summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'test')
-rw-r--r--test/H5srcdir.h1
-rw-r--r--test/accum.c1352
-rw-r--r--test/accum_swmr_reader.c72
-rw-r--r--test/app_ref.c122
-rw-r--r--test/atomic_reader.c121
-rw-r--r--test/atomic_writer.c63
-rw-r--r--test/big.c497
-rw-r--r--test/bittests.c1205
-rw-r--r--test/btree2.c6008
-rw-r--r--test/cache.c36105
-rw-r--r--test/cache_api.c1833
-rw-r--r--test/cache_common.c3889
-rw-r--r--test/cache_common.h1209
-rw-r--r--test/cache_image.c4115
-rw-r--r--test/cache_logging.c101
-rw-r--r--test/cache_tagging.c3034
-rw-r--r--test/chunk_info.c1312
-rw-r--r--test/cmpd_dset.c1952
-rw-r--r--test/cork.c1471
-rw-r--r--test/cross_read.c189
-rw-r--r--test/dangle.c392
-rw-r--r--test/del_many_dense_attrs.c96
-rw-r--r--test/direct_chunk.c1585
-rw-r--r--test/dsets.c12383
-rw-r--r--test/dt_arith.c5414
-rw-r--r--test/dtransform.c960
-rw-r--r--test/dtypes.c6286
-rw-r--r--test/earray.c1475
-rw-r--r--test/efc.c2718
-rw-r--r--test/enc_dec_plist.c452
-rw-r--r--test/enc_dec_plist_cross_platform.c101
-rw-r--r--test/enum.c710
-rw-r--r--test/err_compat.c241
-rw-r--r--test/error_test.c215
-rw-r--r--test/evict_on_close.c515
-rw-r--r--test/extend.c261
-rw-r--r--test/external.c935
-rw-r--r--test/external_common.c49
-rw-r--r--test/external_common.h9
-rw-r--r--test/external_env.c117
-rw-r--r--test/external_fname.h12
-rw-r--r--test/farray.c771
-rw-r--r--test/fheap.c9929
-rw-r--r--test/file_image.c634
-rw-r--r--test/filenotclosed.c65
-rw-r--r--test/fillval.c2434
-rw-r--r--test/filter_fail.c279
-rw-r--r--test/filter_plugin.c328
-rw-r--r--test/filter_plugin1_dsets.c47
-rw-r--r--test/filter_plugin2_dsets.c46
-rw-r--r--test/filter_plugin3_dsets.c55
-rw-r--r--test/filter_plugin4_groups.c56
-rw-r--r--test/flush1.c183
-rw-r--r--test/flush2.c209
-rw-r--r--test/flushrefresh.c1067
-rw-r--r--test/freespace.c1947
-rw-r--r--test/gen_bad_compound.c22
-rw-r--r--test/gen_bad_offset.c69
-rw-r--r--test/gen_bad_ohdr.c66
-rw-r--r--test/gen_bogus.c107
-rw-r--r--test/gen_bounds.c764
-rw-r--r--test/gen_cross.c672
-rw-r--r--test/gen_deflate.c61
-rw-r--r--test/gen_file_image.c44
-rw-r--r--test/gen_filespace.c79
-rw-r--r--test/gen_filters.c180
-rw-r--r--test/gen_mergemsg.c50
-rw-r--r--test/gen_new_array.c68
-rw-r--r--test/gen_new_fill.c87
-rw-r--r--test/gen_new_group.c76
-rw-r--r--test/gen_new_mtime.c13
-rw-r--r--test/gen_new_super.c16
-rw-r--r--test/gen_noencoder.c29
-rw-r--r--test/gen_nullspace.c20
-rw-r--r--test/gen_old_array.c71
-rw-r--r--test/gen_old_group.c26
-rw-r--r--test/gen_old_layout.c30
-rw-r--r--test/gen_old_mtime.c14
-rw-r--r--test/gen_plist.c383
-rw-r--r--test/gen_sizes_lheap.c15
-rw-r--r--test/gen_specmetaread.c26
-rw-r--r--test/gen_udlinks.c104
-rw-r--r--test/genall5.c1189
-rw-r--r--test/genall5.h4
-rw-r--r--test/getname.c3369
-rw-r--r--test/gheap.c317
-rw-r--r--test/h5test.c834
-rw-r--r--test/h5test.h271
-rw-r--r--test/hdfs.c754
-rw-r--r--test/hyperslab.c863
-rw-r--r--test/istore.c512
-rw-r--r--test/lheap.c103
-rw-r--r--test/links.c18310
-rw-r--r--test/links_env.c108
-rw-r--r--test/mf.c4637
-rw-r--r--test/mirror_vfd.c1213
-rw-r--r--test/mount.c3241
-rw-r--r--test/mtime.c117
-rw-r--r--test/ntypes.c2230
-rw-r--r--test/null_vol_connector.c210
-rw-r--r--test/null_vol_connector.h5
-rw-r--r--test/objcopy.c13502
-rw-r--r--test/objcopy_ref.c1584
-rw-r--r--test/ohdr.c1575
-rw-r--r--test/page_buffer.c1294
-rw-r--r--test/pool.c368
-rw-r--r--test/reserved.c363
-rw-r--r--test/ros3.c882
-rw-r--r--test/s3comms.c1661
-rw-r--r--test/set_extent.c1886
-rw-r--r--test/space_overflow.c15
-rw-r--r--test/stab.c1093
-rw-r--r--test/swmr.c4235
-rw-r--r--test/swmr_addrem_writer.c182
-rw-r--r--test/swmr_check_compat_vfd.c7
-rw-r--r--test/swmr_common.c87
-rw-r--r--test/swmr_common.h32
-rw-r--r--test/swmr_generator.c173
-rw-r--r--test/swmr_reader.c240
-rw-r--r--test/swmr_remove_reader.c227
-rw-r--r--test/swmr_remove_writer.c150
-rw-r--r--test/swmr_sparse_reader.c188
-rw-r--r--test/swmr_sparse_writer.c194
-rw-r--r--test/swmr_start_write.c253
-rw-r--r--test/swmr_writer.c186
-rw-r--r--test/tarray.c1164
-rw-r--r--test/tattr.c3760
-rw-r--r--test/tcheck_version.c70
-rw-r--r--test/tchecksum.c44
-rw-r--r--test/tconfig.c47
-rw-r--r--test/tcoords.c392
-rw-r--r--test/testframe.c331
-rw-r--r--test/testhdf5.c45
-rw-r--r--test/testhdf5.h274
-rw-r--r--test/testmeta.c108
-rw-r--r--test/tfile.c2620
-rw-r--r--test/tgenprop.c783
-rw-r--r--test/th5o.c400
-rw-r--r--test/th5s.c1283
-rw-r--r--test/theap.c516
-rw-r--r--test/thread_id.c56
-rw-r--r--test/tid.c365
-rw-r--r--test/timer.c151
-rw-r--r--test/titerate.c560
-rw-r--r--test/tmeta.c106
-rw-r--r--test/tmisc.c2169
-rw-r--r--test/trefer.c949
-rw-r--r--test/trefer_deprec.c627
-rw-r--r--test/trefer_shutdown.c2
-rw-r--r--test/trefstr.c167
-rw-r--r--test/tselect.c12065
-rw-r--r--test/tskiplist.c1007
-rw-r--r--test/tsohm.c1459
-rw-r--r--test/ttime.c96
-rw-r--r--test/ttsafe.c42
-rw-r--r--test/ttsafe.h26
-rw-r--r--test/ttsafe_acreate.c72
-rw-r--r--test/ttsafe_attr_vlen.c53
-rw-r--r--test/ttsafe_cancel.c117
-rw-r--r--test/ttsafe_dcreate.c82
-rw-r--r--test/ttsafe_error.c68
-rw-r--r--test/ttst.c220
-rw-r--r--test/tunicode.c1128
-rw-r--r--test/tvlstr.c382
-rw-r--r--test/tvltypes.c1793
-rw-r--r--test/twriteorder.c237
-rw-r--r--test/unlink.c2406
-rw-r--r--test/unregister.c182
-rw-r--r--test/use.h66
-rw-r--r--test/use_append_chunk.c51
-rw-r--r--test/use_append_chunk_mirror.c74
-rw-r--r--test/use_append_mchunks.c57
-rw-r--r--test/use_common.c306
-rw-r--r--test/use_disable_mdc_flushes.c483
-rw-r--r--test/vds.c8414
-rw-r--r--test/vds_env.c234
-rw-r--r--test/vds_swmr.h20
-rw-r--r--test/vds_swmr_gen.c157
-rw-r--r--test/vds_swmr_reader.c98
-rw-r--r--test/vds_swmr_writer.c98
-rw-r--r--test/vfd.c1686
-rw-r--r--test/vol.c485
-rw-r--r--test/vol_plugin.c167
183 files changed, 125729 insertions, 114474 deletions
diff --git a/test/H5srcdir.h b/test/H5srcdir.h
index 019cfda..07ab90d 100644
--- a/test/H5srcdir.h
+++ b/test/H5srcdir.h
@@ -34,4 +34,3 @@ H5TEST_DLL const char *H5_get_srcdir_filename(const char *filename);
#endif
#endif /* _H5SRCDIR_H */
-
diff --git a/test/accum.c b/test/accum.c
index 4b0ec64..183f955 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -15,23 +15,19 @@
*/
#include "h5test.h"
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
#include "H5Fpkg.h"
#include "H5FDpkg.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Iprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* Filename */
/* (The file names are the same as the define in accum_swmr_reader.c) */
-const char *FILENAME[] = {
- "accum",
- "accum_swmr_big",
- NULL
-};
+const char *FILENAME[] = {"accum", "accum_swmr_big", NULL};
/* The reader forked by test_swmr_write_big() */
#define SWMR_READER "accum_swmr_reader"
@@ -40,10 +36,10 @@ const char *FILENAME[] = {
#define BIG_BUF_SIZE (6 * 1024 * 1024)
/* Random I/O test values */
-#define RANDOM_BUF_SIZE (1 * 1024 * 1024)
+#define RANDOM_BUF_SIZE (1 * 1024 * 1024)
#define MAX_RANDOM_SEGMENTS (5 * 1024)
-#define RAND_SEG_LEN (1024)
-#define RANDOM_BASE_OFF (1024 * 1024)
+#define RAND_SEG_LEN (1024)
+#define RANDOM_BASE_OFF (1024 * 1024)
/* Function Prototypes */
unsigned test_write_read(H5F_t *f);
@@ -64,17 +60,16 @@ unsigned test_swmr_write_big(hbool_t newest_format);
void accum_printf(const H5F_t *f);
/* Private Test H5Faccum Function Wrappers */
-#define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b))
-#define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b))
-#define accum_free(f,a,s) H5F__accum_free(f->shared, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
-#define accum_flush(f) H5F__accum_flush(f->shared)
-#define accum_reset(f) H5F__accum_reset(f->shared, TRUE)
+#define accum_write(a, s, b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b))
+#define accum_read(a, s, b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b))
+#define accum_free(f, a, s) H5F__accum_free(f->shared, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
+#define accum_flush(f) H5F__accum_flush(f->shared)
+#define accum_reset(f) H5F__accum_reset(f->shared, TRUE)
/* ================= */
/* Main Test Routine */
/* ================= */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -91,39 +86,43 @@ void accum_printf(const H5F_t *f);
int
main(void)
{
- unsigned nerrors = 0; /* track errors */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- hid_t fid = -1;
- hid_t fapl = -1; /* File access property list */
- char filename[1024];
- H5F_t * f = NULL; /* File for all tests */
-
+ unsigned nerrors = 0; /* track errors */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t fid = -1;
+ hid_t fapl = -1; /* File access property list */
+ char filename[1024];
+ H5F_t * f = NULL; /* File for all tests */
/* Test Setup */
HDputs("Testing the metadata accumulator");
/* File access property list */
h5_reset();
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Create a test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Get H5F_t * to internal file structure */
- if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
+ FAIL_STACK_ERROR
/* We'll be writing lots of garbage data, so extend the
file a ways. 10MB should do. */
- if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_DEFAULT, (haddr_t)(1024*1024*10)) < 0) FAIL_STACK_ERROR
+ if (H5FD_set_eoa(f->shared->lf, H5FD_MEM_DEFAULT, (haddr_t)(1024 * 1024 * 10)) < 0)
+ FAIL_STACK_ERROR
/* Reset metadata accumulator for the file */
- if(accum_reset(f) < 0) FAIL_STACK_ERROR
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR
/* Test Functions */
nerrors += test_write_read(f);
@@ -140,17 +139,19 @@ main(void)
nerrors += test_random_write(f);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
/* End of test code, close and delete file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* This test uses a different file */
nerrors += test_swmr_write_big(TRUE);
nerrors += test_swmr_write_big(FALSE);
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All metadata accumulator tests passed.");
h5_cleanup(FILENAME, fapl);
@@ -158,7 +159,8 @@ main(void)
return 0;
error:
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
HDputs("*** TESTS FAILED ***");
return 1;
@@ -168,7 +170,6 @@ error:
/* Individual Unit Test Routines */
/* ============================= */
-
/*-------------------------------------------------------------------------
* Function: test_write_read
*
@@ -185,7 +186,7 @@ error:
unsigned
test_write_read(H5F_t *f)
{
- int i = 0;
+ int i = 0;
int *write_buf, *read_buf;
TESTING("simple write/read to/from metadata accumulator");
@@ -197,16 +198,20 @@ test_write_read(H5F_t *f)
HDassert(read_buf);
/* Fill buffer with data, zero out read buffer */
- for(i = 0; i < 1024; i++)
+ for (i = 0; i < 1024; i++)
write_buf[i] = i + 1;
/* Do a simple write/read/verify of data */
/* Write 1KB at Address 0 */
- if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
- if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
+ if (accum_write(0, 1024, write_buf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(0, 1024, read_buf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(write_buf, read_buf, (size_t)1024) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -224,7 +229,6 @@ error:
return 1;
} /* test_write_read */
-
/*-------------------------------------------------------------------------
* Function: test_write_read_nonacc_front
*
@@ -241,7 +245,7 @@ error:
unsigned
test_write_read_nonacc_front(H5F_t *f)
{
- int i = 0;
+ int i = 0;
int *write_buf, *read_buf;
TESTING("simple write/read to/from before metadata accumulator");
@@ -253,19 +257,26 @@ test_write_read_nonacc_front(H5F_t *f)
HDassert(read_buf);
/* Fill buffer with data, zero out read buffer */
- for(i = 0; i < 2048; i++)
+ for (i = 0; i < 2048; i++)
write_buf[i] = i + 1;
/* Do a simple write/read/verify of data */
/* Write 1KB at Address 0 */
- if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
- if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR;
- if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
+ if (accum_write(0, 1024, write_buf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_write(1024, 1024, write_buf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(0, 1024, read_buf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(write_buf, read_buf, (size_t)1024) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -283,7 +294,6 @@ error:
return 1;
} /* test_write_read */
-
/*-------------------------------------------------------------------------
* Function: test_write_read_nonacc_end
*
@@ -300,7 +310,7 @@ error:
unsigned
test_write_read_nonacc_end(H5F_t *f)
{
- int i = 0;
+ int i = 0;
int *write_buf, *read_buf;
TESTING("simple write/read to/from after metadata accumulator");
@@ -312,19 +322,26 @@ test_write_read_nonacc_end(H5F_t *f)
HDassert(read_buf);
/* Fill buffer with data, zero out read buffer */
- for(i = 0; i < 2048; i++)
+ for (i = 0; i < 2048; i++)
write_buf[i] = i + 1;
/* Do a simple write/read/verify of data */
/* Write 1KB at Address 0 */
- if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR;
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
- if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
- if(accum_read(1024, 1024, read_buf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
+ if (accum_write(1024, 1024, write_buf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_write(0, 1024, write_buf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(1024, 1024, read_buf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(write_buf, read_buf, (size_t)1024) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -342,7 +359,6 @@ error:
return 1;
} /* test_write_read */
-
/*-------------------------------------------------------------------------
* Function: test_free
*
@@ -359,9 +375,9 @@ error:
unsigned
test_free(H5F_t *f)
{
- int i = 0;
- int32_t *wbuf = NULL;
- int32_t *rbuf = NULL;
+ int i = 0;
+ int32_t *wbuf = NULL;
+ int32_t *rbuf = NULL;
int32_t *expect = NULL;
TESTING("simple freeing metadata accumulator");
@@ -375,133 +391,179 @@ test_free(H5F_t *f)
HDassert(expect);
/* Fill buffer with data */
- for(i = 0; i < 256; i++)
+ for (i = 0; i < 256; i++)
wbuf[i] = (int32_t)(i + 1);
- if(accum_write(0, 256 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 256 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
- if(accum_free(f, 0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 0, 256 * sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Free an empty accumulator */
- if(accum_free(f, 0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 0, 256 * 1024 * sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Write second quarter of the accumulator */
- if(accum_write(64 * sizeof(int32_t), 64 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(64 * sizeof(int32_t), 64 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Free the second quarter of the accumulator, the requested area
* is bigger than the data region on the right side. */
- if(accum_free(f, 64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
-
+ if (accum_free(f, 64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Write half of the accumulator. */
- if(accum_write(0, 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 128 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Free the first block of 4B */
- if(accum_free(f, 0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 0, sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
- if(accum_read(1 * sizeof(int32_t), 127 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf + 1, rbuf, 127 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_read(1 * sizeof(int32_t), 127 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf + 1, rbuf, 127 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Free the block of 4B at 127*4B */
- if(accum_free(f, 127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 127 * sizeof(int32_t), sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
- if(accum_read(1 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf + 1, rbuf, 126 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_read(1 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf + 1, rbuf, 126 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Free the block of 4B at 2*4B */
- if(accum_free(f, 2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 2 * sizeof(int32_t), sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
- if(accum_read(1 * sizeof(int32_t), 1 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf + 1, rbuf, 1 * sizeof(int32_t)) != 0) TEST_ERROR;
- if(accum_read(3 * sizeof(int32_t), 124 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf + 3, rbuf, 124 * sizeof(int32_t)) != 0) TEST_ERROR;
-
+ if (accum_read(1 * sizeof(int32_t), 1 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf + 1, rbuf, 1 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
+ if (accum_read(3 * sizeof(int32_t), 124 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf + 3, rbuf, 124 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Test freeing section that overlaps the start of the accumulator and is
* entirely before dirty section */
- if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t));
- if(accum_free(f, 62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
- if(accum_read(66 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(expect + 66, rbuf, 126 * sizeof(int32_t)) != 0) TEST_ERROR;
-
+ if (accum_read(66 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(expect + 66, rbuf, 126 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Test freeing section that overlaps the start of the accumulator and
* completely contains dirty section */
- if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t));
- if(accum_free(f, 62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
- if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(expect + 78, rbuf, 114 * sizeof(int32_t)) != 0) TEST_ERROR;
-
+ if (accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(expect + 78, rbuf, 114 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Test freeing section completely contained in accumulator and is entirely
* before dirty section */
- if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(f, 66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
- if(accum_read(70 * sizeof(int32_t), 122 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(expect + 70, rbuf, 122 * sizeof(int32_t)) != 0) TEST_ERROR;
-
+ if (accum_read(70 * sizeof(int32_t), 122 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(expect + 70, rbuf, 122 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Test freeing section completely contained in accumulator, starts before
* dirty section, and ends in dirty section */
- if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(f, 70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
- if(accum_read(74 * sizeof(int32_t), 118 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(expect + 74, rbuf, 118 * sizeof(int32_t)) != 0) TEST_ERROR;
-
+ if (accum_read(74 * sizeof(int32_t), 118 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(expect + 74, rbuf, 118 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Test freeing section completely contained in accumulator and completely
* contains dirty section */
- if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(f, 70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
- if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(expect + 78, rbuf, 114 * sizeof(int32_t)) != 0) TEST_ERROR;
-
+ if (accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(expect + 78, rbuf, 114 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Test freeing section completely contained in accumulator, starts at start
* of dirty section, and ends in dirty section */
- if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- if(accum_write(72 * sizeof(int32_t), 8 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_write(72 * sizeof(int32_t), 8 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 8 * sizeof(int32_t));
- if(accum_free(f, 72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if (accum_free(f, 72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0)
+ FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
- if(accum_read(76 * sizeof(int32_t), 116 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(expect + 76, rbuf, 116 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_read(76 * sizeof(int32_t), 116 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(expect + 76, rbuf, 116 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
HDfree(wbuf);
wbuf = NULL;
@@ -510,24 +572,24 @@ test_free(H5F_t *f)
HDfree(expect);
expect = NULL;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
return 0;
error:
- if(wbuf)
+ if (wbuf)
HDfree(wbuf);
- if(rbuf)
+ if (rbuf)
HDfree(rbuf);
- if(expect)
+ if (expect)
HDfree(expect);
return 1;
} /* test_free */
-
/*-------------------------------------------------------------------------
* Function: test_accum_overlap
*
@@ -546,7 +608,7 @@ error:
unsigned
test_accum_overlap(H5F_t *f)
{
- int i = 0;
+ int i = 0;
int32_t *wbuf, *rbuf;
TESTING("overlapping write to metadata accumulator");
@@ -561,126 +623,162 @@ test_accum_overlap(H5F_t *f)
/* Write 10 1's at address 40 */
/* @0:| 1111111111| */
/* Put some data in the accumulator initially */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
wbuf[i] = 1;
- if(accum_write(40, 10 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(40, 10 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(40, 10 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(40, 10 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 2: End of new piece aligns with start of accumulated data */
/* Write 5 2's at address 20 */
/* @0:| 222221111111111| */
- for(i = 0; i < 5; i++)
+ for (i = 0; i < 5; i++)
wbuf[i] = 2;
- if(accum_write(20, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(20, 5 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(20, 5 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(20, 5 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 3: Start of new piece aligns with start of accumulated data */
/* Write 3 3's at address 20 */
/* @0:| 333221111111111| */
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
wbuf[i] = 3;
- if(accum_write(20, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(20, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(20, 3 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(20, 3 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 4: New piece overlaps start of accumulated data */
/* Write 5 4's at address 8 */
/* @0:| 444443221111111111| */
- for(i = 0; i < 5; i++)
+ for (i = 0; i < 5; i++)
wbuf[i] = 4;
- if(accum_write(8, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(8, 5 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(8, 5 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(8, 5 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 5: New piece completely within accumulated data */
/* Write 4 5's at address 48 */
/* @0:| 444443221155551111| */
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
wbuf[i] = 5;
- if(accum_write(48, 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(48, 4 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(48, 4 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(48, 4 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 6: End of new piece aligns with end of accumulated data */
/* Write 3 6's at address 68 */
/* @0:| 444443221155551666| */
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
wbuf[i] = 6;
- if(accum_write(68, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(68, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(68, 3 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(68, 3 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 7: New piece overlaps end of accumulated data */
/* Write 5 7's at address 76 */
/* @0:| 4444432211555516677777| */
- for(i = 0; i < 5; i++)
+ for (i = 0; i < 5; i++)
wbuf[i] = 7;
- if(accum_write(76, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(76, 5 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(76, 5 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(76, 5 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 8: Start of new piece aligns with end of accumulated data */
/* Write 3 8's at address 96 */
/* @0:| 4444432211555516677777888| */
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
wbuf[i] = 8;
- if(accum_write(96, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(96, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(96, 3 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(96, 3 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Set up expected data buffer and verify contents of
accumulator as constructed by cases 1-8, above */
- for(i = 0; i < 5; i++)
+ for (i = 0; i < 5; i++)
wbuf[i] = 4;
- for(i = 5; i < 6; i++)
+ for (i = 5; i < 6; i++)
wbuf[i] = 3;
- for(i = 6; i < 8; i++)
+ for (i = 6; i < 8; i++)
wbuf[i] = 2;
- for(i = 8; i < 10; i++)
+ for (i = 8; i < 10; i++)
wbuf[i] = 1;
- for(i = 10; i < 14; i++)
+ for (i = 10; i < 14; i++)
wbuf[i] = 5;
- for(i = 14; i < 15; i++)
+ for (i = 14; i < 15; i++)
wbuf[i] = 1;
- for(i = 15; i < 17; i++)
+ for (i = 15; i < 17; i++)
wbuf[i] = 6;
- for(i = 17; i < 22; i++)
+ for (i = 17; i < 22; i++)
wbuf[i] = 7;
- for(i = 22; i < 25; i++)
+ for (i = 22; i < 25; i++)
wbuf[i] = 8;
- if(accum_read(8, 25 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 25 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_read(8, 25 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 25 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 9: New piece completely before accumulated data */
/* Write 1 9 at address 0 */
/* @0:|9 4444432211555516677777888| */
- for(i = 0; i < 1; i++)
+ for (i = 0; i < 1; i++)
wbuf[i] = 9;
- if(accum_write(0, 1 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(0, 1 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 1 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(0, 1 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(0, 1 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 1 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 10: New piece completely after accumulated data */
/* Write 4 3's at address 116 */
/* @0:|9 4444432211555516677777888 3333| */
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
wbuf[i] = 3;
- if(accum_write(116, 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(116, 4 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(116, 4 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(116, 4 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 11: New piece completely overlaps accumulated data */
/* Write 6 4's at address 112 */
/* @0:|9 4444432211555516677777888 444444| */
- for(i = 0; i < 6; i++)
+ for (i = 0; i < 6; i++)
wbuf[i] = 4;
- if(accum_write(112, 6 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(112, 6 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 6 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(112, 6 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(112, 6 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 6 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -698,7 +796,6 @@ error:
return 1;
} /* test_accum_overlap */
-
/*-------------------------------------------------------------------------
* Function: test_accum_overlap_clean
*
@@ -718,7 +815,7 @@ error:
unsigned
test_accum_overlap_clean(H5F_t *f)
{
- int i = 0;
+ int i = 0;
int32_t *wbuf, *rbuf;
TESTING("overlapping write to partially clean metadata accumulator");
@@ -733,134 +830,175 @@ test_accum_overlap_clean(H5F_t *f)
/* Write 10 1's at address 40 */
/* @0:| 1111111111| */
/* Put some data in the accumulator initially */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
wbuf[i] = 1;
- if(accum_write(40, 10 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(40, 10 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(40, 10 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(40, 10 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 2: End of new piece aligns with start of clean accumulated data */
/* Write 5 2's at address 20 */
/* @0:| 222221111111111| */
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- for(i = 0; i < 5; i++)
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ for (i = 0; i < 5; i++)
wbuf[i] = 2;
- if(accum_write(20, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(20, 5 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(20, 5 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(20, 5 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 5 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 3: Start of new piece aligns with start of accumulated data,
* completely encloses dirty section of accumulator */
/* Write 6 3's at address 20 */
/* @0:| 333333111111111| */
- for(i = 0; i < 6; i++)
+ for (i = 0; i < 6; i++)
wbuf[i] = 3;
- if(accum_write(20, 6 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(20, 6 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 6 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(20, 6 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(20, 6 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 6 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 4: New piece completely within accumulated data, overlaps
* end of dirty section of accumulator */
/* Write 2 4's at address 40 */
/* @0:| 333334411111111| */
- for(i = 0; i < 2; i++)
+ for (i = 0; i < 2; i++)
wbuf[i] = 4;
- if(accum_write(40, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(40, 2 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(40, 2 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(40, 2 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 5: New piece completely within accumulated data, completely
* after dirty section of accumulator */
/* Write 2 5's at address 52 */
/* @0:| 333334415511111| */
- for(i = 0; i < 2; i++)
+ for (i = 0; i < 2; i++)
wbuf[i] = 5;
- if(accum_write(52, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(52, 2 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(52, 2 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(52, 2 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 6: New piece completely within clean accumulated data */
/* Write 3 6's at address 44 */
/* @0:| 333334666511111| */
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- for(i = 0; i < 3; i++)
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ for (i = 0; i < 3; i++)
wbuf[i] = 6;
- if(accum_write(44, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(44, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(44, 3 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(44, 3 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 7: New piece overlaps start of clean accumulated data */
/* Write 2 7's at address 16 */
/* @0:| 7733334666511111| */
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- for(i = 0; i < 2; i++)
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ for (i = 0; i < 2; i++)
wbuf[i] = 7;
- if(accum_write(16, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(16, 2 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(16, 2 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(16, 2 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 8: New piece overlaps start of accumulated data, completely
* encloses dirty section of accumulator */
/* Write 4 8's at address 12 */
/* @0:| 88883334666511111| */
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
wbuf[i] = 8;
- if(accum_write(12, 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(12, 4 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(12, 4 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(12, 4 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 9: Start of new piece aligns with end of clean accumulated data */
/* Write 3 9's at address 80 */
/* @0:| 88883334666511111999| */
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- for(i = 0; i < 3; i++)
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ for (i = 0; i < 3; i++)
wbuf[i] = 9;
- if(accum_write(80, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(80, 3 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(80, 3 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(80, 3 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 3 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 10: New piece overlaps end of clean accumulated data */
/* Write 3 2's at address 88 */
/* @0:| 888833346665111119922| */
- if(accum_flush(f) < 0) FAIL_STACK_ERROR;
- for(i = 0; i < 2; i++)
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR;
+ for (i = 0; i < 2; i++)
wbuf[i] = 2;
- if(accum_write(88, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(88, 2 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(88, 2 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(88, 2 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 2 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 11: New piece overlaps end of accumulated data, completely encloses
* dirty section of accumulator */
/* Write 4 7's at address 84 */
/* @0:| 8888333466651111197777| */
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
wbuf[i] = 7;
- if(accum_write(84, 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(84, 4 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(84, 4 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(84, 4 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 4 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Set up expected data buffer and verify contents of
accumulator as constructed by cases 1-11, above */
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
wbuf[i] = 8;
- for(i = 4; i < 7; i++)
+ for (i = 4; i < 7; i++)
wbuf[i] = 3;
- for(i = 7; i < 8; i++)
+ for (i = 7; i < 8; i++)
wbuf[i] = 4;
- for(i = 8; i < 11; i++)
+ for (i = 8; i < 11; i++)
wbuf[i] = 6;
- for(i = 11; i < 12; i++)
+ for (i = 11; i < 12; i++)
wbuf[i] = 5;
- for(i = 12; i < 17; i++)
+ for (i = 12; i < 17; i++)
wbuf[i] = 1;
- for(i = 17; i < 18; i++)
+ for (i = 17; i < 18; i++)
wbuf[i] = 9;
- for(i = 18; i < 22; i++)
+ for (i = 18; i < 22; i++)
wbuf[i] = 7;
- if(accum_read(12, 22 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 22 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_read(12, 22 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 22 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -878,7 +1016,6 @@ error:
return 1;
} /* test_accum_overlap_clean */
-
/*-------------------------------------------------------------------------
* Function: test_accum_non_overlap_size
*
@@ -897,7 +1034,7 @@ error:
unsigned
test_accum_non_overlap_size(H5F_t *f)
{
- int i = 0;
+ int i = 0;
int32_t *wbuf, *rbuf;
TESTING("non-overlapping write to accumulator larger then accum_size");
@@ -912,22 +1049,29 @@ test_accum_non_overlap_size(H5F_t *f)
/* Write 10 1's at address 140 */
/* @0:| 1111111111| */
/* Put some data in the accumulator initially */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
wbuf[i] = 1;
- if(accum_write(140, 10 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(140, 10 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(140, 10 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(140, 10 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 9: New piece completely before accumulated data */
/* Write 20 9 at address 0 */
/* @0:|9 1111111111| */
- for(i = 0; i < 20; i++)
+ for (i = 0; i < 20; i++)
wbuf[i] = 9;
- if(accum_write(0, 20 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(0, 20 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 20 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(0, 20 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(0, 20 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 20 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -964,7 +1108,7 @@ error:
unsigned
test_accum_overlap_size(H5F_t *f)
{
- int i = 0;
+ int i = 0;
int32_t *wbuf, *rbuf;
TESTING("overlapping write to accumulator larger then accum_size");
@@ -979,22 +1123,29 @@ test_accum_overlap_size(H5F_t *f)
/* Write 10 1's at address 64 */
/* @0:| 1111111111| */
/* Put some data in the accumulator initially */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
wbuf[i] = 1;
- if(accum_write(64, 10 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(64, 10 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(64, 10 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(64, 10 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 10 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
/* Case 9: New piece completely before accumulated data */
/* Write 72 9 at address 60 */
/* @0:|9 1111111111| */
- for(i = 0; i < 72; i++)
+ for (i = 0; i < 72; i++)
wbuf[i] = 9;
- if(accum_write(60, 72 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(60, 72 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 72 * sizeof(int32_t)) != 0) TEST_ERROR;
+ if (accum_write(60, 72 * sizeof(int32_t), wbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(60, 72 * sizeof(int32_t), rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, 72 * sizeof(int32_t)) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -1012,7 +1163,6 @@ error:
return 1;
} /* test_accum_overlap_size */
-
/*-------------------------------------------------------------------------
* Function: test_accum_adjust
*
@@ -1042,8 +1192,8 @@ error:
unsigned
test_accum_adjust(H5F_t *f)
{
- int i = 0;
- int s = 1048576; /* size of buffer */
+ int i = 0;
+ int s = 1048576; /* size of buffer */
int32_t *wbuf, *rbuf;
TESTING("accumulator adjustments after append/prepend of data");
@@ -1055,7 +1205,7 @@ test_accum_adjust(H5F_t *f)
HDassert(rbuf);
/* Fill up write buffer */
- for(i = 0; i < s; i++)
+ for (i = 0; i < s; i++)
wbuf[i] = i + 1;
/* ================================================================ */
@@ -1066,7 +1216,8 @@ test_accum_adjust(H5F_t *f)
* but not quite full. This will force the accumulator to, on subsequent
* writes, a) have to adjust since it's nearly full, and b) prevent
* an increase in size because it's already at it's maximum size */
- if(accum_write((1024 * 1024), (1024 * 1024) - 1, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write((1024 * 1024), (1024 * 1024) - 1, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a small (1KB) block that prepends to the front of the accumulator. */
/* ==> Accumulator will need more buffer space */
@@ -1075,18 +1226,24 @@ test_accum_adjust(H5F_t *f)
/* ==> New block is being prepended to accumulator */
/* ==> Accumulator is dirty, it will be flushed. */
/* ==> Dirty region overlaps region to eliminate from accumulator */
- if(accum_write((1024 * 1024) - 1024, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write((1024 * 1024) - 1024, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read back and verify first write */
- if(accum_read((1024 * 1024), (1024 * 1024) - 1, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (size_t)((1024 * 1024) - 1)) != 0) TEST_ERROR;
+ if (accum_read((1024 * 1024), (1024 * 1024) - 1, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)((1024 * 1024) - 1)) != 0)
+ TEST_ERROR;
/* Read back and verify second write */
- if(accum_read((1024 * 1024) - 1024, 1024, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
+ if (accum_read((1024 * 1024) - 1024, 1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)1024) != 0)
+ TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* ================================================================ */
/* Case 2: Prepending large block to large, fully dirty accumulator */
@@ -1096,7 +1253,8 @@ test_accum_adjust(H5F_t *f)
* but not quite full. This will force the accumulator to, on subsequent
* writes, a) have to adjust since it's nearly full, and b) prevent
* an increase in size because it's already at it's maximum size */
- if(accum_write((1024 * 1024), (1024 * 1024) - 1, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write((1024 * 1024), (1024 * 1024) - 1, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a large (just under 1MB) block to the front of the accumulator. */
/* ==> Accumulator will need more buffer space */
@@ -1105,17 +1263,23 @@ test_accum_adjust(H5F_t *f)
/* ==> New block is being prepended to accumulator */
/* ==> Accumulator is dirty, it will be flushed. */
/* ==> Dirty region overlaps region to eliminate from accumulator */
- if(accum_write(5, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(5, (1024 * 1024) - 5, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read back and verify both pieces of data */
- if(accum_read(1048576, 1048575, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (size_t)1048576) != 0) TEST_ERROR;
+ if (accum_read(1048576, 1048575, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)1048576) != 0)
+ TEST_ERROR;
- if(accum_read(5, 1048571, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (size_t)1048571) != 0) TEST_ERROR;
+ if (accum_read(5, 1048571, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)1048571) != 0)
+ TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* ========================================================= */
/* Case 3: Appending small block to large, clean accumulator */
@@ -1125,11 +1289,13 @@ test_accum_adjust(H5F_t *f)
* but not quite full. This will force the accumulator to, on subsequent
* writes, a) have to adjust since it's nearly full, and b) prevent
* an increase in size because it's already at it's maximum size */
- if(accum_write(0, (1024 * 1024) - 1, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, (1024 * 1024) - 1, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Flush the accumulator -- we want to test the case when
accumulator contains clean data */
- if(accum_flush(f) < 0) FAIL_STACK_ERROR
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR
/* Write a small (1KB) block to the end of the accumulator */
/* ==> Accumulator will need more buffer space */
@@ -1138,19 +1304,24 @@ test_accum_adjust(H5F_t *f)
/* ==> New block being appended to accumulator */
/* ==> Accumulator is NOT dirty */
/* ==> Since we're appending, need to adjust location of accumulator */
- if(accum_write((1024 * 1024) - 1, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write((1024 * 1024) - 1, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a piece of metadata outside current accumulator to force write
to disk */
- if(accum_write(0, 1, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 1, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
- if(accum_read((1024 * 1024) - 1, 1024, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
+ if (accum_read((1024 * 1024) - 1, 1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)1024) != 0)
+ TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* ==================================================================== */
/* Case 4: Appending small block to large, partially dirty accumulator, */
@@ -1161,13 +1332,16 @@ test_accum_adjust(H5F_t *f)
* but not quite full. This will force the accumulator to, on subsequent
* writes, a) have to adjust since it's nearly full, and b) prevent
* an increase in size because it's already at it's maximum size */
- if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, (1024 * 1024) - 5, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Flush the accumulator to clean it */
- if(accum_flush(f) < 0) FAIL_STACK_ERROR
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR
/* write to part of the accumulator so just the start of it is dirty */
- if(accum_write(0, 5, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 5, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a small (~340KB) piece of data to the other end of the accumulator */
/* ==> Accumulator will need more buffer space */
@@ -1178,19 +1352,24 @@ test_accum_adjust(H5F_t *f)
/* ==> Max Buffer Size - (dirty offset + adjust size) >= 2 * size) */
/* ==> Need to adjust location of accumulator while appending */
/* ==> Accumulator will need to be reallocated */
- if(accum_write(1048571, 349523, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1048571, 349523, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a piece of metadata outside current accumulator to force write
to disk */
- if(accum_write(1398900, 1, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1398900, 1, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
- if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (size_t)349523) != 0) TEST_ERROR;
+ if (accum_read(1048571, 349523, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)349523) != 0)
+ TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* ==================================================================== */
/* Case 5: Appending small block to large, partially dirty accumulator, */
@@ -1198,14 +1377,17 @@ test_accum_adjust(H5F_t *f)
/* ==================================================================== */
/* Write data to the accumulator to fill it just under max size (but not full) */
- if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, (1024 * 1024) - 5, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Flush the accumulator to clean it */
- if(accum_flush(f) < 0) FAIL_STACK_ERROR
+ if (accum_flush(f) < 0)
+ FAIL_STACK_ERROR
/* write to part of the accumulator so it's dirty, but not entirely dirty */
/* (just the begging few bytes will be clean) */
- if(accum_write(10, (1024 * 1024) - 15, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(10, (1024 * 1024) - 15, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a small piece of data to the dirty end of the accumulator */
/* ==> Accumulator will need more buffer space */
@@ -1215,19 +1397,24 @@ test_accum_adjust(H5F_t *f)
/* ==> We can slide the dirty region down, to accomodate the request */
/* ==> Max Buffer Size - (dirty offset + adjust size) < 2 * size) */
/* ==> Need to adjust location of accumulator while appending */
- if(accum_write((1024 * 1024) - 5, 10, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write((1024 * 1024) - 5, 10, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a piece of metadata outside current accumulator to force write
to disk */
- if(accum_write(0, 1, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 1, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
- if(accum_read((1024 * 1024) - 5, 10, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (size_t)10) != 0) TEST_ERROR;
+ if (accum_read((1024 * 1024) - 5, 10, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)10) != 0)
+ TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* ================================================================= */
/* Case 6: Appending small block to large, fully dirty accumulator */
@@ -1237,7 +1424,8 @@ test_accum_adjust(H5F_t *f)
* but not quite full. This will force the accumulator to, on subsequent
* writes, a) have to adjust since it's nearly full, and b) prevent
* an increase in size because it's already at it's maximum size */
- if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, (1024 * 1024) - 5, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a small (~340KB) piece of data to the end of the accumulator */
/* ==> Accumulator will need more buffer space */
@@ -1247,18 +1435,23 @@ test_accum_adjust(H5F_t *f)
/* ==> We cannot slide dirty region down, it's all dirty */
/* ==> Dirty region overlaps region to eliminate from accumulator */
/* ==> Need to adjust location of accumulator while appending */
- if(accum_write(1048571, 349523, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1048571, 349523, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a piece of metadata outside current accumulator to force write
to disk */
- if(accum_write(1398900, 1, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1398900, 1, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
- if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (size_t)349523) != 0) TEST_ERROR;
+ if (accum_read(1048571, 349523, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)349523) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -1276,7 +1469,6 @@ error:
return 1;
} /* test_accum_adjust */
-
/*-------------------------------------------------------------------------
* Function: test_read_after
*
@@ -1298,8 +1490,8 @@ error:
unsigned
test_read_after(H5F_t *f)
{
- int i = 0;
- int s = 128; /* size of buffer */
+ int i = 0;
+ int s = 128; /* size of buffer */
int32_t *wbuf, *rbuf;
TESTING("reading data from both accumulator and disk");
@@ -1311,37 +1503,44 @@ test_read_after(H5F_t *f)
HDassert(rbuf);
/* Fill up write buffer with 1s */
- for(i = 0; i < s; i++)
+ for (i = 0; i < s; i++)
wbuf[i] = 1;
/* Write data to the accumulator to fill it. */
- if(accum_write(512, 512, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(512, 512, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write a piece of metadata outside current accumulator to force write
to disk */
- if(accum_write(0, 1, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 1, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Fill up write buffer with 2s */
- for(i = 0; i < s; i++)
+ for (i = 0; i < s; i++)
wbuf[i] = 2;
/* Write a block of 2s of the original size that will overlap the lower half
of the original block */
- if(accum_write(256, 512, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(256, 512, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read 128 bytes at the original address, and then */
- if(accum_read(512, 512, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(512, 512, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Set the second half of wbuf back to 1s */
- for(i = 64; i < s; i++)
+ for (i = 64; i < s; i++)
wbuf[i] = 1;
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
- if(accum_read(512, 512, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (size_t)128) != 0) TEST_ERROR;
+ if (accum_read(512, 512, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)128) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -1359,7 +1558,6 @@ error:
return 1;
} /* end test_read_after */
-
/*-------------------------------------------------------------------------
* Function: test_big
*
@@ -1377,8 +1575,8 @@ error:
unsigned
test_big(H5F_t *f)
{
- uint8_t *wbuf, *wbuf2, *rbuf, *zbuf; /* Buffers for reading & writing, etc */
- unsigned u; /* Local index variable */
+ uint8_t *wbuf, *wbuf2, *rbuf, *zbuf; /* Buffers for reading & writing, etc */
+ unsigned u; /* Local index variable */
/* Allocate space for the write & read buffers */
wbuf = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE);
@@ -1391,262 +1589,320 @@ test_big(H5F_t *f)
HDassert(zbuf);
/* Initialize write buffers */
- for(u = 0; u < BIG_BUF_SIZE; u++) {
- wbuf[u] = (uint8_t)u;
+ for (u = 0; u < BIG_BUF_SIZE; u++) {
+ wbuf[u] = (uint8_t)u;
wbuf2[u] = (uint8_t)(u + 1);
} /* end for */
TESTING("large metadata I/O operations");
/* Write large data segment to file */
- if(accum_write(0, BIG_BUF_SIZE, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, BIG_BUF_SIZE, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read entire segment back from file */
- if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
-
+ if (HDmemcmp(wbuf, rbuf, (size_t)BIG_BUF_SIZE) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, BIG_BUF_SIZE, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section to middle of accumulator */
- if(accum_write(1024, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1024, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read entire segment back from file */
/* (Read covers entire dirty region) */
- if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf, rbuf + 1024, (size_t)1024) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + 2048, (size_t)(BIG_BUF_SIZE - 2048)) != 0) TEST_ERROR;
-
+ if (HDmemcmp(zbuf, rbuf, (size_t)1024) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(wbuf, rbuf + 1024, (size_t)1024) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(zbuf, rbuf + 2048, (size_t)(BIG_BUF_SIZE - 2048)) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(1024, 1024, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1024, 1024, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section to overlap with end of "big" region */
- if(accum_write(BIG_BUF_SIZE - 512, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(BIG_BUF_SIZE - 512, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read entire segment back from file */
/* (Read covers bottom half of dirty region) */
- if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, (size_t)(BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf, rbuf + (BIG_BUF_SIZE - 512), (size_t)512) != 0) TEST_ERROR;
-
+ if (HDmemcmp(zbuf, rbuf, (size_t)(BIG_BUF_SIZE - 512)) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(wbuf, rbuf + (BIG_BUF_SIZE - 512), (size_t)512) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(BIG_BUF_SIZE - 512, 1024, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(BIG_BUF_SIZE - 512, 1024, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section to overlap with beginning of "big" region */
- if(accum_write(0, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read entire segment back from file */
/* (Read covers bottom half of dirty region) */
- if(accum_read(512, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(512, BIG_BUF_SIZE, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf + 512, rbuf, (size_t)512) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + 512, (size_t)(BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
-
+ if (HDmemcmp(wbuf + 512, rbuf, (size_t)512) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(zbuf, rbuf + 512, (size_t)(BIG_BUF_SIZE - 512)) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(0, 1024, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 1024, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section to middle of accumulator */
/* (With write buffer #1) */
- if(accum_write(1024, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1024, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write entire segment to from file */
/* (With write buffer #2) */
/* (Write covers entire dirty region) */
- if(accum_write(0, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, BIG_BUF_SIZE, wbuf2) < 0)
+ FAIL_STACK_ERROR;
/* Read entire segment back from file */
- if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
-
+ if (HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, BIG_BUF_SIZE, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section to overlap with end of "big" region */
/* (With write buffer #1) */
- if(accum_write(BIG_BUF_SIZE - 512, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(BIG_BUF_SIZE - 512, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write entire segment to from file */
/* (With write buffer #2) */
/* (Read covers bottom half of dirty region) */
- if(accum_write(0, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, BIG_BUF_SIZE, wbuf2) < 0)
+ FAIL_STACK_ERROR;
/* Read both segments back from file */
- if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf + 512, rbuf + BIG_BUF_SIZE, (size_t)512) != 0) TEST_ERROR;
-
+ if (HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(wbuf + 512, rbuf + BIG_BUF_SIZE, (size_t)512) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(0, BIG_BUF_SIZE + 512, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, BIG_BUF_SIZE + 512, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 512));
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section to be past "big" region */
/* (With write buffer #1) */
- if(accum_write(BIG_BUF_SIZE + 512, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(BIG_BUF_SIZE + 512, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read section before "big" region */
/* (To enlarge accumulator, to it will intersect with big write) */
- if(accum_read(BIG_BUF_SIZE - 512, 1024, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(BIG_BUF_SIZE - 512, 1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write entire segment to from file */
/* (With write buffer #2) */
/* (Doesn't overlap with small section) */
- if(accum_write(0, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, BIG_BUF_SIZE, wbuf2) < 0)
+ FAIL_STACK_ERROR;
/* Read both segments & gap back from file */
- if(accum_read(0, BIG_BUF_SIZE + 1024, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE + 1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + BIG_BUF_SIZE, (size_t)512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf, rbuf + BIG_BUF_SIZE + 512, (size_t)512) != 0) TEST_ERROR;
-
+ if (HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(zbuf, rbuf + BIG_BUF_SIZE, (size_t)512) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(wbuf, rbuf + BIG_BUF_SIZE + 512, (size_t)512) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1024));
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section to be past "big" region */
/* (With write buffer #1) */
- if(accum_write(BIG_BUF_SIZE + 512, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(BIG_BUF_SIZE + 512, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read section before "big" region */
/* (To enlarge accumulator, so it will intersect with big write) */
- if(accum_read(BIG_BUF_SIZE - 512, 1024, rbuf) < 0) FAIL_STACK_ERROR;
- if(accum_read(BIG_BUF_SIZE + 1536, 1024, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(BIG_BUF_SIZE - 512, 1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (accum_read(BIG_BUF_SIZE + 1536, 1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write entire segment to from file */
/* (With write buffer #2) */
/* (Overwriting dirty region, but not invalidating entire accumulator) */
- if(accum_write(1536, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1536, BIG_BUF_SIZE, wbuf2) < 0)
+ FAIL_STACK_ERROR;
/* Read both segments & gap back from file */
- if(accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, (size_t)1536) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 1536, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
-
+ if (HDmemcmp(zbuf, rbuf, (size_t)1536) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(wbuf2, rbuf + 1536, (size_t)BIG_BUF_SIZE) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(1536, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1536, BIG_BUF_SIZE, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1536));
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section before "big" region */
/* (With write buffer #1) */
- if(accum_write(1024, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1024, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read section before "big" region */
/* (To enlarge accumulator, so it will intersect with big write) */
- if(accum_read(0, 1024, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, 1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write entire segment to from file */
/* (With write buffer #2) */
/* (Overwriting dirty region, but not invalidating entire accumulator) */
- if(accum_write(512, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR;
+ if (accum_write(512, BIG_BUF_SIZE, wbuf2) < 0)
+ FAIL_STACK_ERROR;
/* Read both segments & gap back from file */
- if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, (size_t)512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 512, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
-
+ if (HDmemcmp(zbuf, rbuf, (size_t)512) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(wbuf2, rbuf + 512, (size_t)BIG_BUF_SIZE) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(512, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(512, BIG_BUF_SIZE, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 512));
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section before "big" region */
/* (With write buffer #1) */
- if(accum_write(0, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read section before "big" region */
/* (To enlarge accumulator, so it will intersect with big write) */
- if(accum_read(1024, 1024, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(1024, 1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write entire segment to from file */
/* (With write buffer #2) */
/* (Avoiding dirty region, and not invalidating entire accumulator) */
- if(accum_write(1536, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR;
+ if (accum_write(1536, BIG_BUF_SIZE, wbuf2) < 0)
+ FAIL_STACK_ERROR;
/* Read both segments & gap back from file */
- if(accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + 1024, (size_t)512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 1536, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
-
+ if (HDmemcmp(wbuf, rbuf, (size_t)1024) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(zbuf, rbuf + 1024, (size_t)512) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(wbuf2, rbuf + 1536, (size_t)BIG_BUF_SIZE) != 0)
+ TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
- if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0)
+ FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1536));
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
-
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
/* Write small section before "big" region */
/* (With write buffer #1) */
- if(accum_write(0, 1024, wbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_write(0, 1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read section before "big" region */
/* (To enlarge accumulator, so it will intersect with big write) */
- if(accum_read(1024, 1024, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(1024, 1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Write entire segment to from file */
/* (With write buffer #2) */
/* (Partially overwriting dirty region, and not invalidating entire accumulator) */
- if(accum_write(512, BIG_BUF_SIZE, wbuf2) < 0) FAIL_STACK_ERROR;
+ if (accum_write(512, BIG_BUF_SIZE, wbuf2) < 0)
+ FAIL_STACK_ERROR;
/* Read both segments back from file */
- if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf, rbuf, (size_t)512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 512, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
-
+ if (HDmemcmp(wbuf, rbuf, (size_t)512) != 0)
+ TEST_ERROR;
+ if (HDmemcmp(wbuf2, rbuf + 512, (size_t)BIG_BUF_SIZE) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -1667,7 +1923,6 @@ error:
return 1;
} /* end test_big() */
-
/*-------------------------------------------------------------------------
* Function: test_random_write
*
@@ -1685,14 +1940,14 @@ error:
unsigned
test_random_write(H5F_t *f)
{
- uint8_t *wbuf, *rbuf; /* Buffers for reading & writing */
- unsigned seed = 0; /* Random # seed */
- size_t *off; /* Offset of buffer segments to write */
- size_t *len; /* Size of buffer segments to write */
- size_t cur_off; /* Current offset */
- size_t nsegments; /* Number of segments to write */
- size_t swap; /* Position to swap with */
- unsigned u; /* Local index variable */
+ uint8_t *wbuf, *rbuf; /* Buffers for reading & writing */
+ unsigned seed = 0; /* Random # seed */
+ size_t * off; /* Offset of buffer segments to write */
+ size_t * len; /* Size of buffer segments to write */
+ size_t cur_off; /* Current offset */
+ size_t nsegments; /* Number of segments to write */
+ size_t swap; /* Position to swap with */
+ unsigned u; /* Local index variable */
/* Allocate space for the write & read buffers */
wbuf = (uint8_t *)HDmalloc((size_t)RANDOM_BUF_SIZE);
@@ -1701,7 +1956,7 @@ test_random_write(H5F_t *f)
HDassert(rbuf);
/* Initialize write buffer */
- for(u = 0; u < RANDOM_BUF_SIZE; u++)
+ for (u = 0; u < RANDOM_BUF_SIZE; u++)
wbuf[u] = (uint8_t)u;
TESTING("random writes to accumulator");
@@ -1722,16 +1977,16 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed);
/* Randomly choose lengths of segments */
cur_off = 0;
- for(u = 0; u < MAX_RANDOM_SEGMENTS; ) {
- size_t length = 0; /* Length of current segment */
+ for (u = 0; u < MAX_RANDOM_SEGMENTS;) {
+ size_t length = 0; /* Length of current segment */
/* Choose random length of segment, allowing for variance */
do {
length += (size_t)(HDrandom() % RAND_SEG_LEN) + 1;
- } while((HDrandom() & 256) >= 128); /* end while */
+ } while ((HDrandom() & 256) >= 128); /* end while */
/* Check for going off end of buffer */
- if((cur_off + length) > RANDOM_BUF_SIZE)
+ if ((cur_off + length) > RANDOM_BUF_SIZE)
length = RANDOM_BUF_SIZE - cur_off;
/* Set offset & length of segment */
@@ -1745,45 +2000,55 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed);
cur_off += length;
/* If we've used up entire buffer before hitting limit of segments, get out */
- if(cur_off >= RANDOM_BUF_SIZE)
+ if (cur_off >= RANDOM_BUF_SIZE)
break;
} /* end for */
nsegments = u;
/* Increase length of last segment, if it doesn't reach end of buffer */
- if(nsegments < MAX_RANDOM_SEGMENTS)
+ if (nsegments < MAX_RANDOM_SEGMENTS)
len[nsegments - 1] = RANDOM_BUF_SIZE - off[nsegments - 1];
/* Shuffle order of segments, to randomize positions to write */
- for(u = 0; u < nsegments; u++) {
- size_t tmp; /* Temporary holder for offset & length values */
+ for (u = 0; u < nsegments; u++) {
+ size_t tmp; /* Temporary holder for offset & length values */
/* Choose value within next few elements to to swap with */
swap = ((size_t)HDrandom() % 8) + u;
- if(swap >= nsegments)
+ if (swap >= nsegments)
swap = nsegments - 1;
/* Swap values */
- tmp = off[u]; off[u] = off[swap]; off[swap] = tmp;
- tmp = len[u]; len[u] = len[swap]; len[swap] = tmp;
+ tmp = off[u];
+ off[u] = off[swap];
+ off[swap] = tmp;
+ tmp = len[u];
+ len[u] = len[swap];
+ len[swap] = tmp;
} /* end for */
/* Write data segments to file */
- for(u = 0; u < nsegments; u++) {
- if(accum_write(RANDOM_BASE_OFF + off[u], len[u], wbuf + off[u]) < 0) FAIL_STACK_ERROR;
+ for (u = 0; u < nsegments; u++) {
+ if (accum_write(RANDOM_BASE_OFF + off[u], len[u], wbuf + off[u]) < 0)
+ FAIL_STACK_ERROR;
/* Verify individual reads */
- if(accum_read(RANDOM_BASE_OFF + off[u], len[u], rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf + off[u], rbuf, len[u]) != 0) TEST_ERROR;
+ if (accum_read(RANDOM_BASE_OFF + off[u], len[u], rbuf) < 0)
+ FAIL_STACK_ERROR;
+ if (HDmemcmp(wbuf + off[u], rbuf, len[u]) != 0)
+ TEST_ERROR;
} /* end for */
/* Read entire region back from file */
- if(accum_read(RANDOM_BASE_OFF, RANDOM_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
+ if (accum_read(RANDOM_BASE_OFF, RANDOM_BUF_SIZE, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify data read back in */
- if(HDmemcmp(wbuf, rbuf, (size_t)RANDOM_BUF_SIZE) != 0) TEST_ERROR;
+ if (HDmemcmp(wbuf, rbuf, (size_t)RANDOM_BUF_SIZE) != 0)
+ TEST_ERROR;
- if(accum_reset(f) < 0) FAIL_STACK_ERROR;
+ if (accum_reset(f) < 0)
+ FAIL_STACK_ERROR;
PASSED();
@@ -1827,21 +2092,21 @@ error:
unsigned
test_swmr_write_big(hbool_t newest_format)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- H5F_t *rf = NULL; /* File pointer */
- char filename[1024];
- uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */
- uint8_t wbuf[1024]; /* Buffer for reading & writing */
- unsigned u; /* Local index variable */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ H5F_t * rf = NULL; /* File pointer */
+ char filename[1024];
+ uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */
+ uint8_t wbuf[1024]; /* Buffer for reading & writing */
+ unsigned u; /* Local index variable */
#ifdef H5_HAVE_UNISTD_H
- pid_t pid; /* Process ID */
-#endif /* H5_HAVE_UNISTD_H */
- int status; /* Status returned from child process */
- char *driver = NULL; /* VFD string (from env variable) */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ pid_t pid; /* Process ID */
+#endif /* H5_HAVE_UNISTD_H */
+ int status; /* Status returned from child process */
+ char * driver = NULL; /* VFD string (from env variable) */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- if(newest_format)
+ if (newest_format)
TESTING("SWMR write of large metadata: with latest format")
else
TESTING("SWMR write of large metadata: with non-latest-format")
@@ -1858,122 +2123,124 @@ test_swmr_write_big(hbool_t newest_format)
* by the environment variable.
*/
driver = HDgetenv("HDF5_DRIVER");
- if(!H5FD__supports_swmr_test(driver)) {
+ if (!H5FD__supports_swmr_test(driver)) {
SKIPPED();
HDputs(" Test skipped due to VFD not supporting SWMR I/O.");
return 0;
}
/* File access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
/* Both cases will result in v3 superblock and version 2 object header for SWMR */
- if(newest_format) { /* latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (newest_format) { /* latest format */
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
}
else { /* non-latest-format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR_WRITE */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Get H5F_t * to internal file structure */
- if(NULL == (rf = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR
+ if (NULL == (rf = (H5F_t *)H5VL_object(fid)))
+ FAIL_STACK_ERROR
/* We'll be writing lots of garbage data, so extend the
file a ways. 10MB should do. */
- if(H5FD_set_eoa(rf->shared->lf, H5FD_MEM_DEFAULT, (haddr_t)(1024*1024*10)) < 0)
+ if (H5FD_set_eoa(rf->shared->lf, H5FD_MEM_DEFAULT, (haddr_t)(1024 * 1024 * 10)) < 0)
FAIL_STACK_ERROR
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
FAIL_STACK_ERROR;
/* Reset metadata accumulator for the file */
- if(accum_reset(rf) < 0)
+ if (accum_reset(rf) < 0)
FAIL_STACK_ERROR;
/* Allocate space for the write & read buffers */
- if((wbuf2 = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE)) == NULL)
- FAIL_STACK_ERROR;
- if((rbuf = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE)) == NULL)
- FAIL_STACK_ERROR;
+ if ((wbuf2 = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE)) == NULL)
+ FAIL_STACK_ERROR;
+ if ((rbuf = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE)) == NULL)
+ FAIL_STACK_ERROR;
/* Initialize wbuf with "0, 1, 2...1024"*/
- for(u = 0; u < 1024; u++)
+ for (u = 0; u < 1024; u++)
wbuf[u] = (uint8_t)u;
/* Write [1024, 1024] bytes with wbuf */
- if(H5F_block_write(rf, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, wbuf) < 0)
- FAIL_STACK_ERROR;
+ if (H5F_block_write(rf, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read the data */
- if(H5F_block_read(rf, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0)
- FAIL_STACK_ERROR;
+ if (H5F_block_read(rf, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify the data read is correct */
- if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0)
+ if (HDmemcmp(wbuf, rbuf, (size_t)1024) != 0)
TEST_ERROR;
/* Flush the data to disk */
- if(accum_reset(rf) < 0)
+ if (accum_reset(rf) < 0)
FAIL_STACK_ERROR;
/* Initialize wbuf with all 1s */
- for(u = 0; u < 1024; u++)
+ for (u = 0; u < 1024; u++)
wbuf[u] = (uint8_t)1;
/* Initialize wbuf2 */
- for(u = 0; u < BIG_BUF_SIZE; u++)
+ for (u = 0; u < BIG_BUF_SIZE; u++)
wbuf2[u] = (uint8_t)(u + 1);
/* Write [1024,1024] with wbuf--all 1s */
- if(H5F_block_write(rf, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, wbuf) < 0)
- FAIL_STACK_ERROR;
+ if (H5F_block_write(rf, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, wbuf) < 0)
+ FAIL_STACK_ERROR;
/* Read the data */
- if(H5F_block_read(rf, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0)
- FAIL_STACK_ERROR;
+ if (H5F_block_read(rf, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify the data read is correct */
- if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0)
+ if (HDmemcmp(wbuf, rbuf, (size_t)1024) != 0)
TEST_ERROR;
/* The data stays in the accumulator */
/* Write a large piece of metadata [2048, BIG_BUF_SIZE] with wbuf2 */
- if(H5F_block_write(rf, H5FD_MEM_DEFAULT, (haddr_t)2048, (size_t)BIG_BUF_SIZE, wbuf2) < 0)
- FAIL_STACK_ERROR;
+ if (H5F_block_write(rf, H5FD_MEM_DEFAULT, (haddr_t)2048, (size_t)BIG_BUF_SIZE, wbuf2) < 0)
+ FAIL_STACK_ERROR;
/* Read the data */
- if(H5F_block_read(rf, H5FD_MEM_DEFAULT, (haddr_t)2048, (size_t)BIG_BUF_SIZE, rbuf) < 0)
- FAIL_STACK_ERROR;
+ if (H5F_block_read(rf, H5FD_MEM_DEFAULT, (haddr_t)2048, (size_t)BIG_BUF_SIZE, rbuf) < 0)
+ FAIL_STACK_ERROR;
/* Verify the data read is correct */
- if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0)
+ if (HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0)
TEST_ERROR;
/* Fork child process to verify that the data at [1024, 2014] does get written to disk */
- if((pid = HDfork()) < 0) {
+ if ((pid = HDfork()) < 0) {
HDperror("fork");
FAIL_STACK_ERROR;
}
- else if(0 == pid) { /* Child process */
+ else if (0 == pid) { /* Child process */
/* By convention, argv[0] tells the name of program invoked.
*
* execv on NetBSD 8 will actually return EFAULT if there is a
* NULL at argv[0], so we follow the convention unconditionally.
*/
- char swmr_reader[] = SWMR_READER;
- char * const new_argv[] = {swmr_reader, NULL};
+ char swmr_reader[] = SWMR_READER;
+ char *const new_argv[] = {swmr_reader, NULL};
/* Run the reader */
status = HDexecv(SWMR_READER, new_argv);
HDprintf("errno from execv = %s\n", strerror(errno));
@@ -1981,31 +2248,32 @@ test_swmr_write_big(hbool_t newest_format)
} /* end if */
/* Parent process -- wait for the child process to complete */
- while(pid != HDwaitpid(pid, &status, 0))
+ while (pid != HDwaitpid(pid, &status, 0))
/*void*/;
/* Check if child process terminates normally and its return value */
- if(WIFEXITED(status) && !WEXITSTATUS(status)) {
+ if (WIFEXITED(status) && !WEXITSTATUS(status)) {
/* Flush the accumulator */
- if(accum_reset(rf) < 0)
+ if (accum_reset(rf) < 0)
FAIL_STACK_ERROR;
/* Close and remove the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
/* Release memory */
- if(wbuf2)
+ if (wbuf2)
HDfree(wbuf2);
- if(rbuf)
+ if (rbuf)
HDfree(rbuf);
PASSED();
return 0;
@@ -2015,14 +2283,15 @@ error:
/* Closing and remove the file */
H5Fclose(fid);
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
H5Pclose(fapl);
/* Release memory */
- if(wbuf2)
+ if (wbuf2)
HDfree(wbuf2);
- if(rbuf)
+ if (rbuf)
HDfree(rbuf);
return 1;
@@ -2031,7 +2300,6 @@ error:
} /* end test_swmr_write_big() */
-
/*-------------------------------------------------------------------------
* Function: accum_printf
*
@@ -2048,11 +2316,11 @@ error:
void
accum_printf(const H5F_t *f)
{
- H5F_meta_accum_t * accum = &f->shared->accum;
+ H5F_meta_accum_t *accum = &f->shared->accum;
HDprintf("\n");
HDprintf("Current contents of accumulator:\n");
- if(accum->alloc_size == 0) {
+ if (accum->alloc_size == 0) {
HDprintf("=====================================================\n");
HDprintf(" No accumulator allocated.\n");
HDprintf("=====================================================\n");
@@ -2061,18 +2329,20 @@ accum_printf(const H5F_t *f)
HDprintf("=====================================================\n");
HDprintf(" accumulator allocated size == %zu\n", accum->alloc_size);
HDprintf(" accumulated data size == %zu\n", accum->size);
- HDfprintf(stdout, " accumulator dirty? == %s\n",
- accum->dirty ? "TRUE" : "FALSE");
+ HDfprintf(stdout, " accumulator dirty? == %s\n", accum->dirty ? "TRUE" : "FALSE");
HDprintf("=====================================================\n");
HDfprintf(stdout, " start of accumulated data, loc = %" PRIuHADDR "\n", accum->loc);
- if(accum->dirty) {
- HDfprintf(stdout, " start of dirty region, loc = %" PRIuHADDR "\n", (haddr_t)(accum->loc + accum->dirty_off));
- HDfprintf(stdout, " end of dirty region, loc = %" PRIuHADDR "\n", (haddr_t)(accum->loc + accum->dirty_off + accum->dirty_len));
+ if (accum->dirty) {
+ HDfprintf(stdout, " start of dirty region, loc = %" PRIuHADDR "\n",
+ (haddr_t)(accum->loc + accum->dirty_off));
+ HDfprintf(stdout, " end of dirty region, loc = %" PRIuHADDR "\n",
+ (haddr_t)(accum->loc + accum->dirty_off + accum->dirty_len));
} /* end if */
- HDfprintf(stdout, " end of accumulated data, loc = %" PRIuHADDR "\n", (haddr_t)(accum->loc + accum->size));
- HDfprintf(stdout, " end of accumulator allocation, loc = %" PRIuHADDR "\n", (haddr_t)(accum->loc + accum->alloc_size));
+ HDfprintf(stdout, " end of accumulated data, loc = %" PRIuHADDR "\n",
+ (haddr_t)(accum->loc + accum->size));
+ HDfprintf(stdout, " end of accumulator allocation, loc = %" PRIuHADDR "\n",
+ (haddr_t)(accum->loc + accum->alloc_size));
HDprintf("=====================================================\n");
}
HDprintf("\n\n");
} /* accum_printf() */
-
diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c
index c3be09a..1d48d43 100644
--- a/test/accum_swmr_reader.c
+++ b/test/accum_swmr_reader.c
@@ -11,26 +11,20 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5test.h"
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
#include "H5Fpkg.h"
#include "H5FDpkg.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Iprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* Filename: this is the same as the define in accum.c used by test_swmr_write_big() */
-const char *FILENAME[] = {
- "accum",
- "accum_swmr_big",
- NULL
-};
+const char *FILENAME[] = {"accum", "accum_swmr_big", NULL};
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -49,73 +43,77 @@ const char *FILENAME[] = {
int
main(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* file access property list ID */
- H5F_t *f = NULL; /* File pointer */
- char filename[1024];
- unsigned u; /* Local index variable */
- uint8_t rbuf[1024]; /* Buffer for reading */
- uint8_t buf[1024]; /* Buffer for holding the expected data */
- char *driver = NULL; /* VFD string (from env variable) */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* file access property list ID */
+ H5F_t * f = NULL; /* File pointer */
+ char filename[1024];
+ unsigned u; /* Local index variable */
+ uint8_t rbuf[1024]; /* Buffer for reading */
+ uint8_t buf[1024]; /* Buffer for holding the expected data */
+ char * driver = NULL; /* VFD string (from env variable) */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
driver = HDgetenv("HDF5_DRIVER");
- if(!H5FD__supports_swmr_test(driver))
+ if (!H5FD__supports_swmr_test(driver))
return EXIT_SUCCESS;
/* Initialize buffers */
- for(u = 0; u < 1024; u++) {
- rbuf[u] = 0; /* The buffer for reading */
- buf[u] = 1; /* The expected data should be all 1s */
+ for (u = 0; u < 1024; u++) {
+ rbuf[u] = 0; /* The buffer for reading */
+ buf[u] = 1; /* The expected data should be all 1s */
}
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
/* Open the file with SWMR_READ */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Get H5F_t * to internal file structure */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
FAIL_STACK_ERROR
/* Should read in [1024, 2024] with buf data */
- if(H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data read is correct */
- if(HDmemcmp(buf, rbuf, (size_t)1024) != 0)
+ if (HDmemcmp(buf, rbuf, (size_t)1024) != 0)
TEST_ERROR;
/* CLose the file */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/app_ref.c b/test/app_ref.c
index c1735fa..d2b935a 100644
--- a/test/app_ref.c
+++ b/test/app_ref.c
@@ -20,22 +20,22 @@
*/
#include "h5test.h"
-#define APPREF_DSET "test_dset"
-#define APPREF_ATTR "test_attr"
+#define APPREF_DSET "test_dset"
+#define APPREF_ATTR "test_attr"
#define APPREF_GROUP "test_grp"
-#define ERR_WIDTH 40 /* Width of output for the SIGABRT handler */
-#define MAX_NINC 16 /* Maximum increments of a reference count */
+#define ERR_WIDTH 40 /* Width of output for the SIGABRT handler */
+#define MAX_NINC 16 /* Maximum increments of a reference count */
/* Macro to increment the reference count on id a random number of times (from
* 1 to MAX_NINC). Assumes integers i and ninc are in scope. */
-#define RAND_INC(id) \
- ninc = (HDrand() % MAX_NINC) + 1; \
- \
- for (i=0; i<ninc; i++) \
- if (H5Iinc_ref(ids[id]) != i + 2) \
- TEST_ERROR \
- \
+#define RAND_INC(id) \
+ ninc = (HDrand() % MAX_NINC) + 1; \
+ \
+ for (i = 0; i < ninc; i++) \
+ if (H5Iinc_ref(ids[id]) != i + 2) \
+ TEST_ERROR \
+ \
rc[id] = ninc + 1;
typedef enum {
@@ -53,36 +53,23 @@ typedef enum {
T_NUMCLASSES
} id_class_t;
-const char *FILENAME[] = {
- "app_ref",
- NULL
-};
-
-const char *IDNAME[T_NUMCLASSES] = {
- "File",
- "Property List",
- "Property Class",
- "Datatype",
- "Dataspace",
- "Dataset",
- "Attribute",
- "Group",
- "Error Class",
- "Error Message",
- "Error Stack"
-};
+const char *FILENAME[] = {"app_ref", NULL};
+
+const char *IDNAME[T_NUMCLASSES] = {"File", "Property List", "Property Class", "Datatype",
+ "Dataspace", "Dataset", "Attribute", "Group",
+ "Error Class", "Error Message", "Error Stack"};
int rc[T_NUMCLASSES];
-void Abrt_Handler (int sig);
+void Abrt_Handler(int sig);
/* Handler for SIGABRT - prints the reference count on each id */
void
-Abrt_Handler (int H5_ATTR_UNUSED sig)
+Abrt_Handler(int H5_ATTR_UNUSED sig)
{
int i, n;
- for (i=0; i<T_NUMCLASSES; i++) {
+ for (i = 0; i < T_NUMCLASSES; i++) {
HDfprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n);
HDfprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]);
}
@@ -90,93 +77,90 @@ Abrt_Handler (int H5_ATTR_UNUSED sig)
/* Main test routine */
int
-main (void)
+main(void)
{
- hid_t ids[T_NUMCLASSES];
- hid_t fapl; /* File Access Property List */
- int ninc;
- int i;
- char filename[1024];
+ hid_t ids[T_NUMCLASSES];
+ hid_t fapl; /* File Access Property List */
+ int ninc;
+ int i;
+ char filename[1024];
h5_reset();
- h5_fixname (FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
+ h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- HDsrand ((unsigned) HDtime (NULL));
+ HDsrand((unsigned)HDtime(NULL));
- TESTING ("library shutdown with reference count > 1");
+ TESTING("library shutdown with reference count > 1");
/* Create the file */
- if ((ids[T_FILE] = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT)) < 0)
+ if ((ids[T_FILE] = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- RAND_INC (T_FILE)
+ RAND_INC(T_FILE)
/* Create the property list */
if ((ids[T_PLIST] = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- RAND_INC (T_PLIST)
+ RAND_INC(T_PLIST)
/* Create a property class */
- if ((ids[T_PCLASS] = H5Pcreate_class (H5P_DATASET_CREATE, "foo", NULL, NULL,
- NULL, NULL, NULL, NULL)) < 0)
+ if ((ids[T_PCLASS] = H5Pcreate_class(H5P_DATASET_CREATE, "foo", NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
TEST_ERROR
- RAND_INC (T_PCLASS)
+ RAND_INC(T_PCLASS)
/* Create a datatype */
- if ((ids[T_TYPE] = H5Tcreate (H5T_OPAQUE, (size_t) 16)) < 0)
+ if ((ids[T_TYPE] = H5Tcreate(H5T_OPAQUE, (size_t)16)) < 0)
TEST_ERROR
- RAND_INC (T_TYPE)
+ RAND_INC(T_TYPE)
/* Create a dataspace */
- if ((ids[T_SPACE] = H5Screate (H5S_SCALAR)) < 0)
+ if ((ids[T_SPACE] = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR
- RAND_INC (T_SPACE)
+ RAND_INC(T_SPACE)
/* Create a dataset */
- if ((ids[T_DSET] = H5Dcreate2 (ids[T_FILE], APPREF_DSET, H5T_NATIVE_INT,
- ids[T_SPACE], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((ids[T_DSET] = H5Dcreate2(ids[T_FILE], APPREF_DSET, H5T_NATIVE_INT, ids[T_SPACE], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- RAND_INC (T_DSET)
+ RAND_INC(T_DSET)
/* Create an attribute */
- if ((ids[T_ATTR] = H5Acreate2 (ids[T_DSET], APPREF_ATTR, H5T_NATIVE_INT,
- ids[T_SPACE], H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((ids[T_ATTR] = H5Acreate2(ids[T_DSET], APPREF_ATTR, H5T_NATIVE_INT, ids[T_SPACE], H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- RAND_INC (T_ATTR)
+ RAND_INC(T_ATTR)
/* Create a group */
- if ((ids[T_GROUP] = H5Gcreate2 (ids[T_FILE], APPREF_GROUP, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((ids[T_GROUP] = H5Gcreate2(ids[T_FILE], APPREF_GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- RAND_INC (T_GROUP)
+ RAND_INC(T_GROUP)
/* Create an error class */
- if ((ids[T_ECLASS] = H5Eregister_class("foo","bar","baz")) < 0)
+ if ((ids[T_ECLASS] = H5Eregister_class("foo", "bar", "baz")) < 0)
TEST_ERROR
- RAND_INC (T_ECLASS)
+ RAND_INC(T_ECLASS)
/* Create an error message */
- if ((ids[T_EMSG] = H5Ecreate_msg(ids[T_ECLASS],H5E_MAJOR,"mumble")) < 0)
+ if ((ids[T_EMSG] = H5Ecreate_msg(ids[T_ECLASS], H5E_MAJOR, "mumble")) < 0)
TEST_ERROR
- RAND_INC (T_EMSG)
+ RAND_INC(T_EMSG)
/* Create an error stack */
if ((ids[T_ESTACK] = H5Eget_current_stack()) < 0)
TEST_ERROR
- RAND_INC (T_ESTACK)
+ RAND_INC(T_ESTACK)
- HDsignal (SIGABRT, &Abrt_Handler);
+ HDsignal(SIGABRT, &Abrt_Handler);
if (H5close() < 0)
TEST_ERROR
@@ -188,8 +172,8 @@ main (void)
/* Clean up any file(s) created */
h5_reset();
- fapl = H5Pcreate (H5P_FILE_ACCESS);
- h5_cleanup (FILENAME, fapl);
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ h5_cleanup(FILENAME, fapl);
return 0;
diff --git a/test/atomic_reader.c b/test/atomic_reader.c
index 5c1241f..d849631 100644
--- a/test/atomic_reader.c
+++ b/test/atomic_reader.c
@@ -42,7 +42,7 @@
/* Local Macros */
/****************/
-#define FILENAME "atomic_data"
+#define FILENAME "atomic_data"
#define READ_TRIES 20
#define OPEN_TRIES 50
@@ -51,10 +51,8 @@
/********************/
static void usage(void);
-int verify(int fd, unsigned int k);
-void print_info(int *info, unsigned int lastr, unsigned iteration);
-
-
+int verify(int fd, unsigned int k);
+void print_info(int *info, unsigned int lastr, unsigned iteration);
/*-------------------------------------------------------------------------
* Function: usage
@@ -78,7 +76,6 @@ usage(void)
printf("\n");
} /* usage() */
-
/*-------------------------------------------------------------------------
* Function: verify
*
@@ -106,66 +103,64 @@ usage(void)
int
verify(int fd, unsigned int k)
{
- unsigned int i; /* local index variable */
- ssize_t bytes_read; /* the number of bytes read */
- unsigned int *buf = NULL; /* buffer to hold data read */
+ unsigned int i; /* local index variable */
+ ssize_t bytes_read; /* the number of bytes read */
+ unsigned int *buf = NULL; /* buffer to hold data read */
/* Allocate buffer for data read */
- if((buf = (unsigned int *)malloc(k * sizeof(unsigned int))) == NULL) {
+ if ((buf = (unsigned int *)malloc(k * sizeof(unsigned int))) == NULL) {
printf("READER: error from malloc\n");
goto error;
} /* end if */
/* Position the file at the beginning */
- if(lseek(fd, (off_t)0, SEEK_SET) < 0) {
+ if (lseek(fd, (off_t)0, SEEK_SET) < 0) {
printf("READER: error from lseek\n");
goto error;
} /* end if */
/* Read the whole file */
- if((bytes_read = read(fd, buf, (k * sizeof(unsigned int)))) < 0) {
+ if ((bytes_read = read(fd, buf, (k * sizeof(unsigned int)))) < 0) {
printf("READER: error from read\n");
goto error;
} /* end if */
/* Verify the bytes read are correct */
- if(bytes_read != (ssize_t)(k*sizeof(unsigned int))) {
+ if (bytes_read != (ssize_t)(k * sizeof(unsigned int))) {
printf("READER: error from bytes read=%lu\n", (unsigned long)bytes_read);
goto error;
} /* end if */
/* Verify data read */
- for(i=0; i < k; i++) {
- if(buf[i] != i)
+ for (i = 0; i < k; i++) {
+ if (buf[i] != i)
break;
} /* end for */
- if(i < k) {
+ if (i < k) {
/* Compare the beginning and ending sentinel values */
- if(buf[k-1] != (i-1)) {
- printf("FAIL IN READER: ...beginning sentinel value=%u, i=%u\n", (i-1), i);
- printf("FAIL IN READER: buf[%u]=%u\n", i-1, buf[i-1]);
+ if (buf[k - 1] != (i - 1)) {
+ printf("FAIL IN READER: ...beginning sentinel value=%u, i=%u\n", (i - 1), i);
+ printf("FAIL IN READER: buf[%u]=%u\n", i - 1, buf[i - 1]);
printf("FAIL IN READER: buf[%u]=%u\n", i, buf[i]);
- printf("FAIL IN READER: buf[%u]=%u\n", i+1, buf[i+1]);
- printf("FAIL IN READER: ...ending sentinel value=%u\n", buf[k-1]);
+ printf("FAIL IN READER: buf[%u]=%u\n", i + 1, buf[i + 1]);
+ printf("FAIL IN READER: ...ending sentinel value=%u\n", buf[k - 1]);
goto error;
} /* end if */
- } /* end if */
+ } /* end if */
/* Free the buffer */
- if(buf)
+ if (buf)
free(buf);
return 0;
error:
/* Free the buffer */
- if(buf)
+ if (buf)
free(buf);
return -1;
} /* end verify() */
-
-
/*-------------------------------------------------------------------------
* Function: print_info
*
@@ -183,17 +178,16 @@ error:
void
print_info(int *info, unsigned int lastr, unsigned iteration)
{
- unsigned j; /* local index variable */
+ unsigned j; /* local index variable */
printf("--------statistics for %u reads (iteration %u)--------\n", lastr, iteration);
- for(j = 0; j <= READ_TRIES; j++)
+ for (j = 0; j <= READ_TRIES; j++)
printf("# of %u re-tries = %u\n", j, info[j]);
printf("--------end statistics for %u reads (iteration %u)--------\n", lastr, iteration);
} /* print_info() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -222,32 +216,32 @@ print_info(int *info, unsigned int lastr, unsigned iteration)
int
main(int argc, char *argv[])
{
- int fd = -1; /* file descriptor */
- unsigned int j=0, i=0, m=0; /* local index variables */
- int temp; /* temporary variable */
- unsigned int iterations = 0; /* the input for "-i" */
- unsigned num = 0; /* the input for "-n" */
- int opt = 0; /* option char */
- int info[READ_TRIES+1]; /* re-tries statistics */
+ int fd = -1; /* file descriptor */
+ unsigned int j = 0, i = 0, m = 0; /* local index variables */
+ int temp; /* temporary variable */
+ unsigned int iterations = 0; /* the input for "-i" */
+ unsigned num = 0; /* the input for "-n" */
+ int opt = 0; /* option char */
+ int info[READ_TRIES + 1]; /* re-tries statistics */
/* Ensure the expected # of arguments */
- if(argc != 5) {
+ if (argc != 5) {
usage();
exit(EXIT_FAILURE);
} /* end if */
/* Parse command line options */
- while((opt = getopt(argc, argv, "n:i:")) != -1) {
- switch(opt) {
+ while ((opt = getopt(argc, argv, "n:i:")) != -1) {
+ switch (opt) {
case 'n':
- if((temp = atoi(optarg)) < 0) {
+ if ((temp = atoi(optarg)) < 0) {
usage();
exit(EXIT_FAILURE);
} /* end if */
num = (unsigned int)temp;
break;
case 'i':
- if((temp = atoi(optarg)) < 0) {
+ if ((temp = atoi(optarg)) < 0) {
usage();
exit(EXIT_FAILURE);
} /* end if */
@@ -257,35 +251,36 @@ main(int argc, char *argv[])
printf("Invalid option encountered\n");
break;
} /* end switch */
- } /* end while */
+ } /* end while */
printf("READER: number of integers to read = %u; # of iterations = %d\n", num, iterations);
printf("\n");
- for(i = 1; i <= iterations; i++) {
+ for (i = 1; i <= iterations; i++) {
unsigned opens = OPEN_TRIES;
printf("READER: *****start iteration %u*****\n", i);
/* Ensure open and file size are done properly */
- while(opens--) {
+ while (opens--) {
struct stat sinfo;
memset(&sinfo, 0, sizeof(sinfo));
- if((fd = open(FILENAME, O_RDONLY, 0644)) < 0) {
+ if ((fd = open(FILENAME, O_RDONLY, 0644)) < 0) {
printf("READER: error from open--retry open again\n");
- } else {
+ }
+ else {
printf("READER: open succeed\n");
- if((fstat(fd, &sinfo) == 0) &&
- (sinfo.st_size == (off_t)(num * sizeof(unsigned int)))) {
+ if ((fstat(fd, &sinfo) == 0) && (sinfo.st_size == (off_t)(num * sizeof(unsigned int)))) {
printf("READER: file size is correct--%u\n", (unsigned int)sinfo.st_size);
break;
} /* end if */
- printf("READER: error from fstat or file size of %u is incorrect--retry open again\n", (unsigned int)sinfo.st_size);
- if(close(fd) < 0) {
+ printf("READER: error from fstat or file size of %u is incorrect--retry open again\n",
+ (unsigned int)sinfo.st_size);
+ if (close(fd) < 0) {
printf("READER: error from close\n");
return EXIT_FAILURE;
} /* end if */
@@ -294,38 +289,41 @@ main(int argc, char *argv[])
} /* end while */
- if(fd < 0) {
- printf("READER: *****open failure/incorrect file size for all %u tries, continue next iteration*****\n\n", OPEN_TRIES);
+ if (fd < 0) {
+ printf("READER: *****open failure/incorrect file size for all %u tries, continue next "
+ "iteration*****\n\n",
+ OPEN_TRIES);
continue;
} /* end if */
memset(info, 0, sizeof(info));
/* Read and verify data */
- for(j = 1; j <= num; j++) {
+ for (j = 1; j <= num; j++) {
printf("READER: doing read %u\n", j);
- if(verify(fd, num) < 0) {
+ if (verify(fd, num) < 0) {
printf("READER: error from read %u\n", j);
/* Perform re-read to see if correct data is obtained */
- for(m = 1; m <= READ_TRIES; m++) {
+ for (m = 1; m <= READ_TRIES; m++) {
printf("READER: ===============going to do re-read try %u\n", m);
- if(verify(fd, num) < 0)
+ if (verify(fd, num) < 0)
printf("READER: ===============error from re-read try %u\n", m);
else {
++info[m];
printf("READER: ===============SUCCESS from re-read try %u\n", m);
break;
} /* end else */
- } /* end for */
+ } /* end for */
- if(m > READ_TRIES) {
+ if (m > READ_TRIES) {
printf("READER: ===============error from all re-read tries: %u\n", READ_TRIES);
printf("READER:*****ERROR--stop on read %u\n", j);
break;
} /* end if */
- } else {
+ }
+ else {
++info[0];
printf("READER: success from read %u\n", j);
} /* end else */
@@ -333,10 +331,10 @@ main(int argc, char *argv[])
} /* end for */
/* Print the statistics for re-reads */
- print_info(info, j-1, i);
+ print_info(info, j - 1, i);
/* Close the file */
- if(close(fd) < 0) {
+ if (close(fd) < 0) {
printf("READER: error from close\n");
return EXIT_FAILURE;
} /* end if */
@@ -358,4 +356,3 @@ main(void)
} /* end main() */
#endif /* WIN32 / MINGW32 */
-
diff --git a/test/atomic_writer.c b/test/atomic_writer.c
index b9ea03a..0f86f7b 100644
--- a/test/atomic_writer.c
+++ b/test/atomic_writer.c
@@ -53,7 +53,6 @@
static void usage(void);
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -76,8 +75,6 @@ usage(void)
printf("\n");
} /* usage() */
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -114,33 +111,33 @@ usage(void)
int
main(int argc, char *argv[])
{
- int fd = -1; /* file descriptor */
- ssize_t bytes_wrote; /* the nubmer of bytes written */
- unsigned int *buf = NULL; /* buffer to hold written data */
- unsigned int n, u, i; /* local index variable */
- int temp; /* temporary variable */
- unsigned int iterations = 0; /* the input for "-i" */
- unsigned int num = 0; /* the input for "-n" */
- int opt = 0; /* option char */
+ int fd = -1; /* file descriptor */
+ ssize_t bytes_wrote; /* the nubmer of bytes written */
+ unsigned int *buf = NULL; /* buffer to hold written data */
+ unsigned int n, u, i; /* local index variable */
+ int temp; /* temporary variable */
+ unsigned int iterations = 0; /* the input for "-i" */
+ unsigned int num = 0; /* the input for "-n" */
+ int opt = 0; /* option char */
/* Ensure the # of arguments is as expected */
- if(argc != 5) {
+ if (argc != 5) {
usage();
exit(EXIT_FAILURE);
} /* end if */
/* Parse command line options */
- while((opt = getopt(argc, argv, "n:i:")) != -1) {
- switch(opt) {
+ while ((opt = getopt(argc, argv, "n:i:")) != -1) {
+ switch (opt) {
case 'n':
- if((temp = atoi(optarg)) < 0) {
+ if ((temp = atoi(optarg)) < 0) {
usage();
exit(EXIT_FAILURE);
} /* end if */
num = (unsigned int)temp;
break;
case 'i':
- if((temp = atoi(optarg)) < 0) {
+ if ((temp = atoi(optarg)) < 0) {
usage();
exit(EXIT_FAILURE);
} /* end if */
@@ -150,78 +147,79 @@ main(int argc, char *argv[])
printf("Invalid option encountered\n");
break;
} /* end switch */
- } /* end while */
+ } /* end while */
printf("WRITER: # of integers to write = %u; # of iterations = %d\n", num, iterations);
/* Remove existing data file if needed */
- if(remove(FILENAME) < 0) {
- if(errno == ENOENT)
+ if (remove(FILENAME) < 0) {
+ if (errno == ENOENT)
printf("WRITER: remove %s--%s\n", FILENAME, strerror(errno));
else {
printf("WRITER: error from remove: %d--%s\n", errno, strerror(errno));
goto error;
} /* end else */
- } else
+ }
+ else
printf("WRITER: %s is removed\n", FILENAME);
/* Create the data file */
- if((fd = open(FILENAME, O_RDWR|O_TRUNC|O_CREAT, 0664)) < 0) {
+ if ((fd = open(FILENAME, O_RDWR | O_TRUNC | O_CREAT, 0664)) < 0) {
printf("WRITER: error from open\n");
goto error;
} /* end if */
/* Allocate buffer for holding data to be written */
- if((buf = (unsigned int *)malloc(num * sizeof(unsigned int))) == NULL) {
+ if ((buf = (unsigned int *)malloc(num * sizeof(unsigned int))) == NULL) {
printf("WRITER: error from malloc\n");
- if(fd >= 0 && close(fd) < 0)
+ if (fd >= 0 && close(fd) < 0)
printf("WRITER: error from close\n");
goto error;
} /* end if */
printf("\n");
- for(i = 1; i <= iterations; i++) {
+ for (i = 1; i <= iterations; i++) {
printf("WRITER: *****start iteration %u*****\n", i);
/* Write the series of integers to the file */
- for(n = 0; n < num; n++) {
+ for (n = 0; n < num; n++) {
/* Set up data to be written */
- for(u=0; u < num; u++)
+ for (u = 0; u < num; u++)
buf[u] = n;
/* Position the file to the proper location */
- if(lseek(fd, (off_t)(n*sizeof(unsigned int)), SEEK_SET) < 0) {
+ if (lseek(fd, (off_t)(n * sizeof(unsigned int)), SEEK_SET) < 0) {
printf("WRITER: error from lseek\n");
goto error;
} /* end if */
/* Write the data */
- if((bytes_wrote = write(fd, buf, ((num-n) * sizeof(unsigned int)))) < 0) {
+ if ((bytes_wrote = write(fd, buf, ((num - n) * sizeof(unsigned int)))) < 0) {
printf("WRITER: error from write\n");
goto error;
} /* end if */
/* Verify the bytes written is correct */
- if(bytes_wrote != (ssize_t)((num-n) * sizeof(unsigned int))) {
+ if (bytes_wrote != (ssize_t)((num - n) * sizeof(unsigned int))) {
printf("WRITER: error from bytes written\n");
goto error;
} /* end if */
- } /* end for */
+ } /* end for */
printf("WRITER: *****end iteration %u*****\n\n", i);
} /* end for */
/* Close the file */
- if(close(fd) < 0) {
+ if (close(fd) < 0) {
printf("WRITER: error from close\n");
goto error;
} /* end if */
/* Free the buffer */
- if(buf)
+ if (buf)
free(buf);
return EXIT_SUCCESS;
@@ -240,4 +238,3 @@ main(void)
} /* end main() */
#endif /* WIN32 / MINGW32 */
-
diff --git a/test/big.c b/test/big.c
index ae0cec0..6bdbf58 100644
--- a/test/big.c
+++ b/test/big.c
@@ -53,45 +53,40 @@
*/
#include "h5test.h"
-#define DNAME "big.data"
+#define DNAME "big.data"
-#define WRT_N 50
-#define WRT_SIZE 4*1024
-#define FAMILY_SIZE 1024*1024*1024
+#define WRT_N 50
+#define WRT_SIZE 4 * 1024
+#define FAMILY_SIZE 1024 * 1024 * 1024
#define GB (HDoff_t)0x40000000L
-#define MAX_TRIES 100
+#define MAX_TRIES 100
#if H5_SIZEOF_LONG_LONG >= 8
-# define GB8LL ((unsigned long long)8*1024*1024*1024)
+#define GB8LL ((unsigned long long)8 * 1024 * 1024 * 1024)
#else
-# define GB8LL 0 /*cannot do the test*/
+#define GB8LL 0 /*cannot do the test*/
#endif
/* Define Small, Large, Extra Large, Huge File which
* corrspond to less than 2GB, 2GB, 4GB, and tens of GB file size.
* NO_FILE stands for "no file" to be tested.
*/
-typedef enum fsizes_t { SFILE, LFILE, XLFILE, HUGEFILE, NO_FILE} fsizes_t;
-fsizes_t file_size= NO_FILE;
-
-const char *FILENAME[] = {
- "big",
- "sec2",
- "stdio",
- NULL
-};
-int cflag=1; /* check file system before test */
-int sparse_support=0; /* sparse file supported, default false */
-int have_space=0; /* enough space for huge file test, default false */
-hsize_t family_size_def=FAMILY_SIZE; /* default family file size */
+typedef enum fsizes_t { SFILE, LFILE, XLFILE, HUGEFILE, NO_FILE } fsizes_t;
+fsizes_t file_size = NO_FILE;
+
+const char *FILENAME[] = {"big", "sec2", "stdio", NULL};
+int cflag = 1; /* check file system before test */
+int sparse_support = 0; /* sparse file supported, default false */
+int have_space = 0; /* enough space for huge file test, default false */
+hsize_t family_size_def = FAMILY_SIZE; /* default family file size */
/* Prototypes */
static void usage(void);
-static int test_sec2(hid_t fapl);
-static int test_stdio(hid_t fapl);
-static int test_family(hid_t fapl);
+static int test_sec2(hid_t fapl);
+static int test_stdio(hid_t fapl);
+static int test_family(hid_t fapl);
/* Array used to record all addresses at which data has been written */
/* so far. Used to prevent overlapping writes. */
@@ -118,36 +113,33 @@ static hsize_t values_used[WRT_N];
static hsize_t
randll(hsize_t limit, int current_index)
{
- hsize_t acc = 0;
+ hsize_t acc = 0;
int overlap = 1;
int i;
int tries = 0;
/* Generate up to MAX_TRIES random numbers until one of them */
/* does not overlap with any previous writes */
- while(overlap != 0 && tries < MAX_TRIES)
- {
+ while (overlap != 0 && tries < MAX_TRIES) {
acc = (hsize_t)HDrandom();
acc *= (hsize_t)HDrandom();
- acc = acc % limit;
+ acc = acc % limit;
overlap = 0;
- for(i = 0; i < current_index; i++)
- {
- if((acc >= values_used[i]) && (acc < values_used[i]+WRT_SIZE))
+ for (i = 0; i < current_index; i++) {
+ if ((acc >= values_used[i]) && (acc < values_used[i] + WRT_SIZE))
overlap = 1;
- if((acc+WRT_SIZE >= values_used[i]) && (acc+WRT_SIZE < values_used[i]+WRT_SIZE))
+ if ((acc + WRT_SIZE >= values_used[i]) && (acc + WRT_SIZE < values_used[i] + WRT_SIZE))
overlap = 1;
}
tries++;
}
- values_used[current_index]=acc;
+ values_used[current_index] = acc;
return acc;
}
-
/*-------------------------------------------------------------------------
* Function: is_sparse
*
@@ -169,23 +161,28 @@ randll(hsize_t limit, int current_index)
static int
is_sparse(void)
{
- int fd;
- h5_stat_t sb;
-
- if ((fd = HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) return 0;
- if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
- if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
- if (HDclose(fd) < 0) return 0;
- if (HDstat("x.h5", &sb) < 0) return 0;
- if (HDremove("x.h5") < 0) return 0;
+ int fd;
+ h5_stat_t sb;
+
+ if ((fd = HDopen("x.h5", O_RDWR | O_TRUNC | O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0)
+ return 0;
+ if (HDlseek(fd, (off_t)(1024 * 1024), SEEK_SET) != 1024 * 1024)
+ return 0;
+ if (5 != HDwrite(fd, "hello", (size_t)5))
+ return 0;
+ if (HDclose(fd) < 0)
+ return 0;
+ if (HDstat("x.h5", &sb) < 0)
+ return 0;
+ if (HDremove("x.h5") < 0)
+ return 0;
#ifdef H5_HAVE_STAT_ST_BLOCKS
- return ((unsigned long)sb.st_blocks*512 < (unsigned long)sb.st_size);
+ return ((unsigned long)sb.st_blocks * 512 < (unsigned long)sb.st_size);
#else
return (0);
#endif
}
-
/*-------------------------------------------------------------------------
* Function: supports_big
*
@@ -207,56 +204,55 @@ is_sparse(void)
static fsizes_t
supports_big(void)
{
- int fd = -1;
- fsizes_t fsize = NO_FILE;
+ int fd = -1;
+ fsizes_t fsize = NO_FILE;
- if((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd = HDopen("y.h5", O_RDWR | O_TRUNC | O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
/* Write a few byte at the beginning */
- if(5!=HDwrite(fd, "hello", (size_t)5))
+ if (5 != HDwrite(fd, "hello", (size_t)5))
goto quit;
fsize = SFILE;
/* Write a few bytes at 2GB */
- if(HDlseek(fd, 2*GB, SEEK_SET)!=2*GB)
+ if (HDlseek(fd, 2 * GB, SEEK_SET) != 2 * GB)
goto quit;
- if(5!=HDwrite(fd, "hello", (size_t)5))
+ if (5 != HDwrite(fd, "hello", (size_t)5))
goto quit;
fsize = LFILE;
/* Write a few bytes at 4GB */
- if(HDlseek(fd, 4*GB, SEEK_SET) != 4*GB)
+ if (HDlseek(fd, 4 * GB, SEEK_SET) != 4 * GB)
goto quit;
- if(5!=HDwrite(fd, "hello", (size_t)5))
+ if (5 != HDwrite(fd, "hello", (size_t)5))
goto quit;
fsize = XLFILE;
/* If this supports sparse_file, write a few bytes at 32GB */
- if(!sparse_support)
+ if (!sparse_support)
goto quit;
- if(HDlseek(fd, 32*GB, SEEK_SET) != 32*GB)
+ if (HDlseek(fd, 32 * GB, SEEK_SET) != 32 * GB)
goto quit;
- if(5!=HDwrite(fd, "hello", (size_t)5))
+ if (5 != HDwrite(fd, "hello", (size_t)5))
goto quit;
fsize = HUGEFILE;
quit:
- if(HDclose(fd) < 0)
+ if (HDclose(fd) < 0)
goto error;
- if(HDremove("y.h5") < 0)
+ if (HDremove("y.h5") < 0)
goto error;
return fsize;
error:
- if(fd >= 0){
+ if (fd >= 0) {
HDclose(fd);
HDremove("y.h5");
}
return fsize;
}
-
/*-------------------------------------------------------------------------
* Function: enough_room
*
@@ -285,38 +281,39 @@ H5_GCC_DIAG_OFF("format-nonliteral")
static int
enough_room(hid_t fapl)
{
- int ret_value=0;
- int fd[68];
- size_t i, size = (size_t)1 << 30;
- char filename[1024], name[1024];
+ int ret_value = 0;
+ int fd[68];
+ size_t i, size = (size_t)1 << 30;
+ char filename[1024], name[1024];
/* Initialize file descriptors */
- for (i=0; i<NELMTS(fd); i++) fd[i] = -1;
+ for (i = 0; i < NELMTS(fd); i++)
+ fd[i] = -1;
/* Get file name template */
- HDassert(H5FD_FAMILY==H5Pget_driver(fapl));
+ HDassert(H5FD_FAMILY == H5Pget_driver(fapl));
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create files */
- for (i=0; i<NELMTS(fd); i++) {
+ for (i = 0; i < NELMTS(fd); i++) {
HDsnprintf(name, sizeof(name), filename, i);
- if ((fd[i]=HDopen(name, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) {
+ if ((fd[i] = HDopen(name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) {
goto done;
}
if ((off_t)size != HDlseek(fd[i], (off_t)size, SEEK_SET)) {
goto done;
}
- if (1!=HDwrite(fd[i], "X", (size_t)1)) {
+ if (1 != HDwrite(fd[i], "X", (size_t)1)) {
goto done;
}
}
ret_value = 1;
done:
- for (i=0; i<NELMTS(fd) && fd[i]>=0; i++) {
+ for (i = 0; i < NELMTS(fd) && fd[i] >= 0; i++) {
HDsnprintf(name, sizeof(name), filename, i);
- if(HDclose(fd[i]) < 0)
- ret_value=0;
+ if (HDclose(fd[i]) < 0)
+ ret_value = 0;
HDremove(name);
}
@@ -324,7 +321,6 @@ done:
}
H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: writer
*
@@ -344,68 +340,68 @@ H5_GCC_DIAG_ON("format-nonliteral")
*-------------------------------------------------------------------------
*/
static int
-writer (char* filename, hid_t fapl, fsizes_t testsize, int wrt_n)
+writer(char *filename, hid_t fapl, fsizes_t testsize, int wrt_n)
{
- hsize_t size1[4] = {8, 1024, 1024, 1024};
- hsize_t size2[1] = {GB8LL};
- hsize_t hs_start[1];
- hsize_t hs_size[1];
- hid_t file=-1, space1=-1, space2=-1, mem_space=-1, d1=-1, d2=-1;
- int *buf = (int*)HDmalloc (sizeof(int) * WRT_SIZE);
- int i, j;
- FILE *out = HDfopen(DNAME, "w");
- hid_t dcpl;
-
- switch(testsize){
- case LFILE:
- TESTING("Large dataset write(2GB)");
- /* reduce size1 to produce a 2GB dataset */
- size1[1] = 1024/16;
- size2[0] /= 16;
- break;
-
- case XLFILE:
- TESTING("Extra large dataset write(4GB)");
- /* reduce size1 to produce a 4GB dataset */
- size1[1] = 1024/8;
- size2[0] /= 8;
- break;
-
- case HUGEFILE:
- TESTING("Huge dataset write");
- /* Leave size1 as 32GB */
- break;
-
- case SFILE:
- TESTING("small dataset write(1GB)");
- /* reduce size1 to produce a 1GB dataset */
- size1[1] = 1024/32;
- size2[0] /= 32;
- break;
-
- case NO_FILE:
- /* what to do?? */
- HDfprintf(stdout, "Unexpected file size of NO_FILE\n");
- goto error;
- break;
+ hsize_t size1[4] = {8, 1024, 1024, 1024};
+ hsize_t size2[1] = {GB8LL};
+ hsize_t hs_start[1];
+ hsize_t hs_size[1];
+ hid_t file = -1, space1 = -1, space2 = -1, mem_space = -1, d1 = -1, d2 = -1;
+ int * buf = (int *)HDmalloc(sizeof(int) * WRT_SIZE);
+ int i, j;
+ FILE * out = HDfopen(DNAME, "w");
+ hid_t dcpl;
+
+ switch (testsize) {
+ case LFILE:
+ TESTING("Large dataset write(2GB)");
+ /* reduce size1 to produce a 2GB dataset */
+ size1[1] = 1024 / 16;
+ size2[0] /= 16;
+ break;
- default:
- HDfprintf(stdout, "Unexpected file size(%d)\n", testsize);
- goto error;
- break;
+ case XLFILE:
+ TESTING("Extra large dataset write(4GB)");
+ /* reduce size1 to produce a 4GB dataset */
+ size1[1] = 1024 / 8;
+ size2[0] /= 8;
+ break;
+
+ case HUGEFILE:
+ TESTING("Huge dataset write");
+ /* Leave size1 as 32GB */
+ break;
+
+ case SFILE:
+ TESTING("small dataset write(1GB)");
+ /* reduce size1 to produce a 1GB dataset */
+ size1[1] = 1024 / 32;
+ size2[0] /= 32;
+ break;
+
+ case NO_FILE:
+ /* what to do?? */
+ HDfprintf(stdout, "Unexpected file size of NO_FILE\n");
+ goto error;
+ break;
+
+ default:
+ HDfprintf(stdout, "Unexpected file size(%d)\n", testsize);
+ goto error;
+ break;
}
/*
* We might be on a machine that has 32-bit files, so create an HDF5 file
* which is a family of files. Each member of the family will be 1GB
*/
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
goto error;
}
/* Create simple data spaces according to the size specified above. */
- if ((space1 = H5Screate_simple (4, size1, size1)) < 0 ||
- (space2 = H5Screate_simple (1, size2, size2)) < 0) {
+ if ((space1 = H5Screate_simple(4, size1, size1)) < 0 ||
+ (space2 = H5Screate_simple(1, size2, size2)) < 0) {
goto error;
}
@@ -421,54 +417,63 @@ writer (char* filename, hid_t fapl, fsizes_t testsize, int wrt_n)
dcpl = H5Pcreate(H5P_DATASET_CREATE);
H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE);
H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER);
- if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ||
- (d2 = H5Dcreate2(file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ if ((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ||
+ (d2 = H5Dcreate2(file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
goto error;
}
-
/* Write some things to them randomly */
hs_size[0] = WRT_SIZE;
- if ((mem_space = H5Screate_simple (1, hs_size, hs_size)) < 0) goto error;
- for (i=0; i<wrt_n; i++) {
- /* start position must be at least hs_size from the end */
- hs_start[0] = randll (size2[0]-hs_size[0], i);
- HDfprintf (out, "#%03d 0x%016" PRIxHSIZE "\n", i, hs_start[0]);
- if (H5Sselect_hyperslab (space2, H5S_SELECT_SET, hs_start, NULL,
- hs_size, NULL) < 0) goto error;
- for (j=0; j<WRT_SIZE; j++) {
- buf[j] = i+1;
+ if ((mem_space = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ goto error;
+ for (i = 0; i < wrt_n; i++) {
+ /* start position must be at least hs_size from the end */
+ hs_start[0] = randll(size2[0] - hs_size[0], i);
+ HDfprintf(out, "#%03d 0x%016" PRIxHSIZE "\n", i, hs_start[0]);
+ if (H5Sselect_hyperslab(space2, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0)
+ goto error;
+ for (j = 0; j < WRT_SIZE; j++) {
+ buf[j] = i + 1;
}
- if (H5Dwrite (d2, H5T_NATIVE_INT, mem_space, space2,
- H5P_DEFAULT, buf) < 0) goto error;
+ if (H5Dwrite(d2, H5T_NATIVE_INT, mem_space, space2, H5P_DEFAULT, buf) < 0)
+ goto error;
}
- if (H5Dclose (d1) < 0) goto error;
- if (H5Dclose (d2) < 0) goto error;
- if (H5Sclose (mem_space) < 0) goto error;
- if (H5Sclose (space1) < 0) goto error;
- if (H5Sclose (space2) < 0) goto error;
- if (H5Fclose (file) < 0) goto error;
- HDfree (buf);
+ if (H5Dclose(d1) < 0)
+ goto error;
+ if (H5Dclose(d2) < 0)
+ goto error;
+ if (H5Sclose(mem_space) < 0)
+ goto error;
+ if (H5Sclose(space1) < 0)
+ goto error;
+ if (H5Sclose(space2) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+ HDfree(buf);
HDfclose(out);
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(d1);
H5Dclose(d2);
H5Sclose(space1);
H5Sclose(space2);
H5Sclose(mem_space);
H5Fclose(file);
- } H5E_END_TRY;
- if (buf) HDfree(buf);
- if (out) HDfclose(out);
+ }
+ H5E_END_TRY;
+ if (buf)
+ HDfree(buf);
+ if (out)
+ HDfclose(out);
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: reader
*
@@ -488,85 +493,95 @@ error:
static int
reader(char *filename, hid_t fapl)
{
- FILE *script = NULL;
- hid_t file = -1, mspace = -1, fspace = -1, d2 = -1;
+ FILE * script = NULL;
+ hid_t file = -1, mspace = -1, fspace = -1, d2 = -1;
char ln[128], *s;
- hsize_t hs_offset[1];
- hsize_t hs_size[1] = {WRT_SIZE};
- int *buf = (int *)HDmalloc(sizeof(int) * WRT_SIZE);
- int i, j, zero, wrong, nerrors = 0;
+ hsize_t hs_offset[1];
+ hsize_t hs_size[1] = {WRT_SIZE};
+ int * buf = (int *)HDmalloc(sizeof(int) * WRT_SIZE);
+ int i, j, zero, wrong, nerrors = 0;
/* Open script file */
script = HDfopen(DNAME, "r");
/* Open HDF5 file */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open the dataset */
- if((d2 = H5Dopen2(file, "d2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((fspace = H5Dget_space(d2)) < 0) FAIL_STACK_ERROR
+ if ((d2 = H5Dopen2(file, "d2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((fspace = H5Dget_space(d2)) < 0)
+ FAIL_STACK_ERROR
/* Describe `buf' */
- if((mspace = H5Screate_simple(1, hs_size, hs_size)) < 0) FAIL_STACK_ERROR
+ if ((mspace = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ FAIL_STACK_ERROR
/* Read each region */
- while(HDfgets(ln, (int)sizeof(ln), script)) {
- if('#' != ln[0])
+ while (HDfgets(ln, (int)sizeof(ln), script)) {
+ if ('#' != ln[0])
break;
- i = (int)HDstrtol(ln + 1, &s, 10);
+ i = (int)HDstrtol(ln + 1, &s, 10);
hs_offset[0] = HDstrtoull(s, NULL, 0);
HDfprintf(stdout, "#%03d 0x%016" PRIxHSIZE "%47s", i, hs_offset[0], "");
HDfflush(stdout);
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL,
- hs_size, NULL) < 0) FAIL_STACK_ERROR
- if(H5Dread(d2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0)
- FAIL_STACK_ERROR
-
- /* Check */
- for(j = zero = wrong = 0; j < WRT_SIZE; j++) {
- if(0 == buf[j])
- zero++;
- else if(buf[j] != i + 1)
- wrong++;
- }
- if(zero) {
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(d2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check */
+ for (j = zero = wrong = 0; j < WRT_SIZE; j++) {
+ if (0 == buf[j])
+ zero++;
+ else if (buf[j] != i + 1)
+ wrong++;
+ }
+ if (zero) {
H5_FAILED();
HDprintf(" %d zero%s\n", zero, 1 == zero ? "" : "s");
- } else if(wrong) {
+ }
+ else if (wrong) {
SKIPPED();
HDputs(" Possible overlap with another region.");
nerrors++;
- } else {
+ }
+ else {
PASSED();
}
}
- if(H5Dclose(d2) < 0) FAIL_STACK_ERROR
- if(H5Sclose(mspace) < 0) FAIL_STACK_ERROR
- if(H5Sclose(fspace) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
- HDfree(buf);
+ if (H5Dclose(d2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(mspace) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(fspace) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ HDfree(buf);
HDfclose(script);
return nerrors;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(d2);
H5Sclose(mspace);
H5Sclose(fspace);
H5Fclose(file);
- } H5E_END_TRY;
- if(buf)
+ }
+ H5E_END_TRY;
+ if (buf)
HDfree(buf);
- if(script)
+ if (script)
HDfclose(script);
return 1;
}
-
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -585,27 +600,27 @@ static void
usage(void)
{
HDfprintf(stdout,
- "Usage: big [-h] [-c] [-fsize <fsize>}\n"
- "\t-h\tPrint the help page\n"
- "\t-c\tFile system Checking skipped. Caution: this test generates\n"
- "\t\tmany big files and may fill up the file system.\n"
- "\t-fsize\tChange family size default to <fsize> where <fsize> is\n"
- "\t\ta positive float point number. Default value is %" PRIuHSIZE ".\n"
- "Examples:\n"
- "\tbig -fsize 2.1e9 \t# test with file size just under 2GB\n"
- "\tbig -fsize 2.2e9 \t# test with file size just above 2GB\n"
- "\tBe sure the file system can support the file size requested\n"
- , (hsize_t)FAMILY_SIZE);
+ "Usage: big [-h] [-c] [-fsize <fsize>}\n"
+ "\t-h\tPrint the help page\n"
+ "\t-c\tFile system Checking skipped. Caution: this test generates\n"
+ "\t\tmany big files and may fill up the file system.\n"
+ "\t-fsize\tChange family size default to <fsize> where <fsize> is\n"
+ "\t\ta positive float point number. Default value is %" PRIuHSIZE ".\n"
+ "Examples:\n"
+ "\tbig -fsize 2.1e9 \t# test with file size just under 2GB\n"
+ "\tbig -fsize 2.2e9 \t# test with file size just above 2GB\n"
+ "\tBe sure the file system can support the file size requested\n",
+ (hsize_t)FAMILY_SIZE);
}
static int
test_sec2(hid_t fapl)
{
- char filename[1024];
- fsizes_t testsize;
+ char filename[1024];
+ fsizes_t testsize;
testsize = supports_big();
- if(testsize == NO_FILE) {
+ if (testsize == NO_FILE) {
HDfprintf(stdout, "Test for sec2 is skipped because file system does not support big files.\n");
goto quit;
}
@@ -614,9 +629,9 @@ test_sec2(hid_t fapl)
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if(writer(filename, fapl, testsize, WRT_N))
+ if (writer(filename, fapl, testsize, WRT_N))
goto error;
- if(reader(filename, fapl))
+ if (reader(filename, fapl))
goto error;
HDputs("Test passed with the SEC2 Driver.");
@@ -636,11 +651,11 @@ error:
static int
test_stdio(hid_t fapl)
{
- char filename[1024];
- fsizes_t testsize;
+ char filename[1024];
+ fsizes_t testsize;
testsize = supports_big();
- if(testsize == NO_FILE) {
+ if (testsize == NO_FILE) {
HDfprintf(stdout, "Test for stdio is skipped because file system does not support big files.\n");
goto quit;
}
@@ -648,9 +663,9 @@ test_stdio(hid_t fapl)
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if(writer(filename, fapl, testsize, WRT_N))
+ if (writer(filename, fapl, testsize, WRT_N))
goto error;
- if(reader(filename, fapl))
+ if (reader(filename, fapl))
goto error;
HDputs("Test passed with the STDIO Driver.");
@@ -675,34 +690,34 @@ error:
static int
test_family(hid_t fapl)
{
- char filename[1024];
+ char filename[1024];
/* Test huge file with the family driver */
HDputs("Testing big file with the Family Driver ");
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
- if(H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0)
goto error;
- if(cflag){
+ if (cflag) {
/*
* We shouldn't run this test if the file system doesn't support holes
* because we would generate multi-gigabyte files.
*/
HDputs("Checking if file system is adequate for this test...");
- if(sizeof(long long) < 8 || 0 == GB8LL) {
+ if (sizeof(long long) < 8 || 0 == GB8LL) {
HDputs("Test skipped because sizeof(long long) is too small. This");
HDputs("hardware apparently doesn't support 64-bit integer types.");
usage();
goto quit;
}
- if(!sparse_support) {
+ if (!sparse_support) {
HDputs("Test skipped because file system does not support holes.");
usage();
goto quit;
}
- if(!enough_room(fapl)) {
+ if (!enough_room(fapl)) {
HDputs("Test skipped because of quota (file size or num open files).");
usage();
goto quit;
@@ -712,9 +727,9 @@ test_family(hid_t fapl)
/* Do the test with the Family Driver */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if(writer(filename, fapl, HUGEFILE, WRT_N))
+ if (writer(filename, fapl, HUGEFILE, WRT_N))
goto error;
- if(reader(filename, fapl))
+ if (reader(filename, fapl))
goto error;
HDputs("Test passed with the Family Driver.");
@@ -731,7 +746,6 @@ error:
return 1;
} /* end test_family() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -756,49 +770,51 @@ error:
*-------------------------------------------------------------------------
*/
int
-main (int ac, char **av)
+main(int ac, char **av)
{
- unsigned long seed = 0; /* Random # seed */
- hid_t fapl = -1;
- hid_t driver = -1;
+ unsigned long seed = 0; /* Random # seed */
+ hid_t fapl = -1;
+ hid_t driver = -1;
/* parameters setup */
- while (--ac > 0){
+ while (--ac > 0) {
av++;
- if (HDstrcmp("-fsize", *av)==0){
+ if (HDstrcmp("-fsize", *av) == 0) {
/* specify a different family file size */
- ac--; av++;
+ ac--;
+ av++;
if (ac > 0) {
family_size_def = (hsize_t)HDstrtoull(*av, NULL, 0);
}
- else{
+ else {
HDprintf("***Missing fsize value***\n");
usage();
return 1;
}
}
- else if (HDstrcmp("-c", *av)==0){
+ else if (HDstrcmp("-c", *av) == 0) {
/* turn off file system check before test */
- cflag=0;
+ cflag = 0;
}
- else if (HDstrcmp("-h", *av)==0){
+ else if (HDstrcmp("-h", *av) == 0) {
usage();
return 0;
- }else{
+ }
+ else {
usage();
return 1;
}
}
/* check VFD to see if this is one we test */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
goto error;
- if((driver = H5Pget_driver(fapl)) < 0)
+ if ((driver = H5Pget_driver(fapl)) < 0)
goto error;
/* check sparse file support unless cflag is not set. */
- if(cflag)
+ if (cflag)
sparse_support = is_sparse();
/* Choose random # seed */
@@ -810,16 +826,16 @@ main (int ac, char **av)
HDsrandom((unsigned)seed);
/* run VFD-specific test */
- if(H5FD_SEC2 == driver) {
- if(test_sec2(fapl) != 0)
+ if (H5FD_SEC2 == driver) {
+ if (test_sec2(fapl) != 0)
goto error;
}
- else if(H5FD_STDIO == driver) {
- if(test_stdio(fapl) != 0)
+ else if (H5FD_STDIO == driver) {
+ if (test_stdio(fapl) != 0)
goto error;
}
- else if(H5FD_FAMILY == driver) {
- if(test_family(fapl) != 0)
+ else if (H5FD_FAMILY == driver) {
+ if (test_family(fapl) != 0)
goto error;
}
else
@@ -831,8 +847,7 @@ main (int ac, char **av)
error:
HDputs("*** TEST FAILED ***");
- if(fapl > 0)
+ if (fapl > 0)
H5Pclose(fapl);
return 1;
}
-
diff --git a/test/bittests.c b/test/bittests.c
index 6f236d6..905f236 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -19,12 +19,11 @@
*/
#include "h5test.h"
-#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h"
-#define NTESTS 100000
+#define NTESTS 100000
-
/*-------------------------------------------------------------------------
* Function: test_find
*
@@ -44,108 +43,106 @@
*-------------------------------------------------------------------------
*/
static herr_t
-test_find (void)
+test_find(void)
{
- uint8_t v1[8];
- int i;
- ssize_t n;
+ uint8_t v1[8];
+ int i;
+ ssize_t n;
TESTING("bit search operations");
/* The zero length buffer */
HDmemset(v1, 0xaa, sizeof v1);
n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_LSB, TRUE);
- if(-1 != n) {
- H5_FAILED();
- HDputs (" Zero length test failed (lsb)!");
- goto failed;
+ if (-1 != n) {
+ H5_FAILED();
+ HDputs(" Zero length test failed (lsb)!");
+ goto failed;
}
n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_MSB, TRUE);
- if(-1 != n) {
- H5_FAILED();
- HDputs (" Zero length test failed (msb)!");
- goto failed;
+ if (-1 != n) {
+ H5_FAILED();
+ HDputs(" Zero length test failed (msb)!");
+ goto failed;
}
-
/* The zero buffer */
HDmemset(v1, 0, sizeof v1);
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE);
- if(-1 != n) {
- H5_FAILED();
- HDputs (" Zero buffer test failed (lsb)!");
- goto failed;
+ if (-1 != n) {
+ H5_FAILED();
+ HDputs(" Zero buffer test failed (lsb)!");
+ goto failed;
}
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE);
- if(-1 != n) {
- H5_FAILED();
- HDputs (" Zero buffer test failed (msb)!");
- goto failed;
+ if (-1 != n) {
+ H5_FAILED();
+ HDputs(" Zero buffer test failed (msb)!");
+ goto failed;
}
/* Try all combinations of one byte */
- for(i = 0; i < 8 * (int)sizeof(v1); i++) {
- HDmemset(v1, 0, sizeof v1);
- v1[i / 8] = (uint8_t)(1 << (i % 8));
- n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE);
- if((ssize_t)i != n) {
- H5_FAILED();
- HDprintf (" Test for set bit %d failed (lsb)!\n", i);
- goto failed;
- }
- n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE);
- if((ssize_t)i != n) {
- H5_FAILED();
- HDprintf (" Test for set bit %d failed (msb)!\n", i);
- goto failed;
- }
+ for (i = 0; i < 8 * (int)sizeof(v1); i++) {
+ HDmemset(v1, 0, sizeof v1);
+ v1[i / 8] = (uint8_t)(1 << (i % 8));
+ n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE);
+ if ((ssize_t)i != n) {
+ H5_FAILED();
+ HDprintf(" Test for set bit %d failed (lsb)!\n", i);
+ goto failed;
+ }
+ n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE);
+ if ((ssize_t)i != n) {
+ H5_FAILED();
+ HDprintf(" Test for set bit %d failed (msb)!\n", i);
+ goto failed;
+ }
}
/* The one buffer */
HDmemset(v1, 0xff, sizeof v1);
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, FALSE);
- if(-1 != n) {
- H5_FAILED();
- HDputs (" One buffer test failed (lsb)!");
- goto failed;
+ if (-1 != n) {
+ H5_FAILED();
+ HDputs(" One buffer test failed (lsb)!");
+ goto failed;
}
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, FALSE);
- if(-1 != n) {
- H5_FAILED();
- HDputs (" One buffer test failed (msb)!");
- goto failed;
+ if (-1 != n) {
+ H5_FAILED();
+ HDputs(" One buffer test failed (msb)!");
+ goto failed;
}
/* Try all combinations of one byte */
- for (i=0; i<8*(int)sizeof(v1); i++) {
- HDmemset(v1, 0xff, sizeof v1);
- v1[i / 8] &= (uint8_t)~(1 << (i % 8));
- n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_LSB, FALSE);
- if ((ssize_t)i!=n) {
- H5_FAILED();
- HDprintf (" Test for clear bit %d failed (lsb)!\n", i);
- goto failed;
- }
- n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_MSB, FALSE);
- if ((ssize_t)i!=n) {
- H5_FAILED();
- HDprintf (" Test for clear bit %d failed (lsb)!\n", i);
- goto failed;
- }
+ for (i = 0; i < 8 * (int)sizeof(v1); i++) {
+ HDmemset(v1, 0xff, sizeof v1);
+ v1[i / 8] &= (uint8_t) ~(1 << (i % 8));
+ n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, FALSE);
+ if ((ssize_t)i != n) {
+ H5_FAILED();
+ HDprintf(" Test for clear bit %d failed (lsb)!\n", i);
+ goto failed;
+ }
+ n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, FALSE);
+ if ((ssize_t)i != n) {
+ H5_FAILED();
+ HDprintf(" Test for clear bit %d failed (lsb)!\n", i);
+ goto failed;
+ }
}
-
PASSED();
return 0;
- failed:
- HDprintf (" v = 0x");
- for (i=0; i<(int)sizeof(v1); i++) HDprintf ("%02x", v1[i]);
- HDprintf ("\n");
+failed:
+ HDprintf(" v = 0x");
+ for (i = 0; i < (int)sizeof(v1); i++)
+ HDprintf("%02x", v1[i]);
+ HDprintf("\n");
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_copy
*
@@ -163,111 +160,115 @@ test_find (void)
*-------------------------------------------------------------------------
*/
static herr_t
-test_copy (void)
+test_copy(void)
{
- uint8_t v1[8], v2[8];
- size_t s_offset, d_offset, size;
- int i, j;
- ssize_t n;
+ uint8_t v1[8], v2[8];
+ size_t s_offset, d_offset, size;
+ int i, j;
+ ssize_t n;
TESTING("bit copy operations");
- for (i=0; i<NTESTS; i++) {
- s_offset = (size_t)HDrand() % (8 * sizeof v1);
- d_offset = (size_t)HDrand() % (8 * sizeof v2);
- size = (unsigned)HDrand() % MIN (8*sizeof(v1), 8*sizeof(v2));
- size = MIN3 (size, 8*sizeof(v1)-s_offset, 8*sizeof(v2)-d_offset);
- HDmemset(v1, 0xff, sizeof v1);
- HDmemset(v2, 0x00, sizeof v2);
-
- /* Copy some bits to v2 and make sure something was copied */
- H5T__bit_copy (v2, d_offset, v1, s_offset, size);
- for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break;
- if (size>0 && j>=(int)sizeof(v2)) {
- H5_FAILED();
- HDputs (" Unabled to find copied region in destination");
- goto failed;
- }
- if (0==size && j<(int)sizeof(v2)) {
- H5_FAILED();
- HDputs (" Found copied bits when we shouldn't have");
- goto failed;
- }
-
-
- /* Look for the zeros and ones */
- n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1);
- if (size>0 && n!=(ssize_t)d_offset) {
- H5_FAILED();
- HDprintf (" Unable to find first copied bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
- if (0==size && n>=0) {
- H5_FAILED();
- HDputs (" Found copied bits and shouldn't have!");
- goto failed;
- }
- n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0);
- if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) {
- H5_FAILED();
- HDprintf (" Unable to find last copied bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
- if (d_offset+size==8*sizeof(v2) && n>=0) {
- H5_FAILED();
- HDputs (" High-order zeros are present and shouldn't be!");
- goto failed;
- }
-
- /*
- * Look for zeros and ones in reverse order. This is only to test
- * that reverse searches work as expected.
- */
- n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1);
- if (size>0 && (size_t)(n+1)!=d_offset+size) {
- H5_FAILED();
- HDprintf (" Unable to find last copied bit in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
- if (0==size && n>=0) {
- H5_FAILED();
- HDputs (" Found copied bits but shouldn't have (reverse)!");
- goto failed;
- }
- n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0);
- if (d_offset>0 && n+1!=(ssize_t)d_offset) {
- H5_FAILED();
- HDprintf (" Unable to find beginning of copied data "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
- if (0==d_offset && n>=0) {
- H5_FAILED();
- HDputs (" Found leading original data but shouldn't have!");
- goto failed;
- }
-
+ for (i = 0; i < NTESTS; i++) {
+ s_offset = (size_t)HDrand() % (8 * sizeof v1);
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
+ size = (unsigned)HDrand() % MIN(8 * sizeof(v1), 8 * sizeof(v2));
+ size = MIN3(size, 8 * sizeof(v1) - s_offset, 8 * sizeof(v2) - d_offset);
+ HDmemset(v1, 0xff, sizeof v1);
+ HDmemset(v2, 0x00, sizeof v2);
+
+ /* Copy some bits to v2 and make sure something was copied */
+ H5T__bit_copy(v2, d_offset, v1, s_offset, size);
+ for (j = 0; j < (int)sizeof(v2); j++)
+ if (v2[j])
+ break;
+ if (size > 0 && j >= (int)sizeof(v2)) {
+ H5_FAILED();
+ HDputs(" Unabled to find copied region in destination");
+ goto failed;
+ }
+ if (0 == size && j < (int)sizeof(v2)) {
+ H5_FAILED();
+ HDputs(" Found copied bits when we shouldn't have");
+ goto failed;
+ }
+
+ /* Look for the zeros and ones */
+ n = H5T__bit_find(v2, (size_t)0, 8 * sizeof(v2), H5T_BIT_LSB, 1);
+ if (size > 0 && n != (ssize_t)d_offset) {
+ H5_FAILED();
+ HDprintf(" Unable to find first copied bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (0 == size && n >= 0) {
+ H5_FAILED();
+ HDputs(" Found copied bits and shouldn't have!");
+ goto failed;
+ }
+ n = H5T__bit_find(v2, d_offset, 8 * sizeof(v2) - d_offset, H5T_BIT_LSB, 0);
+ if (d_offset + size < 8 * sizeof(v2) && n != (ssize_t)size) {
+ H5_FAILED();
+ HDprintf(" Unable to find last copied bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (d_offset + size == 8 * sizeof(v2) && n >= 0) {
+ H5_FAILED();
+ HDputs(" High-order zeros are present and shouldn't be!");
+ goto failed;
+ }
+
+ /*
+ * Look for zeros and ones in reverse order. This is only to test
+ * that reverse searches work as expected.
+ */
+ n = H5T__bit_find(v2, (size_t)0, 8 * sizeof(v2), H5T_BIT_MSB, 1);
+ if (size > 0 && (size_t)(n + 1) != d_offset + size) {
+ H5_FAILED();
+ HDprintf(" Unable to find last copied bit in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (0 == size && n >= 0) {
+ H5_FAILED();
+ HDputs(" Found copied bits but shouldn't have (reverse)!");
+ goto failed;
+ }
+ n = H5T__bit_find(v2, (size_t)0, d_offset + size, H5T_BIT_MSB, 0);
+ if (d_offset > 0 && n + 1 != (ssize_t)d_offset) {
+ H5_FAILED();
+ HDprintf(" Unable to find beginning of copied data "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (0 == d_offset && n >= 0) {
+ H5_FAILED();
+ HDputs(" Found leading original data but shouldn't have!");
+ goto failed;
+ }
}
PASSED();
return 0;
- failed:
- HDprintf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n",
- i, (unsigned long)s_offset, (unsigned long)d_offset,
- (unsigned long)size);
- HDprintf (" s = 0x");
- for (j=sizeof(v1)-1; j>=0; --j) HDprintf ("%02x", v1[j]);
- HDprintf ("\n d = 0x");
- for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]);
- HDprintf ("\n");
+failed:
+ HDprintf(" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", i, (unsigned long)s_offset,
+ (unsigned long)d_offset, (unsigned long)size);
+ HDprintf(" s = 0x");
+ for (j = sizeof(v1) - 1; j >= 0; --j)
+ HDprintf("%02x", v1[j]);
+ HDprintf("\n d = 0x");
+ for (j = sizeof(v2) - 1; j >= 0; --j)
+ HDprintf("%02x", v2[j]);
+ HDprintf("\n");
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_shift
*
@@ -285,122 +286,128 @@ test_copy (void)
*-------------------------------------------------------------------------
*/
static herr_t
-test_shift (void)
+test_shift(void)
{
- uint8_t vector[8];
- size_t offset, size;
- int i, j;
- ssize_t shift_dist, n;
+ uint8_t vector[8];
+ size_t offset, size;
+ int i, j;
+ ssize_t shift_dist, n;
TESTING("bit shift operations");
- for (i=0; i<NTESTS; i++) {
- offset = (size_t)HDrand() % (8 * sizeof vector);
- size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
+ for (i = 0; i < NTESTS; i++) {
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
- if(size == 0) continue;
+ if (size == 0)
+ continue;
shift_dist = (ssize_t)((size_t)HDrand() % size);
- /*-------- LEFT-shift some bits and make sure something was shifted --------*/
- HDmemset(vector, 0x00, sizeof vector);
- H5T__bit_set (vector, offset, size, 1);
-
- H5T__bit_shift (vector, shift_dist, offset, size);
-
- /* Look for the ones */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if(n != (ssize_t)offset + shift_dist) {
- H5_FAILED();
- HDprintf (" Unable to find first bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
-
- /*
- * Look for zeros and ones in reverse order. This is only to test
- * that reverse searches work as expected.
- */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if (n!=(ssize_t)(offset+size-1)) {
- H5_FAILED();
- HDprintf (" Unable to find last bit in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
-
- /*-------- RIGHT-shift some bits and make sure something was shifted --------*/
- HDmemset(vector, 0x00, sizeof vector);
- H5T__bit_set (vector, offset, size, 1);
-
- H5T__bit_shift (vector, -shift_dist, offset, size);
-
- /* Look for the ones */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if ((size_t)n!=offset) {
- H5_FAILED();
- HDprintf (" Unable to find first bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
-
- /*
- * Look for zeros and ones in reverse order. This is only to test
- * that reverse searches work as expected.
- */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if(n != (ssize_t)(offset + size) - shift_dist - 1) {
- H5_FAILED();
- HDprintf (" Unable to find last bit in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
+ /*-------- LEFT-shift some bits and make sure something was shifted --------*/
+ HDmemset(vector, 0x00, sizeof vector);
+ H5T__bit_set(vector, offset, size, 1);
+
+ H5T__bit_shift(vector, shift_dist, offset, size);
+
+ /* Look for the ones */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_LSB, 1);
+ if (n != (ssize_t)offset + shift_dist) {
+ H5_FAILED();
+ HDprintf(" Unable to find first bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+
+ /*
+ * Look for zeros and ones in reverse order. This is only to test
+ * that reverse searches work as expected.
+ */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_MSB, 1);
+ if (n != (ssize_t)(offset + size - 1)) {
+ H5_FAILED();
+ HDprintf(" Unable to find last bit in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+
+ /*-------- RIGHT-shift some bits and make sure something was shifted --------*/
+ HDmemset(vector, 0x00, sizeof vector);
+ H5T__bit_set(vector, offset, size, 1);
+
+ H5T__bit_shift(vector, -shift_dist, offset, size);
+
+ /* Look for the ones */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_LSB, 1);
+ if ((size_t)n != offset) {
+ H5_FAILED();
+ HDprintf(" Unable to find first bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+
+ /*
+ * Look for zeros and ones in reverse order. This is only to test
+ * that reverse searches work as expected.
+ */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_MSB, 1);
+ if (n != (ssize_t)(offset + size) - shift_dist - 1) {
+ H5_FAILED();
+ HDprintf(" Unable to find last bit in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
/*-------- Shift the bits out of sight --------*/
/* A sequence 111111 will be 000000 if shift_dist=6 */
/* Randomly decide shift direction */
- if(size % 2 == 0)
+ if (size % 2 == 0)
shift_dist = (ssize_t)size;
else
shift_dist = -((ssize_t)size);
- HDmemset(vector, 0x00, sizeof vector);
- H5T__bit_set (vector, offset, size, 1);
+ HDmemset(vector, 0x00, sizeof vector);
+ H5T__bit_set(vector, offset, size, 1);
- H5T__bit_shift (vector, shift_dist, offset, size);
+ H5T__bit_shift(vector, shift_dist, offset, size);
- /* Supposed to fail to find any ones */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if (n >= 0) {
- H5_FAILED();
- HDprintf (" Unable to verify all bits are zero in destination(LSB) "
- "(n=%d)\n", (int)n);
- goto failed;
- }
+ /* Supposed to fail to find any ones */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_LSB, 1);
+ if (n >= 0) {
+ H5_FAILED();
+ HDprintf(" Unable to verify all bits are zero in destination(LSB) "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
/* Look from the other direction */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if (n >= 0) {
- H5_FAILED();
- HDprintf (" Unable to verify all bits are zero in destination(MSB) "
- "(n=%d)\n", (int)n);
- goto failed;
- }
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_MSB, 1);
+ if (n >= 0) {
+ H5_FAILED();
+ HDprintf(" Unable to verify all bits are zero in destination(MSB) "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
}
PASSED();
return 0;
- failed:
- HDprintf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n",
- i, (unsigned long)offset, (unsigned long)size,
- (unsigned long)shift_dist);
- for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
- HDprintf ("\n");
+failed:
+ HDprintf(" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n", i, (unsigned long)offset,
+ (unsigned long)size, (unsigned long)shift_dist);
+ for (j = sizeof(vector) - 1; j >= 0; --j)
+ HDprintf("%02x", vector[j]);
+ HDprintf("\n");
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_increment
*
@@ -418,76 +425,80 @@ test_shift (void)
*-------------------------------------------------------------------------
*/
static herr_t
-test_increment (void)
+test_increment(void)
{
- uint8_t vector[8];
- size_t offset, size;
- int i, j;
- ssize_t n;
+ uint8_t vector[8];
+ size_t offset, size;
+ int i, j;
+ ssize_t n;
TESTING("bit increment operations");
- for (i=0; i<NTESTS; i++) {
- offset = (size_t)HDrand() % (8 * sizeof vector);
- size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
+ for (i = 0; i < NTESTS; i++) {
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
- if(size == 0) continue;
-
- HDmemset(vector, 0x00, sizeof vector);
- if(size>1) /* if size=6, make a sequence like 011111 */
- H5T__bit_set (vector, offset, size-1, 1);
- else /* if size=1, just set this one bit to 1 */
- H5T__bit_set (vector, offset, size, 1);
-
- /* Increment the sequence by one */
- H5T__bit_inc (vector, offset, size);
-
- /* Look for the one */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if (size!=1 && (size_t)n!=offset+size-1) {
- H5_FAILED();
- HDprintf (" Unable to find first bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
- if(size==1 && n>=0) {
- H5_FAILED();
- HDprintf (" Unable to verify all-zero bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
-
- /*
- * Look for one in reverse order. This is only to test
- * that reverse searches work as expected.
- */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if (size!=1 && n!=(ssize_t)(offset+size-1)) {
- H5_FAILED();
- HDprintf (" Unable to find last bit in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
- if(size==1 && n>=0) {
- H5_FAILED();
- HDprintf (" Unable to verify all-zero bit in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
+ if (size == 0)
+ continue;
+
+ HDmemset(vector, 0x00, sizeof vector);
+ if (size > 1) /* if size=6, make a sequence like 011111 */
+ H5T__bit_set(vector, offset, size - 1, 1);
+ else /* if size=1, just set this one bit to 1 */
+ H5T__bit_set(vector, offset, size, 1);
+
+ /* Increment the sequence by one */
+ H5T__bit_inc(vector, offset, size);
+
+ /* Look for the one */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_LSB, 1);
+ if (size != 1 && (size_t)n != offset + size - 1) {
+ H5_FAILED();
+ HDprintf(" Unable to find first bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (size == 1 && n >= 0) {
+ H5_FAILED();
+ HDprintf(" Unable to verify all-zero bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+
+ /*
+ * Look for one in reverse order. This is only to test
+ * that reverse searches work as expected.
+ */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_MSB, 1);
+ if (size != 1 && n != (ssize_t)(offset + size - 1)) {
+ H5_FAILED();
+ HDprintf(" Unable to find last bit in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (size == 1 && n >= 0) {
+ H5_FAILED();
+ HDprintf(" Unable to verify all-zero bit in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
}
PASSED();
return 0;
- failed:
- HDprintf (" i=%d, offset=%lu, size=%lu\n",
- i, (unsigned long)offset, (unsigned long)size);
- for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
- HDprintf ("\n");
+failed:
+ HDprintf(" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size);
+ for (j = sizeof(vector) - 1; j >= 0; --j)
+ HDprintf("%02x", vector[j]);
+ HDprintf("\n");
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_decrement
*
@@ -505,61 +516,63 @@ test_increment (void)
*-------------------------------------------------------------------------
*/
static herr_t
-test_decrement (void)
+test_decrement(void)
{
- uint8_t vector[8];
- size_t offset, size;
- int i, j;
- ssize_t n;
+ uint8_t vector[8];
+ size_t offset, size;
+ int i, j;
+ ssize_t n;
TESTING("bit decrement operations");
- for (i=0; i<NTESTS; i++) {
- offset = (size_t)HDrand() % (8 * sizeof vector);
- size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
+ for (i = 0; i < NTESTS; i++) {
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
- if(size == 0) continue;
+ if (size == 0)
+ continue;
/* All-zero sequence will become 111111(size=6) after decrement */
- HDmemset(vector, 0x00, sizeof vector);
-
- /* decrement the sequence by one */
- H5T__bit_dec (vector, offset, size);
-
- /* Look for the ones */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if ((size_t)n!=offset) {
- H5_FAILED();
- HDprintf (" Unable to find first bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
-
- /*
- * Look for zeros and ones in reverse order. This is only to test
- * that reverse searches work as expected.
- */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if (n!=(ssize_t)(offset+size-1)) {
- H5_FAILED();
- HDprintf (" Unable to find last bit in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
+ HDmemset(vector, 0x00, sizeof vector);
+
+ /* decrement the sequence by one */
+ H5T__bit_dec(vector, offset, size);
+
+ /* Look for the ones */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_LSB, 1);
+ if ((size_t)n != offset) {
+ H5_FAILED();
+ HDprintf(" Unable to find first bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+
+ /*
+ * Look for zeros and ones in reverse order. This is only to test
+ * that reverse searches work as expected.
+ */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_MSB, 1);
+ if (n != (ssize_t)(offset + size - 1)) {
+ H5_FAILED();
+ HDprintf(" Unable to find last bit in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
}
PASSED();
return 0;
- failed:
- HDprintf (" i=%d, offset=%lu, size=%lu\n",
- i, (unsigned long)offset, (unsigned long)size);
- for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
- HDprintf ("\n");
+failed:
+ HDprintf(" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size);
+ for (j = sizeof(vector) - 1; j >= 0; --j)
+ HDprintf("%02x", vector[j]);
+ HDprintf("\n");
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_negate
*
@@ -577,89 +590,93 @@ test_decrement (void)
*-------------------------------------------------------------------------
*/
static herr_t
-test_negate (void)
+test_negate(void)
{
- uint8_t vector[8];
- size_t offset, size;
- int i, j;
- ssize_t n;
+ uint8_t vector[8];
+ size_t offset, size;
+ int i, j;
+ ssize_t n;
TESTING("bit negate operations");
- for (i=0; i<NTESTS; i++) {
- offset = (size_t)HDrand() % (8 * sizeof vector);
- size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
+ for (i = 0; i < NTESTS; i++) {
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
- if(size == 0) continue;
+ if (size == 0)
+ continue;
/* All-zero sequence will become 111111(size=6) after negating */
- HDmemset(vector, 0x00, sizeof vector);
-
- /* negate the sequence */
- H5T__bit_neg (vector, offset, size);
-
- /* Look for the ones */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if ((size_t)n!=offset) {
- H5_FAILED();
- HDprintf (" Unable to find first bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
-
- /*
- * Look for zeros and ones in reverse order. This is only to test
- * that reverse searches work as expected.
- */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if (n!=(ssize_t)(offset+size-1)) {
- H5_FAILED();
- HDprintf (" Unable to find last bit in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
+ HDmemset(vector, 0x00, sizeof vector);
+
+ /* negate the sequence */
+ H5T__bit_neg(vector, offset, size);
+
+ /* Look for the ones */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_LSB, 1);
+ if ((size_t)n != offset) {
+ H5_FAILED();
+ HDprintf(" Unable to find first bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+
+ /*
+ * Look for zeros and ones in reverse order. This is only to test
+ * that reverse searches work as expected.
+ */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_MSB, 1);
+ if (n != (ssize_t)(offset + size - 1)) {
+ H5_FAILED();
+ HDprintf(" Unable to find last bit in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
/* All-one sequence will become 000000(size=6) after negating */
- HDmemset(vector, 0x00, sizeof vector);
- H5T__bit_set (vector, offset, size, 1);
-
- /* negate the sequence */
- H5T__bit_neg (vector, offset, size);
-
- /* Look for the ones */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if (n>=0) {
- H5_FAILED();
- HDprintf (" Unable to verify all-zero bits in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
-
- /*
- * Look for ones in reverse order. This is only to test
- * that reverse searches work as expected.
- */
- n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if (n>=0) {
- H5_FAILED();
- HDprintf (" Unable to verify all-zero bits in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
+ HDmemset(vector, 0x00, sizeof vector);
+ H5T__bit_set(vector, offset, size, 1);
+
+ /* negate the sequence */
+ H5T__bit_neg(vector, offset, size);
+
+ /* Look for the ones */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_LSB, 1);
+ if (n >= 0) {
+ H5_FAILED();
+ HDprintf(" Unable to verify all-zero bits in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+
+ /*
+ * Look for ones in reverse order. This is only to test
+ * that reverse searches work as expected.
+ */
+ n = H5T__bit_find(vector, (size_t)0, 8 * sizeof(vector), H5T_BIT_MSB, 1);
+ if (n >= 0) {
+ H5_FAILED();
+ HDprintf(" Unable to verify all-zero bits in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
}
PASSED();
return 0;
- failed:
- HDprintf (" i=%d, offset=%lu, size=%lu\n",
- i, (unsigned long)offset, (unsigned long)size);
- for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
- HDprintf ("\n");
+failed:
+ HDprintf(" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size);
+ for (j = sizeof(vector) - 1; j >= 0; --j)
+ HDprintf("%02x", vector[j]);
+ HDprintf("\n");
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_set
*
@@ -677,106 +694,109 @@ test_negate (void)
*-------------------------------------------------------------------------
*/
static herr_t
-test_set (void)
+test_set(void)
{
- uint8_t v2[8];
- size_t d_offset, size;
- int i, j;
- ssize_t n;
+ uint8_t v2[8];
+ size_t d_offset, size;
+ int i, j;
+ ssize_t n;
TESTING("bit set operations");
- for (i=0; i<NTESTS; i++) {
- d_offset = (size_t)HDrand() % (8 * sizeof v2);
- size = (size_t)HDrand() % (8 * sizeof(v2));
- size = MIN (size, 8*sizeof(v2)-d_offset);
- HDmemset(v2, 0x00, sizeof v2);
-
- /* Set some bits in v2 */
- H5T__bit_set (v2, d_offset, size, TRUE);
- for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break;
- if (size>0 && j>=(int)sizeof(v2)) {
- H5_FAILED();
- HDputs (" Unabled to find set region in buffer");
- goto failed;
- }
- if (0==size && j<(int)sizeof(v2)) {
- H5_FAILED();
- HDputs (" Found set bits when we shouldn't have");
- goto failed;
- }
-
-
- /* Look for the zeros and ones */
- n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1);
- if (size>0 && n!=(ssize_t)d_offset) {
- H5_FAILED();
- HDprintf (" Unable to find first set bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
- if (0==size && n>=0) {
- H5_FAILED();
- HDputs (" Found set bits and shouldn't have!");
- goto failed;
- }
- n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0);
- if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) {
- H5_FAILED();
- HDprintf (" Unable to find last set bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
- if (d_offset+size==8*sizeof(v2) && n>=0) {
- H5_FAILED();
- HDputs (" High-order zeros are present and shouldn't be!");
- goto failed;
- }
-
- /*
- * Look for zeros and ones in reverse order. This is only to test
- * that reverse searches work as expected.
- */
- n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1);
- if (size>0 && (size_t)(n+1)!=d_offset+size) {
- H5_FAILED();
- HDprintf (" Unable to find last set bit in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
- if (0==size && n>=0) {
- H5_FAILED();
- HDputs (" Found set bits but shouldn't have (reverse)!");
- goto failed;
- }
- n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0);
- if (d_offset>0 && n+1!=(ssize_t)d_offset) {
- H5_FAILED();
- HDprintf (" Unable to find beginning of set bit region "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
- if (0==d_offset && n>=0) {
- H5_FAILED();
- HDputs (" Found leading zeros but shouldn't have!");
- goto failed;
- }
-
+ for (i = 0; i < NTESTS; i++) {
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
+ size = (size_t)HDrand() % (8 * sizeof(v2));
+ size = MIN(size, 8 * sizeof(v2) - d_offset);
+ HDmemset(v2, 0x00, sizeof v2);
+
+ /* Set some bits in v2 */
+ H5T__bit_set(v2, d_offset, size, TRUE);
+ for (j = 0; j < (int)sizeof(v2); j++)
+ if (v2[j])
+ break;
+ if (size > 0 && j >= (int)sizeof(v2)) {
+ H5_FAILED();
+ HDputs(" Unabled to find set region in buffer");
+ goto failed;
+ }
+ if (0 == size && j < (int)sizeof(v2)) {
+ H5_FAILED();
+ HDputs(" Found set bits when we shouldn't have");
+ goto failed;
+ }
+
+ /* Look for the zeros and ones */
+ n = H5T__bit_find(v2, (size_t)0, 8 * sizeof(v2), H5T_BIT_LSB, 1);
+ if (size > 0 && n != (ssize_t)d_offset) {
+ H5_FAILED();
+ HDprintf(" Unable to find first set bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (0 == size && n >= 0) {
+ H5_FAILED();
+ HDputs(" Found set bits and shouldn't have!");
+ goto failed;
+ }
+ n = H5T__bit_find(v2, d_offset, 8 * sizeof(v2) - d_offset, H5T_BIT_LSB, 0);
+ if (d_offset + size < 8 * sizeof(v2) && n != (ssize_t)size) {
+ H5_FAILED();
+ HDprintf(" Unable to find last set bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (d_offset + size == 8 * sizeof(v2) && n >= 0) {
+ H5_FAILED();
+ HDputs(" High-order zeros are present and shouldn't be!");
+ goto failed;
+ }
+
+ /*
+ * Look for zeros and ones in reverse order. This is only to test
+ * that reverse searches work as expected.
+ */
+ n = H5T__bit_find(v2, (size_t)0, 8 * sizeof(v2), H5T_BIT_MSB, 1);
+ if (size > 0 && (size_t)(n + 1) != d_offset + size) {
+ H5_FAILED();
+ HDprintf(" Unable to find last set bit in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (0 == size && n >= 0) {
+ H5_FAILED();
+ HDputs(" Found set bits but shouldn't have (reverse)!");
+ goto failed;
+ }
+ n = H5T__bit_find(v2, (size_t)0, d_offset + size, H5T_BIT_MSB, 0);
+ if (d_offset > 0 && n + 1 != (ssize_t)d_offset) {
+ H5_FAILED();
+ HDprintf(" Unable to find beginning of set bit region "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (0 == d_offset && n >= 0) {
+ H5_FAILED();
+ HDputs(" Found leading zeros but shouldn't have!");
+ goto failed;
+ }
}
PASSED();
return 0;
- failed:
- HDprintf (" i=%d, d_offset=%lu, size=%lu\n",
- i, (unsigned long)d_offset, (unsigned long)size);
- HDprintf (" d = 0x");
- for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]);
- HDprintf ("\n");
+failed:
+ HDprintf(" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size);
+ HDprintf(" d = 0x");
+ for (j = sizeof(v2) - 1; j >= 0; --j)
+ HDprintf("%02x", v2[j]);
+ HDprintf("\n");
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_clear
*
@@ -794,106 +814,109 @@ test_set (void)
*-------------------------------------------------------------------------
*/
static herr_t
-test_clear (void)
+test_clear(void)
{
- uint8_t v2[8];
- size_t d_offset, size;
- int i, j;
- ssize_t n;
+ uint8_t v2[8];
+ size_t d_offset, size;
+ int i, j;
+ ssize_t n;
TESTING("bit clear operations");
- for (i=0; i<NTESTS; i++) {
- d_offset = (size_t)HDrand() % (8 * sizeof v2);
- size = (size_t)HDrand() % (8 * sizeof(v2));
- size = MIN (size, 8*sizeof(v2)-d_offset);
- HDmemset(v2, 0xff, sizeof v2);
-
- /* Clear some bits in v2 */
- H5T__bit_set (v2, d_offset, size, FALSE);
- for (j=0; j<(int)sizeof(v2); j++) if (0xff!=v2[j]) break;
- if (size>0 && j>=(int)sizeof(v2)) {
- H5_FAILED();
- HDputs (" Unabled to find cleared region in buffer");
- goto failed;
- }
- if (0==size && j<(int)sizeof(v2)) {
- H5_FAILED();
- HDputs (" Found cleared bits when we shouldn't have");
- goto failed;
- }
-
-
- /* Look for the zeros and ones */
- n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 0);
- if (size>0 && n!=(ssize_t)d_offset) {
- H5_FAILED();
- HDprintf (" Unable to find first cleared bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
- if (0==size && n>=0) {
- H5_FAILED();
- HDputs (" Found cleared bits and shouldn't have!");
- goto failed;
- }
- n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 1);
- if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) {
- H5_FAILED();
- HDprintf (" Unable to find last cleared bit in destination "
- "(n=%d)\n", (int)n);
- goto failed;
- }
- if (d_offset+size==8*sizeof(v2) && n>=0) {
- H5_FAILED();
- HDputs (" High-order ones are present and shouldn't be!");
- goto failed;
- }
-
- /*
- * Look for zeros and ones in reverse order. This is only to test
- * that reverse searches work as expected.
- */
- n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 0);
- if (size>0 && (size_t)(n+1)!=d_offset+size) {
- H5_FAILED();
- HDprintf (" Unable to find last cleared bit in destination "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
- if (0==size && n>=0) {
- H5_FAILED();
- HDputs (" Found cleared bits but shouldn't have (reverse)!");
- goto failed;
- }
- n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 1);
- if (d_offset>0 && n+1!=(ssize_t)d_offset) {
- H5_FAILED();
- HDprintf (" Unable to find beginning of cleared bit region "
- "(reverse, n=%d)\n", (int)n);
- goto failed;
- }
- if (0==d_offset && n>=0) {
- H5_FAILED();
- HDputs (" Found leading ones but shouldn't have!");
- goto failed;
- }
-
+ for (i = 0; i < NTESTS; i++) {
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
+ size = (size_t)HDrand() % (8 * sizeof(v2));
+ size = MIN(size, 8 * sizeof(v2) - d_offset);
+ HDmemset(v2, 0xff, sizeof v2);
+
+ /* Clear some bits in v2 */
+ H5T__bit_set(v2, d_offset, size, FALSE);
+ for (j = 0; j < (int)sizeof(v2); j++)
+ if (0xff != v2[j])
+ break;
+ if (size > 0 && j >= (int)sizeof(v2)) {
+ H5_FAILED();
+ HDputs(" Unabled to find cleared region in buffer");
+ goto failed;
+ }
+ if (0 == size && j < (int)sizeof(v2)) {
+ H5_FAILED();
+ HDputs(" Found cleared bits when we shouldn't have");
+ goto failed;
+ }
+
+ /* Look for the zeros and ones */
+ n = H5T__bit_find(v2, (size_t)0, 8 * sizeof(v2), H5T_BIT_LSB, 0);
+ if (size > 0 && n != (ssize_t)d_offset) {
+ H5_FAILED();
+ HDprintf(" Unable to find first cleared bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (0 == size && n >= 0) {
+ H5_FAILED();
+ HDputs(" Found cleared bits and shouldn't have!");
+ goto failed;
+ }
+ n = H5T__bit_find(v2, d_offset, 8 * sizeof(v2) - d_offset, H5T_BIT_LSB, 1);
+ if (d_offset + size < 8 * sizeof(v2) && n != (ssize_t)size) {
+ H5_FAILED();
+ HDprintf(" Unable to find last cleared bit in destination "
+ "(n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (d_offset + size == 8 * sizeof(v2) && n >= 0) {
+ H5_FAILED();
+ HDputs(" High-order ones are present and shouldn't be!");
+ goto failed;
+ }
+
+ /*
+ * Look for zeros and ones in reverse order. This is only to test
+ * that reverse searches work as expected.
+ */
+ n = H5T__bit_find(v2, (size_t)0, 8 * sizeof(v2), H5T_BIT_MSB, 0);
+ if (size > 0 && (size_t)(n + 1) != d_offset + size) {
+ H5_FAILED();
+ HDprintf(" Unable to find last cleared bit in destination "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (0 == size && n >= 0) {
+ H5_FAILED();
+ HDputs(" Found cleared bits but shouldn't have (reverse)!");
+ goto failed;
+ }
+ n = H5T__bit_find(v2, (size_t)0, d_offset + size, H5T_BIT_MSB, 1);
+ if (d_offset > 0 && n + 1 != (ssize_t)d_offset) {
+ H5_FAILED();
+ HDprintf(" Unable to find beginning of cleared bit region "
+ "(reverse, n=%d)\n",
+ (int)n);
+ goto failed;
+ }
+ if (0 == d_offset && n >= 0) {
+ H5_FAILED();
+ HDputs(" Found leading ones but shouldn't have!");
+ goto failed;
+ }
}
PASSED();
return 0;
- failed:
- HDprintf (" i=%d, d_offset=%lu, size=%lu\n",
- i, (unsigned long)d_offset, (unsigned long)size);
- HDprintf (" d = 0x");
- for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]);
- HDprintf ("\n");
+failed:
+ HDprintf(" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size);
+ HDprintf(" d = 0x");
+ for (j = sizeof(v2) - 1; j >= 0; --j)
+ HDprintf("%02x", v2[j]);
+ HDprintf("\n");
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -925,9 +948,8 @@ main(void)
nerrors += test_decrement() < 0 ? 1 : 0;
nerrors += test_negate() < 0 ? 1 : 0;
- if(nerrors) {
- HDprintf("***** %u FAILURE%s! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ if (nerrors) {
+ HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
}
HDprintf("All bit tests passed.\n");
@@ -936,4 +958,3 @@ main(void)
HDexit(EXIT_SUCCESS);
} /* end main() */
-
diff --git a/test/btree2.c b/test/btree2.c
index b85f033..4391a3b 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -20,37 +20,32 @@
* This file needs to access private datatypes from the H5B2 package.
* This file also needs to access the v2 B-tree testing code.
*/
-#define H5B2_FRIEND /*suppress error about including H5B2pkg */
+#define H5B2_FRIEND /*suppress error about including H5B2pkg */
#define H5B2_TESTING
#include "H5B2pkg.h"
/* Other private headers that this test requires */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
-const char *FILENAME[] = {
- "btree2",
- "btree2_tmp",
- NULL
-};
-
-#define INSERT_SPLIT_ROOT_NREC 63
-#define INSERT_SPLIT_ROOT_NREC_REC 64
-#define INSERT_MANY (1000 * 1000)
-#define INSERT_MANY_REC (2700 * 1000)
-#define FIND_MANY (INSERT_MANY / 100)
-#define FIND_MANY_REC (INSERT_MANY_REC / 100)
-#define FIND_NEIGHBOR 2000
-#define DELETE_SMALL 20
-#define DELETE_MEDIUM 200
-#define DELETE_LARGE 2000
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+const char *FILENAME[] = {"btree2", "btree2_tmp", NULL};
+
+#define INSERT_SPLIT_ROOT_NREC 63
+#define INSERT_SPLIT_ROOT_NREC_REC 64
+#define INSERT_MANY (1000 * 1000)
+#define INSERT_MANY_REC (2700 * 1000)
+#define FIND_MANY (INSERT_MANY / 100)
+#define FIND_MANY_REC (INSERT_MANY_REC / 100)
+#define FIND_NEIGHBOR 2000
+#define DELETE_SMALL 20
+#define DELETE_MEDIUM 200
+#define DELETE_LARGE 2000
/* Testing parameters */
typedef struct bt2_test_param_t {
- hbool_t reopen_btree; /* Whether to re-open the B-tree during the test */
+ hbool_t reopen_btree; /* Whether to re-open the B-tree during the test */
} bt2_test_param_t;
-
/*-------------------------------------------------------------------------
* Function: init_cparam
*
@@ -71,9 +66,9 @@ init_cparam(H5B2_create_t *cparam, H5B2_create_t *cparam2)
HDmemset(cparam, 0, sizeof(*cparam));
/* General parameters */
- cparam->cls = H5B2_TEST;
- cparam->node_size = (size_t)512;
- cparam->rrec_size = (size_t)8;
+ cparam->cls = H5B2_TEST;
+ cparam->node_size = (size_t)512;
+ cparam->rrec_size = (size_t)8;
cparam->split_percent = 100;
cparam->merge_percent = 40;
@@ -81,16 +76,15 @@ init_cparam(H5B2_create_t *cparam, H5B2_create_t *cparam2)
HDmemset(cparam2, 0, sizeof(*cparam2));
/* General parameters */
- cparam2->cls = H5B2_TEST2;
- cparam2->node_size = (size_t)1024;
- cparam2->rrec_size = (size_t)16;
+ cparam2->cls = H5B2_TEST2;
+ cparam2->node_size = (size_t)1024;
+ cparam2->rrec_size = (size_t)16;
cparam2->split_percent = 100;
cparam2->merge_percent = 40;
- return(0);
+ return (0);
} /* init_cparam() */
-
/*-------------------------------------------------------------------------
* Function: create_file
*
@@ -107,31 +101,30 @@ init_cparam(H5B2_create_t *cparam, H5B2_create_t *cparam2)
static int
create_file(hid_t *file, H5F_t **f, hid_t fapl)
{
- char filename[1024]; /* Filename to use */
+ char filename[1024]; /* Filename to use */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((*file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((*file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (*f = (H5F_t *)H5VL_object(*file)))
+ if (NULL == (*f = (H5F_t *)H5VL_object(*file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(*f) < 0)
+ if (H5AC_ignore_tags(*f) < 0)
STACK_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end create_file() */
-
/*-------------------------------------------------------------------------
* Function: create_btree
*
@@ -146,25 +139,23 @@ error:
*-------------------------------------------------------------------------
*/
static int
-create_btree(H5F_t *f, const H5B2_create_t *cparam,
- H5B2_t **bt2, haddr_t *bt2_addr)
+create_btree(H5F_t *f, const H5B2_create_t *cparam, H5B2_t **bt2, haddr_t *bt2_addr)
{
/* Create the v2 B-tree & get its address */
- if(NULL == (*bt2 = H5B2_create(f, cparam, f)))
+ if (NULL == (*bt2 = H5B2_create(f, cparam, f)))
FAIL_STACK_ERROR
- if(H5B2_get_addr(*bt2, bt2_addr/*out*/) < 0)
+ if (H5B2_get_addr(*bt2, bt2_addr /*out*/) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(*bt2_addr))
+ if (!H5F_addr_defined(*bt2_addr))
FAIL_STACK_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end create_btree() */
-
/*-------------------------------------------------------------------------
* Function: reopen_file
*
@@ -181,31 +172,30 @@ error:
static int
reopen_file(hid_t *file, H5F_t **f, hid_t fapl)
{
- char filename[1024]; /* Filename to use */
+ char filename[1024]; /* Filename to use */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((*file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((*file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (*f = (H5F_t *)H5VL_object(*file)))
+ if (NULL == (*f = (H5F_t *)H5VL_object(*file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(*f) < 0)
+ if (H5AC_ignore_tags(*f) < 0)
STACK_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end create_file() */
-
/*-------------------------------------------------------------------------
* Function: reopen_btree
*
@@ -220,28 +210,26 @@ error:
*-------------------------------------------------------------------------
*/
static int
-reopen_btree(H5F_t *f, H5B2_t **bt2, haddr_t bt2_addr,
- const bt2_test_param_t *tparam)
+reopen_btree(H5F_t *f, H5B2_t **bt2, haddr_t bt2_addr, const bt2_test_param_t *tparam)
{
/* Check for closing & re-opening the B-tree */
- if(tparam->reopen_btree) {
+ if (tparam->reopen_btree) {
/* Close (empty) v2 B-tree */
- if(H5B2_close(*bt2) < 0)
+ if (H5B2_close(*bt2) < 0)
FAIL_STACK_ERROR
/* Re-open v2 B-tree */
- if(NULL == (*bt2 = H5B2_open(f, bt2_addr, f)))
+ if (NULL == (*bt2 = H5B2_open(f, bt2_addr, f)))
FAIL_STACK_ERROR
} /* end if */
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end reopen_btree() */
-
/*-------------------------------------------------------------------------
* Function: check_stats
*
@@ -258,24 +246,23 @@ error:
static int
check_stats(H5B2_t *bt2, const H5B2_stat_t *expected)
{
- H5B2_stat_t actual; /* Actual stats retrieved about v2 B-tree */
+ H5B2_stat_t actual; /* Actual stats retrieved about v2 B-tree */
/* Get current stats */
- if(H5B2_stat_info(bt2, &actual) < 0)
+ if (H5B2_stat_info(bt2, &actual) < 0)
FAIL_STACK_ERROR
- if(actual.depth != expected->depth)
+ if (actual.depth != expected->depth)
TEST_ERROR
- if(actual.nrecords != expected->nrecords)
+ if (actual.nrecords != expected->nrecords)
TEST_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end check_stats() */
-
/*-------------------------------------------------------------------------
* Function: check_node_depth
*
@@ -292,21 +279,20 @@ error:
static int
check_node_depth(H5B2_t *bt2, void *record, unsigned depth)
{
- int rec_depth; /* Depth of record in B-tree */
+ int rec_depth; /* Depth of record in B-tree */
- if((rec_depth = H5B2__get_node_depth_test(bt2, record)) < 0)
+ if ((rec_depth = H5B2__get_node_depth_test(bt2, record)) < 0)
FAIL_STACK_ERROR
- if((unsigned)rec_depth != depth)
+ if ((unsigned)rec_depth != depth)
TEST_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end check_node_depth() */
-
/*-------------------------------------------------------------------------
* Function: check_node_info
*
@@ -321,26 +307,24 @@ error:
*-------------------------------------------------------------------------
*/
static int
-check_node_info(H5B2_t *bt2, hsize_t record,
- H5B2_node_info_test_t *ninfo)
+check_node_info(H5B2_t *bt2, hsize_t record, H5B2_node_info_test_t *ninfo)
{
- H5B2_node_info_test_t rec_ninfo; /* Node info for record in B-tree */
+ H5B2_node_info_test_t rec_ninfo; /* Node info for record in B-tree */
- if(H5B2__get_node_info_test(bt2, &record, &rec_ninfo) < 0)
+ if (H5B2__get_node_info_test(bt2, &record, &rec_ninfo) < 0)
FAIL_STACK_ERROR
- if(rec_ninfo.depth != ninfo->depth)
+ if (rec_ninfo.depth != ninfo->depth)
TEST_ERROR
- if(rec_ninfo.nrec != ninfo->nrec)
+ if (rec_ninfo.nrec != ninfo->nrec)
TEST_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end check_node_info() */
-
/*-------------------------------------------------------------------------
* Function: iter_cb
*
@@ -358,16 +342,15 @@ static int
iter_cb(const void *_record, void *_op_data)
{
const hsize_t *record = (const hsize_t *)_record;
- hsize_t *idx = (hsize_t *)_op_data;
+ hsize_t * idx = (hsize_t *)_op_data;
- if(*record != *idx)
- return(H5_ITER_ERROR);
+ if (*record != *idx)
+ return (H5_ITER_ERROR);
(*idx)++;
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
} /* end iter_cb() */
-
/*-------------------------------------------------------------------------
* Function: iter_rec_cb
*
@@ -385,19 +368,18 @@ static int
iter_rec_cb(const void *_record, void *_op_data)
{
const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record;
- H5B2_test_rec_t *idx = (H5B2_test_rec_t *)_op_data;
+ H5B2_test_rec_t * idx = (H5B2_test_rec_t *)_op_data;
- if(record->key != idx->key)
- return(H5_ITER_ERROR);
- if(record->val != idx->val)
- return(H5_ITER_ERROR);
+ if (record->key != idx->key)
+ return (H5_ITER_ERROR);
+ if (record->val != idx->val)
+ return (H5_ITER_ERROR);
idx->key++;
idx->val += 2;
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
} /* end iter_rec_cb() */
-
/*-------------------------------------------------------------------------
* Function: find_cb
*
@@ -415,15 +397,14 @@ static int
find_cb(const void *_record, void *_op_data)
{
const hsize_t *record = (const hsize_t *)_record;
- hsize_t *search = (hsize_t *)_op_data;
+ hsize_t * search = (hsize_t *)_op_data;
- if(*record != *search)
- return(FALSE);
+ if (*record != *search)
+ return (FALSE);
- return(TRUE);
+ return (TRUE);
} /* end find_cb() */
-
/*-------------------------------------------------------------------------
* Function: find_rec_cb
*
@@ -441,16 +422,15 @@ static int
find_rec_cb(const void *_record, void *_op_data)
{
const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record;
- H5B2_test_rec_t *search = (H5B2_test_rec_t *)_op_data;
+ H5B2_test_rec_t * search = (H5B2_test_rec_t *)_op_data;
- if(record->key != search->key)
- return(FALSE);
+ if (record->key != search->key)
+ return (FALSE);
search->val = record->val;
- return(TRUE);
+ return (TRUE);
} /* end find_rec_cb() */
-
/*-------------------------------------------------------------------------
* Function: find_dec_cb
*
@@ -470,15 +450,14 @@ static int
find_dec_cb(const void *_record, void *_op_data)
{
const hsize_t *record = (const hsize_t *)_record;
- hsize_t *search = (hsize_t *)_op_data;
+ hsize_t * search = (hsize_t *)_op_data;
- if(*record != (INSERT_MANY - (*search + 1)))
- return(-1);
+ if (*record != (INSERT_MANY - (*search + 1)))
+ return (-1);
- return(0);
+ return (0);
} /* end find_dec_cb() */
-
/*-------------------------------------------------------------------------
* Function: index_rec_cb
*
@@ -496,17 +475,16 @@ static int
index_rec_cb(const void *_record, void *_op_data)
{
const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record;
- H5B2_test_rec_t *search = (H5B2_test_rec_t *)_op_data;
+ H5B2_test_rec_t * search = (H5B2_test_rec_t *)_op_data;
HDassert(record);
HDassert(search);
search->key = record->key;
search->val = record->val;
- return(TRUE);
+ return (TRUE);
} /* end index_rec_cb() */
-
/*-------------------------------------------------------------------------
* Function: neighbor_cb
*
@@ -525,14 +503,13 @@ static int
neighbor_cb(const void *_record, void *_op_data)
{
const hsize_t *record = (const hsize_t *)_record;
- hsize_t *search = (hsize_t *)_op_data;
+ hsize_t * search = (hsize_t *)_op_data;
*search = *record;
- return(0);
+ return (0);
} /* end neighbor_cb() */
-
/*-------------------------------------------------------------------------
* Function: modify_cb
*
@@ -553,13 +530,12 @@ modify_cb(void *_record, void *_op_data, hbool_t *changed)
hsize_t *record = (hsize_t *)_record;
hsize_t *modify = (hsize_t *)_op_data;
- *record = *modify;
+ *record = *modify;
*changed = TRUE;
- return(0);
+ return (0);
} /* end modify_cb() */
-
/*-------------------------------------------------------------------------
* Function: modify_rec_cb
*
@@ -581,12 +557,11 @@ modify_rec_cb(void *_record, void *_op_data, hbool_t *changed)
HDassert(record->key == modify->key);
record->val = modify->val;
- *changed = TRUE;
+ *changed = TRUE;
- return(0);
+ return (0);
} /* end modify_rec_cb() */
-
/*-------------------------------------------------------------------------
* Function: no_modify_cb
*
@@ -602,15 +577,13 @@ modify_rec_cb(void *_record, void *_op_data, hbool_t *changed)
*-------------------------------------------------------------------------
*/
static int
-no_modify_cb(void H5_ATTR_UNUSED *_record, void H5_ATTR_UNUSED *_op_data,
- hbool_t *changed)
+no_modify_cb(void H5_ATTR_UNUSED *_record, void H5_ATTR_UNUSED *_op_data, hbool_t *changed)
{
*changed = FALSE;
- return(1);
+ return (1);
} /* end no_modify_cb() */
-
/*-------------------------------------------------------------------------
* Function: remove_cb
*
@@ -628,15 +601,14 @@ no_modify_cb(void H5_ATTR_UNUSED *_record, void H5_ATTR_UNUSED *_op_data,
static int
remove_cb(const void *_record, void *_op_data)
{
- const hsize_t *record = (const hsize_t *)_record;
- hsize_t *rrecord = (hsize_t *)_op_data;
+ const hsize_t *record = (const hsize_t *)_record;
+ hsize_t * rrecord = (hsize_t *)_op_data;
*rrecord = *record;
- return(0);
+ return (0);
} /* end remove_cb() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_basic
*
@@ -651,16 +623,15 @@ remove_cb(const void *_record, void *_op_data)
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_basic(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t idx; /* Index within B-tree, for iterator */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ herr_t ret; /* Generic error return value */
/*
* Test v2 B-tree creation
@@ -668,11 +639,11 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree creation");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
PASSED();
@@ -683,29 +654,28 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree iteration: empty B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to iterate over a B-tree with no records */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index hasn't changed */
- if(idx != 0)
+ if (idx != 0)
TEST_ERROR
/* Attempt to find record in B-tree with no records */
idx = 0;
- if(H5B2_find(bt2, &idx, find_cb, NULL) != FALSE)
+ if (H5B2_find(bt2, &idx, find_cb, NULL) != FALSE)
TEST_ERROR
/* Attempt to index record in B-tree with no records */
idx = 0;
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
PASSED();
@@ -716,45 +686,44 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: first record");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
record = 42;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Attempt to find non-existant record in B-tree with 1 record */
/* (Should not be found, but not fail) */
idx = 41;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Try again with NULL 'op' */
/* (Should not be found, but not fail) */
- if(H5B2_find(bt2, &idx, NULL, NULL) != FALSE)
+ if (H5B2_find(bt2, &idx, NULL, NULL) != FALSE)
TEST_ERROR
/* Attempt to find existant record in B-tree with 1 record */
idx = 42;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
TEST_ERROR
/* Try again with NULL 'op' */
- if(H5B2_find(bt2, &idx, NULL, NULL) != TRUE)
+ if (H5B2_find(bt2, &idx, NULL, NULL) != TRUE)
TEST_ERROR
/* Attempt to index non-existant record in B-tree with 1 record */
idx = 0;
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, find_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, find_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in B-tree with 1 record */
idx = 42;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
TEST_ERROR
PASSED();
@@ -765,88 +734,88 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: several records");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/*
* Test inserting second record into v2 B-tree, before all other records
*/
record = 34;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/*
* Test inserting third record into v2 B-tree, after all other records
*/
record = 56;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/*
* Test inserting fourth record into v2 B-tree, in the middle of other records
*/
record = 38;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Attempt to find non-existant record in level-0 B-tree with several records */
/* (Should not be found, but not fail) */
idx = 41;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Attempt to find existant record in level-0 B-tree with several record */
idx = 56;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
TEST_ERROR
/* Attempt to index non-existant record in B-tree with several records */
idx = 0;
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, find_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, find_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in B-tree with several records */
idx = 34;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
TEST_ERROR
idx = 38;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, find_cb, &idx) < 0)
TEST_ERROR
idx = 42;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)2, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)2, find_cb, &idx) < 0)
TEST_ERROR
idx = 56;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)3, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)3, find_cb, &idx) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
/* All tests passed */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_insert_basic() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_split_root
*
@@ -864,18 +833,17 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t idx; /* Index within B-tree, for iterator */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
/*
* Test inserting enough records into v2 B-tree to split the root node
@@ -883,129 +851,129 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split root");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert records to fill root leaf node */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC - 1); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC - 1); u++) {
record = u + 2;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 0;
+ bt2_stat.depth = 0;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC - 1);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (hsize_t)33;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to split root leaf node */
record = INSERT_SPLIT_ROOT_NREC + 1;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (hsize_t)33;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
-
/* Insert a couple more records, on the left side of the B-tree */
record = 0;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
record = 1;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + 2);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (hsize_t)33;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
-
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != (INSERT_SPLIT_ROOT_NREC + 2))
+ if (idx != (INSERT_SPLIT_ROOT_NREC + 2))
TEST_ERROR
/* Attempt to find non-existant record in level-1 B-tree */
/* (Should not be found, but not fail) */
idx = INSERT_SPLIT_ROOT_NREC + 10;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Attempt to find existant record in root of level-1 B-tree */
idx = 33;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Attempt to find existant record in leaf of level-1 B-tree */
idx = 56;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Attempt to index non-existant record in level-1 B-tree */
idx = 0;
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC+2), find_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC + 2), find_cb, NULL);
+ }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in root of level-1 B-tree */
idx = 33;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)33, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)33, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to index existing record in left leaf of level-1 B-tree */
idx = 0;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to index existing record in right leaf of level-1 B-tree */
idx = 50;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)50, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)50, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -1013,15 +981,16 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_split_root() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level1_2leaf_redistrib
*
@@ -1040,16 +1009,15 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -1057,52 +1025,51 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: redistribute 2 leaves in level 1 B-tree (l->r)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
- record = u + (INSERT_SPLIT_ROOT_NREC/2) + 1;
- if(H5B2_insert(bt2, &record) < 0)
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ record = u + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (hsize_t)INSERT_SPLIT_ROOT_NREC;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
-
/* Force redistribution from left node into right node */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
@@ -1114,52 +1081,52 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: redistribute 2 leaves in level 1 B-tree (r->l)");
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (hsize_t)(INSERT_SPLIT_ROOT_NREC / 2);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force redistribution from left node into right node */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
record = u + INSERT_SPLIT_ROOT_NREC;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1167,15 +1134,16 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level1_2leaf_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level1_side_split
*
@@ -1194,16 +1162,15 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -1211,54 +1178,54 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split side leaf into 2 leaves in level 1 B-tree (l->r)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u + INSERT_SPLIT_ROOT_NREC;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force left node to split */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 31;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = 63;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
@@ -1270,55 +1237,55 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split side leaf into 2 leaves in level 1 B-tree (r->l)");
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force right node to split */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u + INSERT_SPLIT_ROOT_NREC;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 62;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = 94;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1326,15 +1293,16 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level1_side_split() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level1_3leaf_redistrib
*
@@ -1355,17 +1323,16 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -1373,95 +1340,95 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: redistribute 3 leaves in level 1 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u + (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1);
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (2 * INSERT_SPLIT_ROOT_NREC);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force left node to split */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert records to force middle node to redistribute */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC / 2) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC / 2) + 1); u++) {
record = u + INSERT_SPLIT_ROOT_NREC;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 52;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = 105;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != ((INSERT_SPLIT_ROOT_NREC * 2) + (INSERT_SPLIT_ROOT_NREC / 2) + 1))
+ if (idx != ((INSERT_SPLIT_ROOT_NREC * 2) + (INSERT_SPLIT_ROOT_NREC / 2) + 1))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1469,15 +1436,16 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level1_3leaf_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level1_middle_split
*
@@ -1497,17 +1465,16 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -1515,75 +1482,75 @@ test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split middle leaf into 2 leaves in level 1 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 2);
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force split from left node into right node */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = 3 * INSERT_SPLIT_ROOT_NREC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 62;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = 94;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = 126;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != (INSERT_SPLIT_ROOT_NREC * 3))
+ if (idx != (INSERT_SPLIT_ROOT_NREC * 3))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
@@ -1591,15 +1558,16 @@ test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level1_middle_split() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_make_level2
*
@@ -1615,18 +1583,17 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
/*
* Test inserting many records into v2 B-tree
@@ -1634,135 +1601,136 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: make level 2 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 9); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 9); u++) {
record = u + 2;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
- for(; u < ((INSERT_SPLIT_ROOT_NREC * 29) + 1); u++) {
+ for (; u < ((INSERT_SPLIT_ROOT_NREC * 29) + 1); u++) {
record = u + 4;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 948;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Add some extra records to left-most leaf */
record = 0;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
record = 1;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Add some extra records to middle leaf */
record = (INSERT_SPLIT_ROOT_NREC * 9) + 2;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
record = (INSERT_SPLIT_ROOT_NREC * 9) + 3;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
-
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != ((INSERT_SPLIT_ROOT_NREC * 29) + 5))
+ if (idx != ((INSERT_SPLIT_ROOT_NREC * 29) + 5))
TEST_ERROR
/* Attempt to find non-existant record in level-2 B-tree */
/* (Should not be found, but not fail) */
idx = INSERT_SPLIT_ROOT_NREC * 30;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Attempt to find existant record in root of level-2 B-tree */
idx = 948;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Check with B-tree */
record = 948;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
/* Attempt to find existant record in internal node of level-2 B-tree */
idx = 505;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Check with B-tree */
record = 505;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Attempt to find existant record in leaf of level-2 B-tree */
idx = 555;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Check with B-tree */
record = 555;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Attempt to index non-existant record in level-2 B-tree */
idx = 0;
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC * 30), find_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC * 30), find_cb, NULL);
+ }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in root of level-2 B-tree */
idx = 948;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)948, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)948, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to index existing record in internal node of level-2 B-tree */
idx = 505;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)505, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)505, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to index existing record in leaf of level-2 B-tree */
idx = 555;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)555, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)555, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1770,15 +1738,16 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_make_level2() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level2_leaf_redistrib
*
@@ -1796,17 +1765,16 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -1814,63 +1782,63 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: redistrib right-most leaf in level 2 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
/* And fill rightmost leaf */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 8); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 8); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
- for(; u < ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2)); u++) {
+ for (; u < ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2)); u++) {
record = u + INSERT_SPLIT_ROOT_NREC + 1;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1008;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
record = 1859;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = 1921;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to force redistribution of rightmost leaf */
record = u + INSERT_SPLIT_ROOT_NREC + 1;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1008;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
record = 1875;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = 1922;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -1878,46 +1846,46 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: redistrib left-most leaf in level 2 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1008;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
record = 94;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = 32;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Add more records to left-most leaf, to force a 2->1 split and then a
* 2 node redistribution on left leaf
*/
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1008;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
record = 47;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = 0;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -1925,72 +1893,72 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: redistrib middle leaf in level 2 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1008;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0) /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0) /* Record in root node */
TEST_ERROR
record = 535;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */
TEST_ERROR
record = 630;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */
TEST_ERROR
record = 568;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
TEST_ERROR
/* Add more records to middle leaf, to force a split and a 3 node redistribution on middle leaf */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 8) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + (INSERT_SPLIT_ROOT_NREC / 2) + 2;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1008;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0) /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0) /* Record in root node */
TEST_ERROR
record = 524;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */
TEST_ERROR
record = 577;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */
TEST_ERROR
record = 568;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != ((INSERT_SPLIT_ROOT_NREC * 30) + (INSERT_SPLIT_ROOT_NREC / 2) + 2))
+ if (idx != ((INSERT_SPLIT_ROOT_NREC * 30) + (INSERT_SPLIT_ROOT_NREC / 2) + 2))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
@@ -1998,15 +1966,16 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level2_leaf_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level2_leaf_split
*
@@ -2024,17 +1993,16 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -2042,67 +2010,67 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split right-most leaf in level 2 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 8); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 8); u++) {
record = u + 1;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
- for(; u < ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2)); u++) {
+ for (; u < ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2)); u++) {
record = u + 2;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 946; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 946; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 1797; /* Right-most record in right internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 1797; /* Right-most record in right internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 1859; /* Right-most record in right-most leaf */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 1859; /* Right-most record in right-most leaf */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert enough records to force right-most leaf to split */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC / 2) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC / 2) + 1); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 2;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 30;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 946; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 946; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 1828; /* Next-to-right-most record in right-most internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 1828; /* Next-to-right-most record in right-most internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 1860; /* Right-most record in right-most internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 1860; /* Right-most record in right-most internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 1891; /* Right-most record in right-most leaf */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 1891; /* Right-most record in right-most leaf */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -2110,45 +2078,45 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split left-most leaf in level 2 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 30;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 946; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 946; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 63; /* Left-most record in left-most internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 63; /* Left-most record in left-most internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 1; /* Left-most record in left-most leaf */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 1; /* Left-most record in left-most leaf */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Add another record to left-most leaf, to force a 1->2 node split on left leaf */
record = 0;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 946; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 946; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 63; /* Left-most record in left-most internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 63; /* Left-most record in left-most internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 32; /* Left-most record in left internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 32; /* Left-most record in left internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 0; /* Left-most record in left-most leaf */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 0; /* Left-most record in left-most leaf */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -2156,73 +2124,73 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split middle leaf in level 2 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 946; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 946; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 504; /* Record in internal node just before insertion point */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 504; /* Record in internal node just before insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 568; /* Record in internal node just after insertion point */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 568; /* Record in internal node just after insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 506; /* Record in leaf node just after insertion point */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 506; /* Record in leaf node just after insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Add another record to middle leaf, to force a node split on middle leaf */
record = (INSERT_SPLIT_ROOT_NREC * 8) + 1;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 2;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 946; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 946; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 504; /* Left-most record of split in left internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 504; /* Left-most record of split in left internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 537; /* Middle record of split in left internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 537; /* Middle record of split in left internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 568; /* Right-most record of split in left internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 568; /* Right-most record of split in left internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 506; /* Record in leaf node just after insertion point */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 506; /* Record in leaf node just after insertion point */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != ((INSERT_SPLIT_ROOT_NREC * 30) + 2))
+ if (idx != ((INSERT_SPLIT_ROOT_NREC * 30) + 2))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -2230,15 +2198,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level2_leaf_split() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level2_2internal_redistrib
*
@@ -2258,16 +2227,16 @@ error:
*/
static unsigned
test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -2275,58 +2244,58 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: redist. 2 internal (r->l) in level 2 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
/* And fill up right internal node, to just before to redistribute it */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 44); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 44); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 6) - 4;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 44;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1318; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1318; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3114; /* Right-most record in right internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 3114; /* Right-most record in right internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 3145; /* Right-most record in right leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 3145; /* Right-most record in right leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to redistribute right-most internal node */
record = u + (INSERT_SPLIT_ROOT_NREC * 6) - 4;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 44 + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1822; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1822; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3114; /* Right-most record in right internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 3114; /* Right-most record in right internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 3146; /* Right-most record in right leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 3146; /* Right-most record in right leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -2334,66 +2303,66 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: redist. 2 internal (l->r) in level 2 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 44 + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1822; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1822; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 436; /* Left-most record in left internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 436; /* Left-most record in left internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 374; /* Left-most record in left leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 374; /* Left-most record in left leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Force left-most internal node to redistribute */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 6) - 4); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 6) - 4); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 50) - 3;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1570; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1570; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 61; /* Left-most record in left internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 61; /* Left-most record in left internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 0; /* Left-most record in left leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 0; /* Left-most record in left leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != ((INSERT_SPLIT_ROOT_NREC * 50) - 3))
+ if (idx != ((INSERT_SPLIT_ROOT_NREC * 50) - 3))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -2401,15 +2370,16 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level2_2internal_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level2_2internal_split
*
@@ -2428,17 +2398,16 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -2446,61 +2415,61 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split side internal node to 2 in level 2 B-tree (r->l)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
/* (And fill up two child internal nodes) */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 59); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 59); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 14) - (INSERT_SPLIT_ROOT_NREC / 4) + 3;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 59;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 2759; /* Record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 2759; /* Record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 4555; /* Right-most record in right internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 4555; /* Right-most record in right internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 4586; /* Right-most record in right leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 4586; /* Right-most record in right leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to split right-most internal node */
record = u + (INSERT_SPLIT_ROOT_NREC * 14) - (INSERT_SPLIT_ROOT_NREC / 4) + 3;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 59) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 2759; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 2759; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3704; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 3704; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 4555; /* Right-most record in right internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 4555; /* Right-most record in right internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 4387; /* Right-most record in right leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 4387; /* Right-most record in right leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -2508,69 +2477,69 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split side internal node to 2 in level 2 B-tree (l->2)");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 59) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 2759; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 2759; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 932; /* Left-most record in left internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 932; /* Left-most record in left internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 870; /* Left-most record in left leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 870; /* Left-most record in left leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Force left-most internal node to split */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 14) - (INSERT_SPLIT_ROOT_NREC / 4) + 3); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 14) - (INSERT_SPLIT_ROOT_NREC / 4) + 3); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 73) - (INSERT_SPLIT_ROOT_NREC / 4) + 4;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 870; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 870; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 1814; /* Next-to-left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1814; /* Next-to-left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 61; /* Left-most record in left internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 61; /* Left-most record in left internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 0; /* Left-most record in left leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 0; /* Left-most record in left leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != ((INSERT_SPLIT_ROOT_NREC * 73) - (INSERT_SPLIT_ROOT_NREC / 4) + 4))
+ if (idx != ((INSERT_SPLIT_ROOT_NREC * 73) - (INSERT_SPLIT_ROOT_NREC / 4) + 4))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
@@ -2578,15 +2547,16 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level2_2internal_split() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level2_3internal_redistrib
*
@@ -2607,16 +2577,16 @@ error:
*/
static unsigned
test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -2624,130 +2594,130 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: redistrib 3 internals in level 2 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 3 internal nodes */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 36); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 36); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
- for(; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 59) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 3703; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 2267; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 2267; /* Record to left of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 3199; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 3199; /* Record to right of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 3137; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 3137; /* Record just above insertion point in leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert records to fill up middle internal node */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 36);
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 72) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 3703; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3104; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 3104; /* Record to left of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 3137; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 3137; /* Record to right of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 3135; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 3135; /* Record just above insertion point in leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert another record, forcing the middle internal node to redistribute */
record = u + (INSERT_SPLIT_ROOT_NREC * 36);
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 72) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 4;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1574; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1574; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3104; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 3104; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
#ifdef NONE
- record = 2862; /* Record to left of insertion point in right internal node (now) */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 2862; /* Record to left of insertion point in right internal node (now) */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
-#endif /* NONE */
- record = 3137; /* Record to right of insertion point in right internal node (now) */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+#endif /* NONE */
+ record = 3137; /* Record to right of insertion point in right internal node (now) */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 3135; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 3135; /* Record just above insertion point in leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != ((INSERT_SPLIT_ROOT_NREC * 72) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 4))
+ if (idx != ((INSERT_SPLIT_ROOT_NREC * 72) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 4))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
@@ -2755,15 +2725,16 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level2_3internal_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_level2_3internal_split
*
@@ -2783,17 +2754,16 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -2801,134 +2771,134 @@ test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree insert: split 3 internals to 4 in level 2 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 3 internal nodes */
/* (and fill right internal node) */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 31); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 31); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
- for(; u < (INSERT_SPLIT_ROOT_NREC * 74); u++) {
+ for (; u < (INSERT_SPLIT_ROOT_NREC * 74); u++) {
record = u + ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3);
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 74;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 3703; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 1952; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 1952; /* Record to left of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 2884; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 2884; /* Record to right of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 2822; /* Record just after insertion point in leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 2822; /* Record just after insertion point in leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Insert records to fill up middle internal node */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 31);
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 3703; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 2789; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 2789; /* Record to left of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 2822; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 2822; /* Record to right of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 2823; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 2823; /* Record just above insertion point in leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to split middle internal node */
record = u + (INSERT_SPLIT_ROOT_NREC * 31);
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 2789; /* Middle record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 2789; /* Middle record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
- record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 3703; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
#ifdef NONE
- record = 3049; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 3049; /* Record to left of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
-#endif /* NONE */
- record = 2822; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+#endif /* NONE */
+ record = 2822; /* Record to right of insertion point in middle internal node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 2823; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ record = 2823; /* Record just above insertion point in leaf node */
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != ((INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3))
+ if (idx != ((INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -2936,15 +2906,16 @@ test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_insert_level2_3internal_split() */
-
/*-------------------------------------------------------------------------
* Function: test_insert_lots
*
@@ -2961,27 +2932,26 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_lots(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_insert_lots(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[1024]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t idx; /* Index within B-tree, for iterator */
- time_t curr_time; /* Current time, for seeding random number generator */
- hsize_t *records; /* Record #'s for random insertion */
- unsigned u; /* Local index variable */
- unsigned swap_idx; /* Location to swap with when shuffling */
- hsize_t temp_rec; /* Temporary record */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t nrec; /* Number of records in B-tree */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ char filename[1024]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t idx; /* Index within B-tree, for iterator */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ hsize_t * records; /* Record #'s for random insertion */
+ unsigned u; /* Local index variable */
+ unsigned swap_idx; /* Location to swap with when shuffling */
+ hsize_t temp_rec; /* Temporary record */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t nrec; /* Number of records in B-tree */
+ herr_t ret; /* Generic error return value */
/* Initialize random number seed */
- curr_time=HDtime(NULL);
+ curr_time = HDtime(NULL);
#if 0
curr_time=1109170019;
HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
@@ -2994,18 +2964,18 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
TESTING("B-tree insert: create random level 4 B-tree");
/* Allocate space for the records */
- if(NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY)))
+ if (NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY)))
TEST_ERROR
/* Initialize record #'s */
- for(u = 0; u < INSERT_MANY; u++)
+ for (u = 0; u < INSERT_MANY; u++)
records[u] = u;
/* Shuffle record #'s */
- for(u = 0; u < INSERT_MANY; u++) {
- swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u;
- temp_rec = records[u];
- records[u] = records[swap_idx];
+ for (u = 0; u < INSERT_MANY; u++) {
+ swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u;
+ temp_rec = records[u];
+ records[u] = records[swap_idx];
records[swap_idx] = temp_rec;
} /* end for */
@@ -3013,117 +2983,115 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert random records */
- for(u = 0; u < INSERT_MANY; u++) {
+ for (u = 0; u < INSERT_MANY; u++) {
record = records[u];
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 4;
+ bt2_stat.depth = 4;
bt2_stat.nrecords = INSERT_MANY;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Re-open v2 B-tree */
- if(NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
+ if (NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
FAIL_STACK_ERROR
/* Check up on B-tree after re-open */
- bt2_stat.depth = 4;
+ bt2_stat.depth = 4;
bt2_stat.nrecords = INSERT_MANY;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(bt2, iter_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != INSERT_MANY)
+ if (idx != INSERT_MANY)
TEST_ERROR
/* Attempt to find non-existant record in level-4 B-tree */
/* (Should not be found, but not fail) */
idx = INSERT_MANY * 2;
- if(H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Find random records */
- for(u = 0; u < FIND_MANY; u++) {
+ for (u = 0; u < FIND_MANY; u++) {
/* Pick random record */
- idx = (hsize_t)(HDrandom()%INSERT_MANY);
+ idx = (hsize_t)(HDrandom() % INSERT_MANY);
/* Attempt to find existant record in root of level-4 B-tree */
- if(H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
+ if (H5B2_find(bt2, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
} /* end for */
/* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY*3), find_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY * 3), find_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY*3), find_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY * 3), find_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Find random records */
- for(u = 0; u < FIND_MANY; u++) {
+ for (u = 0; u < FIND_MANY; u++) {
/* Pick random record */
idx = (hsize_t)(HDrandom() % INSERT_MANY);
/* Attempt to find existant record in root of level-4 B-tree */
/* (in increasing order) */
- if(H5B2_index(bt2, H5_ITER_INC, idx, find_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, idx, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to find existant record in root of level-4 B-tree */
/* (in decreasing order) */
- if(H5B2_index(bt2, H5_ITER_DEC, idx, find_dec_cb, &idx) < 0)
+ if (H5B2_index(bt2, H5_ITER_DEC, idx, find_dec_cb, &idx) < 0)
FAIL_STACK_ERROR
} /* end for */
@@ -3132,32 +3100,31 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
TESTING("B-tree insert: attempt duplicate record in level 4 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
record = INSERT_MANY / 2;
- H5E_BEGIN_TRY {
- ret = H5B2_insert(bt2, &record);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_insert(bt2, &record); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != INSERT_MANY)
+ if (nrec != INSERT_MANY)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -3167,16 +3134,17 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
HDfree(records);
return 1;
} /* test_insert_lots() */
-
/*-------------------------------------------------------------------------
* Function: test_update_basic
*
@@ -3191,24 +3159,23 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_update_basic(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- H5B2_test_rec_t record; /* Record to insert into tree */
- H5B2_test_rec_t modify; /* Modified value */
- H5B2_test_rec_t find; /* Record to find */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t modify; /* Modified value */
+ H5B2_test_rec_t find; /* Record to find */
+ herr_t ret; /* Generic error return value */
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/*
@@ -3217,136 +3184,132 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree update: inserting first record in empty B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
record.key = 42;
record.val = 72;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Attempt to find non-existant record in B-tree with 1 record */
/* (Should not be found, but not fail) */
find.key = 10;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
FAIL_STACK_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Try again with NULL 'op' */
/* (Should not be found, but not fail) */
- if(H5B2_find(bt2, &find, NULL, NULL) != FALSE)
+ if (H5B2_find(bt2, &find, NULL, NULL) != FALSE)
FAIL_STACK_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to find existant record in B-tree with 1 record */
find.key = 42;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != 72)
+ if (find.val != 72)
TEST_ERROR
/* Try again with NULL 'op' */
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, NULL, NULL) != TRUE)
+ if (H5B2_find(bt2, &find, NULL, NULL) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to index non-existant record in B-tree with 1 record */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in B-tree with 1 record */
find.key = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 42)
+ if (find.key != 42)
TEST_ERROR
- if(find.val != 72)
+ if (find.val != 72)
TEST_ERROR
PASSED();
-
/*
* Test update only record into v2 B-tree
*/
TESTING("B-tree update: update only record in B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
modify.key = 42;
modify.val = 43;
- if(H5B2_update(bt2, &modify, modify_rec_cb, &modify) < 0)
+ if (H5B2_update(bt2, &modify, modify_rec_cb, &modify) < 0)
FAIL_STACK_ERROR
/* Attempt to find non-existant record in B-tree with 1 record */
/* (Should not be found, but not fail) */
find.key = 10;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
FAIL_STACK_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Try again with NULL 'op' */
/* (Should not be found, but not fail) */
- if(H5B2_find(bt2, &find, NULL, NULL) != FALSE)
+ if (H5B2_find(bt2, &find, NULL, NULL) != FALSE)
FAIL_STACK_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to find modified record in B-tree with 1 record */
find.key = 42;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != 43)
+ if (find.val != 43)
TEST_ERROR
/* Try again with NULL 'op' */
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, NULL, NULL) != TRUE)
+ if (H5B2_find(bt2, &find, NULL, NULL) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to index non-existant record in B-tree with 1 record */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in B-tree with 1 record */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 42)
+ if (find.key != 42)
TEST_ERROR
- if(find.val != 43)
+ if (find.val != 43)
TEST_ERROR
PASSED();
-
/*
* Test inserting more records into v2 B-tree
*/
TESTING("B-tree update: insert several records");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/*
@@ -3354,7 +3317,7 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam,
*/
record.key = 34;
record.val = 11;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/*
@@ -3362,7 +3325,7 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam,
*/
record.key = 56;
record.val = 12;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/*
@@ -3370,70 +3333,68 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam,
*/
record.key = 38;
record.val = 13;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Attempt to find non-existant record in level-0 B-tree with several records */
/* (Should not be found, but not fail) */
find.key = 10;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
TEST_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to find existant record in level-0 B-tree with several records */
find.key = 56;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
TEST_ERROR
- if(find.val != 12)
+ if (find.val != 12)
TEST_ERROR
/* Attempt to index non-existant record in B-tree with several records */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in B-tree with several records */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
TEST_ERROR
- if(find.key != 34)
+ if (find.key != 34)
TEST_ERROR
- if(find.val != 11)
+ if (find.val != 11)
TEST_ERROR
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0)
TEST_ERROR
- if(find.key != 38)
+ if (find.key != 38)
TEST_ERROR
- if(find.val != 13)
+ if (find.val != 13)
TEST_ERROR
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0)
TEST_ERROR
- if(find.key != 42)
+ if (find.key != 42)
TEST_ERROR
- if(find.val != 43)
+ if (find.val != 43)
TEST_ERROR
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0)
TEST_ERROR
- if(find.key != 56)
+ if (find.key != 56)
TEST_ERROR
- if(find.val != 12)
+ if (find.val != 12)
TEST_ERROR
PASSED();
-
/*
* Test updating all existing records in v2 B-tree
*/
@@ -3442,107 +3403,106 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam,
record.key = 34;
modify.key = 34;
modify.val = 21;
- if(H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
+ if (H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
FAIL_STACK_ERROR
record.key = 38;
modify.key = 38;
modify.val = 23;
- if(H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
+ if (H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
FAIL_STACK_ERROR
record.key = 42;
modify.key = 42;
modify.val = 24;
- if(H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
+ if (H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
FAIL_STACK_ERROR
record.key = 56;
modify.key = 56;
modify.val = 22;
- if(H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
+ if (H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
FAIL_STACK_ERROR
/* Attempt to find non-existant record in level-0 B-tree with several records */
/* (Should not be found, but not fail) */
find.key = 41;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
TEST_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to find existant record in level-0 B-tree with several record */
find.key = 56;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
TEST_ERROR
- if(find.val != 22)
+ if (find.val != 22)
TEST_ERROR
/* Attempt to index non-existant record in B-tree with several records */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in B-tree with several records */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
TEST_ERROR
- if(find.key != 34)
+ if (find.key != 34)
TEST_ERROR
- if(find.val != 21)
+ if (find.val != 21)
TEST_ERROR
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0)
TEST_ERROR
- if(find.key != 38)
+ if (find.key != 38)
TEST_ERROR
- if(find.val != 23)
+ if (find.val != 23)
TEST_ERROR
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0)
TEST_ERROR
- if(find.key != 42)
+ if (find.key != 42)
TEST_ERROR
- if(find.val != 24)
+ if (find.val != 24)
TEST_ERROR
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0)
TEST_ERROR
- if(find.key != 56)
+ if (find.key != 56)
TEST_ERROR
- if(find.val != 22)
+ if (find.val != 22)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
-
/* All tests passed */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_update_basic() */
-
/*-------------------------------------------------------------------------
* Function: test_update_split_root
*
@@ -3560,20 +3520,19 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_update_split_root(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_update_split_root(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- H5B2_test_rec_t record; /* Record to insert into tree */
- H5B2_test_rec_t modify; /* Modified value */
- H5B2_test_rec_t find; /* Record to find */
- H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t modify; /* Modified value */
+ H5B2_test_rec_t find; /* Record to find */
+ H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
/*
* Test inserting enough records into v2 B-tree to split the root node
@@ -3581,203 +3540,203 @@ test_update_split_root(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree update: split root");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert records to fill root leaf node */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC - 1); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC - 1); u++) {
record.key = u + 2;
record.val = u * 2 + 4;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 0;
+ bt2_stat.depth = 0;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC - 1);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 33;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to split root leaf node */
record.key = INSERT_SPLIT_ROOT_NREC_REC + 1;
record.val = (INSERT_SPLIT_ROOT_NREC_REC - 1) * 2 + 4;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 33;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx.key = 2;
idx.val = 4;
- if(H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2))
+ if (idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Modify all records */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u + 2;
modify.key = u + 2;
modify.val = u * 2 + 5;
- if(H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
+ if (H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 33;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx.key = 2;
idx.val = 5;
- if(H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2))
+ if (idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2))
TEST_ERROR
-
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert a couple more records, on the left side of the B-tree */
record.key = 0;
record.val = 1;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
record.key = 1;
record.val = 3;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC + 2);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 33;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
-
/* Iterate over B-tree to check records have been inserted correctly */
idx.key = 0;
idx.val = 1;
- if(H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2))
+ if (idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2))
TEST_ERROR
/* Attempt to find non-existant record in level-1 B-tree */
/* (Should not be found, but not fail) */
find.key = 800;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
TEST_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to find existant record in root of level-1 B-tree */
find.key = 33;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.key != 33)
+ if (find.key != 33)
TEST_ERROR
- if(find.val != 67)
+ if (find.val != 67)
TEST_ERROR
/* Attempt to find existant record in leaf of level-1 B-tree */
find.key = 56;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.key != 56)
+ if (find.key != 56)
TEST_ERROR
- if(find.val != 113)
+ if (find.val != 113)
TEST_ERROR
/* Attempt to index non-existant record in level-1 B-tree */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC + 2), index_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC + 2), index_rec_cb, NULL);
+ }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in root of level-1 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)33, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)33, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 33)
+ if (find.key != 33)
TEST_ERROR
- if(find.val != 67)
+ if (find.val != 67)
TEST_ERROR
/* Attempt to index existing record in left leaf of level-1 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 0)
+ if (find.key != 0)
TEST_ERROR
- if(find.val != 1)
+ if (find.val != 1)
TEST_ERROR
/* Attempt to index existing record in right leaf of level-1 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)50, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)50, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 50)
+ if (find.key != 50)
TEST_ERROR
- if(find.val != 101)
+ if (find.val != 101)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -3785,15 +3744,16 @@ test_update_split_root(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_update_split_root() */
-
/*-------------------------------------------------------------------------
* Function: test_update_level1_2leaf_redistrib
*
@@ -3812,16 +3772,15 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- H5B2_test_rec_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -3829,54 +3788,53 @@ test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree update: redistribute 2 leaves in level 1 B-tree (l->r)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1;
record.val = u + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 10;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = INSERT_SPLIT_ROOT_NREC_REC;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
-
/* Force redistribution from left node into right node */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) {
record.key = u;
record.val = u + 9;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) + (INSERT_SPLIT_ROOT_NREC_REC / 4);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
@@ -3888,54 +3846,54 @@ test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree update: redistribute 2 leaves in level 1 B-tree (r->l)");
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u;
record.val = u + 9;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force redistribution from left node into right node */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) {
record.key = u + INSERT_SPLIT_ROOT_NREC_REC;
record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 9;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) + (INSERT_SPLIT_ROOT_NREC_REC / 4) - 1;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3943,15 +3901,16 @@ test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_update_level1_2leaf_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_update_level1_side_split
*
@@ -3970,16 +3929,15 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- H5B2_test_rec_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -3987,56 +3945,56 @@ test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree update: split side leaf into 2 leaves in level 1 B-tree (l->r)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u + INSERT_SPLIT_ROOT_NREC_REC;
record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 10;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force left node to split */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u;
record.val = u + 10;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 31;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record.key = 64;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
@@ -4048,57 +4006,57 @@ test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree update: split side leaf into 2 leaves in level 1 B-tree (r->l)");
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u;
record.val = u + 10;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force right node to split */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u + INSERT_SPLIT_ROOT_NREC_REC;
record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 10;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 63;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record.key = 95;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4106,15 +4064,16 @@ test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_update_level1_side_split() */
-
/*-------------------------------------------------------------------------
* Function: test_update_level1_3leaf_redistrib
*
@@ -4135,17 +4094,16 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_update_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_update_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- H5B2_test_rec_t record; /* Record to insert into tree */
- H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -4153,99 +4111,99 @@ test_update_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree update: redistribute 3 leaves in level 1 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u + (INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1);
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = (2 * INSERT_SPLIT_ROOT_NREC_REC);
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force left node to split */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record.key = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert records to force middle node to redistribute */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC_REC / 2) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC_REC / 2) + 1); u++) {
record.key = u + INSERT_SPLIT_ROOT_NREC_REC;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = (2 * INSERT_SPLIT_ROOT_NREC_REC) + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 52;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record.key = 107;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx.key = 0;
idx.val = 0;
- if(H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 2) + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1))
+ if (idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 2) + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4253,15 +4211,16 @@ test_update_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_update_level1_3leaf_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_update_level1_middle_split
*
@@ -4281,17 +4240,16 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_update_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_update_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- H5B2_test_rec_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
/*
* Test inserting many records into v2 B-tree
@@ -4299,78 +4257,78 @@ test_update_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree update: split middle leaf into 2 leaves in level 1 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
record.key = u + (INSERT_SPLIT_ROOT_NREC_REC * 2);
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = (2 * INSERT_SPLIT_ROOT_NREC_REC) + (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force split from left node into right node */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 2); u++) {
record.key = u;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 1;
+ bt2_stat.depth = 1;
bt2_stat.nrecords = 3 * INSERT_SPLIT_ROOT_NREC_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 63;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record.key = 95;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record.key = 128;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx.key = 0;
idx.val = 0;
- if(H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC * 3))
+ if (idx.key != (INSERT_SPLIT_ROOT_NREC_REC * 3))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
@@ -4378,15 +4336,16 @@ test_update_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_update_level1_middle_split() */
-
/*-------------------------------------------------------------------------
* Function: test_update_make_level2
*
@@ -4402,19 +4361,18 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- H5B2_test_rec_t record; /* Record to insert into tree */
- H5B2_test_rec_t find; /* Record to find */
- H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t find; /* Record to find */
+ H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
/*
* Test inserting many records into v2 B-tree
@@ -4422,508 +4380,509 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree update: make level 2 B-tree (l->r)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) {
- record.key = u + 2; /* Leave a gap for later insertion */
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) {
+ record.key = u + 2; /* Leave a gap for later insertion */
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
- for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) {
- record.key = u + 4; /* Leave a gap for later insertion */
+ for (; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) {
+ record.key = u + 4; /* Leave a gap for later insertion */
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 1347;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Add some extra records to left-most leaf */
record.key = 0;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
record.key = 1;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Add some extra records to middle leaf */
record.key = (INSERT_SPLIT_ROOT_NREC_REC * 9) + 2;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
record.key = (INSERT_SPLIT_ROOT_NREC_REC * 9) + 3;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
-
/* Iterate over B-tree to check records have been inserted correctly */
idx.key = 0;
idx.val = 0;
- if(H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4))
+ if (idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4))
TEST_ERROR
/* Attempt to find non-existant record in level-2 B-tree */
/* (Should not be found, but not fail) */
find.key = INSERT_SPLIT_ROOT_NREC_REC * 42;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
TEST_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to find existant record in root of level-2 B-tree */
find.key = 1347;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (1347 * 2))
+ if (find.val != (1347 * 2))
TEST_ERROR
/* Check with B-tree */
record.key = 1347;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
/* Attempt to find existant record in internal node of level-2 B-tree */
find.key = 513;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (513 * 2))
+ if (find.val != (513 * 2))
TEST_ERROR
/* Check with B-tree */
record.key = 513;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Attempt to find existant record in leaf of level-2 B-tree */
find.key = 555;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (555 * 2))
+ if (find.val != (555 * 2))
TEST_ERROR
/* Check with B-tree */
record.key = 555;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Attempt to index non-existant record in level-2 B-tree */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL);
+ }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in root of level-2 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)1347, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)1347, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 1347)
+ if (find.key != 1347)
TEST_ERROR
- if(find.val != (1347 * 2))
+ if (find.val != (1347 * 2))
TEST_ERROR
/* Attempt to index existing record in internal node of level-2 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 513)
+ if (find.key != 513)
TEST_ERROR
- if(find.val != (513 * 2))
+ if (find.val != (513 * 2))
TEST_ERROR
/* Attempt to index existing record in leaf of level-2 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 555)
+ if (find.key != 555)
TEST_ERROR
- if(find.val != (555 * 2))
+ if (find.val != (555 * 2))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
PASSED();
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree update: make level 2 B-tree (r->l)");
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) {
record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 1) - u;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
- for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) {
- record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 1) - (u +2); /* Leave a gap for later insertion */
+ for (; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) {
+ record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 1) - (u + 2); /* Leave a gap for later insertion */
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 1344;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Add some extra records to right-most leaf */
record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 2;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 3;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Add some extra records to middle leaf */
record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9));
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 1;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
-
/* Iterate over B-tree to check records have been inserted correctly */
idx.key = 0;
idx.val = 0;
- if(H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4))
+ if (idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4))
TEST_ERROR
/* Attempt to find non-existant record in level-2 B-tree */
/* (Should not be found, but not fail) */
find.key = INSERT_SPLIT_ROOT_NREC_REC * 42;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
TEST_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to find existant record in root of level-2 B-tree */
find.key = 1344;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (1344 * 2))
+ if (find.val != (1344 * 2))
TEST_ERROR
/* Check with B-tree */
record.key = 1344;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
/* Attempt to find existant record in internal node of level-2 B-tree */
find.key = 512;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (512 * 2))
+ if (find.val != (512 * 2))
TEST_ERROR
/* Check with B-tree */
record.key = 512;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Attempt to find existant record in leaf of level-2 B-tree */
find.key = 555;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (555 * 2))
+ if (find.val != (555 * 2))
TEST_ERROR
/* Check with B-tree */
record.key = 555;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Attempt to index non-existant record in level-2 B-tree */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL);
+ }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in root of level-2 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)1344, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)1344, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 1344)
+ if (find.key != 1344)
TEST_ERROR
- if(find.val != (1344 * 2))
+ if (find.val != (1344 * 2))
TEST_ERROR
/* Attempt to index existing record in internal node of level-2 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)512, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)512, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 512)
+ if (find.key != 512)
TEST_ERROR
- if(find.val != (512 * 2))
+ if (find.val != (512 * 2))
TEST_ERROR
/* Attempt to index existing record in leaf of level-2 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 555)
+ if (find.key != 555)
TEST_ERROR
- if(find.val != (555 * 2))
+ if (find.val != (555 * 2))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
PASSED();
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree update: make level 2 B-tree (l+r->middle)");
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) {
record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 3) - u;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
- for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) {
- record.key = u - ((INSERT_SPLIT_ROOT_NREC_REC * 9) - 2); /* Leave a gap for later insertion */
+ for (; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) {
+ record.key = u - ((INSERT_SPLIT_ROOT_NREC_REC * 9) - 2); /* Leave a gap for later insertion */
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 2;
+ bt2_stat.depth = 2;
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41);
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record.key = 1345;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Add some extra records to right-most leaf */
record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 4;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 5;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Add some extra records to middle leaf */
record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 2;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 3;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Add some extra records to left-most leaf */
record.key = 0;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
record.key = 1;
record.val = record.key * 2;
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
-
/* Iterate over B-tree to check records have been inserted correctly */
idx.key = 0;
idx.val = 0;
- if(H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
+ if (H5B2_iterate(bt2, iter_rec_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 6))
+ if (idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 6))
TEST_ERROR
/* Attempt to find non-existant record in level-2 B-tree */
/* (Should not be found, but not fail) */
find.key = INSERT_SPLIT_ROOT_NREC_REC * 42;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
TEST_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Attempt to find existant record in root of level-2 B-tree */
find.key = 1345;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (1345 * 2))
+ if (find.val != (1345 * 2))
TEST_ERROR
/* Check with B-tree */
record.key = 1345;
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
/* Attempt to find existant record in internal node of level-2 B-tree */
find.key = 513;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (513 * 2))
+ if (find.val != (513 * 2))
TEST_ERROR
/* Check with B-tree */
record.key = 513;
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Attempt to find existant record in leaf of level-2 B-tree */
find.key = 555;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (555 * 2))
+ if (find.val != (555 * 2))
TEST_ERROR
/* Check with B-tree */
record.key = 555;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
/* Attempt to index non-existant record in level-2 B-tree */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL);
+ }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Attempt to index existing record in level-2 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)1345, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)1345, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 1345)
+ if (find.key != 1345)
TEST_ERROR
- if(find.val != (1345 * 2))
+ if (find.val != (1345 * 2))
TEST_ERROR
/* Attempt to index existing record in internal node of level-2 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 513)
+ if (find.key != 513)
TEST_ERROR
- if(find.val != (513 * 2))
+ if (find.val != (513 * 2))
TEST_ERROR
/* Attempt to index existing record in leaf of level-2 B-tree */
find.key = (hsize_t)-1;
find.val = (hsize_t)-1;
- if(H5B2_index(bt2, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != 555)
+ if (find.key != 555)
TEST_ERROR
- if(find.val != (555 * 2))
+ if (find.val != (555 * 2))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4931,15 +4890,16 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_update_make_level2() */
-
/*-------------------------------------------------------------------------
* Function: test_update_lots
*
@@ -4955,23 +4915,22 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_update_lots(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_update_lots(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- time_t curr_time; /* Current time, for seeding random number generator */
- H5B2_test_rec_t *records; /* Record #'s for random insertion */
- H5B2_test_rec_t record; /* Record to insert into tree */
- H5B2_test_rec_t modify; /* Modified value */
- H5B2_test_rec_t find; /* Record to find */
- H5B2_test_rec_t iter; /* Index within B-tree, for iterator */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- hsize_t nrec; /* Number of records in B-tree */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ H5B2_test_rec_t *records; /* Record #'s for random insertion */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t modify; /* Modified value */
+ H5B2_test_rec_t find; /* Record to find */
+ H5B2_test_rec_t iter; /* Index within B-tree, for iterator */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t nrec; /* Number of records in B-tree */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
/* Initialize random number seed */
curr_time = HDtime(NULL);
@@ -4987,120 +4946,118 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
TESTING("B-tree update: create random level 4 B-tree");
/* Allocate space for the records */
- if(NULL == (records = (H5B2_test_rec_t *)HDmalloc(sizeof(H5B2_test_rec_t) * INSERT_MANY_REC)))
+ if (NULL == (records = (H5B2_test_rec_t *)HDmalloc(sizeof(H5B2_test_rec_t) * INSERT_MANY_REC)))
TEST_ERROR
/* Initialize record #'s */
- for(u = 0; u < INSERT_MANY_REC; u++) {
+ for (u = 0; u < INSERT_MANY_REC; u++) {
records[u].key = u;
records[u].val = u * 2;
} /* end for */
/* Shuffle record #'s */
- for(u = 0; u < INSERT_MANY_REC; u++) {
- H5B2_test_rec_t temp_rec; /* Temporary record */
- unsigned swap_idx; /* Location to swap with when shuffling */
+ for (u = 0; u < INSERT_MANY_REC; u++) {
+ H5B2_test_rec_t temp_rec; /* Temporary record */
+ unsigned swap_idx; /* Location to swap with when shuffling */
- swap_idx = ((unsigned)HDrandom() % (INSERT_MANY_REC - u)) + u;
- temp_rec = records[u];
- records[u] = records[swap_idx];
+ swap_idx = ((unsigned)HDrandom() % (INSERT_MANY_REC - u)) + u;
+ temp_rec = records[u];
+ records[u] = records[swap_idx];
records[swap_idx] = temp_rec;
} /* end for */
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert random records */
- for(u = 0; u < INSERT_MANY_REC; u++) {
+ for (u = 0; u < INSERT_MANY_REC; u++) {
record = records[u];
- if(H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
+ if (H5B2_update(bt2, &record, no_modify_cb, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- bt2_stat.depth = 4;
+ bt2_stat.depth = 4;
bt2_stat.nrecords = INSERT_MANY_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
file = -1;
/* Re-open the file for the test */
- if(reopen_file(&file, &f, fapl) < 0)
+ if (reopen_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Re-open v2 B-tree */
- if(NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
+ if (NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
FAIL_STACK_ERROR
/* Check up on B-tree after re-open */
- bt2_stat.depth = 4;
+ bt2_stat.depth = 4;
bt2_stat.nrecords = INSERT_MANY_REC;
- if(check_stats(bt2, &bt2_stat) < 0)
+ if (check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
iter.key = 0;
iter.val = 0;
- if(H5B2_iterate(bt2, iter_rec_cb, &iter) < 0)
+ if (H5B2_iterate(bt2, iter_rec_cb, &iter) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(iter.key != INSERT_MANY_REC)
+ if (iter.key != INSERT_MANY_REC)
TEST_ERROR
/* Attempt to find non-existant record in level-4 B-tree */
/* (Should not be found, but not fail) */
find.key = INSERT_MANY_REC * 2;
find.val = (hsize_t)-1;
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != FALSE)
TEST_ERROR
- if(find.val != (hsize_t)-1)
+ if (find.val != (hsize_t)-1)
TEST_ERROR
/* Find random records */
- for(u = 0; u < FIND_MANY_REC; u++) {
+ for (u = 0; u < FIND_MANY_REC; u++) {
/* Pick random record */
find.key = (hsize_t)(HDrandom() % INSERT_MANY_REC);
find.val = (hsize_t)-1;
/* Attempt to find existant record in level-4 B-tree */
- if(H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
+ if (H5B2_find(bt2, &find, find_rec_cb, &find) != TRUE)
FAIL_STACK_ERROR
- if(find.val != (find.key * 2))
+ if (find.val != (find.key * 2))
TEST_ERROR
} /* end for */
/* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Find random records */
- for(u = 0; u < FIND_MANY_REC; u++) {
- hsize_t idx; /* Record index */
+ for (u = 0; u < FIND_MANY_REC; u++) {
+ hsize_t idx; /* Record index */
/* Pick random record */
idx = (hsize_t)(HDrandom() % INSERT_MANY_REC);
@@ -5111,11 +5068,11 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
/* Attempt to find existant record in level-4 B-tree */
/* (in increasing order) */
- if(H5B2_index(bt2, H5_ITER_INC, idx, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_INC, idx, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != idx)
+ if (find.key != idx)
TEST_ERROR
- if(find.val != (find.key * 2))
+ if (find.val != (find.key * 2))
TEST_ERROR
/* Reset find record */
@@ -5124,11 +5081,11 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
/* Attempt to find existant record in level-4 B-tree */
/* (in decreasing order) */
- if(H5B2_index(bt2, H5_ITER_DEC, idx, index_rec_cb, &find) < 0)
+ if (H5B2_index(bt2, H5_ITER_DEC, idx, index_rec_cb, &find) < 0)
FAIL_STACK_ERROR
- if(find.key != (INSERT_MANY_REC - (idx + 1)))
+ if (find.key != (INSERT_MANY_REC - (idx + 1)))
TEST_ERROR
- if(find.val != (find.key * 2))
+ if (find.val != (find.key * 2))
TEST_ERROR
} /* end for */
@@ -5137,30 +5094,30 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
TESTING("B-tree update: update record in level 4 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
record.key = INSERT_MANY_REC / 2;
modify.key = INSERT_MANY_REC / 2;
modify.val = record.key * 3;
- if(H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
+ if (H5B2_update(bt2, &record, modify_rec_cb, &modify) < 0)
FAIL_STACK_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != INSERT_MANY_REC)
+ if (nrec != INSERT_MANY_REC)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -5171,17 +5128,18 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
error:
HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
HDfree(records);
return 1;
} /* test_update_lots() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_basic
*
@@ -5196,45 +5154,43 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_basic(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ herr_t ret; /* Generic error return value */
/* Record removal tests */
TESTING("B-tree remove: record from empty B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != 0)
+ if (nrec != 0)
TEST_ERROR
/* Attempt to remove a record from a B-tree with no records */
record = 0;
- H5E_BEGIN_TRY {
- ret = H5B2_remove(bt2, &record, NULL, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_remove(bt2, &record, NULL, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
PASSED();
@@ -5242,37 +5198,36 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: non-existant record from 1 record B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert one record into B-tree */
record = 42;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != 1)
+ if (nrec != 1)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Attempt to remove a non-existant record from a B-tree with 1 record */
record = 0;
- H5E_BEGIN_TRY {
- ret = H5B2_remove(bt2, &record, NULL, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_remove(bt2, &record, NULL, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
PASSED();
@@ -5281,32 +5236,32 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: existant record from 1 record B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- record = 42;
+ record = 42;
rrecord = 0;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 42)
+ if (rrecord != 42)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != 0)
+ if (nrec != 0)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has been freed */
- if(H5F_addr_defined(root_addr))
+ if (H5F_addr_defined(root_addr))
TEST_ERROR
PASSED();
@@ -5315,29 +5270,29 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: adding records to B-tree after removal");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert several records into B-tree again */
record = 42;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
record = 34;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
record = 56;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
record = 38;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != 4)
+ if (nrec != 4)
TEST_ERROR
PASSED();
@@ -5346,15 +5301,14 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: non-existant record from level-0 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
record = 0;
- H5E_BEGIN_TRY {
- ret = H5B2_remove(bt2, &record, NULL, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_remove(bt2, &record, NULL, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
PASSED();
@@ -5363,116 +5317,116 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: mult. existant records from level-0 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- record = 42;
+ record = 42;
rrecord = 0;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 42)
+ if (rrecord != 42)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != 3)
+ if (nrec != 3)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has not been freed */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
- record = 34;
+ record = 34;
rrecord = 0;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 34)
+ if (rrecord != 34)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != 2)
+ if (nrec != 2)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has not been freed */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
- record = 56;
+ record = 56;
rrecord = 0;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 56)
+ if (rrecord != 56)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != 1)
+ if (nrec != 1)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has not been freed */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
- record = 38;
+ record = 38;
rrecord = 0;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 38)
+ if (rrecord != 38)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != 0)
+ if (nrec != 0)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has been freed */
- if(H5F_addr_defined(root_addr))
+ if (H5F_addr_defined(root_addr))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -5480,15 +5434,16 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_basic() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_noredistrib
*
@@ -5503,69 +5458,67 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
/* B-tree record removal tests */
TESTING("B-tree remove: non-existant record from level-1 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Attempt to remove a non-existant record from a B-tree with 1 record */
record = (INSERT_SPLIT_ROOT_NREC * 2) + 1;
- H5E_BEGIN_TRY {
- ret = H5B2_remove(bt2, &record, NULL, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_remove(bt2, &record, NULL, NULL); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC*2))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2))
TEST_ERROR
PASSED();
@@ -5574,42 +5527,42 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: record from right leaf of level-1 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
- record = 62; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 94; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 94; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC * 2) - 2;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
rrecord = 0;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - 2))
+ if (rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - 2))
TEST_ERROR
/* Make certain that the leaf nodes didn't redistribute */
- record = 62; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 94; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 94; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - 1))
TEST_ERROR
PASSED();
@@ -5618,36 +5571,36 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: record from left leaf of level-1 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
record = 0;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
rrecord = 1;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 0)
+ if (rrecord != 0)
TEST_ERROR
/* Make certain that the leaf nodes didn't redistribute */
- record = 62; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 94; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 94; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - 2))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - 2))
TEST_ERROR
PASSED();
@@ -5656,45 +5609,45 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: record from middle leaf of level-1 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check up on B-tree */
record = INSERT_SPLIT_ROOT_NREC;
- if(check_node_depth(bt2, &record, (unsigned)0) < 0)
+ if (check_node_depth(bt2, &record, (unsigned)0) < 0)
TEST_ERROR
rrecord = 0;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != INSERT_SPLIT_ROOT_NREC)
+ if (rrecord != INSERT_SPLIT_ROOT_NREC)
TEST_ERROR
/* Make certain that the leaf nodes didn't redistribute */
- record = 62; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 94; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 94; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - 3))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - 3))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -5702,15 +5655,16 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_noredistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_redistrib
*
@@ -5725,91 +5679,90 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ unsigned u; /* Local index variable */
/* More complex record removals */
TESTING("B-tree remove: redistribute 2 leaves in level-1 B-tree (r->l)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 94; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 94; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove enough records from right leaf of a level-1 B-tree to force redistribution */
- for(u = 0; u < 8; u++) {
- record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
+ for (u = 0; u < 8; u++) {
+ record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 90; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 90; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
PASSED();
@@ -5818,34 +5771,34 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: redistribute 2 leaves in level-1 B-tree (l->r)");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- for(u = 0; u < 39; u++) {
- record = u;
+ for (u = 0; u < 39; u++) {
+ record = u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != u)
+ if (rrecord != u)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (((INSERT_SPLIT_ROOT_NREC * 2) - 8) - (u + 1)))
+ if (nrec != (((INSERT_SPLIT_ROOT_NREC * 2) - 8) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 64; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 64; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 90; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 90; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
PASSED();
@@ -5854,43 +5807,43 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: redistribute 3 leaves in level-1 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- for(u = 0; u < 2; u++) {
- record = INSERT_SPLIT_ROOT_NREC + 2 + u;
+ for (u = 0; u < 2; u++) {
+ record = INSERT_SPLIT_ROOT_NREC + 2 + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (INSERT_SPLIT_ROOT_NREC + 2 + u))
+ if (rrecord != (INSERT_SPLIT_ROOT_NREC + 2 + u))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((((INSERT_SPLIT_ROOT_NREC * 2) - 47)) - (u + 1)))
+ if (nrec != ((((INSERT_SPLIT_ROOT_NREC * 2) - 47)) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 64; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 64; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 91; /* Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 91; /* Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -5898,15 +5851,16 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_2leaf_merge
*
@@ -5921,92 +5875,91 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: merge 2 leaves to 1 in level-1 B-tree (r->l)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 2;
- record = 94; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 94; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove enough records from right leaf of a level-1 B-tree to force redistribution */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 4); u++) {
- record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC / 4); u++) {
+ record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check record values in root of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 1;
- record = 62; /* Left record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 62; /* Left record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
PASSED();
@@ -6015,60 +5968,60 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: merge 2 leaves to 1 in level-1 B-tree (l->r)");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Fill B-tree back up */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 4); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC / 4); u++) {
record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 2;
- record = 94; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 94; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Remove records */
- for(u = 0; u < ((3 * INSERT_SPLIT_ROOT_NREC) / 4) - 1; u++) {
- record = u;
+ for (u = 0; u < ((3 * INSERT_SPLIT_ROOT_NREC) / 4) - 1; u++) {
+ record = u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != u)
+ if (rrecord != u)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check record values in root of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 1;
- record = 94; /* Left record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 94; /* Left record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -6076,15 +6029,16 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_2leaf_merge() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_3leaf_merge
*
@@ -6099,101 +6053,100 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: merge 3 leaves to 2 in level-1 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 2;
- record = 94; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 94; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove enough records from middle leaf of a level-1 B-tree to force merge */
- for(u = 0; u < ((5 * INSERT_SPLIT_ROOT_NREC) / 6) - 1; u++) {
- record = ((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1);
+ for (u = 0; u < ((5 * INSERT_SPLIT_ROOT_NREC) / 6) - 1; u++) {
+ record = ((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1)))
+ if (rrecord != (((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check record values in root of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 1;
- record = 37; /* Only record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 37; /* Only record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -6201,15 +6154,16 @@ test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_3leaf_merge() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_promote
*
@@ -6224,105 +6178,104 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from right leaf of level-1 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-1 B-tree with 5 leaves */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 4); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 4); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 125; /* Center-Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 125; /* Center-Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 188; /* Center-Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 188; /* Center-Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 4;
- record = 220; /* Right-most record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 4;
+ record = 220; /* Right-most record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 4))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 4))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from right leaf */
- record = 220;
+ record = 220;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 220)
+ if (rrecord != 220)
TEST_ERROR
/* Check record values in root of B-tree */
- record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 125; /* Center-Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 125; /* Center-Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 188; /* Center-Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 188; /* Center-Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 4;
- record = 221; /* Right-most record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 4;
+ record = 221; /* Right-most record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 4) - 1)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 4) - 1)
TEST_ERROR
PASSED();
@@ -6335,40 +6288,40 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: promote from left leaf of level-1 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- record = 62;
+ record = 62;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 62)
+ if (rrecord != 62)
TEST_ERROR
/* Check record values in root of B-tree */
- record = 63; /* Left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 63; /* Left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 125; /* Center-Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 125; /* Center-Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 188; /* Center-Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 188; /* Center-Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 4;
- record = 221; /* Right-most record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 4;
+ record = 221; /* Right-most record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 4) - 2)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 4) - 2)
TEST_ERROR
PASSED();
@@ -6377,49 +6330,49 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: promote from middle leaf of level-1 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- record = 125;
+ record = 125;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 125)
+ if (rrecord != 125)
TEST_ERROR
/* Check record values in root of B-tree */
- record = 63; /* Left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 63; /* Left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 126; /* Center-Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 126; /* Center-Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
- record = 188; /* Center-Right record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 188; /* Center-Right record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 4;
- record = 221; /* Right-most record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 4;
+ record = 221; /* Right-most record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 4) - 3)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 4) - 3)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -6427,15 +6380,16 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_promote() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_promote_2leaf_redistrib
*
@@ -6451,122 +6405,122 @@ error:
*/
static unsigned
test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from leaf of level-1 B-tree w/2 node redistrib");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 2;
- record = 94; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 94; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from right leaf */
/* Remove records from right leaf until its ready to redistribute */
- for(u = 0; u < 7; u++) {
- record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
+ for (u = 0; u < 7; u++) {
+ record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
} /* end for */
- record = 94;
+ record = 94;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 94)
+ if (rrecord != 94)
TEST_ERROR
/* Check record values in root of B-tree */
- record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 2;
- record = 90; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 90; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 8)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 8)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -6574,15 +6528,16 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_promote_2leaf_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_promote_3leaf_redistrib
*
@@ -6598,122 +6553,122 @@ error:
*/
static unsigned
test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from leaf of level-1 B-tree w/3 node redistrib");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 2;
- record = 94; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 94; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from middle leaf */
/* Remove records from right leaf until its ready to redistribute */
- for(u = 0; u < 7; u++) {
- record = 63 + u;
+ for (u = 0; u < 7; u++) {
+ record = 63 + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (63 + u))
+ if (rrecord != (63 + u))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
} /* end for */
- record = 62;
+ record = 62;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 62)
+ if (rrecord != 62)
TEST_ERROR
/* Check record values in root of B-tree */
- record = 39; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 39; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 2;
- record = 86; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 86; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 8)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 8)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -6721,15 +6676,16 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_promote_3leaf_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_promote_2leaf_merge
*
@@ -6745,119 +6701,119 @@ error:
*/
static unsigned
test_remove_level1_promote_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from leaf of level-1 B-tree w/2->1 merge");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 2;
- record = 94; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 94; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from right leaf */
/* Remove records from right leaf until its ready to merge */
- for(u = 0; u < 14; u++) {
- record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
+ for (u = 0; u < 14; u++) {
+ record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (rrecord != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
} /* end for */
- record = 87;
+ record = 87;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 87)
+ if (rrecord != 87)
TEST_ERROR
/* Check record values in root of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 1;
- record = 62; /* Middle record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 62; /* Middle record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 15)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 15)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -6865,15 +6821,16 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_promote_2leaf_merge() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_promote_3leaf_merge
*
@@ -6889,119 +6846,119 @@ error:
*/
static unsigned
test_remove_level1_promote_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from leaf of level-1 B-tree w/3->2 merge");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 leaves */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, &record, (unsigned)1) < 0)
+ record = 62; /* Left-most record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
- ninfo.nrec = 2;
- record = 94; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 94; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from middle leaf */
/* Remove records from middle leaf until it's ready to merge */
- for(u = 0; u < 50; u++) {
- record = ((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1);
+ for (u = 0; u < 50; u++) {
+ record = ((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1)))
+ if (rrecord != (((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - (u + 1)))
TEST_ERROR
} /* end for */
- record = 25;
+ record = 25;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 25)
+ if (rrecord != 25)
TEST_ERROR
/* Check record values in root of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 1;
- record = 37; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 37; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 51)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 51)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -7009,15 +6966,16 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_promote_3leaf_merge() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level1_collapse
*
@@ -7032,114 +6990,113 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: collapse level-1 B-tree back to level-0");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-1 B-tree with 2 leaves */
- for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
+ for (u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 1;
- record = 31; /* Middle record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 31; /* Middle record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != INSERT_SPLIT_ROOT_NREC)
+ if (nrec != INSERT_SPLIT_ROOT_NREC)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove records from B-tree to force a single leaf for the B-tree */
- for(u = 0; u < 14; u++) {
- record = INSERT_SPLIT_ROOT_NREC - (u + 1);
+ for (u = 0; u < 14; u++) {
+ record = INSERT_SPLIT_ROOT_NREC - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (INSERT_SPLIT_ROOT_NREC - (u + 1)))
+ if (rrecord != (INSERT_SPLIT_ROOT_NREC - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC - (u + 1)))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC - (u + 1)))
TEST_ERROR
} /* end for */
/* Check record values in root of B-tree */
ninfo.depth = 0;
- ninfo.nrec = (uint16_t)(INSERT_SPLIT_ROOT_NREC - u);
- record = 31; /* Middle record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = (uint16_t)(INSERT_SPLIT_ROOT_NREC - u);
+ record = 31; /* Middle record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC - u))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC - u))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -7147,15 +7104,16 @@ test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level1_collapse() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level2_promote
*
@@ -7170,97 +7128,96 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from right internal of level-2 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check information about record in right internal node */
ninfo.depth = 1;
- ninfo.nrec = 14;
- record = 2960; /* Record in right internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 14;
+ record = 2960; /* Record in right internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to remove record from right internal node of a level-2 B-tree to force promotion */
- record = 2960;
+ record = 2960;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 2960)
+ if (rrecord != 2960)
TEST_ERROR
/* Check information about record promoted into right internal node */
ninfo.depth = 1;
- ninfo.nrec = 14;
- record = 2961; /* Record in right internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 14;
+ record = 2961; /* Record in right internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 59))
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 59))
TEST_ERROR
PASSED();
@@ -7269,38 +7226,38 @@ test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: promote from left internal of level-2 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check information about record in left internal node */
ninfo.depth = 1;
- ninfo.nrec = 29;
- record = 1133; /* Record in left internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 29;
+ record = 1133; /* Record in left internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
- record = 1133;
+ record = 1133;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 1133)
+ if (rrecord != 1133)
TEST_ERROR
/* Check information about record in left internal node */
ninfo.depth = 1;
- ninfo.nrec = 29;
- record = 1134; /* Record in left internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 29;
+ record = 1134; /* Record in left internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 1)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 1)
TEST_ERROR
PASSED();
@@ -7309,38 +7266,38 @@ test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: promote from middle internal of level-2 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check information about record in middle internal node */
ninfo.depth = 1;
- ninfo.nrec = 14;
- record = 2267; /* Record in middle internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 14;
+ record = 2267; /* Record in middle internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
- record = 2267;
+ record = 2267;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 2267)
+ if (rrecord != 2267)
TEST_ERROR
/* Check information about record in middle internal node */
ninfo.depth = 1;
- ninfo.nrec = 14;
- record = 2268; /* Record in middle internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 14;
+ record = 2268; /* Record in middle internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 2)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 2)
TEST_ERROR
PASSED();
@@ -7349,82 +7306,82 @@ test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree remove: promote record from root of level-2 B-tree");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check information about record in root node */
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 1889; /* Left record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 1889; /* Left record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
- record = 1889;
+ record = 1889;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 1889)
+ if (rrecord != 1889)
TEST_ERROR
/* Check information about record in root node */
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 1890; /* Left record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 1890; /* Left record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 3)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 3)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check information about record in root node */
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
- record = 2834;
+ record = 2834;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 2834)
+ if (rrecord != 2834)
TEST_ERROR
/* Check information about record in root node */
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2835; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2835; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 4)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 4)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -7432,15 +7389,16 @@ test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level2_promote() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level2_promote_2internal_redistrib
*
@@ -7456,124 +7414,125 @@ error:
*/
static unsigned
test_remove_level2_promote_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from right internal of level-2 B-tree w/redistrib");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 14;
- record = 3685; /* Right-most record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 14;
+ record = 3685; /* Right-most record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
- /* Attempt to remove record from right internal node of a level-2 B-tree to force promotion w/redistribution */
- for(u = 0; u < 8; u++) {
- record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
+ /* Attempt to remove record from right internal node of a level-2 B-tree to force promotion
+ * w/redistribution */
+ for (u = 0; u < 8; u++) {
+ record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (((INSERT_SPLIT_ROOT_NREC * 59) + 1)- (u + 1)))
+ if (rrecord != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
+ if (nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
} /* end for */
- record = 3685;
+ record = 3685;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 3685)
+ if (rrecord != 3685)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 14;
- record = 3681; /* Right-most record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 14;
+ record = 3681; /* Right-most record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 8)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 8)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -7581,15 +7540,16 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl, const H5B2_create_t *
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level2_promote_2internal_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level2_3promote_internal_redistrib
*
@@ -7605,124 +7565,125 @@ error:
*/
static unsigned
test_remove_level2_promote_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from left internal of level-2 B-tree w/redistrib");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 29;
- record = 62; /* Left-most record in left node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 29;
+ record = 62; /* Left-most record in left node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
- /* Attempt to remove record from left internal node of a level-2 B-tree to force promotion w/redistribution */
- for(u = 0; u < 38; u++) {
- record = 63 + u;
+ /* Attempt to remove record from left internal node of a level-2 B-tree to force promotion
+ * w/redistribution */
+ for (u = 0; u < 38; u++) {
+ record = 63 + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (63 + u))
+ if (rrecord != (63 + u))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
+ if (nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
} /* end for */
- record = 62;
+ record = 62;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 62)
+ if (rrecord != 62)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 29;
- record = 49; /* Left-most record in left node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 29;
+ record = 49; /* Left-most record in left node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 38)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 38)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -7730,15 +7691,16 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl, const H5B2_create_t *
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level2_promote_3internal_redistrib() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level2_promote_2internal_merge
*
@@ -7754,125 +7716,126 @@ error:
*/
static unsigned
test_remove_level2_promote_2internal_merge(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from right internal of level-2 B-tree w/merge");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check information about record in right internal node */
ninfo.depth = 1;
- ninfo.nrec = 14;
- record = 3685; /* Right-most record in right internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 14;
+ record = 3685; /* Right-most record in right internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
- /* Attempt to remove record from right internal node of a level-2 B-tree to force promotion w/redistribution */
- for(u = 0; u < 15; u++) {
- record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
+ /* Attempt to remove record from right internal node of a level-2 B-tree to force promotion
+ * w/redistribution */
+ for (u = 0; u < 15; u++) {
+ record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (((INSERT_SPLIT_ROOT_NREC * 59) + 1)- (u + 1)))
+ if (rrecord != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
+ if (nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
} /* end for */
/* Force merge by promoting current right-most record */
- record = 3678;
+ record = 3678;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 3678)
+ if (rrecord != 3678)
TEST_ERROR
/* Check information about record in right internal node */
ninfo.depth = 1;
- ninfo.nrec = 13;
- record = 3653; /* Right-most record in right internal node (now) */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 13;
+ record = 3653; /* Right-most record in right internal node (now) */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 15)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 15)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -7880,15 +7843,16 @@ test_remove_level2_promote_2internal_merge(hid_t fapl, const H5B2_create_t *cpar
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level2_promote_2internal_merge() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level2_3promote_internal_merge
*
@@ -7904,125 +7868,126 @@ error:
*/
static unsigned
test_remove_level2_promote_3internal_merge(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: promote from middle internal of level-2 B-tree w/merge");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check information about record in left internal node */
ninfo.depth = 1;
- ninfo.nrec = 29;
- record = 62; /* Left-most record in left internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 29;
+ record = 62; /* Left-most record in left internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
- /* Attempt to remove record from left internal node of a level-2 B-tree to force promotion w/redistribution */
- for(u = 0; u < 112; u++) {
- record = 48 + u;
+ /* Attempt to remove record from left internal node of a level-2 B-tree to force promotion
+ * w/redistribution */
+ for (u = 0; u < 112; u++) {
+ record = 48 + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (48 + u))
+ if (rrecord != (48 + u))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
+ if (nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
} /* end for */
/* Force merge of left-most internal nodes by promotion */
- record = 25;
+ record = 25;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != 25)
+ if (rrecord != 25)
TEST_ERROR
/* Check information about record in left internal node */
ninfo.depth = 1;
- ninfo.nrec = 28;
- record = 37; /* Left-most record in left internal node (now) */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 28;
+ record = 37; /* Left-most record in left internal node (now) */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 112)
+ if (nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 112)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -8030,15 +7995,16 @@ test_remove_level2_promote_3internal_merge(hid_t fapl, const H5B2_create_t *cpar
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level2_promote_3internal_merge() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level2_2internal_merge_left
*
@@ -8054,100 +8020,100 @@ error:
*/
static unsigned
test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: merge 2 internal nodes to 1 in level-2 B-tree (l->r)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove records from a level-2 B-tree to force 2 internal nodes to merge */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 21) + 15); u++) {
- record = u;
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 21) + 15); u++) {
+ record = u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != u)
+ if (rrecord != u)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
+ if (nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check status of B-tree */
ninfo.depth = 2;
- ninfo.nrec = 1;
- record = 2834; /* Middle record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 2834; /* Middle record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -8155,15 +8121,16 @@ test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level2_2internal_merge_left() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level2_2internal_merge_right
*
@@ -8179,100 +8146,100 @@ error:
*/
static unsigned
test_remove_level2_2internal_merge_right(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+ const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: merge 2 internal nodes to 1 in level-2 B-tree (r->l)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove records from a level-2 B-tree to force 2 internal nodes to merge */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 5) + 17); u++) {
- record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 5) + 17); u++) {
+ record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
+ if (rrecord != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u+ 1)))
+ if (nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check status of B-tree */
ninfo.depth = 2;
- ninfo.nrec = 1;
- record = 1889; /* Middle record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 1889; /* Middle record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -8280,15 +8247,16 @@ test_remove_level2_2internal_merge_right(hid_t fapl, const H5B2_create_t *cparam
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level2_2internal_merge_right() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level2_3internal_merge
*
@@ -8303,101 +8271,101 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: merge 3 internal nodes to 2 in level-2 B-tree");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- /* Attempt to remove record from middle internal node of a level-2 B-tree to force promotion w/redistribution */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 23) + 15); u++) {
- record = (INSERT_SPLIT_ROOT_NREC * 20) + u;
+ /* Attempt to remove record from middle internal node of a level-2 B-tree to force promotion
+ * w/redistribution */
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 23) + 15); u++) {
+ record = (INSERT_SPLIT_ROOT_NREC * 20) + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != ((INSERT_SPLIT_ROOT_NREC * 20) + u))
+ if (rrecord != ((INSERT_SPLIT_ROOT_NREC * 20) + u))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
+ if (nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check status of B-tree */
ninfo.depth = 2;
- ninfo.nrec = 1;
- record = 1196; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 1196; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -8405,15 +8373,16 @@ test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level2_3internal_merge() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_level2_collapse_right
*
@@ -8428,101 +8397,100 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- hsize_t nrec; /* Number of records in B-tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ hsize_t nrec; /* Number of records in B-tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
TESTING("B-tree remove: collapse level-2 B-tree back to level-1 (r->l)");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, &record, (unsigned)2) < 0)
+ record = 1889; /* Left record in root node */
+ if (check_node_depth(bt2, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 2834; /* Right record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 2834; /* Right record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ if (nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(!H5F_addr_defined(root_addr))
+ if (!H5F_addr_defined(root_addr))
TEST_ERROR
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to remove records from a level-2 B-tree to force back to level-1 */
- for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 34) + 17; u++) {
- record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
+ for (u = 0; u < (INSERT_SPLIT_ROOT_NREC * 34) + 17; u++) {
+ record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(record != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
+ if (record != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
+ if (nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1)))
TEST_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(bt2, &bt2_stat) < 0)
+ if (H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ if (bt2_stat.depth != 1)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -8530,15 +8498,16 @@ test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_remove_level2_collapse_right() */
-
/*-------------------------------------------------------------------------
* Function: gen_l4_btree2
*
@@ -8553,67 +8522,68 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam,
- haddr_t *bt2_addr, const hsize_t *records)
+gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam, haddr_t *bt2_addr,
+ const hsize_t *records)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- hsize_t record; /* Record to insert into tree */
- unsigned u; /* Local index variable */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ hsize_t record; /* Record to insert into tree */
+ unsigned u; /* Local index variable */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, bt2_addr) < 0)
TEST_ERROR
/* Insert random records */
- for(u = 0; u < INSERT_MANY; u++) {
+ for (u = 0; u < INSERT_MANY; u++) {
record = records[u];
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(bt2, &bt2_stat) < 0)
+ if (H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
- if(bt2_stat.depth != 4)
+ if (bt2_stat.depth != 4)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* gen_l4_btree2() */
-
/*-------------------------------------------------------------------------
* Function: test_remove_lots
*
@@ -8632,23 +8602,23 @@ error:
static unsigned
test_remove_lots(const char *env_h5_drvr, hid_t fapl, const H5B2_create_t *cparam)
{
- hid_t file = -1; /* File ID */
- char filename[1024]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- int fd = -1; /* File descriptor */
- h5_stat_t sb; /* Stat buffer for file */
- void *file_data = NULL; /* Copy of file data */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t rrecord; /* Record to remove from tree */
- haddr_t root_addr; /* Address of root of B-tree created */
- time_t curr_time; /* Current time, for seeding random number generator */
- hsize_t *records; /* Record #'s for random insertion */
- unsigned u; /* Local index variable */
- unsigned rem_idx; /* Location to remove */
- hsize_t nrec; /* Number of records in B-tree */
- hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */
+ hid_t file = -1; /* File ID */
+ char filename[1024]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ int fd = -1; /* File descriptor */
+ h5_stat_t sb; /* Stat buffer for file */
+ void * file_data = NULL; /* Copy of file data */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
+ haddr_t root_addr; /* Address of root of B-tree created */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ hsize_t * records; /* Record #'s for random insertion */
+ unsigned u; /* Local index variable */
+ unsigned rem_idx; /* Location to remove */
+ hsize_t nrec; /* Number of records in B-tree */
+ hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */
/* Initialize random number seed */
curr_time = HDtime(NULL);
@@ -8663,53 +8633,54 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
*/
/* Allocate space for the records */
- if(NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY)))
+ if (NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY)))
TEST_ERROR
/* Initialize record #'s */
- for(u = 0; u < INSERT_MANY; u++)
+ for (u = 0; u < INSERT_MANY; u++)
records[u] = u;
/* Shuffle record #'s */
- for(u = 0; u < INSERT_MANY; u++) {
- hsize_t temp_rec; /* Temporary record */
- unsigned swap_idx; /* Location to swap with when shuffling */
+ for (u = 0; u < INSERT_MANY; u++) {
+ hsize_t temp_rec; /* Temporary record */
+ unsigned swap_idx; /* Location to swap with when shuffling */
- swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u;
- temp_rec = records[u];
- records[u] = records[swap_idx];
+ swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u;
+ temp_rec = records[u];
+ records[u] = records[swap_idx];
records[swap_idx] = temp_rec;
} /* end for */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Generate the v2 B-tree to test */
- if(gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
+ if (gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
TEST_ERROR
/* Check for VFD which stores data in multiple files */
- single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"));
- if(single_file_vfd) {
+ single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") &&
+ HDstrcmp(env_h5_drvr, "family"));
+ if (single_file_vfd) {
/* Make a copy of the file in memory, in order to speed up deletion testing */
/* Open the file just created */
- if((fd = HDopen(filename, O_RDONLY)) < 0)
+ if ((fd = HDopen(filename, O_RDONLY)) < 0)
TEST_ERROR
/* Retrieve the file's size */
- if(HDfstat(fd, &sb) < 0)
+ if (HDfstat(fd, &sb) < 0)
TEST_ERROR
/* Allocate space for the file data */
- if(NULL == (file_data = HDmalloc((size_t)sb.st_size)))
+ if (NULL == (file_data = HDmalloc((size_t)sb.st_size)))
TEST_ERROR
/* Read file's data into memory */
- if(HDread(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size)
+ if (HDread(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size)
TEST_ERROR
/* Close the file */
- if(HDclose(fd) < 0)
+ if (HDclose(fd) < 0)
TEST_ERROR
fd = -1;
} /* end if */
@@ -8718,353 +8689,345 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
TESTING("B-tree remove: create random level 4 B-tree and delete all records in random order");
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Re-shuffle record #'s */
- for(u = 0; u < INSERT_MANY; u++) {
- hsize_t temp_rec; /* Temporary record */
- unsigned swap_idx; /* Location to swap with when shuffling */
+ for (u = 0; u < INSERT_MANY; u++) {
+ hsize_t temp_rec; /* Temporary record */
+ unsigned swap_idx; /* Location to swap with when shuffling */
- swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u;
- temp_rec = records[u];
- records[u] = records[swap_idx];
+ swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u;
+ temp_rec = records[u];
+ records[u] = records[swap_idx];
records[swap_idx] = temp_rec;
} /* end for */
/* Re-open v2 B-tree */
- if(NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
+ if (NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
FAIL_STACK_ERROR
/* Remove all records */
- for(u = 0; u < INSERT_MANY; u++) {
- record = records[u];
+ for (u = 0; u < INSERT_MANY; u++) {
+ record = records[u];
rrecord = HSIZET_MAX;
- if(H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
+ if (H5B2_remove(bt2, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != records[u])
+ if (rrecord != records[u])
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_MANY - (u + 1)))
+ if (nrec != (INSERT_MANY - (u + 1)))
TEST_ERROR
} /* end for */
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(H5F_addr_defined(root_addr))
+ if (H5F_addr_defined(root_addr))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
-
-
/* Check for VFD which stores data in multiple files */
- if(single_file_vfd) {
+ if (single_file_vfd) {
/* Re-write the file's data with the copy in memory */
/* Open the file just created */
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
TEST_ERROR
/* Write file's data from memory */
- if(HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size)
+ if (HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size)
TEST_ERROR
/* Close the file */
- if(HDclose(fd) < 0)
+ if (HDclose(fd) < 0)
TEST_ERROR
fd = -1;
} /* end if */
else {
/* Re-generate the v2 B-tree to test */
- if(gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
+ if (gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
TEST_ERROR
} /* end else */
-
/* Print banner for this test */
TESTING("B-tree remove: create random level 4 B-tree and delete all records by index, in random order");
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Re-open v2 B-tree */
- if(NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
+ if (NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
FAIL_STACK_ERROR
/* Remove all records */
- for(u = 0; u < INSERT_MANY; u++) {
+ for (u = 0; u < INSERT_MANY; u++) {
/* Pick a record index to remove from randomly */
rem_idx = ((unsigned)HDrandom() % (INSERT_MANY - u));
rrecord = HSIZET_MAX;
/* Remove random record */
- if(H5B2_remove_by_idx(bt2, H5_ITER_INC, (hsize_t)rem_idx, remove_cb, &rrecord) < 0)
+ if (H5B2_remove_by_idx(bt2, H5_ITER_INC, (hsize_t)rem_idx, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord >= INSERT_MANY)
+ if (rrecord >= INSERT_MANY)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_MANY - (u + 1)))
+ if (nrec != (INSERT_MANY - (u + 1)))
TEST_ERROR
} /* end for */
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(H5F_addr_defined(root_addr))
+ if (H5F_addr_defined(root_addr))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
-
-
/* Check for VFD which stores data in multiple files */
- if(single_file_vfd) {
+ if (single_file_vfd) {
/* Re-write the file's data with the copy in memory */
/* Open the file just created */
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
TEST_ERROR
/* Write file's data from memory */
- if(HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size)
+ if (HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size)
TEST_ERROR
/* Close the file */
- if(HDclose(fd) < 0)
+ if (HDclose(fd) < 0)
TEST_ERROR
fd = -1;
} /* end if */
else {
/* Re-generate the v2 B-tree to test */
- if(gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
+ if (gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
TEST_ERROR
} /* end else */
-
-
/* Print banner for this test */
- TESTING("B-tree remove: create random level 4 B-tree and delete all records by index, in increasing order");
+ TESTING(
+ "B-tree remove: create random level 4 B-tree and delete all records by index, in increasing order");
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Re-open v2 B-tree */
- if(NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
+ if (NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
FAIL_STACK_ERROR
/* Remove all records */
- for(u = 0; u < INSERT_MANY; u++) {
+ for (u = 0; u < INSERT_MANY; u++) {
/* Remove first record */
rrecord = HSIZET_MAX;
- if(H5B2_remove_by_idx(bt2, H5_ITER_INC, (hsize_t)0, remove_cb, &rrecord) < 0)
+ if (H5B2_remove_by_idx(bt2, H5_ITER_INC, (hsize_t)0, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != u)
+ if (rrecord != u)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_MANY - (u + 1)))
+ if (nrec != (INSERT_MANY - (u + 1)))
TEST_ERROR
} /* end for */
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(H5F_addr_defined(root_addr))
+ if (H5F_addr_defined(root_addr))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
-
-
/* Check for VFD which stores data in multiple files */
- if(single_file_vfd) {
+ if (single_file_vfd) {
/* Re-write the file's data with the copy in memory */
/* Open the file just created */
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
TEST_ERROR
/* Write file's data from memory */
- if(HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size)
+ if (HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size)
TEST_ERROR
/* Close the file */
- if(HDclose(fd) < 0)
+ if (HDclose(fd) < 0)
TEST_ERROR
fd = -1;
} /* end if */
else {
/* Re-generate the v2 B-tree to test */
- if(gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
+ if (gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
TEST_ERROR
} /* end else */
-
-
/* Print banner for this test */
- TESTING("B-tree remove: create random level 4 B-tree and delete all records by index, in decreasing order");
+ TESTING(
+ "B-tree remove: create random level 4 B-tree and delete all records by index, in decreasing order");
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Re-open v2 B-tree */
- if(NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
+ if (NULL == (bt2 = H5B2_open(f, bt2_addr, f)))
FAIL_STACK_ERROR
/* Remove all records */
- for(u = 0; u < INSERT_MANY; u++) {
+ for (u = 0; u < INSERT_MANY; u++) {
/* Remove last record */
rrecord = HSIZET_MAX;
- if(H5B2_remove_by_idx(bt2, H5_ITER_DEC, (hsize_t)0, remove_cb, &rrecord) < 0)
+ if (H5B2_remove_by_idx(bt2, H5_ITER_DEC, (hsize_t)0, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
- if(rrecord != (INSERT_MANY - (u + 1)))
+ if (rrecord != (INSERT_MANY - (u + 1)))
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(bt2, &nrec) < 0)
+ if (H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
- if(nrec != (INSERT_MANY - (u + 1)))
+ if (nrec != (INSERT_MANY - (u + 1)))
TEST_ERROR
} /* end for */
/* Query the address of the root node in the B-tree */
- if(H5B2__get_root_addr_test(bt2, &root_addr) < 0)
+ if (H5B2__get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
- if(H5F_addr_defined(root_addr))
+ if (H5F_addr_defined(root_addr))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
- if(records)
+ if (records)
HDfree(records);
- if(file_data)
+ if (file_data)
HDfree(file_data);
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
- if(fd > 0)
+ if (fd > 0)
HDclose(fd);
- if(records)
+ if (records)
HDfree(records);
- if(file_data)
+ if (file_data)
HDfree(file_data);
return 1;
} /* test_remove_lots() */
-
/*-------------------------------------------------------------------------
* Function: test_find_neighbor
*
@@ -9080,26 +9043,25 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t search; /* Search value */
- hsize_t *records; /* Record #'s for random insertion */
- unsigned u; /* Local index variable */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t search; /* Search value */
+ hsize_t * records; /* Record #'s for random insertion */
+ unsigned u; /* Local index variable */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ herr_t ret; /* Generic error return value */
/* Allocate space for the records */
- if(NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * FIND_NEIGHBOR)))
+ if (NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * FIND_NEIGHBOR)))
TEST_ERROR
/* Initialize record #'s */
- for(u = 0; u < FIND_NEIGHBOR; u++)
+ for (u = 0; u < FIND_NEIGHBOR; u++)
records[u] = u * 2;
/*
@@ -9108,85 +9070,84 @@ test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree find: nearest neighbor less than a value");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert records */
- for(u = 0; u < FIND_NEIGHBOR; u++) {
+ for (u = 0; u < FIND_NEIGHBOR; u++) {
record = records[u];
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Attempt to find record B-tree less than a value */
search = 0;
- H5E_BEGIN_TRY {
- ret = H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
search = 1;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 0)
+ if (record != 0)
TEST_ERROR
search = 2;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 0)
+ if (record != 0)
TEST_ERROR
search = 3;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 2)
+ if (record != 2)
TEST_ERROR
search = 4;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 2)
+ if (record != 2)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 14;
- record = 250; /* Record in left internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 14;
+ record = 250; /* Record in left internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Neighbor is in internal node */
search = 251;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 250)
+ if (record != 250)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 2;
- ninfo.nrec = 1;
- record = 1888; /* Record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 1;
+ record = 1888; /* Record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Neighbor is in root node */
search = 1889;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 1888)
+ if (record != 1888)
TEST_ERROR
search = (FIND_NEIGHBOR * 2) + 1;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != ((FIND_NEIGHBOR - 1) * 2))
+ if (record != ((FIND_NEIGHBOR - 1) * 2))
TEST_ERROR
PASSED();
@@ -9197,76 +9158,75 @@ test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree find: nearest neighbor greater than a value");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Attempt to find record B-tree less than a value */
search = (FIND_NEIGHBOR * 2) + 1;
- H5E_BEGIN_TRY {
- ret = H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
search = 0;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 2)
+ if (record != 2)
TEST_ERROR
search = 1;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 2)
+ if (record != 2)
TEST_ERROR
search = 2;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 4)
+ if (record != 4)
TEST_ERROR
search = 3;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 4)
+ if (record != 4)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 16;
- record = 2896; /* Record in right internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 16;
+ record = 2896; /* Record in right internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Neighbor is in internal node */
search = 2895;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 2896)
+ if (record != 2896)
TEST_ERROR
/* Neighbor is in root node */
search = 1887;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != 1888)
+ if (record != 1888)
TEST_ERROR
search = ((FIND_NEIGHBOR - 1) * 2) - 1;
- if(H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if (H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
- if(record != ((FIND_NEIGHBOR - 1) * 2))
+ if (record != ((FIND_NEIGHBOR - 1) * 2))
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
PASSED();
@@ -9276,16 +9236,17 @@ test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
HDfree(records);
return 1;
} /* test_find_neighbor() */
-
/*-------------------------------------------------------------------------
* Function: test_delete
*
@@ -9303,73 +9264,73 @@ error:
static unsigned
test_delete(hid_t fapl, const H5B2_create_t *cparam)
{
- hid_t file = -1; /* File ID */
- char filename[1024]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t empty_size; /* Size of an empty file */
- h5_stat_size_t file_size; /* Size of each file created */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[1024]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t empty_size; /* Size of an empty file */
+ h5_stat_size_t file_size; /* Size of each file created */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Attempt to delete empty B-tree */
TESTING("B-tree delete: delete empty B-tree");
-/* Create empty file for size comparisons later */
+ /* Create empty file for size comparisons later */
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
/* Get the size of an empty file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/*
* Delete v2 B-tree
*/
- if(H5B2_delete(f, bt2_addr, f, NULL, NULL) < 0)
+ if (H5B2_delete(f, bt2_addr, f, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -9378,55 +9339,55 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam)
TESTING("B-tree delete: delete level-0 B-tree");
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert records */
- for(u = 0; u < DELETE_SMALL; u++) {
+ for (u = 0; u < DELETE_SMALL; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(bt2, &bt2_stat) < 0)
+ if (H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
- if(bt2_stat.depth != 0)
+ if (bt2_stat.depth != 0)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/*
* Delete v2 B-tree
*/
- if(H5B2_delete(f, bt2_addr, f, NULL, NULL) < 0)
+ if (H5B2_delete(f, bt2_addr, f, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -9435,55 +9396,55 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam)
TESTING("B-tree delete: delete level-1 B-tree");
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert records */
- for(u = 0; u < DELETE_MEDIUM; u++) {
+ for (u = 0; u < DELETE_MEDIUM; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(bt2, &bt2_stat) < 0)
+ if (H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ if (bt2_stat.depth != 1)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/*
* Delete v2 B-tree
*/
- if(H5B2_delete(f, bt2_addr, f, NULL, NULL) < 0)
+ if (H5B2_delete(f, bt2_addr, f, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -9492,55 +9453,55 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam)
TESTING("B-tree delete: delete level-2 B-tree");
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Insert records */
- for(u = 0; u < DELETE_LARGE; u++) {
+ for (u = 0; u < DELETE_LARGE; u++) {
record = u;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(bt2, &bt2_stat) < 0)
+ if (H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ if (bt2_stat.depth != 2)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/*
* Delete v2 B-tree
*/
- if(H5B2_delete(f, bt2_addr, f, NULL, NULL) < 0)
+ if (H5B2_delete(f, bt2_addr, f, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -9548,15 +9509,16 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam)
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_delete() */
-
/*-------------------------------------------------------------------------
* Function: test_modify
*
@@ -9572,20 +9534,19 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_modify(hid_t fapl, const H5B2_create_t *cparam,
- const bt2_test_param_t *tparam)
+test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
- hsize_t record; /* Record to insert into tree */
- hsize_t modify; /* Modified value */
- hsize_t found; /* Found value */
- H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- H5B2_node_info_test_t ninfo; /* B-tree node info */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic error return value */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5B2_t * bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
+ hsize_t modify; /* Modified value */
+ hsize_t found; /* Found value */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ H5B2_node_info_test_t ninfo; /* B-tree node info */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
/*
* Test modifying records
@@ -9593,34 +9554,33 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree modify: attempt to modify non-existant record");
/* Create the file for the test */
- if(create_file(&file, &f, fapl) < 0)
+ if (create_file(&file, &f, fapl) < 0)
TEST_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
- for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
+ for (u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u * 5;
- if(H5B2_insert(bt2, &record) < 0)
+ if (H5B2_insert(bt2, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(bt2, &bt2_stat) < 0)
+ if (H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ if (bt2_stat.depth != 2)
TEST_ERROR
/* Attempt to modify a non-existant record */
record = 3;
modify = 4;
- H5E_BEGIN_TRY {
- ret = H5B2_modify(bt2, &record, modify_cb, &modify);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5B2_modify(bt2, &record, modify_cb, &modify); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
PASSED();
@@ -9628,45 +9588,44 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree modify: modify record in leaf node");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 0;
- ninfo.nrec = 62;
- record = 4330; /* Record in leaf node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 62;
+ record = 4330; /* Record in leaf node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to modify a record in a leaf node */
record = 4330;
modify = 4331;
- if(H5B2_modify(bt2, &record, modify_cb, &modify) < 0)
+ if (H5B2_modify(bt2, &record, modify_cb, &modify) < 0)
FAIL_STACK_ERROR
/* Check status of B-tree */
ninfo.depth = 0;
- ninfo.nrec = 62;
- record = 4331; /* Record in leaf node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 62;
+ record = 4331; /* Record in leaf node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to find modified record */
record = 4331;
- found = 4331;
- if(H5B2_find(bt2, &record, find_cb, &found) != TRUE)
+ found = 4331;
+ if (H5B2_find(bt2, &record, find_cb, &found) != TRUE)
FAIL_STACK_ERROR
- if(found != 4331)
+ if (found != 4331)
TEST_ERROR
/* Attempt to find original record */
record = 4330;
- found = HSIZET_MAX;
- H5E_BEGIN_TRY {
- ret = H5B2_modify(bt2, &record, modify_cb, &modify);
- } H5E_END_TRY;
+ found = HSIZET_MAX;
+ H5E_BEGIN_TRY { ret = H5B2_modify(bt2, &record, modify_cb, &modify); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
PASSED();
@@ -9674,45 +9633,44 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree modify: modify record in internal node");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 29;
- record = 5350; /* Record in internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 29;
+ record = 5350; /* Record in internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to modify a record in an internal node */
record = 5350;
modify = 5352;
- if(H5B2_modify(bt2, &record, modify_cb, &modify) < 0)
+ if (H5B2_modify(bt2, &record, modify_cb, &modify) < 0)
FAIL_STACK_ERROR
/* Check status of B-tree */
ninfo.depth = 1;
- ninfo.nrec = 29;
- record = 5352; /* Record in internal node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 29;
+ record = 5352; /* Record in internal node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to find modified record */
record = 5352;
- found = 5352;
- if(H5B2_find(bt2, &record, find_cb, &found) != TRUE)
+ found = 5352;
+ if (H5B2_find(bt2, &record, find_cb, &found) != TRUE)
STACK_ERROR
- if(found != 5352)
+ if (found != 5352)
TEST_ERROR
/* Attempt to find original record */
record = 5350;
- found = 5350;
- H5E_BEGIN_TRY {
- ret = H5B2_modify(bt2, &record, modify_cb, &modify);
- } H5E_END_TRY;
+ found = 5350;
+ H5E_BEGIN_TRY { ret = H5B2_modify(bt2, &record, modify_cb, &modify); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
PASSED();
@@ -9720,54 +9678,53 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam,
TESTING("B-tree modify: modify record in root node");
/* Check for closing & re-opening the B-tree */
- if(reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
+ if (reopen_btree(f, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Check status of B-tree */
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 9445; /* Record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 9445; /* Record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to modify a record in a root node */
record = 9445;
modify = 9448;
- if(H5B2_modify(bt2, &record, modify_cb, &modify) < 0)
+ if (H5B2_modify(bt2, &record, modify_cb, &modify) < 0)
FAIL_STACK_ERROR
/* Check status of B-tree */
ninfo.depth = 2;
- ninfo.nrec = 2;
- record = 9448; /* Record in root node */
- if(check_node_info(bt2, record, &ninfo) < 0)
+ ninfo.nrec = 2;
+ record = 9448; /* Record in root node */
+ if (check_node_info(bt2, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to find modified record */
record = 9448;
- found = 9448;
- if(H5B2_find(bt2, &record, find_cb, &found) != TRUE)
+ found = 9448;
+ if (H5B2_find(bt2, &record, find_cb, &found) != TRUE)
STACK_ERROR
- if(found != 9448)
+ if (found != 9448)
TEST_ERROR
/* Attempt to find original record */
record = 9445;
- found = 9445;
- H5E_BEGIN_TRY {
- ret = H5B2_modify(bt2, &record, modify_cb, &modify);
- } H5E_END_TRY;
+ found = 9445;
+ H5E_BEGIN_TRY { ret = H5B2_modify(bt2, &record, modify_cb, &modify); }
+ H5E_END_TRY;
/* Should fail */
- if(ret != FAIL)
+ if (ret != FAIL)
TEST_ERROR
/* Close the v2 B-tree */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
PASSED();
@@ -9775,15 +9732,16 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_modify() */
-
/*-------------------------------------------------------------------------
* Function: test_open_twice_diff
*
@@ -9802,17 +9760,17 @@ error:
static unsigned
test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam)
{
- char filename[1024]; /* Filename to use */
- char filename_tmp[1024]; /* Temporary file name */
- hid_t file = -1; /* File ID */
- hid_t file2 = -1; /* File ID */
- hid_t file0 = -1; /* File ID */
- hid_t file00 = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5F_t *f2 = NULL; /* Internal file object pointer */
- H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
- H5B2_t *bt2_2 = NULL; /* Second v2 B-tree wrapper */
- haddr_t bt2_addr; /* Address of B-tree created */
+ char filename[1024]; /* Filename to use */
+ char filename_tmp[1024]; /* Temporary file name */
+ hid_t file = -1; /* File ID */
+ hid_t file2 = -1; /* File ID */
+ hid_t file0 = -1; /* File ID */
+ hid_t file00 = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5F_t * f2 = NULL; /* Internal file object pointer */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ H5B2_t *bt2_2 = NULL; /* Second v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
@@ -9822,27 +9780,27 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam)
TESTING("open B-tree twice, through different file handles");
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
FAIL_STACK_ERROR
/* Create the v2 B-tree & get its address */
- if(create_btree(f, cparam, &bt2, &bt2_addr) < 0)
+ if (create_btree(f, cparam, &bt2, &bt2_addr) < 0)
TEST_ERROR
/* Re-open v2 B-tree */
- if(NULL == (bt2_2 = H5B2_open(f, bt2_addr, f)))
+ if (NULL == (bt2_2 = H5B2_open(f, bt2_addr, f)))
FAIL_STACK_ERROR
/* Close the second v2 B-tree wrapper */
- if(H5B2_close(bt2_2) < 0)
+ if (H5B2_close(bt2_2) < 0)
FAIL_STACK_ERROR
bt2_2 = NULL;
@@ -9850,11 +9808,11 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam)
/* (So that there is something holding the file open when the extensible
* array is closed)
*/
- if((file0 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file0 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Close the first v2 B-tree wrapper */
- if(H5B2_close(bt2) < 0)
+ if (H5B2_close(bt2) < 0)
FAIL_STACK_ERROR
bt2 = NULL;
@@ -9862,7 +9820,7 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam)
/* (close before second file, to detect error on internal B-tree header's
* shared file information)
*/
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
file = -1;
@@ -9872,57 +9830,58 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam)
* header stale)
*/
h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp));
- if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Re-open the file with the v2 B-tree array */
- if((file2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f2 = (H5F_t *)H5VL_object(file2)))
+ if (NULL == (f2 = (H5F_t *)H5VL_object(file2)))
FAIL_STACK_ERROR
/* Open the B-tree through the second file handle */
- if(NULL == (bt2_2 = H5B2_open(f2, bt2_addr, f2)))
+ if (NULL == (bt2_2 = H5B2_open(f2, bt2_addr, f2)))
FAIL_STACK_ERROR
/* Close the extra file handles */
- if(H5Fclose(file0) < 0)
+ if (H5Fclose(file0) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file00) < 0)
+ if (H5Fclose(file00) < 0)
FAIL_STACK_ERROR
/* Close the second v2 B-tree */
- if(H5B2_close(bt2_2) < 0)
+ if (H5B2_close(bt2_2) < 0)
FAIL_STACK_ERROR
bt2_2 = NULL;
/* Close file */
- if(H5Fclose(file2) < 0)
+ if (H5Fclose(file2) < 0)
FAIL_STACK_ERROR
/* All tests passed */
PASSED();
/* All tests passed */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(bt2)
+ H5E_BEGIN_TRY
+ {
+ if (bt2)
H5B2_close(bt2);
- if(bt2)
+ if (bt2)
H5B2_close(bt2_2);
- H5Fclose(file);
- H5Fclose(file2);
- H5Fclose(file0);
- H5Fclose(file00);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ H5Fclose(file2);
+ H5Fclose(file0);
+ H5Fclose(file00);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_open_twice_diff() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -9940,36 +9899,37 @@ error:
int
main(void)
{
- H5B2_create_t cparam, cparam2; /* Creation parameters for v2 B-tree */
- bt2_test_param_t tparam; /* Test parameters for v2 B-tree */
- hid_t fapl = -1; /* File access property list for data files */
- unsigned nerrors = 0; /* Cumulative error count */
- unsigned reopen; /* Whether to reopen B-tree during tests */
- int ExpressMode;
- const char *envval = NULL;
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ H5B2_create_t cparam, cparam2; /* Creation parameters for v2 B-tree */
+ bt2_test_param_t tparam; /* Test parameters for v2 B-tree */
+ hid_t fapl = -1; /* File access property list for data files */
+ unsigned nerrors = 0; /* Cumulative error count */
+ unsigned reopen; /* Whether to reopen B-tree during tests */
+ int ExpressMode;
+ const char * envval = NULL;
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
envval = HDgetenv("HDF5_DRIVER");
- if(envval == NULL)
+ if (envval == NULL)
envval = "nomatch";
/* Reset library */
h5_reset();
- fapl = h5_fileaccess();
+ fapl = h5_fileaccess();
ExpressMode = GetTestExpress();
- if(ExpressMode > 1)
+ if (ExpressMode > 1)
HDprintf("***Express test mode on. Some tests may be skipped\n");
/* Initialize v2 B-tree creation parameters */
init_cparam(&cparam, &cparam2);
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Loop over re-opening B-tree during tests */
- for(reopen = FALSE; reopen <= TRUE; reopen++) {
- if(reopen) {
+ for (reopen = FALSE; reopen <= TRUE; reopen++) {
+ if (reopen) {
HDfprintf(stdout, "Testing with reopening B-tree:\n");
tparam.reopen_btree = TRUE;
} /* end if */
@@ -9993,7 +9953,7 @@ main(void)
nerrors += test_insert_level2_2internal_split(fapl, &cparam, &tparam);
nerrors += test_insert_level2_3internal_redistrib(fapl, &cparam, &tparam);
nerrors += test_insert_level2_3internal_split(fapl, &cparam, &tparam);
- if(ExpressMode > 1)
+ if (ExpressMode > 1)
HDprintf("***Express test mode on. test_insert_lots skipped\n");
else
nerrors += test_insert_lots(fapl, &cparam, &tparam);
@@ -10007,7 +9967,7 @@ main(void)
nerrors += test_update_level1_3leaf_redistrib(fapl, &cparam2, &tparam);
nerrors += test_update_level1_middle_split(fapl, &cparam2, &tparam);
nerrors += test_update_make_level2(fapl, &cparam2, &tparam);
- if(ExpressMode > 1)
+ if (ExpressMode > 1)
HDprintf("***Express test mode on. test_update_lots skipped\n");
else
nerrors += test_update_lots(fapl, &cparam2, &tparam);
@@ -10034,7 +9994,7 @@ main(void)
nerrors += test_remove_level2_2internal_merge_right(fapl, &cparam, &tparam);
nerrors += test_remove_level2_3internal_merge(fapl, &cparam, &tparam);
nerrors += test_remove_level2_collapse_right(fapl, &cparam, &tparam);
- if(ExpressMode > 1)
+ if (ExpressMode > 1)
HDprintf("***Express test mode on. test_remove_lots skipped\n");
else
nerrors += test_remove_lots(envval, fapl, &cparam);
@@ -10056,10 +10016,11 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
- if(nerrors)
+ if (nerrors)
goto error;
puts("All v2 B-tree tests passed.");
@@ -10071,12 +10032,11 @@ main(void)
error:
puts("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(fapl); }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
return 1;
} /* end main() */
-
diff --git a/test/cache.c b/test/cache.c
index 3046915..b7269ba 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -20,17 +20,16 @@
#include "cache_common.h"
#include "H5MFprivate.h"
+H5C_t *saved_cache = NULL; /* store the pointer to the instance of
+ * of H5C_t created by H5Fcreate()
+ * here between test cache setup and
+ * shutdown.
+ */
-H5C_t * saved_cache = NULL; /* store the pointer to the instance of
- * of H5C_t created by H5Fcreate()
- * here between test cache setup and
- * shutdown.
- */
-
-haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the
- * space allocated for cache items in the file between
- * cache setup & takedown
- */
+haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the
+ * space allocated for cache items in the file between
+ * cache setup & takedown
+ */
hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between
* cache setup and takedown. Note
@@ -46,94 +45,84 @@ hid_t saved_fcpl_id = H5P_DEFAULT; /* store the fcpl id here between
* close.
*/
-hid_t saved_fid = -1; /* store the file id here between cache setup
- * and takedown.
- */
-hbool_t write_permitted = TRUE;
-hbool_t try_core_file_driver = FALSE;
+hid_t saved_fid = -1; /* store the file id here between cache setup
+ * and takedown.
+ */
+hbool_t write_permitted = TRUE;
+hbool_t try_core_file_driver = FALSE;
hbool_t core_file_driver_failed = FALSE;
-
/* global variable declarations: */
-const char *FILENAME[] = {
- "cache_test",
- NULL
-};
+const char *FILENAME[] = {"cache_test", NULL};
/* private typedef declarations: */
-struct flush_cache_test_spec
-{
- int entry_num;
- int entry_type;
- int entry_index;
- hbool_t insert_flag;
- unsigned int flags;
- hbool_t expected_deserialized;
- hbool_t expected_serialized;
- hbool_t expected_destroyed;
+struct flush_cache_test_spec {
+ int entry_num;
+ int entry_type;
+ int entry_index;
+ hbool_t insert_flag;
+ unsigned int flags;
+ hbool_t expected_deserialized;
+ hbool_t expected_serialized;
+ hbool_t expected_destroyed;
};
-struct pe_flush_cache_test_spec
-{
- int entry_num;
- int entry_type;
- int entry_index;
- hbool_t insert_flag;
- unsigned int flags;
- int num_pins;
- int pin_type[MAX_PINS];
- int pin_idx[MAX_PINS];
- hbool_t expected_deserialized;
- hbool_t expected_serialized;
- hbool_t expected_destroyed;
+struct pe_flush_cache_test_spec {
+ int entry_num;
+ int entry_type;
+ int entry_index;
+ hbool_t insert_flag;
+ unsigned int flags;
+ int num_pins;
+ int pin_type[MAX_PINS];
+ int pin_idx[MAX_PINS];
+ hbool_t expected_deserialized;
+ hbool_t expected_serialized;
+ hbool_t expected_destroyed;
};
-struct fo_flush_entry_check
-{
- int entry_num;
- int entry_type;
- int entry_index;
- size_t expected_size;
- hbool_t in_cache;
- hbool_t at_main_addr;
- hbool_t is_dirty;
- hbool_t is_protected;
- hbool_t is_pinned;
- hbool_t expected_deserialized;
- hbool_t expected_serialized;
- hbool_t expected_destroyed;
+struct fo_flush_entry_check {
+ int entry_num;
+ int entry_type;
+ int entry_index;
+ size_t expected_size;
+ hbool_t in_cache;
+ hbool_t at_main_addr;
+ hbool_t is_dirty;
+ hbool_t is_protected;
+ hbool_t is_pinned;
+ hbool_t expected_deserialized;
+ hbool_t expected_serialized;
+ hbool_t expected_destroyed;
};
-struct fo_flush_cache_test_spec
-{
- int entry_num;
- int entry_type;
- int entry_index;
- hbool_t insert_flag;
- unsigned int flags;
- hbool_t resize_flag;
- size_t new_size;
- int num_pins;
- int pin_type[MAX_PINS];
- int pin_idx[MAX_PINS];
- int num_flush_ops;
- struct flush_op flush_ops[MAX_FLUSH_OPS];
- hbool_t expected_deserialized;
- hbool_t expected_serialized;
- hbool_t expected_destroyed;
+struct fo_flush_cache_test_spec {
+ int entry_num;
+ int entry_type;
+ int entry_index;
+ hbool_t insert_flag;
+ unsigned int flags;
+ hbool_t resize_flag;
+ size_t new_size;
+ int num_pins;
+ int pin_type[MAX_PINS];
+ int pin_idx[MAX_PINS];
+ int num_flush_ops;
+ struct flush_op flush_ops[MAX_FLUSH_OPS];
+ hbool_t expected_deserialized;
+ hbool_t expected_serialized;
+ hbool_t expected_destroyed;
};
-struct move_entry_test_spec
-{
- int entry_type;
- int entry_index;
- hbool_t is_pinned;
- hbool_t is_protected;
+struct move_entry_test_spec {
+ int entry_type;
+ int entry_index;
+ hbool_t is_pinned;
+ hbool_t is_protected;
};
-
/* private function declarations: */
static unsigned smoke_check_1(int express_test, unsigned paged);
@@ -149,61 +138,36 @@ static unsigned smoke_check_10(int express_test, unsigned paged);
static unsigned write_permitted_check(int express_test, unsigned paged);
static unsigned check_insert_entry(unsigned paged);
static unsigned check_flush_cache(unsigned paged);
-static void check_flush_cache__empty_cache(H5F_t * file_ptr);
-static void check_flush_cache__multi_entry(H5F_t * file_ptr);
-static void check_flush_cache__multi_entry_test(H5F_t * file_ptr,
- int test_num,
- unsigned int flush_flags,
- unsigned int spec_size,
- struct flush_cache_test_spec spec[]);
-static void check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
- int test_num,
- unsigned int flush_flags,
- unsigned int spec_size,
- struct pe_flush_cache_test_spec spec[]);
-static void check_flush_cache__single_entry(H5F_t * file_ptr);
-static void check_flush_cache__single_entry_test(H5F_t * file_ptr,
- int test_num,
- int entry_type,
- int entry_idx,
- hbool_t insert_flag,
- unsigned int flags,
- unsigned int flush_flags,
- hbool_t expected_deserialized,
- hbool_t expected_serialized,
- hbool_t expected_destroyed);
-static void check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
- int test_num,
- int entry_type,
- int entry_idx,
- hbool_t unprot_dirty_flag,
- hbool_t mark_dirty,
- hbool_t pop_mark_dirty_prot,
- hbool_t pop_mark_dirty_pinned,
- hbool_t unprotect_unpin,
- unsigned int flags,
- unsigned int flush_flags,
- hbool_t expected_serialized,
- hbool_t expected_destroyed);
-static void check_flush_cache__flush_ops(H5F_t * file_ptr);
-static void check_flush_cache__flush_op_test(H5F_t * file_ptr,
- int test_num,
- unsigned int flush_flags,
- int spec_size,
- const struct fo_flush_cache_test_spec spec[],
- unsigned init_expected_index_len,
- size_t init_expected_index_size,
- unsigned expected_index_len,
- size_t expected_index_size,
- int check_size,
- struct fo_flush_entry_check check[]);
-static void check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr);
+static void check_flush_cache__empty_cache(H5F_t *file_ptr);
+static void check_flush_cache__multi_entry(H5F_t *file_ptr);
+static void check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags,
+ unsigned int spec_size, struct flush_cache_test_spec spec[]);
+static void check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags,
+ unsigned int spec_size,
+ struct pe_flush_cache_test_spec spec[]);
+static void check_flush_cache__single_entry(H5F_t *file_ptr);
+static void check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_type, int entry_idx,
+ hbool_t insert_flag, unsigned int flags,
+ unsigned int flush_flags, hbool_t expected_deserialized,
+ hbool_t expected_serialized, hbool_t expected_destroyed);
+static void check_flush_cache__pinned_single_entry_test(
+ H5F_t *file_ptr, int test_num, int entry_type, int entry_idx, hbool_t unprot_dirty_flag,
+ hbool_t mark_dirty, hbool_t pop_mark_dirty_prot, hbool_t pop_mark_dirty_pinned, hbool_t unprotect_unpin,
+ unsigned int flags, unsigned int flush_flags, hbool_t expected_serialized, hbool_t expected_destroyed);
+static void check_flush_cache__flush_ops(H5F_t *file_ptr);
+static void check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags,
+ int spec_size, const struct fo_flush_cache_test_spec spec[],
+ unsigned init_expected_index_len,
+ size_t init_expected_index_size, unsigned expected_index_len,
+ size_t expected_index_size, int check_size,
+ struct fo_flush_entry_check check[]);
+static void check_flush_cache__flush_op_eviction_test(H5F_t *file_ptr);
static unsigned check_get_entry_status(unsigned paged);
static unsigned check_expunge_entry(unsigned paged);
static unsigned check_multiple_read_protect(unsigned paged);
static unsigned check_move_entry(unsigned paged);
-static void check_move_entry__run_test(H5F_t * file_ptr, unsigned test_num,
- struct move_entry_test_spec * spec_ptr);
+static void check_move_entry__run_test(H5F_t *file_ptr, unsigned test_num,
+ struct move_entry_test_spec *spec_ptr);
static unsigned check_pin_protected_entry(unsigned paged);
static unsigned check_resize_entry(unsigned paged);
static unsigned check_evictions_enabled(unsigned paged);
@@ -236,21 +200,18 @@ static unsigned check_flush_deps_order(unsigned paged);
static unsigned check_notify_cb(unsigned paged);
static unsigned check_metadata_cork(hbool_t fill_via_insertion, unsigned paged);
static unsigned check_entry_deletions_during_scans(unsigned paged);
-static void cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr);
-static void cedds__H5C_make_space_in_cache(H5F_t * file_ptr);
-static void cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr);
-static void cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr);
+static void cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr);
+static void cedds__H5C_make_space_in_cache(H5F_t *file_ptr);
+static void cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr);
+static void cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t *file_ptr);
static unsigned check_stats(unsigned paged);
#if H5C_COLLECT_CACHE_STATS
-static void check_stats__smoke_check_1(H5F_t * file_ptr);
+static void check_stats__smoke_check_1(H5F_t *file_ptr);
#endif /* H5C_COLLECT_CACHE_STATS */
-
static H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged);
-static void takedown_cache(H5F_t * file_ptr,
- hbool_t dump_stats,
- hbool_t dump_detailed_stats);
+static void takedown_cache(H5F_t *file_ptr, hbool_t dump_stats, hbool_t dump_detailed_stats);
/**************************************************************************/
/**************************************************************************/
@@ -276,67 +237,63 @@ static void takedown_cache(H5F_t * file_ptr,
static unsigned
smoke_check_1(int express_test, unsigned paged)
{
- hbool_t show_progress = FALSE;
- int dirty_unprotects = FALSE;
- int dirty_destroys = FALSE;
- hbool_t display_stats = FALSE;
- int32_t lag = 10;
- int32_t max_index = (10 * 1024) - 1;
- int mile_stone = 1;
- H5F_t * file_ptr = NULL;
-
- if(paged)
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = FALSE;
+ int dirty_destroys = FALSE;
+ hbool_t display_stats = FALSE;
+ int32_t lag = 10;
+ int32_t max_index = (10 * 1024) - 1;
+ int mile_stone = 1;
+ H5F_t * file_ptr = NULL;
+
+ if (paged)
TESTING("smoke check #1P -- all clean, ins, dest, ren, 4/2 MB cache")
else
TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -346,13 +303,12 @@ smoke_check_1(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -365,16 +321,15 @@ smoke_check_1(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -384,13 +339,12 @@ smoke_check_1(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -399,12 +353,11 @@ smoke_check_1(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -413,9 +366,8 @@ smoke_check_1(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -424,12 +376,11 @@ smoke_check_1(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -438,32 +389,33 @@ smoke_check_1(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_1() */
-
/*-------------------------------------------------------------------------
* Function: smoke_check_2()
*
@@ -483,67 +435,63 @@ smoke_check_1(int express_test, unsigned paged)
static unsigned
smoke_check_2(int express_test, unsigned paged)
{
- hbool_t show_progress = FALSE;
- int dirty_unprotects = TRUE;
- int dirty_destroys = TRUE;
- hbool_t display_stats = FALSE;
- int32_t max_index = (10 * 1024) - 1;
- int32_t lag = 10;
- int mile_stone = 1;
- H5F_t * file_ptr = NULL;
-
- if(paged)
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = TRUE;
+ int dirty_destroys = TRUE;
+ hbool_t display_stats = FALSE;
+ int32_t max_index = (10 * 1024) - 1;
+ int32_t lag = 10;
+ int mile_stone = 1;
+ H5F_t * file_ptr = NULL;
+
+ if (paged)
TESTING("smoke check #2P -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache")
else
TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -553,13 +501,12 @@ smoke_check_2(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -572,16 +519,15 @@ smoke_check_2(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -591,13 +537,12 @@ smoke_check_2(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -606,12 +551,11 @@ smoke_check_2(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -620,9 +564,8 @@ smoke_check_2(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -631,12 +574,11 @@ smoke_check_2(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -645,32 +587,33 @@ smoke_check_2(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_2() */
-
/*-------------------------------------------------------------------------
* Function: smoke_check_3()
*
@@ -689,67 +632,63 @@ smoke_check_2(int express_test, unsigned paged)
static unsigned
smoke_check_3(int express_test, unsigned paged)
{
- hbool_t show_progress = FALSE;
- int dirty_unprotects = FALSE;
- int dirty_destroys = FALSE;
- hbool_t display_stats = FALSE;
- int32_t max_index = (10 * 1024) - 1;
- int32_t lag = 10;
- int mile_stone = 1;
- H5F_t * file_ptr = NULL;
-
- if(paged)
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = FALSE;
+ int dirty_destroys = FALSE;
+ hbool_t display_stats = FALSE;
+ int32_t max_index = (10 * 1024) - 1;
+ int32_t lag = 10;
+ int mile_stone = 1;
+ H5F_t * file_ptr = NULL;
+
+ if (paged)
TESTING("smoke check #3P -- all clean, ins, dest, ren, 2/1 KB cache")
else
TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -759,13 +698,12 @@ smoke_check_3(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -778,16 +716,15 @@ smoke_check_3(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -797,13 +734,12 @@ smoke_check_3(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -812,12 +748,11 @@ smoke_check_3(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -826,9 +761,8 @@ smoke_check_3(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -837,12 +771,11 @@ smoke_check_3(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -851,32 +784,33 @@ smoke_check_3(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_3() */
-
/*-------------------------------------------------------------------------
* Function: smoke_check_4()
*
@@ -896,67 +830,63 @@ smoke_check_3(int express_test, unsigned paged)
static unsigned
smoke_check_4(int express_test, unsigned paged)
{
- hbool_t show_progress = FALSE;
- int dirty_unprotects = TRUE;
- int dirty_destroys = TRUE;
- hbool_t display_stats = FALSE;
- int32_t max_index = (10 * 1024) - 1;
- int32_t lag = 10;
- int mile_stone = 1;
- H5F_t * file_ptr = NULL;
-
- if(paged)
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = TRUE;
+ int dirty_destroys = TRUE;
+ hbool_t display_stats = FALSE;
+ int32_t max_index = (10 * 1024) - 1;
+ int32_t lag = 10;
+ int mile_stone = 1;
+ H5F_t * file_ptr = NULL;
+
+ if (paged)
TESTING("smoke check #4P -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache")
else
TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -966,13 +896,12 @@ smoke_check_4(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -985,16 +914,15 @@ smoke_check_4(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -1004,13 +932,12 @@ smoke_check_4(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -1019,12 +946,11 @@ smoke_check_4(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -1033,9 +959,8 @@ smoke_check_4(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -1044,12 +969,11 @@ smoke_check_4(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -1058,32 +982,33 @@ smoke_check_4(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_4() */
-
/*-------------------------------------------------------------------------
* Function: smoke_check_5()
*
@@ -1103,16 +1028,15 @@ smoke_check_4(int express_test, unsigned paged)
static unsigned
smoke_check_5(int express_test, unsigned paged)
{
- herr_t result;
- hbool_t show_progress = FALSE;
- int dirty_unprotects = FALSE;
- hbool_t display_stats = FALSE;
- int32_t max_index = 1024;
- int mile_stone = 1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5C_auto_size_ctl_t auto_size_ctl =
- {
+ herr_t result;
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = FALSE;
+ hbool_t display_stats = FALSE;
+ int32_t max_index = 1024;
+ int mile_stone = 1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5C_auto_size_ctl_t auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
#if 1
/* H5C_auto_resize_report_fcn rpt_fcn = */ NULL,
@@ -1129,7 +1053,6 @@ smoke_check_5(int express_test, unsigned paged)
/* int64_t epoch_length = */ 50000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
@@ -1140,10 +1063,9 @@ smoke_check_5(int express_test, unsigned paged)
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
-
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -1160,67 +1082,63 @@ smoke_check_5(int express_test, unsigned paged)
/* double empty_reserve = */ 0.5f
};
- if(paged)
+ if (paged)
TESTING("smoke check #5P -- all clean, ins, prot, unprot, AR cache 1")
else
TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1230,9 +1148,8 @@ smoke_check_5(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1242,9 +1159,8 @@ smoke_check_5(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1254,9 +1170,8 @@ smoke_check_5(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -1265,9 +1180,8 @@ smoke_check_5(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1278,9 +1192,8 @@ smoke_check_5(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -1289,9 +1202,8 @@ smoke_check_5(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1302,32 +1214,33 @@ smoke_check_5(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_5() */
-
/*-------------------------------------------------------------------------
* Function: smoke_check_6()
*
@@ -1347,16 +1260,15 @@ smoke_check_5(int express_test, unsigned paged)
static unsigned
smoke_check_6(int express_test, unsigned paged)
{
- herr_t result;
- hbool_t show_progress = FALSE;
- int dirty_unprotects = FALSE;
- hbool_t display_stats = FALSE;
- int mile_stone = 1;
- int32_t max_index = 1024;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5C_auto_size_ctl_t auto_size_ctl =
- {
+ herr_t result;
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = FALSE;
+ hbool_t display_stats = FALSE;
+ int mile_stone = 1;
+ int32_t max_index = 1024;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5C_auto_size_ctl_t auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
#if 1
/* H5C_auto_resize_report_fcn rpt_fcn = */ NULL,
@@ -1373,7 +1285,6 @@ smoke_check_6(int express_test, unsigned paged)
/* int64_t epoch_length = */ 50000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
@@ -1384,10 +1295,9 @@ smoke_check_6(int express_test, unsigned paged)
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
-
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -1404,67 +1314,63 @@ smoke_check_6(int express_test, unsigned paged)
/* double empty_reserve = */ 0.05f
};
- if(paged)
+ if (paged)
TESTING("smoke check #6P -- ~1/2 dirty, ins, prot, unprot, AR cache 1")
else
TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
pass = TRUE;
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1474,9 +1380,8 @@ smoke_check_6(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1486,9 +1391,8 @@ smoke_check_6(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1498,9 +1402,8 @@ smoke_check_6(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -1509,9 +1412,8 @@ smoke_check_6(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1522,9 +1424,8 @@ smoke_check_6(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -1533,9 +1434,8 @@ smoke_check_6(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1546,32 +1446,33 @@ smoke_check_6(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_6() */
-
/*-------------------------------------------------------------------------
* Function: smoke_check_7()
*
@@ -1591,16 +1492,15 @@ smoke_check_6(int express_test, unsigned paged)
static unsigned
smoke_check_7(int express_test, unsigned paged)
{
- herr_t result;
- hbool_t show_progress = FALSE;
- int dirty_unprotects = FALSE;
- hbool_t display_stats = FALSE;
- int mile_stone = 1;
- int32_t max_index = 1024;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5C_auto_size_ctl_t auto_size_ctl =
- {
+ herr_t result;
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = FALSE;
+ hbool_t display_stats = FALSE;
+ int mile_stone = 1;
+ int32_t max_index = 1024;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5C_auto_size_ctl_t auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
#if 1
/* H5C_auto_resize_report_fcn rpt_fcn = */ NULL,
@@ -1617,7 +1517,6 @@ smoke_check_7(int express_test, unsigned paged)
/* int64_t epoch_length = */ 100000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
@@ -1628,13 +1527,12 @@ smoke_check_7(int express_test, unsigned paged)
/* size_t max_increment = */ (8 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
-
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */
- H5C_decr__age_out_with_threshold,
+ H5C_decr__age_out_with_threshold,
/* double upper_hr_threshold = */ 0.995f,
@@ -1649,67 +1547,63 @@ smoke_check_7(int express_test, unsigned paged)
/* double empty_reserve = */ 0.1f
};
- if(paged)
+ if (paged)
TESTING("smoke check #7P -- all clean, ins, prot, unprot, AR cache 2")
else
TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1719,9 +1613,8 @@ smoke_check_7(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1731,9 +1624,8 @@ smoke_check_7(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1743,9 +1635,8 @@ smoke_check_7(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -1754,9 +1645,8 @@ smoke_check_7(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1767,9 +1657,8 @@ smoke_check_7(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -1778,9 +1667,8 @@ smoke_check_7(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1791,32 +1679,33 @@ smoke_check_7(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_7() */
-
/*-------------------------------------------------------------------------
* Function: smoke_check_8()
*
@@ -1836,16 +1725,15 @@ smoke_check_7(int express_test, unsigned paged)
static unsigned
smoke_check_8(int express_test, unsigned paged)
{
- herr_t result;
- hbool_t show_progress = FALSE;
- int dirty_unprotects = FALSE;
- hbool_t display_stats = FALSE;
- int mile_stone = 1;
- int32_t max_index = 1024;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5C_auto_size_ctl_t auto_size_ctl =
- {
+ herr_t result;
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = FALSE;
+ hbool_t display_stats = FALSE;
+ int mile_stone = 1;
+ int32_t max_index = 1024;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5C_auto_size_ctl_t auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
#if 1
/* H5C_auto_resize_report_fcn rpt_fcn = */ NULL,
@@ -1862,7 +1750,6 @@ smoke_check_8(int express_test, unsigned paged)
/* int64_t epoch_length = */ 100000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
@@ -1873,13 +1760,12 @@ smoke_check_8(int express_test, unsigned paged)
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
-
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */
- H5C_decr__age_out_with_threshold,
+ H5C_decr__age_out_with_threshold,
/* double upper_hr_threshold = */ 0.995f,
@@ -1894,67 +1780,63 @@ smoke_check_8(int express_test, unsigned paged)
/* double empty_reserve = */ 0.1f
};
- if(paged)
+ if (paged)
TESTING("smoke check #8P -- ~1/2 dirty, ins, prot, unprot, AR cache 2")
else
TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1964,9 +1846,8 @@ smoke_check_8(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1976,9 +1857,8 @@ smoke_check_8(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ FALSE);
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_row_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -1988,9 +1868,8 @@ smoke_check_8(int express_test, unsigned paged)
/* display_detailed_stats */ FALSE,
/* do_inserts */ TRUE);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -1999,9 +1878,8 @@ smoke_check_8(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_col_major_scan_forward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -2012,9 +1890,8 @@ smoke_check_8(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -2023,9 +1900,8 @@ smoke_check_8(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
hl_col_major_scan_backward(/* file_ptr */ file_ptr,
/* max_index */ max_index,
@@ -2036,32 +1912,33 @@ smoke_check_8(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_8() */
-
/*-------------------------------------------------------------------------
* Function: smoke_check_9()
*
@@ -2088,88 +1965,83 @@ smoke_check_8(int express_test, unsigned paged)
static unsigned
smoke_check_9(int express_test, unsigned paged)
{
- herr_t result;
- hbool_t show_progress = FALSE;
- int dirty_unprotects = FALSE;
- int dirty_destroys = FALSE;
- hbool_t display_stats = FALSE;
+ herr_t result;
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = FALSE;
+ int dirty_destroys = FALSE;
+ hbool_t display_stats = FALSE;
hbool_t display_detailed_stats = FALSE;
- int32_t max_index = (10 * 1024) - 1;
- int32_t lag = 10;
- int mile_stone = 1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ int32_t max_index = (10 * 1024) - 1;
+ int32_t lag = 10;
+ int mile_stone = 1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("smoke check #9P -- all clean, ins, dest, ren, 4/2 MB, corked")
else
TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
+ file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
/* disable evictions */
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't disable evictions 1.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't disable evictions 1.\n";
+ }
}
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2179,33 +2051,31 @@ smoke_check_9(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
/* enable evictions */
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't enable evictions 1.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't enable evictions 1.\n";
+ }
}
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n", FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2215,31 +2085,29 @@ smoke_check_9(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't disable evictions 2.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't disable evictions 2.\n";
+ }
}
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled \n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled \n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2249,28 +2117,26 @@ smoke_check_9(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't enable evictions 2.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't enable evictions 2.\n";
+ }
}
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -2279,27 +2145,25 @@ smoke_check_9(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't disable evictions 3.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't disable evictions 3.\n";
+ }
}
- if(show_progress) /* 12 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 12 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2308,9 +2172,8 @@ smoke_check_9(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 13 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 13 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -2319,27 +2182,25 @@ smoke_check_9(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 14 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 14 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't enable evictions 3.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't enable evictions 3.\n";
+ }
}
- if(show_progress) /* 15 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 15 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2348,48 +2209,47 @@ smoke_check_9(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 16 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 16 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't disable evictions 4.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't disable evictions 4.\n";
+ }
}
-
- if(show_progress) /* 17 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 17 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 18 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 18 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_9() */
-
/*-------------------------------------------------------------------------
* Function: smoke_check_10()
*
@@ -2416,71 +2276,67 @@ smoke_check_9(int express_test, unsigned paged)
static unsigned
smoke_check_10(int express_test, unsigned paged)
{
- herr_t result;
- hbool_t show_progress = FALSE;
- int dirty_unprotects = TRUE;
- int dirty_destroys = TRUE;
- hbool_t display_stats = FALSE;
+ herr_t result;
+ hbool_t show_progress = FALSE;
+ int dirty_unprotects = TRUE;
+ int dirty_destroys = TRUE;
+ hbool_t display_stats = FALSE;
hbool_t display_detailed_stats = FALSE;
- int32_t max_index = (10 * 1024) - 1;
- int32_t lag = 10;
- int mile_stone = 1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ int32_t max_index = (10 * 1024) - 1;
+ int32_t lag = 10;
+ int mile_stone = 1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("smoke check #10P -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked")
else
TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked")
- if ( paged && ( express_test > 0 ) ) {
+ if (paged && (express_test > 0)) {
SKIPPED();
- return(0);
+ return (0);
}
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
+ file_ptr = setup_cache((size_t)(4 * 1024 * 1024), (size_t)(2 * 1024 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2490,31 +2346,29 @@ smoke_check_10(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't disable evictions 1.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't disable evictions 1.\n";
+ }
}
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass);
row_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2524,31 +2378,29 @@ smoke_check_10(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't enable evictions 1.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't enable evictions 1.\n";
+ }
}
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2558,28 +2410,26 @@ smoke_check_10(int express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ dirty_destroys,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't disable evictions 2.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't disable evictions 2.\n";
+ }
}
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -2588,27 +2438,25 @@ smoke_check_10(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't enable evictions 2.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't enable evictions 2.\n";
+ }
}
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2617,24 +2465,22 @@ smoke_check_10(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 12 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 12 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't disable evictions 3.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't disable evictions 3.\n";
+ }
}
- if(show_progress) /* 13 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 13 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass);
/* flush all entries in the cache: */
@@ -2643,27 +2489,25 @@ smoke_check_10(int express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 14 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 14 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't enable evictions 3.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't enable evictions 3.\n";
+ }
}
- if(show_progress) /* 15 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 15 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", FUNC, mile_stone++, (int)pass);
col_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2672,47 +2516,47 @@ smoke_check_10(int express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ dirty_unprotects);
- if(show_progress) /* 16 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 16 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
- failure_mssg = "can't disable evictions 4.\n";
- }
+ pass = FALSE;
+ failure_mssg = "can't disable evictions 4.\n";
+ }
}
- if(show_progress) /* 17 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 17 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 18 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 18 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* smoke_check_10() */
-
/*-------------------------------------------------------------------------
* Function: write_permitted_check()
*
@@ -2734,70 +2578,67 @@ smoke_check_10(int express_test, unsigned paged)
static unsigned
write_permitted_check(int
#if !H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-express_test, unsigned paged)
+ express_test,
+ unsigned paged)
{
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
hbool_t show_progress = FALSE;
hbool_t display_stats = FALSE;
- int32_t max_index = (10 * 1024) - 1;
- int32_t lag = 10;
- int mile_stone = 1;
- H5F_t * file_ptr = NULL;
+ int32_t max_index = (10 * 1024) - 1;
+ int32_t lag = 10;
+ int mile_stone = 1;
+ H5F_t * file_ptr = NULL;
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
- if(paged)
+ if (paged)
TESTING("write permitted check -- 1/0 MB cache (paged aggregation)")
else
TESTING("write permitted check -- 1/0 MB cache")
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- switch (express_test)
- {
- case 0:
- max_index = (10 * 1024) - 1;
- break;
+ switch (express_test) {
+ case 0:
+ max_index = (10 * 1024) - 1;
+ break;
- case 1:
- max_index = (1 * 1024) - 1;
- break;
+ case 1:
+ max_index = (1 * 1024) - 1;
+ break;
- case 2:
- max_index = (512) - 1;
- break;
+ case 2:
+ max_index = (512) - 1;
+ break;
- default:
+ default:
SKIPPED();
HDfprintf(stdout, " Long tests disabled.\n");
- return 0; /* <========== note return */
- break;
+ return 0; /* <========== note return */
+ break;
}
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
reset_entries();
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
file_ptr = setup_cache((size_t)(1 * 1024 * 1024), (size_t)0, paged);
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2807,18 +2648,17 @@ express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ TRUE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ TRUE,
/* dirty_unprotects */ TRUE);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
write_permitted = FALSE;
row_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2828,18 +2668,17 @@ express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ TRUE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ FALSE,
/* dirty_unprotects */ NO_CHANGE);
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
write_permitted = TRUE;
row_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2849,13 +2688,12 @@ express_test, unsigned paged)
/* do_moves */ TRUE,
/* move_to_main_addr */ FALSE,
/* do_destroys */ FALSE,
- /* do_mult_ro_protects */ TRUE,
+ /* do_mult_ro_protects */ TRUE,
/* dirty_destroys */ TRUE,
/* dirty_unprotects */ TRUE);
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* flush and destroy all entries in the cache: */
@@ -2864,12 +2702,11 @@ express_test, unsigned paged)
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
col_major_scan_forward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2878,14 +2715,13 @@ express_test, unsigned paged)
/* do_inserts */ TRUE,
/* dirty_unprotects */ TRUE);
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
write_permitted = FALSE;
col_major_scan_backward(/* file_ptr */ file_ptr,
- /* max_index */ max_index,
+ /* max_index */ max_index,
/* lag */ lag,
/* verbose */ FALSE,
/* reset_stats */ TRUE,
@@ -2896,25 +2732,27 @@ express_test, unsigned paged)
write_permitted = TRUE;
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
takedown_cache(file_ptr, display_stats, TRUE);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
verify_clean();
verify_unprotected();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
@@ -2929,7 +2767,6 @@ express_test, unsigned paged)
} /* write_permitted_check() */
-
/*-------------------------------------------------------------------------
* Function: check_insert_entry()
*
@@ -2958,21 +2795,21 @@ express_test, unsigned paged)
static unsigned
check_insert_entry(unsigned paged)
{
- int entry_type = PICO_ENTRY_TYPE;
- int i;
- herr_t result;
- hbool_t in_cache;
- hbool_t is_dirty;
- hbool_t is_protected;
- hbool_t is_pinned;
- size_t entry_size;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
- struct H5C_cache_entry_t * search_ptr;
-
- if(paged)
+ int entry_type = PICO_ENTRY_TYPE;
+ int i;
+ herr_t result;
+ hbool_t in_cache;
+ hbool_t is_dirty;
+ hbool_t is_protected;
+ hbool_t is_pinned;
+ size_t entry_size;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ test_entry_t * base_addr;
+ test_entry_t * entry_ptr;
+ struct H5C_cache_entry_t *search_ptr;
+
+ if (paged)
TESTING("H5C_insert_entry() functionality (paged aggregation)")
else
TESTING("H5C_insert_entry() functionality")
@@ -2989,15 +2826,15 @@ check_insert_entry(unsigned paged)
* used to be the case.)
*/
- if(pass) {
+ if (pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
- if(pass) {
+ if (pass) {
insert_entry(file_ptr, entry_type, 0, H5C__NO_FLAGS_SET);
insert_entry(file_ptr, entry_type, 1, H5C__SET_FLUSH_MARKER_FLAG);
@@ -3007,147 +2844,137 @@ check_insert_entry(unsigned paged)
/* Verify that the entries are inserted as desired. */
- i = 0;
+ i = 0;
base_addr = entries[0];
- while(pass && (i < 4))
- {
- entry_ptr = &(base_addr[i]);
+ while (pass && (i < 4)) {
+ entry_ptr = &(base_addr[i]);
- /* Start by checking everything we can via H5C_get_entry_status() */
+ /* Start by checking everything we can via H5C_get_entry_status() */
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected,
- &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_entry_status() reports failure.";
}
- if(pass) {
+ if (pass) {
- /* check the universals */
- if((!in_cache) || (!is_dirty) || (is_protected) ||
- (entry_size != entry_sizes[entry_type])) {
+ /* check the universals */
+ if ((!in_cache) || (!is_dirty) || (is_protected) || (entry_size != entry_sizes[entry_type])) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected insert results 1.";
}
- }
+ }
- if(pass) {
+ if (pass) {
/* verify that the pinned flag got set correctly */
- if((i == 2) || (i == 3)) {
+ if ((i == 2) || (i == 3)) {
- if(!is_pinned) {
+ if (!is_pinned) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected insert results 2.";
- }
- } else if(is_pinned) {
+ }
+ }
+ else if (is_pinned) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected insert results 3.";
+ }
+ else if (is_pinned != ((entry_ptr->header).is_pinned)) {
- } else if(is_pinned != ((entry_ptr->header).is_pinned)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected insert results 4.";
}
- }
+ }
- /* Thats all we can get from H5C_get_entry_status().
- * Now start looking at the cache data structures directly.
- */
+ /* Thats all we can get from H5C_get_entry_status().
+ * Now start looking at the cache data structures directly.
+ */
- if(pass) {
+ if (pass) {
/* Verify that the flush marker got set correctly */
- if((i == 1) || (i == 3)) {
+ if ((i == 1) || (i == 3)) {
- if(!((entry_ptr->header).flush_marker)) {
+ if (!((entry_ptr->header).flush_marker)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected insert results 5.";
+ }
}
- } else if((entry_ptr->header).flush_marker) {
+ else if ((entry_ptr->header).flush_marker) {
- pass = FALSE;
- failure_mssg = "Unexpected insert results 6.";
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 6.";
+ }
}
- }
- if(pass) {
+ if (pass) {
- /* Verify that pinned entries are in the pinned entry list */
- if((entry_ptr->header).is_pinned) {
+ /* Verify that pinned entries are in the pinned entry list */
+ if ((entry_ptr->header).is_pinned) {
- search_ptr = cache_ptr->pel_head_ptr;
+ search_ptr = cache_ptr->pel_head_ptr;
- while((search_ptr != NULL) &&
- (search_ptr !=
- (struct H5C_cache_entry_t *)entry_ptr))
- {
- search_ptr = search_ptr->next;
- }
+ while ((search_ptr != NULL) && (search_ptr != (struct H5C_cache_entry_t *)entry_ptr)) {
+ search_ptr = search_ptr->next;
+ }
- if(search_ptr == NULL) {
+ if (search_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected insert results 7.";
+ }
+ }
}
- }
- }
- if(pass) {
+ if (pass) {
- /* Verify that unpinned entries are in the LRU list */
- if(!((entry_ptr->header).is_pinned)) {
+ /* Verify that unpinned entries are in the LRU list */
+ if (!((entry_ptr->header).is_pinned)) {
- search_ptr = cache_ptr->LRU_head_ptr;
+ search_ptr = cache_ptr->LRU_head_ptr;
- while((search_ptr != NULL) &&
- (search_ptr !=
- (struct H5C_cache_entry_t *)entry_ptr))
- {
- search_ptr = search_ptr->next;
- }
+ while ((search_ptr != NULL) && (search_ptr != (struct H5C_cache_entry_t *)entry_ptr)) {
+ search_ptr = search_ptr->next;
+ }
- if(search_ptr == NULL) {
+ if (search_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected insert results 8.";
+ }
+ }
}
- }
- }
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- if(pass) {
+ if (pass) {
- /* Verify that unpinned entries are in the dirty LRU list */
- if(!((entry_ptr->header).is_pinned)) {
+ /* Verify that unpinned entries are in the dirty LRU list */
+ if (!((entry_ptr->header).is_pinned)) {
- search_ptr = cache_ptr->dLRU_head_ptr;
+ search_ptr = cache_ptr->dLRU_head_ptr;
- while((search_ptr != NULL) &&
- (search_ptr !=
- (struct H5C_cache_entry_t *)entry_ptr))
- {
- search_ptr = search_ptr->aux_next;
- }
+ while ((search_ptr != NULL) && (search_ptr != (struct H5C_cache_entry_t *)entry_ptr)) {
+ search_ptr = search_ptr->aux_next;
+ }
- if(search_ptr == NULL) {
+ if (search_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected insert results 9.";
+ }
+ }
}
- }
- }
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
- i++;
+ i++;
} /* while */
@@ -3156,32 +2983,23 @@ check_insert_entry(unsigned paged)
* as expected.
*/
- if(pass) {
-
- if ( ( cache_ptr->index_len != 4 ) ||
- ( cache_ptr->index_size != 4 * entry_sizes[entry_type] ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 4 ) ||
- ( cache_ptr->slist_size != 4 * entry_sizes[entry_type] )
- )
- ) ||
- ( cache_ptr->pl_len != 0 ) ||
- ( cache_ptr->pl_size != (size_t)0 ) ||
- ( cache_ptr->pel_len != 2 ) ||
- ( cache_ptr->pel_size != 2 * entry_sizes[entry_type] ) ||
- ( cache_ptr->LRU_list_len != 2 ) ||
- ( cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type] )
+ if (pass) {
+
+ if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * entry_sizes[entry_type]) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 4) || (cache_ptr->slist_size != 4 * entry_sizes[entry_type]))) ||
+ (cache_ptr->pl_len != 0) || (cache_ptr->pl_size != (size_t)0) || (cache_ptr->pel_len != 2) ||
+ (cache_ptr->pel_size != 2 * entry_sizes[entry_type]) || (cache_ptr->LRU_list_len != 2) ||
+ (cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type])
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- ||
- ( cache_ptr->dLRU_list_len != 2 ) ||
- ( cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type] ) ||
- ( cache_ptr->cLRU_list_len != 0 ) ||
- ( cache_ptr->cLRU_list_size != (size_t)0 )
+ || (cache_ptr->dLRU_list_len != 2) ||
+ (cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type]) || (cache_ptr->cLRU_list_len != 0) ||
+ (cache_ptr->cLRU_list_size != (size_t)0)
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
- ) {
+ ) {
- pass = FALSE;
- failure_mssg = "Unexpected insert results 10.";
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 10.";
}
}
@@ -3189,57 +3007,52 @@ check_insert_entry(unsigned paged)
* stats are collected.
*/
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
-
- if ( ( cache_ptr->insertions[entry_type] != 4 ) ||
- ( cache_ptr->pinned_insertions[entry_type] != 2 ) ||
- ( cache_ptr->pins[entry_type] != 2 ) ||
- ( cache_ptr->unpins[entry_type] != 0 ) ||
- ( cache_ptr->dirty_pins[entry_type] != 0 ) ||
- ( cache_ptr->max_index_len != 4 ) ||
- ( cache_ptr->max_index_size != 4 * entry_sizes[entry_type] ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 4 ) ||
- ( cache_ptr->slist_size != 4 * entry_sizes[entry_type] )
- )
- ) ||
- ( cache_ptr->max_pl_len != 0 ) ||
- ( cache_ptr->max_pl_size != (size_t)0 ) ||
- ( cache_ptr->max_pel_len != 2 ) ||
- ( cache_ptr->max_pel_size != 2 * entry_sizes[entry_type] ) ) {
+ if (pass) {
- pass = FALSE;
- failure_mssg = "Unexpected insert results 11.";
+ if ((cache_ptr->insertions[entry_type] != 4) || (cache_ptr->pinned_insertions[entry_type] != 2) ||
+ (cache_ptr->pins[entry_type] != 2) || (cache_ptr->unpins[entry_type] != 0) ||
+ (cache_ptr->dirty_pins[entry_type] != 0) || (cache_ptr->max_index_len != 4) ||
+ (cache_ptr->max_index_size != 4 * entry_sizes[entry_type]) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 4) || (cache_ptr->slist_size != 4 * entry_sizes[entry_type]))) ||
+ (cache_ptr->max_pl_len != 0) || (cache_ptr->max_pl_size != (size_t)0) ||
+ (cache_ptr->max_pel_len != 2) || (cache_ptr->max_pel_size != 2 * entry_sizes[entry_type])) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 11.";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
/* Unpin the pinned entries so we can take down the cache cleanly. */
- if(pass) {
+ if (pass) {
unpin_entry(entry_type, 2);
unpin_entry(entry_type, 3);
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_insert_entry() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_cache()
*
@@ -3259,9 +3072,9 @@ check_insert_entry(unsigned paged)
static unsigned
check_flush_cache(unsigned paged)
{
- H5F_t * file_ptr = NULL;
+ H5F_t *file_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("H5C_flush_cache() functionality (paged aggregation)")
else
TESTING("H5C_flush_cache() functionality")
@@ -3273,7 +3086,7 @@ check_flush_cache(unsigned paged)
* place.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -3284,7 +3097,7 @@ check_flush_cache(unsigned paged)
* checking in this case, so simply check the return values.
*/
- if(pass) {
+ if (pass) {
check_flush_cache__empty_cache(file_ptr);
}
@@ -3293,39 +3106,42 @@ check_flush_cache(unsigned paged)
* Start with a clean entry, with no flags set.
*/
- if(pass) {
+ if (pass) {
check_flush_cache__single_entry(file_ptr);
}
- if(pass) {
+ if (pass) {
check_flush_cache__multi_entry(file_ptr);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__flush_ops(file_ptr);
+ check_flush_cache__flush_ops(file_ptr);
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_flush_cache() */
-
/*-------------------------------------------------------------------------
*
* Function: check_flush_cache__empty_cache()
@@ -3350,51 +3166,47 @@ check_flush_cache(unsigned paged)
*/
static void
-check_flush_cache__empty_cache(H5F_t * file_ptr)
+check_flush_cache__empty_cache(H5F_t *file_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
+ H5C_t *cache_ptr = file_ptr->shared->cache;
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to empty cache case.";
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not empty at beginning of empty cache case.";
}
-
/* Test behaviour on an empty cache. Can't do much sanity
* checking in this case, so simply check the return values.
*
* Check of return values is done in the H5C_FLUSH_CACHE() macro.
*/
- if ( pass ) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, \
- "flush with flags = 0x00 failed on empty cache.\n")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "flush with flags = 0x00 failed on empty cache.\n")
}
- if ( pass ) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG,
"flush with flags = 0x04 failed on empty cache.\n")
}
- if ( pass ) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, \
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG,
"flush with flags = 0x08 failed on empty cache.\n")
}
+ if (pass) {
- if ( pass ) {
-
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG, \
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG,
"flush with flags = 0x10 failed on empty cache.\n")
}
@@ -3402,7 +3214,6 @@ check_flush_cache__empty_cache(H5F_t * file_ptr)
} /* check_flush_cache__empty_cache() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_cache__multi_entry()
*
@@ -3423,874 +3234,679 @@ check_flush_cache__empty_cache(H5F_t * file_ptr)
*/
static void
-check_flush_cache__multi_entry(H5F_t * file_ptr)
+check_flush_cache__multi_entry(H5F_t *file_ptr)
{
H5C_t *cache_ptr = file_ptr->shared->cache;
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to multi entry case.";
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not empty at beginning of multi entry case.";
}
- if(pass)
- {
- int test_num = 1;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- unsigned int spec_size = 8;
- struct flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 2;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- unsigned int spec_size = 8;
- struct flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
-
- check_flush_cache__multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 3;
- unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG;
- unsigned int spec_size = 8;
- struct flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 4;
- unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG;
- unsigned int spec_size = 8;
- struct flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 5;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG;
- unsigned int spec_size = 8;
- struct flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- }
- };
-
- check_flush_cache__multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 6;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG;
+ if (pass) {
+ int test_num = 1;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ unsigned int spec_size = 8;
+ struct flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 2;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ unsigned int spec_size = 8;
+ struct flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 3;
+ unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG;
+ unsigned int spec_size = 8;
+ struct flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 4;
+ unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG;
+ unsigned int spec_size = 8;
+ struct flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 5;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG;
+ unsigned int spec_size = 8;
+ struct flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 6;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG;
unsigned int spec_size = 8;
- struct flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
-
- check_flush_cache__multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 7;
- unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG;
- unsigned int spec_size = 8;
- struct flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 8;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG;
+ struct flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 7;
+ unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG;
unsigned int spec_size = 8;
- struct flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- }
- };
-
- check_flush_cache__multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
+ struct flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 8;
+ unsigned int flush_flags =
+ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG;
+ unsigned int spec_size = 8;
+ struct flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
}
-
/* verify that all other flags are ignored */
- if(pass)
- {
- int test_num = 9;
- unsigned int flush_flags = (unsigned)
- ~(H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG);
- unsigned int spec_size = 8;
- struct flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
+ if (pass) {
+ int test_num = 9;
+ unsigned int flush_flags = (unsigned)~(H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__FLUSH_MARKED_ENTRIES_FLAG);
+ unsigned int spec_size = 8;
+ struct flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
}
/* Now do pinned entry tests:
@@ -4299,664 +3915,508 @@ check_flush_cache__multi_entry(H5F_t * file_ptr)
* of the flush routine to unravel collections of pinned entries.
*/
- if(pass)
- {
- int test_num = 1;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- unsigned int spec_size = 8;
- struct pe_flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 2,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 3,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 4,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 5,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- MONSTER_ENTRY_TYPE,
- -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 6,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- MONSTER_ENTRY_TYPE,
- MONSTER_ENTRY_TYPE,
- -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 7,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- MONSTER_ENTRY_TYPE,
- MONSTER_ENTRY_TYPE,
- MONSTER_ENTRY_TYPE,
- -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, 30, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 2;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- unsigned int spec_size = 8;
- struct pe_flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 2,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 3,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE,
- -1, -1, -1, -1 -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {10, -1, -1, -1 -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 2,
- /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE,
- MONSTER_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {10, 20, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 3,
- /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE,
- MONSTER_ENTRY_TYPE,
- MONSTER_ENTRY_TYPE,
- -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {10, 20, 30, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
-
- check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
- if(pass)
- {
- int test_num = 3;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG;
- unsigned int spec_size = 8;
- struct pe_flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- }
- };
-
- check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 4;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG;
- unsigned int spec_size = 8;
- struct pe_flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* num_pins = */ 4,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 4,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- PICO_ENTRY_TYPE,
- -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
-
- check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
- }
-
-
- if(pass)
- {
- int test_num = 5;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG;
- unsigned int spec_size = 8;
- struct pe_flush_cache_test_spec spec[8] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 0,
- /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 75,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 25,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 30,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ MONSTER_ENTRY_TYPE,
- /* entry_index = */ 40,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
- /* num_pins = */ 1,
- /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE,
- -1, -1, -1, -1, -1, -1, -1},
- /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- }
- };
-
- check_flush_cache__pe_multi_entry_test(file_ptr, test_num,
- flush_flags, spec_size, spec);
+ if (pass) {
+ int test_num = 1;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ unsigned int spec_size = 8;
+ struct pe_flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 2,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 3,
+ /* pin_type[MAX_PINS] = */
+ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 4,
+ /* pin_type[MAX_PINS] = */
+ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 5,
+ /* pin_type[MAX_PINS] = */
+ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1, -1,
+ -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 6,
+ /* pin_type[MAX_PINS] = */
+ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, MONSTER_ENTRY_TYPE,
+ MONSTER_ENTRY_TYPE, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 7,
+ /* pin_type[MAX_PINS] = */
+ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, MONSTER_ENTRY_TYPE,
+ MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, 30, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 2;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ unsigned int spec_size = 8;
+ struct pe_flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 2,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 3,
+ /* pin_type[MAX_PINS] = */
+ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, -1, -1, -1, -1 - 1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {10, -1, -1, -1 - 1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 2,
+ /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {10, 20, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 3,
+ /* pin_type[MAX_PINS] = */
+ {MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, MONSTER_ENTRY_TYPE, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {10, 20, 30, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 3;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG;
+ unsigned int spec_size = 8;
+ struct pe_flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 4;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG;
+ unsigned int spec_size = 8;
+ struct pe_flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* num_pins = */ 4,
+ /* pin_type[MAX_PINS] = */
+ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 4,
+ /* pin_type[MAX_PINS] = */
+ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
+ }
+
+ if (pass) {
+ int test_num = 5;
+ unsigned int flush_flags =
+ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_MARKED_ENTRIES_FLAG;
+ unsigned int spec_size = 8;
+ struct pe_flush_cache_test_spec spec[8] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 0,
+ /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 75,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 25,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 30,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ MONSTER_ENTRY_TYPE,
+ /* entry_index = */ 40,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
+ /* num_pins = */ 1,
+ /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, -1, -1, -1, -1, -1, -1, -1},
+ /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__pe_multi_entry_test(file_ptr, test_num, flush_flags, spec_size, spec);
}
return;
} /* check_flush_cache__multi_entry() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_cache__multi_entry_test()
*
@@ -4979,85 +4439,70 @@ check_flush_cache__multi_entry(H5F_t * file_ptr)
*/
static void
-check_flush_cache__multi_entry_test(H5F_t * file_ptr,
- int test_num,
- unsigned int flush_flags,
- unsigned int spec_size,
- struct flush_cache_test_spec spec[])
+check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags,
+ unsigned int spec_size, struct flush_cache_test_spec spec[])
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
- static char msg[128];
- unsigned u;
- size_t total_entry_size = 0;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
-
-#if 0 /* JRM */
+ H5C_t * cache_ptr = file_ptr->shared->cache;
+ static char msg[128];
+ unsigned u;
+ size_t total_entry_size = 0;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
+
+#if 0 /* JRM */
/* This gets used a lot, so lets leave it in. */
HDfprintf(stdout, "check_flush_cache__multi_entry_test: test %d\n",
test_num);
#endif /* JRM */
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache_ptr NULL on entry to single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache_ptr NULL on entry to single entry test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache not empty at beginning of multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache not empty at beginning of multi entry test #%d.", test_num);
failure_mssg = msg;
}
- else if((spec_size < 1) || (spec == NULL)) {
+ else if ((spec_size < 1) || (spec == NULL)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "missing/bad test spec on entry to multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "missing/bad test spec on entry to multi entry test #%d.", test_num);
failure_mssg = msg;
}
u = 0;
- while ( pass && ( u < spec_size ) ) {
+ while (pass && (u < spec_size)) {
- if ( ( (unsigned)spec[u].entry_num != u ) ||
- ( spec[u].entry_type < 0 ) ||
- ( spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
- ( spec[u].entry_index < 0 ) ||
- ( spec[u].entry_index > max_indices[spec[u].entry_type] ) ) {
+ if (((unsigned)spec[u].entry_num != u) || (spec[u].entry_type < 0) ||
+ (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) ||
+ (spec[u].entry_index > max_indices[spec[u].entry_type])) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "bad data in spec[%u] on entry to multi entry test #%d.",
- u, test_num);
+ HDsnprintf(msg, (size_t)128, "bad data in spec[%u] on entry to multi entry test #%d.", u,
+ test_num);
failure_mssg = msg;
}
u++;
}
u = 0;
- while ( pass && (u < spec_size) ) {
-
- if(spec[u].insert_flag) {
+ while (pass && (u < spec_size)) {
- insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index,
- spec[u].flags);
+ if (spec[u].insert_flag) {
- } else {
+ insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags);
+ }
+ else {
protect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index);
- unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index,
- spec[u].flags);
+ unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags);
}
total_entry_size += entry_sizes[spec[u].entry_type];
@@ -5065,28 +4510,26 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
u++;
}
- if(pass) {
+ if (pass) {
H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n")
- if ( ! pass ) {
+ if (!pass) {
- HDsnprintf(msg, (size_t)128,
- "flush with flags 0x%x failed in multi entry test #%d.",
- flush_flags, test_num);
+ HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in multi entry test #%d.", flush_flags,
+ test_num);
failure_mssg = msg;
}
}
u = 0;
- while(pass && (u < spec_size))
- {
+ while (pass && (u < spec_size)) {
base_addr = entries[spec[u].entry_type];
entry_ptr = &(base_addr[spec[u].entry_index]);
- if((entry_ptr->deserialized != spec[u].expected_deserialized) ||
- (entry_ptr->serialized != spec[u].expected_serialized) ||
- (entry_ptr->destroyed != spec[u].expected_destroyed)) {
+ if ((entry_ptr->deserialized != spec[u].expected_deserialized) ||
+ (entry_ptr->serialized != spec[u].expected_serialized) ||
+ (entry_ptr->destroyed != spec[u].expected_destroyed)) {
#if 0 /* This is useful debugging code. Lets keep it around. */
@@ -5102,68 +4545,49 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
#endif
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Bad status on entry %u after flush in multi entry test #%d.",
- u, test_num);
+ HDsnprintf(msg, (size_t)128, "Bad status on entry %u after flush in multi entry test #%d.", u,
+ test_num);
failure_mssg = msg;
}
u++;
}
- if(pass) {
-
- if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
- &&
- ( ( cache_ptr->index_len != spec_size )
- ||
- ( cache_ptr->index_size != total_entry_size )
- )
- )
- ||
- ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0)
- &&
- ( ( cache_ptr->index_len != 0 )
- ||
- ( cache_ptr->index_size != 0 )
- )
- )
- ) {
+ if (pass) {
+
+ if ((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) &&
+ ((cache_ptr->index_len != spec_size) || (cache_ptr->index_size != total_entry_size))) ||
+ (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) &&
+ ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size after flush in multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected cache len/size after flush in multi entry test #%d.",
+ test_num);
failure_mssg = msg;
}
}
/* clean up the cache to prep for the next test */
- if(pass) {
+ if (pass) {
H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n")
- if ( ! pass ) {
+ if (!pass) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Flush failed on cleanup in multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in multi entry test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size after cleanup in multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected cache len/size after cleanup in multi entry test #%d.",
+ test_num);
failure_mssg = msg;
-
}
}
u = 0;
- while ( pass && ( u < spec_size ) ) {
+ while (pass && (u < spec_size)) {
base_addr = entries[spec[u].entry_type];
entry_ptr = &(base_addr[spec[u].entry_index]);
@@ -5179,7 +4603,6 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
} /* check_flush_cache__multi_entry_test() */
-
/*-------------------------------------------------------------------------
*
* Function: check_flush_cache__pe_multi_entry_test()
@@ -5203,126 +4626,105 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
*/
static void
-check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
- int test_num,
- unsigned int flush_flags,
- unsigned int spec_size,
- struct pe_flush_cache_test_spec spec[])
+check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags,
+ unsigned int spec_size, struct pe_flush_cache_test_spec spec[])
{
- H5C_t *cache_ptr = file_ptr->shared->cache;
- static char msg[128];
- unsigned u;
- int j;
- size_t total_entry_size = 0;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
-
-#if 0 /* JRM */
+ H5C_t * cache_ptr = file_ptr->shared->cache;
+ static char msg[128];
+ unsigned u;
+ int j;
+ size_t total_entry_size = 0;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
+
+#if 0 /* JRM */
/* This is useful debugging code. Leave it in for now. */
HDfprintf(stdout, "check_flush_cache__pe_multi_entry_test: test %d\n",
test_num);
#endif /* JRM */
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache_ptr NULL on entry to pe multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache_ptr NULL on entry to pe multi entry test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache not empty at beginning of pe multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache not empty at beginning of pe multi entry test #%d.", test_num);
failure_mssg = msg;
}
- else if((spec_size < 1) || (spec == NULL)) {
+ else if ((spec_size < 1) || (spec == NULL)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "missing/bad test spec on entry to pe multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "missing/bad test spec on entry to pe multi entry test #%d.", test_num);
failure_mssg = msg;
}
u = 0;
- while ( pass && ( u < spec_size ) ) {
+ while (pass && (u < spec_size)) {
- if ( ( (unsigned)spec[u].entry_num != u ) ||
- ( spec[u].entry_type < 0 ) ||
- ( spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
- ( spec[u].entry_index < 0 ) ||
- ( spec[u].entry_index > max_indices[spec[u].entry_type] ) ||
- ( spec[u].num_pins < 0 ) ||
- ( spec[u].num_pins > MAX_PINS ) ) {
+ if (((unsigned)spec[u].entry_num != u) || (spec[u].entry_type < 0) ||
+ (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) ||
+ (spec[u].entry_index > max_indices[spec[u].entry_type]) || (spec[u].num_pins < 0) ||
+ (spec[u].num_pins > MAX_PINS)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "bad data in spec[%u] on entry to pe multi entry test #%d.",
- u, test_num);
+ HDsnprintf(msg, (size_t)128, "bad data in spec[%u] on entry to pe multi entry test #%d.", u,
+ test_num);
failure_mssg = msg;
}
u++;
}
u = 0;
- while(pass && (u < spec_size))
- {
- if(spec[u].insert_flag) {
+ while (pass && (u < spec_size)) {
+ if (spec[u].insert_flag) {
- insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index,
- spec[u].flags);
-
- } else {
+ insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags);
+ }
+ else {
protect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index);
- unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index,
- spec[u].flags);
+ unprotect_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags);
}
total_entry_size += entry_sizes[spec[u].entry_type];
for (j = 0; j < spec[u].num_pins; j++) {
- create_pinned_entry_dependency(file_ptr,
- spec[u].entry_type,
- spec[u].entry_index,
- spec[u].pin_type[j],
- spec[u].pin_idx[j]);
+ create_pinned_entry_dependency(file_ptr, spec[u].entry_type, spec[u].entry_index,
+ spec[u].pin_type[j], spec[u].pin_idx[j]);
}
u++;
}
- if(pass) {
+ if (pass) {
H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n")
- if ( ! pass ) {
+ if (!pass) {
- HDsnprintf(msg, (size_t)128,
- "flush with flags 0x%x failed in pe multi entry test #%d.",
- flush_flags, test_num);
+ HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in pe multi entry test #%d.",
+ flush_flags, test_num);
failure_mssg = msg;
}
}
u = 0;
- while ( pass && ( u < spec_size ) ) {
+ while (pass && (u < spec_size)) {
base_addr = entries[spec[u].entry_type];
entry_ptr = &(base_addr[spec[u].entry_index]);
- if ( ( entry_ptr->deserialized != spec[u].expected_deserialized ) ||
- ( entry_ptr->serialized != spec[u].expected_serialized ) ||
- ( entry_ptr->destroyed != spec[u].expected_destroyed ) ) {
+ if ((entry_ptr->deserialized != spec[u].expected_deserialized) ||
+ (entry_ptr->serialized != spec[u].expected_serialized) ||
+ (entry_ptr->destroyed != spec[u].expected_destroyed)) {
#if 0 /* This is useful debugging code. Lets keep it around. */
@@ -5338,68 +4740,49 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
#endif
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Bad status on entry %u after flush in pe multi entry test #%d.",
- u, test_num);
+ HDsnprintf(msg, (size_t)128, "Bad status on entry %u after flush in pe multi entry test #%d.", u,
+ test_num);
failure_mssg = msg;
}
u++;
}
- if(pass) {
-
- if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
- &&
- ( ( cache_ptr->index_len != spec_size )
- ||
- ( cache_ptr->index_size != total_entry_size )
- )
- )
- ||
- ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 )
- &&
- ( ( cache_ptr->index_len != 0 )
- ||
- ( cache_ptr->index_size != 0 )
- )
- )
- ) {
+ if (pass) {
+
+ if ((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) &&
+ ((cache_ptr->index_len != spec_size) || (cache_ptr->index_size != total_entry_size))) ||
+ (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) &&
+ ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size after flush in pe multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected cache len/size after flush in pe multi entry test #%d.",
+ test_num);
failure_mssg = msg;
}
}
/* clean up the cache to prep for the next test */
- if ( pass ) {
+ if (pass) {
H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n")
- if ( ! pass ) {
+ if (!pass) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Flush failed on cleanup in pe multi entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in pe multi entry test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size after cleanup in pe multi entry test #%d.",
- test_num);
+ "Unexpected cache len/size after cleanup in pe multi entry test #%d.", test_num);
failure_mssg = msg;
-
}
}
u = 0;
- while ( pass && ( u < spec_size ) ) {
+ while (pass && (u < spec_size)) {
base_addr = entries[spec[u].entry_type];
entry_ptr = &(base_addr[spec[u].entry_index]);
@@ -5415,7 +4798,6 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
} /* check_flush_cache__pe_multi_entry_test() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_cache__flush_ops()
*
@@ -5438,3746 +4820,3172 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
*/
static void
-check_flush_cache__flush_ops(H5F_t * file_ptr)
+check_flush_cache__flush_ops(H5F_t *file_ptr)
{
H5C_t *cache_ptr = file_ptr->shared->cache;
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to flush ops test.";
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not empty at beginning of flush ops test.";
}
- if(pass) /* test #1 */
- {
- /* start with a very simple test, in which there are two entries
- * resident in cache, and the second entry dirties the first in
- * the flush callback. No size changes, and no flush flags.
- */
- int test_num = 1;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 2;
- unsigned init_expected_index_len = 2;
- size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE;
- unsigned expected_index_len = 2;
- size_t expected_index_size = 2 * PICO_ENTRY_SIZE;
- struct fo_flush_cache_test_spec spec[2] =
+ if (pass) /* test #1 */
{
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ 0,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
-
- if(pass) /* test #2 */
- {
- /* Same as test 1, only this time set the flush invalidate flag.
- * Note that we must repeat all tests with the flush invalidate flag
- * as this triggers a different set of code to execute the flush.
- *
- * Create two entries resident in cache, and have the second entry
- * dirty the first in the flush callback.
- */
- int test_num = 2;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- int spec_size = 2;
- unsigned init_expected_index_len = 2;
- size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE;
- unsigned expected_index_len = 0;
- size_t expected_index_size = 0;
- struct fo_flush_cache_test_spec spec[2] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr*/
- { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
-
- if(pass) /* test #3 */
- {
- /* Single entry test verifying that the cache can handle the case in
- * which the call back function resizes the entry for which it has
- * been called.
- */
- int test_num = 3;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4;
- unsigned expected_index_len = 1;
- size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2;
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr:*/
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
-
- if(pass) /* test #4 */
- {
- /* Repeat test #4 with the flush invalidate flag.
- *
- * Single entry test verifying that the cache can handle the case in
- * which the call back function resizes the entry for which it has
- * been called.
- */
- int test_num = 4;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4;
- unsigned expected_index_len = 0;
- size_t expected_index_size = 0;
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
-
- if(pass) /* test #5 & #6 */
- {
- /* Single entry test verifying that the cache can handle the case in
- * which the call back function first resizes and then moves the
- * entry for which it has been called.
- *
- * Run this entry twice, as the first run moves the entry to its
- * alternate address, and the second moves it back.
+ /* start with a very simple test, in which there are two entries
+ * resident in cache, and the second entry dirties the first in
+ * the flush callback. No size changes, and no flush flags.
+ */
+ int test_num = 1;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 2;
+ unsigned init_expected_index_len = 2;
+ size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE;
+ unsigned expected_index_len = 2;
+ size_t expected_index_size = 2 * PICO_ENTRY_SIZE;
+ struct fo_flush_cache_test_spec spec[2] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ 0,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #2 */
+ {
+ /* Same as test 1, only this time set the flush invalidate flag.
+ * Note that we must repeat all tests with the flush invalidate flag
+ * as this triggers a different set of code to execute the flush.
+ *
+ * Create two entries resident in cache, and have the second entry
+ * dirty the first in the flush callback.
+ */
+ int test_num = 2;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ int spec_size = 2;
+ unsigned init_expected_index_len = 2;
+ size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE;
+ unsigned expected_index_len = 0;
+ size_t expected_index_size = 0;
+ struct fo_flush_cache_test_spec spec[2] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr*/
+ {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #3 */
+ {
+ /* Single entry test verifying that the cache can handle the case in
+ * which the call back function resizes the entry for which it has
+ * been called.
+ */
+ int test_num = 3;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4;
+ unsigned expected_index_len = 1;
+ size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2;
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr:*/
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #4 */
+ {
+ /* Repeat test #4 with the flush invalidate flag.
+ *
+ * Single entry test verifying that the cache can handle the case in
+ * which the call back function resizes the entry for which it has
+ * been called.
+ */
+ int test_num = 4;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4;
+ unsigned expected_index_len = 0;
+ size_t expected_index_size = 0;
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #5 & #6 */
+ {
+ /* Single entry test verifying that the cache can handle the case in
+ * which the call back function first resizes and then moves the
+ * entry for which it has been called.
+ *
+ * Run this entry twice, as the first run moves the entry to its
+ * alternate address, and the second moves it back.
*
* 10/8/07 -- JRM
* Added a resize operation to this test to satisfy the new
* requiremnt that any resize of an entry on flush will always
* be accompanied by a resize. Note that as a result, this
* test becomes redundant with later tests.
- */
- int test_num = 5; /* and 6 */
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 1;
- size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2;
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 2,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
+ */
+ int test_num = 5; /* and 6 */
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 1;
+ size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2;
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 2,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+
+ /* this change forces the move to move the target entry back to its
+ * main address. The first test moved it to its alternate address.
+ *
+ * Note that these two tests are not the same, as in the first test,
+ * the moved entry is moved forward in the slist. In the second
+ * it is moved backwards.
+ *
+ * Since there is only one entry in the cache, this doesn't really
+ * matter in this case. But we will do similar tests later with
+ * other entries in the cache.
+ */
+ if (pass) {
+
+ spec[0].flush_ops[1].flag = TRUE;
+ test_num = 6;
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
}
- };
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
-
- /* this change forces the move to move the target entry back to its
- * main address. The first test moved it to its alternate address.
- *
- * Note that these two tests are not the same, as in the first test,
- * the moved entry is moved forward in the slist. In the second
- * it is moved backwards.
- *
- * Since there is only one entry in the cache, this doesn't really
- * matter in this case. But we will do similar tests later with
- * other entries in the cache.
- */
- if(pass) {
-
- spec[0].flush_ops[1].flag = TRUE;
- test_num = 6;
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
- }
-
- if(pass) /* test #7 & #8 */
+ if (pass) /* test #7 & #8 */
{
- /* Run tests 5 & 6 again, using the flush invalidate flag on the
- * second test.
- *
- * Single entry test verifying that the cache can handle the case in
- * which the call back function moves the entry for which it has
- * been called.
- *
- * Run this entry twice, as the first run moves the entry to its
- * alternate address, and the second moves it back.
+ /* Run tests 5 & 6 again, using the flush invalidate flag on the
+ * second test.
+ *
+ * Single entry test verifying that the cache can handle the case in
+ * which the call back function moves the entry for which it has
+ * been called.
+ *
+ * Run this entry twice, as the first run moves the entry to its
+ * alternate address, and the second moves it back.
*
* 10/8/07 -- JRM
* Added a resize operation to this test to satisfy the new
* requiremnt that any resize of an entry on flush will always
* be accompanied by a resize. Note that as a result, this
* test becomes redundant with later tests.
- */
- int test_num = 7; /* and 8 */
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 1;
- size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2;
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 2,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
-
- /* this change forces the move to move the target entry back to its
- * main address. The first test moved it to its alternate address.
- *
- * Note that these two tests are not the same, as in the first test,
- * the moved entry is moved forward in the slist. In the second
- * it is moved backwards.
- *
- * Since there is only one entry in the cache, this doesn't really
- * matter in this case. But we will do similar tests later with
- * other entries in the cache.
- */
-
- if(pass) {
-
- test_num = 8;
- flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- expected_index_len = 0;
- expected_index_size = 0;
- spec[0].flush_ops[1].flag = TRUE;
- spec[0].expected_destroyed = TRUE;
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
- }
-
- if(pass) /* test #9 & #10 */
- {
- /* Single entry test verifying that the cache can handle the case in
- * which the call back function both resizes and moves the entry
- * for which it has been called.
- *
- * Again, we run this entry twice, as the first run moves the entry
- * to its alternate address, and the second moves it back.
- */
- int test_num = 9; /* and 10 */
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2;
- unsigned expected_index_len = 1;
- size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4;
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 2,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
+ */
+ int test_num = 7; /* and 8 */
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 1;
+ size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2;
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 2,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+
+ /* this change forces the move to move the target entry back to its
+ * main address. The first test moved it to its alternate address.
+ *
+ * Note that these two tests are not the same, as in the first test,
+ * the moved entry is moved forward in the slist. In the second
+ * it is moved backwards.
+ *
+ * Since there is only one entry in the cache, this doesn't really
+ * matter in this case. But we will do similar tests later with
+ * other entries in the cache.
+ */
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
-
- /* this change forces the move to move the target entry back to its
- * main address. The first test moved it to its alternate address.
- *
- * Note that these two tests are not the same, as in the first test,
- * the moved entry is moved forward in the slist. In the second
- * it is moved backwards.
- *
- * Since there is only one entry in the cache, this doesn't really
- * matter in this case. But we will do similar tests later with
- * other entries in the cache.
- */
- if(pass) {
-
- spec[0].flush_ops[1].flag = TRUE;
- test_num = 10;
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
- }
-
- if(pass) /* test #11 & #12 */
- {
- /* Repeat the previous test with the flush invalidate flag on the
- * second test.
- *
- * Single entry test verifying that the cache can handle the case in
- * which the call back function both resizes and moves the entry
- * for which it has been called.
- *
- * Again, we run this entry twice, as the first run moves the entry to its
- * alternate address, and the second moves it back.
- */
- int test_num = 11; /* and 12 */
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2;
- unsigned expected_index_len = 1;
- size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4;
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 2,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
+ if (pass) {
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
-
- /* this change forces the move to move the target entry back to its
- * main address. The first test moved it to its alternate address.
- *
- * Note that these two tests are not the same, as in the first test,
- * the moved entry is moved forward in the slist. In the second
- * it is moved backwards.
- *
- * Since there is only one entry in the cache, this doesn't really
- * matter in this case. But we will do similar tests later with
- * other entries in the cache.
- */
- if(pass) {
-
- test_num = 12;
- flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- expected_index_len = 0;
- expected_index_size = 0;
- spec[0].flush_ops[1].flag = TRUE;
- spec[0].expected_destroyed = TRUE;
-
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
- }
-
- if(pass) /* test #13 */
- {
- /* Test the ability of the cache to handle the case in which
- * the flush function of an entry that is resident in cache
- * dirties two entries that are not in cache. No size
- * changes.
- *
- * At present, I am assured that this case will never occur, but
- * lets make sure we can handle it regardless.
- */
- int test_num = 13;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE;
- unsigned expected_index_len = 3;
- size_t expected_index_size = 3 * PICO_ENTRY_SIZE;
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 2,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 2;
- struct fo_flush_entry_check checks[2] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* expected_size = */ PICO_ENTRY_SIZE,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 2,
- /* expected_size = */ PICO_ENTRY_SIZE,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
+ test_num = 8;
+ flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ expected_index_len = 0;
+ expected_index_size = 0;
+ spec[0].flush_ops[1].flag = TRUE;
+ spec[0].expected_destroyed = TRUE;
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
}
- if(pass) /* test #14 */
+ if (pass) /* test #9 & #10 */
{
- /* Repeat previous test with the flush invalidate flag.
- *
- * Test the ability of the cache to handle the case in which
- * the flush function of an entry that is resident in cache
- * dirties two entries that are not in cache. No size
- * changes.
- *
- * At present, I am assured that this case will never occur, but
- * lets make sure we can handle it regardless.
- */
- int test_num = 14;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE;
- unsigned expected_index_len = 0;
- size_t expected_index_size = (size_t)0;
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 2,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
- int check_size = 2;
- struct fo_flush_entry_check checks[2] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* expected_size = */ PICO_ENTRY_SIZE,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 2,
- /* expected_size = */ PICO_ENTRY_SIZE,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
+ /* Single entry test verifying that the cache can handle the case in
+ * which the call back function both resizes and moves the entry
+ * for which it has been called.
+ *
+ * Again, we run this entry twice, as the first run moves the entry
+ * to its alternate address, and the second moves it back.
+ */
+ int test_num = 9; /* and 10 */
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2;
+ unsigned expected_index_len = 1;
+ size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4;
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 2,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+
+ /* this change forces the move to move the target entry back to its
+ * main address. The first test moved it to its alternate address.
+ *
+ * Note that these two tests are not the same, as in the first test,
+ * the moved entry is moved forward in the slist. In the second
+ * it is moved backwards.
+ *
+ * Since there is only one entry in the cache, this doesn't really
+ * matter in this case. But we will do similar tests later with
+ * other entries in the cache.
+ */
+ if (pass) {
+
+ spec[0].flush_ops[1].flag = TRUE;
+ test_num = 10;
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
}
- if(pass) /* test #15 */
+ if (pass) /* test #11 & #12 */
{
- /* Test the ability of the cache to handle the case in which
- * the flush function of an entry that is resident in cache
- * resizes and dirties two entries that are not in cache.
- *
- * At present, I am assured that this case will never occur, but
- * lets make sure we can handle it regardless.
- */
- int test_num = 15;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 3;
- size_t expected_index_size = VARIABLE_ENTRY_SIZE +
- (VARIABLE_ENTRY_SIZE / 4) +
- (VARIABLE_ENTRY_SIZE / 2);
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 4,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 2;
- struct fo_flush_entry_check checks[2] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
+ /* Repeat the previous test with the flush invalidate flag on the
+ * second test.
+ *
+ * Single entry test verifying that the cache can handle the case in
+ * which the call back function both resizes and moves the entry
+ * for which it has been called.
+ *
+ * Again, we run this entry twice, as the first run moves the entry to its
+ * alternate address, and the second moves it back.
+ */
+ int test_num = 11; /* and 12 */
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2;
+ unsigned expected_index_len = 1;
+ size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4;
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 2,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+
+ /* this change forces the move to move the target entry back to its
+ * main address. The first test moved it to its alternate address.
+ *
+ * Note that these two tests are not the same, as in the first test,
+ * the moved entry is moved forward in the slist. In the second
+ * it is moved backwards.
+ *
+ * Since there is only one entry in the cache, this doesn't really
+ * matter in this case. But we will do similar tests later with
+ * other entries in the cache.
+ */
+ if (pass) {
+
+ test_num = 12;
+ flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ expected_index_len = 0;
+ expected_index_size = 0;
+ spec[0].flush_ops[1].flag = TRUE;
+ spec[0].expected_destroyed = TRUE;
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
}
- if(pass) /* test #16 */
- {
- /* Repeat previous test with the flush invalidate flag.
- *
- * Test the ability of the cache to handle the case in which
- * the flush function of an entry that is resident in cache
- * resizes and dirties two entries that are not in cache.
- *
- * At present, I am assured that this case will never occur, but
- * lets make sure we can handle it regardless.
- */
- int test_num = 16;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 0;
- size_t expected_index_size = (size_t)0;
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 4,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
- int check_size = 2;
- struct fo_flush_entry_check checks[2] =
+ if (pass) /* test #13 */
{
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
+ /* Test the ability of the cache to handle the case in which
+ * the flush function of an entry that is resident in cache
+ * dirties two entries that are not in cache. No size
+ * changes.
+ *
+ * At present, I am assured that this case will never occur, but
+ * lets make sure we can handle it regardless.
+ */
+ int test_num = 13;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE;
+ unsigned expected_index_len = 3;
+ size_t expected_index_size = 3 * PICO_ENTRY_SIZE;
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 2,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 2;
+ struct fo_flush_entry_check checks[2] = {{/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* expected_size = */ PICO_ENTRY_SIZE,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 2,
+ /* expected_size = */ PICO_ENTRY_SIZE,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #14 */
+ {
+ /* Repeat previous test with the flush invalidate flag.
+ *
+ * Test the ability of the cache to handle the case in which
+ * the flush function of an entry that is resident in cache
+ * dirties two entries that are not in cache. No size
+ * changes.
+ *
+ * At present, I am assured that this case will never occur, but
+ * lets make sure we can handle it regardless.
+ */
+ int test_num = 14;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE;
+ unsigned expected_index_len = 0;
+ size_t expected_index_size = (size_t)0;
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 2,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+ int check_size = 2;
+ struct fo_flush_entry_check checks[2] = {{/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* expected_size = */ PICO_ENTRY_SIZE,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 2,
+ /* expected_size = */ PICO_ENTRY_SIZE,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #15 */
+ {
+ /* Test the ability of the cache to handle the case in which
+ * the flush function of an entry that is resident in cache
+ * resizes and dirties two entries that are not in cache.
+ *
+ * At present, I am assured that this case will never occur, but
+ * lets make sure we can handle it regardless.
+ */
+ int test_num = 15;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 3;
+ size_t expected_index_size =
+ VARIABLE_ENTRY_SIZE + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2);
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 4,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 2;
+ struct fo_flush_entry_check checks[2] = {{/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #16 */
+ {
+ /* Repeat previous test with the flush invalidate flag.
+ *
+ * Test the ability of the cache to handle the case in which
+ * the flush function of an entry that is resident in cache
+ * resizes and dirties two entries that are not in cache.
+ *
+ * At present, I am assured that this case will never occur, but
+ * lets make sure we can handle it regardless.
+ */
+ int test_num = 16;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 0;
+ size_t expected_index_size = (size_t)0;
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 4,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+ int check_size = 2;
+ struct fo_flush_entry_check checks[2] = {{/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #17 & #18 */
+ {
+ /* Test the ability of the cache to handle the case in which
+ * the flush function of an entry that is resident in cache
+ * resizes, dirties, and moves two entries that are not in cache.
+ *
+ * At present, I am assured that this case will never occur, but
+ * lets make sure we can handle it regardless.
+ */
+ int test_num = 17; /* and 18 */
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 3;
+ size_t expected_index_size =
+ VARIABLE_ENTRY_SIZE + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2);
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 6,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 2;
+ struct fo_flush_entry_check checks[2] = {{/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+
+ /* this change forces the moves to move the target entries back to
+ * their main address. The first test moved them to their alternate
+ * address.
+ *
+ * Note that these two tests are not the same, as in the first test,
+ * the moved entries are moved forward in the slist. In the second
+ * they are moved backwards.
+ */
+ if (pass) {
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
+ test_num = 18;
+ spec[0].flush_ops[2].flag = TRUE;
+ spec[0].flush_ops[5].flag = TRUE;
+ checks[0].at_main_addr = TRUE;
+ checks[1].at_main_addr = TRUE;
- if(pass) /* test #17 & #18 */
- {
- /* Test the ability of the cache to handle the case in which
- * the flush function of an entry that is resident in cache
- * resizes, dirties, and moves two entries that are not in cache.
- *
- * At present, I am assured that this case will never occur, but
- * lets make sure we can handle it regardless.
- */
- int test_num = 17; /* and 18 */
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 3;
- size_t expected_index_size = VARIABLE_ENTRY_SIZE +
- (VARIABLE_ENTRY_SIZE / 4) +
- (VARIABLE_ENTRY_SIZE / 2);
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 6,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 2;
- struct fo_flush_entry_check checks[2] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
}
- };
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
-
- /* this change forces the moves to move the target entries back to
- * their main address. The first test moved them to their alternate
- * address.
- *
- * Note that these two tests are not the same, as in the first test,
- * the moved entries are moved forward in the slist. In the second
- * they are moved backwards.
- */
- if(pass) {
-
- test_num = 18;
- spec[0].flush_ops[2].flag = TRUE;
- spec[0].flush_ops[5].flag = TRUE;
- checks[0].at_main_addr = TRUE;
- checks[1].at_main_addr = TRUE;
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
- }
-
- if(pass) /* test #19 & #20 */
- {
- /* Repeat the above test with the flush invalidate flag on the
- * second test.
- *
- * Test the ability of the cache to handle the case in which
- * the flush function of an entry that is resident in cache
- * resizes, dirties, and moves two entries that are not in cache.
- *
- * At present, I am assured that this case will never occur, but
- * lets make sure we can handle it regardless.
- */
- int test_num = 19; /* and 20 */
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 1;
- unsigned init_expected_index_len = 1;
- size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 3;
- size_t expected_index_size = VARIABLE_ENTRY_SIZE +
- (VARIABLE_ENTRY_SIZE / 4) +
- (VARIABLE_ENTRY_SIZE / 2);
- struct fo_flush_cache_test_spec spec[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 6,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 2;
- struct fo_flush_entry_check checks[2] =
+ if (pass) /* test #19 & #20 */
{
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
+ /* Repeat the above test with the flush invalidate flag on the
+ * second test.
+ *
+ * Test the ability of the cache to handle the case in which
+ * the flush function of an entry that is resident in cache
+ * resizes, dirties, and moves two entries that are not in cache.
+ *
+ * At present, I am assured that this case will never occur, but
+ * lets make sure we can handle it regardless.
+ */
+ int test_num = 19; /* and 20 */
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 1;
+ unsigned init_expected_index_len = 1;
+ size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 3;
+ size_t expected_index_size =
+ VARIABLE_ENTRY_SIZE + (VARIABLE_ENTRY_SIZE / 4) + (VARIABLE_ENTRY_SIZE / 2);
+ struct fo_flush_cache_test_spec spec[1] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 6,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 2;
+ struct fo_flush_entry_check checks[2] = {{/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+
+ /* this change forces the moves to move the target entries back to
+ * their main address. The first test moved them to their alternate
+ * address.
+ *
+ * Note that these two tests are not the same, as in the first test,
+ * the moved entries are moved forward in the slist. In the second
+ * they are moved backwards.
+ */
+ if (pass) {
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
-
- /* this change forces the moves to move the target entries back to
- * their main address. The first test moved them to their alternate
- * address.
- *
- * Note that these two tests are not the same, as in the first test,
- * the moved entries are moved forward in the slist. In the second
- * they are moved backwards.
- */
- if(pass) {
-
- test_num = 20;
- flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- expected_index_len = 0;
- expected_index_size = (size_t)0;
- spec[0].expected_destroyed = TRUE;
- spec[0].flush_ops[2].flag = TRUE;
- spec[0].flush_ops[5].flag = TRUE;
- checks[0].at_main_addr = TRUE;
- checks[0].in_cache = FALSE;
- checks[0].expected_destroyed = TRUE;
- checks[1].at_main_addr = TRUE;
- checks[1].in_cache = FALSE;
- checks[1].expected_destroyed = TRUE;
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
- }
-
- if(pass) /* test #21 */
- {
- /* Now mix things up a bit.
- *
- * Load several entries, two of which have flush functions that
- * resize, dirty, and move two entries that are not in the
- * cache. Mark only one of these entries, and then flush the
- * cache with the flush marked entries flag.
- *
- * This is the only test in which we test the
- * H5C__FLUSH_MARKED_ENTRIES_FLAG. The hope is that since
- * we test the two features extensively by themselves, so
- * it should be sufficient to verify that they play together
- * as expected.
- */
- int test_num = 21;
- unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG;
- int spec_size = 4;
- unsigned init_expected_index_len = 4;
- size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * PICO_ENTRY_SIZE);
- unsigned expected_index_len = 6;
- size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) +
- (VARIABLE_ENTRY_SIZE / 4) +
- (VARIABLE_ENTRY_SIZE / 2) +
- (2 * PICO_ENTRY_SIZE);
- struct fo_flush_cache_test_spec spec[4] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 6,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 11,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 6,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 4;
- struct fo_flush_entry_check checks[4] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ TRUE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ TRUE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* expected_size = */ VARIABLE_ENTRY_SIZE,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 12,
- /* expected_size = */ VARIABLE_ENTRY_SIZE,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
+ test_num = 20;
+ flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ expected_index_len = 0;
+ expected_index_size = (size_t)0;
+ spec[0].expected_destroyed = TRUE;
+ spec[0].flush_ops[2].flag = TRUE;
+ spec[0].flush_ops[5].flag = TRUE;
+ checks[0].at_main_addr = TRUE;
+ checks[0].in_cache = FALSE;
+ checks[0].expected_destroyed = TRUE;
+ checks[1].at_main_addr = TRUE;
+ checks[1].in_cache = FALSE;
+ checks[1].expected_destroyed = TRUE;
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- reset_entries();
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
}
- if(pass) /* test #22 */
- {
- /* Mix things up some more.
- *
- * Load lots of entries, some of which have flush functions that
- * resize, dirty, and move two entries that are not in the
- * cache.
- *
- * Also load entries that have flush ops on entries that are in
- * cache.
- */
- int test_num = 22;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 6;
- unsigned init_expected_index_len = 6;
- size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE);
- unsigned expected_index_len = 10;
- size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) +
- (2 * (VARIABLE_ENTRY_SIZE / 4)) +
- (2 * (VARIABLE_ENTRY_SIZE / 2)) +
- (4 * PICO_ENTRY_SIZE);
- struct fo_flush_cache_test_spec spec[6] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 6,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 11,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 6,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 4;
- struct fo_flush_entry_check checks[4] =
- {
+ if (pass) /* test #21 */
{
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 12,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- reset_entries();
+ /* Now mix things up a bit.
+ *
+ * Load several entries, two of which have flush functions that
+ * resize, dirty, and move two entries that are not in the
+ * cache. Mark only one of these entries, and then flush the
+ * cache with the flush marked entries flag.
+ *
+ * This is the only test in which we test the
+ * H5C__FLUSH_MARKED_ENTRIES_FLAG. The hope is that since
+ * we test the two features extensively by themselves, so
+ * it should be sufficient to verify that they play together
+ * as expected.
+ */
+ int test_num = 21;
+ unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG;
+ int spec_size = 4;
+ unsigned init_expected_index_len = 4;
+ size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * PICO_ENTRY_SIZE);
+ unsigned expected_index_len = 6;
+ size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (VARIABLE_ENTRY_SIZE / 4) +
+ (VARIABLE_ENTRY_SIZE / 2) + (2 * PICO_ENTRY_SIZE);
+ struct fo_flush_cache_test_spec spec[4] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 6,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 11,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 6,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 4;
+ struct fo_flush_entry_check checks[4] = {{/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ TRUE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ TRUE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 12,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ reset_entries();
}
- if(pass) /* test #23 */
- {
- /* Repeat test #23 with the flush invalidate flag set.
- *
- * Mix things up some more.
- *
- * Load lots of entries, some of which have flush functions that
- * resize, dirty, and move two entries that are not in the
- * cache.
- *
- * Also load entries that have flush ops on entries that are in
- * cache.
- */
- int test_num = 23;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- int spec_size = 6;
- unsigned init_expected_index_len = 6;
- size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE);
- unsigned expected_index_len = 0;
- size_t expected_index_size = 0;
- struct fo_flush_cache_test_spec spec[6] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 6,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 11,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 6,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 1,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 20,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
- int check_size = 4;
- struct fo_flush_entry_check checks[4] =
- {
+ if (pass) /* test #22 */
{
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 0,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 10,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 12,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
+ /* Mix things up some more.
+ *
+ * Load lots of entries, some of which have flush functions that
+ * resize, dirty, and move two entries that are not in the
+ * cache.
+ *
+ * Also load entries that have flush ops on entries that are in
+ * cache.
+ */
+ int test_num = 22;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 6;
+ unsigned init_expected_index_len = 6;
+ size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE);
+ unsigned expected_index_len = 10;
+ size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * (VARIABLE_ENTRY_SIZE / 4)) +
+ (2 * (VARIABLE_ENTRY_SIZE / 2)) + (4 * PICO_ENTRY_SIZE);
+ struct fo_flush_cache_test_spec spec[6] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 6,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 11,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 6,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 4;
+ struct fo_flush_entry_check checks[4] = {{/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 12,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ reset_entries();
}
- };
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- reset_entries();
+ if (pass) /* test #23 */
+ {
+ /* Repeat test #23 with the flush invalidate flag set.
+ *
+ * Mix things up some more.
+ *
+ * Load lots of entries, some of which have flush functions that
+ * resize, dirty, and move two entries that are not in the
+ * cache.
+ *
+ * Also load entries that have flush ops on entries that are in
+ * cache.
+ */
+ int test_num = 23;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ int spec_size = 6;
+ unsigned init_expected_index_len = 6;
+ size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE);
+ unsigned expected_index_len = 0;
+ size_t expected_index_size = 0;
+ struct fo_flush_cache_test_spec spec[6] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 6,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 11,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 6,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 1,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 20,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+ int check_size = 4;
+ struct fo_flush_entry_check checks[4] = {{/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 0,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 10,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 12,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ reset_entries();
}
/* So much for tests involving only flush operations.
*
* Now create some tests mixing flush ops and pins.
*/
- if(pass) /* test #24 */
- {
- /* Pico entries 50 and 150 pin pico entry 100, and also dirty
- * pico entry 100 on flush.
- */
- int test_num = 24;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 3;
- unsigned init_expected_index_len = 3;
- size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE;
- unsigned expected_index_len = 3;
- size_t expected_index_size = 3 * PICO_ENTRY_SIZE;
- struct fo_flush_cache_test_spec spec[3] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 1,
- /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 150,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 1,
- /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL },
- { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
-
- if(pass) /* test #25 */
- {
- /* Repeat the previous test with the flush invalidate flag.
- *
- * Pico entries 50 and 150 pin pico entry 100, and also dirty
- * pico entry 100 on flush.
- */
- int test_num = 25;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- int spec_size = 3;
- unsigned init_expected_index_len = 3;
- size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE;
- unsigned expected_index_len = 0;
- size_t expected_index_size = (size_t)0;
- struct fo_flush_cache_test_spec spec[3] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 50,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 1,
- /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ PICO_ENTRY_TYPE,
- /* entry_index = */ 150,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 1,
- /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 1,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL },
- { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ (size_t)0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
- }
-
- if(pass) /* test #26 */
- {
- /* This one is complex.
- *
- * In the following overvies table, VET stands for
- * VARIABLE_ENTRY_TYPE.
- *
- * In trying to follow what happens when we flush the
- * set of entries constructed below, recall that each
- * flush operation is executed the first time the
- * entry is flushed, and then not executed again.
- * This may be a weakness in the tests, but that
- * is the way it is for now.
- *
- * After thinking about it for a while, I'm not sure that
- * the interaction between pins and flush operations needs
- * all that much testing, as the two are essentially
- * orthoginal. Thus this is a bit of a smoke check to
- * verify that we get the expected results.
- *
- * (VET, 100) initially not resident in cache
- *
- * (VET, 200) initially clean and resident in cache
- *
- * (VET, 300) initially not resident in cache
- *
- * (VET, 2100) initially clean and resident in cache
- *
- * (VET, 2200) initially not resident in cache
- *
- * (VET, 2300) initially clean and resident in cache
- *
- * (VET, 1000) initially clean, and in cache
- * dirties (VET, 100)
- * resizes (VET, 200)
- * dirty (VET, 300) -- dirty first to bring into cache.
- * moves (VET, 300)
- *
- * (VET, 2000) initially clean, and in cache
- * dirties (VET, 2100)
- * resizes (VET, 2200)
- * moves (VET, 2300)
- *
- * (VET, 350) initially clean, and in cache
- * pins (VET, 1000)
- * dirties (VET, 1000)
- * resizes (VET, 350)
- * pins (VET, 2000)
- * dirties (VET, 2000)
- *
- * (VET, 450) initially dirty, and in cache
- * pins (VET, 1000)
- * dirties (VET, 1000)
- * moves (VET, 450)
- * pins (VET, 2000)
- * dirties (VET, 2000)
- *
- * (VET, 650) initially clean, and in cache
- * pins (VET, 1000)
- * dirties (VET, 1000)
- * resizes (VET, 650)
- * pins (VET, 2000)
- * dirties (VET, 2000)
- *
- * (VET, 750) initially dirty, and in cache
- * pins (VET, 1000)
- * dirties (VET, 1000)
- * resizes (VET, 750)
- * pins (VET, 2000)
- * dirties (VET, 2000)
- *
- * (VET, 500) initially dirty, and in cache
- * dirties (VET, 350)
- * dirties (VET, 450)
- * dirties (VET, 650)
- * dirties (VET, 750)
- */
- int test_num = 26;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 10;
- unsigned init_expected_index_len = 10;
- size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 13;
- size_t expected_index_size = 9 * VARIABLE_ENTRY_SIZE;
- struct fo_flush_cache_test_spec spec[10] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 200,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2300,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 1000,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 4,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
+ if (pass) /* test #24 */
{
- /* entry_num = */ 4,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2000,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 350,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 2,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 450,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 2,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 650,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 2,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 8,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 750,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 2,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 9,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 500,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 4,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 3;
- struct fo_flush_entry_check checks[3] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* expected_size = */ VARIABLE_ENTRY_SIZE,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 300,
- /* expected_size = */ VARIABLE_ENTRY_SIZE,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2200,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ TRUE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
+ /* Pico entries 50 and 150 pin pico entry 100, and also dirty
+ * pico entry 100 on flush.
+ */
+ int test_num = 24;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 3;
+ unsigned init_expected_index_len = 3;
+ size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE;
+ unsigned expected_index_len = 3;
+ size_t expected_index_size = 3 * PICO_ENTRY_SIZE;
+ struct fo_flush_cache_test_spec spec[3] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 1,
+ /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 150,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 1,
+ /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #25 */
+ {
+ /* Repeat the previous test with the flush invalidate flag.
+ *
+ * Pico entries 50 and 150 pin pico entry 100, and also dirty
+ * pico entry 100 on flush.
+ */
+ int test_num = 25;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ int spec_size = 3;
+ unsigned init_expected_index_len = 3;
+ size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE;
+ unsigned expected_index_len = 0;
+ size_t expected_index_size = (size_t)0;
+ struct fo_flush_cache_test_spec spec[3] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 50,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 1,
+ /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ PICO_ENTRY_TYPE,
+ /* entry_index = */ 150,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 1,
+ /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 1,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ (size_t)0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
+ }
+
+ if (pass) /* test #26 */
+ {
+ /* This one is complex.
+ *
+ * In the following overvies table, VET stands for
+ * VARIABLE_ENTRY_TYPE.
+ *
+ * In trying to follow what happens when we flush the
+ * set of entries constructed below, recall that each
+ * flush operation is executed the first time the
+ * entry is flushed, and then not executed again.
+ * This may be a weakness in the tests, but that
+ * is the way it is for now.
+ *
+ * After thinking about it for a while, I'm not sure that
+ * the interaction between pins and flush operations needs
+ * all that much testing, as the two are essentially
+ * orthoginal. Thus this is a bit of a smoke check to
+ * verify that we get the expected results.
+ *
+ * (VET, 100) initially not resident in cache
+ *
+ * (VET, 200) initially clean and resident in cache
+ *
+ * (VET, 300) initially not resident in cache
+ *
+ * (VET, 2100) initially clean and resident in cache
+ *
+ * (VET, 2200) initially not resident in cache
+ *
+ * (VET, 2300) initially clean and resident in cache
+ *
+ * (VET, 1000) initially clean, and in cache
+ * dirties (VET, 100)
+ * resizes (VET, 200)
+ * dirty (VET, 300) -- dirty first to bring into cache.
+ * moves (VET, 300)
+ *
+ * (VET, 2000) initially clean, and in cache
+ * dirties (VET, 2100)
+ * resizes (VET, 2200)
+ * moves (VET, 2300)
+ *
+ * (VET, 350) initially clean, and in cache
+ * pins (VET, 1000)
+ * dirties (VET, 1000)
+ * resizes (VET, 350)
+ * pins (VET, 2000)
+ * dirties (VET, 2000)
+ *
+ * (VET, 450) initially dirty, and in cache
+ * pins (VET, 1000)
+ * dirties (VET, 1000)
+ * moves (VET, 450)
+ * pins (VET, 2000)
+ * dirties (VET, 2000)
+ *
+ * (VET, 650) initially clean, and in cache
+ * pins (VET, 1000)
+ * dirties (VET, 1000)
+ * resizes (VET, 650)
+ * pins (VET, 2000)
+ * dirties (VET, 2000)
+ *
+ * (VET, 750) initially dirty, and in cache
+ * pins (VET, 1000)
+ * dirties (VET, 1000)
+ * resizes (VET, 750)
+ * pins (VET, 2000)
+ * dirties (VET, 2000)
+ *
+ * (VET, 500) initially dirty, and in cache
+ * dirties (VET, 350)
+ * dirties (VET, 450)
+ * dirties (VET, 650)
+ * dirties (VET, 750)
+ */
+ int test_num = 26;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 10;
+ unsigned init_expected_index_len = 10;
+ size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 13;
+ size_t expected_index_size = 9 * VARIABLE_ENTRY_SIZE;
+ struct fo_flush_cache_test_spec spec[10] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 200,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2300,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 1000,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 4,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2000,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 350,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 2,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 450,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 2,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 650,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 2,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 8,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 750,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 2,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 9,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 500,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 4,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 3;
+ struct fo_flush_entry_check checks[3] = {{/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 300,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2200,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ TRUE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}
- };
+ };
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
- reset_entries();
+ reset_entries();
}
- if(pass) /* test #27 */
- {
- /* Repeat test #26 with the flush invalidate flag.
- *
- * In the following overview table, VET stands for
- * VARIABLE_ENTRY_TYPE.
- *
- * In trying to follow what happens when we flush the
- * set of entries constructed below, recall that each
- * flush operation is executed the first time the
- * entry is flushed, and then not executed again.
- * This may be a weakness in the tests, but that
- * is the way it is for now.
- *
- * After thinking about it for a while, I'm not sure that
- * the interaction between pins and flush operations needs
- * all that much testing, as the two are essentially
- * orthoginal. The big thing is to verify that flushes of
- * pinned entries with flush ops result in the expected
- * updates of the cache.
- *
- * Thus this is a bit of a smoke check to * verify that we
- * get the expected results.
- *
- * (VET, 100) initially not resident in cache
- *
- * (VET, 200) initially clean and resident in cache
- *
- * (VET, 300) initially not resident in cache
- *
- * (VET, 2100) initially clean and resident in cache
- *
- * (VET, 2200) initially not resident in cache
- *
- * (VET, 2300) initially clean and resident in cache
- *
- * (VET, 1000) initially clean, and in cache
- * dirties (VET, 100)
- * resizes (VET, 200)
- * dirty (VET, 300) -- dirty first to bring into cache.
- * moves (VET, 300)
- *
- * (VET, 2000) initially clean, and in cache
- * dirties (VET, 2100)
- * resizes (VET, 2200)
- * moves (VET, 2300)
- *
- * (VET, 350) initially clean, and in cache
- * pins (VET, 1000)
- * dirties (VET, 1000)
- * resizes (VET, 350)
- * pins (VET, 2000)
- * dirties (VET, 2000)
- *
- * (VET, 450) initially dirty, and in cache
- * pins (VET, 1000)
- * dirties (VET, 1000)
- * moves (VET, 450)
- * pins (VET, 2000)
- * dirties (VET, 2000)
- *
- * (VET, 650) initially clean, and in cache
- * pins (VET, 1000)
- * dirties (VET, 1000)
- * resizes (VET, 650)
- * pins (VET, 2000)
- * dirties (VET, 2000)
- *
- * (VET, 750) initially dirty, and in cache
- * pins (VET, 1000)
- * dirties (VET, 1000)
- * resizes (VET, 750)
- * pins (VET, 2000)
- * dirties (VET, 2000)
- *
- * (VET, 500) initially dirty, and in cache
- * dirties (VET, 350)
- * dirties (VET, 450)
- * dirties (VET, 650)
- * dirties (VET, 750)
- */
- int test_num = 27;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- int spec_size = 10;
- unsigned init_expected_index_len = 10;
- size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 0;
- size_t expected_index_size = (size_t)0;
- struct fo_flush_cache_test_spec spec[10] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 200,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2300,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 1000,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 4,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2000,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 5,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 350,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 2,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 6,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 450,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 2,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 7,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 650,
- /* insert_flag = */ TRUE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 2,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 8,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 750,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 2,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
+ if (pass) /* test #27 */
{
- /* entry_num = */ 9,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 500,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 4,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL },
- { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
- int check_size = 3;
- struct fo_flush_entry_check checks[3] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* expected_size = */ VARIABLE_ENTRY_SIZE,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 300,
- /* expected_size = */ VARIABLE_ENTRY_SIZE,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 2200,
- /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ TRUE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
+ /* Repeat test #26 with the flush invalidate flag.
+ *
+ * In the following overview table, VET stands for
+ * VARIABLE_ENTRY_TYPE.
+ *
+ * In trying to follow what happens when we flush the
+ * set of entries constructed below, recall that each
+ * flush operation is executed the first time the
+ * entry is flushed, and then not executed again.
+ * This may be a weakness in the tests, but that
+ * is the way it is for now.
+ *
+ * After thinking about it for a while, I'm not sure that
+ * the interaction between pins and flush operations needs
+ * all that much testing, as the two are essentially
+ * orthoginal. The big thing is to verify that flushes of
+ * pinned entries with flush ops result in the expected
+ * updates of the cache.
+ *
+ * Thus this is a bit of a smoke check to * verify that we
+ * get the expected results.
+ *
+ * (VET, 100) initially not resident in cache
+ *
+ * (VET, 200) initially clean and resident in cache
+ *
+ * (VET, 300) initially not resident in cache
+ *
+ * (VET, 2100) initially clean and resident in cache
+ *
+ * (VET, 2200) initially not resident in cache
+ *
+ * (VET, 2300) initially clean and resident in cache
+ *
+ * (VET, 1000) initially clean, and in cache
+ * dirties (VET, 100)
+ * resizes (VET, 200)
+ * dirty (VET, 300) -- dirty first to bring into cache.
+ * moves (VET, 300)
+ *
+ * (VET, 2000) initially clean, and in cache
+ * dirties (VET, 2100)
+ * resizes (VET, 2200)
+ * moves (VET, 2300)
+ *
+ * (VET, 350) initially clean, and in cache
+ * pins (VET, 1000)
+ * dirties (VET, 1000)
+ * resizes (VET, 350)
+ * pins (VET, 2000)
+ * dirties (VET, 2000)
+ *
+ * (VET, 450) initially dirty, and in cache
+ * pins (VET, 1000)
+ * dirties (VET, 1000)
+ * moves (VET, 450)
+ * pins (VET, 2000)
+ * dirties (VET, 2000)
+ *
+ * (VET, 650) initially clean, and in cache
+ * pins (VET, 1000)
+ * dirties (VET, 1000)
+ * resizes (VET, 650)
+ * pins (VET, 2000)
+ * dirties (VET, 2000)
+ *
+ * (VET, 750) initially dirty, and in cache
+ * pins (VET, 1000)
+ * dirties (VET, 1000)
+ * resizes (VET, 750)
+ * pins (VET, 2000)
+ * dirties (VET, 2000)
+ *
+ * (VET, 500) initially dirty, and in cache
+ * dirties (VET, 350)
+ * dirties (VET, 450)
+ * dirties (VET, 650)
+ * dirties (VET, 750)
+ */
+ int test_num = 27;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ int spec_size = 10;
+ unsigned init_expected_index_len = 10;
+ size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 0;
+ size_t expected_index_size = (size_t)0;
+ struct fo_flush_cache_test_spec spec[10] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 200,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2300,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 1000,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 4,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2000,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 5,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 350,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 2,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 6,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 450,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 2,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 7,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 650,
+ /* insert_flag = */ TRUE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 2,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 8,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 750,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 2,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 9,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 500,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 4,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL},
+ {FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+ int check_size = 3;
+ struct fo_flush_entry_check checks[3] = {{/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 300,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 2200,
+ /* expected_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ TRUE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}
- };
+ };
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
- reset_entries();
+ reset_entries();
}
- if(pass) /* test #28 */
- {
- /* Test the expected fheap case, in which an entry dirties
- * and resizes itself, and dirties an entry which it has
- * pinned.
- */
- int test_num = 28;
- unsigned int flush_flags = H5C__NO_FLAGS_SET;
- int spec_size = 5;
- unsigned init_expected_index_len = 5;
- size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 5;
- size_t expected_index_size = 4 * VARIABLE_ENTRY_SIZE;
- struct fo_flush_cache_test_spec spec[5] =
+ if (pass) /* test #28 */
{
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 200,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* num_pins = */ 1,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 300,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* num_pins = */ 1,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 400,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 500,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* num_pins = */ 1,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ FALSE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ 0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
+ /* Test the expected fheap case, in which an entry dirties
+ * and resizes itself, and dirties an entry which it has
+ * pinned.
+ */
+ int test_num = 28;
+ unsigned int flush_flags = H5C__NO_FLAGS_SET;
+ int spec_size = 5;
+ unsigned init_expected_index_len = 5;
+ size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 5;
+ size_t expected_index_size = 4 * VARIABLE_ENTRY_SIZE;
+ struct fo_flush_cache_test_spec spec[5] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 200,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* num_pins = */ 1,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 300,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* num_pins = */ 1,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 400,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 500,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* num_pins = */ 1,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ FALSE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ 0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
- reset_entries();
+ reset_entries();
}
- if(pass) /* test #29 */
- {
- /* Repeat test #28 with the flush invalidate flag.
- *
- * Test the expected fheap case, in which an entry dirties
- * and resizes itself, and dirties an entry which it has
- * pinned.
- */
- int test_num = 29;
- unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
- int spec_size = 5;
- unsigned init_expected_index_len = 5;
- size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE;
- unsigned expected_index_len = 0;
- size_t expected_index_size = 0;
- struct fo_flush_cache_test_spec spec[5] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 100,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
+ if (pass) /* test #29 */
{
- /* entry_num = */ 1,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 200,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 2,
- /* num_pins = */ 1,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 2,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 300,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* num_pins = */ 1,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 3,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 400,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__NO_FLAGS_SET,
- /* resize_flag = */ FALSE,
- /* new_size = */ 0,
- /* num_pins = */ 0,
- /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 0,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- },
- {
- /* entry_num = */ 4,
- /* entry_type = */ VARIABLE_ENTRY_TYPE,
- /* entry_index = */ 500,
- /* insert_flag = */ FALSE,
- /* flags = */ H5C__DIRTIED_FLAG,
- /* resize_flag = */ TRUE,
- /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
- /* num_pins = */ 1,
- /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
- /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
- /* num_flush_ops = */ 3,
- /* flush_ops = */
- /* op_code: type: idx: flag: size: order_ptr: */
- { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL },
- { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL },
- { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL },
- { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } },
- /* expected_deserialized = */ TRUE,
- /* expected_serialized = */ TRUE,
- /* expected_destroyed = */ TRUE
- }
- };
- int check_size = 0;
- struct fo_flush_entry_check checks[1] =
- {
- {
- /* entry_num = */ 0,
- /* entry_type = */ 0,
- /* entry_index = */ 0,
- /* expected_size = */ 0,
- /* in_cache = */ FALSE,
- /* at_main_addr = */ FALSE,
- /* is_dirty = */ FALSE,
- /* is_protected = */ FALSE,
- /* is_pinned = */ FALSE,
- /* expected_deserialized = */ FALSE,
- /* expected_serialized = */ FALSE,
- /* expected_destroyed = */ FALSE
- }
- };
-
- check_flush_cache__flush_op_test(file_ptr,
- test_num,
- flush_flags,
- spec_size,
- spec,
- init_expected_index_len,
- init_expected_index_size,
- expected_index_len,
- expected_index_size,
- check_size,
- checks);
+ /* Repeat test #28 with the flush invalidate flag.
+ *
+ * Test the expected fheap case, in which an entry dirties
+ * and resizes itself, and dirties an entry which it has
+ * pinned.
+ */
+ int test_num = 29;
+ unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
+ int spec_size = 5;
+ unsigned init_expected_index_len = 5;
+ size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE;
+ unsigned expected_index_len = 0;
+ size_t expected_index_size = 0;
+ struct fo_flush_cache_test_spec spec[5] = {
+ {/* entry_num = */ 0,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 100,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 1,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 200,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 2,
+ /* num_pins = */ 1,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 2,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 300,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* num_pins = */ 1,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 3,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 400,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__NO_FLAGS_SET,
+ /* resize_flag = */ FALSE,
+ /* new_size = */ 0,
+ /* num_pins = */ 0,
+ /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 0,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE},
+ {/* entry_num = */ 4,
+ /* entry_type = */ VARIABLE_ENTRY_TYPE,
+ /* entry_index = */ 500,
+ /* insert_flag = */ FALSE,
+ /* flags = */ H5C__DIRTIED_FLAG,
+ /* resize_flag = */ TRUE,
+ /* new_size = */ VARIABLE_ENTRY_SIZE / 4,
+ /* num_pins = */ 1,
+ /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0},
+ /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0},
+ /* num_flush_ops = */ 3,
+ /* flush_ops = */
+ /* op_code: type: idx: flag: size: order_ptr: */
+ {{FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL},
+ {FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL},
+ {FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL},
+ {FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL}},
+ /* expected_deserialized = */ TRUE,
+ /* expected_serialized = */ TRUE,
+ /* expected_destroyed = */ TRUE}};
+ int check_size = 0;
+ struct fo_flush_entry_check checks[1] = {{/* entry_num = */ 0,
+ /* entry_type = */ 0,
+ /* entry_index = */ 0,
+ /* expected_size = */ 0,
+ /* in_cache = */ FALSE,
+ /* at_main_addr = */ FALSE,
+ /* is_dirty = */ FALSE,
+ /* is_protected = */ FALSE,
+ /* is_pinned = */ FALSE,
+ /* expected_deserialized = */ FALSE,
+ /* expected_serialized = */ FALSE,
+ /* expected_destroyed = */ FALSE}};
+
+ check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec,
+ init_expected_index_len, init_expected_index_size,
+ expected_index_len, expected_index_size, check_size, checks);
- reset_entries();
+ reset_entries();
}
/* finally finish up with the flush ops eviction test */
@@ -9187,7 +7995,6 @@ check_flush_cache__flush_ops(H5F_t * file_ptr)
} /* check_flush_cache__flush_ops() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_cache__flush_op_test()
*
@@ -9211,201 +8018,154 @@ check_flush_cache__flush_ops(H5F_t * file_ptr)
*/
static void
-check_flush_cache__flush_op_test(H5F_t * file_ptr,
- int test_num,
- unsigned int flush_flags,
- int spec_size,
+check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flush_flags, int spec_size,
const struct fo_flush_cache_test_spec spec[],
- unsigned init_expected_index_len,
- size_t init_expected_index_size,
- unsigned expected_index_len,
- size_t expected_index_size,
- int check_size,
+ unsigned init_expected_index_len, size_t init_expected_index_size,
+ unsigned expected_index_len, size_t expected_index_size, int check_size,
struct fo_flush_entry_check check[])
{
H5C_t * cache_ptr = file_ptr->shared->cache;
- static char msg[128];
- int i;
- int j;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ static char msg[128];
+ int i;
+ int j;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
#if 0 /* This is useful debugging code -- lets keep it around. */
HDfprintf(stdout, "check_flush_cache__flush_op_test: test %d\n",
test_num);
#endif
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache_ptr NULL on entry to flush op test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache_ptr NULL on entry to flush op test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache not empty at beginning of flush op test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache not empty at beginning of flush op test #%d.", test_num);
failure_mssg = msg;
}
- else if((spec_size < 1) || (spec == NULL)) {
+ else if ((spec_size < 1) || (spec == NULL)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "missing/bad test spec on entry to flush op test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "missing/bad test spec on entry to flush op test #%d.", test_num);
failure_mssg = msg;
}
i = 0;
- while ( pass && ( i < spec_size ) ) {
-
- if ( ( spec[i].entry_num != i ) ||
- ( spec[i].entry_type < 0 ) ||
- ( spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
- ( spec[i].entry_index < 0 ) ||
- ( spec[i].entry_index > max_indices[spec[i].entry_type] ) ||
- ( spec[i].num_pins < 0 ) ||
- ( spec[i].num_pins > MAX_PINS ) ||
- ( spec[i].num_flush_ops < 0 ) ||
- ( spec[i].num_flush_ops > MAX_FLUSH_OPS ) ) {
+ while (pass && (i < spec_size)) {
+
+ if ((spec[i].entry_num != i) || (spec[i].entry_type < 0) ||
+ (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[i].entry_index < 0) ||
+ (spec[i].entry_index > max_indices[spec[i].entry_type]) || (spec[i].num_pins < 0) ||
+ (spec[i].num_pins > MAX_PINS) || (spec[i].num_flush_ops < 0) ||
+ (spec[i].num_flush_ops > MAX_FLUSH_OPS)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "bad data in spec[%d] on entry to flush op test #%d.",
- i, test_num);
+ HDsnprintf(msg, (size_t)128, "bad data in spec[%d] on entry to flush op test #%d.", i, test_num);
failure_mssg = msg;
}
i++;
}
i = 0;
- while ( pass && ( i < check_size ) ) {
+ while (pass && (i < check_size)) {
- if ( ( check[i].entry_num != i) ||
- ( check[i].entry_type < 0) ||
- ( check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) ||
- ( check[i].entry_index < 0) ||
- ( check[i].entry_index > max_indices[check[i].entry_type]) ||
+ if ((check[i].entry_num != i) || (check[i].entry_type < 0) ||
+ (check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (check[i].entry_index < 0) ||
+ (check[i].entry_index > max_indices[check[i].entry_type]) ||
#ifndef H5_HAVE_STDBOOL_H
- /* Check for nonsense values if hbool_t is an integral
- * type instead of a real Boolean.
- */
- ( ( check[i].in_cache != TRUE ) &&
- ( check[i].in_cache != FALSE ) ) ||
- ( ( check[i].at_main_addr != TRUE ) &&
- ( check[i].at_main_addr != FALSE ) ) ||
- ( ( check[i].is_dirty != TRUE ) &&
- ( check[i].is_dirty != FALSE ) ) ||
- ( ( check[i].is_protected != TRUE ) &&
- ( check[i].is_protected != FALSE ) ) ||
- ( ( check[i].is_pinned != TRUE ) &&
- ( check[i].is_pinned != FALSE ) ) ||
- ( ( check[i].expected_deserialized != TRUE ) &&
- ( check[i].expected_deserialized != FALSE ) ) ||
- ( ( check[i].expected_serialized != TRUE ) &&
- ( check[i].expected_serialized != FALSE ) ) ||
- ( ( check[i].expected_destroyed != TRUE ) &&
- ( check[i].expected_destroyed != FALSE ) ) ||
+ /* Check for nonsense values if hbool_t is an integral
+ * type instead of a real Boolean.
+ */
+ ((check[i].in_cache != TRUE) && (check[i].in_cache != FALSE)) ||
+ ((check[i].at_main_addr != TRUE) && (check[i].at_main_addr != FALSE)) ||
+ ((check[i].is_dirty != TRUE) && (check[i].is_dirty != FALSE)) ||
+ ((check[i].is_protected != TRUE) && (check[i].is_protected != FALSE)) ||
+ ((check[i].is_pinned != TRUE) && (check[i].is_pinned != FALSE)) ||
+ ((check[i].expected_deserialized != TRUE) && (check[i].expected_deserialized != FALSE)) ||
+ ((check[i].expected_serialized != TRUE) && (check[i].expected_serialized != FALSE)) ||
+ ((check[i].expected_destroyed != TRUE) && (check[i].expected_destroyed != FALSE)) ||
#endif /* H5_HAVE_STDBOOL_H */
- ( check[i].expected_size <= (size_t)0 )
- ) {
+ (check[i].expected_size <= (size_t)0)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "bad data in check[%d] on entry to flush op test #%d.",
- i, test_num);
+ HDsnprintf(msg, (size_t)128, "bad data in check[%d] on entry to flush op test #%d.", i, test_num);
failure_mssg = msg;
}
i++;
}
i = 0;
- while ( pass && ( i < spec_size ) ) {
-
- if(spec[i].insert_flag) {
+ while (pass && (i < spec_size)) {
- insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ if (spec[i].insert_flag) {
- } else {
+ insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags);
+ }
+ else {
protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index);
- if(spec[i].resize_flag)
- resize_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].new_size, TRUE);
+ if (spec[i].resize_flag)
+ resize_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].new_size, TRUE);
- unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
- spec[i].flags);
+ unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags);
}
- for (j = 0; j < spec[i].num_pins; j++)
- {
- create_pinned_entry_dependency(file_ptr,
- spec[i].entry_type,
- spec[i].entry_index,
- spec[i].pin_type[j],
- spec[i].pin_idx[j]);
+ for (j = 0; j < spec[i].num_pins; j++) {
+ create_pinned_entry_dependency(file_ptr, spec[i].entry_type, spec[i].entry_index,
+ spec[i].pin_type[j], spec[i].pin_idx[j]);
}
for (j = 0; j < spec[i].num_flush_ops; j++) {
- add_flush_op(spec[i].entry_type,
- spec[i].entry_index,
- spec[i].flush_ops[j].op_code,
- spec[i].flush_ops[j].type,
- spec[i].flush_ops[j].idx,
- spec[i].flush_ops[j].flag,
- spec[i].flush_ops[j].size,
- spec[i].flush_ops[j].order_ptr);
+ add_flush_op(spec[i].entry_type, spec[i].entry_index, spec[i].flush_ops[j].op_code,
+ spec[i].flush_ops[j].type, spec[i].flush_ops[j].idx, spec[i].flush_ops[j].flag,
+ spec[i].flush_ops[j].size, spec[i].flush_ops[j].order_ptr);
}
i++;
}
- if ( pass ) {
+ if (pass) {
- if ( ( cache_ptr->index_len != init_expected_index_len ) ||
- ( cache_ptr->index_size != init_expected_index_size ) ) {
+ if ((cache_ptr->index_len != init_expected_index_len) ||
+ (cache_ptr->index_size != init_expected_index_size)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size before flush in flush op test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected cache len/size before flush in flush op test #%d.",
+ test_num);
failure_mssg = msg;
}
}
- if(pass) {
+ if (pass) {
H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message")
- if ( ! pass ) {
+ if (!pass) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "flush with flags 0x%x failed in flush op test #%d.",
- flush_flags, test_num);
+ HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in flush op test #%d.", flush_flags,
+ test_num);
failure_mssg = msg;
}
}
-
i = 0;
- while ( pass && ( i < spec_size ) ) {
+ while (pass && (i < spec_size)) {
base_addr = entries[spec[i].entry_type];
entry_ptr = &(base_addr[spec[i].entry_index]);
- if ( ( entry_ptr->deserialized != spec[i].expected_deserialized ) ||
- ( entry_ptr->serialized != spec[i].expected_serialized ) ||
- ( entry_ptr->destroyed != spec[i].expected_destroyed ) ) {
+ if ((entry_ptr->deserialized != spec[i].expected_deserialized) ||
+ (entry_ptr->serialized != spec[i].expected_serialized) ||
+ (entry_ptr->destroyed != spec[i].expected_destroyed)) {
#if 0 /* This is useful debugging code. Lets keep it around. */
@@ -9423,47 +8183,41 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
#endif
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Bad status on entry %d after flush op test #%d.",
- i, test_num);
+ HDsnprintf(msg, (size_t)128, "Bad status on entry %d after flush op test #%d.", i, test_num);
failure_mssg = msg;
}
i++;
}
- if(pass) {
+ if (pass) {
i = 0;
- while ( pass && (i < check_size ) ) {
+ while (pass && (i < check_size)) {
- if ( check[i].in_cache != entry_in_cache(cache_ptr,
- check[i].entry_type,
- check[i].entry_index) ) {
+ if (check[i].in_cache != entry_in_cache(cache_ptr, check[i].entry_type, check[i].entry_index)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Check1 failed on entry %d after flush op test #%d.",
- i, test_num);
+ HDsnprintf(msg, (size_t)128, "Check1 failed on entry %d after flush op test #%d.", i,
+ test_num);
failure_mssg = msg;
}
base_addr = entries[check[i].entry_type];
entry_ptr = &(base_addr[check[i].entry_index]);
- if ( ( entry_ptr->size != check[i].expected_size) ||
- ( ( !entry_ptr->header.destroy_in_progress) &&
- ( check[i].in_cache ) &&
- ( entry_ptr->header.size != check[i].expected_size ) ) ||
- ( entry_ptr->at_main_addr != check[i].at_main_addr ) ||
- ( entry_ptr->is_dirty != check[i].is_dirty ) ||
- ( entry_ptr->header.is_dirty != check[i].is_dirty ) ||
- ( entry_ptr->is_protected != check[i].is_protected ) ||
- ( entry_ptr->header.is_protected != check[i].is_protected ) ||
- ( entry_ptr->is_pinned != check[i].is_pinned ) ||
- ( entry_ptr->header.is_pinned != check[i].is_pinned ) ||
- ( entry_ptr->deserialized != check[i].expected_deserialized ) ||
- ( entry_ptr->serialized != check[i].expected_serialized ) ||
- ( entry_ptr->destroyed != check[i].expected_destroyed ) ) {
+ if ((entry_ptr->size != check[i].expected_size) ||
+ ((!entry_ptr->header.destroy_in_progress) && (check[i].in_cache) &&
+ (entry_ptr->header.size != check[i].expected_size)) ||
+ (entry_ptr->at_main_addr != check[i].at_main_addr) ||
+ (entry_ptr->is_dirty != check[i].is_dirty) ||
+ (entry_ptr->header.is_dirty != check[i].is_dirty) ||
+ (entry_ptr->is_protected != check[i].is_protected) ||
+ (entry_ptr->header.is_protected != check[i].is_protected) ||
+ (entry_ptr->is_pinned != check[i].is_pinned) ||
+ (entry_ptr->header.is_pinned != check[i].is_pinned) ||
+ (entry_ptr->deserialized != check[i].expected_deserialized) ||
+ (entry_ptr->serialized != check[i].expected_serialized) ||
+ (entry_ptr->destroyed != check[i].expected_destroyed)) {
#if 0 /* This is useful debugging code. Lets keep it around for a while. */
@@ -9567,75 +8321,56 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
}
#endif
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Check2 failed on entry %d after flush op test #%d.",
- i, test_num);
+ HDsnprintf(msg, (size_t)128, "Check2 failed on entry %d after flush op test #%d.", i,
+ test_num);
failure_mssg = msg;
}
i++;
}
}
- if ( pass ) {
+ if (pass) {
- if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 )
- &&
- ( ( cache_ptr->index_len != expected_index_len )
- ||
- ( cache_ptr->index_size != expected_index_size )
- )
- )
- ||
- ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 )
- &&
- ( ( cache_ptr->index_len != 0 )
- ||
- ( cache_ptr->index_size != 0 )
- )
- )
- ) {
+ if ((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) &&
+ ((cache_ptr->index_len != expected_index_len) ||
+ (cache_ptr->index_size != expected_index_size))) ||
+ (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) &&
+ ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size after flush in flush op test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected cache len/size after flush in flush op test #%d.",
+ test_num);
failure_mssg = msg;
}
}
/* clean up the cache to prep for the next test */
- if(pass) {
+ if (pass) {
H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.")
- if ( ! pass ) {
+ if (!pass) {
- HDsnprintf(msg, (size_t)128,
- "Flush failed on cleanup in flush op test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in flush op test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ||
- ( cache_ptr->clean_index_size != 0 ) ||
- ( cache_ptr->dirty_index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) ||
+ (cache_ptr->clean_index_size != 0) || (cache_ptr->dirty_index_size != 0)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size/cs/ds after cleanup in flush op test #%d.",
- test_num);
+ "Unexpected cache len/size/cs/ds after cleanup in flush op test #%d.", test_num);
failure_mssg = msg;
-
}
}
i = 0;
- while ( pass && ( i < spec_size ) ) {
+ while (pass && (i < spec_size)) {
- base_addr = entries[spec[i].entry_type];
- entry_ptr = &(base_addr[spec[i].entry_index]);
+ base_addr = entries[spec[i].entry_type];
+ entry_ptr = &(base_addr[spec[i].entry_index]);
- entry_ptr->size = entry_sizes[spec[i].entry_type];
+ entry_ptr->size = entry_sizes[spec[i].entry_type];
entry_ptr->deserialized = FALSE;
entry_ptr->serialized = FALSE;
@@ -9645,12 +8380,12 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
}
i = 0;
- while ( pass && ( i < check_size ) ) {
+ while (pass && (i < check_size)) {
- base_addr = entries[check[i].entry_type];
- entry_ptr = &(base_addr[check[i].entry_index]);
+ base_addr = entries[check[i].entry_type];
+ entry_ptr = &(base_addr[check[i].entry_index]);
- entry_ptr->size = entry_sizes[check[i].entry_type];
+ entry_ptr->size = entry_sizes[check[i].entry_type];
entry_ptr->deserialized = FALSE;
entry_ptr->serialized = FALSE;
@@ -9663,7 +8398,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
} /* check_flush_cache__flush_op_test() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_cache__flush_op_eviction_test()
*
@@ -9694,864 +8428,1718 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
*/
static void
-check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
+check_flush_cache__flush_op_eviction_test(H5F_t *file_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
- int i;
- int num_variable_entries = 10;
- int num_monster_entries = 31;
- int num_large_entries = 0;
- test_entry_t * entry_ptr;
- test_entry_t * base_addr;
- struct expected_entry_status expected[10 + 31 + 14] =
- {
- /* the expected array is used to maintain a table of the expected status of every
- * entry used in this test. Note that since the function that processes this
- * array only processes as much of it as it is told to, we don't have to
- * worry about maintaining the status of entries that we haven't used yet.
- */
- /* entry entry in at main flush dep flush dep child flush flush flush */
- /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */
- { VARIABLE_ENTRY_TYPE, 0, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { VARIABLE_ENTRY_TYPE, 1, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { VARIABLE_ENTRY_TYPE, 2, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { VARIABLE_ENTRY_TYPE, 4, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { VARIABLE_ENTRY_TYPE, 6, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { VARIABLE_ENTRY_TYPE, 7, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { VARIABLE_ENTRY_TYPE, 8, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { VARIABLE_ENTRY_TYPE, 9, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 0, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 1, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 2, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 3, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 4, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 5, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 6, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 7, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 8, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 9, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 10, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 11, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 12, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE},
- { LARGE_ENTRY_TYPE, 13, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}
- };
-
- if(pass) {
-
- if(cache_ptr == NULL) {
-
- pass = FALSE;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
+ int i;
+ int num_variable_entries = 10;
+ int num_monster_entries = 31;
+ int num_large_entries = 0;
+ test_entry_t * entry_ptr;
+ test_entry_t * base_addr;
+ struct expected_entry_status expected[10 + 31 + 14] = {
+ /* the expected array is used to maintain a table of the expected status of every
+ * entry used in this test. Note that since the function that processes this
+ * array only processes as much of it as it is told to, we don't have to
+ * worry about maintaining the status of entries that we haven't used yet.
+ */
+ /* entry entry in at main flush dep flush dep child flush flush
+ flush */
+ /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd:
+ srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */
+ {VARIABLE_ENTRY_TYPE,
+ 0,
+ VARIABLE_ENTRY_SIZE / 4,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {VARIABLE_ENTRY_TYPE,
+ 1,
+ VARIABLE_ENTRY_SIZE / 4,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {VARIABLE_ENTRY_TYPE,
+ 2,
+ VARIABLE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {VARIABLE_ENTRY_TYPE,
+ 3,
+ VARIABLE_ENTRY_SIZE / 4,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {VARIABLE_ENTRY_TYPE,
+ 4,
+ VARIABLE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {VARIABLE_ENTRY_TYPE,
+ 5,
+ VARIABLE_ENTRY_SIZE / 4,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {VARIABLE_ENTRY_TYPE,
+ 6,
+ VARIABLE_ENTRY_SIZE / 2,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {VARIABLE_ENTRY_TYPE,
+ 7,
+ VARIABLE_ENTRY_SIZE / 2,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {VARIABLE_ENTRY_TYPE,
+ 8,
+ VARIABLE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {VARIABLE_ENTRY_TYPE,
+ 9,
+ VARIABLE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 0,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 1,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 2,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 3,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 4,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 5,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 6,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 7,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 8,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 9,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 10,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 11,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 12,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 13,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 14,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 15,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 16,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 17,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 18,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 19,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 20,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 21,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 22,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 23,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 24,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 25,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 26,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 27,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 28,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 29,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {MONSTER_ENTRY_TYPE,
+ 30,
+ MONSTER_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 0,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 1,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 2,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 3,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 4,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 5,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 6,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 7,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 8,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 9,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 10,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 11,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 12,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE},
+ {LARGE_ENTRY_TYPE,
+ 13,
+ LARGE_ENTRY_SIZE,
+ TRUE,
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ TRUE,
+ FALSE,
+ FALSE,
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0},
+ 0,
+ 0,
+ 0,
+ -1,
+ FALSE}};
+
+ if (pass) {
+
+ if (cache_ptr == NULL) {
+
+ pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to flush ops test.";
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not empty at start of flush ops eviction test.";
}
- else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
-
- pass = FALSE;
- failure_mssg =
- "unexpected cache config at start of flush op eviction test.";
+ else if ((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- } else {
+ pass = FALSE;
+ failure_mssg = "unexpected cache config at start of flush op eviction test.";
+ }
+ else {
/* set min clean size to zero for this test as it simplifies
- * computing the expected cache size after each operation.
- */
+ * computing the expected cache size after each operation.
+ */
cache_ptr->min_clean_size = 0;
}
}
- if(pass) {
+ if (pass) {
/* the basic idea in this test is to insert a bunch of entries
* with flush operations associated with them, and then load
* other entries into the cache until the cache is full. At
* that point, load yet more entries into the cache, and see
* if the flush operations are performed as expected.
- *
- * To make things a bit more interesting, we also include a
- * couple of pins.
+ *
+ * To make things a bit more interesting, we also include a
+ * couple of pins.
*/
- /* reset the stats before we start. If stats are enabled, we will
- * check to see if they are as expected at the end.
- */
- H5C_stats__reset(cache_ptr);
+ /* reset the stats before we start. If stats are enabled, we will
+ * check to see if they are as expected at the end.
+ */
+ H5C_stats__reset(cache_ptr);
+ /* load a few entries with pin relationships and flush ops.
+ * Start by just loading the entries.
+ */
- /* load a few entries with pin relationships and flush ops.
- * Start by just loading the entries.
- */
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, (VARIABLE_ENTRY_SIZE / 4), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0,
- (VARIABLE_ENTRY_SIZE / 4), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, (VARIABLE_ENTRY_SIZE / 4), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1,
- (VARIABLE_ENTRY_SIZE / 4), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET);
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, (VARIABLE_ENTRY_SIZE / 4), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3,
- (VARIABLE_ENTRY_SIZE / 4), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4, H5C__NO_FLAGS_SET);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4, H5C__NO_FLAGS_SET);
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, (VARIABLE_ENTRY_SIZE / 4), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, H5C__DIRTIED_FLAG);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5,
- (VARIABLE_ENTRY_SIZE / 4), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, (VARIABLE_ENTRY_SIZE / 2), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, H5C__DIRTIED_FLAG);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6,
- (VARIABLE_ENTRY_SIZE / 2), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, (VARIABLE_ENTRY_SIZE / 2), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, H5C__DIRTIED_FLAG);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7,
- (VARIABLE_ENTRY_SIZE / 2), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8, H5C__NO_FLAGS_SET);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8, H5C__NO_FLAGS_SET);
+ protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9, H5C__NO_FLAGS_SET);
- protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9, H5C__NO_FLAGS_SET);
+ if ((cache_ptr->index_len != 10) ||
+ (cache_ptr->index_size !=
+ (4 * (VARIABLE_ENTRY_SIZE / 4)) + (2 * (VARIABLE_ENTRY_SIZE / 2)) + (4 * VARIABLE_ENTRY_SIZE))) {
- if((cache_ptr->index_len != 10) ||
- (cache_ptr->index_size != (4 * (VARIABLE_ENTRY_SIZE / 4)) +
- (2 * (VARIABLE_ENTRY_SIZE / 2)) +
- (4 * VARIABLE_ENTRY_SIZE))) {
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 1.";
+ }
+ }
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 1.";
- }
- }
-
- if(pass) {
-
- /* Now set up the pinning relationships:
- *
- * Briefly, (VET, 0) is pinned by (VET, 1), (VET, 3), and (VET, 5)
- * (VET, 9) is pinned by (VET, 5), and (VET, 7)
- */
- create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 1,
- VARIABLE_ENTRY_TYPE, 0);
- create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 3,
- VARIABLE_ENTRY_TYPE, 0);
- create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5,
- VARIABLE_ENTRY_TYPE, 0);
- create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5,
- VARIABLE_ENTRY_TYPE, 9);
- create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 7,
- VARIABLE_ENTRY_TYPE, 9);
-
- /* Next, set up the flush operations:
- *
- * Briefly, (VET, 1) dirties (VET, 0)
- * resizes (VET, 0) to 3/4 VARIABLE_ENTRY_SIZE
- *
- * (VET, 3) dirties (VET, 0)
- * resizes (VET, 0) to VARIABLE_ENTRY_SIZE
- * moves (VET, 0) to its alternate address
- *
- * (VET, 5) dirties (VET, 0)
- * resizes itself to VARIABLE_ENTRY_SIZE / 2
+ if (pass) {
+
+ /* Now set up the pinning relationships:
+ *
+ * Briefly, (VET, 0) is pinned by (VET, 1), (VET, 3), and (VET, 5)
+ * (VET, 9) is pinned by (VET, 5), and (VET, 7)
+ */
+ create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 1, VARIABLE_ENTRY_TYPE, 0);
+ create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_TYPE, 0);
+ create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_TYPE, 0);
+ create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_TYPE, 9);
+ create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 7, VARIABLE_ENTRY_TYPE, 9);
+
+ /* Next, set up the flush operations:
+ *
+ * Briefly, (VET, 1) dirties (VET, 0)
+ * resizes (VET, 0) to 3/4 VARIABLE_ENTRY_SIZE
+ *
+ * (VET, 3) dirties (VET, 0)
+ * resizes (VET, 0) to VARIABLE_ENTRY_SIZE
+ * moves (VET, 0) to its alternate address
+ *
+ * (VET, 5) dirties (VET, 0)
+ * resizes itself to VARIABLE_ENTRY_SIZE / 2
*
* (VET, 7) dirties (VET, 9)
- *
- * (VET, 9) dirties (VET, 8)
- */
- add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__DIRTY,
- VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL);
- add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__RESIZE,
- VARIABLE_ENTRY_TYPE, 0, TRUE,
- 3 * VARIABLE_ENTRY_SIZE / 4, NULL);
-
- add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__DIRTY,
- VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL);
- add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__RESIZE,
- VARIABLE_ENTRY_TYPE, 0, TRUE, VARIABLE_ENTRY_SIZE, NULL);
- add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__MOVE,
- VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL);
-
- add_flush_op(VARIABLE_ENTRY_TYPE, 5, FLUSH_OP__DIRTY,
- VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL);
- add_flush_op(VARIABLE_ENTRY_TYPE, 5, FLUSH_OP__RESIZE,
- VARIABLE_ENTRY_TYPE, 5, TRUE, VARIABLE_ENTRY_SIZE / 2, NULL);
-
- add_flush_op(VARIABLE_ENTRY_TYPE, 7, FLUSH_OP__DIRTY,
- VARIABLE_ENTRY_TYPE, 9, FALSE, (size_t)0, NULL);
-
- add_flush_op(VARIABLE_ENTRY_TYPE, 9, FLUSH_OP__DIRTY,
- VARIABLE_ENTRY_TYPE, 8, FALSE, (size_t)0, NULL);
- }
-
- if(pass) {
-
- /* to summarize, at present the following variable size entries
- * are in cache with the following characteristics:
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (VET, 0) Y 2.5 KB Y Y - -
- *
- * (VET, 1) Y 2.5 KB Y N 0 dirty (VET, 0),
- * resize (VET, 0) to 7.5 KB
- *
- * (VET, 2) Y 10 KB N N - -
- *
- *
- * (VET, 3) Y 2.5 KB N N 0 dirty (VET, 0)
- * resize (VET, 0) to 10 KB
- * move (VET, 0) to its alternate address
- *
- * (VET, 4) Y 10 KB N N - -
- *
- *
- * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0)
- * resize (VET, 5) to 5 KB
- *
- * (VET, 6) Y 5 KB Y N - -
- *
- * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9)
- *
- * (VET, 8) Y 10 KB N N - -
- *
- * (VET, 9) Y 10 KB N N - dirty (VET, 8)
- *
- * Recall that in this test bed, flush operations are excuted the
- * first time the associated entry is flushed, and are then
- * deleted.
- */
+ *
+ * (VET, 9) dirties (VET, 8)
+ */
+ add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL);
+ add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, TRUE,
+ 3 * VARIABLE_ENTRY_SIZE / 4, NULL);
+
+ add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL);
+ add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, TRUE,
+ VARIABLE_ENTRY_SIZE, NULL);
+ add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL);
+
+ add_flush_op(VARIABLE_ENTRY_TYPE, 5, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL);
+ add_flush_op(VARIABLE_ENTRY_TYPE, 5, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 5, TRUE,
+ VARIABLE_ENTRY_SIZE / 2, NULL);
+
+ add_flush_op(VARIABLE_ENTRY_TYPE, 7, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 9, FALSE, (size_t)0, NULL);
+
+ add_flush_op(VARIABLE_ENTRY_TYPE, 9, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 8, FALSE, (size_t)0, NULL);
+ }
+
+ if (pass) {
+
+ /* to summarize, at present the following variable size entries
+ * are in cache with the following characteristics:
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (VET, 0) Y 2.5 KB Y Y - -
+ *
+ * (VET, 1) Y 2.5 KB Y N 0 dirty (VET, 0),
+ * resize (VET, 0) to 7.5 KB
+ *
+ * (VET, 2) Y 10 KB N N - -
+ *
+ *
+ * (VET, 3) Y 2.5 KB N N 0 dirty (VET, 0)
+ * resize (VET, 0) to 10 KB
+ * move (VET, 0) to its alternate address
+ *
+ * (VET, 4) Y 10 KB N N - -
+ *
+ *
+ * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0)
+ * resize (VET, 5) to 5 KB
+ *
+ * (VET, 6) Y 5 KB Y N - -
+ *
+ * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9)
+ *
+ * (VET, 8) Y 10 KB N N - -
+ *
+ * (VET, 9) Y 10 KB N N - dirty (VET, 8)
+ *
+ * Recall that in this test bed, flush operations are excuted the
+ * first time the associated entry is flushed, and are then
+ * deleted.
+ */
/* Now fill up the cache with other, unrelated entries */
- for (i = 0; i < 31; i++)
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ for (i = 0; i < 31; i++) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
- for (i = 0; i < 1; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 0; i < 1; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
-
- /* The cache should now be exactly full */
- if((cache_ptr->index_len != 42) ||
- (cache_ptr->index_size != 2 * 1024 * 1024) ||
- (cache_ptr->index_size != ((4 * VARIABLE_ENTRY_SIZE / 4) +
- (2 * VARIABLE_ENTRY_SIZE / 2) +
- (4 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (1 * LARGE_ENTRY_SIZE)))) {
+ }
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 2.";
+ /* The cache should now be exactly full */
+ if ((cache_ptr->index_len != 42) || (cache_ptr->index_size != 2 * 1024 * 1024) ||
+ (cache_ptr->index_size !=
+ ((4 * VARIABLE_ENTRY_SIZE / 4) + (2 * VARIABLE_ENTRY_SIZE / 2) + (4 * VARIABLE_ENTRY_SIZE) +
+ (31 * MONSTER_ENTRY_SIZE) + (1 * LARGE_ENTRY_SIZE)))) {
- } else {
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 2.";
+ }
+ else {
- /* verify the expected status of all entries we have loaded to date: */
+ /* verify the expected status of all entries we have loaded to date: */
num_large_entries = 1;
- verify_entry_status(cache_ptr,
- 0,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
- }
- }
-
- if(pass) {
-
- /* Now load a large entry. This should result in the eviction
- * of (VET,2), and the increase in the size of (VET, 0) from .25
- * VARIABLE_ENTRY_SIZE to .75 VARIABLE_ENTRY_SIZE.
- *
- * The following table illustrates the intended state of affairs
- * after the eviction:
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (VET, 0) Y 7.5 KB Y Y - -
- *
- * (VET, 1) Y 2.5 KB N N - -
- *
- * (VET, 2) N 10 KB N N - -
- *
- * (VET, 3) Y 2.5 KB Y N 0 dirty (VET, 0)
- * resize (VET, 0) to 10 KB
- * move (VET, 0) to its alternate address
- *
- * (VET, 4) Y 10 KB N N - -
- *
- * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0)
- * resize (VET, 5) to 5 KB
- *
- * (VET, 6) Y 5 KB Y N - -
- *
- * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9)
- *
- * (VET, 8) Y 10 KB N N - -
- *
- * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
- *
- * Start by updating the expected table for the expected changes in entry status:
- */
- expected[0].size = 3 * VARIABLE_ENTRY_SIZE / 4;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[2].in_cache = FALSE;
- expected[2].destroyed = TRUE;
+ verify_entry_status(cache_ptr, 0,
+ (num_variable_entries + num_monster_entries + num_large_entries), expected);
+ }
+ }
+
+ if (pass) {
+
+ /* Now load a large entry. This should result in the eviction
+ * of (VET,2), and the increase in the size of (VET, 0) from .25
+ * VARIABLE_ENTRY_SIZE to .75 VARIABLE_ENTRY_SIZE.
+ *
+ * The following table illustrates the intended state of affairs
+ * after the eviction:
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (VET, 0) Y 7.5 KB Y Y - -
+ *
+ * (VET, 1) Y 2.5 KB N N - -
+ *
+ * (VET, 2) N 10 KB N N - -
+ *
+ * (VET, 3) Y 2.5 KB Y N 0 dirty (VET, 0)
+ * resize (VET, 0) to 10 KB
+ * move (VET, 0) to its alternate address
+ *
+ * (VET, 4) Y 10 KB N N - -
+ *
+ * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0)
+ * resize (VET, 5) to 5 KB
+ *
+ * (VET, 6) Y 5 KB Y N - -
+ *
+ * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9)
+ *
+ * (VET, 8) Y 10 KB N N - -
+ *
+ * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
+ *
+ * Start by updating the expected table for the expected changes in entry status:
+ */
+ expected[0].size = 3 * VARIABLE_ENTRY_SIZE / 4;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[2].in_cache = FALSE;
+ expected[2].destroyed = TRUE;
num_large_entries = 2;
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG);
-
- if((cache_ptr->index_len != 42) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (VARIABLE_ENTRY_SIZE) +
- (VARIABLE_ENTRY_SIZE / 2) +
- (LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((1 * (3 * VARIABLE_ENTRY_SIZE / 4)) +
- (3 * VARIABLE_ENTRY_SIZE / 4) +
- (2 * VARIABLE_ENTRY_SIZE / 2) +
- (3 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (2 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 3.";
- }
-
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 1,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
- }
-
- if(pass) {
-
- /* Now load another large entry. This should result in the eviction
- * of (VET, 4), the increase in the size of (VET, 0) from .75
- * VARIABLE_ENTRY_SIZE to 1.0 VARIABLE_ENTRY_SIZE, and the renaming
- * of (VET, 0) to its alternate address.
- *
- * The following table shows the expected states of the variable
- * size entries after the test.
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (VET, 0) Y 10 KB Y Y - -
- *
- * (VET, 1) Y 2.5 KB N N - -
- *
- * (VET, 2) N 10 KB N N - -
- *
- * (VET, 3) Y 2.5 KB N N - -
- *
- * (VET, 4) N 10 KB N N - -
- *
- * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0)
- * resize (VET, 5) to 5 KB
- *
- * (VET, 6) Y 5 KB Y N - -
- *
- * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9)
- *
- * (VET, 8) Y 10 KB N N - -
- *
- * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
- *
- * Start by updating the expected table for the expected changes in entry status:
- */
- expected[0].size = VARIABLE_ENTRY_SIZE;
- expected[0].at_main_addr = FALSE;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[4].in_cache = FALSE;
- expected[4].destroyed = TRUE;
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG);
+
+ if ((cache_ptr->index_len != 42) ||
+ (cache_ptr->index_size !=
+ (2 * 1024 * 1024) - (VARIABLE_ENTRY_SIZE) + (VARIABLE_ENTRY_SIZE / 2) + (LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size != ((1 * (3 * VARIABLE_ENTRY_SIZE / 4)) + (3 * VARIABLE_ENTRY_SIZE / 4) +
+ (2 * VARIABLE_ENTRY_SIZE / 2) + (3 * VARIABLE_ENTRY_SIZE) +
+ (31 * MONSTER_ENTRY_SIZE) + (2 * LARGE_ENTRY_SIZE)))) {
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 3.";
+ }
+
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 1, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
+ }
+
+ if (pass) {
+
+ /* Now load another large entry. This should result in the eviction
+ * of (VET, 4), the increase in the size of (VET, 0) from .75
+ * VARIABLE_ENTRY_SIZE to 1.0 VARIABLE_ENTRY_SIZE, and the renaming
+ * of (VET, 0) to its alternate address.
+ *
+ * The following table shows the expected states of the variable
+ * size entries after the test.
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (VET, 0) Y 10 KB Y Y - -
+ *
+ * (VET, 1) Y 2.5 KB N N - -
+ *
+ * (VET, 2) N 10 KB N N - -
+ *
+ * (VET, 3) Y 2.5 KB N N - -
+ *
+ * (VET, 4) N 10 KB N N - -
+ *
+ * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0)
+ * resize (VET, 5) to 5 KB
+ *
+ * (VET, 6) Y 5 KB Y N - -
+ *
+ * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9)
+ *
+ * (VET, 8) Y 10 KB N N - -
+ *
+ * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
+ *
+ * Start by updating the expected table for the expected changes in entry status:
+ */
+ expected[0].size = VARIABLE_ENTRY_SIZE;
+ expected[0].at_main_addr = FALSE;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[4].in_cache = FALSE;
+ expected[4].destroyed = TRUE;
num_large_entries = 3;
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DIRTIED_FLAG);
- if((cache_ptr->index_len != 42) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (2 * VARIABLE_ENTRY_SIZE) +
- (3 * VARIABLE_ENTRY_SIZE / 4) +
- (2 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((3 * VARIABLE_ENTRY_SIZE / 4) +
- (2 * VARIABLE_ENTRY_SIZE / 2) +
- (3 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (3 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 42) ||
+ (cache_ptr->index_size != (2 * 1024 * 1024) - (2 * VARIABLE_ENTRY_SIZE) +
+ (3 * VARIABLE_ENTRY_SIZE / 4) + (2 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size !=
+ ((3 * VARIABLE_ENTRY_SIZE / 4) + (2 * VARIABLE_ENTRY_SIZE / 2) + (3 * VARIABLE_ENTRY_SIZE) +
+ (31 * MONSTER_ENTRY_SIZE) + (3 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 4.";
- }
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 4.";
+ }
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 2,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 2, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
}
- if(pass) {
+ if (pass) {
- /* load two more large entries. This should result in (VET, 5) being
- * flushed, and increasing its size from 1/4 VARIABLE_ENTRY_SIZE to
- * VARIABLE_ENTRY_SIZE.
- *
- * As a result of this size increase, the cache will have to look
- * for another entry to evict. After flushing (VET, 6) and (VET, 7),
- * it should evict (VET, 8), yielding the needed memory and dirtying
+ /* load two more large entries. This should result in (VET, 5) being
+ * flushed, and increasing its size from 1/4 VARIABLE_ENTRY_SIZE to
+ * VARIABLE_ENTRY_SIZE.
+ *
+ * As a result of this size increase, the cache will have to look
+ * for another entry to evict. After flushing (VET, 6) and (VET, 7),
+ * it should evict (VET, 8), yielding the needed memory and dirtying
* (VET, 9).
- *
- * The following table shows the expected states of the variable
- * size entries after the test.
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (VET, 0) Y 10 KB Y Y - -
- *
- * (VET, 1) Y 2.5 KB N N - -
- *
- * (VET, 2) N 10 KB N N - -
- *
- * (VET, 3) Y 2.5 KB N N - -
- *
- * (VET, 4) N 10 KB N N - -
- *
- * (VET, 5) Y 5 KB N N 0, 9 -
- *
- * (VET, 6) Y 5 KB N N - -
- *
- * (VET, 7) Y 5 KB N N 9 -
- *
- * (VET, 8) N 10 KB N N - -
- *
- * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
- *
- * Start by updating the expected table for the expected changes in entry status:
- */
-
- expected[5].size = VARIABLE_ENTRY_SIZE / 2;
- expected[5].is_dirty = FALSE;
- expected[5].serialized = TRUE;
- expected[6].is_dirty = FALSE;
- expected[6].serialized = TRUE;
- expected[7].is_dirty = FALSE;
- expected[7].serialized = TRUE;
- expected[8].in_cache = FALSE;
- expected[8].destroyed = TRUE;
- expected[9].is_dirty = TRUE;
+ *
+ * The following table shows the expected states of the variable
+ * size entries after the test.
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (VET, 0) Y 10 KB Y Y - -
+ *
+ * (VET, 1) Y 2.5 KB N N - -
+ *
+ * (VET, 2) N 10 KB N N - -
+ *
+ * (VET, 3) Y 2.5 KB N N - -
+ *
+ * (VET, 4) N 10 KB N N - -
+ *
+ * (VET, 5) Y 5 KB N N 0, 9 -
+ *
+ * (VET, 6) Y 5 KB N N - -
+ *
+ * (VET, 7) Y 5 KB N N 9 -
+ *
+ * (VET, 8) N 10 KB N N - -
+ *
+ * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
+ *
+ * Start by updating the expected table for the expected changes in entry status:
+ */
+
+ expected[5].size = VARIABLE_ENTRY_SIZE / 2;
+ expected[5].is_dirty = FALSE;
+ expected[5].serialized = TRUE;
+ expected[6].is_dirty = FALSE;
+ expected[6].serialized = TRUE;
+ expected[7].is_dirty = FALSE;
+ expected[7].serialized = TRUE;
+ expected[8].in_cache = FALSE;
+ expected[8].destroyed = TRUE;
+ expected[9].is_dirty = TRUE;
num_large_entries = 5;
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG);
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 4);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 4, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 4);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 4, H5C__DIRTIED_FLAG);
/* verify cache size */
- if((cache_ptr->index_len != 43) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (3 * VARIABLE_ENTRY_SIZE) +
- (1 * VARIABLE_ENTRY_SIZE / 4) +
- (3 * VARIABLE_ENTRY_SIZE / 4) +
- (4 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 4) +
- (3 * VARIABLE_ENTRY_SIZE / 2) +
- (2 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (5 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 43) ||
+ (cache_ptr->index_size != (2 * 1024 * 1024) - (3 * VARIABLE_ENTRY_SIZE) +
+ (1 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 4) +
+ (4 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size !=
+ ((2 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) +
+ (31 * MONSTER_ENTRY_SIZE) + (5 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 5.";
- }
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 5.";
+ }
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 3,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 3, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
}
- if(pass) {
+ if (pass) {
/* now touch all the non VARIABLE_ENTRY_TYPE entries in the
- * cache to bring all the VARIABLE_ENTRY_TYPE entries to the
- * end of the LRU list.
- *
- * Note that we don't have to worry about (VET, 0) and (VET, 9)
- * as they are pinned and thus not in the LRU list to begin with.
- */
- for (i = 0; i < 31; i++)
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ * cache to bring all the VARIABLE_ENTRY_TYPE entries to the
+ * end of the LRU list.
+ *
+ * Note that we don't have to worry about (VET, 0) and (VET, 9)
+ * as they are pinned and thus not in the LRU list to begin with.
+ */
+ for (i = 0; i < 31; i++) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
- for (i = 0; i < 5; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 0; i < 5; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
/* verify cache size */
- if((cache_ptr->index_len != 43) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (3 * VARIABLE_ENTRY_SIZE) +
- (1 * VARIABLE_ENTRY_SIZE / 4) +
- (3 * VARIABLE_ENTRY_SIZE / 4) +
- (4 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 4) +
- (3 * VARIABLE_ENTRY_SIZE / 2) +
- (2 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (5 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 43) ||
+ (cache_ptr->index_size != (2 * 1024 * 1024) - (3 * VARIABLE_ENTRY_SIZE) +
+ (1 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 4) +
+ (4 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size !=
+ ((2 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) +
+ (31 * MONSTER_ENTRY_SIZE) + (5 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 6.";
- }
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 6.";
+ }
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 4,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 4, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
}
- if(pass) {
+ if (pass) {
- /* Now load three more large entries. This should result
- * in the evictions of (VET, 1), (VET, 3), and (VET, 5), and the
+ /* Now load three more large entries. This should result
+ * in the evictions of (VET, 1), (VET, 3), and (VET, 5), and the
* unpinning of (VET, 0)
- *
- * The following table shows the expected states of the variable
- * size entries after the test.
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (VET, 0) Y 10 KB Y N - -
- *
- * (VET, 1) N 2.5 KB N N - -
- *
- * (VET, 2) N 10 KB N N - -
- *
- * (VET, 3) N 2.5 KB N N - -
- *
- * (VET, 4) N 10 KB N N - -
- *
- * (VET, 5) N 5 KB N N - -
- *
- * (VET, 6) Y 5 KB N N - -
- *
- * (VET, 7) Y 5 KB N N 9 -
- *
- * (VET, 8) N 10 KB N N - -
- *
- * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
- *
- * Start by updating the expected table for the expected changes in entry status:
- */
-
- expected[0].is_pinned = FALSE;
- expected[1].in_cache = FALSE;
- expected[1].destroyed = TRUE;
- expected[3].in_cache = FALSE;
- expected[3].destroyed = TRUE;
- expected[5].in_cache = FALSE;
- expected[5].destroyed = TRUE;
+ *
+ * The following table shows the expected states of the variable
+ * size entries after the test.
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (VET, 0) Y 10 KB Y N - -
+ *
+ * (VET, 1) N 2.5 KB N N - -
+ *
+ * (VET, 2) N 10 KB N N - -
+ *
+ * (VET, 3) N 2.5 KB N N - -
+ *
+ * (VET, 4) N 10 KB N N - -
+ *
+ * (VET, 5) N 5 KB N N - -
+ *
+ * (VET, 6) Y 5 KB N N - -
+ *
+ * (VET, 7) Y 5 KB N N 9 -
+ *
+ * (VET, 8) N 10 KB N N - -
+ *
+ * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
+ *
+ * Start by updating the expected table for the expected changes in entry status:
+ */
+
+ expected[0].is_pinned = FALSE;
+ expected[1].in_cache = FALSE;
+ expected[1].destroyed = TRUE;
+ expected[3].in_cache = FALSE;
+ expected[3].destroyed = TRUE;
+ expected[5].in_cache = FALSE;
+ expected[5].destroyed = TRUE;
num_large_entries = 8;
- for (i = 5; i < 8; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 5; i < 8; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
/* verify cache size */
- if((cache_ptr->index_len != 43) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (4 * VARIABLE_ENTRY_SIZE) +
- (1 * VARIABLE_ENTRY_SIZE / 4) +
- (3 * VARIABLE_ENTRY_SIZE / 4) +
- (7 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 2) +
- (2 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (8 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 43) ||
+ (cache_ptr->index_size != (2 * 1024 * 1024) - (4 * VARIABLE_ENTRY_SIZE) +
+ (1 * VARIABLE_ENTRY_SIZE / 4) + (3 * VARIABLE_ENTRY_SIZE / 4) +
+ (7 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) +
+ (31 * MONSTER_ENTRY_SIZE) + (8 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 7.";
- }
-
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 5,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
- }
-
- if(pass) {
-
- /* load another large entry. (VET, 6) should be evicted.
- *
- * The following table shows the expected states of the variable
- * size entries after the test.
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (VET, 0) Y 10 KB Y N - -
- *
- * (VET, 1) N 2.5 KB N N - -
- *
- * (VET, 2) N 10 KB N N - -
- *
- * (VET, 3) N 2.5 KB N N - -
- *
- * (VET, 4) N 10 KB N N - -
- *
- * (VET, 5) N 5 KB N N - -
- *
- * (VET, 6) N 5 KB N N - -
- *
- * (VET, 7) Y 5 KB N N 9 -
- *
- * (VET, 8) N 10 KB N N - -
- *
- * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
- *
- * Start by updating the expected table for the expected changes in entry status:
- */
-
- expected[6].in_cache = FALSE;
- expected[6].destroyed = TRUE;
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 7.";
+ }
+
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 5, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
+ }
+
+ if (pass) {
+
+ /* load another large entry. (VET, 6) should be evicted.
+ *
+ * The following table shows the expected states of the variable
+ * size entries after the test.
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (VET, 0) Y 10 KB Y N - -
+ *
+ * (VET, 1) N 2.5 KB N N - -
+ *
+ * (VET, 2) N 10 KB N N - -
+ *
+ * (VET, 3) N 2.5 KB N N - -
+ *
+ * (VET, 4) N 10 KB N N - -
+ *
+ * (VET, 5) N 5 KB N N - -
+ *
+ * (VET, 6) N 5 KB N N - -
+ *
+ * (VET, 7) Y 5 KB N N 9 -
+ *
+ * (VET, 8) N 10 KB N N - -
+ *
+ * (VET, 9) Y 10 KB N Y - dirty (VET, 8)
+ *
+ * Start by updating the expected table for the expected changes in entry status:
+ */
+
+ expected[6].in_cache = FALSE;
+ expected[6].destroyed = TRUE;
num_large_entries = 9;
- for (i = 8; i < 9; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 8; i < 9; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
/* verify cache size */
- if((cache_ptr->index_len != 43) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (3 * VARIABLE_ENTRY_SIZE) -
- (VARIABLE_ENTRY_SIZE / 2) +
- (8 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE / 2) +
- (2 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (9 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 43) ||
+ (cache_ptr->index_size != (2 * 1024 * 1024) - (3 * VARIABLE_ENTRY_SIZE) -
+ (VARIABLE_ENTRY_SIZE / 2) + (8 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE / 2) + (2 * VARIABLE_ENTRY_SIZE) +
+ (31 * MONSTER_ENTRY_SIZE) + (9 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 8.";
- }
-
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 6,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
- }
-
- if(pass) {
-
- /* Load another large entry.
- *
- * (VET, 7) should be evicted, and (VET, 9) should be unpinned.
- *
- * The following table shows the expected states of the variable
- * size entries after the test.
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (VET, 0) Y 10 KB Y N - -
- *
- * (VET, 1) N 2.5 KB N N - -
- *
- * (VET, 2) N 10 KB N N - -
- *
- * (VET, 3) N 2.5 KB N N - -
- *
- * (VET, 4) N 10 KB N N - -
- *
- * (VET, 5) N 5 KB N N - -
- *
- * (VET, 6) N 5 KB N N - -
- *
- * (VET, 7) N 5 KB N N - -
- *
- * (VET, 8) N 10 KB N N - -
- *
- * (VET, 9) Y 10 KB Y N - dirty (VET, 8)
- *
- * Start by updating the expected table for the expected changes in entry status:
- */
-
- expected[7].in_cache = FALSE;
- expected[7].destroyed = TRUE;
- expected[9].is_pinned = FALSE;
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 8.";
+ }
+
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 6, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
+ }
+
+ if (pass) {
+
+ /* Load another large entry.
+ *
+ * (VET, 7) should be evicted, and (VET, 9) should be unpinned.
+ *
+ * The following table shows the expected states of the variable
+ * size entries after the test.
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (VET, 0) Y 10 KB Y N - -
+ *
+ * (VET, 1) N 2.5 KB N N - -
+ *
+ * (VET, 2) N 10 KB N N - -
+ *
+ * (VET, 3) N 2.5 KB N N - -
+ *
+ * (VET, 4) N 10 KB N N - -
+ *
+ * (VET, 5) N 5 KB N N - -
+ *
+ * (VET, 6) N 5 KB N N - -
+ *
+ * (VET, 7) N 5 KB N N - -
+ *
+ * (VET, 8) N 10 KB N N - -
+ *
+ * (VET, 9) Y 10 KB Y N - dirty (VET, 8)
+ *
+ * Start by updating the expected table for the expected changes in entry status:
+ */
+
+ expected[7].in_cache = FALSE;
+ expected[7].destroyed = TRUE;
+ expected[9].is_pinned = FALSE;
num_large_entries = 10;
- for (i = 9; i < 10; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 9; i < 10; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
/* verify cache size */
- if((cache_ptr->index_len != 43) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (4 * VARIABLE_ENTRY_SIZE) +
- (9 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (10 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 43) ||
+ (cache_ptr->index_size !=
+ (2 * 1024 * 1024) - (4 * VARIABLE_ENTRY_SIZE) + (9 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size !=
+ ((2 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (10 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 9.";
- }
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 9.";
+ }
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 7,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 7, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
}
- if(pass) {
+ if (pass) {
/* Again, touch all the non VARIABLE_ENTRY_TYPE entries in the
- * cache to bring all the VARIABLE_ENTRY_TYPE entries to the
- * end of the LRU list.
- *
- * Both (VET, 0) and (VET, 7) have been unpinned, so they are
- * now in the LRU list.
- */
- for (i = 0; i < 31; i++)
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ * cache to bring all the VARIABLE_ENTRY_TYPE entries to the
+ * end of the LRU list.
+ *
+ * Both (VET, 0) and (VET, 7) have been unpinned, so they are
+ * now in the LRU list.
+ */
+ for (i = 0; i < 31; i++) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
- for (i = 0; i < 10; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 0; i < 10; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
/* verify cache size */
- if((cache_ptr->index_len != 43) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (4 * VARIABLE_ENTRY_SIZE) +
- (9 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (10 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 43) ||
+ (cache_ptr->index_size !=
+ (2 * 1024 * 1024) - (4 * VARIABLE_ENTRY_SIZE) + (9 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size !=
+ ((2 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (10 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 10.";
- }
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 10.";
+ }
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 8,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 8, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
}
- if(pass) {
+ if (pass) {
- /* load two more large entries. Things get a bit complicated here,
- * so I'll go through the operation step by step.
+ /* load two more large entries. Things get a bit complicated here,
+ * so I'll go through the operation step by step.
*
* Initially, the cache has 4 KB of empty space, so the first entry
- * (LET, 10) is loaded via calls to H5C_protect() H5C_unprotect()
- * without causing any evictions.
+ * (LET, 10) is loaded via calls to H5C_protect() H5C_unprotect()
+ * without causing any evictions.
*
* However, this is not the case for the call of H5C_protect() on
- * (LET, 11).
+ * (LET, 11).
*
* Before inserting (LET, 11), H5C_protect(LET, 11) must try to
- * free up at least 4 KB of space. To do this, it starts scanning
- * up the LRU list to find entries to evict.
+ * free up at least 4 KB of space. To do this, it starts scanning
+ * up the LRU list to find entries to evict.
*
* (VET, 0) is at the bottom of the LRU list, and thus is the first
- * entry considered. However, it is dirty, so it flushed to disk,
+ * entry considered. However, it is dirty, so it flushed to disk,
* moved to the top of the LRU list, and marked clean.
*
* (VET, 9) is the next entry on the bottom of the LRU list. It is
- * dirty too, calls its serialize callback function to construct an
+ * dirty too, calls its serialize callback function to construct an
* on disk image of the entry, and moves it to the top of the LRU
* list after the serialize callback returns.
*
* However, (VET 9)'s serialize function needs to modify (VET, 8),
* which is currently not in cache. Thus it calls H5C_protect(VET, 8)
- * to gain access to it. H5C_protect(VET, 8) loads (VET, 8), and
- * then attempts to evict entries to make space for it.
+ * to gain access to it. H5C_protect(VET, 8) loads (VET, 8), and
+ * then attempts to evict entries to make space for it.
*
* However, H5C_make_space_in_cache() now exits without taking
* any action on re-entrant calls. Thus H5C_protect(VET, 8) simply
@@ -10570,12 +10158,12 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
* and are therefore flushed and moved to the head of the LRU list.
*
* The next entry on the bottom of the LRU list is (VET, 0), which
- * is clean, and is therefore evicted, leaving H5C_make_space_in_cache()
+ * is clean, and is therefore evicted, leaving H5C_make_space_in_cache()
* with 4 KB of space to create.
*
- * This space is sufficient, so H5C_protect(VET, 8) inserts
- * (VET, 8) into the cache's index, marks it as protected, and
- * returns to the serialize function for (VET, 9).
+ * This space is sufficient, so H5C_protect(VET, 8) inserts
+ * (VET, 8) into the cache's index, marks it as protected, and
+ * returns to the serialize function for (VET, 9).
*
* When the serialize function for (VET, 9) is done with (VET, 8), it
* calls H5C_unprotect(VET, 8), which markes (VET, 8) as dirty and
@@ -10585,104 +10173,95 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
* evicted -- leaving 6 KB of free space after (LET, 11) is inserted
* into the cache.
*
- * H5C_unprotect(LET, 11) marks (LET, 11) as unprotected, and then
- * returns as well.
- *
- * The following table shows the expected states of the variable
- * size entries after the test.
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (VET, 0) N 10 KB N N - -
- *
- * (VET, 1) N 2.5 KB N N - -
- *
- * (VET, 2) N 10 KB N N - -
- *
- * (VET, 3) N 2.5 KB N N - -
- *
- * (VET, 4) N 10 KB N N - -
- *
- * (VET, 5) N 5 KB N N - -
- *
- * (VET, 6) N 5 KB N N - -
- *
- * (VET, 7) N 5 KB N N - -
- *
- * (VET, 8) Y 10 KB N N - -
- *
- * (VET, 9) N 10 KB N N - -
- *
- * Start by updating the expected table for the expected changes in
- * entry status:
- *
- * Note that we reset the loaded, flushed, and destroyed
- * fields of (VET,8) so we can track what is happening.
- */
- base_addr = entries[VARIABLE_ENTRY_TYPE];
- entry_ptr = &(base_addr[8]);
- entry_ptr->deserialized = FALSE;
- entry_ptr->deserialized = FALSE;
- entry_ptr->destroyed = FALSE;
-
- expected[0].in_cache = FALSE;
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].destroyed = TRUE;
- expected[8].in_cache = TRUE;
- expected[8].is_dirty = FALSE;
- expected[8].deserialized = TRUE;
- expected[8].serialized = TRUE;
- expected[8].destroyed = FALSE;
- expected[9].in_cache = FALSE;
- expected[9].is_dirty = FALSE;
- expected[9].serialized = TRUE;
- expected[9].destroyed = TRUE;
-
- expected[10].in_cache = TRUE;
- expected[10].is_dirty = FALSE;
- expected[10].serialized = TRUE;
- expected[10].destroyed = FALSE;
+ * H5C_unprotect(LET, 11) marks (LET, 11) as unprotected, and then
+ * returns as well.
+ *
+ * The following table shows the expected states of the variable
+ * size entries after the test.
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (VET, 0) N 10 KB N N - -
+ *
+ * (VET, 1) N 2.5 KB N N - -
+ *
+ * (VET, 2) N 10 KB N N - -
+ *
+ * (VET, 3) N 2.5 KB N N - -
+ *
+ * (VET, 4) N 10 KB N N - -
+ *
+ * (VET, 5) N 5 KB N N - -
+ *
+ * (VET, 6) N 5 KB N N - -
+ *
+ * (VET, 7) N 5 KB N N - -
+ *
+ * (VET, 8) Y 10 KB N N - -
+ *
+ * (VET, 9) N 10 KB N N - -
+ *
+ * Start by updating the expected table for the expected changes in
+ * entry status:
+ *
+ * Note that we reset the loaded, flushed, and destroyed
+ * fields of (VET,8) so we can track what is happening.
+ */
+ base_addr = entries[VARIABLE_ENTRY_TYPE];
+ entry_ptr = &(base_addr[8]);
+ entry_ptr->deserialized = FALSE;
+ entry_ptr->deserialized = FALSE;
+ entry_ptr->destroyed = FALSE;
+
+ expected[0].in_cache = FALSE;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].destroyed = TRUE;
+ expected[8].in_cache = TRUE;
+ expected[8].is_dirty = FALSE;
+ expected[8].deserialized = TRUE;
+ expected[8].serialized = TRUE;
+ expected[8].destroyed = FALSE;
+ expected[9].in_cache = FALSE;
+ expected[9].is_dirty = FALSE;
+ expected[9].serialized = TRUE;
+ expected[9].destroyed = TRUE;
+
+ expected[10].in_cache = TRUE;
+ expected[10].is_dirty = FALSE;
+ expected[10].serialized = TRUE;
+ expected[10].destroyed = FALSE;
num_large_entries = 12;
- for (i = num_variable_entries;
- i < num_variable_entries + num_monster_entries + num_large_entries - 1;
- i++)
- {
+ for (i = num_variable_entries; i < num_variable_entries + num_monster_entries + num_large_entries - 1;
+ i++) {
expected[i].is_dirty = FALSE;
- expected[i].serialized = TRUE;
- }
+ expected[i].serialized = TRUE;
+ }
- for (i = 10; i < 12; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 10; i < 12; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
/* verify cache size */
- if((cache_ptr->index_len != 44) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (2 * 1024) -
- (1 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (12 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 44) ||
+ (cache_ptr->index_size != (2 * 1024 * 1024) - (2 * 1024) - (1 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size !=
+ ((1 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (12 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 11.";
- }
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 11.";
+ }
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 9,
- (num_variable_entries + num_monster_entries +
- num_large_entries),
- expected);
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 9, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
}
- if(pass) {
+ if (pass) {
/* protect and unprotect VET 9 to evict MET 0 */
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9);
@@ -10692,92 +10271,81 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
* top of the LRU. Since we are dirtying it again, reset its
* serialized flag.
*/
- base_addr = entries[VARIABLE_ENTRY_TYPE];
- entry_ptr = &(base_addr[8]);
+ base_addr = entries[VARIABLE_ENTRY_TYPE];
+ entry_ptr = &(base_addr[8]);
entry_ptr->serialized = FALSE;
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8, H5C__DIRTIED_FLAG);
-
/* Again, touch all the non VARIABLE_ENTRY_TYPE entries in the
- * cache to evict VET 9 and move VET 8 to the bottom of the LRU.
+ * cache to evict VET 9 and move VET 8 to the bottom of the LRU.
*
* Must do this twice to get the desired result.
- */
-
+ */
/* skip MET 0 in first pass so that we evict VET 9 when we
* reload MET 0
*
* Since we are reloading MET 0, reset its destroyed flag.
*/
- base_addr = entries[MONSTER_ENTRY_TYPE];
- entry_ptr = &(base_addr[0]);
+ base_addr = entries[MONSTER_ENTRY_TYPE];
+ entry_ptr = &(base_addr[0]);
entry_ptr->destroyed = FALSE;
- for (i = 1; i < num_monster_entries; i++)
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ for (i = 1; i < num_monster_entries; i++) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
- for (i = 0; i < num_large_entries; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 0; i < num_large_entries; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
- for (i = 0; i < num_monster_entries; i++)
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ for (i = 0; i < num_monster_entries; i++) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
- for (i = 0; i < num_large_entries; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 0; i < num_large_entries; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
- /* update the expected array to mark all these entries dirty again. */
- for (i = num_variable_entries;
- i < num_variable_entries + num_monster_entries + num_large_entries - 1;
- i++)
- {
+ /* update the expected array to mark all these entries dirty again. */
+ for (i = num_variable_entries; i < num_variable_entries + num_monster_entries + num_large_entries - 1;
+ i++) {
expected[i].is_dirty = TRUE;
- }
+ }
/* update MET 0 to set its in cache flag, and reset
* its destroyed flag
*/
- expected[10].in_cache = TRUE;
+ expected[10].in_cache = TRUE;
/* pass through non variable entries will flush VET 8, and evict VET 9.
* Update accordingly.
*/
- expected[8].in_cache = TRUE;
- expected[8].is_dirty = TRUE;
- expected[8].serialized = FALSE;
- expected[8].destroyed = FALSE;
- expected[9].in_cache = FALSE;
- expected[9].is_dirty = FALSE;
- expected[9].serialized = TRUE;
- expected[9].destroyed = TRUE;
-
+ expected[8].in_cache = TRUE;
+ expected[8].is_dirty = TRUE;
+ expected[8].serialized = FALSE;
+ expected[8].destroyed = FALSE;
+ expected[9].in_cache = FALSE;
+ expected[9].is_dirty = FALSE;
+ expected[9].serialized = TRUE;
+ expected[9].destroyed = TRUE;
/* verify cache size */
- if((cache_ptr->index_len != 44) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (5 * VARIABLE_ENTRY_SIZE) +
- (11 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE) +
- (12 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 44) ||
+ (cache_ptr->index_size !=
+ (2 * 1024 * 1024) - (5 * VARIABLE_ENTRY_SIZE) + (11 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size !=
+ ((1 * VARIABLE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE) + (12 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 12.";
- }
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 12.";
+ }
/* modifications to the H5C__flush_single_entry() function have
* changed the behavior of the cache slightly, causing
@@ -10785,88 +10353,81 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
* fix if all goes well.
*/
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 10,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 10, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
}
- if(pass) {
+ if (pass) {
/* Load two more large entries.
- *
- * Since (VET, 8) is dirty, at first this will just cause (VET, 8)
- * to be flushed.
- *
- * But all other entries in the cache are dirty, so the cache will
- * flush them all, and then evict (VET, 8) on the second pass.
- *
- * The following table shows the expected states of the variable
- * size entries after the test.
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (VET, 0) N 10 KB N N - -
- *
- * (VET, 1) N 2.5 KB N N - -
- *
- * (VET, 2) N 10 KB N N - -
- *
- * (VET, 3) N 2.5 KB N N - -
- *
- * (VET, 4) N 10 KB N N - -
- *
- * (VET, 5) N 5 KB N N - -
- *
- * (VET, 6) N 5 KB N N - -
- *
- * (VET, 7) N 5 KB N N - -
- *
- * (VET, 8) N 10 KB N N - -
- *
- * (VET, 9) N 10 KB N N - -
- *
- * Start by updating the expected table for the expected changes in
- * entry status:
- */
-
- expected[8].in_cache = FALSE;
- expected[8].is_dirty = FALSE;
- expected[8].serialized = TRUE;
- expected[8].destroyed = TRUE;
+ *
+ * Since (VET, 8) is dirty, at first this will just cause (VET, 8)
+ * to be flushed.
+ *
+ * But all other entries in the cache are dirty, so the cache will
+ * flush them all, and then evict (VET, 8) on the second pass.
+ *
+ * The following table shows the expected states of the variable
+ * size entries after the test.
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (VET, 0) N 10 KB N N - -
+ *
+ * (VET, 1) N 2.5 KB N N - -
+ *
+ * (VET, 2) N 10 KB N N - -
+ *
+ * (VET, 3) N 2.5 KB N N - -
+ *
+ * (VET, 4) N 10 KB N N - -
+ *
+ * (VET, 5) N 5 KB N N - -
+ *
+ * (VET, 6) N 5 KB N N - -
+ *
+ * (VET, 7) N 5 KB N N - -
+ *
+ * (VET, 8) N 10 KB N N - -
+ *
+ * (VET, 9) N 10 KB N N - -
+ *
+ * Start by updating the expected table for the expected changes in
+ * entry status:
+ */
+
+ expected[8].in_cache = FALSE;
+ expected[8].is_dirty = FALSE;
+ expected[8].serialized = TRUE;
+ expected[8].destroyed = TRUE;
num_large_entries = 14;
- /* a newly loaded entry is not inserted in the cache until after
- * space has been made for it. Thus (LET, 13) will not be flushed.
- */
- for (i = num_variable_entries;
- i < num_variable_entries + num_monster_entries + num_large_entries - 1;
- i++)
- {
+ /* a newly loaded entry is not inserted in the cache until after
+ * space has been made for it. Thus (LET, 13) will not be flushed.
+ */
+ for (i = num_variable_entries; i < num_variable_entries + num_monster_entries + num_large_entries - 1;
+ i++) {
expected[i].is_dirty = FALSE;
- expected[i].serialized = TRUE;
- }
+ expected[i].serialized = TRUE;
+ }
- for (i = 12; i < 14; i++)
- {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
+ for (i = 12; i < 14; i++) {
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
+ }
/* verify cache size */
- if((cache_ptr->index_len != 45) ||
- (cache_ptr->index_size != (2 * 1024 * 1024) -
- (6 * VARIABLE_ENTRY_SIZE) +
- (13 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->index_size != ((31 * MONSTER_ENTRY_SIZE) +
- (14 * LARGE_ENTRY_SIZE)))) {
+ if ((cache_ptr->index_len != 45) ||
+ (cache_ptr->index_size !=
+ (2 * 1024 * 1024) - (6 * VARIABLE_ENTRY_SIZE) + (13 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->index_size != ((31 * MONSTER_ENTRY_SIZE) + (14 * LARGE_ENTRY_SIZE)))) {
- pass = FALSE;
- failure_mssg = "unexpected size/len in flush op eviction test 13.";
- }
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in flush op eviction test 13.";
+ }
/* modifications to the H5C__flush_single_entry() function have
* changed the behavior of the cache slightly, causing
@@ -10874,11 +10435,9 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
* fix if all goes well.
*/
- /* verify entry status */
- verify_entry_status(cache_ptr,
- 11,
- (num_variable_entries + num_monster_entries + num_large_entries),
- expected);
+ /* verify entry status */
+ verify_entry_status(cache_ptr, 11, (num_variable_entries + num_monster_entries + num_large_entries),
+ expected);
}
/* at this point we have cycled all the variable size entries through
@@ -10887,18 +10446,15 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
* flush the cache and end the test.
*/
- if(pass) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
- "Cache flush invalidate failed after flush op eviction test")
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG,
+ "Cache flush invalidate failed after flush op eviction test")
- if ( ( pass ) &&
- ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) ) {
+ if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test";
-
}
}
@@ -10911,95 +10467,89 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
* to start testing the stats whenever it is convenient to do
* so.
*/
- if(pass) {
-
- if((cache_ptr->insertions[VARIABLE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_insertions[VARIABLE_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[VARIABLE_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[VARIABLE_ENTRY_TYPE] != 9) ||
- (cache_ptr->evictions[VARIABLE_ENTRY_TYPE] != 12) ||
- (cache_ptr->take_ownerships[VARIABLE_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[VARIABLE_ENTRY_TYPE] != 1) ||
- (cache_ptr->entry_flush_moves[VARIABLE_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[VARIABLE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[VARIABLE_ENTRY_TYPE] != 2) ||
- (cache_ptr->unpins[VARIABLE_ENTRY_TYPE] != 2) ||
- (cache_ptr->dirty_pins[VARIABLE_ENTRY_TYPE] != 2) ||
- (cache_ptr->pinned_flushes[VARIABLE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[VARIABLE_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[VARIABLE_ENTRY_TYPE] != 3) ||
- (cache_ptr->size_decreases[VARIABLE_ENTRY_TYPE] != 6) ||
- (cache_ptr->entry_flush_size_changes[VARIABLE_ENTRY_TYPE] != 1) ||
- (cache_ptr->cache_flush_size_changes[VARIABLE_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
- failure_mssg = "Unexpected variable size entry stats in check_flush_cache__flush_op_eviction_test().";
- }
- }
-
- if(pass) {
-
- if((cache_ptr->insertions[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_insertions[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[LARGE_ENTRY_TYPE] != 25) ||
- (cache_ptr->evictions[LARGE_ENTRY_TYPE] != 14) ||
- (cache_ptr->take_ownerships[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[LARGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[LARGE_ENTRY_TYPE] != 0)) {
+ if (pass) {
+
+ if ((cache_ptr->insertions[VARIABLE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_insertions[VARIABLE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[VARIABLE_ENTRY_TYPE] != 0) || (cache_ptr->flushes[VARIABLE_ENTRY_TYPE] != 9) ||
+ (cache_ptr->evictions[VARIABLE_ENTRY_TYPE] != 12) ||
+ (cache_ptr->take_ownerships[VARIABLE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[VARIABLE_ENTRY_TYPE] != 1) ||
+ (cache_ptr->entry_flush_moves[VARIABLE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[VARIABLE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[VARIABLE_ENTRY_TYPE] != 2) || (cache_ptr->unpins[VARIABLE_ENTRY_TYPE] != 2) ||
+ (cache_ptr->dirty_pins[VARIABLE_ENTRY_TYPE] != 2) ||
+ (cache_ptr->pinned_flushes[VARIABLE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[VARIABLE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[VARIABLE_ENTRY_TYPE] != 3) ||
+ (cache_ptr->size_decreases[VARIABLE_ENTRY_TYPE] != 6) ||
+ (cache_ptr->entry_flush_size_changes[VARIABLE_ENTRY_TYPE] != 1) ||
+ (cache_ptr->cache_flush_size_changes[VARIABLE_ENTRY_TYPE] != 0)) {
pass = FALSE;
+ failure_mssg =
+ "Unexpected variable size entry stats in check_flush_cache__flush_op_eviction_test().";
+ }
+ }
+
+ if (pass) {
+
+ if ((cache_ptr->insertions[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_insertions[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[LARGE_ENTRY_TYPE] != 0) || (cache_ptr->flushes[LARGE_ENTRY_TYPE] != 25) ||
+ (cache_ptr->evictions[LARGE_ENTRY_TYPE] != 14) ||
+ (cache_ptr->take_ownerships[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[LARGE_ENTRY_TYPE] != 0) || (cache_ptr->unpins[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->dirty_pins[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[LARGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[LARGE_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected large entry stats in check_flush_cache__flush_op_eviction_test().";
}
}
- if(pass) {
-
- if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 62) ||
- (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
+ if (pass) {
- pass = FALSE;
+ if ((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 62) ||
+ (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster entry stats in check_flush_cache__flush_op_eviction_test().";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass) {
+ if (pass) {
- reset_entries();
+ reset_entries();
}
return;
} /* check_flush_cache__flush_op_eviction_test() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_cache__single_entry()
*
@@ -11024,26 +10574,24 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
*/
static void
-check_flush_cache__single_entry(H5F_t * file_ptr)
+check_flush_cache__single_entry(H5F_t *file_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
+ H5C_t *cache_ptr = file_ptr->shared->cache;
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to single entry case.";
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not empty at beginning of single entry case.";
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 1,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11053,14 +10601,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 2,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11070,14 +10616,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_deserialized */ TRUE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 3,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11087,14 +10631,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 4,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11104,14 +10646,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 5,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11121,14 +10661,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 6,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11138,14 +10676,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 7,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11155,14 +10691,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 8,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11172,160 +10706,134 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 9,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 10,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__DIRTIED_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 11,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 12,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__DIRTIED_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 13,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 14,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__DIRTIED_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 15,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 16,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__DIRTIED_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 17,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11335,14 +10843,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 18,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11352,14 +10858,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_deserialized */ TRUE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 19,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11369,14 +10873,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 20,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11386,14 +10888,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 21,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11403,14 +10903,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 22,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11420,14 +10918,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 23,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11437,14 +10933,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 24,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11454,160 +10948,134 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 25,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 26,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 27,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 28,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 29,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 30,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 31,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 32,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ FALSE,
/* flags */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ TRUE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 33,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11617,14 +11085,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 34,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11634,14 +11100,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 35,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11651,14 +11115,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 36,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11668,14 +11130,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 37,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11685,14 +11145,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 38,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11702,14 +11160,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 39,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11719,14 +11175,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 40,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11736,160 +11190,134 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 41,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 42,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 43,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 44,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 45,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 46,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 47,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 48,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__NO_FLAGS_SET,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 49,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11899,14 +11327,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 50,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11916,14 +11342,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 51,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11933,14 +11357,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 52,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11950,14 +11372,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 53,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11967,14 +11387,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 54,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -11984,14 +11402,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 55,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -12001,14 +11417,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 56,
/* entry_type */ PICO_ENTRY_TYPE,
@@ -12018,157 +11432,131 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 57,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 58,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 59,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 60,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ FALSE
- );
+ /* expected_destroyed */ FALSE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 61,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 62,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG,
+ /* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_INVALIDATE_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ TRUE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 63,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
- if(pass) {
+ if (pass) {
- check_flush_cache__single_entry_test
- (
+ check_flush_cache__single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ 64,
/* entry_type */ PICO_ENTRY_TYPE,
/* entry_idx */ 0,
/* insert_flag */ TRUE,
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
- /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_MARKED_ENTRIES_FLAG,
+ /* flush_flags */ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_deserialized */ FALSE,
/* expected_serialized */ FALSE,
- /* expected_destroyed */ TRUE
- );
+ /* expected_destroyed */ TRUE);
}
-
/* Now run single entry tests for pinned entries. Test all combinations
* of:
*
@@ -12228,314 +11616,565 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
* H5C__SET_FLUSH_MARKER_FLAG apply here as well.
*/
- if(pass) {
-
- int i;
- struct pinned_single_entry_test_spec
- {
- int test_num;
- int entry_type;
- int entry_idx;
- hbool_t dirty_flag;
- hbool_t mark_dirty;
- hbool_t pop_mark_dirty_prot;
- hbool_t pop_mark_dirty_pinned;
- hbool_t unprotect_unpin;
- unsigned int flags;
- unsigned int flush_flags;
- hbool_t expected_serialized;
- hbool_t expected_destroyed;
- } spec[256] =
- /* pop pop
- * ent unprot mark mark
- * test entry -ry dirty mark dirty dirty unprot flush expect expect
- * num type idx flag dirty prot pinned unpin flags flags srlzd destroy
- */
- { { 1, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, FALSE, FALSE },
- { 2, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, FALSE, FALSE },
- { 3, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 4, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 5, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 6, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 7, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 8, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 9, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 10, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 11, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 12, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 13, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 14, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 15, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 16, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 17, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 18, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 19, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 20, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 21, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 22, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 23, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 24, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 25, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 26, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 27, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 28, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 29, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 30, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 31, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 32, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 33, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, FALSE, FALSE },
- { 34, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, FALSE, FALSE },
- { 35, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 36, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 37, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 38, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 39, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 40, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 41, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 42, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 43, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 44, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 45, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 46, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 47, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 48, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 49, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 50, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 51, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 52, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 53, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 54, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 55, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 56, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 57, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 58, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 59, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 60, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 61, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 62, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 63, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 64, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE },
- { 65, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 66, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 67, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 68, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 69, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 70, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 71, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 72, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 73, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 74, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 75, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 76, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 77, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 78, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 79, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 80, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 81, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 82, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 83, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 84, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 85, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 86, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 87, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 88, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 89, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 90, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 91, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 92, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 93, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 94, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 95, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 96, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 97, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 98, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 99, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 100, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 101, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 102, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 103, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 104, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 105, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 106, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 107, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 108, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE },
- { 109, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 110, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 111, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 112, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 113, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 114, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 115, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 116, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 117, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 118, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 119, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 120, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 121, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 122, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 123, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 124, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 125, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 126, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 127, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 128, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE },
- { 129, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 130, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 131, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 132, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 133, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 134, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 135, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 136, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 137, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 138, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 139, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 140, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 141, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 142, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 143, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 144, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 145, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 146, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 147, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 148, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 149, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 150, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 151, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 152, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 153, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 154, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 155, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 156, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 157, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 158, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 159, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 160, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 161, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 162, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 163, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 164, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 165, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 166, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 167, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 168, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 169, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 170, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 171, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 172, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 173, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 174, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 175, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 176, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 177, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 178, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 179, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 180, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 181, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 182, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 183, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 184, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 185, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 186, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 187, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 188, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 189, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 190, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 191, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 192, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 193, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 194, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 195, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 196, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 197, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 198, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 199, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 200, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 201, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 202, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 203, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 204, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 205, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 206, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 207, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 208, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 209, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 210, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 211, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 212, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 213, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 214, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 215, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 216, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 217, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 218, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 219, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 220, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 221, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 222, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 223, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 224, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 225, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 226, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 227, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 228, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 229, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 230, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 231, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 232, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 233, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 234, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 235, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 236, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 237, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 238, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 239, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 240, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 241, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 242, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 243, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 244, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 245, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 246, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 247, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 248, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 249, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 250, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 251, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 252, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 253, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 254, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 255, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE },
- { 256, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE } };
+ if (pass) {
+
+ int i;
+ struct pinned_single_entry_test_spec {
+ int test_num;
+ int entry_type;
+ int entry_idx;
+ hbool_t dirty_flag;
+ hbool_t mark_dirty;
+ hbool_t pop_mark_dirty_prot;
+ hbool_t pop_mark_dirty_pinned;
+ hbool_t unprotect_unpin;
+ unsigned int flags;
+ unsigned int flush_flags;
+ hbool_t expected_serialized;
+ hbool_t expected_destroyed;
+ } spec[256] =
+ /* pop pop
+ * ent unprot mark mark
+ * test entry -ry dirty mark dirty dirty unprot flush expect expect num type
+ * idx flag dirty prot pinned unpin flags flags srlzd destroy
+ */
+ {{1, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ FALSE, FALSE},
+ {2, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ FALSE, FALSE},
+ {3, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {4, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {5, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {6, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {7, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {8, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {9, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {10, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {11, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {12, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {13, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {14, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {15, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {16, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {17, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {18, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {19, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {20, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {21, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {22, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {23, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {24, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {25, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {26, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {27, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {28, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {29, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {30, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {31, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {32, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET,
+ TRUE, FALSE},
+ {33, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, FALSE, FALSE},
+ {34, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, FALSE, FALSE},
+ {35, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {36, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {37, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {38, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {39, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {40, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {41, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {42, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {43, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {44, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {45, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {46, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {47, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {48, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {49, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {50, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {51, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {52, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {53, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {54, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {55, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {56, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {57, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {58, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {59, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {60, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {61, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {62, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {63, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {64, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__NO_FLAGS_SET, TRUE, FALSE},
+ {65, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {66, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {67, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {68, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {69, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {70, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {71, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {72, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {73, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {74, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {75, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {76, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {77, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {78, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {79, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {80, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {81, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {82, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {83, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {84, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {85, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {86, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {87, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {88, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {89, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {90, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {91, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {92, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {93, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {94, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {95, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {96, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {97, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {98, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {99, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {100, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {101, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {102, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {103, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {104, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {105, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {106, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {107, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {108, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE},
+ {109, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {110, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {111, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {112, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {113, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {114, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {115, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {116, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {117, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {118, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {119, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {120, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {121, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {122, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {123, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {124, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {125, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {126, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {127, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {128, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE},
+ {129, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {130, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {131, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {132, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {133, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {134, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {135, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {136, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {137, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {138, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {139, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {140, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {141, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {142, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {143, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {144, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {145, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {146, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {147, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {148, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {149, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {150, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {151, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {152, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {153, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {154, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {155, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {156, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {157, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {158, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {159, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {160, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {161, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {162, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {163, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {164, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {165, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {166, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {167, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {168, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {169, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {170, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {171, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {172, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {173, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {174, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {175, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {176, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {177, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {178, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {179, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {180, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {181, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {182, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {183, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {184, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {185, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {186, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {187, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {188, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {189, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {190, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {191, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {192, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {193, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {194, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {195, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {196, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {197, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {198, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {199, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {200, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {201, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {202, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {203, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {204, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {205, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {206, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {207, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {208, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {209, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {210, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {211, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {212, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {213, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {214, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {215, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {216, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {217, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {218, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {219, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {220, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {221, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {222, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {223, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {224, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {225, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {226, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {227, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {228, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {229, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {230, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {231, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {232, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {233, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {234, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {235, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {236, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {237, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {238, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {239, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {240, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {241, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {242, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {243, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {244, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {245, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {246, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {247, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {248, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {249, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {250, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {251, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {252, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {253, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {254, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {255, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE},
+ {256, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE}};
- i = 0;
- while(pass && (i < 256))
- {
- check_flush_cache__pinned_single_entry_test
- (
+ i = 0;
+ while (pass && (i < 256)) {
+ check_flush_cache__pinned_single_entry_test(
/* file_ptr */ file_ptr,
/* test_num */ spec[i].test_num,
/* entry_type */ spec[i].entry_type,
/* entry_idx */ spec[i].entry_idx,
/* dirty_flag */ spec[i].dirty_flag,
- /* mark_dirty */ spec[i].mark_dirty,
+ /* mark_dirty */ spec[i].mark_dirty,
/* pop_mark_dirty_prot */ spec[i].pop_mark_dirty_prot,
/* pop_mark_dirty_pinned */ spec[i].pop_mark_dirty_pinned,
- /* unprotect_unpin */ spec[i].unprotect_unpin,
+ /* unprotect_unpin */ spec[i].unprotect_unpin,
/* flags */ spec[i].flags,
/* flush_flags */ spec[i].flush_flags,
/* expected_serialized */ spec[i].expected_serialized,
- /* expected_destroyed */ spec[i].expected_destroyed
- );
- i++;
- }
+ /* expected_destroyed */ spec[i].expected_destroyed);
+ i++;
+ }
}
return;
} /* check_flush_cache__single_entry() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_cache__single_entry_test()
*
@@ -12558,61 +12197,46 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
*/
static void
-check_flush_cache__single_entry_test(H5F_t * file_ptr,
- int test_num,
- int entry_type,
- int entry_idx,
- hbool_t insert_flag,
- unsigned int flags,
- unsigned int flush_flags,
- hbool_t expected_deserialized,
- hbool_t expected_serialized,
+check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_type, int entry_idx,
+ hbool_t insert_flag, unsigned int flags, unsigned int flush_flags,
+ hbool_t expected_deserialized, hbool_t expected_serialized,
hbool_t expected_destroyed)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
- static char msg[128];
- test_entry_t * base_addr;
- test_entry_t * entry_ptr = NULL;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
+ static char msg[128];
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr = NULL;
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache_ptr NULL on entry to single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache_ptr NULL on entry to single entry test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache not empty at beginning of single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache not empty at beginning of single entry test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( entry_type < 0 ) ||
- ( entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
- ( entry_idx < 0 ) ||
- ( entry_idx > max_indices[entry_type] ) ) {
+ else if ((entry_type < 0) || (entry_type >= NUMBER_OF_ENTRY_TYPES) || (entry_idx < 0) ||
+ (entry_idx > max_indices[entry_type])) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Bad parameters on entry to single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Bad parameters on entry to single entry test #%d.", test_num);
failure_mssg = msg;
}
- if(pass) {
+ if (pass) {
base_addr = entries[entry_type];
entry_ptr = &(base_addr[entry_idx]);
- if(insert_flag) {
+ if (insert_flag) {
insert_entry(file_ptr, entry_type, entry_idx, flags);
-
- } else {
+ }
+ else {
protect_entry(file_ptr, entry_type, entry_idx);
@@ -12620,21 +12244,20 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
}
}
- if(pass) {
+ if (pass) {
H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure mssg.")
- if ( ! pass ) { /* construct and set actual failure message */
+ if (!pass) { /* construct and set actual failure message */
- HDsnprintf(msg, (size_t)128,
- "flush with flags 0x%x failed in single entry test #%d.",
+ HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in single entry test #%d.",
flush_flags, test_num);
failure_mssg = msg;
}
- else if ( ( entry_ptr->deserialized != expected_deserialized ) ||
- ( entry_ptr->serialized != expected_serialized ) ||
- ( entry_ptr->destroyed != expected_destroyed ) ) {
+ else if ((entry_ptr->deserialized != expected_deserialized) ||
+ (entry_ptr->serialized != expected_serialized) ||
+ (entry_ptr->destroyed != expected_destroyed)) {
#if 0 /* This is useful debugging code -- lets keep it for a while */
@@ -12648,60 +12271,40 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
(int)expected_destroyed);
#endif
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected entry status after flush in single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected entry status after flush in single entry test #%d.",
+ test_num);
failure_mssg = msg;
}
- else if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
- &&
- ( ( cache_ptr->index_len != 1 )
- ||
- ( cache_ptr->index_size != entry_sizes[entry_type] )
- )
- )
- ||
- ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0)
- &&
- ( ( cache_ptr->index_len != 0 )
- ||
- ( cache_ptr->index_size != 0 )
- )
- )
- ) {
+ else if ((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) &&
+ ((cache_ptr->index_len != 1) || (cache_ptr->index_size != entry_sizes[entry_type]))) ||
+ (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) &&
+ ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size after flush in single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected cache len/size after flush in single entry test #%d.",
+ test_num);
failure_mssg = msg;
}
}
-
/* clean up the cache to prep for the next test */
- if(pass) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
- "dummy failure mssg.")
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy failure mssg.")
- if ( ! pass ) { /* construct and set actual failure message */
+ if (!pass) { /* construct and set actual failure message */
- HDsnprintf(msg, (size_t)128,
- "Flush failed on cleanup in single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in single entry test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size after cleanup in single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected cache len/size after cleanup in single entry test #%d.",
+ test_num);
failure_mssg = msg;
-
- } else {
+ }
+ else {
entry_ptr->deserialized = FALSE;
entry_ptr->serialized = FALSE;
@@ -12713,7 +12316,6 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
} /* check_flush_cache__single_entry_test() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_cache__pinned_single_entry_test()
*
@@ -12743,94 +12345,80 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
*/
static void
-check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
- int test_num,
- int entry_type,
- int entry_idx,
- hbool_t unprot_dirty_flag,
- hbool_t mark_dirty,
- hbool_t pop_mark_dirty_prot,
- hbool_t pop_mark_dirty_pinned,
- hbool_t unprotect_unpin,
- unsigned int flags,
- unsigned int flush_flags,
- hbool_t expected_serialized,
+check_flush_cache__pinned_single_entry_test(H5F_t *file_ptr, int test_num, int entry_type, int entry_idx,
+ hbool_t unprot_dirty_flag, hbool_t mark_dirty,
+ hbool_t pop_mark_dirty_prot, hbool_t pop_mark_dirty_pinned,
+ hbool_t unprotect_unpin, unsigned int flags,
+ unsigned int flush_flags, hbool_t expected_serialized,
hbool_t expected_destroyed)
{
H5C_t * cache_ptr = file_ptr->shared->cache;
- static char msg[128];
- hbool_t expected_deserialized = TRUE;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr = NULL;
+ static char msg[128];
+ hbool_t expected_deserialized = TRUE;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr = NULL;
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache_ptr NULL on entry to pinned single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache_ptr NULL on entry to pinned single entry test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache not empty at beginning of pinned single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache not empty at beginning of pinned single entry test #%d.",
+ test_num);
failure_mssg = msg;
}
- else if ( (entry_type < 0) || (entry_type >= NUMBER_OF_ENTRY_TYPES) ||
- (entry_idx < 0) || (entry_idx > max_indices[entry_type])) {
+ else if ((entry_type < 0) || (entry_type >= NUMBER_OF_ENTRY_TYPES) || (entry_idx < 0) ||
+ (entry_idx > max_indices[entry_type])) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Bad parameters on entry to pinned single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Bad parameters on entry to pinned single entry test #%d.", test_num);
failure_mssg = msg;
}
- if(pass) {
+ if (pass) {
base_addr = entries[entry_type];
entry_ptr = &(base_addr[entry_idx]);
protect_entry(file_ptr, entry_type, entry_idx);
- if(pop_mark_dirty_prot) {
+ if (pop_mark_dirty_prot) {
mark_entry_dirty(entry_type, entry_idx);
}
unprotect_entry(file_ptr, entry_type, entry_idx,
- (unprot_dirty_flag ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) |
- (flags | H5C__PIN_ENTRY_FLAG));
+ (unprot_dirty_flag ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) |
+ (flags | H5C__PIN_ENTRY_FLAG));
- if(mark_dirty) {
+ if (mark_dirty) {
mark_entry_dirty(entry_type, entry_idx);
}
- if(pop_mark_dirty_pinned) {
+ if (pop_mark_dirty_pinned) {
mark_entry_dirty(entry_type, entry_idx);
}
}
- if(pass) {
+ if (pass) {
H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message\n")
- if ( ! pass ) { /* construct and set the correct failure message */
+ if (!pass) { /* construct and set the correct failure message */
- HDsnprintf(msg, (size_t)128,
- "flush with flags 0x%x failed in pinned single entry test #%d.",
- flush_flags, test_num);
+ HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in pinned single entry test #%d.",
+ flush_flags, test_num);
failure_mssg = msg;
}
- else if ( ( entry_ptr->deserialized != expected_deserialized ) ||
- ( entry_ptr->serialized != expected_serialized ) ||
- ( entry_ptr->destroyed != expected_destroyed ) ) {
+ else if ((entry_ptr->deserialized != expected_deserialized) ||
+ (entry_ptr->serialized != expected_serialized) ||
+ (entry_ptr->destroyed != expected_destroyed)) {
#if 0 /* this is useful debugging code -- keep it around */
HDfprintf(stdout,
@@ -12844,75 +12432,56 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
#endif
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "Unexpected entry status after flush in pinned single entry test #%d.",
- test_num);
+ "Unexpected entry status after flush in pinned single entry test #%d.", test_num);
failure_mssg = msg;
}
- else if ( ( ( ( flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 )
- &&
- ( ( cache_ptr->index_len != 1 )
- ||
- ( cache_ptr->index_size != entry_sizes[entry_type] )
- )
- )
- ||
- ( ( ( flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 )
- &&
- ( ( cache_ptr->index_len != 0 )
- ||
- ( cache_ptr->index_size != 0 )
- )
- )
- ) {
+ else if ((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) &&
+ ((cache_ptr->index_len != 1) || (cache_ptr->index_size != entry_sizes[entry_type]))) ||
+ (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) &&
+ ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size after flush in pinned single entry test #%d.",
- test_num);
+ "Unexpected cache len/size after flush in pinned single entry test #%d.", test_num);
failure_mssg = msg;
}
}
-
/* clean up the cache to prep for the next test */
- if(pass) {
+ if (pass) {
- if(unprotect_unpin) {
+ if (unprotect_unpin) {
protect_entry(file_ptr, entry_type, entry_idx);
unprotect_entry(file_ptr, entry_type, entry_idx,
- (unprot_dirty_flag ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) |
- H5C__UNPIN_ENTRY_FLAG);
-
- } else {
+ (unprot_dirty_flag ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) |
+ H5C__UNPIN_ENTRY_FLAG);
+ }
+ else {
unpin_entry(entry_type, entry_idx);
-
}
}
- if(pass) {
+ if (pass) {
H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg\n")
- if ( ! pass ) {
+ if (!pass) {
- HDsnprintf(msg, (size_t)128,
- "Flush failed on cleanup in pinned single entry test #%d.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in pinned single entry test #%d.",
+ test_num);
failure_mssg = msg;
}
- else if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "Unexpected cache len/size after cleanup in pinned single entry test #%d.",
- test_num);
+ "Unexpected cache len/size after cleanup in pinned single entry test #%d.", test_num);
failure_mssg = msg;
-
- } else {
+ }
+ else {
entry_ptr->deserialized = FALSE;
entry_ptr->serialized = FALSE;
@@ -12924,7 +12493,6 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
} /* check_flush_cache__pinned_single_entry_test() */
-
/*-------------------------------------------------------------------------
* Function: check_get_entry_status()
*
@@ -12945,59 +12513,56 @@ check_get_entry_status(unsigned paged)
{
static char msg[128];
herr_t result;
- hbool_t in_cache;
- hbool_t is_dirty;
- hbool_t is_protected;
- hbool_t is_pinned;
- size_t entry_size;
- H5F_t * file_ptr = NULL;
- test_entry_t * base_addr = NULL;
- test_entry_t * entry_ptr = NULL;
+ hbool_t in_cache;
+ hbool_t is_dirty;
+ hbool_t is_protected;
+ hbool_t is_pinned;
+ size_t entry_size;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *base_addr = NULL;
+ test_entry_t *entry_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("H5C_get_entry_status() functionality (paged aggregation)")
else
TESTING("H5C_get_entry_status() functionality")
pass = TRUE;
- if(pass) {
+ if (pass) {
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
- if(file_ptr == NULL) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "file_ptr NULL from setup_cache.";
-
}
else {
base_addr = entries[0];
entry_ptr = &(base_addr[0]);
-
}
}
- if(pass) {
+ if (pass) {
/* entry not in cache -- only in_cache should be touched by
* the call. Thus, only check that boolean.
*/
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 1.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 1.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 1.");
@@ -13005,27 +12570,25 @@ check_get_entry_status(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, 0, 0);
unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
-
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 2.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 2.");
failure_mssg = msg;
-
- } else if(!in_cache || is_dirty || is_protected || is_pinned) {
+ }
+ else if (!in_cache || is_dirty || is_protected || is_pinned) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 2.");
@@ -13033,25 +12596,23 @@ check_get_entry_status(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, 0, 0);
-
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 3.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 3.");
failure_mssg = msg;
-
- } else if(!in_cache || is_dirty || !is_protected || is_pinned) {
+ }
+ else if (!in_cache || is_dirty || !is_protected || is_pinned) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 3.");
@@ -13059,25 +12620,23 @@ check_get_entry_status(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
-
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 4.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 4.");
failure_mssg = msg;
-
- } else if(!in_cache || is_dirty || is_protected || !is_pinned) {
+ }
+ else if (!in_cache || is_dirty || is_protected || !is_pinned) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 4.");
@@ -13085,25 +12644,23 @@ check_get_entry_status(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
mark_entry_dirty(0, 0);
-
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 5.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 5.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || !is_pinned) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || !is_pinned) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 5.");
@@ -13111,25 +12668,23 @@ check_get_entry_status(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
unpin_entry(0, 0);
-
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 6.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 6.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || is_pinned) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || is_pinned) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 6.");
@@ -13137,24 +12692,27 @@ check_get_entry_status(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_get_entry_status() */
-
/*-------------------------------------------------------------------------
* Function: check_expunge_entry()
*
@@ -13176,23 +12734,23 @@ check_expunge_entry(unsigned paged)
{
static char msg[128];
herr_t result;
- hbool_t in_cache;
- hbool_t is_dirty;
- hbool_t is_protected;
- hbool_t is_pinned;
- size_t entry_size;
+ hbool_t in_cache;
+ hbool_t is_dirty;
+ hbool_t is_protected;
+ hbool_t is_pinned;
+ size_t entry_size;
H5F_t * file_ptr = NULL;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("H5C_expunge_entry() functionality (paged aggregation)")
else
TESTING("H5C_expunge_entry() functionality")
pass = TRUE;
- if(pass) {
+ if (pass) {
reset_entries();
@@ -13202,122 +12760,107 @@ check_expunge_entry(unsigned paged)
entry_ptr = &(base_addr[0]);
}
- if(pass) {
+ if (pass) {
/* entry not in cache -- only in_cache should be touched by
* the status call. Thus, only check that boolean.
*/
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected,
- &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 1.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 1.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 1.");
failure_mssg = msg;
-
- } else if((entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 1.");
failure_mssg = msg;
-
- }
+ }
}
/* protect an entry to force the cache to load it, and then unprotect
* it without marking it dirty.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, 0, 0);
unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
-
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 2.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 2.");
failure_mssg = msg;
-
- } else if(!in_cache || is_dirty || is_protected || is_pinned) {
+ }
+ else if (!in_cache || is_dirty || is_protected || is_pinned) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 2.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 2.");
failure_mssg = msg;
-
- }
+ }
}
/* Expunge the entry and then verify that it is no longer in the cache.
* Also verify that the entry was loaded and destroyed, but
* not flushed.
*/
- if(pass) {
+ if (pass) {
expunge_entry(file_ptr, 0, 0);
-
}
- if(pass) {
+ if (pass) {
/* entry shouldn't be in cache -- only in_cache should be touched
- * by the status call. Thus, only check that boolean.
+ * by the status call. Thus, only check that boolean.
*/
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 3.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 3.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 3.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (!entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (!entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 3.");
failure_mssg = msg;
-
- }
+ }
}
/* now repeat the process with a different entry. On unprotect
@@ -13327,144 +12870,130 @@ check_expunge_entry(unsigned paged)
base_addr = entries[0];
entry_ptr = &(base_addr[1]);
- if(pass) {
+ if (pass) {
/* entry not in cache -- only in_cache should be touched by
* the status call. Thus, only check that boolean.
*/
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected,
- &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 4.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 4.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 4.");
failure_mssg = msg;
-
- } else if((entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 4.");
failure_mssg = msg;
-
- }
+ }
}
/* protect the entry to force the cache to load it, and then unprotect
* it with the dirty flag set.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, 0, 1);
unprotect_entry(file_ptr, 0, 1, H5C__DIRTIED_FLAG);
-
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected,
- &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 5.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 5.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || is_pinned) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || is_pinned) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 5.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 5.");
failure_mssg = msg;
-
- }
+ }
}
/* Expunge the entry and then verify that it is no longer in the cache.
* Also verify that the entry was loaded and destroyed, but not
* flushed.
*/
- if(pass) {
+ if (pass) {
expunge_entry(file_ptr, 0, 1);
-
}
- if(pass) {
+ if (pass) {
/* entry shouldn't be in cache -- only in_cache should be touched
- * by the status call. Thus, only check that boolean.
+ * by the status call. Thus, only check that boolean.
*/
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected,
- &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 6.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 6.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 6.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (!entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (!entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 6.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_expunge_entry() */
-
/*-------------------------------------------------------------------------
* Function: check_multiple_read_protect()
*
@@ -13485,13 +13014,13 @@ check_expunge_entry(unsigned paged)
static unsigned
check_multiple_read_protect(unsigned paged)
{
- H5F_t * file_ptr = NULL;
+ H5F_t *file_ptr = NULL;
#if H5C_COLLECT_CACHE_STATS
- H5C_t * cache_ptr = NULL;
+ H5C_t *cache_ptr = NULL;
#endif /* H5C_COLLECT_CACHE_STATS */
- test_entry_t * entry_ptr;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("multiple read only protects on a single entry (paged aggr)")
else
TESTING("multiple read only protects on a single entry")
@@ -13519,7 +13048,7 @@ check_multiple_read_protect(unsigned paged)
* Also, verify internal state of read protects at every step.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -13530,261 +13059,227 @@ check_multiple_read_protect(unsigned paged)
entry_ptr = &((entries[0])[0]);
- if((entry_ptr->header.is_protected) ||
- (entry_ptr->header.is_read_only) ||
- (entry_ptr->header.ro_ref_count != 0)) {
+ if ((entry_ptr->header.is_protected) || (entry_ptr->header.is_read_only) ||
+ (entry_ptr->header.ro_ref_count != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 1.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 0) ||
- (cache_ptr->read_protects[0] != 0) ||
- (cache_ptr->max_read_protects[0] != 0)) {
+ if ((cache_ptr->write_protects[0] != 0) || (cache_ptr->read_protects[0] != 0) ||
+ (cache_ptr->max_read_protects[0] != 0)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 1.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 1.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
- {
+ if (pass) {
protect_entry_ro(file_ptr, 0, 0);
- if((!(entry_ptr->header.is_protected)) ||
- (!(entry_ptr->header.is_read_only)) ||
- (entry_ptr->header.ro_ref_count != 1)) {
+ if ((!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) ||
+ (entry_ptr->header.ro_ref_count != 1)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 2.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 0) ||
- (cache_ptr->read_protects[0] != 1) ||
- (cache_ptr->max_read_protects[0] != 1)) {
+ if ((cache_ptr->write_protects[0] != 0) || (cache_ptr->read_protects[0] != 1) ||
+ (cache_ptr->max_read_protects[0] != 1)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 2.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 2.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
- {
+ if (pass) {
protect_entry_ro(file_ptr, 0, 0);
- if((!(entry_ptr->header.is_protected)) ||
- (!(entry_ptr->header.is_read_only)) ||
- (entry_ptr->header.ro_ref_count != 2)) {
+ if ((!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) ||
+ (entry_ptr->header.ro_ref_count != 2)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 3.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 0) ||
- (cache_ptr->read_protects[0] != 2) ||
- (cache_ptr->max_read_protects[0] != 2)) {
+ if ((cache_ptr->write_protects[0] != 0) || (cache_ptr->read_protects[0] != 2) ||
+ (cache_ptr->max_read_protects[0] != 2)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 3.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 3.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
- {
+ if (pass) {
unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
- if((!(entry_ptr->header.is_protected)) ||
- (!(entry_ptr->header.is_read_only)) ||
- (entry_ptr->header.ro_ref_count != 1)) {
+ if ((!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) ||
+ (entry_ptr->header.ro_ref_count != 1)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 4.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 0) ||
- (cache_ptr->read_protects[0] != 2) ||
- (cache_ptr->max_read_protects[0] != 2)) {
+ if ((cache_ptr->write_protects[0] != 0) || (cache_ptr->read_protects[0] != 2) ||
+ (cache_ptr->max_read_protects[0] != 2)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 4.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 4.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
- {
+ if (pass) {
protect_entry_ro(file_ptr, 0, 0);
- if((!(entry_ptr->header.is_protected)) ||
- (!(entry_ptr->header.is_read_only)) ||
- (entry_ptr->header.ro_ref_count != 2)) {
+ if ((!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) ||
+ (entry_ptr->header.ro_ref_count != 2)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 5.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 0) ||
- (cache_ptr->read_protects[0] != 3) ||
- (cache_ptr->max_read_protects[0] != 2)) {
+ if ((cache_ptr->write_protects[0] != 0) || (cache_ptr->read_protects[0] != 3) ||
+ (cache_ptr->max_read_protects[0] != 2)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 5.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 5.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
- {
+ if (pass) {
protect_entry_ro(file_ptr, 0, 0);
- if((!(entry_ptr->header.is_protected)) ||
- (!(entry_ptr->header.is_read_only)) ||
- (entry_ptr->header.ro_ref_count != 3)) {
+ if ((!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) ||
+ (entry_ptr->header.ro_ref_count != 3)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 6.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 0) ||
- (cache_ptr->read_protects[0] != 4) ||
- (cache_ptr->max_read_protects[0] != 3)) {
+ if ((cache_ptr->write_protects[0] != 0) || (cache_ptr->read_protects[0] != 4) ||
+ (cache_ptr->max_read_protects[0] != 3)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 6.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 6.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
- {
+ if (pass) {
unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
- if((!(entry_ptr->header.is_protected)) ||
- (!(entry_ptr->header.is_read_only)) ||
- (entry_ptr->header.ro_ref_count != 2)) {
+ if ((!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) ||
+ (entry_ptr->header.ro_ref_count != 2)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 7.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 0) ||
- (cache_ptr->read_protects[0] != 4) ||
- (cache_ptr->max_read_protects[0] != 3)) {
+ if ((cache_ptr->write_protects[0] != 0) || (cache_ptr->read_protects[0] != 4) ||
+ (cache_ptr->max_read_protects[0] != 3)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 7.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 7.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
- {
+ if (pass) {
unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
- if((!(entry_ptr->header.is_protected)) ||
- (!(entry_ptr->header.is_read_only)) ||
- (entry_ptr->header.ro_ref_count != 1)) {
+ if ((!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) ||
+ (entry_ptr->header.ro_ref_count != 1)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 8.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 0) ||
- (cache_ptr->read_protects[0] != 4) ||
- (cache_ptr->max_read_protects[0] != 3)) {
+ if ((cache_ptr->write_protects[0] != 0) || (cache_ptr->read_protects[0] != 4) ||
+ (cache_ptr->max_read_protects[0] != 3)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 8.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 8.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
- {
+ if (pass) {
unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
- if((entry_ptr->header.is_protected) ||
- (entry_ptr->header.is_read_only) ||
- (entry_ptr->header.ro_ref_count != 0)) {
+ if ((entry_ptr->header.is_protected) || (entry_ptr->header.is_read_only) ||
+ (entry_ptr->header.ro_ref_count != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 9.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 0) ||
- (cache_ptr->read_protects[0] != 4) ||
- (cache_ptr->max_read_protects[0] != 3)) {
+ if ((cache_ptr->write_protects[0] != 0) || (cache_ptr->read_protects[0] != 4) ||
+ (cache_ptr->max_read_protects[0] != 3)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 9.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 9.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
/* If we get this far, do a write protect and unprotect to verify
* that the stats are getting collected properly here as well.
*/
- if(pass)
- {
+ if (pass) {
protect_entry(file_ptr, 0, 0);
- if((!(entry_ptr->header.is_protected)) ||
- (entry_ptr->header.is_read_only) ||
- (entry_ptr->header.ro_ref_count != 0)) {
+ if ((!(entry_ptr->header.is_protected)) || (entry_ptr->header.is_read_only) ||
+ (entry_ptr->header.ro_ref_count != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 10.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 1) ||
- (cache_ptr->read_protects[0] != 4) ||
- (cache_ptr->max_read_protects[0] != 3)) {
+ if ((cache_ptr->write_protects[0] != 1) || (cache_ptr->read_protects[0] != 4) ||
+ (cache_ptr->max_read_protects[0] != 3)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 10.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 10.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
- {
+ if (pass) {
unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
- if((entry_ptr->header.is_protected) ||
- (entry_ptr->header.is_read_only) ||
- (entry_ptr->header.ro_ref_count != 0)) {
+ if ((entry_ptr->header.is_protected) || (entry_ptr->header.is_read_only) ||
+ (entry_ptr->header.ro_ref_count != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected ro protected status 11.\n";
}
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 1) ||
- (cache_ptr->read_protects[0] != 4) ||
- (cache_ptr->max_read_protects[0] != 3)) {
+ if ((cache_ptr->write_protects[0] != 1) || (cache_ptr->read_protects[0] != 4) ||
+ (cache_ptr->max_read_protects[0] != 3)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 11.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 11.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
/* Finally, mix things up a little, using a mix of reads and
* and writes on different entries. Also include a pin to verify
* that it works as well.
@@ -13793,104 +13288,103 @@ check_multiple_read_protect(unsigned paged)
* at the end to ensure that all is at it should be.
*/
- if(pass) {
-
- protect_entry(file_ptr, 0, 2); /* (0,2) write */
- protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (1) */
- protect_entry(file_ptr, 0, 6); /* (0,6) write */
+ if (pass) {
- unprotect_entry(file_ptr, 0, 2, /* (0,2) unprotect */
- H5C__NO_FLAGS_SET);
+ protect_entry(file_ptr, 0, 2); /* (0,2) write */
+ protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (1) */
+ protect_entry(file_ptr, 0, 6); /* (0,6) write */
- protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (1) */
- protect_entry(file_ptr, 0, 1); /* (0,1) write */
- protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (2) */
- protect_entry(file_ptr, 0, 0); /* (0,0) write */
- protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (2) */
+ unprotect_entry(file_ptr, 0, 2, /* (0,2) unprotect */
+ H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, 0, 2, /* (0,2) read only (1) pin */
- H5C__PIN_ENTRY_FLAG);
- unprotect_entry(file_ptr, 0, 6, /* (0,6) unprotect */
- H5C__NO_FLAGS_SET);
+ protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (1) */
+ protect_entry(file_ptr, 0, 1); /* (0,1) write */
+ protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (2) */
+ protect_entry(file_ptr, 0, 0); /* (0,0) write */
+ protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (2) */
- protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (3) */
+ unprotect_entry(file_ptr, 0, 2, /* (0,2) read only (1) pin */
+ H5C__PIN_ENTRY_FLAG);
+ unprotect_entry(file_ptr, 0, 6, /* (0,6) unprotect */
+ H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, 0, 2, /* (0,2) unprotect */
- H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, 0, 1, /* (0,1) unprotect */
- H5C__NO_FLAGS_SET);
+ protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (3) */
- if(pass) {
+ unprotect_entry(file_ptr, 0, 2, /* (0,2) unprotect */
+ H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, 0, 1, /* (0,1) unprotect */
+ H5C__NO_FLAGS_SET);
- entry_ptr = &((entries[0])[4]);
+ if (pass) {
- if(H5C_pin_protected_entry((void *)entry_ptr) < 0) {
-
- pass = FALSE;
- failure_mssg = "H5C_pin_protected_entry() failed.\n";
+ entry_ptr = &((entries[0])[4]);
- } else if(!(entry_ptr->header.is_pinned)) {
+ if (H5C_pin_protected_entry((void *)entry_ptr) < 0) {
- pass = FALSE;
- failure_mssg = "entry (0,4) not pinned.\n";
-
- } else {
+ pass = FALSE;
+ failure_mssg = "H5C_pin_protected_entry() failed.\n";
+ }
+ else if (!(entry_ptr->header.is_pinned)) {
- /* keep test bed sanity checks happy */
- entry_ptr->is_pinned = TRUE;
+ pass = FALSE;
+ failure_mssg = "entry (0,4) not pinned.\n";
+ }
+ else {
+ /* keep test bed sanity checks happy */
+ entry_ptr->is_pinned = TRUE;
+ }
}
- }
- unprotect_entry(file_ptr, 0, 4, /* (0,4) read only (2) */
- H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, 0, 4, /* (0,4) read only (1) */
- H5C__UNPIN_ENTRY_FLAG);
+ unprotect_entry(file_ptr, 0, 4, /* (0,4) read only (2) */
+ H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, 0, 4, /* (0,4) read only (1) */
+ H5C__UNPIN_ENTRY_FLAG);
- if(pass && (entry_ptr->header.is_pinned)) {
+ if (pass && (entry_ptr->header.is_pinned)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "enty (0,4) still pinned.\n";
+ }
- }
-
- unprotect_entry(file_ptr, 0, 4, /* (0,4) unprotect */
- H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, 0, 0, /* (0,0) unprotect */
- H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, 0, 4, /* (0,4) unprotect */
+ H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, 0, 0, /* (0,0) unprotect */
+ H5C__NO_FLAGS_SET);
- unpin_entry(0, 2);
+ unpin_entry(0, 2);
}
#if H5C_COLLECT_CACHE_STATS
- if((cache_ptr->write_protects[0] != 5) ||
- (cache_ptr->read_protects[0] != 9) ||
- (cache_ptr->max_read_protects[0] != 3)) {
+ if ((cache_ptr->write_protects[0] != 5) || (cache_ptr->read_protects[0] != 9) ||
+ (cache_ptr->max_read_protects[0] != 3)) {
- pass = FALSE;
- failure_mssg = "Unexpected protect stats 11.\n";
+ pass = FALSE;
+ failure_mssg = "Unexpected protect stats 11.\n";
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_multiple_read_protect() */
-
/*-------------------------------------------------------------------------
* Function: check_move_entry()
*
@@ -13909,37 +13403,28 @@ check_multiple_read_protect(unsigned paged)
static unsigned
check_move_entry(unsigned paged)
{
- unsigned u;
- H5F_t * file_ptr = NULL;
- struct move_entry_test_spec test_specs[4] =
- {
- {
- /* int entry_type = */ PICO_ENTRY_TYPE,
- /* int entry_index = */ 10,
- /* hbool_t is_pinned = */ FALSE,
- /* hbool_t is_protected = */ FALSE
- },
- {
- /* int entry_type = */ PICO_ENTRY_TYPE,
- /* int entry_index = */ 20,
- /* hbool_t is_pinned = */ TRUE,
- /* hbool_t is_protected = */ FALSE
- },
- {
- /* int entry_type = */ PICO_ENTRY_TYPE,
- /* int entry_index = */ 30,
- /* hbool_t is_pinned = */ FALSE,
- /* hbool_t is_protected = */ TRUE
- },
- {
- /* int entry_type = */ PICO_ENTRY_TYPE,
- /* int entry_index = */ 40,
- /* hbool_t is_pinned = */ TRUE,
- /* hbool_t is_protected = */ TRUE
- },
+ unsigned u;
+ H5F_t * file_ptr = NULL;
+ struct move_entry_test_spec test_specs[4] = {
+ {/* int entry_type = */ PICO_ENTRY_TYPE,
+ /* int entry_index = */ 10,
+ /* hbool_t is_pinned = */ FALSE,
+ /* hbool_t is_protected = */ FALSE},
+ {/* int entry_type = */ PICO_ENTRY_TYPE,
+ /* int entry_index = */ 20,
+ /* hbool_t is_pinned = */ TRUE,
+ /* hbool_t is_protected = */ FALSE},
+ {/* int entry_type = */ PICO_ENTRY_TYPE,
+ /* int entry_index = */ 30,
+ /* hbool_t is_pinned = */ FALSE,
+ /* hbool_t is_protected = */ TRUE},
+ {/* int entry_type = */ PICO_ENTRY_TYPE,
+ /* int entry_index = */ 40,
+ /* hbool_t is_pinned = */ TRUE,
+ /* hbool_t is_protected = */ TRUE},
};
- if(paged)
+ if (paged)
TESTING("H5C_move_entry() functionality (paged aggregation)")
else
TESTING("H5C_move_entry() functionality")
@@ -13971,7 +13456,7 @@ check_move_entry(unsigned paged)
* list.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -13979,28 +13464,25 @@ check_move_entry(unsigned paged)
}
u = 0;
- while(pass && (u < NELMTS(test_specs)))
- {
+ while (pass && (u < NELMTS(test_specs))) {
check_move_entry__run_test(file_ptr, u, &(test_specs[u]));
- u++;
+ u++;
}
- if(pass)
+ if (pass)
takedown_cache(file_ptr, FALSE, FALSE);
- if(pass)
+ if (pass)
PASSED();
else
H5_FAILED()
- if(!pass)
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return (unsigned)!pass;
} /* check_move_entry() */
-
/*-------------------------------------------------------------------------
* Function: check_move_entry__run_test()
*
@@ -14021,143 +13503,121 @@ check_move_entry(unsigned paged)
*/
static void
-check_move_entry__run_test(H5F_t * file_ptr,
- unsigned test_num,
- struct move_entry_test_spec * spec_ptr)
+check_move_entry__run_test(H5F_t *file_ptr, unsigned test_num, struct move_entry_test_spec *spec_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
- static char msg[128];
- unsigned int flags = H5C__NO_FLAGS_SET;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr = NULL;
- H5C_cache_entry_t * test_ptr = NULL;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
+ static char msg[128];
+ unsigned int flags = H5C__NO_FLAGS_SET;
+ test_entry_t * base_addr;
+ test_entry_t * entry_ptr = NULL;
+ H5C_cache_entry_t *test_ptr = NULL;
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "cache_ptr NULL on entry to move test #%u.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "cache_ptr NULL on entry to move test #%u.", test_num);
failure_mssg = msg;
-
- } else if(spec_ptr == NULL) {
+ }
+ else if (spec_ptr == NULL) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "spec_ptr NULL on entry to move test #%u.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "spec_ptr NULL on entry to move test #%u.", test_num);
failure_mssg = msg;
-
}
- if(pass) {
+ if (pass) {
base_addr = entries[spec_ptr->entry_type];
entry_ptr = &(base_addr[spec_ptr->entry_index]);
- if((entry_ptr->self != entry_ptr) ||
- ((entry_ptr->cache_ptr != cache_ptr) &&
- (entry_ptr->cache_ptr != NULL)) ||
- (!(entry_ptr->at_main_addr)) ||
- (entry_ptr->addr != entry_ptr->main_addr)) {
+ if ((entry_ptr->self != entry_ptr) ||
+ ((entry_ptr->cache_ptr != cache_ptr) && (entry_ptr->cache_ptr != NULL)) ||
+ (!(entry_ptr->at_main_addr)) || (entry_ptr->addr != entry_ptr->main_addr)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "bad entry_ptr in move test #%u.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "bad entry_ptr in move test #%u.", test_num);
failure_mssg = msg;
-
}
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index);
- if(spec_ptr->is_pinned)
+ if (spec_ptr->is_pinned)
pin_entry(spec_ptr->entry_type, spec_ptr->entry_index);
- if(!spec_ptr->is_protected)
+ if (!spec_ptr->is_protected)
unprotect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index, flags);
move_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE);
-
}
- if(pass) {
+ if (pass) {
/* verify that the move took place, and that the cache's internal
* structures are as expected. Note that some sanity checking is
* done by move_entry(), so we don't have to repeat it here.
*/
- if(spec_ptr->is_pinned) {
+ if (spec_ptr->is_pinned) {
- if(!(entry_ptr->header.is_pinned)) {
+ if (!(entry_ptr->header.is_pinned)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Pinned entry not pinned after move in test #%u.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Pinned entry not pinned after move in test #%u.", test_num);
failure_mssg = msg;
}
- if(pass) {
+ if (pass) {
- if(spec_ptr->is_protected) {
+ if (spec_ptr->is_protected) {
} /* end if */
else {
/* Scan through the pinned entry list, looking for the entry */
test_ptr = cache_ptr->pel_head_ptr;
- while((test_ptr != NULL) &&
- (test_ptr != (H5C_cache_entry_t *)entry_ptr))
+ while ((test_ptr != NULL) && (test_ptr != (H5C_cache_entry_t *)entry_ptr))
test_ptr = test_ptr->next;
- if(test_ptr == NULL) {
+ if (test_ptr == NULL) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Pinned entry not in pel after move in test #%u.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Pinned entry not in pel after move in test #%u.",
+ test_num);
failure_mssg = msg;
}
} /* end else */
}
unpin_entry(spec_ptr->entry_type, spec_ptr->entry_index);
+ }
+ else {
- } else {
-
- if(entry_ptr->header.is_pinned) {
+ if (entry_ptr->header.is_pinned) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unpinned entry pinned after move in test #%u.",
- test_num);
+ HDsnprintf(msg, (size_t)128, "Unpinned entry pinned after move in test #%u.", test_num);
failure_mssg = msg;
}
- if(spec_ptr->is_protected) {
+ if (spec_ptr->is_protected) {
} /* end if */
else {
- if((entry_ptr->header.prev != NULL) ||
- (cache_ptr->LRU_head_ptr != (H5C_cache_entry_t *)entry_ptr))
- {
+ if ((entry_ptr->header.prev != NULL) ||
+ (cache_ptr->LRU_head_ptr != (H5C_cache_entry_t *)entry_ptr)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Entry not at head of LRU after move in test #%u.",
+ HDsnprintf(msg, (size_t)128, "Entry not at head of LRU after move in test #%u.",
test_num);
failure_mssg = msg;
}
} /* end else */
}
- if(spec_ptr->is_protected) {
- if(!(entry_ptr->header.is_protected)) {
+ if (spec_ptr->is_protected) {
+ if (!(entry_ptr->header.is_protected)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Protected entry not protected after move in test #%u.",
+ HDsnprintf(msg, (size_t)128, "Protected entry not protected after move in test #%u.",
test_num);
failure_mssg = msg;
}
@@ -14166,11 +13626,10 @@ check_move_entry__run_test(H5F_t * file_ptr,
} /* end if */
else {
- if(entry_ptr->header.is_protected) {
+ if (entry_ptr->header.is_protected) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unprotected entry not unprotected after move in test #%u.",
+ HDsnprintf(msg, (size_t)128, "Unprotected entry not unprotected after move in test #%u.",
test_num);
failure_mssg = msg;
}
@@ -14184,7 +13643,6 @@ check_move_entry__run_test(H5F_t * file_ptr,
} /* check_move_entry__run_test() */
-
/*-------------------------------------------------------------------------
* Function: check_pin_protected_entry()
*
@@ -14206,10 +13664,10 @@ check_pin_protected_entry(unsigned paged)
static char msg[128];
herr_t result;
H5F_t * file_ptr = NULL;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("H5C_pin_protected_entry() functionality (paged aggregation)")
else
TESTING("H5C_pin_protected_entry() functionality")
@@ -14221,72 +13679,72 @@ check_pin_protected_entry(unsigned paged)
* to unpin it, and then destroy the cache.
*/
- if(pass) {
+ if (pass) {
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
- if(file_ptr == NULL) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "file_ptr NULL from setup_cache.";
-
}
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, 0, 0);
-
}
- if(pass) {
+ if (pass) {
base_addr = entries[0];
entry_ptr = &(base_addr[0]);
- result = H5C_pin_protected_entry((void *)entry_ptr);
+ result = H5C_pin_protected_entry((void *)entry_ptr);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_pin_protected_entry() reports failure.");
+ HDsnprintf(msg, (size_t)128, "H5C_pin_protected_entry() reports failure.");
failure_mssg = msg;
-
- } else if(!(entry_ptr->header.is_pinned)) {
+ }
+ else if (!(entry_ptr->header.is_pinned)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "entry not pinned when it should be.");
failure_mssg = msg;
+ }
+ else {
- } else {
-
- entry_ptr->is_pinned = TRUE;
- }
+ entry_ptr->is_pinned = TRUE;
+ }
}
unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG);
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_pin_protected_entry() */
-
/*-------------------------------------------------------------------------
* Function: check_resize_entry()
*
@@ -14310,20 +13768,20 @@ check_pin_protected_entry(unsigned paged)
static unsigned
check_resize_entry(unsigned paged)
{
- static char msg[128];
- herr_t result;
+ static char msg[128];
+ herr_t result;
hbool_t in_cache;
hbool_t is_dirty;
hbool_t is_protected;
hbool_t is_pinned;
- size_t entry_size;
- size_t reported_entry_size;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr = NULL;
-
- if(paged)
+ size_t entry_size;
+ size_t reported_entry_size;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr = NULL;
+
+ if (paged)
TESTING("entry resize functionality (paged aggregation)")
else
TESTING("entry resize functionality")
@@ -14361,134 +13819,115 @@ check_resize_entry(unsigned paged)
/* tests with only one entry in the cache: */
- if(pass) {
+ if (pass) {
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
- if(file_ptr == NULL) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "file_ptr NULL from setup_cache.";
-
}
- else
- {
+ else {
cache_ptr = file_ptr->shared->cache;
- base_addr = entries[LARGE_ENTRY_TYPE];
- entry_ptr = &(base_addr[0]);
+ base_addr = entries[LARGE_ENTRY_TYPE];
+ entry_ptr = &(base_addr[0]);
entry_size = LARGE_ENTRY_SIZE;
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->slist_len != 0) ||
- (cache_ptr->slist_size != 0)) {
+ if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || (cache_ptr->slist_len != 0) ||
+ (cache_ptr->slist_size != 0)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 1.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
-
}
- if(pass) {
-
- if((cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != LARGE_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 0) ||
- (cache_ptr->slist_size != 0)) {
+ if (pass) {
+ if ((cache_ptr->index_len != 1) || (cache_ptr->index_size != LARGE_ENTRY_SIZE) ||
+ (cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 2.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 1.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 1.");
failure_mssg = msg;
-
- } else if(!in_cache || is_dirty || !is_protected || is_pinned) {
+ }
+ else if (!in_cache || is_dirty || !is_protected || is_pinned) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 1.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 1.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 2));
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "error(s) in H5C_resize_entry().");
failure_mssg = msg;
+ }
+ else {
- } else {
-
- result = H5C_unprotect(file_ptr,
- entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
+ result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "H5C_unprotect() reports failure 1.");
failure_mssg = msg;
-
- } else {
+ }
+ else {
/* tidy up so we play nice with the standard protect / unprotect
* calls.
*/
entry_ptr->is_protected = FALSE;
- entry_ptr->is_dirty = TRUE;
- entry_ptr->size = LARGE_ENTRY_SIZE / 2;
+ entry_ptr->is_dirty = TRUE;
+ entry_ptr->size = LARGE_ENTRY_SIZE / 2;
}
}
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 1 ) ||
- ( cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2) ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1 ) ||
- ( cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2) ) ) ) ) {
+ if ((cache_ptr->index_len != 1) || (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2)) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2))))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 3.");
@@ -14496,84 +13935,74 @@ check_resize_entry(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 2.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 2.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || is_pinned ||
- (reported_entry_size != (LARGE_ENTRY_SIZE / 2))) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || is_pinned ||
+ (reported_entry_size != (LARGE_ENTRY_SIZE / 2))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 2.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 2.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
-
}
- if(pass) {
+ if (pass) {
result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "error(s) in H5C_resize_entry().");
failure_mssg = msg;
+ }
+ else {
- } else {
-
- result = H5C_unprotect(file_ptr,
- entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
+ result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "H5C_unprotect() reports failure 2.");
failure_mssg = msg;
-
- } else {
+ }
+ else {
/* tidy up so we play nice with the standard protect / unprotect
* calls.
*/
entry_ptr->is_protected = FALSE;
- entry_ptr->is_dirty = TRUE;
- entry_ptr->size = LARGE_ENTRY_SIZE;
+ entry_ptr->is_dirty = TRUE;
+ entry_ptr->size = LARGE_ENTRY_SIZE;
}
}
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 1 ) ||
- ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1 ) ||
- ( cache_ptr->slist_size != LARGE_ENTRY_SIZE ) ) ) ) {
+ if ((cache_ptr->index_len != 1) || (cache_ptr->index_size != LARGE_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 4.");
@@ -14581,214 +14010,175 @@ check_resize_entry(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 3.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 3.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || is_pinned ||
- (reported_entry_size != LARGE_ENTRY_SIZE)) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || is_pinned ||
+ (reported_entry_size != LARGE_ENTRY_SIZE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 3.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 3.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__PIN_ENTRY_FLAG);
-
}
- if(pass) {
+ if (pass) {
result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_resize_entry() reports failure 1.");
+ HDsnprintf(msg, (size_t)128, "H5C_resize_entry() reports failure 1.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 1 ) ||
- ( cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4) ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1 ) ||
- ( cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4) ) ) ) ) {
+ if ((cache_ptr->index_len != 1) || (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4)) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4))))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 5.");
failure_mssg = msg;
-
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 4.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 4.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || !is_pinned ||
- (reported_entry_size != (LARGE_ENTRY_SIZE / 4))) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || !is_pinned ||
+ (reported_entry_size != (LARGE_ENTRY_SIZE / 4))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 4.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 4.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_resize_entry() reports failure 2.");
+ HDsnprintf(msg, (size_t)128, "H5C_resize_entry() reports failure 2.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 1 ) ||
- ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1 ) ||
- ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) {
+ if ((cache_ptr->index_len != 1) || (cache_ptr->index_size != LARGE_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 6.");
failure_mssg = msg;
-
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 5.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 5.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || !is_pinned ||
- (reported_entry_size != LARGE_ENTRY_SIZE)) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || !is_pinned ||
+ (reported_entry_size != LARGE_ENTRY_SIZE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 5.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 5.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0,
- H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG);
-
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG);
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected,
- &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 6.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 6.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 6.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (!entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (!entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 6.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 0 ) ||
- ( cache_ptr->slist_size != 0) ) ) ) {
+ if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) ||
+ ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 7.");
@@ -14796,28 +14186,24 @@ check_resize_entry(unsigned paged)
}
}
-
/* now repeat the above tests with several entries in the cache: */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 0 ) ||
- ( cache_ptr->slist_size != 0) ) ) ) {
+ if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) ||
+ ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 8.");
failure_mssg = msg;
}
- base_addr = entries[LARGE_ENTRY_TYPE];
- entry_ptr = &(base_addr[3]);
+ base_addr = entries[LARGE_ENTRY_TYPE];
+ entry_ptr = &(base_addr[3]);
entry_size = LARGE_ENTRY_SIZE;
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
@@ -14827,119 +14213,101 @@ check_resize_entry(unsigned paged)
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET);
-
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 3 ) ||
- ( cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1 ) ||
- ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) {
+ if ((cache_ptr->index_len != 3) || (cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 9.");
failure_mssg = msg;
-
}
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
-
}
- if(pass) {
-
- if ( ( cache_ptr->index_len != 4 ) ||
- ( cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1) ||
- ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) {
+ if (pass) {
+ if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 10.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 7.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 7.");
failure_mssg = msg;
-
- } else if(!in_cache || is_dirty || !is_protected || is_pinned) {
+ }
+ else if (!in_cache || is_dirty || !is_protected || is_pinned) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 7.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 7.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 2));
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "error(s) in H5C_resize_entry().");
failure_mssg = msg;
+ }
+ else {
- } else {
-
- result = H5C_unprotect(file_ptr,
- entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
+ result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "H5C_unprotect() reports failure 3.");
failure_mssg = msg;
-
- } else {
+ }
+ else {
/* tidy up so we play nice with the standard protect / unprotect
* calls.
*/
entry_ptr->is_protected = FALSE;
- entry_ptr->is_dirty = TRUE;
- entry_ptr->size = LARGE_ENTRY_SIZE / 2;
+ entry_ptr->is_dirty = TRUE;
+ entry_ptr->size = LARGE_ENTRY_SIZE / 2;
}
}
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 4 ) ||
- ( cache_ptr->index_size !=
- ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2)) ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 2 ) ||
- ( cache_ptr->slist_size !=
- (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)) ) ) ) ) {
+ if ((cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2))) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 2) ||
+ (cache_ptr->slist_size != (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)))))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 11.");
@@ -14947,84 +14315,74 @@ check_resize_entry(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 8.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 8.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || is_pinned ||
- (reported_entry_size != (LARGE_ENTRY_SIZE / 2))) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || is_pinned ||
+ (reported_entry_size != (LARGE_ENTRY_SIZE / 2))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 8.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 8.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
-
}
- if(pass) {
+ if (pass) {
result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "error(s) in H5C_resize_entry().");
failure_mssg = msg;
+ }
+ else {
- } else {
-
- result = H5C_unprotect(file_ptr,
- entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
+ result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "H5C_unprotect() reports failure 4.");
failure_mssg = msg;
-
- } else {
+ }
+ else {
/* tidy up so we play nice with the standard protect / unprotect
* calls.
*/
entry_ptr->is_protected = FALSE;
- entry_ptr->is_dirty = TRUE;
- entry_ptr->size = LARGE_ENTRY_SIZE;
+ entry_ptr->is_dirty = TRUE;
+ entry_ptr->size = LARGE_ENTRY_SIZE;
}
}
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 4 ) ||
- ( cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 2 ) ||
- ( cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE ) ) ) ) {
+ if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 12.");
@@ -15032,69 +14390,58 @@ check_resize_entry(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 9.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 9.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || is_pinned ||
- (reported_entry_size != LARGE_ENTRY_SIZE)) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || is_pinned ||
+ (reported_entry_size != LARGE_ENTRY_SIZE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 9.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 9.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__PIN_ENTRY_FLAG);
-
}
- if(pass) {
+ if (pass) {
result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_resize_entry() reports failure 3.");
+ HDsnprintf(msg, (size_t)128, "H5C_resize_entry() reports failure 3.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 4 ) ||
- ( cache_ptr->index_size !=
- ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4)) ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 2 ) ||
- ( cache_ptr->slist_size !=
- (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)) ) ) ) ) {
+ if ((cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4))) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 2) ||
+ (cache_ptr->slist_size != (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)))))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 13.");
@@ -15102,59 +14449,49 @@ check_resize_entry(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 10.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 10.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || !is_pinned ||
- (reported_entry_size != (LARGE_ENTRY_SIZE / 4))) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || !is_pinned ||
+ (reported_entry_size != (LARGE_ENTRY_SIZE / 4))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 10.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 10.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_resize_entry() reports failure 4.");
+ HDsnprintf(msg, (size_t)128, "H5C_resize_entry() reports failure 4.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 4 ) ||
- ( cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE) ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 2 ) ||
- ( cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE)) ) ) ) {
+ if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE)) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE))))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 14.");
@@ -15162,84 +14499,69 @@ check_resize_entry(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
- &is_dirty, &is_protected, &is_pinned,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 11.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 11.");
failure_mssg = msg;
-
- } else if(!in_cache || !is_dirty || is_protected || !is_pinned ||
- (reported_entry_size != LARGE_ENTRY_SIZE)) {
+ }
+ else if (!in_cache || !is_dirty || is_protected || !is_pinned ||
+ (reported_entry_size != LARGE_ENTRY_SIZE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 11.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 11.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3,
- H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG);
-
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG);
}
- if(pass) {
+ if (pass) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected,
- &is_pinned, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty,
+ &is_protected, &is_pinned, NULL, NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 12.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 12.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 12.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (!entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (!entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 12.");
failure_mssg = msg;
-
- }
+ }
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 3 ) ||
- ( cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE) ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1 ) ||
- ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) {
+ if ((cache_ptr->index_len != 3) || (cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE)) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != LARGE_ENTRY_SIZE)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 15.");
@@ -15247,7 +14569,7 @@ check_resize_entry(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DELETED_FLAG);
@@ -15257,16 +14579,12 @@ check_resize_entry(unsigned paged)
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__DELETED_FLAG);
-
}
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 0 ) ||
- ( cache_ptr->slist_size != 0 ) ) ) ) {
+ if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) ||
+ ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)))) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 16.");
@@ -15274,24 +14592,27 @@ check_resize_entry(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_resize_entry() */
-
/*-------------------------------------------------------------------------
* Function: check_evictions_enabled()
*
@@ -15315,19 +14636,19 @@ check_resize_entry(unsigned paged)
static unsigned
check_evictions_enabled(unsigned paged)
{
- static char msg[128];
- herr_t result;
+ static char msg[128];
+ herr_t result;
hbool_t show_progress = FALSE;
hbool_t evictions_enabled;
hbool_t in_cache;
- int i;
+ int i;
int mile_stone = 1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- test_entry_t * base_addr = NULL;
- test_entry_t * entry_ptr;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ test_entry_t *base_addr = NULL;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("evictions enabled/disabled functionality (paged aggregation)")
else
TESTING("evictions enabled/disabled functionality")
@@ -15369,44 +14690,37 @@ check_evictions_enabled(unsigned paged)
pass = TRUE;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* create the cache */
- if(pass) {
+ if (pass) {
reset_entries();
file_ptr = setup_cache((size_t)(1 * 1024 * 1024), (size_t)(512 * 1024), paged);
- if(file_ptr == NULL) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "file_ptr NULL from setup_cache.";
-
}
- else
- {
+ else {
cache_ptr = file_ptr->shared->cache;
base_addr = entries[MONSTER_ENTRY_TYPE];
}
}
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that it is empty */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 0 ) ||
- ( cache_ptr->slist_size != 0 ) ) ) ||
- ( cache_ptr->evictions_enabled != TRUE ) ) {
+ if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) ||
+ ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0))) ||
+ (cache_ptr->evictions_enabled != TRUE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 1.");
@@ -15414,51 +14728,43 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that H5C_get_evictions_enabled() returns the expected value */
- if(pass) {
+ if (pass) {
result = H5C_get_evictions_enabled(cache_ptr, &evictions_enabled);
- if((result != SUCCEED) || (evictions_enabled != TRUE)) {
+ if ((result != SUCCEED) || (evictions_enabled != TRUE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected evictions enabled 1.");
failure_mssg = msg;
- }
+ }
}
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* fill the cache */
- for (i = 0; i < 16 ; i++)
- {
+ for (i = 0; i < 16; i++) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
-
}
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that the cache is full */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 16 ) ||
- ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 0 ) ||
- ( cache_ptr->slist_size != 0 ) ) ) ||
- ( cache_ptr->evictions_enabled != TRUE ) ) {
+ if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0))) ||
+ (cache_ptr->evictions_enabled != TRUE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 2.");
@@ -15466,31 +14772,25 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* protect and unprotect another entry */
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16, H5C__NO_FLAGS_SET);
-
}
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that an entry has been evicted */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 16 ) ||
- ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 0 ) ||
- ( cache_ptr->slist_size != 0 ) ) ) ||
- ( cache_ptr->evictions_enabled != TRUE ) ) {
+ if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) && ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0))) ||
+ (cache_ptr->evictions_enabled != TRUE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 3.");
@@ -15498,66 +14798,55 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
entry_ptr = &(base_addr[0]);
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- NULL, &in_cache, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 1.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 1.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 1.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (!entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (!entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 1.");
failure_mssg = msg;
-
- }
+ }
}
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* insert an entry */
insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 17, H5C__NO_FLAGS_SET);
-
}
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that another entry has been evicted */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 16 ) ||
- ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1 ) ||
- ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) ) ) ||
- ( cache_ptr->evictions_enabled != TRUE ) ) {
+ if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != MONSTER_ENTRY_SIZE))) ||
+ (cache_ptr->evictions_enabled != TRUE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 4.");
@@ -15565,71 +14854,62 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
entry_ptr = &(base_addr[1]);
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 2.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 2.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 2.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (!entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (!entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 2.");
failure_mssg = msg;
-
- }
+ }
}
- if(show_progress) /* 12 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 12 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* disable evictions */
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "can't disable evictions 1.");
failure_mssg = msg;
- }
+ }
}
- if(show_progress) /* 13 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 13 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that evictions are disabled */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 16 ) ||
- ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1 ) ||
- ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) ) ) ||
- ( cache_ptr->evictions_enabled != FALSE ) ) {
+ if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != MONSTER_ENTRY_SIZE))) ||
+ (cache_ptr->evictions_enabled != FALSE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 5.");
@@ -15637,31 +14917,26 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 14 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 14 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* protect and unprotect another entry */
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18, H5C__NO_FLAGS_SET);
-
}
- if(show_progress) /* 15 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 15 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that no entry has been evicted */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 17 ) ||
- ( cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 1 ) ||
- ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) ) ) ||
- ( cache_ptr->evictions_enabled != FALSE ) ) {
+ if ((cache_ptr->index_len != 17) || (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 1) || (cache_ptr->slist_size != MONSTER_ENTRY_SIZE))) ||
+ (cache_ptr->evictions_enabled != FALSE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 6.");
@@ -15669,30 +14944,25 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 16 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 16 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* insert another entry */
insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET);
-
}
- if(show_progress) /* 17 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 17 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that no entry has been evicted */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 18 ) ||
- ( cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 2 ) ||
- ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) ||
- ( cache_ptr->evictions_enabled != FALSE ) ) {
+ if ((cache_ptr->index_len != 18) || (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE))) ||
+ (cache_ptr->evictions_enabled != FALSE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 7.");
@@ -15700,48 +14970,42 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 18 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 18 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* re-enable evictions */
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "can't enable evictions 1.");
failure_mssg = msg;
- }
+ }
}
- if(show_progress) /* 19 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 19 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* protect and unprotect an entry that is in the cache */
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET);
-
}
- if(show_progress) /* 20 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 20 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that no entries have been evicted */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 18 ) ||
- ( cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 2 ) ||
- ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) ||
- ( cache_ptr->evictions_enabled != TRUE ) ) {
+ if ((cache_ptr->index_len != 18) || (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE))) ||
+ (cache_ptr->evictions_enabled != TRUE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 8.");
@@ -15749,34 +15013,29 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 21 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 21 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* protect and unprotect an entry that isn't in the cache */
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20, H5C__NO_FLAGS_SET);
-
}
- if(show_progress) /* 22 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 22 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that the entries have been evicted to bring the
* cache back down to its normal size.
*/
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 16 ) ||
- ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 2 ) ||
- ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) ||
- ( cache_ptr->evictions_enabled != TRUE ) ) {
+ if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE))) ||
+ (cache_ptr->evictions_enabled != TRUE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 9.");
@@ -15784,120 +15043,104 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 23 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 23 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
entry_ptr = &(base_addr[2]);
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 3.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 3.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 3.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (!entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (!entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 3.");
failure_mssg = msg;
-
- }
+ }
}
- if(show_progress) /* 24 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 24 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
entry_ptr = &(base_addr[3]);
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 4.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 4.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 4.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- (entry_ptr->serialized) ||
- (!entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (!entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 4.");
failure_mssg = msg;
-
- }
+ }
}
- if(show_progress) /* 25 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 25 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* disable evictions again */
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "can't disable evictions 2.");
failure_mssg = msg;
- }
+ }
}
- if(show_progress) /* 26 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 26 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* protect and unprotect an entry that isn't in the cache, forcing
* the cache to grow.
*/
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21, H5C__NO_FLAGS_SET);
-
}
- if(show_progress) /* 27 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 27 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that the cache has grown */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 17 ) ||
- ( cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 2 ) ||
- ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) ||
- ( cache_ptr->evictions_enabled != FALSE ) ) {
+ if ((cache_ptr->index_len != 17) || (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 2) || (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE))) ||
+ (cache_ptr->evictions_enabled != FALSE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 10.");
@@ -15905,47 +15148,41 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 28 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 28 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* re-enable evictions again */
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, TRUE);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "can't enable evictions 2.");
failure_mssg = msg;
- }
+ }
}
- if(show_progress) /* 29 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 29 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* insert an entry */
insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 22, H5C__NO_FLAGS_SET);
-
}
- if(show_progress) /* 30 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 30 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* verify that the cache has returned to its maximum size */
- if(pass) {
+ if (pass) {
- if ( ( cache_ptr->index_len != 16 ) ||
- ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->slist_len != 3 ) ||
- ( cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE ) ) ) ||
- ( cache_ptr->evictions_enabled != TRUE ) ) {
+ if ((cache_ptr->index_len != 16) || (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->slist_len != 3) || (cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE))) ||
+ (cache_ptr->evictions_enabled != TRUE)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 11.");
@@ -15953,84 +15190,79 @@ check_evictions_enabled(unsigned paged)
}
}
- if(show_progress) /* 31 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 31 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
entry_ptr = &(base_addr[4]);
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL);
- if(result < 0) {
+ if (result < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5C_get_entry_status() reports failure 5.");
+ HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 5.");
failure_mssg = msg;
-
- } else if(in_cache) {
+ }
+ else if (in_cache) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 5.");
failure_mssg = msg;
-
- } else if((!entry_ptr->deserialized) ||
- ( entry_ptr->serialized) ||
- (!entry_ptr->destroyed)) {
+ }
+ else if ((!entry_ptr->deserialized) || (entry_ptr->serialized) || (!entry_ptr->destroyed)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected entry history 5.");
failure_mssg = msg;
-
- }
+ }
}
- if(show_progress) /* 32 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 32 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* disable evictions one last time before we shut down */
- if(pass) {
+ if (pass) {
result = H5C_set_evictions_enabled(cache_ptr, FALSE);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "can't disable evictions 3.");
failure_mssg = msg;
- }
+ }
}
- if(show_progress) /* 33 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 33 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(show_progress) /* 34 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 34 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_evictions_enabled() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_protected_err()
*
@@ -16055,10 +15287,10 @@ check_evictions_enabled(unsigned paged)
static unsigned
check_flush_protected_err(unsigned paged)
{
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ H5F_t *file_ptr = NULL;
+ H5C_t *cache_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("flush cache with protected entry error (paged aggregation)")
else
TESTING("flush cache with protected entry error")
@@ -16070,13 +15302,13 @@ check_flush_protected_err(unsigned paged)
* succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
- if ( pass ) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
}
@@ -16084,52 +15316,51 @@ check_flush_protected_err(unsigned paged)
protect_entry(file_ptr, 0, 0);
/* enable slist prior to flush */
- if ( ( pass ) &&
- ( H5C_set_slist_enabled(cache_ptr, TRUE, FALSE) < 0 ) ) {
+ if ((pass) && (H5C_set_slist_enabled(cache_ptr, TRUE, FALSE) < 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unable to enable slist prior to flush.\n";
}
- if ( ( pass ) &&
- ( H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) >= 0 ) ) {
+ if ((pass) && (H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) >= 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "flush succeeded on cache with protected entry.\n";
}
/* disable the slist after the flush */
- if ( ( pass ) &&
- ( H5C_set_slist_enabled(cache_ptr, FALSE, FALSE) < 0 ) ) {
+ if ((pass) && (H5C_set_slist_enabled(cache_ptr, FALSE, FALSE) < 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unable to disable slist after flush.\n";
}
unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG);
- if ( pass ) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, \
- "flush failed after unprotect.\n")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "flush failed after unprotect.\n")
}
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_flush_protected_err() */
-
/*-------------------------------------------------------------------------
* Function: check_destroy_pinned_err()
*
@@ -16150,9 +15381,9 @@ check_flush_protected_err(unsigned paged)
static unsigned
check_destroy_pinned_err(unsigned paged)
{
- H5F_t * file_ptr = NULL;
+ H5F_t *file_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("destroy cache with permanently pinned entry error (pgd aggr)")
else
TESTING("destroy cache with permanently pinned entry error")
@@ -16163,57 +15394,61 @@ check_destroy_pinned_err(unsigned paged)
* should fail. Unpin the entry and flush destroy again -- should
* succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
protect_entry(file_ptr, 0, 0);
- unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
+ unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
- if(H5C_prep_for_file_close(file_ptr) < 0) {
- pass = FALSE;
+ if (H5C_prep_for_file_close(file_ptr) < 0) {
+ pass = FALSE;
failure_mssg = "unexpected failure of prep for file close.\n";
} /* end if */
- if(H5C_dest(file_ptr) >= 0) {
- pass = FALSE;
+ if (H5C_dest(file_ptr) >= 0) {
+ pass = FALSE;
failure_mssg = "destroy succeeded on cache with pinned entry.\n";
} /* end if */
- else {
- unpin_entry(0, 0);
+ else {
+ unpin_entry(0, 0);
- if(H5C_dest(file_ptr) < 0) {
- pass = FALSE;
+ if (H5C_dest(file_ptr) < 0) {
+ pass = FALSE;
failure_mssg = "destroy failed after unpin.\n";
} /* end if */
else
file_ptr->shared->cache = NULL;
} /* end else */
- if(saved_cache != NULL) {
+ if (saved_cache != NULL) {
file_ptr->shared->cache = saved_cache;
- saved_cache = NULL;
+ saved_cache = NULL;
} /* end if */
- /* call takedown_cache() with a NULL file_ptr parameter.
- * This causes the function to close and delete the file,
- * while skipping the call to H5C_dest().
- */
- takedown_cache(NULL, FALSE, FALSE);
+ /* call takedown_cache() with a NULL file_ptr parameter.
+ * This causes the function to close and delete the file,
+ * while skipping the call to H5C_dest().
+ */
+ takedown_cache(NULL, FALSE, FALSE);
} /* end if */
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass)
+ if (!pass)
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return (unsigned)!pass;
} /* check_destroy_pinned_err() */
-
/*-------------------------------------------------------------------------
* Function: check_destroy_protected_err()
*
@@ -16233,9 +15468,9 @@ check_destroy_pinned_err(unsigned paged)
static unsigned
check_destroy_protected_err(unsigned paged)
{
- H5F_t * file_ptr = NULL;
+ H5F_t *file_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("destroy cache with protected entry error (paged aggregation)")
else
TESTING("destroy cache with protected entry error")
@@ -16247,7 +15482,7 @@ check_destroy_protected_err(unsigned paged)
* succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -16262,50 +15497,54 @@ check_destroy_protected_err(unsigned paged)
* we are trying to test, put the call to H5C_prep_for_file_close()
* prior to the final protect call.
*/
- if(H5C_prep_for_file_close(file_ptr) < 0) {
- pass = FALSE;
+ if (H5C_prep_for_file_close(file_ptr) < 0) {
+ pass = FALSE;
failure_mssg = "unexpected failure of prep for file close.\n";
} /* end if */
protect_entry(file_ptr, 0, 0);
- if(H5C_dest(file_ptr) >= 0) {
- pass = FALSE;
+ if (H5C_dest(file_ptr) >= 0) {
+ pass = FALSE;
failure_mssg = "destroy succeeded on cache with protected entry.\n";
} /* end if */
- else {
+ else {
unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG);
- if(H5C_dest(file_ptr) < 0) {
- pass = FALSE;
+ if (H5C_dest(file_ptr) < 0) {
+ pass = FALSE;
failure_mssg = "destroy failed after unprotect.\n";
} /* end if */
- else {
+ else {
file_ptr->shared->cache = NULL;
- } /* end else */
- } /* end else */
+ } /* end else */
+ } /* end else */
- if(saved_cache != NULL) {
+ if (saved_cache != NULL) {
file_ptr->shared->cache = saved_cache;
- saved_cache = NULL;
+ saved_cache = NULL;
} /* end if */
- /* call takedown_cache() with a NULL file_ptr parameter.
- * This causes the function to close and delete the file,
- * while skipping the call to H5C_dest().
- */
- takedown_cache(NULL, FALSE, FALSE);
+ /* call takedown_cache() with a NULL file_ptr parameter.
+ * This causes the function to close and delete the file,
+ * while skipping the call to H5C_dest().
+ */
+ takedown_cache(NULL, FALSE, FALSE);
} /* end if */
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass)
+ if (!pass)
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return (unsigned)!pass;
} /* check_destroy_protected_err() */
-
/*-------------------------------------------------------------------------
* Function: check_duplicate_insert_err()
*
@@ -16325,12 +15564,12 @@ check_destroy_protected_err(unsigned paged)
static unsigned
check_duplicate_insert_err(unsigned paged)
{
- herr_t result = -1;
- H5F_t * file_ptr = NULL;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ herr_t result = -1;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("duplicate entry insertion error (paged aggregation)")
else
TESTING("duplicate entry insertion error")
@@ -16342,7 +15581,7 @@ check_duplicate_insert_err(unsigned paged)
* destroy the cache -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -16350,21 +15589,20 @@ check_duplicate_insert_err(unsigned paged)
protect_entry(file_ptr, 0, 0);
- if(pass) {
+ if (pass) {
base_addr = entries[0];
entry_ptr = &(base_addr[0]);
- result = H5C_insert_entry(file_ptr,
- types[0], entry_ptr->addr,
- (void *)entry_ptr, H5C__NO_FLAGS_SET);
+ result =
+ H5C_insert_entry(file_ptr, types[0], entry_ptr->addr, (void *)entry_ptr, H5C__NO_FLAGS_SET);
- if(result >= 0) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "insert of duplicate entry succeeded.\n";
-
- } else {
+ }
+ else {
unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG);
@@ -16373,19 +15611,22 @@ check_duplicate_insert_err(unsigned paged)
}
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_duplicate_insert_err() */
-
/*-------------------------------------------------------------------------
* Function: check_double_pin_err()
*
@@ -16407,11 +15648,11 @@ check_duplicate_insert_err(unsigned paged)
static unsigned
check_double_pin_err(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("pin a pinned entry error (paged aggregation)")
else
TESTING("pin a pinned entry error")
@@ -16424,7 +15665,7 @@ check_double_pin_err(unsigned paged)
* -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -16439,41 +15680,42 @@ check_double_pin_err(unsigned paged)
entry_ptr = &((entries[0])[0]);
}
- if(pass) {
+ if (pass) {
- result = H5C_unprotect(file_ptr,
- entry_ptr->addr, (void *)entry_ptr, H5C__PIN_ENTRY_FLAG);
+ result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, H5C__PIN_ENTRY_FLAG);
- if(result > 0) {
+ if (result > 0) {
- pass = FALSE;
- failure_mssg =
- "attempt to pin a pinned entry succeeded.\n";
-
- } else {
+ pass = FALSE;
+ failure_mssg = "attempt to pin a pinned entry succeeded.\n";
+ }
+ else {
- unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG);
- }
+ unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG);
+ }
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_double_pin_err() */
-
/*-------------------------------------------------------------------------
* Function: check_double_unpin_err()
*
@@ -16495,11 +15737,11 @@ check_double_pin_err(unsigned paged)
static unsigned
check_double_unpin_err(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("unpin an unpinned entry error (paged aggregation)")
else
TESTING("unpin an unpinned entry error")
@@ -16514,7 +15756,7 @@ check_double_unpin_err(unsigned paged)
* Destroy the cache -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -16525,54 +15767,53 @@ check_double_unpin_err(unsigned paged)
entry_ptr = &((entries[0])[0]);
}
- if(pass) {
-
- result = H5C_unprotect(file_ptr,
- entry_ptr->addr, (void *)entry_ptr, H5C__UNPIN_ENTRY_FLAG);
+ if (pass) {
- if(result > 0) {
+ result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, H5C__UNPIN_ENTRY_FLAG);
- pass = FALSE;
- failure_mssg =
- "attempt to unpin an unpinned entry succeeded 1.\n";
+ if (result > 0) {
- } else {
+ pass = FALSE;
+ failure_mssg = "attempt to unpin an unpinned entry succeeded 1.\n";
+ }
+ else {
- unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
- }
+ unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+ }
}
- if(pass) {
+ if (pass) {
- result = H5C_unpin_entry((void *)entry_ptr);
+ result = H5C_unpin_entry((void *)entry_ptr);
- if(result > 0) {
-
- pass = FALSE;
- failure_mssg =
- "attempt to unpin an unpinned entry succeeded 2.\n";
+ if (result > 0) {
+ pass = FALSE;
+ failure_mssg = "attempt to unpin an unpinned entry succeeded 2.\n";
}
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_double_unpin_err() */
-
/*-------------------------------------------------------------------------
* Function: check_pin_entry_errs()
*
@@ -16594,11 +15835,11 @@ check_double_unpin_err(unsigned paged)
static unsigned
check_pin_entry_errs(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("pin entry related errors (paged aggregation)")
else
TESTING("pin entry related errors")
@@ -16617,7 +15858,7 @@ check_pin_entry_errs(unsigned paged)
* Destroy the cache -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -16625,66 +15866,66 @@ check_pin_entry_errs(unsigned paged)
protect_entry(file_ptr, 0, 0);
- unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
entry_ptr = &((entries[0])[0]);
}
- if(pass) {
+ if (pass) {
result = H5C_pin_protected_entry((void *)entry_ptr);
- if(result > 0) {
+ if (result > 0) {
- pass = FALSE;
- failure_mssg =
- "attempt to pin an unprotected entry succeeded.\n";
-
- } else {
+ pass = FALSE;
+ failure_mssg = "attempt to pin an unprotected entry succeeded.\n";
+ }
+ else {
protect_entry(file_ptr, 0, 0);
- unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
+ unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
protect_entry(file_ptr, 0, 0);
- }
+ }
}
- if(pass) {
+ if (pass) {
result = H5C_pin_protected_entry((void *)entry_ptr);
- if(result > 0) {
+ if (result > 0) {
- pass = FALSE;
- failure_mssg =
- "attempt to pin a pinned, protected entry succeeded.\n";
-
- } else {
-
- unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG);
+ pass = FALSE;
+ failure_mssg = "attempt to pin a pinned, protected entry succeeded.\n";
+ }
+ else {
- }
+ unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG);
+ }
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_pin_entry_errs() */
-
/*-------------------------------------------------------------------------
* Function: check_double_protect_err()
*
@@ -16702,11 +15943,11 @@ check_pin_entry_errs(unsigned paged)
static unsigned
check_double_protect_err(unsigned paged)
{
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
- H5C_cache_entry_t * cache_entry_ptr;
+ H5F_t * file_ptr = NULL;
+ test_entry_t * entry_ptr;
+ H5C_cache_entry_t *cache_entry_ptr;
- if(paged)
+ if (paged)
TESTING("protect a protected entry error (paged aggregation)")
else
TESTING("protect a protected entry error")
@@ -16718,7 +15959,7 @@ check_double_protect_err(unsigned paged)
* destroy the cache -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -16729,42 +15970,44 @@ check_double_protect_err(unsigned paged)
entry_ptr = &((entries[0])[0]);
}
- if(pass) {
+ if (pass) {
- cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr,
- types[0], entry_ptr->addr,
- &entry_ptr->addr, H5C__NO_FLAGS_SET);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[0], entry_ptr->addr,
+ &entry_ptr->addr, H5C__NO_FLAGS_SET);
- if(cache_entry_ptr != NULL) {
+ if (cache_entry_ptr != NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "attempt to protect a protected entry succeeded.\n";
}
}
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_double_protect_err() */
-
/*-------------------------------------------------------------------------
* Function: check_double_unprotect_err()
*
@@ -16782,11 +16025,11 @@ check_double_protect_err(unsigned paged)
static unsigned
check_double_unprotect_err(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("unprotect an unprotected entry error (paged aggregation)")
else
TESTING("unprotect an unprotected entry error")
@@ -16798,7 +16041,7 @@ check_double_unprotect_err(unsigned paged)
* -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -16811,37 +16054,38 @@ check_double_unprotect_err(unsigned paged)
entry_ptr = &((entries[0])[0]);
}
- if(pass) {
+ if (pass) {
- result = H5C_unprotect(file_ptr,
- entry_ptr->addr, (void *)entry_ptr, H5C__NO_FLAGS_SET);
+ result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, H5C__NO_FLAGS_SET);
- if(result > 0) {
+ if (result > 0) {
- pass = FALSE;
- failure_mssg =
- "attempt to unprotect an unprotected entry succeeded 1.\n";
+ pass = FALSE;
+ failure_mssg = "attempt to unprotect an unprotected entry succeeded 1.\n";
}
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_double_unprotect_err() */
-
/*-------------------------------------------------------------------------
* Function: check_mark_entry_dirty_errs()
*
@@ -16862,11 +16106,11 @@ check_double_unprotect_err(unsigned paged)
static unsigned
check_mark_entry_dirty_errs(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("mark entry dirty related errors (paged aggregation)")
else
TESTING("mark entry dirty related errors")
@@ -16879,7 +16123,7 @@ check_mark_entry_dirty_errs(unsigned paged)
* Destroy the cache -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -16887,42 +16131,43 @@ check_mark_entry_dirty_errs(unsigned paged)
protect_entry(file_ptr, 0, 0);
- unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
entry_ptr = &((entries[0])[0]);
}
- if(pass) {
-
- result = H5C_mark_entry_dirty((void *)entry_ptr);
+ if (pass) {
+ result = H5C_mark_entry_dirty((void *)entry_ptr);
- if(result > 0) {
+ if (result > 0) {
- pass = FALSE;
- failure_mssg =
- "attempt to dirty a unpinned and unprotected entry succeeded.\n";
+ pass = FALSE;
+ failure_mssg = "attempt to dirty a unpinned and unprotected entry succeeded.\n";
}
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_mark_entry_dirty_errs() */
-
/*-------------------------------------------------------------------------
* Function: check_expunge_entry_errs()
*
@@ -16944,11 +16189,11 @@ check_mark_entry_dirty_errs(unsigned paged)
static unsigned
check_expunge_entry_errs(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("expunge entry related errors (paged aggregation)")
else
TESTING("expunge entry related errors")
@@ -16967,7 +16212,7 @@ check_expunge_entry_errs(unsigned paged)
* Destroy the cache -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -16976,78 +16221,70 @@ check_expunge_entry_errs(unsigned paged)
entry_ptr = &((entries[0])[0]);
protect_entry(file_ptr, 0, 0);
-
}
- if(pass) {
+ if (pass) {
- result = H5C_expunge_entry(file_ptr,
- types[0], entry_ptr->addr, H5C__NO_FLAGS_SET);
+ result = H5C_expunge_entry(file_ptr, types[0], entry_ptr->addr, H5C__NO_FLAGS_SET);
- if(result > 0) {
+ if (result > 0) {
- pass = FALSE;
- failure_mssg =
- "attempt to expunge a protected entry succeeded.\n";
-
- } else {
-
- unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
+ pass = FALSE;
+ failure_mssg = "attempt to expunge a protected entry succeeded.\n";
+ }
+ else {
+ unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
+ }
}
- }
-
- if(pass) {
- result = H5C_expunge_entry(file_ptr,
- types[0], entry_ptr->addr, H5C__NO_FLAGS_SET);
+ if (pass) {
- if(result > 0) {
+ result = H5C_expunge_entry(file_ptr, types[0], entry_ptr->addr, H5C__NO_FLAGS_SET);
- pass = FALSE;
- failure_mssg =
- "attempt to expunge a pinned entry succeeded.\n";
+ if (result > 0) {
- } else {
-
- unpin_entry(0, 0);
+ pass = FALSE;
+ failure_mssg = "attempt to expunge a pinned entry succeeded.\n";
+ }
+ else {
+ unpin_entry(0, 0);
+ }
}
- }
-
- if(pass) {
- result = H5C_expunge_entry(file_ptr,
- types[0], entry_ptr->addr, H5C__NO_FLAGS_SET);
+ if (pass) {
- if(result < 0) {
+ result = H5C_expunge_entry(file_ptr, types[0], entry_ptr->addr, H5C__NO_FLAGS_SET);
- pass = FALSE;
- failure_mssg =
- "attempt to expunge an unpinned and unprotected entry failed.\n";
+ if (result < 0) {
+ pass = FALSE;
+ failure_mssg = "attempt to expunge an unpinned and unprotected entry failed.\n";
+ }
}
- }
-
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_expunge_entry_errs() */
-
/*-------------------------------------------------------------------------
* Function: check_move_entry_errs()
*
@@ -17064,15 +16301,15 @@ check_expunge_entry_errs(unsigned paged)
static unsigned
check_move_entry_errs(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- test_entry_t * entry_ptr = NULL;
- test_entry_t * entry_0_0_ptr;
- test_entry_t * entry_0_1_ptr;
- test_entry_t * entry_1_0_ptr;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ test_entry_t *entry_ptr = NULL;
+ test_entry_t *entry_0_0_ptr;
+ test_entry_t *entry_0_1_ptr;
+ test_entry_t *entry_1_0_ptr;
- if(paged)
+ if (paged)
TESTING("move entry related errors (paged aggregation)")
else
TESTING("move entry related errors")
@@ -17084,10 +16321,10 @@ check_move_entry_errs(unsigned paged)
* fail. Destroy the cache -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
insert_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
@@ -17099,25 +16336,25 @@ check_move_entry_errs(unsigned paged)
entry_1_0_ptr = &((entries[1])[0]);
} /* end if */
- if(pass) {
+ if (pass) {
result = H5C_move_entry(cache_ptr, types[0], entry_0_0_ptr->addr, entry_0_1_ptr->addr);
- if(result >= 0) {
- pass = FALSE;
+ if (result >= 0) {
+ pass = FALSE;
failure_mssg = "move to addr of same type succeeded.\n";
} /* end if */
- } /* end if */
+ } /* end if */
- if(pass) {
+ if (pass) {
result = H5C_move_entry(cache_ptr, types[0], entry_0_0_ptr->addr, entry_1_0_ptr->addr);
- if(result >= 0) {
- pass = FALSE;
+ if (result >= 0) {
+ pass = FALSE;
failure_mssg = "move to addr of different type succeeded.\n";
} /* end if */
- } /* end if */
+ } /* end if */
- if(pass)
+ if (pass)
takedown_cache(file_ptr, FALSE, FALSE);
/* Allocate a cache, protect an entry R/O, and then call
@@ -17127,10 +16364,10 @@ check_move_entry_errs(unsigned paged)
* This should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
insert_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
@@ -17139,21 +16376,21 @@ check_move_entry_errs(unsigned paged)
entry_ptr = &((entries[0])[0]);
} /* end if */
- if(pass) {
- result = H5C_move_entry(cache_ptr, types[0], entry_ptr->header.addr, entry_ptr->header.addr + 10);
+ if (pass) {
+ result = H5C_move_entry(cache_ptr, types[0], entry_ptr->header.addr, entry_ptr->header.addr + 10);
- if(result >= 0) {
- pass = FALSE;
+ if (result >= 0) {
+ pass = FALSE;
failure_mssg = "Call to H5C_move_entry on a R/O protected entry succeeded.\n";
} /* end if */
else
unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
} /* end if */
- if(pass)
+ if (pass)
takedown_cache(file_ptr, FALSE, FALSE);
- if(pass)
+ if (pass)
PASSED();
else {
H5_FAILED()
@@ -17164,7 +16401,6 @@ check_move_entry_errs(unsigned paged)
return (unsigned)!pass;
} /* check_move_entry_errs() */
-
/*-------------------------------------------------------------------------
* Function: check_resize_entry_errs()
*
@@ -17182,11 +16418,11 @@ check_move_entry_errs(unsigned paged)
static unsigned
check_resize_entry_errs(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("resize entry related errors (paged aggregation)")
else
TESTING("resize entry related errors")
@@ -17204,7 +16440,7 @@ check_resize_entry_errs(unsigned paged)
* This should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -17213,61 +16449,59 @@ check_resize_entry_errs(unsigned paged)
entry_ptr = &((entries[0])[0]);
protect_entry(file_ptr, 0, 0);
-
}
- if(pass) {
+ if (pass) {
- result = H5C_resize_entry((void *)entry_ptr, (size_t)1);
+ result = H5C_resize_entry((void *)entry_ptr, (size_t)1);
- if(result < 0) {
-
- pass = FALSE;
- failure_mssg =
- "Call to H5C_resize_entry on a protected entry failed.\n";
+ if (result < 0) {
- } else {
+ pass = FALSE;
+ failure_mssg = "Call to H5C_resize_entry on a protected entry failed.\n";
+ }
+ else {
unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
-
}
}
- if(pass) {
-
- result = H5C_resize_entry((void *)entry_ptr, (size_t)0);
+ if (pass) {
- if(result >= 0) {
+ result = H5C_resize_entry((void *)entry_ptr, (size_t)0);
- pass = FALSE;
- failure_mssg =
- "Call to H5C_resize_entry with 0 new size succeeded.\n";
+ if (result >= 0) {
- } else {
+ pass = FALSE;
+ failure_mssg = "Call to H5C_resize_entry with 0 new size succeeded.\n";
+ }
+ else {
unpin_entry(0, 0);
-
}
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_resize_entry_errs() */
-
/*-------------------------------------------------------------------------
* Function: check_unprotect_ro_dirty_err()
*
@@ -17285,11 +16519,11 @@ check_resize_entry_errs(unsigned paged)
static unsigned
check_unprotect_ro_dirty_err(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *entry_ptr;
- if(paged)
+ if (paged)
TESTING("unprotect a read only entry dirty error (paged aggregation)")
else
TESTING("unprotect a read only entry dirty error")
@@ -17301,7 +16535,7 @@ check_unprotect_ro_dirty_err(unsigned paged)
* -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -17312,26 +16546,23 @@ check_unprotect_ro_dirty_err(unsigned paged)
entry_ptr = &((entries[0])[0]);
}
- if(pass) {
+ if (pass) {
- result = H5C_unprotect(file_ptr,
- entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
+ result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
- if(result >= 0) {
+ if (result >= 0) {
- pass = FALSE;
- failure_mssg =
- "attempt to unprotect a ro entry dirty succeeded 1.\n";
+ pass = FALSE;
+ failure_mssg = "attempt to unprotect a ro entry dirty succeeded 1.\n";
}
}
- if(pass) {
-
- unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+ if (pass) {
+ unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
@@ -17342,7 +16573,7 @@ check_unprotect_ro_dirty_err(unsigned paged)
* This should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -17354,44 +16585,44 @@ check_unprotect_ro_dirty_err(unsigned paged)
entry_ptr = &((entries[0])[0]);
}
- if(pass) {
+ if (pass) {
- result = H5C_unprotect(file_ptr,
- entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
+ result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG);
- if(result > 0) {
+ if (result > 0) {
- pass = FALSE;
- failure_mssg =
- "attempt to unprotect a ro entry dirty succeeded 2.\n";
+ pass = FALSE;
+ failure_mssg = "attempt to unprotect a ro entry dirty succeeded 2.\n";
}
}
- if(pass) {
-
- unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+ if (pass) {
+ unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_unprotect_ro_dirty_err() */
-
/*-------------------------------------------------------------------------
* Function: check_protect_ro_rw_err()
*
@@ -17413,11 +16644,11 @@ check_unprotect_ro_dirty_err(unsigned paged)
static unsigned
check_protect_ro_rw_err(unsigned paged)
{
- H5F_t * file_ptr = NULL;
- test_entry_t * entry_ptr;
- void * thing_ptr = NULL;
+ H5F_t * file_ptr = NULL;
+ test_entry_t *entry_ptr;
+ void * thing_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("protect a read only entry rw error (paged aggregation)")
else
TESTING("protect a read only entry rw error")
@@ -17430,7 +16661,7 @@ check_protect_ro_rw_err(unsigned paged)
* Unprotect the entry and destroy the cache -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -17441,42 +16672,44 @@ check_protect_ro_rw_err(unsigned paged)
entry_ptr = &((entries[0])[0]);
}
- if(pass) {
+ if (pass) {
- thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr,
- types[0], entry_ptr->addr,
- &entry_ptr->addr, H5C__NO_FLAGS_SET);
+ thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[0], entry_ptr->addr, &entry_ptr->addr,
+ H5C__NO_FLAGS_SET);
- if(thing_ptr != NULL) {
+ if (thing_ptr != NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "attempt to protect a ro entry rw succeeded.\n";
}
}
- if(pass) {
+ if (pass) {
- unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
}
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_protect_ro_rw_err() */
-
/*-------------------------------------------------------------------------
* Function: check_protect_retries()
*
@@ -17492,15 +16725,15 @@ check_protect_ro_rw_err(unsigned paged)
static unsigned
check_protect_retries(unsigned paged)
{
- H5F_t * file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- test_entry_t *base_addr = NULL;
- test_entry_t *entry_ptr = NULL;
- H5C_cache_entry_t * cache_entry_ptr = NULL;
- int32_t type;
- int32_t idx;
-
- if(paged)
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ test_entry_t * base_addr = NULL;
+ test_entry_t * entry_ptr = NULL;
+ H5C_cache_entry_t *cache_entry_ptr = NULL;
+ int32_t type;
+ int32_t idx;
+
+ if (paged)
TESTING("protect an entry to verify retries (paged aggregation)")
else
TESTING("protect an entry to verify retries")
@@ -17508,58 +16741,54 @@ check_protect_retries(unsigned paged)
pass = TRUE;
/* Set up the cache */
- if(pass) {
+ if (pass) {
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
- /* Set up read attempts for verifying checksum */
- file_ptr->shared->read_attempts = 10;
+ /* Set up read attempts for verifying checksum */
+ file_ptr->shared->read_attempts = 10;
file_ptr->shared->retries_nbins = 1;
}
/* Test only for this type which has a speculative load */
type = VARIABLE_ENTRY_TYPE;
- idx = 0;
+ idx = 0;
- if(pass) {
+ if (pass) {
- cache_ptr = file_ptr->shared->cache;
- base_addr = entries[type];
+ cache_ptr = file_ptr->shared->cache;
+ base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- /* test case (1):
- * --actual_len is smaller the initial length from get_load_size()
- * --verify_chksum() returns TRUE after max_verify_ct is reached
- *
- */
- entry_ptr->actual_len = entry_ptr->size/2;
+ /* test case (1):
+ * --actual_len is smaller the initial length from get_load_size()
+ * --verify_chksum() returns TRUE after max_verify_ct is reached
+ *
+ */
+ entry_ptr->actual_len = entry_ptr->size / 2;
entry_ptr->max_verify_ct = 3;
- entry_ptr->verify_ct = 0;
+ entry_ptr->verify_ct = 0;
- cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr,
- types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[type], entry_ptr->addr,
+ &entry_ptr->addr, H5C__READ_ONLY_FLAG);
- if((cache_entry_ptr != (void *)entry_ptr) ||
- (!(entry_ptr->header.is_protected)) ||
- (!(entry_ptr->header.is_read_only)) ||
- (entry_ptr->header.ro_ref_count <= 0) ||
- (entry_ptr->header.type != types[type]) ||
- (entry_ptr->size != entry_ptr->header.size) ||
- (entry_ptr->addr != entry_ptr->header.addr) ||
- (entry_ptr->verify_ct != entry_ptr->max_verify_ct)) {
+ if ((cache_entry_ptr != (void *)entry_ptr) || (!(entry_ptr->header.is_protected)) ||
+ (!(entry_ptr->header.is_read_only)) || (entry_ptr->header.ro_ref_count <= 0) ||
+ (entry_ptr->header.type != types[type]) || (entry_ptr->size != entry_ptr->header.size) ||
+ (entry_ptr->addr != entry_ptr->header.addr) ||
+ (entry_ptr->verify_ct != entry_ptr->max_verify_ct)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error from H5C_protect().";
+ }
+ else {
- } else {
-
- HDassert((entry_ptr->cache_ptr == NULL) ||
- (entry_ptr->cache_ptr == cache_ptr));
+ HDassert((entry_ptr->cache_ptr == NULL) || (entry_ptr->cache_ptr == cache_ptr));
- entry_ptr->cache_ptr = cache_ptr;
- entry_ptr->file_ptr = file_ptr;
+ entry_ptr->cache_ptr = cache_ptr;
+ entry_ptr->file_ptr = file_ptr;
entry_ptr->is_protected = TRUE;
entry_ptr->is_read_only = TRUE;
entry_ptr->ro_ref_count++;
@@ -17568,46 +16797,48 @@ check_protect_retries(unsigned paged)
HDassert(((entry_ptr->header).type)->id == type);
}
- if(pass)
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, idx, H5C__NO_FLAGS_SET);
+ if (pass)
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, idx, H5C__NO_FLAGS_SET);
- if(pass) {
+ if (pass) {
entry_ptr = &(base_addr[++idx]);
- /* test case (2):
- * --actual_len is greater the initial length from get_load_size()
- * --verify_chksum() returns FALSE even after all tries is reached
- * (file_ptr->shared->read_attempts is smaller then max_verify_ct)
- */
- entry_ptr->actual_len = entry_ptr->size*2;
+ /* test case (2):
+ * --actual_len is greater the initial length from get_load_size()
+ * --verify_chksum() returns FALSE even after all tries is reached
+ * (file_ptr->shared->read_attempts is smaller then max_verify_ct)
+ */
+ entry_ptr->actual_len = entry_ptr->size * 2;
entry_ptr->max_verify_ct = 11;
- entry_ptr->verify_ct = 0;
+ entry_ptr->verify_ct = 0;
- cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr,
- types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[type], entry_ptr->addr,
+ &entry_ptr->addr, H5C__READ_ONLY_FLAG);
- /* H5C_protect() should fail after all retries fail */
- if(cache_entry_ptr != NULL)
- pass = FALSE;
+ /* H5C_protect() should fail after all retries fail */
+ if (cache_entry_ptr != NULL)
+ pass = FALSE;
}
-
takedown_cache(file_ptr, FALSE, FALSE);
reset_entries();
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_msg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_msg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_protect_retries() */
-
/*-------------------------------------------------------------------------
* Function: check_evictions_enabled_err()
*
@@ -17629,12 +16860,12 @@ check_protect_retries(unsigned paged)
static unsigned
check_check_evictions_enabled_err(unsigned paged)
{
- herr_t result;
+ herr_t result;
hbool_t evictions_enabled;
- H5F_t * file_ptr = NULL;
+ H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("get/set evictions enabled errors (paged aggregation)")
else
TESTING("get/set evictions enabled errors")
@@ -17654,100 +16885,100 @@ check_check_evictions_enabled_err(unsigned paged)
* Unprotect the entry and destroy the cache -- should succeed.
*/
- if(pass) {
+ if (pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
- if(pass) {
+ if (pass) {
- result = H5C_get_evictions_enabled(NULL, &evictions_enabled);
+ result = H5C_get_evictions_enabled(NULL, &evictions_enabled);
- if(result == SUCCEED) {
+ if (result == SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_evictions_enabled succeeded() 1.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_evictions_enabled(cache_ptr, NULL);
+ result = H5C_get_evictions_enabled(cache_ptr, NULL);
- if(result == SUCCEED) {
+ if (result == SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_evictions_enabled succeeded() 2.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_set_evictions_enabled(cache_ptr, TRUE);
+ result = H5C_set_evictions_enabled(cache_ptr, TRUE);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_evictions_enabled failed().\n";
-
- }
+ }
}
- if(pass) {
+ if (pass) {
(cache_ptr->resize_ctl).incr_mode = H5C_incr__threshold;
- result = H5C_get_evictions_enabled(cache_ptr, FALSE);
+ result = H5C_get_evictions_enabled(cache_ptr, FALSE);
- if(result == SUCCEED) {
+ if (result == SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_evictions_enabled succeeded() 1.\n";
-
- } else if(cache_ptr->evictions_enabled == TRUE) {
-
- }
+ }
+ else if (cache_ptr->evictions_enabled == TRUE) {
+ }
(cache_ptr->resize_ctl).incr_mode = H5C_incr__off;
}
- if(pass) {
+ if (pass) {
(cache_ptr->resize_ctl).decr_mode = H5C_decr__threshold;
- result = H5C_get_evictions_enabled(cache_ptr, FALSE);
+ result = H5C_get_evictions_enabled(cache_ptr, FALSE);
- if(result == SUCCEED) {
+ if (result == SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_evictions_enabled succeeded() 2.\n";
}
(cache_ptr->resize_ctl).decr_mode = H5C_decr__off;
}
-
- if(cache_ptr) {
+ if (cache_ptr) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_evictions_enabled_err() */
-
/*-------------------------------------------------------------------------
* Function: check_auto_cache_resize()
*
@@ -17764,33 +16995,29 @@ check_check_evictions_enabled_err(unsigned paged)
*-------------------------------------------------------------------------
*/
-hbool_t rpt_fcn_called = FALSE;
+hbool_t rpt_fcn_called = FALSE;
enum H5C_resize_status rpt_status;
-static void test_rpt_fcn(H5_ATTR_UNUSED H5C_t * cache_ptr,
- H5_ATTR_UNUSED int32_t version,
- H5_ATTR_UNUSED double hit_rate,
- enum H5C_resize_status status,
- H5_ATTR_UNUSED size_t old_max_cache_size,
- H5_ATTR_UNUSED size_t new_max_cache_size,
- H5_ATTR_UNUSED size_t old_min_clean_size,
- H5_ATTR_UNUSED size_t new_min_clean_size)
+static void
+test_rpt_fcn(H5_ATTR_UNUSED H5C_t *cache_ptr, H5_ATTR_UNUSED int32_t version, H5_ATTR_UNUSED double hit_rate,
+ enum H5C_resize_status status, H5_ATTR_UNUSED size_t old_max_cache_size,
+ H5_ATTR_UNUSED size_t new_max_cache_size, H5_ATTR_UNUSED size_t old_min_clean_size,
+ H5_ATTR_UNUSED size_t new_min_clean_size)
{
rpt_fcn_called = TRUE;
- rpt_status = status;
+ rpt_status = status;
}
static unsigned
check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
{
- hbool_t show_progress = FALSE;
- herr_t result;
- int32_t i;
- int32_t checkpoint = 0;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5C_auto_size_ctl_t auto_size_ctl =
- {
+ hbool_t show_progress = FALSE;
+ herr_t result;
+ int32_t i;
+ int32_t checkpoint = 0;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5C_auto_size_ctl_t auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
/* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn,
@@ -17804,7 +17031,6 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
/* int64_t epoch_length = */ 1000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
@@ -17815,10 +17041,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
-
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -17832,839 +17057,805 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
/* int32_t epochs_before_eviction = */ 3,
/* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f
- };
+ /* double empty_reserve = */ 0.05f};
- if(paged)
+ if (paged)
TESTING("automatic cache resizing (paged aggregation)")
else
TESTING("automatic cache resizing")
pass = TRUE;
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* allocate a cache, enable automatic cache resizing, and then force
* the cache through all its operational modes. Verify that all
* performs as expected.
*/
- if(pass) {
+ if (pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
- pass = FALSE;
+ if (result != SUCCEED) {
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(pass) {
- if((cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024))) {
+ if (pass) {
+ if ((cache_ptr->max_cache_size != (512 * 1024)) || (cache_ptr->min_clean_size != (256 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after initialization.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache not full -- should result in not
* full status.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000)) {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, PICO_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, PICO_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != not_full) ||
- (cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != not_full) || (cache_ptr->max_cache_size != (512 * 1024)) ||
+ (cache_ptr->min_clean_size != (256 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 1.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full -- should result in increase
* of cache size from .5 to 1 meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (1 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (1 * 1024 * 1024)) || (cache_ptr->min_clean_size != (512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 2.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache not full -- should result in not
* full status.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, PICO_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, PICO_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != not_full) ||
- (cache_ptr->max_cache_size != (1 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != not_full) ||
+ (cache_ptr->max_cache_size != (1 * 1024 * 1024)) || (cache_ptr->min_clean_size != (512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 3.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full again -- should result in increase
* of cache size from 1 to 2 meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 4.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full again -- should result in increase
* of cache size from 2 to 4 meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 5.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full again -- should result in increase
* of cache size from 4 to 8 meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 6.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full again -- should result in increase
* of cache size from 8 to 12 meg. Note that max increase reduced the
* size of the increase.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (12 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (6 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (12 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (6 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 7.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full again -- should result in increase
* of cache size from 12 to 14 meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (14 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (7 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (14 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (7 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 8.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full and at maximum size -- should
* in no change in size and a result of at_max_size.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (14 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (7 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (14 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (7 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 9.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate with cache full and at maximum size -- should
* result in a decrease from 14 to 13 Meg -- note that max decrease
* reduced the size of the reduction
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (13 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (6 * 1024 * 1024 + 512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (13 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (6 * 1024 * 1024 + 512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 10.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* the current cache configuration is inconvenient for testing cache
* size reduction, so lets change it some something easier to work
* with.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1000 * 1000 + 10;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.1f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1000 * 1000 + 10;
- auto_size_ctl.max_size = 8 * 1000 * 1000;
- auto_size_ctl.min_size = 500 * 1000;
+ auto_size_ctl.min_clean_fraction = 0.1f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 8 * 1000 * 1000;
+ auto_size_ctl.min_size = 500 * 1000;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1000 * 1000);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1000 * 1000);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decrement = 0.5f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1000 * 1000);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1000 * 1000);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
- pass = FALSE;
+ if (result != SUCCEED) {
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1000 * 1000 + 10)) ||
- (cache_ptr->min_clean_size != (400 * 1000 + 1))) {
+ if ((cache_ptr->max_cache_size != (4 * 1000 * 1000 + 10)) ||
+ (cache_ptr->min_clean_size != (400 * 1000 + 1))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 1.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should result in a decrease from ~4 to ~3
* M -- note that max decrease reduces the size of the reduction
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (3 * 1000 * 1000 + 10)) ||
- (cache_ptr->min_clean_size != (300 * 1000 + 1))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (3 * 1000 * 1000 + 10)) ||
+ (cache_ptr->min_clean_size != (300 * 1000 + 1))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 11.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate again -- should result in a decrease from ~3
* to ~2 M -- again note that max decrease reduces the size of the
* reduction.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2 * 1000 * 1000 + 10)) ||
- (cache_ptr->min_clean_size != (200 * 1000 + 1))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (2 * 1000 * 1000 + 10)) ||
+ (cache_ptr->min_clean_size != (200 * 1000 + 1))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 12.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate again -- should result in a decrease from ~2
* to ~1 M -- again note that max decrease reduces the size of the
* reduction, but only by five bites.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (1 * 1000 * 1000 + 10)) ||
- (cache_ptr->min_clean_size != (100 * 1000 + 1))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (1 * 1000 * 1000 + 10)) ||
+ (cache_ptr->min_clean_size != (100 * 1000 + 1))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 13.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate again -- should result in a decrease from ~1
* to ~0.5 M -- max decrease is no longer a factor. New size is five
* bytes above the minimum.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (500 * 1000 + 5)) ||
- (cache_ptr->min_clean_size != (50 * 1000))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (500 * 1000 + 5)) || (cache_ptr->min_clean_size != (50 * 1000))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 14.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate again -- should result in a decrease of five
* bytes to the minimum cache size.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (500 * 1000)) ||
- (cache_ptr->min_clean_size != (50 * 1000))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (500 * 1000)) ||
+ (cache_ptr->min_clean_size != (50 * 1000))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 15.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate again -- Already at minimum size so no change in
* cache size and result should be at_min_size.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_min_size) ||
- (cache_ptr->max_cache_size != (500 * 1000)) ||
- (cache_ptr->min_clean_size != (50 * 1000))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_min_size) || (cache_ptr->max_cache_size != (500 * 1000)) ||
+ (cache_ptr->min_clean_size != (50 * 1000))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 16.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force in range hit rate -- should be no change in cache size,
* and result should be in_spec.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 900))
- {
+ i = 0;
+ while (pass && (i < 900)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- while(pass && (i < 1000))
- {
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i + 1000);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i + 1000, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (500 * 1000)) ||
- (cache_ptr->min_clean_size != (50 * 1000))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->max_cache_size != (500 * 1000)) ||
+ (cache_ptr->min_clean_size != (50 * 1000))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 17.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full -- should
* increase cache size from .5 to 1 M.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (1 * 1000 * 1000)) ||
- (cache_ptr->min_clean_size != (100 * 1000))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (1 * 1000 * 1000)) || (cache_ptr->min_clean_size != (100 * 1000))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 18.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should result in a decrease to the
* minimum cache size.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (500 * 1000)) ||
+ (cache_ptr->min_clean_size != (50 * 1000))) {
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (500 * 1000)) ||
- (cache_ptr->min_clean_size != (50 * 1000))) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 19.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/******************************************************************
* now do some tests with the maximum increase and decrease sizes
* disabled.
******************************************************************/
- if(pass) {
+ if (pass) {
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.increment = 4.0f;
- auto_size_ctl.increment = 4.0f;
+ auto_size_ctl.apply_max_increment = FALSE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.apply_max_increment = FALSE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.decrement = 0.25f;
- auto_size_ctl.decrement = 0.25f;
-
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
- pass = FALSE;
+ if (result != SUCCEED) {
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 2.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should result in a decrease to the
* minimum cache size.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (1 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (1 * 1024 * 1024)) || (cache_ptr->min_clean_size != (512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 20.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full -- should increase cache size
* from 1 to 4 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 21.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate again with cache full -- should increase cache
* size from 4 to 16 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (16 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (8 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (16 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (8 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 22.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should result in a decrease cache size from
* 16 to 4 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 23.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/******************************************************************
* We have tested the threshold increment and decrement modes.
@@ -18673,72 +17864,70 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
* Reconfigure the cache for this testing.
******************************************************************/
- if(pass) {
+ if (pass) {
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1024 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1024 * 1024;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.max_size = 8 * 1024 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.max_size = 8 * 1024 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decr_mode = H5C_decr__age_out;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
-
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = FALSE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = FALSE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
- pass = FALSE;
+ if (result != SUCCEED) {
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 3.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
-
- if(cork_ageout)
- cork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE);
+ if (cork_ageout)
+ cork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE);
/* fill the cache with 1024 byte entries -- nothing should happen
* for three epochs while the markers are inserted into the cache
@@ -18747,380 +17936,365 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
* increase its size. Since we are already at max size, it will
* not be able to.
*/
- if(pass) { /* first epoch */
+ if (pass) { /* first epoch */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000)) {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 24.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* second epoch */
+ if (pass) { /* second epoch */
rpt_fcn_called = FALSE;
- i = 1000;
- while(pass && (i < 2000)) {
+ i = 1000;
+ while (pass && (i < 2000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 25.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* third epoch */
+ if (pass) { /* third epoch */
rpt_fcn_called = FALSE;
- i = 2000;
- while(pass && (i < 3000)) {
+ i = 2000;
+ while (pass && (i < 3000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 26.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fourth epoch -- If the hit rate were above the lower threshold,
* we would see cache size reduction now. However, nothing will
* happen until we get the hit rate above the lower threshold.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000)) {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 27.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fifth epoch -- force the hit rate to 100%. We should see cache size
* reduction now.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000)) {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2001 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(2001 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (2001 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(2001 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 28.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* sixth epoch -- force the hit rate to 100% again.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000)) {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (1001 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(1001 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (1001 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(1001 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 29.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* seventh epoch -- force the hit rate to 100% again.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000)) {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (1000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(1000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(1000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 30.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* eigth epoch -- force the hit rate to 100% again -- should be steady
* state.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000)) {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (1000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(1000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->max_cache_size != (1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(1000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 31.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* now just bang on one entry -- after three epochs, this should
* get all entries other than the one evicted, and the cache size
* should be decreased to the minimum.
*/
- if(pass) { /* ninth epoch */
+ if (pass) { /* ninth epoch */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000)) {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (1000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(1000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->max_cache_size != (1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(1000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 32.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* tenth epoch */
+ if (pass) { /* tenth epoch */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000)) {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (1000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(1000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->max_cache_size != (1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(1000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 33.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* eleventh epoch -- cache size reduction */
+ if (pass) { /* eleventh epoch -- cache size reduction */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000)) {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size !=
- MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (512 * 1024)) ||
+ (cache_ptr->min_clean_size != (256 * 1024)) || (cache_ptr->index_len != 2) ||
+ (cache_ptr->index_size != MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 34.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* twelth epoch -- at minimum size so no more ageouts */
+ if (pass) { /* twelth epoch -- at minimum size so no more ageouts */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000)) {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_min_size) ||
- (cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size !=
- MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
+ if ((!rpt_fcn_called) || (rpt_status != at_min_size) || (cache_ptr->max_cache_size != (512 * 1024)) ||
+ (cache_ptr->min_clean_size != (256 * 1024)) || (cache_ptr->index_len != 2) ||
+ (cache_ptr->index_size != MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 35.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
- if(cork_ageout)
- uncork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (cork_ageout)
+ uncork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE);
/* repeat the above test, but with max_decrement enabled to see
* if that features works as it should. Note that this will change
* the structure of the test a bit.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1024 * 1024;
- auto_size_ctl.max_size = 8 * 1024 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 8 * 1024 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out;
- auto_size_ctl.decr_mode = H5C_decr__age_out;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = FALSE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = FALSE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 4.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fill the cache with 1024 byte entries -- nothing should happen
* for three epochs while the markers are inserted into the cache
@@ -19129,510 +18303,480 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
* increase its size. Since we are already at max size, it will
* not be able to.
*/
- if(pass) { /* first epoch */
+ if (pass) { /* first epoch */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 36.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* second epoch */
+ if (pass) { /* second epoch */
rpt_fcn_called = FALSE;
- i = 1000;
- while(pass && (i < 2000))
- {
+ i = 1000;
+ while (pass && (i < 2000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 37.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* third epoch */
+ if (pass) { /* third epoch */
rpt_fcn_called = FALSE;
- i = 2000;
- while(pass && (i < 3000))
- {
+ i = 2000;
+ while (pass && (i < 3000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 38.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fourth epoch -- If the hit rate were above the lower threshold,
* we would see cache size reduction now. However, nothing will
* happen until we get the hit rate above the lower threshold.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 39.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fifth epoch -- force the hit rate to 100%. We should see cache size
* reduction now.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (7 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (7 * 512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (7 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (7 * 512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 40.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* sixth epoch -- force the hit rate to 100% again.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 2000;
- while(pass && (i < 3000))
- {
+ i = 2000;
+ while (pass && (i < 3000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (6 * 512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (6 * 512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 41.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* seventh epoch -- keep hit rate at 100%, and keep 2K entries active.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (5 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (5 * 512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (5 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (5 * 512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 42.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* eigth epoch -- still 100% hit rate
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 2000;
- while(pass && (i < 3000))
- {
+ i = 2000;
+ while (pass && (i < 3000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 43.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* ninth epoch --hit rate at 100%.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (3 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (3 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 44.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* tenth epoch -- still 100% hit rate
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 2000;
- while(pass && (i < 3000))
- {
+ i = 2000;
+ while (pass && (i < 3000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 512 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 45.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* eleventh epoch -- hit rate at 100% -- starting to stableize
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(2000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (2000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(2000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 46.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* twelth epoch -- force the hit rate to 100% again -- should be steady
* state.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 2000;
- while(pass && (i < 3000))
- {
+ i = 2000;
+ while (pass && (i < 3000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (2000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(2000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->max_cache_size != (2000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(2000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 47.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* now just bang on one entry -- after three epochs, this should
* get all entries other than the one evicted, and the cache size
* should be decreased to the minimum.
*/
- if(pass) { /* thirteenth epoch */
+ if (pass) { /* thirteenth epoch */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (2000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(2000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->max_cache_size != (2000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(2000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 48.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* fourteenth epoch */
+ if (pass) { /* fourteenth epoch */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size !=
- (1001 * 1024 + MONSTER_ENTRY_SIZE)) ||
- (cache_ptr->min_clean_size !=
- (1001 * 512 + MONSTER_ENTRY_SIZE / 2))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (1001 * 1024 + MONSTER_ENTRY_SIZE)) ||
+ (cache_ptr->min_clean_size != (1001 * 512 + MONSTER_ENTRY_SIZE / 2))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 49.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* fifteenth epoch -- cache size reduction */
+ if (pass) { /* fifteenth epoch -- cache size reduction */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size !=
- MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (512 * 1024)) ||
+ (cache_ptr->min_clean_size != (256 * 1024)) || (cache_ptr->index_len != 2) ||
+ (cache_ptr->index_size != MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 50.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* sixteenth epoch -- at minimum size so no more ageouts */
+ if (pass) { /* sixteenth epoch -- at minimum size so no more ageouts */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_min_size) ||
- (cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size !=
- MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
+ if ((!rpt_fcn_called) || (rpt_status != at_min_size) || (cache_ptr->max_cache_size != (512 * 1024)) ||
+ (cache_ptr->min_clean_size != (256 * 1024)) || (cache_ptr->index_len != 2) ||
+ (cache_ptr->index_size != MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 51.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* repeat the test yet again, this time with empty reserve enabled.
* Again, some structural changes in the test are necessary.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
-
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1024 * 1024;
+ if (pass) {
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.max_size = 8 * 1024 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.max_size = 8 * 1024 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.decr_mode = H5C_decr__age_out;
+ auto_size_ctl.decr_mode = H5C_decr__age_out;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decrement = 0.5f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 5.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fill the cache with 1024 byte entries -- nothing should happen
* for three epochs while the markers are inserted into the cache
@@ -19641,330 +18785,305 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
* increase its size. Since we are already at max size, it will
* not be able to.
*/
- if(pass) { /* first epoch */
+ if (pass) { /* first epoch */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 52.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* second epoch */
+ if (pass) { /* second epoch */
rpt_fcn_called = FALSE;
- i = 1000;
- while(pass && (i < 2000))
- {
+ i = 1000;
+ while (pass && (i < 2000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 53.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* third epoch */
+ if (pass) { /* third epoch */
rpt_fcn_called = FALSE;
- i = 2000;
- while(pass && (i < 3000))
- {
+ i = 2000;
+ while (pass && (i < 3000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 54.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fourth epoch -- If the hit rate were above the lower threshold,
* we would see cache size reduction now. However, nothing will
* happen until we get the hit rate above the lower threshold.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 55.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fifth epoch -- force the hit rate to 100%. We should see cache size
* reduction now.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (4002 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(4002 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (4002 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(4002 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 56.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* sixth epoch -- force the hit rate to 100% again.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2002 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(2002 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (2002 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(2002 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 57.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* seventh epoch -- force the hit rate to 100% again.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(2000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (2000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(2000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 58.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* eigth epoch -- force the hit rate to 100% again -- should be steady
* state.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 3000;
- while(pass && (i < 4000))
- {
+ i = 3000;
+ while (pass && (i < 4000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (2000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(2000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->max_cache_size != (2000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(2000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 59.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* now just bang on one entry -- after three epochs, this should
* get all entries other than the one evicted, and the cache size
* should be decreased to the minimum.
*/
- if(pass) { /* ninth epoch */
+ if (pass) { /* ninth epoch */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (2000 * 1024)) ||
- (cache_ptr->min_clean_size != (int)(2000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->max_cache_size != (2000 * 1024)) ||
+ (cache_ptr->min_clean_size != (int)(2000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 60.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* tenth epoch */
+ if (pass) { /* tenth epoch */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (2000 * 1024)) ||
- (cache_ptr->min_clean_size != (2000 * 512))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->max_cache_size != (2000 * 1024)) ||
+ (cache_ptr->min_clean_size != (2000 * 512))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 61.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* eleventh epoch -- cache size reduction */
+ if (pass) { /* eleventh epoch -- cache size reduction */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size !=
- MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (512 * 1024)) ||
+ (cache_ptr->min_clean_size != (256 * 1024)) || (cache_ptr->index_len != 2) ||
+ (cache_ptr->index_size != MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 62.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* twelth epoch -- at minimum size so no more ageouts */
+ if (pass) { /* twelth epoch -- at minimum size so no more ageouts */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_min_size) ||
- (cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size !=
- MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
+ if ((!rpt_fcn_called) || (rpt_status != at_min_size) || (cache_ptr->max_cache_size != (512 * 1024)) ||
+ (cache_ptr->min_clean_size != (256 * 1024)) || (cache_ptr->index_len != 2) ||
+ (cache_ptr->index_size != MONSTER_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 63.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Repeat the test again, this time using the age out with threshold
* mode. To simplify the testing, set epochs to eviction to 1.
@@ -19972,379 +19091,366 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
* Again, there are some minor structural changes in the test.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
-
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1024 * 1024;
+ if (pass) {
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.max_size = 8 * 1024 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.max_size = 8 * 1024 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
- auto_size_ctl.incr_mode = H5C_incr__off;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.incr_mode = H5C_incr__off;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
/* NOTE: upper_hr_threshold MUST be type double (not float)
* or the cache test will fail on 64-bit systems.
*/
- auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */
+ auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */
- auto_size_ctl.decrement = 0.5f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */
- auto_size_ctl.apply_empty_reserve = FALSE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = FALSE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
- pass = FALSE;
+ if (result != SUCCEED) {
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 7.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 6.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fill the cache with 4K byte entries -- increment mode is off,
* so cache size reduction should kick in as soon as we get the
* hit rate above .999.
*/
- if(pass) { /* first epoch -- hit rate 0 */
+ if (pass) { /* first epoch -- hit rate 0 */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 64.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* second epoch -- hit rate 0 */
+ if (pass) { /* second epoch -- hit rate 0 */
rpt_fcn_called = FALSE;
- i = 1000;
- while(pass && (i < 2000))
- {
+ i = 1000;
+ while (pass && (i < 2000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 65.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* third epoch -- hit rate 1.0 -- should see decrease */
+ if (pass) { /* third epoch -- hit rate 1.0 -- should see decrease */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 66.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fourth epoch -- load up the cache again -- hit rate 0 */
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 67.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fifth epoch -- still loading up the cache -- hit rate 0 */
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 1000;
- while(pass && (i < 2000))
- {
+ i = 1000;
+ while (pass && (i < 2000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 68.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* sixth epoch -- force hit rate to .998 -- should be no reduction */
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 1002;
- while(pass && (i < 2002))
- {
+ i = 1002;
+ while (pass && (i < 2002)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (1001 * LARGE_ENTRY_SIZE)) ||
+ (cache_ptr->min_clean_size != (1001 * LARGE_ENTRY_SIZE / 2))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 69.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* seventh epoch -- force hit rate to .999 -- should see reduction
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 1003;
- while(pass && (i < 2003))
- {
+ i = 1003;
+ while (pass && (i < 2003)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (1000 * MEDIUM_ENTRY_SIZE)) ||
- (cache_ptr->min_clean_size != (1000 * MEDIUM_ENTRY_SIZE / 2))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (1000 * MEDIUM_ENTRY_SIZE)) ||
+ (cache_ptr->min_clean_size != (1000 * MEDIUM_ENTRY_SIZE / 2))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 70.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* We have now tested all the major ageout modes individually.
* Lets try them all together to look for unexpected interactions
* and/or bugs.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1000 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1000 * 1024;
- auto_size_ctl.max_size = 8 * 1000 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 8 * 1000 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
- auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.upper_hr_threshold = 0.999f; /* for ease of testing */
- auto_size_ctl.upper_hr_threshold = 0.999f; /* for ease of testing */
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1000 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1000 * 1024);
auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
- pass = FALSE;
+ if (result != SUCCEED) {
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 8.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024))) {
+ if ((cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 7.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fill the cache with 4K byte entries -- increment mode is threshold,
* so the decrease code will not be executed until the hit rate exceeds
* .75.
*/
- if(pass) { /* first epoch -- hit rate 0 */
+ if (pass) { /* first epoch -- hit rate 0 */
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 71.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { /* second epoch -- hit rate 0 */
+ if (pass) { /* second epoch -- hit rate 0 */
rpt_fcn_called = FALSE;
- i = 1000;
- while(pass && (i < 2000))
- {
+ i = 1000;
+ while (pass && (i < 2000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 72.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* third epoch -- force the hit rate to 1.0. Should be no change
* in the cache size due to the combination of the empty reserve
@@ -20354,407 +19460,392 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
*
* In this epoch, all we should see is a reduction in the index size.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
- (cache_ptr->index_size != (7 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (7 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 73.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fourth epoch -- hit rate still 1.0. Index size should decrease,
* but otherwise no change expected.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
- (cache_ptr->index_size != (6 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (6 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 74.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fifth epoch -- hit rate still 1.0. Index size should decrease,
* but otherwise no change expected.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
- (cache_ptr->index_size != (5 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (5 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 75.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* sixth epoch -- hit rate still 1.0. Index size should decrease,
* but otherwise no change expected. Note that the cache size is
* now just on the edge of meeting the clean reserve.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
- (cache_ptr->index_size != (4 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (4 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 76.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* seventh epoch -- hit rate still 1.0. No change in index size expected.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
- (cache_ptr->index_size != (4 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (4 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 77.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* eighth epoch -- start loading 1 KB entries. Hit rate 0 so
* decrease code shouldn't be called.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != at_max_size) ||
- (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
- (cache_ptr->index_size != (5 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != at_max_size) ||
+ (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (5 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 78.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* ninth epoch -- access the 1 KB entries again, driving the hit rate
* to 1.0. Decrease code should be triggered, but the max decrease
* should prevent the empty reserve from being met in this epoch.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
- (cache_ptr->index_size != (4 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (8 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (4 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 79.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* tenth epoch -- access the 1 KB entries yet again, forcing hit rate
* to 1.0. Decrease code should be triggered, and the empty reserve
* should finally be met.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (7 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (7 * 1000 * 1024 / 2)) ||
- (cache_ptr->index_size != (3 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (7 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (7 * 1000 * 1024 / 2)) ||
+ (cache_ptr->index_size != (3 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 80.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* eleventh epoch -- access the 1 KB entries yet again, forcing hit rate
* to 1.0. Decrease code should be triggered, and the empty reserve
* should be met again.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (6 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1000 * 1024)) ||
- (cache_ptr->index_size != (2 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (6 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (2 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 81.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* twelth epoch -- hit rate 1.0 -- decrease as before.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (5 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (5 * 1000 * 1024 / 2)) ||
- (cache_ptr->index_size != (1 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (5 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (5 * 1000 * 1024 / 2)) ||
+ (cache_ptr->index_size != (1 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 82.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* thirteenth epoch -- hit rate 1.0 -- decrease as before.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (4 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1000 * 1024)) ||
- (cache_ptr->index_size != (1 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (4 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (1 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 83.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fourteenth epoch -- hit rate 1.0 -- decrease as before.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (3 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1000 * 1024 / 2)) ||
- (cache_ptr->index_size != (1 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (3 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1000 * 1024 / 2)) ||
+ (cache_ptr->index_size != (1 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 84.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* fifteenth epoch -- hit rate 1.0 -- decrease as before.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1000 * 1024)) ||
- (cache_ptr->index_size != (1 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (2 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (1 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 85.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* sixteenth epoch -- hit rate 1.0 -- should be stable now
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (2 * 1000 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1000 * 1024)) ||
- (cache_ptr->index_size != (1 * 1000 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (2 * 1000 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1000 * 1024)) ||
+ (cache_ptr->index_size != (1 * 1000 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 86.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* now test the flash cache size increment code. At least at present,
* there should be no interaction between the regular auto-resize
@@ -20767,7 +19858,8 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
* code increases the cache size when and as expected.
*/
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Place the cache in a known state via a flush-destroy on the cache
* to clear out all entries, and then a reset on all the entries.
@@ -20776,366 +19868,344 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
* modes. Verify that all perform as expected.
*/
- if(pass) {
+ if (pass) {
flush_cache(file_ptr, TRUE, FALSE, FALSE);
- reset_entries();
+ reset_entries();
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* now repeat the above tests using the add space flash cache size
* increment algorithm.
*/
- if(pass) {
+ if (pass) {
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 64 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 64 * 1024;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.max_size = 1024 * 1024;
- auto_size_ctl.min_size = 5 * 1024;
+ auto_size_ctl.max_size = 1024 * 1024;
+ auto_size_ctl.min_size = 5 * 1024;
- auto_size_ctl.epoch_length = 100;
+ auto_size_ctl.epoch_length = 100;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (32 * 1024);
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (32 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space;
+ auto_size_ctl.flash_multiple = 1.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space;
- auto_size_ctl.flash_multiple = 1.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.upper_hr_threshold = 0.999f; /* for ease of testing */
- auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.upper_hr_threshold = 0.999f; /* for ease of testing */
-
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1000 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1000 * 1024);
auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
- pass = FALSE;
+ if (result != SUCCEED) {
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 12.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (64 * 1024)) ||
- (cache_ptr->min_clean_size != (32 * 1024)) ||
- (cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->cache_accesses != 0)) {
+ if ((cache_ptr->max_cache_size != (64 * 1024)) || (cache_ptr->min_clean_size != (32 * 1024)) ||
+ (cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || (cache_ptr->cache_accesses != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (0).\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Load a huge entry into the cache */
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, HUGE_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (64 * 1024)) ||
- (cache_ptr->min_clean_size != (32 * 1024)) ||
- (cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != HUGE_ENTRY_SIZE) ||
- (cache_ptr->cache_accesses != 1)))) {
+ if (pass && (((cache_ptr->max_cache_size != (64 * 1024)) ||
+ (cache_ptr->min_clean_size != (32 * 1024)) || (cache_ptr->index_len != 1) ||
+ (cache_ptr->index_size != HUGE_ENTRY_SIZE) || (cache_ptr->cache_accesses != 1)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (1).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now load a monster entry. Since a monster entry is larger than
* half the size of the cache, and there is not sufficient space
* for a monster entry in the cache, we will add space to the
* cache to make room for the entry.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (80 * 1024)) ||
- (cache_ptr->min_clean_size != (40 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size != (HUGE_ENTRY_SIZE +
- MONSTER_ENTRY_SIZE)) ||
- (cache_ptr->cache_accesses != 1)))) {
+ if (pass && (((cache_ptr->max_cache_size != (80 * 1024)) ||
+ (cache_ptr->min_clean_size != (40 * 1024)) || (cache_ptr->index_len != 2) ||
+ (cache_ptr->index_size != (HUGE_ENTRY_SIZE + MONSTER_ENTRY_SIZE)) ||
+ (cache_ptr->cache_accesses != 1)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (2).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Load a second monster entry. Since the monster entry is larger
* than half the size of the cache yet again, and there is not
* sufficient space for the monster entry in the cache, we again
* add space to the cache to make space for the entry.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 1);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (144 * 1024)) ||
- (cache_ptr->min_clean_size != (72 * 1024)) ||
- (cache_ptr->index_len != 3) ||
- (cache_ptr->index_size != ((2 * MONSTER_ENTRY_SIZE) +
- HUGE_ENTRY_SIZE)) ||
- (cache_ptr->cache_accesses != 1)))) {
+ if (pass && (((cache_ptr->max_cache_size != (144 * 1024)) ||
+ (cache_ptr->min_clean_size != (72 * 1024)) || (cache_ptr->index_len != 3) ||
+ (cache_ptr->index_size != ((2 * MONSTER_ENTRY_SIZE) + HUGE_ENTRY_SIZE)) ||
+ (cache_ptr->cache_accesses != 1)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (3).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Load a third moster entry. Should be no cache size increase this
* time.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 2);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (144 * 1024)) ||
- (cache_ptr->min_clean_size != (72 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE)) ||
- (cache_ptr->cache_accesses != 2)))) {
+ if (pass &&
+ (((cache_ptr->max_cache_size != (144 * 1024)) || (cache_ptr->min_clean_size != (72 * 1024)) ||
+ (cache_ptr->index_len != 2) || (cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE)) ||
+ (cache_ptr->cache_accesses != 2)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (4).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* delete existing entries to prepare for next test, and reset
* the size of the cache.
*/
- if(pass) {
+ if (pass) {
- expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 1);
- expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 2);
+ expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 1);
+ expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 2);
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
- pass = FALSE;
+ if (result != SUCCEED) {
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n";
- }
+ }
}
- if(pass &&
- (((cache_ptr->max_cache_size != (64 * 1024)) ||
- (cache_ptr->min_clean_size != (32 * 1024)) ||
- (cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (64 * 1024)) ||
+ (cache_ptr->min_clean_size != (32 * 1024)) || (cache_ptr->index_len != 0) ||
+ (cache_ptr->index_size != 0) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (5).\n";
- }
+ }
}
/* repeat the above basic test, only this time, use inserts to add
* entries to the cache, not protects.
*/
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* insert a huge entry into the cache */
- if(pass) {
+ if (pass) {
insert_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET);
- /* protect and unprotect a couple times to increment cache_accesses */
+ /* protect and unprotect a couple times to increment cache_accesses */
protect_entry(file_ptr, HUGE_ENTRY_TYPE, 1);
unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET);
protect_entry(file_ptr, HUGE_ENTRY_TYPE, 1);
unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (64 * 1024)) ||
- (cache_ptr->min_clean_size != (32 * 1024)) ||
- (cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != HUGE_ENTRY_SIZE) ||
- (cache_ptr->cache_accesses != 2)))) {
+ if (pass && (((cache_ptr->max_cache_size != (64 * 1024)) ||
+ (cache_ptr->min_clean_size != (32 * 1024)) || (cache_ptr->index_len != 1) ||
+ (cache_ptr->index_size != HUGE_ENTRY_SIZE) || (cache_ptr->cache_accesses != 2)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (6).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now insert a monster entry. Since a monster entry is larger than
* half the size of the cache, and there is not sufficient space
* for a monster entry in the cache, we will add space to the
* cache to make room for the entry.
*/
- if(pass) {
+ if (pass) {
insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 4, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (80 * 1024)) ||
- (cache_ptr->min_clean_size != (40 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size !=
- HUGE_ENTRY_SIZE + MONSTER_ENTRY_SIZE) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (80 * 1024)) ||
+ (cache_ptr->min_clean_size != (40 * 1024)) || (cache_ptr->index_len != 2) ||
+ (cache_ptr->index_size != HUGE_ENTRY_SIZE + MONSTER_ENTRY_SIZE) ||
+ (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (7).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Insert a second monster entry. Cache size should increase again.
*/
- if(pass) {
+ if (pass) {
insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 5, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (144 * 1024)) ||
- (cache_ptr->min_clean_size != (72 * 1024)) ||
- (cache_ptr->index_len != 3) ||
- (cache_ptr->index_size !=
- 2 * MONSTER_ENTRY_SIZE + HUGE_ENTRY_SIZE) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (144 * 1024)) ||
+ (cache_ptr->min_clean_size != (72 * 1024)) || (cache_ptr->index_len != 3) ||
+ (cache_ptr->index_size != 2 * MONSTER_ENTRY_SIZE + HUGE_ENTRY_SIZE) ||
+ (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (8).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Insert a third monster entry. Should be no cache size increase this
* time.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 6);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 6, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (144 * 1024)) ||
- (cache_ptr->min_clean_size != (72 * 1024)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE)) ||
- (cache_ptr->cache_accesses != 1)))) {
+ if (pass &&
+ (((cache_ptr->max_cache_size != (144 * 1024)) || (cache_ptr->min_clean_size != (72 * 1024)) ||
+ (cache_ptr->index_len != 2) || (cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE)) ||
+ (cache_ptr->cache_accesses != 1)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (9).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* delete existing entries to prepare for next test, and reset
* the size of the cache. We must also change the size of the needed
* variable entries before we run the test, so will protect and
* unprotect them now so as to get the correct initial size.
*/
- if(pass) {
+ if (pass) {
- expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 5);
- expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 6);
+ expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 5);
+ expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 6);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1024, TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1024, TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1024, TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, 1024, TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__DIRTIED_FLAG);
-
- flush_cache(file_ptr, TRUE, FALSE, FALSE);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, 1024, TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__DIRTIED_FLAG);
+ flush_cache(file_ptr, TRUE, FALSE, FALSE);
- if(pass) {
+ if (pass) {
- auto_size_ctl.initial_size = 6 * 1024;
- result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
+ auto_size_ctl.initial_size = 6 * 1024;
+ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n";
- }
+ }
}
- if(pass &&
- (((cache_ptr->max_cache_size != (6 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024)) ||
- (cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (6 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024)) || (cache_ptr->index_len != 0) ||
+ (cache_ptr->index_size != 0) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (10).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now load the variable entries into the cache */
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__NO_FLAGS_SET);
@@ -21149,245 +20219,221 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (6 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 4 * 1024) ||
- (cache_ptr->cache_accesses != 4)))) {
+ if (pass && (((cache_ptr->max_cache_size != (6 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 4 * 1024) || (cache_ptr->cache_accesses != 4)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (11).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* protect a variable entry, and re-size it to 3K. Should be
* no effect on the size of the cache.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (3 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
-
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (3 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
- if(pass &&
- (((cache_ptr->max_cache_size != (6 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 6 * 1024) ||
- (cache_ptr->cache_accesses != 5)))) {
+ if (pass && (((cache_ptr->max_cache_size != (6 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 6 * 1024) || (cache_ptr->cache_accesses != 5)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (12).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* protect the variable entry again, and re-size it to 10K. Should
* resize the cache to 13 KB. Note that cache_accesses will be 0
* in this case, since cache_accesses is incremented on the protect.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (10 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
-
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (10 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
- if(pass &&
- (((cache_ptr->max_cache_size != (13 * 1024)) ||
- (cache_ptr->min_clean_size != (13 * 512)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 13 * 1024) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (13 * 1024)) ||
+ (cache_ptr->min_clean_size != (13 * 512)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 13 * 1024) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (13).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* protect a second variable entry, and re-size it to 10K. Should
* resize to 22 KB.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (10 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
-
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (10 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
- if(pass &&
- (((cache_ptr->max_cache_size != (22 * 1024)) ||
- (cache_ptr->min_clean_size != (11 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 22 * 1024) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (22 * 1024)) ||
+ (cache_ptr->min_clean_size != (11 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 22 * 1024) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (14).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* protect a third variable entry, and re-size it to 10K. Should
* be no change in cache size.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (10 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
-
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (10 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
- if(pass &&
- (((cache_ptr->max_cache_size != (22 * 1024)) ||
- (cache_ptr->min_clean_size != (11 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 31 * 1024) ||
- (cache_ptr->cache_accesses != 1)))) {
+ if (pass && (((cache_ptr->max_cache_size != (22 * 1024)) ||
+ (cache_ptr->min_clean_size != (11 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 31 * 1024) || (cache_ptr->cache_accesses != 1)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (15).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* re-size the variable entries back down to their initial size, and
* restore the cache to its initial size as well, in preparation
* for the next test.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
- if(pass) {
+ if (pass) {
- auto_size_ctl.initial_size = 6 * 1024;
- result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
+ auto_size_ctl.initial_size = 6 * 1024;
+ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 14.\n";
- }
+ }
}
- if(pass &&
- (((cache_ptr->max_cache_size != (6 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 4 * 1024) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (6 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 4 * 1024) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (16).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now test flash cache resizes with pinned entries...
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__PIN_ENTRY_FLAG);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE);
- if(pass &&
- (((cache_ptr->max_cache_size != (6 * 1024)) ||
- (cache_ptr->min_clean_size != (6 * 512)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 5 * 1024) ||
- (cache_ptr->cache_accesses != 1)))) {
+ if (pass && (((cache_ptr->max_cache_size != (6 * 1024)) || (cache_ptr->min_clean_size != (6 * 512)) ||
+ (cache_ptr->index_len != 4) || (cache_ptr->index_size != 5 * 1024) ||
+ (cache_ptr->cache_accesses != 1)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (17).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE);
- if(pass &&
- (((cache_ptr->max_cache_size != (13 * 1024)) ||
- (cache_ptr->min_clean_size != (13 * 512)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 13 * 1024) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (13 * 1024)) ||
+ (cache_ptr->min_clean_size != (13 * 512)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 13 * 1024) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (18).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__PIN_ENTRY_FLAG);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE);
- if(pass &&
- (((cache_ptr->max_cache_size != (22 * 1024)) ||
- (cache_ptr->min_clean_size != (11 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 22 * 1024) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (22 * 1024)) ||
+ (cache_ptr->min_clean_size != (11 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 22 * 1024) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (19).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__PIN_ENTRY_FLAG);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE);
- if(pass &&
- (((cache_ptr->max_cache_size != (22 * 1024)) ||
- (cache_ptr->min_clean_size != (11 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 31 * 1024) ||
- (cache_ptr->cache_accesses != 1)))) {
+ if (pass && (((cache_ptr->max_cache_size != (22 * 1024)) ||
+ (cache_ptr->min_clean_size != (11 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 31 * 1024) || (cache_ptr->cache_accesses != 1)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (20).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Unpin the entries. Note that no entries are evicted as we don't
* load any entries.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__UNPIN_ENTRY_FLAG);
@@ -21398,144 +20444,131 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__UNPIN_ENTRY_FLAG);
- if(pass &&
- (((cache_ptr->max_cache_size != (22 * 1024)) ||
- (cache_ptr->min_clean_size != (11 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 31 * 1024) ||
- (cache_ptr->cache_accesses != 4)))) {
+ if (pass && (((cache_ptr->max_cache_size != (22 * 1024)) ||
+ (cache_ptr->min_clean_size != (11 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 31 * 1024) || (cache_ptr->cache_accesses != 4)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (21).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* re-size the variable entries back down to their initial size, and
* restore the cache to its initial size as well, in preparation
* for the next test.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
+ resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE);
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG);
- if(pass) {
+ if (pass) {
- auto_size_ctl.initial_size = 6 * 1024;
- result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
+ auto_size_ctl.initial_size = 6 * 1024;
+ result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n";
- }
+ }
}
- if(pass &&
- (((cache_ptr->max_cache_size != (6 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 4 * 1024) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (6 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 4 * 1024) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (22).\n";
- }
+ }
}
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__PIN_ENTRY_FLAG);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE);
- if(pass &&
- (((cache_ptr->max_cache_size != (6 * 1024)) ||
- (cache_ptr->min_clean_size != (6 * 512)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 5 * 1024) ||
- (cache_ptr->cache_accesses != 1)))) {
+ if (pass && (((cache_ptr->max_cache_size != (6 * 1024)) || (cache_ptr->min_clean_size != (6 * 512)) ||
+ (cache_ptr->index_len != 4) || (cache_ptr->index_size != 5 * 1024) ||
+ (cache_ptr->cache_accesses != 1)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (23).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE);
- if(pass &&
- (((cache_ptr->max_cache_size != (13 * 1024)) ||
- (cache_ptr->min_clean_size != (13 * 512)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 13 * 1024) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (13 * 1024)) ||
+ (cache_ptr->min_clean_size != (13 * 512)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 13 * 1024) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (24).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__PIN_ENTRY_FLAG);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE);
- if(pass &&
- (((cache_ptr->max_cache_size != (22 * 1024)) ||
- (cache_ptr->min_clean_size != (11 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 22 * 1024) ||
- (cache_ptr->cache_accesses != 0)))) {
+ if (pass && (((cache_ptr->max_cache_size != (22 * 1024)) ||
+ (cache_ptr->min_clean_size != (11 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 22 * 1024) || (cache_ptr->cache_accesses != 0)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (25).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__PIN_ENTRY_FLAG);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE);
- if(pass &&
- (((cache_ptr->max_cache_size != (22 * 1024)) ||
- (cache_ptr->min_clean_size != (11 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 31 * 1024) ||
- (cache_ptr->cache_accesses != 1)))) {
+ if (pass && (((cache_ptr->max_cache_size != (22 * 1024)) ||
+ (cache_ptr->min_clean_size != (11 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 31 * 1024) || (cache_ptr->cache_accesses != 1)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (26).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Unpin the entries. Note that no entries are evicted as we don't
* load any entries.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__UNPIN_ENTRY_FLAG);
@@ -21546,169 +20579,156 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__UNPIN_ENTRY_FLAG);
- if(pass &&
- (((cache_ptr->max_cache_size != (22 * 1024)) ||
- (cache_ptr->min_clean_size != (11 * 1024)) ||
- (cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 31 * 1024) ||
- (cache_ptr->cache_accesses != 4)))) {
+ if (pass && (((cache_ptr->max_cache_size != (22 * 1024)) ||
+ (cache_ptr->min_clean_size != (11 * 1024)) || (cache_ptr->index_len != 4) ||
+ (cache_ptr->index_size != 31 * 1024) || (cache_ptr->cache_accesses != 4)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (27).\n";
- }
+ }
}
/* We have finished a basic check of the flash cache size increment
* code. Tidy up for a more extensive test...
*/
- if(pass) {
+ if (pass) {
- expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13);
+ expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
+ expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
+ expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
+ expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13);
- if(pass &&
- (((cache_ptr->max_cache_size != (22 * 1024)) ||
- (cache_ptr->min_clean_size != (11 * 1024)) ||
- (cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->cache_accesses != 4)))) {
+ if (pass && (((cache_ptr->max_cache_size != (22 * 1024)) ||
+ (cache_ptr->min_clean_size != (11 * 1024)) || (cache_ptr->index_len != 0) ||
+ (cache_ptr->index_size != 0) || (cache_ptr->cache_accesses != 4)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (28).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* ...and then reconfigure. Note that we change the flash_multiple
* and flash_threshold just to make sure that such changed perform
* as expected.
*/
- if(pass) {
+ if (pass) {
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.max_size = 20 * 1024;
- auto_size_ctl.min_size = 4 * 1024;
+ auto_size_ctl.max_size = 20 * 1024;
+ auto_size_ctl.min_size = 4 * 1024;
- auto_size_ctl.epoch_length = 100;
+ auto_size_ctl.epoch_length = 100;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024);
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.4f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.4f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.upper_hr_threshold = 0.999f; /* for ease of testing */
- auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.upper_hr_threshold = 0.999f; /* for ease of testing */
-
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (2 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (2 * 1024);
auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.5f; /* for ease of testing */
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
- pass = FALSE;
+ if (result != SUCCEED) {
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 512)) ||
- (cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->cache_accesses != 0)) {
+ if ((cache_ptr->max_cache_size != (4 * 1024)) || (cache_ptr->min_clean_size != (4 * 512)) ||
+ (cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || (cache_ptr->cache_accesses != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache after initialization 15.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* protect and unprotect a large entry -- no change in cache size since
* a large entry will just fill the available space in the cache.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (4 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 512)) ||
- (cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != LARGE_ENTRY_SIZE) ||
- (cache_ptr->cache_accesses != 1) ||
- (rpt_fcn_called == TRUE)))) {
+ if (pass && (((cache_ptr->max_cache_size != (4 * 1024)) || (cache_ptr->min_clean_size != (4 * 512)) ||
+ (cache_ptr->index_len != 1) || (cache_ptr->index_size != LARGE_ENTRY_SIZE) ||
+ (cache_ptr->cache_accesses != 1) || (rpt_fcn_called == TRUE)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (29).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* protect and unprotect another a large entry -- should trigger a
* flash cache size increase to 12 KB (remember that flash_multiple is
* set to 2.0).
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (12 * 1024)) ||
- (cache_ptr->min_clean_size != (12 * 512)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size != 2 * LARGE_ENTRY_SIZE) ||
- (cache_ptr->cache_accesses != 1) ||
- (rpt_fcn_called != TRUE)))) {
+ if (pass &&
+ (((cache_ptr->max_cache_size != (12 * 1024)) || (cache_ptr->min_clean_size != (12 * 512)) ||
+ (cache_ptr->index_len != 2) || (cache_ptr->index_size != 2 * LARGE_ENTRY_SIZE) ||
+ (cache_ptr->cache_accesses != 1) || (rpt_fcn_called != TRUE)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (30).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* protect and unprotect two more large entries -- shouldnt trigger a
* flash cache size increase.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
@@ -21717,122 +20737,112 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (12 * 1024)) ||
- (cache_ptr->min_clean_size != (12 * 512)) ||
- (cache_ptr->index_len != 3) ||
- (cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE) ||
- (cache_ptr->cache_accesses != 3) ||
- (rpt_fcn_called != FALSE)))) {
+ if (pass &&
+ (((cache_ptr->max_cache_size != (12 * 1024)) || (cache_ptr->min_clean_size != (12 * 512)) ||
+ (cache_ptr->index_len != 3) || (cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE) ||
+ (cache_ptr->cache_accesses != 3) || (rpt_fcn_called != FALSE)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (31).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* do many accesses of a single entry to talk the cache into reducing
* its size to the minimum.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, TINY_ENTRY_TYPE, 0);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, TINY_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->max_cache_size != (4 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024)) ||
- (cache_ptr->index_size != (1 * TINY_ENTRY_SIZE))) {
+ if ((!rpt_fcn_called) || (cache_ptr->max_cache_size != (4 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024)) || (cache_ptr->index_size != (1 * TINY_ENTRY_SIZE))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (32).\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Force another flash increase */
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (4 * 1024 + 128)) ||
- (cache_ptr->min_clean_size != (2 * 1024 + 64)) ||
- (cache_ptr->index_len != 2) ||
- (cache_ptr->index_size !=
- LARGE_ENTRY_SIZE + TINY_ENTRY_SIZE) ||
- (cache_ptr->cache_accesses != 1) ||
- (rpt_fcn_called == FALSE) ||
- (rpt_status != flash_increase)))) {
+ if (pass && (((cache_ptr->max_cache_size != (4 * 1024 + 128)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 + 64)) || (cache_ptr->index_len != 2) ||
+ (cache_ptr->index_size != LARGE_ENTRY_SIZE + TINY_ENTRY_SIZE) ||
+ (cache_ptr->cache_accesses != 1) || (rpt_fcn_called == FALSE) ||
+ (rpt_status != flash_increase)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (33).\n";
- }
+ }
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force regular size increase up to maximum */
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 500))
- {
+ i = 0;
+ while (pass && (i < 500)) {
protect_entry(file_ptr, TINY_ENTRY_TYPE, i);
- if(pass)
+ if (pass)
unprotect_entry(file_ptr, TINY_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
i++;
}
- if((cache_ptr->max_cache_size != (20 * 1024)) ||
- (cache_ptr->min_clean_size != (10 * 1024)) ||
- (rpt_fcn_called == FALSE) ||
- (rpt_status != at_max_size)) {
+ if ((cache_ptr->max_cache_size != (20 * 1024)) || (cache_ptr->min_clean_size != (10 * 1024)) ||
+ (rpt_fcn_called == FALSE) || (rpt_status != at_max_size)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache config (34).\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
PASSED();
} /* end if */
else {
H5_FAILED();
} /* end else */
- if(!pass)
+ if (!pass)
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return (unsigned)!pass;
} /* check_auto_cache_resize() */
-
/*-------------------------------------------------------------------------
* Function: check_auto_cache_resize_disable()
*
@@ -21856,14 +20866,13 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
static unsigned
check_auto_cache_resize_disable(unsigned paged)
{
- hbool_t show_progress = FALSE;
- herr_t result;
- int32_t i;
- int32_t checkpoint = 0;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5C_auto_size_ctl_t auto_size_ctl =
- {
+ hbool_t show_progress = FALSE;
+ herr_t result;
+ int32_t i;
+ int32_t checkpoint = 0;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5C_auto_size_ctl_t auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
/* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn,
@@ -21877,7 +20886,6 @@ check_auto_cache_resize_disable(unsigned paged)
/* int64_t epoch_length = */ 1000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
@@ -21888,11 +20896,10 @@ check_auto_cache_resize_disable(unsigned paged)
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* flash_incr_mode = */ H5C_flash_incr__off,
/* double flash_multiple = */ 1.0f,
/* double flash_threshold = */ 0.25f,
-
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
/* double upper_hr_threshold = */ 0.995f,
@@ -21905,34 +20912,33 @@ check_auto_cache_resize_disable(unsigned paged)
/* int32_t epochs_before_eviction = */ 3,
/* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f
- };
+ /* double empty_reserve = */ 0.05f};
- if(paged)
+ if (paged)
TESTING("automatic cache resize disable (paged aggregation)")
else
TESTING("automatic cache resize disable")
pass = TRUE;
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* allocate a cache, enable automatic cache resizing, and then force
* the cache through all its operational modes. Verify that all
* performs as expected.
*/
- if(pass) {
+ if (pass) {
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
- if(file_ptr == NULL) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "file_ptr NULL from setup_cache.";
-
}
else {
@@ -21940,29 +20946,28 @@ check_auto_cache_resize_disable(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024))) {
+ if ((cache_ptr->max_cache_size != (512 * 1024)) || (cache_ptr->min_clean_size != (256 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after initialization.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/******************************************************************
* So far, we have forced the auto cache resize through all modes
@@ -21971,1399 +20976,1346 @@ check_auto_cache_resize_disable(unsigned paged)
* modes.
******************************************************************/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
-
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.increment = 1.0f; /* disable size increases */
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.apply_max_increment = FALSE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.increment = 1.0f; /* disable size increases */
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.apply_max_increment = FALSE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decrement = 0.5f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 1.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full -- increase disabled so should
* be no change in cache size, and result should be increase_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_increase_possible) ||
- (rpt_status != increase_disabled) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_increase_possible) || (rpt_status != increase_disabled) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 1.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- make sure that we haven't disabled decreases.
* should result in a decrease cache size from 4 to 2 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 2.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate again -- increase disabled so should
* be no change in cache size, and result should be increase_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_increase_possible) ||
- (rpt_status != increase_disabled) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_increase_possible) || (rpt_status != increase_disabled) ||
+ (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 3.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Repeat the above tests, disabling increase through the lower
* threshold instead of the increment.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.0f; /* disable size increases */
+ auto_size_ctl.lower_hr_threshold = 0.0f; /* disable size increases */
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = FALSE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = FALSE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 2.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full -- increase disabled so should
* be no change in cache size, and result should be in_spec.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_increase_possible) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_increase_possible) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 4.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- make sure that we haven't disabled decreases.
* should result in a decrease cache size from 4 to 2 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 5.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate again -- increase disabled so should
* be no change in cache size, and result should be increase_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_increase_possible) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_increase_possible) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 6.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Repeat the above tests yet again, disabling increase through the
* incr_mode.
*/
- if(pass) {
+ if (pass) {
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.incr_mode = H5C_incr__off;
- auto_size_ctl.incr_mode = H5C_incr__off;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.apply_max_increment = FALSE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.apply_max_increment = FALSE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
-
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 3.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate with cache full -- increase disabled so should
* be no change in cache size, and result should be in_spec.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_increase_possible) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_increase_possible) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 7.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- make sure that we haven't disabled decreases.
* should result in a decrease cache size from 4 to 2 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 8.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate again -- increase disabled so should
* be no change in cache size, and result should be increase_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_increase_possible) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_increase_possible) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 9.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now, disable size decreases, and repeat the above tests.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
-
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decrement = 1.0f; /* disable size decreases */
+ auto_size_ctl.decrement = 1.0f; /* disable size decreases */
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 4.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should be no change in cache size,
* and result should be decrease_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease_disabled) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease_disabled) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 10.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- cache size should increase from 4 to 6 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 11.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate again -- should be no change in cache size,
* and result should be decrease_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease_disabled) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease_disabled) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 12.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Repeat the above tests, disabling decrease through the upper
* threshold instead of the decrement.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.upper_hr_threshold = 1.0f; /* disable size decreases */
- auto_size_ctl.upper_hr_threshold = 1.0f; /* disable size decreases */
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 5.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should be no change in cache size,
* and result should be in_spec.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 13.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- cache size should increase from 4 to 6 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 14.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate again -- should be no change in cache size,
* and result should be in_spec.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 15.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Repeat the above tests, disabling decrease through the decr_mode.
*/
- if(pass) {
+ if (pass) {
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__off;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decr_mode = H5C_decr__off;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
-
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 7.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 6.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should be no change in cache size,
* and result should be in_spec.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 16.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- cache size should increase from 4 to 6 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 17.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate again -- should be no change in cache size,
* and result should be in_spec.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 18.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now do tests disabling size decrement in age out mode.
*
* Start by disabling size decrement by setting max_decrement to zero.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
-
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.decr_mode = H5C_decr__age_out;
+ auto_size_ctl.decr_mode = H5C_decr__age_out;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decrement = 0.5f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = 0; /* disable decrement */
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = 0; /* disable decrement */
auto_size_ctl.epochs_before_eviction = 1;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 8.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 7.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
/* flush the cache and destroy all entries so we start from a known point */
flush_cache(file_ptr, TRUE, FALSE, FALSE);
-
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* load up the cache with small entries. Note that it will take an
* epoch for the ageout code to initialize itself if it is enabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != not_full) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != not_full) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 19.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Load up some more small entries.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 1000;
- while(pass && (i < 2000))
- {
+ i = 1000;
+ while (pass && (i < 2000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != not_full) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != not_full) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 20.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now force a high hit rate so that the size increase code is
* is satisfied. We would see a decrease here if decrease were
* possible.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != decrease_disabled) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != decrease_disabled) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 21.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- cache size should increase from 4 to 6 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 22.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* just bang on a single entry. This will see to it that there are
* many entries that could be aged out were decreases enabled.
* Should be no change in cache size, and result should be
* decrease_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != decrease_disabled) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != decrease_disabled) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 23.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now disable size decrement in age out mode via the empty reserve.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out;
- auto_size_ctl.decr_mode = H5C_decr__age_out;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 1;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 1.0f; /* disable decrement */
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 1.0f; /* disable decrement */
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 9.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 8.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
/* flush the cache and destroy all entries so we start from a known point */
flush_cache(file_ptr, TRUE, FALSE, FALSE);
-
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* load up the cache with small entries. Note that it will take an
* epoch for the ageout code to initialize itself if it is enabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != not_full) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != not_full) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 24.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Load up some more small entries.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 1000;
- while(pass && (i < 2000))
- {
+ i = 1000;
+ while (pass && (i < 2000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != not_full) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != not_full) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 25.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now force a high hit rate so that the size increase code is
* is satisfied. We would see a decrease here if decrease were
* possible.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != decrease_disabled) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != decrease_disabled) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 26.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- cache size should increase from 4 to 6 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 27.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* just bang on a single entry. This will see to it that there are
* many entries that could be aged out were decreases enabled.
* Should be no change in cache size, and result should be
* decrease_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != decrease_disabled) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != decrease_disabled) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 28.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now work with age out with threshold. One can argue that we should
* repeat the above age out tests with age out with threshold, but the
@@ -23375,138 +22327,133 @@ check_auto_cache_resize_disable(unsigned paged)
* to 1.0. Test this now.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
- auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.upper_hr_threshold = 1.0f;
- auto_size_ctl.upper_hr_threshold = 1.0f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 1;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 10.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 9.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
/* flush the cache and destroy all entries so we start from a known point */
flush_cache(file_ptr, TRUE, FALSE, FALSE);
-
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* load up the cache with small entries. Note that it will take an
* epoch for the ageout code to initialize itself if it is enabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != not_full) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != not_full) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 29.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Load up some more small entries.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 1000;
- while(pass && (i < 2000))
- {
+ i = 1000;
+ while (pass && (i < 2000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != not_full) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != not_full) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 30.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now force a high hit rate so that the size increase code is
* is satisfied. We would see a decrease here if decrease were
@@ -23514,62 +22461,58 @@ check_auto_cache_resize_disable(unsigned paged)
*
* rpt_status should be decrease_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != decrease_disabled) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024)) ||
- (cache_ptr->index_len != 2000) ||
- (cache_ptr->index_size != 2000 * SMALL_ENTRY_SIZE)) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != decrease_disabled) ||
+ (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024)) || (cache_ptr->index_len != 2000) ||
+ (cache_ptr->index_size != 2000 * SMALL_ENTRY_SIZE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 31.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- cache size should increase from 4 to 6 Meg.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != increase) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (rpt_status != increase) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 32.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* just bang on a single entry. This keeps the hit rate high, and sees
* to it that there are many entries that could be aged out were
@@ -23578,33 +22521,30 @@ check_auto_cache_resize_disable(unsigned paged)
* Should be no change in cache size, and result should be
* decrease_disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 999);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 999, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (cache_ptr->size_decrease_possible) ||
- (rpt_status != decrease_disabled) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((!rpt_fcn_called) || (cache_ptr->size_decrease_possible) || (rpt_status != decrease_disabled) ||
+ (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 33.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/*********************************************************************
* Finally, use the auto cache resize code to set the size of the
@@ -23613,770 +22553,725 @@ check_auto_cache_resize_disable(unsigned paged)
* check them all.
*********************************************************************/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 2 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 2 * 1024 * 1024;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.0f; /* disable size increases */
+ auto_size_ctl.lower_hr_threshold = 0.0f; /* disable size increases */
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.upper_hr_threshold = 1.0f; /* disable size decreases */
- auto_size_ctl.upper_hr_threshold = 1.0f; /* disable size decreases */
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 11.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 10.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 34.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 35.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- auto_size_ctl.min_clean_fraction = 0.25f;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.min_clean_fraction = 0.25f;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.increment = 1.0f; /* disable size increment */
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.increment = 1.0f; /* disable size increment */
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decrement = 1.0f; /* disable size decrement */
+ auto_size_ctl.decrement = 1.0f; /* disable size decrement */
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 12.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 11.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 36.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 37.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- auto_size_ctl.set_initial_size = FALSE;
- auto_size_ctl.initial_size = 2 * 1024 * 1024;
+ if (pass) {
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.max_size = 6 * 1024 * 1024; /* no resize */
- auto_size_ctl.min_size = 6 * 1024 * 1024; /* no resize */
+ auto_size_ctl.set_initial_size = FALSE;
+ auto_size_ctl.initial_size = 2 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.max_size = 6 * 1024 * 1024; /* no resize */
+ auto_size_ctl.min_size = 6 * 1024 * 1024; /* no resize */
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decrement = 0.5f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 12.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 38.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (6 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (3 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 39.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
- if(pass) {
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.25f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.25f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 1.0f; /* disable size increment */
+ auto_size_ctl.increment = 1.0f; /* disable size increment */
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.upper_hr_threshold = 1.0f; /* disable size decrement */
- auto_size_ctl.upper_hr_threshold = 1.0f; /* disable size decrement */
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 14.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 13.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 40.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 41.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
- if(pass) {
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.lower_hr_threshold = 0.0f; /* disable size increment */
+ auto_size_ctl.lower_hr_threshold = 0.0f; /* disable size increment */
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.decrement = 1.0f; /* disable size decrement */
- auto_size_ctl.decrement = 1.0f; /* disable size decrement */
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
-
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 14.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 42.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 43.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
- if(pass) {
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 4 * 1024 * 1024;
- auto_size_ctl.max_size = 16 * 1024 * 1024;
- auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 16 * 1024 * 1024;
+ auto_size_ctl.min_size = 1 * 1024 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__off;
+ auto_size_ctl.incr_mode = H5C_incr__off;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__off;
- auto_size_ctl.decr_mode = H5C_decr__off;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
-
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 16.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 15.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force low hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 44.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* force high hit rate -- should be no response as the auto-resize
* code should be disabled.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
i++;
}
- if((rpt_fcn_called) ||
- (cache_ptr->resize_enabled) ||
- (cache_ptr->size_increase_possible) ||
- (cache_ptr->size_decrease_possible) ||
- (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
+ if ((rpt_fcn_called) || (cache_ptr->resize_enabled) || (cache_ptr->size_increase_possible) ||
+ (cache_ptr->size_decrease_possible) || (cache_ptr->max_cache_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (2 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 45.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now test the flash cache size increment code to verify that it
* is disabled when it should be.
@@ -24405,66 +23300,62 @@ check_auto_cache_resize_disable(unsigned paged)
* code enabled.
*/
- if(pass) {
+ if (pass) {
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 64 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 64 * 1024;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.max_size = 256 * 1024;
- auto_size_ctl.min_size = 32 * 1024;
+ auto_size_ctl.max_size = 256 * 1024;
+ auto_size_ctl.min_size = 32 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.incr_mode = H5C_incr__threshold;
- auto_size_ctl.incr_mode = H5C_incr__threshold;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (2 * 1024);
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (2 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 1.0f;
+ auto_size_ctl.flash_threshold = 0.25f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 1.0f;
- auto_size_ctl.flash_threshold = 0.25f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
-
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = TRUE;
- auto_size_ctl.max_decrement = (1 * 1024);
+ auto_size_ctl.apply_max_decrement = TRUE;
+ auto_size_ctl.max_decrement = (1 * 1024);
auto_size_ctl.epochs_before_eviction = 3;
- auto_size_ctl.apply_empty_reserve = TRUE;
- auto_size_ctl.empty_reserve = 0.05f;
-
+ auto_size_ctl.apply_empty_reserve = TRUE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 17.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (64 * 1024)) ||
- (cache_ptr->min_clean_size != (32 * 1024))) {
+ if ((cache_ptr->max_cache_size != (64 * 1024)) || (cache_ptr->min_clean_size != (32 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 16.\n";
}
}
@@ -24473,37 +23364,30 @@ check_auto_cache_resize_disable(unsigned paged)
* size. Protect and unprotect an entry to allow the cache to evict
* entries and get within bounds
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (64 * 1024)) ||
- (cache_ptr->min_clean_size != (32 * 1024)) ||
- (cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != LARGE_ENTRY_SIZE) ||
- (rpt_fcn_called != FALSE)))) {
-
- HDfprintf(stdout, "\nmax_cache_size = %ld.\n",
- (long)(cache_ptr->max_cache_size));
- HDfprintf(stdout, "min_clean_size = %ld.\n",
- (long)(cache_ptr->min_clean_size));
- HDfprintf(stdout, "index_len = %ld.\n",
- (long)(cache_ptr->index_len));
- HDfprintf(stdout, "index_size = %ld.\n",
- (long)(cache_ptr->index_size));
- HDfprintf(stdout, "rpt_fcn_called = %ld.\n",
- (long)(rpt_fcn_called));
+ if (pass && (((cache_ptr->max_cache_size != (64 * 1024)) ||
+ (cache_ptr->min_clean_size != (32 * 1024)) || (cache_ptr->index_len != 1) ||
+ (cache_ptr->index_size != LARGE_ENTRY_SIZE) || (rpt_fcn_called != FALSE)))) {
- pass = FALSE;
+ HDfprintf(stdout, "\nmax_cache_size = %ld.\n", (long)(cache_ptr->max_cache_size));
+ HDfprintf(stdout, "min_clean_size = %ld.\n", (long)(cache_ptr->min_clean_size));
+ HDfprintf(stdout, "index_len = %ld.\n", (long)(cache_ptr->index_len));
+ HDfprintf(stdout, "index_size = %ld.\n", (long)(cache_ptr->index_size));
+ HDfprintf(stdout, "rpt_fcn_called = %ld.\n", (long)(rpt_fcn_called));
+
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 46.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now protect and unprotect a monster entry. If the flash cache
* size increment code was active, this would trigger an increase.
@@ -24512,58 +23396,55 @@ check_auto_cache_resize_disable(unsigned paged)
* This finishes the additional tests needed for the flash cache
* size increase code.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
- if(pass &&
- (((cache_ptr->max_cache_size != (64 * 1024)) ||
- (cache_ptr->min_clean_size != (32 * 1024)) ||
- (cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != MONSTER_ENTRY_SIZE) ||
- (rpt_fcn_called != FALSE)))) {
-
- HDfprintf(stdout, "\nmax_cache_size = %ld.\n",
- (long)(cache_ptr->max_cache_size));
- HDfprintf(stdout, "min_clean_size = %ld.\n",
- (long)(cache_ptr->min_clean_size));
- HDfprintf(stdout, "index_len = %ld.\n",
- (long)(cache_ptr->index_len));
- HDfprintf(stdout, "index_size = %ld.\n",
- (long)(cache_ptr->index_size));
- HDfprintf(stdout, "rpt_fcn_called = %ld.\n",
- (long)(rpt_fcn_called));
+ if (pass && (((cache_ptr->max_cache_size != (64 * 1024)) ||
+ (cache_ptr->min_clean_size != (32 * 1024)) || (cache_ptr->index_len != 1) ||
+ (cache_ptr->index_size != MONSTER_ENTRY_SIZE) || (rpt_fcn_called != FALSE)))) {
- pass = FALSE;
+ HDfprintf(stdout, "\nmax_cache_size = %ld.\n", (long)(cache_ptr->max_cache_size));
+ HDfprintf(stdout, "min_clean_size = %ld.\n", (long)(cache_ptr->min_clean_size));
+ HDfprintf(stdout, "index_len = %ld.\n", (long)(cache_ptr->index_len));
+ HDfprintf(stdout, "index_size = %ld.\n", (long)(cache_ptr->index_size));
+ HDfprintf(stdout, "rpt_fcn_called = %ld.\n", (long)(rpt_fcn_called));
+
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 47.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_auto_cache_resize_disable() */
-
/*-------------------------------------------------------------------------
* Function: check_auto_cache_resize_epoch_markers()
*
@@ -24583,15 +23464,14 @@ check_auto_cache_resize_disable(unsigned paged)
static unsigned
check_auto_cache_resize_epoch_markers(unsigned paged)
{
- hbool_t show_progress = FALSE;
- herr_t result;
- int32_t i;
- int32_t j;
- int32_t checkpoint = 0;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5C_auto_size_ctl_t auto_size_ctl =
- {
+ hbool_t show_progress = FALSE;
+ herr_t result;
+ int32_t i;
+ int32_t j;
+ int32_t checkpoint = 0;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5C_auto_size_ctl_t auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
/* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn,
@@ -24605,7 +23485,6 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
/* int64_t epoch_length = */ 1000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
@@ -24616,10 +23495,9 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
-
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -24633,182 +23511,174 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
/* int32_t epochs_before_eviction = */ 3,
/* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f
- };
+ /* double empty_reserve = */ 0.05f};
- if(paged)
+ if (paged)
TESTING("automatic cache resize epoch marker management (paged aggr)")
else
TESTING("automatic cache resize epoch marker management")
pass = TRUE;
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024))) {
+ if ((cache_ptr->max_cache_size != (512 * 1024)) || (cache_ptr->min_clean_size != (256 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after initialization.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
-
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Now make sure that we are managing the epoch markers correctly.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1024 * 1024;
- auto_size_ctl.max_size = 8 * 1024 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 8 * 1024 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__off;
+ auto_size_ctl.incr_mode = H5C_incr__off;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out;
- auto_size_ctl.decr_mode = H5C_decr__age_out;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 10;
- auto_size_ctl.apply_empty_reserve = FALSE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = FALSE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 1.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Since we just created the cache, there should be no epoch markers
* active. Verify that this is true.
*/
- if(pass) {
+ if (pass) {
- if(cache_ptr->epoch_markers_active != 0) {
+ if (cache_ptr->epoch_markers_active != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected # of epoch markers 1.\n";
}
}
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MEDIUM_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024)) ||
- (cache_ptr->index_size != (1 * 1000 * MEDIUM_ENTRY_SIZE))) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) ||
+ (cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->index_size != (1 * 1000 * MEDIUM_ENTRY_SIZE))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 0.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
-
- if(pass) {
+ if (pass) {
j = 2;
- while(pass && (j <= 10))
- {
+ while (pass && (j <= 10)) {
rpt_fcn_called = FALSE;
- i = (j - 2) * 1000;
- while(pass && (i < (j - 1) * 1000))
- {
+ i = (j - 2) * 1000;
+ while (pass && (i < (j - 1) * 1000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->epoch_markers_active != j)) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->epoch_markers_active != j)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected # of epoch markers 2.\n";
}
@@ -24816,116 +23686,112 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* we now have a full complement of epoch markers -- see if
* we get the expected reduction.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 9000;
- while(pass && (i < 10000))
- {
+ i = 9000;
+ while (pass && (i < 10000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size !=
- (10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) ||
- (cache_ptr->min_clean_size !=
- ((10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE) / 2)) ||
- (cache_ptr->index_size !=
- (10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) ||
+ (cache_ptr->max_cache_size != (10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE)) ||
+ (cache_ptr->min_clean_size != ((10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE) / 2)) ||
+ (cache_ptr->index_size != (10 * 1000 * SMALL_ENTRY_SIZE + MEDIUM_ENTRY_SIZE))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 1.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* now reduce the epochs before eviction, and see if the cache
* deletes the extra markers
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1024 * 1024;
- auto_size_ctl.max_size = 8 * 1024 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 8 * 1024 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__off;
+ auto_size_ctl.incr_mode = H5C_incr__off;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__age_out;
- auto_size_ctl.decr_mode = H5C_decr__age_out;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 1;
- auto_size_ctl.apply_empty_reserve = FALSE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = FALSE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 3.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 2.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* There should be exactly one active epoch marker at present.
*/
- if(pass) {
+ if (pass) {
- if(cache_ptr->epoch_markers_active != 1) {
+ if (cache_ptr->epoch_markers_active != 1) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected # of epoch markers 3.\n";
}
}
@@ -24934,40 +23800,38 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
* not accessed in this epoch gets evicted, and the cache size
* is reduced.
*/
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 9000;
- while(pass && (i < 10000))
- {
+ i = 9000;
+ while (pass && (i < 10000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != decrease) ||
- (cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024)) ||
- (cache_ptr->index_size != (1 * 1000 * SMALL_ENTRY_SIZE))) {
+ if ((!rpt_fcn_called) || (rpt_status != decrease) || (cache_ptr->max_cache_size != (512 * 1024)) ||
+ (cache_ptr->min_clean_size != (256 * 1024)) ||
+ (cache_ptr->index_size != (1 * 1000 * SMALL_ENTRY_SIZE))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 2.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* There should be exactly one active epoch marker at present...
*/
- if(pass) {
+ if (pass) {
- if(cache_ptr->epoch_markers_active != 1) {
+ if (cache_ptr->epoch_markers_active != 1) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected # of epoch markers 4.\n";
}
}
@@ -24975,175 +23839,169 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
/* shift the decrement mode to threshold, and verify that we remove
* all epoch markers.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ if (pass) {
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1024 * 1024;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1024 * 1024;
- auto_size_ctl.max_size = 8 * 1024 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.max_size = 8 * 1024 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.incr_mode = H5C_incr__off;
+ auto_size_ctl.incr_mode = H5C_incr__off;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__threshold;
- auto_size_ctl.decr_mode = H5C_decr__threshold;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 1;
- auto_size_ctl.apply_empty_reserve = FALSE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = FALSE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 4.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
+ if ((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after set resize re-config 3.\n";
}
}
/* ... and now there should be none.
*/
- if(pass) {
+ if (pass) {
- if(cache_ptr->epoch_markers_active != 0) {
+ if (cache_ptr->epoch_markers_active != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected # of epoch markers 5.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* shift the decrement mode to age out with threshold. Set epochs
* before eviction to 10 again.
*/
- if(pass) {
-
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
-
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1024 * 1024;
+ if (pass) {
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.max_size = 8 * 1024 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1024 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.max_size = 8 * 1024 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
- auto_size_ctl.incr_mode = H5C_incr__off;
+ auto_size_ctl.epoch_length = 1000;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.incr_mode = H5C_incr__off;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
- auto_size_ctl.upper_hr_threshold = 0.995f;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decrement = 0.5f;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 10;
- auto_size_ctl.apply_empty_reserve = FALSE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = FALSE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 5.\n";
}
}
/* Verify that there are no active epoch markers.
*/
- if(pass) {
+ if (pass) {
- if(cache_ptr->epoch_markers_active != 0) {
+ if (cache_ptr->epoch_markers_active != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected # of epoch markers 6.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* build up a full set of epoch markers. */
- if(pass) {
+ if (pass) {
j = 1;
- while(pass && (j <= 10))
- {
+ while (pass && (j <= 10)) {
rpt_fcn_called = FALSE;
- i = (j - 1) * 1000;
- while(pass && (i < j * 1000))
- {
+ i = (j - 1) * 1000;
+ while (pass && (i < j * 1000)) {
protect_entry(file_ptr, SMALL_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, SMALL_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
i++;
}
- if((!rpt_fcn_called) ||
- (rpt_status != in_spec) ||
- (cache_ptr->epoch_markers_active != j)) {
+ if ((!rpt_fcn_called) || (rpt_status != in_spec) || (cache_ptr->epoch_markers_active != j)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected # of epoch markers 7.\n";
}
@@ -25151,15 +24009,16 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* Verify that there are now 10 active epoch markers.
*/
- if(pass) {
+ if (pass) {
- if(cache_ptr->epoch_markers_active != 10) {
+ if (cache_ptr->epoch_markers_active != 10) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected # of epoch markers 8.\n";
}
}
@@ -25167,109 +24026,112 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
/* shift the decrement mode to off. This should cause all epoch
* markers to be removed.
*/
- if(pass) {
+ if (pass) {
- auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- auto_size_ctl.rpt_fcn = test_rpt_fcn;
+ auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ auto_size_ctl.rpt_fcn = test_rpt_fcn;
- auto_size_ctl.set_initial_size = TRUE;
- auto_size_ctl.initial_size = 8 * 1024 * 1024;
+ auto_size_ctl.set_initial_size = TRUE;
+ auto_size_ctl.initial_size = 8 * 1024 * 1024;
- auto_size_ctl.min_clean_fraction = 0.5f;
+ auto_size_ctl.min_clean_fraction = 0.5f;
- auto_size_ctl.max_size = 8 * 1024 * 1024;
- auto_size_ctl.min_size = 512 * 1024;
+ auto_size_ctl.max_size = 8 * 1024 * 1024;
+ auto_size_ctl.min_size = 512 * 1024;
- auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.epoch_length = 1000;
+ auto_size_ctl.incr_mode = H5C_incr__off;
- auto_size_ctl.incr_mode = H5C_incr__off;
+ auto_size_ctl.lower_hr_threshold = 0.75f;
- auto_size_ctl.lower_hr_threshold = 0.75f;
+ auto_size_ctl.increment = 2.0f;
- auto_size_ctl.increment = 2.0f;
+ auto_size_ctl.apply_max_increment = TRUE;
+ auto_size_ctl.max_increment = (4 * 1024 * 1024);
- auto_size_ctl.apply_max_increment = TRUE;
- auto_size_ctl.max_increment = (4 * 1024 * 1024);
+ auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ auto_size_ctl.flash_multiple = 2.0f;
+ auto_size_ctl.flash_threshold = 0.5f;
- auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- auto_size_ctl.flash_multiple = 2.0f;
- auto_size_ctl.flash_threshold = 0.5f;
+ auto_size_ctl.decr_mode = H5C_decr__off;
+ auto_size_ctl.upper_hr_threshold = 0.995f;
- auto_size_ctl.decr_mode = H5C_decr__off;
+ auto_size_ctl.decrement = 0.5f;
- auto_size_ctl.upper_hr_threshold = 0.995f;
-
- auto_size_ctl.decrement = 0.5f;
-
- auto_size_ctl.apply_max_decrement = FALSE;
- auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ auto_size_ctl.apply_max_decrement = FALSE;
+ auto_size_ctl.max_decrement = (1 * 1024 * 1024);
auto_size_ctl.epochs_before_eviction = 10;
- auto_size_ctl.apply_empty_reserve = FALSE;
- auto_size_ctl.empty_reserve = 0.05f;
+ auto_size_ctl.apply_empty_reserve = FALSE;
+ auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 6.\n";
}
}
/* Verify that there are now no active epoch markers.
*/
- if(pass) {
+ if (pass) {
- if(cache_ptr->epoch_markers_active != 0) {
+ if (cache_ptr->epoch_markers_active != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected # of epoch markers 9.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
/* verify that we still have the expected number of entries in the cache,
* and that the cache is of the expected size.
*/
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (4 * 1024 * 1024))||
- (cache_ptr->index_size != (10 * 1000 * SMALL_ENTRY_SIZE)) ||
- (cache_ptr->index_len != 10000)) {
+ if ((cache_ptr->max_cache_size != (8 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (4 * 1024 * 1024)) ||
+ (cache_ptr->index_size != (10 * 1000 * SMALL_ENTRY_SIZE)) || (cache_ptr->index_len != 10000)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache size change results 3.\n";
}
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++);
+ if (show_progress)
+ HDfprintf(stderr, "check point %d\n", checkpoint++);
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_auto_cache_resize_epoch_markers() */
-
/*-------------------------------------------------------------------------
* Function: check_auto_cache_resize_input_errs()
*
@@ -25294,11 +24156,10 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
static unsigned
check_auto_cache_resize_input_errs(unsigned paged)
{
- herr_t result;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5C_auto_size_ctl_t ref_auto_size_ctl =
- {
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5C_auto_size_ctl_t ref_auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
/* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn,
@@ -25312,7 +24173,6 @@ check_auto_cache_resize_input_errs(unsigned paged)
/* int64_t epoch_length = */ 1000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
@@ -25323,10 +24183,9 @@ check_auto_cache_resize_input_errs(unsigned paged)
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
-
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -25340,13 +24199,12 @@ check_auto_cache_resize_input_errs(unsigned paged)
/* int32_t epochs_before_eviction = */ 3,
/* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f
- };
+ /* double empty_reserve = */ 0.05f};
H5C_auto_size_ctl_t invalid_auto_size_ctl;
H5C_auto_size_ctl_t test_auto_size_ctl;
- if(paged)
+ if (paged)
TESTING("automatic cache resize input errors (paged aggregation)")
else
TESTING("automatic cache resize input errors")
@@ -25359,2326 +24217,2153 @@ check_auto_cache_resize_input_errs(unsigned paged)
* and that the configuration is not modified.
*/
- if(pass) {
+ if (pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &ref_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (512 * 1024)) ||
- (cache_ptr->min_clean_size != (256 * 1024))) {
+ if ((cache_ptr->max_cache_size != (512 * 1024)) || (cache_ptr->min_clean_size != (256 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after initialization.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 1.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 1.";
}
}
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.7f;
- invalid_auto_size_ctl.lower_hr_threshold = 0.7f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
-
- invalid_auto_size_ctl.decrement = 0.5f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(NULL, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted NULL cache_ptr.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted NULL cache_ptr.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 2.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 2.";
}
}
-
/* check bad version rejection. */
- if(pass) {
-
- invalid_auto_size_ctl.version = -1; /* INVALID */
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.version = -1; /* INVALID */
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.7f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.7f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decrement = 0.5f;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad version.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad version.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 3.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 3.";
}
}
-
/* check bad initial size rejection */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ if (pass) {
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 16 * 1024 * 1024 + 1;
- /* INVALID */
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 16 * 1024 * 1024 + 1;
+ /* INVALID */
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.decrement = 0.5f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad init size 1.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad init size 1.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 4.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 4.";
}
}
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 1 * 1024 * 1024 - 1;
- /* INVALID */
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 1 * 1024 * 1024 - 1;
+ /* INVALID */
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
-
- invalid_auto_size_ctl.decrement = 0.5f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad init size 2.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad init size 2.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 5.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 5.";
}
}
-
/* test for invalid min clean fraction rejection. */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 1.00001f; /* INVALID */
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 1.00001f; /* INVALID */
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decrement = 0.5f;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad min clean frac 1.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad min clean frac 1.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 6.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 6.";
}
}
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = -0.00001f; /* INVALID */
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = -0.00001f; /* INVALID */
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decrement = 0.5f;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad min clean frac 2.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad min clean frac 2.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 7.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 7.";
}
}
-
/* test for invalid max_size and/or min_size rejection */
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
- invalid_auto_size_ctl.max_size = H5C__MAX_MAX_CACHE_SIZE + 1;
- /* INVALID */
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = H5C__MAX_MAX_CACHE_SIZE + 1;
+ /* INVALID */
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
-
- invalid_auto_size_ctl.decrement = 0.5f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad max_size.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad max_size.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 8.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 8.";
}
}
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
- invalid_auto_size_ctl.max_size = 1 * 1024 * 1024;/* INVALID */
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024 + 1;/*PAIR */
+ invalid_auto_size_ctl.max_size = 1 * 1024 * 1024; /* INVALID */
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024 + 1; /*PAIR */
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
-
- invalid_auto_size_ctl.decrement = 0.5f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad size pair.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad size pair.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 9.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 9.";
}
}
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ if (pass) {
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = H5C__MIN_MAX_CACHE_SIZE - 1;
- /* INVALID */
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = H5C__MIN_MAX_CACHE_SIZE - 1;
+ /* INVALID */
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.decrement = 0.5f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad min_size.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad min_size.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 10.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 10.";
}
}
-
/* test for invalid epoch_length rejection */
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = H5C__MAX_AR_EPOCH_LENGTH + 1;
- /* INVALID */
+ invalid_auto_size_ctl.epoch_length = H5C__MAX_AR_EPOCH_LENGTH + 1;
+ /* INVALID */
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.decrement = 0.9f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad epoch len 1.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad epoch len 1.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 11.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 11.";
}
}
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1;
- /* INVALID */
+ invalid_auto_size_ctl.epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1;
+ /* INVALID */
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.decrement = 0.9f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad epoch len 2.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad epoch len 2.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 12.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 12.";
}
}
-
/* test for bad incr_mode rejection */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ if (pass) {
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.incr_mode =
- (enum H5C_cache_incr_mode) -1; /* INVALID */
+ invalid_auto_size_ctl.incr_mode = (enum H5C_cache_incr_mode) - 1; /* INVALID */
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.decrement = 0.9f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad incr_mode 1.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad incr_mode 1.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 13.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 13.";
}
}
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.incr_mode = (enum H5C_cache_incr_mode)2; /* INVALID */
- invalid_auto_size_ctl.incr_mode =
- (enum H5C_cache_incr_mode) 2; /* INVALID */
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
-
- invalid_auto_size_ctl.decrement = 0.9f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad incr_mode 2.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad incr_mode 2.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 14.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 14.";
}
}
-
/* check for bad upper and/or lower threshold rejection */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.7f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.7f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.upper_hr_threshold = 1.01f; /* INVALID */
+ invalid_auto_size_ctl.upper_hr_threshold = 1.01f; /* INVALID */
- invalid_auto_size_ctl.decrement = 0.5f;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad upper threshold.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad upper threshold.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 15.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 15.";
}
}
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.8f; /* INVALID */
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.8f; /* INVALID */
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.upper_hr_threshold = 0.7f; /* INVALID */
+ invalid_auto_size_ctl.upper_hr_threshold = 0.7f; /* INVALID */
- invalid_auto_size_ctl.decrement = 0.5f;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad threshold pair.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad threshold pair.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 16.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 16.";
}
}
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ if (pass) {
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.min_clean_fraction = 0.5f;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.min_clean_fraction = 0.5f;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.lower_hr_threshold = -0.0001f; /* INVALID */
+ invalid_auto_size_ctl.lower_hr_threshold = -0.0001f; /* INVALID */
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.decrement = 0.5f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad lower threshold.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad lower threshold.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 17.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 17.";
}
}
-
/* test for bad increment rejection */
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.increment = 0.99999f; /* INVALID */
- invalid_auto_size_ctl.increment = 0.99999f; /* INVALID */
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decrement = 0.5f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
-
- invalid_auto_size_ctl.decrement = 0.5f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
-
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad increment.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad increment.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 18.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 18.";
}
}
/* test for bad flash_incr_mode rejection */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode =
- (enum H5C_cache_flash_incr_mode) -1; /* INVALID */
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = (enum H5C_cache_flash_incr_mode) - 1; /* INVALID */
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decrement = 0.9f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad flash_incr_mode.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad flash_incr_mode.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 19.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 19.";
}
}
/* test for bad flash_multiple rejection */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode =
- H5C_flash_incr__add_space;
- invalid_auto_size_ctl.flash_multiple = 0.09f; /* INVALID */
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space;
+ invalid_auto_size_ctl.flash_multiple = 0.09f; /* INVALID */
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decrement = 0.9f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad flash_multiple(1).\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad flash_multiple(1).\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 20.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 20.";
}
}
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ if (pass) {
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode =
- H5C_flash_incr__add_space;
- invalid_auto_size_ctl.flash_multiple = 10.01f; /* INVALID */
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space;
+ invalid_auto_size_ctl.flash_multiple = 10.01f; /* INVALID */
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.decrement = 0.9f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad flash_multiple(2).\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad flash_multiple(2).\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 21.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 21.";
}
}
/* test for bad flash_threshold rejection */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ if (pass) {
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode =
- H5C_flash_incr__add_space;
- invalid_auto_size_ctl.flash_multiple = 1.0f;
- invalid_auto_size_ctl.flash_threshold = 0.09f; /* INVALID */
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space;
+ invalid_auto_size_ctl.flash_multiple = 1.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.09f; /* INVALID */
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.decrement = 0.9f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad flash_threshold(1).\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad flash_threshold(1).\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 22.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 22.";
}
}
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space;
+ invalid_auto_size_ctl.flash_multiple = 1.0f;
+ invalid_auto_size_ctl.flash_threshold = 1.001f; /* INVALID */
- invalid_auto_size_ctl.flash_incr_mode =
- H5C_flash_incr__add_space;
- invalid_auto_size_ctl.flash_multiple = 1.0f;
- invalid_auto_size_ctl.flash_threshold = 1.001f; /* INVALID */
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
-
- invalid_auto_size_ctl.decrement = 0.9f;
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad flash_threshold(2).\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad flash_threshold(2).\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 23.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 23.";
}
}
-
/* test for bad decr_mode rejection */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode =
- (enum H5C_cache_decr_mode) -1; /* INVALID */
+ invalid_auto_size_ctl.decr_mode = (enum H5C_cache_decr_mode) - 1; /* INVALID */
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decrement = 0.9f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad decr_mode 1.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad decr_mode 1.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 24.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 24.";
}
}
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode =
- (enum H5C_cache_decr_mode) 4; /* INVALID */
+ invalid_auto_size_ctl.decr_mode = (enum H5C_cache_decr_mode)4; /* INVALID */
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decrement = 0.9f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad decr_mode 2.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad decr_mode 2.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 25.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 25.";
}
}
-
/* check for bad decrement rejection */
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decrement = 1.000001f; /* INVALID */
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
-
- invalid_auto_size_ctl.decrement = 1.000001f; /* INVALID */
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad decrement 1.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad decrement 1.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 26.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 26.";
}
}
- if(pass) {
+ if (pass) {
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__threshold;
+ invalid_auto_size_ctl.decrement = -0.000001f; /* INVALID */
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
-
- invalid_auto_size_ctl.decrement = -0.000001f; /* INVALID */
-
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_set_cache_auto_resize_config accepted bad decrement 2.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_set_cache_auto_resize_config accepted bad decrement 2.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 27.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 27.";
}
}
-
/* check for rejection of bad epochs_before_eviction */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__age_out;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__age_out;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decrement = 0.9f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 0; /* INVALID */
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config accepted bad epochs_before_eviction 1.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 28.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 28.";
}
}
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ if (pass) {
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.decrement = 0.9f;
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.epochs_before_eviction = H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */
- invalid_auto_size_ctl.epochs_before_eviction =
- H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */
-
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config accepted bad epochs_before_eviction 2.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 29.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 29.";
}
}
-
/* Check for bad apply_empty_reserve rejection */
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
-
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ if (pass) {
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
- invalid_auto_size_ctl.decr_mode = H5C_decr__age_out;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__age_out;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.decrement = 0.9f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
invalid_auto_size_ctl.epochs_before_eviction = 3;
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = -0.0000001f; /* INVALID */
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = -0.0000001f; /* INVALID */
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config accepted bad empty_reserve 1.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 30.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 30.";
}
}
- if(pass) {
-
- invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- invalid_auto_size_ctl.rpt_fcn = NULL;
+ if (pass) {
- invalid_auto_size_ctl.set_initial_size = TRUE;
- invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
+ invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ invalid_auto_size_ctl.rpt_fcn = NULL;
- invalid_auto_size_ctl.min_clean_fraction = 0.1f;
+ invalid_auto_size_ctl.set_initial_size = TRUE;
+ invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024;
- invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
- invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.min_clean_fraction = 0.1f;
- invalid_auto_size_ctl.epoch_length = 5000;
+ invalid_auto_size_ctl.max_size = 16 * 1024 * 1024;
+ invalid_auto_size_ctl.min_size = 1 * 1024 * 1024;
+ invalid_auto_size_ctl.epoch_length = 5000;
- invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
+ invalid_auto_size_ctl.incr_mode = H5C_incr__threshold;
- invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
+ invalid_auto_size_ctl.lower_hr_threshold = 0.75f;
- invalid_auto_size_ctl.increment = 2.0f;
+ invalid_auto_size_ctl.increment = 2.0f;
- invalid_auto_size_ctl.apply_max_increment = TRUE;
- invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
+ invalid_auto_size_ctl.apply_max_increment = TRUE;
+ invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024);
- invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
- invalid_auto_size_ctl.flash_multiple = 2.0f;
- invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off;
+ invalid_auto_size_ctl.flash_multiple = 2.0f;
+ invalid_auto_size_ctl.flash_threshold = 0.5f;
+ invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
- invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold;
+ invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
- invalid_auto_size_ctl.upper_hr_threshold = 0.999f;
+ invalid_auto_size_ctl.decrement = 0.9f;
- invalid_auto_size_ctl.decrement = 0.9f;
+ invalid_auto_size_ctl.apply_max_decrement = TRUE;
+ invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
- invalid_auto_size_ctl.apply_max_decrement = TRUE;
- invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024);
+ invalid_auto_size_ctl.epochs_before_eviction = H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */
- invalid_auto_size_ctl.epochs_before_eviction =
- H5C__MAX_EPOCH_MARKERS + 1; /* INVALID */
-
- invalid_auto_size_ctl.apply_empty_reserve = TRUE;
- invalid_auto_size_ctl.empty_reserve = 0.05f;
+ invalid_auto_size_ctl.apply_empty_reserve = TRUE;
+ invalid_auto_size_ctl.empty_reserve = 0.05f;
result = H5C_set_cache_auto_resize_config(cache_ptr, &invalid_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config accepted bad empty_reserve 2.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed 31.";
+ }
+ else if (!resize_configs_are_equal(&test_auto_size_ctl, &ref_auto_size_ctl, FALSE)) {
- } else if(!resize_configs_are_equal(&test_auto_size_ctl, \
- &ref_auto_size_ctl, FALSE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected auto resize config 31.";
}
}
-
/* finally, before we finish, try feeding
* H5C_get_cache_auto_resize_config invalid data.
*/
- if(pass) {
+ if (pass) {
result = H5C_get_cache_auto_resize_config(NULL, &test_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_auto_resize_config accepted NULL cache_ptr.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_auto_resize_config accepted NULL cache_ptr.\n";
}
}
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_auto_resize_config((const H5C_t *)&test_auto_size_ctl,
- &test_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config((const H5C_t *)&test_auto_size_ctl, &test_auto_size_ctl);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_auto_resize_config accepted bad cache_ptr.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_auto_resize_config accepted bad cache_ptr.\n";
}
}
- if(pass) {
+ if (pass) {
result = H5C_get_cache_auto_resize_config(cache_ptr, NULL);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_auto_resize_config accepted NULL config ptr.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_auto_resize_config accepted NULL config ptr.\n";
}
}
- if(cache_ptr) {
+ if (cache_ptr) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_auto_cache_resize_input_errs() */
-
/*-------------------------------------------------------------------------
* Function: check_auto_cache_resize_aux_fcns()
*
@@ -27703,17 +26388,16 @@ check_auto_cache_resize_input_errs(unsigned paged)
static unsigned
check_auto_cache_resize_aux_fcns(unsigned paged)
{
- herr_t result;
- int32_t i;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- double hit_rate;
- size_t max_size;
- size_t min_clean_size;
- size_t cur_size;
- uint32_t cur_num_entries;
- H5C_auto_size_ctl_t auto_size_ctl =
- {
+ herr_t result;
+ int32_t i;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ double hit_rate;
+ size_t max_size;
+ size_t min_clean_size;
+ size_t cur_size;
+ uint32_t cur_num_entries;
+ H5C_auto_size_ctl_t auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
#if 1
/* H5C_auto_resize_report_fcn rpt_fcn = */ NULL,
@@ -27730,7 +26414,6 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
/* int64_t epoch_length = */ 50000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
/* double lower_hr_threshold = */ 0.75f,
@@ -27741,10 +26424,9 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
-
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
@@ -27761,8 +26443,7 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
/* double empty_reserve = */ 0.5f
};
-
- if(paged)
+ if (paged)
TESTING("automatic cache resize auxilary functions (paged aggregation)")
else
TESTING("automatic cache resize auxilary functions")
@@ -27772,31 +26453,30 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
/* allocate a cache, and then test the various auxilary functions.
*/
- if(pass) {
+ if (pass) {
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
}
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(pass) {
+ if (pass) {
- if((cache_ptr->max_cache_size != (1 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (512 * 1024))) {
+ if ((cache_ptr->max_cache_size != (1 * 1024 * 1024)) || (cache_ptr->min_clean_size != (512 * 1024))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad cache size after initialization.\n";
}
}
@@ -27805,42 +26485,40 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
* H5C_reset_cache_hit_rate_stats() pair.
*/
- if(pass) {
+ if (pass) {
- if((H5C_get_cache_hit_rate(NULL, &hit_rate) != FAIL) ||
- (H5C_get_cache_hit_rate(cache_ptr, NULL) != FAIL)) {
+ if ((H5C_get_cache_hit_rate(NULL, &hit_rate) != FAIL) ||
+ (H5C_get_cache_hit_rate(cache_ptr, NULL) != FAIL)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate accepts bad params.\n";
}
}
- if(pass) {
+ if (pass) {
result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
+ }
+ else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.0f)) { /* i.e. hit_rate != 0.0 */
- } else if(!H5_DBL_ABS_EQUAL(hit_rate, (double)0.0f)) { /* i.e. hit_rate != 0.0 */
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_hit_rate returned unexpected hit rate 1.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_hit_rate returned unexpected hit rate 1.\n";
}
}
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, PICO_ENTRY_TYPE, i);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, PICO_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
}
@@ -27848,44 +26526,40 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
+ }
+ else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.0f)) { /* i.e. hit_rate != 0.0 */
- } else if(!H5_DBL_ABS_EQUAL(hit_rate, (double)0.0f)) { /* i.e. hit_rate != 0.0 */
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_hit_rate returned unexpected hit rate 2.\n";
-
- } else if((cache_ptr->cache_accesses != 1000) ||
- (cache_ptr->cache_hits != 0)) {
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_hit_rate returned unexpected hit rate 2.\n";
+ }
+ else if ((cache_ptr->cache_accesses != 1000) || (cache_ptr->cache_hits != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache hit rate stats.\n";
+ }
+ else if (rpt_fcn_called) {
- } else if(rpt_fcn_called) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Report function called?.\n";
-
}
}
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, PICO_ENTRY_TYPE, 0);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, PICO_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
@@ -27893,81 +26567,72 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
}
}
- if(pass) {
+ if (pass) {
result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
+ }
+ else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.5f)) { /* i.e. hit_rate != 0.5 */
- } else if(!H5_DBL_ABS_EQUAL(hit_rate, (double)0.5f)) { /* i.e. hit_rate != 0.5 */
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_hit_rate returned unexpected hit rate 3.\n";
-
- } else if((cache_ptr->cache_accesses != 2000) ||
- (cache_ptr->cache_hits != 1000)) {
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_hit_rate returned unexpected hit rate 3.\n";
+ }
+ else if ((cache_ptr->cache_accesses != 2000) || (cache_ptr->cache_hits != 1000)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache hit rate stats.\n";
+ }
+ else if (rpt_fcn_called) {
- } else if(rpt_fcn_called) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Report function called?.\n";
-
}
}
- if(pass) {
+ if (pass) {
result = H5C_reset_cache_hit_rate_stats(NULL);
- if(result != FAIL) {
-
- pass = FALSE;
- failure_mssg =
- "H5C_reset_cache_hit_rate_stats accepted NULL cache_ptr.\n";
+ if (result != FAIL) {
- } else if((cache_ptr->cache_accesses != 2000) ||
- (cache_ptr->cache_hits != 1000)) {
+ pass = FALSE;
+ failure_mssg = "H5C_reset_cache_hit_rate_stats accepted NULL cache_ptr.\n";
+ }
+ else if ((cache_ptr->cache_accesses != 2000) || (cache_ptr->cache_hits != 1000)) {
- pass = FALSE;
- failure_mssg =
- "Failed call to H5C_reset_cache_hit_rate_stats altered stats?\n";
+ pass = FALSE;
+ failure_mssg = "Failed call to H5C_reset_cache_hit_rate_stats altered stats?\n";
}
}
- if(pass) {
+ if (pass) {
result = H5C_reset_cache_hit_rate_stats(cache_ptr);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_reset_cache_hit_rate_stats failed.\n";
+ }
+ else if ((cache_ptr->cache_accesses != 0) || (cache_ptr->cache_hits != 0)) {
- } else if((cache_ptr->cache_accesses != 0) ||
- (cache_ptr->cache_hits != 0)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache hit rate stats.\n";
-
}
}
- if(pass) {
+ if (pass) {
rpt_fcn_called = FALSE;
- i = 0;
- while(pass && (i < 1000))
- {
+ i = 0;
+ while (pass && (i < 1000)) {
protect_entry(file_ptr, PICO_ENTRY_TYPE, i + 500);
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, PICO_ENTRY_TYPE, i + 500, H5C__NO_FLAGS_SET);
}
@@ -27975,33 +26640,29 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
}
}
-
- if(pass) {
+ if (pass) {
result = H5C_get_cache_hit_rate(cache_ptr, &hit_rate);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_hit_rate failed.\n";
+ }
+ else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.5F)) { /* i.e. hit_rate != 0.5 */
- } else if(!H5_DBL_ABS_EQUAL(hit_rate, (double)0.5F)) { /* i.e. hit_rate != 0.5 */
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_hit_rate returned unexpected hit rate 4.\n";
-
- } else if((cache_ptr->cache_accesses != 1000) ||
- (cache_ptr->cache_hits != 500)) {
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_hit_rate returned unexpected hit rate 4.\n";
+ }
+ else if ((cache_ptr->cache_accesses != 1000) || (cache_ptr->cache_hits != 500)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache hit rate stats.\n";
+ }
+ else if (rpt_fcn_called) {
- } else if(rpt_fcn_called) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Report function called?.\n";
-
}
}
@@ -28011,214 +26672,194 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
* H5C_get_cache_size().
***************************************************/
- if(pass) {
+ if (pass) {
- result = H5C_get_cache_size(NULL, &max_size, &min_clean_size,
- &cur_size, &cur_num_entries);
+ result = H5C_get_cache_size(NULL, &max_size, &min_clean_size, &cur_size, &cur_num_entries);
- if(result != FAIL) {
+ if (result != FAIL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_size accepted NULL cache_ptr.\n";
}
}
- if(pass) {
+ if (pass) {
max_size = 0;
min_clean_size = 0;
cur_size = 0;
cur_num_entries = 0;
- result = H5C_get_cache_size(cache_ptr, &max_size, &min_clean_size,
- &cur_size, &cur_num_entries);
+ result = H5C_get_cache_size(cache_ptr, &max_size, &min_clean_size, &cur_size, &cur_num_entries);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_size failed 1.\n";
+ }
+ else if (max_size != (1 * 1024 * 1024)) {
- } else if(max_size != (1 * 1024 * 1024)) {
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected max_size 1.\n";
-
- } else if(min_clean_size != (512 * 1024)) {
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected min_clean_size 1.\n";
-
- } else if(cur_size != (1500 * PICO_ENTRY_SIZE)) {
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected max_size 1.\n";
+ }
+ else if (min_clean_size != (512 * 1024)) {
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected cur_size 1.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected min_clean_size 1.\n";
+ }
+ else if (cur_size != (1500 * PICO_ENTRY_SIZE)) {
- } else if(cur_num_entries != 1500) {
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected cur_size 1.\n";
+ }
+ else if (cur_num_entries != 1500) {
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected cur_num_entries 1.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected cur_num_entries 1.\n";
}
}
/* read a larger entry so that cur_size and cur_num_entries will be
* different.
*/
- if(pass) {
+ if (pass) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
}
- if(pass) {
+ if (pass) {
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET);
}
- if(pass) {
+ if (pass) {
max_size = 0;
min_clean_size = 0;
cur_size = 0;
cur_num_entries = 0;
- result = H5C_get_cache_size(cache_ptr, &max_size, &min_clean_size,
- &cur_size, &cur_num_entries);
+ result = H5C_get_cache_size(cache_ptr, &max_size, &min_clean_size, &cur_size, &cur_num_entries);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_size failed 2.\n";
+ }
+ else if (max_size != (1 * 1024 * 1024)) {
- } else if(max_size != (1 * 1024 * 1024)) {
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected max_size 2.\n";
-
- } else if(min_clean_size != (512 * 1024)) {
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected min_clean_size 2.\n";
-
- } else if(cur_size !=
- ((1500 * PICO_ENTRY_SIZE) + MONSTER_ENTRY_SIZE)) {
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected max_size 2.\n";
+ }
+ else if (min_clean_size != (512 * 1024)) {
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected cur_size 2.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected min_clean_size 2.\n";
+ }
+ else if (cur_size != ((1500 * PICO_ENTRY_SIZE) + MONSTER_ENTRY_SIZE)) {
- } else if(cur_num_entries != 1501) {
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected cur_size 2.\n";
+ }
+ else if (cur_num_entries != 1501) {
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected cur_num_entries 2.\n";
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected cur_num_entries 2.\n";
}
}
- if(pass) {
+ if (pass) {
- max_size = 0;
+ max_size = 0;
result = H5C_get_cache_size(cache_ptr, &max_size, NULL, NULL, NULL);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_size failed 3.\n";
+ }
+ else if (max_size != (1 * 1024 * 1024)) {
- } else if(max_size != (1 * 1024 * 1024)) {
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected max_size 3.\n";
-
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected max_size 3.\n";
}
}
- if(pass) {
+ if (pass) {
- min_clean_size = 0;
+ min_clean_size = 0;
- result = H5C_get_cache_size(cache_ptr, NULL, &min_clean_size,
- NULL, NULL);
+ result = H5C_get_cache_size(cache_ptr, NULL, &min_clean_size, NULL, NULL);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_size failed 4.\n";
+ }
+ else if (min_clean_size != (512 * 1024)) {
- } else if(min_clean_size != (512 * 1024)) {
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected min_clean_size 4.\n";
-
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected min_clean_size 4.\n";
}
}
- if(pass) {
+ if (pass) {
- cur_size = 0;
+ cur_size = 0;
result = H5C_get_cache_size(cache_ptr, NULL, NULL, &cur_size, NULL);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_size failed 5.\n";
+ }
+ else if (cur_size != ((1500 * PICO_ENTRY_SIZE) + MONSTER_ENTRY_SIZE)) {
- } else if(cur_size !=
- ((1500 * PICO_ENTRY_SIZE) + MONSTER_ENTRY_SIZE)) {
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected cur_size 5.\n";
-
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected cur_size 5.\n";
}
}
- if(pass) {
+ if (pass) {
cur_num_entries = 0;
- result = H5C_get_cache_size(cache_ptr, NULL, NULL, NULL,
- &cur_num_entries);
+ result = H5C_get_cache_size(cache_ptr, NULL, NULL, NULL, &cur_num_entries);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_size failed 6.\n";
+ }
+ else if (cur_num_entries != 1501) {
- } else if(cur_num_entries != 1501) {
-
- pass = FALSE;
- failure_mssg =
- "H5C_get_cache_size reports unexpected cur_num_entries 2.\n";
-
+ pass = FALSE;
+ failure_mssg = "H5C_get_cache_size reports unexpected cur_num_entries 2.\n";
}
}
- if(cache_ptr) {
+ if (cache_ptr) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_auto_cache_resize_aux_fcns() */
-
/*-------------------------------------------------------------------------
* Function: check_metadata_blizzard_absence()
*
@@ -28249,19 +26890,19 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
static unsigned
check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
{
- int entry_type = HUGE_ENTRY_TYPE;
- size_t entry_size = HUGE_ENTRY_SIZE; /* 16 KB */
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ int entry_type = HUGE_ENTRY_TYPE;
+ size_t entry_size = HUGE_ENTRY_SIZE; /* 16 KB */
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
hbool_t show_progress = FALSE;
- int32_t checkpoint = 0;
- int32_t entry_idx = 0;
+ int32_t checkpoint = 0;
+ int32_t entry_idx = 0;
int32_t i;
/* Expected deserialized status of entries depends on how they get into
* the cache. Insertions = not deserialized, protect/unprotect = deserialized.
*/
- hbool_t deserialized = (hbool_t)!(fill_via_insertion);
+ hbool_t deserialized = (hbool_t) !(fill_via_insertion);
/* Set up the expected array. This is used to maintain a table of the
* expected status of every entry used in this test.
@@ -28428,23 +27069,23 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
reset_entries();
- if(fill_via_insertion) {
- if(paged)
+ if (fill_via_insertion) {
+ if (paged)
TESTING("to ensure metadata blizzard absence when inserting (pgd aggr)")
else
TESTING("to ensure metadata blizzard absence when inserting")
} /* end if */
else {
- if(paged)
+ if (paged)
TESTING("to ensure metadata blizzard absence on protect/unprotect (pa)")
else
TESTING("to ensure metadata blizzard absence on protect/unprotect")
} /* end else */
- if(show_progress) /* 0 */
- HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
+ if (show_progress) /* 0 */
+ HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
- if(pass) {
+ if (pass) {
/* Set up the cache.
*
@@ -28453,19 +27094,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
*/
file_ptr = setup_cache((size_t)(50 * entry_size), (size_t)(25 * entry_size), paged);
- if(file_ptr == NULL) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad return from cache intialization.\n";
-
}
else
cache_ptr = file_ptr->shared->cache;
}
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
/* ========================================================================
* ========================================================================
@@ -28483,7 +27122,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
* ========================================================================
*/
- if(pass) {
+ if (pass) {
/* Insert 26 entries (indexes 0 through 25) into the cache.
*
@@ -28496,28 +27135,28 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
for (entry_idx = 0; entry_idx < 26; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
-
- } else {
+ entry_type, /* int32_t type */
+ entry_idx, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/* Change expected values, and verify the status of the entries
* after each insertion
*/
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
expected[entry_idx].deserialized = (unsigned char)deserialized;
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -28527,9 +27166,8 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
}
}
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
/* ========================================================================
* ========================================================================
@@ -28547,7 +27185,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
* ========================================================================
*/
- if(pass) {
+ if (pass) {
/* Insert the 27th entry (index = 26) into the cache.
*
@@ -28555,19 +27193,20 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
* before the insertion because it doesn't satisfy the min_clean_size
* constraint.
*/
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx++, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ entry_type, /* int32_t type */
+ entry_idx++, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx++, /* int32_t idx */
+ entry_idx++, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
@@ -28582,13 +27221,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
*/
/* entry w/ index 0 has now been flushed and is now clean. */
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
/* entry w/ index 26 is now in the cache and dirty. */
- expected[26].in_cache = TRUE;
- expected[26].is_dirty = TRUE;
- expected[26].deserialized = (unsigned char)deserialized;
+ expected[26].in_cache = TRUE;
+ expected[26].is_dirty = TRUE;
+ expected[26].deserialized = (unsigned char)deserialized;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -28597,11 +27236,10 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
expected); /* expected */
}
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
- if(pass) {
+ if (pass) {
/* Insert the 28th entry (index = 27) into the cache.
*
@@ -28609,17 +27247,18 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
* recently used entry before the insertion as it again does not
* satisfy the min_clean_size constraint.
*/
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx++, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ entry_type, /* int32_t type */
+ entry_idx++, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
entry_idx++, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
@@ -28636,13 +27275,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
*/
/* entry w/ index 1 has now been flushed and is now clean. */
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
/* entry w/ index 27 is now in the cache and dirty. */
- expected[27].in_cache = TRUE;
- expected[27].is_dirty = TRUE;
- expected[27].deserialized = (unsigned char)deserialized;
+ expected[27].in_cache = TRUE;
+ expected[27].is_dirty = TRUE;
+ expected[27].deserialized = (unsigned char)deserialized;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -28651,29 +27290,29 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
expected); /* expected */
}
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
- if(pass) {
+ if (pass) {
/* Fill out the rest of the cache with entries */
/* Verify expected status of entries after each insertion */
for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ entry_type, /* int32_t type */
+ entry_idx, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
@@ -28682,12 +27321,12 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
* entry currently getting inserted is now in the cache and
* dirty.
*/
- expected[entry_idx - 26].is_dirty = FALSE;
+ expected[entry_idx - 26].is_dirty = FALSE;
expected[entry_idx - 26].serialized = TRUE;
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
- expected[entry_idx].deserialized = (unsigned char)deserialized;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].deserialized = (unsigned char)deserialized;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -28697,16 +27336,15 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
}
/* Verify that the cache is now full */
- if(cache_ptr->cache_full != TRUE) {
+ if (cache_ptr->cache_full != TRUE) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not completely filled.\n";
}
}
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
/* ========================================================================
* ========================================================================
@@ -28726,24 +27364,25 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
* ========================================================================
*/
- if(pass) {
+ if (pass) {
/* Insert the 51st entry (index = 50) into the cache.
*
* The cache is full prior to the insertion, so it will
* have to evict in order to make room for the new entry.
*/
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx++, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ entry_type, /* int32_t type */
+ entry_idx++, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
entry_idx++, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
@@ -28758,19 +27397,19 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
*/
/* entry w/ index 0 has been evicted. */
- expected[0].in_cache = FALSE;
- expected[0].destroyed = TRUE;
+ expected[0].in_cache = FALSE;
+ expected[0].destroyed = TRUE;
/* entries w/ indices 24,25 have now been flushed and are clean. */
- expected[24].is_dirty = FALSE;
- expected[24].serialized = TRUE;
- expected[25].is_dirty = FALSE;
- expected[25].serialized = TRUE;
+ expected[24].is_dirty = FALSE;
+ expected[24].serialized = TRUE;
+ expected[25].is_dirty = FALSE;
+ expected[25].serialized = TRUE;
/* entry w/ index 50 is now in the cache and dirty */
- expected[50].in_cache = TRUE;
- expected[50].is_dirty = TRUE;
- expected[50].deserialized = (unsigned char)deserialized;
+ expected[50].in_cache = TRUE;
+ expected[50].is_dirty = TRUE;
+ expected[50].deserialized = (unsigned char)deserialized;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -28779,12 +27418,10 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
expected); /* expected */
}
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
-
- if(pass) {
+ if (pass) {
/* Insert 49 more entries (indices 51-99) into the cache.
*
@@ -28796,38 +27433,39 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
*/
for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
+ entry_type, /* int32_t type */
entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/* This past inserted entry is now in the cache and dirty */
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
- expected[entry_idx].deserialized = (unsigned char)deserialized;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].deserialized = (unsigned char)deserialized;
/* The entry inserted 50 insertions ago has been evicted */
- expected[entry_idx - 50].in_cache = FALSE;
- expected[entry_idx - 50].destroyed = TRUE;
+ expected[entry_idx - 50].in_cache = FALSE;
+ expected[entry_idx - 50].destroyed = TRUE;
/* If the newly inserted entry is among the first 24
* insertions in this loop, then the insertion will
* have resulted in a flush of the entry inserted
* 25 insertions ago. */
- if(entry_idx < 75) {
+ if (entry_idx < 75) {
- expected[entry_idx - 25].is_dirty = FALSE;
+ expected[entry_idx - 25].is_dirty = FALSE;
expected[entry_idx - 25].serialized = TRUE;
}
/* If the newly inserted entry is among the last
@@ -28839,7 +27477,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
* flush-then-evict, it switches to evict-then-flush. */
else {
- expected[entry_idx - 26].is_dirty = FALSE;
+ expected[entry_idx - 26].is_dirty = FALSE;
expected[entry_idx - 26].serialized = TRUE;
}
@@ -28851,9 +27489,8 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
}
}
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
/* ========================================================================
* ========================================================================
@@ -28876,7 +27513,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
* ========================================================================
*/
- if(pass) {
+ if (pass) {
/* Flush the cache.
*
@@ -28886,9 +27523,9 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
*/
flush_cache(file_ptr, /* H5F_t * file_ptr */
- FALSE, /* hbool_t destory_entries */
- FALSE, /* hbool_t dump_stats */
- FALSE); /* hbool_t dump_detailed_stats */
+ FALSE, /* hbool_t destory_entries */
+ FALSE, /* hbool_t dump_stats */
+ FALSE); /* hbool_t dump_detailed_stats */
/* Verify that the cache is clean */
verify_clean();
@@ -28902,7 +27539,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
/* entries w/ indices 74-99 have been flushed. */
for (i = 74; i < 100; i++) {
- expected[i].is_dirty = FALSE;
+ expected[i].is_dirty = FALSE;
expected[i].serialized = TRUE;
}
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -28911,11 +27548,10 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
expected); /* expected */
}
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
- if(pass) {
+ if (pass) {
/* Insert 26 entries (indexes 100 through 125) into the cache.
*
@@ -28926,31 +27562,31 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
for (entry_idx = 100; entry_idx < 126; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
-
- } else {
+ entry_type, /* int32_t type */
+ entry_idx, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/* This past inserted entry is now in the cache and dirty */
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
- expected[entry_idx].deserialized = (unsigned char)deserialized;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].deserialized = (unsigned char)deserialized;
/* The entry with ID minus 50 will have been evicted */
- expected[entry_idx - 50].in_cache = FALSE;
- expected[entry_idx - 50].destroyed = TRUE;
+ expected[entry_idx - 50].in_cache = FALSE;
+ expected[entry_idx - 50].destroyed = TRUE;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -28960,26 +27596,26 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
}
}
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
- if(pass) {
+ if (pass) {
/* Insert the 127th entry (index = 126) into the cache. */
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx++, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ entry_type, /* int32_t type */
+ entry_idx++, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx++, /* int32_t idx */
+ entry_idx++, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
@@ -28992,62 +27628,61 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
*/
/* entry w/ index 76 has been evicted. */
- expected[76].in_cache = FALSE;
- expected[76].destroyed = TRUE;
+ expected[76].in_cache = FALSE;
+ expected[76].destroyed = TRUE;
/* entry w/ index 100 has now been flushed and is now clean. */
- expected[100].is_dirty = FALSE;
- expected[100].serialized = TRUE;
+ expected[100].is_dirty = FALSE;
+ expected[100].serialized = TRUE;
/* entry w/ index 26 is now in the cache and dirty. */
- expected[126].in_cache = TRUE;
- expected[126].is_dirty = TRUE;
- expected[126].deserialized = (unsigned char)deserialized;
+ expected[126].in_cache = TRUE;
+ expected[126].is_dirty = TRUE;
+ expected[126].deserialized = (unsigned char)deserialized;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- 126, /* int tag */
+ 126, /* int tag */
150, /* int num_entries */
expected); /* expected */
}
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
- if(pass) {
+ if (pass) {
/* Insert entries w/ indices 127 through 149 into the cache */
for (entry_idx = 127; entry_idx < 150; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
-
- } else {
+ entry_type, /* int32_t type */
+ entry_idx, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/* This past inserted entry is now in the cache and dirty */
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
- expected[entry_idx].deserialized = (unsigned char)deserialized;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].deserialized = (unsigned char)deserialized;
/* The entry with ID minus 50 will have been evicted */
- expected[entry_idx - 50].in_cache = FALSE;
- expected[entry_idx - 50].destroyed = TRUE;
+ expected[entry_idx - 50].in_cache = FALSE;
+ expected[entry_idx - 50].destroyed = TRUE;
/* The entry with ID minus 26 will now be clean */
- expected[entry_idx - 26].is_dirty = FALSE;
+ expected[entry_idx - 26].is_dirty = FALSE;
expected[entry_idx - 26].serialized = TRUE;
/* verify the status */
@@ -29056,31 +27691,32 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
150, /* int num_entries */
expected); /* struct expected_entry_staus[] */
}
-
}
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
- if(cache_ptr) {
+ if (cache_ptr) {
/* We're done with testing. We can take down the cache. */
takedown_cache(file_ptr, FALSE, FALSE);
reset_entries();
}
- if(show_progress) /* 12 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- FUNC, checkpoint++, pass);
+ if (show_progress) /* 12 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
return (unsigned)!pass;
} /* check_metadata_blizzard_absence() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_deps()
*
@@ -29097,11 +27733,11 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
static unsigned
check_flush_deps(unsigned paged)
{
- H5F_t * file_ptr = NULL; /* File for this test */
- H5C_t * cache_ptr = NULL; /* Metadata cache for this test */
- test_entry_t *base_addr; /* Base address of entries for test */
- int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */
- unsigned u; /* Local index variable */
+ H5F_t * file_ptr = NULL; /* File for this test */
+ H5C_t * cache_ptr = NULL; /* Metadata cache for this test */
+ test_entry_t *base_addr; /* Base address of entries for test */
+ int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */
+ unsigned u; /* Local index variable */
/* clang-format off */
struct expected_entry_status expected[5] =
@@ -29116,7 +27752,7 @@ check_flush_deps(unsigned paged)
};
/* clang-format on */
- if(paged)
+ if (paged)
TESTING("flush dependencies (paged aggregation)")
else
TESTING("flush dependencies")
@@ -29128,16 +27764,18 @@ check_flush_deps(unsigned paged)
*/
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
base_addr = entries[entry_type];
- if(!pass) CACHE_ERROR("setup_cache failed")
+ if (!pass)
+ CACHE_ERROR("setup_cache failed")
/* Insert entries to work with into the cache */
- for(u = 0; u < 5; u++) {
+ for (u = 0; u < 5; u++) {
insert_entry(file_ptr, entry_type, (int32_t)u, H5C__NO_FLAGS_SET);
- if(!pass) CACHE_ERROR("insert_entry failed")
+ if (!pass)
+ CACHE_ERROR("insert_entry failed")
/* Change expected values, and verify the status of the entries
* after each insertion
@@ -29146,836 +27784,927 @@ check_flush_deps(unsigned paged)
expected[u].is_dirty = TRUE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)u, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)u, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
} /* end for */
-/* Test Case #1 - Single flush dependency relationship */
+ /* Test Case #1 - Single flush dependency relationship */
/* Create flush dependency between entries 0 (child) & 1 (parent) */
{
- hbool_t in_cache, is_flush_dep_parent, is_flush_dep_child;
- test_entry_t * entry_ptr;
+ hbool_t in_cache, is_flush_dep_parent, is_flush_dep_child;
+ test_entry_t *entry_ptr;
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
/* Check the parent's entry status */
- entry_ptr = &(base_addr[1]);
- if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache,
- NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0)
+ entry_ptr = &(base_addr[1]);
+ if (H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL,
+ &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0)
CACHE_ERROR("H5C_get_entry_status() failed")
- if(!in_cache || is_flush_dep_parent || is_flush_dep_child)
+ if (!in_cache || is_flush_dep_parent || is_flush_dep_child)
CACHE_ERROR("invalid entry status")
/* Check the child's entry status */
- entry_ptr = &(base_addr[0]);
- if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache,
- NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0)
+ entry_ptr = &(base_addr[0]);
+ if (H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL,
+ &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0)
CACHE_ERROR("H5C_get_entry_status() failed")
- if(!in_cache || is_flush_dep_parent || is_flush_dep_child)
+ if (!in_cache || is_flush_dep_parent || is_flush_dep_child)
CACHE_ERROR("invalid entry status")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Check the parent's entry status */
- entry_ptr = &(base_addr[1]);
- if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache,
- NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0)
+ entry_ptr = &(base_addr[1]);
+ if (H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL,
+ &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0)
CACHE_ERROR("H5C_get_entry_status() failed")
- if(!in_cache || !is_flush_dep_parent || is_flush_dep_child)
+ if (!in_cache || !is_flush_dep_parent || is_flush_dep_child)
CACHE_ERROR("invalid entry status")
/* Check the child's entry status */
- entry_ptr = &(base_addr[0]);
- if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache,
- NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0)
+ entry_ptr = &(base_addr[0]);
+ if (H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL,
+ &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0)
CACHE_ERROR("H5C_get_entry_status() failed")
- if(!in_cache || is_flush_dep_parent || !is_flush_dep_child)
+ if (!in_cache || is_flush_dep_parent || !is_flush_dep_child)
CACHE_ERROR("invalid entry status")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries 0 (child) & 1 (parent) */
{
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
- expected[1].flush_dep_ndirty_chd =0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
+ expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #2 - Multiple children for one parent flush dependency relationship */
+ /* Test Case #2 - Multiple children for one parent flush dependency relationship */
/* Create flush dependency between entries 0, 1 (children) & 2 (parent) */
{
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 2;
- expected[0].flush_dep_npar = 1;
+ expected[0].flush_dep_par_idx[0] = 2;
+ expected[0].flush_dep_npar = 1;
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 2;
- expected[2].flush_dep_ndirty_chd = 2;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 2;
+ expected[2].flush_dep_ndirty_chd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries 0, 1 (children) & 2 (parent) */
{
destroy_flush_dependency(entry_type, 2, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].flush_dep_npar = 0;
- expected[2].is_protected = FALSE;
- expected[2].is_pinned = FALSE;
- expected[2].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].flush_dep_npar = 0;
+ expected[2].is_protected = FALSE;
+ expected[2].is_pinned = FALSE;
+ expected[2].flush_dep_nchd = 0;
expected[2].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #3a1 - Single chain of flush dependencies, 4 entries tall
- * created from the "bottom up" and destroyed from the "top down"
- */
+ /* Test Case #3a1 - Single chain of flush dependencies, 4 entries tall
+ * created from the "bottom up" and destroyed from the "top down"
+ */
/* Create flush dependency between entries (child) 0->1->2->3 (parent) */
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
- expected[2].flush_dep_ndirty_chd = 1;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
+ expected[2].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 3);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type[0] = entry_type;
- expected[2].flush_dep_par_idx[0] = 3;
- expected[2].flush_dep_npar = 1;
- expected[3].is_protected = TRUE;
- expected[3].is_pinned = TRUE;
- expected[3].flush_dep_nchd = 1;
- expected[3].flush_dep_ndirty_chd = 1;
+ expected[2].flush_dep_par_idx[0] = 3;
+ expected[2].flush_dep_npar = 1;
+ expected[3].is_protected = TRUE;
+ expected[3].is_pinned = TRUE;
+ expected[3].flush_dep_nchd = 1;
+ expected[3].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, from the "top down" */
{
destroy_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
3, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[2].flush_dep_npar = 0;
- expected[3].is_protected = FALSE;
- expected[3].is_pinned = FALSE;
- expected[3].flush_dep_nchd = 0;
+ expected[2].flush_dep_npar = 0;
+ expected[3].is_protected = FALSE;
+ expected[3].is_pinned = FALSE;
+ expected[3].flush_dep_nchd = 0;
expected[3].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[1].flush_dep_npar = 0;
- expected[2].is_protected = FALSE;
- expected[2].is_pinned = FALSE;
- expected[2].flush_dep_nchd = 0;
+ expected[1].flush_dep_npar = 0;
+ expected[2].is_protected = FALSE;
+ expected[2].is_pinned = FALSE;
+ expected[2].flush_dep_nchd = 0;
expected[2].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #3a2 - Single chain of flush dependencies, 4 entries tall
- * created from the "bottom up" and destroyed from the "bottom up"
- */
+ /* Test Case #3a2 - Single chain of flush dependencies, 4 entries tall
+ * created from the "bottom up" and destroyed from the "bottom up"
+ */
/* Create flush dependency between entries (child) 0->1->2->3 (parent) */
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
- expected[2].flush_dep_ndirty_chd = 1;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
+ expected[2].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 3);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type[0] = entry_type;
- expected[2].flush_dep_par_idx[0] = 3;
- expected[2].flush_dep_npar = 1;
- expected[3].is_protected = TRUE;
- expected[3].is_pinned = TRUE;
- expected[3].flush_dep_nchd = 1;
- expected[3].flush_dep_ndirty_chd = 1;
+ expected[2].flush_dep_par_idx[0] = 3;
+ expected[2].flush_dep_npar = 1;
+ expected[3].is_protected = TRUE;
+ expected[3].is_pinned = TRUE;
+ expected[3].flush_dep_nchd = 1;
+ expected[3].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, from the "bottom up" */
{
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[1].flush_dep_npar = 0;
- expected[2].is_protected = FALSE;
- expected[2].is_pinned = FALSE;
- expected[2].flush_dep_nchd = 0;
+ expected[1].flush_dep_npar = 0;
+ expected[2].is_protected = FALSE;
+ expected[2].is_pinned = FALSE;
+ expected[2].flush_dep_nchd = 0;
expected[2].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
3, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[2].flush_dep_npar = 0;
- expected[3].is_protected = FALSE;
- expected[3].is_pinned = FALSE;
- expected[3].flush_dep_nchd = 0;
+ expected[2].flush_dep_npar = 0;
+ expected[3].is_protected = FALSE;
+ expected[3].is_pinned = FALSE;
+ expected[3].flush_dep_nchd = 0;
expected[3].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #3b1 - Single chain of flush dependencies, 4 entries tall
- * created from the "top down" and destroyed from the "top down"
- */
+ /* Test Case #3b1 - Single chain of flush dependencies, 4 entries tall
+ * created from the "top down" and destroyed from the "top down"
+ */
/* Create flush dependency between entries (child) 0->1->2->3 (parent) */
{
protect_entry(file_ptr, entry_type, 3);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type[0] = entry_type;
- expected[2].flush_dep_par_idx[0] = 3;
- expected[2].flush_dep_npar = 1;
- expected[3].is_protected = TRUE;
- expected[3].is_pinned = TRUE;
- expected[3].flush_dep_nchd = 1;
- expected[3].flush_dep_ndirty_chd = 1;
+ expected[2].flush_dep_par_idx[0] = 3;
+ expected[2].flush_dep_npar = 1;
+ expected[3].is_protected = TRUE;
+ expected[3].is_pinned = TRUE;
+ expected[3].flush_dep_nchd = 1;
+ expected[3].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
- expected[2].flush_dep_ndirty_chd = 1;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
+ expected[2].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, from the "top down" */
{
destroy_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
3, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[2].flush_dep_npar = 0;
- expected[3].is_protected = FALSE;
- expected[3].is_pinned = FALSE;
- expected[3].flush_dep_nchd = 0;
+ expected[2].flush_dep_npar = 0;
+ expected[3].is_protected = FALSE;
+ expected[3].is_pinned = FALSE;
+ expected[3].flush_dep_nchd = 0;
expected[3].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[1].flush_dep_npar = 0;
- expected[2].is_protected = FALSE;
- expected[2].is_pinned = FALSE;
- expected[2].flush_dep_nchd = 0;
+ expected[1].flush_dep_npar = 0;
+ expected[2].is_protected = FALSE;
+ expected[2].is_pinned = FALSE;
+ expected[2].flush_dep_nchd = 0;
expected[2].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #3b2 - Single chain of flush dependencies, 4 entries tall
- * created from the "top down" and destroyed from the "bottom up"
- */
+ /* Test Case #3b2 - Single chain of flush dependencies, 4 entries tall
+ * created from the "top down" and destroyed from the "bottom up"
+ */
/* Create flush dependency between entries (child) 0->1->2->3 (parent) */
{
protect_entry(file_ptr, entry_type, 3);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type[0] = entry_type;
- expected[2].flush_dep_par_idx[0] = 3;
- expected[2].flush_dep_npar = 1;
- expected[3].is_protected = TRUE;
- expected[3].is_pinned = TRUE;
- expected[3].flush_dep_nchd = 1;
- expected[3].flush_dep_ndirty_chd = 1;
+ expected[2].flush_dep_par_idx[0] = 3;
+ expected[2].flush_dep_npar = 1;
+ expected[3].is_protected = TRUE;
+ expected[3].is_pinned = TRUE;
+ expected[3].flush_dep_nchd = 1;
+ expected[3].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
- expected[2].flush_dep_ndirty_chd = 1;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
+ expected[2].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, from the "bottom up" */
{
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[1].flush_dep_npar = 0;
- expected[2].is_protected = FALSE;
- expected[2].is_pinned = FALSE;
- expected[2].flush_dep_nchd = 0;
+ expected[1].flush_dep_npar = 0;
+ expected[2].is_protected = FALSE;
+ expected[2].is_pinned = FALSE;
+ expected[2].flush_dep_nchd = 0;
expected[2].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
3, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[2].flush_dep_npar = 0;
- expected[3].is_protected = FALSE;
- expected[3].is_pinned = FALSE;
- expected[3].flush_dep_nchd = 0;
+ expected[2].flush_dep_npar = 0;
+ expected[3].is_protected = FALSE;
+ expected[3].is_pinned = FALSE;
+ expected[3].flush_dep_nchd = 0;
expected[3].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #4 - Multiple children for a single parent */
+ /* Test Case #4 - Multiple children for a single parent */
/* Create flush dependency between entries (child) 0,1,2,3->4 (parent) */
{
protect_entry(file_ptr, entry_type, 4);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
- for(u = 0; u < 4; u++) {
+ for (u = 0; u < 4; u++) {
create_flush_dependency(entry_type, 4, entry_type, (int32_t)u);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[u].flush_dep_par_type[0] = entry_type;
- expected[u].flush_dep_par_idx[0] = 4;
- expected[u].flush_dep_npar = 1;
- expected[4].is_protected = TRUE;
- expected[4].is_pinned = TRUE;
+ expected[u].flush_dep_par_idx[0] = 4;
+ expected[u].flush_dep_npar = 1;
+ expected[4].is_protected = TRUE;
+ expected[4].is_pinned = TRUE;
expected[4].flush_dep_nchd++;
expected[4].flush_dep_ndirty_chd++;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
} /* end for */
}
/* Destroy flush dependency between entries */
{
- for(u = 0; u < 4; u++) {
+ for (u = 0; u < 4; u++) {
destroy_flush_dependency(entry_type, 4, entry_type, (int32_t)u);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -29985,834 +28714,923 @@ check_flush_deps(unsigned paged)
expected[4].flush_dep_ndirty_chd--;
/* Check for destroying flush dependency on last entry */
- if(3 == u) {
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ if (3 == u) {
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
4, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].is_protected = FALSE;
- expected[4].is_pinned = FALSE;
+ expected[4].is_pinned = FALSE;
} /* end if */
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
} /* end for */
}
-/* Test Case #5a - Join two flush dependency chains together, creating a single
- * un-forked dependency chain
- */
+ /* Test Case #5a - Join two flush dependency chains together, creating a single
+ * un-forked dependency chain
+ */
/* Create flush dependency between entries (child) 0->1 and 3->4 (parent)
* then add entry 4 as a child of 0
*/
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 4);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type[0] = entry_type;
- expected[3].flush_dep_par_idx[0] = 4;
- expected[3].flush_dep_npar = 1;
- expected[4].is_protected = TRUE;
- expected[4].is_pinned = TRUE;
- expected[4].flush_dep_nchd = 1;
- expected[4].flush_dep_ndirty_chd = 1;
+ expected[3].flush_dep_par_idx[0] = 4;
+ expected[3].flush_dep_npar = 1;
+ expected[4].is_protected = TRUE;
+ expected[4].is_pinned = TRUE;
+ expected[4].flush_dep_nchd = 1;
+ expected[4].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 0, entry_type, 4);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type[0] = entry_type;
- expected[4].flush_dep_par_idx[0] = 0;
- expected[4].flush_dep_npar = 1;
- expected[0].is_protected = TRUE;
- expected[0].is_pinned = TRUE;
- expected[0].flush_dep_nchd = 1;
- expected[0].flush_dep_ndirty_chd = 1;
+ expected[4].flush_dep_par_idx[0] = 0;
+ expected[4].flush_dep_npar = 1;
+ expected[0].is_protected = TRUE;
+ expected[0].is_pinned = TRUE;
+ expected[0].flush_dep_nchd = 1;
+ expected[0].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
-
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, detaching 3->4 from 0 first */
{
destroy_flush_dependency(entry_type, 0, entry_type, 4);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[4].flush_dep_npar = 0;
- expected[0].is_protected = FALSE;
- expected[0].is_pinned = FALSE;
- expected[0].flush_dep_nchd = 0;
+ expected[4].flush_dep_npar = 0;
+ expected[0].is_protected = FALSE;
+ expected[0].is_pinned = FALSE;
+ expected[0].flush_dep_nchd = 0;
expected[0].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
4, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[3].flush_dep_npar = 0;
- expected[4].is_protected = FALSE;
- expected[4].is_pinned = FALSE;
- expected[4].flush_dep_nchd = 0;
+ expected[3].flush_dep_npar = 0;
+ expected[4].is_protected = FALSE;
+ expected[4].is_pinned = FALSE;
+ expected[4].flush_dep_nchd = 0;
expected[4].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #5b - Join two flush dependency chains together, creating a
- * forked dependency chain
- */
+ /* Test Case #5b - Join two flush dependency chains together, creating a
+ * forked dependency chain
+ */
/* Create flush dependency between entries (child) 0->1->2 and 3->4 (parent)
* then add entry 4 as a child of 1
*/
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5F_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5F_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
- expected[2].flush_dep_ndirty_chd = 1;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
+ expected[2].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 4);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type[0] = entry_type;
- expected[3].flush_dep_par_idx[0] = 4;
- expected[3].flush_dep_npar = 1;
- expected[4].is_protected = TRUE;
- expected[4].is_pinned = TRUE;
- expected[4].flush_dep_nchd = 1;
- expected[4].flush_dep_ndirty_chd = 1;
+ expected[3].flush_dep_par_idx[0] = 4;
+ expected[3].flush_dep_npar = 1;
+ expected[4].is_protected = TRUE;
+ expected[4].is_pinned = TRUE;
+ expected[4].flush_dep_nchd = 1;
+ expected[4].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 1, entry_type, 4);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type[0] = entry_type;
- expected[4].flush_dep_par_idx[0] = 1;
- expected[4].flush_dep_npar = 1;
- expected[1].flush_dep_nchd = 2;
- expected[1].flush_dep_ndirty_chd = 2;
+ expected[4].flush_dep_par_idx[0] = 1;
+ expected[4].flush_dep_npar = 1;
+ expected[1].flush_dep_nchd = 2;
+ expected[1].flush_dep_ndirty_chd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
-
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, detaching 3->4 from 1 first */
{
destroy_flush_dependency(entry_type, 1, entry_type, 4);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[4].flush_dep_npar = 0;
- expected[1].flush_dep_nchd = 1;
+ expected[4].flush_dep_npar = 0;
+ expected[1].flush_dep_nchd = 1;
expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
4, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[3].flush_dep_npar = 0;
- expected[4].is_protected = FALSE;
- expected[4].is_pinned = FALSE;
- expected[4].flush_dep_nchd = 0;
+ expected[3].flush_dep_npar = 0;
+ expected[4].is_protected = FALSE;
+ expected[4].is_pinned = FALSE;
+ expected[4].flush_dep_nchd = 0;
expected[4].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[1].flush_dep_npar = 0;
- expected[2].is_protected = FALSE;
- expected[2].is_pinned = FALSE;
- expected[2].flush_dep_nchd = 0;
+ expected[1].flush_dep_npar = 0;
+ expected[2].is_protected = FALSE;
+ expected[2].is_pinned = FALSE;
+ expected[2].flush_dep_nchd = 0;
expected[2].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #5c - Join two flush dependency chains together, creating a
- * forked dependency chain
- */
+ /* Test Case #5c - Join two flush dependency chains together, creating a
+ * forked dependency chain
+ */
/* Create flush dependency between entries (child) 0->1->2 and 3->4 (parent)
* then add entry 4 as a child of 2
*/
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
- expected[2].flush_dep_ndirty_chd = 1;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
+ expected[2].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 4);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type[0] = entry_type;
- expected[3].flush_dep_par_idx[0] = 4;
- expected[3].flush_dep_npar = 1;
- expected[4].is_protected = TRUE;
- expected[4].is_pinned = TRUE;
- expected[4].flush_dep_nchd = 1;
- expected[4].flush_dep_ndirty_chd = 1;
+ expected[3].flush_dep_par_idx[0] = 4;
+ expected[3].flush_dep_npar = 1;
+ expected[4].is_protected = TRUE;
+ expected[4].is_pinned = TRUE;
+ expected[4].flush_dep_nchd = 1;
+ expected[4].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 2, entry_type, 4);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type[0] = entry_type;
- expected[4].flush_dep_par_idx[0] = 2;
- expected[4].flush_dep_npar = 1;
- expected[2].flush_dep_nchd = 2;
- expected[2].flush_dep_ndirty_chd = 2;
+ expected[4].flush_dep_par_idx[0] = 2;
+ expected[4].flush_dep_npar = 1;
+ expected[2].flush_dep_nchd = 2;
+ expected[2].flush_dep_ndirty_chd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
-
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, detaching 3->4 from 2 first */
{
destroy_flush_dependency(entry_type, 2, entry_type, 4);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[4].flush_dep_npar = 0;
- expected[2].flush_dep_nchd = 1;
+ expected[4].flush_dep_npar = 0;
+ expected[2].flush_dep_nchd = 1;
expected[2].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
4, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[3].flush_dep_npar = 0;
- expected[4].is_protected = FALSE;
- expected[4].is_pinned = FALSE;
- expected[4].flush_dep_nchd = 0;
+ expected[3].flush_dep_npar = 0;
+ expected[4].is_protected = FALSE;
+ expected[4].is_pinned = FALSE;
+ expected[4].flush_dep_nchd = 0;
expected[4].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[1].flush_dep_npar = 0;
- expected[2].is_protected = FALSE;
- expected[2].is_pinned = FALSE;
- expected[2].flush_dep_nchd = 0;
+ expected[1].flush_dep_npar = 0;
+ expected[2].is_protected = FALSE;
+ expected[2].is_pinned = FALSE;
+ expected[2].flush_dep_nchd = 0;
expected[2].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #6a - Make certain that flush dependency relationship with parent
- * already pinned works (unpin ater destroying flush dependency)
- */
+ /* Test Case #6a - Make certain that flush dependency relationship with parent
+ * already pinned works (unpin ater destroying flush dependency)
+ */
/* Create flush dependency between entries 0 (child) & 1 (parent) */
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
pin_entry(entry_type, 1);
- if(!pass) CACHE_ERROR("pin_entry failed")
+ if (!pass)
+ CACHE_ERROR("pin_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Unpin entry & destroy flush dependency between entries 0 (child) & 1 (parent) */
{
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
unpin_entry(entry_type, 1);
- if(!pass) CACHE_ERROR("unpin_entry failed")
+ if (!pass)
+ CACHE_ERROR("unpin_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #6b - Make certain that flush dependency relationship with parent
- * already pinned works (unpin before destroying flush dependency)
- */
+ /* Test Case #6b - Make certain that flush dependency relationship with parent
+ * already pinned works (unpin before destroying flush dependency)
+ */
/* Create flush dependency between entries 0 (child) & 1 (parent) */
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
pin_entry(entry_type, 1);
- if(!pass) CACHE_ERROR("pin_entry failed")
+ if (!pass)
+ CACHE_ERROR("pin_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Unpin entry & destroy flush dependency between entries 0 (child) & 1 (parent) */
{
unpin_entry(entry_type, 1);
- if(!pass) CACHE_ERROR("unpin_entry failed")
+ if (!pass)
+ CACHE_ERROR("unpin_entry failed")
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #7 - Simple multiple parents
- */
+ /* Test Case #7 - Simple multiple parents
+ */
/* Create flush dependency between entries (child) 0 and 1, 2 (parents)
*/
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[1] = entry_type;
- expected[0].flush_dep_par_idx[1] = 2;
- expected[0].flush_dep_npar = 2;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
- expected[2].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[1] = 2;
+ expected[0].flush_dep_npar = 2;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
+ expected[2].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries */
{
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 2;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = FALSE;
- expected[1].is_pinned = FALSE;
- expected[1].flush_dep_nchd = 0;
- expected[1].flush_dep_ndirty_chd = 0;
+ expected[0].flush_dep_par_idx[0] = 2;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = FALSE;
+ expected[1].is_pinned = FALSE;
+ expected[1].flush_dep_nchd = 0;
+ expected[1].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[0].flush_dep_npar = 0;
- expected[2].is_protected = FALSE;
- expected[2].is_pinned = FALSE;
- expected[2].flush_dep_nchd = 0;
+ expected[0].flush_dep_npar = 0;
+ expected[2].is_protected = FALSE;
+ expected[2].is_pinned = FALSE;
+ expected[2].flush_dep_nchd = 0;
expected[2].flush_dep_ndirty_chd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-
done:
- if(file_ptr)
+ if (file_ptr)
takedown_cache(file_ptr, FALSE, FALSE);
- if(pass)
+ if (pass)
PASSED();
else {
H5_FAILED();
@@ -30822,7 +29640,6 @@ done:
return (unsigned)!pass;
} /* check_flush_deps() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_deps_err()
*
@@ -30839,11 +29656,11 @@ done:
static unsigned
check_flush_deps_err(unsigned paged)
{
- H5F_t * file_ptr = NULL; /* File for this test */
- int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */
- unsigned test_count; /* Test iteration variable */
+ H5F_t * file_ptr = NULL; /* File for this test */
+ int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */
+ unsigned test_count; /* Test iteration variable */
- if(paged)
+ if (paged)
TESTING("flush dependency errors (paged aggregation)")
else
TESTING("flush dependency errors")
@@ -30853,172 +29670,216 @@ check_flush_deps_err(unsigned paged)
/* Loop over test cases, check for various errors in configuring flush
* dependencies. Verify that all performs as expected.
*/
- for(test_count = 0; test_count < 7; test_count++) {
- unsigned u; /* Local index variable */
- herr_t result; /* Generic return value */
+ for (test_count = 0; test_count < 7; test_count++) {
+ unsigned u; /* Local index variable */
+ herr_t result; /* Generic return value */
/* Allocate a cache */
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
- if(!pass) CACHE_ERROR("setup_cache failed")
+ if (!pass)
+ CACHE_ERROR("setup_cache failed")
/* Insert entries to work with into the cache */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
insert_entry(file_ptr, entry_type, (int32_t)u, H5C__NO_FLAGS_SET);
- if(!pass) CACHE_ERROR("insert_entry failed")
+ if (!pass)
+ CACHE_ERROR("insert_entry failed")
} /* end for */
/* Various test cases */
- switch(test_count) {
+ switch (test_count) {
/* Verify that parent entry in flush dependency must be protected */
case 0:
- result = H5C_create_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1]));
- if(result != FAIL) CACHE_ERROR("Creating flush dependency with unprotected entry succeeded")
+ result =
+ H5C_create_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1]));
+ if (result != FAIL)
+ CACHE_ERROR("Creating flush dependency with unprotected entry succeeded")
break;
/* Verify that entry can't have flush dependency on itself */
case 1:
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
- result = H5C_create_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[0]));
- if(result != FAIL) CACHE_ERROR("Creating flush dependency with parent == child")
+ result =
+ H5C_create_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[0]));
+ if (result != FAIL)
+ CACHE_ERROR("Creating flush dependency with parent == child")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
break;
/* Verify that parent entry must be protected */
case 2:
- result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1]));
- if(result != FAIL) CACHE_ERROR("Destroying [non-existant] dependency when parent isn't protected")
+ result =
+ H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1]));
+ if (result != FAIL)
+ CACHE_ERROR("Destroying [non-existant] dependency when parent isn't protected")
break;
/* Verify that parent entry has flush dependency */
case 3:
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
- result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1]));
- if(result != FAIL) CACHE_ERROR("Destroying dependency when parent isn't in relationship")
+ result =
+ H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1]));
+ if (result != FAIL)
+ CACHE_ERROR("Destroying dependency when parent isn't in relationship")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
break;
/* Verify that child entry is in flush dependency relationship */
case 4:
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
- result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[2]));
- if(result != FAIL) CACHE_ERROR("Destroying dependency when child isn't in relationship")
+ result =
+ H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[2]));
+ if (result != FAIL)
+ CACHE_ERROR("Destroying dependency when child isn't in relationship")
destroy_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
break;
/* Verify that parent has child as direct descendant */
case 5:
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 3);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 3, entry_type, 4);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
- result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[4]));
- if(result != FAIL) CACHE_ERROR("Destroying dependency when child is not a direct descendant has no children at child's height")
+ result =
+ H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[4]));
+ if (result != FAIL)
+ CACHE_ERROR("Destroying dependency when child is not a direct descendant has no children "
+ "at child's height")
destroy_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
destroy_flush_dependency(entry_type, 1, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
destroy_flush_dependency(entry_type, 3, entry_type, 4);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
3, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
break;
-
/* Verify that child entry is child of parent */
case 6:
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
- result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[3]));
- if(result != FAIL) CACHE_ERROR("Destroying dependency when child isn't in relationship")
+ result =
+ H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[3]));
+ if (result != FAIL)
+ CACHE_ERROR("Destroying dependency when child isn't in relationship")
destroy_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
destroy_flush_dependency(entry_type, 2, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
break;
default:
@@ -31026,16 +29887,16 @@ check_flush_deps_err(unsigned paged)
} /* end switch */
takedown_cache(file_ptr, FALSE, FALSE);
- if(!pass) CACHE_ERROR("takedown_cache failed")
+ if (!pass)
+ CACHE_ERROR("takedown_cache failed")
file_ptr = NULL;
} /* end for */
-
done:
- if(file_ptr)
+ if (file_ptr)
takedown_cache(file_ptr, FALSE, FALSE);
- if(pass)
+ if (pass)
PASSED();
else {
H5_FAILED();
@@ -31045,7 +29906,6 @@ done:
return (unsigned)!pass;
} /* check_flush_deps_err() */
-
/*-------------------------------------------------------------------------
* Function: check_flush_deps_order()
*
@@ -31071,11 +29931,11 @@ done:
static unsigned
check_flush_deps_order(unsigned paged)
{
- H5F_t * file_ptr = NULL; /* File for this test */
- H5C_t * cache_ptr = NULL; /* Metadata cache for this test */
- int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */
- unsigned u; /* Local index variable */
- unsigned flush_order; /* Index for tracking flush order */
+ H5F_t * file_ptr = NULL; /* File for this test */
+ H5C_t * cache_ptr = NULL; /* Metadata cache for this test */
+ int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */
+ unsigned u; /* Local index variable */
+ unsigned flush_order; /* Index for tracking flush order */
/* clang-format off */
struct expected_entry_status expected[5] =
{
@@ -31089,7 +29949,7 @@ check_flush_deps_order(unsigned paged)
};
/* clang-format on */
- if(paged)
+ if (paged)
TESTING("flush dependencies flush order (paged aggregation)")
else
TESTING("flush dependencies flush order")
@@ -31101,15 +29961,17 @@ check_flush_deps_order(unsigned paged)
*/
reset_entries();
- file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
cache_ptr = file_ptr->shared->cache;
- if(!pass) CACHE_ERROR("setup_cache failed")
+ if (!pass)
+ CACHE_ERROR("setup_cache failed")
/* Insert entries to work with into the cache */
- for(u = 0; u < 5; u++) {
+ for (u = 0; u < 5; u++) {
insert_entry(file_ptr, entry_type, (int32_t)u, H5C__NO_FLAGS_SET);
- if(!pass) CACHE_ERROR("insert_entry failed")
+ if (!pass)
+ CACHE_ERROR("insert_entry failed")
/* Change expected values, and verify the status of the entries
* after each insertion
@@ -31118,903 +29980,966 @@ check_flush_deps_order(unsigned paged)
expected[u].is_dirty = TRUE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)u, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)u, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
} /* end for */
-/* Test Case #1a - Single flush dependency relationship, increasing addr order */
+ /* Test Case #1a - Single flush dependency relationship, increasing addr order */
/* Create flush dependency between entries 0 (child) & 1 (parent) */
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
- expected[1].flush_dep_ndirty_chd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
+ expected[1].flush_dep_ndirty_chd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 0;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 1;
- expected[1].is_protected = FALSE;
- expected[1].flush_dep_ndirty_chd =0;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[4].is_dirty = FALSE;
- expected[4].serialized = TRUE;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 0;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 1;
+ expected[1].is_protected = FALSE;
+ expected[1].flush_dep_ndirty_chd = 0;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[4].is_dirty = FALSE;
+ expected[4].serialized = TRUE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries 0 (child) & 1 (parent) */
{
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].flush_dep_npar = 0;
- expected[1].is_pinned = FALSE;
+ expected[1].is_pinned = FALSE;
expected[1].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #1b - Single flush dependency relationship, decreasing addr order */
+ /* Test Case #1b - Single flush dependency relationship, decreasing addr order */
/* Create flush dependency between entries 0 (child) & 1 (parent) */
{
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
- expected[0].is_protected = TRUE;
- expected[0].is_pinned = TRUE;
- expected[0].flush_dep_nchd = 1;
+ expected[0].is_protected = TRUE;
+ expected[0].is_pinned = TRUE;
+ expected[0].flush_dep_nchd = 1;
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 0;
- expected[1].flush_dep_npar = 1;
+ expected[1].flush_dep_par_idx[0] = 0;
+ expected[1].flush_dep_npar = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0 & 1 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, TRUE);
dirty_entry(file_ptr, entry_type, 1, FALSE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 1;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 1;
expected[0].is_protected = FALSE;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 0;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries 0 (child) & 1 (parent) */
{
destroy_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_pinned = FALSE;
+ expected[0].is_pinned = FALSE;
expected[0].flush_dep_nchd = 0;
expected[1].flush_dep_npar = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #2a - Multiple children for one parent flush dependency relationship
- * increasing addr order
- */
+ /* Test Case #2a - Multiple children for one parent flush dependency relationship
+ * increasing addr order
+ */
/* Create flush dependency between entries 0, 1 (children) & 2 (parent) */
{
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 2;
- expected[0].flush_dep_npar = 1;
+ expected[0].flush_dep_par_idx[0] = 2;
+ expected[0].flush_dep_npar = 1;
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 2;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0, 1 & 2 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, FALSE);
dirty_entry(file_ptr, entry_type, 1, FALSE);
dirty_entry(file_ptr, entry_type, 2, TRUE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 0;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 1;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 2;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 0;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 1;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 2;
expected[2].is_protected = FALSE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries 0, 1 (children) & 2 (parent) */
{
destroy_flush_dependency(entry_type, 2, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].flush_dep_npar = 0;
expected[1].flush_dep_npar = 0;
- expected[2].is_pinned = FALSE;
+ expected[2].is_pinned = FALSE;
expected[2].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #2b - Multiple children for one parent flush dependency relationship
- * decreasing addr order
- */
+ /* Test Case #2b - Multiple children for one parent flush dependency relationship
+ * decreasing addr order
+ */
/* Create flush dependency between entries 1, 2 (children) & 0 (parent) */
{
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
create_flush_dependency(entry_type, 0, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
- expected[0].is_protected = TRUE;
- expected[0].is_pinned = TRUE;
- expected[0].flush_dep_nchd = 2;
+ expected[0].is_protected = TRUE;
+ expected[0].is_pinned = TRUE;
+ expected[0].flush_dep_nchd = 2;
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 0;
- expected[1].flush_dep_npar = 1;
+ expected[1].flush_dep_par_idx[0] = 0;
+ expected[1].flush_dep_npar = 1;
expected[2].flush_dep_par_type[0] = entry_type;
- expected[2].flush_dep_par_idx[0] = 0;
- expected[2].flush_dep_npar = 1;
+ expected[2].flush_dep_par_idx[0] = 0;
+ expected[2].flush_dep_npar = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0, 1 & 2 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, TRUE);
dirty_entry(file_ptr, entry_type, 1, FALSE);
dirty_entry(file_ptr, entry_type, 2, FALSE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 2;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 2;
expected[0].is_protected = FALSE;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 0;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 1;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 0;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries 1, 2 (children) & 0 (parent) */
{
destroy_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
destroy_flush_dependency(entry_type, 0, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_pinned = FALSE;
+ expected[0].is_pinned = FALSE;
expected[0].flush_dep_nchd = 0;
expected[1].flush_dep_npar = 0;
expected[2].flush_dep_npar = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #3a - Single chain of flush dependencies, 4 entries tall,
- * increasing addr order
- */
+ /* Test Case #3a - Single chain of flush dependencies, 4 entries tall,
+ * increasing addr order
+ */
/* Create flush dependency between entries (child) 0->1->2->3 (parent) */
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 3);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type[0] = entry_type;
- expected[2].flush_dep_par_idx[0] = 3;
- expected[2].flush_dep_npar = 1;
- expected[3].is_protected = TRUE;
- expected[3].is_pinned = TRUE;
- expected[3].flush_dep_nchd = 1;
+ expected[2].flush_dep_par_idx[0] = 3;
+ expected[2].flush_dep_npar = 1;
+ expected[3].is_protected = TRUE;
+ expected[3].is_pinned = TRUE;
+ expected[3].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 3, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
3, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0-3 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, FALSE);
dirty_entry(file_ptr, entry_type, 1, TRUE);
dirty_entry(file_ptr, entry_type, 2, TRUE);
dirty_entry(file_ptr, entry_type, 3, TRUE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
- expected[3].serialized = FALSE;
+ expected[3].serialized = FALSE;
expected[3].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 0;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 1;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 0;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 1;
expected[1].is_protected = FALSE;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 2;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 2;
expected[2].is_protected = FALSE;
- expected[3].serialized = TRUE;
- expected[3].flush_order = 3;
+ expected[3].serialized = TRUE;
+ expected[3].flush_order = 3;
expected[3].is_protected = FALSE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, from the "top down" */
{
destroy_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[2].flush_dep_npar = 0;
- expected[3].is_pinned = FALSE;
+ expected[3].is_pinned = FALSE;
expected[3].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_npar = 0;
- expected[2].is_pinned = FALSE;
+ expected[2].is_pinned = FALSE;
expected[2].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_npar = 0;
- expected[1].is_pinned = FALSE;
+ expected[1].is_pinned = FALSE;
expected[1].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #3b - Single chain of flush dependencies, 4 entries tall
- * decreasing addr order
- */
+ /* Test Case #3b - Single chain of flush dependencies, 4 entries tall
+ * decreasing addr order
+ */
/* Create flush dependency between entries (child) 0->1->2->3 (parent) */
{
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
- expected[0].is_protected = TRUE;
- expected[0].is_pinned = TRUE;
- expected[0].flush_dep_nchd = 1;
+ expected[0].is_protected = TRUE;
+ expected[0].is_pinned = TRUE;
+ expected[0].flush_dep_nchd = 1;
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 0;
- expected[1].flush_dep_npar = 1;
+ expected[1].flush_dep_par_idx[0] = 0;
+ expected[1].flush_dep_npar = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
expected[2].flush_dep_par_type[0] = entry_type;
- expected[2].flush_dep_par_idx[0] = 1;
- expected[2].flush_dep_npar = 1;
+ expected[2].flush_dep_par_idx[0] = 1;
+ expected[2].flush_dep_npar = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
expected[3].flush_dep_par_type[0] = entry_type;
- expected[3].flush_dep_par_idx[0] = 2;
- expected[3].flush_dep_npar = 1;
+ expected[3].flush_dep_par_idx[0] = 2;
+ expected[3].flush_dep_npar = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 3, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0-3 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, TRUE);
dirty_entry(file_ptr, entry_type, 1, TRUE);
dirty_entry(file_ptr, entry_type, 2, TRUE);
dirty_entry(file_ptr, entry_type, 3, FALSE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
- expected[3].serialized = FALSE;
+ expected[3].serialized = FALSE;
expected[3].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 3;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 3;
expected[0].is_protected = FALSE;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 2;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 2;
expected[1].is_protected = FALSE;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 1;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 1;
expected[2].is_protected = FALSE;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[3].flush_order = 0;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[3].flush_order = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, from the "bottom up" */
{
destroy_flush_dependency(entry_type, 2, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[2].is_pinned = FALSE;
+ expected[2].is_pinned = FALSE;
expected[2].flush_dep_nchd = 0;
expected[3].flush_dep_npar = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[1].is_pinned = FALSE;
+ expected[1].is_pinned = FALSE;
expected[1].flush_dep_nchd = 0;
expected[2].flush_dep_npar = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
- expected[0].is_pinned = FALSE;
+ expected[0].is_pinned = FALSE;
expected[0].flush_dep_nchd = 0;
expected[1].flush_dep_npar = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #4a - Multiple children for a single parent, increasing addr order */
+ /* Test Case #4a - Multiple children for a single parent, increasing addr order */
/* Create flush dependency between entries (child) 0,1,2,3->4 (parent) */
{
protect_entry(file_ptr, entry_type, 4);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
- for(u = 0; u < 4; u++) {
+ for (u = 0; u < 4; u++) {
create_flush_dependency(entry_type, 4, entry_type, (int32_t)u);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[u].flush_dep_par_type[0] = entry_type;
- expected[u].flush_dep_par_idx[0] = 4;
- expected[u].flush_dep_npar = 1;
- expected[4].is_protected = TRUE;
- expected[4].is_pinned = TRUE;
- expected[4].flush_dep_nchd = u + 1;
+ expected[u].flush_dep_par_idx[0] = 4;
+ expected[u].flush_dep_npar = 1;
+ expected[4].is_protected = TRUE;
+ expected[4].is_pinned = TRUE;
+ expected[4].flush_dep_nchd = u + 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
} /* end for */
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 3, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 4, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
4, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0-4 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, FALSE);
@@ -32022,59 +30947,63 @@ check_flush_deps_order(unsigned paged)
dirty_entry(file_ptr, entry_type, 2, FALSE);
dirty_entry(file_ptr, entry_type, 3, FALSE);
dirty_entry(file_ptr, entry_type, 4, TRUE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
- expected[3].serialized = FALSE;
+ expected[3].serialized = FALSE;
expected[3].flush_order = -1;
- expected[4].serialized = FALSE;
+ expected[4].serialized = FALSE;
expected[4].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 0;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 1;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 2;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[3].flush_order = 3;
- expected[4].is_dirty = FALSE;
- expected[4].serialized = TRUE;
- expected[4].flush_order = 4;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 0;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 1;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 2;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[3].flush_order = 3;
+ expected[4].is_dirty = FALSE;
+ expected[4].serialized = TRUE;
+ expected[4].flush_order = 4;
expected[4].is_protected = FALSE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries */
{
- for(u = 0; u < 4; u++) {
+ for (u = 0; u < 4; u++) {
destroy_flush_dependency(entry_type, 4, entry_type, (int32_t)u);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -32083,7 +31012,7 @@ check_flush_deps_order(unsigned paged)
expected[4].flush_dep_nchd = 3 - u;
/* Check for destroying flush dependency on last entry */
- if(3 == u) {
+ if (3 == u) {
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
@@ -32091,62 +31020,62 @@ check_flush_deps_order(unsigned paged)
} /* end if */
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
} /* end for */
}
-/* Test Case #4b - Multiple children for a single parent, decreasing addr order */
+ /* Test Case #4b - Multiple children for a single parent, decreasing addr order */
/* Create flush dependency between entries (child) 0,1,2,3->4 (parent) */
{
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
- for(u = 1; u < 5; u++) {
+ for (u = 1; u < 5; u++) {
create_flush_dependency(entry_type, 0, entry_type, (int32_t)u);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[u].flush_dep_par_type[0] = entry_type;
- expected[u].flush_dep_par_idx[0] = 0;
- expected[u].flush_dep_npar = 1;
- expected[0].is_protected = TRUE;
- expected[0].is_pinned = TRUE;
- expected[0].flush_dep_nchd = u;
+ expected[u].flush_dep_par_idx[0] = 0;
+ expected[u].flush_dep_npar = 1;
+ expected[0].is_protected = TRUE;
+ expected[0].is_pinned = TRUE;
+ expected[0].flush_dep_nchd = u;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
} /* end for */
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 3, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 4, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0-4 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, TRUE);
@@ -32154,59 +31083,63 @@ check_flush_deps_order(unsigned paged)
dirty_entry(file_ptr, entry_type, 2, FALSE);
dirty_entry(file_ptr, entry_type, 3, FALSE);
dirty_entry(file_ptr, entry_type, 4, FALSE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
- expected[3].serialized = FALSE;
+ expected[3].serialized = FALSE;
expected[3].flush_order = -1;
- expected[4].serialized = FALSE;
+ expected[4].serialized = FALSE;
expected[4].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 4;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 4;
expected[0].is_protected = FALSE;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 0;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 1;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[3].flush_order = 2;
- expected[4].is_dirty = FALSE;
- expected[4].serialized = TRUE;
- expected[4].flush_order = 3;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 0;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 1;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[3].flush_order = 2;
+ expected[4].is_dirty = FALSE;
+ expected[4].serialized = TRUE;
+ expected[4].flush_order = 3;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries */
{
- for(u = 1; u < 5; u++) {
+ for (u = 1; u < 5; u++) {
destroy_flush_dependency(entry_type, 0, entry_type, (int32_t)u);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -32215,7 +31148,7 @@ check_flush_deps_order(unsigned paged)
expected[0].flush_dep_nchd = 4 - u;
/* Check for destroying flush dependency on last entry */
- if(4 == u) {
+ if (4 == u) {
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
@@ -32223,358 +31156,383 @@ check_flush_deps_order(unsigned paged)
} /* end if */
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
} /* end for */
}
-/* Test Case #5a - Join two flush dependency chains together, creating a single
- * un-forked dependency chain
- */
+ /* Test Case #5a - Join two flush dependency chains together, creating a single
+ * un-forked dependency chain
+ */
/* Create flush dependency between entries (child) 0->1 and 3->4 (parent)
* then add entry 4 as a child of 0
*/
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 4);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type[0] = entry_type;
- expected[3].flush_dep_par_idx[0] = 4;
- expected[3].flush_dep_npar = 1;
- expected[4].is_protected = TRUE;
- expected[4].is_pinned = TRUE;
- expected[4].flush_dep_nchd = 1;
+ expected[3].flush_dep_par_idx[0] = 4;
+ expected[3].flush_dep_npar = 1;
+ expected[4].is_protected = TRUE;
+ expected[4].is_pinned = TRUE;
+ expected[4].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 0, entry_type, 4);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type[0] = entry_type;
- expected[4].flush_dep_par_idx[0] = 0;
- expected[4].flush_dep_npar = 1;
- expected[0].is_protected = TRUE;
- expected[0].is_pinned = TRUE;
- expected[0].flush_dep_nchd = 1;
+ expected[4].flush_dep_par_idx[0] = 0;
+ expected[4].flush_dep_npar = 1;
+ expected[0].is_protected = TRUE;
+ expected[0].is_pinned = TRUE;
+ expected[0].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
-
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 3, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 4, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
4, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0 & 1, 3 & 4 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, TRUE);
dirty_entry(file_ptr, entry_type, 1, TRUE);
dirty_entry(file_ptr, entry_type, 3, FALSE);
dirty_entry(file_ptr, entry_type, 4, TRUE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
- expected[3].serialized = FALSE;
+ expected[3].serialized = FALSE;
expected[3].flush_order = -1;
- expected[4].serialized = FALSE;
+ expected[4].serialized = FALSE;
expected[4].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 2;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 2;
expected[0].is_protected = FALSE;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 3;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 3;
expected[1].is_protected = FALSE;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[3].flush_order = 0;
- expected[4].is_dirty = FALSE;
- expected[4].serialized = TRUE;
- expected[4].flush_order = 1;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[3].flush_order = 0;
+ expected[4].is_dirty = FALSE;
+ expected[4].serialized = TRUE;
+ expected[4].flush_order = 1;
expected[4].is_protected = FALSE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, detaching 3->4 from 0 first */
{
destroy_flush_dependency(entry_type, 0, entry_type, 4);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].flush_dep_npar = 0;
- expected[0].is_pinned = FALSE;
+ expected[0].is_pinned = FALSE;
expected[0].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_npar = 0;
- expected[4].is_pinned = FALSE;
+ expected[4].is_pinned = FALSE;
expected[4].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_npar = 0;
- expected[1].is_pinned = FALSE;
+ expected[1].is_pinned = FALSE;
expected[1].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #5b - Join two flush dependency chains together, creating a
- * forked dependency chain
- */
+ /* Test Case #5b - Join two flush dependency chains together, creating a
+ * forked dependency chain
+ */
/* Create flush dependency between entries (child) 0->1->2 and 3->4 (parent)
* then add entry 4 as a child of 1
*/
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 4);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type[0] = entry_type;
- expected[3].flush_dep_par_idx[0] = 4;
- expected[3].flush_dep_npar = 1;
- expected[4].is_protected = TRUE;
- expected[4].is_pinned = TRUE;
- expected[4].flush_dep_nchd = 1;
+ expected[3].flush_dep_par_idx[0] = 4;
+ expected[3].flush_dep_npar = 1;
+ expected[4].is_protected = TRUE;
+ expected[4].is_pinned = TRUE;
+ expected[4].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 1, entry_type, 4);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type[0] = entry_type;
- expected[4].flush_dep_par_idx[0] = 1;
- expected[4].flush_dep_npar = 1;
- expected[1].flush_dep_nchd = 2;
+ expected[4].flush_dep_par_idx[0] = 1;
+ expected[4].flush_dep_npar = 1;
+ expected[1].flush_dep_nchd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
-
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 3, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 4, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
4, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0-4 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, FALSE);
@@ -32582,61 +31540,65 @@ check_flush_deps_order(unsigned paged)
dirty_entry(file_ptr, entry_type, 2, TRUE);
dirty_entry(file_ptr, entry_type, 3, FALSE);
dirty_entry(file_ptr, entry_type, 4, TRUE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
- expected[3].serialized = FALSE;
+ expected[3].serialized = FALSE;
expected[3].flush_order = -1;
- expected[4].serialized = FALSE;
+ expected[4].serialized = FALSE;
expected[4].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 0;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 0;
expected[0].is_protected = FALSE;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 3;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 3;
expected[1].is_protected = FALSE;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 4;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 4;
expected[2].is_protected = FALSE;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[3].flush_order = 1;
- expected[4].is_dirty = FALSE;
- expected[4].serialized = TRUE;
- expected[4].flush_order = 2;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[3].flush_order = 1;
+ expected[4].is_dirty = FALSE;
+ expected[4].serialized = TRUE;
+ expected[4].flush_order = 2;
expected[4].is_protected = FALSE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, detaching 3->4 from 1 first */
{
destroy_flush_dependency(entry_type, 1, entry_type, 4);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -32645,191 +31607,206 @@ check_flush_deps_order(unsigned paged)
expected[1].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_npar = 0;
- expected[4].is_pinned = FALSE;
+ expected[4].is_pinned = FALSE;
expected[4].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_npar = 0;
- expected[2].is_pinned = FALSE;
+ expected[2].is_pinned = FALSE;
expected[2].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_npar = 0;
- expected[1].is_pinned = FALSE;
+ expected[1].is_pinned = FALSE;
expected[1].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #5c - Join two flush dependency chains together, creating a
- * forked dependency chain
- */
+ /* Test Case #5c - Join two flush dependency chains together, creating a
+ * forked dependency chain
+ */
/* Create flush dependency between entries (child) 0->1->2 and 3->4 (parent)
* then add entry 4 as a child of 2
*/
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 4);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type[0] = entry_type;
- expected[3].flush_dep_par_idx[0] = 4;
- expected[3].flush_dep_npar = 1;
- expected[4].is_protected = TRUE;
- expected[4].is_pinned = TRUE;
- expected[4].flush_dep_nchd = 1;
+ expected[3].flush_dep_par_idx[0] = 4;
+ expected[3].flush_dep_npar = 1;
+ expected[4].is_protected = TRUE;
+ expected[4].is_pinned = TRUE;
+ expected[4].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 2, entry_type, 4);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type[0] = entry_type;
- expected[4].flush_dep_par_idx[0] = 2;
- expected[4].flush_dep_npar = 1;
- expected[2].flush_dep_nchd = 2;
+ expected[4].flush_dep_par_idx[0] = 2;
+ expected[4].flush_dep_npar = 1;
+ expected[2].flush_dep_nchd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
-
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 3, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 4, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 4, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
4, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0-4 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, FALSE);
@@ -32837,61 +31814,65 @@ check_flush_deps_order(unsigned paged)
dirty_entry(file_ptr, entry_type, 2, TRUE);
dirty_entry(file_ptr, entry_type, 3, FALSE);
dirty_entry(file_ptr, entry_type, 4, TRUE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'serialized' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
- expected[3].serialized = FALSE;
+ expected[3].serialized = FALSE;
expected[3].flush_order = -1;
- expected[4].serialized = FALSE;
+ expected[4].serialized = FALSE;
expected[4].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 0;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 0;
expected[0].is_protected = FALSE;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 1;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 1;
expected[1].is_protected = FALSE;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 4;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 4;
expected[2].is_protected = FALSE;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[3].flush_order = 2;
- expected[4].is_dirty = FALSE;
- expected[4].serialized = TRUE;
- expected[4].flush_order = 3;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[3].flush_order = 2;
+ expected[4].is_dirty = FALSE;
+ expected[4].serialized = TRUE;
+ expected[4].flush_order = 3;
expected[4].is_protected = FALSE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, detaching 3->4 from 2 first */
{
destroy_flush_dependency(entry_type, 2, entry_type, 4);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -32900,280 +31881,304 @@ check_flush_deps_order(unsigned paged)
expected[2].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 4, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_npar = 0;
- expected[4].is_pinned = FALSE;
+ expected[4].is_pinned = FALSE;
expected[4].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_npar = 0;
- expected[2].is_pinned = FALSE;
+ expected[2].is_pinned = FALSE;
expected[2].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_npar = 0;
- expected[1].is_pinned = FALSE;
+ expected[1].is_pinned = FALSE;
expected[1].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #6a - Interlocked multiple parents, increasing addr order
- */
+ /* Test Case #6a - Interlocked multiple parents, increasing addr order
+ */
/* Create flush dependencies between entries 0-3, with each entry a child
* of every entry with a higher number.
*/
{
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[0] = entry_type;
- expected[0].flush_dep_par_idx[0] = 1;
- expected[0].flush_dep_npar = 1;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
+ expected[0].flush_dep_par_idx[0] = 1;
+ expected[0].flush_dep_npar = 1;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[1] = entry_type;
- expected[0].flush_dep_par_idx[1] = 2;
- expected[0].flush_dep_npar = 2;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
+ expected[0].flush_dep_par_idx[1] = 2;
+ expected[0].flush_dep_npar = 2;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 2;
- expected[1].flush_dep_npar = 1;
- expected[2].flush_dep_nchd = 2;
+ expected[1].flush_dep_par_idx[0] = 2;
+ expected[1].flush_dep_npar = 1;
+ expected[2].flush_dep_nchd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 3);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 3, entry_type, 0);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type[2] = entry_type;
- expected[0].flush_dep_par_idx[2] = 3;
- expected[0].flush_dep_npar = 3;
- expected[3].is_protected = TRUE;
- expected[3].is_pinned = TRUE;
- expected[3].flush_dep_nchd = 1;
+ expected[0].flush_dep_par_idx[2] = 3;
+ expected[0].flush_dep_npar = 3;
+ expected[3].is_protected = TRUE;
+ expected[3].is_pinned = TRUE;
+ expected[3].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 3, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[1] = entry_type;
- expected[1].flush_dep_par_idx[1] = 3;
- expected[1].flush_dep_npar = 2;
- expected[3].flush_dep_nchd = 2;
+ expected[1].flush_dep_par_idx[1] = 3;
+ expected[1].flush_dep_npar = 2;
+ expected[3].flush_dep_nchd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type[0] = entry_type;
- expected[2].flush_dep_par_idx[0] = 3;
- expected[2].flush_dep_npar = 1;
- expected[3].flush_dep_nchd = 3;
+ expected[2].flush_dep_par_idx[0] = 3;
+ expected[2].flush_dep_npar = 1;
+ expected[3].flush_dep_nchd = 3;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
-
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 3, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
3, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0-3 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, FALSE);
dirty_entry(file_ptr, entry_type, 1, TRUE);
dirty_entry(file_ptr, entry_type, 2, TRUE);
dirty_entry(file_ptr, entry_type, 3, FALSE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'flushed' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
- expected[3].serialized = FALSE;
+ expected[3].serialized = FALSE;
expected[3].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 0;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 0;
expected[0].is_protected = FALSE;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 1;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 1;
expected[1].is_protected = FALSE;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 2;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 2;
expected[2].is_protected = FALSE;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[3].flush_order = 3;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[3].flush_order = 3;
expected[3].is_protected = FALSE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, in reverse order */
{
destroy_flush_dependency(entry_type, 3, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -33182,14 +32187,16 @@ check_flush_deps_order(unsigned paged)
expected[3].flush_dep_nchd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 3, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -33198,31 +32205,35 @@ check_flush_deps_order(unsigned paged)
expected[3].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 3, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_npar = 2;
- expected[3].is_pinned = FALSE;
+ expected[3].is_pinned = FALSE;
expected[3].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -33231,263 +32242,285 @@ check_flush_deps_order(unsigned paged)
expected[2].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_npar = 1;
- expected[2].is_pinned = FALSE;
+ expected[2].is_pinned = FALSE;
expected[2].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 0);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_npar = 0;
- expected[1].is_pinned = FALSE;
+ expected[1].is_pinned = FALSE;
expected[1].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-/* Test Case #6b - Interlocked multiple parents, decreasing addr order
- */
+ /* Test Case #6b - Interlocked multiple parents, decreasing addr order
+ */
/* Create flush dependencies between entries 0-3, with each entry a parent
* of every entry with a higher number.
*/
{
protect_entry(file_ptr, entry_type, 2);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 2, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type[0] = entry_type;
- expected[3].flush_dep_par_idx[0] = 2;
- expected[3].flush_dep_npar = 1;
- expected[2].is_protected = TRUE;
- expected[2].is_pinned = TRUE;
- expected[2].flush_dep_nchd = 1;
+ expected[3].flush_dep_par_idx[0] = 2;
+ expected[3].flush_dep_npar = 1;
+ expected[2].is_protected = TRUE;
+ expected[2].is_pinned = TRUE;
+ expected[2].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 1);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type[1] = entry_type;
- expected[3].flush_dep_par_idx[1] = 1;
- expected[3].flush_dep_npar = 2;
- expected[1].is_protected = TRUE;
- expected[1].is_pinned = TRUE;
- expected[1].flush_dep_nchd = 1;
+ expected[3].flush_dep_par_idx[1] = 1;
+ expected[3].flush_dep_npar = 2;
+ expected[1].is_protected = TRUE;
+ expected[1].is_pinned = TRUE;
+ expected[1].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 1, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type[0] = entry_type;
- expected[2].flush_dep_par_idx[0] = 1;
- expected[2].flush_dep_npar = 1;
- expected[1].flush_dep_nchd = 2;
+ expected[2].flush_dep_par_idx[0] = 1;
+ expected[2].flush_dep_npar = 1;
+ expected[1].flush_dep_nchd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
protect_entry(file_ptr, entry_type, 0);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
create_flush_dependency(entry_type, 0, entry_type, 3);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type[2] = entry_type;
- expected[3].flush_dep_par_idx[2] = 0;
- expected[3].flush_dep_npar = 3;
- expected[0].is_protected = TRUE;
- expected[0].is_pinned = TRUE;
- expected[0].flush_dep_nchd = 1;
+ expected[3].flush_dep_par_idx[2] = 0;
+ expected[3].flush_dep_npar = 3;
+ expected[0].is_protected = TRUE;
+ expected[0].is_pinned = TRUE;
+ expected[0].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 0, entry_type, 2);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type[1] = entry_type;
- expected[2].flush_dep_par_idx[1] = 0;
- expected[2].flush_dep_npar = 2;
- expected[0].flush_dep_nchd = 2;
+ expected[2].flush_dep_par_idx[1] = 0;
+ expected[2].flush_dep_npar = 2;
+ expected[0].flush_dep_nchd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
create_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("create_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("create_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type[0] = entry_type;
- expected[1].flush_dep_par_idx[0] = 0;
- expected[1].flush_dep_npar = 1;
- expected[0].flush_dep_nchd = 3;
+ expected[1].flush_dep_par_idx[0] = 0;
+ expected[1].flush_dep_npar = 1;
+ expected[0].flush_dep_nchd = 3;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
-
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Flush the cache and verify that the entries were flushed in correct order */
{
- add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 2, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
- add_flush_op(entry_type, 3, FLUSH_OP__ORDER,
- entry_type, 0, FALSE, (size_t)0, &flush_order);
-
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 1, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 2, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+ add_flush_op(entry_type, 3, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order);
+
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
0, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
1, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
2, /* int32_t idx */
H5C__NO_FLAGS_SET); /* unsigned int flags */
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Mark entries 0-3 dirty, so they are flushed */
dirty_entry(file_ptr, entry_type, 0, FALSE);
dirty_entry(file_ptr, entry_type, 1, TRUE);
dirty_entry(file_ptr, entry_type, 2, TRUE);
dirty_entry(file_ptr, entry_type, 3, FALSE);
- if(!pass) CACHE_ERROR("dirty_entry failed")
+ if (!pass)
+ CACHE_ERROR("dirty_entry failed")
/* Reset 'flushed' flag & 'flush_order' value in expected array */
- expected[0].serialized = FALSE;
+ expected[0].serialized = FALSE;
expected[0].flush_order = -1;
- expected[1].serialized = FALSE;
+ expected[1].serialized = FALSE;
expected[1].flush_order = -1;
- expected[2].serialized = FALSE;
+ expected[2].serialized = FALSE;
expected[2].flush_order = -1;
- expected[3].serialized = FALSE;
+ expected[3].serialized = FALSE;
expected[3].flush_order = -1;
/* Reset index for tracking flush order */
flush_order = 0;
H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
- if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
+ if (!pass)
+ CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
- expected[0].flush_order = 3;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
+ expected[0].flush_order = 3;
expected[0].is_protected = FALSE;
- expected[1].is_dirty = FALSE;
- expected[1].serialized = TRUE;
- expected[1].flush_order = 2;
+ expected[1].is_dirty = FALSE;
+ expected[1].serialized = TRUE;
+ expected[1].flush_order = 2;
expected[1].is_protected = FALSE;
- expected[2].is_dirty = FALSE;
- expected[2].serialized = TRUE;
- expected[2].flush_order = 1;
+ expected[2].is_dirty = FALSE;
+ expected[2].serialized = TRUE;
+ expected[2].flush_order = 1;
expected[2].is_protected = FALSE;
- expected[3].is_dirty = FALSE;
- expected[3].serialized = TRUE;
- expected[3].flush_order = 0;
+ expected[3].is_dirty = FALSE;
+ expected[3].serialized = TRUE;
+ expected[3].flush_order = 0;
expected[3].is_protected = FALSE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
/* Destroy flush dependency between entries, in reverse order */
{
destroy_flush_dependency(entry_type, 0, entry_type, 1);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -33496,14 +32529,16 @@ check_flush_deps_order(unsigned paged)
expected[0].flush_dep_nchd = 2;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 0, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -33512,31 +32547,35 @@ check_flush_deps_order(unsigned paged)
expected[0].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 0, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_npar = 2;
- expected[0].is_pinned = FALSE;
+ expected[0].is_pinned = FALSE;
expected[0].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 2);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
@@ -33545,53 +32584,57 @@ check_flush_deps_order(unsigned paged)
expected[1].flush_dep_nchd = 1;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 1, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_npar = 1;
- expected[1].is_pinned = FALSE;
+ expected[1].is_pinned = FALSE;
expected[1].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
destroy_flush_dependency(entry_type, 2, entry_type, 3);
- if(!pass) CACHE_ERROR("destroy_flush_dependency failed")
+ if (!pass)
+ CACHE_ERROR("destroy_flush_dependency failed")
/* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_npar = 0;
- expected[2].is_pinned = FALSE;
+ expected[2].is_pinned = FALSE;
expected[2].flush_dep_nchd = 0;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)0, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)0, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
}
-
done:
- if(file_ptr)
+ if (file_ptr)
takedown_cache(file_ptr, FALSE, FALSE);
- if(pass)
+ if (pass)
PASSED();
else {
H5_FAILED();
@@ -33601,7 +32644,6 @@ done:
return (unsigned)!pass;
} /* check_flush_deps_order() */
-
/*-------------------------------------------------------------------------
* Function: check_notify_cb()
*
@@ -33618,11 +32660,11 @@ done:
static unsigned
check_notify_cb(unsigned paged)
{
- H5F_t * file_ptr = NULL; /* File for this test */
- H5C_t * cache_ptr = NULL; /* Metadata cache for this test */
+ H5F_t * file_ptr = NULL; /* File for this test */
+ H5C_t * cache_ptr = NULL; /* Metadata cache for this test */
test_entry_t *base_addr; /* Base address of entries for test */
- test_entry_t * entry_ptr; /* Cache entry to examine/manipulate */
- int entry_type = NOTIFY_ENTRY_TYPE; /* Use entry w/notify callback (size of entries doesn't matter) */
+ test_entry_t *entry_ptr; /* Cache entry to examine/manipulate */
+ int entry_type = NOTIFY_ENTRY_TYPE; /* Use entry w/notify callback (size of entries doesn't matter) */
unsigned u; /* Local index variable */
/* clang-format off */
struct expected_entry_status expected[5] =
@@ -33637,7 +32679,7 @@ check_notify_cb(unsigned paged)
};
/* clang-format on */
- if(paged)
+ if (paged)
TESTING("'notify' callback (paged)")
else
TESTING("'notify' callback")
@@ -33650,16 +32692,19 @@ check_notify_cb(unsigned paged)
reset_entries();
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
- if(!file_ptr) CACHE_ERROR("setup_cache returned NULL")
+ if (!file_ptr)
+ CACHE_ERROR("setup_cache returned NULL")
cache_ptr = file_ptr->shared->cache;
base_addr = entries[entry_type];
- if(!pass) CACHE_ERROR("setup_cache failed")
+ if (!pass)
+ CACHE_ERROR("setup_cache failed")
/* Insert entries to work with into the cache */
- for(u = 0; u < 5; u++) {
+ for (u = 0; u < 5; u++) {
insert_entry(file_ptr, entry_type, (int32_t)u, H5C__NO_FLAGS_SET);
- if(!pass) CACHE_ERROR("insert_entry failed")
+ if (!pass)
+ CACHE_ERROR("insert_entry failed")
/* Change expected values, and verify the status of the entries
* after each insertion
@@ -33668,135 +32713,144 @@ check_notify_cb(unsigned paged)
expected[u].is_dirty = TRUE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)u, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)u, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
/* Check the entry's 'after insert' count */
- entry_ptr = &(base_addr[u]);
- if(1 != entry_ptr->notify_after_insert_count)
+ entry_ptr = &(base_addr[u]);
+ if (1 != entry_ptr->notify_after_insert_count)
CACHE_ERROR("invalid notify after insert count")
- if(0 != entry_ptr->notify_before_evict_count)
+ if (0 != entry_ptr->notify_before_evict_count)
CACHE_ERROR("invalid notify before evict count")
} /* end for */
/* Remove entries from the cache */
- for(u = 0; u < 5; u++) {
+ for (u = 0; u < 5; u++) {
expunge_entry(file_ptr, entry_type, (int32_t)u);
- if(!pass) CACHE_ERROR("expunge_entry failed")
+ if (!pass)
+ CACHE_ERROR("expunge_entry failed")
/* Change expected values, and verify the status of the entries
* after each expunge
*/
- expected[u].in_cache = FALSE;
- expected[u].is_dirty = TRUE;
+ expected[u].in_cache = FALSE;
+ expected[u].is_dirty = TRUE;
expected[u].serialized = FALSE;
- expected[u].destroyed = TRUE;
+ expected[u].destroyed = TRUE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)u, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)u, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
/* Check the entry's 'before evict' count */
- entry_ptr = &(base_addr[u]);
- if(1 != entry_ptr->notify_after_insert_count)
+ entry_ptr = &(base_addr[u]);
+ if (1 != entry_ptr->notify_after_insert_count)
CACHE_ERROR("invalid notify after insert count")
- if(1 != entry_ptr->notify_before_evict_count)
+ if (1 != entry_ptr->notify_before_evict_count)
CACHE_ERROR("invalid notify before evict count")
} /* end for */
/* Protect entries to bring them into the cache */
- for(u = 0; u < 5; u++) {
+ for (u = 0; u < 5; u++) {
protect_entry(file_ptr, entry_type, (int32_t)u);
- if(!pass) CACHE_ERROR("protect_entry failed")
+ if (!pass)
+ CACHE_ERROR("protect_entry failed")
/* Change expected values, and verify the status of the entries
* after each insertion
*/
- expected[u].in_cache = TRUE;
- expected[u].is_dirty = FALSE;
+ expected[u].in_cache = TRUE;
+ expected[u].is_dirty = FALSE;
expected[u].is_protected = TRUE;
expected[u].deserialized = TRUE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)u, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)u, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
/* Check the entry's 'after insert' count */
- entry_ptr = &(base_addr[u]);
- if(2 != entry_ptr->notify_after_insert_count)
+ entry_ptr = &(base_addr[u]);
+ if (2 != entry_ptr->notify_after_insert_count)
CACHE_ERROR("invalid notify after insert count")
- if(1 != entry_ptr->notify_before_evict_count)
+ if (1 != entry_ptr->notify_before_evict_count)
CACHE_ERROR("invalid notify before evict count")
} /* end for */
/* Unprotect entries, evicting them from the cache */
- for(u = 0; u < 5; u++) {
+ for (u = 0; u < 5; u++) {
unprotect_entry(file_ptr, entry_type, (int32_t)u, H5C__DIRTIED_FLAG);
- if(!pass) CACHE_ERROR("unprotect_entry failed")
+ if (!pass)
+ CACHE_ERROR("unprotect_entry failed")
/* Change expected values, and verify the status of the entries
* after each insertion
*/
- expected[u].in_cache = TRUE;
- expected[u].is_dirty = TRUE;
+ expected[u].in_cache = TRUE;
+ expected[u].is_dirty = TRUE;
expected[u].is_protected = FALSE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)u, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)u, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
/* Check the entry's 'after insert' count */
- entry_ptr = &(base_addr[u]);
- if(2 != entry_ptr->notify_after_insert_count)
+ entry_ptr = &(base_addr[u]);
+ if (2 != entry_ptr->notify_after_insert_count)
CACHE_ERROR("invalid notify after insert count")
- if(1 != entry_ptr->notify_before_evict_count)
+ if (1 != entry_ptr->notify_before_evict_count)
CACHE_ERROR("invalid notify before evict count")
} /* end for */
/* Remove entries from the cache */
- for(u = 0; u < 5; u++) {
+ for (u = 0; u < 5; u++) {
expunge_entry(file_ptr, entry_type, (int32_t)u);
- if(!pass) CACHE_ERROR("expunge_entry failed")
+ if (!pass)
+ CACHE_ERROR("expunge_entry failed")
/* Change expected values, and verify the status of the entries
* after each expunge
*/
- expected[u].in_cache = FALSE;
- expected[u].is_dirty = TRUE;
+ expected[u].in_cache = FALSE;
+ expected[u].is_dirty = TRUE;
expected[u].serialized = FALSE;
- expected[u].destroyed = TRUE;
+ expected[u].destroyed = TRUE;
/* Verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- (int)u, /* int tag */
- (int)5, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
- if(!pass) CACHE_ERROR("verify_entry_status failed")
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ (int)u, /* int tag */
+ (int)5, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
+ if (!pass)
+ CACHE_ERROR("verify_entry_status failed")
/* Check the entry's 'before evict' count */
- entry_ptr = &(base_addr[u]);
- if(2 != entry_ptr->notify_after_insert_count)
+ entry_ptr = &(base_addr[u]);
+ if (2 != entry_ptr->notify_after_insert_count)
CACHE_ERROR("invalid notify after insert count")
- if(2 != entry_ptr->notify_before_evict_count)
+ if (2 != entry_ptr->notify_before_evict_count)
CACHE_ERROR("invalid notify before evict count")
} /* end for */
done:
takedown_cache(file_ptr, FALSE, FALSE);
- if(pass)
+ if (pass)
PASSED();
else {
H5_FAILED();
@@ -33806,7 +32860,6 @@ done:
return (unsigned)!pass;
} /* check_notify_cb() */
-
/*-------------------------------------------------------------------------
* Function: check_metadata_cork
*
@@ -33824,20 +32877,20 @@ done:
static unsigned
check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
{
- const char * fcn_name = "check_metadata_cork";
- int entry_type = HUGE_ENTRY_TYPE;
- size_t entry_size = HUGE_ENTRY_SIZE; /* 16 KB */
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- hbool_t show_progress = FALSE;
- int32_t checkpoint = 0;
- int32_t entry_idx = 0;
- int32_t i;
+ const char *fcn_name = "check_metadata_cork";
+ int entry_type = HUGE_ENTRY_TYPE;
+ size_t entry_size = HUGE_ENTRY_SIZE; /* 16 KB */
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ hbool_t show_progress = FALSE;
+ int32_t checkpoint = 0;
+ int32_t entry_idx = 0;
+ int32_t i;
/* Expected deserialized status of entries depends on how they get into
* the cache. Insertions = not deserialized, protect/unprotect = deserialized.
*/
- hbool_t deserialized = (hbool_t)!(fill_via_insertion);
+ hbool_t deserialized = (hbool_t) !(fill_via_insertion);
/* Set up the expected array. This is used to maintain a table of the
* expected status of every entry used in this test.
@@ -34004,16 +33057,15 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
reset_entries();
- if(fill_via_insertion)
+ if (fill_via_insertion)
TESTING("to ensure cork/uncork metadata when inserting")
else
TESTING("to ensure cork/uncork metadata on protect/unprotect")
- if(show_progress) /* 0 */
- HDfprintf(stdout, "\n%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
+ if (show_progress) /* 0 */
+ HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
- if(pass) {
+ if (pass) {
/* Set up the cache.
*
@@ -34022,11 +33074,10 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
*/
file_ptr = setup_cache((size_t)(50 * entry_size), (size_t)(25 * entry_size), paged);
- if(file_ptr == NULL) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad return from cache intialization.\n";
-
}
else
cache_ptr = file_ptr->shared->cache;
@@ -34035,9 +33086,8 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
/* Cork the cache entry type */
cork_entry_type(file_ptr, entry_type);
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
/* ========================================================================
* ========================================================================
@@ -34052,35 +33102,35 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
* ========================================================================
*/
- if(pass) {
+ if (pass) {
/* Insert 26 entries (indexes 0 through 25) into the cache. */
for (entry_idx = 0; entry_idx < 26; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
-
- } else {
+ entry_type, /* int32_t type */
+ entry_idx, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/* Change expected values, and verify the status of the entries
* after each insertion
*/
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
expected[entry_idx].deserialized = (unsigned char)deserialized;
- expected[entry_idx].is_corked = TRUE;
+ expected[entry_idx].is_corked = TRUE;
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
entry_idx, /* int tag */
@@ -34089,9 +33139,8 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
}
}
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
/* ========================================================================
* ========================================================================
@@ -34106,22 +33155,23 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
* ========================================================================
*/
- if(pass) {
+ if (pass) {
/* Insert the 27th entry (index = 26) into the cache. */
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx++, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ entry_type, /* int32_t type */
+ entry_idx++, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx++, /* int32_t idx */
+ entry_idx++, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
@@ -34129,14 +33179,14 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
*
* Expected status is that there are 27 entries in the cache, and
* all entries remain the same as before since they are all corked
- * and dirty
+ * and dirty
*/
/* entry w/ index 26 is now in the cache and dirty. */
- expected[26].in_cache = TRUE;
- expected[26].is_dirty = TRUE;
- expected[26].deserialized = (unsigned char)deserialized;
- expected[26].is_corked = TRUE;
+ expected[26].in_cache = TRUE;
+ expected[26].is_dirty = TRUE;
+ expected[26].deserialized = (unsigned char)deserialized;
+ expected[26].is_corked = TRUE;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -34145,25 +33195,24 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
expected); /* expected */
}
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
-
- if(pass) {
+ if (pass) {
/* Insert the 28th entry (index = 27) into the cache. */
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx++, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ entry_type, /* int32_t type */
+ entry_idx++, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
entry_idx++, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
@@ -34175,10 +33224,10 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
* all entries are dirty corked entries.
*
*/
- expected[27].in_cache = TRUE;
- expected[27].is_dirty = TRUE;
- expected[27].deserialized = (unsigned char)deserialized;
- expected[27].is_corked = TRUE;
+ expected[27].in_cache = TRUE;
+ expected[27].is_dirty = TRUE;
+ expected[27].deserialized = (unsigned char)deserialized;
+ expected[27].is_corked = TRUE;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -34187,40 +33236,39 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
expected); /* expected */
}
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
-
- if(pass) {
+ if (pass) {
/* Fill out the rest of the cache with entries */
/* Verify expected status of entries after each insertion */
for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ entry_type, /* int32_t type */
+ entry_idx, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/*
- * Expected status: all entries are dirty corked entries.
+ * Expected status: all entries are dirty corked entries.
*/
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
- expected[entry_idx].deserialized = (unsigned char)deserialized;
- expected[entry_idx].is_corked = TRUE;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].deserialized = (unsigned char)deserialized;
+ expected[entry_idx].is_corked = TRUE;
/* Verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -34230,16 +33278,15 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
}
/* Verify that the cache is now full */
- if(cache_ptr->cache_full != TRUE) {
+ if (cache_ptr->cache_full != TRUE) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not completely filled.\n";
}
}
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
/* ========================================================================
* ========================================================================
@@ -34251,36 +33298,36 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
* ========================================================================
*/
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
- if(pass) {
+ if (pass) {
/* Insert 50 more entries (indices 50-99) into the cache. */
for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
+ entry_type, /* int32_t type */
entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/* This past inserted entry is now in the cache: dirty and corked */
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
- expected[entry_idx].deserialized = (unsigned char)deserialized;
- expected[entry_idx].is_corked = TRUE;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].deserialized = (unsigned char)deserialized;
+ expected[entry_idx].is_corked = TRUE;
/* Verify this expected status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -34290,10 +33337,8 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
}
}
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
-
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
/* ========================================================================
* ========================================================================
@@ -34306,7 +33351,7 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
* ========================================================================
*/
- if(pass) {
+ if (pass) {
/* Flush the cache.
*
@@ -34316,19 +33361,19 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
*/
flush_cache(file_ptr, /* H5F_t * file_ptr */
- FALSE, /* hbool_t destory_entries */
- FALSE, /* hbool_t dump_stats */
- FALSE); /* hbool_t dump_detailed_stats */
+ FALSE, /* hbool_t destory_entries */
+ FALSE, /* hbool_t dump_stats */
+ FALSE); /* hbool_t dump_detailed_stats */
/* Verify that the cache is clean */
verify_clean();
/* Verify the status of the entries. */
- /* All entries are flushed, clean but still corked */
+ /* All entries are flushed, clean but still corked */
for (i = 0; i < 100; i++) {
expected[i].serialized = TRUE;
- expected[i].is_dirty = FALSE;
- expected[i].is_corked = TRUE;
+ expected[i].is_dirty = FALSE;
+ expected[i].is_corked = TRUE;
}
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
0, /* int tag */
@@ -34336,178 +33381,168 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
expected); /* expected */
}
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
-
-
- if(pass) {
-
- /* Will evict 50 clean "corked" entries all at once when inserting the 100th entry */
- for(i = 0; i < 51; i++) {
- expected[i].in_cache = FALSE;
- expected[i].destroyed = TRUE;
- expected[i].is_corked = TRUE;
- }
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
- /* Insert the 100th entry */
- if(fill_via_insertion) {
- insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- 100, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
+ if (pass) {
- } else {
- protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- 100); /* int32-t idx */
+ /* Will evict 50 clean "corked" entries all at once when inserting the 100th entry */
+ for (i = 0; i < 51; i++) {
+ expected[i].in_cache = FALSE;
+ expected[i].destroyed = TRUE;
+ expected[i].is_corked = TRUE;
+ }
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- 100, /* int32_t idx */
- H5C__DIRTIED_FLAG); /* unsigned int flags */
- }
+ /* Insert the 100th entry */
+ if (fill_via_insertion) {
+ insert_entry(file_ptr, /* H5F_t * file_ptr */
+ entry_type, /* int32_t type */
+ 100, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
+ protect_entry(file_ptr, /* H5F_t * file_ptr */
+ entry_type, /* int32_t type */
+ 100); /* int32-t idx */
- /* The 100th inserted entry is now in the cache and dirty */
- expected[100].in_cache = TRUE;
- expected[100].is_dirty = TRUE;
- expected[100].deserialized = (unsigned char)deserialized;
- expected[100].is_corked = TRUE;
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ entry_type, /* int32_t type */
+ 100, /* int32_t idx */
+ H5C__DIRTIED_FLAG); /* unsigned int flags */
+ }
- /* verify the status */
- verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- 100, /* int tag */
- 150, /* int num_entries */
- expected); /* struct expected_entry_staus[] */
+ /* The 100th inserted entry is now in the cache and dirty */
+ expected[100].in_cache = TRUE;
+ expected[100].is_dirty = TRUE;
+ expected[100].deserialized = (unsigned char)deserialized;
+ expected[100].is_corked = TRUE;
+ /* verify the status */
+ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
+ 100, /* int tag */
+ 150, /* int num_entries */
+ expected); /* struct expected_entry_staus[] */
}
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
- if(pass) {
+ if (pass) {
/* Insert 25 more corked entries (indexes 101 through 125) into the cache. */
- /* Clean entry will be evicted one a time */
+ /* Clean entry will be evicted one a time */
for (entry_idx = 101; entry_idx < 126; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
-
- } else {
+ entry_type, /* int32_t type */
+ entry_idx, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/* The inserted entry is now in the cache and dirty */
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
- expected[entry_idx].deserialized = (unsigned char)deserialized;
- expected[entry_idx].is_corked = TRUE;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].deserialized = (unsigned char)deserialized;
+ expected[entry_idx].is_corked = TRUE;
- expected[entry_idx - 50].in_cache = FALSE;
- expected[entry_idx - 50].destroyed = TRUE;
- expected[entry_idx - 50].is_corked = TRUE;
+ expected[entry_idx - 50].in_cache = FALSE;
+ expected[entry_idx - 50].destroyed = TRUE;
+ expected[entry_idx - 50].is_corked = TRUE;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
entry_idx, /* int tag */
150, /* int num_entries */
expected); /* struct expected_entry_staus[] */
- } /* end for */
-
+ } /* end for */
}
+ if (show_progress) /* 10 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
- if(show_progress) /* 10 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
-
-
- if(pass) {
+ if (pass) {
/* Insert the 127th entry (index = 126) into the cache. */
- if(fill_via_insertion) {
- insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- 126, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
- } else {
- protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
+ if (fill_via_insertion) {
+ insert_entry(file_ptr, /* H5F_t * file_ptr */
+ entry_type, /* int32_t type */
+ 126, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
+ protect_entry(file_ptr, /* H5F_t * file_ptr */
+ entry_type, /* int32_t type */
126); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- 126, /* int32_t idx */
+ 126, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/* Verify the status of the entries. */
- expected[126].in_cache = TRUE;
- expected[126].is_dirty = TRUE;
- expected[126].deserialized = (unsigned char)deserialized;
- expected[126].is_corked = TRUE;
+ expected[126].in_cache = TRUE;
+ expected[126].is_dirty = TRUE;
+ expected[126].deserialized = (unsigned char)deserialized;
+ expected[126].is_corked = TRUE;
- expected[126 - 50].in_cache = FALSE;
- expected[126 - 50].destroyed = TRUE;
- expected[126 - 50].is_corked = TRUE;
+ expected[126 - 50].in_cache = FALSE;
+ expected[126 - 50].destroyed = TRUE;
+ expected[126 - 50].is_corked = TRUE;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
- 126, /* int tag */
+ 126, /* int tag */
150, /* int num_entries */
expected); /* expected */
}
+ if (show_progress) /* 11 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
- if(show_progress) /* 11 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
-
-
- if(pass) {
+ if (pass) {
/* Insert entries w/ indices 127 through 149 into the cache */
for (entry_idx = 127; entry_idx < 150; entry_idx++) {
- if(fill_via_insertion) {
+ if (fill_via_insertion) {
insert_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
- H5C__NO_FLAGS_SET); /* unsigned int flags */
-
- } else {
+ entry_type, /* int32_t type */
+ entry_idx, /* int32_t idx */
+ H5C__NO_FLAGS_SET); /* unsigned int flags */
+ }
+ else {
protect_entry(file_ptr, /* H5F_t * file_ptr */
- entry_type, /* int32_t type */
- entry_idx); /* int32-t idx */
+ entry_type, /* int32_t type */
+ entry_idx); /* int32-t idx */
- unprotect_entry(file_ptr, /* H5F_t * file_ptr */
+ unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
- entry_idx, /* int32_t idx */
+ entry_idx, /* int32_t idx */
H5C__DIRTIED_FLAG); /* unsigned int flags */
}
/* This past inserted entry is now in the cache, dirty and corked */
- expected[entry_idx].in_cache = TRUE;
- expected[entry_idx].is_dirty = TRUE;
- expected[entry_idx].deserialized = (unsigned char)deserialized;
- expected[entry_idx].is_corked = TRUE;
+ expected[entry_idx].in_cache = TRUE;
+ expected[entry_idx].is_dirty = TRUE;
+ expected[entry_idx].deserialized = (unsigned char)deserialized;
+ expected[entry_idx].is_corked = TRUE;
- /* Entry that is 50 entries away will be evicted since it is clean even though corked */
- expected[entry_idx - 50].in_cache = FALSE;
- expected[entry_idx - 50].destroyed = TRUE;
- expected[entry_idx - 50].is_corked = TRUE;
+ /* Entry that is 50 entries away will be evicted since it is clean even though corked */
+ expected[entry_idx - 50].in_cache = FALSE;
+ expected[entry_idx - 50].destroyed = TRUE;
+ expected[entry_idx - 50].is_corked = TRUE;
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
@@ -34515,29 +33550,29 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
150, /* int num_entries */
expected); /* struct expected_entry_staus[] */
}
-
}
- if(show_progress) /* 12 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
-
+ if (show_progress) /* 12 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
/* We're done with testing. We can take down the cache. */
takedown_cache(file_ptr, FALSE, FALSE);
reset_entries();
- if(show_progress) /* 13 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
- fcn_name, checkpoint++, pass);
+ if (show_progress) /* 13 */
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n", fcn_name, checkpoint++, pass);
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
return (unsigned)!pass;
} /* check_metadata_cork() */
-
/*-------------------------------------------------------------------------
* Function: check_entry_deletions_during_scans()
*
@@ -34571,9 +33606,9 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged)
static unsigned
check_entry_deletions_during_scans(unsigned paged)
{
- H5F_t * file_ptr = NULL;
+ H5F_t *file_ptr = NULL;
- if(paged)
+ if (paged)
TESTING("entry deletion during list scan detection and adaption (par)")
else
TESTING("entry deletion during list scan detection and adaption")
@@ -34585,7 +33620,7 @@ check_entry_deletions_during_scans(unsigned paged)
* place.
*/
- if(pass) {
+ if (pass) {
reset_entries();
@@ -34598,43 +33633,44 @@ check_entry_deletions_during_scans(unsigned paged)
* a different entry could cause problems.
*/
- if(pass) {
+ if (pass) {
cedds__expunge_dirty_entry_in_flush_test(file_ptr);
}
- if(pass) {
+ if (pass) {
cedds__H5C_make_space_in_cache(file_ptr);
}
- if(pass) {
+ if (pass) {
cedds__H5C__autoadjust__ageout__evict_aged_out_entries(file_ptr);
}
- if(pass) {
+ if (pass) {
cedds__H5C_flush_invalidate_cache__bucket_scan(file_ptr);
}
-
-
takedown_cache(file_ptr, FALSE, FALSE);
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
return (unsigned)!pass;
} /* check_entry_deletions_during_scans() */
-
/*-------------------------------------------------------------------------
*
* Function: cedds__expunge_dirty_entry_in_flush_test()
@@ -34670,10 +33706,10 @@ check_entry_deletions_during_scans(unsigned paged)
*/
static void
-cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
+cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
- int i;
+ H5C_t *cache_ptr = file_ptr->shared->cache;
+ int i;
/* clang-format off */
struct expected_entry_status expected[36] =
{
@@ -34691,88 +33727,82 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
};
/* clang-format on */
- if(pass) {
+ if (pass) {
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to cedds expunge dirty entry in flush test.";
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not empty on entry to cedds expunge dirty entry in flush test.";
}
- else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
-
- pass = FALSE;
- failure_mssg =
- "unexpected cache config at start of cedds expunge dirty entry in flush test.";
+ else if ((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- } else {
+ pass = FALSE;
+ failure_mssg = "unexpected cache config at start of cedds expunge dirty entry in flush test.";
+ }
+ else {
/* set min clean size to zero for this test as it simplifies
- * computing the expected cache size after each operation.
- */
+ * computing the expected cache size after each operation.
+ */
cache_ptr->min_clean_size = 0;
}
}
- if(pass) {
+ if (pass) {
- /* The basic idea of this test is to setup the cache such
- * that:
- *
- * 1) the cache contains several dirty entries.
- *
- * 2) the first entry on the slist is dirty, and has a flush
- * operation that will remove the second entry on the
+ /* The basic idea of this test is to setup the cache such
+ * that:
+ *
+ * 1) the cache contains several dirty entries.
+ *
+ * 2) the first entry on the slist is dirty, and has a flush
+ * operation that will remove the second entry on the
* slist.
*
* Then load flush the cache. Cache should handle the
- * removal of the next entry in the slist scan gracefully.
+ * removal of the next entry in the slist scan gracefully.
*/
- /* reset the stats before we start. If stats are enabled, we will
- * check to see if they are as expected at the end.
- */
- H5C_stats__reset(cache_ptr);
-
+ /* reset the stats before we start. If stats are enabled, we will
+ * check to see if they are as expected at the end.
+ */
+ H5C_stats__reset(cache_ptr);
- /* Load four huge entries into the cache. Recall that huge entries
+ /* Load four huge entries into the cache. Recall that huge entries
* are one fourth the size of monster entries (16 KB vs. 64 KB).
*/
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++) {
- protect_entry(file_ptr, HUGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, HUGE_ENTRY_TYPE, i);
+ unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
- if((cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != (4 * HUGE_ENTRY_SIZE))) {
+ if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != (4 * HUGE_ENTRY_SIZE))) {
pass = FALSE;
- failure_mssg = "unexpected size/len in cedds expunge dirty entry in flush test (1)";
- }
+ failure_mssg = "unexpected size/len in cedds expunge dirty entry in flush test (1)";
+ }
}
- if(pass) {
-
- /* Next, set up the flush operation:
- *
- * (HET, 0) expunges (HET, 1)
- *
- */
- add_flush_op(HUGE_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE,
- HUGE_ENTRY_TYPE, 1, FALSE, (size_t)0, NULL);
+ if (pass) {
+ /* Next, set up the flush operation:
+ *
+ * (HET, 0) expunges (HET, 1)
+ *
+ */
+ add_flush_op(HUGE_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE, HUGE_ENTRY_TYPE, 1, FALSE, (size_t)0, NULL);
}
- if ( pass ) {
+ if (pass) {
/* to summarize, at present the following entries
* are in cache with the following characteristics:
@@ -34799,18 +33829,15 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
/* flush the cache to run the test. In the process, clean up after test. */
- if ( pass ) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
- "Cache flush inval failed in cedds expunge dirty entry in flush test")
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG,
+ "Cache flush inval failed in cedds expunge dirty entry in flush test")
- if ( ( pass ) &&
- ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) ) {
+ if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache len/size after cedds expunge dirty entry in flush test";
-
}
}
@@ -34818,43 +33845,38 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
/* If we are collecting stats, check to see if we get the expected
* values.
*/
- if(pass)
- if((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_insertions[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[HUGE_ENTRY_TYPE] != 1) ||
- (cache_ptr->flushes[HUGE_ENTRY_TYPE] != 3) ||
- (cache_ptr->evictions[HUGE_ENTRY_TYPE] != 4) ||
- (cache_ptr->take_ownerships[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[HUGE_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if (pass)
+ if ((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_insertions[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[HUGE_ENTRY_TYPE] != 1) || (cache_ptr->flushes[HUGE_ENTRY_TYPE] != 3) ||
+ (cache_ptr->evictions[HUGE_ENTRY_TYPE] != 4) ||
+ (cache_ptr->take_ownerships[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->moves[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->pins[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->unpins[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->dirty_pins[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[HUGE_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected huge size entry stats in cedds__expunge_dirty_entry_in_flush_test().";
} /* end if */
- if(pass)
- if((cache_ptr->slist_scan_restarts != 1) ||
- (cache_ptr->LRU_scan_restarts != 0) ||
- (cache_ptr->index_scan_restarts != 0)) {
- pass = FALSE;
+ if (pass)
+ if ((cache_ptr->slist_scan_restarts != 1) || (cache_ptr->LRU_scan_restarts != 0) ||
+ (cache_ptr->index_scan_restarts != 0)) {
+ pass = FALSE;
failure_mssg = "unexpected scan restart stats in cedds__expunge_dirty_entry_in_flush_test().";
} /* end if */
-#endif /* H5C_COLLECT_CACHE_STATS */
+#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
+ if (pass)
reset_entries();
- if(pass)
+ if (pass)
/* reset cache min clean size to its expected value */
cache_ptr->min_clean_size = (1 * 1024 * 1024);
@@ -34862,7 +33884,6 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
} /* cedds__expunge_dirty_entry_in_flush_test() */
-
/*-------------------------------------------------------------------------
* Function: cedds__H5C_make_space_in_cache()
*
@@ -34899,12 +33920,12 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
*/
static void
-cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
+cedds__H5C_make_space_in_cache(H5F_t *file_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
- int i;
- const int num_huge_entries = 4;
- const int num_monster_entries = 32;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
+ int i;
+ const int num_huge_entries = 4;
+ const int num_monster_entries = 32;
/* clang-format off */
struct expected_entry_status expected[36] =
{
@@ -34954,145 +33975,136 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
};
/* clang-format on */
- if(pass) {
+ if (pass) {
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to cedds for H5C__make_space_in_cache() test.";
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not empty at start of flush ops eviction test.";
}
- else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
-
- pass = FALSE;
- failure_mssg =
- "unexpected cache config at start of cedds H5C__make_space_in_cache() test.";
+ else if ((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- } else {
+ pass = FALSE;
+ failure_mssg = "unexpected cache config at start of cedds H5C__make_space_in_cache() test.";
+ }
+ else {
/* set min clean size to zero for this test as it simplifies
- * computing the expected cache size after each operation.
- */
+ * computing the expected cache size after each operation.
+ */
cache_ptr->min_clean_size = 0;
}
}
- if(pass) {
+ if (pass) {
- /* The basic idea of this test is to setup the cache such
- * that:
- *
- * 1) the cache is full
- *
- * 2) the last entry on the LRU is dirty, and has a flush
- * operation that will remove the second to last entry
+ /* The basic idea of this test is to setup the cache such
+ * that:
+ *
+ * 1) the cache is full
+ *
+ * 2) the last entry on the LRU is dirty, and has a flush
+ * operation that will remove the second to last entry
* on the LRU from the cache.
*
* Then load another entry into the cache. See if
- * H5C__make_space_in_cache() detects the removal of
- * the next item in the scan, and restarts the scan
+ * H5C__make_space_in_cache() detects the removal of
+ * the next item in the scan, and restarts the scan
* from the bottom of the LRU. Note that the newly
* loaded entry must be large enough to require that
* the scan continue after the entry is expunged.
*/
- /* reset the stats before we start. If stats are enabled, we will
- * check to see if they are as expected at the end.
- */
- H5C_stats__reset(cache_ptr);
-
+ /* reset the stats before we start. If stats are enabled, we will
+ * check to see if they are as expected at the end.
+ */
+ H5C_stats__reset(cache_ptr);
- /* Load four huge entries into the cache. Recall that huge entries
+ /* Load four huge entries into the cache. Recall that huge entries
* are one fourth the size of monster entries (16 KB vs. 64 KB).
*/
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++) {
- protect_entry(file_ptr, HUGE_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, HUGE_ENTRY_TYPE, i);
+ unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
}
- if((cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != (4 * HUGE_ENTRY_SIZE))) {
+ if ((cache_ptr->index_len != 4) || (cache_ptr->index_size != (4 * HUGE_ENTRY_SIZE))) {
pass = FALSE;
- failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (1)";
- }
+ failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (1)";
+ }
}
- if(pass) {
-
- /* Next, set up the flush operation:
- *
- * (HET, 0) expunges (HET, 1)
- *
- */
- add_flush_op(HUGE_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE,
- HUGE_ENTRY_TYPE, 1, FALSE, (size_t)0, NULL);
+ if (pass) {
+ /* Next, set up the flush operation:
+ *
+ * (HET, 0) expunges (HET, 1)
+ *
+ */
+ add_flush_op(HUGE_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE, HUGE_ENTRY_TYPE, 1, FALSE, (size_t)0, NULL);
}
- if(pass) {
+ if (pass) {
- /* to summarize, at present the following entries
- * are in cache with the following characteristics:
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (HET, 0) Y 16 KB Y N - expunge (HET 1)
- *
- * (HET, 1) Y 16 KB N N - -
+ /* to summarize, at present the following entries
+ * are in cache with the following characteristics:
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (HET, 0) Y 16 KB Y N - expunge (HET 1)
*
- * (HET, 2) Y 16 KB N N - -
+ * (HET, 1) Y 16 KB N N - -
*
- * (HET, 3) Y 16 KB N N - -
- *
- * Recall that in this test bed, flush operations are excuted the
- * first time the associated entry is flushed, and are then
- * deleted.
- */
+ * (HET, 2) Y 16 KB N N - -
+ *
+ * (HET, 3) Y 16 KB N N - -
+ *
+ * Recall that in this test bed, flush operations are excuted the
+ * first time the associated entry is flushed, and are then
+ * deleted.
+ */
/* Now fill up the cache with other, unrelated entries. Recall
* that the cache size is 2 MB and 31 * 64 KB + 4 * 16 KP == 2 MB.
*/
- for (i = 0; i < 31; i++)
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ for (i = 0; i < 31; i++) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG);
- }
-
- /* The cache should now be exactly full */
- if((cache_ptr->index_len != 35) ||
- (cache_ptr->index_size != 2 * 1024 * 1024) ||
- (cache_ptr->index_size != ((4 * HUGE_ENTRY_SIZE) +
- (31 * MONSTER_ENTRY_SIZE)))) {
+ }
- pass = FALSE;
- failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (2)";
+ /* The cache should now be exactly full */
+ if ((cache_ptr->index_len != 35) || (cache_ptr->index_size != 2 * 1024 * 1024) ||
+ (cache_ptr->index_size != ((4 * HUGE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE)))) {
- } else {
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (2)";
+ }
+ else {
- /* verify the expected status of all entries we have loaded to date: */
- verify_entry_status(cache_ptr, 0, 35, expected);
- }
+ /* verify the expected status of all entries we have loaded to date: */
+ verify_entry_status(cache_ptr, 0, 35, expected);
+ }
}
- if(pass) {
+ if (pass) {
/* now load another monster entry. This should cause
- * H5C__make_space_in_cache() to be called. (HET 0) is dirty, and is at
- * the bottom of the LRU. * Thus it will be flushed, and moved to the
- * head of the LRU. However, during the flush, (HET 1) should be expunged
- * from the cache. Since (MET 1) is the next item in
- * H5C__make_space_in_cache(), must detect its removal from the cache,
+ * H5C__make_space_in_cache() to be called. (HET 0) is dirty, and is at
+ * the bottom of the LRU. * Thus it will be flushed, and moved to the
+ * head of the LRU. However, during the flush, (HET 1) should be expunged
+ * from the cache. Since (MET 1) is the next item in
+ * H5C__make_space_in_cache(), must detect its removal from the cache,
* and refrain from trying to flush it.
*
* Since all entries in the cache are dirty, all entries will be flushed,
@@ -35107,7 +34119,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31);
}
- if(pass) {
+ if (pass) {
/* if the protect succeeded, unprotect and verify that all is at
* it should be.
@@ -35115,56 +34127,50 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31, H5C__DIRTIED_FLAG);
- /* The cache should now be exactly full */
- if((cache_ptr->index_len != 32) ||
- (cache_ptr->index_size != 2 * 1024 * 1024) ||
- (cache_ptr->index_size != (32 * MONSTER_ENTRY_SIZE))) {
-
- pass = FALSE;
- failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (3)";
+ /* The cache should now be exactly full */
+ if ((cache_ptr->index_len != 32) || (cache_ptr->index_size != 2 * 1024 * 1024) ||
+ (cache_ptr->index_size != (32 * MONSTER_ENTRY_SIZE))) {
- } else {
+ pass = FALSE;
+ failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (3)";
+ }
+ else {
- /* modify the expected table to match the new situation, and
+ /* modify the expected table to match the new situation, and
* then call verify_entry_status().
*/
- for (i = 0; i < num_huge_entries; i++)
- {
- expected[i].in_cache = FALSE;
- expected[i].is_dirty = FALSE;
- expected[i].serialized = TRUE;
- expected[i].destroyed = TRUE;
+ for (i = 0; i < num_huge_entries; i++) {
+ expected[i].in_cache = FALSE;
+ expected[i].is_dirty = FALSE;
+ expected[i].serialized = TRUE;
+ expected[i].destroyed = TRUE;
}
/* (HET, 1) was expunged, so touch its entry up accordingly */
- expected[1].is_dirty = TRUE;
- expected[1].serialized = FALSE;
+ expected[1].is_dirty = TRUE;
+ expected[1].serialized = FALSE;
- for (i = num_huge_entries; i < num_huge_entries + num_monster_entries - 1; i++)
- {
- expected[i].is_dirty = FALSE;
- expected[i].serialized = TRUE;
+ for (i = num_huge_entries; i < num_huge_entries + num_monster_entries - 1; i++) {
+ expected[i].is_dirty = FALSE;
+ expected[i].serialized = TRUE;
}
- /* verify the expected status of all entries: */
- verify_entry_status(cache_ptr, 0, 36, expected);
+ /* verify the expected status of all entries: */
+ verify_entry_status(cache_ptr, 0, 36, expected);
}
}
/* flush the cache and end the test. */
- if ( pass ) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
- "Cache flush invalidate failed after flush op eviction test")
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG,
+ "Cache flush invalidate failed after flush op eviction test")
- if ( ( pass ) &&
- ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) ) {
+ if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test";
-
}
}
@@ -35173,71 +34179,64 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
* values.
*/
- if(pass) {
-
- if((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_insertions[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[HUGE_ENTRY_TYPE] != 1) ||
- (cache_ptr->flushes[HUGE_ENTRY_TYPE] != 3) ||
- (cache_ptr->evictions[HUGE_ENTRY_TYPE] != 4) ||
- (cache_ptr->take_ownerships[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[HUGE_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[HUGE_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if (pass) {
+
+ if ((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_insertions[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[HUGE_ENTRY_TYPE] != 1) || (cache_ptr->flushes[HUGE_ENTRY_TYPE] != 3) ||
+ (cache_ptr->evictions[HUGE_ENTRY_TYPE] != 4) ||
+ (cache_ptr->take_ownerships[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->moves[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->pins[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->unpins[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->dirty_pins[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[HUGE_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[HUGE_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected large entry stats in cedds__H5C_make_space_in_cache().";
}
}
- if(pass)
- if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if (pass)
+ if ((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster entry stats in cedds__H5C_make_space_in_cache().";
} /* end if */
- if(pass)
- if((cache_ptr->slist_scan_restarts != 0) ||
- (cache_ptr->LRU_scan_restarts != 1) ||
- (cache_ptr->index_scan_restarts != 0)) {
+ if (pass)
+ if ((cache_ptr->slist_scan_restarts != 0) || (cache_ptr->LRU_scan_restarts != 1) ||
+ (cache_ptr->index_scan_restarts != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unexpected scan restart stats in cedds__H5C_make_space_in_cache().";
} /* end if */
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
+ if (pass)
reset_entries();
- if(pass)
+ if (pass)
/* reset cache min clean size to its expected value */
cache_ptr->min_clean_size = (1 * 1024 * 1024);
@@ -35245,7 +34244,6 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
} /* cedds__H5C_make_space_in_cache() */
-
/*-------------------------------------------------------------------------
* Function: cedds__H5C__autoadjust__ageout__evict_aged_out_entries()
*
@@ -35282,11 +34280,11 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
*/
static void
-cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
+cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
- int i;
- herr_t result;
+ H5C_t *cache_ptr = file_ptr->shared->cache;
+ int i;
+ herr_t result;
/* clang-format off */
struct expected_entry_status expected[36] =
{
@@ -35332,8 +34330,7 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
};
/* clang-format on */
H5C_auto_size_ctl_t saved_auto_size_ctl;
- H5C_auto_size_ctl_t test_auto_size_ctl =
- {
+ H5C_auto_size_ctl_t test_auto_size_ctl = {
/* int32_t version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
/* H5C_auto_resize_report_fcn rpt_fcn = */ test_rpt_fcn,
@@ -35347,7 +34344,6 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
/* int64_t epoch_length = */ 1000,
-
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
/* double lower_hr_threshold = */ 0.75f,
@@ -35358,10 +34354,9 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
/* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
-
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out,
@@ -35375,151 +34370,145 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
/* int32_t epochs_before_eviction = */ 1,
/* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f
- };
+ /* double empty_reserve = */ 0.05f};
- if(pass) {
+ if (pass) {
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
- pass = FALSE;
- failure_mssg = "cache_ptr NULL on entry to cedds for H5C__autoadjust__ageout__evict_aged_out_entries() test.";
+ pass = FALSE;
+ failure_mssg = "cache_ptr NULL on entry to cedds for "
+ "H5C__autoadjust__ageout__evict_aged_out_entries() test.";
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
- failure_mssg = "cache not empty at start cedds for H5C__autoadjust__ageout__evict_aged_out_entries() test.";
+ failure_mssg =
+ "cache not empty at start cedds for H5C__autoadjust__ageout__evict_aged_out_entries() test.";
}
- else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
-
- pass = FALSE;
- failure_mssg =
- "unexpected cache config at start of cedds H5C__autoadjust__ageout__evict_aged_out_entries() test.";
+ else if ((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- } else {
+ pass = FALSE;
+ failure_mssg = "unexpected cache config at start of cedds "
+ "H5C__autoadjust__ageout__evict_aged_out_entries() test.";
+ }
+ else {
/* set min clean size to zero for this test as it simplifies
- * computing the expected cache size after each operation.
- */
+ * computing the expected cache size after each operation.
+ */
cache_ptr->min_clean_size = 0;
}
}
/* save the initial resize configuration so we can restore it later */
- if(pass) {
+ if (pass) {
saved_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- result = H5C_get_cache_auto_resize_config(cache_ptr,
- &saved_auto_size_ctl);
+ result = H5C_get_cache_auto_resize_config(cache_ptr, &saved_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_get_cache_auto_resize_config failed.";
-
}
}
/* set the resize configuration we will be using in the test */
- if(pass) {
+ if (pass) {
result = H5C_set_cache_auto_resize_config(cache_ptr, &test_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 1.\n";
}
}
- if(pass) {
+ if (pass) {
- /* The basic idea of this test is to setup the cache such
- * that:
- *
- * 1) the cache is full
- *
- * 2) the last entry on the LRU is dirty, and has a flush
- * operation that will remove the second to last entry
+ /* The basic idea of this test is to setup the cache such
+ * that:
+ *
+ * 1) the cache is full
+ *
+ * 2) the last entry on the LRU is dirty, and has a flush
+ * operation that will remove the second to last entry
* on the LRU from the cache.
*
* Then access the first item in the LRU until the epoch
- * and H5C__autoadjust__ageout__evict_aged_out_entries()
+ * and H5C__autoadjust__ageout__evict_aged_out_entries()
* is invoked. Verify that the function deals with the
- * deletion of the next item in its scan cleanly.
+ * deletion of the next item in its scan cleanly.
*/
- /* reset the stats before we start. If stats are enabled, we will
- * check to see if they are as expected at the end.
- */
- H5C_stats__reset(cache_ptr);
-
+ /* reset the stats before we start. If stats are enabled, we will
+ * check to see if they are as expected at the end.
+ */
+ H5C_stats__reset(cache_ptr);
/* load the first entry -- mark it dirty */
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG);
/* Then load the rest of the entries to fill the cache:
*
* Recall that the cache size is 2 MB and 32 * 64 KB == 2 MB.
*/
- for (i = 1; i < 32; i++)
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ for (i = 1; i < 32; i++) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
+ }
}
- }
-
- if(pass) {
- /* Next, set up the flush operation:
- *
- * (MET, 0) expunges (MET, 1)
- *
- */
- add_flush_op(MONSTER_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE,
- MONSTER_ENTRY_TYPE, 1, FALSE, (size_t)0, NULL);
+ if (pass) {
+ /* Next, set up the flush operation:
+ *
+ * (MET, 0) expunges (MET, 1)
+ *
+ */
+ add_flush_op(MONSTER_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE, MONSTER_ENTRY_TYPE, 1, FALSE, (size_t)0, NULL);
}
- if(pass) {
+ if (pass) {
- /* to summarize, at present the following entries
- * are in cache with the following characteristics:
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (MET, 0) Y 64 KB Y N - expunge (MET 1)
- *
- * (MET, 1-31) Y 64 KB N N - -
- *
- * Recall that in this test bed, flush operations are excuted the
- * first time the associated entry is flushed, and are then
- * deleted.
- */
+ /* to summarize, at present the following entries
+ * are in cache with the following characteristics:
+ *
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
+ *
+ * (MET, 0) Y 64 KB Y N - expunge (MET 1)
+ *
+ * (MET, 1-31) Y 64 KB N N - -
+ *
+ * Recall that in this test bed, flush operations are excuted the
+ * first time the associated entry is flushed, and are then
+ * deleted.
+ */
- /* The cache should now be exactly full */
- if((cache_ptr->index_len != 32) ||
- (cache_ptr->index_size != 2 * 1024 * 1024) ||
- (cache_ptr->index_size != (32 * MONSTER_ENTRY_SIZE))) {
+ /* The cache should now be exactly full */
+ if ((cache_ptr->index_len != 32) || (cache_ptr->index_size != 2 * 1024 * 1024) ||
+ (cache_ptr->index_size != (32 * MONSTER_ENTRY_SIZE))) {
pass = FALSE;
- failure_mssg = "unexpected size/len in H5C__autoadjust__ageout__evict_aged_out_entries() test (1)";
-
- } else {
+ failure_mssg =
+ "unexpected size/len in H5C__autoadjust__ageout__evict_aged_out_entries() test (1)";
+ }
+ else {
- /* verify the expected status of all entries we have loaded to date: */
- verify_entry_status(cache_ptr, 0, 32, expected);
- }
+ /* verify the expected status of all entries we have loaded to date: */
+ verify_entry_status(cache_ptr, 0, 32, expected);
+ }
}
/* protect and unprotect (MET, 31) repeatedly until the end of the first epoch */
- while(pass && (cache_ptr->cache_accesses > 0)) {
+ while (pass && (cache_ptr->cache_accesses > 0)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31, H5C__NO_FLAGS_SET);
@@ -35527,7 +34516,7 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
/* at this point, an epoch marker entry should have been inserted into the LRU */
- if(pass) {
+ if (pass) {
/* protect and unprotect (MET, 31) again to get cache_accesses > 0 */
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31);
@@ -35535,7 +34524,7 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
}
/* protect and unprotect (MET, 31) repeatedly until the end of the second epoch */
- while(pass && (cache_ptr->cache_accesses > 0)) {
+ while (pass && (cache_ptr->cache_accesses > 0)) {
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31, H5C__NO_FLAGS_SET);
@@ -35547,63 +34536,59 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
* moved to the head of the LRU by the ageout algorithm.)
*/
- if(pass) {
+ if (pass) {
- if((cache_ptr->index_len != 2) ||
- (cache_ptr->index_size != 2 * MONSTER_ENTRY_SIZE)) {
+ if ((cache_ptr->index_len != 2) || (cache_ptr->index_size != 2 * MONSTER_ENTRY_SIZE)) {
pass = FALSE;
- failure_mssg = "unexpected size/len in H5C__autoadjust__ageout__evict_aged_out_entries() test (2)";
-
- } else {
+ failure_mssg =
+ "unexpected size/len in H5C__autoadjust__ageout__evict_aged_out_entries() test (2)";
+ }
+ else {
/* update the expected table to reflect the expected values at
* this point, and then verify.
*/
- expected[0].is_dirty = FALSE;
- expected[0].serialized = TRUE;
+ expected[0].is_dirty = FALSE;
+ expected[0].serialized = TRUE;
- for (i = 1; i < 31; i++)
- {
- expected[i].in_cache = FALSE;
- expected[i].is_dirty = FALSE;
- expected[i].destroyed = TRUE;
+ for (i = 1; i < 31; i++) {
+ expected[i].in_cache = FALSE;
+ expected[i].is_dirty = FALSE;
+ expected[i].destroyed = TRUE;
}
- verify_entry_status(cache_ptr, 0, 32, expected);
- }
+ verify_entry_status(cache_ptr, 0, 32, expected);
+ }
}
/* restore the initial resize configuration */
- if(pass) {
+ if (pass) {
saved_auto_size_ctl.set_initial_size = TRUE;
saved_auto_size_ctl.initial_size = 2 * 1024 * 1024;
result = H5C_set_cache_auto_resize_config(cache_ptr, &saved_auto_size_ctl);
- if(result != SUCCEED) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_set_cache_auto_resize_config failed 2.\n";
}
}
/* flush the cache and end the test. */
- if ( pass ) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
- "Cache flush invalidate failed after flush op eviction test")
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG,
+ "Cache flush invalidate failed after flush op eviction test")
- if ( ( pass ) &&
- ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) ) {
+ if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test";
-
}
}
@@ -35612,45 +34597,44 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
* values.
*/
- if(pass)
- if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
+ if (pass)
+ if ((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 1) ||
+ (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
pass = FALSE;
- failure_mssg = "Unexpected monster entry stats in cedds__H5C__autoadjust__ageout__evict_aged_out_entries().";
+ failure_mssg =
+ "Unexpected monster entry stats in cedds__H5C__autoadjust__ageout__evict_aged_out_entries().";
} /* end if */
- if(pass)
- if((cache_ptr->slist_scan_restarts != 0) ||
- (cache_ptr->LRU_scan_restarts != 1) ||
- (cache_ptr->index_scan_restarts != 0)) {
+ if (pass)
+ if ((cache_ptr->slist_scan_restarts != 0) || (cache_ptr->LRU_scan_restarts != 1) ||
+ (cache_ptr->index_scan_restarts != 0)) {
pass = FALSE;
- failure_mssg = "unexpected scan restart stats in cedds__H5C__autoadjust__ageout__evict_aged_out_entries().";
+ failure_mssg =
+ "unexpected scan restart stats in cedds__H5C__autoadjust__ageout__evict_aged_out_entries().";
} /* end if */
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
+ if (pass)
reset_entries();
- if(pass)
+ if (pass)
/* reset cache min clean size to its expected value */
cache_ptr->min_clean_size = (1 * 1024 * 1024);
@@ -35658,7 +34642,6 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
} /* cedds__H5C__autoadjust__ageout__evict_aged_out_entries() */
-
/*-------------------------------------------------------------------------
* Function: cedds__H5C_flush_invalidate_cache__bucket_scan()
*
@@ -35756,15 +34739,15 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
*/
static void
-cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
+cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t *file_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
int i;
int expected_hash_bucket = 0;
- haddr_t entry_addr;
- test_entry_t * entry_ptr;
- test_entry_t * base_addr = NULL;
- struct H5C_cache_entry_t * scan_ptr;
+ haddr_t entry_addr;
+ test_entry_t * entry_ptr;
+ test_entry_t * base_addr = NULL;
+ struct H5C_cache_entry_t *scan_ptr;
/* clang-format off */
struct expected_entry_status expected[5] =
{
@@ -35783,65 +34766,63 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
};
/* clang-format on */
- if(pass) {
+ if (pass) {
- if(cache_ptr == NULL) {
+ if (cache_ptr == NULL) {
pass = FALSE;
- failure_mssg = "cache_ptr NULL on entry to cedds for cedds__H5C_flush_invalidate_cache__bucket_scan() test.";
+ failure_mssg =
+ "cache_ptr NULL on entry to cedds for cedds__H5C_flush_invalidate_cache__bucket_scan() test.";
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
pass = FALSE;
- failure_mssg = "cache not empty at start cedds for cedds__H5C_flush_invalidate_cache__bucket_scan() test.";
+ failure_mssg =
+ "cache not empty at start cedds for cedds__H5C_flush_invalidate_cache__bucket_scan() test.";
}
- else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ else if ((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
- failure_mssg =
- "unexpected cache config at start of cedds cedds__H5C_flush_invalidate_cache__bucket_scan() test.";
-
- } else {
+ pass = FALSE;
+ failure_mssg = "unexpected cache config at start of cedds "
+ "cedds__H5C_flush_invalidate_cache__bucket_scan() test.";
+ }
+ else {
/* set min clean size to zero for this test as it simplifies
- * computing the expected cache size after each operation.
- */
+ * computing the expected cache size after each operation.
+ */
cache_ptr->min_clean_size = 0;
}
}
+ if (pass) {
- if(pass) {
-
- /* reset the stats before we start. If stats are enabled, we will
- * check to see if they are as expected at the end.
- */
-
- H5C_stats__reset(cache_ptr);
+ /* reset the stats before we start. If stats are enabled, we will
+ * check to see if they are as expected at the end.
+ */
+ H5C_stats__reset(cache_ptr);
- /* load one dirty and three clean entries that should hash to the
+ /* load one dirty and three clean entries that should hash to the
* same hash bucket.
*/
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG);
- for (i = 8; i <= 24; i += 8)
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ for (i = 8; i <= 24; i += 8) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
- }
+ }
}
- if(pass) {
+ if (pass) {
/* verify that the above entries hash to the same bucket */
- base_addr = entries[MONSTER_ENTRY_TYPE];
- entry_ptr = &(base_addr[0]);
+ base_addr = entries[MONSTER_ENTRY_TYPE];
+ entry_ptr = &(base_addr[0]);
entry_addr = entry_ptr->header.addr;
HDassert(entry_addr == entry_ptr->addr);
@@ -35850,87 +34831,84 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
for (i = 8; i <= 24; i += 8) {
- entry_ptr = &(base_addr[i]);
+ entry_ptr = &(base_addr[i]);
entry_addr = entry_ptr->header.addr;
- if(expected_hash_bucket != H5C__HASH_FCN(entry_addr)) {
+ if (expected_hash_bucket != H5C__HASH_FCN(entry_addr)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Test entries don't map to same bucket -- hash table size or hash fcn change?";
}
}
}
- if(pass) {
+ if (pass) {
- /* setup the expunge flush operation:
- *
- * (MET, 0) expunges (MET, 8)
- *
- */
- add_flush_op(MONSTER_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE,
- MONSTER_ENTRY_TYPE, 8, FALSE, (size_t)0, NULL);
+ /* setup the expunge flush operation:
+ *
+ * (MET, 0) expunges (MET, 8)
+ *
+ */
+ add_flush_op(MONSTER_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE, MONSTER_ENTRY_TYPE, 8, FALSE, (size_t)0, NULL);
}
- if(pass) {
+ if (pass) {
/* load the entry that will have a flush dependencey with (MET, 0),
* thus preventing it from being flushed on the first pass through
* the skip list.
*/
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31, H5C__DIRTIED_FLAG);
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31, H5C__DIRTIED_FLAG);
}
- if(pass) {
+ if (pass) {
/* verify that the dirty entry doesn't map to the same
* hash bucket as the clean entries.
*/
- entry_ptr = &(base_addr[31]);
+ entry_ptr = &(base_addr[31]);
entry_addr = entry_ptr->header.addr;
- if(expected_hash_bucket == H5C__HASH_FCN(entry_addr)) {
+ if (expected_hash_bucket == H5C__HASH_FCN(entry_addr)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Dirty entry maps to same hash bucket as clean entries?!?!";
}
}
- if(pass) {
+ if (pass) {
- /* Next, create the flush dependency requiring (MET, 31) to
+ /* Next, create the flush dependency requiring (MET, 31) to
* be flushed prior to (MET, 0).
- */
+ */
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0);
create_flush_dependency(MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_TYPE, 31);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG);
-
}
- if(pass) {
+ if (pass) {
/* Then, setup the flush operation to take down the flush
* dependency when (MET, 31) is flushed.
- *
- * (MET, 31) destroys flush dependency with (MET, 8)
- *
+ *
+ * (MET, 31) destroys flush dependency with (MET, 8)
+ *
*/
- add_flush_op(MONSTER_ENTRY_TYPE, 31, FLUSH_OP__DEST_FLUSH_DEP,
- MONSTER_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL);
-
+ add_flush_op(MONSTER_ENTRY_TYPE, 31, FLUSH_OP__DEST_FLUSH_DEP, MONSTER_ENTRY_TYPE, 0, FALSE,
+ (size_t)0, NULL);
}
- if(pass) {
+ if (pass) {
- /* verify the expected status of all entries we have loaded to date: */
+ /* verify the expected status of all entries we have loaded to date: */
verify_entry_status(cache_ptr, 0, 5, expected);
}
- if(pass) {
+ if (pass) {
/* now do some protect / unprotect cycles to force the
* entries into the desired order in the hash bucket.
@@ -35938,14 +34916,13 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
* hash bucket list on lookup.
*/
- for (i = 24; i >= 0; i -= 8)
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ for (i = 24; i >= 0; i -= 8) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
- }
+ }
}
- if(pass) {
+ if (pass) {
/* scan the hash bucket to verify that the expected entries appear
* in the expected order.
@@ -35954,45 +34931,39 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
i = 0;
- while(pass && (i <= 24))
- {
+ while (pass && (i <= 24)) {
entry_ptr = &(base_addr[i]);
- if(scan_ptr == NULL) {
+ if (scan_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "premature end of hash bucket list?!?!";
+ }
+ else if ((scan_ptr == NULL) || (scan_ptr != &(entry_ptr->header))) {
- } else if((scan_ptr == NULL) ||
- (scan_ptr != &(entry_ptr->header))) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "bad test hash bucket setup?!?!";
}
- if(pass) {
+ if (pass) {
scan_ptr = scan_ptr->ht_next;
i += 8;
}
- }
+ }
}
-
/* test setup complete -- flush the cache to run and end the test. */
- if ( pass ) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
- "Cache flush invalidate failed after flush op eviction test")
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG,
+ "Cache flush invalidate failed after flush op eviction test")
- if ( ( pass ) &&
- ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) ) {
+ if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test";
-
}
}
@@ -36001,48 +34972,47 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
* values.
*/
- if(pass)
- if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 2) ||
- (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 5) ||
- (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
+ if (pass)
+ if ((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 2) ||
+ (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 5) ||
+ (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 1) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 1) ||
+ (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
pass = FALSE;
- failure_mssg = "Unexpected monster entry stats in cedds__H5C_flush_invalidate_cache__bucket_scan().";
+ failure_mssg =
+ "Unexpected monster entry stats in cedds__H5C_flush_invalidate_cache__bucket_scan().";
} /* end if */
- if(pass)
+ if (pass)
/* as this test is now checking for index list scan restarts,
* the following has been modified to check this instead of
* hash bucket scan restarts.
*/
- if((cache_ptr->slist_scan_restarts != 0) ||
- (cache_ptr->LRU_scan_restarts != 0) ||
- (cache_ptr->index_scan_restarts != 1)) {
+ if ((cache_ptr->slist_scan_restarts != 0) || (cache_ptr->LRU_scan_restarts != 0) ||
+ (cache_ptr->index_scan_restarts != 1)) {
pass = FALSE;
- failure_mssg = "unexpected scan restart stats in cedds__H5C_flush_invalidate_cache__bucket_scan().";
+ failure_mssg =
+ "unexpected scan restart stats in cedds__H5C_flush_invalidate_cache__bucket_scan().";
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(pass)
+ if (pass)
reset_entries();
- if(pass)
+ if (pass)
/* reset cache min clean size to its expected value */
cache_ptr->min_clean_size = (1 * 1024 * 1024);
@@ -36050,7 +35020,6 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
} /* cedds__H5C_flush_invalidate_cache__bucket_scan() */
-
/*-------------------------------------------------------------------------
* Function: check_stats()
*
@@ -36078,11 +35047,11 @@ check_stats(unsigned paged)
#if H5C_COLLECT_CACHE_STATS
- H5F_t * file_ptr = NULL;
+ H5F_t *file_ptr = NULL;
#endif /* H5C_COLLECT_CACHE_STATS */
- if(paged)
+ if (paged)
TESTING("metadata cache statistics collection (paged aggregation)")
else
TESTING("metadata cache statistics collection")
@@ -36095,24 +35064,26 @@ check_stats(unsigned paged)
file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged);
- if(pass) {
+ if (pass) {
check_stats__smoke_check_1(file_ptr);
}
-
-
- if(pass) {
+ if (pass) {
takedown_cache(file_ptr, FALSE, FALSE);
}
- if(pass) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if(!pass) {
+ if (!pass) {
- HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
#else /* H5C_COLLECT_CACHE_STATS */
@@ -36127,7 +35098,6 @@ check_stats(unsigned paged)
} /* check_stats() */
-
/*-------------------------------------------------------------------------
* Function: check_stats__smoke_check_1()
*
@@ -36164,211 +35134,181 @@ check_stats(unsigned paged)
*/
#if H5C_COLLECT_CACHE_STATS
static void
-check_stats__smoke_check_1(H5F_t * file_ptr)
+check_stats__smoke_check_1(H5F_t *file_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
- int i;
+ H5C_t *cache_ptr = file_ptr->shared->cache;
+ int i;
- if(pass) {
- if(cache_ptr == NULL) {
+ if (pass) {
+ if (cache_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache_ptr NULL on entry to check_stats__smoke_check_1().";
} /* end if */
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache not empty on entry to check_stats__smoke_check_1().";
} /* end else-if */
- else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
- (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
+ else if ((cache_ptr->max_cache_size != (2 * 1024 * 1024)) ||
+ (cache_ptr->min_clean_size != (1 * 1024 * 1024))) {
- pass = FALSE;
- failure_mssg = "unexpected cache config at start of check_stats__smoke_check_1().";
+ pass = FALSE;
+ failure_mssg = "unexpected cache config at start of check_stats__smoke_check_1().";
} /* end else-if */
- else {
+ else {
/* set min clean size to zero for this test as it simplifies
- * computing the expected cache size after each operation.
- */
+ * computing the expected cache size after each operation.
+ */
cache_ptr->min_clean_size = 0;
} /* end else */
- } /* end if */
+ } /* end if */
- if(pass)
+ if (pass)
/* first fill the cache with monster entryies via insertion */
- for(i = 0; i < 32; i++)
+ for (i = 0; i < 32; i++)
insert_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
- if(pass)
- if((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->read_protects[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_read_protects[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if (pass)
+ if ((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->read_protects[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_read_protects[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(1).";
} /* end if */
- if ( pass ) {
-
- if ( ( cache_ptr->total_ht_insertions != 32 ) ||
- ( cache_ptr->total_ht_deletions != 0 ) ||
- ( cache_ptr->successful_ht_searches != 0 ) ||
- ( cache_ptr->total_successful_ht_search_depth != 0 ) ||
- ( cache_ptr->failed_ht_searches != 32 ) ||
- ( cache_ptr->total_failed_ht_search_depth != 48 ) ||
- ( cache_ptr->max_index_len != 32 ) ||
- ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) ||
- ( cache_ptr->max_clean_index_size != 0 ) ||
- ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->max_slist_len != 32 ) ||
- ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) ||
- ( cache_ptr->max_pl_len != 0 ) ||
- ( cache_ptr->max_pl_size != 0 ) ||
- ( cache_ptr->max_pel_len != 0 ) ||
- ( cache_ptr->max_pel_size != 0 ) ||
- ( cache_ptr->calls_to_msic != 0 ) ||
- ( cache_ptr->total_entries_skipped_in_msic != 0 ) ||
- ( cache_ptr->total_entries_scanned_in_msic != 0 ) ||
- ( cache_ptr->max_entries_skipped_in_msic != 0 ) ||
- ( cache_ptr->max_entries_scanned_in_msic != 0 ) ||
- ( cache_ptr->entries_scanned_to_make_space != 0 ) ||
- ( cache_ptr->slist_scan_restarts != 0 ) ||
- ( cache_ptr->LRU_scan_restarts != 0 ) ||
- ( cache_ptr->index_scan_restarts != 0 ) ) {
-
- pass = FALSE;
+ if (pass) {
+
+ if ((cache_ptr->total_ht_insertions != 32) || (cache_ptr->total_ht_deletions != 0) ||
+ (cache_ptr->successful_ht_searches != 0) || (cache_ptr->total_successful_ht_search_depth != 0) ||
+ (cache_ptr->failed_ht_searches != 32) || (cache_ptr->total_failed_ht_search_depth != 48) ||
+ (cache_ptr->max_index_len != 32) || (cache_ptr->max_index_size != 2 * 1024 * 1024) ||
+ (cache_ptr->max_clean_index_size != 0) || (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->max_slist_len != 32) || (cache_ptr->max_slist_size != 2 * 1024 * 1024))) ||
+ (cache_ptr->max_pl_len != 0) || (cache_ptr->max_pl_size != 0) || (cache_ptr->max_pel_len != 0) ||
+ (cache_ptr->max_pel_size != 0) || (cache_ptr->calls_to_msic != 0) ||
+ (cache_ptr->total_entries_skipped_in_msic != 0) ||
+ (cache_ptr->total_entries_scanned_in_msic != 0) ||
+ (cache_ptr->max_entries_skipped_in_msic != 0) || (cache_ptr->max_entries_scanned_in_msic != 0) ||
+ (cache_ptr->entries_scanned_to_make_space != 0) || (cache_ptr->slist_scan_restarts != 0) ||
+ (cache_ptr->LRU_scan_restarts != 0) || (cache_ptr->index_scan_restarts != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(1).";
} /* end if */
}
#if H5C_COLLECT_CACHE_ENTRY_STATS
- if(pass)
+ if (pass)
/* Note that most entry level stats are only updated on entry eviction */
- if((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1000000) || /* initial value */
- (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_size[MONSTER_ENTRY_TYPE] != 64 * 1024) ||
- (cache_ptr->max_pins[MONSTER_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if ((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1000000) || /* initial value */
+ (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_size[MONSTER_ENTRY_TYPE] != 64 * 1024) ||
+ (cache_ptr->max_pins[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster entry level stats in check_stats__smoke_check_1(1).";
} /* end if */
-#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
+#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
- if(pass)
+ if (pass)
/* protect and unprotect each entry once. Note
* that all entries are already dirty, as they
* entered the cache via insertion
*/
- for(i = 0; i < 32; i++) {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
+ for (i = 0; i < 32; i++) {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET);
} /* end for */
- if(pass)
- if((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->read_protects[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_read_protects[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if (pass)
+ if ((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 32) || (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->read_protects[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_read_protects[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(2).";
} /* end if */
- if ( pass ) {
-
- if ( ( cache_ptr->total_ht_insertions != 32 ) ||
- ( cache_ptr->total_ht_deletions != 0 ) ||
- ( cache_ptr->successful_ht_searches != 32 ) ||
- ( cache_ptr->total_successful_ht_search_depth != 96 ) ||
- ( cache_ptr->failed_ht_searches != 32 ) ||
- ( cache_ptr->total_failed_ht_search_depth != 48 ) ||
- ( cache_ptr->max_index_len != 32 ) ||
- ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) ||
- ( cache_ptr->max_clean_index_size != 0 ) ||
- ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->max_slist_len != 32 ) ||
- ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) ||
- ( cache_ptr->max_pl_len != 1 ) ||
- ( cache_ptr->max_pl_size != 64 * 1024 ) ||
- ( cache_ptr->max_pel_len != 0 ) ||
- ( cache_ptr->max_pel_size != 0 ) ||
- ( cache_ptr->calls_to_msic != 0 ) ||
- ( cache_ptr->total_entries_skipped_in_msic != 0 ) ||
- ( cache_ptr->total_entries_scanned_in_msic != 0 ) ||
- ( cache_ptr->max_entries_skipped_in_msic != 0 ) ||
- ( cache_ptr->max_entries_scanned_in_msic != 0 ) ||
- ( cache_ptr->entries_scanned_to_make_space != 0 ) ||
- ( cache_ptr->slist_scan_restarts != 0 ) ||
- ( cache_ptr->LRU_scan_restarts != 0 ) ||
- ( cache_ptr->index_scan_restarts != 0 ) ) {
-
- pass = FALSE;
+ if (pass) {
+
+ if ((cache_ptr->total_ht_insertions != 32) || (cache_ptr->total_ht_deletions != 0) ||
+ (cache_ptr->successful_ht_searches != 32) ||
+ (cache_ptr->total_successful_ht_search_depth != 96) || (cache_ptr->failed_ht_searches != 32) ||
+ (cache_ptr->total_failed_ht_search_depth != 48) || (cache_ptr->max_index_len != 32) ||
+ (cache_ptr->max_index_size != 2 * 1024 * 1024) || (cache_ptr->max_clean_index_size != 0) ||
+ (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->max_slist_len != 32) || (cache_ptr->max_slist_size != 2 * 1024 * 1024))) ||
+ (cache_ptr->max_pl_len != 1) || (cache_ptr->max_pl_size != 64 * 1024) ||
+ (cache_ptr->max_pel_len != 0) || (cache_ptr->max_pel_size != 0) ||
+ (cache_ptr->calls_to_msic != 0) || (cache_ptr->total_entries_skipped_in_msic != 0) ||
+ (cache_ptr->total_entries_scanned_in_msic != 0) ||
+ (cache_ptr->max_entries_skipped_in_msic != 0) || (cache_ptr->max_entries_scanned_in_msic != 0) ||
+ (cache_ptr->entries_scanned_to_make_space != 0) || (cache_ptr->slist_scan_restarts != 0) ||
+ (cache_ptr->LRU_scan_restarts != 0) || (cache_ptr->index_scan_restarts != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(2).";
} /* end if */
}
#if H5C_COLLECT_CACHE_ENTRY_STATS
- if(pass)
+ if (pass)
/* Note that most entry level stats are only updated on entry eviction */
- if((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1000000) || /* initial value */
- (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_size[MONSTER_ENTRY_TYPE] != 64 * 1024) ||
- (cache_ptr->max_pins[MONSTER_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if ((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1000000) || /* initial value */
+ (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_size[MONSTER_ENTRY_TYPE] != 64 * 1024) ||
+ (cache_ptr->max_pins[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster entry level stats in check_stats__smoke_check_1(2).";
} /* end if */
-#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
+#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
- if(pass) {
+ if (pass) {
/* protect and unprotect an entry that is not currently
* in the cache. Since the cache is full and all entries
* are dirty, this will force a flush of each entry, and
@@ -36378,86 +35318,73 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 32, H5C__DIRTIED_FLAG);
} /* end if */
- if(pass)
- if((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 33) ||
- (cache_ptr->read_protects[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_read_protects[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if (pass)
+ if ((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 32) || (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 1) ||
+ (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 33) ||
+ (cache_ptr->read_protects[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_read_protects[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 1) ||
+ (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(3).";
} /* end if */
- if ( pass ) {
-
- if ( ( cache_ptr->total_ht_insertions != 33 ) ||
- ( cache_ptr->total_ht_deletions != 1 ) ||
- ( cache_ptr->successful_ht_searches != 32 ) ||
- ( cache_ptr->total_successful_ht_search_depth != 96 ) ||
- ( cache_ptr->failed_ht_searches != 33 ) ||
- ( cache_ptr->total_failed_ht_search_depth != 52 ) ||
- ( cache_ptr->max_index_len != 32 ) ||
- ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) ||
- ( cache_ptr->max_clean_index_size != 2 * 1024 * 1024 ) ||
- ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->max_slist_len != 32 ) ||
- ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) ||
- ( cache_ptr->max_pl_len != 1 ) ||
- ( cache_ptr->max_pl_size != 64 * 1024 ) ||
- ( cache_ptr->max_pel_len != 0 ) ||
- ( cache_ptr->max_pel_size != 0 ) ||
- ( cache_ptr->calls_to_msic != 1 ) ||
- ( cache_ptr->total_entries_skipped_in_msic != 0 ) ||
- ( cache_ptr->total_entries_scanned_in_msic != 33 ) ||
- ( cache_ptr->max_entries_skipped_in_msic != 0 ) ||
- ( cache_ptr->max_entries_scanned_in_msic != 33 ) ||
- ( cache_ptr->entries_scanned_to_make_space != 33 ) ||
- ( cache_ptr->slist_scan_restarts != 0 ) ||
- ( cache_ptr->LRU_scan_restarts != 0 ) ||
- ( cache_ptr->index_scan_restarts != 0 ) ) {
-
- pass = FALSE;
+ if (pass) {
+
+ if ((cache_ptr->total_ht_insertions != 33) || (cache_ptr->total_ht_deletions != 1) ||
+ (cache_ptr->successful_ht_searches != 32) ||
+ (cache_ptr->total_successful_ht_search_depth != 96) || (cache_ptr->failed_ht_searches != 33) ||
+ (cache_ptr->total_failed_ht_search_depth != 52) || (cache_ptr->max_index_len != 32) ||
+ (cache_ptr->max_index_size != 2 * 1024 * 1024) ||
+ (cache_ptr->max_clean_index_size != 2 * 1024 * 1024) ||
+ (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->max_slist_len != 32) || (cache_ptr->max_slist_size != 2 * 1024 * 1024))) ||
+ (cache_ptr->max_pl_len != 1) || (cache_ptr->max_pl_size != 64 * 1024) ||
+ (cache_ptr->max_pel_len != 0) || (cache_ptr->max_pel_size != 0) ||
+ (cache_ptr->calls_to_msic != 1) || (cache_ptr->total_entries_skipped_in_msic != 0) ||
+ (cache_ptr->total_entries_scanned_in_msic != 33) ||
+ (cache_ptr->max_entries_skipped_in_msic != 0) || (cache_ptr->max_entries_scanned_in_msic != 33) ||
+ (cache_ptr->entries_scanned_to_make_space != 33) || (cache_ptr->slist_scan_restarts != 0) ||
+ (cache_ptr->LRU_scan_restarts != 0) || (cache_ptr->index_scan_restarts != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(3).";
} /* end if */
}
#if H5C_COLLECT_CACHE_ENTRY_STATS
- if(pass)
+ if (pass)
/* Note that most entry level stats are only updated on entry eviction */
- if((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_flushes[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->max_size[MONSTER_ENTRY_TYPE] != 64 * 1024) ||
- (cache_ptr->max_pins[MONSTER_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if ((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 1) ||
+ (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1) ||
+ (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_flushes[MONSTER_ENTRY_TYPE] != 1) ||
+ (cache_ptr->max_size[MONSTER_ENTRY_TYPE] != 64 * 1024) ||
+ (cache_ptr->max_pins[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster entry level stats in check_stats__smoke_check_1(3).";
} /* end if */
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
- if(pass) {
+ if (pass) {
/* protect and unprotect dirty (MET, 1), and then flush destroy
* the cache.
*/
@@ -36467,104 +35394,89 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
/* flush the cache to end the test and collect all entry stats */
- if ( pass ) {
+ if (pass) {
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
- "Cache flush invalidate failed in check_stats__smoke_check_1()")
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG,
+ "Cache flush invalidate failed in check_stats__smoke_check_1()")
- if ( ( pass ) &&
- ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ) ) {
+ if ((pass) && ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected cache len/size after check_stats__smoke_check_1()";
} /* end else-if */
- } /* end if */
-
- if(pass)
- if((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 33) ||
- (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 34) ||
- (cache_ptr->read_protects[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_read_protects[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 32) ||
- (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 34) ||
- (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 33) ||
- (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ } /* end if */
+
+ if (pass)
+ if ((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 33) || (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 1) ||
+ (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 34) ||
+ (cache_ptr->read_protects[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_read_protects[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 32) ||
+ (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 34) ||
+ (cache_ptr->evictions[MONSTER_ENTRY_TYPE] != 33) ||
+ (cache_ptr->take_ownerships[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_moves[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pins[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->unpins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->dirty_pins[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_flushes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->pinned_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_increases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->size_decreases[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->entry_flush_size_changes[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->cache_flush_size_changes[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(4).";
} /* end if */
- if ( pass ) {
-
- if ( ( cache_ptr->total_ht_insertions != 33 ) ||
- ( cache_ptr->total_ht_deletions != 33 ) ||
- ( cache_ptr->successful_ht_searches != 33 ) ||
- ( cache_ptr->total_successful_ht_search_depth != 99 ) ||
- ( cache_ptr->failed_ht_searches != 33 ) ||
- ( cache_ptr->total_failed_ht_search_depth != 52 ) ||
- ( cache_ptr->max_index_len != 32 ) ||
- ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) ||
- ( cache_ptr->max_clean_index_size != 2 * 1024 * 1024 ) ||
- ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) ||
- ( ( cache_ptr->slist_enabled ) &&
- ( ( cache_ptr->max_slist_len != 32 ) ||
- ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) ||
- ( cache_ptr->max_pl_len != 1 ) ||
- ( cache_ptr->max_pl_size != 64 * 1024 ) ||
- ( cache_ptr->max_pel_len != 0 ) ||
- ( cache_ptr->max_pel_size != 0 ) ||
- ( cache_ptr->calls_to_msic != 1 ) ||
- ( cache_ptr->total_entries_skipped_in_msic != 0 ) ||
- ( cache_ptr->total_entries_scanned_in_msic != 33 ) ||
- ( cache_ptr->max_entries_skipped_in_msic != 0 ) ||
- ( cache_ptr->max_entries_scanned_in_msic != 33 ) ||
- ( cache_ptr->entries_scanned_to_make_space != 33 ) ||
- ( cache_ptr->slist_scan_restarts != 0 ) ||
- ( cache_ptr->LRU_scan_restarts != 0 ) ||
- ( cache_ptr->index_scan_restarts != 0 ) ) {
-
- pass = FALSE;
+ if (pass) {
+
+ if ((cache_ptr->total_ht_insertions != 33) || (cache_ptr->total_ht_deletions != 33) ||
+ (cache_ptr->successful_ht_searches != 33) ||
+ (cache_ptr->total_successful_ht_search_depth != 99) || (cache_ptr->failed_ht_searches != 33) ||
+ (cache_ptr->total_failed_ht_search_depth != 52) || (cache_ptr->max_index_len != 32) ||
+ (cache_ptr->max_index_size != 2 * 1024 * 1024) ||
+ (cache_ptr->max_clean_index_size != 2 * 1024 * 1024) ||
+ (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) ||
+ ((cache_ptr->slist_enabled) &&
+ ((cache_ptr->max_slist_len != 32) || (cache_ptr->max_slist_size != 2 * 1024 * 1024))) ||
+ (cache_ptr->max_pl_len != 1) || (cache_ptr->max_pl_size != 64 * 1024) ||
+ (cache_ptr->max_pel_len != 0) || (cache_ptr->max_pel_size != 0) ||
+ (cache_ptr->calls_to_msic != 1) || (cache_ptr->total_entries_skipped_in_msic != 0) ||
+ (cache_ptr->total_entries_scanned_in_msic != 33) ||
+ (cache_ptr->max_entries_skipped_in_msic != 0) || (cache_ptr->max_entries_scanned_in_msic != 33) ||
+ (cache_ptr->entries_scanned_to_make_space != 33) || (cache_ptr->slist_scan_restarts != 0) ||
+ (cache_ptr->LRU_scan_restarts != 0) || (cache_ptr->index_scan_restarts != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(4).";
} /* end if */
}
#if H5C_COLLECT_CACHE_ENTRY_STATS
- if(pass)
+ if (pass)
/* Note that most entry level stats are only updated on entry eviction */
- if((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 2) ||
- (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1) ||
- (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) ||
- (cache_ptr->max_flushes[MONSTER_ENTRY_TYPE] != 2) ||
- (cache_ptr->max_size[MONSTER_ENTRY_TYPE] != 64 * 1024) ||
- (cache_ptr->max_pins[MONSTER_ENTRY_TYPE] != 0)) {
-
- pass = FALSE;
+ if ((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 2) ||
+ (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1) ||
+ (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) ||
+ (cache_ptr->max_flushes[MONSTER_ENTRY_TYPE] != 2) ||
+ (cache_ptr->max_size[MONSTER_ENTRY_TYPE] != 64 * 1024) ||
+ (cache_ptr->max_pins[MONSTER_ENTRY_TYPE] != 0)) {
+
+ pass = FALSE;
failure_mssg = "Unexpected monster entry level stats in check_stats__smoke_check_1(4).";
} /* end if */
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
- if(pass)
+ if (pass)
reset_entries();
- if(pass)
+ if (pass)
/* reset cache min clean size to its expected value */
cache_ptr->min_clean_size = (1 * 1024 * 1024);
@@ -36574,10 +35486,8 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
#endif /* H5C_COLLECT_CACHE_STATS */
-
/* Call back functions: */
-
/*-------------------------------------------------------------------------
*
* Function: check_if_write_permitted
@@ -36600,14 +35510,13 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
static herr_t
check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_ptr)
{
- HDassert( write_permitted_ptr );
+ HDassert(write_permitted_ptr);
*write_permitted_ptr = write_permitted;
- return(SUCCEED);
+ return (SUCCEED);
} /* check_write_permitted() */
-
/*****************************************************************************
*
* Function: setup_cache()
@@ -36641,146 +35550,140 @@ check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_pt
*****************************************************************************/
H5F_t *
-setup_cache(size_t max_cache_size,
- size_t min_clean_size,
- unsigned paged)
+setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged)
{
- char filename[512];
+ char filename[512];
hbool_t show_progress = FALSE;
- hbool_t verbose = TRUE;
- int mile_stone = 1;
- hid_t fid = -1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5F_t * ret_val = NULL;
+ hbool_t verbose = TRUE;
+ int mile_stone = 1;
+ hid_t fid = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5F_t * ret_val = NULL;
haddr_t actual_base_addr;
- hid_t fapl_id = H5P_DEFAULT;
- hid_t fcpl_id = H5P_DEFAULT;
+ hid_t fapl_id = H5P_DEFAULT;
+ hid_t fcpl_id = H5P_DEFAULT;
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
saved_fid = -1;
- if(pass) {
- if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) == FAIL) {
- pass = FALSE;
+ if (pass) {
+ if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) == FAIL) {
+ pass = FALSE;
failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
}
}
- if(pass && paged) {
+ if (pass && paged) {
/* Set up paged aggregation strategy */
- if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) == FAIL) {
- pass = FALSE;
+ if (H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) == FAIL) {
+ pass = FALSE;
failure_mssg = "H5Pset_file_space_strategy() failed.\n";
H5Pclose(fcpl_id);
- fcpl_id = H5P_DEFAULT;
+ fcpl_id = H5P_DEFAULT;
}
}
- if(pass && paged) {
+ if (pass && paged) {
/* Set up file space page size to BASE_ADDR */
- if(H5Pset_file_space_page_size(fcpl_id, (hsize_t)BASE_ADDR) == FAIL) {
- pass = FALSE;
+ if (H5Pset_file_space_page_size(fcpl_id, (hsize_t)BASE_ADDR) == FAIL) {
+ pass = FALSE;
failure_mssg = "H5Pset_file_space_page_size() failed.\n";
H5Pclose(fcpl_id);
- fcpl_id = H5P_DEFAULT;
+ fcpl_id = H5P_DEFAULT;
}
}
- if(pass)
+ if (pass)
saved_fcpl_id = fcpl_id;
/* setup the file name */
- if(pass) {
- if(NULL == h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))) {
- pass = FALSE;
+ if (pass) {
+ if (NULL == h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))) {
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass && try_core_file_driver) {
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL) {
- pass = FALSE;
- failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
+ if (pass && try_core_file_driver) {
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL) {
+ pass = FALSE;
+ failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
}
- else if(H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0) {
- H5Pclose(fapl_id);
- fapl_id = H5P_DEFAULT;
- pass = FALSE;
- failure_mssg = "H5P_set_fapl_core() failed.\n";
+ else if (H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0) {
+ H5Pclose(fapl_id);
+ fapl_id = H5P_DEFAULT;
+ pass = FALSE;
+ failure_mssg = "H5P_set_fapl_core() failed.\n";
}
- else if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) {
- core_file_driver_failed = TRUE;
+ else if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) {
+ core_file_driver_failed = TRUE;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", FUNC);
- } else {
- saved_fapl_id = fapl_id;
- }
+ }
+ else {
+ saved_fapl_id = fapl_id;
+ }
}
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
/* if we either aren't using the core file driver, or a create
* with the core file driver failed, try again with a regular file.
* If this fails, we are cooked.
*/
- if(pass && fid < 0) {
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ if (pass && fid < 0) {
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
saved_fid = fid;
- if(fid < 0) {
- pass = FALSE;
+ if (fid < 0) {
+ pass = FALSE;
failure_mssg = "H5Fcreate() failed.";
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: H5Fcreate() failed.\n", FUNC);
} /* end if */
- } /* end if */
+ } /* end if */
/* Push API context */
H5CX_push();
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
HDassert(fid >= 0);
saved_fid = fid;
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
- pass = FALSE;
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
+ pass = FALSE;
failure_mssg = "H5Fflush() failed.";
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
}
else {
file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE);
- if(file_ptr == NULL) {
- pass = FALSE;
+ if (file_ptr == NULL) {
+ pass = FALSE;
failure_mssg = "Can't get file_ptr.";
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
}
}
}
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* A bit of fancy footwork here:
*
@@ -36811,75 +35714,67 @@ setup_cache(size_t max_cache_size,
*/
HDassert(saved_cache == NULL);
- saved_cache = file_ptr->shared->cache;
+ saved_cache = file_ptr->shared->cache;
file_ptr->shared->cache = NULL;
- cache_ptr = H5C_create(max_cache_size,
- min_clean_size,
- (NUMBER_OF_ENTRY_TYPES - 1),
- types,
- check_write_permitted,
- TRUE,
- NULL,
- NULL);
+ cache_ptr = H5C_create(max_cache_size, min_clean_size, (NUMBER_OF_ENTRY_TYPES - 1), types,
+ check_write_permitted, TRUE, NULL, NULL);
file_ptr->shared->cache = cache_ptr;
}
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
- if(cache_ptr == NULL) {
- pass = FALSE;
+ if (pass) {
+ if (cache_ptr == NULL) {
+ pass = FALSE;
failure_mssg = "H5C_create() failed.";
- if(verbose)
- HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC);
+ if (verbose)
+ HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC);
}
- else if(cache_ptr->magic != H5C__H5C_T_MAGIC) {
- pass = FALSE;
+ else if (cache_ptr->magic != H5C__H5C_T_MAGIC) {
+ pass = FALSE;
failure_mssg = "Bad cache_ptr magic.";
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC);
}
}
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) { /* allocate space for test entries */
+ if (pass) { /* allocate space for test entries */
actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
- if(actual_base_addr == HADDR_UNDEF) {
- pass = FALSE;
- failure_mssg = "H5MF_alloc() failed.";
+ if (actual_base_addr == HADDR_UNDEF) {
+ pass = FALSE;
+ failure_mssg = "H5MF_alloc() failed.";
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", FUNC);
- } else if(actual_base_addr > BASE_ADDR) {
- /* If this happens, must increase BASE_ADDR so that the
- * actual_base_addr is <= BASE_ADDR. This should only happen
- * if the size of the superblock is increase.
- */
- pass = FALSE;
- failure_mssg = "actual_base_addr > BASE_ADDR";
+ }
+ else if (actual_base_addr > BASE_ADDR) {
+ /* If this happens, must increase BASE_ADDR so that the
+ * actual_base_addr is <= BASE_ADDR. This should only happen
+ * if the size of the superblock is increase.
+ */
+ pass = FALSE;
+ failure_mssg = "actual_base_addr > BASE_ADDR";
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", FUNC);
}
saved_actual_base_addr = actual_base_addr;
}
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- if(pass) {
+ if (pass) {
/* Need to set this else all cache tests will fail */
cache_ptr->ignore_tags = TRUE;
@@ -36887,14 +35782,12 @@ setup_cache(size_t max_cache_size,
ret_val = file_ptr;
}
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
+ if (show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass);
- return(ret_val);
+ return (ret_val);
} /* setup_cache() */
-
/*-------------------------------------------------------------------------
* Function: takedown_cache()
*
@@ -36913,23 +35806,21 @@ setup_cache(size_t max_cache_size,
*/
void
-takedown_cache(H5F_t * file_ptr,
- hbool_t dump_stats,
- hbool_t dump_detailed_stats)
+takedown_cache(H5F_t *file_ptr, hbool_t dump_stats, hbool_t dump_detailed_stats)
{
char filename[512];
- if ( file_ptr != NULL ) {
- H5C_t * cache_ptr = file_ptr->shared->cache;
+ if (file_ptr != NULL) {
+ H5C_t *cache_ptr = file_ptr->shared->cache;
- if ( dump_stats ) {
+ if (dump_stats) {
H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
}
- if ( H5C_prep_for_file_close(file_ptr) < 0 ) {
+ if (H5C_prep_for_file_close(file_ptr) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unexpected failure of prep for file close.\n";
}
@@ -36937,67 +35828,63 @@ takedown_cache(H5F_t * file_ptr,
H5C_dest(file_ptr);
- if ( saved_cache != NULL ) {
+ if (saved_cache != NULL) {
file_ptr->shared->cache = saved_cache;
- saved_cache = NULL;
+ saved_cache = NULL;
}
-
}
- if ( saved_fapl_id != H5P_DEFAULT ) {
+ if (saved_fapl_id != H5P_DEFAULT) {
H5Pclose(saved_fapl_id);
saved_fapl_id = H5P_DEFAULT;
}
- if ( saved_fcpl_id != H5P_DEFAULT ) {
+ if (saved_fcpl_id != H5P_DEFAULT) {
H5Pclose(saved_fcpl_id);
saved_fcpl_id = H5P_DEFAULT;
}
- if ( saved_fid != -1 ) {
+ if (saved_fid != -1) {
- if ( H5F_addr_defined(saved_actual_base_addr) ) {
+ if (H5F_addr_defined(saved_actual_base_addr)) {
- if ( NULL == file_ptr ) {
+ if (NULL == file_ptr) {
file_ptr = (H5F_t *)H5VL_object_verify(saved_fid, H5I_FILE);
- HDassert ( file_ptr );
+ HDassert(file_ptr);
}
H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, saved_actual_base_addr,
- (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
+ (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
saved_actual_base_addr = HADDR_UNDEF;
}
- if ( H5Fclose(saved_fid) < 0 ) {
+ if (H5Fclose(saved_fid) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "couldn't close test file.";
-
- } else {
+ }
+ else {
saved_fid = -1;
-
}
/* Pop API context */
H5CX_pop();
- if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) {
+ if ((!try_core_file_driver) || (core_file_driver_failed)) {
- if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "couldn't delete test file.";
-
}
}
}
@@ -37022,7 +35909,7 @@ main(void)
{
unsigned nerrs = 0;
unsigned paged;
- int express_test;
+ int express_test;
H5open();
@@ -37033,7 +35920,7 @@ main(void)
HDprintf(" express_test = %d\n", express_test);
HDprintf("=========================================\n");
- if(create_entry_arrays() < 0) {
+ if (create_entry_arrays() < 0) {
HDprintf("ERROR: Unable to create entries arrays. Aborting.\n");
return EXIT_FAILURE;
@@ -37041,14 +35928,13 @@ main(void)
/* Test with paged aggregation enabled or not */
/* Each test will call setup_cache() which set up the file space strategy according to "paged" */
- for(paged = FALSE; paged <= TRUE; paged++) {
+ for (paged = FALSE; paged <= TRUE; paged++) {
- if ( paged ) {
+ if (paged) {
- HDfprintf(stdout,
- "\n\nRe-running tests with paged aggregation:\n");
+ HDfprintf(stdout, "\n\nRe-running tests with paged aggregation:\n");
- if ( express_test > 0 )
+ if (express_test > 0)
HDfprintf(stdout, " Skipping smoke checks.\n");
HDfprintf(stdout, "\n");
@@ -37112,10 +35998,9 @@ main(void)
/* can't fail, returns void */
free_entry_arrays();
- if(nerrs > 0)
+ if (nerrs > 0)
return EXIT_FAILURE;
else
return EXIT_SUCCESS;
} /* main() */
-
diff --git a/test/cache_api.c b/test/cache_api.c
index ca2e0ca..acdb4ba 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -24,23 +24,18 @@
/* global variable declarations: */
-const char *FILENAME[] = {
- "cache_api_test",
- NULL
-};
+const char *FILENAME[] = {"cache_api_test", NULL};
/* macro definitions */
/* private function declarations: */
-static hbool_t check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id);
-static hbool_t check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id);
-static hbool_t mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id);
-static H5AC_cache_config_t * init_invalid_configs(void);
-static hbool_t check_fapl_mdc_api_errs(void);
-static hbool_t check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id);
-
-
+static hbool_t check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id);
+static hbool_t check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id);
+static hbool_t mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id);
+static H5AC_cache_config_t *init_invalid_configs(void);
+static hbool_t check_fapl_mdc_api_errs(void);
+static hbool_t check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id);
/**************************************************************************/
/**************************************************************************/
@@ -69,54 +64,52 @@ static hbool_t check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id);
static hbool_t
check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
{
- char filename[512];
- herr_t result;
- hid_t fapl_id = -1;
- hid_t test_fapl_id = -1;
- hid_t file_id = -1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ char filename[512];
+ herr_t result;
+ hid_t fapl_id = -1;
+ hid_t test_fapl_id = -1;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
- H5AC_cache_config_t mod_config =
- {
- /* int version = */ H5AC__CURR_CACHE_CONFIG_VERSION,
- /* hbool_t rpt_fcn_enabled = */ FALSE,
- /* hbool_t open_trace_file = */ FALSE,
- /* hbool_t close_trace_file = */ FALSE,
- /* char trace_file_name[] = */ "",
- /* hbool_t evictions_enabled = */ TRUE,
- /* hbool_t set_initial_size = */ TRUE,
- /* size_t initial_size = */ (1 * 1024 * 1024 + 1),
- /* double min_clean_fraction = */ 0.2f,
- /* size_t max_size = */ (16 * 1024 * 1024 + 1),
- /* size_t min_size = */ ( 1 * 1024 * 1024 + 1),
- /* long int epoch_length = */ 50001,
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
- /* double lower_hr_threshold = */ 0.91f,
- /* double increment = */ 2.1f,
- /* hbool_t apply_max_increment = */ TRUE,
- /* size_t max_increment = */ (4 * 1024 * 1024 + 1),
- /* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
- /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out,
- /* double upper_hr_threshold = */ 0.998f,
- /* double decrement = */ 0.91f,
- /* hbool_t apply_max_decrement = */ TRUE,
- /* size_t max_decrement = */ (1 * 1024 * 1024 - 1),
- /* int epochs_before_eviction = */ 4,
- /* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f,
- /* int dirty_bytes_threshold = */ (256 * 1024),
- /* int metadata_write_strategy = */
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY
- };
+ H5AC_cache_config_t mod_config = {
+ /* int version = */ H5AC__CURR_CACHE_CONFIG_VERSION,
+ /* hbool_t rpt_fcn_enabled = */ FALSE,
+ /* hbool_t open_trace_file = */ FALSE,
+ /* hbool_t close_trace_file = */ FALSE,
+ /* char trace_file_name[] = */ "",
+ /* hbool_t evictions_enabled = */ TRUE,
+ /* hbool_t set_initial_size = */ TRUE,
+ /* size_t initial_size = */ (1 * 1024 * 1024 + 1),
+ /* double min_clean_fraction = */ 0.2f,
+ /* size_t max_size = */ (16 * 1024 * 1024 + 1),
+ /* size_t min_size = */ (1 * 1024 * 1024 + 1),
+ /* long int epoch_length = */ 50001,
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
+ /* double lower_hr_threshold = */ 0.91f,
+ /* double increment = */ 2.1f,
+ /* hbool_t apply_max_increment = */ TRUE,
+ /* size_t max_increment = */ (4 * 1024 * 1024 + 1),
+ /* enum H5C_cache_flash_incr_mode */
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
+ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out,
+ /* double upper_hr_threshold = */ 0.998f,
+ /* double decrement = */ 0.91f,
+ /* hbool_t apply_max_decrement = */ TRUE,
+ /* size_t max_decrement = */ (1 * 1024 * 1024 - 1),
+ /* int epochs_before_eviction = */ 4,
+ /* hbool_t apply_empty_reserve = */ TRUE,
+ /* double empty_reserve = */ 0.05f,
+ /* int dirty_bytes_threshold = */ (256 * 1024),
+ /* int metadata_write_strategy = */
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
H5AC_cache_config_t scratch;
H5C_auto_size_ctl_t default_auto_size_ctl;
H5C_auto_size_ctl_t mod_auto_size_ctl;
- if(paged)
+ if (paged)
TESTING("MDC/FAPL related API calls for paged aggregation strategy")
else
TESTING("MDC/FAPL related API calls")
@@ -130,74 +123,73 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
* initial mdc configuration
*/
- if ( pass ) {
+ if (pass) {
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if ( fapl_id < 0 ) {
+ if (fapl_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
}
}
- if ( pass ) {
+ if (pass) {
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
result = H5Pget_mdc_config(fapl_id, &scratch);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pget_mdc_config() failed.\n";
+ }
+ else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) {
- } else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "retrieved config doesn't match default.";
}
}
-
/* Modify the initial mdc configuration in a FAPL, and verify that
* the changes can be read back
*/
- if ( pass ) {
+ if (pass) {
result = H5Pset_mdc_config(fapl_id, &mod_config);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_mdc_config() failed.\n";
}
}
- if ( pass ) {
+ if (pass) {
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
result = H5Pget_mdc_config(fapl_id, &scratch);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pget_mdc_config() failed.\n";
+ }
+ else if (!CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE)) {
- } else if ( ! CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE) ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "retrieved config doesn't match mod config.";
}
}
- if ( pass ) {
+ if (pass) {
- if ( H5Pclose(fapl_id) < 0 ) {
+ if (H5Pclose(fapl_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pclose() failed.\n";
}
}
@@ -210,75 +202,72 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
*/
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
/* create the file using the default FAPL */
- if ( pass ) {
+ if (pass) {
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
- if ( file_id < 0 ) {
+ if (file_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fcreate() failed.\n";
}
}
/* get a pointer to the files internal data structure */
- if ( pass ) {
+ if (pass) {
file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't get file_ptr.\n";
-
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
}
/* verify that we can access the internal version of the cache config */
- if ( pass ) {
+ if (pass) {
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ||
- ( cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER ) ){
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC) ||
+ (cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't access cache resize_ctl.\n";
}
}
/* conpare the cache's internal configuration with the expected value */
- if ( pass ) {
+ if (pass) {
- if ( ! resize_configs_are_equal(&default_auto_size_ctl, \
- &cache_ptr->resize_ctl, TRUE) ) {
+ if (!resize_configs_are_equal(&default_auto_size_ctl, &cache_ptr->resize_ctl, TRUE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected value(s) in cache resize_ctl 1.\n";
}
}
/* get a copy of the files FAPL */
- if ( pass ) {
+ if (pass) {
fapl_id = H5Fget_access_plist(file_id);
- if ( fapl_id < 0 ) {
+ if (fapl_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_access_plist() failed.\n";
}
}
@@ -286,45 +275,44 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
/* compare the initial cache config from the copy of the file's FAPL
* to the expected value. If all goes well, close the copy of the FAPL.
*/
- if ( pass ) {
+ if (pass) {
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
result = H5Pget_mdc_config(fapl_id, &scratch);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pget_mdc_config() failed.\n";
+ }
+ else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) {
- } else if (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "config retrieved from file doesn't match default.";
+ }
+ else if (H5Pclose(fapl_id) < 0) {
- } else if ( H5Pclose(fapl_id) < 0 ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pclose() failed.\n";
}
}
/* close the file and delete it */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
+ }
+ else if (HDremove(filename) < 0) {
- } else if ( HDremove(filename) < 0 ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
-
/* Open a file using a FAPL with a modified initial metadata cache
* configuration. Verify that the resulting metadata cache uses the
* modified configuration as well. Get a copy of the FAPL from the
@@ -333,100 +321,97 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
*/
/* Create a FAPL */
- if ( pass ) {
+ if (pass) {
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if ( fapl_id < 0 ) {
+ if (fapl_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
}
}
/* Modify the initial mdc configuration in the FAPL. */
- if ( pass ) {
+ if (pass) {
result = H5Pset_mdc_config(fapl_id, &mod_config);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_mdc_config() failed.\n";
}
}
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
/* create the file using the modified FAPL */
- if ( pass ) {
+ if (pass) {
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
- if ( file_id < 0 ) {
+ if (file_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fcreate() failed.\n";
}
}
/* get a pointer to the files internal data structure */
- if ( pass ) {
+ if (pass) {
file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't get file_ptr.\n";
-
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
}
/* verify that we can access the internal version of the cache config */
- if ( pass ) {
+ if (pass) {
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ||
- ( cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER ) ){
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC) ||
+ (cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't access cache resize_ctl.\n";
}
}
/* conpare the cache's internal configuration with the expected value */
- if ( pass ) {
+ if (pass) {
- if ( ! resize_configs_are_equal(&mod_auto_size_ctl, \
- &cache_ptr->resize_ctl, TRUE) ) {
+ if (!resize_configs_are_equal(&mod_auto_size_ctl, &cache_ptr->resize_ctl, TRUE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected value(s) in cache resize_ctl 2.\n";
}
}
/* get a copy of the files FAPL */
- if ( pass ) {
+ if (pass) {
test_fapl_id = H5Fget_access_plist(file_id);
- if ( test_fapl_id < 0 ) {
+ if (test_fapl_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_access_plist() failed.\n";
}
}
@@ -434,64 +419,64 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
/* compare the initial cache config from the copy of the file's FAPL
* to the expected value. If all goes well, close the copy of the FAPL.
*/
- if ( pass ) {
+ if (pass) {
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
result = H5Pget_mdc_config(test_fapl_id, &scratch);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pget_mdc_config() failed.\n";
+ }
+ else if (!CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE)) {
- } else if ( ! CACHE_CONFIGS_EQUAL(mod_config, scratch, TRUE, TRUE) ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "config retrieved from file doesn't match.";
+ }
+ else if (H5Pclose(test_fapl_id) < 0) {
- } else if ( H5Pclose(test_fapl_id) < 0 ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pclose() failed.\n";
}
}
/* close the fapl used to create the file */
- if ( pass ) {
+ if (pass) {
- if ( H5Pclose(fapl_id) < 0 ) {
+ if (H5Pclose(fapl_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pclose() failed.\n";
}
}
/* close the file and delete it */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
+ }
+ else if (HDremove(filename) < 0) {
- } else if ( HDremove(filename) < 0 ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) {
+ if (pass) {
PASSED();
-
- } else {
+ }
+ else {
H5_FAILED();
}
- if ( ! pass ) {
+ if (!pass) {
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
@@ -500,7 +485,6 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
} /* check_fapl_mdc_api_calls() */
-
/*-------------------------------------------------------------------------
* Function: check_file_mdc_api_calls()
*
@@ -525,157 +509,149 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
static hbool_t
check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
{
- char filename[512];
- hid_t file_id = -1;
- size_t max_size;
- size_t min_clean_size;
- size_t cur_size;
- int cur_num_entries;
- double hit_rate;
+ char filename[512];
+ hid_t file_id = -1;
+ size_t max_size;
+ size_t min_clean_size;
+ size_t cur_size;
+ int cur_num_entries;
+ double hit_rate;
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
- H5AC_cache_config_t mod_config_1 =
- {
- /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
- /* hbool_t rpt_fcn_enabled = */ FALSE,
- /* hbool_t open_trace_file = */ FALSE,
- /* hbool_t close_trace_file = */ FALSE,
- /* char trace_file_name[] = */ "",
- /* hbool_t evictions_enabled = */ TRUE,
- /* hbool_t set_initial_size = */ TRUE,
- /* size_t initial_size = */ (1 * 1024 * 1024 + 1),
- /* double min_clean_fraction = */ 0.2f,
- /* size_t max_size = */ (16 * 1024 * 1024 + 1),
- /* size_t min_size = */ ( 1 * 1024 * 1024 + 1),
- /* long int epoch_length = */ 50001,
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
- /* double lower_hr_threshold = */ 0.91f,
- /* double increment = */ 2.1f,
- /* hbool_t apply_max_increment = */ TRUE,
- /* size_t max_increment = */ (4 * 1024 * 1024 + 1),
- /* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
- /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out,
- /* double upper_hr_threshold = */ 0.998f,
- /* double decrement = */ 0.91f,
- /* hbool_t apply_max_decrement = */ TRUE,
- /* size_t max_decrement = */ (1 * 1024 * 1024 - 1),
- /* int epochs_before_eviction = */ 4,
- /* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f,
- /* int dirty_bytes_threshold = */ (256 * 1024),
- /* int metadata_write_strategy = */
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY
- };
- H5AC_cache_config_t mod_config_2 =
- {
- /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
- /* hbool_t rpt_fcn_enabled = */ TRUE,
- /* hbool_t open_trace_file = */ FALSE,
- /* hbool_t close_trace_file = */ FALSE,
- /* char trace_file_name[] = */ "",
- /* hbool_t evictions_enabled = */ TRUE,
- /* hbool_t set_initial_size = */ TRUE,
- /* size_t initial_size = */ (512 * 1024),
- /* double min_clean_fraction = */ 0.1f,
- /* size_t max_size = */ ( 8 * 1024 * 1024),
- /* size_t min_size = */ ( 512 * 1024),
- /* long int epoch_length = */ 25000,
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
- /* double lower_hr_threshold = */ 0.9f,
- /* double increment = */ 2.0f,
- /* hbool_t apply_max_increment = */ TRUE,
- /* size_t max_increment = */ (2 * 1024 * 1024),
- /* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 1.5f,
- /* double flash_threshold = */ 0.4f,
- /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
- /* double upper_hr_threshold = */ 0.9995f,
- /* double decrement = */ 0.95f,
- /* hbool_t apply_max_decrement = */ TRUE,
- /* size_t max_decrement = */ (512 * 1024),
- /* int epochs_before_eviction = */ 4,
- /* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f,
- /* int dirty_bytes_threshold = */ (256 * 1024),
- /* int metadata_write_strategy = */
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY
- };
- H5AC_cache_config_t mod_config_3 =
- {
- /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
- /* hbool_t rpt_fcn_enabled = */ FALSE,
- /* hbool_t open_trace_file = */ FALSE,
- /* hbool_t close_trace_file = */ FALSE,
- /* char trace_file_name[] = */ "",
- /* hbool_t evictions_enabled = */ TRUE,
- /* hbool_t set_initial_size = */ TRUE,
- /* size_t initial_size = */ (1 * 1024 * 1024),
- /* double min_clean_fraction = */ 0.2f,
- /* size_t max_size = */ (16 * 1024 * 1024),
- /* size_t min_size = */ ( 1 * 1024 * 1024),
- /* long int epoch_length = */ 50000,
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
- /* double lower_hr_threshold = */ 0.90f,
- /* double increment = */ 2.0f,
- /* hbool_t apply_max_increment = */ TRUE,
- /* size_t max_increment = */ (4 * 1024 * 1024),
- /* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.1f,
- /* double flash_threshold = */ 0.6f,
- /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
- /* double upper_hr_threshold = */ 0.999f,
- /* double decrement = */ 0.9f,
- /* hbool_t apply_max_decrement = */ FALSE,
- /* size_t max_decrement = */ (1 * 1024 * 1024 - 1),
- /* int epochs_before_eviction = */ 3,
- /* hbool_t apply_empty_reserve = */ FALSE,
- /* double empty_reserve = */ 0.05f,
- /* int dirty_bytes_threshold = */ (256 * 1024),
- /* int metadata_write_strategy = */
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY
- };
- H5AC_cache_config_t mod_config_4 =
- {
- /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
- /* hbool_t rpt_fcn_enabled = */ FALSE,
- /* hbool_t open_trace_file = */ FALSE,
- /* hbool_t close_trace_file = */ FALSE,
- /* char trace_file_name[] = */ "",
- /* hbool_t evictions_enabled = */ TRUE,
- /* hbool_t set_initial_size = */ TRUE,
- /* size_t initial_size = */ (1 * 1024 * 1024),
- /* double min_clean_fraction = */ 0.15f,
- /* size_t max_size = */ (20 * 1024 * 1024),
- /* size_t min_size = */ ( 1 * 1024 * 1024),
- /* long int epoch_length = */ 75000,
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
- /* double lower_hr_threshold = */ 0.9f,
- /* double increment = */ 2.0f,
- /* hbool_t apply_max_increment = */ TRUE,
- /* size_t max_increment = */ (2 * 1024 * 1024),
- /* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 1.1f,
- /* double flash_threshold = */ 0.3f,
- /* enum H5C_cache_decr_mode decr_mode = */
- H5C_decr__age_out_with_threshold,
- /* double upper_hr_threshold = */ 0.999f,
- /* double decrement = */ 0.9f,
- /* hbool_t apply_max_decrement = */ TRUE,
- /* size_t max_decrement = */ (1 * 1024 * 1024),
- /* int epochs_before_eviction = */ 3,
- /* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.1f,
- /* int dirty_bytes_threshold = */ (256 * 1024),
- /* int metadata_write_strategy = */
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY
- };
-
- if(paged)
+ H5AC_cache_config_t mod_config_1 = {
+ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
+ /* hbool_t rpt_fcn_enabled = */ FALSE,
+ /* hbool_t open_trace_file = */ FALSE,
+ /* hbool_t close_trace_file = */ FALSE,
+ /* char trace_file_name[] = */ "",
+ /* hbool_t evictions_enabled = */ TRUE,
+ /* hbool_t set_initial_size = */ TRUE,
+ /* size_t initial_size = */ (1 * 1024 * 1024 + 1),
+ /* double min_clean_fraction = */ 0.2f,
+ /* size_t max_size = */ (16 * 1024 * 1024 + 1),
+ /* size_t min_size = */ (1 * 1024 * 1024 + 1),
+ /* long int epoch_length = */ 50001,
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
+ /* double lower_hr_threshold = */ 0.91f,
+ /* double increment = */ 2.1f,
+ /* hbool_t apply_max_increment = */ TRUE,
+ /* size_t max_increment = */ (4 * 1024 * 1024 + 1),
+ /* enum H5C_cache_flash_incr_mode */
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
+ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out,
+ /* double upper_hr_threshold = */ 0.998f,
+ /* double decrement = */ 0.91f,
+ /* hbool_t apply_max_decrement = */ TRUE,
+ /* size_t max_decrement = */ (1 * 1024 * 1024 - 1),
+ /* int epochs_before_eviction = */ 4,
+ /* hbool_t apply_empty_reserve = */ TRUE,
+ /* double empty_reserve = */ 0.05f,
+ /* int dirty_bytes_threshold = */ (256 * 1024),
+ /* int metadata_write_strategy = */
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+ H5AC_cache_config_t mod_config_2 = {
+ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
+ /* hbool_t rpt_fcn_enabled = */ TRUE,
+ /* hbool_t open_trace_file = */ FALSE,
+ /* hbool_t close_trace_file = */ FALSE,
+ /* char trace_file_name[] = */ "",
+ /* hbool_t evictions_enabled = */ TRUE,
+ /* hbool_t set_initial_size = */ TRUE,
+ /* size_t initial_size = */ (512 * 1024),
+ /* double min_clean_fraction = */ 0.1f,
+ /* size_t max_size = */ (8 * 1024 * 1024),
+ /* size_t min_size = */ (512 * 1024),
+ /* long int epoch_length = */ 25000,
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
+ /* double lower_hr_threshold = */ 0.9f,
+ /* double increment = */ 2.0f,
+ /* hbool_t apply_max_increment = */ TRUE,
+ /* size_t max_increment = */ (2 * 1024 * 1024),
+ /* enum H5C_cache_flash_incr_mode */
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 1.5f,
+ /* double flash_threshold = */ 0.4f,
+ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
+ /* double upper_hr_threshold = */ 0.9995f,
+ /* double decrement = */ 0.95f,
+ /* hbool_t apply_max_decrement = */ TRUE,
+ /* size_t max_decrement = */ (512 * 1024),
+ /* int epochs_before_eviction = */ 4,
+ /* hbool_t apply_empty_reserve = */ TRUE,
+ /* double empty_reserve = */ 0.05f,
+ /* int dirty_bytes_threshold = */ (256 * 1024),
+ /* int metadata_write_strategy = */
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+ H5AC_cache_config_t mod_config_3 = {
+ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
+ /* hbool_t rpt_fcn_enabled = */ FALSE,
+ /* hbool_t open_trace_file = */ FALSE,
+ /* hbool_t close_trace_file = */ FALSE,
+ /* char trace_file_name[] = */ "",
+ /* hbool_t evictions_enabled = */ TRUE,
+ /* hbool_t set_initial_size = */ TRUE,
+ /* size_t initial_size = */ (1 * 1024 * 1024),
+ /* double min_clean_fraction = */ 0.2f,
+ /* size_t max_size = */ (16 * 1024 * 1024),
+ /* size_t min_size = */ (1 * 1024 * 1024),
+ /* long int epoch_length = */ 50000,
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
+ /* double lower_hr_threshold = */ 0.90f,
+ /* double increment = */ 2.0f,
+ /* hbool_t apply_max_increment = */ TRUE,
+ /* size_t max_increment = */ (4 * 1024 * 1024),
+ /* enum H5C_cache_flash_incr_mode */
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.1f,
+ /* double flash_threshold = */ 0.6f,
+ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
+ /* double upper_hr_threshold = */ 0.999f,
+ /* double decrement = */ 0.9f,
+ /* hbool_t apply_max_decrement = */ FALSE,
+ /* size_t max_decrement = */ (1 * 1024 * 1024 - 1),
+ /* int epochs_before_eviction = */ 3,
+ /* hbool_t apply_empty_reserve = */ FALSE,
+ /* double empty_reserve = */ 0.05f,
+ /* int dirty_bytes_threshold = */ (256 * 1024),
+ /* int metadata_write_strategy = */
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+ H5AC_cache_config_t mod_config_4 = {
+ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
+ /* hbool_t rpt_fcn_enabled = */ FALSE,
+ /* hbool_t open_trace_file = */ FALSE,
+ /* hbool_t close_trace_file = */ FALSE,
+ /* char trace_file_name[] = */ "",
+ /* hbool_t evictions_enabled = */ TRUE,
+ /* hbool_t set_initial_size = */ TRUE,
+ /* size_t initial_size = */ (1 * 1024 * 1024),
+ /* double min_clean_fraction = */ 0.15f,
+ /* size_t max_size = */ (20 * 1024 * 1024),
+ /* size_t min_size = */ (1 * 1024 * 1024),
+ /* long int epoch_length = */ 75000,
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold,
+ /* double lower_hr_threshold = */ 0.9f,
+ /* double increment = */ 2.0f,
+ /* hbool_t apply_max_increment = */ TRUE,
+ /* size_t max_increment = */ (2 * 1024 * 1024),
+ /* enum H5C_cache_flash_incr_mode */
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 1.1f,
+ /* double flash_threshold = */ 0.3f,
+ /* enum H5C_cache_decr_mode decr_mode = */
+ H5C_decr__age_out_with_threshold,
+ /* double upper_hr_threshold = */ 0.999f,
+ /* double decrement = */ 0.9f,
+ /* hbool_t apply_max_decrement = */ TRUE,
+ /* size_t max_decrement = */ (1 * 1024 * 1024),
+ /* int epochs_before_eviction = */ 3,
+ /* hbool_t apply_empty_reserve = */ TRUE,
+ /* double empty_reserve = */ 0.1f,
+ /* int dirty_bytes_threshold = */ (256 * 1024),
+ /* int metadata_write_strategy = */
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+
+ if (paged)
TESTING("MDC/FILE related API calls for paged aggregation strategy")
else
TESTING("MDC/FILE related API calls")
@@ -691,24 +667,23 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
*/
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
/* create the file using the default FAPL */
- if ( pass ) {
+ if (pass) {
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
- if ( file_id < 0 ) {
+ if (file_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fcreate() failed.\n";
}
}
@@ -717,11 +692,11 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
validate_mdc_config(file_id, &default_config, TRUE, 1);
/* set alternate config 1 */
- if ( pass ) {
+ if (pass) {
- if ( H5Fset_mdc_config(file_id, &mod_config_1) < 0 ) {
+ if (H5Fset_mdc_config(file_id, &mod_config_1) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fset_mdc_config() failed 1.\n";
}
}
@@ -730,11 +705,11 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
validate_mdc_config(file_id, &mod_config_1, TRUE, 2);
/* set alternate config 2 */
- if ( pass ) {
+ if (pass) {
- if ( H5Fset_mdc_config(file_id, &mod_config_2) < 0 ) {
+ if (H5Fset_mdc_config(file_id, &mod_config_2) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fset_mdc_config() failed 2.\n";
}
}
@@ -743,11 +718,11 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
validate_mdc_config(file_id, &mod_config_2, TRUE, 3);
/* set alternate config 3 */
- if ( pass ) {
+ if (pass) {
- if ( H5Fset_mdc_config(file_id, &mod_config_3) < 0 ) {
+ if (H5Fset_mdc_config(file_id, &mod_config_3) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fset_mdc_config() failed 3.\n";
}
}
@@ -756,11 +731,11 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
validate_mdc_config(file_id, &mod_config_3, TRUE, 4);
/* set alternate config 4 */
- if ( pass ) {
+ if (pass) {
- if ( H5Fset_mdc_config(file_id, &mod_config_4) < 0 ) {
+ if (H5Fset_mdc_config(file_id, &mod_config_4) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fset_mdc_config() failed 4.\n";
}
}
@@ -768,25 +743,22 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
/* verify that the cache is now set to the alternate config */
validate_mdc_config(file_id, &mod_config_4, TRUE, 5);
-
/* Run some quick smoke checks on the cache status monitoring
* calls -- no interesting data as the cache hasn't had a
* chance to do much yet.
*/
- if ( pass ) {
+ if (pass) {
- if ( H5Fget_mdc_hit_rate(file_id, &hit_rate) < 0 ) {
+ if (H5Fget_mdc_hit_rate(file_id, &hit_rate) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_hit_rate() failed 1.\n";
+ }
+ else if (!H5_DBL_ABS_EQUAL(hit_rate, (double)0.0f)) {
- } else if ( !H5_DBL_ABS_EQUAL(hit_rate, (double)0.0f) ) {
-
- pass = FALSE;
- failure_mssg =
- "H5Fget_mdc_hit_rate() returned unexpected hit rate.\n";
-
+ pass = FALSE;
+ failure_mssg = "H5Fget_mdc_hit_rate() returned unexpected hit rate.\n";
}
#if 0 /* this may be useful now and then -- keep it around */
else {
@@ -798,21 +770,18 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
#endif
}
- if ( pass ) {
+ if (pass) {
- if ( H5Fget_mdc_size(file_id, &max_size, &min_clean_size,
- &cur_size, &cur_num_entries) < 0 ) {
+ if (H5Fget_mdc_size(file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_size() failed 1.\n";
+ }
+ else if ((mod_config_4.initial_size != max_size) ||
+ (min_clean_size != (size_t)((double)max_size * mod_config_4.min_clean_fraction))) {
- } else if ( ( mod_config_4.initial_size != max_size ) ||
- ( min_clean_size != (size_t)
- ((double)max_size * mod_config_4.min_clean_fraction) ) ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_size() returned unexpected value(s).\n";
-
}
#if 0 /* this may be useful now and then -- keep it around */
else {
@@ -827,30 +796,30 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
}
/* close the file and delete it */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
+ }
+ else if (HDremove(filename) < 0) {
- } else if ( HDremove(filename) < 0 ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) {
+ if (pass) {
PASSED();
-
- } else {
+ }
+ else {
H5_FAILED();
}
- if ( ! pass ) {
+ if (!pass) {
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
@@ -859,7 +828,6 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
} /* check_file_mdc_api_calls() */
-
/*-------------------------------------------------------------------------
* Function: mdc_api_call_smoke_check()
*
@@ -877,149 +845,143 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
*-------------------------------------------------------------------------
*/
-#define CHUNK_SIZE 2
-#define DSET_SIZE (200 * CHUNK_SIZE)
-#define NUM_DSETS 6
-#define NUM_RANDOM_ACCESSES 200000
+#define CHUNK_SIZE 2
+#define DSET_SIZE (200 * CHUNK_SIZE)
+#define NUM_DSETS 6
+#define NUM_RANDOM_ACCESSES 200000
static hbool_t
mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
{
- char filename[512];
- hbool_t valid_chunk;
- hbool_t dump_hit_rate = FALSE;
- int64_t min_accesses = 1000;
- double min_hit_rate = 0.90f;
- hbool_t dump_cache_size = FALSE;
- hid_t file_id = -1;
- hid_t dataspace_id = -1;
- hid_t filespace_ids[NUM_DSETS];
- hid_t memspace_id = -1;
- hid_t dataset_ids[NUM_DSETS];
- hid_t properties = -1;
- char dset_name[64];
- int i, j, k, l, m, n;
- herr_t status;
- hsize_t dims[2];
- hsize_t a_size[2];
- hsize_t offset[2];
- hsize_t chunk_size[2];
- int data_chunk[CHUNK_SIZE][CHUNK_SIZE];
+ char filename[512];
+ hbool_t valid_chunk;
+ hbool_t dump_hit_rate = FALSE;
+ int64_t min_accesses = 1000;
+ double min_hit_rate = 0.90f;
+ hbool_t dump_cache_size = FALSE;
+ hid_t file_id = -1;
+ hid_t dataspace_id = -1;
+ hid_t filespace_ids[NUM_DSETS];
+ hid_t memspace_id = -1;
+ hid_t dataset_ids[NUM_DSETS];
+ hid_t properties = -1;
+ char dset_name[64];
+ int i, j, k, l, m, n;
+ herr_t status;
+ hsize_t dims[2];
+ hsize_t a_size[2];
+ hsize_t offset[2];
+ hsize_t chunk_size[2];
+ int data_chunk[CHUNK_SIZE][CHUNK_SIZE];
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
- H5AC_cache_config_t mod_config_1 =
- {
- /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
- /* hbool_t rpt_fcn_enabled = */ FALSE,
- /* hbool_t open_trace_file = */ FALSE,
- /* hbool_t close_trace_file = */ FALSE,
- /* char trace_file_name[] = */ "",
- /* hbool_t evictions_enabled = */ TRUE,
- /* hbool_t set_initial_size = */ TRUE,
- /* size_t initial_size = */ 500000,
- /* double min_clean_fraction = */ 0.1f,
- /* size_t max_size = */ 16000000,
- /* size_t min_size = */ 250000,
- /* long int epoch_length = */ 50000,
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
- /* double lower_hr_threshold = */ 0.95f,
- /* double increment = */ 2.0f,
- /* hbool_t apply_max_increment = */ FALSE,
- /* size_t max_increment = */ 4000000,
- /* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
- /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
- /* double upper_hr_threshold = */ 0.999f,
- /* double decrement = */ 0.9f,
- /* hbool_t apply_max_decrement = */ FALSE,
- /* size_t max_decrement = */ 1000000,
- /* int epochs_before_eviction = */ 2,
- /* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f,
- /* int dirty_bytes_threshold = */ (256 * 1024),
- /* int metadata_write_strategy = */
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY
- };
- H5AC_cache_config_t mod_config_2 =
- {
- /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
- /* hbool_t rpt_fcn_enabled = */ FALSE,
- /* hbool_t open_trace_file = */ FALSE,
- /* hbool_t close_trace_file = */ FALSE,
- /* char trace_file_name[] = */ "",
- /* hbool_t evictions_enabled = */ TRUE,
- /* hbool_t set_initial_size = */ TRUE,
- /* size_t initial_size = */ 12000000,
- /* double min_clean_fraction = */ 0.1f,
- /* size_t max_size = */ 16000000,
- /* size_t min_size = */ 250000,
- /* long int epoch_length = */ 50000,
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
- /* double lower_hr_threshold = */ 0.95f,
- /* double increment = */ 2.0f,
- /* hbool_t apply_max_increment = */ FALSE,
- /* size_t max_increment = */ 4000000,
- /* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
- /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
- /* double upper_hr_threshold = */ 0.999f,
- /* double decrement = */ 0.9f,
- /* hbool_t apply_max_decrement = */ FALSE,
- /* size_t max_decrement = */ 1000000,
- /* int epochs_before_eviction = */ 2,
- /* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f,
- /* int dirty_bytes_threshold = */ (256 * 1024),
- /* int metadata_write_strategy = */
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY
- };
- H5AC_cache_config_t mod_config_3 =
- {
- /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
- /* hbool_t rpt_fcn_enabled = */ FALSE,
- /* hbool_t open_trace_file = */ FALSE,
- /* hbool_t close_trace_file = */ FALSE,
- /* char trace_file_name[] = */ "",
- /* hbool_t evictions_enabled = */ TRUE,
- /* hbool_t set_initial_size = */ TRUE,
- /* size_t initial_size = */ 2000000,
- /* double min_clean_fraction = */ 0.1f,
- /* size_t max_size = */ 16000000,
- /* size_t min_size = */ 250000,
- /* long int epoch_length = */ 50000,
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
- /* double lower_hr_threshold = */ 0.95f,
- /* double increment = */ 2.0f,
- /* hbool_t apply_max_increment = */ FALSE,
- /* size_t max_increment = */ 4000000,
- /* enum H5C_cache_flash_incr_mode */
- /* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0f,
- /* double flash_threshold = */ 0.5f,
- /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
- /* double upper_hr_threshold = */ 0.999f,
- /* double decrement = */ 0.9f,
- /* hbool_t apply_max_decrement = */ FALSE,
- /* size_t max_decrement = */ 1000000,
- /* int epochs_before_eviction = */ 2,
- /* hbool_t apply_empty_reserve = */ TRUE,
- /* double empty_reserve = */ 0.05f,
- /* int dirty_bytes_threshold = */ (256 * 1024),
- /* int metadata_write_strategy = */
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY
- };
-
- if(paged)
+ H5AC_cache_config_t mod_config_1 = {
+ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
+ /* hbool_t rpt_fcn_enabled = */ FALSE,
+ /* hbool_t open_trace_file = */ FALSE,
+ /* hbool_t close_trace_file = */ FALSE,
+ /* char trace_file_name[] = */ "",
+ /* hbool_t evictions_enabled = */ TRUE,
+ /* hbool_t set_initial_size = */ TRUE,
+ /* size_t initial_size = */ 500000,
+ /* double min_clean_fraction = */ 0.1f,
+ /* size_t max_size = */ 16000000,
+ /* size_t min_size = */ 250000,
+ /* long int epoch_length = */ 50000,
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
+ /* double lower_hr_threshold = */ 0.95f,
+ /* double increment = */ 2.0f,
+ /* hbool_t apply_max_increment = */ FALSE,
+ /* size_t max_increment = */ 4000000,
+ /* enum H5C_cache_flash_incr_mode */
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
+ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
+ /* double upper_hr_threshold = */ 0.999f,
+ /* double decrement = */ 0.9f,
+ /* hbool_t apply_max_decrement = */ FALSE,
+ /* size_t max_decrement = */ 1000000,
+ /* int epochs_before_eviction = */ 2,
+ /* hbool_t apply_empty_reserve = */ TRUE,
+ /* double empty_reserve = */ 0.05f,
+ /* int dirty_bytes_threshold = */ (256 * 1024),
+ /* int metadata_write_strategy = */
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+ H5AC_cache_config_t mod_config_2 = {
+ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
+ /* hbool_t rpt_fcn_enabled = */ FALSE,
+ /* hbool_t open_trace_file = */ FALSE,
+ /* hbool_t close_trace_file = */ FALSE,
+ /* char trace_file_name[] = */ "",
+ /* hbool_t evictions_enabled = */ TRUE,
+ /* hbool_t set_initial_size = */ TRUE,
+ /* size_t initial_size = */ 12000000,
+ /* double min_clean_fraction = */ 0.1f,
+ /* size_t max_size = */ 16000000,
+ /* size_t min_size = */ 250000,
+ /* long int epoch_length = */ 50000,
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
+ /* double lower_hr_threshold = */ 0.95f,
+ /* double increment = */ 2.0f,
+ /* hbool_t apply_max_increment = */ FALSE,
+ /* size_t max_increment = */ 4000000,
+ /* enum H5C_cache_flash_incr_mode */
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
+ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
+ /* double upper_hr_threshold = */ 0.999f,
+ /* double decrement = */ 0.9f,
+ /* hbool_t apply_max_decrement = */ FALSE,
+ /* size_t max_decrement = */ 1000000,
+ /* int epochs_before_eviction = */ 2,
+ /* hbool_t apply_empty_reserve = */ TRUE,
+ /* double empty_reserve = */ 0.05f,
+ /* int dirty_bytes_threshold = */ (256 * 1024),
+ /* int metadata_write_strategy = */
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+ H5AC_cache_config_t mod_config_3 = {
+ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER,
+ /* hbool_t rpt_fcn_enabled = */ FALSE,
+ /* hbool_t open_trace_file = */ FALSE,
+ /* hbool_t close_trace_file = */ FALSE,
+ /* char trace_file_name[] = */ "",
+ /* hbool_t evictions_enabled = */ TRUE,
+ /* hbool_t set_initial_size = */ TRUE,
+ /* size_t initial_size = */ 2000000,
+ /* double min_clean_fraction = */ 0.1f,
+ /* size_t max_size = */ 16000000,
+ /* size_t min_size = */ 250000,
+ /* long int epoch_length = */ 50000,
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__off,
+ /* double lower_hr_threshold = */ 0.95f,
+ /* double increment = */ 2.0f,
+ /* hbool_t apply_max_increment = */ FALSE,
+ /* size_t max_increment = */ 4000000,
+ /* enum H5C_cache_flash_incr_mode */
+ /* flash_incr_mode = */ H5C_flash_incr__off,
+ /* double flash_multiple = */ 2.0f,
+ /* double flash_threshold = */ 0.5f,
+ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
+ /* double upper_hr_threshold = */ 0.999f,
+ /* double decrement = */ 0.9f,
+ /* hbool_t apply_max_decrement = */ FALSE,
+ /* size_t max_decrement = */ 1000000,
+ /* int epochs_before_eviction = */ 2,
+ /* hbool_t apply_empty_reserve = */ TRUE,
+ /* double empty_reserve = */ 0.05f,
+ /* int dirty_bytes_threshold = */ (256 * 1024),
+ /* int metadata_write_strategy = */
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+
+ if (paged)
TESTING("MDC API smoke check for paged aggregation strategy")
else
TESTING("MDC API smoke check")
pass = TRUE;
- if ( express_test > 0 ) {
+ if (express_test > 0) {
SKIPPED();
@@ -1037,24 +999,23 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
*/
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
/* create the file using the default FAPL */
- if ( pass ) {
+ if (pass) {
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
- if ( file_id < 0 ) {
+ if (file_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fcreate() failed.\n";
}
}
@@ -1063,11 +1024,11 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
validate_mdc_config(file_id, &default_config, TRUE, 1);
/* set alternate config 1 */
- if ( pass ) {
+ if (pass) {
- if ( H5Fset_mdc_config(file_id, &mod_config_1) < 0 ) {
+ if (H5Fset_mdc_config(file_id, &mod_config_1) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fset_mdc_config() failed 1.\n";
}
}
@@ -1076,20 +1037,19 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
validate_mdc_config(file_id, &mod_config_1, TRUE, 2);
/* create the datasets */
- if ( pass ) {
+ if (pass) {
i = 0;
- while ( ( pass ) && ( i < NUM_DSETS ) )
- {
+ while ((pass) && (i < NUM_DSETS)) {
/* create a dataspace for the chunked dataset */
- dims[0] = DSET_SIZE;
- dims[1] = DSET_SIZE;
+ dims[0] = DSET_SIZE;
+ dims[1] = DSET_SIZE;
dataspace_id = H5Screate_simple(2, dims, NULL);
- if ( dataspace_id < 0 ) {
+ if (dataspace_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Screate_simple() failed.";
}
@@ -1097,50 +1057,50 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
* to be partioned into 10X10 element chunks.
*/
- if ( pass ) {
+ if (pass) {
chunk_size[0] = CHUNK_SIZE;
chunk_size[1] = CHUNK_SIZE;
- properties = H5Pcreate(H5P_DATASET_CREATE);
+ properties = H5Pcreate(H5P_DATASET_CREATE);
- if ( properties < 0 ) {
+ if (properties < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pcreate() failed.";
}
}
- if ( pass ) {
+ if (pass) {
- if ( H5Pset_chunk(properties, 2, chunk_size) < 0 ) {
+ if (H5Pset_chunk(properties, 2, chunk_size) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_chunk() failed.";
}
}
/* create the dataset */
- if ( pass ) {
+ if (pass) {
HDsprintf(dset_name, "/dset%03d", i);
- dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE,
- dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT);
+ dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT,
+ properties, H5P_DEFAULT);
- if ( dataset_ids[i] < 0 ) {
+ if (dataset_ids[i] < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dcreate2() failed.";
}
}
/* get the file space ID */
- if ( pass ) {
+ if (pass) {
filespace_ids[i] = H5Dget_space(dataset_ids[i]);
- if ( filespace_ids[i] < 0 ) {
+ if (filespace_ids[i] < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dget_space() failed.";
}
}
@@ -1150,32 +1110,31 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
}
/* create the mem space to be used to read and write chunks */
- if ( pass ) {
+ if (pass) {
- dims[0] = CHUNK_SIZE;
- dims[1] = CHUNK_SIZE;
+ dims[0] = CHUNK_SIZE;
+ dims[1] = CHUNK_SIZE;
memspace_id = H5Screate_simple(2, dims, NULL);
- if ( memspace_id < 0 ) {
+ if (memspace_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Screate_simple() failed.";
}
}
/* select in memory hyperslab */
- if ( pass ) {
+ if (pass) {
- offset[0] = 0; /*offset of hyperslab in memory*/
+ offset[0] = 0; /*offset of hyperslab in memory*/
offset[1] = 0;
- a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
+ a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
a_size[1] = CHUNK_SIZE;
- status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL,
- a_size, NULL);
+ status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL, a_size, NULL);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sselect_hyperslab() failed.";
}
}
@@ -1183,45 +1142,38 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
/* initialize all datasets on a round robin basis */
i = 0;
- while ( ( pass ) && ( i < DSET_SIZE ) )
- {
+ while ((pass) && (i < DSET_SIZE)) {
j = 0;
- while ( ( pass ) && ( j < DSET_SIZE ) )
- {
+ while ((pass) && (j < DSET_SIZE)) {
m = 0;
- while ( ( pass ) && ( m < NUM_DSETS ) )
- {
+ while ((pass) && (m < NUM_DSETS)) {
/* initialize the slab */
- for ( k = 0; k < CHUNK_SIZE; k++ )
- {
- for ( l = 0; l < CHUNK_SIZE; l++ )
- {
- data_chunk[k][l] = (DSET_SIZE * DSET_SIZE * m) +
- (DSET_SIZE * (i + k)) + j + l;
+ for (k = 0; k < CHUNK_SIZE; k++) {
+ for (l = 0; l < CHUNK_SIZE; l++) {
+ data_chunk[k][l] = (DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l;
}
}
/* select on disk hyperslab */
offset[0] = (hsize_t)i; /*offset of hyperslab in file*/
offset[1] = (hsize_t)j;
- a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
+ a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
a_size[1] = CHUNK_SIZE;
- status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET,
- offset, NULL, a_size, NULL);
+ status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "disk H5Sselect_hyperslab() failed.";
}
/* write the chunk to file */
- status = H5Dwrite(dataset_ids[m], H5T_NATIVE_INT, memspace_id,
- filespace_ids[m], H5P_DEFAULT, data_chunk);
+ status = H5Dwrite(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m], H5P_DEFAULT,
+ data_chunk);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dwrite() failed.";
}
m++;
@@ -1238,25 +1190,22 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
* similarly, check cache size.
*/
- if ( ( pass ) && ( i % (DSET_SIZE / 4) == 0 ) ) {
+ if ((pass) && (i % (DSET_SIZE / 4) == 0)) {
- check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate,
- min_accesses, min_hit_rate);
+ check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate, min_accesses, min_hit_rate);
- check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL,
- dump_cache_size);
+ check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL, dump_cache_size);
}
i += CHUNK_SIZE;
-
}
/* set alternate config 2 */
- if ( pass ) {
+ if (pass) {
- if ( H5Fset_mdc_config(file_id, &mod_config_2) < 0 ) {
+ if (H5Fset_mdc_config(file_id, &mod_config_2) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fset_mdc_config() failed 2.\n";
}
}
@@ -1266,8 +1215,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
/* do random reads on all datasets */
n = 0;
- while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) )
- {
+ while ((pass) && (n < NUM_RANDOM_ACCESSES)) {
m = rand() % NUM_DSETS;
i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE;
j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE;
@@ -1275,44 +1223,38 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
/* select on disk hyperslab */
offset[0] = (hsize_t)i; /*offset of hyperslab in file*/
offset[1] = (hsize_t)j;
- a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
+ a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
a_size[1] = CHUNK_SIZE;
- status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET,
- offset, NULL, a_size, NULL);
+ status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
- failure_mssg = "disk hyperslab create failed.";
+ pass = FALSE;
+ failure_mssg = "disk hyperslab create failed.";
}
/* read the chunk from file */
- if ( pass ) {
+ if (pass) {
- status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id,
- filespace_ids[m], H5P_DEFAULT, data_chunk);
+ status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m], H5P_DEFAULT,
+ data_chunk);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
- failure_mssg = "disk hyperslab create failed.";
+ pass = FALSE;
+ failure_mssg = "disk hyperslab create failed.";
}
}
/* validate the slab */
- if ( pass ) {
+ if (pass) {
valid_chunk = TRUE;
- for ( k = 0; k < CHUNK_SIZE; k++ )
- {
- for ( l = 0; l < CHUNK_SIZE; l++ )
- {
- if ( data_chunk[k][l]
- !=
- ((DSET_SIZE * DSET_SIZE * m) +
- (DSET_SIZE * (i + k)) + j + l) ) {
-
- valid_chunk = FALSE;
+ for (k = 0; k < CHUNK_SIZE; k++) {
+ for (l = 0; l < CHUNK_SIZE; l++) {
+ if (data_chunk[k][l] != ((DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l)) {
+
+ valid_chunk = FALSE;
#if 0 /* this will be useful from time to time -- lets keep it*/
HDfprintf(stdout,
"data_chunk[%0d][%0d] = %0d, expect %0d.\n",
@@ -1327,61 +1269,54 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
}
}
- if ( ! valid_chunk ) {
+ if (!valid_chunk) {
#if 1
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "slab validation failed.";
#else /* as above */
- HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n",
- i, j, m);
+ HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m);
#endif
}
}
- if ( ( pass ) && ( n % (NUM_RANDOM_ACCESSES / 4) == 0 ) ) {
+ if ((pass) && (n % (NUM_RANDOM_ACCESSES / 4) == 0)) {
- check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate,
- min_accesses, min_hit_rate);
+ check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate, min_accesses, min_hit_rate);
- check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL,
- dump_cache_size);
+ check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL, dump_cache_size);
}
n++;
}
-
/* close the file spaces we are done with */
i = 1;
- while ( ( pass ) && ( i < NUM_DSETS ) )
- {
- if ( H5Sclose(filespace_ids[i]) < 0 ) {
+ while ((pass) && (i < NUM_DSETS)) {
+ if (H5Sclose(filespace_ids[i]) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sclose() failed.";
}
i++;
}
-
/* close the datasets we are done with */
i = 1;
- while ( ( pass ) && ( i < NUM_DSETS ) )
- {
- if ( H5Dclose(dataset_ids[i]) < 0 ) {
+ while ((pass) && (i < NUM_DSETS)) {
+ if (H5Dclose(dataset_ids[i]) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dclose() failed.";
}
i++;
}
/* set alternate config 3 */
- if ( pass ) {
+ if (pass) {
- if ( H5Fset_mdc_config(file_id, &mod_config_3) < 0 ) {
+ if (H5Fset_mdc_config(file_id, &mod_config_3) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fset_mdc_config() failed 3.\n";
}
}
@@ -1392,53 +1327,46 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
/* do random reads on data set 0 only */
m = 0;
n = 0;
- while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) )
- {
+ while ((pass) && (n < NUM_RANDOM_ACCESSES)) {
i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE;
j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE;
/* select on disk hyperslab */
offset[0] = (hsize_t)i; /*offset of hyperslab in file*/
offset[1] = (hsize_t)j;
- a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
+ a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
a_size[1] = CHUNK_SIZE;
- status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET,
- offset, NULL, a_size, NULL);
+ status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
- failure_mssg = "disk hyperslab create failed.";
+ pass = FALSE;
+ failure_mssg = "disk hyperslab create failed.";
}
/* read the chunk from file */
- if ( pass ) {
+ if (pass) {
- status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id,
- filespace_ids[m], H5P_DEFAULT, data_chunk);
+ status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m], H5P_DEFAULT,
+ data_chunk);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
- failure_mssg = "disk hyperslab create failed.";
+ pass = FALSE;
+ failure_mssg = "disk hyperslab create failed.";
}
}
/* validate the slab */
- if ( pass ) {
+ if (pass) {
valid_chunk = TRUE;
- for ( k = 0; k < CHUNK_SIZE; k++ )
- {
- for ( l = 0; l < CHUNK_SIZE; l++ )
- {
- if ( data_chunk[k][l]
- !=
- ((DSET_SIZE * DSET_SIZE * m) +
- (DSET_SIZE * (i + k)) + j + l) ) {
-
- valid_chunk = FALSE;
- }
+ for (k = 0; k < CHUNK_SIZE; k++) {
+ for (l = 0; l < CHUNK_SIZE; l++) {
+ if (data_chunk[k][l] != ((DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l)) {
+
+ valid_chunk = FALSE;
+ }
#if 0 /* this will be useful from time to time -- lets keep it */
HDfprintf(stdout, "data_chunk[%0d][%0d] = %0d, expect %0d.\n",
k, l, data_chunk[k][l],
@@ -1448,9 +1376,9 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
}
}
- if ( ! valid_chunk ) {
+ if (!valid_chunk) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "slab validation failed.";
#if 0 /* as above */
HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n",
@@ -1459,84 +1387,81 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
}
}
- if ( ( pass ) && ( n % (NUM_RANDOM_ACCESSES / 4) == 0 ) ) {
+ if ((pass) && (n % (NUM_RANDOM_ACCESSES / 4) == 0)) {
- check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate,
- min_accesses, min_hit_rate);
+ check_and_validate_cache_hit_rate(file_id, NULL, dump_hit_rate, min_accesses, min_hit_rate);
- check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL,
- dump_cache_size);
+ check_and_validate_cache_size(file_id, NULL, NULL, NULL, NULL, dump_cache_size);
}
n++;
}
/* close file space 0 */
- if ( pass ) {
+ if (pass) {
- if ( H5Sclose(filespace_ids[0]) < 0 ) {
+ if (H5Sclose(filespace_ids[0]) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sclose(filespace_ids[0]) failed.";
}
}
/* close the data space */
- if ( pass ) {
+ if (pass) {
- if ( H5Sclose(dataspace_id) < 0 ) {
+ if (H5Sclose(dataspace_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sclose(dataspace) failed.";
}
}
/* close the mem space */
- if ( pass ) {
+ if (pass) {
- if ( H5Sclose(memspace_id) < 0 ) {
+ if (H5Sclose(memspace_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sclose(memspace_id) failed.";
}
}
/* close dataset 0 */
- if ( pass ) {
+ if (pass) {
- if ( H5Dclose(dataset_ids[0]) < 0 ) {
+ if (H5Dclose(dataset_ids[0]) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dclose(dataset_ids[0]) failed.";
}
}
/* close the file and delete it */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
- else if ( HDremove(filename) < 0 ) {
+ else if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) {
+ if (pass) {
PASSED();
-
- } else {
+ }
+ else {
H5_FAILED();
}
- if ( ! pass ) {
+ if (!pass) {
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
@@ -1545,8 +1470,6 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
} /* mdc_api_call_smoke_check() */
-
-
/*-------------------------------------------------------------------------
* Function: init_invalid_configs()
*
@@ -1566,183 +1489,183 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
*-------------------------------------------------------------------------
*/
-#define NUM_INVALID_CONFIGS 36
-static H5AC_cache_config_t * invalid_configs = NULL;
+#define NUM_INVALID_CONFIGS 36
+static H5AC_cache_config_t *invalid_configs = NULL;
static H5AC_cache_config_t *
-init_invalid_configs(void) {
+init_invalid_configs(void)
+{
- int i;
- H5AC_cache_config_t * configs = NULL;
+ int i;
+ H5AC_cache_config_t *configs = NULL;
/* Allocate memory */
- if ( NULL == (configs = (H5AC_cache_config_t *)HDcalloc(
- NUM_INVALID_CONFIGS, sizeof(H5AC_cache_config_t) ) ) ) {
+ if (NULL ==
+ (configs = (H5AC_cache_config_t *)HDcalloc(NUM_INVALID_CONFIGS, sizeof(H5AC_cache_config_t)))) {
return NULL;
}
/* Set defaults for all configs */
- for ( i = 0; i < NUM_INVALID_CONFIGS; i++ ) {
+ for (i = 0; i < NUM_INVALID_CONFIGS; i++) {
- configs[i].version = H5C__CURR_AUTO_SIZE_CTL_VER;
- configs[i].rpt_fcn_enabled = FALSE;
- configs[i].open_trace_file = FALSE;
- configs[i].close_trace_file = FALSE;
+ configs[i].version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ configs[i].rpt_fcn_enabled = FALSE;
+ configs[i].open_trace_file = FALSE;
+ configs[i].close_trace_file = FALSE;
/* trace file name set to all ASCII NUL by calloc() */
- configs[i].evictions_enabled = TRUE;
- configs[i].set_initial_size = TRUE;
- configs[i].initial_size = (1 * 1024 * 1024);
- configs[i].min_clean_fraction = 0.25F;
- configs[i].max_size = (16 * 1024 * 1024);
- configs[i].min_size = (1 * 1024 * 1024);
- configs[i].epoch_length = 50000;
- configs[i].incr_mode = H5C_incr__threshold;
- configs[i].lower_hr_threshold = 0.9F;
- configs[i].increment = 2.0F;
- configs[i].apply_max_increment = TRUE;
- configs[i].max_increment = (4 * 1024 * 1024);
- configs[i].flash_incr_mode = H5C_flash_incr__off;
- configs[i].flash_multiple = 2.0F;
- configs[i].flash_threshold = 0.5F;
- configs[i].decr_mode = H5C_decr__age_out_with_threshold;
- configs[i].upper_hr_threshold = 0.999F;
- configs[i].decrement = 0.9F;
- configs[i].apply_max_decrement = TRUE;
- configs[i].max_decrement = (1 * 1024 * 1024);
- configs[i].epochs_before_eviction = 3;
- configs[i].apply_empty_reserve = TRUE;
- configs[i].empty_reserve = 0.1F;
- configs[i].dirty_bytes_threshold = (256 * 1024);
- configs[i].metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
+ configs[i].evictions_enabled = TRUE;
+ configs[i].set_initial_size = TRUE;
+ configs[i].initial_size = (1 * 1024 * 1024);
+ configs[i].min_clean_fraction = 0.25F;
+ configs[i].max_size = (16 * 1024 * 1024);
+ configs[i].min_size = (1 * 1024 * 1024);
+ configs[i].epoch_length = 50000;
+ configs[i].incr_mode = H5C_incr__threshold;
+ configs[i].lower_hr_threshold = 0.9F;
+ configs[i].increment = 2.0F;
+ configs[i].apply_max_increment = TRUE;
+ configs[i].max_increment = (4 * 1024 * 1024);
+ configs[i].flash_incr_mode = H5C_flash_incr__off;
+ configs[i].flash_multiple = 2.0F;
+ configs[i].flash_threshold = 0.5F;
+ configs[i].decr_mode = H5C_decr__age_out_with_threshold;
+ configs[i].upper_hr_threshold = 0.999F;
+ configs[i].decrement = 0.9F;
+ configs[i].apply_max_decrement = TRUE;
+ configs[i].max_decrement = (1 * 1024 * 1024);
+ configs[i].epochs_before_eviction = 3;
+ configs[i].apply_empty_reserve = TRUE;
+ configs[i].empty_reserve = 0.1F;
+ configs[i].dirty_bytes_threshold = (256 * 1024);
+ configs[i].metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
}
/* Set badness for each config */
/* 0 -- bad version */
- configs[0].version = -1;
+ configs[0].version = -1;
/* 1 -- open_trace_file == TRUE and empty trace_file_name */
- configs[1].open_trace_file = TRUE;
+ configs[1].open_trace_file = TRUE;
/* trace file name set to all ASCII NUL by calloc() */
/* 2 -- max_size too big */
- configs[2].max_size = H5C__MAX_MAX_CACHE_SIZE + 1;
+ configs[2].max_size = H5C__MAX_MAX_CACHE_SIZE + 1;
/* 3 -- min_size too small */
- configs[3].min_size = H5C__MIN_MAX_CACHE_SIZE - 1;
+ configs[3].min_size = H5C__MIN_MAX_CACHE_SIZE - 1;
/* 4 -- min_size > max_size */
- configs[4].max_size = (16 * 1024 * 1024);
- configs[4].min_size = (16 * 1024 * 1024 + 1);
+ configs[4].max_size = (16 * 1024 * 1024);
+ configs[4].min_size = (16 * 1024 * 1024 + 1);
/* 5 -- initial size out of range (too big) */
- configs[5].initial_size = (16 * 1024 * 1024 + 1);
+ configs[5].initial_size = (16 * 1024 * 1024 + 1);
/* 6 -- initial_size out of range (too small) */
- configs[6].initial_size = (1 * 1024 * 1024 - 1);
+ configs[6].initial_size = (1 * 1024 * 1024 - 1);
/* 7 -- min_clean_fraction too big */
- configs[7].min_clean_fraction = 1.000001f;
+ configs[7].min_clean_fraction = 1.000001f;
/* 8 -- min_clean_fraction too small */
- configs[8].min_clean_fraction = -0.00000001f;
+ configs[8].min_clean_fraction = -0.00000001f;
/* 9 -- epoch_length too small */
- configs[9].epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1;
+ configs[9].epoch_length = H5C__MIN_AR_EPOCH_LENGTH - 1;
/* 10 -- epoch_length too big */
- configs[10].epoch_length = H5C__MAX_AR_EPOCH_LENGTH + 1;
+ configs[10].epoch_length = H5C__MAX_AR_EPOCH_LENGTH + 1;
/* 11 -- invalid incr_mode */
- configs[11].incr_mode = (enum H5C_cache_incr_mode)-1;
+ configs[11].incr_mode = (enum H5C_cache_incr_mode) - 1;
/* 12 -- lower_hr_threshold too small */
- configs[12].lower_hr_threshold = -0.000001f;
+ configs[12].lower_hr_threshold = -0.000001f;
/* 13 -- lower_hr_threshold too big */
- configs[13].lower_hr_threshold = 1.00000001f;
+ configs[13].lower_hr_threshold = 1.00000001f;
/* 14 -- increment too small */
- configs[14].increment = 0.999999999999;
+ configs[14].increment = 0.999999999999;
/* 15 -- invalid flash_incr_mode */
- configs[15].flash_incr_mode = (enum H5C_cache_flash_incr_mode)-1;
+ configs[15].flash_incr_mode = (enum H5C_cache_flash_incr_mode) - 1;
/* 16 -- flash_multiple too small */
- configs[16].flash_incr_mode = H5C_flash_incr__add_space;
- configs[16].flash_multiple = 0.09f;
+ configs[16].flash_incr_mode = H5C_flash_incr__add_space;
+ configs[16].flash_multiple = 0.09f;
/* 17 -- flash_multiple too big */
- configs[17].flash_incr_mode = H5C_flash_incr__add_space;
- configs[17].flash_multiple = 10.001f;
+ configs[17].flash_incr_mode = H5C_flash_incr__add_space;
+ configs[17].flash_multiple = 10.001f;
/* 18 -- flash_threshold too small */
- configs[18].flash_incr_mode = H5C_flash_incr__add_space;
- configs[18].flash_threshold = 0.099f;
+ configs[18].flash_incr_mode = H5C_flash_incr__add_space;
+ configs[18].flash_threshold = 0.099f;
/* 19 -- flash_threshold too big */
- configs[19].flash_incr_mode = H5C_flash_incr__add_space;
- configs[19].flash_threshold = 1.001f;
+ configs[19].flash_incr_mode = H5C_flash_incr__add_space;
+ configs[19].flash_threshold = 1.001f;
/* 20 -- bad decr_mode */
- configs[20].decr_mode = (enum H5C_cache_decr_mode)-1;
+ configs[20].decr_mode = (enum H5C_cache_decr_mode) - 1;
/* 21 -- upper_hr_threshold too big */
- configs[21].upper_hr_threshold = 1.00001f;
+ configs[21].upper_hr_threshold = 1.00001f;
/* 22 -- decrement too small */
- configs[22].decr_mode = H5C_decr__threshold;
- configs[22].decrement = -0.0000000001f;
+ configs[22].decr_mode = H5C_decr__threshold;
+ configs[22].decrement = -0.0000000001f;
/* 23 -- decrement too big */
- configs[23].decr_mode = H5C_decr__threshold;
- configs[23].decrement = 1.0000000001;
+ configs[23].decr_mode = H5C_decr__threshold;
+ configs[23].decrement = 1.0000000001;
/* 24 -- epochs_before_eviction too small */
- configs[24].epochs_before_eviction = 0;
+ configs[24].epochs_before_eviction = 0;
/* 25 -- epochs_before_eviction too big */
- configs[25].epochs_before_eviction = H5C__MAX_EPOCH_MARKERS + 1;
+ configs[25].epochs_before_eviction = H5C__MAX_EPOCH_MARKERS + 1;
/* 26 -- empty_reserve too small */
- configs[26].empty_reserve = -0.0000000001f;
+ configs[26].empty_reserve = -0.0000000001f;
/* 27 -- empty_reserve too big */
- configs[27].empty_reserve = 1.00000000001;
+ configs[27].empty_reserve = 1.00000000001;
/* 28 -- upper_hr_threshold too small */
- configs[28].upper_hr_threshold = -0.000000001f;
+ configs[28].upper_hr_threshold = -0.000000001f;
/* 29 -- upper_hr_threshold too big */
- configs[29].upper_hr_threshold = 1.00000001;
+ configs[29].upper_hr_threshold = 1.00000001;
/* 30 -- upper_hr_threshold <= lower_hr_threshold */
- configs[30].lower_hr_threshold = 0.9f;
- configs[30].upper_hr_threshold = 0.9f;
+ configs[30].lower_hr_threshold = 0.9f;
+ configs[30].upper_hr_threshold = 0.9f;
/* 31 -- dirty_bytes_threshold too small */
- configs[31].dirty_bytes_threshold = (H5C__MIN_MAX_CACHE_SIZE / 2) - 1;
+ configs[31].dirty_bytes_threshold = (H5C__MIN_MAX_CACHE_SIZE / 2) - 1;
/* 32 -- dirty_bytes_threshold too big */
- configs[32].dirty_bytes_threshold = (H5C__MAX_MAX_CACHE_SIZE / 4) + 1;
+ configs[32].dirty_bytes_threshold = (H5C__MAX_MAX_CACHE_SIZE / 4) + 1;
/* 33 -- attempt to disable evictions when auto incr enabled */
- configs[33].evictions_enabled = FALSE;
- configs[33].decr_mode = H5C_decr__off;
+ configs[33].evictions_enabled = FALSE;
+ configs[33].decr_mode = H5C_decr__off;
/* 34 -- attempt to disable evictions when auto decr enabled */
- configs[34].evictions_enabled = FALSE;
- configs[34].decr_mode = H5C_decr__age_out;
+ configs[34].evictions_enabled = FALSE;
+ configs[34].decr_mode = H5C_decr__age_out;
/* 35 -- unknown metadata write strategy */
- configs[35].metadata_write_strategy = -1;
+ configs[35].metadata_write_strategy = -1;
return configs;
} /* initialize_invalid_configs() */
-
/*-------------------------------------------------------------------------
* Function: check_fapl_mdc_api_errs()
*
@@ -1759,10 +1682,10 @@ init_invalid_configs(void) {
static hbool_t
check_fapl_mdc_api_errs(void)
{
- static char msg[128];
- int i;
- herr_t result;
- hid_t fapl_id = -1;
+ static char msg[128];
+ int i;
+ herr_t result;
+ hid_t fapl_id = -1;
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
H5AC_cache_config_t scratch;
@@ -1774,15 +1697,14 @@ check_fapl_mdc_api_errs(void)
*/
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- if ( pass ) {
+ if (pass) {
- H5E_BEGIN_TRY {
- result = H5Pget_mdc_config((hid_t)-1, &scratch);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Pget_mdc_config((hid_t)-1, &scratch); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pget_mdc_config() accepted invalid plist_id.";
}
}
@@ -1791,35 +1713,33 @@ check_fapl_mdc_api_errs(void)
* default MDC configuration.
*/
- if ( pass ) {
+ if (pass) {
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if ( fapl_id < 0 ) {
+ if (fapl_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
}
}
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- if ( ( pass ) &&
- ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0) ||
- ( !CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE) ) ) ) {
+ if ((pass) && ((H5Pget_mdc_config(fapl_id, &scratch) < 0) ||
+ (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "New FAPL has unexpected metadata cache config?!?!?.\n";
}
- if ( pass ) {
+ if (pass) {
- H5E_BEGIN_TRY {
- result = H5Pget_mdc_config(fapl_id, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Pget_mdc_config(fapl_id, NULL); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pget_mdc_config() accepted NULL config_ptr.";
}
}
@@ -1827,62 +1747,55 @@ check_fapl_mdc_api_errs(void)
/* one last test for H5Pget_mdc_config() */
scratch.version = -1; /* a convenient, invalid value */
- if ( pass ) {
+ if (pass) {
- H5E_BEGIN_TRY {
- result = H5Pget_mdc_config(fapl_id, &scratch);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Pget_mdc_config(fapl_id, &scratch); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pget_mdc_config() accepted bad config version.";
}
}
-
/* now test H5Pset_mdc_config()
*/
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- if ( pass ) {
+ if (pass) {
- H5E_BEGIN_TRY {
- result = H5Pset_mdc_config((hid_t)-1, &default_config);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Pset_mdc_config((hid_t)-1, &default_config); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_mdc_config() accepted bad invalid plist_id.";
}
}
- if ( pass ) {
+ if (pass) {
- H5E_BEGIN_TRY {
- result = H5Pset_mdc_config(fapl_id, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Pset_mdc_config(fapl_id, NULL); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_mdc_config() accepted NULL config_ptr.";
}
}
i = 0;
- while ( ( pass ) && ( i < NUM_INVALID_CONFIGS ) )
- {
- H5E_BEGIN_TRY {
- result = H5Pset_mdc_config(fapl_id, &(invalid_configs[i]));
- } H5E_END_TRY;
+ while ((pass) && (i < NUM_INVALID_CONFIGS)) {
+ H5E_BEGIN_TRY { result = H5Pset_mdc_config(fapl_id, &(invalid_configs[i])); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5Pset_mdc_config() accepted invalid_configs[%d].", i);
+ HDsnprintf(msg, (size_t)128, "H5Pset_mdc_config() accepted invalid_configs[%d].", i);
failure_mssg = msg;
}
i++;
@@ -1892,24 +1805,23 @@ check_fapl_mdc_api_errs(void)
* the configuration in the FAPL.
*/
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- if ( ( pass ) &&
- ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0 ) ||
- ( !CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE) ) ) ) {
+ if ((pass) && ((H5Pget_mdc_config(fapl_id, &scratch) < 0) ||
+ (!CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE)))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "FAPL metadata cache config changed???.\n";
}
- if ( pass ) {
+ if (pass) {
PASSED();
-
- } else {
+ }
+ else {
H5_FAILED();
}
- if ( ! pass ) {
+ if (!pass) {
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
@@ -1918,7 +1830,6 @@ check_fapl_mdc_api_errs(void)
} /* check_fapl_mdc_api_errs() */
-
/*-------------------------------------------------------------------------
* Function: check_file_mdc_api_errs()
*
@@ -1935,21 +1846,21 @@ check_fapl_mdc_api_errs(void)
static hbool_t
check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)
{
- char filename[512];
- static char msg[128];
- hbool_t show_progress = FALSE;
- int i;
- herr_t result;
- hid_t file_id = -1;
- size_t max_size;
- size_t min_clean_size;
- size_t cur_size;
- int cur_num_entries;
- double hit_rate;
+ char filename[512];
+ static char msg[128];
+ hbool_t show_progress = FALSE;
+ int i;
+ herr_t result;
+ hid_t file_id = -1;
+ size_t max_size;
+ size_t min_clean_size;
+ size_t cur_size;
+ int cur_num_entries;
+ double hit_rate;
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
H5AC_cache_config_t scratch;
- if(paged)
+ if (paged)
TESTING("MDC/FILE related API input errors for paged aggregation strategy")
else
TESTING("MDC/FILE related API input errors")
@@ -1961,157 +1872,144 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)
*/
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: calling h5_fixname().\n", FUNC);
}
- if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: calling H5Fcreate().\n", FUNC);
}
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
- if ( file_id < 0 ) {
+ if (file_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fcreate() failed.\n";
}
}
validate_mdc_config(file_id, &default_config, TRUE, 1);
-
/* test H5Fget_mdc_config(). */
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 1.\n", FUNC);
}
- H5E_BEGIN_TRY {
- result = H5Fget_mdc_config((hid_t)-1, &scratch);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Fget_mdc_config((hid_t)-1, &scratch); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_config() accepted invalid file_id.";
}
}
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 2.\n", FUNC);
}
- H5E_BEGIN_TRY {
- result = H5Fget_mdc_config(file_id, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Fget_mdc_config(file_id, NULL); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_config() accepted NULL config_ptr.";
}
}
scratch.version = -1; /* a convenient, invalid value */
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_config() 3.\n", FUNC);
}
- H5E_BEGIN_TRY {
- result = H5Fget_mdc_config(file_id, &scratch);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Fget_mdc_config(file_id, &scratch); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_config() accepted bad config version.";
}
}
-
/* test H5Fset_mdc_config() */
scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER;
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 1.\n", FUNC);
}
- H5E_BEGIN_TRY {
- result = H5Fset_mdc_config((hid_t)-1, &default_config);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Fset_mdc_config((hid_t)-1, &default_config); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fset_mdc_config() accepted bad invalid file_id.";
}
}
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: testing H5Fset_mdc_config() 2.\n", FUNC);
}
- H5E_BEGIN_TRY {
- result = H5Fset_mdc_config(file_id, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Fset_mdc_config(file_id, NULL); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fset_mdc_config() accepted NULL config_ptr.";
}
}
i = 0;
- while ( ( pass ) && ( i < NUM_INVALID_CONFIGS ) )
- {
- if ( show_progress ) {
+ while ((pass) && (i < NUM_INVALID_CONFIGS)) {
+ if (show_progress) {
- HDfprintf(stdout,
- "%s: testing H5Fset_mdc_config() with invalid config %d.\n",
- FUNC, i);
+ HDfprintf(stdout, "%s: testing H5Fset_mdc_config() with invalid config %d.\n", FUNC, i);
}
- H5E_BEGIN_TRY {
- result = H5Fset_mdc_config(file_id, &(invalid_configs[i]));
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Fset_mdc_config(file_id, &(invalid_configs[i])); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5Fset_mdc_config() accepted invalid_configs[%d].", i);
+ HDsnprintf(msg, (size_t)128, "H5Fset_mdc_config() accepted invalid_configs[%d].", i);
failure_mssg = msg;
}
i++;
@@ -2122,140 +2020,128 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)
*/
validate_mdc_config(file_id, &default_config, TRUE, 2);
-
/* test H5Fget_mdc_hit_rate() */
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
- HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n",
- FUNC);
+ HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 1.\n", FUNC);
}
- H5E_BEGIN_TRY {
- result = H5Fget_mdc_hit_rate((hid_t)-1, &hit_rate);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Fget_mdc_hit_rate((hid_t)-1, &hit_rate); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_hit_rate() accepted bad file_id.";
}
}
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
- HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n",
- FUNC);
+ HDfprintf(stdout, "%s: testing H5Fget_mdc_hit_rate() 2.\n", FUNC);
}
- H5E_BEGIN_TRY {
- result = H5Fget_mdc_hit_rate(file_id, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Fget_mdc_hit_rate(file_id, NULL); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_hit_rate() accepted NULL hit_rate_ptr.";
}
}
-
/* test H5Freset_mdc_hit_rate_stats() */
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
- HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n",
- FUNC);
+ HDfprintf(stdout, "%s: testing H5Freset_mdc_hit_rate_stats().\n", FUNC);
}
- H5E_BEGIN_TRY {
- result = H5Freset_mdc_hit_rate_stats((hid_t)-1);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { result = H5Freset_mdc_hit_rate_stats((hid_t)-1); }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
- failure_mssg =
- "H5Freset_mdc_hit_rate_stats() accepted bad file_id.";
+ pass = FALSE;
+ failure_mssg = "H5Freset_mdc_hit_rate_stats() accepted bad file_id.";
}
}
-
/* test H5Fget_mdc_size() */
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 1.\n", FUNC);
}
- H5E_BEGIN_TRY {
- result = H5Fget_mdc_size((hid_t)-1, &max_size, &min_clean_size,
- &cur_size, &cur_num_entries);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ result = H5Fget_mdc_size((hid_t)-1, &max_size, &min_clean_size, &cur_size, &cur_num_entries);
+ }
+ H5E_END_TRY;
- if ( result >= 0 ) {
+ if (result >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_size() accepted bad file_id.";
}
}
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: testing H5Fget_mdc_size() 2.\n", FUNC);
}
- if ( ( H5Fget_mdc_size(file_id, &max_size, NULL, NULL, NULL) < 0 ) ||
- ( H5Fget_mdc_size(file_id, NULL, &min_clean_size,
- NULL, NULL) < 0 ) ||
- ( H5Fget_mdc_size(file_id, NULL, NULL, &cur_size, NULL) < 0 ) ||
- ( H5Fget_mdc_size(file_id, NULL, NULL, NULL,
- &cur_num_entries) < 0 ) ||
- ( H5Fget_mdc_size(file_id, NULL, NULL, NULL, NULL) < 0 ) ) {
+ if ((H5Fget_mdc_size(file_id, &max_size, NULL, NULL, NULL) < 0) ||
+ (H5Fget_mdc_size(file_id, NULL, &min_clean_size, NULL, NULL) < 0) ||
+ (H5Fget_mdc_size(file_id, NULL, NULL, &cur_size, NULL) < 0) ||
+ (H5Fget_mdc_size(file_id, NULL, NULL, NULL, &cur_num_entries) < 0) ||
+ (H5Fget_mdc_size(file_id, NULL, NULL, NULL, NULL) < 0)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_size() failed to handle NULL params.";
}
}
-
/* close the file and delete it */
- if ( pass ) {
+ if (pass) {
- if ( show_progress ) {
+ if (show_progress) {
HDfprintf(stdout, "%s: cleaning up from tests.\n", FUNC);
}
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
+ }
+ else if (HDremove(filename) < 0) {
- } else if ( HDremove(filename) < 0 ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) {
+ if (pass) {
PASSED();
-
- } else {
+ }
+ else {
H5_FAILED();
}
- if ( ! pass ) {
+ if (!pass) {
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
}
@@ -2264,7 +2150,6 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)
} /* check_file_mdc_api_errs() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2281,9 +2166,9 @@ int
main(void)
{
unsigned nerrs = 0;
- int express_test;
- hid_t fcpl_id = -1;
- hid_t fcpl2_id = -1;
+ int express_test;
+ hid_t fcpl_id = -1;
+ hid_t fcpl2_id = -1;
unsigned paged;
H5open();
@@ -2295,30 +2180,29 @@ main(void)
HDprintf(" express_test = %d\n", express_test);
HDprintf("===================================\n");
-
/* Initialize invalid configurations.
*/
invalid_configs = init_invalid_configs();
- if ( NULL == invalid_configs ) {
+ if (NULL == invalid_configs) {
failure_mssg = "Unable to allocate memory for invalid configs.";
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return EXIT_FAILURE;
} /* end if */
- if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) {
failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return EXIT_FAILURE;
} /* end if */
/* Set file space strategy to default or paged aggregation strategy */
- if((fcpl2_id = H5Pcopy(fcpl_id)) < 0) {
+ if ((fcpl2_id = H5Pcopy(fcpl_id)) < 0) {
failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return EXIT_FAILURE;
} /* end if */
- if(H5Pset_file_space_strategy(fcpl2_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0) {
+ if (H5Pset_file_space_strategy(fcpl2_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0) {
failure_mssg = "H5Pset_file_space_strategy() failed.\n";
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return EXIT_FAILURE;
@@ -2326,40 +2210,39 @@ main(void)
/* Test with paged aggregation enabled or not */
/* The "my_fcpl" passed to each test has the paged or non-paged strategy set up accordinly */
- for(paged = FALSE; paged <= TRUE; paged++) {
+ for (paged = FALSE; paged <= TRUE; paged++) {
hid_t my_fcpl = fcpl_id;
- if(paged)
+ if (paged)
my_fcpl = fcpl2_id;
- if(!check_fapl_mdc_api_calls(paged, my_fcpl))
+ if (!check_fapl_mdc_api_calls(paged, my_fcpl))
nerrs += 1;
- if(!check_file_mdc_api_calls(paged, my_fcpl))
+ if (!check_file_mdc_api_calls(paged, my_fcpl))
nerrs += 1;
- if(!mdc_api_call_smoke_check(express_test, paged, my_fcpl))
+ if (!mdc_api_call_smoke_check(express_test, paged, my_fcpl))
nerrs += 1;
- if(!check_file_mdc_api_errs(paged, my_fcpl))
+ if (!check_file_mdc_api_errs(paged, my_fcpl))
nerrs += 1;
} /* end for paged */
- if(!check_fapl_mdc_api_errs())
+ if (!check_fapl_mdc_api_errs())
nerrs += 1;
- if(invalid_configs)
+ if (invalid_configs)
HDfree(invalid_configs);
- if(H5Pclose(fcpl_id) < 0 ) {
+ if (H5Pclose(fcpl_id) < 0) {
failure_mssg = "H5Pclose() failed.\n";
HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return EXIT_FAILURE;
} /* end if */
- if(nerrs > 0)
+ if (nerrs > 0)
return EXIT_FAILURE;
else
return EXIT_SUCCESS;
} /* main() */
-
diff --git a/test/cache_common.c b/test/cache_common.c
index d0b8632..8fc8303 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -18,25 +18,25 @@
* implemented in H5C.c
*/
#include "H5private.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5MMprivate.h"
#include "cache_common.h"
-hbool_t pass = TRUE; /* set to false on error */
+hbool_t pass = TRUE; /* set to false on error */
const char *failure_mssg = NULL;
-static test_entry_t *pico_entries = NULL, *orig_pico_entries = NULL;
-static test_entry_t *nano_entries = NULL, *orig_nano_entries = NULL;
-static test_entry_t *micro_entries = NULL, *orig_micro_entries = NULL;
-static test_entry_t *tiny_entries = NULL, *orig_tiny_entries = NULL;
-static test_entry_t *small_entries = NULL, *orig_small_entries = NULL;
-static test_entry_t *medium_entries = NULL, *orig_medium_entries = NULL;
-static test_entry_t *large_entries = NULL, *orig_large_entries = NULL;
-static test_entry_t *huge_entries = NULL, *orig_huge_entries = NULL;
-static test_entry_t *monster_entries = NULL, *orig_monster_entries = NULL;
-static test_entry_t *variable_entries = NULL, *orig_variable_entries = NULL;
-static test_entry_t *notify_entries = NULL, *orig_notify_entries = NULL;
+static test_entry_t *pico_entries = NULL, *orig_pico_entries = NULL;
+static test_entry_t *nano_entries = NULL, *orig_nano_entries = NULL;
+static test_entry_t *micro_entries = NULL, *orig_micro_entries = NULL;
+static test_entry_t *tiny_entries = NULL, *orig_tiny_entries = NULL;
+static test_entry_t *small_entries = NULL, *orig_small_entries = NULL;
+static test_entry_t *medium_entries = NULL, *orig_medium_entries = NULL;
+static test_entry_t *large_entries = NULL, *orig_large_entries = NULL;
+static test_entry_t *huge_entries = NULL, *orig_huge_entries = NULL;
+static test_entry_t *monster_entries = NULL, *orig_monster_entries = NULL;
+static test_entry_t *variable_entries = NULL, *orig_variable_entries = NULL;
+static test_entry_t *notify_entries = NULL, *orig_notify_entries = NULL;
hbool_t orig_entry_arrays_init = FALSE;
@@ -52,33 +52,22 @@ static herr_t monster_get_initial_load_size(void *udata_ptr, size_t *image_len_p
static herr_t variable_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr);
static herr_t notify_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr);
-static herr_t variable_get_final_load_size(const void *image, size_t image_len,
- void *udata, size_t *actual_len);
+static herr_t variable_get_final_load_size(const void *image, size_t image_len, void *udata,
+ size_t *actual_len);
static htri_t variable_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
-static void *pico_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *nano_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *micro_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *tiny_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *small_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *medium_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *large_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *huge_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *monster_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *variable_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
-static void *notify_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr);
+static void *pico_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *nano_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *micro_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *tiny_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *small_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *medium_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *large_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *huge_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *monster_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *variable_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+static void *notify_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr);
static herr_t pico_image_len(const void *thing, size_t *image_len_ptr);
static herr_t nano_image_len(const void *thing, size_t *image_len_ptr);
@@ -92,62 +81,40 @@ static herr_t monster_image_len(const void *thing, size_t *image_len_ptr);
static herr_t variable_image_len(const void *thing, size_t *image_len_ptr);
static herr_t notify_image_len(const void *thing, size_t *image_len_ptr);
-static herr_t pico_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t nano_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t micro_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t tiny_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t small_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t medium_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t large_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t huge_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t monster_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t variable_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-static herr_t notify_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr,
- size_t *new_len_ptr, unsigned *flags_ptr);
-
-static herr_t pico_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t nano_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t micro_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t tiny_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t small_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t medium_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t large_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t huge_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t monster_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t variable_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t notify_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
+static herr_t pico_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t nano_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t micro_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t tiny_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t small_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t medium_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t large_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t huge_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t monster_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t variable_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t notify_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+
+static herr_t pico_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t nano_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t micro_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t tiny_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t small_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t medium_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t large_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t huge_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t monster_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t variable_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t notify_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
static herr_t pico_free_icr(void *thing);
static herr_t nano_free_icr(void *thing);
@@ -161,97 +128,50 @@ static herr_t monster_free_icr(void *thing);
static herr_t variable_free_icr(void *thing);
static herr_t notify_free_icr(void *thing);
-
static herr_t notify_notify(H5C_notify_action_t action, void *thing);
-static void mark_flush_dep_dirty(test_entry_t * entry_ptr);
-static void mark_flush_dep_clean(test_entry_t * entry_ptr);
+static void mark_flush_dep_dirty(test_entry_t *entry_ptr);
+static void mark_flush_dep_clean(test_entry_t *entry_ptr);
/* Generic callback routines */
-static herr_t get_initial_load_size(void *udata_ptr, size_t *image_len_ptr,
- int32_t entry_type);
-static herr_t get_final_load_size(const void *image, size_t image_len,
- void *udata, size_t *actual_len, int32_t entry_type);
-static void *deserialize(const void *image_ptr, size_t len, void *udata_ptr,
- hbool_t *dirty_ptr, int32_t entry_type);
+static herr_t get_initial_load_size(void *udata_ptr, size_t *image_len_ptr, int32_t entry_type);
+static herr_t get_final_load_size(const void *image, size_t image_len, void *udata, size_t *actual_len,
+ int32_t entry_type);
+static void * deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr,
+ int32_t entry_type);
static herr_t image_len(const void *thing, size_t *image_len_ptr, int32_t entry_type);
-static herr_t pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr,
- unsigned *flags_ptr);
-static herr_t serialize(const H5F_t *f, void *image_ptr, size_t len,
- void *thing);
-static herr_t notify(H5C_notify_action_t action, void *thing, int32_t
- entry_type);
+static herr_t pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr);
+static herr_t serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t notify(H5C_notify_action_t action, void *thing, int32_t entry_type);
static herr_t free_icr(test_entry_t *entry, int32_t entry_type);
/* Local routines */
-static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr,
- struct flush_op *op_ptr, unsigned *flags_ptr);
+static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, struct flush_op *op_ptr,
+ unsigned *flags_ptr);
test_entry_t *entries[NUMBER_OF_ENTRY_TYPES];
test_entry_t *orig_entries[NUMBER_OF_ENTRY_TYPES];
-const int32_t max_indices[NUMBER_OF_ENTRY_TYPES] =
-{
- NUM_PICO_ENTRIES - 1,
- NUM_NANO_ENTRIES - 1,
- NUM_MICRO_ENTRIES - 1,
- NUM_TINY_ENTRIES - 1,
- NUM_SMALL_ENTRIES - 1,
- NUM_MEDIUM_ENTRIES - 1,
- NUM_LARGE_ENTRIES - 1,
- NUM_HUGE_ENTRIES - 1,
- NUM_MONSTER_ENTRIES - 1,
- NUM_VARIABLE_ENTRIES - 1,
- NUM_NOTIFY_ENTRIES - 1
-};
-
-const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES] =
-{
- PICO_ENTRY_SIZE,
- NANO_ENTRY_SIZE,
- MICRO_ENTRY_SIZE,
- TINY_ENTRY_SIZE,
- SMALL_ENTRY_SIZE,
- MEDIUM_ENTRY_SIZE,
- LARGE_ENTRY_SIZE,
- HUGE_ENTRY_SIZE,
- MONSTER_ENTRY_SIZE,
- VARIABLE_ENTRY_SIZE,
- NOTIFY_ENTRY_SIZE
-};
-
-const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES] =
-{
- PICO_BASE_ADDR,
- NANO_BASE_ADDR,
- MICRO_BASE_ADDR,
- TINY_BASE_ADDR,
- SMALL_BASE_ADDR,
- MEDIUM_BASE_ADDR,
- LARGE_BASE_ADDR,
- HUGE_BASE_ADDR,
- MONSTER_BASE_ADDR,
- VARIABLE_BASE_ADDR,
- NOTIFY_BASE_ADDR
-};
-
-const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] =
-{
- PICO_ALT_BASE_ADDR,
- NANO_ALT_BASE_ADDR,
- MICRO_ALT_BASE_ADDR,
- TINY_ALT_BASE_ADDR,
- SMALL_ALT_BASE_ADDR,
- MEDIUM_ALT_BASE_ADDR,
- LARGE_ALT_BASE_ADDR,
- HUGE_ALT_BASE_ADDR,
- MONSTER_ALT_BASE_ADDR,
- VARIABLE_ALT_BASE_ADDR,
- NOTIFY_ALT_BASE_ADDR
-};
+const int32_t max_indices[NUMBER_OF_ENTRY_TYPES] = {
+ NUM_PICO_ENTRIES - 1, NUM_NANO_ENTRIES - 1, NUM_MICRO_ENTRIES - 1, NUM_TINY_ENTRIES - 1,
+ NUM_SMALL_ENTRIES - 1, NUM_MEDIUM_ENTRIES - 1, NUM_LARGE_ENTRIES - 1, NUM_HUGE_ENTRIES - 1,
+ NUM_MONSTER_ENTRIES - 1, NUM_VARIABLE_ENTRIES - 1, NUM_NOTIFY_ENTRIES - 1};
+
+const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES] = {PICO_ENTRY_SIZE, NANO_ENTRY_SIZE, MICRO_ENTRY_SIZE,
+ TINY_ENTRY_SIZE, SMALL_ENTRY_SIZE, MEDIUM_ENTRY_SIZE,
+ LARGE_ENTRY_SIZE, HUGE_ENTRY_SIZE, MONSTER_ENTRY_SIZE,
+ VARIABLE_ENTRY_SIZE, NOTIFY_ENTRY_SIZE};
+const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES] = {
+ PICO_BASE_ADDR, NANO_BASE_ADDR, MICRO_BASE_ADDR, TINY_BASE_ADDR, SMALL_BASE_ADDR, MEDIUM_BASE_ADDR,
+ LARGE_BASE_ADDR, HUGE_BASE_ADDR, MONSTER_BASE_ADDR, VARIABLE_BASE_ADDR, NOTIFY_BASE_ADDR};
+
+const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] = {
+ PICO_ALT_BASE_ADDR, NANO_ALT_BASE_ADDR, MICRO_ALT_BASE_ADDR, TINY_ALT_BASE_ADDR,
+ SMALL_ALT_BASE_ADDR, MEDIUM_ALT_BASE_ADDR, LARGE_ALT_BASE_ADDR, HUGE_ALT_BASE_ADDR,
+ MONSTER_ALT_BASE_ADDR, VARIABLE_ALT_BASE_ADDR, NOTIFY_ALT_BASE_ADDR};
/* Callback classes */
static const H5C_class_t pico_class[1] = {{
@@ -443,23 +363,12 @@ static const H5C_class_t notify_class[1] = {{
/* callback table declaration */
-const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES] = {
- pico_class,
- nano_class,
- micro_class,
- tiny_class,
- small_class,
- medium_class,
- large_class,
- huge_class,
- monster_class,
- variable_class,
- notify_class
-};
+const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES] = {pico_class, nano_class, micro_class, tiny_class,
+ small_class, medium_class, large_class, huge_class,
+ monster_class, variable_class, notify_class};
/* address translation functions: */
-
/*-------------------------------------------------------------------------
* Function: addr_to_type_and_index
*
@@ -474,72 +383,63 @@ const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES] = {
*-------------------------------------------------------------------------
*/
void
-addr_to_type_and_index(haddr_t addr,
- int32_t *type_ptr,
- int32_t *index_ptr)
+addr_to_type_and_index(haddr_t addr, int32_t *type_ptr, int32_t *index_ptr)
{
- int i;
+ int i;
int32_t type;
int32_t idx;
- HDassert( type_ptr );
- HDassert( index_ptr );
+ HDassert(type_ptr);
+ HDassert(index_ptr);
/* we only have a small number of entry types, so just do a
* linear search. If NUMBER_OF_ENTRY_TYPES grows, we may want
* to do a binary search instead.
*/
i = 1;
- if ( addr >= PICO_ALT_BASE_ADDR ) {
+ if (addr >= PICO_ALT_BASE_ADDR) {
- while ( ( i < NUMBER_OF_ENTRY_TYPES ) &&
- ( addr >= alt_base_addrs[i] ) )
- {
+ while ((i < NUMBER_OF_ENTRY_TYPES) && (addr >= alt_base_addrs[i])) {
i++;
}
+ }
+ else {
- } else {
-
- while ( ( i < NUMBER_OF_ENTRY_TYPES ) &&
- ( addr >= base_addrs[i] ) )
- {
+ while ((i < NUMBER_OF_ENTRY_TYPES) && (addr >= base_addrs[i])) {
i++;
}
}
type = i - 1;
- HDassert( ( type >= 0 ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
+ HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES));
- if ( addr >= PICO_ALT_BASE_ADDR ) {
+ if (addr >= PICO_ALT_BASE_ADDR) {
idx = (int32_t)((addr - alt_base_addrs[type]) / entry_sizes[type]);
- HDassert( ( idx >= 0 ) && ( idx <= max_indices[type] ) );
- HDassert( !((entries[type])[idx].at_main_addr) );
- HDassert( addr == (entries[type])[idx].alt_addr );
-
- } else {
+ HDassert((idx >= 0) && (idx <= max_indices[type]));
+ HDassert(!((entries[type])[idx].at_main_addr));
+ HDassert(addr == (entries[type])[idx].alt_addr);
+ }
+ else {
idx = (int32_t)((addr - base_addrs[type]) / entry_sizes[type]);
- HDassert( ( idx >= 0 ) && ( idx <= max_indices[type] ) );
- HDassert( (entries[type])[idx].at_main_addr );
- HDassert( addr == (entries[type])[idx].main_addr );
+ HDassert((idx >= 0) && (idx <= max_indices[type]));
+ HDassert((entries[type])[idx].at_main_addr);
+ HDassert(addr == (entries[type])[idx].main_addr);
}
- HDassert( addr == (entries[type])[idx].addr );
+ HDassert(addr == (entries[type])[idx].addr);
- *type_ptr = type;
+ *type_ptr = type;
*index_ptr = idx;
return;
} /* addr_to_type_and_index() */
-
/* Call back functions: */
-
-
/*-------------------------------------------------------------------------
* Function: get_initial_load_size & friends
*
@@ -558,14 +458,14 @@ get_initial_load_size(void *udata, size_t *image_length, int32_t H5_ATTR_NDEBUG_
{
test_entry_t *entry;
test_entry_t *base_addr;
- haddr_t addr = *(const haddr_t *)udata;
- int32_t type;
- int32_t idx;
+ haddr_t addr = *(const haddr_t *)udata;
+ int32_t type;
+ int32_t idx;
addr_to_type_and_index(addr, &type, &idx);
base_addr = entries[type];
- entry = &(base_addr[idx]);
+ entry = &(base_addr[idx]);
HDassert(entry->type >= 0);
HDassert(entry->type == type);
@@ -579,7 +479,7 @@ get_initial_load_size(void *udata, size_t *image_length, int32_t H5_ATTR_NDEBUG_
*image_length = entry->size;
- return(SUCCEED);
+ return (SUCCEED);
} /* get_initial_load_size() */
static herr_t
@@ -648,7 +548,6 @@ notify_get_initial_load_size(void *udata, size_t *image_length)
return get_initial_load_size(udata, image_length, NOTIFY_ENTRY_TYPE);
}
-
/*-------------------------------------------------------------------------
* Function: get_final_load_size & friends
*
@@ -663,19 +562,19 @@ notify_get_initial_load_size(void *udata, size_t *image_length)
*-------------------------------------------------------------------------
*/
static herr_t
-get_final_load_size(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED image_len,
- void *udata, size_t *actual_len, int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
+get_final_load_size(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED image_len, void *udata,
+ size_t *actual_len, int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
test_entry_t *entry;
test_entry_t *base_addr;
- haddr_t addr = *(const haddr_t *)udata;
- int32_t type;
- int32_t idx;
+ haddr_t addr = *(const haddr_t *)udata;
+ int32_t type;
+ int32_t idx;
addr_to_type_and_index(addr, &type, &idx);
base_addr = entries[type];
- entry = &(base_addr[idx]);
+ entry = &(base_addr[idx]);
HDassert(entry->type >= 0);
HDassert(entry->type == type);
@@ -689,24 +588,22 @@ get_final_load_size(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED imag
HDassert(type == VARIABLE_ENTRY_TYPE);
/* Simulate SPECULATIVE read with a specified actual_len */
- if(entry->actual_len) {
+ if (entry->actual_len) {
*actual_len = entry->actual_len;
entry->size = entry->actual_len;
} /* end if */
else
*actual_len = entry->size;
- return(SUCCEED);
+ return (SUCCEED);
} /* get_final_load_size() */
static herr_t
-variable_get_final_load_size(const void *image, size_t image_len,
- void *udata, size_t *actual_len)
+variable_get_final_load_size(const void *image, size_t image_len, void *udata, size_t *actual_len)
{
return get_final_load_size(image, image_len, udata, actual_len, VARIABLE_ENTRY_TYPE);
}
-
/*-------------------------------------------------------------------------
* Function: verify_chksum & friends
* (only done for VARIABLE_ENTRY_TYPE which has a speculative read)
@@ -725,18 +622,18 @@ variable_get_final_load_size(const void *image, size_t image_len,
static htri_t
verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void *udata,
- int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
+ int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
test_entry_t *entry;
test_entry_t *base_addr;
- haddr_t addr = *(const haddr_t *)udata;
- int32_t type;
- int32_t idx;
+ haddr_t addr = *(const haddr_t *)udata;
+ int32_t type;
+ int32_t idx;
addr_to_type_and_index(addr, &type, &idx);
base_addr = entries[type];
- entry = &(base_addr[idx]);
+ entry = &(base_addr[idx]);
HDassert(entry->type >= 0);
HDassert(entry->type == type);
@@ -749,10 +646,10 @@ verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void
HDassert(entry == entry->self);
HDassert(entry->addr == addr);
- if(++entry->verify_ct >= entry->max_verify_ct)
- return(TRUE);
+ if (++entry->verify_ct >= entry->max_verify_ct)
+ return (TRUE);
else
- return(FALSE);
+ return (FALSE);
} /* verify_chksum() */
@@ -762,7 +659,6 @@ variable_verify_chksum(const void *image, size_t len, void *udata)
return verify_chksum(image, len, udata, VARIABLE_ENTRY_TYPE);
}
-
/*-------------------------------------------------------------------------
* Function: deserialize & friends
*
@@ -779,18 +675,18 @@ variable_verify_chksum(const void *image, size_t len, void *udata)
*/
static void *
deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *udata, hbool_t *dirty,
- int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
+ int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
test_entry_t *entry;
test_entry_t *base_addr;
- haddr_t addr = *(haddr_t *)udata;
- int32_t type;
- int32_t idx;
+ haddr_t addr = *(haddr_t *)udata;
+ int32_t type;
+ int32_t idx;
addr_to_type_and_index(addr, &type, &idx);
base_addr = entries[type];
- entry = &(base_addr[idx]);
+ entry = &(base_addr[idx]);
HDassert(entry->type >= 0);
HDassert(entry->type == type);
@@ -804,54 +700,45 @@ deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *udata, hb
HDassert(entry->size == len);
HDassert((entry->type == VARIABLE_ENTRY_TYPE) || (entry->size == entry_sizes[type]));
HDassert(dirty != NULL);
- HDassert( entry->flush_dep_npar == 0 );
- HDassert( entry->flush_dep_nchd == 0 );
+ HDassert(entry->flush_dep_npar == 0);
+ HDassert(entry->flush_dep_nchd == 0);
/* for now *dirty will always be FALSE */
*dirty = FALSE;
/* verify that the image contains the expected data. */
HDassert(image != NULL);
- if((entry->at_main_addr && entry->written_to_main_addr) ||
- (!entry->at_main_addr && entry->written_to_alt_addr)) {
- if((type == PICO_ENTRY_TYPE) || (type == VARIABLE_ENTRY_TYPE) ||
- (type == NOTIFY_ENTRY_TYPE)) {
- if((*((const char *)image)) != (char)(idx & 0xFF)) {
- HDfprintf(stdout, "type = %d, idx = %d, addr = 0x%lx.\n",
- type, idx, (long)addr);
- HDfprintf(stdout, "*image = 0x%x\n",
- (int)(*((const char *)image)));
- HDfprintf(stdout, "expected *image = 0x%x\n",
- (int)(idx & 0xFF));
+ if ((entry->at_main_addr && entry->written_to_main_addr) ||
+ (!entry->at_main_addr && entry->written_to_alt_addr)) {
+ if ((type == PICO_ENTRY_TYPE) || (type == VARIABLE_ENTRY_TYPE) || (type == NOTIFY_ENTRY_TYPE)) {
+ if ((*((const char *)image)) != (char)(idx & 0xFF)) {
+ HDfprintf(stdout, "type = %d, idx = %d, addr = 0x%lx.\n", type, idx, (long)addr);
+ HDfprintf(stdout, "*image = 0x%x\n", (int)(*((const char *)image)));
+ HDfprintf(stdout, "expected *image = 0x%x\n", (int)(idx & 0xFF));
} /* end if */
- HDassert((*((const char *)image)) == (char)(idx & 0xFF));
+ HDassert((*((const char *)image)) == (char)(idx & 0xFF));
} /* end if */
else {
- if((*(((const char *)image) + 2)) != (char)(idx & 0xFF)) {
- HDfprintf(stdout, "type = %d, idx = %d, addr = 0x%lx.\n",
- type, idx, (long)addr);
- HDfprintf(stdout,
- "*image = 0x%" PRIx8 " 0x%" PRIx8 " 0x%" PRIx8 "\n",
- (*((const uint8_t *)image)),
- (*(((const uint8_t *)image) + 1)),
- (*(((const uint8_t *)image) + 2)));
- HDfprintf(stdout,
- "expected *image = 0x%02" PRIx32 "%02" PRIx32 "\n",
- (uint32_t)idx & 0xFF,
+ if ((*(((const char *)image) + 2)) != (char)(idx & 0xFF)) {
+ HDfprintf(stdout, "type = %d, idx = %d, addr = 0x%lx.\n", type, idx, (long)addr);
+ HDfprintf(stdout, "*image = 0x%" PRIx8 " 0x%" PRIx8 " 0x%" PRIx8 "\n",
+ (*((const uint8_t *)image)), (*(((const uint8_t *)image) + 1)),
+ (*(((const uint8_t *)image) + 2)));
+ HDfprintf(stdout, "expected *image = 0x%02" PRIx32 "%02" PRIx32 "\n", (uint32_t)idx & 0xFF,
(((uint32_t)idx & 0xFF00) >> 8));
} /* end if */
- HDassert((*((const char *)image)) == (char)(type & 0xFF));
- HDassert((*(((const char *)image) + 1)) == (char)((idx & 0xFF00) >> 8));
- HDassert((*(((const char *)image) + 2)) == (char)(idx & 0xFF));
+ HDassert((*((const char *)image)) == (char)(type & 0xFF));
+ HDassert((*(((const char *)image) + 1)) == (char)((idx & 0xFF00) >> 8));
+ HDassert((*(((const char *)image) + 2)) == (char)(idx & 0xFF));
} /* end else */
- } /* end if */
+ } /* end if */
- entry->deserialized = TRUE;
+ entry->deserialized = TRUE;
entry->header.is_dirty = FALSE;
- entry->is_dirty = FALSE;
+ entry->is_dirty = FALSE;
(entry->deserializes)++;
- return((void *)entry);
+ return ((void *)entry);
} /* deserialize() */
void *
@@ -920,7 +807,6 @@ notify_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
return deserialize(image, len, udata, dirty, NOTIFY_ENTRY_TYPE);
}
-
/*-------------------------------------------------------------------------
* Function: image_len & friends
*
@@ -940,7 +826,7 @@ herr_t
image_len(const void *thing, size_t *image_length, int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
const test_entry_t *entry;
- int32_t type;
+ int32_t type;
HDassert(thing);
HDassert(image_length);
@@ -957,16 +843,16 @@ image_len(const void *thing, size_t *image_length, int32_t H5_ATTR_NDEBUG_UNUSED
HDassert(entry == &(entries[type][entry->index]));
- if(type != VARIABLE_ENTRY_TYPE)
- HDassert(entry->size == entry_sizes[type]);
+ if (type != VARIABLE_ENTRY_TYPE)
+ HDassert(entry->size == entry_sizes[type]);
else {
- HDassert(entry->size <= entry_sizes[type]);
- HDassert(entry->size > 0);
+ HDassert(entry->size <= entry_sizes[type]);
+ HDassert(entry->size > 0);
} /* end else */
*image_length = entry->size;
- return(SUCCEED);
+ return (SUCCEED);
} /* image_len() */
herr_t
@@ -1035,7 +921,6 @@ notify_image_len(const void *thing, size_t *image_length)
return image_len(thing, image_length, NOTIFY_ENTRY_TYPE);
}
-
/*-------------------------------------------------------------------------
* Function: pre_serialize & friends
*
@@ -1055,16 +940,12 @@ notify_image_len(const void *thing, size_t *image_length)
*-------------------------------------------------------------------------
*/
herr_t
-pre_serialize(H5F_t H5_ATTR_NDEBUG_UNUSED *f,
- void *thing,
- haddr_t H5_ATTR_NDEBUG_UNUSED addr,
- size_t H5_ATTR_NDEBUG_UNUSED len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
+pre_serialize(H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *thing, haddr_t H5_ATTR_NDEBUG_UNUSED addr,
+ size_t H5_ATTR_NDEBUG_UNUSED len, haddr_t *new_addr_ptr, size_t *new_len_ptr,
unsigned *flags_ptr)
{
test_entry_t *entry;
- int32_t i;
+ int32_t i;
HDassert(f);
HDassert(thing);
@@ -1089,14 +970,13 @@ pre_serialize(H5F_t H5_ATTR_NDEBUG_UNUSED *f,
HDassert(entry->num_flush_ops >= 0);
HDassert(entry->num_flush_ops < MAX_FLUSH_OPS);
- if(entry->num_flush_ops > 0) {
- for(i = 0; i < entry->num_flush_ops; i++ ) {
+ if (entry->num_flush_ops > 0) {
+ for (i = 0; i < entry->num_flush_ops; i++) {
HDassert(entry->file_ptr);
- execute_flush_op(entry->file_ptr, entry,
- &((entry->flush_ops)[i]), flags_ptr);
+ execute_flush_op(entry->file_ptr, entry, &((entry->flush_ops)[i]), flags_ptr);
} /* end for */
- entry->num_flush_ops = 0;
+ entry->num_flush_ops = 0;
entry->flush_op_self_resize_in_progress = FALSE;
/* This looks wrong, but it isn't -- *flags_ptr will be modified
@@ -1104,7 +984,7 @@ pre_serialize(H5F_t H5_ATTR_NDEBUG_UNUSED *f,
* and the flags set will accumulate over the set of calls in
* the for loop.
*/
- if(pass && (((*flags_ptr) & H5C__SERIALIZE_RESIZED_FLAG) != 0)) {
+ if (pass && (((*flags_ptr) & H5C__SERIALIZE_RESIZED_FLAG) != 0)) {
/* set *new_len_ptr to the new length. */
@@ -1115,164 +995,96 @@ pre_serialize(H5F_t H5_ATTR_NDEBUG_UNUSED *f,
*new_len_ptr = entry->size;
} /* end if */
- if(((*flags_ptr) & H5C__SERIALIZE_MOVED_FLAG) != 0) {
+ if (((*flags_ptr) & H5C__SERIALIZE_MOVED_FLAG) != 0) {
HDassert(((*flags_ptr) | H5C__SERIALIZE_RESIZED_FLAG) != 0);
/* place the new address in *new_addr */
*new_addr_ptr = entry->addr;
} /* end if */
- } /* end if */
+ } /* end if */
- return(SUCCEED);
+ return (SUCCEED);
} /* pre_serialize() */
herr_t
-pico_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+pico_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-nano_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+nano_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-micro_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+micro_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-tiny_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+tiny_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-small_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+small_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-medium_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+medium_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-large_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+large_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-huge_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+huge_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-monster_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+monster_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-variable_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+variable_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
herr_t
-notify_pre_serialize(H5F_t *f,
- void *thing,
- haddr_t addr,
- size_t len,
- haddr_t *new_addr_ptr,
- size_t *new_len_ptr,
- unsigned *flags_ptr)
+notify_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr,
+ size_t *new_len_ptr, unsigned *flags_ptr)
{
- return pre_serialize(f, thing, addr, len,
- new_addr_ptr, new_len_ptr, flags_ptr);
+ return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr);
}
-
-
/*-------------------------------------------------------------------------
* Function: serialize & friends
*
@@ -1297,7 +1109,7 @@ herr_t
serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
test_entry_t *entry;
- int32_t type;
+ int32_t type;
HDassert(image_ptr);
HDassert(thing);
@@ -1322,16 +1134,15 @@ serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thin
/* null out the image to avoid spurious failures */
HDmemset(image_ptr, 0, len);
- if((type == PICO_ENTRY_TYPE) || (type == VARIABLE_ENTRY_TYPE) ||
- (type == NOTIFY_ENTRY_TYPE )) {
- HDassert(entry->size >= PICO_ENTRY_SIZE);
- *((char *)image_ptr) = (char)((entry->index) & 0xFF);
+ if ((type == PICO_ENTRY_TYPE) || (type == VARIABLE_ENTRY_TYPE) || (type == NOTIFY_ENTRY_TYPE)) {
+ HDassert(entry->size >= PICO_ENTRY_SIZE);
+ *((char *)image_ptr) = (char)((entry->index) & 0xFF);
} /* end if */
else {
- HDassert(entry->size >= NANO_ENTRY_SIZE);
- *((char *)image_ptr) = (char)((entry->type) & 0xFF);
- *(((char *)image_ptr) + 1) = (char)(((entry->index) & 0xFF00) >> 8);
- *(((char *)image_ptr) + 2) = (char)((entry->index) & 0xFF);
+ HDassert(entry->size >= NANO_ENTRY_SIZE);
+ *((char *)image_ptr) = (char)((entry->type) & 0xFF);
+ *(((char *)image_ptr) + 1) = (char)(((entry->index) & 0xFF00) >> 8);
+ *(((char *)image_ptr) + 2) = (char)((entry->index) & 0xFF);
} /* end else */
/* We no longer do the actual write through an callback -- this is
@@ -1340,24 +1151,24 @@ serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thin
*/
entry->is_dirty = FALSE;
- if(entry->flush_dep_npar > 0) {
- HDassert(entry->flush_dep_ndirty_chd == 0);
+ if (entry->flush_dep_npar > 0) {
+ HDassert(entry->flush_dep_ndirty_chd == 0);
mark_flush_dep_clean(entry);
} /* end if */
/* since the entry is about to be written to disk, we can mark it
* as initialized.
*/
- if(entry->at_main_addr)
- entry->written_to_main_addr = TRUE;
+ if (entry->at_main_addr)
+ entry->written_to_main_addr = TRUE;
else
- entry->written_to_alt_addr = TRUE;
+ entry->written_to_alt_addr = TRUE;
/* do book keeping */
(entry->serializes)++;
entry->serialized = TRUE;
- return(SUCCEED);
+ return (SUCCEED);
} /* serialize() */
herr_t
@@ -1391,8 +1202,7 @@ small_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void
}
herr_t
-medium_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len,
- void *thing)
+medium_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
return serialize(f, image_ptr, len, thing);
}
@@ -1410,27 +1220,23 @@ huge_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void
}
herr_t
-monster_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len,
- void *thing)
+monster_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
return serialize(f, image_ptr, len, thing);
}
herr_t
-variable_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len,
- void *thing)
+variable_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
return serialize(f, image_ptr, len, thing);
}
herr_t
-notify_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len,
- void *thing)
+notify_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
return serialize(f, image_ptr, len, thing);
}
-
/*-------------------------------------------------------------------------
* Function: notify & friends
*
@@ -1460,15 +1266,14 @@ notify(H5C_notify_action_t action, void *thing, int32_t H5_ATTR_NDEBUG_UNUSED en
HDassert(entry->type == entry_type);
HDassert(entry == &(entries[entry->type][entry->index]));
HDassert(entry == entry->self);
- if(!(action == H5C_NOTIFY_ACTION_ENTRY_DIRTIED && entry->action == TEST_ENTRY_ACTION_MOVE))
+ if (!(action == H5C_NOTIFY_ACTION_ENTRY_DIRTIED && entry->action == TEST_ENTRY_ACTION_MOVE))
HDassert(entry->header.addr == entry->addr);
- HDassert((entry->type == VARIABLE_ENTRY_TYPE) || \
- (entry->size == entry_sizes[entry->type]));
+ HDassert((entry->type == VARIABLE_ENTRY_TYPE) || (entry->size == entry_sizes[entry->type]));
/* Increment count for appropriate action */
- switch(action) {
- case H5C_NOTIFY_ACTION_AFTER_INSERT: /* Entry has been added */
- case H5C_NOTIFY_ACTION_AFTER_LOAD: /* to the cache. */
+ switch (action) {
+ case H5C_NOTIFY_ACTION_AFTER_INSERT: /* Entry has been added */
+ case H5C_NOTIFY_ACTION_AFTER_LOAD: /* to the cache. */
entry->notify_after_insert_count++;
break;
@@ -1479,10 +1284,10 @@ notify(H5C_notify_action_t action, void *thing, int32_t H5_ATTR_NDEBUG_UNUSED en
case H5C_NOTIFY_ACTION_CHILD_CLEANED:
case H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED:
case H5C_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
- break;
+ /* do nothing */
+ break;
- case H5C_NOTIFY_ACTION_BEFORE_EVICT: /* Entry is about to be evicted from cache */
+ case H5C_NOTIFY_ACTION_BEFORE_EVICT: /* Entry is about to be evicted from cache */
entry->notify_before_evict_count++;
break;
@@ -1490,16 +1295,15 @@ notify(H5C_notify_action_t action, void *thing, int32_t H5_ATTR_NDEBUG_UNUSED en
HDassert(0 && "Unknown notify action!?!");
} /* end switch */
- return(SUCCEED);
+ return (SUCCEED);
} /* notify() */
herr_t
notify_notify(H5C_notify_action_t action, void *thing)
{
- return(notify(action, thing, NOTIFY_ENTRY_TYPE));
+ return (notify(action, thing, NOTIFY_ENTRY_TYPE));
}
-
/*-------------------------------------------------------------------------
* Function: free_icr & friends
*
@@ -1534,54 +1338,52 @@ free_icr(test_entry_t *entry, int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
HDassert(entry == entry->self);
HDassert(entry->cache_ptr != NULL);
HDassert(entry->cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert((entry->header.destroy_in_progress) ||
- (entry->header.addr == entry->addr));
+ HDassert((entry->header.destroy_in_progress) || (entry->header.addr == entry->addr));
HDassert(entry->header.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC);
HDassert(entry->header.size == entry->size);
- HDassert((entry->type == VARIABLE_ENTRY_TYPE) ||
- (entry->size == entry_sizes[entry->type]));
+ HDassert((entry->type == VARIABLE_ENTRY_TYPE) || (entry->size == entry_sizes[entry->type]));
HDassert(entry->header.tl_next == NULL);
HDassert(entry->header.tl_prev == NULL);
- if(entry->num_pins > 0) {
+ if (entry->num_pins > 0) {
int i;
- for(i = 0; i < entry->num_pins; i++) {
+ for (i = 0; i < entry->num_pins; i++) {
test_entry_t *pinned_entry;
test_entry_t *pinned_base_addr;
- pinned_base_addr = entries[entry->pin_type[i]];
- pinned_entry = &(pinned_base_addr[entry->pin_idx[i]]);
+ pinned_base_addr = entries[entry->pin_type[i]];
+ pinned_entry = &(pinned_base_addr[entry->pin_idx[i]]);
- HDassert(0 <= pinned_entry->type);
+ HDassert(0 <= pinned_entry->type);
HDassert(pinned_entry->type < NUMBER_OF_ENTRY_TYPES);
- HDassert(pinned_entry->type == entry->pin_type[i]);
- HDassert(pinned_entry->index >= 0);
- HDassert(pinned_entry->index <= max_indices[pinned_entry->type]);
- HDassert(pinned_entry->index == entry->pin_idx[i]);
- HDassert(pinned_entry == pinned_entry->self);
- HDassert(pinned_entry->header.is_pinned);
- HDassert(pinned_entry->is_pinned);
- HDassert(pinned_entry->pinning_ref_count > 0);
-
- pinned_entry->pinning_ref_count--;
-
- if(pinned_entry->pinning_ref_count <= 0) {
+ HDassert(pinned_entry->type == entry->pin_type[i]);
+ HDassert(pinned_entry->index >= 0);
+ HDassert(pinned_entry->index <= max_indices[pinned_entry->type]);
+ HDassert(pinned_entry->index == entry->pin_idx[i]);
+ HDassert(pinned_entry == pinned_entry->self);
+ HDassert(pinned_entry->header.is_pinned);
+ HDassert(pinned_entry->is_pinned);
+ HDassert(pinned_entry->pinning_ref_count > 0);
+
+ pinned_entry->pinning_ref_count--;
+
+ if (pinned_entry->pinning_ref_count <= 0) {
HDassert(pinned_entry->file_ptr);
- unpin_entry(pinned_entry->type, pinned_entry->index);
- } /* end if */
+ unpin_entry(pinned_entry->type, pinned_entry->index);
+ } /* end if */
- entry->pin_type[i] = -1;
- entry->pin_idx[i] = -1;
- } /* end if */
- entry->num_pins = 0;
+ entry->pin_type[i] = -1;
+ entry->pin_idx[i] = -1;
+ } /* end if */
+ entry->num_pins = 0;
} /* end if */
entry->destroyed = TRUE;
entry->cache_ptr = NULL;
- return(SUCCEED);
+ return (SUCCEED);
} /* free_icr() */
herr_t
@@ -1650,7 +1452,6 @@ notify_free_icr(void *thing)
return free_icr((test_entry_t *)thing, NOTIFY_ENTRY_TYPE);
}
-
/**************************************************************************/
/**************************************************************************/
/************************** test utility functions: ***********************/
@@ -1674,60 +1475,50 @@ notify_free_icr(void *thing)
*/
void
-add_flush_op(int target_type,
- int target_idx,
- int op_code,
- int type,
- int idx,
- hbool_t flag,
- size_t new_size,
- unsigned * order_ptr)
+add_flush_op(int target_type, int target_idx, int op_code, int type, int idx, hbool_t flag, size_t new_size,
+ unsigned *order_ptr)
{
- int i;
- test_entry_t * target_base_addr;
- test_entry_t * target_entry_ptr;
-
- HDassert( ( 0 <= target_type ) && ( target_type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= target_idx ) &&
- ( target_idx <= max_indices[target_type] ) );
- HDassert( ( 0 <= op_code ) && ( op_code <= FLUSH_OP__MAX_OP ) );
- HDassert( ( op_code != FLUSH_OP__RESIZE ) ||
- ( type == VARIABLE_ENTRY_TYPE ) );
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
- HDassert( new_size <= VARIABLE_ENTRY_SIZE );
+ int i;
+ test_entry_t *target_base_addr;
+ test_entry_t *target_entry_ptr;
+
+ HDassert((0 <= target_type) && (target_type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= target_idx) && (target_idx <= max_indices[target_type]));
+ HDassert((0 <= op_code) && (op_code <= FLUSH_OP__MAX_OP));
+ HDassert((op_code != FLUSH_OP__RESIZE) || (type == VARIABLE_ENTRY_TYPE));
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
+ HDassert(new_size <= VARIABLE_ENTRY_SIZE);
#ifndef H5_HAVE_STDBOOL_H
/* Check for TRUE or FALSE if we're using an integer type instead
* of a real Boolean type.
*/
- HDassert( ( flag == TRUE ) || ( flag == FALSE ) );
+ HDassert((flag == TRUE) || (flag == FALSE));
#endif /* H5_HAVE_STDBOOL_H */
- if ( pass ) {
+ if (pass) {
target_base_addr = entries[target_type];
target_entry_ptr = &(target_base_addr[target_idx]);
- HDassert( target_entry_ptr->index == target_idx );
- HDassert( target_entry_ptr->type == target_type );
- HDassert( target_entry_ptr == target_entry_ptr->self );
- HDassert( target_entry_ptr->num_flush_ops < MAX_FLUSH_OPS );
-
- i = (target_entry_ptr->num_flush_ops)++;
- (target_entry_ptr->flush_ops)[i].op_code = op_code;
- (target_entry_ptr->flush_ops)[i].type = type;
- (target_entry_ptr->flush_ops)[i].idx = idx;
- (target_entry_ptr->flush_ops)[i].flag = flag;
- (target_entry_ptr->flush_ops)[i].size = new_size;
- (target_entry_ptr->flush_ops)[i].order_ptr = order_ptr;
-
+ HDassert(target_entry_ptr->index == target_idx);
+ HDassert(target_entry_ptr->type == target_type);
+ HDassert(target_entry_ptr == target_entry_ptr->self);
+ HDassert(target_entry_ptr->num_flush_ops < MAX_FLUSH_OPS);
+
+ i = (target_entry_ptr->num_flush_ops)++;
+ (target_entry_ptr->flush_ops)[i].op_code = op_code;
+ (target_entry_ptr->flush_ops)[i].type = type;
+ (target_entry_ptr->flush_ops)[i].idx = idx;
+ (target_entry_ptr->flush_ops)[i].flag = flag;
+ (target_entry_ptr->flush_ops)[i].size = new_size;
+ (target_entry_ptr->flush_ops)[i].order_ptr = order_ptr;
}
return;
} /* add_flush_op() */
-
/*-------------------------------------------------------------------------
* Function: create_pinned_entry_dependency
*
@@ -1751,27 +1542,20 @@ add_flush_op(int target_type,
*/
void
-create_pinned_entry_dependency(H5F_t * file_ptr,
- int pinning_type,
- int pinning_idx,
- int pinned_type,
- int pinned_idx)
+create_pinned_entry_dependency(H5F_t *file_ptr, int pinning_type, int pinning_idx, int pinned_type,
+ int pinned_idx)
{
- test_entry_t * pinning_base_addr;
- test_entry_t * pinning_entry_ptr;
- test_entry_t * pinned_base_addr;
- test_entry_t * pinned_entry_ptr;
-
- if ( pass ) {
-
- HDassert( ( 0 <= pinning_type ) &&
- ( pinning_type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= pinning_idx ) &&
- ( pinning_idx <= max_indices[pinning_type] ) );
- HDassert( ( 0 <= pinned_type ) &&
- ( pinned_type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= pinned_idx ) &&
- ( pinned_idx <= max_indices[pinned_type] ) );
+ test_entry_t *pinning_base_addr;
+ test_entry_t *pinning_entry_ptr;
+ test_entry_t *pinned_base_addr;
+ test_entry_t *pinned_entry_ptr;
+
+ if (pass) {
+
+ HDassert((0 <= pinning_type) && (pinning_type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= pinning_idx) && (pinning_idx <= max_indices[pinning_type]));
+ HDassert((0 <= pinned_type) && (pinned_type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= pinned_idx) && (pinned_idx <= max_indices[pinned_type]));
pinning_base_addr = entries[pinning_type];
pinning_entry_ptr = &(pinning_base_addr[pinning_idx]);
@@ -1779,34 +1563,33 @@ create_pinned_entry_dependency(H5F_t * file_ptr,
pinned_base_addr = entries[pinned_type];
pinned_entry_ptr = &(pinned_base_addr[pinned_idx]);
- HDassert( pinning_entry_ptr->index == pinning_idx );
- HDassert( pinning_entry_ptr->type == pinning_type );
- HDassert( pinning_entry_ptr == pinning_entry_ptr->self );
- HDassert( pinning_entry_ptr->num_pins < MAX_PINS );
+ HDassert(pinning_entry_ptr->index == pinning_idx);
+ HDassert(pinning_entry_ptr->type == pinning_type);
+ HDassert(pinning_entry_ptr == pinning_entry_ptr->self);
+ HDassert(pinning_entry_ptr->num_pins < MAX_PINS);
- HDassert( pinning_entry_ptr->index == pinning_idx );
- HDassert( pinning_entry_ptr->type == pinning_type );
- HDassert( pinning_entry_ptr == pinning_entry_ptr->self );
- HDassert( ! ( pinning_entry_ptr->is_protected ) );
+ HDassert(pinning_entry_ptr->index == pinning_idx);
+ HDassert(pinning_entry_ptr->type == pinning_type);
+ HDassert(pinning_entry_ptr == pinning_entry_ptr->self);
+ HDassert(!(pinning_entry_ptr->is_protected));
- pinning_entry_ptr->pin_type[pinning_entry_ptr->num_pins] = pinned_type;
- pinning_entry_ptr->pin_idx[pinning_entry_ptr->num_pins] = pinned_idx;
- (pinning_entry_ptr->num_pins)++;
+ pinning_entry_ptr->pin_type[pinning_entry_ptr->num_pins] = pinned_type;
+ pinning_entry_ptr->pin_idx[pinning_entry_ptr->num_pins] = pinned_idx;
+ (pinning_entry_ptr->num_pins)++;
- if ( pinned_entry_ptr->pinning_ref_count == 0 ) {
+ if (pinned_entry_ptr->pinning_ref_count == 0) {
- protect_entry(file_ptr, pinned_type, pinned_idx);
- unprotect_entry(file_ptr, pinned_type, pinned_idx, H5C__PIN_ENTRY_FLAG);
- }
+ protect_entry(file_ptr, pinned_type, pinned_idx);
+ unprotect_entry(file_ptr, pinned_type, pinned_idx, H5C__PIN_ENTRY_FLAG);
+ }
- (pinned_entry_ptr->pinning_ref_count)++;
+ (pinned_entry_ptr->pinning_ref_count)++;
}
return;
} /* create_pinned_entry_dependency() */
-
/*-------------------------------------------------------------------------
* Function: dirty_entry
*
@@ -1829,62 +1612,58 @@ create_pinned_entry_dependency(H5F_t * file_ptr,
*/
void
-dirty_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- hbool_t dirty_pin)
+dirty_entry(H5F_t *file_ptr, int32_t type, int32_t idx, hbool_t dirty_pin)
{
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
- HDassert( file_ptr );
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ HDassert(file_ptr);
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
- if ( pass ) {
+ if (pass) {
- if ( dirty_pin ) {
+ if (dirty_pin) {
H5C_t *cache_ptr = file_ptr->shared->cache;
HDassert(cache_ptr);
- if ( ! entry_in_cache(cache_ptr, type, idx) ) {
+ if (!entry_in_cache(cache_ptr, type, idx)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "entry to be dirty pinned is not in cache.";
-
- } else {
+ }
+ else {
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
- if ( ! ( (entry_ptr->header).is_pinned ) ) {
+ if (!((entry_ptr->header).is_pinned)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "entry to be dirty pinned is not pinned.";
+ }
+ else {
- } else {
-
- mark_entry_dirty(type, idx);
-
- }
+ mark_entry_dirty(type, idx);
+ }
+ }
}
- } else {
+ else {
- protect_entry(file_ptr, type, idx);
+ protect_entry(file_ptr, type, idx);
unprotect_entry(file_ptr, type, idx, H5C__DIRTIED_FLAG);
- }
+ }
}
return;
} /* dirty_entry() */
-
/*-------------------------------------------------------------------------
* Function: execute_flush_op
*
@@ -1902,150 +1681,134 @@ dirty_entry(H5F_t * file_ptr,
*/
void
-execute_flush_op(H5F_t * file_ptr,
- struct test_entry_t * entry_ptr,
- struct flush_op * op_ptr,
- unsigned * flags_ptr)
+execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, struct flush_op *op_ptr,
+ unsigned *flags_ptr)
{
- H5C_t * cache_ptr;
+ H5C_t *cache_ptr;
- HDassert( file_ptr );
+ HDassert(file_ptr);
cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr != NULL );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( entry_ptr != NULL );
- HDassert( entry_ptr = entry_ptr->self );
- HDassert( entry_ptr->header.addr == entry_ptr->addr );
- HDassert( ( entry_ptr->flush_op_self_resize_in_progress ) ||
- ( entry_ptr->header.size == entry_ptr->size ) );
- HDassert( op_ptr != NULL );
- HDassert( ( 0 <= entry_ptr->type ) &&
- ( entry_ptr->type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= entry_ptr->index ) &&
- ( entry_ptr->index <= max_indices[entry_ptr->type] ) );
- HDassert( ( 0 <= op_ptr->type ) &&
- ( op_ptr->type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= op_ptr->idx ) &&
- ( op_ptr->idx <= max_indices[op_ptr->type] ) );
- HDassert( flags_ptr != NULL );
+ HDassert(cache_ptr != NULL);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(entry_ptr != NULL);
+ HDassert(entry_ptr = entry_ptr->self);
+ HDassert(entry_ptr->header.addr == entry_ptr->addr);
+ HDassert((entry_ptr->flush_op_self_resize_in_progress) || (entry_ptr->header.size == entry_ptr->size));
+ HDassert(op_ptr != NULL);
+ HDassert((0 <= entry_ptr->type) && (entry_ptr->type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= entry_ptr->index) && (entry_ptr->index <= max_indices[entry_ptr->type]));
+ HDassert((0 <= op_ptr->type) && (op_ptr->type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= op_ptr->idx) && (op_ptr->idx <= max_indices[op_ptr->type]));
+ HDassert(flags_ptr != NULL);
#ifndef H5_HAVE_STDBOOL_H
/* Check for TRUE or FALSE if we're using an integer type instead
* of a real Boolean type.
*/
- HDassert( ( op_ptr->flag == FALSE ) || ( op_ptr->flag == TRUE ) );
+ HDassert((op_ptr->flag == FALSE) || (op_ptr->flag == TRUE));
#endif /* H5_HAVE_STDBOOL_H */
- if ( pass ) {
+ if (pass) {
- switch ( op_ptr->op_code )
- {
- case FLUSH_OP__NO_OP:
- break;
+ switch (op_ptr->op_code) {
+ case FLUSH_OP__NO_OP:
+ break;
- case FLUSH_OP__DIRTY:
- HDassert( ( entry_ptr->type != op_ptr->type ) ||
- ( entry_ptr->index != op_ptr->idx ) );
+ case FLUSH_OP__DIRTY:
+ HDassert((entry_ptr->type != op_ptr->type) || (entry_ptr->index != op_ptr->idx));
- dirty_entry(file_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag);
- break;
+ dirty_entry(file_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag);
+ break;
case FLUSH_OP__RESIZE:
- if ( ( entry_ptr->type == op_ptr->type ) &&
- ( entry_ptr->index == op_ptr->idx ) ) {
+ if ((entry_ptr->type == op_ptr->type) && (entry_ptr->index == op_ptr->idx)) {
/* the flush operation is acting on the entry to
- * which it is attached. Handle this here:
- */
- HDassert( entry_ptr->type == VARIABLE_ENTRY_TYPE );
- HDassert( op_ptr->size > 0 );
- HDassert( op_ptr->size <= VARIABLE_ENTRY_SIZE );
+ * which it is attached. Handle this here:
+ */
+ HDassert(entry_ptr->type == VARIABLE_ENTRY_TYPE);
+ HDassert(op_ptr->size > 0);
+ HDassert(op_ptr->size <= VARIABLE_ENTRY_SIZE);
entry_ptr->size = op_ptr->size;
- (*flags_ptr) |= H5C__SERIALIZE_RESIZED_FLAG;
-
- entry_ptr->flush_op_self_resize_in_progress = TRUE;
+ (*flags_ptr) |= H5C__SERIALIZE_RESIZED_FLAG;
- } else {
+ entry_ptr->flush_op_self_resize_in_progress = TRUE;
+ }
+ else {
- /* change the size of some other entry */
+ /* change the size of some other entry */
- resize_entry(file_ptr, op_ptr->type, op_ptr->idx,
- op_ptr->size, op_ptr->flag);
- }
- break;
+ resize_entry(file_ptr, op_ptr->type, op_ptr->idx, op_ptr->size, op_ptr->flag);
+ }
+ break;
- case FLUSH_OP__MOVE:
- if((entry_ptr->type == op_ptr->type) &&
- (entry_ptr->index == op_ptr->idx)) {
+ case FLUSH_OP__MOVE:
+ if ((entry_ptr->type == op_ptr->type) && (entry_ptr->index == op_ptr->idx)) {
/* the flush operation is acting on the entry to
- * which it is attached. Handle this here:
- */
+ * which it is attached. Handle this here:
+ */
- HDassert(((*flags_ptr) & H5C__SERIALIZE_RESIZED_FLAG) != 0);
+ HDassert(((*flags_ptr) & H5C__SERIALIZE_RESIZED_FLAG) != 0);
(*flags_ptr) |= H5C__SERIALIZE_MOVED_FLAG;
- if(op_ptr->flag) {
+ if (op_ptr->flag) {
HDassert(entry_ptr->addr == entry_ptr->alt_addr);
- entry_ptr->addr = entry_ptr->main_addr;
+ entry_ptr->addr = entry_ptr->main_addr;
entry_ptr->at_main_addr = TRUE;
} /* end if */
else {
HDassert(entry_ptr->addr == entry_ptr->main_addr);
- entry_ptr->addr = entry_ptr->alt_addr;
+ entry_ptr->addr = entry_ptr->alt_addr;
entry_ptr->at_main_addr = FALSE;
} /* end else */
- } /* end if */
+ } /* end if */
else
- move_entry(cache_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag);
- break;
+ move_entry(cache_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag);
+ break;
- case FLUSH_OP__ORDER:
- HDassert( op_ptr->order_ptr );
+ case FLUSH_OP__ORDER:
+ HDassert(op_ptr->order_ptr);
entry_ptr->flush_order = *op_ptr->order_ptr;
(*op_ptr->order_ptr)++;
- break;
-
- case FLUSH_OP__EXPUNGE:
- /* the expunge flush op exists to allow us to simulate the
- * case in which an entry is removed from the cashe as the
- * the result of the flush of a second entry. At present,
- * this can only happen via the take ownership flag, but
- * we will make this test feature more general to as to make
- * tests easier to write.
- *
- * When this operation is executed, the target entry is
- * removed from the cache without being flushed if dirty
- * via the expunge_entry() test function (which calls
- * H5C_expunge_entry()). Note that this flush operation
- * must always be executed on an entry other than the
- * entry being flushed.
- */
- HDassert( ( entry_ptr->type != op_ptr->type ) ||
- ( entry_ptr->index != op_ptr->idx ) );
- expunge_entry(file_ptr, op_ptr->type, op_ptr->idx);
- break;
-
- case FLUSH_OP__DEST_FLUSH_DEP:
- HDassert( ( entry_ptr->type != op_ptr->type ) ||
- ( entry_ptr->index != op_ptr->idx ) );
- destroy_flush_dependency(op_ptr->type, op_ptr->idx,
- entry_ptr->type, entry_ptr->index);
break;
- default:
- pass = FALSE;
+ case FLUSH_OP__EXPUNGE:
+ /* the expunge flush op exists to allow us to simulate the
+ * case in which an entry is removed from the cashe as the
+ * the result of the flush of a second entry. At present,
+ * this can only happen via the take ownership flag, but
+ * we will make this test feature more general to as to make
+ * tests easier to write.
+ *
+ * When this operation is executed, the target entry is
+ * removed from the cache without being flushed if dirty
+ * via the expunge_entry() test function (which calls
+ * H5C_expunge_entry()). Note that this flush operation
+ * must always be executed on an entry other than the
+ * entry being flushed.
+ */
+ HDassert((entry_ptr->type != op_ptr->type) || (entry_ptr->index != op_ptr->idx));
+ expunge_entry(file_ptr, op_ptr->type, op_ptr->idx);
+ break;
+
+ case FLUSH_OP__DEST_FLUSH_DEP:
+ HDassert((entry_ptr->type != op_ptr->type) || (entry_ptr->index != op_ptr->idx));
+ destroy_flush_dependency(op_ptr->type, op_ptr->idx, entry_ptr->type, entry_ptr->index);
+ break;
+
+ default:
+ pass = FALSE;
failure_mssg = "Undefined flush op code.";
- break;
- }
+ break;
+ }
}
return;
} /* execute_flush_op() */
-
/*-------------------------------------------------------------------------
* Function: entry_in_cache
*
@@ -2061,40 +1824,37 @@ execute_flush_op(H5F_t * file_ptr,
*/
hbool_t
-entry_in_cache(H5C_t * cache_ptr,
- int32_t type,
- int32_t idx)
+entry_in_cache(H5C_t *cache_ptr, int32_t type, int32_t idx)
{
- hbool_t in_cache = FALSE; /* will set to TRUE if necessary */
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
- H5C_cache_entry_t * test_ptr = NULL;
+ hbool_t in_cache = FALSE; /* will set to TRUE if necessary */
+ test_entry_t * base_addr;
+ test_entry_t * entry_ptr;
+ H5C_cache_entry_t *test_ptr = NULL;
- HDassert( cache_ptr );
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ HDassert(cache_ptr);
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
H5C_TEST__SEARCH_INDEX(cache_ptr, entry_ptr->addr, test_ptr)
- if ( test_ptr != NULL ) {
+ if (test_ptr != NULL) {
in_cache = TRUE;
- HDassert( test_ptr == (H5C_cache_entry_t *)entry_ptr );
- HDassert( entry_ptr->addr == entry_ptr->header.addr );
+ HDassert(test_ptr == (H5C_cache_entry_t *)entry_ptr);
+ HDassert(entry_ptr->addr == entry_ptr->header.addr);
}
- return(in_cache);
+ return (in_cache);
} /* entry_in_cache() */
-
/*-------------------------------------------------------------------------
* Function: create_entry_arrays
*
@@ -2113,93 +1873,94 @@ create_entry_arrays(void)
{
/* pico entries */
- if(NULL == (pico_entries = (test_entry_t *)HDcalloc(NUM_PICO_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (pico_entries = (test_entry_t *)HDcalloc(NUM_PICO_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_pico_entries = (test_entry_t *)HDcalloc(NUM_PICO_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_pico_entries = (test_entry_t *)HDcalloc(NUM_PICO_ENTRIES, sizeof(test_entry_t))))
goto error;
/* nano entries */
- if(NULL == (nano_entries = (test_entry_t *)HDcalloc(NUM_NANO_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (nano_entries = (test_entry_t *)HDcalloc(NUM_NANO_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_nano_entries = (test_entry_t *)HDcalloc(NUM_NANO_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_nano_entries = (test_entry_t *)HDcalloc(NUM_NANO_ENTRIES, sizeof(test_entry_t))))
goto error;
/* micro entries */
- if(NULL == (micro_entries = (test_entry_t *)HDcalloc(NUM_MICRO_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (micro_entries = (test_entry_t *)HDcalloc(NUM_MICRO_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_micro_entries = (test_entry_t *)HDcalloc(NUM_MICRO_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_micro_entries = (test_entry_t *)HDcalloc(NUM_MICRO_ENTRIES, sizeof(test_entry_t))))
goto error;
/* tiny entries */
- if(NULL == (tiny_entries = (test_entry_t *)HDcalloc(NUM_TINY_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (tiny_entries = (test_entry_t *)HDcalloc(NUM_TINY_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_tiny_entries = (test_entry_t *)HDcalloc(NUM_TINY_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_tiny_entries = (test_entry_t *)HDcalloc(NUM_TINY_ENTRIES, sizeof(test_entry_t))))
goto error;
/* small entries */
- if(NULL == (small_entries = (test_entry_t *)HDcalloc(NUM_SMALL_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (small_entries = (test_entry_t *)HDcalloc(NUM_SMALL_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_small_entries = (test_entry_t *)HDcalloc(NUM_SMALL_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_small_entries = (test_entry_t *)HDcalloc(NUM_SMALL_ENTRIES, sizeof(test_entry_t))))
goto error;
/* medium entries */
- if(NULL == (medium_entries = (test_entry_t *)HDcalloc(NUM_MEDIUM_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (medium_entries = (test_entry_t *)HDcalloc(NUM_MEDIUM_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_medium_entries = (test_entry_t *)HDcalloc(NUM_MEDIUM_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_medium_entries = (test_entry_t *)HDcalloc(NUM_MEDIUM_ENTRIES, sizeof(test_entry_t))))
goto error;
/* large entries */
- if(NULL == (large_entries = (test_entry_t *)HDcalloc(NUM_LARGE_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (large_entries = (test_entry_t *)HDcalloc(NUM_LARGE_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_large_entries = (test_entry_t *)HDcalloc(NUM_LARGE_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_large_entries = (test_entry_t *)HDcalloc(NUM_LARGE_ENTRIES, sizeof(test_entry_t))))
goto error;
/* huge entries */
- if(NULL == (huge_entries = (test_entry_t *)HDcalloc(NUM_HUGE_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (huge_entries = (test_entry_t *)HDcalloc(NUM_HUGE_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_huge_entries = (test_entry_t *)HDcalloc(NUM_HUGE_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_huge_entries = (test_entry_t *)HDcalloc(NUM_HUGE_ENTRIES, sizeof(test_entry_t))))
goto error;
/* monster entries */
- if(NULL == (monster_entries = (test_entry_t *)HDcalloc(NUM_MONSTER_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (monster_entries = (test_entry_t *)HDcalloc(NUM_MONSTER_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_monster_entries = (test_entry_t *)HDcalloc(NUM_MONSTER_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_monster_entries = (test_entry_t *)HDcalloc(NUM_MONSTER_ENTRIES, sizeof(test_entry_t))))
goto error;
/* variable entries */
- if(NULL == (variable_entries = (test_entry_t *)HDcalloc(NUM_VARIABLE_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (variable_entries = (test_entry_t *)HDcalloc(NUM_VARIABLE_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_variable_entries = (test_entry_t *)HDcalloc(NUM_VARIABLE_ENTRIES, sizeof(test_entry_t))))
+ if (NULL ==
+ (orig_variable_entries = (test_entry_t *)HDcalloc(NUM_VARIABLE_ENTRIES, sizeof(test_entry_t))))
goto error;
/* notify entries */
- if(NULL == (notify_entries = (test_entry_t *)HDcalloc(NUM_NOTIFY_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (notify_entries = (test_entry_t *)HDcalloc(NUM_NOTIFY_ENTRIES, sizeof(test_entry_t))))
goto error;
- if(NULL == (orig_notify_entries = (test_entry_t *)HDcalloc(NUM_NOTIFY_ENTRIES, sizeof(test_entry_t))))
+ if (NULL == (orig_notify_entries = (test_entry_t *)HDcalloc(NUM_NOTIFY_ENTRIES, sizeof(test_entry_t))))
goto error;
- entries[0] = pico_entries;
- entries[1] = nano_entries;
- entries[2] = micro_entries;
- entries[3] = tiny_entries;
- entries[4] = small_entries;
- entries[5] = medium_entries;
- entries[6] = large_entries;
- entries[7] = huge_entries;
- entries[8] = monster_entries;
- entries[9] = variable_entries;
+ entries[0] = pico_entries;
+ entries[1] = nano_entries;
+ entries[2] = micro_entries;
+ entries[3] = tiny_entries;
+ entries[4] = small_entries;
+ entries[5] = medium_entries;
+ entries[6] = large_entries;
+ entries[7] = huge_entries;
+ entries[8] = monster_entries;
+ entries[9] = variable_entries;
entries[10] = notify_entries;
- orig_entries[0] = orig_pico_entries;
- orig_entries[1] = orig_nano_entries;
- orig_entries[2] = orig_micro_entries;
- orig_entries[3] = orig_tiny_entries;
- orig_entries[4] = orig_small_entries;
- orig_entries[5] = orig_medium_entries;
- orig_entries[6] = orig_large_entries;
- orig_entries[7] = orig_huge_entries;
- orig_entries[8] = orig_monster_entries;
- orig_entries[9] = orig_variable_entries;
+ orig_entries[0] = orig_pico_entries;
+ orig_entries[1] = orig_nano_entries;
+ orig_entries[2] = orig_micro_entries;
+ orig_entries[3] = orig_tiny_entries;
+ orig_entries[4] = orig_small_entries;
+ orig_entries[5] = orig_medium_entries;
+ orig_entries[6] = orig_large_entries;
+ orig_entries[7] = orig_huge_entries;
+ orig_entries[8] = orig_monster_entries;
+ orig_entries[9] = orig_variable_entries;
orig_entries[10] = orig_notify_entries;
return SUCCEED;
@@ -2210,7 +1971,6 @@ error:
} /* create_entry_arrays() */
-
/*-------------------------------------------------------------------------
* Function: free_entry_arrays
*
@@ -2276,7 +2036,6 @@ free_entry_arrays(void)
} /* free_entry_arrays() */
-
/*-------------------------------------------------------------------------
* Function: reset_entries
*
@@ -2294,31 +2053,28 @@ void
reset_entries(void)
{
- int i;
- int32_t max_index;
- test_entry_t * base_addr;
- test_entry_t * orig_base_addr;
+ int i;
+ int32_t max_index;
+ test_entry_t *base_addr;
+ test_entry_t *orig_base_addr;
- if( !orig_entry_arrays_init)
- {
- haddr_t addr = PICO_BASE_ADDR;
+ if (!orig_entry_arrays_init) {
+ haddr_t addr = PICO_BASE_ADDR;
haddr_t alt_addr = PICO_ALT_BASE_ADDR;
- size_t entry_size;
+ size_t entry_size;
- for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
- {
+ for (i = 0; i < NUMBER_OF_ENTRY_TYPES; i++) {
int j;
- entry_size = entry_sizes[i];
- max_index = max_indices[i];
- base_addr = entries[i];
+ entry_size = entry_sizes[i];
+ max_index = max_indices[i];
+ base_addr = entries[i];
orig_base_addr = orig_entries[i];
- HDassert( base_addr );
- HDassert( orig_base_addr );
+ HDassert(base_addr);
+ HDassert(orig_base_addr);
- for ( j = 0; j <= max_index; j++ )
- {
+ for (j = 0; j <= max_index; j++) {
int k;
/* one can argue that we should fill the header with garbage.
@@ -2327,108 +2083,104 @@ reset_entries(void)
* enough.
*/
- base_addr[j].header.addr = (haddr_t)0;
- base_addr[j].header.size = (size_t)0;
- base_addr[j].header.type = NULL;
- base_addr[j].header.is_dirty = FALSE;
+ base_addr[j].header.addr = (haddr_t)0;
+ base_addr[j].header.size = (size_t)0;
+ base_addr[j].header.type = NULL;
+ base_addr[j].header.is_dirty = FALSE;
base_addr[j].header.is_protected = FALSE;
base_addr[j].header.is_read_only = FALSE;
base_addr[j].header.ro_ref_count = FALSE;
- base_addr[j].header.next = NULL;
- base_addr[j].header.prev = NULL;
+ base_addr[j].header.next = NULL;
+ base_addr[j].header.prev = NULL;
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
base_addr[j].header.aux_next = NULL;
base_addr[j].header.aux_prev = NULL;
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
- base_addr[j].self = &(base_addr[j]);
- base_addr[j].cache_ptr = NULL;
+ base_addr[j].self = &(base_addr[j]);
+ base_addr[j].cache_ptr = NULL;
base_addr[j].written_to_main_addr = FALSE;
- base_addr[j].written_to_alt_addr = FALSE;
- base_addr[j].addr = addr;
- base_addr[j].at_main_addr = TRUE;
- base_addr[j].main_addr = addr;
- base_addr[j].alt_addr = alt_addr;
- base_addr[j].size = entry_size;
- base_addr[j].type = i;
- base_addr[j].index = j;
- base_addr[j].serializes = 0;
- base_addr[j].deserializes = 0;
- base_addr[j].is_dirty = FALSE;
- base_addr[j].is_protected = FALSE;
- base_addr[j].is_read_only = FALSE;
- base_addr[j].ro_ref_count = FALSE;
+ base_addr[j].written_to_alt_addr = FALSE;
+ base_addr[j].addr = addr;
+ base_addr[j].at_main_addr = TRUE;
+ base_addr[j].main_addr = addr;
+ base_addr[j].alt_addr = alt_addr;
+ base_addr[j].size = entry_size;
+ base_addr[j].type = i;
+ base_addr[j].index = j;
+ base_addr[j].serializes = 0;
+ base_addr[j].deserializes = 0;
+ base_addr[j].is_dirty = FALSE;
+ base_addr[j].is_protected = FALSE;
+ base_addr[j].is_read_only = FALSE;
+ base_addr[j].ro_ref_count = FALSE;
base_addr[j].is_corked = FALSE;
- base_addr[j].is_pinned = FALSE;
+ base_addr[j].is_pinned = FALSE;
base_addr[j].pinning_ref_count = 0;
- base_addr[j].num_pins = 0;
- for ( k = 0; k < MAX_PINS; k++ )
- {
+ base_addr[j].num_pins = 0;
+ for (k = 0; k < MAX_PINS; k++) {
base_addr[j].pin_type[k] = -1;
- base_addr[j].pin_idx[k] = -1;
+ base_addr[j].pin_idx[k] = -1;
}
base_addr[j].num_flush_ops = 0;
- for ( k = 0; k < MAX_FLUSH_OPS; k++ )
- {
+ for (k = 0; k < MAX_FLUSH_OPS; k++) {
base_addr[j].flush_ops[k].op_code = FLUSH_OP__NO_OP;
- base_addr[j].flush_ops[k].type = -1;
- base_addr[j].flush_ops[k].idx = -1;
- base_addr[j].flush_ops[k].flag = FALSE;
- base_addr[j].flush_ops[k].size = 0;
+ base_addr[j].flush_ops[k].type = -1;
+ base_addr[j].flush_ops[k].idx = -1;
+ base_addr[j].flush_ops[k].flag = FALSE;
+ base_addr[j].flush_ops[k].size = 0;
}
base_addr[j].flush_op_self_resize_in_progress = FALSE;
base_addr[j].deserialized = FALSE;
- base_addr[j].serialized = FALSE;
- base_addr[j].destroyed = FALSE;
- base_addr[j].expunged = FALSE;
+ base_addr[j].serialized = FALSE;
+ base_addr[j].destroyed = FALSE;
+ base_addr[j].expunged = FALSE;
- base_addr[j].flush_dep_npar = 0;
- base_addr[j].flush_dep_nchd = 0;
+ base_addr[j].flush_dep_npar = 0;
+ base_addr[j].flush_dep_nchd = 0;
base_addr[j].flush_dep_ndirty_chd = 0;
- base_addr[j].pinned_from_client = FALSE;
- base_addr[j].pinned_from_cache = FALSE;
+ base_addr[j].pinned_from_client = FALSE;
+ base_addr[j].pinned_from_cache = FALSE;
base_addr[j].flush_order = 0;
base_addr[j].notify_after_insert_count = 0;
base_addr[j].notify_before_evict_count = 0;
- base_addr[j].actual_len = 0;
+ base_addr[j].actual_len = 0;
base_addr[j].max_verify_ct = 0;
- base_addr[j].verify_ct = 0;
+ base_addr[j].verify_ct = 0;
addr += (haddr_t)entry_size;
alt_addr += (haddr_t)entry_size;
} /* end for */
/* Make copy of entries in base_addr for later */
- HDmemcpy(orig_base_addr, base_addr, (size_t)(max_index + 1) * sizeof( *base_addr ));
+ HDmemcpy(orig_base_addr, base_addr, (size_t)(max_index + 1) * sizeof(*base_addr));
} /* end for */
/* Indicate that we've made a copy for later */
orig_entry_arrays_init = TRUE;
} /* end if */
else {
- for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
- {
- max_index = max_indices[i];
- base_addr = entries[i];
+ for (i = 0; i < NUMBER_OF_ENTRY_TYPES; i++) {
+ max_index = max_indices[i];
+ base_addr = entries[i];
orig_base_addr = orig_entries[i];
/* Make copy of entries in base_addr for later */
- HDmemcpy(base_addr, orig_base_addr, (size_t)(max_index + 1) * sizeof( *base_addr ));
+ HDmemcpy(base_addr, orig_base_addr, (size_t)(max_index + 1) * sizeof(*base_addr));
} /* end for */
- } /* end else */
+ } /* end else */
return;
} /* reset_entries() */
-
/*-------------------------------------------------------------------------
* Function: resize_entry
*
@@ -2449,84 +2201,79 @@ reset_entries(void)
*/
void
-resize_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- size_t new_size,
- hbool_t in_cache)
+resize_entry(H5F_t *file_ptr, int32_t type, int32_t idx, size_t new_size, hbool_t in_cache)
{
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
- herr_t result;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
+ herr_t result;
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( type == VARIABLE_ENTRY_TYPE );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
- HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes[type] ) );
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert(type == VARIABLE_ENTRY_TYPE);
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
+ HDassert((0 < new_size) && (new_size <= entry_sizes[type]));
- if ( pass ) {
+ if (pass) {
- if ( in_cache ) {
+ if (in_cache) {
H5C_t *cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr );
+ HDassert(cache_ptr);
- if ( ! entry_in_cache(cache_ptr, type, idx) ) {
+ if (!entry_in_cache(cache_ptr, type, idx)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "entry to be resized pinned is not in cache.";
-
- } else {
+ }
+ else {
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
- HDassert( entry_ptr == entry_ptr->self );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr->cache_ptr == cache_ptr);
+ HDassert(entry_ptr == entry_ptr->self);
- if ( ! ( entry_ptr->header.is_pinned || entry_ptr->header.is_protected ) ) {
+ if (!(entry_ptr->header.is_pinned || entry_ptr->header.is_protected)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "entry to be resized is not pinned or protected.";
-
- } else {
+ }
+ else {
hbool_t was_dirty = entry_ptr->is_dirty;
entry_ptr->size = new_size;
- result = H5C_resize_entry((void *)entry_ptr, new_size);
+ result = H5C_resize_entry((void *)entry_ptr, new_size);
entry_ptr->is_dirty = TRUE;
- if(entry_ptr->flush_dep_npar > 0 && !was_dirty)
+ if (entry_ptr->flush_dep_npar > 0 && !was_dirty)
mark_flush_dep_dirty(entry_ptr);
- if ( result != SUCCEED ) {
+ if (result != SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error(s) in H5C_resize_entry().";
+ }
+ else {
- } else {
-
- HDassert( entry_ptr->size = (entry_ptr->header).size );
-
+ HDassert(entry_ptr->size = (entry_ptr->header).size);
}
}
}
- } else {
+ }
+ else {
- protect_entry(file_ptr, type, idx);
+ protect_entry(file_ptr, type, idx);
resize_entry(file_ptr, type, idx, new_size, TRUE);
- unprotect_entry(file_ptr, type, idx, H5C__DIRTIED_FLAG);
- }
+ unprotect_entry(file_ptr, type, idx, H5C__DIRTIED_FLAG);
+ }
}
return;
} /* resize_entry() */
-
/*-------------------------------------------------------------------------
* Function: verify_clean
*
@@ -2547,34 +2294,31 @@ void
verify_clean(void)
{
- int i;
- int j;
- int dirty_count = 0;
- int32_t max_index;
- test_entry_t * base_addr;
+ int i;
+ int j;
+ int dirty_count = 0;
+ int32_t max_index;
+ test_entry_t *base_addr;
- if ( pass ) {
+ if (pass) {
- for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
- {
+ for (i = 0; i < NUMBER_OF_ENTRY_TYPES; i++) {
max_index = max_indices[i];
base_addr = entries[i];
- HDassert( base_addr );
+ HDassert(base_addr);
- for ( j = 0; j <= max_index; j++ )
- {
- if ( ( base_addr[j].header.is_dirty ) ||
- ( base_addr[j].is_dirty ) ) {
+ for (j = 0; j <= max_index; j++) {
+ if ((base_addr[j].header.is_dirty) || (base_addr[j].is_dirty)) {
dirty_count++;
}
}
}
- if ( dirty_count > 0 ) {
+ if (dirty_count > 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "verify_clean() found dirty entry(s).";
}
}
@@ -2583,7 +2327,6 @@ verify_clean(void)
} /* verify_clean() */
-
/*-------------------------------------------------------------------------
* Function: verify_entry_status
*
@@ -2602,238 +2345,178 @@ verify_clean(void)
*/
void
-verify_entry_status(H5C_t * cache_ptr,
- int tag,
- int num_entries,
- struct expected_entry_status expected[])
+verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_entry_status expected[])
{
- static char msg[256];
- int i;
+ static char msg[256];
+ int i;
i = 0;
- while ( ( pass ) && ( i < num_entries ) )
- {
- test_entry_t * base_addr = entries[expected[i].entry_type];
- test_entry_t * entry_ptr = &(base_addr[expected[i].entry_index]);
- hbool_t in_cache = FALSE; /* will set to TRUE if necessary */
- unsigned u; /* Local index variable */
+ while ((pass) && (i < num_entries)) {
+ test_entry_t *base_addr = entries[expected[i].entry_type];
+ test_entry_t *entry_ptr = &(base_addr[expected[i].entry_index]);
+ hbool_t in_cache = FALSE; /* will set to TRUE if necessary */
+ unsigned u; /* Local index variable */
- if ( ( ! expected[i].in_cache ) &&
- ( ( expected[i].is_protected ) || ( expected[i].is_pinned ) ) ) {
+ if ((!expected[i].in_cache) && ((expected[i].is_protected) || (expected[i].is_pinned))) {
- pass = FALSE;
- HDsprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i);
- failure_mssg = msg;
- }
+ pass = FALSE;
+ HDsprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i);
+ failure_mssg = msg;
+ }
- if ( ( ! expected[i].in_cache ) &&
- ( expected[i].is_dirty ) &&
- ( ! entry_ptr->expunged ) ) {
+ if ((!expected[i].in_cache) && (expected[i].is_dirty) && (!entry_ptr->expunged)) {
- pass = FALSE;
- HDsprintf(msg,
- "%d: expected[%d] specs non-expunged, dirty, non-resident.\n",
- tag, i);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d: expected[%d] specs non-expunged, dirty, non-resident.\n", tag, i);
+ failure_mssg = msg;
}
- if ( pass ) {
+ if (pass) {
- in_cache = entry_in_cache(cache_ptr, expected[i].entry_type,
- expected[i].entry_index);
+ in_cache = entry_in_cache(cache_ptr, expected[i].entry_type, expected[i].entry_index);
- if ( in_cache != expected[i].in_cache ) {
+ if (in_cache != expected[i].in_cache) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) in cache actual/expected = %d/%d.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)in_cache,
- (int)expected[i].in_cache);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) in cache actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index, (int)in_cache,
+ (int)expected[i].in_cache);
+ failure_mssg = msg;
+ }
}
- }
- if ( pass ) {
+ if (pass) {
- if ( entry_ptr->size != expected[i].size ) {
+ if (entry_ptr->size != expected[i].size) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) size actual/expected = %ld/%ld.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (long)(entry_ptr->size),
- (long)expected[i].size);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) size actual/expected = %ld/%ld.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index, (long)(entry_ptr->size),
+ (long)expected[i].size);
+ failure_mssg = msg;
+ }
}
- }
- if ( ( pass ) && ( in_cache ) ) {
+ if ((pass) && (in_cache)) {
- if ( entry_ptr->header.size != expected[i].size ) {
+ if (entry_ptr->header.size != expected[i].size) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) header size actual/expected = %ld/%ld.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (long)(entry_ptr->header.size),
- (long)expected[i].size);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) header size actual/expected = %ld/%ld.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (long)(entry_ptr->header.size), (long)expected[i].size);
+ failure_mssg = msg;
+ }
}
- }
- if ( pass ) {
+ if (pass) {
- if ( entry_ptr->at_main_addr != expected[i].at_main_addr ) {
+ if (entry_ptr->at_main_addr != expected[i].at_main_addr) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) at main addr actual/expected = %d/%d.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)(entry_ptr->at_main_addr),
- (int)expected[i].at_main_addr);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) at main addr actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->at_main_addr), (int)expected[i].at_main_addr);
+ failure_mssg = msg;
+ }
}
- }
- if ( pass ) {
+ if (pass) {
- if ( entry_ptr->is_dirty != expected[i].is_dirty ) {
+ if (entry_ptr->is_dirty != expected[i].is_dirty) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) is_dirty actual/expected = %d/%d.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)(entry_ptr->is_dirty),
- (int)expected[i].is_dirty);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) is_dirty actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->is_dirty), (int)expected[i].is_dirty);
+ failure_mssg = msg;
+ }
}
- }
- if ( ( pass ) && ( in_cache ) ) {
+ if ((pass) && (in_cache)) {
- if ( entry_ptr->header.is_dirty != expected[i].is_dirty ) {
+ if (entry_ptr->header.is_dirty != expected[i].is_dirty) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) header is_dirty actual/expected = %d/%d.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)(entry_ptr->header.is_dirty),
- (int)expected[i].is_dirty);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) header is_dirty actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->header.is_dirty), (int)expected[i].is_dirty);
+ failure_mssg = msg;
+ }
}
- }
- if ( pass ) {
+ if (pass) {
- if ( entry_ptr->is_protected != expected[i].is_protected ) {
+ if (entry_ptr->is_protected != expected[i].is_protected) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) is_protected actual/expected = %d/%d.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)(entry_ptr->is_protected),
- (int)expected[i].is_protected);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) is_protected actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->is_protected), (int)expected[i].is_protected);
+ failure_mssg = msg;
+ }
}
- }
- if ( ( pass ) && ( in_cache ) ) {
+ if ((pass) && (in_cache)) {
- if ( entry_ptr->header.is_protected != expected[i].is_protected ) {
+ if (entry_ptr->header.is_protected != expected[i].is_protected) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) header is_protected actual/expected = %d/%d.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)(entry_ptr->header.is_protected),
- (int)expected[i].is_protected);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) header is_protected actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->header.is_protected), (int)expected[i].is_protected);
+ failure_mssg = msg;
+ }
}
- }
- if ( pass ) {
+ if (pass) {
- if ( entry_ptr->is_pinned != expected[i].is_pinned ) {
+ if (entry_ptr->is_pinned != expected[i].is_pinned) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) is_pinned actual/expected = %d/%d.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)(entry_ptr->is_pinned),
- (int)expected[i].is_pinned);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) is_pinned actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->is_pinned), (int)expected[i].is_pinned);
+ failure_mssg = msg;
+ }
}
- }
- if ( pass ) {
+ if (pass) {
- if ( entry_ptr->is_corked != expected[i].is_corked) {
+ if (entry_ptr->is_corked != expected[i].is_corked) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) is_corked actual/expected = %d/%d.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)(entry_ptr->is_corked),
- (int)expected[i].is_corked);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) is_corked actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->is_corked), (int)expected[i].is_corked);
+ failure_mssg = msg;
+ }
}
- }
- if ( ( pass ) && ( in_cache ) ) {
+ if ((pass) && (in_cache)) {
- if ( entry_ptr->header.is_pinned != expected[i].is_pinned ) {
+ if (entry_ptr->header.is_pinned != expected[i].is_pinned) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) header is_pinned actual/expected = %d/%d.\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)(entry_ptr->header.is_pinned),
- (int)expected[i].is_pinned);
- failure_mssg = msg;
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d, %d) header is_pinned actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->header.is_pinned), (int)expected[i].is_pinned);
+ failure_mssg = msg;
+ }
}
- }
- if ( pass ) {
+ if (pass) {
- if ( ( entry_ptr->deserialized != expected[i].deserialized ) ||
- ( entry_ptr->serialized != expected[i].serialized ) ||
- ( entry_ptr->destroyed != expected[i].destroyed ) ) {
+ if ((entry_ptr->deserialized != expected[i].deserialized) ||
+ (entry_ptr->serialized != expected[i].serialized) ||
+ (entry_ptr->destroyed != expected[i].destroyed)) {
- pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d,%d) deserialized = %d(%d), serialized = %d(%d), dest = %d(%d)\n",
- tag,
- (int)expected[i].entry_type,
- (int)expected[i].entry_index,
- (int)(entry_ptr->deserialized),
- (int)(expected[i].deserialized),
- (int)(entry_ptr->serialized),
- (int)(expected[i].serialized),
- (int)(entry_ptr->destroyed),
- (int)(expected[i].destroyed));
+ pass = FALSE;
+ HDsprintf(msg, "%d entry (%d,%d) deserialized = %d(%d), serialized = %d(%d), dest = %d(%d)\n",
+ tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->deserialized), (int)(expected[i].deserialized),
+ (int)(entry_ptr->serialized), (int)(expected[i].serialized),
+ (int)(entry_ptr->destroyed), (int)(expected[i].destroyed));
failure_mssg = msg;
}
}
@@ -2841,136 +2524,99 @@ verify_entry_status(H5C_t * cache_ptr,
/* Check flush dependency fields */
/* # of flush dependency parents */
- if ( pass ) {
- if ( entry_ptr->flush_dep_npar != expected[i].flush_dep_npar ) {
+ if (pass) {
+ if (entry_ptr->flush_dep_npar != expected[i].flush_dep_npar) {
pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) flush_dep_npar actual/expected = %u/%u.\n",
- tag,
- expected[i].entry_type,
- expected[i].entry_index,
- entry_ptr->flush_dep_npar,
- expected[i].flush_dep_npar);
+ HDsprintf(msg, "%d entry (%d, %d) flush_dep_npar actual/expected = %u/%u.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_npar,
+ expected[i].flush_dep_npar);
failure_mssg = msg;
} /* end if */
- } /* end if */
- if ( ( pass ) && ( in_cache ) ) {
- if ( entry_ptr->header.flush_dep_nparents != expected[i].flush_dep_npar ) {
+ } /* end if */
+ if ((pass) && (in_cache)) {
+ if (entry_ptr->header.flush_dep_nparents != expected[i].flush_dep_npar) {
pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) header flush_dep_nparents actual/expected = %u/%u.\n",
- tag,
- expected[i].entry_type,
- expected[i].entry_index,
- entry_ptr->header.flush_dep_nparents,
- expected[i].flush_dep_npar);
+ HDsprintf(msg, "%d entry (%d, %d) header flush_dep_nparents actual/expected = %u/%u.\n", tag,
+ expected[i].entry_type, expected[i].entry_index,
+ entry_ptr->header.flush_dep_nparents, expected[i].flush_dep_npar);
failure_mssg = msg;
} /* end if */
- } /* end if */
+ } /* end if */
/* Flush dependency parent type & index. Note this algorithm assumes
* that the parents in both arrays are in the same order. */
- if ( pass ) {
- for ( u = 0; u < entry_ptr->flush_dep_npar; u++ ) {
- if ( entry_ptr->flush_dep_par_type[u] != expected[i].flush_dep_par_type[u] ) {
+ if (pass) {
+ for (u = 0; u < entry_ptr->flush_dep_npar; u++) {
+ if (entry_ptr->flush_dep_par_type[u] != expected[i].flush_dep_par_type[u]) {
pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) flush_dep_par_type[%u] actual/expected = %d/%d.\n",
- tag,
- expected[i].entry_type,
- expected[i].entry_index,
- u,
- entry_ptr->flush_dep_par_type[u],
- expected[i].flush_dep_par_type[u]);
+ HDsprintf(msg, "%d entry (%d, %d) flush_dep_par_type[%u] actual/expected = %d/%d.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, u,
+ entry_ptr->flush_dep_par_type[u], expected[i].flush_dep_par_type[u]);
failure_mssg = msg;
} /* end if */
- } /* end for */
- } /* end if */
- if ( pass ) {
- for ( u = 0; u < entry_ptr->flush_dep_npar; u++ ) {
- if ( entry_ptr->flush_dep_par_idx[u] != expected[i].flush_dep_par_idx[u] ) {
+ } /* end for */
+ } /* end if */
+ if (pass) {
+ for (u = 0; u < entry_ptr->flush_dep_npar; u++) {
+ if (entry_ptr->flush_dep_par_idx[u] != expected[i].flush_dep_par_idx[u]) {
pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) flush_dep_par_idx[%u] actual/expected = %d/%d.\n",
- tag,
- expected[i].entry_type,
- expected[i].entry_index,
- u,
- entry_ptr->flush_dep_par_idx[u],
- expected[i].flush_dep_par_idx[u]);
+ HDsprintf(msg, "%d entry (%d, %d) flush_dep_par_idx[%u] actual/expected = %d/%d.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, u,
+ entry_ptr->flush_dep_par_idx[u], expected[i].flush_dep_par_idx[u]);
failure_mssg = msg;
} /* end if */
- } /* end for */
- } /* end if */
+ } /* end for */
+ } /* end if */
/* # of flush dependency children and dirty children */
- if ( pass ) {
- if ( entry_ptr->flush_dep_nchd != expected[i].flush_dep_nchd ) {
+ if (pass) {
+ if (entry_ptr->flush_dep_nchd != expected[i].flush_dep_nchd) {
pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) flush_dep_nchd actual/expected = %u/%u.\n",
- tag,
- expected[i].entry_type,
- expected[i].entry_index,
- entry_ptr->flush_dep_nchd,
- expected[i].flush_dep_nchd);
+ HDsprintf(msg, "%d entry (%d, %d) flush_dep_nchd actual/expected = %u/%u.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_nchd,
+ expected[i].flush_dep_nchd);
failure_mssg = msg;
} /* end if */
- } /* end if */
- if ( ( pass ) && ( in_cache ) ) {
- if ( entry_ptr->header.flush_dep_nchildren != expected[i].flush_dep_nchd ) {
+ } /* end if */
+ if ((pass) && (in_cache)) {
+ if (entry_ptr->header.flush_dep_nchildren != expected[i].flush_dep_nchd) {
pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) header flush_dep_nchildren actual/expected = %u/%u.\n",
- tag,
- expected[i].entry_type,
- expected[i].entry_index,
- entry_ptr->header.flush_dep_nchildren,
- expected[i].flush_dep_nchd);
+ HDsprintf(msg, "%d entry (%d, %d) header flush_dep_nchildren actual/expected = %u/%u.\n", tag,
+ expected[i].entry_type, expected[i].entry_index,
+ entry_ptr->header.flush_dep_nchildren, expected[i].flush_dep_nchd);
failure_mssg = msg;
} /* end if */
- } /* end if */
- if ( pass ) {
- if ( entry_ptr->flush_dep_ndirty_chd != expected[i].flush_dep_ndirty_chd ) {
+ } /* end if */
+ if (pass) {
+ if (entry_ptr->flush_dep_ndirty_chd != expected[i].flush_dep_ndirty_chd) {
pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) flush_dep_ndirty_chd actual/expected = %u/%u.\n",
- tag,
- expected[i].entry_type,
- expected[i].entry_index,
- entry_ptr->flush_dep_ndirty_chd,
- expected[i].flush_dep_ndirty_chd);
+ HDsprintf(msg, "%d entry (%d, %d) flush_dep_ndirty_chd actual/expected = %u/%u.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_ndirty_chd,
+ expected[i].flush_dep_ndirty_chd);
failure_mssg = msg;
} /* end if */
- } /* end if */
- if ( ( pass ) && ( in_cache ) ) {
- if ( entry_ptr->header.flush_dep_ndirty_children != expected[i].flush_dep_ndirty_chd ) {
+ } /* end if */
+ if ((pass) && (in_cache)) {
+ if (entry_ptr->header.flush_dep_ndirty_children != expected[i].flush_dep_ndirty_chd) {
pass = FALSE;
HDsprintf(msg,
- "%d entry (%d, %d) header flush_dep_ndirty_children actual/expected = %u/%u.\n",
- tag,
- expected[i].entry_type,
- expected[i].entry_index,
- entry_ptr->header.flush_dep_ndirty_children,
- expected[i].flush_dep_ndirty_chd);
+ "%d entry (%d, %d) header flush_dep_ndirty_children actual/expected = %u/%u.\n",
+ tag, expected[i].entry_type, expected[i].entry_index,
+ entry_ptr->header.flush_dep_ndirty_children, expected[i].flush_dep_ndirty_chd);
failure_mssg = msg;
} /* end if */
- } /* end if */
+ } /* end if */
/* Flush dependency flush order */
- if ( pass ) {
- if ( expected[i].flush_order >= 0 && entry_ptr->flush_order != (unsigned)expected[i].flush_order ) {
+ if (pass) {
+ if (expected[i].flush_order >= 0 && entry_ptr->flush_order != (unsigned)expected[i].flush_order) {
pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) flush_order actual/expected = %u/%d.\n",
- tag,
- expected[i].entry_type,
- expected[i].entry_index,
- entry_ptr->flush_order,
- expected[i].flush_order);
+ HDsprintf(msg, "%d entry (%d, %d) flush_order actual/expected = %u/%d.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_order,
+ expected[i].flush_order);
failure_mssg = msg;
} /* end if */
- } /* end if */
+ } /* end if */
i++;
} /* while */
@@ -2979,7 +2625,6 @@ verify_entry_status(H5C_t * cache_ptr,
} /* verify_entry_status() */
-
/*-------------------------------------------------------------------------
* Function: verify_unprotected
*
@@ -3000,37 +2645,33 @@ void
verify_unprotected(void)
{
- int i;
- int j;
- int protected_count = 0;
- int32_t max_index;
- test_entry_t * base_addr;
+ int i;
+ int j;
+ int protected_count = 0;
+ int32_t max_index;
+ test_entry_t *base_addr;
- if ( pass ) {
+ if (pass) {
- for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
- {
+ for (i = 0; i < NUMBER_OF_ENTRY_TYPES; i++) {
max_index = max_indices[i];
base_addr = entries[i];
- HDassert( base_addr );
+ HDassert(base_addr);
- for ( j = 0; j <= max_index; j++ )
- {
- HDassert( base_addr[j].header.is_protected ==
- base_addr[j].is_protected );
+ for (j = 0; j <= max_index; j++) {
+ HDassert(base_addr[j].header.is_protected == base_addr[j].is_protected);
- if ( ( base_addr[j].header.is_protected ) ||
- ( base_addr[j].is_protected ) ) {
+ if ((base_addr[j].header.is_protected) || (base_addr[j].is_protected)) {
protected_count++;
}
}
}
- if ( protected_count > 0 ) {
+ if (protected_count > 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "verify_unprotected() found protected entry(s).";
}
}
@@ -3039,8 +2680,6 @@ verify_unprotected(void)
} /* verify_unprotected() */
-
-
/*-------------------------------------------------------------------------
* Function: expunge_entry()
*
@@ -3061,46 +2700,44 @@ verify_unprotected(void)
*/
void
-expunge_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx)
+expunge_entry(H5F_t *file_ptr, int32_t type, int32_t idx)
{
- herr_t result;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ herr_t result;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
- if ( pass ) {
+ if (pass) {
#ifndef NDEBUG
- H5C_t * cache_ptr = file_ptr->shared->cache;
+ H5C_t *cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr );
+ HDassert(cache_ptr);
#endif /* NDEBUG */
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
- HDassert( ! ( entry_ptr->header.is_protected ) );
- HDassert( ! ( entry_ptr->is_protected ) );
- HDassert( ! ( entry_ptr->header.is_pinned ) );
- HDassert( ! ( entry_ptr->is_pinned ) );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
+ HDassert(entry_ptr->cache_ptr == cache_ptr);
+ HDassert(!(entry_ptr->header.is_protected));
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(!(entry_ptr->header.is_pinned));
+ HDassert(!(entry_ptr->is_pinned));
result = H5C_expunge_entry(file_ptr, types[type], entry_ptr->addr, H5C__NO_FLAGS_SET);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error in H5C_expunge_entry().";
+ }
+ else {
- } else {
-
- entry_ptr->expunged = TRUE;
+ entry_ptr->expunged = TRUE;
}
}
@@ -3108,7 +2745,6 @@ expunge_entry(H5F_t * file_ptr,
} /* expunge_entry() */
-
/*-------------------------------------------------------------------------
* Function: flush_cache()
*
@@ -3120,14 +2756,14 @@ expunge_entry(H5F_t * file_ptr,
* Programmer: John Mainzer
* 6/23/04
*
- * Changes: Added code to setup and take down the skip list before
+ * Changes: Added code to setup and take down the skip list before
* and after calls to H5C_flush_cache(). Do this via calls
* to the H5C_FLUSH_CACHE macro.
*
* This is necessary, as H5C_flush() is called repeatedly
- * during file flush. If we setup and took down the
+ * during file flush. If we setup and took down the
* skip list on H5C_flush_cache(), we would find ourselves
- * doing this repeatedly -- which is contrary to the
+ * doing this repeatedly -- which is contrary to the
* objective of the exercise (avoiding as many skip list
* operations as possible).
*
@@ -3137,56 +2773,45 @@ expunge_entry(H5F_t * file_ptr,
*/
void
-flush_cache(H5F_t * file_ptr,
- hbool_t destroy_entries,
- hbool_t dump_stats,
- hbool_t dump_detailed_stats)
+flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_t dump_detailed_stats)
{
hbool_t verbose = FALSE;
verify_unprotected();
- if(pass) {
- H5C_t * cache_ptr;
+ if (pass) {
+ H5C_t *cache_ptr;
herr_t result = 0;
HDassert(file_ptr);
cache_ptr = file_ptr->shared->cache;
- if ( destroy_entries ) {
-
- H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
- "error in H5C_flush_cache().")
+ if (destroy_entries) {
- } else {
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "error in H5C_flush_cache().")
+ }
+ else {
- H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, \
- "error in H5C_flush_cache().")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "error in H5C_flush_cache().")
}
- if ( dump_stats ) {
+ if (dump_stats) {
H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
}
- if ( ( pass ) && ( destroy_entries ) &&
- ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ||
- ( cache_ptr->clean_index_size != 0 ) ||
- ( cache_ptr->dirty_index_size != 0 ) ) ) {
-
- if ( verbose ) {
-
- HDfprintf(stdout,
- "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n",
- FUNC,
- (long long)(cache_ptr->index_len),
- (long long)(cache_ptr->index_size),
- (long long)(cache_ptr->clean_index_size),
- (long long)(cache_ptr->dirty_index_size));
+ if ((pass) && (destroy_entries) &&
+ ((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) ||
+ (cache_ptr->clean_index_size != 0) || (cache_ptr->dirty_index_size != 0))) {
+
+ if (verbose) {
+
+ HDfprintf(stdout, "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n", FUNC,
+ (long long)(cache_ptr->index_len), (long long)(cache_ptr->index_size),
+ (long long)(cache_ptr->clean_index_size), (long long)(cache_ptr->dirty_index_size));
}
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "non zero index len/sizes after H5C_flush_cache() with invalidate.";
}
}
@@ -3195,7 +2820,6 @@ flush_cache(H5F_t * file_ptr,
} /* flush_cache() */
-
/*-------------------------------------------------------------------------
* Function: cork_entry_type()
*
@@ -3213,8 +2837,8 @@ flush_cache(H5F_t * file_ptr,
void
cork_entry_type(H5F_t *file_ptr, int32_t type)
{
- if(pass) {
- H5C_t *cache_ptr;
+ if (pass) {
+ H5C_t * cache_ptr;
haddr_t baddrs;
cache_ptr = file_ptr->shared->cache;
@@ -3223,15 +2847,14 @@ cork_entry_type(H5F_t *file_ptr, int32_t type)
HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
baddrs = base_addrs[type];
- if(H5C_cork(cache_ptr, baddrs, H5C__SET_CORK, NULL) < 0) {
- pass = FALSE;
+ if (H5C_cork(cache_ptr, baddrs, H5C__SET_CORK, NULL) < 0) {
+ pass = FALSE;
failure_mssg = "error in H5C_cork().";
} /* end if */
- } /* end if */
+ } /* end if */
} /* cork_entry_type() */
-
/*-------------------------------------------------------------------------
* Function: uncork_entry_type()
*
@@ -3249,8 +2872,8 @@ cork_entry_type(H5F_t *file_ptr, int32_t type)
void
uncork_entry_type(H5F_t *file_ptr, int32_t type)
{
- if(pass) {
- H5C_t *cache_ptr;
+ if (pass) {
+ H5C_t * cache_ptr;
haddr_t baddrs;
cache_ptr = file_ptr->shared->cache;
@@ -3259,15 +2882,14 @@ uncork_entry_type(H5F_t *file_ptr, int32_t type)
HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
baddrs = base_addrs[type];
- if(H5C_cork(cache_ptr, baddrs, H5C__UNCORK, NULL) < 0) {
- pass = FALSE;
+ if (H5C_cork(cache_ptr, baddrs, H5C__UNCORK, NULL) < 0) {
+ pass = FALSE;
failure_mssg = "error in H5C_cork().";
} /* end if */
- } /* end if */
+ } /* end if */
} /* uncork_entry_type() */
-
/*-------------------------------------------------------------------------
* Function: insert_entry()
*
@@ -3284,38 +2906,35 @@ uncork_entry_type(H5F_t *file_ptr, int32_t type)
*/
void
-insert_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- unsigned int flags)
+insert_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags)
{
- H5C_t * cache_ptr;
- herr_t result;
- hbool_t insert_pinned;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
- haddr_t baddrs;
+ H5C_t * cache_ptr;
+ herr_t result;
+ hbool_t insert_pinned;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
+ haddr_t baddrs;
- if ( pass ) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr );
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ HDassert(cache_ptr);
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- baddrs = base_addrs[type];
+ baddrs = base_addrs[type];
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( !(entry_ptr->is_protected) );
- HDassert( entry_ptr->flush_dep_npar == 0 );
- HDassert( entry_ptr->flush_dep_nchd == 0 );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(entry_ptr->flush_dep_npar == 0);
+ HDassert(entry_ptr->flush_dep_nchd == 0);
- insert_pinned = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0 );
+ insert_pinned = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0);
entry_ptr->is_dirty = TRUE;
@@ -3325,13 +2944,10 @@ insert_entry(H5F_t * file_ptr,
result = H5C_insert_entry(file_ptr, types[type], entry_ptr->addr, (void *)entry_ptr, flags);
- if ( ( result < 0 ) ||
- ( entry_ptr->header.is_protected ) ||
- ( entry_ptr->header.type != types[type] ) ||
- ( entry_ptr->size != entry_ptr->header.size ) ||
- ( entry_ptr->addr != entry_ptr->header.addr ) ) {
+ if ((result < 0) || (entry_ptr->header.is_protected) || (entry_ptr->header.type != types[type]) ||
+ (entry_ptr->size != entry_ptr->header.size) || (entry_ptr->addr != entry_ptr->header.addr)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error in H5C_insert().";
#if 0 /* This is useful debugging code. Lets keep it around. */
@@ -3352,17 +2968,17 @@ insert_entry(H5F_t * file_ptr,
} /* end if */
HDassert(entry_ptr->cache_ptr == NULL);
- entry_ptr->file_ptr = file_ptr;
+ entry_ptr->file_ptr = file_ptr;
entry_ptr->cache_ptr = cache_ptr;
- if(insert_pinned)
+ if (insert_pinned)
HDassert(entry_ptr->header.is_pinned);
else
HDassert(!(entry_ptr->header.is_pinned));
- entry_ptr->is_pinned = insert_pinned;
+ entry_ptr->is_pinned = insert_pinned;
entry_ptr->pinned_from_client = insert_pinned;
- if(entry_ptr->header.tag_info && entry_ptr->header.tag_info->corked)
+ if (entry_ptr->header.tag_info && entry_ptr->header.tag_info->corked)
entry_ptr->is_corked = TRUE;
HDassert(entry_ptr->header.is_dirty);
@@ -3373,7 +2989,6 @@ insert_entry(H5F_t * file_ptr,
} /* insert_entry() */
-
/*-------------------------------------------------------------------------
* Function: mark_entry_dirty()
*
@@ -3390,58 +3005,51 @@ insert_entry(H5F_t * file_ptr,
*/
void
-mark_entry_dirty(int32_t type,
- int32_t idx)
+mark_entry_dirty(int32_t type, int32_t idx)
{
- herr_t result;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
- hbool_t was_dirty;
+ herr_t result;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
+ hbool_t was_dirty;
- if ( pass ) {
+ if (pass) {
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->header.is_protected ||
- entry_ptr->header.is_pinned );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
+ HDassert(entry_ptr->header.is_protected || entry_ptr->header.is_pinned);
- was_dirty = entry_ptr->is_dirty;
- entry_ptr->is_dirty = TRUE;
+ was_dirty = entry_ptr->is_dirty;
+ entry_ptr->is_dirty = TRUE;
- if(entry_ptr->flush_dep_npar > 0 && !was_dirty)
+ if (entry_ptr->flush_dep_npar > 0 && !was_dirty)
mark_flush_dep_dirty(entry_ptr);
result = H5C_mark_entry_dirty((void *)entry_ptr);
- if ( ( result < 0 ) ||
- ( !entry_ptr->header.is_protected && !entry_ptr->header.is_pinned ) ||
- ( entry_ptr->header.is_protected && !entry_ptr->header.dirtied ) ||
- ( !entry_ptr->header.is_protected && !entry_ptr->header.is_dirty ) ||
- ( entry_ptr->header.type != types[type] ) ||
- ( entry_ptr->size != entry_ptr->header.size ) ||
- ( entry_ptr->addr != entry_ptr->header.addr ) ) {
+ if ((result < 0) || (!entry_ptr->header.is_protected && !entry_ptr->header.is_pinned) ||
+ (entry_ptr->header.is_protected && !entry_ptr->header.dirtied) ||
+ (!entry_ptr->header.is_protected && !entry_ptr->header.is_dirty) ||
+ (entry_ptr->header.type != types[type]) || (entry_ptr->size != entry_ptr->header.size) ||
+ (entry_ptr->addr != entry_ptr->header.addr)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error in H5C_mark_entry_dirty().";
-
}
- HDassert( ((entry_ptr->header).type)->id == type );
-
+ HDassert(((entry_ptr->header).type)->id == type);
}
return;
} /* mark_entry_dirty() */
-
/*-------------------------------------------------------------------------
* Function: move_entry()
*
@@ -3458,96 +3066,90 @@ mark_entry_dirty(int32_t type,
*/
void
-move_entry(H5C_t * cache_ptr,
- int32_t type,
- int32_t idx,
- hbool_t main_addr)
+move_entry(H5C_t *cache_ptr, int32_t type, int32_t idx, hbool_t main_addr)
{
- herr_t result;
- hbool_t done = TRUE; /* will set to FALSE if we have work to do */
- haddr_t old_addr = HADDR_UNDEF;
- haddr_t new_addr = HADDR_UNDEF;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ herr_t result;
+ hbool_t done = TRUE; /* will set to FALSE if we have work to do */
+ haddr_t old_addr = HADDR_UNDEF;
+ haddr_t new_addr = HADDR_UNDEF;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
- if ( pass ) {
+ if (pass) {
- HDassert( cache_ptr );
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ HDassert(cache_ptr);
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
- HDassert( !entry_ptr->is_read_only );
- HDassert( !entry_ptr->header.is_read_only );
-
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
+ HDassert(entry_ptr->cache_ptr == cache_ptr);
+ HDassert(!entry_ptr->is_read_only);
+ HDassert(!entry_ptr->header.is_read_only);
- if ( entry_ptr->at_main_addr && !main_addr ) {
+ if (entry_ptr->at_main_addr && !main_addr) {
/* move to alt addr */
- HDassert( entry_ptr->addr == entry_ptr->main_addr );
+ HDassert(entry_ptr->addr == entry_ptr->main_addr);
- done = FALSE;
+ done = FALSE;
old_addr = entry_ptr->addr;
new_addr = entry_ptr->alt_addr;
-
- } else if ( !(entry_ptr->at_main_addr) && main_addr ) {
+ }
+ else if (!(entry_ptr->at_main_addr) && main_addr) {
/* move to main addr */
- HDassert( entry_ptr->addr == entry_ptr->alt_addr );
+ HDassert(entry_ptr->addr == entry_ptr->alt_addr);
- done = FALSE;
+ done = FALSE;
old_addr = entry_ptr->addr;
new_addr = entry_ptr->main_addr;
}
- if ( ! done ) {
+ if (!done) {
hbool_t was_dirty = entry_ptr->is_dirty;
entry_ptr->is_dirty = TRUE;
- if(entry_ptr->flush_dep_npar > 0 && !was_dirty)
+ if (entry_ptr->flush_dep_npar > 0 && !was_dirty)
mark_flush_dep_dirty(entry_ptr);
entry_ptr->action = TEST_ENTRY_ACTION_MOVE;
- result = H5C_move_entry(cache_ptr, types[type], old_addr, new_addr);
+ result = H5C_move_entry(cache_ptr, types[type], old_addr, new_addr);
entry_ptr->action = TEST_ENTRY_ACTION_NUL;
}
- if ( ! done ) {
+ if (!done) {
- if ( ( result < 0 ) ||
- ( ( ! ( entry_ptr->header.destroy_in_progress ) ) &&
- ( entry_ptr->header.addr != new_addr ) ) ) {
+ if ((result < 0) ||
+ ((!(entry_ptr->header.destroy_in_progress)) && (entry_ptr->header.addr != new_addr))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error in H5C_move_entry().";
+ }
+ else {
- } else {
-
- entry_ptr->addr = new_addr;
+ entry_ptr->addr = new_addr;
entry_ptr->at_main_addr = main_addr;
}
}
- HDassert( ((entry_ptr->header).type)->id == type );
+ HDassert(((entry_ptr->header).type)->id == type);
- HDassert( entry_ptr->header.is_dirty );
- HDassert( entry_ptr->is_dirty );
+ HDassert(entry_ptr->header.is_dirty);
+ HDassert(entry_ptr->is_dirty);
}
return;
} /* move_entry() */
-
/*-------------------------------------------------------------------------
* Function: protect_entry()
*
@@ -3563,15 +3165,15 @@ move_entry(H5C_t * cache_ptr,
*-------------------------------------------------------------------------
*/
void
-protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx)
+protect_entry(H5F_t *file_ptr, int32_t type, int32_t idx)
{
- H5C_t * cache_ptr;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
- haddr_t baddrs;
- H5C_cache_entry_t * cache_entry_ptr;
+ H5C_t * cache_ptr;
+ test_entry_t * base_addr;
+ test_entry_t * entry_ptr;
+ haddr_t baddrs;
+ H5C_cache_entry_t *cache_entry_ptr;
- if(pass) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
HDassert(cache_ptr);
@@ -3580,7 +3182,7 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx)
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- baddrs = base_addrs[type];
+ baddrs = base_addrs[type];
HDassert(entry_ptr->index == idx);
HDassert(entry_ptr->type == type);
@@ -3591,15 +3193,12 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx)
/* Use to cork entries for the object */
H5AC_tag(baddrs, NULL);
- cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr,
- types[type], entry_ptr->addr, &entry_ptr->addr,
- H5C__NO_FLAGS_SET);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[type], entry_ptr->addr,
+ &entry_ptr->addr, H5C__NO_FLAGS_SET);
- if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
- ( !(entry_ptr->header.is_protected) ) ||
- ( entry_ptr->header.type != types[type] ) ||
- ( entry_ptr->size != entry_ptr->header.size ) ||
- ( entry_ptr->addr != entry_ptr->header.addr ) ) {
+ if ((cache_entry_ptr != (void *)entry_ptr) || (!(entry_ptr->header.is_protected)) ||
+ (entry_ptr->header.type != types[type]) || (entry_ptr->size != entry_ptr->header.size) ||
+ (entry_ptr->addr != entry_ptr->header.addr)) {
#if 0
/* I've written the following debugging code several times
@@ -3627,30 +3226,28 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx)
entry_ptr->verify_ct, entry_ptr->max_verify_ct);
H5Eprint2(H5E_DEFAULT, stdout);
#endif
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error in H5C_protect().";
} /* end if */
else {
- HDassert( ( entry_ptr->cache_ptr == NULL ) ||
- ( entry_ptr->cache_ptr == cache_ptr ) );
+ HDassert((entry_ptr->cache_ptr == NULL) || (entry_ptr->cache_ptr == cache_ptr));
- entry_ptr->cache_ptr = cache_ptr;
- entry_ptr->file_ptr = file_ptr;
+ entry_ptr->cache_ptr = cache_ptr;
+ entry_ptr->file_ptr = file_ptr;
entry_ptr->is_protected = TRUE;
} /* end else */
- if(entry_ptr->header.tag_info && entry_ptr->header.tag_info->corked)
- entry_ptr->is_corked = TRUE;
+ if (entry_ptr->header.tag_info && entry_ptr->header.tag_info->corked)
+ entry_ptr->is_corked = TRUE;
HDassert(((entry_ptr->header).type)->id == type);
} /* end if */
} /* protect_entry() */
-
/*-------------------------------------------------------------------------
* Function: protect_entry_ro()
*
@@ -3668,67 +3265,59 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx)
*/
void
-protect_entry_ro(H5F_t * file_ptr,
- int32_t type,
- int32_t idx)
+protect_entry_ro(H5F_t *file_ptr, int32_t type, int32_t idx)
{
- H5C_t *cache_ptr;
- test_entry_t *base_addr;
- test_entry_t *entry_ptr;
- H5C_cache_entry_t * cache_entry_ptr;
+ H5C_t * cache_ptr;
+ test_entry_t * base_addr;
+ test_entry_t * entry_ptr;
+ H5C_cache_entry_t *cache_entry_ptr;
- if ( pass ) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr );
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ HDassert(cache_ptr);
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( ( ! ( entry_ptr->is_protected ) ) ||
- ( ( entry_ptr->is_read_only ) &&
- ( entry_ptr->ro_ref_count > 0 ) ) );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
+ HDassert((!(entry_ptr->is_protected)) ||
+ ((entry_ptr->is_read_only) && (entry_ptr->ro_ref_count > 0)));
- cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr,
- types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[type], entry_ptr->addr,
+ &entry_ptr->addr, H5C__READ_ONLY_FLAG);
- if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
- ( !(entry_ptr->header.is_protected) ) ||
- ( !(entry_ptr->header.is_read_only) ) ||
- ( entry_ptr->header.ro_ref_count <= 0 ) ||
- ( entry_ptr->header.type != types[type] ) ||
- ( entry_ptr->size != entry_ptr->header.size ) ||
- ( entry_ptr->addr != entry_ptr->header.addr ) ) {
+ if ((cache_entry_ptr != (void *)entry_ptr) || (!(entry_ptr->header.is_protected)) ||
+ (!(entry_ptr->header.is_read_only)) || (entry_ptr->header.ro_ref_count <= 0) ||
+ (entry_ptr->header.type != types[type]) || (entry_ptr->size != entry_ptr->header.size) ||
+ (entry_ptr->addr != entry_ptr->header.addr)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error in read only H5C_protect().";
+ }
+ else {
- } else {
-
- HDassert( ( entry_ptr->cache_ptr == NULL ) ||
- ( entry_ptr->cache_ptr == cache_ptr ) );
+ HDassert((entry_ptr->cache_ptr == NULL) || (entry_ptr->cache_ptr == cache_ptr));
- entry_ptr->cache_ptr = cache_ptr;
- entry_ptr->file_ptr = file_ptr;
+ entry_ptr->cache_ptr = cache_ptr;
+ entry_ptr->file_ptr = file_ptr;
entry_ptr->is_protected = TRUE;
- entry_ptr->is_read_only = TRUE;
- entry_ptr->ro_ref_count++;
+ entry_ptr->is_read_only = TRUE;
+ entry_ptr->ro_ref_count++;
}
- HDassert( ((entry_ptr->header).type)->id == type );
+ HDassert(((entry_ptr->header).type)->id == type);
}
return;
} /* protect_entry_ro() */
-
/*-------------------------------------------------------------------------
* Function: pin_entry()
*
@@ -3745,51 +3334,48 @@ protect_entry_ro(H5F_t * file_ptr,
*/
void
-pin_entry(int32_t type,
- int32_t idx)
+pin_entry(int32_t type, int32_t idx)
{
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
- if ( pass ) {
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
- herr_t result;
+ if (pass) {
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
+ herr_t result;
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->is_protected );
- HDassert( !(entry_ptr->pinned_from_client) );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
+ HDassert(entry_ptr->is_protected);
+ HDassert(!(entry_ptr->pinned_from_client));
- result = H5C_pin_protected_entry((void *)entry_ptr);
+ result = H5C_pin_protected_entry((void *)entry_ptr);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5C_pin_protected_entry() reports failure.";
+ }
+ else if (!(entry_ptr->header.is_pinned)) {
- } else if ( ! ( entry_ptr->header.is_pinned ) ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "entry not pinned when it should be.";
-
- } else {
+ }
+ else {
entry_ptr->pinned_from_client = TRUE;
- entry_ptr->is_pinned = TRUE;
-
- }
+ entry_ptr->is_pinned = TRUE;
+ }
} /* end if */
return;
} /* pin_entry() */
-
/*-------------------------------------------------------------------------
* Function: unpin_entry()
*
@@ -3806,55 +3392,49 @@ pin_entry(int32_t type,
*/
void
-unpin_entry(int32_t type,
- int32_t idx)
+unpin_entry(int32_t type, int32_t idx)
{
- herr_t result;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ herr_t result;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
- if ( pass ) {
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ if (pass) {
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->header.is_pinned );
- HDassert( entry_ptr->header.pinned_from_client );
- HDassert( entry_ptr->is_pinned );
- HDassert( entry_ptr->pinned_from_client );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
+ HDassert(entry_ptr->header.is_pinned);
+ HDassert(entry_ptr->header.pinned_from_client);
+ HDassert(entry_ptr->is_pinned);
+ HDassert(entry_ptr->pinned_from_client);
result = H5C_unpin_entry(entry_ptr);
- if ( ( result < 0 ) ||
- ( entry_ptr->header.pinned_from_client ) ||
- ( entry_ptr->header.is_pinned && !entry_ptr->header.pinned_from_cache ) ||
- ( entry_ptr->header.type != types[type] ) ||
- ( entry_ptr->size != entry_ptr->header.size ) ||
- ( entry_ptr->addr != entry_ptr->header.addr ) ) {
+ if ((result < 0) || (entry_ptr->header.pinned_from_client) ||
+ (entry_ptr->header.is_pinned && !entry_ptr->header.pinned_from_cache) ||
+ (entry_ptr->header.type != types[type]) || (entry_ptr->size != entry_ptr->header.size) ||
+ (entry_ptr->addr != entry_ptr->header.addr)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error in H5C_unpin().";
-
}
entry_ptr->pinned_from_client = FALSE;
- entry_ptr->is_pinned = entry_ptr->pinned_from_cache;
-
- HDassert( ((entry_ptr->header).type)->id == type );
+ entry_ptr->is_pinned = entry_ptr->pinned_from_cache;
+ HDassert(((entry_ptr->header).type)->id == type);
}
return;
} /* unpin_entry() */
-
/*-------------------------------------------------------------------------
* Function: unprotect_entry()
*
@@ -3871,112 +3451,101 @@ unpin_entry(int32_t type,
*/
void
-unprotect_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- unsigned int flags)
+unprotect_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags)
{
- herr_t result;
- hbool_t pin_flag_set;
- hbool_t unpin_flag_set;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ herr_t result;
+ hbool_t pin_flag_set;
+ hbool_t unpin_flag_set;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
- if ( pass ) {
- HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
+ if (pass) {
+ HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= idx) && (idx <= max_indices[type]));
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->header.is_protected );
- HDassert( entry_ptr->is_protected );
+ HDassert(entry_ptr->index == idx);
+ HDassert(entry_ptr->type == type);
+ HDassert(entry_ptr == entry_ptr->self);
+ HDassert(entry_ptr->header.is_protected);
+ HDassert(entry_ptr->is_protected);
- pin_flag_set = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0);
- unpin_flag_set = (hbool_t)((flags & H5C__UNPIN_ENTRY_FLAG) != 0);
+ pin_flag_set = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0);
+ unpin_flag_set = (hbool_t)((flags & H5C__UNPIN_ENTRY_FLAG) != 0);
- HDassert ( ! ( pin_flag_set && unpin_flag_set ) );
- HDassert ( ( ! pin_flag_set ) || ( ! (entry_ptr->is_pinned) ) );
- HDassert ( ( ! unpin_flag_set ) || ( entry_ptr->is_pinned ) );
+ HDassert(!(pin_flag_set && unpin_flag_set));
+ HDassert((!pin_flag_set) || (!(entry_ptr->is_pinned)));
+ HDassert((!unpin_flag_set) || (entry_ptr->is_pinned));
- if(flags & H5C__DIRTIED_FLAG) {
+ if (flags & H5C__DIRTIED_FLAG) {
hbool_t was_dirty = entry_ptr->is_dirty;
entry_ptr->is_dirty = TRUE;
- if(entry_ptr->flush_dep_npar > 0 && !was_dirty)
+ if (entry_ptr->flush_dep_npar > 0 && !was_dirty)
mark_flush_dep_dirty(entry_ptr);
} /* end if */
result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, flags);
- if ( ( result < 0 ) ||
- ( ( entry_ptr->header.is_protected ) &&
- ( ( ! ( entry_ptr->is_read_only ) ) ||
- ( entry_ptr->ro_ref_count <= 0 ) ) ) ||
- ( entry_ptr->header.type != types[type] ) ||
- ( entry_ptr->size != entry_ptr->header.size ) ||
- ( entry_ptr->addr != entry_ptr->header.addr ) ) {
+ if ((result < 0) ||
+ ((entry_ptr->header.is_protected) &&
+ ((!(entry_ptr->is_read_only)) || (entry_ptr->ro_ref_count <= 0))) ||
+ (entry_ptr->header.type != types[type]) || (entry_ptr->size != entry_ptr->header.size) ||
+ (entry_ptr->addr != entry_ptr->header.addr)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error in H5C_unprotect().";
-
}
- else
- {
- if ( entry_ptr->ro_ref_count > 1 ) {
-
- entry_ptr->ro_ref_count--;
-
- } else if ( entry_ptr->ro_ref_count == 1 ) {
-
- entry_ptr->is_protected = FALSE;
- entry_ptr->is_read_only = FALSE;
- entry_ptr->ro_ref_count = 0;
-
- } else {
-
- entry_ptr->is_protected = FALSE;
+ else {
+ if (entry_ptr->ro_ref_count > 1) {
- }
+ entry_ptr->ro_ref_count--;
+ }
+ else if (entry_ptr->ro_ref_count == 1) {
- if ( pin_flag_set ) {
+ entry_ptr->is_protected = FALSE;
+ entry_ptr->is_read_only = FALSE;
+ entry_ptr->ro_ref_count = 0;
+ }
+ else {
- HDassert(entry_ptr->header.is_pinned);
- entry_ptr->pinned_from_client = TRUE;
- entry_ptr->is_pinned = TRUE;
+ entry_ptr->is_protected = FALSE;
+ }
- } else if ( unpin_flag_set ) {
+ if (pin_flag_set) {
- HDassert(entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache);
- entry_ptr->pinned_from_client = FALSE;
- entry_ptr->is_pinned = entry_ptr->pinned_from_cache;
+ HDassert(entry_ptr->header.is_pinned);
+ entry_ptr->pinned_from_client = TRUE;
+ entry_ptr->is_pinned = TRUE;
+ }
+ else if (unpin_flag_set) {
+ HDassert(entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache);
+ entry_ptr->pinned_from_client = FALSE;
+ entry_ptr->is_pinned = entry_ptr->pinned_from_cache;
}
}
- HDassert( ((entry_ptr->header).type)->id == type );
+ HDassert(((entry_ptr->header).type)->id == type);
- if ( ( flags & H5C__DIRTIED_FLAG ) != 0
- && ( (flags & H5C__DELETED_FLAG) == 0 ) ) {
+ if ((flags & H5C__DIRTIED_FLAG) != 0 && ((flags & H5C__DELETED_FLAG) == 0)) {
- HDassert( entry_ptr->header.is_dirty );
- HDassert( entry_ptr->is_dirty );
+ HDassert(entry_ptr->header.is_dirty);
+ HDassert(entry_ptr->is_dirty);
}
- HDassert( entry_ptr->header.is_protected == entry_ptr->is_protected );
- HDassert( entry_ptr->header.is_read_only == entry_ptr->is_read_only );
- HDassert( entry_ptr->header.ro_ref_count == entry_ptr->ro_ref_count );
+ HDassert(entry_ptr->header.is_protected == entry_ptr->is_protected);
+ HDassert(entry_ptr->header.is_read_only == entry_ptr->is_read_only);
+ HDassert(entry_ptr->header.ro_ref_count == entry_ptr->ro_ref_count);
}
return;
} /* unprotect_entry() */
-
/*-------------------------------------------------------------------------
* Function: row_major_scan_forward()
*
@@ -3989,7 +3558,7 @@ unprotect_entry(H5F_t * file_ptr,
* Programmer: John Mainzer
* 6/12/04
*
- * Changes: Updated slist size == dirty index size checks to
+ * Changes: Updated slist size == dirty index size checks to
* bypass the test if cache_ptr->slist_enabled is FALSE.
*
* JRM -- 5/8/20
@@ -3997,326 +3566,285 @@ unprotect_entry(H5F_t * file_ptr,
*-------------------------------------------------------------------------
*/
void
-row_major_scan_forward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- hbool_t do_moves,
- hbool_t move_to_main_addr,
- hbool_t do_destroys,
- hbool_t do_mult_ro_protects,
- int dirty_destroys,
- int dirty_unprotects)
+row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t verbose, hbool_t reset_stats,
+ hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts,
+ hbool_t do_moves, hbool_t move_to_main_addr, hbool_t do_destroys,
+ hbool_t do_mult_ro_protects, int dirty_destroys, int dirty_unprotects)
{
H5C_t * cache_ptr = NULL;
- int32_t type = 0;
+ int32_t type = 0;
int32_t idx;
int32_t local_max_index;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s(): entering.\n", FUNC);
- if(pass) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
HDassert(cache_ptr != NULL);
HDassert(lag >= 10);
- if(reset_stats)
+ if (reset_stats)
H5C_stats__reset(cache_ptr);
} /* end if */
- while(pass && type < NUMBER_OF_ENTRY_TYPES) {
+ while (pass && type < NUMBER_OF_ENTRY_TYPES) {
idx = -lag;
local_max_index = MIN(max_index, max_indices[type]);
- while(pass && idx <= (local_max_index + lag)) {
+ while (pass && idx <= (local_max_index + lag)) {
int32_t tmp_idx;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%d:%d: ", type, idx);
tmp_idx = idx + lag;
- if(pass && do_inserts && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
- ((tmp_idx % 2) == 0 ) && !entry_in_cache(cache_ptr, type, tmp_idx)) {
+ if (pass && do_inserts && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
+ ((tmp_idx % 2) == 0) && !entry_in_cache(cache_ptr, type, tmp_idx)) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "1(i, %d, %d) ", type, tmp_idx);
insert_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
tmp_idx--;
- if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
- (tmp_idx % 3) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && (tmp_idx % 3) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "2(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
tmp_idx--;
- if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
- (tmp_idx % 3) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && (tmp_idx % 3) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "3(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
/* (don't decrement tmp_idx) */
- if(pass && do_moves && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
- (tmp_idx % 3) == 0) {
+ if (pass && do_moves && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && (tmp_idx % 3) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "4(r, %d, %d, %d) ", type, tmp_idx, (int)move_to_main_addr);
move_entry(cache_ptr, type, tmp_idx, move_to_main_addr);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
tmp_idx--;
- if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
- (tmp_idx % 5) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && (tmp_idx % 5) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "5(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
tmp_idx -= 2;
- if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
- (tmp_idx % 5) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && (tmp_idx % 5) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "6(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
- if(do_mult_ro_protects) {
+ if (do_mult_ro_protects) {
/* (don't decrement tmp_idx) */
- if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
- (tmp_idx % 9) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 9) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "7(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, tmp_idx);
+ protect_entry_ro(file_ptr, type, tmp_idx);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
- } /* end if */
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
+ } /* end if */
tmp_idx--;
- if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
- (tmp_idx % 11) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 11) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "8(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, tmp_idx);
+ protect_entry_ro(file_ptr, type, tmp_idx);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
- } /* end if */
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
+ } /* end if */
tmp_idx--;
- if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
- (tmp_idx % 13) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 13) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "9(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, tmp_idx);
+ protect_entry_ro(file_ptr, type, tmp_idx);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
- } /* end if */
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
+ } /* end if */
/* (don't decrement tmp_idx) */
- if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
- (tmp_idx % 9) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 9) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "10(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
- } /* end if */
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
+ } /* end if */
tmp_idx--;
- if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
- (tmp_idx % 11) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 11) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "11(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
- } /* end if */
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
+ } /* end if */
tmp_idx--;
- if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
- (tmp_idx % 13) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 13) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "12(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
- } /* end if */
- } /* if ( do_mult_ro_protects ) */
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
+ } /* end if */
+ } /* if ( do_mult_ro_protects ) */
- if(pass && (idx >= 0) && (idx <= local_max_index)) {
- if(verbose)
+ if (pass && (idx >= 0) && (idx <= local_max_index)) {
+ if (verbose)
HDfprintf(stdout, "13(p, %d, %d) ", type, idx);
protect_entry(file_ptr, type, idx);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
tmp_idx = idx - lag + 2;
- if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
- (tmp_idx % 7) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && (tmp_idx % 7) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "14(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
tmp_idx--;
- if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
- (tmp_idx % 7) == 0) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && (tmp_idx % 7) == 0) {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "15(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
- if(do_destroys) {
+ if (do_destroys) {
tmp_idx = idx - lag;
- if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index)) {
- switch(tmp_idx % 4) {
+ if (pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index)) {
+ switch (tmp_idx % 4) {
case 0: /* we just did an insert */
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "16(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
break;
case 1:
- if((entries[type])[tmp_idx].is_dirty) {
- if(verbose)
+ if ((entries[type])[tmp_idx].is_dirty) {
+ if (verbose)
HDfprintf(stdout, "17(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
else {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "18(u, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+ unprotect_entry(file_ptr, type, tmp_idx,
+ (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end else */
break;
case 2: /* we just did an insert */
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "19(u-del, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
break;
case 3:
- if((entries[type])[tmp_idx].is_dirty) {
- if(verbose)
+ if ((entries[type])[tmp_idx].is_dirty) {
+ if (verbose)
HDfprintf(stdout, "20(u-del, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
else {
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "21(u-del, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, tmp_idx, (dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) | H5C__DELETED_FLAG);
+ unprotect_entry(file_ptr, type, tmp_idx,
+ (dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) |
+ H5C__DELETED_FLAG);
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end else */
break;
@@ -4324,23 +3852,23 @@ row_major_scan_forward(H5F_t * file_ptr,
HDassert(0); /* this can't happen... */
break;
} /* end switch */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
else {
tmp_idx = idx - lag;
- if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index)) {
- if(verbose)
+ if (pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index)) {
+ if (verbose)
HDfprintf(stdout, "22(u, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+ unprotect_entry(file_ptr, type, tmp_idx,
+ (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( cache_ptr->slist_size == \
- cache_ptr->dirty_index_size ) );
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_size == cache_ptr->dirty_index_size));
} /* end if */
- } /* end elsef */
+ } /* end elsef */
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "\n");
idx++;
@@ -4349,12 +3877,11 @@ row_major_scan_forward(H5F_t * file_ptr,
type++;
} /* end while */
- if(pass && display_stats)
+ if (pass && display_stats)
H5C_stats(cache_ptr, "test cache", display_detailed_stats);
} /* row_major_scan_forward() */
-
/*-------------------------------------------------------------------------
* Function: hl_row_major_scan_forward()
*
@@ -4371,53 +3898,44 @@ row_major_scan_forward(H5F_t * file_ptr,
*/
void
-hl_row_major_scan_forward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts)
+hl_row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats,
+ hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts)
{
H5C_t * cache_ptr = NULL;
- int32_t type = 0;
+ int32_t type = 0;
int32_t idx;
int32_t i;
int32_t lag = 100;
int32_t local_max_index;
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "%s(): entering.\n", FUNC);
- if ( pass ) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr != NULL );
- HDassert( lag > 5 );
- HDassert( max_index >= 200 );
- HDassert( max_index <= MAX_ENTRIES );
+ HDassert(cache_ptr != NULL);
+ HDassert(lag > 5);
+ HDassert(max_index >= 200);
+ HDassert(max_index <= MAX_ENTRIES);
- if ( reset_stats ) {
+ if (reset_stats) {
H5C_stats__reset(cache_ptr);
}
}
- while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) )
- {
+ while ((pass) && (type < NUMBER_OF_ENTRY_TYPES)) {
idx = -lag;
local_max_index = MIN(max_index, max_indices[type]);
- while ( ( pass ) && ( idx <= (local_max_index + lag) ) )
- {
- if ( ( pass ) && ( do_inserts ) && ( (idx + lag) >= 0 ) &&
- ( (idx + lag) <= max_indices[type] ) &&
- ( ((idx + lag) % 2) == 0 ) &&
- ( ! entry_in_cache(cache_ptr, type, (idx + lag)) ) ) {
+ while ((pass) && (idx <= (local_max_index + lag))) {
+ if ((pass) && (do_inserts) && ((idx + lag) >= 0) && ((idx + lag) <= max_indices[type]) &&
+ (((idx + lag) % 2) == 0) && (!entry_in_cache(cache_ptr, type, (idx + lag)))) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag));
insert_entry(file_ptr, type, (idx + lag), H5C__NO_FLAGS_SET);
@@ -4425,16 +3943,15 @@ hl_row_major_scan_forward(H5F_t * file_ptr,
i = idx;
- while ( ( pass ) && ( i >= idx - lag ) && ( i >= 0 ) )
- {
- if ( ( pass ) && ( i >= 0 ) && ( i <= local_max_index ) ) {
+ while ((pass) && (i >= idx - lag) && (i >= 0)) {
+ if ((pass) && (i >= 0) && (i <= local_max_index)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, i);
protect_entry(file_ptr, type, i);
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, i);
unprotect_entry(file_ptr, type, i, H5C__NO_FLAGS_SET);
@@ -4442,7 +3959,7 @@ hl_row_major_scan_forward(H5F_t * file_ptr,
i--;
}
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "\n");
idx++;
@@ -4450,7 +3967,7 @@ hl_row_major_scan_forward(H5F_t * file_ptr,
type++;
}
- if ( ( pass ) && ( display_stats ) ) {
+ if ((pass) && (display_stats)) {
H5C_stats(cache_ptr, "test cache", display_detailed_stats);
}
@@ -4459,7 +3976,6 @@ hl_row_major_scan_forward(H5F_t * file_ptr,
} /* hl_row_major_scan_forward() */
-
/*-------------------------------------------------------------------------
* Function: row_major_scan_backward()
*
@@ -4476,235 +3992,193 @@ hl_row_major_scan_forward(H5F_t * file_ptr,
*/
void
-row_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- hbool_t do_moves,
- hbool_t move_to_main_addr,
- hbool_t do_destroys,
- hbool_t do_mult_ro_protects,
- int dirty_destroys,
- int dirty_unprotects)
+row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t verbose, hbool_t reset_stats,
+ hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts,
+ hbool_t do_moves, hbool_t move_to_main_addr, hbool_t do_destroys,
+ hbool_t do_mult_ro_protects, int dirty_destroys, int dirty_unprotects)
{
H5C_t * cache_ptr = NULL;
- int32_t type = NUMBER_OF_ENTRY_TYPES - 1;
+ int32_t type = NUMBER_OF_ENTRY_TYPES - 1;
int32_t idx;
int32_t local_max_index;
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "%s(): Entering.\n", FUNC);
- if ( pass ) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr != NULL );
- HDassert( lag >= 10 );
+ HDassert(cache_ptr != NULL);
+ HDassert(lag >= 10);
- if ( reset_stats ) {
+ if (reset_stats) {
H5C_stats__reset(cache_ptr);
}
}
- while ( ( pass ) && ( type >= 0 ) )
- {
+ while ((pass) && (type >= 0)) {
local_max_index = MIN(max_index, max_indices[type]);
idx = local_max_index + lag;
- while ( ( pass ) && ( idx >= -lag ) )
- {
+ while ((pass) && (idx >= -lag)) {
int32_t tmp_idx;
tmp_idx = idx - lag;
- if ( ( pass ) && ( do_inserts ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx <= local_max_index ) &&
- ( (tmp_idx % 2) == 1 ) &&
- ( ! entry_in_cache(cache_ptr, type, tmp_idx) ) ) {
+ if ((pass) && (do_inserts) && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
+ ((tmp_idx % 2) == 1) && (!entry_in_cache(cache_ptr, type, tmp_idx))) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(i, %d, %d) ", type, tmp_idx);
insert_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
tmp_idx++;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx <= local_max_index ) &&
- ( ( tmp_idx % 3 ) == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && ((tmp_idx % 3) == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
}
tmp_idx++;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx <= local_max_index ) &&
- ( ( tmp_idx % 3 ) == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && ((tmp_idx % 3) == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
/* (don't increment tmp_idx) */
- if ( ( pass ) && ( do_moves ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx <= local_max_index ) &&
- ( ( tmp_idx % 3 ) == 0 ) ) {
+ if ((pass) && (do_moves) && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
+ ((tmp_idx % 3) == 0)) {
- if ( verbose )
- HDfprintf(stdout, "(r, %d, %d, %d) ",
- type, tmp_idx, (int)move_to_main_addr);
+ if (verbose)
+ HDfprintf(stdout, "(r, %d, %d, %d) ", type, tmp_idx, (int)move_to_main_addr);
move_entry(cache_ptr, type, tmp_idx, move_to_main_addr);
}
tmp_idx++;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx <= local_max_index ) &&
- ( ( tmp_idx % 5 ) == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && ((tmp_idx % 5) == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, (idx - lag + 3));
}
tmp_idx += 2;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx <= local_max_index ) &&
- ( ( tmp_idx % 5 ) == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && ((tmp_idx % 5) == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
/* (don't increment tmp_idx) */
- if ( do_mult_ro_protects )
- {
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx < local_max_index ) &&
- ( tmp_idx % 9 == 0 ) ) {
+ if (do_mult_ro_protects) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 9 == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, tmp_idx);
- }
+ protect_entry_ro(file_ptr, type, tmp_idx);
+ }
tmp_idx++;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx < local_max_index ) &&
- ( tmp_idx % 11 == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 11 == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, tmp_idx);
- }
+ protect_entry_ro(file_ptr, type, tmp_idx);
+ }
tmp_idx++;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx < local_max_index ) &&
- ( tmp_idx % 13 == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 13 == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, tmp_idx);
- }
+ protect_entry_ro(file_ptr, type, tmp_idx);
+ }
/* (don't increment tmp_idx) */
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx < local_max_index ) &&
- ( tmp_idx % 9 == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 9 == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- }
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+ }
tmp_idx++;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx < local_max_index ) &&
- ( tmp_idx % 11 == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 11 == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- }
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+ }
tmp_idx++;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx < local_max_index ) &&
- ( tmp_idx % 13 == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 13 == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- }
- } /* if ( do_mult_ro_protects ) */
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+ }
+ } /* if ( do_mult_ro_protects ) */
- if ( ( pass ) && ( idx >= 0 ) && ( idx <= local_max_index ) ) {
+ if ((pass) && (idx >= 0) && (idx <= local_max_index)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
protect_entry(file_ptr, type, idx);
}
tmp_idx = idx + lag - 2;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx <= local_max_index ) &&
- ( ( tmp_idx % 7 ) == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && ((tmp_idx % 7) == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
tmp_idx++;
- if ( ( pass ) && ( tmp_idx >= 0 ) &&
- ( tmp_idx <= local_max_index ) &&
- ( ( tmp_idx % 7 ) == 0 ) ) {
+ if ((pass) && (tmp_idx >= 0) && (tmp_idx <= local_max_index) && ((tmp_idx % 7) == 0)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
}
+ if (do_destroys) {
- if ( do_destroys ) {
-
- if ( ( pass ) && ( (idx + lag) >= 0 ) &&
- ( ( idx + lag) <= local_max_index ) ) {
+ if ((pass) && ((idx + lag) >= 0) && ((idx + lag) <= local_max_index)) {
- switch ( (idx + lag) % 4 ) {
+ switch ((idx + lag) % 4) {
case 0:
- if ( (entries[type])[idx+lag].is_dirty ) {
+ if ((entries[type])[idx + lag].is_dirty) {
unprotect_entry(file_ptr, type, idx + lag, H5C__NO_FLAGS_SET);
- } else {
+ }
+ else {
unprotect_entry(file_ptr, type, idx + lag,
- (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+ (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
}
break;
@@ -4713,14 +4187,15 @@ row_major_scan_backward(H5F_t * file_ptr,
break;
case 2:
- if ( (entries[type])[idx + lag].is_dirty ) {
+ if ((entries[type])[idx + lag].is_dirty) {
unprotect_entry(file_ptr, type, idx + lag, H5C__DELETED_FLAG);
- } else {
+ }
+ else {
unprotect_entry(file_ptr, type, idx + lag,
- (dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)
- | H5C__DELETED_FLAG);
+ (dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) |
+ H5C__DELETED_FLAG);
}
break;
@@ -4733,20 +4208,20 @@ row_major_scan_backward(H5F_t * file_ptr,
break;
}
}
- } else {
+ }
+ else {
- if ( ( pass ) && ( (idx + lag) >= 0 ) &&
- ( ( idx + lag) <= local_max_index ) ) {
+ if ((pass) && ((idx + lag) >= 0) && ((idx + lag) <= local_max_index)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag));
unprotect_entry(file_ptr, type, idx + lag,
- (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+ (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
}
}
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "\n");
idx--;
@@ -4754,7 +4229,7 @@ row_major_scan_backward(H5F_t * file_ptr,
type--;
}
- if ( ( pass ) && ( display_stats ) ) {
+ if ((pass) && (display_stats)) {
H5C_stats(cache_ptr, "test cache", display_detailed_stats);
}
@@ -4763,7 +4238,6 @@ row_major_scan_backward(H5F_t * file_ptr,
} /* row_major_scan_backward() */
-
/*-------------------------------------------------------------------------
* Function: hl_row_major_scan_backward()
*
@@ -4780,53 +4254,44 @@ row_major_scan_backward(H5F_t * file_ptr,
*/
void
-hl_row_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts)
+hl_row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats,
+ hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts)
{
H5C_t * cache_ptr = NULL;
- int32_t type = NUMBER_OF_ENTRY_TYPES - 1;
+ int32_t type = NUMBER_OF_ENTRY_TYPES - 1;
int32_t idx;
int32_t i;
int32_t lag = 100;
int32_t local_max_index;
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "%s(): entering.\n", FUNC);
- if ( pass ) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr != NULL );
- HDassert( lag > 5 );
- HDassert( max_index >= 200 );
- HDassert( max_index <= MAX_ENTRIES );
+ HDassert(cache_ptr != NULL);
+ HDassert(lag > 5);
+ HDassert(max_index >= 200);
+ HDassert(max_index <= MAX_ENTRIES);
- if ( reset_stats ) {
+ if (reset_stats) {
H5C_stats__reset(cache_ptr);
}
}
- while ( ( pass ) && ( type >= 0 ) )
- {
+ while ((pass) && (type >= 0)) {
idx = max_indices[type] + lag;
local_max_index = MIN(max_index, max_indices[type]);
- while ( ( pass ) && ( idx >= -lag ) )
- {
- if ( ( pass ) && ( do_inserts ) && ( (idx + lag) >= 0 ) &&
- ( (idx + lag) <= local_max_index ) &&
- ( ((idx + lag) % 2) == 0 ) &&
- ( ! entry_in_cache(cache_ptr, type, (idx + lag)) ) ) {
+ while ((pass) && (idx >= -lag)) {
+ if ((pass) && (do_inserts) && ((idx + lag) >= 0) && ((idx + lag) <= local_max_index) &&
+ (((idx + lag) % 2) == 0) && (!entry_in_cache(cache_ptr, type, (idx + lag)))) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag));
insert_entry(file_ptr, type, (idx + lag), H5C__NO_FLAGS_SET);
@@ -4834,16 +4299,15 @@ hl_row_major_scan_backward(H5F_t * file_ptr,
i = idx;
- while ( ( pass ) && ( i >= idx - lag ) && ( i >= 0 ) )
- {
- if ( ( pass ) && ( i >= 0 ) && ( i <= local_max_index ) ) {
+ while ((pass) && (i >= idx - lag) && (i >= 0)) {
+ if ((pass) && (i >= 0) && (i <= local_max_index)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, i);
protect_entry(file_ptr, type, i);
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, i);
unprotect_entry(file_ptr, type, i, H5C__NO_FLAGS_SET);
@@ -4851,7 +4315,7 @@ hl_row_major_scan_backward(H5F_t * file_ptr,
i--;
}
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "\n");
idx--;
@@ -4859,7 +4323,7 @@ hl_row_major_scan_backward(H5F_t * file_ptr,
type--;
}
- if ( ( pass ) && ( display_stats ) ) {
+ if ((pass) && (display_stats)) {
H5C_stats(cache_ptr, "test cache", display_detailed_stats);
}
@@ -4868,7 +4332,6 @@ hl_row_major_scan_backward(H5F_t * file_ptr,
} /* hl_row_major_scan_backward() */
-
/*-------------------------------------------------------------------------
* Function: col_major_scan_forward()
*
@@ -4885,35 +4348,29 @@ hl_row_major_scan_backward(H5F_t * file_ptr,
*/
void
-col_major_scan_forward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
+col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t verbose, hbool_t reset_stats,
+ hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts,
int dirty_unprotects)
{
H5C_t * cache_ptr = NULL;
- int32_t type = 0;
+ int32_t type = 0;
int32_t idx;
int32_t local_max_index[NUMBER_OF_ENTRY_TYPES];
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "%s: entering.\n", FUNC);
- if ( pass ) {
+ if (pass) {
int i;
cache_ptr = file_ptr->shared->cache;
- for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
+ for (i = 0; i < NUMBER_OF_ENTRY_TYPES; i++)
local_max_index[i] = MIN(max_index, max_indices[i]);
- HDassert( lag > 5 );
+ HDassert(lag > 5);
- if ( reset_stats ) {
+ if (reset_stats) {
H5C_stats__reset(cache_ptr);
}
@@ -4921,44 +4378,37 @@ col_major_scan_forward(H5F_t * file_ptr,
idx = -lag;
- while ( ( pass ) && ( (idx - lag) <= MAX_ENTRIES ) )
- {
+ while ((pass) && ((idx - lag) <= MAX_ENTRIES)) {
type = 0;
- while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) )
- {
- if ( ( pass ) && ( do_inserts ) && ( (idx + lag) >= 0 ) &&
- ( (idx + lag) <= local_max_index[type] ) &&
- ( ((idx + lag) % 3) == 0 ) &&
- ( ! entry_in_cache(cache_ptr, type, (idx + lag)) ) ) {
+ while ((pass) && (type < NUMBER_OF_ENTRY_TYPES)) {
+ if ((pass) && (do_inserts) && ((idx + lag) >= 0) && ((idx + lag) <= local_max_index[type]) &&
+ (((idx + lag) % 3) == 0) && (!entry_in_cache(cache_ptr, type, (idx + lag)))) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag));
insert_entry(file_ptr, type, (idx + lag), H5C__NO_FLAGS_SET);
}
- if ( ( pass ) &&
- ( idx >= 0 ) &&
- ( idx <= local_max_index[type] ) ) {
+ if ((pass) && (idx >= 0) && (idx <= local_max_index[type])) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
protect_entry(file_ptr, type, idx);
}
- if ( ( pass ) && ( (idx - lag) >= 0 ) &&
- ( (idx - lag) <= local_max_index[type] ) ) {
+ if ((pass) && ((idx - lag) >= 0) && ((idx - lag) <= local_max_index[type])) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag));
unprotect_entry(file_ptr, type, idx - lag,
- (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+ (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
}
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "\n");
type++;
@@ -4967,7 +4417,7 @@ col_major_scan_forward(H5F_t * file_ptr,
idx++;
}
- if ( ( pass ) && ( display_stats ) ) {
+ if ((pass) && (display_stats)) {
H5C_stats(cache_ptr, "test cache", display_detailed_stats);
}
@@ -4976,7 +4426,6 @@ col_major_scan_forward(H5F_t * file_ptr,
} /* col_major_scan_forward() */
-
/*-------------------------------------------------------------------------
* Function: hl_col_major_scan_forward()
*
@@ -4993,35 +4442,30 @@ col_major_scan_forward(H5F_t * file_ptr,
*/
void
-hl_col_major_scan_forward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
+hl_col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats,
+ hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts,
int dirty_unprotects)
{
H5C_t * cache_ptr = NULL;
- int32_t type = 0;
+ int32_t type = 0;
int32_t idx;
int32_t lag = 200;
int32_t i;
int32_t local_max_index;
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "%s: entering.\n", FUNC);
- if ( pass ) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr != NULL );
- HDassert( lag > 5 );
- HDassert( max_index >= 500 );
- HDassert( max_index <= MAX_ENTRIES );
+ HDassert(cache_ptr != NULL);
+ HDassert(lag > 5);
+ HDassert(max_index >= 500);
+ HDassert(max_index <= MAX_ENTRIES);
- if ( reset_stats ) {
+ if (reset_stats) {
H5C_stats__reset(cache_ptr);
}
@@ -5031,47 +4475,42 @@ hl_col_major_scan_forward(H5F_t * file_ptr,
local_max_index = MIN(max_index, MAX_ENTRIES);
- while ( ( pass ) && ( idx <= local_max_index ) )
- {
+ while ((pass) && (idx <= local_max_index)) {
i = idx;
- while ( ( pass ) && ( i >= 0 ) && ( i >= (idx - lag) ) ) {
+ while ((pass) && (i >= 0) && (i >= (idx - lag))) {
type = 0;
- while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) )
- {
- if ( ( pass ) && ( do_inserts ) && ( i == idx ) &&
- ( i <= local_max_index ) &&
- ( (i % 3) == 0 ) &&
- ( ! entry_in_cache(cache_ptr, type, i) ) ) {
+ while ((pass) && (type < NUMBER_OF_ENTRY_TYPES)) {
+ if ((pass) && (do_inserts) && (i == idx) && (i <= local_max_index) && ((i % 3) == 0) &&
+ (!entry_in_cache(cache_ptr, type, i))) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(i, %d, %d) ", type, i);
insert_entry(file_ptr, type, i, H5C__NO_FLAGS_SET);
}
- if ( ( pass ) && ( i >= 0 ) && ( i <= local_max_index ) ) {
+ if ((pass) && (i >= 0) && (i <= local_max_index)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, i);
protect_entry(file_ptr, type, i);
}
- if ( ( pass ) && ( i >= 0 ) &&
- ( i <= local_max_index ) ) {
+ if ((pass) && (i >= 0) && (i <= local_max_index)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, i);
unprotect_entry(file_ptr, type, i,
- (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+ (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
}
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "\n");
type++;
@@ -5083,7 +4522,7 @@ hl_col_major_scan_forward(H5F_t * file_ptr,
idx++;
}
- if ( ( pass ) && ( display_stats ) ) {
+ if ((pass) && (display_stats)) {
H5C_stats(cache_ptr, "test cache", display_detailed_stats);
}
@@ -5092,7 +4531,6 @@ hl_col_major_scan_forward(H5F_t * file_ptr,
} /* hl_col_major_scan_forward() */
-
/*-------------------------------------------------------------------------
* Function: col_major_scan_backward()
*
@@ -5109,38 +4547,32 @@ hl_col_major_scan_forward(H5F_t * file_ptr,
*/
void
-col_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
+col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t verbose, hbool_t reset_stats,
+ hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts,
int dirty_unprotects)
{
- H5C_t * cache_ptr = NULL;
- int mile_stone = 1;
+ H5C_t * cache_ptr = NULL;
+ int mile_stone = 1;
int32_t type;
int32_t idx;
int32_t local_max_index[NUMBER_OF_ENTRY_TYPES];
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "%s: entering.\n", FUNC);
- if ( pass ) {
+ if (pass) {
int i;
cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr != NULL );
+ HDassert(cache_ptr != NULL);
- for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
+ for (i = 0; i < NUMBER_OF_ENTRY_TYPES; i++)
local_max_index[i] = MIN(max_index, max_indices[i]);
- HDassert( lag > 5 );
+ HDassert(lag > 5);
- if ( reset_stats ) {
+ if (reset_stats) {
H5C_stats__reset(cache_ptr);
}
@@ -5148,48 +4580,40 @@ col_major_scan_backward(H5F_t * file_ptr,
idx = local_max_index[NUMBER_OF_ENTRY_TYPES - 1] + lag;
- if ( verbose ) /* 1 */
+ if (verbose) /* 1 */
HDfprintf(stdout, "%s: point %d.\n", FUNC, mile_stone++);
-
- while ( ( pass ) && ( (idx + lag) >= 0 ) )
- {
+ while ((pass) && ((idx + lag) >= 0)) {
type = NUMBER_OF_ENTRY_TYPES - 1;
- while ( ( pass ) && ( type >= 0 ) )
- {
- if ( ( pass ) && ( do_inserts) && ( (idx - lag) >= 0 ) &&
- ( (idx - lag) <= local_max_index[type] ) &&
- ( ((idx - lag) % 3) == 0 ) &&
- ( ! entry_in_cache(cache_ptr, type, (idx - lag)) ) ) {
+ while ((pass) && (type >= 0)) {
+ if ((pass) && (do_inserts) && ((idx - lag) >= 0) && ((idx - lag) <= local_max_index[type]) &&
+ (((idx - lag) % 3) == 0) && (!entry_in_cache(cache_ptr, type, (idx - lag)))) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(i, %d, %d) ", type, (idx - lag));
insert_entry(file_ptr, type, (idx - lag), H5C__NO_FLAGS_SET);
}
- if ( ( pass ) &&
- ( idx >= 0 ) &&
- ( idx <= local_max_index[type] ) ) {
+ if ((pass) && (idx >= 0) && (idx <= local_max_index[type])) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
protect_entry(file_ptr, type, idx);
}
- if ( ( pass ) && ( (idx + lag) >= 0 ) &&
- ( (idx + lag) <= local_max_index[type] ) ) {
+ if ((pass) && ((idx + lag) >= 0) && ((idx + lag) <= local_max_index[type])) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag));
unprotect_entry(file_ptr, type, idx + lag,
- (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+ (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
}
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "\n");
type--;
@@ -5198,22 +4622,21 @@ col_major_scan_backward(H5F_t * file_ptr,
idx--;
}
- if ( verbose ) /* 2 */
+ if (verbose) /* 2 */
HDfprintf(stdout, "%s: point %d.\n", FUNC, mile_stone++);
- if ( ( pass ) && ( display_stats ) ) {
+ if ((pass) && (display_stats)) {
H5C_stats(cache_ptr, "test cache", display_detailed_stats);
}
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "%s: exiting.\n", FUNC);
return;
} /* col_major_scan_backward() */
-
/*-------------------------------------------------------------------------
* Function: hl_col_major_scan_backward()
*
@@ -5230,37 +4653,32 @@ col_major_scan_backward(H5F_t * file_ptr,
*/
void
-hl_col_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
+hl_col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats,
+ hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts,
int dirty_unprotects)
{
H5C_t * cache_ptr = NULL;
- int32_t type = 0;
- int32_t idx = -1;
- int32_t lag = 50;
+ int32_t type = 0;
+ int32_t idx = -1;
+ int32_t lag = 50;
int32_t i;
int32_t local_max_index = -1;
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "%s: entering.\n", FUNC);
- if ( pass ) {
+ if (pass) {
cache_ptr = file_ptr->shared->cache;
- HDassert( cache_ptr != NULL );
- HDassert( lag > 5 );
- HDassert( max_index >= 500 );
- HDassert( max_index <= MAX_ENTRIES );
+ HDassert(cache_ptr != NULL);
+ HDassert(lag > 5);
+ HDassert(max_index >= 500);
+ HDassert(max_index <= MAX_ENTRIES);
local_max_index = MIN(max_index, MAX_ENTRIES);
- if ( reset_stats ) {
+ if (reset_stats) {
H5C_stats__reset(cache_ptr);
}
@@ -5268,46 +4686,42 @@ hl_col_major_scan_backward(H5F_t * file_ptr,
idx = local_max_index;
}
- while ( ( pass ) && ( idx >= 0 ) )
- {
+ while ((pass) && (idx >= 0)) {
i = idx;
- while ( ( pass ) && ( i <= local_max_index ) && ( i <= (idx + lag) ) ) {
+ while ((pass) && (i <= local_max_index) && (i <= (idx + lag))) {
type = 0;
- while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) )
- {
- if ( ( pass ) && ( do_inserts ) && ( i == idx ) &&
- ( i <= local_max_index ) &&
- ( ! entry_in_cache(cache_ptr, type, i) ) ) {
+ while ((pass) && (type < NUMBER_OF_ENTRY_TYPES)) {
+ if ((pass) && (do_inserts) && (i == idx) && (i <= local_max_index) &&
+ (!entry_in_cache(cache_ptr, type, i))) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(i, %d, %d) ", type, i);
insert_entry(file_ptr, type, i, H5C__NO_FLAGS_SET);
}
- if ( ( pass ) && ( i >= 0 ) && ( i <= local_max_index ) ) {
+ if ((pass) && (i >= 0) && (i <= local_max_index)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(p, %d, %d) ", type, i);
protect_entry(file_ptr, type, i);
}
- if ( ( pass ) && ( i >= 0 ) &&
- ( i <= local_max_index ) ) {
+ if ((pass) && (i >= 0) && (i <= local_max_index)) {
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "(u, %d, %d) ", type, i);
unprotect_entry(file_ptr, type, i,
- (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+ (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
}
- if ( verbose )
+ if (verbose)
HDfprintf(stdout, "\n");
type++;
@@ -5319,7 +4733,7 @@ hl_col_major_scan_backward(H5F_t * file_ptr,
idx--;
}
- if ( ( pass ) && ( display_stats ) ) {
+ if ((pass) && (display_stats)) {
H5C_stats(cache_ptr, "test cache", display_detailed_stats);
}
@@ -5328,7 +4742,6 @@ hl_col_major_scan_backward(H5F_t * file_ptr,
} /* hl_col_major_scan_backward() */
-
/*-------------------------------------------------------------------------
* Function: create_flush_dependency()
*
@@ -5345,23 +4758,20 @@ hl_col_major_scan_backward(H5F_t * file_ptr,
*/
void
-create_flush_dependency(int32_t par_type,
- int32_t par_idx,
- int32_t chd_type,
- int32_t chd_idx)
+create_flush_dependency(int32_t par_type, int32_t par_idx, int32_t chd_type, int32_t chd_idx)
{
- HDassert( ( 0 <= par_type ) && ( par_type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= par_idx ) && ( par_idx <= max_indices[par_type] ) );
- HDassert( ( 0 <= chd_type ) && ( chd_type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= chd_idx ) && ( chd_idx <= max_indices[chd_type] ) );
-
- if ( pass ) {
- test_entry_t * par_base_addr; /* Base entry of parent's entry array */
- test_entry_t * par_entry_ptr; /* Parent entry */
- test_entry_t * chd_base_addr; /* Base entry of child's entry array */
- test_entry_t * chd_entry_ptr; /* Child entry */
- hbool_t par_is_pinned; /* Whether parent is already pinned */
- herr_t result; /* API routine status */
+ HDassert((0 <= par_type) && (par_type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= par_idx) && (par_idx <= max_indices[par_type]));
+ HDassert((0 <= chd_type) && (chd_type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= chd_idx) && (chd_idx <= max_indices[chd_type]));
+
+ if (pass) {
+ test_entry_t *par_base_addr; /* Base entry of parent's entry array */
+ test_entry_t *par_entry_ptr; /* Parent entry */
+ test_entry_t *chd_base_addr; /* Base entry of child's entry array */
+ test_entry_t *chd_entry_ptr; /* Child entry */
+ hbool_t par_is_pinned; /* Whether parent is already pinned */
+ herr_t result; /* API routine status */
/* Get parent entry */
par_base_addr = entries[par_type];
@@ -5369,47 +4779,45 @@ create_flush_dependency(int32_t par_type,
par_is_pinned = par_entry_ptr->header.is_pinned;
/* Sanity check parent entry */
- HDassert( par_entry_ptr->index == par_idx );
- HDassert( par_entry_ptr->type == par_type );
- HDassert( par_entry_ptr->header.is_protected );
- HDassert( par_entry_ptr == par_entry_ptr->self );
+ HDassert(par_entry_ptr->index == par_idx);
+ HDassert(par_entry_ptr->type == par_type);
+ HDassert(par_entry_ptr->header.is_protected);
+ HDassert(par_entry_ptr == par_entry_ptr->self);
/* Get parent entry */
chd_base_addr = entries[chd_type];
chd_entry_ptr = &(chd_base_addr[chd_idx]);
/* Sanity check child entry */
- HDassert( chd_entry_ptr->index == chd_idx );
- HDassert( chd_entry_ptr->type == chd_type );
- HDassert( chd_entry_ptr == chd_entry_ptr->self );
+ HDassert(chd_entry_ptr->index == chd_idx);
+ HDassert(chd_entry_ptr->type == chd_type);
+ HDassert(chd_entry_ptr == chd_entry_ptr->self);
result = H5C_create_flush_dependency(par_entry_ptr, chd_entry_ptr);
- if ( ( result < 0 ) ||
- ( !par_entry_ptr->header.is_pinned ) ||
- ( !(par_entry_ptr->header.flush_dep_nchildren > 0) ) ) {
+ if ((result < 0) || (!par_entry_ptr->header.is_pinned) ||
+ (!(par_entry_ptr->header.flush_dep_nchildren > 0))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error in H5C_create_flush_dependency().";
} /* end if */
/* Update information about entries */
- HDassert( chd_entry_ptr->flush_dep_npar < MAX_FLUSH_DEP_PARS );
+ HDassert(chd_entry_ptr->flush_dep_npar < MAX_FLUSH_DEP_PARS);
chd_entry_ptr->flush_dep_par_type[chd_entry_ptr->flush_dep_npar] = par_type;
- chd_entry_ptr->flush_dep_par_idx[chd_entry_ptr->flush_dep_npar] = par_idx;
+ chd_entry_ptr->flush_dep_par_idx[chd_entry_ptr->flush_dep_npar] = par_idx;
chd_entry_ptr->flush_dep_npar++;
par_entry_ptr->flush_dep_nchd++;
- if(chd_entry_ptr->is_dirty || chd_entry_ptr->flush_dep_ndirty_chd > 0) {
+ if (chd_entry_ptr->is_dirty || chd_entry_ptr->flush_dep_ndirty_chd > 0) {
HDassert(par_entry_ptr->flush_dep_ndirty_chd < par_entry_ptr->flush_dep_nchd);
par_entry_ptr->flush_dep_ndirty_chd++;
} /* end if */
par_entry_ptr->pinned_from_cache = TRUE;
- if( !par_is_pinned )
+ if (!par_is_pinned)
par_entry_ptr->is_pinned = TRUE;
} /* end if */
} /* create_flush_dependency() */
-
/*-------------------------------------------------------------------------
* Function: destroy_flush_dependency()
*
@@ -5426,81 +4834,72 @@ create_flush_dependency(int32_t par_type,
*/
void
-destroy_flush_dependency(int32_t par_type,
- int32_t par_idx,
- int32_t chd_type,
- int32_t chd_idx)
+destroy_flush_dependency(int32_t par_type, int32_t par_idx, int32_t chd_type, int32_t chd_idx)
{
- HDassert( ( 0 <= par_type ) && ( par_type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= par_idx ) && ( par_idx <= max_indices[par_type] ) );
- HDassert( ( 0 <= chd_type ) && ( chd_type < NUMBER_OF_ENTRY_TYPES ) );
- HDassert( ( 0 <= chd_idx ) && ( chd_idx <= max_indices[chd_type] ) );
-
- if ( pass ) {
- test_entry_t * par_base_addr; /* Base entry of parent's entry array */
- test_entry_t * par_entry_ptr; /* Parent entry */
- test_entry_t * chd_base_addr; /* Base entry of child's entry array */
- test_entry_t * chd_entry_ptr; /* Child entry */
- unsigned i; /* Local index variable */
+ HDassert((0 <= par_type) && (par_type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= par_idx) && (par_idx <= max_indices[par_type]));
+ HDassert((0 <= chd_type) && (chd_type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((0 <= chd_idx) && (chd_idx <= max_indices[chd_type]));
+
+ if (pass) {
+ test_entry_t *par_base_addr; /* Base entry of parent's entry array */
+ test_entry_t *par_entry_ptr; /* Parent entry */
+ test_entry_t *chd_base_addr; /* Base entry of child's entry array */
+ test_entry_t *chd_entry_ptr; /* Child entry */
+ unsigned i; /* Local index variable */
/* Get parent entry */
par_base_addr = entries[par_type];
par_entry_ptr = &(par_base_addr[par_idx]);
/* Sanity check parent entry */
- HDassert( par_entry_ptr->is_pinned );
- HDassert( par_entry_ptr->pinned_from_cache );
- HDassert( par_entry_ptr->flush_dep_nchd > 0 );
- HDassert( par_entry_ptr == par_entry_ptr->self );
+ HDassert(par_entry_ptr->is_pinned);
+ HDassert(par_entry_ptr->pinned_from_cache);
+ HDassert(par_entry_ptr->flush_dep_nchd > 0);
+ HDassert(par_entry_ptr == par_entry_ptr->self);
/* Get parent entry */
chd_base_addr = entries[chd_type];
chd_entry_ptr = &(chd_base_addr[chd_idx]);
/* Sanity check child entry */
- HDassert( chd_entry_ptr->index == chd_idx );
- HDassert( chd_entry_ptr->type == chd_type );
- HDassert( chd_entry_ptr->flush_dep_npar > 0 );
- HDassert( chd_entry_ptr == chd_entry_ptr->self );
+ HDassert(chd_entry_ptr->index == chd_idx);
+ HDassert(chd_entry_ptr->type == chd_type);
+ HDassert(chd_entry_ptr->flush_dep_npar > 0);
+ HDassert(chd_entry_ptr == chd_entry_ptr->self);
- if ( H5C_destroy_flush_dependency(par_entry_ptr, chd_entry_ptr) < 0 ) {
- pass = FALSE;
+ if (H5C_destroy_flush_dependency(par_entry_ptr, chd_entry_ptr) < 0) {
+ pass = FALSE;
failure_mssg = "error in H5C_destroy_flush_dependency().";
} /* end if */
/* Update information about entries */
- for(i=0; i<chd_entry_ptr->flush_dep_npar; i++)
- if(chd_entry_ptr->flush_dep_par_type[i] == par_type
- && chd_entry_ptr->flush_dep_par_idx[i] == par_idx)
+ for (i = 0; i < chd_entry_ptr->flush_dep_npar; i++)
+ if (chd_entry_ptr->flush_dep_par_type[i] == par_type &&
+ chd_entry_ptr->flush_dep_par_idx[i] == par_idx)
break;
HDassert(i < chd_entry_ptr->flush_dep_npar);
- if(i < chd_entry_ptr->flush_dep_npar - 1)
- HDmemmove(&chd_entry_ptr->flush_dep_par_type[i],
- &chd_entry_ptr->flush_dep_par_type[i+1],
- (chd_entry_ptr->flush_dep_npar - i - 1)
- * sizeof(chd_entry_ptr->flush_dep_par_type[0]));
- if(i < chd_entry_ptr->flush_dep_npar - 1)
- HDmemmove(&chd_entry_ptr->flush_dep_par_idx[i],
- &chd_entry_ptr->flush_dep_par_idx[i+1],
- (chd_entry_ptr->flush_dep_npar - i - 1)
- * sizeof(chd_entry_ptr->flush_dep_par_idx[0]));
+ if (i < chd_entry_ptr->flush_dep_npar - 1)
+ HDmemmove(&chd_entry_ptr->flush_dep_par_type[i], &chd_entry_ptr->flush_dep_par_type[i + 1],
+ (chd_entry_ptr->flush_dep_npar - i - 1) * sizeof(chd_entry_ptr->flush_dep_par_type[0]));
+ if (i < chd_entry_ptr->flush_dep_npar - 1)
+ HDmemmove(&chd_entry_ptr->flush_dep_par_idx[i], &chd_entry_ptr->flush_dep_par_idx[i + 1],
+ (chd_entry_ptr->flush_dep_npar - i - 1) * sizeof(chd_entry_ptr->flush_dep_par_idx[0]));
chd_entry_ptr->flush_dep_npar--;
par_entry_ptr->flush_dep_nchd--;
- if(par_entry_ptr->flush_dep_nchd == 0) {
+ if (par_entry_ptr->flush_dep_nchd == 0) {
par_entry_ptr->pinned_from_cache = FALSE;
- par_entry_ptr->is_pinned = par_entry_ptr->pinned_from_client;
+ par_entry_ptr->is_pinned = par_entry_ptr->pinned_from_client;
} /* end if */
- if(chd_entry_ptr->is_dirty || chd_entry_ptr->flush_dep_ndirty_chd > 0) {
+ if (chd_entry_ptr->is_dirty || chd_entry_ptr->flush_dep_ndirty_chd > 0) {
HDassert(par_entry_ptr->flush_dep_ndirty_chd > 0);
par_entry_ptr->flush_dep_ndirty_chd--;
- if(!par_entry_ptr->is_dirty
- && par_entry_ptr->flush_dep_ndirty_chd == 0)
+ if (!par_entry_ptr->is_dirty && par_entry_ptr->flush_dep_ndirty_chd == 0)
mark_flush_dep_clean(par_entry_ptr);
} /* end if */
- } /* end if */
+ } /* end if */
} /* destroy_flush_dependency() */
-
/*-------------------------------------------------------------------------
* Function: mark_flush_dep_dirty()
*
@@ -5517,33 +4916,31 @@ destroy_flush_dependency(int32_t par_type,
*-------------------------------------------------------------------------
*/
static void
-mark_flush_dep_dirty(test_entry_t * entry_ptr)
+mark_flush_dep_dirty(test_entry_t *entry_ptr)
{
/* Sanity checks */
HDassert(entry_ptr);
/* Iterate over the parent entries */
- if(entry_ptr->flush_dep_npar) {
- test_entry_t *par_base_addr; /* Base entry of parent's entry array */
- test_entry_t *par_entry_ptr; /* Parent entry */
- unsigned u; /* Local index variable */
+ if (entry_ptr->flush_dep_npar) {
+ test_entry_t *par_base_addr; /* Base entry of parent's entry array */
+ test_entry_t *par_entry_ptr; /* Parent entry */
+ unsigned u; /* Local index variable */
- for(u = 0; u < entry_ptr->flush_dep_npar; u++) {
+ for (u = 0; u < entry_ptr->flush_dep_npar; u++) {
/* Get parent entry */
par_base_addr = entries[entry_ptr->flush_dep_par_type[u]];
par_entry_ptr = &(par_base_addr[entry_ptr->flush_dep_par_idx[u]]);
/* Sanity check */
- HDassert(par_entry_ptr->flush_dep_ndirty_chd
- < par_entry_ptr->flush_dep_nchd);
+ HDassert(par_entry_ptr->flush_dep_ndirty_chd < par_entry_ptr->flush_dep_nchd);
/* Adjust the parent's number of dirty children */
par_entry_ptr->flush_dep_ndirty_chd++;
} /* end for */
- } /* end if */
+ } /* end if */
} /* end mark_flush_dep_dirty() */
-
/*-------------------------------------------------------------------------
* Function: mark_flush_dep_clean()
*
@@ -5560,19 +4957,19 @@ mark_flush_dep_dirty(test_entry_t * entry_ptr)
*-------------------------------------------------------------------------
*/
static void
-mark_flush_dep_clean(test_entry_t * entry_ptr)
+mark_flush_dep_clean(test_entry_t *entry_ptr)
{
/* Sanity checks */
HDassert(entry_ptr);
HDassert(!entry_ptr->is_dirty && entry_ptr->flush_dep_ndirty_chd == 0);
/* Iterate over the parent entries */
- if(entry_ptr->flush_dep_npar) {
- test_entry_t *par_base_addr; /* Base entry of parent's entry array */
- test_entry_t *par_entry_ptr; /* Parent entry */
- unsigned u; /* Local index variable */
+ if (entry_ptr->flush_dep_npar) {
+ test_entry_t *par_base_addr; /* Base entry of parent's entry array */
+ test_entry_t *par_entry_ptr; /* Parent entry */
+ unsigned u; /* Local index variable */
- for(u = 0; u < entry_ptr->flush_dep_npar; u++) {
+ for (u = 0; u < entry_ptr->flush_dep_npar; u++) {
/* Get parent entry */
par_base_addr = entries[entry_ptr->flush_dep_par_type[u]];
par_entry_ptr = &(par_base_addr[entry_ptr->flush_dep_par_idx[u]]);
@@ -5583,13 +4980,11 @@ mark_flush_dep_clean(test_entry_t * entry_ptr)
/* Adjust the parent's number of dirty children */
par_entry_ptr->flush_dep_ndirty_chd--;
} /* end for */
- } /* end if */
+ } /* end if */
} /* end mark_flush_dep_clean() */
-
/*** H5AC level utility functions ***/
-
/*-------------------------------------------------------------------------
* Function: check_and_validate_cache_hit_rate()
*
@@ -5617,115 +5012,106 @@ mark_flush_dep_clean(test_entry_t * entry_ptr)
*/
void
-check_and_validate_cache_hit_rate(hid_t file_id,
- double * hit_rate_ptr,
- hbool_t dump_data,
- int64_t min_accesses,
- double min_hit_rate)
+check_and_validate_cache_hit_rate(hid_t file_id, double *hit_rate_ptr, hbool_t dump_data,
+ int64_t min_accesses, double min_hit_rate)
{
- herr_t result;
- int64_t cache_hits = 0;
+ herr_t result;
+ int64_t cache_hits = 0;
int64_t cache_accesses = 0;
- double expected_hit_rate;
- double hit_rate;
- H5F_t * file_ptr = NULL;
+ double expected_hit_rate;
+ double hit_rate;
+ H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
/* get a pointer to the files internal data structure */
- if ( pass ) {
+ if (pass) {
file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't get file_ptr.";
-
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
}
/* verify that we can access the cache data structure */
- if ( pass ) {
+ if (pass) {
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't access cache resize_ctl.";
}
}
/* compare the cache's internal configuration with the expected value */
- if ( pass ) {
+ if (pass) {
cache_hits = cache_ptr->cache_hits;
cache_accesses = cache_ptr->cache_accesses;
- if ( cache_accesses > 0 ) {
+ if (cache_accesses > 0) {
expected_hit_rate = ((double)cache_hits) / ((double)cache_accesses);
-
- } else {
+ }
+ else {
expected_hit_rate = 0.0F;
}
result = H5Fget_mdc_hit_rate(file_id, &hit_rate);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_hit_rate() failed.";
+ }
+ else if (!H5_DBL_ABS_EQUAL(hit_rate, expected_hit_rate)) {
- } else if ( ! H5_DBL_ABS_EQUAL(hit_rate, expected_hit_rate) ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unexpected hit rate.";
-
}
}
- if ( pass ) { /* reset the hit rate */
+ if (pass) { /* reset the hit rate */
result = H5Freset_mdc_hit_rate_stats(file_id);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Freset_mdc_hit_rate_stats() failed.";
}
}
/* set *hit_rate_ptr if appropriate */
- if ( ( pass ) && ( hit_rate_ptr != NULL ) ) {
+ if ((pass) && (hit_rate_ptr != NULL)) {
*hit_rate_ptr = hit_rate;
}
/* dump data to stdout if requested */
- if ( ( pass ) && ( dump_data ) ) {
+ if ((pass) && (dump_data)) {
- HDfprintf(stdout,
- "cache_hits: %ld, cache_accesses: %ld, hit_rate: %lf\n",
- (long)cache_hits, (long)cache_accesses, hit_rate);
+ HDfprintf(stdout, "cache_hits: %ld, cache_accesses: %ld, hit_rate: %lf\n", (long)cache_hits,
+ (long)cache_accesses, hit_rate);
}
- if ( ( pass ) &&
- ( cache_accesses > min_accesses ) &&
- ( hit_rate < min_hit_rate ) ) {
+ if ((pass) && (cache_accesses > min_accesses) && (hit_rate < min_hit_rate)) {
- pass = FALSE;
- failure_mssg = "Unexpectedly low hit rate.";
+ pass = FALSE;
+ failure_mssg = "Unexpectedly low hit rate.";
}
return;
} /* check_and_validate_cache_hit_rate() */
-
/*-------------------------------------------------------------------------
* Function: check_and_validate_cache_size()
*
@@ -5749,111 +5135,96 @@ check_and_validate_cache_hit_rate(hid_t file_id,
*/
void
-check_and_validate_cache_size(hid_t file_id,
- size_t * max_size_ptr,
- size_t * min_clean_size_ptr,
- size_t * cur_size_ptr,
- int32_t * cur_num_entries_ptr,
- hbool_t dump_data)
+check_and_validate_cache_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+ size_t *cur_size_ptr, int32_t *cur_num_entries_ptr, hbool_t dump_data)
{
- herr_t result;
- size_t expected_max_size;
- size_t max_size;
- size_t expected_min_clean_size;
- size_t min_clean_size;
- size_t expected_cur_size;
- size_t cur_size;
+ herr_t result;
+ size_t expected_max_size;
+ size_t max_size;
+ size_t expected_min_clean_size;
+ size_t min_clean_size;
+ size_t expected_cur_size;
+ size_t cur_size;
uint32_t expected_cur_num_entries;
- int cur_num_entries;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ int cur_num_entries;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
/* get a pointer to the files internal data structure */
- if ( pass ) {
+ if (pass) {
file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't get file_ptr.";
-
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
}
/* verify that we can access the cache data structure */
- if ( pass ) {
+ if (pass) {
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't access cache data structure.";
}
}
/* compare the cache's internal configuration with the expected value */
- if ( pass ) {
+ if (pass) {
expected_max_size = cache_ptr->max_cache_size;
expected_min_clean_size = cache_ptr->min_clean_size;
expected_cur_size = cache_ptr->index_size;
expected_cur_num_entries = cache_ptr->index_len;
- result = H5Fget_mdc_size(file_id,
- &max_size,
- &min_clean_size,
- &cur_size,
- &cur_num_entries);
+ result = H5Fget_mdc_size(file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_size() failed.";
+ }
+ else if ((max_size != expected_max_size) || (min_clean_size != expected_min_clean_size) ||
+ (cur_size != expected_cur_size) || (cur_num_entries != (int)expected_cur_num_entries)) {
- } else if ( ( max_size != expected_max_size ) ||
- ( min_clean_size != expected_min_clean_size ) ||
- ( cur_size != expected_cur_size ) ||
- ( cur_num_entries != (int)expected_cur_num_entries ) ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_mdc_size() returned unexpected value(s).";
-
}
}
/* return size values if requested */
- if ( ( pass ) && ( max_size_ptr != NULL ) ) {
+ if ((pass) && (max_size_ptr != NULL)) {
*max_size_ptr = max_size;
}
- if ( ( pass ) && ( min_clean_size_ptr != NULL ) ) {
+ if ((pass) && (min_clean_size_ptr != NULL)) {
*min_clean_size_ptr = min_clean_size;
}
- if ( ( pass ) && ( cur_size_ptr != NULL ) ) {
+ if ((pass) && (cur_size_ptr != NULL)) {
*cur_size_ptr = cur_size;
}
- if ( ( pass ) && ( cur_num_entries_ptr != NULL ) ) {
+ if ((pass) && (cur_num_entries_ptr != NULL)) {
*cur_num_entries_ptr = cur_num_entries;
}
-
/* dump data to stdout if requested */
- if ( ( pass ) && ( dump_data ) ) {
+ if ((pass) && (dump_data)) {
- HDfprintf(stdout,
- "max_sz: %ld, min_clean_sz: %ld, cur_sz: %ld, cur_ent: %ld\n",
- (long)max_size, (long)min_clean_size, (long)cur_size,
- (long)cur_num_entries);
+ HDfprintf(stdout, "max_sz: %ld, min_clean_sz: %ld, cur_sz: %ld, cur_ent: %ld\n", (long)max_size,
+ (long)min_clean_size, (long)cur_size, (long)cur_num_entries);
}
return;
@@ -5861,62 +5232,59 @@ check_and_validate_cache_size(hid_t file_id,
} /* check_and_validate_cache_size() */
H5_ATTR_PURE hbool_t
-resize_configs_are_equal(const H5C_auto_size_ctl_t *a,
- const H5C_auto_size_ctl_t *b,
- hbool_t compare_init)
+resize_configs_are_equal(const H5C_auto_size_ctl_t *a, const H5C_auto_size_ctl_t *b, hbool_t compare_init)
{
- if(a->version != b->version)
- return(FALSE);
- else if(a->rpt_fcn != b->rpt_fcn)
- return(FALSE);
- else if(compare_init && (a->set_initial_size != b->set_initial_size))
- return(FALSE);
- else if(compare_init && (a->initial_size != b->initial_size))
- return(FALSE);
- else if(!H5_DBL_ABS_EQUAL(a->min_clean_fraction, b->min_clean_fraction))
- return(FALSE);
- else if(a->max_size != b->max_size)
- return(FALSE);
- else if(a->min_size != b->min_size)
- return(FALSE);
- else if(a->epoch_length != b->epoch_length)
- return(FALSE);
- else if(a->incr_mode != b->incr_mode)
- return(FALSE);
- else if(!H5_DBL_ABS_EQUAL(a->lower_hr_threshold, b->lower_hr_threshold))
- return(FALSE);
- else if(!H5_DBL_ABS_EQUAL(a->increment, b->increment))
- return(FALSE);
- else if(a->apply_max_increment != b->apply_max_increment)
- return(FALSE);
- else if(a->max_increment != b->max_increment)
- return(FALSE);
- else if(a->flash_incr_mode != b->flash_incr_mode)
- return(FALSE);
- else if(!H5_DBL_ABS_EQUAL(a->flash_multiple, b->flash_multiple))
- return(FALSE);
- else if(!H5_DBL_ABS_EQUAL(a->flash_threshold, b->flash_threshold))
- return(FALSE);
- else if(a->decr_mode != b->decr_mode)
- return(FALSE);
- else if(!H5_DBL_ABS_EQUAL(a->upper_hr_threshold, b->upper_hr_threshold))
- return(FALSE);
- else if(!H5_DBL_ABS_EQUAL(a->decrement, b->decrement))
- return(FALSE);
- else if(a->apply_max_decrement != b->apply_max_decrement)
- return(FALSE);
- else if(a->max_decrement != b->max_decrement)
- return(FALSE);
- else if(a->epochs_before_eviction != b->epochs_before_eviction)
- return(FALSE);
- else if(a->apply_empty_reserve != b->apply_empty_reserve)
- return(FALSE);
- else if(!H5_DBL_ABS_EQUAL(a->empty_reserve, b->empty_reserve))
- return(FALSE);
- return(TRUE);
+ if (a->version != b->version)
+ return (FALSE);
+ else if (a->rpt_fcn != b->rpt_fcn)
+ return (FALSE);
+ else if (compare_init && (a->set_initial_size != b->set_initial_size))
+ return (FALSE);
+ else if (compare_init && (a->initial_size != b->initial_size))
+ return (FALSE);
+ else if (!H5_DBL_ABS_EQUAL(a->min_clean_fraction, b->min_clean_fraction))
+ return (FALSE);
+ else if (a->max_size != b->max_size)
+ return (FALSE);
+ else if (a->min_size != b->min_size)
+ return (FALSE);
+ else if (a->epoch_length != b->epoch_length)
+ return (FALSE);
+ else if (a->incr_mode != b->incr_mode)
+ return (FALSE);
+ else if (!H5_DBL_ABS_EQUAL(a->lower_hr_threshold, b->lower_hr_threshold))
+ return (FALSE);
+ else if (!H5_DBL_ABS_EQUAL(a->increment, b->increment))
+ return (FALSE);
+ else if (a->apply_max_increment != b->apply_max_increment)
+ return (FALSE);
+ else if (a->max_increment != b->max_increment)
+ return (FALSE);
+ else if (a->flash_incr_mode != b->flash_incr_mode)
+ return (FALSE);
+ else if (!H5_DBL_ABS_EQUAL(a->flash_multiple, b->flash_multiple))
+ return (FALSE);
+ else if (!H5_DBL_ABS_EQUAL(a->flash_threshold, b->flash_threshold))
+ return (FALSE);
+ else if (a->decr_mode != b->decr_mode)
+ return (FALSE);
+ else if (!H5_DBL_ABS_EQUAL(a->upper_hr_threshold, b->upper_hr_threshold))
+ return (FALSE);
+ else if (!H5_DBL_ABS_EQUAL(a->decrement, b->decrement))
+ return (FALSE);
+ else if (a->apply_max_decrement != b->apply_max_decrement)
+ return (FALSE);
+ else if (a->max_decrement != b->max_decrement)
+ return (FALSE);
+ else if (a->epochs_before_eviction != b->epochs_before_eviction)
+ return (FALSE);
+ else if (a->apply_empty_reserve != b->apply_empty_reserve)
+ return (FALSE);
+ else if (!H5_DBL_ABS_EQUAL(a->empty_reserve, b->empty_reserve))
+ return (FALSE);
+ return (TRUE);
}
-
/*-------------------------------------------------------------------------
* Function: validate_mdc_config()
*
@@ -5937,78 +5305,70 @@ resize_configs_are_equal(const H5C_auto_size_ctl_t *a,
*/
void
-validate_mdc_config(hid_t file_id,
- H5AC_cache_config_t * ext_config_ptr,
- hbool_t compare_init,
- int test_num)
+validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t compare_init, int test_num)
{
- static char msg[256];
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ static char msg[256];
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
H5AC_cache_config_t scratch;
H5C_auto_size_ctl_t int_config;
XLATE_EXT_TO_INT_MDC_CONFIG(int_config, (*ext_config_ptr))
/* get a pointer to the files internal data structure */
- if ( pass ) {
+ if (pass) {
file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Can't get file_ptr #%d.", test_num);
failure_mssg = msg;
-
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
}
/* verify that we can access the internal version of the cache config */
- if ( pass ) {
+ if (pass) {
- if ( ( cache_ptr == NULL ) ||
- ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ||
- ( cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER ) ){
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC) ||
+ (cache_ptr->resize_ctl.version != H5C__CURR_AUTO_SIZE_CTL_VER)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Can't access cache resize_ctl #%d.", test_num);
+ HDsnprintf(msg, (size_t)128, "Can't access cache resize_ctl #%d.", test_num);
failure_mssg = msg;
}
}
/* compare the cache's internal configuration with the expected value */
- if ( pass ) {
+ if (pass) {
- if ( ! resize_configs_are_equal(&int_config, &cache_ptr->resize_ctl,
- compare_init) ) {
+ if (!resize_configs_are_equal(&int_config, &cache_ptr->resize_ctl, compare_init)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected internal config #%d.", test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected internal config #%d.", test_num);
failure_mssg = msg;
}
}
/* obtain external cache config */
- if ( pass ) {
+ if (pass) {
scratch.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- if ( H5Fget_mdc_config(file_id, &scratch) < 0 ) {
+ if (H5Fget_mdc_config(file_id, &scratch) < 0) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5Fget_mdc_config() failed #%d.", test_num);
+ HDsnprintf(msg, (size_t)128, "H5Fget_mdc_config() failed #%d.", test_num);
failure_mssg = msg;
}
}
- if ( pass ) {
+ if (pass) {
/* Recall that in any configuration supplied by the cache
* at run time, the set_initial_size field will always
@@ -6021,12 +5381,10 @@ validate_mdc_config(hid_t file_id,
* Depending on circumstances, this may or may not match
* the original. Hence the compare_init parameter.
*/
- if ( ! CACHE_CONFIGS_EQUAL((*ext_config_ptr), scratch, \
- FALSE, compare_init) ) {
+ if (!CACHE_CONFIGS_EQUAL((*ext_config_ptr), scratch, FALSE, compare_init)) {
pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "Unexpected external config #%d.", test_num);
+ HDsnprintf(msg, (size_t)128, "Unexpected external config #%d.", test_num);
failure_mssg = msg;
}
}
@@ -6035,7 +5393,6 @@ validate_mdc_config(hid_t file_id,
} /* validate_mdc_config() */
-
#if 0 /* debugging functions -- normally commented out */
/*-------------------------------------------------------------------------
* Function: dump_LRU
diff --git a/test/cache_common.h b/test/cache_common.h
index 807ba35..aa32858 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -20,8 +20,8 @@
#ifndef _CACHE_COMMON_H
#define _CACHE_COMMON_H
-#define H5C_FRIEND /*suppress error about including H5Cpkg */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5C_FRIEND /*suppress error about including H5Cpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/* Include library header files */
#include "H5ACprivate.h"
@@ -29,127 +29,108 @@
#include "H5Cpkg.h"
#include "H5Fpkg.h"
#include "H5Iprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* Include test header files */
#include "h5test.h"
/* Macro to make error reporting easier */
-#define CACHE_ERROR(s) {failure_mssg = "Line #" H5_TOSTRING(__LINE__) ": " s ; pass = FALSE; goto done;}
+#define CACHE_ERROR(s) \
+ { \
+ failure_mssg = "Line #" H5_TOSTRING(__LINE__) ": " s; \
+ pass = FALSE; \
+ goto done; \
+ }
-#define NO_CHANGE -1
+#define NO_CHANGE -1
/* with apologies for the abuse of terminology... */
-#define PICO_ENTRY_TYPE 0
-#define NANO_ENTRY_TYPE 1
+#define PICO_ENTRY_TYPE 0
+#define NANO_ENTRY_TYPE 1
#define MICRO_ENTRY_TYPE 2
-#define TINY_ENTRY_TYPE 3
+#define TINY_ENTRY_TYPE 3
#define SMALL_ENTRY_TYPE 4
-#define MEDIUM_ENTRY_TYPE 5
+#define MEDIUM_ENTRY_TYPE 5
#define LARGE_ENTRY_TYPE 6
-#define HUGE_ENTRY_TYPE 7
-#define MONSTER_ENTRY_TYPE 8
-#define VARIABLE_ENTRY_TYPE 9
-#define NOTIFY_ENTRY_TYPE 10
+#define HUGE_ENTRY_TYPE 7
+#define MONSTER_ENTRY_TYPE 8
+#define VARIABLE_ENTRY_TYPE 9
+#define NOTIFY_ENTRY_TYPE 10
-#define NUMBER_OF_ENTRY_TYPES 11
+#define NUMBER_OF_ENTRY_TYPES 11
-#define PICO_ENTRY_SIZE (size_t)1
-#define NANO_ENTRY_SIZE (size_t)4
+#define PICO_ENTRY_SIZE (size_t)1
+#define NANO_ENTRY_SIZE (size_t)4
#define MICRO_ENTRY_SIZE (size_t)16
-#define TINY_ENTRY_SIZE (size_t)64
+#define TINY_ENTRY_SIZE (size_t)64
#define SMALL_ENTRY_SIZE (size_t)256
-#define MEDIUM_ENTRY_SIZE (size_t)1024
+#define MEDIUM_ENTRY_SIZE (size_t)1024
#define LARGE_ENTRY_SIZE (size_t)(4 * 1024)
-#define HUGE_ENTRY_SIZE (size_t)(16 * 1024)
-#define MONSTER_ENTRY_SIZE (size_t)(64 * 1024)
-#define VARIABLE_ENTRY_SIZE (size_t)(10 * 1024)
-#define NOTIFY_ENTRY_SIZE (size_t)1
+#define HUGE_ENTRY_SIZE (size_t)(16 * 1024)
+#define MONSTER_ENTRY_SIZE (size_t)(64 * 1024)
+#define VARIABLE_ENTRY_SIZE (size_t)(10 * 1024)
+#define NOTIFY_ENTRY_SIZE (size_t)1
-#define NUM_PICO_ENTRIES (10 * 1024)
-#define NUM_NANO_ENTRIES (10 * 1024)
+#define NUM_PICO_ENTRIES (10 * 1024)
+#define NUM_NANO_ENTRIES (10 * 1024)
#define NUM_MICRO_ENTRIES (10 * 1024)
-#define NUM_TINY_ENTRIES (10 * 1024)
+#define NUM_TINY_ENTRIES (10 * 1024)
#define NUM_SMALL_ENTRIES (10 * 1024)
-#define NUM_MEDIUM_ENTRIES (10 * 1024)
+#define NUM_MEDIUM_ENTRIES (10 * 1024)
#define NUM_LARGE_ENTRIES (10 * 1024)
-#define NUM_HUGE_ENTRIES (10 * 1024)
-#define NUM_MONSTER_ENTRIES (10 * 1024)
-#define NUM_VARIABLE_ENTRIES (10 * 1024)
-#define NUM_NOTIFY_ENTRIES (10 * 1024)
-
-#define MAX_ENTRIES (10 * 1024)
+#define NUM_HUGE_ENTRIES (10 * 1024)
+#define NUM_MONSTER_ENTRIES (10 * 1024)
+#define NUM_VARIABLE_ENTRIES (10 * 1024)
+#define NUM_NOTIFY_ENTRIES (10 * 1024)
+#define MAX_ENTRIES (10 * 1024)
/* The choice of the BASE_ADDR below is arbitrary -- it just has to be
* larger than the superblock.
*/
-#define BASE_ADDR (haddr_t)1024
-#define PICO_BASE_ADDR BASE_ADDR
-#define NANO_BASE_ADDR (haddr_t)(PICO_BASE_ADDR + \
- (PICO_ENTRY_SIZE * NUM_PICO_ENTRIES))
-#define MICRO_BASE_ADDR (haddr_t)(NANO_BASE_ADDR + \
- (NANO_ENTRY_SIZE * NUM_NANO_ENTRIES))
-#define TINY_BASE_ADDR (haddr_t)(MICRO_BASE_ADDR + \
- (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES))
-#define SMALL_BASE_ADDR (haddr_t)(TINY_BASE_ADDR + \
- (TINY_ENTRY_SIZE * NUM_TINY_ENTRIES))
-#define MEDIUM_BASE_ADDR (haddr_t)(SMALL_BASE_ADDR + \
- (SMALL_ENTRY_SIZE * NUM_SMALL_ENTRIES))
-#define LARGE_BASE_ADDR (haddr_t)(MEDIUM_BASE_ADDR + \
- (MEDIUM_ENTRY_SIZE * NUM_MEDIUM_ENTRIES))
-#define HUGE_BASE_ADDR (haddr_t)(LARGE_BASE_ADDR + \
- (LARGE_ENTRY_SIZE * NUM_LARGE_ENTRIES))
-#define MONSTER_BASE_ADDR (haddr_t)(HUGE_BASE_ADDR + \
- (HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES))
-#define VARIABLE_BASE_ADDR (haddr_t)(MONSTER_BASE_ADDR + \
- (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES))
-#define NOTIFY_BASE_ADDR (haddr_t)(VARIABLE_BASE_ADDR + \
- (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES))
-
-#define PICO_ALT_BASE_ADDR (haddr_t)(NOTIFY_BASE_ADDR + \
- (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
-#define NANO_ALT_BASE_ADDR (haddr_t)(PICO_ALT_BASE_ADDR + \
- (PICO_ENTRY_SIZE * NUM_PICO_ENTRIES))
-#define MICRO_ALT_BASE_ADDR (haddr_t)(NANO_ALT_BASE_ADDR + \
- (NANO_ENTRY_SIZE * NUM_NANO_ENTRIES))
-#define TINY_ALT_BASE_ADDR (haddr_t)(MICRO_ALT_BASE_ADDR + \
- (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES))
-#define SMALL_ALT_BASE_ADDR (haddr_t)(TINY_ALT_BASE_ADDR + \
- (TINY_ENTRY_SIZE * NUM_TINY_ENTRIES))
-#define MEDIUM_ALT_BASE_ADDR (haddr_t)(SMALL_ALT_BASE_ADDR + \
- (SMALL_ENTRY_SIZE * NUM_SMALL_ENTRIES))
-#define LARGE_ALT_BASE_ADDR (haddr_t)(MEDIUM_ALT_BASE_ADDR + \
- (MEDIUM_ENTRY_SIZE * NUM_MEDIUM_ENTRIES))
-#define HUGE_ALT_BASE_ADDR (haddr_t)(LARGE_ALT_BASE_ADDR + \
- (LARGE_ENTRY_SIZE * NUM_LARGE_ENTRIES))
-#define MONSTER_ALT_BASE_ADDR (haddr_t)(HUGE_ALT_BASE_ADDR + \
- (HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES))
-#define VARIABLE_ALT_BASE_ADDR (haddr_t)(MONSTER_ALT_BASE_ADDR + \
- (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES))
-#define NOTIFY_ALT_BASE_ADDR (haddr_t)(VARIABLE_ALT_BASE_ADDR + \
- (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES))
-#define MAX_ADDR (haddr_t)(NOTIFY_ALT_BASE_ADDR + \
- (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
+#define BASE_ADDR (haddr_t)1024
+#define PICO_BASE_ADDR BASE_ADDR
+#define NANO_BASE_ADDR (haddr_t)(PICO_BASE_ADDR + (PICO_ENTRY_SIZE * NUM_PICO_ENTRIES))
+#define MICRO_BASE_ADDR (haddr_t)(NANO_BASE_ADDR + (NANO_ENTRY_SIZE * NUM_NANO_ENTRIES))
+#define TINY_BASE_ADDR (haddr_t)(MICRO_BASE_ADDR + (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES))
+#define SMALL_BASE_ADDR (haddr_t)(TINY_BASE_ADDR + (TINY_ENTRY_SIZE * NUM_TINY_ENTRIES))
+#define MEDIUM_BASE_ADDR (haddr_t)(SMALL_BASE_ADDR + (SMALL_ENTRY_SIZE * NUM_SMALL_ENTRIES))
+#define LARGE_BASE_ADDR (haddr_t)(MEDIUM_BASE_ADDR + (MEDIUM_ENTRY_SIZE * NUM_MEDIUM_ENTRIES))
+#define HUGE_BASE_ADDR (haddr_t)(LARGE_BASE_ADDR + (LARGE_ENTRY_SIZE * NUM_LARGE_ENTRIES))
+#define MONSTER_BASE_ADDR (haddr_t)(HUGE_BASE_ADDR + (HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES))
+#define VARIABLE_BASE_ADDR (haddr_t)(MONSTER_BASE_ADDR + (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES))
+#define NOTIFY_BASE_ADDR (haddr_t)(VARIABLE_BASE_ADDR + (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES))
+
+#define PICO_ALT_BASE_ADDR (haddr_t)(NOTIFY_BASE_ADDR + (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
+#define NANO_ALT_BASE_ADDR (haddr_t)(PICO_ALT_BASE_ADDR + (PICO_ENTRY_SIZE * NUM_PICO_ENTRIES))
+#define MICRO_ALT_BASE_ADDR (haddr_t)(NANO_ALT_BASE_ADDR + (NANO_ENTRY_SIZE * NUM_NANO_ENTRIES))
+#define TINY_ALT_BASE_ADDR (haddr_t)(MICRO_ALT_BASE_ADDR + (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES))
+#define SMALL_ALT_BASE_ADDR (haddr_t)(TINY_ALT_BASE_ADDR + (TINY_ENTRY_SIZE * NUM_TINY_ENTRIES))
+#define MEDIUM_ALT_BASE_ADDR (haddr_t)(SMALL_ALT_BASE_ADDR + (SMALL_ENTRY_SIZE * NUM_SMALL_ENTRIES))
+#define LARGE_ALT_BASE_ADDR (haddr_t)(MEDIUM_ALT_BASE_ADDR + (MEDIUM_ENTRY_SIZE * NUM_MEDIUM_ENTRIES))
+#define HUGE_ALT_BASE_ADDR (haddr_t)(LARGE_ALT_BASE_ADDR + (LARGE_ENTRY_SIZE * NUM_LARGE_ENTRIES))
+#define MONSTER_ALT_BASE_ADDR (haddr_t)(HUGE_ALT_BASE_ADDR + (HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES))
+#define VARIABLE_ALT_BASE_ADDR (haddr_t)(MONSTER_ALT_BASE_ADDR + (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES))
+#define NOTIFY_ALT_BASE_ADDR (haddr_t)(VARIABLE_ALT_BASE_ADDR + (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES))
+#define MAX_ADDR (haddr_t)(NOTIFY_ALT_BASE_ADDR + (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
#define ADDR_SPACE_SIZE (haddr_t)(MAX_ADDR - BASE_ADDR)
-
/***********************************************************************
*
* Macro: H5C_FLUSH_CACHE
*
- * Purpose: Wrap a call to H5C_flush_cache() in calls to
+ * Purpose: Wrap a call to H5C_flush_cache() in calls to
* H5C_set_slist_enabled() to setup and take down the slist.
*
* This is necessary, as H5C_flush_cache() needs the
- * slist to be active. Further, since it is called
- * repeatedly during file flush, it would be inefficient
+ * slist to be active. Further, since it is called
+ * repeatedly during file flush, it would be inefficient
* for it to setup the slist on entry, and take it down
- * on exit.
+ * on exit.
*
* Note that the slist need not be empty if the flags
- * indicate a partial flush (i.e.
+ * indicate a partial flush (i.e.
* H5C__FLUSH_MARKED_ENTRIES_FLAG). Compute clear_slist
* and pass it into H5C_set_slist_enabled as appropriate.
*
@@ -165,263 +146,263 @@
*
***********************************************************************/
-#define H5C_FLUSH_CACHE(file, flags, fail_mssg) \
-{ \
- hbool_t clear_slist; \
- herr_t rslt; \
- \
- clear_slist = ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ); \
- \
- rslt = H5C_set_slist_enabled((file)->shared->cache, TRUE, FALSE); \
- \
- if ( rslt >= 0 ) { \
- \
- rslt = H5C_flush_cache((file), (flags)); \
- } \
- \
- if ( rslt >= 0 ) { \
- \
- rslt = H5C_set_slist_enabled((file)->shared->cache, FALSE, \
- clear_slist); \
- } \
- \
- if( rslt < 0 ) { \
- \
- pass = FALSE; \
- failure_mssg = (fail_mssg); \
- } \
-} /* H5C_FLUSH_CACHE */
-
-
-#define MAX_PINS 8 /* Maximum number of entries that can be
- * directly pinned by a single entry.
- */
-
-#define FLUSH_OP__NO_OP 0
-#define FLUSH_OP__DIRTY 1
-#define FLUSH_OP__RESIZE 2
-#define FLUSH_OP__MOVE 3
-#define FLUSH_OP__ORDER 4
+#define H5C_FLUSH_CACHE(file, flags, fail_mssg) \
+ { \
+ hbool_t clear_slist; \
+ herr_t rslt; \
+ \
+ clear_slist = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0); \
+ \
+ rslt = H5C_set_slist_enabled((file)->shared->cache, TRUE, FALSE); \
+ \
+ if (rslt >= 0) { \
+ \
+ rslt = H5C_flush_cache((file), (flags)); \
+ } \
+ \
+ if (rslt >= 0) { \
+ \
+ rslt = H5C_set_slist_enabled((file)->shared->cache, FALSE, clear_slist); \
+ } \
+ \
+ if (rslt < 0) { \
+ \
+ pass = FALSE; \
+ failure_mssg = (fail_mssg); \
+ } \
+ } /* H5C_FLUSH_CACHE */
+
+#define MAX_PINS \
+ 8 /* Maximum number of entries that can be \
+ * directly pinned by a single entry. \
+ */
+
+#define FLUSH_OP__NO_OP 0
+#define FLUSH_OP__DIRTY 1
+#define FLUSH_OP__RESIZE 2
+#define FLUSH_OP__MOVE 3
+#define FLUSH_OP__ORDER 4
#define FLUSH_OP__EXPUNGE 5
-#define FLUSH_OP__DEST_FLUSH_DEP 6
-#define FLUSH_OP__MAX_OP 6
-
-#define MAX_FLUSH_OPS 10 /* Maximum number of flush operations
- * that can be associated with a
- * cache entry.
- */
-
-#define MAX_FLUSH_DEP_PARS 8 /* Maximum number of flush dependency
- * parents in the test */
-
-typedef struct flush_op
-{
- int op_code; /* integer op code indicating the
- * operation to be performed. At
- * present it must be one of:
- *
- * FLUSH_OP__NO_OP
- * FLUSH_OP__DIRTY
- * FLUSH_OP__RESIZE
- * FLUSH_OP__MOVE
- * FLUSH_OP__ORDER
- */
- int type; /* type code of the cache entry that
- * is the target of the operation.
- * This value is passed into the
- * function implementing the flush
- * operation.
- */
- int idx; /* index of the cache entry that
- * is the target of the operation.
- * This value is passed into the
- * function implementing the flush
- * operation.
- */
- hbool_t flag; /* boolean flag passed into the
- * function implementing the flush
- * operation. The meaning of the
- * flag is dependent upon the flush
- * operation:
- *
- * FLUSH_OP__DIRTY: TRUE iff the
- * target is pinned, and is to
- * be dirtied via the
- * H5C_mark_entry_dirty()
- * call.
- *
- * FLUSH_OP__RESIZE: TRUE iff the
- * target is pinned, and is to
- * be resized via the
- * H5C_resize_entry()
- * call.
- *
- * FLUSH_OP__MOVE: TRUE iff the
- * target is to be moved to
- * its main address.
- */
- size_t size; /* New target size in the
- * FLUSH_OP__MOVE operation.
- * Unused elsewhere.
- */
- unsigned * order_ptr; /* Pointer to outside counter for
- * recording the order of entries
- * flushed.
- */
+#define FLUSH_OP__DEST_FLUSH_DEP 6
+#define FLUSH_OP__MAX_OP 6
+
+#define MAX_FLUSH_OPS \
+ 10 /* Maximum number of flush operations \
+ * that can be associated with a \
+ * cache entry. \
+ */
+
+#define MAX_FLUSH_DEP_PARS \
+ 8 /* Maximum number of flush dependency \
+ * parents in the test */
+
+typedef struct flush_op {
+ int op_code; /* integer op code indicating the
+ * operation to be performed. At
+ * present it must be one of:
+ *
+ * FLUSH_OP__NO_OP
+ * FLUSH_OP__DIRTY
+ * FLUSH_OP__RESIZE
+ * FLUSH_OP__MOVE
+ * FLUSH_OP__ORDER
+ */
+ int type; /* type code of the cache entry that
+ * is the target of the operation.
+ * This value is passed into the
+ * function implementing the flush
+ * operation.
+ */
+ int idx; /* index of the cache entry that
+ * is the target of the operation.
+ * This value is passed into the
+ * function implementing the flush
+ * operation.
+ */
+ hbool_t flag; /* boolean flag passed into the
+ * function implementing the flush
+ * operation. The meaning of the
+ * flag is dependent upon the flush
+ * operation:
+ *
+ * FLUSH_OP__DIRTY: TRUE iff the
+ * target is pinned, and is to
+ * be dirtied via the
+ * H5C_mark_entry_dirty()
+ * call.
+ *
+ * FLUSH_OP__RESIZE: TRUE iff the
+ * target is pinned, and is to
+ * be resized via the
+ * H5C_resize_entry()
+ * call.
+ *
+ * FLUSH_OP__MOVE: TRUE iff the
+ * target is to be moved to
+ * its main address.
+ */
+ size_t size; /* New target size in the
+ * FLUSH_OP__MOVE operation.
+ * Unused elsewhere.
+ */
+ unsigned *order_ptr; /* Pointer to outside counter for
+ * recording the order of entries
+ * flushed.
+ */
} flush_op;
typedef enum test_entry_action_t {
- TEST_ENTRY_ACTION_NUL = 0, /* No action on entry */
- TEST_ENTRY_ACTION_MOVE /* Entry is beging moved */
+ TEST_ENTRY_ACTION_NUL = 0, /* No action on entry */
+ TEST_ENTRY_ACTION_MOVE /* Entry is beging moved */
} test_entry_action_t;
-typedef struct test_entry_t
-{
- H5C_cache_entry_t header; /* entry data used by the cache
- * -- must be first
- */
- struct test_entry_t * self; /* pointer to this entry -- used for
- * sanity checking.
- */
- test_entry_action_t action; /* Action being performed on a test entry */
- H5F_t * file_ptr; /* pointer to the file in which the
- * entry resides, or NULL if the entry
- * is not in a file.
- */
- H5C_t * cache_ptr; /* pointer to the cache in which
- * the entry resides, or NULL if the
- * entry is not in cache.
- */
- hbool_t written_to_main_addr;
- /* Flag indicating whether an image
- * of the entry has been written to
- * its main address. Since we no
- * longer have a flush callback, we
- * set this field to true whenever the
- * entry is serialized while at its
- * main address.
- */
- hbool_t written_to_alt_addr;
- /* Flag indicating whether an image
- * of the entry has been written to
- * its alternate address. Since we no
- * longer have a flush callback, we
- * set this field to true whenever the
- * entry is serialized while at its
- * alternate address.
- */
- haddr_t addr; /* where the cache thinks this entry
- * is located
- */
- hbool_t at_main_addr; /* boolean flag indicating whether
- * the entry is supposed to be at
- * either its main or alternate
- * address.
- */
- haddr_t main_addr; /* initial location of the entry
- */
- haddr_t alt_addr; /* location to which the entry
- * can be relocated or "moved"
- */
- size_t size; /* how big the cache thinks this
- * entry is
- */
- int32_t type; /* indicates which entry array this
- * entry is in
- */
- int32_t index; /* index in its entry array
- */
- int32_t serializes; /* number of times this entry has
- * been serialized.
- */
- int32_t deserializes; /* number of times this entry has
- * been deserialized
- */
- hbool_t is_dirty; /* entry has been modified since
- * last write
- */
- hbool_t is_protected; /* entry should currently be on
- * the cache's protected list.
- */
- hbool_t is_read_only; /* TRUE iff the entry should be
- * protected read only.
- */
- int ro_ref_count; /* Number of outstanding read only
- * protects on the entry.
- */
- hbool_t is_pinned; /* entry is currently pinned in
- * the cache.
- */
- haddr_t tag; /* the base_addr as tag for corking entries */
- hbool_t is_corked; /* entry is currently corked or not */
- int pinning_ref_count; /* Number of entries that
- * pin this entry in the cache.
- * When this count drops to zero,
- * this entry should be unpinned.
- */
- int num_pins; /* Number of entries that this
- * entry pins in the cache. This
- * value must be in the range
- * [0, MAX_PINS].
- */
- int pin_type[MAX_PINS]; /* array of the types of entries
- * pinned by this entry.
- */
- int pin_idx[MAX_PINS]; /* array of the indicies of
- * entries pinned by this entry.
- */
- int num_flush_ops; /* integer field containing the
- * number of flush operations to
- * be executed when the entry is
- * flushed. This value must lie in
- * the closed interval
- * [0, MAX_FLUSH_OPS].
- */
- struct flush_op flush_ops[MAX_FLUSH_OPS]; /* Array of instances
- * of struct flush_op detailing the
- * flush operations (if any) that
- * are to be executed when the entry
- * is flushed from the cache.
- *
- * num_flush_ops contains the number
- * of valid entries in this array.
- */
- hbool_t flush_op_self_resize_in_progress; /* Boolean flag
- * that is set to TRUE iff this
- * entry is being flushed, it has
- * been resized by a resize flush
- * op, and the flush function has
- * not yet returned, This field is
- * used to turn off overactive santity
- * checking code that would otherwise
- * cause a false test failure.
- */
- hbool_t deserialized; /* entry has been deserialized since
- * the last time it was reset.
- */
- hbool_t serialized; /* entry has been serialized since the
- * last time it was reset.
- */
- hbool_t destroyed; /* entry has been destroyed since the
- * last time it was reset.
- */
- hbool_t expunged; /* entry has been expunged since the
- * last time it was reset.
- */
- int flush_dep_par_type[MAX_FLUSH_DEP_PARS]; /* Entry types of flush dependency parents */
- int flush_dep_par_idx[MAX_FLUSH_DEP_PARS]; /* Indices of flush dependency parents */
- unsigned flush_dep_npar; /* Number of flush dependency parents */
- unsigned flush_dep_nchd; /* Number of flush dependency children */
- unsigned flush_dep_ndirty_chd; /* Number of dirty flush dependency children (including granchildren, etc.) */
- hbool_t pinned_from_client; /* entry was pinned by client call */
- hbool_t pinned_from_cache; /* entry was pinned by cache internally */
- unsigned flush_order; /* Order that entry was flushed in */
-
- unsigned notify_after_insert_count; /* Count of times that entry was inserted in cache */
- unsigned notify_before_evict_count; /* Count of times that entry was removed in cache */
- size_t actual_len; /* Simulate the entry's actual size for a speculative load */
- unsigned max_verify_ct; /* Maximum # of times to verify an entry's checksum */
- unsigned verify_ct; /* Count the # of checksum verification for an entry */
+typedef struct test_entry_t {
+ H5C_cache_entry_t header; /* entry data used by the cache
+ * -- must be first
+ */
+ struct test_entry_t *self; /* pointer to this entry -- used for
+ * sanity checking.
+ */
+ test_entry_action_t action; /* Action being performed on a test entry */
+ H5F_t * file_ptr; /* pointer to the file in which the
+ * entry resides, or NULL if the entry
+ * is not in a file.
+ */
+ H5C_t *cache_ptr; /* pointer to the cache in which
+ * the entry resides, or NULL if the
+ * entry is not in cache.
+ */
+ hbool_t written_to_main_addr;
+ /* Flag indicating whether an image
+ * of the entry has been written to
+ * its main address. Since we no
+ * longer have a flush callback, we
+ * set this field to true whenever the
+ * entry is serialized while at its
+ * main address.
+ */
+ hbool_t written_to_alt_addr;
+ /* Flag indicating whether an image
+ * of the entry has been written to
+ * its alternate address. Since we no
+ * longer have a flush callback, we
+ * set this field to true whenever the
+ * entry is serialized while at its
+ * alternate address.
+ */
+ haddr_t addr; /* where the cache thinks this entry
+ * is located
+ */
+ hbool_t at_main_addr; /* boolean flag indicating whether
+ * the entry is supposed to be at
+ * either its main or alternate
+ * address.
+ */
+ haddr_t main_addr; /* initial location of the entry
+ */
+ haddr_t alt_addr; /* location to which the entry
+ * can be relocated or "moved"
+ */
+ size_t size; /* how big the cache thinks this
+ * entry is
+ */
+ int32_t type; /* indicates which entry array this
+ * entry is in
+ */
+ int32_t index; /* index in its entry array
+ */
+ int32_t serializes; /* number of times this entry has
+ * been serialized.
+ */
+ int32_t deserializes; /* number of times this entry has
+ * been deserialized
+ */
+ hbool_t is_dirty; /* entry has been modified since
+ * last write
+ */
+ hbool_t is_protected; /* entry should currently be on
+ * the cache's protected list.
+ */
+ hbool_t is_read_only; /* TRUE iff the entry should be
+ * protected read only.
+ */
+ int ro_ref_count; /* Number of outstanding read only
+ * protects on the entry.
+ */
+ hbool_t is_pinned; /* entry is currently pinned in
+ * the cache.
+ */
+ haddr_t tag; /* the base_addr as tag for corking entries */
+ hbool_t is_corked; /* entry is currently corked or not */
+ int pinning_ref_count; /* Number of entries that
+ * pin this entry in the cache.
+ * When this count drops to zero,
+ * this entry should be unpinned.
+ */
+ int num_pins; /* Number of entries that this
+ * entry pins in the cache. This
+ * value must be in the range
+ * [0, MAX_PINS].
+ */
+ int pin_type[MAX_PINS]; /* array of the types of entries
+ * pinned by this entry.
+ */
+ int pin_idx[MAX_PINS]; /* array of the indicies of
+ * entries pinned by this entry.
+ */
+ int num_flush_ops; /* integer field containing the
+ * number of flush operations to
+ * be executed when the entry is
+ * flushed. This value must lie in
+ * the closed interval
+ * [0, MAX_FLUSH_OPS].
+ */
+ struct flush_op flush_ops[MAX_FLUSH_OPS]; /* Array of instances
+ * of struct flush_op detailing the
+ * flush operations (if any) that
+ * are to be executed when the entry
+ * is flushed from the cache.
+ *
+ * num_flush_ops contains the number
+ * of valid entries in this array.
+ */
+ hbool_t flush_op_self_resize_in_progress; /* Boolean flag
+ * that is set to TRUE iff this
+ * entry is being flushed, it has
+ * been resized by a resize flush
+ * op, and the flush function has
+ * not yet returned, This field is
+ * used to turn off overactive santity
+ * checking code that would otherwise
+ * cause a false test failure.
+ */
+ hbool_t deserialized; /* entry has been deserialized since
+ * the last time it was reset.
+ */
+ hbool_t serialized; /* entry has been serialized since the
+ * last time it was reset.
+ */
+ hbool_t destroyed; /* entry has been destroyed since the
+ * last time it was reset.
+ */
+ hbool_t expunged; /* entry has been expunged since the
+ * last time it was reset.
+ */
+ int flush_dep_par_type[MAX_FLUSH_DEP_PARS]; /* Entry types of flush dependency parents */
+ int flush_dep_par_idx[MAX_FLUSH_DEP_PARS]; /* Indices of flush dependency parents */
+ unsigned flush_dep_npar; /* Number of flush dependency parents */
+ unsigned flush_dep_nchd; /* Number of flush dependency children */
+ unsigned
+ flush_dep_ndirty_chd; /* Number of dirty flush dependency children (including granchildren, etc.) */
+ hbool_t pinned_from_client; /* entry was pinned by client call */
+ hbool_t pinned_from_cache; /* entry was pinned by cache internally */
+ unsigned flush_order; /* Order that entry was flushed in */
+
+ unsigned notify_after_insert_count; /* Count of times that entry was inserted in cache */
+ unsigned notify_before_evict_count; /* Count of times that entry was removed in cache */
+ size_t actual_len; /* Simulate the entry's actual size for a speculative load */
+ unsigned max_verify_ct; /* Maximum # of times to verify an entry's checksum */
+ unsigned verify_ct; /* Count the # of checksum verification for an entry */
} test_entry_t;
/* The following are cut down test versions of the hash table manipulation
@@ -430,180 +411,148 @@ typedef struct test_entry_t
* updated as necessary.
*/
-#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3)
-
-#define H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
-if ( ( (cache_ptr) == NULL ) || \
- ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
- ( (cache_ptr)->index_size != \
- ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
- ( ! H5F_addr_defined(Addr) ) || \
- ( H5C__HASH_FCN(Addr) < 0 ) || \
- ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \
- HDfprintf(stdout, "Pre HT search SC failed.\n"); \
-}
-
-#define H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k) \
-if ( ( (cache_ptr) == NULL ) || \
- ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
- ( (cache_ptr)->index_len < 1 ) || \
- ( (entry_ptr) == NULL ) || \
- ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
- ( (cache_ptr)->index_size != \
- ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
- ( (entry_ptr)->size <= 0 ) || \
- ( ((cache_ptr)->index)[k] == NULL ) || \
- ( ( ((cache_ptr)->index)[k] != (entry_ptr) ) && \
- ( (entry_ptr)->ht_prev == NULL ) ) || \
- ( ( ((cache_ptr)->index)[k] == (entry_ptr) ) && \
- ( (entry_ptr)->ht_prev != NULL ) ) || \
- ( ( (entry_ptr)->ht_prev != NULL ) && \
- ( (entry_ptr)->ht_prev->ht_next != (entry_ptr) ) ) || \
- ( ( (entry_ptr)->ht_next != NULL ) && \
- ( (entry_ptr)->ht_next->ht_prev != (entry_ptr) ) ) ) { \
- HDfprintf(stdout, "Post successful HT search SC failed.\n"); \
-}
-
-#define H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
-if ( ( (cache_ptr) == NULL ) || \
- ( ((cache_ptr)->index)[k] != (entry_ptr) ) || \
- ( (entry_ptr)->ht_prev != NULL ) ) { \
- HDfprintf(stdout, "Post HT shift to front failed.\n"); \
-}
-
-#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
-{ \
- int k; \
- H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
- k = H5C__HASH_FCN(Addr); \
- entry_ptr = ((cache_ptr)->index)[k]; \
- while ( entry_ptr ) \
- { \
- if ( H5F_addr_eq(Addr, (entry_ptr)->addr) ) \
- { \
- H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k) \
- if ( entry_ptr != ((cache_ptr)->index)[k] ) \
- { \
- if ( (entry_ptr)->ht_next ) \
- (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
- HDassert( (entry_ptr)->ht_prev != NULL ); \
- (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
- ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \
- (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
- (entry_ptr)->ht_prev = NULL; \
- ((cache_ptr)->index)[k] = (entry_ptr); \
- H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
- } \
- break; \
- } \
- (entry_ptr) = (entry_ptr)->ht_next; \
- } \
-}
-
+#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3)
+
+#define H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
+ if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || \
+ ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
+ (!H5F_addr_defined(Addr)) || (H5C__HASH_FCN(Addr) < 0) || \
+ (H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN)) { \
+ HDfprintf(stdout, "Pre HT search SC failed.\n"); \
+ }
+
+#define H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k) \
+ if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || ((cache_ptr)->index_len < 1) || \
+ ((entry_ptr) == NULL) || ((cache_ptr)->index_size < (entry_ptr)->size) || \
+ ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
+ ((entry_ptr)->size <= 0) || (((cache_ptr)->index)[k] == NULL) || \
+ ((((cache_ptr)->index)[k] != (entry_ptr)) && ((entry_ptr)->ht_prev == NULL)) || \
+ ((((cache_ptr)->index)[k] == (entry_ptr)) && ((entry_ptr)->ht_prev != NULL)) || \
+ (((entry_ptr)->ht_prev != NULL) && ((entry_ptr)->ht_prev->ht_next != (entry_ptr))) || \
+ (((entry_ptr)->ht_next != NULL) && ((entry_ptr)->ht_next->ht_prev != (entry_ptr)))) { \
+ HDfprintf(stdout, "Post successful HT search SC failed.\n"); \
+ }
+
+#define H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
+ if (((cache_ptr) == NULL) || (((cache_ptr)->index)[k] != (entry_ptr)) || \
+ ((entry_ptr)->ht_prev != NULL)) { \
+ HDfprintf(stdout, "Post HT shift to front failed.\n"); \
+ }
+
+#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
+ { \
+ int k; \
+ H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
+ k = H5C__HASH_FCN(Addr); \
+ entry_ptr = ((cache_ptr)->index)[k]; \
+ while (entry_ptr) { \
+ if (H5F_addr_eq(Addr, (entry_ptr)->addr)) { \
+ H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k) \
+ if (entry_ptr != ((cache_ptr)->index)[k]) { \
+ if ((entry_ptr)->ht_next) \
+ (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
+ HDassert((entry_ptr)->ht_prev != NULL); \
+ (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
+ ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \
+ (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
+ (entry_ptr)->ht_prev = NULL; \
+ ((cache_ptr)->index)[k] = (entry_ptr); \
+ H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
+ } \
+ break; \
+ } \
+ (entry_ptr) = (entry_ptr)->ht_next; \
+ } \
+ }
/* Macros used in H5AC level tests */
-#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \
- ( ( (a).version == (b).version ) && \
- ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \
- ( (a).open_trace_file == (b).open_trace_file ) && \
- ( (a).close_trace_file == (b).close_trace_file ) && \
- ( ( (a).open_trace_file == FALSE ) || \
- ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \
- ( (a).evictions_enabled == (b).evictions_enabled ) && \
- ( ( ! cmp_set_init ) || \
- ( (a).set_initial_size == (b).set_initial_size ) ) && \
- ( ( ! cmp_init_size ) || \
- ( (a).initial_size == (b).initial_size ) ) && \
- ( H5_DBL_ABS_EQUAL((a).min_clean_fraction, (b).min_clean_fraction) ) && \
- ( (a).max_size == (b).max_size ) && \
- ( (a).min_size == (b).min_size ) && \
- ( (a).epoch_length == (b).epoch_length ) && \
- ( (a).incr_mode == (b).incr_mode ) && \
- ( H5_DBL_ABS_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold) ) && \
- ( H5_DBL_ABS_EQUAL((a).increment, (b).increment) ) && \
- ( (a).apply_max_increment == (b).apply_max_increment ) && \
- ( (a).max_increment == (b).max_increment ) && \
- ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
- ( H5_DBL_ABS_EQUAL((a).flash_multiple, (b).flash_multiple) ) && \
- ( H5_DBL_ABS_EQUAL((a).flash_threshold, (b).flash_threshold) ) && \
- ( (a).decr_mode == (b).decr_mode ) && \
- ( H5_DBL_ABS_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold) ) && \
- ( H5_DBL_ABS_EQUAL((a).decrement, (b).decrement) ) && \
- ( (a).apply_max_decrement == (b).apply_max_decrement ) && \
- ( (a).max_decrement == (b).max_decrement ) && \
- ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \
- ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \
- ( H5_DBL_ABS_EQUAL((a).empty_reserve, (b).empty_reserve) ) && \
- ( (a).dirty_bytes_threshold == (b).dirty_bytes_threshold ) && \
- ( (a).metadata_write_strategy == (b).metadata_write_strategy ) )
-
-#define XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \
-{ \
- (i).version = H5C__CURR_AUTO_SIZE_CTL_VER; \
- if ( (e).rpt_fcn_enabled ) \
- (i).rpt_fcn = H5C_def_auto_resize_rpt_fcn; \
- else \
- (i).rpt_fcn = NULL; \
- (i).set_initial_size = (e).set_initial_size; \
- (i).initial_size = (e).initial_size; \
- (i).min_clean_fraction = (e).min_clean_fraction; \
- (i).max_size = (e).max_size; \
- (i).min_size = (e).min_size; \
- (i).epoch_length = (long int)((e).epoch_length); \
- (i).incr_mode = (e).incr_mode; \
- (i).lower_hr_threshold = (e).lower_hr_threshold; \
- (i).increment = (e).increment; \
- (i).apply_max_increment = (e).apply_max_increment; \
- (i).max_increment = (e).max_increment; \
- (i).flash_incr_mode = (e).flash_incr_mode; \
- (i).flash_multiple = (e).flash_multiple; \
- (i).flash_threshold = (e).flash_threshold; \
- (i).decr_mode = (e).decr_mode; \
- (i).upper_hr_threshold = (e).upper_hr_threshold; \
- (i).decrement = (e).decrement; \
- (i).apply_max_decrement = (e).apply_max_decrement; \
- (i).max_decrement = (e).max_decrement; \
- (i).epochs_before_eviction = (int)((e).epochs_before_eviction); \
- (i).apply_empty_reserve = (e).apply_empty_reserve; \
- (i).empty_reserve = (e).empty_reserve; \
-}
-
+#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \
+ (((a).version == (b).version) && ((a).rpt_fcn_enabled == (b).rpt_fcn_enabled) && \
+ ((a).open_trace_file == (b).open_trace_file) && ((a).close_trace_file == (b).close_trace_file) && \
+ (((a).open_trace_file == FALSE) || (strcmp((a).trace_file_name, (b).trace_file_name) == 0)) && \
+ ((a).evictions_enabled == (b).evictions_enabled) && \
+ ((!cmp_set_init) || ((a).set_initial_size == (b).set_initial_size)) && \
+ ((!cmp_init_size) || ((a).initial_size == (b).initial_size)) && \
+ (H5_DBL_ABS_EQUAL((a).min_clean_fraction, (b).min_clean_fraction)) && ((a).max_size == (b).max_size) && \
+ ((a).min_size == (b).min_size) && ((a).epoch_length == (b).epoch_length) && \
+ ((a).incr_mode == (b).incr_mode) && \
+ (H5_DBL_ABS_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold)) && \
+ (H5_DBL_ABS_EQUAL((a).increment, (b).increment)) && \
+ ((a).apply_max_increment == (b).apply_max_increment) && ((a).max_increment == (b).max_increment) && \
+ ((a).flash_incr_mode == (b).flash_incr_mode) && \
+ (H5_DBL_ABS_EQUAL((a).flash_multiple, (b).flash_multiple)) && \
+ (H5_DBL_ABS_EQUAL((a).flash_threshold, (b).flash_threshold)) && ((a).decr_mode == (b).decr_mode) && \
+ (H5_DBL_ABS_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold)) && \
+ (H5_DBL_ABS_EQUAL((a).decrement, (b).decrement)) && \
+ ((a).apply_max_decrement == (b).apply_max_decrement) && ((a).max_decrement == (b).max_decrement) && \
+ ((a).epochs_before_eviction == (b).epochs_before_eviction) && \
+ ((a).apply_empty_reserve == (b).apply_empty_reserve) && \
+ (H5_DBL_ABS_EQUAL((a).empty_reserve, (b).empty_reserve)) && \
+ ((a).dirty_bytes_threshold == (b).dirty_bytes_threshold) && \
+ ((a).metadata_write_strategy == (b).metadata_write_strategy))
+
+#define XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \
+ { \
+ (i).version = H5C__CURR_AUTO_SIZE_CTL_VER; \
+ if ((e).rpt_fcn_enabled) \
+ (i).rpt_fcn = H5C_def_auto_resize_rpt_fcn; \
+ else \
+ (i).rpt_fcn = NULL; \
+ (i).set_initial_size = (e).set_initial_size; \
+ (i).initial_size = (e).initial_size; \
+ (i).min_clean_fraction = (e).min_clean_fraction; \
+ (i).max_size = (e).max_size; \
+ (i).min_size = (e).min_size; \
+ (i).epoch_length = (long int)((e).epoch_length); \
+ (i).incr_mode = (e).incr_mode; \
+ (i).lower_hr_threshold = (e).lower_hr_threshold; \
+ (i).increment = (e).increment; \
+ (i).apply_max_increment = (e).apply_max_increment; \
+ (i).max_increment = (e).max_increment; \
+ (i).flash_incr_mode = (e).flash_incr_mode; \
+ (i).flash_multiple = (e).flash_multiple; \
+ (i).flash_threshold = (e).flash_threshold; \
+ (i).decr_mode = (e).decr_mode; \
+ (i).upper_hr_threshold = (e).upper_hr_threshold; \
+ (i).decrement = (e).decrement; \
+ (i).apply_max_decrement = (e).apply_max_decrement; \
+ (i).max_decrement = (e).max_decrement; \
+ (i).epochs_before_eviction = (int)((e).epochs_before_eviction); \
+ (i).apply_empty_reserve = (e).apply_empty_reserve; \
+ (i).empty_reserve = (e).empty_reserve; \
+ }
/* misc type definitions */
-struct expected_entry_status
-{
- int entry_type;
- int entry_index;
- size_t size;
- hbool_t in_cache;
- hbool_t at_main_addr;
- hbool_t is_dirty;
- hbool_t is_protected;
- hbool_t is_pinned;
- hbool_t deserialized;
- hbool_t serialized;
- hbool_t destroyed;
- int flush_dep_par_type[MAX_FLUSH_DEP_PARS]; /* Entry types of flush dependency parents */
- int flush_dep_par_idx[MAX_FLUSH_DEP_PARS]; /* Indices of flush dependency parents */
- unsigned flush_dep_npar; /* Number of flush dependency parents */
- unsigned flush_dep_nchd; /* Number of flush dependency children */
- unsigned flush_dep_ndirty_chd; /* Number of dirty flush dependency children */
- int flush_order; /* flush order of entry */
- unsigned char is_corked; /* cork status of entry */
+struct expected_entry_status {
+ int entry_type;
+ int entry_index;
+ size_t size;
+ hbool_t in_cache;
+ hbool_t at_main_addr;
+ hbool_t is_dirty;
+ hbool_t is_protected;
+ hbool_t is_pinned;
+ hbool_t deserialized;
+ hbool_t serialized;
+ hbool_t destroyed;
+ int flush_dep_par_type[MAX_FLUSH_DEP_PARS]; /* Entry types of flush dependency parents */
+ int flush_dep_par_idx[MAX_FLUSH_DEP_PARS]; /* Indices of flush dependency parents */
+ unsigned flush_dep_npar; /* Number of flush dependency parents */
+ unsigned flush_dep_nchd; /* Number of flush dependency children */
+ unsigned flush_dep_ndirty_chd; /* Number of dirty flush dependency children */
+ int flush_order; /* flush order of entry */
+ unsigned char is_corked; /* cork status of entry */
};
-
-
-
/* global variable externs: */
-H5TEST_DLLVAR hbool_t pass; /* set to false on error */
+H5TEST_DLLVAR hbool_t pass; /* set to false on error */
H5TEST_DLLVAR const char *failure_mssg;
-H5TEST_DLLVAR test_entry_t * entries[NUMBER_OF_ENTRY_TYPES];
+H5TEST_DLLVAR test_entry_t *entries[NUMBER_OF_ENTRY_TYPES];
H5TEST_DLLVAR const int32_t max_indices[NUMBER_OF_ENTRY_TYPES];
-H5TEST_DLLVAR const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES];
+H5TEST_DLLVAR const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES];
H5TEST_DLLVAR const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES];
H5TEST_DLLVAR const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES];
@@ -611,74 +560,42 @@ H5TEST_DLLVAR const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES];
H5TEST_DLLVAR const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES];
-
#ifdef __cplusplus
extern "C" {
#endif
/* function declarations: */
-H5TEST_DLL void add_flush_op(int target_type,
- int target_idx,
- int op_code,
- int type,
- int idx,
- hbool_t flag,
- size_t size,
- unsigned * order);
+H5TEST_DLL void add_flush_op(int target_type, int target_idx, int op_code, int type, int idx, hbool_t flag,
+ size_t size, unsigned *order);
-
-H5TEST_DLL void addr_to_type_and_index(haddr_t addr,
- int32_t * type_ptr,
- int32_t * index_ptr);
+H5TEST_DLL void addr_to_type_and_index(haddr_t addr, int32_t *type_ptr, int32_t *index_ptr);
#if 0 /* keep this for a while -- it may be useful */
H5TEST_DLL haddr_t type_and_index_to_addr(int32_t type,
int32_t idx);
#endif
-H5TEST_DLL void dirty_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- hbool_t dirty_pin);
+H5TEST_DLL void dirty_entry(H5F_t *file_ptr, int32_t type, int32_t idx, hbool_t dirty_pin);
-H5TEST_DLL void expunge_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx);
+H5TEST_DLL void expunge_entry(H5F_t *file_ptr, int32_t type, int32_t idx);
-H5TEST_DLL void insert_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- unsigned int flags);
+H5TEST_DLL void insert_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags);
-H5TEST_DLL void mark_entry_dirty(int32_t type,
- int32_t idx);
+H5TEST_DLL void mark_entry_dirty(int32_t type, int32_t idx);
-H5TEST_DLL void move_entry(H5C_t * cache_ptr,
- int32_t type,
- int32_t idx,
- hbool_t main_addr);
+H5TEST_DLL void move_entry(H5C_t *cache_ptr, int32_t type, int32_t idx, hbool_t main_addr);
-H5TEST_DLL void protect_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx);
+H5TEST_DLL void protect_entry(H5F_t *file_ptr, int32_t type, int32_t idx);
-H5TEST_DLL void protect_entry_ro(H5F_t * file_ptr,
- int32_t type,
- int32_t idx);
+H5TEST_DLL void protect_entry_ro(H5F_t *file_ptr, int32_t type, int32_t idx);
-H5TEST_DLL void pin_entry(int32_t type,
- int32_t idx);
+H5TEST_DLL void pin_entry(int32_t type, int32_t idx);
-H5TEST_DLL hbool_t entry_in_cache(H5C_t * cache_ptr,
- int32_t type,
- int32_t idx);
+H5TEST_DLL hbool_t entry_in_cache(H5C_t *cache_ptr, int32_t type, int32_t idx);
-H5TEST_DLL void create_pinned_entry_dependency(H5F_t * file_ptr,
- int pinning_type,
- int pinning_idx,
- int pinned_type,
- int pinned_idx);
+H5TEST_DLL void create_pinned_entry_dependency(H5F_t *file_ptr, int pinning_type, int pinning_idx,
+ int pinned_type, int pinned_idx);
H5TEST_DLL herr_t create_entry_arrays(void);
@@ -686,154 +603,87 @@ H5TEST_DLL void free_entry_arrays(void);
H5TEST_DLL void reset_entries(void);
-H5TEST_DLL void cork_entry_type(H5F_t * file_ptr, int32_t type);
-
-H5TEST_DLL void uncork_entry_type(H5F_t * file_ptr, int32_t type);
-
-H5TEST_DLL void resize_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- size_t new_size,
- hbool_t in_cache);
-
-H5TEST_DLL void row_major_scan_forward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- hbool_t do_moves,
- hbool_t move_to_main_addr,
- hbool_t do_destroys,
- hbool_t do_mult_ro_protects,
- int dirty_destroys,
- int dirty_unprotects);
-
-H5TEST_DLL void hl_row_major_scan_forward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts);
-
-H5TEST_DLL void row_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- hbool_t do_moves,
- hbool_t move_to_main_addr,
- hbool_t do_destroys,
- hbool_t do_mult_ro_protects,
- int dirty_destroys,
- int dirty_unprotects);
-
-H5TEST_DLL void hl_row_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts);
-
-H5TEST_DLL void col_major_scan_forward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- int dirty_unprotects);
-
-H5TEST_DLL void hl_col_major_scan_forward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- int dirty_unprotects);
-
-H5TEST_DLL void col_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- int dirty_unprotects);
-
-H5TEST_DLL void hl_col_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- int dirty_unprotects);
-
-H5TEST_DLL void flush_cache(H5F_t * file_ptr,
- hbool_t destroy_entries,
- hbool_t dump_stats,
- hbool_t dump_detailed_stats);
-
-H5TEST_DLL void unpin_entry(int32_t type,
- int32_t idx);
-
-H5TEST_DLL void unprotect_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- unsigned int flags);
+H5TEST_DLL void cork_entry_type(H5F_t *file_ptr, int32_t type);
+
+H5TEST_DLL void uncork_entry_type(H5F_t *file_ptr, int32_t type);
+
+H5TEST_DLL void resize_entry(H5F_t *file_ptr, int32_t type, int32_t idx, size_t new_size, hbool_t in_cache);
+
+H5TEST_DLL void row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t verbose,
+ hbool_t reset_stats, hbool_t display_stats,
+ hbool_t display_detailed_stats, hbool_t do_inserts, hbool_t do_moves,
+ hbool_t move_to_main_addr, hbool_t do_destroys,
+ hbool_t do_mult_ro_protects, int dirty_destroys, int dirty_unprotects);
+
+H5TEST_DLL void hl_row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose,
+ hbool_t reset_stats, hbool_t display_stats,
+ hbool_t display_detailed_stats, hbool_t do_inserts);
+
+H5TEST_DLL void row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t verbose,
+ hbool_t reset_stats, hbool_t display_stats,
+ hbool_t display_detailed_stats, hbool_t do_inserts, hbool_t do_moves,
+ hbool_t move_to_main_addr, hbool_t do_destroys,
+ hbool_t do_mult_ro_protects, int dirty_destroys,
+ int dirty_unprotects);
+
+H5TEST_DLL void hl_row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose,
+ hbool_t reset_stats, hbool_t display_stats,
+ hbool_t display_detailed_stats, hbool_t do_inserts);
+
+H5TEST_DLL void col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t verbose,
+ hbool_t reset_stats, hbool_t display_stats,
+ hbool_t display_detailed_stats, hbool_t do_inserts,
+ int dirty_unprotects);
+
+H5TEST_DLL void hl_col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose,
+ hbool_t reset_stats, hbool_t display_stats,
+ hbool_t display_detailed_stats, hbool_t do_inserts,
+ int dirty_unprotects);
+
+H5TEST_DLL void col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t verbose,
+ hbool_t reset_stats, hbool_t display_stats,
+ hbool_t display_detailed_stats, hbool_t do_inserts,
+ int dirty_unprotects);
+
+H5TEST_DLL void hl_col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose,
+ hbool_t reset_stats, hbool_t display_stats,
+ hbool_t display_detailed_stats, hbool_t do_inserts,
+ int dirty_unprotects);
+
+H5TEST_DLL void flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats,
+ hbool_t dump_detailed_stats);
+
+H5TEST_DLL void unpin_entry(int32_t type, int32_t idx);
+
+H5TEST_DLL void unprotect_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags);
H5TEST_DLL void verify_clean(void);
-H5TEST_DLL void verify_entry_status(H5C_t * cache_ptr,
- int tag,
- int num_entries,
- struct expected_entry_status expected[]);
+H5TEST_DLL void verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries,
+ struct expected_entry_status expected[]);
H5TEST_DLL void verify_unprotected(void);
-H5TEST_DLL void create_flush_dependency(int32_t parent_type,
- int32_t parent_idx,
- int32_t child_type,
- int32_t child_idx);
+H5TEST_DLL void create_flush_dependency(int32_t parent_type, int32_t parent_idx, int32_t child_type,
+ int32_t child_idx);
-H5TEST_DLL void destroy_flush_dependency(int32_t parent_type,
- int32_t parent_idx,
- int32_t child_type,
- int32_t child_idx);
+H5TEST_DLL void destroy_flush_dependency(int32_t parent_type, int32_t parent_idx, int32_t child_type,
+ int32_t child_idx);
/*** H5AC level utility functions ***/
-H5TEST_DLL hbool_t resize_configs_are_equal(const H5C_auto_size_ctl_t *a,
- const H5C_auto_size_ctl_t *b, hbool_t compare_init);
+H5TEST_DLL hbool_t resize_configs_are_equal(const H5C_auto_size_ctl_t *a, const H5C_auto_size_ctl_t *b,
+ hbool_t compare_init);
-H5TEST_DLL void check_and_validate_cache_hit_rate(hid_t file_id,
- double * hit_rate_ptr,
- hbool_t dump_data,
- int64_t min_accesses,
- double min_hit_rate);
+H5TEST_DLL void check_and_validate_cache_hit_rate(hid_t file_id, double *hit_rate_ptr, hbool_t dump_data,
+ int64_t min_accesses, double min_hit_rate);
-H5TEST_DLL void check_and_validate_cache_size(hid_t file_id,
- size_t * max_size_ptr,
- size_t * min_clean_size_ptr,
- size_t * cur_size_ptr,
- int32_t * cur_num_entries_ptr,
- hbool_t dump_data);
+H5TEST_DLL void check_and_validate_cache_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+ size_t *cur_size_ptr, int32_t *cur_num_entries_ptr,
+ hbool_t dump_data);
-H5TEST_DLL void validate_mdc_config(hid_t file_id,
- H5AC_cache_config_t * ext_config_ptr,
- hbool_t compare_init,
- int test_num);
+H5TEST_DLL void validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t compare_init,
+ int test_num);
/** Debugging functions -- normally commented out ***/
#if 0
@@ -845,4 +695,3 @@ H5TEST_DLL void dump_LRU(H5F_t * file_ptr);
#endif
#endif /* _CACHE_COMMON_H */
-
diff --git a/test/cache_image.c b/test/cache_image.c
index 9f8c4c5..cdfe7b3 100644
--- a/test/cache_image.c
+++ b/test/cache_image.c
@@ -22,21 +22,17 @@
/* global variable declarations: */
-
-const char *FILENAMES[] = {
- "cache_image_test",
- NULL
-};
+const char *FILENAMES[] = {"cache_image_test", NULL};
/* local utility function declarations */
static void create_datasets(hid_t file_id, int min_dset, int max_dset);
static void delete_datasets(hid_t file_id, int min_dset, int max_dset);
-static void open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
- hbool_t read_only, hbool_t set_mdci_fapl, hbool_t config_fsm,
- hbool_t set_eoc, const char *hdf_file_name, unsigned cache_image_flags,
- hid_t *file_id_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr);
-static void attempt_swmr_open_hdf5_file(hbool_t create_file,
- hbool_t set_mdci_fapl, const char *hdf_file_name);
+static void open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, hbool_t read_only,
+ hbool_t set_mdci_fapl, hbool_t config_fsm, hbool_t set_eoc,
+ const char *hdf_file_name, unsigned cache_image_flags, hid_t *file_id_ptr,
+ H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr);
+static void attempt_swmr_open_hdf5_file(hbool_t create_file, hbool_t set_mdci_fapl,
+ const char *hdf_file_name);
static void verify_datasets(hid_t file_id, int min_dset, int max_dset);
/* local test function declarations */
@@ -62,7 +58,6 @@ static unsigned cache_image_api_error_check_4(hbool_t single_file_vfd);
static unsigned get_free_sections_test(hbool_t single_file_vfd);
static unsigned evict_on_close_test(hbool_t single_file_vfd);
-
/****************************************************************************/
/***************************** Utility Functions ****************************/
/****************************************************************************/
@@ -89,33 +84,34 @@ static unsigned evict_on_close_test(hbool_t single_file_vfd);
*-------------------------------------------------------------------------
*/
-#define CHUNK_SIZE 10
-#define DSET_SIZE (40 * CHUNK_SIZE)
-#define MAX_NUM_DSETS 256
+#define CHUNK_SIZE 10
+#define DSET_SIZE (40 * CHUNK_SIZE)
+#define MAX_NUM_DSETS 256
static void
create_datasets(hid_t file_id, int min_dset, int max_dset)
{
- const char * fcn_name = "create_datasets()";
- char dset_name[64];
- hbool_t show_progress = FALSE;
- hbool_t valid_chunk;
- hbool_t verbose = FALSE;
- int cp = 0;
- int i, j, k, l, m;
- int data_chunk[CHUNK_SIZE][CHUNK_SIZE];
- herr_t status;
- hid_t dataspace_id = -1;
- hid_t filespace_ids[MAX_NUM_DSETS];
- hid_t memspace_id = -1;
- hid_t dataset_ids[MAX_NUM_DSETS];
- hid_t properties = -1;
- hsize_t dims[2];
- hsize_t a_size[2];
- hsize_t offset[2];
- hsize_t chunk_size[2];
-
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ const char *fcn_name = "create_datasets()";
+ char dset_name[64];
+ hbool_t show_progress = FALSE;
+ hbool_t valid_chunk;
+ hbool_t verbose = FALSE;
+ int cp = 0;
+ int i, j, k, l, m;
+ int data_chunk[CHUNK_SIZE][CHUNK_SIZE];
+ herr_t status;
+ hid_t dataspace_id = -1;
+ hid_t filespace_ids[MAX_NUM_DSETS];
+ hid_t memspace_id = -1;
+ hid_t dataset_ids[MAX_NUM_DSETS];
+ hid_t properties = -1;
+ hsize_t dims[2];
+ hsize_t a_size[2];
+ hsize_t offset[2];
+ hsize_t chunk_size[2];
+
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
HDassert(0 <= min_dset);
HDassert(min_dset <= max_dset);
@@ -123,20 +119,19 @@ create_datasets(hid_t file_id, int min_dset, int max_dset)
/* create the datasets */
- if ( pass ) {
+ if (pass) {
i = min_dset;
- while ( ( pass ) && ( i <= max_dset ) )
- {
+ while ((pass) && (i <= max_dset)) {
/* create a dataspace for the chunked dataset */
- dims[0] = DSET_SIZE;
- dims[1] = DSET_SIZE;
+ dims[0] = DSET_SIZE;
+ dims[1] = DSET_SIZE;
dataspace_id = H5Screate_simple(2, dims, NULL);
- if ( dataspace_id < 0 ) {
+ if (dataspace_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Screate_simple() failed.";
}
@@ -144,51 +139,50 @@ create_datasets(hid_t file_id, int min_dset, int max_dset)
* to be partioned into 10X10 element chunks.
*/
- if ( pass ) {
+ if (pass) {
chunk_size[0] = CHUNK_SIZE;
chunk_size[1] = CHUNK_SIZE;
- properties = H5Pcreate(H5P_DATASET_CREATE);
+ properties = H5Pcreate(H5P_DATASET_CREATE);
- if ( properties < 0 ) {
+ if (properties < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pcreate() failed.";
}
}
- if ( pass ) {
+ if (pass) {
- if ( H5Pset_chunk(properties, 2, chunk_size) < 0 ) {
+ if (H5Pset_chunk(properties, 2, chunk_size) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_chunk() failed.";
}
}
/* create the dataset */
- if ( pass ) {
+ if (pass) {
HDsprintf(dset_name, "/dset%03d", i);
- dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE,
- dataspace_id, H5P_DEFAULT,
+ dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT,
properties, H5P_DEFAULT);
- if ( dataset_ids[i] < 0 ) {
+ if (dataset_ids[i] < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dcreate() failed.";
}
}
/* get the file space ID */
- if ( pass ) {
+ if (pass) {
filespace_ids[i] = H5Dget_space(dataset_ids[i]);
- if ( filespace_ids[i] < 0 ) {
+ if (filespace_ids[i] < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dget_space() failed.";
}
}
@@ -197,84 +191,79 @@ create_datasets(hid_t file_id, int min_dset, int max_dset)
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* create the mem space to be used to read and write chunks */
- if ( pass ) {
+ if (pass) {
- dims[0] = CHUNK_SIZE;
- dims[1] = CHUNK_SIZE;
+ dims[0] = CHUNK_SIZE;
+ dims[1] = CHUNK_SIZE;
memspace_id = H5Screate_simple(2, dims, NULL);
- if ( memspace_id < 0 ) {
+ if (memspace_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Screate_simple() failed.";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* select in memory hyperslab */
- if ( pass ) {
+ if (pass) {
- offset[0] = 0; /*offset of hyperslab in memory*/
+ offset[0] = 0; /*offset of hyperslab in memory*/
offset[1] = 0;
- a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
+ a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
a_size[1] = CHUNK_SIZE;
- status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL,
- a_size, NULL);
+ status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL, a_size, NULL);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sselect_hyperslab() failed.";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* initialize all datasets on a round robin basis */
i = 0;
- while ( ( pass ) && ( i < DSET_SIZE ) )
- {
+ while ((pass) && (i < DSET_SIZE)) {
j = 0;
- while ( ( pass ) && ( j < DSET_SIZE ) )
- {
+ while ((pass) && (j < DSET_SIZE)) {
m = min_dset;
- while ( ( pass ) && ( m <= max_dset ) )
- {
+ while ((pass) && (m <= max_dset)) {
/* initialize the slab */
- for ( k = 0; k < CHUNK_SIZE; k++ )
- {
- for ( l = 0; l < CHUNK_SIZE; l++ )
- {
- data_chunk[k][l] = (DSET_SIZE * DSET_SIZE * m) +
- (DSET_SIZE * (i + k)) + j + l;
+ for (k = 0; k < CHUNK_SIZE; k++) {
+ for (l = 0; l < CHUNK_SIZE; l++) {
+ data_chunk[k][l] = (DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l;
}
}
/* select on disk hyperslab */
offset[0] = (hsize_t)i; /*offset of hyperslab in file*/
offset[1] = (hsize_t)j;
- a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
+ a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
a_size[1] = CHUNK_SIZE;
- status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET,
- offset, NULL, a_size, NULL);
+ status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "disk H5Sselect_hyperslab() failed.";
}
/* write the chunk to file */
- status = H5Dwrite(dataset_ids[m], H5T_NATIVE_INT, memspace_id,
- filespace_ids[m], H5P_DEFAULT, data_chunk);
+ status = H5Dwrite(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m], H5P_DEFAULT,
+ data_chunk);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dwrite() failed.";
}
m++;
@@ -285,88 +274,75 @@ create_datasets(hid_t file_id, int min_dset, int max_dset)
i += CHUNK_SIZE;
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* read data from datasets and validate it */
i = 0;
- while ( ( pass ) && ( i < DSET_SIZE ) )
- {
+ while ((pass) && (i < DSET_SIZE)) {
j = 0;
- while ( ( pass ) && ( j < DSET_SIZE ) )
- {
+ while ((pass) && (j < DSET_SIZE)) {
m = min_dset;
- while ( ( pass ) && ( m <= max_dset ) )
- {
+ while ((pass) && (m <= max_dset)) {
/* select on disk hyperslab */
offset[0] = (hsize_t)i; /* offset of hyperslab in file */
offset[1] = (hsize_t)j;
a_size[0] = CHUNK_SIZE; /* size of hyperslab */
a_size[1] = CHUNK_SIZE;
- status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET,
- offset, NULL, a_size, NULL);
+ status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
- failure_mssg = "disk hyperslab create failed.";
+ pass = FALSE;
+ failure_mssg = "disk hyperslab create failed.";
}
/* read the chunk from file */
- if ( pass ) {
+ if (pass) {
- status = H5Dread(dataset_ids[m], H5T_NATIVE_INT,
- memspace_id, filespace_ids[m],
+ status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m],
H5P_DEFAULT, data_chunk);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
- failure_mssg = "disk hyperslab create failed.";
+ pass = FALSE;
+ failure_mssg = "disk hyperslab create failed.";
}
}
/* validate the slab */
- if ( pass ) {
+ if (pass) {
valid_chunk = TRUE;
- for ( k = 0; k < CHUNK_SIZE; k++ )
- {
- for ( l = 0; l < CHUNK_SIZE; l++ )
- {
- if ( data_chunk[k][l]
- !=
- ((DSET_SIZE * DSET_SIZE * m) +
- (DSET_SIZE * (i + k)) + j + l) ) {
+ for (k = 0; k < CHUNK_SIZE; k++) {
+ for (l = 0; l < CHUNK_SIZE; l++) {
+ if (data_chunk[k][l] !=
+ ((DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l)) {
valid_chunk = FALSE;
- if ( verbose ) {
+ if (verbose) {
- HDfprintf(stdout,
- "data_chunk[%0d][%0d] = %0d, expect %0d.\n",
- k, l, data_chunk[k][l],
- ((DSET_SIZE * DSET_SIZE * m) +
- (DSET_SIZE * (i + k)) + j + l));
- HDfprintf(stdout,
- "m = %d, i = %d, j = %d, k = %d, l = %d\n",
- m, i, j, k, l);
- }
+ HDfprintf(stdout, "data_chunk[%0d][%0d] = %0d, expect %0d.\n", k, l,
+ data_chunk[k][l],
+ ((DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l));
+ HDfprintf(stdout, "m = %d, i = %d, j = %d, k = %d, l = %d\n", m, i, j, k,
+ l);
+ }
}
}
}
- if ( ! valid_chunk ) {
+ if (!valid_chunk) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "slab validation failed.";
- if ( verbose ) {
+ if (verbose) {
- HDfprintf(stdout,
- "Chunk (%0d, %0d) in /dset%03d is invalid.\n",
- i, j, m);
- }
+ HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m);
+ }
}
}
m++;
@@ -376,39 +352,37 @@ create_datasets(hid_t file_id, int min_dset, int max_dset)
i += CHUNK_SIZE;
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* close the file spaces */
i = min_dset;
- while ( ( pass ) && ( i <= max_dset ) )
- {
- if ( H5Sclose(filespace_ids[i]) < 0 ) {
+ while ((pass) && (i <= max_dset)) {
+ if (H5Sclose(filespace_ids[i]) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sclose() failed.";
}
i++;
}
-
/* close the datasets */
i = min_dset;
- while ( ( pass ) && ( i <= max_dset ) )
- {
- if ( H5Dclose(dataset_ids[i]) < 0 ) {
+ while ((pass) && (i <= max_dset)) {
+ if (H5Dclose(dataset_ids[i]) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dclose() failed.";
}
i++;
}
/* close the mem space */
- if ( pass ) {
+ if (pass) {
- if ( H5Sclose(memspace_id) < 0 ) {
+ if (H5Sclose(memspace_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sclose(memspace_id) failed.";
}
}
@@ -417,7 +391,6 @@ create_datasets(hid_t file_id, int min_dset, int max_dset)
} /* create_datasets() */
-
/*-------------------------------------------------------------------------
* Function: delete_datasets()
*
@@ -444,51 +417,53 @@ create_datasets(hid_t file_id, int min_dset, int max_dset)
static void
delete_datasets(hid_t file_id, int min_dset, int max_dset)
{
- const char * fcn_name = "delete_datasets()";
- char dset_name[64];
- hbool_t show_progress = FALSE;
- int cp = 0;
- int i;
+ const char *fcn_name = "delete_datasets()";
+ char dset_name[64];
+ hbool_t show_progress = FALSE;
+ int cp = 0;
+ int i;
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
HDassert(0 <= min_dset);
HDassert(min_dset <= max_dset);
HDassert(max_dset < MAX_NUM_DSETS);
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* first, verify the contents of the target dataset(s) */
verify_datasets(file_id, min_dset, max_dset);
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* now delete the target datasets */
- if ( pass ) {
+ if (pass) {
i = min_dset;
- while ( ( pass ) && ( i <= max_dset ) )
- {
+ while ((pass) && (i <= max_dset)) {
HDsprintf(dset_name, "/dset%03d", i);
- if ( H5Ldelete(file_id, dset_name, H5P_DEFAULT) < 0) {
+ if (H5Ldelete(file_id, dset_name, H5P_DEFAULT) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Ldelete() failed.";
- }
+ }
i++;
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
return;
} /* delete_datasets() */
-
/*-------------------------------------------------------------------------
* Function: open_hdf5_file()
*
@@ -532,179 +507,169 @@ delete_datasets(hid_t file_id, int min_dset, int max_dset)
*/
static void
-open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
- hbool_t read_only, hbool_t set_mdci_fapl, hbool_t config_fsm,
- hbool_t set_eoc, const char *hdf_file_name, unsigned cache_image_flags,
- hid_t *file_id_ptr, H5F_t ** file_ptr_ptr, H5C_t ** cache_ptr_ptr)
+open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, hbool_t read_only, hbool_t set_mdci_fapl,
+ hbool_t config_fsm, hbool_t set_eoc, const char *hdf_file_name, unsigned cache_image_flags,
+ hid_t *file_id_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr)
{
- const char * fcn_name = "open_hdf5_file()";
- hbool_t show_progress = FALSE;
- hbool_t verbose = FALSE;
- int cp = 0;
- hid_t fapl_id = -1;
- hid_t fcpl_id = -1;
- hid_t file_id = -1;
- herr_t result;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5C_cache_image_ctl_t image_ctl;
- H5AC_cache_image_config_t cache_image_config = {
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
- TRUE,
- FALSE,
- H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
-
- if ( pass )
- {
- /* opening the file both read only and with a cache image
+ const char * fcn_name = "open_hdf5_file()";
+ hbool_t show_progress = FALSE;
+ hbool_t verbose = FALSE;
+ int cp = 0;
+ hid_t fapl_id = -1;
+ hid_t fcpl_id = -1;
+ hid_t file_id = -1;
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5C_cache_image_ctl_t image_ctl;
+ H5AC_cache_image_config_t cache_image_config = {H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, TRUE, FALSE,
+ H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
+
+ if (pass) {
+ /* opening the file both read only and with a cache image
* requested is a contradiction. We resolve it by ignoring
* the cache image request silently.
*/
- if ( ( create_file && mdci_sbem_expected ) ||
- ( create_file && read_only ) ||
- ( config_fsm && !create_file ) ||
- ( hdf_file_name == NULL ) ||
- ( ( set_mdci_fapl ) && ( cache_image_flags == 0 ) ) ||
- ( ( set_mdci_fapl ) &&
- ( (cache_image_flags & ~H5C_CI__ALL_FLAGS) != 0 ) ) ||
- ( file_id_ptr == NULL ) ||
- ( file_ptr_ptr == NULL ) ||
- ( cache_ptr_ptr == NULL ) ) {
+ if ((create_file && mdci_sbem_expected) || (create_file && read_only) ||
+ (config_fsm && !create_file) || (hdf_file_name == NULL) ||
+ ((set_mdci_fapl) && (cache_image_flags == 0)) ||
+ ((set_mdci_fapl) && ((cache_image_flags & ~H5C_CI__ALL_FLAGS) != 0)) || (file_id_ptr == NULL) ||
+ (file_ptr_ptr == NULL) || (cache_ptr_ptr == NULL)) {
- failure_mssg =
- "Bad param(s) on entry to open_hdf5_file().\n";
- pass = FALSE;
- } else if ( verbose ) {
+ failure_mssg = "Bad param(s) on entry to open_hdf5_file().\n";
+ pass = FALSE;
+ }
+ else if (verbose) {
- HDfprintf(stdout, "%s: HDF file name = \"%s\".\n",
- fcn_name, hdf_file_name);
+ HDfprintf(stdout, "%s: HDF file name = \"%s\".\n", fcn_name, hdf_file_name);
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* create a file access propertly list. */
- if ( pass ) {
+ if (pass) {
fapl_id = h5_fileaccess();
- if ( fapl_id < 0 ) {
+ if (fapl_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fileaccess() failed.\n";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* call H5Pset_libver_bounds() on the fapl_id */
- if ( pass ) {
+ if (pass) {
- if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST,
- H5F_LIBVER_LATEST) < 0 ) {
+ if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_libver_bounds() failed.\n";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* get metadata cache image config -- verify that it is the default */
- if ( pass ) {
+ if (pass) {
result = H5Pget_mdc_image_config(fapl_id, &cache_image_config);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pget_mdc_image_config() failed.\n";
}
- if ( ( cache_image_config.version !=
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) ||
- ( cache_image_config.generate_image != FALSE ) ||
- ( cache_image_config.save_resize_status != FALSE ) ||
- ( cache_image_config.entry_ageout !=
- H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) ) {
+ if ((cache_image_config.version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) ||
+ (cache_image_config.generate_image != FALSE) ||
+ (cache_image_config.save_resize_status != FALSE) ||
+ (cache_image_config.entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected default cache image config.\n";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* set metadata cache image fapl entry if indicated */
- if ( ( pass ) && ( set_mdci_fapl ) ) {
+ if ((pass) && (set_mdci_fapl)) {
/* set cache image config fields to taste */
- cache_image_config.generate_image = TRUE;
+ cache_image_config.generate_image = TRUE;
cache_image_config.save_resize_status = FALSE;
- cache_image_config.entry_ageout = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE;
+ cache_image_config.entry_ageout = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE;
result = H5Pset_mdc_image_config(fapl_id, &cache_image_config);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_mdc_image_config() failed.\n";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* setup the persistent free space manager if indicated */
- if ( ( pass ) && ( config_fsm ) ) {
+ if ((pass) && (config_fsm)) {
- fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
- if ( fcpl_id <= 0 ) {
+ if (fcpl_id <= 0) {
- pass = FALSE;
- failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.";
- }
+ pass = FALSE;
+ failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.";
+ }
}
- if ( ( pass ) && ( config_fsm ) ) {
- if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE,
- TRUE, (hsize_t)1) < 0) {
- pass = FALSE;
+ if ((pass) && (config_fsm)) {
+ if (H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0) {
+ pass = FALSE;
failure_mssg = "H5Pset_file_space_strategy() failed.";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* set evict on close if indicated */
- if ( ( pass ) && ( set_eoc ) ) {
+ if ((pass) && (set_eoc)) {
- if ( H5Pset_evict_on_close(fapl_id, TRUE) < 0 ) {
+ if (H5Pset_evict_on_close(fapl_id, TRUE) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_evict_on_close() failed.";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* open the file */
- if ( pass ) {
-
- if ( create_file ) {
+ if (pass) {
- if ( fcpl_id != -1 )
+ if (create_file) {
- file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC,
- fcpl_id, fapl_id);
- else
+ if (fcpl_id != -1)
- file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC,
- H5P_DEFAULT, fapl_id);
+ file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ else
- } else {
+ file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ }
+ else {
- if ( read_only )
+ if (read_only)
file_id = H5Fopen(hdf_file_name, H5F_ACC_RDONLY, fapl_id);
@@ -716,46 +681,48 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
/* tidy up */
H5Pclose(fapl_id);
- if ( file_id < 0 ) {
+ if (file_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fcreate() or H5Fopen() failed.\n";
-
- } else {
+ }
+ else {
file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't get file_ptr.";
- if ( verbose ) {
+ if (verbose) {
HDfprintf(stdout, "%s: Can't get file_ptr.\n", fcn_name);
}
}
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* get a pointer to the files internal data structure and then
* to the cache structure
*/
- if ( pass ) {
+ if (pass) {
- if ( file_ptr->shared->cache == NULL ) {
+ if (file_ptr->shared->cache == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "can't get cache pointer(1).\n";
-
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* verify expected metadata cache status */
@@ -764,134 +731,129 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
*
* Then set the flags in this structure to the specified value.
*/
- if ( pass ) {
+ if (pass) {
- if ( H5C_get_cache_image_config(cache_ptr, &image_ctl) < 0 ) {
+ if (H5C_get_cache_image_config(cache_ptr, &image_ctl) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error returned by H5C_get_cache_image_config().";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
- if ( pass ) {
+ if (pass) {
- if ( set_mdci_fapl ) {
+ if (set_mdci_fapl) {
- if ( read_only ) {
+ if (read_only) {
- if ( ( image_ctl.version !=
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) ||
- ( image_ctl.generate_image != FALSE ) ||
- ( image_ctl.save_resize_status != FALSE ) ||
- ( image_ctl.entry_ageout !=
- H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) ||
- ( image_ctl.flags != H5C_CI__ALL_FLAGS ) ) {
+ if ((image_ctl.version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) ||
+ (image_ctl.generate_image != FALSE) || (image_ctl.save_resize_status != FALSE) ||
+ (image_ctl.entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE) ||
+ (image_ctl.flags != H5C_CI__ALL_FLAGS)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected image_ctl values(1).\n";
}
- } else {
+ }
+ else {
- if ( ( image_ctl.version !=
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) ||
- ( image_ctl.generate_image != TRUE ) ||
- ( image_ctl.save_resize_status != FALSE ) ||
- ( image_ctl.entry_ageout !=
- H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) ||
- ( image_ctl.flags != H5C_CI__ALL_FLAGS ) ) {
+ if ((image_ctl.version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) ||
+ (image_ctl.generate_image != TRUE) || (image_ctl.save_resize_status != FALSE) ||
+ (image_ctl.entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE) ||
+ (image_ctl.flags != H5C_CI__ALL_FLAGS)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected image_ctl values(2).\n";
}
}
- } else {
+ }
+ else {
- if ( ( image_ctl.version !=
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) ||
- ( image_ctl.generate_image != FALSE ) ||
- ( image_ctl.save_resize_status != FALSE ) ||
- ( image_ctl.entry_ageout !=
- H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) ||
- ( image_ctl.flags != H5C_CI__ALL_FLAGS ) ) {
+ if ((image_ctl.version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) ||
+ (image_ctl.generate_image != FALSE) || (image_ctl.save_resize_status != FALSE) ||
+ (image_ctl.entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE) ||
+ (image_ctl.flags != H5C_CI__ALL_FLAGS)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected image_ctl values(3).\n";
}
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
- if ( ( pass ) && ( set_mdci_fapl ) ) {
+ if ((pass) && (set_mdci_fapl)) {
image_ctl.flags = cache_image_flags;
- if ( H5C_set_cache_image_config(file_ptr, cache_ptr, &image_ctl) < 0 ) {
+ if (H5C_set_cache_image_config(file_ptr, cache_ptr, &image_ctl) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "error returned by H5C_set_cache_image_config().";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->close_warning_received == TRUE ) {
+ if (cache_ptr->close_warning_received == TRUE) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Unexpected value of close_warning_received.\n";
}
- if ( mdci_sbem_expected ) {
+ if (mdci_sbem_expected) {
- if ( read_only ) {
+ if (read_only) {
- if ( ( cache_ptr->load_image != TRUE ) ||
- ( cache_ptr->delete_image != FALSE ) ) {
+ if ((cache_ptr->load_image != TRUE) || (cache_ptr->delete_image != FALSE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "mdci sb extension message not present?\n";
}
- } else {
+ }
+ else {
- if ( ( cache_ptr->load_image != TRUE ) ||
- ( cache_ptr->delete_image != TRUE ) ) {
+ if ((cache_ptr->load_image != TRUE) || (cache_ptr->delete_image != TRUE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "mdci sb extension message not present?\n";
}
+ }
}
- } else {
+ else {
- if ( ( cache_ptr->load_image == TRUE ) ||
- ( cache_ptr->delete_image == TRUE ) ) {
+ if ((cache_ptr->load_image == TRUE) || (cache_ptr->delete_image == TRUE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "mdci sb extension message present?\n";
- }
+ }
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
- if ( pass ) {
+ if (pass) {
- *file_id_ptr = file_id;
- *file_ptr_ptr = file_ptr;
+ *file_id_ptr = file_id;
+ *file_ptr_ptr = file_ptr;
*cache_ptr_ptr = cache_ptr;
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d -- exiting.\n", fcn_name, cp++);
return;
} /* open_hdf5_file() */
-
/*-------------------------------------------------------------------------
* Function: attempt_swmr_open_hdf5_file()
*
@@ -912,99 +874,96 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
*/
static void
-attempt_swmr_open_hdf5_file(const hbool_t create_file,
- const hbool_t set_mdci_fapl,
- const char * hdf_file_name)
+attempt_swmr_open_hdf5_file(const hbool_t create_file, const hbool_t set_mdci_fapl, const char *hdf_file_name)
{
- const char * fcn_name = "attempt_swmr_open_hdf5_file()";
- hbool_t show_progress = FALSE;
- int cp = 0;
- hid_t fapl_id = -1;
- hid_t file_id = -1;
- herr_t result;
- H5AC_cache_image_config_t cache_image_config = {
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
- TRUE,
- FALSE,
- H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
+ const char * fcn_name = "attempt_swmr_open_hdf5_file()";
+ hbool_t show_progress = FALSE;
+ int cp = 0;
+ hid_t fapl_id = -1;
+ hid_t file_id = -1;
+ herr_t result;
+ H5AC_cache_image_config_t cache_image_config = {H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, TRUE, FALSE,
+ H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
/* create a file access propertly list. */
- if ( pass ) {
+ if (pass) {
fapl_id = h5_fileaccess();
- if ( fapl_id < 0 ) {
+ if (fapl_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fileaccess() failed.\n";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* call H5Pset_libver_bounds() on the fapl_id */
- if ( pass ) {
+ if (pass) {
- if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)
- < 0 ) {
+ if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_libver_bounds() failed.\n";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* set metadata cache image fapl entry if indicated */
- if ( ( pass ) && ( set_mdci_fapl ) ) {
+ if ((pass) && (set_mdci_fapl)) {
/* set cache image config fields to taste */
- cache_image_config.generate_image = TRUE;
+ cache_image_config.generate_image = TRUE;
cache_image_config.save_resize_status = FALSE;
- cache_image_config.entry_ageout = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE;
+ cache_image_config.entry_ageout = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE;
result = H5Pset_mdc_image_config(fapl_id, &cache_image_config);
- if ( result < 0 ) {
+ if (result < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_mdc_image_config() failed.\n";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* open the file */
- if ( pass ) {
+ if (pass) {
- if ( create_file ) {
+ if (create_file) {
- H5E_BEGIN_TRY {
- file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE,
- H5P_DEFAULT, fapl_id);
- } H5E_END_TRY;
- } else {
+ H5E_BEGIN_TRY
+ {
+ file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl_id);
+ }
+ H5E_END_TRY;
+ }
+ else {
- H5E_BEGIN_TRY {
- file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl_id); }
+ H5E_END_TRY;
}
- if ( file_id >= 0 ) {
+ if (file_id >= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "SWMR H5Fcreate() or H5Fopen() succeeded.\n";
-
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
return;
} /* attempt_swmr_open_hdf5_file() */
-
/*-------------------------------------------------------------------------
* Function: verify_datasets()
*
@@ -1032,23 +991,24 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file,
static void
verify_datasets(hid_t file_id, int min_dset, int max_dset)
{
- const char * fcn_name = "verify_datasets()";
- char dset_name[64];
- hbool_t show_progress = FALSE;
- hbool_t valid_chunk;
- hbool_t verbose = FALSE;
- int cp = 0;
- int i, j, k, l, m;
- int data_chunk[CHUNK_SIZE][CHUNK_SIZE];
- herr_t status;
- hid_t filespace_ids[MAX_NUM_DSETS];
- hid_t memspace_id = -1;
- hid_t dataset_ids[MAX_NUM_DSETS];
- hsize_t dims[2];
- hsize_t a_size[2];
- hsize_t offset[2];
-
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ const char *fcn_name = "verify_datasets()";
+ char dset_name[64];
+ hbool_t show_progress = FALSE;
+ hbool_t valid_chunk;
+ hbool_t verbose = FALSE;
+ int cp = 0;
+ int i, j, k, l, m;
+ int data_chunk[CHUNK_SIZE][CHUNK_SIZE];
+ herr_t status;
+ hid_t filespace_ids[MAX_NUM_DSETS];
+ hid_t memspace_id = -1;
+ hid_t dataset_ids[MAX_NUM_DSETS];
+ hsize_t dims[2];
+ hsize_t a_size[2];
+ hsize_t offset[2];
+
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
HDassert(0 <= min_dset);
HDassert(min_dset <= max_dset);
@@ -1056,33 +1016,32 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset)
/* open the datasets */
- if ( pass ) {
+ if (pass) {
i = min_dset;
- while ( ( pass ) && ( i <= max_dset ) )
- {
+ while ((pass) && (i <= max_dset)) {
/* open the dataset */
- if ( pass ) {
+ if (pass) {
HDsprintf(dset_name, "/dset%03d", i);
dataset_ids[i] = H5Dopen2(file_id, dset_name, H5P_DEFAULT);
- if ( dataset_ids[i] < 0 ) {
+ if (dataset_ids[i] < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dopen2() failed.";
}
}
/* get the file space ID */
- if ( pass ) {
+ if (pass) {
filespace_ids[i] = H5Dget_space(dataset_ids[i]);
- if ( filespace_ids[i] < 0 ) {
+ if (filespace_ids[i] < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dget_space() failed.";
}
}
@@ -1091,124 +1050,111 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset)
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* create the mem space to be used to read and write chunks */
- if ( pass ) {
+ if (pass) {
- dims[0] = CHUNK_SIZE;
- dims[1] = CHUNK_SIZE;
+ dims[0] = CHUNK_SIZE;
+ dims[1] = CHUNK_SIZE;
memspace_id = H5Screate_simple(2, dims, NULL);
- if ( memspace_id < 0 ) {
+ if (memspace_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Screate_simple() failed.";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* select in memory hyperslab */
- if ( pass ) {
+ if (pass) {
- offset[0] = 0; /*offset of hyperslab in memory*/
+ offset[0] = 0; /*offset of hyperslab in memory*/
offset[1] = 0;
- a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
+ a_size[0] = CHUNK_SIZE; /*size of hyperslab*/
a_size[1] = CHUNK_SIZE;
- status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL,
- a_size, NULL);
+ status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, offset, NULL, a_size, NULL);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sselect_hyperslab() failed.";
}
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
-
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* read data from datasets and validate it */
i = 0;
- while ( ( pass ) && ( i < DSET_SIZE ) )
- {
+ while ((pass) && (i < DSET_SIZE)) {
j = 0;
- while ( ( pass ) && ( j < DSET_SIZE ) )
- {
+ while ((pass) && (j < DSET_SIZE)) {
m = min_dset;
- while ( ( pass ) && ( m <= max_dset ) )
- {
+ while ((pass) && (m <= max_dset)) {
/* select on disk hyperslab */
offset[0] = (hsize_t)i; /* offset of hyperslab in file */
offset[1] = (hsize_t)j;
a_size[0] = CHUNK_SIZE; /* size of hyperslab */
a_size[1] = CHUNK_SIZE;
- status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET,
- offset, NULL, a_size, NULL);
+ status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
- failure_mssg = "disk hyperslab create failed.";
+ pass = FALSE;
+ failure_mssg = "disk hyperslab create failed.";
}
/* read the chunk from file */
- if ( pass ) {
+ if (pass) {
- status = H5Dread(dataset_ids[m], H5T_NATIVE_INT,
- memspace_id, filespace_ids[m],
+ status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m],
H5P_DEFAULT, data_chunk);
- if ( status < 0 ) {
+ if (status < 0) {
- pass = FALSE;
- failure_mssg = "disk hyperslab create failed.";
+ pass = FALSE;
+ failure_mssg = "disk hyperslab create failed.";
}
}
/* validate the slab */
- if ( pass ) {
+ if (pass) {
valid_chunk = TRUE;
- for ( k = 0; k < CHUNK_SIZE; k++ )
- {
- for ( l = 0; l < CHUNK_SIZE; l++ )
- {
- if ( data_chunk[k][l]
- !=
- ((DSET_SIZE * DSET_SIZE * m) +
- (DSET_SIZE * (i + k)) + j + l) ) {
+ for (k = 0; k < CHUNK_SIZE; k++) {
+ for (l = 0; l < CHUNK_SIZE; l++) {
+ if (data_chunk[k][l] !=
+ ((DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l)) {
valid_chunk = FALSE;
- if ( verbose ) {
+ if (verbose) {
- HDfprintf(stdout,
- "data_chunk[%0d][%0d] = %0d, expect %0d.\n",
- k, l, data_chunk[k][l],
- ((DSET_SIZE * DSET_SIZE * m) +
- (DSET_SIZE * (i + k)) + j + l));
- HDfprintf(stdout,
- "m = %d, i = %d, j = %d, k = %d, l = %d\n",
- m, i, j, k, l);
- }
+ HDfprintf(stdout, "data_chunk[%0d][%0d] = %0d, expect %0d.\n", k, l,
+ data_chunk[k][l],
+ ((DSET_SIZE * DSET_SIZE * m) + (DSET_SIZE * (i + k)) + j + l));
+ HDfprintf(stdout, "m = %d, i = %d, j = %d, k = %d, l = %d\n", m, i, j, k,
+ l);
+ }
}
}
}
- if ( ! valid_chunk ) {
+ if (!valid_chunk) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "slab validation failed.";
- if ( verbose ) {
+ if (verbose) {
- HDfprintf(stdout,
- "Chunk (%0d, %0d) in /dset%03d is invalid.\n",
- i, j, m);
- }
+ HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m);
+ }
}
}
m++;
@@ -1218,39 +1164,37 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset)
i += CHUNK_SIZE;
}
- if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ if (show_progress)
+ HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
/* close the file spaces */
i = min_dset;
- while ( ( pass ) && ( i <= max_dset ) )
- {
- if ( H5Sclose(filespace_ids[i]) < 0 ) {
+ while ((pass) && (i <= max_dset)) {
+ if (H5Sclose(filespace_ids[i]) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sclose() failed.";
}
i++;
}
-
/* close the datasets */
i = min_dset;
- while ( ( pass ) && ( i <= max_dset ) )
- {
- if ( H5Dclose(dataset_ids[i]) < 0 ) {
+ while ((pass) && (i <= max_dset)) {
+ if (H5Dclose(dataset_ids[i]) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Dclose() failed.";
}
i++;
}
/* close the mem space */
- if ( pass ) {
+ if (pass) {
- if ( H5Sclose(memspace_id) < 0 ) {
+ if (H5Sclose(memspace_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Sclose(memspace_id) failed.";
}
}
@@ -1259,7 +1203,6 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset)
} /* verify_datasets() */
-
/****************************************************************************/
/******************************* Test Functions *****************************/
/****************************************************************************/
@@ -1334,18 +1277,18 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset)
static unsigned
check_cache_image_ctl_flow_1(hbool_t single_file_vfd)
{
- const char * fcn_name = "check_cache_image_ctl_flow_1()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "check_cache_image_ctl_flow_1()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image control flow test 1");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -1353,25 +1296,22 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -1380,14 +1320,14 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd)
* extension message only.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -1395,37 +1335,33 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create some datasets in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Open the file.
*
* Verify that the metadata cache is instructed to load the
@@ -1434,14 +1370,14 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd)
* indicate that the metadata image block doesn't exist.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1449,61 +1385,58 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Open and close a dataset.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
- if ( pass ) {
+ if (pass) {
/* think on how to verify that the superblock extension has been
* deleted, and if it is necessary to verify this directly.
*/
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Open the file.
*
* Verify that the file doesn't contain a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1511,47 +1444,48 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* check_cache_image_ctl_flow_1() */
-
/*-------------------------------------------------------------------------
* Function: check_cache_image_ctl_flow_2()
*
@@ -1620,18 +1554,18 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd)
static unsigned
check_cache_image_ctl_flow_2(hbool_t single_file_vfd)
{
- const char * fcn_name = "check_cache_image_ctl_flow_2()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "check_cache_image_ctl_flow_2()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image control flow test 2");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -1639,24 +1573,22 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -1665,14 +1597,14 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd)
* extension message only.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -1680,26 +1612,23 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Open the file.
*
* Verify that the metadata cache is instructed to load the
@@ -1708,14 +1637,14 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd)
* indicate that the metadata image block doesn't exist.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1723,39 +1652,37 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Open the file.
*
* Verify that the file doesn't contain a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1763,47 +1690,48 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* check_cache_image_ctl_flow_2() */
-
/*-------------------------------------------------------------------------
* Function: check_cache_image_ctl_flow_3()
*
@@ -1890,18 +1818,18 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd)
static unsigned
check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
{
- const char * fcn_name = "check_cache_image_ctl_flow_3()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "check_cache_image_ctl_flow_3()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image control flow test 3");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -1909,21 +1837,20 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress ) /* 0 */
+ if (show_progress) /* 0 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress ) /* 1 */
+ if (show_progress) /* 1 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 1) Create a HDF5 file WITHOUT the cache image FAPL entry.
@@ -1932,14 +1859,14 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
* FAPL entry.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1947,25 +1874,23 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 2 */
+ if (show_progress) /* 2 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 3 */
+ if (show_progress) /* 3 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Open the file WITH the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -1974,14 +1899,14 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
* extension message only.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -1989,36 +1914,33 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 4 */
+ if (show_progress) /* 4 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Create some datasets. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
- if ( show_progress ) /* 5 */
+ if (show_progress) /* 5 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 6 */
+ if (show_progress) /* 6 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Open the file READ ONLY.
*
* Verify that the metadata cache is instructed
@@ -2028,14 +1950,14 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
* that the metadata image block doesn't exist.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2043,36 +1965,33 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 7 */
+ if (show_progress) /* 7 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Verify the contents of the datasets. */
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
- if ( show_progress ) /* 8 */
+ if (show_progress) /* 8 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 9 */
+ if (show_progress) /* 9 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Open the file READ/WRITE.
*
* Verify that the metadata cache is instructed
@@ -2082,14 +2001,14 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
* that the metadata image block doesn't exist.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2097,50 +2016,47 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 10 */
+ if (show_progress) /* 10 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Verify the contents of the datasets. */
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
- if ( show_progress ) /* 11 */
+ if (show_progress) /* 11 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 11) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 12 */
+ if (show_progress) /* 12 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Open the file
*
* Verify that the file doesn't contain a metadata cache
* image superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2148,48 +2064,48 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 13 */
+ if (show_progress) /* 13 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 14 */
+ if (show_progress) /* 14 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 14) Delete the file. */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
-
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* check_cache_image_ctl_flow_3() */
-
/*-------------------------------------------------------------------------
* Function: check_cache_image_ctl_flow_4()
*
@@ -2268,18 +2184,18 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd)
static unsigned
check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
{
- const char * fcn_name = "check_cache_image_ctl_flow_4()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "check_cache_image_ctl_flow_4()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image control flow test 4");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -2287,21 +2203,20 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress ) /* 0 */
+ if (show_progress) /* 0 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress ) /* 1 */
+ if (show_progress) /* 1 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 1) Create a HDF5 file WITHOUT the cache image FAPL entry.
@@ -2310,14 +2225,14 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
* FAPL entry.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2325,25 +2240,23 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 2 */
+ if (show_progress) /* 2 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 3 */
+ if (show_progress) /* 3 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Open the file WITH the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -2352,14 +2265,14 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
* extension message only.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -2367,25 +2280,23 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 4 */
+ if (show_progress) /* 4 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 5 */
+ if (show_progress) /* 5 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Open the file READ ONLY.
*
* Verify that the metadata cache is instructed
@@ -2395,14 +2306,14 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
* that the metadata image block doesn't exist.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2410,25 +2321,23 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 6 */
+ if (show_progress) /* 6 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 7 */
+ if (show_progress) /* 7 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Open the file READ/WRITE.
*
* Verify that the metadata cache is instructed
@@ -2438,14 +2347,14 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
* that the metadata image block doesn't exist.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2453,39 +2362,37 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 8 */
+ if (show_progress) /* 8 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 9 */
+ if (show_progress) /* 9 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Open the file
*
* Verify that the file doesn't contain a metadata cache
* image superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2493,48 +2400,48 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 10 */
+ if (show_progress) /* 10 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 11 */
+ if (show_progress) /* 11 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 11) Delete the file. */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
-
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* check_cache_image_ctl_flow_4() */
-
/*-------------------------------------------------------------------------
* Function: check_cache_image_ctl_flow_5()
*
@@ -2606,18 +2513,18 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd)
static unsigned
check_cache_image_ctl_flow_5(hbool_t single_file_vfd)
{
- const char * fcn_name = "check_cache_image_ctl_flow_5()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "check_cache_image_ctl_flow_5()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image control flow test 5");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -2625,24 +2532,22 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress ) /* 0 */
+ if (show_progress) /* 0 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress ) /* 1 */
+ if (show_progress) /* 1 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -2651,14 +2556,14 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd)
* super block extension message only.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -2666,36 +2571,33 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 2 */
+ if (show_progress) /* 2 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create some datasets. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
- if ( show_progress ) /* 3 */
+ if (show_progress) /* 3 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 4 */
+ if (show_progress) /* 4 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Open the file WITH the cache image FAPL entry.
*
* Verify that the metadata cache is instructed
@@ -2711,14 +2613,14 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd)
* super block extension message only.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -2726,35 +2628,33 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 5 */
+ if (show_progress) /* 5 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 5) Verify the contents of the datasets. */
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
- if ( show_progress ) /* 6 */
+ if (show_progress) /* 6 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 7 */
+ if (show_progress) /* 7 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Open the file.
*
* Verify that the metadata cache is instructed
@@ -2764,14 +2664,14 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd)
* that the metadata image block doesn't exist.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2779,58 +2679,58 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 8 */
+ if (show_progress) /* 8 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 8) Verify the contents of the datasets. */
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
- if ( show_progress ) /* 9 */
+ if (show_progress) /* 9 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 10 */
+ if (show_progress) /* 10 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Delete the file. */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
-
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* check_cache_image_ctl_flow_5() */
-
/*-------------------------------------------------------------------------
* Function: check_cache_image_ctl_flow_6()
*
@@ -2894,18 +2794,18 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd)
static unsigned
check_cache_image_ctl_flow_6(hbool_t single_file_vfd)
{
- const char * fcn_name = "check_cache_image_ctl_flow_6()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "check_cache_image_ctl_flow_6()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image control flow test 6");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -2913,24 +2813,22 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress ) /* 0 */
+ if (show_progress) /* 0 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress ) /* 1 */
+ if (show_progress) /* 1 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -2939,14 +2837,14 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd)
* super block extension message only.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -2954,25 +2852,23 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 2 */
+ if (show_progress) /* 2 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 3 */
+ if (show_progress) /* 3 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Open the file WITH the cache image FAPL entry.
*
* Verify that the metadata cache is instructed
@@ -2988,14 +2884,14 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd)
* super block extension message only.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -3003,25 +2899,23 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 4 */
+ if (show_progress) /* 4 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 5 */
+ if (show_progress) /* 5 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Open the file.
*
* Verify that the metadata cache is instructed
@@ -3031,14 +2925,14 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd)
* that the metadata image block doesn't exist.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3046,48 +2940,48 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress ) /* 6 */
+ if (show_progress) /* 6 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress ) /* 7 */
+ if (show_progress) /* 7 */
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Delete the file. */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
-
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* check_cache_image_ctl_flow_6() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_smoke_check_1()
*
@@ -3186,18 +3080,18 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd)
static unsigned
cache_image_smoke_check_1(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_smoke_check_1()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "cache_image_smoke_check_1()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image smoke check 1");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -3205,25 +3099,22 @@ cache_image_smoke_check_1(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -3231,14 +3122,14 @@ cache_image_smoke_check_1(hbool_t single_file_vfd)
* Set flags forcing full function of the cache image feature.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -3246,50 +3137,44 @@ cache_image_smoke_check_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create some datasets in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Open the file.
*
* Verify that the metadata cache is instructed to load the
@@ -3298,14 +3183,14 @@ cache_image_smoke_check_1(hbool_t single_file_vfd)
* indicate that the metadata image block doesn't exist.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3313,65 +3198,62 @@ cache_image_smoke_check_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Open and close a dataset.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 1 ) {
+ if (cache_ptr->images_loaded != 1) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Open the file.
*
* Verify that the file doesn't contain a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3379,66 +3261,62 @@ cache_image_smoke_check_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Open and close a dataset.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Open the file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image
* FAPL entry.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -3446,42 +3324,40 @@ cache_image_smoke_check_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 11) Close the file. Since there has been no access to
* any entries that would be included in the cache image,
* there should be no cache image.
*/
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Open the file.
*
* Verify that the file doesn't contain a metadata cache
* image superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3489,73 +3365,72 @@ cache_image_smoke_check_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Open a dataset.
*
* Verify that it contains the expected data.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(3).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 14) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 15) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_smoke_check_1() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_smoke_check_2()
*
@@ -3616,18 +3491,18 @@ cache_image_smoke_check_1(hbool_t single_file_vfd)
static unsigned
cache_image_smoke_check_2(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_smoke_check_2()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "cache_image_smoke_check_2()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image smoke check 2");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -3635,25 +3510,22 @@ cache_image_smoke_check_2(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -3661,14 +3533,14 @@ cache_image_smoke_check_2(hbool_t single_file_vfd)
* Set flags forcing full function of the cache image feature.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -3676,46 +3548,42 @@ cache_image_smoke_check_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create some datasets in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 4) Open the file.
@@ -3724,14 +3592,14 @@ cache_image_smoke_check_2(hbool_t single_file_vfd)
* metadata cache image.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3745,39 +3613,37 @@ cache_image_smoke_check_2(hbool_t single_file_vfd)
* incremented just before the cache is shut down.
*/
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Open the file.
*
* Verify that the file doesn't contain a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3785,62 +3651,62 @@ cache_image_smoke_check_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Open and close a dataset.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_smoke_check_2() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_smoke_check_3()
*
@@ -3923,18 +3789,18 @@ cache_image_smoke_check_2(hbool_t single_file_vfd)
static unsigned
cache_image_smoke_check_3(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_smoke_check_3()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "cache_image_smoke_check_3()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image smoke check 3");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -3942,25 +3808,22 @@ cache_image_smoke_check_3(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -3968,14 +3831,14 @@ cache_image_smoke_check_3(hbool_t single_file_vfd)
* Set flags forcing full function of the cache image feature.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -3983,62 +3846,58 @@ cache_image_smoke_check_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create some datasets in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Open the file read only.
*
* Verify that the metadata cache is instructed to load the
* metadata cache image.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4046,65 +3905,62 @@ cache_image_smoke_check_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Open and close a dataset.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded == 0 ) {
+ if (cache_ptr->images_loaded == 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Open the file.
*
* Verify that the file contains a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4112,63 +3968,59 @@ cache_image_smoke_check_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Open and close a dataset.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded == 0 ) {
+ if (cache_ptr->images_loaded == 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
-
/* 10) Open the file.
*
* Verify that the file doesn't contain a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4176,74 +4028,73 @@ cache_image_smoke_check_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 11) Open and close a dataset.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_smoke_check_3() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_smoke_check_4()
*
@@ -4315,20 +4166,20 @@ cache_image_smoke_check_3(hbool_t single_file_vfd)
static unsigned
cache_image_smoke_check_4(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_smoke_check_4()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
- int min_dset = 0;
- int max_dset = 0;
+ const char *fcn_name = "cache_image_smoke_check_4()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
+ int min_dset = 0;
+ int max_dset = 0;
TESTING("metadata cache image smoke check 4");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -4336,25 +4187,22 @@ cache_image_smoke_check_4(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -4362,14 +4210,14 @@ cache_image_smoke_check_4(hbool_t single_file_vfd)
* Set flags forcing full function of the cache image feature.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -4377,49 +4225,45 @@ cache_image_smoke_check_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create a dataset in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, min_dset++, max_dset++);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- while ( ( pass ) && ( max_dset < MAX_NUM_DSETS ) )
- {
+ while ((pass) && (max_dset < MAX_NUM_DSETS)) {
/* 4) Open the file.
*
@@ -4427,14 +4271,14 @@ cache_image_smoke_check_4(hbool_t single_file_vfd)
* metadata cache image.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -4442,67 +4286,60 @@ cache_image_smoke_check_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
- HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n",
- fcn_name, cp, max_dset, pass);
-
+ if (show_progress)
+ HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp, max_dset, pass);
/* 5) Create a dataset in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, min_dset++, max_dset++);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded == 0 ) {
+ if (cache_ptr->images_loaded == 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
- HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n",
- fcn_name, cp + 1, max_dset, pass);
-
+ if (show_progress)
+ HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 1, max_dset, pass);
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
- HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n",
- fcn_name, cp + 2, max_dset, pass);
+ if (show_progress)
+ HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 2, max_dset, pass);
} /* end while */
cp += 3;
-
/* 7) Open the file.
*
* Verify that the file contains a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4510,63 +4347,59 @@ cache_image_smoke_check_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Open and close all datasets.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, max_dset - 1);
+ verify_datasets(file_id, 0, max_dset - 1);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded == 0 ) {
+ if (cache_ptr->images_loaded == 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
-
/* 10) Open the file.
*
* Verify that the file doesn't contain a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4574,72 +4407,72 @@ cache_image_smoke_check_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 11) Open and close all datasets.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, max_dset - 1);
+ verify_datasets(file_id, 0, max_dset - 1);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 13) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_smoke_check_4() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_smoke_check_5()
*
@@ -4726,23 +4559,23 @@ cache_image_smoke_check_4(hbool_t single_file_vfd)
static unsigned
cache_image_smoke_check_5(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_smoke_check_5()";
- char filename[512];
- char process_group_name[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- hid_t proc_gid = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
- int i;
- int min_group = 0;
- int max_group = 0;
+ const char *fcn_name = "cache_image_smoke_check_5()";
+ char filename[512];
+ char process_group_name[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ hid_t proc_gid = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
+ int i;
+ int min_group = 0;
+ int max_group = 0;
TESTING("metadata cache image smoke check 5");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -4750,29 +4583,26 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
hid_t fapl_id = h5_fileaccess();
- if ( h5_fixname(FILENAMES[0], fapl_id, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], fapl_id, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
H5Pclose(fapl_id);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -4780,14 +4610,14 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
* Set flags forcing full function of the cache image feature.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -4795,74 +4625,68 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create a process specific group. */
- if ( pass ) {
+ if (pass) {
HDsprintf(process_group_name, "/process_%d", min_group);
- proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if ( proc_gid < 0 ) {
+ if (proc_gid < 0) {
- pass = FALSE;
- failure_mssg = "H5Gcreate2() failed (1).\n";
+ pass = FALSE;
+ failure_mssg = "H5Gcreate2() failed (1).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Construct a "zoo" in the above group, and validate it. */
- if ( pass )
+ if (pass)
create_zoo(file_id, process_group_name, min_group);
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Gclose(proc_gid) < 0 ) {
+ if (H5Gclose(proc_gid) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Gclose(proc_gid) failed. (1)";
}
}
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- while ( ( pass ) && ( max_group < MAX_NUM_GROUPS ) )
- {
+ while ((pass) && (max_group < MAX_NUM_GROUPS)) {
/* 5) Open the file.
*
@@ -4870,14 +4694,14 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
* metadata cache image.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -4885,85 +4709,78 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
- HDfprintf(stdout, "%s:L1 cp = %d, max_group = %d, pass = %d.\n",
- fcn_name, cp, max_group, pass);
-
+ if (show_progress)
+ HDfprintf(stdout, "%s:L1 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp, max_group, pass);
/* 6) Validate the "zoo" created in the previous file open. */
- if ( pass )
+ if (pass)
validate_zoo(file_id, process_group_name, max_group);
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded == 0 ) {
+ if (cache_ptr->images_loaded == 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
- HDfprintf(stdout, "%s:L2 cp = %d, max_group = %d, pass = %d.\n",
- fcn_name, cp + 1, max_group, pass);
-
+ if (show_progress)
+ HDfprintf(stdout, "%s:L2 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp + 1, max_group,
+ pass);
- /* 7) Create a process specific group for this file open */
- if ( pass ) {
+ /* 7) Create a process specific group for this file open */
+ if (pass) {
- max_group++;
- HDsprintf(process_group_name, "/process_%d", max_group);
+ max_group++;
+ HDsprintf(process_group_name, "/process_%d", max_group);
- proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if ( proc_gid < 0 ) {
+ if (proc_gid < 0) {
- pass = FALSE;
- failure_mssg = "H5Gcreate2() failed (2).\n";
+ pass = FALSE;
+ failure_mssg = "H5Gcreate2() failed (2).\n";
}
}
- if ( show_progress )
- HDfprintf(stdout, "%s:L3 cp = %d, max_group = %d, pass = %d.\n",
- fcn_name, cp + 2, max_group, pass);
-
+ if (show_progress)
+ HDfprintf(stdout, "%s:L3 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp + 2, max_group,
+ pass);
- /* 8) Construct a "zoo" in the above group, and validate it. */
- if ( pass )
+ /* 8) Construct a "zoo" in the above group, and validate it. */
+ if (pass)
create_zoo(file_id, process_group_name, max_group);
- if ( show_progress )
- HDfprintf(stdout, "%s:L4 cp = %d, max_group = %d, pass = %d.\n",
- fcn_name, cp + 3, max_group, pass);
-
+ if (show_progress)
+ HDfprintf(stdout, "%s:L4 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp + 3, max_group,
+ pass);
/* 9) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Gclose(proc_gid) < 0 ) {
+ if (H5Gclose(proc_gid) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Gclose(process_gid) failed. (2)";
}
}
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
- HDfprintf(stdout, "%s:L5 cp = %d, max_group = %d, pass = %d.\n",
- fcn_name, cp + 4, max_group, pass);
+ if (show_progress)
+ HDfprintf(stdout, "%s:L5 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp + 4, max_group,
+ pass);
} /* end while */
cp += 5;
@@ -4972,13 +4789,13 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
* Verify that the file contains a metadata cache image
* superblock extension message.
*/
- if(pass) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4986,33 +4803,32 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if(show_progress)
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 11) Validate all the zoos. */
i = min_group;
- while(pass && i <= max_group) {
+ while (pass && i <= max_group) {
HDsprintf(process_group_name, "/process_%d", i);
validate_zoo(file_id, process_group_name, i++);
}
#if H5C_COLLECT_CACHE_STATS
- if( pass) {
- if(cache_ptr->images_loaded == 0) {
- pass = FALSE;
+ if (pass) {
+ if (cache_ptr->images_loaded == 0) {
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if(show_progress)
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 12) Close the file. */
- if(pass) {
- if(H5Fclose(file_id) < 0) {
- pass = FALSE;
+ if (pass) {
+ if (H5Fclose(file_id) < 0) {
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
@@ -5023,14 +4839,14 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5038,60 +4854,56 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 14) Validate all the zoos. */
i = min_group;
- while ( ( pass ) && ( i <= max_group ) ) {
+ while ((pass) && (i <= max_group)) {
HDsprintf(process_group_name, "/process_%d", i);
validate_zoo(file_id, process_group_name, i++);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded == 0 ) {
+ if (cache_ptr->images_loaded == 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 15) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
-
/* 16) Open the file.
*
* Verify that the file doesn't contain a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5099,75 +4911,73 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 17) Validate all the zoos.
*
* Verify that the metadata cache image superblock
* extension message has been deleted.
*/
i = min_group;
- while ( ( pass ) && ( i <= max_group ) ) {
+ while ((pass) && (i <= max_group)) {
HDsprintf(process_group_name, "/process_%d", i);
validate_zoo(file_id, process_group_name, i++);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 18) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 19) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
-
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_smoke_check_5() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_smoke_check_6()
*
@@ -5251,21 +5061,21 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
static unsigned
cache_image_smoke_check_6(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_smoke_check_6()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
+ const char * fcn_name = "cache_image_smoke_check_6()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
h5_stat_size_t file_size;
- int cp = 0;
- int min_dset = 0;
- int max_dset = 0;
+ int cp = 0;
+ int min_dset = 0;
+ int max_dset = 0;
TESTING("metadata cache image smoke check 6");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -5273,25 +5083,22 @@ cache_image_smoke_check_6(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with the cache image FAPL entry.
*
* Verify that the cache is informed of the cache image FAPL entry.
@@ -5299,14 +5106,14 @@ cache_image_smoke_check_6(hbool_t single_file_vfd)
* Set flags forcing full function of the cache image feature.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -5314,49 +5121,45 @@ cache_image_smoke_check_6(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create a dataset in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, min_dset++, max_dset++);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- while ( ( pass ) && ( max_dset < MAX_NUM_DSETS ) )
- {
+ while ((pass) && (max_dset < MAX_NUM_DSETS)) {
/* 4) Open the file.
*
@@ -5364,14 +5167,14 @@ cache_image_smoke_check_6(hbool_t single_file_vfd)
* metadata cache image.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -5379,78 +5182,69 @@ cache_image_smoke_check_6(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
- HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n",
- fcn_name, cp, max_dset, pass);
-
+ if (show_progress)
+ HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp, max_dset, pass);
/* 5) Create a dataset in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, min_dset++, max_dset++);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded == 0 ) {
+ if (cache_ptr->images_loaded == 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
- HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n",
- fcn_name, cp + 1, max_dset, pass);
-
+ if (show_progress)
+ HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 1, max_dset, pass);
- /* 6) Verify and delete the old dataset. */
- if ( pass ) {
+ /* 6) Verify and delete the old dataset. */
+ if (pass) {
- delete_datasets(file_id, min_dset - 2, max_dset - 2);
- }
-
- if ( show_progress )
- HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n",
- fcn_name, cp + 2, max_dset, pass);
+ delete_datasets(file_id, min_dset - 2, max_dset - 2);
+ }
+ if (show_progress)
+ HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 2, max_dset, pass);
/* 7) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
- HDfprintf(stdout, "%s:L4 cp = %d, max_dset = %d, pass = %d.\n",
- fcn_name, cp + 3, max_dset, pass);
+ if (show_progress)
+ HDfprintf(stdout, "%s:L4 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 3, max_dset, pass);
} /* end while */
cp += 4;
-
/* 8) Open the file.
*
* Verify that the file contains a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5458,59 +5252,55 @@ cache_image_smoke_check_6(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Verify the last dataset created. */
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, min_dset - 1, max_dset - 1);
+ verify_datasets(file_id, min_dset - 1, max_dset - 1);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded == 0 ) {
+ if (cache_ptr->images_loaded == 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block not loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
-
/* 11) Open the file.
*
* Verify that the file doesn't contain a metadata cache image
* superblock extension message.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5518,48 +5308,44 @@ cache_image_smoke_check_6(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Verify and delete the last dataset.
*
* Verify that a metadata cache image is not loaded.
*/
- if ( pass ) {
+ if (pass) {
- delete_datasets(file_id, min_dset - 1, max_dset - 1);
+ delete_datasets(file_id, min_dset - 1, max_dset - 1);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
-
/* 13) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 14) Get the size of the file. Verify that it is less
* than 20 KB. Without deletions and persistent free
* space managers, size size is about 167 MB, so this
@@ -5571,42 +5357,44 @@ cache_image_smoke_check_6(hbool_t single_file_vfd)
* with and without paged allocation, we must leave some
* extra space for the paged allocation case.
*/
- if(pass) {
- if((file_size = h5_get_file_size(filename, H5P_DEFAULT)) < 0) {
- pass = FALSE;
+ if (pass) {
+ if ((file_size = h5_get_file_size(filename, H5P_DEFAULT)) < 0) {
+ pass = FALSE;
failure_mssg = "h5_get_file_size() failed.\n";
- } else if(file_size > 20 * 1024) {
- pass = FALSE;
+ }
+ else if (file_size > 20 * 1024) {
+ pass = FALSE;
failure_mssg = "unexpectedly large file size.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 15) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
-
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_smoke_check_6() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_api_error_check_1()
*
@@ -5668,18 +5456,18 @@ cache_image_smoke_check_6(hbool_t single_file_vfd)
static unsigned
cache_image_api_error_check_1(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_api_error_check_1()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "cache_image_api_error_check_1()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image api error check 1");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -5687,35 +5475,32 @@ cache_image_api_error_check_1(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5723,60 +5508,54 @@ cache_image_api_error_check_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create some datasets in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Open the file read only with a cache image FAPL entry requested. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ TRUE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -5784,10 +5563,9 @@ cache_image_api_error_check_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Open and close a dataset.
*
* Verify that it contains the expected data.
@@ -5795,51 +5573,49 @@ cache_image_api_error_check_1(hbool_t single_file_vfd)
* Verify that the cache image was not loaded.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Open the file read only. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5847,10 +5623,9 @@ cache_image_api_error_check_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Open and close a dataset.
*
* Verify that it contains the expected data.
@@ -5858,52 +5633,49 @@ cache_image_api_error_check_1(hbool_t single_file_vfd)
* Verify that the cache image was not loaded.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(3).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Open the file read / write. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -5911,7 +5683,7 @@ cache_image_api_error_check_1(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 11) Open and close a dataset.
@@ -5921,63 +5693,64 @@ cache_image_api_error_check_1(hbool_t single_file_vfd)
* Verify that the cache image was not loaded.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(4).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_api_error_check_1() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_api_error_check_2()
*
@@ -6051,18 +5824,18 @@ cache_image_api_error_check_1(hbool_t single_file_vfd)
static unsigned
cache_image_api_error_check_2(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_api_error_check_2()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "cache_image_api_error_check_2()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image api error check 2");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -6070,35 +5843,32 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with a cache image requested. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6106,60 +5876,54 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create some datasets in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Open the file read only with a cache image FAPL entry requested. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ TRUE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6167,10 +5931,9 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Open and close a dataset.
*
* Verify that it contains the expected data.
@@ -6178,51 +5941,49 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
* Verify that the cache image was loaded.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 1 ) {
+ if (cache_ptr->images_loaded != 1) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block was not loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Open the file read only. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -6230,10 +5991,9 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Open and close a dataset.
*
* Verify that it contains the expected data.
@@ -6241,52 +6001,49 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
* Verify that the cache image was loaded.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 1 ) {
+ if (cache_ptr->images_loaded != 1) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block was not loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
-
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Open the file read / write. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ TRUE,
+ /* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6294,7 +6051,7 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 11) Open and close a dataset.
@@ -6304,51 +6061,49 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
* Verify that the cache image was loaded.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 1 ) {
+ if (cache_ptr->images_loaded != 1) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block was not loaded(3).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Open the file read / write. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6356,7 +6111,7 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 14) Open and close a dataset.
@@ -6366,63 +6121,64 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
* Verify that the cache image was not loaded.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block was loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 15) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_api_error_check_2() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_api_error_check_3()
*
@@ -6469,18 +6225,18 @@ cache_image_api_error_check_2(hbool_t single_file_vfd)
static unsigned
cache_image_api_error_check_3(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_api_error_check_3()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "cache_image_api_error_check_3()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
TESTING("metadata cache image api error check 3");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -6488,35 +6244,32 @@ cache_image_api_error_check_3(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with a cache image requested. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6524,64 +6277,61 @@ cache_image_api_error_check_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Try to start SWMR write -- should fail. */
- if ( pass ) {
+ if (pass) {
- H5E_BEGIN_TRY {
- if ( H5Fstart_swmr_write(file_id) == SUCCEED ) {
+ H5E_BEGIN_TRY
+ {
+ if (H5Fstart_swmr_write(file_id) == SUCCEED) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "SWMR start succeeded in file with cache image.";
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Discard the file if necessary */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Attempt to create a HDF5 file with SWMR write
* access and cache image requested -- should fail.
*/
- attempt_swmr_open_hdf5_file(/* create_file */ TRUE,
- /* set_mdci_fapl */ TRUE,
- /* hdf_file_name */ filename);
+ attempt_swmr_open_hdf5_file(/* create_file */ TRUE,
+ /* set_mdci_fapl */ TRUE,
+ /* hdf_file_name */ filename);
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Discard the file if necessary */
- if ( pass ) {
+ if (pass) {
/* file probably doesn't exist, so don't
* error check the remove call.
@@ -6589,20 +6339,19 @@ cache_image_api_error_check_3(hbool_t single_file_vfd)
HDremove(filename);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Create a HDF5 file with a cache image requested. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6610,84 +6359,81 @@ cache_image_api_error_check_3(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Create some datasets in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Attempt to open the file with SWMR write access -- should fail. */
attempt_swmr_open_hdf5_file(/* create_file */ FALSE,
/* set_mdci_fapl */ TRUE,
/* hdf_file_name */ filename);
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Discard the file if necessary. */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
-
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_api_error_check_3() */
-
/*-------------------------------------------------------------------------
* Function: cache_image_api_error_check_4()
*
@@ -6760,20 +6506,20 @@ cache_image_api_error_check_3(hbool_t single_file_vfd)
static unsigned
cache_image_api_error_check_4(hbool_t single_file_vfd)
{
- const char * fcn_name = "cache_image_api_error_check_4()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t fapl_id = -1;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char * fcn_name = "cache_image_api_error_check_4()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t fapl_id = -1;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
H5AC_cache_image_config_t cache_image_config;
TESTING("metadata cache image api error check 4");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -6781,157 +6527,149 @@ cache_image_api_error_check_4(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* 1) Create a FAPL requesting a cache image, but WITHOUT
* specifying the latest file format.
*/
- if ( pass ) {
+ if (pass) {
fapl_id = h5_fileaccess();
- if ( fapl_id < 0 ) {
+ if (fapl_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fileaccess() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) {
+ if (pass) {
/* set cache image config fields to taste */
- cache_image_config.version = H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION;
- cache_image_config.generate_image = TRUE;
+ cache_image_config.version = H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION;
+ cache_image_config.generate_image = TRUE;
cache_image_config.save_resize_status = FALSE;
- cache_image_config.entry_ageout = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE;
+ cache_image_config.entry_ageout = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE;
- if ( H5Pset_mdc_image_config(fapl_id, &cache_image_config) < 0 ) {
+ if (H5Pset_mdc_image_config(fapl_id, &cache_image_config) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Pset_mdc_image_config() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create a HDF5 file using the above FAPL. */
- if ( pass ) {
+ if (pass) {
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if ( file_id < 0 ) {
+ if (file_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fcreate() failed.\n";
-
- } else {
+ }
+ else {
file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't get file_ptr.";
-
}
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* get a pointer to the files internal data structure and then
* to the cache structure
*/
- if ( pass ) {
+ if (pass) {
- if ( file_ptr->shared->cache == NULL ) {
+ if (file_ptr->shared->cache == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "can't get cache pointer(1).\n";
-
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Create some datasets in the file. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
HDassert(cache_ptr);
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(1).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Open the file read only. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6939,254 +6677,240 @@ cache_image_api_error_check_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Verify that the datasets exist and contain the
* expected data
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Open the file R/W using the FAPL defined in 1) above.
*
* Verify that the file does not contain a cache image.
*/
- if ( pass ) {
+ if (pass) {
file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
- if ( file_id < 0 ) {
+ if (file_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fopen() failed.\n";
-
- } else {
+ }
+ else {
file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't get file_ptr.";
-
}
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* get a pointer to the files internal data structure and then
* to the cache structure
*/
- if ( pass ) {
+ if (pass) {
- if ( file_ptr->shared->cache == NULL ) {
+ if (file_ptr->shared->cache == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "can't get cache pointer(1).\n";
-
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) {
+ if (pass) {
- if ( ( cache_ptr->load_image == TRUE ) ||
- ( cache_ptr->delete_image == TRUE ) ) {
+ if ((cache_ptr->load_image == TRUE) || (cache_ptr->delete_image == TRUE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "mdci sb extension message present?\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
-
/* 10) Open the file R/W using the FAPL defined in 1) above.
* Verify that the file does not contain a cache image.
*/
- if ( pass ) {
+ if (pass) {
file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
- if ( file_id < 0 ) {
+ if (file_id < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fopen() failed.\n";
-
- } else {
+ }
+ else {
file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE);
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "Can't get file_ptr.";
-
}
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
/* get a pointer to the files internal data structure and then
* to the cache structure
*/
- if ( pass ) {
+ if (pass) {
- if ( file_ptr->shared->cache == NULL ) {
+ if (file_ptr->shared->cache == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "can't get cache pointer(1).\n";
-
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) {
+ if (pass) {
- if ( ( cache_ptr->load_image == TRUE ) ||
- ( cache_ptr->delete_image == TRUE ) ) {
+ if ((cache_ptr->load_image == TRUE) || (cache_ptr->delete_image == TRUE)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "mdci sb extension message present?\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 11) Verify that the data sets contain the expected data
*
* Verify that a cache image was not loaded.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 5);
+ verify_datasets(file_id, 0, 5);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Create several more data sets. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 6, 10);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 14) Open the file read write.
*
* Verify that the file does not contain a cache image.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
- /* mdci_sbem_expected */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7194,81 +6918,79 @@ cache_image_api_error_check_4(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 15) Verify the data sets exist and contain the expected data.
*
* Verify that a cache image was not loaded.
*/
- if ( pass ) {
+ if (pass) {
- verify_datasets(file_id, 0, 10);
+ verify_datasets(file_id, 0, 10);
}
#if H5C_COLLECT_CACHE_STATS
- if ( pass ) {
+ if (pass) {
- if ( cache_ptr->images_loaded != 0 ) {
+ if (cache_ptr->images_loaded != 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "metadata cache image block loaded(2).";
}
}
#endif /* H5C_COLLECT_CACHE_STATS */
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 16) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 17) Delete the file */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* tidy up */
- if ( fapl_id != -1 )
+ if (fapl_id != -1)
H5Pclose(fapl_id);
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
-
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* cache_image_api_error_check_4() */
-
/*-------------------------------------------------------------------------
* Function: get_free_sections_test()
*
@@ -7356,19 +7078,19 @@ cache_image_api_error_check_4(hbool_t single_file_vfd)
static unsigned
get_free_sections_test(hbool_t single_file_vfd)
{
- const char * fcn_name = "get_free_sections_test()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
+ const char * fcn_name = "get_free_sections_test()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
h5_stat_size_t file_size;
- int cp = 0;
+ int cp = 0;
TESTING("Cache image / H5Fget_free_sections() interaction");
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -7376,37 +7098,34 @@ get_free_sections_test(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file with a cache image requested
* and persistent free space managers enabled.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7414,65 +7133,61 @@ get_free_sections_test(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create some data sets, and then delete some of
* of those near the beginning of the file.
*/
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 1, 10);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 1, 10);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) {
+ if (pass) {
delete_datasets(file_id, 1, 5);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed (1).\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Open the file read only. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
/* mdci_sbem_expected */ TRUE,
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7480,120 +7195,108 @@ get_free_sections_test(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Verify that a cache image exists, and has not been loaded. */
- if ( pass ) {
+ if (pass) {
- if ( ( ! file_ptr->shared->cache->load_image ) ||
- ( file_ptr->shared->cache->image_loaded ) ) {
+ if ((!file_ptr->shared->cache->load_image) || (file_ptr->shared->cache->image_loaded)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unexpected cache image status.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Verify that one or more self referential FSMs
* have been stored at the end of the file just
* before the cache image.
*/
- if ( pass ) {
+ if (pass) {
/* file_ptr->shared->first_alloc_dealloc is set to FALSE if the
* file is opened R/O.
*/
- if ( ( ! H5F_addr_defined(file_ptr->shared->eoa_fsm_fsalloc) ) ||
- ( ! H5F_addr_defined(file_ptr->shared->cache->image_addr) ) ||
- ( H5F_addr_gt(file_ptr->shared->eoa_fsm_fsalloc,
- file_ptr->shared->cache->image_addr) ) ) {
+ if ((!H5F_addr_defined(file_ptr->shared->eoa_fsm_fsalloc)) ||
+ (!H5F_addr_defined(file_ptr->shared->cache->image_addr)) ||
+ (H5F_addr_gt(file_ptr->shared->eoa_fsm_fsalloc, file_ptr->shared->cache->image_addr))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unexpected cache image status (1).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Call H5Fget_free_sections(). */
- if ( pass ) {
+ if (pass) {
- if ( H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL)
- < 0 ){
+ if (H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_free_sections() failed (1).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Verify that the cache image has been loaded and
* that the self referential FSMs have been floated.
*/
- if ( pass ) {
+ if (pass) {
- if ( ! file_ptr->shared->cache->image_loaded ) {
+ if (!file_ptr->shared->cache->image_loaded) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache image not loaded (1).\n";
-
}
-
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Verify that the remaining data sets contain the expected data. */
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 6, 10);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed (2).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 11) Open the file R/W. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
/* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7601,162 +7304,151 @@ get_free_sections_test(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Verify that a cache image exists, and has not been loaded. */
- if ( pass ) {
+ if (pass) {
- if ( ( ! file_ptr->shared->cache->load_image ) ||
- ( file_ptr->shared->cache->image_loaded ) ) {
+ if ((!file_ptr->shared->cache->load_image) || (file_ptr->shared->cache->image_loaded)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unexpected cache image status.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Verify that one or more self referential FSMs
* have been stored at the end of the file just
* before the cache image.
*/
- if ( pass ) {
+ if (pass) {
- if ( ( ! H5F_addr_defined(file_ptr->shared->eoa_fsm_fsalloc) ) ||
- ( ! H5F_addr_defined(file_ptr->shared->cache->image_addr) ) ||
- ( H5F_addr_gt(file_ptr->shared->eoa_fsm_fsalloc,
- file_ptr->shared->cache->image_addr) ) ) {
+ if ((!H5F_addr_defined(file_ptr->shared->eoa_fsm_fsalloc)) ||
+ (!H5F_addr_defined(file_ptr->shared->cache->image_addr)) ||
+ (H5F_addr_gt(file_ptr->shared->eoa_fsm_fsalloc, file_ptr->shared->cache->image_addr))) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unexpected cache image status (2).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 14) Call H5Fget_free_sections(). */
- if ( pass ) {
+ if (pass) {
- if ( H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL)
- < 0 ){
+ if (H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fget_free_sections() failed (2).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 15) Verify that the cache image has been loaded and
* that the self referential FSMs have been floated.
*/
- if ( pass ) {
+ if (pass) {
- if ( ! file_ptr->shared->cache->image_loaded ) {
+ if (!file_ptr->shared->cache->image_loaded) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "cache image not loaded (2).\n";
-
}
-
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 16) Verify that the remaining data sets contain the expected data. */
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 6, 10);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 17) Delete the remaining data sets. */
- if ( pass ) {
+ if (pass) {
delete_datasets(file_id, 6, 10);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 18) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed (3).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 19) Verify that file space has been reclaimed. */
- if ( pass ) {
+ if (pass) {
- if((file_size = h5_get_file_size(filename, H5P_DEFAULT)) < 0) {
+ if ((file_size = h5_get_file_size(filename, H5P_DEFAULT)) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_get_file_size() failed.\n";
+ }
+ else if (file_size > 20 * 1024) {
- } else if ( file_size > 20 * 1024 ) {
-
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "unexpectedly large file size.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 20) Discard the file. */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
} /* get_free_sections_test() */
-
/*-------------------------------------------------------------------------
* Function: evict_on_close_test()
*
@@ -7828,14 +7520,14 @@ static unsigned
evict_on_close_test(hbool_t single_file_vfd)
{
#ifndef H5_HAVE_PARALLEL
- const char * fcn_name = "evict_on_close_test()";
- char filename[512];
- hbool_t show_progress = FALSE;
- hbool_t verbose = FALSE;
- hid_t file_id = -1;
- H5F_t *file_ptr = NULL;
- H5C_t *cache_ptr = NULL;
- int cp = 0;
+ const char *fcn_name = "evict_on_close_test()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hbool_t verbose = FALSE;
+ hid_t file_id = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ int cp = 0;
#endif /* H5_HAVE_PARALLEL */
TESTING("Cache image / evict on close interaction");
@@ -7847,7 +7539,7 @@ evict_on_close_test(hbool_t single_file_vfd)
#else
/* Check for VFD that is a single file */
- if(!single_file_vfd) {
+ if (!single_file_vfd) {
SKIPPED();
HDputs(" Cache image not supported with the current VFD.");
return 0;
@@ -7855,36 +7547,33 @@ evict_on_close_test(hbool_t single_file_vfd)
pass = TRUE;
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* setup the file name */
- if ( pass ) {
+ if (pass) {
- if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
+ if (h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 1) Create a HDF5 file without a cache image requested
* and persistent free space managers enabled.
*/
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ TRUE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ TRUE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7892,55 +7581,51 @@ evict_on_close_test(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 2) Create some data sets and verify them. */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 1, 10);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 1, 10);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 3) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed (1).\n";
-
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 4) Open the file R/W, and with cache image requested. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
/* mdci_sbem_expected */ FALSE,
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
- /* config_fsm */ FALSE,
- /* set_eoc */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7948,78 +7633,73 @@ evict_on_close_test(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 5) Verify the datasets created in 2) above. This will
* force their (clean) metadata into the metadata cache,
* and hence into the cache image.
*/
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 1, 10);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 6) Create some more datasets and verify them */
- if ( pass ) {
+ if (pass) {
create_datasets(file_id, 11, 20);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 11, 20);
}
- if ( verbose ) {
+ if (verbose) {
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDfprintf(stdout, "index size / index dirty size = %lld / %lld\n",
- (long long)(cache_ptr->index_size),
+ HDfprintf(stdout, "index size / index dirty size = %lld / %lld\n", (long long)(cache_ptr->index_size),
(long long)(cache_ptr->dirty_index_size));
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 7) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed (2).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 8) Open the file R/O and with evict on close enabled. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
/* mdci_sbem_expected */ TRUE,
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ TRUE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ TRUE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -8027,54 +7707,51 @@ evict_on_close_test(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s*: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 9) Verify all datasets twice */
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 1, 20);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 1, 20);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 10) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed (3).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 11) Open the file R/w and with evict on close enabled. */
- if ( pass ) {
+ if (pass) {
open_hdf5_file(/* create_file */ FALSE,
/* mdci_sbem_expected */ TRUE,
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
- /* config_fsm */ FALSE,
- /* set_eoc */ TRUE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ TRUE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -8082,70 +7759,70 @@ evict_on_close_test(hbool_t single_file_vfd)
/* cache_ptr_ptr */ &cache_ptr);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s*: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 12) Verify all datasets twice */
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 1, 20);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) {
+ if (pass) {
verify_datasets(file_id, 1, 20);
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Close the file. */
- if ( pass ) {
+ if (pass) {
- if ( H5Fclose(file_id) < 0 ) {
+ if (H5Fclose(file_id) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "H5Fclose() failed (3).\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 14) Discard the file. */
- if ( pass ) {
+ if (pass) {
- if ( HDremove(filename) < 0 ) {
+ if (HDremove(filename) < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "HDremove() failed.\n";
}
}
- if ( show_progress )
+ if (show_progress)
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
- if ( pass ) { PASSED(); } else { H5_FAILED(); }
+ if (pass) {
+ PASSED();
+ }
+ else {
+ H5_FAILED();
+ }
- if ( ! pass )
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
+ if (!pass)
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg);
return !pass;
#endif /* H5_HAVE_PARALLEL */
} /* evict_on_close_test() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -8163,14 +7840,14 @@ evict_on_close_test(hbool_t single_file_vfd)
int
main(void)
{
- const char *env_h5_drvr; /* File driver value from environment */
- hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */
- unsigned nerrs = 0;
- int express_test;
+ const char *env_h5_drvr; /* File driver value from environment */
+ hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */
+ unsigned nerrs = 0;
+ int express_test;
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
H5open();
@@ -8183,7 +7860,8 @@ main(void)
HDprintf("=========================================\n");
/* Check for VFD which stores data in multiple files */
- single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"));
+ single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") &&
+ HDstrcmp(env_h5_drvr, "family"));
nerrs += check_cache_image_ctl_flow_1(single_file_vfd);
nerrs += check_cache_image_ctl_flow_2(single_file_vfd);
@@ -8207,7 +7885,6 @@ main(void)
nerrs += get_free_sections_test(single_file_vfd);
nerrs += evict_on_close_test(single_file_vfd);
- return(nerrs > 0);
+ return (nerrs > 0);
} /* main() */
-
diff --git a/test/cache_logging.c b/test/cache_logging.c
index c43609b..baf84f8 100644
--- a/test/cache_logging.c
+++ b/test/cache_logging.c
@@ -32,20 +32,20 @@
static herr_t
test_logging_api(void)
{
- hid_t fapl = -1;
- hbool_t is_enabled;
- hbool_t is_enabled_out;
- hbool_t start_on_access;
- hbool_t start_on_access_out;
- char *location = NULL;
- size_t size;
-
- hid_t fid = -1;
- hid_t gid = -1;
- hbool_t is_currently_logging;
- char group_name[12];
- char filename[1024];
- int i;
+ hid_t fapl = -1;
+ hbool_t is_enabled;
+ hbool_t is_enabled_out;
+ hbool_t start_on_access;
+ hbool_t start_on_access_out;
+ char * location = NULL;
+ size_t size;
+
+ hid_t fid = -1;
+ hid_t gid = -1;
+ hbool_t is_currently_logging;
+ char group_name[12];
+ char filename[1024];
+ int i;
TESTING("metadata cache log api calls");
@@ -53,85 +53,78 @@ test_logging_api(void)
h5_fixname(FILE_NAME, fapl, filename, sizeof filename);
/* Set up metadata cache logging */
- is_enabled = TRUE;
+ is_enabled = TRUE;
start_on_access = FALSE;
- if(H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0)
+ if (H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0)
TEST_ERROR;
/* Check to make sure that the property list getter returns the correct
* location string buffer size;
*/
- is_enabled_out = FALSE;
+ is_enabled_out = FALSE;
start_on_access_out = TRUE;
- location = NULL;
- size = 999;
- if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size,
- &start_on_access_out) < 0)
+ location = NULL;
+ size = 999;
+ if (H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, &start_on_access_out) < 0)
TEST_ERROR;
- if(size != HDstrlen(LOG_LOCATION) + 1)
+ if (size != HDstrlen(LOG_LOCATION) + 1)
TEST_ERROR;
/* Check to make sure that the property list getter works */
- if(NULL == (location = (char *)HDcalloc(size, sizeof(char))))
+ if (NULL == (location = (char *)HDcalloc(size, sizeof(char))))
TEST_ERROR;
- if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size,
- &start_on_access_out) < 0)
+ if (H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, &start_on_access_out) < 0)
TEST_ERROR;
- if((is_enabled != is_enabled_out)
- || (start_on_access != start_on_access_out)
- || HDstrcmp(LOG_LOCATION, location))
+ if ((is_enabled != is_enabled_out) || (start_on_access != start_on_access_out) ||
+ HDstrcmp(LOG_LOCATION, location))
TEST_ERROR;
/* Create a file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
-
/* Check to see if the logging flags were set correctly */
- is_enabled = FALSE;
+ is_enabled = FALSE;
is_currently_logging = TRUE;
- if((H5Fget_mdc_logging_status(fid, &is_enabled, &is_currently_logging) < 0)
- || (is_enabled != TRUE)
- || (is_currently_logging != FALSE))
+ if ((H5Fget_mdc_logging_status(fid, &is_enabled, &is_currently_logging) < 0) || (is_enabled != TRUE) ||
+ (is_currently_logging != FALSE))
TEST_ERROR;
/* Turn on logging and check flags */
- if(H5Fstart_mdc_logging(fid) < 0)
+ if (H5Fstart_mdc_logging(fid) < 0)
TEST_ERROR;
- is_enabled = FALSE;
+ is_enabled = FALSE;
is_currently_logging = FALSE;
- if((H5Fget_mdc_logging_status(fid, &is_enabled, &is_currently_logging) < 0)
- || (is_enabled != TRUE)
- || (is_currently_logging != TRUE))
+ if ((H5Fget_mdc_logging_status(fid, &is_enabled, &is_currently_logging) < 0) || (is_enabled != TRUE) ||
+ (is_currently_logging != TRUE))
TEST_ERROR;
/* Perform some manipulations */
- for(i = 0; i < N_GROUPS; i++) {
+ for (i = 0; i < N_GROUPS; i++) {
HDmemset(group_name, 0, sizeof(group_name));
HDsnprintf(group_name, sizeof(group_name), "%d", i);
- if((gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR;
}
/* Turn off logging and check flags */
- if(H5Fstop_mdc_logging(fid) < 0)
+ if (H5Fstop_mdc_logging(fid) < 0)
TEST_ERROR;
- is_enabled = FALSE;
+ is_enabled = FALSE;
is_currently_logging = TRUE;
- if((H5Fget_mdc_logging_status(fid, &is_enabled, &is_currently_logging) < 0)
- || (is_enabled != TRUE)
- || (is_currently_logging != FALSE))
+ if ((H5Fget_mdc_logging_status(fid, &is_enabled, &is_currently_logging) < 0) || (is_enabled != TRUE) ||
+ (is_currently_logging != FALSE))
TEST_ERROR;
/* Clean up */
HDfree(location);
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
PASSED();
@@ -139,7 +132,7 @@ test_logging_api(void)
error:
return 1;
- } /* test_logging_api() */
+} /* test_logging_api() */
/*-------------------------------------------------------------------------
* Function: main
@@ -163,9 +156,8 @@ main(void)
nerrors += test_logging_api();
- if(nerrors) {
- HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ if (nerrors) {
+ HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
HDexit(EXIT_FAILURE);
}
@@ -173,4 +165,3 @@ main(void)
HDexit(EXIT_SUCCESS);
}
-
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index e1187fb..b2975d1 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -15,14 +15,14 @@
*
* This file contains tests for metadata tagging.
*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
#include "H5Fpkg.h"
#include "testhdf5.h"
#include "cache_common.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5HLprivate.h"
#include "H5VLnative_private.h" /* Native VOL connector */
@@ -40,13 +40,13 @@
#define DATASETNAME "Dataset"
#define DATASETNAME2 "Dataset2"
#define LINKNAME "Link"
-#define RANK 2
-#define DIMS 32
+#define RANK 2
+#define DIMS 32
#define MULTIGROUPS 10
-#define TEST_DEFAULT 0
-#define TEST_SHMESG 1
+#define TEST_DEFAULT 0
+#define TEST_SHMESG 1
#define NUM_TEST_TYPES 2
/* ===================== */
@@ -92,12 +92,10 @@ static unsigned check_dense_attribute_tags(void);
static unsigned check_link_iteration_tags(void);
static unsigned check_invalid_tag_application(void);
-
/* ================ */
/* Helper Functions */
/* ================ */
-
#ifndef NDEBUG
/*-------------------------------------------------------------------------
@@ -115,16 +113,17 @@ static unsigned check_invalid_tag_application(void);
*
*-------------------------------------------------------------------------
*/
-static int dump_cache(hid_t fid)
+static int
+dump_cache(hid_t fid)
{
- H5F_t *f; /* File Pointer */
+ H5F_t *f; /* File Pointer */
/* Get Internal File / Cache Pointers */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR;
/* Dump the cache */
- if(H5AC_dump_cache(f) < 0)
+ if (H5AC_dump_cache(f) < 0)
TEST_ERROR;
return 0;
@@ -134,7 +133,6 @@ error:
} /* dump_cache */
#endif /* NDEBUG */ /* end debugging functions */
-
/*-------------------------------------------------------------------------
* Function: verify_no_unknown_tags()
*
@@ -155,26 +153,26 @@ static int
verify_no_unknown_tags(hid_t fid)
{
- H5F_t *f; /* File Pointer */
- H5C_t *cache_ptr; /* Cache Pointer */
- int i; /* Iterator */
+ H5F_t *f; /* File Pointer */
+ H5C_t *cache_ptr; /* Cache Pointer */
+ int i; /* Iterator */
/* Get Internal File / Cache Pointers */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR;
cache_ptr = f->shared->cache;
- for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
- H5C_cache_entry_t *entry_ptr; /* entry pointer */
+ for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
+ H5C_cache_entry_t *entry_ptr; /* entry pointer */
entry_ptr = cache_ptr->index[i];
- while(entry_ptr != NULL) {
- if(!entry_ptr->dirtied)
+ while (entry_ptr != NULL) {
+ if (!entry_ptr->dirtied)
TEST_ERROR;
entry_ptr = entry_ptr->ht_next;
} /* end if */
- } /* end for */
+ } /* end for */
return 0;
@@ -182,7 +180,6 @@ error:
return -1;
} /* verify_no_unknown_tags */
-
/*-------------------------------------------------------------------------
* Function: mark_all_entries_investigated()
*
@@ -203,26 +200,26 @@ error:
static int
mark_all_entries_investigated(hid_t fid)
{
- H5F_t *f; /* File Pointer */
- H5C_t *cache_ptr; /* Cache Pointer */
- int i; /* Iterator */
+ H5F_t *f; /* File Pointer */
+ H5C_t *cache_ptr; /* Cache Pointer */
+ int i; /* Iterator */
/* Get Internal File / Cache Pointers */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR;
cache_ptr = f->shared->cache;
- for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
- H5C_cache_entry_t *entry_ptr; /* entry pointer */
+ for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
+ H5C_cache_entry_t *entry_ptr; /* entry pointer */
entry_ptr = cache_ptr->index[i];
- while(entry_ptr != NULL) {
- if(!entry_ptr->dirtied)
+ while (entry_ptr != NULL) {
+ if (!entry_ptr->dirtied)
entry_ptr->dirtied = TRUE;
entry_ptr = entry_ptr->ht_next;
} /* end if */
- } /* end for */
+ } /* end for */
return 0;
@@ -230,7 +227,6 @@ error:
return -1;
} /* mark_all_entries_investigated */
-
/*-------------------------------------------------------------------------
* Function: reset_all_entries_investigated()
*
@@ -249,26 +245,26 @@ error:
static int
reset_all_entries_investigated(hid_t fid)
{
- H5F_t *f; /* File Pointer */
- H5C_t *cache_ptr; /* Cache Pointer */
- int i; /* Iterator */
+ H5F_t *f; /* File Pointer */
+ H5C_t *cache_ptr; /* Cache Pointer */
+ int i; /* Iterator */
/* Get Internal File / Cache Pointers */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR;
cache_ptr = f->shared->cache;
- for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
- H5C_cache_entry_t *entry_ptr; /* entry pointer */
+ for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
+ H5C_cache_entry_t *entry_ptr; /* entry pointer */
entry_ptr = cache_ptr->index[i];
- while(entry_ptr != NULL) {
- if(entry_ptr->dirtied)
+ while (entry_ptr != NULL) {
+ if (entry_ptr->dirtied)
entry_ptr->dirtied = FALSE;
entry_ptr = entry_ptr->ht_next;
} /* end if */
- } /* end for */
+ } /* end for */
return 0;
@@ -276,7 +272,6 @@ error:
return -1;
} /* reset_all_entries_investigated */
-
/*-------------------------------------------------------------------------
* Function: verify_tag()
*
@@ -297,22 +292,22 @@ error:
static int
verify_tag(hid_t fid, int id, haddr_t tag)
{
- H5F_t *f; /* File Pointer */
- H5C_t *cache_ptr; /* Cache Pointer */
- int i; /* Iterator */
+ H5F_t *f; /* File Pointer */
+ H5C_t *cache_ptr; /* Cache Pointer */
+ int i; /* Iterator */
/* Get Internal File / Cache Pointers */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR;
cache_ptr = f->shared->cache;
- for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
+ for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
H5C_cache_entry_t *entry_ptr; /* entry pointer */
entry_ptr = cache_ptr->index[i];
- while(entry_ptr != NULL) {
- if(entry_ptr->type->id == id && !entry_ptr->dirtied) {
- if(entry_ptr->tag_info->tag != tag)
+ while (entry_ptr != NULL) {
+ if (entry_ptr->type->id == id && !entry_ptr->dirtied) {
+ if (entry_ptr->tag_info->tag != tag)
TEST_ERROR;
/* Mark the entry/tag pair as found */
@@ -324,7 +319,7 @@ verify_tag(hid_t fid, int id, haddr_t tag)
entry_ptr = entry_ptr->ht_next;
} /* end if */
- } /* end for */
+ } /* end for */
/* Didn't find the tagged entry, throw an error */
TEST_ERROR;
@@ -339,27 +334,27 @@ error:
static int
evict_entries(hid_t fid)
{
- H5F_t *f; /* File Pointer */
+ H5F_t *f; /* File Pointer */
/* Get Internal File / Cache Pointers */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR;
/* Mark all entries investigated */
mark_all_entries_investigated(fid);
/* setup the skip list prior to calling H5C_flush_cache() */
- if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 )
+ if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0)
TEST_ERROR;
/* Evict all we can from the cache to examine full tag creation tree */
/* This function will likely return failure since the root group
- * is still protected. Thus, don't check its return value.
+ * is still protected. Thus, don't check its return value.
*/
H5C_flush_cache(f, H5C__FLUSH_INVALIDATE_FLAG);
/* shutdown the slist -- allow it to be non-empty */
- if ( H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0 )
+ if (H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0)
TEST_ERROR;
return 0;
@@ -368,7 +363,6 @@ error:
return -1;
} /* evict entries */
-
/*-------------------------------------------------------------------------
* Function: get_object_header_tag()
*
@@ -384,14 +378,14 @@ error:
static int
get_object_header_tag(hid_t loc_id, haddr_t *tag)
{
- H5O_info2_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
/* Retrieve the info for the object */
- if(H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR;
/* Set the tag to return */
- if(H5VLnative_token_to_addr(loc_id, oinfo.token, tag) < 0)
+ if (H5VLnative_token_to_addr(loc_id, oinfo.token, tag) < 0)
TEST_ERROR;
return 0;
@@ -400,7 +394,6 @@ error:
return -1;
} /* get_object_header_tag */
-
/*-------------------------------------------------------------------------
* Function: get_sbe_tag()
*
@@ -418,7 +411,7 @@ static int
get_sbe_tag(hid_t fid, haddr_t *tag)
{
/* Retrieve the superblock extension's object header address for the file */
- if(H5F__get_sbe_addr_test(fid, tag) < 0)
+ if (H5F__get_sbe_addr_test(fid, tag) < 0)
TEST_ERROR;
return 0;
@@ -431,7 +424,6 @@ error:
/* Test Functions */
/* ============== */
-
/*-------------------------------------------------------------------------
* Function: check_file_creation_tags
*
@@ -449,69 +441,85 @@ static unsigned
check_file_creation_tags(hid_t fcpl_id, int type)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
+ hid_t fid = -1; /* File Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose test outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t fapl = -1; /* File access prop list */
+ int verbose = FALSE; /* verbose test outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = 0;
- haddr_t sbe_tag = 0;
+ haddr_t sbe_tag = 0;
/* Testing Macro */
TESTING("tag application during file creation");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file with provided fcpl_t */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
#ifndef NDEBUG
/* if verbose, print cache index to screen before verification . */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* verify there is a superblock entry with superblock tag */
- if ( verify_tag(fid, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0)
+ TEST_ERROR;
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* determine tag value of superblock extension object header */
- if ( get_sbe_tag(fid, &sbe_tag) < 0 ) TEST_ERROR;
+ if (get_sbe_tag(fid, &sbe_tag) < 0)
+ TEST_ERROR;
/* verify object header belonging to superblock extension */
- if ( verify_tag(fid, H5AC_OHDR_ID, sbe_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, sbe_tag) < 0)
+ TEST_ERROR;
/* verify sohm master table with sohm tag */
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* verify object header chunk belonging to superblock extension */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, sbe_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, sbe_tag) < 0)
+ TEST_ERROR;
- } /* end if */
+ } /* end if */
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* verify object header belonging to superblock extension */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify local heap prefix belonging to root group */
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify b-tree node belonging to root group */
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify no other cache entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* Close the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
PASSED();
return 0;
@@ -520,7 +528,6 @@ error:
return 1;
} /* check_file_creation_tags */
-
/*-------------------------------------------------------------------------
* Function: check_file_open_tags
*
@@ -538,13 +545,13 @@ static unsigned
check_file_open_tags(hid_t fcpl, int type)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
+ hid_t fid = -1; /* File Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag; /* Root Group Tag */
- haddr_t sbe_tag; /* Sblock Extension Tag */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag; /* Root Group Tag */
+ haddr_t sbe_tag; /* Sblock Extension Tag */
/* Testing Macro */
TESTING("tag application during file open");
@@ -554,74 +561,90 @@ check_file_open_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file with provided fcpl_t */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Retrieve various tags */
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* determine tag value of superblock extension object header */
- if ( get_sbe_tag(fid, &sbe_tag) < 0 ) TEST_ERROR;
+ if (get_sbe_tag(fid, &sbe_tag) < 0)
+ TEST_ERROR;
} /* end if */
/* Close the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* =================== */
/* TEST: Open The File */
/* =================== */
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen before verification . */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* verify there is a superblock entry with superblock tag. */
- if ( verify_tag(fid, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0)
+ TEST_ERROR;
/* Verify test-type-dependent tags */
- if ( type == TEST_DEFAULT ) {
+ if (type == TEST_DEFAULT) {
/* verify there is an object header belonging to the root group. */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
-
- } else if ( type == TEST_SHMESG ) {
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ }
+ else if (type == TEST_SHMESG) {
/* verify there is a superblock extension object header. */
- if ( verify_tag(fid, H5AC_OHDR_ID, sbe_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, sbe_tag) < 0)
+ TEST_ERROR;
/* verify sohm master table with sohm tag */
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* verify object header chunk belonging to superblock extension */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, sbe_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, sbe_tag) < 0)
+ TEST_ERROR;
} /* end if */
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* ========== */
/* Close file */
/* ========== */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -634,7 +657,6 @@ error:
return 1;
} /* check_file_open_tags */
-
/*-------------------------------------------------------------------------
* Function: check_group_creation_tags
*
@@ -652,14 +674,14 @@ static unsigned
check_group_creation_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t gid = -1; /* Group Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t gid = -1; /* Group Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */
- haddr_t g_tag; /* Group Tag */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */
+ haddr_t g_tag; /* Group Tag */
/* Testing Macro */
TESTING("tag application during group creation");
@@ -669,62 +691,83 @@ check_group_creation_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file with provided fcpl_t */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Close and Reopen the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ==================== */
/* TEST: Create a Group */
/* ==================== */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group's tagged metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* Verify new group's tagged metadata */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify no other cache entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -737,7 +780,6 @@ error:
return 1;
} /* check_group_creation_tags */
-
/*-------------------------------------------------------------------------
* Function: check_multi_group_creation_tags
*
@@ -755,34 +797,38 @@ static unsigned
check_multi_group_creation_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t gid = -1; /* Group Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t gid = -1; /* Group Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- char gname[16]; /* group name buffer */
- int i = 0; /* iterator */
- hid_t fapl = -1; /* File access prop list */
- haddr_t g_tag = 0; /* Group tag value */
- haddr_t root_tag = 0; /* Root group tag value */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ char gname[16]; /* group name buffer */
+ int i = 0; /* iterator */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t g_tag = 0; /* Group tag value */
+ haddr_t root_tag = 0; /* Root group tag value */
/* Testing Macro */
TESTING("tag application during multiple group creation");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Set latest version of library */
- if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR;
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR;
/* =========== */
/* Create File */
/* =========== */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Clear Metadata Tags (don't care about them for this test) */
mark_all_entries_investigated(fid);
@@ -794,8 +840,10 @@ check_multi_group_creation_tags(void)
for (i = 0; i < MULTIGROUPS; i++) {
HDsprintf(gname, "%d", i);
- if ( (gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
} /* end for */
@@ -805,7 +853,8 @@ check_multi_group_creation_tags(void)
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify there is an object header for each group */
@@ -813,48 +862,63 @@ check_multi_group_creation_tags(void)
/* Re-open the group */
HDsprintf(gname, "%d", i);
- if ( (gid = H5Gopen2(fid, gname, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gopen2(fid, gname, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Verify object header for root group */
/* ('dirtied' flag on entry gets cleared with each open operation) */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
/* Retrieve the object address for the group */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Verify object header for group */
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
/* Close the group */
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
} /* end for */
/* Verify free space header and section info */
- if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FSPACE_SINFO_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_FSPACE_HDR_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify fractal heap header belonging to root group */
- if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_HDR_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify fractal heap direct block belonging to root group */
- if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify btree header and leaf node belonging to root group */
- if ( verify_tag(fid, H5AC_BT2_HDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_LEAF_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_HDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_LEAF_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -867,7 +931,6 @@ error:
return 1;
} /* check_multi_group_creation_tags */
-
/*-------------------------------------------------------------------------
* Function: check_link_iteration_tags
*
@@ -885,49 +948,59 @@ static unsigned
check_link_iteration_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t sid = -1; /* Group Identifier */
- hid_t did = -1; /* Group Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t sid = -1; /* Group Identifier */
+ hid_t did = -1; /* Group Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- int i = 0; /* iterator */
- haddr_t root_tag = 0; /* Root Group Tag Value */
- char dsetname[500]; /* Name of dataset */
- H5G_info_t ginfo; /* Group Info Struct */
- hid_t fapl = -1; /* File access prop list */
- hid_t root_group = -1; /* Root Group Identifier */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ int i = 0; /* iterator */
+ haddr_t root_tag = 0; /* Root Group Tag Value */
+ char dsetname[500]; /* Name of dataset */
+ H5G_info_t ginfo; /* Group Info Struct */
+ hid_t fapl = -1; /* File access prop list */
+ hid_t root_group = -1; /* Root Group Identifier */
/* Testing Macro */
TESTING("tag application during iteration over links in a group");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* =========== */
/* Create File */
/* =========== */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* Get root group tag */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create dataspace */
- if ( (sid = H5Screate(H5S_SCALAR)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR;
/* Create many datasets in root group */
- for (i=0;i<500;i++) {
+ for (i = 0; i < 500; i++) {
HDsprintf(dsetname, "Dset %d", i);
- if ( (did = H5Dcreate2(fid, dsetname, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, dsetname, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
}
/* Close and Reopen the file (to clear cache) */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* clear remaining metadata tags */
mark_all_entries_investigated(fid);
@@ -937,44 +1010,55 @@ check_link_iteration_tags(void)
/* ================================ */
/* Open root group */
- if ( (root_group = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((root_group = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get root group info (will iterate over all links in group) */
- if ( H5Gget_info(root_group, &ginfo) < 0 ) TEST_ERROR;
+ if (H5Gget_info(root_group, &ginfo) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group's tagged metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
/* Verify 112 symbol table nodes belonging to the root group */
for (i = 0; i < 112; i++)
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
/* Verify 9 b-tree nodes belonging to the root group */
for (i = 0; i < 9; i++)
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Sclose(sid) < 0 ) TEST_ERROR;
- if ( H5Gclose(root_group) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(root_group) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -987,7 +1071,6 @@ error:
return 1;
} /* check_link_iteration_tags */
-
/*-------------------------------------------------------------------------
* Function: check_dense_attribute_tags
*
@@ -1005,49 +1088,59 @@ static unsigned
check_dense_attribute_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t aid = -1; /* File Identifier */
- hid_t sid = -1; /* Group Identifier */
- hid_t did = -1; /* Group Identifier */
- hid_t dcpl = -1; /* Group Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t aid = -1; /* File Identifier */
+ hid_t sid = -1; /* Group Identifier */
+ hid_t did = -1; /* Group Identifier */
+ hid_t dcpl = -1; /* Group Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- int i = 0; /* iterator */
- hid_t fapl = -1; /* File access property list */
- haddr_t d_tag = 0; /* Dataset tag value */
- haddr_t root_tag = 0; /* Root group tag value */
- char attrname[500]; /* Name of attribute */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ int i = 0; /* iterator */
+ hid_t fapl = -1; /* File access property list */
+ haddr_t d_tag = 0; /* Dataset tag value */
+ haddr_t root_tag = 0; /* Root group tag value */
+ char attrname[500]; /* Name of attribute */
/* Testing Macro */
TESTING("tag application during dense attribute manipulation");
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
- if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR;
/* Create Dcpl */
- if ( (dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0 ) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* =========== */
/* Create File */
/* =========== */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create dataspace */
- if ( (sid = H5Screate(H5S_SCALAR)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR;
/* Create dataset */
- if ( (did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
/* get dataset object header */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* Clear Metadata Tags (don't care about them for this test */
mark_all_entries_investigated(fid);
@@ -1056,12 +1149,15 @@ check_dense_attribute_tags(void)
/* Create Many attributes, triggering dense storage */
/* ================================================ */
- for (i=0;i<50;i++) {
+ for (i = 0; i < 50; i++) {
HDsprintf(attrname, "attr %d", i);
- if ( (aid = H5Acreate2(did, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0 ) TEST_ERROR;
- if ( H5Aclose(aid) < 0 ) TEST_ERROR;
+ if ((aid = H5Acreate2(did, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
} /* end for */
@@ -1071,48 +1167,65 @@ check_dense_attribute_tags(void)
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify free space header and section info */
- if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FSPACE_SINFO_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_FSPACE_HDR_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify object header belonging to dataset */
- if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify fractal heap header belonging to dataset */
- if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_HDR_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify fractal heap direct block belonging to root group */
- if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify btree header and leaf node belonging to dataset */
- if ( verify_tag(fid, H5AC_BT2_HDR_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_INT_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_HDR_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_INT_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ======================= */
/* Reopen file and dataset */
/* ======================= */
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( (did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Clear Metadata Tags (don't care about them for this test */
mark_all_entries_investigated(fid);
@@ -1121,47 +1234,64 @@ check_dense_attribute_tags(void)
/* Open attribute by index */
/* ======================= */
- if ( (aid = H5Aopen_by_idx(did, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((aid = H5Aopen_by_idx(did, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* verify object header belonging to dataset */
- if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify fractal heap header belonging to dataset */
- if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_HDR_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify fractal heap direct block belonging to root group */
- if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_FHEAP_IBLOCK_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_IBLOCK_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify btree header and leaf node belonging to dataset */
- if ( verify_tag(fid, H5AC_BT2_HDR_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_INT_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_HDR_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_INT_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Aclose(aid) < 0 ) TEST_ERROR;
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -1174,7 +1304,6 @@ error:
return 1;
} /* check_dense_attribute_tags */
-
/*-------------------------------------------------------------------------
* Function: check_group_open_tags
*
@@ -1192,12 +1321,12 @@ static unsigned
check_group_open_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t gid = -1; /* Group Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t gid = -1; /* Group Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file output */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t fapl = -1; /* File access prop list */
+ int verbose = FALSE; /* verbose file output */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = HADDR_UNDEF;
haddr_t g_tag;
@@ -1209,68 +1338,89 @@ check_group_open_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file with provided fcpl_t */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Close Group */
- if (H5Gclose(gid) < 0) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
/* Close and Reopen the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ================ */
/* TEST: Open Group */
/* ================ */
- if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* Verify opened group metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -1283,7 +1433,6 @@ error:
return 1;
} /* check_group_open_tags */
-
/*-------------------------------------------------------------------------
* Function: check_attribute_creation_tags
*
@@ -1301,17 +1450,17 @@ static unsigned
check_attribute_creation_tags(hid_t fcpl, int type)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t aid = -1; /* Attribute Identifier */
- hid_t gid = -1; /* Group Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t aid = -1; /* Attribute Identifier */
+ hid_t gid = -1; /* Group Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0; /* Root group tag */
- haddr_t g_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0; /* Root group tag */
+ haddr_t g_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
/* Testing Macro */
@@ -1322,91 +1471,121 @@ check_attribute_creation_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file with provided fcpl_t */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and group */
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ========================= */
/* Create Attribute on Group */
/* ========================= */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
- if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* verify object header belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify object header chunk belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0)
+ TEST_ERROR;
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* verify (another) object header chunk belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify shared message index tagged with sohm */
- if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* verify fractal heap header belonging to group */
- if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* verify fractal heap direct block belonging to group */
- if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* Verify free space header and free space section */
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* verify btree header and leaf node belonging to group */
- if ( verify_tag(fid, H5AC_BT2_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_LEAF_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_HDR_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_LEAF_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
} /* end if */
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Aclose(aid) < 0 ) TEST_ERROR;
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -1419,7 +1598,6 @@ error:
return 1;
} /* check_attribute_creation_tags */
-
/*-------------------------------------------------------------------------
* Function: check_attribute_open_tags
*
@@ -1437,17 +1615,17 @@ static unsigned
check_attribute_open_tags(hid_t fcpl, int type)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t aid = -1; /* Attribute Identifier */
- hid_t gid = -1; /* Group Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t aid = -1; /* Attribute Identifier */
+ hid_t gid = -1; /* Group Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t g_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t g_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
/* Testing Macro */
@@ -1458,94 +1636,123 @@ check_attribute_open_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file with provided fcpl_t */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Create attribute dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create attribute on group */
- if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Close attribute */
- if ( H5Aclose(aid) < 0 ) TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and group */
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ========================= */
/* Open Attribute of Group */
/* ========================= */
- if ( (aid = H5Aopen(gid, ATTRNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((aid = H5Aopen(gid, ATTRNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* verify object header belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify object header chunk belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0)
+ TEST_ERROR;
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* verify (another) object header chunk belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify shared header message master table */
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* verify fractal heap header belonging to group */
- if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_HDR_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify fractal heap direct block belonging to group */
- if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify btree header and leaf node belonging to group */
- if ( verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_LEAF_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_LEAF_ID, g_tag) < 0)
+ TEST_ERROR;
} /* end if */
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Aclose(aid) < 0 ) TEST_ERROR;
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -1558,7 +1765,6 @@ error:
return 1;
} /* check_attribute_open_tags */
-
/*-------------------------------------------------------------------------
* Function: check_attribute_rename_tags
*
@@ -1576,20 +1782,20 @@ static unsigned
check_attribute_rename_tags(hid_t fcpl, int type)
{
/* Variable declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t gid = -1; /* Group Identifier */
- hid_t aid = -1; /* Attribute Identifier */
- hid_t sid = -1; /* Dataset Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t gid = -1; /* Group Identifier */
+ hid_t aid = -1; /* Attribute Identifier */
+ hid_t sid = -1; /* Dataset Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- int *data = NULL; /* data buffer */
- int i,j,k = 0; /* iterators */
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t g_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ int * data = NULL; /* data buffer */
+ int i, j, k = 0; /* iterators */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t g_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
hbool_t persistent_fsms = FALSE;
/* Testing Macro */
@@ -1600,125 +1806,162 @@ check_attribute_rename_tags(hid_t fcpl, int type)
/* ===== */
/* check to see if the FCPL specified persistent free space managers */
- if(H5Pget_file_space_strategy(fcpl, NULL, &persistent_fsms, NULL) < 0)
+ if (H5Pget_file_space_strategy(fcpl, NULL, &persistent_fsms, NULL) < 0)
TEST_ERROR;
/* Allocate array */
- if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
+ if ((NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))))
+ TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file with provided fcpl_t */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Set up attribute dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create attribute */
- if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* fill out data buffer */
- for(i = 0; i < DIMS; i++)
- for(j = 0; j < DIMS; j++)
+ for (i = 0; i < DIMS; i++)
+ for (j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
/* Write to attribute */
- if ( H5Awrite(aid, H5T_NATIVE_INT, data) < 0 ) TEST_ERROR;
+ if (H5Awrite(aid, H5T_NATIVE_INT, data) < 0)
+ TEST_ERROR;
/* Close Attribute */
- if ( H5Aclose(aid) < 0 ) TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and group */
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ========================= */
/* Rename Attribute of Group */
/* ========================= */
- if ( H5Arename_by_name(fid, GROUPNAME, ATTRNAME, ATTRNAME3, H5P_DEFAULT) < 0 ) TEST_ERROR;
+ if (H5Arename_by_name(fid, GROUPNAME, ATTRNAME, ATTRNAME3, H5P_DEFAULT) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify object header belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify object header chunk belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0)
+ TEST_ERROR;
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* verify (another) object header chunk belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify shared header message master table */
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* verify fractal heap header belonging to group */
- if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_HDR_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify fractal heap direct block belonging to group */
- if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify shared header message stored as a list */
- if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/*
* one freespace header tag for H5FD_MEM_DRAW manager,
* one freespace header tag for H5FD_MEM_SUPER manager
*/
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0)
+ TEST_ERROR;
/* verify btree header and leaf node belonging to group */
- if ( verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_LEAF_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_LEAF_ID, g_tag) < 0)
+ TEST_ERROR;
} /* end if */
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -1730,12 +1973,11 @@ check_attribute_rename_tags(hid_t fcpl, int type)
return 0;
error:
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* check_attribute_rename_tags */
-
/*-------------------------------------------------------------------------
* Function: check_attribute_delete_tags
*
@@ -1753,20 +1995,20 @@ static unsigned
check_attribute_delete_tags(hid_t fcpl, int type)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t gid = -1; /* Group Identifier */
- hid_t aid = -1; /* Attribute Identifier */
- hid_t sid = -1; /* Dataset Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t gid = -1; /* Group Identifier */
+ hid_t aid = -1; /* Attribute Identifier */
+ hid_t sid = -1; /* Dataset Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- int *data = NULL; /* data buffer */
- int i,j,k = 0; /* iterators */
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t g_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ int * data = NULL; /* data buffer */
+ int i, j, k = 0; /* iterators */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t g_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
hbool_t persistent_fsms = FALSE;
/* Testing Macro */
@@ -1777,77 +2019,97 @@ check_attribute_delete_tags(hid_t fcpl, int type)
/* ===== */
/* check to see if the FCPL specified persistent free space managers */
- if ( H5Pget_file_space_strategy(fcpl, NULL, &persistent_fsms, NULL) < 0 )
+ if (H5Pget_file_space_strategy(fcpl, NULL, &persistent_fsms, NULL) < 0)
TEST_ERROR;
/* Allocate array */
- if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
+ if ((NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))))
+ TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file with provided fcpl_t */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Set up attribute dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create attribute */
- if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* fill out data buffer */
- for(i = 0;i < DIMS; i++)
- for(j = 0;j < DIMS; j++)
+ for (i = 0; i < DIMS; i++)
+ for (j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
/* Write to attribute */
- if ( (H5Awrite(aid, H5T_NATIVE_INT, data)) < 0 ) TEST_ERROR;
+ if ((H5Awrite(aid, H5T_NATIVE_INT, data)) < 0)
+ TEST_ERROR;
/* Close Attribute */
- if ( H5Aclose(aid) < 0 ) TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and group */
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ========================= */
/* Delete Attribute of Group */
/* ========================= */
- if ( (H5Adelete(gid, ATTRNAME)) < 0 ) TEST_ERROR;
+ if ((H5Adelete(gid, ATTRNAME)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* verify object header belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* verify shared header message master table */
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/*
* 2 calls to verify_tag() for verifying free space:
@@ -1855,11 +2117,11 @@ check_attribute_delete_tags(hid_t fcpl, int type)
* one freespace header tag for free-space section info raw data
* one freespace header tag for free-space header metadata
*/
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 )
+ if (verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0)
TEST_ERROR;
- if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0 )
+ if (verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0)
TEST_ERROR;
- if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 )
+ if (verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0)
TEST_ERROR;
#if 0
@@ -1877,17 +2139,21 @@ check_attribute_delete_tags(hid_t fcpl, int type)
} /* end if */
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -1899,12 +2165,11 @@ check_attribute_delete_tags(hid_t fcpl, int type)
return 0;
error:
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* check_attribute_delete_tags */
-
/*-------------------------------------------------------------------------
* Function: check_dataset_creation_tags
*
@@ -1922,19 +2187,19 @@ static unsigned
check_dataset_creation_tags(hid_t fcpl, int type)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t did = -1; /* Dataset Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t did = -1; /* Dataset Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t dcpl = -1; /* dataset creation pl */
- hsize_t cdims[2] = {1,1}; /* chunk dimensions */
- int fillval = 0;
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t d_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t dcpl = -1; /* dataset creation pl */
+ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */
+ int fillval = 0;
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t d_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
/* Testing Macro */
@@ -1945,21 +2210,28 @@ check_dataset_creation_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Close and Reopen the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ============================ */
/* Create Dataset in Root Group */
@@ -1969,64 +2241,83 @@ check_dataset_creation_tags(hid_t fcpl, int type)
dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Enable chunking */
- if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ TEST_ERROR;
/* Set up a fill value */
- if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
/* Set up dataset dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create Dataset */
- if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* Get dataset's object header address */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* Verify object header for group */
- if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0)
+ TEST_ERROR;
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* verify shared header message master table */
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* Verify dataset's tagged metadata */
- if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* Verify shared object header message tags */
- if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
} /* end if */
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -2039,7 +2330,6 @@ error:
return 1;
} /* check_dataset_creation_tags */
-
/*-------------------------------------------------------------------------
* Function: check_dataset_creation_earlyalloc_tags
*
@@ -2057,21 +2347,21 @@ static unsigned
check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t did = -1; /* Dataset Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t did = -1; /* Dataset Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t dcpl = -1; /* dataset creation pl */
- hsize_t cdims[2] = {1,1}; /* chunk dimensions */
- int fillval = 0;
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t d_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t dcpl = -1; /* dataset creation pl */
+ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */
+ int fillval = 0;
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t d_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
- int i = 0; /* iterator */
+ int i = 0; /* iterator */
/* Testing Macro */
TESTING("tag application during dataset creation with early allocation");
@@ -2081,21 +2371,28 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Close and Reopen the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ============================ */
/* Create Dataset in Root Group */
@@ -2103,69 +2400,90 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type)
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ TEST_ERROR;
- if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
/* Set early allocation time */
- if ( H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0 ) TEST_ERROR;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR;
/* Set up dataset dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
- if (( did = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* Get dataset's object header address */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* Verify object header for group */
- if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0)
+ TEST_ERROR;
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* verify shared header message master table */
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* Verify dataset's tagged metadata */
- if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* Verify shared object header message tags */
- if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
} /* end if */
/* Verify 19 b-tree nodes belonging to dataset */
- for (i=0; i<19; i++)
- if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR;
+ for (i = 0; i < 19; i++)
+ if (verify_tag(fid, H5AC_BT_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -2178,7 +2496,6 @@ error:
return 1;
} /* check_dataset_creation_earlyalloc_tags */
-
/*-------------------------------------------------------------------------
* Function: check_dataset_open_tags
*
@@ -2196,19 +2513,19 @@ static unsigned
check_dataset_open_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t did = -1; /* Dataset Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t did = -1; /* Dataset Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t dcpl = -1; /* dataset creation pl */
- hsize_t cdims[2] = {1,1}; /* chunk dimensions */
- int fillval = 0;
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t d_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t dcpl = -1; /* dataset creation pl */
+ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */
+ int fillval = 0;
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t d_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
/* Testing Macro */
@@ -2219,81 +2536,106 @@ check_dataset_open_tags(void)
/* ========= */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Set up creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Enable chunking */
- if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ TEST_ERROR;
/* Set up a fill value */
- if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
/* Set up dataset dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create Dataset */
- if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
/* Retrieve tag associated with this dataset */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* Close Dataset */
- if (H5Dclose(did) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
/* Close and Reopen the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ========================== */
/* Open Dataset in Root Group */
/* ========================== */
- if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* Verify dataset's object header */
- if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -2306,7 +2648,6 @@ error:
return 1;
} /* check_dataset_open_tags */
-
/*-------------------------------------------------------------------------
* Function: check_dataset_write_tags
*
@@ -2324,22 +2665,22 @@ static unsigned
check_dataset_write_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t did = -1; /* Dataset Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t did = -1; /* Dataset Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t dcpl = -1; /* dataset creation pl */
- hsize_t cdims[2] = {1,1}; /* chunk dimensions */
- int fillval = 0;
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t d_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t dcpl = -1; /* dataset creation pl */
+ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */
+ int fillval = 0;
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t d_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
- int i,j,k = 0; /* iterators */
- int *data = NULL; /* data buffer */
+ int i, j, k = 0; /* iterators */
+ int * data = NULL; /* data buffer */
/* Testing Macro */
TESTING("tag application during dataset write");
@@ -2349,90 +2690,114 @@ check_dataset_write_tags(void)
/* ===== */
/* Allocate array */
- if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
+ if ((NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))))
+ TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Set up creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Enable chunking */
- if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ TEST_ERROR;
/* Set up a fill value */
- if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
/* Set up dataset dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create Dataset */
- if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
/* Retrieve tag associated with this dataset */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and dataset */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ============================== */
/* Write to Dataset in Root Group */
/* ============================== */
/* fill out data buffer */
- for(i = 0;i < DIMS; i++) {
- for(j = 0;j < DIMS; j++) {
+ for (i = 0; i < DIMS; i++) {
+ for (j = 0; j < DIMS; j++) {
- data[(DIMS *i) + j] = k++;
+ data[(DIMS * i) + j] = k++;
} /* end for */
- } /* end for */
+ } /* end for */
/* Write to dataset */
- if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
+ if ((H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify 10 b-tree nodes belonging to dataset */
- for (i=0; i<10; i++)
- if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR;
+ for (i = 0; i < 10; i++)
+ if (verify_tag(fid, H5AC_BT_ID, d_tag) < 0)
+ TEST_ERROR;
/* Verify object header for dataset */
- if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -2444,12 +2809,11 @@ check_dataset_write_tags(void)
return 0;
error:
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* check_dataset_write_tags */
-
/*-------------------------------------------------------------------------
* Function: check_attribute_write_tags
*
@@ -2467,19 +2831,19 @@ static unsigned
check_attribute_write_tags(hid_t fcpl, int type)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t gid = -1; /* Group Identifier */
- hid_t aid = -1; /* Attribute Identifier */
- hid_t sid = -1; /* Dataset Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t gid = -1; /* Group Identifier */
+ hid_t aid = -1; /* Attribute Identifier */
+ hid_t sid = -1; /* Dataset Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- int *data = NULL; /* data buffer */
- int i,j,k = 0; /* iterators */
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t g_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ int * data = NULL; /* data buffer */
+ int i, j, k = 0; /* iterators */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t g_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
/* Testing Macro */
@@ -2490,105 +2854,137 @@ check_attribute_write_tags(hid_t fcpl, int type)
/* ===== */
/* Allocate array */
- if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
+ if ((NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))))
+ TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file with provided fcpl_t */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Create attribute dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create attribute on group */
- if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Close and Reopen the file, group, and attribute */
- if ( H5Aclose(aid) < 0 ) TEST_ERROR;
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( (aid = H5Aopen(gid, ATTRNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((aid = H5Aopen(gid, ATTRNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Write to Attribute in Group */
/* =========================== */
/* fill out data buffer */
- for(i = 0; i < DIMS; i++)
- for(j = 0;j < DIMS; j++)
+ for (i = 0; i < DIMS; i++)
+ for (j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
/* Write attribute */
- if ( (H5Awrite(aid, H5T_NATIVE_INT, data)) < 0 ) TEST_ERROR;
+ if ((H5Awrite(aid, H5T_NATIVE_INT, data)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify object header of group */
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify object header chunk belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0)
+ TEST_ERROR;
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* verify (another) object header chunk belonging to group */
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify shared header message master table and list */
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* verify fractal heap header belonging to group */
- if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_HDR_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify fractal heap direct block belonging to group */
- if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, g_tag) < 0)
+ TEST_ERROR;
/* Verify SOHM list */
- if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
/* verify btree header and leaf node belonging to group */
- if ( verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT2_LEAF_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT2_LEAF_ID, g_tag) < 0)
+ TEST_ERROR;
} /* end if */
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Aclose(aid) < 0 ) TEST_ERROR;
- if ( H5Gclose(gid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -2600,12 +2996,11 @@ check_attribute_write_tags(hid_t fcpl, int type)
return 0;
error:
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* check_attribute_write_tags */
-
/*-------------------------------------------------------------------------
* Function: check_dataset_read_tags
*
@@ -2623,22 +3018,22 @@ static unsigned
check_dataset_read_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t did = -1; /* Dataset Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t did = -1; /* Dataset Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t dcpl = -1; /* dataset creation pl */
- hsize_t cdims[2] = {1,1}; /* chunk dimensions */
- int fillval = 0;
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t d_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t dcpl = -1; /* dataset creation pl */
+ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */
+ int fillval = 0;
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t d_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
- int i,j,k = 0; /* iterators */
- int *data = NULL; /* data buffer */
+ int i, j, k = 0; /* iterators */
+ int * data = NULL; /* data buffer */
/* Testing Macro */
TESTING("tag application during dataset read");
@@ -2648,86 +3043,110 @@ check_dataset_read_tags(void)
/* ===== */
/* Allocate array */
- if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
+ if ((NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))))
+ TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Set up creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Enable chunking */
- if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ TEST_ERROR;
/* Set up a fill value */
- if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
/* Set up dataset dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create Dataset */
- if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
/* Retrieve tag associated with this dataset */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* fill out data buffer */
- for(i = 0; i < DIMS; i++)
- for(j = 0; j < DIMS; j++)
+ for (i = 0; i < DIMS; i++)
+ for (j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
/* Write to dataset */
- if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
+ if ((H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and dataset */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ===================================== */
/* TEST: Read from Dataset in Root Group */
/* ===================================== */
- if( (H5Dread(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
+ if ((H5Dread(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify 19 b-tree nodes belonging to dataset */
- for (i=0; i<19; i++)
- if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR;
+ for (i = 0; i < 19; i++)
+ if (verify_tag(fid, H5AC_BT_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -2739,12 +3158,11 @@ check_dataset_read_tags(void)
return 0;
error:
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* check_dataset_read_tags */
-
/*-------------------------------------------------------------------------
* Function: check_dataset_size_retrieval
*
@@ -2762,22 +3180,22 @@ static unsigned
check_dataset_size_retrieval(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t did = -1; /* Dataset Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t did = -1; /* Dataset Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t dcpl = -1; /* dataset creation pl */
- hsize_t cdims[2] = {1,1}; /* chunk dimensions */
- int fillval = 0;
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t d_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t dcpl = -1; /* dataset creation pl */
+ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */
+ int fillval = 0;
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t d_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
- int i,j,k = 0; /* iterators */
- int *data = NULL; /* data buffer */
+ int i, j, k = 0; /* iterators */
+ int * data = NULL; /* data buffer */
hsize_t dsize = 0;
/* Testing Macro */
@@ -2788,86 +3206,110 @@ check_dataset_size_retrieval(void)
/* ===== */
/* Allocate array */
- if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
+ if ((NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))))
+ TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Set up creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Enable chunking */
- if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ TEST_ERROR;
/* Set up a fill value */
- if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
/* Set up dataset dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create Dataset */
- if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
/* Retrieve tag associated with this dataset */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* fill out data buffer */
- for(i = 0; i < DIMS; i++)
- for(j = 0; j < DIMS; j++)
+ for (i = 0; i < DIMS; i++)
+ for (j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
/* Write to dataset */
- if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
+ if ((H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and dataset */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ========================================= */
/* Get storage size of dataset in Root Group */
/* ========================================= */
- if ( (dsize = H5Dget_storage_size(did)) == 0 ) TEST_ERROR;
+ if ((dsize = H5Dget_storage_size(did)) == 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify 19 b-tree nodes belonging to dataset */
- for (i=0; i<19; i++)
- if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR;
+ for (i = 0; i < 19; i++)
+ if (verify_tag(fid, H5AC_BT_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -2879,12 +3321,11 @@ check_dataset_size_retrieval(void)
return 0;
error:
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* check_dataset_size_retrieval */
-
/*-------------------------------------------------------------------------
* Function: check_dataset_extend_tags
*
@@ -2903,23 +3344,23 @@ check_dataset_extend_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t did = -1; /* Dataset Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t did = -1; /* Dataset Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t dcpl = -1; /* dataset creation pl */
- hsize_t cdims[2] = {1,1}; /* chunk dimensions */
- int fillval = 0;
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t d_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t dcpl = -1; /* dataset creation pl */
+ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */
+ int fillval = 0;
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t d_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
- int i,j,k = 0; /* iterators */
- int *data = NULL; /* data buffer */
- hsize_t newdims[2] = {DIMS*2, DIMS}; /* dimensions */
+ int i, j, k = 0; /* iterators */
+ int * data = NULL; /* data buffer */
+ hsize_t newdims[2] = {DIMS * 2, DIMS}; /* dimensions */
/* Testing Macro */
TESTING("tag application during dataset extend");
@@ -2929,86 +3370,110 @@ check_dataset_extend_tags(void)
/* ===== */
/* Allocate array */
- if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
+ if ((NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))))
+ TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Set up creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Enable chunking */
- if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ TEST_ERROR;
/* Set up a fill value */
- if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
/* Set up dataset dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create Dataset */
- if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
/* Retrieve tag associated with this dataset */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* fill out data buffer */
- for(i = 0; i < DIMS; i++)
- for(j = 0; j < DIMS; j++)
+ for (i = 0; i < DIMS; i++)
+ for (j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
/* Write to dataset */
- if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
+ if ((H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and dataset */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ================== */
/* Set Dataset extent */
/* ================== */
- if ( H5Dset_extent(did, newdims) < 0 ) TEST_ERROR;
+ if (H5Dset_extent(did, newdims) < 0)
+ TEST_ERROR;
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -3020,12 +3485,11 @@ check_dataset_extend_tags(void)
return 0;
error:
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* check_dataset_extend_tags */
-
/*-------------------------------------------------------------------------
* Function: check_object_info_tags
*
@@ -3043,15 +3507,15 @@ static unsigned
check_object_info_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t gid = -1; /* Group Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t gid = -1; /* Group Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file output */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = HADDR_UNDEF;
- haddr_t g_tag;
- H5O_native_info_t ninfo; /* Native object info struct */
+ int verbose = FALSE; /* verbose file output */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = HADDR_UNDEF;
+ haddr_t g_tag;
+ H5O_native_info_t ninfo; /* Native object info struct */
/* Testing Macro */
TESTING("tag application during object info retrieval");
@@ -3061,31 +3525,41 @@ check_object_info_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Close Group */
- if (H5Gclose(gid) < 0) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
/* Close and Reopen the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ===================================== */
/* Get information on an object by name */
@@ -3094,39 +3568,51 @@ check_object_info_tags(void)
/* Even though we do nothing with this, touching the internal
* data structures is needed for the test to pass.
*/
- if ( H5Oget_native_info_by_name(fid, GROUPNAME, &ninfo, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR;
+ if (H5Oget_native_info_by_name(fid, GROUPNAME, &ninfo, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group's tagged metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* Verify dataset's tagged metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -3139,7 +3625,6 @@ error:
return 1;
} /* check_object_info_tags */
-
/*-------------------------------------------------------------------------
* Function: check_object_copy_tags
*
@@ -3157,12 +3642,12 @@ static unsigned
check_object_copy_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t gid = -1; /* Group Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t gid = -1; /* Group Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file output */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t fapl = -1; /* File access prop list */
+ int verbose = FALSE; /* verbose file output */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = HADDR_UNDEF;
haddr_t g_tag;
haddr_t copy_tag;
@@ -3175,79 +3660,107 @@ check_object_copy_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Close Group */
- if (H5Gclose(gid) < 0) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
/* Close and Reopen the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* =========== */
/* Copy Group */
/* =========== */
- if ( H5Ocopy(fid, GROUPNAME, fid, GROUPNAMECOPY, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if (H5Ocopy(fid, GROUPNAME, fid, GROUPNAMECOPY, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR;
/* Get tag for copied group */
- if ( (gid = H5Gopen2(fid, GROUPNAMECOPY, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( get_object_header_tag(gid, &copy_tag) < 0 ) TEST_ERROR;
- if (H5Gclose(gid) < 0) TEST_ERROR;
+ if ((gid = H5Gopen2(fid, GROUPNAMECOPY, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (get_object_header_tag(gid, &copy_tag) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group's tagged metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* Verify group's tagged metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, g_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, g_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0)
+ TEST_ERROR;
/* Verify copied group's tagged metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, copy_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, copy_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, copy_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, copy_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, copy_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, copy_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -3260,7 +3773,6 @@ error:
return 1;
} /* check_object_copy_tags */
-
/*-------------------------------------------------------------------------
* Function: check_link_removal_tags
*
@@ -3278,24 +3790,24 @@ static unsigned
check_link_removal_tags(hid_t fcpl, int type)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t did = -1; /* Dataset Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
- hid_t gid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t did = -1; /* Dataset Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
+ hid_t gid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t dcpl = -1; /* dataset creation pl */
- hsize_t cdims[2] = {1,1}; /* chunk dimensions */
- int fillval = 0;
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t d_tag = 0;
- haddr_t g_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t dcpl = -1; /* dataset creation pl */
+ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */
+ int fillval = 0;
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t d_tag = 0;
+ haddr_t g_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
- int i,j,k = 0; /* iterators */
- int *data = NULL; /* data buffer */
+ int i, j, k = 0; /* iterators */
+ int * data = NULL; /* data buffer */
/* Testing Macro */
TESTING("tag application during link removal");
@@ -3305,105 +3817,134 @@ check_link_removal_tags(hid_t fcpl, int type)
/* ===== */
/* Allocate array */
- if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
+ if ((NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))))
+ TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Close Group */
- if (H5Gclose(gid) < 0) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
/* Set up creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Enable chunking */
- if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ TEST_ERROR;
/* Set up a fill value */
- if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
/* Set up dataset dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create Dataset */
- if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
/* Retrieve tag associated with this dataset */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* fill out data buffer */
- for(i = 0; i < DIMS; i++)
- for(j = 0; j < DIMS; j++)
+ for (i = 0; i < DIMS; i++)
+ for (j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
/* Write to dataset */
- if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
+ if ((H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0)
+ TEST_ERROR;
/* Close Dataset */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and dataset */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ================================ */
/* Remove link to group and dataset */
/* ================================ */
- if ( (H5Ldelete(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((H5Ldelete(fid, GROUPNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if ( (H5Ldelete(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((H5Ldelete(fid, DATASETNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group's tagged metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
- if ( type == TEST_SHMESG ) {
+ if (type == TEST_SHMESG) {
/* verify shared header message master table */
- if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0)
+ TEST_ERROR;
} /* end if */
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -3415,12 +3956,11 @@ check_link_removal_tags(hid_t fcpl, int type)
return 0;
error:
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* check_link_removal_tags */
-
/*-------------------------------------------------------------------------
* Function: check_link_getname_tags
*
@@ -3438,25 +3978,25 @@ static unsigned
check_link_getname_tags(void)
{
/* Variable Declarations */
- char name[500];
- hid_t fid = -1; /* File Identifier */
- hid_t did = -1; /* Dataset Identifier */
- hid_t sid = -1; /* Dataspace Identifier */
- hid_t gid = -1; /* Dataspace Identifier */
+ char name[500];
+ hid_t fid = -1; /* File Identifier */
+ hid_t did = -1; /* Dataset Identifier */
+ hid_t sid = -1; /* Dataspace Identifier */
+ hid_t gid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t dcpl = -1; /* dataset creation pl */
- hsize_t cdims[2] = {1,1}; /* chunk dimensions */
- int fillval = 0;
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t d_tag = 0;
- haddr_t g_tag = 0;
- hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t dcpl = -1; /* dataset creation pl */
+ hsize_t cdims[2] = {1, 1}; /* chunk dimensions */
+ int fillval = 0;
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t d_tag = 0;
+ haddr_t g_tag = 0;
+ hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */
- int i,j,k = 0; /* iterators */
- int *data = NULL; /* data buffer */
+ int i, j, k = 0; /* iterators */
+ int * data = NULL; /* data buffer */
/* Testing Macro */
TESTING("tag application during link name retrieval");
@@ -3466,64 +4006,83 @@ check_link_getname_tags(void)
/* ===== */
/* Allocate array */
- if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR;
+ if ((NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))))
+ TEST_ERROR;
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create group */
- if ( (gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Retrieve group tag */
- if ( get_object_header_tag(gid, &g_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(gid, &g_tag) < 0)
+ TEST_ERROR;
/* Close Group */
- if (H5Gclose(gid) < 0) TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
/* Set up creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Enable chunking */
- if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ TEST_ERROR;
/* Set up a fill value */
- if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
/* Set up dataset dataspace */
- if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims1, maxdims)) < 0)
+ TEST_ERROR;
/* Create Dataset */
- if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( H5Pclose(dcpl) < 0 ) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
/* Retrieve tag associated with this dataset */
- if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(did, &d_tag) < 0)
+ TEST_ERROR;
/* fill out data buffer */
- for(i = 0; i < DIMS; i++)
- for(j = 0; j < DIMS; j++)
+ for (i = 0; i < DIMS; i++)
+ for (j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
/* Write to dataset */
- if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
+ if ((H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0)
+ TEST_ERROR;
/* Close Dataset */
- if ( H5Dclose(did) < 0 ) TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
/* Close and Reopen the file and dataset */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Get name by index location. */
@@ -3537,26 +4096,34 @@ check_link_getname_tags(void)
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group's tagged metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -3568,12 +4135,11 @@ check_link_getname_tags(void)
return 0;
error:
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* check_link_getname_tags */
-
/*-------------------------------------------------------------------------
* Function: check_external_link_creation_tags
*
@@ -3591,13 +4157,13 @@ static unsigned
check_external_link_creation_tags(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File Identifier */
- hid_t fid2 = -1; /* File Identifier */
- hid_t gid = -1; /* Dataspace Identifier */
+ hid_t fid = -1; /* File Identifier */
+ hid_t fid2 = -1; /* File Identifier */
+ hid_t gid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- hid_t fapl = -1; /* File access prop list */
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = 0;
/* Testing Macro */
@@ -3608,65 +4174,85 @@ check_external_link_creation_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Close and Reopen the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* Create a second file */
- if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* Create group in second file */
- if ( (gid = H5Gcreate2(fid2, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid2, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Close out second file */
- if ( (H5Gclose(gid)) < 0 ) TEST_ERROR;
- if ( (H5Fclose(fid2)) < 0 ) TEST_ERROR;
+ if ((H5Gclose(gid)) < 0)
+ TEST_ERROR;
+ if ((H5Fclose(fid2)) < 0)
+ TEST_ERROR;
/* ==================== */
/* Create External Link */
/* ==================== */
- if (H5Lcreate_external(FILENAME2, GROUPNAMEPATH, fid, LINKNAME, H5P_DEFAULT, H5P_DEFAULT) < 0 ) TEST_ERROR;
+ if (H5Lcreate_external(FILENAME2, GROUPNAMEPATH, fid, LINKNAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* Verify root group metadata */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_BT_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -3679,7 +4265,6 @@ error:
return 1;
} /* check_external_link_creation_tags */
-
/*-------------------------------------------------------------------------
* Function: check_external_link_open_tags
*
@@ -3697,18 +4282,18 @@ static unsigned
check_external_link_open_tags(void)
{
/* Variable Declarations */
- haddr_t link_tag = 0; /* link tag */
- hid_t fid = -1; /* File Identifier */
- hid_t fid2 = -1; /* File Identifier */
- hid_t gid = -1; /* Dataspace Identifier */
- hid_t xid = -1; /* Dataspace Identifier */
+ haddr_t link_tag = 0; /* link tag */
+ hid_t fid = -1; /* File Identifier */
+ hid_t fid2 = -1; /* File Identifier */
+ hid_t gid = -1; /* Dataspace Identifier */
+ hid_t xid = -1; /* Dataspace Identifier */
#ifndef NDEBUG
- int verbose = FALSE; /* verbose file outout */
-#endif /* NDEBUG */ /* end debugging functions */
- H5O_native_info_t ninfo; /* Native object info struct */
- hid_t fapl = -1; /* File access prop list */
- haddr_t root_tag = 0;
- haddr_t root2_tag = 0;
+ int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ H5O_native_info_t ninfo; /* Native object info struct */
+ hid_t fapl = -1; /* File access prop list */
+ haddr_t root_tag = 0;
+ haddr_t root2_tag = 0;
/* Testing Macro */
TESTING("tag application during external link open");
@@ -3718,93 +4303,128 @@ check_external_link_open_tags(void)
/* ===== */
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid, &root_tag) < 0)
+ TEST_ERROR;
/* Create a second file */
- if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* determine tag value of root group's object header */
- if ( get_object_header_tag(fid2, &root2_tag) < 0 ) TEST_ERROR;
+ if (get_object_header_tag(fid2, &root2_tag) < 0)
+ TEST_ERROR;
/* Create group in second file */
- if ( (gid = H5Gcreate2(fid2, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid2, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Close out second file */
- if ( (H5Gclose(gid)) < 0 ) TEST_ERROR;
- if ( (H5Fclose(fid2)) < 0 ) TEST_ERROR;
+ if ((H5Gclose(gid)) < 0)
+ TEST_ERROR;
+ if ((H5Fclose(fid2)) < 0)
+ TEST_ERROR;
/* Create external link to second file */
- if ( H5Lcreate_external(FILENAME2, GROUPNAMEPATH, fid, LINKNAME, H5P_DEFAULT, H5P_DEFAULT) < 0 ) TEST_ERROR;
+ if (H5Lcreate_external(FILENAME2, GROUPNAMEPATH, fid, LINKNAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR;
/* Close and Reopen the file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* Evict as much as we can from the cache so we can track full tag path */
- if ( evict_entries(fid) < 0 ) TEST_ERROR;
+ if (evict_entries(fid) < 0)
+ TEST_ERROR;
/* ================== */
/* Open External Link */
/* ================== */
- if ( (xid = H5Gopen2(fid, LINKNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
- if ( (fid2 = H5Iget_file_id(xid)) < 0) TEST_ERROR;
- if ( get_object_header_tag(xid, &link_tag) < 0 ) TEST_ERROR;
+ if ((xid = H5Gopen2(fid, LINKNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((fid2 = H5Iget_file_id(xid)) < 0)
+ TEST_ERROR;
+ if (get_object_header_tag(xid, &link_tag) < 0)
+ TEST_ERROR;
/* Even though we do nothing with this, touching the internal
* data structures is needed for the test to pass.
*/
- if ( H5Oget_native_info(xid, &ninfo, H5O_NATIVE_INFO_ALL) < 0 ) TEST_ERROR;
+ if (H5Oget_native_info(xid, &ninfo, H5O_NATIVE_INFO_ALL) < 0)
+ TEST_ERROR;
- /* =================================== */
- /* Verification of Metadata Tag Values */
- /* =================================== */
+ /* =================================== */
+ /* Verification of Metadata Tag Values */
+ /* =================================== */
#ifndef NDEBUG
/* if verbose, print cache index to screen for visual verification */
- if ( verbose ) dump_cache(fid);
+ if (verbose)
+ dump_cache(fid);
#endif /* NDEBUG */ /* end debugging functions */
/* verify tag value of first file's root group */
- if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid, H5AC_OHDR_CHK_ID, root_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid, H5AC_OHDR_CHK_ID, root_tag) < 0)
+ TEST_ERROR;
/* verify there is a superblock entry with superblock tag. */
- if ( verify_tag(fid2, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0 ) TEST_ERROR;
+ if (verify_tag(fid2, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0)
+ TEST_ERROR;
/* verify tag value of linked file's root group */
- if ( verify_tag(fid2, H5AC_OHDR_ID, root2_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid2, H5AC_LHEAP_PRFX_ID, root2_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid2, H5AC_BT_ID, root2_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid2, H5AC_SNODE_ID, root2_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid2, H5AC_OHDR_ID, root2_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid2, H5AC_LHEAP_PRFX_ID, root2_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid2, H5AC_BT_ID, root2_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid2, H5AC_SNODE_ID, root2_tag) < 0)
+ TEST_ERROR;
/* verify tag value of linked group's object header */
- if ( verify_tag(fid2, H5AC_OHDR_ID, link_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid2, H5AC_LHEAP_PRFX_ID, link_tag) < 0 ) TEST_ERROR;
- if ( verify_tag(fid2, H5AC_BT_ID, link_tag) < 0 ) TEST_ERROR;
+ if (verify_tag(fid2, H5AC_OHDR_ID, link_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid2, H5AC_LHEAP_PRFX_ID, link_tag) < 0)
+ TEST_ERROR;
+ if (verify_tag(fid2, H5AC_BT_ID, link_tag) < 0)
+ TEST_ERROR;
/* verify no other entries present */
- if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
- if ( verify_no_unknown_tags(fid2) < 0 ) TEST_ERROR;
+ if (verify_no_unknown_tags(fid) < 0)
+ TEST_ERROR;
+ if (verify_no_unknown_tags(fid2) < 0)
+ TEST_ERROR;
/* Reset the changes we've made to the cache's data structures */
- if(reset_all_entries_investigated(fid) < 0) TEST_ERROR;
- if(reset_all_entries_investigated(fid2) < 0) TEST_ERROR;
+ if (reset_all_entries_investigated(fid) < 0)
+ TEST_ERROR;
+ if (reset_all_entries_investigated(fid2) < 0)
+ TEST_ERROR;
/* =========================== */
/* Close open objects and file */
/* =========================== */
- if ( H5Gclose(xid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
- if ( H5Fclose(fid2) < 0 ) TEST_ERROR;
+ if (H5Gclose(xid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR;
/* ========================================== */
/* Finished Test. Print status and return. */
@@ -3817,7 +4437,6 @@ error:
return 1;
} /* check_external_link_open_tags */
-
/*-------------------------------------------------------------------------
* Function: check_invalid_tag_application
*
@@ -3837,65 +4456,77 @@ check_invalid_tag_application(void)
{
#if H5C_DO_TAGGING_SANITY_CHECKS
/* Variables */
- H5F_t * f = NULL;
- hid_t fid = -1;
+ H5F_t * f = NULL;
+ hid_t fid = -1;
haddr_t addr;
- H5HL_t * lheap = NULL;
- hid_t fapl = -1; /* File access prop list */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
-#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
+ H5HL_t *lheap = NULL;
+ hid_t fapl = -1; /* File access prop list */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
/* Testing Macro */
TESTING("failure on invalid tag application");
#if H5C_DO_TAGGING_SANITY_CHECKS
/* Create Fapl */
- if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR;
+ if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR;
/* Create a test file */
- if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
- if ( H5Pclose(fapl) < 0 ) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
/* Push API context */
- if(H5CX_push() < 0) TEST_ERROR
+ if (H5CX_push() < 0)
+ TEST_ERROR
api_ctx_pushed = TRUE;
/* Get internal file pointer*/
- if ( NULL == (f = (H5F_t *)H5VL_object(fid)) ) TEST_ERROR;
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
+ TEST_ERROR;
/* Call H5HL_create, an internal function that calls H5AC_insert_entry without setting up a tag */
/* Ensure this returns FAILURE, as a tag has not been set up. */
- if ( H5HL_create(f, (size_t)1024, &addr) >= 0) TEST_ERROR;
+ if (H5HL_create(f, (size_t)1024, &addr) >= 0)
+ TEST_ERROR;
/* Now set up a tag in the API context */
H5AC_tag((haddr_t)25, NULL);
/* Verify the same call to H5HL_create now works as intended, with a tag set up. */
- if ( H5HL_create(f, (size_t)1024, &addr) < 0) TEST_ERROR;
+ if (H5HL_create(f, (size_t)1024, &addr) < 0)
+ TEST_ERROR;
/* Reset API context to use invalid tag. */
H5AC_tag(H5AC__INVALID_TAG, NULL);
/* Call H5HL_protect to protect the local heap created above. */
/* This should fail as no tag is set up during the protect call */
- if (( lheap = H5HL_protect(f, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR;
+ if ((lheap = H5HL_protect(f, addr, H5AC__NO_FLAGS_SET)) != NULL)
+ TEST_ERROR;
/* Again, set up a valid tag in the API context */
H5AC_tag((haddr_t)25, NULL);
/* Call H5HL_protect again to protect the local heap. This should succeed. */
- if (( lheap = H5HL_protect(f, addr, H5AC__NO_FLAGS_SET)) == NULL ) TEST_ERROR;
+ if ((lheap = H5HL_protect(f, addr, H5AC__NO_FLAGS_SET)) == NULL)
+ TEST_ERROR;
/* Now unprotect the heap, as we're done with the test. */
- if ( H5HL_unprotect(lheap) < 0 ) TEST_ERROR;
+ if (H5HL_unprotect(lheap) < 0)
+ TEST_ERROR;
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) TEST_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ TEST_ERROR
api_ctx_pushed = FALSE;
/* Close open objects and file */
- if ( H5Fclose(fid) < 0 ) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* Finished Test. Print status and return. */
PASSED();
@@ -3908,14 +4539,14 @@ check_invalid_tag_application(void)
#if H5C_DO_TAGGING_SANITY_CHECKS
error:
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
return 1;
#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
} /* check_invalid_tag_application */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -3932,11 +4563,11 @@ int
main(void)
{
/* Variable Declarations */
- hid_t fcpl_default = -1; /* file creation prop list */
- hid_t fcpl_shmesg_all = -1; /* file creation prop list */
- hid_t fcpl = -1; /* file creation prop list */
- unsigned nerrs = 0; /* Error Encountered */
- int test_type = 0; /* test type iterator */
+ hid_t fcpl_default = -1; /* file creation prop list */
+ hid_t fcpl_shmesg_all = -1; /* file creation prop list */
+ hid_t fcpl = -1; /* file creation prop list */
+ unsigned nerrs = 0; /* Error Encountered */
+ int test_type = 0; /* test type iterator */
/* Open the HDF5 Library */
H5open();
@@ -3958,54 +4589,83 @@ main(void)
/* Run Tests */
/* ========= */
- for (test_type=0; test_type<NUM_TEST_TYPES; test_type++) {
+ for (test_type = 0; test_type < NUM_TEST_TYPES; test_type++) {
/* Run tests on each fcpl set up above. */
if (test_type == TEST_DEFAULT) {
- if (!nerrs) HDprintf("Testing standard tag application cases w/ default fcpl:\n");
+ if (!nerrs)
+ HDprintf("Testing standard tag application cases w/ default fcpl:\n");
fcpl = fcpl_default;
+ }
+ else if (test_type == TEST_SHMESG) {
- } else if (test_type == TEST_SHMESG) {
-
- if (!nerrs) HDprintf("Testing standard tag application cases w/ shared messages:\n");
+ if (!nerrs)
+ HDprintf("Testing standard tag application cases w/ shared messages:\n");
fcpl = fcpl_shmesg_all;
-
- } else {
+ }
+ else {
TEST_ERROR;
}
/* Check tag application under different circumstances */
- if (!nerrs) nerrs += check_file_creation_tags(fcpl, test_type);
- if (!nerrs) nerrs += check_file_open_tags(fcpl, test_type);
- if (!nerrs) nerrs += check_attribute_creation_tags(fcpl, test_type);
- if (!nerrs) nerrs += check_attribute_open_tags(fcpl, test_type);
- if (!nerrs) nerrs += check_attribute_write_tags(fcpl, test_type);
- if (!nerrs) nerrs += check_attribute_delete_tags(fcpl, test_type);
- if (!nerrs) nerrs += check_attribute_rename_tags(fcpl, test_type);
- if (!nerrs) nerrs += check_dataset_creation_tags(fcpl, test_type);
- if (!nerrs) nerrs += check_dataset_creation_earlyalloc_tags(fcpl, test_type);
- if (!nerrs) nerrs += check_link_removal_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_file_creation_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_file_open_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_attribute_creation_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_attribute_open_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_attribute_write_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_attribute_delete_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_attribute_rename_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_dataset_creation_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_dataset_creation_earlyalloc_tags(fcpl, test_type);
+ if (!nerrs)
+ nerrs += check_link_removal_tags(fcpl, test_type);
} /* end for */
- if (!nerrs) HDprintf("Testing other specific tag application cases:\n");
- if (!nerrs) nerrs += check_group_creation_tags();
- if (!nerrs) nerrs += check_multi_group_creation_tags();
- if (!nerrs) nerrs += check_group_open_tags();
- if (!nerrs) nerrs += check_dataset_open_tags();
- if (!nerrs) nerrs += check_dataset_write_tags();
- if (!nerrs) nerrs += check_dataset_read_tags();
- if (!nerrs) nerrs += check_dataset_size_retrieval();
- if (!nerrs) nerrs += check_dataset_extend_tags();
- if (!nerrs) nerrs += check_object_info_tags();
- if (!nerrs) nerrs += check_object_copy_tags();
- if (!nerrs) nerrs += check_link_getname_tags();
- if (!nerrs) nerrs += check_external_link_creation_tags();
- if (!nerrs) nerrs += check_external_link_open_tags();
-
- if (!nerrs) nerrs += check_dense_attribute_tags();
- if (!nerrs) nerrs += check_link_iteration_tags();
- if (!nerrs) nerrs += check_invalid_tag_application();
+ if (!nerrs)
+ HDprintf("Testing other specific tag application cases:\n");
+ if (!nerrs)
+ nerrs += check_group_creation_tags();
+ if (!nerrs)
+ nerrs += check_multi_group_creation_tags();
+ if (!nerrs)
+ nerrs += check_group_open_tags();
+ if (!nerrs)
+ nerrs += check_dataset_open_tags();
+ if (!nerrs)
+ nerrs += check_dataset_write_tags();
+ if (!nerrs)
+ nerrs += check_dataset_read_tags();
+ if (!nerrs)
+ nerrs += check_dataset_size_retrieval();
+ if (!nerrs)
+ nerrs += check_dataset_extend_tags();
+ if (!nerrs)
+ nerrs += check_object_info_tags();
+ if (!nerrs)
+ nerrs += check_object_copy_tags();
+ if (!nerrs)
+ nerrs += check_link_getname_tags();
+ if (!nerrs)
+ nerrs += check_external_link_creation_tags();
+ if (!nerrs)
+ nerrs += check_external_link_open_tags();
+
+ if (!nerrs)
+ nerrs += check_dense_attribute_tags();
+ if (!nerrs)
+ nerrs += check_link_iteration_tags();
+ if (!nerrs)
+ nerrs += check_invalid_tag_application();
/* Delete test files */
HDremove(FILENAME);
diff --git a/test/chunk_info.c b/test/chunk_info.c
index 942c01a..99b5b1e 100644
--- a/test/chunk_info.c
+++ b/test/chunk_info.c
@@ -39,7 +39,7 @@
*
*/
#define H5D_FRIEND
-#define H5D_TESTING /* to use H5D__ functions */
+#define H5D_TESTING /* to use H5D__ functions */
#include "H5Dpkg.h"
#include "testhdf5.h"
@@ -48,93 +48,90 @@
#endif
/* Test file names, using H5F_libver_t as indices */
-const char *FILENAME[] = {
- "tchunk_info_earliest",
- "tchunk_info_v18",
- "tchunk_info_v110",
- "tchunk_info_v112",
- "tchunk_info_v114",
- NULL
-};
+const char *FILENAME[] = {"tchunk_info_earliest", "tchunk_info_v18", "tchunk_info_v110",
+ "tchunk_info_v112", "tchunk_info_v114", NULL};
/* File to be used in test_failed_attempts */
-#define FILTERMASK_FILE "tflt_msk"
-#define BASIC_FILE "basic_query"
+#define FILTERMASK_FILE "tflt_msk"
+#define BASIC_FILE "basic_query"
/* Parameters for testing chunk querying */
-#define SIMPLE_CHUNKED_DSET_NAME "Chunked Dataset"
-#define CONTIGUOUS_DSET_NAME "Contiguous Dataset"
-#define EMPTY_DSET_NAME "Empty Dataset"
-#define EMPTY_EARLY_ALLOC_DSET_NAME "Empty Dataset with ALLOC_TIME_EARLY"
-#define SINGLE_CHUNK_DSET_NAME "Single Chunk Index Dataset"
-#define IMPLICIT_INDEX_DSET_NAME "Implicit Index Dataset"
-#define FIXED_ARR_INDEX_DSET_NAME "Fixed Array Index Dataset"
-#define EXT_ARR_INDEX_DSET_NAME "Extensible Array Index Dataset"
-#define V2_BTREE_INDEX_DSET_NAME "Version 2 B-Tree Index Dataset"
-#define SKIP_FILTER_DSET_NAME "Dataset with Skipping One Filter"
-#define FILENAME_BUF_SIZE 256 /* Size for file names */
-#define RANK 2 /* Rank for datasets */
+#define SIMPLE_CHUNKED_DSET_NAME "Chunked Dataset"
+#define CONTIGUOUS_DSET_NAME "Contiguous Dataset"
+#define EMPTY_DSET_NAME "Empty Dataset"
+#define EMPTY_EARLY_ALLOC_DSET_NAME "Empty Dataset with ALLOC_TIME_EARLY"
+#define SINGLE_CHUNK_DSET_NAME "Single Chunk Index Dataset"
+#define IMPLICIT_INDEX_DSET_NAME "Implicit Index Dataset"
+#define FIXED_ARR_INDEX_DSET_NAME "Fixed Array Index Dataset"
+#define EXT_ARR_INDEX_DSET_NAME "Extensible Array Index Dataset"
+#define V2_BTREE_INDEX_DSET_NAME "Version 2 B-Tree Index Dataset"
+#define SKIP_FILTER_DSET_NAME "Dataset with Skipping One Filter"
+#define FILENAME_BUF_SIZE 256 /* Size for file names */
+#define RANK 2 /* Rank for datasets */
/* Dimension of the dataset */
-#define NX 24
-#define NY 16
+#define NX 24
+#define NY 16
/* Dimension of the chunk */
-#define CHUNK_NX 6
-#define CHUNK_NY 4
+#define CHUNK_NX 6
+#define CHUNK_NY 4
/* X/Y coords of first chunk written */
-#define START_CHK_X 0
-#define START_CHK_Y 2
+#define START_CHK_X 0
+#define START_CHK_Y 2
/* X/Y coord of last chunk written */
-#define END_CHK_X 2
-#define END_CHK_Y 4
+#define END_CHK_X 2
+#define END_CHK_Y 4
/* X and Y coords of an empty chunk */
-#define EMPTY_CHK_X 0
-#define EMPTY_CHK_Y 0
+#define EMPTY_CHK_X 0
+#define EMPTY_CHK_Y 0
/* Size of a chunk when the entire dataset is a one single chunk */
-#define SINGLE_CHK_SIZE (NX*NY*sizeof(int))
+#define SINGLE_CHK_SIZE (NX * NY * sizeof(int))
/* Size of a chunk */
-#define CHK_SIZE (CHUNK_NX*CHUNK_NY*sizeof(int))
+#define CHK_SIZE (CHUNK_NX * CHUNK_NY * sizeof(int))
/* Size of an empty chunk */
-#define EMPTY_CHK_SIZE 0
+#define EMPTY_CHK_SIZE 0
/* Number of maximum chunks without extending */
-#define NUM_CHUNKS ((NX/CHUNK_NX)*(NY/CHUNK_NY))
+#define NUM_CHUNKS ((NX / CHUNK_NX) * (NY / CHUNK_NY))
/* Number of chunks that have been written */
-#define NUM_CHUNKS_WRITTEN 4
-#define ONE_CHUNK_WRITTEN 1
-#define TWO_CHUNKS_WRITTEN 2
-#define NO_CHUNK_WRITTEN 0
+#define NUM_CHUNKS_WRITTEN 4
+#define ONE_CHUNK_WRITTEN 1
+#define TWO_CHUNKS_WRITTEN 2
+#define NO_CHUNK_WRITTEN 0
/* For testing invalid arguments */
-#define NONEXIST_CHK_INDEX 3
-#define OUTOFRANGE_CHK_INDEX 5
-#define INVALID_CHK_INDEX 5
+#define NONEXIST_CHK_INDEX 3
+#define OUTOFRANGE_CHK_INDEX 5
+#define INVALID_CHK_INDEX 5
/* For compressed data */
-#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12.0)
+#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s)) * 1.001) + 12.0)
/* For use in error reporting */
-#define MSG_CHK_ADDR "Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY."
-#define MSG_CHK_SIZE "Chunk size should not be 0 because of H5D_ALLOC_TIME_EARLY."
+#define MSG_CHK_ADDR "Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY."
+#define MSG_CHK_SIZE "Chunk size should not be 0 because of H5D_ALLOC_TIME_EARLY."
/* Utility function to initialize arguments */
void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size);
/* Helper function containing common code that verifies indexing type
and number of chunks */
-static int verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks);
-static int verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, hsize_t *exp_offset, unsigned exp_flt_msk);
-static int verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size, unsigned exp_flt_msk);
-static int verify_empty_chunk_info(hid_t dset, hsize_t *offset);
-static const char* index_type_str(H5D_chunk_index_t idx_type);
+static int verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type,
+ hsize_t exp_num_chunks);
+static int verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size,
+ hsize_t *exp_offset, unsigned exp_flt_msk);
+static int verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size,
+ unsigned exp_flt_msk);
+static int verify_empty_chunk_info(hid_t dset, hsize_t *offset);
+static const char *index_type_str(H5D_chunk_index_t idx_type);
/*-------------------------------------------------------------------------
* Function: reinit_vars (helper function)
@@ -147,13 +144,14 @@ static const char* index_type_str(H5D_chunk_index_t idx_type);
*
*-------------------------------------------------------------------------
*/
-void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size)
+void
+reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size)
{
- if(read_flt_msk)
+ if (read_flt_msk)
*read_flt_msk = 0;
- if(addr)
+ if (addr)
*addr = 0;
- if(size)
+ if (size)
*size = 0;
}
@@ -171,14 +169,15 @@ void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size)
*-------------------------------------------------------------------------
*/
static int
-verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, hsize_t *exp_offset, unsigned exp_flt_msk)
+verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, hsize_t *exp_offset,
+ unsigned exp_flt_msk)
{
- unsigned read_flt_msk = 0; /* Read filter mask */
+ unsigned read_flt_msk = 0; /* Read filter mask */
hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
- if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ if (H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info");
VERIFY(size, exp_chk_size, "H5Dget_chunk_info, chunk size");
@@ -207,12 +206,12 @@ error:
static int
verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size, unsigned exp_flt_msk)
{
- unsigned read_flt_msk = 0; /* Read filter mask */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
+ unsigned read_flt_msk = 0; /* Read filter mask */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
/* Get info of the chunk at logical coordinates specified by offset */
- if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ if (H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord");
VERIFY(size, exp_chk_size, "H5Dget_chunk_info_by_coord, chunk size");
@@ -239,12 +238,12 @@ error:
static int
verify_empty_chunk_info(hid_t dset, hsize_t *offset)
{
- unsigned read_flt_msk = 0; /* Read filter mask */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
+ unsigned read_flt_msk = 0; /* Read filter mask */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
/* Get info of the chunk at logical coordinates specified by offset */
- if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ if (H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address");
VERIFY(size, EMPTY_CHK_SIZE, "H5Dget_chunk_info_by_coord, chunk size");
@@ -267,25 +266,25 @@ error:
*
*-------------------------------------------------------------------------
*/
-static const char*
+static const char *
index_type_str(H5D_chunk_index_t idx_type)
{
switch (idx_type) {
case H5D_CHUNK_IDX_SINGLE:
- return("Single Chunk index type");
+ return ("Single Chunk index type");
case H5D_CHUNK_IDX_NONE:
- return("Implicit index type");
+ return ("Implicit index type");
case H5D_CHUNK_IDX_FARRAY:
- return("Fixed Array index type");
+ return ("Fixed Array index type");
case H5D_CHUNK_IDX_EARRAY:
- return("Extensible Array index type");
+ return ("Extensible Array index type");
case H5D_CHUNK_IDX_BT2:
- return("Version 2 B-tree index type");
+ return ("Version 2 B-tree index type");
case H5D_CHUNK_IDX_BTREE:
- return("Version 1 B-tree index type (default)");
+ return ("Version 1 B-tree index type (default)");
case H5D_CHUNK_IDX_NTYPES:
default:
- return("invalid index type");
+ return ("invalid index type");
}
} /* index_type_str */
@@ -306,38 +305,39 @@ static int
verify_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end)
{
int read_buf[CHUNK_NX][CHUNK_NY];
- int expected_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Expected data */
- unsigned read_flt_msk = 0; /* Filter mask read back */
- hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */
- hsize_t chk_index; /* Chunk index */
- hsize_t ii, jj; /* Array indices */
+ int expected_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Expected data */
+ unsigned read_flt_msk = 0; /* Filter mask read back */
+ hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */
+ hsize_t chk_index; /* Chunk index */
+ hsize_t ii, jj; /* Array indices */
int n;
HDmemset(&read_buf, 0, sizeof(read_buf));
/* Initialize the array of chunk data for all NUM_CHUNKS chunks, this is
the same as the written data and will be used to verify the read data */
- for(n = 0; n < NUM_CHUNKS; n++)
- for(ii = 0; ii < CHUNK_NX; ii++)
- for(jj = 0; jj < CHUNK_NY; jj++)
- expected_buf[n][ii][jj] = (int)(ii*jj) + 1;
+ for (n = 0; n < NUM_CHUNKS; n++)
+ for (ii = 0; ii < CHUNK_NX; ii++)
+ for (jj = 0; jj < CHUNK_NY; jj++)
+ expected_buf[n][ii][jj] = (int)(ii * jj) + 1;
/* Read each chunk within the boundery of {start,end} and verify the
values against the expected data */
chk_index = 0;
- for(ii = start[0]; ii < end[0]; ii++)
- for(jj = start[1]; jj < end[1]; jj++, chk_index++) {
+ for (ii = start[0]; ii < end[0]; ii++)
+ for (jj = start[1]; jj < end[1]; jj++, chk_index++) {
offset[0] = ii * CHUNK_NX;
offset[1] = jj * CHUNK_NY;
/* Read the current chunk */
- if(H5Dread_chunk(dset, plist, offset, &read_flt_msk, read_buf) < 0)
+ if (H5Dread_chunk(dset, plist, offset, &read_flt_msk, read_buf) < 0)
TEST_ERROR
/* Verify that read chunk is the same as the corresponding written one */
- if(HDmemcmp(expected_buf[chk_index], read_buf, CHUNK_NX*CHUNK_NY) != 0)
- {
- HDfprintf(stderr, "Read chunk differs from written chunk at offset (%" PRIuHSIZE ",%" PRIuHSIZE ")\n", offset[0], offset[1]);
+ if (HDmemcmp(expected_buf[chk_index], read_buf, CHUNK_NX * CHUNK_NY) != 0) {
+ HDfprintf(stderr,
+ "Read chunk differs from written chunk at offset (%" PRIuHSIZE ",%" PRIuHSIZE ")\n",
+ offset[0], offset[1]);
return FAIL;
}
}
@@ -366,26 +366,26 @@ error:
static int
write_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end, unsigned flt_msk)
{
- int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
- hsize_t offset[2]; /* Offset coordinates of a chunk */
- hsize_t chk_index; /* Chunk index */
- hsize_t ii, jj; /* Array indices */
- int n;
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t chk_index; /* Chunk index */
+ hsize_t ii, jj; /* Array indices */
+ int n;
/* Initialize the array of chunk data for all NUM_CHUNKS chunks */
- for(n = 0; n < NUM_CHUNKS; n++)
- for(ii = 0; ii < CHUNK_NX; ii++)
- for(jj = 0; jj < CHUNK_NY; jj++)
- direct_buf[n][ii][jj] = (int)(ii*jj) + 1;
+ for (n = 0; n < NUM_CHUNKS; n++)
+ for (ii = 0; ii < CHUNK_NX; ii++)
+ for (jj = 0; jj < CHUNK_NY; jj++)
+ direct_buf[n][ii][jj] = (int)(ii * jj) + 1;
/* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords:
(0,2) (0,3) (1,2) (1,3) */
chk_index = 0;
- for(ii = start[0]; ii < end[0]; ii++)
- for(jj = start[1]; jj < end[1]; jj++, chk_index++) {
+ for (ii = start[0]; ii < end[0]; ii++)
+ for (jj = start[1]; jj < end[1]; jj++, chk_index++) {
offset[0] = ii * CHUNK_NX;
offset[1] = jj * CHUNK_NY;
- if(H5Dwrite_chunk(dset, plist, flt_msk, offset, CHK_SIZE, (void*)direct_buf[chk_index]) < 0)
+ if (H5Dwrite_chunk(dset, plist, flt_msk, offset, CHK_SIZE, (void *)direct_buf[chk_index]) < 0)
TEST_ERROR
}
@@ -411,27 +411,28 @@ error:
static int
verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks)
{
- H5D_chunk_index_t idx_type; /* Dataset chunk index type */
- hsize_t nchunks = 0; /* Number of chunks */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t nchunks = 0; /* Number of chunks */
/* Get the chunk indexing type of the dataset */
- if(H5Dget_chunk_index_type(dset, &idx_type) < 0)
+ if (H5Dget_chunk_index_type(dset, &idx_type) < 0)
TEST_ERROR
/* Ensure the correct chunk indexing scheme is used */
- if(idx_type != exp_idx_type)
- {
+ if (idx_type != exp_idx_type) {
char msg[256];
sprintf(msg, "Should be using %s.\n", index_type_str(idx_type));
FAIL_PUTS_ERROR(msg);
}
/* Get and verify the number of chunks */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, exp_num_chunks, "H5Dget_num_chunks, number of chunks");
/* Get and verify the number of chunks again, passing in H5S_ALL */
- if(H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, exp_num_chunks, "H5Dget_num_chunks, number of chunks");
return SUCCEED;
@@ -464,36 +465,36 @@ error:
static herr_t
test_get_chunk_info_highest_v18(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE]; /* File name */
- hid_t chunkfile = H5I_INVALID_HID; /* File ID */
- hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t cparms = H5I_INVALID_HID; /* Creation plist */
+ char filename[FILENAME_BUF_SIZE]; /* File name */
+ hid_t chunkfile = H5I_INVALID_HID; /* File ID */
+ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t cparms = H5I_INVALID_HID; /* Creation plist */
hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
- int direct_buf[CHUNK_NX][CHUNK_NY]; /* Data chunk */
+ int direct_buf[CHUNK_NX][CHUNK_NY]; /* Data chunk */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* 2 unlimited dims */
- hsize_t out_offset[2]; /* Buffer to get offset coordinates */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- hsize_t nchunks = 0; /* Number of chunks */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
- hsize_t chk_index = 0; /* Index of a chunk */
- hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
- unsigned flt_msk = 0; /* Filter mask */
- unsigned read_flt_msk = 0; /* Filter mask after direct read */
- int fillvalue = -1; /* Fill value */
- int aggression = 9; /* Compression aggression setting */
- hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2]; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t chk_index = 0; /* Index of a chunk */
+ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
+ unsigned flt_msk = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ int fillvalue = -1; /* Fill value */
+ int aggression = 9; /* Compression aggression setting */
+ hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */
#ifdef H5_HAVE_FILTER_DEFLATE
- const Bytef *z_src = (const Bytef*)(direct_buf);
- Bytef *z_dst; /*destination buffer */
+ const Bytef *z_src = (const Bytef *)(direct_buf);
+ Bytef * z_dst; /*destination buffer */
uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(CHK_SIZE);
uLong z_src_nbytes = (uLong)CHK_SIZE;
-#endif /* end H5_HAVE_FILTER_DEFLATE */
- void *inbuf = NULL; /* Pointer to new buffer */
- hsize_t chunk_size = CHK_SIZE; /* Size of a chunk, can be compressed or not */
- hsize_t ii, jj; /* Array indices */
- int n; /* Used as chunk index, but int to avoid conversion warning */
- herr_t ret; /* Temporary returned value for verifying failure */
+#endif /* end H5_HAVE_FILTER_DEFLATE */
+ void * inbuf = NULL; /* Pointer to new buffer */
+ hsize_t chunk_size = CHK_SIZE; /* Size of a chunk, can be compressed or not */
+ hsize_t ii, jj; /* Array indices */
+ int n; /* Used as chunk index, but int to avoid conversion warning */
+ herr_t ret; /* Temporary returned value for verifying failure */
TESTING("getting chunk information in file with version prior to 1.10");
@@ -502,36 +503,42 @@ test_get_chunk_info_highest_v18(hid_t fapl)
/* Set version bounds for creating the file. High bound to V18 to test
chunked dataset that use B-tree v1 structures to index chunks. */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) < 0)
TEST_ERROR
chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if(chunkfile < 0)
+ if (chunkfile < 0)
TEST_ERROR
/* Create the file and memory dataspace */
- if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
TEST_ERROR
/* Set dset creation properties with chunking, compression, and fillvalue */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) TEST_ERROR
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
#ifdef H5_HAVE_FILTER_DEFLATE
- if(H5Pset_deflate(cparms, (unsigned)aggression) < 0) TEST_ERROR
+ if (H5Pset_deflate(cparms, (unsigned)aggression) < 0)
+ TEST_ERROR
#endif /* end H5_HAVE_FILTER_DEFLATE */
/* Set fill value */
- if(H5Pset_fill_value(cparms, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR
+ if (H5Pset_fill_value(cparms, H5T_NATIVE_INT, &fillvalue) < 0)
+ TEST_ERROR
/* Create a new dataset using cparms creation properties */
- dset = H5Dcreate2(chunkfile, SIMPLE_CHUNKED_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
+ dset = H5Dcreate2(chunkfile, SIMPLE_CHUNKED_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT);
+ if (dset < 0)
+ TEST_ERROR
/* Initialize a chunk of data */
- for(ii = 0; ii < CHUNK_NX; ii++)
- for(jj = 0; jj < CHUNK_NY; jj++)
- direct_buf[ii][jj] = (int)(ii*jj) + 1;
+ for (ii = 0; ii < CHUNK_NX; ii++)
+ for (jj = 0; jj < CHUNK_NY; jj++)
+ direct_buf[ii][jj] = (int)(ii * jj) + 1;
#ifdef H5_HAVE_FILTER_DEFLATE
/* Allocate input (compressed) buffer */
@@ -540,19 +547,21 @@ test_get_chunk_info_highest_v18(hid_t fapl)
/* Set chunk size to the compressed chunk size and the chunk point
to the compressed data chunk */
chunk_size = (hsize_t)z_dst_nbytes;
- z_dst = (Bytef *)inbuf;
+ z_dst = (Bytef *)inbuf;
/* Perform compression from the source to the destination buffer */
ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
/* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
+ if (Z_BUF_ERROR == ret) {
fprintf(stderr, "overflow");
TEST_ERROR
- } else if(Z_MEM_ERROR == ret) {
+ }
+ else if (Z_MEM_ERROR == ret) {
fprintf(stderr, "deflate memory error");
TEST_ERROR
- } else if(Z_OK != ret) {
+ }
+ else if (Z_OK != ret) {
fprintf(stderr, "other deflate error");
TEST_ERROR
}
@@ -565,105 +574,117 @@ test_get_chunk_info_highest_v18(hid_t fapl)
/* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
(0,2) (0,3) (1,2) (1,3) */
n = 0;
- for(ii = START_CHK_X; ii < END_CHK_X; ii++)
- for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, n++) {
+ for (ii = START_CHK_X; ii < END_CHK_X; ii++)
+ for (jj = START_CHK_Y; jj < END_CHK_Y; jj++, n++) {
offset[0] = ii * CHUNK_NX;
offset[1] = jj * CHUNK_NY;
- ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, chunk_size, (void*)inbuf);
- if(ret < 0) TEST_ERROR
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, chunk_size, (void *)inbuf);
+ if (ret < 0)
+ TEST_ERROR
}
/* Free the input buffer */
- if(inbuf)
+ if (inbuf)
HDfree(inbuf);
- if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(dset, H5F_SCOPE_LOCAL) < 0)
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* ...open it again to test the chunk query functions */
- if((dset = H5Dopen2(chunkfile, SIMPLE_CHUNKED_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(chunkfile, SIMPLE_CHUNKED_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get and verify the number of chunks written */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
/* Get and verify info of the last written chunk again, passing in H5S_ALL
this time */
offset[0] = 6;
offset[1] = 12;
- if(verify_get_chunk_info(dset, H5S_ALL, NUM_CHUNKS_WRITTEN-1, chunk_size, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, H5S_ALL, NUM_CHUNKS_WRITTEN - 1, chunk_size, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n");
/* Attempt to get info of a non-existing chunk, should fail */
chk_index = OUTOFRANGE_CHK_INDEX;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Dget_chunk_info(dset, H5S_ALL, chk_index, out_offset, &read_flt_msk, &addr, &size);
- } H5E_END_TRY;
- if(ret != FAIL)
+ }
+ H5E_END_TRY;
+ if (ret != FAIL)
FAIL_PUTS_ERROR(" Attempt to get info of a non-existing chunk.");
/* Attempt to get info of empty chunks, verify the returned addr and size */
offset[0] = 0;
offset[1] = 0;
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
offset[0] = 3 * CHUNK_NX;
offset[1] = 3 * CHUNK_NY;
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
/* Go through all written chunks, get their info and verify the values */
chk_index = 0;
- for(ii = START_CHK_X; ii < END_CHK_X; ii++)
- for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) {
+ for (ii = START_CHK_X; ii < END_CHK_X; ii++)
+ for (jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) {
offset[0] = ii * CHUNK_NX;
offset[1] = jj * CHUNK_NY;
- if(verify_get_chunk_info(dset, dspace, chk_index, chunk_size, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, dspace, chk_index, chunk_size, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n");
/* Use the same offset to pass into the next ...by_coord function */
- if(verify_get_chunk_info_by_coord(dset, offset, chunk_size, flt_msk) == FAIL)
+ if (verify_get_chunk_info_by_coord(dset, offset, chunk_size, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n");
}
/* Close the first dataset */
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Create an empty dataset and close it */
dset = H5Dcreate2(chunkfile, EMPTY_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (dset < 0)
+ TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Reopen the empty dataset to verify the chunk query functions on it */
- if((dset = H5Dopen2(chunkfile, EMPTY_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(chunkfile, EMPTY_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Verify that the number of chunks is 0 */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
/* Attempt to get info of a chunk from an empty dataset, should fail */
chk_index = OUTOFRANGE_CHK_INDEX;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
- } H5E_END_TRY;
- if(ret != FAIL)
+ }
+ H5E_END_TRY;
+ if (ret != FAIL)
FAIL_PUTS_ERROR(" Attempt to get info of a non-existing chunk.");
/* Attempt to get info of a chunk given its coords from an empty dataset,
should succeed with the returned address as HADDR_UNDEF and size as 0 */
offset[0] = EMPTY_CHK_X;
offset[1] = EMPTY_CHK_Y;
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/************************************************************************
* Test empty dataset with H5D_ALLOC_TIME_EARLY *
@@ -671,74 +692,87 @@ test_get_chunk_info_highest_v18(hid_t fapl)
/* Set space allocation to early so that chunk query functions will
retrieve chunk information even though the dataset is empty */
- if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0)
+ if (H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0)
TEST_ERROR
/* Create an empty dataset and close it */
- dset = H5Dcreate2(chunkfile, EMPTY_EARLY_ALLOC_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
+ dset = H5Dcreate2(chunkfile, EMPTY_EARLY_ALLOC_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT);
+ if (dset < 0)
+ TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Reopen the empty dataset to verify the chunk query functions on it */
- if((dset = H5Dopen2(chunkfile, EMPTY_EARLY_ALLOC_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(chunkfile, EMPTY_EARLY_ALLOC_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Verify that the number of chunks is NUM_CHUNKS */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
- if(nchunks != NUM_CHUNKS) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
+ if (nchunks != NUM_CHUNKS)
+ TEST_ERROR
/* Attempt to get info of a chunk from an empty dataset, verify the
returned address and size in the case of H5D_ALLOC_TIME_EARLY */
chk_index = NONEXIST_CHK_INDEX;
reinit_vars(&read_flt_msk, &addr, &size);
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
- if(addr == HADDR_UNDEF)
+ if (addr == HADDR_UNDEF)
TEST_ERROR
- if(size == EMPTY_CHK_SIZE)
+ if (size == EMPTY_CHK_SIZE)
TEST_ERROR
chk_index = 10;
reinit_vars(&read_flt_msk, &addr, &size);
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
- if(addr == HADDR_UNDEF)
+ if (addr == HADDR_UNDEF)
TEST_ERROR
- if(size == EMPTY_CHK_SIZE)
+ if (size == EMPTY_CHK_SIZE)
TEST_ERROR
/* Attempt to get info of a chunk given its coords from an empty dataset,
verify the returned address and size */
offset[0] = 0;
offset[1] = 0;
- if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ if (H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
/* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
- if(addr == HADDR_UNDEF)
+ if (addr == HADDR_UNDEF)
TEST_ERROR
- if(size == 0)
+ if (size == 0)
TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Close/release resources. */
- if(H5Sclose(dspace) < 0) TEST_ERROR
- if(H5Pclose(cparms) < 0) TEST_ERROR
- if(H5Fclose(chunkfile) < 0) TEST_ERROR
+ if (H5Sclose(dspace) < 0)
+ TEST_ERROR
+ if (H5Pclose(cparms) < 0)
+ TEST_ERROR
+ if (H5Fclose(chunkfile) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(dspace);
H5Pclose(cparms);
H5Fclose(chunkfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -764,114 +798,128 @@ error:
static herr_t
test_chunk_info_single_chunk(const char *filename, hid_t fapl)
{
- hid_t chunkfile = H5I_INVALID_HID; /* File ID */
- hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t cparms = H5I_INVALID_HID; /* Creation plist */
- hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
- hsize_t chunk_dims[2] = {NX, NY}; /* Chunk dimensions */
- int data_buf[NX][NY]; /* Input buffer */
- H5D_chunk_index_t idx_type; /* Dataset chunk index type */
- unsigned flt_msk = 0; /* Filter mask */
- unsigned read_flt_msk = 0; /* Filter mask after direct read */
- hsize_t offset[2]; /* Offset coordinates of a chunk */
- hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- hsize_t nchunks = 0; /* Number of chunks */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
- hsize_t chk_index = 0; /* Index of a chunk */
- hsize_t ii, jj; /* Array indices */
- herr_t ret; /* Temporary returned value for verifying failure */
+ hid_t chunkfile = H5I_INVALID_HID; /* File ID */
+ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t cparms = H5I_INVALID_HID; /* Creation plist */
+ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
+ hsize_t chunk_dims[2] = {NX, NY}; /* Chunk dimensions */
+ int data_buf[NX][NY]; /* Input buffer */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ unsigned flt_msk = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t chk_index = 0; /* Index of a chunk */
+ hsize_t ii, jj; /* Array indices */
+ herr_t ret; /* Temporary returned value for verifying failure */
TESTING(" Single Chunk index");
/* Open the file for reading/writing */
- if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create dataspace */
- if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
TEST_ERROR
/* Enable chunking */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
TEST_ERROR
/* Create a new dataset using cparms creation properties */
- dset = H5Dcreate2(chunkfile, SINGLE_CHUNK_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
+ dset = H5Dcreate2(chunkfile, SINGLE_CHUNK_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT);
+ if (dset < 0)
+ TEST_ERROR
/* Close the dataset */
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* ...open it again to test the chunk query functions on a single empty
chunk */
- if((dset = H5Dopen2(chunkfile, SINGLE_CHUNK_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(chunkfile, SINGLE_CHUNK_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Ensure the correct chunk indexing scheme is used */
- if(H5Dget_chunk_index_type(dset, &idx_type) < 0)
+ if (H5Dget_chunk_index_type(dset, &idx_type) < 0)
TEST_ERROR
- if(idx_type != H5D_CHUNK_IDX_SINGLE)
+ if (idx_type != H5D_CHUNK_IDX_SINGLE)
FAIL_PUTS_ERROR("Should be using Single Chunk index type");
/* Get the number of chunks and verify that no chunk has been written */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
- if(nchunks != NO_CHUNK_WRITTEN) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
+ if (nchunks != NO_CHUNK_WRITTEN)
+ TEST_ERROR
/* Initialize the array of chunk data for the single chunk */
- for(ii = 0; ii < NX; ii++)
- for(jj = 0; jj < NY; jj++)
- data_buf[ii][jj] = (int)(ii*jj);
+ for (ii = 0; ii < NX; ii++)
+ for (jj = 0; jj < NY; jj++)
+ data_buf[ii][jj] = (int)(ii * jj);
/* Write the chunk */
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_buf) < 0)
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_buf) < 0)
TEST_ERROR
/* Get and verify that one chunk had been written */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
- if(nchunks != ONE_CHUNK_WRITTEN) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
+ if (nchunks != ONE_CHUNK_WRITTEN)
+ TEST_ERROR
/* Offset of the only chunk */
offset[0] = 0;
offset[1] = 0;
/* Get and verify info of the first and only chunk */
- if(verify_get_chunk_info(dset, H5S_ALL, 0, SINGLE_CHK_SIZE, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, H5S_ALL, 0, SINGLE_CHK_SIZE, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n");
/* Get and verify info of the chunk at logical coordinates (0,0) */
- if(verify_get_chunk_info_by_coord(dset, offset, SINGLE_CHK_SIZE, flt_msk) == FAIL)
+ if (verify_get_chunk_info_by_coord(dset, offset, SINGLE_CHK_SIZE, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n");
/* Attempt to get chunk info given an invalid chunk index and verify
* that failure occurs */
chk_index = INVALID_CHK_INDEX;
reinit_vars(&read_flt_msk, &addr, &size);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
- } H5E_END_TRY;
- if(ret != FAIL)
+ }
+ H5E_END_TRY;
+ if (ret != FAIL)
TEST_ERROR
/* Release resourse */
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Sclose(dspace) < 0) TEST_ERROR
- if(H5Fclose(chunkfile) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Sclose(dspace) < 0)
+ TEST_ERROR
+ if (H5Fclose(chunkfile) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(dspace);
H5Pclose(cparms);
H5Fclose(chunkfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -897,91 +945,100 @@ error:
static herr_t
test_chunk_info_implicit(char *filename, hid_t fapl)
{
- hid_t chunkfile = H5I_INVALID_HID; /* File ID */
- hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t cparms = H5I_INVALID_HID; /* Creation plist */
- hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
- unsigned flt_msk = 0; /* Filter mask */
- hsize_t chk_index = 0; /* Index of a chunk */
- hsize_t ii, jj; /* Array indices */
+ hid_t chunkfile = H5I_INVALID_HID; /* File ID */
+ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t cparms = H5I_INVALID_HID; /* Creation plist */
+ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ unsigned flt_msk = 0; /* Filter mask */
+ hsize_t chk_index = 0; /* Index of a chunk */
+ hsize_t ii, jj; /* Array indices */
hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */
- hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */
+ hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */
TESTING(" Implicit index");
/* Open the file for reading/writing */
- if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create dataspace */
- if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
TEST_ERROR
/* Enable chunking */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
TEST_ERROR
/* Set allocation time to early */
- if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0)
+ if (H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0)
TEST_ERROR
/* Create a new dataset using cparms creation properties */
- dset = H5Dcreate2(chunkfile, IMPLICIT_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
+ dset = H5Dcreate2(chunkfile, IMPLICIT_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT);
+ if (dset < 0)
+ TEST_ERROR
/* Close the dataset */
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Open the dataset again to test getting chunk info */
- if((dset = H5Dopen2(chunkfile, IMPLICIT_INDEX_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(chunkfile, IMPLICIT_INDEX_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Verify chunk indexing scheme and number of chunks */
- if(verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_NONE, NUM_CHUNKS) == FAIL)
+ if (verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_NONE, NUM_CHUNKS) == FAIL)
FAIL_PUTS_ERROR("Verification and write failed\n");
/* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords:
(0,2) (0,3) (1,2) (1,3) */
- if(write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL)
+ if (write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Writing to selected chunks failed\n");
/* Go through all chunks, and get their info and verify the values */
chk_index = 0;
- for(ii = 0; ii < NX/CHUNK_NX; ii++)
- for(jj = 0; jj < NY/CHUNK_NY; jj++, chk_index++) {
+ for (ii = 0; ii < NX / CHUNK_NX; ii++)
+ for (jj = 0; jj < NY / CHUNK_NY; jj++, chk_index++) {
hsize_t offset[2] = {ii * CHUNK_NX, jj * CHUNK_NY};
- if(verify_get_chunk_info(dset, H5S_ALL, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, H5S_ALL, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n");
/* Get info of a chunk and verify its information. Note that
all chunks in this dataset are allocated because of the property
H5D_ALLOC_TIME_EARLY */
- if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
+ if (verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n");
}
/* Release resourse */
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Sclose(dspace) < 0) TEST_ERROR
- if(H5Pclose(cparms) < 0) TEST_ERROR
- if(H5Fclose(chunkfile) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Sclose(dspace) < 0)
+ TEST_ERROR
+ if (H5Pclose(cparms) < 0)
+ TEST_ERROR
+ if (H5Fclose(chunkfile) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(dspace);
H5Pclose(cparms);
H5Fclose(chunkfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -1007,112 +1064,123 @@ error:
static herr_t
test_chunk_info_fixed_array(const char *filename, hid_t fapl)
{
- hid_t chunkfile = H5I_INVALID_HID; /* File ID */
- hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t cparms = H5I_INVALID_HID; /* Creation plist */
- hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
- unsigned flt_msk = 0; /* Filter mask */
- unsigned read_flt_msk = 0; /* Filter mask after direct read */
- hsize_t offset[2]; /* Offset coordinates of a chunk */
- hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */
- hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */
- hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- hsize_t nchunks = 0; /* Number of chunks */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
- hsize_t chk_index = 0; /* Index of a chunk */
- hsize_t ii, jj; /* Array indices */
- herr_t ret; /* Temporary returned value for verifying failure */
+ hid_t chunkfile = H5I_INVALID_HID; /* File ID */
+ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t cparms = H5I_INVALID_HID; /* Creation plist */
+ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ unsigned flt_msk = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */
+ hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t chk_index = 0; /* Index of a chunk */
+ hsize_t ii, jj; /* Array indices */
+ herr_t ret; /* Temporary returned value for verifying failure */
TESTING(" Fixed Array index");
/* Open the file for reading/writing */
- if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create dataspace */
- if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
TEST_ERROR
/* Enable chunking */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
TEST_ERROR
/* Create a new dataset using cparms creation properties */
- dset = H5Dcreate2(chunkfile, FIXED_ARR_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
+ dset = H5Dcreate2(chunkfile, FIXED_ARR_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT);
+ if (dset < 0)
+ TEST_ERROR
/* Close the dataset */
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Open the dataset again to test getting chunk info */
- if((dset = H5Dopen2(chunkfile, FIXED_ARR_INDEX_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(chunkfile, FIXED_ARR_INDEX_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Verify chunk indexing scheme and number of chunks */
- if(verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_FARRAY, NO_CHUNK_WRITTEN) == FAIL)
+ if (verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_FARRAY, NO_CHUNK_WRITTEN) == FAIL)
FAIL_PUTS_ERROR("Verification and write failed\n");
/* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords:
(0,2) (0,3) (1,2) (1,3) */
- if(write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL)
+ if (write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Writing to selected chunks failed\n");
/* Get and verify the number of chunks written */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
/* Get and verify info of each written chunk */
chk_index = 0;
- for(ii = START_CHK_X; ii < END_CHK_X; ii++)
- for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) {
+ for (ii = START_CHK_X; ii < END_CHK_X; ii++)
+ for (jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) {
offset[0] = ii * CHUNK_NX;
offset[1] = jj * CHUNK_NY;
- if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n");
}
/* Attempt to get info using an out-of-range index, chk_index is now > NUM_CHUNKS_WRITTEN. should fail */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
- } H5E_END_TRY;
- if(ret != FAIL)
+ }
+ H5E_END_TRY;
+ if (ret != FAIL)
FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index.");
/* Attempt to get info of empty chunks, verify the returned address and size */
offset[0] = 0;
offset[1] = 0;
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
offset[0] = 3 * CHUNK_NX;
offset[1] = 3 * CHUNK_NY;
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
/* Read and verify values of selected chunks */
- if(verify_selected_chunks(dset, H5P_DEFAULT, start, end) < 0)
+ if (verify_selected_chunks(dset, H5P_DEFAULT, start, end) < 0)
- /* Release resourse */
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Sclose(dspace) < 0) TEST_ERROR
- if(H5Fclose(chunkfile) < 0) TEST_ERROR
+ /* Release resourse */
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Sclose(dspace) < 0)
+ TEST_ERROR
+ if (H5Fclose(chunkfile) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(dspace);
H5Pclose(cparms);
H5Fclose(chunkfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -1138,118 +1206,129 @@ error:
static herr_t
test_chunk_info_extensible_array(const char *filename, hid_t fapl)
{
- hid_t chunkfile = H5I_INVALID_HID; /* File ID */
- hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t cparms = H5I_INVALID_HID; /* Creation plist */
- hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
- hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */
- unsigned flt_msk = 0; /* Filter mask */
- unsigned read_flt_msk = 0; /* Filter mask after direct read */
- hsize_t offset[2]; /* Offset coordinates of a chunk */
- hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */
- hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */
- hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- hsize_t nchunks = 0; /* Number of chunks */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
- hsize_t chk_index = 0; /* Index of a chunk */
- hsize_t ii, jj; /* Array indices */
- herr_t ret; /* Temporary returned value for verifying failure */
+ hid_t chunkfile = H5I_INVALID_HID; /* File ID */
+ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t cparms = H5I_INVALID_HID; /* Creation plist */
+ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */
+ unsigned flt_msk = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */
+ hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t chk_index = 0; /* Index of a chunk */
+ hsize_t ii, jj; /* Array indices */
+ herr_t ret; /* Temporary returned value for verifying failure */
TESTING(" Extensible Array index");
/* Open the file for reading/writing */
- if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create dataspace */
- if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
TEST_ERROR
/* Enable chunking */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
TEST_ERROR
/* Create a new dataset using cparms creation properties */
- dset = H5Dcreate2(chunkfile, EXT_ARR_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
+ dset = H5Dcreate2(chunkfile, EXT_ARR_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT);
+ if (dset < 0)
+ TEST_ERROR
/* Close the dataset */
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Open the dataset again to test getting chunk info */
- if((dset = H5Dopen2(chunkfile, EXT_ARR_INDEX_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(chunkfile, EXT_ARR_INDEX_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Verify chunk indexing scheme and number of chunks */
- if(verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_EARRAY, NO_CHUNK_WRITTEN) == FAIL)
+ if (verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_EARRAY, NO_CHUNK_WRITTEN) == FAIL)
FAIL_PUTS_ERROR("Verification and write failed\n");
/* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords:
(0,2) (0,3) (1,2) (1,3) */
- if(write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL)
+ if (write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Writing to selected chunks failed\n");
/* Get and verify the number of chunks written */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
/* Get and verify info of each written chunk */
chk_index = 0;
- for(ii = START_CHK_X; ii < END_CHK_X; ii++)
- for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) {
+ for (ii = START_CHK_X; ii < END_CHK_X; ii++)
+ for (jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) {
offset[0] = ii * CHUNK_NX;
offset[1] = jj * CHUNK_NY;
- if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n");
- if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
+ if (verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n");
}
/* Attempt to get info using an out-of-range index, should fail */
chk_index = OUTOFRANGE_CHK_INDEX;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
- } H5E_END_TRY;
- if(ret != FAIL)
+ }
+ H5E_END_TRY;
+ if (ret != FAIL)
FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index.");
/* Attempt to get info of empty chunks, verify the returned address and size */
offset[0] = 0;
offset[1] = 0;
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
offset[0] = 3 * CHUNK_NX;
offset[1] = 3 * CHUNK_NY;
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
/* Read and verify values of selected chunks */
- if(verify_selected_chunks(dset, H5P_DEFAULT, start, end) < 0)
+ if (verify_selected_chunks(dset, H5P_DEFAULT, start, end) < 0)
- /* Release resourse */
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Sclose(dspace) < 0) TEST_ERROR
- if(H5Fclose(chunkfile) < 0) TEST_ERROR
+ /* Release resourse */
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Sclose(dspace) < 0)
+ TEST_ERROR
+ if (H5Fclose(chunkfile) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(dspace);
H5Pclose(cparms);
H5Fclose(chunkfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -1275,118 +1354,129 @@ error:
static herr_t
test_chunk_info_version2_btrees(const char *filename, hid_t fapl)
{
- hid_t chunkfile = H5I_INVALID_HID; /* File ID */
- hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t cparms = H5I_INVALID_HID; /* Creation plist */
- hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */
- unsigned flt_msk = 0; /* Filter mask */
- unsigned read_flt_msk = 0; /* Filter mask after direct read */
- hsize_t offset[2]; /* Offset coordinates of a chunk */
- hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */
- hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */
- hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- hsize_t nchunks = 0; /* Number of chunks */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
- hsize_t chk_index = 0; /* Index of a chunk */
- hsize_t ii, jj; /* Array indices */
+ hid_t chunkfile = H5I_INVALID_HID; /* File ID */
+ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t cparms = H5I_INVALID_HID; /* Creation plist */
+ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */
+ unsigned flt_msk = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */
+ hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t chk_index = 0; /* Index of a chunk */
+ hsize_t ii, jj; /* Array indices */
herr_t ret; /* Temporary returned value for verifying failure */
TESTING(" Version 2 B-trees index");
/* Open the file for reading/writing */
- if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create dataspace */
- if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
TEST_ERROR
/* Enable chunking */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
TEST_ERROR
/* Create a new dataset using cparms creation properties */
- dset = H5Dcreate2(chunkfile, V2_BTREE_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
+ dset = H5Dcreate2(chunkfile, V2_BTREE_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT);
+ if (dset < 0)
+ TEST_ERROR
/* Close the dataset */
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Open the dataset again to test getting chunk info */
- if((dset = H5Dopen2(chunkfile, V2_BTREE_INDEX_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(chunkfile, V2_BTREE_INDEX_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Verify chunk indexing scheme and number of chunks */
- if(verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_BT2, NO_CHUNK_WRITTEN) == FAIL)
+ if (verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_BT2, NO_CHUNK_WRITTEN) == FAIL)
FAIL_PUTS_ERROR("Verification and write failed\n");
/* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords:
(0,2) (0,3) (1,2) (1,3) */
- if(write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL)
+ if (write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Writing to selected chunks failed\n");
/* Get and verify the number of chunks written */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
/* Go through all written chunks, get their info and verify the values */
chk_index = 0;
- for(ii = START_CHK_X; ii < END_CHK_X; ii++)
- for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) {
+ for (ii = START_CHK_X; ii < END_CHK_X; ii++)
+ for (jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) {
offset[0] = ii * CHUNK_NX;
offset[1] = jj * CHUNK_NY;
- if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n");
- if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
+ if (verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n");
}
/* Attempt to provide out-of-range offsets, should fail */
chk_index = OUTOFRANGE_CHK_INDEX;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
- } H5E_END_TRY;
- if(ret != FAIL)
+ }
+ H5E_END_TRY;
+ if (ret != FAIL)
FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index.");
/* Attempt to get info of empty chunks, verify the returned address and size */
offset[0] = 0;
offset[1] = 0;
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
offset[0] = 3 * CHUNK_NX;
offset[1] = 3 * CHUNK_NY;
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
/* Read and verify values of selected chunks */
- if(verify_selected_chunks(dset, H5P_DEFAULT, start, end) < 0)
+ if (verify_selected_chunks(dset, H5P_DEFAULT, start, end) < 0)
- /* Release resourse */
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Sclose(dspace) < 0) TEST_ERROR
- if(H5Fclose(chunkfile) < 0) TEST_ERROR
+ /* Release resourse */
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Sclose(dspace) < 0)
+ TEST_ERROR
+ if (H5Fclose(chunkfile) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(dspace);
H5Pclose(cparms);
H5Fclose(chunkfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -1412,24 +1502,24 @@ error:
static herr_t
test_basic_query(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE]; /* File name */
- hid_t basicfile = H5I_INVALID_HID; /* File ID */
- hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t cparms = H5I_INVALID_HID; /* Creation plist */
- hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
- int direct_buf[CHUNK_NX][CHUNK_NY];/* Data in chunks */
- unsigned flt_msk = 0; /* Filter mask */
- unsigned read_flt_msk = 0; /* Filter mask after direct read */
- hsize_t offset[2]; /* Offset coordinates of a chunk */
- hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- hsize_t nchunks = 0; /* Number of chunks */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
- hsize_t chk_index = 0; /* Index of a chunk */
- hsize_t ii, jj; /* Array indices */
- herr_t ret; /* Temporary returned value for verifying failure */
+ char filename[FILENAME_BUF_SIZE]; /* File name */
+ hid_t basicfile = H5I_INVALID_HID; /* File ID */
+ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t cparms = H5I_INVALID_HID; /* Creation plist */
+ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ int direct_buf[CHUNK_NX][CHUNK_NY]; /* Data in chunks */
+ unsigned flt_msk = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t chk_index = 0; /* Index of a chunk */
+ hsize_t ii, jj; /* Array indices */
+ herr_t ret; /* Temporary returned value for verifying failure */
TESTING("basic operations");
@@ -1437,104 +1527,115 @@ test_basic_query(hid_t fapl)
h5_fixname(BASIC_FILE, fapl, filename, sizeof filename);
/* Create a new file. */
- if((basicfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((basicfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create dataspace */
- if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
TEST_ERROR
/* Enable chunking */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
TEST_ERROR
/* Create a new dataset using cparms creation properties */
- dset = H5Dcreate2(basicfile, SIMPLE_CHUNKED_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
+ dset = H5Dcreate2(basicfile, SIMPLE_CHUNKED_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT);
+ if (dset < 0)
+ TEST_ERROR
/* Get the number of chunks and verify that no chunk has been written */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
/* Initialize the array of chunk data for the single chunk */
- for(ii = 0; ii < CHUNK_NX; ii++)
- for(jj = 0; jj < CHUNK_NY; jj++)
- direct_buf[ii][jj] = (int)(ii*jj);
+ for (ii = 0; ii < CHUNK_NX; ii++)
+ for (jj = 0; jj < CHUNK_NY; jj++)
+ direct_buf[ii][jj] = (int)(ii * jj);
/* Write the chunk of data */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
- if(H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, direct_buf) < 0)
+ if (H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, direct_buf) < 0)
TEST_ERROR;
/* Get and verify that one chunk had been written */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
/* Get and verify info of the first and only chunk */
- if(verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n");
/* Get and verify info of the chunk at the offset (CHUNK_NX,CHUNK_NY) */
- if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
+ if (verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n");
/* Attempt to get chunk info given an invalid chunk index and verify
* that failure occurs */
chk_index = INVALID_CHK_INDEX;
reinit_vars(&read_flt_msk, &addr, &size);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
- } H5E_END_TRY;
- if(ret != FAIL)
+ }
+ H5E_END_TRY;
+ if (ret != FAIL)
TEST_ERROR
/* Write the chunk of data to another location */
offset[0] = 0;
offset[1] = 0;
- if(H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, direct_buf) < 0)
+ if (H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, direct_buf) < 0)
TEST_ERROR;
/* Get and verify that two chunks had been written */
- if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, TWO_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks");
/* Get and verify info of the first written chunk in the dataset, its
offset should be (0,0) */
- if(verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n");
/* Get and verify info of the chunk at the offset (0,0) */
- if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
+ if (verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n");
/* Get and verify info of the second written chunk in the dataset, its
offset should be (CHUNK_NX, CHUNK_NY) */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
- if(verify_get_chunk_info(dset, H5S_ALL, 1, CHK_SIZE, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, H5S_ALL, 1, CHK_SIZE, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n");
/* Get and verify info of the chunk at the offset (CHUNK_NX, CHUNK_NY) */
- if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
+ if (verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n");
/* Get and verify info of an empty chunk, at offset
(2*CHUNK_NX, 2*CHUNK_NY) */
- offset[0] = 2*CHUNK_NX;
- offset[1] = 2*CHUNK_NY;
+ offset[0] = 2 * CHUNK_NX;
+ offset[1] = 2 * CHUNK_NY;
/* Get and verify info of the chunk at the offset (CHUNK_NX, CHUNK_NY) */
- if(verify_empty_chunk_info(dset, offset) == FAIL)
+ if (verify_empty_chunk_info(dset, offset) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n");
/* Release resourse */
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Sclose(dspace) < 0) TEST_ERROR
- if(H5Pclose(cparms) < 0) TEST_ERROR
- if(H5Fclose(basicfile) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Sclose(dspace) < 0)
+ TEST_ERROR
+ if (H5Pclose(cparms) < 0)
+ TEST_ERROR
+ if (H5Fclose(basicfile) < 0)
+ TEST_ERROR
/* Remove the test file */
remove(filename);
@@ -1543,12 +1644,14 @@ test_basic_query(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(dspace);
H5Pclose(cparms);
H5Fclose(basicfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -1573,91 +1676,99 @@ error:
static herr_t
test_failed_attempts(const char *filename, hid_t fapl)
{
- hid_t chunkfile = H5I_INVALID_HID; /* File ID */
- hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dset = H5I_INVALID_HID; /* Dataset ID */
- hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
- int data_buf[NX][NY]; /* Input buffer */
- unsigned read_flt_msk = 0; /* Filter mask after direct read */
- hsize_t offset[2]; /* Offset coordinates of a chunk */
- hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
- hsize_t size = 0; /* Size of an allocated/written chunk */
- hsize_t nchunks = 0; /* Number of chunks */
- haddr_t addr = 0; /* Address of an allocated/written chunk */
- hsize_t chk_index = 0; /* Index of a chunk */
- hsize_t ii, jj; /* Array indices */
- herr_t ret; /* Temporary returned value for verifying failure */
+ hid_t chunkfile = H5I_INVALID_HID; /* File ID */
+ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dset = H5I_INVALID_HID; /* Dataset ID */
+ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
+ int data_buf[NX][NY]; /* Input buffer */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t chk_index = 0; /* Index of a chunk */
+ hsize_t ii, jj; /* Array indices */
+ herr_t ret; /* Temporary returned value for verifying failure */
TESTING(" Invalid Operations");
/* Open the file for reading/writing */
- if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create dataspace */
- if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
TEST_ERROR
/* Create a contiguous dataset */
- dset = H5Dcreate2(chunkfile, CONTIGUOUS_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset < 0) TEST_ERROR
+ dset = H5Dcreate2(chunkfile, CONTIGUOUS_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
+ if (dset < 0)
+ TEST_ERROR
/* Initialize the array of data */
- for(ii = 0; ii < NX; ii++)
- for(jj = 0; jj < NY; jj++)
- data_buf[ii][jj] = (int)(ii*jj);
+ for (ii = 0; ii < NX; ii++)
+ for (jj = 0; jj < NY; jj++)
+ data_buf[ii][jj] = (int)(ii * jj);
/* Write the data */
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_buf) < 0)
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_buf) < 0)
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Open it again to test the chunk query functions on contiguous dataset */
- if((dset = H5Dopen2(chunkfile, CONTIGUOUS_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(chunkfile, CONTIGUOUS_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Attempt to get the number of chunks on contiguous dataset, should fail */
- H5E_BEGIN_TRY {
- ret = H5Dget_num_chunks(dset, dspace, &nchunks);
- } H5E_END_TRY;
- if(ret != FAIL)
+ H5E_BEGIN_TRY { ret = H5Dget_num_chunks(dset, dspace, &nchunks); }
+ H5E_END_TRY;
+ if (ret != FAIL)
FAIL_PUTS_ERROR(" Attempt a chunk query function on a contiguous dataset.")
/* Attempt to get chunk info on contiguous data, should fail */
chk_index = 0;
reinit_vars(&read_flt_msk, &addr, &size);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
- } H5E_END_TRY;
- if(ret != FAIL)
+ }
+ H5E_END_TRY;
+ if (ret != FAIL)
FAIL_PUTS_ERROR(" Attempt a chunk query function on a contiguous dataset.")
/* Attempt to get chunk info at logical coordinates (0,0) on contiguous
* dataset, should fail */
offset[0] = 0;
offset[1] = 0;
- H5E_BEGIN_TRY {
- ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
- } H5E_END_TRY;
- if(ret != FAIL)
+ H5E_BEGIN_TRY { ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size); }
+ H5E_END_TRY;
+ if (ret != FAIL)
FAIL_PUTS_ERROR(" Attempt a chunk query function on a contiguous dataset.")
/* Release resourse */
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Sclose(dspace) < 0) TEST_ERROR
- if(H5Fclose(chunkfile) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Sclose(dspace) < 0)
+ TEST_ERROR
+ if (H5Fclose(chunkfile) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(dspace);
H5Fclose(chunkfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -1687,9 +1798,9 @@ error:
static herr_t
test_get_chunk_info_v110(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE]; /* File name */
- hid_t chunkfile = H5I_INVALID_HID; /* File ID */
- H5F_libver_t low, high; /* File format bounds */
+ char filename[FILENAME_BUF_SIZE]; /* File name */
+ hid_t chunkfile = H5I_INVALID_HID; /* File ID */
+ H5F_libver_t low, high; /* File format bounds */
TESTING("getting chunk information in file with versions 1.10 and later");
HDprintf("\n"); /* to list sub-tests */
@@ -1698,42 +1809,44 @@ test_get_chunk_info_v110(hid_t fapl)
high = H5F_LIBVER_LATEST;
/* Test getting info of chunked datasets in version combo up to 1.10 */
- for(low = H5F_LIBVER_V110; low <= H5F_LIBVER_LATEST; low++) {
+ for (low = H5F_LIBVER_V110; low <= H5F_LIBVER_LATEST; low++) {
/* Set version bounds for creating file */
- if(H5Pset_libver_bounds(fapl, low, high) < 0)
+ if (H5Pset_libver_bounds(fapl, low, high) < 0)
TEST_ERROR
/* Create the file */
h5_fixname(FILENAME[low], fapl, filename, sizeof filename);
chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(chunkfile < 0) TEST_ERROR
+ if (chunkfile < 0)
+ TEST_ERROR
/* Close the file, individual tests will re-open the file with different
libvers via the fapl */
- if(H5Fclose(chunkfile) < 0) TEST_ERROR
+ if (H5Fclose(chunkfile) < 0)
+ TEST_ERROR
/* Test getting chunk info when Single Chunk index type is used */
- if(test_chunk_info_single_chunk(filename, fapl) < 0)
+ if (test_chunk_info_single_chunk(filename, fapl) < 0)
TEST_ERROR
/* Test getting chunk info when Implicit index type is used */
- if(test_chunk_info_implicit(filename, fapl) < 0)
+ if (test_chunk_info_implicit(filename, fapl) < 0)
TEST_ERROR
/* Test getting chunk info when Fixed Array index type is used */
- if(test_chunk_info_fixed_array(filename, fapl) < 0)
+ if (test_chunk_info_fixed_array(filename, fapl) < 0)
TEST_ERROR
/* Test getting chunk info when Extensible Array index type is used */
- if(test_chunk_info_extensible_array(filename, fapl) < 0)
+ if (test_chunk_info_extensible_array(filename, fapl) < 0)
TEST_ERROR
/* Test getting chunk info when Version 2 B-trees index type is used */
- if(test_chunk_info_version2_btrees(filename, fapl) < 0)
+ if (test_chunk_info_version2_btrees(filename, fapl) < 0)
TEST_ERROR
/* Test various attempts to use the functions incorrectly */
- if(test_failed_attempts(filename, fapl) < 0)
+ if (test_failed_attempts(filename, fapl) < 0)
TEST_ERROR
} /* for low libver bound */
@@ -1760,31 +1873,31 @@ error:
static herr_t
test_flt_msk_with_skip_compress(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE]; /* File name */
- hid_t filter_file = H5I_INVALID_HID; /* File ID for filter mask */
- hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
- hid_t mem_space = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t cparms = H5I_INVALID_HID; /* Creation plist */
- hid_t dxpl = H5I_INVALID_HID; /* Transfer plist */
- hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* 2 unlimited dims */
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
- int direct_buf[CHUNK_NX][CHUNK_NY]; /* One chunk of data */
- int check_chunk[CHUNK_NX][CHUNK_NY]; /* Buffer to read data in */
- int read_direct_buf[CHUNK_NX][CHUNK_NY]; /* Buffer to read a chunk */
- hsize_t read_buf_size = 0; /* buf size */
- unsigned flt_msk = 0; /* Filter mask */
- unsigned read_flt_msk = 0; /* Filter mask after direct read */
- hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */
- hsize_t nchunks = 0; /* Number of chunks */
- hsize_t chk_index = 0; /* Index of a chunk */
- int aggression = 9; /* Compression aggression setting */
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
- int ii, jj; /* Array indices */
+ char filename[FILENAME_BUF_SIZE]; /* File name */
+ hid_t filter_file = H5I_INVALID_HID; /* File ID for filter mask */
+ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t mem_space = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t cparms = H5I_INVALID_HID; /* Creation plist */
+ hid_t dxpl = H5I_INVALID_HID; /* Transfer plist */
+ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* 2 unlimited dims */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ int direct_buf[CHUNK_NX][CHUNK_NY]; /* One chunk of data */
+ int check_chunk[CHUNK_NX][CHUNK_NY]; /* Buffer to read data in */
+ int read_direct_buf[CHUNK_NX][CHUNK_NY]; /* Buffer to read a chunk */
+ hsize_t read_buf_size = 0; /* buf size */
+ unsigned flt_msk = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ hsize_t chk_index = 0; /* Index of a chunk */
+ int aggression = 9; /* Compression aggression setting */
+ hsize_t start[2]; /* Start of hyperslab */
+ hsize_t stride[2]; /* Stride of hyperslab */
+ hsize_t count[2]; /* Block count */
+ hsize_t block[2]; /* Block sizes */
+ int ii, jj; /* Array indices */
TESTING("getting filter mask when compression filter is skipped");
@@ -1792,40 +1905,41 @@ test_flt_msk_with_skip_compress(hid_t fapl)
h5_fixname(FILTERMASK_FILE, fapl, filename, sizeof filename);
/* Create a new file. */
- if((filter_file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((filter_file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create file data space with unlimited dimensions. */
- if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
TEST_ERROR;
/* Create memory data space. */
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
TEST_ERROR;
/* Create dataset create property list with chunking and compression
enabled. */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR;
- if(H5Pset_chunk( cparms, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
TEST_ERROR;
- if(H5Pset_deflate( cparms, (unsigned ) aggression) < 0)
+ if (H5Pset_deflate(cparms, (unsigned)aggression) < 0)
TEST_ERROR;
/* Create a new dataset using cparms creation properties. */
- if((dset = H5Dcreate2(filter_file, SKIP_FILTER_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(filter_file, SKIP_FILTER_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create transfer property list for writing */
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
TEST_ERROR;
/* Initialize data for one chunk */
- for(ii = 0; ii < CHUNK_NX; ii++)
- for(jj = 0; jj < CHUNK_NY; jj++)
- direct_buf[ii][jj] = (int)(ii*jj);
+ for (ii = 0; ii < CHUNK_NX; ii++)
+ for (jj = 0; jj < CHUNK_NY; jj++)
+ direct_buf[ii][jj] = (int)(ii * jj);
/* Indicate the compression filter is to be skipped. */
flt_msk = 0x00000001;
@@ -1833,34 +1947,38 @@ test_flt_msk_with_skip_compress(hid_t fapl)
/* Write a chunk of uncompressed data */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
- if(H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, direct_buf) < 0)
+ if (H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, direct_buf) < 0)
TEST_ERROR;
- if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(dset, H5F_SCOPE_LOCAL) < 0)
TEST_ERROR;
/* Close and re-open the dataset */
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(filter_file, SKIP_FILTER_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(filter_file, SKIP_FILTER_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Select hyperslab for the chunk just written in the file */
- start[0] = CHUNK_NX; start[1] = CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
- if(H5Sselect_hyperslab(dspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ start[0] = CHUNK_NX;
+ start[1] = CHUNK_NY;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
+ if (H5Sselect_hyperslab(dspace, H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR;
/* Read the chunk back */
- if(H5Dread(dset, H5T_NATIVE_INT, mem_space, dspace, H5P_DEFAULT, check_chunk) < 0)
+ if (H5Dread(dset, H5T_NATIVE_INT, mem_space, dspace, H5P_DEFAULT, check_chunk) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(ii = 0; ii < CHUNK_NX; ii++)
- for(jj = 0; jj < CHUNK_NY; jj++)
- if(direct_buf[ii][jj] != check_chunk[ii][jj]) {
+ for (ii = 0; ii < CHUNK_NX; ii++)
+ for (jj = 0; jj < CHUNK_NY; jj++)
+ if (direct_buf[ii][jj] != check_chunk[ii][jj]) {
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", ii, jj);
HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[ii][jj], check_chunk[ii][jj]);
@@ -1868,50 +1986,58 @@ test_flt_msk_with_skip_compress(hid_t fapl)
}
/* Query chunk storage size */
- if(H5Dget_chunk_storage_size(dset, offset, &read_buf_size) < 0)
+ if (H5Dget_chunk_storage_size(dset, offset, &read_buf_size) < 0)
TEST_ERROR;
- if(read_buf_size != CHK_SIZE)
+ if (read_buf_size != CHK_SIZE)
TEST_ERROR;
/* Read the raw chunk back with H5Dread_chunk */
HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf));
- if(H5Dread_chunk(dset, H5P_DEFAULT, offset, &read_flt_msk, read_direct_buf) < 0)
+ if (H5Dread_chunk(dset, H5P_DEFAULT, offset, &read_flt_msk, read_direct_buf) < 0)
TEST_ERROR;
- if(read_flt_msk != flt_msk)
+ if (read_flt_msk != flt_msk)
TEST_ERROR;
/* Check that the direct chunk read is the same as the chunk written */
- for(ii = 0; ii < CHUNK_NX; ii++)
- for(jj = 0; jj < CHUNK_NY; jj++)
- if(direct_buf[ii][jj] != read_direct_buf[ii][jj]) {
+ for (ii = 0; ii < CHUNK_NX; ii++)
+ for (jj = 0; jj < CHUNK_NY; jj++)
+ if (direct_buf[ii][jj] != read_direct_buf[ii][jj]) {
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", ii, jj);
- HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[ii][jj], read_direct_buf[ii][jj]);
+ HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[ii][jj],
+ read_direct_buf[ii][jj]);
TEST_ERROR;
}
/* Get and verify the number of chunks written */
- if(H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR
+ if (H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0)
+ TEST_ERROR
VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
/* Get and verify info of the first and only chunk */
chk_index = 0;
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
- if(verify_get_chunk_info(dset, H5S_ALL, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
+ if (verify_get_chunk_info(dset, H5S_ALL, chk_index, CHK_SIZE, offset, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n");
/* Get info of the chunk at the specified offsets and verify its info */
- if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
+ if (verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL)
FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n");
/* Release resourse */
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Sclose(mem_space) < 0) TEST_ERROR
- if(H5Sclose(dspace) < 0) TEST_ERROR
- if(H5Pclose(cparms) < 0) TEST_ERROR
- if(H5Pclose(dxpl) < 0) TEST_ERROR
- if(H5Fclose(filter_file) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Sclose(mem_space) < 0)
+ TEST_ERROR
+ if (H5Sclose(dspace) < 0)
+ TEST_ERROR
+ if (H5Pclose(cparms) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl) < 0)
+ TEST_ERROR
+ if (H5Fclose(filter_file) < 0)
+ TEST_ERROR
/* Remove the test file */
remove(filename);
@@ -1920,14 +2046,16 @@ test_flt_msk_with_skip_compress(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(mem_space);
H5Sclose(dspace);
H5Pclose(cparms);
H5Pclose(dxpl);
H5Fclose(filter_file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -1948,13 +2076,14 @@ error:
int
main(void)
{
- hid_t fapl = H5I_INVALID_HID; /* File access property list */
- int nerrors = 0; /* Number of errors so far */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ int nerrors = 0; /* Number of errors so far */
h5_reset();
/* Create a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR
/* Test basic operations on the chunk query functions */
nerrors += test_basic_query(fapl) < 0 ? 1 : 0;
@@ -1968,7 +2097,7 @@ main(void)
/* Tests getting filter mask when compression filter is skipped */
nerrors += test_flt_msk_with_skip_compress(fapl) < 0 ? 1 : 0;
- if(nerrors)
+ if (nerrors)
goto error;
HDprintf("All chunk query tests passed.\n");
@@ -1979,8 +2108,7 @@ main(void)
error:
nerrors = MAX(1, nerrors);
- HDprintf("***** %d QUERY CHUNK INFO TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d QUERY CHUNK INFO TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return EXIT_FAILURE;
}
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index c8ef1e4..6e5dd07 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -19,26 +19,16 @@
/* See H5private.h for how to include headers */
#undef NDEBUG
-#define H5T_FRIEND /*suppress error about including H5Tpkg */
-#include "H5Tpkg.h" /*to turn off hardware conversions*/
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#include "H5Tpkg.h" /*to turn off hardware conversions*/
#include "H5Iprivate.h"
#include "h5test.h"
-const char *FILENAME[] = {
- "cmpd_dset",
- "src_subset",
- "dst_subset",
- NULL
-};
-
-const char *DSET_NAME[] = {
- "contig_src_subset",
- "chunk_src_subset",
- "contig_dst_subset",
- "chunk_dst_subset",
- NULL
-};
+const char *FILENAME[] = {"cmpd_dset", "src_subset", "dst_subset", NULL};
+
+const char *DSET_NAME[] = {"contig_src_subset", "chunk_src_subset", "contig_dst_subset", "chunk_dst_subset",
+ NULL};
/* The first dataset */
typedef struct s1_t {
@@ -96,16 +86,16 @@ typedef struct s6_t {
/* Structures for testing the optimization for the Chicago company. */
typedef struct {
- int a, b, c[8], d, e;
- float f, g, h[16], i, j;
+ int a, b, c[8], d, e;
+ float f, g, h[16], i, j;
double k, l, m, n;
} stype1;
typedef struct {
- int a, b, c[8], d, e;
- float f, g, h[16], i, j;
+ int a, b, c[8], d, e;
+ float f, g, h[16], i, j;
double k, l, m, n;
- long o, p, q;
+ long o, p, q;
} stype2;
typedef struct {
@@ -113,17 +103,16 @@ typedef struct {
} stype3;
typedef struct {
- int a, b, c[8], d, e;
- float f, g, h[16], i, j;
- double k, l, m, n;
- long o, p, q;
+ int a, b, c[8], d, e;
+ float f, g, h[16], i, j;
+ double k, l, m, n;
+ long o, p, q;
long long r, s, t;
} stype4;
-#define NX 100u
-#define NY 2000u
-#define PACK_NMEMBS 100
-
+#define NX 100u
+#define NY 2000u
+#define PACK_NMEMBS 100
/*-------------------------------------------------------------------------
* Function: test_compound
@@ -149,92 +138,97 @@ typedef struct {
*-------------------------------------------------------------------------
*/
static unsigned
-test_compound (char *filename, hid_t fapl)
+test_compound(char *filename, hid_t fapl)
{
/* First dataset */
- s1_t *s1 = NULL;
- hid_t s1_tid;
+ s1_t *s1 = NULL;
+ hid_t s1_tid;
/* Second dataset */
- s2_t *s2 = NULL;
- hid_t s2_tid;
+ s2_t *s2 = NULL;
+ hid_t s2_tid;
/* Third dataset */
- s3_t *s3 = NULL;
- hid_t s3_tid;
+ s3_t *s3 = NULL;
+ hid_t s3_tid;
/* Fourth dataset */
- s4_t *s4 = NULL;
- hid_t s4_tid;
+ s4_t *s4 = NULL;
+ hid_t s4_tid;
/* Fifth dataset */
- s5_t *s5 = NULL;
- hid_t s5_tid;
+ s5_t *s5 = NULL;
+ hid_t s5_tid;
/* Sixth dataset */
- s6_t *s6 = NULL;
- hid_t s6_tid;
+ s6_t *s6 = NULL;
+ hid_t s6_tid;
/* Seventh dataset */
- hid_t s7_sid;
+ hid_t s7_sid;
/* Eighth dataset */
- s1_t *s8 = NULL;
- hid_t s8_f_sid; /*file data space */
- hid_t s8_m_sid; /*memory data space */
+ s1_t *s8 = NULL;
+ hid_t s8_f_sid; /*file data space */
+ hid_t s8_m_sid; /*memory data space */
/* Ninth dataset */
/* Tenth dataset */
/* Eleventh dataset */
- s4_t *s11 = NULL;
+ s4_t *s11 = NULL;
/* Other variables */
- unsigned int i, j;
- hid_t file, dataset, space, PRESERVE;
- hid_t array_dt;
- static hsize_t dim[] = {NX, NY};
- hsize_t f_offset[2]; /*offset of hyperslab in file */
- hsize_t h_size[2]; /*size of hyperslab */
+ unsigned int i, j;
+ hid_t file, dataset, space, PRESERVE;
+ hid_t array_dt;
+ static hsize_t dim[] = {NX, NY};
+ hsize_t f_offset[2]; /*offset of hyperslab in file */
+ hsize_t h_size[2]; /*size of hyperslab */
hsize_t memb_size[1] = {4};
int ret_code;
/* Allocate buffers for datasets */
- if(NULL == (s1 = (s1_t *)HDmalloc(sizeof(s1_t) * NX * NY)))
+ if (NULL == (s1 = (s1_t *)HDmalloc(sizeof(s1_t) * NX * NY)))
goto error;
- if(NULL == (s2 = (s2_t *)HDmalloc(sizeof(s2_t) * NX * NY)))
+ if (NULL == (s2 = (s2_t *)HDmalloc(sizeof(s2_t) * NX * NY)))
goto error;
- if(NULL == (s3 = (s3_t *)HDmalloc(sizeof(s3_t) * NX * NY)))
+ if (NULL == (s3 = (s3_t *)HDmalloc(sizeof(s3_t) * NX * NY)))
goto error;
- if(NULL == (s4 = (s4_t *)HDmalloc(sizeof(s4_t) * NX * NY)))
+ if (NULL == (s4 = (s4_t *)HDmalloc(sizeof(s4_t) * NX * NY)))
goto error;
- if(NULL == (s5 = (s5_t *)HDmalloc(sizeof(s5_t) * NX * NY)))
+ if (NULL == (s5 = (s5_t *)HDmalloc(sizeof(s5_t) * NX * NY)))
goto error;
- if(NULL == (s6 = (s6_t *)HDmalloc(sizeof(s6_t) * NX * NY)))
+ if (NULL == (s6 = (s6_t *)HDmalloc(sizeof(s6_t) * NX * NY)))
goto error;
/* Create the file */
- if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
- goto error;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
+ goto error;
}
/* Create the data space */
- if ((space = H5Screate_simple (2, dim, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, dim, NULL)) < 0)
+ goto error;
/* Create xfer properties to preserve initialized data */
/* Also verify H5Pset_preserve is initially 0 and then is set to 1. */
- if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto error;
- if ((ret_code=H5Pget_preserve (PRESERVE)) != 0){
- HDprintf("Preserve status of dataset transfer property list should be"
- " 0 (FALSE), got %d\n", ret_code);
- goto error;
+ if ((PRESERVE = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if ((ret_code = H5Pget_preserve(PRESERVE)) != 0) {
+ HDprintf("Preserve status of dataset transfer property list should be"
+ " 0 (FALSE), got %d\n",
+ ret_code);
+ goto error;
}
- if (H5Pset_preserve (PRESERVE, 1)<0) goto error;
- if ((ret_code=H5Pget_preserve (PRESERVE)) != 1){
- HDprintf("Preserve status of dataset transfer property list should be"
- " 1 (TRUE), got %d\n", ret_code);
- goto error;
+ if (H5Pset_preserve(PRESERVE, 1) < 0)
+ goto error;
+ if ((ret_code = H5Pget_preserve(PRESERVE)) != 1) {
+ HDprintf("Preserve status of dataset transfer property list should be"
+ " 1 (TRUE), got %d\n",
+ ret_code);
+ goto error;
}
/*
@@ -244,36 +238,36 @@ test_compound (char *filename, hid_t fapl)
TESTING("basic compound write");
/* Initialize the dataset */
- for (i=0; i<NX*NY; i++) {
- s1[i].a = 8*i+0;
- s1[i].b = 2000+2*i;
- s1[i].c[0] = 8*i+2;
- s1[i].c[1] = 8*i+3;
- s1[i].c[2] = 8*i+4;
- s1[i].c[3] = 8*i+5;
- s1[i].d = 2001+2*i;
- s1[i].e = 8*i+7;
+ for (i = 0; i < NX * NY; i++) {
+ s1[i].a = 8 * i + 0;
+ s1[i].b = 2000 + 2 * i;
+ s1[i].c[0] = 8 * i + 2;
+ s1[i].c[1] = 8 * i + 3;
+ s1[i].c[2] = 8 * i + 4;
+ s1[i].c[3] = 8 * i + 5;
+ s1[i].d = 2001 + 2 * i;
+ s1[i].e = 8 * i + 7;
}
/* Create the memory data type */
- if((s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0)
+ if ((s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0)
goto error;
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size);
- if(H5Tinsert(s1_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(s1_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(s1_tid, "c", HOFFSET(s1_t, c), array_dt) < 0 ||
- H5Tinsert(s1_tid, "d", HOFFSET(s1_t, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(s1_tid, "e", HOFFSET(s1_t, e), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(s1_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s1_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s1_tid, "c", HOFFSET(s1_t, c), array_dt) < 0 ||
+ H5Tinsert(s1_tid, "d", HOFFSET(s1_t, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s1_tid, "e", HOFFSET(s1_t, e), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
/* Create the dataset */
- if((dataset = H5Dcreate2(file, "s1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ if ((dataset = H5Dcreate2(file, "s1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* Write the data */
- if(H5Dwrite(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1) < 0)
- goto error;
+ if (H5Dwrite(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1) < 0)
+ goto error;
PASSED();
@@ -286,36 +280,31 @@ test_compound (char *filename, hid_t fapl)
TESTING("basic compound read");
/* Create a data type for s2 */
- if ((s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t))) < 0)
+ if ((s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t))) < 0)
goto error;
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size);
- if (H5Tinsert (s2_tid, "a", HOFFSET(s2_t,a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s2_tid, "b", HOFFSET(s2_t,b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s2_tid, "c", HOFFSET(s2_t,c), array_dt) < 0 ||
- H5Tinsert (s2_tid, "d", HOFFSET(s2_t,d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s2_tid, "e", HOFFSET(s2_t,e), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(s2_tid, "a", HOFFSET(s2_t, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s2_tid, "b", HOFFSET(s2_t, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s2_tid, "c", HOFFSET(s2_t, c), array_dt) < 0 ||
+ H5Tinsert(s2_tid, "d", HOFFSET(s2_t, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s2_tid, "e", HOFFSET(s2_t, e), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
/* Read the data */
- if (H5Dread (dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s2) < 0) {
- goto error;
+ if (H5Dread(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s2) < 0) {
+ goto error;
}
/* Compare s2 with s1. They should be the same */
- for (i=0; i<NX*NY; i++) {
- if (s1[i].a!=s2[i].a ||
- s1[i].b!=s2[i].b ||
- s1[i].c[0]!=s2[i].c[0] ||
- s1[i].c[1]!=s2[i].c[1] ||
- s1[i].c[2]!=s2[i].c[2] ||
- s1[i].c[3]!=s2[i].c[3] ||
- s1[i].d!=s2[i].d ||
- s1[i].e!=s2[i].e) {
- H5_FAILED();
- puts(" Incorrect values read from the file");
- goto error;
- }
+ for (i = 0; i < NX * NY; i++) {
+ if (s1[i].a != s2[i].a || s1[i].b != s2[i].b || s1[i].c[0] != s2[i].c[0] ||
+ s1[i].c[1] != s2[i].c[1] || s1[i].c[2] != s2[i].c[2] || s1[i].c[3] != s2[i].c[3] ||
+ s1[i].d != s2[i].d || s1[i].e != s2[i].e) {
+ H5_FAILED();
+ puts(" Incorrect values read from the file");
+ goto error;
+ }
}
PASSED();
@@ -328,36 +317,31 @@ test_compound (char *filename, hid_t fapl)
TESTING("reversal of struct members");
/* Create a data type for s3 */
- if ((s3_tid = H5Tcreate (H5T_COMPOUND, sizeof(s3_t))) < 0)
+ if ((s3_tid = H5Tcreate(H5T_COMPOUND, sizeof(s3_t))) < 0)
goto error;
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size);
- if (H5Tinsert (s3_tid, "a", HOFFSET(s3_t,a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s3_tid, "b", HOFFSET(s3_t,b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s3_tid, "c", HOFFSET(s3_t,c), array_dt) < 0 ||
- H5Tinsert (s3_tid, "d", HOFFSET(s3_t,d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s3_tid, "e", HOFFSET(s3_t,e), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(s3_tid, "a", HOFFSET(s3_t, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s3_tid, "b", HOFFSET(s3_t, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s3_tid, "c", HOFFSET(s3_t, c), array_dt) < 0 ||
+ H5Tinsert(s3_tid, "d", HOFFSET(s3_t, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s3_tid, "e", HOFFSET(s3_t, e), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
/* Read the data */
- if (H5Dread (dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3) < 0) {
- goto error;
+ if (H5Dread(dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3) < 0) {
+ goto error;
}
/* Compare s3 with s1. They should be the same */
- for (i=0; i<NX*NY; i++) {
- if (s1[i].a!=s3[i].a ||
- s1[i].b!=s3[i].b ||
- s1[i].c[0]!=s3[i].c[0] ||
- s1[i].c[1]!=s3[i].c[1] ||
- s1[i].c[2]!=s3[i].c[2] ||
- s1[i].c[3]!=s3[i].c[3] ||
- s1[i].d!=s3[i].d ||
- s1[i].e!=s3[i].e) {
- H5_FAILED();
- puts(" Incorrect values read from the file");
- goto error;
- }
+ for (i = 0; i < NX * NY; i++) {
+ if (s1[i].a != s3[i].a || s1[i].b != s3[i].b || s1[i].c[0] != s3[i].c[0] ||
+ s1[i].c[1] != s3[i].c[1] || s1[i].c[2] != s3[i].c[2] || s1[i].c[3] != s3[i].c[3] ||
+ s1[i].d != s3[i].d || s1[i].e != s3[i].e) {
+ H5_FAILED();
+ puts(" Incorrect values read from the file");
+ goto error;
+ }
}
PASSED();
@@ -369,23 +353,25 @@ test_compound (char *filename, hid_t fapl)
TESTING("subset struct read");
/* Create a datatype for s4 */
- if ((s4_tid = H5Tcreate (H5T_COMPOUND, sizeof(s4_t))) < 0) goto error;
- if (H5Tinsert (s4_tid, "b", HOFFSET(s4_t,b), H5T_NATIVE_INT) < 0) goto error;
- if (H5Tinsert (s4_tid, "d", HOFFSET(s4_t,d), H5T_NATIVE_INT) < 0) goto error;
+ if ((s4_tid = H5Tcreate(H5T_COMPOUND, sizeof(s4_t))) < 0)
+ goto error;
+ if (H5Tinsert(s4_tid, "b", HOFFSET(s4_t, b), H5T_NATIVE_INT) < 0)
+ goto error;
+ if (H5Tinsert(s4_tid, "d", HOFFSET(s4_t, d), H5T_NATIVE_INT) < 0)
+ goto error;
/* Read the data */
- if (H5Dread (dataset, s4_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s4) < 0) {
- goto error;
+ if (H5Dread(dataset, s4_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s4) < 0) {
+ goto error;
}
/* Compare s4 with s1 */
- for (i=0; i<NX*NY; i++) {
- if (s1[i].b!=s4[i].b ||
- s1[i].d!=s4[i].d) {
- H5_FAILED();
- puts(" Incorrect values read from the file");
- goto error;
- }
+ for (i = 0; i < NX * NY; i++) {
+ if (s1[i].b != s4[i].b || s1[i].d != s4[i].d) {
+ H5_FAILED();
+ puts(" Incorrect values read from the file");
+ goto error;
+ }
}
PASSED();
@@ -397,56 +383,49 @@ test_compound (char *filename, hid_t fapl)
TESTING("partially initialized superset read");
/* Initialize some members */
- for (i=0; i<NX*NY; i++) {
- s5[i].pre = 1000+4*i;
- s5[i].mid1 = 1001+4*i;
- s5[i].mid2 = 1002+4*i;
- s5[i].post = 1003+4*i;
+ for (i = 0; i < NX * NY; i++) {
+ s5[i].pre = 1000 + 4 * i;
+ s5[i].mid1 = 1001 + 4 * i;
+ s5[i].mid2 = 1002 + 4 * i;
+ s5[i].post = 1003 + 4 * i;
}
/* Create a data type for s5 */
- if ((s5_tid = H5Tcreate (H5T_COMPOUND, sizeof(s5_t))) < 0)
+ if ((s5_tid = H5Tcreate(H5T_COMPOUND, sizeof(s5_t))) < 0)
goto error;
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size);
- if (H5Tinsert (s5_tid, "a", HOFFSET(s5_t,a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s5_tid, "b", HOFFSET(s5_t,b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s5_tid, "c", HOFFSET(s5_t,c), array_dt) < 0 ||
- H5Tinsert (s5_tid, "d", HOFFSET(s5_t,d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s5_tid, "e", HOFFSET(s5_t,e), H5T_NATIVE_INT))
+ if (H5Tinsert(s5_tid, "a", HOFFSET(s5_t, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s5_tid, "b", HOFFSET(s5_t, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s5_tid, "c", HOFFSET(s5_t, c), array_dt) < 0 ||
+ H5Tinsert(s5_tid, "d", HOFFSET(s5_t, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s5_tid, "e", HOFFSET(s5_t, e), H5T_NATIVE_INT))
goto error;
H5Tclose(array_dt);
/* Read the data */
- if (H5Dread (dataset, s5_tid, H5S_ALL, H5S_ALL, PRESERVE, s5) < 0) {
- goto error;
+ if (H5Dread(dataset, s5_tid, H5S_ALL, H5S_ALL, PRESERVE, s5) < 0) {
+ goto error;
}
/* Check that the data was read properly */
- for (i=0; i<NX*NY; i++) {
- if (s1[i].a!=s5[i].a ||
- s1[i].b!=s5[i].b ||
- s1[i].c[0]!=s5[i].c[0] ||
- s1[i].c[1]!=s5[i].c[1] ||
- s1[i].c[2]!=s5[i].c[2] ||
- s1[i].c[3]!=s5[i].c[3] ||
- s1[i].d!=s5[i].d ||
- s1[i].e!=s5[i].e) {
- H5_FAILED();
- puts(" Incorrect values read from the file");
- goto error;
- }
+ for (i = 0; i < NX * NY; i++) {
+ if (s1[i].a != s5[i].a || s1[i].b != s5[i].b || s1[i].c[0] != s5[i].c[0] ||
+ s1[i].c[1] != s5[i].c[1] || s1[i].c[2] != s5[i].c[2] || s1[i].c[3] != s5[i].c[3] ||
+ s1[i].d != s5[i].d || s1[i].e != s5[i].e) {
+ H5_FAILED();
+ puts(" Incorrect values read from the file");
+ goto error;
+ }
}
/* Check that no previous values were clobbered */
- for (i=0; i<NX*NY; i++) {
- if (s5[i].pre != 1000+4*i ||
- s5[i].mid1 != 1001+4*i ||
- s5[i].mid2 != 1002+4*i ||
- s5[i].post != 1003+4*i) {
- H5_FAILED();
- puts(" Memory values were clobbered");
- goto error;
- }
+ for (i = 0; i < NX * NY; i++) {
+ if (s5[i].pre != 1000 + 4 * i || s5[i].mid1 != 1001 + 4 * i || s5[i].mid2 != 1002 + 4 * i ||
+ s5[i].post != 1003 + 4 * i) {
+ H5_FAILED();
+ puts(" Memory values were clobbered");
+ goto error;
+ }
}
PASSED();
@@ -469,64 +448,56 @@ test_compound (char *filename, hid_t fapl)
TESTING("partially initialized superset optimized read");
/* Initialize some members */
- for (i=0; i<NX*NY; i++) {
- s6[i].pre = 1000+4*i;
- s6[i].mid1 = 1001+4*i;
- s6[i].mid2 = 1002+4*i;
- s6[i].post = 1003+4*i;
+ for (i = 0; i < NX * NY; i++) {
+ s6[i].pre = 1000 + 4 * i;
+ s6[i].mid1 = 1001 + 4 * i;
+ s6[i].mid2 = 1002 + 4 * i;
+ s6[i].post = 1003 + 4 * i;
}
/* Create a data type for s6 */
- if ((s6_tid = H5Tcreate (H5T_COMPOUND, sizeof(s6_t))) < 0)
+ if ((s6_tid = H5Tcreate(H5T_COMPOUND, sizeof(s6_t))) < 0)
goto error;
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size);
- if (H5Tinsert (s6_tid, "a", HOFFSET(s6_t,a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s6_tid, "b", HOFFSET(s6_t,b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s6_tid, "c", HOFFSET(s6_t,c), array_dt) < 0 ||
- H5Tinsert (s6_tid, "d", HOFFSET(s6_t,d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s6_tid, "e", HOFFSET(s6_t,e), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s6_tid, "pre", HOFFSET(s6_t,pre), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s6_tid, "mid1", HOFFSET(s6_t,mid1), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s6_tid, "mid2", HOFFSET(s6_t,mid2), H5T_NATIVE_INT) < 0 ||
- H5Tinsert (s6_tid, "post", HOFFSET(s6_t,post), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(s6_tid, "a", HOFFSET(s6_t, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s6_tid, "b", HOFFSET(s6_t, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s6_tid, "c", HOFFSET(s6_t, c), array_dt) < 0 ||
+ H5Tinsert(s6_tid, "d", HOFFSET(s6_t, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s6_tid, "e", HOFFSET(s6_t, e), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s6_tid, "pre", HOFFSET(s6_t, pre), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s6_tid, "mid1", HOFFSET(s6_t, mid1), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s6_tid, "mid2", HOFFSET(s6_t, mid2), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(s6_tid, "post", HOFFSET(s6_t, post), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
/* Read the data */
- if (H5Dread (dataset, s6_tid, H5S_ALL, H5S_ALL, PRESERVE, s6) < 0) {
- goto error;
+ if (H5Dread(dataset, s6_tid, H5S_ALL, H5S_ALL, PRESERVE, s6) < 0) {
+ goto error;
}
/* Check that the data was read properly */
- for (i=0; i<NX*NY; i++) {
- if (s1[i].a!=s6[i].a ||
- s1[i].b!=s6[i].b ||
- s1[i].c[0]!=s6[i].c[0] ||
- s1[i].c[1]!=s6[i].c[1] ||
- s1[i].c[2]!=s6[i].c[2] ||
- s1[i].c[3]!=s6[i].c[3] ||
- s1[i].d!=s6[i].d ||
- s1[i].e!=s6[i].e) {
- H5_FAILED();
- puts(" Incorrect values read from the file");
- goto error;
- }
+ for (i = 0; i < NX * NY; i++) {
+ if (s1[i].a != s6[i].a || s1[i].b != s6[i].b || s1[i].c[0] != s6[i].c[0] ||
+ s1[i].c[1] != s6[i].c[1] || s1[i].c[2] != s6[i].c[2] || s1[i].c[3] != s6[i].c[3] ||
+ s1[i].d != s6[i].d || s1[i].e != s6[i].e) {
+ H5_FAILED();
+ puts(" Incorrect values read from the file");
+ goto error;
+ }
}
/* Check that no previous values were clobbered */
- for (i=0; i<NX*NY; i++) {
- if (s6[i].pre != 1000+4*i ||
- s6[i].mid1 != 1001+4*i ||
- s6[i].mid2 != 1002+4*i ||
- s6[i].post != 1003+4*i) {
- H5_FAILED();
- puts(" Memory values were clobbered");
- goto error;
- }
+ for (i = 0; i < NX * NY; i++) {
+ if (s6[i].pre != 1000 + 4 * i || s6[i].mid1 != 1001 + 4 * i || s6[i].mid2 != 1002 + 4 * i ||
+ s6[i].post != 1003 + 4 * i) {
+ H5_FAILED();
+ puts(" Memory values were clobbered");
+ goto error;
+ }
}
PASSED();
-
/*
*######################################################################
* STEP 7: Update fields `b' and `d' on the file leaving the other
@@ -536,40 +507,34 @@ test_compound (char *filename, hid_t fapl)
TESTING("partially initialized superset write");
/* Initialize `s4' with new values */
- for (i=0; i<NX*NY; i++) {
- s4[i].b = 8*i+1;
- s4[i].d = 8*i+6;
+ for (i = 0; i < NX * NY; i++) {
+ s4[i].b = 8 * i + 1;
+ s4[i].d = 8 * i + 6;
}
/* Write the data to file */
- if (H5Dwrite (dataset, s4_tid, H5S_ALL, H5S_ALL, PRESERVE, s4) < 0) {
- goto error;
+ if (H5Dwrite(dataset, s4_tid, H5S_ALL, H5S_ALL, PRESERVE, s4) < 0) {
+ goto error;
}
/* Read the data back */
- if (H5Dread (dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1) < 0) {
- goto error;
+ if (H5Dread(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1) < 0) {
+ goto error;
}
/* Compare */
- for (i=0; i<NX*NY; i++) {
- if (s1[i].a != 8*i+0 ||
- s1[i].b != 8*i+1 ||
- s1[i].c[0] != 8*i+2 ||
- s1[i].c[1] != 8*i+3 ||
- s1[i].c[2] != 8*i+4 ||
- s1[i].c[3] != 8*i+5 ||
- s1[i].d != 8*i+6 ||
- s1[i].e != 8*i+7) {
- H5_FAILED();
- HDprintf(" i==%u, row=%u, col=%u\n", i, i/NY, i%NY);
- HDprintf(" got: {%7d,%7d,[%7d,%7d,%7d,%7d],%7d,%7d}\n",
- s1[i].a, s1[i].b, s1[i].c[0], s1[i].c[1], s1[i].c[2],
- s1[i].c[3], s1[i].d, s1[i].e);
- HDprintf(" ans: {%7d,%7d,[%7d,%7d,%7d,%7d],%7d,%7d}\n",
- 8*i+0, 8*i+1, 8*i+2, 8*i+3, 8*i+4, 8*i+5, 8*i+6, 8*i+7);
- goto error;
- }
+ for (i = 0; i < NX * NY; i++) {
+ if (s1[i].a != 8 * i + 0 || s1[i].b != 8 * i + 1 || s1[i].c[0] != 8 * i + 2 ||
+ s1[i].c[1] != 8 * i + 3 || s1[i].c[2] != 8 * i + 4 || s1[i].c[3] != 8 * i + 5 ||
+ s1[i].d != 8 * i + 6 || s1[i].e != 8 * i + 7) {
+ H5_FAILED();
+ HDprintf(" i==%u, row=%u, col=%u\n", i, i / NY, i % NY);
+ HDprintf(" got: {%7d,%7d,[%7d,%7d,%7d,%7d],%7d,%7d}\n", s1[i].a, s1[i].b, s1[i].c[0],
+ s1[i].c[1], s1[i].c[2], s1[i].c[3], s1[i].d, s1[i].e);
+ HDprintf(" ans: {%7d,%7d,[%7d,%7d,%7d,%7d],%7d,%7d}\n", 8 * i + 0, 8 * i + 1, 8 * i + 2,
+ 8 * i + 3, 8 * i + 4, 8 * i + 5, 8 * i + 6, 8 * i + 7);
+ goto error;
+ }
}
PASSED();
@@ -582,31 +547,26 @@ test_compound (char *filename, hid_t fapl)
TESTING("explicit data space");
/* Create the data space */
- if ((s7_sid = H5Screate_simple (2, dim, NULL)) < 0) goto error;
+ if ((s7_sid = H5Screate_simple(2, dim, NULL)) < 0)
+ goto error;
/* Read the dataset */
- if (H5Dread (dataset, s2_tid, s7_sid, H5S_ALL, H5P_DEFAULT, s2) < 0) {
- goto error;
+ if (H5Dread(dataset, s2_tid, s7_sid, H5S_ALL, H5P_DEFAULT, s2) < 0) {
+ goto error;
}
/* Compare */
- for (i=0; i<NX*NY; i++) {
- if (s2[i].a != s1[i].a ||
- s2[i].b != s1[i].b ||
- s2[i].c[0] != s1[i].c[0] ||
- s2[i].c[1] != s1[i].c[1] ||
- s2[i].c[2] != s1[i].c[2] ||
- s2[i].c[3] != s1[i].c[3] ||
- s2[i].d != s1[i].d ||
- s2[i].e != s1[i].e) {
- H5_FAILED();
- puts(" Incorrect values read from file");
- goto error;
- }
+ for (i = 0; i < NX * NY; i++) {
+ if (s2[i].a != s1[i].a || s2[i].b != s1[i].b || s2[i].c[0] != s1[i].c[0] ||
+ s2[i].c[1] != s1[i].c[1] || s2[i].c[2] != s1[i].c[2] || s2[i].c[3] != s1[i].c[3] ||
+ s2[i].d != s1[i].d || s2[i].e != s1[i].e) {
+ H5_FAILED();
+ puts(" Incorrect values read from file");
+ goto error;
+ }
}
PASSED();
-
/*
*######################################################################
* STEP 9. Read a hyperslab of the file into a complete array in memory.
@@ -615,50 +575,45 @@ test_compound (char *filename, hid_t fapl)
TESTING("hyperslab partial read to array");
/* Create the file data space */
- if ((s8_f_sid = H5Dget_space (dataset)) < 0) goto error;
- f_offset[0] = NX/3;
- f_offset[1] = NY/3;
- h_size[0] = 2*NX/3 - f_offset[0];
- h_size[1] = 2*NY/3 - f_offset[1];
- if (H5Sselect_hyperslab (s8_f_sid, H5S_SELECT_SET, f_offset, NULL,
- h_size, NULL) < 0) goto error;
+ if ((s8_f_sid = H5Dget_space(dataset)) < 0)
+ goto error;
+ f_offset[0] = NX / 3;
+ f_offset[1] = NY / 3;
+ h_size[0] = 2 * NX / 3 - f_offset[0];
+ h_size[1] = 2 * NY / 3 - f_offset[1];
+ if (H5Sselect_hyperslab(s8_f_sid, H5S_SELECT_SET, f_offset, NULL, h_size, NULL) < 0)
+ goto error;
/* Create memory data space */
- if ((s8_m_sid = H5Screate_simple (2, h_size, NULL)) < 0) goto error;
+ if ((s8_m_sid = H5Screate_simple(2, h_size, NULL)) < 0)
+ goto error;
/* Read the dataset */
- s8 = (s1_t *) HDcalloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t));
- assert (s8);
- if (H5Dread (dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8) < 0) {
- goto error;
+ s8 = (s1_t *)HDcalloc((size_t)(h_size[0] * h_size[1]), sizeof(s1_t));
+ assert(s8);
+ if (H5Dread(dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8) < 0) {
+ goto error;
}
/* Compare */
- for (i=0; i<h_size[0]; i++) {
- for (j=0; j<h_size[1]; j++) {
- s1_t *ps1 = s1 + (f_offset[0]+i)*NY + f_offset[1] + j;
- s1_t *ps8 = s8 + i*h_size[1] + j;
-
- if (ps8->a != ps1->a ||
- ps8->b != ps1->b ||
- ps8->c[0] != ps1->c[0] ||
- ps8->c[1] != ps1->c[1] ||
- ps8->c[2] != ps1->c[2] ||
- ps8->c[3] != ps1->c[3] ||
- ps8->d != ps1->d ||
- ps8->e != ps1->e) {
- H5_FAILED();
- puts(" Incorrect values read from file");
- goto error;
+ for (i = 0; i < h_size[0]; i++) {
+ for (j = 0; j < h_size[1]; j++) {
+ s1_t *ps1 = s1 + (f_offset[0] + i) * NY + f_offset[1] + j;
+ s1_t *ps8 = s8 + i * h_size[1] + j;
+
+ if (ps8->a != ps1->a || ps8->b != ps1->b || ps8->c[0] != ps1->c[0] || ps8->c[1] != ps1->c[1] ||
+ ps8->c[2] != ps1->c[2] || ps8->c[3] != ps1->c[3] || ps8->d != ps1->d || ps8->e != ps1->e) {
+ H5_FAILED();
+ puts(" Incorrect values read from file");
+ goto error;
+ }
}
}
- }
- HDfree (s8);
+ HDfree(s8);
s8 = NULL;
PASSED();
-
/*
*######################################################################
* STEP 10. Read a hyperslab of the file into a hyperslab of memory. The
@@ -667,52 +622,41 @@ test_compound (char *filename, hid_t fapl)
TESTING("hyperslab partial read to another hyperslab");
/* Initialize */
- for (i=0; i<NX*NY; i++) {
- s2[i].a = s2[i].b = s2[i].d = s2[i].e = (unsigned)(-1);
- s2[i].c[0] = s2[i].c[1] = s2[i].c[2] = s2[i].c[3] = (unsigned)(-1);
+ for (i = 0; i < NX * NY; i++) {
+ s2[i].a = s2[i].b = s2[i].d = s2[i].e = (unsigned)(-1);
+ s2[i].c[0] = s2[i].c[1] = s2[i].c[2] = s2[i].c[3] = (unsigned)(-1);
}
/* Read the hyperslab */
- if (H5Dread (dataset, s2_tid, s8_f_sid, s8_f_sid, H5P_DEFAULT, s2) < 0) {
- goto error;
+ if (H5Dread(dataset, s2_tid, s8_f_sid, s8_f_sid, H5P_DEFAULT, s2) < 0) {
+ goto error;
}
/* Compare */
- for (i=0; i<NX; i++) {
- for (j=0; j<NY; j++) {
- s1_t *ps1 = s1 + i*NY + j;
- s2_t *ps2 = s2 + i*NY + j;
- if (i>=f_offset[0] &&
- i<f_offset[0]+h_size[0] &&
- j>=f_offset[1] &&
- j<f_offset[1]+h_size[1]) {
- if (ps2->a != ps1->a ||
- ps2->b != ps1->b ||
- ps2->c[0] != ps1->c[0] ||
- ps2->c[1] != ps1->c[1] ||
- ps2->c[2] != ps1->c[2] ||
- ps2->c[3] != ps1->c[3] ||
- ps2->d != ps1->d ||
- ps2->e != ps1->e) {
- H5_FAILED();
- puts(" Memory values clobbered");
- goto error;
+ for (i = 0; i < NX; i++) {
+ for (j = 0; j < NY; j++) {
+ s1_t *ps1 = s1 + i * NY + j;
+ s2_t *ps2 = s2 + i * NY + j;
+ if (i >= f_offset[0] && i < f_offset[0] + h_size[0] && j >= f_offset[1] &&
+ j < f_offset[1] + h_size[1]) {
+ if (ps2->a != ps1->a || ps2->b != ps1->b || ps2->c[0] != ps1->c[0] ||
+ ps2->c[1] != ps1->c[1] || ps2->c[2] != ps1->c[2] || ps2->c[3] != ps1->c[3] ||
+ ps2->d != ps1->d || ps2->e != ps1->e) {
+ H5_FAILED();
+ puts(" Memory values clobbered");
+ goto error;
+ }
+ }
+ else {
+ if (ps2->a != (unsigned)(-1) || ps2->b != (unsigned)(-1) || ps2->c[0] != (unsigned)(-1) ||
+ ps2->c[1] != (unsigned)(-1) || ps2->c[2] != (unsigned)(-1) ||
+ ps2->c[3] != (unsigned)(-1) || ps2->d != (unsigned)(-1) || ps2->e != (unsigned)(-1)) {
+ H5_FAILED();
+ puts(" Incorrect values read from file");
+ goto error;
+ }
+ }
}
- } else {
- if (ps2->a != (unsigned)(-1) ||
- ps2->b != (unsigned)(-1) ||
- ps2->c[0] != (unsigned)(-1) ||
- ps2->c[1] != (unsigned)(-1) ||
- ps2->c[2] != (unsigned)(-1) ||
- ps2->c[3] != (unsigned)(-1) ||
- ps2->d != (unsigned)(-1) ||
- ps2->e != (unsigned)(-1)) {
- H5_FAILED();
- puts(" Incorrect values read from file");
- goto error;
- }
- }
- }
}
PASSED();
@@ -724,62 +668,46 @@ test_compound (char *filename, hid_t fapl)
TESTING("hyperslab to hyperslab part initialized read");
/* Initialize */
- for (i=0; i<NX*NY; i++) {
- s5[i].a = s5[i].b = s5[i].d = s5[i].e = (unsigned)(-1);
- s5[i].c[0] = s5[i].c[1] = s5[i].c[2] = s5[i].c[3] = (unsigned)(-1);
- s5[i].pre = s5[i].mid1 = s5[i].mid2 = s5[i].post = (unsigned)(-1);
+ for (i = 0; i < NX * NY; i++) {
+ s5[i].a = s5[i].b = s5[i].d = s5[i].e = (unsigned)(-1);
+ s5[i].c[0] = s5[i].c[1] = s5[i].c[2] = s5[i].c[3] = (unsigned)(-1);
+ s5[i].pre = s5[i].mid1 = s5[i].mid2 = s5[i].post = (unsigned)(-1);
}
/* Read the hyperslab */
- if (H5Dread (dataset, s5_tid, s8_f_sid, s8_f_sid, PRESERVE, s5) < 0) {
- goto error;
+ if (H5Dread(dataset, s5_tid, s8_f_sid, s8_f_sid, PRESERVE, s5) < 0) {
+ goto error;
}
/* Compare */
- for (i=0; i<NX; i++) {
- for (j=0; j<NY; j++) {
- s1_t *ps1 = s1 + i*NY + j;
- s5_t *ps5 = s5 + i*NY + j;
- if (i>=f_offset[0] &&
- i<f_offset[0]+h_size[0] &&
- j>=f_offset[1] &&
- j<f_offset[1]+h_size[1]) {
- if (ps5->pre != (unsigned)(-1) ||
- ps5->a != ps1->a ||
- ps5->b != ps1->b ||
- ps5->mid1 != (unsigned)(-1) ||
- ps5->c[0] != ps1->c[0] ||
- ps5->c[1] != ps1->c[1] ||
- ps5->c[2] != ps1->c[2] ||
- ps5->c[3] != ps1->c[3] ||
- ps5->mid2 != (unsigned)(-1) ||
- ps5->d != ps1->d ||
- ps5->e != ps1->e ||
- ps5->post != (unsigned)(-1)) {
- H5_FAILED();
- puts(" Memory values clobbered");
- goto error;
- }
- } else {
- if (ps5->pre != (unsigned)(-1) ||
- ps5->a != (unsigned)(-1) ||
- ps5->b != (unsigned)(-1) ||
- ps5->mid1 != (unsigned)(-1) ||
- ps5->c[0] != (unsigned)(-1) ||
- ps5->c[1] != (unsigned)(-1) ||
- ps5->c[2] != (unsigned)(-1) ||
- ps5->c[3] != (unsigned)(-1) ||
- ps5->mid2 != (unsigned)(-1) ||
- ps5->d != (unsigned)(-1) ||
- ps5->e != (unsigned)(-1) ||
- ps5->post != (unsigned)(-1)) {
- H5_FAILED();
- puts(" Incorrect values read from file");
- goto error;
- }
+ for (i = 0; i < NX; i++) {
+ for (j = 0; j < NY; j++) {
+ s1_t *ps1 = s1 + i * NY + j;
+ s5_t *ps5 = s5 + i * NY + j;
+ if (i >= f_offset[0] && i < f_offset[0] + h_size[0] && j >= f_offset[1] &&
+ j < f_offset[1] + h_size[1]) {
+ if (ps5->pre != (unsigned)(-1) || ps5->a != ps1->a || ps5->b != ps1->b ||
+ ps5->mid1 != (unsigned)(-1) || ps5->c[0] != ps1->c[0] || ps5->c[1] != ps1->c[1] ||
+ ps5->c[2] != ps1->c[2] || ps5->c[3] != ps1->c[3] || ps5->mid2 != (unsigned)(-1) ||
+ ps5->d != ps1->d || ps5->e != ps1->e || ps5->post != (unsigned)(-1)) {
+ H5_FAILED();
+ puts(" Memory values clobbered");
+ goto error;
+ }
+ }
+ else {
+ if (ps5->pre != (unsigned)(-1) || ps5->a != (unsigned)(-1) || ps5->b != (unsigned)(-1) ||
+ ps5->mid1 != (unsigned)(-1) || ps5->c[0] != (unsigned)(-1) ||
+ ps5->c[1] != (unsigned)(-1) || ps5->c[2] != (unsigned)(-1) ||
+ ps5->c[3] != (unsigned)(-1) || ps5->mid2 != (unsigned)(-1) || ps5->d != (unsigned)(-1) ||
+ ps5->e != (unsigned)(-1) || ps5->post != (unsigned)(-1)) {
+ H5_FAILED();
+ puts(" Incorrect values read from file");
+ goto error;
+ }
+ }
}
}
- }
PASSED();
/*
@@ -790,73 +718,67 @@ test_compound (char *filename, hid_t fapl)
TESTING("hyperslab part initialized write");
/* Create the memory array and initialize all fields to zero */
- f_offset[0] = NX/3;
- f_offset[1] = NY/3;
- h_size[0] = 2*NX/3 - f_offset[0];
- h_size[1] = 2*NY/3 - f_offset[1];
- s11 = (s4_t *) HDmalloc ((size_t)h_size[0]*(size_t)h_size[1]*sizeof(s4_t));
- assert (s11);
+ f_offset[0] = NX / 3;
+ f_offset[1] = NY / 3;
+ h_size[0] = 2 * NX / 3 - f_offset[0];
+ h_size[1] = 2 * NY / 3 - f_offset[1];
+ s11 = (s4_t *)HDmalloc((size_t)h_size[0] * (size_t)h_size[1] * sizeof(s4_t));
+ assert(s11);
/* Initialize */
- for (i=0; i<h_size[0]*h_size[1]; i++) {
- s11[i].b = s11[i].d = (unsigned)(-1);
+ for (i = 0; i < h_size[0] * h_size[1]; i++) {
+ s11[i].b = s11[i].d = (unsigned)(-1);
}
/* Write to disk */
- if (H5Dwrite (dataset, s4_tid, s8_m_sid, s8_f_sid, PRESERVE, s11) < 0) {
- goto error;
+ if (H5Dwrite(dataset, s4_tid, s8_m_sid, s8_f_sid, PRESERVE, s11) < 0) {
+ goto error;
}
- HDfree (s11);
- s11=NULL;
+ HDfree(s11);
+ s11 = NULL;
/* Read the whole thing */
- if (H5Dread (dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1) < 0) {
- goto error;
+ if (H5Dread(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1) < 0) {
+ goto error;
}
/* Compare */
- for (i=0; i<NX; i++) {
- for (j=0; j<NY; j++) {
- s1_t *ps1 = s1 + i*NY + j;
-
- if (ps1->a != 8*(i*NY+j)+0 ||
- ps1->c[0] != 8*(i*NY+j)+2 ||
- ps1->c[1] != 8*(i*NY+j)+3 ||
- ps1->c[2] != 8*(i*NY+j)+4 ||
- ps1->c[3] != 8*(i*NY+j)+5 ||
- ps1->e != 8*(i*NY+j)+7) {
- H5_FAILED();
- puts(" Write clobbered values");
- goto error;
- }
-
- if (i>=f_offset[0] &&
- i<f_offset[0]+h_size[0] &&
- j>=f_offset[1] &&
- j<f_offset[1]+h_size[1]) {
- if (ps1->b != (unsigned)(-1) ||
- ps1->d != (unsigned)(-1)) {
- H5_FAILED();
- puts(" Wrong values written or read");
- goto error;
- }
- } else {
- if (ps1->b != 8*(i*NY+j)+1 ||
- ps1->d != 8*(i*NY+j)+6) {
- H5_FAILED();
- puts(" Write clobbered values");
- goto error;
+ for (i = 0; i < NX; i++) {
+ for (j = 0; j < NY; j++) {
+ s1_t *ps1 = s1 + i * NY + j;
+
+ if (ps1->a != 8 * (i * NY + j) + 0 || ps1->c[0] != 8 * (i * NY + j) + 2 ||
+ ps1->c[1] != 8 * (i * NY + j) + 3 || ps1->c[2] != 8 * (i * NY + j) + 4 ||
+ ps1->c[3] != 8 * (i * NY + j) + 5 || ps1->e != 8 * (i * NY + j) + 7) {
+ H5_FAILED();
+ puts(" Write clobbered values");
+ goto error;
+ }
+
+ if (i >= f_offset[0] && i < f_offset[0] + h_size[0] && j >= f_offset[1] &&
+ j < f_offset[1] + h_size[1]) {
+ if (ps1->b != (unsigned)(-1) || ps1->d != (unsigned)(-1)) {
+ H5_FAILED();
+ puts(" Wrong values written or read");
+ goto error;
+ }
+ }
+ else {
+ if (ps1->b != 8 * (i * NY + j) + 1 || ps1->d != 8 * (i * NY + j) + 6) {
+ H5_FAILED();
+ puts(" Write clobbered values");
+ goto error;
+ }
+ }
}
- }
- }
}
/*
* Release resources.
*/
- H5Pclose (PRESERVE);
- H5Dclose (dataset);
- H5Fclose (file);
+ H5Pclose(PRESERVE);
+ H5Dclose(dataset);
+ H5Fclose(file);
/* Release buffers */
HDfree(s1);
@@ -873,23 +795,22 @@ error:
puts("*** DATASET TESTS FAILED ***");
/* Release resources */
- if(s1)
+ if (s1)
HDfree(s1);
- if(s2)
+ if (s2)
HDfree(s2);
- if(s3)
+ if (s3)
HDfree(s3);
- if(s4)
+ if (s4)
HDfree(s4);
- if(s5)
+ if (s5)
HDfree(s5);
- if(s6)
+ if (s6)
HDfree(s6);
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: initialize_stype1
*
@@ -906,33 +827,32 @@ error:
static void
initialize_stype1(unsigned char *buf, size_t num)
{
- int i, j;
+ int i, j;
stype1 *s_ptr;
- for(i = 0; i < (int)num; i++) {
- s_ptr = (stype1 *)((void *)buf) + i;
- s_ptr->a = i * 8 + 0;
- s_ptr->b = i * 8 + 1;
- for(j = 0; j < 8; j++)
- s_ptr->c[j] = i * 8 + j;
- s_ptr->d = i * 8 + 6;
- s_ptr->e = i * 8 + 7;
-
- s_ptr->f = (float)(i * 2 / 3);
- s_ptr->g = (float)(i * 2 / 3 + 1);
- for(j = 0; j < 16; j++)
- s_ptr->h[j] = (float)(i * j / 5 + j);
- s_ptr->i = (float)(i * 2 / 3 + 2);
- s_ptr->j = (float)(i * 2 / 3 + 3);
-
- s_ptr->k = i / 7 + 1;
- s_ptr->l = i / 7 + 2;
- s_ptr->m = i / 7 + 3;
- s_ptr->n = i / 7 + 4;
+ for (i = 0; i < (int)num; i++) {
+ s_ptr = (stype1 *)((void *)buf) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ for (j = 0; j < 8; j++)
+ s_ptr->c[j] = i * 8 + j;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for (j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = i / 7 + 1;
+ s_ptr->l = i / 7 + 2;
+ s_ptr->m = i / 7 + 3;
+ s_ptr->n = i / 7 + 4;
}
}
-
/*-------------------------------------------------------------------------
* Function: initialize_stype2
*
@@ -949,37 +869,36 @@ initialize_stype1(unsigned char *buf, size_t num)
static void
initialize_stype2(unsigned char *buf, size_t num)
{
- size_t i, j;
+ size_t i, j;
stype2 *s_ptr;
- for(i = 0; i < num; i++) {
- s_ptr = (stype2 *)((void *)buf) + i;
- s_ptr->a = (int)(i * 8 + 0);
- s_ptr->b = (int)(i * 8 + 1);
- for(j = 0; j < 8; j++)
- s_ptr->c[j] = (int)(i * 8 + j);
- s_ptr->d = (int)(i * 8 + 6);
- s_ptr->e = (int)(i * 8 + 7);
-
- s_ptr->f = (float)(i * 2 / 3);
- s_ptr->g = (float)(i * 2 / 3 + 1);
- for(j = 0; j < 16; j++)
- s_ptr->h[j] = (float)(i * j / 5 + j);
- s_ptr->i = (float)(i * 2 / 3 + 2);
- s_ptr->j = (float)(i * 2 / 3 + 3);
-
- s_ptr->k = (double)(i / 7 + 1);
- s_ptr->l = (double)(i / 7 + 2);
- s_ptr->m = (double)(i / 7 + 3);
- s_ptr->n = (double)(i / 7 + 4);
-
- s_ptr->o = (long)(i * 3 + 0);
- s_ptr->p = (long)(i * 3 + 1);
- s_ptr->q = (long)(i * 3 + 2);
+ for (i = 0; i < num; i++) {
+ s_ptr = (stype2 *)((void *)buf) + i;
+ s_ptr->a = (int)(i * 8 + 0);
+ s_ptr->b = (int)(i * 8 + 1);
+ for (j = 0; j < 8; j++)
+ s_ptr->c[j] = (int)(i * 8 + j);
+ s_ptr->d = (int)(i * 8 + 6);
+ s_ptr->e = (int)(i * 8 + 7);
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for (j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = (double)(i / 7 + 1);
+ s_ptr->l = (double)(i / 7 + 2);
+ s_ptr->m = (double)(i / 7 + 3);
+ s_ptr->n = (double)(i / 7 + 4);
+
+ s_ptr->o = (long)(i * 3 + 0);
+ s_ptr->p = (long)(i * 3 + 1);
+ s_ptr->q = (long)(i * 3 + 2);
}
}
-
/*-------------------------------------------------------------------------
* Function: initialize_stype3
*
@@ -996,21 +915,20 @@ initialize_stype2(unsigned char *buf, size_t num)
static void
initialize_stype3(unsigned char *buf, size_t num)
{
- int i, j;
+ int i, j;
stype3 *s_ptr;
- for(i = 0; i < (int)num; i++) {
- s_ptr = (stype3 *)((void *)buf) + i;
- s_ptr->a = i * 8 + 0;
- s_ptr->b = i * 8 + 1;
- for(j = 0; j < 8; j++)
- s_ptr->c[j] = i * 8 + j;
- s_ptr->d = i * 8 + 6;
- s_ptr->e = i * 8 + 7;
+ for (i = 0; i < (int)num; i++) {
+ s_ptr = (stype3 *)((void *)buf) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ for (j = 0; j < 8; j++)
+ s_ptr->c[j] = i * 8 + j;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
}
-
/*-------------------------------------------------------------------------
* Function: initialize_stype4
*
@@ -1027,41 +945,40 @@ initialize_stype3(unsigned char *buf, size_t num)
static void
initialize_stype4(unsigned char *buf, size_t num)
{
- size_t i, j;
+ size_t i, j;
stype4 *s_ptr;
- for(i = 0; i < num; i++) {
- s_ptr = (stype4 *)((void *)buf) + i;
- s_ptr->a = (int)(i * 8 + 0);
- s_ptr->b = (int)(i * 8 + 1);
- for(j = 0; j < 8; j++)
- s_ptr->c[j] = (int)(i * 8 + j);
- s_ptr->d = (int)(i * 8 + 6);
- s_ptr->e = (int)(i * 8 + 7);
-
- s_ptr->f = (float)(i * 2 / 3);
- s_ptr->g = (float)(i * 2 / 3 + 1);
- for(j = 0; j < 16; j++)
- s_ptr->h[j] = (float)(i * j / 5 + j);
- s_ptr->i = (float)(i * 2 / 3 + 2);
- s_ptr->j = (float)(i * 2 / 3 + 3);
-
- s_ptr->k = (double)(i / 7 + 1);
- s_ptr->l = (double)(i / 7 + 2);
- s_ptr->m = (double)(i / 7 + 3);
- s_ptr->n = (double)(i / 7 + 4);
-
- s_ptr->o = (long)(i * 3 + 0);
- s_ptr->p = (long)(i * 3 + 1);
- s_ptr->q = (long)(i * 3 + 2);
-
- s_ptr->r = (long long)(i * 5 + 1);
- s_ptr->s = (long long)(i * 5 + 2);
- s_ptr->t = (long long)(i * 5 + 3);
+ for (i = 0; i < num; i++) {
+ s_ptr = (stype4 *)((void *)buf) + i;
+ s_ptr->a = (int)(i * 8 + 0);
+ s_ptr->b = (int)(i * 8 + 1);
+ for (j = 0; j < 8; j++)
+ s_ptr->c[j] = (int)(i * 8 + j);
+ s_ptr->d = (int)(i * 8 + 6);
+ s_ptr->e = (int)(i * 8 + 7);
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for (j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = (double)(i / 7 + 1);
+ s_ptr->l = (double)(i / 7 + 2);
+ s_ptr->m = (double)(i / 7 + 3);
+ s_ptr->n = (double)(i / 7 + 4);
+
+ s_ptr->o = (long)(i * 3 + 0);
+ s_ptr->p = (long)(i * 3 + 1);
+ s_ptr->q = (long)(i * 3 + 2);
+
+ s_ptr->r = (long long)(i * 5 + 1);
+ s_ptr->s = (long long)(i * 5 + 2);
+ s_ptr->t = (long long)(i * 5 + 3);
}
}
-
/*-------------------------------------------------------------------------
* Function: create_stype1
*
@@ -1080,35 +997,35 @@ initialize_stype4(unsigned char *buf, size_t num)
static hid_t
create_stype1(void)
{
- hid_t array_dt1, array_dt2, tid;
- const hsize_t eight = 8, sixteen = 16;
+ hid_t array_dt1, array_dt2, tid;
+ const hsize_t eight = 8, sixteen = 16;
/* Build hdf5 datatypes */
- if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0)
+ if ((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT, 1, &eight)) < 0)
goto error;
- if((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT,1, &sixteen)) < 0)
+ if ((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &sixteen)) < 0)
goto error;
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype1))) < 0 ||
- H5Tinsert(tid, "a", HOFFSET(stype1, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "b", HOFFSET(stype1, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "c", HOFFSET(stype1, c), array_dt1) < 0 ||
- H5Tinsert(tid, "d", HOFFSET(stype1, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "e", HOFFSET(stype1, e), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "f", HOFFSET(stype1, f), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "g", HOFFSET(stype1, g), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "h", HOFFSET(stype1, h), array_dt2) < 0 ||
- H5Tinsert(tid, "i", HOFFSET(stype1, i), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "j", HOFFSET(stype1, j), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "k", HOFFSET(stype1, k), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "l", HOFFSET(stype1, l), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "m", HOFFSET(stype1, m), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "n", HOFFSET(stype1, n), H5T_NATIVE_DOUBLE) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype1))) < 0 ||
+ H5Tinsert(tid, "a", HOFFSET(stype1, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "b", HOFFSET(stype1, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "c", HOFFSET(stype1, c), array_dt1) < 0 ||
+ H5Tinsert(tid, "d", HOFFSET(stype1, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "e", HOFFSET(stype1, e), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "f", HOFFSET(stype1, f), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "g", HOFFSET(stype1, g), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "h", HOFFSET(stype1, h), array_dt2) < 0 ||
+ H5Tinsert(tid, "i", HOFFSET(stype1, i), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "j", HOFFSET(stype1, j), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "k", HOFFSET(stype1, k), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "l", HOFFSET(stype1, l), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "m", HOFFSET(stype1, m), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "n", HOFFSET(stype1, n), H5T_NATIVE_DOUBLE) < 0)
goto error;
- if(H5Tclose(array_dt1) < 0)
+ if (H5Tclose(array_dt1) < 0)
goto error;
- if(H5Tclose(array_dt2) < 0)
+ if (H5Tclose(array_dt2) < 0)
goto error;
return tid;
@@ -1117,7 +1034,6 @@ error:
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: create_stype2
*
@@ -1136,38 +1052,38 @@ error:
static hid_t
create_stype2(void)
{
- hid_t array_dt1, array_dt2, tid;
- const hsize_t eight = 8, sixteen = 16;
+ hid_t array_dt1, array_dt2, tid;
+ const hsize_t eight = 8, sixteen = 16;
/* Build hdf5 datatypes */
- if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0)
+ if ((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT, 1, &eight)) < 0)
goto error;
- if((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT,1, &sixteen)) < 0)
+ if ((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &sixteen)) < 0)
goto error;
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype2))) < 0 ||
- H5Tinsert(tid, "a", HOFFSET(stype2, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "b", HOFFSET(stype2, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "c", HOFFSET(stype2, c), array_dt1) < 0 ||
- H5Tinsert(tid, "d", HOFFSET(stype2, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "e", HOFFSET(stype2, e), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "f", HOFFSET(stype2, f), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "g", HOFFSET(stype2, g), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "h", HOFFSET(stype2, h), array_dt2) < 0 ||
- H5Tinsert(tid, "i", HOFFSET(stype2, i), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "j", HOFFSET(stype2, j), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "k", HOFFSET(stype2, k), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "l", HOFFSET(stype2, l), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "m", HOFFSET(stype2, m), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "n", HOFFSET(stype2, n), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "o", HOFFSET(stype2, o), H5T_NATIVE_LONG) < 0 ||
- H5Tinsert(tid, "p", HOFFSET(stype2, p), H5T_NATIVE_LONG) < 0 ||
- H5Tinsert(tid, "q", HOFFSET(stype2, q), H5T_NATIVE_LONG) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype2))) < 0 ||
+ H5Tinsert(tid, "a", HOFFSET(stype2, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "b", HOFFSET(stype2, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "c", HOFFSET(stype2, c), array_dt1) < 0 ||
+ H5Tinsert(tid, "d", HOFFSET(stype2, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "e", HOFFSET(stype2, e), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "f", HOFFSET(stype2, f), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "g", HOFFSET(stype2, g), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "h", HOFFSET(stype2, h), array_dt2) < 0 ||
+ H5Tinsert(tid, "i", HOFFSET(stype2, i), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "j", HOFFSET(stype2, j), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "k", HOFFSET(stype2, k), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "l", HOFFSET(stype2, l), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "m", HOFFSET(stype2, m), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "n", HOFFSET(stype2, n), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "o", HOFFSET(stype2, o), H5T_NATIVE_LONG) < 0 ||
+ H5Tinsert(tid, "p", HOFFSET(stype2, p), H5T_NATIVE_LONG) < 0 ||
+ H5Tinsert(tid, "q", HOFFSET(stype2, q), H5T_NATIVE_LONG) < 0)
goto error;
- if(H5Tclose(array_dt1) < 0)
+ if (H5Tclose(array_dt1) < 0)
goto error;
- if(H5Tclose(array_dt2) < 0)
+ if (H5Tclose(array_dt2) < 0)
goto error;
return tid;
@@ -1176,7 +1092,6 @@ error:
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: create_stype3
*
@@ -1195,22 +1110,22 @@ error:
static hid_t
create_stype3(void)
{
- hid_t array_dt1, tid;
- const hsize_t eight = 8;
+ hid_t array_dt1, tid;
+ const hsize_t eight = 8;
/* Build hdf5 datatypes */
- if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0)
+ if ((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT, 1, &eight)) < 0)
goto error;
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype3))) < 0 ||
- H5Tinsert(tid, "a", HOFFSET(stype3, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "b", HOFFSET(stype3, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "c", HOFFSET(stype3, c), array_dt1) < 0 ||
- H5Tinsert(tid, "d", HOFFSET(stype3, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "e", HOFFSET(stype3, e), H5T_NATIVE_INT) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype3))) < 0 ||
+ H5Tinsert(tid, "a", HOFFSET(stype3, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "b", HOFFSET(stype3, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "c", HOFFSET(stype3, c), array_dt1) < 0 ||
+ H5Tinsert(tid, "d", HOFFSET(stype3, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "e", HOFFSET(stype3, e), H5T_NATIVE_INT) < 0)
goto error;
- if(H5Tclose(array_dt1) < 0)
+ if (H5Tclose(array_dt1) < 0)
goto error;
return tid;
@@ -1219,7 +1134,6 @@ error:
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: create_stype4
*
@@ -1238,41 +1152,41 @@ error:
static hid_t
create_stype4(void)
{
- hid_t array_dt1, array_dt2, tid;
- const hsize_t eight = 8, sixteen = 16;
+ hid_t array_dt1, array_dt2, tid;
+ const hsize_t eight = 8, sixteen = 16;
/* Build hdf5 datatypes */
- if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0)
+ if ((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT, 1, &eight)) < 0)
goto error;
- if((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT,1, &sixteen)) < 0)
+ if ((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &sixteen)) < 0)
goto error;
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype4))) < 0 ||
- H5Tinsert(tid, "a", HOFFSET(stype4, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "b", HOFFSET(stype4, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "c", HOFFSET(stype4, c), array_dt1) < 0 ||
- H5Tinsert(tid, "d", HOFFSET(stype4, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "e", HOFFSET(stype4, e), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(tid, "f", HOFFSET(stype4, f), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "g", HOFFSET(stype4, g), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "h", HOFFSET(stype4, h), array_dt2) < 0 ||
- H5Tinsert(tid, "i", HOFFSET(stype4, i), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "j", HOFFSET(stype4, j), H5T_NATIVE_FLOAT) < 0 ||
- H5Tinsert(tid, "k", HOFFSET(stype4, k), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "l", HOFFSET(stype4, l), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "m", HOFFSET(stype4, m), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "n", HOFFSET(stype4, n), H5T_NATIVE_DOUBLE) < 0 ||
- H5Tinsert(tid, "o", HOFFSET(stype4, o), H5T_NATIVE_LONG) < 0 ||
- H5Tinsert(tid, "p", HOFFSET(stype4, p), H5T_NATIVE_LONG) < 0 ||
- H5Tinsert(tid, "q", HOFFSET(stype4, q), H5T_NATIVE_LONG) < 0 ||
- H5Tinsert(tid, "r", HOFFSET(stype4, r), H5T_NATIVE_LLONG) < 0 ||
- H5Tinsert(tid, "s", HOFFSET(stype4, s), H5T_NATIVE_LLONG) < 0 ||
- H5Tinsert(tid, "t", HOFFSET(stype4, t), H5T_NATIVE_LLONG) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype4))) < 0 ||
+ H5Tinsert(tid, "a", HOFFSET(stype4, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "b", HOFFSET(stype4, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "c", HOFFSET(stype4, c), array_dt1) < 0 ||
+ H5Tinsert(tid, "d", HOFFSET(stype4, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "e", HOFFSET(stype4, e), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(tid, "f", HOFFSET(stype4, f), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "g", HOFFSET(stype4, g), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "h", HOFFSET(stype4, h), array_dt2) < 0 ||
+ H5Tinsert(tid, "i", HOFFSET(stype4, i), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "j", HOFFSET(stype4, j), H5T_NATIVE_FLOAT) < 0 ||
+ H5Tinsert(tid, "k", HOFFSET(stype4, k), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "l", HOFFSET(stype4, l), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "m", HOFFSET(stype4, m), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "n", HOFFSET(stype4, n), H5T_NATIVE_DOUBLE) < 0 ||
+ H5Tinsert(tid, "o", HOFFSET(stype4, o), H5T_NATIVE_LONG) < 0 ||
+ H5Tinsert(tid, "p", HOFFSET(stype4, p), H5T_NATIVE_LONG) < 0 ||
+ H5Tinsert(tid, "q", HOFFSET(stype4, q), H5T_NATIVE_LONG) < 0 ||
+ H5Tinsert(tid, "r", HOFFSET(stype4, r), H5T_NATIVE_LLONG) < 0 ||
+ H5Tinsert(tid, "s", HOFFSET(stype4, s), H5T_NATIVE_LLONG) < 0 ||
+ H5Tinsert(tid, "t", HOFFSET(stype4, t), H5T_NATIVE_LLONG) < 0)
goto error;
- if(H5Tclose(array_dt1) < 0)
+ if (H5Tclose(array_dt1) < 0)
goto error;
- if(H5Tclose(array_dt2) < 0)
+ if (H5Tclose(array_dt2) < 0)
goto error;
return tid;
@@ -1281,7 +1195,6 @@ error:
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: compare_data
*
@@ -1300,57 +1213,53 @@ error:
static int
compare_data(void *src_data, void *dst_data, hbool_t src_subset)
{
- stype1 *s_ptr;
- stype2 *d_ptr;
+ stype1 *s_ptr;
+ stype2 *d_ptr;
int i;
- for(i = 0; i < (int)(NX * NY); i++) {
- if(src_subset) {
- s_ptr = ((stype1 *)src_data) + i;
- d_ptr = ((stype2 *)dst_data) + i;
- } else {
- s_ptr = (stype1 *)(((stype2 *)src_data) + i);
- d_ptr = (stype2 *)(((stype1 *)dst_data) + i);
+ for (i = 0; i < (int)(NX * NY); i++) {
+ if (src_subset) {
+ s_ptr = ((stype1 *)src_data) + i;
+ d_ptr = ((stype2 *)dst_data) + i;
+ }
+ else {
+ s_ptr = (stype1 *)(((stype2 *)src_data) + i);
+ d_ptr = (stype2 *)(((stype1 *)dst_data) + i);
}
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e ||
- !H5_FLT_ABS_EQUAL(s_ptr->f, d_ptr->f) ||
- !H5_FLT_ABS_EQUAL(s_ptr->g, d_ptr->g) ||
- !H5_FLT_ABS_EQUAL(s_ptr->h[0], d_ptr->h[0]) ||
- !H5_FLT_ABS_EQUAL(s_ptr->h[1], d_ptr->h[1]) ||
- !H5_FLT_ABS_EQUAL(s_ptr->i, d_ptr->i) ||
- !H5_FLT_ABS_EQUAL(s_ptr->j, d_ptr->j) ||
- !H5_DBL_ABS_EQUAL(s_ptr->k, d_ptr->k) ||
- !H5_DBL_ABS_EQUAL(s_ptr->l, d_ptr->l) ||
- !H5_DBL_ABS_EQUAL(s_ptr->m, d_ptr->m) ||
- !H5_DBL_ABS_EQUAL(s_ptr->n, d_ptr->n) ) {
-
- H5_FAILED();
- HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->c[4], s_ptr->c[5], s_ptr->c[6], s_ptr->c[7],
- s_ptr->d, s_ptr->e, (double)s_ptr->f, (double)s_ptr->g,(double)s_ptr->h[0],(double)s_ptr->h[1],(double)s_ptr->h[2],
- (double)s_ptr->h[3],(double)s_ptr->h[4],(double)s_ptr->h[5],(double)s_ptr->h[6],(double)s_ptr->h[7],(double)s_ptr->h[8],
- (double)s_ptr->h[9],(double)s_ptr->h[10],(double)s_ptr->h[11],(double)s_ptr->h[12],(double)s_ptr->h[13],(double)s_ptr->h[14],
- (double)s_ptr->h[15], (double)s_ptr->i,(double)s_ptr->j,s_ptr->k,s_ptr->l,s_ptr->m,s_ptr->n);
- HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n",
- d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->c[4], d_ptr->c[5], d_ptr->c[6], d_ptr->c[7],
- d_ptr->d, d_ptr->e, (double)d_ptr->f, (double)d_ptr->g,(double)d_ptr->h[0],(double)d_ptr->h[1],(double)d_ptr->h[2],
- (double)d_ptr->h[3],(double)d_ptr->h[4],(double)d_ptr->h[5],(double)d_ptr->h[6],(double)d_ptr->h[7],(double)d_ptr->h[8],
- (double)d_ptr->h[9],(double)d_ptr->h[10],(double)d_ptr->h[11],(double)d_ptr->h[12],(double)d_ptr->h[13],
- (double)d_ptr->h[14],(double)d_ptr->h[15],(double)d_ptr->i,(double)d_ptr->j,d_ptr->k,d_ptr->l,
- d_ptr->m,d_ptr->n);
- goto error;
- }
+ if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e || !H5_FLT_ABS_EQUAL(s_ptr->f, d_ptr->f) ||
+ !H5_FLT_ABS_EQUAL(s_ptr->g, d_ptr->g) || !H5_FLT_ABS_EQUAL(s_ptr->h[0], d_ptr->h[0]) ||
+ !H5_FLT_ABS_EQUAL(s_ptr->h[1], d_ptr->h[1]) || !H5_FLT_ABS_EQUAL(s_ptr->i, d_ptr->i) ||
+ !H5_FLT_ABS_EQUAL(s_ptr->j, d_ptr->j) || !H5_DBL_ABS_EQUAL(s_ptr->k, d_ptr->k) ||
+ !H5_DBL_ABS_EQUAL(s_ptr->l, d_ptr->l) || !H5_DBL_ABS_EQUAL(s_ptr->m, d_ptr->m) ||
+ !H5_DBL_ABS_EQUAL(s_ptr->n, d_ptr->n)) {
+
+ H5_FAILED();
+ HDprintf(" i=%d\n", i);
+ HDprintf(
+ " src={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, "
+ "h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n",
+ s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], s_ptr->c[3], s_ptr->c[4],
+ s_ptr->c[5], s_ptr->c[6], s_ptr->c[7], s_ptr->d, s_ptr->e, (double)s_ptr->f, (double)s_ptr->g,
+ (double)s_ptr->h[0], (double)s_ptr->h[1], (double)s_ptr->h[2], (double)s_ptr->h[3],
+ (double)s_ptr->h[4], (double)s_ptr->h[5], (double)s_ptr->h[6], (double)s_ptr->h[7],
+ (double)s_ptr->h[8], (double)s_ptr->h[9], (double)s_ptr->h[10], (double)s_ptr->h[11],
+ (double)s_ptr->h[12], (double)s_ptr->h[13], (double)s_ptr->h[14], (double)s_ptr->h[15],
+ (double)s_ptr->i, (double)s_ptr->j, s_ptr->k, s_ptr->l, s_ptr->m, s_ptr->n);
+ HDprintf(
+ " dst={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, "
+ "h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n",
+ d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], d_ptr->c[3], d_ptr->c[4],
+ d_ptr->c[5], d_ptr->c[6], d_ptr->c[7], d_ptr->d, d_ptr->e, (double)d_ptr->f, (double)d_ptr->g,
+ (double)d_ptr->h[0], (double)d_ptr->h[1], (double)d_ptr->h[2], (double)d_ptr->h[3],
+ (double)d_ptr->h[4], (double)d_ptr->h[5], (double)d_ptr->h[6], (double)d_ptr->h[7],
+ (double)d_ptr->h[8], (double)d_ptr->h[9], (double)d_ptr->h[10], (double)d_ptr->h[11],
+ (double)d_ptr->h[12], (double)d_ptr->h[13], (double)d_ptr->h[14], (double)d_ptr->h[15],
+ (double)d_ptr->i, (double)d_ptr->j, d_ptr->k, d_ptr->l, d_ptr->m, d_ptr->n);
+ goto error;
+ }
}
return SUCCEED;
@@ -1359,7 +1268,6 @@ error:
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: test_hdf5_src_subset
*
@@ -1388,45 +1296,44 @@ error:
static unsigned
test_hdf5_src_subset(char *filename, hid_t fapl)
{
- hid_t file;
- hid_t rew_tid, src_tid, dst_tid;
- hid_t dataset;
- hid_t space;
- hid_t dcpl, dxpl;
- hsize_t dims[2] = {NX, NY};
- hsize_t chunk_dims[2] = {NX/10, NY/10};
- unsigned char *orig=NULL, *rew_buf=NULL, *rbuf=NULL;
+ hid_t file;
+ hid_t rew_tid, src_tid, dst_tid;
+ hid_t dataset;
+ hid_t space;
+ hid_t dcpl, dxpl;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t chunk_dims[2] = {NX / 10, NY / 10};
+ unsigned char *orig = NULL, *rew_buf = NULL, *rbuf = NULL;
/* Create the file for this test */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
/* Build hdf5 datatypes */
- if ((src_tid=create_stype1()) < 0)
+ if ((src_tid = create_stype1()) < 0)
goto error;
- if ((dst_tid=create_stype2()) < 0)
+ if ((dst_tid = create_stype2()) < 0)
goto error;
- if ((rew_tid=create_stype3()) < 0)
+ if ((rew_tid = create_stype3()) < 0)
goto error;
/* Create the data space */
- if((space = H5Screate_simple(2, dims, NULL)) < 0)
- goto error;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
/* Allocate space and initialize data */
- orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype1));
- initialize_stype1(orig, (size_t)NX*NY);
-
- rbuf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype2));
+ orig = (unsigned char *)HDmalloc(NX * NY * sizeof(stype1));
+ initialize_stype1(orig, (size_t)NX * NY);
- rew_buf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype3));
- initialize_stype3(rew_buf, (size_t)NX*NY);
+ rbuf = (unsigned char *)HDmalloc(NX * NY * sizeof(stype2));
+ rew_buf = (unsigned char *)HDmalloc(NX * NY * sizeof(stype3));
+ initialize_stype3(rew_buf, (size_t)NX * NY);
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/*
@@ -1436,29 +1343,29 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
TESTING("writing data to contiguous and chunked datasets");
/* Create contiguous data set */
- if((dataset = H5Dcreate2(file, DSET_NAME[0], src_tid, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_NAME[0], src_tid, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0)
- goto error;
+ if (H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0)
+ goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
/* Set chunking */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
goto error;
/* Create chunked data set */
- if((dataset = H5Dcreate2(file, DSET_NAME[1], src_tid, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_NAME[1], src_tid, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0)
- goto error;
+ if (H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0)
+ goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
PASSED();
@@ -1470,32 +1377,32 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
TESTING("rewriting data with a subset of original data type");
/* Create xfer properties to preserve initialized data */
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ FAIL_STACK_ERROR
- if(H5Pset_preserve(dxpl, TRUE) < 0)
- FAIL_STACK_ERROR
+ if (H5Pset_preserve(dxpl, TRUE) < 0)
+ FAIL_STACK_ERROR
/* Rewrite contiguous data set */
- if((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write the data to the dataset */
- if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
- FAIL_STACK_ERROR
+ if (H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
+ FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
/* Rewrite chunked data set */
- if((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write the data to the dataset */
- if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
- FAIL_STACK_ERROR
+ if (H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
+ FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1507,48 +1414,48 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
TESTING("reading data with a subset of original data type");
/* Check contiguous data set */
- if((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
+ if (H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
FAIL_STACK_ERROR
- if(compare_data(orig, rbuf, TRUE) < 0)
+ if (compare_data(orig, rbuf, TRUE) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
/* Check chunked data set */
- if((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
+ if (H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
FAIL_STACK_ERROR
- if(compare_data(orig, rbuf, TRUE) < 0)
+ if (compare_data(orig, rbuf, TRUE) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
/* Finishing test and release resources */
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dxpl) < 0)
+ if (H5Pclose(dxpl) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(src_tid) < 0)
+ if (H5Tclose(src_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(dst_tid) < 0)
+ if (H5Tclose(dst_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(rew_tid) < 0)
+ if (H5Tclose(rew_tid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
HDfree(orig);
@@ -1563,7 +1470,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_hdf5_dst_subset
*
@@ -1593,44 +1499,44 @@ error:
static unsigned
test_hdf5_dst_subset(char *filename, hid_t fapl)
{
- hid_t file;
- hid_t rew_tid, src_tid, dst_tid;
- hid_t dataset;
- hid_t space;
- hid_t dcpl, dxpl;
- hsize_t dims[2] = {NX, NY};
- hsize_t chunk_dims[2] = {NX/10, NY/10};
- unsigned char *orig=NULL, *rew_buf=NULL, *rbuf=NULL;
+ hid_t file;
+ hid_t rew_tid, src_tid, dst_tid;
+ hid_t dataset;
+ hid_t space;
+ hid_t dcpl, dxpl;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t chunk_dims[2] = {NX / 10, NY / 10};
+ unsigned char *orig = NULL, *rew_buf = NULL, *rbuf = NULL;
/* Create the file for this test */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
/* Build hdf5 datatypes */
- if ((src_tid=create_stype2()) < 0)
+ if ((src_tid = create_stype2()) < 0)
goto error;
- if ((dst_tid=create_stype1()) < 0)
+ if ((dst_tid = create_stype1()) < 0)
goto error;
- if ((rew_tid=create_stype4()) < 0)
+ if ((rew_tid = create_stype4()) < 0)
goto error;
/* Create the data space */
- if((space = H5Screate_simple(2, dims, NULL)) < 0)
- goto error;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
/* Allocate space and initialize data */
- orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype2));
- initialize_stype2(orig, (size_t)NX*NY);
+ orig = (unsigned char *)HDmalloc(NX * NY * sizeof(stype2));
+ initialize_stype2(orig, (size_t)NX * NY);
- rbuf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype1));
+ rbuf = (unsigned char *)HDmalloc(NX * NY * sizeof(stype1));
- rew_buf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype4));
- initialize_stype4(rew_buf, (size_t)NX*NY);
+ rew_buf = (unsigned char *)HDmalloc(NX * NY * sizeof(stype4));
+ initialize_stype4(rew_buf, (size_t)NX * NY);
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/*
@@ -1640,29 +1546,29 @@ test_hdf5_dst_subset(char *filename, hid_t fapl)
TESTING("writing data to contiguous and chunked datasets");
/* Create contiguous data set */
- if((dataset = H5Dcreate2(file, DSET_NAME[2], src_tid, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_NAME[2], src_tid, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0)
- goto error;
+ if (H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0)
+ goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
/* Set chunking */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
goto error;
/* Create chunked data set */
- if((dataset = H5Dcreate2(file, DSET_NAME[3], src_tid, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_NAME[3], src_tid, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0)
- goto error;
+ if (H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0)
+ goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
PASSED();
@@ -1674,32 +1580,32 @@ test_hdf5_dst_subset(char *filename, hid_t fapl)
TESTING("rewriting data with a subset of original data type");
/* Create xfer properties to preserve initialized data */
- if((dxpl = H5Pcreate (H5P_DATASET_XFER)) < 0)
- goto error;
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
- if(H5Pset_preserve(dxpl, TRUE) < 0)
- goto error;
+ if (H5Pset_preserve(dxpl, TRUE) < 0)
+ goto error;
/* Rewrite contiguous data set */
- if((dataset = H5Dopen2(file, DSET_NAME[2], H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_NAME[2], H5P_DEFAULT)) < 0)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
- goto error;
+ if (H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
+ goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
/* Rewrite chunked data set */
- if((dataset = H5Dopen2(file, DSET_NAME[3], H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_NAME[3], H5P_DEFAULT)) < 0)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
- goto error;
+ if (H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
+ goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
PASSED();
@@ -1711,48 +1617,48 @@ test_hdf5_dst_subset(char *filename, hid_t fapl)
TESTING("reading data with a subset of original data type");
/* Check contiguous data set */
- if((dataset = H5Dopen2(file, DSET_NAME[2], H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_NAME[2], H5P_DEFAULT)) < 0)
goto error;
- if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
+ if (H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
goto error;
- if(compare_data(orig, rbuf, FALSE) < 0)
+ if (compare_data(orig, rbuf, FALSE) < 0)
goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
/* Check chunked data set */
- if((dataset = H5Dopen2(file, DSET_NAME[3], H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_NAME[3], H5P_DEFAULT)) < 0)
goto error;
- if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
+ if (H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
goto error;
- if(compare_data(orig, rbuf, FALSE) < 0)
+ if (compare_data(orig, rbuf, FALSE) < 0)
goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
/* Finishing test and release resources */
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Pclose(dxpl) < 0)
+ if (H5Pclose(dxpl) < 0)
goto error;
- if(H5Tclose(src_tid) < 0)
+ if (H5Tclose(src_tid) < 0)
goto error;
- if(H5Tclose(dst_tid) < 0)
+ if (H5Tclose(dst_tid) < 0)
goto error;
- if(H5Tclose(rew_tid) < 0)
+ if (H5Tclose(rew_tid) < 0)
goto error;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
HDfree(orig);
@@ -1769,18 +1675,18 @@ error:
/* Error macro that outputs the state of the randomly generated variables so the
* failure can be reproduced */
-#define PACK_OOO_ERROR \
-{ \
- int _i; \
- H5_FAILED(); AT(); \
- HDprintf(" Insertion order ="); \
- for(_i=0; _i<PACK_NMEMBS; _i++) \
- HDprintf(" %d", order[_i]); \
- HDprintf("\n Inner compound order = %d, location = %d\n", sub_cmpd_order, order[sub_cmpd_order]); \
- fflush(stdout); \
- goto error; \
-}
-
+#define PACK_OOO_ERROR \
+ { \
+ int _i; \
+ H5_FAILED(); \
+ AT(); \
+ HDprintf(" Insertion order ="); \
+ for (_i = 0; _i < PACK_NMEMBS; _i++) \
+ HDprintf(" %d", order[_i]); \
+ HDprintf("\n Inner compound order = %d, location = %d\n", sub_cmpd_order, order[sub_cmpd_order]); \
+ fflush(stdout); \
+ goto error; \
+ }
/*-------------------------------------------------------------------------
* Function: test_pack_ooo
@@ -1802,44 +1708,44 @@ error:
static unsigned
test_pack_ooo(void)
{
- hid_t cmpd, sub_cmpd; /* Datatype IDs */
- H5T_t *dt; /* Datatype pointer */
- unsigned order[PACK_NMEMBS]; /* Order of insertion */
- unsigned free_order[PACK_NMEMBS]; /* Index of remaining free slots in order */
- unsigned num_free; /* Number of free slots in order */
- unsigned sub_cmpd_order; /* Order to insert the inner compound */
- char name[16]; /* Member name */
- unsigned extra_space; /* Whether to add extra space to the end of
- * the compound */
- unsigned i, j; /* Indices */
-
- HDsrand((unsigned) time(NULL));
+ hid_t cmpd, sub_cmpd; /* Datatype IDs */
+ H5T_t * dt; /* Datatype pointer */
+ unsigned order[PACK_NMEMBS]; /* Order of insertion */
+ unsigned free_order[PACK_NMEMBS]; /* Index of remaining free slots in order */
+ unsigned num_free; /* Number of free slots in order */
+ unsigned sub_cmpd_order; /* Order to insert the inner compound */
+ char name[16]; /* Member name */
+ unsigned extra_space; /* Whether to add extra space to the end of
+ * the compound */
+ unsigned i, j; /* Indices */
+
+ HDsrand((unsigned)time(NULL));
/* Initialize "free_order" array to indicate that all slots in order are
* free */
- for(i=0; i<PACK_NMEMBS; i++)
+ for (i = 0; i < PACK_NMEMBS; i++)
free_order[i] = i;
/* Create "order" array */
- for(i=0; i<PACK_NMEMBS; i++) {
+ for (i = 0; i < PACK_NMEMBS; i++) {
/* Generate index into free_order array */
num_free = PACK_NMEMBS - i;
- j = (unsigned)HDrandom() % num_free;
+ j = (unsigned)HDrandom() % num_free;
/* Update order array at the randomly generated (but guaranteed to be
* free) location */
order[free_order[j]] = i;
/* Reshape free_order to remove j (which is no longer free) */
- if(j < (num_free - 1))
- HDmemmove(&free_order[j], &free_order[j+1], (num_free - j - 1) * sizeof(free_order[0]));
+ if (j < (num_free - 1))
+ HDmemmove(&free_order[j], &free_order[j + 1], (num_free - j - 1) * sizeof(free_order[0]));
} /* end for */
/* Generate order to insert inner compound type */
sub_cmpd_order = (unsigned)HDrandom() % PACK_NMEMBS;
- for(extra_space=0; extra_space<2; extra_space ++) {
- if(extra_space)
+ for (extra_space = 0; extra_space < 2; extra_space++) {
+ if (extra_space)
HDputs("With extra space at the end of compound...");
else
HDputs("Without extra space at the end of compound...");
@@ -1847,159 +1753,204 @@ test_pack_ooo(void)
TESTING("random member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
+ if ((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0)
+ PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
+ if ((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0)
+ PACK_OOO_ERROR
/* Insert the compound members in the random order previously generated */
- for(i=0; i<PACK_NMEMBS; i++) {
+ for (i = 0; i < PACK_NMEMBS; i++) {
HDsprintf(name, "%05d", i);
- if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if (i == sub_cmpd_order) {
+ if (H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0)
+ PACK_OOO_ERROR
+ }
+ else if (H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0)
+ PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(dt->shared->u.compnd.packed) PACK_OOO_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(cmpd, H5I_DATATYPE)))
+ PACK_OOO_ERROR
+ if (dt->shared->u.compnd.packed)
+ PACK_OOO_ERROR
/* Close the main compound */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+ if (H5Tclose(cmpd) < 0)
+ PACK_OOO_ERROR
PASSED();
TESTING("random member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if (H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0)
+ PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
+ if ((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0)
+ PACK_OOO_ERROR
/* Insert the compound members in the random order previously generated */
- for(i=0; i<PACK_NMEMBS; i++) {
+ for (i = 0; i < PACK_NMEMBS; i++) {
HDsprintf(name, "%05d", i);
- if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if (i == sub_cmpd_order) {
+ if (H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0)
+ PACK_OOO_ERROR
+ }
+ else if (H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0)
+ PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(dt->shared->u.compnd.packed != !extra_space) PACK_OOO_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(cmpd, H5I_DATATYPE)))
+ PACK_OOO_ERROR
+ if (dt->shared->u.compnd.packed != !extra_space)
+ PACK_OOO_ERROR
/* Close */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
- if(H5Tclose(sub_cmpd) < 0) PACK_OOO_ERROR
+ if (H5Tclose(cmpd) < 0)
+ PACK_OOO_ERROR
+ if (H5Tclose(sub_cmpd) < 0)
+ PACK_OOO_ERROR
PASSED();
TESTING("reverse member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
+ if ((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0)
+ PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
+ if ((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0)
+ PACK_OOO_ERROR
/* Insert the compound members in reverse order, with compound last */
- for(i=0; i<PACK_NMEMBS; i++) {
+ for (i = 0; i < PACK_NMEMBS; i++) {
HDsprintf(name, "%05d", i);
- if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if (i == PACK_NMEMBS - 1) {
+ if (H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0)
+ PACK_OOO_ERROR
+ }
+ else if (H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0)
+ PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(dt->shared->u.compnd.packed) PACK_OOO_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(cmpd, H5I_DATATYPE)))
+ PACK_OOO_ERROR
+ if (dt->shared->u.compnd.packed)
+ PACK_OOO_ERROR
/* Close the main compound */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+ if (H5Tclose(cmpd) < 0)
+ PACK_OOO_ERROR
PASSED();
TESTING("reverse member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if (H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0)
+ PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
+ if ((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0)
+ PACK_OOO_ERROR
/* Insert the compound members in reverse order, with compound last */
- for(i=0; i<PACK_NMEMBS; i++) {
+ for (i = 0; i < PACK_NMEMBS; i++) {
HDsprintf(name, "%05d", i);
- if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if (i == PACK_NMEMBS - 1) {
+ if (H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0)
+ PACK_OOO_ERROR
+ }
+ else if (H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0)
+ PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(dt->shared->u.compnd.packed != !extra_space) PACK_OOO_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(cmpd, H5I_DATATYPE)))
+ PACK_OOO_ERROR
+ if (dt->shared->u.compnd.packed != !extra_space)
+ PACK_OOO_ERROR
/* Close */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
- if(H5Tclose(sub_cmpd) < 0) PACK_OOO_ERROR
+ if (H5Tclose(cmpd) < 0)
+ PACK_OOO_ERROR
+ if (H5Tclose(sub_cmpd) < 0)
+ PACK_OOO_ERROR
PASSED();
TESTING("forward member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
+ if ((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0)
+ PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
+ if ((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0)
+ PACK_OOO_ERROR
/* Insert the compound members in forward order, with compound first */
- for(i=0; i<PACK_NMEMBS; i++) {
+ for (i = 0; i < PACK_NMEMBS; i++) {
HDsprintf(name, "%05d", i);
- if(i == 0) {
- if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if (i == 0) {
+ if (H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0)
+ PACK_OOO_ERROR
+ }
+ else if (H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0)
+ PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(dt->shared->u.compnd.packed) PACK_OOO_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(cmpd, H5I_DATATYPE)))
+ PACK_OOO_ERROR
+ if (dt->shared->u.compnd.packed)
+ PACK_OOO_ERROR
/* Close the main compound */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+ if (H5Tclose(cmpd) < 0)
+ PACK_OOO_ERROR
PASSED();
TESTING("forward member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if (H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0)
+ PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
+ if ((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0)
+ PACK_OOO_ERROR
/* Insert the compound members in forward order */
- for(i=0; i<PACK_NMEMBS; i++) {
+ for (i = 0; i < PACK_NMEMBS; i++) {
HDsprintf(name, "%05d", i);
- if(i == 0) {
- if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if (i == 0) {
+ if (H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0)
+ PACK_OOO_ERROR
+ }
+ else if (H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0)
+ PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(dt->shared->u.compnd.packed != !extra_space) PACK_OOO_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(cmpd, H5I_DATATYPE)))
+ PACK_OOO_ERROR
+ if (dt->shared->u.compnd.packed != !extra_space)
+ PACK_OOO_ERROR
/* Close */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
- if(H5Tclose(sub_cmpd) < 0) PACK_OOO_ERROR
+ if (H5Tclose(cmpd) < 0)
+ PACK_OOO_ERROR
+ if (H5Tclose(sub_cmpd) < 0)
+ PACK_OOO_ERROR
PASSED();
} /* end for */
@@ -2007,11 +1958,10 @@ test_pack_ooo(void)
return 0;
error:
-HDputs("*** DATASET TESTS FAILED ***");
+ HDputs("*** DATASET TESTS FAILED ***");
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_ooo_order
*
@@ -2034,160 +1984,228 @@ HDputs("*** DATASET TESTS FAILED ***");
static unsigned
test_ooo_order(char *filename, hid_t fapl_id)
{
- hid_t file = -1; /* File ID */
- hid_t dtype = -1; /* Datatype IDs */
- hid_t dtype_tmp = -1; /* Temp Datatype ID */
- H5T_t *dt = NULL; /* Datatype pointer */
+ hid_t file = -1; /* File ID */
+ hid_t dtype = -1; /* Datatype IDs */
+ hid_t dtype_tmp = -1; /* Temp Datatype ID */
+ H5T_t *dt = NULL; /* Datatype pointer */
TESTING("that compound member insertion order is preserved")
/* Create the file */
- if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR
/* Create the compound */
- if((dtype = H5Tcreate(H5T_COMPOUND, (size_t)20)) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "A", (size_t)8, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "B", (size_t)12, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "C", (size_t)0, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "D", (size_t)16, H5T_STD_I32LE) < 0) TEST_ERROR
+ if ((dtype = H5Tcreate(H5T_COMPOUND, (size_t)20)) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype, "A", (size_t)8, H5T_STD_I32LE) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype, "B", (size_t)12, H5T_STD_I32LE) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype, "C", (size_t)0, H5T_STD_I32LE) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype, "D", (size_t)16, H5T_STD_I32LE) < 0)
+ TEST_ERROR
/* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if (dt->shared->u.compnd.packed)
TEST_ERROR
- if(dt->shared->u.compnd.packed) TEST_ERROR
/* Verify that the order is the same as the insertion order */
- if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
- if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
- if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
- if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
+ if (H5Tget_member_offset(dtype, 0) != 8)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 1) != 12)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 2) != 0)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 3) != 16)
+ TEST_ERROR
/* Commit the datatype */
- if(H5Tcommit2(file, "dtype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(file, "dtype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Close and reopen the file */
- if(H5Tclose(dtype)) TEST_ERROR
- if(H5Fclose(file)) TEST_ERROR
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
+ if (H5Tclose(dtype))
+ TEST_ERROR
+ if (H5Fclose(file))
+ TEST_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ TEST_ERROR
/* Open the type */
- if((dtype_tmp = H5Topen2(file, "dtype", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dtype_tmp = H5Topen2(file, "dtype", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype_tmp, H5I_DATATYPE)))
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(dtype_tmp, H5I_DATATYPE)))
+ TEST_ERROR
+ if (dt->shared->u.compnd.packed)
TEST_ERROR
- if(dt->shared->u.compnd.packed) TEST_ERROR
/* Verify that the order is the same as the insertion order */
- if(H5Tget_member_offset(dtype_tmp, 0) != 8) TEST_ERROR
- if(H5Tget_member_offset(dtype_tmp, 1) != 12) TEST_ERROR
- if(H5Tget_member_offset(dtype_tmp, 2) != 0) TEST_ERROR
- if(H5Tget_member_offset(dtype_tmp, 3) != 16) TEST_ERROR
+ if (H5Tget_member_offset(dtype_tmp, 0) != 8)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype_tmp, 1) != 12)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype_tmp, 2) != 0)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype_tmp, 3) != 16)
+ TEST_ERROR
/* Copy the datatype */
- if((dtype = H5Tcopy(dtype_tmp)) < 0) TEST_ERROR
+ if ((dtype = H5Tcopy(dtype_tmp)) < 0)
+ TEST_ERROR
/* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if (dt->shared->u.compnd.packed)
TEST_ERROR
- if(dt->shared->u.compnd.packed) TEST_ERROR
/* Verify that the order is the same as the insertion order */
- if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
- if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
- if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
- if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
+ if (H5Tget_member_offset(dtype, 0) != 8)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 1) != 12)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 2) != 0)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 3) != 16)
+ TEST_ERROR
/* Insert the last member */
- if(H5Tinsert(dtype, "E", (size_t)4, H5T_STD_I32LE) < 0) TEST_ERROR
+ if (H5Tinsert(dtype, "E", (size_t)4, H5T_STD_I32LE) < 0)
+ TEST_ERROR
/* Verify that the compound is packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if (!dt->shared->u.compnd.packed)
TEST_ERROR
- if(!dt->shared->u.compnd.packed) TEST_ERROR
/* Verify that the order is the same as the insertion order */
- if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
- if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
- if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
- if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
- if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
+ if (H5Tget_member_offset(dtype, 0) != 8)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 1) != 12)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 2) != 0)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 3) != 16)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 4) != 4)
+ TEST_ERROR
/* Commit the modified datatype */
- if(H5Tcommit2(file, "dtype2", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(file, "dtype2", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Close and reopen the file */
- if(H5Tclose(dtype_tmp)) TEST_ERROR
- if(H5Tclose(dtype)) TEST_ERROR
- if(H5Fclose(file)) TEST_ERROR
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id)) < 0) TEST_ERROR
+ if (H5Tclose(dtype_tmp))
+ TEST_ERROR
+ if (H5Tclose(dtype))
+ TEST_ERROR
+ if (H5Fclose(file))
+ TEST_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id)) < 0)
+ TEST_ERROR
/* Open the type, and verify status */
- if((dtype_tmp = H5Topen2(file, "dtype2", H5P_DEFAULT)) < 0) TEST_ERROR
- if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype_tmp, H5I_DATATYPE)))
+ if ((dtype_tmp = H5Topen2(file, "dtype2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(dtype_tmp, H5I_DATATYPE)))
+ TEST_ERROR
+ if (!dt->shared->u.compnd.packed)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype_tmp, 0) != 8)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype_tmp, 1) != 12)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype_tmp, 2) != 0)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype_tmp, 3) != 16)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype_tmp, 4) != 4)
TEST_ERROR
- if(!dt->shared->u.compnd.packed) TEST_ERROR
- if(H5Tget_member_offset(dtype_tmp, 0) != 8) TEST_ERROR
- if(H5Tget_member_offset(dtype_tmp, 1) != 12) TEST_ERROR
- if(H5Tget_member_offset(dtype_tmp, 2) != 0) TEST_ERROR
- if(H5Tget_member_offset(dtype_tmp, 3) != 16) TEST_ERROR
- if(H5Tget_member_offset(dtype_tmp, 4) != 4) TEST_ERROR
/* Copy the datatype, and verify status */
- if((dtype = H5Tcopy(dtype_tmp)) < 0) TEST_ERROR
- if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ if ((dtype = H5Tcopy(dtype_tmp)) < 0)
+ TEST_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if (!dt->shared->u.compnd.packed)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 0) != 8)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 1) != 12)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 2) != 0)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 3) != 16)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 4) != 4)
TEST_ERROR
- if(!dt->shared->u.compnd.packed) TEST_ERROR
- if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
- if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
- if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
- if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
- if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Expand the type, and verify that it became unpacked */
- if(H5Tset_size(dtype, (size_t)21) < 0) TEST_ERROR
- if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ if (H5Tset_size(dtype, (size_t)21) < 0)
+ TEST_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if (dt->shared->u.compnd.packed)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 0) != 8)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 1) != 12)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 2) != 0)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 3) != 16)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 4) != 4)
TEST_ERROR
- if(dt->shared->u.compnd.packed) TEST_ERROR
- if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
- if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
- if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
- if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
- if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Shrink the type, and verify that it became packed */
- if(H5Tset_size(dtype, (size_t)20) < 0) TEST_ERROR
- if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ if (H5Tset_size(dtype, (size_t)20) < 0)
+ TEST_ERROR
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if (!dt->shared->u.compnd.packed)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 0) != 8)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 1) != 12)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 2) != 0)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 3) != 16)
+ TEST_ERROR
+ if (H5Tget_member_offset(dtype, 4) != 4)
TEST_ERROR
- if(!dt->shared->u.compnd.packed) TEST_ERROR
- if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
- if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
- if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
- if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
- if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Close */
- if(H5Tclose(dtype_tmp)) TEST_ERROR
- if(H5Tclose(dtype)) TEST_ERROR
- if(H5Fclose(file)) TEST_ERROR
+ if (H5Tclose(dtype_tmp))
+ TEST_ERROR
+ if (H5Tclose(dtype))
+ TEST_ERROR
+ if (H5Fclose(file))
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(dtype_tmp);
H5Tclose(dtype);
H5Fclose(file);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
HDputs("*** DATASET TESTS FAILED ***");
return 1;
} /* test_ooo_order */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2205,21 +2223,22 @@ error:
*-------------------------------------------------------------------------
*/
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
hid_t fapl_id;
- char fname[256];
- unsigned nerrors = 0;
+ char fname[256];
+ unsigned nerrors = 0;
h5_reset();
/* Turn off optimized compound converter? */
- if (argc>1) {
- if (argc>2 || strcmp("--noopt", argv[1])) {
- HDfprintf(stderr, "usage: %s [--noopt]\n", argv[0]);
- HDexit(EXIT_FAILURE);
- }
- H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, (H5T_conv_t)((void (*) (void))H5T__conv_struct_opt));
+ if (argc > 1) {
+ if (argc > 2 || strcmp("--noopt", argv[1])) {
+ HDfprintf(stderr, "usage: %s [--noopt]\n", argv[0]);
+ HDexit(EXIT_FAILURE);
+ }
+ H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1,
+ (H5T_conv_t)((void (*)(void))H5T__conv_struct_opt));
}
/* Create the file */
@@ -2248,8 +2267,7 @@ main (int argc, char *argv[])
nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0);
if (nerrors) {
- HDprintf("***** %u FAILURE%s! *****\n",
- nerrors, 1==nerrors?"":"S");
+ HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
}
diff --git a/test/cork.c b/test/cork.c
index 125c53e..79f90da 100644
--- a/test/cork.c
+++ b/test/cork.c
@@ -24,41 +24,39 @@
* This file needs to access private information from the H5C package.
* This file also needs to access the metadata cache testing code.
*/
-#define H5C_FRIEND /*suppress error about including H5Cpkg */
-#define H5C_TESTING /*suppress warning about H5C testing funcs*/
-#include "H5Cpkg.h" /* Cache */
-
+#define H5C_FRIEND /*suppress error about including H5Cpkg */
+#define H5C_TESTING /*suppress warning about H5C testing funcs*/
+#include "H5Cpkg.h" /* Cache */
/* ============ */
/* Test Defines */
/* ============ */
-#define FILENAME "test_cork.h5"
-#define ATTR "ATTR"
-#define DSET "DSET"
-#define DSET_BT1 "DSET_BT1"
-#define DSET_COMPACT "DSET_COMPACT"
-#define DSET_CONTIG "DSET_CONTIG"
-#define DSET_EA "DSET_EA"
-#define DSET_BT2 "DSET_BT2"
-#define DSET_FA "DSET_FA"
-#define DSET_NONE "DSET_NONE"
-#define GRP "GRP"
-#define GRP2 "GRP2"
-#define GRP3 "GRP3"
-#define DT "DT"
-#define DT2 "DT2"
-#define DT3 "DT3"
-#define GRP_ATTR "GRP_ATTR"
-#define DSET_ATTR "DSET_ATTR"
-#define DT_ATTR "DT_ATTR"
-
-#define RANK 2
-#define DIM0 5
-#define DIM1 10
-#define DIMS0 50
-#define DIMS1 100
-
+#define FILENAME "test_cork.h5"
+#define ATTR "ATTR"
+#define DSET "DSET"
+#define DSET_BT1 "DSET_BT1"
+#define DSET_COMPACT "DSET_COMPACT"
+#define DSET_CONTIG "DSET_CONTIG"
+#define DSET_EA "DSET_EA"
+#define DSET_BT2 "DSET_BT2"
+#define DSET_FA "DSET_FA"
+#define DSET_NONE "DSET_NONE"
+#define GRP "GRP"
+#define GRP2 "GRP2"
+#define GRP3 "GRP3"
+#define DT "DT"
+#define DT2 "DT2"
+#define DT3 "DT3"
+#define GRP_ATTR "GRP_ATTR"
+#define DSET_ATTR "DSET_ATTR"
+#define DT_ATTR "DT_ATTR"
+
+#define RANK 2
+#define DIM0 5
+#define DIM1 10
+#define DIMS0 50
+#define DIMS1 100
/* ===================== */
/* Function Declarations */
@@ -74,7 +72,6 @@ static unsigned verify_group_cork(hbool_t swmr);
static unsigned verify_named_cork(hbool_t swmr);
static unsigned verify_multiple_cork(hbool_t swmr);
-
/*-------------------------------------------------------------------------
* Function: verify_old_dset_cork
*
@@ -92,165 +89,165 @@ static unsigned
verify_old_dset_cork(void)
{
/* Variable Declarations */
- hid_t fid = -1; /* File ID */
- hid_t did = -1, did2 = -1, did3 = -1; /* Dataset IDs */
- hid_t dcpl = -1, dcpl2 = -1, dcpl3 = -1; /* Dataset creation property lists */
- hid_t sid = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
- hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
- hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
- hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
- int **buf = NULL; /* Data bufer (pointers to fake 2D array) */
- int *buf_data = NULL; /* Data buffer (actual data) */
- int i = 0, j = 0; /* Local index variables */
- H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
- hsize_t dims2[2] = {8, 16}; /* Dataset dimension sizes */
+ hid_t fid = -1; /* File ID */
+ hid_t did = -1, did2 = -1, did3 = -1; /* Dataset IDs */
+ hid_t dcpl = -1, dcpl2 = -1, dcpl3 = -1; /* Dataset creation property lists */
+ hid_t sid = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
+ hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
+ hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
+ int ** buf = NULL; /* Data bufer (pointers to fake 2D array) */
+ int * buf_data = NULL; /* Data buffer (actual data) */
+ int i = 0, j = 0; /* Local index variables */
+ H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
+ hsize_t dims2[2] = {8, 16}; /* Dataset dimension sizes */
/* Testing Macro */
TESTING("cork status for datasets with old format");
/* Create the file */
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create dcpl */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set to use chunked dataset */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR
/* Create chunked dataset with v1-btree indexing: DSET_BT1 */
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
TEST_ERROR
- if((did = H5Dcreate2(fid, DSET_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get dataset object header address: DSET_BT1 */
- if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_BT1 */
- if(H5Odisable_mdc_flushes(did) < 0)
+ if (H5Odisable_mdc_flushes(did) < 0)
TEST_ERROR
/* Verify cork status */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Set up data array */
- if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int))))
+ if (NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int))))
TEST_ERROR;
- if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data))))
+ if (NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data))))
TEST_ERROR;
for (i = 0; i < 100; i++)
buf[i] = buf_data + (i * 20);
/* Initialize data buffer */
- for(i = 0; i < (int)dims[0]; i++)
- for(j = 0; j < (int)dims[1]; j++)
+ for (i = 0; i < (int)dims[0]; i++)
+ for (j = 0; j < (int)dims[1]; j++)
buf[i][j] = (i + 1) * (j + 1);
/* Write to the dataset: DSET_BT1 */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT1 */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Create compact dataset: DSET_COMPACT */
- if((sid2 = H5Screate_simple(2, dims2, NULL)) < 0)
+ if ((sid2 = H5Screate_simple(2, dims2, NULL)) < 0)
FAIL_STACK_ERROR
- if((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_layout(dcpl2, H5D_COMPACT) < 0)
+ if (H5Pset_layout(dcpl2, H5D_COMPACT) < 0)
FAIL_STACK_ERROR
- if(H5Pset_alloc_time(dcpl2, H5D_ALLOC_TIME_EARLY) < 0)
+ if (H5Pset_alloc_time(dcpl2, H5D_ALLOC_TIME_EARLY) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dcreate2(fid, DSET_COMPACT, H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, DSET_COMPACT, H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get dataset object address */
- if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_COMPACT */
- if(H5Odisable_mdc_flushes(did2) < 0)
+ if (H5Odisable_mdc_flushes(did2) < 0)
TEST_ERROR
/* Verify cork status */
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
TEST_ERROR
- if(H5Sclose(sid2) < 0)
+ if (H5Sclose(sid2) < 0)
TEST_ERROR
- if(H5Pclose(dcpl2) < 0)
+ if (H5Pclose(dcpl2) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Reopen the file */
- if((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Open and write to the dataset: DSET_BT1 */
- if((did = H5Dopen2(fid, DSET_BT1, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_BT1, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create contiguous dataset: DSET_CONTIG */
- if((sid3 = H5Screate_simple(2, dims2, NULL)) < 0)
+ if ((sid3 = H5Screate_simple(2, dims2, NULL)) < 0)
FAIL_STACK_ERROR
- if((dcpl3 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl3 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_layout(dcpl3, H5D_CONTIGUOUS) < 0)
+ if (H5Pset_layout(dcpl3, H5D_CONTIGUOUS) < 0)
FAIL_STACK_ERROR
- if((did3 = H5Dcreate2(fid, DSET_CONTIG, H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl3, H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dcreate2(fid, DSET_CONTIG, H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl3, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get dataset object address: DSET_CONTIG */
- if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_CONTIG */
- if(H5Odisable_mdc_flushes(did3) < 0)
+ if (H5Odisable_mdc_flushes(did3) < 0)
TEST_ERROR
/* Verify the cork status for DSET_CONTIG */
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT1 */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Un-cork the dataset: DSET_CONTIG */
- if(H5Oenable_mdc_flushes(did3) < 0)
+ if (H5Oenable_mdc_flushes(did3) < 0)
TEST_ERROR
/* Verify the cork status for DSET_CONTIG */
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Closing */
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
TEST_ERROR
- if(H5Pclose(dcpl3) < 0)
+ if (H5Pclose(dcpl3) < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
HDfree(buf);
@@ -260,7 +257,8 @@ verify_old_dset_cork(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Sclose(sid2);
H5Sclose(sid3);
@@ -271,7 +269,8 @@ error:
H5Pclose(dcpl2);
H5Pclose(dcpl3);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
HDfree(buf_data);
@@ -279,7 +278,6 @@ error:
return 1;
} /* verify_old_dset_cork */
-
/*-------------------------------------------------------------------------
* Function: verify_obj_dset_cork
*
@@ -297,176 +295,179 @@ static unsigned
verify_obj_dset_cork(hbool_t swmr)
{
/* Variable Declarations */
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- hid_t aid = -1; /* Attribute ID */
- hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t oid = -1; /* Object ID */
- hid_t dcpl2; /* Dataset creation property list */
- int i = 0; /* Local index variable */
- hsize_t dim[1] = {100}; /* Dataset dimension size */
- hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */
- H5O_info2_t oinfo, oinfo2; /* Object metadata information */
- char attrname[500]; /* Name of attribute */
- unsigned flags; /* File access flags */
-
- if(swmr) {
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t oid = -1; /* Object ID */
+ hid_t dcpl2; /* Dataset creation property list */
+ int i = 0; /* Local index variable */
+ hsize_t dim[1] = {100}; /* Dataset dimension size */
+ hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */
+ H5O_info2_t oinfo, oinfo2; /* Object metadata information */
+ char attrname[500]; /* Name of attribute */
+ unsigned flags; /* File access flags */
+
+ if (swmr) {
TESTING("cork status for dataset objects with attributes (SWMR)");
- } else {
+ }
+ else {
TESTING("cork status for dataset objects with attributes");
}
/* Create fapl */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set to use latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
/* Create the file with/without SWMR access */
flags = H5F_ACC_TRUNC;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR
/* Create dataset: DSET */
- if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get dataset object header address */
- if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Cork the dataset: DSET */
- if(H5Odisable_mdc_flushes(did) < 0)
+ if (H5Odisable_mdc_flushes(did) < 0)
TEST_ERROR
/* Attach and write to an attribute to the dataset: DSET */
- if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Close the attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Create dcpl */
- if((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Set to early allocation for dataset space */
- if(H5Pset_alloc_time(dcpl2, H5D_ALLOC_TIME_EARLY) < 0)
+ if (H5Pset_alloc_time(dcpl2, H5D_ALLOC_TIME_EARLY) < 0)
TEST_ERROR
/* Create chunked dataset with implicit indexing: DSET_NONE */
- if(H5Pset_chunk(dcpl2, 1, chunk_dim) < 0)
+ if (H5Pset_chunk(dcpl2, 1, chunk_dim) < 0)
FAIL_STACK_ERROR
- if((sid2 = H5Screate_simple(1, dim, NULL)) < 0)
+ if ((sid2 = H5Screate_simple(1, dim, NULL)) < 0)
TEST_ERROR
- if((did2 = H5Dcreate2(fid, DSET_NONE, H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, DSET_NONE, H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get dataset object header address */
- if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_NONE */
- if(H5Odisable_mdc_flushes(did2) < 0)
+ if (H5Odisable_mdc_flushes(did2) < 0)
TEST_ERROR
/* Attach 8 attributes to the dataset */
- for(i = 0; i < 8; i++) {
+ for (i = 0; i < 8; i++) {
HDsprintf(attrname, "attr %d", i);
- if((aid = H5Acreate2(did2, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did2, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Awrite(aid, H5T_NATIVE_INT, &i) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_INT, &i) < 0)
TEST_ERROR
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR
} /* end for */
/* Verify cork status of the dataset: DSET_NONE */
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Closing */
- if(H5Oclose(did) < 0)
+ if (H5Oclose(did) < 0)
TEST_ERROR
- if(H5Oclose(did2) < 0)
+ if (H5Oclose(did2) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
- if(H5Sclose(sid2) < 0)
+ if (H5Sclose(sid2) < 0)
TEST_ERROR
- if(H5Pclose(dcpl2) < 0)
+ if (H5Pclose(dcpl2) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Re-open the file */
flags = H5F_ACC_RDWR;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
+ if ((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
TEST_ERROR
/* Open the dataset object: DSET_NONE */
- if((oid = H5Oopen(fid, DSET_NONE, H5P_DEFAULT)) < 0)
+ if ((oid = H5Oopen(fid, DSET_NONE, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
TEST_ERROR
/* Open the attribute attached to the dataset object: DSET_NONE */
- if((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
TEST_ERROR
/* Cork the dataset: DSET_NONE */
- if(H5Odisable_mdc_flushes(oid) < 0)
+ if (H5Odisable_mdc_flushes(oid) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET_NONE */
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Close the attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Closing */
- if(H5Oclose(oid) < 0)
+ if (H5Oclose(oid) < 0)
TEST_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid);
H5Sclose(sid);
H5Sclose(sid2);
@@ -476,11 +477,11 @@ error:
H5Pclose(dcpl2);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* verify_obj_dset_cork */
-
/*-------------------------------------------------------------------------
* Function: verify_dset_cork
*
@@ -499,215 +500,218 @@ static unsigned
verify_dset_cork(hbool_t swmr, hbool_t new_format)
{
/* Variable Declarations */
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- hid_t did = -1, did2 = -1, did3 = -1; /* Dataset IDs */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t sid = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
- hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
- hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
- hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
- int **buf = NULL; /* Data bufer (pointers to fake 2D array) */
- int *buf_data = NULL; /* Data buffer (actual data) */
- int i = 0, j = 0; /* Local index variables */
- H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
- unsigned flags; /* File access flags */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ hid_t did = -1, did2 = -1, did3 = -1; /* Dataset IDs */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t sid = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
+ hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
+ hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
+ int ** buf = NULL; /* Data bufer (pointers to fake 2D array) */
+ int * buf_data = NULL; /* Data buffer (actual data) */
+ int i = 0, j = 0; /* Local index variables */
+ H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
+ unsigned flags; /* File access flags */
/* Testing Macro */
- if(swmr) {
- if(new_format) {
+ if (swmr) {
+ if (new_format) {
TESTING("cork status for chunked datasets with different indexing types (SWMR & latest)");
- } else {
+ }
+ else {
TESTING("cork status for chunked datasets with different indexing types (SWMR & non-latest)");
} /* end if */
- } else {
- if(new_format) {
+ }
+ else {
+ if (new_format) {
TESTING("cork status for chunked datasets with different indexing types (non-SWMR & latest)");
- } else {
+ }
+ else {
TESTING("cork status for chunked datasets with different indexing types (non-SWMR & non-latest)");
} /* end if */
- } /* end if */
+ } /* end if */
/* Create fapl */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
- if(new_format) {
+ if (new_format) {
/* Set to use latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
} /* end if */
/* Create the file */
flags = H5F_ACC_TRUNC;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create dcpl */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set to use chunked dataset */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR
/* Create chunked dataset with extensive array indexing: DSET_EA */
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
TEST_ERROR
- if((did = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get dataset object header address: DSET_EA */
- if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_EA */
- if(H5Odisable_mdc_flushes(did) < 0)
+ if (H5Odisable_mdc_flushes(did) < 0)
TEST_ERROR
/* Verify cork status */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Create chunked dataset with fixed array indexing: DSET_FA */
- if((sid2 = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((sid2 = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((did2 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get dataset object header address: DSET_FA */
- if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_FA */
- if(H5Odisable_mdc_flushes(did2) < 0)
+ if (H5Odisable_mdc_flushes(did2) < 0)
TEST_ERROR
/* Uncork the dataset: DSET_EA */
- if(H5Oenable_mdc_flushes(did) < 0)
+ if (H5Oenable_mdc_flushes(did) < 0)
TEST_ERROR
/* Verify the cork status for DSET_FA */
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Verify the cork status for DSET_EA */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Create chunked dataset with v2-Btree indexing */
max_dims[0] = H5S_UNLIMITED;
- if((sid3 = H5Screate_simple(2, dims, max_dims)) < 0)
+ if ((sid3 = H5Screate_simple(2, dims, max_dims)) < 0)
TEST_ERROR
- if((did3 = H5Dcreate2(fid, DSET_BT2, H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dcreate2(fid, DSET_BT2, H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get dataset object header address: DSET_BT2 */
- if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_BT2 */
- if(H5Odisable_mdc_flushes(did3) < 0)
+ if (H5Odisable_mdc_flushes(did3) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Closing */
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
TEST_ERROR
- if(H5Sclose(sid3) < 0)
+ if (H5Sclose(sid3) < 0)
TEST_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
TEST_ERROR
- if(H5Sclose(sid2) < 0)
+ if (H5Sclose(sid2) < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Reopen the file */
flags = H5F_ACC_RDWR;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
+ if ((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
TEST_ERROR
/* Set up data array */
- if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int))))
+ if (NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int))))
TEST_ERROR;
- if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data))))
+ if (NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data))))
TEST_ERROR;
for (i = 0; i < 100; i++)
buf[i] = buf_data + (i * 20);
/* Initialize data buffer */
- for(i = 0; i < (int)dims[0]; i++)
- for(j = 0; j < (int)dims[1]; j++)
+ for (i = 0; i < (int)dims[0]; i++)
+ for (j = 0; j < (int)dims[1]; j++)
buf[i][j] = (i + 1) * (j + 1);
/* Open and write to the dataset: DSET_EA */
- if((did = H5Dopen2(fid, DSET_EA, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_EA, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Verify the cork status for DSET_EA */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Open and write to the dataset: DSET_FA */
- if((did2 = H5Dopen2(fid, DSET_FA, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid, DSET_FA, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Cork the dataset: DSET_FA */
- if(H5Odisable_mdc_flushes(did2) < 0)
+ if (H5Odisable_mdc_flushes(did2) < 0)
TEST_ERROR
/* Verify the cork status for DSET_FA */
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Open and write to the dataset: DSET_BT2 */
- if((did3 = H5Dopen2(fid, DSET_BT2, H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dopen2(fid, DSET_BT2, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
+ if (H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Cork the dataset: DSET_BT2 */
- if(H5Odisable_mdc_flushes(did3) < 0)
+ if (H5Odisable_mdc_flushes(did3) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
TEST_ERROR
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
TEST_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
HDfree(buf);
@@ -717,7 +721,8 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Sclose(sid2);
H5Sclose(sid3);
@@ -727,7 +732,8 @@ error:
H5Pclose(dcpl);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
HDfree(buf_data);
@@ -735,8 +741,6 @@ error:
return 1;
} /* verify_dset_cork */
-
-
/*-------------------------------------------------------------------------
* Function: verify_group_cork
*
@@ -754,156 +758,158 @@ static unsigned
verify_group_cork(hbool_t swmr)
{
/* Variable Declarations */
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- hid_t gid = -1, gid2 = -1, gid3 = -1; /* Group IDs */
- H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
- hid_t aid; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- char attrname[500]; /* Name of attribute */
- unsigned flags; /* File access flags */
- int i = 0; /* Local index variable */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ hid_t gid = -1, gid2 = -1, gid3 = -1; /* Group IDs */
+ H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ char attrname[500]; /* Name of attribute */
+ unsigned flags; /* File access flags */
+ int i = 0; /* Local index variable */
/* Testing Macro */
- if(swmr) {
+ if (swmr) {
TESTING("cork status for groups (SWMR)");
- } else {
+ }
+ else {
TESTING("cork status for groups");
}
/* Create fapl */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set to use latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
/* Create the file */
flags = H5F_ACC_TRUNC;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create 3 groups */
- if((gid = H5Gcreate2(fid, GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gid2 = H5Gcreate2(gid, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(gid, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gid3 = H5Gcreate2(gid2, GRP3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid3 = H5Gcreate2(gid2, GRP3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Cork the second group: GRP2 */
- if(H5Odisable_mdc_flushes(gid2) < 0)
+ if (H5Odisable_mdc_flushes(gid2) < 0)
TEST_ERROR
/* Get group object header addresses */
- if(H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info3(gid3, &oinfo3, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(gid3, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Verify cork status of the groups */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Close the second group: GRP2 */
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR
/* Re-open the second group: GRP2 */
- if((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Verify cork status of the second group: GRP2 */
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
TEST_ERROR
/* Closing */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR
- if(H5Gclose(gid3) < 0)
+ if (H5Gclose(gid3) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Re-open the file and the three groups */
flags = H5F_ACC_RDWR;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
+ if ((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, GRP, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, GRP, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((gid3 = H5Gopen2(gid2, GRP3, H5P_DEFAULT)) < 0)
+ if ((gid3 = H5Gopen2(gid2, GRP3, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR
/* Attach 8 attributes to the third group: GRP3 */
- for(i = 0;i < 8; i++) {
+ for (i = 0; i < 8; i++) {
HDsprintf(attrname, "attr %d", i);
- if((aid = H5Acreate2(gid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(gid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0)
TEST_ERROR
/* Cork the third group while attaching attributes */
- if(i == 3) {
- if(H5Odisable_mdc_flushes(gid3) < 0)
+ if (i == 3) {
+ if (H5Odisable_mdc_flushes(gid3) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
}
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR
} /* end for */
/* Verify cork status of the third group: GRP3 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Closing */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR
- if(H5Gclose(gid3) < 0)
+ if (H5Gclose(gid3) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gid);
- H5Gclose(gid2);
- H5Gclose(gid3);
- H5Sclose(sid);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Gclose(gid2);
+ H5Gclose(gid3);
+ H5Sclose(sid);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* verify_group_cork */
-
/*-------------------------------------------------------------------------
* Function: verify_named_cork
*
@@ -921,263 +927,264 @@ static unsigned
verify_named_cork(hbool_t swmr)
{
/* Variable Declarations */
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- hid_t tid = -1, tid2 = -1, tid3 = -1; /* Datatype IDs */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5O_info2_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */
- hid_t aid = -1; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- hid_t did; /* Dataset ID */
- char attrname[500]; /* Name of attribute */
- unsigned flags; /* File access flags */
- int i = 0; /* Local index variable */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ hid_t tid = -1, tid2 = -1, tid3 = -1; /* Datatype IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5O_info2_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t did; /* Dataset ID */
+ char attrname[500]; /* Name of attribute */
+ unsigned flags; /* File access flags */
+ int i = 0; /* Local index variable */
/* Testing Macro */
- if(swmr) {
+ if (swmr) {
TESTING("cork status for named datatypes (SWMR)");
- } else {
+ }
+ else {
TESTING("cork status for named datatypes");
}
/* Create fapl */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set to use latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
/* Create the file */
flags = H5F_ACC_TRUNC;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create 3 copies of datatypes */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
TEST_ERROR
- if((tid2 = H5Tcopy(H5T_NATIVE_LONG)) < 0)
+ if ((tid2 = H5Tcopy(H5T_NATIVE_LONG)) < 0)
TEST_ERROR
- if((tid3 = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ if ((tid3 = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
TEST_ERROR
/* Commit datatype /DT */
- if(H5Tcommit2(fid, DT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(fid, DT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Create /GRP */
- if((gid = H5Gcreate2(fid, GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Commit datatype /GRP/DT2 */
- if(H5Tcommit2(gid, DT2, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(gid, DT2, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Create /GRP/GRP2 */
- if((gid2 = H5Gcreate2(gid, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(gid, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Commit datatype /GRP/GRP2/DT3 */
- if(H5Tcommit2(gid2, DT3, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(gid2, DT3, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Cork 2 named datatypes: /DT and /GRP/GRP2/DT3 */
- if(H5Odisable_mdc_flushes(tid) < 0)
+ if (H5Odisable_mdc_flushes(tid) < 0)
TEST_ERROR
- if(H5Odisable_mdc_flushes(tid3) < 0)
+ if (H5Odisable_mdc_flushes(tid3) < 0)
TEST_ERROR
/* Get named datatype object header addresses */
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info3(tid3, &oinfo3, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(tid3, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Verify cork status of the named datatypes */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Close the datatypes */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
TEST_ERROR
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
TEST_ERROR
- if(H5Tclose(tid3) < 0)
+ if (H5Tclose(tid3) < 0)
TEST_ERROR
/* Re-open the named datatypes */
- if((tid = H5Topen2(fid, DT, H5P_DEFAULT)) < 0)
+ if ((tid = H5Topen2(fid, DT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((tid2 = H5Topen2(gid, DT2, H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(gid, DT2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((tid3 = H5Topen2(gid2, DT3, H5P_DEFAULT)) < 0)
+ if ((tid3 = H5Topen2(gid2, DT3, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Verify cork status of the named datatypes */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Closing */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
TEST_ERROR
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
TEST_ERROR
- if(H5Tclose(tid3) < 0)
+ if (H5Tclose(tid3) < 0)
TEST_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
-
/* Re-open the file and the three groups */
flags = H5F_ACC_RDWR;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
+ if ((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, GRP, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, GRP, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Re-open the named datatypes */
- if((tid = H5Topen2(fid, DT, H5P_DEFAULT)) < 0)
+ if ((tid = H5Topen2(fid, DT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((tid2 = H5Topen2(gid, DT2, H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(gid, DT2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((tid3 = H5Topen2(gid2, DT3, H5P_DEFAULT)) < 0)
+ if ((tid3 = H5Topen2(gid2, DT3, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Cork the datatype: DT2 */
- if(H5Odisable_mdc_flushes(tid2) < 0)
+ if (H5Odisable_mdc_flushes(tid2) < 0)
TEST_ERROR
/* Create dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR
/* Attach 8 attributes to datatype: DT3 */
- for(i = 0;i < 8; i++) {
+ for (i = 0; i < 8; i++) {
HDsprintf(attrname, "attr %d", i);
- if((aid = H5Acreate2(tid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0)
TEST_ERROR
/* Cork the datatype while attaching attributes */
- if(i == 3) {
- if(H5Odisable_mdc_flushes(tid3) < 0)
+ if (i == 3) {
+ if (H5Odisable_mdc_flushes(tid3) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
}
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR
} /* end for */
/* Create a dataset with named datatype: DT */
- if((did = H5Dcreate2(fid, DSET, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get dataset object header address */
- if(H5Oget_info3(did, &oinfo4, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oinfo4, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET */
- if(H5Odisable_mdc_flushes(did) < 0)
+ if (H5Odisable_mdc_flushes(did) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT3 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Un-cork the datatype: DT3 */
- if(H5Oenable_mdc_flushes(tid3) < 0)
+ if (H5Oenable_mdc_flushes(tid3) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT3 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Cork the datatype: DT */
- if(H5Odisable_mdc_flushes(tid) < 0)
+ if (H5Odisable_mdc_flushes(tid) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo4.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo4.token, TRUE) < 0)
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT */
- if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo4.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid, oinfo4.token, FALSE) < 0)
TEST_ERROR
/* Closing */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
TEST_ERROR
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
TEST_ERROR
- if(H5Tclose(tid3) < 0)
+ if (H5Tclose(tid3) < 0)
TEST_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Tclose(tid);
- H5Tclose(tid2);
- H5Tclose(tid3);
- H5Gclose(gid);
- H5Gclose(gid2);
- H5Dclose(did);
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(tid);
+ H5Tclose(tid2);
+ H5Tclose(tid3);
+ H5Gclose(gid);
+ H5Gclose(gid2);
+ H5Dclose(did);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* verify_named_cork */
-
/*-------------------------------------------------------------------------
* Function: verify_multiple_cork
*
@@ -1197,332 +1204,332 @@ static unsigned
verify_multiple_cork(hbool_t swmr)
{
/* Variable Declarations */
- hid_t fid1 = -1, fid2 = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- hid_t tid1 = -1, tid2 = -1; /* Datatype IDs */
- hid_t gid1 = -1, gid2 = -1; /* Group IDs */
- hid_t did1 = -1, did2 = -1; /* Dataset ID */
- hid_t aidg1 = -1, aidg2 = -1; /* Attribute ID */
- hid_t aidd1 = -1, aidd2 = -1; /* Attribute ID */
- hid_t aidt1 = -1, aidt2 = -1; /* Attribute ID */
- hid_t sid = -1; /* Dataspace ID */
- H5O_info2_t oinfo1, oinfo2, oinfo3; /* Object metadata information */
- hsize_t dim[1] = {5}; /* Dimension sizes */
- unsigned flags; /* File access flags */
- hbool_t corked; /* Cork status */
- herr_t ret; /* Return value */
+ hid_t fid1 = -1, fid2 = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ hid_t tid1 = -1, tid2 = -1; /* Datatype IDs */
+ hid_t gid1 = -1, gid2 = -1; /* Group IDs */
+ hid_t did1 = -1, did2 = -1; /* Dataset ID */
+ hid_t aidg1 = -1, aidg2 = -1; /* Attribute ID */
+ hid_t aidd1 = -1, aidd2 = -1; /* Attribute ID */
+ hid_t aidt1 = -1, aidt2 = -1; /* Attribute ID */
+ hid_t sid = -1; /* Dataspace ID */
+ H5O_info2_t oinfo1, oinfo2, oinfo3; /* Object metadata information */
+ hsize_t dim[1] = {5}; /* Dimension sizes */
+ unsigned flags; /* File access flags */
+ hbool_t corked; /* Cork status */
+ herr_t ret; /* Return value */
/* Testing Macro */
- if(swmr) {
+ if (swmr) {
TESTING("cork status for multiple opens (SWMR)");
- } else {
+ }
+ else {
TESTING("cork status for multiple opens");
}
/* Create fapl */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set to use latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
/* Create the file */
flags = H5F_ACC_TRUNC;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid1 = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
+ if ((fid1 = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Open root group */
- if((gid1 = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create and commit datatype */
- if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0)
+ if ((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0)
TEST_ERROR
- if(H5Tcommit2(fid1, DT, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(fid1, DT, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Create dataset */
- if((sid = H5Screate_simple(1, dim, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dim, NULL)) < 0)
TEST_ERROR
- if((did1 = H5Dcreate2(fid1, DSET, tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid1, DSET, tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create attribute on root group */
- if((aidg1 = H5Acreate2(gid1, GRP_ATTR, tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aidg1 = H5Acreate2(gid1, GRP_ATTR, tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create attribute on dataset */
- if((aidd1 = H5Acreate2(did1, DSET_ATTR, tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aidd1 = H5Acreate2(did1, DSET_ATTR, tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create attribute on datatype */
- if((aidt1 = H5Acreate2(tid1, DT_ATTR, tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aidt1 = H5Acreate2(tid1, DT_ATTR, tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Closing */
- if(H5Aclose(aidt1) < 0)
+ if (H5Aclose(aidt1) < 0)
TEST_ERROR
- if(H5Aclose(aidd1) < 0)
+ if (H5Aclose(aidd1) < 0)
TEST_ERROR
- if(H5Aclose(aidg1) < 0)
+ if (H5Aclose(aidg1) < 0)
TEST_ERROR
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
TEST_ERROR
- if(H5Tclose(tid1) < 0)
+ if (H5Tclose(tid1) < 0)
TEST_ERROR
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/* Open the file twice: fid1, fid2 */
flags = H5F_ACC_RDWR;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid1 = H5Fopen(FILENAME, flags, fapl)) < 0)
+ if ((fid1 = H5Fopen(FILENAME, flags, fapl)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(FILENAME, flags, fapl)) < 0)
+ if ((fid2 = H5Fopen(FILENAME, flags, fapl)) < 0)
TEST_ERROR
/* Open the root group twice: gid1, gid2 */
- if((gid1 = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gid2 = H5Gopen2(fid2, "/", H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gopen2(fid2, "/", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Open the root group attribute twice: aidg1, aidg2 */
- if((aidg1 = H5Aopen(gid1, GRP_ATTR, H5P_DEFAULT)) < 0)
+ if ((aidg1 = H5Aopen(gid1, GRP_ATTR, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((aidg2 = H5Aopen(gid2, GRP_ATTR, H5P_DEFAULT)) < 0)
+ if ((aidg2 = H5Aopen(gid2, GRP_ATTR, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Cork the group: gid2 */
- if(H5Odisable_mdc_flushes(gid2) < 0)
+ if (H5Odisable_mdc_flushes(gid2) < 0)
TEST_ERROR
/* Verify cork status of the group: gid2 */
- if(H5Oget_info3(gid2, &oinfo1, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(gid2, &oinfo1, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid2, oinfo1.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid2, oinfo1.token, TRUE) < 0)
TEST_ERROR
/* Check cork status of the group: gid1 */
- if(H5Oare_mdc_flushes_disabled(gid1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(gid1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Open the dataset twice: did1, did2 */
- if((did1 = H5Dopen2(fid1, DSET, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid1, DSET, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((did2 = H5Dopen2(fid2, DSET, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid2, DSET, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Open the dataset attribute twice: aidd1, aidd2 */
- if((aidd1 = H5Aopen(did1, DSET_ATTR, H5P_DEFAULT)) < 0)
+ if ((aidd1 = H5Aopen(did1, DSET_ATTR, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((aidd2 = H5Aopen(did2, DSET_ATTR, H5P_DEFAULT)) < 0)
+ if ((aidd2 = H5Aopen(did2, DSET_ATTR, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Cork the dataset: did1 */
- if(H5Odisable_mdc_flushes(did1) < 0)
+ if (H5Odisable_mdc_flushes(did1) < 0)
TEST_ERROR
/* Verify cork status of the dataset: did1 */
- if(H5Oget_info3(did1, &oinfo2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did1, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid1, oinfo2.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid1, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Check cork status of the dataset: did2 */
- if(H5Oare_mdc_flushes_disabled(did2, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did2, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Open the datatype twice: tid1, tid2 */
- if((tid1 = H5Topen2(fid1, DT, H5P_DEFAULT)) < 0)
+ if ((tid1 = H5Topen2(fid1, DT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((tid2 = H5Topen2(fid2, DT, H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(fid2, DT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Open the datatype attribute twice: aidt1, aidt2 */
- if((aidt1 = H5Aopen(tid1, DT_ATTR, H5P_DEFAULT)) < 0)
+ if ((aidt1 = H5Aopen(tid1, DT_ATTR, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((aidt2 = H5Aopen(tid2, DT_ATTR, H5P_DEFAULT)) < 0)
+ if ((aidt2 = H5Aopen(tid2, DT_ATTR, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Cork the datatype: tid2 */
- if(H5Odisable_mdc_flushes(tid2) < 0)
+ if (H5Odisable_mdc_flushes(tid2) < 0)
TEST_ERROR
/* Verify cork status of the datatype: tid2 */
- if(H5Oget_info3(tid2, &oinfo3, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(tid2, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid2, oinfo3.token, TRUE) < 0)
+ if (H5C__verify_cork_tag_test(fid2, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Check cork status of the datatype: tid1 */
- if(H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Uncork the group: gid1 */
- if(H5Oenable_mdc_flushes(gid1) < 0)
+ if (H5Oenable_mdc_flushes(gid1) < 0)
TEST_ERROR
/* Verify cork status of the group: gid1 */
- if(H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0)
TEST_ERROR
/* Check cork status of the group: gid2 */
- if(H5Oare_mdc_flushes_disabled(gid2, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(gid2, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Close the group: gid2 */
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR
/* Check cork status of the group: gid1 */
- if(H5Oare_mdc_flushes_disabled(gid1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(gid1, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Verify cork status of the group: gid1 */
- if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0)
TEST_ERROR
/* Close the group: gid1 */
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
TEST_ERROR
/* Uncork the dataset: gid2 */
- if(H5Oenable_mdc_flushes(did2) < 0)
+ if (H5Oenable_mdc_flushes(did2) < 0)
TEST_ERROR
/* Verify cork status of the dataset: did2 */
- if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid2, oinfo2.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid2, oinfo2.token, FALSE) < 0)
TEST_ERROR
/* Check cork status of the dataset: did1 */
- if(H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Close the dataset: did2 */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
TEST_ERROR
/* Check cork status of the dataset: did1 */
- if(H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Verify cork status of the dataset: did1 */
- if(H5C__verify_cork_tag_test(fid1, oinfo2.token, FALSE) < 0)
+ if (H5C__verify_cork_tag_test(fid1, oinfo2.token, FALSE) < 0)
TEST_ERROR
/* Close the dataset: did1 */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
TEST_ERROR
/* Check cork status of the datatype: tid1 */
- if(H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close datatype: tid1 */
- if(H5Tclose(tid1) < 0)
+ if (H5Tclose(tid1) < 0)
TEST_ERROR
/* Check cork status of the datatype: tid2 */
- if(H5Oare_mdc_flushes_disabled(tid2, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid2, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close datatype: tid2 */
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
TEST_ERROR
/* Should fail to cork the attribute: aidg2; not an object */
- H5E_BEGIN_TRY {
- ret = H5Odisable_mdc_flushes(aidg2);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Odisable_mdc_flushes(aidg2); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Should fail to uncork the attribute: aidd1; not an object */
- H5E_BEGIN_TRY {
- ret = H5Odisable_mdc_flushes(aidd1);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Odisable_mdc_flushes(aidd1); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Should fail to check cork status of the attribute: aidt2; not an object */
- H5E_BEGIN_TRY {
- ret = H5Oare_mdc_flushes_disabled(aidt2, &corked);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Oare_mdc_flushes_disabled(aidt2, &corked); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close all attributes */
- if(H5Aclose(aidg1) < 0)
+ if (H5Aclose(aidg1) < 0)
TEST_ERROR
- if(H5Aclose(aidg2) < 0)
+ if (H5Aclose(aidg2) < 0)
TEST_ERROR
- if(H5Aclose(aidd1) < 0)
+ if (H5Aclose(aidd1) < 0)
TEST_ERROR
- if(H5Aclose(aidd2) < 0)
+ if (H5Aclose(aidd2) < 0)
TEST_ERROR
- if(H5Aclose(aidt1) < 0)
+ if (H5Aclose(aidt1) < 0)
TEST_ERROR
- if(H5Aclose(aidt2) < 0)
+ if (H5Aclose(aidt2) < 0)
TEST_ERROR
/* Should fail to cork the file: fid1; not an object */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Oare_mdc_flushes_disabled(fid1, &corked);
ret = H5Odisable_mdc_flushes(fid1);
- } H5E_END_TRY;
- if(ret >= 0)
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Should fail to uncork the file: fid2; not an object */
- H5E_BEGIN_TRY {
- ret = H5Oenable_mdc_flushes(fid2);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Oenable_mdc_flushes(fid2); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Closing */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid1);
H5Tclose(tid2);
H5Gclose(gid1);
@@ -1538,15 +1545,17 @@ error:
H5Pclose(fapl);
H5Fclose(fid1);
H5Fclose(fid1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* verify_multiple_cork */
/*-------------------------------------------------------------------------
* Function: test_objs_cork
*
- * Purpose: This function verifies H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled public
- * routines are working as specified.
+ * Purpose: This function verifies
+ *H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled public routines are working as
+ *specified.
*
* Return: 0 on Success, 1 on Failure
*
@@ -1557,264 +1566,265 @@ error:
static unsigned
test_objs_cork(hbool_t swmr, hbool_t new_format)
{
- hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
- hid_t fapl = H5I_INVALID_HID; /* File access property list */
- hid_t gid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID; /* Object IDs */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t aid = H5I_INVALID_HID; /* Attribute ID */
- hsize_t dims[RANK]; /* Dataset dimension sizes */
- hbool_t corked; /* Cork status of an object */
- unsigned flags; /* File access flags */
- herr_t ret; /* Return value */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t gid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID; /* Object IDs */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hsize_t dims[RANK]; /* Dataset dimension sizes */
+ hbool_t corked; /* Cork status of an object */
+ unsigned flags; /* File access flags */
+ herr_t ret; /* Return value */
/* Testing Macro */
- if(new_format) {
- if(swmr) {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (new library format) (SWMR)");
+ if (new_format) {
+ if (swmr) {
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (new library "
+ "format) (SWMR)");
} /* end if */
else {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (new library format)");
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (new library "
+ "format)");
} /* end else */
- } else {
- if(swmr) {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (old library format) (SWMR)");
+ }
+ else {
+ if (swmr) {
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (old library "
+ "format) (SWMR)");
} /* end if */
else {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (old library format)");
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (old library "
+ "format)");
} /* end else */
- } /* end else */
+ } /* end else */
/* Create fapl */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set to use latest format */
- if(new_format) {
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (new_format) {
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
} /* end if */
/* Create the file with/without SWMR access */
flags = H5F_ACC_TRUNC;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create group */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check cork status of the group: not corked */
- if(H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Cork the group: an object */
- if(H5Odisable_mdc_flushes(gid) < 0)
+ if (H5Odisable_mdc_flushes(gid) < 0)
TEST_ERROR
/* Check cork status of the group: corked */
- if(H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close the group */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
/* Create a transient copy of a native type */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
TEST_ERROR
/* Should fail to cork the datatype: not an object */
- H5E_BEGIN_TRY {
- ret = H5Odisable_mdc_flushes(tid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Odisable_mdc_flushes(tid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Create a named datatype */
- if(H5Tcommit2(fid, "group/datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(fid, "group/datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Check cork status of the named datatype: not corked */
- if(H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Cork the named datatype: an object */
- if(H5Odisable_mdc_flushes(tid) < 0)
+ if (H5Odisable_mdc_flushes(tid) < 0)
TEST_ERROR
/* Check cork status of the named datatype: corked */
- if(H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close the named datatype */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
TEST_ERROR
/* Create dataspace */
dims[0] = DIM0;
dims[1] = DIM1;
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
TEST_ERROR
/* Should fail to uncork the dataspace: not an object */
- H5E_BEGIN_TRY {
- ret = H5Oenable_mdc_flushes(sid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Oenable_mdc_flushes(sid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Create dataset. */
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create attribute on the dataset */
- if((aid = H5Acreate2(did, "attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Should fail to check cork status of the attribute: not an object */
- H5E_BEGIN_TRY {
- ret = H5Oare_mdc_flushes_disabled(aid, &corked);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Oare_mdc_flushes_disabled(aid, &corked); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Check cork status of the dataset: not corked */
- if(H5Oare_mdc_flushes_disabled(did, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Cork the dataset: an object */
- if(H5Odisable_mdc_flushes(did) < 0)
+ if (H5Odisable_mdc_flushes(did) < 0)
TEST_ERROR
/* Check cork status of the dataset: corked */
- if(H5Oare_mdc_flushes_disabled(did, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close the dataset and dataspace */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
/* Open the group */
- if((gid = H5Oopen(fid, "group", H5P_DEFAULT)) < 0)
+ if ((gid = H5Oopen(fid, "group", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check cork status of the group */
- if(H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Cork the group */
- if(H5Odisable_mdc_flushes(gid) < 0)
+ if (H5Odisable_mdc_flushes(gid) < 0)
TEST_ERROR
/* Should fail to cork the group again */
- H5E_BEGIN_TRY {
- ret = H5Odisable_mdc_flushes(gid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Odisable_mdc_flushes(gid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Check cork status of the group */
- if(H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Open the named datatype */
- if((tid = H5Oopen(fid, "group/datatype", H5P_DEFAULT)) < 0)
+ if ((tid = H5Oopen(fid, "group/datatype", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check cork status of the named datatype */
- if(H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Should fail to un-cork the named datatype that is not corked yet */
- H5E_BEGIN_TRY {
- ret = H5Oenable_mdc_flushes(tid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Oenable_mdc_flushes(tid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Cork the named datatype */
- if(H5Odisable_mdc_flushes(tid) < 0)
+ if (H5Odisable_mdc_flushes(tid) < 0)
TEST_ERROR
/* Check cork status of the named datatype */
- if(H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Open the dataset */
- if((did = H5Oopen(fid, "/dataset", H5P_DEFAULT)) < 0)
+ if ((did = H5Oopen(fid, "/dataset", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check cork status of the dataset */
- if(H5Oare_mdc_flushes_disabled(did, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Cork the dataset */
- if(H5Odisable_mdc_flushes(did) < 0)
+ if (H5Odisable_mdc_flushes(did) < 0)
TEST_ERROR
/* Check cork status of dataset */
- if(H5Oare_mdc_flushes_disabled(did, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Un-cork the dataset */
- if(H5Oenable_mdc_flushes(did) < 0)
+ if (H5Oenable_mdc_flushes(did) < 0)
TEST_ERROR
/* Check cork status of the dataset */
- if(H5Oare_mdc_flushes_disabled(did, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Closing */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
TEST_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Aclose(aid);
H5Dclose(did);
@@ -1822,16 +1832,17 @@ error:
H5Tclose(tid);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_objs_cork() */
-
/*-------------------------------------------------------------------------
* Function: test_dset_cork
*
- * Purpose: This function verifies H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled are
- * working as specified when manipulating datasets.
+ * Purpose: This function verifies
+ *H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled are working as specified when
+ *manipulating datasets.
*
* Return: 0 on Success, 1 on Failure
*
@@ -1842,309 +1853,314 @@ error:
static unsigned
test_dset_cork(hbool_t swmr, hbool_t new_format)
{
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- hid_t gid; /* Groupd ID */
- hid_t did1, did2; /* Dataset IDs */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t sid; /* Dataspace ID */
- hid_t dcpl; /* Dataset creation property list */
- hsize_t dims[RANK]; /* Dataset dimensions */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dataset dimensions */
- hsize_t cdims[RANK] = {2,2}; /* Chunk dimensions */
- int fillval = 0; /* Fill value */
- int i, j, k = 0; /* Local index variables */
- int **wbuf = NULL; /* Data buffer for writes (pointers to fake 2D array) */
- int *wbuf_data = NULL; /* Data buffer for writes (real data) */
- int *rbuf_data = NULL; /* Data buffer for reads (real data) */
- hbool_t corked; /* Cork status of an object */
- unsigned flags; /* File access flags */
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ hid_t gid; /* Groupd ID */
+ hid_t did1, did2; /* Dataset IDs */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataset creation property list */
+ hsize_t dims[RANK]; /* Dataset dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dataset dimensions */
+ hsize_t cdims[RANK] = {2, 2}; /* Chunk dimensions */
+ int fillval = 0; /* Fill value */
+ int i, j, k = 0; /* Local index variables */
+ int ** wbuf = NULL; /* Data buffer for writes (pointers to fake 2D array) */
+ int * wbuf_data = NULL; /* Data buffer for writes (real data) */
+ int * rbuf_data = NULL; /* Data buffer for reads (real data) */
+ hbool_t corked; /* Cork status of an object */
+ unsigned flags; /* File access flags */
/* Testing Macro */
- if(new_format) {
- if(swmr) {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets (new library format) (SWMR)");
+ if (new_format) {
+ if (swmr) {
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets "
+ "(new library format) (SWMR)");
} /* end if */
else {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets (new library format)");
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets "
+ "(new library format)");
} /* end else */
- } else {
- if(swmr) {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets (old library format) (SWMR)");
+ }
+ else {
+ if (swmr) {
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets "
+ "(old library format) (SWMR)");
} /* end if */
else {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets (old library format)");
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets "
+ "(old library format)");
} /* end else */
- } /* end if */
+ } /* end if */
/* Create fapl */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set to use latest format */
- if(new_format) {
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (new_format) {
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
} /* end if */
/* Create the file with/without SWMR access */
flags = H5F_ACC_TRUNC;
- if(swmr)
+ if (swmr)
flags |= H5F_ACC_SWMR_WRITE;
- if((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create a group */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Commit the datatype with the group */
- if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
TEST_ERROR
- if(H5Tcommit2(gid, "datatype", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(gid, "datatype", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Cork the named datatype */
- if(H5Odisable_mdc_flushes(tid1) < 0)
+ if (H5Odisable_mdc_flushes(tid1) < 0)
TEST_ERROR
/* Set up dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Enable chunking */
- if(H5Pset_chunk(dcpl, RANK, cdims) < 0)
+ if (H5Pset_chunk(dcpl, RANK, cdims) < 0)
TEST_ERROR
/* Set up a fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
TEST_ERROR
/* Create dataspace */
dims[0] = DIMS0;
dims[1] = DIMS1;
- if((sid = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, maxdims)) < 0)
TEST_ERROR
/* Create the dataset inside the group with the named datatype */
- if((did1 = H5Dcreate2(gid, "dataset", tid1, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(gid, "dataset", tid1, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check cork status of the named datatype */
- if(H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Cork the dataset */
- if(H5Odisable_mdc_flushes(did1) < 0)
+ if (H5Odisable_mdc_flushes(did1) < 0)
TEST_ERROR
/* Check cork status of the dataset */
- if(H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Check cork status of the group */
- if(H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Set up data array */
- if(NULL == (wbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int))))
+ if (NULL == (wbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int))))
TEST_ERROR;
- if(NULL == (wbuf = (int **)HDcalloc(DIMS0, sizeof(wbuf_data))))
+ if (NULL == (wbuf = (int **)HDcalloc(DIMS0, sizeof(wbuf_data))))
TEST_ERROR;
for (i = 0; i < DIMS0; i++)
wbuf[i] = wbuf_data + (i * DIMS1);
/* Initialize the buffer */
- for(i = 0; i < DIMS0;i++)
- for(j = 0;j < DIMS1;j++)
+ for (i = 0; i < DIMS0; i++)
+ for (j = 0; j < DIMS1; j++)
wbuf[i][j] = k++;
/* Write to the dataset */
- if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0)
+ if (H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0)
TEST_ERROR
/* Flush the dataset */
- if(H5Oflush(did1) < 0)
+ if (H5Oflush(did1) < 0)
TEST_ERROR
/* Check cork status of the dataset */
- if(H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Check cork status of the named datatype */
- if(H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
TEST_ERROR
/* Open the dataset again */
- if((did1 = H5Dopen2(gid, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(gid, "dataset", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check cork status of dataset */
- if(H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Set up data array */
- if(NULL == (rbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int))))
+ if (NULL == (rbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int))))
TEST_ERROR;
/* Read from the dataset */
- if(H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_data) < 0)
+ if (H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_data) < 0)
TEST_ERROR
/* Cork the dataset */
- if(H5Odisable_mdc_flushes(did1) < 0)
+ if (H5Odisable_mdc_flushes(did1) < 0)
TEST_ERROR
/* Delete the dataset */
- if(H5Ldelete(gid, "dataset", H5P_DEFAULT) < 0)
+ if (H5Ldelete(gid, "dataset", H5P_DEFAULT) < 0)
TEST_ERROR
/* Check cork status of the dataset */
- if(H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close the dataset */
- if(H5Oclose(did1) < 0)
+ if (H5Oclose(did1) < 0)
TEST_ERROR
/* Create the dataset again */
- if((did1 = H5Dcreate2(gid, "dataset", tid1, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(gid, "dataset", tid1, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Cork the dataset */
- if(H5Odisable_mdc_flushes(did1) < 0)
+ if (H5Odisable_mdc_flushes(did1) < 0)
TEST_ERROR
/* Write to the dataset */
- if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0)
+ if (H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0)
TEST_ERROR
/* Refresh the dataset */
- if(H5Drefresh(did1) < 0)
+ if (H5Drefresh(did1) < 0)
TEST_ERROR
/* Check cork status of the dataset */
- if(H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
TEST_ERROR
/* First open of the dataset */
- if((did1 = H5Dopen2(gid, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(gid, "dataset", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Second open of the dataset */
- if((did2 = H5Dopen2(gid, "dataset", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(gid, "dataset", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Cork the first opened dataset */
- if(H5Odisable_mdc_flushes(did1) < 0)
+ if (H5Odisable_mdc_flushes(did1) < 0)
TEST_ERROR
/* Check cork status of the first opened dataset */
- if(H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Check cork status of the second opened dataset */
- if(H5Oare_mdc_flushes_disabled(did2, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did2, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close the second opened dataset */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
TEST_ERROR
/* Check cork status of the first opened dataset */
- if(H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(did1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Close the first opened dastaset */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
TEST_ERROR
/* Check cork status of the named datatype */
- if(H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Second open of the named datatype */
- if((tid2 = H5Topen2(gid, "datatype", H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(gid, "datatype", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check cork status of the second opened named datatype */
- if(H5Oare_mdc_flushes_disabled(tid2, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid2, &corked) < 0)
TEST_ERROR
- if(!corked)
+ if (!corked)
TEST_ERROR
/* Uncork the second opened named datatype */
- if(H5Oenable_mdc_flushes(tid2) < 0)
+ if (H5Oenable_mdc_flushes(tid2) < 0)
TEST_ERROR
/* Check cork status of the second opened named datatype */
- if(H5Oare_mdc_flushes_disabled(tid2, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid2, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Check cork status of the first opened named datatype */
- if(H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(tid1, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Close the first opened datatype */
- if(H5Tclose(tid1) < 0)
+ if (H5Tclose(tid1) < 0)
TEST_ERROR
/* Close the second opened datatype */
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
TEST_ERROR
/* Check cork status of the group */
- if(H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
+ if (H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
TEST_ERROR
- if(corked)
+ if (corked)
TEST_ERROR
/* Closing */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
HDfree(wbuf);
@@ -2155,7 +2171,8 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did1);
H5Dclose(did2);
@@ -2165,7 +2182,8 @@ error:
H5Gclose(gid);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(wbuf);
HDfree(wbuf_data);
@@ -2175,8 +2193,6 @@ error:
} /* test_dset_cork() */
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2193,13 +2209,13 @@ error:
int
main(void)
{
- unsigned swmr; /* Loop over SWMR/non-SWMR */
- unsigned nerrs = 0; /* Error Encountered */
+ unsigned swmr; /* Loop over SWMR/non-SWMR */
+ unsigned nerrs = 0; /* Error Encountered */
/* Test for dataset created with old library format */
nerrs += verify_old_dset_cork();
- for(swmr = 0; swmr <= 1; swmr++) {
+ for (swmr = 0; swmr <= 1; swmr++) {
/* Tests with new/old library format */
/* This is the test moved from th5o.c: test_h5o_cork() */
nerrs += test_objs_cork(swmr, TRUE);
@@ -2221,6 +2237,5 @@ main(void)
HDremove(FILENAME);
/* Return Errors */
- return(nerrs > 0);
+ return (nerrs > 0);
} /* main */
-
diff --git a/test/cross_read.c b/test/cross_read.c
index dabd3ab..22c6828 100644
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -22,45 +22,39 @@
#include "h5test.h"
#include "H5srcdir.h"
-const char *FILENAME[] = {
- "vms_data",
- "le_data",
- "be_data",
- NULL
-};
-
-#define DATASETNAME "Array_le"
-#define DATASETNAME1 "Array_be"
-#define DATASETNAME2 "Scale_offset_float_data_le"
-#define DATASETNAME3 "Scale_offset_float_data_be"
-#define DATASETNAME4 "Scale_offset_double_data_le"
-#define DATASETNAME5 "Scale_offset_double_data_be"
-#define DATASETNAME6 "Scale_offset_char_data_le"
-#define DATASETNAME7 "Scale_offset_char_data_be"
-#define DATASETNAME8 "Scale_offset_short_data_le"
-#define DATASETNAME9 "Scale_offset_short_data_be"
-#define DATASETNAME10 "Scale_offset_int_data_le"
-#define DATASETNAME11 "Scale_offset_int_data_be"
-#define DATASETNAME12 "Scale_offset_long_long_data_le"
-#define DATASETNAME13 "Scale_offset_long_long_data_be"
-
-#define DATASETNAME14 "Fletcher_float_data_le"
-#define DATASETNAME15 "Fletcher_float_data_be"
-#define DATASETNAME16 "Deflate_float_data_le"
-#define DATASETNAME17 "Deflate_float_data_be"
+const char *FILENAME[] = {"vms_data", "le_data", "be_data", NULL};
+
+#define DATASETNAME "Array_le"
+#define DATASETNAME1 "Array_be"
+#define DATASETNAME2 "Scale_offset_float_data_le"
+#define DATASETNAME3 "Scale_offset_float_data_be"
+#define DATASETNAME4 "Scale_offset_double_data_le"
+#define DATASETNAME5 "Scale_offset_double_data_be"
+#define DATASETNAME6 "Scale_offset_char_data_le"
+#define DATASETNAME7 "Scale_offset_char_data_be"
+#define DATASETNAME8 "Scale_offset_short_data_le"
+#define DATASETNAME9 "Scale_offset_short_data_be"
+#define DATASETNAME10 "Scale_offset_int_data_le"
+#define DATASETNAME11 "Scale_offset_int_data_be"
+#define DATASETNAME12 "Scale_offset_long_long_data_le"
+#define DATASETNAME13 "Scale_offset_long_long_data_be"
+
+#define DATASETNAME14 "Fletcher_float_data_le"
+#define DATASETNAME15 "Fletcher_float_data_be"
+#define DATASETNAME16 "Deflate_float_data_le"
+#define DATASETNAME17 "Deflate_float_data_be"
#ifdef H5_HAVE_FILTER_SZIP
-#define DATASETNAME18 "Szip_float_data_le"
-#define DATASETNAME19 "Szip_float_data_be"
+#define DATASETNAME18 "Szip_float_data_le"
+#define DATASETNAME19 "Szip_float_data_be"
#endif /* H5_HAVE_FILTER_SZIP */
-#define DATASETNAME20 "Shuffle_float_data_le"
-#define DATASETNAME21 "Shuffle_float_data_be"
-#define DATASETNAME22 "Nbit_float_data_le"
-#define DATASETNAME23 "Nbit_float_data_be"
+#define DATASETNAME20 "Shuffle_float_data_le"
+#define DATASETNAME21 "Shuffle_float_data_be"
+#define DATASETNAME22 "Nbit_float_data_le"
+#define DATASETNAME23 "Nbit_float_data_be"
-#define NX 6
-#define NY 6
+#define NX 6
+#define NY 6
-
/*-------------------------------------------------------------------------
* Function: check_data_i
*
@@ -77,49 +71,49 @@ const char *FILENAME[] = {
static int
check_data_i(const char *dsetname, hid_t fid)
{
- hid_t did = -1; /* dataset ID */
- long long data_in[NX+1][NY]; /* input buffer */
- long long data_out[NX+1][NY]; /* output buffer */
- int i, j; /* iterators */
- int nerrors = 0; /* # errors in dataset values */
+ hid_t did = -1; /* dataset ID */
+ long long data_in[NX + 1][NY]; /* input buffer */
+ long long data_out[NX + 1][NY]; /* output buffer */
+ int i, j; /* iterators */
+ int nerrors = 0; /* # errors in dataset values */
/* Open the dataset. */
- if((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Initialization. */
/* Input (last row is different) */
- for(i = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
+ for (i = 0; i < NX; i++)
+ for (j = 0; j < NY; j++)
data_in[i][j] = i + j;
- for(i = 0; i < NY; i++)
+ for (i = 0; i < NY; i++)
data_in[NX][i] = -2;
/* Output */
- HDmemset(data_out, 0, (NX+1) * NY * sizeof(long long));
+ HDmemset(data_out, 0, (NX + 1) * NY * sizeof(long long));
/* Read data from hyperslab in the file into the hyperslab in
* memory and display.
*/
- if(H5Dread(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0)
+ if (H5Dread(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0)
FAIL_STACK_ERROR;
/* Check results */
- for(i = 0; i < (NX + 1); i++)
- for(j = 0; j < NY; j++)
- if(data_out[i][j] != data_in[i][j])
- if(!nerrors++) {
+ for (i = 0; i < (NX + 1); i++)
+ for (j = 0; j < NY; j++)
+ if (data_out[i][j] != data_in[i][j])
+ if (!nerrors++) {
H5_FAILED();
- HDprintf("element [%d][%d] is %lld but should have been %lld\n",
- (int)i, (int)j, data_out[i][j], data_in[i][j]);
+ HDprintf("element [%d][%d] is %lld but should have been %lld\n", (int)i, (int)j,
+ data_out[i][j], data_in[i][j]);
} /* end if */
/* Close/release resources. */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Failure */
- if(nerrors) {
- HDprintf("total of %d errors out of %d elements\n", nerrors, (int)(NX*NY));
+ if (nerrors) {
+ HDprintf("total of %d errors out of %d elements\n", nerrors, (int)(NX * NY));
return 1;
} /* end if */
@@ -127,13 +121,11 @@ check_data_i(const char *dsetname, hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Dclose(did);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Dclose(did); }
+ H5E_END_TRY;
return 1;
} /* end check_data_i() */
-
/*-------------------------------------------------------------------------
* Function: check_data_f
*
@@ -150,49 +142,49 @@ error:
static int
check_data_f(const char *dsetname, hid_t fid)
{
- hid_t did = -1; /* dataset ID */
- double data_in[NX+1][NY]; /* input buffer */
- double data_out[NX+1][NY]; /* output buffer */
- int i, j; /* iterators */
- int nerrors = 0; /* # of errors in dataset values */
+ hid_t did = -1; /* dataset ID */
+ double data_in[NX + 1][NY]; /* input buffer */
+ double data_out[NX + 1][NY]; /* output buffer */
+ int i, j; /* iterators */
+ int nerrors = 0; /* # of errors in dataset values */
/* Open the dataset. */
- if((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Initialization. */
/* Input (last row is different) */
- for(i = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
+ for (i = 0; i < NX; i++)
+ for (j = 0; j < NY; j++)
data_in[i][j] = ((double)(i + j + 1)) / (double)3.0F;
- for(i = 0; i < NY; i++)
+ for (i = 0; i < NY; i++)
data_in[NX][i] = -2.2F;
/* Output */
- HDmemset(data_out, 0, (NX+1) * NY * sizeof(double));
+ HDmemset(data_out, 0, (NX + 1) * NY * sizeof(double));
/* Read data from hyperslab in the file into the hyperslab in
* memory and display.
*/
- if(H5Dread(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0)
+ if (H5Dread(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0)
FAIL_STACK_ERROR;
/* Check results */
- for(i = 0; i < (NX + 1); i++)
- for(j = 0; j < NY; j++)
- if(!H5_DBL_REL_EQUAL(data_out[i][j], data_in[i][j], (double)0.001F))
- if(!nerrors++) {
+ for (i = 0; i < (NX + 1); i++)
+ for (j = 0; j < NY; j++)
+ if (!H5_DBL_REL_EQUAL(data_out[i][j], data_in[i][j], (double)0.001F))
+ if (!nerrors++) {
H5_FAILED();
- HDprintf("element [%d][%d] is %g but should have been %g\n",
- (int)i, (int)j, data_out[i][j], data_in[i][j]);
+ HDprintf("element [%d][%d] is %g but should have been %g\n", (int)i, (int)j,
+ data_out[i][j], data_in[i][j]);
} /* end if */
/* Close/release resources. */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Failure */
- if(nerrors) {
- HDprintf("total of %d errors out of %d elements\n", nerrors, (int)(NX*NY));
+ if (nerrors) {
+ HDprintf("total of %d errors out of %d elements\n", nerrors, (int)(NX * NY));
return 1;
} /* end if */
@@ -200,13 +192,11 @@ check_data_f(const char *dsetname, hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Dclose(did);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Dclose(did); }
+ H5E_END_TRY;
return 1;
} /* end check_data_f() */
-
/*-------------------------------------------------------------------------
* Function: check_file
*
@@ -223,15 +213,15 @@ error:
static int
check_file(char *filename)
{
- const char *pathname = H5_get_srcdir_filename(filename); /* Corrected test file name */
- hid_t fid = -1; /* file ID */
- int nerrors = 0; /* # of datasets with errors */
+ const char *pathname = H5_get_srcdir_filename(filename); /* Corrected test file name */
+ hid_t fid = -1; /* file ID */
+ int nerrors = 0; /* # of datasets with errors */
#if !defined(H5_HAVE_FILTER_DEFLATE) || !defined(H5_HAVE_FILTER_SZIP)
- const char *not_supported= " filter is not enabled."; /* no filter message */
+ const char *not_supported = " filter is not enabled."; /* no filter message */
#endif
/* Open the file. */
- if((fid = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
TESTING("regular dataset of LE DOUBLE");
@@ -285,7 +275,7 @@ check_file(char *filename)
TESTING("dataset of LE FLOAT with Deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
nerrors += check_data_f(DATASETNAME16, fid);
-#else /*H5_HAVE_FILTER_DEFLATE*/
+#else /*H5_HAVE_FILTER_DEFLATE*/
SKIPPED();
HDputs(not_supported);
#endif /*H5_HAVE_FILTER_DEFLATE*/
@@ -293,7 +283,7 @@ check_file(char *filename)
TESTING("dataset of BE FLOAT with Deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
nerrors += check_data_f(DATASETNAME17, fid);
-#else /*H5_HAVE_FILTER_DEFLATE*/
+#else /*H5_HAVE_FILTER_DEFLATE*/
SKIPPED();
HDputs(not_supported);
#endif /*H5_HAVE_FILTER_DEFLATE*/
@@ -301,7 +291,7 @@ check_file(char *filename)
TESTING("dataset of LE FLOAT with Szip filter");
#ifdef H5_HAVE_FILTER_SZIP
nerrors += check_data_f(DATASETNAME18, fid);
-#else /*H5_HAVE_FILTER_SZIP*/
+#else /*H5_HAVE_FILTER_SZIP*/
SKIPPED();
HDputs(not_supported);
#endif /*H5_HAVE_FILTER_SZIP*/
@@ -309,7 +299,7 @@ check_file(char *filename)
TESTING("dataset of BE FLOAT with Szip filter");
#ifdef H5_HAVE_FILTER_SZIP
nerrors += check_data_f(DATASETNAME19, fid);
-#else /*H5_HAVE_FILTER_SZIP*/
+#else /*H5_HAVE_FILTER_SZIP*/
SKIPPED();
HDputs(not_supported);
#endif /*H5_HAVE_FILTER_SZIP*/
@@ -326,18 +316,16 @@ check_file(char *filename)
TESTING("dataset of BE FLOAT with Nbit filter");
nerrors += check_data_f(DATASETNAME23, fid);
- if(H5Fclose(fid))
+ if (H5Fclose(fid))
FAIL_STACK_ERROR
return nerrors;
error:
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_END_TRY;
return nerrors;
} /* end check_file() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -353,8 +341,8 @@ error:
int
main(void)
{
- char filename[1024];
- int nerrors = 0;
+ char filename[1024];
+ int nerrors = 0;
h5_reset();
@@ -368,7 +356,7 @@ main(void)
h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof(filename));
nerrors += check_file(filename);
- if(nerrors) {
+ if (nerrors) {
HDprintf("***** %d FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S");
return EXIT_FAILURE;
} /* end if */
@@ -376,4 +364,3 @@ main(void)
HDprintf("All data type tests passed.\n");
return EXIT_SUCCESS;
} /* end main() */
-
diff --git a/test/dangle.c b/test/dangle.c
index 8300792..4728923 100644
--- a/test/dangle.c
+++ b/test/dangle.c
@@ -19,18 +19,14 @@
*/
#include "h5test.h"
-const char *FILENAME[] = {
- "dangle",
- NULL
-};
+const char *FILENAME[] = {"dangle", NULL};
-#define MAX_DANGLE 1000
-
-#define DSETNAME "Dataset"
-#define GROUPNAME "Group"
-#define TYPENAME "Type"
-#define ATTRNAME "Attribute"
+#define MAX_DANGLE 1000
+#define DSETNAME "Dataset"
+#define GROUPNAME "Group"
+#define TYPENAME "Type"
+#define ATTRNAME "Attribute"
/*-------------------------------------------------------------------------
* Function: test_dangle_dataset
@@ -51,70 +47,74 @@ const char *FILENAME[] = {
static int
test_dangle_dataset(H5F_close_degree_t degree)
{
- char filename[1024];
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- hid_t dsid; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- unsigned u; /* Local index variable */
+ char filename[1024];
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ unsigned u; /* Local index variable */
TESTING(" dangling dataset IDs");
- if(H5open() < 0)
+ if (H5open() < 0)
TEST_ERROR;
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set file close degree */
- if(H5Pset_fclose_degree(fapl, degree) < 0)
+ if (H5Pset_fclose_degree(fapl, degree) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR;
- if((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
TEST_ERROR;
/* Try creating duplicate dataset */
- H5E_BEGIN_TRY {
- if((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0)
+ H5E_BEGIN_TRY
+ {
+ if ((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >=
+ 0)
TEST_ERROR;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
/* Leave open a _lot_ of objects */
- for(u = 0; u < MAX_DANGLE; u++)
- if((dsid = H5Dopen2(fid, DSETNAME, H5P_DEFAULT)) < 0)
+ for (u = 0; u < MAX_DANGLE; u++)
+ if ((dsid = H5Dopen2(fid, DSETNAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(degree == H5F_CLOSE_SEMI) {
- H5E_BEGIN_TRY {
- if(H5Fclose(fid) >= 0)
+ if (degree == H5F_CLOSE_SEMI) {
+ H5E_BEGIN_TRY
+ {
+ if (H5Fclose(fid) >= 0)
TEST_ERROR;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* end if */
- else
- if(H5Fclose(fid) < 0)
- TEST_ERROR;
+ else if (H5Fclose(fid) < 0)
+ TEST_ERROR;
- if(h5_get_file_size(filename, fapl) < 0)
+ if (h5_get_file_size(filename, fapl) < 0)
TEST_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
- if(H5close() < 0)
+ if (H5close() < 0)
TEST_ERROR;
/* Clean up temporary file */
@@ -127,7 +127,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_dangle_group
*
@@ -147,65 +146,67 @@ error:
static int
test_dangle_group(H5F_close_degree_t degree)
{
- char filename[1024];
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- hid_t gid; /* Group ID */
- unsigned u; /* Local index variable */
+ char filename[1024];
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ hid_t gid; /* Group ID */
+ unsigned u; /* Local index variable */
TESTING(" dangling group IDs");
- if(H5open() < 0)
+ if (H5open() < 0)
TEST_ERROR;
/* Create file access property list */
- if((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set file close degree */
- if(H5Pset_fclose_degree(fapl,degree) < 0)
+ if (H5Pset_fclose_degree(fapl, degree) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((fid = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR;
/* Try creating duplicate group */
- H5E_BEGIN_TRY {
- gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(gid >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (gid >= 0)
+ TEST_ERROR
/* Leave open a _lot_ of objects */
- for(u = 0; u < MAX_DANGLE; u++)
- if((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
+ for (u = 0; u < MAX_DANGLE; u++)
+ if ((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(degree==H5F_CLOSE_SEMI) {
- H5E_BEGIN_TRY {
- if(H5Fclose(fid)>=0)
+ if (degree == H5F_CLOSE_SEMI) {
+ H5E_BEGIN_TRY
+ {
+ if (H5Fclose(fid) >= 0)
TEST_ERROR;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* end if */
- else
- if(H5Fclose(fid) < 0)
- TEST_ERROR;
+ else if (H5Fclose(fid) < 0)
+ TEST_ERROR;
- if(h5_get_file_size(filename, fapl) < 0)
+ if (h5_get_file_size(filename, fapl) < 0)
TEST_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
- if(H5close() < 0)
+ if (H5close() < 0)
TEST_ERROR;
/* Clean up temporary file */
@@ -218,7 +219,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_dangle_datatype1
*
@@ -238,70 +238,73 @@ error:
static int
test_dangle_datatype1(H5F_close_degree_t degree)
{
- char filename[1024];
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- hid_t tid; /* Datatype ID */
- unsigned u; /* Local index variable */
+ char filename[1024];
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ hid_t tid; /* Datatype ID */
+ unsigned u; /* Local index variable */
TESTING(" dangling named datatype IDs");
- if(H5open() < 0)
+ if (H5open() < 0)
TEST_ERROR;
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set file close degree */
- if(H5Pset_fclose_degree(fapl, degree) < 0)
+ if (H5Pset_fclose_degree(fapl, degree) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
TEST_ERROR;
- if(H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
TEST_ERROR;
/* Try creating duplicate named datatype */
- if((tid = H5Tcopy (H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- if(H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR;
- } H5E_END_TRY;
- if(H5Tclose(tid) < 0)
+ }
+ H5E_END_TRY;
+ if (H5Tclose(tid) < 0)
TEST_ERROR;
/* Leave open a _lot_ of objects */
- for(u = 0; u < MAX_DANGLE; u++)
- if((tid = H5Topen2(fid, TYPENAME, H5P_DEFAULT)) < 0)
+ for (u = 0; u < MAX_DANGLE; u++)
+ if ((tid = H5Topen2(fid, TYPENAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(degree == H5F_CLOSE_SEMI) {
- H5E_BEGIN_TRY {
- if(H5Fclose(fid) >= 0)
+ if (degree == H5F_CLOSE_SEMI) {
+ H5E_BEGIN_TRY
+ {
+ if (H5Fclose(fid) >= 0)
TEST_ERROR;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* end if */
- else
- if(H5Fclose(fid) < 0)
- TEST_ERROR;
+ else if (H5Fclose(fid) < 0)
+ TEST_ERROR;
- if(h5_get_file_size(filename, fapl) < 0)
+ if (h5_get_file_size(filename, fapl) < 0)
TEST_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
- if(H5close() < 0)
+ if (H5close() < 0)
TEST_ERROR;
/* Clean up temporary file */
@@ -314,7 +317,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_dangle_datatype2
*
@@ -334,61 +336,62 @@ error:
static int
test_dangle_datatype2(H5F_close_degree_t degree)
{
- char filename[1024];
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- hid_t did; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
+ char filename[1024];
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
TESTING(" dangling named datatype ID used by dataset");
- if(H5open() < 0)
+ if (H5open() < 0)
TEST_ERROR;
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set file close degree */
- if(H5Pset_fclose_degree(fapl, degree) < 0)
+ if (H5Pset_fclose_degree(fapl, degree) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
TEST_ERROR;
- if(H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR;
/* Create a dataset that uses the named datatype & leave it open */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR;
- if((did = H5Dcreate2(fid, DSETNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSETNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(degree == H5F_CLOSE_SEMI) {
- H5E_BEGIN_TRY {
- if(H5Fclose(fid) >= 0)
+ if (degree == H5F_CLOSE_SEMI) {
+ H5E_BEGIN_TRY
+ {
+ if (H5Fclose(fid) >= 0)
TEST_ERROR;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* end if */
- else
- if(H5Fclose(fid) < 0)
- TEST_ERROR;
+ else if (H5Fclose(fid) < 0)
+ TEST_ERROR;
- if(h5_get_file_size(filename, fapl) < 0)
+ if (h5_get_file_size(filename, fapl) < 0)
TEST_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
- if(H5close() < 0)
+ if (H5close() < 0)
TEST_ERROR;
/* Clean up temporary file */
@@ -401,7 +404,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_dangle_attribute
*
@@ -421,81 +423,84 @@ error:
static int
test_dangle_attribute(H5F_close_degree_t degree)
{
- char filename[1024];
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- hid_t dsid; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t aid; /* Attribute ID */
- unsigned u; /* Local index variable */
+ char filename[1024];
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t aid; /* Attribute ID */
+ unsigned u; /* Local index variable */
TESTING(" dangling attribute IDs");
- if(H5open() < 0)
+ if (H5open() < 0)
TEST_ERROR;
/* Create file access property list */
- if((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set file close degree */
- if(H5Pset_fclose_degree(fapl,degree) < 0)
+ if (H5Pset_fclose_degree(fapl, degree) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR;
- if((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create an attribute on the dataset */
- if((aid = H5Acreate2(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Don't worry about writing the attribute - it will have a fill value */
/* Close the attribute on the dataset */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR;
/* Try creating duplicate attribute */
- H5E_BEGIN_TRY {
- if((aid = H5Acreate2(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) >= 0)
+ H5E_BEGIN_TRY
+ {
+ if ((aid = H5Acreate2(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) >= 0)
TEST_ERROR;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
/* Leave open a _lot_ of objects */
- for(u = 0; u < MAX_DANGLE; u++)
- if((aid = H5Aopen(dsid, ATTRNAME, H5P_DEFAULT)) < 0)
+ for (u = 0; u < MAX_DANGLE; u++)
+ if ((aid = H5Aopen(dsid, ATTRNAME, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
TEST_ERROR
- if(degree == H5F_CLOSE_SEMI) {
- H5E_BEGIN_TRY {
- if(H5Fclose(fid) >= 0)
+ if (degree == H5F_CLOSE_SEMI) {
+ H5E_BEGIN_TRY
+ {
+ if (H5Fclose(fid) >= 0)
TEST_ERROR;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* end if */
- else
- if(H5Fclose(fid) < 0)
- TEST_ERROR;
+ else if (H5Fclose(fid) < 0)
+ TEST_ERROR;
- if(h5_get_file_size(filename, fapl) < 0)
+ if (h5_get_file_size(filename, fapl) < 0)
TEST_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
- if(H5close() < 0)
+ if (H5close() < 0)
TEST_ERROR;
/* Clean up temporary file */
@@ -508,7 +513,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_dangle_force
*
@@ -527,97 +531,97 @@ static int
test_dangle_force(void)
{
char filename[1024];
- hid_t fid; /* File ID */
- hid_t gid, gid2; /* Group IDs */
- hid_t dsid, dsid2; /* Dataset IDs */
- hid_t sid; /* Dataspace ID */
- hid_t aid, aid2; /* Attribute IDs */
- hid_t tid, tid2; /* Named datatype IDs */
- ssize_t count; /* Count of open objects */
- hid_t *objs = NULL; /* Pointer to list of open objects */
- size_t u; /* Local index variable */
+ hid_t fid; /* File ID */
+ hid_t gid, gid2; /* Group IDs */
+ hid_t dsid, dsid2; /* Dataset IDs */
+ hid_t sid; /* Dataspace ID */
+ hid_t aid, aid2; /* Attribute IDs */
+ hid_t tid, tid2; /* Named datatype IDs */
+ ssize_t count; /* Count of open objects */
+ hid_t * objs = NULL; /* Pointer to list of open objects */
+ size_t u; /* Local index variable */
TESTING("force dangling IDs to close, from API routines");
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create a dataspace for the dataset & attribute to use */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
FAIL_STACK_ERROR
/* Create a dataset */
- if((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Re-open the dataset */
- if((dsid2 = H5Dopen2(fid, DSETNAME, H5P_DEFAULT)) < 0)
+ if ((dsid2 = H5Dopen2(fid, DSETNAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create an attribute on the dataset */
- if((aid = H5Acreate2(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Re-open the attribute */
- if((aid2 = H5Aopen(dsid, ATTRNAME, H5P_DEFAULT)) < 0)
+ if ((aid2 = H5Aopen(dsid, ATTRNAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close the dataspace ID */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
/* Open a group ID */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Open group again */
- if((gid2 = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create a named datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
FAIL_STACK_ERROR
- if(H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Re-open the named datatype */
- if((tid2 = H5Topen2(fid, TYPENAME, H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(fid, TYPENAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Increment the ref count on all the "second" objects */
- if(H5Iinc_ref(dsid2) < 0)
+ if (H5Iinc_ref(dsid2) < 0)
FAIL_STACK_ERROR
- if(H5Iinc_ref(aid2) < 0)
+ if (H5Iinc_ref(aid2) < 0)
FAIL_STACK_ERROR
- if(H5Iinc_ref(gid2) < 0)
+ if (H5Iinc_ref(gid2) < 0)
FAIL_STACK_ERROR
- if(H5Iinc_ref(aid2) < 0)
+ if (H5Iinc_ref(aid2) < 0)
FAIL_STACK_ERROR
/* Get the number of open objects */
- if((count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0)
+ if ((count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0)
FAIL_STACK_ERROR
- if(0 == count)
+ if (0 == count)
TEST_ERROR;
/* Allocate the array of object IDs */
- if(NULL == (objs = (hid_t *)HDcalloc((size_t)count, sizeof(hid_t))))
+ if (NULL == (objs = (hid_t *)HDcalloc((size_t)count, sizeof(hid_t))))
TEST_ERROR;
/* Get the list of open IDs */
- if(H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0)
+ if (H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0)
FAIL_STACK_ERROR
/* Close all open IDs */
- for(u = 0; u < (size_t)count; u++)
- while(H5Iget_type(objs[u]) != H5I_BADID && H5Iget_ref(objs[u]) > 0)
+ for (u = 0; u < (size_t)count; u++)
+ while (H5Iget_type(objs[u]) != H5I_BADID && H5Iget_ref(objs[u]) > 0)
H5Idec_ref(objs[u]);
/* Get the number of open objects */
- if((count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0)
+ if ((count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0)
FAIL_STACK_ERROR
- if(0 != count)
+ if (0 != count)
TEST_ERROR;
/* Clean up temporary file */
@@ -630,12 +634,11 @@ test_dangle_force(void)
return 0;
error:
- if(objs)
+ if (objs)
HDfree(objs);
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -654,7 +657,7 @@ error:
int
main(void)
{
- int nerrors=0;
+ int nerrors = 0;
/* Run tests w/weak file close */
puts("Testing dangling objects with weak file close:");
@@ -694,4 +697,3 @@ error:
puts("***** DANGLING ID TESTS FAILED *****");
return 1;
}
-
diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c
index 6f48901..95b5854 100644
--- a/test/del_many_dense_attrs.c
+++ b/test/del_many_dense_attrs.c
@@ -17,16 +17,12 @@
* (See HDFFV-10659).
*/
-
#include "h5test.h"
/* The test file name */
-const char *FILENAME[] = {
- "del_many_dense_attrs",
- NULL
-};
+const char *FILENAME[] = {"del_many_dense_attrs", NULL};
-#define ATTR_COUNT 64 /* The number of attributes */
+#define ATTR_COUNT 64 /* The number of attributes */
/*-------------------------------------------------------------------------
* Function: catch_signal
@@ -39,12 +35,12 @@ const char *FILENAME[] = {
*
*-------------------------------------------------------------------------
*/
-static void catch_signal(int H5_ATTR_UNUSED signo)
+static void
+catch_signal(int H5_ATTR_UNUSED signo)
{
HDexit(EXIT_FAILURE);
} /* catch_signal() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -62,108 +58,108 @@ static void catch_signal(int H5_ATTR_UNUSED signo)
int
main(void)
{
- hid_t fid = -1; /* HDF5 File ID */
- hid_t gid = -1; /* Group ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t fapl = -1; /* File access property lists */
- hid_t gcpl = -1; /* Group creation property list */
- char aname[50]; /* Name of attribute */
- const char *basename="attr"; /* Name prefix for attribute */
- char filename[100]; /* File name */
- int i; /* Local index variable */
+ hid_t fid = -1; /* HDF5 File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t fapl = -1; /* File access property lists */
+ hid_t gcpl = -1; /* Group creation property list */
+ char aname[50]; /* Name of attribute */
+ const char *basename = "attr"; /* Name prefix for attribute */
+ char filename[100]; /* File name */
+ int i; /* Local index variable */
/* Testing setup */
h5_reset();
/* To exit from the file for SIGABRT signal */
- if(HDsignal(SIGABRT, catch_signal) == SIG_ERR)
- TEST_ERROR
+ if (HDsignal(SIGABRT, catch_signal) == SIG_ERR)
+ TEST_ERROR
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Set to latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
/* Create the file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
- /* Re-open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ /* Re-open the file */
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create the group creation property list */
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ if ((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
TEST_ERROR
/* Set to use dense storage for all attributes on the group */
- if(H5Pset_attr_phase_change(gcpl, 0, 0) < 0)
+ if (H5Pset_attr_phase_change(gcpl, 0, 0) < 0)
TEST_ERROR
/* Create the group in the file */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR
/* Get a copy of the datatype */
- if((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
TEST_ERROR
/* Create attributes in the group */
- for(i = ATTR_COUNT; i >= 0; i--) {
+ for (i = ATTR_COUNT; i >= 0; i--) {
/* Set up the attribute name */
HDsprintf(aname, "%s%d", basename, i);
/* Create the attribute */
- if((aid = H5Acreate2(gid, aname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(gid, aname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Write to the attribute */
- if(H5Awrite(aid, tid, &i) < 0)
+ if (H5Awrite(aid, tid, &i) < 0)
TEST_ERROR
/* Close the attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR
}
/* Close the datatype */
- if(H5Tclose(tid) < 0)
- TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Close the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/* Close the group */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl) < 0)
+ if (H5Pclose(gcpl) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Re-open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Open the group */
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Delete the attributes */
@@ -172,24 +168,25 @@ main(void)
HDsprintf(aname, "%s%d", basename, i);
/* Delete the attribute */
- if(H5Adelete(gid, aname) < 0)
+ if (H5Adelete(gid, aname) < 0)
TEST_ERROR
} /* end for */
/* Close the group */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
h5_cleanup(FILENAME, fapl);
- return(EXIT_SUCCESS);
+ return (EXIT_SUCCESS);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Sclose(sid);
H5Tclose(tid);
@@ -197,7 +194,8 @@ error:
H5Fclose(fid);
H5Pclose(gcpl);
H5Pclose(fapl);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return EXIT_FAILURE;
}
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 2e6cc68..388f2cc 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -1,62 +1,62 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5test.h"
#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
-# define H5_ZLIB_HEADER "zlib.h"
+#define H5_ZLIB_HEADER "zlib.h"
#endif
#if defined(H5_ZLIB_HEADER)
-# include H5_ZLIB_HEADER /* "zlib.h" */
+#include H5_ZLIB_HEADER /* "zlib.h" */
#endif
#define FILE_NAME "direct_chunk.h5"
/* Datasets for Direct Write tests */
-#define DATASETNAME1 "direct_write"
-#define DATASETNAME2 "skip_one_filter"
-#define DATASETNAME3 "skip_two_filters"
-#define DATASETNAME4 "data_conv"
-#define DATASETNAME5 "contiguous_dset"
-#define DATASETNAME6 "invalid_argue"
-#define DATASETNAME7 "overwrite_chunk"
+#define DATASETNAME1 "direct_write"
+#define DATASETNAME2 "skip_one_filter"
+#define DATASETNAME3 "skip_two_filters"
+#define DATASETNAME4 "data_conv"
+#define DATASETNAME5 "contiguous_dset"
+#define DATASETNAME6 "invalid_argue"
+#define DATASETNAME7 "overwrite_chunk"
/* Datasets for Direct Read tests */
-#define DATASETNAME8 "disabled_chunk_cache"
-#define DATASETNAME9 "flush_chunk_cache"
-#define DATASETNAME10 "read_w_valid_cache"
-#define DATASETNAME11 "unallocated_chunk"
-#define DATASETNAME12 "unfiltered_data"
+#define DATASETNAME8 "disabled_chunk_cache"
+#define DATASETNAME9 "flush_chunk_cache"
+#define DATASETNAME10 "read_w_valid_cache"
+#define DATASETNAME11 "unallocated_chunk"
+#define DATASETNAME12 "unfiltered_data"
-#define RANK 2
-#define NX 16
-#define NY 16
-#define CHUNK_NX 4
-#define CHUNK_NY 4
+#define RANK 2
+#define NX 16
+#define NY 16
+#define CHUNK_NX 4
+#define CHUNK_NY 4
-#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*1.001)+12.0)
+#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12.0)
/* Temporary filter IDs used for testing */
-#define H5Z_FILTER_BOGUS1 305
-#define H5Z_FILTER_BOGUS2 306
+#define H5Z_FILTER_BOGUS1 305
+#define H5Z_FILTER_BOGUS2 306
#define ADD_ON 7
#define FACTOR 3
/* Constants for the overwrite test */
-#define OVERWRITE_NDIMS 3
-#define OVERWRITE_CHUNK_NX 3
-#define OVERWRITE_CHUNK_2NX 6
-#define OVERWRITE_CHUNK_NY 2
-#define OVERWRITE_VALUE 42
+#define OVERWRITE_NDIMS 3
+#define OVERWRITE_CHUNK_NX 3
+#define OVERWRITE_CHUNK_2NX 6
+#define OVERWRITE_CHUNK_NY 2
+#define OVERWRITE_VALUE 42
/* Test configurations */
#define CONFIG_LATEST 0x01
@@ -67,38 +67,38 @@
#define CONFIG_END 0x20
/* Defines used in test_single_chunk_latest() */
-#define FILE "single_latest.h5"
-#define DATASET "dataset"
-#define DIM0 4
-#define DIM1 32
-#define CHUNK0 DIM0
-#define CHUNK1 DIM1
+#define FILE "single_latest.h5"
+#define DATASET "dataset"
+#define DIM0 4
+#define DIM1 32
+#define CHUNK0 DIM0
+#define CHUNK1 DIM1
/* Local prototypes for filter functions */
-static size_t filter_bogus1(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus1(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS1[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS1, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "bogus1", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_bogus1, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_BOGUS1, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "bogus1", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_bogus1, /* The actual filter function */
}};
const H5Z_class2_t H5Z_BOGUS2[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS2, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "bogus2", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_bogus2, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_BOGUS2, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "bogus2", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_bogus2, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
@@ -116,31 +116,31 @@ const H5Z_class2_t H5Z_BOGUS2[1] = {{
*/
#ifdef H5_HAVE_FILTER_DEFLATE
static int
-test_direct_chunk_write (hid_t file)
+test_direct_chunk_write(hid_t file)
{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int ret;
- int data[NX][NY];
- int i, j, n;
-
- unsigned filter_mask = 0;
- int direct_buf[CHUNK_NX][CHUNK_NY];
- int check_chunk[CHUNK_NX][CHUNK_NY];
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
-
- const Bytef *z_src = (const Bytef*)(direct_buf);
- Bytef *z_dst = NULL; /*destination buffer */
- uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- uLong z_src_nbytes = (uLong)buf_size;
- int aggression = 9; /* Compression aggression setting */
- void *outbuf = NULL; /* Pointer to new buffer */
+ hid_t dataspace = -1, dataset = -1;
+ hid_t mem_space = -1;
+ hid_t cparms = -1, dxpl = -1;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
+ herr_t status;
+ int ret;
+ int data[NX][NY];
+ int i, j, n;
+
+ unsigned filter_mask = 0;
+ int direct_buf[CHUNK_NX][CHUNK_NY];
+ int check_chunk[CHUNK_NX][CHUNK_NY];
+ hsize_t offset[2] = {0, 0};
+ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
+
+ const Bytef *z_src = (const Bytef *)(direct_buf);
+ Bytef * z_dst = NULL; /*destination buffer */
+ uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
+ uLong z_src_nbytes = (uLong)buf_size;
+ int aggression = 9; /* Compression aggression setting */
+ void * outbuf = NULL; /* Pointer to new buffer */
hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
@@ -152,76 +152,77 @@ test_direct_chunk_write (hid_t file)
/*
* Create the data space with unlimited dimensions.
*/
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
goto error;
/*
* Modify dataset creation properties, i.e. enable chunking and compression
*/
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
+ if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
goto error;
- if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0)
+ if ((status = H5Pset_deflate(cparms, (unsigned)aggression)) < 0)
goto error;
/*
* Create a new dataset within the file using cparms
* creation properties.
*/
- if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
goto error;
/* Initialize the dataset */
- for(i = n = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
- data[i][j] = n++;
+ for (i = n = 0; i < NX; i++)
+ for (j = 0; j < NY; j++)
+ data[i][j] = n++;
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/*
* Write the data for the dataset. It should stay in the chunk cache.
* It will be evicted from the cache by the H5Dwrite_chunk calls.
*/
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
+ if ((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, data)) < 0)
goto error;
/* Initialize data for one chunk */
- for(i = n = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++)
- direct_buf[i][j] = n++;
+ for (i = n = 0; i < CHUNK_NX; i++)
+ for (j = 0; j < CHUNK_NY; j++)
+ direct_buf[i][j] = n++;
/* Allocate output (compressed) buffer */
outbuf = HDmalloc(z_dst_nbytes);
- z_dst = (Bytef *)outbuf;
+ z_dst = (Bytef *)outbuf;
/* Perform compression from the source to the destination buffer */
ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
/* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
+ if (Z_BUF_ERROR == ret) {
HDfprintf(stderr, "overflow");
goto error;
- } else if(Z_MEM_ERROR == ret) {
+ }
+ else if (Z_MEM_ERROR == ret) {
HDfprintf(stderr, "deflate memory error");
goto error;
- } else if(Z_OK != ret) {
+ }
+ else if (Z_OK != ret) {
HDfprintf(stderr, "other deflate error");
goto error;
}
/* Write the compressed chunk data repeatedly to cover all the chunks in the
* dataset, using the direct writing function. */
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
+ for (i = 0; i < NX / CHUNK_NX; i++) {
+ for (j = 0; j < NY / CHUNK_NY; j++) {
status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, z_dst_nbytes, outbuf);
offset[1] += CHUNK_NY;
}
@@ -229,36 +230,40 @@ test_direct_chunk_write (hid_t file)
offset[1] = 0;
}
- if(outbuf)
+ if (outbuf)
HDfree(outbuf);
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
- if((dataset = H5Dopen2(file, DATASETNAME1, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DATASETNAME1, H5P_DEFAULT)) < 0)
goto error;
/*
* Select hyperslab for one chunk in the file
*/
- start[0] = CHUNK_NX; start[1] = CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ start[0] = CHUNK_NX;
+ start[1] = CHUNK_NY;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
+ if ((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
goto error;
/* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
+ if ((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != check_chunk[i][j]) {
+ for (i = 0; i < CHUNK_NX; i++) {
+ for (j = 0; j < CHUNK_NY; j++) {
+ if (direct_buf[i][j] != check_chunk[i][j]) {
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
@@ -268,25 +273,27 @@ test_direct_chunk_write (hid_t file)
}
/* Reinitialize different data for one chunk */
- for(i = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++)
- direct_buf[i][j] = i + j;
+ for (i = 0; i < CHUNK_NX; i++)
+ for (j = 0; j < CHUNK_NY; j++)
+ direct_buf[i][j] = i + j;
/* Allocate output (compressed) buffer */
outbuf = HDmalloc(z_dst_nbytes);
- z_dst = (Bytef *)outbuf;
+ z_dst = (Bytef *)outbuf;
/* Perform compression from the source to the destination buffer */
ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
/* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
+ if (Z_BUF_ERROR == ret) {
HDfprintf(stderr, "overflow");
goto error;
- } else if(Z_MEM_ERROR == ret) {
+ }
+ else if (Z_MEM_ERROR == ret) {
HDfprintf(stderr, "deflate memory error");
goto error;
- } else if(Z_OK != ret) {
+ }
+ else if (Z_OK != ret) {
HDfprintf(stderr, "other deflate error");
goto error;
}
@@ -294,8 +301,8 @@ test_direct_chunk_write (hid_t file)
/* Rewrite the compressed chunk data repeatedly to cover all the chunks in the
* dataset, using the direct writing function. */
offset[0] = offset[1] = 0;
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
+ for (i = 0; i < NX / CHUNK_NX; i++) {
+ for (j = 0; j < NY / CHUNK_NY; j++) {
status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, z_dst_nbytes, outbuf);
offset[1] += CHUNK_NY;
}
@@ -303,26 +310,26 @@ test_direct_chunk_write (hid_t file)
offset[1] = 0;
}
- if(outbuf)
+ if (outbuf)
HDfree(outbuf);
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
- if((dataset = H5Dopen2(file, DATASETNAME1, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DATASETNAME1, H5P_DEFAULT)) < 0)
goto error;
/* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
+ if ((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != check_chunk[i][j]) {
+ for (i = 0; i < CHUNK_NX; i++) {
+ for (j = 0; j < CHUNK_NY; j++) {
+ if (direct_buf[i][j] != check_chunk[i][j]) {
HDprintf(" 2. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
@@ -344,15 +351,17 @@ test_direct_chunk_write (hid_t file)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(outbuf)
+ if (outbuf)
HDfree(outbuf);
H5_FAILED();
@@ -376,22 +385,22 @@ error:
static int
test_direct_chunk_overwrite_data(hid_t fid)
{
- size_t buf_size = OVERWRITE_CHUNK_NX * OVERWRITE_CHUNK_NY * sizeof(int16_t);
- int16_t data_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_NX];
- int16_t overwrite_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_NX];
- uint32_t filter_mask = 0;
- hid_t tid = H5T_NATIVE_UINT16;
- hid_t dcpl_id = -1;
- hid_t sid = -1;
- hid_t did = -1;
- uint16_t fill_value = 0;
- hsize_t dset_dims[] = {1, OVERWRITE_CHUNK_NY, OVERWRITE_CHUNK_2NX};
- hsize_t dset_max_dims[] = {H5S_UNLIMITED, OVERWRITE_CHUNK_NY, OVERWRITE_CHUNK_2NX};
- hsize_t chunk_dims[] = {1, OVERWRITE_CHUNK_NY, OVERWRITE_CHUNK_NX};
- hsize_t offset[] = {0, 0, 0};
- hsize_t i, j;
- int16_t n;
- int16_t read_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_2NX];
+ size_t buf_size = OVERWRITE_CHUNK_NX * OVERWRITE_CHUNK_NY * sizeof(int16_t);
+ int16_t data_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_NX];
+ int16_t overwrite_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_NX];
+ uint32_t filter_mask = 0;
+ hid_t tid = H5T_NATIVE_UINT16;
+ hid_t dcpl_id = -1;
+ hid_t sid = -1;
+ hid_t did = -1;
+ uint16_t fill_value = 0;
+ hsize_t dset_dims[] = {1, OVERWRITE_CHUNK_NY, OVERWRITE_CHUNK_2NX};
+ hsize_t dset_max_dims[] = {H5S_UNLIMITED, OVERWRITE_CHUNK_NY, OVERWRITE_CHUNK_2NX};
+ hsize_t chunk_dims[] = {1, OVERWRITE_CHUNK_NY, OVERWRITE_CHUNK_NX};
+ hsize_t offset[] = {0, 0, 0};
+ hsize_t i, j;
+ int16_t n;
+ int16_t read_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_2NX];
TESTING("overwriting existing data with H5Dwrite_chunk");
@@ -415,7 +424,7 @@ test_direct_chunk_overwrite_data(hid_t fid)
n = 0;
for (i = 0; i < OVERWRITE_CHUNK_NY; i++) {
for (j = 0; j < OVERWRITE_CHUNK_NX; j++) {
- data_buf[i][j] = n++;
+ data_buf[i][j] = n++;
overwrite_buf[i][j] = OVERWRITE_VALUE;
}
}
@@ -456,11 +465,13 @@ test_direct_chunk_overwrite_data(hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl_id);
H5Sclose(sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -483,25 +494,25 @@ error:
static int
test_skip_compress_write1(hid_t file)
{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int i, j, n;
-
- unsigned filter_mask = 0;
- int direct_buf[CHUNK_NX][CHUNK_NY];
- int check_chunk[CHUNK_NX][CHUNK_NY];
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- int aggression = 9; /* Compression aggression setting */
-
- unsigned read_filter_mask = 0; /* filter mask after direct read */
- int read_direct_buf[CHUNK_NX][CHUNK_NY];
- hsize_t read_buf_size = 0; /* buf size */
+ hid_t dataspace = -1, dataset = -1;
+ hid_t mem_space = -1;
+ hid_t cparms = -1, dxpl = -1;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
+ herr_t status;
+ int i, j, n;
+
+ unsigned filter_mask = 0;
+ int direct_buf[CHUNK_NX][CHUNK_NY];
+ int check_chunk[CHUNK_NX][CHUNK_NY];
+ hsize_t offset[2] = {0, 0};
+ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
+ int aggression = 9; /* Compression aggression setting */
+
+ unsigned read_filter_mask = 0; /* filter mask after direct read */
+ int read_direct_buf[CHUNK_NX][CHUNK_NY];
+ hsize_t read_buf_size = 0; /* buf size */
hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
@@ -513,40 +524,40 @@ test_skip_compress_write1(hid_t file)
/*
* Create the data space with unlimited dimensions.
*/
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
goto error;
/*
* Modify dataset creation properties, i.e. enable chunking and compression
*/
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
+ if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
goto error;
- if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0)
+ if ((status = H5Pset_deflate(cparms, (unsigned)aggression)) < 0)
goto error;
/*
* Create a new dataset within the file using cparms
* creation properties.
*/
- if((dataset = H5Dcreate2(file, DATASETNAME2, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME2, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
goto error;
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/* Initialize data for one chunk */
- for(i = n = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++) {
+ for (i = n = 0; i < CHUNK_NX; i++)
+ for (j = 0; j < CHUNK_NY; j++) {
direct_buf[i][j] = n++;
- }
+ }
/* write the uncompressed chunk data repeatedly to dataset, using the direct writing function.
* Indicate skipping the compression filter. */
@@ -555,36 +566,40 @@ test_skip_compress_write1(hid_t file)
filter_mask = 0x00000001;
- if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
+ if ((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
goto error;
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
- if((dataset = H5Dopen2(file, DATASETNAME2, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DATASETNAME2, H5P_DEFAULT)) < 0)
goto error;
/*
* Select hyperslab for the chunk just written in the file
*/
- start[0] = CHUNK_NX; start[1] = CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ start[0] = CHUNK_NX;
+ start[1] = CHUNK_NY;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
+ if ((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
goto error;
/* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
+ if ((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != check_chunk[i][j]) {
+ for (i = 0; i < CHUNK_NX; i++) {
+ for (j = 0; j < CHUNK_NY; j++) {
+ if (direct_buf[i][j] != check_chunk[i][j]) {
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
@@ -594,22 +609,22 @@ test_skip_compress_write1(hid_t file)
}
/* Query chunk storage size */
- if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
+ if ((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
goto error;
- if(read_buf_size != buf_size)
+ if (read_buf_size != buf_size)
goto error;
/* Read the raw chunk back */
HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf));
- if((status = H5Dread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0)
+ if ((status = H5Dread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0)
goto error;
- if(read_filter_mask != filter_mask)
+ if (read_filter_mask != filter_mask)
goto error;
/* Check that the direct chunk read is the same as the chunk written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != read_direct_buf[i][j]) {
+ for (i = 0; i < CHUNK_NX; i++) {
+ for (j = 0; j < CHUNK_NY; j++) {
+ if (direct_buf[i][j] != read_direct_buf[i][j]) {
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[i][j], read_direct_buf[i][j]);
@@ -631,13 +646,15 @@ test_skip_compress_write1(hid_t file)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -657,26 +674,25 @@ error:
*/
static size_t
filter_bogus1(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t *buf_size, void **buf)
{
- int *int_ptr=(int *)*buf; /* Pointer to the data values */
- size_t buf_left=*buf_size; /* Amount of data buffer left to process */
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- if(flags & H5Z_FLAG_REVERSE) { /* read */
+ if (flags & H5Z_FLAG_REVERSE) { /* read */
/* Substract the "add on" value to all the data values */
- while(buf_left>0) {
+ while (buf_left > 0) {
*int_ptr++ -= (int)ADD_ON;
buf_left -= sizeof(int);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /* write */
/* Add the "add on" value to all the data values */
- while(buf_left>0) {
+ while (buf_left > 0) {
*int_ptr++ += (int)ADD_ON;
buf_left -= sizeof(int);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* filter_bogus1() */
@@ -694,26 +710,25 @@ filter_bogus1(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
*/
static size_t
filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t *buf_size, void **buf)
{
- int *int_ptr=(int *)*buf; /* Pointer to the data values */
- size_t buf_left=*buf_size; /* Amount of data buffer left to process */
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- if(flags & H5Z_FLAG_REVERSE) { /* read */
+ if (flags & H5Z_FLAG_REVERSE) { /* read */
/* Substract the "add on" value to all the data values */
- while(buf_left>0) {
+ while (buf_left > 0) {
*int_ptr++ /= (int)FACTOR;
buf_left -= sizeof(int);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /* write */
/* Add the "add on" value to all the data values */
- while(buf_left>0) {
+ while (buf_left > 0) {
*int_ptr++ *= (int)FACTOR;
buf_left -= sizeof(int);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* filter_bogus2() */
@@ -735,87 +750,87 @@ filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
static int
test_skip_compress_write2(hid_t file)
{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int i, j, n;
-
- unsigned filter_mask = 0; /* orig filter mask */
- int origin_direct_buf[CHUNK_NX][CHUNK_NY];
- int direct_buf[CHUNK_NX][CHUNK_NY];
- int check_chunk[CHUNK_NX][CHUNK_NY];
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- int aggression = 9; /* Compression aggression setting */
-
- unsigned read_filter_mask = 0; /* filter mask after direct read */
- int read_direct_buf[CHUNK_NX][CHUNK_NY];
- hsize_t read_buf_size = 0; /* buf size */
-
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
+ hid_t dataspace = -1, dataset = -1;
+ hid_t mem_space = -1;
+ hid_t cparms = -1, dxpl = -1;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
+ herr_t status;
+ int i, j, n;
+
+ unsigned filter_mask = 0; /* orig filter mask */
+ int origin_direct_buf[CHUNK_NX][CHUNK_NY];
+ int direct_buf[CHUNK_NX][CHUNK_NY];
+ int check_chunk[CHUNK_NX][CHUNK_NY];
+ hsize_t offset[2] = {0, 0};
+ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
+ int aggression = 9; /* Compression aggression setting */
+
+ unsigned read_filter_mask = 0; /* filter mask after direct read */
+ int read_direct_buf[CHUNK_NX][CHUNK_NY];
+ hsize_t read_buf_size = 0; /* buf size */
+
+ hsize_t start[2]; /* Start of hyperslab */
+ hsize_t stride[2]; /* Stride of hyperslab */
+ hsize_t count[2]; /* Block count */
+ hsize_t block[2]; /* Block sizes */
TESTING("skipping compression filters but keep two other filters");
/*
* Create the data space with unlimited dimensions.
*/
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
goto error;
/*
* Modify dataset creation properties, i.e. enable chunking and compression.
* The order of filters is bogus 1 + deflate + bogus 2.
*/
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
+ if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
goto error;
/* Register and enable first bogus filter */
- if(H5Zregister (H5Z_BOGUS1) < 0)
+ if (H5Zregister(H5Z_BOGUS1) < 0)
goto error;
- if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS1, 0, (size_t)0, NULL) < 0)
+ if (H5Pset_filter(cparms, H5Z_FILTER_BOGUS1, 0, (size_t)0, NULL) < 0)
goto error;
/* Enable compression filter */
- if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0)
+ if ((status = H5Pset_deflate(cparms, (unsigned)aggression)) < 0)
goto error;
/* Register and enable second bogus filter */
- if(H5Zregister (H5Z_BOGUS2) < 0)
+ if (H5Zregister(H5Z_BOGUS2) < 0)
goto error;
- if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS2, 0, (size_t)0, NULL) < 0)
+ if (H5Pset_filter(cparms, H5Z_FILTER_BOGUS2, 0, (size_t)0, NULL) < 0)
goto error;
/*
* Create a new dataset within the file using cparms
* creation properties.
*/
- if((dataset = H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
goto error;
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/* Initialize data for one chunk. Apply operations of two bogus filters to the chunk */
- for(i = n = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++) {
+ for (i = n = 0; i < CHUNK_NX; i++)
+ for (j = 0; j < CHUNK_NY; j++) {
origin_direct_buf[i][j] = n++;
- direct_buf[i][j] = (origin_direct_buf[i][j] + ADD_ON) * FACTOR;
+ direct_buf[i][j] = (origin_direct_buf[i][j] + ADD_ON) * FACTOR;
}
/* write the uncompressed chunk data repeatedly to dataset, using the direct writing function.
@@ -826,61 +841,66 @@ test_skip_compress_write2(hid_t file)
/* compression filter is the middle one to be skipped */
filter_mask = 0x00000002;
- if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
+ if ((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
goto error;
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
- if((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0)
goto error;
/*
* Select hyperslab for one chunk in the file
*/
- start[0] = CHUNK_NX; start[1] = CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ start[0] = CHUNK_NX;
+ start[1] = CHUNK_NY;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
+ if ((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
goto error;
/* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
+ if ((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(origin_direct_buf[i][j] != check_chunk[i][j]) {
+ for (i = 0; i < CHUNK_NX; i++) {
+ for (j = 0; j < CHUNK_NY; j++) {
+ if (origin_direct_buf[i][j] != check_chunk[i][j]) {
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" origin_direct_buf=%d, check_chunk=%d\n", origin_direct_buf[i][j], check_chunk[i][j]);
+ HDprintf(" origin_direct_buf=%d, check_chunk=%d\n", origin_direct_buf[i][j],
+ check_chunk[i][j]);
goto error;
}
}
}
/* Query chunk storage size */
- if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
+ if ((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
goto error;
- if(read_buf_size != buf_size)
+ if (read_buf_size != buf_size)
goto error;
/* Read the raw chunk back */
HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf));
- if((status = H5Dread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0)
+ if ((status = H5Dread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0)
goto error;
- if(read_filter_mask != filter_mask)
+ if (read_filter_mask != filter_mask)
goto error;
/* Check that the direct chunk read is the same as the chunk written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != read_direct_buf[i][j]) {
+ for (i = 0; i < CHUNK_NX; i++) {
+ for (j = 0; j < CHUNK_NY; j++) {
+ if (direct_buf[i][j] != read_direct_buf[i][j]) {
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[i][j], read_direct_buf[i][j]);
@@ -902,13 +922,15 @@ test_skip_compress_write2(hid_t file)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -934,28 +956,28 @@ test_data_conv(hid_t file)
int a, b, c[4], d, e;
} src_type_t;
typedef struct {
- int a, c[4], e;
+ int a, c[4], e;
} dst_type_t;
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int i, j, n;
- const hsize_t four = 4;
- hid_t st=-1, dt=-1;
- hid_t array_dt;
-
- unsigned filter_mask = 0;
- src_type_t direct_buf[CHUNK_NX][CHUNK_NY];
- dst_type_t check_chunk[CHUNK_NX][CHUNK_NY];
- src_type_t read_chunk[CHUNK_NX][CHUNK_NY]; /* For H5Dread_chunk */
-
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(src_type_t);
+ hid_t dataspace = -1, dataset = -1;
+ hid_t mem_space = -1;
+ hid_t cparms = -1, dxpl = -1;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
+ herr_t status;
+ int i, j, n;
+ const hsize_t four = 4;
+ hid_t st = -1, dt = -1;
+ hid_t array_dt;
+
+ unsigned filter_mask = 0;
+ src_type_t direct_buf[CHUNK_NX][CHUNK_NY];
+ dst_type_t check_chunk[CHUNK_NX][CHUNK_NY];
+ src_type_t read_chunk[CHUNK_NX][CHUNK_NY]; /* For H5Dread_chunk */
+
+ hsize_t offset[2] = {0, 0};
+ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(src_type_t);
hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
@@ -967,66 +989,65 @@ test_data_conv(hid_t file)
/*
* Create the data space with unlimited dimensions.
*/
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
goto error;
/*
* Modify dataset creation properties, i.e. enable chunking
*/
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
+ if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
goto error;
/* Build hdf5 datatypes */
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
- if((st = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t))) < 0 ||
- H5Tinsert(st, "a", HOFFSET(src_type_t, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "b", HOFFSET(src_type_t, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "c", HOFFSET(src_type_t, c), array_dt) < 0 ||
- H5Tinsert(st, "d", HOFFSET(src_type_t, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "e", HOFFSET(src_type_t, e), H5T_NATIVE_INT) < 0)
+ if ((st = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t))) < 0 ||
+ H5Tinsert(st, "a", HOFFSET(src_type_t, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "b", HOFFSET(src_type_t, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "c", HOFFSET(src_type_t, c), array_dt) < 0 ||
+ H5Tinsert(st, "d", HOFFSET(src_type_t, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "e", HOFFSET(src_type_t, e), H5T_NATIVE_INT) < 0)
goto error;
- if(H5Tclose(array_dt) < 0)
+ if (H5Tclose(array_dt) < 0)
goto error;
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
- if((dt = H5Tcreate(H5T_COMPOUND, sizeof(dst_type_t))) < 0 ||
- H5Tinsert(dt, "a", HOFFSET(dst_type_t, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(dt, "c", HOFFSET(dst_type_t, c), array_dt) < 0 ||
- H5Tinsert(dt, "e", HOFFSET(dst_type_t, e), H5T_NATIVE_INT) < 0)
+ if ((dt = H5Tcreate(H5T_COMPOUND, sizeof(dst_type_t))) < 0 ||
+ H5Tinsert(dt, "a", HOFFSET(dst_type_t, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(dt, "c", HOFFSET(dst_type_t, c), array_dt) < 0 ||
+ H5Tinsert(dt, "e", HOFFSET(dst_type_t, e), H5T_NATIVE_INT) < 0)
goto error;
- if(H5Tclose(array_dt) < 0)
+ if (H5Tclose(array_dt) < 0)
goto error;
/*
* Create a new dataset within the file using cparms
* creation properties.
*/
- if((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
goto error;
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/* Initialize data for one chunk */
- for(i = n = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- (direct_buf[i][j]).a = i*j+0;
- (direct_buf[i][j]).b = i*j+1;
- (direct_buf[i][j]).c[0] = i*j+2;
- (direct_buf[i][j]).c[1] = i*j+3;
- (direct_buf[i][j]).c[2] = i*j+4;
- (direct_buf[i][j]).c[3] = i*j+5;
- (direct_buf[i][j]).d = i*j+6;
- (direct_buf[i][j]).e = i*j+7;
+ for (i = n = 0; i < CHUNK_NX; i++) {
+ for (j = 0; j < CHUNK_NY; j++) {
+ (direct_buf[i][j]).a = i * j + 0;
+ (direct_buf[i][j]).b = i * j + 1;
+ (direct_buf[i][j]).c[0] = i * j + 2;
+ (direct_buf[i][j]).c[1] = i * j + 3;
+ (direct_buf[i][j]).c[2] = i * j + 4;
+ (direct_buf[i][j]).c[3] = i * j + 5;
+ (direct_buf[i][j]).d = i * j + 6;
+ (direct_buf[i][j]).e = i * j + 7;
}
}
@@ -1035,43 +1056,45 @@ test_data_conv(hid_t file)
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
- if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
+ if ((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
goto error;
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
- if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0)
goto error;
/* Use H5Dread_chunk() to read the uncompressed data */
- if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, read_chunk)) < 0)
+ if ((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, read_chunk)) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if ((direct_buf[i][j]).a != (read_chunk[i][j]).a ||
- (direct_buf[i][j]).b != (read_chunk[i][j]).b ||
+ for (i = 0; i < CHUNK_NX; i++) {
+ for (j = 0; j < CHUNK_NY; j++) {
+ if ((direct_buf[i][j]).a != (read_chunk[i][j]).a ||
+ (direct_buf[i][j]).b != (read_chunk[i][j]).b ||
(direct_buf[i][j]).c[0] != (read_chunk[i][j]).c[0] ||
(direct_buf[i][j]).c[1] != (read_chunk[i][j]).c[1] ||
(direct_buf[i][j]).c[2] != (read_chunk[i][j]).c[2] ||
(direct_buf[i][j]).c[3] != (read_chunk[i][j]).c[3] ||
- (direct_buf[i][j]).d != (read_chunk[i][j]).d ||
- (direct_buf[i][j]).e != (read_chunk[i][j]).e) {
- HDprintf(" 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
- (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e);
- HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1],
- (read_chunk[i][j]).c[2], (read_chunk[i][j]).c[3], (read_chunk[i][j]).d, (read_chunk[i][j]).e);
-
- goto error;
+ (direct_buf[i][j]).d != (read_chunk[i][j]).d ||
+ (direct_buf[i][j]).e != (read_chunk[i][j]).e) {
+ HDprintf(" 1. Read different values than written.");
+ HDprintf(" At index %d,%d\n", i, j);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", (direct_buf[i][j]).a,
+ (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
+ (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d,
+ (direct_buf[i][j]).e);
+ HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", (read_chunk[i][j]).a,
+ (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1],
+ (read_chunk[i][j]).c[2], (read_chunk[i][j]).c[3], (read_chunk[i][j]).d,
+ (read_chunk[i][j]).e);
+
+ goto error;
}
}
}
@@ -1079,36 +1102,41 @@ test_data_conv(hid_t file)
/*
* Select hyperslab for the chunk just written in the file
*/
- start[0] = CHUNK_NX; start[1] = CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ start[0] = CHUNK_NX;
+ start[1] = CHUNK_NY;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
+ if ((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
goto error;
/* Read the chunk back. Data should be converted */
- if((status = H5Dread(dataset, dt, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
+ if ((status = H5Dread(dataset, dt, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if ((direct_buf[i][j]).a != (check_chunk[i][j]).a ||
+ for (i = 0; i < CHUNK_NX; i++) {
+ for (j = 0; j < CHUNK_NY; j++) {
+ if ((direct_buf[i][j]).a != (check_chunk[i][j]).a ||
(direct_buf[i][j]).c[0] != (check_chunk[i][j]).c[0] ||
(direct_buf[i][j]).c[1] != (check_chunk[i][j]).c[1] ||
(direct_buf[i][j]).c[2] != (check_chunk[i][j]).c[2] ||
(direct_buf[i][j]).c[3] != (check_chunk[i][j]).c[3] ||
- (direct_buf[i][j]).e != (check_chunk[i][j]).e) {
- HDprintf(" 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
- (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e);
- HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
- (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2],
- (check_chunk[i][j]).c[3], (check_chunk[i][j]).e);
-
- goto error;
+ (direct_buf[i][j]).e != (check_chunk[i][j]).e) {
+ HDprintf(" 1. Read different values than written.");
+ HDprintf(" At index %d,%d\n", i, j);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", (direct_buf[i][j]).a,
+ (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
+ (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d,
+ (direct_buf[i][j]).e);
+ HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", (check_chunk[i][j]).a,
+ (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2],
+ (check_chunk[i][j]).c[3], (check_chunk[i][j]).e);
+
+ goto error;
}
}
}
@@ -1128,7 +1156,8 @@ test_data_conv(hid_t file)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
@@ -1136,7 +1165,8 @@ error:
H5Pclose(dxpl);
H5Tclose(st);
H5Tclose(dt);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -1158,52 +1188,52 @@ error:
static int
test_invalid_parameters(hid_t file)
{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int i, j, n;
-
- unsigned filter_mask = 0;
- int direct_buf[CHUNK_NX][CHUNK_NY];
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- int aggression = 9; /* Compression aggression setting */
-
- hsize_t chunk_nbytes; /* Chunk size */
+ hid_t dataspace = -1, dataset = -1;
+ hid_t mem_space = -1;
+ hid_t cparms = -1, dxpl = -1;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
+ herr_t status;
+ int i, j, n;
+
+ unsigned filter_mask = 0;
+ int direct_buf[CHUNK_NX][CHUNK_NY];
+ hsize_t offset[2] = {0, 0};
+ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
+ int aggression = 9; /* Compression aggression setting */
+
+ hsize_t chunk_nbytes; /* Chunk size */
TESTING("invalid parameters for H5Dwrite_chunk/H5Dread_chunk");
/*
* Create the data space with unlimited dimensions.
*/
- if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
goto error;
/*
* Modify dataset creation properties
*/
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/*
* Create a new contiguous dataset to verify H5Dwrite_chunk/H5Dread_chunk doesn't work
*/
- if((dataset = H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
goto error;
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/* Initialize data for one chunk */
- for(i = n = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++) {
+ for (i = n = 0; i < CHUNK_NX; i++)
+ for (j = 0; j < CHUNK_NY; j++) {
direct_buf[i][j] = n++;
}
@@ -1211,123 +1241,154 @@ test_invalid_parameters(hid_t file)
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
- H5E_BEGIN_TRY {
- if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Try to get chunk size for a contiguous dataset. It should fail */
- H5E_BEGIN_TRY {
- if((status = H5Dget_chunk_storage_size(dataset, offset, &chunk_nbytes)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dget_chunk_storage_size(dataset, offset, &chunk_nbytes)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Try to H5Dread_chunk from the contiguous dataset. It should fail */
- H5E_BEGIN_TRY {
- if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
-
/* Create a chunked dataset with compression filter */
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
+ if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
goto error;
- if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0)
+ if ((status = H5Pset_deflate(cparms, (unsigned)aggression)) < 0)
goto error;
/*
* Create a new dataset within the file using cparms
* creation properties.
*/
- if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
goto error;
/* Check invalid dataset ID for H5Dwrite_chunk and H5Dread_chunk */
- H5E_BEGIN_TRY {
- if((status = H5Dwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- H5E_BEGIN_TRY {
- if((status = H5Dread_chunk((hid_t)-1, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dread_chunk((hid_t)-1, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Check invalid DXPL ID for H5Dwrite_chunk and H5Dread_chunk */
- H5E_BEGIN_TRY {
- if((status = H5Dwrite_chunk(dataset, (hid_t)-1, filter_mask, offset, buf_size, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dwrite_chunk(dataset, (hid_t)-1, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- H5E_BEGIN_TRY {
- if((status = H5Dread_chunk(dataset, (hid_t)-1, offset, &filter_mask, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dread_chunk(dataset, (hid_t)-1, offset, &filter_mask, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Check invalid OFFSET for H5Dwrite_chunk and H5Dread_chunk */
- H5E_BEGIN_TRY {
- if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, NULL, buf_size, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, NULL, buf_size, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- H5E_BEGIN_TRY {
- if((status = H5Dread_chunk(dataset, dxpl, NULL, &filter_mask, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dread_chunk(dataset, dxpl, NULL, &filter_mask, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Check when OFFSET is out of dataset range for H5Dwrite_chunk and H5Dread_chunk */
offset[0] = NX + 1;
offset[1] = NY;
- H5E_BEGIN_TRY {
- if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- H5E_BEGIN_TRY {
- if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Check when OFFSET is not on chunk boundary for H5Dwrite_chunk and H5Dread_chunk */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY + 1;
- H5E_BEGIN_TRY {
- if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- H5E_BEGIN_TRY {
- if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Check invalid buffer size for H5Dwrite_chunk only */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
- buf_size = 0;
- H5E_BEGIN_TRY {
- if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
+ buf_size = 0;
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Check invalid data buffer for H5Dwrite_chunk and H5Dread_chunk */
- buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- H5E_BEGIN_TRY {
- if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, NULL)) != FAIL)
+ buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, NULL)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- H5E_BEGIN_TRY {
- if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, NULL)) != FAIL)
+ H5E_BEGIN_TRY
+ {
+ if ((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, NULL)) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
/*
@@ -1342,13 +1403,15 @@ test_invalid_parameters(hid_t file)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -1370,31 +1433,31 @@ error:
*/
#ifdef H5_HAVE_FILTER_DEFLATE
static int
-test_direct_chunk_read_no_cache (hid_t file)
+test_direct_chunk_read_no_cache(hid_t file)
{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1, dapl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
- herr_t status; /* status from H5 function calls */
- int ret; /* deflate return status */
- int data[NX][NY];
- int i, j, k, l, n; /* local index variables */
-
- unsigned filter_mask = 0; /* filter mask returned from H5Dread_chunk */
- int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread and manually decompressed */
- int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */
- hsize_t offset[2]; /* chunk offset used for H5Dread_chunk */
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
-
- Bytef *z_src = NULL; /* source buffer */
- uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- Bytef *z_dst = (Bytef*)(direct_buf);
- uLong z_dst_nbytes = (uLong)buf_size;
- int aggression = 9; /* Compression aggression setting */
- void *outbuf = NULL; /* Pointer to new buffer */
+ hid_t dataspace = -1, dataset = -1;
+ hid_t mem_space = -1;
+ hid_t cparms = -1, dxpl = -1, dapl = -1;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
+ herr_t status; /* status from H5 function calls */
+ int ret; /* deflate return status */
+ int data[NX][NY];
+ int i, j, k, l, n; /* local index variables */
+
+ unsigned filter_mask = 0; /* filter mask returned from H5Dread_chunk */
+ int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread and manually decompressed */
+ int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */
+ hsize_t offset[2]; /* chunk offset used for H5Dread_chunk */
+ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
+
+ Bytef *z_src = NULL; /* source buffer */
+ uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
+ Bytef *z_dst = (Bytef *)(direct_buf);
+ uLong z_dst_nbytes = (uLong)buf_size;
+ int aggression = 9; /* Compression aggression setting */
+ void * outbuf = NULL; /* Pointer to new buffer */
hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
@@ -1404,96 +1467,104 @@ test_direct_chunk_read_no_cache (hid_t file)
TESTING("basic functionality of H5Dread_chunk (chunk cache disabled)");
/* Create the data space with unlimited dimensions. */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
goto error;
/* Modify dataset creation properties, i.e. enable chunking and compression */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
+ if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
goto error;
- if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0)
+ if ((status = H5Pset_deflate(cparms, (unsigned)aggression)) < 0)
goto error;
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
goto error;
/* Disable chunk cache by setting number of slots to 0 */
- if((status = H5Pset_chunk_cache(dapl, 0, H5D_CHUNK_CACHE_NBYTES_DEFAULT, H5D_CHUNK_CACHE_W0_DEFAULT)) < 0)
+ if ((status = H5Pset_chunk_cache(dapl, 0, H5D_CHUNK_CACHE_NBYTES_DEFAULT, H5D_CHUNK_CACHE_W0_DEFAULT)) <
+ 0)
goto error;
/* Create a new dataset within the file using cparms creation properties. */
- if((dataset = H5Dcreate2(file, DATASETNAME8, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, dapl)) < 0)
+ if ((dataset = H5Dcreate2(file, DATASETNAME8, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, dapl)) < 0)
goto error;
/* Initialize the dataset */
- for(i = n = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
+ for (i = n = 0; i < NX; i++)
+ for (j = 0; j < NY; j++)
data[i][j] = n++;
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/* Write the data for the dataset.
* Data will skip chunk cache and go directly to disk. */
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
+ if ((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, data)) < 0)
goto error;
/* Allocate output (compressed) buffer */
outbuf = HDmalloc(z_src_nbytes);
- z_src = (Bytef *)outbuf;
+ z_src = (Bytef *)outbuf;
/* For each chunk in the dataset, compare the result of H5Dread and H5Dread_chunk. */
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
+ for (i = 0; i < NX / CHUNK_NX; i++) {
+ for (j = 0; j < NY / CHUNK_NY; j++) {
/* Select hyperslab for one chunk in the file */
- start[0] = (hsize_t)i * CHUNK_NX; start[1] = (hsize_t)j * CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
+ start[0] = (hsize_t)i * CHUNK_NX;
+ start[1] = (hsize_t)j * CHUNK_NY;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
/* Hyperslab selection equals single chunk */
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ if ((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
goto error;
/* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
+ if ((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) <
+ 0)
goto error;
- offset[0] = (hsize_t)i * CHUNK_NX; offset[1] = (hsize_t)j * CHUNK_NY;
+ offset[0] = (hsize_t)i * CHUNK_NX;
+ offset[1] = (hsize_t)j * CHUNK_NY;
/* Read the compressed chunk back using the direct read function. */
- if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, outbuf)) < 0)
+ if ((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, outbuf)) < 0)
goto error;
/* Check filter mask return value */
- if(filter_mask != 0)
+ if (filter_mask != 0)
goto error;
/* Perform decompression from the source to the destination buffer */
ret = uncompress(z_dst, &z_dst_nbytes, z_src, z_src_nbytes);
/* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
+ if (Z_BUF_ERROR == ret) {
HDfprintf(stderr, "overflow\n");
goto error;
- } else if(Z_MEM_ERROR == ret) {
+ }
+ else if (Z_MEM_ERROR == ret) {
HDfprintf(stderr, "deflate memory error\n");
goto error;
- } else if(Z_DATA_ERROR == ret) {
+ }
+ else if (Z_DATA_ERROR == ret) {
HDfprintf(stderr, "corrupted data\n");
goto error;
- } else if(Z_OK != ret) {
+ }
+ else if (Z_OK != ret) {
HDfprintf(stderr, "other deflate error\n");
goto error;
}
/* Check that the decompressed values match those read from H5Dread */
- for(k = 0; k < CHUNK_NX; k++) {
- for(l = 0; l < CHUNK_NY; l++) {
- if(direct_buf[k][l] != check_chunk[k][l]) {
+ for (k = 0; k < CHUNK_NX; k++) {
+ for (l = 0; l < CHUNK_NY; l++) {
+ if (direct_buf[k][l] != check_chunk[k][l]) {
HDprintf("\n 1. Read different values than written.");
HDprintf(" At index %d,%d\n", k, l);
HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[k][l], check_chunk[k][l]);
@@ -1512,23 +1583,25 @@ test_direct_chunk_read_no_cache (hid_t file)
H5Pclose(dxpl);
H5Pclose(dapl);
- if(outbuf)
+ if (outbuf)
HDfree(outbuf);
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
H5Pclose(dapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(outbuf)
+ if (outbuf)
HDfree(outbuf);
H5_FAILED();
@@ -1538,142 +1611,151 @@ error:
#ifdef H5_HAVE_FILTER_DEFLATE
static int
-test_direct_chunk_read_cache (hid_t file, hbool_t flush)
+test_direct_chunk_read_cache(hid_t file, hbool_t flush)
{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
- herr_t status; /* status from H5 function calls */
- int ret; /* deflate return status */
- int data[NX][NY];
- int i, j, k, l, n; /* local index variables */
-
- unsigned filter_mask = 0; /* filter mask returned from H5Dread_chunk */
- int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread and manually decompressed */
- int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */
- hsize_t offset[2]; /* chunk offset used for H5Dread_chunk */
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
-
- Bytef *z_src = NULL; /* source buffer */
- uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- Bytef *z_dst = (Bytef*)(direct_buf);
- uLong z_dst_nbytes = (uLong)buf_size;
- int aggression = 9; /* Compression aggression setting */
- void *outbuf = NULL; /* Pointer to new buffer */
- hsize_t read_buf_size = 0;
+ hid_t dataspace = -1, dataset = -1;
+ hid_t mem_space = -1;
+ hid_t cparms = -1, dxpl = -1;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
+ herr_t status; /* status from H5 function calls */
+ int ret; /* deflate return status */
+ int data[NX][NY];
+ int i, j, k, l, n; /* local index variables */
+
+ unsigned filter_mask = 0; /* filter mask returned from H5Dread_chunk */
+ int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread and manually decompressed */
+ int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */
+ hsize_t offset[2]; /* chunk offset used for H5Dread_chunk */
+ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
+
+ Bytef * z_src = NULL; /* source buffer */
+ uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
+ Bytef * z_dst = (Bytef *)(direct_buf);
+ uLong z_dst_nbytes = (uLong)buf_size;
+ int aggression = 9; /* Compression aggression setting */
+ void * outbuf = NULL; /* Pointer to new buffer */
+ hsize_t read_buf_size = 0;
hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
hsize_t count[2]; /* Block count */
hsize_t block[2]; /* Block sizes */
- if(flush) {
+ if (flush) {
TESTING("basic functionality of H5Dread_chunk (flush chunk cache)");
- } else {
+ }
+ else {
TESTING("basic functionality of H5Dread_chunk (does not flush chunk cache)");
}
/* Create the data space with unlimited dimensions. */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
goto error;
/* Modify dataset creation properties, i.e. enable chunking and compression */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
+ if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
goto error;
- if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0)
+ if ((status = H5Pset_deflate(cparms, (unsigned)aggression)) < 0)
goto error;
/* Create a new dataset within the file using cparms creation properties. */
- if((dataset = H5Dcreate2(file, flush?DATASETNAME9:DATASETNAME10, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, flush ? DATASETNAME9 : DATASETNAME10, H5T_NATIVE_INT, dataspace,
+ H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
goto error;
/* Initialize the dataset */
- for(i = n = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
+ for (i = n = 0; i < NX; i++)
+ for (j = 0; j < NY; j++)
data[i][j] = n++;
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/* Write the data for the dataset.
* It should stay in the chunk cache. */
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
+ if ((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, data)) < 0)
goto error;
- if(flush) {
+ if (flush) {
/* Flush the chunk cache to disk. Cache entry is not evicted. */
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
}
/* Allocate output (compressed) buffer */
outbuf = HDmalloc(z_src_nbytes);
- z_src = (Bytef *)outbuf;
+ z_src = (Bytef *)outbuf;
/* For each chunk in the dataset, compare the result of H5Dread and H5Dread_chunk. */
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
+ for (i = 0; i < NX / CHUNK_NX; i++) {
+ for (j = 0; j < NY / CHUNK_NY; j++) {
/* Select hyperslab for one chunk in the file */
- start[0] = (hsize_t)i * CHUNK_NX; start[1] = (hsize_t)j * CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
+ start[0] = (hsize_t)i * CHUNK_NX;
+ start[1] = (hsize_t)j * CHUNK_NY;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
/* Hyperslab selection equals single chunk */
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ if ((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
goto error;
/* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
+ if ((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) <
+ 0)
goto error;
- offset[0] = (hsize_t)i * CHUNK_NX; offset[1] = (hsize_t)j * CHUNK_NY;
+ offset[0] = (hsize_t)i * CHUNK_NX;
+ offset[1] = (hsize_t)j * CHUNK_NY;
/* Query chunk storage size */
- if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
+ if ((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
goto error;
- if(read_buf_size == 0)
+ if (read_buf_size == 0)
goto error;
/* Read the compressed chunk back using the direct read function. */
- if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, outbuf)) < 0)
+ if ((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, outbuf)) < 0)
goto error;
/* Check filter mask return value */
- if(filter_mask != 0)
+ if (filter_mask != 0)
goto error;
/* Perform decompression from the source to the destination buffer */
ret = uncompress(z_dst, &z_dst_nbytes, z_src, z_src_nbytes);
/* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
+ if (Z_BUF_ERROR == ret) {
HDfprintf(stderr, "overflow\n");
goto error;
- } else if(Z_MEM_ERROR == ret) {
+ }
+ else if (Z_MEM_ERROR == ret) {
HDfprintf(stderr, "deflate memory error\n");
goto error;
- } else if(Z_DATA_ERROR == ret) {
+ }
+ else if (Z_DATA_ERROR == ret) {
HDfprintf(stderr, "corrupted data\n");
goto error;
- } else if(Z_OK != ret) {
+ }
+ else if (Z_OK != ret) {
HDfprintf(stderr, "other deflate error\n");
goto error;
}
/* Check that the decompressed values match those read from H5Dread */
- for(k = 0; k < CHUNK_NX; k++) {
- for(l = 0; l < CHUNK_NY; l++) {
- if(direct_buf[k][l] != check_chunk[k][l]) {
+ for (k = 0; k < CHUNK_NX; k++) {
+ for (l = 0; l < CHUNK_NY; l++) {
+ if (direct_buf[k][l] != check_chunk[k][l]) {
HDprintf("\n 1. Read different values than written.");
HDprintf(" At index %d,%d\n", k, l);
HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[k][l], check_chunk[k][l]);
@@ -1691,22 +1773,24 @@ test_direct_chunk_read_cache (hid_t file, hbool_t flush)
H5Pclose(cparms);
H5Pclose(dxpl);
- if(outbuf)
+ if (outbuf)
HDfree(outbuf);
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(outbuf)
+ if (outbuf)
HDfree(outbuf);
H5_FAILED();
@@ -1731,22 +1815,22 @@ error:
static int
test_read_unfiltered_dset(hid_t file)
{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int data[NX][NY];
- int i, j, k, l, n;
-
- unsigned filter_mask = 0;
- int direct_buf[CHUNK_NX][CHUNK_NY];
- int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- hsize_t read_buf_size = 0;
+ hid_t dataspace = -1, dataset = -1;
+ hid_t mem_space = -1;
+ hid_t cparms = -1, dxpl = -1;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
+ herr_t status;
+ int data[NX][NY];
+ int i, j, k, l, n;
+
+ unsigned filter_mask = 0;
+ int direct_buf[CHUNK_NX][CHUNK_NY];
+ int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */
+ hsize_t offset[2] = {0, 0};
+ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int);
+ hsize_t read_buf_size = 0;
hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
@@ -1756,79 +1840,84 @@ test_read_unfiltered_dset(hid_t file)
TESTING("basic functionality of H5Dread_chunk on unfiltered datasets");
/* Create the data space with unlimited dimensions. */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
goto error;
/* Modify dataset creation properties, i.e. enable chunking, no compression */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
+ if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
goto error;
/* Create a new dataset within the file using cparms creation properties. */
- if((dataset = H5Dcreate2(file, DATASETNAME12, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DATASETNAME12, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT)) < 0)
goto error;
/* Initialize the dataset */
- for(i = n = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
+ for (i = n = 0; i < NX; i++)
+ for (j = 0; j < NY; j++)
data[i][j] = n++;
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/* Write the data for the dataset.
* It should stay in the chunk cache and will be evicted/flushed by
* the H5Dread_chunk function call. */
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
+ if ((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, data)) < 0)
goto error;
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
/* For each chunk in the dataset, compare the result of H5Dread and H5Dread_chunk. */
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
+ for (i = 0; i < NX / CHUNK_NX; i++) {
+ for (j = 0; j < NY / CHUNK_NY; j++) {
/* Select hyperslab for one chunk in the file */
- start[0] = (hsize_t)i * CHUNK_NX; start[1] = (hsize_t)j * CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
+ start[0] = (hsize_t)i * CHUNK_NX;
+ start[1] = (hsize_t)j * CHUNK_NY;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
/* Hyperslab selection equals single chunk */
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ if ((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
goto error;
/* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
+ if ((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) <
+ 0)
goto error;
/* Query chunk storage size */
- if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
+ if ((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
goto error;
- if(read_buf_size != buf_size )
+ if (read_buf_size != buf_size)
goto error;
- offset[0] = (hsize_t)i * CHUNK_NX; offset[1] = (hsize_t)j * CHUNK_NY;
+ offset[0] = (hsize_t)i * CHUNK_NX;
+ offset[1] = (hsize_t)j * CHUNK_NY;
/* Read the raw chunk back */
HDmemset(&direct_buf, 0, sizeof(direct_buf));
filter_mask = UINT_MAX;
- if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) < 0)
+ if ((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) < 0)
goto error;
/* Check filter mask return value */
- if(filter_mask != 0)
+ if (filter_mask != 0)
goto error;
/* Check that the decompressed values match those read from H5Dread */
- for(k = 0; k < CHUNK_NX; k++) {
- for(l = 0; l < CHUNK_NY; l++) {
- if(direct_buf[k][l] != check_chunk[k][l]) {
+ for (k = 0; k < CHUNK_NX; k++) {
+ for (l = 0; l < CHUNK_NY; l++) {
+ if (direct_buf[k][l] != check_chunk[k][l]) {
HDprintf("\n 1. Read different values than written.");
HDprintf(" At index %d,%d\n", k, l);
HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[k][l], check_chunk[k][l]);
@@ -1850,13 +1939,15 @@ test_read_unfiltered_dset(hid_t file)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -1878,82 +1969,80 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_read_unallocated_chunk (hid_t file)
+test_read_unallocated_chunk(hid_t file)
{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
- hsize_t chunk_nbytes = CHUNK_NX*CHUNK_NY*sizeof(int);
- hsize_t direct_chunk_nbytes = 0; /* size (bytes) of the on-disk chunk */
- herr_t status; /* status from H5 function calls */
- hsize_t i, j; /* local index variables */
-
- unsigned filter_mask = 0; /* filter mask returned from H5Dread_chunk */
- int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread and manually decompressed */
- hsize_t offset[2]; /* chunk offset used for H5Dread_chunk */
+ hid_t dataspace = -1, dataset = -1;
+ hid_t mem_space = -1;
+ hid_t cparms = -1, dxpl = -1;
+ hsize_t dims[2] = {NX, NY};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
+ hsize_t chunk_nbytes = CHUNK_NX * CHUNK_NY * sizeof(int);
+ hsize_t direct_chunk_nbytes = 0; /* size (bytes) of the on-disk chunk */
+ herr_t status; /* status from H5 function calls */
+ hsize_t i, j; /* local index variables */
+
+ unsigned filter_mask = 0; /* filter mask returned from H5Dread_chunk */
+ int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread and manually decompressed */
+ hsize_t offset[2]; /* chunk offset used for H5Dread_chunk */
TESTING("H5Dread_chunk with unallocated chunks");
/* Create the data space with unlimited dimensions. */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
goto error;
/* Modify dataset creation properties, i.e. enable chunking, no compression */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
+ if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0)
goto error;
/* Create a new dataset within the file using cparms creation properties. */
- if((dataset = H5Dcreate2(file, DATASETNAME11, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DATASETNAME11, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT)) < 0)
goto error;
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/* Write a single chunk to intialize the chunk storage */
HDmemset(direct_buf, 0, CHUNK_NX * CHUNK_NY * sizeof(int));
- offset[0] = 0; offset[1] = 0;
+ offset[0] = 0;
+ offset[1] = 0;
- if(H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, direct_buf) < 0)
+ if (H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, direct_buf) < 0)
goto error;
/* Attempt to read each chunk in the dataset. Chunks are not allocated,
* therefore we expect the result of H5Dread_chunk to fail. Chunk idx starts
* at 1, since one chunk was written to init the chunk storage. */
- for(i=1; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
+ for (i = 1; i < NX / CHUNK_NX; i++) {
+ for (j = 0; j < NY / CHUNK_NY; j++) {
offset[0] = i * CHUNK_NX;
offset[1] = j * CHUNK_NY;
/* Read a non-existant chunk using the direct read function. */
- H5E_BEGIN_TRY {
- status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, &direct_buf);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, &direct_buf); }
+ H5E_END_TRY;
/* Check that the chunk read call does not succeed. */
- if(status != -1)
+ if (status != -1)
goto error;
/* Query the size of the non-existant chunk */
direct_chunk_nbytes = ULONG_MAX;
- H5E_BEGIN_TRY {
- status = H5Dget_chunk_storage_size(dataset, offset, &direct_chunk_nbytes);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { status = H5Dget_chunk_storage_size(dataset, offset, &direct_chunk_nbytes); }
+ H5E_END_TRY;
/* Check that the chunk storage size call does not succeed. */
- if(status != -1 )
+ if (status != -1)
goto error;
- if(direct_chunk_nbytes != 0 )
+ if (direct_chunk_nbytes != 0)
goto error;
-
}
}
@@ -1968,13 +2057,15 @@ test_read_unallocated_chunk (hid_t file)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -2008,106 +2099,106 @@ error:
static int
test_single_chunk(unsigned config)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t fapl = H5I_INVALID_HID; /* File access property list ID */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
- hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */
- hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */
- hsize_t offset[2] = {0,0}; /* Offset for writing */
- uint32_t filters; /* Filter mask out */
- int wdata[DIM0][DIM1]; /* Write buffer */
- int rdata[DIM0][DIM1]; /* Read buffer */
- int i, j; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+ hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */
+ hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */
+ hsize_t offset[2] = {0, 0}; /* Offset for writing */
+ uint32_t filters; /* Filter mask out */
+ int wdata[DIM0][DIM1]; /* Write buffer */
+ int rdata[DIM0][DIM1]; /* Read buffer */
+ int i, j; /* Local index variable */
TESTING("Single chunk I/O");
/* Initialize data */
- for (i=0; i<DIM0; i++) {
- for (j=0; j< DIM1; j++)
- wdata[i][j] = j/CHUNK0;
+ for (i = 0; i < DIM0; i++) {
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = j / CHUNK0;
}
/* Create a new file with the latest format */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
- if(config & CONFIG_LATEST)
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (config & CONFIG_LATEST)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
- if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
/* Create dataspace */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
goto error;
/* Create the dataset creation property list and set the chunk size */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl, 2, chunk) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk) < 0)
goto error;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if(config & CONFIG_DIRECT_WRITE) {
+ if (config & CONFIG_DIRECT_WRITE) {
/* Write the data directly to the dataset */
- if(H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0*CHUNK1*4, (void *)wdata) < 0)
+ if (H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0 * CHUNK1 * 4, (void *)wdata) < 0)
goto error;
} /* end if */
else
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0)
- goto error;
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0)
+ goto error;
/*
* Close and release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(config & CONFIG_REOPEN_DSET)
- if(H5Dclose(did) < 0)
+ if (config & CONFIG_REOPEN_DSET)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
goto error;
- if(config & CONFIG_REOPEN_FILE)
- if(H5Fclose(fid) < 0)
+ if (config & CONFIG_REOPEN_FILE)
+ if (H5Fclose(fid) < 0)
goto error;
/* Open the file and dataset with default properties */
- if(config & CONFIG_REOPEN_FILE)
- if((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if (config & CONFIG_REOPEN_FILE)
+ if ((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
goto error;
- if(config & CONFIG_REOPEN_DSET)
- if((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
+ if (config & CONFIG_REOPEN_DSET)
+ if ((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
goto error;
/* Retrieve dataset creation property list */
- if((dcpl = H5Dget_create_plist(did)) < 0)
+ if ((dcpl = H5Dget_create_plist(did)) < 0)
goto error;
- if(config & CONFIG_DIRECT_READ) {
+ if (config & CONFIG_DIRECT_READ) {
/* Read the data directly */
- if(H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0)
+ if (H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0)
goto error;
/* Verify returned filter mask */
- if(filters != 0)
+ if (filters != 0)
goto error;
} /* end if */
else
/* Read the data */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
- goto error;
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
+ goto error;
/* Verify that the data read was correct. */
for (i = 0; i < DIM0; i++) {
for (j = 0; j < DIM1; j++) {
- if(rdata[i][j] != wdata[i][j])
+ if (rdata[i][j] != wdata[i][j])
goto error;
}
}
@@ -2115,24 +2206,26 @@ test_single_chunk(unsigned config)
/*
* Close and release resources
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
H5Pclose(dcpl);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -2152,19 +2245,20 @@ error:
*
*-------------------------------------------------------------------------
*/
-int main( void )
+int
+main(void)
{
- hid_t file_id;
+ hid_t file_id;
unsigned config;
- int nerrors=0;
+ int nerrors = 0;
/*
* Create a new file. If file exists its contents will be overwritten.
*/
- if((file_id = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((file_id = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- /* Test direct chunk write and direct chunk read */
+ /* Test direct chunk write and direct chunk read */
#ifdef H5_HAVE_FILTER_DEFLATE
nerrors += test_direct_chunk_write(file_id);
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -2184,43 +2278,43 @@ int main( void )
nerrors += test_read_unallocated_chunk(file_id);
/* Loop over test configurations */
- for(config = 0; config < CONFIG_END; config++) {
+ for (config = 0; config < CONFIG_END; config++) {
hbool_t need_comma = FALSE;
/* Check for invalid combinations */
- if((config & CONFIG_REOPEN_FILE) && !(config & CONFIG_REOPEN_DSET))
+ if ((config & CONFIG_REOPEN_FILE) && !(config & CONFIG_REOPEN_DSET))
continue;
/* Print configuration */
HDprintf("Configuration: ");
- if(config == 0)
+ if (config == 0)
HDprintf("<empty>");
- if(config & CONFIG_LATEST) {
- if(need_comma)
+ if (config & CONFIG_LATEST) {
+ if (need_comma)
HDprintf(", ");
HDprintf("latest format");
need_comma = TRUE;
} /* end if */
- if(config & CONFIG_REOPEN_FILE) {
- if(need_comma)
+ if (config & CONFIG_REOPEN_FILE) {
+ if (need_comma)
HDprintf(", ");
HDprintf("reopen file");
need_comma = TRUE;
} /* end if */
- else if(config & CONFIG_REOPEN_DSET) {
- if(need_comma)
+ else if (config & CONFIG_REOPEN_DSET) {
+ if (need_comma)
HDprintf(", ");
HDprintf("reopen dataset");
need_comma = TRUE;
} /* end if */
- if(config & CONFIG_DIRECT_WRITE) {
- if(need_comma)
+ if (config & CONFIG_DIRECT_WRITE) {
+ if (need_comma)
HDprintf(", ");
HDprintf("direct write");
need_comma = TRUE;
} /* end if */
- if(config & CONFIG_DIRECT_READ) {
- if(need_comma)
+ if (config & CONFIG_DIRECT_READ) {
+ if (need_comma)
HDprintf(", ");
HDprintf("direct read");
need_comma = TRUE;
@@ -2231,7 +2325,7 @@ int main( void )
nerrors += test_single_chunk(config);
} /* end for */
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
goto error;
/* check for errors */
@@ -2245,4 +2339,3 @@ error:
HDputs("*** TESTS FAILED ***");
return EXIT_FAILURE;
}
-
diff --git a/test/dsets.c b/test/dsets.c
index c06ac97..8a4332d 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -17,119 +17,117 @@
*
* Purpose: Tests the dataset interface (H5D)
*/
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
#define H5D_TESTING
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
-#define H5Z_FRIEND /*suppress error about including H5Zpkg */
+#define H5Z_FRIEND /*suppress error about including H5Zpkg */
#include "testhdf5.h"
#include "H5srcdir.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Iprivate.h"
#include "H5Pprivate.h"
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
-#define H5S_FRIEND /*suppress error about including H5Spkg */
-#include "H5Spkg.h" /* Dataspace */
+#define H5S_FRIEND /*suppress error about including H5Spkg */
+#include "H5Spkg.h" /* Dataspace */
-#define H5T_FRIEND /*suppress error about including H5Tpkg */
-#include "H5Tpkg.h" /* Datatype */
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#include "H5Tpkg.h" /* Datatype */
-#define H5A_FRIEND /*suppress error about including H5Apkg */
-#include "H5Apkg.h" /* Attributes */
+#define H5A_FRIEND /*suppress error about including H5Apkg */
+#include "H5Apkg.h" /* Attributes */
/* Use in version bound test */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
-#include "H5Opkg.h" /* Object headers */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#include "H5Opkg.h" /* Object headers */
#include "H5Dpkg.h"
#include "H5FDpkg.h"
#include "H5VMprivate.h"
#include "H5Zpkg.h"
#ifdef H5_HAVE_SZLIB_H
-# include "szlib.h"
+#include "szlib.h"
#endif
-const char *FILENAME[] = {
- "dataset", /* 0 */
- "compact_dataset", /* 1 */
- "dset_offset", /* 2 */
- "max_compact_dataset", /* 3 */
- "simple", /* 4 */
- "set_local", /* 5 */
- "random_chunks", /* 6 */
- "huge_chunks", /* 7 */
- "chunk_cache", /* 8 */
- "big_chunk", /* 9 */
- "chunk_fast", /* 10 */
- "chunk_expand", /* 11 */
- "chunk_fixed", /* 12 */
- "copy_dcpl_newfile",/* 13 */
- "partial_chunks", /* 14 */
- "layout_extend", /* 15 */
- "zero_chunk", /* 16 */
- "chunk_single", /* 17 */
- "swmr_non_latest", /* 18 */
- "earray_hdr_fd", /* 19 */
- "farray_hdr_fd", /* 20 */
- "bt2_hdr_fd", /* 21 */
- "storage_size", /* 22 */
- "dls_01_strings", /* 23 */
- "power2up", /* 24 */
- "version_bounds", /* 25 */
- "alloc_0sized", /* 26 */
- NULL
-};
+const char *FILENAME[] = {"dataset", /* 0 */
+ "compact_dataset", /* 1 */
+ "dset_offset", /* 2 */
+ "max_compact_dataset", /* 3 */
+ "simple", /* 4 */
+ "set_local", /* 5 */
+ "random_chunks", /* 6 */
+ "huge_chunks", /* 7 */
+ "chunk_cache", /* 8 */
+ "big_chunk", /* 9 */
+ "chunk_fast", /* 10 */
+ "chunk_expand", /* 11 */
+ "chunk_fixed", /* 12 */
+ "copy_dcpl_newfile", /* 13 */
+ "partial_chunks", /* 14 */
+ "layout_extend", /* 15 */
+ "zero_chunk", /* 16 */
+ "chunk_single", /* 17 */
+ "swmr_non_latest", /* 18 */
+ "earray_hdr_fd", /* 19 */
+ "farray_hdr_fd", /* 20 */
+ "bt2_hdr_fd", /* 21 */
+ "storage_size", /* 22 */
+ "dls_01_strings", /* 23 */
+ "power2up", /* 24 */
+ "version_bounds", /* 25 */
+ "alloc_0sized", /* 26 */
+ NULL};
#define OHMIN_FILENAME_A "ohdr_min_a"
-#define FILENAME_BUF_SIZE 1024
-#define KB 1024
+#define FILENAME_BUF_SIZE 1024
+#define KB 1024
-#define FILE_DEFLATE_NAME "deflate.h5"
+#define FILE_DEFLATE_NAME "deflate.h5"
/* Dataset names for testing filters */
-#define DSET_DEFAULT_NAME "default"
-#define DSET_CHUNKED_NAME "chunked"
-#define DSET_COMPACT_NAME "compact"
-#define DSET_SIMPLE_IO_NAME "simple_io"
-#define DSET_USERBLOCK_IO_NAME "userblock_io"
-#define DSET_COMPACT_IO_NAME "compact_io"
-#define DSET_COMPACT_MAX_NAME "max_compact"
-#define DSET_COMPACT_MAX2_NAME "max_compact_2"
-#define DSET_CONV_BUF_NAME "conv_buf"
-#define DSET_TCONV_NAME "tconv"
-#define DSET_DEFLATE_NAME "deflate"
-#define DSET_SHUFFLE_NAME "shuffle"
-#define DSET_FLETCHER32_NAME "fletcher32"
-#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
-#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
-#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
-#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
-#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space"
-#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type"
+#define DSET_DEFAULT_NAME "default"
+#define DSET_CHUNKED_NAME "chunked"
+#define DSET_COMPACT_NAME "compact"
+#define DSET_SIMPLE_IO_NAME "simple_io"
+#define DSET_USERBLOCK_IO_NAME "userblock_io"
+#define DSET_COMPACT_IO_NAME "compact_io"
+#define DSET_COMPACT_MAX_NAME "max_compact"
+#define DSET_COMPACT_MAX2_NAME "max_compact_2"
+#define DSET_CONV_BUF_NAME "conv_buf"
+#define DSET_TCONV_NAME "tconv"
+#define DSET_DEFLATE_NAME "deflate"
+#define DSET_SHUFFLE_NAME "shuffle"
+#define DSET_FLETCHER32_NAME "fletcher32"
+#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
+#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
+#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
+#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
+#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space"
+#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type"
#ifdef H5_HAVE_FILTER_SZIP
-#define DSET_SZIP_NAME "szip"
-#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
-#define DSET_SHUF_SZIP_FLET_NAME_2 "shuffle+szip+fletcher32_2"
+#define DSET_SZIP_NAME "szip"
+#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
+#define DSET_SHUF_SZIP_FLET_NAME_2 "shuffle+szip+fletcher32_2"
#endif /* H5_HAVE_FILTER_SZIP */
-#define DSET_BOGUS_NAME "bogus"
-#define DSET_MISSING_NAME "missing"
-#define DSET_CAN_APPLY_NAME "can_apply"
-#define DSET_CAN_APPLY_NAME2 "can_apply2"
+#define DSET_BOGUS_NAME "bogus"
+#define DSET_MISSING_NAME "missing"
+#define DSET_CAN_APPLY_NAME "can_apply"
+#define DSET_CAN_APPLY_NAME2 "can_apply2"
#ifdef H5_HAVE_FILTER_SZIP
-#define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip"
+#define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip"
#endif /* H5_HAVE_FILTER_SZIP */
-#define DSET_SET_LOCAL_NAME "set_local"
-#define DSET_SET_LOCAL_NAME_2 "set_local_2"
-#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle"
+#define DSET_SET_LOCAL_NAME "set_local"
+#define DSET_SET_LOCAL_NAME_2 "set_local_2"
+#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle"
#define DSET_NBIT_INT_NAME "nbit_int"
#define DSET_NBIT_FLOAT_NAME "nbit_float"
#define DSET_NBIT_DOUBLE_NAME "nbit_double"
@@ -151,74 +149,74 @@ const char *FILENAME[] = {
#define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2"
#define COPY_DCPL_EXTFILE_NAME "ext_file"
#ifndef H5_NO_DEPRECATED_SYMBOLS
-#define DSET_DEPREC_NAME "deprecated"
-#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked"
-#define DSET_DEPREC_NAME_COMPACT "deprecated_compact"
-#define DSET_DEPREC_NAME_FILTER "deprecated_filter"
+#define DSET_DEPREC_NAME "deprecated"
+#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked"
+#define DSET_DEPREC_NAME_COMPACT "deprecated_compact"
+#define DSET_DEPREC_NAME_FILTER "deprecated_filter"
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Dataset names for testing Fixed Array Indexing */
-#define DSET_FIXED_MAX "DSET_FIXED_MAX"
-#define DSET_FIXED_NOMAX "DSET_FIXED_NOMAX"
-#define DSET_FIXED_BIG "DSET_FIXED_BIG"
-#define POINTS 72
-#define POINTS_BIG 2500
+#define DSET_FIXED_MAX "DSET_FIXED_MAX"
+#define DSET_FIXED_NOMAX "DSET_FIXED_NOMAX"
+#define DSET_FIXED_BIG "DSET_FIXED_BIG"
+#define POINTS 72
+#define POINTS_BIG 2500
/* Dataset names used for testing header flush dependencies */
-#define DSET_EARRAY_HDR_FD "earray_hdr_fd"
-#define DSET_FARRAY_HDR_FD "farray_hdr_fd"
-#define DSET_BT2_HDR_FD "bt2_hdr_fd"
+#define DSET_EARRAY_HDR_FD "earray_hdr_fd"
+#define DSET_FARRAY_HDR_FD "farray_hdr_fd"
+#define DSET_BT2_HDR_FD "bt2_hdr_fd"
/* Dataset names for testing Implicit Indexing */
-#define DSET_SINGLE_MAX "DSET_SINGLE_MAX"
-#define DSET_SINGLE_NOMAX "DSET_SINGLE_NOMAX"
+#define DSET_SINGLE_MAX "DSET_SINGLE_MAX"
+#define DSET_SINGLE_NOMAX "DSET_SINGLE_NOMAX"
-#define USER_BLOCK 1024
-#define SIXTY_FOUR_KB 65536
+#define USER_BLOCK 1024
+#define SIXTY_FOUR_KB 65536
/* Temporary filter IDs used for testing */
-#define H5Z_FILTER_BOGUS 305
-#define H5Z_FILTER_CORRUPT 306
-#define H5Z_FILTER_CAN_APPLY_TEST 307
-#define H5Z_FILTER_SET_LOCAL_TEST 308
+#define H5Z_FILTER_BOGUS 305
+#define H5Z_FILTER_CORRUPT 306
+#define H5Z_FILTER_CAN_APPLY_TEST 307
+#define H5Z_FILTER_SET_LOCAL_TEST 308
#ifndef H5_NO_DEPRECATED_SYMBOLS
-#define H5Z_FILTER_DEPREC 309
+#define H5Z_FILTER_DEPREC 309
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-#define H5Z_FILTER_EXPAND 310
-#define H5Z_FILTER_CAN_APPLY_TEST2 311
-#define H5Z_FILTER_COUNT 312
+#define H5Z_FILTER_EXPAND 310
+#define H5Z_FILTER_CAN_APPLY_TEST2 311
+#define H5Z_FILTER_COUNT 312
/* Flags for testing filters */
-#define DISABLE_FLETCHER32 0
-#define ENABLE_FLETCHER32 1
-#define DATA_CORRUPTED 1
-#define DATA_NOT_CORRUPTED 0
+#define DISABLE_FLETCHER32 0
+#define ENABLE_FLETCHER32 1
+#define DATA_CORRUPTED 1
+#define DATA_NOT_CORRUPTED 0
/* Parameters for the "set local" test */
-#define BOGUS2_PERM_NPARMS 2 /* Number of "permanent" parameters */
-#define BOGUS2_PARAM_1 13 /* (No particular meaning, just for checking value) */
-#define BOGUS2_PARAM_2 35 /* (No particular meaning, just for checking value) */
-#define BOGUS2_ALL_NPARMS 4 /* Total number of parameter = permanent + "local" parameters */
+#define BOGUS2_PERM_NPARMS 2 /* Number of "permanent" parameters */
+#define BOGUS2_PARAM_1 13 /* (No particular meaning, just for checking value) */
+#define BOGUS2_PARAM_2 35 /* (No particular meaning, just for checking value) */
+#define BOGUS2_ALL_NPARMS 4 /* Total number of parameter = permanent + "local" parameters */
/* Dimensionality for conversion buffer test */
-#define DIM1 100 /* Dim. Size of data member # 1 */
-#define DIM2 5000 /* Dim. Size of data member # 2 */
-#define DIM3 10 /* Dim. Size of data member # 3 */
+#define DIM1 100 /* Dim. Size of data member # 1 */
+#define DIM2 5000 /* Dim. Size of data member # 2 */
+#define DIM3 10 /* Dim. Size of data member # 3 */
/* Parameters for internal filter test */
-#define FILTER_CHUNK_DIM1 2
-#define FILTER_CHUNK_DIM2 25
-#define FILTER_HS_OFFSET1 7
-#define FILTER_HS_OFFSET2 30
-#define FILTER_HS_SIZE1 4
-#define FILTER_HS_SIZE2 50
+#define FILTER_CHUNK_DIM1 2
+#define FILTER_CHUNK_DIM2 25
+#define FILTER_HS_OFFSET1 7
+#define FILTER_HS_OFFSET2 30
+#define FILTER_HS_SIZE1 4
+#define FILTER_HS_SIZE2 50
/* Names for noencoder test */
#ifdef H5_HAVE_FILTER_SZIP
-#define NOENCODER_FILENAME "noencoder.h5"
-#define NOENCODER_COPY_FILENAME "noencoder.h5.copy"
-#define NOENCODER_TEST_DATASET "noencoder_tdset.h5"
-#define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5"
+#define NOENCODER_FILENAME "noencoder.h5"
+#define NOENCODER_COPY_FILENAME "noencoder.h5.copy"
+#define NOENCODER_TEST_DATASET "noencoder_tdset.h5"
+#define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5"
#define NOENCODER_SZIP_SHUFF_FLETCH_DATASET "noencoder_szip_shuffle_fletcher_dset.h5"
#endif /* H5_HAVE_FILTER_SZIP */
@@ -227,46 +225,46 @@ const char *FILENAME[] = {
#define ZERODIM_DATASET2 "zerodim2"
/* Parameters for zero-dim test */
-#define MISSING_CHUNK_DATASET "missing_chunk"
-#define MISSING_CHUNK_DATASET2 "missing_chunk2"
-#define MISSING_CHUNK_DIM 100
+#define MISSING_CHUNK_DATASET "missing_chunk"
+#define MISSING_CHUNK_DATASET2 "missing_chunk2"
+#define MISSING_CHUNK_DIM 100
/* Names for random chunks test */
-#define NPOINTS 50
+#define NPOINTS 50
/* Parameters for huge chunks test */
-#define HUGE_DATASET "Dataset"
-#define HUGE_DIM ((hsize_t)16 * 1024 * 1024 * 1024)
-#define HUGE_CHUNK_DIM ((hsize_t)2 * 1024 * 1024 * 1024)
-#define TOO_HUGE_CHUNK_DIM ((hsize_t)4 * 1024 * 1024 * 1024)
-#define HUGE_DATASET2 "Dataset2"
-#define HUGE_DIM2_0 ((hsize_t)16 * 1024)
-#define HUGE_DIM2_1 ((hsize_t)16 * 1024)
-#define HUGE_DIM2_2 ((hsize_t)16 * 1024)
-#define HUGE_CHUNK_DIM2_0 ((hsize_t)2 * 1024)
-#define HUGE_CHUNK_DIM2_1 ((hsize_t)1024)
-#define HUGE_CHUNK_DIM2_2 ((hsize_t)1024)
-#define TOO_HUGE_CHUNK_DIM2_0 ((hsize_t)4 * 1024)
-#define TOO_HUGE_CHUNK_DIM2_1 ((hsize_t)1024)
-#define TOO_HUGE_CHUNK_DIM2_2 ((hsize_t)1024)
+#define HUGE_DATASET "Dataset"
+#define HUGE_DIM ((hsize_t)16 * 1024 * 1024 * 1024)
+#define HUGE_CHUNK_DIM ((hsize_t)2 * 1024 * 1024 * 1024)
+#define TOO_HUGE_CHUNK_DIM ((hsize_t)4 * 1024 * 1024 * 1024)
+#define HUGE_DATASET2 "Dataset2"
+#define HUGE_DIM2_0 ((hsize_t)16 * 1024)
+#define HUGE_DIM2_1 ((hsize_t)16 * 1024)
+#define HUGE_DIM2_2 ((hsize_t)16 * 1024)
+#define HUGE_CHUNK_DIM2_0 ((hsize_t)2 * 1024)
+#define HUGE_CHUNK_DIM2_1 ((hsize_t)1024)
+#define HUGE_CHUNK_DIM2_2 ((hsize_t)1024)
+#define TOO_HUGE_CHUNK_DIM2_0 ((hsize_t)4 * 1024)
+#define TOO_HUGE_CHUNK_DIM2_1 ((hsize_t)1024)
+#define TOO_HUGE_CHUNK_DIM2_2 ((hsize_t)1024)
/* Parameters for testing bypassing chunk cache */
-#define BYPASS_DATASET1 "Dset1"
-#define BYPASS_DATASET2 "Dset2"
+#define BYPASS_DATASET1 "Dset1"
+#define BYPASS_DATASET2 "Dset2"
-#define T_BYPASS_DATASET1 "T_Dset1"
-#define T_BYPASS_DATASET2 "T_Dset2"
+#define T_BYPASS_DATASET1 "T_Dset1"
+#define T_BYPASS_DATASET2 "T_Dset2"
-#define BYPASS_DIM 1000
-#define BYPASS_CHUNK_DIM 500
-#define BYPASS_FILL_VALUE 7
+#define BYPASS_DIM 1000
+#define BYPASS_CHUNK_DIM 500
+#define BYPASS_FILL_VALUE 7
/* Parameters for testing extensible array chunk indices */
-#define EARRAY_MAX_RANK 3
-#define EARRAY_DSET_DIM 15
-#define EARRAY_CHUNK_DIM 3
-#define EARRAY_EXTEND_INCR 15
-#define EARRAY_MAX_EXTEND 75
+#define EARRAY_MAX_RANK 3
+#define EARRAY_DSET_DIM 15
+#define EARRAY_CHUNK_DIM 3
+#define EARRAY_EXTEND_INCR 15
+#define EARRAY_MAX_EXTEND 75
/* Parameters for datasets in query storage size tests */
#define STORAGE_SIZE_DIM1 12
@@ -277,60 +275,59 @@ const char *FILENAME[] = {
#define STORAGE_SIZE_CHUNK_DIM2 5
/* Shared global arrays */
-#define DSET_DIM1 100
-#define DSET_DIM2 200
-int **points = NULL;
-int *points_data = NULL;
-double **points_dbl = NULL;
-double *points_dbl_data = NULL;
-int **check = NULL;
-int *check_data = NULL;
-double **check_dbl = NULL;
-double *check_dbl_data = NULL;
-size_t count_nbytes_read = 0;
-size_t count_nbytes_written = 0;
+#define DSET_DIM1 100
+#define DSET_DIM2 200
+int ** points = NULL;
+int * points_data = NULL;
+double **points_dbl = NULL;
+double * points_dbl_data = NULL;
+int ** check = NULL;
+int * check_data = NULL;
+double **check_dbl = NULL;
+double * check_dbl_data = NULL;
+size_t count_nbytes_read = 0;
+size_t count_nbytes_written = 0;
/* Temporary buffer dimensions */
-#define DSET_TMP_DIM1 50
-#define DSET_TMP_DIM2 100
+#define DSET_TMP_DIM1 50
+#define DSET_TMP_DIM2 100
/* Declarations for test_idx_compatible() */
-#define DSET "dset"
-#define DSET_FILTER "dset_filter"
-const char *OLD_FILENAME[] = { /* Files created under 1.6 branch and 1.8 branch */
+#define DSET "dset"
+#define DSET_FILTER "dset_filter"
+const char *OLD_FILENAME[] = {
+ /* Files created under 1.6 branch and 1.8 branch */
"btree_idx_1_6.h5", /* 1.6 HDF5 file */
"btree_idx_1_8.h5" /* 1.8 HDF5 file */
};
-
/* Local prototypes for filter functions */
-static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
static htri_t can_apply_bogus(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static herr_t set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t space_id);
-static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-static size_t filter_bogus3(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-static size_t filter_corrupt(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-static size_t filter_expand(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-static size_t filter_count(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus3(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_corrupt(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_expand(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_count(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_COUNT[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_COUNT, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "count", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_count, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_COUNT, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "count", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_count, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: filter_count
*
@@ -344,10 +341,10 @@ const H5Z_class2_t H5Z_COUNT[1] = {{
*/
static size_t
filter_count(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
+ void H5_ATTR_UNUSED **buf)
{
- if(flags & H5Z_FLAG_REVERSE)
+ if (flags & H5Z_FLAG_REVERSE)
count_nbytes_read += nbytes;
else
count_nbytes_written += nbytes;
@@ -355,7 +352,6 @@ filter_count(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
return nbytes;
} /* end filter_count() */
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -368,50 +364,55 @@ filter_count(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
static herr_t
test_create(hid_t file)
{
- hid_t dataset, space, small_space, create_parms;
- hsize_t dims[2], small_dims[2];
- herr_t status;
- hsize_t csize[2];
+ hid_t dataset, space, small_space, create_parms;
+ hsize_t dims[2], small_dims[2];
+ herr_t status;
+ hsize_t csize[2];
TESTING("create, open, close");
/* Create the data space */
dims[0] = 256;
dims[1] = 512;
- space = H5Screate_simple(2, dims, NULL);
- assert(space>=0);
+ space = H5Screate_simple(2, dims, NULL);
+ assert(space >= 0);
/* Create a small data space for compact dataset */
small_dims[0] = 16;
small_dims[1] = 8;
- small_space = H5Screate_simple(2, small_dims, NULL);
- assert(space>=0);
+ small_space = H5Screate_simple(2, small_dims, NULL);
+ assert(space >= 0);
/*
* Create a dataset using the default dataset creation properties. We're
* not sure what they are, so we won't check.
*/
- dataset = H5Dcreate2(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dataset < 0) goto error;
+ dataset =
+ H5Dcreate2(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dataset < 0)
+ goto error;
/* Close the dataset */
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
/* Add a comment to the dataset */
status = H5Oset_comment_by_name(file, DSET_DEFAULT_NAME, "This is a dataset", H5P_DEFAULT);
- if(status < 0) goto error;
+ if (status < 0)
+ goto error;
/*
* Try creating a dataset that already exists. This should fail since a
* dataset can only be created once. Temporarily turn off error
* reporting.
*/
- H5E_BEGIN_TRY {
- dataset = H5Dcreate2(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dataset >= 0) {
+ H5E_BEGIN_TRY
+ {
+ dataset = H5Dcreate2(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (dataset >= 0) {
H5_FAILED();
HDputs(" Library allowed overwrite of existing dataset.");
goto error;
@@ -421,19 +422,21 @@ test_create(hid_t file)
* Open the dataset we created above and then close it. This is how
* existing datasets are accessed.
*/
- if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) goto error;
- if((dataset = H5Dopen2(file, DSET_DEFAULT_NAME, H5P_DEFAULT)) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Fflush(file, H5F_SCOPE_GLOBAL) < 0)
+ goto error;
+ if ((dataset = H5Dopen2(file, DSET_DEFAULT_NAME, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
/*
* Try opening a non-existent dataset. This should fail since new datasets
* cannot be created with this function. Temporarily turn off error
* reporting.
*/
- H5E_BEGIN_TRY {
- dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT);
- } H5E_END_TRY;
- if(dataset >= 0) {
+ H5E_BEGIN_TRY { dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (dataset >= 0) {
H5_FAILED();
HDputs(" Opened a non-existent dataset.");
goto error;
@@ -447,15 +450,17 @@ test_create(hid_t file)
assert(create_parms >= 0);
/* Attempt to create a dataset with invalid chunk sizes */
- csize[0] = dims[0]*2;
- csize[1] = dims[1]*2;
- status = H5Pset_chunk(create_parms, 2, csize);
+ csize[0] = dims[0] * 2;
+ csize[1] = dims[1] * 2;
+ status = H5Pset_chunk(create_parms, 2, csize);
assert(status >= 0);
- H5E_BEGIN_TRY {
- dataset = H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space,
- H5P_DEFAULT, create_parms, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dataset >= 0) {
+ H5E_BEGIN_TRY
+ {
+ dataset = H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, create_parms,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (dataset >= 0) {
H5_FAILED();
HDputs(" Opened a dataset with incorrect chunking parameters.");
goto error;
@@ -463,21 +468,24 @@ test_create(hid_t file)
csize[0] = 5;
csize[1] = 100;
- status = H5Pset_chunk(create_parms, 2, csize);
+ status = H5Pset_chunk(create_parms, 2, csize);
assert(status >= 0);
- dataset = H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space,
- H5P_DEFAULT, create_parms, H5P_DEFAULT);
- if(dataset < 0) goto error;
+ dataset =
+ H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, create_parms, H5P_DEFAULT);
+ if (dataset < 0)
+ goto error;
H5Pclose(create_parms);
/* Test dataset address. Should be undefined. */
- if(H5Dget_offset(dataset)!=HADDR_UNDEF) goto error;
+ if (H5Dget_offset(dataset) != HADDR_UNDEF)
+ goto error;
/*
* Close the chunked dataset.
*/
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
/*
* Create a compact dataset, then close it.
@@ -489,20 +497,21 @@ test_create(hid_t file)
status = H5Pset_alloc_time(create_parms, H5D_ALLOC_TIME_EARLY);
assert(status >= 0);
- dataset = H5Dcreate2(file, DSET_COMPACT_NAME, H5T_NATIVE_DOUBLE,
- small_space, H5P_DEFAULT, create_parms, H5P_DEFAULT);
- if(dataset < 0) goto error;
+ dataset = H5Dcreate2(file, DSET_COMPACT_NAME, H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT, create_parms,
+ H5P_DEFAULT);
+ if (dataset < 0)
+ goto error;
H5Pclose(create_parms);
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
return SUCCEED;
- error:
+error:
return FAIL;
} /* end test_create() */
-
/*-------------------------------------------------------------------------
* Function: test_simple_io
*
@@ -517,75 +526,81 @@ test_create(hid_t file)
static herr_t
test_simple_io(const char *env_h5_drvr, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t file = -1, dataset = -1, space = -1, xfer = -1;
- int i, j, n;
- hsize_t dims[2];
- void *tconv_buf = NULL;
- int f = -1;
- haddr_t offset;
- int **rdata = NULL;
- int *rdata_bytes = NULL;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t file = -1, dataset = -1, space = -1, xfer = -1;
+ int i, j, n;
+ hsize_t dims[2];
+ void * tconv_buf = NULL;
+ int f = -1;
+ haddr_t offset;
+ int ** rdata = NULL;
+ int * rdata_bytes = NULL;
TESTING("simple I/O");
/* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */
- if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
+ if (HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
/* Set up data array */
- if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ if (NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
TEST_ERROR;
- if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes))))
+ if (NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes))))
TEST_ERROR;
for (i = 0; i < DSET_DIM1; i++)
rdata[i] = rdata_bytes + (i * DSET_DIM2);
/* Initialize the dataset */
- for(i = n = 0; i < DSET_DIM1; i++)
- for(j = 0; j < DSET_DIM2; j++)
+ for (i = n = 0; i < DSET_DIM1; i++)
+ for (j = 0; j < DSET_DIM2; j++)
points[i][j] = n++;
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
/* Create the data space */
dims[0] = DSET_DIM1;
dims[1] = DSET_DIM2;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
/* Create a small conversion buffer to test strip mining */
tconv_buf = HDmalloc((size_t)1000);
- xfer = H5Pcreate(H5P_DATASET_XFER);
- assert(xfer>=0);
- if(H5Pset_buffer (xfer, (size_t)1000, tconv_buf, NULL) < 0) goto error;
+ xfer = H5Pcreate(H5P_DATASET_XFER);
+ assert(xfer >= 0);
+ if (H5Pset_buffer(xfer, (size_t)1000, tconv_buf, NULL) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_SIMPLE_IO_NAME, H5T_NATIVE_INT, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Sclose(space) < 0) TEST_ERROR
+ if ((dataset = H5Dcreate2(file, DSET_SIMPLE_IO_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR
space = -1;
/* Test dataset address. Should be undefined. */
- if(H5Dget_offset(dataset) != HADDR_UNDEF) goto error;
+ if (H5Dget_offset(dataset) != HADDR_UNDEF)
+ goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points_data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points_data) < 0)
goto error;
/* Test dataset address in file. Open the same file as a C file, seek
* the data position as H5Dget_offset points to, read the dataset, and
* compare it with the data written in.*/
- if((offset=H5Dget_offset(dataset))==HADDR_UNDEF) goto error;
+ if ((offset = H5Dget_offset(dataset)) == HADDR_UNDEF)
+ goto error;
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check_data) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check_data) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < DSET_DIM1; i++) {
- for(j = 0; j < DSET_DIM2; j++) {
- if(points[i][j] != check[i][j]) {
+ for (i = 0; i < DSET_DIM1; i++) {
+ for (j = 0; j < DSET_DIM2; j++) {
+ if (points[i][j] != check[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
@@ -594,22 +609,25 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
}
}
- if(H5Pclose (xfer) < 0) goto error;
- xfer = -1;
- if(H5Dclose(dataset) < 0) goto error;
- dataset = -1;
- if(H5Fclose(file) < 0) goto error;
- file = -1;
+ if (H5Pclose(xfer) < 0)
+ goto error;
+ xfer = -1;
+ if (H5Dclose(dataset) < 0)
+ goto error;
+ dataset = -1;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = -1;
f = HDopen(filename, O_RDONLY);
HDlseek(f, (off_t)offset, SEEK_SET);
- if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
+ if (HDread(f, rdata_bytes, sizeof(int) * DSET_DIM1 * DSET_DIM2) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < DSET_DIM1; i++) {
- for(j = 0; j < DSET_DIM2; j++) {
- if(points[i][j] != rdata[i][j]) {
+ for (i = 0; i < DSET_DIM1; i++) {
+ for (j = 0; j < DSET_DIM2; j++) {
+ if (points[i][j] != rdata[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
@@ -635,15 +653,19 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
return SUCCEED;
error:
- if(space > 0)
- if(H5Sclose(space) < 0) TEST_ERROR
- if(xfer > 0)
- if(H5Pclose(xfer) < 0) TEST_ERROR
- if(dataset > 0)
- if(H5Dclose(dataset) < 0) TEST_ERROR
- if(file > 0)
- if(H5Fclose(file) < 0) TEST_ERROR
- if(f > 0)
+ if (space > 0)
+ if (H5Sclose(space) < 0)
+ TEST_ERROR
+ if (xfer > 0)
+ if (H5Pclose(xfer) < 0)
+ TEST_ERROR
+ if (dataset > 0)
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR
+ if (file > 0)
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
+ if (f > 0)
HDclose(f);
HDfree(tconv_buf);
@@ -653,7 +675,6 @@ error:
return FAIL;
} /* end test_simple_io() */
-
/*-------------------------------------------------------------------------
* Function: test_userblock_offset
*
@@ -666,74 +687,83 @@ error:
static herr_t
test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t file = -1, fcpl = -1, dataset = -1, space = -1;
- int i, j;
- hsize_t dims[2];
- int f = -1;
- haddr_t offset;
- int **rdata = NULL;
- int *rdata_bytes = NULL;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t file = -1, fcpl = -1, dataset = -1, space = -1;
+ int i, j;
+ hsize_t dims[2];
+ int f = -1;
+ haddr_t offset;
+ int ** rdata = NULL;
+ int * rdata_bytes = NULL;
TESTING("dataset offset with user block");
/* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */
- if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
+ if (HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
/* Set up data array */
- if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ if (NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
TEST_ERROR;
- if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes))))
+ if (NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes))))
TEST_ERROR;
for (i = 0; i < DSET_DIM1; i++)
rdata[i] = rdata_bytes + (i * DSET_DIM2);
- if((fcpl=H5Pcreate(H5P_FILE_CREATE)) < 0) goto error;
- if(H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0) goto error;
- if(new_format)
- if(H5Pset_file_space_page_size(fcpl, (hsize_t)USER_BLOCK) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+ if (H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0)
+ goto error;
+ if (new_format)
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)USER_BLOCK) < 0)
goto error;
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
goto error;
- if(H5Pclose(fcpl) < 0) TEST_ERROR
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR
fcpl = -1;
/* Create the data space */
dims[0] = DSET_DIM1;
dims[1] = DSET_DIM2;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_USERBLOCK_IO_NAME, H5T_NATIVE_INT, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Sclose(space) < 0) TEST_ERROR
+ if ((dataset = H5Dcreate2(file, DSET_USERBLOCK_IO_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR
space = -1;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0)
goto error;
/* Test dataset address in file. Open the same file as a C file, seek
* the data position as H5Dget_offset points to, read the dataset, and
* compare it with the data written in.*/
- if((offset = H5Dget_offset(dataset)) == HADDR_UNDEF) goto error;
+ if ((offset = H5Dget_offset(dataset)) == HADDR_UNDEF)
+ goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
dataset = -1;
- if(H5Fclose(file) < 0) goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
file = -1;
f = HDopen(filename, O_RDONLY);
HDlseek(f, (off_t)offset, SEEK_SET);
- if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
+ if (HDread(f, rdata_bytes, sizeof(int) * DSET_DIM1 * DSET_DIM2) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < DSET_DIM1; i++) {
- for(j = 0; j < DSET_DIM2; j++) {
- if(points[i][j] != rdata[i][j]) {
+ for (i = 0; i < DSET_DIM1; i++) {
+ for (j = 0; j < DSET_DIM2; j++) {
+ if (points[i][j] != rdata[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
@@ -758,15 +788,19 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
return SUCCEED;
error:
- if(space > 0)
- if(H5Sclose(space) < 0) TEST_ERROR
- if(fcpl > 0)
- if(H5Pclose(fcpl) < 0) TEST_ERROR
- if(dataset > 0)
- if(H5Dclose(dataset) < 0) TEST_ERROR
- if(file > 0)
- if(H5Fclose(file) < 0) TEST_ERROR
- if(f > 0)
+ if (space > 0)
+ if (H5Sclose(space) < 0)
+ TEST_ERROR
+ if (fcpl > 0)
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR
+ if (dataset > 0)
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR
+ if (file > 0)
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
+ if (f > 0)
HDclose(f);
HDfree(rdata_bytes);
@@ -775,7 +809,6 @@ error:
return FAIL;
} /* end test_userblock_offset() */
-
/*-------------------------------------------------------------------------
* Function: test_compact_io
*
@@ -791,129 +824,143 @@ error:
static herr_t
test_compact_io(hid_t fapl)
{
- hid_t file, dataset, space, plist;
- hid_t verfile = -1, new_fapl = -1;
- hsize_t dims[2];
- int wbuf[16][8], rbuf[16][8];
- char filename[FILENAME_BUF_SIZE];
- H5F_libver_t low, high; /* File format bounds */
- H5F_t *fp; /* Internal file pointer */
- H5D_t *dsetp; /* Internal dataset pointer */
- int i, j, n; /* Indices */
- herr_t ret; /* Generic return value */
+ hid_t file, dataset, space, plist;
+ hid_t verfile = -1, new_fapl = -1;
+ hsize_t dims[2];
+ int wbuf[16][8], rbuf[16][8];
+ char filename[FILENAME_BUF_SIZE];
+ H5F_libver_t low, high; /* File format bounds */
+ H5F_t * fp; /* Internal file pointer */
+ H5D_t * dsetp; /* Internal dataset pointer */
+ int i, j, n; /* Indices */
+ herr_t ret; /* Generic return value */
TESTING("compact dataset I/O");
/* Initialize data */
n = 0;
- for(i = 0; i < 16; i++)
- for(j = 0; j < 8; j++)
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 8; j++)
wbuf[i][j] = n++;
/* Create a small data space for compact dataset */
dims[0] = 16;
dims[1] = 8;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
/* Create a file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create property list for compact dataset creation */
- if((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_layout(plist, H5D_COMPACT) < 0) TEST_ERROR
- if(H5Pset_alloc_time(plist, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if ((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_layout(plist, H5D_COMPACT) < 0)
+ TEST_ERROR
+ if (H5Pset_alloc_time(plist, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* Create and write to a compact dataset */
- if((dataset = H5Dcreate2(file, DSET_COMPACT_IO_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_COMPACT_IO_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Test dataset address. Should be undefined. */
- if(H5Dget_offset(dataset) != HADDR_UNDEF) TEST_ERROR
+ if (H5Dget_offset(dataset) != HADDR_UNDEF)
+ TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
TEST_ERROR
/* Test dataset address. Should be undefined. */
- if(H5Dget_offset(dataset)!=HADDR_UNDEF) TEST_ERROR
+ if (H5Dget_offset(dataset) != HADDR_UNDEF)
+ TEST_ERROR
/* Close file */
- if(H5Dclose(dataset) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
/*
* Open the file and check data
*/
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if((dataset = H5Dopen2(file, DSET_COMPACT_IO_NAME, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_COMPACT_IO_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
TEST_ERROR
- /* Check that the values read are the same as the values written */
- for(i = 0; i < 16; i++)
- for(j = 0; j < 8; j++)
- if(rbuf[i][j] != wbuf[i][j]) {
- H5_FAILED();
- HDprintf(" Read different values than written.\n");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]);
- HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]);
- goto error;
- } /* end */
+ /* Check that the values read are the same as the values written */
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 8; j++)
+ if (rbuf[i][j] != wbuf[i][j]) {
+ H5_FAILED();
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %d,%d\n", i, j);
+ HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]);
+ HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]);
+ goto error;
+ } /* end */
- if(H5Dclose(dataset) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
/**************************************
* Additional test for version bounds *
**************************************/
/* Create a copy of file access property list */
- if((new_fapl = h5_fileaccess()) < 0) TEST_ERROR
+ if ((new_fapl = h5_fileaccess()) < 0)
+ TEST_ERROR
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combinations.
- Create a file, create and write a compact dataset, and verify its data
- Verify the dataset's layout and fill message versions */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds */
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(new_fapl, low, high);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
continue;
/* Create a file */
h5_fixname(FILENAME[25], new_fapl, filename, sizeof filename);
- if((verfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl)) < 0)
+ if ((verfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl)) < 0)
TEST_ERROR
/* Create the compact dataset */
- dataset = H5Dcreate2(verfile, DSET_DEFAULT_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist, H5P_DEFAULT);
- if(dataset < 0) TEST_ERROR
+ dataset = H5Dcreate2(verfile, DSET_DEFAULT_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist,
+ H5P_DEFAULT);
+ if (dataset < 0)
+ TEST_ERROR
/* Write the same data as of DSET_COMPACT_IO_NAME */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
TEST_ERROR
/* Close DSET_DEFAULT_NAME, then reopen it to read and verify
the data */
- if(H5Dclose(dataset) < 0) TEST_ERROR
- if((dataset = H5Dopen2(verfile, DSET_DEFAULT_NAME, H5P_DEFAULT)) < 0)
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR
+ if ((dataset = H5Dopen2(verfile, DSET_DEFAULT_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
TEST_ERROR
/* Check that the values read are the same as the values written */
- for(i = 0; i < 16; i++)
- for(j = 0; j < 8; j++)
- if(rbuf[i][j] != wbuf[i][j]) {
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 8; j++)
+ if (rbuf[i][j] != wbuf[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
@@ -923,52 +970,63 @@ test_compact_io(hid_t fapl)
} /* end */
/* Get the internal file pointer */
- if((fp = (H5F_t *)H5VL_object(verfile)) == NULL) TEST_ERROR
+ if ((fp = (H5F_t *)H5VL_object(verfile)) == NULL)
+ TEST_ERROR
/* Get the internal dataset pointer */
- if((dsetp = (H5D_t *)H5VL_object(dataset)) == NULL) TEST_ERROR
+ if ((dsetp = (H5D_t *)H5VL_object(dataset)) == NULL)
+ TEST_ERROR
/* Verify the dataset's layout and fill message versions */
- if(fp->shared->low_bound == H5F_LIBVER_EARLIEST) {
+ if (fp->shared->low_bound == H5F_LIBVER_EARLIEST) {
VERIFY(dsetp->shared->layout.version, H5O_LAYOUT_VERSION_DEFAULT, "layout_ver_bounds");
VERIFY(dsetp->shared->dcpl_cache.fill.version, H5O_FILL_VERSION_2, "fill_ver_bounds");
- } else {
- VERIFY(dsetp->shared->layout.version, H5O_layout_ver_bounds[fp->shared->low_bound], "layout_ver_bounds");
- VERIFY(dsetp->shared->dcpl_cache.fill.version, H5O_fill_ver_bounds[fp->shared->low_bound], "fill_ver_bounds");
+ }
+ else {
+ VERIFY(dsetp->shared->layout.version, H5O_layout_ver_bounds[fp->shared->low_bound],
+ "layout_ver_bounds");
+ VERIFY(dsetp->shared->dcpl_cache.fill.version, H5O_fill_ver_bounds[fp->shared->low_bound],
+ "fill_ver_bounds");
}
/* Close the dataset and delete from the file */
- if(H5Dclose(dataset) < 0) TEST_ERROR
- if(H5Ldelete(verfile, DSET_DEFAULT_NAME, H5P_DEFAULT) < 0)
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR
+ if (H5Ldelete(verfile, DSET_DEFAULT_NAME, H5P_DEFAULT) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(verfile) < 0) TEST_ERROR
+ if (H5Fclose(verfile) < 0)
+ TEST_ERROR
} /* end for high */
- } /* end for low */
+ } /* end for low */
- if(H5Pclose(new_fapl) < 0) TEST_ERROR
- if(H5Sclose(space) < 0) TEST_ERROR
- if(H5Pclose(plist) < 0) TEST_ERROR
+ if (H5Pclose(new_fapl) < 0)
+ TEST_ERROR
+ if (H5Sclose(space) < 0)
+ TEST_ERROR
+ if (H5Pclose(plist) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Pclose(plist);
H5Pclose(new_fapl);
H5Dclose(dataset);
H5Fclose(file);
H5Fclose(verfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_compact_io() */
-
/*-------------------------------------------------------------------------
* Function: test_max_compact
*
@@ -981,17 +1039,17 @@ test_compact_io(hid_t fapl)
static herr_t
test_max_compact(hid_t fapl)
{
- hid_t file = -1;
- hid_t dataset = -1;
- hid_t space = -1;
- hid_t plist = -1;
- hsize_t dims[1];
- size_t compact_size;
- int *wbuf = NULL;
- int *rbuf = NULL;
- char filename[FILENAME_BUF_SIZE];
- int n;
- size_t u;
+ hid_t file = -1;
+ hid_t dataset = -1;
+ hid_t space = -1;
+ hid_t plist = -1;
+ hsize_t dims[1];
+ size_t compact_size;
+ int * wbuf = NULL;
+ int * rbuf = NULL;
+ char filename[FILENAME_BUF_SIZE];
+ int n;
+ size_t u;
TESTING("compact dataset of maximal size");
@@ -1000,128 +1058,132 @@ test_max_compact(hid_t fapl)
/* Initialize data */
compact_size = (SIXTY_FOUR_KB - 64) / sizeof(int);
- if(NULL == (wbuf = (int *)HDmalloc(sizeof(int) * compact_size)))
+ if (NULL == (wbuf = (int *)HDmalloc(sizeof(int) * compact_size)))
TEST_ERROR
- if(NULL == (rbuf = (int *)HDmalloc(sizeof(int) * compact_size)))
+ if (NULL == (rbuf = (int *)HDmalloc(sizeof(int) * compact_size)))
TEST_ERROR
n = 0;
- for(u = 0; u < compact_size; u++)
+ for (u = 0; u < compact_size; u++)
wbuf[u] = n++;
/* Create a small data space for compact dataset */
dims[0] = (hsize_t)compact_size;
- if((space = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((space = H5Screate_simple(1, dims, NULL)) < 0)
FAIL_STACK_ERROR
/* Create a file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create property list for compact dataset creation */
- if((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_layout(plist, H5D_COMPACT) < 0)
+ if (H5Pset_layout(plist, H5D_COMPACT) < 0)
FAIL_STACK_ERROR
/* Create and write to a compact dataset */
- if((dataset = H5Dcreate2(file, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(plist) < 0)
+ if (H5Pclose(plist) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/*
* Open the file and check data
*/
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
- if((dataset = H5Dopen2(file, DSET_COMPACT_MAX_NAME, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_COMPACT_MAX_NAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR
/* Check that the values read are the same as the values written */
- for(u = 0; u < compact_size; u++)
- if(rbuf[u] != wbuf[u]) {
+ for (u = 0; u < compact_size; u++)
+ if (rbuf[u] != wbuf[u]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %u\n", (unsigned)u);
goto error;
} /* end if */
- if(H5Dclose(dataset) < 0)
- FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
- HDfree(wbuf);
- wbuf = NULL;
- HDfree(rbuf);
- rbuf = NULL;
-
- /* Test compact dataset of size 64KB */
-
- /* Create a data space for compact dataset */
- compact_size = SIXTY_FOUR_KB / sizeof(int);
- dims[0] = (hsize_t)compact_size;
- if((space = H5Screate_simple(1, dims, NULL)) < 0)
- FAIL_STACK_ERROR
-
- /* Open file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- goto error;
-
- /* Create property list for compact dataset creation */
- if((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_layout(plist, H5D_COMPACT) < 0)
- FAIL_STACK_ERROR
-
- /* Create and write to a compact dataset */
- H5E_BEGIN_TRY {
- H5Dcreate2(file, DSET_COMPACT_MAX2_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist, H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* Close file */
- if(H5Sclose(space) < 0)
- FAIL_STACK_ERROR
- if(H5Pclose(plist) < 0)
- FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
-
- PASSED();
- return SUCCEED;
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ HDfree(wbuf);
+ wbuf = NULL;
+ HDfree(rbuf);
+ rbuf = NULL;
+
+ /* Test compact dataset of size 64KB */
+
+ /* Create a data space for compact dataset */
+ compact_size = SIXTY_FOUR_KB / sizeof(int);
+ dims[0] = (hsize_t)compact_size;
+ if ((space = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open file */
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ goto error;
+
+ /* Create property list for compact dataset creation */
+ if ((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_layout(plist, H5D_COMPACT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create and write to a compact dataset */
+ H5E_BEGIN_TRY
+ {
+ H5Dcreate2(file, DSET_COMPACT_MAX2_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+
+ /* Close file */
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(plist) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+ return SUCCEED;
error:
- if(wbuf)
+ if (wbuf)
HDfree(wbuf);
- if(rbuf)
+ if (rbuf)
HDfree(rbuf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* Close file */
H5Sclose(space);
H5Pclose(plist);
H5Dclose(dataset);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return FAIL;
+ return FAIL;
} /* end test_max_compact() */
-
/*-------------------------------------------------------------------------
* Function: test_layout_extend
*
@@ -1139,98 +1201,121 @@ error:
static herr_t
test_layout_extend(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE]; /* File name */
- hid_t fid = -1; /* File id */
- hid_t sid_fix = -1, sid_unlim = -1; /* Dataspace id */
- hid_t dcpl_compact = -1, dcpl_contig = -1, dcpl_chunked = -1; /* Dataset creation property list id */
- hid_t did_fixed = -1, did_unlim = -1; /* Dataset id */
- hsize_t cur_size[1] = {10}; /* Current size of dataspace */
- hsize_t max_unlim[1] = {H5S_UNLIMITED}; /* Maximum size of dataspace (unlimited) */
- hsize_t max_fix[1] = {100}; /* Maximum size of dataspace (fixed) */
+ char filename[FILENAME_BUF_SIZE]; /* File name */
+ hid_t fid = -1; /* File id */
+ hid_t sid_fix = -1, sid_unlim = -1; /* Dataspace id */
+ hid_t dcpl_compact = -1, dcpl_contig = -1, dcpl_chunked = -1; /* Dataset creation property list id */
+ hid_t did_fixed = -1, did_unlim = -1; /* Dataset id */
+ hsize_t cur_size[1] = {10}; /* Current size of dataspace */
+ hsize_t max_unlim[1] = {H5S_UNLIMITED}; /* Maximum size of dataspace (unlimited) */
+ hsize_t max_fix[1] = {100}; /* Maximum size of dataspace (fixed) */
hsize_t chunk_dim[1] = {10}; /* Chunk size */
TESTING("extendible dataset with various layout");
/* Create a file */
h5_fixname(FILENAME[15], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create dataspace */
- if((sid_fix = H5Screate_simple(1, cur_size, max_fix)) < 0)
+ if ((sid_fix = H5Screate_simple(1, cur_size, max_fix)) < 0)
FAIL_STACK_ERROR
- if((sid_unlim = H5Screate_simple(1, cur_size, max_unlim)) < 0)
+ if ((sid_unlim = H5Screate_simple(1, cur_size, max_unlim)) < 0)
FAIL_STACK_ERROR
/* Create property list for compact dataset creation */
- if((dcpl_compact = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_compact = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_layout(dcpl_compact, H5D_COMPACT) < 0)
+ if (H5Pset_layout(dcpl_compact, H5D_COMPACT) < 0)
FAIL_STACK_ERROR
/* Create dataset with extendible dataspace (fixed max_dims) should fail */
- H5E_BEGIN_TRY {
- if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL)
- TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) !=
+ FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Create dataset with extendible dataspace (unlimited max_dims) should fail */
- H5E_BEGIN_TRY {
- if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL)
- TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) !=
+ FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Create property list for contiguous dataset creation */
- if((dcpl_contig = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_contig = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_layout(dcpl_contig, H5D_CONTIGUOUS)) < 0)
+ if ((H5Pset_layout(dcpl_contig, H5D_CONTIGUOUS)) < 0)
FAIL_STACK_ERROR
/* Create dataset with extendible dataspace (fixed max_dims) should fail */
- H5E_BEGIN_TRY {
- if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL)
- TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Create dataset with extendible dataspace (unlimited max_dims) should fail*/
- H5E_BEGIN_TRY {
- if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL)
- TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) !=
+ FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Create property list for chunked dataset creation */
- if((dcpl_chunked = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_chunked = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_layout(dcpl_chunked, H5D_CHUNKED) < 0)
+ if (H5Pset_layout(dcpl_chunked, H5D_CHUNKED) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl_chunked, 1, chunk_dim) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl_chunked, 1, chunk_dim) < 0) FAIL_STACK_ERROR
/* Create dataset with extendible dataspace (fixed max_dims) should succeed */
- if((did_fixed = H5Dcreate2(fid, "chunked_fixed", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_chunked, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did_fixed = H5Dcreate2(fid, "chunked_fixed", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_chunked,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset with extendible dataspace (unlimited max_dims) should succeed */
- if((did_unlim = H5Dcreate2(fid, "chunked_unlim", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_chunked, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did_unlim = H5Dcreate2(fid, "chunked_unlim", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_chunked,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Closing */
- if(H5Sclose(sid_fix) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid_unlim) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid_fix) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid_unlim) < 0)
+ FAIL_STACK_ERROR
- if(H5Pclose(dcpl_compact) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl_contig) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl_chunked) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl_compact) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl_contig) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl_chunked) < 0)
+ FAIL_STACK_ERROR
- if(H5Dclose(did_fixed) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did_unlim) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did_fixed) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did_unlim) < 0)
+ FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid_fix);
H5Sclose(sid_unlim);
H5Pclose(dcpl_compact);
@@ -1239,12 +1324,12 @@ error:
H5Dclose(did_fixed);
H5Dclose(did_unlim);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return FAIL;
+ return FAIL;
} /* end test_layout_extend() */
-
/*-------------------------------------------------------------------------
* Function: test_conv_buffer
*
@@ -1257,135 +1342,157 @@ error:
static herr_t
test_conv_buffer(hid_t fid)
{
- typedef struct
- {
- int a[DIM1][DIM2][DIM3];
- float b[DIM2];
- double c[DIM3];
+ typedef struct {
+ int a[DIM1][DIM2][DIM3];
+ float b[DIM2];
+ double c[DIM3];
} CmpField;
- typedef struct
- {
- float b[DIM2];
- double c[DIM3];
+ typedef struct {
+ float b[DIM2];
+ double c[DIM3];
} CmpFieldR;
- herr_t status = -1;
- int j, k, l;
-
- CmpField *cf = NULL;
- CmpFieldR *cfrR = NULL;
-
- hid_t dataset = H5I_INVALID_HID; /* dataset ID */
- hid_t space = H5I_INVALID_HID; /* data space ID */
- hid_t ctype1 = H5I_INVALID_HID,
- ctype2 = H5I_INVALID_HID; /* data type ID */
- hid_t arr_type1 = H5I_INVALID_HID,
- arr_type2 = H5I_INVALID_HID,
- arr_type3 = H5I_INVALID_HID,
- arr_type4 = H5I_INVALID_HID,
- arr_type5 = H5I_INVALID_HID;
- hsize_t dimsa[3];
- hsize_t dimsb[1];
- hsize_t dimsc[1];
- hid_t xfer_list = H5I_INVALID_HID;
- size_t size;
+ herr_t status = -1;
+ int j, k, l;
+
+ CmpField * cf = NULL;
+ CmpFieldR *cfrR = NULL;
+
+ hid_t dataset = H5I_INVALID_HID; /* dataset ID */
+ hid_t space = H5I_INVALID_HID; /* data space ID */
+ hid_t ctype1 = H5I_INVALID_HID, ctype2 = H5I_INVALID_HID; /* data type ID */
+ hid_t arr_type1 = H5I_INVALID_HID, arr_type2 = H5I_INVALID_HID, arr_type3 = H5I_INVALID_HID,
+ arr_type4 = H5I_INVALID_HID, arr_type5 = H5I_INVALID_HID;
+ hsize_t dimsa[3];
+ hsize_t dimsb[1];
+ hsize_t dimsc[1];
+ hid_t xfer_list = H5I_INVALID_HID;
+ size_t size;
TESTING("data type conversion buffer size");
- if ((cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField))) == 0) goto error;
+ if ((cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField))) == 0)
+ goto error;
/* Populate the data members */
- for(j = 0; j < DIM1; j++)
- for(k = 0; k < DIM2; k++)
- for(l = 0; l < DIM3; l++)
- cf->a[j][k][l] = 10*(j+1) + l + k;
-
- for(j = 0; j < DIM2; j++)
- cf->b[j] = 100.0f * (float)(j+1) + 0.01f * (float)j;
-
- for(j = 0; j < DIM3; j++)
- cf->c[j] = 100.0f * (float)(j+1) + 0.02f * (float)j;
-
-
- /* Create data space */
- if((space=H5Screate(H5S_SCALAR)) < 0) goto error;
-
- /* Add members to the compound data type */
- dimsa[0] = DIM1;
- dimsa[1] = DIM2;
- dimsa[2] = DIM3;
- dimsb[0] = DIM2;
- dimsc[0] = DIM3;
-
- /* Create the memory data type */
- if((ctype1 = H5Tcreate(H5T_COMPOUND, sizeof (CmpField))) < 0) goto error;
-
- if((arr_type1 = H5Tarray_create2(H5T_NATIVE_INT, 3, dimsa)) < 0) goto error;
- if((arr_type2 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0) goto error;
- if((arr_type3 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error;
-
- if(H5Tinsert(ctype1, "A", HOFFSET(CmpField, a), arr_type1) < 0) goto error;
- if(H5Tinsert(ctype1, "B", HOFFSET(CmpField, b), arr_type2) < 0) goto error;
- if(H5Tinsert(ctype1, "C", HOFFSET(CmpField, c), arr_type3) < 0) goto error;
-
- /* Create the dataset */
- if((dataset = H5Dcreate2(fid, DSET_CONV_BUF_NAME, ctype1, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Dwrite(dataset, ctype1, H5S_ALL, H5S_ALL, H5P_DEFAULT, cf) < 0) goto error;
-
- if((ctype2 = H5Tcreate(H5T_COMPOUND, sizeof (CmpFieldR))) < 0) goto error;
-
- if((arr_type4 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0) goto error;
- if((arr_type5 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error;
-
- if(H5Tinsert(ctype2, "B", HOFFSET(CmpFieldR, b), arr_type4) < 0) goto error;
- if(H5Tinsert(ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error;
-
- /* Read should succeed since library will set conversion buffer big enough */
- if ((cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR))) == 0) goto error;
- if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfrR) < 0) goto error;
-
- /* Read should fail since conversion buffer isn't big enough */
- xfer_list = H5Pcreate(H5P_DATASET_XFER);
- size = (DIM2 * DIM3 * (sizeof(int))+ DIM2 * (sizeof(float))+
- DIM3 * (sizeof(double)));
- if(H5Pset_buffer(xfer_list, size, NULL, NULL) < 0) goto error;
-
- H5E_BEGIN_TRY {
- status = H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Library shouldn't allow conversion buffer too small");
- goto error;
- }
-
- /* Read will succeed since conversion buffer is big enough */
- size = (DIM1 * DIM2 * DIM3 * (sizeof(int))+ DIM2 * (sizeof(float))+
- DIM3 * (sizeof(double)));
- if(H5Pset_buffer(xfer_list, size, NULL, NULL) < 0) goto error;
-
- if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR) < 0) goto error;
-
-
- if(H5Pclose(xfer_list) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Tclose(arr_type1) < 0) goto error;
- if(H5Tclose(arr_type2) < 0) goto error;
- if(H5Tclose(arr_type3) < 0) goto error;
- if(H5Tclose(ctype1) < 0) goto error;
- if(H5Tclose(ctype2) < 0) goto error;
- if(H5Tclose(arr_type4) < 0) goto error;
- if(H5Tclose(arr_type5) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
-
- HDfree(cf);
- HDfree(cfrR);
- HDputs(" PASSED");
- return SUCCEED;
+ for (j = 0; j < DIM1; j++)
+ for (k = 0; k < DIM2; k++)
+ for (l = 0; l < DIM3; l++)
+ cf->a[j][k][l] = 10 * (j + 1) + l + k;
+
+ for (j = 0; j < DIM2; j++)
+ cf->b[j] = 100.0f * (float)(j + 1) + 0.01f * (float)j;
+
+ for (j = 0; j < DIM3; j++)
+ cf->c[j] = 100.0f * (float)(j + 1) + 0.02f * (float)j;
+
+ /* Create data space */
+ if ((space = H5Screate(H5S_SCALAR)) < 0)
+ goto error;
+
+ /* Add members to the compound data type */
+ dimsa[0] = DIM1;
+ dimsa[1] = DIM2;
+ dimsa[2] = DIM3;
+ dimsb[0] = DIM2;
+ dimsc[0] = DIM3;
+
+ /* Create the memory data type */
+ if ((ctype1 = H5Tcreate(H5T_COMPOUND, sizeof(CmpField))) < 0)
+ goto error;
+
+ if ((arr_type1 = H5Tarray_create2(H5T_NATIVE_INT, 3, dimsa)) < 0)
+ goto error;
+ if ((arr_type2 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0)
+ goto error;
+ if ((arr_type3 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0)
+ goto error;
+
+ if (H5Tinsert(ctype1, "A", HOFFSET(CmpField, a), arr_type1) < 0)
+ goto error;
+ if (H5Tinsert(ctype1, "B", HOFFSET(CmpField, b), arr_type2) < 0)
+ goto error;
+ if (H5Tinsert(ctype1, "C", HOFFSET(CmpField, c), arr_type3) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if ((dataset =
+ H5Dcreate2(fid, DSET_CONV_BUF_NAME, ctype1, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dwrite(dataset, ctype1, H5S_ALL, H5S_ALL, H5P_DEFAULT, cf) < 0)
+ goto error;
+
+ if ((ctype2 = H5Tcreate(H5T_COMPOUND, sizeof(CmpFieldR))) < 0)
+ goto error;
+
+ if ((arr_type4 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0)
+ goto error;
+ if ((arr_type5 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0)
+ goto error;
+
+ if (H5Tinsert(ctype2, "B", HOFFSET(CmpFieldR, b), arr_type4) < 0)
+ goto error;
+ if (H5Tinsert(ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0)
+ goto error;
+
+ /* Read should succeed since library will set conversion buffer big enough */
+ if ((cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR))) == 0)
+ goto error;
+ if (H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfrR) < 0)
+ goto error;
+
+ /* Read should fail since conversion buffer isn't big enough */
+ xfer_list = H5Pcreate(H5P_DATASET_XFER);
+ size = (DIM2 * DIM3 * (sizeof(int)) + DIM2 * (sizeof(float)) + DIM3 * (sizeof(double)));
+ if (H5Pset_buffer(xfer_list, size, NULL, NULL) < 0)
+ goto error;
+
+ H5E_BEGIN_TRY { status = H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Library shouldn't allow conversion buffer too small");
+ goto error;
+ }
+
+ /* Read will succeed since conversion buffer is big enough */
+ size = (DIM1 * DIM2 * DIM3 * (sizeof(int)) + DIM2 * (sizeof(float)) + DIM3 * (sizeof(double)));
+ if (H5Pset_buffer(xfer_list, size, NULL, NULL) < 0)
+ goto error;
+
+ if (H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR) < 0)
+ goto error;
+
+ if (H5Pclose(xfer_list) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Tclose(arr_type1) < 0)
+ goto error;
+ if (H5Tclose(arr_type2) < 0)
+ goto error;
+ if (H5Tclose(arr_type3) < 0)
+ goto error;
+ if (H5Tclose(ctype1) < 0)
+ goto error;
+ if (H5Tclose(ctype2) < 0)
+ goto error;
+ if (H5Tclose(arr_type4) < 0)
+ goto error;
+ if (H5Tclose(arr_type5) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
+
+ HDfree(cf);
+ HDfree(cfrR);
+ HDputs(" PASSED");
+ return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(xfer_list);
H5Sclose(space);
H5Tclose(arr_type1);
@@ -1396,12 +1503,12 @@ error:
H5Tclose(arr_type4);
H5Tclose(arr_type5);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return FAIL;
+ return FAIL;
} /* end test_conv_buffer() */
-
/*-------------------------------------------------------------------------
* Function: test_tconv
*
@@ -1414,10 +1521,10 @@ error:
static herr_t
test_tconv(hid_t file)
{
- char *out = NULL, *in = NULL;
- hsize_t dims[1];
- hid_t space = -1, dataset = -1;
- int i;
+ char * out = NULL, *in = NULL;
+ hsize_t dims[1];
+ hid_t space = -1, dataset = -1;
+ int i;
if ((out = (char *)HDmalloc((size_t)(4 * 1000 * 1000))) == NULL)
goto error;
@@ -1427,7 +1534,7 @@ test_tconv(hid_t file)
TESTING("data type conversion");
/* Initialize the dataset */
- for(i = 0; i < 1000000; i++) {
+ for (i = 0; i < 1000000; i++) {
out[i * 4 + 0] = 0x11;
out[i * 4 + 1] = 0x22;
out[i * 4 + 2] = 0x33;
@@ -1436,35 +1543,36 @@ test_tconv(hid_t file)
/* Create the data space */
dims[0] = 1000000;
- if((space = H5Screate_simple (1, dims, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
/* Create the data set */
- if((dataset = H5Dcreate2(file, DSET_TCONV_NAME, H5T_STD_I32LE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_TCONV_NAME, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, out) < 0)
+ if (H5Dwrite(dataset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, out) < 0)
goto error;
/* Read data with byte order conversion */
- if(H5Dread(dataset, H5T_STD_I32BE, H5S_ALL, H5S_ALL, H5P_DEFAULT, in) < 0)
+ if (H5Dread(dataset, H5T_STD_I32BE, H5S_ALL, H5S_ALL, H5P_DEFAULT, in) < 0)
goto error;
/* Check */
- for(i = 0; i < 1000000; i++) {
- if(in[4 * i + 0] != out[4 * i + 3] ||
- in[4 * i + 1] != out[4 * i + 2] ||
- in[4 * i + 2] != out[4 * i + 1] ||
- in[4 * i + 3] != out[4 * i + 0]) {
+ for (i = 0; i < 1000000; i++) {
+ if (in[4 * i + 0] != out[4 * i + 3] || in[4 * i + 1] != out[4 * i + 2] ||
+ in[4 * i + 2] != out[4 * i + 1] || in[4 * i + 3] != out[4 * i + 0]) {
H5_FAILED();
HDputs(" Read with byte order conversion failed.");
goto error;
}
}
- if(H5Dclose(dataset) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
HDfree(out);
HDfree(in);
@@ -1472,31 +1580,32 @@ test_tconv(hid_t file)
return SUCCEED;
error:
- if(out)
+ if (out)
HDfree(out);
- if(in)
+ if (in)
HDfree(in);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_tconv() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "bogus", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_bogus, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_BOGUS, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "bogus", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_bogus, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: can_apply_bogus
*
@@ -1510,15 +1619,14 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
static htri_t
can_apply_bogus(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id)
{
- if(H5Tequal(type_id,H5T_NATIVE_DOUBLE))
+ if (H5Tequal(type_id, H5T_NATIVE_DOUBLE))
return 0;
- else if(H5Tequal(type_id,H5T_NATIVE_INT))
+ else if (H5Tequal(type_id, H5T_NATIVE_INT))
return 1;
else
return -1;
} /* end can_apply_bogus() */
-
/*-------------------------------------------------------------------------
* Function: filter_bogus
*
@@ -1530,13 +1638,12 @@ can_apply_bogus(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSE
*/
static size_t
filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
+ void H5_ATTR_UNUSED **buf)
{
return nbytes;
} /* end filter_bogus() */
-
/*-------------------------------------------------------------------------
* Function: set_local_bogus2
*
@@ -1551,38 +1658,37 @@ filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
static herr_t
set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id)
{
- unsigned add_on=0; /* Value to add to data going through */
- unsigned flags; /* Filter flags */
- size_t cd_nelmts=BOGUS2_PERM_NPARMS; /* Number of filter parameters */
- unsigned cd_values[4]; /* Filter parameters */
+ unsigned add_on = 0; /* Value to add to data going through */
+ unsigned flags; /* Filter flags */
+ size_t cd_nelmts = BOGUS2_PERM_NPARMS; /* Number of filter parameters */
+ unsigned cd_values[4]; /* Filter parameters */
/* Check for native integer datatype and set private property */
- if(H5Tequal(type_id,H5T_NATIVE_INT)>0)
- add_on=(unsigned)H5Tget_size(type_id);
+ if (H5Tequal(type_id, H5T_NATIVE_INT) > 0)
+ add_on = (unsigned)H5Tget_size(type_id);
/* Get the filter's current parameters */
- if(H5Pget_filter_by_id2(dcpl_id, H5Z_FILTER_SET_LOCAL_TEST, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0)
- return(FAIL);
+ if (H5Pget_filter_by_id2(dcpl_id, H5Z_FILTER_SET_LOCAL_TEST, &flags, &cd_nelmts, cd_values, (size_t)0,
+ NULL, NULL) < 0)
+ return (FAIL);
/* Check that the parameter values were passed along correctly */
- if(cd_values[0]!=BOGUS2_PARAM_1)
- return(FAIL);
- if(cd_values[1]!=BOGUS2_PARAM_2)
- return(FAIL);
+ if (cd_values[0] != BOGUS2_PARAM_1)
+ return (FAIL);
+ if (cd_values[1] != BOGUS2_PARAM_2)
+ return (FAIL);
/* Set "local" parameters for this dataset */
- cd_values[2]=(unsigned)(add_on>0); /* Flag to indicate data is modified */
- cd_values[3]=add_on; /* Amount the data was modified by */
+ cd_values[2] = (unsigned)(add_on > 0); /* Flag to indicate data is modified */
+ cd_values[3] = add_on; /* Amount the data was modified by */
/* Modify the filter's parameters for this dataset */
- if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SET_LOCAL_TEST, flags, (size_t)BOGUS2_ALL_NPARMS,
- cd_values) < 0)
- return(FAIL);
+ if (H5Pmodify_filter(dcpl_id, H5Z_FILTER_SET_LOCAL_TEST, flags, (size_t)BOGUS2_ALL_NPARMS, cd_values) < 0)
+ return (FAIL);
- return(SUCCEED);
+ return (SUCCEED);
} /* end set_local_bogus2() */
-
/*-------------------------------------------------------------------------
* Function: filter_bogus2
*
@@ -1596,47 +1702,45 @@ set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id)
*-------------------------------------------------------------------------
*/
static size_t
-filter_bogus2(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+filter_bogus2(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
/* Check for the correct number of parameters */
- if(cd_nelmts!=BOGUS2_ALL_NPARMS)
- return(0);
+ if (cd_nelmts != BOGUS2_ALL_NPARMS)
+ return (0);
/* Check that permanent parameters are set correctly */
- if(cd_values[0]!=BOGUS2_PARAM_1)
- return(0);
- if(cd_values[1]!=BOGUS2_PARAM_2)
- return(0);
+ if (cd_values[0] != BOGUS2_PARAM_1)
+ return (0);
+ if (cd_values[1] != BOGUS2_PARAM_2)
+ return (0);
/* Check if this filter is supposed to do something */
- if(cd_values[2]>0) {
+ if (cd_values[2] > 0) {
/* Check whether we are "uncompressing" */
- if(flags & H5Z_FLAG_REVERSE) {
+ if (flags & H5Z_FLAG_REVERSE) {
/* Do nothing */
} /* end if */
/* "Compressing" */
else {
- unsigned add_on=cd_values[3]; /* Get "add on" value */
- int *int_ptr=(int *)*buf; /* Pointer to the data values */
- size_t buf_left=*buf_size; /* Amount of data buffer left to process */
+ unsigned add_on = cd_values[3]; /* Get "add on" value */
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Add the "add on" value to all the data values */
- while(buf_left>0) {
+ while (buf_left > 0) {
*int_ptr++ += (int)add_on;
buf_left -= sizeof(int);
} /* end while */
- } /* end else */
+ } /* end else */
- return(nbytes);
+ return (nbytes);
} /* end if */
/* Filter is "no op" */
else
- return(nbytes);
+ return (nbytes);
} /* end filter_bogus2() */
-
/*-------------------------------------------------------------------------
* Function: filter_bogus3
*
@@ -1648,24 +1752,23 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts,
*/
static size_t
filter_bogus3(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t H5_ATTR_UNUSED nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t H5_ATTR_UNUSED nbytes,
+ size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
{
return 0;
} /* end filter_bogus3() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CORRUPT[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_CORRUPT, /* Filter id number */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_CORRUPT, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
- "corrupt", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_corrupt, /* The actual filter function */
+ "corrupt", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_corrupt, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: filter_corrupt
*
@@ -1674,42 +1777,41 @@ const H5Z_class2_t H5Z_CORRUPT[1] = {{
* fail.
*
* Return: Success: Data chunk size
- * Failure: 0
+ * Failure: 0
*-------------------------------------------------------------------------
*/
static size_t
-filter_corrupt(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+filter_corrupt(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- void *data = NULL;
- unsigned char *dst = (unsigned char*)(*buf);
+ void * data = NULL;
+ unsigned char *dst = (unsigned char *)(*buf);
unsigned int offset;
unsigned int length;
unsigned int value;
size_t ret_value = 0;
- if(cd_nelmts != 3 || !cd_values)
+ if (cd_nelmts != 3 || !cd_values)
TEST_ERROR
offset = cd_values[0];
length = cd_values[1];
value = cd_values[2];
- if(offset > nbytes || (offset + length) > nbytes || length < sizeof(unsigned int))
+ if (offset > nbytes || (offset + length) > nbytes || length < sizeof(unsigned int))
TEST_ERROR
- if(NULL == (data = HDmalloc((size_t)length)))
+ if (NULL == (data = HDmalloc((size_t)length)))
TEST_ERROR
HDmemset(data, (int)value, (size_t)length);
- if(flags & H5Z_FLAG_REVERSE) { /* Varify data is actually corrupted during read */
+ if (flags & H5Z_FLAG_REVERSE) { /* Varify data is actually corrupted during read */
dst += offset;
- if(HDmemcmp(data, dst, (size_t)length) != 0)
+ if (HDmemcmp(data, dst, (size_t)length) != 0)
TEST_ERROR
else {
*buf_size = nbytes;
ret_value = nbytes;
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
else { /* Write corrupted data */
dst += offset;
HDmemcpy(dst, data, (size_t)length);
@@ -1718,13 +1820,12 @@ filter_corrupt(unsigned int flags, size_t cd_nelmts,
} /* end else */
error:
- if(data)
+ if (data)
HDfree(data);
return ret_value;
} /* end filter_corrupt() */
-
/*-------------------------------------------------------------------------
* Function: filter_cb_cont
*
@@ -1735,15 +1836,14 @@ error:
*/
static H5Z_cb_return_t
filter_cb_cont(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size,
- void H5_ATTR_UNUSED *op_data)
+ void H5_ATTR_UNUSED *op_data)
{
- if(H5Z_FILTER_FLETCHER32==filter)
- return H5Z_CB_CONT;
+ if (H5Z_FILTER_FLETCHER32 == filter)
+ return H5Z_CB_CONT;
else
return H5Z_CB_FAIL;
} /* end filter_cb_cont() */
-
/*-------------------------------------------------------------------------
* Function: filter_cb_fail
*
@@ -1754,15 +1854,14 @@ filter_cb_cont(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU
*/
static H5Z_cb_return_t
filter_cb_fail(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size,
- void H5_ATTR_UNUSED *op_data)
+ void H5_ATTR_UNUSED *op_data)
{
- if(H5Z_FILTER_FLETCHER32==filter)
- return H5Z_CB_FAIL;
+ if (H5Z_FILTER_FLETCHER32 == filter)
+ return H5Z_CB_FAIL;
else
- return H5Z_CB_CONT;
+ return H5Z_CB_CONT;
} /* end filter_cb_fail() */
-
/*-------------------------------------------------------------------------
* Function: test_filter_internal
*
@@ -1776,51 +1875,55 @@ filter_cb_fail(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU
*-------------------------------------------------------------------------
*/
static herr_t
-test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
- int corrupted, hsize_t *dset_size)
+test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, int corrupted,
+ hsize_t *dset_size)
{
- hid_t dataset; /* Dataset ID */
- hid_t dxpl; /* Dataset xfer property list ID */
- hid_t write_dxpl; /* Dataset xfer property list ID for writing */
- hid_t sid; /* Dataspace ID */
- const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */
- const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */
- void *tconv_buf = NULL; /* Temporary conversion buffer */
- size_t i, j, n; /* Local index variables */
- herr_t status; /* Error status */
+ hid_t dataset; /* Dataset ID */
+ hid_t dxpl; /* Dataset xfer property list ID */
+ hid_t write_dxpl; /* Dataset xfer property list ID for writing */
+ hid_t sid; /* Dataspace ID */
+ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */
+ const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */
+ void * tconv_buf = NULL; /* Temporary conversion buffer */
+ size_t i, j, n; /* Local index variables */
+ herr_t status; /* Error status */
/* Create the data space */
- if((sid = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((sid = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/*
* Create a small conversion buffer to test strip mining. We
* might as well test all we can!
*/
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error;
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
tconv_buf = HDmalloc((size_t)1000);
- if(H5Pset_buffer(dxpl, (size_t)1000, tconv_buf, NULL) < 0) goto error;
- if((write_dxpl = H5Pcopy(dxpl)) < 0) TEST_ERROR;
+ if (H5Pset_buffer(dxpl, (size_t)1000, tconv_buf, NULL) < 0)
+ goto error;
+ if ((write_dxpl = H5Pcopy(dxpl)) < 0)
+ TEST_ERROR;
- if(if_fletcher32==DISABLE_FLETCHER32) {
- if(H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC) < 0)
+ if (if_fletcher32 == DISABLE_FLETCHER32) {
+ if (H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC) < 0)
goto error;
- if(H5Z_DISABLE_EDC != H5Pget_edc_check(dxpl))
+ if (H5Z_DISABLE_EDC != H5Pget_edc_check(dxpl))
goto error;
}
TESTING(" filters (setup)");
/* Check if all the filters are available */
- if(H5Pall_filters_avail(dcpl)!=TRUE) {
+ if (H5Pall_filters_avail(dcpl) != TRUE) {
H5_FAILED();
- HDprintf(" Line %d: Incorrect filter availability\n",__LINE__);
+ HDprintf(" Line %d: Incorrect filter availability\n", __LINE__);
goto error;
} /* end if */
/* Create the dataset */
- if((dataset = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT,
- dcpl, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
PASSED();
@@ -1830,20 +1933,19 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
*/
TESTING(" filters (uninitialized read)");
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
- TEST_ERROR;
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
+ TEST_ERROR;
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(0!=check[i][j]) {
- H5_FAILED();
- HDprintf(" Read a non-zero value.\n");
- HDprintf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- goto error;
+ for (i = 0; i < (size_t)size[0]; i++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (0 != check[i][j]) {
+ H5_FAILED();
+ HDprintf(" Read a non-zero value.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ goto error;
+ }
}
}
- }
PASSED();
/*----------------------------------------------------------------------
@@ -1853,16 +1955,17 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
*/
TESTING(" filters (write)");
- for(i=n=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
+ for (i = n = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
points[i][j] = (int)(n++);
}
}
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0)
TEST_ERROR;
- if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR;
+ if ((*dset_size = H5Dget_storage_size(dataset)) == 0)
+ TEST_ERROR;
PASSED();
@@ -1873,40 +1976,42 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
TESTING(" filters (read)");
/* Read the dataset back */
- if(corrupted) {
+ if (corrupted) {
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
- H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
- } H5E_END_TRY;
- if(status>=0) TEST_ERROR;
+ H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
- if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
+ if (H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0)
+ TEST_ERROR;
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
- if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
+ if (H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0)
+ TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
- H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
- } H5E_END_TRY;
- if(status>=0) TEST_ERROR;
+ H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR;
}
else {
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if(points[i][j] != check[i][j]) {
+ for (i = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
+ if (points[i][j] != check[i][j]) {
H5_FAILED();
- HDfprintf(stderr," Read different values than written.\n");
- HDfprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- HDfprintf(stderr," At original: %d\n", (int)points[i][j]);
- HDfprintf(stderr," At returned: %d\n", (int)check[i][j]);
+ HDfprintf(stderr, " Read different values than written.\n");
+ HDfprintf(stderr, " At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDfprintf(stderr, " At original: %d\n", (int)points[i][j]);
+ HDfprintf(stderr, " At returned: %d\n", (int)check[i][j]);
goto error;
}
}
@@ -1924,55 +2029,57 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
*/
TESTING(" filters (modify)");
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]/2; j++) {
- points[i][j] = (int)HDrandom ();
+ for (i = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1] / 2; j++) {
+ points[i][j] = (int)HDrandom();
}
}
- if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0)
TEST_ERROR;
- if(corrupted) {
+ if (corrupted) {
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
- H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
- } H5E_END_TRY;
- if(status>=0) TEST_ERROR;
+ H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
- if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
+ if (H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0)
+ TEST_ERROR;
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
- if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
+ if (H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0)
+ TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
- H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
- } H5E_END_TRY;
- if(status>=0) TEST_ERROR;
+ H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR;
}
else {
/* Read the dataset back and check it */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if(points[i][j] != check[i][j]) {
+ for (i = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
+ if (points[i][j] != check[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
- HDprintf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
}
}
}
}
- if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR;
+ if ((*dset_size = H5Dget_storage_size(dataset)) == 0)
+ TEST_ERROR;
PASSED();
/*----------------------------------------------------------------------
@@ -1983,50 +2090,52 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
*/
TESTING(" filters (re-open)");
- if(H5Dclose(dataset) < 0) TEST_ERROR;
- if((dataset = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+ if ((dataset = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if(corrupted) {
+ if (corrupted) {
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
- H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
- } H5E_END_TRY;
- if(status >= 0) TEST_ERROR;
+ H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
- if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
+ if (H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0)
+ TEST_ERROR;
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
- if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
+ if (H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0)
+ TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
- H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
- } H5E_END_TRY;
- if(status >= 0) TEST_ERROR;
+ H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR;
} /* end if */
else {
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i = 0; i < size[0]; i++)
- for(j = 0; j < size[1]; j++)
- if(points[i][j] != check[i][j]) {
+ for (i = 0; i < size[0]; i++)
+ for (j = 0; j < size[1]; j++)
+ if (points[i][j] != check[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
- HDprintf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
} /* end if */
- } /* end else */
+ } /* end else */
PASSED();
-
/*----------------------------------------------------------------------
* STEP 6: Test partial I/O by writing to and then reading from a
* hyperslab of the dataset. The hyperslab does not line up on chunk
@@ -2035,56 +2144,58 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
*/
TESTING(" filters (partial I/O)");
- for(i=0; i<(size_t)hs_size[0]; i++) {
- for(j=0; j<(size_t)hs_size[1]; j++) {
- points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] = (int)HDrandom();
+ for (i = 0; i < (size_t)hs_size[0]; i++) {
+ for (j = 0; j < (size_t)hs_size[1]; j++) {
+ points[(size_t)hs_offset[0] + i][(size_t)hs_offset[1] + j] = (int)HDrandom();
}
}
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size,
- NULL) < 0) TEST_ERROR;
- /* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */
- if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points_data) < 0)
- TEST_ERROR;
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
+ TEST_ERROR;
+ /* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing)
+ */
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, sid, sid, dxpl, points_data) < 0)
+ TEST_ERROR;
- if(corrupted) {
+ if (corrupted) {
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
- H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
- } H5E_END_TRY;
- if(status>=0) TEST_ERROR;
+ H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
- if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
+ if (H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0)
+ TEST_ERROR;
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
- if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
+ if (H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0)
+ TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
- H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
- } H5E_END_TRY;
- if(status>=0) TEST_ERROR;
+ H5E_BEGIN_TRY { status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR;
}
else {
- if(H5Dread(dataset, H5T_NATIVE_INT, sid, sid, dxpl, check_data) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, sid, sid, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)hs_size[0]; i++) {
- for(j=0; j<(size_t)hs_size[1]; j++) {
- if(points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] !=
- check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]) {
+ for (i = 0; i < (size_t)hs_size[0]; i++) {
+ for (j = 0; j < (size_t)hs_size[1]; j++) {
+ if (points[(size_t)hs_offset[0] + i][(size_t)hs_offset[1] + j] !=
+ check[(size_t)hs_offset[0] + i][(size_t)hs_offset[1] + j]) {
H5_FAILED();
- HDfprintf(stderr," Read different values than written.\n");
- HDfprintf(stderr," At index %lu,%lu\n",
- (unsigned long)((size_t)hs_offset[0]+i),
- (unsigned long)((size_t)hs_offset[1]+j));
- HDfprintf(stderr," At original: %d\n",
- (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
- HDfprintf(stderr," At returned: %d\n",
- (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
+ HDfprintf(stderr, " Read different values than written.\n");
+ HDfprintf(stderr, " At index %lu,%lu\n", (unsigned long)((size_t)hs_offset[0] + i),
+ (unsigned long)((size_t)hs_offset[1] + j));
+ HDfprintf(stderr, " At original: %d\n",
+ (int)points[(size_t)hs_offset[0] + i][(size_t)hs_offset[1] + j]);
+ HDfprintf(stderr, " At returned: %d\n",
+ (int)check[(size_t)hs_offset[0] + i][(size_t)hs_offset[1] + j]);
goto error;
}
}
@@ -2092,22 +2203,27 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
}
/* Get the storage size of the dataset */
- if((*dset_size=H5Dget_storage_size(dataset))==0) goto error;
+ if ((*dset_size = H5Dget_storage_size(dataset)) == 0)
+ goto error;
PASSED();
/* Clean up objects used for this test */
- if(H5Dclose (dataset) < 0) goto error;
- if(H5Sclose (sid) < 0) goto error;
- if(H5Pclose (dxpl) < 0) goto error;
- if(H5Pclose (write_dxpl) < 0) goto error;
- HDfree (tconv_buf);
+ if (H5Dclose(dataset) < 0)
+ goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Pclose(dxpl) < 0)
+ goto error;
+ if (H5Pclose(write_dxpl) < 0)
+ goto error;
+ HDfree(tconv_buf);
return SUCCEED;
error:
- if(tconv_buf)
- HDfree (tconv_buf);
+ if (tconv_buf)
+ HDfree(tconv_buf);
return FAIL;
} /* end test_filter_internal() */
@@ -2126,16 +2242,16 @@ error:
static herr_t
test_filter_noencoder(const char *dset_name)
{
- hid_t file_id = -1;
- hid_t dset_id = -1;
- hid_t test_dset_id = -1;
- hid_t dcpl_id = -1;
- hid_t space_id = -1;
- hsize_t dims = 10;
- herr_t err;
- int test_ints[10] = { 12 };
- int read_buf[10];
- int i;
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t test_dset_id = -1;
+ hid_t dcpl_id = -1;
+ hid_t space_id = -1;
+ hsize_t dims = 10;
+ herr_t err;
+ int test_ints[10] = {12};
+ int read_buf[10];
+ int i;
/* Make a local copy of the file since this test writes to the data file
from svn. */
@@ -2144,22 +2260,26 @@ test_filter_noencoder(const char *dset_name)
/* Open file */
file_id = H5Fopen(NOENCODER_COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- if(file_id < 0) goto error;
+ if (file_id < 0)
+ goto error;
dset_id = H5Dopen2(file_id, dset_name, H5P_DEFAULT);
- if(dset_id < 0) goto error;
+ if (dset_id < 0)
+ goto error;
space_id = H5Screate_simple(1, &dims, NULL);
- if(space_id < 0) goto error;
+ if (space_id < 0)
+ goto error;
TESTING(" decoding without encoder");
/* Read the dataset and make sure the decoder is working correctly */
err = H5Dread(dset_id, H5T_NATIVE_INT, space_id, space_id, H5P_DEFAULT, read_buf);
- if(err < 0) goto error;
+ if (err < 0)
+ goto error;
- for(i = 0; i < 10; i++)
- if(read_buf[i] != i)
+ for (i = 0; i < 10; i++)
+ if (read_buf[i] != i)
goto error;
H5Sclose(space_id);
@@ -2173,36 +2293,42 @@ test_filter_noencoder(const char *dset_name)
TESTING(" trying to write without encoder");
dcpl_id = H5Dget_create_plist(dset_id);
- if(dcpl_id < 0) goto error;
+ if (dcpl_id < 0)
+ goto error;
space_id = H5Screate_simple(1, &dims, NULL);
- if(space_id < 0) goto error;
+ if (space_id < 0)
+ goto error;
- H5E_BEGIN_TRY{
- test_dset_id = H5Dcreate2(file_id, NOENCODER_TEST_DATASET, H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
- }H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ test_dset_id = H5Dcreate2(file_id, NOENCODER_TEST_DATASET, H5T_NATIVE_INT, space_id, H5P_DEFAULT,
+ dcpl_id, H5P_DEFAULT);
+ }
+ H5E_END_TRY
- if(test_dset_id >= 0) goto error;
+ if (test_dset_id >= 0)
+ goto error;
/* Attempt to extend the dataset. This should fail because
* the dataset has a fill value and is instructed to fill on
* allocation.
*/
dims = 20; /* Dataset is originally of size 10 */
- H5E_BEGIN_TRY{
- err = H5Dset_extent(dset_id, &dims);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { err = H5Dset_extent(dset_id, &dims); }
+ H5E_END_TRY
- if(err >= 0) goto error;
+ if (err >= 0)
+ goto error;
/* Attempt to write to the dataset. This should fail because
* the filter does not have an encoder.
*/
- H5E_BEGIN_TRY{
- err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints); }
+ H5E_END_TRY
- if(err >= 0) goto error;
+ if (err >= 0)
+ goto error;
H5Fclose(file_id);
H5Dclose(dset_id);
@@ -2215,15 +2341,15 @@ test_filter_noencoder(const char *dset_name)
error:
H5_FAILED();
- if(dset_id != -1)
+ if (dset_id != -1)
H5Dclose(dset_id);
- if(test_dset_id != -1)
+ if (test_dset_id != -1)
H5Dclose(test_dset_id);
- if(space_id != -1)
+ if (space_id != -1)
H5Sclose(space_id);
- if(dcpl_id != -1)
+ if (dcpl_id != -1)
H5Pclose(dcpl_id);
- if(file_id != -1)
+ if (file_id != -1)
H5Fclose(file_id);
return FAIL;
@@ -2242,61 +2368,65 @@ error:
static herr_t
test_get_filter_info(void)
{
- unsigned int flags; /* flags returned from H5Zget_filter_info */
- herr_t err;
+ unsigned int flags; /* flags returned from H5Zget_filter_info */
+ herr_t err;
- TESTING("H5Zget_filter_info");
+ TESTING("H5Zget_filter_info");
- /* Verify that each filter is reported as having the right combination
- * of encoder and decoder.
- */
- if(H5Zget_filter_info(H5Z_FILTER_FLETCHER32, &flags) < 0) TEST_ERROR
+ /* Verify that each filter is reported as having the right combination
+ * of encoder and decoder.
+ */
+ if (H5Zget_filter_info(H5Z_FILTER_FLETCHER32, &flags) < 0)
+ TEST_ERROR
- if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
- ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
- TEST_ERROR
+ if (((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
+ ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
+ TEST_ERROR
- if(H5Zget_filter_info(H5Z_FILTER_SHUFFLE, &flags) < 0) TEST_ERROR
+ if (H5Zget_filter_info(H5Z_FILTER_SHUFFLE, &flags) < 0)
+ TEST_ERROR
- if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
- ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
- TEST_ERROR
+ if (((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
+ ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
+ TEST_ERROR
#ifdef H5_HAVE_FILTER_DEFLATE
- if(H5Zget_filter_info(H5Z_FILTER_DEFLATE, &flags) < 0) TEST_ERROR
+ if (H5Zget_filter_info(H5Z_FILTER_DEFLATE, &flags) < 0)
+ TEST_ERROR
- if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
- ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
- TEST_ERROR
+ if (((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
+ ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
+ TEST_ERROR
#endif
#ifdef H5_HAVE_FILTER_SZIP
- if(H5Zget_filter_info(H5Z_FILTER_SZIP, &flags) < 0) TEST_ERROR
+ if (H5Zget_filter_info(H5Z_FILTER_SZIP, &flags) < 0)
+ TEST_ERROR
- if(H5Z_SZIP->encoder_present) {
- if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
- ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
+ if (H5Z_SZIP->encoder_present) {
+ if (((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
+ ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
TEST_ERROR
} /* end if */
else {
- if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) != 0) ||
- ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
+ if (((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) != 0) ||
+ ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
TEST_ERROR
- } /* end else */
+ } /* end else */
#endif /* H5_HAVE_FILTER_SZIP */
- /* Verify that get_filter_info throws an error when given a bad filter */
- /* (Depends on 1.6 compatibility flag) */
- H5E_BEGIN_TRY {
- err = H5Zget_filter_info(-1, &flags);
- } H5E_END_TRY;
- if(err >= 0) TEST_ERROR
+ /* Verify that get_filter_info throws an error when given a bad filter */
+ /* (Depends on 1.6 compatibility flag) */
+ H5E_BEGIN_TRY { err = H5Zget_filter_info(-1, &flags); }
+ H5E_END_TRY;
+ if (err >= 0)
+ TEST_ERROR
- PASSED();
- return SUCCEED;
+ PASSED();
+ return SUCCEED;
error:
- return FAIL;
+ return FAIL;
} /* end test_get_filter_info() */
/*-------------------------------------------------------------------------
@@ -2311,63 +2441,76 @@ error:
static herr_t
test_filters(hid_t file, hid_t
#ifndef H5_HAVE_FILTER_SZIP
-H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5_HAVE_FILTER_SZIP */
- fapl)
+ fapl)
{
- hid_t dc; /* Dataset creation property list ID */
- const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
- hsize_t null_size; /* Size of dataset with null filter */
+ hid_t dc; /* Dataset creation property list ID */
+ const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
+ hsize_t null_size; /* Size of dataset with null filter */
- hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */
- unsigned data_corrupt[3]; /* position and length of data to be corrupted */
+ hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */
+ unsigned data_corrupt[3]; /* position and length of data to be corrupted */
#ifdef H5_HAVE_FILTER_DEFLATE
- hsize_t deflate_size; /* Size of dataset with deflate filter */
-#endif /* H5_HAVE_FILTER_DEFLATE */
+ hsize_t deflate_size; /* Size of dataset with deflate filter */
+#endif /* H5_HAVE_FILTER_DEFLATE */
#ifdef H5_HAVE_FILTER_SZIP
- hsize_t szip_size; /* Size of dataset with szip filter */
- unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block = 4;
+ hsize_t szip_size; /* Size of dataset with szip filter */
+ unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 4;
#endif /* H5_HAVE_FILTER_SZIP */
- hsize_t shuffle_size; /* Size of dataset with shuffle filter */
+ hsize_t shuffle_size; /* Size of dataset with shuffle filter */
#if defined(H5_HAVE_FILTER_DEFLATE) || defined(H5_HAVE_FILTER_SZIP)
- hsize_t combo_size; /* Size of dataset with multiple filters */
-#endif /* defined(H5_HAVE_FILTER_DEFLATE) || defined(H5_HAVE_FILTER_SZIP) */
+ hsize_t combo_size; /* Size of dataset with multiple filters */
+#endif /* defined(H5_HAVE_FILTER_DEFLATE) || defined(H5_HAVE_FILTER_SZIP) */
/* test the H5Zget_filter_info function */
- if(test_get_filter_info() < 0) goto error;
+ if (test_get_filter_info() < 0)
+ goto error;
/*----------------------------------------------------------
* STEP 0: Test null I/O filter by itself.
*----------------------------------------------------------
*/
HDputs("Testing 'null' filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Zregister (H5Z_BOGUS) < 0) goto error;
- if(H5Pset_filter(dc, H5Z_FILTER_BOGUS, 0, (size_t)0, NULL) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Zregister(H5Z_BOGUS) < 0)
+ goto error;
+ if (H5Pset_filter(dc, H5Z_FILTER_BOGUS, 0, (size_t)0, NULL) < 0)
+ goto error;
- if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size) < 0) goto error;
+ if (test_filter_internal(file, DSET_BOGUS_NAME, dc, DISABLE_FLETCHER32, DATA_NOT_CORRUPTED, &null_size) <
+ 0)
+ goto error;
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
/*----------------------------------------------------------
* STEP 1: Test Fletcher32 Checksum by itself.
*----------------------------------------------------------
*/
HDputs("Testing Fletcher32 checksum(enabled for read)");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_filter(dc, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_filter(dc, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL) < 0)
+ goto error;
/* Enable checksum during read */
- if(test_filter_internal(file,DSET_FLETCHER32_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size) < 0) goto error;
- if(fletcher32_size<=null_size) {
+ if (test_filter_internal(file, DSET_FLETCHER32_NAME, dc, ENABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &fletcher32_size) < 0)
+ goto error;
+ if (fletcher32_size <= null_size) {
H5_FAILED();
HDputs(" Size after checksumming is incorrect.");
goto error;
@@ -2375,8 +2518,10 @@ H5_ATTR_UNUSED
/* Disable checksum during read */
HDputs("Testing Fletcher32 checksum(disabled for read)");
- if(test_filter_internal(file,DSET_FLETCHER32_NAME_2,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size) < 0) goto error;
- if(fletcher32_size<=null_size) {
+ if (test_filter_internal(file, DSET_FLETCHER32_NAME_2, dc, DISABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &fletcher32_size) < 0)
+ goto error;
+ if (fletcher32_size <= null_size) {
H5_FAILED();
HDputs(" Size after checksumming is incorrect.");
goto error;
@@ -2388,52 +2533,68 @@ H5_ATTR_UNUSED
data_corrupt[1] = 33;
data_corrupt[2] = 27;
- if(H5Zregister (H5Z_CORRUPT) < 0) goto error;
- if(H5Pset_filter(dc, H5Z_FILTER_CORRUPT, 0, (size_t)3, data_corrupt) < 0) goto error;
- if(test_filter_internal(file,DSET_FLETCHER32_NAME_3,dc,DISABLE_FLETCHER32,DATA_CORRUPTED,&fletcher32_size) < 0) goto error;
- if(fletcher32_size<=null_size) {
+ if (H5Zregister(H5Z_CORRUPT) < 0)
+ goto error;
+ if (H5Pset_filter(dc, H5Z_FILTER_CORRUPT, 0, (size_t)3, data_corrupt) < 0)
+ goto error;
+ if (test_filter_internal(file, DSET_FLETCHER32_NAME_3, dc, DISABLE_FLETCHER32, DATA_CORRUPTED,
+ &fletcher32_size) < 0)
+ goto error;
+ if (fletcher32_size <= null_size) {
H5_FAILED();
HDputs(" Size after checksumming is incorrect.");
goto error;
} /* end if */
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
-
+ if (H5Pclose(dc) < 0)
+ goto error;
- /*----------------------------------------------------------
- * STEP 2: Test deflation by itself.
- *----------------------------------------------------------
- */
+ /*----------------------------------------------------------
+ * STEP 2: Test deflation by itself.
+ *----------------------------------------------------------
+ */
#ifdef H5_HAVE_FILTER_DEFLATE
HDputs("Testing deflate filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_deflate (dc, 6) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_deflate(dc, 6) < 0)
+ goto error;
- if(test_filter_internal(file,DSET_DEFLATE_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deflate_size) < 0) goto error;
+ if (test_filter_internal(file, DSET_DEFLATE_NAME, dc, DISABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &deflate_size) < 0)
+ goto error;
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
-#else /* H5_HAVE_FILTER_DEFLATE */
+ if (H5Pclose(dc) < 0)
+ goto error;
+#else /* H5_HAVE_FILTER_DEFLATE */
TESTING("deflate filter");
SKIPPED();
HDputs(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
- /*----------------------------------------------------------
- * STEP 3: Test szip compression by itself.
- *----------------------------------------------------------
- */
+ /*----------------------------------------------------------
+ * STEP 3: Test szip compression by itself.
+ *----------------------------------------------------------
+ */
#ifdef H5_HAVE_FILTER_SZIP
TESTING("szip filter (with encoder)");
- if( h5_szip_can_encode() == 1) {
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
+ if (h5_szip_can_encode() == 1) {
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
- HDputs("");
- if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error;
- if(test_filter_internal(file,DSET_SZIP_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&szip_size) < 0) goto error;
- if(H5Pclose (dc) < 0) goto error;
+ HDputs("");
+ if (H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0)
+ goto error;
+ if (test_filter_internal(file, DSET_SZIP_NAME, dc, DISABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &szip_size) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
}
else {
SKIPPED();
@@ -2441,15 +2602,16 @@ H5_ATTR_UNUSED
TESTING("szip filter (without encoder)");
- if( h5_szip_can_encode() != 1) {
+ if (h5_szip_can_encode() != 1) {
HDputs("");
- if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error;
+ if (test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0)
+ goto error;
}
else {
SKIPPED();
}
-#else /* H5_HAVE_FILTER_SZIP */
+#else /* H5_HAVE_FILTER_SZIP */
TESTING("szip filter");
SKIPPED();
HDputs(" Szip filter not enabled");
@@ -2460,71 +2622,100 @@ H5_ATTR_UNUSED
*----------------------------------------------------------
*/
HDputs("Testing shuffle filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_shuffle (dc) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_shuffle(dc) < 0)
+ goto error;
- if(test_filter_internal(file,DSET_SHUFFLE_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&shuffle_size) < 0) goto error;
- if(shuffle_size!=null_size) {
+ if (test_filter_internal(file, DSET_SHUFFLE_NAME, dc, DISABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &shuffle_size) < 0)
+ goto error;
+ if (shuffle_size != null_size) {
H5_FAILED();
HDputs(" Shuffled size not the same as uncompressed size.");
goto error;
} /* end if */
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
- /*----------------------------------------------------------
- * STEP 5: Test shuffle + deflate + checksum in any order.
- *----------------------------------------------------------
- */
+ /*----------------------------------------------------------
+ * STEP 5: Test shuffle + deflate + checksum in any order.
+ *----------------------------------------------------------
+ */
#ifdef H5_HAVE_FILTER_DEFLATE
HDputs("Testing shuffle+deflate+checksum filters(checksum first)");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_fletcher32 (dc) < 0) goto error;
- if(H5Pset_shuffle (dc) < 0) goto error;
- if(H5Pset_deflate (dc, 6) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_fletcher32(dc) < 0)
+ goto error;
+ if (H5Pset_shuffle(dc) < 0)
+ goto error;
+ if (H5Pset_deflate(dc, 6) < 0)
+ goto error;
- if(test_filter_internal(file,DSET_SHUF_DEF_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error;
+ if (test_filter_internal(file, DSET_SHUF_DEF_FLET_NAME, dc, ENABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &combo_size) < 0)
+ goto error;
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
HDputs("Testing shuffle+deflate+checksum filters(checksum last)");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_shuffle (dc) < 0) goto error;
- if(H5Pset_deflate (dc, 6) < 0) goto error;
- if(H5Pset_fletcher32 (dc) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_shuffle(dc) < 0)
+ goto error;
+ if (H5Pset_deflate(dc, 6) < 0)
+ goto error;
+ if (H5Pset_fletcher32(dc) < 0)
+ goto error;
- if(test_filter_internal(file,DSET_SHUF_DEF_FLET_NAME_2,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error;
+ if (test_filter_internal(file, DSET_SHUF_DEF_FLET_NAME_2, dc, ENABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &combo_size) < 0)
+ goto error;
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
-#else /* H5_HAVE_FILTER_DEFLATE */
+ if (H5Pclose(dc) < 0)
+ goto error;
+#else /* H5_HAVE_FILTER_DEFLATE */
TESTING("shuffle+deflate+fletcher32 filters");
SKIPPED();
HDputs(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
- /*----------------------------------------------------------
- * STEP 6: Test shuffle + szip + checksum in any order.
- *----------------------------------------------------------
- */
+ /*----------------------------------------------------------
+ * STEP 6: Test shuffle + szip + checksum in any order.
+ *----------------------------------------------------------
+ */
#ifdef H5_HAVE_FILTER_SZIP
TESTING("shuffle+szip+checksum filters(checksum first, with encoder)");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_fletcher32 (dc) < 0) goto error;
- if(H5Pset_shuffle (dc) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_fletcher32(dc) < 0)
+ goto error;
+ if (H5Pset_shuffle(dc) < 0)
+ goto error;
/* Make sure encoding is enabled */
- if( h5_szip_can_encode() == 1) {
+ if (h5_szip_can_encode() == 1) {
HDputs("");
- if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error;
- if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error;
+ if (H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0)
+ goto error;
+ if (test_filter_internal(file, DSET_SHUF_SZIP_FLET_NAME, dc, ENABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &combo_size) < 0)
+ goto error;
}
else {
SKIPPED();
@@ -2532,38 +2723,48 @@ H5_ATTR_UNUSED
TESTING("shuffle+szip+checksum filters(checksum first, without encoder)");
- if( h5_szip_can_encode() != 1) {
+ if (h5_szip_can_encode() != 1) {
HDputs("");
- if(test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error;
+ if (test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0)
+ goto error;
}
else {
SKIPPED();
}
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
TESTING("shuffle+szip+checksum filters(checksum last, with encoder)");
/* Make sure encoding is enabled */
- if( h5_szip_can_encode() == 1) {
+ if (h5_szip_can_encode() == 1) {
HDputs("");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_shuffle (dc) < 0) goto error;
- if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error;
- if(H5Pset_fletcher32 (dc) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_shuffle(dc) < 0)
+ goto error;
+ if (H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0)
+ goto error;
+ if (H5Pset_fletcher32(dc) < 0)
+ goto error;
- if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME_2,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error;
+ if (test_filter_internal(file, DSET_SHUF_SZIP_FLET_NAME_2, dc, ENABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &combo_size) < 0)
+ goto error;
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
}
else {
SKIPPED();
}
-#else /* H5_HAVE_FILTER_SZIP */
+#else /* H5_HAVE_FILTER_SZIP */
TESTING("shuffle+szip+fletcher32 filters");
SKIPPED();
HDputs(" szip filter not enabled");
@@ -2574,7 +2775,6 @@ error:
return FAIL;
} /* end test_filters() */
-
/*-------------------------------------------------------------------------
* Function: test_missing_filter
*
@@ -2586,242 +2786,244 @@ error:
static herr_t
test_missing_filter(hid_t file)
{
- hid_t fid; /* File ID */
- hid_t dsid; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t dcpl; /* Dataspace creation property list ID */
- const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
- hsize_t dset_size; /* Dataset size */
- size_t i,j; /* Local index variables */
- herr_t ret; /* Generic return value */
- const char *testfile = H5_get_srcdir_filename(FILE_DEFLATE_NAME); /* Corrected test file name */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t fid; /* File ID */
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataspace creation property list ID */
+ const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
+ hsize_t dset_size; /* Dataset size */
+ size_t i, j; /* Local index variables */
+ herr_t ret; /* Generic return value */
+ const char * testfile = H5_get_srcdir_filename(FILE_DEFLATE_NAME); /* Corrected test file name */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
TESTING("dataset access with missing filter");
/* Unregister the deflate filter */
#ifdef H5_HAVE_FILTER_DEFLATE
- /* Verify deflate filter is registered currently */
- if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) {
- H5_FAILED();
- HDprintf(" Line %d: Deflate filter not available\n",__LINE__);
- goto error;
- } /* end if */
+ /* Verify deflate filter is registered currently */
+ if (H5Zfilter_avail(H5Z_FILTER_DEFLATE) != TRUE) {
+ H5_FAILED();
+ HDprintf(" Line %d: Deflate filter not available\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
- api_ctx_pushed = TRUE;
+ /* Push API context */
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
+ api_ctx_pushed = TRUE;
- /* Unregister deflate filter */
- /* (Use private routine, to avoid range checking on filter ID) */
- if(H5Z__unregister(H5Z_FILTER_DEFLATE) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__);
- goto error;
- } /* end if */
+ /* Unregister deflate filter */
+ /* (Use private routine, to avoid range checking on filter ID) */
+ if (H5Z__unregister(H5Z_FILTER_DEFLATE) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't unregister deflate filter\n", __LINE__);
+ goto error;
+ } /* end if */
#endif /* H5_HAVE_FILTER_DEFLATE */
- /* Verify deflate filter is not registered currently */
- if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) {
- H5_FAILED();
- HDprintf(" Line %d: Deflate filter available\n",__LINE__);
- goto error;
- } /* end if */
+ /* Verify deflate filter is not registered currently */
+ if (H5Zfilter_avail(H5Z_FILTER_DEFLATE) != FALSE) {
+ H5_FAILED();
+ HDprintf(" Line %d: Deflate filter available\n", __LINE__);
+ goto error;
+ } /* end if */
/* Create dcpl with deflate filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n", __LINE__);
goto error;
} /* end if */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n", __LINE__);
goto error;
} /* end if */
- if(H5Pset_deflate(dcpl, 9) < 0) {
+ if (H5Pset_deflate(dcpl, 9) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't set deflate filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set deflate filter\n", __LINE__);
goto error;
} /* end if */
/* Check if all the filters are available */
- ret=H5Pall_filters_avail(dcpl);
- if(ret<0) {
+ ret = H5Pall_filters_avail(dcpl);
+ if (ret < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't check filter availability\n",__LINE__);
+ HDprintf(" Line %d: Can't check filter availability\n", __LINE__);
goto error;
} /* end if */
- if(ret!=FALSE) {
+ if (ret != FALSE) {
H5_FAILED();
- HDprintf(" Line %d: Filter shouldn't be available\n",__LINE__);
+ HDprintf(" Line %d: Filter shouldn't be available\n", __LINE__);
goto error;
} /* end if */
/* Create the data space */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n", __LINE__);
goto error;
} /* end if */
/* Create new dataset */
- if((dsid = H5Dcreate2(file, DSET_MISSING_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ if ((dsid = H5Dcreate2(file, DSET_MISSING_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) <
+ 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n", __LINE__);
goto error;
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n", __LINE__);
goto error;
} /* end if */
/* Flush the file (to clear the cache) */
- if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
+ if (H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error flushing file\n",__LINE__);
+ HDprintf(" Line %d: Error flushing file\n", __LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
- if(0 == (dset_size = H5Dget_storage_size(dsid))) {
+ if (0 == (dset_size = H5Dget_storage_size(dsid))) {
H5_FAILED();
- HDprintf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size);
+ HDprintf(" Line %d: Error querying dataset size, dset_size=%lu\n", __LINE__,
+ (unsigned long)dset_size);
goto error;
} /* end if */
/* Verify that the size indicates data is uncompressed */
/* (i.e. the deflation filter we asked for was silently ignored) */
- if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) {
+ if ((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) {
H5_FAILED();
- HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
+ HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
+ if (H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
} /* end if */
/* Compare data */
/* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)dims[0]; i++) {
- for(j=0; j<(size_t)dims[1]; j++) {
- if(points[i][j] != check[i][j]) {
+ for (i = 0; i < (size_t)dims[0]; i++) {
+ for (j = 0; j < (size_t)dims[1]; j++) {
+ if (points[i][j] != check[i][j]) {
H5_FAILED();
- HDprintf(" Line %d: Read different values than written.\n",__LINE__);
+ HDprintf(" Line %d: Read different values than written.\n", __LINE__);
HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- HDprintf(" At original: %d\n",points[i][j]);
- HDprintf(" At returned: %d\n",check[i][j]);
+ HDprintf(" At original: %d\n", points[i][j]);
+ HDprintf(" At returned: %d\n", check[i][j]);
goto error;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close dataset */
- if(H5Dclose(dsid) < 0) {
+ if (H5Dclose(dsid) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Close dataspace */
- if(H5Sclose(sid) < 0) {
+ if (H5Sclose(sid) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataspace\n", __LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
- if(H5Pclose(dcpl) < 0) {
+ if (H5Pclose(dcpl) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't close dcpl\n", __LINE__);
goto error;
} /* end if */
-
/* Try reading existing dataset with deflate filter */
/* Open existing file */
- if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ if ((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't open existing deflated file\n", __LINE__);
goto error;
} /* end if */
/* Open dataset */
- if((dsid = H5Dopen2(fid, "Dataset1", H5P_DEFAULT)) < 0) {
+ if ((dsid = H5Dopen2(fid, "Dataset1", H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't open dataset\n", __LINE__);
goto error;
} /* end if */
/* Read data (should fail, since deflate filter is missing) */
- H5E_BEGIN_TRY {
- ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data);
- } H5E_END_TRY;
- if(ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
HDprintf(" Line %d: Should not be able to read dataset data\n", __LINE__);
goto error;
} /* end if */
/* Close dataset */
- if(H5Dclose(dsid) < 0) {
+ if (H5Dclose(dsid) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Close existing file */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't close file\n", __LINE__);
goto error;
} /* end if */
/* Re-register the deflate filter */
- /* Verify deflate filter is not registered currently */
- if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) {
- H5_FAILED();
- HDprintf(" Line %d: Deflate filter available\n",__LINE__);
- goto error;
- } /* end if */
+ /* Verify deflate filter is not registered currently */
+ if (H5Zfilter_avail(H5Z_FILTER_DEFLATE) != FALSE) {
+ H5_FAILED();
+ HDprintf(" Line %d: Deflate filter available\n", __LINE__);
+ goto error;
+ } /* end if */
#ifdef H5_HAVE_FILTER_DEFLATE
- /* Register deflate filter (use internal function to avoid range checks) */
- if(H5Z_register(H5Z_DEFLATE) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__);
- goto error;
- } /* end if */
+ /* Register deflate filter (use internal function to avoid range checks) */
+ if (H5Z_register(H5Z_DEFLATE) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't unregister deflate filter\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Verify deflate filter is registered currently */
- if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) {
- H5_FAILED();
- HDprintf(" Line %d: Deflate filter not available\n",__LINE__);
- goto error;
- } /* end if */
+ /* Verify deflate filter is registered currently */
+ if (H5Zfilter_avail(H5Z_FILTER_DEFLATE) != TRUE) {
+ H5_FAILED();
+ HDprintf(" Line %d: Deflate filter not available\n", __LINE__);
+ goto error;
+ } /* end if */
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
PASSED();
return SUCCEED;
error:
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
return FAIL;
} /* end test_missing_filter() */
-
/*-------------------------------------------------------------------------
* Function: test_onebyte_shuffle
*
@@ -2836,29 +3038,34 @@ error:
static herr_t
test_onebyte_shuffle(hid_t file)
{
- hid_t dataset, space,dc;
- const hsize_t size[2] = {10, 20};
- const hsize_t chunk_size[2] = {10, 20};
- unsigned char orig_data[10][20];
- unsigned char new_data[10][20];
- size_t i, j;
+ hid_t dataset, space, dc;
+ const hsize_t size[2] = {10, 20};
+ const hsize_t chunk_size[2] = {10, 20};
+ unsigned char orig_data[10][20];
+ unsigned char new_data[10][20];
+ size_t i, j;
TESTING("8-bit shuffling (setup)");
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Use shuffling algorithm with 8-bit */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_shuffle (dc) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_shuffle(dc) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_ONEBYTE_SHUF_NAME, H5T_NATIVE_UCHAR,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset = H5Dcreate2(file, DSET_ONEBYTE_SHUF_NAME, H5T_NATIVE_UCHAR, space, H5P_DEFAULT, dc,
+ H5P_DEFAULT)) < 0)
+ goto error;
- for(i= 0;i< 10; i++)
- for(j = 0; j < 20; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 20; j++)
orig_data[i][j] = (unsigned char)HDrandom();
PASSED();
@@ -2870,7 +3077,7 @@ test_onebyte_shuffle(hid_t file)
*/
TESTING("8-bit shuffling (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
goto error;
PASSED();
@@ -2882,17 +3089,16 @@ test_onebyte_shuffle(hid_t file)
TESTING("8-bit shuffling (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(new_data[i][j] != orig_data[i][j]) {
+ for (i = 0; i < (size_t)size[0]; i++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (new_data[i][j] != orig_data[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
- HDprintf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
}
}
@@ -2902,8 +3108,10 @@ test_onebyte_shuffle(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Pclose (dc) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -2913,7 +3121,6 @@ error:
return FAIL;
} /* end test_onebyte_shuffle() */
-
/*-------------------------------------------------------------------------
* Function: test_nbit_int
*
@@ -2926,52 +3133,59 @@ error:
static herr_t
test_nbit_int(hid_t file)
{
- hid_t dataset, datatype, mem_datatype, space, dc;
- hsize_t size[2] = {2, 5};
- hsize_t chunk_size[2] = {2,5};
- int orig_data[2][5];
- int new_data[2][5];
- unsigned int mask;
- size_t precision, offset;
- double power;
- size_t i, j;
+ hid_t dataset, datatype, mem_datatype, space, dc;
+ hsize_t size[2] = {2, 5};
+ hsize_t chunk_size[2] = {2, 5};
+ int orig_data[2][5];
+ int new_data[2][5];
+ unsigned int mask;
+ size_t precision, offset;
+ double power;
+ size_t i, j;
HDputs("Testing nbit filter");
TESTING(" nbit int (setup)");
/* Define dataset datatype (integer), and set precision, offset */
- datatype = H5Tcopy(H5T_NATIVE_INT);
+ datatype = H5Tcopy(H5T_NATIVE_INT);
precision = 17; /* precision includes sign bit */
- if(H5Tset_precision(datatype,precision) < 0) goto error;
+ if (H5Tset_precision(datatype, precision) < 0)
+ goto error;
offset = 4;
- if(H5Tset_offset(datatype,offset) < 0) goto error;
+ if (H5Tset_offset(datatype, offset) < 0)
+ goto error;
/* Copy to memory datatype before setting order */
mem_datatype = H5Tcopy(datatype);
/* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE) < 0) goto error;
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0)
+ goto error;
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_nbit(dc) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_INT_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset = H5Dcreate2(file, DSET_NBIT_INT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ goto error;
/* Initialize data, assuming size of long long >= size of int */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- power = HDpow(2.0f, (double)(precision - 1));
+ for (i = 0; i < (size_t)size[0]; i++)
+ for (j = 0; j < (size_t)size[1]; j++) {
+ power = HDpow(2.0f, (double)(precision - 1));
orig_data[i][j] = (int)(((long long)HDrandom() % (long long)power) << offset);
/* even-numbered values are negtive */
- if((i*size[1]+j+1)%2 == 0)
+ if ((i * size[1] + j + 1) % 2 == 0)
orig_data[i][j] = -orig_data[i][j];
}
@@ -2984,7 +3198,7 @@ test_nbit_int(hid_t file)
*/
TESTING(" nbit int (write)");
- if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ if (H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
goto error;
PASSED();
@@ -2995,16 +3209,16 @@ test_nbit_int(hid_t file)
TESTING(" nbit int (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ if (H5Dread(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
goto error;
/* Check that the values read are the same as the values written
* Use mask for checking the significant bits, ignoring the padding bits
*/
mask = ~((unsigned)~0 << (precision + offset)) & ((unsigned)~0 << offset);
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(((unsigned)new_data[i][j] & mask) != ((unsigned)orig_data[i][j] & mask)) {
+ for (i = 0; i < (size_t)size[0]; i++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (((unsigned)new_data[i][j] & mask) != ((unsigned)orig_data[i][j] & mask)) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3017,11 +3231,16 @@ test_nbit_int(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Tclose(mem_datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Tclose(datatype) < 0)
+ goto error;
+ if (H5Tclose(mem_datatype) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -3031,7 +3250,6 @@ error:
return FAIL;
} /* end test_nbit_int() */
-
/*-------------------------------------------------------------------------
* Function: test_nbit_float
*
@@ -3044,49 +3262,49 @@ error:
static herr_t
test_nbit_float(hid_t file)
{
- hid_t dataset, datatype, space, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2, 5};
+ hid_t dataset, datatype, space, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
/* orig_data[] are initialized to be within the range that can be represented by
* dataset datatype (no precision loss during datatype conversion)
*/
- float orig_data[2][5] = {{188384.0f, 19.103516f, -1.0831790e9f, -84.242188f, 5.2045898f},
- {-49140.0f, 2350.25f, -3.2110596e-1f, 6.4998865e-5f, -0.0f}};
- float new_data[2][5];
- size_t precision, offset;
- size_t i, j;
+ float orig_data[2][5] = {{188384.0f, 19.103516f, -1.0831790e9f, -84.242188f, 5.2045898f},
+ {-49140.0f, 2350.25f, -3.2110596e-1f, 6.4998865e-5f, -0.0f}};
+ float new_data[2][5];
+ size_t precision, offset;
+ size_t i, j;
TESTING(" nbit float (setup)");
/* Define user-defined single-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F32BE);
- if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ if (H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
FAIL_STACK_ERROR
offset = 7;
- if(H5Tset_offset(datatype,offset) < 0)
+ if (H5Tset_offset(datatype, offset) < 0)
FAIL_STACK_ERROR
precision = 20;
- if(H5Tset_precision(datatype,precision) < 0)
+ if (H5Tset_precision(datatype, precision) < 0)
FAIL_STACK_ERROR
- if(H5Tset_size(datatype, (size_t)4) < 0)
+ if (H5Tset_size(datatype, (size_t)4) < 0)
FAIL_STACK_ERROR
- if(H5Tset_ebias(datatype, (size_t)31) < 0)
+ if (H5Tset_ebias(datatype, (size_t)31) < 0)
FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0)
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
FAIL_STACK_ERROR
- if(H5Pset_nbit(dc) < 0)
+ if (H5Pset_nbit(dc) < 0)
FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3097,7 +3315,7 @@ test_nbit_float(hid_t file)
*/
TESTING(" nbit float (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3109,17 +3327,17 @@ test_nbit_float(hid_t file)
TESTING(" nbit float (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of int = size of float
*/
- for(i = 0; i < (size_t)size[0]; i++) {
- for(j = 0; j < (size_t)size[1]; j++) {
- if(HDisnan(orig_data[i][j]))
- continue; /* skip if value is NaN */
- if(!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
+ for (i = 0; i < (size_t)size[0]; i++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (HDisnan(orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if (!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3132,13 +3350,13 @@ test_nbit_float(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0)
+ if (H5Tclose(datatype) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dc) < 0)
+ if (H5Pclose(dc) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3149,7 +3367,6 @@ error:
return FAIL;
} /* end test_nbit_float() */
-
/*-------------------------------------------------------------------------
* Function: test_nbit_double
*
@@ -3162,63 +3379,54 @@ error:
static herr_t
test_nbit_double(hid_t file)
{
-/* assume unsigned int and float has the same number of bytes */
- hid_t dataset, datatype, space, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2, 5};
+ /* assume unsigned int and float has the same number of bytes */
+ hid_t dataset, datatype, space, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
/* orig_data[] are initialized to be within the range that can be represented by
* dataset datatype (no precision loss during datatype conversion)
*/
- double orig_data[2][5] = {
- {
- (double)1.6081706885101836e+60L,
- -255.32099170994480f,
- (double)1.2677579992621376e-61L,
- 64568.289448797700f,
- (double)-1.0619721778839084e-75L
- },
- {
- (double)2.1499497833454840e+56L,
- 6.6562295504670740e-3f,
- -1.5747263393432150f,
- 1.0711093225222612f,
- -9.8971679387636870e-1f
- }};
- double new_data[2][5];
- size_t precision, offset;
- size_t i, j;
+ double orig_data[2][5] = {{(double)1.6081706885101836e+60L, -255.32099170994480f,
+ (double)1.2677579992621376e-61L, 64568.289448797700f,
+ (double)-1.0619721778839084e-75L},
+ {(double)2.1499497833454840e+56L, 6.6562295504670740e-3f, -1.5747263393432150f,
+ 1.0711093225222612f, -9.8971679387636870e-1f}};
+ double new_data[2][5];
+ size_t precision, offset;
+ size_t i, j;
TESTING(" nbit double (setup)");
/* Define user-defined doule-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F64BE);
- if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0)
+ if (H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0)
FAIL_STACK_ERROR
offset = 5;
- if(H5Tset_offset(datatype,offset) < 0)
+ if (H5Tset_offset(datatype, offset) < 0)
FAIL_STACK_ERROR
precision = 51;
- if(H5Tset_precision(datatype,precision) < 0)
+ if (H5Tset_precision(datatype, precision) < 0)
FAIL_STACK_ERROR
- if(H5Tset_size(datatype, (size_t)8) < 0)
+ if (H5Tset_size(datatype, (size_t)8) < 0)
FAIL_STACK_ERROR
- if(H5Tset_ebias(datatype, (size_t)255) < 0)
+ if (H5Tset_ebias(datatype, (size_t)255) < 0)
FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0)
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
FAIL_STACK_ERROR
- if(H5Pset_nbit(dc) < 0)
+ if (H5Pset_nbit(dc) < 0)
FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) <
+ 0)
FAIL_STACK_ERROR
PASSED();
@@ -3230,7 +3438,7 @@ test_nbit_double(hid_t file)
*/
TESTING(" nbit double (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3241,17 +3449,17 @@ test_nbit_double(hid_t file)
TESTING(" nbit double (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of long long = size of double
*/
- for(i = 0; i < (size_t)size[0]; i++) {
- for(j = 0; j < (size_t)size[1]; j++) {
- if(HDisnan(orig_data[i][j]))
- continue; /* skip if value is NaN */
- if(!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
+ for (i = 0; i < (size_t)size[0]; i++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (HDisnan(orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if (!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3264,13 +3472,13 @@ test_nbit_double(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0)
+ if (H5Tclose(datatype) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dc) < 0)
+ if (H5Pclose(dc) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3281,7 +3489,6 @@ error:
return FAIL;
} /* end test_nbit_double() */
-
/*-------------------------------------------------------------------------
* Function: test_nbit_array
*
@@ -3294,31 +3501,34 @@ error:
static herr_t
test_nbit_array(hid_t file)
{
- hid_t dataset, base_datatype, array_datatype, space, dc;
- hid_t mem_base_datatype, mem_array_datatype;
- const hsize_t size[2] = {2, 5};
- const hsize_t adims[2] = {3, 2};
- const hsize_t chunk_size[2] = {2,5};
- unsigned int orig_data[2][5][3][2];
- unsigned int new_data[2][5][3][2];
- size_t precision, offset;
- double power;
- size_t i, j, m, n;
+ hid_t dataset, base_datatype, array_datatype, space, dc;
+ hid_t mem_base_datatype, mem_array_datatype;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t adims[2] = {3, 2};
+ const hsize_t chunk_size[2] = {2, 5};
+ unsigned int orig_data[2][5][3][2];
+ unsigned int new_data[2][5][3][2];
+ size_t precision, offset;
+ double power;
+ size_t i, j, m, n;
TESTING(" nbit array (setup)");
/* Define dataset array datatype's base datatype and set precision, offset */
base_datatype = H5Tcopy(H5T_NATIVE_UINT);
- precision = 22;
- if(H5Tset_precision(base_datatype,precision) < 0) goto error;
+ precision = 22;
+ if (H5Tset_precision(base_datatype, precision) < 0)
+ goto error;
offset = 7;
- if(H5Tset_offset(base_datatype,offset) < 0) goto error;
+ if (H5Tset_offset(base_datatype, offset) < 0)
+ goto error;
/* Copy to memory array datatype's base datatype before setting order */
mem_base_datatype = H5Tcopy(base_datatype);
/* Set order of dataset array datatype's base datatype */
- if(H5Tset_order(base_datatype, H5T_ORDER_BE) < 0) goto error;
+ if (H5Tset_order(base_datatype, H5T_ORDER_BE) < 0)
+ goto error;
/* Create dataset array datatype */
array_datatype = H5Tarray_create2(base_datatype, 2, adims);
@@ -3327,26 +3537,31 @@ test_nbit_array(hid_t file)
mem_array_datatype = H5Tarray_create2(mem_base_datatype, 2, adims);
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_nbit(dc) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_ARRAY_NAME, array_datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset =
+ H5Dcreate2(file, DSET_NBIT_ARRAY_NAME, array_datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ goto error;
/* Initialize data, assuming size of long long >= size of unsigned int */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++)
- for(m = 0; m < (size_t)adims[0]; m++)
- for(n = 0; n < (size_t)adims[1]; n++) {
- power = HDpow(2.0F, (double)precision);
- orig_data[i][j][m][n] = (unsigned int)(((long long)HDrandom() %
- (long long)power) << offset);
- } /* end for */
+ for (i = 0; i < (size_t)size[0]; i++)
+ for (j = 0; j < (size_t)size[1]; j++)
+ for (m = 0; m < (size_t)adims[0]; m++)
+ for (n = 0; n < (size_t)adims[1]; n++) {
+ power = HDpow(2.0F, (double)precision);
+ orig_data[i][j][m][n] =
+ (unsigned int)(((long long)HDrandom() % (long long)power) << offset);
+ } /* end for */
PASSED();
/*----------------------------------------------------------------------
@@ -3356,8 +3571,7 @@ test_nbit_array(hid_t file)
*/
TESTING(" nbit array (write)");
- if(H5Dwrite(dataset, mem_array_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
+ if (H5Dwrite(dataset, mem_array_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
goto error;
PASSED();
@@ -3369,36 +3583,42 @@ test_nbit_array(hid_t file)
TESTING(" nbit array (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_array_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
+ if (H5Dread(dataset, mem_array_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
goto error;
/* Check that the values read are the same as the values written
*/
- for(i=0; i<(size_t)size[0]; i++)
- for(j=0; j<(size_t)size[1]; j++)
- for(m = 0; m < (size_t)adims[0]; m++)
- for(n = 0; n < (size_t)adims[1]; n++) {
- if(new_data[i][j][m][n]!= orig_data[i][j][m][n]) {
- H5_FAILED();
- HDprintf(" Read different values than written.\n");
- HDprintf(" At index %lu,%lu,%lu,%lu\n",
- (unsigned long)i, (unsigned long)j, (unsigned long)m, (unsigned long)n);
- goto error;
- }
- }
+ for (i = 0; i < (size_t)size[0]; i++)
+ for (j = 0; j < (size_t)size[1]; j++)
+ for (m = 0; m < (size_t)adims[0]; m++)
+ for (n = 0; n < (size_t)adims[1]; n++) {
+ if (new_data[i][j][m][n] != orig_data[i][j][m][n]) {
+ H5_FAILED();
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu,%lu,%lu\n", (unsigned long)i, (unsigned long)j,
+ (unsigned long)m, (unsigned long)n);
+ goto error;
+ }
+ }
/*----------------------------------------------------------------------
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(array_datatype) < 0) goto error;
- if(H5Tclose(base_datatype) < 0) goto error;
- if(H5Tclose(mem_array_datatype) < 0) goto error;
- if(H5Tclose(mem_base_datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Tclose(array_datatype) < 0)
+ goto error;
+ if (H5Tclose(base_datatype) < 0)
+ goto error;
+ if (H5Tclose(mem_array_datatype) < 0)
+ goto error;
+ if (H5Tclose(mem_base_datatype) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -3408,7 +3628,6 @@ error:
return FAIL;
} /* end test_nbit_array() */
-
/*-------------------------------------------------------------------------
* Function: test_nbit_compound
*
@@ -3426,125 +3645,125 @@ error:
static herr_t
test_nbit_compound(hid_t file)
{
- typedef struct { /* Struct with atomic fields */
- int i;
- char c;
+ typedef struct { /* Struct with atomic fields */
+ int i;
+ char c;
short s;
float f;
} atomic;
- hid_t i_tid, c_tid, s_tid, f_tid;
- hid_t cmpd_tid; /* atomic compound datatype */
- hid_t mem_cmpd_tid; /* memory atomic compound datatype */
- size_t precision[3] = {15, 7, 10};
- size_t offset[3] = {9, 0, 3};
- hid_t dataset, space, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2, 5};
- const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F},
- {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}};
- atomic orig_data[2][5];
- atomic new_data[2][5];
- unsigned int i_mask, s_mask, c_mask;
- double power;
- size_t i, j;
-
+ hid_t i_tid, c_tid, s_tid, f_tid;
+ hid_t cmpd_tid; /* atomic compound datatype */
+ hid_t mem_cmpd_tid; /* memory atomic compound datatype */
+ size_t precision[3] = {15, 7, 10};
+ size_t offset[3] = {9, 0, 3};
+ hid_t dataset, space, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
+ const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F},
+ {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}};
+ atomic orig_data[2][5];
+ atomic new_data[2][5];
+ unsigned int i_mask, s_mask, c_mask;
+ double power;
+ size_t i, j;
TESTING(" nbit compound (setup)");
/* Define datatypes of members of compound datatype */
- if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
FAIL_STACK_ERROR
- if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ if ((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
FAIL_STACK_ERROR
- if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ if ((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
FAIL_STACK_ERROR
- if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ if ((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
FAIL_STACK_ERROR
/* Set precision and offset etc. */
- if(H5Tset_precision(i_tid,precision[0]) < 0)
+ if (H5Tset_precision(i_tid, precision[0]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(i_tid,offset[0]) < 0)
+ if (H5Tset_offset(i_tid, offset[0]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0)
+ if (H5Tset_precision(c_tid, precision[1]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(c_tid,offset[1]) < 0)
+ if (H5Tset_offset(c_tid, offset[1]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0)
+ if (H5Tset_precision(s_tid, precision[2]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(s_tid,offset[2]) < 0)
+ if (H5Tset_offset(s_tid, offset[2]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ if (H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ if (H5Tset_offset(f_tid, (size_t)7) < 0)
FAIL_STACK_ERROR
- if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ if (H5Tset_precision(f_tid, (size_t)20) < 0)
FAIL_STACK_ERROR
- if(H5Tset_size(f_tid, (size_t)4) < 0)
+ if (H5Tset_size(f_tid, (size_t)4) < 0)
FAIL_STACK_ERROR
- if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ if (H5Tset_ebias(f_tid, (size_t)31) < 0)
FAIL_STACK_ERROR
/* Create a memory compound datatype before setting the order */
- if((mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ if ((mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ if (H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ if (H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ if (H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ if (H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
FAIL_STACK_ERROR
/* Create a dataset compound datatype and insert some atomic types */
- if((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ if ((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ if (H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ if (H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ if (H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0)
+ if (H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0)
FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0)
+ if (H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0)
FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0)
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
FAIL_STACK_ERROR
- if(H5Pset_nbit(dc) < 0)
+ if (H5Pset_nbit(dc) < 0)
FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, space, H5P_DEFAULT, dc, H5P_DEFAULT)) <
+ 0)
FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
- for(i = 0; i < (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- power = HDpow(2.0F, (double)(precision[0]-1));
+ for (i = 0; i < (size_t)size[0]; i++)
+ for (j = 0; j < (size_t)size[1]; j++) {
+ power = HDpow(2.0F, (double)(precision[0] - 1));
orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
- power = HDpow(2.0F, (double)(precision[1]-1));
+ power = HDpow(2.0F, (double)(precision[1] - 1));
orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
- power = HDpow(2.0F, (double)(precision[2]-1));
+ power = HDpow(2.0F, (double)(precision[2] - 1));
orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
orig_data[i][j].f = float_val[i][j];
/* some even-numbered integer values are negtive */
- if((i * size[1] + j + 1) % 2 == 0) {
+ if ((i * size[1] + j + 1) % 2 == 0) {
orig_data[i][j].i = -orig_data[i][j].i;
orig_data[i][j].s = (short)-orig_data[i][j].s;
}
@@ -3559,7 +3778,7 @@ test_nbit_compound(hid_t file)
*/
TESTING(" nbit compound (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ if (H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3570,7 +3789,7 @@ test_nbit_compound(hid_t file)
TESTING(" nbit compound (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ if (H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
@@ -3579,13 +3798,12 @@ test_nbit_compound(hid_t file)
i_mask = ~((unsigned)~0 << (precision[0] + offset[0])) & ((unsigned)~0 << offset[0]);
c_mask = ~((unsigned)~0 << (precision[1] + offset[1])) & ((unsigned)~0 << offset[1]);
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
- for(i = 0; i < size[0]; i++) {
- for(j = 0; j < size[1]; j++) {
- if(((unsigned)new_data[i][j].i & i_mask) != ((unsigned)orig_data[i][j].i & i_mask) ||
+ for (i = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
+ if (((unsigned)new_data[i][j].i & i_mask) != ((unsigned)orig_data[i][j].i & i_mask) ||
((unsigned)new_data[i][j].c & c_mask) != ((unsigned)orig_data[i][j].c & c_mask) ||
((unsigned)new_data[i][j].s & s_mask) != ((unsigned)orig_data[i][j].s & s_mask) ||
- (!HDisnan(orig_data[i][j].f) && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f)))
- {
+ (!HDisnan(orig_data[i][j].f) && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f))) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3598,23 +3816,23 @@ test_nbit_compound(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0)
+ if (H5Tclose(i_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(c_tid) < 0)
+ if (H5Tclose(c_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(s_tid) < 0)
+ if (H5Tclose(s_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(f_tid) < 0)
+ if (H5Tclose(f_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(cmpd_tid) < 0)
+ if (H5Tclose(cmpd_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(mem_cmpd_tid) < 0)
+ if (H5Tclose(mem_cmpd_tid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dc) < 0)
+ if (H5Pclose(dc) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3625,7 +3843,6 @@ error:
return FAIL;
} /* end test_nbit_compound() */
-
/*-------------------------------------------------------------------------
* Function: test_nbit_compound_2
*
@@ -3643,210 +3860,213 @@ error:
static herr_t
test_nbit_compound_2(hid_t file)
{
- typedef struct { /* Struct with atomic fields */
- int i;
- char c;
+ typedef struct { /* Struct with atomic fields */
+ int i;
+ char c;
short s;
float f;
} atomic;
- typedef struct { /* Struct with complex fields */
- atomic a;
+ typedef struct { /* Struct with complex fields */
+ atomic a;
unsigned int v;
- char b[2][2];
- atomic d[2][2];
+ char b[2][2];
+ atomic d[2][2];
} complex;
- hid_t i_tid, c_tid, s_tid, f_tid, v_tid;
- hid_t cmpd_tid1; /* atomic compound datatype */
- hid_t cmpd_tid2; /* complex compound datatype */
- hid_t mem_cmpd_tid1; /* memory atomic compound datatype */
- hid_t mem_cmpd_tid2; /* memory complex compound datatype */
- hid_t base_tid; /* simple array datatype's base datatype */
- hid_t array_tid; /* simple array datatype */
- hid_t array_cmplx_tid; /* complex array datatype */
- hid_t mem_array_cmplx_tid; /* memory complex array datatype */
- const hsize_t array_dims[2] = {2, 2};
- size_t precision[5] = {31, 8, 10, 23, 8};
- size_t offset[5] = {1, 0, 3, 5, 0};
- hid_t dataset, space, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2, 5};
- const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F},
- {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}};
- complex orig_data[2][5];
- complex new_data[2][5];
- unsigned int i_mask, s_mask, c_mask, b_mask;
- double power;
- size_t i, j, m, n, b_failed, d_failed;
-
+ hid_t i_tid, c_tid, s_tid, f_tid, v_tid;
+ hid_t cmpd_tid1; /* atomic compound datatype */
+ hid_t cmpd_tid2; /* complex compound datatype */
+ hid_t mem_cmpd_tid1; /* memory atomic compound datatype */
+ hid_t mem_cmpd_tid2; /* memory complex compound datatype */
+ hid_t base_tid; /* simple array datatype's base datatype */
+ hid_t array_tid; /* simple array datatype */
+ hid_t array_cmplx_tid; /* complex array datatype */
+ hid_t mem_array_cmplx_tid; /* memory complex array datatype */
+ const hsize_t array_dims[2] = {2, 2};
+ size_t precision[5] = {31, 8, 10, 23, 8};
+ size_t offset[5] = {1, 0, 3, 5, 0};
+ hid_t dataset, space, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
+ const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F},
+ {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}};
+ complex orig_data[2][5];
+ complex new_data[2][5];
+ unsigned int i_mask, s_mask, c_mask, b_mask;
+ double power;
+ size_t i, j, m, n, b_failed, d_failed;
TESTING(" nbit compound complex (setup)");
/* Define datatypes of members of compound datatype */
- if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
FAIL_STACK_ERROR
- if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ if ((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
FAIL_STACK_ERROR
- if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ if ((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
FAIL_STACK_ERROR
- if((v_tid = H5Tcopy(H5T_NATIVE_UINT)) < 0)
+ if ((v_tid = H5Tcopy(H5T_NATIVE_UINT)) < 0)
FAIL_STACK_ERROR
- if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ if ((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
FAIL_STACK_ERROR
/* Set precision and offset etc. of atomic compound datatype members */
- if(H5Tset_precision(i_tid,precision[0]) < 0)
+ if (H5Tset_precision(i_tid, precision[0]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(i_tid,offset[0]) < 0)
+ if (H5Tset_offset(i_tid, offset[0]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0)
+ if (H5Tset_precision(c_tid, precision[1]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(c_tid,offset[1]) < 0)
+ if (H5Tset_offset(c_tid, offset[1]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0)
+ if (H5Tset_precision(s_tid, precision[2]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(s_tid,offset[2]) < 0)
+ if (H5Tset_offset(s_tid, offset[2]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ if (H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ if (H5Tset_offset(f_tid, (size_t)7) < 0)
FAIL_STACK_ERROR
- if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ if (H5Tset_precision(f_tid, (size_t)20) < 0)
FAIL_STACK_ERROR
- if(H5Tset_size(f_tid, (size_t)4) < 0)
+ if (H5Tset_size(f_tid, (size_t)4) < 0)
FAIL_STACK_ERROR
- if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ if (H5Tset_ebias(f_tid, (size_t)31) < 0)
FAIL_STACK_ERROR
/* Create a memory atomic compound datatype before setting the order */
- if((mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ if ((mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ if (H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ if (H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ if (H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ if (H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
FAIL_STACK_ERROR
/* Create a dataset atomic compound datatype and insert some atomic types */
- if((cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ if ((cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ if (H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ if (H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ if (H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0)
+ if (H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0)
FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0)
+ if (H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0)
FAIL_STACK_ERROR
/* Set precision and offset of the other data member */
- if(H5Tset_precision(v_tid,precision[3]) < 0)
+ if (H5Tset_precision(v_tid, precision[3]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(v_tid,offset[3]) < 0)
+ if (H5Tset_offset(v_tid, offset[3]) < 0)
FAIL_STACK_ERROR
/* Create the simple array datatype */
- if((base_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ if ((base_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
FAIL_STACK_ERROR
- if(H5Tset_precision(base_tid,precision[4]) < 0)
+ if (H5Tset_precision(base_tid, precision[4]) < 0)
FAIL_STACK_ERROR
- if(H5Tset_offset(base_tid,offset[4]) < 0)
+ if (H5Tset_offset(base_tid, offset[4]) < 0)
FAIL_STACK_ERROR
- if((array_tid = H5Tarray_create2(base_tid, 2, array_dims)) < 0)
+ if ((array_tid = H5Tarray_create2(base_tid, 2, array_dims)) < 0)
FAIL_STACK_ERROR
/* Create the complex memory and dataset array datatype */
- if((array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims)) < 0)
+ if ((array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims)) < 0)
FAIL_STACK_ERROR
- if((mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims)) < 0)
+ if ((mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims)) < 0)
FAIL_STACK_ERROR
/* Create a memory complex compound datatype before setting the order */
- if((mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ if ((mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0)
+ if (H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ if (H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ if (H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0)
+ if (H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0)
FAIL_STACK_ERROR
/* Set order of dataset other complex compound member datatype */
- if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0)
+ if (H5Tset_order(v_tid, H5T_ORDER_BE) < 0)
FAIL_STACK_ERROR
/* Create a dataset complex compound datatype and insert members */
- if((cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ if ((cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0)
+ if (H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ if (H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ if (H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0)
+ if (H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0)
FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0)
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
FAIL_STACK_ERROR
- if(H5Pset_nbit(dc) < 0)
+ if (H5Pset_nbit(dc) < 0)
FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- power = HDpow(2.0F, (double)(precision[0]-1));
+ for (i = 0; i < (size_t)size[0]; i++)
+ for (j = 0; j < (size_t)size[1]; j++) {
+ power = HDpow(2.0F, (double)(precision[0] - 1));
orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
- power = HDpow(2.0F, (double)(precision[1]-1));
+ power = HDpow(2.0F, (double)(precision[1] - 1));
orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
- power = HDpow(2.0F, (double)(precision[2]-1));
+ power = HDpow(2.0F, (double)(precision[2] - 1));
orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]);
orig_data[i][j].a.f = float_val[i][j];
- power = HDpow(2.0F, (double)precision[3]);
+ power = HDpow(2.0F, (double)precision[3]);
orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]);
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++) {
- power = HDpow(2.0F, (double)(precision[4]-1));
+ for (m = 0; m < (size_t)array_dims[0]; m++)
+ for (n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[4] - 1));
orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]);
} /* end for */
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++) {
- power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]);
- power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
- power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
+ for (m = 0; m < (size_t)array_dims[0]; m++)
+ for (n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[0] - 1));
+ orig_data[i][j].d[m][n].i =
+ (int)(-((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1] - 1));
+ orig_data[i][j].d[m][n].c =
+ (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2] - 1));
+ orig_data[i][j].d[m][n].s =
+ (short)(((long long)HDrandom() % (long long)power) << offset[2]);
orig_data[i][j].d[m][n].f = float_val[i][j];
} /* end for */
- } /* end for */
+ } /* end for */
PASSED();
@@ -3857,7 +4077,7 @@ test_nbit_compound_2(hid_t file)
*/
TESTING(" nbit compound complex (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ if (H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3868,7 +4088,7 @@ test_nbit_compound_2(hid_t file)
TESTING(" nbit compound complex (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ if (H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
@@ -3880,7 +4100,7 @@ test_nbit_compound_2(hid_t file)
* discovered it using clang compiler with -fcatch-undefined-behavior option (see Issue 7674
* in Jira). So I changed it in a funny way as below to avoid it. SLU - 2011/8/11
*/
- if(sizeof(unsigned) > 4)
+ if (sizeof(unsigned) > 4)
i_mask = ~((unsigned)~0 << (precision[0] + offset[0])) & ((unsigned)~0 << offset[0]);
else {
i_mask = 0xffffffff;
@@ -3889,34 +4109,39 @@ test_nbit_compound_2(hid_t file)
c_mask = ~((unsigned)~0 << (precision[1] + offset[1])) & ((unsigned)~0 << offset[1]);
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
b_mask = ~((unsigned)~0 << (precision[4] + offset[4])) & ((unsigned)~0 << offset[4]);
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
+ for (i = 0; i < (size_t)size[0]; i++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
b_failed = 0;
d_failed = 0;
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) {
- b_failed = 1;
- goto out;
- }
+ for (m = 0; m < (size_t)array_dims[0]; m++)
+ for (n = 0; n < (size_t)array_dims[1]; n++)
+ if (((unsigned)new_data[i][j].b[m][n] & b_mask) !=
+ ((unsigned)orig_data[i][j].b[m][n] & b_mask)) {
+ b_failed = 1;
+ goto out;
+ }
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)||
- ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)||
- ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)||
- (!HDisnan(new_data[i][j].d[m][n].f) && !H5_FLT_ABS_EQUAL(new_data[i][j].d[m][n].f, new_data[i][j].d[m][n].f))) {
+ for (m = 0; m < (size_t)array_dims[0]; m++)
+ for (n = 0; n < (size_t)array_dims[1]; n++)
+ if (((unsigned)new_data[i][j].d[m][n].i & i_mask) !=
+ ((unsigned)orig_data[i][j].d[m][n].i & i_mask) ||
+ ((unsigned)new_data[i][j].d[m][n].c & c_mask) !=
+ ((unsigned)orig_data[i][j].d[m][n].c & c_mask) ||
+ ((unsigned)new_data[i][j].d[m][n].s & s_mask) !=
+ ((unsigned)orig_data[i][j].d[m][n].s & s_mask) ||
+ (!HDisnan(new_data[i][j].d[m][n].f) &&
+ !H5_FLT_ABS_EQUAL(new_data[i][j].d[m][n].f, new_data[i][j].d[m][n].f))) {
d_failed = 1;
goto out;
}
out:
- if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)||
- ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)||
- ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)||
- (!HDisnan(new_data[i][j].a.f) && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) ||
- new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
+ if (((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask) ||
+ ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask) ||
+ ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask) ||
+ (!HDisnan(new_data[i][j].a.f) && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) ||
+ new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3929,37 +4154,37 @@ out:
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0)
+ if (H5Tclose(i_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(c_tid) < 0)
+ if (H5Tclose(c_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(s_tid) < 0)
+ if (H5Tclose(s_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(f_tid) < 0)
+ if (H5Tclose(f_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(v_tid) < 0)
+ if (H5Tclose(v_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(cmpd_tid2) < 0)
+ if (H5Tclose(cmpd_tid2) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(cmpd_tid1) < 0)
+ if (H5Tclose(cmpd_tid1) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(mem_cmpd_tid2) < 0)
+ if (H5Tclose(mem_cmpd_tid2) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(mem_cmpd_tid1) < 0)
+ if (H5Tclose(mem_cmpd_tid1) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(array_tid) < 0)
+ if (H5Tclose(array_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(base_tid) < 0)
+ if (H5Tclose(base_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(array_cmplx_tid) < 0)
+ if (H5Tclose(array_cmplx_tid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(mem_array_cmplx_tid) < 0)
+ if (H5Tclose(mem_array_cmplx_tid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dc) < 0)
+ if (H5Pclose(dc) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -3970,7 +4195,6 @@ error:
return FAIL;
} /* end test_nbit_compound_2() */
-
/*-------------------------------------------------------------------------
* Function: test_nbit_compound_3
*
@@ -3988,83 +4212,103 @@ error:
static herr_t
test_nbit_compound_3(hid_t file)
{
- typedef struct { /* Struct with some no-op type fields */
- int i; /* integer field, NOT a no-op type */
- char str[30]; /* fixed-length string, no-op type */
- char *vl_str; /* varible-length string, no-op type */
- hvl_t v; /* VL datatype field, no-op type */
- hobj_ref_t r; /* Object reference field, no-op type */
- unsigned char o[5]; /* Opaque field, no-op type */
+ typedef struct { /* Struct with some no-op type fields */
+ int i; /* integer field, NOT a no-op type */
+ char str[30]; /* fixed-length string, no-op type */
+ char * vl_str; /* varible-length string, no-op type */
+ hvl_t v; /* VL datatype field, no-op type */
+ hobj_ref_t r; /* Object reference field, no-op type */
+ unsigned char o[5]; /* Opaque field, no-op type */
} atomic;
- hid_t i_tid, str_tid, vl_str_tid, v_tid, o_tid;
- hid_t cmpd_tid; /* atomic compound datatype */
- hid_t dataset, space, dc, obj_ref_dataset = -1;
- const hsize_t size[1] = {5};
- const hsize_t chunk_size[1] = {5};
- atomic orig_data[5];
- atomic new_data[5];
- double power;
- size_t i, k, j;
-
+ hid_t i_tid, str_tid, vl_str_tid, v_tid, o_tid;
+ hid_t cmpd_tid; /* atomic compound datatype */
+ hid_t dataset, space, dc, obj_ref_dataset = -1;
+ const hsize_t size[1] = {5};
+ const hsize_t chunk_size[1] = {5};
+ atomic orig_data[5];
+ atomic new_data[5];
+ double power;
+ size_t i, k, j;
TESTING(" nbit compound with no-op type (setup)");
/* Define datatypes of members of compound datatype */
- i_tid=H5Tcopy(H5T_NATIVE_INT);
- if(H5Tset_precision(i_tid, (size_t)17) < 0) goto error;
+ i_tid = H5Tcopy(H5T_NATIVE_INT);
+ if (H5Tset_precision(i_tid, (size_t)17) < 0)
+ goto error;
- str_tid=H5Tcopy(H5T_C_S1);
- if(H5Tset_size(str_tid, (size_t)30) < 0) goto error;
+ str_tid = H5Tcopy(H5T_C_S1);
+ if (H5Tset_size(str_tid, (size_t)30) < 0)
+ goto error;
vl_str_tid = H5Tcopy(H5T_C_S1);
- if(H5Tset_size(vl_str_tid,H5T_VARIABLE) < 0) goto error;
+ if (H5Tset_size(vl_str_tid, H5T_VARIABLE) < 0)
+ goto error;
- if((v_tid = H5Tvlen_create(H5T_NATIVE_UINT)) < 0) goto error;
+ if ((v_tid = H5Tvlen_create(H5T_NATIVE_UINT)) < 0)
+ goto error;
- if((o_tid = H5Tcreate(H5T_OPAQUE, (size_t)5)) < 0) goto error;
- if(H5Tset_tag(o_tid, "testing opaque field") < 0) goto error;
+ if ((o_tid = H5Tcreate(H5T_OPAQUE, (size_t)5)) < 0)
+ goto error;
+ if (H5Tset_tag(o_tid, "testing opaque field") < 0)
+ goto error;
/* Create a dataset compound datatype and insert some atomic types */
cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "str", HOFFSET(atomic, str), str_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "vl_str", HOFFSET(atomic, vl_str), vl_str_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "v", HOFFSET(atomic, v), v_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "r", HOFFSET(atomic, r), H5T_STD_REF_OBJ) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "o", HOFFSET(atomic, o), o_tid) < 0) goto error;
+ if (H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ goto error;
+ if (H5Tinsert(cmpd_tid, "str", HOFFSET(atomic, str), str_tid) < 0)
+ goto error;
+ if (H5Tinsert(cmpd_tid, "vl_str", HOFFSET(atomic, vl_str), vl_str_tid) < 0)
+ goto error;
+ if (H5Tinsert(cmpd_tid, "v", HOFFSET(atomic, v), v_tid) < 0)
+ goto error;
+ if (H5Tinsert(cmpd_tid, "r", HOFFSET(atomic, r), H5T_STD_REF_OBJ) < 0)
+ goto error;
+ if (H5Tinsert(cmpd_tid, "o", HOFFSET(atomic, o), o_tid) < 0)
+ goto error;
/* Create the data space */
- if((space = H5Screate_simple(1, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(1, size, NULL)) < 0)
+ goto error;
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 1, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dc, 1, chunk_size) < 0)
+ goto error;
+ if (H5Pset_nbit(dc) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_3, cmpd_tid,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset =
+ H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_3, cmpd_tid, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ goto error;
/* Create the dataset object reference points to */
- if((obj_ref_dataset = H5Dcreate2(file, "nbit_obj_ref", H5T_NATIVE_INT,
- space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if ((obj_ref_dataset = H5Dcreate2(file, "nbit_obj_ref", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ goto error;
/* Initialize data */
- for(i = 0; i < (size_t)size[0]; i++) {
+ for (i = 0; i < (size_t)size[0]; i++) {
power = HDpow(2.0F, 17.0F - 1.0F);
HDmemset(&orig_data[i], 0, sizeof(orig_data[i]));
orig_data[i].i = (int)(HDrandom() % (long)power);
HDstrcpy(orig_data[i].str, "fixed-length C string");
orig_data[i].vl_str = HDstrdup("variable-length C string");
- orig_data[i].v.p = HDmalloc((size_t)(i+1)*sizeof(unsigned int));
- orig_data[i].v.len = (size_t)i+1;
- for(k = 0; k < (i+1); k++) ((unsigned int *)orig_data[i].v.p)[k] = (unsigned int)(i*100 + k);
+ orig_data[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int));
+ orig_data[i].v.len = (size_t)i + 1;
+ for (k = 0; k < (i + 1); k++)
+ ((unsigned int *)orig_data[i].v.p)[k] = (unsigned int)(i * 100 + k);
/* Create reference to the dataset "nbit_obj_ref" */
- if(H5Rcreate(&orig_data[i].r, file, "nbit_obj_ref", H5R_OBJECT, (hid_t)-1) < 0) goto error;
+ if (H5Rcreate(&orig_data[i].r, file, "nbit_obj_ref", H5R_OBJECT, (hid_t)-1) < 0)
+ goto error;
- for(j = 0; j < 5; j++) orig_data[i].o[j] = (unsigned char)(i + j);
+ for (j = 0; j < 5; j++)
+ orig_data[i].o[j] = (unsigned char)(i + j);
}
PASSED();
@@ -4076,8 +4320,7 @@ test_nbit_compound_3(hid_t file)
*/
TESTING(" nbit compound with no-op type (write)");
- if(H5Dwrite(dataset, cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
+ if (H5Dwrite(dataset, cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
goto error;
PASSED();
@@ -4088,36 +4331,30 @@ test_nbit_compound_3(hid_t file)
TESTING(" nbit compound with no-op type (read)");
/* Read the dataset back */
- if(H5Dread(dataset, cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
+ if (H5Dread(dataset, cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
goto error;
/* Check that the values read are the same as the values written */
- for(i = 0; i < (size_t)size[0]; i++) {
- if(new_data[i].i != orig_data[i].i ||
- strcmp(new_data[i].str, orig_data[i].str) !=0 ||
- strcmp(new_data[i].vl_str, orig_data[i].vl_str) !=0 ||
- new_data[i].v.len != orig_data[i].v.len ||
- new_data[i].r != orig_data[i].r)
- {
+ for (i = 0; i < (size_t)size[0]; i++) {
+ if (new_data[i].i != orig_data[i].i || strcmp(new_data[i].str, orig_data[i].str) != 0 ||
+ strcmp(new_data[i].vl_str, orig_data[i].vl_str) != 0 || new_data[i].v.len != orig_data[i].v.len ||
+ new_data[i].r != orig_data[i].r) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu\n", (unsigned long)i);
goto error;
}
- for(k=0; k<i+1; k++)
- if(((unsigned int *)orig_data[i].v.p)[k] !=((unsigned int *)new_data[i].v.p)[k])
- {
+ for (k = 0; k < i + 1; k++)
+ if (((unsigned int *)orig_data[i].v.p)[k] != ((unsigned int *)new_data[i].v.p)[k]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu\n", (unsigned long)i);
goto error;
}
- for(j=0; j<5; j++)
- if(orig_data[i].o[j] != new_data[i].o[j])
- {
+ for (j = 0; j < 5; j++)
+ if (orig_data[i].o[j] != new_data[i].o[j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu\n", (unsigned long)i);
@@ -4129,18 +4366,30 @@ test_nbit_compound_3(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Treclaim(cmpd_tid, space, H5P_DEFAULT, new_data) < 0) goto error;
- if(H5Treclaim(cmpd_tid, space, H5P_DEFAULT, orig_data) < 0) goto error;
- if(H5Tclose(i_tid) < 0) goto error;
- if(H5Tclose(str_tid) < 0) goto error;
- if(H5Tclose(vl_str_tid) < 0) goto error;
- if(H5Tclose(v_tid) < 0) goto error;
- if(H5Tclose(o_tid) < 0) goto error;
- if(H5Tclose(cmpd_tid) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(obj_ref_dataset) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Treclaim(cmpd_tid, space, H5P_DEFAULT, new_data) < 0)
+ goto error;
+ if (H5Treclaim(cmpd_tid, space, H5P_DEFAULT, orig_data) < 0)
+ goto error;
+ if (H5Tclose(i_tid) < 0)
+ goto error;
+ if (H5Tclose(str_tid) < 0)
+ goto error;
+ if (H5Tclose(vl_str_tid) < 0)
+ goto error;
+ if (H5Tclose(v_tid) < 0)
+ goto error;
+ if (H5Tclose(o_tid) < 0)
+ goto error;
+ if (H5Tclose(cmpd_tid) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(obj_ref_dataset) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -4150,7 +4399,6 @@ error:
return FAIL;
} /* end test_nbit_compound_3() */
-
/*-------------------------------------------------------------------------
* Function: test_nbit_int_size
*
@@ -4171,8 +4419,8 @@ test_nbit_int_size(hid_t file)
hid_t dataspace, dataset, datatype, mem_datatype, dset_create_props;
hsize_t dims[2], chunk_size[2];
hsize_t dset_size = 0;
- int **orig = NULL;
- int *orig_data = NULL;
+ int ** orig = NULL;
+ int * orig_data = NULL;
double power;
int i, j;
size_t precision, offset;
@@ -4180,135 +4428,133 @@ test_nbit_int_size(hid_t file)
TESTING(" nbit integer dataset size");
/* Set up data array */
- if(NULL == (orig_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ if (NULL == (orig_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
TEST_ERROR;
- if(NULL == (orig = (int **)HDcalloc(DSET_DIM1, sizeof(orig_data))))
+ if (NULL == (orig = (int **)HDcalloc(DSET_DIM1, sizeof(orig_data))))
TEST_ERROR;
for (i = 0; i < DSET_DIM1; i++)
orig[i] = orig_data + (i * DSET_DIM2);
/* Define dataset datatype (integer), and set precision, offset */
- if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) {
+ if ((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
+ HDprintf(" line %d: H5Tcopy failed\n", __LINE__);
goto error;
}
precision = 16; /* precision includes sign bit */
- if(H5Tset_precision(datatype,precision)<0) {
+ if (H5Tset_precision(datatype, precision) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pset_precision failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_precision failed\n", __LINE__);
goto error;
}
offset = 8;
- if(H5Tset_offset(datatype,offset)<0) {
+ if (H5Tset_offset(datatype, offset) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Tset_offset failed\n",__LINE__);
+ HDprintf(" line %d: H5Tset_offset failed\n", __LINE__);
goto error;
}
/* Copy to memory datatype */
- if((mem_datatype = H5Tcopy(datatype)) < 0) {
+ if ((mem_datatype = H5Tcopy(datatype)) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
+ HDprintf(" line %d: H5Tcopy failed\n", __LINE__);
goto error;
}
/* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pset_order failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_order failed\n", __LINE__);
goto error;
}
- if(H5Tset_size(datatype, 4)<0) {
+ if (H5Tset_size(datatype, 4) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_size failed\n", __LINE__);
goto error;
}
/* Initiliaze data buffer with random data within correct range
* corresponding to the memory datatype's precision and offset.
*/
- for (i=0; i < DSET_DIM1; i++)
- for (j=0; j < DSET_DIM2; j++) {
- power = HDpow(2.0F, (double)(precision-1));
+ for (i = 0; i < DSET_DIM1; i++)
+ for (j = 0; j < DSET_DIM2; j++) {
+ power = HDpow(2.0F, (double)(precision - 1));
orig[i][j] = HDrandom() % (int)power << offset;
}
-
/* Describe the dataspace. */
dims[0] = DSET_DIM1;
dims[1] = DSET_DIM2;
- if((dataspace = H5Screate_simple(2, dims, NULL))<0) {
+ if ((dataspace = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
+ HDprintf(" line %d: H5Pcreate failed\n", __LINE__);
goto error;
}
/*
* Set the dataset creation property list to specify the chunks
*/
- chunk_size[0] = DSET_DIM1/10;
- chunk_size[1] = DSET_DIM2/10;
- if((dset_create_props = H5Pcreate(H5P_DATASET_CREATE))<0) {
+ chunk_size[0] = DSET_DIM1 / 10;
+ chunk_size[1] = DSET_DIM2 / 10;
+ if ((dset_create_props = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
+ HDprintf(" line %d: H5Pcreate failed\n", __LINE__);
goto error;
}
- if(H5Pset_chunk(dset_create_props, 2, chunk_size)<0) {
+ if (H5Pset_chunk(dset_create_props, 2, chunk_size) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_chunk failed\n", __LINE__);
goto error;
}
/*
* Set for n-bit compression
*/
- if(H5Pset_nbit(dset_create_props)<0) {
+ if (H5Pset_nbit(dset_create_props) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_nbit failed\n", __LINE__);
goto error;
}
/*
* Create a new dataset within the file.
*/
- if((dataset = H5Dcreate2(file, DSET_NBIT_INT_SIZE_NAME, datatype,
- dataspace, H5P_DEFAULT,
- dset_create_props, H5P_DEFAULT))<0) {
+ if ((dataset = H5Dcreate2(file, DSET_NBIT_INT_SIZE_NAME, datatype, dataspace, H5P_DEFAULT,
+ dset_create_props, H5P_DEFAULT)) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5dwrite failed\n",__LINE__);
+ HDprintf(" line %d: H5dwrite failed\n", __LINE__);
goto error;
}
/*
* Write the array to the file.
*/
- if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) {
+ if (H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) {
H5_FAILED();
- HDprintf(" Line %d: H5Dwrite failed\n",__LINE__);
+ HDprintf(" Line %d: H5Dwrite failed\n", __LINE__);
goto error;
}
/*
* Get the precision of the data type
*/
- if((precision = H5Tget_precision(datatype)) == 0) {
+ if ((precision = H5Tget_precision(datatype)) == 0) {
H5_FAILED();
- HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
+ HDprintf(" Line %d: wrong precision size: %zu\n", __LINE__, precision);
goto error;
}
/*
* The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2
*/
- if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
- dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
+ if ((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1 * DSET_DIM2 * (precision / 8) ||
+ dset_size > DSET_DIM1 * DSET_DIM2 * (precision / 8) + 1 * KB) {
H5_FAILED();
- HDfprintf(stdout, " Line %d: wrong dataset size: %" PRIuHSIZE "\n",__LINE__, dset_size);
+ HDfprintf(stdout, " Line %d: wrong dataset size: %" PRIuHSIZE "\n", __LINE__, dset_size);
goto error;
}
@@ -4332,7 +4578,6 @@ error:
return FAIL;
} /* end test_nbit_int_size() */
-
/*-------------------------------------------------------------------------
* Function: test_nbit_flt_size
*
@@ -4354,8 +4599,8 @@ test_nbit_flt_size(hid_t file)
hid_t dataspace, dataset, datatype, dset_create_props;
hsize_t dims[2], chunk_size[2];
hsize_t dset_size = 0;
- float **orig = NULL;
- float *orig_data = NULL;
+ float **orig = NULL;
+ float * orig_data = NULL;
int i, j;
size_t precision, offset;
size_t spos, epos, esize, mpos, msize;
@@ -4363,180 +4608,177 @@ test_nbit_flt_size(hid_t file)
TESTING(" nbit floating-number dataset size");
/* Set up data array */
- if(NULL == (orig_data = (float *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(float))))
+ if (NULL == (orig_data = (float *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(float))))
TEST_ERROR;
- if(NULL == (orig = (float **)HDcalloc(DSET_DIM1, sizeof(orig_data))))
+ if (NULL == (orig = (float **)HDcalloc(DSET_DIM1, sizeof(orig_data))))
TEST_ERROR;
for (i = 0; i < DSET_DIM1; i++)
orig[i] = orig_data + (i * DSET_DIM2);
- /* Define floating-point type for dataset
- *-------------------------------------------------------------------
- * size=4 byte, precision=16 bits, offset=8 bits,
- * mantissa size=9 bits, mantissa position=8,
- * exponent size=6 bits, exponent position=17,
- * exponent bias=31.
- * It can be illustrated in little-endian order as:
- * (S - sign bit, E - exponent bit, M - mantissa bit,
- * ? - padding bit)
- *
- * 3 2 1 0
- * ???????? SEEEEEEM MMMMMMMM ????????
- *
- * To create a new floating-point type, the following
- * properties must be set in the order of
- * set fields -> set offset -> set precision -> set size.
- * All these properties must be set before the type can function.
- * Other properties can be set anytime. Derived type size cannot
- * be expanded bigger than original size but can be decreased.
- * There should be no holes among the significant bits. Exponent
- * bias usually is set 2^(n-1)-1, where n is the exponent size.
- *-------------------------------------------------------------------*/
- if((datatype = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
- goto error;
- } /* end if */
-
- msize = 9;
- spos = 23;
- epos = 17;
- esize = 6;
- mpos = 8;
- offset = 8;
- precision = 16;
-
- if(H5Tset_fields(datatype, spos, epos, esize, mpos, msize)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tset_fields failed\n",__LINE__);
- goto error;
- } /* end if */
-
- if(H5Tset_offset(datatype,offset)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tset_offset failed\n",__LINE__);
- goto error;
- } /* end if */
-
- if(H5Tset_precision(datatype,precision)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tset_precision failed\n",__LINE__);
- goto error;
- } /* end if */
-
- if(H5Tset_size(datatype, 4)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
- goto error;
- } /* end if */
-
- /* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
+ /* Define floating-point type for dataset
+ *-------------------------------------------------------------------
+ * size=4 byte, precision=16 bits, offset=8 bits,
+ * mantissa size=9 bits, mantissa position=8,
+ * exponent size=6 bits, exponent position=17,
+ * exponent bias=31.
+ * It can be illustrated in little-endian order as:
+ * (S - sign bit, E - exponent bit, M - mantissa bit,
+ * ? - padding bit)
+ *
+ * 3 2 1 0
+ * ???????? SEEEEEEM MMMMMMMM ????????
+ *
+ * To create a new floating-point type, the following
+ * properties must be set in the order of
+ * set fields -> set offset -> set precision -> set size.
+ * All these properties must be set before the type can function.
+ * Other properties can be set anytime. Derived type size cannot
+ * be expanded bigger than original size but can be decreased.
+ * There should be no holes among the significant bits. Exponent
+ * bias usually is set 2^(n-1)-1, where n is the exponent size.
+ *-------------------------------------------------------------------*/
+ if ((datatype = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pset_order failed\n",__LINE__);
- goto error;
- } /* end if */
-
- if(H5Tset_ebias(datatype, 31)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
- goto error;
- } /* end if */
-
- /*
- * Initiliaze data buffer with random data
- */
- for (i=0; i < DSET_DIM1; i++)
- for (j=0; j < DSET_DIM2; j++)
- orig[i][j] = (float)(HDrandom() % 1234567) / 2;
-
-
- /* Describe the dataspace. */
- dims[0] = DSET_DIM1;
- dims[1] = DSET_DIM2;
- if((dataspace = H5Screate_simple (2, dims, NULL))<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
- goto error;
- } /* end if */
-
- /*
- * Set the dataset creation property list to specify the chunks
- */
- chunk_size[0] = DSET_DIM1/10;
- chunk_size[1] = DSET_DIM2/10;
- if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
- goto error;
- } /* end if */
-
- if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__);
- goto error;
- } /* end if */
-
- /*
- * Set for n-bit compression
- */
- if(H5Pset_nbit (dset_create_props)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__);
- goto error;
- } /* end if */
-
- /*
- * Create a new dataset within the file.
- */
- if((dataset = H5Dcreate2 (file, DSET_NBIT_FLT_SIZE_NAME, datatype,
- dataspace, H5P_DEFAULT,
- dset_create_props, H5P_DEFAULT))<0) {
- H5_FAILED();
- HDprintf(" line %d: H5dwrite failed\n",__LINE__);
- goto error;
- } /* end if */
-
- /*
- * Write the array to the file.
- */
- if(H5Dwrite (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, orig_data)<0) {
- H5_FAILED();
- HDprintf(" Line %d: H5Dwrite failed\n",__LINE__);
- goto error;
- } /* end if */
-
- /*
- * Get the precision of the data type
- */
- if((precision = H5Tget_precision(datatype)) == 0) {
- H5_FAILED();
- HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
- goto error;
- } /* end if */
-
- /*
- * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2
- */
- if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
- dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
- H5_FAILED();
- HDfprintf(stdout, " Line %d: wrong dataset size: %" PRIuHSIZE "\n",__LINE__, dset_size);
- goto error;
- } /* end if */
-
- H5Tclose (datatype);
- H5Dclose (dataset);
- H5Sclose (dataspace);
- H5Pclose (dset_create_props);
+ HDprintf(" line %d: H5Tcopy failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ msize = 9;
+ spos = 23;
+ epos = 17;
+ esize = 6;
+ mpos = 8;
+ offset = 8;
+ precision = 16;
+
+ if (H5Tset_fields(datatype, spos, epos, esize, mpos, msize) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Tset_fields failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ if (H5Tset_offset(datatype, offset) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Tset_offset failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ if (H5Tset_precision(datatype, precision) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Tset_precision failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ if (H5Tset_size(datatype, 4) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_size failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ /* Set order of dataset datatype */
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_order failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ if (H5Tset_ebias(datatype, 31) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_size failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Initiliaze data buffer with random data
+ */
+ for (i = 0; i < DSET_DIM1; i++)
+ for (j = 0; j < DSET_DIM2; j++)
+ orig[i][j] = (float)(HDrandom() % 1234567) / 2;
+
+ /* Describe the dataspace. */
+ dims[0] = DSET_DIM1;
+ dims[1] = DSET_DIM2;
+ if ((dataspace = H5Screate_simple(2, dims, NULL)) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pcreate failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Set the dataset creation property list to specify the chunks
+ */
+ chunk_size[0] = DSET_DIM1 / 10;
+ chunk_size[1] = DSET_DIM2 / 10;
+ if ((dset_create_props = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pcreate failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ if (H5Pset_chunk(dset_create_props, 2, chunk_size) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_chunk failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Set for n-bit compression
+ */
+ if (H5Pset_nbit(dset_create_props) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_nbit failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Create a new dataset within the file.
+ */
+ if ((dataset = H5Dcreate2(file, DSET_NBIT_FLT_SIZE_NAME, datatype, dataspace, H5P_DEFAULT,
+ dset_create_props, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5dwrite failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Write the array to the file.
+ */
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: H5Dwrite failed\n", __LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Get the precision of the data type
+ */
+ if ((precision = H5Tget_precision(datatype)) == 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: wrong precision size: %zu\n", __LINE__, precision);
+ goto error;
+ } /* end if */
+
+ /*
+ * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2
+ */
+ if ((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1 * DSET_DIM2 * (precision / 8) ||
+ dset_size > DSET_DIM1 * DSET_DIM2 * (precision / 8) + 1 * KB) {
+ H5_FAILED();
+ HDfprintf(stdout, " Line %d: wrong dataset size: %" PRIuHSIZE "\n", __LINE__, dset_size);
+ goto error;
+ } /* end if */
+
+ H5Tclose(datatype);
+ H5Dclose(dataset);
+ H5Sclose(dataspace);
+ H5Pclose(dset_create_props);
PASSED();
HDfree(orig);
HDfree(orig_data);
- return SUCCEED;
+ return SUCCEED;
error:
HDfree(orig);
HDfree(orig_data);
@@ -4562,12 +4804,12 @@ error:
static herr_t
test_scaleoffset_int(hid_t file)
{
- hid_t dataset, datatype, space, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2,5};
- int orig_data[2][5];
- int new_data[2][5];
- size_t i, j;
+ hid_t dataset, datatype, space, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
+ int orig_data[2][5];
+ int new_data[2][5];
+ size_t i, j;
HDputs("Testing scaleoffset filter");
TESTING(" scaleoffset int without fill value (setup)");
@@ -4575,34 +4817,41 @@ test_scaleoffset_int(hid_t file)
datatype = H5Tcopy(H5T_NATIVE_INT);
/* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE) < 0) goto error;
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0)
+ goto error;
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Create the dataset property list */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
/* Fill value undefined */
- if(H5Pset_fill_value(dc, datatype, NULL) < 0) goto error;
+ if (H5Pset_fill_value(dc, datatype, NULL) < 0)
+ goto error;
/* Set up to use scaleoffset filter, let library calculate minbits */
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_scaleoffset(dc, H5Z_SO_INT,H5Z_SO_INT_MINBITS_DEFAULT) < 0) goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_scaleoffset(dc, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_INT_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset =
+ H5Dcreate2(file, DSET_SCALEOFFSET_INT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ goto error;
/* Initialize data */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = HDrandom() % 10000;
+ for (i = 0; i < (size_t)size[0]; i++)
+ for (j = 0; j < (size_t)size[1]; j++) {
+ orig_data[i][j] = HDrandom() % 10000;
- /* even-numbered values are negtive */
- if((i*size[1]+j+1)%2 == 0)
- orig_data[i][j] = -orig_data[i][j];
- }
+ /* even-numbered values are negtive */
+ if ((i * size[1] + j + 1) % 2 == 0)
+ orig_data[i][j] = -orig_data[i][j];
+ }
PASSED();
@@ -4613,8 +4862,8 @@ test_scaleoffset_int(hid_t file)
*/
TESTING(" scaleoffset int without fill value (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0) goto error;
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ goto error;
PASSED();
/*----------------------------------------------------------------------
@@ -4624,13 +4873,13 @@ test_scaleoffset_int(hid_t file)
TESTING(" scaleoffset int without fill value (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0) goto error;
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(new_data[i][j] != orig_data[i][j]) {
+ for (i = 0; i < (size_t)size[0]; i++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (new_data[i][j] != orig_data[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -4643,10 +4892,14 @@ test_scaleoffset_int(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Tclose(datatype) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -4655,7 +4908,6 @@ error:
return FAIL;
} /* end test_scaleoffset_int() */
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_int_2
*
@@ -4674,62 +4926,74 @@ error:
static herr_t
test_scaleoffset_int_2(hid_t file)
{
- hid_t dataset, datatype, space, mspace, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2,5};
- int orig_data[2][5];
- int new_data[2][5];
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
- int fillval;
- size_t j;
+ hid_t dataset, datatype, space, mspace, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
+ int orig_data[2][5];
+ int new_data[2][5];
+ hsize_t start[2]; /* Start of hyperslab */
+ hsize_t stride[2]; /* Stride of hyperslab */
+ hsize_t count[2]; /* Block count */
+ hsize_t block[2]; /* Block sizes */
+ int fillval;
+ size_t j;
TESTING(" scaleoffset int with fill value (setup)");
datatype = H5Tcopy(H5T_NATIVE_INT);
/* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE) < 0) goto error;
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0)
+ goto error;
/* Create the data space for the dataset */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Create the dataset property list */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
/* Set fill value */
fillval = 10000;
- if(H5Pset_fill_value(dc, H5T_NATIVE_INT, &fillval) < 0) goto error;
+ if (H5Pset_fill_value(dc, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
/* Set up to use scaleoffset filter, let library calculate minbits */
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_scaleoffset(dc, H5Z_SO_INT,H5Z_SO_INT_MINBITS_DEFAULT) < 0) goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_scaleoffset(dc, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_INT_NAME_2, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_INT_NAME_2, datatype, space, H5P_DEFAULT, dc,
+ H5P_DEFAULT)) < 0)
+ goto error;
/* Create the memory data space */
- if((mspace = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((mspace = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Select hyperslab for data to write, using 1x5 blocks,
* (1,1) stride and (1,1) count starting at the position (0,0).
*/
- start[0] = 0; start[1] = 0;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 1; block[1] = 5;
- if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start,
- stride, count, block) < 0) goto error;
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 5;
+ if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ goto error;
/* Initialize data of hyperslab */
- for(j = 0; j < (size_t)size[1]; j++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
orig_data[0][j] = (int)HDrandom() % 10000;
/* even-numbered values are negtive */
- if((j+1)%2 == 0)
+ if ((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -4743,8 +5007,8 @@ test_scaleoffset_int_2(hid_t file)
TESTING(" scaleoffset int with fill value (write)");
/* only data in the hyperslab will be written, other value should be fill value */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, mspace, mspace, H5P_DEFAULT,
- orig_data) < 0) goto error;
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, mspace, mspace, H5P_DEFAULT, orig_data) < 0)
+ goto error;
PASSED();
/*----------------------------------------------------------------------
@@ -4754,12 +5018,12 @@ test_scaleoffset_int_2(hid_t file)
TESTING(" scaleoffset int with fill value (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_INT, mspace, mspace, H5P_DEFAULT,
- new_data) < 0) goto error;
+ if (H5Dread(dataset, H5T_NATIVE_INT, mspace, mspace, H5P_DEFAULT, new_data) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
- for(j=0; j<(size_t)size[1]; j++) {
- if(new_data[0][j] != orig_data[0][j]) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (new_data[0][j] != orig_data[0][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
@@ -4771,10 +5035,14 @@ test_scaleoffset_int_2(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Tclose(datatype) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -4783,7 +5051,6 @@ error:
return FAIL;
} /* end test_scaleoffset_int_2() */
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_float
*
@@ -4802,48 +5069,55 @@ error:
static herr_t
test_scaleoffset_float(hid_t file)
{
- hid_t dataset, datatype, space, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2,5};
- float orig_data[2][5];
- float new_data[2][5];
- size_t i, j;
+ hid_t dataset, datatype, space, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
+ float orig_data[2][5];
+ float new_data[2][5];
+ size_t i, j;
TESTING(" scaleoffset float without fill value, D-scaling (setup)");
datatype = H5Tcopy(H5T_NATIVE_FLOAT);
/* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE) < 0) goto error;
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0)
+ goto error;
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Create the dataset property list */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
/* Fill value undefined */
- if(H5Pset_fill_value(dc, datatype, NULL) < 0) goto error;
+ if (H5Pset_fill_value(dc, datatype, NULL) < 0)
+ goto error;
/* Set up to use scaleoffset filter, decimal scale factor is 3,
* use variable-minimum-bits method
*/
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_scaleoffset(dc, H5Z_SO_FLOAT_DSCALE,3) < 0) goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_scaleoffset(dc, H5Z_SO_FLOAT_DSCALE, 3) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_FLOAT_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_FLOAT_NAME, datatype, space, H5P_DEFAULT, dc,
+ H5P_DEFAULT)) < 0)
+ goto error;
/* Initialize data */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (float)(HDrandom() % 100000) / 1000.0F;
+ for (i = 0; i < (size_t)size[0]; i++)
+ for (j = 0; j < (size_t)size[1]; j++) {
+ orig_data[i][j] = (float)(HDrandom() % 100000) / 1000.0F;
- /* even-numbered values are negtive */
- if((i*size[1]+j+1)%2 == 0)
- orig_data[i][j] = -orig_data[i][j];
- }
+ /* even-numbered values are negtive */
+ if ((i * size[1] + j + 1) % 2 == 0)
+ orig_data[i][j] = -orig_data[i][j];
+ }
PASSED();
@@ -4854,8 +5128,8 @@ test_scaleoffset_float(hid_t file)
*/
TESTING(" scaleoffset float without fill value, D-scaling (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0) goto error;
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ goto error;
PASSED();
/*----------------------------------------------------------------------
@@ -4865,13 +5139,13 @@ test_scaleoffset_float(hid_t file)
TESTING(" scaleoffset float without fill value, D-scaling (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0) goto error;
+ if (H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -3.0F)) {
+ for (i = 0; i < (size_t)size[0]; i++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0F, -3.0F)) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -4884,10 +5158,14 @@ test_scaleoffset_float(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Tclose(datatype) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -4896,7 +5174,6 @@ error:
return FAIL;
} /* end test_scaleoffset_float() */
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_float_2
*
@@ -4915,64 +5192,76 @@ error:
static herr_t
test_scaleoffset_float_2(hid_t file)
{
- hid_t dataset, datatype, space, mspace, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2,5};
- float orig_data[2][5];
- float new_data[2][5];
- float fillval;
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
- size_t j;
+ hid_t dataset, datatype, space, mspace, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
+ float orig_data[2][5];
+ float new_data[2][5];
+ float fillval;
+ hsize_t start[2]; /* Start of hyperslab */
+ hsize_t stride[2]; /* Stride of hyperslab */
+ hsize_t count[2]; /* Block count */
+ hsize_t block[2]; /* Block sizes */
+ size_t j;
TESTING(" scaleoffset float with fill value, D-scaling (setup)");
datatype = H5Tcopy(H5T_NATIVE_FLOAT);
/* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE) < 0) goto error;
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0)
+ goto error;
/* Create the data space for the dataset */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Create the dataset property list */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
/* Set fill value */
fillval = 10000.0F;
- if(H5Pset_fill_value(dc, H5T_NATIVE_FLOAT, &fillval) < 0) goto error;
+ if (H5Pset_fill_value(dc, H5T_NATIVE_FLOAT, &fillval) < 0)
+ goto error;
/* Set up to use scaleoffset filter, decimal scale factor is 3,
* use variable-minimum-bits method
*/
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_scaleoffset(dc, H5Z_SO_FLOAT_DSCALE,3) < 0) goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_scaleoffset(dc, H5Z_SO_FLOAT_DSCALE, 3) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_FLOAT_NAME_2, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_FLOAT_NAME_2, datatype, space, H5P_DEFAULT, dc,
+ H5P_DEFAULT)) < 0)
+ goto error;
/* Create the memory data space */
- if((mspace = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((mspace = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Select hyperslab for data to write, using 1x5 blocks,
* (1,1) stride and (1,1) count starting at the position (0,0).
*/
- start[0] = 0; start[1] = 0;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 1; block[1] = 5;
- if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start,
- stride, count, block) < 0) goto error;
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 5;
+ if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ goto error;
/* Initialize data of hyperslab */
- for(j = 0; j < (size_t)size[1]; j++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
orig_data[0][j] = (float)(HDrandom() % 100000) / 1000.0F;
/* even-numbered values are negtive */
- if((j + 1) % 2 == 0)
+ if ((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -4986,8 +5275,8 @@ test_scaleoffset_float_2(hid_t file)
TESTING(" scaleoffset float with fill value, D-scaling (write)");
/* only data in the hyperslab will be written, other value should be fill value */
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, mspace, mspace, H5P_DEFAULT,
- orig_data) < 0) goto error;
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, mspace, mspace, H5P_DEFAULT, orig_data) < 0)
+ goto error;
PASSED();
/*----------------------------------------------------------------------
@@ -4997,12 +5286,12 @@ test_scaleoffset_float_2(hid_t file)
TESTING(" scaleoffset float with fill value, D-scaling (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_FLOAT, mspace, mspace, H5P_DEFAULT,
- new_data) < 0) goto error;
+ if (H5Dread(dataset, H5T_NATIVE_FLOAT, mspace, mspace, H5P_DEFAULT, new_data) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
- for(j=0; j<(size_t)size[1]; j++) {
- if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -3.0F)) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0F, -3.0F)) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
@@ -5013,10 +5302,14 @@ test_scaleoffset_float_2(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Tclose(datatype) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -5025,7 +5318,6 @@ error:
return FAIL;
} /* end test_scaleoffset_float_2() */
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_double
*
@@ -5044,48 +5336,55 @@ error:
static herr_t
test_scaleoffset_double(hid_t file)
{
- hid_t dataset, datatype, space, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2,5};
- double orig_data[2][5];
- double new_data[2][5];
- size_t i, j;
+ hid_t dataset, datatype, space, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
+ double orig_data[2][5];
+ double new_data[2][5];
+ size_t i, j;
TESTING(" scaleoffset double without fill value, D-scaling (setup)");
datatype = H5Tcopy(H5T_NATIVE_DOUBLE);
/* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE) < 0) goto error;
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0)
+ goto error;
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Create the dataset property list */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
/* Fill value undefined */
- if(H5Pset_fill_value(dc, datatype, NULL) < 0) goto error;
+ if (H5Pset_fill_value(dc, datatype, NULL) < 0)
+ goto error;
/* Set up to use scaleoffset filter, decimal scale factor is 7,
* use variable-minimum-bits method
*/
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_scaleoffset(dc, H5Z_SO_FLOAT_DSCALE,7) < 0) goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_scaleoffset(dc, H5Z_SO_FLOAT_DSCALE, 7) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_DOUBLE_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_DOUBLE_NAME, datatype, space, H5P_DEFAULT, dc,
+ H5P_DEFAULT)) < 0)
+ goto error;
/* Initialize data */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
+ for (i = 0; i < (size_t)size[0]; i++)
+ for (j = 0; j < (size_t)size[1]; j++) {
+ orig_data[i][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
- /* even-numbered values are negtive */
- if((i* size[1] + j + 1) % 2 == 0)
- orig_data[i][j] = -orig_data[i][j];
- }
+ /* even-numbered values are negtive */
+ if ((i * size[1] + j + 1) % 2 == 0)
+ orig_data[i][j] = -orig_data[i][j];
+ }
PASSED();
@@ -5096,8 +5395,8 @@ test_scaleoffset_double(hid_t file)
*/
TESTING(" scaleoffset double without fill value, D-scaling (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0) goto error;
+ if (H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ goto error;
PASSED();
/*----------------------------------------------------------------------
@@ -5107,13 +5406,13 @@ test_scaleoffset_double(hid_t file)
TESTING(" scaleoffset double without fill value, D-scaling (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0) goto error;
+ if (H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -7.0F)) {
+ for (i = 0; i < (size_t)size[0]; i++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (HDfabs(new_data[i][j] - orig_data[i][j]) > HDpow(10.0F, -7.0F)) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -5126,10 +5425,14 @@ test_scaleoffset_double(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Tclose(datatype) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -5138,7 +5441,6 @@ error:
return FAIL;
} /* end test_scaleoffset_double() */
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_double_2
*
@@ -5157,64 +5459,76 @@ error:
static herr_t
test_scaleoffset_double_2(hid_t file)
{
- hid_t dataset, datatype, space, mspace, dc;
- const hsize_t size[2] = {2, 5};
- const hsize_t chunk_size[2] = {2,5};
- double orig_data[2][5];
- double new_data[2][5];
- double fillval;
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
- size_t j;
+ hid_t dataset, datatype, space, mspace, dc;
+ const hsize_t size[2] = {2, 5};
+ const hsize_t chunk_size[2] = {2, 5};
+ double orig_data[2][5];
+ double new_data[2][5];
+ double fillval;
+ hsize_t start[2]; /* Start of hyperslab */
+ hsize_t stride[2]; /* Stride of hyperslab */
+ hsize_t count[2]; /* Block count */
+ hsize_t block[2]; /* Block sizes */
+ size_t j;
TESTING(" scaleoffset double with fill value, D-scaling (setup)");
datatype = H5Tcopy(H5T_NATIVE_DOUBLE);
/* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE) < 0) goto error;
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0)
+ goto error;
/* Create the data space for the dataset */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((space = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Create the dataset property list */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if ((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
/* Set fill value */
fillval = 10000.0F;
- if(H5Pset_fill_value(dc, H5T_NATIVE_DOUBLE, &fillval) < 0) goto error;
+ if (H5Pset_fill_value(dc, H5T_NATIVE_DOUBLE, &fillval) < 0)
+ goto error;
/* Set up to use scaleoffset filter, decimal scale factor is 7,
* use variable-minimum-bits method
*/
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_scaleoffset(dc, H5Z_SO_FLOAT_DSCALE,7) < 0) goto error;
+ if (H5Pset_chunk(dc, 2, chunk_size) < 0)
+ goto error;
+ if (H5Pset_scaleoffset(dc, H5Z_SO_FLOAT_DSCALE, 7) < 0)
+ goto error;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_DOUBLE_NAME_2, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset = H5Dcreate2(file, DSET_SCALEOFFSET_DOUBLE_NAME_2, datatype, space, H5P_DEFAULT, dc,
+ H5P_DEFAULT)) < 0)
+ goto error;
/* Create the memory data space */
- if((mspace = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if ((mspace = H5Screate_simple(2, size, NULL)) < 0)
+ goto error;
/* Select hyperslab for data to write, using 1x5 blocks,
* (1,1) stride and (1,1) count starting at the position (0,0).
*/
- start[0] = 0; start[1] = 0;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 1; block[1] = 5;
- if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start,
- stride, count, block) < 0) goto error;
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 5;
+ if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ goto error;
/* Initialize data of hyperslab */
- for(j = 0; j < (size_t)size[1]; j++) {
+ for (j = 0; j < (size_t)size[1]; j++) {
orig_data[0][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
/* even-numbered values are negtive */
- if((j + 1) % 2 == 0)
+ if ((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -5228,8 +5542,8 @@ test_scaleoffset_double_2(hid_t file)
TESTING(" scaleoffset double with fill value, D-scaling (write)");
/* only data in the hyperslab will be written, other value should be fill value */
- if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, mspace, mspace, H5P_DEFAULT,
- orig_data) < 0) goto error;
+ if (H5Dwrite(dataset, H5T_NATIVE_DOUBLE, mspace, mspace, H5P_DEFAULT, orig_data) < 0)
+ goto error;
PASSED();
/*----------------------------------------------------------------------
@@ -5239,12 +5553,12 @@ test_scaleoffset_double_2(hid_t file)
TESTING(" scaleoffset double with fill value, D-scaling (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_DOUBLE, mspace, mspace, H5P_DEFAULT,
- new_data) < 0) goto error;
+ if (H5Dread(dataset, H5T_NATIVE_DOUBLE, mspace, mspace, H5P_DEFAULT, new_data) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
- for(j=0; j<(size_t)size[1]; j++) {
- if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -7.0F)) {
+ for (j = 0; j < (size_t)size[1]; j++) {
+ if (HDfabs(new_data[0][j] - orig_data[0][j]) > HDpow(10.0F, -7.0F)) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
@@ -5256,10 +5570,14 @@ test_scaleoffset_double_2(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Tclose(datatype) < 0)
+ goto error;
+ if (H5Pclose(dc) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
PASSED();
@@ -5268,7 +5586,6 @@ error:
return FAIL;
} /* end test_scaleoffset_double_2() */
-
/*-------------------------------------------------------------------------
* Function: test_multiopen
*
@@ -5287,55 +5604,69 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_multiopen (hid_t file)
+test_multiopen(hid_t file)
{
- hid_t dcpl = -1, space = -1, dset1 = -1, dset2 = -1;
- hsize_t cur_size[1] = {10};
- hsize_t tmp_size[1];
+ hid_t dcpl = -1, space = -1, dset1 = -1, dset2 = -1;
+ hsize_t cur_size[1] = {10};
+ hsize_t tmp_size[1];
static hsize_t max_size[1] = {H5S_UNLIMITED};
TESTING("multi-open with extending");
/* Create the dataset and open it twice */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dcpl, 1, cur_size) < 0) goto error;
- if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error;
- if((dset1 = H5Dcreate2(file, "multiopen", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
- if((dset2 = H5Dopen2(dset1, ".", H5P_DEFAULT)) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, 1, cur_size) < 0)
+ goto error;
+ if ((space = H5Screate_simple(1, cur_size, max_size)) < 0)
+ goto error;
+ if ((dset1 = H5Dcreate2(file, "multiopen", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dset2 = H5Dopen2(dset1, ".", H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
/* Extend with the first handle */
cur_size[0] = 20;
- if(H5Dset_extent(dset1, cur_size) < 0) goto error;
+ if (H5Dset_extent(dset1, cur_size) < 0)
+ goto error;
/* Get the size from the second handle */
- if((space = H5Dget_space(dset2)) < 0) goto error;
- if(H5Sget_simple_extent_dims(space, tmp_size, NULL) < 0) goto error;
- if(cur_size[0] != tmp_size[0]) {
+ if ((space = H5Dget_space(dset2)) < 0)
+ goto error;
+ if (H5Sget_simple_extent_dims(space, tmp_size, NULL) < 0)
+ goto error;
+ if (cur_size[0] != tmp_size[0]) {
H5_FAILED();
HDprintf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]);
goto error;
} /* end if */
- if(H5Dclose(dset1) < 0) goto error;
- if(H5Dclose(dset2) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Dclose(dset1) < 0)
+ goto error;
+ if (H5Dclose(dset2) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
PASSED();
return SUCCEED;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset1);
H5Dclose(dset2);
H5Sclose(space);
H5Pclose(dcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_multiopen() */
-
/*-------------------------------------------------------------------------
* Function: test_types
*
@@ -5353,96 +5684,109 @@ test_multiopen (hid_t file)
static herr_t
test_types(hid_t file)
{
- hid_t grp=-1, type=-1, space=-1, dset=-1;
+ hid_t grp = -1, type = -1, space = -1, dset = -1;
size_t i;
- hsize_t nelmts;
- unsigned char buf[32];
+ hsize_t nelmts;
+ unsigned char buf[32];
TESTING("various datatypes");
- if((grp = H5Gcreate2(file, "typetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if ((grp = H5Gcreate2(file, "typetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* bitfield_1 */
nelmts = sizeof(buf);
- if((type=H5Tcopy(H5T_STD_B8LE)) < 0 ||
- (space=H5Screate_simple(1, &nelmts, NULL)) < 0 ||
- (dset=H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
- for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i);
- if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto error;
-
- if(H5Sclose(space) < 0) goto error;
- if(H5Tclose(type) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
+ if ((type = H5Tcopy(H5T_STD_B8LE)) < 0 || (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < sizeof buf; i++)
+ buf[i] = (unsigned char)(0xff ^ i);
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
/* bitfield_2 */
- nelmts = sizeof(buf)/2;
- if((type=H5Tcopy(H5T_STD_B16LE)) < 0 ||
- (space=H5Screate_simple(1, &nelmts, NULL)) < 0 ||
- (dset=H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
- for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i);
- if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Tclose(type) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
+ nelmts = sizeof(buf) / 2;
+ if ((type = H5Tcopy(H5T_STD_B16LE)) < 0 || (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < sizeof buf; i++)
+ buf[i] = (unsigned char)(0xff ^ i);
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
/* opaque_1 */
nelmts = sizeof(buf);
- if((type = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0 ||
- H5Tset_tag(type, "testing 1-byte opaque type") < 0 ||
- (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
- (dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
- for(i = 0; i < sizeof buf; i++)
+ if ((type = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0 || H5Tset_tag(type, "testing 1-byte opaque type") < 0 ||
+ (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < sizeof buf; i++)
buf[i] = (unsigned char)(0xff ^ i);
- if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Tclose(type) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
/* opaque_2 */
- nelmts = sizeof(buf)/4;
- if((type = H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0 ||
- H5Tset_tag(type, "testing 4-byte opaque type") < 0 ||
- (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
- (dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
- for(i = 0; i < sizeof buf; i++)
+ nelmts = sizeof(buf) / 4;
+ if ((type = H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0 || H5Tset_tag(type, "testing 4-byte opaque type") < 0 ||
+ (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < sizeof buf; i++)
buf[i] = (unsigned char)(0xff ^ i);
- if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Tclose(type) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
/* Cleanup */
- if(H5Gclose(grp) < 0) goto error;
+ if (H5Gclose(grp) < 0)
+ goto error;
PASSED();
return SUCCEED;
- error:
- H5E_BEGIN_TRY {
- H5Gclose(grp);
- H5Tclose(type);
- H5Sclose(space);
- H5Dclose(dset);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(grp);
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Dclose(dset);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_types() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
- H5Z_CLASS_T_VERS,
- H5Z_FILTER_CAN_APPLY_TEST, /* Filter id number */
- 1, 1,
- "can_apply_test", /* Filter name for debugging */
- can_apply_bogus, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_bogus, /* The actual filter function */
+ H5Z_CLASS_T_VERS, H5Z_FILTER_CAN_APPLY_TEST, /* Filter id number */
+ 1, 1, "can_apply_test", /* Filter name for debugging */
+ can_apply_bogus, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_bogus, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: test_can_apply
*
@@ -5462,149 +5806,153 @@ const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
static herr_t
test_can_apply(hid_t file)
{
- hid_t dsid; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t dcpl; /* Dataspace creation property list ID */
- const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
- hsize_t dset_size; /* Dataset size */
- size_t i,j; /* Local index variables */
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataspace creation property list ID */
+ const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
+ hsize_t dset_size; /* Dataset size */
+ size_t i, j; /* Local index variables */
TESTING("dataset filter 'can apply' callback");
/* Create dcpl with special filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n", __LINE__);
goto error;
} /* end if */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n", __LINE__);
goto error;
} /* end if */
- if(H5Zregister (H5Z_CAN_APPLY_TEST) < 0) {
+ if (H5Zregister(H5Z_CAN_APPLY_TEST) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
+ HDprintf(" Line %d: Can't register 'can apply' filter\n", __LINE__);
goto error;
}
/* The filter is mandate. */
- if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) {
+ if (H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't set bogus filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set bogus filter\n", __LINE__);
goto error;
}
/* Create the data space */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n", __LINE__);
goto error;
} /* end if */
/* Create new dataset */
/* (Should fail because the 'can apply' function should indicate inappropriate
* combination. And the filter is mandate.) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dsid >=0) {
+ }
+ H5E_END_TRY;
+ if (dsid >= 0) {
H5_FAILED();
- HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't have created dataset!\n", __LINE__);
H5Dclose(dsid);
goto error;
} /* end if */
/* (Should fail because the 'can apply' function should fail) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dsid >=0) {
+ }
+ H5E_END_TRY;
+ if (dsid >= 0) {
H5_FAILED();
- HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't have created dataset!\n", __LINE__);
H5Dclose(dsid);
goto error;
} /* end if */
/* Create new dataset */
- if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ if ((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) <
+ 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n", __LINE__);
goto error;
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n", __LINE__);
goto error;
} /* end if */
/* Flush the file (to clear the cache) */
- if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
+ if (H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error flushing file\n",__LINE__);
+ HDprintf(" Line %d: Error flushing file\n", __LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
- if((dset_size=H5Dget_storage_size(dsid))==0) {
+ if ((dset_size = H5Dget_storage_size(dsid)) == 0) {
H5_FAILED();
- HDprintf(" Line %d: Error querying dataset size\n",__LINE__);
+ HDprintf(" Line %d: Error querying dataset size\n", __LINE__);
goto error;
} /* end if */
/* Verify that the size indicates data is uncompressed */
- if((H5Tget_size(H5T_NATIVE_INT)*dims[0]*dims[1])!=dset_size) {
+ if ((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) {
H5_FAILED();
- HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
+ HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
+ if (H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
} /* end if */
/* Compare data */
/* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)dims[0]; i++) {
- for(j=0; j<(size_t)dims[1]; j++) {
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- HDprintf(" Line %d: Read different values than written.\n",__LINE__);
- HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- HDprintf(" At original: %d\n",points[i][j]);
- HDprintf(" At returned: %d\n",check[i][j]);
- goto error;
- } /* end if */
- } /* end for */
- } /* end for */
+ for (i = 0; i < (size_t)dims[0]; i++) {
+ for (j = 0; j < (size_t)dims[1]; j++) {
+ if (points[i][j] != check[i][j]) {
+ H5_FAILED();
+ HDprintf(" Line %d: Read different values than written.\n", __LINE__);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ HDprintf(" At original: %d\n", points[i][j]);
+ HDprintf(" At returned: %d\n", check[i][j]);
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Close dataset */
- if(H5Dclose(dsid) < 0) {
+ if (H5Dclose(dsid) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Close dataspace */
- if(H5Sclose(sid) < 0) {
+ if (H5Sclose(sid) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataspace\n", __LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
- if(H5Pclose(dcpl) < 0) {
+ if (H5Pclose(dcpl) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't close dcpl\n", __LINE__);
goto error;
} /* end if */
-
PASSED();
return SUCCEED;
@@ -5614,16 +5962,13 @@ error:
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CAN_APPLY_TEST2[1] = {{
- H5Z_CLASS_T_VERS,
- H5Z_FILTER_CAN_APPLY_TEST2, /* Filter id number */
- 1, 1,
- "can_apply_test", /* Filter name for debugging */
- can_apply_bogus, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_bogus3, /* The actual filter function */
+ H5Z_CLASS_T_VERS, H5Z_FILTER_CAN_APPLY_TEST2, /* Filter id number */
+ 1, 1, "can_apply_test", /* Filter name for debugging */
+ can_apply_bogus, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_bogus3, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: test_can_apply2
*
@@ -5645,125 +5990,125 @@ const H5Z_class2_t H5Z_CAN_APPLY_TEST2[1] = {{
static herr_t
test_can_apply2(hid_t file)
{
- hid_t dsid; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t dcpl; /* Dataspace creation property list ID */
- const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
- hsize_t dset_size; /* Dataset size */
- size_t i,j; /* Local index variables */
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataspace creation property list ID */
+ const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
+ hsize_t dset_size; /* Dataset size */
+ size_t i, j; /* Local index variables */
TESTING("dataset filter 'can apply' callback second");
/* Create dcpl with special filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n", __LINE__);
goto error;
} /* end if */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n", __LINE__);
goto error;
} /* end if */
- if(H5Zregister (H5Z_CAN_APPLY_TEST2) < 0) {
+ if (H5Zregister(H5Z_CAN_APPLY_TEST2) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
+ HDprintf(" Line %d: Can't register 'can apply' filter\n", __LINE__);
goto error;
}
/* The filter is optional. */
- if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST2, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) {
+ if (H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST2, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't set bogus filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set bogus filter\n", __LINE__);
goto error;
}
/* Create the data space */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n", __LINE__);
goto error;
} /* end if */
/* Create new dataset */
- if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ if ((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n", __LINE__);
goto error;
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n", __LINE__);
goto error;
} /* end if */
/* Flush the file (to clear the cache) */
- if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
+ if (H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error flushing file\n",__LINE__);
+ HDprintf(" Line %d: Error flushing file\n", __LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
- if((dset_size=H5Dget_storage_size(dsid))==0) {
+ if ((dset_size = H5Dget_storage_size(dsid)) == 0) {
H5_FAILED();
- HDprintf(" Line %d: Error querying dataset size\n",__LINE__);
+ HDprintf(" Line %d: Error querying dataset size\n", __LINE__);
goto error;
} /* end if */
/* Verify that the size indicates data is uncompressed */
- if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) {
+ if ((H5Tget_size(H5T_NATIVE_DOUBLE) * dims[0] * dims[1]) != dset_size) {
H5_FAILED();
- HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
+ HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
+ if (H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
} /* end if */
/* Compare data */
/* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)dims[0]; i++) {
- for(j=0; j<(size_t)dims[1]; j++) {
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- HDprintf(" Line %d: Read different values than written.\n",__LINE__);
- HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- HDprintf(" At original: %d\n",points[i][j]);
- HDprintf(" At returned: %d\n",check[i][j]);
- goto error;
- } /* end if */
- } /* end for */
- } /* end for */
+ for (i = 0; i < (size_t)dims[0]; i++) {
+ for (j = 0; j < (size_t)dims[1]; j++) {
+ if (points[i][j] != check[i][j]) {
+ H5_FAILED();
+ HDprintf(" Line %d: Read different values than written.\n", __LINE__);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ HDprintf(" At original: %d\n", points[i][j]);
+ HDprintf(" At returned: %d\n", check[i][j]);
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Close dataset */
- if(H5Dclose(dsid) < 0) {
+ if (H5Dclose(dsid) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Close dataspace */
- if(H5Sclose(sid) < 0) {
+ if (H5Sclose(sid) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataspace\n", __LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
- if(H5Pclose(dcpl) < 0) {
+ if (H5Pclose(dcpl) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't close dcpl\n", __LINE__);
goto error;
} /* end if */
-
PASSED();
return SUCCEED;
@@ -5771,7 +6116,6 @@ error:
return FAIL;
} /* end test_can_apply2() */
-
/*-------------------------------------------------------------------------
* Function: test_optional_filters
*
@@ -5790,84 +6134,97 @@ error:
static herr_t
test_optional_filters(hid_t file)
{
- unsigned int level = 9;
+ unsigned int level = 9;
unsigned int cd_values[1] = {level};
- size_t cd_nelmts = 1;
- hsize_t dim1d[1]; /* Dataspace dimensions */
- hid_t dsid = H5I_INVALID_HID; /* Dataset ID */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t strtid = H5I_INVALID_HID; /* Datatype ID for string */
- hid_t vlentid = H5I_INVALID_HID; /* Datatype ID for vlen */
- hid_t dcplid = H5I_INVALID_HID; /* Dataspace creation property list ID */
+ size_t cd_nelmts = 1;
+ hsize_t dim1d[1]; /* Dataspace dimensions */
+ hid_t dsid = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t strtid = H5I_INVALID_HID; /* Datatype ID for string */
+ hid_t vlentid = H5I_INVALID_HID; /* Datatype ID for vlen */
+ hid_t dcplid = H5I_INVALID_HID; /* Dataspace creation property list ID */
TESTING("dataset with optional filters");
/* Create dcpl with special filter */
- if((dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Create the datatype */
- if((strtid = H5Tcreate(H5T_STRING, H5T_VARIABLE)) < 0) TEST_ERROR;
+ if ((strtid = H5Tcreate(H5T_STRING, H5T_VARIABLE)) < 0)
+ TEST_ERROR;
/* Create the data space */
- if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR;
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR;
/* The filter is optional. */
- if(H5Pset_filter(dcplid, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, cd_nelmts, cd_values) < 0)
+ if (H5Pset_filter(dcplid, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, cd_nelmts, cd_values) < 0)
TEST_ERROR;
/* Create dataset with optional filter */
- if((dsid = H5Dcreate2(file, DSET_OPTIONAL_SCALAR, strtid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(file, DSET_OPTIONAL_SCALAR, strtid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dsid) < 0) TEST_ERROR;
+ if (H5Dclose(dsid) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR;
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(strtid) < 0) TEST_ERROR;
+ if (H5Tclose(strtid) < 0)
+ TEST_ERROR;
/* Set dataspace dimensions */
- dim1d[0]=DIM1;
+ dim1d[0] = DIM1;
/* Create a non-scalar dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR;
/* Create a vlen datatype */
- if((vlentid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ((vlentid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR;
/* Create dataset with optional filter */
- if((dsid = H5Dcreate2(file, DSET_OPTIONAL_VLEN, vlentid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(file, DSET_OPTIONAL_VLEN, vlentid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dsid) < 0) TEST_ERROR;
+ if (H5Dclose(dsid) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR;
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(vlentid) < 0) TEST_ERROR;
+ if (H5Tclose(vlentid) < 0)
+ TEST_ERROR;
/* Close dataset creation property list */
- if(H5Pclose(dcplid) < 0) TEST_ERROR;
+ if (H5Pclose(dcplid) < 0)
+ TEST_ERROR;
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dsid);
H5Sclose(sid);
H5Pclose(dcplid);
H5Tclose(strtid);
H5Tclose(vlentid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_optional_filters() */
-
/*-------------------------------------------------------------------------
* Function: test_can_apply_szip
*
@@ -5885,170 +6242,174 @@ error:
static herr_t
test_can_apply_szip(hid_t
#ifndef H5_HAVE_FILTER_SZIP
-H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5_HAVE_FILTER_SZIP */
-file)
+ file)
{
#ifdef H5_HAVE_FILTER_SZIP
- hid_t dsid; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t dcpl; /* Dataspace creation property list ID */
- unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block;
- const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
- const hsize_t dims2[2] = {4, 2}; /* Dataspace dimensions */
- const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataspace creation property list ID */
+ unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block;
+ const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
+ const hsize_t dims2[2] = {4, 2}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
const hsize_t chunk_dims2[2] = {2, 1}; /* Chunk dimensions */
- herr_t ret; /* Status value */
-#endif /* H5_HAVE_FILTER_SZIP */
+ herr_t ret; /* Status value */
+#endif /* H5_HAVE_FILTER_SZIP */
TESTING("dataset szip filter 'can apply' callback");
#ifdef H5_HAVE_FILTER_SZIP
- if(h5_szip_can_encode() == 1) {
- /* Create the data space */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
- goto error;
- } /* end if */
-
- /* Create dcpl with special filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
- goto error;
- } /* end if */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
- goto error;
- } /* end if */
+ if (h5_szip_can_encode() == 1) {
+ /* Create the data space */
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't open dataspace\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Set (invalid at property set time) szip parameters */
- szip_pixels_per_block=3;
- H5E_BEGIN_TRY {
- ret=H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block);
- } H5E_END_TRY;
- if(ret>=0) {
- H5_FAILED();
- HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__);
- goto error;
- }
+ /* Create dcpl with special filter */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't create dcpl\n", __LINE__);
+ goto error;
+ } /* end if */
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't set chunk sizes\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Set (invalid at property set time) szip parameters */
- szip_pixels_per_block=512;
- H5E_BEGIN_TRY {
- ret=H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block);
- } H5E_END_TRY;
- if(ret>=0) {
- H5_FAILED();
- HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__);
- goto error;
- }
+ /* Set (invalid at property set time) szip parameters */
+ szip_pixels_per_block = 3;
+ H5E_BEGIN_TRY { ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block); }
+ H5E_END_TRY;
+ if (ret >= 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Shouldn't be able to set szip filter\n", __LINE__);
+ goto error;
+ }
- /* Set (invalid at dataset creation time) szip parameters */
- szip_pixels_per_block=2;
- if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't set szip filter\n",__LINE__);
- goto error;
- }
+ /* Set (invalid at property set time) szip parameters */
+ szip_pixels_per_block = 512;
+ H5E_BEGIN_TRY { ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block); }
+ H5E_END_TRY;
+ if (ret >= 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Shouldn't be able to set szip filter\n", __LINE__);
+ goto error;
+ }
- /* Create new dataset */
- /* (Should succeed; according to the new algorithm, scanline should be reset
- to 2*128 satisfying 'maximum blocks per scanline' condition) */
- H5E_BEGIN_TRY {
- dsid = H5Dcreate2(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dsid <=0) {
- H5_FAILED();
- HDprintf(" Line %d: Should have created dataset!\n",__LINE__);
- goto error;
- } /* end if */
+ /* Set (invalid at dataset creation time) szip parameters */
+ szip_pixels_per_block = 2;
+ if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't set szip filter\n", __LINE__);
+ goto error;
+ }
- /* Close dataset */
- if(H5Dclose(dsid) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't close dataset\n",__LINE__);
- goto error;
- } /* end if */
+ /* Create new dataset */
+ /* (Should succeed; according to the new algorithm, scanline should be reset
+ to 2*128 satisfying 'maximum blocks per scanline' condition) */
+ H5E_BEGIN_TRY
+ {
+ dsid = H5Dcreate2(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (dsid <= 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Should have created dataset!\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Close dataspace */
- if(H5Sclose(sid) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
- goto error;
- } /* end if */
+ /* Close dataset */
+ if (H5Dclose(dsid) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't close dataset\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Close dataset creation property list */
- if(H5Pclose(dcpl) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
- goto error;
- } /* end if */
+ /* Close dataspace */
+ if (H5Sclose(sid) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't close dataspace\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Create another data space */
- if((sid = H5Screate_simple(2, dims2, NULL)) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
- goto error;
- } /* end if */
+ /* Close dataset creation property list */
+ if (H5Pclose(dcpl) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't close dcpl\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Create dcpl with special filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
- goto error;
- } /* end if */
- if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
- goto error;
- } /* end if */
+ /* Create another data space */
+ if ((sid = H5Screate_simple(2, dims2, NULL)) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't open dataspace\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Set (invalid at dataset creation time) szip parameters */
- szip_pixels_per_block=32;
- if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't set szip filter\n",__LINE__);
- goto error;
- }
+ /* Create dcpl with special filter */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't create dcpl\n", __LINE__);
+ goto error;
+ } /* end if */
+ if (H5Pset_chunk(dcpl, 2, chunk_dims2) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't set chunk sizes\n", __LINE__);
+ goto error;
+ } /* end if */
- /* Create new dataset */
- /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
- H5E_BEGIN_TRY {
- dsid = H5Dcreate2(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dsid >=0) {
- H5_FAILED();
- HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
- H5Dclose(dsid);
- goto error;
- } /* end if */
+ /* Set (invalid at dataset creation time) szip parameters */
+ szip_pixels_per_block = 32;
+ if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't set szip filter\n", __LINE__);
+ goto error;
+ }
- /* Close dataspace */
- if(H5Sclose(sid) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
- goto error;
- } /* end if */
+ /* Create new dataset */
+ /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
+ H5E_BEGIN_TRY
+ {
+ dsid = H5Dcreate2(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (dsid >= 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Shouldn't have created dataset!\n", __LINE__);
+ H5Dclose(dsid);
+ goto error;
+ } /* end if */
- /* Close dataset creation property list */
- if(H5Pclose(dcpl) < 0) {
- H5_FAILED();
- HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
- goto error;
- } /* end if */
+ /* Close dataspace */
+ if (H5Sclose(sid) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't close dataspace\n", __LINE__);
+ goto error;
+ } /* end if */
+ /* Close dataset creation property list */
+ if (H5Pclose(dcpl) < 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: Can't close dcpl\n", __LINE__);
+ goto error;
+ } /* end if */
- PASSED();
-} else {
- SKIPPED();
- HDputs(" Szip encoding is not enabled.");
-}
-#else /* H5_HAVE_FILTER_SZIP */
+ PASSED();
+ }
+ else {
+ SKIPPED();
+ HDputs(" Szip encoding is not enabled.");
+ }
+#else /* H5_HAVE_FILTER_SZIP */
SKIPPED();
HDputs(" Szip filter is not enabled.");
#endif /* H5_HAVE_FILTER_SZIP */
@@ -6060,19 +6421,15 @@ error:
#endif /* H5_HAVE_FILTER_SZIP */
} /* end test_can_apply_szip() */
-
/* This message derives from H5Z */
const H5Z_class2_t H5Z_SET_LOCAL_TEST[1] = {{
- H5Z_CLASS_T_VERS,
- H5Z_FILTER_SET_LOCAL_TEST, /* Filter id number */
- 1, 1,
- "set_local_test", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- set_local_bogus2, /* The "set local" callback */
- filter_bogus2, /* The actual filter function */
+ H5Z_CLASS_T_VERS, H5Z_FILTER_SET_LOCAL_TEST, /* Filter id number */
+ 1, 1, "set_local_test", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ set_local_bogus2, /* The "set local" callback */
+ filter_bogus2, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: test_set_local
*
@@ -6089,160 +6446,162 @@ const H5Z_class2_t H5Z_SET_LOCAL_TEST[1] = {{
static herr_t
test_set_local(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t file; /* File ID */
- hid_t dsid; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t dcpl; /* Dataspace creation property list ID */
- const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
- hsize_t dset_size; /* Dataset size */
- unsigned cd_values[2]={BOGUS2_PARAM_1, BOGUS2_PARAM_2}; /* Parameters for Bogus2 filter */
- size_t i,j; /* Local index variables */
- double n; /* Local index variables */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t file; /* File ID */
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataspace creation property list ID */
+ const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
+ hsize_t dset_size; /* Dataset size */
+ unsigned cd_values[2] = {BOGUS2_PARAM_1, BOGUS2_PARAM_2}; /* Parameters for Bogus2 filter */
+ size_t i, j; /* Local index variables */
+ double n; /* Local index variables */
TESTING("dataset filter 'set local' callback");
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
/* Initialize the integer & floating-point dataset */
- n=1.0F;
- for(i = 0; i < DSET_DIM1; i++)
- for(j = 0; j < DSET_DIM2; j++) {
- points[i][j] = (int)n++;
- points_dbl[i][j] = (double)1.5F*n++;
- }
+ n = 1.0F;
+ for (i = 0; i < DSET_DIM1; i++)
+ for (j = 0; j < DSET_DIM2; j++) {
+ points[i][j] = (int)n++;
+ points_dbl[i][j] = (double)1.5F * n++;
+ }
/* Open file */
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't open file\n",__LINE__);
- goto error;
+ HDprintf(" Line %d: Can't open file\n", __LINE__);
+ goto error;
}
/* Create dcpl with special filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n", __LINE__);
goto error;
} /* end if */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n", __LINE__);
goto error;
} /* end if */
- if(H5Zregister (H5Z_SET_LOCAL_TEST) < 0) {
+ if (H5Zregister(H5Z_SET_LOCAL_TEST) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't register 'set local' filter\n",__LINE__);
+ HDprintf(" Line %d: Can't register 'set local' filter\n", __LINE__);
goto error;
}
- if(H5Pset_filter(dcpl, H5Z_FILTER_SET_LOCAL_TEST, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) {
+ if (H5Pset_filter(dcpl, H5Z_FILTER_SET_LOCAL_TEST, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't set bogus2 filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set bogus2 filter\n", __LINE__);
goto error;
}
/* Create the data space */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n", __LINE__);
goto error;
} /* end if */
/* Create new dataset */
- if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ if ((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) <
+ 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n", __LINE__);
goto error;
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n", __LINE__);
goto error;
} /* end if */
/* Close dataset */
- if(H5Dclose(dsid) < 0) {
+ if (H5Dclose(dsid) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Create new dataset */
/* (Shouldn't get modified by output filter) */
- if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME_2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ if ((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME_2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n", __LINE__);
goto error;
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl_data) < 0) {
+ if (H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl_data) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n", __LINE__);
goto error;
} /* end if */
/* Close dataset */
- if(H5Dclose(dsid) < 0) {
+ if (H5Dclose(dsid) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Close dataspace */
- if(H5Sclose(sid) < 0) {
+ if (H5Sclose(sid) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't close dataspace\n", __LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
- if(H5Pclose(dcpl) < 0) {
+ if (H5Pclose(dcpl) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't close dcpl\n", __LINE__);
goto error;
} /* end if */
/* Close file (flushes & empties cache) */
- if(H5Fclose(file) < 0) {
+ if (H5Fclose(file) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't close file\n", __LINE__);
goto error;
} /* end if */
/* Open file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) {
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't open file\n", __LINE__);
goto error;
}
/* Re-open dataset */
- if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME, H5P_DEFAULT)) < 0) {
+ if ((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME, H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't open dataset\n", __LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
- if((dset_size = H5Dget_storage_size(dsid)) == 0) {
+ if ((dset_size = H5Dget_storage_size(dsid)) == 0) {
H5_FAILED();
HDprintf(" Line %d: Error querying dataset size\n", __LINE__);
goto error;
} /* end if */
/* Verify that the size indicates data is uncompressed */
- if((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) {
+ if ((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) {
H5_FAILED();
HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
+ if (H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
@@ -6250,49 +6609,49 @@ test_set_local(hid_t fapl)
/* Compare data */
/* Check that the values read are the modified version of what was written */
- for(i=0; i<dims[0]; i++) {
- for(j=0; j<dims[1]; j++) {
- if((points[i][j]+(int)sizeof(int)) != check[i][j]) {
- H5_FAILED();
- HDprintf(" Line %d: Read different values than written.\n",__LINE__);
- HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- HDprintf(" At original: %d\n",points[i][j]);
- HDprintf(" At returned: %d\n",check[i][j]);
- goto error;
- } /* end if */
- } /* end for */
- } /* end for */
+ for (i = 0; i < dims[0]; i++) {
+ for (j = 0; j < dims[1]; j++) {
+ if ((points[i][j] + (int)sizeof(int)) != check[i][j]) {
+ H5_FAILED();
+ HDprintf(" Line %d: Read different values than written.\n", __LINE__);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ HDprintf(" At original: %d\n", points[i][j]);
+ HDprintf(" At returned: %d\n", check[i][j]);
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Close dataset */
- if(H5Dclose(dsid) < 0) {
+ if (H5Dclose(dsid) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Re-open second dataset */
- if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME_2, H5P_DEFAULT)) < 0) {
+ if ((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME_2, H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf(" Line %d: Can't open dataset\n", __LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
- if((dset_size = H5Dget_storage_size(dsid)) == 0) {
+ if ((dset_size = H5Dget_storage_size(dsid)) == 0) {
H5_FAILED();
HDprintf(" Line %d: Error querying dataset size\n", __LINE__);
goto error;
} /* end if */
/* Verify that the size indicates data is uncompressed */
- if((H5Tget_size(H5T_NATIVE_DOUBLE) * dims[0] * dims[1]) != dset_size) {
+ if ((H5Tget_size(H5T_NATIVE_DOUBLE) * dims[0] * dims[1]) != dset_size) {
H5_FAILED();
HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl_data) < 0) {
+ if (H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
@@ -6300,36 +6659,35 @@ test_set_local(hid_t fapl)
/* Compare data */
/* Check that the values read are the modified version of what was written */
- for(i=0; i<dims[0]; i++) {
- for(j=0; j<dims[1]; j++) {
- /* If the difference between two values is greater than 0.001%, they're
+ for (i = 0; i < dims[0]; i++) {
+ for (j = 0; j < dims[1]; j++) {
+ /* If the difference between two values is greater than 0.001%, they're
* considered not equal. */
- if(!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], (double)0.00001F)) {
- H5_FAILED();
- HDprintf(" Line %d: Read different values than written.\n",__LINE__);
- HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- HDprintf(" At original: %f\n",points_dbl[i][j]);
- HDprintf(" At returned: %f\n",check_dbl[i][j]);
- goto error;
- } /* end if */
- } /* end for */
- } /* end for */
+ if (!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], (double)0.00001F)) {
+ H5_FAILED();
+ HDprintf(" Line %d: Read different values than written.\n", __LINE__);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ HDprintf(" At original: %f\n", points_dbl[i][j]);
+ HDprintf(" At returned: %f\n", check_dbl[i][j]);
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Close dataset */
- if(H5Dclose(dsid) < 0) {
+ if (H5Dclose(dsid) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Close file */
- if(H5Fclose(file) < 0) {
+ if (H5Fclose(file) < 0) {
H5_FAILED();
- HDprintf(" Line %d: Can't close file\n",__LINE__);
+ HDprintf(" Line %d: Can't close file\n", __LINE__);
goto error;
} /* end if */
-
PASSED();
return SUCCEED;
@@ -6337,7 +6695,6 @@ error:
return FAIL;
} /* end test_set_local() */
-
/*-------------------------------------------------------------------------
* Function: test_compare_dcpl
*
@@ -6356,73 +6713,90 @@ error:
static herr_t
test_compare_dcpl(hid_t file)
{
- hid_t dsid=(-1); /* Dataset ID */
- hid_t sid=(-1); /* Dataspace ID */
- hid_t dcpl=(-1); /* Dataspace creation property list ID */
- hid_t dcpl1=(-1),dcpl2=(-1); /* Dataspace creation property list IDs from datasets */
- const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
- const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
+ hid_t dsid = (-1); /* Dataset ID */
+ hid_t sid = (-1); /* Dataspace ID */
+ hid_t dcpl = (-1); /* Dataspace creation property list ID */
+ hid_t dcpl1 = (-1), dcpl2 = (-1); /* Dataspace creation property list IDs from datasets */
+ const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
TESTING("comparing dataset creation property lists");
/* Create the data space */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
/* Create dcpl with special filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR
- /* Set gzip parameter (if available) */
+ /* Set gzip parameter (if available) */
#ifdef H5_HAVE_FILTER_DEFLATE
- if(H5Pset_deflate (dcpl, 9) < 0) TEST_ERROR
+ if (H5Pset_deflate(dcpl, 9) < 0)
+ TEST_ERROR
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Create first dataset */
- if((dsid = H5Dcreate2(file, DSET_COMPARE_DCPL_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dsid = H5Dcreate2(file, DSET_COMPARE_DCPL_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Get copy of dataset's dataset creation property list */
- if((dcpl1=H5Dget_create_plist(dsid)) < 0) TEST_ERROR
+ if ((dcpl1 = H5Dget_create_plist(dsid)) < 0)
+ TEST_ERROR
/* Close dataset */
- if(H5Dclose (dsid) < 0) TEST_ERROR
+ if (H5Dclose(dsid) < 0)
+ TEST_ERROR
/* Create second dataset */
- if((dsid = H5Dcreate2(file, DSET_COMPARE_DCPL_NAME_2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dsid = H5Dcreate2(file, DSET_COMPARE_DCPL_NAME_2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Get copy of dataset's dataset creation property list */
- if((dcpl2=H5Dget_create_plist(dsid)) < 0) TEST_ERROR
+ if ((dcpl2 = H5Dget_create_plist(dsid)) < 0)
+ TEST_ERROR
/* Close dataset */
- if(H5Dclose (dsid) < 0) TEST_ERROR
+ if (H5Dclose(dsid) < 0)
+ TEST_ERROR
/* Close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* Compare dataset creation property lists */
- if(H5Pequal(dcpl1,dcpl2)<=0) TEST_ERROR
+ if (H5Pequal(dcpl1, dcpl2) <= 0)
+ TEST_ERROR
/* Close dataset creation property lists */
- if(H5Pclose(dcpl) < 0) TEST_ERROR
- if(H5Pclose(dcpl1) < 0) TEST_ERROR
- if(H5Pclose(dcpl2) < 0) TEST_ERROR
-
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl1) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl2) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dsid);
H5Sclose(sid);
H5Pclose(dcpl);
H5Pclose(dcpl1);
H5Pclose(dcpl2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_compare_dcpl() */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dcpl
*
@@ -6442,104 +6816,135 @@ error:
static herr_t
test_copy_dcpl(hid_t file, hid_t fapl)
{
- hid_t dsid1=(-1), dsid2=(-1); /* Dataset ID */
- hid_t new_dsid1=(-1), new_dsid2=(-1); /* Dataset ID */
- hid_t sid=(-1); /* Dataspace ID */
- hid_t dcpl=(-1); /* Dataset creation property list ID */
- hid_t dcpl1=(-1),dcpl2=(-1); /* Copies of creation property list IDs */
- hid_t dcpl1_copy=(-1),dcpl2_copy=(-1);/* Copies of creation property list IDs */
- const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
- const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
- char filename[FILENAME_BUF_SIZE];
- hid_t new_file=(-1);
+ hid_t dsid1 = (-1), dsid2 = (-1); /* Dataset ID */
+ hid_t new_dsid1 = (-1), new_dsid2 = (-1); /* Dataset ID */
+ hid_t sid = (-1); /* Dataspace ID */
+ hid_t dcpl = (-1); /* Dataset creation property list ID */
+ hid_t dcpl1 = (-1), dcpl2 = (-1); /* Copies of creation property list IDs */
+ hid_t dcpl1_copy = (-1), dcpl2_copy = (-1); /* Copies of creation property list IDs */
+ const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t new_file = (-1);
TESTING("copying dataset creation property lists");
/* Create the data space */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
/* Create dcpl with special filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR
- if(H5Pset_fletcher32(dcpl) < 0) TEST_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR
+ if (H5Pset_fletcher32(dcpl) < 0)
+ TEST_ERROR
/* Create first dataset of chunking with filter */
- if((dsid1 = H5Dcreate2(file, DSET_COPY_DCPL_NAME_1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
- H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dsid1 = H5Dcreate2(file, DSET_COPY_DCPL_NAME_1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close dataset */
- if(H5Dclose (dsid1) < 0) TEST_ERROR
+ if (H5Dclose(dsid1) < 0)
+ TEST_ERROR
/* Reopen the first dataset */
- if((dsid1 = H5Dopen2(file, DSET_COPY_DCPL_NAME_1, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dsid1 = H5Dopen2(file, DSET_COPY_DCPL_NAME_1, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Get the copy of dataset's creation property list */
- if((dcpl1=H5Dget_create_plist(dsid1)) < 0) TEST_ERROR
- if((dcpl1_copy = H5Pcopy(dcpl1)) < 0) TEST_ERROR
+ if ((dcpl1 = H5Dget_create_plist(dsid1)) < 0)
+ TEST_ERROR
+ if ((dcpl1_copy = H5Pcopy(dcpl1)) < 0)
+ TEST_ERROR
/* Close dataset */
- if(H5Dclose (dsid1) < 0) TEST_ERROR
+ if (H5Dclose(dsid1) < 0)
+ TEST_ERROR
/* Change the DCPL for contiguous layout with external storage. The size of the reserved
* space in the external file is the size of the dataset - 500*4096*sizeof(int).
* There's no need to clean up the external file since the library doesn't create it
* until the data is written to it. */
- if(H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0) TEST_ERROR
- if(H5Premove_filter(dcpl, H5Z_FILTER_FLETCHER32) < 0) TEST_ERROR
- if(H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, (off_t)0, (hsize_t)(500 * 4096 * sizeof(int))) < 0) TEST_ERROR
+ if (H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0)
+ TEST_ERROR
+ if (H5Premove_filter(dcpl, H5Z_FILTER_FLETCHER32) < 0)
+ TEST_ERROR
+ if (H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, (off_t)0, (hsize_t)(500 * 4096 * sizeof(int))) < 0)
+ TEST_ERROR
/* Create second dataset of contiguous layout with external storage */
- if((dsid2 = H5Dcreate2(file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
- H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dsid2 = H5Dcreate2(file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close dataset */
- if(H5Dclose (dsid2) < 0) TEST_ERROR
+ if (H5Dclose(dsid2) < 0)
+ TEST_ERROR
/* Reopen the second dataset */
- if((dsid2 = H5Dopen2(file, DSET_COPY_DCPL_NAME_2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dsid2 = H5Dopen2(file, DSET_COPY_DCPL_NAME_2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Get copy of dataset's dataset creation property list */
- if((dcpl2=H5Dget_create_plist(dsid2)) < 0) TEST_ERROR
- if((dcpl2_copy = H5Pcopy(dcpl2)) < 0) TEST_ERROR
+ if ((dcpl2 = H5Dget_create_plist(dsid2)) < 0)
+ TEST_ERROR
+ if ((dcpl2_copy = H5Pcopy(dcpl2)) < 0)
+ TEST_ERROR
/* Close dataset */
- if(H5Dclose (dsid2) < 0) TEST_ERROR
+ if (H5Dclose(dsid2) < 0)
+ TEST_ERROR
/* Create a second file and create 2 datasets with the copies of the DCPLs in the first
* file. Test whether the copies of DCPLs work. */
h5_fixname(FILENAME[13], fapl, filename, sizeof filename);
- if((new_file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((new_file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((new_dsid1 = H5Dcreate2(new_file, DSET_COPY_DCPL_NAME_1, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, dcpl1_copy, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((new_dsid1 = H5Dcreate2(new_file, DSET_COPY_DCPL_NAME_1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl1_copy,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if((new_dsid2 = H5Dcreate2(new_file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, dcpl2_copy, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((new_dsid2 = H5Dcreate2(new_file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl2_copy,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* Close datasets */
- if(H5Dclose (new_dsid1) < 0) TEST_ERROR
- if(H5Dclose (new_dsid2) < 0) TEST_ERROR
+ if (H5Dclose(new_dsid1) < 0)
+ TEST_ERROR
+ if (H5Dclose(new_dsid2) < 0)
+ TEST_ERROR
/* Close the second file */
- if(H5Fclose (new_file) < 0) TEST_ERROR
+ if (H5Fclose(new_file) < 0)
+ TEST_ERROR
/* Close dataset creation property lists */
- if(H5Pclose(dcpl) < 0) TEST_ERROR
- if(H5Pclose(dcpl1) < 0) TEST_ERROR
- if(H5Pclose(dcpl2) < 0) TEST_ERROR
- if(H5Pclose(dcpl1_copy) < 0) TEST_ERROR
- if(H5Pclose(dcpl2_copy) < 0) TEST_ERROR
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl1) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl2) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl1_copy) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl2_copy) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dsid1);
H5Dclose(dsid2);
H5Dclose(new_dsid1);
@@ -6550,11 +6955,11 @@ error:
H5Pclose(dcpl2);
H5Pclose(dcpl1_copy);
H5Pclose(dcpl2_copy);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_copy_dcpl() */
-
/*-------------------------------------------------------------------------
* Function: test_filter_delete
*
@@ -6571,98 +6976,116 @@ error:
static herr_t
test_filter_delete(hid_t file)
{
- H5Z_filter_t filtn; /* filter identification number */
- hid_t dsid=-1; /* dataset ID */
- hid_t sid=-1; /* dataspace ID */
- hid_t dcpl=-1; /* dataset creation property list ID */
- hid_t dcpl1=-1; /* dataset creation property list ID */
- hsize_t dims[2]={20,20}; /* dataspace dimensions */
- hsize_t chunk_dims[2]={10,10}; /* chunk dimensions */
- int nfilters; /* number of filters in DCPL */
- unsigned flags; /* flags for filter */
- herr_t ret; /* generic return value */
+ H5Z_filter_t filtn; /* filter identification number */
+ hid_t dsid = -1; /* dataset ID */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t dcpl = -1; /* dataset creation property list ID */
+ hid_t dcpl1 = -1; /* dataset creation property list ID */
+ hsize_t dims[2] = {20, 20}; /* dataspace dimensions */
+ hsize_t chunk_dims[2] = {10, 10}; /* chunk dimensions */
+ int nfilters; /* number of filters in DCPL */
+ unsigned flags; /* flags for filter */
+ herr_t ret; /* generic return value */
int i;
TESTING("filter deletion");
#ifdef H5_HAVE_FILTER_DEFLATE
/* create the data space */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) goto error;
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
/* create dcpl */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ goto error;
- if(H5Pset_fletcher32 (dcpl) < 0) goto error;
- if(H5Pset_deflate (dcpl, 6) < 0) goto error;
- if(H5Pset_shuffle (dcpl) < 0) goto error;
+ if (H5Pset_fletcher32(dcpl) < 0)
+ goto error;
+ if (H5Pset_deflate(dcpl, 6) < 0)
+ goto error;
+ if (H5Pset_shuffle(dcpl) < 0)
+ goto error;
/* create a dataset */
- if((dsid = H5Dcreate2(file,"dsetdel", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
+ if ((dsid = H5Dcreate2(file, "dsetdel", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
/* get copy of dataset's dataset creation property list */
- if((dcpl1=H5Dget_create_plist(dsid)) < 0) goto error;
+ if ((dcpl1 = H5Dget_create_plist(dsid)) < 0)
+ goto error;
- /*----------------------------------------------------------------------
- * delete the deflate filter
- *----------------------------------------------------------------------
- */
+ /*----------------------------------------------------------------------
+ * delete the deflate filter
+ *----------------------------------------------------------------------
+ */
/* delete the deflate filter */
- if(H5Premove_filter(dcpl1,H5Z_FILTER_DEFLATE) < 0) goto error;
+ if (H5Premove_filter(dcpl1, H5Z_FILTER_DEFLATE) < 0)
+ goto error;
/* get information about filters */
- if((nfilters = H5Pget_nfilters(dcpl1)) < 0) goto error;
+ if ((nfilters = H5Pget_nfilters(dcpl1)) < 0)
+ goto error;
/* check if filter was deleted */
- for(i=0; i<nfilters; i++) {
+ for (i = 0; i < nfilters; i++) {
filtn = H5Pget_filter2(dcpl1, (unsigned)i, NULL, NULL, NULL, (size_t)0, NULL, NULL);
- if(H5Z_FILTER_DEFLATE==filtn)
+ if (H5Z_FILTER_DEFLATE == filtn)
goto error;
}
/* try to get the info for the deflate filter */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Pget_filter_by_id2(dcpl1, H5Z_FILTER_DEFLATE, &flags, NULL, NULL, (size_t)0, NULL, NULL);
- } H5E_END_TRY;
- if(ret >=0) {
+ }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
- HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't have deleted filter!\n", __LINE__);
goto error;
} /* end if */
/* try to delete the deflate filter again */
- H5E_BEGIN_TRY {
- ret=H5Premove_filter(dcpl1,H5Z_FILTER_DEFLATE);
- } H5E_END_TRY;
- if(ret >=0) {
+ H5E_BEGIN_TRY { ret = H5Premove_filter(dcpl1, H5Z_FILTER_DEFLATE); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
- HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't have deleted filter!\n", __LINE__);
goto error;
} /* end if */
- /*----------------------------------------------------------------------
- * delete all filters
- *----------------------------------------------------------------------
- */
+ /*----------------------------------------------------------------------
+ * delete all filters
+ *----------------------------------------------------------------------
+ */
/* delete all filters */
- if(H5Premove_filter(dcpl1,H5Z_FILTER_ALL) < 0) goto error;
+ if (H5Premove_filter(dcpl1, H5Z_FILTER_ALL) < 0)
+ goto error;
/* get information about filters */
- if((nfilters = H5Pget_nfilters(dcpl1)) < 0) goto error;
+ if ((nfilters = H5Pget_nfilters(dcpl1)) < 0)
+ goto error;
/* check if filters were deleted */
- if(nfilters)goto error;
+ if (nfilters)
+ goto error;
- /*----------------------------------------------------------------------
- * close
- *----------------------------------------------------------------------
- */
+ /*----------------------------------------------------------------------
+ * close
+ *----------------------------------------------------------------------
+ */
/* clean up objects used for this test */
- if(H5Pclose (dcpl) < 0) goto error;
- if(H5Pclose (dcpl1) < 0) goto error;
- if(H5Dclose (dsid) < 0) goto error;
- if(H5Sclose (sid) < 0) goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Pclose(dcpl1) < 0)
+ goto error;
+ if (H5Dclose(dsid) < 0)
+ goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
PASSED();
#else
@@ -6671,17 +7094,17 @@ test_filter_delete(hid_t file)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(dcpl1);
H5Dclose(dsid);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_filter_delete() */
-
-
/*-------------------------------------------------------------------------
* Function: auxread_fdata
*
@@ -6698,74 +7121,75 @@ error:
static herr_t
auxread_fdata(hid_t fid, const char *name)
{
- hid_t dset_id=-1; /* dataset ID */
- hid_t dcpl_id=-1; /* dataset creation property list ID */
- hid_t space_id=-1; /* space ID */
- hid_t ftype_id=-1; /* file data type ID */
- hid_t mtype_id=-1; /* memory data type ID */
- size_t msize; /* memory size of memory type */
- void *buf=NULL; /* data buffer */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- int i;
+ hid_t dset_id = -1; /* dataset ID */
+ hid_t dcpl_id = -1; /* dataset creation property list ID */
+ hid_t space_id = -1; /* space ID */
+ hid_t ftype_id = -1; /* file data type ID */
+ hid_t mtype_id = -1; /* memory data type ID */
+ size_t msize; /* memory size of memory type */
+ void * buf = NULL; /* data buffer */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
+ int i;
- if((dset_id = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
goto error;
- if((space_id = H5Dget_space(dset_id)) < 0)
+ if ((space_id = H5Dget_space(dset_id)) < 0)
goto error;
- if((ftype_id = H5Dget_type(dset_id)) < 0)
+ if ((ftype_id = H5Dget_type(dset_id)) < 0)
goto error;
- if((dcpl_id = H5Dget_create_plist(dset_id)) < 0)
+ if ((dcpl_id = H5Dget_create_plist(dset_id)) < 0)
goto error;
- if((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
goto error;
HDmemset(dims, 0, sizeof dims);
- if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
goto error;
nelmts = 1;
- for(i = 0; i < rank; i++)
+ for (i = 0; i < rank; i++)
nelmts *= dims[i];
- if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
+ if ((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
goto error;
- if((msize = H5Tget_size(mtype_id)) == 0)
+ if ((msize = H5Tget_size(mtype_id)) == 0)
goto error;
- if(nelmts) {
+ if (nelmts) {
buf = (void *)HDmalloc((size_t)(nelmts * msize));
- if(buf == NULL) {
- HDprintf( "cannot read into memory\n" );
+ if (buf == NULL) {
+ HDprintf("cannot read into memory\n");
goto error;
}
- if(H5Dread(dset_id, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(dset_id, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
}
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
goto error;
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
goto error;
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
goto error;
- if(buf)
+ if (buf)
HDfree(buf);
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl_id);
H5Sclose(space_id);
H5Dclose(dset_id);
H5Tclose(ftype_id);
H5Tclose(mtype_id);
- if(buf)
+ if (buf)
HDfree(buf);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end auxread_fdata() */
-
/*-------------------------------------------------------------------------
* Function: test_filters_endianess
*
@@ -6782,60 +7206,67 @@ error:
static herr_t
test_filters_endianess(void)
{
- hid_t fid=-1; /* file ID */
- hid_t dsid=-1; /* dataset ID */
- hid_t sid=-1; /* dataspace ID */
- hid_t dcpl=-1; /* dataset creation property list ID */
+ hid_t fid = -1; /* file ID */
+ hid_t dsid = -1; /* dataset ID */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t dcpl = -1; /* dataset creation property list ID */
const char *data_file = H5_get_srcdir_filename("test_filters_le.h5"); /* Corrected test file name */
TESTING("filters with big-endian/little-endian data");
- /*-------------------------------------------------------------------------
- * step 1: open a file written on a little-endian machine
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * step 1: open a file written on a little-endian machine
+ *-------------------------------------------------------------------------
+ */
/* open */
- if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* read */
- if(auxread_fdata(fid,"dset") < 0) TEST_ERROR
+ if (auxread_fdata(fid, "dset") < 0)
+ TEST_ERROR
/* close */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
- /*-------------------------------------------------------------------------
- * step 2: open a file written on a big-endian machine
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * step 2: open a file written on a big-endian machine
+ *-------------------------------------------------------------------------
+ */
/* compose the name of the file to open, using the srcdir, if appropriate */
data_file = H5_get_srcdir_filename("test_filters_be.h5"); /* Corrected test file name */
/* open */
- if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* read */
- if(auxread_fdata(fid,"dset") < 0) TEST_ERROR
+ if (auxread_fdata(fid, "dset") < 0)
+ TEST_ERROR
/* close */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_filters_endianess() */
-
/*-------------------------------------------------------------------------
* Function: test_zero_dims
*
@@ -6852,140 +7283,179 @@ error:
static herr_t
test_zero_dims(hid_t file)
{
- hid_t s = -1, d = -1, dcpl = -1;
- hid_t s2 = -1, d2 = -1, dcpl2 = -1;
- hsize_t dzero = 0, dmax = H5S_UNLIMITED, csize = 5;
- hsize_t dzero2[2] = {0, 0};
- hsize_t dmax2[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t csize2[2] = {5, 5};
- hid_t fapl; /* File access property list */
+ hid_t s = -1, d = -1, dcpl = -1;
+ hid_t s2 = -1, d2 = -1, dcpl2 = -1;
+ hsize_t dzero = 0, dmax = H5S_UNLIMITED, csize = 5;
+ hsize_t dzero2[2] = {0, 0};
+ hsize_t dmax2[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t csize2[2] = {5, 5};
+ hid_t fapl; /* File access property list */
H5D_chunk_index_t idx_type; /* Dataset chunk index type */
- H5F_libver_t low; /* File format low bound */
- herr_t ret;
+ H5F_libver_t low; /* File format low bound */
+ herr_t ret;
TESTING("I/O on datasets with zero-sized dims");
/* Get the file's file access property list */
- if((fapl = H5Fget_access_plist(file)) < 0) FAIL_STACK_ERROR
+ if ((fapl = H5Fget_access_plist(file)) < 0)
+ FAIL_STACK_ERROR
/* Get library format */
- if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Pget_libver_bounds(fapl, &low, NULL) < 0)
+ FAIL_STACK_ERROR
/* Close FAPL */
- if(H5Pclose(fapl) < 0) TEST_ERROR
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR
/*
* One-dimensional dataset
*/
- if((s = H5Screate_simple(1, &dzero, &dmax)) < 0) FAIL_STACK_ERROR
+ if ((s = H5Screate_simple(1, &dzero, &dmax)) < 0)
+ FAIL_STACK_ERROR
/* Try creating chunked dataset with undefined chunk dimensions */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
- if(H5Pset_layout(dcpl, H5D_CHUNKED) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_layout(dcpl, H5D_CHUNKED) < 0)
+ FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(d > 0) {
+ }
+ H5E_END_TRY;
+ if (d > 0) {
H5Dclose(d);
FAIL_PUTS_ERROR("created dataset with undefined chunk dimensions")
} /* end if */
/* Try creating chunked dataset with zero-sized chunk dimensions */
- H5E_BEGIN_TRY {
- ret = H5Pset_chunk(dcpl, 1, &dzero);
- } H5E_END_TRY;
- if(ret > 0)
+ H5E_BEGIN_TRY { ret = H5Pset_chunk(dcpl, 1, &dzero); }
+ H5E_END_TRY;
+ if (ret > 0)
FAIL_PUTS_ERROR("set zero-sized chunk dimensions")
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
/* Create the zero-sized extendible dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, &csize) < 0) FAIL_STACK_ERROR
- if((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 1, &csize) < 0)
+ FAIL_STACK_ERROR
+ if ((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(d, &idx_type) < 0) FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(d, &idx_type) < 0)
+ FAIL_STACK_ERROR
/* Verify index type */
- if(low == H5F_LIBVER_LATEST) {
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
- FAIL_PUTS_ERROR("should be using extensible array as index");
- } else if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (low == H5F_LIBVER_LATEST) {
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("should be using extensible array as index");
+ }
+ else if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
/* Various no-op writes */
- if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
- if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR
- if(H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
- if(H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void *)911) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)911) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0)
+ FAIL_STACK_ERROR
/* Various no-op reads */
- if(H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
- if(H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR
- if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
- if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void *)911) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)911) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0)
+ FAIL_STACK_ERROR
- if(H5Dclose(d) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(s) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(d) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(s) < 0)
+ FAIL_STACK_ERROR
/*
* Two-dimensional dataset
*/
- if((s2 = H5Screate_simple(2, dzero2, dmax2)) < 0) FAIL_STACK_ERROR
+ if ((s2 = H5Screate_simple(2, dzero2, dmax2)) < 0)
+ FAIL_STACK_ERROR
/* Try creating chunked dataset with undefined chunk dimensions */
- if((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
- if(H5Pset_layout(dcpl2, H5D_CHUNKED) < 0) FAIL_STACK_ERROR
+ if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_layout(dcpl2, H5D_CHUNKED) < 0)
+ FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
d2 = H5Dcreate2(file, ZERODIM_DATASET2, H5T_NATIVE_INT, s2, H5P_DEFAULT, dcpl2, H5P_DEFAULT);
- } H5E_END_TRY;
- if(d2 > 0) {
+ }
+ H5E_END_TRY;
+ if (d2 > 0) {
H5Dclose(d2);
FAIL_PUTS_ERROR("created dataset with undefined chunk dimensions")
} /* end if */
/* Try creating chunked dataset with zero-sized chunk dimensions */
- H5E_BEGIN_TRY {
- ret = H5Pset_chunk(dcpl2, 2, dzero2);
- } H5E_END_TRY;
- if(ret > 0)
+ H5E_BEGIN_TRY { ret = H5Pset_chunk(dcpl2, 2, dzero2); }
+ H5E_END_TRY;
+ if (ret > 0)
FAIL_PUTS_ERROR("set zero-sized chunk dimensions")
- if(H5Pclose(dcpl2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl2) < 0)
+ FAIL_STACK_ERROR
/* Write to the zero-sized extendible dataset */
- if((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl2, 2, csize2) < 0) FAIL_STACK_ERROR
+ if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl2, 2, csize2) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((d2 = H5Dcreate2(file, ZERODIM_DATASET2, H5T_NATIVE_INT, s2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((d2 = H5Dcreate2(file, ZERODIM_DATASET2, H5T_NATIVE_INT, s2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(d2, &idx_type) < 0) FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(d2, &idx_type) < 0)
+ FAIL_STACK_ERROR
/* Verify index type */
- if(low == H5F_LIBVER_LATEST) {
- if(idx_type != H5D_CHUNK_IDX_BT2)
- FAIL_PUTS_ERROR("should be using v2 B-tree as index");
- } else if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (low == H5F_LIBVER_LATEST) {
+ if (idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("should be using v2 B-tree as index");
+ }
+ else if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
/* Just a no-op */
- if(H5Dwrite(d2, H5T_NATIVE_INT, s2, s2, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(d2, H5T_NATIVE_INT, s2, s2, H5P_DEFAULT, (void *)911) < 0)
+ FAIL_STACK_ERROR
- if(H5Dclose(d2) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl2) < 0) FAIL_STACK_ERROR
- if(H5Sclose(s2) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(d2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(s2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(dcpl);
@@ -6995,11 +7465,11 @@ error:
H5Pclose(dcpl2);
H5Dclose(d2);
H5Sclose(s2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_zero_dims() */
-
/*-------------------------------------------------------------------------
* Function: test_missing_chunk
*
@@ -7018,183 +7488,212 @@ error:
static herr_t
test_missing_chunk(hid_t file)
{
- hid_t d = -1, did2 = -1; /* Dataset IDs */
- hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property IDs */
- hid_t s = -1, sid2 = -1; /* Dataspace ID */
- hsize_t hs_start[1], hs_stride[1], hs_count[1], hs_block[1]; /* Hyperslab setting */
- hsize_t hs_start2[2], hs_stride2[2], hs_count2[2], hs_block2[2];/* Hyperslab setting */
+ hid_t d = -1, did2 = -1; /* Dataset IDs */
+ hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property IDs */
+ hid_t s = -1, sid2 = -1; /* Dataspace ID */
+ hsize_t hs_start[1], hs_stride[1], hs_count[1], hs_block[1]; /* Hyperslab setting */
+ hsize_t hs_start2[2], hs_stride2[2], hs_count2[2], hs_block2[2]; /* Hyperslab setting */
/* Buffers for reading/writing dataset */
- int *wdata = NULL;
- int *rdata = NULL;
- int **wdata2 = NULL;
- int **rdata2 = NULL;
- int *wdata2_bytes = NULL;
- int *rdata2_bytes = NULL;
+ int * wdata = NULL;
+ int * rdata = NULL;
+ int **wdata2 = NULL;
+ int **rdata2 = NULL;
+ int * wdata2_bytes = NULL;
+ int * rdata2_bytes = NULL;
/* Setting for 1-D dataset */
- hsize_t dsize=100, dmax=H5S_UNLIMITED;
- hsize_t csize=5;
+ hsize_t dsize = 100, dmax = H5S_UNLIMITED;
+ hsize_t csize = 5;
/* Setting for 2-D dataset */
- hsize_t dsize2[2] = {100, 100}, dmax2[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t csize2[2] = {5, 5};
- size_t u, i, j; /* Local Index variable */
+ hsize_t dsize2[2] = {100, 100}, dmax2[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t csize2[2] = {5, 5};
+ size_t u, i, j; /* Local Index variable */
- hid_t fapl; /* File access property list */
- H5F_libver_t low; /* File format low bound */
- H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index types */
+ hid_t fapl; /* File access property list */
+ H5F_libver_t low; /* File format low bound */
+ H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index types */
TESTING("Read dataset with unwritten chunk & undefined fill value");
/* Set up data arrays */
- if(NULL == (wdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int))))
+ if (NULL == (wdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int))))
TEST_ERROR;
- if(NULL == (rdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int))))
+ if (NULL == (rdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int))))
TEST_ERROR;
- if(NULL == (wdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int))))
+ if (NULL == (wdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int))))
TEST_ERROR;
- if(NULL == (wdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(wdata2_bytes))))
+ if (NULL == (wdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(wdata2_bytes))))
TEST_ERROR;
for (i = 0; i < MISSING_CHUNK_DIM; i++)
wdata2[i] = wdata2_bytes + (i * MISSING_CHUNK_DIM);
- if(NULL == (rdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int))))
+ if (NULL == (rdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int))))
TEST_ERROR;
- if(NULL == (rdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(rdata2_bytes))))
+ if (NULL == (rdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(rdata2_bytes))))
TEST_ERROR;
for (i = 0; i < MISSING_CHUNK_DIM; i++)
rdata2[i] = rdata2_bytes + (i * MISSING_CHUNK_DIM);
/* Get the file's file access property list */
- if((fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR;
+ if ((fapl = H5Fget_access_plist(file)) < 0)
+ TEST_ERROR;
/* Get library format */
- if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) TEST_ERROR;
+ if (H5Pget_libver_bounds(fapl, &low, NULL) < 0)
+ TEST_ERROR;
/* Close FAPL */
- if(H5Pclose(fapl) < 0) TEST_ERROR
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR
/* Initialize data for 1-D dataset */
- for(u = 0; u < MISSING_CHUNK_DIM; u++) {
+ for (u = 0; u < MISSING_CHUNK_DIM; u++) {
wdata[u] = (int)u;
rdata[u] = 911;
} /* end for */
/* Initialize data for 2-D dataset */
- for(i = 0; i < MISSING_CHUNK_DIM; i++) {
- for(j = 0; j < MISSING_CHUNK_DIM; j++) {
+ for (i = 0; i < MISSING_CHUNK_DIM; i++) {
+ for (j = 0; j < MISSING_CHUNK_DIM; j++) {
wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
rdata2[i][j] = 911;
}
} /* end for */
/* Create dataspace */
- if((s = H5Screate_simple(1, &dsize, &dmax)) < 0) TEST_ERROR;
- if((sid2 = H5Screate_simple(2, dsize2, dmax2)) < 0) TEST_ERROR;
+ if ((s = H5Screate_simple(1, &dsize, &dmax)) < 0)
+ TEST_ERROR;
+ if ((sid2 = H5Screate_simple(2, dsize2, dmax2)) < 0)
+ TEST_ERROR;
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
+ if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set to chunked */
- if(H5Pset_chunk(dcpl, 1, &csize) < 0) TEST_ERROR;
- if(H5Pset_chunk(dcpl2, 2, csize2) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 1, &csize) < 0)
+ TEST_ERROR;
+ if (H5Pset_chunk(dcpl2, 2, csize2) < 0)
+ TEST_ERROR;
/* Undefine fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, NULL) < 0) TEST_ERROR;
- if(H5Pset_fill_value(dcpl2, H5T_NATIVE_INT, NULL) < 0) TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, NULL) < 0)
+ TEST_ERROR;
+ if (H5Pset_fill_value(dcpl2, H5T_NATIVE_INT, NULL) < 0)
+ TEST_ERROR;
/* Create the 1-D & 2-D datasets */
- if((d = H5Dcreate2(file, MISSING_CHUNK_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR;
- if((did2 = H5Dcreate2(file, MISSING_CHUNK_DATASET2, H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((d = H5Dcreate2(file, MISSING_CHUNK_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if ((did2 = H5Dcreate2(file, MISSING_CHUNK_DATASET2, H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl2,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get the chunk index types */
- if(H5D__layout_idx_type_test(d, &idx_type) < 0) TEST_ERROR;
- if(H5D__layout_idx_type_test(did2, &idx_type2) < 0) TEST_ERROR;
+ if (H5D__layout_idx_type_test(d, &idx_type) < 0)
+ TEST_ERROR;
+ if (H5D__layout_idx_type_test(did2, &idx_type2) < 0)
+ TEST_ERROR;
/* Verify index type */
- if(low == H5F_LIBVER_LATEST) {
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ if (low == H5F_LIBVER_LATEST) {
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
FAIL_PUTS_ERROR("should be using Extensible Array as index");
- if(idx_type2 != H5D_CHUNK_IDX_BT2)
+ if (idx_type2 != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("should be using v2 B-tree as index");
- } else {
- if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
- if(idx_type2 != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ }
+ else {
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (idx_type2 != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
}
/* Select elements in every other chunk for 1-D dataset */
- hs_start[0]=0;
- hs_stride[0]=10;
- hs_count[0]=10;
- hs_block[0]=5;
- if(H5Sselect_hyperslab(s, H5S_SELECT_SET, hs_start, hs_stride, hs_count,
- hs_block) < 0) TEST_ERROR;
+ hs_start[0] = 0;
+ hs_stride[0] = 10;
+ hs_count[0] = 10;
+ hs_block[0] = 5;
+ if (H5Sselect_hyperslab(s, H5S_SELECT_SET, hs_start, hs_stride, hs_count, hs_block) < 0)
+ TEST_ERROR;
/* Select elements in every other chunk for 2-D dataset */
hs_start2[0] = hs_start2[1] = 0;
hs_stride2[0] = hs_stride2[1] = 10;
hs_count2[0] = hs_count2[1] = 10;
hs_block2[0] = hs_block2[1] = 5;
- if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_start2, hs_stride2, hs_count2,
- hs_block2) < 0) TEST_ERROR;
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_start2, hs_stride2, hs_count2, hs_block2) < 0)
+ TEST_ERROR;
/* Write selected data to the datasets */
- if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
- if(H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2_bytes) < 0) TEST_ERROR;
+ if (H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, wdata) < 0)
+ TEST_ERROR;
+ if (H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2_bytes) < 0)
+ TEST_ERROR;
/* Read all data from the datasets */
- if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR;
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2_bytes) < 0) TEST_ERROR;
+ if (H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
+ TEST_ERROR;
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2_bytes) < 0)
+ TEST_ERROR;
/* Validata values read for the 1-D dataset */
- for(u=0; u<MISSING_CHUNK_DIM; u++) {
- if((u%10)>=5) {
- if(rdata[u]!=911) {
- HDprintf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]);
+ for (u = 0; u < MISSING_CHUNK_DIM; u++) {
+ if ((u % 10) >= 5) {
+ if (rdata[u] != 911) {
+ HDprintf(" Line %d: Incorrect value, rdata[%u]=%d\n", __LINE__, (unsigned)u, rdata[u]);
TEST_ERROR;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(rdata[u]!=wdata[u]) {
- HDprintf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]);
+ if (rdata[u] != wdata[u]) {
+ HDprintf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n", __LINE__, (unsigned)u,
+ wdata[u], (unsigned)u, rdata[u]);
TEST_ERROR;
} /* end if */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end for */
/* Validata values read for the 2-D dataset */
- for(i = 0; i < MISSING_CHUNK_DIM; i++) {
- for(j = 0; j < MISSING_CHUNK_DIM; j++) {
-
- if((i % 10) >= 5 || (j % 10) >= 5) {
- if(rdata2[i][j] != 911) {
- HDprintf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n",
- __LINE__,(unsigned)i, (unsigned)j, rdata2[i][j]);
- TEST_ERROR;
- } /* end if */
- } /* end if */
- else {
- if(rdata2[i][j] != wdata2[i][j]) {
- HDprintf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n",
- __LINE__,(unsigned)i, (unsigned)j, wdata2[i][j],(unsigned)i, (unsigned)j, rdata2[i][j]);
- TEST_ERROR;
- } /* end if */
- } /* end else */
- } /* end for */
- } /* end for */
+ for (i = 0; i < MISSING_CHUNK_DIM; i++) {
+ for (j = 0; j < MISSING_CHUNK_DIM; j++) {
+
+ if ((i % 10) >= 5 || (j % 10) >= 5) {
+ if (rdata2[i][j] != 911) {
+ HDprintf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", __LINE__, (unsigned)i,
+ (unsigned)j, rdata2[i][j]);
+ TEST_ERROR;
+ } /* end if */
+ } /* end if */
+ else {
+ if (rdata2[i][j] != wdata2[i][j]) {
+ HDprintf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n",
+ __LINE__, (unsigned)i, (unsigned)j, wdata2[i][j], (unsigned)i, (unsigned)j,
+ rdata2[i][j]);
+ TEST_ERROR;
+ } /* end if */
+ } /* end else */
+ } /* end for */
+ } /* end for */
/* Close everything */
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Pclose(dcpl2) < 0) TEST_ERROR;
- if(H5Sclose(s) < 0) TEST_ERROR;
- if(H5Sclose(sid2) < 0) TEST_ERROR;
- if(H5Dclose(d) < 0) TEST_ERROR;
- if(H5Dclose(did2) < 0) TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl2) < 0)
+ TEST_ERROR;
+ if (H5Sclose(s) < 0)
+ TEST_ERROR;
+ if (H5Sclose(sid2) < 0)
+ TEST_ERROR;
+ if (H5Dclose(d) < 0)
+ TEST_ERROR;
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR;
HDfree(rdata);
HDfree(wdata);
@@ -7207,7 +7706,8 @@ test_missing_chunk(hid_t file)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(dcpl);
@@ -7216,7 +7716,8 @@ error:
H5Dclose(did2);
H5Sclose(s);
H5Sclose(sid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(rdata);
HDfree(wdata);
@@ -7245,10 +7746,11 @@ gcd(long l0, long r0)
do {
if (l < r) {
- r = r % l;
+ r = r % l;
remainder = r;
- } else /* r <= l */ {
- l = l % r;
+ }
+ else /* r <= l */ {
+ l = l % r;
remainder = l;
}
} while (remainder != 0);
@@ -7311,23 +7813,22 @@ make_random_offset_and_increment(long nelts, long *offsetp, long *incp)
static herr_t
test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t s=-1, m=-1, d=-1, dcpl=-1, file=-1;
- int wbuf[NPOINTS],
- rbuf[NPOINTS],
- check2[20][20];
- hsize_t coord[NPOINTS][2];
- const hsize_t dsize[2]={100,100}, dmax[2]={H5S_UNLIMITED, H5S_UNLIMITED}, csize[2]={10,10}, nsize[2]={200,200};
- hsize_t fixed_dmax[2] = {1000, 1000};
- hsize_t msize[1]={NPOINTS};
- const char dname[]="dataset";
- int chunk_row, chunk_col;
- size_t i, j;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t s = -1, m = -1, d = -1, dcpl = -1, file = -1;
+ int wbuf[NPOINTS], rbuf[NPOINTS], check2[20][20];
+ hsize_t coord[NPOINTS][2];
+ const hsize_t dsize[2] = {100, 100}, dmax[2] = {H5S_UNLIMITED, H5S_UNLIMITED}, csize[2] = {10, 10},
+ nsize[2] = {200, 200};
+ hsize_t fixed_dmax[2] = {1000, 1000};
+ hsize_t msize[1] = {NPOINTS};
+ const char dname[] = "dataset";
+ int chunk_row, chunk_col;
+ size_t i, j;
H5D_chunk_index_t idx_type; /* Dataset chunk index type */
- H5F_libver_t low; /* File format low bound */
- long ofs, inc;
- long rows;
- long cols;
+ H5F_libver_t low; /* File format low bound */
+ long ofs, inc;
+ long rows;
+ long cols;
TESTING(testname);
@@ -7335,157 +7836,197 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
- if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) TEST_ERROR;
+ if (H5Pget_libver_bounds(fapl, &low, NULL) < 0)
+ TEST_ERROR;
/* Create file for first test */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* Create dataspace */
- if((s = H5Screate_simple(2, dsize, NULL)) < 0) TEST_ERROR;
+ if ((s = H5Screate_simple(2, dsize, NULL)) < 0)
+ TEST_ERROR;
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set chunked layout */
- if(H5Pset_chunk(dcpl, 2, csize) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, csize) < 0)
+ TEST_ERROR;
/* Set early allocation time for one dataset; the other dataset is using default alloc time */
- if(early_alloc)
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR;
+ if (early_alloc)
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR;
/* Create dataset */
- if((d = H5Dcreate2(file, dname, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((d = H5Dcreate2(file, dname, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Initialization of check array for repeated coordinates */
- for(i=0; i<dsize[0]/csize[0]; i++)
- for(j=0; j<dsize[1]/csize[1]; j++)
+ for (i = 0; i < dsize[0] / csize[0]; i++)
+ for (j = 0; j < dsize[1] / csize[1]; j++)
check2[i][j] = 0;
- rows = (long)(dsize[0]/csize[0]);
- cols = (long)(dsize[1]/csize[1]);
+ rows = (long)(dsize[0] / csize[0]);
+ cols = (long)(dsize[1] / csize[1]);
make_random_offset_and_increment(rows * cols, &ofs, &inc);
/* Generate random point coordinates. Only one point is selected per chunk */
- for(i=0; i<NPOINTS; i++){
+ for (i = 0; i < NPOINTS; i++) {
H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
ofs = (ofs + inc) % (rows * cols);
HDassert(!check2[chunk_row][chunk_col]);
- wbuf[i] = check2[chunk_row][chunk_col] = chunk_row+chunk_col+1;
- coord[i][0] = (hsize_t)chunk_row * csize[0];
- coord[i][1] = (hsize_t)chunk_col * csize[1];
+ wbuf[i] = check2[chunk_row][chunk_col] = chunk_row + chunk_col + 1;
+ coord[i][0] = (hsize_t)chunk_row * csize[0];
+ coord[i][1] = (hsize_t)chunk_col * csize[1];
}
/* Create dataspace for write buffer */
- if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ if ((m = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if (H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0)
+ TEST_ERROR;
/* Write into dataset */
- if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
+ if (H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0)
+ TEST_ERROR;
/* Close resources*/
- if(H5Sclose(s) < 0) TEST_ERROR;
- if(H5Sclose(m) < 0) TEST_ERROR;
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Dclose(d) < 0) TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if (H5Sclose(s) < 0)
+ TEST_ERROR;
+ if (H5Sclose(m) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(d) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/* Open first file again */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR;
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR;
/* Open dataset */
- if((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(d, &idx_type) < 0) TEST_ERROR;
+ if (H5D__layout_idx_type_test(d, &idx_type) < 0)
+ TEST_ERROR;
/* Verify index type */
- if(low == H5F_LIBVER_LATEST) {
- if(early_alloc) {
- if(idx_type != H5D_CHUNK_IDX_NONE)
+ if (low == H5F_LIBVER_LATEST) {
+ if (early_alloc) {
+ if (idx_type != H5D_CHUNK_IDX_NONE)
FAIL_PUTS_ERROR("should be using Non-Index as index");
} /* end if */
else {
- if(idx_type != H5D_CHUNK_IDX_FARRAY)
+ if (idx_type != H5D_CHUNK_IDX_FARRAY)
FAIL_PUTS_ERROR("should be using Fixed Array as index");
} /* end else */
- } else if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ }
+ else if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
/* Get dataset dataspace */
- if((s = H5Dget_space(d)) < 0) TEST_ERROR;
+ if ((s = H5Dget_space(d)) < 0)
+ TEST_ERROR;
/* Create dataspace for read buffer */
- if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ if ((m = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if (H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0)
+ TEST_ERROR;
/* Read from dataset */
- if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
+ if (H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR;
/* Verify that written and read data are the same */
- for(i = 0; i < NPOINTS; i++)
- if(rbuf[i] != wbuf[i]){
- HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
- HDprintf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]);
+ for (i = 0; i < NPOINTS; i++)
+ if (rbuf[i] != wbuf[i]) {
+ HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__, (unsigned)i,
+ wbuf[i], (unsigned)i, rbuf[i]);
+ HDprintf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0],
+ (unsigned long)coord[i][1]);
TEST_ERROR;
} /* end if */
/* Close resources */
- if(H5Sclose(s) < 0) TEST_ERROR;
- if(H5Sclose(m) < 0) TEST_ERROR;
- if(H5Dclose(d) < 0) TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
-
+ if (H5Sclose(s) < 0)
+ TEST_ERROR;
+ if (H5Sclose(m) < 0)
+ TEST_ERROR;
+ if (H5Dclose(d) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/* Create second file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* Create dataspace with unlimited maximum dimensions */
- if(early_alloc) {
- if((s = H5Screate_simple(2, dsize, fixed_dmax)) < 0) TEST_ERROR;
- } else
- if((s = H5Screate_simple(2, dsize, dmax)) < 0) TEST_ERROR;
+ if (early_alloc) {
+ if ((s = H5Screate_simple(2, dsize, fixed_dmax)) < 0)
+ TEST_ERROR;
+ }
+ else if ((s = H5Screate_simple(2, dsize, dmax)) < 0)
+ TEST_ERROR;
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set chunked layout */
- if(H5Pset_chunk(dcpl, 2, csize) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, csize) < 0)
+ TEST_ERROR;
/* Set early allocation time for one dataset; the other dataset is using default alloc time */
- if(early_alloc)
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR;
+ if (early_alloc)
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR;
/* Create dataset */
- if((d = H5Dcreate2(file, dname, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((d = H5Dcreate2(file, dname, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(d, &idx_type) < 0) TEST_ERROR;
+ if (H5D__layout_idx_type_test(d, &idx_type) < 0)
+ TEST_ERROR;
/* Verify index type */
- if(low == H5F_LIBVER_LATEST) {
- if(early_alloc) {
- if(idx_type != H5D_CHUNK_IDX_NONE)
- FAIL_PUTS_ERROR("should be using implicit indexing");
- } else if(idx_type != H5D_CHUNK_IDX_BT2)
- FAIL_PUTS_ERROR("should be using v2 B-tree as index");
- } else if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (low == H5F_LIBVER_LATEST) {
+ if (early_alloc) {
+ if (idx_type != H5D_CHUNK_IDX_NONE)
+ FAIL_PUTS_ERROR("should be using implicit indexing");
+ }
+ else if (idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("should be using v2 B-tree as index");
+ }
+ else if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
/* Extend both dimensions of the dataset */
- if(H5Dset_extent(d, nsize) < 0) TEST_ERROR;
+ if (H5Dset_extent(d, nsize) < 0)
+ TEST_ERROR;
/* Reset the dataset dataspace to new dimensions */
- if(H5Sset_extent_simple(s, 2, nsize, dmax) < 0) TEST_ERROR;
+ if (H5Sset_extent_simple(s, 2, nsize, dmax) < 0)
+ TEST_ERROR;
/* Initialize check buffer for repeated coordinates */
- for(i = 0; i < nsize[0]/csize[0]; i++)
- for(j = 0; j < nsize[1] / csize[1]; j++)
+ for (i = 0; i < nsize[0] / csize[0]; i++)
+ for (j = 0; j < nsize[1] / csize[1]; j++)
check2[i][j] = 0;
H5_CHECKED_ASSIGN(rows, int, nsize[0] / csize[0], long);
@@ -7493,109 +8034,137 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
make_random_offset_and_increment(rows * cols, &ofs, &inc);
/* Generate random point coordinates. Only one point is selected per chunk */
- for(i = 0; i < NPOINTS; i++){
+ for (i = 0; i < NPOINTS; i++) {
H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
ofs = (ofs + inc) % (rows * cols);
HDassert(!check2[chunk_row][chunk_col]);
wbuf[i] = check2[chunk_row][chunk_col] = chunk_row + chunk_col + 1;
- coord[i][0] = (hsize_t)chunk_row * csize[0];
- coord[i][1] = (hsize_t)chunk_col * csize[1];
+ coord[i][0] = (hsize_t)chunk_row * csize[0];
+ coord[i][1] = (hsize_t)chunk_col * csize[1];
}
/* Create dataspace for write buffer */
- if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ if ((m = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if (H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0)
+ TEST_ERROR;
/* Write into dataset */
- if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
+ if (H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0)
+ TEST_ERROR;
/* Close resources */
- if(H5Sclose(s) < 0) TEST_ERROR;
- if(H5Sclose(m) < 0) TEST_ERROR;
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Dclose(d) < 0) TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if (H5Sclose(s) < 0)
+ TEST_ERROR;
+ if (H5Sclose(m) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(d) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/* Open second file again */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR;
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR;
/* Open dataset */
- if((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get dataset dataspace */
- if((s = H5Dget_space(d)) < 0) TEST_ERROR;
+ if ((s = H5Dget_space(d)) < 0)
+ TEST_ERROR;
/* Create dataspace for read buffer */
- if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ if ((m = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if (H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0)
+ TEST_ERROR;
/* Read from dataset */
- if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
+ if (H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR;
/* Verify that written and read data are the same */
- for(i = 0; i < NPOINTS; i++)
- if(rbuf[i] != wbuf[i]){
- HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
- TEST_ERROR;
+ for (i = 0; i < NPOINTS; i++)
+ if (rbuf[i] != wbuf[i]) {
+ HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__, (unsigned)i,
+ wbuf[i], (unsigned)i, rbuf[i]);
+ TEST_ERROR;
} /* end if */
/* Close resources */
- if(H5Sclose(s) < 0) TEST_ERROR;
- if(H5Sclose(m) < 0) TEST_ERROR;
- if(H5Dclose(d) < 0) TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
-
+ if (H5Sclose(s) < 0)
+ TEST_ERROR;
+ if (H5Sclose(m) < 0)
+ TEST_ERROR;
+ if (H5Dclose(d) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/* Create third file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* Create dataspace with fixed maximum dimensions */
- if((s = H5Screate_simple(2, dsize, fixed_dmax)) < 0) TEST_ERROR;
+ if ((s = H5Screate_simple(2, dsize, fixed_dmax)) < 0)
+ TEST_ERROR;
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set chunked layout */
- if(H5Pset_chunk(dcpl, 2, csize) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, csize) < 0)
+ TEST_ERROR;
/* Set early allocation time for one dataset; the other dataset is using default alloc time */
- if(early_alloc)
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR;
+ if (early_alloc)
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR;
/* Create dataset */
- if((d = H5Dcreate2(file, dname, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((d = H5Dcreate2(file, dname, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(d, &idx_type) < 0) TEST_ERROR;
+ if (H5D__layout_idx_type_test(d, &idx_type) < 0)
+ TEST_ERROR;
/* Verify index type */
- if(low == H5F_LIBVER_LATEST) {
- if(early_alloc) {
- if(idx_type != H5D_CHUNK_IDX_NONE)
+ if (low == H5F_LIBVER_LATEST) {
+ if (early_alloc) {
+ if (idx_type != H5D_CHUNK_IDX_NONE)
FAIL_PUTS_ERROR("should be using Non-Index as index");
} /* end if */
else {
- if(idx_type != H5D_CHUNK_IDX_FARRAY)
+ if (idx_type != H5D_CHUNK_IDX_FARRAY)
FAIL_PUTS_ERROR("should be using Fixed Array as index");
} /* end else */
- } else if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ }
+ else if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
/* Extend both dimensions of the dataset */
- if(H5Dset_extent(d, nsize) < 0) TEST_ERROR;
+ if (H5Dset_extent(d, nsize) < 0)
+ TEST_ERROR;
/* Reset the dataset dataspace to new dimensions */
- if(H5Sset_extent_simple(s, 2, nsize, dmax) < 0) TEST_ERROR;
+ if (H5Sset_extent_simple(s, 2, nsize, dmax) < 0)
+ TEST_ERROR;
/* Initialize check buffer for repeated coordinates */
- for(i = 0; i < nsize[0]/csize[0]; i++)
- for(j = 0; j < nsize[1] / csize[1]; j++)
+ for (i = 0; i < nsize[0] / csize[0]; i++)
+ for (j = 0; j < nsize[1] / csize[1]; j++)
check2[i][j] = 0;
rows = (long)(nsize[0] / csize[0]);
@@ -7603,79 +8172,99 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
make_random_offset_and_increment(rows * cols, &ofs, &inc);
/* Generate random point coordinates. Only one point is selected per chunk */
- for(i = 0; i < NPOINTS; i++){
+ for (i = 0; i < NPOINTS; i++) {
H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
ofs = (ofs + inc) % (rows * cols);
HDassert(!check2[chunk_row][chunk_col]);
wbuf[i] = check2[chunk_row][chunk_col] = chunk_row + chunk_col + 1;
- coord[i][0] = (hsize_t)chunk_row * csize[0];
- coord[i][1] = (hsize_t)chunk_col * csize[1];
+ coord[i][0] = (hsize_t)chunk_row * csize[0];
+ coord[i][1] = (hsize_t)chunk_col * csize[1];
}
/* Create dataspace for write buffer */
- if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ if ((m = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if (H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0)
+ TEST_ERROR;
/* Write into dataset */
- if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
+ if (H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0)
+ TEST_ERROR;
/* Close resources */
- if(H5Sclose(s) < 0) TEST_ERROR;
- if(H5Sclose(m) < 0) TEST_ERROR;
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Dclose(d) < 0) TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if (H5Sclose(s) < 0)
+ TEST_ERROR;
+ if (H5Sclose(m) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(d) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/* Open third file again */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR;
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR;
/* Open dataset */
- if((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get dataset dataspace */
- if((s = H5Dget_space(d)) < 0) TEST_ERROR;
+ if ((s = H5Dget_space(d)) < 0)
+ TEST_ERROR;
/* Create dataspace for read buffer */
- if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ if ((m = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if (H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0)
+ TEST_ERROR;
/* Read from dataset */
- if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
+ if (H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR;
/* Verify that written and read data are the same */
- for(i = 0; i < NPOINTS; i++)
- if(rbuf[i] != wbuf[i]){
- HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
- TEST_ERROR;
+ for (i = 0; i < NPOINTS; i++)
+ if (rbuf[i] != wbuf[i]) {
+ HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__, (unsigned)i,
+ wbuf[i], (unsigned)i, rbuf[i]);
+ TEST_ERROR;
} /* end if */
/* Close resources */
- if(H5Sclose(s) < 0) TEST_ERROR;
- if(H5Sclose(m) < 0) TEST_ERROR;
- if(H5Dclose(d) < 0) TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if (H5Sclose(s) < 0)
+ TEST_ERROR;
+ if (H5Sclose(m) < 0)
+ TEST_ERROR;
+ if (H5Dclose(d) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(s);
H5Sclose(m);
H5Dclose(d);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_random_chunks_real() */
-
/*-------------------------------------------------------------------------
* Function: test_random_chunks
*
@@ -7704,12 +8293,14 @@ error:
static herr_t
test_random_chunks(hid_t fapl)
{
- int nerrors = 0; /* Errors in sub-tests */
+ int nerrors = 0; /* Errors in sub-tests */
- nerrors += test_random_chunks_real("Write/read on randomly selected chunks w/non-implicit index", FALSE, fapl);
+ nerrors +=
+ test_random_chunks_real("Write/read on randomly selected chunks w/non-implicit index", FALSE, fapl);
nerrors += test_random_chunks_real("Write/read on randomly selected chunks w/implicit index", TRUE, fapl);
- return nerrors;;
+ return nerrors;
+ ;
} /* end test_random_chunks() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -7723,19 +8314,18 @@ can_apply_deprec(hid_t H5_ATTR_UNUSED dcpl_id, hid_t H5_ATTR_UNUSED type_id, hid
static herr_t
set_local_deprec(hid_t H5_ATTR_UNUSED dcpl_id, hid_t H5_ATTR_UNUSED type_id, hid_t H5_ATTR_UNUSED space_id)
{
- return(SUCCEED);
+ return (SUCCEED);
}
/* Old style H5Z_class_t, essentially a copy of the "bogus" filter */
const H5Z_class1_t H5Z_DEPREC[1] = {{
- H5Z_FILTER_DEPREC, /* Filter id number */
- "deprec", /* Filter name for debugging */
- can_apply_deprec, /* The "can apply" callback */
- set_local_deprec, /* The "set local" callback */
- filter_bogus, /* The actual filter function */
+ H5Z_FILTER_DEPREC, /* Filter id number */
+ "deprec", /* Filter name for debugging */
+ can_apply_deprec, /* The "can apply" callback */
+ set_local_deprec, /* The "set local" callback */
+ filter_bogus, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: test_deprec
*
@@ -7752,69 +8342,70 @@ const H5Z_class1_t H5Z_DEPREC[1] = {{
static herr_t
test_deprec(hid_t file)
{
- hid_t dataset, space, small_space, create_parms, dcpl;
- hsize_t dims[2], small_dims[2];
- hsize_t deprec_size;
- herr_t H5_ATTR_NDEBUG_UNUSED status;
- hsize_t csize[2];
+ hid_t dataset, space, small_space, create_parms, dcpl;
+ hsize_t dims[2], small_dims[2];
+ hsize_t deprec_size;
+ herr_t H5_ATTR_NDEBUG_UNUSED status;
+ hsize_t csize[2];
TESTING("deprecated API routines");
/* Create the data space */
dims[0] = 256;
dims[1] = 512;
- space = H5Screate_simple(2, dims, NULL);
- assert(space>=0);
+ space = H5Screate_simple(2, dims, NULL);
+ assert(space >= 0);
/* Create a small data space for compact dataset */
small_dims[0] = 16;
small_dims[1] = 8;
- small_space = H5Screate_simple(2, small_dims, NULL);
- assert(space>=0);
+ small_space = H5Screate_simple(2, small_dims, NULL);
+ assert(space >= 0);
/*
* Create a dataset using the default dataset creation properties. We're
* not sure what they are, so we won't check.
*/
- if((dataset = H5Dcreate1(file, DSET_DEPREC_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT)) < 0) goto error;
+ if ((dataset = H5Dcreate1(file, DSET_DEPREC_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT)) < 0)
+ goto error;
/* Close the dataset */
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
/*
* Try creating a dataset that already exists. This should fail since a
* dataset can only be created once. Temporarily turn off error
* reporting.
*/
- H5E_BEGIN_TRY {
- dataset = H5Dcreate1(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space,
- H5P_DEFAULT);
- } H5E_END_TRY;
- if(dataset >= 0) {
- H5_FAILED();
- HDputs(" Library allowed overwrite of existing dataset.");
- goto error;
+ H5E_BEGIN_TRY { dataset = H5Dcreate1(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (dataset >= 0) {
+ H5_FAILED();
+ HDputs(" Library allowed overwrite of existing dataset.");
+ goto error;
}
/*
* Open the dataset we created above and then close it. This is how
* existing datasets are accessed.
*/
- if((dataset = H5Dopen1(file, DSET_DEPREC_NAME)) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if ((dataset = H5Dopen1(file, DSET_DEPREC_NAME)) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
/*
* Try opening a non-existent dataset. This should fail since new datasets
* cannot be created with this function. Temporarily turn off error
* reporting.
*/
- H5E_BEGIN_TRY {
- dataset = H5Dopen1(file, "does_not_exist");
- } H5E_END_TRY;
- if(dataset >= 0) {
- H5_FAILED();
- HDputs(" Opened a non-existent dataset.");
- goto error;
+ H5E_BEGIN_TRY { dataset = H5Dopen1(file, "does_not_exist"); }
+ H5E_END_TRY;
+ if (dataset >= 0) {
+ H5_FAILED();
+ HDputs(" Opened a non-existent dataset.");
+ goto error;
}
/*
@@ -7826,66 +8417,73 @@ test_deprec(hid_t file)
/* Add the deflate filter, if available */
#if defined H5_HAVE_FILTER_DEFLATE
-{
- H5Z_filter_t filtn; /* filter identification number */
- size_t cd_nelmts = 1; /* Number of filter parameters */
- unsigned cd_value; /* Filter parameter */
+ {
+ H5Z_filter_t filtn; /* filter identification number */
+ size_t cd_nelmts = 1; /* Number of filter parameters */
+ unsigned cd_value; /* Filter parameter */
- if(H5Pset_deflate(create_parms, 6) < 0) goto error;
+ if (H5Pset_deflate(create_parms, 6) < 0)
+ goto error;
- /* Check for the deflate filter */
- filtn = H5Pget_filter1(create_parms, (unsigned)0, NULL, &cd_nelmts, &cd_value, (size_t)0, NULL);
- if(H5Z_FILTER_DEFLATE != filtn)
- goto error;
- if(1 != cd_nelmts)
- goto error;
- if(6 != cd_value)
- goto error;
+ /* Check for the deflate filter */
+ filtn = H5Pget_filter1(create_parms, (unsigned)0, NULL, &cd_nelmts, &cd_value, (size_t)0, NULL);
+ if (H5Z_FILTER_DEFLATE != filtn)
+ goto error;
+ if (1 != cd_nelmts)
+ goto error;
+ if (6 != cd_value)
+ goto error;
- /* Check for the deflate filter */
- if(H5Pget_filter_by_id1(create_parms, H5Z_FILTER_DEFLATE, NULL, &cd_nelmts, &cd_value, (size_t)0, NULL) < 0) goto error;
- if(1 != cd_nelmts)
- goto error;
- if(6 != cd_value)
- goto error;
-}
+ /* Check for the deflate filter */
+ if (H5Pget_filter_by_id1(create_parms, H5Z_FILTER_DEFLATE, NULL, &cd_nelmts, &cd_value, (size_t)0,
+ NULL) < 0)
+ goto error;
+ if (1 != cd_nelmts)
+ goto error;
+ if (6 != cd_value)
+ goto error;
+ }
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Attempt to create a dataset with invalid chunk sizes */
- csize[0] = dims[0]*2;
- csize[1] = dims[1]*2;
- status = H5Pset_chunk(create_parms, 2, csize);
+ csize[0] = dims[0] * 2;
+ csize[1] = dims[1] * 2;
+ status = H5Pset_chunk(create_parms, 2, csize);
assert(status >= 0);
- H5E_BEGIN_TRY {
- dataset = H5Dcreate1(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space,
- create_parms);
- } H5E_END_TRY;
- if(dataset >= 0) {
- H5_FAILED();
- HDputs(" Opened a dataset with incorrect chunking parameters.");
- goto error;
+ H5E_BEGIN_TRY
+ {
+ dataset = H5Dcreate1(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, create_parms);
+ }
+ H5E_END_TRY;
+ if (dataset >= 0) {
+ H5_FAILED();
+ HDputs(" Opened a dataset with incorrect chunking parameters.");
+ goto error;
}
csize[0] = 5;
csize[1] = 100;
- status = H5Pset_chunk(create_parms, 2, csize);
+ status = H5Pset_chunk(create_parms, 2, csize);
assert(status >= 0);
- if((dataset = H5Dcreate1(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, create_parms)) < 0) goto error;
+ if ((dataset = H5Dcreate1(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, create_parms)) < 0)
+ goto error;
H5Pclose(create_parms);
/*
* Close the chunked dataset.
*/
- if(H5Dclose(dataset) < 0) goto error;
-
+ if (H5Dclose(dataset) < 0)
+ goto error;
/*
* Open the dataset we created above and then close it. This is how
* existing datasets are accessed.
*/
- if((dataset = H5Dopen1(file, DSET_DEPREC_NAME_CHUNKED)) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if ((dataset = H5Dopen1(file, DSET_DEPREC_NAME_CHUNKED)) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
/*
* Create a compact dataset, then close it.
@@ -7897,36 +8495,47 @@ test_deprec(hid_t file)
status = H5Pset_alloc_time(create_parms, H5D_ALLOC_TIME_EARLY);
assert(status >= 0);
- if((dataset = H5Dcreate1(file, DSET_DEPREC_NAME_COMPACT, H5T_NATIVE_DOUBLE, small_space, create_parms)) < 0) goto error;
+ if ((dataset = H5Dcreate1(file, DSET_DEPREC_NAME_COMPACT, H5T_NATIVE_DOUBLE, small_space, create_parms)) <
+ 0)
+ goto error;
H5Pclose(create_parms);
- if(H5Dclose(dataset) < 0) goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
/*
* Open the dataset we created above and then close it. This is how
* existing datasets are accessed.
*/
- if((dataset = H5Dopen1(file, DSET_DEPREC_NAME_COMPACT)) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if ((dataset = H5Dopen1(file, DSET_DEPREC_NAME_COMPACT)) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
/* Test H5Zregister with deprecated H5Z_class1_t */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dcpl, 2, csize) < 0) goto error;
- if(H5Zregister(H5Z_DEPREC) < 0) goto error;
- if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, 2, csize) < 0)
+ goto error;
+ if (H5Zregister(H5Z_DEPREC) < 0)
+ goto error;
+ if (H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0)
+ goto error;
HDputs("");
- if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error;
+ if (test_filter_internal(file, DSET_DEPREC_NAME_FILTER, dcpl, DISABLE_FLETCHER32, DATA_NOT_CORRUPTED,
+ &deprec_size) < 0)
+ goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
return SUCCEED;
- error:
+error:
return FAIL;
} /* end test_deprec() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: test_huge_chunks
*
@@ -7943,102 +8552,114 @@ test_deprec(hid_t file)
static herr_t
test_huge_chunks(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dsid = -1; /* Dataset ID */
- hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */
- hsize_t dim2[3], chunk_dim2[3]; /* Dataset and chunk dimensions */
- herr_t ret; /* Generic return value */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dsid = -1; /* Dataset ID */
+ hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */
+ hsize_t dim2[3], chunk_dim2[3]; /* Dataset and chunk dimensions */
+ herr_t ret; /* Generic return value */
TESTING("creating dataset with >4GB chunks");
h5_fixname(FILENAME[7], fapl, filename, sizeof filename);
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Try to set too large of a chunk for 1-D dataset (# of elements) */
chunk_dim = TOO_HUGE_CHUNK_DIM;
- H5E_BEGIN_TRY {
- ret = H5Pset_chunk(dcpl, 1, &chunk_dim);
- } H5E_END_TRY;
- if(ret >= 0)
- FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.")
+ H5E_BEGIN_TRY { ret = H5Pset_chunk(dcpl, 1, &chunk_dim); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.")
/* Try to set too large of a chunk for n-D dataset (# of elements) */
chunk_dim2[0] = TOO_HUGE_CHUNK_DIM2_0;
chunk_dim2[1] = TOO_HUGE_CHUNK_DIM2_1;
chunk_dim2[2] = TOO_HUGE_CHUNK_DIM2_2;
- H5E_BEGIN_TRY {
- ret = H5Pset_chunk(dcpl, 3, chunk_dim2);
- } H5E_END_TRY;
- if(ret >= 0)
- FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.")
+ H5E_BEGIN_TRY { ret = H5Pset_chunk(dcpl, 3, chunk_dim2); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.")
/* Set 1-D chunk size */
chunk_dim = HUGE_CHUNK_DIM;
- if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 1, &chunk_dim) < 0)
+ FAIL_STACK_ERROR
/* Create 1-D dataspace */
dim = HUGE_DIM;
- if((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(1, &dim, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Try to create dataset */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dsid = H5Dcreate2(fid, HUGE_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dsid >= 0)
- FAIL_PUTS_ERROR(" 1-D Dataset with too large of chunk dimensions created.")
+ }
+ H5E_END_TRY;
+ if (dsid >= 0)
+ FAIL_PUTS_ERROR(" 1-D Dataset with too large of chunk dimensions created.")
/* Close 1-D dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
-
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
/* Set n-D chunk size */
chunk_dim2[0] = HUGE_CHUNK_DIM2_0;
chunk_dim2[1] = HUGE_CHUNK_DIM2_1;
chunk_dim2[2] = HUGE_CHUNK_DIM2_2;
- if(H5Pset_chunk(dcpl, 3, chunk_dim2) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 3, chunk_dim2) < 0)
+ FAIL_STACK_ERROR
/* Create n-D dataspace */
dim2[0] = HUGE_DIM2_0;
dim2[1] = HUGE_DIM2_1;
dim2[2] = HUGE_DIM2_2;
- if((sid = H5Screate_simple(3, dim2, NULL)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(3, dim2, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Try to create dataset */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dsid = H5Dcreate2(fid, HUGE_DATASET2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dsid >= 0)
- FAIL_PUTS_ERROR(" n-D Dataset with too large of chunk dimensions created.")
+ }
+ H5E_END_TRY;
+ if (dsid >= 0)
+ FAIL_PUTS_ERROR(" n-D Dataset with too large of chunk dimensions created.")
/* Close n-D dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
/* Close everything else */
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_huge_chunks() */
-
/*-------------------------------------------------------------------------
* Function: test_chunk_cache
*
@@ -8056,184 +8677,227 @@ error:
static herr_t
test_chunk_cache(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t fapl_local = -1; /* Local fapl */
- hid_t fapl_def = -1; /* Default fapl */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t dapl1 = -1; /* Dataset access property list ID */
- hid_t dapl2 = -1; /* Dataset access property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dsid = -1; /* Dataset ID */
- hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */
- size_t nslots_1, nslots_2, nslots_3, nslots_4; /* rdcc number of elements */
- size_t nbytes_1, nbytes_2, nbytes_3, nbytes_4; /* rdcc number of bytes */
- size_t nlinks; /* Number of link traversals */
- double w0_1, w0_2, w0_3, w0_4; /* rdcc preemption policy */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t fapl_local = -1; /* Local fapl */
+ hid_t fapl_def = -1; /* Default fapl */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t dapl1 = -1; /* Dataset access property list ID */
+ hid_t dapl2 = -1; /* Dataset access property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dsid = -1; /* Dataset ID */
+ hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */
+ size_t nslots_1, nslots_2, nslots_3, nslots_4; /* rdcc number of elements */
+ size_t nbytes_1, nbytes_2, nbytes_3, nbytes_4; /* rdcc number of bytes */
+ size_t nlinks; /* Number of link traversals */
+ double w0_1, w0_2, w0_3, w0_4; /* rdcc preemption policy */
TESTING("dataset chunk cache configuration");
/* Create a default fapl and dapl */
- if ((fapl_def = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR
- if ((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR
+ if ((fapl_def = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+ if ((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Pget_chunk_cache(dapl) returns the same values as are in
* the default fapl.
*/
- if (H5Pget_cache(fapl_def, NULL, &nslots_1, &nbytes_1, &w0_1) < 0) FAIL_STACK_ERROR
- if (H5Pget_chunk_cache(dapl1, &nslots_4, &nbytes_4, &w0_4) < 0) FAIL_STACK_ERROR
+ if (H5Pget_cache(fapl_def, NULL, &nslots_1, &nbytes_1, &w0_1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pget_chunk_cache(dapl1, &nslots_4, &nbytes_4, &w0_4) < 0)
+ FAIL_STACK_ERROR
if ((nslots_1 != nslots_4) || (nbytes_1 != nbytes_4) || !H5_DBL_ABS_EQUAL(w0_1, w0_4))
FAIL_PUTS_ERROR(" Cache values from default dapl do not match those from fapl.")
/* Set a lapl property on dapl1 (to verify inheritance) */
- if (H5Pset_nlinks(dapl1, (size_t)134) < 0) FAIL_STACK_ERROR
- if (H5Pget_nlinks(dapl1, &nlinks) < 0) FAIL_STACK_ERROR
+ if (H5Pset_nlinks(dapl1, (size_t)134) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pget_nlinks(dapl1, &nlinks) < 0)
+ FAIL_STACK_ERROR
if (nlinks != 134)
FAIL_PUTS_ERROR(" nlinks parameter not set properly on dapl.")
/* Copy fapl passed to this function (as we will be modifying it) */
- if ((fapl_local = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+ if ((fapl_local = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
/* Set new rdcc settings on fapl */
nslots_2 = nslots_1 * 2;
nbytes_2 = nbytes_1 * 2;
- w0_2 = w0_1 / (double)2.0F;
- if (H5Pset_cache(fapl_local, 0, nslots_2, nbytes_2, w0_2) < 0) FAIL_STACK_ERROR
+ w0_2 = w0_1 / (double)2.0F;
+ if (H5Pset_cache(fapl_local, 0, nslots_2, nbytes_2, w0_2) < 0)
+ FAIL_STACK_ERROR
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
/* Create file */
- if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_local)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_local)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset creation property list */
- if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set chunking */
chunk_dim = 10;
- if (H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 1, &chunk_dim) < 0)
+ FAIL_STACK_ERROR
/* Create 1-D dataspace */
dim = 100;
- if ((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(1, &dim, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset with default dapl */
if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl1)) < 0)
FAIL_STACK_ERROR
/* Retrieve dapl from dataset, verfiy cache values are the same as on fapl_local */
- if ((dapl2 = H5Dget_access_plist(dsid)) < 0) FAIL_STACK_ERROR
- if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0) FAIL_STACK_ERROR
+ if ((dapl2 = H5Dget_access_plist(dsid)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0)
+ FAIL_STACK_ERROR
if ((nslots_2 != nslots_4) || (nbytes_2 != nbytes_4) || !H5_DBL_ABS_EQUAL(w0_2, w0_4))
FAIL_PUTS_ERROR(" Cache values from retrieved dapl do not match those from fapl.")
- if (H5Pclose(dapl2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dapl2) < 0)
+ FAIL_STACK_ERROR
/* Set new values on dapl1. nbytes will be set to default, so the file
* property will override this setting */
nslots_3 = nslots_2 * 2;
nbytes_3 = H5D_CHUNK_CACHE_NBYTES_DEFAULT;
- w0_3 = w0_2 / 2;
- if (H5Pset_chunk_cache(dapl1, nslots_3, nbytes_3, w0_3) < 0) FAIL_STACK_ERROR
+ w0_3 = w0_2 / 2;
+ if (H5Pset_chunk_cache(dapl1, nslots_3, nbytes_3, w0_3) < 0)
+ FAIL_STACK_ERROR
/* Close dataset, reopen with dapl1. Note the use of a dapl with H5Oopen */
- if (H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if ((dsid = H5Oopen(fid, "dset", dapl1)) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if ((dsid = H5Oopen(fid, "dset", dapl1)) < 0)
+ FAIL_STACK_ERROR
/* Retrieve dapl from dataset, verfiy cache values are the same as on dapl1 */
/* Note we rely on the knowledge that H5Pget_chunk_cache retrieves these
* values directly from the dataset structure, and not from a copy of the
* dapl used to open the dataset (which is not preserved).
*/
- if ((dapl2 = H5Dget_access_plist(dsid)) < 0) FAIL_STACK_ERROR
- if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0) FAIL_STACK_ERROR
+ if ((dapl2 = H5Dget_access_plist(dsid)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0)
+ FAIL_STACK_ERROR
if ((nslots_3 != nslots_4) || (nbytes_2 != nbytes_4) || !H5_DBL_ABS_EQUAL(w0_3, w0_4))
FAIL_PUTS_ERROR(" Cache values from retrieved dapl do not match those from dapl1.")
- if (H5Pclose(dapl2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dapl2) < 0)
+ FAIL_STACK_ERROR
/* Close dataset, reopen with H5P_DEFAULT as dapl */
- if (H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if ((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Retrieve dapl from dataset, verfiy cache values are the same on fapl_local */
- if ((dapl2 = H5Dget_access_plist(dsid)) < 0) FAIL_STACK_ERROR
- if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0) FAIL_STACK_ERROR
+ if ((dapl2 = H5Dget_access_plist(dsid)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0)
+ FAIL_STACK_ERROR
if ((nslots_2 != nslots_4) || (nbytes_2 != nbytes_4) || !H5_DBL_ABS_EQUAL(w0_2, w0_4))
FAIL_PUTS_ERROR(" Cache values from retrieved dapl do not match those from fapl.")
- if (H5Pclose(dapl2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dapl2) < 0)
+ FAIL_STACK_ERROR
/* Similary, test use of H5Dcreate2 with H5P_DEFAULT */
- if (H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
if ((dsid = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if ((dapl2 = H5Dget_access_plist(dsid)) < 0) FAIL_STACK_ERROR
- if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0) FAIL_STACK_ERROR
+ if ((dapl2 = H5Dget_access_plist(dsid)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0)
+ FAIL_STACK_ERROR
if ((nslots_2 != nslots_4) || (nbytes_2 != nbytes_4) || !H5_DBL_ABS_EQUAL(w0_2, w0_4))
FAIL_PUTS_ERROR(" Cache values from retrieved dapl do not match those from fapl.")
/* Don't close dapl2, we will use it in the next section */
/* Modify cache values on fapl_local */
nbytes_3 = nbytes_2 * 2;
- if (H5Pset_cache(fapl_local, 0, nslots_3, nbytes_3, w0_3) < 0) FAIL_STACK_ERROR
+ if (H5Pset_cache(fapl_local, 0, nslots_3, nbytes_3, w0_3) < 0)
+ FAIL_STACK_ERROR
/* Close and reopen file with new fapl_local */
- if (H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if (H5Fclose(fid) < 0) FAIL_STACK_ERROR
- if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_local)) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_local)) < 0)
+ FAIL_STACK_ERROR
/* Verify that dapl2 retrieved earlier (using values from the old fapl)
* sets its values in the new file (test use of H5Dopen2 with a dapl)
*/
- if ((dsid = H5Dopen2(fid, "dset", dapl2)) < 0) FAIL_STACK_ERROR
- if (H5Pclose(dapl2) < 0) FAIL_STACK_ERROR /* Close dapl2, to avoid id leak */
- if ((dapl2 = H5Dget_access_plist(dsid)) < 0) FAIL_STACK_ERROR
- if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0) FAIL_STACK_ERROR
- if ((nslots_2 != nslots_4) || (nbytes_2 != nbytes_4) || !H5_DBL_ABS_EQUAL(w0_2, w0_4))
- FAIL_PUTS_ERROR(" Cache values from retrieved dapl do not match those from dapl2.")
+ if ((dsid = H5Dopen2(fid, "dset", dapl2)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dapl2) < 0)
+ FAIL_STACK_ERROR /* Close dapl2, to avoid id leak */
+ if ((dapl2 = H5Dget_access_plist(dsid)) < 0)
+ FAIL_STACK_ERROR if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0)
+ FAIL_STACK_ERROR if ((nslots_2 != nslots_4) || (nbytes_2 != nbytes_4) ||
+ !H5_DBL_ABS_EQUAL(w0_2, w0_4))
+ FAIL_PUTS_ERROR(" Cache values from retrieved dapl do not match those from dapl2.")
- /* Test H5D_CHUNK_CACHE_NSLOTS_DEFAULT and H5D_CHUNK_CACHE_W0_DEFAULT */
- nslots_2 = H5D_CHUNK_CACHE_NSLOTS_DEFAULT;
+ /* Test H5D_CHUNK_CACHE_NSLOTS_DEFAULT and H5D_CHUNK_CACHE_W0_DEFAULT */
+ nslots_2 = H5D_CHUNK_CACHE_NSLOTS_DEFAULT;
w0_2 = H5D_CHUNK_CACHE_W0_DEFAULT;
- if (H5Pset_chunk_cache(dapl2, nslots_2, nbytes_2, w0_2) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk_cache(dapl2, nslots_2, nbytes_2, w0_2) < 0)
+ FAIL_STACK_ERROR
- if (H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if ((dsid = H5Dopen2(fid, "dset", dapl2)) < 0) FAIL_STACK_ERROR
- if (H5Pclose(dapl2) < 0) FAIL_STACK_ERROR /* Close dapl2, to avoid id leak */
- if ((dapl2 = H5Dget_access_plist(dsid)) < 0) FAIL_STACK_ERROR
- if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0) FAIL_STACK_ERROR
- if ((nslots_3 != nslots_4) || (nbytes_2 != nbytes_4) || !H5_DBL_ABS_EQUAL(w0_3, w0_4))
- FAIL_PUTS_ERROR(" Cache values from retrieved dapl do not match those expected.")
- if (H5Pclose(dapl2) < 0) FAIL_STACK_ERROR
-
- /* Verify that the file has indeed started using the new cache values (test
- * use of H5Oopen with H5P_DEFAULT) */
- if (H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if ((dsid = H5Oopen(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if ((dapl2 = H5Dget_access_plist(dsid)) < 0) FAIL_STACK_ERROR
- if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0) FAIL_STACK_ERROR
- if ((nslots_3 != nslots_4) || (nbytes_3 != nbytes_4) || !H5_DBL_ABS_EQUAL(w0_3, w0_4))
- FAIL_PUTS_ERROR(" Cache values from retrieved dapl do not match those from fapl.")
- if (H5Pclose(dapl2) < 0) FAIL_STACK_ERROR
-
- /* Verify functionality of H5Pcopy with a dapl */
- if ((dapl2 = H5Pcopy(dapl1)) < 0) FAIL_STACK_ERROR
- if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0) FAIL_STACK_ERROR
- if ((nslots_3 != nslots_4) || (nbytes_1 != nbytes_4) || !H5_DBL_ABS_EQUAL(w0_3, w0_4))
- FAIL_PUTS_ERROR(" Cache values from dapl2 do not match those from dapl1.")
-
- /* Close */
- if (H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if (H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if (H5Pclose(fapl_local) < 0) FAIL_STACK_ERROR
- if (H5Pclose(fapl_def) < 0) FAIL_STACK_ERROR
- if (H5Pclose(dapl1) < 0) FAIL_STACK_ERROR
- if (H5Pclose(dapl2) < 0) FAIL_STACK_ERROR
- if (H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if (H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset", dapl2)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dapl2) < 0)
+ FAIL_STACK_ERROR /* Close dapl2, to avoid id leak */
+ if ((dapl2 = H5Dget_access_plist(dsid)) <
+ 0) FAIL_STACK_ERROR if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) <
+ 0) FAIL_STACK_ERROR if ((nslots_3 != nslots_4) ||
+ (nbytes_2 != nbytes_4) ||
+ !H5_DBL_ABS_EQUAL(w0_3, w0_4))
+ FAIL_PUTS_ERROR(
+ " Cache values from retrieved dapl do not match those expected.") if (H5Pclose(dapl2) <
+ 0)
+ FAIL_STACK_ERROR
- PASSED();
+ /* Verify that the file has indeed started using the new cache values (test
+ * use of H5Oopen with H5P_DEFAULT) */
+ if (H5Dclose(dsid) < 0) FAIL_STACK_ERROR if ((dsid = H5Oopen(fid, "dset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR if ((dapl2 = H5Dget_access_plist(dsid)) < 0)
+ FAIL_STACK_ERROR if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0)
+ FAIL_STACK_ERROR if ((nslots_3 != nslots_4) || (nbytes_3 != nbytes_4) ||
+ !H5_DBL_ABS_EQUAL(w0_3, w0_4))
+ FAIL_PUTS_ERROR(" Cache values from retrieved dapl do not match those from "
+ "fapl.") if (H5Pclose(dapl2) < 0) FAIL_STACK_ERROR
+
+ /* Verify functionality of H5Pcopy with a dapl */
+ if ((dapl2 = H5Pcopy(dapl1)) < 0)
+ FAIL_STACK_ERROR if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0)
+ FAIL_STACK_ERROR if ((nslots_3 != nslots_4) || (nbytes_1 != nbytes_4) ||
+ !H5_DBL_ABS_EQUAL(w0_3, w0_4))
+ FAIL_PUTS_ERROR(" Cache values from dapl2 do not match those from dapl1.")
+
+ /* Close */
+ if (H5Dclose(dsid) < 0) FAIL_STACK_ERROR if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR if (H5Pclose(fapl_local) < 0) FAIL_STACK_ERROR if (H5Pclose(fapl_def) < 0)
+ FAIL_STACK_ERROR if (H5Pclose(dapl1) < 0) FAIL_STACK_ERROR if (H5Pclose(dapl2) < 0)
+ FAIL_STACK_ERROR if (H5Pclose(dcpl) < 0) FAIL_STACK_ERROR if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_local);
H5Pclose(fapl_def);
H5Pclose(dapl1);
@@ -8242,11 +8906,11 @@ error:
H5Dclose(dsid);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_chunk_cache() */
-
/*-------------------------------------------------------------------------
* Function: test_big_chunks_bypass_cache
*
@@ -8268,121 +8932,145 @@ error:
static herr_t
test_big_chunks_bypass_cache(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t fapl_local = -1; /* File access property list ID */
- hid_t dcpl = -1, t_dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1, t_sid = -1; /* Dataspace ID */
- hid_t mid; /* Memory space ID */
- hid_t dsid = -1, t_dsid = -1; /* Dataset ID */
- hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */
- hsize_t t_dim[2], t_max[2], t_chunk_dim[2]; /* Dataset and chunk dimensions */
- size_t rdcc_nelmts, rdcc_nbytes; /* Chunk cache parameters */
- int fvalue = BYPASS_FILL_VALUE; /* Fill value */
- hsize_t count, stride, offset, block; /* Setting for hyperslab (1-D) */
- hsize_t t_count[2], t_stride[2], t_offset[2], t_block[2]; /* Setting for hyperslab (2-D) */
- /* Buffers for reading and writing data (1-D) */
- int *wdata = NULL, *rdata1 = NULL, *rdata2 = NULL;
- /* Buffers for reading and writing data (2-D) */
- int **t_wdata = NULL;
- int **t_rdata1 = NULL;
- int **t_rdata2 = NULL;
- int *t_wdata_bytes = NULL;
- int *t_rdata1_bytes = NULL;
- int *t_rdata2_bytes = NULL;
- int i, j; /* Local index variables */
- H5F_libver_t low; /* File format low bound */
- H5D_chunk_index_t idx_type, t_idx_type; /* Dataset chunk index types */
-
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t fapl_local = -1; /* File access property list ID */
+ hid_t dcpl = -1, t_dcpl = -1; /* Dataset creation property list ID */
+ hid_t sid = -1, t_sid = -1; /* Dataspace ID */
+ hid_t mid; /* Memory space ID */
+ hid_t dsid = -1, t_dsid = -1; /* Dataset ID */
+ hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */
+ hsize_t t_dim[2], t_max[2], t_chunk_dim[2]; /* Dataset and chunk dimensions */
+ size_t rdcc_nelmts, rdcc_nbytes; /* Chunk cache parameters */
+ int fvalue = BYPASS_FILL_VALUE; /* Fill value */
+ hsize_t count, stride, offset, block; /* Setting for hyperslab (1-D) */
+ hsize_t t_count[2], t_stride[2], t_offset[2], t_block[2]; /* Setting for hyperslab (2-D) */
+ /* Buffers for reading and writing data (1-D) */
+ int *wdata = NULL, *rdata1 = NULL, *rdata2 = NULL;
+ /* Buffers for reading and writing data (2-D) */
+ int ** t_wdata = NULL;
+ int ** t_rdata1 = NULL;
+ int ** t_rdata2 = NULL;
+ int * t_wdata_bytes = NULL;
+ int * t_rdata1_bytes = NULL;
+ int * t_rdata2_bytes = NULL;
+ int i, j; /* Local index variables */
+ H5F_libver_t low; /* File format low bound */
+ H5D_chunk_index_t idx_type, t_idx_type; /* Dataset chunk index types */
TESTING("big chunks bypassing the cache");
h5_fixname(FILENAME[9], fapl, filename, sizeof filename);
/* Set up data arrays */
- if(NULL == (t_wdata_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int))))
+ if (NULL ==
+ (t_wdata_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM / 2) * (BYPASS_CHUNK_DIM / 2), sizeof(int))))
TEST_ERROR;
- if(NULL == (t_wdata = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_wdata_bytes))))
+ if (NULL == (t_wdata = (int **)HDcalloc((BYPASS_CHUNK_DIM / 2), sizeof(t_wdata_bytes))))
TEST_ERROR;
- for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++)
- t_wdata[i] = t_wdata_bytes + (i * (BYPASS_CHUNK_DIM/2));
+ for (i = 0; i < (BYPASS_CHUNK_DIM / 2); i++)
+ t_wdata[i] = t_wdata_bytes + (i * (BYPASS_CHUNK_DIM / 2));
- if(NULL == (t_rdata1_bytes = (int *)HDcalloc(BYPASS_DIM * BYPASS_DIM, sizeof(int))))
+ if (NULL == (t_rdata1_bytes = (int *)HDcalloc(BYPASS_DIM * BYPASS_DIM, sizeof(int))))
TEST_ERROR;
- if(NULL == (t_rdata1 = (int **)HDcalloc(BYPASS_DIM, sizeof(t_rdata1_bytes))))
+ if (NULL == (t_rdata1 = (int **)HDcalloc(BYPASS_DIM, sizeof(t_rdata1_bytes))))
TEST_ERROR;
for (i = 0; i < BYPASS_DIM; i++)
t_rdata1[i] = t_rdata1_bytes + (i * BYPASS_DIM);
- if(NULL == (t_rdata2_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int))))
+ if (NULL ==
+ (t_rdata2_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM / 2) * (BYPASS_CHUNK_DIM / 2), sizeof(int))))
TEST_ERROR;
- if(NULL == (t_rdata2 = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_rdata2_bytes))))
+ if (NULL == (t_rdata2 = (int **)HDcalloc((BYPASS_CHUNK_DIM / 2), sizeof(t_rdata2_bytes))))
TEST_ERROR;
- for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++)
- t_rdata2[i] = t_rdata2_bytes + (i * (BYPASS_CHUNK_DIM/2));
-
+ for (i = 0; i < (BYPASS_CHUNK_DIM / 2); i++)
+ t_rdata2[i] = t_rdata2_bytes + (i * (BYPASS_CHUNK_DIM / 2));
- /* Check if we are using the latest version of the format */
- if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) FAIL_STACK_ERROR
+ /* Check if we are using the latest version of the format */
+ if (H5Pget_libver_bounds(fapl, &low, NULL) < 0)
+ FAIL_STACK_ERROR
/* Copy fapl passed to this function (as we will be modifying it) */
- if((fapl_local = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+ if ((fapl_local = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
/* Define cache size to be smaller than chunk size */
- rdcc_nelmts = BYPASS_CHUNK_DIM/5;
- rdcc_nbytes = sizeof(int)*BYPASS_CHUNK_DIM/5;
- if(H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, 0.0F) < 0) FAIL_STACK_ERROR
+ rdcc_nelmts = BYPASS_CHUNK_DIM / 5;
+ rdcc_nbytes = sizeof(int) * BYPASS_CHUNK_DIM / 5;
+ if (H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, 0.0F) < 0)
+ FAIL_STACK_ERROR
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_local)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_local)) < 0)
+ FAIL_STACK_ERROR
/* Create 1-D & 2-D dataspace */
dim = t_dim[0] = t_dim[1] = BYPASS_DIM;
t_max[0] = t_max[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR
- if((t_sid = H5Screate_simple(2, t_dim, t_max)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(1, &dim, NULL)) < 0)
+ FAIL_STACK_ERROR
+ if ((t_sid = H5Screate_simple(2, t_dim, t_max)) < 0)
+ FAIL_STACK_ERROR
/* Create 1-D & 2-D dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
- if((t_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if ((t_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Define chunk size. */
/* There will be 2 chunks in 1-D dataset & 4 chunks in the 2-D dataset */
chunk_dim = t_chunk_dim[0] = t_chunk_dim[1] = BYPASS_CHUNK_DIM;
- if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR
- if(H5Pset_chunk(t_dcpl, 2, t_chunk_dim) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 1, &chunk_dim) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_chunk(t_dcpl, 2, t_chunk_dim) < 0)
+ FAIL_STACK_ERROR
/* Define fill value, fill time, and chunk allocation time */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fvalue) < 0) FAIL_STACK_ERROR
- if(H5Pset_fill_value(t_dcpl, H5T_NATIVE_INT, &fvalue) < 0) FAIL_STACK_ERROR
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fvalue) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_fill_value(t_dcpl, H5T_NATIVE_INT, &fvalue) < 0)
+ FAIL_STACK_ERROR
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) FAIL_STACK_ERROR
- if(H5Pset_fill_time(t_dcpl, H5D_FILL_TIME_IFSET) < 0) FAIL_STACK_ERROR
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_fill_time(t_dcpl, H5D_FILL_TIME_IFSET) < 0)
+ FAIL_STACK_ERROR
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR) < 0) FAIL_STACK_ERROR
- if(H5Pset_alloc_time(t_dcpl, H5D_ALLOC_TIME_INCR) < 0) FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(t_dcpl, H5D_ALLOC_TIME_INCR) < 0)
+ FAIL_STACK_ERROR
/* Create the first 1-D dataset */
- if((dsid = H5Dcreate2(fid, BYPASS_DATASET1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, BYPASS_DATASET1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create the first 2-D dataset */
- if((t_dsid = H5Dcreate2(fid, T_BYPASS_DATASET1, H5T_NATIVE_INT, t_sid, H5P_DEFAULT, t_dcpl, H5P_DEFAULT)) < 0)
+ if ((t_dsid =
+ H5Dcreate2(fid, T_BYPASS_DATASET1, H5T_NATIVE_INT, t_sid, H5P_DEFAULT, t_dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get the chunk index types for 1-D and 2-d datasets */
- if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR
- if(H5D__layout_idx_type_test(t_dsid, &t_idx_type) < 0) FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(dsid, &idx_type) < 0)
+ FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(t_dsid, &t_idx_type) < 0)
+ FAIL_STACK_ERROR
/* Chunk index type expected depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
- /* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_FARRAY) FAIL_PUTS_ERROR("should be using Fixed Array as index");
- if(t_idx_type != H5D_CHUNK_IDX_BT2) FAIL_PUTS_ERROR("should be using v2 B-tree as index");
- } else {
- /* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index");
- if(t_idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (low == H5F_LIBVER_LATEST) {
+ /* Verify index type */
+ if (idx_type != H5D_CHUNK_IDX_FARRAY)
+ FAIL_PUTS_ERROR("should be using Fixed Array as index");
+ if (t_idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("should be using v2 B-tree as index");
+ }
+ else {
+ /* Verify index type */
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (t_idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
} /* end else */
/* Select first chunk to write the data */
@@ -8390,27 +9078,27 @@ test_big_chunks_bypass_cache(hid_t fapl)
count = t_count[0] = t_count[1] = 1;
stride = t_stride[0] = t_stride[1] = 1;
block = t_block[0] = t_block[1] = BYPASS_CHUNK_DIM / 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &offset, &stride, &count, &block) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, &offset, &stride, &count, &block) < 0)
FAIL_STACK_ERROR
- if(H5Sselect_hyperslab(t_sid, H5S_SELECT_SET, t_offset, t_stride, t_count, t_block) < 0)
+ if (H5Sselect_hyperslab(t_sid, H5S_SELECT_SET, t_offset, t_stride, t_count, t_block) < 0)
FAIL_STACK_ERROR
/* Allocate buffers */
- if(NULL == (wdata = (int *)HDmalloc(sizeof(int) * (BYPASS_CHUNK_DIM / 2))))
+ if (NULL == (wdata = (int *)HDmalloc(sizeof(int) * (BYPASS_CHUNK_DIM / 2))))
TEST_ERROR
- if(NULL == (rdata1 = (int *)HDmalloc(sizeof(int) * BYPASS_DIM)))
+ if (NULL == (rdata1 = (int *)HDmalloc(sizeof(int) * BYPASS_DIM)))
TEST_ERROR
- if(NULL == (rdata2 = (int *)HDmalloc(sizeof(int) * (BYPASS_CHUNK_DIM / 2))))
+ if (NULL == (rdata2 = (int *)HDmalloc(sizeof(int) * (BYPASS_CHUNK_DIM / 2))))
TEST_ERROR
/* Initialize data to write for 1-D dataset */
- for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
+ for (i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
wdata[i] = i;
/* Initialize data to write for 2-D dataset */
- for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
- for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
+ for (i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
+ for (j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
t_wdata[i][j] = j;
/* Set up memory space for the 2-D dataset */
@@ -8418,125 +9106,149 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* Write to the first 1-D & 2-D datasets */
/* This write should go through the cache because fill value is used. */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0)
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0)
+ if (H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0)
FAIL_STACK_ERROR
/* Close the first 1-D & 2-D datasets */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(t_dsid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(t_dsid) < 0)
+ FAIL_STACK_ERROR
/* Reopen the first 1-D & 2-D datasets */
- if((dsid = H5Dopen2(fid, BYPASS_DATASET1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((t_dsid = H5Dopen2(fid, T_BYPASS_DATASET1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, BYPASS_DATASET1, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((t_dsid = H5Dopen2(fid, T_BYPASS_DATASET1, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Reads both 2 chunks. Reading the second chunk should bypass the cache because the
* chunk is bigger than the cache size and it isn't allocated on disk. */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata1) < 0)
+ if (H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata1) < 0)
FAIL_STACK_ERROR
- if(H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1_bytes) < 0)
+ if (H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1_bytes) < 0)
FAIL_STACK_ERROR
/* Verify data for the first 1-D dataset */
- for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
- if(rdata1[i] != i) {
+ for (i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
+ if (rdata1[i] != i) {
HDprintf(" Read different values than written in the 1st chunk.\n");
- HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i);
+ HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i],
+ i);
TEST_ERROR
} /* end if */
- for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++)
- if(rdata1[j] != fvalue) {
+ for (j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++)
+ if (rdata1[j] != fvalue) {
HDprintf(" Read different values than written in the 2nd chunk.\n");
- HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue);
+ HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i],
+ fvalue);
TEST_ERROR
} /* end if */
/* Verify data for the first 2-D dataset */
- for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
- for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
- if(t_rdata1[i][j] != j) {
- HDprintf(" Read different values than written in the 1st chunk.\n");
- HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n",
- __LINE__, i, j, t_rdata1[i][j], j);
- TEST_ERROR
- } /* end if */
+ for (i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
+ for (j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
+ if (t_rdata1[i][j] != j) {
+ HDprintf(" Read different values than written in the 1st chunk.\n");
+ HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i,
+ j, t_rdata1[i][j], j);
+ TEST_ERROR
+ } /* end if */
- for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++)
- for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++)
- if(t_rdata1[i][j] != fvalue) {
- HDprintf(" Read different values than written in the 2nd chunk.\n");
- HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n",
- __LINE__, i, j, t_rdata1[i][j], fvalue);
- TEST_ERROR
- } /* end if */
+ for (i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++)
+ for (j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++)
+ if (t_rdata1[i][j] != fvalue) {
+ HDprintf(" Read different values than written in the 2nd chunk.\n");
+ HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i,
+ j, t_rdata1[i][j], fvalue);
+ TEST_ERROR
+ } /* end if */
/* Close the first 1-D & 2-D datasets */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(t_dsid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(t_dsid) < 0)
+ FAIL_STACK_ERROR
/* Create a second dataset without fill value. This time, both write
* and read should bypass the cache because the chunk is bigger than the
* cache size and it's not allocated on disk. */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) FAIL_STACK_ERROR
- if(H5Pset_fill_time(t_dcpl, H5D_FILL_TIME_NEVER) < 0) FAIL_STACK_ERROR
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_fill_time(t_dcpl, H5D_FILL_TIME_NEVER) < 0)
+ FAIL_STACK_ERROR
/* Create a second 1-D & 2-D dataset */
- if((dsid = H5Dcreate2(fid, BYPASS_DATASET2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, BYPASS_DATASET2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((t_dsid = H5Dcreate2(fid, T_BYPASS_DATASET2, H5T_NATIVE_INT, t_sid, H5P_DEFAULT, t_dcpl, H5P_DEFAULT)) < 0)
+ if ((t_dsid =
+ H5Dcreate2(fid, T_BYPASS_DATASET2, H5T_NATIVE_INT, t_sid, H5P_DEFAULT, t_dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write to the second 1-D & 2-D dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0)
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0)
+ if (H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0)
FAIL_STACK_ERROR
/* Close the second 1-D & 2-D dataset */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(t_dsid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(t_dsid) < 0)
+ FAIL_STACK_ERROR
/* Reopen the second 1-d dataset and 2-d dataset */
- if((dsid = H5Dopen2(fid, BYPASS_DATASET2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((t_dsid = H5Dopen2(fid, T_BYPASS_DATASET2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, BYPASS_DATASET2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((t_dsid = H5Dopen2(fid, T_BYPASS_DATASET2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Read back only the part that was written to the file. Reading the
* half chunk should bypass the cache because the chunk is bigger than
* the cache size. */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0)
- FAIL_STACK_ERROR
- if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2_bytes) < 0)
- FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2_bytes) < 0)
+ FAIL_STACK_ERROR
/* Verify data for the second 1-D dataset */
- for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
- if(rdata2[i] != i) {
+ for (i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
+ if (rdata2[i] != i) {
HDprintf(" Read different values than written in the chunk.\n");
- HDprintf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i);
+ HDprintf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i],
+ i);
TEST_ERROR
} /* end if */
/* Verify data for the second 2-D dataset */
- for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
- for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
- if(t_rdata2[i][j] != j) {
- HDprintf(" Read different values than written in the chunk.\n");
- HDprintf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n",
- __LINE__, i, j, t_rdata2[i][j], j);
- TEST_ERROR
- } /* end if */
+ for (i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
+ for (j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
+ if (t_rdata2[i][j] != j) {
+ HDprintf(" Read different values than written in the chunk.\n");
+ HDprintf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", __LINE__, i,
+ j, t_rdata2[i][j], j);
+ TEST_ERROR
+ } /* end if */
/* Close IDs */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(t_sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(t_dsid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(t_dcpl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(fapl_local) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(t_sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(t_dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(t_dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(fapl_local) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Release buffers */
HDfree(wdata);
@@ -8553,7 +9265,8 @@ test_big_chunks_bypass_cache(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(t_dcpl);
H5Pclose(fapl_local);
@@ -8562,7 +9275,8 @@ error:
H5Sclose(sid);
H5Sclose(t_sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(wdata);
HDfree(rdata1);
@@ -8577,7 +9291,6 @@ error:
return FAIL;
} /* end test_big_chunks_bypass_cache() */
-
/*-------------------------------------------------------------------------
* Function: test_chunk_fast
*
@@ -8594,43 +9307,48 @@ error:
static herr_t
test_chunk_fast(const char *env_h5_driver, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t my_fapl = -1; /* File access property list ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t scalar_sid = -1;/* Scalar dataspace ID */
- hid_t dsid = -1; /* Dataset ID */
- hsize_t fill; /* Temporary value, for filling arrays */
- hsize_t hs_size[EARRAY_MAX_RANK]; /* Hyperslab size */
- hsize_t chunk_dim[EARRAY_MAX_RANK]; /* Chunk dimensions */
- H5F_libver_t low; /* File format low bound */
- unsigned swmr; /* Whether file should be written with SWMR access enabled */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t my_fapl = -1; /* File access property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t scalar_sid = -1; /* Scalar dataspace ID */
+ hid_t dsid = -1; /* Dataset ID */
+ hsize_t fill; /* Temporary value, for filling arrays */
+ hsize_t hs_size[EARRAY_MAX_RANK]; /* Hyperslab size */
+ hsize_t chunk_dim[EARRAY_MAX_RANK]; /* Chunk dimensions */
+ H5F_libver_t low; /* File format low bound */
+ unsigned swmr; /* Whether file should be written with SWMR access enabled */
TESTING("datasets w/extensible array as chunk index");
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Copy the file access property list */
- if((my_fapl = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+ if ((my_fapl = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
- /* Turn on the chunk cache again */
- {
- int mdc_nelmts; /* # of elements in metadata cache */
- size_t rdcc_nelmts; /* # of chunks in chunk cache */
- size_t rdcc_nbytes; /* # of bytes in chunk cache */
- double rdcc_w0; /* write-ratio for chunk cache */
+ /* Turn on the chunk cache again */
+ {
+ int mdc_nelmts; /* # of elements in metadata cache */
+ size_t rdcc_nelmts; /* # of chunks in chunk cache */
+ size_t rdcc_nbytes; /* # of bytes in chunk cache */
+ double rdcc_w0; /* write-ratio for chunk cache */
- if(H5Pget_cache(my_fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) FAIL_STACK_ERROR
- rdcc_nbytes = 1048576;
- if(H5Pset_cache(my_fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) FAIL_STACK_ERROR
- } /* end block */
+ if (H5Pget_cache(my_fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
+ FAIL_STACK_ERROR
+ rdcc_nbytes = 1048576;
+ if (H5Pset_cache(my_fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
+ FAIL_STACK_ERROR
+ } /* end block */
/* Check if we are using the latest version of the format */
- if(H5Pget_libver_bounds(my_fapl, &low, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Pget_libver_bounds(my_fapl, &low, NULL) < 0)
+ FAIL_STACK_ERROR
/* Create scalar dataspace */
- if((scalar_sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
+ if ((scalar_sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
/* Initialize chunk dimensions */
fill = EARRAY_CHUNK_DIM;
@@ -8641,8 +9359,8 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
H5VM_array_fill(hs_size, &fill, sizeof(fill), EARRAY_MAX_RANK);
/* Loop over using SWMR access to write */
- for(swmr = 0; swmr <= 1; swmr++) {
- int compress; /* Whether chunks should be compressed */
+ for (swmr = 0; swmr <= 1; swmr++) {
+ int compress; /* Whether chunks should be compressed */
/* SWMR is now supported with/without latest format: */
/* (1) write+latest-format (2) SWMR-write+non-latest-format */
@@ -8650,59 +9368,67 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
/* Skip this iteration if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
- if(swmr && !H5FD__supports_swmr_test(env_h5_driver))
+ if (swmr && !H5FD__supports_swmr_test(env_h5_driver))
continue;
#ifdef H5_HAVE_FILTER_DEFLATE
/* Loop over compressing chunks */
- for(compress = 0; compress <= 1; compress++)
+ for (compress = 0; compress <= 1; compress++)
#else
/* Loop over without compression */
- for(compress = 0; compress <= 0; compress++)
+ for (compress = 0; compress <= 0; compress++)
#endif /* H5_HAVE_FILTER_DEFLATE */
{
- H5D_alloc_time_t alloc_time; /* Storage allocation time */
+ H5D_alloc_time_t alloc_time; /* Storage allocation time */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
- unsigned ndims; /* Current # of dims to test */
+ for (alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ unsigned ndims; /* Current # of dims to test */
/* Loop over dataspace ranks to test */
- for(ndims = 1; ndims < (EARRAY_MAX_RANK + 1); ndims++) {
+ for (ndims = 1; ndims < (EARRAY_MAX_RANK + 1); ndims++) {
unsigned unlim_dim;
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set chunking & chunk dims */
- if(H5Pset_chunk(dcpl, (int)ndims, chunk_dim) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, (int)ndims, chunk_dim) < 0)
+ FAIL_STACK_ERROR
#ifdef H5_HAVE_FILTER_DEFLATE
/* Check if we should compress the chunks */
- if(compress)
- if(H5Pset_deflate(dcpl, 9) < 0) FAIL_STACK_ERROR
+ if (compress)
+ if (H5Pset_deflate(dcpl, 9) < 0)
+ FAIL_STACK_ERROR
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Set fill time */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ FAIL_STACK_ERROR
/* Set allocation time */
- if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(dcpl, alloc_time) < 0)
+ FAIL_STACK_ERROR
/* Loop over which dimension is unlimited */
- for(unlim_dim = 0; unlim_dim < ndims; unlim_dim++) {
- H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ for (unlim_dim = 0; unlim_dim < ndims; unlim_dim++) {
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
hsize_t dim[EARRAY_MAX_RANK], max_dim[EARRAY_MAX_RANK]; /* Dataset dimensions */
- hsize_t swizzled_dim[EARRAY_MAX_RANK]; /* Dimensions, with unlimited dimension moved to rank 0 */
- hsize_t down[EARRAY_MAX_RANK]; /* 'down' sizes, for computing array index */
- hsize_t hs_offset[EARRAY_MAX_RANK]; /* Hyperslab offset */
- hssize_t snpoints; /* # of points in dataspace extent (signed) */
- hsize_t npoints; /* # of points in dataspace extent */
- unsigned write_elem, read_elem; /* Element written/read */
- hsize_t u; /* Local index variable */
+ hsize_t swizzled_dim[EARRAY_MAX_RANK]; /* Dimensions, with unlimited dimension moved
+ to rank 0 */
+ hsize_t down[EARRAY_MAX_RANK]; /* 'down' sizes, for computing array index */
+ hsize_t hs_offset[EARRAY_MAX_RANK]; /* Hyperslab offset */
+ hssize_t snpoints; /* # of points in dataspace extent (signed) */
+ hsize_t npoints; /* # of points in dataspace extent */
+ unsigned write_elem, read_elem; /* Element written/read */
+ hsize_t u; /* Local index variable */
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (swmr ? H5F_ACC_SWMR_WRITE : 0), H5P_DEFAULT, my_fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (swmr ? H5F_ACC_SWMR_WRITE : 0),
+ H5P_DEFAULT, my_fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create n-D dataspace */
fill = EARRAY_DSET_DIM;
@@ -8710,112 +9436,143 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
fill = EARRAY_DSET_DIM;
H5VM_array_fill(max_dim, &fill, sizeof(fill), EARRAY_MAX_RANK);
max_dim[unlim_dim] = H5S_UNLIMITED;
- fill = EARRAY_DSET_DIM;
+ fill = EARRAY_DSET_DIM;
H5VM_array_fill(swizzled_dim, &fill, sizeof(fill), EARRAY_MAX_RANK);
- if((sid = H5Screate_simple((int)ndims, dim, max_dim)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple((int)ndims, dim, max_dim)) < 0)
+ FAIL_STACK_ERROR
/* Get the number of points in the dataspace */
- if((snpoints = H5Sget_simple_extent_npoints(sid)) < 0) FAIL_STACK_ERROR
+ if ((snpoints = H5Sget_simple_extent_npoints(sid)) < 0)
+ FAIL_STACK_ERROR
npoints = (hsize_t)snpoints;
/* Compute the "down" dimension values */
- if(H5VM_array_down(ndims, dim, down) < 0) FAIL_STACK_ERROR
+ if (H5VM_array_down(ndims, dim, down) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(dsid, &idx_type) < 0)
+ FAIL_STACK_ERROR
- /* Chunk index type expected depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST || swmr) {
+ /* Chunk index type expected depends on whether we are using the latest version of the
+ * format */
+ if (low == H5F_LIBVER_LATEST || swmr) {
/* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("should be using extensible array as index");
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("should be using extensible array as index");
} /* end if */
else {
/* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
} /* end else */
/* Fill existing elements */
- for(u = 0; u < npoints; u++) {
+ for (u = 0; u < npoints; u++) {
/* Compute the coordinate from the linear offset */
- if(H5VM_array_calc_pre(u, ndims, down, hs_offset) < 0) FAIL_STACK_ERROR
+ if (H5VM_array_calc_pre(u, ndims, down, hs_offset) < 0)
+ FAIL_STACK_ERROR
/* Un-swizzle hyperslab offset in same way as swizzled dimensions */
H5VM_unswizzle_coords(hsize_t, hs_offset, unlim_dim);
/* Select a single element in the dataset */
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
+ FAIL_STACK_ERROR
/* Read (unwritten) element from dataset */
read_elem = 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
/* Verify unwritten element is fill value (0) */
- if(read_elem != 0) FAIL_PUTS_ERROR("invalid unwritten element read");
+ if (read_elem != 0)
+ FAIL_PUTS_ERROR("invalid unwritten element read");
/* Write element to dataset */
write_elem = (unsigned)u;
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) <
+ 0)
+ FAIL_STACK_ERROR
/* Read element from dataset */
read_elem = write_elem + 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
/* Verify written element is read in */
- if(read_elem != write_elem) FAIL_PUTS_ERROR("invalid written element read");
+ if (read_elem != write_elem)
+ FAIL_PUTS_ERROR("invalid written element read");
} /* end for */
/* Incrementally extend dataset and verify write/reads */
- while(dim[unlim_dim] < EARRAY_MAX_EXTEND) {
- hssize_t snew_npoints; /* # of points in dataspace extent (signed) */
- hsize_t new_npoints; /* # of points in dataspace extent */
+ while (dim[unlim_dim] < EARRAY_MAX_EXTEND) {
+ hssize_t snew_npoints; /* # of points in dataspace extent (signed) */
+ hsize_t new_npoints; /* # of points in dataspace extent */
/* Extend dataset */
dim[unlim_dim] += EARRAY_EXTEND_INCR;
swizzled_dim[0] += EARRAY_EXTEND_INCR;
- if(H5Dset_extent(dsid, dim) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, dim) < 0)
+ FAIL_STACK_ERROR
/* Close old dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
/* Get dataspace for dataset now */
- if((sid = H5Dget_space(dsid)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Dget_space(dsid)) < 0)
+ FAIL_STACK_ERROR
/* Get the new number of points in the dataspace */
- if((snew_npoints = H5Sget_simple_extent_npoints(sid)) < 0) FAIL_STACK_ERROR
+ if ((snew_npoints = H5Sget_simple_extent_npoints(sid)) < 0)
+ FAIL_STACK_ERROR
new_npoints = (hsize_t)snew_npoints;
/* Fill new elements */
- for(u = npoints; u < new_npoints; u++) {
+ for (u = npoints; u < new_npoints; u++) {
/* Compute the coordinate from the linear offset */
- if(H5VM_array_calc(u, ndims, swizzled_dim, hs_offset) < 0) FAIL_STACK_ERROR
+ if (H5VM_array_calc(u, ndims, swizzled_dim, hs_offset) < 0)
+ FAIL_STACK_ERROR
/* Un-swizzle hyperslab offset in same way as swizzled dimensions */
H5VM_unswizzle_coords(hsize_t, hs_offset, unlim_dim);
/* Select a single element in the dataset */
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) <
+ 0)
+ FAIL_STACK_ERROR
/* Read (unwritten) element from dataset */
read_elem = 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) <
+ 0)
+ FAIL_STACK_ERROR
/* Verify unwritten element is fill value (0) */
- if(read_elem != 0) FAIL_PUTS_ERROR("invalid unwritten element read");
+ if (read_elem != 0)
+ FAIL_PUTS_ERROR("invalid unwritten element read");
/* Write element to dataset */
write_elem = (unsigned)u;
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT,
+ &write_elem) < 0)
+ FAIL_STACK_ERROR
/* Read element from dataset */
read_elem = write_elem + 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) <
+ 0)
+ FAIL_STACK_ERROR
/* Verify written element is read in */
- if(read_elem != write_elem) FAIL_PUTS_ERROR("invalid written element read");
+ if (read_elem != write_elem)
+ FAIL_PUTS_ERROR("invalid written element read");
} /* end for */
/* Update the number of points in the dataspace */
@@ -8823,108 +9580,134 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
} /* end while */
/* Close everything */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Re-open file & dataset */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | (swmr ? H5F_ACC_SWMR_READ : 0), my_fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | (swmr ? H5F_ACC_SWMR_READ : 0),
+ my_fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open dataset */
- if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(dsid, &idx_type) < 0)
+ FAIL_STACK_ERROR
- /* Chunk index tyepe expected depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST || swmr) {
+ /* Chunk index tyepe expected depends on whether we are using the latest version of
+ * the format */
+ if (low == H5F_LIBVER_LATEST || swmr) {
/* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("should be using extensible array as index");
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("should be using extensible array as index");
} /* end if */
else {
/* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
} /* end else */
/* Get dataspace for dataset now */
- if((sid = H5Dget_space(dsid)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Dget_space(dsid)) < 0)
+ FAIL_STACK_ERROR
/* Get the number of points in the dataspace */
- if((snpoints = H5Sget_simple_extent_npoints(sid)) < 0) FAIL_STACK_ERROR
+ if ((snpoints = H5Sget_simple_extent_npoints(sid)) < 0)
+ FAIL_STACK_ERROR
npoints = (hsize_t)snpoints;
/* Get the current dimensions into swizzled_dim array */
- if(H5Sget_simple_extent_dims(sid, swizzled_dim, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Sget_simple_extent_dims(sid, swizzled_dim, NULL) < 0)
+ FAIL_STACK_ERROR
/* Generate the swizzled dimensions */
H5VM_swizzle_coords(hsize_t, swizzled_dim, unlim_dim);
/* Compute the "down" dimension values */
- if(H5VM_array_down(ndims, swizzled_dim, down) < 0) FAIL_STACK_ERROR
+ if (H5VM_array_down(ndims, swizzled_dim, down) < 0)
+ FAIL_STACK_ERROR
/* Read elements */
- for(u = 0; u < npoints; u++) {
+ for (u = 0; u < npoints; u++) {
/* Compute the coordinate from the linear offset */
- if(H5VM_array_calc_pre(u, ndims, down, hs_offset) < 0) FAIL_STACK_ERROR
+ if (H5VM_array_calc_pre(u, ndims, down, hs_offset) < 0)
+ FAIL_STACK_ERROR
/* Unswizzle hyperslab offset in same way as swizzled dimensions */
H5VM_unswizzle_coords(hsize_t, hs_offset, unlim_dim);
/* Select a single element in the dataset */
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
+ FAIL_STACK_ERROR
/* Read written element from dataset */
read_elem = (unsigned)(u + 1);
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
/* Verify written element is correct */
- if(read_elem != u) FAIL_PUTS_ERROR("invalid element read");
+ if (read_elem != u)
+ FAIL_PUTS_ERROR("invalid element read");
} /* end for */
/* Close everything */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Re-open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, my_fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, my_fapl)) < 0)
+ FAIL_STACK_ERROR
/* Delete dataset */
- if(H5Ldelete(fid, "dset", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "dset", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close everything */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close everything */
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
} /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Close everything */
- if(H5Sclose(scalar_sid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(my_fapl) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(scalar_sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(my_fapl) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Sclose(scalar_sid);
H5Fclose(fid);
H5Pclose(my_fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_chunk_fast() */
-
/*-------------------------------------------------------------------------
* Function: test_reopen_chunk_fast
*
@@ -8946,90 +9729,104 @@ error:
static herr_t
test_reopen_chunk_fast(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t scalar_sid = -1;/* Scalar dataspace ID */
- hid_t dsid = -1; /* Dataset ID */
- hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */
- hsize_t hs_offset; /* Hyperslab offset */
- hsize_t hs_size; /* Hyperslab size */
- H5D_alloc_time_t alloc_time; /* Storage allocation time */
- unsigned write_elem, read_elem; /* Element written/read */
- unsigned u; /* Local index variable */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t scalar_sid = -1; /* Scalar dataspace ID */
+ hid_t dsid = -1; /* Dataset ID */
+ hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */
+ hsize_t hs_offset; /* Hyperslab offset */
+ hsize_t hs_size; /* Hyperslab size */
+ H5D_alloc_time_t alloc_time; /* Storage allocation time */
+ unsigned write_elem, read_elem; /* Element written/read */
+ unsigned u; /* Local index variable */
TESTING("datasets w/extensible array open/reopen with read/write");
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
- /* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ for (alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ /* Create file */
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- /* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ /* Create dataset creation property list */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* Set chunking */
- chunk_dim = 10;
- if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR
+ /* Set chunking */
+ chunk_dim = 10;
+ if (H5Pset_chunk(dcpl, 1, &chunk_dim) < 0)
+ FAIL_STACK_ERROR
- /* Set fill time */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR
+ /* Set fill time */
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ FAIL_STACK_ERROR
- /* Set allocation time */
- if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR
+ /* Set allocation time */
+ if (H5Pset_alloc_time(dcpl, alloc_time) < 0)
+ FAIL_STACK_ERROR
- /* Create scalar dataspace */
- if((scalar_sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
+ /* Create scalar dataspace */
+ if ((scalar_sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
- /* Create 1-D dataspace */
- dim = 100;
- max_dim = H5S_UNLIMITED;
- if((sid = H5Screate_simple(1, &dim, &max_dim)) < 0) FAIL_STACK_ERROR
+ /* Create 1-D dataspace */
+ dim = 100;
+ max_dim = H5S_UNLIMITED;
+ if ((sid = H5Screate_simple(1, &dim, &max_dim)) < 0)
+ FAIL_STACK_ERROR
- /* Create chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ /* Create chunked dataset */
+ if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- /* Fill existing elements */
- hs_size = 1;
- for(u = 0; u < 100; u++) {
- /* Select a single element in the dataset */
- hs_offset = u;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0)
- FAIL_STACK_ERROR
- /* Write element to dataset */
- write_elem = u;
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0)
- FAIL_STACK_ERROR
- } /* end for */
+ /* Fill existing elements */
+ hs_size = 1;
+ for (u = 0; u < 100; u++) {
+ /* Select a single element in the dataset */
+ hs_offset = u;
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0)
+ FAIL_STACK_ERROR
+ /* Write element to dataset */
+ write_elem = u;
+ if (H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
- /* Close everything */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ /* Close everything */
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
- /* Reopen the dataset */
- if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Reopen the dataset */
+ if ((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
hs_size = 1;
- /* Read from dataset */
- for(u = 0; u < 100; u++) {
- /* Select a single element in the dataset */
- hs_offset = u;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0)
- FAIL_STACK_ERROR
+ /* Read from dataset */
+ for (u = 0; u < 100; u++) {
+ /* Select a single element in the dataset */
+ hs_offset = u;
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0)
+ FAIL_STACK_ERROR
- /* Read element from dataset */
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
- FAIL_STACK_ERROR
- } /* end for */
+ /* Read element from dataset */
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(scalar_sid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(scalar_sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
} /* end for */
@@ -9037,17 +9834,18 @@ test_reopen_chunk_fast(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Sclose(scalar_sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_reopen_chunk_fast() */
-
/*-------------------------------------------------------------------------
* Function: test_chunk_fast_bug1
*
@@ -9068,99 +9866,110 @@ error:
static herr_t
test_chunk_fast_bug1(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dsid = -1; /* Dataset ID */
- hsize_t dim[2], max_dim[2], chunk_dim[2]; /* Dataset and chunk dimensions */
- H5D_alloc_time_t alloc_time; /* Storage allocation time */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dsid = -1; /* Dataset ID */
+ hsize_t dim[2], max_dim[2], chunk_dim[2]; /* Dataset and chunk dimensions */
+ H5D_alloc_time_t alloc_time; /* Storage allocation time */
- unsigned **wbuf = NULL;
- unsigned **rbuf = NULL;
- unsigned *wbuf_bytes = NULL;
- unsigned *rbuf_bytes = NULL;
+ unsigned **wbuf = NULL;
+ unsigned **rbuf = NULL;
+ unsigned * wbuf_bytes = NULL;
+ unsigned * rbuf_bytes = NULL;
- unsigned i, j; /* Local index variables */
+ unsigned i, j; /* Local index variables */
TESTING("datasets w/extensible array chunk indexing bug");
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Set up data array */
- if(NULL == (wbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned))))
+ if (NULL == (wbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned))))
TEST_ERROR;
- if(NULL == (wbuf = (unsigned **)HDcalloc(40, sizeof(wbuf_bytes))))
+ if (NULL == (wbuf = (unsigned **)HDcalloc(40, sizeof(wbuf_bytes))))
TEST_ERROR;
for (i = 0; i < 40; i++)
wbuf[i] = wbuf_bytes + (i * 20);
- if(NULL == (rbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned))))
+ if (NULL == (rbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned))))
TEST_ERROR;
- if(NULL == (rbuf = (unsigned **)HDcalloc(40, sizeof(rbuf_bytes))))
+ if (NULL == (rbuf = (unsigned **)HDcalloc(40, sizeof(rbuf_bytes))))
TEST_ERROR;
for (i = 0; i < 40; i++)
rbuf[i] = rbuf_bytes + (i * 20);
/* Initialize write buffer */
- for(i=0; i<40; i++)
- for(j=0; j<20; j++)
+ for (i = 0; i < 40; i++)
+ for (j = 0; j < 20; j++)
wbuf[i][j] = (i * 20) + j;
/* Create 2-D dataspace */
- dim[0] = 40;
- dim[1] = 20;
+ dim[0] = 40;
+ dim[1] = 20;
max_dim[0] = 40;
max_dim[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dim, max_dim)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(2, dim, max_dim)) < 0)
+ FAIL_STACK_ERROR
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for (alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set chunking */
chunk_dim[0] = 20;
chunk_dim[1] = 10;
- if(H5Pset_chunk(dcpl, 2, chunk_dim) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 2, chunk_dim) < 0)
+ FAIL_STACK_ERROR
/* Set allocation time */
- if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(dcpl, alloc_time) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write buffer to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, wbuf_bytes) < 0)
+ if (H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, wbuf_bytes) < 0)
FAIL_STACK_ERROR
/* Close everything */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Reopen the dataset */
- if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Read from dataset */
- if(H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, rbuf_bytes) < 0)
+ if (H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, rbuf_bytes) < 0)
FAIL_STACK_ERROR
/* Verify read data */
- for(i=0; i<40; i++)
- for(j=0; j<20; j++)
- if(wbuf[i][j] != rbuf[i][j])
+ for (i = 0; i < 40; i++)
+ for (j = 0; j < 20; j++)
+ if (wbuf[i][j] != rbuf[i][j])
FAIL_PUTS_ERROR("invalid element read");
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
} /* end for */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
HDfree(wbuf);
HDfree(rbuf);
@@ -9171,12 +9980,14 @@ test_chunk_fast_bug1(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(wbuf);
HDfree(rbuf);
@@ -9188,19 +9999,18 @@ error:
/* This message derives from H5Z */
const H5Z_class2_t H5Z_EXPAND[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_EXPAND, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "expand", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_expand, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_EXPAND, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "expand", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_expand, /* The actual filter function */
}};
/* Global "expansion factor" for filter_expand() routine */
static size_t filter_expand_factor_g = 0;
-
/*-------------------------------------------------------------------------
* Function: filter_expand
*
@@ -9222,19 +10032,19 @@ static size_t filter_expand_factor_g = 0;
*/
static size_t
filter_expand(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t *buf_size, void H5_ATTR_UNUSED **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t *buf_size,
+ void H5_ATTR_UNUSED **buf)
{
- size_t ret_value = 0;
+ size_t ret_value = 0;
- if(flags & H5Z_FLAG_REVERSE) {
+ if (flags & H5Z_FLAG_REVERSE) {
/* Don't do anything when filter is applied in reverse */
*buf_size = nbytes;
ret_value = nbytes;
} /* end if */
else {
/* Check for expanding the chunk */
- if(filter_expand_factor_g > 0) {
+ if (filter_expand_factor_g > 0) {
/* Expand the buffer size beyond what can be encoded */
*buf_size = nbytes * 256 * 256 * 256 * filter_expand_factor_g;
ret_value = *buf_size;
@@ -9244,12 +10054,11 @@ filter_expand(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
*buf_size = nbytes;
ret_value = nbytes;
} /* end else */
- } /* end else */
+ } /* end else */
return ret_value;
} /* end filter_expand() */
-
/*-------------------------------------------------------------------------
* Function: test_chunk_expand
*
@@ -9267,364 +10076,495 @@ filter_expand(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
static herr_t
test_chunk_expand(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list ID */
- hid_t sid = -1, sid2 = -1; /* Dataspace ID */
- hid_t scalar_sid = -1; /* Scalar dataspace ID */
- hid_t dsid = -1, dsid2 = -1; /* Dataset ID */
- hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */
- hsize_t dim2[2], max_dim2[2], chunk_dim2[2]; /* Dataset and chunk dimensions */
- H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index type */
- H5F_libver_t low, high; /* File format bounds */
- hsize_t hs_offset, hs_offset2[2]; /* Hyperslab offset */
- hsize_t hs_size, hs_size2[2]; /* Hyperslab size */
- H5D_alloc_time_t alloc_time; /* Storage allocation time */
- unsigned write_elem, read_elem; /* Element written/read */
- unsigned write_elem2, read_elem2; /* Element written/read */
- unsigned u; /* Local index variable */
- herr_t status; /* Generic return value */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list ID */
+ hid_t sid = -1, sid2 = -1; /* Dataspace ID */
+ hid_t scalar_sid = -1; /* Scalar dataspace ID */
+ hid_t dsid = -1, dsid2 = -1; /* Dataset ID */
+ hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */
+ hsize_t dim2[2], max_dim2[2], chunk_dim2[2]; /* Dataset and chunk dimensions */
+ H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index type */
+ H5F_libver_t low, high; /* File format bounds */
+ hsize_t hs_offset, hs_offset2[2]; /* Hyperslab offset */
+ hsize_t hs_size, hs_size2[2]; /* Hyperslab size */
+ H5D_alloc_time_t alloc_time; /* Storage allocation time */
+ unsigned write_elem, read_elem; /* Element written/read */
+ unsigned write_elem2, read_elem2; /* Element written/read */
+ unsigned u; /* Local index variable */
+ herr_t status; /* Generic return value */
TESTING("filter expanding chunks too much");
h5_fixname(FILENAME[11], fapl, filename, sizeof filename);
/* Check if we are using the latest version of the format */
- if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR
+ if (H5Pget_libver_bounds(fapl, &low, &high) < 0)
+ FAIL_STACK_ERROR
- if(sizeof(size_t) <= 4 && low != H5F_LIBVER_LATEST) {
- SKIPPED();
- HDputs(" Current machine can't test for error w/old file format");
+ if (sizeof(size_t) <= 4 && low != H5F_LIBVER_LATEST) {
+ SKIPPED();
+ HDputs(" Current machine can't test for error w/old file format");
} /* end if */
else {
/* Register "expansion" filter */
- if(H5Zregister(H5Z_EXPAND) < 0) FAIL_STACK_ERROR
+ if (H5Zregister(H5Z_EXPAND) < 0)
+ FAIL_STACK_ERROR
/* Check that the filter was registered */
- if(TRUE != H5Zfilter_avail(H5Z_FILTER_EXPAND)) FAIL_STACK_ERROR
+ if (TRUE != H5Zfilter_avail(H5Z_FILTER_EXPAND))
+ FAIL_STACK_ERROR
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for (alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
- if((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set chunking */
chunk_dim = chunk_dim2[0] = chunk_dim2[1] = 10;
- if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl2, 2, chunk_dim2) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 1, &chunk_dim) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl2, 2, chunk_dim2) < 0)
+ FAIL_STACK_ERROR
/* Set fill time */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR
- if(H5Pset_fill_time(dcpl2, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_fill_time(dcpl2, H5D_FILL_TIME_ALLOC) < 0)
+ FAIL_STACK_ERROR
/* Set allocation time */
- if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR
- if(H5Pset_alloc_time(dcpl2, alloc_time) < 0) FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(dcpl, alloc_time) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(dcpl2, alloc_time) < 0)
+ FAIL_STACK_ERROR
/* Set "expand" filter */
- if(H5Pset_filter(dcpl, H5Z_FILTER_EXPAND, 0, (size_t)0, NULL) < 0) FAIL_STACK_ERROR
- if(H5Pset_filter(dcpl2, H5Z_FILTER_EXPAND, 0, (size_t)0, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Pset_filter(dcpl, H5Z_FILTER_EXPAND, 0, (size_t)0, NULL) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_filter(dcpl2, H5Z_FILTER_EXPAND, 0, (size_t)0, NULL) < 0)
+ FAIL_STACK_ERROR
/* Create scalar dataspace */
- if((scalar_sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
+ if ((scalar_sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
/* Create 1-D and 2-D dataspace */
dim = dim2[0] = dim2[1] = 100;
- max_dim = max_dim2[0] = max_dim2[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(1, &dim, &max_dim)) < 0) FAIL_STACK_ERROR
- if((sid2 = H5Screate_simple(2, dim2, max_dim2)) < 0) FAIL_STACK_ERROR
+ max_dim = max_dim2[0] = max_dim2[1] = H5S_UNLIMITED;
+ if ((sid = H5Screate_simple(1, &dim, &max_dim)) < 0)
+ FAIL_STACK_ERROR
+ if ((sid2 = H5Screate_simple(2, dim2, max_dim2)) < 0)
+ FAIL_STACK_ERROR
/* Create 1-D & 2-D chunked datasets */
- if(H5D_ALLOC_TIME_EARLY == alloc_time) {
+ if (H5D_ALLOC_TIME_EARLY == alloc_time) {
/* Make the expansion factor large enough to cause failure right away */
filter_expand_factor_g = 8;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dsid >= 0) FAIL_PUTS_ERROR("should fail to create dataset when allocation time is early");
+ }
+ H5E_END_TRY;
+ if (dsid >= 0)
+ FAIL_PUTS_ERROR("should fail to create dataset when allocation time is early");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dsid2 = H5Dcreate2(fid, "dset2", H5T_NATIVE_UINT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dsid2 >= 0) FAIL_PUTS_ERROR("should fail to create dataset when allocation time is early");
+ }
+ H5E_END_TRY;
+ if (dsid2 >= 0)
+ FAIL_PUTS_ERROR("should fail to create dataset when allocation time is early");
} /* end if */
else {
- if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) <
+ 0)
FAIL_STACK_ERROR
- if((dsid2 = H5Dcreate2(fid, "dset2", H5T_NATIVE_UINT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
+ if ((dsid2 = H5Dcreate2(fid, "dset2", H5T_NATIVE_UINT, sid2, H5P_DEFAULT, dcpl2,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR
- if(H5D__layout_idx_type_test(dsid2, &idx_type2) < 0) FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(dsid, &idx_type) < 0)
+ FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(dsid2, &idx_type2) < 0)
+ FAIL_STACK_ERROR
- /* Chunk index type expected depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
+ /* Chunk index type expected depends on whether we are using the latest version of the format
+ */
+ if (low == H5F_LIBVER_LATEST) {
/* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("should be using extensible array as index");
- if(idx_type2 != H5D_CHUNK_IDX_BT2) FAIL_PUTS_ERROR("should be using v2 B-tree as index");
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("should be using extensible array as index");
+ if (idx_type2 != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("should be using v2 B-tree as index");
} /* end if */
else {
/* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index");
- if(idx_type2 != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (idx_type2 != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
} /* end else */
/* Fill elements */
hs_size = hs_size2[0] = hs_size2[1] = 1;
- for(u = 0; u < 100; u++) {
+ for (u = 0; u < 100; u++) {
hs_offset = hs_offset2[0] = hs_offset2[1] = u;
/* Select a single element in the 1-D dataset */
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0)
+ FAIL_STACK_ERROR
/* Select a single element in the 2-D dataset; NOT every element is selected */
- if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0)
+ FAIL_STACK_ERROR
/* Read (unwritten) element from dataset */
read_elem = read_elem2 = 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
- if(H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0)
+ FAIL_STACK_ERROR
/* Verify unwritten element is fill value (0) */
- if(read_elem != 0) FAIL_PUTS_ERROR("invalid unwritten element read");
- if(read_elem2 != 0) FAIL_PUTS_ERROR("invalid unwritten element read");
+ if (read_elem != 0)
+ FAIL_PUTS_ERROR("invalid unwritten element read");
+ if (read_elem2 != 0)
+ FAIL_PUTS_ERROR("invalid unwritten element read");
/* Don't expand chunks yet */
filter_expand_factor_g = 0;
/* Write element to the datasets */
write_elem = write_elem2 = u;
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) FAIL_STACK_ERROR
- if(H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2) < 0)
+ FAIL_STACK_ERROR
/* Read element from the datasets */
- read_elem = write_elem + 1;
+ read_elem = write_elem + 1;
read_elem2 = write_elem2 + 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
- if(H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0)
+ FAIL_STACK_ERROR
/* Verify written element is read in */
- if(read_elem != write_elem) FAIL_PUTS_ERROR("invalid written element read");
- if(read_elem2 != write_elem2) FAIL_PUTS_ERROR("invalid written element read");
+ if (read_elem != write_elem)
+ FAIL_PUTS_ERROR("invalid written element read");
+ if (read_elem2 != write_elem2)
+ FAIL_PUTS_ERROR("invalid written element read");
/* Expand chunks now */
filter_expand_factor_g = 8;
/* Write element to the datasets */
write_elem = write_elem2 = u;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
status = H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem);
- } H5E_END_TRY;
- if(status >= 0) FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
-
- H5E_BEGIN_TRY {
- status = H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2);
- } H5E_END_TRY;
- if(status >= 0) FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
+ }
+ H5E_END_TRY;
+ if (status >= 0)
+ FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
+
+ H5E_BEGIN_TRY
+ {
+ status =
+ H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2);
+ }
+ H5E_END_TRY;
+ if (status >= 0)
+ FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
} /* end for */
/* Incrementally extend dataset and verify write/reads */
- while(dim < 1000) {
+ while (dim < 1000) {
/* Extend the datasets */
dim += 100;
dim2[0] += 100;
dim2[1] += 100;
- if(H5Dset_extent(dsid, &dim) < 0) FAIL_STACK_ERROR
- if(H5Dset_extent(dsid2, dim2) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, &dim) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid2, dim2) < 0)
+ FAIL_STACK_ERROR
/* Close old dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid2) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR
/* Get dataspace for the datasets now */
- if((sid = H5Dget_space(dsid)) < 0) FAIL_STACK_ERROR
- if((sid2 = H5Dget_space(dsid2)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Dget_space(dsid)) < 0)
+ FAIL_STACK_ERROR
+ if ((sid2 = H5Dget_space(dsid2)) < 0)
+ FAIL_STACK_ERROR
/* Fill new elements */
hs_size = hs_size2[0] = hs_size2[1] = 1;
- for(u = 0; u < 100; u++) {
+ for (u = 0; u < 100; u++) {
/* Select a single element in the datasets */
- hs_offset = (dim + u) - 100;
+ hs_offset = (dim + u) - 100;
hs_offset2[0] = (dim2[0] + u) - 100;
hs_offset2[1] = (dim2[1] + u) - 100;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) FAIL_STACK_ERROR
- if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0)
+ FAIL_STACK_ERROR
/* Read (unwritten) element from the datasets */
read_elem = read_elem2 = 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
- if(H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0)
+ FAIL_STACK_ERROR
/* Verify unwritten element is fill value (0) */
- if(read_elem != 0) FAIL_PUTS_ERROR("invalid unwritten element read");
- if(read_elem2 != 0) FAIL_PUTS_ERROR("invalid unwritten element read");
+ if (read_elem != 0)
+ FAIL_PUTS_ERROR("invalid unwritten element read");
+ if (read_elem2 != 0)
+ FAIL_PUTS_ERROR("invalid unwritten element read");
/* Don't expand chunks yet */
filter_expand_factor_g = 0;
/* Write element to the datasets */
write_elem = write_elem2 = u;
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) FAIL_STACK_ERROR
- if(H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2) < 0)
+ FAIL_STACK_ERROR
/* Read element from the datasets */
- read_elem = write_elem + 1;
+ read_elem = write_elem + 1;
read_elem2 = write_elem2 + 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
- if(H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0)
+ FAIL_STACK_ERROR
/* Verify written element is read in */
- if(read_elem != write_elem) FAIL_PUTS_ERROR("invalid written element read");
- if(read_elem2 != write_elem2) FAIL_PUTS_ERROR("invalid written element read");
+ if (read_elem != write_elem)
+ FAIL_PUTS_ERROR("invalid written element read");
+ if (read_elem2 != write_elem2)
+ FAIL_PUTS_ERROR("invalid written element read");
/* Expand chunks now */
filter_expand_factor_g = 8;
/* Write element to the datasets */
write_elem = write_elem2 = u;
- H5E_BEGIN_TRY {
- status = H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem);
- } H5E_END_TRY;
- if(status >= 0) FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
-
- H5E_BEGIN_TRY {
- status = H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2);
- } H5E_END_TRY;
- if(status >= 0) FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
+ H5E_BEGIN_TRY
+ {
+ status =
+ H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem);
+ }
+ H5E_END_TRY;
+ if (status >= 0)
+ FAIL_PUTS_ERROR(
+ "should fail to write to dataset when allocation time is not early");
+
+ H5E_BEGIN_TRY
+ {
+ status =
+ H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2);
+ }
+ H5E_END_TRY;
+ if (status >= 0)
+ FAIL_PUTS_ERROR(
+ "should fail to write to dataset when allocation time is not early");
} /* end for */
- } /* end while */
+ } /* end while */
/* Close the datasets */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid2) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid2) < 0)
+ FAIL_STACK_ERROR
} /* end else */
/* Close everything */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid2) < 0) FAIL_STACK_ERROR
- if(H5Sclose(scalar_sid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(scalar_sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* If the dataset was created, do some extra testing */
- if(H5D_ALLOC_TIME_EARLY != alloc_time) {
+ if (H5D_ALLOC_TIME_EARLY != alloc_time) {
/* Re-open file & datasets */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open the datasets */
- if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((dsid2 = H5Dopen2(fid, "dset2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((dsid2 = H5Dopen2(fid, "dset2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the chunk index type for the two datasets */
- if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR
- if(H5D__layout_idx_type_test(dsid2, &idx_type2) < 0) FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(dsid, &idx_type) < 0)
+ FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(dsid2, &idx_type2) < 0)
+ FAIL_STACK_ERROR
- /* Chunk index type expected depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
+ /* Chunk index type expected depends on whether we are using the latest version of the format
+ */
+ if (low == H5F_LIBVER_LATEST) {
/* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("should be using extensible array as index");
- if(idx_type2 != H5D_CHUNK_IDX_BT2) FAIL_PUTS_ERROR("should be using v2 B-tree as index");
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("should be using extensible array as index");
+ if (idx_type2 != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("should be using v2 B-tree as index");
} /* end if */
else {
/* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index");
- if(idx_type2 != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ if (idx_type2 != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
} /* end else */
/* Create scalar dataspace */
- if((scalar_sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
+ if ((scalar_sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
/* Get dataspace for the datasets now */
- if((sid = H5Dget_space(dsid)) < 0) FAIL_STACK_ERROR
- if((sid2 = H5Dget_space(dsid2)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Dget_space(dsid)) < 0)
+ FAIL_STACK_ERROR
+ if ((sid2 = H5Dget_space(dsid2)) < 0)
+ FAIL_STACK_ERROR
/* Read elements */
hs_size = hs_size2[0] = hs_size2[1] = 1;
- for(u = 0; u < 1000; u++) {
+ for (u = 0; u < 1000; u++) {
/* Select a single element in the datasets */
hs_offset = hs_offset2[0] = hs_offset2[1] = u;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) FAIL_STACK_ERROR
- if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0)
+ FAIL_STACK_ERROR
/* Read element from the datasets */
read_elem = read_elem2 = u + 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
- if(H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0)
+ FAIL_STACK_ERROR
/* Verify unwritten element is proper value */
- if(read_elem != (u % 100)) FAIL_PUTS_ERROR("invalid element read");
- if(read_elem2 != (u % 100)) FAIL_PUTS_ERROR("invalid element read");
+ if (read_elem != (u % 100))
+ FAIL_PUTS_ERROR("invalid element read");
+ if (read_elem2 != (u % 100))
+ FAIL_PUTS_ERROR("invalid element read");
/* Don't expand chunks yet */
filter_expand_factor_g = 0;
/* Write element to the datasets */
write_elem = write_elem2 = u % 100;
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) FAIL_STACK_ERROR
- if(H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2) < 0)
+ FAIL_STACK_ERROR
/* Read element from the datasets */
- read_elem = write_elem + 1;
+ read_elem = write_elem + 1;
read_elem2 = write_elem2 + 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
- if(H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &read_elem2) < 0)
+ FAIL_STACK_ERROR
/* Verify written element is read in */
- if(read_elem != write_elem) FAIL_PUTS_ERROR("invalid written element read");
- if(read_elem2 != write_elem2) FAIL_PUTS_ERROR("invalid written element read");
+ if (read_elem != write_elem)
+ FAIL_PUTS_ERROR("invalid written element read");
+ if (read_elem2 != write_elem2)
+ FAIL_PUTS_ERROR("invalid written element read");
/* Expand chunks now */
filter_expand_factor_g = 8;
/* Write element to the datasets */
write_elem = write_elem2 = u % 100;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
status = H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem);
- } H5E_END_TRY;
- if(status >= 0) FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
-
- H5E_BEGIN_TRY {
- status = H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2);
- } H5E_END_TRY;
- if(status >= 0) FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
+ }
+ H5E_END_TRY;
+ if (status >= 0)
+ FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
+
+ H5E_BEGIN_TRY
+ {
+ status =
+ H5Dwrite(dsid2, H5T_NATIVE_UINT, scalar_sid, sid2, H5P_DEFAULT, &write_elem2);
+ }
+ H5E_END_TRY;
+ if (status >= 0)
+ FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early");
} /* end for */
/* Close everything */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid2) < 0) FAIL_STACK_ERROR
- if(H5Sclose(scalar_sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(scalar_sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Re-open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Delete the datasets */
- if(H5Ldelete(fid, "dset", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "dset2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "dset", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "dset2", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close everything */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
} /* end if */
- } /* end for */
+ } /* end for */
/* Unregister "expansion" filter */
- if(H5Zunregister(H5Z_FILTER_EXPAND) < 0) FAIL_STACK_ERROR
+ if (H5Zunregister(H5Z_FILTER_EXPAND) < 0)
+ FAIL_STACK_ERROR
/* Check that the filter was unregistered */
- if(FALSE != H5Zfilter_avail(H5Z_FILTER_EXPAND)) FAIL_STACK_ERROR
+ if (FALSE != H5Zfilter_avail(H5Z_FILTER_EXPAND))
+ FAIL_STACK_ERROR
PASSED();
} /* end else */
@@ -9632,7 +10572,8 @@ test_chunk_expand(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(dcpl2);
H5Dclose(dsid);
@@ -9641,11 +10582,11 @@ error:
H5Sclose(sid2);
H5Sclose(scalar_sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_chunk_expand() */
-
/*-------------------------------------------------------------------------
* Function: test_fixed_array
*
@@ -9679,413 +10620,474 @@ error:
static herr_t
test_fixed_array(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE]; /* File name */
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
+ char filename[FILENAME_BUF_SIZE]; /* File name */
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1; /* Dataspace ID for dataset with fixed dimensions */
- hid_t sid_big = -1; /* Dataspate ID for big dataset */
- hid_t sid_max = -1; /* Dataspace ID for dataset with maximum dimensions set */
+ hid_t sid = -1; /* Dataspace ID for dataset with fixed dimensions */
+ hid_t sid_big = -1; /* Dataspate ID for big dataset */
+ hid_t sid_max = -1; /* Dataspace ID for dataset with maximum dimensions set */
- hid_t dsid = -1; /* Dataset ID for dataset with fixed dimensions */
- hid_t dsid_big = -1; /* Dataset ID for big dataset with fixed dimensions */
- hid_t dsid_max = -1; /* Dataset ID for dataset with maximum dimensions set */
+ hid_t dsid = -1; /* Dataset ID for dataset with fixed dimensions */
+ hid_t dsid_big = -1; /* Dataset ID for big dataset with fixed dimensions */
+ hid_t dsid_max = -1; /* Dataset ID for dataset with maximum dimensions set */
- hsize_t dim2[2] = {48, 18}; /* Dataset dimensions */
- const hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */
- hsize_t dim2_max[2] = {120, 50}; /* Maximum dataset dimensions */
+ hsize_t dim2[2] = {48, 18}; /* Dataset dimensions */
+ const hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */
+ hsize_t dim2_max[2] = {120, 50}; /* Maximum dataset dimensions */
- hid_t mem_id; /* Memory space ID */
- hid_t big_mem_id; /* Memory space ID for big dataset */
+ hid_t mem_id; /* Memory space ID */
+ hid_t big_mem_id; /* Memory space ID for big dataset */
- hsize_t msize[1] = {POINTS}; /* Size of memory space */
- hsize_t msize_big[1] = {POINTS_BIG}; /* Size of memory space for big dataset */
+ hsize_t msize[1] = {POINTS}; /* Size of memory space */
+ hsize_t msize_big[1] = {POINTS_BIG}; /* Size of memory space for big dataset */
- int wbuf[POINTS]; /* write buffer */
- int *wbuf_big = NULL; /* write buffer for big dataset */
- int rbuf[POINTS]; /* read buffer */
- int *rbuf_big = NULL; /* read buffer for big dataset */
+ int wbuf[POINTS]; /* write buffer */
+ int *wbuf_big = NULL; /* write buffer for big dataset */
+ int rbuf[POINTS]; /* read buffer */
+ int *rbuf_big = NULL; /* read buffer for big dataset */
- const hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */
+ const hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */
- int **chunks = NULL; /* # of chunks for dataset dimensions */
- int **chunks_big = NULL; /* # of chunks for big dataset dimensions */
- int *chunks_bytes = NULL;
- int *chunks_big_bytes = NULL;
+ int **chunks = NULL; /* # of chunks for dataset dimensions */
+ int **chunks_big = NULL; /* # of chunks for big dataset dimensions */
+ int * chunks_bytes = NULL;
+ int * chunks_big_bytes = NULL;
- int chunk_row; /* chunk row index */
- int chunk_col; /* chunk column index */
+ int chunk_row; /* chunk row index */
+ int chunk_col; /* chunk column index */
- hsize_t **coord = NULL; /* datdaset coordinates */
- hsize_t **coord_big = NULL; /* big datdaset coordinates */
- hsize_t *coord_bytes = NULL;
- hsize_t *coord_big_bytes = NULL;
+ hsize_t **coord = NULL; /* datdaset coordinates */
+ hsize_t **coord_big = NULL; /* big datdaset coordinates */
+ hsize_t * coord_bytes = NULL;
+ hsize_t * coord_big_bytes = NULL;
- H5D_chunk_index_t idx_type; /* Dataset chunk index type */
- H5F_libver_t low, high; /* File format bounds */
- H5D_alloc_time_t alloc_time; /* Storage allocation time */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ H5F_libver_t low, high; /* File format bounds */
+ H5D_alloc_time_t alloc_time; /* Storage allocation time */
#ifdef H5_HAVE_FILTER_DEFLATE
- unsigned compress; /* Whether chunks should be compressed */
-#endif /* H5_HAVE_FILTER_DEFLATE */
+ unsigned compress; /* Whether chunks should be compressed */
+#endif /* H5_HAVE_FILTER_DEFLATE */
- h5_stat_size_t empty_size; /* Size of an empty file */
- h5_stat_size_t file_size; /* Size of each file created */
+ h5_stat_size_t empty_size; /* Size of an empty file */
+ h5_stat_size_t file_size; /* Size of each file created */
- size_t i, j; /* local index variables */
- herr_t ret; /* Generic return value */
- long ofs, inc;
- long rows;
- long cols;
+ size_t i, j; /* local index variables */
+ herr_t ret; /* Generic return value */
+ long ofs, inc;
+ long rows;
+ long cols;
TESTING("datasets w/fixed array as chunk index");
h5_fixname(FILENAME[12], fapl, filename, sizeof filename);
/* Set up 2D data arrays */
- if(NULL == (chunks_bytes = (int *)HDcalloc(12 * 6, sizeof(int))))
+ if (NULL == (chunks_bytes = (int *)HDcalloc(12 * 6, sizeof(int))))
TEST_ERROR;
- if(NULL == (chunks = (int **)HDcalloc(12, sizeof(chunks_bytes))))
+ if (NULL == (chunks = (int **)HDcalloc(12, sizeof(chunks_bytes))))
TEST_ERROR;
for (i = 0; i < 12; i++)
chunks[i] = chunks_bytes + (i * 6);
- if(NULL == (chunks_big_bytes = (int *)HDcalloc(125 * 20, sizeof(int))))
+ if (NULL == (chunks_big_bytes = (int *)HDcalloc(125 * 20, sizeof(int))))
TEST_ERROR;
- if(NULL == (chunks_big = (int **)HDcalloc(125, sizeof(chunks_big_bytes))))
+ if (NULL == (chunks_big = (int **)HDcalloc(125, sizeof(chunks_big_bytes))))
TEST_ERROR;
for (i = 0; i < 125; i++)
chunks_big[i] = chunks_big_bytes + (i * 20);
- if(NULL == (coord_bytes = (hsize_t *)HDcalloc(POINTS * 2, sizeof(hsize_t))))
+ if (NULL == (coord_bytes = (hsize_t *)HDcalloc(POINTS * 2, sizeof(hsize_t))))
TEST_ERROR;
- if(NULL == (coord = (hsize_t **)HDcalloc(POINTS, sizeof(coord_bytes))))
+ if (NULL == (coord = (hsize_t **)HDcalloc(POINTS, sizeof(coord_bytes))))
TEST_ERROR;
for (i = 0; i < POINTS; i++)
coord[i] = coord_bytes + (i * 2);
- if(NULL == (coord_big_bytes = (hsize_t *)HDcalloc(POINTS_BIG * 2, sizeof(hsize_t))))
+ if (NULL == (coord_big_bytes = (hsize_t *)HDcalloc(POINTS_BIG * 2, sizeof(hsize_t))))
TEST_ERROR;
- if(NULL == (coord_big = (hsize_t **)HDcalloc(POINTS_BIG, sizeof(coord_big_bytes))))
+ if (NULL == (coord_big = (hsize_t **)HDcalloc(POINTS_BIG, sizeof(coord_big_bytes))))
TEST_ERROR;
for (i = 0; i < POINTS_BIG; i++)
coord_big[i] = coord_big_bytes + (i * 2);
/* Check if we are using the latest version of the format */
- if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR
+ if (H5Pget_libver_bounds(fapl, &low, &high) < 0)
+ FAIL_STACK_ERROR
/* Create and close the file to get the file size */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
STACK_ERROR
/* Get the size of the empty file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Allocate the "big" buffers */
- if(NULL == (wbuf_big = (int *)HDmalloc(sizeof(int) * POINTS_BIG)))
+ if (NULL == (wbuf_big = (int *)HDmalloc(sizeof(int) * POINTS_BIG)))
TEST_ERROR
- if(NULL == (rbuf_big = (int *)HDmalloc(sizeof(int) * POINTS_BIG)))
+ if (NULL == (rbuf_big = (int *)HDmalloc(sizeof(int) * POINTS_BIG)))
TEST_ERROR
#ifdef H5_HAVE_FILTER_DEFLATE
/* Loop over compressing chunks */
- for(compress = FALSE; compress <= TRUE; compress++) {
+ for (compress = FALSE; compress <= TRUE; compress++) {
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for (alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set chunking */
- if((ret = H5Pset_chunk(dcpl, 2, chunk_dim2)) < 0)
- FAIL_PUTS_ERROR(" Problem with setting chunk.")
+ if ((ret = H5Pset_chunk(dcpl, 2, chunk_dim2)) < 0)
+ FAIL_PUTS_ERROR(" Problem with setting chunk.")
#ifdef H5_HAVE_FILTER_DEFLATE
/* Check if we should compress the chunks */
- if(compress)
- if(H5Pset_deflate(dcpl, 9) < 0) FAIL_STACK_ERROR
+ if (compress)
+ if (H5Pset_deflate(dcpl, 9) < 0)
+ FAIL_STACK_ERROR
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Set fill time */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ FAIL_STACK_ERROR
/* Set allocation time */
- if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR
-
- /* Initialization of chunk array for repeated coordinates */
- for(i = 0; i < dim2[0]/chunk_dim2[0]; i++)
- for(j = 0; j < dim2[1]/chunk_dim2[1]; j++)
- chunks[i][j] = 0;
-
- rows = (long)(dim2[0]/chunk_dim2[0]);
- cols = (long)(dim2[1]/chunk_dim2[1]);
- make_random_offset_and_increment(rows * cols, &ofs, &inc);
-
- /* Generate random point coordinates. Only one point is selected per chunk */
- for(i = 0; i < POINTS; i++){
- H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
- H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
- ofs = (ofs + inc) % (rows * cols);
- HDassert(!chunks[chunk_row][chunk_col]);
-
- wbuf[i] = chunks[chunk_row][chunk_col] = chunk_row+chunk_col+1;
- coord[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
- coord[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
- } /* end for */
+ if (H5Pset_alloc_time(dcpl, alloc_time) < 0)
+ FAIL_STACK_ERROR
- /* Create first dataset with cur and max dimensions */
- if((sid_max = H5Screate_simple(2, dim2, dim2_max)) < 0) FAIL_STACK_ERROR
- dsid_max = H5Dcreate2(fid, DSET_FIXED_MAX, H5T_NATIVE_INT, sid_max, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if(dsid_max < 0)
- FAIL_PUTS_ERROR(" Creating Chunked Dataset with maximum dimensions.")
+ /* Initialization of chunk array for repeated coordinates */
+ for (i = 0; i < dim2[0] / chunk_dim2[0]; i++)
+ for (j = 0; j < dim2[1] / chunk_dim2[1]; j++)
+ chunks[i][j] = 0;
+
+ rows = (long)(dim2[0] / chunk_dim2[0]);
+ cols = (long)(dim2[1] / chunk_dim2[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
+ /* Generate random point coordinates. Only one point is selected per chunk */
+ for (i = 0; i < POINTS; i++) {
+ H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
+ H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!chunks[chunk_row][chunk_col]);
+
+ wbuf[i] = chunks[chunk_row][chunk_col] = chunk_row + chunk_col + 1;
+ coord[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
+ coord[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
+ } /* end for */
- /* Get the chunk index type */
- if(H5D__layout_idx_type_test(dsid_max, &idx_type) < 0) FAIL_STACK_ERROR
+ /* Create first dataset with cur and max dimensions */
+ if ((sid_max = H5Screate_simple(2, dim2, dim2_max)) < 0)
+ FAIL_STACK_ERROR
+ dsid_max =
+ H5Dcreate2(fid, DSET_FIXED_MAX, H5T_NATIVE_INT, sid_max, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dsid_max < 0)
+ FAIL_PUTS_ERROR(" Creating Chunked Dataset with maximum dimensions.")
+
+ /* Get the chunk index type */
+ if (H5D__layout_idx_type_test(dsid_max, &idx_type) < 0)
+ FAIL_STACK_ERROR
- /* Chunk index type depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
- if(alloc_time == H5D_ALLOC_TIME_EARLY
+ /* Chunk index type depends on whether we are using the latest version of the format */
+ if (low == H5F_LIBVER_LATEST) {
+ if (alloc_time == H5D_ALLOC_TIME_EARLY
#ifdef H5_HAVE_FILTER_DEFLATE
- && !compress
+ && !compress
#endif /* H5_HAVE_FILTER_DEFLATE */
- ) {
- if(idx_type != H5D_CHUNK_IDX_NONE)
- FAIL_PUTS_ERROR("should be using Non Index as index");
- } else if (idx_type != H5D_CHUNK_IDX_FARRAY)
- FAIL_PUTS_ERROR("should be using Fixed Array as index");
- } /* end if */
- else {
- if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
- } /* end else */
-
- /* Create dataspace for write buffer */
- if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ ) {
+ if (idx_type != H5D_CHUNK_IDX_NONE)
+ FAIL_PUTS_ERROR("should be using Non Index as index");
+ }
+ else if (idx_type != H5D_CHUNK_IDX_FARRAY)
+ FAIL_PUTS_ERROR("should be using Fixed Array as index");
+ } /* end if */
+ else {
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ } /* end else */
- /* Select the random points for writing */
- if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
- TEST_ERROR;
+ /* Create dataspace for write buffer */
+ if ((mem_id = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
- /* Write into dataset */
- if(H5Dwrite(dsid_max, H5T_NATIVE_INT, mem_id, sid_max, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
+ /* Select the random points for writing */
+ if (H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
+ TEST_ERROR;
- /* Closing */
- if(H5Dclose(dsid_max) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid_max) < 0) FAIL_STACK_ERROR
- if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR
+ /* Write into dataset */
+ if (H5Dwrite(dsid_max, H5T_NATIVE_INT, mem_id, sid_max, H5P_DEFAULT, wbuf) < 0)
+ TEST_ERROR;
+ /* Closing */
+ if (H5Dclose(dsid_max) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid_max) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(mem_id) < 0)
+ FAIL_STACK_ERROR
- /* Create second dataset with curr dim but NULL max dim */
- if((sid = H5Screate_simple(2, dim2, NULL)) < 0) FAIL_STACK_ERROR
- dsid = H5Dcreate2(fid, DSET_FIXED_NOMAX, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if(dsid < 0)
- FAIL_PUTS_ERROR(" Creating Chunked Dataset.")
+ /* Create second dataset with curr dim but NULL max dim */
+ if ((sid = H5Screate_simple(2, dim2, NULL)) < 0)
+ FAIL_STACK_ERROR
+ dsid = H5Dcreate2(fid, DSET_FIXED_NOMAX, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dsid < 0)
+ FAIL_PUTS_ERROR(" Creating Chunked Dataset.")
- /* Get the chunk index type */
- if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR
+ /* Get the chunk index type */
+ if (H5D__layout_idx_type_test(dsid, &idx_type) < 0)
+ FAIL_STACK_ERROR
- /* Chunk index type depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
- if(alloc_time == H5D_ALLOC_TIME_EARLY
+ /* Chunk index type depends on whether we are using the latest version of the format */
+ if (low == H5F_LIBVER_LATEST) {
+ if (alloc_time == H5D_ALLOC_TIME_EARLY
#ifdef H5_HAVE_FILTER_DEFLATE
- && !compress
+ && !compress
#endif /* H5_HAVE_FILTER_DEFLATE */
- ) {
- if(idx_type != H5D_CHUNK_IDX_NONE)
- FAIL_PUTS_ERROR("should be using Non Index as index");
- } else if(idx_type != H5D_CHUNK_IDX_FARRAY)
- FAIL_PUTS_ERROR("should be using Fixed Array as index");
- } else {
- if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
- } /* end else */
+ ) {
+ if (idx_type != H5D_CHUNK_IDX_NONE)
+ FAIL_PUTS_ERROR("should be using Non Index as index");
+ }
+ else if (idx_type != H5D_CHUNK_IDX_FARRAY)
+ FAIL_PUTS_ERROR("should be using Fixed Array as index");
+ }
+ else {
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ } /* end else */
- /* Create dataspace for write buffer */
- if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ /* Create dataspace for write buffer */
+ if ((mem_id = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
- /* Select the random points for writing */
- if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
- TEST_ERROR;
+ /* Select the random points for writing */
+ if (H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
+ TEST_ERROR;
- /* Write into dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
+ /* Write into dataset */
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, wbuf) < 0)
+ TEST_ERROR;
- /* Closing */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR
+ /* Closing */
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(mem_id) < 0)
+ FAIL_STACK_ERROR
- /* Create the third dataset with bigger size and both curr & max dimensions are the same */
- if((sid_big = H5Screate_simple(2, dim2_big, dim2_big)) < 0) FAIL_STACK_ERROR
- dsid_big = H5Dcreate2(fid, DSET_FIXED_BIG, H5T_NATIVE_INT, sid_big, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if(dsid_big < 0)
- FAIL_PUTS_ERROR(" Creating Big Chunked Dataset.")
+ /* Create the third dataset with bigger size and both curr & max dimensions are the same */
+ if ((sid_big = H5Screate_simple(2, dim2_big, dim2_big)) < 0)
+ FAIL_STACK_ERROR
+ dsid_big =
+ H5Dcreate2(fid, DSET_FIXED_BIG, H5T_NATIVE_INT, sid_big, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dsid_big < 0)
+ FAIL_PUTS_ERROR(" Creating Big Chunked Dataset.")
- /* Get the chunk index type */
- if(H5D__layout_idx_type_test(dsid_big, &idx_type) < 0) FAIL_STACK_ERROR
+ /* Get the chunk index type */
+ if (H5D__layout_idx_type_test(dsid_big, &idx_type) < 0)
+ FAIL_STACK_ERROR
- /* Chunk index type depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
- if(alloc_time == H5D_ALLOC_TIME_EARLY
+ /* Chunk index type depends on whether we are using the latest version of the format */
+ if (low == H5F_LIBVER_LATEST) {
+ if (alloc_time == H5D_ALLOC_TIME_EARLY
#ifdef H5_HAVE_FILTER_DEFLATE
- && !compress
+ && !compress
#endif /* H5_HAVE_FILTER_DEFLATE */
- ) {
- if(idx_type != H5D_CHUNK_IDX_NONE)
- FAIL_PUTS_ERROR("should be using Non Index as index");
- } else if(idx_type != H5D_CHUNK_IDX_FARRAY)
- FAIL_PUTS_ERROR("should be using Fixed Array as index");
- } /* end if */
- else {
- if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
- } /* end else */
+ ) {
+ if (idx_type != H5D_CHUNK_IDX_NONE)
+ FAIL_PUTS_ERROR("should be using Non Index as index");
+ }
+ else if (idx_type != H5D_CHUNK_IDX_FARRAY)
+ FAIL_PUTS_ERROR("should be using Fixed Array as index");
+ } /* end if */
+ else {
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ } /* end else */
- /* Initialization of chunk array for repeated coordinates */
- for(i = 0; i < dim2_big[0]/chunk_dim2[0]; i++)
- for(j = 0; j < dim2_big[1]/chunk_dim2[1]; j++)
- chunks_big[i][j] = 0;
-
- rows = (long)(dim2_big[0]/chunk_dim2[0]);
- cols = (long)(dim2_big[1]/chunk_dim2[1]);
- make_random_offset_and_increment(rows * cols, &ofs, &inc);
-
- /* Generate random point coordinates. Only one point is selected per chunk */
- for(i = 0; i < POINTS_BIG; i++){
- H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
- H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
- ofs = (ofs + inc) % (rows * cols);
- HDassert(!chunks_big[chunk_row][chunk_col]);
-
- wbuf_big[i] = chunks_big[chunk_row][chunk_col] = chunk_row+chunk_col+1;
- coord_big[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
- coord_big[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
- } /* end for */
+ /* Initialization of chunk array for repeated coordinates */
+ for (i = 0; i < dim2_big[0] / chunk_dim2[0]; i++)
+ for (j = 0; j < dim2_big[1] / chunk_dim2[1]; j++)
+ chunks_big[i][j] = 0;
+
+ rows = (long)(dim2_big[0] / chunk_dim2[0]);
+ cols = (long)(dim2_big[1] / chunk_dim2[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
+ /* Generate random point coordinates. Only one point is selected per chunk */
+ for (i = 0; i < POINTS_BIG; i++) {
+ H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
+ H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!chunks_big[chunk_row][chunk_col]);
+
+ wbuf_big[i] = chunks_big[chunk_row][chunk_col] = chunk_row + chunk_col + 1;
+ coord_big[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
+ coord_big[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
+ } /* end for */
- /* Create dataspace for write buffer */
- if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR;
+ /* Create dataspace for write buffer */
+ if ((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0)
+ TEST_ERROR;
- /* Select the random points for writing */
- if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0)
- TEST_ERROR;
+ /* Select the random points for writing */
+ if (H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0)
+ TEST_ERROR;
- /* Write into dataset */
- if(H5Dwrite(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, wbuf_big) < 0) TEST_ERROR;
+ /* Write into dataset */
+ if (H5Dwrite(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, wbuf_big) < 0)
+ TEST_ERROR;
- /* Closing */
- if(H5Dclose(dsid_big) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid_big) < 0) FAIL_STACK_ERROR
- if(H5Sclose(big_mem_id) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ /* Closing */
+ if (H5Dclose(dsid_big) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid_big) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(big_mem_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
- /* Open the first dataset */
- if((dsid = H5Dopen2(fid, DSET_FIXED_MAX, H5P_DEFAULT)) < 0) TEST_ERROR;
+ /* Open the first dataset */
+ if ((dsid = H5Dopen2(fid, DSET_FIXED_MAX, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* Get dataset dataspace */
- if((sid = H5Dget_space(dsid)) < 0) TEST_ERROR;
+ /* Get dataset dataspace */
+ if ((sid = H5Dget_space(dsid)) < 0)
+ TEST_ERROR;
- /* Create dataspace for read buffer */
- if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ /* Create dataspace for read buffer */
+ if ((mem_id = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
- /* Select the random points for reading */
- if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR;
+ /* Select the random points for reading */
+ if (H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
+ TEST_ERROR;
- /* Read from dataset */
- if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
+ /* Read from dataset */
+ if (H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR;
- /* Verify that written and read data are the same */
- for(i = 0; i < POINTS; i++)
- if(rbuf[i] != wbuf[i]){
- HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",
- __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
- TEST_ERROR;
- } /* end if */
+ /* Verify that written and read data are the same */
+ for (i = 0; i < POINTS; i++)
+ if (rbuf[i] != wbuf[i]) {
+ HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,
+ (unsigned)i, wbuf[i], (unsigned)i, rbuf[i]);
+ TEST_ERROR;
+ } /* end if */
- /* Closing */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR
+ /* Closing */
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(mem_id) < 0)
+ FAIL_STACK_ERROR
- /* Open the second dataset */
- if((dsid = H5Dopen2(fid, DSET_FIXED_NOMAX, H5P_DEFAULT)) < 0) TEST_ERROR;
+ /* Open the second dataset */
+ if ((dsid = H5Dopen2(fid, DSET_FIXED_NOMAX, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* Get dataset dataspace */
- if((sid = H5Dget_space(dsid)) < 0) TEST_ERROR;
+ /* Get dataset dataspace */
+ if ((sid = H5Dget_space(dsid)) < 0)
+ TEST_ERROR;
- /* Create dataspace for read buffer */
- if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
+ /* Create dataspace for read buffer */
+ if ((mem_id = H5Screate_simple(1, msize, NULL)) < 0)
+ TEST_ERROR;
- /* Select the random points for reading */
- if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR;
+ /* Select the random points for reading */
+ if (H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
+ TEST_ERROR;
- /* Read from dataset */
- if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
+ /* Read from dataset */
+ if (H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR;
- /* Verify that written and read data are the same */
- for(i = 0; i < POINTS; i++)
- if(rbuf[i] != wbuf[i]){
- HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",
- __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
- TEST_ERROR;
- } /* end if */
+ /* Verify that written and read data are the same */
+ for (i = 0; i < POINTS; i++)
+ if (rbuf[i] != wbuf[i]) {
+ HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,
+ (unsigned)i, wbuf[i], (unsigned)i, rbuf[i]);
+ TEST_ERROR;
+ } /* end if */
- /* Closing */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR
+ /* Closing */
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(mem_id) < 0)
+ FAIL_STACK_ERROR
- /* Open the third dataset */
- if((dsid_big = H5Dopen2(fid, DSET_FIXED_BIG, H5P_DEFAULT)) < 0) TEST_ERROR;
- /* Get dataset dataspace */
- if((sid_big = H5Dget_space(dsid_big)) < 0) TEST_ERROR;
+ /* Open the third dataset */
+ if ((dsid_big = H5Dopen2(fid, DSET_FIXED_BIG, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ /* Get dataset dataspace */
+ if ((sid_big = H5Dget_space(dsid_big)) < 0)
+ TEST_ERROR;
- /* Create dataspace for read buffer */
- if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR;
+ /* Create dataspace for read buffer */
+ if ((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0)
+ TEST_ERROR;
- /* Select the random points for reading */
- if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0) TEST_ERROR;
- /* Read from dataset */
- if(H5Dread(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, rbuf_big) < 0) TEST_ERROR;
+ /* Select the random points for reading */
+ if (H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0)
+ TEST_ERROR;
+ /* Read from dataset */
+ if (H5Dread(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, rbuf_big) < 0)
+ TEST_ERROR;
- /* Verify that written and read data are the same */
- for(i = 0; i < POINTS_BIG; i++)
- if(rbuf_big[i] != wbuf_big[i]) {
- HDprintf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n",
- __LINE__,(unsigned)i,wbuf_big[i],(unsigned)i,rbuf_big[i]);
- TEST_ERROR;
- } /* end if */
+ /* Verify that written and read data are the same */
+ for (i = 0; i < POINTS_BIG; i++)
+ if (rbuf_big[i] != wbuf_big[i]) {
+ HDprintf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", __LINE__,
+ (unsigned)i, wbuf_big[i], (unsigned)i, rbuf_big[i]);
+ TEST_ERROR;
+ } /* end if */
- /* Closing */
- if(H5Dclose(dsid_big) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid_big) < 0) FAIL_STACK_ERROR
- if(H5Sclose(big_mem_id) < 0) FAIL_STACK_ERROR
+ /* Closing */
+ if (H5Dclose(dsid_big) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid_big) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(big_mem_id) < 0)
+ FAIL_STACK_ERROR
/* Delete datasets */
- if(H5Ldelete(fid, DSET_FIXED_BIG, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, DSET_FIXED_NOMAX, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, DSET_FIXED_MAX, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, DSET_FIXED_BIG, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, DSET_FIXED_NOMAX, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, DSET_FIXED_MAX, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close everything */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
- /* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
- TEST_ERROR
+ /* Get the size of the file */
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
- /* Verify the file is correct size */
- if(file_size != empty_size)
- TEST_ERROR
+ /* Verify the file is correct size */
+ if (file_size != empty_size)
+ TEST_ERROR
} /* end for */
#ifdef H5_HAVE_FILTER_DEFLATE
- } /* end for */
+ } /* end for */
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Release buffers */
@@ -10105,13 +11107,15 @@ test_fixed_array(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Sclose(mem_id);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(wbuf_big);
HDfree(rbuf_big);
@@ -10127,7 +11131,6 @@ error:
return FAIL;
} /* end test_fixed_array() */
-
/*-------------------------------------------------------------------------
* Function: test_single_chunk
*
@@ -10156,211 +11159,241 @@ error:
static herr_t
test_single_chunk(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE]; /* File name */
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t t_dcpl = -1; /* Dataset creation property list ID */
-
- hid_t sid = -1, sid_max = -1; /* Dataspace ID for dataset with fixed dimensions */
- hid_t did = -1, did_max = -1; /* Dataset ID for dataset with fixed dimensions */
- hsize_t dim2[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */
- hsize_t t_dim2[2] = {DSET_TMP_DIM1, DSET_TMP_DIM2}; /* Dataset dimensions */
- int *wbuf = NULL; /* write buffer */
- int *t_wbuf = NULL; /* write buffer */
- int *rbuf = NULL; /* read buffer */
- int *t_rbuf = NULL; /* read buffer */
-
- H5D_chunk_index_t idx_type; /* Dataset chunk index type */
- H5F_libver_t low, high; /* File format bounds */
- H5D_alloc_time_t alloc_time; /* Storage allocation time */
+ char filename[FILENAME_BUF_SIZE]; /* File name */
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t t_dcpl = -1; /* Dataset creation property list ID */
+
+ hid_t sid = -1, sid_max = -1; /* Dataspace ID for dataset with fixed dimensions */
+ hid_t did = -1, did_max = -1; /* Dataset ID for dataset with fixed dimensions */
+ hsize_t dim2[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */
+ hsize_t t_dim2[2] = {DSET_TMP_DIM1, DSET_TMP_DIM2}; /* Dataset dimensions */
+ int * wbuf = NULL; /* write buffer */
+ int * t_wbuf = NULL; /* write buffer */
+ int * rbuf = NULL; /* read buffer */
+ int * t_rbuf = NULL; /* read buffer */
+
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ H5F_libver_t low, high; /* File format bounds */
+ H5D_alloc_time_t alloc_time; /* Storage allocation time */
#ifdef H5_HAVE_FILTER_DEFLATE
- unsigned compress; /* Whether chunks should be compressed */
-#endif /* H5_HAVE_FILTER_DEFLATE */
+ unsigned compress; /* Whether chunks should be compressed */
+#endif /* H5_HAVE_FILTER_DEFLATE */
- size_t n, i; /* local index variables */
- herr_t ret; /* Generic return value */
- h5_stat_size_t empty_size; /* Size of an empty file */
- h5_stat_size_t file_size; /* Size of each file created */
+ size_t n, i; /* local index variables */
+ herr_t ret; /* Generic return value */
+ h5_stat_size_t empty_size; /* Size of an empty file */
+ h5_stat_size_t file_size; /* Size of each file created */
TESTING("datasets w/Single Chunk indexing");
h5_fixname(FILENAME[17], fapl, filename, sizeof filename);
/* Check if we are using the latest version of the format */
- if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR
+ if (H5Pget_libver_bounds(fapl, &low, &high) < 0)
+ FAIL_STACK_ERROR
/* Create and close the file to get the file size */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
STACK_ERROR
/* Get the size of the empty file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Allocate the buffers */
- if(NULL == (wbuf = (int *)HDmalloc(sizeof(int) * (DSET_DIM1 * DSET_DIM2))))
+ if (NULL == (wbuf = (int *)HDmalloc(sizeof(int) * (DSET_DIM1 * DSET_DIM2))))
TEST_ERROR
- if(NULL == (rbuf = (int *)HDmalloc(sizeof(int) * (DSET_DIM1 * DSET_DIM2))))
+ if (NULL == (rbuf = (int *)HDmalloc(sizeof(int) * (DSET_DIM1 * DSET_DIM2))))
TEST_ERROR
- if(NULL == (t_wbuf = (int *)HDmalloc(sizeof(int) * (DSET_TMP_DIM1 * DSET_TMP_DIM2))))
+ if (NULL == (t_wbuf = (int *)HDmalloc(sizeof(int) * (DSET_TMP_DIM1 * DSET_TMP_DIM2))))
TEST_ERROR
- if(NULL == (t_rbuf = (int *)HDmalloc(sizeof(int) * (DSET_TMP_DIM1 * DSET_TMP_DIM2))))
+ if (NULL == (t_rbuf = (int *)HDmalloc(sizeof(int) * (DSET_TMP_DIM1 * DSET_TMP_DIM2))))
TEST_ERROR
- for(i = n = 0; i < (DSET_DIM1 * DSET_DIM2); i++)
- wbuf[i] = (int)n++;
+ for (i = n = 0; i < (DSET_DIM1 * DSET_DIM2); i++)
+ wbuf[i] = (int)n++;
- for(i = n = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++)
- t_wbuf[i] = (int)n++;
+ for (i = n = 0; i < (DSET_TMP_DIM1 * DSET_TMP_DIM2); i++)
+ t_wbuf[i] = (int)n++;
#ifdef H5_HAVE_FILTER_DEFLATE
/* Loop over compressing chunks */
- for(compress = FALSE; compress <= TRUE; compress++) {
+ for (compress = FALSE; compress <= TRUE; compress++) {
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for (alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
- if((t_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if ((t_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set chunking */
- if((ret = H5Pset_chunk(dcpl, 2, dim2)) < 0)
- FAIL_PUTS_ERROR(" Problem with setting chunk.")
+ if ((ret = H5Pset_chunk(dcpl, 2, dim2)) < 0)
+ FAIL_PUTS_ERROR(" Problem with setting chunk.")
- if((ret = H5Pset_chunk(t_dcpl, 2, t_dim2)) < 0)
- FAIL_PUTS_ERROR(" Problem with setting chunk.")
+ if ((ret = H5Pset_chunk(t_dcpl, 2, t_dim2)) < 0)
+ FAIL_PUTS_ERROR(" Problem with setting chunk.")
#ifdef H5_HAVE_FILTER_DEFLATE
/* Check if we should compress the chunks */
- if(compress) {
- if(H5Pset_deflate(dcpl, 9) < 0) FAIL_STACK_ERROR
- if(H5Pset_deflate(t_dcpl, 9) < 0) FAIL_STACK_ERROR
- }
+ if (compress) {
+ if (H5Pset_deflate(dcpl, 9) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_deflate(t_dcpl, 9) < 0)
+ FAIL_STACK_ERROR
+ }
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Set fill time */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR
- if(H5Pset_fill_time(t_dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_fill_time(t_dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ FAIL_STACK_ERROR
/* Set allocation time */
- if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR
- if(H5Pset_alloc_time(t_dcpl, alloc_time) < 0) FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(dcpl, alloc_time) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(t_dcpl, alloc_time) < 0)
+ FAIL_STACK_ERROR
- /* Create first dataset with cur and max dimensions */
- if((sid_max = H5Screate_simple(2, dim2, dim2)) < 0) FAIL_STACK_ERROR
- did_max = H5Dcreate2(fid, DSET_SINGLE_MAX, H5T_NATIVE_INT, sid_max, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if(did_max < 0)
- FAIL_PUTS_ERROR(" Creating Chunked Dataset with maximum dimensions.")
+ /* Create first dataset with cur and max dimensions */
+ if ((sid_max = H5Screate_simple(2, dim2, dim2)) < 0)
+ FAIL_STACK_ERROR
+ did_max =
+ H5Dcreate2(fid, DSET_SINGLE_MAX, H5T_NATIVE_INT, sid_max, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (did_max < 0)
+ FAIL_PUTS_ERROR(" Creating Chunked Dataset with maximum dimensions.")
- /* Get the chunk index type */
- if(H5D__layout_idx_type_test(did_max, &idx_type) < 0) FAIL_STACK_ERROR
+ /* Get the chunk index type */
+ if (H5D__layout_idx_type_test(did_max, &idx_type) < 0)
+ FAIL_STACK_ERROR
- /* Chunk index type depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
- if(idx_type != H5D_CHUNK_IDX_SINGLE)
- FAIL_PUTS_ERROR("should be using Single Chunk indexing");
- } /* end if */
- else {
- if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
- } /* end else */
+ /* Chunk index type depends on whether we are using the latest version of the format */
+ if (low == H5F_LIBVER_LATEST) {
+ if (idx_type != H5D_CHUNK_IDX_SINGLE)
+ FAIL_PUTS_ERROR("should be using Single Chunk indexing");
+ } /* end if */
+ else {
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ } /* end else */
- /* Write into dataset */
- if(H5Dwrite(did_max, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
+ /* Write into dataset */
+ if (H5Dwrite(did_max, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ TEST_ERROR;
- /* Closing */
- if(H5Dclose(did_max) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid_max) < 0) FAIL_STACK_ERROR
+ /* Closing */
+ if (H5Dclose(did_max) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid_max) < 0)
+ FAIL_STACK_ERROR
- /* Create second dataset with curr dim but NULL max dim */
- if((sid = H5Screate_simple(2, t_dim2, NULL)) < 0) FAIL_STACK_ERROR
- did = H5Dcreate2(fid, DSET_SINGLE_NOMAX, H5T_NATIVE_INT, sid, H5P_DEFAULT, t_dcpl, H5P_DEFAULT);
- if(did < 0)
- FAIL_PUTS_ERROR(" Creating Chunked Dataset.")
+ /* Create second dataset with curr dim but NULL max dim */
+ if ((sid = H5Screate_simple(2, t_dim2, NULL)) < 0)
+ FAIL_STACK_ERROR
+ did = H5Dcreate2(fid, DSET_SINGLE_NOMAX, H5T_NATIVE_INT, sid, H5P_DEFAULT, t_dcpl, H5P_DEFAULT);
+ if (did < 0)
+ FAIL_PUTS_ERROR(" Creating Chunked Dataset.")
- /* Get the chunk index type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR
-
- /* Chunk index type depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
- if(idx_type != H5D_CHUNK_IDX_SINGLE)
- FAIL_PUTS_ERROR("should be using Single Chunk indexing");
- } else {
- if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
- } /* end else */
+ /* Get the chunk index type */
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
- /* Write into dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, t_wbuf) < 0) TEST_ERROR;
+ /* Chunk index type depends on whether we are using the latest version of the format */
+ if (low == H5F_LIBVER_LATEST) {
+ if (idx_type != H5D_CHUNK_IDX_SINGLE)
+ FAIL_PUTS_ERROR("should be using Single Chunk indexing");
+ }
+ else {
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ } /* end else */
- /* Closing */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ /* Write into dataset */
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, t_wbuf) < 0)
+ TEST_ERROR;
- /* Open the first dataset */
- if((did_max = H5Dopen2(fid, DSET_SINGLE_MAX, H5P_DEFAULT)) < 0) TEST_ERROR;
+ /* Closing */
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
- /* Read from dataset */
- if(H5Dread(did_max, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
+ /* Open the first dataset */
+ if ((did_max = H5Dopen2(fid, DSET_SINGLE_MAX, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- /* Verify that written and read data are the same */
- for(i = 0; i < (DSET_DIM1 * DSET_DIM2); i++)
- if(rbuf[i] != wbuf[i]){
- HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",
- __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
- TEST_ERROR;
- } /* end if */
+ /* Read from dataset */
+ if (H5Dread(did_max, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR;
+
+ /* Verify that written and read data are the same */
+ for (i = 0; i < (DSET_DIM1 * DSET_DIM2); i++)
+ if (rbuf[i] != wbuf[i]) {
+ HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,
+ (unsigned)i, wbuf[i], (unsigned)i, rbuf[i]);
+ TEST_ERROR;
+ } /* end if */
- /* Closing */
- if(H5Dclose(did_max) < 0) FAIL_STACK_ERROR
+ /* Closing */
+ if (H5Dclose(did_max) < 0)
+ FAIL_STACK_ERROR
- /* Open the second dataset */
- if((did = H5Dopen2(fid, DSET_SINGLE_NOMAX, H5P_DEFAULT)) < 0) TEST_ERROR;
+ /* Open the second dataset */
+ if ((did = H5Dopen2(fid, DSET_SINGLE_NOMAX, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- HDmemset(rbuf, 0, sizeof(int) * (DSET_DIM1 * DSET_DIM2));
+ HDmemset(rbuf, 0, sizeof(int) * (DSET_DIM1 * DSET_DIM2));
- /* Read from dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rbuf) < 0) TEST_ERROR;
+ /* Read from dataset */
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rbuf) < 0)
+ TEST_ERROR;
- /* Verify that written and read data are the same */
- for(i = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++)
- if(t_rbuf[i] != t_wbuf[i]) {
- HDprintf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n",
- __LINE__,(unsigned)i,t_wbuf[i],(unsigned)i,t_rbuf[i]);
- TEST_ERROR;
- } /* end if */
+ /* Verify that written and read data are the same */
+ for (i = 0; i < (DSET_TMP_DIM1 * DSET_TMP_DIM2); i++)
+ if (t_rbuf[i] != t_wbuf[i]) {
+ HDprintf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", __LINE__,
+ (unsigned)i, t_wbuf[i], (unsigned)i, t_rbuf[i]);
+ TEST_ERROR;
+ } /* end if */
- /* Closing */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ /* Closing */
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
- /* Delete datasets */
- if(H5Ldelete(fid, DSET_SINGLE_NOMAX, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, DSET_SINGLE_MAX, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ /* Delete datasets */
+ if (H5Ldelete(fid, DSET_SINGLE_NOMAX, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, DSET_SINGLE_MAX, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close everything */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
- /* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ /* Get the size of the file */
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
} /* end for */
#ifdef H5_HAVE_FILTER_DEFLATE
- } /* end for */
+ } /* end for */
#endif /* H5_HAVE_FILTER_DEFLATE */
-
/* Release buffers */
HDfree(wbuf);
HDfree(rbuf);
@@ -10371,7 +11404,8 @@ test_single_chunk(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(t_dcpl);
H5Dclose(did);
@@ -10379,19 +11413,19 @@ error:
H5Sclose(sid);
H5Sclose(sid_max);
H5Fclose(fid);
- } H5E_END_TRY;
- if(wbuf)
+ }
+ H5E_END_TRY;
+ if (wbuf)
HDfree(wbuf);
- if(rbuf)
+ if (rbuf)
HDfree(rbuf);
- if(t_wbuf)
+ if (t_wbuf)
HDfree(t_wbuf);
- if(t_rbuf)
+ if (t_rbuf)
HDfree(t_rbuf);
return FAIL;
} /* end test_single_chunk() */
-
/*-------------------------------------------------------------------------
*
* test_idx_compatible():
@@ -10405,62 +11439,69 @@ error:
static herr_t
test_idx_compatible(void)
{
- hid_t fid = -1; /* File id */
- hid_t did = -1; /* Dataset id */
- const char *filename = NULL; /* old test file name */
- unsigned j; /* Local index variable */
- H5D_chunk_index_t idx_type; /* Chunked dataset index type */
+ hid_t fid = -1; /* File id */
+ hid_t did = -1; /* Dataset id */
+ const char * filename = NULL; /* old test file name */
+ unsigned j; /* Local index variable */
+ H5D_chunk_index_t idx_type; /* Chunked dataset index type */
/* Output message about test being performed */
TESTING("compatibility for 1.6/1.8 datasets that use B-tree indexing");
- for(j = 0; j < NELMTS(OLD_FILENAME); j++) {
+ for (j = 0; j < NELMTS(OLD_FILENAME); j++) {
- /* Generate correct name for test file by prepending the source path */
- filename = H5_get_srcdir_filename(OLD_FILENAME[j]);
+ /* Generate correct name for test file by prepending the source path */
+ filename = H5_get_srcdir_filename(OLD_FILENAME[j]);
- /* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ /* Open the file */
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- /* Should be able to read the dataset w/o filter created under 1.8/1.6 */
- if((did = H5Dopen2(fid, DSET, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ /* Should be able to read the dataset w/o filter created under 1.8/1.6 */
+ if ((did = H5Dopen2(fid, DSET, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- /* Get the chunk index type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR
+ /* Get the chunk index type */
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
- /* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index")
+ /* Verify index type */
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index")
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
- /* Should be able to read the dataset w/ filter created under 1.8/1.6 */
- if((did = H5Dopen2(fid, DSET_FILTER, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ /* Should be able to read the dataset w/ filter created under 1.8/1.6 */
+ if ((did = H5Dopen2(fid, DSET_FILTER, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- /* Get the chunk index type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR
+ /* Get the chunk index type */
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
- /* Verify index type */
- if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index")
+ /* Verify index type */
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index")
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
- /* Close the file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ /* Close the file */
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
}
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
- H5Fclose(fid);
- } H5E_END_TRY;
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_idx_compatible() */
@@ -10477,17 +11518,17 @@ error:
static herr_t
test_unfiltered_edge_chunks(hid_t fapl)
{
- hid_t fid = -1; /* File id */
- hid_t did = -1; /* Dataset id */
- hid_t sid = -1; /* Dataspace id */
- hid_t dcpl = -1; /* DCPL id */
- hsize_t dim[2] = {4, 3}; /* Dataset dimensions */
- hsize_t cdim[2] = {2, 2}; /* Chunk dimension */
- char wbuf[4][3]; /* Write buffer */
- char rbuf[4][3]; /* Read buffer */
- char filename[FILENAME_BUF_SIZE] = ""; /* old test file name */
- unsigned opts; /* Chunk options */
- unsigned i, j; /* Local index variables */
+ hid_t fid = -1; /* File id */
+ hid_t did = -1; /* Dataset id */
+ hid_t sid = -1; /* Dataspace id */
+ hid_t dcpl = -1; /* DCPL id */
+ hsize_t dim[2] = {4, 3}; /* Dataset dimensions */
+ hsize_t cdim[2] = {2, 2}; /* Chunk dimension */
+ char wbuf[4][3]; /* Write buffer */
+ char rbuf[4][3]; /* Read buffer */
+ char filename[FILENAME_BUF_SIZE] = ""; /* old test file name */
+ unsigned opts; /* Chunk options */
+ unsigned i, j; /* Local index variables */
/* Output message about test being performed */
TESTING("disabled partial chunk filters");
@@ -10495,116 +11536,116 @@ test_unfiltered_edge_chunks(hid_t fapl)
h5_fixname(FILENAME[14], fapl, filename, sizeof filename);
/* Create the file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Register byte-counting filter */
- if(H5Zregister(H5Z_COUNT) < 0)
+ if (H5Zregister(H5Z_COUNT) < 0)
TEST_ERROR
/* Create dataspace */
- if((sid = H5Screate_simple(2, dim, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dim, NULL)) < 0)
TEST_ERROR
/* Create DCPL */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Set chunk dimensions */
- if(H5Pset_chunk(dcpl, 2, cdim) < 0)
+ if (H5Pset_chunk(dcpl, 2, cdim) < 0)
TEST_ERROR
/* Add "count" filter */
- if(H5Pset_filter(dcpl, H5Z_FILTER_COUNT, 0u, (size_t)0, NULL) < 0)
+ if (H5Pset_filter(dcpl, H5Z_FILTER_COUNT, 0u, (size_t)0, NULL) < 0)
TEST_ERROR
/* Disable filters on partial chunks */
- if(H5Pget_chunk_opts(dcpl, &opts) < 0)
+ if (H5Pget_chunk_opts(dcpl, &opts) < 0)
TEST_ERROR
opts |= H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS;
- if(H5Pset_chunk_opts(dcpl, opts) < 0)
+ if (H5Pset_chunk_opts(dcpl, opts) < 0)
TEST_ERROR
/* Initialize write buffer */
- for(i=0; i<dim[0]; i++)
- for(j=0; j<dim[1]; j++)
+ for (i = 0; i < dim[0]; i++)
+ for (j = 0; j < dim[1]; j++)
wbuf[i][j] = (char)((2 * i) - j);
/* Reset byte counts */
- count_nbytes_read = (size_t)0;
+ count_nbytes_read = (size_t)0;
count_nbytes_written = (size_t)0;
/* Create dataset */
- if((did = H5Dcreate2(fid, DSET_CHUNKED_NAME, H5T_NATIVE_CHAR, sid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_CHUNKED_NAME, H5T_NATIVE_CHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Nothing should have been written, as we are not using early allocation */
- if(count_nbytes_read != (size_t)0)
+ if (count_nbytes_read != (size_t)0)
TEST_ERROR
- if(count_nbytes_written != (size_t)0)
+ if (count_nbytes_written != (size_t)0)
TEST_ERROR
/* Write data */
- if(H5Dwrite(did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
/* Make sure only 2 of the 4 chunks were written through the filter (4 bytes
* each) */
- if(count_nbytes_read != (size_t)0)
+ if (count_nbytes_read != (size_t)0)
TEST_ERROR
- if(count_nbytes_written != (size_t)(2 * cdim[0] * cdim[1]))
+ if (count_nbytes_written != (size_t)(2 * cdim[0] * cdim[1]))
TEST_ERROR
/* Reopen the dataset */
- if((did = H5Dopen2(fid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
TEST_ERROR
/* Verify that data read == data written */
- for(i=0; i<dim[0]; i++)
- for(j=0; j<dim[1]; j++)
- if(rbuf[i][j] != wbuf[i][j])
+ for (i = 0; i < dim[0]; i++)
+ for (j = 0; j < dim[1]; j++)
+ if (rbuf[i][j] != wbuf[i][j])
TEST_ERROR
/* Make sure only 2 of the 4 chunks were read through the filter (4 bytes
* each) */
- if(count_nbytes_read != (size_t)(2 * cdim[0] * cdim[1]))
+ if (count_nbytes_read != (size_t)(2 * cdim[0] * cdim[1]))
TEST_ERROR
- if(count_nbytes_written != (size_t)(2 * cdim[0] * cdim[1]))
+ if (count_nbytes_written != (size_t)(2 * cdim[0] * cdim[1]))
TEST_ERROR
/* Close IDs */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Pclose(dcpl);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_unfiltered_edge_chunks() */
-
/*-------------------------------------------------------------------------
* Function: test_large_chunk_shrink
*
@@ -10622,104 +11663,125 @@ error:
static herr_t
test_large_chunk_shrink(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t scalar_sid = -1;/* Scalar dataspace ID */
- hid_t dsid = -1; /* Dataset ID */
- hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */
- hsize_t hs_offset; /* Hyperslab offset */
- hsize_t hs_size; /* Hyperslab size */
- unsigned write_elem, read_elem; /* Element written/read */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t scalar_sid = -1; /* Scalar dataspace ID */
+ hid_t dsid = -1; /* Dataset ID */
+ hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */
+ hsize_t hs_offset; /* Hyperslab offset */
+ hsize_t hs_size; /* Hyperslab size */
+ unsigned write_elem, read_elem; /* Element written/read */
TESTING("shrinking large chunk");
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set 2 MB chunk size */
chunk_dim = 2 * 1024 * 1024 / sizeof(unsigned);
- if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 1, &chunk_dim) < 0)
+ FAIL_STACK_ERROR
/* Create scalar dataspace */
- if((scalar_sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
+ if ((scalar_sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
/* Create 1-D dataspace */
- dim = 2 * 1024 * 1024 / sizeof(unsigned);
+ dim = 2 * 1024 * 1024 / sizeof(unsigned);
max_dim = H5S_UNLIMITED;
- if((sid = H5Screate_simple(1, &dim, &max_dim)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(1, &dim, &max_dim)) < 0)
+ FAIL_STACK_ERROR
/* Create 2 MB chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Select last element in the dataset */
hs_offset = dim - 1;
- hs_size = 1;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) FAIL_STACK_ERROR
+ hs_size = 1;
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0)
+ FAIL_STACK_ERROR
/* Read (unwritten) element from dataset */
read_elem = 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
/* Verify unwritten element is fill value (0) */
- if(read_elem != 0) FAIL_PUTS_ERROR("invalid unwritten element read");
+ if (read_elem != 0)
+ FAIL_PUTS_ERROR("invalid unwritten element read");
/* Write element to dataset */
write_elem = 2;
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0)
+ FAIL_STACK_ERROR
/* Read element from dataset */
read_elem = write_elem + 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
/* Verify written element is read in */
- if(read_elem != write_elem) FAIL_PUTS_ERROR("invalid written element read");
+ if (read_elem != write_elem)
+ FAIL_PUTS_ERROR("invalid written element read");
/* Shrink dataset to 512 KB */
dim = 512 * 1024 / sizeof(unsigned);
- if(H5Dset_extent(dsid, &dim) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, &dim) < 0)
+ FAIL_STACK_ERROR
/* Expand dataset back to 2MB */
dim = 2 * 1024 * 1024 / sizeof(unsigned);
- if(H5Dset_extent(dsid, &dim) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, &dim) < 0)
+ FAIL_STACK_ERROR
/* Read element from dataset */
read_elem = 1;
- if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0)
+ FAIL_STACK_ERROR
/* Verify element is now 0 */
- if(read_elem != 0) FAIL_PUTS_ERROR("invalid element read");
+ if (read_elem != 0)
+ FAIL_PUTS_ERROR("invalid element read");
/* Close everything */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(scalar_sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(scalar_sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Sclose(scalar_sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_large_chunk_shrink() */
-
/*-------------------------------------------------------------------------
* Function: test_zero_dim_dset
*
@@ -10737,28 +11799,27 @@ error:
static herr_t
test_zero_dim_dset(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dsid = -1; /* Dataset ID */
- hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */
- int data[1];
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dsid = -1; /* Dataset ID */
+ hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */
+ int data[1];
H5F_libver_t low, high; /* File format bounds */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
TESTING("chunked dataset with zero dimension");
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combination, and verify support for reading a 1D
chunked dataset with dimension size = 0 */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds before opening the file */
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(fapl, low, high);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
continue;
@@ -10766,53 +11827,64 @@ test_zero_dim_dset(hid_t fapl)
h5_fixname(FILENAME[16], fapl, filename, sizeof filename);
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set 1 chunk size */
chunk_dim = 1;
- if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 1, &chunk_dim) < 0)
+ FAIL_STACK_ERROR
/* Create 1D dataspace with 0 dim size */
dim = 0;
- if((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(1, &dim, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* write 0 elements from dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR
/* Read 0 elements from dataset */
- if(H5Dread(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR
/* Close everything */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
} /* end for high */
- } /* end for low */
+ } /* end for low */
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_zero_dim_dset() */
-
/*-------------------------------------------------------------------------
* Function: test_swmr_non_latest
*
@@ -10829,240 +11901,261 @@ error:
static herr_t
test_swmr_non_latest(const char *env_h5_driver, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hsize_t dim[1], dims2[2]; /* Size of dataset */
- hsize_t max_dim[1], max_dims2[2]; /* Maximum size of dataset */
- hsize_t chunk_dim[1], chunk_dims2[2]; /* Chunk dimensions */
- H5D_chunk_index_t idx_type; /* Chunk index type */
- int data; /* Data to be written to the dataset */
- H5F_libver_t low; /* File format low bound */
-
- TESTING("File created with write+latest-format/SWMR-write+non-latest-format: dataset with latest chunk index");
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hsize_t dim[1], dims2[2]; /* Size of dataset */
+ hsize_t max_dim[1], max_dims2[2]; /* Maximum size of dataset */
+ hsize_t chunk_dim[1], chunk_dims2[2]; /* Chunk dimensions */
+ H5D_chunk_index_t idx_type; /* Chunk index type */
+ int data; /* Data to be written to the dataset */
+ H5F_libver_t low; /* File format low bound */
+
+ TESTING("File created with write+latest-format/SWMR-write+non-latest-format: dataset with latest chunk "
+ "index");
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
- if(!H5FD__supports_swmr_test(env_h5_driver)) {
+ if (!H5FD__supports_swmr_test(env_h5_driver)) {
SKIPPED();
HDputs(" Test skipped due to VFD not supporting SWMR I/O.");
return SUCCEED;
}
/* Check if we are using the latest version of the format */
- if(H5Pget_libver_bounds(fapl, &low, NULL) < 0)
+ if (H5Pget_libver_bounds(fapl, &low, NULL) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[18], fapl, filename, sizeof filename);
- if(low == H5F_LIBVER_LATEST) {
+ if (low == H5F_LIBVER_LATEST) {
/* Create file with write+latest-format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
}
else {
/* Create file with SWMR-write+non-latest-format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
} /* end else */
/* Create a chunked dataset: this will use extensible array chunk indexing */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
chunk_dim[0] = 6;
- if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
FAIL_STACK_ERROR
- dim[0] = 1;
+ dim[0] = 1;
max_dim[0] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(1, dim, max_dim)) < 0)
+ if ((sid = H5Screate_simple(1, dim, max_dim)) < 0)
FAIL_STACK_ERROR
- if((did = H5Dcreate2(fid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write to the dataset */
data = 100;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
FAIL_STACK_ERROR
/* Verify the dataset's indexing type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
FAIL_STACK_ERROR
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
FAIL_PUTS_ERROR("created dataset not indexed by extensible array")
/* Closing */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Open the file again */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset in the file */
- if((did = H5Dopen2(fid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Verify the dataset's indexing type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
FAIL_STACK_ERROR
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
FAIL_PUTS_ERROR("created dataset not indexed by extensible array")
/* Read from the dataset and verify data read is correct */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
FAIL_STACK_ERROR
- if(data != 100)
+ if (data != 100)
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Create a group in the file */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset in the group: this will use v2 B-tree chunk indexing */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
chunk_dims2[0] = chunk_dims2[1] = 10;
- if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims2) < 0)
FAIL_STACK_ERROR
dims2[0] = dims2[1] = 1;
max_dims2[0] = max_dims2[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dims2, max_dims2)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, max_dims2)) < 0)
FAIL_STACK_ERROR
- if((did = H5Dcreate2(gid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(gid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Verify the dataset's indexing type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
FAIL_STACK_ERROR
- if(idx_type != H5D_CHUNK_IDX_BT2)
+ if (idx_type != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("created dataset not indexed by v2 B-tree")
/* Closing */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Open the file again */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the group */
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Open the dataset in the group */
- if((did = H5Dopen2(gid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(gid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Verify the dataset's indexing type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
FAIL_STACK_ERROR
- if(idx_type != H5D_CHUNK_IDX_BT2)
+ if (idx_type != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("created dataset not indexed by v2 B-tree")
/* Closing */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Reopen the file with SWMR-write */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset in the file */
- if((did = H5Dopen2(fid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Verify the dataset's indexing type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
FAIL_STACK_ERROR
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
FAIL_PUTS_ERROR("created dataset not indexed by extensible array")
/* Close the dataset */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Open the group */
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Open the dataset in the group */
- if((did = H5Dopen2(gid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(gid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Verify the dataset's indexing type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
FAIL_STACK_ERROR
- if(idx_type != H5D_CHUNK_IDX_BT2)
+ if (idx_type != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("created dataset not indexed by v2 B-tree")
/* Write to the dataset in the group */
data = 99;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
FAIL_STACK_ERROR
/* Closing */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Open the file again with SWMR read access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did = H5Dopen2(gid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(gid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Read from the dataset and verify data read is correct */
data = 0;
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
FAIL_STACK_ERROR
- if(data != 99)
+ if (data != 99)
TEST_ERROR
/* Closing */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(did);
H5Sclose(sid);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* test_swmr_non_latest() */
-
/*-------------------------------------------------------------------------
* Function: test_earray_hdr_fd
*
@@ -11078,91 +12171,91 @@ error:
static herr_t
test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1;
- hid_t sid = -1;
- hid_t did = -1;
- hid_t tid = -1;
- hid_t dcpl = -1;
- hid_t msid = -1;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1;
+ hid_t sid = -1;
+ hid_t did = -1;
+ hid_t tid = -1;
+ hid_t dcpl = -1;
+ hid_t msid = -1;
H5D_chunk_index_t idx_type;
- const hsize_t shape[1] = { 8 };
- const hsize_t maxshape[1] = { H5S_UNLIMITED };
- const hsize_t chunk[1] = { 8 };
- const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- H5O_info2_t info;
+ const hsize_t shape[1] = {8};
+ const hsize_t maxshape[1] = {H5S_UNLIMITED};
+ const hsize_t chunk[1] = {8};
+ const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+ H5O_info2_t info;
TESTING("Extensible array chunk index header flush dependencies handled correctly");
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
- if(!H5FD__supports_swmr_test(env_h5_driver)) {
+ if (!H5FD__supports_swmr_test(env_h5_driver)) {
SKIPPED();
HDputs(" Test skipped due to VFD not supporting SWMR I/O.");
return SUCCEED;
}
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR;
h5_fixname(FILENAME[19], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
/* Create a dataset with one unlimited dimension */
- if((sid = H5Screate_simple(1, shape, maxshape)) < 0)
+ if ((sid = H5Screate_simple(1, shape, maxshape)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Tcopy(H5T_NATIVE_INT32)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT32)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 1, chunk) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, DSET_EARRAY_HDR_FD, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT )) < 0)
+ if ((did = H5Dcreate2(fid, DSET_EARRAY_HDR_FD, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Verify the chunk index type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
FAIL_STACK_ERROR;
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
FAIL_PUTS_ERROR("should be using extensible array as index");
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
FAIL_STACK_ERROR;
/* Write data to the dataset */
- if((did = H5Dopen2(fid, DSET_EARRAY_HDR_FD, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_EARRAY_HDR_FD, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
FAIL_STACK_ERROR;
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
/* The second call triggered a bug in the library (JIRA issue: SWMR-95) */
- if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
PASSED();
@@ -11170,7 +12263,8 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
H5Dclose(did);
@@ -11178,11 +12272,11 @@ error:
H5Tclose(tid);
H5Sclose(sid);
H5Sclose(msid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* test_earray_hdr_fd() */
-
/*-------------------------------------------------------------------------
* Function: test_farray_hdr_fd
*
@@ -11198,91 +12292,91 @@ error:
static herr_t
test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1;
- hid_t sid = -1;
- hid_t did = -1;
- hid_t tid = -1;
- hid_t dcpl = -1;
- hid_t msid = -1;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1;
+ hid_t sid = -1;
+ hid_t did = -1;
+ hid_t tid = -1;
+ hid_t dcpl = -1;
+ hid_t msid = -1;
H5D_chunk_index_t idx_type;
- const hsize_t shape[1] = { 8 };
- const hsize_t maxshape[1] = { 64 };
- const hsize_t chunk[1] = { 8 };
- const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- H5O_info2_t info;
+ const hsize_t shape[1] = {8};
+ const hsize_t maxshape[1] = {64};
+ const hsize_t chunk[1] = {8};
+ const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+ H5O_info2_t info;
TESTING("Fixed array chunk index header flush dependencies handled correctly");
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
- if(!H5FD__supports_swmr_test(env_h5_driver)) {
+ if (!H5FD__supports_swmr_test(env_h5_driver)) {
SKIPPED();
HDputs(" Test skipped due to VFD not supporting SWMR I/O.");
return SUCCEED;
}
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR;
h5_fixname(FILENAME[20], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
/* Create a chunked dataset with fixed dimensions */
- if((sid = H5Screate_simple(1, shape, maxshape)) < 0)
+ if ((sid = H5Screate_simple(1, shape, maxshape)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Tcopy(H5T_NATIVE_INT32)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT32)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 1, chunk) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, DSET_FARRAY_HDR_FD, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT )) < 0)
+ if ((did = H5Dcreate2(fid, DSET_FARRAY_HDR_FD, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Verify the chunk index type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
FAIL_STACK_ERROR;
- if(idx_type != H5D_CHUNK_IDX_FARRAY)
+ if (idx_type != H5D_CHUNK_IDX_FARRAY)
FAIL_PUTS_ERROR("should be using fixed array as index");
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
FAIL_STACK_ERROR;
/* Write data to the dataset */
- if((did = H5Dopen2(fid, DSET_FARRAY_HDR_FD, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_FARRAY_HDR_FD, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
FAIL_STACK_ERROR;
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
/* The second call triggered a bug in the library (JIRA issue: SWMR-95) */
- if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
PASSED();
@@ -11290,7 +12384,8 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
H5Dclose(did);
@@ -11298,11 +12393,11 @@ error:
H5Tclose(tid);
H5Sclose(sid);
H5Sclose(msid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_farray_hdr_fd() */
-
/*-------------------------------------------------------------------------
* Function: test_bt2_hdr_fd
*
@@ -11318,19 +12413,19 @@ error:
static herr_t
test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1;
- hid_t sid = -1;
- hid_t did = -1;
- hid_t tid = -1;
- hid_t dcpl = -1;
- hid_t msid = -1;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1;
+ hid_t sid = -1;
+ hid_t did = -1;
+ hid_t tid = -1;
+ hid_t dcpl = -1;
+ hid_t msid = -1;
H5D_chunk_index_t idx_type;
- const hsize_t shape[2] = { 8, 8 };
- const hsize_t maxshape[2] = { H5S_UNLIMITED, H5S_UNLIMITED };
- const hsize_t chunk[2] = { 8, 8 };
- const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- H5O_info2_t info;
+ const hsize_t shape[2] = {8, 8};
+ const hsize_t maxshape[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ const hsize_t chunk[2] = {8, 8};
+ const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+ H5O_info2_t info;
TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly");
@@ -11340,72 +12435,72 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl)
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
- if(!H5FD__supports_swmr_test(env_h5_driver)) {
+ if (!H5FD__supports_swmr_test(env_h5_driver)) {
SKIPPED();
HDputs(" Test skipped due to VFD not supporting SWMR I/O.");
return SUCCEED;
}
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR;
h5_fixname(FILENAME[21], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
/* Create a chunked dataset with fixed dimensions */
- if((sid = H5Screate_simple(2, shape, maxshape)) < 0)
+ if ((sid = H5Screate_simple(2, shape, maxshape)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Tcopy(H5T_NATIVE_INT32)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT32)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 2, chunk) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, DSET_BT2_HDR_FD, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT )) < 0)
+ if ((did = H5Dcreate2(fid, DSET_BT2_HDR_FD, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Verify the chunk index type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
FAIL_STACK_ERROR;
- if(idx_type != H5D_CHUNK_IDX_BT2)
+ if (idx_type != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("should be using fixed array as index");
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
FAIL_STACK_ERROR;
/* Write data to the dataset */
- if((did = H5Dopen2(fid, DSET_BT2_HDR_FD, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_BT2_HDR_FD, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
FAIL_STACK_ERROR;
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
/* The second call triggered a bug in the library (JIRA issue: SWMR-95) */
- if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
PASSED();
@@ -11413,7 +12508,8 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
H5Dclose(did);
@@ -11421,11 +12517,11 @@ error:
H5Tclose(tid);
H5Sclose(sid);
H5Sclose(msid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_bt2_hdr_fd() */
-
/*-------------------------------------------------------------------------
* Function: test_storage_size
*
@@ -11443,383 +12539,479 @@ error:
static herr_t
test_storage_size(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dsid = -1; /* Dataset ID */
- hsize_t dims[2], max_dims[2]; /* Dataset dimensions */
- hsize_t new_dims[2]; /* New dataset dimensions */
- hsize_t chunk_dims[2]; /* Chunk dimensions */
- int wdata[STORAGE_SIZE_DIM1][STORAGE_SIZE_DIM2];
- hsize_t ssize; /* Dataset storage size */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dsid = -1; /* Dataset ID */
+ hsize_t dims[2], max_dims[2]; /* Dataset dimensions */
+ hsize_t new_dims[2]; /* New dataset dimensions */
+ hsize_t chunk_dims[2]; /* Chunk dimensions */
+ int wdata[STORAGE_SIZE_DIM1][STORAGE_SIZE_DIM2];
+ hsize_t ssize; /* Dataset storage size */
TESTING("querying storage size");
h5_fixname(FILENAME[22], fapl, filename, sizeof filename);
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set chunk size */
chunk_dims[0] = STORAGE_SIZE_CHUNK_DIM1;
chunk_dims[1] = STORAGE_SIZE_CHUNK_DIM2;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ FAIL_STACK_ERROR
/* Copy the DCPL, and set it to early allocation */
- if((dcpl2 = H5Pcopy(dcpl)) < 0) FAIL_STACK_ERROR
- if(H5Pset_alloc_time(dcpl2, H5D_ALLOC_TIME_EARLY) < 0) FAIL_STACK_ERROR
+ if ((dcpl2 = H5Pcopy(dcpl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(dcpl2, H5D_ALLOC_TIME_EARLY) < 0)
+ FAIL_STACK_ERROR
/* Create 2D dataspace, with max dims same as current dimensions */
- dims[0] = STORAGE_SIZE_DIM1;
- dims[1] = STORAGE_SIZE_DIM2;
+ dims[0] = STORAGE_SIZE_DIM1;
+ dims[1] = STORAGE_SIZE_DIM2;
max_dims[0] = STORAGE_SIZE_DIM1;
max_dims[1] = STORAGE_SIZE_DIM2;
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize buffer to zeroes */
HDmemset(wdata, 0, sizeof(wdata));
/* write elements to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close dataset & dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Copy the dataset */
- if(H5Ocopy(fid, "dset", fid, "dset_copy", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ocopy(fid, "dset", fid, "dset_copy", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the copied dataset */
- if((dsid = H5Dopen2(fid, "dset_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset_copy", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close copied dataset */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Create 2D dataspace with max dims > current dims (but not unlimited) */
- dims[0] = STORAGE_SIZE_DIM1;
- dims[1] = STORAGE_SIZE_DIM2;
+ dims[0] = STORAGE_SIZE_DIM1;
+ dims[1] = STORAGE_SIZE_DIM2;
max_dims[0] = STORAGE_SIZE_MAX_DIM1;
max_dims[1] = STORAGE_SIZE_MAX_DIM2;
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize buffer to zeroes */
HDmemset(wdata, 0, sizeof(wdata));
/* write elements to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Extend dataset's dimensions */
new_dims[0] = STORAGE_SIZE_DIM1 * 2;
new_dims[1] = STORAGE_SIZE_DIM2 * 2;
- if(H5Dset_extent(dsid, new_dims) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, new_dims) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close dataset & dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Copy the dataset */
- if(H5Ocopy(fid, "dset2", fid, "dset2_copy", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ocopy(fid, "dset2", fid, "dset2_copy", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the copied dataset */
- if((dsid = H5Dopen2(fid, "dset2_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset2_copy", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close copied dataset */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Create 2D dataspace with max dims > current dims (but not unlimited) */
- dims[0] = STORAGE_SIZE_DIM1;
- dims[1] = STORAGE_SIZE_DIM2;
+ dims[0] = STORAGE_SIZE_DIM1;
+ dims[1] = STORAGE_SIZE_DIM2;
max_dims[0] = STORAGE_SIZE_MAX_DIM1;
max_dims[1] = STORAGE_SIZE_MAX_DIM2;
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset, w/early allocation */
- if((dsid = H5Dcreate2(fid, "dset2a", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset2a", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize buffer to zeroes */
HDmemset(wdata, 0, sizeof(wdata));
/* write elements to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Extend dataset's dimensions */
new_dims[0] = STORAGE_SIZE_DIM1 * 2;
new_dims[1] = STORAGE_SIZE_DIM2 * 2;
- if(H5Dset_extent(dsid, new_dims) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, new_dims) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close dataset & dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Copy the dataset */
- if(H5Ocopy(fid, "dset2a", fid, "dset2a_copy", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ocopy(fid, "dset2a", fid, "dset2a_copy", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the copied dataset */
- if((dsid = H5Dopen2(fid, "dset2a_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset2a_copy", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close copied dataset */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Create 2D dataspace with max dims > current dims (and 1 unlimited dim) */
- dims[0] = STORAGE_SIZE_DIM1;
- dims[1] = STORAGE_SIZE_DIM2;
+ dims[0] = STORAGE_SIZE_DIM1;
+ dims[1] = STORAGE_SIZE_DIM2;
max_dims[0] = H5S_UNLIMITED;
max_dims[1] = STORAGE_SIZE_MAX_DIM2;
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize buffer to zeroes */
HDmemset(wdata, 0, sizeof(wdata));
/* write elements to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Extend dataset's dimensions */
new_dims[0] = STORAGE_SIZE_DIM1 * 2;
new_dims[1] = STORAGE_SIZE_DIM2 * 2;
- if(H5Dset_extent(dsid, new_dims) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, new_dims) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close dataset & dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Copy the dataset */
- if(H5Ocopy(fid, "dset3", fid, "dset3_copy", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ocopy(fid, "dset3", fid, "dset3_copy", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the copied dataset */
- if((dsid = H5Dopen2(fid, "dset3_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset3_copy", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close copied dataset */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Create 2D dataspace with max dims > current dims (and 1 unlimited dim) */
- dims[0] = STORAGE_SIZE_DIM1;
- dims[1] = STORAGE_SIZE_DIM2;
+ dims[0] = STORAGE_SIZE_DIM1;
+ dims[1] = STORAGE_SIZE_DIM2;
max_dims[0] = H5S_UNLIMITED;
max_dims[1] = STORAGE_SIZE_MAX_DIM2;
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset, w/early allocation */
- if((dsid = H5Dcreate2(fid, "dset3a", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset3a", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize buffer to zeroes */
HDmemset(wdata, 0, sizeof(wdata));
/* write elements to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Extend dataset's dimensions */
new_dims[0] = STORAGE_SIZE_DIM1 * 2;
new_dims[1] = STORAGE_SIZE_DIM2 * 2;
- if(H5Dset_extent(dsid, new_dims) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, new_dims) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close dataset & dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Copy the dataset */
- if(H5Ocopy(fid, "dset3a", fid, "dset3a_copy", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ocopy(fid, "dset3a", fid, "dset3a_copy", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the copied dataset */
- if((dsid = H5Dopen2(fid, "dset3a_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset3a_copy", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close copied dataset */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Create 2D dataspace with max dims > current dims (and 2 unlimited dims) */
- dims[0] = STORAGE_SIZE_DIM1;
- dims[1] = STORAGE_SIZE_DIM2;
+ dims[0] = STORAGE_SIZE_DIM1;
+ dims[1] = STORAGE_SIZE_DIM2;
max_dims[0] = H5S_UNLIMITED;
max_dims[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize buffer to zeroes */
HDmemset(wdata, 0, sizeof(wdata));
/* write elements to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Extend dataset's dimensions */
new_dims[0] = STORAGE_SIZE_DIM1 * 2;
new_dims[1] = STORAGE_SIZE_DIM2 * 2;
- if(H5Dset_extent(dsid, new_dims) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, new_dims) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close dataset & dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Copy the dataset */
- if(H5Ocopy(fid, "dset4", fid, "dset4_copy", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ocopy(fid, "dset4", fid, "dset4_copy", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the copied dataset */
- if((dsid = H5Dopen2(fid, "dset4_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset4_copy", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close copied dataset */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Create 2D dataspace with max dims > current dims (and 2 unlimited dims) */
- dims[0] = STORAGE_SIZE_DIM1;
- dims[1] = STORAGE_SIZE_DIM2;
+ dims[0] = STORAGE_SIZE_DIM1;
+ dims[1] = STORAGE_SIZE_DIM2;
max_dims[0] = H5S_UNLIMITED;
max_dims[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create chunked dataset, w/early allocation */
- if((dsid = H5Dcreate2(fid, "dset4a", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "dset4a", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize buffer to zeroes */
HDmemset(wdata, 0, sizeof(wdata));
/* write elements to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 6 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Extend dataset's dimensions */
new_dims[0] = STORAGE_SIZE_DIM1 * 2;
new_dims[1] = STORAGE_SIZE_DIM2 * 2;
- if(H5Dset_extent(dsid, new_dims) < 0) FAIL_STACK_ERROR
+ if (H5Dset_extent(dsid, new_dims) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close dataset & dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Copy the dataset */
- if(H5Ocopy(fid, "dset4a", fid, "dset4a_copy", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ocopy(fid, "dset4a", fid, "dset4a_copy", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the copied dataset */
- if((dsid = H5Dopen2(fid, "dset4a_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dsid = H5Dopen2(fid, "dset4a_copy", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the storage size */
- if(0 == (ssize = H5Dget_storage_size(dsid))) FAIL_STACK_ERROR
- if((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize) TEST_ERROR
+ if (0 == (ssize = H5Dget_storage_size(dsid)))
+ FAIL_STACK_ERROR
+ if ((sizeof(int) * 15 * STORAGE_SIZE_CHUNK_DIM1 * STORAGE_SIZE_CHUNK_DIM2) != ssize)
+ TEST_ERROR
/* Close copied dataset */
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dsid) < 0)
+ FAIL_STACK_ERROR
/* Close rest */
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(dcpl2);
H5Dclose(dsid);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_storage_size() */
-
/*-------------------------------------------------------------------------
* Function: test_power2up
*
@@ -11838,79 +13030,80 @@ error:
static herr_t
test_power2up(hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hsize_t dims[2]; /* Dataset dimension sizes */
- hsize_t max_dims[2]; /* Maximum dimension sizes */
- hsize_t chunk_dims[2]; /* Chunk dimensions */
- hsize_t ext_dims[2]; /* Extended dimension sizes */
- herr_t status; /* Error status */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hsize_t dims[2]; /* Dataset dimension sizes */
+ hsize_t max_dims[2]; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2]; /* Chunk dimensions */
+ hsize_t ext_dims[2]; /* Extended dimension sizes */
+ herr_t status; /* Error status */
TESTING("the next power of 2");
h5_fixname(FILENAME[24], fapl, filename, sizeof filename);
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Set dims[1] to ((2^63) -1) */
- dims[0] = 0;
- dims[1] = ((hsize_t)1 << ((sizeof(hsize_t) * CHAR_BIT) -1)) - 1;
+ dims[0] = 0;
+ dims[1] = ((hsize_t)1 << ((sizeof(hsize_t) * CHAR_BIT) - 1)) - 1;
max_dims[0] = max_dims[1] = H5S_UNLIMITED;
- sid = H5Screate_simple(2, dims, max_dims);
+ sid = H5Screate_simple(2, dims, max_dims);
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- TEST_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
/* Set chunk size */
chunk_dims[0] = chunk_dims[1] = 1;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
- TEST_ERROR
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR
/* Create chunked dataset */
- if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT64, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if ((did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT64, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
ext_dims[0] = 1;
ext_dims[1] = dims[1] + 5;
/* Extend to (2^63)+ */
- H5E_BEGIN_TRY {
- status = H5Dset_extent(did, ext_dims);
- } H5E_END_TRY;
- if(status >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { status = H5Dset_extent(did, ext_dims); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR
/* Closing */
- if(H5Dclose(did) < 0)
- TEST_ERROR
- if(H5Sclose(sid) < 0)
- TEST_ERROR
- if(H5Pclose(dcpl) < 0)
- TEST_ERROR
- if(H5Fclose(fid) < 0)
- TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(did);
H5Sclose(sid);
H5Pclose(dcpl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_power2up() */
-
/*-------------------------------------------------------------------------
* Function: test_scatter
*
@@ -11926,34 +13119,35 @@ error:
*-------------------------------------------------------------------------
*/
typedef struct scatter_info_t {
- int *src_buf; /* Source data buffer */
+ int * src_buf; /* Source data buffer */
size_t block; /* Maximum number of elements to return to H5Dscatter() */
size_t size; /* Remaining number of elements to return */
} scatter_info_t;
-#define TEST_SCATTER_CHECK_ARR(ARR, EXP) \
- for(i=0; i<(int)(sizeof(ARR)/sizeof(ARR[0])); i++) \
- for(j=0; j<(int)(sizeof(ARR[0])/sizeof(ARR[0][0])); j++) \
- for(k=0; k<(int)(sizeof(ARR[0][0])/sizeof(ARR[0][0][0])); k++) \
- if(ARR[i][j][k] != EXP[i][j][k]) { \
- H5_FAILED(); AT(); \
- HDprintf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \
- goto error; \
+#define TEST_SCATTER_CHECK_ARR(ARR, EXP) \
+ for (i = 0; i < (int)(sizeof(ARR) / sizeof(ARR[0])); i++) \
+ for (j = 0; j < (int)(sizeof(ARR[0]) / sizeof(ARR[0][0])); j++) \
+ for (k = 0; k < (int)(sizeof(ARR[0][0]) / sizeof(ARR[0][0][0])); k++) \
+ if (ARR[i][j][k] != EXP[i][j][k]) { \
+ H5_FAILED(); \
+ AT(); \
+ HDprintf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, \
+ ARR[i][j][k], i, j, k, EXP[i][j][k]); \
+ goto error; \
}
static herr_t
-scatter_cb(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/,
- void *_scatter_info)
+scatter_cb(void **src_buf /*out*/, size_t *src_buf_bytes_used /*out*/, void *_scatter_info)
{
scatter_info_t *scatter_info = (scatter_info_t *)_scatter_info;
- size_t nelmts; /* Number of elements to return in src_buf */
+ size_t nelmts; /* Number of elements to return in src_buf */
/* Calculate number of elements */
nelmts = MIN(scatter_info->block, scatter_info->size);
HDassert(nelmts > 0);
/* Set output variables */
- *src_buf = (void *)scatter_info->src_buf;
+ *src_buf = (void *)scatter_info->src_buf;
*src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]);
/* Update scatter_info */
@@ -11966,32 +13160,32 @@ scatter_cb(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/,
static herr_t
test_scatter(void)
{
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dim[3] = {8, 5, 8}; /* Dataspace dimensions */
- hsize_t start[3] = {0, 0, 0};
- hsize_t stride[3] = {0, 0, 0};
- hsize_t count[3] = {0, 0, 0};
- hsize_t block[3] = {0, 0, 0};
- hsize_t start2[3] = {0, 0, 0};
- hsize_t count2[3] = {0, 0, 0};
- hsize_t point[4][3] = {{2, 3, 2}, {3, 0, 2}, {7, 2, 0}, {0, 1, 5}};
- size_t src_buf_size;
- int src_buf[36]; /* Source data buffer */
- int dst_buf[8][5][8]; /* Destination data buffer */
- int expect_dst_buf[8][5][8]; /* Expected destination data buffer */
- scatter_info_t scatter_info; /* Operator data for callback */
- int i, j, k, src_i; /* Local index variables */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dim[3] = {8, 5, 8}; /* Dataspace dimensions */
+ hsize_t start[3] = {0, 0, 0};
+ hsize_t stride[3] = {0, 0, 0};
+ hsize_t count[3] = {0, 0, 0};
+ hsize_t block[3] = {0, 0, 0};
+ hsize_t start2[3] = {0, 0, 0};
+ hsize_t count2[3] = {0, 0, 0};
+ hsize_t point[4][3] = {{2, 3, 2}, {3, 0, 2}, {7, 2, 0}, {0, 1, 5}};
+ size_t src_buf_size;
+ int src_buf[36]; /* Source data buffer */
+ int dst_buf[8][5][8]; /* Destination data buffer */
+ int expect_dst_buf[8][5][8]; /* Expected destination data buffer */
+ scatter_info_t scatter_info; /* Operator data for callback */
+ int i, j, k, src_i; /* Local index variables */
TESTING("H5Dscatter()");
/* Create dataspace */
- if((sid = H5Screate_simple(3, dim, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(3, dim, NULL)) < 0)
+ TEST_ERROR
/* Initialize src_buf */
- for(i=0; i<(int)(sizeof(src_buf)/sizeof(src_buf[0])); i++)
+ for (i = 0; i < (int)(sizeof(src_buf) / sizeof(src_buf[0])); i++)
src_buf[i] = i + 1;
-
/*
* Test 1: Simple case
*/
@@ -11999,33 +13193,32 @@ test_scatter(void)
count[0] = 1;
count[1] = 1;
count[2] = 8;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- /* Initialize dst_buf and expect_dst_buf */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
- for(i=0; i<8; i++)
+ /* Initialize dst_buf and expect_dst_buf */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ for (i = 0; i < 8; i++)
expect_dst_buf[0][0][i] = src_buf[i];
/* Loop over buffer sizes */
- for(src_buf_size=1; src_buf_size<=9; src_buf_size++) {
+ for (src_buf_size = 1; src_buf_size <= 9; src_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Set up scatter info */
scatter_info.src_buf = src_buf;
- scatter_info.block = src_buf_size;
- scatter_info.size = 8;
+ scatter_info.block = src_buf_size;
+ scatter_info.size = 8;
/* Scatter data */
- if(H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
+ if (H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
TEST_ERROR
/* Verify data */
TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf)
} /* end for */
-
/*
* Test 2: Single block in dataset
*/
@@ -12036,94 +13229,89 @@ test_scatter(void)
count[0] = 2;
count[1] = 3;
count[2] = 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ /* Initialize expect_dst_buf */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
src_i = 0;
- for(i=3; i<5; i++)
- for(j=2; j<5; j++)
- for(k=4; k<6; k++)
+ for (i = 3; i < 5; i++)
+ for (j = 2; j < 5; j++)
+ for (k = 4; k < 6; k++)
expect_dst_buf[i][j][k] = src_buf[src_i++];
/* Loop over buffer sizes */
- for(src_buf_size=1; src_buf_size<=13; src_buf_size++) {
+ for (src_buf_size = 1; src_buf_size <= 13; src_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Set up scatter info */
scatter_info.src_buf = src_buf;
- scatter_info.block = src_buf_size;
- scatter_info.size = 12;
+ scatter_info.block = src_buf_size;
+ scatter_info.size = 12;
/* Scatter data */
- if(H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
+ if (H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
TEST_ERROR
/* Verify data */
TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf)
} /* end for */
-
/*
* Test 3: Multiple blocks
*/
/* Select hyperslab */
- start[0] = 1;
- start[1] = 1;
- start[2] = 1;
+ start[0] = 1;
+ start[1] = 1;
+ start[2] = 1;
stride[0] = 3;
stride[1] = 4;
stride[2] = 5;
- count[0] = 3;
- count[1] = 1;
- count[2] = 2;
- block[0] = 1;
- block[1] = 3;
- block[2] = 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride ,count, block) < 0)
+ count[0] = 3;
+ count[1] = 1;
+ count[2] = 2;
+ block[0] = 1;
+ block[1] = 3;
+ block[2] = 2;
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- /* Iterate over block containing selection, checking if each element is in
- * selection. Note that the algorithm used here (if statement) would not
- * work for overlapping hyperslabs. */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ /* Initialize expect_dst_buf */
+ /* Iterate over block containing selection, checking if each element is in
+ * selection. Note that the algorithm used here (if statement) would not
+ * work for overlapping hyperslabs. */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
src_i = 0;
- for(i=1; i<8; i++)
- for(j=1; j<4; j++)
- for(k=1; k<8; k++)
- if((hsize_t)i >= start[0]
- && ((hsize_t)i - start[0]) % stride[0] < block[0]
- && ((hsize_t)i - start[0]) / stride[0] < count[0]
- && (hsize_t)j >= start[1]
- && ((hsize_t)j - start[1]) % stride[1] < block[1]
- && ((hsize_t)j - start[1]) / stride[1] < count[1]
- && (hsize_t)k >= start[2]
- && ((hsize_t)k - start[2]) % stride[2] < block[2]
- && ((hsize_t)k - start[2]) / stride[2] < count[2])
+ for (i = 1; i < 8; i++)
+ for (j = 1; j < 4; j++)
+ for (k = 1; k < 8; k++)
+ if ((hsize_t)i >= start[0] && ((hsize_t)i - start[0]) % stride[0] < block[0] &&
+ ((hsize_t)i - start[0]) / stride[0] < count[0] && (hsize_t)j >= start[1] &&
+ ((hsize_t)j - start[1]) % stride[1] < block[1] &&
+ ((hsize_t)j - start[1]) / stride[1] < count[1] && (hsize_t)k >= start[2] &&
+ ((hsize_t)k - start[2]) % stride[2] < block[2] &&
+ ((hsize_t)k - start[2]) / stride[2] < count[2])
expect_dst_buf[i][j][k] = src_buf[src_i++];
/* Loop over buffer sizes */
- for(src_buf_size=1; src_buf_size<=37; src_buf_size++) {
+ for (src_buf_size = 1; src_buf_size <= 37; src_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Set up scatter info */
scatter_info.src_buf = src_buf;
- scatter_info.block = src_buf_size;
- scatter_info.size = 36;
+ scatter_info.block = src_buf_size;
+ scatter_info.size = 36;
/* Scatter data */
- if(H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
+ if (H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
TEST_ERROR
/* Verify data */
TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf)
} /* end for */
-
/*
* Test 4: Compound selection
*/
@@ -12134,7 +13322,7 @@ test_scatter(void)
count[0] = 2;
count[1] = 3;
count[2] = 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start2[0] = 1;
start2[1] = 2;
@@ -12142,93 +13330,89 @@ test_scatter(void)
count2[0] = 3;
count2[1] = 2;
count2[2] = 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_XOR, start2, NULL ,count2, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_XOR, start2, NULL, count2, NULL) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- /* Iterate over block containing selection, checking if each element is in
- * selection. */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ /* Initialize expect_dst_buf */
+ /* Iterate over block containing selection, checking if each element is in
+ * selection. */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
src_i = 0;
- for(i=1; i<4; i++)
- for(j=1; j<4; j++)
- for(k=1; k<4; k++)
- if(!(((hsize_t)i >= start[0] && (hsize_t)i < start[0] + count[0])
- && ((hsize_t)j >= start[1] && (hsize_t)j < start[1] + count[1])
- && ((hsize_t)k >= start[2] && (hsize_t)k < start[2] + count[2]))
- != !(((hsize_t)i >= start2[0] && (hsize_t)i < start2[0] + count2[0])
- && ((hsize_t)j >= start2[1] && (hsize_t)j < start2[1] + count2[1])
- && ((hsize_t)k >= start2[2] && (hsize_t)k < start2[2] + count2[2])))
+ for (i = 1; i < 4; i++)
+ for (j = 1; j < 4; j++)
+ for (k = 1; k < 4; k++)
+ if (!(((hsize_t)i >= start[0] && (hsize_t)i < start[0] + count[0]) &&
+ ((hsize_t)j >= start[1] && (hsize_t)j < start[1] + count[1]) &&
+ ((hsize_t)k >= start[2] && (hsize_t)k < start[2] + count[2])) !=
+ !(((hsize_t)i >= start2[0] && (hsize_t)i < start2[0] + count2[0]) &&
+ ((hsize_t)j >= start2[1] && (hsize_t)j < start2[1] + count2[1]) &&
+ ((hsize_t)k >= start2[2] && (hsize_t)k < start2[2] + count2[2])))
expect_dst_buf[i][j][k] = src_buf[src_i++];
/* Loop over buffer sizes */
- for(src_buf_size=1; src_buf_size<=17; src_buf_size++) {
+ for (src_buf_size = 1; src_buf_size <= 17; src_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Set up scatter info */
scatter_info.src_buf = src_buf;
- scatter_info.block = src_buf_size;
- scatter_info.size = 16;
+ scatter_info.block = src_buf_size;
+ scatter_info.size = 16;
/* Scatter data */
- if(H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
+ if (H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
TEST_ERROR
/* Verify data */
TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf)
} /* end for */
-
/*
* Test 5: Point selection
*/
/* Select hyperslabs */
- if(H5Sselect_elements(sid, H5S_SELECT_SET, sizeof(point) / sizeof(point[0]), (hsize_t *)point) < 0)
+ if (H5Sselect_elements(sid, H5S_SELECT_SET, sizeof(point) / sizeof(point[0]), (hsize_t *)point) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- /* Iterate over block containing selection, checking if each element is in
- * selection. */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
- for(i=0; i<(int)(sizeof(point) / sizeof(point[0])); i++)
- expect_dst_buf[point[i][0]][point[i][1]][point[i][2]]
- = src_buf[i];
+ /* Initialize expect_dst_buf */
+ /* Iterate over block containing selection, checking if each element is in
+ * selection. */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ for (i = 0; i < (int)(sizeof(point) / sizeof(point[0])); i++)
+ expect_dst_buf[point[i][0]][point[i][1]][point[i][2]] = src_buf[i];
/* Loop over buffer sizes */
- for(src_buf_size=1; src_buf_size<=5; src_buf_size++) {
+ for (src_buf_size = 1; src_buf_size <= 5; src_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Set up scatter info */
scatter_info.src_buf = src_buf;
- scatter_info.block = src_buf_size;
- scatter_info.size = 4;
+ scatter_info.block = src_buf_size;
+ scatter_info.size = 4;
/* Scatter data */
- if(H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
+ if (H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
TEST_ERROR
/* Verify data */
TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf)
} /* end for */
-
/* Close everything */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Sclose(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Sclose(sid); }
+ H5E_END_TRY;
return FAIL;
} /* end test_scatter() */
-
/*-------------------------------------------------------------------------
* Function: test_gather
*
@@ -12244,18 +13428,17 @@ error:
*-------------------------------------------------------------------------
*/
typedef struct gather_info_t {
- int *expect_dst_buf; /* Expected destination data buffer */
- size_t max_nelmts; /* Maximum number of elements passed to callback */
- hbool_t last_call; /* Whether this should be the last time the callback is called */
+ int * expect_dst_buf; /* Expected destination data buffer */
+ size_t max_nelmts; /* Maximum number of elements passed to callback */
+ hbool_t last_call; /* Whether this should be the last time the callback is called */
} gather_info_t;
static herr_t
-gather_cb(const void *dst_buf, size_t dst_buf_bytes_used,
- void *_gather_info)
+gather_cb(const void *dst_buf, size_t dst_buf_bytes_used, void *_gather_info)
{
gather_info_t *gather_info = (gather_info_t *)_gather_info;
- size_t nelmts; /* Number of elements in src_buf */
- int i; /* Local index variable */
+ size_t nelmts; /* Number of elements in src_buf */
+ int i; /* Local index variable */
HDassert(dst_buf_bytes_used > 0);
@@ -12263,24 +13446,24 @@ gather_cb(const void *dst_buf, size_t dst_buf_bytes_used,
nelmts = dst_buf_bytes_used / sizeof(gather_info->expect_dst_buf[0]);
/* Make sure the number of bytes is a multiple of the number of elements */
- if(nelmts * sizeof(gather_info->expect_dst_buf[0]) != dst_buf_bytes_used)
+ if (nelmts * sizeof(gather_info->expect_dst_buf[0]) != dst_buf_bytes_used)
TEST_ERROR
/* Make sure we weren't passed more data than we requested to be passed at
* once */
- if(nelmts > gather_info->max_nelmts)
+ if (nelmts > gather_info->max_nelmts)
TEST_ERROR
/* If we were passed less data than requested, make sure this is the last
* time the callback was called */
- if(gather_info->last_call)
+ if (gather_info->last_call)
TEST_ERROR
- if(nelmts < gather_info->max_nelmts)
+ if (nelmts < gather_info->max_nelmts)
gather_info->last_call = TRUE;
/* Compare data and expected data */
- for(i=0; i<(int)nelmts; i++)
- if(((const int *)dst_buf)[i] != *((gather_info->expect_dst_buf)++))
+ for (i = 0; i < (int)nelmts; i++)
+ if (((const int *)dst_buf)[i] != *((gather_info->expect_dst_buf)++))
TEST_ERROR
return SUCCEED;
@@ -12292,35 +13475,34 @@ error:
static herr_t
test_gather(void)
{
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dim[3] = {8, 5, 8}; /* Dataspace dimensions */
- hsize_t start[3] = {0, 0, 0};
- hsize_t stride[3] = {0, 0, 0};
- hsize_t count[3] = {0, 0, 0};
- hsize_t block[3] = {0, 0, 0};
- hsize_t start2[3] = {0, 0, 0};
- hsize_t count2[3] = {0, 0, 0};
- hsize_t point[4][3] = {{2, 3, 2}, {3, 0, 2}, {7, 2, 0}, {0, 1, 5}};
- size_t dst_buf_size;
- int src_buf[8][5][8]; /* Source data buffer */
- int dst_buf[36]; /* Destination data buffer */
- int expect_dst_buf[36]; /* Expected destination data buffer */
- gather_info_t gather_info; /* Operator data for callback */
- int i, j, k, dst_i; /* Local index variables */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dim[3] = {8, 5, 8}; /* Dataspace dimensions */
+ hsize_t start[3] = {0, 0, 0};
+ hsize_t stride[3] = {0, 0, 0};
+ hsize_t count[3] = {0, 0, 0};
+ hsize_t block[3] = {0, 0, 0};
+ hsize_t start2[3] = {0, 0, 0};
+ hsize_t count2[3] = {0, 0, 0};
+ hsize_t point[4][3] = {{2, 3, 2}, {3, 0, 2}, {7, 2, 0}, {0, 1, 5}};
+ size_t dst_buf_size;
+ int src_buf[8][5][8]; /* Source data buffer */
+ int dst_buf[36]; /* Destination data buffer */
+ int expect_dst_buf[36]; /* Expected destination data buffer */
+ gather_info_t gather_info; /* Operator data for callback */
+ int i, j, k, dst_i; /* Local index variables */
TESTING("H5Dgather()");
/* Create dataspace */
- if((sid = H5Screate_simple(3, dim, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(3, dim, NULL)) < 0)
+ TEST_ERROR
/* Initialize src_buf */
- for(i=0; i<(int)(sizeof(src_buf)/sizeof(src_buf[0])); i++)
- for(j=0; j<(int)(sizeof(src_buf[0])/sizeof(src_buf[0][0])); j++)
- for(k=0; k<(int)(sizeof(src_buf[0][0])/sizeof(src_buf[0][0][0])); k++)
- src_buf[i][j][k] = 1 + k
- + (int)(sizeof(src_buf[0][0]) / sizeof(src_buf[0][0][0])) * j
- + (int)(sizeof(src_buf[0]) / sizeof(src_buf[0][0][0])) * i;
-
+ for (i = 0; i < (int)(sizeof(src_buf) / sizeof(src_buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(src_buf[0]) / sizeof(src_buf[0][0])); j++)
+ for (k = 0; k < (int)(sizeof(src_buf[0][0]) / sizeof(src_buf[0][0][0])); k++)
+ src_buf[i][j][k] = 1 + k + (int)(sizeof(src_buf[0][0]) / sizeof(src_buf[0][0][0])) * j +
+ (int)(sizeof(src_buf[0]) / sizeof(src_buf[0][0][0])) * i;
/*
* Test 1: Simple case
@@ -12329,45 +13511,48 @@ test_gather(void)
count[0] = 1;
count[1] = 1;
count[2] = 8;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
- for(i=0; i<8; i++)
+ /* Initialize expect_dst_buf */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ for (i = 0; i < 8; i++)
expect_dst_buf[i] = src_buf[0][0][i];
/* Loop over buffer sizes */
- for(dst_buf_size=1; dst_buf_size<=9; dst_buf_size++) {
+ for (dst_buf_size = 1; dst_buf_size <= 9; dst_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Initialize gather_info */
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.max_nelmts = dst_buf_size;
- gather_info.last_call = FALSE;
+ gather_info.max_nelmts = dst_buf_size;
+ gather_info.last_call = FALSE;
/* Gather data */
- if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0)
+ if (H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb,
+ &gather_info) < 0)
TEST_ERROR
/* Verify that all data has been gathered (and verified) */
- if(gather_info.expect_dst_buf - expect_dst_buf != 8) TEST_ERROR
+ if (gather_info.expect_dst_buf - expect_dst_buf != 8)
+ TEST_ERROR
} /* end for */
/* Test without a callback */
/* Loop over buffer sizes */
- for(dst_buf_size=8; dst_buf_size<=9; dst_buf_size++) {
+ for (dst_buf_size = 8; dst_buf_size <= 9; dst_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Gather data */
- if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, NULL, NULL) < 0)
+ if (H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, NULL, NULL) <
+ 0)
TEST_ERROR
/* Verify data */
- for(i=0; i<(int)(sizeof(dst_buf)/sizeof(dst_buf[0])); i++)
- if(dst_buf[i] != expect_dst_buf[i])
+ for (i = 0; i < (int)(sizeof(dst_buf) / sizeof(dst_buf[0])); i++)
+ if (dst_buf[i] != expect_dst_buf[i])
TEST_ERROR
} /* end for */
@@ -12378,16 +13563,17 @@ test_gather(void)
/* Initialize gather_info */
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.max_nelmts = dst_buf_size - 1;
- gather_info.last_call = FALSE;
+ gather_info.max_nelmts = dst_buf_size - 1;
+ gather_info.last_call = FALSE;
/* Gather data */
- if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]) - 1, dst_buf, gather_cb, &gather_info) < 0)
+ if (H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]) - 1, dst_buf, gather_cb,
+ &gather_info) < 0)
TEST_ERROR
/* Verify that all data has been gathered (and verified) */
- if(gather_info.expect_dst_buf - expect_dst_buf != 8) TEST_ERROR
-
+ if (gather_info.expect_dst_buf - expect_dst_buf != 8)
+ TEST_ERROR
/*
* Test 2: Single block in dataset
@@ -12399,94 +13585,93 @@ test_gather(void)
count[0] = 2;
count[1] = 3;
count[2] = 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ /* Initialize expect_dst_buf */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
dst_i = 0;
- for(i=3; i<5; i++)
- for(j=2; j<5; j++)
- for(k=4; k<6; k++)
+ for (i = 3; i < 5; i++)
+ for (j = 2; j < 5; j++)
+ for (k = 4; k < 6; k++)
expect_dst_buf[dst_i++] = src_buf[i][j][k];
/* Loop over buffer sizes */
- for(dst_buf_size=1; dst_buf_size<=13; dst_buf_size++) {
+ for (dst_buf_size = 1; dst_buf_size <= 13; dst_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Initialize gather_info */
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.max_nelmts = dst_buf_size;
- gather_info.last_call = FALSE;
+ gather_info.max_nelmts = dst_buf_size;
+ gather_info.last_call = FALSE;
/* Gather data */
- if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0)
+ if (H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb,
+ &gather_info) < 0)
TEST_ERROR
/* Verify that all data has been gathered (and verified) */
- if(gather_info.expect_dst_buf - expect_dst_buf != 12) TEST_ERROR
+ if (gather_info.expect_dst_buf - expect_dst_buf != 12)
+ TEST_ERROR
} /* end for */
-
/*
* Test 3: Multiple blocks
*/
/* Select hyperslab */
- start[0] = 1;
- start[1] = 1;
- start[2] = 1;
+ start[0] = 1;
+ start[1] = 1;
+ start[2] = 1;
stride[0] = 3;
stride[1] = 4;
stride[2] = 5;
- count[0] = 3;
- count[1] = 1;
- count[2] = 2;
- block[0] = 1;
- block[1] = 3;
- block[2] = 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride ,count, block) < 0)
+ count[0] = 3;
+ count[1] = 1;
+ count[2] = 2;
+ block[0] = 1;
+ block[1] = 3;
+ block[2] = 2;
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- /* Iterate over block containing selection, checking if each element is in
- * selection. Note that the algorithm used here (if statement) would not
- * work for overlapping hyperslabs. */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ /* Initialize expect_dst_buf */
+ /* Iterate over block containing selection, checking if each element is in
+ * selection. Note that the algorithm used here (if statement) would not
+ * work for overlapping hyperslabs. */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
dst_i = 0;
- for(i=1; i<8; i++)
- for(j=1; j<4; j++)
- for(k=1; k<8; k++)
- if((hsize_t)i >= start[0]
- && ((hsize_t)i - start[0]) % stride[0] < block[0]
- && ((hsize_t)i - start[0]) / stride[0] < count[0]
- && (hsize_t)j >= start[1]
- && ((hsize_t)j - start[1]) % stride[1] < block[1]
- && ((hsize_t)j - start[1]) / stride[1] < count[1]
- && (hsize_t)k >= start[2]
- && ((hsize_t)k - start[2]) % stride[2] < block[2]
- && ((hsize_t)k - start[2]) / stride[2] < count[2])
+ for (i = 1; i < 8; i++)
+ for (j = 1; j < 4; j++)
+ for (k = 1; k < 8; k++)
+ if ((hsize_t)i >= start[0] && ((hsize_t)i - start[0]) % stride[0] < block[0] &&
+ ((hsize_t)i - start[0]) / stride[0] < count[0] && (hsize_t)j >= start[1] &&
+ ((hsize_t)j - start[1]) % stride[1] < block[1] &&
+ ((hsize_t)j - start[1]) / stride[1] < count[1] && (hsize_t)k >= start[2] &&
+ ((hsize_t)k - start[2]) % stride[2] < block[2] &&
+ ((hsize_t)k - start[2]) / stride[2] < count[2])
expect_dst_buf[dst_i++] = src_buf[i][j][k];
/* Loop over buffer sizes */
- for(dst_buf_size=1; dst_buf_size<=37; dst_buf_size++) {
+ for (dst_buf_size = 1; dst_buf_size <= 37; dst_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Initialize gather_info */
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.max_nelmts = dst_buf_size;
- gather_info.last_call = FALSE;
+ gather_info.max_nelmts = dst_buf_size;
+ gather_info.last_call = FALSE;
/* Gather data */
- if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0)
+ if (H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb,
+ &gather_info) < 0)
TEST_ERROR
/* Verify that all data has been gathered (and verified) */
- if(gather_info.expect_dst_buf - expect_dst_buf != 36) TEST_ERROR
+ if (gather_info.expect_dst_buf - expect_dst_buf != 36)
+ TEST_ERROR
} /* end for */
-
/*
* Test 4: Compound selection
*/
@@ -12497,7 +13682,7 @@ test_gather(void)
count[0] = 2;
count[1] = 3;
count[2] = 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start2[0] = 1;
start2[1] = 2;
@@ -12505,92 +13690,93 @@ test_gather(void)
count2[0] = 3;
count2[1] = 2;
count2[2] = 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_XOR, start2, NULL ,count2, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_XOR, start2, NULL, count2, NULL) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- /* Iterate over block containing selection, checking if each element is in
- * selection. */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ /* Initialize expect_dst_buf */
+ /* Iterate over block containing selection, checking if each element is in
+ * selection. */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
dst_i = 0;
- for(i=1; i<4; i++)
- for(j=1; j<4; j++)
- for(k=1; k<4; k++)
- if(!(((hsize_t)i >= start[0] && (hsize_t)i < start[0] + count[0])
- && ((hsize_t)j >= start[1] && (hsize_t)j < start[1] + count[1])
- && ((hsize_t)k >= start[2] && (hsize_t)k < start[2] + count[2]))
- != !(((hsize_t)i >= start2[0] && (hsize_t)i < start2[0] + count2[0])
- && ((hsize_t)j >= start2[1] && (hsize_t)j < start2[1] + count2[1])
- && ((hsize_t)k >= start2[2] && (hsize_t)k < start2[2] + count2[2])))
+ for (i = 1; i < 4; i++)
+ for (j = 1; j < 4; j++)
+ for (k = 1; k < 4; k++)
+ if (!(((hsize_t)i >= start[0] && (hsize_t)i < start[0] + count[0]) &&
+ ((hsize_t)j >= start[1] && (hsize_t)j < start[1] + count[1]) &&
+ ((hsize_t)k >= start[2] && (hsize_t)k < start[2] + count[2])) !=
+ !(((hsize_t)i >= start2[0] && (hsize_t)i < start2[0] + count2[0]) &&
+ ((hsize_t)j >= start2[1] && (hsize_t)j < start2[1] + count2[1]) &&
+ ((hsize_t)k >= start2[2] && (hsize_t)k < start2[2] + count2[2])))
expect_dst_buf[dst_i++] = src_buf[i][j][k];
/* Loop over buffer sizes */
- for(dst_buf_size=1; dst_buf_size<=17; dst_buf_size++) {
+ for (dst_buf_size = 1; dst_buf_size <= 17; dst_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Initialize gather_info */
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.max_nelmts = dst_buf_size;
- gather_info.last_call = FALSE;
+ gather_info.max_nelmts = dst_buf_size;
+ gather_info.last_call = FALSE;
/* Gather data */
- if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0)
+ if (H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb,
+ &gather_info) < 0)
TEST_ERROR
/* Verify that all data has been gathered (and verified) */
- if(gather_info.expect_dst_buf - expect_dst_buf != 16) TEST_ERROR
+ if (gather_info.expect_dst_buf - expect_dst_buf != 16)
+ TEST_ERROR
} /* end for */
-
/*
* Test 5: Point selection
*/
/* Select hyperslabs */
- if(H5Sselect_elements(sid, H5S_SELECT_SET, sizeof(point) / sizeof(point[0]), (hsize_t *)point) < 0)
+ if (H5Sselect_elements(sid, H5S_SELECT_SET, sizeof(point) / sizeof(point[0]), (hsize_t *)point) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- /* Iterate over block containing selection, checking if each element is in
- * selection. */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
- for(i=0; i<(int)(sizeof(point) / sizeof(point[0])); i++)
+ /* Initialize expect_dst_buf */
+ /* Iterate over block containing selection, checking if each element is in
+ * selection. */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ for (i = 0; i < (int)(sizeof(point) / sizeof(point[0])); i++)
expect_dst_buf[i] = src_buf[point[i][0]][point[i][1]][point[i][2]];
/* Loop over buffer sizes */
- for(dst_buf_size=1; dst_buf_size<=5; dst_buf_size++) {
+ for (dst_buf_size = 1; dst_buf_size <= 5; dst_buf_size++) {
/* Reset dst_buf */
(void)HDmemset(dst_buf, 0, sizeof(dst_buf));
/* Initialize gather_info */
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.max_nelmts = dst_buf_size;
- gather_info.last_call = FALSE;
+ gather_info.max_nelmts = dst_buf_size;
+ gather_info.last_call = FALSE;
/* Gather data */
- if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0)
+ if (H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb,
+ &gather_info) < 0)
TEST_ERROR
/* Verify that all data has been gathered (and verified) */
- if(gather_info.expect_dst_buf - expect_dst_buf != 4) TEST_ERROR
+ if (gather_info.expect_dst_buf - expect_dst_buf != 4)
+ TEST_ERROR
} /* end for */
-
/* Close everything */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Sclose(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Sclose(sid); }
+ H5E_END_TRY;
return FAIL;
} /* end test_gather() */
-
/*-------------------------------------------------------------------------
* Function: test_scatter_error
*
@@ -12606,47 +13792,45 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-scatter_error_cb_fail(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/,
- void *_scatter_info)
+scatter_error_cb_fail(void **src_buf /*out*/, size_t *src_buf_bytes_used /*out*/, void *_scatter_info)
{
scatter_info_t *scatter_info = (scatter_info_t *)_scatter_info;
- size_t nelmts; /* Number of elements to return in src_buf */
+ size_t nelmts; /* Number of elements to return in src_buf */
/* Calculate number of elements */
nelmts = MIN(scatter_info->block, scatter_info->size);
HDassert(nelmts > 0);
/* Set output variables */
- *src_buf = (void *)scatter_info->src_buf;
+ *src_buf = (void *)scatter_info->src_buf;
*src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]);
return FAIL;
} /* end scatter_error_cb_fail() */
static herr_t
-scatter_error_cb_null(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/,
- void *_scatter_info)
+scatter_error_cb_null(void **src_buf /*out*/, size_t *src_buf_bytes_used /*out*/, void *_scatter_info)
{
scatter_info_t *scatter_info = (scatter_info_t *)_scatter_info;
- size_t nelmts; /* Number of elements to return in src_buf */
+ size_t nelmts; /* Number of elements to return in src_buf */
/* Calculate number of elements */
nelmts = MIN(scatter_info->block, scatter_info->size);
HDassert(nelmts > 0);
/* Set output variables */
- *src_buf = NULL;
+ *src_buf = NULL;
*src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]);
return SUCCEED;
} /* end scatter_error_cb_null() */
static herr_t
-scatter_error_cb_unalign(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/,
- void *_src_buf_bytes_used)
+scatter_error_cb_unalign(void **src_buf /*out*/, size_t *src_buf_bytes_used /*out*/,
+ void *_src_buf_bytes_used)
{
/* Set output variables */
- *src_buf = _src_buf_bytes_used;
+ *src_buf = _src_buf_bytes_used;
*src_buf_bytes_used = *(size_t *)_src_buf_bytes_used;
return SUCCEED;
@@ -12655,145 +13839,168 @@ scatter_error_cb_unalign(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*
static herr_t
test_scatter_error(void)
{
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dim[1] = {10}; /* Dataspace dimensions */
- hsize_t start[3] = {2};
- hsize_t count[3] = {6};
- int src_buf[7]; /* Source data buffer */
- int dst_buf[10]; /* Destination data buffer */
- scatter_info_t scatter_info; /* Operator data for callback */
- size_t cb_unalign_nbytes; /* Number of bytes to return for unaligned test */
- herr_t ret; /* Return value */
- int i; /* Local index variable */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dim[1] = {10}; /* Dataspace dimensions */
+ hsize_t start[3] = {2};
+ hsize_t count[3] = {6};
+ int src_buf[7]; /* Source data buffer */
+ int dst_buf[10]; /* Destination data buffer */
+ scatter_info_t scatter_info; /* Operator data for callback */
+ size_t cb_unalign_nbytes; /* Number of bytes to return for unaligned test */
+ herr_t ret; /* Return value */
+ int i; /* Local index variable */
TESTING("H5Dscatter() error conditions");
/* Create dataspace */
- if((sid = H5Screate_simple(1, dim, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim, NULL)) < 0)
+ TEST_ERROR
/* Initialize src_buf */
- for(i=0; i<(int)(sizeof(src_buf)/sizeof(src_buf[0])); i++)
+ for (i = 0; i < (int)(sizeof(src_buf) / sizeof(src_buf[0])); i++)
src_buf[i] = i + 1;
/* Select hyperslab */
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Verify that base configuration passes */
scatter_info.src_buf = src_buf;
- scatter_info.block = sizeof(src_buf)/sizeof(src_buf[0]);
- scatter_info.size = 6;
- if(H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
+ scatter_info.block = sizeof(src_buf) / sizeof(src_buf[0]);
+ scatter_info.size = 6;
+ if (H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0)
TEST_ERROR
-
/*
* Test invalid parameters
*/
scatter_info.src_buf = src_buf;
- scatter_info.size = 6;
- H5E_BEGIN_TRY {
- ret = H5Dscatter(NULL, NULL, H5T_NATIVE_INT, sid, dst_buf);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ scatter_info.size = 6;
+ H5E_BEGIN_TRY { ret = H5Dscatter(NULL, NULL, H5T_NATIVE_INT, sid, dst_buf); }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
scatter_info.src_buf = src_buf;
- scatter_info.size = 6;
- H5E_BEGIN_TRY {
- ret = H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, sid, sid, dst_buf);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ scatter_info.size = 6;
+ H5E_BEGIN_TRY { ret = H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, sid, sid, dst_buf); }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
scatter_info.src_buf = src_buf;
- scatter_info.size = 6;
- H5E_BEGIN_TRY {
- ret = H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, H5T_NATIVE_INT, dst_buf);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ scatter_info.size = 6;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, H5T_NATIVE_INT,
+ dst_buf);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
scatter_info.src_buf = src_buf;
- scatter_info.size = 6;
- H5E_BEGIN_TRY {
+ scatter_info.size = 6;
+ H5E_BEGIN_TRY
+ {
ret = H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, NULL);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
-
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
/*
* Test returning too many elements in callback
*/
scatter_info.src_buf = src_buf;
- scatter_info.size = 7;
- H5E_BEGIN_TRY {
+ scatter_info.size = 7;
+ H5E_BEGIN_TRY
+ {
ret = H5Dscatter((H5D_scatter_func_t)scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
-
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
/*
* Test callback returns failure
*/
scatter_info.src_buf = src_buf;
- scatter_info.size = 6;
- H5E_BEGIN_TRY {
- ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_fail, &scatter_info, H5T_NATIVE_INT, sid, dst_buf);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
-
+ scatter_info.size = 6;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_fail, &scatter_info, H5T_NATIVE_INT, sid,
+ dst_buf);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
/*
* Test callback returns NULL buffer
*/
scatter_info.src_buf = src_buf;
- scatter_info.size = 6;
- H5E_BEGIN_TRY {
- ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_null, &scatter_info, H5T_NATIVE_INT, sid, dst_buf);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
-
+ scatter_info.size = 6;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_null, &scatter_info, H5T_NATIVE_INT, sid,
+ dst_buf);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
/*
* Test callback returns 0 for src_buf_bytes_used
*/
cb_unalign_nbytes = 0;
- H5E_BEGIN_TRY {
- ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_unalign, &cb_unalign_nbytes, H5T_NATIVE_INT, sid, dst_buf);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
-
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_unalign, &cb_unalign_nbytes, H5T_NATIVE_INT,
+ sid, dst_buf);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
/*
* Test callback returns src_buf_bytes_used that is not a multiple of
* datatype size
*/
cb_unalign_nbytes = sizeof(src_buf[0]) - 1;
- H5E_BEGIN_TRY {
- ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_unalign, &cb_unalign_nbytes, H5T_NATIVE_INT, sid, dst_buf);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_unalign, &cb_unalign_nbytes, H5T_NATIVE_INT,
+ sid, dst_buf);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
cb_unalign_nbytes = sizeof(src_buf[0]) + 1;
- H5E_BEGIN_TRY {
- ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_unalign, &cb_unalign_nbytes, H5T_NATIVE_INT, sid, dst_buf);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
-
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dscatter((H5D_scatter_func_t)scatter_error_cb_unalign, &cb_unalign_nbytes, H5T_NATIVE_INT,
+ sid, dst_buf);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
/* Close everything */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Sclose(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Sclose(sid); }
+ H5E_END_TRY;
return FAIL;
} /* end test_scatter_error() */
-
/*-------------------------------------------------------------------------
* Function: test_gather_error
*
@@ -12809,8 +14016,8 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-gather_error_cb_fail(const void H5_ATTR_UNUSED *dst_buf,
- size_t H5_ATTR_UNUSED dst_buf_bytes_used, void H5_ATTR_UNUSED *op_data)
+gather_error_cb_fail(const void H5_ATTR_UNUSED *dst_buf, size_t H5_ATTR_UNUSED dst_buf_bytes_used,
+ void H5_ATTR_UNUSED *op_data)
{
return FAIL;
} /* end gather_error_cb_fail() */
@@ -12818,117 +14025,136 @@ gather_error_cb_fail(const void H5_ATTR_UNUSED *dst_buf,
static herr_t
test_gather_error(void)
{
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dim[1] = {10}; /* Dataspace dimensions */
- hsize_t start[1] = {2};
- hsize_t count[1] = {6};
- int src_buf[10]; /* Source data buffer */
- int dst_buf[6]; /* Destination data buffer */
- int expect_dst_buf[6]; /* Expected destination data buffer */
- gather_info_t gather_info; /* Operator data for callback */
- herr_t ret; /* Return value */
- int i; /* Local index variable */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dim[1] = {10}; /* Dataspace dimensions */
+ hsize_t start[1] = {2};
+ hsize_t count[1] = {6};
+ int src_buf[10]; /* Source data buffer */
+ int dst_buf[6]; /* Destination data buffer */
+ int expect_dst_buf[6]; /* Expected destination data buffer */
+ gather_info_t gather_info; /* Operator data for callback */
+ herr_t ret; /* Return value */
+ int i; /* Local index variable */
TESTING("H5Dgather() error conditions");
/* Create dataspace */
- if((sid = H5Screate_simple(1, dim, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim, NULL)) < 0)
+ TEST_ERROR
/* Initialize src_buf */
- for(i=0; i<(int)(sizeof(src_buf)/sizeof(src_buf[0])); i++)
+ for (i = 0; i < (int)(sizeof(src_buf) / sizeof(src_buf[0])); i++)
src_buf[i] = 1 + i;
/* Select hyperslab */
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- /* Initialize expect_dst_buf */
- (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
- for(i=0; i<6; i++)
+ /* Initialize expect_dst_buf */
+ (void) HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf));
+ for (i = 0; i < 6; i++)
expect_dst_buf[i] = src_buf[i + 2];
/* Verify that base configuration passes */
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.max_nelmts = 6;
- gather_info.last_call = FALSE;
- if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0)
+ gather_info.max_nelmts = 6;
+ gather_info.last_call = FALSE;
+ if (H5Dgather(sid, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0)
TEST_ERROR
/*
* Test invalid parameters
*/
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.last_call = FALSE;
- H5E_BEGIN_TRY {
- ret = H5Dgather(H5T_NATIVE_INT, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ gather_info.last_call = FALSE;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dgather(H5T_NATIVE_INT, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb,
+ &gather_info);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.last_call = FALSE;
- H5E_BEGIN_TRY {
+ gather_info.last_call = FALSE;
+ H5E_BEGIN_TRY
+ {
ret = H5Dgather(sid, NULL, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.last_call = FALSE;
- H5E_BEGIN_TRY {
+ gather_info.last_call = FALSE;
+ H5E_BEGIN_TRY
+ {
ret = H5Dgather(sid, src_buf, sid, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.last_call = FALSE;
- H5E_BEGIN_TRY {
- ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 0, dst_buf, gather_cb, &gather_info);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ gather_info.last_call = FALSE;
+ H5E_BEGIN_TRY { ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 0, dst_buf, gather_cb, &gather_info); }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.last_call = FALSE;
- H5E_BEGIN_TRY {
- ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 1, dst_buf, gather_cb, &gather_info);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ gather_info.last_call = FALSE;
+ H5E_BEGIN_TRY { ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 1, dst_buf, gather_cb, &gather_info); }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.last_call = FALSE;
- H5E_BEGIN_TRY {
+ gather_info.last_call = FALSE;
+ H5E_BEGIN_TRY
+ {
ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), NULL, gather_cb, &gather_info);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.last_call = FALSE;
- H5E_BEGIN_TRY {
+ gather_info.last_call = FALSE;
+ H5E_BEGIN_TRY
+ {
ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 5 * sizeof(dst_buf[0]), dst_buf, NULL, &gather_info);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
-
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
/*
* Test callback returns failure
*/
gather_info.expect_dst_buf = expect_dst_buf;
- gather_info.last_call = FALSE;
- H5E_BEGIN_TRY {
- ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_error_cb_fail, NULL);
- } H5E_END_TRY
- if(ret >= 0) TEST_ERROR
-
+ gather_info.last_call = FALSE;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_error_cb_fail,
+ NULL);
+ }
+ H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR
/* Close everything */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Sclose(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Sclose(sid); }
+ H5E_END_TRY;
return FAIL;
} /* end test_gather_error() */
@@ -13015,55 +14241,65 @@ error:
*-------------------------------------------------------------------------
*/
-#define DLS_01_DATASET "data"
-#define DLS_01_STR_SIZE 256
-#define DLS_01_CHUNK_SIZE 8
-#define DLS_01_DIMS 4
+#define DLS_01_DATASET "data"
+#define DLS_01_STR_SIZE 256
+#define DLS_01_CHUNK_SIZE 8
+#define DLS_01_DIMS 4
-static herr_t dls_01_setup_file( hid_t fid );
-static herr_t dls_01_write_data( hid_t fid, char* buffer );
-static herr_t dls_01_read_stuff( hid_t fid );
-static herr_t dls_01_main( void );
+static herr_t dls_01_setup_file(hid_t fid);
+static herr_t dls_01_write_data(hid_t fid, char *buffer);
+static herr_t dls_01_read_stuff(hid_t fid);
+static herr_t dls_01_main(void);
static herr_t
-dls_01_setup_file( hid_t fid )
+dls_01_setup_file(hid_t fid)
{
- int status = 0;
- hid_t sid = 0, did = 0, tid = 0, dcpl = 0;
- int ndims = 1;
- hsize_t max_shape[1] = {H5S_UNLIMITED};
+ int status = 0;
+ hid_t sid = 0, did = 0, tid = 0, dcpl = 0;
+ int ndims = 1;
+ hsize_t max_shape[1] = {H5S_UNLIMITED};
hsize_t initial_shape[1] = {0};
- hsize_t chunks[1] = {DLS_01_CHUNK_SIZE};
+ hsize_t chunks[1] = {DLS_01_CHUNK_SIZE};
- sid = H5Screate_simple( ndims, initial_shape, max_shape );
- if ( sid <= 0 ) TEST_ERROR
+ sid = H5Screate_simple(ndims, initial_shape, max_shape);
+ if (sid <= 0)
+ TEST_ERROR
- tid = H5Tcopy( H5T_C_S1 );
- if ( tid <= 0 ) TEST_ERROR
+ tid = H5Tcopy(H5T_C_S1);
+ if (tid <= 0)
+ TEST_ERROR
- status = H5Tset_size( tid, DLS_01_STR_SIZE );
- if ( status != 0 ) TEST_ERROR
+ status = H5Tset_size(tid, DLS_01_STR_SIZE);
+ if (status != 0)
+ TEST_ERROR
- dcpl = H5Pcreate( H5P_DATASET_CREATE );
- if ( dcpl <= 0 ) TEST_ERROR
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ if (dcpl <= 0)
+ TEST_ERROR
- status = H5Pset_chunk( dcpl, ndims, chunks );
- if ( status != 0 ) TEST_ERROR
+ status = H5Pset_chunk(dcpl, ndims, chunks);
+ if (status != 0)
+ TEST_ERROR
- did = H5Dcreate2( fid, DLS_01_DATASET, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT );
- if ( did <= 0 ) TEST_ERROR
+ did = H5Dcreate2(fid, DLS_01_DATASET, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (did <= 0)
+ TEST_ERROR
- status = H5Dclose( did );
- if ( status != 0 ) TEST_ERROR
+ status = H5Dclose(did);
+ if (status != 0)
+ TEST_ERROR
- status = H5Pclose( dcpl );
- if ( status != 0 ) TEST_ERROR
+ status = H5Pclose(dcpl);
+ if (status != 0)
+ TEST_ERROR
- status = H5Tclose( tid );
- if ( status != 0 ) TEST_ERROR
+ status = H5Tclose(tid);
+ if (status != 0)
+ TEST_ERROR
- status = H5Sclose( sid );
- if ( status != 0 ) TEST_ERROR
+ status = H5Sclose(sid);
+ if (status != 0)
+ TEST_ERROR
return SUCCEED;
@@ -13072,32 +14308,39 @@ error:
} /* end dls_01_setup_file() */
static herr_t
-dls_01_write_data( hid_t fid, char* buffer )
+dls_01_write_data(hid_t fid, char *buffer)
{
- int status = 0;
- hid_t did = 0, tid = 0;
+ int status = 0;
+ hid_t did = 0, tid = 0;
hsize_t extent[1] = {4};
- did = H5Dopen2( fid, DLS_01_DATASET, H5P_DEFAULT );
- if ( did <= 0 ) TEST_ERROR
+ did = H5Dopen2(fid, DLS_01_DATASET, H5P_DEFAULT);
+ if (did <= 0)
+ TEST_ERROR
- tid = H5Dget_type( did );
- if ( tid <= 0 ) TEST_ERROR
+ tid = H5Dget_type(did);
+ if (tid <= 0)
+ TEST_ERROR
- status = H5Dset_extent( did, extent );
- if ( status != 0 ) TEST_ERROR
+ status = H5Dset_extent(did, extent);
+ if (status != 0)
+ TEST_ERROR
- status = H5Dwrite( did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer );
- if ( status != 0 ) TEST_ERROR
+ status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
+ if (status != 0)
+ TEST_ERROR
- status = H5Fflush( fid, H5F_SCOPE_LOCAL );
- if ( status != 0 ) TEST_ERROR
+ status = H5Fflush(fid, H5F_SCOPE_LOCAL);
+ if (status != 0)
+ TEST_ERROR
- status = H5Tclose( tid );
- if ( status != 0 ) TEST_ERROR
+ status = H5Tclose(tid);
+ if (status != 0)
+ TEST_ERROR
- status = H5Dclose( did );
- if ( status != 0 ) TEST_ERROR
+ status = H5Dclose(did);
+ if (status != 0)
+ TEST_ERROR
return SUCCEED;
@@ -13108,20 +14351,20 @@ error:
static herr_t
dls_01_read_stuff(hid_t fid)
{
- int status = 0;
- hid_t did = 0;
+ int status = 0;
+ hid_t did = 0;
H5O_info2_t info;
did = H5Dopen2(fid, DLS_01_DATASET, H5P_DEFAULT);
- if(did <= 0)
+ if (did <= 0)
TEST_ERROR
status = H5Oget_info3(did, &info, H5O_INFO_BASIC);
- if(status != 0)
+ if (status != 0)
TEST_ERROR
status = H5Dclose(did);
- if(status != 0)
+ if (status != 0)
TEST_ERROR
return SUCCEED;
@@ -13131,59 +14374,64 @@ error:
} /* end dls_01_read_stuff() */
static herr_t
-dls_01_main( void )
+dls_01_main(void)
{
- char filename[512];
- int status = 0;
- hid_t fapl = 0, fid = 0;
- const char* strings[DLS_01_DIMS] =
- { "String 1", "Test string 2", "Another string", "Final String" };
- char* buffer = NULL;
+ char filename[512];
+ int status = 0;
+ hid_t fapl = 0, fid = 0;
+ const char *strings[DLS_01_DIMS] = {"String 1", "Test string 2", "Another string", "Final String"};
+ char * buffer = NULL;
TESTING("Testing DLS bugfix 1");
- if ( NULL == h5_fixname(FILENAME[23], H5P_DEFAULT, filename,
- sizeof(filename)) )
- TEST_ERROR
+ if (NULL == h5_fixname(FILENAME[23], H5P_DEFAULT, filename, sizeof(filename)))
+ TEST_ERROR
- buffer = (char *)HDcalloc( DLS_01_DIMS, DLS_01_STR_SIZE );
- if ( NULL == buffer )
+ buffer = (char *)HDcalloc(DLS_01_DIMS, DLS_01_STR_SIZE);
+ if (NULL == buffer)
TEST_ERROR
- HDstrcpy( buffer, strings[0] );
- HDstrcpy( buffer + DLS_01_STR_SIZE, strings[1] );
- HDstrcpy( buffer + DLS_01_STR_SIZE * 2, strings[2] );
- HDstrcpy( buffer + DLS_01_STR_SIZE * 3, strings[3] );
+ HDstrcpy(buffer, strings[0]);
+ HDstrcpy(buffer + DLS_01_STR_SIZE, strings[1]);
+ HDstrcpy(buffer + DLS_01_STR_SIZE * 2, strings[2]);
+ HDstrcpy(buffer + DLS_01_STR_SIZE * 3, strings[3]);
- fapl = H5Pcreate( H5P_FILE_ACCESS );
- if ( fapl <= 0 ) TEST_ERROR
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ if (fapl <= 0)
+ TEST_ERROR
- status = H5Pset_libver_bounds( fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST );
- if ( status != 0 ) TEST_ERROR
+ status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ if (status != 0)
+ TEST_ERROR
- fid = H5Fcreate( filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl );
- if ( fid <= 0 ) TEST_ERROR
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ if (fid <= 0)
+ TEST_ERROR
- if ( 0 != dls_01_setup_file( fid ) )
- goto error;
+ if (0 != dls_01_setup_file(fid))
+ goto error;
- if ( 0 != dls_01_write_data( fid, buffer ) )
- goto error;
+ if (0 != dls_01_write_data(fid, buffer))
+ goto error;
- status = H5Fclose( fid );
- if ( status != 0 ) TEST_ERROR
+ status = H5Fclose(fid);
+ if (status != 0)
+ TEST_ERROR
- fid = H5Fopen( filename, H5F_ACC_RDONLY, fapl );
- if ( fid <= 0 ) TEST_ERROR
+ fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
+ if (fid <= 0)
+ TEST_ERROR
- if ( 0 != dls_01_read_stuff( fid ) )
- goto error;
+ if (0 != dls_01_read_stuff(fid))
+ goto error;
- status = H5Fclose( fid );
- if ( status != 0 ) TEST_ERROR
+ status = H5Fclose(fid);
+ if (status != 0)
+ TEST_ERROR
- status = H5Pclose( fapl );
- if ( status != 0 ) TEST_ERROR
+ status = H5Pclose(fapl);
+ if (status != 0)
+ TEST_ERROR
HDfree(buffer);
@@ -13192,7 +14440,8 @@ dls_01_main( void )
return SUCCEED;
error:
- if ( buffer ) HDfree(buffer);
+ if (buffer)
+ HDfree(buffer);
return FAIL;
} /* end dls_01_main() */
@@ -13217,104 +14466,105 @@ error:
static herr_t
test_compact_open_close_dirty(hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* Dataset creation property list */
- hsize_t dims[1] = {10}; /* Dimension */
- int wbuf[10]; /* Data buffer */
- char filename[FILENAME_BUF_SIZE]; /* Filename */
- int i; /* Local index variable */
- hbool_t dirty; /* The dirty flag */
+ hid_t fid = -1; /* File ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hsize_t dims[1] = {10}; /* Dimension */
+ int wbuf[10]; /* Data buffer */
+ char filename[FILENAME_BUF_SIZE]; /* Filename */
+ int i; /* Local index variable */
+ hbool_t dirty; /* The dirty flag */
TESTING("compact dataset repeated open/close and dirty flag");
/* Create a file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Initialize data */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
wbuf[i] = i;
/* Create dataspace */
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
TEST_ERROR
/* Set compact layout */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_layout(dcpl, H5D_COMPACT) < 0)
+ if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
TEST_ERROR
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
TEST_ERROR
/* Create a compact dataset */
- if((did = H5Dcreate2(fid, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) <
+ 0)
TEST_ERROR
/* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
/* Verify the repeated open/close of the dataset will not fail */
- for(i = 0; i < 20;i++) {
- H5E_BEGIN_TRY {
- did = H5Dopen2 (fid, DSET_COMPACT_MAX_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
- if(did < 0)
+ for (i = 0; i < 20; i++) {
+ H5E_BEGIN_TRY { did = H5Dopen2(fid, DSET_COMPACT_MAX_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (did < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
}
/* Open the dataset */
- if((did = H5Dopen2(fid, DSET_COMPACT_MAX_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_COMPACT_MAX_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Retrieve the "dirty" flag from the compact dataset layout */
- if(H5D__layout_compact_dirty_test(did, &dirty) < 0)
+ if (H5D__layout_compact_dirty_test(did, &dirty) < 0)
TEST_ERROR
/* Verify that the "dirty" flag is false */
- if(dirty)
+ if (dirty)
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
/* Close the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/* Close the dataset creation property list */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
- PASSED();
- return SUCCEED;
+ PASSED();
+ return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Pclose(dcpl);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_compact_open_close_dirty() */
-
/*-------------------------------------------------------------------------
* Function: test_versionbounds
*
@@ -13331,129 +14581,137 @@ error:
*
*-------------------------------------------------------------------------
*/
-#define VDS_FNAME1 "virtual_file1"
-#define VDS_FNAME2 "virtual_file2"
-#define SRC_FNAME "source_file"
-#define SRC_DSET "src_dset"
-#define V_DSET "v_dset"
+#define VDS_FNAME1 "virtual_file1"
+#define VDS_FNAME2 "virtual_file2"
+#define SRC_FNAME "source_file"
+#define SRC_DSET "src_dset"
+#define V_DSET "v_dset"
static herr_t
test_versionbounds(void)
{
- hid_t fapl = -1;
- hid_t srcfile = -1; /* Files with source dsets */
- hid_t vfile = -1; /* File with virtual dset */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t srcspace = -1; /* Source dataspaces */
- hid_t vspace = -1; /* Virtual dset dataspaces */
- hid_t srcdset = -1; /* Source datset */
- hid_t vdset = -1; /* Virtual dataset */
- hsize_t dims[1] = {3}; /* Data space current size */
- char srcfilename[FILENAME_BUF_SIZE];
- char vfilename1[FILENAME_BUF_SIZE];
- char vfilename2[FILENAME_BUF_SIZE];
- H5F_libver_t low, high; /* File format bounds */
- herr_t ret; /* Generic return value */
+ hid_t fapl = -1;
+ hid_t srcfile = -1; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t srcspace = -1; /* Source dataspaces */
+ hid_t vspace = -1; /* Virtual dset dataspaces */
+ hid_t srcdset = -1; /* Source datset */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[1] = {3}; /* Data space current size */
+ char srcfilename[FILENAME_BUF_SIZE];
+ char vfilename1[FILENAME_BUF_SIZE];
+ char vfilename2[FILENAME_BUF_SIZE];
+ H5F_libver_t low, high; /* File format bounds */
+ herr_t ret; /* Generic return value */
TESTING("version bounds of datasets");
/* Create a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR
h5_fixname(VDS_FNAME1, fapl, vfilename1, sizeof vfilename1);
h5_fixname(VDS_FNAME2, fapl, vfilename2, sizeof vfilename2);
h5_fixname(SRC_FNAME, fapl, srcfilename, sizeof srcfilename);
/* Create DCPL */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create source dataspace */
- if((srcspace = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((srcspace = H5Screate_simple(1, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((vspace = H5Screate_simple(1, dims, NULL)) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace, srcfilename, SRC_DSET, srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace, srcfilename, SRC_DSET, srcspace) < 0)
TEST_ERROR
/* Loop through all the combinations of low/high library format bounds */
/* Create a source file and a dataset in it. Create a virtual file and
virtual dataset. Creation of virtual dataset should only succeed in
H5F_LIBVER_V110 */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds, skip for invalid low/high combination */
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(fapl, low, high);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
continue;
/* Create a source file and dataset */
- if((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if((srcdset = H5Dcreate2(srcfile, SRC_DSET, H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset = H5Dcreate2(srcfile, SRC_DSET, H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create a virtual file */
- if((vfile = H5Fcreate(vfilename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create the virtual dataset */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
vdset = H5Dcreate2(vfile, V_DSET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
if (vdset > 0) /* dataset created successfully */
{
/* Virtual dataset is only available starting in V110 */
VERIFY(high >= H5F_LIBVER_V110, TRUE, "virtual dataset");
- if(H5Dclose(vdset) < 0) TEST_ERROR
+ if (H5Dclose(vdset) < 0)
+ TEST_ERROR
vdset = -1;
}
/* Close virtual file */
- if(H5Fclose(vfile) < 0) TEST_ERROR
+ if (H5Fclose(vfile) < 0)
+ TEST_ERROR
vfile = -1;
/* Close srcdset and srcfile */
- if(H5Dclose(srcdset) < 0) TEST_ERROR
+ if (H5Dclose(srcdset) < 0)
+ TEST_ERROR
srcdset = -1;
- if(H5Fclose(srcfile) < 0) TEST_ERROR
+ if (H5Fclose(srcfile) < 0)
+ TEST_ERROR
srcfile = -1;
} /* for high */
- } /* for low */
+ } /* for low */
/* Close dataspaces and properties */
- if(H5Sclose(srcspace) < 0)
+ if (H5Sclose(srcspace) < 0)
TEST_ERROR
srcspace = -1;
- if(H5Sclose(vspace) < 0)
+ if (H5Sclose(vspace) < 0)
TEST_ERROR
vspace = -1;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
fapl = -1;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
dcpl = -1;
PASSED();
return SUCCEED;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Sclose(srcspace);
H5Sclose(vspace);
H5Pclose(dcpl);
@@ -13462,11 +14720,11 @@ test_versionbounds(void)
H5Dclose(vdset);
H5Fclose(srcfile);
H5Fclose(vfile);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_versionbounds() */
-
/*-----------------------------------------------------------------------------
* Function: test_object_header_minimization_dcpl
*
@@ -13485,11 +14743,11 @@ test_versionbounds(void)
static herr_t
test_object_header_minimization_dcpl(void)
{
- hid_t dcpl_id = -1;
- hid_t file_id = -1;
- char filename[FILENAME_BUF_SIZE] = "";
- hbool_t minimize = FALSE;
- herr_t ret;
+ hid_t dcpl_id = -1;
+ hid_t file_id = -1;
+ char filename[FILENAME_BUF_SIZE] = "";
+ hbool_t minimize = FALSE;
+ herr_t ret;
TESTING("dcpl flags to minimize dataset object header");
@@ -13497,7 +14755,7 @@ test_object_header_minimization_dcpl(void)
/* SETUP */
/*********/
- if(NULL == h5_fixname(OHMIN_FILENAME_A, H5P_DEFAULT, filename, sizeof(filename)))
+ if (NULL == h5_fixname(OHMIN_FILENAME_A, H5P_DEFAULT, filename, sizeof(filename)))
TEST_ERROR
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -13539,52 +14797,56 @@ test_object_header_minimization_dcpl(void)
/* error cases
*/
- H5E_BEGIN_TRY {
- ret = H5Pget_dset_no_attrs_hint(-1, &minimize);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pget_dset_no_attrs_hint(-1, &minimize); }
+ H5E_END_TRY;
if (ret == SUCCEED)
TEST_ERROR /* Invalid DCPL ID should fail */
- H5E_BEGIN_TRY {
- ret = H5Pset_dset_no_attrs_hint(-1, FALSE);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Pset_dset_no_attrs_hint(-1, FALSE);
+ }
+ H5E_END_TRY;
if (ret == SUCCEED)
TEST_ERROR /* Invalid DCPL ID should fail */
- H5E_BEGIN_TRY {
- ret = H5Pset_dset_no_attrs_hint(-1, TRUE);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Pset_dset_no_attrs_hint(-1, TRUE);
+ }
+ H5E_END_TRY;
if (ret == SUCCEED)
TEST_ERROR /* Invalid DCPL ID should fail */
- H5E_BEGIN_TRY {
- ret = H5Pget_dset_no_attrs_hint(dcpl_id, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Pget_dset_no_attrs_hint(dcpl_id, NULL);
+ }
+ H5E_END_TRY;
if (ret == SUCCEED)
TEST_ERROR /* NULL out pointer should fail */
- /************/
- /* TEARDOWN */
- /************/
+ /************/
+ /* TEARDOWN */
+ /************/
- if (H5Fclose(file_id) == FAIL)
- TEST_ERROR
+ if (H5Fclose(file_id) == FAIL) TEST_ERROR
- if (H5Pclose(dcpl_id) == FAIL)
- TEST_ERROR
+ if (H5Pclose(dcpl_id) == FAIL) TEST_ERROR
- PASSED();
+ PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_object_header_minimization_dcpl() */
-
/*-----------------------------------------------------------------------------
* Function: test_0sized_dset_metadata_alloc
*
@@ -13601,15 +14863,15 @@ error:
static herr_t
test_0sized_dset_metadata_alloc(hid_t fapl_id)
{
- char filename[FILENAME_BUF_SIZE] = "";
- hid_t file_id = H5I_INVALID_HID;
- hid_t fapl_id_copy = H5I_INVALID_HID;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t dcpl_id = H5I_INVALID_HID;
- hid_t dcpl_id_copy = H5I_INVALID_HID;
- hid_t dset_space_id = H5I_INVALID_HID;
- hid_t buf_space_id = H5I_INVALID_HID;
- unsigned new_format; /* Whether to use latest file format */
+ char filename[FILENAME_BUF_SIZE] = "";
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id_copy = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t dcpl_id_copy = H5I_INVALID_HID;
+ hid_t dset_space_id = H5I_INVALID_HID;
+ hid_t buf_space_id = H5I_INVALID_HID;
+ unsigned new_format; /* Whether to use latest file format */
TESTING("allocation of metadata for 0-sized datasets");
@@ -13617,144 +14879,146 @@ test_0sized_dset_metadata_alloc(hid_t fapl_id)
/* SETUP */
/*********/
- if(NULL == h5_fixname(FILENAME[26], fapl_id, filename, sizeof(filename)))
+ if (NULL == h5_fixname(FILENAME[26], fapl_id, filename, sizeof(filename)))
FAIL_STACK_ERROR
/* Create DCPL for the dataset */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
-
/*************/
/* RUN TESTS */
/*************/
/* Iterate over file format versions */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- H5D_layout_t layout; /* Dataset layout type */
- H5D_alloc_time_t alloc_time; /* Storage allocation time */
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
+ H5D_layout_t layout; /* Dataset layout type */
+ H5D_alloc_time_t alloc_time; /* Storage allocation time */
/* Copy the file access property list */
- if((fapl_id_copy = H5Pcopy(fapl_id)) < 0)
+ if ((fapl_id_copy = H5Pcopy(fapl_id)) < 0)
FAIL_STACK_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(new_format)
- if(H5Pset_libver_bounds(fapl_id_copy, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (new_format)
+ if (H5Pset_libver_bounds(fapl_id_copy, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create test file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id_copy)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id_copy)) < 0)
FAIL_STACK_ERROR
/* Close the copy of the FAPL */
- if(H5Pclose(fapl_id_copy) < 0)
+ if (H5Pclose(fapl_id_copy) < 0)
FAIL_STACK_ERROR
/* Iterate over combinations of testing parameters */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
- const hsize_t dims[1] = {0}; /* Dataset dimensions */
- const hsize_t max_dims[1] = {H5S_UNLIMITED}; /* Maximum dataset dimensions */
- const hsize_t chunk_dims[1] = {100}; /* Chunk dimensions */
- char dset_name[32]; /* Dataset name */
- H5O_native_info_t nat_info; /* Information about the dataset */
+ for (layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
+ for (alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ const hsize_t dims[1] = {0}; /* Dataset dimensions */
+ const hsize_t max_dims[1] = {H5S_UNLIMITED}; /* Maximum dataset dimensions */
+ const hsize_t chunk_dims[1] = {100}; /* Chunk dimensions */
+ char dset_name[32]; /* Dataset name */
+ H5O_native_info_t nat_info; /* Information about the dataset */
/* Compact storage must have early allocation */
- if(H5D_COMPACT == layout && H5D_ALLOC_TIME_EARLY != alloc_time)
+ if (H5D_COMPACT == layout && H5D_ALLOC_TIME_EARLY != alloc_time)
continue;
/* Compose dataset name */
- HDsnprintf(dset_name, sizeof(dset_name), "/Dataset-%u-%u", (unsigned)alloc_time, (unsigned)layout);
+ HDsnprintf(dset_name, sizeof(dset_name), "/Dataset-%u-%u", (unsigned)alloc_time,
+ (unsigned)layout);
/* Set up DCPL */
- if((dcpl_id_copy = H5Pcopy(dcpl_id)) < 0)
+ if ((dcpl_id_copy = H5Pcopy(dcpl_id)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_alloc_time(dcpl_id_copy, alloc_time) < 0)
+ if (H5Pset_alloc_time(dcpl_id_copy, alloc_time) < 0)
FAIL_STACK_ERROR
- if(H5Pset_layout(dcpl_id_copy, layout) < 0)
+ if (H5Pset_layout(dcpl_id_copy, layout) < 0)
FAIL_STACK_ERROR
- if(H5D_CHUNKED == layout)
- if(H5Pset_chunk(dcpl_id_copy, 1, chunk_dims) < 0)
+ if (H5D_CHUNKED == layout)
+ if (H5Pset_chunk(dcpl_id_copy, 1, chunk_dims) < 0)
FAIL_STACK_ERROR
/* Create the dataspace for the dataset */
- if((dset_space_id = H5Screate_simple(1, dims, (H5D_CHUNKED == layout ? max_dims : NULL))) < 0)
+ if ((dset_space_id = H5Screate_simple(1, dims, (H5D_CHUNKED == layout ? max_dims : NULL))) <
+ 0)
FAIL_STACK_ERROR
/* Create the dataset with the appropriate parameters */
- if((dset_id = H5Dcreate2(file_id, dset_name, H5T_NATIVE_INT, dset_space_id, H5P_DEFAULT, dcpl_id_copy, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(file_id, dset_name, H5T_NATIVE_INT, dset_space_id, H5P_DEFAULT,
+ dcpl_id_copy, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close objects used to create dataset */
- if(H5Pclose(dcpl_id_copy) < 0)
+ if (H5Pclose(dcpl_id_copy) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(dset_space_id) < 0)
+ if (H5Sclose(dset_space_id) < 0)
FAIL_STACK_ERROR
/* Retrieve & verify the dataset's index info */
HDmemset(&nat_info, 0, sizeof(nat_info));
- if(H5Oget_native_info(dset_id, &nat_info, H5O_NATIVE_INFO_META_SIZE) < 0)
+ if (H5Oget_native_info(dset_id, &nat_info, H5O_NATIVE_INFO_META_SIZE) < 0)
FAIL_STACK_ERROR
- if(0 != nat_info.meta_size.obj.index_size)
+ if (0 != nat_info.meta_size.obj.index_size)
FAIL_PUTS_ERROR("dataset index allocation size is non-zero")
/* If chunked, try extending and verify that the index is allocated */
- if(H5D_CHUNKED == layout) {
+ if (H5D_CHUNKED == layout) {
const hsize_t new_dims[1] = {1500}; /* New dataset dimensions */
- const hsize_t mem_dims[1] = {1}; /* Memory buffer dataset dimensions */
- const hsize_t coord = 0; /* Dataset selection coordinate */
- int val = 0; /* Data value */
+ const hsize_t mem_dims[1] = {1}; /* Memory buffer dataset dimensions */
+ const hsize_t coord = 0; /* Dataset selection coordinate */
+ int val = 0; /* Data value */
/* Extend dataset */
- if(H5Dset_extent(dset_id, new_dims) < 0)
+ if (H5Dset_extent(dset_id, new_dims) < 0)
FAIL_STACK_ERROR
/* Get the dataspace for the dataset & set single point selection */
- if((dset_space_id = H5Dget_space(dset_id)) < 0)
+ if ((dset_space_id = H5Dget_space(dset_id)) < 0)
FAIL_STACK_ERROR
- if(H5Sselect_elements(dset_space_id, H5S_SELECT_SET, (size_t)1, (const hsize_t *)&coord) < 0)
+ if (H5Sselect_elements(dset_space_id, H5S_SELECT_SET, (size_t)1,
+ (const hsize_t *)&coord) < 0)
FAIL_STACK_ERROR
/* Create memory dataspace, with only one element */
- if((buf_space_id = H5Screate_simple(1, mem_dims, NULL)) < 0)
+ if ((buf_space_id = H5Screate_simple(1, mem_dims, NULL)) < 0)
FAIL_STACK_ERROR
/* Write the data to the dataset */
- if(H5Dwrite(dset_id, H5T_NATIVE_INT, buf_space_id, dset_space_id, H5P_DEFAULT, &val) < 0)
+ if (H5Dwrite(dset_id, H5T_NATIVE_INT, buf_space_id, dset_space_id, H5P_DEFAULT, &val) < 0)
FAIL_STACK_ERROR
/* Close objects used to perform I/O */
- if(H5Sclose(dset_space_id) < 0)
+ if (H5Sclose(dset_space_id) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(buf_space_id) < 0)
+ if (H5Sclose(buf_space_id) < 0)
FAIL_STACK_ERROR
/* Retrieve & verify the dataset's index info */
HDmemset(&nat_info, 0, sizeof(nat_info));
- if(H5Oget_native_info(dset_id, &nat_info, H5O_NATIVE_INFO_META_SIZE) < 0)
+ if (H5Oget_native_info(dset_id, &nat_info, H5O_NATIVE_INFO_META_SIZE) < 0)
FAIL_STACK_ERROR
- if(0 == nat_info.meta_size.obj.index_size)
+ if (0 == nat_info.meta_size.obj.index_size)
FAIL_PUTS_ERROR("dataset index allocation size is zero")
} /* end if */
/* Close dataset */
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR
} /* end for */
- } /* end for */
+ } /* end for */
/* Close test file */
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR
} /* end for */
-
/************/
/* TEARDOWN */
/************/
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -13762,7 +15026,8 @@ test_0sized_dset_metadata_alloc(hid_t fapl_id)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dset_space_id);
H5Pclose(buf_space_id);
H5Pclose(fapl_id_copy);
@@ -13770,12 +15035,12 @@ error:
H5Pclose(dcpl_id);
H5Dclose(dset_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_0sized_dset_metadata_alloc() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -13791,24 +15056,24 @@ error:
int
main(void)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t file, grp, fapl, fapl2;
- hid_t fcpl = -1, fcpl2 = -1;
- unsigned new_format;
- unsigned paged;
- unsigned minimized_ohdr;
- int mdc_nelmts;
- size_t rdcc_nelmts;
- size_t rdcc_nbytes;
- double rdcc_w0;
- int nerrors = 0;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t file, grp, fapl, fapl2;
+ hid_t fcpl = -1, fcpl2 = -1;
+ unsigned new_format;
+ unsigned paged;
+ unsigned minimized_ohdr;
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ size_t rdcc_nbytes;
+ double rdcc_w0;
+ int nerrors = 0;
const char *envval;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
- int i;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ int i;
/* Don't run this test using certain file drivers */
envval = HDgetenv("HDF5_DRIVER");
- if(envval == NULL)
+ if (envval == NULL)
envval = "nomatch";
/* Current VFD that does not support contigous address space */
@@ -13819,33 +15084,33 @@ main(void)
/* Initialize global arrays */
/* points */
- if(NULL == (points_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ if (NULL == (points_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
TEST_ERROR;
- if(NULL == (points = (int **)HDcalloc(DSET_DIM1, sizeof(points_data))))
+ if (NULL == (points = (int **)HDcalloc(DSET_DIM1, sizeof(points_data))))
TEST_ERROR;
for (i = 0; i < DSET_DIM1; i++)
points[i] = points_data + (i * DSET_DIM2);
/* check */
- if(NULL == (check_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ if (NULL == (check_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
TEST_ERROR;
- if(NULL == (check = (int **)HDcalloc(DSET_DIM1, sizeof(check_data))))
+ if (NULL == (check = (int **)HDcalloc(DSET_DIM1, sizeof(check_data))))
TEST_ERROR;
for (i = 0; i < DSET_DIM1; i++)
check[i] = check_data + (i * DSET_DIM2);
/* points_dbl */
- if(NULL == (points_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double))))
+ if (NULL == (points_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double))))
TEST_ERROR;
- if(NULL == (points_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(points_dbl_data))))
+ if (NULL == (points_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(points_dbl_data))))
TEST_ERROR;
for (i = 0; i < DSET_DIM1; i++)
points_dbl[i] = points_dbl_data + (i * DSET_DIM2);
/* check_dbl */
- if(NULL == (check_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double))))
+ if (NULL == (check_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double))))
TEST_ERROR;
- if(NULL == (check_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(check_dbl_data))))
+ if (NULL == (check_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(check_dbl_data))))
TEST_ERROR;
for (i = 0; i < DSET_DIM1; i++)
check_dbl[i] = check_dbl_data + (i * DSET_DIM2);
@@ -13855,67 +15120,72 @@ main(void)
fapl = h5_fileaccess();
/* Turn off the chunk cache, so all the chunks are immediately written to disk */
- if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
+ if (H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
goto error;
rdcc_nbytes = 0;
- if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
+ if (H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
goto error;
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
/* create a file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+ if ((fcpl2 = H5Pcopy(fcpl)) < 0)
TEST_ERROR
- if((fcpl2 = H5Pcopy(fcpl)) < 0) TEST_ERROR
/* Set file space strategy to paged aggregation and persisting free-space */
- if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
TEST_ERROR
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Test with paged aggregation enabled or not */
- for(paged = FALSE; paged <= TRUE; paged++) {
+ for (paged = FALSE; paged <= TRUE; paged++) {
/* Temporary: skip testing for multi/split drivers:
fail file create when persisting free-space or using paged aggregation strategy */
- if(!contig_addr_vfd && paged)
+ if (!contig_addr_vfd && paged)
continue;
- for(minimized_ohdr = FALSE; minimized_ohdr <= TRUE; minimized_ohdr++) {
+ for (minimized_ohdr = FALSE; minimized_ohdr <= TRUE; minimized_ohdr++) {
/* Test with old & new format groups */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl, my_fcpl;
/* Set the FAPL for the type of format */
- if(new_format) {
+ if (new_format) {
my_fapl = fapl2;
- if(paged) {
+ if (paged) {
my_fcpl = fcpl2;
HDputs("\nTesting with new file format and paged aggregation");
- } else {
+ }
+ else {
my_fcpl = fcpl;
HDputs("\nTesting with new file format and non-paged aggregation");
}
} /* end if */
else {
my_fapl = fapl;
- if(paged) {
+ if (paged) {
my_fcpl = fcpl2;
HDputs("Testing with old file format and paged aggregation:");
- } else {
+ }
+ else {
my_fcpl = fcpl;
HDputs("Testing with old file format and non-paged aggregation:");
}
} /* end else */
/* Create the file for this test */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, my_fcpl, my_fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, my_fcpl, my_fapl)) < 0)
goto error;
if (TRUE == minimized_ohdr) {
@@ -13925,110 +15195,113 @@ main(void)
}
/* Cause the library to emit initial messages */
- if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0)
+ if (H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0)
goto error;
- if(H5Gclose(grp) < 0)
+ if (H5Gclose(grp) < 0)
goto error;
- nerrors += (test_create(file) < 0 ? 1 : 0);
- nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
- nerrors += (test_tconv(file) < 0 ? 1 : 0);
- nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_int(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_float(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_double(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_array(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_compound(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0);
- nerrors += (test_multiopen (file) < 0 ? 1 : 0);
- nerrors += (test_types(file) < 0 ? 1 : 0);
- nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0);
- nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
- nerrors += (test_optional_filters(file) < 0 ? 1 : 0);
- nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
- nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
- nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
- nerrors += (test_filters_endianess() < 0 ? 1 : 0);
- nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
- nerrors += (test_missing_chunk(file) < 0 ? 1 : 0);
- nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_create(file) < 0 ? 1 : 0);
+ nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
+ nerrors += (test_tconv(file) < 0 ? 1 : 0);
+ nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_int(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_float(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_double(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_array(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_compound(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0);
+ nerrors += (test_multiopen(file) < 0 ? 1 : 0);
+ nerrors += (test_types(file) < 0 ? 1 : 0);
+ nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0);
+ nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
+ nerrors += (test_optional_filters(file) < 0 ? 1 : 0);
+ nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
+ nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
+ nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
+ nerrors += (test_filters_endianess() < 0 ? 1 : 0);
+ nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
+ nerrors += (test_missing_chunk(file) < 0 ? 1 : 0);
+ nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += (test_deprec(file) < 0 ? 1 : 0);
+ nerrors += (test_deprec(file) < 0 ? 1 : 0);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_idx_compatible() < 0 ? 1 : 0);
- nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0);
-
- nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
-
- if(H5Fclose(file) < 0)
+ nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_idx_compatible() < 0 ? 1 : 0);
+ nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0);
+
+ nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+
+ if (H5Fclose(file) < 0)
goto error;
} /* end for new_format */
- } /* end for minimized_ohdr */
- } /* end for paged */
+ } /* end for minimized_ohdr */
+ } /* end for paged */
/* Close property lists */
- if(H5Pclose(fapl2) < 0) TEST_ERROR
- if(H5Pclose(fcpl) < 0) TEST_ERROR
- if(H5Pclose(fcpl2) < 0) TEST_ERROR
+ if (H5Pclose(fapl2) < 0)
+ TEST_ERROR
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR
+ if (H5Pclose(fcpl2) < 0)
+ TEST_ERROR
/* Tests that do not use files */
- nerrors += (test_scatter() < 0 ? 1 : 0);
- nerrors += (test_gather() < 0 ? 1 : 0);
- nerrors += (test_scatter_error() < 0 ? 1 : 0);
- nerrors += (test_gather_error() < 0 ? 1 : 0);
+ nerrors += (test_scatter() < 0 ? 1 : 0);
+ nerrors += (test_gather() < 0 ? 1 : 0);
+ nerrors += (test_scatter_error() < 0 ? 1 : 0);
+ nerrors += (test_gather_error() < 0 ? 1 : 0);
/* Tests version bounds using its own file */
- nerrors += (test_versionbounds() < 0 ? 1 : 0);
+ nerrors += (test_versionbounds() < 0 ? 1 : 0);
nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0);
/* Run misc tests */
- nerrors += (dls_01_main() < 0 ? 1 : 0);
- nerrors += (test_0sized_dset_metadata_alloc(fapl) < 0 ? 1 : 0);
+ nerrors += (dls_01_main() < 0 ? 1 : 0);
+ nerrors += (test_0sized_dset_metadata_alloc(fapl) < 0 ? 1 : 0);
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if(nerrors)
+ if (nerrors)
goto error;
HDprintf("All dataset tests passed.\n");
#ifdef H5_HAVE_FILTER_SZIP
@@ -14061,8 +15334,6 @@ error:
HDfree(check_dbl_data);
nerrors = MAX(1, nerrors);
- HDprintf("***** %d DATASET TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 9b89225..466554c 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -21,7 +21,7 @@
#include "h5test.h"
/* Number of elements in each random test */
-#define NTESTELEM 10000
+#define NTESTELEM 10000
/* Epsilon for floating-point comparisons */
#define FP_EPSILON 0.000001F
@@ -30,7 +30,7 @@
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
*/
-#define ALIGNMENT 1
+#define ALIGNMENT 1
/*
* Define if you want to test alignment code on a machine that doesn't
@@ -41,29 +41,34 @@
/* Alignment test stuff */
#ifdef TEST_ALIGNMENT
-#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h"
#endif
-#define SET_ALIGNMENT(TYPE,VAL) \
- H5T_NATIVE_##TYPE##_ALIGN_g=MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL)
+#define SET_ALIGNMENT(TYPE, VAL) H5T_NATIVE_##TYPE##_ALIGN_g = MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL)
-const char *FILENAME[] = {
- "dt_arith1",
- "dt_arith2",
- NULL
-};
+const char *FILENAME[] = {"dt_arith1", "dt_arith2", NULL};
/*
* Count up or down depending on whether the machine is big endian or little
* endian. If local variable `endian' is H5T_ORDER_BE then the result will
* be I, otherwise the result will be Z-(I+1).
*/
-#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1))
+#define ENDIAN(Z, I, E) (H5T_ORDER_BE == E ? (I) : (Z) - ((I) + 1))
typedef enum dtype_t {
- INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
- INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, FLT_FLOAT, FLT_DOUBLE,
-#if H5_SIZEOF_LONG_DOUBLE !=0
+ INT_SCHAR,
+ INT_UCHAR,
+ INT_SHORT,
+ INT_USHORT,
+ INT_INT,
+ INT_UINT,
+ INT_LONG,
+ INT_ULONG,
+ INT_LLONG,
+ INT_ULLONG,
+ FLT_FLOAT,
+ FLT_DOUBLE,
+#if H5_SIZEOF_LONG_DOUBLE != 0
FLT_LDOUBLE,
#endif
OTHER
@@ -87,311 +92,313 @@ static int skip_overflow_tests_g = 0;
* Decide what values of floating-point number we want to test. They are
* 1 - normalized; 2 - denormalized; 3 - special.
*/
-#define TEST_NOOP 0
-#define TEST_NORMAL 1
-#define TEST_DENORM 2
-#define TEST_SPECIAL 3
+#define TEST_NOOP 0
+#define TEST_NORMAL 1
+#define TEST_DENORM 2
+#define TEST_SPECIAL 3
/* Temporary buffer sizes */
-#define TMP_BUF_DIM1 32
-#define TMP_BUF_DIM2 100
+#define TMP_BUF_DIM1 32
+#define TMP_BUF_DIM2 100
/* Don't use hardware conversions if set */
static int without_hardware_g = 0;
/* Allocates memory aligned on a certain boundary. */
-#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT))
-#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT)
+#define aligned_malloc(Z) ((void *)((char *)HDmalloc(ALIGNMENT + Z) + ALIGNMENT))
+#define aligned_free(M) HDfree((char *)(M)-ALIGNMENT)
/* Initialize source buffer of integer for integer->integer and integer->floating-point conversion test.
* This algorithm is mainly to avoid any casting and comparison between source and destination types
* for compiler, because we're testing conversions. */
-#define INIT_INTEGER(TYPE, SRC_MAX, SRC_MIN, SRC_SIZE, DST_SIZE, SRC_PREC, BUF, SAVED, NELMTS) \
-{ \
- unsigned char *buf_p, *saved_p; \
- unsigned int n; \
- TYPE value1 = 1; \
- TYPE value2 = 0; \
- \
- /* Allocate buffers */ \
- NELMTS=SRC_PREC*3; \
- BUF = (unsigned char*)aligned_malloc(NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- SAVED = (unsigned char*)aligned_malloc(NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- \
- buf_p = BUF; \
- saved_p = SAVED; \
- \
- /*positive values, ascending order. VALUE1 starts from 00000001, to 00000010, until 10000000*/ \
- /*VALUE2 ascends from 00000000, to 00000011, 00000111,..., until 11111111.*/ \
- for(n=0; n<SRC_PREC; n++) { \
- { \
- HDmemcpy(buf_p, &value1, SRC_SIZE); \
- HDmemcpy(saved_p, &value1, SRC_SIZE); \
- buf_p += SRC_SIZE; \
- saved_p += SRC_SIZE; \
- } \
- { \
- HDmemcpy(buf_p, &value2, SRC_SIZE); \
- HDmemcpy(saved_p, &value2, SRC_SIZE); \
- buf_p += SRC_SIZE; \
- saved_p += SRC_SIZE; \
- } \
- \
- if(n<SRC_PREC-2) { \
- value1 = (TYPE)(value1 << 1); \
- value2 = (TYPE)((value1 - 1) | value1); \
- } else if(n==SRC_PREC-2) { /*to avoid overflow of negative values for signed integer*/ \
- value1 = (TYPE)(value1 << 1); \
- value2 = (TYPE)((~value1) | value1); \
- } \
- } \
- \
- /* negative values for signed; descending positive values for unsigned */ \
- /* VALUE2 descends from 11111111 to 11111110, 11111100, ..., until 10000000. */ \
- for(n=0; n<SRC_PREC-1; n++) { \
- { \
- HDmemcpy(buf_p, &value2, SRC_SIZE); \
- HDmemcpy(saved_p, &value2, SRC_SIZE); \
- buf_p += SRC_SIZE; \
- saved_p += SRC_SIZE; \
- } \
- if(n<SRC_PREC-1) \
- value2 = (TYPE)(value2 << 1); \
- } \
-}
+#define INIT_INTEGER(TYPE, SRC_MAX, SRC_MIN, SRC_SIZE, DST_SIZE, SRC_PREC, BUF, SAVED, NELMTS) \
+ { \
+ unsigned char *buf_p, *saved_p; \
+ unsigned int n; \
+ TYPE value1 = 1; \
+ TYPE value2 = 0; \
+ \
+ /* Allocate buffers */ \
+ NELMTS = SRC_PREC * 3; \
+ BUF = (unsigned char *)aligned_malloc(NELMTS * MAX(SRC_SIZE, DST_SIZE)); \
+ SAVED = (unsigned char *)aligned_malloc(NELMTS * MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemset(BUF, 0, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemset(SAVED, 0, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
+ \
+ buf_p = BUF; \
+ saved_p = SAVED; \
+ \
+ /*positive values, ascending order. VALUE1 starts from 00000001, to 00000010, until 10000000*/ \
+ /*VALUE2 ascends from 00000000, to 00000011, 00000111,..., until 11111111.*/ \
+ for (n = 0; n < SRC_PREC; n++) { \
+ { \
+ HDmemcpy(buf_p, &value1, SRC_SIZE); \
+ HDmemcpy(saved_p, &value1, SRC_SIZE); \
+ buf_p += SRC_SIZE; \
+ saved_p += SRC_SIZE; \
+ } \
+ { \
+ HDmemcpy(buf_p, &value2, SRC_SIZE); \
+ HDmemcpy(saved_p, &value2, SRC_SIZE); \
+ buf_p += SRC_SIZE; \
+ saved_p += SRC_SIZE; \
+ } \
+ \
+ if (n < SRC_PREC - 2) { \
+ value1 = (TYPE)(value1 << 1); \
+ value2 = (TYPE)((value1 - 1) | value1); \
+ } \
+ else if (n == SRC_PREC - 2) { /*to avoid overflow of negative values for signed integer*/ \
+ value1 = (TYPE)(value1 << 1); \
+ value2 = (TYPE)((~value1) | value1); \
+ } \
+ } \
+ \
+ /* negative values for signed; descending positive values for unsigned */ \
+ /* VALUE2 descends from 11111111 to 11111110, 11111100, ..., until 10000000. */ \
+ for (n = 0; n < SRC_PREC - 1; n++) { \
+ { \
+ HDmemcpy(buf_p, &value2, SRC_SIZE); \
+ HDmemcpy(saved_p, &value2, SRC_SIZE); \
+ buf_p += SRC_SIZE; \
+ saved_p += SRC_SIZE; \
+ } \
+ if (n < SRC_PREC - 1) \
+ value2 = (TYPE)(value2 << 1); \
+ } \
+ }
/* Change a buffer's byte order from big endian to little endian. It's mainly for library's
* bit operations which handle only little endian order.
*/
-#define CHANGE_ORDER(EBUF, EORDER, ESIZE) \
-{ \
- unsigned int m; \
- if (H5T_ORDER_BE==EORDER) { \
- unsigned char mediator; \
- size_t half_size = ESIZE/2; \
- for (m=0; m<half_size; m++) { \
- mediator = EBUF[ESIZE-(m+1)]; \
- EBUF[ESIZE-(m+1)] = EBUF[m]; \
- EBUF[m] = mediator; \
- } \
- } else if (H5T_ORDER_VAX==EORDER) { \
- unsigned char mediator1, mediator2; \
- for (m = 0; m < ESIZE; m += 4) { \
- mediator1 = EBUF[m]; \
- mediator2 = EBUF[m+1]; \
- \
- EBUF[m] = EBUF[(ESIZE-2)-m]; \
- EBUF[m+1] = EBUF[(ESIZE-1)-m]; \
- \
- EBUF[(ESIZE-2)-m] = mediator1; \
- EBUF[(ESIZE-1)-m] = mediator2; \
- } \
- } \
-}
+#define CHANGE_ORDER(EBUF, EORDER, ESIZE) \
+ { \
+ unsigned int m; \
+ if (H5T_ORDER_BE == EORDER) { \
+ unsigned char mediator; \
+ size_t half_size = ESIZE / 2; \
+ for (m = 0; m < half_size; m++) { \
+ mediator = EBUF[ESIZE - (m + 1)]; \
+ EBUF[ESIZE - (m + 1)] = EBUF[m]; \
+ EBUF[m] = mediator; \
+ } \
+ } \
+ else if (H5T_ORDER_VAX == EORDER) { \
+ unsigned char mediator1, mediator2; \
+ for (m = 0; m < ESIZE; m += 4) { \
+ mediator1 = EBUF[m]; \
+ mediator2 = EBUF[m + 1]; \
+ \
+ EBUF[m] = EBUF[(ESIZE - 2) - m]; \
+ EBUF[m + 1] = EBUF[(ESIZE - 1) - m]; \
+ \
+ EBUF[(ESIZE - 2) - m] = mediator1; \
+ EBUF[(ESIZE - 1) - m] = mediator2; \
+ } \
+ } \
+ }
/* Allocate buffer and initialize it with floating-point normalized values.
* It's for conversion test of floating-point as the source.
*/
-#define INIT_FP_NORM(TYPE, SRC_MAX, SRC_MIN, SRC_MAX_10_EXP, SRC_MIN_10_EXP, SRC_SIZE, \
- DST_SIZE, BUF, SAVED, NELMTS) \
-{ \
- unsigned char *buf_p, *saved_p; \
- size_t num_norm, factor, n; \
- TYPE value1, value2; \
- TYPE multiply; \
- \
- /*Determine the number of normalized values and increment pace. The values start from \
- *minimal normalized value and are multiplied by MULTIPLY each step until reach to maximal \
- *normalized value.*/ \
- if(SRC_MAX_10_EXP<100) { /*for float*/ \
- factor = 0; \
- multiply = 10; \
- } else if(SRC_MAX_10_EXP>=100 && SRC_MAX_10_EXP<400) { /*for double*/ \
- factor = 2; \
- multiply = 10000; \
- } else { /*for long double*/ \
- factor = 3; \
- multiply = 100000000; \
- } \
- \
- /*The number of values if multiplied by 10 for each step.*/ \
- num_norm = (SRC_MAX_10_EXP - SRC_MIN_10_EXP); \
- /*Reduce the number of values by 2^factor. MULTIPLY=10^(2^factor). Using this algorithm \
- *instead of arithmatic operation to avoid any conversion*/ \
- num_norm >>= factor; \
- \
- /*Total number of values*/ \
- NELMTS = 2 * /*both positive and negative*/ \
- (num_norm + /*number of normalized values*/ \
- 1); /*maximal normalized value*/ \
- \
- /* Allocate buffers */ \
- BUF = (unsigned char*)aligned_malloc(NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- SAVED = (unsigned char*)aligned_malloc(NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- \
- buf_p = BUF; \
- saved_p = SAVED; \
- \
- /*Normalized values*/ \
- value1 = SRC_MIN; \
- value2 = -SRC_MIN; \
- for(n=0; n<num_norm; n++) { \
- if(value1<SRC_MAX) { /*positive*/ \
- HDmemcpy(buf_p, &value1, SRC_SIZE); \
- HDmemcpy(saved_p, &value1, SRC_SIZE); \
- value1 *= multiply; \
- buf_p += SRC_SIZE; \
- saved_p += SRC_SIZE; \
- } \
- if(value2>-SRC_MAX) { /*negative*/ \
- HDmemcpy(buf_p, &value2, SRC_SIZE); \
- HDmemcpy(saved_p, &value2, SRC_SIZE); \
- value2 *= multiply; \
- buf_p += SRC_SIZE; \
- saved_p += SRC_SIZE; \
- } \
- } \
- \
- value1 = SRC_MAX; /*maximal value*/ \
- HDmemcpy(buf_p, &value1, SRC_SIZE); \
- HDmemcpy(saved_p, &value1, SRC_SIZE); \
- buf_p += SRC_SIZE; \
- saved_p += SRC_SIZE; \
- \
- value2 = -SRC_MAX; /*negative value*/ \
- HDmemcpy(buf_p, &value2, SRC_SIZE); \
- HDmemcpy(saved_p, &value2, SRC_SIZE); \
- buf_p += SRC_SIZE; \
- saved_p += SRC_SIZE; \
-}
+#define INIT_FP_NORM(TYPE, SRC_MAX, SRC_MIN, SRC_MAX_10_EXP, SRC_MIN_10_EXP, SRC_SIZE, DST_SIZE, BUF, SAVED, \
+ NELMTS) \
+ { \
+ unsigned char *buf_p, *saved_p; \
+ size_t num_norm, factor, n; \
+ TYPE value1, value2; \
+ TYPE multiply; \
+ \
+ /*Determine the number of normalized values and increment pace. The values start from \
+ *minimal normalized value and are multiplied by MULTIPLY each step until reach to maximal \
+ *normalized value.*/ \
+ if (SRC_MAX_10_EXP < 100) { /*for float*/ \
+ factor = 0; \
+ multiply = 10; \
+ } \
+ else if (SRC_MAX_10_EXP >= 100 && SRC_MAX_10_EXP < 400) { /*for double*/ \
+ factor = 2; \
+ multiply = 10000; \
+ } \
+ else { /*for long double*/ \
+ factor = 3; \
+ multiply = 100000000; \
+ } \
+ \
+ /*The number of values if multiplied by 10 for each step.*/ \
+ num_norm = (SRC_MAX_10_EXP - SRC_MIN_10_EXP); \
+ /*Reduce the number of values by 2^factor. MULTIPLY=10^(2^factor). Using this algorithm \
+ *instead of arithmatic operation to avoid any conversion*/ \
+ num_norm >>= factor; \
+ \
+ /*Total number of values*/ \
+ NELMTS = 2 * /*both positive and negative*/ \
+ (num_norm + /*number of normalized values*/ \
+ 1); /*maximal normalized value*/ \
+ \
+ /* Allocate buffers */ \
+ BUF = (unsigned char *)aligned_malloc(NELMTS * MAX(SRC_SIZE, DST_SIZE)); \
+ SAVED = (unsigned char *)aligned_malloc(NELMTS * MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemset(BUF, 0, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemset(SAVED, 0, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
+ \
+ buf_p = BUF; \
+ saved_p = SAVED; \
+ \
+ /*Normalized values*/ \
+ value1 = SRC_MIN; \
+ value2 = -SRC_MIN; \
+ for (n = 0; n < num_norm; n++) { \
+ if (value1 < SRC_MAX) { /*positive*/ \
+ HDmemcpy(buf_p, &value1, SRC_SIZE); \
+ HDmemcpy(saved_p, &value1, SRC_SIZE); \
+ value1 *= multiply; \
+ buf_p += SRC_SIZE; \
+ saved_p += SRC_SIZE; \
+ } \
+ if (value2 > -SRC_MAX) { /*negative*/ \
+ HDmemcpy(buf_p, &value2, SRC_SIZE); \
+ HDmemcpy(saved_p, &value2, SRC_SIZE); \
+ value2 *= multiply; \
+ buf_p += SRC_SIZE; \
+ saved_p += SRC_SIZE; \
+ } \
+ } \
+ \
+ value1 = SRC_MAX; /*maximal value*/ \
+ HDmemcpy(buf_p, &value1, SRC_SIZE); \
+ HDmemcpy(saved_p, &value1, SRC_SIZE); \
+ buf_p += SRC_SIZE; \
+ saved_p += SRC_SIZE; \
+ \
+ value2 = -SRC_MAX; /*negative value*/ \
+ HDmemcpy(buf_p, &value2, SRC_SIZE); \
+ HDmemcpy(saved_p, &value2, SRC_SIZE); \
+ buf_p += SRC_SIZE; \
+ saved_p += SRC_SIZE; \
+ }
/* Allocate buffer and initialize it with floating-point denormalized values.
* It's for conversion test of floating-point as the source.
*/
-#define INIT_FP_DENORM(TYPE, SRC_MANT_DIG, SRC_SIZE, SRC_PREC, SRC_ORDR, DST_SIZE, \
- BUF, SAVED, NELMTS) \
-{ \
- unsigned char *buf_p, *saved_p; \
- unsigned char *tmp1, *tmp2; \
- size_t n; \
- \
- /*Total number of values*/ \
- NELMTS = 2 * /*both positive and negative*/ \
- (SRC_MANT_DIG - 1); /*number of denormalized values*/ \
- \
- /* Allocate buffers */ \
- BUF = (unsigned char*)aligned_malloc(NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- SAVED = (unsigned char*)aligned_malloc(NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- \
- tmp1 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
- tmp2 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
- \
- buf_p = BUF; \
- saved_p = SAVED; \
- \
- /*Denormalized values. Exponent is 0. Let mantissa starts from 00000001, 00000011, \
- *00000111,..., until 11111111.*/ \
- HDmemset(tmp1, 0, SRC_SIZE); \
- HDmemset(tmp2, 0, SRC_SIZE); \
- H5T__bit_set (tmp2, SRC_PREC-1, (size_t)1, TRUE); /*the negative value*/ \
- for(n=0; n<SRC_MANT_DIG-1; n++) { \
- H5T__bit_set (tmp1, n, (size_t)1, TRUE); /*turn on 1 bit each time*/ \
- CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- HDmemcpy(buf_p, tmp1, SRC_SIZE); \
- HDmemcpy(saved_p, tmp1, SRC_SIZE); \
- CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
- buf_p += SRC_SIZE; \
- saved_p += SRC_SIZE; \
- \
- /*negative values*/ \
- H5T__bit_set (tmp2, n, (size_t)1, TRUE); \
- CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \
- HDmemcpy(buf_p, tmp2, SRC_SIZE); \
- HDmemcpy(saved_p, tmp2, SRC_SIZE); \
- CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \
- buf_p += SRC_SIZE; \
- saved_p += SRC_SIZE; \
- } \
- HDfree(tmp1); \
- HDfree(tmp2); \
-}
+#define INIT_FP_DENORM(TYPE, SRC_MANT_DIG, SRC_SIZE, SRC_PREC, SRC_ORDR, DST_SIZE, BUF, SAVED, NELMTS) \
+ { \
+ unsigned char *buf_p, *saved_p; \
+ unsigned char *tmp1, *tmp2; \
+ size_t n; \
+ \
+ /*Total number of values*/ \
+ NELMTS = 2 * /*both positive and negative*/ \
+ (SRC_MANT_DIG - 1); /*number of denormalized values*/ \
+ \
+ /* Allocate buffers */ \
+ BUF = (unsigned char *)aligned_malloc(NELMTS * MAX(SRC_SIZE, DST_SIZE)); \
+ SAVED = (unsigned char *)aligned_malloc(NELMTS * MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemset(BUF, 0, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemset(SAVED, 0, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
+ \
+ tmp1 = (unsigned char *)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
+ tmp2 = (unsigned char *)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
+ \
+ buf_p = BUF; \
+ saved_p = SAVED; \
+ \
+ /*Denormalized values. Exponent is 0. Let mantissa starts from 00000001, 00000011, \
+ *00000111,..., until 11111111.*/ \
+ HDmemset(tmp1, 0, SRC_SIZE); \
+ HDmemset(tmp2, 0, SRC_SIZE); \
+ H5T__bit_set(tmp2, SRC_PREC - 1, (size_t)1, TRUE); /*the negative value*/ \
+ for (n = 0; n < SRC_MANT_DIG - 1; n++) { \
+ H5T__bit_set(tmp1, n, (size_t)1, TRUE); /*turn on 1 bit each time*/ \
+ CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
+ HDmemcpy(buf_p, tmp1, SRC_SIZE); \
+ HDmemcpy(saved_p, tmp1, SRC_SIZE); \
+ CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
+ buf_p += SRC_SIZE; \
+ saved_p += SRC_SIZE; \
+ \
+ /*negative values*/ \
+ H5T__bit_set(tmp2, n, (size_t)1, TRUE); \
+ CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \
+ HDmemcpy(buf_p, tmp2, SRC_SIZE); \
+ HDmemcpy(saved_p, tmp2, SRC_SIZE); \
+ CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \
+ buf_p += SRC_SIZE; \
+ saved_p += SRC_SIZE; \
+ } \
+ HDfree(tmp1); \
+ HDfree(tmp2); \
+ }
/* Allocate buffer and initialize it with floating-point special values, +/-0, +/-infinity,
* +/-QNaN, +/-SNaN. It's for conversion test of floating-point as the source.
*/
-#define INIT_FP_SPECIAL(SRC_SIZE, SRC_PREC, SRC_ORDR, SRC_MANT_DIG, DST_SIZE, \
- BUF, SAVED, NELMTS) \
-{ \
- unsigned char *buf_p; \
- unsigned char *value; \
- int n; \
- \
- /*Total number of values*/ \
- NELMTS = 2 * /*both positive and negative*/ \
- 4; /*infinity, SNaN, QNaN */ \
- \
- /* Allocate buffers */ \
- BUF = (unsigned char*)aligned_malloc(NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- SAVED = (unsigned char*)aligned_malloc( NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- value = (unsigned char*)HDcalloc(SRC_SIZE, sizeof(unsigned char)); \
- \
- buf_p = BUF; \
- \
- /* +0 */ \
- H5T__bit_set(value, (size_t)0, SRC_PREC, FALSE); \
- HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
- buf_p += SRC_SIZE; \
- \
- for(n=0; n<2; n++) { \
- if(n==1) { \
- memset(value, 0, SRC_SIZE*sizeof(unsigned char)); \
- /* -0 */ \
- H5T__bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \
- CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change order for big endian*/ \
- HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
- CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change back the order for bit operation*/ \
- buf_p += SRC_SIZE; \
- } \
- \
- /* +/-infinity */ \
- H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 1), SRC_PREC-SRC_MANT_DIG, TRUE); \
- CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
- CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
- buf_p += SRC_SIZE; \
- \
- /* +/-SNaN */ \
- H5T__bit_set(value, (size_t)0, (size_t)1, TRUE); \
- CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
- CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
- buf_p += SRC_SIZE; \
- \
- /* +/-QNaN */ \
- H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 2), (size_t)1, TRUE); \
- CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
- CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
- buf_p += SRC_SIZE; \
- } \
- \
- HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDfree(value); \
-}
+#define INIT_FP_SPECIAL(SRC_SIZE, SRC_PREC, SRC_ORDR, SRC_MANT_DIG, DST_SIZE, BUF, SAVED, NELMTS) \
+ { \
+ unsigned char *buf_p; \
+ unsigned char *value; \
+ int n; \
+ \
+ /*Total number of values*/ \
+ NELMTS = 2 * /*both positive and negative*/ \
+ 4; /*infinity, SNaN, QNaN */ \
+ \
+ /* Allocate buffers */ \
+ BUF = (unsigned char *)aligned_malloc(NELMTS * MAX(SRC_SIZE, DST_SIZE)); \
+ SAVED = (unsigned char *)aligned_malloc(NELMTS * MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemset(BUF, 0, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemset(SAVED, 0, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
+ value = (unsigned char *)HDcalloc(SRC_SIZE, sizeof(unsigned char)); \
+ \
+ buf_p = BUF; \
+ \
+ /* +0 */ \
+ H5T__bit_set(value, (size_t)0, SRC_PREC, FALSE); \
+ HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
+ buf_p += SRC_SIZE; \
+ \
+ for (n = 0; n < 2; n++) { \
+ if (n == 1) { \
+ memset(value, 0, SRC_SIZE * sizeof(unsigned char)); \
+ /* -0 */ \
+ H5T__bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \
+ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
+ HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
+ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
+ buf_p += SRC_SIZE; \
+ } \
+ \
+ /* +/-infinity */ \
+ H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 1), SRC_PREC - SRC_MANT_DIG, TRUE); \
+ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
+ HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
+ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
+ buf_p += SRC_SIZE; \
+ \
+ /* +/-SNaN */ \
+ H5T__bit_set(value, (size_t)0, (size_t)1, TRUE); \
+ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
+ HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
+ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
+ buf_p += SRC_SIZE; \
+ \
+ /* +/-QNaN */ \
+ H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 2), (size_t)1, TRUE); \
+ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
+ HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
+ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
+ buf_p += SRC_SIZE; \
+ } \
+ \
+ HDmemcpy(SAVED, BUF, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
+ HDfree(value); \
+ }
-void some_dummy_func(float x);
+void some_dummy_func(float x);
static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits);
-static int my_isnan(dtype_t type, void *val);
-static int my_isinf(int endian, unsigned char *val, size_t size,
- size_t mpos, size_t msize, size_t epos, size_t esize);
+static int my_isnan(dtype_t type, void *val);
+static int my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos,
+ size_t esize);
/*-------------------------------------------------------------------------
* Function: fpe_handler
@@ -419,7 +426,6 @@ fpe_handler(int H5_ATTR_UNUSED signo)
HDexit(255);
}
-
/*-------------------------------------------------------------------------
* Function: reset_hdf5
*
@@ -440,28 +446,27 @@ reset_hdf5(void)
{
h5_reset();
- if (without_hardware_g) h5_no_hwconv();
+ if (without_hardware_g)
+ h5_no_hwconv();
#ifdef TEST_ALIGNMENT
- SET_ALIGNMENT(SCHAR, H5_SIZEOF_CHAR);
- SET_ALIGNMENT(UCHAR, H5_SIZEOF_CHAR);
- SET_ALIGNMENT(SHORT, H5_SIZEOF_SHORT);
- SET_ALIGNMENT(USHORT, H5_SIZEOF_SHORT);
- SET_ALIGNMENT(INT, H5_SIZEOF_INT);
- SET_ALIGNMENT(UINT, H5_SIZEOF_INT);
- SET_ALIGNMENT(LONG, H5_SIZEOF_LONG);
- SET_ALIGNMENT(ULONG, H5_SIZEOF_LONG);
- SET_ALIGNMENT(LLONG, H5_SIZEOF_LONG_LONG);
- SET_ALIGNMENT(ULLONG, H5_SIZEOF_LONG_LONG);
- SET_ALIGNMENT(FLOAT, H5_SIZEOF_FLOAT);
- SET_ALIGNMENT(DOUBLE, H5_SIZEOF_DOUBLE);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+ SET_ALIGNMENT(SCHAR, H5_SIZEOF_CHAR);
+ SET_ALIGNMENT(UCHAR, H5_SIZEOF_CHAR);
+ SET_ALIGNMENT(SHORT, H5_SIZEOF_SHORT);
+ SET_ALIGNMENT(USHORT, H5_SIZEOF_SHORT);
+ SET_ALIGNMENT(INT, H5_SIZEOF_INT);
+ SET_ALIGNMENT(UINT, H5_SIZEOF_INT);
+ SET_ALIGNMENT(LONG, H5_SIZEOF_LONG);
+ SET_ALIGNMENT(ULONG, H5_SIZEOF_LONG);
+ SET_ALIGNMENT(LLONG, H5_SIZEOF_LONG_LONG);
+ SET_ALIGNMENT(ULLONG, H5_SIZEOF_LONG_LONG);
+ SET_ALIGNMENT(FLOAT, H5_SIZEOF_FLOAT);
+ SET_ALIGNMENT(DOUBLE, H5_SIZEOF_DOUBLE);
+#if H5_SIZEOF_LONG_DOUBLE != 0
SET_ALIGNMENT(LDOUBLE, H5_SIZEOF_LONG_DOUBLE);
#endif
#endif
-
}
-
/*-------------------------------------------------------------------------
* Function: except_func
*
@@ -481,35 +486,34 @@ reset_hdf5(void)
*-------------------------------------------------------------------------
*/
static H5T_conv_ret_t
-except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf,
- void *dst_buf, void *user_data)
+except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id,
+ void H5_ATTR_UNUSED *src_buf, void *dst_buf, void *user_data)
{
- H5T_conv_ret_t ret = H5T_CONV_HANDLED;
+ H5T_conv_ret_t ret = H5T_CONV_HANDLED;
- if(except_type == H5T_CONV_EXCEPT_RANGE_HI)
+ if (except_type == H5T_CONV_EXCEPT_RANGE_HI)
/*only test integer case*/
- *(int*)dst_buf = *(int*)user_data;
- else if(except_type == H5T_CONV_EXCEPT_RANGE_LOW)
+ *(int *)dst_buf = *(int *)user_data;
+ else if (except_type == H5T_CONV_EXCEPT_RANGE_LOW)
/*only test integer case*/
- *(int*)dst_buf = *(int*)user_data;
- else if(except_type == H5T_CONV_EXCEPT_TRUNCATE)
+ *(int *)dst_buf = *(int *)user_data;
+ else if (except_type == H5T_CONV_EXCEPT_TRUNCATE)
ret = H5T_CONV_UNHANDLED;
- else if(except_type == H5T_CONV_EXCEPT_PRECISION)
+ else if (except_type == H5T_CONV_EXCEPT_PRECISION)
ret = H5T_CONV_UNHANDLED;
- else if(except_type == H5T_CONV_EXCEPT_PINF)
+ else if (except_type == H5T_CONV_EXCEPT_PINF)
/*only test integer case*/
- *(int*)dst_buf = *(int*)user_data;
- else if(except_type == H5T_CONV_EXCEPT_NINF)
+ *(int *)dst_buf = *(int *)user_data;
+ else if (except_type == H5T_CONV_EXCEPT_NINF)
/*only test integer case*/
- *(int*)dst_buf = *(int*)user_data;
- else if(except_type == H5T_CONV_EXCEPT_NAN)
+ *(int *)dst_buf = *(int *)user_data;
+ else if (except_type == H5T_CONV_EXCEPT_NAN)
/*only test integer case*/
- *(int*)dst_buf = *(int*)user_data;
+ *(int *)dst_buf = *(int *)user_data;
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: some_dummy_func
*
@@ -529,12 +533,11 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
void
some_dummy_func(float x)
{
- char s[128];
+ char s[128];
HDsnprintf(s, sizeof(s), "%g", (double)x);
}
-
/*-------------------------------------------------------------------------
* Function: generates_sigfpe
*
@@ -554,38 +557,40 @@ static void
generates_sigfpe(void)
{
#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
- pid_t pid;
- int status;
- size_t i, j;
- double d;
- unsigned char *dp = (unsigned char*)&d;
- float f;
+ pid_t pid;
+ int status;
+ size_t i, j;
+ double d;
+ unsigned char *dp = (unsigned char *)&d;
+ float f;
HDfflush(stdout);
HDfflush(stderr);
- if ((pid=fork()) < 0) {
- HDperror("fork");
- HDexit(EXIT_FAILURE);
- } else if (0==pid) {
- for (i=0; i<2000; i++) {
- for(j = 0; j < sizeof(double); j++)
- dp[j] = (unsigned char)HDrand();
- f = (float)d;
- some_dummy_func((float)f);
+ if ((pid = fork()) < 0) {
+ HDperror("fork");
+ HDexit(EXIT_FAILURE);
}
- HDexit(EXIT_SUCCESS);
+ else if (0 == pid) {
+ for (i = 0; i < 2000; i++) {
+ for (j = 0; j < sizeof(double); j++)
+ dp[j] = (unsigned char)HDrand();
+ f = (float)d;
+ some_dummy_func((float)f);
+ }
+ HDexit(EXIT_SUCCESS);
}
- while (pid!=waitpid(pid, &status, 0))
+ while (pid != waitpid(pid, &status, 0))
/*void*/;
- if (WIFEXITED(status) && 0==WEXITSTATUS(status)) {
- HDputs("Floating-point overflow cases will be tested.");
- skip_overflow_tests_g = FALSE;
- } else if (WIFSIGNALED(status) && SIGFPE==WTERMSIG(status)) {
- HDputs("Floating-point overflow cases cannot be safely tested.");
- skip_overflow_tests_g = TRUE;
- /* delete the core dump file that SIGFPE may have created */
- HDunlink("core");
+ if (WIFEXITED(status) && 0 == WEXITSTATUS(status)) {
+ HDputs("Floating-point overflow cases will be tested.");
+ skip_overflow_tests_g = FALSE;
+ }
+ else if (WIFSIGNALED(status) && SIGFPE == WTERMSIG(status)) {
+ HDputs("Floating-point overflow cases cannot be safely tested.");
+ skip_overflow_tests_g = TRUE;
+ /* delete the core dump file that SIGFPE may have created */
+ HDunlink("core");
}
#else
HDputs("Cannot determine if floating-point overflows generate a SIGFPE;");
@@ -595,7 +600,6 @@ generates_sigfpe(void)
#endif
}
-
/*-------------------------------------------------------------------------
* Function: test_hard_query
*
@@ -619,7 +623,7 @@ test_hard_query(void)
TESTING("query functions of compiler conversion");
/* Verify the conversion from int to float is a hard conversion. */
- if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) {
+ if (H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) {
H5_FAILED();
HDprintf("Can't query conversion function\n");
goto error;
@@ -627,8 +631,9 @@ test_hard_query(void)
/* Unregister the hard conversion from int to float. Verify the conversion
* is a soft conversion. */
- H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float));
- if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != FALSE) {
+ H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT,
+ (H5T_conv_t)((void (*)(void))H5T__conv_int_float));
+ if (H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != FALSE) {
H5_FAILED();
HDprintf("Can't query conversion function\n");
goto error;
@@ -636,8 +641,9 @@ test_hard_query(void)
/* Register the hard conversion from int to float. Verify the conversion
* is a hard conversion. */
- H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float));
- if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) {
+ H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT,
+ (H5T_conv_t)((void (*)(void))H5T__conv_int_float));
+ if (H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) {
H5_FAILED();
HDprintf("Can't query conversion function\n");
goto error;
@@ -660,7 +666,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: expt_handle
*
@@ -677,24 +682,23 @@ error:
*-------------------------------------------------------------------------
*/
static H5T_conv_ret_t
-expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf,
- void *dst_buf, void *user_data)
+expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id,
+ void H5_ATTR_UNUSED *src_buf, void *dst_buf, void *user_data)
{
- signed char fill_value1 = 7;
- int fill_value2 = 13;
+ signed char fill_value1 = 7;
+ int fill_value2 = 13;
- if(except_type == H5T_CONV_EXCEPT_RANGE_HI || except_type == H5T_CONV_EXCEPT_RANGE_LOW ||
- except_type == H5T_CONV_EXCEPT_TRUNCATE) {
- if(*(hbool_t*)user_data)
- *(signed char*)dst_buf = fill_value1;
+ if (except_type == H5T_CONV_EXCEPT_RANGE_HI || except_type == H5T_CONV_EXCEPT_RANGE_LOW ||
+ except_type == H5T_CONV_EXCEPT_TRUNCATE) {
+ if (*(hbool_t *)user_data)
+ *(signed char *)dst_buf = fill_value1;
else
- *(int*)dst_buf = fill_value2;
+ *(int *)dst_buf = fill_value2;
} /* end if */
return H5T_CONV_HANDLED;
}
-
/*-------------------------------------------------------------------------
* Function: test_particular_fp_integer
*
@@ -716,51 +720,52 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
* Failure: number of errors
*-------------------------------------------------------------------------
*/
-static int test_particular_fp_integer(void)
+static int
+test_particular_fp_integer(void)
{
- hid_t dxpl_id;
- hbool_t flag;
- double src_d = (double)SCHAR_MAX;
- signed char dst_c;
+ hid_t dxpl_id;
+ hbool_t flag;
+ double src_d = (double)SCHAR_MAX;
+ signed char dst_c;
unsigned char *buf1 = NULL, *buf2 = NULL;
unsigned char *saved_buf1 = NULL, *saved_buf2 = NULL;
- size_t src_size1, src_size2;
- size_t dst_size1, dst_size2;
- float src_f = (float)INT_MAX;
- int dst_i;
- int fill_value = 13;
- int endian; /*endianess */
- unsigned int fails_this_test = 0;
- size_t j;
+ size_t src_size1, src_size2;
+ size_t dst_size1, dst_size2;
+ float src_f = (float)INT_MAX;
+ int dst_i;
+ int fill_value = 13;
+ int endian; /*endianess */
+ unsigned int fails_this_test = 0;
+ size_t j;
TESTING("hard particular floating number -> integer conversions");
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
HDprintf("Can't create data transfer property list\n");
goto error;
}
/* Test conversion from double (the value is SCHAR_MAX) to signed char. */
- endian = H5Tget_order(H5T_NATIVE_DOUBLE);
- src_size1 = H5Tget_size(H5T_NATIVE_DOUBLE);
- dst_size1 = H5Tget_size(H5T_NATIVE_SCHAR);
- buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
- saved_buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
+ endian = H5Tget_order(H5T_NATIVE_DOUBLE);
+ src_size1 = H5Tget_size(H5T_NATIVE_DOUBLE);
+ dst_size1 = H5Tget_size(H5T_NATIVE_SCHAR);
+ buf1 = (unsigned char *)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
+ saved_buf1 = (unsigned char *)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
HDmemcpy(buf1, &src_d, src_size1);
HDmemcpy(saved_buf1, &src_d, src_size1);
/* Register exception handling function and signal the destination is "signed char". */
flag = 1;
- if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) {
+ if (H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) {
H5_FAILED();
HDprintf("Can't register conversion callback\n");
goto error;
}
/* Do conversion */
- if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) {
+ if (H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't convert data\n");
goto error;
@@ -769,23 +774,23 @@ static int test_particular_fp_integer(void)
HDmemcpy(&dst_c, buf1, dst_size1);
/* Print errors */
- if(dst_c != SCHAR_MAX) {
- double x = 0.0;
- signed char y;
+ if (dst_c != SCHAR_MAX) {
+ double x = 0.0;
+ signed char y;
- if(0 == fails_this_test++)
+ if (0 == fails_this_test++)
H5_FAILED();
HDprintf(" test double to signed char:\n");
HDprintf(" src = ");
- for (j=0; j<src_size1; j++)
+ for (j = 0; j < src_size1; j++)
HDprintf(" %02x", saved_buf1[ENDIAN(src_size1, j, endian)]);
HDmemcpy(&x, saved_buf1, src_size1);
HDprintf(" %29.20e\n", x);
HDprintf(" dst = ");
- for (j=0; j<dst_size1; j++)
+ for (j = 0; j < dst_size1; j++)
HDprintf(" %02x", buf1[ENDIAN(dst_size1, j, endian)]);
HDmemcpy(&y, buf1, dst_size1);
@@ -793,10 +798,10 @@ static int test_particular_fp_integer(void)
}
/* Test conversion from float (the value is INT_MAX) to int. */
- src_size2 = H5Tget_size(H5T_NATIVE_FLOAT);
- dst_size2 = H5Tget_size(H5T_NATIVE_INT);
- buf2 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
- saved_buf2 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ src_size2 = H5Tget_size(H5T_NATIVE_FLOAT);
+ dst_size2 = H5Tget_size(H5T_NATIVE_INT);
+ buf2 = (unsigned char *)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ saved_buf2 = (unsigned char *)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
HDmemcpy(buf2, &src_f, src_size2);
HDmemcpy(saved_buf2, &src_f, src_size2);
@@ -804,7 +809,7 @@ static int test_particular_fp_integer(void)
flag = 0;
/* Do conversion */
- if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)1, buf2, NULL, dxpl_id) < 0) {
+ if (H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)1, buf2, NULL, dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't convert data\n");
goto error;
@@ -813,45 +818,45 @@ static int test_particular_fp_integer(void)
HDmemcpy(&dst_i, buf2, dst_size2);
/* Print errors */
- if(dst_i != fill_value) {
+ if (dst_i != fill_value) {
float x = 0.0;
int y;
- if(0 == fails_this_test++)
+ if (0 == fails_this_test++)
H5_FAILED();
HDprintf(" test float to int:\n");
HDprintf(" src = ");
- for (j=0; j<src_size2; j++)
+ for (j = 0; j < src_size2; j++)
HDprintf(" %02x", saved_buf2[ENDIAN(src_size2, j, endian)]);
HDmemcpy(&x, saved_buf2, src_size2);
HDprintf(" %29.20e\n", (double)x);
HDprintf(" dst = ");
- for (j=0; j<dst_size2; j++)
+ for (j = 0; j < dst_size2; j++)
HDprintf(" %02x", buf2[ENDIAN(dst_size2, j, endian)]);
HDmemcpy(&y, buf2, dst_size2);
HDprintf(" %29d\n", y);
}
- if(fails_this_test)
+ if (fails_this_test)
goto error;
- if(H5Pclose(dxpl_id) < 0) {
+ if (H5Pclose(dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't close property list\n");
goto error;
}
- if(buf1)
+ if (buf1)
HDfree(buf1);
- if(buf2)
+ if (buf2)
HDfree(buf2);
- if(saved_buf1)
+ if (saved_buf1)
HDfree(saved_buf1);
- if(saved_buf2)
+ if (saved_buf2)
HDfree(saved_buf2);
PASSED();
@@ -859,16 +864,15 @@ static int test_particular_fp_integer(void)
error:
HDfflush(stdout);
- H5E_BEGIN_TRY {
- H5Pclose(dxpl_id);
- } H5E_END_TRY;
- if(buf1)
+ H5E_BEGIN_TRY { H5Pclose(dxpl_id); }
+ H5E_END_TRY;
+ if (buf1)
HDfree(buf1);
- if(buf2)
+ if (buf2)
HDfree(buf2);
- if(saved_buf1)
+ if (saved_buf1)
HDfree(saved_buf1);
- if(saved_buf2)
+ if (saved_buf2)
HDfree(saved_buf2);
/* Restore the default error handler (set in h5_reset()) */
@@ -879,7 +883,6 @@ error:
return MAX((int)fails_this_test, 1);
}
-
/*-------------------------------------------------------------------------
* Function: test_derived_flt
*
@@ -899,43 +902,43 @@ error:
static int
test_derived_flt(void)
{
- hid_t file=-1, tid1=-1, tid2=-1;
- hid_t dxpl_id=-1;
- char filename[1024];
- size_t spos, epos, esize, mpos, msize, size;
- size_t src_size, dst_size;
- unsigned char *buf=NULL, *saved_buf=NULL;
- int *aligned=NULL;
- int endian; /*endianess */
- size_t nelmts = NTESTELEM;
- unsigned int fails_this_test = 0;
- const size_t max_fails=40; /*max number of failures*/
- char str[256]; /*message string */
- unsigned int i, j;
+ hid_t file = -1, tid1 = -1, tid2 = -1;
+ hid_t dxpl_id = -1;
+ char filename[1024];
+ size_t spos, epos, esize, mpos, msize, size;
+ size_t src_size, dst_size;
+ unsigned char *buf = NULL, *saved_buf = NULL;
+ int * aligned = NULL;
+ int endian; /*endianess */
+ size_t nelmts = NTESTELEM;
+ unsigned int fails_this_test = 0;
+ const size_t max_fails = 40; /*max number of failures*/
+ char str[256]; /*message string */
+ unsigned int i, j;
TESTING("user-define and query functions of floating-point types");
/* Create File */
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf("Can't create file\n");
goto error;
}
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
HDprintf("Can't create data transfer property list\n");
goto error;
}
- if((tid1 = H5Tcopy(H5T_IEEE_F64LE)) < 0) {
+ if ((tid1 = H5Tcopy(H5T_IEEE_F64LE)) < 0) {
H5_FAILED();
HDprintf("Can't copy data type\n");
goto error;
}
- if((tid2 = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
+ if ((tid2 = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
H5_FAILED();
HDprintf("Can't copy data type\n");
goto error;
@@ -959,78 +962,78 @@ test_derived_flt(void)
* holes among the significant bits. Exponent bias usually is set
* 2^(n-1)-1, where n is the exponent size.
*-----------------------------------------------------------------------*/
- if(H5Tset_fields(tid1, (size_t)44, (size_t)34, (size_t)10, (size_t)3, (size_t)31) < 0) {
+ if (H5Tset_fields(tid1, (size_t)44, (size_t)34, (size_t)10, (size_t)3, (size_t)31) < 0) {
H5_FAILED();
HDprintf("Can't set fields\n");
goto error;
}
- if(H5Tset_offset(tid1, (size_t)3) < 0) {
+ if (H5Tset_offset(tid1, (size_t)3) < 0) {
H5_FAILED();
HDprintf("Can't set offset\n");
goto error;
}
- if(H5Tset_precision(tid1, (size_t)42) < 0) {
+ if (H5Tset_precision(tid1, (size_t)42) < 0) {
H5_FAILED();
HDprintf("Can't set precision 1\n");
goto error;
}
- if(H5Tset_size(tid1, (size_t)7) < 0) {
+ if (H5Tset_size(tid1, (size_t)7) < 0) {
H5_FAILED();
HDprintf("Can't set size\n");
goto error;
}
- if(H5Tset_ebias(tid1, (size_t)511) < 0) {
+ if (H5Tset_ebias(tid1, (size_t)511) < 0) {
H5_FAILED();
HDprintf("Can't set exponent bias\n");
goto error;
}
- if(H5Tset_pad(tid1, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) {
+ if (H5Tset_pad(tid1, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) {
H5_FAILED();
HDprintf("Can't set padding\n");
goto error;
}
- if(H5Tcommit2(file, "new float type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Tcommit2(file, "new float type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Can't set inpad\n");
goto error;
}
- if(H5Tclose(tid1) < 0) {
+ if (H5Tclose(tid1) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
}
- if((tid1 = H5Topen2(file, "new float type 1", H5P_DEFAULT)) < 0)
+ if ((tid1 = H5Topen2(file, "new float type 1", H5P_DEFAULT)) < 0)
FAIL_PUTS_ERROR("Can't open datatype")
- if(H5Tget_fields(tid1, &spos, &epos, &esize, &mpos, &msize) < 0) {
+ if (H5Tget_fields(tid1, &spos, &epos, &esize, &mpos, &msize) < 0) {
H5_FAILED();
HDprintf("Can't get fields\n");
goto error;
}
- if(spos != 44 || epos != 34 || esize != 10 || mpos != 3 || msize != 31) {
+ if (spos != 44 || epos != 34 || esize != 10 || mpos != 3 || msize != 31) {
H5_FAILED();
HDprintf("Wrong field values\n");
goto error;
}
- if(H5Tget_precision(tid1) != 42) {
+ if (H5Tget_precision(tid1) != 42) {
H5_FAILED();
HDprintf("Can't get precision or wrong precision\n");
goto error;
}
- if(H5Tget_offset(tid1)!=3) {
+ if (H5Tget_offset(tid1) != 3) {
H5_FAILED();
HDprintf("Can't get offset or wrong offset\n");
goto error;
}
- if((size = H5Tget_size(tid1))!=7) {
+ if ((size = H5Tget_size(tid1)) != 7) {
H5_FAILED();
HDprintf("Can't get size or wrong size\n");
goto error;
}
- if(H5Tget_ebias(tid1)!=511) {
+ if (H5Tget_ebias(tid1) != 511) {
H5_FAILED();
HDprintf("Can't get exponent bias or wrong bias\n");
goto error;
@@ -1040,63 +1043,64 @@ test_derived_flt(void)
* Then convert data from the floating-point type back to native integer.
* Compare the final data with the original data.
*/
- src_size = H5Tget_size(H5T_NATIVE_INT);
- endian = H5Tget_order(H5T_NATIVE_INT);
- buf = (unsigned char *)HDmalloc(nelmts * (MAX(src_size, size)));
+ src_size = H5Tget_size(H5T_NATIVE_INT);
+ endian = H5Tget_order(H5T_NATIVE_INT);
+ buf = (unsigned char *)HDmalloc(nelmts * (MAX(src_size, size)));
saved_buf = (unsigned char *)HDmalloc(nelmts * src_size);
HDmemset(buf, 0, nelmts * MAX(src_size, size));
HDmemset(saved_buf, 0, nelmts * src_size);
aligned = (int *)HDcalloc((size_t)1, src_size);
- for(i = 0; i < nelmts * src_size; i++)
+ for (i = 0; i < nelmts * src_size; i++)
buf[i] = saved_buf[i] = (unsigned char)HDrand();
/* Convert data from native integer to derived floating-point type.
* The mantissa is big enough to retain the integer's precision. */
- if(H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
+ if (H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't convert data\n");
goto error;
}
/* Convert data from the derived floating-point type back to native integer. */
- if(H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id) < 0) {
+ if (H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't convert data\n");
goto error;
}
/* Are the values still the same?*/
- for(i=0; i<nelmts; i++) {
- for(j=0; j<src_size; j++)
- if(buf[i*src_size+j]!=saved_buf[i*src_size+j])
- break;
- if(j==src_size)
- continue; /*no error*/
+ for (i = 0; i < nelmts; i++) {
+ for (j = 0; j < src_size; j++)
+ if (buf[i * src_size + j] != saved_buf[i * src_size + j])
+ break;
+ if (j == src_size)
+ continue; /*no error*/
/* Print errors */
- if (0==fails_this_test++) {
- HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
- HDprintf("%-70s", str);
- HDfflush(stdout);
+ if (0 == fails_this_test++) {
+ HDsnprintf(str, sizeof(str),
+ "\nTesting random sw derived floating-point -> derived floating-point conversions");
+ HDprintf("%-70s", str);
+ HDfflush(stdout);
H5_FAILED();
}
HDprintf(" test %u elmt %u: \n", 1, (unsigned)i);
HDprintf(" src = ");
- for (j=0; j<src_size; j++)
- HDprintf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ for (j = 0; j < src_size; j++)
+ HDprintf(" %02x", saved_buf[i * src_size + ENDIAN(src_size, j, endian)]);
- HDmemcpy(aligned, saved_buf+i*sizeof(int), sizeof(int));
+ HDmemcpy(aligned, saved_buf + i * sizeof(int), sizeof(int));
HDprintf(" %29d\n", *aligned);
HDprintf(" dst = ");
- for (j=0; j<src_size; j++)
- HDprintf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ for (j = 0; j < src_size; j++)
+ HDprintf(" %02x", buf[i * src_size + ENDIAN(src_size, j, endian)]);
- HDmemcpy(aligned, buf+i*sizeof(int), sizeof(int));
+ HDmemcpy(aligned, buf + i * sizeof(int), sizeof(int));
HDprintf(" %29d\n", *aligned);
- if (fails_this_test>=max_fails) {
+ if (fails_this_test >= max_fails) {
HDputs(" maximum failures reached, aborting test...");
goto error;
}
@@ -1106,9 +1110,9 @@ test_derived_flt(void)
HDfree(buf);
HDfree(saved_buf);
HDfree(aligned);
- buf = NULL;
+ buf = NULL;
saved_buf = NULL;
- aligned = NULL;
+ aligned = NULL;
/*--------------------------------------------------------------------------
* 2nd floating-point type
@@ -1119,77 +1123,77 @@ test_derived_flt(void)
* 2 1 0
* SEEEEEEE MMMMMMMM MMMMMMMM
*--------------------------------------------------------------------------*/
- if(H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) {
+ if (H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) {
H5_FAILED();
HDprintf("Can't set fields\n");
goto error;
}
- if(H5Tset_offset(tid2, (size_t)0) < 0) {
+ if (H5Tset_offset(tid2, (size_t)0) < 0) {
H5_FAILED();
HDprintf("Can't set offset\n");
goto error;
}
- if(H5Tset_precision(tid2, (size_t)24) < 0) {
+ if (H5Tset_precision(tid2, (size_t)24) < 0) {
H5_FAILED();
HDprintf("Can't set precision 2\n");
goto error;
}
- if(H5Tset_size(tid2, (size_t)3) < 0) {
+ if (H5Tset_size(tid2, (size_t)3) < 0) {
H5_FAILED();
HDprintf("Can't set size\n");
goto error;
}
- if(H5Tset_ebias(tid2, (size_t)63) < 0) {
+ if (H5Tset_ebias(tid2, (size_t)63) < 0) {
H5_FAILED();
HDprintf("Can't set size\n");
goto error;
}
- if(H5Tset_pad(tid2, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) {
+ if (H5Tset_pad(tid2, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) {
H5_FAILED();
HDprintf("Can't set padding\n");
goto error;
}
- if(H5Tcommit2(file, "new float type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Tcommit2(file, "new float type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Can't set inpad\n");
goto error;
}
- if(H5Tclose(tid2) < 0) {
+ if (H5Tclose(tid2) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
}
- if((tid2 = H5Topen2(file, "new float type 2", H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(file, "new float type 2", H5P_DEFAULT)) < 0)
FAIL_PUTS_ERROR("Can't open datatype")
- if(H5Tget_fields(tid2, &spos, &epos, &esize, &mpos, &msize) < 0) {
+ if (H5Tget_fields(tid2, &spos, &epos, &esize, &mpos, &msize) < 0) {
H5_FAILED();
HDprintf("Can't get fields\n");
goto error;
}
- if(spos != 23 || epos != 16 || esize != 7 || mpos != 0 || msize != 16) {
+ if (spos != 23 || epos != 16 || esize != 7 || mpos != 0 || msize != 16) {
H5_FAILED();
HDprintf("Wrong field values\n");
goto error;
}
- if(H5Tget_precision(tid2) != 24) {
+ if (H5Tget_precision(tid2) != 24) {
H5_FAILED();
HDprintf("Can't get precision or wrong precision\n");
goto error;
}
- if(H5Tget_offset(tid2)!=0) {
+ if (H5Tget_offset(tid2) != 0) {
H5_FAILED();
HDprintf("Can't get offset or wrong offset\n");
goto error;
}
- if((size = H5Tget_size(tid2))!=3) {
+ if ((size = H5Tget_size(tid2)) != 3) {
H5_FAILED();
HDprintf("Can't get size or wrong size\n");
goto error;
}
- if(H5Tget_ebias(tid2)!=63) {
+ if (H5Tget_ebias(tid2) != 63) {
H5_FAILED();
HDprintf("Can't get exponent bias or wrong bias\n");
goto error;
@@ -1199,95 +1203,98 @@ test_derived_flt(void)
* Then convert data from the 1st type back to the 2nd type.
* Compare the final data with the original data.
*/
- src_size = H5Tget_size(tid2);
- dst_size = H5Tget_size(tid1);
- endian = H5Tget_order(tid2);
- buf = (unsigned char *)HDmalloc(nelmts * (MAX(src_size, dst_size)));
+ src_size = H5Tget_size(tid2);
+ dst_size = H5Tget_size(tid1);
+ endian = H5Tget_order(tid2);
+ buf = (unsigned char *)HDmalloc(nelmts * (MAX(src_size, dst_size)));
saved_buf = (unsigned char *)HDmalloc(nelmts * src_size);
HDmemset(buf, 0, nelmts * MAX(src_size, dst_size));
- HDmemset(saved_buf, 0, nelmts*src_size);
+ HDmemset(saved_buf, 0, nelmts * src_size);
- for(i=0; i<nelmts*src_size; i++)
+ for (i = 0; i < nelmts * src_size; i++)
buf[i] = saved_buf[i] = (unsigned char)HDrand();
/* Convert data from the 2nd to the 1st derived floating-point type.
* The mantissa and exponent of the 2nd type are big enough to retain
* the precision and exponent power. */
- if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
+ if (H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't convert data\n");
goto error;
}
/* Convert data from the 1st back to the 2nd derived floating-point type. */
- if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
+ if (H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't convert data\n");
goto error;
}
/* Are the values still the same?*/
- for(i=0; i<nelmts; i++) {
- for(j=0; j<src_size; j++)
- if(buf[i*src_size+j]!=saved_buf[i*src_size+j])
- break;
- if(j==src_size)
- continue; /*no error*/
+ for (i = 0; i < nelmts; i++) {
+ for (j = 0; j < src_size; j++)
+ if (buf[i * src_size + j] != saved_buf[i * src_size + j])
+ break;
+ if (j == src_size)
+ continue; /*no error*/
/* If original value is NaN(exponent bits are all ones, 11..11),
* the library simply sets all mantissa bits to ones. So don't
* compare values in this case.
*/
- if((buf[i*src_size+2]==0x7f && saved_buf[i*src_size+2]==0x7f) ||
- (buf[i*src_size+2]==0xff && saved_buf[i*src_size+2]==0xff))
+ if ((buf[i * src_size + 2] == 0x7f && saved_buf[i * src_size + 2] == 0x7f) ||
+ (buf[i * src_size + 2] == 0xff && saved_buf[i * src_size + 2] == 0xff))
continue;
/* Print errors */
- if (0==fails_this_test++) {
- HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
- HDprintf("%-70s", str);
- HDfflush(stdout);
+ if (0 == fails_this_test++) {
+ HDsnprintf(str, sizeof(str),
+ "\nTesting random sw derived floating-point -> derived floating-point conversions");
+ HDprintf("%-70s", str);
+ HDfflush(stdout);
H5_FAILED();
}
HDprintf(" test %u elmt %u: \n", 1, (unsigned)i);
HDprintf(" src = ");
- for (j=0; j<src_size; j++)
- HDprintf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ for (j = 0; j < src_size; j++)
+ HDprintf(" %02x", saved_buf[i * src_size + ENDIAN(src_size, j, endian)]);
HDprintf("\n");
HDprintf(" dst = ");
- for (j=0; j<src_size; j++)
- HDprintf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ for (j = 0; j < src_size; j++)
+ HDprintf(" %02x", buf[i * src_size + ENDIAN(src_size, j, endian)]);
HDprintf("\n");
- if (fails_this_test>=max_fails) {
+ if (fails_this_test >= max_fails) {
HDputs(" maximum failures reached, aborting test...");
goto error;
}
}
- if (buf) HDfree(buf);
- if (saved_buf) HDfree(saved_buf);
+ if (buf)
+ HDfree(buf);
+ if (saved_buf)
+ HDfree(saved_buf);
- if(H5Tclose(tid1) < 0) {
+ if (H5Tclose(tid1) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
}
- if(H5Tclose(tid2) < 0) {
+ if (H5Tclose(tid2) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
}
- if(H5Pclose(dxpl_id) < 0) {
+ if (H5Pclose(dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't close property list\n");
goto error;
}
- if(H5Fclose(file) < 0) {
+ if (H5Fclose(file) < 0) {
H5_FAILED();
HDprintf("Can't close file\n");
goto error;
@@ -1298,21 +1305,26 @@ test_derived_flt(void)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return 0;
- error:
- if (buf) HDfree(buf);
- if (saved_buf) HDfree(saved_buf);
- if (aligned) HDfree(aligned);
+error:
+ if (buf)
+ HDfree(buf);
+ if (saved_buf)
+ HDfree(saved_buf);
+ if (aligned)
+ HDfree(aligned);
HDfflush(stdout);
- H5E_BEGIN_TRY {
- H5Tclose (tid1);
- H5Tclose (tid2);
- H5Pclose (dxpl_id);
- H5Fclose (file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(tid1);
+ H5Tclose(tid2);
+ H5Pclose(dxpl_id);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1322,7 +1334,6 @@ test_derived_flt(void)
return MAX((int)fails_this_test, 1);
}
-
/*-------------------------------------------------------------------------
* Function: test_derived_integer
*
@@ -1342,41 +1353,41 @@ test_derived_flt(void)
static int
test_derived_integer(void)
{
- hid_t file=-1, tid1=-1, tid2=-1;
- hid_t dxpl_id=-1;
- char filename[1024];
- size_t src_size, dst_size;
- unsigned char *buf=NULL, *saved_buf=NULL;
- int endian; /*endianess */
- size_t nelmts = NTESTELEM;
- unsigned int fails_this_test = 0;
- const size_t max_fails=40; /*max number of failures*/
- char str[256]; /*message string */
- unsigned int i, j;
+ hid_t file = -1, tid1 = -1, tid2 = -1;
+ hid_t dxpl_id = -1;
+ char filename[1024];
+ size_t src_size, dst_size;
+ unsigned char *buf = NULL, *saved_buf = NULL;
+ int endian; /*endianess */
+ size_t nelmts = NTESTELEM;
+ unsigned int fails_this_test = 0;
+ const size_t max_fails = 40; /*max number of failures*/
+ char str[256]; /*message string */
+ unsigned int i, j;
TESTING("user-define and query functions of integer types");
/* Create File */
h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf("Can't create file\n");
goto error;
}
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
HDprintf("Can't create data transfer property list\n");
goto error;
}
- if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) {
+ if ((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) {
H5_FAILED();
HDprintf("Can't copy data type\n");
goto error;
}
- if((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) {
+ if ((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) {
H5_FAILED();
HDprintf("Can't copy data type\n");
goto error;
@@ -1394,60 +1405,60 @@ test_derived_integer(void)
* of a new integer type, H5Tset_precision, H5Tset_offset, H5Tset_size,
* H5Tset_order, H5Tset_pad, H5Tset_sign.
*--------------------------------------------------------------------------*/
- if(H5Tset_offset(tid1, (size_t)0) < 0) {
+ if (H5Tset_offset(tid1, (size_t)0) < 0) {
H5_FAILED();
HDprintf("Can't set offset\n");
goto error;
}
- if(H5Tset_size(tid1, (size_t)3) < 0) {
+ if (H5Tset_size(tid1, (size_t)3) < 0) {
H5_FAILED();
HDprintf("Can't set size\n");
goto error;
}
- if(H5Tset_precision(tid1, (size_t)24) < 0) {
+ if (H5Tset_precision(tid1, (size_t)24) < 0) {
H5_FAILED();
HDprintf("Can't set precision\n");
goto error;
}
- if(H5Tset_order(tid1, H5T_ORDER_BE) < 0) {
+ if (H5Tset_order(tid1, H5T_ORDER_BE) < 0) {
H5_FAILED();
HDprintf("Can't set order\n");
goto error;
}
- if(H5Tcommit2(file, "new integer type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Tcommit2(file, "new integer type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Can't commit data type\n");
goto error;
}
- if(H5Tclose(tid1) < 0) {
+ if (H5Tclose(tid1) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
}
- if((tid1 = H5Topen2(file, "new integer type 1", H5P_DEFAULT)) < 0)
+ if ((tid1 = H5Topen2(file, "new integer type 1", H5P_DEFAULT)) < 0)
FAIL_PUTS_ERROR("Can't open datatype")
- if(H5Tget_precision(tid1) != 24) {
+ if (H5Tget_precision(tid1) != 24) {
H5_FAILED();
HDprintf("Can't get precision or wrong precision\n");
goto error;
}
- if(H5Tget_offset(tid1) != 0) {
+ if (H5Tget_offset(tid1) != 0) {
H5_FAILED();
HDprintf("Can't get offset or wrong offset\n");
goto error;
}
- if(H5Tget_size(tid1) != 3) {
+ if (H5Tget_size(tid1) != 3) {
H5_FAILED();
HDprintf("Can't get size or wrong size\n");
goto error;
}
- if(H5Tget_order(tid1)!=H5T_ORDER_BE) {
+ if (H5Tget_order(tid1) != H5T_ORDER_BE) {
H5_FAILED();
HDprintf("Can't get order or wrong order\n");
goto error;
@@ -1461,54 +1472,54 @@ test_derived_integer(void)
* 7 6 5 4 3 2 1 0
* ??????SI IIIIIIII IIIIIIII IIIIIIII IIIIIIII IIIIIIII IIIIII?? ????????
*--------------------------------------------------------------------------*/
- if(H5Tset_precision(tid2, (size_t)48) < 0) {
+ if (H5Tset_precision(tid2, (size_t)48) < 0) {
H5_FAILED();
HDprintf("Can't set precision\n");
goto error;
}
- if(H5Tset_offset(tid2, (size_t)10) < 0) {
+ if (H5Tset_offset(tid2, (size_t)10) < 0) {
H5_FAILED();
HDprintf("Can't set offset\n");
goto error;
}
- if(H5Tset_sign(tid2, H5T_SGN_2) < 0) {
+ if (H5Tset_sign(tid2, H5T_SGN_2) < 0) {
H5_FAILED();
HDprintf("Can't set offset\n");
goto error;
}
- if(H5Tcommit2(file, "new integer type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Tcommit2(file, "new integer type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Can't commit data type\n");
goto error;
}
- if(H5Tclose(tid2) < 0) {
+ if (H5Tclose(tid2) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
}
- if((tid2 = H5Topen2(file, "new integer type 2", H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(file, "new integer type 2", H5P_DEFAULT)) < 0)
FAIL_PUTS_ERROR("Can't open datatype")
- if(H5Tget_precision(tid2) != 48) {
+ if (H5Tget_precision(tid2) != 48) {
H5_FAILED();
HDprintf("Can't get precision or wrong precision\n");
goto error;
}
- if(H5Tget_offset(tid2) != 10) {
+ if (H5Tget_offset(tid2) != 10) {
H5_FAILED();
HDprintf("Can't get offset or wrong offset\n");
goto error;
}
- if(H5Tget_size(tid2) != 8) {
+ if (H5Tget_size(tid2) != 8) {
H5_FAILED();
HDprintf("Can't get size or wrong size\n");
goto error;
}
- if(H5Tget_sign(tid2)!=H5T_SGN_2) {
+ if (H5Tget_sign(tid2) != H5T_SGN_2) {
H5_FAILED();
HDprintf("Can't get sign or wrong sign\n");
goto error;
@@ -1518,84 +1529,85 @@ test_derived_integer(void)
* Then convert data from the 2nd type back to the 1st type.
* Compare the final data with the original data.
*/
- src_size = H5Tget_size(tid1);
- dst_size = H5Tget_size(tid2);
- endian = H5Tget_order(tid1);
- buf = (unsigned char *)HDmalloc(nelmts*(MAX(src_size, dst_size)));
- saved_buf = (unsigned char *)HDmalloc(nelmts*src_size);
+ src_size = H5Tget_size(tid1);
+ dst_size = H5Tget_size(tid2);
+ endian = H5Tget_order(tid1);
+ buf = (unsigned char *)HDmalloc(nelmts * (MAX(src_size, dst_size)));
+ saved_buf = (unsigned char *)HDmalloc(nelmts * src_size);
HDmemset(buf, 0, nelmts * MAX(src_size, dst_size));
- HDmemset(saved_buf, 0, nelmts*src_size);
+ HDmemset(saved_buf, 0, nelmts * src_size);
- for(i=0; i<nelmts * src_size; i++)
+ for (i = 0; i < nelmts * src_size; i++)
buf[i] = saved_buf[i] = (unsigned char)HDrand();
/* Convert data from the 1st to the 2nd derived integer type.
* The precision of the 2nd type are big enough to retain
* the 1st type's precision. */
- if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
+ if (H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't convert data\n");
goto error;
}
/* Convert data from the 2nd back to the 1st derived integer type. */
- if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
+ if (H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't convert data\n");
goto error;
}
/* Are the values still the same?*/
- for(i=0; i<nelmts; i++) {
- for(j=0; j<src_size; j++)
- if(buf[i*src_size+j]!=saved_buf[i*src_size+j])
- break;
- if(j==src_size)
- continue; /*no error*/
+ for (i = 0; i < nelmts; i++) {
+ for (j = 0; j < src_size; j++)
+ if (buf[i * src_size + j] != saved_buf[i * src_size + j])
+ break;
+ if (j == src_size)
+ continue; /*no error*/
/* Print errors */
- if (0==fails_this_test++) {
- HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions");
- HDprintf("%-70s", str);
- HDfflush(stdout);
+ if (0 == fails_this_test++) {
+ HDsnprintf(str, sizeof(str),
+ "\nTesting random sw derived integer -> derived integer conversions");
+ HDprintf("%-70s", str);
+ HDfflush(stdout);
H5_FAILED();
}
HDprintf(" test %u elmt %u: \n", 1, (unsigned)i);
HDprintf(" src = ");
- for (j=0; j<src_size; j++)
- HDprintf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ for (j = 0; j < src_size; j++)
+ HDprintf(" %02x", saved_buf[i * src_size + ENDIAN(src_size, j, endian)]);
HDprintf("\n");
HDprintf(" dst = ");
- for (j=0; j<src_size; j++)
- HDprintf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ for (j = 0; j < src_size; j++)
+ HDprintf(" %02x", buf[i * src_size + ENDIAN(src_size, j, endian)]);
HDprintf("\n");
- if (fails_this_test>=max_fails) {
+ if (fails_this_test >= max_fails) {
HDputs(" maximum failures reached, aborting test...");
goto error;
}
}
- if(H5Tclose(tid1) < 0) {
+ if (H5Tclose(tid1) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
}
- if(H5Tclose(tid2) < 0) {
+ if (H5Tclose(tid2) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
}
- if(H5Pclose(dxpl_id) < 0) {
+ if (H5Pclose(dxpl_id) < 0) {
H5_FAILED();
HDprintf("Can't close property list\n");
goto error;
}
- if(H5Fclose(file) < 0) {
+ if (H5Fclose(file) < 0) {
H5_FAILED();
HDprintf("Can't close file\n");
goto error;
@@ -1609,20 +1621,24 @@ test_derived_integer(void)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return 0;
- error:
- if (buf) HDfree(buf);
- if (saved_buf) HDfree(saved_buf);
+error:
+ if (buf)
+ HDfree(buf);
+ if (saved_buf)
+ HDfree(saved_buf);
HDfflush(stdout);
- H5E_BEGIN_TRY {
- H5Tclose (tid1);
- H5Tclose (tid2);
- H5Pclose (dxpl_id);
- H5Fclose (file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(tid1);
+ H5Tclose(tid2);
+ H5Pclose(dxpl_id);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1632,7 +1648,6 @@ test_derived_integer(void)
return MAX((int)fails_this_test, 1);
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_int_1
*
@@ -1659,160 +1674,189 @@ test_derived_integer(void)
static int
test_conv_int_1(const char *name, hid_t src, hid_t dst)
{
- size_t nelmts=0; /*num values per test */
- const size_t max_fails=8; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- char str[256]; /*hello string */
- dtype_t src_type, dst_type; /*data types */
- const char *src_type_name=NULL; /*source type name */
- const char *dst_type_name=NULL; /*destination type name */
- int endian; /*machine endianess */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf=NULL; /*buffer for conversion */
- unsigned char *saved=NULL; /*original values */
- size_t j, k; /*counters */
- unsigned char *hw=NULL; /*hardware conv result */
- unsigned char src_bits[32]; /*src value in LE order */
- unsigned char dst_bits[32]; /*dest value in LE order*/
- size_t src_nbits; /*source length in bits */
- size_t dst_nbits; /*dst length in bits */
- H5T_sign_t src_sign; /*source sign type */
- H5T_sign_t dst_sign; /*dst sign type */
- void *aligned=NULL; /*aligned temp buffer */
+ size_t nelmts = 0; /*num values per test */
+ const size_t max_fails = 8; /*max number of failures*/
+ size_t fails_all_tests = 0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ char str[256]; /*hello string */
+ dtype_t src_type, dst_type; /*data types */
+ const char * src_type_name = NULL; /*source type name */
+ const char * dst_type_name = NULL; /*destination type name */
+ int endian; /*machine endianess */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char * buf = NULL; /*buffer for conversion */
+ unsigned char * saved = NULL; /*original values */
+ size_t j, k; /*counters */
+ unsigned char * hw = NULL; /*hardware conv result */
+ unsigned char src_bits[32]; /*src value in LE order */
+ unsigned char dst_bits[32]; /*dest value in LE order*/
+ size_t src_nbits; /*source length in bits */
+ size_t dst_nbits; /*dst length in bits */
+ H5T_sign_t src_sign; /*source sign type */
+ H5T_sign_t dst_sign; /*dst sign type */
+ void * aligned = NULL; /*aligned temp buffer */
signed char hw_char;
- unsigned char hw_uchar;
- short hw_short;
- unsigned short hw_ushort;
- int hw_int;
- unsigned hw_uint;
- long hw_long;
- unsigned long hw_ulong;
- long long hw_llong;
- unsigned long long hw_ullong;
+ unsigned char hw_uchar;
+ short hw_short;
+ unsigned short hw_ushort;
+ int hw_int;
+ unsigned hw_uint;
+ long hw_long;
+ unsigned long hw_ulong;
+ long long hw_llong;
+ unsigned long long hw_ullong;
/* What are the names of the source and destination types */
if (H5Tequal(src, H5T_NATIVE_SCHAR)) {
- src_type_name = "signed char";
- src_type = INT_SCHAR;
- } else if (H5Tequal(src, H5T_NATIVE_UCHAR)) {
- src_type_name = "unsigned char";
- src_type = INT_UCHAR;
- } else if (H5Tequal(src, H5T_NATIVE_SHORT)) {
- src_type_name = "short";
- src_type = INT_SHORT;
- } else if (H5Tequal(src, H5T_NATIVE_USHORT)) {
- src_type_name = "unsigned short";
- src_type = INT_USHORT;
- } else if (H5Tequal(src, H5T_NATIVE_INT)) {
- src_type_name = "int";
- src_type = INT_INT;
- } else if (H5Tequal(src, H5T_NATIVE_UINT)) {
- src_type_name = "unsigned int";
- src_type = INT_UINT;
- } else if (H5Tequal(src, H5T_NATIVE_LONG)) {
- src_type_name = "long";
- src_type = INT_LONG;
- } else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
- src_type_name = "unsigned long";
- src_type = INT_ULONG;
- } else if (H5Tequal(src, H5T_NATIVE_LLONG)) {
- src_type_name = "long long";
- src_type = INT_LLONG;
- } else if (H5Tequal(src, H5T_NATIVE_ULLONG)) {
- src_type_name = "unsigned long long";
- src_type = INT_ULLONG;
- } else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
+ src_type_name = "signed char";
+ src_type = INT_SCHAR;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_UCHAR)) {
+ src_type_name = "unsigned char";
+ src_type = INT_UCHAR;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_SHORT)) {
+ src_type_name = "short";
+ src_type = INT_SHORT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_USHORT)) {
+ src_type_name = "unsigned short";
+ src_type = INT_USHORT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_INT)) {
+ src_type_name = "int";
+ src_type = INT_INT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_UINT)) {
+ src_type_name = "unsigned int";
+ src_type = INT_UINT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_LONG)) {
+ src_type_name = "long";
+ src_type = INT_LONG;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
+ src_type_name = "unsigned long";
+ src_type = INT_ULONG;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_LLONG)) {
+ src_type_name = "long long";
+ src_type = INT_LLONG;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_ULLONG)) {
+ src_type_name = "unsigned long long";
+ src_type = INT_ULLONG;
+ }
+ else {
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
}
if (H5Tequal(dst, H5T_NATIVE_SCHAR)) {
- dst_type_name = "signed char";
- dst_type = INT_SCHAR;
- } else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) {
- dst_type_name = "unsigned char";
- dst_type = INT_UCHAR;
- } else if (H5Tequal(dst, H5T_NATIVE_SHORT)) {
- dst_type_name = "short";
- dst_type = INT_SHORT;
- } else if (H5Tequal(dst, H5T_NATIVE_USHORT)) {
- dst_type_name = "unsigned short";
- dst_type = INT_USHORT;
- } else if (H5Tequal(dst, H5T_NATIVE_INT)) {
- dst_type_name = "int";
- dst_type = INT_INT;
- } else if (H5Tequal(dst, H5T_NATIVE_UINT)) {
- dst_type_name = "unsigned int";
- dst_type = INT_UINT;
- } else if (H5Tequal(dst, H5T_NATIVE_LONG)) {
- dst_type_name = "long";
- dst_type = INT_LONG;
- } else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
- dst_type_name = "unsigned long";
- dst_type = INT_ULONG;
- } else if (H5Tequal(dst, H5T_NATIVE_LLONG)) {
- dst_type_name = "long long";
- dst_type = INT_LLONG;
- } else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) {
- dst_type_name = "unsigned long long";
- dst_type = INT_ULLONG;
- } else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
+ dst_type_name = "signed char";
+ dst_type = INT_SCHAR;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) {
+ dst_type_name = "unsigned char";
+ dst_type = INT_UCHAR;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_SHORT)) {
+ dst_type_name = "short";
+ dst_type = INT_SHORT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_USHORT)) {
+ dst_type_name = "unsigned short";
+ dst_type = INT_USHORT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_INT)) {
+ dst_type_name = "int";
+ dst_type = INT_INT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_UINT)) {
+ dst_type_name = "unsigned int";
+ dst_type = INT_UINT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_LONG)) {
+ dst_type_name = "long";
+ dst_type = INT_LONG;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
+ dst_type_name = "unsigned long";
+ dst_type = INT_ULONG;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_LLONG)) {
+ dst_type_name = "long long";
+ dst_type = INT_LLONG;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) {
+ dst_type_name = "unsigned long long";
+ dst_type = INT_ULLONG;
+ }
+ else {
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
}
/* Sanity checks */
- if (OTHER==src_type || OTHER==dst_type) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- HDprintf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
- } else {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ if (OTHER == src_type || OTHER == dst_type) {
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
+ }
+ else {
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name);
HDprintf("%-70s", str);
HDfflush(stdout);
- fails_this_test=0;
+ fails_this_test = 0;
}
/* Some information about datatypes */
- endian = H5Tget_order(H5T_NATIVE_INT);
- src_size = H5Tget_size(src);
- dst_size = H5Tget_size(dst);
+ endian = H5Tget_order(H5T_NATIVE_INT);
+ src_size = H5Tget_size(src);
+ dst_size = H5Tget_size(dst);
src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
- src_sign = H5Tget_sign(src);
- dst_sign = H5Tget_sign(dst);
- aligned = HDcalloc((size_t)1, sizeof(long long));
+ src_sign = H5Tget_sign(src);
+ dst_sign = H5Tget_sign(dst);
+ aligned = HDcalloc((size_t)1, sizeof(long long));
/* Allocate and initialize the source buffer through macro INIT_INTEGER. The BUF
* will be used for the conversion while the SAVED buffer will be
* used for the comparison later.
*/
- if(src_type == INT_SCHAR) {
+ if (src_type == INT_SCHAR) {
INIT_INTEGER(signed char, SCHAR_MAX, SCHAR_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_UCHAR) {
+ }
+ else if (src_type == INT_UCHAR) {
INIT_INTEGER(unsigned char, UCHAR_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_SHORT) {
+ }
+ else if (src_type == INT_SHORT) {
INIT_INTEGER(short, SHRT_MAX, SHRT_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_USHORT) {
+ }
+ else if (src_type == INT_USHORT) {
INIT_INTEGER(unsigned short, USHRT_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_INT) {
+ }
+ else if (src_type == INT_INT) {
INIT_INTEGER(int, INT_MAX, INT_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_UINT) {
+ }
+ else if (src_type == INT_UINT) {
INIT_INTEGER(unsigned int, UINT_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_LONG) {
+ }
+ else if (src_type == INT_LONG) {
INIT_INTEGER(long, LONG_MAX, LONG_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_ULONG) {
+ }
+ else if (src_type == INT_ULONG) {
INIT_INTEGER(unsigned long, ULONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_LLONG) {
+ }
+ else if (src_type == INT_LLONG) {
INIT_INTEGER(long long, LLONG_MAX, LLONG_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_ULLONG) {
+ }
+ else if (src_type == INT_ULLONG) {
INIT_INTEGER(unsigned long long, ULLONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else
+ }
+ else
goto error;
/* Perform the conversion */
@@ -1820,528 +1864,537 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
goto error;
/* Check the results from the library against hardware */
- for (j=0; j<nelmts; j++) {
- if (INT_SCHAR==dst_type) {
- hw = (unsigned char*)&hw_char;
+ for (j = 0; j < nelmts; j++) {
+ if (INT_SCHAR == dst_type) {
+ hw = (unsigned char *)&hw_char;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_char = (signed char)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_char = (signed char)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_char = (signed char)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_char = (signed char)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_char = (signed char)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_char = (signed char)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_char = (signed char)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_char = (signed char)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_char = (signed char)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_char = (signed char)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_char = (signed char)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_char = (signed char)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_char = (signed char)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_char = (signed char)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_char = (signed char)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_char = (signed char)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_char = (signed char)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_char = (signed char)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_char = (signed char)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_char = (signed char)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_UCHAR==dst_type) {
- hw = (unsigned char*)&hw_uchar;
+ }
+ else if (INT_UCHAR == dst_type) {
+ hw = (unsigned char *)&hw_uchar;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_uchar = (unsigned char)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_uchar = (unsigned char)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_uchar = (unsigned char)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_uchar = (unsigned char)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_uchar = (unsigned char)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_uchar = (unsigned char)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_uchar = (unsigned char)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_uchar = (unsigned char)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_uchar = (unsigned char)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_uchar = (unsigned char)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_uchar = (unsigned char)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_uchar = (unsigned char)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_uchar = (unsigned char)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_uchar = (unsigned char)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_uchar = (unsigned char)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_uchar = (unsigned char)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_uchar = (unsigned char)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_uchar = (unsigned char)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_uchar = (unsigned char)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_uchar = (unsigned char)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_SHORT==dst_type) {
- hw = (unsigned char*)&hw_short;
+ }
+ else if (INT_SHORT == dst_type) {
+ hw = (unsigned char *)&hw_short;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_short = (short)(*((char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_short = (short)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_short = (short)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_short = (short)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_short = (short)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_short = (short)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_short = (short)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_short = (short)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_short = (short)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_short = (short)(*((unsigned long long*)aligned));
- break;
-
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(char), sizeof(char));
+ hw_short = (short)(*((char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_short = (short)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_short = (short)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_short = (short)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_short = (short)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_short = (short)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_short = (short)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_short = (short)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_short = (short)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_short = (short)(*((unsigned long long *)aligned));
+ break;
+
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_USHORT==dst_type) {
- hw = (unsigned char*)&hw_ushort;
+ }
+ else if (INT_USHORT == dst_type) {
+ hw = (unsigned char *)&hw_ushort;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_ushort = (unsigned short)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_ushort = (unsigned short)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_ushort = (unsigned short)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_ushort = (unsigned short)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_ushort = (unsigned short)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_ushort = (unsigned short)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_ushort = (unsigned short)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_ushort = (unsigned short)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_ushort = (unsigned short)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_ushort = (unsigned short)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_ushort = (unsigned short)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_ushort = (unsigned short)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_ushort = (unsigned short)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_ushort = (unsigned short)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_ushort = (unsigned short)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_ushort = (unsigned short)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_ushort = (unsigned short)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_ushort = (unsigned short)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_ushort = (unsigned short)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_ushort = (unsigned short)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_INT==dst_type) {
- hw = (unsigned char*)&hw_int;
+ }
+ else if (INT_INT == dst_type) {
+ hw = (unsigned char *)&hw_int;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_int = (int)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_int = (int)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_int = (int)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_int = (int)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_int = (int)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_int = (int)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_int = (int)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_int = (int)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_int = (int)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_int = (int)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_int = (int)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_int = (int)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_int = (int)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_int = (int)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_int = (int)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_int = (int)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_int = (int)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_int = (int)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_int = (int)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_int = (int)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_UINT==dst_type) {
- hw = (unsigned char*)&hw_uint;
+ }
+ else if (INT_UINT == dst_type) {
+ hw = (unsigned char *)&hw_uint;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_uint = (unsigned int)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_uint = (unsigned int)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_uint = (unsigned int)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_uint = (unsigned int)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_uint = (unsigned int)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_uint = (unsigned int)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_uint = (unsigned int)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_uint = (unsigned int)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_uint = (unsigned int)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_uint = (unsigned int)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_uint = (unsigned int)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_uint = (unsigned int)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_uint = (unsigned int)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_uint = (unsigned int)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_uint = (unsigned int)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_uint = (unsigned int)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_uint = (unsigned int)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_uint = (unsigned int)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_uint = (unsigned int)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_uint = (unsigned int)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_LONG==dst_type) {
- hw = (unsigned char*)&hw_long;
+ }
+ else if (INT_LONG == dst_type) {
+ hw = (unsigned char *)&hw_long;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_long = (long int)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_long = (long int)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_long = (long int)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_long = (long int)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_long = (long int)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_long = (long int)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_long = (long int)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_long = (long int)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_long = (long int)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_long = (long int)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_long = (long int)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_long = (long int)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_long = (long int)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_long = (long int)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_long = (long int)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_long = (long int)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_long = (long int)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_long = (long int)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_long = (long int)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_long = (long int)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_ULONG==dst_type) {
- hw = (unsigned char*)&hw_ulong;
+ }
+ else if (INT_ULONG == dst_type) {
+ hw = (unsigned char *)&hw_ulong;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_ulong = (unsigned long)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_ulong = (unsigned long)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_ulong = (unsigned long)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_ulong = (unsigned long)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_ulong = (unsigned long)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_ulong = (unsigned long)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_ulong = (unsigned long)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_ulong = (unsigned long)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_ulong = (unsigned long)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_ulong = (unsigned long)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_ulong = (unsigned long)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_ulong = (unsigned long)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_ulong = (unsigned long)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_ulong = (unsigned long)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_ulong = (unsigned long)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_ulong = (unsigned long)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_ulong = (unsigned long)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_ulong = (unsigned long)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_ulong = (unsigned long)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_ulong = (unsigned long)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_LLONG==dst_type) {
- hw = (unsigned char*)&hw_llong;
+ }
+ else if (INT_LLONG == dst_type) {
+ hw = (unsigned char *)&hw_llong;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_llong = (long long)(*((char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_llong = (long long)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_llong = (long long)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_llong = (long long)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_llong = (long long)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_llong = (long long)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_llong = (long long)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_llong = (long long)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_llong = (long long)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_llong = (long long)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(char), sizeof(char));
+ hw_llong = (long long)(*((char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_llong = (long long)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_llong = (long long)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_llong = (long long)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_llong = (long long)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_llong = (long long)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_llong = (long long)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_llong = (long long)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_llong = (long long)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_llong = (long long)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_ULLONG==dst_type) {
- hw = (unsigned char*)&hw_ullong;
+ }
+ else if (INT_ULLONG == dst_type) {
+ hw = (unsigned char *)&hw_ullong;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_ullong = (unsigned long long)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_ullong = (unsigned long long)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_ullong = (unsigned long long)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_ullong = (unsigned long long)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_ullong = (unsigned long long)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_ullong = (unsigned long long)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_ullong = (unsigned long long)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_ullong = (unsigned long long)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_ullong = (unsigned long long)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_ullong = (unsigned long long)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_ullong = (unsigned long long)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_ullong = (unsigned long long)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_ullong = (unsigned long long)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_ullong = (unsigned long long)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_ullong = (unsigned long long)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_ullong = (unsigned long long)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_ullong = (unsigned long long)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_ullong = (unsigned long long)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_ullong = (unsigned long long)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_ullong = (unsigned long long)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
}
/* Make certain that there isn't some weird number of destination bits */
- assert(dst_nbits%8==0);
+ assert(dst_nbits % 8 == 0);
/* Are the two results the same? */
- for (k=(dst_size-(dst_nbits/8)); k<dst_size; k++)
- if (buf[j*dst_size+k]!=hw[k])
+ for (k = (dst_size - (dst_nbits / 8)); k < dst_size; k++)
+ if (buf[j * dst_size + k] != hw[k])
break;
- if (k==dst_size)
+ if (k == dst_size)
continue; /*no error*/
/*
@@ -2350,64 +2403,67 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* certain things. These routines have already been tested by
* the `bittests' program.
*/
- for (k=0; k<src_size; k++)
- src_bits[src_size-(k+1)] = saved[j*src_size+ENDIAN(src_size, k, endian)];
+ for (k = 0; k < src_size; k++)
+ src_bits[src_size - (k + 1)] = saved[j * src_size + ENDIAN(src_size, k, endian)];
- for (k=0; k<dst_size; k++)
- dst_bits[dst_size-(k+1)] = buf[j*dst_size+ENDIAN(dst_size, k, endian)];
+ for (k = 0; k < dst_size; k++)
+ dst_bits[dst_size - (k + 1)] = buf[j * dst_size + ENDIAN(dst_size, k, endian)];
/*
* Hardware usually doesn't handle overflows too gracefully. The
* hardware conversion result during overflows is usually garbage
* so we must handle those cases differetly when checking results.
*/
- if (H5T_SGN_2==src_sign && H5T_SGN_2==dst_sign) {
- if (src_nbits>dst_nbits) {
- if(0==H5T__bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
- H5T__bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits),
- H5T_BIT_MSB, 1)>=0) {
+ if (H5T_SGN_2 == src_sign && H5T_SGN_2 == dst_sign) {
+ if (src_nbits > dst_nbits) {
+ if (0 == H5T__bit_get_d(src_bits, src_nbits - 1, (size_t)1) &&
+ H5T__bit_find(src_bits, dst_nbits - 1, (src_nbits - dst_nbits), H5T_BIT_MSB, 1) >= 0) {
/*
* Source is positive and the magnitude is too large for
* the destination. The destination should be set to the
* maximum possible value: 0x7f...f
*/
- if (0==H5T__bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
- H5T__bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
+ if (0 == H5T__bit_get_d(dst_bits, dst_nbits - 1, (size_t)1) &&
+ H5T__bit_find(dst_bits, (size_t)0, dst_nbits - 1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
- } else if (1==H5T__bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
- H5T__bit_find(src_bits, (size_t)0, src_nbits-1, H5T_BIT_MSB,
- 0)+1>=(ssize_t)dst_nbits) {
+ }
+ else if (1 == H5T__bit_get_d(src_bits, src_nbits - 1, (size_t)1) &&
+ H5T__bit_find(src_bits, (size_t)0, src_nbits - 1, H5T_BIT_MSB, 0) + 1 >=
+ (ssize_t)dst_nbits) {
/*
* Source is negative but the magnitude is too large for
* the destination. The destination should be set to the
* smallest possible value: 0x80...0
*/
- if (1==H5T__bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
- H5T__bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 1) < 0)
+ if (1 == H5T__bit_get_d(dst_bits, dst_nbits - 1, (size_t)1) &&
+ H5T__bit_find(dst_bits, (size_t)0, dst_nbits - 1, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
}
- } else if(src_nbits<dst_nbits) {
+ }
+ else if (src_nbits < dst_nbits) {
/* Source is smaller than the destination */
- if(0==H5T__bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
+ if (0 == H5T__bit_get_d(src_bits, src_nbits - 1, (size_t)1)) {
/*
* Source is positive, so the excess bits in the
* destination should be set to 0's.
*/
- if (0==H5T__bit_get_d(dst_bits, src_nbits-1, (size_t)1) &&
- H5T__bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 1) < 0)
+ if (0 == H5T__bit_get_d(dst_bits, src_nbits - 1, (size_t)1) &&
+ H5T__bit_find(dst_bits, src_nbits, dst_nbits - src_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
- } else {
+ }
+ else {
/*
* Source is negative, so the excess bits in the
* destination should be set to 1's.
*/
- if (1==H5T__bit_get_d(dst_bits, src_nbits-1, (size_t)1) &&
- H5T__bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 0) < 0)
+ if (1 == H5T__bit_get_d(dst_bits, src_nbits - 1, (size_t)1) &&
+ H5T__bit_find(dst_bits, src_nbits, dst_nbits - src_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
}
- } else if (H5T_SGN_2==src_sign && H5T_SGN_NONE==dst_sign) {
- if (H5T__bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
+ }
+ else if (H5T_SGN_2 == src_sign && H5T_SGN_NONE == dst_sign) {
+ if (H5T__bit_get_d(src_bits, src_nbits - 1, (size_t)1)) {
/*
* The source is negative so the result should be zero.
* The source is negative if the most significant bit is
@@ -2415,9 +2471,9 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
*/
if (H5T__bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
- } else if (src_nbits>dst_nbits &&
- H5T__bit_find(src_bits, dst_nbits-1,
- src_nbits-dst_nbits, H5T_BIT_LSB, 1)>=0) {
+ }
+ else if (src_nbits > dst_nbits &&
+ H5T__bit_find(src_bits, dst_nbits - 1, src_nbits - dst_nbits, H5T_BIT_LSB, 1) >= 0) {
/*
* The source is a value with a magnitude too large for
* the destination. The destination should be the
@@ -2426,23 +2482,23 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
if (H5T__bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
- } else if (H5T_SGN_NONE==src_sign && H5T_SGN_2==dst_sign) {
- if (src_nbits>=dst_nbits &&
- H5T__bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits)+1,
- H5T_BIT_LSB, 1)>=0) {
+ }
+ else if (H5T_SGN_NONE == src_sign && H5T_SGN_2 == dst_sign) {
+ if (src_nbits >= dst_nbits &&
+ H5T__bit_find(src_bits, dst_nbits - 1, (src_nbits - dst_nbits) + 1, H5T_BIT_LSB, 1) >= 0) {
/*
* The source value has a magnitude that is larger than
* the destination can handle. The destination should be
* set to the largest possible positive value: 0x7f...f
*/
- if (0==H5T__bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
- H5T__bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
+ if (0 == H5T__bit_get_d(dst_bits, dst_nbits - 1, (size_t)1) &&
+ H5T__bit_find(dst_bits, (size_t)0, dst_nbits - 1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
- } else {
- if (src_nbits>dst_nbits &&
- H5T__bit_find(src_bits, dst_nbits, src_nbits-dst_nbits,
- H5T_BIT_LSB, 1)>=0) {
+ }
+ else {
+ if (src_nbits > dst_nbits &&
+ H5T__bit_find(src_bits, dst_nbits, src_nbits - dst_nbits, H5T_BIT_LSB, 1) >= 0) {
/*
* The unsigned source has a value which is too large for
* the unsigned destination. The destination should be
@@ -2454,54 +2510,54 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
}
/* Print errors */
- if (0==fails_this_test++)
+ if (0 == fails_this_test++)
H5_FAILED();
HDprintf(" elmt %u\n", (unsigned)j);
HDprintf(" src = ");
- for (k=0; k<src_size; k++)
- HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size, k, endian)]);
- HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
+ for (k = 0; k < src_size; k++)
+ HDprintf(" %02x", saved[j * src_size + ENDIAN(src_size, k, endian)]);
+ HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)dst_size - (ssize_t)src_size)), "");
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- HDprintf(" %29d\n", (int)*((signed char*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ HDprintf(" %29d\n", (int)*((signed char *)aligned));
break;
case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char *)aligned));
break;
case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- HDprintf(" %29hd\n", *((short*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ HDprintf(" %29hd\n", *((short *)aligned));
break;
case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- HDprintf(" %29hu\n", *((unsigned short*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ HDprintf(" %29hu\n", *((unsigned short *)aligned));
break;
case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- HDprintf(" %29d\n", *((int*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ HDprintf(" %29d\n", *((int *)aligned));
break;
case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- HDprintf(" %29u\n", *((unsigned*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ HDprintf(" %29u\n", *((unsigned *)aligned));
break;
case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- HDprintf(" %29ld\n", *((long*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ HDprintf(" %29ld\n", *((long *)aligned));
break;
case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- HDprintf(" %29lu\n", *((unsigned long*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ HDprintf(" %29lu\n", *((unsigned long *)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned));
break;
case FLT_FLOAT:
case FLT_DOUBLE:
@@ -2513,49 +2569,49 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
}
HDprintf(" dst = ");
- for (k=0; k<dst_size; k++)
- HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, endian)]);
- HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ for (k = 0; k < dst_size; k++)
+ HDprintf(" %02x", buf[j * dst_size + ENDIAN(dst_size, k, endian)]);
+ HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
- HDmemcpy(aligned, buf+j*sizeof(signed char), sizeof(signed char));
- HDprintf(" %29d\n", (int)*((signed char*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(signed char), sizeof(signed char));
+ HDprintf(" %29d\n", (int)*((signed char *)aligned));
break;
case INT_UCHAR:
- HDmemcpy(aligned, buf+j*sizeof(unsigned char), sizeof(unsigned char));
- HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(unsigned char), sizeof(unsigned char));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char *)aligned));
break;
case INT_SHORT:
- HDmemcpy(aligned, buf+j*sizeof(short), sizeof(short));
- HDprintf(" %29hd\n", *((short*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(short), sizeof(short));
+ HDprintf(" %29hd\n", *((short *)aligned));
break;
case INT_USHORT:
- HDmemcpy(aligned, buf+j*sizeof(unsigned short), sizeof(unsigned short));
- HDprintf(" %29hu\n", *((unsigned short*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(unsigned short), sizeof(unsigned short));
+ HDprintf(" %29hu\n", *((unsigned short *)aligned));
break;
case INT_INT:
- HDmemcpy(aligned, buf+j*sizeof(int), sizeof(int));
- HDprintf(" %29d\n", *((int*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(int), sizeof(int));
+ HDprintf(" %29d\n", *((int *)aligned));
break;
case INT_UINT:
- HDmemcpy(aligned, buf+j*sizeof(unsigned), sizeof(unsigned));
- HDprintf(" %29u\n", *((unsigned*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(unsigned), sizeof(unsigned));
+ HDprintf(" %29u\n", *((unsigned *)aligned));
break;
case INT_LONG:
- HDmemcpy(aligned, buf+j*sizeof(long), sizeof(long));
- HDprintf(" %29ld\n", *((long*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(long), sizeof(long));
+ HDprintf(" %29ld\n", *((long *)aligned));
break;
case INT_ULONG:
- HDmemcpy(aligned, buf+j*sizeof(unsigned long), sizeof(unsigned long));
- HDprintf(" %29lu\n", *((unsigned long*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(unsigned long), sizeof(unsigned long));
+ HDprintf(" %29lu\n", *((unsigned long *)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(long long), sizeof(long long));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(unsigned long long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(long long), sizeof(unsigned long long));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned));
break;
case FLT_FLOAT:
case FLT_DOUBLE:
@@ -2567,39 +2623,39 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
}
HDprintf(" ans = ");
- for (k=0; k<dst_size; k++)
+ for (k = 0; k < dst_size; k++)
HDprintf(" %02x", hw[ENDIAN(dst_size, k, endian)]);
- HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
- HDprintf(" %29d\n", (int)*((signed char*)((void *)hw)));
+ HDprintf(" %29d\n", (int)*((signed char *)((void *)hw)));
break;
case INT_UCHAR:
- HDprintf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw)));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char *)((void *)hw)));
break;
case INT_SHORT:
- HDprintf(" %29hd\n", *((short*)((void *)hw)));
+ HDprintf(" %29hd\n", *((short *)((void *)hw)));
break;
case INT_USHORT:
- HDprintf(" %29hu\n", *((unsigned short*)((void *)hw)));
+ HDprintf(" %29hu\n", *((unsigned short *)((void *)hw)));
break;
case INT_INT:
- HDprintf(" %29d\n", *((int*)((void *)hw)));
+ HDprintf(" %29d\n", *((int *)((void *)hw)));
break;
case INT_UINT:
- HDprintf(" %29u\n", *((unsigned*)((void *)hw)));
+ HDprintf(" %29u\n", *((unsigned *)((void *)hw)));
break;
case INT_LONG:
- HDprintf(" %29ld\n", *((long*)((void *)hw)));
+ HDprintf(" %29ld\n", *((long *)((void *)hw)));
break;
case INT_ULONG:
- HDprintf(" %29lu\n", *((unsigned long*)((void *)hw)));
+ HDprintf(" %29lu\n", *((unsigned long *)((void *)hw)));
break;
case INT_LLONG:
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw)));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)((void *)hw)));
break;
case INT_ULLONG:
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)((void *)hw)));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)((void *)hw)));
break;
case FLT_FLOAT:
case FLT_DOUBLE:
@@ -2610,7 +2666,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
break;
}
- if (++fails_all_tests>=max_fails) {
+ if (++fails_all_tests >= max_fails) {
HDputs(" maximum failures reached, aborting test...");
HDputs(" (dst is library's conversion output. ans is compiler's conversion output.)");
goto done;
@@ -2619,33 +2675,38 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
PASSED();
done:
- if (buf) aligned_free(buf);
- if (saved) aligned_free(saved);
- if (aligned) HDfree(aligned);
+ if (buf)
+ aligned_free(buf);
+ if (saved)
+ aligned_free(saved);
+ if (aligned)
+ HDfree(aligned);
HDfflush(stdout);
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return (int)fails_all_tests;
error:
- if (buf) aligned_free(buf);
- if (saved) aligned_free(saved);
- if (aligned) HDfree(aligned);
+ if (buf)
+ aligned_free(buf);
+ if (saved)
+ aligned_free(saved);
+ if (aligned)
+ HDfree(aligned);
HDfflush(stdout);
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return MAX((int)fails_all_tests, 1);
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_int_2
*
@@ -2666,9 +2727,9 @@ error:
static int
test_conv_int_2(void)
{
- int i, j;
- hid_t src_type, dst_type;
- char *buf;
+ int i, j;
+ hid_t src_type, dst_type;
+ char *buf;
HDprintf("%-70s", "Testing overlap calculations");
HDfflush(stdout);
@@ -2676,32 +2737,31 @@ test_conv_int_2(void)
buf = (char *)HDcalloc(TMP_BUF_DIM1, TMP_BUF_DIM2);
HDassert(buf);
- for(i = 1; i <= TMP_BUF_DIM1; i++) {
- for(j = 1; j <= TMP_BUF_DIM1; j++) {
+ for (i = 1; i <= TMP_BUF_DIM1; i++) {
+ for (j = 1; j <= TMP_BUF_DIM1; j++) {
- /* Source type */
- src_type = H5Tcopy(H5T_NATIVE_CHAR);
- H5Tset_size(src_type, (size_t)i);
+ /* Source type */
+ src_type = H5Tcopy(H5T_NATIVE_CHAR);
+ H5Tset_size(src_type, (size_t)i);
- /* Destination type */
- dst_type = H5Tcopy(H5T_NATIVE_CHAR);
- H5Tset_size(dst_type, (size_t)j);
+ /* Destination type */
+ dst_type = H5Tcopy(H5T_NATIVE_CHAR);
+ H5Tset_size(dst_type, (size_t)j);
- /*
- * Conversion. If overlap calculations aren't right then an
- * assertion will fail in H5T__conv_i_i()
- */
- H5Tconvert(src_type, dst_type, (size_t)TMP_BUF_DIM2, buf, NULL, H5P_DEFAULT);
- H5Tclose(src_type);
- H5Tclose(dst_type);
- }
+ /*
+ * Conversion. If overlap calculations aren't right then an
+ * assertion will fail in H5T__conv_i_i()
+ */
+ H5Tconvert(src_type, dst_type, (size_t)TMP_BUF_DIM2, buf, NULL, H5P_DEFAULT);
+ H5Tclose(src_type);
+ H5Tclose(dst_type);
+ }
}
PASSED();
HDfree(buf);
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: my_isnan
*
@@ -2719,25 +2779,28 @@ test_conv_int_2(void)
static int
my_isnan(dtype_t type, void *val)
{
- int retval = 0;
+ int retval = 0;
char s[256];
- if (FLT_FLOAT==type) {
- float x = 0.0;
- HDmemcpy(&x, val, sizeof(float));
- retval = (x!=x);
- } else if (FLT_DOUBLE==type) {
- double x = 0.0;
- HDmemcpy(&x, val, sizeof(double));
- retval = (x!=x);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if (FLT_LDOUBLE==type) {
- long double x = 0.0;
- HDmemcpy(&x, val, sizeof(long double));
- retval = (x!=x);
+ if (FLT_FLOAT == type) {
+ float x = 0.0;
+ HDmemcpy(&x, val, sizeof(float));
+ retval = (x != x);
+ }
+ else if (FLT_DOUBLE == type) {
+ double x = 0.0;
+ HDmemcpy(&x, val, sizeof(double));
+ retval = (x != x);
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (FLT_LDOUBLE == type) {
+ long double x = 0.0;
+ HDmemcpy(&x, val, sizeof(long double));
+ retval = (x != x);
#endif
- } else {
- return 0;
+ }
+ else {
+ return 0;
}
/*
@@ -2745,34 +2808,36 @@ my_isnan(dtype_t type, void *val)
* the result contains a NaN string.
*/
if (!retval) {
- if (FLT_FLOAT==type) {
- float x = 0.0;
+ if (FLT_FLOAT == type) {
+ float x = 0.0;
- HDmemcpy(&x, val, sizeof(float));
- HDsnprintf(s, sizeof(s), "%g", (double)x);
- } else if (FLT_DOUBLE==type) {
- double x = 0.0;
+ HDmemcpy(&x, val, sizeof(float));
+ HDsnprintf(s, sizeof(s), "%g", (double)x);
+ }
+ else if (FLT_DOUBLE == type) {
+ double x = 0.0;
- HDmemcpy(&x, val, sizeof(double));
- HDsnprintf(s, sizeof(s), "%g", x);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if (FLT_LDOUBLE==type) {
- long double x = 0.0;
+ HDmemcpy(&x, val, sizeof(double));
+ HDsnprintf(s, sizeof(s), "%g", x);
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (FLT_LDOUBLE == type) {
+ long double x = 0.0;
- HDmemcpy(&x, val, sizeof(long double));
- HDsnprintf(s, sizeof(s), "%Lg", x);
+ HDmemcpy(&x, val, sizeof(long double));
+ HDsnprintf(s, sizeof(s), "%Lg", x);
#endif
- } else {
- return 0;
- }
- if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan"))
- retval = 1;
+ }
+ else {
+ return 0;
+ }
+ if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan"))
+ retval = 1;
}
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: my_isinf
*
@@ -2788,20 +2853,19 @@ my_isnan(dtype_t type, void *val)
*-------------------------------------------------------------------------
*/
static int
-my_isinf(int endian, unsigned char *val, size_t size,
- size_t mpos, size_t msize, size_t epos, size_t esize)
+my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, size_t esize)
{
unsigned char *bits;
- int retval = 0;
- size_t i;
+ int retval = 0;
+ size_t i;
- bits = (unsigned char*)HDcalloc((size_t)1, size);
+ bits = (unsigned char *)HDcalloc((size_t)1, size);
- for (i=0; i<size; i++)
- bits[size-(i+1)] = *(val + ENDIAN(size, i, endian));
+ for (i = 0; i < size; i++)
+ bits[size - (i + 1)] = *(val + ENDIAN(size, i, endian));
- if(H5T__bit_find(bits, mpos, msize, H5T_BIT_LSB, 1) < 0 &&
- H5T__bit_find(bits, epos, esize, H5T_BIT_LSB, 0) < 0)
+ if (H5T__bit_find(bits, mpos, msize, H5T_BIT_LSB, 1) < 0 &&
+ H5T__bit_find(bits, epos, esize, H5T_BIT_LSB, 0) < 0)
retval = 1;
HDfree(bits);
@@ -2809,7 +2873,6 @@ my_isinf(int endian, unsigned char *val, size_t size,
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_flt_1
*
@@ -2834,45 +2897,45 @@ my_isinf(int endian, unsigned char *val, size_t size,
*-------------------------------------------------------------------------
*/
static int
-test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
+test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
{
- dtype_t src_type, dst_type; /*data types */
- size_t nelmts=0; /*num values per test */
- const size_t max_fails=8; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- const char *src_type_name = NULL; /*source type name */
- const char *dst_type_name = NULL; /*destination type name */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf = NULL; /*buffer for conversion */
- unsigned char *saved = NULL; /*original values */
- char str[256]; /*hello string */
- void *aligned=NULL; /*aligned buffer */
- float hw_f; /*hardware-converted */
- double hw_d; /*hardware-converted */
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- long double hw_ld; /*hardware-converted */
+ dtype_t src_type, dst_type; /*data types */
+ size_t nelmts = 0; /*num values per test */
+ const size_t max_fails = 8; /*max number of failures*/
+ size_t fails_all_tests = 0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ const char * src_type_name = NULL; /*source type name */
+ const char * dst_type_name = NULL; /*destination type name */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char *buf = NULL; /*buffer for conversion */
+ unsigned char *saved = NULL; /*original values */
+ char str[256]; /*hello string */
+ void * aligned = NULL; /*aligned buffer */
+ float hw_f; /*hardware-converted */
+ double hw_d; /*hardware-converted */
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ long double hw_ld; /*hardware-converted */
#endif
- unsigned char *hw=NULL; /*ptr to hardware-conv'd*/
- int underflow; /*underflow occurred */
- int overflow = 0; /*overflow occurred */
- int uflow=0; /*underflow debug counters*/
- size_t j, k; /*counters */
- int sendian; /* source type endianess */
- int dendian; /* Destination type endianess */
- size_t dst_ebias; /* Destination type's exponent bias */
- size_t src_epos; /* Source type's exponent position */
- size_t src_esize; /* Source type's exponent size */
- size_t dst_epos; /* Destination type's exponent position */
- size_t dst_esize; /* Destination type's exponent size */
- size_t dst_mpos; /* Destination type's mantissa position */
- size_t dst_msize; /* Destination type's mantissa size */
- size_t src_nbits; /* source length in bits */
- size_t dst_nbits; /* dst length in bits */
+ unsigned char *hw = NULL; /*ptr to hardware-conv'd*/
+ int underflow; /*underflow occurred */
+ int overflow = 0; /*overflow occurred */
+ int uflow = 0; /*underflow debug counters*/
+ size_t j, k; /*counters */
+ int sendian; /* source type endianess */
+ int dendian; /* Destination type endianess */
+ size_t dst_ebias; /* Destination type's exponent bias */
+ size_t src_epos; /* Source type's exponent position */
+ size_t src_esize; /* Source type's exponent size */
+ size_t dst_epos; /* Destination type's exponent position */
+ size_t dst_esize; /* Destination type's exponent size */
+ size_t dst_mpos; /* Destination type's mantissa position */
+ size_t dst_msize; /* Destination type's mantissa size */
+ size_t src_nbits; /* source length in bits */
+ size_t dst_nbits; /* dst length in bits */
#ifdef HANDLE_SIGFPE
- pid_t child_pid; /*process ID of child */
- int status; /*child exit status */
+ pid_t child_pid; /*process ID of child */
+ int status; /*child exit status */
/*
* Some systems generage SIGFPE during floating point overflow and we
@@ -2882,23 +2945,28 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
*/
HDfflush(stdout);
HDfflush(stderr);
- if ((child_pid=fork()) < 0) {
- HDperror("fork");
- return 1;
- } else if (child_pid>0) {
- while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/;
- if (WIFEXITED(status) && 255==WEXITSTATUS(status)) {
- return 0; /*child exit after catching SIGFPE*/
- } else if (WIFEXITED(status)) {
- return WEXITSTATUS(status);
- } else if (WIFSIGNALED(status)) {
- HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status));
- HDputs(str);
- return 1; /*child exit after catching non-SIGFPE signal */
- } else {
- HDputs(" Child didn't exit normally.");
+ if ((child_pid = fork()) < 0) {
+ HDperror("fork");
return 1;
}
+ else if (child_pid > 0) {
+ while (child_pid != waitpid(child_pid, &status, 0)) /*void*/
+ ;
+ if (WIFEXITED(status) && 255 == WEXITSTATUS(status)) {
+ return 0; /*child exit after catching SIGFPE*/
+ }
+ else if (WIFEXITED(status)) {
+ return WEXITSTATUS(status);
+ }
+ else if (WIFSIGNALED(status)) {
+ HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status));
+ HDputs(str);
+ return 1; /*child exit after catching non-SIGFPE signal */
+ }
+ else {
+ HDputs(" Child didn't exit normally.");
+ return 1;
+ }
}
#endif
@@ -2906,75 +2974,82 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
* The remainder of this function is executed only by the child if
* HANDLE_SIGFPE is defined.
*/
- HDsignal(SIGFPE,fpe_handler);
+ HDsignal(SIGFPE, fpe_handler);
/* What are the names of the source and destination types */
if (H5Tequal(src, H5T_NATIVE_FLOAT)) {
- src_type_name = "float";
- src_type = FLT_FLOAT;
- } else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
- src_type_name = "double";
- src_type = FLT_DOUBLE;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
- src_type_name = "long double";
- src_type = FLT_LDOUBLE;
+ src_type_name = "float";
+ src_type = FLT_FLOAT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
+ src_type_name = "double";
+ src_type = FLT_DOUBLE;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
+ src_type_name = "long double";
+ src_type = FLT_LDOUBLE;
#endif
- } else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
+ }
+ else {
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
}
if (H5Tequal(dst, H5T_NATIVE_FLOAT)) {
- dst_type_name = "float";
- dst_type = FLT_FLOAT;
- } else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
- dst_type_name = "double";
- dst_type = FLT_DOUBLE;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
- dst_type_name = "long double";
- dst_type = FLT_LDOUBLE;
+ dst_type_name = "float";
+ dst_type = FLT_FLOAT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
+ dst_type_name = "double";
+ dst_type = FLT_DOUBLE;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
+ dst_type_name = "long double";
+ dst_type = FLT_LDOUBLE;
#endif
- } else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
+ }
+ else {
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
}
/* Sanity checks */
- if(sizeof(float)==sizeof(double))
+ if (sizeof(float) == sizeof(double))
HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible.");
- if (OTHER==src_type || OTHER==dst_type) {
- if(!strcmp(name, "noop"))
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- else if(run_test==TEST_SPECIAL)
- HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
- name, src_type_name, dst_type_name);
- else if(run_test==TEST_NORMAL)
- HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
- else if(run_test==TEST_DENORM)
- HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
-
- HDprintf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
- } else {
- if(!strcmp(name, "noop"))
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- else if(run_test==TEST_SPECIAL)
- HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
- name, src_type_name, dst_type_name);
- else if(run_test==TEST_NORMAL)
- HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
- else if(run_test==TEST_DENORM)
- HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ if (OTHER == src_type || OTHER == dst_type) {
+ if (!strcmp(name, "noop"))
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name,
+ dst_type_name);
+ else if (run_test == TEST_SPECIAL)
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name,
+ dst_type_name);
+ else if (run_test == TEST_NORMAL)
+ HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, src_type_name,
+ dst_type_name);
+ else if (run_test == TEST_DENORM)
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name,
+ dst_type_name);
+
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
+ }
+ else {
+ if (!strcmp(name, "noop"))
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name,
+ dst_type_name);
+ else if (run_test == TEST_SPECIAL)
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name,
+ dst_type_name);
+ else if (run_test == TEST_NORMAL)
+ HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, src_type_name,
+ dst_type_name);
+ else if (run_test == TEST_DENORM)
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name,
+ dst_type_name);
HDprintf("%-70s", str);
HDfflush(stdout);
@@ -2982,13 +3057,13 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
}
/* Get "interesting" values */
- src_size = H5Tget_size(src);
- dst_size = H5Tget_size(dst);
+ src_size = H5Tget_size(src);
+ dst_size = H5Tget_size(dst);
src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
- dst_ebias=H5Tget_ebias(dst);
- H5Tget_fields(src,NULL,&src_epos,&src_esize,NULL,NULL);
- H5Tget_fields(dst,NULL,&dst_epos,&dst_esize,&dst_mpos,&dst_msize);
+ dst_ebias = H5Tget_ebias(dst);
+ H5Tget_fields(src, NULL, &src_epos, &src_esize, NULL, NULL);
+ H5Tget_fields(dst, NULL, &dst_epos, &dst_esize, &dst_mpos, &dst_msize);
sendian = H5Tget_order(src);
dendian = H5Tget_order(dst);
@@ -3004,51 +3079,57 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
switch (run_test) {
case TEST_NOOP:
case TEST_NORMAL:
- if(src_type == FLT_FLOAT) {
- INIT_FP_NORM(float, FLT_MAX, FLT_MIN, FLT_MAX_10_EXP, FLT_MIN_10_EXP,
- src_size, dst_size, buf, saved, nelmts);
- } else if(src_type == FLT_DOUBLE) {
- INIT_FP_NORM(double, DBL_MAX, DBL_MIN, DBL_MAX_10_EXP, DBL_MIN_10_EXP,
- src_size, dst_size, buf, saved, nelmts);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if(src_type == FLT_LDOUBLE) {
- INIT_FP_NORM(long double, LDBL_MAX, LDBL_MIN, LDBL_MAX_10_EXP, LDBL_MIN_10_EXP,
- src_size, dst_size, buf, saved, nelmts);
+ if (src_type == FLT_FLOAT) {
+ INIT_FP_NORM(float, FLT_MAX, FLT_MIN, FLT_MAX_10_EXP, FLT_MIN_10_EXP, src_size, dst_size, buf,
+ saved, nelmts);
+ }
+ else if (src_type == FLT_DOUBLE) {
+ INIT_FP_NORM(double, DBL_MAX, DBL_MIN, DBL_MAX_10_EXP, DBL_MIN_10_EXP, src_size, dst_size,
+ buf, saved, nelmts);
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (src_type == FLT_LDOUBLE) {
+ INIT_FP_NORM(long double, LDBL_MAX, LDBL_MIN, LDBL_MAX_10_EXP, LDBL_MIN_10_EXP, src_size,
+ dst_size, buf, saved, nelmts);
#endif
- } else
+ }
+ else
goto error;
break;
case TEST_DENORM:
- if(src_type == FLT_FLOAT) {
- INIT_FP_DENORM(float, FLT_MANT_DIG, src_size, src_nbits, sendian, dst_size,
- buf, saved, nelmts);
- } else if(src_type == FLT_DOUBLE) {
- INIT_FP_DENORM(double, DBL_MANT_DIG, src_size, src_nbits, sendian, dst_size,
- buf, saved, nelmts);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if(src_type == FLT_LDOUBLE) {
- INIT_FP_DENORM(long double, LDBL_MANT_DIG, src_size, src_nbits, sendian, dst_size,
- buf, saved, nelmts);
+ if (src_type == FLT_FLOAT) {
+ INIT_FP_DENORM(float, FLT_MANT_DIG, src_size, src_nbits, sendian, dst_size, buf, saved,
+ nelmts);
+ }
+ else if (src_type == FLT_DOUBLE) {
+ INIT_FP_DENORM(double, DBL_MANT_DIG, src_size, src_nbits, sendian, dst_size, buf, saved,
+ nelmts);
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (src_type == FLT_LDOUBLE) {
+ INIT_FP_DENORM(long double, LDBL_MANT_DIG, src_size, src_nbits, sendian, dst_size, buf, saved,
+ nelmts);
#endif
- } else
+ }
+ else
goto error;
break;
case TEST_SPECIAL:
- if(src_type == FLT_FLOAT) {
- INIT_FP_SPECIAL(src_size, src_nbits, sendian, FLT_MANT_DIG, dst_size,
- buf, saved, nelmts);
- } else if(src_type == FLT_DOUBLE) {
- INIT_FP_SPECIAL(src_size, src_nbits, sendian, DBL_MANT_DIG, dst_size,
- buf, saved, nelmts);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if(src_type == FLT_LDOUBLE) {
- INIT_FP_SPECIAL(src_size, src_nbits, sendian, LDBL_MANT_DIG, dst_size,
- buf, saved, nelmts);
+ if (src_type == FLT_FLOAT) {
+ INIT_FP_SPECIAL(src_size, src_nbits, sendian, FLT_MANT_DIG, dst_size, buf, saved, nelmts);
+ }
+ else if (src_type == FLT_DOUBLE) {
+ INIT_FP_SPECIAL(src_size, src_nbits, sendian, DBL_MANT_DIG, dst_size, buf, saved, nelmts);
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (src_type == FLT_LDOUBLE) {
+ INIT_FP_SPECIAL(src_size, src_nbits, sendian, LDBL_MANT_DIG, dst_size, buf, saved, nelmts);
#endif
- } else
+ }
+ else
goto error;
break;
@@ -3061,66 +3142,74 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
goto error;
/* Check the software results against the hardware */
- for (j=0; j<nelmts; j++) {
+ for (j = 0; j < nelmts; j++) {
underflow = 0;
- hw_f = 911.0f;
- hw_d = 911.0f;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ hw_f = 911.0f;
+ hw_d = 911.0f;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
hw_ld = 911.0f;
#endif
/* The hardware conversion */
/* Check for underflow when src is a "larger" float than dst.*/
- if (FLT_FLOAT==src_type) {
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- if (FLT_FLOAT==dst_type) {
- hw_f = *((float*)aligned);
- hw = (unsigned char*)&hw_f;
- } else if (FLT_DOUBLE==dst_type) {
- hw_d = *((float*)aligned);
- hw = (unsigned char*)&hw_d;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
- hw_ld = *((float*)aligned);
- hw = (unsigned char*)&hw_ld;
+ if (FLT_FLOAT == src_type) {
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ if (FLT_FLOAT == dst_type) {
+ hw_f = *((float *)aligned);
+ hw = (unsigned char *)&hw_f;
+ }
+ else if (FLT_DOUBLE == dst_type) {
+ hw_d = *((float *)aligned);
+ hw = (unsigned char *)&hw_d;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ }
+ else {
+ hw_ld = *((float *)aligned);
+ hw = (unsigned char *)&hw_ld;
#endif
}
- } else if (FLT_DOUBLE==src_type) {
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- if (FLT_FLOAT==dst_type) {
- hw_f = (float)(*((double*)aligned));
- hw = (unsigned char*)&hw_f;
- underflow = HDfabs(*((double*)aligned)) < (double)FLT_MIN;
- overflow = HDfabs(*((double*)aligned)) > (double)FLT_MAX;
- } else if (FLT_DOUBLE==dst_type) {
- hw_d = *((double*)aligned);
- hw = (unsigned char*)&hw_d;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
- hw_ld = *((double*)aligned);
- hw = (unsigned char*)&hw_ld;
+ }
+ else if (FLT_DOUBLE == src_type) {
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ if (FLT_FLOAT == dst_type) {
+ hw_f = (float)(*((double *)aligned));
+ hw = (unsigned char *)&hw_f;
+ underflow = HDfabs(*((double *)aligned)) < (double)FLT_MIN;
+ overflow = HDfabs(*((double *)aligned)) > (double)FLT_MAX;
+ }
+ else if (FLT_DOUBLE == dst_type) {
+ hw_d = *((double *)aligned);
+ hw = (unsigned char *)&hw_d;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ }
+ else {
+ hw_ld = *((double *)aligned);
+ hw = (unsigned char *)&hw_ld;
#endif
}
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- if (FLT_FLOAT==dst_type) {
- hw_f = (float)*((long double*)aligned);
- hw = (unsigned char*)&hw_f;
- underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN;
- overflow = HDfabsl(*((long double*)aligned)) > FLT_MAX;
- } else if (FLT_DOUBLE==dst_type) {
- hw_d = (double)*((long double*)aligned);
- hw = (unsigned char*)&hw_d;
- underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN;
- overflow = HDfabsl(*((long double*)aligned)) > DBL_MAX;
- } else {
- hw_ld = *((long double*)aligned);
- hw = (unsigned char*)&hw_ld;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ }
+ else {
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ if (FLT_FLOAT == dst_type) {
+ hw_f = (float)*((long double *)aligned);
+ hw = (unsigned char *)&hw_f;
+ underflow = HDfabsl(*((long double *)aligned)) < FLT_MIN;
+ overflow = HDfabsl(*((long double *)aligned)) > FLT_MAX;
+ }
+ else if (FLT_DOUBLE == dst_type) {
+ hw_d = (double)*((long double *)aligned);
+ hw = (unsigned char *)&hw_d;
+ underflow = HDfabsl(*((long double *)aligned)) < DBL_MIN;
+ overflow = HDfabsl(*((long double *)aligned)) > DBL_MAX;
+ }
+ else {
+ hw_ld = *((long double *)aligned);
+ hw = (unsigned char *)&hw_ld;
}
#endif
}
- if (underflow){
+ if (underflow) {
uflow++;
}
@@ -3130,43 +3219,40 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
* last few unused bytes may have garbage in them. Clean them out with
* 0s before compare the values.
*/
-#if H5_SIZEOF_LONG_DOUBLE !=0
- if(sendian == H5T_ORDER_LE && dst_type == FLT_LDOUBLE) {
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ if (sendian == H5T_ORDER_LE && dst_type == FLT_LDOUBLE) {
size_t q;
- for(q = dst_nbits / 8; q < dst_size; q++) {
+ for (q = dst_nbits / 8; q < dst_size; q++) {
buf[j * dst_size + q] = 0x00;
- hw[q] = 0x00;
+ hw[q] = 0x00;
}
}
#endif
/* Are the two results the same? */
- for (k=(dst_size-(dst_nbits/8)); k<dst_size; k++)
- if (buf[j*dst_size+k]!=hw[k])
+ for (k = (dst_size - (dst_nbits / 8)); k < dst_size; k++)
+ if (buf[j * dst_size + k] != hw[k])
break;
- if (k==dst_size)
+ if (k == dst_size)
continue; /*no error*/
-
/*
* Assume same if both results are NaN. There are many NaN bit
* patterns and the software doesn't attemt to emulate the
* hardware in this regard. Instead, software uses a single bit
* pattern for NaN by setting the significand to all ones.
*/
- if (FLT_FLOAT==dst_type &&
- my_isnan(dst_type, buf+j*sizeof(float)) &&
- my_isnan(dst_type, hw)) {
+ if (FLT_FLOAT == dst_type && my_isnan(dst_type, buf + j * sizeof(float)) && my_isnan(dst_type, hw)) {
continue;
- } else if (FLT_DOUBLE==dst_type &&
- my_isnan(dst_type, buf+j*sizeof(double)) &&
- my_isnan(dst_type, hw)) {
+ }
+ else if (FLT_DOUBLE == dst_type && my_isnan(dst_type, buf + j * sizeof(double)) &&
+ my_isnan(dst_type, hw)) {
continue;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if (FLT_LDOUBLE==dst_type &&
- my_isnan(dst_type, buf+j*sizeof(long double)) &&
- my_isnan(dst_type, hw)) {
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (FLT_LDOUBLE == dst_type && my_isnan(dst_type, buf + j * sizeof(long double)) &&
+ my_isnan(dst_type, hw)) {
continue;
#endif
}
@@ -3193,132 +3279,138 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
* the SGI compiler assigns the dst's maximal value.
*/
{
- double check_mant[2];
- int check_expo[2];
+ double check_mant[2];
+ int check_expo[2];
- if (FLT_FLOAT==dst_type) {
+ if (FLT_FLOAT == dst_type) {
float x = 0.0;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
- if (underflow &&
- HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
- continue; /* all underflowed, no error */
- if (overflow && my_isinf(dendian, buf+j*sizeof(float),
- dst_size, dst_mpos, dst_msize, dst_epos, dst_esize))
- continue; /* all overflowed, no error */
- check_mant[0] = HDfrexpf(x, check_expo+0);
- check_mant[1] = HDfrexpf(hw_f, check_expo+1);
- } else if (FLT_DOUBLE==dst_type) {
+ HDmemcpy(&x, &buf[j * dst_size], sizeof(float));
+ if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
+ continue; /* all underflowed, no error */
+ if (overflow && my_isinf(dendian, buf + j * sizeof(float), dst_size, dst_mpos, dst_msize,
+ dst_epos, dst_esize))
+ continue; /* all overflowed, no error */
+ check_mant[0] = HDfrexpf(x, check_expo + 0);
+ check_mant[1] = HDfrexpf(hw_f, check_expo + 1);
+ }
+ else if (FLT_DOUBLE == dst_type) {
double x = 0.0;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
- if (underflow &&
- HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
- continue; /* all underflowed, no error */
- if (overflow && my_isinf(dendian, buf+j*sizeof(double),
- dst_size, dst_mpos, dst_msize, dst_epos, dst_esize))
- continue; /* all overflowed, no error */
- check_mant[0] = HDfrexp(x, check_expo+0);
- check_mant[1] = HDfrexp(hw_d, check_expo+1);
-#if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE)
- } else {
+ HDmemcpy(&x, &buf[j * dst_size], sizeof(double));
+ if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
+ continue; /* all underflowed, no error */
+ if (overflow && my_isinf(dendian, buf + j * sizeof(double), dst_size, dst_mpos, dst_msize,
+ dst_epos, dst_esize))
+ continue; /* all overflowed, no error */
+ check_mant[0] = HDfrexp(x, check_expo + 0);
+ check_mant[1] = HDfrexp(hw_d, check_expo + 1);
+#if H5_SIZEOF_LONG_DOUBLE != 0 && (H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE)
+ }
+ else {
long double x = 0.0;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
+ HDmemcpy(&x, &buf[j * dst_size], sizeof(long double));
/* dst is largest float, no need to check underflow. */
- check_mant[0] = (double)HDfrexpl(x, check_expo+0);
- check_mant[1] = (double)HDfrexpl(hw_ld, check_expo+1);
+ check_mant[0] = (double)HDfrexpl(x, check_expo + 0);
+ check_mant[1] = (double)HDfrexpl(hw_ld, check_expo + 1);
#endif
}
/* Special check for denormalized values */
- if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) {
+ if (check_expo[0] < (-(int)dst_ebias) || check_expo[1] < (-(int)dst_ebias)) {
int expo_diff = check_expo[0] - check_expo[1];
- int valid_bits = (int)((dst_ebias + dst_msize) + (size_t)MIN(check_expo[0], check_expo[1])) - 1;
+ int valid_bits =
+ (int)((dst_ebias + dst_msize) + (size_t)MIN(check_expo[0], check_expo[1])) - 1;
double epsilon = 1.0F;
/* Re-scale the mantissas based on any exponent difference */
- if(expo_diff!=0)
- check_mant[0] = HDldexp(check_mant[0],expo_diff);
+ if (expo_diff != 0)
+ check_mant[0] = HDldexp(check_mant[0], expo_diff);
/* Compute the proper epsilon */
- epsilon=HDldexp(epsilon,-valid_bits);
+ epsilon = HDldexp(epsilon, -valid_bits);
/* Check for "close enough" fit with scaled epsilon value */
- if (HDfabs(check_mant[0]-check_mant[1])<=epsilon)
+ if (HDfabs(check_mant[0] - check_mant[1]) <= epsilon)
continue;
} /* end if */
else {
- if(check_expo[0] == check_expo[1] &&
- HDfabs(check_mant[0] - check_mant[1]) < (double)FP_EPSILON)
+ if (check_expo[0] == check_expo[1] &&
+ HDfabs(check_mant[0] - check_mant[1]) < (double)FP_EPSILON)
continue;
} /* end else */
}
- if (0==fails_this_test++) {
- if(run_test==TEST_NOOP || run_test==TEST_NORMAL) {
+ if (0 == fails_this_test++) {
+ if (run_test == TEST_NOOP || run_test == TEST_NORMAL) {
H5_FAILED();
- } else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL) {
+ }
+ else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL) {
H5_WARNING();
}
}
HDprintf(" elmt %u\n", (unsigned)j);
HDprintf(" src =");
- for (k=0; k<src_size; k++)
- HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]);
- HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
- if (FLT_FLOAT==src_type) {
+ for (k = 0; k < src_size; k++)
+ HDprintf(" %02x", saved[j * src_size + ENDIAN(src_size, k, sendian)]);
+ HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)dst_size - (ssize_t)src_size)), "");
+ if (FLT_FLOAT == src_type) {
float x = 0.0;
- HDmemcpy(&x, &saved[j*src_size], sizeof(float));
+ HDmemcpy(&x, &saved[j * src_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
- } else if (FLT_DOUBLE==src_type) {
+ }
+ else if (FLT_DOUBLE == src_type) {
double x = 0.0;
- HDmemcpy(&x, &saved[j*src_size], sizeof(double));
+ HDmemcpy(&x, &saved[j * src_size], sizeof(double));
HDprintf(" %29.20e\n", x);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ }
+ else {
long double x = 0.0;
- HDmemcpy(&x, &saved[j*src_size], sizeof(long double));
- HDfprintf(stdout," %29.20Le\n", x);
+ HDmemcpy(&x, &saved[j * src_size], sizeof(long double));
+ HDfprintf(stdout, " %29.20Le\n", x);
#endif
}
HDprintf(" dst =");
- for (k=0; k<dst_size; k++)
- HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]);
- HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
- if (FLT_FLOAT==dst_type) {
+ for (k = 0; k < dst_size; k++)
+ HDprintf(" %02x", buf[j * dst_size + ENDIAN(dst_size, k, dendian)]);
+ HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), "");
+ if (FLT_FLOAT == dst_type) {
float x = 0.0;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
+ HDmemcpy(&x, &buf[j * dst_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
- } else if (FLT_DOUBLE==dst_type) {
+ }
+ else if (FLT_DOUBLE == dst_type) {
double x = 0.0;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
+ HDmemcpy(&x, &buf[j * dst_size], sizeof(double));
HDprintf(" %29.20e\n", x);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- } else {
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ }
+ else {
long double x = 0.0;
- HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
- HDfprintf(stdout," %29.20Le\n", x);
+ HDmemcpy(&x, &buf[j * dst_size], sizeof(long double));
+ HDfprintf(stdout, " %29.20Le\n", x);
#endif
}
HDprintf(" ans =");
- for (k=0; k<dst_size; k++)
- HDprintf(" %02x", hw[ENDIAN(dst_size,k,dendian)]);
- HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
- if (FLT_FLOAT==dst_type)
+ for (k = 0; k < dst_size; k++)
+ HDprintf(" %02x", hw[ENDIAN(dst_size, k, dendian)]);
+ HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), "");
+ if (FLT_FLOAT == dst_type)
HDprintf(" %29.20e\n", (double)hw_f);
- else if (FLT_DOUBLE==dst_type)
+ else if (FLT_DOUBLE == dst_type)
HDprintf(" %29.20e\n", hw_d);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
else
- HDfprintf(stdout," %29.20Le\n", hw_ld);
+ HDfprintf(stdout, " %29.20Le\n", hw_ld);
#endif
/* If the source is normalized values, print out error message; if it is
* denormalized or special values, print out warning message.*/
- if (++fails_all_tests>=max_fails) {
- if(run_test==TEST_NORMAL)
+ if (++fails_all_tests >= max_fails) {
+ if (run_test == TEST_NORMAL)
HDputs(" maximum failures reached, aborting test...");
- else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
+ else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL)
HDputs(" maximum warnings reached, aborting test...");
HDputs(" (dst is library's conversion output. ans is compiler's conversion output.)");
@@ -3326,18 +3418,21 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
}
}
- if(!fails_all_tests)
+ if (!fails_all_tests)
PASSED();
done:
- if (buf) aligned_free(buf);
- if (saved) aligned_free(saved);
- if (aligned) HDfree(aligned);
+ if (buf)
+ aligned_free(buf);
+ if (saved)
+ aligned_free(saved);
+ if (aligned)
+ HDfree(aligned);
HDfflush(stdout);
#ifdef HANDLE_SIGFPE
- if(run_test==TEST_NOOP || run_test==TEST_NORMAL)
+ if (run_test == TEST_NOOP || run_test == TEST_NORMAL)
HDexit(MIN((int)fails_all_tests, 254));
- else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
+ else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL)
HDexit(EXIT_SUCCESS);
HDassert(0 && "Should not reach this point!");
return 1;
@@ -3349,21 +3444,24 @@ done:
/* If the source is normalized values, treat the failures as error;
* if it is denormalized or special values, treat the failure as warning.*/
- if(run_test==TEST_NOOP || run_test==TEST_NORMAL)
+ if (run_test == TEST_NOOP || run_test == TEST_NORMAL)
return (int)fails_all_tests;
- else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
+ else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL)
return 0;
#endif
error:
- if (buf) aligned_free(buf);
- if (saved) aligned_free(saved);
- if (aligned) HDfree(aligned);
+ if (buf)
+ aligned_free(buf);
+ if (saved)
+ aligned_free(saved);
+ if (aligned)
+ HDfree(aligned);
HDfflush(stdout);
#ifdef HANDLE_SIGFPE
- if(run_test==TEST_NOOP || run_test==TEST_NORMAL)
+ if (run_test == TEST_NOOP || run_test == TEST_NORMAL)
HDexit(MIN(MAX((int)fails_all_tests, 1), 254));
- else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
+ else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL)
HDexit(EXIT_FAILURE);
HDassert(0 && "Should not reach this point!");
return 1;
@@ -3373,14 +3471,13 @@ error:
reset_hdf5();
- if(run_test==TEST_NOOP || run_test==TEST_NORMAL)
+ if (run_test == TEST_NOOP || run_test == TEST_NORMAL)
return MAX((int)fails_all_tests, 1);
- else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
+ else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL)
return 1;
#endif
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_int_fp
*
@@ -3407,216 +3504,236 @@ error:
static int
test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
{
- hid_t dxpl_id; /*dataset transfer property list*/
- int fill_value=9; /*fill value for conversion exception*/
- H5T_conv_except_func_t op; /*returned callback function for conversion exception*/
- void *user_data; /*returned pointer to user data passed in to the callback*/
- hbool_t except_set = FALSE; /*whether user's exception handling is set*/
- size_t nelmts=0; /*num values per test */
- const size_t max_fails=40; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- char str[256]; /*hello string */
- dtype_t src_type; /*data types */
- dtype_t dst_type; /*data types */
- const char *src_type_name=NULL; /*source type name */
- const char *dst_type_name=NULL; /*destination type name */
- int sendian; /*source endianess */
- int dendian; /*destination endianess */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf=NULL; /*buffer for conversion */
- unsigned char *saved=NULL; /*original values */
- size_t j, k; /*counters */
- unsigned char *hw=NULL; /*hardware conv result */
- unsigned char src_bits[32]; /*src value in LE order */
- unsigned char dst_bits[32]; /*dest value in LE order*/
- size_t src_nbits; /*source length in bits */
- size_t dst_nbits; /*dst length in bits */
- void *aligned=NULL; /*aligned temp buffer */
- float hw_float=0;
- double hw_double=0;
- long double hw_ldouble=0;
- signed char hw_schar=0;
- unsigned char hw_uchar=0;
- short hw_short=0;
- unsigned short hw_ushort=0;
- int hw_int=0;
- unsigned hw_uint=0;
- long hw_long=0;
- unsigned long hw_ulong=0;
- long long hw_llong=0;
- unsigned long long hw_ullong=0;
+ hid_t dxpl_id; /*dataset transfer property list*/
+ int fill_value = 9; /*fill value for conversion exception*/
+ H5T_conv_except_func_t op; /*returned callback function for conversion exception*/
+ void * user_data; /*returned pointer to user data passed in to the callback*/
+ hbool_t except_set = FALSE; /*whether user's exception handling is set*/
+ size_t nelmts = 0; /*num values per test */
+ const size_t max_fails = 40; /*max number of failures*/
+ size_t fails_all_tests = 0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ char str[256]; /*hello string */
+ dtype_t src_type; /*data types */
+ dtype_t dst_type; /*data types */
+ const char * src_type_name = NULL; /*source type name */
+ const char * dst_type_name = NULL; /*destination type name */
+ int sendian; /*source endianess */
+ int dendian; /*destination endianess */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char * buf = NULL; /*buffer for conversion */
+ unsigned char * saved = NULL; /*original values */
+ size_t j, k; /*counters */
+ unsigned char * hw = NULL; /*hardware conv result */
+ unsigned char src_bits[32]; /*src value in LE order */
+ unsigned char dst_bits[32]; /*dest value in LE order*/
+ size_t src_nbits; /*source length in bits */
+ size_t dst_nbits; /*dst length in bits */
+ void * aligned = NULL; /*aligned temp buffer */
+ float hw_float = 0;
+ double hw_double = 0;
+ long double hw_ldouble = 0;
+ signed char hw_schar = 0;
+ unsigned char hw_uchar = 0;
+ short hw_short = 0;
+ unsigned short hw_ushort = 0;
+ int hw_int = 0;
+ unsigned hw_uint = 0;
+ long hw_long = 0;
+ unsigned long hw_ulong = 0;
+ long long hw_llong = 0;
+ unsigned long long hw_ullong = 0;
/* What is the name of the source type */
if (H5Tequal(src, H5T_NATIVE_SCHAR)) {
- src_type_name = "signed char";
- src_type = INT_SCHAR;
- } else if (H5Tequal(src, H5T_NATIVE_UCHAR)) {
- src_type_name = "unsigned char";
- src_type = INT_UCHAR;
- } else if (H5Tequal(src, H5T_NATIVE_SHORT)) {
- src_type_name = "short";
- src_type = INT_SHORT;
- } else if (H5Tequal(src, H5T_NATIVE_USHORT)) {
- src_type_name = "unsigned short";
- src_type = INT_USHORT;
- } else if (H5Tequal(src, H5T_NATIVE_INT)) {
- src_type_name = "int";
- src_type = INT_INT;
- } else if (H5Tequal(src, H5T_NATIVE_UINT)) {
- src_type_name = "unsigned int";
- src_type = INT_UINT;
- } else if (H5Tequal(src, H5T_NATIVE_LONG)) {
- src_type_name = "long";
- src_type = INT_LONG;
- } else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
- src_type_name = "unsigned long";
- src_type = INT_ULONG;
- } else if (H5Tequal(src, H5T_NATIVE_LLONG)) {
- src_type_name = "long long";
- src_type = INT_LLONG;
- } else if (H5Tequal(src, H5T_NATIVE_ULLONG)) {
- src_type_name = "unsigned long long";
- src_type = INT_ULLONG;
- } else if (H5Tequal(src, H5T_NATIVE_FLOAT)) {
- src_type_name = "float";
- src_type = FLT_FLOAT;
- } else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
- src_type_name = "double";
- src_type = FLT_DOUBLE;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
- src_type_name = "long double";
- src_type = FLT_LDOUBLE;
+ src_type_name = "signed char";
+ src_type = INT_SCHAR;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_UCHAR)) {
+ src_type_name = "unsigned char";
+ src_type = INT_UCHAR;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_SHORT)) {
+ src_type_name = "short";
+ src_type = INT_SHORT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_USHORT)) {
+ src_type_name = "unsigned short";
+ src_type = INT_USHORT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_INT)) {
+ src_type_name = "int";
+ src_type = INT_INT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_UINT)) {
+ src_type_name = "unsigned int";
+ src_type = INT_UINT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_LONG)) {
+ src_type_name = "long";
+ src_type = INT_LONG;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
+ src_type_name = "unsigned long";
+ src_type = INT_ULONG;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_LLONG)) {
+ src_type_name = "long long";
+ src_type = INT_LLONG;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_ULLONG)) {
+ src_type_name = "unsigned long long";
+ src_type = INT_ULLONG;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_FLOAT)) {
+ src_type_name = "float";
+ src_type = FLT_FLOAT;
+ }
+ else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
+ src_type_name = "double";
+ src_type = FLT_DOUBLE;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
+ src_type_name = "long double";
+ src_type = FLT_LDOUBLE;
#endif
- } else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
+ }
+ else {
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
}
/* What is the name of the destination type */
if (H5Tequal(dst, H5T_NATIVE_SCHAR)) {
- dst_type_name = "signed char";
- dst_type = INT_SCHAR;
- } else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) {
- dst_type_name = "unsigned char";
- dst_type = INT_UCHAR;
- } else if (H5Tequal(dst, H5T_NATIVE_SHORT)) {
- dst_type_name = "short";
- dst_type = INT_SHORT;
- } else if (H5Tequal(dst, H5T_NATIVE_USHORT)) {
- dst_type_name = "unsigned short";
- dst_type = INT_USHORT;
- } else if (H5Tequal(dst, H5T_NATIVE_INT)) {
- dst_type_name = "int";
- dst_type = INT_INT;
- } else if (H5Tequal(dst, H5T_NATIVE_UINT)) {
- dst_type_name = "unsigned int";
- dst_type = INT_UINT;
- } else if (H5Tequal(dst, H5T_NATIVE_LONG)) {
- dst_type_name = "long";
- dst_type = INT_LONG;
- } else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
- dst_type_name = "unsigned long";
- dst_type = INT_ULONG;
- } else if (H5Tequal(dst, H5T_NATIVE_LLONG)) {
- dst_type_name = "long long";
- dst_type = INT_LLONG;
- } else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) {
- dst_type_name = "unsigned long long";
- dst_type = INT_ULLONG;
- } else if (H5Tequal(dst, H5T_NATIVE_FLOAT)) {
- dst_type_name = "float";
- dst_type = FLT_FLOAT;
- } else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
- dst_type_name = "double";
- dst_type = FLT_DOUBLE;
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
- dst_type_name = "long double";
- dst_type = FLT_LDOUBLE;
+ dst_type_name = "signed char";
+ dst_type = INT_SCHAR;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) {
+ dst_type_name = "unsigned char";
+ dst_type = INT_UCHAR;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_SHORT)) {
+ dst_type_name = "short";
+ dst_type = INT_SHORT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_USHORT)) {
+ dst_type_name = "unsigned short";
+ dst_type = INT_USHORT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_INT)) {
+ dst_type_name = "int";
+ dst_type = INT_INT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_UINT)) {
+ dst_type_name = "unsigned int";
+ dst_type = INT_UINT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_LONG)) {
+ dst_type_name = "long";
+ dst_type = INT_LONG;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
+ dst_type_name = "unsigned long";
+ dst_type = INT_ULONG;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_LLONG)) {
+ dst_type_name = "long long";
+ dst_type = INT_LLONG;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) {
+ dst_type_name = "unsigned long long";
+ dst_type = INT_ULLONG;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_FLOAT)) {
+ dst_type_name = "float";
+ dst_type = FLT_FLOAT;
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
+ dst_type_name = "double";
+ dst_type = FLT_DOUBLE;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
+ dst_type_name = "long double";
+ dst_type = FLT_LDOUBLE;
#endif
- } else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
+ }
+ else {
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
}
/* Sanity checks */
- if (OTHER==src_type || OTHER==dst_type) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- HDprintf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
- }
-
- if ((INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type ||
- INT_USHORT==src_type || INT_INT==src_type || INT_UINT==src_type ||
- INT_LONG==src_type || INT_ULONG==src_type || INT_LLONG==src_type ||
- INT_ULLONG==src_type) &&
- (FLT_FLOAT!=dst_type && FLT_DOUBLE!=dst_type
-#if H5_SIZEOF_LONG_DOUBLE !=0
- && FLT_LDOUBLE!=dst_type
+ if (OTHER == src_type || OTHER == dst_type) {
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
+ }
+
+ if ((INT_SCHAR == src_type || INT_UCHAR == src_type || INT_SHORT == src_type || INT_USHORT == src_type ||
+ INT_INT == src_type || INT_UINT == src_type || INT_LONG == src_type || INT_ULONG == src_type ||
+ INT_LLONG == src_type || INT_ULLONG == src_type) &&
+ (FLT_FLOAT != dst_type && FLT_DOUBLE != dst_type
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ && FLT_LDOUBLE != dst_type
#endif
- )) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- HDprintf("%-70s", str);
- H5_FAILED();
- HDputs(" 1. Not an integer-float conversion.");
- goto error;
- }
-
- if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type
-#if H5_SIZEOF_LONG_DOUBLE !=0
- || FLT_LDOUBLE==src_type
+ )) {
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" 1. Not an integer-float conversion.");
+ goto error;
+ }
+
+ if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ || FLT_LDOUBLE == src_type
#endif
- )
- && (INT_SCHAR!=dst_type && INT_UCHAR!=dst_type && INT_SHORT!=dst_type
- && INT_USHORT!=dst_type && INT_INT!=dst_type && INT_UINT!=dst_type
- && INT_LONG!=dst_type && INT_ULONG!=dst_type && INT_LLONG!=dst_type
- && INT_ULLONG!=dst_type)) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- HDprintf("%-70s", str);
- H5_FAILED();
- HDputs(" 2. Not a float-integer conversion.");
- goto error;
- }
-
- if (INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type ||
- INT_USHORT==src_type || INT_INT==src_type || INT_UINT==src_type ||
- INT_LONG==src_type || INT_ULONG==src_type || INT_LLONG==src_type ||
- INT_ULLONG==src_type) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ ) &&
+ (INT_SCHAR != dst_type && INT_UCHAR != dst_type && INT_SHORT != dst_type && INT_USHORT != dst_type &&
+ INT_INT != dst_type && INT_UINT != dst_type && INT_LONG != dst_type && INT_ULONG != dst_type &&
+ INT_LLONG != dst_type && INT_ULLONG != dst_type)) {
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" 2. Not a float-integer conversion.");
+ goto error;
+ }
+
+ if (INT_SCHAR == src_type || INT_UCHAR == src_type || INT_SHORT == src_type || INT_USHORT == src_type ||
+ INT_INT == src_type || INT_UINT == src_type || INT_LONG == src_type || INT_ULONG == src_type ||
+ INT_LLONG == src_type || INT_ULLONG == src_type) {
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name);
HDprintf("%-70s", str);
HDfflush(stdout);
- fails_this_test=0;
- } else {
- if(run_test==TEST_NORMAL)
- HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
- else if(run_test==TEST_DENORM)
- HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ fails_this_test = 0;
+ }
+ else {
+ if (run_test == TEST_NORMAL)
+ HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, src_type_name,
+ dst_type_name);
+ else if (run_test == TEST_DENORM)
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name,
+ dst_type_name);
else
- HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name,
+ dst_type_name);
HDprintf("%-70s", str);
HDfflush(stdout);
- fails_this_test=0;
+ fails_this_test = 0;
}
/* Some information about datatypes */
- sendian = H5Tget_order(src);
- dendian = H5Tget_order(dst);
- src_size = H5Tget_size(src);
- dst_size = H5Tget_size(dst);
+ sendian = H5Tget_order(src);
+ dendian = H5Tget_order(dst);
+ src_size = H5Tget_size(src);
+ dst_size = H5Tget_size(dst);
src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
- aligned = HDcalloc((size_t)1, MAX(sizeof(long double), sizeof(long long)));
+ aligned = HDcalloc((size_t)1, MAX(sizeof(long double), sizeof(long long)));
#ifdef SHOW_OVERFLOWS
noverflows_g = 0;
#endif
@@ -3633,22 +3750,20 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* conversion exception happens. We only test (unsigned) int - float
* and float - (unsigned) int conversions, which should cover more cases.
*/
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
- if((src_type == INT_INT && dst_type == FLT_FLOAT) ||
- (src_type == INT_UINT && dst_type == FLT_FLOAT) ||
- (src_type == FLT_FLOAT && dst_type == INT_UINT) ||
- (src_type == FLT_FLOAT && dst_type == INT_INT)) {
- if(H5Pset_type_conv_cb(dxpl_id, except_func, &fill_value) < 0)
+ if ((src_type == INT_INT && dst_type == FLT_FLOAT) || (src_type == INT_UINT && dst_type == FLT_FLOAT) ||
+ (src_type == FLT_FLOAT && dst_type == INT_UINT) || (src_type == FLT_FLOAT && dst_type == INT_INT)) {
+ if (H5Pset_type_conv_cb(dxpl_id, except_func, &fill_value) < 0)
goto error;
else
except_set = TRUE;
- if(H5Pget_type_conv_cb(dxpl_id, &op, &user_data) < 0)
+ if (H5Pget_type_conv_cb(dxpl_id, &op, &user_data) < 0)
goto error;
- if(op != except_func || *(int*)user_data != fill_value)
+ if (op != except_func || *(int *)user_data != fill_value)
goto error;
}
@@ -3656,554 +3771,583 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* INIT_FP_NORM if floating-point. The BUF will be used for the conversion while the SAVED buffer will be
* used for the comparison later.
*/
- if(src_type == INT_SCHAR) {
+ if (src_type == INT_SCHAR) {
INIT_INTEGER(signed char, SCHAR_MAX, SCHAR_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_UCHAR) {
+ }
+ else if (src_type == INT_UCHAR) {
INIT_INTEGER(unsigned char, UCHAR_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_SHORT) {
+ }
+ else if (src_type == INT_SHORT) {
INIT_INTEGER(short, SHRT_MAX, SHRT_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_USHORT) {
+ }
+ else if (src_type == INT_USHORT) {
INIT_INTEGER(unsigned short, USHRT_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_INT) {
+ }
+ else if (src_type == INT_INT) {
INIT_INTEGER(int, INT_MAX, INT_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_UINT) {
+ }
+ else if (src_type == INT_UINT) {
INIT_INTEGER(unsigned int, UINT_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_LONG) {
+ }
+ else if (src_type == INT_LONG) {
INIT_INTEGER(long, LONG_MAX, LONG_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_ULONG) {
+ }
+ else if (src_type == INT_ULONG) {
INIT_INTEGER(unsigned long, ULONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_LLONG) {
+ }
+ else if (src_type == INT_LLONG) {
INIT_INTEGER(long long, LLONG_MAX, LLONG_MIN, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == INT_ULLONG) {
+ }
+ else if (src_type == INT_ULLONG) {
INIT_INTEGER(unsigned long long, ULLONG_MAX, 0, src_size, dst_size, src_nbits, buf, saved, nelmts);
- } else if(src_type == FLT_FLOAT) {
- if(run_test==TEST_NORMAL) {
- INIT_FP_NORM(float, FLT_MAX, FLT_MIN, FLT_MAX_10_EXP, FLT_MIN_10_EXP,
- src_size, dst_size, buf, saved, nelmts);
- } else if(run_test==TEST_DENORM) {
- INIT_FP_DENORM(float, FLT_MANT_DIG, src_size, src_nbits, sendian, dst_size,
- buf, saved, nelmts);
- } else {
+ }
+ else if (src_type == FLT_FLOAT) {
+ if (run_test == TEST_NORMAL) {
+ INIT_FP_NORM(float, FLT_MAX, FLT_MIN, FLT_MAX_10_EXP, FLT_MIN_10_EXP, src_size, dst_size, buf,
+ saved, nelmts);
+ }
+ else if (run_test == TEST_DENORM) {
+ INIT_FP_DENORM(float, FLT_MANT_DIG, src_size, src_nbits, sendian, dst_size, buf, saved, nelmts);
+ }
+ else {
INIT_FP_SPECIAL(src_size, src_nbits, sendian, FLT_MANT_DIG, dst_size, buf, saved, nelmts);
}
- } else if(src_type == FLT_DOUBLE) {
- if(run_test==TEST_NORMAL) {
- INIT_FP_NORM(double, DBL_MAX, DBL_MIN, DBL_MAX_10_EXP, DBL_MIN_10_EXP,
- src_size, dst_size, buf, saved, nelmts);
- } else if(run_test==TEST_DENORM) {
- INIT_FP_DENORM(double, DBL_MANT_DIG, src_size, src_nbits, sendian, dst_size,
- buf, saved, nelmts);
- } else {
+ }
+ else if (src_type == FLT_DOUBLE) {
+ if (run_test == TEST_NORMAL) {
+ INIT_FP_NORM(double, DBL_MAX, DBL_MIN, DBL_MAX_10_EXP, DBL_MIN_10_EXP, src_size, dst_size, buf,
+ saved, nelmts);
+ }
+ else if (run_test == TEST_DENORM) {
+ INIT_FP_DENORM(double, DBL_MANT_DIG, src_size, src_nbits, sendian, dst_size, buf, saved, nelmts);
+ }
+ else {
INIT_FP_SPECIAL(src_size, src_nbits, sendian, DBL_MANT_DIG, dst_size, buf, saved, nelmts);
}
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if(src_type == FLT_LDOUBLE) {
- if(run_test==TEST_NORMAL) {
- INIT_FP_NORM(long double, LDBL_MAX, LDBL_MIN, LDBL_MAX_10_EXP, LDBL_MIN_10_EXP,
- src_size, dst_size, buf, saved, nelmts);
- } else if(run_test==TEST_DENORM) {
- INIT_FP_DENORM(long double, LDBL_MANT_DIG, src_size, src_nbits, sendian, dst_size,
- buf, saved, nelmts);
- } else {
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (src_type == FLT_LDOUBLE) {
+ if (run_test == TEST_NORMAL) {
+ INIT_FP_NORM(long double, LDBL_MAX, LDBL_MIN, LDBL_MAX_10_EXP, LDBL_MIN_10_EXP, src_size,
+ dst_size, buf, saved, nelmts);
+ }
+ else if (run_test == TEST_DENORM) {
+ INIT_FP_DENORM(long double, LDBL_MANT_DIG, src_size, src_nbits, sendian, dst_size, buf, saved,
+ nelmts);
+ }
+ else {
INIT_FP_SPECIAL(src_size, src_nbits, sendian, LDBL_MANT_DIG, dst_size, buf, saved, nelmts);
}
#endif
- } else
+ }
+ else
goto error;
/* Perform the conversion */
- if(H5Tconvert(src, dst, nelmts, buf, NULL, dxpl_id) < 0)
+ if (H5Tconvert(src, dst, nelmts, buf, NULL, dxpl_id) < 0)
goto error;
/* Check the results from the library against hardware */
- for (j=0; j<nelmts; j++) {
- if(FLT_FLOAT==src_type || FLT_DOUBLE==src_type
-#if H5_SIZEOF_LONG_DOUBLE !=0
- || FLT_LDOUBLE==src_type
+ for (j = 0; j < nelmts; j++) {
+ if (FLT_FLOAT == src_type || FLT_DOUBLE == src_type
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ || FLT_LDOUBLE == src_type
#endif
- )
- if(my_isnan(src_type, saved+j*src_size))
+ )
+ if (my_isnan(src_type, saved + j * src_size))
continue;
- if (FLT_FLOAT==dst_type) {
- hw = (unsigned char*)&hw_float;
+ if (FLT_FLOAT == dst_type) {
+ hw = (unsigned char *)&hw_float;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_float = (float)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_float = (float)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_float = (float)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_float = (float)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_float = (float)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_float = (float)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_float = (float)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_float = (float)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_float = (float)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_float = (float)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_float = (float)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_float = (float)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_float = (float)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_float = (float)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_float = (float)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_float = (float)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_float = (float)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_float = (float)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_float = (float)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_float = (float)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (FLT_DOUBLE==dst_type) {
- hw = (unsigned char*)&hw_double;
+ }
+ else if (FLT_DOUBLE == dst_type) {
+ hw = (unsigned char *)&hw_double;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_double = (double)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_double = (double)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_double = (double)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_double = (double)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_double = (double)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_double = (double)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_double = (double)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_double = (double)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_double = (double)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_double = (double)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_double = (double)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_double = (double)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_double = (double)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_double = (double)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_double = (double)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_double = (double)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_double = (double)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_double = (double)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_double = (double)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_double = (double)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
-#if H5_SIZEOF_LONG_DOUBLE !=0
- } else if (FLT_LDOUBLE==dst_type) {
- hw = (unsigned char*)&hw_ldouble;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (FLT_LDOUBLE == dst_type) {
+ hw = (unsigned char *)&hw_ldouble;
switch (src_type) {
- case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- hw_ldouble = (long double)(*((signed char*)aligned));
- break;
- case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_ldouble = (long double)(*((unsigned char*)aligned));
- break;
- case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_ldouble = (long double)(*((short*)aligned));
- break;
- case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_ldouble = (long double)(*((unsigned short*)aligned));
- break;
- case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_ldouble = (long double)(*((int*)aligned));
- break;
- case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_ldouble = (long double)(*((unsigned*)aligned));
- break;
- case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_ldouble = (long double)(*((long*)aligned));
- break;
- case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_ldouble = (long double)(*((unsigned long*)aligned));
- break;
- case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- hw_ldouble = (long double)(*((long long*)aligned));
- break;
- case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- hw_ldouble = (long double)(*((unsigned long long*)aligned));
- break;
- case FLT_FLOAT:
- case FLT_DOUBLE:
- case FLT_LDOUBLE:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_ldouble = (long double)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_ldouble = (long double)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_ldouble = (long double)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_ldouble = (long double)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_ldouble = (long double)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_ldouble = (long double)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_ldouble = (long double)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_ldouble = (long double)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_ldouble = (long double)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_ldouble = (long double)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
#endif
- } else if (INT_SCHAR==dst_type) {
- hw = (unsigned char*)&hw_schar;
+ }
+ else if (INT_SCHAR == dst_type) {
+ hw = (unsigned char *)&hw_schar;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_schar = (signed char)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_schar = (signed char)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_schar = (signed char)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_schar = (signed char)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_schar = (signed char)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_schar = (signed char)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_UCHAR==dst_type) {
- hw = (unsigned char*)&hw_uchar;
+ }
+ else if (INT_UCHAR == dst_type) {
+ hw = (unsigned char *)&hw_uchar;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_uchar = (unsigned char)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_uchar = (unsigned char)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_uchar = (unsigned char)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_uchar = (unsigned char)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_uchar = (unsigned char)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_uchar = (unsigned char)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_SHORT==dst_type) {
- hw = (unsigned char*)&hw_short;
+ }
+ else if (INT_SHORT == dst_type) {
+ hw = (unsigned char *)&hw_short;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_short = (short)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_short = (short)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_short = (short)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_short = (short)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_short = (short)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_short = (short)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_USHORT==dst_type) {
- hw = (unsigned char*)&hw_ushort;
+ }
+ else if (INT_USHORT == dst_type) {
+ hw = (unsigned char *)&hw_ushort;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_ushort = (unsigned short)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_ushort = (unsigned short)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_ushort = (unsigned short)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_ushort = (unsigned short)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_ushort = (unsigned short)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_ushort = (unsigned short)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_INT==dst_type) {
- hw = (unsigned char*)&hw_int;
+ }
+ else if (INT_INT == dst_type) {
+ hw = (unsigned char *)&hw_int;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_int = (int)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_int = (int)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_int = (int)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_int = (int)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_int = (int)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_int = (int)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_UINT==dst_type) {
- hw = (unsigned char*)&hw_uint;
+ }
+ else if (INT_UINT == dst_type) {
+ hw = (unsigned char *)&hw_uint;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_uint = (unsigned int)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_uint = (unsigned int)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_uint = (unsigned int)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_uint = (unsigned int)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_uint = (unsigned int)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_uint = (unsigned int)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_LONG==dst_type) {
- hw = (unsigned char*)&hw_long;
+ }
+ else if (INT_LONG == dst_type) {
+ hw = (unsigned char *)&hw_long;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_long = (long)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_long = (long)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_long = (long)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_long = (long)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_long = (long)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_long = (long)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_ULONG==dst_type) {
- hw = (unsigned char*)&hw_ulong;
+ }
+ else if (INT_ULONG == dst_type) {
+ hw = (unsigned char *)&hw_ulong;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_ulong = (unsigned long)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_ulong = (unsigned long)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_ulong = (unsigned long)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_ulong = (unsigned long)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_ulong = (unsigned long)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_ulong = (unsigned long)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_LLONG==dst_type) {
- hw = (unsigned char*)&hw_llong;
+ }
+ else if (INT_LLONG == dst_type) {
+ hw = (unsigned char *)&hw_llong;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_llong = (long long)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_llong = (long long)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_llong = (long long)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_llong = (long long)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_llong = (long long)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_llong = (long long)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
- } else if (INT_ULLONG==dst_type) {
- hw = (unsigned char*)&hw_ullong;
+ }
+ else if (INT_ULLONG == dst_type) {
+ hw = (unsigned char *)&hw_ullong;
switch (src_type) {
- case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_ullong = (unsigned long long)(*((float*)aligned));
- break;
- case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_ullong = (unsigned long long)(*((double*)aligned));
- break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- hw_ullong = (unsigned long long)(*((long double*)aligned));
- break;
+ case FLT_FLOAT:
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ hw_ullong = (unsigned long long)(*((float *)aligned));
+ break;
+ case FLT_DOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ hw_ullong = (unsigned long long)(*((double *)aligned));
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ case FLT_LDOUBLE:
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ hw_ullong = (unsigned long long)(*((long double *)aligned));
+ break;
#endif
- case INT_SCHAR:
- case INT_UCHAR:
- case INT_SHORT:
- case INT_USHORT:
- case INT_INT:
- case INT_UINT:
- case INT_LONG:
- case INT_ULONG:
- case INT_LLONG:
- case INT_ULLONG:
- case OTHER:
- default:
- HDassert(0 && "Unknown type");
- break;
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ HDassert(0 && "Unknown type");
+ break;
}
}
/* Make certain that there isn't some weird number of destination bits */
- assert(dst_nbits%8==0);
+ assert(dst_nbits % 8 == 0);
/* For Intel machines, the size of "long double" is 12 bytes, precision
* is 80 bits; for AMD processors, the size of "long double" is 16 bytes,
@@ -4211,20 +4355,20 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* bytes may have garbage in them. Clean them out with 0s before compare
* the values.
*/
-#if H5_SIZEOF_LONG_DOUBLE !=0
- if(dendian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE) {
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ if (dendian == H5T_ORDER_LE && dst_type == FLT_LDOUBLE) {
size_t q;
- for(q = dst_nbits / 8; q < dst_size; q++)
+ for (q = dst_nbits / 8; q < dst_size; q++)
buf[j * dst_size + q] = 0x00;
}
#endif
/* Are the two results the same? */
- for (k=(dst_size-(dst_nbits/8)); k<dst_size; k++)
- if (buf[j*dst_size+k]!=hw[k])
+ for (k = (dst_size - (dst_nbits / 8)); k < dst_size; k++)
+ if (buf[j * dst_size + k] != hw[k])
break;
- if (k==dst_size)
+ if (k == dst_size)
continue; /*no error*/
/*
@@ -4234,18 +4378,19 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* the `bittests' program.
*/
- if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type) && sendian==H5T_ORDER_VAX) {
+ if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type) && sendian == H5T_ORDER_VAX) {
for (k = 0; k < src_size; k += 2) {
- src_bits[k] = saved[j*src_size + (src_size - 2) - k];
- src_bits[k + 1] = saved[j*src_size + (src_size - 1) - k];
+ src_bits[k] = saved[j * src_size + (src_size - 2) - k];
+ src_bits[k + 1] = saved[j * src_size + (src_size - 1) - k];
}
- } else {
- for (k=0; k<src_size; k++)
- src_bits[src_size-(k+1)] = saved[j*src_size+ENDIAN(src_size, k, sendian)];
+ }
+ else {
+ for (k = 0; k < src_size; k++)
+ src_bits[src_size - (k + 1)] = saved[j * src_size + ENDIAN(src_size, k, sendian)];
}
- for (k=0; k<dst_size; k++)
- dst_bits[dst_size-(k+1)] = buf[j*dst_size+ENDIAN(dst_size, k, dendian)];
+ for (k = 0; k < dst_size; k++)
+ dst_bits[dst_size - (k + 1)] = buf[j * dst_size + ENDIAN(dst_size, k, dendian)];
/* Test library's default overflow handling:
* Hardware usually doesn't handle overflows too gracefully. The
@@ -4256,77 +4401,83 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* Try to follow the except_func callback function to check if the
* desired value was set.
*/
- if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type
-#if H5_SIZEOF_LONG_DOUBLE !=0
- || FLT_LDOUBLE==src_type
+ if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ || FLT_LDOUBLE == src_type
#endif
- )
- && (INT_SCHAR==dst_type || INT_SHORT==dst_type || INT_INT==dst_type
- || INT_LONG==dst_type || INT_LLONG==dst_type)) {
- if(0==H5T__bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
- overflows(src_bits, src, dst_nbits-1)) {
+ ) &&
+ (INT_SCHAR == dst_type || INT_SHORT == dst_type || INT_INT == dst_type || INT_LONG == dst_type ||
+ INT_LLONG == dst_type)) {
+ if (0 == H5T__bit_get_d(src_bits, src_nbits - 1, (size_t)1) &&
+ overflows(src_bits, src, dst_nbits - 1)) {
/*
* Source is positive and the magnitude is too large for
* the destination. The destination should be set to the
* maximum possible value: 0x7f...f
*/
- if(!except_set) {
- if (0==H5T__bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
- H5T__bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
+ if (!except_set) {
+ if (0 == H5T__bit_get_d(dst_bits, dst_nbits - 1, (size_t)1) &&
+ H5T__bit_find(dst_bits, (size_t)0, dst_nbits - 1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
- } else {
+ }
+ else {
/* fill_value is small so we know only the 1st byte is set */
if (dst_bits[0] == fill_value)
continue; /*no error*/
}
- } else if (1==H5T__bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
- overflows(src_bits, src, dst_nbits-1)) {
+ }
+ else if (1 == H5T__bit_get_d(src_bits, src_nbits - 1, (size_t)1) &&
+ overflows(src_bits, src, dst_nbits - 1)) {
/*
* Source is negative but the magnitude is too large for
* the destination. The destination should be set to the
* smallest possible value: 0x80...0
*/
- if(!except_set) {
- if (1==H5T__bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
- H5T__bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 1) < 0)
+ if (!except_set) {
+ if (1 == H5T__bit_get_d(dst_bits, dst_nbits - 1, (size_t)1) &&
+ H5T__bit_find(dst_bits, (size_t)0, dst_nbits - 1, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
- } else {
+ }
+ else {
if (dst_bits[0] == fill_value)
continue; /*no error*/
}
}
}
- if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type
-#if H5_SIZEOF_LONG_DOUBLE !=0
- || FLT_LDOUBLE==src_type
+ if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ || FLT_LDOUBLE == src_type
#endif
- )
- && (INT_UCHAR==dst_type || INT_USHORT==dst_type || INT_UINT==dst_type
- || INT_ULONG==dst_type || INT_ULLONG==dst_type)) {
- if (H5T__bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
+ ) &&
+ (INT_UCHAR == dst_type || INT_USHORT == dst_type || INT_UINT == dst_type ||
+ INT_ULONG == dst_type || INT_ULLONG == dst_type)) {
+ if (H5T__bit_get_d(src_bits, src_nbits - 1, (size_t)1)) {
/*
* The source is negative so the result should be zero.
* The source is negative if the most significant bit is
* set. The destination is zero if all bits are zero.
*/
- if(!except_set) {
+ if (!except_set) {
if (H5T__bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
- } else {
+ }
+ else {
if (dst_bits[0] == fill_value)
continue; /*no error*/
}
- } else if (overflows(src_bits, src, dst_nbits)) {
+ }
+ else if (overflows(src_bits, src, dst_nbits)) {
/*
* The source is a value with a magnitude too large for
* the destination. The destination should be the
* largest possible value: 0xff...f
*/
- if(!except_set) {
+ if (!except_set) {
if (H5T__bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
- } else {
+ }
+ else {
if (dst_bits[0] == fill_value)
continue; /*no error*/
}
@@ -4334,72 +4485,73 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
/* Print errors */
- if (0==fails_this_test++) {
- if(run_test==TEST_NORMAL) {
+ if (0 == fails_this_test++) {
+ if (run_test == TEST_NORMAL) {
H5_FAILED();
- } else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL) {
+ }
+ else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL) {
H5_WARNING();
}
}
HDprintf(" elmt %u: \n", (unsigned)j);
HDprintf(" src = ");
- for (k=0; k<src_size; k++)
- HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size, k, sendian)]);
- HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
+ for (k = 0; k < src_size; k++)
+ HDprintf(" %02x", saved[j * src_size + ENDIAN(src_size, k, sendian)]);
+ HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)dst_size - (ssize_t)src_size)), "");
switch (src_type) {
case INT_SCHAR:
- HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- HDprintf(" %29d\n", (int)*((signed char*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ HDprintf(" %29d\n", (int)*((signed char *)aligned));
break;
case INT_UCHAR:
- HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char *)aligned));
break;
case INT_SHORT:
- HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- HDprintf(" %29hd\n", *((short*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ HDprintf(" %29hd\n", *((short *)aligned));
break;
case INT_USHORT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- HDprintf(" %29hu\n", *((unsigned short*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ HDprintf(" %29hu\n", *((unsigned short *)aligned));
break;
case INT_INT:
- HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- HDprintf(" %29d\n", *((int*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ HDprintf(" %29d\n", *((int *)aligned));
break;
case INT_UINT:
- HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- HDprintf(" %29u\n", *((unsigned*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ HDprintf(" %29u\n", *((unsigned *)aligned));
break;
case INT_LONG:
- HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- HDprintf(" %29ld\n", *((long*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ HDprintf(" %29ld\n", *((long *)aligned));
break;
case INT_ULONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- HDprintf(" %29lu\n", *((unsigned long*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ HDprintf(" %29lu\n", *((unsigned long *)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned));
break;
case FLT_FLOAT:
- HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- HDprintf(" %29f\n", (double)*((float*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float));
+ HDprintf(" %29f\n", (double)*((float *)aligned));
break;
case FLT_DOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- HDprintf(" %29f\n", *((double*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(double), sizeof(double));
+ HDprintf(" %29f\n", *((double *)aligned));
break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- HDprintf(" %29Lf\n", *((long double*)aligned));
+ HDmemcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
+ HDprintf(" %29Lf\n", *((long double *)aligned));
break;
#endif
case OTHER:
@@ -4409,62 +4561,62 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
HDprintf(" dst = ");
- for (k=0; k<dst_size; k++)
- HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, dendian)]);
- HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ for (k = 0; k < dst_size; k++)
+ HDprintf(" %02x", buf[j * dst_size + ENDIAN(dst_size, k, dendian)]);
+ HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
- HDmemcpy(aligned, buf+j*sizeof(signed char), sizeof(signed char));
- HDprintf(" %29d\n", (int)*((signed char*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(signed char), sizeof(signed char));
+ HDprintf(" %29d\n", (int)*((signed char *)aligned));
break;
case INT_UCHAR:
- HDmemcpy(aligned, buf+j*sizeof(unsigned char), sizeof(unsigned char));
- HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(unsigned char), sizeof(unsigned char));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char *)aligned));
break;
case INT_SHORT:
- HDmemcpy(aligned, buf+j*sizeof(short), sizeof(short));
- HDprintf(" %29hd\n", *((short*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(short), sizeof(short));
+ HDprintf(" %29hd\n", *((short *)aligned));
break;
case INT_USHORT:
- HDmemcpy(aligned, buf+j*sizeof(unsigned short), sizeof(unsigned short));
- HDprintf(" %29hu\n", *((unsigned short*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(unsigned short), sizeof(unsigned short));
+ HDprintf(" %29hu\n", *((unsigned short *)aligned));
break;
case INT_INT:
- HDmemcpy(aligned, buf+j*sizeof(int), sizeof(int));
- HDprintf(" %29d\n", *((int*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(int), sizeof(int));
+ HDprintf(" %29d\n", *((int *)aligned));
break;
case INT_UINT:
- HDmemcpy(aligned, buf+j*sizeof(unsigned), sizeof(unsigned));
- HDprintf(" %29u\n", *((unsigned*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(unsigned), sizeof(unsigned));
+ HDprintf(" %29u\n", *((unsigned *)aligned));
break;
case INT_LONG:
- HDmemcpy(aligned, buf+j*sizeof(long), sizeof(long));
- HDprintf(" %29ld\n", *((long*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(long), sizeof(long));
+ HDprintf(" %29ld\n", *((long *)aligned));
break;
case INT_ULONG:
- HDmemcpy(aligned, buf+j*sizeof(unsigned long), sizeof(unsigned long));
- HDprintf(" %29lu\n", *((unsigned long*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(unsigned long), sizeof(unsigned long));
+ HDprintf(" %29lu\n", *((unsigned long *)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(long long), sizeof(long long));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, buf+j*sizeof(unsigned long long), sizeof(unsigned long long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned));
break;
case FLT_FLOAT:
- HDmemcpy(aligned, buf+j*sizeof(float), sizeof(float));
- HDprintf(" %29f\n", (double)*((float*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(float), sizeof(float));
+ HDprintf(" %29f\n", (double)*((float *)aligned));
break;
case FLT_DOUBLE:
- HDmemcpy(aligned, buf+j*sizeof(double), sizeof(double));
- HDprintf(" %29f\n", *((double*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(double), sizeof(double));
+ HDprintf(" %29f\n", *((double *)aligned));
break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
case FLT_LDOUBLE:
- HDmemcpy(aligned, buf+j*sizeof(long double), sizeof(long double));
- HDprintf(" %29Lf\n", *((long double*)aligned));
+ HDmemcpy(aligned, buf + j * sizeof(long double), sizeof(long double));
+ HDprintf(" %29Lf\n", *((long double *)aligned));
break;
#endif
case OTHER:
@@ -4474,49 +4626,49 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
HDprintf(" ans = ");
- for (k=0; k<dst_size; k++)
+ for (k = 0; k < dst_size; k++)
HDprintf(" %02x", hw[ENDIAN(dst_size, k, dendian)]);
- HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
- HDprintf(" %29d\n", (int)*((signed char*)((void *)hw)));
+ HDprintf(" %29d\n", (int)*((signed char *)((void *)hw)));
break;
case INT_UCHAR:
- HDprintf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw)));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char *)((void *)hw)));
break;
case INT_SHORT:
- HDprintf(" %29hd\n", *((short*)((void *)hw)));
+ HDprintf(" %29hd\n", *((short *)((void *)hw)));
break;
case INT_USHORT:
- HDprintf(" %29hu\n", *((unsigned short*)((void *)hw)));
+ HDprintf(" %29hu\n", *((unsigned short *)((void *)hw)));
break;
case INT_INT:
- HDprintf(" %29d\n", *((int*)((void *)hw)));
+ HDprintf(" %29d\n", *((int *)((void *)hw)));
break;
case INT_UINT:
- HDprintf(" %29u\n", *((unsigned int*)((void *)hw)));
+ HDprintf(" %29u\n", *((unsigned int *)((void *)hw)));
break;
case INT_LONG:
- HDprintf(" %29ld\n", *((long*)((void *)hw)));
+ HDprintf(" %29ld\n", *((long *)((void *)hw)));
break;
case INT_ULONG:
- HDprintf(" %29lu\n", *((unsigned long*)((void *)hw)));
+ HDprintf(" %29lu\n", *((unsigned long *)((void *)hw)));
break;
case INT_LLONG:
- HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw)));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)((void *)hw)));
break;
case INT_ULLONG:
- HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)((void *)hw)));
+ HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)((void *)hw)));
break;
case FLT_FLOAT:
- HDprintf(" %29f\n", (double)*((float*)((void *)hw)));
+ HDprintf(" %29f\n", (double)*((float *)((void *)hw)));
break;
case FLT_DOUBLE:
- HDprintf(" %29f\n", *((double*)((void *)hw)));
+ HDprintf(" %29f\n", *((double *)((void *)hw)));
break;
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
case FLT_LDOUBLE:
- HDprintf(" %29Lf\n", *((long double*)((void *)hw)));
+ HDprintf(" %29Lf\n", *((long double *)((void *)hw)));
break;
#endif
case OTHER:
@@ -4527,10 +4679,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
/* If the source is normalized values, print out error message; if it is
* denormalized or special values, print out warning message.*/
- if (++fails_all_tests>=max_fails) {
- if(run_test==TEST_NORMAL)
+ if (++fails_all_tests >= max_fails) {
+ if (run_test == TEST_NORMAL)
HDputs(" maximum failures reached, aborting test...");
- else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
+ else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL)
HDputs(" maximum warnings reached, aborting test...");
HDputs(" (dst is library's conversion output. ans is compiler's conversion output.)");
@@ -4538,46 +4690,51 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
}
- if(!fails_all_tests)
+ if (!fails_all_tests)
PASSED();
- done:
- if (buf) aligned_free(buf);
- if (saved) aligned_free(saved);
- if (aligned) HDfree(aligned);
+done:
+ if (buf)
+ aligned_free(buf);
+ if (saved)
+ aligned_free(saved);
+ if (aligned)
+ HDfree(aligned);
HDfflush(stdout);
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
/* If the source is normalized floating values, treat the failures as error;
* if it is denormalized or special floating values, treat the failure as warning.*/
- if(run_test==TEST_NORMAL)
+ if (run_test == TEST_NORMAL)
return (int)fails_all_tests;
- else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
+ else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL)
return 0;
- error:
- if (buf) aligned_free(buf);
- if (saved) aligned_free(saved);
- if (aligned) HDfree(aligned);
+error:
+ if (buf)
+ aligned_free(buf);
+ if (saved)
+ aligned_free(saved);
+ if (aligned)
+ HDfree(aligned);
HDfflush(stdout);
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
- if(run_test==TEST_NORMAL)
+ if (run_test == TEST_NORMAL)
return MAX((int)fails_all_tests, 1);
else {
- HDassert(run_test==TEST_DENORM || run_test==TEST_SPECIAL);
+ HDassert(run_test == TEST_DENORM || run_test == TEST_SPECIAL);
return 1;
}
}
-
/*-------------------------------------------------------------------------
* Function: overflows
*
@@ -4599,14 +4756,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
static hbool_t
overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
{
- hbool_t ret_value=FALSE;
- hsize_t expt;
- size_t mant_digits=0, expt_digits=0, bias=0;
- size_t epos, mpos;
- size_t src_prec=0; /*source type precision in bits*/
- H5T_norm_t norm;
- ssize_t indx;
- unsigned char bits[32], mant_bits[32];
+ hbool_t ret_value = FALSE;
+ hsize_t expt;
+ size_t mant_digits = 0, expt_digits = 0, bias = 0;
+ size_t epos, mpos;
+ size_t src_prec = 0; /*source type precision in bits*/
+ H5T_norm_t norm;
+ ssize_t indx;
+ unsigned char bits[32], mant_bits[32];
HDmemset(bits, 0, (size_t)32);
HDmemset(mant_bits, 0, (size_t)32);
@@ -4621,55 +4778,53 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
bias = H5Tget_ebias(src_id);
norm = H5Tget_norm(src_id);
- HDmemcpy(bits, origin_bits, src_prec/8+1);
+ HDmemcpy(bits, origin_bits, src_prec / 8 + 1);
/*Check for special cases: +Inf, -Inf*/
- if (H5T__bit_find (bits, mpos, mant_digits, H5T_BIT_LSB, TRUE) < 0) {
- if (H5T__bit_find (bits, epos, expt_digits, H5T_BIT_LSB, FALSE) < 0) {
- ret_value=TRUE;
+ if (H5T__bit_find(bits, mpos, mant_digits, H5T_BIT_LSB, TRUE) < 0) {
+ if (H5T__bit_find(bits, epos, expt_digits, H5T_BIT_LSB, FALSE) < 0) {
+ ret_value = TRUE;
goto done;
}
- } else if (H5T_NORM_NONE==norm && H5T__bit_find (bits, mpos, mant_digits-1,
- H5T_BIT_LSB, TRUE) < 0 && H5T__bit_find (bits, epos, expt_digits,
- H5T_BIT_LSB, FALSE) < 0) {
+ }
+ else if (H5T_NORM_NONE == norm && H5T__bit_find(bits, mpos, mant_digits - 1, H5T_BIT_LSB, TRUE) < 0 &&
+ H5T__bit_find(bits, epos, expt_digits, H5T_BIT_LSB, FALSE) < 0) {
/*This is a special case for the source of no implied mantissa bit.
*If the exponent bits are all 1s and only the 1st bit of mantissa
*is set to 1. It's infinity. The Intel-Linux "long double" is this case.*/
- ret_value=TRUE;
- goto done;
+ ret_value = TRUE;
+ goto done;
}
/* get exponent */
expt = H5T__bit_get_d(bits, mant_digits, expt_digits) - bias;
- if(expt>=(dst_num_bits-1)) {
- ret_value=TRUE;
- goto done;
+ if (expt >= (dst_num_bits - 1)) {
+ ret_value = TRUE;
+ goto done;
}
/* get significand */
- H5T__bit_copy (mant_bits, (size_t)0, bits, (size_t)0, mant_digits);
-
+ H5T__bit_copy(mant_bits, (size_t)0, bits, (size_t)0, mant_digits);
/* restore implicit bit if normalization is implied*/
- if(norm == H5T_NORM_IMPLIED) {
+ if (norm == H5T_NORM_IMPLIED) {
H5T__bit_inc(mant_bits, mant_digits, (size_t)1);
mant_digits++;
}
/* shift significand */
- H5T__bit_shift (mant_bits, (ssize_t)(expt-expt_digits), (size_t)0, (size_t)(32 * 8));
+ H5T__bit_shift(mant_bits, (ssize_t)(expt - expt_digits), (size_t)0, (size_t)(32 * 8));
indx = H5T__bit_find(mant_bits, (size_t)0, (size_t)(32 * 8), H5T_BIT_MSB, 1);
- if((size_t)indx>=dst_num_bits)
- ret_value=TRUE;
+ if ((size_t)indx >= dst_num_bits)
+ ret_value = TRUE;
done:
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: run_integer_tests
*
@@ -4687,18 +4842,18 @@ done:
static int
run_integer_tests(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_ULONG);
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_ULLONG);
#endif
@@ -4708,11 +4863,11 @@ run_integer_tests(const char *name)
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_ULONG);
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_ULLONG);
#endif
@@ -4722,11 +4877,11 @@ run_integer_tests(const char *name)
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_ULONG);
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_ULLONG);
#endif
@@ -4736,11 +4891,11 @@ run_integer_tests(const char *name)
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_ULONG);
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_ULLONG);
#endif
@@ -4750,11 +4905,11 @@ run_integer_tests(const char *name)
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_ULONG);
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_ULLONG);
#endif
@@ -4764,16 +4919,16 @@ run_integer_tests(const char *name)
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_INT);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_ULONG);
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_ULLONG);
#endif
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_SHORT);
@@ -4781,13 +4936,13 @@ run_integer_tests(const char *name)
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_UINT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_ULONG);
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_ULLONG);
#endif
#endif
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_SHORT);
@@ -4795,34 +4950,34 @@ run_integer_tests(const char *name)
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_UINT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_LONG);
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_ULLONG);
#endif
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_ULLONG);
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_ULONG);
#endif
@@ -4832,7 +4987,6 @@ run_integer_tests(const char *name)
return nerrors;
}
-
/*-------------------------------------------------------------------------
* Function: run_fp_tests
*
@@ -4850,12 +5004,12 @@ run_integer_tests(const char *name)
static int
run_fp_tests(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
- if(!strcmp(name, "noop")) {
+ if (!strcmp(name, "noop")) {
nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT);
nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LDOUBLE);
#endif
goto done;
@@ -4864,7 +5018,7 @@ run_fp_tests(const char *name)
/*Test normalized values. TEST_NORMAL indicates normalized values.*/
nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE);
nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT);
@@ -4874,20 +5028,20 @@ run_fp_tests(const char *name)
/*Test denormalized values. TEST_DENORM indicates denormalized values.*/
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE);
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE);
#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT);
#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
- HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
- name, "long double", "float");
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, "long double",
+ "float");
HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
#else
HDputs(" Test skipped due to disabled long double.");
@@ -4901,7 +5055,7 @@ run_fp_tests(const char *name)
/*Test special values, +/-0, +/-infinity, +/-QNaN, +/-SNaN.*/
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE);
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE);
#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
@@ -4909,13 +5063,13 @@ run_fp_tests(const char *name)
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE);
#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
- HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
- name, "long double", "float or double");
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double",
+ "float or double");
HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
#else
HDputs(" Test skipped due to disabled long double.");
@@ -4928,7 +5082,6 @@ done:
return nerrors;
}
-
/*-------------------------------------------------------------------------
* Function: run_int_fp_conv
*
@@ -4946,7 +5099,7 @@ done:
static int
run_int_fp_conv(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_DOUBLE);
@@ -4966,7 +5119,7 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_DOUBLE);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_DOUBLE);
@@ -4974,7 +5127,7 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_DOUBLE);
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_DOUBLE);
@@ -4982,26 +5135,26 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_DOUBLE);
#endif
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UCHAR, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SHORT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_USHORT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
#if !defined(H5_LONG_TO_LDOUBLE_SPECIAL) && !defined(H5_DISABLE_SOME_LDOUBLE_CONV)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE);
#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, "(unsigned) long", "long double");
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "(unsigned) long",
+ "long double");
HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
HDputs(" Test skipped due to the special algorithm of hardware conversion.");
#else
HDputs(" Test skipped due to disabled long double.");
@@ -5009,15 +5162,14 @@ run_int_fp_conv(const char *name)
}
#endif
#endif /* H5_SIZEOF_LONG!=H5_SIZEOF_INT */
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
#if H5_LLONG_TO_LDOUBLE_CORRECT
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE);
-#else /* H5_LLONG_TO_LDOUBLE_CORRECT */
+#else /* H5_LLONG_TO_LDOUBLE_CORRECT */
{
- char str[256]; /*hello string */
+ char str[256]; /*hello string */
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, "long long", "long double");
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long long", "long double");
HDprintf("%-70s", str);
SKIPPED();
HDputs(" Test skipped due to compiler error in handling conversion.");
@@ -5025,12 +5177,12 @@ run_int_fp_conv(const char *name)
#endif /* H5_LLONG_TO_LDOUBLE_CORRECT */
#if H5_LLONG_TO_LDOUBLE_CORRECT
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE);
-#else /* H5_LLONG_TO_LDOUBLE_CORRECT */
+#else /* H5_LLONG_TO_LDOUBLE_CORRECT */
{
- char str[256]; /*hello string */
+ char str[256]; /*hello string */
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, "unsigned long long", "long double");
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "unsigned long long",
+ "long double");
HDprintf("%-70s", str);
SKIPPED();
HDputs(" Test skipped due to compiler not handling conversion.");
@@ -5042,7 +5194,6 @@ run_int_fp_conv(const char *name)
return nerrors;
}
-
/*-------------------------------------------------------------------------
* Function: run_fp_int_conv
*
@@ -5060,10 +5211,10 @@ run_int_fp_conv(const char *name)
static int
run_fp_int_conv(const char *name)
{
- int nerrors = 0;
- int test_values;
+ int nerrors = 0;
+ int test_values;
- for(test_values = TEST_NORMAL; test_values <= TEST_SPECIAL; test_values++) {
+ for (test_values = TEST_NORMAL; test_values <= TEST_SPECIAL; test_values++) {
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR);
@@ -5083,7 +5234,7 @@ run_fp_int_conv(const char *name)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_UINT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LONG);
@@ -5091,11 +5242,12 @@ run_fp_int_conv(const char *name)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULONG);
#endif
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
- if(!strcmp(name, "hw")) { /* Hardware conversion */
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
+ if (!strcmp(name, "hw")) { /* Hardware conversion */
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG);
- } else { /* Software conversion */
+ }
+ else { /* Software conversion */
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG);
}
@@ -5103,42 +5255,44 @@ run_fp_int_conv(const char *name)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULLONG);
#endif
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- if(test_values != TEST_SPECIAL) {
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ if (test_values != TEST_SPECIAL) {
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
- } else {
+ }
+ else {
#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
#else
- char str[256]; /*string */
+ char str[256]; /*string */
- HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
- name, "long double", "signed and unsigned char, short, int, long");
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double",
+ "signed and unsigned char, short, int, long");
HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
#else
HDputs(" Test skipped due to disabled long double.");
#endif
#endif
}
-#if H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE != 0
#ifndef H5_LDOUBLE_TO_LONG_SPECIAL
- if(test_values != TEST_SPECIAL && test_values != TEST_NORMAL) {
+ if (test_values != TEST_SPECIAL && test_values != TEST_NORMAL) {
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
- } else {
+ }
+ else {
#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
@@ -5146,13 +5300,13 @@ run_fp_int_conv(const char *name)
}
#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, "long double", "(unsigned) long");
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double",
+ "(unsigned) long");
HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
HDputs(" Test skipped due to the special algorithm of hardware conversion.");
#else
HDputs(" Test skipped due to disabled long double.");
@@ -5161,18 +5315,17 @@ run_fp_int_conv(const char *name)
#endif
#endif /*H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0 */
-#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG && H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG && H5_SIZEOF_LONG_DOUBLE != 0
#ifdef H5_LDOUBLE_TO_LLONG_ACCURATE
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG);
#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
{
- char str[256]; /*string */
+ char str[256]; /*string */
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, "long double", "long long");
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "long long");
HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
HDputs(" Test skipped due to hardware conversion error.");
#else
HDputs(" Test skipped due to disabled long double.");
@@ -5183,13 +5336,13 @@ run_fp_int_conv(const char *name)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG);
#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
{
- char str[256]; /*string */
+ char str[256]; /*string */
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, "long double", "unsigned long long");
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double",
+ "unsigned long long");
HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
HDputs(" Test skipped due to hardware conversion error.");
#else
HDputs(" Test skipped due to disabled long double.");
@@ -5203,7 +5356,6 @@ run_fp_int_conv(const char *name)
return nerrors;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -5227,7 +5379,7 @@ run_fp_int_conv(const char *name)
int
main(void)
{
- unsigned long nerrors = 0;
+ unsigned long nerrors = 0;
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -5235,7 +5387,7 @@ main(void)
reset_hdf5();
if (ALIGNMENT)
- HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
+ HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
/* Do the tests */
@@ -5304,11 +5456,9 @@ main(void)
h5_restore_err();
if (nerrors) {
- HDprintf("***** %lu FAILURE%s! *****\n",
- nerrors, 1==nerrors?"":"S");
+ HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
}
HDprintf("All data type tests passed.\n");
return 0;
}
-
diff --git a/test/dtransform.c b/test/dtransform.c
index bc61232..191cc73 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -13,8 +13,8 @@
#include "h5test.h"
-#define ROWS 12
-#define COLS 18
+#define ROWS 12
+#define COLS 18
#define FLOAT_TOL 0.0001F
static int init_test(hid_t file_id);
@@ -26,266 +26,324 @@ static int test_set(void);
static int test_getset(const hid_t dxpl_id_simple);
/* These are needed for multiple tests, so are declared here globally and are init'ed in init_test */
-hid_t dset_id_int = -1;
-hid_t dset_id_float = -1;
-hid_t dset_id_int_chunk = -1;
+hid_t dset_id_int = -1;
+hid_t dset_id_float = -1;
+hid_t dset_id_int_chunk = -1;
hid_t dset_id_float_chunk = -1;
-
-const float windchillFfloat[ROWS][COLS] =
- { {36.0f, 31.0f, 25.0f, 19.0f, 13.0f, 7.0f, 1.0f, -5.0f, -11.0f, -16.0f, -22.0f, -28.0f, -34.0f, -40.0f, -46.0f, -52.0f, -57.0f, -63.0f},
- {34.0f, 27.0f, 21.0f, 15.0f, 9.0f, 3.0f, -4.0f, -10.0f, -16.0f, -22.0f, -28.0f, -35.0f, -41.0f, -47.0f, -53.0f, -59.0f, -66.0f, -72.0f} ,
- {32.0f, 25.0f, 19.0f, 13.0f, 6.0f, 0.0f, -7.0f, -13.0f, -19.0f, -26.0f, -32.0f, -39.0f, -45.0f, -51.0f, -58.0f, -64.0f, -71.0f, -77.0f},
- {30.0f, 24.0f, 17.0f, 11.0f, 4.0f, -2.0f, -9.0f, -15.0f, -22.0f, -29.0f, -35.0f, -42.0f, -48.0f, -55.0f, -61.0f, -68.0f, -74.0f, -81.0f},
- {29.0f, 23.0f, 16.0f, 9.0f, 3.0f, -4.0f, -11.0f, -17.0f, -24.0f, -31.0f, -37.0f, -44.0f, -51.0f, -58.0f, -64.0f, -71.0f, -78.0f, -84.0f},
- {28.0f, 22.0f, 15.0f, 8.0f, 1.0f, -5.0f, -12.0f, -19.0f, -26.0f, -33.0f, -39.0f, -46.0f, -53.0f, -60.0f, -67.0f, -73.0f, -80.0f, -87.0f},
- {28.0f, 21.0f, 14.0f, 7.0f, 0.0f, -7.0f, -14.0f, -21.0f, -27.0f, -34.0f, -41.0f, -48.0f, -55.0f, -62.0f, -69.0f, -76.0f, -82.0f, -89.0f},
- {27.0f, 20.0f, 13.0f, 6.0f, -1.0f, -8.0f, -15.0f, -22.0f, -29.0f, -36.0f, -43.0f, -50.0f, -57.0f, -64.0f, -71.0f, -78.0f, -84.0f, -91.0f},
- {26.0f, 19.0f, 12.0f, 5.0f, -2.0f, -9.0f, -16.0f, -23.0f, -30.0f, -37.0f, -44.0f, -51.0f, -58.0f, -65.0f, -72.0f, -79.0f, -86.0f, -93.0f},
- {26.0f, 19.0f, 12.0f, 4.0f, -3.0f, -10.0f, -17.0f, -24.0f, -31.0f, -38.0f, -45.0f, -52.0f, -60.0f, -67.0f, -74.0f, -81.0f, -88.0f, -95.0f},
- {25.0f, 18.0f, 11.0f, 4.0f, -3.0f, -11.0f, -18.0f, -25.0f, -32.0f, -39.0f, -46.0f, -54.0f, -61.0f, -68.0f, -75.0f, -82.0f, -89.0f, -97.0f},
- {25.0f, 17.0f, 10.0f, 3.0f, -4.0f, -11.0f, -19.0f, -26.0f, -33.0f, -40.0f, -48.0f, -55.0f, -62.0f, -69.0f, -76.0f, -84.0f, -91.0f, -98.0f}
- };
-
-const int transformData[ROWS][COLS] =
- { {36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, 28, 34, 40, 46, 52, 57, 63 },
- {34, 27, 21, 15, 9, 3, 4, 10, 16, 22, 28, 35, 41, 47, 53, 59, 66, 1 } ,
- {32, 25, 19, 13, 6, 2, 7, 13, 19, 26, 32, 39, 45, 51, 58, 64, 71, 5 },
- {30, 24, 17, 11, 4, 2, 9, 15, 22, 29, 35, 42, 48, 55, 61, 68, 2, 9 },
- {29, 23, 16, 9, 3, 4, 11, 17, 24, 31, 37, 44, 51, 58, 64, 71, 6, 12 },
- {28, 22, 15, 8, 1, 5, 12, 19, 26, 33, 39, 46, 53, 60, 67, 1, 8, 15 },
- {28, 21, 14, 7, 6, 7, 14, 21, 27, 34, 41, 48, 55, 62, 69, 4, 10, 17 },
- {27, 20, 13, 6, 1, 8, 15, 22, 29, 36, 43, 50, 57, 64, 71, 6, 12, 19 },
- {26, 19, 12, 5, 2, 9, 16, 23, 30, 37, 44, 51, 58, 65, 5, 7, 14, 21 },
- {26, 19, 12, 4, 3, 10, 17, 24, 31, 38, 45, 52, 60, 67, 2, 9, 16, 23},
- {25, 18, 11, 4, 3, 11, 18, 25, 32, 39, 46, 54, 61, 68, 3, 10, 17, 25},
- {25, 17, 10, 3, 4, 11, 19, 26, 33, 40, 48, 55, 62, 69, 4, 12, 19, 26}
- };
-
-#define UCOMPARE(TYPE,VAR1,VAR2,TOL) \
-{ \
- size_t i,j; \
- \
- for(i=0; i<ROWS; i++) \
- for(j=0; j<COLS; j++) \
- { \
- if(!( (((VAR1)[i][j] >= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || ( ((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) \
- { \
- H5_FAILED(); \
- HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
- goto error; \
- } \
- } \
- PASSED(); \
-}
-
-#define COMPARE(TYPE,VAR1,VAR2,TOL) \
-{ \
- size_t i,j; \
- \
- for(i=0; i<ROWS; i++) \
- for(j=0; j<COLS; j++) \
- { \
- if( !(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + TOL)) && ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - TOL))) ) \
- { \
- H5_FAILED(); \
- HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
- goto error; \
- } \
- } \
- PASSED(); \
-}
-
-#define COMPARE_INT(VAR1,VAR2) \
-{ \
- size_t i,j; \
- \
- for(i=0; i<ROWS; i++) \
- for(j=0; j<COLS; j++) \
- { \
- if( (VAR1)[i][j] != (VAR2)[i][j] ) \
- { \
- H5_FAILED(); \
- HDfprintf(stderr, " ERROR: data failed to match computed data\n"); \
- goto error; \
- } \
- } \
-}
-
-#define TEST_TYPE_CONTIG(XFORM, TYPE, HDF_TYPE, TEST_STR, COMPARE_DATA, SIGNED) \
-{ \
- TYPE array[ROWS][COLS]; \
- const char* f_to_c = "(5/9.0)*(x-32)"; \
- /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */ \
- const char* utrans = "((x+100)/4)*3"; \
- \
- hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, dset, dset_nn, dt_nn; \
- H5T_order_t order; \
- hsize_t dim[2] = {ROWS, COLS}; \
- \
- if((dataspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR; \
- if((dset = H5Dcreate2(file_id, "/transformtest_"TEST_STR, HDF_TYPE, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; \
- \
- if((dt_nn = H5Tcopy(HDF_TYPE)) < 0) TEST_ERROR \
- if((order = H5Tget_order(dt_nn)) == H5T_ORDER_ERROR) TEST_ERROR \
- if(H5Tset_order(dt_nn, order == H5T_ORDER_LE ? H5T_ORDER_BE : H5T_ORDER_LE) < 0) TEST_ERROR \
- if((dset_nn = H5Dcreate2(file_id, "/nonnative_transformtest_"TEST_STR, dt_nn, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR \
- if(H5Tclose(dt_nn) < 0) TEST_ERROR \
- \
- if(SIGNED) \
- { \
- if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \
- if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) TEST_ERROR; \
- if(H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \
- if(H5Dwrite(dset_nn, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \
- if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR; \
- } \
- else \
- { \
- if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \
- if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) TEST_ERROR; \
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \
- if(H5Dwrite(dset_nn, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \
- if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR; \
- } \
- \
- \
- TESTING("contiguous, no data type conversion ("TEST_STR"->"TEST_STR")") \
- \
- if(H5Dread(dset, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \
- if(SIGNED) \
- COMPARE(TYPE, array, COMPARE_DATA, 2) \
- else \
- UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
- \
- TESTING("contiguous, byte order conversion ("TEST_STR"->"TEST_STR")") \
- \
- if(H5Dread(dset_nn, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \
- if(SIGNED) \
- COMPARE(TYPE, array, COMPARE_DATA, 2) \
- else \
- UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
- \
- if(SIGNED) \
- { \
- TESTING("contiguous, with type conversion (float->"TEST_STR")") \
- \
- if(H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \
- COMPARE(TYPE, array, COMPARE_DATA, 2) \
- } \
- \
- if(H5Dclose(dset) < 0) TEST_ERROR; \
- if(H5Sclose(dataspace) < 0) TEST_ERROR; \
-}
-
-#define TEST_TYPE_CHUNK(XFORM, TYPE, HDF_TYPE, TEST_STR, COMPARE_DATA, SIGNED) \
-{ \
- TYPE array[ROWS][COLS]; \
- const char* f_to_c = "(5/9.0)*(x-32)"; \
- /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */ \
- const char* utrans = "((x+100)/4)*3"; \
- \
- hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, memspace, dset_chunk, filespace; \
- hsize_t dim[2] = {ROWS, COLS}; \
- hsize_t offset[2] = {0, 0}; \
- \
- \
- if((dataspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR; \
- \
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; \
- if(H5Pset_chunk(cparms, 2, dim) < 0) TEST_ERROR; \
- \
- if((dset_chunk = H5Dcreate2(file_id, "/transformtest_chunk_"TEST_STR, HDF_TYPE, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR; \
- if((filespace = H5Dget_space(dset_chunk)) < 0) TEST_ERROR \
- if((memspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR \
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR; \
- \
- if(SIGNED) \
- { \
- if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \
- if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) TEST_ERROR; \
- if(H5Dwrite(dset_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \
- if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR; \
- } \
- else \
- { \
- if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \
- if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) TEST_ERROR; \
- if(H5Dwrite(dset_chunk, H5T_NATIVE_INT, dataspace, filespace, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \
- if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR; \
- } \
- \
- \
- TESTING("chunked, no data type conversion ("TEST_STR"->"TEST_STR")") \
- \
- if(H5Dread(dset_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) TEST_ERROR; \
- if(SIGNED) \
- COMPARE(TYPE, array, COMPARE_DATA, 2) \
- else \
- UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
- \
- if(SIGNED) \
- { \
- TESTING("chunked, with type conversion (float->"TEST_STR")") \
- \
- if(H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) TEST_ERROR; \
- COMPARE(TYPE, array, COMPARE_DATA, 2) \
- } \
- \
- \
- if(H5Pclose(cparms) < 0) TEST_ERROR; \
- if(H5Dclose(dset_chunk) < 0) TEST_ERROR; \
- if(H5Sclose(dataspace) < 0) TEST_ERROR; \
- if(H5Sclose(memspace) < 0) TEST_ERROR; \
-}
-
-#define INVALID_SET_TEST(TRANSFORM) \
-{ \
- if(H5Pset_data_transform(dxpl_id, TRANSFORM) < 0) \
- { \
- PASSED(); \
- } \
- else \
- { \
- H5_FAILED(); \
- HDfprintf(stderr, " ERROR: Data transform allowed invalid TRANSFORM transform to be set\n"); \
- goto error; \
- } \
-}
-
-int main(void)
+const float windchillFfloat[ROWS][COLS] = {
+ {36.0f, 31.0f, 25.0f, 19.0f, 13.0f, 7.0f, 1.0f, -5.0f, -11.0f, -16.0f, -22.0f, -28.0f, -34.0f, -40.0f,
+ -46.0f, -52.0f, -57.0f, -63.0f},
+ {34.0f, 27.0f, 21.0f, 15.0f, 9.0f, 3.0f, -4.0f, -10.0f, -16.0f, -22.0f, -28.0f, -35.0f, -41.0f, -47.0f,
+ -53.0f, -59.0f, -66.0f, -72.0f},
+ {32.0f, 25.0f, 19.0f, 13.0f, 6.0f, 0.0f, -7.0f, -13.0f, -19.0f, -26.0f, -32.0f, -39.0f, -45.0f, -51.0f,
+ -58.0f, -64.0f, -71.0f, -77.0f},
+ {30.0f, 24.0f, 17.0f, 11.0f, 4.0f, -2.0f, -9.0f, -15.0f, -22.0f, -29.0f, -35.0f, -42.0f, -48.0f, -55.0f,
+ -61.0f, -68.0f, -74.0f, -81.0f},
+ {29.0f, 23.0f, 16.0f, 9.0f, 3.0f, -4.0f, -11.0f, -17.0f, -24.0f, -31.0f, -37.0f, -44.0f, -51.0f, -58.0f,
+ -64.0f, -71.0f, -78.0f, -84.0f},
+ {28.0f, 22.0f, 15.0f, 8.0f, 1.0f, -5.0f, -12.0f, -19.0f, -26.0f, -33.0f, -39.0f, -46.0f, -53.0f, -60.0f,
+ -67.0f, -73.0f, -80.0f, -87.0f},
+ {28.0f, 21.0f, 14.0f, 7.0f, 0.0f, -7.0f, -14.0f, -21.0f, -27.0f, -34.0f, -41.0f, -48.0f, -55.0f, -62.0f,
+ -69.0f, -76.0f, -82.0f, -89.0f},
+ {27.0f, 20.0f, 13.0f, 6.0f, -1.0f, -8.0f, -15.0f, -22.0f, -29.0f, -36.0f, -43.0f, -50.0f, -57.0f, -64.0f,
+ -71.0f, -78.0f, -84.0f, -91.0f},
+ {26.0f, 19.0f, 12.0f, 5.0f, -2.0f, -9.0f, -16.0f, -23.0f, -30.0f, -37.0f, -44.0f, -51.0f, -58.0f, -65.0f,
+ -72.0f, -79.0f, -86.0f, -93.0f},
+ {26.0f, 19.0f, 12.0f, 4.0f, -3.0f, -10.0f, -17.0f, -24.0f, -31.0f, -38.0f, -45.0f, -52.0f, -60.0f, -67.0f,
+ -74.0f, -81.0f, -88.0f, -95.0f},
+ {25.0f, 18.0f, 11.0f, 4.0f, -3.0f, -11.0f, -18.0f, -25.0f, -32.0f, -39.0f, -46.0f, -54.0f, -61.0f, -68.0f,
+ -75.0f, -82.0f, -89.0f, -97.0f},
+ {25.0f, 17.0f, 10.0f, 3.0f, -4.0f, -11.0f, -19.0f, -26.0f, -33.0f, -40.0f, -48.0f, -55.0f, -62.0f, -69.0f,
+ -76.0f, -84.0f, -91.0f, -98.0f}};
+
+const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, 28, 34, 40, 46, 52, 57, 63},
+ {34, 27, 21, 15, 9, 3, 4, 10, 16, 22, 28, 35, 41, 47, 53, 59, 66, 1},
+ {32, 25, 19, 13, 6, 2, 7, 13, 19, 26, 32, 39, 45, 51, 58, 64, 71, 5},
+ {30, 24, 17, 11, 4, 2, 9, 15, 22, 29, 35, 42, 48, 55, 61, 68, 2, 9},
+ {29, 23, 16, 9, 3, 4, 11, 17, 24, 31, 37, 44, 51, 58, 64, 71, 6, 12},
+ {28, 22, 15, 8, 1, 5, 12, 19, 26, 33, 39, 46, 53, 60, 67, 1, 8, 15},
+ {28, 21, 14, 7, 6, 7, 14, 21, 27, 34, 41, 48, 55, 62, 69, 4, 10, 17},
+ {27, 20, 13, 6, 1, 8, 15, 22, 29, 36, 43, 50, 57, 64, 71, 6, 12, 19},
+ {26, 19, 12, 5, 2, 9, 16, 23, 30, 37, 44, 51, 58, 65, 5, 7, 14, 21},
+ {26, 19, 12, 4, 3, 10, 17, 24, 31, 38, 45, 52, 60, 67, 2, 9, 16, 23},
+ {25, 18, 11, 4, 3, 11, 18, 25, 32, 39, 46, 54, 61, 68, 3, 10, 17, 25},
+ {25, 17, 10, 3, 4, 11, 19, 26, 33, 40, 48, 55, 62, 69, 4, 12, 19, 26}};
+
+#define UCOMPARE(TYPE, VAR1, VAR2, TOL) \
+ { \
+ size_t i, j; \
+ \
+ for (i = 0; i < ROWS; i++) \
+ for (j = 0; j < COLS; j++) { \
+ if (!((((VAR1)[i][j] >= (TYPE)((VAR2)[i][j])) && \
+ (((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || \
+ (((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && \
+ (((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) { \
+ H5_FAILED(); \
+ HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
+ goto error; \
+ } \
+ } \
+ PASSED(); \
+ }
+
+#define COMPARE(TYPE, VAR1, VAR2, TOL) \
+ { \
+ size_t i, j; \
+ \
+ for (i = 0; i < ROWS; i++) \
+ for (j = 0; j < COLS; j++) { \
+ if (!(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + TOL)) && \
+ ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - TOL)))) { \
+ H5_FAILED(); \
+ HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
+ goto error; \
+ } \
+ } \
+ PASSED(); \
+ }
+
+#define COMPARE_INT(VAR1, VAR2) \
+ { \
+ size_t i, j; \
+ \
+ for (i = 0; i < ROWS; i++) \
+ for (j = 0; j < COLS; j++) { \
+ if ((VAR1)[i][j] != (VAR2)[i][j]) { \
+ H5_FAILED(); \
+ HDfprintf(stderr, " ERROR: data failed to match computed data\n"); \
+ goto error; \
+ } \
+ } \
+ }
+
+#define TEST_TYPE_CONTIG(XFORM, TYPE, HDF_TYPE, TEST_STR, COMPARE_DATA, SIGNED) \
+ { \
+ TYPE array[ROWS][COLS]; \
+ const char *f_to_c = "(5/9.0)*(x-32)"; \
+ /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to \
+ * fit into uchar */ \
+ const char *utrans = "((x+100)/4)*3"; \
+ \
+ hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, dset, dset_nn, dt_nn; \
+ H5T_order_t order; \
+ hsize_t dim[2] = {ROWS, COLS}; \
+ \
+ if ((dataspace = H5Screate_simple(2, dim, NULL)) < 0) \
+ TEST_ERROR; \
+ if ((dset = H5Dcreate2(file_id, "/transformtest_" TEST_STR, HDF_TYPE, dataspace, H5P_DEFAULT, \
+ H5P_DEFAULT, H5P_DEFAULT)) < 0) \
+ TEST_ERROR; \
+ \
+ if ((dt_nn = H5Tcopy(HDF_TYPE)) < 0) \
+ TEST_ERROR \
+ if ((order = H5Tget_order(dt_nn)) == H5T_ORDER_ERROR) \
+ TEST_ERROR \
+ if (H5Tset_order(dt_nn, order == H5T_ORDER_LE ? H5T_ORDER_BE : H5T_ORDER_LE) < 0) \
+ TEST_ERROR \
+ if ((dset_nn = H5Dcreate2(file_id, "/nonnative_transformtest_" TEST_STR, dt_nn, dataspace, \
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) \
+ TEST_ERROR \
+ if (H5Tclose(dt_nn) < 0) \
+ TEST_ERROR \
+ \
+ if (SIGNED) { \
+ if ((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) \
+ TEST_ERROR; \
+ if (H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) \
+ TEST_ERROR; \
+ if (H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) \
+ TEST_ERROR; \
+ if (H5Dwrite(dset_nn, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) \
+ TEST_ERROR; \
+ if (H5Pclose(dxpl_id_f_to_c) < 0) \
+ TEST_ERROR; \
+ } \
+ else { \
+ if ((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) \
+ TEST_ERROR; \
+ if (H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) \
+ TEST_ERROR; \
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData) < 0) \
+ TEST_ERROR; \
+ if (H5Dwrite(dset_nn, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData) < 0) \
+ TEST_ERROR; \
+ if (H5Pclose(dxpl_id_utrans) < 0) \
+ TEST_ERROR; \
+ } \
+ \
+ TESTING("contiguous, no data type conversion (" TEST_STR "->" TEST_STR ")") \
+ \
+ if (H5Dread(dset, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) \
+ TEST_ERROR; \
+ if (SIGNED) \
+ COMPARE(TYPE, array, COMPARE_DATA, 2) \
+ else \
+ UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
+ \
+ TESTING("contiguous, byte order conversion (" TEST_STR "->" TEST_STR ")") \
+ \
+ if (H5Dread(dset_nn, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) \
+ TEST_ERROR; \
+ if (SIGNED) \
+ COMPARE(TYPE, array, COMPARE_DATA, 2) \
+ else \
+ UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
+ \
+ if (SIGNED) { \
+ TESTING("contiguous, with type conversion (float->" TEST_STR ")") \
+ \
+ if (H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) \
+ TEST_ERROR; \
+ COMPARE(TYPE, array, COMPARE_DATA, 2) \
+ } \
+ \
+ if (H5Dclose(dset) < 0) \
+ TEST_ERROR; \
+ if (H5Sclose(dataspace) < 0) \
+ TEST_ERROR; \
+ }
+
+#define TEST_TYPE_CHUNK(XFORM, TYPE, HDF_TYPE, TEST_STR, COMPARE_DATA, SIGNED) \
+ { \
+ TYPE array[ROWS][COLS]; \
+ const char *f_to_c = "(5/9.0)*(x-32)"; \
+ /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to \
+ * fit into uchar */ \
+ const char *utrans = "((x+100)/4)*3"; \
+ \
+ hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, memspace, dset_chunk, filespace; \
+ hsize_t dim[2] = {ROWS, COLS}; \
+ hsize_t offset[2] = {0, 0}; \
+ \
+ if ((dataspace = H5Screate_simple(2, dim, NULL)) < 0) \
+ TEST_ERROR; \
+ \
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) \
+ TEST_ERROR; \
+ if (H5Pset_chunk(cparms, 2, dim) < 0) \
+ TEST_ERROR; \
+ \
+ if ((dset_chunk = H5Dcreate2(file_id, "/transformtest_chunk_" TEST_STR, HDF_TYPE, dataspace, \
+ H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) \
+ TEST_ERROR; \
+ if ((filespace = H5Dget_space(dset_chunk)) < 0) \
+ TEST_ERROR \
+ if ((memspace = H5Screate_simple(2, dim, NULL)) < 0) \
+ TEST_ERROR \
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) \
+ TEST_ERROR; \
+ \
+ if (SIGNED) { \
+ if ((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) \
+ TEST_ERROR; \
+ if (H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) \
+ TEST_ERROR; \
+ if (H5Dwrite(dset_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, \
+ windchillFfloat) < 0) \
+ TEST_ERROR; \
+ if (H5Pclose(dxpl_id_f_to_c) < 0) \
+ TEST_ERROR; \
+ } \
+ else { \
+ if ((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) \
+ TEST_ERROR; \
+ if (H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) \
+ TEST_ERROR; \
+ if (H5Dwrite(dset_chunk, H5T_NATIVE_INT, dataspace, filespace, dxpl_id_utrans, transformData) < \
+ 0) \
+ TEST_ERROR; \
+ if (H5Pclose(dxpl_id_utrans) < 0) \
+ TEST_ERROR; \
+ } \
+ \
+ TESTING("chunked, no data type conversion (" TEST_STR "->" TEST_STR ")") \
+ \
+ if (H5Dread(dset_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) \
+ TEST_ERROR; \
+ if (SIGNED) \
+ COMPARE(TYPE, array, COMPARE_DATA, 2) \
+ else \
+ UCOMPARE(TYPE, array, COMPARE_DATA, 4) \
+ \
+ if (SIGNED) { \
+ TESTING("chunked, with type conversion (float->" TEST_STR ")") \
+ \
+ if (H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) \
+ TEST_ERROR; \
+ COMPARE(TYPE, array, COMPARE_DATA, 2) \
+ } \
+ \
+ if (H5Pclose(cparms) < 0) \
+ TEST_ERROR; \
+ if (H5Dclose(dset_chunk) < 0) \
+ TEST_ERROR; \
+ if (H5Sclose(dataspace) < 0) \
+ TEST_ERROR; \
+ if (H5Sclose(memspace) < 0) \
+ TEST_ERROR; \
+ }
+
+#define INVALID_SET_TEST(TRANSFORM) \
+ { \
+ if (H5Pset_data_transform(dxpl_id, TRANSFORM) < 0) { \
+ PASSED(); \
+ } \
+ else { \
+ H5_FAILED(); \
+ HDfprintf(stderr, " ERROR: Data transform allowed invalid TRANSFORM transform to be set\n"); \
+ goto error; \
+ } \
+ }
+
+int
+main(void)
{
- hid_t dxpl_id_c_to_f = -1;
- hid_t dxpl_id_c_to_f_copy = 1;
- hid_t dxpl_id_simple = -1;
- hid_t dxpl_id_polynomial = -1;
+ hid_t dxpl_id_c_to_f = -1;
+ hid_t dxpl_id_c_to_f_copy = 1;
+ hid_t dxpl_id_simple = -1;
+ hid_t dxpl_id_polynomial = -1;
hid_t dxpl_id_polynomial_copy = -1;
- hid_t dxpl_id_utrans_inv = -1;
- hid_t file_id = -1;
+ hid_t dxpl_id_utrans_inv = -1;
+ hid_t file_id = -1;
- const char* c_to_f = "(9/5.0)*x + 32";
- const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
- const char* polynomial = "(2+x)* ((x-8)/2)";
+ const char *c_to_f = "(9/5.0)*x + 32";
+ const char *simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
+ const char *polynomial = "(2+x)* ((x-8)/2)";
/* inverses the utrans transform in init_test to get back original array */
- const char* utrans_inv = "(x/3)*4 - 100";
-
- if((file_id = H5Fcreate("dtransform.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
-
- if((dxpl_id_c_to_f = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
- if((dxpl_id_simple = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
- if((dxpl_id_utrans_inv = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
- if((dxpl_id_polynomial = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
- if(H5Pset_data_transform(dxpl_id_c_to_f, c_to_f) < 0) TEST_ERROR;
- if(H5Pset_data_transform(dxpl_id_polynomial, polynomial) < 0) TEST_ERROR;
- if(H5Pset_data_transform(dxpl_id_simple, simple) < 0) TEST_ERROR;
- if(H5Pset_data_transform(dxpl_id_utrans_inv, utrans_inv) < 0) TEST_ERROR;
- if((dxpl_id_polynomial_copy = H5Pcopy(dxpl_id_polynomial)) < 0) TEST_ERROR;
- if((dxpl_id_c_to_f_copy = H5Pcopy(dxpl_id_c_to_f)) < 0) TEST_ERROR;
+ const char *utrans_inv = "(x/3)*4 - 100";
+
+ if ((file_id = H5Fcreate("dtransform.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if ((dxpl_id_c_to_f = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR;
+ if ((dxpl_id_simple = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR;
+ if ((dxpl_id_utrans_inv = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR;
+ if ((dxpl_id_polynomial = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR;
+ if (H5Pset_data_transform(dxpl_id_c_to_f, c_to_f) < 0)
+ TEST_ERROR;
+ if (H5Pset_data_transform(dxpl_id_polynomial, polynomial) < 0)
+ TEST_ERROR;
+ if (H5Pset_data_transform(dxpl_id_simple, simple) < 0)
+ TEST_ERROR;
+ if (H5Pset_data_transform(dxpl_id_utrans_inv, utrans_inv) < 0)
+ TEST_ERROR;
+ if ((dxpl_id_polynomial_copy = H5Pcopy(dxpl_id_polynomial)) < 0)
+ TEST_ERROR;
+ if ((dxpl_id_c_to_f_copy = H5Pcopy(dxpl_id_c_to_f)) < 0)
+ TEST_ERROR;
/* Run all the tests */
- if(init_test(file_id) < 0) TEST_ERROR;
- if(test_set() < 0) TEST_ERROR;
+ if (init_test(file_id) < 0)
+ TEST_ERROR;
+ if (test_set() < 0)
+ TEST_ERROR;
TEST_TYPE_CONTIG(dxpl_id_utrans_inv, char, H5T_NATIVE_CHAR, "char", transformData, 0);
TEST_TYPE_CONTIG(dxpl_id_utrans_inv, unsigned char, H5T_NATIVE_UCHAR, "uchar", transformData, 0);
TEST_TYPE_CONTIG(dxpl_id_c_to_f, signed char, H5T_NATIVE_SCHAR, "schar", windchillFfloat, 1);
@@ -299,7 +357,7 @@ int main(void)
TEST_TYPE_CONTIG(dxpl_id_utrans_inv, unsigned long long, H5T_NATIVE_ULLONG, "ullong", transformData, 0);
TEST_TYPE_CONTIG(dxpl_id_c_to_f, float, H5T_NATIVE_FLOAT, "float", windchillFfloat, 1);
TEST_TYPE_CONTIG(dxpl_id_c_to_f, double, H5T_NATIVE_DOUBLE, "double", windchillFfloat, 1);
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
TEST_TYPE_CONTIG(dxpl_id_c_to_f, long double, H5T_NATIVE_LDOUBLE, "ldouble", windchillFfloat, 1);
#endif
@@ -316,34 +374,50 @@ int main(void)
TEST_TYPE_CHUNK(dxpl_id_utrans_inv, unsigned long long, H5T_NATIVE_ULLONG, "ullong", transformData, 0);
TEST_TYPE_CHUNK(dxpl_id_c_to_f, float, H5T_NATIVE_FLOAT, "float", windchillFfloat, 1);
TEST_TYPE_CHUNK(dxpl_id_c_to_f, double, H5T_NATIVE_DOUBLE, "double", windchillFfloat, 1);
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
TEST_TYPE_CHUNK(dxpl_id_c_to_f, long double, H5T_NATIVE_LDOUBLE, "ldouble", windchillFfloat, 1);
#endif
- if(test_copy(dxpl_id_c_to_f_copy, dxpl_id_polynomial_copy) < 0) TEST_ERROR;
- if(test_trivial(dxpl_id_simple) < 0) TEST_ERROR;
- if(test_poly(dxpl_id_polynomial) < 0) TEST_ERROR;
- if(test_getset(dxpl_id_c_to_f) < 0) TEST_ERROR;
- if(test_specials(file_id) < 0) TEST_ERROR;
+ if (test_copy(dxpl_id_c_to_f_copy, dxpl_id_polynomial_copy) < 0)
+ TEST_ERROR;
+ if (test_trivial(dxpl_id_simple) < 0)
+ TEST_ERROR;
+ if (test_poly(dxpl_id_polynomial) < 0)
+ TEST_ERROR;
+ if (test_getset(dxpl_id_c_to_f) < 0)
+ TEST_ERROR;
+ if (test_specials(file_id) < 0)
+ TEST_ERROR;
/* Close the objects we opened/created */
- if(H5Dclose(dset_id_int) < 0) TEST_ERROR;
- if(H5Dclose(dset_id_int_chunk) < 0) TEST_ERROR;
- if(H5Dclose(dset_id_float) < 0) TEST_ERROR;
- if(H5Dclose(dset_id_float_chunk) < 0) TEST_ERROR;
- if(H5Fclose(file_id) < 0) TEST_ERROR;
- if(H5Pclose(dxpl_id_c_to_f) < 0) TEST_ERROR;
- if(H5Pclose(dxpl_id_c_to_f_copy) < 0) TEST_ERROR;
- if(H5Pclose(dxpl_id_polynomial) < 0) TEST_ERROR;
- if(H5Pclose(dxpl_id_polynomial_copy) < 0) TEST_ERROR;
- if(H5Pclose(dxpl_id_simple) < 0) TEST_ERROR;
- if(H5Pclose(dxpl_id_utrans_inv) < 0) TEST_ERROR;
-
+ if (H5Dclose(dset_id_int) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset_id_int_chunk) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset_id_float) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset_id_float_chunk) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dxpl_id_c_to_f) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dxpl_id_c_to_f_copy) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dxpl_id_polynomial) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dxpl_id_polynomial_copy) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dxpl_id_simple) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dxpl_id_utrans_inv) < 0)
+ TEST_ERROR;
- return 0;
+ return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset_id_int);
H5Dclose(dset_id_int_chunk);
H5Dclose(dset_id_float);
@@ -355,86 +429,86 @@ error:
H5Pclose(dxpl_id_polynomial_copy);
H5Pclose(dxpl_id_simple);
H5Pclose(dxpl_id_utrans_inv);
- } H5E_END_TRY
- return -1;
+ }
+ H5E_END_TRY
+ return -1;
}
static int
init_test(hid_t file_id)
{
- const char* f_to_c = "(5/9.0)*(x-32)";
- /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */
- const char* utrans = "((x+100)/4)*3";
+ const char *f_to_c = "(5/9.0)*(x-32)";
+ /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit
+ * into uchar */
+ const char *utrans = "((x+100)/4)*3";
- hid_t dataspace = -1;
+ hid_t dataspace = -1;
hid_t dxpl_id_f_to_c = -1;
hid_t dxpl_id_utrans = -1;
- hid_t cparms = -1;
- hid_t filespace = -1;
- hsize_t dim[2] = { ROWS, COLS };
- hsize_t offset[2] = { 0, 0 };
+ hid_t cparms = -1;
+ hid_t filespace = -1;
+ hsize_t dim[2] = {ROWS, COLS};
+ hsize_t offset[2] = {0, 0};
- if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0)
TEST_ERROR
- if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0)
TEST_ERROR
- if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0)
+ if (H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0)
TEST_ERROR
- if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0)
+ if (H5Pset_data_transform(dxpl_id_utrans, utrans) < 0)
TEST_ERROR
cparms = H5Pcreate(H5P_DATASET_CREATE);
- if(H5Pset_chunk(cparms, 2, dim) < 0)
+ if (H5Pset_chunk(cparms, 2, dim) < 0)
TEST_ERROR
- if((dataspace = H5Screate_simple(2, dim, NULL)) < 0)
+ if ((dataspace = H5Screate_simple(2, dim, NULL)) < 0)
TEST_ERROR
TESTING("Intializing test...")
- if((dset_id_int = H5Dcreate2(file_id, "/default_int", H5T_NATIVE_INT,
- dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset_id_int = H5Dcreate2(file_id, "/default_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- dxpl_id_f_to_c, windchillFfloat) < 0)
+ if (H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0)
TEST_ERROR
- if((dset_id_float = H5Dcreate2(file_id, "/default_float",
- H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset_id_float = H5Dcreate2(file_id, "/default_float", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- dxpl_id_f_to_c, windchillFfloat) < 0)
+ if (H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0)
TEST_ERROR
- if((dset_id_int_chunk = H5Dcreate2(file_id, "/default_chunk_int",
- H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
+ if ((dset_id_int_chunk = H5Dcreate2(file_id, "/default_chunk_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
+ cparms, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(dset_id_int_chunk)) < 0)
+ if ((filespace = H5Dget_space(dset_id_int_chunk)) < 0)
TEST_ERROR
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace,
- dxpl_id_f_to_c, windchillFfloat) < 0)
+ if (H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) <
+ 0)
TEST_ERROR
- if((dset_id_float_chunk = H5Dcreate2(file_id, "/default_chunk_float",
- H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
+ if ((dset_id_float_chunk = H5Dcreate2(file_id, "/default_chunk_float", H5T_NATIVE_FLOAT, dataspace,
+ H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace,
- dxpl_id_f_to_c, windchillFfloat) < 0)
+ if (H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c,
+ windchillFfloat) < 0)
TEST_ERROR
- if(H5Pclose(cparms) < 0)
+ if (H5Pclose(cparms) < 0)
TEST_ERROR
- if(H5Pclose(dxpl_id_f_to_c) < 0)
+ if (H5Pclose(dxpl_id_f_to_c) < 0)
TEST_ERROR
- if(H5Pclose(dxpl_id_utrans) < 0)
+ if (H5Pclose(dxpl_id_utrans) < 0)
TEST_ERROR
- if(H5Sclose(dataspace) < 0)
+ if (H5Sclose(dataspace) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
PASSED();
@@ -442,13 +516,15 @@ init_test(hid_t file_id)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(cparms);
H5Pclose(dxpl_id_f_to_c);
H5Pclose(dxpl_id_utrans);
H5Sclose(dataspace);
H5Sclose(filespace);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return -1;
}
@@ -457,33 +533,31 @@ static int
test_poly(const hid_t dxpl_id_polynomial)
{
float polyflres[ROWS][COLS];
- int polyintread[ROWS][COLS];
+ int polyintread[ROWS][COLS];
float polyflread[ROWS][COLS];
- int windchillC;
- int row, col;
+ int windchillC;
+ int row, col;
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++) {
- windchillC = (int) ((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++) {
+ windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
polyflres[row][col] = ((2.0f + (float)windchillC) * (((float)windchillC - 8.0f) / 2.0f));
}
TESTING("data transform, polynomial transform (int->float)")
- if(H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- dxpl_id_polynomial, polyflread) < 0)
+ if (H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread) < 0)
TEST_ERROR
COMPARE(float, polyflread, polyflres, 2.0f)
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++) {
- windchillC = (int) ((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
- polyflres[row][col] = (float) ((2 + windchillC) * ((windchillC - 8) / 2));
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++) {
+ windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
+ polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2));
}
TESTING("data transform, polynomial transform (float->int)")
- if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl_id_polynomial, polyintread) < 0)
+ if (H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyintread) < 0)
TEST_ERROR
COMPARE(int, polyintread, polyflres, 4)
@@ -491,188 +565,181 @@ test_poly(const hid_t dxpl_id_polynomial)
return 0;
error:
- return -1;
+ return -1;
}
static int
test_specials(hid_t file)
{
- hid_t dxpl_id, dset_id, dataspace;
- hsize_t dim[2] = { ROWS, COLS };
- int read_buf[ROWS][COLS];
- int data_res[ROWS][COLS];
- int row, col;
- const char* special1 = "x*-100";
- const char* special2 = "100-x";
- const char* special3 = "1000/x";
- const char* special4 = "-x";
- const char* special5 = "+x";
+ hid_t dxpl_id, dset_id, dataspace;
+ hsize_t dim[2] = {ROWS, COLS};
+ int read_buf[ROWS][COLS];
+ int data_res[ROWS][COLS];
+ int row, col;
+ const char *special1 = "x*-100";
+ const char *special2 = "100-x";
+ const char *special3 = "1000/x";
+ const char *special4 = "-x";
+ const char *special5 = "+x";
TESTING("data transform of some special cases")
- if((dataspace = H5Screate_simple(2, dim, NULL)) < 0)
+ if ((dataspace = H5Screate_simple(2, dim, NULL)) < 0)
TEST_ERROR
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR;
/*-----------------------------
* Operation 1: x*-100
*----------------------------*/
- if(H5Pset_data_transform(dxpl_id, special1) < 0) TEST_ERROR;
+ if (H5Pset_data_transform(dxpl_id, special1) < 0)
+ TEST_ERROR;
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++)
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++)
data_res[row][col] = transformData[row][col] * -100;
- if((dset_id = H5Dcreate2(file, "/special1", H5T_NATIVE_INT,
- dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(file, "/special1", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl_id, transformData) < 0)
+ if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0)
TEST_ERROR
- if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, read_buf) < 0)
+ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0)
TEST_ERROR
COMPARE_INT(read_buf, data_res)
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
TEST_ERROR
/*-----------------------------
* Operation 2: 100-x
*----------------------------*/
- if(H5Pset_data_transform(dxpl_id, special2) < 0) TEST_ERROR;
+ if (H5Pset_data_transform(dxpl_id, special2) < 0)
+ TEST_ERROR;
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++)
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++)
data_res[row][col] = 100 - transformData[row][col];
- if((dset_id = H5Dcreate2(file, "/special2", H5T_NATIVE_INT,
- dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(file, "/special2", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl_id, transformData) < 0)
+ if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0)
TEST_ERROR
- if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, read_buf) < 0)
+ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0)
TEST_ERROR
COMPARE_INT(read_buf, data_res)
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
TEST_ERROR
/*-----------------------------
* Operation 3: 1000/x
*----------------------------*/
- if(H5Pset_data_transform(dxpl_id, special3) < 0) TEST_ERROR;
+ if (H5Pset_data_transform(dxpl_id, special3) < 0)
+ TEST_ERROR;
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++)
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++)
data_res[row][col] = 1000 / transformData[row][col];
- if((dset_id = H5Dcreate2(file, "/special3", H5T_NATIVE_INT,
- dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(file, "/special3", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl_id, transformData) < 0)
+ if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0)
TEST_ERROR
- if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, read_buf) < 0)
+ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0)
TEST_ERROR
COMPARE_INT(read_buf, data_res)
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
TEST_ERROR
/*-----------------------------
* Operation 4: -x
*----------------------------*/
- if(H5Pset_data_transform(dxpl_id, special4) < 0) TEST_ERROR;
+ if (H5Pset_data_transform(dxpl_id, special4) < 0)
+ TEST_ERROR;
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++)
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++)
data_res[row][col] = -1 * transformData[row][col];
- if((dset_id = H5Dcreate2(file, "/special4", H5T_NATIVE_INT,
- dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(file, "/special4", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl_id, transformData) < 0)
+ if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0)
TEST_ERROR
- if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, read_buf) < 0)
+ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0)
TEST_ERROR
COMPARE_INT(read_buf, data_res)
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
TEST_ERROR
/*-----------------------------
* Operation 5: +x
*----------------------------*/
- if(H5Pset_data_transform(dxpl_id, special5) < 0) TEST_ERROR;
+ if (H5Pset_data_transform(dxpl_id, special5) < 0)
+ TEST_ERROR;
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++)
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++)
data_res[row][col] = transformData[row][col];
- if((dset_id = H5Dcreate2(file, "/special5", H5T_NATIVE_INT,
- dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(file, "/special5", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl_id, transformData) < 0)
+ if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0)
TEST_ERROR
- if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, read_buf) < 0)
+ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0)
TEST_ERROR
COMPARE_INT(read_buf, data_res)
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
TEST_ERROR
-
- if(H5Pclose(dxpl_id) < 0)
+ if (H5Pclose(dxpl_id) < 0)
TEST_ERROR
- if(H5Sclose(dataspace) < 0)
+ if (H5Sclose(dataspace) < 0)
TEST_ERROR
PASSED();
return 0;
error:
- return -1;
+ return -1;
}
static int
test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy)
{
- int windchillC;
+ int windchillC;
float polyflres[ROWS][COLS];
- int polyintread[ROWS][COLS];
- int windchillFintread[ROWS][COLS];
- int row, col;
-
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++) {
- windchillC = (int) ((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
- polyflres[row][col] = (float) ((2 + windchillC) * ((windchillC - 8) / 2));
+ int polyintread[ROWS][COLS];
+ int windchillFintread[ROWS][COLS];
+ int row, col;
+
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++) {
+ windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
+ polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2));
}
TESTING("data transform, linear transform w/ copied property")
- if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl_id_c_to_f_copy, windchillFintread) < 0)
+ if (H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f_copy, windchillFintread) < 0)
TEST_ERROR
COMPARE(int, windchillFintread, windchillFfloat, 2)
TESTING("data transform, polynomial transform w/ copied property")
- if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl_id_polynomial_copy, polyintread) < 0)
+ if (H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial_copy, polyintread) < 0)
TEST_ERROR
COMPARE(int, polyintread, polyflres, 2)
@@ -687,28 +754,26 @@ static int
test_trivial(const hid_t dxpl_id_simple)
{
float windchillFfloatread[ROWS][COLS];
- int windchillFintread[ROWS][COLS];
- int row, col;
+ int windchillFintread[ROWS][COLS];
+ int row, col;
TESTING("data transform, trivial transform, without type conversion")
- if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- dxpl_id_simple, windchillFfloatread) < 0)
+ if (H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFfloatread) < 0)
TEST_ERROR
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++) {
- if((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL)
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++) {
+ if ((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL)
FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n");
}
PASSED();
TESTING("data transform, trivial transform, with type conversion")
- if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl_id_simple, windchillFintread) < 0)
+ if (H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFintread) < 0)
TEST_ERROR
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++) {
- if(windchillFintread[row][col] != 4)
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++) {
+ if (windchillFintread[row][col] != 4)
FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n")
}
@@ -725,18 +790,18 @@ test_getset(const hid_t dxpl_id_c_to_f)
int row;
int col;
float windchillFfloatread[ROWS][COLS];
- const char *simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
- const char *c_to_f = "(9/5.0)*x + 32";
- char *ptrgetTest = NULL;
+ const char *simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
+ const char *c_to_f = "(9/5.0)*x + 32";
+ char * ptrgetTest = NULL;
TESTING("H5Pget_data_transform")
- if(NULL == (ptrgetTest = (char *)HDmalloc(HDstrlen(simple) + 1)))
+ if (NULL == (ptrgetTest = (char *)HDmalloc(HDstrlen(simple) + 1)))
TEST_ERROR
- if(H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(c_to_f) + 1) < 0)
+ if (H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(c_to_f) + 1) < 0)
TEST_ERROR
- if(HDstrcmp(c_to_f, ptrgetTest) != 0)
+ if (HDstrcmp(c_to_f, ptrgetTest) != 0)
FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n")
PASSED();
@@ -746,16 +811,15 @@ test_getset(const hid_t dxpl_id_c_to_f)
TESTING("data transform, read after resetting of transform property")
- if(H5Pset_data_transform(dxpl_id_c_to_f, simple) < 0)
+ if (H5Pset_data_transform(dxpl_id_c_to_f, simple) < 0)
TEST_ERROR
- if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- dxpl_id_c_to_f, windchillFfloatread) < 0)
+ if (H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread) < 0)
TEST_ERROR
- for(row = 0; row < ROWS; row++)
- for(col = 0; col < COLS; col++) {
- if((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL)
+ for (row = 0; row < ROWS; row++)
+ for (col = 0; col < COLS; col++) {
+ if ((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL)
FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n")
}
@@ -763,11 +827,11 @@ test_getset(const hid_t dxpl_id_c_to_f)
TESTING("H5Pget_data_transform, after resetting transform property")
- if(NULL == (ptrgetTest = (char *)HDcalloc((size_t)1, HDstrlen(simple) + 1)))
+ if (NULL == (ptrgetTest = (char *)HDcalloc((size_t)1, HDstrlen(simple) + 1)))
TEST_ERROR
- if(H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(simple) + 1) < 0)
+ if (H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(simple) + 1) < 0)
TEST_ERROR
- if(HDstrcmp(simple, ptrgetTest) != 0)
+ if (HDstrcmp(simple, ptrgetTest) != 0)
FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n")
PASSED();
@@ -778,7 +842,7 @@ test_getset(const hid_t dxpl_id_c_to_f)
return 0;
error:
- if(ptrgetTest)
+ if (ptrgetTest)
HDfree(ptrgetTest);
return -1;
@@ -787,17 +851,17 @@ error:
static int
test_set(void)
{
- hid_t dxpl_id = -1;
+ hid_t dxpl_id = -1;
H5E_auto2_t func;
- const char *str = "(9/5.0)*x + 32";
- char *ptrgetTest = NULL;
+ const char *str = "(9/5.0)*x + 32";
+ char * ptrgetTest = NULL;
TESTING("H5Pget_data_transform (get before set)")
- if(NULL == (ptrgetTest = (char *)HDmalloc(HDstrlen(str) + 1)))
+ if (NULL == (ptrgetTest = (char *)HDmalloc(HDstrlen(str) + 1)))
TEST_ERROR
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
TEST_ERROR
/* Test get before set */
@@ -805,7 +869,7 @@ test_set(void)
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
- if(H5Pget_data_transform(dxpl_id, ptrgetTest, HDstrlen(str) + 1) < 0)
+ if (H5Pget_data_transform(dxpl_id, ptrgetTest, HDstrlen(str) + 1) < 0)
PASSED();
else
FAIL_PUTS_ERROR(" ERROR: Data transform get before set succeeded (it shouldn't have)\n");
@@ -842,18 +906,16 @@ test_set(void)
H5Eset_auto2(H5E_DEFAULT, func, NULL);
- if(H5Pclose(dxpl_id) < 0)
+ if (H5Pclose(dxpl_id) < 0)
TEST_ERROR
return 0;
error:
- if(ptrgetTest)
+ if (ptrgetTest)
HDfree(ptrgetTest);
- H5E_BEGIN_TRY {
- H5Pclose(dxpl_id);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { H5Pclose(dxpl_id); }
+ H5E_END_TRY
return -1;
}
-
diff --git a/test/dtypes.c b/test/dtypes.c
index e96e826..bb9bb2e 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -20,19 +20,19 @@
#include "testhdf5.h"
#include "H5srcdir.h"
-#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
+#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
/* Number of elements in each test */
-#define NTESTELEM 100000
+#define NTESTELEM 100000
/* For test_compound_8 and test_compound_10 */
-#define ARRAY_DIM 4
+#define ARRAY_DIM 4
/*
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
*/
-#define ALIGNMENT 1
+#define ALIGNMENT 1
/*
* Define if you want to test alignment code on a machine that doesn't
@@ -43,103 +43,93 @@
/* Alignment test stuff */
#ifdef TEST_ALIGNMENT
-#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h"
#endif
/* Use in version bound test */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
/* Use in version bound test */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
-#include "H5Opkg.h" /* Object headers */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#include "H5Opkg.h" /* Object headers */
-#define SET_ALIGNMENT(TYPE,VAL) \
- H5T_NATIVE_##TYPE##_ALIGN_g=MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL)
+#define SET_ALIGNMENT(TYPE, VAL) H5T_NATIVE_##TYPE##_ALIGN_g = MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL)
/*
* Macro for checking that the correct number of datatype ids are present. Be
* careful as the call to H5Tunregister removes *ALL* compound conversions from
* the soft conversion list. One must call reset_hdf5() after this.
*/
-#define CHECK_NMEMBS(NMEMBS,SRC_ID,DST_ID) \
- if(H5Tunregister(H5T_PERS_SOFT, NULL, SRC_ID, DST_ID, NULL) < 0) \
- FAIL_STACK_ERROR \
- if(H5Tclose(SRC_ID) < 0 || ((SRC_ID) != (DST_ID) && H5Tclose(DST_ID) < 0)) \
- FAIL_STACK_ERROR \
- if((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \
- H5_FAILED(); \
- HDprintf(" #dtype ids expected: %lld; found: %lld\n", \
- (long long)NMEMBS, (long long)H5I_nmembers(H5I_DATATYPE)); \
- goto error; \
+#define CHECK_NMEMBS(NMEMBS, SRC_ID, DST_ID) \
+ if (H5Tunregister(H5T_PERS_SOFT, NULL, SRC_ID, DST_ID, NULL) < 0) \
+ FAIL_STACK_ERROR \
+ if (H5Tclose(SRC_ID) < 0 || ((SRC_ID) != (DST_ID) && H5Tclose(DST_ID) < 0)) \
+ FAIL_STACK_ERROR \
+ if ((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \
+ H5_FAILED(); \
+ HDprintf(" #dtype ids expected: %lld; found: %lld\n", (long long)NMEMBS, \
+ (long long)H5I_nmembers(H5I_DATATYPE)); \
+ goto error; \
}
-const char *FILENAME[] = {
- "dtypes0",
- "dtypes1",
- "dtypes2",
- "dtypes3",
- "dtypes4",
- "dtypes5",
- "dtypes6",
- "dtypes7",
- "dtypes8",
- "dtypes9",
- "dtypes10",
- NULL
-};
-
-#define TESTFILE "bad_compound.h5"
+const char *FILENAME[] = {"dtypes0", "dtypes1", "dtypes2", "dtypes3", "dtypes4", "dtypes5",
+ "dtypes6", "dtypes7", "dtypes8", "dtypes9", "dtypes10", NULL};
+
+#define TESTFILE "bad_compound.h5"
typedef struct complex_t {
- double re;
- double im;
+ double re;
+ double im;
} complex_t;
typedef enum dtype_t {
- INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
- INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, FLT_FLOAT, FLT_DOUBLE,
- FLT_LDOUBLE, OTHER
+ INT_SCHAR,
+ INT_UCHAR,
+ INT_SHORT,
+ INT_USHORT,
+ INT_INT,
+ INT_UINT,
+ INT_LONG,
+ INT_ULONG,
+ INT_LLONG,
+ INT_ULLONG,
+ FLT_FLOAT,
+ FLT_DOUBLE,
+ FLT_LDOUBLE,
+ OTHER
} dtype_t; /* This doesn't seem to be used anywhere... -BMR */
-typedef enum {
- E1_RED,
- E1_GREEN,
- E1_BLUE,
- E1_ORANGE,
- E1_YELLOW
-} color_t;
+typedef enum { E1_RED, E1_GREEN, E1_BLUE, E1_ORANGE, E1_YELLOW } color_t;
/* Constant for size of conversion buffer for int <-> float exception test */
-#define CONVERT_SIZE 4
+#define CONVERT_SIZE 4
/* Constants for compound_13 test */
-#define COMPOUND13_ARRAY_SIZE 256
-#define COMPOUND13_ATTR_NAME "attr"
+#define COMPOUND13_ARRAY_SIZE 256
+#define COMPOUND13_ATTR_NAME "attr"
/* Constants for delete_obj_named test */
-#define DEL_OBJ_NAMED_DATASET "/Dataset"
-#define DEL_OBJ_NAMED_NAMED_DTYPE "/Dtype"
-#define DEL_OBJ_NAMED_ATTRIBUTE "Attr"
+#define DEL_OBJ_NAMED_DATASET "/Dataset"
+#define DEL_OBJ_NAMED_NAMED_DTYPE "/Dtype"
+#define DEL_OBJ_NAMED_ATTRIBUTE "Attr"
/* Constant for testing conversion of UTF-8 characters */
-#define UTF8_DATASET "utf8"
-#define UTF8_DATASET2 "2nd_utf8"
-#define ASCII_DATASET "ascii"
-#define ASCII_DATASET2 "2nd_ascii"
+#define UTF8_DATASET "utf8"
+#define UTF8_DATASET2 "2nd_utf8"
+#define ASCII_DATASET "ascii"
+#define ASCII_DATASET2 "2nd_ascii"
/* Count opaque conversions */
static int num_opaque_conversions_g = 0;
-static int opaque_check(int tag_it);
-static herr_t convert_opaque(hid_t st, hid_t dt, H5T_cdata_t *cdata,
- size_t nelmts, size_t buf_stride, size_t bkg_stride, void *_buf,
- void *bkg, hid_t dset_xfer_plid);
-static int opaque_long(void);
-static int opaque_funcs(void);
-
+static int opaque_check(int tag_it);
+static herr_t convert_opaque(hid_t st, hid_t dt, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *_buf, void *bkg, hid_t dset_xfer_plid);
+static int opaque_long(void);
+static int opaque_funcs(void);
/*-------------------------------------------------------------------------
* Function: reset_hdf5
@@ -158,26 +148,24 @@ reset_hdf5(void)
{
h5_reset();
#ifdef TEST_ALIGNMENT
- SET_ALIGNMENT(SCHAR, H5_SIZEOF_CHAR);
- SET_ALIGNMENT(UCHAR, H5_SIZEOF_CHAR);
- SET_ALIGNMENT(SHORT, H5_SIZEOF_SHORT);
- SET_ALIGNMENT(USHORT, H5_SIZEOF_SHORT);
- SET_ALIGNMENT(INT, H5_SIZEOF_INT);
- SET_ALIGNMENT(UINT, H5_SIZEOF_INT);
- SET_ALIGNMENT(LONG, H5_SIZEOF_LONG);
- SET_ALIGNMENT(ULONG, H5_SIZEOF_LONG);
- SET_ALIGNMENT(LLONG, H5_SIZEOF_LONG_LONG);
- SET_ALIGNMENT(ULLONG, H5_SIZEOF_LONG_LONG);
- SET_ALIGNMENT(FLOAT, H5_SIZEOF_FLOAT);
- SET_ALIGNMENT(DOUBLE, H5_SIZEOF_DOUBLE);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+ SET_ALIGNMENT(SCHAR, H5_SIZEOF_CHAR);
+ SET_ALIGNMENT(UCHAR, H5_SIZEOF_CHAR);
+ SET_ALIGNMENT(SHORT, H5_SIZEOF_SHORT);
+ SET_ALIGNMENT(USHORT, H5_SIZEOF_SHORT);
+ SET_ALIGNMENT(INT, H5_SIZEOF_INT);
+ SET_ALIGNMENT(UINT, H5_SIZEOF_INT);
+ SET_ALIGNMENT(LONG, H5_SIZEOF_LONG);
+ SET_ALIGNMENT(ULONG, H5_SIZEOF_LONG);
+ SET_ALIGNMENT(LLONG, H5_SIZEOF_LONG_LONG);
+ SET_ALIGNMENT(ULLONG, H5_SIZEOF_LONG_LONG);
+ SET_ALIGNMENT(FLOAT, H5_SIZEOF_FLOAT);
+ SET_ALIGNMENT(DOUBLE, H5_SIZEOF_DOUBLE);
+#if H5_SIZEOF_LONG_DOUBLE != 0
SET_ALIGNMENT(LDOUBLE, H5_SIZEOF_LONG_DOUBLE);
#endif
#endif
-
}
-
/*-------------------------------------------------------------------------
* Function: test_classes
*
@@ -193,88 +181,111 @@ reset_hdf5(void)
static int
test_classes(void)
{
- struct complex { /* Struct with complex fields */
+ struct complex { /* Struct with complex fields */
hvl_t vl_c;
hvl_t vl_s;
};
- hid_t cmpd_id; /* Compound datatype */
- hid_t vlc_id; /* VL type of char */
- hid_t vls_id; /* VL string */
- hid_t memb_id; /* Compound member datatype */
- H5T_class_t memb_cls;
- H5T_class_t tcls;
- int nmembs;
- unsigned u;
+ hid_t cmpd_id; /* Compound datatype */
+ hid_t vlc_id; /* VL type of char */
+ hid_t vls_id; /* VL string */
+ hid_t memb_id; /* Compound member datatype */
+ H5T_class_t memb_cls;
+ H5T_class_t tcls;
+ int nmembs;
+ unsigned u;
TESTING("H5Tget_class()");
/*-------------------------------------------------------------
* Check class of some atomic types.
*-----------------------------------------------------------*/
- if((tcls = H5Tget_class(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5T_INTEGER != tcls) TEST_ERROR
+ if ((tcls = H5Tget_class(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5T_INTEGER != tcls)
+ TEST_ERROR
- if((tcls = H5Tget_class(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR
- if(H5T_FLOAT != tcls) TEST_ERROR
+ if ((tcls = H5Tget_class(H5T_NATIVE_DOUBLE)) < 0)
+ TEST_ERROR
+ if (H5T_FLOAT != tcls)
+ TEST_ERROR
/* Create a VL datatype of char. It should be a VL, not a string class. */
- if((vlc_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR
+ if ((vlc_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0)
+ TEST_ERROR
/* Make certain that the correct classes can be detected */
- if((tcls = H5Tget_class(vlc_id)) < 0) TEST_ERROR
- if(H5T_VLEN != tcls) TEST_ERROR
+ if ((tcls = H5Tget_class(vlc_id)) < 0)
+ TEST_ERROR
+ if (H5T_VLEN != tcls)
+ TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if(H5T_STRING == tcls) TEST_ERROR
+ if (H5T_STRING == tcls)
+ TEST_ERROR
/* Create a VL string. It should be a string, not a VL class. */
- if((vls_id = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if(H5Tset_size(vls_id, H5T_VARIABLE) < 0) TEST_ERROR;
+ if ((vls_id = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR
+ if (H5Tset_size(vls_id, H5T_VARIABLE) < 0)
+ TEST_ERROR;
/* Make certain that the correct classes can be detected */
- if((tcls = H5Tget_class(vls_id)) < 0) TEST_ERROR
- if(H5T_STRING != tcls) TEST_ERROR
+ if ((tcls = H5Tget_class(vls_id)) < 0)
+ TEST_ERROR
+ if (H5T_STRING != tcls)
+ TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if(H5T_VLEN == tcls) TEST_ERROR
+ if (H5T_VLEN == tcls)
+ TEST_ERROR
/*-------------------------------------------------------------
* Check class for member types of compound type.
*-----------------------------------------------------------*/
/* Create a compound datatype and insert some complex types */
- if((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0) TEST_ERROR
+ if ((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0)
+ TEST_ERROR
- if((nmembs = H5Tget_nmembers(cmpd_id)) < 0) TEST_ERROR
+ if ((nmembs = H5Tget_nmembers(cmpd_id)) < 0)
+ TEST_ERROR
- for(u = 0; u < (unsigned)nmembs; u++) {
+ for (u = 0; u < (unsigned)nmembs; u++) {
/* Get member type ID */
- if((memb_id = H5Tget_member_type(cmpd_id, u)) < 0) TEST_ERROR
+ if ((memb_id = H5Tget_member_type(cmpd_id, u)) < 0)
+ TEST_ERROR
/* Get member type class */
- if((memb_cls = H5Tget_member_class (cmpd_id, u)) < 0) TEST_ERROR
+ if ((memb_cls = H5Tget_member_class(cmpd_id, u)) < 0)
+ TEST_ERROR
/* Verify member class */
- if(H5Tdetect_class(memb_id, memb_cls) < 0) TEST_ERROR
+ if (H5Tdetect_class(memb_id, memb_cls) < 0)
+ TEST_ERROR
/* Close member type ID */
- if(H5Tclose(memb_id) < 0) TEST_ERROR
+ if (H5Tclose(memb_id) < 0)
+ TEST_ERROR
} /* end for */
/* Close datatypes */
- if(H5Tclose(cmpd_id) < 0) TEST_ERROR
- if(H5Tclose(vlc_id) < 0) TEST_ERROR
- if(H5Tclose(vls_id) < 0) TEST_ERROR
+ if (H5Tclose(cmpd_id) < 0)
+ TEST_ERROR
+ if (H5Tclose(vlc_id) < 0)
+ TEST_ERROR
+ if (H5Tclose(vls_id) < 0)
+ TEST_ERROR
PASSED();
return 0;
- error:
+error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_copy
*
@@ -290,32 +301,32 @@ test_classes(void)
static int
test_copy(void)
{
- hid_t a_copy;
- herr_t status;
+ hid_t a_copy;
+ herr_t status;
TESTING("H5Tcopy()");
- if ((a_copy = H5Tcopy(H5T_NATIVE_SHORT)) < 0) goto error;
- if (H5Tclose(a_copy) < 0) goto error;
+ if ((a_copy = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ goto error;
+ if (H5Tclose(a_copy) < 0)
+ goto error;
/* We should not be able to close a built-in byte */
- H5E_BEGIN_TRY {
- status = H5Tclose (H5T_NATIVE_SCHAR);
- } H5E_END_TRY;
- if (status>=0) {
+ H5E_BEGIN_TRY { status = H5Tclose(H5T_NATIVE_SCHAR); }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
- HDputs (" Should not be able to close a predefined type!");
+ HDputs(" Should not be able to close a predefined type!");
goto error;
}
PASSED();
return 0;
- error:
+error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_detect
*
@@ -338,29 +349,29 @@ test_copy(void)
static int
test_detect(void)
{
- struct atomic { /* Struct with atomic fields */
- int i;
- float f;
- char c;
+ struct atomic { /* Struct with atomic fields */
+ int i;
+ float f;
+ char c;
double d;
- short s;
+ short s;
};
- struct complex { /* Struct with complex fields */
+ struct complex { /* Struct with complex fields */
hobj_ref_t arr_r[3][3];
- int i;
- hvl_t vl_f;
- hvl_t vl_s;
- char c;
- short s;
+ int i;
+ hvl_t vl_f;
+ hvl_t vl_s;
+ char c;
+ short s;
};
- hid_t atom_cmpd_id; /* Atomic Compound datatype */
- hid_t atom_arr_id; /* Atomic Array datatype */
- hid_t atom_vlf_id; /* Atomic VL datatype of float */
- hid_t atom_vlc_id; /* Atomic VL datatype of char */
- hid_t atom_vls_id; /* Atomic VL string datatype */
- hid_t cplx_cmpd_id; /* Complex Compound datatype */
- unsigned rank = 2; /* Rank for array datatype */
- hsize_t dims[2] = {3,3}; /* Dimensions for array datatype */
+ hid_t atom_cmpd_id; /* Atomic Compound datatype */
+ hid_t atom_arr_id; /* Atomic Array datatype */
+ hid_t atom_vlf_id; /* Atomic VL datatype of float */
+ hid_t atom_vlc_id; /* Atomic VL datatype of char */
+ hid_t atom_vls_id; /* Atomic VL string datatype */
+ hid_t cplx_cmpd_id; /* Complex Compound datatype */
+ unsigned rank = 2; /* Rank for array datatype */
+ hsize_t dims[2] = {3, 3}; /* Dimensions for array datatype */
TESTING("H5Tdetect_class()");
@@ -368,121 +379,176 @@ test_detect(void)
* Test class of some atomic types.
*------------------------------------------------------------------------------*/
/* Native integers should be in the integer class */
- if(H5Tdetect_class(H5T_NATIVE_INT,H5T_INTEGER)!=TRUE) TEST_ERROR
+ if (H5Tdetect_class(H5T_NATIVE_INT, H5T_INTEGER) != TRUE)
+ TEST_ERROR
/* Native integers should _not_ be in other classes */
- if(H5Tdetect_class(H5T_NATIVE_INT,H5T_FLOAT)!=FALSE) TEST_ERROR
- if(H5Tdetect_class(H5T_NATIVE_INT,H5T_ARRAY)!=FALSE) TEST_ERROR
- if(H5Tdetect_class(H5T_NATIVE_INT,H5T_ENUM)!=FALSE) TEST_ERROR
+ if (H5Tdetect_class(H5T_NATIVE_INT, H5T_FLOAT) != FALSE)
+ TEST_ERROR
+ if (H5Tdetect_class(H5T_NATIVE_INT, H5T_ARRAY) != FALSE)
+ TEST_ERROR
+ if (H5Tdetect_class(H5T_NATIVE_INT, H5T_ENUM) != FALSE)
+ TEST_ERROR
/*--------------------------------------------------------------------------------
* Test class of a compound type with some atomic types as fields.
*------------------------------------------------------------------------------*/
/* Create a compound datatype and insert some atomic types */
- if ((atom_cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct atomic))) < 0) TEST_ERROR
- if (H5Tinsert(atom_cmpd_id, "i", HOFFSET(struct atomic, i), H5T_NATIVE_INT) < 0) TEST_ERROR
- if (H5Tinsert(atom_cmpd_id, "f", HOFFSET(struct atomic, f), H5T_NATIVE_FLOAT) < 0) TEST_ERROR
- if (H5Tinsert(atom_cmpd_id, "c", HOFFSET(struct atomic, c), H5T_NATIVE_CHAR) < 0) TEST_ERROR
- if (H5Tinsert(atom_cmpd_id, "d", HOFFSET(struct atomic, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
- if (H5Tinsert(atom_cmpd_id, "s", HOFFSET(struct atomic, s), H5T_NATIVE_SHORT) < 0) TEST_ERROR
+ if ((atom_cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct atomic))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(atom_cmpd_id, "i", HOFFSET(struct atomic, i), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(atom_cmpd_id, "f", HOFFSET(struct atomic, f), H5T_NATIVE_FLOAT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(atom_cmpd_id, "c", HOFFSET(struct atomic, c), H5T_NATIVE_CHAR) < 0)
+ TEST_ERROR
+ if (H5Tinsert(atom_cmpd_id, "d", HOFFSET(struct atomic, d), H5T_NATIVE_DOUBLE) < 0)
+ TEST_ERROR
+ if (H5Tinsert(atom_cmpd_id, "s", HOFFSET(struct atomic, s), H5T_NATIVE_SHORT) < 0)
+ TEST_ERROR
/* Make certain that the correct classes can be detected */
- if(H5Tdetect_class(atom_cmpd_id,H5T_COMPOUND)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(atom_cmpd_id,H5T_INTEGER)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(atom_cmpd_id,H5T_FLOAT)!=TRUE) TEST_ERROR
+ if (H5Tdetect_class(atom_cmpd_id, H5T_COMPOUND) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(atom_cmpd_id, H5T_INTEGER) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(atom_cmpd_id, H5T_FLOAT) != TRUE)
+ TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if(H5Tdetect_class(atom_cmpd_id,H5T_VLEN)!=FALSE) TEST_ERROR
+ if (H5Tdetect_class(atom_cmpd_id, H5T_VLEN) != FALSE)
+ TEST_ERROR
/*--------------------------------------------------------------------------------
* Test class of some complex types.
*------------------------------------------------------------------------------*/
/* Create an array datatype with an atomic base type */
- if((atom_arr_id = H5Tarray_create2(H5T_STD_REF_OBJ, rank, dims)) < 0) TEST_ERROR
+ if ((atom_arr_id = H5Tarray_create2(H5T_STD_REF_OBJ, rank, dims)) < 0)
+ TEST_ERROR
/* Make certain that the correct classes can be detected */
- if(H5Tdetect_class(atom_arr_id,H5T_ARRAY)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(atom_arr_id,H5T_REFERENCE)!=TRUE) TEST_ERROR
+ if (H5Tdetect_class(atom_arr_id, H5T_ARRAY) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(atom_arr_id, H5T_REFERENCE) != TRUE)
+ TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if(H5Tdetect_class(atom_arr_id,H5T_VLEN)!=FALSE) TEST_ERROR
- if(H5Tdetect_class(atom_arr_id,H5T_FLOAT)!=FALSE) TEST_ERROR
- if(H5Tdetect_class(atom_arr_id,H5T_INTEGER)!=FALSE) TEST_ERROR
+ if (H5Tdetect_class(atom_arr_id, H5T_VLEN) != FALSE)
+ TEST_ERROR
+ if (H5Tdetect_class(atom_arr_id, H5T_FLOAT) != FALSE)
+ TEST_ERROR
+ if (H5Tdetect_class(atom_arr_id, H5T_INTEGER) != FALSE)
+ TEST_ERROR
/* Create a VL datatype with an atomic base type of float*/
- if((atom_vlf_id=H5Tvlen_create(H5T_NATIVE_FLOAT)) < 0) TEST_ERROR
+ if ((atom_vlf_id = H5Tvlen_create(H5T_NATIVE_FLOAT)) < 0)
+ TEST_ERROR
/* Make certain that the correct classes can be detected */
- if(H5Tdetect_class(atom_vlf_id,H5T_VLEN)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(atom_vlf_id,H5T_FLOAT)!=TRUE) TEST_ERROR
+ if (H5Tdetect_class(atom_vlf_id, H5T_VLEN) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(atom_vlf_id, H5T_FLOAT) != TRUE)
+ TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if(H5Tdetect_class(atom_vlf_id,H5T_COMPOUND)!=FALSE) TEST_ERROR
- if(H5Tdetect_class(atom_vlf_id,H5T_INTEGER)!=FALSE) TEST_ERROR
+ if (H5Tdetect_class(atom_vlf_id, H5T_COMPOUND) != FALSE)
+ TEST_ERROR
+ if (H5Tdetect_class(atom_vlf_id, H5T_INTEGER) != FALSE)
+ TEST_ERROR
/* Create a VL datatype with an atomic base type of char. It should be a VL
* but not a string class. */
- if((atom_vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR
+ if ((atom_vlc_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0)
+ TEST_ERROR
/* Make certain that the correct classes can be detected */
- if(H5Tdetect_class(atom_vlc_id,H5T_VLEN)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(atom_vlc_id,H5T_INTEGER)!=TRUE) TEST_ERROR
+ if (H5Tdetect_class(atom_vlc_id, H5T_VLEN) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(atom_vlc_id, H5T_INTEGER) != TRUE)
+ TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if(H5Tdetect_class(atom_vlc_id,H5T_STRING)!=FALSE) TEST_ERROR
+ if (H5Tdetect_class(atom_vlc_id, H5T_STRING) != FALSE)
+ TEST_ERROR
/* Create a VL string. It should be a string, not a VL class. */
- if((atom_vls_id=H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if(H5Tset_size(atom_vls_id, H5T_VARIABLE) < 0) TEST_ERROR;
+ if ((atom_vls_id = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR
+ if (H5Tset_size(atom_vls_id, H5T_VARIABLE) < 0)
+ TEST_ERROR;
/* Make certain that the correct classes can be detected */
- if(H5Tdetect_class(atom_vls_id,H5T_STRING)!=TRUE) TEST_ERROR
+ if (H5Tdetect_class(atom_vls_id, H5T_STRING) != TRUE)
+ TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if(H5Tdetect_class(atom_vls_id,H5T_VLEN)!=FALSE) TEST_ERROR
+ if (H5Tdetect_class(atom_vls_id, H5T_VLEN) != FALSE)
+ TEST_ERROR
/*--------------------------------------------------------------------------------
* Test class of a compound type with some complex types as fields.
*------------------------------------------------------------------------------*/
/* Create a compound datatype and insert some complex types */
- if ((cplx_cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR
- if (H5Tinsert(cplx_cmpd_id, "arr_r", HOFFSET(struct complex, arr_r), atom_arr_id) < 0) TEST_ERROR
- if (H5Tinsert(cplx_cmpd_id, "i", HOFFSET(struct complex, i), H5T_NATIVE_INT) < 0) TEST_ERROR
- if (H5Tinsert(cplx_cmpd_id, "vl_f", HOFFSET(struct complex, vl_f), atom_vlf_id) < 0) TEST_ERROR
- if (H5Tinsert(cplx_cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), atom_vls_id) < 0) TEST_ERROR
- if (H5Tinsert(cplx_cmpd_id, "c", HOFFSET(struct complex, c), H5T_NATIVE_CHAR) < 0) TEST_ERROR
- if (H5Tinsert(cplx_cmpd_id, "s", HOFFSET(struct complex, s), H5T_NATIVE_SHORT) < 0) TEST_ERROR
+ if ((cplx_cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cplx_cmpd_id, "arr_r", HOFFSET(struct complex, arr_r), atom_arr_id) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cplx_cmpd_id, "i", HOFFSET(struct complex, i), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cplx_cmpd_id, "vl_f", HOFFSET(struct complex, vl_f), atom_vlf_id) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cplx_cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), atom_vls_id) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cplx_cmpd_id, "c", HOFFSET(struct complex, c), H5T_NATIVE_CHAR) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cplx_cmpd_id, "s", HOFFSET(struct complex, s), H5T_NATIVE_SHORT) < 0)
+ TEST_ERROR
/* Make certain that the correct classes can be detected */
- if(H5Tdetect_class(cplx_cmpd_id,H5T_COMPOUND)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(cplx_cmpd_id,H5T_ARRAY)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(cplx_cmpd_id,H5T_REFERENCE)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(cplx_cmpd_id,H5T_INTEGER)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(cplx_cmpd_id,H5T_FLOAT)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(cplx_cmpd_id,H5T_STRING)!=TRUE) TEST_ERROR
- if(H5Tdetect_class(cplx_cmpd_id,H5T_VLEN)!=TRUE) TEST_ERROR
+ if (H5Tdetect_class(cplx_cmpd_id, H5T_COMPOUND) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(cplx_cmpd_id, H5T_ARRAY) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(cplx_cmpd_id, H5T_REFERENCE) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(cplx_cmpd_id, H5T_INTEGER) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(cplx_cmpd_id, H5T_FLOAT) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(cplx_cmpd_id, H5T_STRING) != TRUE)
+ TEST_ERROR
+ if (H5Tdetect_class(cplx_cmpd_id, H5T_VLEN) != TRUE)
+ TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if(H5Tdetect_class(cplx_cmpd_id,H5T_TIME)!=FALSE) TEST_ERROR
- if(H5Tdetect_class(cplx_cmpd_id,H5T_ENUM)!=FALSE) TEST_ERROR
+ if (H5Tdetect_class(cplx_cmpd_id, H5T_TIME) != FALSE)
+ TEST_ERROR
+ if (H5Tdetect_class(cplx_cmpd_id, H5T_ENUM) != FALSE)
+ TEST_ERROR
/* Close complex compound datatype */
- if(H5Tclose(cplx_cmpd_id) < 0) TEST_ERROR
+ if (H5Tclose(cplx_cmpd_id) < 0)
+ TEST_ERROR
/* Close atomic VL datatype of float */
- if(H5Tclose(atom_vlf_id) < 0) TEST_ERROR
+ if (H5Tclose(atom_vlf_id) < 0)
+ TEST_ERROR
/* Close atomic VL datatype of char */
- if(H5Tclose(atom_vlc_id) < 0) TEST_ERROR
+ if (H5Tclose(atom_vlc_id) < 0)
+ TEST_ERROR
/* Close atomic VL string datatype */
- if(H5Tclose(atom_vls_id) < 0) TEST_ERROR
+ if (H5Tclose(atom_vls_id) < 0)
+ TEST_ERROR
/* Close atomic array datatype */
- if(H5Tclose(atom_arr_id) < 0) TEST_ERROR
+ if (H5Tclose(atom_arr_id) < 0)
+ TEST_ERROR
/* Close atomic compound datatype */
- if(H5Tclose(atom_cmpd_id) < 0) TEST_ERROR
+ if (H5Tclose(atom_cmpd_id) < 0)
+ TEST_ERROR
PASSED();
return 0;
@@ -491,7 +557,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_1
*
@@ -507,18 +572,18 @@ error:
static int
test_compound_1(void)
{
- hid_t complex_id;
- hid_t super;
- size_t size;
- H5T_pad_t lsb, msb;
- H5T_cset_t cset;
- H5T_str_t strpad;
- H5T_order_t order;
- H5T_sign_t sign;
- char *tag = NULL;
- int offset;
- herr_t ret;
- int retval = 1;
+ hid_t complex_id;
+ hid_t super;
+ size_t size;
+ H5T_pad_t lsb, msb;
+ H5T_cset_t cset;
+ H5T_str_t strpad;
+ H5T_order_t order;
+ H5T_sign_t sign;
+ char * tag = NULL;
+ int offset;
+ herr_t ret;
+ int retval = 1;
TESTING("compound datatypes");
@@ -527,131 +592,117 @@ test_compound_1(void)
goto error;
/* Try to shrink and expand the size */
- if(H5Tset_size(complex_id, sizeof(double)) < 0)
+ if (H5Tset_size(complex_id, sizeof(double)) < 0)
goto error;
- if(H5Tset_size(complex_id, sizeof(complex_t)) < 0)
+ if (H5Tset_size(complex_id, sizeof(complex_t)) < 0)
goto error;
/* Attempt to add the new compound datatype as a field within itself */
- H5E_BEGIN_TRY {
- ret=H5Tinsert(complex_id, "compound", (size_t)0, complex_id);
- } H5E_END_TRY;
- if (ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tinsert(complex_id, "compound", (size_t)0, complex_id); }
+ H5E_END_TRY;
+ if (ret >= 0) {
FAIL_PUTS_ERROR("Inserted compound datatype into itself?");
} /* end if */
/* Add a couple fields */
- if(H5Tinsert(complex_id, "real", HOFFSET(complex_t, re), H5T_NATIVE_DOUBLE) < 0)
+ if (H5Tinsert(complex_id, "real", HOFFSET(complex_t, re), H5T_NATIVE_DOUBLE) < 0)
goto error;
- if(H5Tinsert(complex_id, "imaginary", HOFFSET(complex_t, im), H5T_NATIVE_DOUBLE) < 0)
+ if (H5Tinsert(complex_id, "imaginary", HOFFSET(complex_t, im), H5T_NATIVE_DOUBLE) < 0)
goto error;
/* Test some functions that aren't supposed to work for compound type */
/* Tries to shrink the size and trail the last member */
- H5E_BEGIN_TRY {
- ret=H5Tset_size(complex_id, sizeof(double));
- } H5E_END_TRY;
- if (ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_size(complex_id, sizeof(double)); }
+ H5E_END_TRY;
+ if (ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- size=H5Tget_precision(complex_id);
- } H5E_END_TRY;
- if (size>0) {
+ H5E_BEGIN_TRY { size = H5Tget_precision(complex_id); }
+ H5E_END_TRY;
+ if (size > 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
size = 128;
- H5E_BEGIN_TRY {
- ret = H5Tset_precision(complex_id, size);
- } H5E_END_TRY;
- if (ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_precision(complex_id, size); }
+ H5E_END_TRY;
+ if (ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- ret = H5Tget_pad(complex_id, &lsb, &msb);
- } H5E_END_TRY;
- if (ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tget_pad(complex_id, &lsb, &msb); }
+ H5E_END_TRY;
+ if (ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- size = H5Tget_ebias(complex_id);
- } H5E_END_TRY;
- if (size>0) {
+ H5E_BEGIN_TRY { size = H5Tget_ebias(complex_id); }
+ H5E_END_TRY;
+ if (size > 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- lsb = H5Tget_inpad(complex_id);
- } H5E_END_TRY;
- if (lsb>=0) {
+ H5E_BEGIN_TRY { lsb = H5Tget_inpad(complex_id); }
+ H5E_END_TRY;
+ if (lsb >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- cset = H5Tget_cset(complex_id);
- } H5E_END_TRY;
- if (cset>-1) {
+ H5E_BEGIN_TRY { cset = H5Tget_cset(complex_id); }
+ H5E_END_TRY;
+ if (cset > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- strpad = H5Tget_strpad(complex_id);
- } H5E_END_TRY;
- if (strpad>-1) {
+ H5E_BEGIN_TRY { strpad = H5Tget_strpad(complex_id); }
+ H5E_END_TRY;
+ if (strpad > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- offset = H5Tget_offset(complex_id);
- } H5E_END_TRY;
- if (offset>=0) {
+ H5E_BEGIN_TRY { offset = H5Tget_offset(complex_id); }
+ H5E_END_TRY;
+ if (offset >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
/* We started to support this function for compound type in 1.8.6 release. */
- if((order = H5Tget_order(complex_id)) == H5T_ORDER_ERROR)
+ if ((order = H5Tget_order(complex_id)) == H5T_ORDER_ERROR)
FAIL_PUTS_ERROR("Can't get order for compound type.");
- if(order != H5T_ORDER_LE && order != H5T_ORDER_BE)
+ if (order != H5T_ORDER_LE && order != H5T_ORDER_BE)
FAIL_PUTS_ERROR("Wrong order for this type.");
- H5E_BEGIN_TRY {
- sign = H5Tget_sign(complex_id);
- } H5E_END_TRY;
- if (sign>-1) {
+ H5E_BEGIN_TRY { sign = H5Tget_sign(complex_id); }
+ H5E_END_TRY;
+ if (sign > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- tag = H5Tget_tag(complex_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tag = H5Tget_tag(complex_id); }
+ H5E_END_TRY;
if (tag) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- super = H5Tget_super(complex_id);
- } H5E_END_TRY;
- if (super>=0) {
+ H5E_BEGIN_TRY { super = H5Tget_super(complex_id); }
+ H5E_END_TRY;
+ if (super >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- if (H5Tclose (complex_id) < 0)
+ if (H5Tclose(complex_id) < 0)
goto error;
PASSED();
retval = 0;
error:
- if(tag)
+ if (tag)
H5free_memory(tag);
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_2
*
@@ -671,18 +722,18 @@ test_compound_2(void)
{
struct st {
int a, b, c[4], d, e;
- } *s_ptr;
+ } * s_ptr;
struct dt {
int e, d, c[4], b, a;
- } *d_ptr;
+ } * d_ptr;
- const size_t nelmts = NTESTELEM;
- const hsize_t four = 4;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t st=-1, dt=-1;
- hid_t array_dt;
- int64_t nmembs;
- int i;
+ const size_t nelmts = NTESTELEM;
+ const hsize_t four = 4;
+ unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
+ hid_t st = -1, dt = -1;
+ hid_t array_dt;
+ int64_t nmembs;
+ int i;
TESTING("compound element reordering");
@@ -690,66 +741,60 @@ test_compound_2(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
- for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ for (i = 0; i < (int)nelmts; i++) {
+ s_ptr = ((struct st *)((void *)orig)) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ s_ptr->c[0] = i * 8 + 2;
+ s_ptr->c[1] = i * 8 + 3;
+ s_ptr->c[2] = i * 8 + 4;
+ s_ptr->c[3] = i * 8 + 5;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
- HDmemcpy(buf, orig, nelmts*sizeof(struct st));
+ HDmemcpy(buf, orig, nelmts * sizeof(struct st));
/* Build hdf5 datatypes */
- array_dt = H5Tarray_create2(H5T_NATIVE_INT,1, &four);
- if((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 ||
- H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 ||
- H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT) < 0)
+ array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
+ if ((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 ||
+ H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 ||
+ H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
- if((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 ||
- H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 ||
- H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0)
+ if ((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 ||
+ H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 ||
+ H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
/* Perform the conversion */
- if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT) < 0)
+ goto error;
/* Compare results */
- for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e) {
+ for (i = 0; i < (int)nelmts; i++) {
+ s_ptr = ((struct st *)((void *)orig)) + i;
+ d_ptr = ((struct dt *)((void *)buf)) + i;
+ if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) {
H5_FAILED();
HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->d, s_ptr->e);
- HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->d, d_ptr->e);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", s_ptr->a, s_ptr->b, s_ptr->c[0],
+ s_ptr->c[1], s_ptr->c[2], s_ptr->c[3], s_ptr->d, s_ptr->e);
+ HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", d_ptr->a, d_ptr->b, d_ptr->c[0],
+ d_ptr->c[1], d_ptr->c[2], d_ptr->c[3], d_ptr->d, d_ptr->e);
goto error;
}
}
@@ -758,7 +803,7 @@ test_compound_2(void)
HDfree(buf);
HDfree(bkg);
HDfree(orig);
- CHECK_NMEMBS(nmembs , st, dt)
+ CHECK_NMEMBS(nmembs, st, dt)
PASSED();
@@ -778,7 +823,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_3
*
@@ -798,16 +842,16 @@ test_compound_3(void)
{
struct st {
int a, b, c[4], d, e;
- } *s_ptr;
- struct dt {
- int a, c[4], e;
- } *d_ptr;
-
- const size_t nelmts = NTESTELEM;
- const hsize_t four = 4;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t st=-1, dt=-1;
- hid_t array_dt;
+ } * s_ptr;
+ struct dt {
+ int a, c[4], e;
+ } * d_ptr;
+
+ const size_t nelmts = NTESTELEM;
+ const hsize_t four = 4;
+ unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
+ hid_t st = -1, dt = -1;
+ hid_t array_dt;
int64_t nmembs;
int i;
@@ -817,38 +861,38 @@ test_compound_3(void)
FAIL_STACK_ERROR
/* Initialize */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
- for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ for (i = 0; i < (int)nelmts; i++) {
+ s_ptr = ((struct st *)((void *)orig)) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ s_ptr->c[0] = i * 8 + 2;
+ s_ptr->c[1] = i * 8 + 3;
+ s_ptr->c[2] = i * 8 + 4;
+ s_ptr->c[3] = i * 8 + 5;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
- HDmemcpy(buf, orig, nelmts*sizeof(struct st));
+ HDmemcpy(buf, orig, nelmts * sizeof(struct st));
/* Build hdf5 datatypes */
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
- if((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 ||
- H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 ||
- H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT) < 0)
+ if ((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 ||
+ H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 ||
+ H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
- if((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 ||
- H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 ||
- H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0)
+ if ((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 ||
+ H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 ||
+ H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
@@ -857,23 +901,17 @@ test_compound_3(void)
goto error;
/* Compare results */
- for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->e != d_ptr->e) {
+ for (i = 0; i < (int)nelmts; i++) {
+ s_ptr = ((struct st *)((void *)orig)) + i;
+ d_ptr = ((struct dt *)((void *)buf)) + i;
+ if (s_ptr->a != d_ptr->a || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] || s_ptr->e != d_ptr->e) {
H5_FAILED();
HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->d, s_ptr->e);
- HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
- d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->e);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", s_ptr->a, s_ptr->b, s_ptr->c[0],
+ s_ptr->c[1], s_ptr->c[2], s_ptr->c[3], s_ptr->d, s_ptr->e);
+ HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", d_ptr->a, d_ptr->c[0], d_ptr->c[1],
+ d_ptr->c[2], d_ptr->c[3], d_ptr->e);
goto error;
}
}
@@ -901,7 +939,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_4
*
@@ -922,19 +959,19 @@ test_compound_4(void)
struct st {
int a, b, c[4], d, e;
- } *s_ptr;
+ } * s_ptr;
struct dt {
short b;
- int a, c[4];
+ int a, c[4];
short d;
- int e;
- } *d_ptr;
-
- const size_t nelmts = NTESTELEM;
- const hsize_t four = 4;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t st=-1, dt=-1;
- hid_t array_dt;
+ int e;
+ } * d_ptr;
+
+ const size_t nelmts = NTESTELEM;
+ const hsize_t four = 4;
+ unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
+ hid_t st = -1, dt = -1;
+ hid_t array_dt;
int64_t nmembs;
int i;
@@ -944,40 +981,40 @@ test_compound_4(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
- for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = (i*8+1) & 0x7fff;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = (i*8+6) & 0x7fff;
- s_ptr->e = i*8+7;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ for (i = 0; i < (int)nelmts; i++) {
+ s_ptr = ((struct st *)((void *)orig)) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = (i * 8 + 1) & 0x7fff;
+ s_ptr->c[0] = i * 8 + 2;
+ s_ptr->c[1] = i * 8 + 3;
+ s_ptr->c[2] = i * 8 + 4;
+ s_ptr->c[3] = i * 8 + 5;
+ s_ptr->d = (i * 8 + 6) & 0x7fff;
+ s_ptr->e = i * 8 + 7;
}
- HDmemcpy(buf, orig, nelmts*sizeof(struct st));
+ HDmemcpy(buf, orig, nelmts * sizeof(struct st));
/* Build hdf5 datatypes */
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
- if((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 ||
- H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 ||
- H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT) < 0)
+ if ((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 ||
+ H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 ||
+ H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
- if((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 ||
- H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT) < 0 ||
- H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 ||
- H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_SHORT) < 0 ||
- H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0)
+ if ((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 ||
+ H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT) < 0 ||
+ H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 ||
+ H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_SHORT) < 0 ||
+ H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0)
goto error;
H5Tclose(array_dt);
@@ -986,25 +1023,18 @@ test_compound_4(void)
goto error;
/* Compare results */
- for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e) {
+ for (i = 0; i < (int)nelmts; i++) {
+ s_ptr = ((struct st *)((void *)orig)) + i;
+ d_ptr = ((struct dt *)((void *)buf)) + i;
+ if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) {
H5_FAILED();
HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->d, s_ptr->e);
- HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->d, d_ptr->e);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", s_ptr->a, s_ptr->b, s_ptr->c[0],
+ s_ptr->c[1], s_ptr->c[2], s_ptr->c[3], s_ptr->d, s_ptr->e);
+ HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", d_ptr->a, d_ptr->b, d_ptr->c[0],
+ d_ptr->c[1], d_ptr->c[2], d_ptr->c[3], d_ptr->d, d_ptr->e);
goto error;
}
}
@@ -1032,7 +1062,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_5
*
@@ -1052,38 +1081,37 @@ static int
test_compound_5(void)
{
typedef struct {
- char name[16];
- short tdim;
- short coll_ids[4];
+ char name[16];
+ short tdim;
+ short coll_ids[4];
} src_type_t;
typedef struct {
- char name[16];
- short tdim;
- int coll_ids[4];
+ char name[16];
+ short tdim;
+ int coll_ids[4];
} dst_type_t;
- hsize_t dims[1] = {4};
- hid_t src_type, dst_type, short_array, int_array, string;
- hid_t array_dt;
- src_type_t src[2] = {{"one", 102, {104, 105, 106, 107}},
- {"two", 202, {204, 205, 206, 207}}};
+ hsize_t dims[1] = {4};
+ hid_t src_type, dst_type, short_array, int_array, string;
+ hid_t array_dt;
+ src_type_t src[2] = {{"one", 102, {104, 105, 106, 107}}, {"two", 202, {204, 205, 206, 207}}};
- dst_type_t *dst;
- void *buf = HDcalloc((size_t)2, sizeof(dst_type_t));
- void *bkg = HDcalloc((size_t)2, sizeof(dst_type_t));
- int retval = 1;
+ dst_type_t *dst;
+ void * buf = HDcalloc((size_t)2, sizeof(dst_type_t));
+ void * bkg = HDcalloc((size_t)2, sizeof(dst_type_t));
+ int retval = 1;
TESTING("optimized struct converter");
/* Build datatypes */
- short_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(short));
- array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims);
+ short_array = H5Tcreate(H5T_COMPOUND, 4 * sizeof(short));
+ array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims);
H5Tinsert(short_array, "_", (size_t)0, array_dt);
H5Tclose(array_dt);
- int_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(int));
- array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, dims);
+ int_array = H5Tcreate(H5T_COMPOUND, 4 * sizeof(int));
+ array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, dims);
H5Tinsert(int_array, "_", (size_t)0, array_dt);
H5Tclose(array_dt);
@@ -1091,19 +1119,19 @@ test_compound_5(void)
H5Tset_size(string, (size_t)16);
src_type = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t));
- H5Tinsert(src_type, "name", HOFFSET(src_type_t, name), string );
- H5Tinsert(src_type, "tdim", HOFFSET(src_type_t, tdim), H5T_NATIVE_SHORT);
- H5Tinsert(src_type, "coll_ids", HOFFSET(src_type_t, coll_ids), short_array );
+ H5Tinsert(src_type, "name", HOFFSET(src_type_t, name), string);
+ H5Tinsert(src_type, "tdim", HOFFSET(src_type_t, tdim), H5T_NATIVE_SHORT);
+ H5Tinsert(src_type, "coll_ids", HOFFSET(src_type_t, coll_ids), short_array);
dst_type = H5Tcreate(H5T_COMPOUND, sizeof(dst_type_t));
- H5Tinsert(dst_type, "name", HOFFSET(dst_type_t, name), string );
- H5Tinsert(dst_type, "tdim", HOFFSET(dst_type_t, tdim), H5T_NATIVE_SHORT);
- H5Tinsert(dst_type, "coll_ids", HOFFSET(dst_type_t, coll_ids), int_array );
+ H5Tinsert(dst_type, "name", HOFFSET(dst_type_t, name), string);
+ H5Tinsert(dst_type, "tdim", HOFFSET(dst_type_t, tdim), H5T_NATIVE_SHORT);
+ H5Tinsert(dst_type, "coll_ids", HOFFSET(dst_type_t, coll_ids), int_array);
/* Convert data */
HDmemcpy(buf, src, sizeof(src));
H5Tconvert(src_type, dst_type, (size_t)2, buf, bkg, H5P_DEFAULT);
- dst = (dst_type_t*)buf;
+ dst = (dst_type_t *)buf;
/* Cleanup */
H5Tclose(src_type);
@@ -1112,15 +1140,10 @@ test_compound_5(void)
H5Tclose(short_array);
H5Tclose(int_array);
-
-
/* Check results */
- if (HDmemcmp(src[1].name, dst[1].name, sizeof(src[1].name)) ||
- src[1].tdim!=dst[1].tdim ||
- src[1].coll_ids[0]!=dst[1].coll_ids[0] ||
- src[1].coll_ids[1]!=dst[1].coll_ids[1] ||
- src[1].coll_ids[2]!=dst[1].coll_ids[2] ||
- src[1].coll_ids[3]!=dst[1].coll_ids[3]) {
+ if (HDmemcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || src[1].tdim != dst[1].tdim ||
+ src[1].coll_ids[0] != dst[1].coll_ids[0] || src[1].coll_ids[1] != dst[1].coll_ids[1] ||
+ src[1].coll_ids[2] != dst[1].coll_ids[2] || src[1].coll_ids[3] != dst[1].coll_ids[3]) {
H5_FAILED();
}
else {
@@ -1134,7 +1157,6 @@ test_compound_5(void)
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_6
*
@@ -1156,15 +1178,15 @@ test_compound_6(void)
struct st {
short b;
short d;
- } *s_ptr;
+ } * s_ptr;
struct dt {
long b;
long d;
- } *d_ptr;
+ } * d_ptr;
- const size_t nelmts = NTESTELEM;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t st=-1, dt=-1;
+ const size_t nelmts = NTESTELEM;
+ unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
+ hid_t st = -1, dt = -1;
int64_t nmembs;
int i;
@@ -1174,27 +1196,27 @@ test_compound_6(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
- for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- s_ptr->b = (int16_t)((i*8+1) & 0x7fff);
- s_ptr->d = (int16_t)((i*8+6) & 0x7fff);
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ for (i = 0; i < (int)nelmts; i++) {
+ s_ptr = ((struct st *)((void *)orig)) + i;
+ s_ptr->b = (int16_t)((i * 8 + 1) & 0x7fff);
+ s_ptr->d = (int16_t)((i * 8 + 6) & 0x7fff);
}
- HDmemcpy(buf, orig, nelmts*sizeof(struct st));
+ HDmemcpy(buf, orig, nelmts * sizeof(struct st));
/* Build hdf5 datatypes */
- if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 ||
- H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_SHORT) < 0 ||
- H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_SHORT) < 0) {
+ if ((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 ||
+ H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_SHORT) < 0 ||
+ H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_SHORT) < 0) {
H5_FAILED();
goto error;
}
- if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 ||
- H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_LONG) < 0 ||
- H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_LONG) < 0) {
+ if ((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 ||
+ H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_LONG) < 0 ||
+ H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_LONG) < 0) {
H5_FAILED();
goto error;
}
@@ -1206,17 +1228,14 @@ test_compound_6(void)
}
/* Compare results */
- for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->b != d_ptr->b ||
- s_ptr->d != d_ptr->d) {
+ for (i = 0; i < (int)nelmts; i++) {
+ s_ptr = ((struct st *)((void *)orig)) + i;
+ d_ptr = ((struct dt *)((void *)buf)) + i;
+ if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) {
H5_FAILED();
HDprintf(" i=%d\n", i);
- HDprintf(" src={b=%d, d=%d\n",
- (int)s_ptr->b, (int)s_ptr->d);
- HDprintf(" dst={b=%ld, d=%ld\n",
- d_ptr->b, d_ptr->d);
+ HDprintf(" src={b=%d, d=%d\n", (int)s_ptr->b, (int)s_ptr->d);
+ HDprintf(" dst={b=%ld, d=%ld\n", d_ptr->b, d_ptr->d);
goto error;
}
}
@@ -1268,99 +1287,97 @@ static int
test_compound_7(void)
{
struct s1 {
- int a;
+ int a;
float b;
- long c;
+ long c;
};
struct s2 {
- int a;
- float b;
- long c;
+ int a;
+ float b;
+ long c;
double d;
};
- hid_t tid1,tid2;
+ hid_t tid1, tid2;
herr_t ret;
TESTING("compound element insertion");
- if((tid1= H5Tcreate( H5T_COMPOUND, sizeof(struct s1))) < 0) {
+ if ((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) {
H5_FAILED();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_INT) < 0) {
+ if (H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'a'\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_FLOAT) < 0) {
+ if (H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'b'\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1,"c",HOFFSET(struct s1,c),H5T_NATIVE_LONG) < 0) {
+ if (H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'c'\n");
goto error;
} /* end if */
- if(H5Tget_size(tid1)!=sizeof(struct s1)) {
+ if (H5Tget_size(tid1) != sizeof(struct s1)) {
H5_FAILED();
HDprintf("Incorrect size for struct 1\n");
goto error;
} /* end if */
- if((tid2= H5Tcopy(tid1)) < 0) {
+ if ((tid2 = H5Tcopy(tid1)) < 0) {
H5_FAILED();
HDprintf("Can't copy datatype\n");
goto error;
} /* end if */
- if(H5Tget_size(tid2)==sizeof(struct s2)) {
+ if (H5Tget_size(tid2) == sizeof(struct s2)) {
H5_FAILED();
HDprintf("Incorrect size for struct 2\n");
goto error;
} /* end if */
/* Should not be able to insert field past end of compound datatype */
- H5E_BEGIN_TRY {
- ret=H5Tinsert(tid2,"d",HOFFSET(struct s2,d),H5T_NATIVE_DOUBLE);
- } H5E_END_TRY;
- if(ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tinsert(tid2, "d", HOFFSET(struct s2, d), H5T_NATIVE_DOUBLE); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
HDprintf("Inserted field 'd'?\n");
goto error;
} /* end if */
/* Should not be able to shrink size of compound datatype */
- H5E_BEGIN_TRY {
- ret=H5Tset_size(tid2, sizeof(struct s1)/2);
- } H5E_END_TRY;
- if(ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_size(tid2, sizeof(struct s1) / 2); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
HDprintf("Shrunk compound type?\n");
goto error;
} /* end if */
/* Increase compound type size and try inserting field again */
- if(H5Tset_size(tid2, sizeof(struct s2)) < 0) {
+ if (H5Tset_size(tid2, sizeof(struct s2)) < 0) {
H5_FAILED();
HDprintf("Can't increase size for compound type\n");
goto error;
} /* end if */
- if( H5Tinsert(tid2,"d",HOFFSET(struct s2,d),H5T_NATIVE_DOUBLE) < 0) {
+ if (H5Tinsert(tid2, "d", HOFFSET(struct s2, d), H5T_NATIVE_DOUBLE) < 0) {
H5_FAILED();
HDprintf("Can't expand compound datatype\n");
goto error;
} /* end if */
- if(H5Tget_size(tid2)!=sizeof(struct s2)) {
+ if (H5Tget_size(tid2) != sizeof(struct s2)) {
H5_FAILED();
HDprintf("Incorrect size for struct 2\n");
goto error;
@@ -1390,7 +1407,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_8
*
@@ -1414,18 +1430,18 @@ static int
test_compound_8(void)
{
typedef struct s1 {
- char a;
- int b;
+ char a;
+ int b;
} s1;
typedef struct s2 {
- char c;
- s1 d;
+ char c;
+ s1 d;
} s2;
- hid_t tid1, tid1_copy, tid2, tid2_copy, tid3, arr_tid;
- size_t tsize;
+ hid_t tid1, tid1_copy, tid2, tid2_copy, tid3, arr_tid;
+ size_t tsize;
hsize_t dims[1] = {ARRAY_DIM};
- herr_t ret;
+ herr_t ret;
TESTING("packing compound datatypes");
@@ -1433,60 +1449,69 @@ test_compound_8(void)
* Test H5Tpack for compound type
*/
/* Create first compound datatype */
- if((tid1 = H5Tcreate( H5T_COMPOUND, sizeof(struct s1))) < 0) {
- H5_FAILED(); AT();
+ if ((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_CHAR) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_CHAR) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'a'\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_INT) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_INT) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'b'\n");
goto error;
} /* end if */
/* Make a copy of the type for later use */
- if((tid1_copy = H5Tcopy(tid1)) < 0) {
- H5_FAILED(); AT();
+ if ((tid1_copy = H5Tcopy(tid1)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't copy type #1\n");
goto error;
} /* end if */
/* Test H5Tpack for the first compound type */
- if(H5Tpack(tid1) < 0) {
- H5_FAILED(); AT();
+ if (H5Tpack(tid1) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't pack the compound datatype\n");
goto error;
} /* end if */
- if(H5Tlock(tid1) < 0) {
- H5_FAILED(); AT();
+ if (H5Tlock(tid1) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't lock the compound datatype\n");
goto error;
} /* end if */
/* If the type is already packed, packing a locked type is OK */
- if(H5Tpack(tid1) < 0) {
- H5_FAILED(); AT();
+ if (H5Tpack(tid1) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't pack the compound datatype for second time\n");
goto error;
} /* end if */
/* Verify the size of packed compound type */
- if((tsize = H5Tget_size(tid1)) == 0) {
- H5_FAILED(); AT();
+ if ((tsize = H5Tget_size(tid1)) == 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't get size of the compound datatype\n");
goto error;
} /* end if */
- if(tsize != (sizeof(char) + sizeof(int))) {
- H5_FAILED(); AT();
+ if (tsize != (sizeof(char) + sizeof(int))) {
+ H5_FAILED();
+ AT();
HDprintf("The size of the packed compound datatype is incorrect\n");
goto error;
} /* end if */
@@ -1495,85 +1520,96 @@ test_compound_8(void)
* Test H5Tpack for nested compound type
*/
/* Create second compound datatype */
- if((tid2 = H5Tcreate( H5T_COMPOUND, sizeof(struct s2))) < 0) {
- H5_FAILED(); AT();
+ if ((tid2 = H5Tcreate(H5T_COMPOUND, sizeof(struct s2))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(tid2,"c",HOFFSET(struct s2,c),H5T_NATIVE_CHAR) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(tid2, "c", HOFFSET(struct s2, c), H5T_NATIVE_CHAR) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'c'\n");
goto error;
} /* end if */
/* Insert the member of unpacked compound type */
- if(H5Tinsert(tid2,"d",HOFFSET(struct s2,d),tid1_copy) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(tid2, "d", HOFFSET(struct s2, d), tid1_copy) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'd'\n");
goto error;
} /* end if */
/* Make a copy of the type for later */
- if((tid3=H5Tcopy(tid2)) < 0) {
- H5_FAILED(); AT();
+ if ((tid3 = H5Tcopy(tid2)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't copy type #2\n");
goto error;
} /* end if */
/* Make a copy of the type for later */
- if((tid2_copy = H5Tcopy(tid2)) < 0) {
- H5_FAILED(); AT();
+ if ((tid2_copy = H5Tcopy(tid2)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't copy type #2\n");
goto error;
} /* end if */
/* Test H5Tpack for the second compound type */
- if(H5Tpack(tid2) < 0) {
- H5_FAILED(); AT();
+ if (H5Tpack(tid2) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't pack the compound datatype\n");
goto error;
} /* end if */
- if(H5Tlock(tid2) < 0) {
- H5_FAILED(); AT();
+ if (H5Tlock(tid2) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't lock the compound datatype\n");
goto error;
} /* end if */
/* If the type is already packed, packing a locked type is OK */
- if(H5Tpack(tid2) < 0) {
- H5_FAILED(); AT();
+ if (H5Tpack(tid2) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't pack the compound datatype for second time\n");
goto error;
} /* end if */
/* Lock unpacked type */
- if(H5Tlock(tid3) < 0) {
- H5_FAILED(); AT();
+ if (H5Tlock(tid3) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't lock the compound datatype\n");
goto error;
} /* end if */
/* If the type is not packed, packing a locked type shouldn't work */
- H5E_BEGIN_TRY {
- ret=H5Tpack(tid3);
- } H5E_END_TRY;
- if(ret>=0) {
- H5_FAILED(); AT();
+ H5E_BEGIN_TRY { ret = H5Tpack(tid3); }
+ H5E_END_TRY;
+ if (ret >= 0) {
+ H5_FAILED();
+ AT();
HDprintf("Packing locked datatype worked?\n");
goto error;
} /* end if */
/* Verify the size of packed compound type */
- if((tsize = H5Tget_size(tid2)) == 0) {
- H5_FAILED(); AT();
+ if ((tsize = H5Tget_size(tid2)) == 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't get size of the compound datatype\n");
goto error;
} /* end if */
- if(tsize != (sizeof(char) + sizeof(char) + sizeof(int))) {
- H5_FAILED(); AT();
+ if (tsize != (sizeof(char) + sizeof(char) + sizeof(int))) {
+ H5_FAILED();
+ AT();
HDprintf("The size of the packed compound datatype is incorrect: tsize = %zu\n", tsize);
goto error;
} /* end if */
@@ -1582,47 +1618,53 @@ test_compound_8(void)
* Test H5Tpack for array type of nested compound type
*/
/* Create an array type of compound type */
- if((arr_tid = H5Tarray_create2(tid2_copy, 1, dims)) < 0) {
- H5_FAILED(); AT();
+ if ((arr_tid = H5Tarray_create2(tid2_copy, 1, dims)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create an array datatype\n");
goto error;
} /* end if */
/* Test H5Tpack for the array type */
- if(H5Tpack(arr_tid) < 0) {
- H5_FAILED(); AT();
+ if (H5Tpack(arr_tid) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't pack the array datatype\n");
goto error;
} /* end if */
/* Verify the size of packed compound type */
- if((tsize = H5Tget_size(arr_tid)) == 0) {
- H5_FAILED(); AT();
+ if ((tsize = H5Tget_size(arr_tid)) == 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't get size of the array datatype\n");
goto error;
} /* end if */
- if(tsize != ARRAY_DIM * (sizeof(char) + sizeof(char) + sizeof(int))) {
- H5_FAILED(); AT();
+ if (tsize != ARRAY_DIM * (sizeof(char) + sizeof(char) + sizeof(int))) {
+ H5_FAILED();
+ AT();
HDprintf("The size of the packed array datatype is incorrect\n");
goto error;
} /* end if */
-
- if(H5Tclose(tid1_copy) < 0) {
- H5_FAILED(); AT();
+ if (H5Tclose(tid1_copy) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't close the compound datatype\n");
goto error;
} /* end if */
- if(H5Tclose(tid2_copy) < 0) {
- H5_FAILED(); AT();
+ if (H5Tclose(tid2_copy) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't close the compound datatype\n");
goto error;
} /* end if */
- if(H5Tclose(arr_tid) < 0) {
- H5_FAILED(); AT();
+ if (H5Tclose(arr_tid) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't close the array datatype\n");
goto error;
} /* end if */
@@ -1632,11 +1674,10 @@ test_compound_8(void)
PASSED();
return 0;
- error:
+error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_9
*
@@ -1654,214 +1695,238 @@ static int
test_compound_9(void)
{
typedef struct cmpd_struct_w {
- int i1;
- const char* str;
- int i2;
+ int i1;
+ const char *str;
+ int i2;
} cmpd_struct_w;
typedef struct cmpd_struct_r {
- int i1;
- char* str;
- int i2;
+ int i1;
+ char *str;
+ int i2;
} cmpd_struct_r;
cmpd_struct_w wdata = {11, "variable-length string", 22};
cmpd_struct_r rdata;
- hid_t file;
- hid_t cmpd_tid, str_id, dup_tid;
- hid_t space_id;
- hid_t dset_id;
- hsize_t dim1[1];
- char filename[1024];
+ hid_t file;
+ hid_t cmpd_tid, str_id, dup_tid;
+ hid_t space_id;
+ hid_t dset_id;
+ hsize_t dim1[1];
+ char filename[1024];
TESTING("compound datatype with VL string");
/* Create File */
h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create file!\n");
goto error;
} /* end if */
/* Create first compound datatype */
- if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_w))) < 0) {
- H5_FAILED(); AT();
+ if ((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct_w))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct_w, i1), H5T_NATIVE_INT) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct_w, i1), H5T_NATIVE_INT) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'i1'\n");
goto error;
} /* end if */
str_id = H5Tcopy(H5T_C_S1);
- if(H5Tset_size(str_id,H5T_VARIABLE) < 0) {
- H5_FAILED(); AT();
+ if (H5Tset_size(str_id, H5T_VARIABLE) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't set size for VL string\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct_w, str), str_id) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct_w, str), str_id) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'i1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct_w, i2), H5T_NATIVE_INT) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct_w, i2), H5T_NATIVE_INT) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'i2'\n");
goto error;
} /* end if */
- if(H5Tcommit2(file, "compound", cmpd_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
- H5_FAILED(); AT();
+ if (H5Tcommit2(file, "compound", cmpd_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't commit datatype\n");
goto error;
} /* end if */
- if(H5Tclose(cmpd_tid) < 0) {
- H5_FAILED(); AT();
+ if (H5Tclose(cmpd_tid) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
- if((cmpd_tid = H5Topen2(file, "compound", H5P_DEFAULT)) < 0)
+ if ((cmpd_tid = H5Topen2(file, "compound", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((dup_tid = H5Tcopy(cmpd_tid)) < 0) {
- H5_FAILED(); AT();
+ if ((dup_tid = H5Tcopy(cmpd_tid)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't copy datatype\n");
goto error;
} /* end if */
dim1[0] = 1;
- if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) {
- H5_FAILED(); AT();
+ if ((space_id = H5Screate_simple(1, dim1, NULL)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create space\n");
goto error;
} /* end if */
- if((dset_id = H5Dcreate2(file, "Dataset", dup_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((dset_id = H5Dcreate2(file, "Dataset", dup_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create dataset\n");
goto error;
} /* end if */
- if(H5Dwrite(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Dwrite(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't write data\n");
goto error;
} /* end if */
- if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
- if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
- H5_FAILED(); AT();
+ if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
- if(H5Treclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Treclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
rdata.str = NULL;
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
goto error;
- if(H5Tclose(cmpd_tid) < 0)
+ if (H5Tclose(cmpd_tid) < 0)
goto error;
- if(H5Tclose(dup_tid) < 0)
+ if (H5Tclose(dup_tid) < 0)
goto error;
- if(H5Tclose(str_id) < 0)
+ if (H5Tclose(str_id) < 0)
goto error;
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
goto error;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
-
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("cannot open file\n");
goto error;
} /* end if */
- if((dset_id = H5Dopen2(file, "Dataset", H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((dset_id = H5Dopen2(file, "Dataset", H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("cannot open dataset\n");
goto error;
} /* end if */
- if((space_id = H5Dget_space(dset_id)) < 0) {
- H5_FAILED(); AT();
+ if ((space_id = H5Dget_space(dset_id)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't get space\n");
goto error;
} /* end if */
- if((cmpd_tid = H5Dget_type(dset_id)) < 0) {
- H5_FAILED(); AT();
+ if ((cmpd_tid = H5Dget_type(dset_id)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("cannot open dataset\n");
goto error;
} /* end if */
- if((dup_tid = H5Tcopy(cmpd_tid)) < 0) {
- H5_FAILED(); AT();
+ if ((dup_tid = H5Tcopy(cmpd_tid)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't copy datatype\n");
goto error;
} /* end if */
rdata.i1 = rdata.i2 = 0;
- if(rdata.str) HDfree(rdata.str);
+ if (rdata.str)
+ HDfree(rdata.str);
- if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
- if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || strcmp(rdata.str, wdata.str)) {
- H5_FAILED(); AT();
+ if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || strcmp(rdata.str, wdata.str)) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
- if(H5Treclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Treclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
rdata.str = NULL;
- if(rdata.str) HDfree(rdata.str);
+ if (rdata.str)
+ HDfree(rdata.str);
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
goto error;
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
goto error;
- if(H5Tclose(cmpd_tid) < 0)
+ if (H5Tclose(cmpd_tid) < 0)
goto error;
- if(H5Tclose(dup_tid) < 0)
+ if (H5Tclose(dup_tid) < 0)
goto error;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
PASSED();
return 0;
- error:
+error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_10
*
@@ -1882,10 +1947,10 @@ static int
test_compound_10(void)
{
typedef struct cmpd_struct {
- int i1;
- char* str;
- hvl_t text;
- int i2;
+ int i1;
+ char *str;
+ hvl_t text;
+ int i2;
} cmpd_struct;
cmpd_struct wdata[ARRAY_DIM];
@@ -1894,168 +1959,186 @@ test_compound_10(void)
hid_t arr_tid, cmpd_tid, cstr_id, vlstr_id;
hid_t space_id;
hid_t dset_id;
- hsize_t arr_dim[1] = {ARRAY_DIM}; /* Array dimensions */
+ hsize_t arr_dim[1] = {ARRAY_DIM}; /* Array dimensions */
hsize_t dim1[1];
- void *t1, *t2;
+ void * t1, *t2;
char filename[1024];
size_t len;
int i;
TESTING("array datatype of compound type with VL string");
- for(i=0; i<ARRAY_DIM; i++) {
- wdata[i].i1 = i*10+i;
- wdata[i].str = HDstrdup("C string A");
+ for (i = 0; i < ARRAY_DIM; i++) {
+ wdata[i].i1 = i * 10 + i;
+ wdata[i].str = HDstrdup("C string A");
wdata[i].str[9] = (char)(wdata[i].str[9] + i);
- wdata[i].i2 = i*1000+i*10;
+ wdata[i].i2 = i * 1000 + i * 10;
- wdata[i].text.p = (void*)HDstrdup("variable-length text A\0");
- len = wdata[i].text.len = HDstrlen((char*)wdata[i].text.p)+1;
+ wdata[i].text.p = (void *)HDstrdup("variable-length text A\0");
+ len = wdata[i].text.len = HDstrlen((char *)wdata[i].text.p) + 1;
((char *)(wdata[i].text.p))[len - 2] = (char)(((char *)(wdata[i].text.p))[len - 2] + i);
- ((char*)(wdata[i].text.p))[len-1] = '\0';
+ ((char *)(wdata[i].text.p))[len - 1] = '\0';
}
/* Create File */
h5_fixname(FILENAME[4], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create file!\n");
goto error;
} /* end if */
/* Create first compound datatype */
- if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) {
- H5_FAILED(); AT();
+ if ((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct, i1), H5T_NATIVE_INT) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'i1'\n");
goto error;
} /* end if */
cstr_id = H5Tcopy(H5T_C_S1);
- if(H5Tset_size(cstr_id,H5T_VARIABLE) < 0) {
- H5_FAILED(); AT();
+ if (H5Tset_size(cstr_id, H5T_VARIABLE) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't set size for C string\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid,"c_string",HOFFSET(cmpd_struct,str),cstr_id) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_tid, "c_string", HOFFSET(cmpd_struct, str), cstr_id) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'str'\n");
goto error;
} /* end if */
/* Create vl-string datatype */
- if((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) {
- H5_FAILED(); AT();
+ if ((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create VL string\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid, "vl_string",HOFFSET(cmpd_struct, text), vlstr_id) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct, text), vlstr_id) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'text'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_tid,"i2",HOFFSET(struct cmpd_struct,i2),H5T_NATIVE_INT) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'i2'\n");
goto error;
} /* end if */
/* Create the array datatype for c_string data */
- if((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0) {
- H5_FAILED(); AT();
+ if ((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create array type\n");
goto error;
} /* end if */
dim1[0] = 1;
- if((space_id = H5Screate_simple(1,dim1,NULL)) < 0) {
- H5_FAILED(); AT();
+ if ((space_id = H5Screate_simple(1, dim1, NULL)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create space\n");
goto error;
} /* end if */
- if((dset_id = H5Dcreate2(file, "Dataset", arr_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((dset_id = H5Dcreate2(file, "Dataset", arr_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create dataset\n");
goto error;
} /* end if */
- if(H5Dwrite(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Dwrite(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't write data\n");
goto error;
} /* end if */
- if(H5Dread(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Dread(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
- for(i = 0; i < ARRAY_DIM; i++) {
- if(rdata[i].i1 != wdata[i].i1 || rdata[i].i2 != wdata[i].i2 ||
+ for (i = 0; i < ARRAY_DIM; i++) {
+ if (rdata[i].i1 != wdata[i].i1 || rdata[i].i2 != wdata[i].i2 ||
HDstrcmp(rdata[i].str, wdata[i].str)) {
- H5_FAILED(); AT();
+ H5_FAILED();
+ AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
- if(rdata[i].text.len!=wdata[i].text.len) {
- H5_FAILED(); AT();
+ if (rdata[i].text.len != wdata[i].text.len) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect VL length\n");
goto error;
} /* end if */
t1 = rdata[i].text.p;
t2 = wdata[i].text.p;
- if(strcmp((char*)t1, (char*)t2)) {
- H5_FAILED(); AT();
+ if (strcmp((char *)t1, (char *)t2)) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect VL read data\n");
goto error;
}
} /* end for */
- if(H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
- if(H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
goto error;
- if(H5Tclose(arr_tid) < 0)
+ if (H5Tclose(arr_tid) < 0)
goto error;
- if(H5Tclose(cmpd_tid) < 0)
+ if (H5Tclose(cmpd_tid) < 0)
goto error;
- if(H5Tclose(cstr_id) < 0)
+ if (H5Tclose(cstr_id) < 0)
goto error;
- if(H5Tclose(vlstr_id) < 0)
+ if (H5Tclose(vlstr_id) < 0)
goto error;
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
goto error;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
PASSED();
return 0;
- error:
+error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_11
*
@@ -2079,61 +2162,77 @@ test_compound_11(void)
{
typedef struct {
double d1;
- int i1;
- char *s1;
- int i2;
+ int i1;
+ char * s1;
+ int i2;
double d2;
double d3;
} big_t;
typedef struct {
double d1;
- int i1;
- char *s1;
+ int i1;
+ char * s1;
} little_t;
- hid_t var_string_tid; /* Datatype IDs for type conversion */
- hid_t big_tid, little_tid; /* Datatype IDs for type conversion */
- hid_t big_tid2, little_tid2; /* Datatype IDs for type conversion */
- hid_t opaq_src_tid, opaq_dst_tid; /* Datatype IDs for type conversion */
- hid_t space_id; /* Dataspace for buffer elements */
- hsize_t dim[1]; /* Dimensions for dataspace */
- void *buf = NULL; /* Conversion buffer */
- void *buf_orig = NULL; /* Copy of original conversion buffer */
- void *bkg = NULL; /* Background buffer */
- size_t u; /* Local index variable */
- int retval = 1;
+ hid_t var_string_tid; /* Datatype IDs for type conversion */
+ hid_t big_tid, little_tid; /* Datatype IDs for type conversion */
+ hid_t big_tid2, little_tid2; /* Datatype IDs for type conversion */
+ hid_t opaq_src_tid, opaq_dst_tid; /* Datatype IDs for type conversion */
+ hid_t space_id; /* Dataspace for buffer elements */
+ hsize_t dim[1]; /* Dimensions for dataspace */
+ void * buf = NULL; /* Conversion buffer */
+ void * buf_orig = NULL; /* Copy of original conversion buffer */
+ void * bkg = NULL; /* Background buffer */
+ size_t u; /* Local index variable */
+ int retval = 1;
TESTING("registering type conversion routine with compound conversions");
/* Create variable string type for use in both structs */
- if((var_string_tid=H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if(H5Tset_size(var_string_tid,H5T_VARIABLE) < 0) TEST_ERROR
+ if ((var_string_tid = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR
+ if (H5Tset_size(var_string_tid, H5T_VARIABLE) < 0)
+ TEST_ERROR
/* Create type for 'big' struct */
- if((big_tid = H5Tcreate(H5T_COMPOUND, sizeof(big_t))) < 0) TEST_ERROR
+ if ((big_tid = H5Tcreate(H5T_COMPOUND, sizeof(big_t))) < 0)
+ TEST_ERROR
- if(H5Tinsert(big_tid, "d1", HOFFSET(big_t, d1), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
- if(H5Tinsert(big_tid, "i1", HOFFSET(big_t, i1), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(big_tid, "s1", HOFFSET(big_t, s1), var_string_tid) < 0) TEST_ERROR
- if(H5Tinsert(big_tid, "i2", HOFFSET(big_t, i2), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(big_tid, "d2", HOFFSET(big_t, d2), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
- if(H5Tinsert(big_tid, "d3", HOFFSET(big_t, d3), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
+ if (H5Tinsert(big_tid, "d1", HOFFSET(big_t, d1), H5T_NATIVE_DOUBLE) < 0)
+ TEST_ERROR
+ if (H5Tinsert(big_tid, "i1", HOFFSET(big_t, i1), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(big_tid, "s1", HOFFSET(big_t, s1), var_string_tid) < 0)
+ TEST_ERROR
+ if (H5Tinsert(big_tid, "i2", HOFFSET(big_t, i2), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(big_tid, "d2", HOFFSET(big_t, d2), H5T_NATIVE_DOUBLE) < 0)
+ TEST_ERROR
+ if (H5Tinsert(big_tid, "d3", HOFFSET(big_t, d3), H5T_NATIVE_DOUBLE) < 0)
+ TEST_ERROR
/* Create type for 'little' struct (with "out of order" inserts) */
- if((little_tid = H5Tcreate(H5T_COMPOUND, sizeof(little_t))) < 0) TEST_ERROR
+ if ((little_tid = H5Tcreate(H5T_COMPOUND, sizeof(little_t))) < 0)
+ TEST_ERROR
- if(H5Tinsert(little_tid, "d1", HOFFSET(little_t, d1), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
- if(H5Tinsert(little_tid, "s1", HOFFSET(little_t, s1), var_string_tid) < 0) TEST_ERROR
- if(H5Tinsert(little_tid, "i1", HOFFSET(little_t, i1), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (H5Tinsert(little_tid, "d1", HOFFSET(little_t, d1), H5T_NATIVE_DOUBLE) < 0)
+ TEST_ERROR
+ if (H5Tinsert(little_tid, "s1", HOFFSET(little_t, s1), var_string_tid) < 0)
+ TEST_ERROR
+ if (H5Tinsert(little_tid, "i1", HOFFSET(little_t, i1), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Allocate buffers */
- if((buf=HDmalloc(sizeof(big_t)*NTESTELEM))==NULL) TEST_ERROR
- if((buf_orig=HDmalloc(sizeof(big_t)*NTESTELEM))==NULL) TEST_ERROR
- if((bkg=HDmalloc(sizeof(big_t)*NTESTELEM))==NULL) TEST_ERROR
+ if ((buf = HDmalloc(sizeof(big_t) * NTESTELEM)) == NULL)
+ TEST_ERROR
+ if ((buf_orig = HDmalloc(sizeof(big_t) * NTESTELEM)) == NULL)
+ TEST_ERROR
+ if ((bkg = HDmalloc(sizeof(big_t) * NTESTELEM)) == NULL)
+ TEST_ERROR
/* Initialize buffer */
- for(u = 0; u < NTESTELEM; u++) {
+ for (u = 0; u < NTESTELEM; u++) {
((big_t *)buf)[u].d1 = (double)u * (double)1.5f;
((big_t *)buf)[u].d2 = (double)u * (double)2.5f;
((big_t *)buf)[u].d3 = (double)u * (double)3.5f;
@@ -2144,11 +2243,12 @@ test_compound_11(void)
} /* end for */
/* Make copy of buffer before conversion */
- HDmemcpy(buf_orig,buf,sizeof(big_t)*NTESTELEM);
+ HDmemcpy(buf_orig, buf, sizeof(big_t) * NTESTELEM);
dim[0] = NTESTELEM;
- if((space_id = H5Screate_simple(1, dim, NULL)) < 0) {
- H5_FAILED(); AT();
+ if ((space_id = H5Screate_simple(1, dim, NULL)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create space\n");
goto error;
} /* end if */
@@ -2156,149 +2256,170 @@ test_compound_11(void)
/* Make copies of the 'big' and 'little' datatypes, so the type
* conversion routine doesn't use the same ones this time and next time
*/
- if((big_tid2=H5Tcopy(big_tid)) < 0) TEST_ERROR
- if((little_tid2=H5Tcopy(little_tid)) < 0) TEST_ERROR
+ if ((big_tid2 = H5Tcopy(big_tid)) < 0)
+ TEST_ERROR
+ if ((little_tid2 = H5Tcopy(little_tid)) < 0)
+ TEST_ERROR
/* Convert buffer from 'big' to 'little' struct */
- if(H5Tconvert(big_tid2,little_tid2,(size_t)NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Tconvert(big_tid2, little_tid2, (size_t)NTESTELEM, buf, bkg, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify converted buffer is correct */
- for(u=0; u<NTESTELEM; u++) {
- if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
- HDprintf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1);
+ for (u = 0; u < NTESTELEM; u++) {
+ if (!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
+ HDprintf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].d1, (unsigned)u, ((little_t *)buf)[u].d1);
TEST_ERROR
} /* end if */
- if(((big_t *)buf_orig)[u].i1!=((little_t *)buf)[u].i1) {
- HDprintf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].i1,(unsigned)u,((little_t *)buf)[u].i1);
+ if (((big_t *)buf_orig)[u].i1 != ((little_t *)buf)[u].i1) {
+ HDprintf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].i1, (unsigned)u, ((little_t *)buf)[u].i1);
TEST_ERROR
} /* end if */
- if(((big_t *)buf_orig)[u].s1==NULL || ((little_t *)buf)[u].s1==NULL) {
- HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
+ if (((big_t *)buf_orig)[u].s1 == NULL || ((little_t *)buf)[u].s1 == NULL) {
+ HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- else if(HDstrcmp(((big_t *)buf_orig)[u].s1,((little_t *)buf)[u].s1)) {
- HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
+ else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1)) {
+ HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- } /* end for */
- if(H5Treclaim(little_tid2, space_id, H5P_DEFAULT, buf) < 0) {
- H5_FAILED(); AT();
+ } /* end for */
+ if (H5Treclaim(little_tid2, space_id, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim data\n");
goto error;
} /* end if */
/* Build source and destination types for conversion routine */
- if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
- if(H5Tset_tag(opaq_src_tid, "opaque source type") < 0) TEST_ERROR
- if((opaq_dst_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
- if(H5Tset_tag(opaq_dst_tid, "opaque destination type") < 0) TEST_ERROR
+ if ((opaq_src_tid = H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0)
+ TEST_ERROR
+ if (H5Tset_tag(opaq_src_tid, "opaque source type") < 0)
+ TEST_ERROR
+ if ((opaq_dst_tid = H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0)
+ TEST_ERROR
+ if (H5Tset_tag(opaq_dst_tid, "opaque destination type") < 0)
+ TEST_ERROR
/* Register new type conversion routine */
- if(H5Tregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0) TEST_ERROR
+ if (H5Tregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0)
+ TEST_ERROR
/* Recover the original buffer information */
- HDmemcpy(buf,buf_orig,sizeof(big_t)*NTESTELEM);
+ HDmemcpy(buf, buf_orig, sizeof(big_t) * NTESTELEM);
/* Convert buffer from 'big' to 'little' struct */
- if(H5Tconvert(big_tid,little_tid,(size_t)NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Tconvert(big_tid, little_tid, (size_t)NTESTELEM, buf, bkg, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify converted buffer is correct */
- for(u=0; u<NTESTELEM; u++) {
- if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
- HDprintf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1);
+ for (u = 0; u < NTESTELEM; u++) {
+ if (!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
+ HDprintf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].d1, (unsigned)u, ((little_t *)buf)[u].d1);
TEST_ERROR
} /* end if */
- if(((big_t *)buf_orig)[u].i1!=((little_t *)buf)[u].i1) {
- HDprintf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].i1,(unsigned)u,((little_t *)buf)[u].i1);
+ if (((big_t *)buf_orig)[u].i1 != ((little_t *)buf)[u].i1) {
+ HDprintf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].i1, (unsigned)u, ((little_t *)buf)[u].i1);
TEST_ERROR
} /* end if */
- if(((big_t *)buf_orig)[u].s1==NULL || ((little_t *)buf)[u].s1==NULL) {
- HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
+ if (((big_t *)buf_orig)[u].s1 == NULL || ((little_t *)buf)[u].s1 == NULL) {
+ HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- else if(HDstrcmp(((big_t *)buf_orig)[u].s1,((little_t *)buf)[u].s1)) {
- HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
+ else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1)) {
+ HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- } /* end for */
- if(H5Treclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
- H5_FAILED(); AT();
+ } /* end for */
+ if (H5Treclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim data\n");
goto error;
} /* end if */
/* Unregister the conversion routine */
- if(H5Tunregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0) TEST_ERROR
+ if (H5Tunregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0)
+ TEST_ERROR
/* Recover the original buffer information */
- HDmemcpy(buf,buf_orig,sizeof(big_t)*NTESTELEM);
+ HDmemcpy(buf, buf_orig, sizeof(big_t) * NTESTELEM);
/* Convert buffer from 'big' to 'little' struct */
- if(H5Tconvert(big_tid,little_tid,(size_t)NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Tconvert(big_tid, little_tid, (size_t)NTESTELEM, buf, bkg, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify converted buffer is correct */
- for(u=0; u<NTESTELEM; u++) {
- if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
- HDprintf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1);
+ for (u = 0; u < NTESTELEM; u++) {
+ if (!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
+ HDprintf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].d1, (unsigned)u, ((little_t *)buf)[u].d1);
TEST_ERROR
} /* end if */
- if(((big_t *)buf_orig)[u].i1!=((little_t *)buf)[u].i1) {
- HDprintf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].i1,(unsigned)u,((little_t *)buf)[u].i1);
+ if (((big_t *)buf_orig)[u].i1 != ((little_t *)buf)[u].i1) {
+ HDprintf("Error, line #%d: buf_orig[%u].i1=%d, buf[%u].i1=%d\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].i1, (unsigned)u, ((little_t *)buf)[u].i1);
TEST_ERROR
} /* end if */
- if(((big_t *)buf_orig)[u].s1==NULL || ((little_t *)buf)[u].s1==NULL) {
- HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
+ if (((big_t *)buf_orig)[u].s1 == NULL || ((little_t *)buf)[u].s1 == NULL) {
+ HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- else if(HDstrcmp(((big_t *)buf_orig)[u].s1,((little_t *)buf)[u].s1)) {
- HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n",__LINE__,
- (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
+ else if (HDstrcmp(((big_t *)buf_orig)[u].s1, ((little_t *)buf)[u].s1)) {
+ HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u,
+ ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- } /* end for */
- if(H5Treclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
- H5_FAILED(); AT();
+ } /* end for */
+ if (H5Treclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim data\n");
goto error;
} /* end if */
/* Free everything */
- for(u=0; u<NTESTELEM; u++)
+ for (u = 0; u < NTESTELEM; u++)
HDfree(((big_t *)buf_orig)[u].s1);
- if(H5Sclose(space_id) < 0) TEST_ERROR
- if(H5Tclose(opaq_dst_tid) < 0) TEST_ERROR
- if(H5Tclose(opaq_src_tid) < 0) TEST_ERROR
- if(H5Tclose(little_tid2) < 0) TEST_ERROR
- if(H5Tclose(big_tid2) < 0) TEST_ERROR
- if(H5Tclose(little_tid) < 0) TEST_ERROR
- if(H5Tclose(big_tid) < 0) TEST_ERROR
- if(H5Tclose(var_string_tid) < 0) TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (H5Tclose(opaq_dst_tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(opaq_src_tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(little_tid2) < 0)
+ TEST_ERROR
+ if (H5Tclose(big_tid2) < 0)
+ TEST_ERROR
+ if (H5Tclose(little_tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(big_tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(var_string_tid) < 0)
+ TEST_ERROR
PASSED();
retval = 0;
error:
- if(buf)
+ if (buf)
HDfree(buf);
- if(buf_orig)
+ if (buf_orig)
HDfree(buf_orig);
- if(bkg)
+ if (bkg)
HDfree(bkg);
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_12
*
@@ -2320,68 +2441,80 @@ error:
static int
test_compound_12(void)
{
- hid_t complex_id;
- size_t size = 0;
- size_t offset, new_size, tmp_size;
+ hid_t complex_id;
+ size_t size = 0;
+ size_t offset, new_size, tmp_size;
herr_t ret;
TESTING("adjust size of compound datatypes");
/* Create a compound type of minimal size */
- if ((complex_id = H5Tcreate(H5T_COMPOUND, (size_t)1)) < 0) goto error;
+ if ((complex_id = H5Tcreate(H5T_COMPOUND, (size_t)1)) < 0)
+ goto error;
/* Verify the size */
- if((new_size=H5Tget_size(complex_id))==0) goto error;
- if(new_size!=1) goto error;
+ if ((new_size = H5Tget_size(complex_id)) == 0)
+ goto error;
+ if (new_size != 1)
+ goto error;
/* Add a couple fields and adjust the size */
offset = size;
- if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
- size+=tmp_size;
- if (H5Tset_size(complex_id, size) < 0) goto error;
- if (H5Tinsert(complex_id, "real", offset,
- H5T_NATIVE_DOUBLE) < 0) goto error;
+ if ((tmp_size = H5Tget_size(H5T_NATIVE_DOUBLE)) == 0)
+ goto error;
+ size += tmp_size;
+ if (H5Tset_size(complex_id, size) < 0)
+ goto error;
+ if (H5Tinsert(complex_id, "real", offset, H5T_NATIVE_DOUBLE) < 0)
+ goto error;
offset = size;
- if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
- size+=tmp_size;
- if (H5Tset_size(complex_id, size) < 0) goto error;
- if (H5Tinsert(complex_id, "imaginary", offset,
- H5T_NATIVE_DOUBLE) < 0) goto error;
+ if ((tmp_size = H5Tget_size(H5T_NATIVE_DOUBLE)) == 0)
+ goto error;
+ size += tmp_size;
+ if (H5Tset_size(complex_id, size) < 0)
+ goto error;
+ if (H5Tinsert(complex_id, "imaginary", offset, H5T_NATIVE_DOUBLE) < 0)
+ goto error;
/* Increase and decrease the size. */
- if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
- size+=tmp_size;
- if (H5Tset_size(complex_id, size) < 0) goto error;
+ if ((tmp_size = H5Tget_size(H5T_NATIVE_DOUBLE)) == 0)
+ goto error;
+ size += tmp_size;
+ if (H5Tset_size(complex_id, size) < 0)
+ goto error;
- if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error;
- size-=tmp_size;
- if (H5Tset_size(complex_id, size) < 0) goto error;
+ if ((tmp_size = H5Tget_size(H5T_NATIVE_DOUBLE)) == 0)
+ goto error;
+ size -= tmp_size;
+ if (H5Tset_size(complex_id, size) < 0)
+ goto error;
/* Verify the size */
- if((new_size=H5Tget_size(complex_id))==0) goto error;
- if(new_size!=size) goto error;
+ if ((new_size = H5Tget_size(complex_id)) == 0)
+ goto error;
+ if (new_size != size)
+ goto error;
/* Tries to cut last member. Supposed to fail. */
size--;
- H5E_BEGIN_TRY {
- ret = H5Tset_size(complex_id, size);
- } H5E_END_TRY;
- if(ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_size(complex_id, size); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
puts(" Tries to cut off the last member. Should have failed.");
goto error;
}
- if (H5Tclose (complex_id) < 0) goto error;
+ if (H5Tclose(complex_id) < 0)
+ goto error;
PASSED();
return 0;
- error:
+error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_13
*
@@ -2403,78 +2536,110 @@ test_compound_13(void)
{
struct s1 {
unsigned char x[COMPOUND13_ARRAY_SIZE + 1];
- float y;
+ float y;
};
- struct s1 data_out, data_in;
- hid_t fileid, grpid, dtypeid, array1_tid, spaceid, attid;
- hid_t fapl_id;
- hsize_t dims[1] = {COMPOUND13_ARRAY_SIZE + 1};
- char filename[1024];
- unsigned u;
+ struct s1 data_out, data_in;
+ hid_t fileid, grpid, dtypeid, array1_tid, spaceid, attid;
+ hid_t fapl_id;
+ hsize_t dims[1] = {COMPOUND13_ARRAY_SIZE + 1};
+ char filename[1024];
+ unsigned u;
TESTING("compound datatypes of boundary size with latest format");
/* Create some phony data. */
HDmemset(&data_out, 0, sizeof(data_out));
- for(u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
+ for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
data_out.x[u] = (unsigned char)u;
data_out.y = 99.99f;
/* Set latest_format in access propertly list to enable the latest
* compound datatype format.
*/
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR
- if(H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
/* Open file and get root group. */
h5_fixname(FILENAME[4], H5P_DEFAULT, filename, sizeof filename);
- if((fileid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR
- if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fileid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ FAIL_STACK_ERROR
+ if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a compound type. */
- if((dtypeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) FAIL_STACK_ERROR
- if((array1_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, 1, dims)) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(dtypeid, "x", HOFFSET(struct s1, x), array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(dtypeid, "y", HOFFSET(struct s1, y), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
+ if ((dtypeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0)
+ FAIL_STACK_ERROR
+ if ((array1_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, 1, dims)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(dtypeid, "x", HOFFSET(struct s1, x), array1_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(dtypeid, "y", HOFFSET(struct s1, y), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create a space. */
- if((spaceid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
+ if ((spaceid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
/* Create an attribute of this compound type. */
- if((attid = H5Acreate2(grpid, COMPOUND13_ATTR_NAME, dtypeid, spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((attid = H5Acreate2(grpid, COMPOUND13_ATTR_NAME, dtypeid, spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write some data. */
- if(H5Awrite(attid, dtypeid, &data_out) < 0) FAIL_STACK_ERROR
+ if (H5Awrite(attid, dtypeid, &data_out) < 0)
+ FAIL_STACK_ERROR
/* Release all resources. */
- if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(dtypeid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(spaceid) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(fapl_id) < 0) FAIL_STACK_ERROR
+ if (H5Aclose(attid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(array1_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(dtypeid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(spaceid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grpid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fileid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(fapl_id) < 0)
+ FAIL_STACK_ERROR
/* Now open the file and read it. */
- if((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((attid = H5Aopen(grpid, COMPOUND13_ATTR_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((dtypeid = H5Aget_type(attid)) < 0) FAIL_STACK_ERROR
- if(H5Tget_class(dtypeid) != H5T_COMPOUND) FAIL_STACK_ERROR
- if(HOFFSET(struct s1, x) != H5Tget_member_offset(dtypeid, 0)) TEST_ERROR
- if(HOFFSET(struct s1, y) != H5Tget_member_offset(dtypeid, 1)) TEST_ERROR
- if(H5Aread(attid, dtypeid, &data_in) < 0) FAIL_STACK_ERROR
+ if ((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((attid = H5Aopen(grpid, COMPOUND13_ATTR_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((dtypeid = H5Aget_type(attid)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tget_class(dtypeid) != H5T_COMPOUND)
+ FAIL_STACK_ERROR
+ if (HOFFSET(struct s1, x) != H5Tget_member_offset(dtypeid, 0))
+ TEST_ERROR
+ if (HOFFSET(struct s1, y) != H5Tget_member_offset(dtypeid, 1))
+ TEST_ERROR
+ if (H5Aread(attid, dtypeid, &data_in) < 0)
+ FAIL_STACK_ERROR
/* Check the data. */
for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
- if(data_out.x[u] != data_in.x[u]) TEST_ERROR
- if(!H5_FLT_ABS_EQUAL(data_out.y, data_in.y)) TEST_ERROR
+ if (data_out.x[u] != data_in.x[u])
+ TEST_ERROR
+ if (!H5_FLT_ABS_EQUAL(data_out.y, data_in.y))
+ TEST_ERROR
/* Release all resources. */
- if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(dtypeid) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
+ if (H5Aclose(attid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(dtypeid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grpid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fileid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
@@ -2483,7 +2648,6 @@ error:
return 1;
} /* end test_compound_13() */
-
/*-------------------------------------------------------------------------
* Function: test_compound_14
*
@@ -2507,390 +2671,440 @@ static int
test_compound_14(void)
{
typedef struct cmpd_struct_1_w {
- char c1;
- char c2;
- const char* str;
+ char c1;
+ char c2;
+ const char *str;
} cmpd_struct_1_w;
typedef struct cmpd_struct_1_r {
- char c1;
- char c2;
- char* str;
+ char c1;
+ char c2;
+ char *str;
} cmpd_struct_1_r;
typedef struct cmpd_struct_2_w {
- char c1;
- char c2;
- const char* str;
- long l1;
- long l2;
- long l3;
- long l4;
+ char c1;
+ char c2;
+ const char *str;
+ long l1;
+ long l2;
+ long l3;
+ long l4;
} cmpd_struct_2_w;
typedef struct cmpd_struct_2_r {
- char c1;
- char c2;
- char* str;
- long l1;
- long l2;
- long l3;
- long l4;
+ char c1;
+ char c2;
+ char *str;
+ long l1;
+ long l2;
+ long l3;
+ long l4;
} cmpd_struct_2_r;
cmpd_struct_1_w wdata1 = {'A', 'B', "variable-length string"};
cmpd_struct_1_r rdata1;
cmpd_struct_2_w wdata2 = {'C', 'D', "another vlen!", 1, 2, -1, 9001};
cmpd_struct_2_r rdata2;
- hid_t file;
- hid_t cmpd_m1_tid, cmpd_f1_tid, cmpd_m2_tid, cmpd_f2_tid, str_id;
- hid_t space_id;
- hid_t dset1_id, dset2_id;
- hsize_t dim1[1];
- char filename[1024];
+ hid_t file;
+ hid_t cmpd_m1_tid, cmpd_f1_tid, cmpd_m2_tid, cmpd_f2_tid, str_id;
+ hid_t space_id;
+ hid_t dset1_id, dset2_id;
+ hsize_t dim1[1];
+ char filename[1024];
TESTING("unaligned VL strings in compound");
/* Create File */
h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create file!\n");
goto error;
} /* end if */
/* Create memory compound datatype 1 */
- if((cmpd_m1_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_1_w))) < 0) {
- H5_FAILED(); AT();
+ if ((cmpd_m1_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct_1_w))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m1_tid,"c1",HOFFSET(struct cmpd_struct_1_w, c1), H5T_NATIVE_CHAR) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m1_tid, "c1", HOFFSET(struct cmpd_struct_1_w, c1), H5T_NATIVE_CHAR) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m1_tid,"c2",HOFFSET(struct cmpd_struct_1_w, c2), H5T_NATIVE_CHAR) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m1_tid, "c2", HOFFSET(struct cmpd_struct_1_w, c2), H5T_NATIVE_CHAR) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'c2'\n");
goto error;
} /* end if */
str_id = H5Tcopy(H5T_C_S1);
- if(H5Tset_size(str_id,H5T_VARIABLE) < 0) {
- H5_FAILED(); AT();
+ if (H5Tset_size(str_id, H5T_VARIABLE) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't set size for VL string\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m1_tid, "vl_string", HOFFSET(cmpd_struct_1_w, str), str_id) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m1_tid, "vl_string", HOFFSET(cmpd_struct_1_w, str), str_id) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'vl_string'\n");
goto error;
} /* end if */
/* Create file compound datatype 1 */
- if((cmpd_f1_tid = H5Tcreate( H5T_COMPOUND, 8 + 1 + sizeof(hvl_t))) < 0) {
- H5_FAILED(); AT();
+ if ((cmpd_f1_tid = H5Tcreate(H5T_COMPOUND, 8 + 1 + sizeof(hvl_t))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f1_tid,"c1",(size_t)0,H5T_STD_I64BE) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f1_tid, "c1", (size_t)0, H5T_STD_I64BE) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f1_tid,"c2",(size_t)8,H5T_NATIVE_CHAR) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f1_tid, "c2", (size_t)8, H5T_NATIVE_CHAR) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'c2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f1_tid, "vl_string",(size_t)(8 + 1), str_id) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f1_tid, "vl_string", (size_t)(8 + 1), str_id) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'vl_string'\n");
goto error;
} /* end if */
/* Create memory compound datatype 2 */
- if((cmpd_m2_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_2_w))) < 0) {
- H5_FAILED(); AT();
+ if ((cmpd_m2_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct_2_w))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"c1",HOFFSET(struct cmpd_struct_2_w, c1), H5T_NATIVE_CHAR) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m2_tid, "c1", HOFFSET(struct cmpd_struct_2_w, c1), H5T_NATIVE_CHAR) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"c2",HOFFSET(struct cmpd_struct_2_w, c2), H5T_NATIVE_CHAR) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m2_tid, "c2", HOFFSET(struct cmpd_struct_2_w, c2), H5T_NATIVE_CHAR) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'c2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid, "vl_string", HOFFSET(cmpd_struct_2_w, str), str_id) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m2_tid, "vl_string", HOFFSET(cmpd_struct_2_w, str), str_id) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'vl_string'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"l1",HOFFSET(struct cmpd_struct_2_w, l1), H5T_NATIVE_LONG) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m2_tid, "l1", HOFFSET(struct cmpd_struct_2_w, l1), H5T_NATIVE_LONG) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'l1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"l2",HOFFSET(struct cmpd_struct_2_w, l2), H5T_NATIVE_LONG) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m2_tid, "l2", HOFFSET(struct cmpd_struct_2_w, l2), H5T_NATIVE_LONG) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'l2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"l3",HOFFSET(struct cmpd_struct_2_w, l3), H5T_NATIVE_LONG) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m2_tid, "l3", HOFFSET(struct cmpd_struct_2_w, l3), H5T_NATIVE_LONG) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'l3'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m2_tid,"l4",HOFFSET(struct cmpd_struct_2_w, l4), H5T_NATIVE_LONG) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m2_tid, "l4", HOFFSET(struct cmpd_struct_2_w, l4), H5T_NATIVE_LONG) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'l4'\n");
goto error;
} /* end if */
/* Create file compound datatype 2 */
- if((cmpd_f2_tid = H5Tcreate( H5T_COMPOUND, 8 + 1 + sizeof(hvl_t) + 4*sizeof(long))) < 0) {
- H5_FAILED(); AT();
+ if ((cmpd_f2_tid = H5Tcreate(H5T_COMPOUND, 8 + 1 + sizeof(hvl_t) + 4 * sizeof(long))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"c1",(size_t)0,H5T_STD_I64BE) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f2_tid, "c1", (size_t)0, H5T_STD_I64BE) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"c2",(size_t)8,H5T_NATIVE_CHAR) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f2_tid, "c2", (size_t)8, H5T_NATIVE_CHAR) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'c2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid, "vl_string", (size_t)(8 + 1), str_id) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f2_tid, "vl_string", (size_t)(8 + 1), str_id) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'vl_string'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"l1",8 + 1 + sizeof(hvl_t),H5T_NATIVE_LONG) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f2_tid, "l1", 8 + 1 + sizeof(hvl_t), H5T_NATIVE_LONG) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'l1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"l2",8 + 1 + sizeof(hvl_t) + sizeof(long),H5T_NATIVE_LONG) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f2_tid, "l2", 8 + 1 + sizeof(hvl_t) + sizeof(long), H5T_NATIVE_LONG) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'l2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"l3",8 + 1 + sizeof(hvl_t) + 2*sizeof(long),H5T_NATIVE_LONG) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f2_tid, "l3", 8 + 1 + sizeof(hvl_t) + 2 * sizeof(long), H5T_NATIVE_LONG) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'l3'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"l4",8 + 1 + sizeof(hvl_t) + 3*sizeof(long),H5T_NATIVE_LONG) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f2_tid, "l4", 8 + 1 + sizeof(hvl_t) + 3 * sizeof(long), H5T_NATIVE_LONG) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'l4'\n");
goto error;
} /* end if */
dim1[0] = 1;
- if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) {
- H5_FAILED(); AT();
+ if ((space_id = H5Screate_simple(1, dim1, NULL)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create space\n");
goto error;
} /* end if */
- if((dset1_id = H5Dcreate2(file, "Dataset1", cmpd_f1_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((dset1_id = H5Dcreate2(file, "Dataset1", cmpd_f1_tid, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create dataset\n");
goto error;
} /* end if */
- if((dset2_id = H5Dcreate2(file, "Dataset2", cmpd_f2_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((dset2_id = H5Dcreate2(file, "Dataset2", cmpd_f2_tid, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create dataset\n");
goto error;
} /* end if */
- if(H5Dwrite(dset1_id, cmpd_m1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata1) < 0) {
- H5_FAILED(); AT();
+ if (H5Dwrite(dset1_id, cmpd_m1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata1) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't write data\n");
goto error;
} /* end if */
- if(H5Dwrite(dset2_id, cmpd_m2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata2) < 0) {
- H5_FAILED(); AT();
+ if (H5Dwrite(dset2_id, cmpd_m2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata2) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't write data\n");
goto error;
} /* end if */
- if(H5Dread(dset1_id, cmpd_m1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata1) < 0) {
- H5_FAILED(); AT();
+ if (H5Dread(dset1_id, cmpd_m1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata1) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
- if(H5Dread(dset2_id, cmpd_m2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata2) < 0) {
- H5_FAILED(); AT();
+ if (H5Dread(dset2_id, cmpd_m2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata2) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
- if(rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str)) {
- H5_FAILED(); AT();
+ if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str)) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
- if(rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) ||
- rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 || rdata2.l4 != wdata2.l4) {
- H5_FAILED(); AT();
+ if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) ||
+ rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 ||
+ rdata2.l4 != wdata2.l4) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
- if(H5Treclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
- H5_FAILED(); AT();
+ if (H5Treclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
rdata1.str = NULL;
- if(H5Treclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
- H5_FAILED(); AT();
+ if (H5Treclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
rdata2.str = NULL;
- if(H5Dclose(dset1_id) < 0)
+ if (H5Dclose(dset1_id) < 0)
goto error;
- if(H5Dclose(dset2_id) < 0)
+ if (H5Dclose(dset2_id) < 0)
goto error;
- if(H5Tclose(cmpd_f1_tid) < 0)
+ if (H5Tclose(cmpd_f1_tid) < 0)
goto error;
- if(H5Tclose(cmpd_f2_tid) < 0)
+ if (H5Tclose(cmpd_f2_tid) < 0)
goto error;
- if(H5Tclose(str_id) < 0)
+ if (H5Tclose(str_id) < 0)
goto error;
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
goto error;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
-
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("cannot open file\n");
goto error;
} /* end if */
- if((dset1_id = H5Dopen2(file, "Dataset1", H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((dset1_id = H5Dopen2(file, "Dataset1", H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("cannot open dataset\n");
goto error;
} /* end if */
- if((dset2_id = H5Dopen2(file, "Dataset2", H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((dset2_id = H5Dopen2(file, "Dataset2", H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("cannot open dataset\n");
goto error;
} /* end if */
- if((space_id = H5Dget_space(dset2_id)) < 0) {
- H5_FAILED(); AT();
+ if ((space_id = H5Dget_space(dset2_id)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't get space\n");
goto error;
} /* end if */
rdata1.c1 = rdata1.c2 = 0;
- if(rdata1.str) HDfree(rdata1.str);
+ if (rdata1.str)
+ HDfree(rdata1.str);
rdata2.c1 = rdata2.c2 = 0;
rdata2.l1 = rdata2.l2 = rdata2.l3 = rdata2.l4 = 0;
- if(rdata2.str) {
+ if (rdata2.str) {
HDfree(rdata2.str);
rdata2.str = NULL;
} /* end if */
- if(H5Dread(dset1_id, cmpd_m1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata1) < 0) {
- H5_FAILED(); AT();
+ if (H5Dread(dset1_id, cmpd_m1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata1) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
- if(H5Dread(dset2_id, cmpd_m2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata2) < 0) {
- H5_FAILED(); AT();
+ if (H5Dread(dset2_id, cmpd_m2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata2) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
- if(rdata1.c1!=wdata1.c1 || rdata1.c2!=wdata1.c2 || strcmp(rdata1.str, wdata1.str)) {
- H5_FAILED(); AT();
+ if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || strcmp(rdata1.str, wdata1.str)) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
- if(rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) ||
- rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 || rdata2.l4 != wdata2.l4) {
- H5_FAILED(); AT();
+ if (rdata2.c1 != wdata2.c1 || rdata2.c2 != wdata2.c2 || HDstrcmp(rdata2.str, wdata2.str) ||
+ rdata2.l1 != wdata2.l1 || rdata2.l2 != wdata2.l2 || rdata2.l3 != wdata2.l3 ||
+ rdata2.l4 != wdata2.l4) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
- if(H5Treclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
- H5_FAILED(); AT();
+ if (H5Treclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
rdata1.str = NULL;
- if(H5Treclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
- H5_FAILED(); AT();
+ if (H5Treclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
rdata2.str = NULL;
- if(H5Dclose(dset1_id) < 0)
+ if (H5Dclose(dset1_id) < 0)
goto error;
- if(H5Dclose(dset2_id) < 0)
+ if (H5Dclose(dset2_id) < 0)
goto error;
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
goto error;
- if(H5Tclose(cmpd_m1_tid) < 0)
+ if (H5Tclose(cmpd_m1_tid) < 0)
goto error;
- if(H5Tclose(cmpd_m2_tid) < 0)
+ if (H5Tclose(cmpd_m2_tid) < 0)
goto error;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
PASSED();
return 0;
- error:
+error:
return 1;
} /* end test_compound_14() */
-
/*-------------------------------------------------------------------------
* Function: test_compound_15
*
@@ -2913,8 +3127,8 @@ static int
test_compound_15(void)
{
typedef struct cmpd_struct {
- int i1;
- int i2;
+ int i1;
+ int i2;
} cmpd_struct;
cmpd_struct wdata1 = {1254, 5471};
@@ -2931,82 +3145,95 @@ test_compound_15(void)
/* Create File */
h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create file!\n");
goto error;
} /* end if */
/* Create file compound datatype */
- if((cmpd_f_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) {
- H5_FAILED(); AT();
+ if ((cmpd_f_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f_tid, "i1", HOFFSET(struct cmpd_struct, i1), H5T_NATIVE_INT) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'i1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f_tid,"i2",HOFFSET(struct cmpd_struct,i2),H5T_NATIVE_INT) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_f_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'i2'\n");
goto error;
} /* end if */
/* Create memory compound datatype */
- if((cmpd_m_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) {
- H5_FAILED(); AT();
+ if ((cmpd_m_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m_tid,"i1",(size_t)0,H5T_NATIVE_INT) < 0) {
- H5_FAILED(); AT();
+ if (H5Tinsert(cmpd_m_tid, "i1", (size_t)0, H5T_NATIVE_INT) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't insert field 'i1'\n");
goto error;
} /* end if */
/* Create space, dataset, write wdata1 */
dim1[0] = 1;
- if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) {
- H5_FAILED(); AT();
+ if ((space_id = H5Screate_simple(1, dim1, NULL)) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create space\n");
goto error;
} /* end if */
- if((dset_id = H5Dcreate2(file, "Dataset", cmpd_f_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED(); AT();
+ if ((dset_id = H5Dcreate2(file, "Dataset", cmpd_f_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't create dataset\n");
goto error;
} /* end if */
- if(H5Dwrite(dset_id, cmpd_f_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata1) < 0) {
- H5_FAILED(); AT();
+ if (H5Dwrite(dset_id, cmpd_f_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata1) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't write data\n");
goto error;
} /* end if */
/* Write wdata2. The use of cmpd_m_tid here should cause only the first
* element of wdata2 to be written. */
- if(H5Dwrite(dset_id, cmpd_m_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata2) < 0) {
- H5_FAILED(); AT();
+ if (H5Dwrite(dset_id, cmpd_m_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata2) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't write data\n");
goto error;
} /* end if */
/* Read data */
- if(H5Dread(dset_id, cmpd_f_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Dread(dset_id, cmpd_f_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
/* Check for correctness of read data */
- if(rdata.i1 != wdata2[0] || rdata.i2 != wdata1.i2) {
- H5_FAILED(); AT();
+ if (rdata.i1 != wdata2[0] || rdata.i2 != wdata1.i2) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
@@ -3017,39 +3244,40 @@ test_compound_15(void)
rdata.i2 = wdata2[1];
/* Read data */
- if(H5Dread(dset_id, cmpd_m_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
+ if (H5Dread(dset_id, cmpd_m_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED();
+ AT();
HDprintf("Can't read data\n");
goto error;
} /* end if */
/* Check for correctness of read data */
- if(rdata.i1 != wdata2[0] || rdata.i2 != wdata2[1]) {
- H5_FAILED(); AT();
+ if (rdata.i1 != wdata2[0] || rdata.i2 != wdata2[1]) {
+ H5_FAILED();
+ AT();
HDprintf("incorrect read data\n");
goto error;
} /* end if */
/* Close */
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
goto error;
- if(H5Tclose(cmpd_f_tid) < 0)
+ if (H5Tclose(cmpd_f_tid) < 0)
goto error;
- if(H5Tclose(cmpd_m_tid) < 0)
+ if (H5Tclose(cmpd_m_tid) < 0)
goto error;
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
goto error;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
PASSED();
return 0;
- error:
+error:
return 1;
} /* end test_compound_15() */
-
/*-------------------------------------------------------------------------
* Function: test_compound_16
*
@@ -3072,8 +3300,8 @@ static int
test_compound_16(void)
{
typedef struct cmpd_struct {
- int i1;
- int i2;
+ int i1;
+ int i2;
} cmpd_struct;
cmpd_struct wdata1 = {1254, 5471};
@@ -3083,56 +3311,78 @@ test_compound_16(void)
hid_t space_id;
hid_t dset_id;
hid_t open_dtypes[2] = {0, 0};
- hsize_t dim1[1] = {1};
+ hsize_t dim1[1] = {1};
char filename[1024];
TESTING("visibility of internally registered type ids");
/* Create File */
h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Copy and commit integer datatype */
- if((int_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(file, "int", int_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((int_id = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(file, "int", int_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create file compound datatype */
- if((cmpd_f_tid = H5Tcreate(H5T_COMPOUND, 2 * sizeof(int) + 2)) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_f_tid, "i1", (size_t)0, int_id) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_f_tid, "i2", sizeof(int) + 1, int_id) < 0) TEST_ERROR
+ if ((cmpd_f_tid = H5Tcreate(H5T_COMPOUND, 2 * sizeof(int) + 2)) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cmpd_f_tid, "i1", (size_t)0, int_id) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cmpd_f_tid, "i2", sizeof(int) + 1, int_id) < 0)
+ TEST_ERROR
/* Create memory compound datatype */
- if((cmpd_m_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_m_tid, "i1", HOFFSET(struct cmpd_struct, i1), int_id) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_m_tid, "i2", HOFFSET(struct cmpd_struct, i2), int_id) < 0) TEST_ERROR
+ if ((cmpd_m_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cmpd_m_tid, "i1", HOFFSET(struct cmpd_struct, i1), int_id) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cmpd_m_tid, "i2", HOFFSET(struct cmpd_struct, i2), int_id) < 0)
+ TEST_ERROR
/* Create space, dataset, write wdata1 */
- if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) TEST_ERROR
- if((dset_id = H5Dcreate2(file, "Dataset", cmpd_f_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(dset_id, cmpd_m_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata1) < 0) TEST_ERROR
+ if ((space_id = H5Screate_simple(1, dim1, NULL)) < 0)
+ TEST_ERROR
+ if ((dset_id = H5Dcreate2(file, "Dataset", cmpd_f_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Dwrite(dset_id, cmpd_m_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata1) < 0)
+ TEST_ERROR
/* Check behavior of H5Fget_obj_count */
- if((obj_count = H5Fget_obj_count(file, H5F_OBJ_DATATYPE)) != 1) {
- H5_FAILED(); AT();
+ if ((obj_count = H5Fget_obj_count(file, H5F_OBJ_DATATYPE)) != 1) {
+ H5_FAILED();
+ AT();
HDprintf(" H5Fget_obj_count returned: %zd; expected: 1\n", obj_count);
goto error;
}
/* Check behavior of H5Fget_obj_ids */
- if(H5Fget_obj_ids(file, H5F_OBJ_DATATYPE, (size_t)2, open_dtypes) < 0) TEST_ERROR
- if(open_dtypes[1]) {
- H5_FAILED(); AT();
+ if (H5Fget_obj_ids(file, H5F_OBJ_DATATYPE, (size_t)2, open_dtypes) < 0)
+ TEST_ERROR
+ if (open_dtypes[1]) {
+ H5_FAILED();
+ AT();
HDprintf(" H5Fget_obj_ids returned as second id: %lld; expected: 0\n", (long long)open_dtypes[1]);
goto error;
}
/* Close */
- if(H5Dclose(dset_id) < 0) TEST_ERROR
- if(H5Sclose(space_id) < 0) TEST_ERROR
- if(H5Tclose(cmpd_f_tid) < 0) TEST_ERROR
- if(H5Tclose(cmpd_m_tid) < 0) TEST_ERROR
- if(H5Tclose(int_id) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Dclose(dset_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (H5Tclose(cmpd_f_tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(cmpd_m_tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(int_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
PASSED();
return 0;
@@ -3141,7 +3391,6 @@ error:
return 1;
} /* end test_compound_16() */
-
/*-------------------------------------------------------------------------
* Function: test_compound_17
*
@@ -3164,98 +3413,134 @@ error:
static int
test_compound_17(void)
{
- hid_t file;
- hid_t cmpd_int, arr_int, cmpd_ext, arr_ext, tmp_dt;
- hsize_t dims[1] = {2};
- char filename[1024];
+ hid_t file;
+ hid_t cmpd_int, arr_int, cmpd_ext, arr_ext, tmp_dt;
+ hsize_t dims[1] = {2};
+ char filename[1024];
TESTING("that H5Tpack removes trailing bytes");
/* Create inner compound datatype. This type will be "packed" according
* to the internal field, but will have trailing space at the end. */
- if((cmpd_int = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_int, "c", (size_t)0, H5T_NATIVE_CHAR) < 0) TEST_ERROR
+ if ((cmpd_int = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cmpd_int, "c", (size_t)0, H5T_NATIVE_CHAR) < 0)
+ TEST_ERROR
/* Create inner array datatype */
- if((arr_int = H5Tarray_create2(cmpd_int, 1, dims)) < 0) TEST_ERROR
+ if ((arr_int = H5Tarray_create2(cmpd_int, 1, dims)) < 0)
+ TEST_ERROR
/* Create outer compound datatype. This type will be truly packed, with no
* trailing space. However, the internal compound contained within is not
* packed. */
- if((cmpd_ext = H5Tcreate(H5T_COMPOUND, (size_t)8)) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_ext, "arr", (size_t)0, arr_int) < 0) TEST_ERROR
+ if ((cmpd_ext = H5Tcreate(H5T_COMPOUND, (size_t)8)) < 0)
+ TEST_ERROR
+ if (H5Tinsert(cmpd_ext, "arr", (size_t)0, arr_int) < 0)
+ TEST_ERROR
/* Create outer array datatype */
- if((arr_ext = H5Tarray_create2(cmpd_ext, 1, dims)) < 0) TEST_ERROR
+ if ((arr_ext = H5Tarray_create2(cmpd_ext, 1, dims)) < 0)
+ TEST_ERROR
/* Try packing the internal array. Size should be 2 after packing. */
- if((tmp_dt = H5Tcopy(arr_int)) < 0) TEST_ERROR
- if(H5Tpack(tmp_dt) < 0) TEST_ERROR
- if(2 != H5Tget_size(tmp_dt)) {
- H5_FAILED(); AT();
+ if ((tmp_dt = H5Tcopy(arr_int)) < 0)
+ TEST_ERROR
+ if (H5Tpack(tmp_dt) < 0)
+ TEST_ERROR
+ if (2 != H5Tget_size(tmp_dt)) {
+ H5_FAILED();
+ AT();
HDprintf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
- if(H5Tclose(tmp_dt) < 0) TEST_ERROR
+ if (H5Tclose(tmp_dt) < 0)
+ TEST_ERROR
/* Try packing the external array. Size should be 4 after packing. */
- if((tmp_dt = H5Tcopy(arr_ext)) < 0) TEST_ERROR
- if(H5Tpack(tmp_dt) < 0) TEST_ERROR
- if(4 != H5Tget_size(tmp_dt)) {
- H5_FAILED(); AT();
+ if ((tmp_dt = H5Tcopy(arr_ext)) < 0)
+ TEST_ERROR
+ if (H5Tpack(tmp_dt) < 0)
+ TEST_ERROR
+ if (4 != H5Tget_size(tmp_dt)) {
+ H5_FAILED();
+ AT();
HDprintf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
- if(H5Tclose(tmp_dt) < 0) TEST_ERROR
+ if (H5Tclose(tmp_dt) < 0)
+ TEST_ERROR
/* Now we will commit arr_int and arr_ext to a file, and verify that they
* are still packed correctly after opening them from the file */
/* Create File */
h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Commit the datatypes. Note that they are still unpacked. */
- if(H5Tcommit2(file, "arr_int", arr_int, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tcommit2(file, "arr_ext", arr_ext, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Tcommit2(file, "arr_int", arr_int, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(file, "arr_ext", arr_ext, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close IDs */
- if(H5Tclose(cmpd_int) < 0) TEST_ERROR
- if(H5Tclose(arr_int) < 0) TEST_ERROR
- if(H5Tclose(cmpd_ext) < 0) TEST_ERROR
- if(H5Tclose(arr_ext) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Tclose(cmpd_int) < 0)
+ TEST_ERROR
+ if (H5Tclose(arr_int) < 0)
+ TEST_ERROR
+ if (H5Tclose(cmpd_ext) < 0)
+ TEST_ERROR
+ if (H5Tclose(arr_ext) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
/* Reopen file */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Open committed array datatypes */
- if((arr_int = H5Topen2(file, "arr_int", H5P_DEFAULT)) < 0) TEST_ERROR
- if((arr_ext = H5Topen2(file, "arr_ext", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((arr_int = H5Topen2(file, "arr_int", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((arr_ext = H5Topen2(file, "arr_ext", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Try packing the internal array. Size should be 2 after packing. */
- if((tmp_dt = H5Tcopy(arr_int)) < 0) TEST_ERROR
- if(H5Tpack(tmp_dt) < 0) TEST_ERROR
- if(2 != H5Tget_size(tmp_dt)) {
- H5_FAILED(); AT();
+ if ((tmp_dt = H5Tcopy(arr_int)) < 0)
+ TEST_ERROR
+ if (H5Tpack(tmp_dt) < 0)
+ TEST_ERROR
+ if (2 != H5Tget_size(tmp_dt)) {
+ H5_FAILED();
+ AT();
HDprintf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
- if(H5Tclose(tmp_dt) < 0) TEST_ERROR
+ if (H5Tclose(tmp_dt) < 0)
+ TEST_ERROR
/* Try packing the external array. Size should be 4 after packing. */
- if((tmp_dt = H5Tcopy(arr_ext)) < 0) TEST_ERROR
- if(H5Tpack(tmp_dt) < 0) TEST_ERROR
- if(4 != H5Tget_size(tmp_dt)) {
- H5_FAILED(); AT();
+ if ((tmp_dt = H5Tcopy(arr_ext)) < 0)
+ TEST_ERROR
+ if (H5Tpack(tmp_dt) < 0)
+ TEST_ERROR
+ if (4 != H5Tget_size(tmp_dt)) {
+ H5_FAILED();
+ AT();
HDprintf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
- if(H5Tclose(tmp_dt) < 0) TEST_ERROR
+ if (H5Tclose(tmp_dt) < 0)
+ TEST_ERROR
/* Close IDs */
- if(H5Tclose(arr_int) < 0) TEST_ERROR
- if(H5Tclose(arr_ext) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Tclose(arr_int) < 0)
+ TEST_ERROR
+ if (H5Tclose(arr_ext) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
PASSED();
return 0;
@@ -3264,7 +3549,6 @@ error:
return 1;
} /* end test_compound_17() */
-
/*-------------------------------------------------------------------------
* Function: test_compound_18
*
@@ -3282,13 +3566,13 @@ error:
static int
test_compound_18(void)
{
- hid_t file = -1;
- hid_t gid = -1;
- hid_t did = -1;
- hid_t aid = -1;
- hid_t tid = -1;
- hid_t sid = -1;
- hsize_t dim = 1;
+ hid_t file = -1;
+ hid_t gid = -1;
+ hid_t did = -1;
+ hid_t aid = -1;
+ hid_t tid = -1;
+ hid_t sid = -1;
+ hsize_t dim = 1;
const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
char filename[1024];
herr_t ret;
@@ -3302,17 +3586,17 @@ test_compound_18(void)
/* Attempt to create file with compound datatype that has no fields */
/* Create File */
h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a dataspace to use */
sid = H5Screate_simple(1, &dim, NULL);
HDassert(sid > 0);
/* Create a dataset with the bad compound datatype */
- H5E_BEGIN_TRY {
- did = H5Dcreate2(file, "dataset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(did > 0) {
+ H5E_BEGIN_TRY { did = H5Dcreate2(file, "dataset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (did > 0) {
H5Dclose(did);
FAIL_PUTS_ERROR("created dataset with bad compound datatype")
} /* end if */
@@ -3322,66 +3606,68 @@ test_compound_18(void)
HDassert(gid > 0);
/* Create an attribute with the bad compound datatype */
- H5E_BEGIN_TRY {
- aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(aid > 0) {
+ H5E_BEGIN_TRY { aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (aid > 0) {
H5Aclose(aid);
FAIL_PUTS_ERROR("created attribute with bad compound datatype")
} /* end if */
/* Commit the datatype */
- H5E_BEGIN_TRY {
- ret = H5Tcommit2(file, "cmpnd", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) {
+ H5E_BEGIN_TRY { ret = H5Tcommit2(file, "cmpnd", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (ret >= 0) {
FAIL_PUTS_ERROR("committed named datatype with bad compound datatype")
} /* end if */
/* Close IDs */
- if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
-
+ if (H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Open Generated File */
/* (generated with gen_bad_compound.c) */
- if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Try to open the datatype */
- H5E_BEGIN_TRY {
- tid = H5Topen2(file, "cmpnd", H5P_DEFAULT);
- } H5E_END_TRY;
- if(tid > 0) {
+ H5E_BEGIN_TRY { tid = H5Topen2(file, "cmpnd", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (tid > 0) {
H5Tclose(tid);
FAIL_PUTS_ERROR("opened named datatype with bad compound datatype")
} /* end if */
/* Try to open the dataset */
- H5E_BEGIN_TRY {
- did = H5Dopen2(file, "dataset", H5P_DEFAULT);
- } H5E_END_TRY;
- if(did > 0) {
+ H5E_BEGIN_TRY { did = H5Dopen2(file, "dataset", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (did > 0) {
H5Dclose(did);
FAIL_PUTS_ERROR("opened dataset with bad compound datatype")
} /* end if */
/* Open the group with the attribute */
- if((gid = H5Gopen2(file, "group", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gopen2(file, "group", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Try to open the dataset */
- H5E_BEGIN_TRY {
- aid = H5Aopen(gid, "attr", H5P_DEFAULT);
- } H5E_END_TRY;
- if(aid > 0) {
+ H5E_BEGIN_TRY { aid = H5Aopen(gid, "attr", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (aid > 0) {
H5Aclose(aid);
FAIL_PUTS_ERROR("opened attribute with bad compound datatype")
} /* end if */
/* Close IDs */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
@@ -3390,7 +3676,6 @@ error:
return 1;
} /* end test_compound_18() */
-
/*-------------------------------------------------------------------------
* Function: test_query
*
@@ -3419,175 +3704,175 @@ test_query(void)
long c;
double d;
};
- hid_t file=-1, tid1=-1, tid2=-1;
- char filename[1024];
- char compnd_type[]="Compound_type", enum_type[]="Enum_type";
- short enum_val;
- char enum_name[16];
+ hid_t file = -1, tid1 = -1, tid2 = -1;
+ char filename[1024];
+ char compnd_type[] = "Compound_type", enum_type[] = "Enum_type";
+ short enum_val;
+ char enum_name[16];
TESTING("query functions of compound and enumeration types");
/* Create File */
h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create a compound datatype */
- if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) {
+ if ((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) {
H5_FAILED();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) {
+ if (H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'a'\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) {
+ if (H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'b'\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) {
+ if (H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'c'\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) {
+ if (H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'd'\n");
goto error;
} /* end if */
/* Create a enumerate datatype */
- if((tid2=H5Tcreate(H5T_ENUM, sizeof(short))) < 0) {
+ if ((tid2 = H5Tcreate(H5T_ENUM, sizeof(short))) < 0) {
H5_FAILED();
HDprintf("Can't create enumerate type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "RED", (enum_val=10,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "RED", (enum_val = 10, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "GREEN", (enum_val=11,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "GREEN", (enum_val = 11, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "BLUE", (enum_val=12,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "BLUE", (enum_val = 12, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "ORANGE", (enum_val=13,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "ORANGE", (enum_val = 13, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "YELLOW", (enum_val=14,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "YELLOW", (enum_val = 14, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
/* Query member number and member index by name, for compound type. */
- if(H5Tget_nmembers(tid1)!=4) {
+ if (H5Tget_nmembers(tid1) != 4) {
H5_FAILED();
HDprintf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(tid1, "c")!=2) {
+ if (H5Tget_member_index(tid1, "c") != 2) {
H5_FAILED();
HDprintf("Can't get correct index number\n");
goto error;
} /* end if */
/* Query member number and member index by member name, for enumeration type. */
- if(H5Tget_nmembers(tid2) != 5) {
+ if (H5Tget_nmembers(tid2) != 5) {
H5_FAILED();
HDprintf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(tid2, "ORANGE") != 3) {
+ if (H5Tget_member_index(tid2, "ORANGE") != 3) {
H5_FAILED();
HDprintf("Can't get correct index number\n");
goto error;
} /* end if */
/* Commit compound datatype and close it */
- if(H5Tcommit2(file, compnd_type, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Tcommit2(file, compnd_type, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Can't commit compound datatype\n");
goto error;
} /* end if */
- if(H5Tclose(tid1) < 0) {
+ if (H5Tclose(tid1) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
/* Commit enumeration datatype and close it */
- if(H5Tcommit2(file, enum_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Tcommit2(file, enum_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Can't commit compound datatype\n");
goto error;
} /* end if */
- if(H5Tclose(tid2) < 0) {
+ if (H5Tclose(tid2) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
/* Open the dataytpe for query */
- if((tid1 = H5Topen2(file, compnd_type, H5P_DEFAULT)) < 0)
+ if ((tid1 = H5Topen2(file, compnd_type, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((tid2 = H5Topen2(file, enum_type, H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(file, enum_type, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Query member number and member index by name, for compound type */
- if(H5Tget_nmembers(tid1) != 4) {
+ if (H5Tget_nmembers(tid1) != 4) {
H5_FAILED();
HDprintf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(tid1, "c") != 2) {
+ if (H5Tget_member_index(tid1, "c") != 2) {
H5_FAILED();
HDprintf("Can't get correct index number\n");
goto error;
} /* end if */
/* Query member number and member index by member name, for enumeration type */
- if(H5Tget_nmembers(tid2)!=5) {
+ if (H5Tget_nmembers(tid2) != 5) {
H5_FAILED();
HDprintf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(tid2, "ORANGE")!=3) {
+ if (H5Tget_member_index(tid2, "ORANGE") != 3) {
H5_FAILED();
HDprintf("Can't get correct index number\n");
goto error;
} /* end if */
/* Query member value by member name, for enumeration type */
- if(H5Tenum_valueof (tid2, "ORANGE", &enum_val) < 0) {
+ if (H5Tenum_valueof(tid2, "ORANGE", &enum_val) < 0) {
H5_FAILED();
HDprintf("Can't get value for enumerate member\n");
goto error;
} /* end if */
- if(enum_val!=13) {
+ if (enum_val != 13) {
H5_FAILED();
HDprintf("Incorrect value for enum member\n");
goto error;
} /* end if */
/* Query member value by member index, for enumeration type */
- if(H5Tget_member_value (tid2, 2, &enum_val) < 0) {
+ if (H5Tget_member_value(tid2, 2, &enum_val) < 0) {
H5_FAILED();
HDprintf("Can't get value for enum member\n");
goto error;
} /* end if */
- if(enum_val!=12) {
+ if (enum_val != 12) {
H5_FAILED();
HDprintf("Incorrect value for enum member\n");
goto error;
@@ -3595,30 +3880,30 @@ test_query(void)
/* Query member name by member value, for enumeration type */
enum_val = 14;
- if(H5Tenum_nameof(tid2, &enum_val, enum_name, (size_t)16) < 0) {
+ if (H5Tenum_nameof(tid2, &enum_val, enum_name, (size_t)16) < 0) {
H5_FAILED();
HDprintf("Can't get name for enum member\n");
goto error;
} /* end if */
- if(strcmp("YELLOW", enum_name)) {
+ if (strcmp("YELLOW", enum_name)) {
H5_FAILED();
HDprintf("Incorrect name for enum member\n");
goto error;
} /* end if */
/* Close datatype and file */
- if(H5Tclose(tid1) < 0) {
+ if (H5Tclose(tid1) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(tid2) < 0) {
+ if (H5Tclose(tid2) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Fclose(file) < 0) {
+ if (H5Fclose(file) < 0) {
H5_FAILED();
HDprintf("Can't close file\n");
goto error;
@@ -3627,16 +3912,17 @@ test_query(void)
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Tclose (tid1);
- H5Tclose (tid2);
- H5Fclose (file);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(tid1);
+ H5Tclose(tid2);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_transient
*
@@ -3654,118 +3940,131 @@ test_query(void)
*-------------------------------------------------------------------------
*/
static int
-test_transient (hid_t fapl)
+test_transient(hid_t fapl)
{
- static hsize_t ds_size[2] = {10, 20};
- hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1;
- char filename[1024];
- hid_t ret_id; /* Generic hid_t return value */
- herr_t status;
+ static hsize_t ds_size[2] = {10, 20};
+ hid_t file = -1, type = -1, space = -1, dset = -1, t2 = -1;
+ char filename[1024];
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t status;
TESTING("transient datatypes");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
- goto error;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
+ goto error;
}
- if ((space = H5Screate_simple (2, ds_size, ds_size)) < 0) goto error;
+ if ((space = H5Screate_simple(2, ds_size, ds_size)) < 0)
+ goto error;
/* Predefined types cannot be modified or closed */
- H5E_BEGIN_TRY {
- status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256);
- } H5E_END_TRY;
- if (status>=0) {
- H5_FAILED();
- HDputs (" Predefined types should not be modifiable!");
- goto error;
+ H5E_BEGIN_TRY { status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Predefined types should not be modifiable!");
+ goto error;
}
- H5E_BEGIN_TRY {
- status = H5Tclose (H5T_NATIVE_INT);
- } H5E_END_TRY;
- if (status>=0) {
- H5_FAILED();
- HDputs (" Predefined types should not be closable!");
- goto error;
+ H5E_BEGIN_TRY { status = H5Tclose(H5T_NATIVE_INT); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Predefined types should not be closable!");
+ goto error;
}
/* Copying a predefined type results in a modifiable copy */
- if((type=H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
- if(H5Tset_precision(type, (size_t)256) < 0) goto error;
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto error;
+ if (H5Tset_precision(type, (size_t)256) < 0)
+ goto error;
/* It should not be possible to create an attribute for a transient type */
- H5E_BEGIN_TRY {
- ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if (ret_id>=0) {
- H5_FAILED();
- HDputs (" Attributes should not be allowed for transient types!");
- goto error;
+ H5E_BEGIN_TRY { ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (ret_id >= 0) {
+ H5_FAILED();
+ HDputs(" Attributes should not be allowed for transient types!");
+ goto error;
}
/* Create a dataset from a transient datatype */
- if(H5Tclose(type) < 0) goto error;
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
- if((dset = H5Dcreate2(file, "dset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto error;
+ if ((dset = H5Dcreate2(file, "dset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* The type returned from a dataset should not be modifiable */
- if((t2 = H5Dget_type(dset)) < 0) goto error;
- H5E_BEGIN_TRY {
- status = H5Tset_precision(t2, (size_t)256);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs (" Dataset datatypes should not be modifiable!");
- goto error;
+ if ((t2 = H5Dget_type(dset)) < 0)
+ goto error;
+ H5E_BEGIN_TRY { status = H5Tset_precision(t2, (size_t)256); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Dataset datatypes should not be modifiable!");
+ goto error;
}
- if(H5Tclose(t2) < 0) goto error;
+ if (H5Tclose(t2) < 0)
+ goto error;
/*
* Close the dataset and reopen it, testing that it's type is still
* read-only.
*/
- if(H5Dclose(dset) < 0) goto error;
- if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error;
- if((t2 = H5Dget_type(dset)) < 0) goto error;
- H5E_BEGIN_TRY {
- status = H5Tset_precision(t2, (size_t)256);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs (" Dataset datatypes should not be modifiable!");
- goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if ((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((t2 = H5Dget_type(dset)) < 0)
+ goto error;
+ H5E_BEGIN_TRY { status = H5Tset_precision(t2, (size_t)256); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Dataset datatypes should not be modifiable!");
+ goto error;
}
- if(H5Tclose(t2) < 0) goto error;
+ if (H5Tclose(t2) < 0)
+ goto error;
/*
* Get the dataset datatype by applying H5Tcopy() to the dataset. The
* result should be modifiable.
*/
- if((t2=H5Tcopy(dset)) < 0) goto error;
- if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
- if(H5Tclose(t2) < 0) goto error;
-
+ if ((t2 = H5Tcopy(dset)) < 0)
+ goto error;
+ if (H5Tset_precision(t2, (size_t)256) < 0)
+ goto error;
+ if (H5Tclose(t2) < 0)
+ goto error;
- if(H5Dclose(dset) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
- if(H5Tclose(type) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Tclose (t2);
- H5Tclose (type);
- H5Sclose (space);
- H5Dclose (dset);
- H5Fclose (file);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(t2);
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Dclose(dset);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_named
*
@@ -3783,227 +4082,280 @@ test_transient (hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-test_named (hid_t fapl)
+test_named(hid_t fapl)
{
- hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, t3=-1, attr1=-1;
- herr_t status;
- static hsize_t ds_size[2] = {10, 20};
- size_t i,j;
- unsigned attr_data[10][20];
- char filename[1024];
+ hid_t file = -1, type = -1, space = -1, dset = -1, t2 = -1, t3 = -1, attr1 = -1;
+ herr_t status;
+ static hsize_t ds_size[2] = {10, 20};
+ size_t i, j;
+ unsigned attr_data[10][20];
+ char filename[1024];
TESTING("named datatypes");
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
- goto error;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
+ goto error;
}
- if ((space = H5Screate_simple (2, ds_size, ds_size)) < 0) goto error;
+ if ((space = H5Screate_simple(2, ds_size, ds_size)) < 0)
+ goto error;
/* Predefined types cannot be committed */
- H5E_BEGIN_TRY {
- status = H5Tcommit2(file, "test_named_1 (should not exist)", H5T_NATIVE_INT, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs (" Predefined types should not be committable!");
- goto error;
+ H5E_BEGIN_TRY
+ {
+ status = H5Tcommit2(file, "test_named_1 (should not exist)", H5T_NATIVE_INT, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Predefined types should not be committable!");
+ goto error;
}
/* Copy a predefined datatype and commit the copy */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
- if(H5Tcommit2(file, "native-int", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) goto error;
- if((status = H5Tcommitted(type)) < 0) goto error;
- if(0 == status) {
- H5_FAILED();
- HDputs (" H5Tcommitted() returned false!");
- goto error;
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto error;
+ if (H5Tcommit2(file, "native-int", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto error;
+ if ((status = H5Tcommitted(type)) < 0)
+ goto error;
+ if (0 == status) {
+ H5_FAILED();
+ HDputs(" H5Tcommitted() returned false!");
+ goto error;
}
/* We should not be able to modify a type after it has been committed. */
- H5E_BEGIN_TRY {
- status = H5Tset_precision (type, (size_t)256);
- } H5E_END_TRY;
- if (status>=0) {
- H5_FAILED();
- HDputs (" Committed type is not constant!");
- goto error;
+ H5E_BEGIN_TRY { status = H5Tset_precision(type, (size_t)256); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Committed type is not constant!");
+ goto error;
}
/* We should not be able to re-commit a committed type */
- H5E_BEGIN_TRY {
- status = H5Tcommit2(file, "test_named_2 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs (" Committed types should not be recommitted!");
- goto error;
+ H5E_BEGIN_TRY
+ {
+ status =
+ H5Tcommit2(file, "test_named_2 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Committed types should not be recommitted!");
+ goto error;
}
/* It should be possible to define an attribute for the named type */
- if((attr1 = H5Acreate2(type, "attr1", H5T_NATIVE_UCHAR, space,
- H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- for(i = 0; i < (size_t)ds_size[0]; i++)
- for(j = 0; j < (size_t)ds_size[1]; j++)
+ if ((attr1 = H5Acreate2(type, "attr1", H5T_NATIVE_UCHAR, space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < (size_t)ds_size[0]; i++)
+ for (j = 0; j < (size_t)ds_size[1]; j++)
attr_data[i][j] = (unsigned)(i * ds_size[1] + j);
- if(H5Awrite(attr1, H5T_NATIVE_UINT, attr_data) < 0) goto error;
- if(H5Aclose(attr1) < 0) goto error;
+ if (H5Awrite(attr1, H5T_NATIVE_UINT, attr_data) < 0)
+ goto error;
+ if (H5Aclose(attr1) < 0)
+ goto error;
/*
* Copying a committed type should result in a transient type which is
* not locked.
*/
- if((t2 = H5Tcopy(type)) < 0) goto error;
- if((status = H5Tcommitted(t2)) < 0) goto error;
- if(status) {
- H5_FAILED();
- HDputs (" Copying a named type should result in a transient type!");
- goto error;
+ if ((t2 = H5Tcopy(type)) < 0)
+ goto error;
+ if ((status = H5Tcommitted(t2)) < 0)
+ goto error;
+ if (status) {
+ H5_FAILED();
+ HDputs(" Copying a named type should result in a transient type!");
+ goto error;
}
- if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
- if(H5Tclose(t2) < 0) goto error;
+ if (H5Tset_precision(t2, (size_t)256) < 0)
+ goto error;
+ if (H5Tclose(t2) < 0)
+ goto error;
/*
* Close the committed type and reopen it. It should return a named type.
*/
- if(H5Tclose(type) < 0) goto error;
- if((type = H5Topen2(file, "native-int", H5P_DEFAULT)) < 0)
+ if (H5Tclose(type) < 0)
+ goto error;
+ if ((type = H5Topen2(file, "native-int", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((status = H5Tcommitted(type)) < 0) goto error;
- if(!status) {
- H5_FAILED();
- HDputs (" Opened named types should be named types!");
- goto error;
+ if ((status = H5Tcommitted(type)) < 0)
+ goto error;
+ if (!status) {
+ H5_FAILED();
+ HDputs(" Opened named types should be named types!");
+ goto error;
}
/* Create a dataset that uses the named type */
- if((dset = H5Dcreate2(file, "dset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ if ((dset = H5Dcreate2(file, "dset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* Get the dataset's datatype and make sure it's a named type */
- if((t2 = H5Dget_type(dset)) < 0) goto error;
- if((status = H5Tcommitted(t2)) < 0) goto error;
- if(!status) {
- H5_FAILED();
- HDputs (" Dataset type should be a named type!");
- goto error;
+ if ((t2 = H5Dget_type(dset)) < 0)
+ goto error;
+ if ((status = H5Tcommitted(t2)) < 0)
+ goto error;
+ if (!status) {
+ H5_FAILED();
+ HDputs(" Dataset type should be a named type!");
+ goto error;
}
/* Close the dataset, then close its type, then reopen the dataset */
- if(H5Dclose(dset) < 0) goto error;
- if(H5Tclose(t2) < 0) goto error;
- if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Tclose(t2) < 0)
+ goto error;
+ if ((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0)
+ goto error;
/* Get the dataset's type and make sure it's named */
- if((t2 = H5Dget_type(dset)) < 0) goto error;
- if((status = H5Tcommitted(t2)) < 0) goto error;
- if(!status) {
- H5_FAILED();
- HDputs (" Dataset type should be a named type!");
- goto error;
+ if ((t2 = H5Dget_type(dset)) < 0)
+ goto error;
+ if ((status = H5Tcommitted(t2)) < 0)
+ goto error;
+ if (!status) {
+ H5_FAILED();
+ HDputs(" Dataset type should be a named type!");
+ goto error;
}
/*
* Close the dataset and create another with the type returned from the
* first dataset.
*/
- if(H5Dclose(dset) < 0) goto error;
- if((dset = H5Dcreate2(file, "dset2", t2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if ((dset = H5Dcreate2(file, "dset2", t2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* Reopen the second dataset and make sure the type is shared */
- if(H5Tclose(t2) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
- if((dset = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0) goto error;
- if((t2 = H5Dget_type(dset)) < 0) goto error;
- if((status = H5Tcommitted(t2)) < 0) goto error;
- if(!status) {
- H5_FAILED();
- HDputs (" Dataset type should be a named type!");
- goto error;
+ if (H5Tclose(t2) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if ((dset = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((t2 = H5Dget_type(dset)) < 0)
+ goto error;
+ if ((status = H5Tcommitted(t2)) < 0)
+ goto error;
+ if (!status) {
+ H5_FAILED();
+ HDputs(" Dataset type should be a named type!");
+ goto error;
}
- if(H5Tclose(t2) < 0) goto error;
+ if (H5Tclose(t2) < 0)
+ goto error;
/*
* Get the dataset datatype by applying H5Tcopy() to the dataset. The
* result should be modifiable.
*/
- if((t2 = H5Tcopy(dset)) < 0) goto error;
- if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
- if(H5Tclose(t2) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
+ if ((t2 = H5Tcopy(dset)) < 0)
+ goto error;
+ if (H5Tset_precision(t2, (size_t)256) < 0)
+ goto error;
+ if (H5Tclose(t2) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
/*
* Copy of committed type used as dataset type should not be name type
*/
- if((t2 = H5Tcopy(type)) < 0) goto error;
- if((status = H5Tcommitted(t2)) < 0) goto error;
- if(status) {
- H5_FAILED();
- HDputs (" Copied type should not be a named type!");
- goto error;
+ if ((t2 = H5Tcopy(type)) < 0)
+ goto error;
+ if ((status = H5Tcommitted(t2)) < 0)
+ goto error;
+ if (status) {
+ H5_FAILED();
+ HDputs(" Copied type should not be a named type!");
+ goto error;
}
- if((dset = H5Dcreate2(file, "dset3", t2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if((t3 = H5Dget_type(dset)) < 0) goto error;
- if((status = H5Tcommitted(t3)) < 0) goto error;
- if(status) {
- H5_FAILED();
- HDputs (" Datatype from dataset using copied type should not be a named type!");
- goto error;
+ if ((dset = H5Dcreate2(file, "dset3", t2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if ((t3 = H5Dget_type(dset)) < 0)
+ goto error;
+ if ((status = H5Tcommitted(t3)) < 0)
+ goto error;
+ if (status) {
+ H5_FAILED();
+ HDputs(" Datatype from dataset using copied type should not be a named type!");
+ goto error;
}
- if(H5Tclose(t3) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
+ if (H5Tclose(t3) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
/* Close */
- if(H5Tclose(type) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
/* Reopen file with read only access */
if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
goto error;
/* Verify that H5Tcommit2 returns an error */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
- H5E_BEGIN_TRY {
- status = H5Tcommit2(file, "test_named_3 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto error;
+ H5E_BEGIN_TRY
+ {
+ status =
+ H5Tcommit2(file, "test_named_3 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
- HDputs (" Types should not be committable to a read-only file!");
+ HDputs(" Types should not be committable to a read-only file!");
goto error;
}
/* Verify that H5Tcommit_anon returns an error */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
- H5E_BEGIN_TRY {
- status = H5Tcommit_anon(file, type, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto error;
+ H5E_BEGIN_TRY { status = H5Tcommit_anon(file, type, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
- HDputs (" Types should not be committable to a read-only file!");
+ HDputs(" Types should not be committable to a read-only file!");
goto error;
}
/* Close */
- if(H5Tclose(type) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Tclose(t3);
- H5Tclose(t2);
- H5Tclose(type);
- H5Sclose(space);
- H5Dclose(dset);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(t3);
+ H5Tclose(t2);
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Dclose(dset);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: mkstr
*
@@ -4020,19 +4372,18 @@ error:
static hid_t
mkstr(size_t len, H5T_str_t strpad)
{
- hid_t t;
+ hid_t t;
- if((t = H5Tcopy(H5T_C_S1)) < 0)
+ if ((t = H5Tcopy(H5T_C_S1)) < 0)
return -1;
- if(H5Tset_size(t, len) < 0)
+ if (H5Tset_size(t, len) < 0)
return -1;
- if(H5Tset_strpad(t, strpad) < 0)
+ if (H5Tset_strpad(t, strpad) < 0)
return -1;
return t;
}
-
/*-------------------------------------------------------------------------
* Function: test_str_create
*
@@ -4050,45 +4401,65 @@ static int
test_str_create(void)
{
hid_t fixed_str1, fixed_str2;
- hid_t vlen_str1, vlen_str2;
+ hid_t vlen_str1, vlen_str2;
htri_t is_vl_str = FALSE;
size_t query_size, str_size = 10;
TESTING("string type creation using H5Tcreate");
/* Create fixed-length string in two ways and make sure they are the same */
- if((fixed_str1 = mkstr(str_size, H5T_STR_NULLTERM)) < 0) goto error;
+ if ((fixed_str1 = mkstr(str_size, H5T_STR_NULLTERM)) < 0)
+ goto error;
- if((fixed_str2 = H5Tcreate(H5T_STRING, str_size)) < 0) goto error;
- if(H5Tset_strpad(fixed_str2, H5T_STR_NULLTERM) < 0) goto error;
+ if ((fixed_str2 = H5Tcreate(H5T_STRING, str_size)) < 0)
+ goto error;
+ if (H5Tset_strpad(fixed_str2, H5T_STR_NULLTERM) < 0)
+ goto error;
- if(!H5Tequal(fixed_str1, fixed_str2)) goto error;
+ if (!H5Tequal(fixed_str1, fixed_str2))
+ goto error;
- if((query_size = H5Tget_size(fixed_str1)) == 0) goto error;
- if(query_size != str_size) goto error;
+ if ((query_size = H5Tget_size(fixed_str1)) == 0)
+ goto error;
+ if (query_size != str_size)
+ goto error;
- if((query_size = H5Tget_size(fixed_str2)) == 0) goto error;
- if(query_size != str_size) goto error;
+ if ((query_size = H5Tget_size(fixed_str2)) == 0)
+ goto error;
+ if (query_size != str_size)
+ goto error;
- if(H5Tclose(fixed_str1) < 0) goto error;
- if(H5Tclose(fixed_str2) < 0) goto error;
+ if (H5Tclose(fixed_str1) < 0)
+ goto error;
+ if (H5Tclose(fixed_str2) < 0)
+ goto error;
/* Create variable-length string in two ways and make sure they are the same */
- if((vlen_str1 = mkstr((size_t)H5T_VARIABLE, H5T_STR_NULLTERM)) < 0) goto error;
+ if ((vlen_str1 = mkstr((size_t)H5T_VARIABLE, H5T_STR_NULLTERM)) < 0)
+ goto error;
- if((vlen_str2 = H5Tcreate(H5T_STRING, (size_t)H5T_VARIABLE)) < 0) goto error;
- if(H5Tset_strpad(vlen_str2, H5T_STR_NULLTERM) < 0) goto error;
+ if ((vlen_str2 = H5Tcreate(H5T_STRING, (size_t)H5T_VARIABLE)) < 0)
+ goto error;
+ if (H5Tset_strpad(vlen_str2, H5T_STR_NULLTERM) < 0)
+ goto error;
- if(!H5Tequal(vlen_str1, vlen_str2)) goto error;
+ if (!H5Tequal(vlen_str1, vlen_str2))
+ goto error;
- if((is_vl_str = H5Tis_variable_str(vlen_str1)) < 0) goto error;
- if(!is_vl_str) goto error;
+ if ((is_vl_str = H5Tis_variable_str(vlen_str1)) < 0)
+ goto error;
+ if (!is_vl_str)
+ goto error;
- if((is_vl_str = H5Tis_variable_str(vlen_str2)) < 0) goto error;
- if(!is_vl_str) goto error;
+ if ((is_vl_str = H5Tis_variable_str(vlen_str2)) < 0)
+ goto error;
+ if (!is_vl_str)
+ goto error;
- if(H5Tclose(vlen_str1) < 0) goto error;
- if(H5Tclose(vlen_str2) < 0) goto error;
+ if (H5Tclose(vlen_str1) < 0)
+ goto error;
+ if (H5Tclose(vlen_str2) < 0)
+ goto error;
PASSED();
return 0;
@@ -4098,7 +4469,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_str_1
*
@@ -4115,9 +4485,9 @@ error:
static int
test_conv_str_1(void)
{
- char *buf = NULL;
- hid_t src_type = -1;
- hid_t dst_type = -1;
+ char *buf = NULL;
+ hid_t src_type = -1;
+ hid_t dst_type = -1;
TESTING("string conversions");
@@ -4125,74 +4495,95 @@ test_conv_str_1(void)
* Convert a null-terminated string to a shorter and longer null
* terminated string.
*/
- if((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
- if((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
- if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ if ((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0)
+ goto error;
+ if (NULL == (buf = (char *)HDcalloc((size_t)2, (size_t)10)))
+ goto error;
HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Truncated C-string test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Truncated C-string test failed");
+ goto error;
}
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Extended C-string test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Extended C-string test failed");
+ goto error;
}
HDfree(buf);
buf = NULL;
- if (H5Tclose(src_type) < 0) goto error;
- if (H5Tclose(dst_type) < 0) goto error;
+ if (H5Tclose(src_type) < 0)
+ goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
/*
* Convert a null padded string to a shorter and then longer string.
*/
- if((src_type = mkstr((size_t)10, H5T_STR_NULLPAD)) < 0) goto error;
- if((dst_type = mkstr((size_t)5, H5T_STR_NULLPAD)) < 0) goto error;
- if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ if ((src_type = mkstr((size_t)10, H5T_STR_NULLPAD)) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)5, H5T_STR_NULLPAD)) < 0)
+ goto error;
+ if (NULL == (buf = (char *)HDcalloc((size_t)2, (size_t)10)))
+ goto error;
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Truncated C buffer test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Truncated C buffer test failed");
+ goto error;
}
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Extended C buffer test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Extended C buffer test failed");
+ goto error;
}
HDfree(buf);
buf = NULL;
- if (H5Tclose(src_type) < 0) goto error;
- if (H5Tclose(dst_type) < 0) goto error;
+ if (H5Tclose(src_type) < 0)
+ goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
/*
* Convert a space-padded string to a shorter and then longer string.
*/
- if((src_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
- if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
- if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ if ((src_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0)
+ goto error;
+ if (NULL == (buf = (char *)HDcalloc((size_t)2, (size_t)10)))
+ goto error;
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Truncated Fortran-string test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Truncated Fortran-string test failed");
+ goto error;
}
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcde abcde ", (size_t)20)) {
- H5_FAILED();
- HDputs(" Extended Fortran-string test failed");
- goto error;
+ H5_FAILED();
+ HDputs(" Extended Fortran-string test failed");
+ goto error;
}
HDfree(buf);
buf = NULL;
- if (H5Tclose(src_type) < 0) goto error;
- if (H5Tclose(dst_type) < 0) goto error;
+ if (H5Tclose(src_type) < 0)
+ goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
/*
* What happens if a null-terminated string is not null terminated? If
@@ -4200,146 +4591,189 @@ test_conv_str_1(void)
* the destination is a different size or type of string then the right
* thing should happen.
*/
- if((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
- if((dst_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
- if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ if ((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0)
+ goto error;
+ if (NULL == (buf = (char *)HDcalloc((size_t)2, (size_t)10)))
+ goto error;
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Non-terminated string test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" Non-terminated string test 1");
+ goto error;
}
H5Tclose(dst_type);
- if((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
+ if ((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0)
+ goto error;
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Non-terminated string test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" Non-terminated string test 2");
+ goto error;
}
HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", (size_t)20);
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Non-terminated string test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" Non-terminated string test 2");
+ goto error;
}
HDfree(buf);
buf = NULL;
- if (H5Tclose(src_type) < 0) goto error;
- if (H5Tclose(dst_type) < 0) goto error;
+ if (H5Tclose(src_type) < 0)
+ goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
/*
* Test C string to Fortran and vice versa.
*/
- if((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
- if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
- if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ if ((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0)
+ goto error;
+ if (NULL == (buf = (char *)HDcalloc((size_t)2, (size_t)10)))
+ goto error;
HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcdefghi abcdefghi ", (size_t)20)) {
- H5_FAILED();
- HDputs(" C string to Fortran test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" C string to Fortran test 1");
+ goto error;
}
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C string test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C string test 1");
+ goto error;
}
- if (H5Tclose(dst_type) < 0) goto error;
- if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0)
+ goto error;
HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" C string to Fortran test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" C string to Fortran test 2");
+ goto error;
}
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C string test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C string test 2");
+ goto error;
}
- if (H5Tclose(src_type) < 0) goto error;
- if (H5Tclose(dst_type) < 0) goto error;
- if((src_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
- if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ if (H5Tclose(src_type) < 0)
+ goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
+ if ((src_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0)
+ goto error;
HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
- H5_FAILED();
- HDputs(" C string to Fortran test 3");
- goto error;
+ H5_FAILED();
+ HDputs(" C string to Fortran test 3");
+ goto error;
}
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C string test 3");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C string test 3");
+ goto error;
}
HDfree(buf);
buf = NULL;
- if (H5Tclose(src_type) < 0) goto error;
- if (H5Tclose(dst_type) < 0) goto error;
+ if (H5Tclose(src_type) < 0)
+ goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
/*
* Test C buffer to Fortran and vice versa.
*/
- if((src_type = mkstr((size_t)10, H5T_STR_NULLPAD)) < 0) goto error;
- if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
- if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ if ((src_type = mkstr((size_t)10, H5T_STR_NULLPAD)) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0)
+ goto error;
+ if (NULL == (buf = (char *)HDcalloc((size_t)2, (size_t)10)))
+ goto error;
HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" C buffer to Fortran test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" C buffer to Fortran test 1");
+ goto error;
}
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C buffer test 1");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C buffer test 1");
+ goto error;
}
- if (H5Tclose(dst_type) < 0) goto error;
- if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0)
+ goto error;
HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" C buffer to Fortran test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" C buffer to Fortran test 2");
+ goto error;
}
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C buffer test 2");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C buffer test 2");
+ goto error;
}
- if (H5Tclose(src_type) < 0) goto error;
- if (H5Tclose(dst_type) < 0) goto error;
- if((src_type = mkstr((size_t)5, H5T_STR_NULLPAD)) < 0) goto error;
- if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ if (H5Tclose(src_type) < 0)
+ goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
+ if ((src_type = mkstr((size_t)5, H5T_STR_NULLPAD)) < 0)
+ goto error;
+ if ((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0)
+ goto error;
HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
- if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
- H5_FAILED();
- HDputs(" C buffer to Fortran test 3");
- goto error;
+ H5_FAILED();
+ HDputs(" C buffer to Fortran test 3");
+ goto error;
}
- if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
- H5_FAILED();
- HDputs(" Fortran to C buffer test 3");
- goto error;
+ H5_FAILED();
+ HDputs(" Fortran to C buffer test 3");
+ goto error;
}
- if(H5Tclose(src_type) < 0) goto error;
- if(H5Tclose(dst_type) < 0) goto error;
+ if (H5Tclose(src_type) < 0)
+ goto error;
+ if (H5Tclose(dst_type) < 0)
+ goto error;
HDfree(buf);
PASSED();
@@ -4351,12 +4785,14 @@ test_conv_str_1(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(src_type);
H5Tclose(dst_type);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(buf)
+ if (buf)
HDfree(buf);
/* Restore the default error handler (set in h5_reset()) */
@@ -4367,7 +4803,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_str_2
*
@@ -4384,24 +4819,27 @@ error:
static int
test_conv_str_2(void)
{
- char *buf = NULL, s[80];
+ char * buf = NULL, s[80];
hid_t c_type = -1;
- hid_t f_type = -1;
- const size_t nelmts = NTESTELEM;
- size_t i, j, nchars;
- int ret_value = 1;
+ hid_t f_type = -1;
+ const size_t nelmts = NTESTELEM;
+ size_t i, j, nchars;
+ int ret_value = 1;
/*
* Initialize types and buffer.
*/
- if((c_type = mkstr((size_t)8, H5T_STR_NULLPAD)) < 0) goto error;
- if((f_type = mkstr((size_t)8, H5T_STR_SPACEPAD)) < 0) goto error;
- if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8))) goto error;
- for(i = 0; i < nelmts; i++) {
- nchars = (size_t)(HDrand() % 8);
- for(j = 0; j < nchars; j++)
- buf[i * 8 + j] = (char)('a' + HDrand() % 26);
- while(j < nchars)
+ if ((c_type = mkstr((size_t)8, H5T_STR_NULLPAD)) < 0)
+ goto error;
+ if ((f_type = mkstr((size_t)8, H5T_STR_SPACEPAD)) < 0)
+ goto error;
+ if (NULL == (buf = (char *)HDcalloc(nelmts, (size_t)8)))
+ goto error;
+ for (i = 0; i < nelmts; i++) {
+ nchars = (size_t)(HDrand() % 8);
+ for (j = 0; j < nchars; j++)
+ buf[i * 8 + j] = (char)('a' + HDrand() % 26);
+ while (j < nchars)
buf[i * 8 + j++] = '\0';
} /* end for */
@@ -4409,21 +4847,23 @@ test_conv_str_2(void)
HDsprintf(s, "Testing random string conversion speed");
HDprintf("%-70s", s);
HDfflush(stdout);
- if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if(H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ if (H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
PASSED();
ret_value = 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(c_type);
H5Tclose(f_type);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(buf)
+ if (buf)
HDfree(buf);
/* Restore the default error handler (set in h5_reset()) */
@@ -4434,7 +4874,6 @@ error:
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_str_3
*
@@ -4452,81 +4891,83 @@ error:
static int
test_conv_str_3(void)
{
- char *buf=NULL;
- hid_t type = -1;
- hid_t super = -1;
- const size_t nelmts = NTESTELEM;
- size_t i, j, nchars;
- int ret_value = 1;
- size_t size;
- H5T_pad_t inpad;
- H5T_sign_t sign;
- char *tag = NULL;
- herr_t ret;
+ char * buf = NULL;
+ hid_t type = -1;
+ hid_t super = -1;
+ const size_t nelmts = NTESTELEM;
+ size_t i, j, nchars;
+ int ret_value = 1;
+ size_t size;
+ H5T_pad_t inpad;
+ H5T_sign_t sign;
+ char * tag = NULL;
+ herr_t ret;
TESTING("some type functions for string");
/*
* Initialize types and buffer.
*/
- if((type = mkstr((size_t)8, H5T_STR_NULLPAD)) < 0) goto error;
- if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8)))
+ if ((type = mkstr((size_t)8, H5T_STR_NULLPAD)) < 0)
+ goto error;
+ if (NULL == (buf = (char *)HDcalloc(nelmts, (size_t)8)))
FAIL_PUTS_ERROR("Allocation failed.");
- for(i = 0; i < nelmts; i++) {
- nchars = (size_t)(HDrand() % 8);
- for(j = 0; j < nchars; j++)
- buf[i * 8 + j] = (char)('a' + HDrand() % 26);
- while(j < nchars)
+ for (i = 0; i < nelmts; i++) {
+ nchars = (size_t)(HDrand() % 8);
+ for (j = 0; j < nchars; j++)
+ buf[i * 8 + j] = (char)('a' + HDrand() % 26);
+ while (j < nchars)
buf[i * 8 + j++] = '\0';
} /* end for */
- if(H5Tget_precision(type) == 0) FAIL_STACK_ERROR
- if(H5Tget_size(type) == 0) FAIL_STACK_ERROR
- if(H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE) < 0) FAIL_STACK_ERROR
- if(H5Tget_cset(type) < 0) FAIL_STACK_ERROR
- if(H5Tget_strpad(type) < 0) FAIL_STACK_ERROR
- if(H5Tset_offset(type, (size_t)0) < 0) FAIL_STACK_ERROR
- if(H5Tget_order(type) < 0) FAIL_STACK_ERROR
-
- H5E_BEGIN_TRY {
- ret = H5Tset_precision(type, nelmts);
- } H5E_END_TRY;
- if(ret >= 0) {
+ if (H5Tget_precision(type) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tget_size(type) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tget_cset(type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tget_strpad(type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tset_offset(type, (size_t)0) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tget_order(type) < 0)
+ FAIL_STACK_ERROR
+
+ H5E_BEGIN_TRY { ret = H5Tset_precision(type, nelmts); }
+ H5E_END_TRY;
+ if (ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- size = H5Tget_ebias(type);
- } H5E_END_TRY;
- if(size > 0) {
+ H5E_BEGIN_TRY { size = H5Tget_ebias(type); }
+ H5E_END_TRY;
+ if (size > 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- inpad = H5Tget_inpad(type);
- } H5E_END_TRY;
- if(inpad > -1) {
+ H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); }
+ H5E_END_TRY;
+ if (inpad > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- sign = H5Tget_sign(type);
- } H5E_END_TRY;
- if(sign > -1) {
+ H5E_BEGIN_TRY { sign = H5Tget_sign(type); }
+ H5E_END_TRY;
+ if (sign > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- tag = H5Tget_tag(type);
- } H5E_END_TRY;
- if(tag) {
+ H5E_BEGIN_TRY { tag = H5Tget_tag(type); }
+ H5E_END_TRY;
+ if (tag) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- super = H5Tget_super(type);
- } H5E_END_TRY;
- if(super >= 0) {
+ H5E_BEGIN_TRY { super = H5Tget_super(type); }
+ H5E_END_TRY;
+ if (super >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
@@ -4534,14 +4975,16 @@ test_conv_str_3(void)
ret_value = 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(type);
H5Tclose(super);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(buf)
+ if (buf)
HDfree(buf);
- if(tag)
+ if (tag)
H5free_memory(tag); /* Technically allocated by API call */
/* Restore the default error handler (set in h5_reset()) */
@@ -4549,10 +4992,9 @@ error:
reset_hdf5();
- return ret_value; /* Number of errors */
+ return ret_value; /* Number of errors */
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_enum_1
*
@@ -4572,52 +5014,58 @@ error:
static int
test_conv_enum_1(void)
{
- const size_t nelmts=NTESTELEM;
- int i, val, *buf=NULL;
- hid_t t1 = -1;
- hid_t t2 = -1;
- char s[80];
- int ret_value = 1;
- size_t u;
+ const size_t nelmts = NTESTELEM;
+ int i, val, *buf = NULL;
+ hid_t t1 = -1;
+ hid_t t2 = -1;
+ char s[80];
+ int ret_value = 1;
+ size_t u;
/* Build the datatypes */
- if((t1 = H5Tcreate(H5T_ENUM, sizeof(int))) < 0) goto error;
- if((t2 = H5Tenum_create(H5T_NATIVE_INT)) < 0) goto error;
+ if ((t1 = H5Tcreate(H5T_ENUM, sizeof(int))) < 0)
+ goto error;
+ if ((t2 = H5Tenum_create(H5T_NATIVE_INT)) < 0)
+ goto error;
s[1] = '\0';
- for(i = 0; i < 26; i++) {
- s[0] = (char)('A' + i);
- H5Tenum_insert(t1, s, &i);
- H5Tenum_insert(t2, s, (val = i * 1000 + i, &val));
+ for (i = 0; i < 26; i++) {
+ s[0] = (char)('A' + i);
+ H5Tenum_insert(t1, s, &i);
+ H5Tenum_insert(t2, s, (val = i * 1000 + i, &val));
} /* end for */
/* Initialize the buffer */
- if(NULL == (buf = (int*)HDmalloc(nelmts * MAX(H5Tget_size(t1), H5Tget_size(t2)))))
+ if (NULL == (buf = (int *)HDmalloc(nelmts * MAX(H5Tget_size(t1), H5Tget_size(t2)))))
goto error;
- for(u = 0; u < nelmts; u++)
+ for (u = 0; u < nelmts; u++)
buf[u] = HDrand() % 26;
/* Conversions */
HDsprintf(s, "Testing random enum conversion O(N)");
HDprintf("%-70s", s);
HDfflush(stdout);
- if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
PASSED();
HDsprintf(s, "Testing random enum conversion O(N log N)");
HDprintf("%-70s", s);
HDfflush(stdout);
- if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
PASSED();
ret_value = 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(t1);
H5Tclose(t2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(buf)
+ if (buf)
HDfree(buf);
/* Restore the default error handler (set in h5_reset()) */
@@ -4628,7 +5076,6 @@ error:
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_enum_2
*
@@ -4644,16 +5091,9 @@ error:
static int
test_conv_enum_2(void)
{
- hid_t srctype=-1, dsttype=-1, oddsize=-1;
- int *data=NULL, i, nerrors=0;
- const char *mname[] = { "RED",
- "GREEN",
- "BLUE",
- "YELLOW",
- "PINK",
- "PURPLE",
- "ORANGE",
- "WHITE" };
+ hid_t srctype = -1, dsttype = -1, oddsize = -1;
+ int * data = NULL, i, nerrors = 0;
+ const char *mname[] = {"RED", "GREEN", "BLUE", "YELLOW", "PINK", "PURPLE", "ORANGE", "WHITE"};
TESTING("non-native enumeration type conversion");
@@ -4661,7 +5101,7 @@ test_conv_enum_2(void)
oddsize = H5Tcopy(H5T_STD_I32BE);
H5Tset_size(oddsize, (size_t)3); /*reduce to 24 bits, not corresponding to any native size*/
srctype = H5Tenum_create(oddsize);
- for (i=7; i>=0; --i) {
+ for (i = 7; i >= 0; --i) {
char pattern[3];
pattern[2] = (char)i;
pattern[0] = pattern[1] = 0;
@@ -4671,27 +5111,26 @@ test_conv_enum_2(void)
/* Destination enum type */
dsttype = H5Tenum_create(H5T_NATIVE_INT);
HDassert(H5Tget_size(dsttype) > H5Tget_size(srctype));
- for (i=0; i<8; i++)
+ for (i = 0; i < 8; i++)
H5Tenum_insert(dsttype, mname[i], &i);
/* Source data */
- data = (int*)HDmalloc(NTESTELEM*sizeof(int));
- for (i=0; i<NTESTELEM; i++) {
- ((char*)data)[i*3+2] = (char)(i % 8);
- ((char*)data)[i*3+0] = 0;
- ((char*)data)[i*3+1] = 0;
+ data = (int *)HDmalloc(NTESTELEM * sizeof(int));
+ for (i = 0; i < NTESTELEM; i++) {
+ ((char *)data)[i * 3 + 2] = (char)(i % 8);
+ ((char *)data)[i * 3 + 0] = 0;
+ ((char *)data)[i * 3 + 1] = 0;
}
/* Convert to destination type */
H5Tconvert(srctype, dsttype, (size_t)NTESTELEM, data, NULL, H5P_DEFAULT);
/* Check results */
- for (i=0; i<NTESTELEM; i++) {
- if (data[i] != i%8) {
+ for (i = 0; i < NTESTELEM; i++) {
+ if (data[i] != i % 8) {
if (!nerrors++) {
H5_FAILED();
- HDprintf("element %d is %d but should have been %d\n",
- i, data[i], i%8);
+ HDprintf("element %d is %d but should have been %d\n", i, data[i], i % 8);
}
}
}
@@ -4704,8 +5143,7 @@ test_conv_enum_2(void)
/* Failure */
if (nerrors) {
- HDprintf("total of %d conversion errors out of %d elements for enums\n",
- nerrors, NTESTELEM);
+ HDprintf("total of %d conversion errors out of %d elements for enums\n", nerrors, NTESTELEM);
return 1;
}
@@ -4713,7 +5151,6 @@ test_conv_enum_2(void)
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: test_conv_bitfield
*
@@ -4729,8 +5166,8 @@ test_conv_enum_2(void)
static int
test_conv_bitfield(void)
{
- unsigned char buf[4];
- hid_t st=-1, dt=-1;
+ unsigned char buf[4];
+ hid_t st = -1, dt = -1;
TESTING("bitfield conversions");
@@ -4739,12 +5176,13 @@ test_conv_bitfield(void)
* 1010101010101010
* ________________1010101010101010
*/
- st = H5Tcopy(H5T_STD_B16LE);
- dt = H5Tcopy(H5T_STD_B32LE);
+ st = H5Tcopy(H5T_STD_B16LE);
+ dt = H5Tcopy(H5T_STD_B32LE);
buf[0] = buf[1] = 0xAA;
buf[2] = buf[3] = 0x55; /*irrelevant*/
- if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) {
+ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ if (buf[0] != 0xAA || buf[1] != 0xAA || buf[2] != 0 || buf[3] != 0) {
H5_FAILED();
HDprintf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", buf[3], buf[2], buf[1], buf[0]);
goto error;
@@ -4760,9 +5198,12 @@ test_conv_bitfield(void)
H5Tset_offset(st, (size_t)2);
H5Tset_precision(dt, (size_t)12);
H5Tset_offset(dt, (size_t)10);
- buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
- if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) {
+ buf[0] = 0xA8;
+ buf[1] = 0x2A;
+ buf[2] = buf[3] = 0;
+ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ if (buf[0] != 0 || buf[1] != 0xA8 || buf[2] != 0x2A || buf[3] != 0) {
H5_FAILED();
HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", buf[3], buf[2], buf[1], buf[0]);
goto error;
@@ -4773,9 +5214,12 @@ test_conv_bitfield(void)
* be filled with ones.
*/
H5Tset_pad(dt, H5T_PAD_ONE, H5T_PAD_ONE);
- buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
- if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) {
+ buf[0] = 0xA8;
+ buf[1] = 0x2A;
+ buf[2] = buf[3] = 0;
+ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ if (buf[0] != 0xff || buf[1] != 0xAB || buf[2] != 0xEA || buf[3] != 0xff) {
H5_FAILED();
HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", buf[3], buf[2], buf[1], buf[0]);
goto error;
@@ -4803,7 +5247,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_bitfield_funcs
*
@@ -4820,92 +5263,92 @@ error:
static int
test_bitfield_funcs(void)
{
- hid_t type=-1, ntype=-1, super=-1;
- size_t size;
- char* tag=0;
- H5T_pad_t inpad;
- H5T_cset_t cset;
- H5T_str_t strpad;
- herr_t ret;
- int retval=-1;
+ hid_t type = -1, ntype = -1, super = -1;
+ size_t size;
+ char * tag = 0;
+ H5T_pad_t inpad;
+ H5T_cset_t cset;
+ H5T_str_t strpad;
+ herr_t ret;
+ int retval = -1;
TESTING("some type functions for bitfield");
/*
* First create a bitfield type.
*/
- if((type = H5Tcopy(H5T_STD_B32LE)) < 0) goto error;
+ if ((type = H5Tcopy(H5T_STD_B32LE)) < 0)
+ goto error;
/*
* Offset a 12-byte value in the middle of a 16 and 32 byte
* field. Pad unused bits with ones.
* ____ ____ __10 1010 1010 10__ ____ ____
*/
- if(H5Tset_precision(type, (size_t)12) < 0) goto error;
- if(H5Tset_offset(type, (size_t)10) < 0) goto error;
- if(H5Tset_pad(type, H5T_PAD_ONE, H5T_PAD_ONE)) goto error;
- if((size=H5Tget_size(type))==0) goto error;
- if(H5Tset_order(type, H5T_ORDER_BE) < 0) goto error;
- if((ntype = H5Tget_native_type(type, H5T_DIR_ASCEND)) < 0) goto error;
-
- H5E_BEGIN_TRY {
- size=H5Tget_ebias(type);
- } H5E_END_TRY;
- if (size>0) {
+ if (H5Tset_precision(type, (size_t)12) < 0)
+ goto error;
+ if (H5Tset_offset(type, (size_t)10) < 0)
+ goto error;
+ if (H5Tset_pad(type, H5T_PAD_ONE, H5T_PAD_ONE))
+ goto error;
+ if ((size = H5Tget_size(type)) == 0)
+ goto error;
+ if (H5Tset_order(type, H5T_ORDER_BE) < 0)
+ goto error;
+ if ((ntype = H5Tget_native_type(type, H5T_DIR_ASCEND)) < 0)
+ goto error;
+
+ H5E_BEGIN_TRY { size = H5Tget_ebias(type); }
+ H5E_END_TRY;
+ if (size > 0) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- inpad=H5Tget_inpad(type);
- } H5E_END_TRY;
- if (inpad>-1) {
+ H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); }
+ H5E_END_TRY;
+ if (inpad > -1) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- cset=H5Tget_cset(type);
- } H5E_END_TRY;
- if (cset>-1) {
+ H5E_BEGIN_TRY { cset = H5Tget_cset(type); }
+ H5E_END_TRY;
+ if (cset > -1) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- strpad=H5Tget_strpad(type);
- } H5E_END_TRY;
- if (strpad>-1) {
+ H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); }
+ H5E_END_TRY;
+ if (strpad > -1) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- ret=H5Tset_sign(type, H5T_SGN_2);
- } H5E_END_TRY;
- if(ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_sign(type, H5T_SGN_2); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- tag = H5Tget_tag(type);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tag = H5Tget_tag(type); }
+ H5E_END_TRY;
if (tag) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- super = H5Tget_super(type);
- } H5E_END_TRY;
- if (super>=0) {
+ H5E_BEGIN_TRY { super = H5Tget_super(type); }
+ H5E_END_TRY;
+ if (super >= 0) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
@@ -4914,11 +5357,13 @@ test_bitfield_funcs(void)
retval = 0;
error:
- if (retval == -1) retval = 1;
+ if (retval == -1)
+ retval = 1;
H5free_memory(tag);
H5Tclose(ntype);
H5Tclose(type);
- if (retval == 0) PASSED();
+ if (retval == 0)
+ PASSED();
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -4928,7 +5373,6 @@ error:
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: convert_opaque
*
@@ -4943,16 +5387,15 @@ error:
*/
static herr_t
convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cdata,
- size_t H5_ATTR_UNUSED nelmts, size_t H5_ATTR_UNUSED buf_stride,
- size_t H5_ATTR_UNUSED bkg_stride, void H5_ATTR_UNUSED *_buf,
- void H5_ATTR_UNUSED *bkg, hid_t H5_ATTR_UNUSED dset_xfer_plid)
+ size_t H5_ATTR_UNUSED nelmts, size_t H5_ATTR_UNUSED buf_stride,
+ size_t H5_ATTR_UNUSED bkg_stride, void H5_ATTR_UNUSED *_buf, void H5_ATTR_UNUSED *bkg,
+ hid_t H5_ATTR_UNUSED dset_xfer_plid)
{
- if (H5T_CONV_CONV==cdata->command)
+ if (H5T_CONV_CONV == cdata->command)
num_opaque_conversions_g++;
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: test_opaque
*
@@ -4981,17 +5424,16 @@ test_opaque(void)
/* Test some type functions with opaque type */
num_errors += opaque_funcs();
- if(num_errors)
+ if (num_errors)
goto error;
PASSED();
return 0;
- error:
+error:
return num_errors;
}
-
/*-------------------------------------------------------------------------
* Function: opaque_check
*
@@ -5008,28 +5450,30 @@ static int
opaque_check(int tag_it)
{
#define OPAQUE_NELMTS 1000
- hid_t st=-1, dt=-1;
- herr_t status;
- char buf[1]; /*not really used*/
- int saved;
+ hid_t st = -1, dt = -1;
+ herr_t status;
+ char buf[1]; /*not really used*/
+ int saved;
saved = num_opaque_conversions_g = 0;
/* Build source and destination types */
- if ((st=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) goto error;
- if (H5Tset_tag(st, "opaque source type") < 0) goto error;
+ if ((st = H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0)
+ goto error;
+ if (H5Tset_tag(st, "opaque source type") < 0)
+ goto error;
- if ((dt=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) goto error;
+ if ((dt = H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0)
+ goto error;
if (tag_it) {
if (H5Tset_tag(dt, "opaque destination type") < 0)
goto error;
}
/* Make sure that we can't convert between the types yet */
- H5E_BEGIN_TRY {
- status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
- } H5E_END_TRY;
- if (status>=0) {
+ H5E_BEGIN_TRY { status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
HDprintf(" opaque conversion should have failed but succeeded\n");
goto error;
@@ -5040,8 +5484,9 @@ opaque_check(int tag_it)
goto error;
/* Try the conversion again, this time it should work */
- if (H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (saved+1 != num_opaque_conversions_g) {
+ if (H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ if (saved + 1 != num_opaque_conversions_g) {
H5_FAILED();
HDprintf(" unexpected number of opaque conversions\n");
goto error;
@@ -5055,14 +5500,15 @@ opaque_check(int tag_it)
H5Tclose(dt);
return 0;
- error:
- if (st>0) H5Tclose(st);
- if (dt>0) H5Tclose(dt);
+error:
+ if (st > 0)
+ H5Tclose(st);
+ if (dt > 0)
+ H5Tclose(dt);
H5_FAILED();
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: opaque_long
*
@@ -5079,26 +5525,29 @@ opaque_check(int tag_it)
static int
opaque_long(void)
{
- char *long_tag = NULL;
- hid_t dt = -1;
- herr_t ret;
+ char * long_tag = NULL;
+ hid_t dt = -1;
+ herr_t ret;
/* Build opaque type */
- if((dt=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
+ if ((dt = H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0)
+ TEST_ERROR
/* Create long tag */
- if(NULL == (long_tag = (char *)HDmalloc((size_t)(16384 + 1)))) TEST_ERROR
+ if (NULL == (long_tag = (char *)HDmalloc((size_t)(16384 + 1))))
+ TEST_ERROR
HDmemset(long_tag, 'a', (size_t)16384);
long_tag[16384] = '\0';
/* Set opaque type's tag */
- H5E_BEGIN_TRY {
- ret = H5Tset_tag(dt, long_tag);
- } H5E_END_TRY;
- if(ret != FAIL) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Tset_tag(dt, long_tag); }
+ H5E_END_TRY;
+ if (ret != FAIL)
+ TEST_ERROR
/* Close datatype */
- if(H5Tclose(dt) < 0) TEST_ERROR
+ if (H5Tclose(dt) < 0)
+ TEST_ERROR
/* Release memory for tag */
HDfree(long_tag);
@@ -5106,15 +5555,14 @@ opaque_long(void)
return 0;
error:
- if(dt>0)
+ if (dt > 0)
H5Tclose(dt);
- if(long_tag)
+ if (long_tag)
HDfree(long_tag);
H5_FAILED();
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: opaque_funcs
*
@@ -5131,102 +5579,97 @@ error:
static int
opaque_funcs(void)
{
- hid_t type = -1, super=-1;
- size_t size;
- H5T_pad_t inpad;
- H5T_cset_t cset;
- H5T_str_t strpad;
- H5T_sign_t sign;
- herr_t ret;
+ hid_t type = -1, super = -1;
+ size_t size;
+ H5T_pad_t inpad;
+ H5T_cset_t cset;
+ H5T_str_t strpad;
+ H5T_sign_t sign;
+ herr_t ret;
/* Build opaque type */
- if ((type=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
- if (H5Tset_tag(type, "opaque source type") < 0) TEST_ERROR
+ if ((type = H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0)
+ TEST_ERROR
+ if (H5Tset_tag(type, "opaque source type") < 0)
+ TEST_ERROR
- if ((size=H5Tget_size(type))==0) goto error;
+ if ((size = H5Tget_size(type)) == 0)
+ goto error;
- H5E_BEGIN_TRY {
- ret=H5Tset_precision(type, (size_t)32);
- } H5E_END_TRY;
- if (ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_precision(type, (size_t)32); }
+ H5E_END_TRY;
+ if (ret >= 0) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
- } H5E_END_TRY;
- if (ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); }
+ H5E_END_TRY;
+ if (ret >= 0) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- size=H5Tget_ebias(type);
- } H5E_END_TRY;
- if (size>0) {
+ H5E_BEGIN_TRY { size = H5Tget_ebias(type); }
+ H5E_END_TRY;
+ if (size > 0) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- inpad=H5Tget_inpad(type);
- } H5E_END_TRY;
- if (inpad>-1) {
+ H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); }
+ H5E_END_TRY;
+ if (inpad > -1) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- cset=H5Tget_cset(type);
- } H5E_END_TRY;
- if (cset>-1) {
+ H5E_BEGIN_TRY { cset = H5Tget_cset(type); }
+ H5E_END_TRY;
+ if (cset > -1) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- strpad=H5Tget_strpad(type);
- } H5E_END_TRY;
- if (strpad>-1) {
+ H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); }
+ H5E_END_TRY;
+ if (strpad > -1) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- ret=H5Tset_offset(type, (size_t)16);
- } H5E_END_TRY;
- if (ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_offset(type, (size_t)16); }
+ H5E_END_TRY;
+ if (ret >= 0) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- sign = H5Tget_sign(type);
- } H5E_END_TRY;
- if (sign>-1) {
+ H5E_BEGIN_TRY { sign = H5Tget_sign(type); }
+ H5E_END_TRY;
+ if (sign > -1) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- super = H5Tget_super(type);
- } H5E_END_TRY;
- if (super>=0) {
+ H5E_BEGIN_TRY { super = H5Tget_super(type); }
+ H5E_END_TRY;
+ if (super >= 0) {
HDprintf("Operation not allowed for this type.\n");
TEST_ERROR
} /* end if */
/* Close datatype */
- if(H5Tclose(type) < 0) TEST_ERROR
+ if (H5Tclose(type) < 0)
+ TEST_ERROR
return 0;
- error:
- if (type>0) H5Tclose(type);
+error:
+ if (type > 0)
+ H5Tclose(type);
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_encode
*
@@ -5257,24 +5700,24 @@ test_encode(void)
long c;
double d;
};
- hid_t file=-1, tid1=-1, tid2=-1, tid3=-1;
- hid_t decoded_tid1=-1, decoded_tid2=-1, decoded_tid3=-1;
- char filename[1024];
- char compnd_type[]="Compound_type", enum_type[]="Enum_type";
- char vlstr_type[]="VLstring_type";
- short enum_val;
- size_t cmpd_buf_size = 0;
- size_t enum_buf_size = 0;
- size_t vlstr_buf_size = 0;
- unsigned char *cmpd_buf=NULL, *enum_buf=NULL, *vlstr_buf=NULL;
- hid_t ret_id;
- herr_t ret;
+ hid_t file = -1, tid1 = -1, tid2 = -1, tid3 = -1;
+ hid_t decoded_tid1 = -1, decoded_tid2 = -1, decoded_tid3 = -1;
+ char filename[1024];
+ char compnd_type[] = "Compound_type", enum_type[] = "Enum_type";
+ char vlstr_type[] = "VLstring_type";
+ short enum_val;
+ size_t cmpd_buf_size = 0;
+ size_t enum_buf_size = 0;
+ size_t vlstr_buf_size = 0;
+ unsigned char *cmpd_buf = NULL, *enum_buf = NULL, *vlstr_buf = NULL;
+ hid_t ret_id;
+ herr_t ret;
TESTING("functions of encoding and decoding datatypes");
/* Create File */
h5_fixname(FILENAME[5], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/*-----------------------------------------------------------------------
@@ -5282,71 +5725,71 @@ test_encode(void)
*-----------------------------------------------------------------------
*/
/* Create a compound datatype */
- if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) {
+ if ((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) {
H5_FAILED();
HDprintf("Can't create datatype!\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) {
+ if (H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'a'\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) {
+ if (H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'b'\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) {
+ if (H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'c'\n");
goto error;
} /* end if */
- if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) {
+ if (H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) {
H5_FAILED();
HDprintf("Can't insert field 'd'\n");
goto error;
} /* end if */
/* Create a enumerate datatype */
- if((tid2=H5Tcreate(H5T_ENUM, sizeof(short))) < 0) {
+ if ((tid2 = H5Tcreate(H5T_ENUM, sizeof(short))) < 0) {
H5_FAILED();
HDprintf("Can't create enumerate type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "RED", (enum_val = 0, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "GREEN", (enum_val = 1, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "BLUE", (enum_val = 2, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "ORANGE", (enum_val = 3, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
- if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val)) < 0) {
+ if (H5Tenum_insert(tid2, "YELLOW", (enum_val = 4, &enum_val)) < 0) {
H5_FAILED();
HDprintf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
/* Create a variable-length string type */
- if((tid3 = H5Tcopy(H5T_C_S1)) < 0) {
+ if ((tid3 = H5Tcopy(H5T_C_S1)) < 0) {
H5_FAILED();
HDprintf("Can't copy a string type\n");
goto error;
} /* end if */
- if(H5Tset_size(tid3, H5T_VARIABLE) < 0) {
+ if (H5Tset_size(tid3, H5T_VARIABLE) < 0) {
H5_FAILED();
HDprintf("Can't the string type to be variable-length\n");
goto error;
@@ -5357,128 +5800,125 @@ test_encode(void)
*-----------------------------------------------------------------------
*/
/* Encode compound type in a buffer */
- if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) {
+ if (H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode compound type\n");
goto error;
} /* end if */
- if(cmpd_buf_size>0)
- cmpd_buf = (unsigned char*)HDcalloc((size_t)1, cmpd_buf_size);
+ if (cmpd_buf_size > 0)
+ cmpd_buf = (unsigned char *)HDcalloc((size_t)1, cmpd_buf_size);
/* Try decoding bogus buffer */
- H5E_BEGIN_TRY {
- ret_id = H5Tdecode(cmpd_buf);
- } H5E_END_TRY;
- if(ret_id!=FAIL) {
+ H5E_BEGIN_TRY { ret_id = H5Tdecode(cmpd_buf); }
+ H5E_END_TRY;
+ if (ret_id != FAIL) {
H5_FAILED();
HDprintf("Decoded bogus buffer!\n");
goto error;
}
- if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) {
+ if (H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode compound type\n");
goto error;
} /* end if */
/* Decode from the compound buffer and return an object handle */
- if((decoded_tid1 = H5Tdecode(cmpd_buf)) < 0)
+ if ((decoded_tid1 = H5Tdecode(cmpd_buf)) < 0)
FAIL_PUTS_ERROR("Can't decode compound type\n")
/* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid1, tid1)<=0) {
+ if (H5Tequal(decoded_tid1, tid1) <= 0) {
H5_FAILED();
HDprintf("Datatype wasn't encoded & decoded identically\n");
goto error;
} /* end if */
/* Query member number and member index by name, for compound type. */
- if(H5Tget_nmembers(decoded_tid1)!=4) {
+ if (H5Tget_nmembers(decoded_tid1) != 4) {
H5_FAILED();
HDprintf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(decoded_tid1, "c")!=2) {
+ if (H5Tget_member_index(decoded_tid1, "c") != 2) {
H5_FAILED();
HDprintf("Can't get correct index number\n");
goto error;
} /* end if */
-
/* Encode enumerate type in a buffer */
- if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) {
+ if (H5Tencode(tid2, NULL, &enum_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode enumerate type\n");
goto error;
} /* end if */
- if(enum_buf_size>0)
- enum_buf = (unsigned char*)HDcalloc((size_t)1, enum_buf_size);
+ if (enum_buf_size > 0)
+ enum_buf = (unsigned char *)HDcalloc((size_t)1, enum_buf_size);
- if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
+ if (H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode enumerate type\n");
goto error;
} /* end if */
/* Decode from the enumerate buffer and return an object handle */
- if((decoded_tid2=H5Tdecode(enum_buf)) < 0) {
+ if ((decoded_tid2 = H5Tdecode(enum_buf)) < 0) {
H5_FAILED();
HDprintf("Can't decode enumerate type\n");
goto error;
} /* end if */
/* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid2, tid2)<=0) {
+ if (H5Tequal(decoded_tid2, tid2) <= 0) {
H5_FAILED();
HDprintf("Datatype wasn't encoded & decoded identically\n");
goto error;
} /* end if */
/* Query member number and member index by name, for enumeration type. */
- if(H5Tget_nmembers(decoded_tid2)!=5) {
+ if (H5Tget_nmembers(decoded_tid2) != 5) {
H5_FAILED();
HDprintf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(decoded_tid2, "ORANGE") != 3) {
+ if (H5Tget_member_index(decoded_tid2, "ORANGE") != 3) {
H5_FAILED();
HDprintf("Can't get correct index number\n");
goto error;
} /* end if */
-
/* Encode VL string type in a buffer */
- if(H5Tencode(tid3, NULL, &vlstr_buf_size) < 0) {
+ if (H5Tencode(tid3, NULL, &vlstr_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode VL string type\n");
goto error;
} /* end if */
- if(vlstr_buf_size>0)
- vlstr_buf = (unsigned char*)HDcalloc((size_t)1, vlstr_buf_size);
+ if (vlstr_buf_size > 0)
+ vlstr_buf = (unsigned char *)HDcalloc((size_t)1, vlstr_buf_size);
- if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
+ if (H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode VL string type\n");
goto error;
} /* end if */
/* Decode from the VL string buffer and return an object handle */
- if((decoded_tid3=H5Tdecode(vlstr_buf)) < 0) {
+ if ((decoded_tid3 = H5Tdecode(vlstr_buf)) < 0) {
H5_FAILED();
HDprintf("Can't decode VL string type\n");
goto error;
} /* end if */
/* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid3, tid3)<=0) {
+ if (H5Tequal(decoded_tid3, tid3) <= 0) {
H5_FAILED();
HDprintf("Datatype wasn't encoded & decoded identically\n");
goto error;
} /* end if */
- if(!H5Tis_variable_str(decoded_tid3)) {
+ if (!H5Tis_variable_str(decoded_tid3)) {
H5_FAILED();
HDprintf("Datatype wasn't encoded & decoded identically\n");
goto error;
@@ -5489,17 +5929,17 @@ test_encode(void)
*-----------------------------------------------------------------------
*/
/* Commit compound datatype and close it */
- if(H5Tcommit2(file, compnd_type, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Tcommit2(file, compnd_type, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Can't commit compound datatype\n");
goto error;
} /* end if */
- if(H5Tclose(tid1) < 0) {
+ if (H5Tclose(tid1) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(decoded_tid1) < 0) {
+ if (H5Tclose(decoded_tid1) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
@@ -5508,17 +5948,17 @@ test_encode(void)
cmpd_buf_size = 0;
/* Commit enumeration datatype and close it */
- if(H5Tcommit2(file, enum_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Tcommit2(file, enum_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Can't commit compound datatype\n");
goto error;
} /* end if */
- if(H5Tclose(tid2) < 0) {
+ if (H5Tclose(tid2) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(decoded_tid2) < 0) {
+ if (H5Tclose(decoded_tid2) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
@@ -5527,17 +5967,17 @@ test_encode(void)
enum_buf_size = 0;
/* Commit enumeration datatype and close it */
- if(H5Tcommit2(file, vlstr_type, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Tcommit2(file, vlstr_type, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Can't commit vl string datatype\n");
goto error;
} /* end if */
- if(H5Tclose(tid3) < 0) {
+ if (H5Tclose(tid3) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(decoded_tid3) < 0) {
+ if (H5Tclose(decoded_tid3) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
@@ -5546,11 +5986,11 @@ test_encode(void)
vlstr_buf_size = 0;
/* Open the dataytpe for query */
- if((tid1 = H5Topen2(file, compnd_type, H5P_DEFAULT)) < 0)
+ if ((tid1 = H5Topen2(file, compnd_type, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((tid2 = H5Topen2(file, enum_type, H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(file, enum_type, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((tid3 = H5Topen2(file, vlstr_type, H5P_DEFAULT)) < 0)
+ if ((tid3 = H5Topen2(file, vlstr_type, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/*-----------------------------------------------------------------------
@@ -5558,104 +5998,104 @@ test_encode(void)
*-----------------------------------------------------------------------
*/
/* Encode compound type in a buffer */
- if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) {
+ if (H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode compound type\n");
goto error;
} /* end if */
- if(cmpd_buf_size>0)
- cmpd_buf = (unsigned char*)HDcalloc((size_t)1, cmpd_buf_size);
+ if (cmpd_buf_size > 0)
+ cmpd_buf = (unsigned char *)HDcalloc((size_t)1, cmpd_buf_size);
- if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) {
+ if (H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode compound type\n");
goto error;
} /* end if */
/* Decode from the compound buffer and return an object handle */
- if((decoded_tid1 = H5Tdecode(cmpd_buf)) < 0)
+ if ((decoded_tid1 = H5Tdecode(cmpd_buf)) < 0)
FAIL_PUTS_ERROR("Can't decode compound type\n")
/* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid1, tid1)<=0) {
+ if (H5Tequal(decoded_tid1, tid1) <= 0) {
H5_FAILED();
HDprintf("Datatype wasn't encoded & decoded identically\n");
goto error;
} /* end if */
/* Query member number and member index by name, for compound type. */
- if(H5Tget_nmembers(decoded_tid1)!=4) {
+ if (H5Tget_nmembers(decoded_tid1) != 4) {
H5_FAILED();
HDprintf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(decoded_tid1, "c")!=2) {
+ if (H5Tget_member_index(decoded_tid1, "c") != 2) {
H5_FAILED();
HDprintf("Can't get correct index number\n");
goto error;
} /* end if */
/* Encode enumerate type in a buffer */
- if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) {
+ if (H5Tencode(tid2, NULL, &enum_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode enumerate type\n");
goto error;
} /* end if */
- if(enum_buf_size>0)
- enum_buf = (unsigned char*)HDcalloc((size_t)1, enum_buf_size);
+ if (enum_buf_size > 0)
+ enum_buf = (unsigned char *)HDcalloc((size_t)1, enum_buf_size);
- if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
+ if (H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode enumerate type\n");
goto error;
} /* end if */
/* Decode from the enumerate buffer and return an object handle */
- if((decoded_tid2=H5Tdecode(enum_buf)) < 0) {
+ if ((decoded_tid2 = H5Tdecode(enum_buf)) < 0) {
H5_FAILED();
HDprintf("Can't decode enumerate type\n");
goto error;
} /* end if */
/* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid2, tid2)<=0) {
+ if (H5Tequal(decoded_tid2, tid2) <= 0) {
H5_FAILED();
HDprintf("Datatype wasn't encoded & decoded identically\n");
goto error;
} /* end if */
/* Query member number and member index by name, for enumeration type. */
- if(H5Tget_nmembers(decoded_tid2)!=5) {
+ if (H5Tget_nmembers(decoded_tid2) != 5) {
H5_FAILED();
HDprintf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) {
+ if (H5Tget_member_index(decoded_tid2, "ORANGE") != 3) {
H5_FAILED();
HDprintf("Can't get correct index number\n");
goto error;
} /* end if */
/* Encode VL string type in a buffer */
- if(H5Tencode(tid3, NULL, &vlstr_buf_size) < 0) {
+ if (H5Tencode(tid3, NULL, &vlstr_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode VL string type\n");
goto error;
} /* end if */
- if(vlstr_buf_size > 0)
- vlstr_buf = (unsigned char*)HDcalloc((size_t)1, vlstr_buf_size);
+ if (vlstr_buf_size > 0)
+ vlstr_buf = (unsigned char *)HDcalloc((size_t)1, vlstr_buf_size);
- if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
+ if (H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
H5_FAILED();
HDprintf("Can't encode VL string type\n");
goto error;
} /* end if */
/* Decode from the VL string buffer and return an object handle */
- if((decoded_tid3=H5Tdecode(vlstr_buf)) < 0) {
+ if ((decoded_tid3 = H5Tdecode(vlstr_buf)) < 0) {
H5_FAILED();
HDprintf("Can't decode VL string type\n");
goto error;
@@ -5663,12 +6103,12 @@ test_encode(void)
HDfree(vlstr_buf);
/* Verify that the datatype was copied exactly */
- if(H5Tequal(decoded_tid3, tid3)<=0) {
+ if (H5Tequal(decoded_tid3, tid3) <= 0) {
H5_FAILED();
HDprintf("Datatype wasn't encoded & decoded identically\n");
goto error;
} /* end if */
- if(!H5Tis_variable_str(decoded_tid3)) {
+ if (!H5Tis_variable_str(decoded_tid3)) {
H5_FAILED();
HDprintf("Datatype wasn't encoded & decoded identically\n");
goto error;
@@ -5680,19 +6120,19 @@ test_encode(void)
*/
/* Make sure the reference counts for the decoded datatypes are one. */
- if(H5Iget_ref(decoded_tid1) != 1) {
+ if (H5Iget_ref(decoded_tid1) != 1) {
H5_FAILED();
HDprintf("Decoded datatype has incorrect reference count\n");
goto error;
} /* end if */
- if(H5Iget_ref(decoded_tid2) != 1) {
+ if (H5Iget_ref(decoded_tid2) != 1) {
H5_FAILED();
HDprintf("Decoded datatype has incorrect reference count\n");
goto error;
} /* end if */
- if(H5Iget_ref(decoded_tid3) != 1) {
+ if (H5Iget_ref(decoded_tid3) != 1) {
H5_FAILED();
HDprintf("Decoded datatype has incorrect reference count\n");
goto error;
@@ -5700,47 +6140,44 @@ test_encode(void)
/* Make sure the reference counts for the decoded datatypes can be
* decremented and the datatypes are closed. */
- if(H5Idec_ref(decoded_tid1) != 0) {
+ if (H5Idec_ref(decoded_tid1) != 0) {
H5_FAILED();
HDprintf("Decoded datatype can't close\n");
goto error;
} /* end if */
- if(H5Idec_ref(decoded_tid2) != 0) {
+ if (H5Idec_ref(decoded_tid2) != 0) {
H5_FAILED();
HDprintf("Decoded datatype can't close\n");
goto error;
} /* end if */
- if(H5Idec_ref(decoded_tid3) != 0) {
+ if (H5Idec_ref(decoded_tid3) != 0) {
H5_FAILED();
HDprintf("Decoded datatype can't close\n");
goto error;
} /* end if */
/* Make sure the decoded datatypes are already closed. */
- H5E_BEGIN_TRY {
- ret = H5Tclose(decoded_tid1);
- } H5E_END_TRY;
- if(ret!=FAIL) {
+ H5E_BEGIN_TRY { ret = H5Tclose(decoded_tid1); }
+ H5E_END_TRY;
+ if (ret != FAIL) {
H5_FAILED();
HDprintf("Decoded datatype should have been closed\n");
goto error;
}
- H5E_BEGIN_TRY {
- ret = H5Tclose(decoded_tid2);
- } H5E_END_TRY;
- if(ret!=FAIL) {
+ H5E_BEGIN_TRY { ret = H5Tclose(decoded_tid2); }
+ H5E_END_TRY;
+ if (ret != FAIL) {
H5_FAILED();
HDprintf("Decoded datatype should have been closed\n");
goto error;
}
- H5E_BEGIN_TRY {
- ret = H5Tclose(decoded_tid3);
- } H5E_END_TRY;
- if(ret!=FAIL) {
+ H5E_BEGIN_TRY { ret = H5Tclose(decoded_tid3); }
+ H5E_END_TRY;
+ if (ret != FAIL) {
H5_FAILED();
HDprintf("Decoded datatype should have been closed\n");
goto error;
@@ -5751,23 +6188,23 @@ test_encode(void)
*-----------------------------------------------------------------------
*/
/* Close datatype and file */
- if(H5Tclose(tid1) < 0) {
+ if (H5Tclose(tid1) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(tid2) < 0) {
+ if (H5Tclose(tid2) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(tid3) < 0) {
+ if (H5Tclose(tid3) < 0) {
H5_FAILED();
HDprintf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Fclose(file) < 0) {
+ if (H5Fclose(file) < 0) {
H5_FAILED();
HDprintf("Can't close file\n");
goto error;
@@ -5779,20 +6216,21 @@ test_encode(void)
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Tclose (tid1);
- H5Tclose (tid2);
- H5Tclose (tid3);
- H5Tclose (decoded_tid1);
- H5Tclose (decoded_tid2);
- H5Tclose (decoded_tid3);
- H5Fclose (file);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(tid1);
+ H5Tclose(tid2);
+ H5Tclose(tid3);
+ H5Tclose(decoded_tid1);
+ H5Tclose(decoded_tid2);
+ H5Tclose(decoded_tid3);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_latest
*
@@ -5816,155 +6254,153 @@ test_latest(void)
long c;
double d;
};
- hid_t file = (-1); /* File ID */
- hid_t tid1 = (-1), tid2 = (-1); /* Datatype ID */
- hid_t fapl = (-1); /* File access property list */
- H5O_native_info_t oi; /* Stat buffer for committed datatype */
- hsize_t old_dtype_oh_size; /* Size of object header with "old" format */
- hsize_t new_dtype_oh_size; /* Size of object header with "new" format */
- char filename[1024]; /* Buffer for filename */
- const char compnd_type[] = "Compound_type"; /* Name of committed datatype */
+ hid_t file = (-1); /* File ID */
+ hid_t tid1 = (-1), tid2 = (-1); /* Datatype ID */
+ hid_t fapl = (-1); /* File access property list */
+ H5O_native_info_t oi; /* Stat buffer for committed datatype */
+ hsize_t old_dtype_oh_size; /* Size of object header with "old" format */
+ hsize_t new_dtype_oh_size; /* Size of object header with "new" format */
+ char filename[1024]; /* Buffer for filename */
+ const char compnd_type[] = "Compound_type"; /* Name of committed datatype */
TESTING("encoding datatypes with the 'use the latest format' flag");
/* Create a compound datatype */
- if((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0)
+ if ((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0)
+ if (H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0)
+ if (H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0)
+ if (H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0)
FAIL_STACK_ERROR
/* Create file using default FAPL */
h5_fixname(FILENAME[5], H5P_DEFAULT, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Make a copy of the datatype, to commit */
- if((tid2 = H5Tcopy(tid1)) < 0)
+ if ((tid2 = H5Tcopy(tid1)) < 0)
FAIL_STACK_ERROR
/* Commit compound datatype */
- if(H5Tcommit2(file, compnd_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(file, compnd_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Get information about datatype on disk */
- if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
+ if (H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
old_dtype_oh_size = oi.hdr.space.total;
/* Close datatype */
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Check that datatype has been encoded/decoded correctly */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Open the dataytpe for query */
- if((tid2 = H5Topen2(file, compnd_type, H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(file, compnd_type, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Verify that the datatype was encoded/decoded correctly */
- if(H5Tequal(tid1, tid2) <= 0)
+ if (H5Tequal(tid1, tid2) <= 0)
FAIL_STACK_ERROR
/* Get information about datatype on disk */
- if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
+ if (H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Check that the object header info is still the same */
- if(old_dtype_oh_size != oi.hdr.space.total)
+ if (old_dtype_oh_size != oi.hdr.space.total)
TEST_ERROR
/* Close datatype */
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
-
/* Set the 'use the latest format' bounds in the FAPL */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create file using default FAPL */
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Make a copy of the datatype, to commit */
- if((tid2 = H5Tcopy(tid1)) < 0)
+ if ((tid2 = H5Tcopy(tid1)) < 0)
FAIL_STACK_ERROR
/* Commit compound datatype */
- if(H5Tcommit2(file, compnd_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(file, compnd_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Get information about datatype on disk */
- if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
+ if (H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
new_dtype_oh_size = oi.hdr.space.total;
/* Check that the new format is smaller than the old format */
- if(old_dtype_oh_size <= new_dtype_oh_size)
+ if (old_dtype_oh_size <= new_dtype_oh_size)
TEST_ERROR
/* Close datatype */
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Check that datatype has been encoded/decoded correctly */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataytpe for query */
- if((tid2 = H5Topen2(file, compnd_type, H5P_DEFAULT)) < 0)
+ if ((tid2 = H5Topen2(file, compnd_type, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Verify that the datatype was encoded/decoded correctly */
- if(H5Tequal(tid1, tid2) <= 0)
+ if (H5Tequal(tid1, tid2) <= 0)
FAIL_STACK_ERROR
/* Get information about datatype on disk */
- if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
+ if (H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Check that the object header info is still the same */
- if(new_dtype_oh_size != oi.hdr.space.total)
+ if (new_dtype_oh_size != oi.hdr.space.total)
TEST_ERROR
/* Close datatype */
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
-
/* Close FAPL */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Close datatype */
- if(H5Tclose(tid1) < 0)
+ if (H5Tclose(tid1) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -5972,45 +6408,46 @@ test_latest(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid2);
H5Tclose(tid1);
H5Fclose(file);
H5Pclose(fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_latest() */
typedef struct {
- unsigned num_range_hi; /* Number of H5T_CONV_EXCEPT_RANGE_HI exceptions seen */
- unsigned num_range_low; /* Number of H5T_CONV_EXCEPT_RANGE_LOW exceptions seen */
- unsigned num_precision; /* Number of H5T_CONV_EXCEPT_PRECISION exceptions seen */
- unsigned num_truncate; /* Number of H5T_CONV_EXCEPT_TRUNCATE exceptions seen */
- unsigned num_other; /* Number of other exceptions seen */
+ unsigned num_range_hi; /* Number of H5T_CONV_EXCEPT_RANGE_HI exceptions seen */
+ unsigned num_range_low; /* Number of H5T_CONV_EXCEPT_RANGE_LOW exceptions seen */
+ unsigned num_precision; /* Number of H5T_CONV_EXCEPT_PRECISION exceptions seen */
+ unsigned num_truncate; /* Number of H5T_CONV_EXCEPT_TRUNCATE exceptions seen */
+ unsigned num_other; /* Number of other exceptions seen */
} except_info_t;
static H5T_conv_ret_t
conv_except(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id,
- void H5_ATTR_UNUSED *src_buf, void H5_ATTR_UNUSED *dst_buf, void *_user_data)
+ void H5_ATTR_UNUSED *src_buf, void H5_ATTR_UNUSED *dst_buf, void *_user_data)
{
except_info_t *user_data = (except_info_t *)_user_data;
- if(except_type == H5T_CONV_EXCEPT_RANGE_HI)
+ if (except_type == H5T_CONV_EXCEPT_RANGE_HI)
user_data->num_range_hi++;
- else if(except_type == H5T_CONV_EXCEPT_RANGE_LOW)
+ else if (except_type == H5T_CONV_EXCEPT_RANGE_LOW)
user_data->num_range_low++;
- else if(except_type == H5T_CONV_EXCEPT_PRECISION)
+ else if (except_type == H5T_CONV_EXCEPT_PRECISION)
user_data->num_precision++;
- else if(except_type == H5T_CONV_EXCEPT_TRUNCATE)
+ else if (except_type == H5T_CONV_EXCEPT_TRUNCATE)
user_data->num_truncate++;
else
user_data->num_other++;
- return(H5T_CONV_UNHANDLED);
+ return (H5T_CONV_UNHANDLED);
}
-
/*-------------------------------------------------------------------------
* Function: test_int_float_except
*
@@ -6036,123 +6473,149 @@ conv_except(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
static int
test_int_float_except(void)
{
-#if H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4
- float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, (float)INT_MAX - 68.0f, (float)4.5f};
- int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX-127, 4};
- float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4};
- int *intp; /* Pointer to buffer, as integers */
- int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
- float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f};
- int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
- float *floatp; /* Pointer to buffer #2, as floats */
- hid_t dxpl; /* Dataset transfer property list */
- except_info_t e; /* Exception information */
- unsigned u; /* Local index variables */
-#endif /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */
+#if H5_SIZEOF_INT == 4 && H5_SIZEOF_FLOAT == 4
+ float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, (float)INT_MAX - 68.0f,
+ (float)4.5f};
+ int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 4};
+ float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4};
+ int * intp; /* Pointer to buffer, as integers */
+ int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
+ float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f};
+ int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
+ float *floatp; /* Pointer to buffer #2, as floats */
+ hid_t dxpl; /* Dataset transfer property list */
+ except_info_t e; /* Exception information */
+ unsigned u; /* Local index variables */
+#endif /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */
TESTING("exceptions for int <-> float conversions");
-#if H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4
+#if H5_SIZEOF_INT == 4 && H5_SIZEOF_FLOAT == 4
/* Create dataset transfer property list */
- if((dxpl = H5Pcreate(H5P_DATASET_XFER) ) < 0) TEST_ERROR
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
/* Set the conversion exception handler in the DXPL */
- if(H5Pset_type_conv_cb(dxpl, conv_except, &e) < 0) TEST_ERROR
+ if (H5Pset_type_conv_cb(dxpl, conv_except, &e) < 0)
+ TEST_ERROR
/* Convert buffer */
HDmemset(&e, 0, sizeof(except_info_t));
- if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE, buf, NULL, dxpl) < 0) TEST_ERROR
+ if (H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE, buf, NULL, dxpl) < 0)
+ TEST_ERROR
/* Check the buffer after conversion, as integers */
- for(u = 0; u < CONVERT_SIZE; u++) {
+ for (u = 0; u < CONVERT_SIZE; u++) {
intp = (int *)&buf[u];
- if(*intp != buf_int[u]) TEST_ERROR
+ if (*intp != buf_int[u])
+ TEST_ERROR
} /* end for */
/* Check for proper exceptions */
- if(e.num_range_hi != 1) TEST_ERROR
- if(e.num_range_low != 1) TEST_ERROR
- if(e.num_precision != 0) TEST_ERROR
- if(e.num_truncate != 1) TEST_ERROR
- if(e.num_other != 0) TEST_ERROR
+ if (e.num_range_hi != 1)
+ TEST_ERROR
+ if (e.num_range_low != 1)
+ TEST_ERROR
+ if (e.num_precision != 0)
+ TEST_ERROR
+ if (e.num_truncate != 1)
+ TEST_ERROR
+ if (e.num_other != 0)
+ TEST_ERROR
/* Convert buffer */
HDmemset(&e, 0, sizeof(except_info_t));
- if(H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE,
- buf, NULL, dxpl) < 0) TEST_ERROR
+ if (H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE, buf, NULL, dxpl) < 0)
+ TEST_ERROR
/* Check the buffer after conversion, as floats */
- for(u = 0; u < CONVERT_SIZE; u++) {
+ for (u = 0; u < CONVERT_SIZE; u++) {
floatp = (float *)&buf[u];
- if(!H5_FLT_ABS_EQUAL(*floatp, buf_float[u])) TEST_ERROR
+ if (!H5_FLT_ABS_EQUAL(*floatp, buf_float[u]))
+ TEST_ERROR
} /* end for */
/* Check for proper exceptions */
- if(e.num_range_hi != 0) TEST_ERROR
- if(e.num_range_low != 0) TEST_ERROR
- if(e.num_precision != 1) TEST_ERROR
- if(e.num_truncate != 0) TEST_ERROR
- if(e.num_other != 0) TEST_ERROR
-
+ if (e.num_range_hi != 0)
+ TEST_ERROR
+ if (e.num_range_low != 0)
+ TEST_ERROR
+ if (e.num_precision != 1)
+ TEST_ERROR
+ if (e.num_truncate != 0)
+ TEST_ERROR
+ if (e.num_other != 0)
+ TEST_ERROR
/* Work on second buffer */
/* Convert second buffer */
HDmemset(&e, 0, sizeof(except_info_t));
- if(H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0)
+ if (H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0)
TEST_ERROR
/* Check the buffer after conversion, as floats */
- for(u = 0; u < CONVERT_SIZE; u++) {
+ for (u = 0; u < CONVERT_SIZE; u++) {
floatp = (float *)&buf2[u];
- if(!H5_FLT_ABS_EQUAL(*floatp, buf2_float[u])) TEST_ERROR
+ if (!H5_FLT_ABS_EQUAL(*floatp, buf2_float[u]))
+ TEST_ERROR
} /* end for */
/* Check for proper exceptions */
- if(e.num_range_hi != 0) TEST_ERROR
- if(e.num_range_low != 0) TEST_ERROR
- if(e.num_precision != 2) TEST_ERROR
- if(e.num_truncate != 0) TEST_ERROR
- if(e.num_other != 0) TEST_ERROR
+ if (e.num_range_hi != 0)
+ TEST_ERROR
+ if (e.num_range_low != 0)
+ TEST_ERROR
+ if (e.num_precision != 2)
+ TEST_ERROR
+ if (e.num_truncate != 0)
+ TEST_ERROR
+ if (e.num_other != 0)
+ TEST_ERROR
/* Convert buffer */
HDmemset(&e, 0, sizeof(except_info_t));
- if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0)
+ if (H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0)
TEST_ERROR
/* Check the buffer after conversion, as integers */
- for(u = 0; u < CONVERT_SIZE; u++) {
+ for (u = 0; u < CONVERT_SIZE; u++) {
intp = (int *)&buf2[u];
- if(*intp != buf2_int[u]) TEST_ERROR
+ if (*intp != buf2_int[u])
+ TEST_ERROR
} /* end for */
/* Check for proper exceptions */
- if(e.num_range_hi != 1) TEST_ERROR
- if(e.num_range_low != 0) TEST_ERROR
- if(e.num_precision != 0) TEST_ERROR
- if(e.num_truncate != 0) TEST_ERROR
- if(e.num_other != 0) TEST_ERROR
+ if (e.num_range_hi != 1)
+ TEST_ERROR
+ if (e.num_range_low != 0)
+ TEST_ERROR
+ if (e.num_precision != 0)
+ TEST_ERROR
+ if (e.num_truncate != 0)
+ TEST_ERROR
+ if (e.num_other != 0)
+ TEST_ERROR
/* Close DXPL */
- if(H5Pclose(dxpl) < 0) TEST_ERROR
+ if (H5Pclose(dxpl) < 0)
+ TEST_ERROR
PASSED();
-#else /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */
+#else /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */
SKIPPED();
HDputs(" Test skipped due to int or float not 4 bytes.");
#endif /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */
return 0;
-#if H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4
+#if H5_SIZEOF_INT == 4 && H5_SIZEOF_FLOAT == 4
error:
- H5E_BEGIN_TRY {
- H5Pclose (dxpl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(dxpl); }
+ H5E_END_TRY;
return 1;
#endif /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */
} /* end test_int_float_except() */
-
/*-------------------------------------------------------------------------
* Function: test_set_order
*
@@ -6170,150 +6633,222 @@ error:
static int
test_set_order(void)
{
- hid_t dtype; /* Datatype ID */
- H5T_order_t order; /* Byte order */
- hsize_t dims[2] = {3, 4}; /* Array dimenstions */
- herr_t ret; /* Generic return value */
+ hid_t dtype; /* Datatype ID */
+ H5T_order_t order; /* Byte order */
+ hsize_t dims[2] = {3, 4}; /* Array dimenstions */
+ herr_t ret; /* Generic return value */
TESTING("H5Tset/get_order");
/* Integer */
- if ((dtype = H5Tcopy(H5T_STD_I32BE)) < 0) TEST_ERROR
- if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
+ if ((dtype = H5Tcopy(H5T_STD_I32BE)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_BE != H5Tget_order(dtype))
+ TEST_ERROR;
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_NONE);
+ ret = H5Tset_order(dtype, H5T_ORDER_NONE);
H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (H5Tset_order(dtype, H5T_ORDER_LE) < 0) TEST_ERROR
- if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_LE) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_LE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Float */
- if ((dtype = H5Tcopy(H5T_IEEE_F64LE)) < 0) TEST_ERROR
- if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR;
+ if ((dtype = H5Tcopy(H5T_IEEE_F64LE)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_LE != H5Tget_order(dtype))
+ TEST_ERROR;
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_NONE);
+ ret = H5Tset_order(dtype, H5T_ORDER_NONE);
H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR
- if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_BE) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_BE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Time */
- if ((dtype = H5Tcopy(H5T_UNIX_D64BE)) < 0) TEST_ERROR
- if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
+ if ((dtype = H5Tcopy(H5T_UNIX_D64BE)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_BE != H5Tget_order(dtype))
+ TEST_ERROR;
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_NONE);
+ ret = H5Tset_order(dtype, H5T_ORDER_NONE);
H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (H5Tset_order(dtype, H5T_ORDER_LE) < 0) TEST_ERROR
- if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_LE) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_LE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Fixed length string */
- if ((dtype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if (H5Tset_size(dtype, (size_t)5) < 0) TEST_ERROR
- if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR;
- if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
+ if ((dtype = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR
+ if (H5Tset_size(dtype, (size_t)5) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_NONE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0)
+ TEST_ERROR;
+ if (H5T_ORDER_NONE != H5Tget_order(dtype))
+ TEST_ERROR;
/* Variable length string */
- if (H5Tset_size(dtype, H5T_VARIABLE) < 0) TEST_ERROR
+ if (H5Tset_size(dtype, H5T_VARIABLE) < 0)
+ TEST_ERROR
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_NONE);
+ ret = H5Tset_order(dtype, H5T_ORDER_NONE);
H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR
- if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_BE) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_BE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Bitfield */
- if ((dtype = H5Tcopy(H5T_STD_B16LE)) < 0) TEST_ERROR
- if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR;
+ if ((dtype = H5Tcopy(H5T_STD_B16LE)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_LE != H5Tget_order(dtype))
+ TEST_ERROR;
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_NONE);
+ ret = H5Tset_order(dtype, H5T_ORDER_NONE);
H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR
- if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_BE) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_BE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Opaque - No effect on the order */
- if ((dtype = H5Tcreate(H5T_OPAQUE, (size_t)96)) < 0) TEST_ERROR
- if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR
- if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR
- if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if ((dtype = H5Tcreate(H5T_OPAQUE, (size_t)96)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_NONE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0)
+ TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_BE) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_NONE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Compound */
- if ((dtype = H5Tcreate(H5T_COMPOUND, (size_t)48)) < 0) TEST_ERROR
+ if ((dtype = H5Tcreate(H5T_COMPOUND, (size_t)48)) < 0)
+ TEST_ERROR
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_BE);
+ ret = H5Tset_order(dtype, H5T_ORDER_BE);
H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if ((order = H5Tget_order(dtype)) == H5T_ORDER_ERROR) TEST_ERROR
- if (order != H5T_ORDER_NONE) TEST_ERROR
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
+ if ((order = H5Tget_order(dtype)) == H5T_ORDER_ERROR)
+ TEST_ERROR
+ if (order != H5T_ORDER_NONE)
+ TEST_ERROR
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Object reference */
- if ((dtype = H5Tcopy(H5T_STD_REF_OBJ)) < 0) TEST_ERROR
- if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR;
- if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if ((dtype = H5Tcopy(H5T_STD_REF_OBJ)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_NONE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0)
+ TEST_ERROR;
+ if (H5T_ORDER_NONE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Region reference */
- if ((dtype = H5Tcopy(H5T_STD_REF_DSETREG)) < 0) TEST_ERROR
- if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR;
- if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if ((dtype = H5Tcopy(H5T_STD_REF_DSETREG)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_NONE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0)
+ TEST_ERROR;
+ if (H5T_ORDER_NONE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Enum */
- if ((dtype = H5Tenum_create(H5T_STD_I16BE)) < 0) TEST_ERROR
- if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
+ if ((dtype = H5Tenum_create(H5T_STD_I16BE)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_BE != H5Tget_order(dtype))
+ TEST_ERROR;
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_NONE);
+ ret = H5Tset_order(dtype, H5T_ORDER_NONE);
H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (H5Tset_order(dtype, H5T_ORDER_LE) < 0) TEST_ERROR
- if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_LE) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_LE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Vlen */
- if ((dtype = H5Tvlen_create(H5T_STD_U64LE)) < 0) TEST_ERROR
- if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR;
+ if ((dtype = H5Tvlen_create(H5T_STD_U64LE)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_LE != H5Tget_order(dtype))
+ TEST_ERROR;
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_NONE);
+ ret = H5Tset_order(dtype, H5T_ORDER_NONE);
H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR
- if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_BE) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_BE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
/* Array */
- if ((dtype = H5Tarray_create2(H5T_IEEE_F64BE, 2, dims)) < 0) TEST_ERROR
- if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
+ if ((dtype = H5Tarray_create2(H5T_IEEE_F64BE, 2, dims)) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_BE != H5Tget_order(dtype))
+ TEST_ERROR;
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_NONE);
+ ret = H5Tset_order(dtype, H5T_ORDER_NONE);
H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (H5Tset_order(dtype, H5T_ORDER_LE) < 0) TEST_ERROR
- if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR;
- if (H5Tclose(dtype) < 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_LE) < 0)
+ TEST_ERROR
+ if (H5T_ORDER_LE != H5Tget_order(dtype))
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
H5E_BEGIN_TRY
- H5Tclose (dtype);
+ H5Tclose(dtype);
H5E_END_TRY;
return 1;
} /* end test_set_order() */
-
/*-------------------------------------------------------------------------
* Function: test_set_order_compound
*
@@ -6331,127 +6866,157 @@ error:
static int
test_set_order_compound(hid_t fapl)
{
- typedef struct { /* Struct with atomic fields */
+ typedef struct { /* Struct with atomic fields */
int i;
char c;
short s;
float f;
} atomic_cmpd;
- typedef struct { /* Struct with complex fields */
+ typedef struct { /* Struct with complex fields */
atomic_cmpd a;
hvl_t vl;
double b[3][4];
atomic_cmpd d[3][4];
} complex_cmpd;
- hid_t file = -1;
- hid_t cmpd = -1, memb_cmpd = -1, memb_array1 = -1, memb_array2 = -1, cmpd_array = -1;
- hid_t vl_id = -1;
- hsize_t dims[2] = {3, 4}; /* Array dimenstions */
- char filename[1024];
- herr_t ret; /* Generic return value */
+ hid_t file = -1;
+ hid_t cmpd = -1, memb_cmpd = -1, memb_array1 = -1, memb_array2 = -1, cmpd_array = -1;
+ hid_t vl_id = -1;
+ hsize_t dims[2] = {3, 4}; /* Array dimenstions */
+ char filename[1024];
+ herr_t ret; /* Generic return value */
TESTING("H5Tset/get_order for compound type");
- if((memb_cmpd = H5Tcreate(H5T_COMPOUND, sizeof(atomic_cmpd))) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(memb_cmpd, "i", HOFFSET(atomic_cmpd, i), H5T_NATIVE_INT) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(memb_cmpd, "c", HOFFSET(atomic_cmpd, c), H5T_NATIVE_CHAR) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(memb_cmpd, "s", HOFFSET(atomic_cmpd, s), H5T_NATIVE_SHORT) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(memb_cmpd, "f", HOFFSET(atomic_cmpd, f), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
+ if ((memb_cmpd = H5Tcreate(H5T_COMPOUND, sizeof(atomic_cmpd))) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(memb_cmpd, "i", HOFFSET(atomic_cmpd, i), H5T_NATIVE_INT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(memb_cmpd, "c", HOFFSET(atomic_cmpd, c), H5T_NATIVE_CHAR) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(memb_cmpd, "s", HOFFSET(atomic_cmpd, s), H5T_NATIVE_SHORT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(memb_cmpd, "f", HOFFSET(atomic_cmpd, f), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Set the order to little-endian. */
- if(H5Tset_order(memb_cmpd, H5T_ORDER_BE) < 0) FAIL_STACK_ERROR
+ if (H5Tset_order(memb_cmpd, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Create the array datatypes */
memb_array1 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 2, dims);
memb_array2 = H5Tarray_create2(memb_cmpd, 2, dims);
/* Set the order to big-endian. */
- if(H5Tset_order(memb_array1, H5T_ORDER_LE) < 0) FAIL_STACK_ERROR
+ if (H5Tset_order(memb_array1, H5T_ORDER_LE) < 0)
+ FAIL_STACK_ERROR
/* Create a variable-length datatype */
- if((vl_id = H5Tvlen_create(H5T_NATIVE_UINT)) < 0) FAIL_STACK_ERROR
+ if ((vl_id = H5Tvlen_create(H5T_NATIVE_UINT)) < 0)
+ FAIL_STACK_ERROR
/* Create a compound type using the types above. */
- if((cmpd = H5Tcreate(H5T_COMPOUND, sizeof(complex_cmpd))) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(cmpd, "a", HOFFSET(complex_cmpd, a), memb_cmpd) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(cmpd, "vl_type", HOFFSET(complex_cmpd, vl), vl_id) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(cmpd, "b", HOFFSET(complex_cmpd, b), memb_array1) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(cmpd, "d", HOFFSET(complex_cmpd, d), memb_array2) < 0) FAIL_STACK_ERROR
+ if ((cmpd = H5Tcreate(H5T_COMPOUND, sizeof(complex_cmpd))) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(cmpd, "a", HOFFSET(complex_cmpd, a), memb_cmpd) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(cmpd, "vl_type", HOFFSET(complex_cmpd, vl), vl_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(cmpd, "b", HOFFSET(complex_cmpd, b), memb_array1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(cmpd, "d", HOFFSET(complex_cmpd, d), memb_array2) < 0)
+ FAIL_STACK_ERROR
/* The order should be mixed now. */
- if(H5Tget_order(cmpd) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
+ if (H5Tget_order(cmpd) != H5T_ORDER_MIXED)
+ FAIL_STACK_ERROR
/* Create an array of the compound type above */
cmpd_array = H5Tarray_create2(cmpd, 2, dims);
/* The order of the array type should be the same as the compound type */
- if(H5Tget_order(cmpd_array) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
+ if (H5Tget_order(cmpd_array) != H5T_ORDER_MIXED)
+ FAIL_STACK_ERROR
/* Verify that the order can't be 'none'. */
H5E_BEGIN_TRY
- ret = H5Tset_order(cmpd, H5T_ORDER_NONE);
+ ret = H5Tset_order(cmpd, H5T_ORDER_NONE);
H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
/* Verify that the order can't be 'mixed'. */
H5E_BEGIN_TRY
- ret = H5Tset_order(cmpd, H5T_ORDER_MIXED);
+ ret = H5Tset_order(cmpd, H5T_ORDER_MIXED);
H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
/* Change the order of the compound type to big-endian*/
- if(H5Tset_order(cmpd, H5T_ORDER_BE) < 0) FAIL_STACK_ERROR
+ if (H5Tset_order(cmpd, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Verify that the order of the compound type is big-endian */
- if(H5Tget_order(cmpd) != H5T_ORDER_BE) FAIL_STACK_ERROR
+ if (H5Tget_order(cmpd) != H5T_ORDER_BE)
+ FAIL_STACK_ERROR
/* Change the order of the array type to little-endian*/
- if(H5Tset_order(cmpd_array, H5T_ORDER_LE) < 0) FAIL_STACK_ERROR
+ if (H5Tset_order(cmpd_array, H5T_ORDER_LE) < 0)
+ FAIL_STACK_ERROR
/* Verify that the order of the array type is little-endian */
- if(H5Tget_order(cmpd_array) != H5T_ORDER_LE) FAIL_STACK_ERROR
+ if (H5Tget_order(cmpd_array) != H5T_ORDER_LE)
+ FAIL_STACK_ERROR
/* Create file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Commit the data type */
- if(H5Tcommit2(file, "compound", cmpd, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Tcommit2(file, "compound", cmpd, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that committed type can't change order */
H5E_BEGIN_TRY
- ret = H5Tset_order(cmpd, H5T_ORDER_LE);
+ ret = H5Tset_order(cmpd, H5T_ORDER_LE);
H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
- if(H5Tclose(memb_cmpd) < 0) FAIL_STACK_ERROR
- if(H5Tclose(memb_array1) < 0) FAIL_STACK_ERROR
- if(H5Tclose(memb_array2) < 0) FAIL_STACK_ERROR
- if(H5Tclose(vl_id) < 0) FAIL_STACK_ERROR
- if(H5Tclose(cmpd) < 0) FAIL_STACK_ERROR
- if(H5Tclose(cmpd_array) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Tclose(memb_cmpd) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_array1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_array2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(vl_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(cmpd) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(cmpd_array) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
H5E_BEGIN_TRY
- H5Tclose(memb_cmpd);
- H5Tclose(memb_array1);
- H5Tclose(memb_array2);
- H5Tclose(vl_id);
- H5Tclose(cmpd);
- H5Tclose(cmpd_array);
+ H5Tclose(memb_cmpd);
+ H5Tclose(memb_array1);
+ H5Tclose(memb_array2);
+ H5Tclose(vl_id);
+ H5Tclose(cmpd);
+ H5Tclose(cmpd_array);
H5Fclose(file);
H5E_END_TRY;
return 1;
} /* end test_set_order_compound() */
-
/*-------------------------------------------------------------------------
* Function: test_named_indirect_reopen
*
@@ -6468,201 +7033,268 @@ error:
static int
test_named_indirect_reopen(hid_t fapl)
{
- hid_t file=-1, type=-1, reopened_type=-1, strtype=-1, dset=-1, space=-1;
- static hsize_t dims[1] = {3};
- size_t dt_size;
- int enum_value;
- const char *tag = "opaque_tag";
- char *tag_ret = NULL;
- char filename[1024];
+ hid_t file = -1, type = -1, reopened_type = -1, strtype = -1, dset = -1, space = -1;
+ static hsize_t dims[1] = {3};
+ size_t dt_size;
+ int enum_value;
+ const char * tag = "opaque_tag";
+ char * tag_ret = NULL;
+ char filename[1024];
TESTING("indirectly reopening committed datatypes");
/* Create file, dataspace */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if ((space = H5Screate_simple (1, dims, dims)) < 0) TEST_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((space = H5Screate_simple(1, dims, dims)) < 0)
+ TEST_ERROR
/*
* Compound
*/
/* Create compound type */
- if((strtype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if(H5Tset_size(strtype, H5T_VARIABLE) < 0) TEST_ERROR
- if((type = H5Tcreate(H5T_COMPOUND, sizeof(char *))) < 0) TEST_ERROR
- if(H5Tinsert(type, "vlstr", (size_t)0, strtype) < 0) TEST_ERROR
- if(H5Tclose(strtype) < 0) TEST_ERROR
+ if ((strtype = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR
+ if (H5Tset_size(strtype, H5T_VARIABLE) < 0)
+ TEST_ERROR
+ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(char *))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(type, "vlstr", (size_t)0, strtype) < 0)
+ TEST_ERROR
+ if (H5Tclose(strtype) < 0)
+ TEST_ERROR
/* Get size of compound type */
- if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR
+ if ((dt_size = H5Tget_size(type)) == 0)
+ TEST_ERROR
/* Commit compound type and verify the size doesn't change */
- if(H5Tcommit2(file, "cmpd_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(type)) TEST_ERROR
+ if (H5Tcommit2(file, "cmpd_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(type))
+ TEST_ERROR
/* Create dataset with compound type */
- if((dset = H5Dcreate2(file, "cmpd_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dset = H5Dcreate2(file, "cmpd_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Indirectly reopen type and verify that the size doesn't change */
- if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR
+ if ((reopened_type = H5Dget_type(dset)) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(reopened_type))
+ TEST_ERROR
/* Close types and dataset */
- if(H5Tclose(type) < 0) TEST_ERROR
- if(H5Tclose(reopened_type) < 0) TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Tclose(type) < 0)
+ TEST_ERROR
+ if (H5Tclose(reopened_type) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/*
* Enum
*/
/* Create enum type */
- if((type = H5Tenum_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((type = H5Tenum_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
enum_value = 0;
- if(H5Tenum_insert(type, "val1", &enum_value) < 0) TEST_ERROR
+ if (H5Tenum_insert(type, "val1", &enum_value) < 0)
+ TEST_ERROR
enum_value = 1;
- if(H5Tenum_insert(type, "val2", &enum_value) < 0) TEST_ERROR
+ if (H5Tenum_insert(type, "val2", &enum_value) < 0)
+ TEST_ERROR
/* Get size of enum type */
- if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR
+ if ((dt_size = H5Tget_size(type)) == 0)
+ TEST_ERROR
/* Commit enum type and verify the size doesn't change */
- if(H5Tcommit2(file, "enum_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(type)) TEST_ERROR
+ if (H5Tcommit2(file, "enum_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(type))
+ TEST_ERROR
/* Create dataset with enum type */
- if((dset = H5Dcreate2(file, "enum_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dset = H5Dcreate2(file, "enum_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Indirectly reopen type and verify that the size doesn't change */
- if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR
+ if ((reopened_type = H5Dget_type(dset)) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(reopened_type))
+ TEST_ERROR
/* Close types and dataset */
- if(H5Tclose(type) < 0) TEST_ERROR
- if(H5Tclose(reopened_type) < 0) TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Tclose(type) < 0)
+ TEST_ERROR
+ if (H5Tclose(reopened_type) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/*
* Vlen
*/
/* Create vlen type */
- if((type = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((type = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* Get size of vlen type */
- if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR
+ if ((dt_size = H5Tget_size(type)) == 0)
+ TEST_ERROR
/* Commit vlen type and verify the size doesn't change */
- if(H5Tcommit2(file, "vlen_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(type)) TEST_ERROR
+ if (H5Tcommit2(file, "vlen_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(type))
+ TEST_ERROR
/* Create dataset with vlen type */
- if((dset = H5Dcreate2(file, "vlen_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dset = H5Dcreate2(file, "vlen_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Indirectly reopen type and verify that the size doesn't change */
- if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR
+ if ((reopened_type = H5Dget_type(dset)) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(reopened_type))
+ TEST_ERROR
/* Close types and dataset */
- if(H5Tclose(type) < 0) TEST_ERROR
- if(H5Tclose(reopened_type) < 0) TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Tclose(type) < 0)
+ TEST_ERROR
+ if (H5Tclose(reopened_type) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/*
* Opaque
*/
/* Create opaque type */
- if((type = H5Tcreate(H5T_OPAQUE, (size_t)13)) < 0) TEST_ERROR
- if(H5Tset_tag(type, tag) < 0) TEST_ERROR
+ if ((type = H5Tcreate(H5T_OPAQUE, (size_t)13)) < 0)
+ TEST_ERROR
+ if (H5Tset_tag(type, tag) < 0)
+ TEST_ERROR
/* Get size of opaque type */
- if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR
+ if ((dt_size = H5Tget_size(type)) == 0)
+ TEST_ERROR
/* Commit opaque type and verify the size and tag don't change */
- if(H5Tcommit2(file, "opaque_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(type)) TEST_ERROR
- if(NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR
- if(HDstrcmp(tag, tag_ret)) TEST_ERROR
+ if (H5Tcommit2(file, "opaque_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(type))
+ TEST_ERROR
+ if (NULL == (tag_ret = H5Tget_tag(type)))
+ TEST_ERROR
+ if (HDstrcmp(tag, tag_ret))
+ TEST_ERROR
H5free_memory(tag_ret);
tag_ret = NULL;
/* Create dataset with opaque type */
- if((dset = H5Dcreate2(file, "opaque_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dset = H5Dcreate2(file, "opaque_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Indirectly reopen type and verify that the size and tag don't change */
- if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR
- if(NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR
- if(HDstrcmp(tag, tag_ret)) TEST_ERROR
+ if ((reopened_type = H5Dget_type(dset)) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(reopened_type))
+ TEST_ERROR
+ if (NULL == (tag_ret = H5Tget_tag(type)))
+ TEST_ERROR
+ if (HDstrcmp(tag, tag_ret))
+ TEST_ERROR
H5free_memory(tag_ret);
tag_ret = NULL;
/* Close types and dataset */
- if(H5Tclose(type) < 0) TEST_ERROR
- if(H5Tclose(reopened_type) < 0) TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Tclose(type) < 0)
+ TEST_ERROR
+ if (H5Tclose(reopened_type) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/*
* Array
*/
/* Create array type */
- if((type = H5Tarray_create2(H5T_NATIVE_INT, 1, dims)) < 0) TEST_ERROR
+ if ((type = H5Tarray_create2(H5T_NATIVE_INT, 1, dims)) < 0)
+ TEST_ERROR
/* Get size of array type */
- if((dt_size = H5Tget_size(type)) == 0) TEST_ERROR
+ if ((dt_size = H5Tget_size(type)) == 0)
+ TEST_ERROR
/* Commit array type and verify the size doesn't change */
- if(H5Tcommit2(file, "array_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(type)) TEST_ERROR
+ if (H5Tcommit2(file, "array_type", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(type))
+ TEST_ERROR
/* Create dataset with array type */
- if((dset = H5Dcreate2(file, "array_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dset = H5Dcreate2(file, "array_dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Indirectly reopen type and verify that the size doesn't change */
- if((reopened_type = H5Dget_type(dset)) < 0) TEST_ERROR
- if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR
+ if ((reopened_type = H5Dget_type(dset)) < 0)
+ TEST_ERROR
+ if (dt_size != H5Tget_size(reopened_type))
+ TEST_ERROR
/* Close types and dataset */
- if(H5Tclose(type) < 0) TEST_ERROR
- if(H5Tclose(reopened_type) < 0) TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Tclose(type) < 0)
+ TEST_ERROR
+ if (H5Tclose(reopened_type) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
/* Close file and dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Sclose(space) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(type);
H5Tclose(strtype);
H5Tclose(reopened_type);
H5Sclose(space);
H5Dclose(dset);
- H5Fclose(file);
- } H5E_END_TRY;
- if(tag_ret)
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ if (tag_ret)
H5free_memory(tag_ret);
return 1;
} /* end test_named_indirect_reopen() */
-static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
- H5F_libver_t low, H5F_libver_t high)
+static void
+create_del_obj_named_test_file(const char *filename, hid_t fapl, H5F_libver_t low, H5F_libver_t high)
{
- hid_t file; /* File ID */
- hid_t type; /* Datatype ID */
- hid_t space; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dset; /* Dataset ID */
- hid_t fcpl; /* File creation property list ID */
- hid_t my_fapl; /* Copy of file access property list ID */
- hid_t dcpl; /* Dataset creation property list ID */
- unsigned use_at_least_v18;/* Whether to use old or new format */
- herr_t H5_ATTR_NDEBUG_UNUSED status; /* Generic return value */
+ hid_t file; /* File ID */
+ hid_t type; /* Datatype ID */
+ hid_t space; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dset; /* Dataset ID */
+ hid_t fcpl; /* File creation property list ID */
+ hid_t my_fapl; /* Copy of file access property list ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ unsigned use_at_least_v18; /* Whether to use old or new format */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Generic return value */
/* Make copy of FAPL */
my_fapl = H5Pcopy(fapl);
@@ -6681,7 +7313,7 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
fcpl = H5Pcreate(H5P_FILE_CREATE);
HDassert(fcpl > 0);
- if(use_at_least_v18) {
+ if (use_at_least_v18) {
/* Use dense link storage for all links in root group */
status = H5Pset_link_phase_change(fcpl, 0, 0);
HDassert(status >= 0);
@@ -6715,7 +7347,7 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
dcpl = H5Pcreate(H5P_DATASET_CREATE);
HDassert(dcpl > 0);
- if(use_at_least_v18) {
+ if (use_at_least_v18) {
/* Use dense attribute storage for all attributes on dataset */
status = H5Pset_attr_phase_change(dcpl, 0, 0);
HDassert(status >= 0);
@@ -6734,7 +7366,8 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
HDassert(status >= 0);
/* Create attribute */
- attr = H5Acreate_by_name(file, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Acreate_by_name(file, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, type, space, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
HDassert(attr > 0);
/* Close dataspace */
@@ -6754,7 +7387,6 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
HDassert(status >= 0);
} /* end create_del_obj_named_test_file() */
-
/*-------------------------------------------------------------------------
* Function: test_delete_obj_named
*
@@ -6772,24 +7404,25 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
static int
test_delete_obj_named(hid_t fapl)
{
- hid_t filea1 = -1, filea2 = -1, fileb = -1; /* File IDs */
- hid_t attr = -1; /* Attribute ID */
- hid_t dset = -1; /* Dataset ID */
- hid_t fapl2 = -1; /* File access property list ID */
- H5F_libver_t low, high; /* File format bounds */
- char filename[1024], filename2[1024];
+ hid_t filea1 = -1, filea2 = -1, fileb = -1; /* File IDs */
+ hid_t attr = -1; /* Attribute ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t fapl2 = -1; /* File access property list ID */
+ H5F_libver_t low, high; /* File format bounds */
+ char filename[1024], filename2[1024];
TESTING("deleting objects that use named datatypes");
/* Set up filenames & FAPLs */
- if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
h5_fixname(FILENAME[9], fapl2, filename2, sizeof filename2);
/* Loop through all valid the combinations of low/high library format bounds,
to test delete objects that use named datatypes through different file IDs */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Skip invalid low/high combination */
if ((high == H5F_LIBVER_EARLIEST) || (low > high))
@@ -6799,60 +7432,81 @@ test_delete_obj_named(hid_t fapl)
create_del_obj_named_test_file(filename, fapl, low, high);
/* Test deleting dataset opened through different file ID */
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if ((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(filea1) < 0)
+ FAIL_STACK_ERROR
- if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
+ if ((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0)
+ FAIL_STACK_ERROR
- if(H5Ldelete(filea2, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(filea2, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
- if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(filea2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fileb) < 0)
+ FAIL_STACK_ERROR
/* Create test file, with attribute that uses committed datatype */
create_del_obj_named_test_file(filename, fapl, low, high);
/* Test deleting attribute opened through different file ID */
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
-
- if((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
-
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
-
- if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
-
- if(H5Adelete_by_name(filea2, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
-
- if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
+ if ((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ if ((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Aclose(attr) < 0)
+ FAIL_STACK_ERROR
+
+ if (H5Fclose(filea1) < 0)
+ FAIL_STACK_ERROR
+
+ if ((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0)
+ FAIL_STACK_ERROR
+
+ if (H5Adelete_by_name(filea2, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ if (H5Fclose(filea2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fileb) < 0)
+ FAIL_STACK_ERROR
} /* end high */
- } /* end low */
+ } /* end low */
- if(H5Pclose(fapl2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(attr);
H5Dclose(dset);
H5Pclose(fapl2);
H5Fclose(filea1);
H5Fclose(filea2);
H5Fclose(fileb);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_delete_obj_named() */
-
/*-------------------------------------------------------------------------
* Function: test_delete_obj_named_fileid
*
@@ -6870,27 +7524,28 @@ error:
static int
test_delete_obj_named_fileid(hid_t fapl)
{
- hid_t filea1 = -1, filea2 = -1, fileb = -1; /* File IDs */
- hid_t dset_fid = -1; /* File ID from dataset */
- hid_t type_fid = -1; /* File ID from datatype */
- hid_t attr_fid = -1; /* File ID from attribute */
- hid_t type = -1; /* Datatype ID */
- hid_t attr = -1; /* Attribute ID */
- hid_t dset = -1; /* Dataset ID */
- hid_t fapl2 = -1; /* File access property list ID */
- H5F_libver_t low, high; /* File format bounds */
- char filename[1024], filename2[1024];
+ hid_t filea1 = -1, filea2 = -1, fileb = -1; /* File IDs */
+ hid_t dset_fid = -1; /* File ID from dataset */
+ hid_t type_fid = -1; /* File ID from datatype */
+ hid_t attr_fid = -1; /* File ID from attribute */
+ hid_t type = -1; /* Datatype ID */
+ hid_t attr = -1; /* Attribute ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t fapl2 = -1; /* File access property list ID */
+ H5F_libver_t low, high; /* File format bounds */
+ char filename[1024], filename2[1024];
TESTING("deleting objects that use named datatypes");
/* Set up filenames & FAPLs */
- if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
h5_fixname(FILENAME[9], fapl2, filename2, sizeof filename2);
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Skip invalid low/high combination */
if ((high == H5F_LIBVER_EARLIEST) || (low > high))
@@ -6900,111 +7555,146 @@ test_delete_obj_named_fileid(hid_t fapl)
create_del_obj_named_test_file(filename, fapl, low, high);
/* Test getting file ID for dataset opened through different file ID */
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify file ID from dataset matches correct file */
dset_fid = H5Iget_file_id(dset);
- if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR
+ if (!H5F__same_file_test(dset_fid, filea1))
+ TEST_ERROR
H5Fclose(dset_fid);
/* Verify file ID from datatype (from dataset) matches correct file */
- type = H5Dget_type(dset);
+ type = H5Dget_type(dset);
type_fid = H5Iget_file_id(type);
- if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR
+ if (!H5F__same_file_test(type_fid, filea1))
+ TEST_ERROR
H5Fclose(type_fid);
H5Tclose(type);
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(filea1) < 0)
+ FAIL_STACK_ERROR
- if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
+ if ((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0)
+ FAIL_STACK_ERROR
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify file ID from dataset matches correct file */
dset_fid = H5Iget_file_id(dset);
- if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR
+ if (!H5F__same_file_test(dset_fid, filea1))
+ TEST_ERROR
H5Fclose(dset_fid);
/* Verify file ID from datatype (from dataset) matches correct file */
- type = H5Dget_type(dset);
+ type = H5Dget_type(dset);
type_fid = H5Iget_file_id(type);
- if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR
+ if (!H5F__same_file_test(type_fid, filea1))
+ TEST_ERROR
H5Fclose(type_fid);
H5Tclose(type);
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
-
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(filea1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(filea2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fileb) < 0)
+ FAIL_STACK_ERROR
/* Create test file, with attribute that uses committed datatype */
create_del_obj_named_test_file(filename, fapl, low, high);
/* Test getting file ID for attribute opened through different file ID */
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify file ID from dataset matches correct file */
attr_fid = H5Iget_file_id(attr);
- if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR
+ if (!H5F__same_file_test(attr_fid, filea1))
+ TEST_ERROR
H5Fclose(attr_fid);
/* Verify file ID from datatype (from dataset) matches correct file */
- type = H5Aget_type(attr);
+ type = H5Aget_type(attr);
type_fid = H5Iget_file_id(type);
- if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR
+ if (!H5F__same_file_test(type_fid, filea1))
+ TEST_ERROR
H5Fclose(type_fid);
H5Tclose(type);
- if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
+ if (H5Aclose(attr) < 0)
+ FAIL_STACK_ERROR
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(filea1) < 0)
+ FAIL_STACK_ERROR
- if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
+ if ((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0)
+ FAIL_STACK_ERROR
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify file ID from dataset matches correct file */
attr_fid = H5Iget_file_id(attr);
- if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR
+ if (!H5F__same_file_test(attr_fid, filea1))
+ TEST_ERROR
H5Fclose(attr_fid);
/* Verify file ID from datatype (from dataset) matches correct file */
- type = H5Aget_type(attr);
+ type = H5Aget_type(attr);
type_fid = H5Iget_file_id(type);
- if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR
+ if (!H5F__same_file_test(type_fid, filea1))
+ TEST_ERROR
H5Fclose(type_fid);
H5Tclose(type);
- if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
+ if (H5Aclose(attr) < 0)
+ FAIL_STACK_ERROR
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(filea1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(filea2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fileb) < 0)
+ FAIL_STACK_ERROR
} /* end high */
- } /* end low */
+ } /* end low */
- if(H5Pclose(fapl2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(attr);
H5Tclose(type);
H5Dclose(dset);
@@ -7014,11 +7704,11 @@ error:
H5Fclose(fileb);
H5Fclose(attr_fid);
H5Fclose(type_fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_delete_obj_named_fileid() */
-
/*-------------------------------------------------------------------------
* Function: test_deprec
*
@@ -7036,138 +7726,148 @@ error:
static int
test_deprec(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t type = -1; /* Datatype ID */
- unsigned rank = 2; /* Rank for array datatype */
- hsize_t dims[2] = {3, 3}; /* Dimensions for array datatype */
- int perm[2] = {0, 1}; /* Dimensions permutations for array datatype */
- hsize_t rdims[2]= {0, 0}; /* Dimensions for querying array datatype */
- int rperm[2] = {-2, -2}; /* Dimensions permutations for array datatype */
- hbool_t dim_mismatch; /* Whether any dimensions didn't match */
- char filename[1024];
- unsigned u; /* Local index variable */
- herr_t status; /* Generic routine value */
+ hid_t file = -1; /* File ID */
+ hid_t type = -1; /* Datatype ID */
+ unsigned rank = 2; /* Rank for array datatype */
+ hsize_t dims[2] = {3, 3}; /* Dimensions for array datatype */
+ int perm[2] = {0, 1}; /* Dimensions permutations for array datatype */
+ hsize_t rdims[2] = {0, 0}; /* Dimensions for querying array datatype */
+ int rperm[2] = {-2, -2}; /* Dimensions permutations for array datatype */
+ hbool_t dim_mismatch; /* Whether any dimensions didn't match */
+ char filename[1024];
+ unsigned u; /* Local index variable */
+ herr_t status; /* Generic routine value */
TESTING("deprected API routines for datatypes");
/* Create an array datatype with an atomic base type */
/* (dimension permutations allowed, but not stored) */
- if((type = H5Tarray_create1(H5T_NATIVE_INT, (int)rank, dims, perm)) < 0)
+ if ((type = H5Tarray_create1(H5T_NATIVE_INT, (int)rank, dims, perm)) < 0)
FAIL_STACK_ERROR
/* Make certain that the correct classes can be detected */
- if(H5Tdetect_class(type, H5T_ARRAY) != TRUE)
+ if (H5Tdetect_class(type, H5T_ARRAY) != TRUE)
FAIL_STACK_ERROR
- if(H5Tdetect_class(type, H5T_INTEGER) != TRUE)
+ if (H5Tdetect_class(type, H5T_INTEGER) != TRUE)
FAIL_STACK_ERROR
/* Get the array dimensions */
/* (Query the dimension permutations, which is allowed, but ignored) */
- if(H5Tget_array_dims1(type, rdims, rperm) < 0)
+ if (H5Tget_array_dims1(type, rdims, rperm) < 0)
FAIL_STACK_ERROR
/* Check the array dimensions */
dim_mismatch = FALSE;
- for(u = 0; u < rank; u++)
- if(rdims[u] != dims[u]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%u]=%d, tdims1[%u]=%d\n", u, (int)rdims[u], u, (int)dims[u]);
+ for (u = 0; u < rank; u++)
+ if (rdims[u] != dims[u]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%u]=%d, tdims1[%u]=%d\n", u,
+ (int)rdims[u], u, (int)dims[u]);
dim_mismatch = TRUE;
} /* end if */
- if(dim_mismatch)
- FAIL_PUTS_ERROR(" Dimensions didn't match!")
+ if (dim_mismatch)
+ FAIL_PUTS_ERROR(" Dimensions didn't match!")
/* Check the array dimension permutations */
dim_mismatch = FALSE;
- for(u = 0; u < rank; u++)
- if(rperm[u] != -2) {
- TestErrPrintf("Array dimension permutation information was modified!, rdims1[%u]=%d, tdims1[%u]=%d\n", u, rperm[u], u, perm[u]);
+ for (u = 0; u < rank; u++)
+ if (rperm[u] != -2) {
+ TestErrPrintf(
+ "Array dimension permutation information was modified!, rdims1[%u]=%d, tdims1[%u]=%d\n", u,
+ rperm[u], u, perm[u]);
dim_mismatch = TRUE;
} /* end if */
- if(dim_mismatch)
- FAIL_PUTS_ERROR(" Dimension permutations modified!")
+ if (dim_mismatch)
+ FAIL_PUTS_ERROR(" Dimension permutations modified!")
/* Close the datatype */
- if(H5Tclose(type) < 0)
+ if (H5Tclose(type) < 0)
FAIL_STACK_ERROR
-
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Predefined types cannot be committed */
- H5E_BEGIN_TRY {
- status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT); }
+ H5E_END_TRY;
+ if (status >= 0)
FAIL_PUTS_ERROR(" Predefined types should not be committable!")
/* Copy a predefined datatype and commit the copy */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
- if(H5Tcommit1(file, "native-int", type) < 0) FAIL_STACK_ERROR
- if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR
- if(0 == status)
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tcommit1(file, "native-int", type) < 0)
+ FAIL_STACK_ERROR
+ if ((status = H5Tcommitted(type)) < 0)
+ FAIL_STACK_ERROR
+ if (0 == status)
FAIL_PUTS_ERROR(" H5Tcommitted() returned false!")
/* We should not be able to modify a type after it has been committed. */
- H5E_BEGIN_TRY {
- status = H5Tset_precision(type, (size_t)256);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Tset_precision(type, (size_t)256); }
+ H5E_END_TRY;
+ if (status >= 0)
FAIL_PUTS_ERROR(" Committed type is not constant!")
/* We should not be able to re-commit a committed type */
- H5E_BEGIN_TRY {
- status = H5Tcommit1(file, "test_named_2 (should not exist)", type);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Tcommit1(file, "test_named_2 (should not exist)", type); }
+ H5E_END_TRY;
+ if (status >= 0)
FAIL_PUTS_ERROR(" Committed types should not be recommitted!")
/*
* Close the committed type and reopen it. It should return a named type.
*/
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
- if((type = H5Topen1(file, "native-int")) < 0) FAIL_STACK_ERROR
- if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR
- if(!status)
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
+ if ((type = H5Topen1(file, "native-int")) < 0)
+ FAIL_STACK_ERROR
+ if ((status = H5Tcommitted(type)) < 0)
+ FAIL_STACK_ERROR
+ if (!status)
FAIL_PUTS_ERROR(" Opened named types should be named types!")
/* Close */
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Reopen file with read only access */
if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
goto error;
/* Verify that H5Tcommit2 returns an error */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
- H5E_BEGIN_TRY {
- status = H5Tcommit1(file, "test_named_3 (should not exist)", type);
- } H5E_END_TRY;
- if(status >= 0) {
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto error;
+ H5E_BEGIN_TRY { status = H5Tcommit1(file, "test_named_3 (should not exist)", type); }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
- HDputs (" Types should not be committable to a read-only file!");
+ HDputs(" Types should not be committable to a read-only file!");
goto error;
}
/* Close */
- if(H5Tclose(type) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(type);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_deprec() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: test_utf_ascii_conv
*
@@ -7184,20 +7884,20 @@ error:
static int
test_utf_ascii_conv(void)
{
- hid_t fid = -1;
- hid_t did = -1;
- hid_t utf8_vtid = -1;
- hid_t ascii_vtid = -1;
- hid_t utf8_tid = -1;
- hid_t ascii_tid = -1;
- hid_t sid = -1;
- const char *utf8_w = "foo!";
- char *ascii_r = NULL;
- const char *ascii_w = "bar!";
- char *utf8_r = NULL;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t utf8_vtid = -1;
+ hid_t ascii_vtid = -1;
+ hid_t utf8_tid = -1;
+ hid_t ascii_tid = -1;
+ hid_t sid = -1;
+ const char *utf8_w = "foo!";
+ char * ascii_r = NULL;
+ const char *ascii_w = "bar!";
+ char * utf8_r = NULL;
char filename[1024];
- char ascii2[4], utf8_2[4];
- herr_t status;
+ char ascii2[4], utf8_2[4];
+ herr_t status;
TESTING("string conversion between ASCII and UTF");
@@ -7205,168 +7905,193 @@ test_utf_ascii_conv(void)
* Test VL string conversion from UTF8 to ASCII
************************************************/
/* Create a variable-length string */
- if((utf8_vtid = H5Tcopy(H5T_C_S1)) < 0) FAIL_STACK_ERROR
+ if ((utf8_vtid = H5Tcopy(H5T_C_S1)) < 0)
+ FAIL_STACK_ERROR
- if((status = H5Tset_size(utf8_vtid, H5T_VARIABLE)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tset_size(utf8_vtid, H5T_VARIABLE)) < 0)
+ FAIL_STACK_ERROR
/* Set the character set for the string to UTF-8 */
- if((status = H5Tset_cset(utf8_vtid, H5T_CSET_UTF8)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tset_cset(utf8_vtid, H5T_CSET_UTF8)) < 0)
+ FAIL_STACK_ERROR
/* Create a variable-length string */
- if((ascii_vtid = H5Tcopy(H5T_C_S1)) < 0) FAIL_STACK_ERROR
+ if ((ascii_vtid = H5Tcopy(H5T_C_S1)) < 0)
+ FAIL_STACK_ERROR
- if((status = H5Tset_size(ascii_vtid, H5T_VARIABLE)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tset_size(ascii_vtid, H5T_VARIABLE)) < 0)
+ FAIL_STACK_ERROR
/* Set the character set for the string to ASCII (should already be so) */
- if((status = H5Tset_cset(ascii_vtid, H5T_CSET_ASCII) < 0)) FAIL_STACK_ERROR
+ if ((status = H5Tset_cset(ascii_vtid, H5T_CSET_ASCII) < 0))
+ FAIL_STACK_ERROR
/* Test conversion in memory */
- H5E_BEGIN_TRY {
- status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT);
- } H5E_END_TRY
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT); }
+ H5E_END_TRY
+ if (status >= 0)
FAIL_STACK_ERROR
/* Create a file */
h5_fixname(FILENAME[10], H5P_DEFAULT, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a scalar dataspace for the dataset */
- if((sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset of UTF8 string type */
- if((did = H5Dcreate2(fid, UTF8_DATASET, utf8_vtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((did = H5Dcreate2(fid, UTF8_DATASET, utf8_vtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write the UTF8 string, as UTF8 */
- if((status = H5Dwrite(did, utf8_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_w)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Dwrite(did, utf8_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_w)) < 0)
+ FAIL_STACK_ERROR
/* Read the UTF8 string, as ASCII, supposed to fail */
- H5E_BEGIN_TRY {
- status = H5Dread(did, ascii_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_r);
- } H5E_END_TRY
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Dread(did, ascii_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_r); }
+ H5E_END_TRY
+ if (status >= 0)
FAIL_STACK_ERROR
/* Close the dataset */
- if((status = H5Dclose(did)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Dclose(did)) < 0)
+ FAIL_STACK_ERROR
/************************************************
* Test VL string conversion from ASCII to UTF8
************************************************/
/* Test conversion in memory */
- H5E_BEGIN_TRY {
- status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT);
- } H5E_END_TRY
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT); }
+ H5E_END_TRY
+ if (status >= 0)
FAIL_STACK_ERROR
/* Create a dataset of ASCII string type */
- if((did = H5Dcreate2(fid, ASCII_DATASET, ascii_vtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((did = H5Dcreate2(fid, ASCII_DATASET, ascii_vtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write the ASCII string, as ASCII */
- if((status = H5Dwrite(did, ascii_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_w)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Dwrite(did, ascii_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_w)) < 0)
+ FAIL_STACK_ERROR
/* Read the ASCII string, as UTF8, supposed to fail */
- H5E_BEGIN_TRY {
- status = H5Dread(did, utf8_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_r);
- } H5E_END_TRY
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Dread(did, utf8_vtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_r); }
+ H5E_END_TRY
+ if (status >= 0)
FAIL_STACK_ERROR
/* Close the dataset */
- if((status = H5Dclose(did)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Dclose(did)) < 0)
+ FAIL_STACK_ERROR
/* Close the UTF8 VL-string datatype */
- if((status = H5Tclose(utf8_vtid)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tclose(utf8_vtid)) < 0)
+ FAIL_STACK_ERROR
/* Close the ASCII VL-string datatype */
- if((status = H5Tclose(ascii_vtid)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tclose(ascii_vtid)) < 0)
+ FAIL_STACK_ERROR
/**********************************************************
* Test fixed-length string conversion from UTF8 to ASCII
**********************************************************/
/* Create a fixed-length UTF8 string */
- if((utf8_tid = H5Tcopy(H5T_C_S1)) < 0) FAIL_STACK_ERROR
+ if ((utf8_tid = H5Tcopy(H5T_C_S1)) < 0)
+ FAIL_STACK_ERROR
- if((status = H5Tset_size(utf8_tid, 4)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tset_size(utf8_tid, 4)) < 0)
+ FAIL_STACK_ERROR
/* Set the character set for the string to UTF-8 */
- if((status = H5Tset_cset(utf8_tid, H5T_CSET_UTF8)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tset_cset(utf8_tid, H5T_CSET_UTF8)) < 0)
+ FAIL_STACK_ERROR
/* Create a fixed-length ASCII string */
- if((ascii_tid = H5Tcopy(H5T_C_S1)) < 0) FAIL_STACK_ERROR
+ if ((ascii_tid = H5Tcopy(H5T_C_S1)) < 0)
+ FAIL_STACK_ERROR
- if((status = H5Tset_size(ascii_tid, 4)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tset_size(ascii_tid, 4)) < 0)
+ FAIL_STACK_ERROR
/* Set the character set for the string to ASCII (should already be so) */
- if((status = H5Tset_cset(ascii_tid, H5T_CSET_ASCII) < 0)) FAIL_STACK_ERROR
+ if ((status = H5Tset_cset(ascii_tid, H5T_CSET_ASCII) < 0))
+ FAIL_STACK_ERROR
/* Test conversion in memory */
- H5E_BEGIN_TRY {
- status = H5Tconvert(utf8_tid, ascii_tid, 1, utf8_2, NULL, H5P_DEFAULT);
- } H5E_END_TRY
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Tconvert(utf8_tid, ascii_tid, 1, utf8_2, NULL, H5P_DEFAULT); }
+ H5E_END_TRY
+ if (status >= 0)
FAIL_STACK_ERROR
/* Create a dataset */
- if((did = H5Dcreate2(fid, UTF8_DATASET2, utf8_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((did = H5Dcreate2(fid, UTF8_DATASET2, utf8_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write the UTF8 string, as UTF8 */
- if((status = H5Dwrite(did, utf8_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_w)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Dwrite(did, utf8_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_w)) < 0)
+ FAIL_STACK_ERROR
/* Read the UTF8 string as ASCII, supposed to fail */
- H5E_BEGIN_TRY {
- status = H5Dread(did, ascii_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii2);
- } H5E_END_TRY
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Dread(did, ascii_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii2); }
+ H5E_END_TRY
+ if (status >= 0)
FAIL_STACK_ERROR
/* Close the dataset */
- if((status = H5Dclose(did)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Dclose(did)) < 0)
+ FAIL_STACK_ERROR
/**********************************************************
* Test fixed-length string conversion from ASCII to UTF8
**********************************************************/
/* Test conversion in memory */
- H5E_BEGIN_TRY {
- status = H5Tconvert(ascii_tid, utf8_tid, 1, ascii2, NULL, H5P_DEFAULT);
- } H5E_END_TRY
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Tconvert(ascii_tid, utf8_tid, 1, ascii2, NULL, H5P_DEFAULT); }
+ H5E_END_TRY
+ if (status >= 0)
FAIL_STACK_ERROR
/* Create a dataset */
- if((did = H5Dcreate2(fid, ASCII_DATASET2, ascii_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((did = H5Dcreate2(fid, ASCII_DATASET2, ascii_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write the ASCII string, as ASCII */
- if((status = H5Dwrite(did, ascii_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_w)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Dwrite(did, ascii_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &ascii_w)) < 0)
+ FAIL_STACK_ERROR
/* Read the UTF8 string as ASCII, supposed to fail */
- H5E_BEGIN_TRY {
- status = H5Dread(did, utf8_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_2);
- } H5E_END_TRY
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Dread(did, utf8_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &utf8_2); }
+ H5E_END_TRY
+ if (status >= 0)
FAIL_STACK_ERROR
/* Close the dataset */
- if((status = H5Dclose(did)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Dclose(did)) < 0)
+ FAIL_STACK_ERROR
/* Close the UTF8 string datatype */
- if((status = H5Tclose(utf8_tid)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tclose(utf8_tid)) < 0)
+ FAIL_STACK_ERROR
/* Close the ASCII string datatype */
- if((status = H5Tclose(ascii_tid)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Tclose(ascii_tid)) < 0)
+ FAIL_STACK_ERROR
/* Close the dataspace */
- if((status = H5Sclose(sid)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Sclose(sid)) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if((status = H5Fclose(fid)) < 0) FAIL_STACK_ERROR
+ if ((status = H5Fclose(fid)) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(utf8_vtid);
H5Tclose(ascii_vtid);
H5Tclose(utf8_tid);
@@ -7374,7 +8099,8 @@ error:
H5Dclose(did);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
@@ -7395,125 +8121,132 @@ error:
* the library will only use basic version
*
*************************************************************************/
-static herr_t verify_version(hid_t dtype, H5F_libver_t low, unsigned *highest_version)
+static herr_t
+verify_version(hid_t dtype, H5F_libver_t low, unsigned *highest_version)
{
- hid_t base_dtype = -1;
- hid_t mem_dtype = -1;
- H5T_t *dtypep = NULL; /* Internal structure of a datatype */
- H5T_class_t type_cls = H5T_NO_CLASS; /* Temporary var for datatype class */
- int nmembers = 0;
- unsigned i;
- herr_t ret = SUCCEED; /* Generic return value */
+ hid_t base_dtype = -1;
+ hid_t mem_dtype = -1;
+ H5T_t * dtypep = NULL; /* Internal structure of a datatype */
+ H5T_class_t type_cls = H5T_NO_CLASS; /* Temporary var for datatype class */
+ int nmembers = 0;
+ unsigned i;
+ herr_t ret = SUCCEED; /* Generic return value */
dtypep = (H5T_t *)H5I_object(dtype);
- if (dtypep == NULL) TEST_ERROR
+ if (dtypep == NULL)
+ TEST_ERROR
/* Carry out the verification according to the class of the datatype.
For compound datatype, its members will be verified, recursively.
For array datatype, its element datatype will be verified, recursively.*/
type_cls = dtypep->shared->type;
- switch (type_cls)
- {
- case H5T_ARRAY:
- {
- H5T_t *base_dtypep = NULL; /* Internal structure of a datatype */
+ switch (type_cls) {
+ case H5T_ARRAY: {
+ H5T_t *base_dtypep = NULL; /* Internal structure of a datatype */
- if (low == H5F_LIBVER_EARLIEST)
- VERIFY(dtypep->shared->version, H5O_DTYPE_VERSION_2, "H5O_dtype_ver_bounds");
- else
- VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "H5O_dtype_ver_bounds");
+ if (low == H5F_LIBVER_EARLIEST)
+ VERIFY(dtypep->shared->version, H5O_DTYPE_VERSION_2, "H5O_dtype_ver_bounds");
+ else
+ VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "H5O_dtype_ver_bounds");
- /* Get the base datatype of this array type */
- base_dtype = H5Tget_super(dtype);
- CHECK(base_dtype, FAIL, "H5Tget_super");
+ /* Get the base datatype of this array type */
+ base_dtype = H5Tget_super(dtype);
+ CHECK(base_dtype, FAIL, "H5Tget_super");
- /* Get the base type's internal structure for version */
- base_dtypep = (H5T_t *)H5I_object(base_dtype);
- if (base_dtypep == NULL) TEST_ERROR
+ /* Get the base type's internal structure for version */
+ base_dtypep = (H5T_t *)H5I_object(base_dtype);
+ if (base_dtypep == NULL)
+ TEST_ERROR
/* Reset highest version if this datatype has higher version than
its outer type */
- if (*highest_version < base_dtypep->shared->version)
- *highest_version = base_dtypep->shared->version;
-
- /* Verify the base datatype recursively */
- ret = verify_version(base_dtype, low, highest_version);
-
- /* Close the member datatype before checking for failure */
- if ((H5Tclose(base_dtype)) < 0) TEST_ERROR
-
- /* Check if verify_version fails */
- if (ret < 0) TEST_ERROR
+ if (*highest_version < base_dtypep->shared->version)
+ *highest_version = base_dtypep->shared->version;
- break;
- }
- case H5T_COMPOUND:
- {
- H5T_t *mem_dtypep = NULL; /* Internal structure of a datatype */
- /* Get the number of members of this compound type */
- if ((nmembers = H5Tget_nmembers(dtype)) < 0) TEST_ERROR
-
- /* Go through all its member datatypes */
- for (i = 0; i < (unsigned)nmembers; i++)
- {
- /* Get the member datatype to verify it recursively */
- mem_dtype = H5Tget_member_type(dtype, i);
- if (mem_dtype < 0) TEST_ERROR
-
- /* Get the member type's internal structure for version */
- mem_dtypep = (H5T_t *)H5I_object(mem_dtype);
- if (mem_dtypep == NULL) TEST_ERROR
-
- /* Reset highest version if this datatype has higher version than
- its outer type */
- if (*highest_version < mem_dtypep->shared->version)
- *highest_version = mem_dtypep->shared->version;
-
- /* Verify the datatype recursively */
- ret = verify_version(mem_dtype, low, highest_version);
+ /* Verify the base datatype recursively */
+ ret = verify_version(base_dtype, low, highest_version);
/* Close the member datatype before checking for failure */
- if ((H5Tclose(mem_dtype)) < 0) TEST_ERROR
+ if ((H5Tclose(base_dtype)) < 0)
+ TEST_ERROR
/* Check if verify_version fails */
- if (ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
+
+ break;
+ }
+ case H5T_COMPOUND: {
+ H5T_t *mem_dtypep = NULL; /* Internal structure of a datatype */
+ /* Get the number of members of this compound type */
+ if ((nmembers = H5Tget_nmembers(dtype)) < 0)
+ TEST_ERROR
+
+ /* Go through all its member datatypes */
+ for (i = 0; i < (unsigned)nmembers; i++) {
+ /* Get the member datatype to verify it recursively */
+ mem_dtype = H5Tget_member_type(dtype, i);
+ if (mem_dtype < 0)
+ TEST_ERROR
+
+ /* Get the member type's internal structure for version */
+ mem_dtypep = (H5T_t *)H5I_object(mem_dtype);
+ if (mem_dtypep == NULL)
+ TEST_ERROR
+
+ /* Reset highest version if this datatype has higher version than
+ its outer type */
+ if (*highest_version < mem_dtypep->shared->version)
+ *highest_version = mem_dtypep->shared->version;
+
+ /* Verify the datatype recursively */
+ ret = verify_version(mem_dtype, low, highest_version);
+
+ /* Close the member datatype before checking for failure */
+ if ((H5Tclose(mem_dtype)) < 0)
+ TEST_ERROR
+
+ /* Check if verify_version fails */
+ if (ret < 0)
+ TEST_ERROR
+ }
+ /* If this compound datatype contains a datatype of higher version, it
+ will be promoted to that version, thus, verify with highest version */
+ if (*highest_version > H5O_dtype_ver_bounds[low])
+ VERIFY(dtypep->shared->version, *highest_version, "verify_version");
+ else
+ VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "verify_version");
+ break;
}
- /* If this compound datatype contains a datatype of higher version, it
- will be promoted to that version, thus, verify with highest version */
- if (*highest_version > H5O_dtype_ver_bounds[low])
- VERIFY(dtypep->shared->version, *highest_version, "verify_version");
- else
+ case H5T_ENUM:
VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "verify_version");
- break;
- }
- case H5T_ENUM:
- VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "verify_version");
- break;
- case H5T_VLEN:
- case H5T_FLOAT:
- case H5T_INTEGER:
- VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "verify_version");
- break;
- case H5T_NCLASSES:
- case H5T_NO_CLASS:
- case H5T_TIME:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_REFERENCE:
- default:
- TEST_ERROR
+ break;
+ case H5T_VLEN:
+ case H5T_FLOAT:
+ case H5T_INTEGER:
+ VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "verify_version");
+ break;
+ case H5T_NCLASSES:
+ case H5T_NO_CLASS:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_REFERENCE:
+ default:
+ TEST_ERROR
} /* end switch */
error:
- H5E_BEGIN_TRY {
- H5Tclose(base_dtype);
- H5Tclose(mem_dtype);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(base_dtype);
+ H5Tclose(mem_dtype);
+ }
+ H5E_END_TRY;
return ret;
} /* end of verify_version */
-
/*-------------------------------------------------------------------------
* Function: test_versionbounds
*
@@ -7538,139 +8271,162 @@ error:
*
*-------------------------------------------------------------------------
*/
-#define VERFNAME "tverbounds_dtype.h5"
-#define VERDSNAME "dataset 1"
-#define ARRAY_RANK 1
-#define ARRAY_LEN 10
+#define VERFNAME "tverbounds_dtype.h5"
+#define VERDSNAME "dataset 1"
+#define ARRAY_RANK 1
+#define ARRAY_LEN 10
static int
test_versionbounds(void)
{
- typedef struct { /* Struct for the simple compound type */
- int single_int;
+ typedef struct { /* Struct for the simple compound type */
+ int single_int;
char char_arr[ARRAY_LEN];
} simple_cmp_t;
- typedef struct { /* Struct for the inner compound type */
+ typedef struct { /* Struct for the inner compound type */
simple_cmp_t inner_arr[ARRAY_LEN];
- hvl_t vlen_float;
+ hvl_t vlen_float;
} inner_cmp_t;
- typedef struct { /* Struct for the outer compound type */
+ typedef struct { /* Struct for the outer compound type */
inner_cmp_t inner_cmp;
- color_t enum_color;
+ color_t enum_color;
} outer_cmp_t;
- hid_t file = -1; /* File ID */
- hid_t space = -1; /* Dataspace ID */
- hid_t dset = -1; /* Dataset ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t fapl = -1; /* Copy of file access property list ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t dset_dtype = -1; /* Dataset's datatype */
- hid_t arr_chartype = -1; /* Array of characters datatype */
- hid_t vlen_floattype = -1; /* Vlen of float datatype */
- hid_t enum_type = -1; /* Enumeration datatype */
- hid_t outer_cmp_type = -1; /* Outer compound datatype */
- hid_t inner_cmp_type = -1; /* Inner compound datatype */
- hid_t simple_cmp_type = -1;/* Simple cmpd dtype, contains no other cmpd */
- hid_t outer_arr_type = -1; /* Outermost array datatype */
- hid_t inner_arr_type = -1; /* Inner array datatype */
- H5F_t *filep = NULL; /* Pointer to internal structure of a file */
- H5T_t *dtypep = NULL; /* Pointer to internal structure of a datatype */
- hsize_t arr_dim[] = {ARRAY_LEN}; /* Length of the array */
- int low, high; /* Indices for iterating over versions */
- H5F_libver_t versions[] = {H5F_LIBVER_EARLIEST, H5F_LIBVER_V18, H5F_LIBVER_V110, H5F_LIBVER_V112, H5F_LIBVER_V114};
- int versions_count = 5; /* Number of version bounds in the array */
- unsigned highest_version; /* Highest version in nested datatypes */
- color_t enum_val; /* Enum type index */
- herr_t ret = 0; /* Generic return value */
+ hid_t file = -1; /* File ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fapl = -1; /* Copy of file access property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t dset_dtype = -1; /* Dataset's datatype */
+ hid_t arr_chartype = -1; /* Array of characters datatype */
+ hid_t vlen_floattype = -1; /* Vlen of float datatype */
+ hid_t enum_type = -1; /* Enumeration datatype */
+ hid_t outer_cmp_type = -1; /* Outer compound datatype */
+ hid_t inner_cmp_type = -1; /* Inner compound datatype */
+ hid_t simple_cmp_type = -1; /* Simple cmpd dtype, contains no other cmpd */
+ hid_t outer_arr_type = -1; /* Outermost array datatype */
+ hid_t inner_arr_type = -1; /* Inner array datatype */
+ H5F_t * filep = NULL; /* Pointer to internal structure of a file */
+ H5T_t * dtypep = NULL; /* Pointer to internal structure of a datatype */
+ hsize_t arr_dim[] = {ARRAY_LEN}; /* Length of the array */
+ int low, high; /* Indices for iterating over versions */
+ H5F_libver_t versions[] = {H5F_LIBVER_EARLIEST, H5F_LIBVER_V18, H5F_LIBVER_V110, H5F_LIBVER_V112,
+ H5F_LIBVER_V114};
+ int versions_count = 5; /* Number of version bounds in the array */
+ unsigned highest_version; /* Highest version in nested datatypes */
+ color_t enum_val; /* Enum type index */
+ herr_t ret = 0; /* Generic return value */
TESTING("version bounds with nested datatypes");
/* Create a file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR
/* Create a file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
/* Create a scalar dataspace */
- if ((space = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
+ if ((space = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR
/* Create a dataset creation property list */
- if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
/* Create an array datatype of chars */
arr_chartype = H5Tarray_create2(H5T_NATIVE_CHAR, ARRAY_RANK, arr_dim);
- if (arr_chartype < 0) TEST_ERROR
+ if (arr_chartype < 0)
+ TEST_ERROR
/* Create the simple compound datatype that has an integer and an
array of chars */
simple_cmp_type = H5Tcreate(H5T_COMPOUND, sizeof(simple_cmp_t));
- if (simple_cmp_type < 0) TEST_ERROR
+ if (simple_cmp_type < 0)
+ TEST_ERROR
/* Insert integer field */
ret = H5Tinsert(simple_cmp_type, "single_int", HOFFSET(simple_cmp_t, single_int), H5T_NATIVE_INT);
- if (ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Insert array field */
ret = H5Tinsert(simple_cmp_type, "char_arr", HOFFSET(simple_cmp_t, char_arr), arr_chartype);
- if (ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Create an array datatype containing simple compound datatype */
inner_arr_type = H5Tarray_create2(simple_cmp_type, ARRAY_RANK, arr_dim);
- if (inner_arr_type < 0) TEST_ERROR
+ if (inner_arr_type < 0)
+ TEST_ERROR
/* Create a VL datatype of floats */
vlen_floattype = H5Tvlen_create(H5T_NATIVE_FLOAT);
- if (vlen_floattype < 0) TEST_ERROR
+ if (vlen_floattype < 0)
+ TEST_ERROR
/* Create the innermost compound datatype that houses inner_arr_type and vlen_floattype */
inner_cmp_type = H5Tcreate(H5T_COMPOUND, sizeof(inner_cmp_t));
- if (inner_cmp_type < 0) TEST_ERROR
+ if (inner_cmp_type < 0)
+ TEST_ERROR
/* Insert integer field */
ret = H5Tinsert(inner_cmp_type, "inner_arr", HOFFSET(inner_cmp_t, inner_arr), inner_arr_type);
- if (ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Insert integer field */
ret = H5Tinsert(inner_cmp_type, "vlen_float", HOFFSET(inner_cmp_t, vlen_float), vlen_floattype);
- if (ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Create a enumerate datatype */
enum_type = H5Tcreate(H5T_ENUM, sizeof(color_t));
- if (enum_type < 0) TEST_ERROR
+ if (enum_type < 0)
+ TEST_ERROR
enum_val = E1_RED;
- ret = H5Tenum_insert(enum_type, "RED", &enum_val);
- if (ret < 0) TEST_ERROR
+ ret = H5Tenum_insert(enum_type, "RED", &enum_val);
+ if (ret < 0)
+ TEST_ERROR
enum_val = E1_GREEN;
- ret = H5Tenum_insert(enum_type, "GREEN", &enum_val);
- if (ret < 0) TEST_ERROR
+ ret = H5Tenum_insert(enum_type, "GREEN", &enum_val);
+ if (ret < 0)
+ TEST_ERROR
enum_val = E1_BLUE;
- ret = H5Tenum_insert(enum_type, "BLUE", &enum_val);
- if (ret < 0) TEST_ERROR
+ ret = H5Tenum_insert(enum_type, "BLUE", &enum_val);
+ if (ret < 0)
+ TEST_ERROR
enum_val = E1_ORANGE;
- ret = H5Tenum_insert(enum_type, "ORANGE", &enum_val);
- if (ret < 0) TEST_ERROR
+ ret = H5Tenum_insert(enum_type, "ORANGE", &enum_val);
+ if (ret < 0)
+ TEST_ERROR
enum_val = E1_YELLOW;
- ret = H5Tenum_insert(enum_type, "YELLOW", &enum_val);
- if (ret < 0) TEST_ERROR
+ ret = H5Tenum_insert(enum_type, "YELLOW", &enum_val);
+ if (ret < 0)
+ TEST_ERROR
/* Create the outer compound datatype that contains the inner compound datatype and the enum datatype */
outer_cmp_type = H5Tcreate(H5T_COMPOUND, sizeof(outer_cmp_t));
- if (ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Insert integer field */
ret = H5Tinsert(outer_cmp_type, "inner_cmp", HOFFSET(outer_cmp_t, inner_cmp), inner_cmp_type);
- if (ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Insert enum field */
ret = H5Tinsert(outer_cmp_type, "enum_color", HOFFSET(outer_cmp_t, enum_color), enum_type);
- if (ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Create an array datatype containing the outer compound datatype */
if ((outer_arr_type = H5Tarray_create2(outer_cmp_type, ARRAY_RANK, arr_dim)) < 0)
@@ -7680,60 +8436,71 @@ test_versionbounds(void)
skipping invalid combinations */
/* Create the file, create and write to a dataset with compound datatype */
/* Verify the dataset's datatype and its members */
- for(low = 0; low < versions_count; low++) {
+ for (low = 0; low < versions_count; low++) {
- for(high = 0; high < versions_count; high++) {
+ for (high = 0; high < versions_count; high++) {
/* Set version bounds */
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(fapl, versions[low], versions[high]);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl, versions[low], versions[high]); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
continue;
/* Create a file */
file = H5Fcreate(VERFNAME, H5F_ACC_TRUNC, fcpl, fapl);
- if (file < 0) TEST_ERROR
+ if (file < 0)
+ TEST_ERROR
/* Get the internal file pointer if the create succeeds */
- if ((filep = (H5F_t *)H5I_object(file)) == NULL) TEST_ERROR
+ if ((filep = (H5F_t *)H5I_object(file)) == NULL)
+ TEST_ERROR
/* Create dataset using the array type */
dset = H5Dcreate2(file, VERDSNAME, outer_arr_type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if (dset < 0) TEST_ERROR
+ if (dset < 0)
+ TEST_ERROR
/* Get the dataset's datatype */
- if ((dset_dtype = H5Dget_type(dset)) < 0) TEST_ERROR
+ if ((dset_dtype = H5Dget_type(dset)) < 0)
+ TEST_ERROR
/* Get the version of this datatype */
dtypep = (H5T_t *)H5I_object(dset_dtype);
- if (dtypep == NULL) TEST_ERROR
+ if (dtypep == NULL)
+ TEST_ERROR
highest_version = dtypep->shared->version;
/* Verify version of the datatype recursevily */
ret = verify_version(dset_dtype, versions[low], &highest_version);
/* Close the dataset's datatype */
- if (H5Tclose(dset_dtype) < 0) TEST_ERROR
+ if (H5Tclose(dset_dtype) < 0)
+ TEST_ERROR
/* Close dataset and file */
- if (H5Dclose(dset) < 0) TEST_ERROR
- if (H5Fclose(file) < 0) TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
} /* for high */
- } /* for low */
+ } /* for low */
/* Close dataspace and property lists */
- if (H5Sclose(space) < 0) TEST_ERROR
- if (H5Pclose(fcpl) < 0) TEST_ERROR
- if (H5Pclose(fapl) < 0) TEST_ERROR
+ if (H5Sclose(space) < 0)
+ TEST_ERROR
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(space);
H5Tclose(dset_dtype);
@@ -7741,11 +8508,11 @@ error:
H5Pclose(fcpl);
H5Pclose(fapl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_versionbounds() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -7762,8 +8529,8 @@ error:
int
main(void)
{
- long nerrors = 0;
- hid_t fapl = H5I_INVALID_HID;
+ long nerrors = 0;
+ hid_t fapl = H5I_INVALID_HID;
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -7771,7 +8538,7 @@ main(void)
reset_hdf5();
fapl = h5_fileaccess();
- if(ALIGNMENT)
+ if (ALIGNMENT)
HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
/* Do the tests */
@@ -7826,8 +8593,8 @@ main(void)
nerrors += test_utf_ascii_conv();
nerrors += test_versionbounds();
- if(nerrors) {
- HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S");
+ if (nerrors) {
+ HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
}
@@ -7835,4 +8602,3 @@ main(void)
return 0;
}
-
diff --git a/test/earray.c b/test/earray.c
index 8f99331..79bf0f1 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -20,94 +20,97 @@
* This file needs to access private datatypes from the H5EA package.
* This file also needs to access the extensible array testing code.
*/
-#define H5EA_FRIEND /*suppress error about including H5EApkg */
+#define H5EA_FRIEND /*suppress error about including H5EApkg */
#define H5EA_TESTING
-#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5EApkg.h" /* Extensible Arrays */
/* Other private headers that this test requires */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Iprivate.h" /* IDs */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-#include "H5VMprivate.h" /* Vectors and arrays */
-
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VMprivate.h" /* Vectors and arrays */
/* Local macros */
/* Max. testfile name length */
-#define EARRAY_FILENAME_LEN 1024
+#define EARRAY_FILENAME_LEN 1024
/* Extensible array creation values */
-#define ELMT_SIZE sizeof(uint64_t)
-#define MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */
-#define IDX_BLK_ELMTS 4
-#define SUP_BLK_MIN_DATA_PTRS 4
-#define DATA_BLK_MIN_ELMTS 16
-#define MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
+#define ELMT_SIZE sizeof(uint64_t)
+#define MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */
+#define IDX_BLK_ELMTS 4
+#define SUP_BLK_MIN_DATA_PTRS 4
+#define DATA_BLK_MIN_ELMTS 16
+#define MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
/* Convenience macros for computing earray state */
-#define EA_HDR_SIZE 72 /* (hard-coded, current size) */
-#define EA_IBLOCK_SIZE 298 /* (hard-coded, current size) */
-#define EA_NELMTS(cparam, tparam, idx, sblk_idx) \
- (hsize_t)(cparam->idx_blk_elmts + \
- tparam->sblk_info[sblk_idx].start_idx + \
- ((1 + ((idx - (cparam->idx_blk_elmts + tparam->sblk_info[sblk_idx].start_idx)) / tparam->sblk_info[sblk_idx].dblk_nelmts)) \
- * tparam->sblk_info[sblk_idx].dblk_nelmts))
-#define EA_NDATA_BLKS(cparam, tparam, idx, sblk_idx) \
- (1 + tparam->sblk_info[sblk_idx].start_dblk + \
- ((idx - (cparam->idx_blk_elmts + tparam->sblk_info[sblk_idx].start_idx)) / tparam->sblk_info[sblk_idx].dblk_nelmts))
+#define EA_HDR_SIZE 72 /* (hard-coded, current size) */
+#define EA_IBLOCK_SIZE 298 /* (hard-coded, current size) */
+#define EA_NELMTS(cparam, tparam, idx, sblk_idx) \
+ (hsize_t)(cparam->idx_blk_elmts + tparam->sblk_info[sblk_idx].start_idx + \
+ ((1 + ((idx - (cparam->idx_blk_elmts + tparam->sblk_info[sblk_idx].start_idx)) / \
+ tparam->sblk_info[sblk_idx].dblk_nelmts)) * \
+ tparam->sblk_info[sblk_idx].dblk_nelmts))
+#define EA_NDATA_BLKS(cparam, tparam, idx, sblk_idx) \
+ (1 + tparam->sblk_info[sblk_idx].start_dblk + \
+ ((idx - (cparam->idx_blk_elmts + tparam->sblk_info[sblk_idx].start_idx)) / \
+ tparam->sblk_info[sblk_idx].dblk_nelmts))
/* Iterator parameter values */
-#define EA_RND2_SCALE 100
-#define EA_CYC_COUNT 4
+#define EA_RND2_SCALE 100
+#define EA_CYC_COUNT 4
/* Local typedefs */
/* Types of tests to perform */
typedef enum {
- EARRAY_TEST_NORMAL, /* "Normal" test, with no testing parameters set */
- EARRAY_TEST_REOPEN, /* Set the reopen_array flag */
- EARRAY_TEST_NTESTS /* The number of test types, must be last */
+ EARRAY_TEST_NORMAL, /* "Normal" test, with no testing parameters set */
+ EARRAY_TEST_REOPEN, /* Set the reopen_array flag */
+ EARRAY_TEST_NTESTS /* The number of test types, must be last */
} earray_test_type_t;
/* Types of iteration to perform */
typedef enum {
- EARRAY_ITER_FW, /* "Forward" iteration */
- EARRAY_ITER_RV, /* "Reverse" iteration */
- EARRAY_ITER_RND, /* "Random" iteration */
- EARRAY_ITER_CYC, /* "Cyclic" iteration */
- EARRAY_ITER_RND2, /* "Random #2" iteration */
- EARRAY_ITER_NITERS /* The number of iteration types, must be last */
+ EARRAY_ITER_FW, /* "Forward" iteration */
+ EARRAY_ITER_RV, /* "Reverse" iteration */
+ EARRAY_ITER_RND, /* "Random" iteration */
+ EARRAY_ITER_CYC, /* "Cyclic" iteration */
+ EARRAY_ITER_RND2, /* "Random #2" iteration */
+ EARRAY_ITER_NITERS /* The number of iteration types, must be last */
} earray_iter_type_t;
/* Orders to operate on entries */
typedef enum {
- EARRAY_DIR_FORWARD, /* Insert objects from 0 -> nobjs */
- EARRAY_DIR_RANDOM, /* Insert objects randomly from 0 - nobjs */
- EARRAY_DIR_CYCLIC, /* Insert every n'th object cyclicly: 0, n, 2n, 3n, ..., nobjs/n, 1+nobjs/n, 1+n+nobjs/n, 1+2n+nobjs/n, ..., nobjs */
- EARRAY_DIR_REVERSE, /* Insert objects from nobjs -> 0 */
- EARRAY_DIR_INWARD, /* Insert objects from outside to in: 0, nobjs, 1, nobjs-1, 2, nobjs-2, ..., nobjs/2 */
- EARRAY_DIR_OUTWARD, /* Insert objects from inside to out: nobjs/2, (nobjs/2)-1, (nobjs/2)+1, ..., 0, nobjs */
- EARRAY_DIR_NDIRS /* The number of different insertion orders, must be last */
+ EARRAY_DIR_FORWARD, /* Insert objects from 0 -> nobjs */
+ EARRAY_DIR_RANDOM, /* Insert objects randomly from 0 - nobjs */
+ EARRAY_DIR_CYCLIC, /* Insert every n'th object cyclicly: 0, n, 2n, 3n, ..., nobjs/n, 1+nobjs/n,
+ 1+n+nobjs/n, 1+2n+nobjs/n, ..., nobjs */
+ EARRAY_DIR_REVERSE, /* Insert objects from nobjs -> 0 */
+ EARRAY_DIR_INWARD, /* Insert objects from outside to in: 0, nobjs, 1, nobjs-1, 2, nobjs-2, ..., nobjs/2 */
+ EARRAY_DIR_OUTWARD, /* Insert objects from inside to out: nobjs/2, (nobjs/2)-1, (nobjs/2)+1, ..., 0, nobjs
+ */
+ EARRAY_DIR_NDIRS /* The number of different insertion orders, must be last */
} earray_test_dir_t;
/* Whether to compress data blocks */
typedef enum {
- EARRAY_TEST_NO_COMPRESS, /* Don't compress data blocks */
- EARRAY_TEST_COMPRESS, /* Compress data blocks */
- EARRAY_TEST_COMP_N /* The number of different ways to test compressing array blocks, must be last */
+ EARRAY_TEST_NO_COMPRESS, /* Don't compress data blocks */
+ EARRAY_TEST_COMPRESS, /* Compress data blocks */
+ EARRAY_TEST_COMP_N /* The number of different ways to test compressing array blocks, must be last */
} earray_test_comp_t;
/* Extensible array state information */
typedef struct earray_state_t {
- hsize_t hdr_size; /* Size of header */
- hsize_t nindex_blks; /* # of index blocks */
- hsize_t index_blk_size; /* Size of index blocks */
- hsize_t nsuper_blks; /* # of super blocks */
- hsize_t super_blk_size; /* Size of super blocks */
- hsize_t ndata_blks; /* # of data blocks */
- hsize_t data_blk_size; /* Size of data blocks */
- hsize_t max_idx_set; /* Highest element index stored (+1 - i.e. if element 0 has been set, this value with be '1', if no elements have been stored, this value will be '0') */
- hsize_t nelmts; /* # of elements "realized" */
+ hsize_t hdr_size; /* Size of header */
+ hsize_t nindex_blks; /* # of index blocks */
+ hsize_t index_blk_size; /* Size of index blocks */
+ hsize_t nsuper_blks; /* # of super blocks */
+ hsize_t super_blk_size; /* Size of super blocks */
+ hsize_t ndata_blks; /* # of data blocks */
+ hsize_t data_blk_size; /* Size of data blocks */
+ hsize_t max_idx_set; /* Highest element index stored (+1 - i.e. if element 0 has been set, this value with
+ be '1', if no elements have been stored, this value will be '0') */
+ hsize_t nelmts; /* # of elements "realized" */
} earray_state_t;
/* Forward decl. */
@@ -116,34 +119,34 @@ typedef struct earray_test_param_t earray_test_param_t;
/* Extensible array iterator class */
typedef struct earray_iter_t {
void *(*init)(const H5EA_create_t *cparam, const earray_test_param_t *tparam,
- hsize_t cnt); /* Initialize/allocate iterator private info */
- hssize_t (*next)(void *info); /* Get the next element to test */
- hssize_t (*max_elem)(const void *info); /* Get the max. element set */
- int (*state)(void *_eiter, const H5EA_create_t *cparam,
- const earray_test_param_t *tparam, earray_state_t *state, hsize_t idx); /* Get the state of the extensible array */
- herr_t (*term)(void *info); /* Shutdown/free iterator private info */
+ hsize_t cnt); /* Initialize/allocate iterator private info */
+ hssize_t (*next)(void *info); /* Get the next element to test */
+ hssize_t (*max_elem)(const void *info); /* Get the max. element set */
+ int (*state)(void *_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam,
+ earray_state_t *state, hsize_t idx); /* Get the state of the extensible array */
+ herr_t (*term)(void *info); /* Shutdown/free iterator private info */
} earray_iter_t;
/* Testing parameters */
struct earray_test_param_t {
- earray_test_type_t reopen_array; /* Whether to re-open the array during the test */
- earray_test_comp_t comp; /* Whether to compress the blocks or not */
- const earray_iter_t *eiter; /* Iterator to use for this test */
+ earray_test_type_t reopen_array; /* Whether to re-open the array during the test */
+ earray_test_comp_t comp; /* Whether to compress the blocks or not */
+ const earray_iter_t *eiter; /* Iterator to use for this test */
/* Super block information */
- size_t nsblks; /* Number of superblocks needed for array */
- H5EA_sblk_info_t *sblk_info; /* Array of information for each super block */
+ size_t nsblks; /* Number of superblocks needed for array */
+ H5EA_sblk_info_t *sblk_info; /* Array of information for each super block */
};
/* Flush depend test context */
typedef struct earray_flush_depend_ctx_t {
- hbool_t base_obj; /* Flag to indicate that base object has been flushed */
- hbool_t idx0_obj; /* Flag to indicate that index 0's object has been flushed */
- hbool_t idx0_elem; /* Flag to indicate that index 0's element has been flushed */
- hbool_t idx1_obj; /* Flag to indicate that index 1's object has been flushed */
- hbool_t idx1_elem; /* Flag to indicate that index 1's element has been flushed */
- hbool_t idx10000_obj; /* Flag to indicate that index 10000's object has been flushed */
- hbool_t idx10000_elem; /* Flag to indicate that index 10000's element has been flushed */
+ hbool_t base_obj; /* Flag to indicate that base object has been flushed */
+ hbool_t idx0_obj; /* Flag to indicate that index 0's object has been flushed */
+ hbool_t idx0_elem; /* Flag to indicate that index 0's element has been flushed */
+ hbool_t idx1_obj; /* Flag to indicate that index 1's object has been flushed */
+ hbool_t idx1_elem; /* Flag to indicate that index 1's element has been flushed */
+ hbool_t idx10000_obj; /* Flag to indicate that index 10000's object has been flushed */
+ hbool_t idx10000_elem; /* Flag to indicate that index 10000's element has been flushed */
} earray_flush_depend_ctx_t;
/* Extensible array test cache object */
@@ -152,20 +155,14 @@ typedef struct earray_test_t {
H5AC_info_t cache_info;
/* Entry information */
- uint64_t idx; /* Index that entry corresponds to */
+ uint64_t idx; /* Index that entry corresponds to */
earray_flush_depend_ctx_t *fd_info; /* Context information for flush depend test */
} earray_test_t;
-
/* Local prototypes */
-
/* Local variables */
-const char *FILENAME[] = {
- "earray",
- "earray_tmp",
- NULL
-};
+const char *FILENAME[] = {"earray", "earray_tmp", NULL};
/* Filename to use for all tests */
char filename_g[EARRAY_FILENAME_LEN];
@@ -173,7 +170,6 @@ char filename_g[EARRAY_FILENAME_LEN];
/* Empty file size */
h5_stat_size_t empty_size_g;
-
/*-------------------------------------------------------------------------
* Function: init_cparam
*
@@ -194,18 +190,17 @@ init_cparam(H5EA_create_t *cparam)
HDmemset(cparam, 0, sizeof(*cparam));
/* General parameters */
- cparam->cls = H5EA_CLS_TEST;
- cparam->raw_elmt_size = ELMT_SIZE;
- cparam->max_nelmts_bits = MAX_NELMTS_BITS;
- cparam->idx_blk_elmts = IDX_BLK_ELMTS;
- cparam->sup_blk_min_data_ptrs = SUP_BLK_MIN_DATA_PTRS;
- cparam->data_blk_min_elmts = DATA_BLK_MIN_ELMTS;
+ cparam->cls = H5EA_CLS_TEST;
+ cparam->raw_elmt_size = ELMT_SIZE;
+ cparam->max_nelmts_bits = MAX_NELMTS_BITS;
+ cparam->idx_blk_elmts = IDX_BLK_ELMTS;
+ cparam->sup_blk_min_data_ptrs = SUP_BLK_MIN_DATA_PTRS;
+ cparam->data_blk_min_elmts = DATA_BLK_MIN_ELMTS;
cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS;
- return(0);
+ return (0);
} /* init_cparam() */
-
/*-------------------------------------------------------------------------
* Function: init_tparam
*
@@ -224,9 +219,9 @@ init_cparam(H5EA_create_t *cparam)
static int
init_tparam(earray_test_param_t *tparam, const H5EA_create_t *cparam)
{
- hsize_t start_idx; /* First element index for each super block */
- hsize_t start_dblk; /* First data block index for each super block */
- size_t u; /* Local index variable */
+ hsize_t start_idx; /* First element index for each super block */
+ hsize_t start_dblk; /* First data block index for each super block */
+ size_t u; /* Local index variable */
/* Wipe out background */
HDmemset(tparam, 0, sizeof(*tparam));
@@ -239,23 +234,22 @@ init_tparam(earray_test_param_t *tparam, const H5EA_create_t *cparam)
HDassert(tparam->sblk_info);
/* Compute information about each super block */
- start_idx = 0;
+ start_idx = 0;
start_dblk = 0;
- for(u = 0; u < tparam->nsblks; u++) {
- tparam->sblk_info[u].ndblks = (size_t)H5_EXP2(u / 2);
+ for (u = 0; u < tparam->nsblks; u++) {
+ tparam->sblk_info[u].ndblks = (size_t)H5_EXP2(u / 2);
tparam->sblk_info[u].dblk_nelmts = (size_t)H5_EXP2((u + 1) / 2) * cparam->data_blk_min_elmts;
- tparam->sblk_info[u].start_idx = start_idx;
- tparam->sblk_info[u].start_dblk = start_dblk;
+ tparam->sblk_info[u].start_idx = start_idx;
+ tparam->sblk_info[u].start_dblk = start_dblk;
/* Advance starting indices for next super block */
start_idx += (hsize_t)tparam->sblk_info[u].ndblks * (hsize_t)tparam->sblk_info[u].dblk_nelmts;
start_dblk += (hsize_t)tparam->sblk_info[u].ndblks;
} /* end for */
- return(0);
+ return (0);
} /* init_tparam() */
-
/*-------------------------------------------------------------------------
* Function: finish_tparam
*
@@ -276,10 +270,9 @@ finish_tparam(earray_test_param_t *tparam)
HDfree(tparam->sblk_info);
tparam->sblk_info = NULL;
- return(0);
+ return (0);
} /* finish_tparam() */
-
/*-------------------------------------------------------------------------
* Function: create_file
*
@@ -297,25 +290,24 @@ static int
create_file(unsigned flags, hid_t fapl, hid_t *file, H5F_t **f)
{
/* Create the file to work on */
- if((*file = H5Fcreate(filename_g, flags, H5P_DEFAULT, fapl)) < 0)
+ if ((*file = H5Fcreate(filename_g, flags, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (*f = (H5F_t *)H5VL_object(*file)))
+ if (NULL == (*f = (H5F_t *)H5VL_object(*file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(*f) < 0)
+ if (H5AC_ignore_tags(*f) < 0)
FAIL_STACK_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* create_file() */
-
/*-------------------------------------------------------------------------
* Function: check_stats
*
@@ -332,64 +324,83 @@ error:
static int
check_stats(const H5EA_t *ea, const earray_state_t *state)
{
- H5EA_stat_t earray_stats; /* Statistics about the array */
+ H5EA_stat_t earray_stats; /* Statistics about the array */
/* Get statistics for extensible array and verify they are correct */
- if(H5EA_get_stats(ea, &earray_stats) < 0)
+ if (H5EA_get_stats(ea, &earray_stats) < 0)
FAIL_STACK_ERROR
/* Compare information */
- if(earray_stats.stored.max_idx_set != state->max_idx_set) {
- HDfprintf(stdout, "earray_stats.stored.max_idx_set = %" PRIuHSIZE ", state->max_idx_set = %" PRIuHSIZE "\n", earray_stats.stored.max_idx_set, state->max_idx_set);
+ if (earray_stats.stored.max_idx_set != state->max_idx_set) {
+ HDfprintf(stdout,
+ "earray_stats.stored.max_idx_set = %" PRIuHSIZE ", state->max_idx_set = %" PRIuHSIZE "\n",
+ earray_stats.stored.max_idx_set, state->max_idx_set);
TEST_ERROR
} /* end if */
- if(earray_stats.stored.nelmts != state->nelmts) {
- HDfprintf(stdout, "earray_stats.stored.nelmts = %" PRIuHSIZE ", state->nelmts = %" PRIuHSIZE "\n", earray_stats.stored.nelmts, state->nelmts);
+ if (earray_stats.stored.nelmts != state->nelmts) {
+ HDfprintf(stdout, "earray_stats.stored.nelmts = %" PRIuHSIZE ", state->nelmts = %" PRIuHSIZE "\n",
+ earray_stats.stored.nelmts, state->nelmts);
TEST_ERROR
} /* end if */
- if(earray_stats.computed.hdr_size != state->hdr_size) {
- HDfprintf(stdout, "earray_stats.computed.hdr_size = %" PRIuHSIZE ", state->hdr_size = %" PRIuHSIZE "\n", earray_stats.computed.hdr_size, state->hdr_size);
+ if (earray_stats.computed.hdr_size != state->hdr_size) {
+ HDfprintf(stdout,
+ "earray_stats.computed.hdr_size = %" PRIuHSIZE ", state->hdr_size = %" PRIuHSIZE "\n",
+ earray_stats.computed.hdr_size, state->hdr_size);
TEST_ERROR
} /* end if */
- if(earray_stats.computed.nindex_blks != state->nindex_blks) {
- HDfprintf(stdout, "earray_stats.computed.nindex_blks = %" PRIuHSIZE ", state->nindex_blks = %" PRIuHSIZE "\n", earray_stats.computed.nindex_blks, state->nindex_blks);
+ if (earray_stats.computed.nindex_blks != state->nindex_blks) {
+ HDfprintf(stdout,
+ "earray_stats.computed.nindex_blks = %" PRIuHSIZE ", state->nindex_blks = %" PRIuHSIZE "\n",
+ earray_stats.computed.nindex_blks, state->nindex_blks);
TEST_ERROR
} /* end if */
- if(earray_stats.computed.index_blk_size != state->index_blk_size) {
- HDfprintf(stdout, "earray_stats.computed.index_blk_size = %" PRIuHSIZE ", state->index_blk_size = %" PRIuHSIZE "\n", earray_stats.computed.index_blk_size, state->index_blk_size);
+ if (earray_stats.computed.index_blk_size != state->index_blk_size) {
+ HDfprintf(stdout,
+ "earray_stats.computed.index_blk_size = %" PRIuHSIZE ", state->index_blk_size = %" PRIuHSIZE
+ "\n",
+ earray_stats.computed.index_blk_size, state->index_blk_size);
TEST_ERROR
} /* end if */
- if(earray_stats.stored.ndata_blks != state->ndata_blks) {
- HDfprintf(stdout, "earray_stats.stored.ndata_blks = %" PRIuHSIZE ", state->ndata_blks = %" PRIuHSIZE "\n", earray_stats.stored.ndata_blks, state->ndata_blks);
+ if (earray_stats.stored.ndata_blks != state->ndata_blks) {
+ HDfprintf(stdout,
+ "earray_stats.stored.ndata_blks = %" PRIuHSIZE ", state->ndata_blks = %" PRIuHSIZE "\n",
+ earray_stats.stored.ndata_blks, state->ndata_blks);
TEST_ERROR
} /* end if */
/* Don't compare this currently, it's very hard to compute */
#ifdef NOT_YET
- if(earray_stats.stored.data_blk_size != state->data_blk_size) {
- HDfprintf(stdout, "earray_stats.stored.data_blk_size = %" PRIuHSIZE ", state->data_blk_size = %" PRIuHSIZE "\n", earray_stats.stored.data_blk_size, state->data_blk_size);
+ if (earray_stats.stored.data_blk_size != state->data_blk_size) {
+ HDfprintf(stdout,
+ "earray_stats.stored.data_blk_size = %" PRIuHSIZE ", state->data_blk_size = %" PRIuHSIZE
+ "\n",
+ earray_stats.stored.data_blk_size, state->data_blk_size);
TEST_ERROR
- } /* end if */
+ } /* end if */
#endif /* NOT_YET */
- if(earray_stats.stored.nsuper_blks != state->nsuper_blks) {
- HDfprintf(stdout, "earray_stats.stored.nsuper_blks = %" PRIuHSIZE ", state->nsuper_blks = %" PRIuHSIZE "\n", earray_stats.stored.nsuper_blks, state->nsuper_blks);
+ if (earray_stats.stored.nsuper_blks != state->nsuper_blks) {
+ HDfprintf(stdout,
+ "earray_stats.stored.nsuper_blks = %" PRIuHSIZE ", state->nsuper_blks = %" PRIuHSIZE "\n",
+ earray_stats.stored.nsuper_blks, state->nsuper_blks);
TEST_ERROR
} /* end if */
/* Don't compare this currently, it's very hard to compute */
#ifdef NOT_YET
- if(earray_stats.stored.super_blk_size != state->super_blk_size) {
- HDfprintf(stdout, "earray_stats.stored.super_blk_size = %" PRIuHSIZE ", state->super_blk_size = %" PRIuHSIZE "\n", earray_stats.stored.super_blk_size, state->super_blk_size);
+ if (earray_stats.stored.super_blk_size != state->super_blk_size) {
+ HDfprintf(stdout,
+ "earray_stats.stored.super_blk_size = %" PRIuHSIZE ", state->super_blk_size = %" PRIuHSIZE
+ "\n",
+ earray_stats.stored.super_blk_size, state->super_blk_size);
TEST_ERROR
- } /* end if */
+ } /* end if */
#endif /* NOT_YET */
/* All tests passed */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* check_stats() */
-
/*-------------------------------------------------------------------------
* Function: reopen_file
*
@@ -404,53 +415,52 @@ error:
*-------------------------------------------------------------------------
*/
static int
-reopen_file(hid_t *file, H5F_t **f, hid_t fapl,
- H5EA_t **ea, haddr_t ea_addr, const earray_test_param_t *tparam)
+reopen_file(hid_t *file, H5F_t **f, hid_t fapl, H5EA_t **ea, haddr_t ea_addr,
+ const earray_test_param_t *tparam)
{
/* Check for closing & re-opening the array */
/* (actually will close & re-open the file as well) */
- if(tparam->reopen_array) {
+ if (tparam->reopen_array) {
/* Close array, if given */
- if(ea && *ea) {
- if(H5EA_close(*ea) < 0)
+ if (ea && *ea) {
+ if (H5EA_close(*ea) < 0)
FAIL_STACK_ERROR
*ea = NULL;
} /* end if */
/* Close file */
- if(*file) {
- if(H5Fclose(*file) < 0)
+ if (*file) {
+ if (H5Fclose(*file) < 0)
FAIL_STACK_ERROR
*file = (-1);
- *f = NULL;
+ *f = NULL;
} /* end if */
/* Re-open the file */
- if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
+ if ((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (*f = (H5F_t *)H5VL_object(*file)))
+ if (NULL == (*f = (H5F_t *)H5VL_object(*file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(*f) < 0)
+ if (H5AC_ignore_tags(*f) < 0)
FAIL_STACK_ERROR
/* Re-open array, if given */
- if(ea)
- if(NULL == (*ea = H5EA_open(*f, ea_addr, NULL)))
+ if (ea)
+ if (NULL == (*ea = H5EA_open(*f, ea_addr, NULL)))
FAIL_STACK_ERROR
} /* end if */
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* reopen_file() */
-
/*-------------------------------------------------------------------------
* Function: create_array
*
@@ -465,39 +475,37 @@ error:
*-------------------------------------------------------------------------
*/
static int
-create_array(H5F_t *f, const H5EA_create_t *cparam,
- H5EA_t **ea, haddr_t *ea_addr, H5EA__ctx_cb_t *cb)
+create_array(H5F_t *f, const H5EA_create_t *cparam, H5EA_t **ea, haddr_t *ea_addr, H5EA__ctx_cb_t *cb)
{
- hsize_t nelmts; /* Number of elements in array */
- earray_state_t state; /* State of extensible array */
+ hsize_t nelmts; /* Number of elements in array */
+ earray_state_t state; /* State of extensible array */
/* Create array */
- if(NULL == (*ea = H5EA_create(f, cparam, cb)))
+ if (NULL == (*ea = H5EA_create(f, cparam, cb)))
FAIL_STACK_ERROR
/* Check status of array */
nelmts = (hsize_t)ULLONG_MAX;
- if(H5EA_get_nelmts(*ea, &nelmts) < 0)
+ if (H5EA_get_nelmts(*ea, &nelmts) < 0)
FAIL_STACK_ERROR
- if(nelmts > 0)
+ if (nelmts > 0)
TEST_ERROR
- if(H5EA_get_addr(*ea, ea_addr) < 0)
+ if (H5EA_get_addr(*ea, ea_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(*ea_addr))
+ if (!H5F_addr_defined(*ea_addr))
TEST_ERROR
HDmemset(&state, 0, sizeof(state));
state.hdr_size = EA_HDR_SIZE;
- if(check_stats(*ea, &state))
+ if (check_stats(*ea, &state))
TEST_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* create_array() */
-
/*-------------------------------------------------------------------------
* Function: verify_cparam
*
@@ -514,15 +522,15 @@ error:
static int
verify_cparam(const H5EA_t *ea, const H5EA_create_t *cparam)
{
- H5EA_create_t test_cparam; /* Creation parameters for array */
+ H5EA_create_t test_cparam; /* Creation parameters for array */
/* Retrieve creation parameters */
HDmemset(&test_cparam, 0, sizeof(H5EA_create_t));
- if(H5EA__get_cparam_test(ea, &test_cparam) < 0)
+ if (H5EA__get_cparam_test(ea, &test_cparam) < 0)
FAIL_STACK_ERROR
/* Verify creation parameters */
- if(H5EA__cmp_cparam_test(cparam, &test_cparam))
+ if (H5EA__cmp_cparam_test(cparam, &test_cparam))
TEST_ERROR
/* Success */
@@ -532,7 +540,6 @@ error:
return FAIL;
} /* verify_cparam() */
-
/*-------------------------------------------------------------------------
* Function: finish
*
@@ -550,37 +557,35 @@ error:
static int
finish(hid_t file, hid_t fapl, H5F_t *f, H5EA_t *ea, haddr_t ea_addr)
{
- h5_stat_size_t file_size; /* File size, after deleting array */
+ h5_stat_size_t file_size; /* File size, after deleting array */
/* Close the extensible array */
- if(H5EA_close(ea) < 0)
+ if (H5EA_close(ea) < 0)
FAIL_STACK_ERROR
/* Delete array */
- if(H5EA_delete(f, ea_addr, NULL) < 0)
+ if (H5EA_delete(f, ea_addr, NULL) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
-
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename_g, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename_g, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size_g)
+ if (file_size != empty_size_g)
TEST_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* finish() */
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -597,13 +602,13 @@ error:
static unsigned
test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSED *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5EA_t *ea = NULL; /* Extensible array wrapper */
- haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5EA_t *ea = NULL; /* Extensible array wrapper */
+ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
- if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
+ if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -612,117 +617,94 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE
TESTING("invalid extensible array creation parameters");
#ifndef NDEBUG
-{
- H5EA_create_t test_cparam; /* Creation parameters for array */
-
- /* Set invalid element size */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.raw_elmt_size = 0;
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
- /* Close opened extensible array */
- H5EA_close(ea);
- ea = NULL;
-
- /* Indicate error */
- TEST_ERROR
- } /* end if */
+ {
+ H5EA_create_t test_cparam; /* Creation parameters for array */
- /* Set invalid max. # of elements bits */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.max_nelmts_bits = 0;
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
- /* Close opened extensible array */
- H5EA_close(ea);
- ea = NULL;
+ /* Set invalid element size */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.raw_elmt_size = 0;
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
+ /* Close opened extensible array */
+ H5EA_close(ea);
+ ea = NULL;
- /* Indicate error */
- TEST_ERROR
- } /* end if */
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.max_nelmts_bits = 65;
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
- /* Close opened extensible array */
- H5EA_close(ea);
- ea = NULL;
+ /* Set invalid max. # of elements bits */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.max_nelmts_bits = 0;
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
+ /* Close opened extensible array */
+ H5EA_close(ea);
+ ea = NULL;
- /* Indicate error */
- TEST_ERROR
- } /* end if */
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
- /* Set invalid min. # of data block pointers in super blocks */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.sup_blk_min_data_ptrs = 0;
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
- /* Close opened extensible array */
- H5EA_close(ea);
- ea = NULL;
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.max_nelmts_bits = 65;
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
+ /* Close opened extensible array */
+ H5EA_close(ea);
+ ea = NULL;
- /* Indicate error */
- TEST_ERROR
- } /* end if */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.sup_blk_min_data_ptrs = 1;
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
- /* Close opened extensible array */
- H5EA_close(ea);
- ea = NULL;
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
- /* Indicate error */
- TEST_ERROR
- } /* end if */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.sup_blk_min_data_ptrs = 6;
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
- /* Close opened extensible array */
- H5EA_close(ea);
- ea = NULL;
+ /* Set invalid min. # of data block pointers in super blocks */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.sup_blk_min_data_ptrs = 0;
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
+ /* Close opened extensible array */
+ H5EA_close(ea);
+ ea = NULL;
- /* Indicate error */
- TEST_ERROR
- } /* end if */
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.sup_blk_min_data_ptrs = 1;
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
+ /* Close opened extensible array */
+ H5EA_close(ea);
+ ea = NULL;
- /* Set invalid min. # of elements per data block */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.data_blk_min_elmts = 0;
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
- /* Close opened extensible array */
- H5EA_close(ea);
- ea = NULL;
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.sup_blk_min_data_ptrs = 6;
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
+ /* Close opened extensible array */
+ H5EA_close(ea);
+ ea = NULL;
- /* Indicate error */
- TEST_ERROR
- } /* end if */
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
- /* Set invalid max. # of elements per data block page bits */
- if(test_cparam.idx_blk_elmts > 0) {
+ /* Set invalid min. # of elements per data block */
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(H5VM_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1);
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
+ test_cparam.data_blk_min_elmts = 0;
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
/* Close opened extensible array */
H5EA_close(ea);
ea = NULL;
@@ -730,37 +712,52 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE
/* Indicate error */
TEST_ERROR
} /* end if */
- } /* end if */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.max_dblk_page_nelmts_bits = 4; /* corresponds to 16 elements in data block page, which is less than the 64 elements for the default settings */
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
- /* Close opened extensible array */
- H5EA_close(ea);
- ea = NULL;
- /* Indicate error */
- TEST_ERROR
- } /* end if */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(test_cparam.max_nelmts_bits + 1);
- H5E_BEGIN_TRY {
- ea = H5EA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(ea) {
- /* Close opened extensible array */
- H5EA_close(ea);
- ea = NULL;
+ /* Set invalid max. # of elements per data block page bits */
+ if (test_cparam.idx_blk_elmts > 0) {
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.max_dblk_page_nelmts_bits =
+ (uint8_t)(H5VM_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1);
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
+ /* Close opened extensible array */
+ H5EA_close(ea);
+ ea = NULL;
+
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
+ } /* end if */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.max_dblk_page_nelmts_bits = 4; /* corresponds to 16 elements in data block page, which is
+ less than the 64 elements for the default settings */
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
+ /* Close opened extensible array */
+ H5EA_close(ea);
+ ea = NULL;
- /* Indicate error */
- TEST_ERROR
- } /* end if */
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(test_cparam.max_nelmts_bits + 1);
+ H5E_BEGIN_TRY { ea = H5EA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (ea) {
+ /* Close opened extensible array */
+ H5EA_close(ea);
+ ea = NULL;
- PASSED();
-}
-#else /* NDEBUG */
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
+
+ PASSED();
+ }
+#else /* NDEBUG */
SKIPPED();
puts(" Not tested when assertions are disabled");
#endif /* NDEBUG */
@@ -771,7 +768,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE
TESTING("extensible array creation");
/* Create array */
- if(create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
+ if (create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
TEST_ERROR
PASSED();
@@ -780,11 +777,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE
TESTING("verify array creation parameters");
/* Verify the creation parameters */
- if(verify_cparam(ea, cparam) < 0)
+ if (verify_cparam(ea, cparam) < 0)
TEST_ERROR
/* Close array, delete array, close file & verify file is empty */
- if(finish(file, fapl, f, ea, ea_addr) < 0)
+ if (finish(file, fapl, f, ea, ea_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -793,16 +790,17 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE
return 0;
error:
- H5E_BEGIN_TRY {
- if(ea)
+ H5E_BEGIN_TRY
+ {
+ if (ea)
H5EA_close(ea);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_create() */
-
/*-------------------------------------------------------------------------
* Function: test_reopen
*
@@ -819,13 +817,13 @@ error:
static unsigned
test_reopen(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5EA_t *ea = NULL; /* Extensible array wrapper */
- haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5EA_t *ea = NULL; /* Extensible array wrapper */
+ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
- if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
+ if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -834,27 +832,27 @@ test_reopen(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
TESTING("create, close & reopen extensible array");
/* Create array */
- if(create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
+ if (create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
TEST_ERROR
/* Close the extensible array */
- if(H5EA_close(ea) < 0)
+ if (H5EA_close(ea) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0)
TEST_ERROR
/* Re-open the array */
- if(NULL == (ea = H5EA_open(f, ea_addr, NULL)))
+ if (NULL == (ea = H5EA_open(f, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
- if(verify_cparam(ea, cparam) < 0)
+ if (verify_cparam(ea, cparam) < 0)
TEST_ERROR
/* Close array, delete array, close file & verify file is empty */
- if(finish(file, fapl, f, ea, ea_addr) < 0)
+ if (finish(file, fapl, f, ea, ea_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -863,16 +861,17 @@ test_reopen(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
return 0;
error:
- H5E_BEGIN_TRY {
- if(ea)
+ H5E_BEGIN_TRY
+ {
+ if (ea)
H5EA_close(ea);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_reopen() */
-
/*-------------------------------------------------------------------------
* Function: test_open_twice
*
@@ -889,16 +888,16 @@ error:
static unsigned
test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- hid_t file2 = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5F_t *f2 = NULL; /* Internal file object pointer */
- H5EA_t *ea = NULL; /* Extensible array wrapper */
- H5EA_t *ea2 = NULL; /* Extensible array wrapper */
- haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t file = -1; /* File ID */
+ hid_t file2 = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5F_t * f2 = NULL; /* Internal file object pointer */
+ H5EA_t *ea = NULL; /* Extensible array wrapper */
+ H5EA_t *ea2 = NULL; /* Extensible array wrapper */
+ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
- if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
+ if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -907,46 +906,46 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
TESTING("open extensible array twice");
/* Create array */
- if(create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
+ if (create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
TEST_ERROR
/* Open the array again, through the first file handle */
- if(NULL == (ea2 = H5EA_open(f, ea_addr, NULL)))
+ if (NULL == (ea2 = H5EA_open(f, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
- if(verify_cparam(ea, cparam) < 0)
+ if (verify_cparam(ea, cparam) < 0)
TEST_ERROR
- if(verify_cparam(ea2, cparam) < 0)
+ if (verify_cparam(ea2, cparam) < 0)
TEST_ERROR
/* Close the second extensible array wrapper */
- if(H5EA_close(ea2) < 0)
+ if (H5EA_close(ea2) < 0)
FAIL_STACK_ERROR
ea2 = NULL;
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, &ea, ea_addr, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, &ea, ea_addr, tparam) < 0)
TEST_ERROR
/* Re-open the file */
- if((file2 = H5Freopen(file)) < 0)
+ if ((file2 = H5Freopen(file)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f2 = (H5F_t *)H5VL_object(file2)))
+ if (NULL == (f2 = (H5F_t *)H5VL_object(file2)))
FAIL_STACK_ERROR
/* Open the extensible array through the second file handle */
- if(NULL == (ea2 = H5EA_open(f2, ea_addr, NULL)))
+ if (NULL == (ea2 = H5EA_open(f2, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
- if(verify_cparam(ea, cparam) < 0)
+ if (verify_cparam(ea, cparam) < 0)
TEST_ERROR
/* Close the first extensible array wrapper */
- if(H5EA_close(ea) < 0)
+ if (H5EA_close(ea) < 0)
FAIL_STACK_ERROR
ea = NULL;
@@ -954,11 +953,11 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
/* (close before second file, to detect error on internal array header's
* shared file information)
*/
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Close array, delete array, close file & verify file is empty */
- if(finish(file2, fapl, f2, ea2, ea_addr) < 0)
+ if (finish(file2, fapl, f2, ea2, ea_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -967,19 +966,20 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
return 0;
error:
- H5E_BEGIN_TRY {
- if(ea)
+ H5E_BEGIN_TRY
+ {
+ if (ea)
H5EA_close(ea);
- if(ea2)
+ if (ea2)
H5EA_close(ea2);
- H5Fclose(file);
- H5Fclose(file2);
- } H5E_END_TRY;
+ H5Fclose(file);
+ H5Fclose(file2);
+ }
+ H5E_END_TRY;
return 1;
} /* test_open_twice() */
-
/*-------------------------------------------------------------------------
* Function: test_open_twice_diff
*
@@ -998,19 +998,19 @@ error:
static unsigned
test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
{
- char filename_tmp[EARRAY_FILENAME_LEN]; /* Temporary file name */
- hid_t file = -1; /* File ID */
- hid_t file2 = -1; /* File ID */
- hid_t file0 = -1; /* File ID */
- hid_t file00 = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5F_t *f2 = NULL; /* Internal file object pointer */
- H5EA_t *ea = NULL; /* Extensible array wrapper */
- H5EA_t *ea2 = NULL; /* Extensible array wrapper */
- haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
+ char filename_tmp[EARRAY_FILENAME_LEN]; /* Temporary file name */
+ hid_t file = -1; /* File ID */
+ hid_t file2 = -1; /* File ID */
+ hid_t file0 = -1; /* File ID */
+ hid_t file00 = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5F_t * f2 = NULL; /* Internal file object pointer */
+ H5EA_t *ea = NULL; /* Extensible array wrapper */
+ H5EA_t *ea2 = NULL; /* Extensible array wrapper */
+ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
- if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
+ if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -1019,21 +1019,21 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa
TESTING("open extensible array twice, through different file handles");
/* Create array */
- if(create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
+ if (create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
TEST_ERROR
/* Open the array again, through the first file handle */
- if(NULL == (ea2 = H5EA_open(f, ea_addr, NULL)))
+ if (NULL == (ea2 = H5EA_open(f, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
- if(verify_cparam(ea, cparam) < 0)
+ if (verify_cparam(ea, cparam) < 0)
TEST_ERROR
- if(verify_cparam(ea2, cparam) < 0)
+ if (verify_cparam(ea2, cparam) < 0)
TEST_ERROR
/* Close the second extensible array wrapper */
- if(H5EA_close(ea2) < 0)
+ if (H5EA_close(ea2) < 0)
FAIL_STACK_ERROR
ea2 = NULL;
@@ -1041,19 +1041,19 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa
/* (So that there is something holding the file open when the extensible
* array is closed)
*/
- if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, &ea, ea_addr, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, &ea, ea_addr, tparam) < 0)
TEST_ERROR
/* Verify the creation parameters */
- if(verify_cparam(ea, cparam) < 0)
+ if (verify_cparam(ea, cparam) < 0)
TEST_ERROR
/* Close the first extensible array wrapper */
- if(H5EA_close(ea) < 0)
+ if (H5EA_close(ea) < 0)
FAIL_STACK_ERROR
ea = NULL;
@@ -1061,7 +1061,7 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa
/* (close before second file, to detect error on internal array header's
* shared file information)
*/
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
file = -1;
@@ -1071,34 +1071,33 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa
* header stale)
*/
h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp));
- if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
-
/* Re-open the file with the extensible array */
- if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f2 = (H5F_t *)H5VL_object(file2)))
+ if (NULL == (f2 = (H5F_t *)H5VL_object(file2)))
FAIL_STACK_ERROR
/* Open the extensible array through the second file handle */
- if(NULL == (ea2 = H5EA_open(f2, ea_addr, NULL)))
+ if (NULL == (ea2 = H5EA_open(f2, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
- if(verify_cparam(ea2, cparam) < 0)
+ if (verify_cparam(ea2, cparam) < 0)
TEST_ERROR
/* Close the extra file handles */
- if(H5Fclose(file0) < 0)
+ if (H5Fclose(file0) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file00) < 0)
+ if (H5Fclose(file00) < 0)
FAIL_STACK_ERROR
/* Close array, delete array, close file & verify file is empty */
- if(finish(file2, fapl, f2, ea2, ea_addr) < 0)
+ if (finish(file2, fapl, f2, ea2, ea_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -1107,21 +1106,22 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa
return 0;
error:
- H5E_BEGIN_TRY {
- if(ea)
+ H5E_BEGIN_TRY
+ {
+ if (ea)
H5EA_close(ea);
- if(ea2)
+ if (ea2)
H5EA_close(ea2);
- H5Fclose(file);
- H5Fclose(file2);
- H5Fclose(file0);
- H5Fclose(file00);
- } H5E_END_TRY;
+ H5Fclose(file);
+ H5Fclose(file2);
+ H5Fclose(file0);
+ H5Fclose(file00);
+ }
+ H5E_END_TRY;
return 1;
} /* test_open_twice_diff() */
-
/*-------------------------------------------------------------------------
* Function: test_delete_open
*
@@ -1138,15 +1138,15 @@ error:
static unsigned
test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5EA_t *ea = NULL; /* Extensible array wrapper */
- H5EA_t *ea2 = NULL; /* Extensible array wrapper */
- haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
- h5_stat_size_t file_size; /* File size, after deleting array */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5EA_t * ea = NULL; /* Extensible array wrapper */
+ H5EA_t * ea2 = NULL; /* Extensible array wrapper */
+ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
+ h5_stat_size_t file_size; /* File size, after deleting array */
/* Create file & retrieve pointer to internal file object */
- if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
+ if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -1155,33 +1155,32 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
TESTING("deleting open extensible array");
/* Create array */
- if(create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
+ if (create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
TEST_ERROR
/* Open the array again */
- if(NULL == (ea2 = H5EA_open(f, ea_addr, NULL)))
+ if (NULL == (ea2 = H5EA_open(f, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Request that the array be deleted */
- if(H5EA_delete(f, ea_addr, NULL) < 0)
+ if (H5EA_delete(f, ea_addr, NULL) < 0)
FAIL_STACK_ERROR
/* Verify the creation parameters */
- if(verify_cparam(ea, cparam) < 0)
+ if (verify_cparam(ea, cparam) < 0)
TEST_ERROR
- if(verify_cparam(ea2, cparam) < 0)
+ if (verify_cparam(ea2, cparam) < 0)
TEST_ERROR
/* Close the second extensible array wrapper */
- if(H5EA_close(ea2) < 0)
+ if (H5EA_close(ea2) < 0)
FAIL_STACK_ERROR
ea2 = NULL;
/* Try re-opening the array again (should fail, as array will be deleted) */
- H5E_BEGIN_TRY {
- ea2 = H5EA_open(f, ea_addr, NULL);
- } H5E_END_TRY;
- if(ea2) {
+ H5E_BEGIN_TRY { ea2 = H5EA_open(f, ea_addr, NULL); }
+ H5E_END_TRY;
+ if (ea2) {
/* Close opened array */
H5EA_close(ea2);
@@ -1190,19 +1189,18 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
} /* end if */
/* Close the first extensible array wrapper */
- if(H5EA_close(ea) < 0)
+ if (H5EA_close(ea) < 0)
FAIL_STACK_ERROR
ea = NULL;
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0)
TEST_ERROR
/* Try re-opening the array again (should fail, as array is now deleted) */
- H5E_BEGIN_TRY {
- ea = H5EA_open(f, ea_addr, NULL);
- } H5E_END_TRY;
- if(ea) {
+ H5E_BEGIN_TRY { ea = H5EA_open(f, ea_addr, NULL); }
+ H5E_END_TRY;
+ if (ea) {
/* Close opened array */
H5EA_close(ea);
@@ -1211,15 +1209,15 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename_g, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename_g, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size_g)
+ if (file_size != empty_size_g)
TEST_ERROR
/* All tests passed */
@@ -1228,24 +1226,25 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
return 0;
error:
- H5E_BEGIN_TRY {
- if(ea)
+ H5E_BEGIN_TRY
+ {
+ if (ea)
H5EA_close(ea);
- if(ea2)
+ if (ea2)
H5EA_close(ea2);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_delete_open() */
/* Extensible array iterator info for forward iteration */
typedef struct eiter_fw_t {
- hsize_t idx; /* Index of next array location */
- unsigned base_sblk_idx; /* Starting index for actual superblocks */
+ hsize_t idx; /* Index of next array location */
+ unsigned base_sblk_idx; /* Starting index for actual superblocks */
} eiter_fw_t;
-
/*-------------------------------------------------------------------------
* Function: eiter_fw_init
*
@@ -1261,23 +1260,22 @@ typedef struct eiter_fw_t {
*/
static void *
eiter_fw_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_param_t H5_ATTR_UNUSED *tparam,
- hsize_t H5_ATTR_UNUSED cnt)
+ hsize_t H5_ATTR_UNUSED cnt)
{
- eiter_fw_t *eiter; /* Forward element iteration object */
+ eiter_fw_t *eiter; /* Forward element iteration object */
/* Allocate space for the element iteration object */
eiter = (eiter_fw_t *)HDmalloc(sizeof(eiter_fw_t));
HDassert(eiter);
/* Initialize the element iteration object */
- eiter->idx = 0;
+ eiter->idx = 0;
eiter->base_sblk_idx = UINT_MAX;
/* Return iteration object */
- return(eiter);
+ return (eiter);
} /* end eiter_fw_init() */
-
/*-------------------------------------------------------------------------
* Function: eiter_fw_next
*
@@ -1295,7 +1293,7 @@ static hssize_t
eiter_fw_next(void *_eiter)
{
eiter_fw_t *eiter = (eiter_fw_t *)_eiter;
- hssize_t ret_val;
+ hssize_t ret_val;
/* Sanity check */
HDassert(eiter);
@@ -1303,10 +1301,9 @@ eiter_fw_next(void *_eiter)
/* Get the next array index to test */
ret_val = (hssize_t)eiter->idx++;
- return(ret_val);
+ return (ret_val);
} /* end eiter_fw_next() */
-
/*-------------------------------------------------------------------------
* Function: eiter_fw_max
*
@@ -1329,10 +1326,9 @@ eiter_fw_max(const void *_eiter)
HDassert(eiter);
/* Return the max. array index used */
- return((hssize_t)(eiter->idx - 1));
+ return ((hssize_t)(eiter->idx - 1));
} /* end eiter_fw_max() */
-
/*-------------------------------------------------------------------------
* Function: eiter_fw_state
*
@@ -1347,8 +1343,8 @@ eiter_fw_max(const void *_eiter)
*-------------------------------------------------------------------------
*/
static int
-eiter_fw_state(void *_eiter, const H5EA_create_t *cparam,
- const earray_test_param_t *tparam, earray_state_t *state, hsize_t idx)
+eiter_fw_state(void *_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam,
+ earray_state_t *state, hsize_t idx)
{
eiter_fw_t *eiter = (eiter_fw_t *)_eiter;
@@ -1359,28 +1355,29 @@ eiter_fw_state(void *_eiter, const H5EA_create_t *cparam,
HDassert(state);
/* Compute the state of the extensible array */
- state->hdr_size = EA_HDR_SIZE;
- state->nindex_blks = 1;
+ state->hdr_size = EA_HDR_SIZE;
+ state->nindex_blks = 1;
state->index_blk_size = EA_IBLOCK_SIZE;
- state->max_idx_set = idx + 1;
- if(idx < cparam->idx_blk_elmts) {
- state->nelmts = (hsize_t)cparam->idx_blk_elmts;
+ state->max_idx_set = idx + 1;
+ if (idx < cparam->idx_blk_elmts) {
+ state->nelmts = (hsize_t)cparam->idx_blk_elmts;
state->nsuper_blks = state->ndata_blks = (hsize_t)0;
state->super_blk_size = state->data_blk_size = (hsize_t)0;
} /* end if */
else {
- unsigned sblk_idx; /* Which superblock does this index fall in? */
+ unsigned sblk_idx; /* Which superblock does this index fall in? */
/* Compute super block index for element index */
/* (same eqn. as in H5EA__dblock_sblk_idx()) */
- sblk_idx = H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
- state->nelmts = EA_NELMTS(cparam, tparam, idx, sblk_idx);
+ sblk_idx =
+ H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
+ state->nelmts = EA_NELMTS(cparam, tparam, idx, sblk_idx);
state->ndata_blks = EA_NDATA_BLKS(cparam, tparam, idx, sblk_idx);
/* Check if we have any super blocks yet */
- if(tparam->sblk_info[sblk_idx].ndblks >= cparam->sup_blk_min_data_ptrs) {
+ if (tparam->sblk_info[sblk_idx].ndblks >= cparam->sup_blk_min_data_ptrs) {
/* Check if this is the first superblock */
- if(sblk_idx < eiter->base_sblk_idx)
+ if (sblk_idx < eiter->base_sblk_idx)
eiter->base_sblk_idx = sblk_idx;
state->nsuper_blks = (sblk_idx - eiter->base_sblk_idx) + 1;
@@ -1389,10 +1386,9 @@ eiter_fw_state(void *_eiter, const H5EA_create_t *cparam,
state->nsuper_blks = 0;
} /* end else */
- return(0);
+ return (0);
} /* end eiter_fw_state() */
-
/*-------------------------------------------------------------------------
* Function: eiter_fw_term
*
@@ -1415,29 +1411,28 @@ eiter_fw_term(void *eiter)
/* Free iteration object */
HDfree(eiter);
- return(0);
+ return (0);
} /* end eiter_fw_term() */
/* Extensible array iterator class for forward iteration */
static const earray_iter_t ea_iter_fw = {
- eiter_fw_init, /* Iterator init */
- eiter_fw_next, /* Next array index */
- eiter_fw_max, /* Max. array index */
- eiter_fw_state, /* State of the extensible array */
- eiter_fw_term /* Iterator term */
+ eiter_fw_init, /* Iterator init */
+ eiter_fw_next, /* Next array index */
+ eiter_fw_max, /* Max. array index */
+ eiter_fw_state, /* State of the extensible array */
+ eiter_fw_term /* Iterator term */
};
/* Extensible array iterator info for reverse iteration */
typedef struct eiter_rv_t {
- hsize_t idx; /* Index of next array location */
- hsize_t max; /* Index of max. array location */
- hsize_t max_sblk_idx; /* Which superblock does the max. array location fall in? */
- hsize_t max_nelmts; /* Max. # of elements for array */
- hsize_t max_ndata_blks; /* Max. # of data blocks for array */
- hsize_t idx_blk_nsblks; /* Number of superblocks directly pointed to in the index block */
+ hsize_t idx; /* Index of next array location */
+ hsize_t max; /* Index of max. array location */
+ hsize_t max_sblk_idx; /* Which superblock does the max. array location fall in? */
+ hsize_t max_nelmts; /* Max. # of elements for array */
+ hsize_t max_ndata_blks; /* Max. # of data blocks for array */
+ hsize_t idx_blk_nsblks; /* Number of superblocks directly pointed to in the index block */
} eiter_rv_t;
-
/*-------------------------------------------------------------------------
* Function: eiter_rv_init
*
@@ -1452,10 +1447,9 @@ typedef struct eiter_rv_t {
*-------------------------------------------------------------------------
*/
static void *
-eiter_rv_init(const H5EA_create_t *cparam, const earray_test_param_t *tparam,
- hsize_t cnt)
+eiter_rv_init(const H5EA_create_t *cparam, const earray_test_param_t *tparam, hsize_t cnt)
{
- eiter_rv_t *eiter; /* Reverse element iteration object */
+ eiter_rv_t *eiter; /* Reverse element iteration object */
/* Allocate space for the element iteration object */
eiter = (eiter_rv_t *)HDmalloc(sizeof(eiter_rv_t));
@@ -1464,24 +1458,24 @@ eiter_rv_init(const H5EA_create_t *cparam, const earray_test_param_t *tparam,
/* Initialize reverse iteration info */
eiter->idx = cnt - 1;
eiter->max = cnt - 1;
- if(cnt > cparam->idx_blk_elmts) {
- eiter->max_sblk_idx = H5VM_log2_gen((uint64_t)(((eiter->max - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
- eiter->max_nelmts = EA_NELMTS(cparam, tparam, eiter->max, eiter->max_sblk_idx);
+ if (cnt > cparam->idx_blk_elmts) {
+ eiter->max_sblk_idx = H5VM_log2_gen(
+ (uint64_t)(((eiter->max - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
+ eiter->max_nelmts = EA_NELMTS(cparam, tparam, eiter->max, eiter->max_sblk_idx);
eiter->max_ndata_blks = EA_NDATA_BLKS(cparam, tparam, eiter->max, eiter->max_sblk_idx);
eiter->idx_blk_nsblks = 2 * H5VM_log2_of2((uint32_t)cparam->sup_blk_min_data_ptrs);
} /* end if */
else {
- eiter->max_sblk_idx = (hsize_t)0;
- eiter->max_nelmts = (hsize_t)0;
+ eiter->max_sblk_idx = (hsize_t)0;
+ eiter->max_nelmts = (hsize_t)0;
eiter->max_ndata_blks = (hsize_t)0;
eiter->idx_blk_nsblks = (hsize_t)0;
} /* end else */
/* Return iteration object */
- return(eiter);
+ return (eiter);
} /* end eiter_rv_init() */
-
/*-------------------------------------------------------------------------
* Function: eiter_rv_next
*
@@ -1499,7 +1493,7 @@ static hssize_t
eiter_rv_next(void *_eiter)
{
eiter_rv_t *eiter = (eiter_rv_t *)_eiter;
- hssize_t ret_val;
+ hssize_t ret_val;
/* Sanity check */
HDassert(eiter);
@@ -1507,10 +1501,9 @@ eiter_rv_next(void *_eiter)
/* Get the next array index to test */
ret_val = (hssize_t)eiter->idx--;
- return(ret_val);
+ return (ret_val);
} /* end eiter_rv_next() */
-
/*-------------------------------------------------------------------------
* Function: eiter_rv_max
*
@@ -1533,10 +1526,9 @@ eiter_rv_max(const void *_eiter)
HDassert(eiter);
/* Return the max. array index used */
- return((hssize_t)eiter->max);
+ return ((hssize_t)eiter->max);
} /* end eiter_rv_max() */
-
/*-------------------------------------------------------------------------
* Function: eiter_rv_state
*
@@ -1551,8 +1543,8 @@ eiter_rv_max(const void *_eiter)
*-------------------------------------------------------------------------
*/
static int
-eiter_rv_state(void *_eiter, const H5EA_create_t *cparam,
- const earray_test_param_t *tparam, earray_state_t *state, hsize_t idx)
+eiter_rv_state(void *_eiter, const H5EA_create_t *cparam, const earray_test_param_t *tparam,
+ earray_state_t *state, hsize_t idx)
{
eiter_rv_t *eiter = (eiter_rv_t *)_eiter;
@@ -1563,64 +1555,65 @@ eiter_rv_state(void *_eiter, const H5EA_create_t *cparam,
HDassert(state);
/* Compute the state of the extensible array */
- state->hdr_size = EA_HDR_SIZE;
- state->nindex_blks = 1;
+ state->hdr_size = EA_HDR_SIZE;
+ state->nindex_blks = 1;
state->index_blk_size = EA_IBLOCK_SIZE;
- state->max_idx_set = eiter->max + 1;
- if(eiter->max < cparam->idx_blk_elmts) {
- state->nelmts = (hsize_t)cparam->idx_blk_elmts;
+ state->max_idx_set = eiter->max + 1;
+ if (eiter->max < cparam->idx_blk_elmts) {
+ state->nelmts = (hsize_t)cparam->idx_blk_elmts;
state->nsuper_blks = state->ndata_blks = (hsize_t)0;
} /* end if */
else {
- hsize_t idx_nelmts; /* # of elements for array index */
- hsize_t idx_ndata_blks; /* # of data blocks for array index */
- hsize_t loc_idx = 0; /* Local index, for computing an offset in next lower data block */
- unsigned idx_sblk_idx; /* Which superblock does this index fall in? */
- unsigned loc_sblk_idx = 0; /* Which superblock does the local index fall in? */
+ hsize_t idx_nelmts; /* # of elements for array index */
+ hsize_t idx_ndata_blks; /* # of data blocks for array index */
+ hsize_t loc_idx = 0; /* Local index, for computing an offset in next lower data block */
+ unsigned idx_sblk_idx; /* Which superblock does this index fall in? */
+ unsigned loc_sblk_idx = 0; /* Which superblock does the local index fall in? */
/* Compute super block index for element index */
/* (same eqn. as in H5EA__dblock_sblk_idx()) */
- if(idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts)
+ if (idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts)
idx_sblk_idx = 0;
else {
- hsize_t tmp_idx; /* Temporary index in superblock */
- hsize_t dblk_idx; /* Index of data block within superblock */
+ hsize_t tmp_idx; /* Temporary index in superblock */
+ hsize_t dblk_idx; /* Index of data block within superblock */
- idx_sblk_idx = H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
- tmp_idx = idx - (cparam->idx_blk_elmts + tparam->sblk_info[idx_sblk_idx].start_idx);
+ idx_sblk_idx =
+ H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
+ tmp_idx = idx - (cparam->idx_blk_elmts + tparam->sblk_info[idx_sblk_idx].start_idx);
dblk_idx = tmp_idx / tparam->sblk_info[idx_sblk_idx].dblk_nelmts;
- if(dblk_idx > 0)
+ if (dblk_idx > 0)
loc_idx = idx - tparam->sblk_info[idx_sblk_idx].dblk_nelmts;
else
loc_idx = cparam->idx_blk_elmts + tparam->sblk_info[idx_sblk_idx].start_idx - 1;
- loc_sblk_idx = H5VM_log2_gen((uint64_t)(((loc_idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
+ loc_sblk_idx = H5VM_log2_gen(
+ (uint64_t)(((loc_idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
} /* end else */
- if(idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts)
+ if (idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts)
idx_nelmts = (hsize_t)cparam->idx_blk_elmts;
else
idx_nelmts = EA_NELMTS(cparam, tparam, loc_idx, loc_sblk_idx);
state->nelmts = (eiter->max_nelmts - idx_nelmts) + cparam->idx_blk_elmts;
- if(idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts)
+ if (idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts)
idx_ndata_blks = 0;
else
idx_ndata_blks = EA_NDATA_BLKS(cparam, tparam, loc_idx, loc_sblk_idx);
state->ndata_blks = eiter->max_ndata_blks - idx_ndata_blks;
/* Check if we have any super blocks yet */
- if(tparam->sblk_info[eiter->max_sblk_idx].ndblks >= cparam->sup_blk_min_data_ptrs) {
- if(idx_sblk_idx > eiter->idx_blk_nsblks)
+ if (tparam->sblk_info[eiter->max_sblk_idx].ndblks >= cparam->sup_blk_min_data_ptrs) {
+ if (idx_sblk_idx > eiter->idx_blk_nsblks)
state->nsuper_blks = (eiter->max_sblk_idx - idx_sblk_idx) + 1;
else
state->nsuper_blks = (eiter->max_sblk_idx - eiter->idx_blk_nsblks) + 1;
} /* end if */
- } /* end else */
+ } /* end else */
- return(0);
+ return (0);
} /* end eiter_rv_state() */
-
/*-------------------------------------------------------------------------
* Function: eiter_rv_term
*
@@ -1643,26 +1636,25 @@ eiter_rv_term(void *eiter)
/* Free iteration object */
HDfree(eiter);
- return(0);
+ return (0);
} /* end eiter_rv_term() */
/* Extensible array iterator class for reverse iteration */
static const earray_iter_t ea_iter_rv = {
- eiter_rv_init, /* Iterator init */
- eiter_rv_next, /* Next array index */
- eiter_rv_max, /* Max. array index written */
- eiter_rv_state, /* State of the extensible array */
- eiter_rv_term /* Iterator term */
+ eiter_rv_init, /* Iterator init */
+ eiter_rv_next, /* Next array index */
+ eiter_rv_max, /* Max. array index written */
+ eiter_rv_state, /* State of the extensible array */
+ eiter_rv_term /* Iterator term */
};
/* Extensible array iterator info for random iteration */
typedef struct eiter_rnd_t {
- hsize_t max; /* Max. array index used */
- hsize_t pos; /* Position in shuffled array */
- hsize_t *idx; /* Array of shuffled indices */
+ hsize_t max; /* Max. array index used */
+ hsize_t pos; /* Position in shuffled array */
+ hsize_t *idx; /* Array of shuffled indices */
} eiter_rnd_t;
-
/*-------------------------------------------------------------------------
* Function: eiter_rnd_init
*
@@ -1678,10 +1670,10 @@ typedef struct eiter_rnd_t {
*/
static void *
eiter_rnd_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_param_t H5_ATTR_UNUSED *tparam,
- hsize_t cnt)
+ hsize_t cnt)
{
- eiter_rnd_t *eiter; /* Random element iteration object */
- size_t u; /* Local index variable */
+ eiter_rnd_t *eiter; /* Random element iteration object */
+ size_t u; /* Local index variable */
/* Allocate space for the element iteration object */
eiter = (eiter_rnd_t *)HDmalloc(sizeof(eiter_rnd_t));
@@ -1694,27 +1686,26 @@ eiter_rnd_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_par
/* Initialize reverse iteration info */
eiter->max = 0;
eiter->pos = 0;
- for(u = 0; u < (size_t)cnt; u++)
+ for (u = 0; u < (size_t)cnt; u++)
eiter->idx[u] = (hsize_t)u;
/* Randomly shuffle array indices */
- if(cnt > 1) {
- for(u = 0; u < (size_t)cnt; u++) {
- size_t swap_idx; /* Location to swap with when shuffling */
- hsize_t temp_idx; /* Temporary index */
-
- swap_idx = ((size_t)HDrandom() % ((size_t)cnt - u)) + u;
- temp_idx = eiter->idx[u];
- eiter->idx[u] = eiter->idx[swap_idx];
+ if (cnt > 1) {
+ for (u = 0; u < (size_t)cnt; u++) {
+ size_t swap_idx; /* Location to swap with when shuffling */
+ hsize_t temp_idx; /* Temporary index */
+
+ swap_idx = ((size_t)HDrandom() % ((size_t)cnt - u)) + u;
+ temp_idx = eiter->idx[u];
+ eiter->idx[u] = eiter->idx[swap_idx];
eiter->idx[swap_idx] = temp_idx;
} /* end for */
- } /* end if */
+ } /* end if */
/* Return iteration object */
- return(eiter);
+ return (eiter);
} /* end eiter_rnd_init() */
-
/*-------------------------------------------------------------------------
* Function: eiter_rnd_next
*
@@ -1732,7 +1723,7 @@ static hssize_t
eiter_rnd_next(void *_eiter)
{
eiter_rnd_t *eiter = (eiter_rnd_t *)_eiter;
- hssize_t ret_val;
+ hssize_t ret_val;
/* Sanity check */
HDassert(eiter);
@@ -1742,13 +1733,12 @@ eiter_rnd_next(void *_eiter)
eiter->pos++;
/* Check for new max. value */
- if((hsize_t)ret_val > eiter->max)
+ if ((hsize_t)ret_val > eiter->max)
eiter->max = (hsize_t)ret_val;
- return(ret_val);
+ return (ret_val);
} /* end eiter_rnd_next() */
-
/*-------------------------------------------------------------------------
* Function: eiter_rnd_max
*
@@ -1771,10 +1761,9 @@ eiter_rnd_max(const void *_eiter)
HDassert(eiter);
/* Return the max. array index used */
- return((hssize_t)eiter->max);
+ return ((hssize_t)eiter->max);
} /* end eiter_rnd_max() */
-
/*-------------------------------------------------------------------------
* Function: eiter_rnd_term
*
@@ -1803,19 +1792,18 @@ eiter_rnd_term(void *_eiter)
/* Free iteration object */
HDfree(eiter);
- return(0);
+ return (0);
} /* end eiter_rnd_term() */
/* Extensible array iterator class for random iteration */
static const earray_iter_t ea_iter_rnd = {
- eiter_rnd_init, /* Iterator init */
- eiter_rnd_next, /* Next array index */
- eiter_rnd_max, /* Max. array index written */
- NULL, /* State of the extensible array */
- eiter_rnd_term /* Iterator term */
+ eiter_rnd_init, /* Iterator init */
+ eiter_rnd_next, /* Next array index */
+ eiter_rnd_max, /* Max. array index written */
+ NULL, /* State of the extensible array */
+ eiter_rnd_term /* Iterator term */
};
-
/*-------------------------------------------------------------------------
* Function: eiter_rnd2_init
*
@@ -1831,10 +1819,10 @@ static const earray_iter_t ea_iter_rnd = {
*/
static void *
eiter_rnd2_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_param_t H5_ATTR_UNUSED *tparam,
- hsize_t cnt)
+ hsize_t cnt)
{
- eiter_rnd_t *eiter; /* Random element iteration object */
- size_t u; /* Local index variable */
+ eiter_rnd_t *eiter; /* Random element iteration object */
+ size_t u; /* Local index variable */
/* Allocate space for the element iteration object */
eiter = (eiter_rnd_t *)HDmalloc(sizeof(eiter_rnd_t));
@@ -1849,24 +1837,24 @@ eiter_rnd2_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_pa
eiter->pos = 0;
/* Randomly shuffle array indices */
- if(cnt > 1) {
- hsize_t *tmp_idx; /* Temporary index array */
- hsize_t sparse_cnt = (hsize_t)(cnt * EA_RND2_SCALE); /* Sparse range to choose from */
+ if (cnt > 1) {
+ hsize_t *tmp_idx; /* Temporary index array */
+ hsize_t sparse_cnt = (hsize_t)(cnt * EA_RND2_SCALE); /* Sparse range to choose from */
/* Allocate temporary index array */
tmp_idx = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)sparse_cnt);
HDassert(tmp_idx);
/* Initialize temporary index array, for shuffling */
- for(u = 0; u < (size_t)sparse_cnt; u++)
+ for (u = 0; u < (size_t)sparse_cnt; u++)
tmp_idx[u] = (hsize_t)u;
/* Shuffle index elements & store in final array */
- for(u = 0; u < (size_t)cnt; u++) {
- size_t swap_idx; /* Location to swap with when shuffling */
+ for (u = 0; u < (size_t)cnt; u++) {
+ size_t swap_idx; /* Location to swap with when shuffling */
- swap_idx = ((size_t)HDrandom() % ((size_t)sparse_cnt - u)) + u;
- eiter->idx[u] = tmp_idx[swap_idx];
+ swap_idx = ((size_t)HDrandom() % ((size_t)sparse_cnt - u)) + u;
+ eiter->idx[u] = tmp_idx[swap_idx];
tmp_idx[swap_idx] = tmp_idx[u];
} /* end for */
@@ -1874,32 +1862,31 @@ eiter_rnd2_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_pa
HDfree(tmp_idx);
} /* end if */
else {
- for(u = 0; u < (size_t)cnt; u++)
+ for (u = 0; u < (size_t)cnt; u++)
eiter->idx[u] = (hsize_t)u;
} /* end else */
/* Return iteration object */
- return(eiter);
+ return (eiter);
} /* end eiter_rnd2_init() */
/* Extensible array iterator class for random iteration */
static const earray_iter_t ea_iter_rnd2 = {
- eiter_rnd2_init, /* Iterator init */
- eiter_rnd_next, /* Next array index */
- eiter_rnd_max, /* Max. array index written */
- NULL, /* State of the extensible array */
- eiter_rnd_term /* Iterator term */
+ eiter_rnd2_init, /* Iterator init */
+ eiter_rnd_next, /* Next array index */
+ eiter_rnd_max, /* Max. array index written */
+ NULL, /* State of the extensible array */
+ eiter_rnd_term /* Iterator term */
};
/* Extensible array iterator info for cyclic iteration */
typedef struct eiter_cyc_t {
- hsize_t max; /* Max. array index used */
- hsize_t pos; /* Position in shuffled array */
- hsize_t cnt; /* # of elements to store */
- hsize_t cyc; /* Cycle of elements to choose from */
+ hsize_t max; /* Max. array index used */
+ hsize_t pos; /* Position in shuffled array */
+ hsize_t cnt; /* # of elements to store */
+ hsize_t cyc; /* Cycle of elements to choose from */
} eiter_cyc_t;
-
/*-------------------------------------------------------------------------
* Function: eiter_cyc_init
*
@@ -1915,9 +1902,9 @@ typedef struct eiter_cyc_t {
*/
static void *
eiter_cyc_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_param_t H5_ATTR_UNUSED *tparam,
- hsize_t cnt)
+ hsize_t cnt)
{
- eiter_cyc_t *eiter; /* Cyclic element iteration object */
+ eiter_cyc_t *eiter; /* Cyclic element iteration object */
/* Allocate space for the element iteration object */
eiter = (eiter_cyc_t *)HDmalloc(sizeof(eiter_cyc_t));
@@ -1930,10 +1917,9 @@ eiter_cyc_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_par
eiter->cyc = 0;
/* Return iteration object */
- return(eiter);
+ return (eiter);
} /* end eiter_cyc_init() */
-
/*-------------------------------------------------------------------------
* Function: eiter_cyc_next
*
@@ -1951,7 +1937,7 @@ static hssize_t
eiter_cyc_next(void *_eiter)
{
eiter_cyc_t *eiter = (eiter_cyc_t *)_eiter;
- hssize_t ret_val;
+ hssize_t ret_val;
/* Sanity check */
HDassert(eiter);
@@ -1959,17 +1945,16 @@ eiter_cyc_next(void *_eiter)
/* Get the next array index to test */
ret_val = (hssize_t)eiter->pos;
eiter->pos += EA_CYC_COUNT;
- if(eiter->pos >= eiter->cnt)
+ if (eiter->pos >= eiter->cnt)
eiter->pos = ++eiter->cyc;
/* Check for new max. value */
- if((hsize_t)ret_val > eiter->max)
+ if ((hsize_t)ret_val > eiter->max)
eiter->max = (hsize_t)ret_val;
- return(ret_val);
+ return (ret_val);
} /* end eiter_cyc_next() */
-
/*-------------------------------------------------------------------------
* Function: eiter_cyc_max
*
@@ -1992,10 +1977,9 @@ eiter_cyc_max(const void *_eiter)
HDassert(eiter);
/* Return the max. array index used */
- return((hssize_t)eiter->max);
+ return ((hssize_t)eiter->max);
} /* end eiter_cyc_max() */
-
/*-------------------------------------------------------------------------
* Function: eiter_cyc_term
*
@@ -2020,19 +2004,18 @@ eiter_cyc_term(void *_eiter)
/* Free iteration object */
HDfree(eiter);
- return(0);
+ return (0);
} /* end eiter_cyc_term() */
/* Extensible array iterator class for cyclic iteration */
static const earray_iter_t ea_iter_cyc = {
- eiter_cyc_init, /* Iterator init */
- eiter_cyc_next, /* Next array index */
- eiter_cyc_max, /* Max. array index written */
- NULL, /* State of the extensible array */
- eiter_cyc_term /* Iterator term */
+ eiter_cyc_init, /* Iterator init */
+ eiter_cyc_next, /* Next array index */
+ eiter_cyc_max, /* Max. array index written */
+ NULL, /* State of the extensible array */
+ eiter_cyc_term /* Iterator term */
};
-
/*-------------------------------------------------------------------------
* Function: test_set_elmts
*
@@ -2047,23 +2030,23 @@ static const earray_iter_t ea_iter_cyc = {
*-------------------------------------------------------------------------
*/
static unsigned
-test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
- hsize_t nelmts, const char *test_str)
+test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, hsize_t nelmts,
+ const char *test_str)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5EA_t *ea = NULL; /* Extensible array wrapper */
- void *eiter_info; /* Extensible array iterator info */
- earray_state_t state; /* State of extensible array */
- uint64_t welmt; /* Element to write */
- uint64_t relmt; /* Element to read */
- hsize_t nelmts_written; /* Highest element written in array */
- hsize_t cnt; /* Count of array indices */
- hssize_t smax; /* Index value of max. element set */
- hsize_t max; /* Index value of max. element set */
- hssize_t sidx; /* Index value of first element of first data block */
- hsize_t idx; /* Index value of first element of first data block */
- haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5EA_t * ea = NULL; /* Extensible array wrapper */
+ void * eiter_info; /* Extensible array iterator info */
+ earray_state_t state; /* State of extensible array */
+ uint64_t welmt; /* Element to write */
+ uint64_t relmt; /* Element to read */
+ hsize_t nelmts_written; /* Highest element written in array */
+ hsize_t cnt; /* Count of array indices */
+ hssize_t smax; /* Index value of max. element set */
+ hsize_t max; /* Index value of max. element set */
+ hssize_t sidx; /* Index value of first element of first data block */
+ hsize_t idx; /* Index value of first element of first data block */
+ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
/*
* Display testing message
@@ -2071,128 +2054,127 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
- if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
+ if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/* Create array */
- if(create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
+ if (create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
TEST_ERROR
/* Verify the creation parameters */
- if(verify_cparam(ea, cparam) < 0)
+ if (verify_cparam(ea, cparam) < 0)
TEST_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, &ea, ea_addr, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, &ea, ea_addr, tparam) < 0)
TEST_ERROR
/* Verify high-water # of elements written */
nelmts_written = (hsize_t)ULLONG_MAX;
- if(H5EA_get_nelmts(ea, &nelmts_written) < 0)
+ if (H5EA_get_nelmts(ea, &nelmts_written) < 0)
FAIL_STACK_ERROR
- if(nelmts_written != 0)
+ if (nelmts_written != 0)
TEST_ERROR
/* Verify array state */
HDmemset(&state, 0, sizeof(state));
state.hdr_size = EA_HDR_SIZE;
- if(check_stats(ea, &state))
+ if (check_stats(ea, &state))
TEST_ERROR
/* Get all elements from empty array */
/* Initialize iterator */
- if(NULL == (eiter_info = tparam->eiter->init(cparam, tparam, nelmts)))
+ if (NULL == (eiter_info = tparam->eiter->init(cparam, tparam, nelmts)))
TEST_ERROR
/* Get elements of array */
- for(cnt = 0; cnt < nelmts; cnt++) {
+ for (cnt = 0; cnt < nelmts; cnt++) {
/* Get the array index */
- if((sidx = tparam->eiter->next(eiter_info)) < 0)
+ if ((sidx = tparam->eiter->next(eiter_info)) < 0)
TEST_ERROR
idx = (hsize_t)sidx;
/* Retrieve element of array (not set yet) */
relmt = (uint64_t)0;
- if(H5EA_get(ea, idx, &relmt) < 0)
+ if (H5EA_get(ea, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify element is fill value for array */
- if(relmt != H5EA_TEST_FILL)
+ if (relmt != H5EA_TEST_FILL)
TEST_ERROR
} /* end for */
/* Shutdown iterator */
- if(tparam->eiter->term(eiter_info) < 0)
+ if (tparam->eiter->term(eiter_info) < 0)
TEST_ERROR
-
/* Set (& get) all elements from empty array */
/* Initialize iterator */
- if(NULL == (eiter_info = tparam->eiter->init(cparam, tparam, nelmts)))
+ if (NULL == (eiter_info = tparam->eiter->init(cparam, tparam, nelmts)))
TEST_ERROR
/* Set elements of array */
- for(cnt = 0; cnt < nelmts; cnt++) {
+ for (cnt = 0; cnt < nelmts; cnt++) {
/* Get the array index */
- if((sidx = tparam->eiter->next(eiter_info)) < 0)
+ if ((sidx = tparam->eiter->next(eiter_info)) < 0)
TEST_ERROR
idx = (hsize_t)sidx;
/* Retrieve element of array (not set yet) */
relmt = (uint64_t)0;
- if(H5EA_get(ea, idx, &relmt) < 0)
+ if (H5EA_get(ea, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify element is fill value for array */
- if(relmt != H5EA_TEST_FILL)
+ if (relmt != H5EA_TEST_FILL)
TEST_ERROR
/* Set element of array */
welmt = (uint64_t)7 + idx;
- if(H5EA_set(ea, idx, &welmt) < 0)
+ if (H5EA_set(ea, idx, &welmt) < 0)
FAIL_STACK_ERROR
/* Get the max. array index */
- if((smax = tparam->eiter->max_elem(eiter_info)) < 0)
+ if ((smax = tparam->eiter->max_elem(eiter_info)) < 0)
TEST_ERROR
max = (hsize_t)smax;
/* Verify high-water # of elements written */
nelmts_written = (hsize_t)ULLONG_MAX;
- if(H5EA_get_nelmts(ea, &nelmts_written) < 0)
+ if (H5EA_get_nelmts(ea, &nelmts_written) < 0)
FAIL_STACK_ERROR
- if(nelmts_written != (max + 1))
+ if (nelmts_written != (max + 1))
TEST_ERROR
/* Check if array state is available */
- if(tparam->eiter->state) {
+ if (tparam->eiter->state) {
/* Get the extensible array state */
- if(tparam->eiter->state(eiter_info, cparam, tparam, &state, idx) < 0)
+ if (tparam->eiter->state(eiter_info, cparam, tparam, &state, idx) < 0)
TEST_ERROR
/* Verify array state */
- if(check_stats(ea, &state))
+ if (check_stats(ea, &state))
TEST_ERROR
} /* end if */
/* Retrieve element of array (set now) */
relmt = (uint64_t)0;
- if(H5EA_get(ea, idx, &relmt) < 0)
+ if (H5EA_get(ea, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify element is value written */
- if(relmt != welmt)
+ if (relmt != welmt)
TEST_ERROR
} /* end for */
/* Shutdown iterator */
- if(tparam->eiter->term(eiter_info) < 0)
+ if (tparam->eiter->term(eiter_info) < 0)
TEST_ERROR
/* Close array, delete array, close file & verify file is empty */
- if(finish(file, fapl, f, ea, ea_addr) < 0)
+ if (finish(file, fapl, f, ea, ea_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -2201,16 +2183,17 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(ea)
+ H5E_BEGIN_TRY
+ {
+ if (ea)
H5EA_close(ea);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_set_elmts() */
-
/*-------------------------------------------------------------------------
* Function: test_skip_elmts
*
@@ -2225,19 +2208,19 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
- hsize_t skip_elmts, const char *test_str)
+test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, hsize_t skip_elmts,
+ const char *test_str)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5EA_t *ea = NULL; /* Extensible array wrapper */
- earray_state_t state; /* State of extensible array */
- uint64_t welmt; /* Element to write */
- uint64_t relmt; /* Element to read */
- hsize_t nelmts_written; /* Highest element written in array */
- hsize_t idx; /* Index value of element to get */
- hsize_t cnt; /* Count of array indices */
- haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5EA_t * ea = NULL; /* Extensible array wrapper */
+ earray_state_t state; /* State of extensible array */
+ uint64_t welmt; /* Element to write */
+ uint64_t relmt; /* Element to read */
+ hsize_t nelmts_written; /* Highest element written in array */
+ hsize_t idx; /* Index value of element to get */
+ hsize_t cnt; /* Count of array indices */
+ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
/*
* Display testing message
@@ -2245,32 +2228,32 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
- if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
+ if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/* Create array */
- if(create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
+ if (create_array(f, cparam, &ea, &ea_addr, NULL) < 0)
TEST_ERROR
/* Verify the creation parameters */
- if(verify_cparam(ea, cparam) < 0)
+ if (verify_cparam(ea, cparam) < 0)
TEST_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, &ea, ea_addr, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, &ea, ea_addr, tparam) < 0)
TEST_ERROR
/* Verify high-water # of elements written */
nelmts_written = (hsize_t)ULLONG_MAX;
- if(H5EA_get_nelmts(ea, &nelmts_written) < 0)
+ if (H5EA_get_nelmts(ea, &nelmts_written) < 0)
FAIL_STACK_ERROR
- if(nelmts_written != 0)
+ if (nelmts_written != 0)
TEST_ERROR
/* Verify array state */
HDmemset(&state, 0, sizeof(state));
state.hdr_size = EA_HDR_SIZE;
- if(check_stats(ea, &state))
+ if (check_stats(ea, &state))
TEST_ERROR
/* Set (& get) element after skipping elements */
@@ -2278,78 +2261,79 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
/* Retrieve element of array (not set yet) */
relmt = (uint64_t)0;
- if(H5EA_get(ea, idx, &relmt) < 0)
+ if (H5EA_get(ea, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify element is fill value for array */
- if(relmt != H5EA_TEST_FILL)
+ if (relmt != H5EA_TEST_FILL)
TEST_ERROR
/* Set element of array */
welmt = (uint64_t)7 + idx;
- if(H5EA_set(ea, idx, &welmt) < 0)
+ if (H5EA_set(ea, idx, &welmt) < 0)
FAIL_STACK_ERROR
/* Verify high-water # of elements written */
nelmts_written = (hsize_t)ULLONG_MAX;
- if(H5EA_get_nelmts(ea, &nelmts_written) < 0)
+ if (H5EA_get_nelmts(ea, &nelmts_written) < 0)
FAIL_STACK_ERROR
- if(nelmts_written != (idx + 1))
+ if (nelmts_written != (idx + 1))
TEST_ERROR
/* Set array state */
HDmemset(&state, 0, sizeof(state));
- state.hdr_size = EA_HDR_SIZE;
- state.nindex_blks = 1;
+ state.hdr_size = EA_HDR_SIZE;
+ state.nindex_blks = 1;
state.index_blk_size = EA_IBLOCK_SIZE;
- state.max_idx_set = idx + 1;
- if(1 == skip_elmts) {
- state.nelmts = (hsize_t)cparam->idx_blk_elmts;
+ state.max_idx_set = idx + 1;
+ if (1 == skip_elmts) {
+ state.nelmts = (hsize_t)cparam->idx_blk_elmts;
state.nsuper_blks = state.ndata_blks = (hsize_t)0;
} /* end if */
- else if(cparam->idx_blk_elmts == skip_elmts) {
- state.nelmts = (hsize_t)cparam->idx_blk_elmts + cparam->data_blk_min_elmts;
- state.ndata_blks = (hsize_t)1;
+ else if (cparam->idx_blk_elmts == skip_elmts) {
+ state.nelmts = (hsize_t)cparam->idx_blk_elmts + cparam->data_blk_min_elmts;
+ state.ndata_blks = (hsize_t)1;
state.nsuper_blks = (hsize_t)0;
} /* end if */
else {
- unsigned sblk_idx; /* Which superblock does this index fall in? */
+ unsigned sblk_idx; /* Which superblock does this index fall in? */
/* Compute super block index for element index */
/* (same eqn. as in H5EA__dblock_sblk_idx()) */
- sblk_idx = H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
- state.nelmts = (hsize_t)cparam->idx_blk_elmts + tparam->sblk_info[sblk_idx].dblk_nelmts;
- state.ndata_blks = (hsize_t)1;
+ sblk_idx =
+ H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
+ state.nelmts = (hsize_t)cparam->idx_blk_elmts + tparam->sblk_info[sblk_idx].dblk_nelmts;
+ state.ndata_blks = (hsize_t)1;
state.nsuper_blks = (hsize_t)1;
} /* end if */
/* Verify array state */
- if(check_stats(ea, &state))
+ if (check_stats(ea, &state))
TEST_ERROR
/* Retrieve element of array (set now) */
relmt = (uint64_t)0;
- if(H5EA_get(ea, idx, &relmt) < 0)
+ if (H5EA_get(ea, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify element is value written */
- if(relmt != welmt)
+ if (relmt != welmt)
TEST_ERROR
/* Get unset elements of array */
- for(cnt = 0; cnt < skip_elmts; cnt++) {
+ for (cnt = 0; cnt < skip_elmts; cnt++) {
/* Retrieve element of array (not set yet) */
relmt = (uint64_t)0;
- if(H5EA_get(ea, cnt, &relmt) < 0)
+ if (H5EA_get(ea, cnt, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify element is fill value for array */
- if(relmt != H5EA_TEST_FILL)
+ if (relmt != H5EA_TEST_FILL)
TEST_ERROR
} /* end for */
/* Close array, delete array, close file & verify file is empty */
- if(finish(file, fapl, f, ea, ea_addr) < 0)
+ if (finish(file, fapl, f, ea, ea_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -2358,16 +2342,17 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(ea)
+ H5E_BEGIN_TRY
+ {
+ if (ea)
H5EA_close(ea);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_skip_elmts() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2384,28 +2369,29 @@ error:
int
main(void)
{
- H5EA_create_t cparam; /* Creation parameters for extensible array */
- earray_test_param_t tparam; /* Testing parameters */
- earray_test_type_t curr_test; /* Current test being worked on */
- earray_iter_type_t curr_iter; /* Current iteration type being worked on */
- hid_t fapl = -1; /* File access property list for data files */
- unsigned nerrors = 0; /* Cumulative error count */
- time_t curr_time; /* Current time, for seeding random number generator */
- int ExpressMode; /* Test express value */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ H5EA_create_t cparam; /* Creation parameters for extensible array */
+ earray_test_param_t tparam; /* Testing parameters */
+ earray_test_type_t curr_test; /* Current test being worked on */
+ earray_iter_type_t curr_iter; /* Current iteration type being worked on */
+ hid_t fapl = -1; /* File access property list for data files */
+ unsigned nerrors = 0; /* Cumulative error count */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ int ExpressMode; /* Test express value */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Reset library */
h5_reset();
- fapl = h5_fileaccess();
+ fapl = h5_fileaccess();
ExpressMode = GetTestExpress();
- if(ExpressMode > 1)
+ if (ExpressMode > 1)
HDprintf("***Express test mode on. Some tests may be skipped\n");
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g));
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Seed random #'s */
@@ -2414,32 +2400,31 @@ main(void)
/* Create an empty file to retrieve size */
{
- hid_t file; /* File ID */
+ hid_t file; /* File ID */
- if((file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/no array */
- if((empty_size_g = h5_get_file_size(filename_g, fapl)) < 0)
+ if ((empty_size_g = h5_get_file_size(filename_g, fapl)) < 0)
TEST_ERROR
}
-
/* Initialize extensible array creation parameters */
init_cparam(&cparam);
/* Iterate over the testing parameters */
- for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; curr_test++) {
+ for (curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; curr_test++) {
/* Initialize the testing parameters */
init_tparam(&tparam, &cparam);
/* Set appropriate testing parameters for each test */
- switch(curr_test) {
+ switch (curr_test) {
/* "Normal" testing parameters */
case EARRAY_TEST_NORMAL:
puts("Testing with normal parameters");
@@ -2465,15 +2450,15 @@ main(void)
nerrors += test_delete_open(fapl, &cparam, &tparam);
/* Iterate over the type of capacity tests */
- for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; curr_iter++) {
- hsize_t sblk; /* Super block index */
- hsize_t dblk; /* Data block index */
- hsize_t nelmts; /* # of elements to test */
- char test_str[128]; /* String for describing test */
- hsize_t ndblks; /* # of data blocks tested */
+ for (curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; curr_iter++) {
+ hsize_t sblk; /* Super block index */
+ hsize_t dblk; /* Data block index */
+ hsize_t nelmts; /* # of elements to test */
+ char test_str[128]; /* String for describing test */
+ hsize_t ndblks; /* # of data blocks tested */
/* Set appropriate parameters for each type of iteration */
- switch(curr_iter) {
+ switch (curr_iter) {
/* "Forward" testing parameters */
case EARRAY_ITER_FW:
puts("Testing with forward iteration");
@@ -2512,40 +2497,52 @@ main(void)
/* Basic capacity tests */
nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)1, "setting first element of array");
- nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)cparam.idx_blk_elmts, "setting index block elements of array");
+ nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)cparam.idx_blk_elmts,
+ "setting index block elements of array");
/* Super Block capacity tests */
ndblks = 0;
- for(sblk = 0; sblk < 9; sblk++) {
- for(dblk = 0; dblk < tparam.sblk_info[sblk].ndblks; dblk ++) {
+ for (sblk = 0; sblk < 9; sblk++) {
+ for (dblk = 0; dblk < tparam.sblk_info[sblk].ndblks; dblk++) {
/* Test first element in data block */
- nelmts = (hsize_t)((hsize_t)1 + cparam.idx_blk_elmts +
- tparam.sblk_info[sblk].start_idx +
- (tparam.sblk_info[sblk].dblk_nelmts * dblk));
- HDsprintf(test_str, "setting first element of array's data block #%llu", (unsigned long long)ndblks);
+ nelmts = (hsize_t)((hsize_t)1 + cparam.idx_blk_elmts + tparam.sblk_info[sblk].start_idx +
+ (tparam.sblk_info[sblk].dblk_nelmts * dblk));
+ HDsprintf(test_str, "setting first element of array's data block #%llu",
+ (unsigned long long)ndblks);
nerrors += test_set_elmts(fapl, &cparam, &tparam, nelmts, test_str);
/* Test all elements in data block */
- nelmts = (hsize_t)(cparam.idx_blk_elmts +
- tparam.sblk_info[sblk].start_idx +
- (tparam.sblk_info[sblk].dblk_nelmts * (dblk + 1)));
- HDsprintf(test_str, "setting all elements of array's data block #%llu", (unsigned long long)ndblks);
+ nelmts = (hsize_t)(cparam.idx_blk_elmts + tparam.sblk_info[sblk].start_idx +
+ (tparam.sblk_info[sblk].dblk_nelmts * (dblk + 1)));
+ HDsprintf(test_str, "setting all elements of array's data block #%llu",
+ (unsigned long long)ndblks);
nerrors += test_set_elmts(fapl, &cparam, &tparam, nelmts, test_str);
/* Increment data block being tested */
ndblks++;
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Check skipping elements */
nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)1, "skipping 1st element");
- nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)cparam.idx_blk_elmts, "skipping index block elements");
- nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (15 * cparam.data_blk_min_elmts) + 1), "skipping index block & data block elements");
- nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (31 * cparam.data_blk_min_elmts) + 1), "skipping 1st super block elements");
- nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (63 * cparam.data_blk_min_elmts) + 1), "skipping 2nd super block elements");
- nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (127 * cparam.data_blk_min_elmts) + 1), "skipping 3rd super block elements");
- nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (255 * cparam.data_blk_min_elmts) + 1), "skipping 4th super block elements");
+ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)cparam.idx_blk_elmts,
+ "skipping index block elements");
+ nerrors += test_skip_elmts(fapl, &cparam, &tparam,
+ (hsize_t)(cparam.idx_blk_elmts + (15 * cparam.data_blk_min_elmts) + 1),
+ "skipping index block & data block elements");
+ nerrors += test_skip_elmts(fapl, &cparam, &tparam,
+ (hsize_t)(cparam.idx_blk_elmts + (31 * cparam.data_blk_min_elmts) + 1),
+ "skipping 1st super block elements");
+ nerrors += test_skip_elmts(fapl, &cparam, &tparam,
+ (hsize_t)(cparam.idx_blk_elmts + (63 * cparam.data_blk_min_elmts) + 1),
+ "skipping 2nd super block elements");
+ nerrors += test_skip_elmts(fapl, &cparam, &tparam,
+ (hsize_t)(cparam.idx_blk_elmts + (127 * cparam.data_blk_min_elmts) + 1),
+ "skipping 3rd super block elements");
+ nerrors += test_skip_elmts(fapl, &cparam, &tparam,
+ (hsize_t)(cparam.idx_blk_elmts + (255 * cparam.data_blk_min_elmts) + 1),
+ "skipping 4th super block elements");
/* Close down testing parameters */
finish_tparam(&tparam);
@@ -2555,10 +2552,11 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All extensible array tests passed.");
@@ -2570,12 +2568,11 @@ main(void)
error:
HDputs("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(fapl); }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
return 1;
} /* end main() */
-
diff --git a/test/efc.c b/test/efc.c
index 9ae7d53..c0b41b2 100644
--- a/test/efc.c
+++ b/test/efc.c
@@ -16,29 +16,21 @@
#include "h5test.h"
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5Fpkg.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Iprivate.h"
-#include "H5Pprivate.h" /* Property lists */
-
-const char *FILENAME[] = {
- "efc0",
- "efc1",
- "efc2",
- "efc3",
- "efc4",
- "efc5",
- NULL
-};
+#include "H5Pprivate.h" /* Property lists */
+
+const char *FILENAME[] = {"efc0", "efc1", "efc2", "efc3", "efc4", "efc5", NULL};
/* Windows doesn't have PATH_MAX */
#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif /* !PATH_MAX */
+#define PATH_MAX 4096
+#endif /* !PATH_MAX */
/* Global patched filename buffer */
-#define N_FILENAMES 6
+#define N_FILENAMES 6
static char *filename[N_FILENAMES];
/* Global property lists - just copies of the defaults (necessary to use
@@ -46,7 +38,6 @@ static char *filename[N_FILENAMES];
hid_t fcpl_id = H5I_INVALID_HID;
hid_t fapl_id = H5I_INVALID_HID;
-
/*-------------------------------------------------------------------------
* Function: test_single
*
@@ -63,414 +54,403 @@ hid_t fapl_id = H5I_INVALID_HID;
static unsigned
test_single(void)
{
- H5F_t *f0 = NULL; /* Parent file containing EFC */
- H5F_t *f1 = NULL; /* Child file */
- H5F_t *f2 = NULL; /* Child file */
- H5F_t *f3 = NULL; /* Child file */
- H5F_t *f4 = NULL; /* Child file */
- H5F_t *ftmp1 = NULL; /* Temp file */
- H5F_t *ftmp2 = NULL; /* Temp file */
- H5F_t *ftmp3 = NULL; /* Temp file */
- H5F_t *ftmp4 = NULL; /* Temp file */
+ H5F_t *f0 = NULL; /* Parent file containing EFC */
+ H5F_t *f1 = NULL; /* Child file */
+ H5F_t *f2 = NULL; /* Child file */
+ H5F_t *f3 = NULL; /* Child file */
+ H5F_t *f4 = NULL; /* Child file */
+ H5F_t *ftmp1 = NULL; /* Temp file */
+ H5F_t *ftmp2 = NULL; /* Temp file */
+ H5F_t *ftmp3 = NULL; /* Temp file */
+ H5F_t *ftmp4 = NULL; /* Temp file */
TESTING("single EFC");
/* Set EFC size to 3. Do this instead of H5F__efc_create() so we can pass
* a file pointer to H5F__efc_open containing the EFC.
*/
- if(H5Pset_elink_file_cache_size(fapl_id, 3) < 0)
+ if (H5Pset_elink_file_cache_size(fapl_id, 3) < 0)
TEST_ERROR
/* Open parent file */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
/* Disable EFC for child files */
- if(H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
+ if (H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
TEST_ERROR
-
/* Test 1: Open file 1 through EFC, close, then open normally, verify ref
* count = 2, release EFC, verify ref count = 1. Verifies a file can be
* held open by the EFC.
*/
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 1)
+ if (ftmp1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp1, NULL) < 0)
+ if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 2: Verify that subsequent efc_open requests return the cached top
* level file pointer. Open file 1 through EFC, close, open again, verify
* file pointers are the same. */
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
ftmp1 = f1;
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1 != ftmp1)
+ if (f1 != ftmp1)
TEST_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
-
/* Test 3: Verify LRU functionality. Add four files to the EFC and verify
* that the one added first is evicted. Then reopen files in a different
* order. Open each file normally after closing through EFC the first time
* to track ref counts. */
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(f2->shared->nrefs != 2)
+ if (f2->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(f2->shared->nrefs != 2)
+ if (f2->shared->nrefs != 2)
TEST_ERROR
- if(f3->shared->nrefs != 2)
+ if (f3->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f4 = H5F__efc_open(f0, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f4) < 0)
+ if (H5F_efc_close(f0, f4) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(f2->shared->nrefs != 2)
+ if (f2->shared->nrefs != 2)
TEST_ERROR
- if(f3->shared->nrefs != 2)
+ if (f3->shared->nrefs != 2)
TEST_ERROR
- if(f4->shared->nrefs != 2)
+ if (f4->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (ftmp3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, ftmp3) < 0)
+ if (H5F_efc_close(f0, ftmp3) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(f2->shared->nrefs != 2)
+ if (f2->shared->nrefs != 2)
TEST_ERROR
- if(f3->shared->nrefs != 2)
+ if (f3->shared->nrefs != 2)
TEST_ERROR
- if(f4->shared->nrefs != 2)
+ if (f4->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, ftmp2) < 0)
+ if (H5F_efc_close(f0, ftmp2) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(f2->shared->nrefs != 2)
+ if (f2->shared->nrefs != 2)
TEST_ERROR
- if(f3->shared->nrefs != 2)
+ if (f3->shared->nrefs != 2)
TEST_ERROR
- if(f4->shared->nrefs != 2)
+ if (f4->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, ftmp1) < 0)
+ if (H5F_efc_close(f0, ftmp1) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(f2->shared->nrefs != 2)
+ if (f2->shared->nrefs != 2)
TEST_ERROR
- if(f3->shared->nrefs != 2)
+ if (f3->shared->nrefs != 2)
TEST_ERROR
- if(f4->shared->nrefs != 1)
+ if (f4->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (ftmp4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, ftmp4) < 0)
+ if (H5F_efc_close(f0, ftmp4) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(f2->shared->nrefs != 2)
+ if (f2->shared->nrefs != 2)
TEST_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(f4->shared->nrefs != 2)
+ if (f4->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(f4->shared->nrefs != 1)
+ if (f4->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f4, NULL) < 0)
+ if (H5F_try_close(f4, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 4: Verify that files kept open through the EFC are not evicted by
* H5F__efc_release(). */
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 1)
+ if (ftmp1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp1, NULL) < 0)
+ if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 5: Verify that files kept open through the EFC are not evicted by
* filling up the cache. Open 4 files while holding the first open. Verify
* that the second file is evicted. Close the first file, reopen the
* second, and verify that the first file is evicted. */
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp1->shared != f1->shared)
+ if (ftmp1->shared != f1->shared)
TEST_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f4 = H5F__efc_open(f0, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f4) < 0)
+ if (H5F_efc_close(f0, f4) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(ftmp2->shared->nrefs != 1)
+ if (ftmp2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 1)
+ if (ftmp1->shared->nrefs != 1)
TEST_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 1)
+ if (ftmp1->shared->nrefs != 1)
TEST_ERROR
- if(ftmp2->shared->nrefs != 1)
+ if (ftmp2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp1, NULL) < 0)
+ if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp2, NULL) < 0)
+ if (H5F_try_close(ftmp2, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 6: Verify that having a full EFC filled only with open files
* prevents further files from being cached. Open and hold open 3 files
* through the EFC, then open the fourth and verify that it was not added to
* the EFC. */
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp1->shared != f1->shared)
+ if (ftmp1->shared != f1->shared)
TEST_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp2->shared != f2->shared)
+ if (ftmp2->shared != f2->shared)
TEST_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp3->shared != f3->shared)
+ if (ftmp3->shared != f3->shared)
TEST_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f4 = H5F__efc_open(f0, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f4) < 0)
+ if (H5F_efc_close(f0, f4) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp4->shared->nrefs != 1)
+ if (ftmp4->shared->nrefs != 1)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 1)
+ if (ftmp1->shared->nrefs != 1)
TEST_ERROR
- if(ftmp2->shared->nrefs != 1)
+ if (ftmp2->shared->nrefs != 1)
TEST_ERROR
- if(ftmp3->shared->nrefs != 1)
+ if (ftmp3->shared->nrefs != 1)
TEST_ERROR
- if(ftmp4->shared->nrefs != 1)
+ if (ftmp4->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp1, NULL) < 0)
+ if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp2, NULL) < 0)
+ if (H5F_try_close(ftmp2, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp3, NULL) < 0)
+ if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp4, NULL) < 0)
+ if (H5F_try_close(ftmp4, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 7: Test multiple file opens. Open a file twice, close it once, then
* verify that it is not evicted by H5F__efc_release(). */
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 1)
+ if (ftmp1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp1, NULL) < 0)
+ if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR
-
/* Close parent file */
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -481,7 +461,6 @@ error:
return 1;
} /* test_single */
-
/*-------------------------------------------------------------------------
* Function: test_graph_nocycle
*
@@ -499,15 +478,15 @@ error:
static unsigned
test_graph_nocycle(void)
{
- H5F_t *f0 = NULL; /* Parent file containing EFC */
- H5F_t *f1 = NULL; /* Child file */
- H5F_t *f2 = NULL; /* Child file */
- H5F_t *f3 = NULL; /* Child file */
- H5F_t *f4 = NULL; /* Child file */
- H5F_t *ftmp1 = NULL; /* Temp file */
- H5F_t *ftmp2 = NULL; /* Temp file */
- H5F_t *ftmp3 = NULL; /* Temp file */
- H5F_t *ftmp4 = NULL; /* Temp file */
+ H5F_t *f0 = NULL; /* Parent file containing EFC */
+ H5F_t *f1 = NULL; /* Child file */
+ H5F_t *f2 = NULL; /* Child file */
+ H5F_t *f3 = NULL; /* Child file */
+ H5F_t *f4 = NULL; /* Child file */
+ H5F_t *ftmp1 = NULL; /* Temp file */
+ H5F_t *ftmp2 = NULL; /* Temp file */
+ H5F_t *ftmp3 = NULL; /* Temp file */
+ H5F_t *ftmp4 = NULL; /* Temp file */
TESTING("graph of EFCs without cycles");
@@ -515,310 +494,288 @@ test_graph_nocycle(void)
* a file pointer to H5F__efc_open containing the EFC. Set to a high number
* because we don't test the EFC becoming too large in this test.
*/
- if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
+ if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
TEST_ERROR
-
/* Test 1: Simple 3 file chain. Open file 1 through file 0, then open file
* 2 through file 1. Release file 0's EFC and verify that file 2 gets its
* ref count reduced (implying file 1 was closed). Do the same with the
* opening order reversed.
*/
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f1, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f2) < 0)
+ if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 1)
+ if (ftmp2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp2, NULL) < 0)
+ if (H5F_try_close(ftmp2, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(ftmp1, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F__efc_open(ftmp1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id,
+ fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp1, NULL) < 0)
+ if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f2) < 0)
+ if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 1)
+ if (ftmp2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp2, NULL) < 0)
+ if (H5F_try_close(ftmp2, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 2: 5 file chain. The parent file has 2 child files, each of which
* has their own child file. Verifies that releasing the parent's EFC
* closes all 4 children. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f1, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f2) < 0)
+ if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F__efc_open(f3, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f4 = H5F__efc_open(f3, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, f4) < 0)
+ if (H5F_efc_close(f3, f4) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp4->shared->nrefs != 2)
+ if (ftmp4->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 1)
+ if (ftmp2->shared->nrefs != 1)
TEST_ERROR
- if(ftmp4->shared->nrefs != 1)
+ if (ftmp4->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp2, NULL) < 0)
+ if (H5F_try_close(ftmp2, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp4, NULL) < 0)
+ if (H5F_try_close(ftmp4, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 3: Simple "inverted" tree. Two parent files share a child file,
* which has its own child file. Verify that the child's child is not
* closed until both parents' EFCs are released. First release through one
* parent, then reopen through that parent and release the other, then
* re-release the first parent. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp2) < 0)
+ if (H5F_efc_close(f1, ftmp2) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(H5F__efc_release(f1->shared->efc) < 0)
+ if (H5F__efc_release(f1->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 1)
+ if (ftmp3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp3, NULL) < 0)
+ if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 4: Simple "diamond" tree. The parent file has two children, which
* shared the same child. Verify that releasing the parent file closes all
* files. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 3)
+ if (ftmp3->shared->nrefs != 3)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 1)
+ if (ftmp3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp3, NULL) < 0)
+ if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 5: Dense 5 file graph. f0 caches f1, f2, f3 and f4. f1 and f2
* each cache f3 and f4. f3 caches f4. Verify that releasing f0 closes all
* files. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F__efc_open(f0, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f4 = H5F__efc_open(f0, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f4) < 0)
+ if (H5F_efc_close(f0, f4) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f4) < 0)
+ if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F__efc_open(f2, filename[4], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f4 = H5F__efc_open(f2, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f4) < 0)
+ if (H5F_efc_close(f2, f4) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F__efc_open(f3, filename[4], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f4 = H5F__efc_open(f3, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, f4) < 0)
+ if (H5F_efc_close(f3, f4) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp4->shared->nrefs != 5)
+ if (ftmp4->shared->nrefs != 5)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp4->shared->nrefs != 1)
+ if (ftmp4->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 1)
+ if (ftmp1->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 1)
+ if (ftmp2->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 1)
+ if (ftmp3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(ftmp1, NULL) < 0)
+ if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp2, NULL) < 0)
+ if (H5F_try_close(ftmp2, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp3, NULL) < 0)
+ if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp4, NULL) < 0)
+ if (H5F_try_close(ftmp4, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
PASSED();
return 0;
@@ -827,7 +784,6 @@ error:
return 1;
} /* test_graph_nocycle */
-
/*-------------------------------------------------------------------------
* Function: test_graph_cycle
*
@@ -845,16 +801,16 @@ error:
static unsigned
test_graph_cycle(void)
{
- H5F_t *f0 = NULL; /* File */
- H5F_t *f1 = NULL; /* File */
- H5F_t *f2 = NULL; /* File */
- H5F_t *f3 = NULL; /* File */
- H5F_t *f4 = NULL; /* File */
- H5F_t *f5 = NULL; /* File */
- H5F_t *ftmp0 = NULL; /* Temp file */
- H5F_t *ftmp1 = NULL; /* Temp file */
- H5F_t *ftmp2 = NULL; /* Temp file */
- H5F_t *ftmp3 = NULL; /* Temp file */
+ H5F_t *f0 = NULL; /* File */
+ H5F_t *f1 = NULL; /* File */
+ H5F_t *f2 = NULL; /* File */
+ H5F_t *f3 = NULL; /* File */
+ H5F_t *f4 = NULL; /* File */
+ H5F_t *f5 = NULL; /* File */
+ H5F_t *ftmp0 = NULL; /* Temp file */
+ H5F_t *ftmp1 = NULL; /* Temp file */
+ H5F_t *ftmp2 = NULL; /* Temp file */
+ H5F_t *ftmp3 = NULL; /* Temp file */
TESTING("graph of EFCs with cycles");
@@ -862,2022 +818,1816 @@ test_graph_cycle(void)
* a file pointer to H5F__efc_open containing the EFC. Set to a high number
* because we don't test the EFC becoming too large in this test.
*/
- if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
+ if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
TEST_ERROR
-
/* Test 1: File caches itself. Verify that closing the file causes it to be
* actually closed, and there is no other unexpected behavior.
*/
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, ftmp0) < 0)
+ if (H5F_efc_close(f0, ftmp0) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, ftmp0) < 0)
+ if (H5F_efc_close(f0, ftmp0) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 2: Indirectly referenced file caches itself. Same as above except
* the file is part of another file's EFC. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp1) < 0)
+ if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp1) < 0)
+ if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 3: Simple 2 file cycle */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 4: Simple 2 file cycle (indirectly referenced) */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f1, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp1) < 0)
+ if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f2) < 0)
+ if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 5: Parallel double cycle */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp0) < 0)
+ if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 3)
+ if (f0->shared->nrefs != 3)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 6: Parallel double cycle with release */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp0) < 0)
+ if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 3)
+ if (f0->shared->nrefs != 3)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 7: Chained parallel double cycle */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f1, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp1) < 0)
+ if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f2) < 0)
+ if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp1) < 0)
+ if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 8: Chained parallel double cycle with release */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f1, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp1) < 0)
+ if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f2) < 0)
+ if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp1) < 0)
+ if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 9: Simple 2 file cycle, extra ID on root */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp1) < 0)
+ if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared != ftmp0->shared)
+ if (f0->shared != ftmp0->shared)
TEST_ERROR
- if(f0->shared->nrefs != 3)
+ if (f0->shared->nrefs != 3)
TEST_ERROR
- if(H5F_try_close(ftmp0, NULL) < 0)
+ if (H5F_try_close(ftmp0, NULL) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 10: Simple 2 file cycle, extra ID on second file */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(ftmp1->shared->nrefs != 2)
+ if (ftmp1->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp1, NULL) < 0)
+ if (H5F_try_close(ftmp1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 11: Parallel double cycle, extra ID on a child file */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp0) < 0)
+ if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 3)
+ if (f0->shared->nrefs != 3)
TEST_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 3)
+ if (f0->shared->nrefs != 3)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp2, NULL) < 0)
+ if (H5F_try_close(ftmp2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 12: Parallel double cycle, extra ID on a child file, with release */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp0) < 0)
+ if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 3)
+ if (f0->shared->nrefs != 3)
TEST_ERROR
- if(ftmp2->shared->nrefs != 2)
+ if (ftmp2->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(ftmp2->shared->nrefs != 1)
+ if (ftmp2->shared->nrefs != 1)
TEST_ERROR
- if(H5F__efc_release(ftmp2->shared->efc) < 0)
+ if (H5F__efc_release(ftmp2->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(ftmp2->shared->nrefs != 1)
+ if (ftmp2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp2, NULL) < 0)
+ if (H5F_try_close(ftmp2, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 13: Chained parallel double cycle, extra ID on a child file */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f1, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp1) < 0)
+ if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f2) < 0)
+ if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp1) < 0)
+ if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp3, NULL) < 0)
+ if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 14: Chained parallel double cycle, extra ID on a child file, with
* release */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f1, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp1) < 0)
+ if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f2) < 0)
+ if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp1) < 0)
+ if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(ftmp3->shared->efc) < 0)
+ if (H5F__efc_release(ftmp3->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(ftmp3->shared->nrefs != 1)
+ if (ftmp3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp3, NULL) < 0)
+ if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 15: One local and one remote cycle */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp2) < 0)
+ if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 16: One local and one remote cycle, with release */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp2) < 0)
+ if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 17: One local and one remote cycle, remote cycle held open */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp2) < 0)
+ if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(ftmp3, NULL) < 0)
+ if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 18: One local and one remote cycle, remote cycle held open, with
* release */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp2) < 0)
+ if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(ftmp3->shared->nrefs != 2)
+ if (ftmp3->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 2)
+ if (f2->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F__efc_release(ftmp3->shared->efc) < 0)
+ if (H5F__efc_release(ftmp3->shared->efc) < 0)
FAIL_STACK_ERROR
- if(ftmp3->shared->nrefs != 1)
+ if (ftmp3->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(ftmp3, NULL) < 0)
+ if (H5F_try_close(ftmp3, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 19: "Diamond" shape with links moving from bottom (root) to top.
* Also cycle between bottom (root) and top and cycles on the sides. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp0) < 0)
+ if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F__efc_open(f1, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f4, ftmp1) < 0)
+ if (H5F_efc_close(f4, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f4) < 0)
+ if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR
- if(NULL == (f5 = H5F__efc_open(f2, filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f5, ftmp2) < 0)
+ if (H5F_efc_close(f5, ftmp2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f5) < 0)
+ if (H5F_efc_close(f2, f5) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F_open(filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f4->shared->nrefs != 1)
+ if (f4->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f4, NULL) < 0)
+ if (H5F_try_close(f4, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f5 = H5F_open(filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f5->shared->nrefs != 1)
+ if (f5->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f5, NULL) < 0)
+ if (H5F_try_close(f5, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 20: "Diamond" shape with links moving from bottom (root) to top.
* Also cycle between bottom (root) and top, cycles on the sides, and
* release the files instead of closing. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp0) < 0)
+ if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F__efc_open(f1, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f4, ftmp1) < 0)
+ if (H5F_efc_close(f4, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f4) < 0)
+ if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR
- if(NULL == (f5 = H5F__efc_open(f2, filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f5, ftmp2) < 0)
+ if (H5F_efc_close(f5, ftmp2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f5) < 0)
+ if (H5F_efc_close(f2, f5) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F_open(filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f4->shared->nrefs != 1)
+ if (f4->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f4, NULL) < 0)
+ if (H5F_try_close(f4, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f5 = H5F_open(filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f5->shared->nrefs != 1)
+ if (f5->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f5, NULL) < 0)
+ if (H5F_try_close(f5, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 21: "Diamond" shape with links moving from bottom (root) to top.
* Also cycle between bottom (root) and top, cycles on sides held open. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp0) < 0)
+ if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F__efc_open(f1, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f4, ftmp1) < 0)
+ if (H5F_efc_close(f4, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f4) < 0)
+ if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f5 = H5F__efc_open(f2, filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f5, ftmp2) < 0)
+ if (H5F_efc_close(f5, ftmp2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f5) < 0)
+ if (H5F_efc_close(f2, f5) < 0)
FAIL_STACK_ERROR
- if(NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f4->shared->nrefs != 2)
+ if (f4->shared->nrefs != 2)
TEST_ERROR
- if(f5->shared->nrefs != 2)
+ if (f5->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(f4->shared->nrefs != 2)
+ if (f4->shared->nrefs != 2)
TEST_ERROR
- if(f5->shared->nrefs != 2)
+ if (f5->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f4, NULL) < 0)
+ if (H5F_try_close(f4, NULL) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f5->shared->nrefs != 2)
+ if (f5->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(f5->shared->nrefs != 2)
+ if (f5->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f5, NULL) < 0)
+ if (H5F_try_close(f5, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F_open(filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f4->shared->nrefs != 1)
+ if (f4->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f4, NULL) < 0)
+ if (H5F_try_close(f4, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f5 = H5F_open(filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f5->shared->nrefs != 1)
+ if (f5->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f5, NULL) < 0)
+ if (H5F_try_close(f5, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 22: "Diamond" shape with links moving from bottom (root) to top.
* Also cycle between bottom (root) and top, cycles on sides held open.
* Also release the files instead of closing. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f3) < 0)
+ if (H5F_efc_close(f2, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp0) < 0)
+ if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F__efc_open(f1, filename[4],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f4 = H5F__efc_open(f1, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f4, ftmp1) < 0)
+ if (H5F_efc_close(f4, ftmp1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f4) < 0)
+ if (H5F_efc_close(f1, f4) < 0)
FAIL_STACK_ERROR
- if(NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f5 = H5F__efc_open(f2, filename[5],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f5 = H5F__efc_open(f2, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f5, ftmp2) < 0)
+ if (H5F_efc_close(f5, ftmp2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f5) < 0)
+ if (H5F_efc_close(f2, f5) < 0)
FAIL_STACK_ERROR
- if(NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f4->shared->nrefs != 2)
+ if (f4->shared->nrefs != 2)
TEST_ERROR
- if(f5->shared->nrefs != 2)
+ if (f5->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f4->shared->nrefs != 2)
+ if (f4->shared->nrefs != 2)
TEST_ERROR
- if(f5->shared->nrefs != 2)
+ if (f5->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 3)
+ if (f3->shared->nrefs != 3)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F__efc_release(f4->shared->efc) < 0)
+ if (H5F__efc_release(f4->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f4->shared->nrefs != 1)
+ if (f4->shared->nrefs != 1)
TEST_ERROR
- if(f5->shared->nrefs != 2)
+ if (f5->shared->nrefs != 2)
TEST_ERROR
- if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 2)
+ if (f3->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F__efc_release(f5->shared->efc) < 0)
+ if (H5F__efc_release(f5->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(f4->shared->nrefs != 1)
+ if (f4->shared->nrefs != 1)
TEST_ERROR
- if(f5->shared->nrefs != 1)
+ if (f5->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f4, NULL) < 0)
+ if (H5F_try_close(f4, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f5, NULL) < 0)
+ if (H5F_try_close(f5, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 23: Dense "ball" of files. 4 files each cache all files (including
* itself). */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, ftmp0) < 0)
+ if (H5F_efc_close(f0, ftmp0) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp1) < 0)
+ if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp2) < 0)
+ if (H5F_efc_close(f1, ftmp2) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp3) < 0)
+ if (H5F_efc_close(f1, ftmp3) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp0) < 0)
+ if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp1) < 0)
+ if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f2, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp2) < 0)
+ if (H5F_efc_close(f2, ftmp2) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp3) < 0)
+ if (H5F_efc_close(f2, ftmp3) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp0) < 0)
+ if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp1) < 0)
+ if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp2) < 0)
+ if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F__efc_open(f3, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp3 = H5F__efc_open(f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp3) < 0)
+ if (H5F_efc_close(f3, ftmp3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 24: Dense "ball" of files. 4 files each cache all files (including
* itself). Release the files instead of closing. */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, ftmp0) < 0)
+ if (H5F_efc_close(f0, ftmp0) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f0, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f0, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp1) < 0)
+ if (H5F_efc_close(f1, ftmp1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp2) < 0)
+ if (H5F_efc_close(f1, ftmp2) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp3) < 0)
+ if (H5F_efc_close(f1, ftmp3) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp0) < 0)
+ if (H5F_efc_close(f2, ftmp0) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp1) < 0)
+ if (H5F_efc_close(f2, ftmp1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f2, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp2) < 0)
+ if (H5F_efc_close(f2, ftmp2) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp3 = H5F__efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, ftmp3) < 0)
+ if (H5F_efc_close(f2, ftmp3) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp0) < 0)
+ if (H5F_efc_close(f3, ftmp0) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp1 = H5F__efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp1) < 0)
+ if (H5F_efc_close(f3, ftmp1) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp2 = H5F__efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp2) < 0)
+ if (H5F_efc_close(f3, ftmp2) < 0)
FAIL_STACK_ERROR
- if(NULL == (ftmp3 = H5F__efc_open(f3, filename[3], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp3 = H5F__efc_open(f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f3, ftmp3) < 0)
+ if (H5F_efc_close(f3, ftmp3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f3) < 0)
+ if (H5F_efc_close(f0, f3) < 0)
FAIL_STACK_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 25: File held open by EFC client interrupts cycle, with release */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 26: File held open by EFC does not interrupt cycle, with release */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F__efc_open(f0, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f0, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_efc_close(f0, f2) < 0)
+ if (H5F_efc_close(f0, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 27: File held open by EFC client through non-parent file does not
* interrupt cycle, but parent file does (no valid way around it) */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 2)
+ if (f3->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f1) < 0)
+ if (H5F_efc_close(f2, f1) < 0)
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 3)
+ if (f1->shared->nrefs != 3)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 2)
+ if (f3->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 28: File held open by EFC client through non-parent file does not
* interrupt cycle, but parent file does (no valid way around it), with
* release */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (f1 = H5F__efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F__efc_open(f1, filename[3],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f3 = H5F__efc_open(f1, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f1->shared->nrefs != 2)
+ if (f1->shared->nrefs != 2)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F__efc_release(f0->shared->efc) < 0)
+ if (H5F__efc_release(f0->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F__efc_release(f2->shared->efc) < 0)
+ if (H5F__efc_release(f2->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_efc_close(f1, f3) < 0)
+ if (H5F_efc_close(f1, f3) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f2, f1) < 0)
+ if (H5F_efc_close(f2, f1) < 0)
FAIL_STACK_ERROR
- if(H5F__efc_release(f2->shared->efc) < 0)
+ if (H5F__efc_release(f2->shared->efc) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f3->shared->nrefs != 1)
+ if (f3->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f3, NULL) < 0)
+ if (H5F_try_close(f3, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 29: File without EFC interrupts cycle */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
+ if (H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
TEST_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
+ if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
TEST_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
-
/* Test 30: File without EFC does not interrupt cycle */
- if(NULL == (f0 = H5F_open(filename[0],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F__efc_open(f0, filename[1],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f1 = H5F__efc_open(f0, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
- fapl_id)))
+ if (NULL == (ftmp0 = H5F__efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5F_efc_close(f1, ftmp0) < 0)
+ if (H5F_efc_close(f1, ftmp0) < 0)
FAIL_STACK_ERROR
- if(H5F_efc_close(f0, f1) < 0)
+ if (H5F_efc_close(f0, f1) < 0)
FAIL_STACK_ERROR
- if(H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
+ if (H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
TEST_ERROR
- if(NULL == (f2 = H5F__efc_open(f1, filename[2],
- H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
+ if (NULL ==
+ (f2 = H5F__efc_open(f1, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
+ if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
TEST_ERROR
- if(H5F_efc_close(f1, f2) < 0)
+ if (H5F_efc_close(f1, f2) < 0)
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 2)
+ if (f0->shared->nrefs != 2)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f0->shared->nrefs != 1)
+ if (f0->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f0, NULL) < 0)
+ if (H5F_try_close(f0, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f1->shared->nrefs != 1)
+ if (f1->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f1, NULL) < 0)
+ if (H5F_try_close(f1, NULL) < 0)
FAIL_STACK_ERROR
- if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
+ if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id)))
FAIL_STACK_ERROR
- if(f2->shared->nrefs != 1)
+ if (f2->shared->nrefs != 1)
TEST_ERROR
- if(H5F_try_close(f2, NULL) < 0)
+ if (H5F_try_close(f2, NULL) < 0)
FAIL_STACK_ERROR
-
PASSED();
return 0;
@@ -2886,7 +2636,6 @@ error:
return 1;
} /* test_graph_cycle */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2902,11 +2651,11 @@ error:
int
main(void)
{
- unsigned nerrors = 0; /* track errors */
- H5P_genplist_t *plist; /* Property list pointer for FAPL */
- H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- int i; /* iterator */
+ unsigned nerrors = 0; /* track errors */
+ H5P_genplist_t * plist; /* Property list pointer for FAPL */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ int i; /* iterator */
/* Test Setup */
HDputs("Testing the external file cache");
@@ -2916,7 +2665,7 @@ main(void)
fapl_id = h5_fileaccess();
/* Allocate memory for filenames */
- for(i = 0; i < N_FILENAMES; i++) {
+ for (i = 0; i < N_FILENAMES; i++) {
filename[i] = (char *)HDcalloc(PATH_MAX, sizeof(char));
}
@@ -2929,7 +2678,8 @@ main(void)
h5_fixname(FILENAME[5], fapl_id, filename[5], PATH_MAX);
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Get the VOL info from the fapl */
@@ -2947,25 +2697,25 @@ main(void)
nerrors += test_graph_cycle();
/* Close property lists */
- if(H5Pclose(fcpl_id) < 0)
+ if (H5Pclose(fcpl_id) < 0)
TEST_ERROR
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0)
+ if (api_ctx_pushed && H5CX_pop() < 0)
FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All external file cache tests passed.");
h5_clean_files(FILENAME, fapl_id);
- for(i = 0; i < N_FILENAMES; i++) {
+ for (i = 0; i < N_FILENAMES; i++) {
HDfree(filename[i]);
}
@@ -2974,17 +2724,15 @@ main(void)
error:
HDputs("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Pclose(fapl_id);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { H5Pclose(fapl_id); }
+ H5E_END_TRY
- if(api_ctx_pushed)
+ if (api_ctx_pushed)
H5CX_pop();
- for(i = 0; i < N_FILENAMES; i++) {
+ for (i = 0; i < N_FILENAMES; i++) {
HDfree(filename[i]);
}
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c
index 54f3fb0..1a6769c 100644
--- a/test/enc_dec_plist.c
+++ b/test/enc_dec_plist.c
@@ -19,676 +19,662 @@
#include "H5ACprivate.h"
#include "H5Pprivate.h"
-#define SRC_FNAME "source_file.h5"
-#define SRC_DSET "src_dset"
+#define SRC_FNAME "source_file.h5"
+#define SRC_DSET "src_dset"
static int
test_encode_decode(hid_t orig_pl, H5F_libver_t low, H5F_libver_t high, hbool_t support_virtual)
{
- hid_t pl = (-1); /* Decoded property list */
- hid_t fapl = -1; /* File access property list */
- void *temp_buf = NULL; /* Pointer to encoding buffer */
- size_t temp_size = 0; /* Size of encoding buffer */
- herr_t ret; /* Return value */
+ hid_t pl = (-1); /* Decoded property list */
+ hid_t fapl = -1; /* File access property list */
+ void * temp_buf = NULL; /* Pointer to encoding buffer */
+ size_t temp_size = 0; /* Size of encoding buffer */
+ herr_t ret; /* Return value */
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set library version bounds */
- if(H5Pset_libver_bounds(fapl, low, high) < 0)
+ if (H5Pset_libver_bounds(fapl, low, high) < 0)
TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Pencode2(orig_pl, NULL, &temp_size, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pencode2(orig_pl, NULL, &temp_size, fapl); }
+ H5E_END_TRY;
- if(support_virtual && high < H5F_LIBVER_V110)
+ if (support_virtual && high < H5F_LIBVER_V110)
VERIFY(ret, FAIL, "H5Pencode2");
else {
VERIFY(ret, SUCCEED, "H5Pencode2");
/* Allocate the buffer for encoding */
- if(NULL == (temp_buf = (void *)HDmalloc(temp_size)))
+ if (NULL == (temp_buf = (void *)HDmalloc(temp_size)))
TEST_ERROR
/* Encode the property list to the buffer */
- if(H5Pencode2(orig_pl, temp_buf, &temp_size, fapl) < 0)
+ if (H5Pencode2(orig_pl, temp_buf, &temp_size, fapl) < 0)
TEST_ERROR
/* Decode the buffer */
- if((pl = H5Pdecode(temp_buf)) < 0)
+ if ((pl = H5Pdecode(temp_buf)) < 0)
STACK_ERROR
/* Check if the original and the decoded property lists are equal */
- if(!H5Pequal(orig_pl, pl))
+ if (!H5Pequal(orig_pl, pl))
PUTS_ERROR("encoding-decoding cycle failed\n")
/* Close the decoded property list */
- if((H5Pclose(pl)) < 0)
+ if ((H5Pclose(pl)) < 0)
TEST_ERROR
/* Free the buffer */
- if(temp_buf)
+ if (temp_buf)
HDfree(temp_buf);
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Test H5Pencode1() */
/* first call to encode returns only the size of the buffer needed */
- if(H5Pencode1(orig_pl, NULL, &temp_size) < 0)
+ if (H5Pencode1(orig_pl, NULL, &temp_size) < 0)
STACK_ERROR
- if(NULL == (temp_buf = (void *)HDmalloc(temp_size)))
+ if (NULL == (temp_buf = (void *)HDmalloc(temp_size)))
TEST_ERROR
- if(H5Pencode1(orig_pl, temp_buf, &temp_size) < 0)
+ if (H5Pencode1(orig_pl, temp_buf, &temp_size) < 0)
STACK_ERROR
- if((pl = H5Pdecode(temp_buf)) < 0)
+ if ((pl = H5Pdecode(temp_buf)) < 0)
STACK_ERROR
- if(!H5Pequal(orig_pl, pl))
+ if (!H5Pequal(orig_pl, pl))
PUTS_ERROR("encoding-decoding cycle failed\n")
- if((H5Pclose(pl)) < 0)
+ if ((H5Pclose(pl)) < 0)
STACK_ERROR
- if(temp_buf)
+ if (temp_buf)
HDfree(temp_buf);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
}
- if((H5Pclose(fapl)) < 0)
+ if ((H5Pclose(fapl)) < 0)
TEST_ERROR
/* Success */
- return(0);
+ return (0);
error:
- if(temp_buf)
+ if (temp_buf)
HDfree(temp_buf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pl);
H5Pclose(fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return(-1);
+ return (-1);
} /* end test_encode_decode() */
int
main(void)
{
- hid_t dcpl; /* dataset create prop. list */
- hid_t dapl; /* dataset access prop. list */
- hid_t dxpl; /* dataset xfer prop. list */
- hid_t gcpl; /* group create prop. list */
- hid_t ocpypl; /* object copy prop. list */
- hid_t ocpl; /* object create prop. list */
- hid_t lcpl; /* link create prop. list */
- hid_t lapl; /* link access prop. list */
- hid_t fapl; /* file access prop. list */
- hid_t fcpl; /* file create prop. list */
- hid_t strcpl; /* string create prop. list */
- hid_t acpl; /* attribute create prop. list */
- hid_t srcspace = -1; /* Source dataspaces */
- hid_t vspace = -1; /* Virtual dset dataspaces */
- hsize_t dims[1] = {3}; /* Data space current size */
- hsize_t chunk_size[2] = {16384, 4}; /* chunk size */
- double fill = 2.7f; /* Fill value */
- hsize_t max_size[1]; /* data space maximum size */
- size_t nslots = 521 * 2;
- size_t nbytes = 1048576 * 10;
- double w0 = 0.5f;
- unsigned max_compact;
- unsigned min_dense;
- const char* c_to_f = "x+32";
+ hid_t dcpl; /* dataset create prop. list */
+ hid_t dapl; /* dataset access prop. list */
+ hid_t dxpl; /* dataset xfer prop. list */
+ hid_t gcpl; /* group create prop. list */
+ hid_t ocpypl; /* object copy prop. list */
+ hid_t ocpl; /* object create prop. list */
+ hid_t lcpl; /* link create prop. list */
+ hid_t lapl; /* link access prop. list */
+ hid_t fapl; /* file access prop. list */
+ hid_t fcpl; /* file create prop. list */
+ hid_t strcpl; /* string create prop. list */
+ hid_t acpl; /* attribute create prop. list */
+ hid_t srcspace = -1; /* Source dataspaces */
+ hid_t vspace = -1; /* Virtual dset dataspaces */
+ hsize_t dims[1] = {3}; /* Data space current size */
+ hsize_t chunk_size[2] = {16384, 4}; /* chunk size */
+ double fill = 2.7f; /* Fill value */
+ hsize_t max_size[1]; /* data space maximum size */
+ size_t nslots = 521 * 2;
+ size_t nbytes = 1048576 * 10;
+ double w0 = 0.5f;
+ unsigned max_compact;
+ unsigned min_dense;
+ const char * c_to_f = "x+32";
H5F_libver_t low, high; /* Low and high bounds */
- H5AC_cache_config_t my_cache_config = {
- H5AC__CURR_CACHE_CONFIG_VERSION,
- TRUE,
- FALSE,
- FALSE,
- "temp",
- TRUE,
- FALSE,
- ( 2 * 2048 * 1024),
- 0.3f,
- (64 * 1024 * 1024),
- (4 * 1024 * 1024),
- 60000,
- H5C_incr__threshold,
- 0.8f,
- 3.0f,
- TRUE,
- (8 * 1024 * 1024),
- H5C_flash_incr__add_space,
- 2.0f,
- 0.25f,
- H5C_decr__age_out_with_threshold,
- 0.997f,
- 0.8f,
- TRUE,
- (3 * 1024 * 1024),
- 3,
- FALSE,
- 0.2f,
- (256 * 2048),
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
-
- H5AC_cache_image_config_t my_cache_image_config = {
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
- TRUE,
- FALSE,
- -1 };
+ H5AC_cache_config_t my_cache_config = {H5AC__CURR_CACHE_CONFIG_VERSION,
+ TRUE,
+ FALSE,
+ FALSE,
+ "temp",
+ TRUE,
+ FALSE,
+ (2 * 2048 * 1024),
+ 0.3f,
+ (64 * 1024 * 1024),
+ (4 * 1024 * 1024),
+ 60000,
+ H5C_incr__threshold,
+ 0.8f,
+ 3.0f,
+ TRUE,
+ (8 * 1024 * 1024),
+ H5C_flash_incr__add_space,
+ 2.0f,
+ 0.25f,
+ H5C_decr__age_out_with_threshold,
+ 0.997f,
+ 0.8f,
+ TRUE,
+ (3 * 1024 * 1024),
+ 3,
+ FALSE,
+ 0.2f,
+ (256 * 2048),
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY};
+
+ H5AC_cache_image_config_t my_cache_image_config = {H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, TRUE, FALSE,
+ -1};
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- char msg[80]; /* Message for file version bounds */
- const char *low_string; /* The low bound string */
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ char msg[80]; /* Message for file version bounds */
+ const char *low_string; /* The low bound string */
const char *high_string; /* The high bound string */
/* Invalid combinations, just continue */
- if(high == H5F_LIBVER_EARLIEST || high < low)
+ if (high == H5F_LIBVER_EARLIEST || high < low)
continue;
/* Display testing info */
- low_string = h5_get_version_string(low);
+ low_string = h5_get_version_string(low);
high_string = h5_get_version_string(high);
- HDsprintf(msg, "Testing ENCODE/DECODE with file version bounds: (%s, %s):", low_string, high_string);
+ HDsprintf(msg, "Testing ENCODE/DECODE with file version bounds: (%s, %s):", low_string,
+ high_string);
HDputs(msg);
-
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("Encode/Decode DCPLs\n");
/******* ENCODE/DECODE DCPLS *****/
TESTING("Default DCPL Encoding/Decoding");
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(dcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(dcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default DCPL encoding/decoding failed\n")
PASSED();
TESTING("DCPL Encoding/Decoding");
- if((H5Pset_chunk(dcpl, 2, chunk_size)) < 0)
+ if ((H5Pset_chunk(dcpl, 2, chunk_size)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0)
+ if ((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill)) < 0)
+ if ((H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_dset_no_attrs_hint(dcpl, FALSE)) < 0)
+ if ((H5Pset_dset_no_attrs_hint(dcpl, FALSE)) < 0)
FAIL_STACK_ERROR
max_size[0] = 100;
- if((H5Pset_external(dcpl, "ext1.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ if ((H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0)
FAIL_STACK_ERROR
- if((H5Pset_external(dcpl, "ext2.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ if ((H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0)
FAIL_STACK_ERROR
- if((H5Pset_external(dcpl, "ext3.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ if ((H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0)
FAIL_STACK_ERROR
- if((H5Pset_external(dcpl, "ext4.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ if ((H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(dcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(dcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(dcpl)) < 0)
+ if ((H5Pclose(dcpl)) < 0)
FAIL_STACK_ERROR
- PASSED();
+ PASSED();
/******* ENCODE/DECODE DCPLS *****/
TESTING("DCPL Encoding/Decoding for virtual layout");
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set virtual layout */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create source dataspace */
- if((srcspace = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((srcspace = H5Screate_simple(1, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((vspace = H5Screate_simple(1, dims, NULL)) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace, SRC_FNAME, SRC_DSET, srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace, SRC_FNAME, SRC_DSET, srcspace) < 0)
TEST_ERROR
- if(test_encode_decode(dcpl, low, high, TRUE) < 0)
+ if (test_encode_decode(dcpl, low, high, TRUE) < 0)
FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(dcpl)) < 0)
+ if ((H5Pclose(dcpl)) < 0)
FAIL_STACK_ERROR
/******* ENCODE/DECODE DAPLS *****/
TESTING("Default DAPL Encoding/Decoding");
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(dapl, low, high, FALSE) < 0)
+ if (test_encode_decode(dapl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default DAPL encoding/decoding failed\n")
PASSED();
TESTING("DAPL Encoding/Decoding");
- if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0)
+ if ((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(dapl, low, high, FALSE) < 0)
+ if (test_encode_decode(dapl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(dapl)) < 0)
+ if ((H5Pclose(dapl)) < 0)
FAIL_STACK_ERROR
- PASSED();
+ PASSED();
/******* ENCODE/DECODE OCPLS *****/
TESTING("Default OCPL Encoding/Decoding");
- if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
+ if ((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(ocpl, low, high, FALSE) < 0)
+ if (test_encode_decode(ocpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n")
PASSED();
TESTING("OCPL Encoding/Decoding");
- if((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ if ((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
FAIL_STACK_ERROR
- if((H5Pset_attr_phase_change (ocpl, 110, 105)) < 0)
+ if ((H5Pset_attr_phase_change(ocpl, 110, 105)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_filter (ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
+ if ((H5Pset_filter(ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(ocpl, low, high, FALSE) < 0)
+ if (test_encode_decode(ocpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("OCPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(ocpl)) < 0)
+ if ((H5Pclose(ocpl)) < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE DXPLS *****/
TESTING("Default DXPL Encoding/Decoding");
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(dxpl, low, high, FALSE) < 0)
+ if (test_encode_decode(dxpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default DXPL encoding/decoding failed\n")
PASSED();
TESTING("DXPL Encoding/Decoding");
- if((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0)
+ if ((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_hyper_vector_size(dxpl, 5)) < 0)
+ if ((H5Pset_hyper_vector_size(dxpl, 5)) < 0)
FAIL_STACK_ERROR
#ifdef H5_HAVE_PARALLEL
- if((H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE)) < 0)
+ if ((H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
+ if ((H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
+ if ((H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30)) < 0)
+ if ((H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40)) < 0)
+ if ((H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40)) < 0)
FAIL_STACK_ERROR
-#endif/* H5_HAVE_PARALLEL */
- if((H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)) < 0)
+#endif /* H5_HAVE_PARALLEL */
+ if ((H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_data_transform(dxpl, c_to_f)) < 0)
+ if ((H5Pset_data_transform(dxpl, c_to_f)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(dxpl, low, high, FALSE) < 0)
+ if (test_encode_decode(dxpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("DXPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(dxpl)) < 0)
+ if ((H5Pclose(dxpl)) < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE GCPLS *****/
TESTING("Default GCPL Encoding/Decoding");
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ if ((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(gcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(gcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n")
PASSED();
TESTING("GCPL Encoding/Decoding");
- if((H5Pset_local_heap_size_hint(gcpl, 256)) < 0)
+ if ((H5Pset_local_heap_size_hint(gcpl, 256)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_link_phase_change(gcpl, 2, 2)) < 0)
+ if ((H5Pset_link_phase_change(gcpl, 2, 2)) < 0)
FAIL_STACK_ERROR
/* Query the group creation properties */
- if((H5Pget_link_phase_change(gcpl, &max_compact, &min_dense)) < 0)
+ if ((H5Pget_link_phase_change(gcpl, &max_compact, &min_dense)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_est_link_info(gcpl, 3, 9)) < 0)
+ if ((H5Pset_est_link_info(gcpl, 3, 9)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ if ((H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(gcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(gcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(gcpl)) < 0)
+ if ((H5Pclose(gcpl)) < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE LCPLS *****/
TESTING("Default LCPL Encoding/Decoding");
- if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(lcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(lcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default LCPL encoding/decoding failed\n")
PASSED();
TESTING("LCPL Encoding/Decoding");
- if((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0)
+ if ((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(lcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(lcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(lcpl)) < 0)
+ if ((H5Pclose(lcpl)) < 0)
FAIL_STACK_ERROR
PASSED();
-
/******* ENCODE/DECODE LAPLS *****/
TESTING("Default LAPL Encoding/Decoding");
- if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ if ((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(lapl, low, high, FALSE) < 0)
+ if (test_encode_decode(lapl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default LAPL encoding/decoding failed\n")
PASSED();
TESTING("LAPL Encoding/Decoding");
- if((H5Pset_nlinks(lapl, (size_t)134)) < 0)
+ if ((H5Pset_nlinks(lapl, (size_t)134)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY)) < 0)
+ if ((H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_elink_prefix(lapl, "/tmpasodiasod")) < 0)
+ if ((H5Pset_elink_prefix(lapl, "/tmpasodiasod")) < 0)
FAIL_STACK_ERROR
/* Create FAPL for the elink FAPL */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_alignment(fapl, 2, 1024)) < 0)
+ if ((H5Pset_alignment(fapl, 2, 1024)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_elink_fapl(lapl, fapl)) < 0)
+ if ((H5Pset_elink_fapl(lapl, fapl)) < 0)
FAIL_STACK_ERROR
/* Close the elink's FAPL */
- if((H5Pclose(fapl)) < 0)
+ if ((H5Pclose(fapl)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(lapl, low, high, FALSE) < 0)
+ if (test_encode_decode(lapl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(lapl)) < 0)
+ if ((H5Pclose(lapl)) < 0)
FAIL_STACK_ERROR
PASSED();
-
/******* ENCODE/DECODE OCPYPLS *****/
TESTING("Default OCPYPL Encoding/Decoding");
- if((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ if ((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(ocpypl, low, high, FALSE) < 0)
+ if (test_encode_decode(ocpypl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default OCPYPL encoding/decoding failed\n")
PASSED();
TESTING("OCPYPL Encoding/Decoding");
- if((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0)
+ if ((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0)
FAIL_STACK_ERROR
- if((H5Padd_merge_committed_dtype_path(ocpypl, "foo")) < 0)
+ if ((H5Padd_merge_committed_dtype_path(ocpypl, "foo")) < 0)
FAIL_STACK_ERROR
- if((H5Padd_merge_committed_dtype_path(ocpypl, "bar")) < 0)
+ if ((H5Padd_merge_committed_dtype_path(ocpypl, "bar")) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(ocpypl, low, high, FALSE) < 0)
+ if (test_encode_decode(ocpypl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(ocpypl)) < 0)
+ if ((H5Pclose(ocpypl)) < 0)
FAIL_STACK_ERROR
PASSED();
- /******* ENCODE/DECODE FAPLS *****/
+ /******* ENCODE/DECODE FAPLS *****/
TESTING("Default FAPL Encoding/Decoding");
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(fapl, low, high, FALSE) < 0)
+ if (test_encode_decode(fapl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default FAPL encoding/decoding failed\n")
PASSED();
TESTING("FAPL Encoding/Decoding");
- if((H5Pset_family_offset(fapl, 1024)) < 0)
+ if ((H5Pset_family_offset(fapl, 1024)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_meta_block_size(fapl, 2098452)) < 0)
+ if ((H5Pset_meta_block_size(fapl, 2098452)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_sieve_buf_size(fapl, 1048576)) < 0)
+ if ((H5Pset_sieve_buf_size(fapl, 1048576)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_alignment(fapl, 2, 1024)) < 0)
+ if ((H5Pset_alignment(fapl, 2, 1024)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0)
+ if ((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0)
+ if ((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_gc_references(fapl, 1)) < 0)
+ if ((H5Pset_gc_references(fapl, 1)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_small_data_block_size(fapl, 2048)) < 0)
+ if ((H5Pset_small_data_block_size(fapl, 2048)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
+ if ((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK)) < 0)
+ if ((H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_multi_type(fapl, H5FD_MEM_GHEAP)) < 0)
+ if ((H5Pset_multi_type(fapl, H5FD_MEM_GHEAP)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0)
+ if ((H5Pset_mdc_config(fapl, &my_cache_config)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_mdc_image_config(fapl, &my_cache_image_config)) < 0)
+ if ((H5Pset_mdc_image_config(fapl, &my_cache_image_config)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(fapl, low, high, FALSE) < 0)
+ if (test_encode_decode(fapl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("FAPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(fapl)) < 0)
+ if ((H5Pclose(fapl)) < 0)
FAIL_STACK_ERROR
PASSED();
-
/******* ENCODE/DECODE FCPLS *****/
TESTING("Default FCPL Encoding/Decoding");
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(fcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(fcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default FCPL encoding/decoding failed\n")
PASSED();
TESTING("FCPL Encoding/Decoding");
- if((H5Pset_userblock(fcpl, 1024) < 0))
+ if ((H5Pset_userblock(fcpl, 1024) < 0))
FAIL_STACK_ERROR
- if((H5Pset_istore_k(fcpl, 3) < 0))
+ if ((H5Pset_istore_k(fcpl, 3) < 0))
FAIL_STACK_ERROR
- if((H5Pset_sym_k(fcpl, 4, 5) < 0))
+ if ((H5Pset_sym_k(fcpl, 4, 5) < 0))
FAIL_STACK_ERROR
- if((H5Pset_shared_mesg_nindexes(fcpl, 8) < 0))
+ if ((H5Pset_shared_mesg_nindexes(fcpl, 8) < 0))
FAIL_STACK_ERROR
- if((H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
+ if ((H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
FAIL_STACK_ERROR
- if((H5Pset_shared_mesg_phase_change(fcpl, 60, 20) < 0))
+ if ((H5Pset_shared_mesg_phase_change(fcpl, 60, 20) < 0))
FAIL_STACK_ERROR
- if((H5Pset_sizes(fcpl, 8, 4) < 0))
+ if ((H5Pset_sizes(fcpl, 8, 4) < 0))
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(fcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(fcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(fcpl)) < 0)
+ if ((H5Pclose(fcpl)) < 0)
FAIL_STACK_ERROR
PASSED();
-
/******* ENCODE/DECODE STRCPLS *****/
TESTING("Default STRCPL Encoding/Decoding");
- if((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0)
+ if ((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(strcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(strcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default STRCPL encoding/decoding failed\n")
PASSED();
TESTING("STRCPL Encoding/Decoding");
- if((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0))
+ if ((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0))
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(strcpl, low, high, FALSE) < 0)
+ if (test_encode_decode(strcpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(strcpl)) < 0)
+ if ((H5Pclose(strcpl)) < 0)
FAIL_STACK_ERROR
PASSED();
-
/******* ENCODE/DECODE ACPLS *****/
TESTING("Default ACPL Encoding/Decoding");
- if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
+ if ((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Test encoding & decoding default property list */
- if(test_encode_decode(acpl, low, high, FALSE) < 0)
+ if (test_encode_decode(acpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("Default ACPL encoding/decoding failed\n")
PASSED();
TESTING("ACPL Encoding/Decoding");
- if((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0))
+ if ((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0))
FAIL_STACK_ERROR
/* Test encoding & decoding property list */
- if(test_encode_decode(acpl, low, high, FALSE) < 0)
+ if (test_encode_decode(acpl, low, high, FALSE) < 0)
FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n")
/* release resource */
- if((H5Pclose(acpl)) < 0)
+ if ((H5Pclose(acpl)) < 0)
FAIL_STACK_ERROR
PASSED();
} /* end high */
- } /* end low */
+ } /* end low */
return 0;
error:
-HDprintf("***** Plist Encode/Decode tests FAILED! *****\n");
+ HDprintf("***** Plist Encode/Decode tests FAILED! *****\n");
return 1;
}
-
diff --git a/test/enc_dec_plist_cross_platform.c b/test/enc_dec_plist_cross_platform.c
index f54f675..14c58b7 100644
--- a/test/enc_dec_plist_cross_platform.c
+++ b/test/enc_dec_plist_cross_platform.c
@@ -18,135 +18,135 @@
#include "h5test.h"
#include "H5srcdir.h"
-#define CONFIG_LE 0x01
-#define CONFIG_64 0x02
-#define NCONFIG 0x04
+#define CONFIG_LE 0x01
+#define CONFIG_64 0x02
+#define NCONFIG 0x04
static int test_plists(const char *filename_prefix);
int
main(void)
{
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("Encode/Decode property list endianess\n");
/******* ENCODE/DECODE DCPLS *****/
TESTING("Default DCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_dcpl_") < 0)
+ if (test_plists("testfiles/plist_files/def_dcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("DCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/dcpl_") < 0)
+ if (test_plists("testfiles/plist_files/dcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE DAPLS *****/
TESTING("Default DAPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_dapl_") < 0)
+ if (test_plists("testfiles/plist_files/def_dapl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("DAPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/dapl_") < 0)
+ if (test_plists("testfiles/plist_files/dapl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE DXPLS *****/
TESTING("Default DXPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_dxpl_") < 0)
+ if (test_plists("testfiles/plist_files/def_dxpl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("DXPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/dxpl_") < 0)
+ if (test_plists("testfiles/plist_files/dxpl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE GCPLS *****/
TESTING("Default GCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_gcpl_") < 0)
+ if (test_plists("testfiles/plist_files/def_gcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("GCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/gcpl_") < 0)
+ if (test_plists("testfiles/plist_files/gcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE LCPLS *****/
TESTING("Default LCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_lcpl_") < 0)
+ if (test_plists("testfiles/plist_files/def_lcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("LCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/lcpl_") < 0)
+ if (test_plists("testfiles/plist_files/lcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE LAPLS *****/
TESTING("Default LAPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_lapl_") < 0)
+ if (test_plists("testfiles/plist_files/def_lapl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("LAPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/lapl_") < 0)
+ if (test_plists("testfiles/plist_files/lapl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE OCPLS *****/
TESTING("Default OCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_ocpl_") < 0)
+ if (test_plists("testfiles/plist_files/def_ocpl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("OCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/ocpl_") < 0)
+ if (test_plists("testfiles/plist_files/ocpl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE OCPYPLS *****/
TESTING("Default OCPYPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_ocpypl_") < 0)
+ if (test_plists("testfiles/plist_files/def_ocpypl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("OCPYPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/ocpypl_") < 0)
+ if (test_plists("testfiles/plist_files/ocpypl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE FCPLS *****/
TESTING("Default FCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_fcpl_") < 0)
+ if (test_plists("testfiles/plist_files/def_fcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("FCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/fcpl_") < 0)
+ if (test_plists("testfiles/plist_files/fcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE FAPLS *****/
TESTING("Default FAPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_fapl_") < 0)
+ if (test_plists("testfiles/plist_files/def_fapl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("FAPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/fapl_") < 0)
+ if (test_plists("testfiles/plist_files/fapl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE STRCPLS *****/
TESTING("Default STRCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_strcpl_") < 0)
+ if (test_plists("testfiles/plist_files/def_strcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("STRCPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/strcpl_") < 0)
+ if (test_plists("testfiles/plist_files/strcpl_") < 0)
FAIL_STACK_ERROR
PASSED();
/******* ENCODE/DECODE ACPLS *****/
TESTING("Default ACPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/def_acpl_") < 0)
+ if (test_plists("testfiles/plist_files/def_acpl_") < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("ACPL Encoding/Decoding");
- if(test_plists("testfiles/plist_files/acpl_") < 0)
+ if (test_plists("testfiles/plist_files/acpl_") < 0)
FAIL_STACK_ERROR
PASSED();
@@ -159,65 +159,63 @@ error:
static int
test_plists(const char *filename_prefix)
{
- unsigned config_1, config_2;
- int fd_1, fd_2;
- size_t size_1 = 0, size_2 = 0;
- void *buf_1 = NULL, *buf_2 = NULL;
- hid_t plist_1, plist_2;
- char filename[1024];
+ unsigned config_1, config_2;
+ int fd_1, fd_2;
+ size_t size_1 = 0, size_2 = 0;
+ void * buf_1 = NULL, *buf_2 = NULL;
+ hid_t plist_1, plist_2;
+ char filename[1024];
const char *testfile;
/* Iterate over all combinations of configurations */
- for(config_1 = 0; config_1 < (NCONFIG - 1); config_1++)
- for(config_2 = config_1 + 1; config_2 < NCONFIG; config_2++) {
+ for (config_1 = 0; config_1 < (NCONFIG - 1); config_1++)
+ for (config_2 = config_1 + 1; config_2 < NCONFIG; config_2++) {
/* Generate filename for file 1 */
- if(HDsnprintf(filename, sizeof(filename), "%s%s%s", filename_prefix,
- config_1 & CONFIG_64 ? "64" : "32",
- config_1 & CONFIG_LE ? "le" : "be") < 0)
+ if (HDsnprintf(filename, sizeof(filename), "%s%s%s", filename_prefix,
+ config_1 & CONFIG_64 ? "64" : "32", config_1 & CONFIG_LE ? "le" : "be") < 0)
TEST_ERROR
/* Read file 1 */
testfile = H5_get_srcdir_filename(filename);
- if((fd_1 = HDopen(testfile, O_RDONLY)) < 0)
+ if ((fd_1 = HDopen(testfile, O_RDONLY)) < 0)
TEST_ERROR
size_1 = (size_t)HDlseek(fd_1, (HDoff_t)0, SEEK_END);
HDlseek(fd_1, (HDoff_t)0, SEEK_SET);
buf_1 = (void *)HDmalloc(size_1);
- if(HDread(fd_1, buf_1, size_1) < 0)
+ if (HDread(fd_1, buf_1, size_1) < 0)
TEST_ERROR
HDclose(fd_1);
/* Generate filename for file 2 */
- if(HDsnprintf(filename, sizeof(filename), "%s%s%s", filename_prefix,
- config_2 & CONFIG_64 ? "64" : "32",
- config_2 & CONFIG_LE ? "le" : "be") < 0)
+ if (HDsnprintf(filename, sizeof(filename), "%s%s%s", filename_prefix,
+ config_2 & CONFIG_64 ? "64" : "32", config_2 & CONFIG_LE ? "le" : "be") < 0)
TEST_ERROR
/* Read file 1 */
testfile = H5_get_srcdir_filename(filename);
- if((fd_2 = HDopen(testfile, O_RDONLY)) < 0)
+ if ((fd_2 = HDopen(testfile, O_RDONLY)) < 0)
TEST_ERROR
size_2 = (size_t)HDlseek(fd_2, (HDoff_t)0, SEEK_END);
HDlseek(fd_2, (HDoff_t)0, SEEK_SET);
buf_2 = (void *)HDmalloc(size_2);
- if(HDread(fd_2, buf_2, size_2) < 0)
+ if (HDread(fd_2, buf_2, size_2) < 0)
TEST_ERROR
HDclose(fd_2);
/* Decode property lists */
- if((plist_1 = H5Pdecode(buf_1)) < 0)
+ if ((plist_1 = H5Pdecode(buf_1)) < 0)
FAIL_STACK_ERROR
- if((plist_2 = H5Pdecode(buf_2)) < 0)
+ if ((plist_2 = H5Pdecode(buf_2)) < 0)
FAIL_STACK_ERROR
/* Compare decoded property lists */
- if(!H5Pequal(plist_1, plist_2))
+ if (!H5Pequal(plist_1, plist_2))
FAIL_PUTS_ERROR("PLIST encoding/decoding comparison failed\n")
/* Close */
- if((H5Pclose(plist_1)) < 0)
+ if ((H5Pclose(plist_1)) < 0)
FAIL_STACK_ERROR
- if((H5Pclose(plist_2)) < 0)
+ if ((H5Pclose(plist_2)) < 0)
FAIL_STACK_ERROR
HDfree(buf_1);
@@ -230,4 +228,3 @@ error:
HDprintf("***** Plist Encode/Decode tests FAILED! *****\n");
return -1;
}
-
diff --git a/test/enum.c b/test/enum.c
index 1933ce1..eafce72 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -16,22 +16,12 @@
* Tuesday, December 22, 1998
*/
#include "h5test.h"
-#define CPTR(VAR,CONST) ((VAR)=(CONST),&(VAR))
-
-const char *FILENAME[] = {
- "enum1",
- NULL
-};
-
-typedef enum {
- E1_RED,
- E1_GREEN,
- E1_BLUE,
- E1_WHITE,
- E1_BLACK
-} c_e1;
-
-
+#define CPTR(VAR, CONST) ((VAR) = (CONST), &(VAR))
+
+const char *FILENAME[] = {"enum1", NULL};
+
+typedef enum { E1_RED, E1_GREEN, E1_BLUE, E1_WHITE, E1_BLACK } c_e1;
+
/*-------------------------------------------------------------------------
* Function: test_named
*
@@ -51,61 +41,90 @@ typedef enum {
static int
test_named(hid_t file)
{
- hid_t type = -1, cwg = -1;
- c_e1 val;
- signed char val8;
+ hid_t type = -1, cwg = -1;
+ c_e1 val;
+ signed char val8;
TESTING("named enumeration types");
- if((cwg = H5Gcreate2(file, "test_named", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((cwg = H5Gcreate2(file, "test_named", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* A native integer */
- if((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "RED", CPTR(val, E1_RED )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0) FAIL_STACK_ERROR
- if(H5Tcommit2(cwg, "e1_a", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
+ if ((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "RED", CPTR(val, E1_RED)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tcommit2(cwg, "e1_a", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
/* A smaller type */
- if((type = H5Tcreate(H5T_ENUM, (size_t)1)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "RED", CPTR(val8, E1_RED )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "GREEN", CPTR(val8, E1_GREEN)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLUE", CPTR(val8, E1_BLUE )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "WHITE", CPTR(val8, E1_WHITE)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLACK", CPTR(val8, E1_BLACK)) < 0) FAIL_STACK_ERROR
- if(H5Tcommit2(cwg, "e1_b", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
+ if ((type = H5Tcreate(H5T_ENUM, (size_t)1)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "RED", CPTR(val8, E1_RED)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "GREEN", CPTR(val8, E1_GREEN)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLUE", CPTR(val8, E1_BLUE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "WHITE", CPTR(val8, E1_WHITE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLACK", CPTR(val8, E1_BLACK)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tcommit2(cwg, "e1_b", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
/* A non-native type */
- if(H5T_ORDER_BE == H5Tget_order(H5T_NATIVE_INT)) {
- if ((type = H5Tenum_create(H5T_STD_U8LE)) < 0) FAIL_STACK_ERROR
- } else {
- if ((type = H5Tenum_create(H5T_STD_U8BE)) < 0) FAIL_STACK_ERROR
+ if (H5T_ORDER_BE == H5Tget_order(H5T_NATIVE_INT)) {
+ if ((type = H5Tenum_create(H5T_STD_U8LE)) < 0)
+ FAIL_STACK_ERROR
}
- if(H5Tenum_insert(type, "RED", CPTR(val8, E1_RED )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "GREEN", CPTR(val8, E1_GREEN)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLUE", CPTR(val8, E1_BLUE )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "WHITE", CPTR(val8, E1_WHITE)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLACK", CPTR(val8, E1_BLACK)) < 0) FAIL_STACK_ERROR
- if(H5Tcommit2(cwg, "e1_c", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
-
- if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR
+ else {
+ if ((type = H5Tenum_create(H5T_STD_U8BE)) < 0)
+ FAIL_STACK_ERROR
+ }
+ if (H5Tenum_insert(type, "RED", CPTR(val8, E1_RED)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "GREEN", CPTR(val8, E1_GREEN)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLUE", CPTR(val8, E1_BLUE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "WHITE", CPTR(val8, E1_WHITE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLACK", CPTR(val8, E1_BLACK)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tcommit2(cwg, "e1_c", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
+
+ if (H5Gclose(cwg) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Tclose(type);
- H5Gclose(cwg);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(type);
+ H5Gclose(cwg);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_conv
*
@@ -126,140 +145,162 @@ test_named(hid_t file)
static int
test_conv(hid_t file)
{
- hid_t cwg=-1, type=-1, space=-1, dset=-1;
- c_e1 val;
+ hid_t cwg = -1, type = -1, space = -1, dset = -1;
+ c_e1 val;
/* Some values are out of range for testing. The library should accept them */
- static c_e1 data1[]={E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
- E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED,
- E1_RED, E1_BLUE, E1_GREEN, E1_BLACK, E1_WHITE,
- E1_RED, E1_WHITE, (c_e1)0, (c_e1)-1, (c_e1)-2};
- c_e1 data2[NELMTS(data1)];
- short data_short[NELMTS(data1)];
- int data_int[NELMTS(data1)];
- double data_double[NELMTS(data1)];
- hsize_t ds_size[1]={NELMTS(data1)};
- size_t i;
+ static c_e1 data1[] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, E1_WHITE, E1_BLACK,
+ E1_GREEN, E1_BLUE, E1_RED, E1_RED, E1_BLUE, E1_GREEN, E1_BLACK,
+ E1_WHITE, E1_RED, E1_WHITE, (c_e1)0, (c_e1)-1, (c_e1)-2};
+ c_e1 data2[NELMTS(data1)];
+ short data_short[NELMTS(data1)];
+ int data_int[NELMTS(data1)];
+ double data_double[NELMTS(data1)];
+ hsize_t ds_size[1] = {NELMTS(data1)};
+ size_t i;
TESTING("enumeration conversions");
- if((cwg = H5Gcreate2(file, "test_conv", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- if((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "RED", CPTR(val, E1_RED )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0) FAIL_STACK_ERROR
-
- if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR
+ if ((cwg = H5Gcreate2(file, "test_conv", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ if ((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "RED", CPTR(val, E1_RED)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0)
+ FAIL_STACK_ERROR
+
+ if ((space = H5Screate_simple(1, ds_size, NULL)) < 0)
+ FAIL_STACK_ERROR
/***************************************
* Dataset of enumeration type
***************************************/
/* Create a dataset of enum type and write enum data to it */
- if((dset = H5Dcreate2(cwg, "color_table1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR
+ if ((dset = H5Dcreate2(cwg, "color_table1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0)
+ FAIL_STACK_ERROR
/* Test reading back the data with no conversion */
- if(H5Dread(dset, type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dset, type, space, space, H5P_DEFAULT, data2) < 0)
+ FAIL_STACK_ERROR
- for(i = 0; i < (size_t)ds_size[0]; i++)
- if(data1[i] != data2[i]) {
- H5_FAILED();
- HDprintf(" 1. data1[%lu]=%d, data2[%lu]=%d (should be same)\n",
- (unsigned long)i, (int)(data1[i]),
- (unsigned long)i, (int)(data2[i]));
- goto error;
- } /* end if */
+ for (i = 0; i < (size_t)ds_size[0]; i++)
+ if (data1[i] != data2[i]) {
+ H5_FAILED();
+ HDprintf(" 1. data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i,
+ (int)(data1[i]), (unsigned long)i, (int)(data2[i]));
+ goto error;
+ } /* end if */
/* Test converting the data to integer. Read enum data back as integer */
- if(H5Dread(dset, H5T_NATIVE_SHORT, space, space, H5P_DEFAULT, data_short) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dset, H5T_NATIVE_SHORT, space, space, H5P_DEFAULT, data_short) < 0)
+ FAIL_STACK_ERROR
- for(i = 0; i < (size_t)ds_size[0]; i++)
- if((short)data1[i] != data_short[i]) {
- H5_FAILED();
- HDprintf(" 2. data1[%lu]=%d, data_short[%lu]=%d (should be same)\n",
- (unsigned long)i, (int)(data1[i]),
- (unsigned long)i, (int)(data_short[i]));
- goto error;
- } /* end if */
+ for (i = 0; i < (size_t)ds_size[0]; i++)
+ if ((short)data1[i] != data_short[i]) {
+ H5_FAILED();
+ HDprintf(" 2. data1[%lu]=%d, data_short[%lu]=%d (should be same)\n", (unsigned long)i,
+ (int)(data1[i]), (unsigned long)i, (int)(data_short[i]));
+ goto error;
+ } /* end if */
/* Test converting the data to floating number. Read enum data back as floating number */
- if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0)
+ FAIL_STACK_ERROR
- for(i = 0; i < (size_t)ds_size[0]; i++)
- if((int)data1[i] != (int)data_double[i]) {
- H5_FAILED();
- HDprintf(" 3. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n",
- (unsigned long)i, (int)(data1[i]),
- (unsigned long)i, (int)(data_double[i]));
- goto error;
- } /* end if */
+ for (i = 0; i < (size_t)ds_size[0]; i++)
+ if ((int)data1[i] != (int)data_double[i]) {
+ H5_FAILED();
+ HDprintf(" 3. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", (unsigned long)i,
+ (int)(data1[i]), (unsigned long)i, (int)(data_double[i]));
+ goto error;
+ } /* end if */
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
/***************************************
* Dataset of integer type
***************************************/
/* Create a dataset of native integer and write enum data to it */
- if((dset = H5Dcreate2(cwg, "color_table2", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dset = H5Dcreate2(cwg, "color_table2", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- if(H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0)
+ FAIL_STACK_ERROR
/* Test reading back the data with no conversion */
- if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, data_int) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, data_int) < 0)
+ FAIL_STACK_ERROR
- for(i = 0; i < (size_t)ds_size[0]; i++)
- if((int)data1[i] != data_int[i]) {
- H5_FAILED();
- HDprintf(" 4. data1[%lu]=%d, data_int[%lu]=%d (should be same)\n",
- (unsigned long)i, (int)(data1[i]),
- (unsigned long)i, (int)(data_int[i]));
- goto error;
- } /* end if */
+ for (i = 0; i < (size_t)ds_size[0]; i++)
+ if ((int)data1[i] != data_int[i]) {
+ H5_FAILED();
+ HDprintf(" 4. data1[%lu]=%d, data_int[%lu]=%d (should be same)\n", (unsigned long)i,
+ (int)(data1[i]), (unsigned long)i, (int)(data_int[i]));
+ goto error;
+ } /* end if */
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
/***************************************
* Dataset of double type
***************************************/
/* Create a dataset of native double and write enum data to it */
- if((dset = H5Dcreate2(cwg, "color_table3", H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dset = H5Dcreate2(cwg, "color_table3", H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- if(H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0)
+ FAIL_STACK_ERROR
/* Test reading back the data with no conversion */
- if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0) FAIL_STACK_ERROR
+ if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0)
+ FAIL_STACK_ERROR
- for(i = 0; i < (size_t)ds_size[0]; i++)
- if((int)data1[i] != (int)data_double[i]) {
- H5_FAILED();
- HDprintf(" 5. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n",
- (unsigned long)i, (int)(data1[i]),
- (unsigned long)i, (int)(data_double[i]));
- goto error;
- } /* end if */
+ for (i = 0; i < (size_t)ds_size[0]; i++)
+ if ((int)data1[i] != (int)data_double[i]) {
+ H5_FAILED();
+ HDprintf(" 5. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", (unsigned long)i,
+ (int)(data1[i]), (unsigned long)i, (int)(data_double[i]));
+ goto error;
+ } /* end if */
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
- if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(cwg) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Dclose(dset);
- H5Sclose(space);
- H5Tclose(type);
- H5Gclose(cwg);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Tclose(type);
+ H5Gclose(cwg);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_tr1
*
@@ -282,70 +323,91 @@ test_conv(hid_t file)
static int
test_tr1(hid_t file)
{
- hid_t cwg = -1, m_type = -1, f_type = -1, space = -1, dset = -1;
- hsize_t ds_size[1] = {10};
- size_t i;
- c_e1 eval;
- int ival;
- static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
- E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
- c_e1 data2[10];
+ hid_t cwg = -1, m_type = -1, f_type = -1, space = -1, dset = -1;
+ hsize_t ds_size[1] = {10};
+ size_t i;
+ c_e1 eval;
+ int ival;
+ static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
+ E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
+ c_e1 data2[10];
TESTING("O(1) conversions");
- if((cwg = H5Gcreate2(file, "test_tr1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "RED", CPTR(eval, E1_RED )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "GREEN", CPTR(eval, E1_GREEN)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "BLUE", CPTR(eval, E1_BLUE )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "WHITE", CPTR(eval, E1_WHITE)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "BLACK", CPTR(eval, E1_BLACK)) < 0) FAIL_STACK_ERROR
-
-
- if((f_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "RED", CPTR(ival, 105)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "GREEN", CPTR(ival, 104)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "BLUE", CPTR(ival, 103)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "WHITE", CPTR(ival, 102)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "BLACK", CPTR(ival, 101)) < 0) FAIL_STACK_ERROR
-
- if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR
- if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR
- if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR
-
- for(i = 0; i < (size_t)ds_size[0]; i++)
- if(data1[i] != data2[i]) {
+ if ((cwg = H5Gcreate2(file, "test_tr1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ if ((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "RED", CPTR(eval, E1_RED)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "GREEN", CPTR(eval, E1_GREEN)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "BLUE", CPTR(eval, E1_BLUE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "WHITE", CPTR(eval, E1_WHITE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "BLACK", CPTR(eval, E1_BLACK)) < 0)
+ FAIL_STACK_ERROR
+
+ if ((f_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "RED", CPTR(ival, 105)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "GREEN", CPTR(ival, 104)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "BLUE", CPTR(ival, 103)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "WHITE", CPTR(ival, 102)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "BLACK", CPTR(ival, 101)) < 0)
+ FAIL_STACK_ERROR
+
+ if ((space = H5Screate_simple(1, ds_size, NULL)) < 0)
+ FAIL_STACK_ERROR
+ if ((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0)
+ FAIL_STACK_ERROR
+
+ for (i = 0; i < (size_t)ds_size[0]; i++)
+ if (data1[i] != data2[i]) {
H5_FAILED();
- HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n",
- (unsigned long)i, (int)(data1[i]),
- (unsigned long)i, (int)(data2[i]));
+ HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]),
+ (unsigned long)i, (int)(data2[i]));
goto error;
}
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR
- if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR
- if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(m_type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(f_type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(cwg) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(space);
H5Tclose(m_type);
H5Tclose(f_type);
H5Gclose(cwg);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_tr2
*
@@ -365,69 +427,91 @@ error:
static int
test_tr2(hid_t file)
{
- hid_t cwg = -1, m_type = -1, f_type = -1, space = -1, dset = -1;
- hsize_t ds_size[1] = {10};
- size_t i;
- c_e1 val1;
- int val2;
- static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
- E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
- c_e1 data2[10];
+ hid_t cwg = -1, m_type = -1, f_type = -1, space = -1, dset = -1;
+ hsize_t ds_size[1] = {10};
+ size_t i;
+ c_e1 val1;
+ int val2;
+ static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
+ E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
+ c_e1 data2[10];
TESTING("O(log N) conversions");
- if((cwg = H5Gcreate2(file, "test_tr2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "RED", CPTR(val1, E1_RED )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "GREEN", CPTR(val1, E1_GREEN)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "BLUE", CPTR(val1, E1_BLUE )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "WHITE", CPTR(val1, E1_WHITE)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(m_type, "BLACK", CPTR(val1, E1_BLACK)) < 0) FAIL_STACK_ERROR
-
- if((f_type = H5Tcreate(H5T_ENUM, sizeof(int))) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "RED", CPTR(val2, 1050)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "GREEN", CPTR(val2, 1040)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "BLUE", CPTR(val2, 1030)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "WHITE", CPTR(val2, 1020)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(f_type, "BLACK", CPTR(val2, 1010)) < 0) FAIL_STACK_ERROR
-
- if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR
- if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR
- if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR
-
- for(i = 0; i < (size_t)ds_size[0]; i++)
- if(data1[i] != data2[i]) {
+ if ((cwg = H5Gcreate2(file, "test_tr2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ if ((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "RED", CPTR(val1, E1_RED)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "GREEN", CPTR(val1, E1_GREEN)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "BLUE", CPTR(val1, E1_BLUE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "WHITE", CPTR(val1, E1_WHITE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(m_type, "BLACK", CPTR(val1, E1_BLACK)) < 0)
+ FAIL_STACK_ERROR
+
+ if ((f_type = H5Tcreate(H5T_ENUM, sizeof(int))) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "RED", CPTR(val2, 1050)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "GREEN", CPTR(val2, 1040)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "BLUE", CPTR(val2, 1030)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "WHITE", CPTR(val2, 1020)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(f_type, "BLACK", CPTR(val2, 1010)) < 0)
+ FAIL_STACK_ERROR
+
+ if ((space = H5Screate_simple(1, ds_size, NULL)) < 0)
+ FAIL_STACK_ERROR
+ if ((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0)
+ FAIL_STACK_ERROR
+
+ for (i = 0; i < (size_t)ds_size[0]; i++)
+ if (data1[i] != data2[i]) {
H5_FAILED();
- HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n",
- (unsigned long)i, (int)(data1[i]),
- (unsigned long)i, (int)(data2[i]));
+ HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]),
+ (unsigned long)i, (int)(data2[i]));
goto error;
}
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR
- if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR
- if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(m_type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(f_type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(cwg) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(space);
H5Tclose(m_type);
H5Tclose(f_type);
H5Gclose(cwg);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_value_dsnt_exist
*
@@ -455,62 +539,74 @@ static int
test_value_dsnt_exist(void)
{
- hid_t datatype_id=(-1); /* identifiers */
- int val;
- char nam[100];
+ hid_t datatype_id = (-1); /* identifiers */
+ int val;
+ char nam[100];
size_t size = 100;
TESTING("for non-existing name and value");
/* Turn off error reporting since we expect failure in this test */
- if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) goto error;
+ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
+ goto error;
- if ((datatype_id = H5Tenum_create(H5T_NATIVE_INT))< 0) goto error;
+ if ((datatype_id = H5Tenum_create(H5T_NATIVE_INT)) < 0)
+ goto error;
/* These calls should fail, since no memebrs exist yet */
- if (H5Tenum_valueof(datatype_id, "SAX", &val) >= 0) goto error;
+ if (H5Tenum_valueof(datatype_id, "SAX", &val) >= 0)
+ goto error;
val = 3;
- if (H5Tenum_nameof(datatype_id, &val, nam, size) >= 0) goto error;
+ if (H5Tenum_nameof(datatype_id, &val, nam, size) >= 0)
+ goto error;
val = 2;
- if (H5Tenum_insert(datatype_id, "TWO", (int *)&val) < 0) goto error;
+ if (H5Tenum_insert(datatype_id, "TWO", (int *)&val) < 0)
+ goto error;
val = 6;
- if (H5Tenum_insert(datatype_id, "SIX", (int *)&val) < 0) goto error;
+ if (H5Tenum_insert(datatype_id, "SIX", (int *)&val) < 0)
+ goto error;
val = 10;
- if (H5Tenum_insert(datatype_id, "TEN", (int *)&val) < 0) goto error;
+ if (H5Tenum_insert(datatype_id, "TEN", (int *)&val) < 0)
+ goto error;
/* This call should fail since we did not create a member with value = 3*/
val = 3;
- if (H5Tenum_nameof(datatype_id, &val, nam, size) >= 0) goto error;
+ if (H5Tenum_nameof(datatype_id, &val, nam, size) >= 0)
+ goto error;
/* This call should fail since we did not create a member with value = 11*/
val = 11;
- if (H5Tenum_nameof(datatype_id, &val, nam, size) >= 0) goto error;
+ if (H5Tenum_nameof(datatype_id, &val, nam, size) >= 0)
+ goto error;
/* This call should fail since we did not create a member with value = 0*/
val = 0;
- if (H5Tenum_nameof(datatype_id, &val, nam, size) >= 0) goto error;
+ if (H5Tenum_nameof(datatype_id, &val, nam, size) >= 0)
+ goto error;
/* This call should fail since we do not have SAX name in the type */
- if (H5Tenum_valueof(datatype_id, "SAX", &val) >= 0) goto error;
+ if (H5Tenum_valueof(datatype_id, "SAX", &val) >= 0)
+ goto error;
/* This call should fail since we do not have TEEN name in the type */
- if (H5Tenum_valueof(datatype_id, "TEEN", &val) >= 0) goto error;
+ if (H5Tenum_valueof(datatype_id, "TEEN", &val) >= 0)
+ goto error;
/* This call should fail since we do not have A name in the type */
- if (H5Tenum_valueof(datatype_id, "A", &val) >= 0) goto error;
+ if (H5Tenum_valueof(datatype_id, "A", &val) >= 0)
+ goto error;
- if (H5Tclose(datatype_id) < 0) goto error;
+ if (H5Tclose(datatype_id) < 0)
+ goto error;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Tclose(datatype_id);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY { H5Tclose(datatype_id); }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_funcs
*
@@ -531,97 +627,101 @@ test_value_dsnt_exist(void)
static int
test_funcs(void)
{
- hid_t type=-1;
- c_e1 val;
- size_t size;
- H5T_pad_t inpad;
- H5T_cset_t cset;
- herr_t ret;
+ hid_t type = -1;
+ c_e1 val;
+ size_t size;
+ H5T_pad_t inpad;
+ H5T_cset_t cset;
+ herr_t ret;
TESTING("some functions with enumeration types");
/* A native integer */
- if((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "RED", CPTR(val, E1_RED )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE )) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE)) < 0) FAIL_STACK_ERROR
- if(H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0) FAIL_STACK_ERROR
-
- if(H5Tget_precision(type) == 0) FAIL_STACK_ERROR
- if(H5Tget_size(type) == 0) FAIL_STACK_ERROR
- if(H5Tget_offset(type) < 0) FAIL_STACK_ERROR
- if(H5Tget_sign(type) < 0) FAIL_STACK_ERROR
- if(H5Tget_super(type) < 0) FAIL_STACK_ERROR
-
- H5E_BEGIN_TRY {
- ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
- } H5E_END_TRY;
- if (ret>=0) {
+ if ((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "RED", CPTR(val, E1_RED)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0)
+ FAIL_STACK_ERROR
+
+ if (H5Tget_precision(type) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tget_size(type) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tget_offset(type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tget_sign(type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tget_super(type) < 0)
+ FAIL_STACK_ERROR
+
+ H5E_BEGIN_TRY { ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- size=H5Tget_ebias(type);
- } H5E_END_TRY;
- if (size>0) {
+ H5E_BEGIN_TRY { size = H5Tget_ebias(type); }
+ H5E_END_TRY;
+ if (size > 0) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- inpad=H5Tget_inpad(type);
- } H5E_END_TRY;
- if (inpad>-1) {
+ H5E_BEGIN_TRY { inpad = H5Tget_inpad(type); }
+ H5E_END_TRY;
+ if (inpad > -1) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- cset=H5Tget_cset(type);
- } H5E_END_TRY;
- if (cset>-1) {
+ H5E_BEGIN_TRY { cset = H5Tget_cset(type); }
+ H5E_END_TRY;
+ if (cset > -1) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
size = 16;
- H5E_BEGIN_TRY {
- ret=H5Tset_offset(type, (size_t)size);
- } H5E_END_TRY;
- if (ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_offset(type, (size_t)size); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- H5E_BEGIN_TRY {
- ret=H5Tset_order(type, H5T_ORDER_BE);
- } H5E_END_TRY;
- if (ret>=0) {
+ H5E_BEGIN_TRY { ret = H5Tset_order(type, H5T_ORDER_BE); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
HDprintf("Operation not allowed for this type.\n");
goto error;
} /* end if */
- if (H5Tclose(type)<0) goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Tclose(type);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY { H5Tclose(type); }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -641,16 +741,17 @@ test_funcs(void)
int
main(void)
{
- hid_t fapl=-1, file=-1;
- char name[1024];
- int nerrors=0;
+ hid_t fapl = -1, file = -1;
+ char name[1024];
+ int nerrors = 0;
h5_reset();
fapl = h5_fileaccess();
/* Create the file */
h5_fixname(FILENAME[0], fapl, name, sizeof name);
- if ((file=H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) goto error;
+ if ((file = H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
/* Tests */
nerrors += test_named(file);
@@ -665,12 +766,13 @@ main(void)
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if (nerrors) goto error;
+ if (nerrors)
+ goto error;
puts("All enum tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
- error:
+error:
puts("*** ENUM TESTS FAILED ***");
return 1;
}
diff --git a/test/err_compat.c b/test/err_compat.c
index eb86760..4f86153 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -20,32 +20,29 @@
#include "h5test.h"
#ifdef H5_NO_DEPRECATED_SYMBOLS
-int main(void)
+int
+main(void)
{
HDprintf("Test skipped because backward compatibility with v1.6 is NOT configured in\n");
return 0;
}
#else /* H5_NO_DEPRECATED_SYMBOLS */
-const char *FILENAME[] = {
- "errors_compat",
- NULL
-};
-
-#define DIM0 100
-#define DIM1 200
+const char *FILENAME[] = {"errors_compat", NULL};
-int **ipoints2 = NULL;
-int **icheck2 = NULL;
-int *ipoints2_data = NULL;
-int *icheck2_data = NULL;
+#define DIM0 100
+#define DIM1 200
-#define DSET_NAME "a_dataset"
-#define FAKE_ID (hid_t)-1
+int **ipoints2 = NULL;
+int **icheck2 = NULL;
+int * ipoints2_data = NULL;
+int * icheck2_data = NULL;
-herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data);
-herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data);
+#define DSET_NAME "a_dataset"
+#define FAKE_ID (hid_t) - 1
+herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void *client_data);
+herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void *client_data);
/*-------------------------------------------------------------------------
* Function: user_print1
@@ -66,17 +63,15 @@ user_print1(FILE *stream)
{
/* Customized way to print errors */
HDfprintf(stderr, "\n********* Print error stack in customized way *********\n");
- if(H5Ewalk1(H5E_WALK_UPWARD, (H5E_walk1_t)custom_print_cb1, stream) < 0)
+ if (H5Ewalk1(H5E_WALK_UPWARD, (H5E_walk1_t)custom_print_cb1, stream) < 0)
TEST_ERROR;
return 0;
- error:
+error:
return -1;
-
}
-
/*-------------------------------------------------------------------------
* Function: user_print2
*
@@ -96,17 +91,15 @@ user_print2(hid_t err_stack, FILE *stream)
{
/* Customized way to print errors */
HDfprintf(stderr, "\n********* Print error stack in customized way *********\n");
- if(H5Ewalk2(err_stack, H5E_WALK_UPWARD, (H5E_walk2_t)custom_print_cb2, stream) < 0)
+ if (H5Ewalk2(err_stack, H5E_WALK_UPWARD, (H5E_walk2_t)custom_print_cb2, stream) < 0)
TEST_ERROR;
return 0;
- error:
+error:
return -1;
-
}
-
/*-------------------------------------------------------------------------
* Function: custom_print_cb1
*
@@ -125,22 +118,21 @@ user_print2(hid_t err_stack, FILE *stream)
*-------------------------------------------------------------------------
*/
herr_t
-custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data)
+custom_print_cb1(int n, H5E_error1_t *err_desc, void *client_data)
{
- FILE *stream = (FILE *)client_data;
- char *maj = NULL;
- char *min = NULL;
- const int indent = 4;
+ FILE * stream = (FILE *)client_data;
+ char * maj = NULL;
+ char * min = NULL;
+ const int indent = 4;
- if(NULL == (min = H5Eget_minor(err_desc->min_num)))
+ if (NULL == (min = H5Eget_minor(err_desc->min_num)))
TEST_ERROR;
- if(NULL == (maj = H5Eget_major(err_desc->maj_num)))
+ if (NULL == (maj = H5Eget_major(err_desc->maj_num)))
TEST_ERROR;
- HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
- indent, "", n, err_desc->file_name,
- err_desc->func_name, err_desc->line);
+ HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", indent, "", n, err_desc->file_name,
+ err_desc->func_name, err_desc->line);
HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj);
HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min);
@@ -151,15 +143,14 @@ custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data)
return 0;
error:
- if(maj)
+ if (maj)
H5free_memory(maj);
- if(min)
+ if (min)
H5free_memory(min);
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: custom_print_cb2
*
@@ -178,22 +169,21 @@ error:
*-------------------------------------------------------------------------
*/
herr_t
-custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data)
+custom_print_cb2(int n, H5E_error2_t *err_desc, void *client_data)
{
- FILE *stream = (FILE *)client_data;
- char *maj = NULL;
- char *min = NULL;
- const int indent = 4;
+ FILE * stream = (FILE *)client_data;
+ char * maj = NULL;
+ char * min = NULL;
+ const int indent = 4;
- if(NULL == (min = H5Eget_minor(err_desc->min_num)))
+ if (NULL == (min = H5Eget_minor(err_desc->min_num)))
TEST_ERROR;
- if(NULL == (maj = H5Eget_major(err_desc->maj_num)))
+ if (NULL == (maj = H5Eget_major(err_desc->maj_num)))
TEST_ERROR;
- HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
- indent, "", n, err_desc->file_name,
- err_desc->func_name, err_desc->line);
+ HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", indent, "", n, err_desc->file_name,
+ err_desc->func_name, err_desc->line);
HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj);
HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min);
@@ -204,15 +194,14 @@ custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data)
return 0;
error:
- if(maj)
+ if (maj)
H5free_memory(maj);
- if(min)
+ if (min)
H5free_memory(min);
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_error1
*
@@ -233,12 +222,12 @@ error:
static herr_t
test_error1(void)
{
- hid_t dataset, space;
- hsize_t dims[2];
- H5E_auto1_t old_func1;
- H5E_auto2_t old_func2;
- void *old_data;
- herr_t ret;
+ hid_t dataset, space;
+ hsize_t dims[2];
+ H5E_auto1_t old_func1;
+ H5E_auto2_t old_func2;
+ void * old_data;
+ herr_t ret;
TESTING("error API H5Eset/get_auto");
HDfprintf(stderr, "\n");
@@ -246,105 +235,101 @@ test_error1(void)
/* Create the data space */
dims[0] = DIM0;
dims[1] = DIM1;
- if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
/* Use H5Eget_auto2 to query the default printing function. The library
*should indicate H5Eprint2 as the default. */
- if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data)<0)
- TEST_ERROR;
+ if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data) < 0)
+ TEST_ERROR;
if (old_data != NULL)
- TEST_ERROR;
+ TEST_ERROR;
if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2)
- TEST_ERROR;
+ TEST_ERROR;
/* This function sets the default printing function to be H5Eprint2. */
- if(H5Eset_auto2(H5E_DEFAULT, old_func2, old_data)<0)
+ if (H5Eset_auto2(H5E_DEFAULT, old_func2, old_data) < 0)
TEST_ERROR;
/* Try the printing function. Dataset creation should fail because the file
* doesn't exist. */
- dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- if(dataset >= 0)
+ dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dataset >= 0)
TEST_ERROR;
/* This call should work. It simply returns H5Eprint1. */
- if((ret = H5Eget_auto1(&old_func1, &old_data))<0)
+ if ((ret = H5Eget_auto1(&old_func1, &old_data)) < 0)
TEST_ERROR;
if (old_data != NULL)
- TEST_ERROR;
+ TEST_ERROR;
if (!old_func1 || (H5E_auto1_t)H5Eprint1 != old_func1)
- TEST_ERROR;
+ TEST_ERROR;
/* This function changes the old-style printing function to be user_print1. */
- if(H5Eset_auto1((H5E_auto1_t)user_print1, stderr)<0)
+ if (H5Eset_auto1((H5E_auto1_t)user_print1, stderr) < 0)
TEST_ERROR;
/* Try the printing function. Dataset creation should fail because the file
* doesn't exist. */
- dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- if(dataset >= 0)
+ dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dataset >= 0)
TEST_ERROR;
/* This call should fail because the test mixes H5Eget_auto2 with H5Eset_auto1.
* Once the H5Eset_auto1 is called with a user-defined printing function,
* a call to H5Eget_auto2 will fail. But keep in mind the printing function is
* user_print1. */
- if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))>=0)
+ if ((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data)) >= 0)
TEST_ERROR;
/* This function changes the new-style printing function to be user_print2. */
- if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)user_print2, stderr)<0)
+ if (H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)user_print2, stderr) < 0)
TEST_ERROR;
/* Try the printing function. Dataset creation should fail because the file
* doesn't exist. */
- dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- if(dataset >= 0)
+ dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dataset >= 0)
TEST_ERROR;
/* This function changes the new-style printing function back to the default H5Eprint2. */
- if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, NULL)<0)
+ if (H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, NULL) < 0)
TEST_ERROR;
/* This call should work because the H5Eset_auto2 above restored the default printing
* function H5Eprint2. It simply returns user_print1. */
- if((ret = H5Eget_auto1(&old_func1, &old_data))<0)
+ if ((ret = H5Eget_auto1(&old_func1, &old_data)) < 0)
TEST_ERROR;
if (old_data != NULL)
- TEST_ERROR;
+ TEST_ERROR;
if (!old_func1 || (H5E_auto1_t)user_print1 != old_func1)
- TEST_ERROR;
+ TEST_ERROR;
/* This function changes the new-style printing function back to the default H5Eprint1. */
- if(H5Eset_auto1((H5E_auto1_t)H5Eprint1, NULL)<0)
+ if (H5Eset_auto1((H5E_auto1_t)H5Eprint1, NULL) < 0)
TEST_ERROR;
/* This call should work because the H5Eset_auto1 above restored the default printing
* function H5Eprint1. It simply returns H5Eprint2. */
- if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))<0)
+ if ((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data)) < 0)
TEST_ERROR;
if (old_data != NULL)
- TEST_ERROR;
+ TEST_ERROR;
if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2)
- TEST_ERROR;
+ TEST_ERROR;
/* Try the printing function. Dataset creation should fail because the file
* doesn't exist. */
- dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- if(dataset >= 0)
+ dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dataset >= 0)
TEST_ERROR;
return 0;
- error:
+error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_error2
*
@@ -365,9 +350,9 @@ test_error1(void)
static herr_t
test_error2(hid_t file)
{
- hid_t dataset, space;
- hsize_t dims[2];
- const char *FUNC_test_error="test_error2";
+ hid_t dataset, space;
+ hsize_t dims[2];
+ const char *FUNC_test_error = "test_error2";
TESTING("error API based on data I/O");
HDfprintf(stderr, "\n");
@@ -375,46 +360,48 @@ test_error2(hid_t file)
/* Create the data space */
dims[0] = DIM0;
dims[1] = DIM1;
- if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
/* Test H5E_BEGIN_TRY */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Create the dataset */
- if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE,
- "H5Dcreate2 failed");
+ if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0) {
+ H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE, "H5Dcreate2 failed");
goto error;
}
/* Disable the library's default printing function */
#ifdef H5_USE_16_API_DEFAULT
- if(H5Eset_auto(NULL, NULL)<0)
+ if (H5Eset_auto(NULL, NULL) < 0)
#else
- if(H5Eset_auto(H5E_DEFAULT, NULL, NULL)<0)
+ if (H5Eset_auto(H5E_DEFAULT, NULL, NULL) < 0)
#endif
TEST_ERROR;
/* Make H5Dwrite fail, verify default print is disabled */
- if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0) {
+ if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) {
H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_WRITEERROR,
- "H5Dwrite shouldn't succeed");
+ "H5Dwrite shouldn't succeed");
goto error;
}
/* In case program comes to this point, close dataset */
- if(H5Dclose(dataset)<0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
TEST_ERROR;
- error:
+error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: dump_error
*
@@ -437,22 +424,20 @@ dump_error(void)
{
/* Print errors in library default way */
HDfprintf(stderr, "********* Print error stack in HDF5 default way *********\n");
- if(H5Eprint1(stderr) < 0)
+ if (H5Eprint1(stderr) < 0)
TEST_ERROR;
/* Customized way to print errors */
HDfprintf(stderr, "\n********* Print error stack in customized way *********\n");
- if(H5Ewalk1(H5E_WALK_UPWARD, custom_print_cb1, stderr) < 0)
+ if (H5Ewalk1(H5E_WALK_UPWARD, custom_print_cb1, stderr) < 0)
TEST_ERROR;
return 0;
- error:
+error:
return -1;
}
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -470,36 +455,36 @@ main(void)
{
hid_t file, fapl;
char filename[1024];
- const char *FUNC_main="main";
+ const char *FUNC_main = "main";
int i;
- HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n");
+ HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to "
+ "be some error messages\n");
fapl = h5_fileaccess();
/* Set up data arrays */
- if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ if (NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
TEST_ERROR;
- if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data))))
+ if (NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data))))
TEST_ERROR;
for (i = 0; i < DIM0; i++)
ipoints2[i] = ipoints2_data + (i * DIM1);
- if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ if (NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
TEST_ERROR;
- if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data))))
+ if (NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data))))
TEST_ERROR;
for (i = 0; i < DIM0; i++)
icheck2[i] = icheck2_data + (i * DIM1);
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR ;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* Test error stack */
/* Push an error onto error stack */
- H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE,
- "Error test failed");
+ H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE, "Error test failed");
/* Print out the errors on stack */
dump_error();
@@ -508,15 +493,16 @@ main(void)
H5Eclear1();
/* Test error API */
- if(test_error1() < 0) TEST_ERROR ;
+ if (test_error1() < 0)
+ TEST_ERROR;
- if(test_error2(file) < 0) {
- H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG,
- "Error test failed");
+ if (test_error2(file) < 0) {
+ H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG, "Error test failed");
H5Eprint1(stderr);
}
- if(H5Fclose(file) < 0) TEST_ERROR ;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
h5_clean_files(FILENAME, fapl);
HDfree(ipoints2);
@@ -537,4 +523,3 @@ error:
return 1;
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
diff --git a/test/error_test.c b/test/error_test.c
index 1408c46..bcb2ec4 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -21,68 +21,64 @@
#include "H5srcdir.h"
#ifdef H5_USE_16_API
-int main(void)
+int
+main(void)
{
HDfprintf(stderr, "Test skipped because backward compatibility with v1.6 is configured in\n");
return 0;
}
#else /* H5_USE_16_API */
-const char *FILENAME[] = {
- "errors",
- NULL
-};
+const char *FILENAME[] = {"errors", NULL};
#define DATAFILE "filter_error"
-#define DIM0 100
-#define DIM1 200
-
-int **ipoints2 = NULL;
-int **icheck2 = NULL;
-int *ipoints2_data = NULL;
-int *icheck2_data = NULL;
+#define DIM0 100
+#define DIM1 200
-hid_t ERR_CLS;
-hid_t ERR_CLS2;
-hid_t ERR_STACK;
+int **ipoints2 = NULL;
+int **icheck2 = NULL;
+int * ipoints2_data = NULL;
+int * icheck2_data = NULL;
-hid_t ERR_MAJ_TEST;
-hid_t ERR_MAJ_IO;
-hid_t ERR_MAJ_API;
+hid_t ERR_CLS;
+hid_t ERR_CLS2;
+hid_t ERR_STACK;
-hid_t ERR_MIN_SUBROUTINE;
-hid_t ERR_MIN_ERRSTACK;
-hid_t ERR_MIN_CREATE;
-hid_t ERR_MIN_WRITE;
-hid_t ERR_MIN_GETNUM;
+hid_t ERR_MAJ_TEST;
+hid_t ERR_MAJ_IO;
+hid_t ERR_MAJ_API;
-#define DSET_NAME "a_dataset"
-#define FAKE_ID (hid_t)0
+hid_t ERR_MIN_SUBROUTINE;
+hid_t ERR_MIN_ERRSTACK;
+hid_t ERR_MIN_CREATE;
+hid_t ERR_MIN_WRITE;
+hid_t ERR_MIN_GETNUM;
-#define ERR_CLS_NAME "Error Test"
-#define ERR_CLS2_NAME "Second Test"
-#define PROG_NAME "Error Program"
-#define PROG2_NAME "Second Program"
-#define PROG_VERS "1.0"
+#define DSET_NAME "a_dataset"
+#define FAKE_ID (hid_t)0
-#define ERR_MAJ_TEST_MSG "Error in test"
-#define ERR_MAJ_IO_MSG "Error in IO"
-#define ERR_MAJ_API_MSG "Error in API"
-#define ERR_MIN_SUBROUTINE_MSG "Error in subroutine"
-#define ERR_MIN_ERRSTACK_MSG "Error in error stack"
-#define ERR_MIN_CREATE_MSG "Error in H5Dcreate2"
-#define ERR_MIN_WRITE_MSG "Error in H5Dwrite"
-#define ERR_MIN_GETNUM_MSG "Error in H5Eget_num"
+#define ERR_CLS_NAME "Error Test"
+#define ERR_CLS2_NAME "Second Test"
+#define PROG_NAME "Error Program"
+#define PROG2_NAME "Second Program"
+#define PROG_VERS "1.0"
-#define MSG_SIZE 64
-#define LONG_DESC_SIZE 8192
+#define ERR_MAJ_TEST_MSG "Error in test"
+#define ERR_MAJ_IO_MSG "Error in IO"
+#define ERR_MAJ_API_MSG "Error in API"
+#define ERR_MIN_SUBROUTINE_MSG "Error in subroutine"
+#define ERR_MIN_ERRSTACK_MSG "Error in error stack"
+#define ERR_MIN_CREATE_MSG "Error in H5Dcreate2"
+#define ERR_MIN_WRITE_MSG "Error in H5Dwrite"
+#define ERR_MIN_GETNUM_MSG "Error in H5Eget_num"
-#define DSET_FILTER_NAME "dataset_with_filter"
+#define MSG_SIZE 64
+#define LONG_DESC_SIZE 8192
-static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc,
- void *client_data);
+#define DSET_FILTER_NAME "dataset_with_filter"
+static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data);
/*-------------------------------------------------------------------------
* Function: test_error
@@ -97,13 +93,13 @@ static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc,
static herr_t
test_error(hid_t file)
{
- hid_t dataset = -1;
- hid_t space = -1;
+ hid_t dataset = -1;
+ hid_t space = -1;
hid_t estack_id = -1;
- hsize_t dims[2];
- const char *FUNC_test_error = "test_error";
- H5E_auto2_t old_func;
- void *old_data = NULL;
+ hsize_t dims[2];
+ const char *FUNC_test_error = "test_error";
+ H5E_auto2_t old_func;
+ void * old_data = NULL;
HDfprintf(stderr, "\nTesting error API based on data I/O\n");
@@ -114,12 +110,15 @@ test_error(hid_t file)
TEST_ERROR;
/* Test H5E_BEGIN_TRY */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Create the dataset */
- if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0) {
H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE,
"H5Dcreate2 failed");
goto error;
@@ -133,7 +132,7 @@ test_error(hid_t file)
#ifdef H5_USE_16_API
if (old_func != (H5E_auto_t)H5Eprint)
TEST_ERROR;
-#else /* H5_USE_16_API */
+#else /* H5_USE_16_API */
if (old_func != (H5E_auto2_t)H5Eprint2)
TEST_ERROR;
#endif /* H5_USE_16_API */
@@ -163,16 +162,15 @@ test_error(hid_t file)
}
/* In case program comes to this point, close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR;
TEST_ERROR;
- error:
+error:
return -1;
} /* end test_error() */
-
/*-------------------------------------------------------------------------
* Function: init_error
*
@@ -186,10 +184,10 @@ test_error(hid_t file)
static herr_t
init_error(void)
{
- ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME) + 1;
- ssize_t msg_size = (ssize_t)HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1;
- char *cls_name = NULL;
- char *msg = NULL;
+ ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME) + 1;
+ ssize_t msg_size = (ssize_t)HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1;
+ char * cls_name = NULL;
+ char * msg = NULL;
H5E_type_t msg_type;
if (NULL == (cls_name = (char *)HDmalloc(HDstrlen(ERR_CLS_NAME) + 1)))
@@ -248,7 +246,6 @@ error:
return -1;
} /* end init_error() */
-
/*-------------------------------------------------------------------------
* Function: error_stack
*
@@ -262,8 +259,8 @@ error:
static herr_t
error_stack(void)
{
- ssize_t err_num;
- const char *FUNC_error_stack = "error_stack";
+ ssize_t err_num;
+ const char *FUNC_error_stack = "error_stack";
if ((err_num = H5Eget_num(H5E_DEFAULT)) < 0)
TEST_ERROR;
@@ -290,7 +287,6 @@ error:
return -1;
} /* end error_stack() */
-
/*-------------------------------------------------------------------------
* Function: long_desc_cb
*
@@ -304,7 +300,7 @@ error:
static herr_t
long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *client_data)
{
- char *real_desc = (char *)client_data;
+ char *real_desc = (char *)client_data;
if (err_desc->desc != NULL && HDstrcmp(err_desc->desc, real_desc) == 0)
return 0;
@@ -312,7 +308,6 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie
return -1;
} /* end long_desc_cb() */
-
/*-------------------------------------------------------------------------
* Function: test_long_desc
*
@@ -333,11 +328,11 @@ H5_GCC_DIAG_OFF("format-nonliteral")
static herr_t
test_long_desc(void)
{
- const char *format = "Testing very long description string, %s";
- char *long_desc = NULL;
- char *full_desc = NULL;
- size_t u;
- const char *test_FUNC = "test_long_desc";
+ const char *format = "Testing very long description string, %s";
+ char * long_desc = NULL;
+ char * full_desc = NULL;
+ size_t u;
+ const char *test_FUNC = "test_long_desc";
/* Allocate space for the error description info */
if (NULL == (long_desc = (char *)HDmalloc(LONG_DESC_SIZE)))
@@ -355,7 +350,8 @@ test_long_desc(void)
TEST_ERROR;
/* Push an error with a long description */
- if (H5Epush(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format, long_desc) < 0)
+ if (H5Epush(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format,
+ long_desc) < 0)
TEST_ERROR;
/* Create the string that should be in the description. Must use HDsnprintf here
@@ -386,7 +382,6 @@ error:
} /* end test_long_desc() */
H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: dump_error
*
@@ -416,7 +411,6 @@ error:
return -1;
} /* end dump_error() */
-
/*-------------------------------------------------------------------------
* Function: custom_print_cb
*
@@ -428,13 +422,13 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data)
+custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
{
- FILE *stream = (FILE *)client_data;
- char maj[MSG_SIZE];
- char min[MSG_SIZE];
- char cls[MSG_SIZE];
- const int indent = 4;
+ FILE * stream = (FILE *)client_data;
+ char maj[MSG_SIZE];
+ char min[MSG_SIZE];
+ char cls[MSG_SIZE];
+ const int indent = 4;
/* Get descriptions for the major and minor error numbers */
if (H5Eget_class_name(err_desc->cls_id, cls, MSG_SIZE) < 0)
@@ -446,9 +440,8 @@ custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data)
if (H5Eget_msg(err_desc->min_num, NULL, min, MSG_SIZE) < 0)
TEST_ERROR;
- HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
- indent, "", n, err_desc->file_name,
- err_desc->func_name, err_desc->line);
+ HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", indent, "", n, err_desc->file_name,
+ err_desc->func_name, err_desc->line);
HDfprintf(stream, "%*sclass: %s\n", indent * 2, "", cls);
HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj);
HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min);
@@ -459,7 +452,6 @@ error:
return -1;
} /* end custom_print_cb() */
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -473,10 +465,10 @@ error:
static herr_t
test_create(void)
{
- const char *err_func = "test_create"; /* Function name for pushing error */
- const char *err_msg = "Error message"; /* Error message for pushing error */
- ssize_t err_num; /* Number of errors on stack */
- hid_t estack_id = -1; /* Error stack ID */
+ const char *err_func = "test_create"; /* Function name for pushing error */
+ const char *err_msg = "Error message"; /* Error message for pushing error */
+ ssize_t err_num; /* Number of errors on stack */
+ hid_t estack_id = -1; /* Error stack ID */
/* Create an empty error stack */
if ((estack_id = H5Ecreate_stack()) < 0)
@@ -488,7 +480,8 @@ test_create(void)
TEST_ERROR
/* Push an error with a long description */
- if (H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0)
+ if (H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s",
+ err_msg) < 0)
TEST_ERROR;
/* Check the number of errors on stack */
@@ -506,7 +499,7 @@ test_create(void)
TEST_ERROR
/* Close error stack */
- if(H5Eclose_stack(estack_id) < 0)
+ if (H5Eclose_stack(estack_id) < 0)
TEST_ERROR
return 0;
@@ -528,14 +521,15 @@ error:
static herr_t
test_copy(void)
{
- const char *err_func = "test_copy"; /* Function name for pushing error */
- const char *err_msg = "Error message"; /* Error message for pushing error */
- ssize_t err_num; /* Number of errors on stack */
- hid_t estack_id = -1; /* Error stack ID */
- herr_t ret; /* Generic return value */
+ const char *err_func = "test_copy"; /* Function name for pushing error */
+ const char *err_msg = "Error message"; /* Error message for pushing error */
+ ssize_t err_num; /* Number of errors on stack */
+ hid_t estack_id = -1; /* Error stack ID */
+ herr_t ret; /* Generic return value */
/* Push an error with a long description */
- if (H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0)
+ if (H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s",
+ err_msg) < 0)
TEST_ERROR;
/* Check the number of errors on stack */
@@ -569,9 +563,8 @@ test_copy(void)
/* Try to close error stack copy. Should fail because
* the current H5Eset_current_stack closes the stack to be set.
*/
- H5E_BEGIN_TRY {
- ret = H5Eclose_stack(estack_id);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Eclose_stack(estack_id); }
+ H5E_END_TRY
if (ret >= 0)
TEST_ERROR
@@ -581,7 +574,6 @@ error:
return -1;
} /* end test_copy() */
-
/*-------------------------------------------------------------------------
* Function: close_error
*
@@ -617,7 +609,6 @@ error:
return -1;
} /* end close_error() */
-
/*-------------------------------------------------------------------------
* Function: test_filter_error
*
@@ -635,8 +626,8 @@ static herr_t
test_filter_error(const char *fname)
{
const char *pathname = H5_get_srcdir_filename(fname); /* Corrected test file name */
- hid_t file = -1;
- hid_t dataset = -1;
+ hid_t file = -1;
+ hid_t dataset = -1;
int buf[20];
HDfprintf(stderr, "\nTesting error message during data reading when filter isn't registered\n");
@@ -665,7 +656,6 @@ error:
return -1;
} /* end test_filter_error() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -676,11 +666,11 @@ error:
int
main(void)
{
- hid_t file = -1;
- hid_t fapl = -1;
+ hid_t file = -1;
+ hid_t fapl = -1;
hid_t estack_id = -1;
char filename[1024];
- const char *FUNC_main = "main";
+ const char *FUNC_main = "main";
int i;
HDfprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n");
@@ -693,16 +683,16 @@ main(void)
TEST_ERROR;
/* Set up data arrays */
- if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ if (NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
TEST_ERROR;
- if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data))))
+ if (NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data))))
TEST_ERROR;
for (i = 0; i < DIM0; i++)
ipoints2[i] = ipoints2_data + (i * DIM1);
- if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ if (NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
TEST_ERROR;
- if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data))))
+ if (NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data))))
TEST_ERROR;
for (i = 0; i < DIM0; i++)
icheck2[i] = icheck2_data + (i * DIM1);
@@ -715,7 +705,7 @@ main(void)
if (error_stack() < 0) {
/* Push an error onto error stack */
if (H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK,
- "Error stack test failed") < 0)
+ "Error stack test failed") < 0)
TEST_ERROR;
/* Delete an error from the top of error stack */
@@ -791,4 +781,3 @@ error:
return 1;
}
#endif /* H5_USE_16_API */
-
diff --git a/test/evict_on_close.c b/test/evict_on_close.c
index 9f6607a..fb88826 100644
--- a/test/evict_on_close.c
+++ b/test/evict_on_close.c
@@ -16,23 +16,22 @@
* are located in cache.c.
*/
-#define H5C_FRIEND /*suppress error about including H5Cpkg */
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5C_FRIEND /*suppress error about including H5Cpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
#define H5D_TESTING
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
-#define H5I_FRIEND /*suppress error about including H5Ipkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5I_FRIEND /*suppress error about including H5Ipkg */
#define H5I_TESTING
-
#include "h5test.h"
#include "H5Cpkg.h"
#include "H5Dpkg.h"
#include "H5Fpkg.h"
#include "H5Gpkg.h"
#include "H5Ipkg.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* Evict on close is not supported under parallel at this time.
* In the meantime, we just run a simple check that EoC can't be
@@ -44,42 +43,39 @@
/* (Requires debug build of the library) */
/* #define EOC_MANUAL_INSPECTION */
-const char *FILENAMES[] = {
- "evict-on-close", /* 0 */
- NULL
-};
-#define FILENAME_BUF_SIZE 1024
+const char *FILENAMES[] = {"evict-on-close", /* 0 */
+ NULL};
+#define FILENAME_BUF_SIZE 1024
/* Group names */
-#define GROUP_OLD_STYLE_NAME "old_style_groups"
-#define GROUP_NEW_STYLE_NAME "new_style_groups"
+#define GROUP_OLD_STYLE_NAME "old_style_groups"
+#define GROUP_NEW_STYLE_NAME "new_style_groups"
/* Dataset names */
-#define DSET_COMPACT_NAME "compact"
-#define DSET_CONTIGUOUS_NAME "contiguous"
-#define DSET_BTREE_NAME "v1_btree"
-#define DSET_EARRAY_NAME "earray"
-#define DSET_BT2_NAME "v2_btree"
-#define DSET_FARRAY_NAME "farray"
-#define DSET_SINGLE_NAME "single"
+#define DSET_COMPACT_NAME "compact"
+#define DSET_CONTIGUOUS_NAME "contiguous"
+#define DSET_BTREE_NAME "v1_btree"
+#define DSET_EARRAY_NAME "earray"
+#define DSET_BT2_NAME "v2_btree"
+#define DSET_FARRAY_NAME "farray"
+#define DSET_SINGLE_NAME "single"
/* Number of data elements in a dataset */
-#define NELEMENTS 1024
+#define NELEMENTS 1024
/* Number of subgroups in each style of group */
-#define NSUBGROUPS 128
+#define NSUBGROUPS 128
/* Max size of subgroup name, not including NULL */
-#define SUBGROUP_NAME_SIZE 16
+#define SUBGROUP_NAME_SIZE 16
/* Prototypes */
static hbool_t verify_tag_not_in_cache(const H5F_t *f, haddr_t tag);
-static herr_t check_evict_on_close_api(void);
-static hid_t generate_eoc_test_file(hid_t fapl_id);
-static herr_t check_dset_scheme(hid_t fid, const char *dset_name);
-static herr_t check_group_layout(hid_t fid, const char *group_name);
+static herr_t check_evict_on_close_api(void);
+static hid_t generate_eoc_test_file(hid_t fapl_id);
+static herr_t check_dset_scheme(hid_t fid, const char *dset_name);
+static herr_t check_group_layout(hid_t fid, const char *group_name);
-
/*-------------------------------------------------------------------------
* Function: verify_tag_not_in_cache()
*
@@ -93,18 +89,18 @@ static herr_t check_group_layout(hid_t fid, const char *group_name);
static H5_ATTR_PURE hbool_t
verify_tag_not_in_cache(const H5F_t *f, haddr_t tag)
{
- H5C_t *cache_ptr = NULL; /* cache pointer */
- int i = 0; /* iterator */
+ H5C_t *cache_ptr = NULL; /* cache pointer */
+ int i = 0; /* iterator */
/* Get Internal Cache Pointers */
cache_ptr = f->shared->cache;
- for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
- H5C_cache_entry_t *entry_ptr; /* entry pointer */
+ for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
+ H5C_cache_entry_t *entry_ptr; /* entry pointer */
entry_ptr = cache_ptr->index[i];
- while(entry_ptr != NULL) {
- if(tag == entry_ptr->tag_info->tag)
+ while (entry_ptr != NULL) {
+ if (tag == entry_ptr->tag_info->tag)
return TRUE;
else
entry_ptr = entry_ptr->ht_next;
@@ -114,7 +110,6 @@ verify_tag_not_in_cache(const H5F_t *f, haddr_t tag)
return FALSE;
} /* end verify_tag_not_in_cache() */
-
/*-------------------------------------------------------------------------
* Function: generate_eoc_test_file()
*
@@ -128,22 +123,22 @@ verify_tag_not_in_cache(const H5F_t *f, haddr_t tag)
static hid_t
generate_eoc_test_file(hid_t fapl_id)
{
- char filename[FILENAME_BUF_SIZE]; /* decorated file name */
- hid_t fid = -1; /* file ID (returned) */
- hid_t fapl_copy_id = -1; /* ID of copied fapl */
- hid_t gid1 = -1, gid2 = -1; /* group IDs */
- hid_t sid = -1; /* dataspace ID */
- hid_t dcpl_id = -1; /* dataset creation plist */
- hid_t did = -1; /* dataset ID */
- int rank; /* # of array dimensions */
- hsize_t current_dims[2]; /* current dataset size */
- hsize_t maximum_dims[2]; /* maximum dataset size */
- hsize_t chunk_dims[2]; /* chunk dimensions */
- H5D_chunk_index_t idx_type; /* dataset chunk index type */
- H5D_layout_t layout_type; /* dataset layout type */
- int *data = NULL; /* buffer for fake data */
- int n; /* # of data elements */
- int i; /* iterator (# subgroups) */
+ char filename[FILENAME_BUF_SIZE]; /* decorated file name */
+ hid_t fid = -1; /* file ID (returned) */
+ hid_t fapl_copy_id = -1; /* ID of copied fapl */
+ hid_t gid1 = -1, gid2 = -1; /* group IDs */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t dcpl_id = -1; /* dataset creation plist */
+ hid_t did = -1; /* dataset ID */
+ int rank; /* # of array dimensions */
+ hsize_t current_dims[2]; /* current dataset size */
+ hsize_t maximum_dims[2]; /* maximum dataset size */
+ hsize_t chunk_dims[2]; /* chunk dimensions */
+ H5D_chunk_index_t idx_type; /* dataset chunk index type */
+ H5D_layout_t layout_type; /* dataset layout type */
+ int * data = NULL; /* buffer for fake data */
+ int n; /* # of data elements */
+ int i; /* iterator (# subgroups) */
TESTING("generating evict-on-close test file");
@@ -151,20 +146,19 @@ generate_eoc_test_file(hid_t fapl_id)
h5_fixname(FILENAMES[0], fapl_id, filename, sizeof(filename));
/* Copy the fapl and set the latest file format */
- if((fapl_copy_id = H5Pcopy(fapl_id)) < 0)
+ if ((fapl_copy_id = H5Pcopy(fapl_id)) < 0)
TEST_ERROR;
- if(H5Pset_libver_bounds(fapl_copy_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl_copy_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
/* Create a data buffer for dataset writes */
- if(NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int))))
+ if (NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int))))
TEST_ERROR;
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
-
/*******************************************/
/* CREATE OBJECTS WITH THE OLD FILE FORMAT */
/*******************************************/
@@ -182,25 +176,25 @@ generate_eoc_test_file(hid_t fapl_id)
* ensure that the file data structures for groups include
* multiple cache entries.
*/
- if((gid1 = H5Gcreate2(fid, GROUP_OLD_STYLE_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(fid, GROUP_OLD_STYLE_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create sub-groups */
- for(i = 0; i < NSUBGROUPS; i++) {
+ for (i = 0; i < NSUBGROUPS; i++) {
char subgroup_name[SUBGROUP_NAME_SIZE];
/* Create the group name */
HDmemset(subgroup_name, '\0', SUBGROUP_NAME_SIZE);
- if(HDsnprintf(subgroup_name, (size_t)(SUBGROUP_NAME_SIZE - 1), "%d", i) < 0)
+ if (HDsnprintf(subgroup_name, (size_t)(SUBGROUP_NAME_SIZE - 1), "%d", i) < 0)
TEST_ERROR
- if((gid2 = H5Gcreate2(gid1, subgroup_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(gid1, subgroup_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR;
}
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
TEST_ERROR;
/********************************************************************/
@@ -216,53 +210,52 @@ generate_eoc_test_file(hid_t fapl_id)
/********************/
/* Create dataspace */
- n = NELEMENTS;
- rank = 1;
+ n = NELEMENTS;
+ rank = 1;
current_dims[0] = (hsize_t)n;
maximum_dims[0] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
+ if ((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
TEST_ERROR;
/* Create dcpl and set up chunking */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR;
chunk_dims[0] = 1;
- if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
TEST_ERROR;
/* Create dataset */
- if((did = H5Dcreate2(fid, DSET_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Ensure we're using the correct chunk indexing scheme */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
TEST_ERROR;
- if(idx_type != H5D_CHUNK_IDX_BTREE)
+ if (idx_type != H5D_CHUNK_IDX_BTREE)
FAIL_PUTS_ERROR("should be using version 1 B-tree as the chunk index");
/* Write a bunch of fake data */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
TEST_ERROR;
/* Close IDs for this dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
TEST_ERROR;
-
/**********************************************/
/* CREATE OBJECTS WITH THE LATEST FILE FORMAT */
/**********************************************/
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
/* Reopen the file with the "latest file format" fapl */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_copy_id)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_copy_id)) < 0)
TEST_ERROR;
/*******************/
@@ -278,25 +271,25 @@ generate_eoc_test_file(hid_t fapl_id)
* ensure that the file data structures for groups include
* multiple cache entries.
*/
- if((gid1 = H5Gcreate2(fid, GROUP_NEW_STYLE_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(fid, GROUP_NEW_STYLE_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create sub-groups */
- for(i = 0; i < NSUBGROUPS; i++) {
+ for (i = 0; i < NSUBGROUPS; i++) {
char subgroup_name[SUBGROUP_NAME_SIZE];
/* Create the group name */
HDmemset(subgroup_name, '\0', SUBGROUP_NAME_SIZE);
- if(HDsnprintf(subgroup_name, (size_t)(SUBGROUP_NAME_SIZE - 1), "%d", i) < 0)
+ if (HDsnprintf(subgroup_name, (size_t)(SUBGROUP_NAME_SIZE - 1), "%d", i) < 0)
TEST_ERROR
- if((gid2 = H5Gcreate2(gid1, subgroup_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(gid1, subgroup_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR;
}
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
TEST_ERROR;
/********************************************************************/
@@ -308,40 +301,40 @@ generate_eoc_test_file(hid_t fapl_id)
/********************/
/* Create dataspace */
- n = NELEMENTS;
- rank = 1;
+ n = NELEMENTS;
+ rank = 1;
current_dims[0] = (hsize_t)n;
maximum_dims[0] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
+ if ((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
TEST_ERROR;
/* Create dcpl and set up chunking */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR;
chunk_dims[0] = 1;
- if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
TEST_ERROR;
/* Create dataset */
- if((did = H5Dcreate2(fid, DSET_EARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_EARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Ensure we're using the correct chunk indexing scheme */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
TEST_ERROR;
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
FAIL_PUTS_ERROR("should be using extensible array as the chunk index");
/* Write a bunch of fake data */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
TEST_ERROR;
/* Close IDs for this dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
TEST_ERROR;
/********************/
@@ -349,43 +342,43 @@ generate_eoc_test_file(hid_t fapl_id)
/********************/
/* Create dataspace */
- n = NELEMENTS;
- rank = 2;
+ n = NELEMENTS;
+ rank = 2;
current_dims[0] = (hsize_t)2;
- current_dims[1] = (hsize_t)(n/2);
+ current_dims[1] = (hsize_t)(n / 2);
maximum_dims[0] = H5S_UNLIMITED;
maximum_dims[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
+ if ((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
TEST_ERROR;
/* Create dcpl and set up chunking */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR;
chunk_dims[0] = 1;
chunk_dims[1] = 1;
- if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
TEST_ERROR;
/* Create dataset */
- if((did = H5Dcreate2(fid, DSET_BT2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_BT2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Ensure we're using the correct chunk indexing scheme */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
TEST_ERROR;
- if(idx_type != H5D_CHUNK_IDX_BT2)
+ if (idx_type != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("should be using version 2 B-tree as the chunk index");
/* Write a bunch of fake data */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
TEST_ERROR;
/* Close IDs for this dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
TEST_ERROR;
/***************/
@@ -393,41 +386,41 @@ generate_eoc_test_file(hid_t fapl_id)
/***************/
/* Create dataspace */
- n = NELEMENTS;
- rank = 1;
+ n = NELEMENTS;
+ rank = 1;
current_dims[0] = (hsize_t)n;
maximum_dims[0] = (hsize_t)n;
- if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
+ if ((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
TEST_ERROR;
/* Create dcpl and set up chunking */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR;
chunk_dims[0] = 1;
chunk_dims[1] = 1;
- if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
TEST_ERROR;
/* Create dataset */
- if((did = H5Dcreate2(fid, DSET_FARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_FARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Ensure we're using the correct chunk indexing scheme */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
TEST_ERROR;
- if(idx_type != H5D_CHUNK_IDX_FARRAY)
+ if (idx_type != H5D_CHUNK_IDX_FARRAY)
FAIL_PUTS_ERROR("should be using fixed array as the chunk index");
/* Write a bunch of fake data */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
TEST_ERROR;
/* Close IDs for this dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
TEST_ERROR;
/****************/
@@ -435,41 +428,41 @@ generate_eoc_test_file(hid_t fapl_id)
/****************/
/* Create dataspace */
- n = NELEMENTS;
- rank = 1;
+ n = NELEMENTS;
+ rank = 1;
current_dims[0] = (hsize_t)n;
maximum_dims[0] = (hsize_t)n;
- if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
+ if ((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
TEST_ERROR;
/* Create dcpl and set up chunking */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR;
chunk_dims[0] = (hsize_t)n;
chunk_dims[1] = (hsize_t)n;
- if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0)
TEST_ERROR;
/* Create dataset */
- if((did = H5Dcreate2(fid, DSET_SINGLE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_SINGLE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Ensure we're using the correct chunk indexing scheme */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
TEST_ERROR;
- if(idx_type != H5D_CHUNK_IDX_SINGLE)
+ if (idx_type != H5D_CHUNK_IDX_SINGLE)
FAIL_PUTS_ERROR("should be using single chunk as the chunk index");
/* Write a bunch of fake data */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
TEST_ERROR;
/* Close IDs for this dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
TEST_ERROR;
/**************/
@@ -477,31 +470,32 @@ generate_eoc_test_file(hid_t fapl_id)
/**************/
/* Create dataspace */
- n = NELEMENTS;
- rank = 1;
+ n = NELEMENTS;
+ rank = 1;
current_dims[0] = (hsize_t)n;
maximum_dims[0] = (hsize_t)n;
- if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
+ if ((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
TEST_ERROR;
/* Create dataset */
- if((did = H5Dcreate2(fid, DSET_CONTIGUOUS_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_CONTIGUOUS_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Ensure we're using the correct layout scheme */
- if(H5D__layout_type_test(did, &layout_type) < 0)
+ if (H5D__layout_type_test(did, &layout_type) < 0)
TEST_ERROR;
- if(layout_type != H5D_CONTIGUOUS)
+ if (layout_type != H5D_CONTIGUOUS)
FAIL_PUTS_ERROR("should be using contiguous layout");
/* Write a bunch of fake data */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
TEST_ERROR;
/* Close IDs for this dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
/***********/
@@ -509,39 +503,40 @@ generate_eoc_test_file(hid_t fapl_id)
/***********/
/* Create dataspace */
- n = 1;
- rank = 1;
+ n = 1;
+ rank = 1;
current_dims[0] = (hsize_t)n;
maximum_dims[0] = (hsize_t)n;
- if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
+ if ((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0)
TEST_ERROR;
/* Create dcpl and set up compact layout */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR;
- if(H5Pset_layout(dcpl_id, H5D_COMPACT) < 0)
+ if (H5Pset_layout(dcpl_id, H5D_COMPACT) < 0)
TEST_ERROR;
/* Create dataset */
- if((did = H5Dcreate2(fid, DSET_COMPACT_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_COMPACT_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) <
+ 0)
TEST_ERROR;
/* Ensure we're using the correct layout scheme */
- if(H5D__layout_type_test(did, &layout_type) < 0)
+ if (H5D__layout_type_test(did, &layout_type) < 0)
TEST_ERROR;
- if(layout_type != H5D_COMPACT)
+ if (layout_type != H5D_COMPACT)
FAIL_PUTS_ERROR("should be using compact layout");
/* Write a bunch of fake data */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
TEST_ERROR;
/* Close IDs for this dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
TEST_ERROR;
/********/
@@ -549,7 +544,7 @@ generate_eoc_test_file(hid_t fapl_id)
/********/
/* Close/free everything else */
- if(H5Pclose(fapl_copy_id) < 0)
+ if (H5Pclose(fapl_copy_id) < 0)
TEST_ERROR;
HDfree(data);
@@ -558,7 +553,8 @@ generate_eoc_test_file(hid_t fapl_id)
return fid;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid1);
H5Gclose(gid2);
H5Fclose(fid);
@@ -566,7 +562,8 @@ error:
H5Sclose(sid);
H5Pclose(dcpl_id);
H5Pclose(fapl_copy_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(data);
@@ -575,7 +572,6 @@ error:
} /* end generate_eoc_test_file() */
-
/*-------------------------------------------------------------------------
* Function: check_group_layout()
*
@@ -589,17 +585,17 @@ error:
static herr_t
check_group_layout(hid_t fid, const char *group_name)
{
- H5F_t *file_ptr = NULL; /* ptr to internal file struct */
- hid_t gid1 = -1, gid2 = -1; /* group IDs */
- H5G_t *grp_ptr = NULL; /* ptr to internal group struct */
- haddr_t tag1, tag2; /* MD cache tags for groups */
- uint32_t before, during, after; /* cache sizes */
- int i; /* iterator */
+ H5F_t * file_ptr = NULL; /* ptr to internal file struct */
+ hid_t gid1 = -1, gid2 = -1; /* group IDs */
+ H5G_t * grp_ptr = NULL; /* ptr to internal group struct */
+ haddr_t tag1, tag2; /* MD cache tags for groups */
+ uint32_t before, during, after; /* cache sizes */
+ int i; /* iterator */
/* NOTE: The TESTING() macro is called in main() */
/* Get a pointer to the file struct */
- if(NULL == (file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE)))
+ if (NULL == (file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE)))
TEST_ERROR;
/* Record the number of cache entries */
@@ -607,39 +603,38 @@ check_group_layout(hid_t fid, const char *group_name)
#ifdef EOC_MANUAL_INSPECTION
HDprintf("\nCACHE BEFORE GROUP OPEN:\n");
- if(H5AC_dump_cache(file_ptr) < 0)
+ if (H5AC_dump_cache(file_ptr) < 0)
TEST_ERROR;
HDprintf("NUMBER OF CACHE ENTRIES: %u\n", before);
#endif
/* Open the main group and get its tag */
- if((gid1 = H5Gopen2(fid, group_name, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gopen2(fid, group_name, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(NULL == (grp_ptr = (H5G_t *)H5VL_object_verify(gid1, H5I_GROUP)))
+ if (NULL == (grp_ptr = (H5G_t *)H5VL_object_verify(gid1, H5I_GROUP)))
TEST_ERROR;
tag1 = grp_ptr->oloc.addr;
-
/* Open and close all sub-groups */
- for(i = 0; i < NSUBGROUPS; i++) {
+ for (i = 0; i < NSUBGROUPS; i++) {
char subgroup_name[SUBGROUP_NAME_SIZE];
/* Create the group name */
HDmemset(subgroup_name, '\0', SUBGROUP_NAME_SIZE);
- if(HDsnprintf(subgroup_name, (size_t)(SUBGROUP_NAME_SIZE - 1), "%d", i) < 0)
+ if (HDsnprintf(subgroup_name, (size_t)(SUBGROUP_NAME_SIZE - 1), "%d", i) < 0)
TEST_ERROR
- if((gid2 = H5Gopen2(gid1, subgroup_name, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gopen2(gid1, subgroup_name, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(NULL == (grp_ptr = (H5G_t *)H5VL_object_verify(gid2, H5I_GROUP)))
+ if (NULL == (grp_ptr = (H5G_t *)H5VL_object_verify(gid2, H5I_GROUP)))
TEST_ERROR;
tag2 = grp_ptr->oloc.addr;
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR;
- if(TRUE == verify_tag_not_in_cache(file_ptr, tag2))
+ if (TRUE == verify_tag_not_in_cache(file_ptr, tag2))
TEST_ERROR;
} /* end for */
@@ -648,14 +643,14 @@ check_group_layout(hid_t fid, const char *group_name)
#ifdef EOC_MANUAL_INSPECTION
HDprintf("\nCACHE AFTER OPENING GROUPS (WHILE OPEN):\n");
- if(H5AC_dump_cache(file_ptr) < 0)
+ if (H5AC_dump_cache(file_ptr) < 0)
TEST_ERROR;
HDprintf("MAIN GROUP TAG: %#X\n", tag1);
HDprintf("NUMBER OF CACHE ENTRIES: %u\n", during);
#endif
/* Close the main group */
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
TEST_ERROR;
/* Record the number of cache entries */
@@ -663,33 +658,34 @@ check_group_layout(hid_t fid, const char *group_name)
#ifdef EOC_MANUAL_INSPECTION
HDprintf("\nCACHE AFTER CLOSING GROUPS:\n");
- if(H5AC_dump_cache(file_ptr) < 0)
+ if (H5AC_dump_cache(file_ptr) < 0)
TEST_ERROR;
HDprintf("NUMBER OF CACHE ENTRIES: %u\n", after);
#endif
/* Ensure that the cache does not contain entries with the tag */
- if(TRUE == verify_tag_not_in_cache(file_ptr, tag1))
+ if (TRUE == verify_tag_not_in_cache(file_ptr, tag1))
TEST_ERROR;
/* Compare the number of cache entries */
- if(before != after || before == during)
+ if (before != after || before == during)
TEST_ERROR;
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid1);
H5Gclose(gid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
} /* end check_group_layout() */
-
/*-------------------------------------------------------------------------
* Function: check_dset_scheme()
*
@@ -703,21 +699,21 @@ error:
static herr_t
check_dset_scheme(hid_t fid, const char *dset_name)
{
- H5F_t *file_ptr = NULL; /* ptr to internal file struct */
- hid_t did = -1; /* dataset ID */
- H5D_t *dset_ptr = NULL; /* ptr to internal dset struct */
- haddr_t tag; /* MD cache tag for dataset */
- int *data = NULL; /* buffer for fake data */
- uint32_t before, during, after; /* cache sizes */
+ H5F_t * file_ptr = NULL; /* ptr to internal file struct */
+ hid_t did = -1; /* dataset ID */
+ H5D_t * dset_ptr = NULL; /* ptr to internal dset struct */
+ haddr_t tag; /* MD cache tag for dataset */
+ int * data = NULL; /* buffer for fake data */
+ uint32_t before, during, after; /* cache sizes */
/* NOTE: The TESTING() macro is called in main() */
/* Get a pointer to the file struct */
- if(NULL == (file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE)))
+ if (NULL == (file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE)))
TEST_ERROR;
/* Create the data buffer */
- if(NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int))))
+ if (NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int))))
TEST_ERROR;
/* Record the number of cache entries */
@@ -725,22 +721,22 @@ check_dset_scheme(hid_t fid, const char *dset_name)
#ifdef EOC_MANUAL_INSPECTION
HDprintf("\nCACHE BEFORE DATASET OPEN:\n");
- if(H5AC_dump_cache(file_ptr) < 0)
+ if (H5AC_dump_cache(file_ptr) < 0)
TEST_ERROR;
HDprintf("NUMBER OF CACHE ENTRIES: %u\n", before);
#endif
/* Open dataset and get the metadata tag */
- if((did = H5Dopen2(fid, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, dset_name, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(NULL == (dset_ptr = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
+ if (NULL == (dset_ptr = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
TEST_ERROR;
tag = dset_ptr->oloc.addr;
/* Read data from the dataset so the cache gets populated with chunk entries
* and the like.
*/
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
TEST_ERROR;
/* Record the number of cache entries */
@@ -748,14 +744,14 @@ check_dset_scheme(hid_t fid, const char *dset_name)
#ifdef EOC_MANUAL_INSPECTION
HDprintf("\nCACHE AFTER DATA READ (WHILE OPEN):\n");
- if(H5AC_dump_cache(file_ptr) < 0)
+ if (H5AC_dump_cache(file_ptr) < 0)
TEST_ERROR;
HDprintf("TAG: %#X\n", tag);
HDprintf("NUMBER OF CACHE ENTRIES: %u\n", during);
#endif
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
/* Record the number of cache entries */
@@ -763,17 +759,17 @@ check_dset_scheme(hid_t fid, const char *dset_name)
#ifdef EOC_MANUAL_INSPECTION
HDprintf("\nCACHE AFTER DATASET CLOSE:\n");
- if(H5AC_dump_cache(file_ptr) < 0)
+ if (H5AC_dump_cache(file_ptr) < 0)
TEST_ERROR;
HDprintf("NUMBER OF CACHE ENTRIES: %u\n", after);
#endif
/* Ensure that the cache does not contain entries with the tag */
- if(TRUE == verify_tag_not_in_cache(file_ptr, tag))
+ if (TRUE == verify_tag_not_in_cache(file_ptr, tag))
TEST_ERROR;
/* Compare the number of cache entries */
- if(before != after || before == during)
+ if (before != after || before == during)
TEST_ERROR;
HDfree(data);
@@ -782,16 +778,14 @@ check_dset_scheme(hid_t fid, const char *dset_name)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Dclose(did);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Dclose(did); }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
} /* check_dset_scheme() */
-
/*-------------------------------------------------------------------------
* Function: check_evict_on_close_api()
*
@@ -805,63 +799,61 @@ error:
static herr_t
check_evict_on_close_api(void)
{
- hid_t fapl_id = -1;
- hid_t dapl_id = -1;
- hbool_t evict_on_close;
- herr_t status;
+ hid_t fapl_id = -1;
+ hid_t dapl_id = -1;
+ hbool_t evict_on_close;
+ herr_t status;
TESTING("evict on close API");
/* Create a fapl */
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Check the default */
evict_on_close = TRUE;
- if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0)
+ if (H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0)
TEST_ERROR;
- if(evict_on_close != FALSE)
+ if (evict_on_close != FALSE)
FAIL_PUTS_ERROR("Incorrect default evict on close value.");
/* Set the evict on close property */
evict_on_close = TRUE;
- if(H5Pset_evict_on_close(fapl_id, evict_on_close) < 0)
+ if (H5Pset_evict_on_close(fapl_id, evict_on_close) < 0)
TEST_ERROR;
/* Make sure we can get it back out */
evict_on_close = FALSE;
- if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0)
+ if (H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0)
TEST_ERROR;
- if(evict_on_close != TRUE)
+ if (evict_on_close != TRUE)
FAIL_PUTS_ERROR("Incorrect evict on close value.");
/* close fapl */
- if(H5Pclose(fapl_id) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR;
/**********************************************/
/* Trying passing in a non-fapl property list */
/**********************************************/
- if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
TEST_ERROR;
/* ensure using an incorrect access plist fails */
- H5E_BEGIN_TRY {
- status = H5Pset_evict_on_close(dapl_id, evict_on_close);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Pset_evict_on_close(dapl_id, evict_on_close); }
+ H5E_END_TRY;
+ if (status >= 0)
FAIL_PUTS_ERROR("H5Pset_evict_on_close() accepted invalid access plist.");
/* ensure an invalid plist fails */
- H5E_BEGIN_TRY {
- status = H5Pget_evict_on_close(H5I_INVALID_HID, &evict_on_close);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Pget_evict_on_close(H5I_INVALID_HID, &evict_on_close); }
+ H5E_END_TRY;
+ if (status >= 0)
FAIL_PUTS_ERROR("H5Pget_evict_on_close() accepted invalid hid_t.");
/* close dapl */
- if(H5Pclose(dapl_id) < 0)
+ if (H5Pclose(dapl_id) < 0)
TEST_ERROR;
PASSED();
@@ -873,7 +865,6 @@ error:
} /* check_evict_on_close_api() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -884,9 +875,9 @@ error:
int
main(void)
{
- hid_t fapl_id = -1; /* VFD-specific fapl */
- hid_t fid = -1; /* file ID */
- unsigned nerrors = 0; /* number of test errors */
+ hid_t fapl_id = -1; /* VFD-specific fapl */
+ hid_t fid = -1; /* file ID */
+ unsigned nerrors = 0; /* number of test errors */
HDprintf("Testing evict-on-close cache behavior\n");
@@ -897,19 +888,19 @@ main(void)
nerrors += check_evict_on_close_api() < 0 ? 1 : 0;
/* Set up VFD-specific fapl */
- if((fapl_id = h5_fileaccess()) < 0) {
+ if ((fapl_id = h5_fileaccess()) < 0) {
nerrors++;
PUTS_ERROR("Unable to get VFD-specific fapl\n");
} /* end if */
/* Set evict-on-close property */
- if(H5Pset_evict_on_close(fapl_id, TRUE) < 0) {
+ if (H5Pset_evict_on_close(fapl_id, TRUE) < 0) {
nerrors++;
PUTS_ERROR("Unable to set evict-on-close property\n");
} /* end if */
/* Generate the test file */
- if((fid = generate_eoc_test_file(fapl_id)) < 0) {
+ if ((fid = generate_eoc_test_file(fapl_id)) < 0) {
nerrors++;
PUTS_ERROR("Unable to generate test file\n");
} /* end if */
@@ -918,42 +909,42 @@ main(void)
* PASSED() and H5_FAILED() are handled in check_configuration()
*/
TESTING("evict on close with version 1 B-tree chunk index");
- nerrors += check_dset_scheme(fid, DSET_BTREE_NAME) < 0 ? 1 : 0;
+ nerrors += check_dset_scheme(fid, DSET_BTREE_NAME) < 0 ? 1 : 0;
TESTING("evict on close with extensible array chunk index");
- nerrors += check_dset_scheme(fid, DSET_EARRAY_NAME) < 0 ? 1 : 0;
+ nerrors += check_dset_scheme(fid, DSET_EARRAY_NAME) < 0 ? 1 : 0;
TESTING("evict on close with version 2 B-tree chunk index");
- nerrors += check_dset_scheme(fid, DSET_BT2_NAME) < 0 ? 1 : 0;
+ nerrors += check_dset_scheme(fid, DSET_BT2_NAME) < 0 ? 1 : 0;
TESTING("evict on close with fixed array chunk index");
- nerrors += check_dset_scheme(fid, DSET_FARRAY_NAME) < 0 ? 1 : 0;
+ nerrors += check_dset_scheme(fid, DSET_FARRAY_NAME) < 0 ? 1 : 0;
TESTING("evict on close with \'single chunk\' chunk index");
- nerrors += check_dset_scheme(fid, DSET_SINGLE_NAME) < 0 ? 1 : 0;
+ nerrors += check_dset_scheme(fid, DSET_SINGLE_NAME) < 0 ? 1 : 0;
TESTING("evict on close with contiguous layout");
- nerrors += check_dset_scheme(fid, DSET_CONTIGUOUS_NAME) < 0 ? 1 : 0;
+ nerrors += check_dset_scheme(fid, DSET_CONTIGUOUS_NAME) < 0 ? 1 : 0;
TESTING("evict on close with compact layout");
- nerrors += check_dset_scheme(fid, DSET_COMPACT_NAME) < 0 ? 1 : 0;
+ nerrors += check_dset_scheme(fid, DSET_COMPACT_NAME) < 0 ? 1 : 0;
/* Run tests with old- and new-style groups
* PASSED() and H5_FAILED() are handled in check_configuration()
*/
TESTING("evict on close with old-style groups");
- nerrors += check_group_layout(fid, GROUP_OLD_STYLE_NAME) < 0 ? 1 : 0;
+ nerrors += check_group_layout(fid, GROUP_OLD_STYLE_NAME) < 0 ? 1 : 0;
TESTING("evict on close with new-style groups");
- nerrors += check_group_layout(fid, GROUP_NEW_STYLE_NAME) < 0 ? 1 : 0;
+ nerrors += check_group_layout(fid, GROUP_NEW_STYLE_NAME) < 0 ? 1 : 0;
/* Close the test file */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
nerrors++;
PUTS_ERROR("Unable to close the test file.\n");
} /* end if */
/* Clean up files and close the VFD-specific fapl */
h5_delete_all_test_files(FILENAMES, fapl_id);
- if(H5Pclose(fapl_id) < 0) {
+ if (H5Pclose(fapl_id) < 0) {
nerrors++;
PUTS_ERROR("Unable to close VFD-specific fapl.\n");
} /* end if */
- if(nerrors)
+ if (nerrors)
goto error;
HDprintf("All evict-on-close tests passed.\n");
@@ -962,14 +953,15 @@ main(void)
error:
- HDprintf("***** %u evict-on-close test%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ HDprintf("***** %u evict-on-close test%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
h5_delete_all_test_files(FILENAMES, fapl_id);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fapl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDexit(EXIT_FAILURE);
@@ -977,7 +969,6 @@ error:
#else
-
/*-------------------------------------------------------------------------
* Function: check_evict_on_close_parallel_fail()
*
@@ -991,26 +982,25 @@ error:
static herr_t
check_evict_on_close_parallel_fail(void)
{
- hid_t fapl_id = -1;
- hbool_t evict_on_close;
- herr_t status;
+ hid_t fapl_id = -1;
+ hbool_t evict_on_close;
+ herr_t status;
TESTING("evict on close fails in parallel");
/* Create a fapl */
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set the evict on close property (should fail)*/
evict_on_close = TRUE;
- H5E_BEGIN_TRY {
- status = H5Pset_evict_on_close(fapl_id, evict_on_close);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Pset_evict_on_close(fapl_id, evict_on_close); }
+ H5E_END_TRY;
+ if (status >= 0)
FAIL_PUTS_ERROR("H5Pset_evict_on_close() did not fail in parallel HDF5.");
/* close fapl */
- if(H5Pclose(fapl_id) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR;
PASSED();
@@ -1022,7 +1012,6 @@ error:
} /* check_evict_on_close_parallel_fail() */
-
/*-------------------------------------------------------------------------
* Function: main (parallel version)
*
@@ -1033,7 +1022,7 @@ error:
int
main(void)
{
- unsigned nerrors = 0; /* number of test errors */
+ unsigned nerrors = 0; /* number of test errors */
HDprintf("Testing evict-on-close cache behavior\n");
@@ -1043,7 +1032,7 @@ main(void)
/* Test that EoC fails in parallel HDF5 */
nerrors += check_evict_on_close_parallel_fail() < 0 ? 1 : 0;
- if(nerrors)
+ if (nerrors)
goto error;
HDprintf("All evict-on-close tests passed.\n");
@@ -1053,12 +1042,10 @@ main(void)
error:
- HDprintf("***** %u evict-on-close test%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ HDprintf("***** %u evict-on-close test%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
HDexit(EXIT_FAILURE);
} /* main() - parallel */
#endif /* H5_HAVE_PARALLEL */
-
diff --git a/test/extend.c b/test/extend.c
index 369ad32..6658253 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -20,23 +20,19 @@
#include "h5test.h"
-const char *FILENAME[] = {
- "extend",
- NULL
-};
+const char *FILENAME[] = {"extend", NULL};
-#define N1X 100 /* USE AN EVEN NUMBER! */
-#define N1Y 100 /* USE AN EVEN NUMBER! */
-#define N2X (N1X / 2)
-#define N2Y (N1Y / 2)
+#define N1X 100 /* USE AN EVEN NUMBER! */
+#define N1Y 100 /* USE AN EVEN NUMBER! */
+#define N2X (N1X / 2)
+#define N2Y (N1Y / 2)
/* Data buffers */
-static int **buf1 = NULL;
-static int *buf1_data = NULL;
-static int **buf2 = NULL;
-static int *buf2_data = NULL;
+static int **buf1 = NULL;
+static int * buf1_data = NULL;
+static int **buf2 = NULL;
+static int * buf2_data = NULL;
-
/*-------------------------------------------------------------------------
* Function: write_data
*
@@ -53,75 +49,89 @@ static int *buf2_data = NULL;
static int
write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space)
{
- hid_t dataset, file_space, half_space;
- static const hsize_t dims[2] = {N1X, N1Y};
- static const hsize_t half_dims[2] = {N2X, N2Y};
- hsize_t size[2];
- hsize_t max_size[2] = {0, 0};
- hsize_t offset[2];
- int i, j, k, m;
+ hid_t dataset, file_space, half_space;
+ static const hsize_t dims[2] = {N1X, N1Y};
+ static const hsize_t half_dims[2] = {N2X, N2Y};
+ hsize_t size[2];
+ hsize_t max_size[2] = {0, 0};
+ hsize_t offset[2];
+ int i, j, k, m;
TESTING(msg);
/* Create the dataset */
- if((dataset = H5Dcreate2(file, name, H5T_NATIVE_INT, mem_space, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dcreate2(file, name, H5T_NATIVE_INT, mem_space, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Write the data */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++) {
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 5; j++) {
/* Extend the dataset */
offset[0] = (hsize_t)(i * N1X);
offset[1] = (hsize_t)(j * N1Y);
- size[0] = offset[0] + N1X;
- size[1] = offset[1] + N1Y;
- if(size[0] > max_size[0] || size[1] > max_size[1]) {
- if(size[0] > max_size[0])
+ size[0] = offset[0] + N1X;
+ size[1] = offset[1] + N1Y;
+ if (size[0] > max_size[0] || size[1] > max_size[1]) {
+ if (size[0] > max_size[0])
max_size[0] = size[0];
- if(size[1] > max_size[1])
+ if (size[1] > max_size[1])
max_size[1] = size[1];
- if(H5Dset_extent(dataset, max_size) < 0) TEST_ERROR;
+ if (H5Dset_extent(dataset, max_size) < 0)
+ TEST_ERROR;
} /* end if */
/* Select a hyperslab */
- if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
+ if ((file_space = H5Dget_space(dataset)) < 0)
+ TEST_ERROR;
+ if (H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0)
+ TEST_ERROR;
/* Write to the hyperslab */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR;
- if(H5Sclose(file_space) < 0) TEST_ERROR;
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0)
+ TEST_ERROR;
+ if (H5Sclose(file_space) < 0)
+ TEST_ERROR;
} /* end for */
/* Read the data */
- if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR;
- if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
- for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
+ if ((half_space = H5Screate_simple(2, half_dims, NULL)) < 0)
+ TEST_ERROR;
+ if ((file_space = H5Dget_space(dataset)) < 0)
+ TEST_ERROR;
+ for (i = 0; i < 10; i++) {
+ for (j = 0; j < 10; j++) {
/* Select a hyperslab */
offset[0] = (hsize_t)(i * N2X);
offset[1] = (hsize_t)(j * N2Y);
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
+ if (H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0)
+ TEST_ERROR;
/* Read */
- if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR;
+ if (H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0)
+ TEST_ERROR;
/* Compare */
- for(k = 0; k < N2X; k++)
- for(m = 0; m < N2Y; m++)
- if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) {
+ for (k = 0; k < N2X; k++)
+ for (m = 0; m < N2Y; m++)
+ if (buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) {
HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
- HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]);
+ HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m,
+ buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]);
TEST_ERROR;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Cleanup */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
- if(H5Sclose(file_space) < 0) TEST_ERROR;
- if(H5Sclose(half_space) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+ if (H5Sclose(file_space) < 0)
+ TEST_ERROR;
+ if (H5Sclose(half_space) < 0)
+ TEST_ERROR;
PASSED();
return 0;
@@ -131,7 +141,7 @@ error:
} /* end write_data() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*-------------------------------------------------------------------------
* Function: write_data_deprec
*
@@ -149,69 +159,82 @@ error:
static int
write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space)
{
- hid_t dataset, file_space, half_space;
- static const hsize_t dims[2] = {N1X, N1Y};
- static const hsize_t half_dims[2] = {N2X, N2Y};
- static hsize_t size[2];
- hsize_t offset[2];
- int i, j, k, m;
+ hid_t dataset, file_space, half_space;
+ static const hsize_t dims[2] = {N1X, N1Y};
+ static const hsize_t half_dims[2] = {N2X, N2Y};
+ static hsize_t size[2];
+ hsize_t offset[2];
+ int i, j, k, m;
TESTING(msg);
/* Create the dataset */
- if((dataset = H5Dcreate2(file, name, H5T_NATIVE_INT, mem_space, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dcreate2(file, name, H5T_NATIVE_INT, mem_space, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Write the data */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++) {
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 5; j++) {
/* Extend the dataset */
offset[0] = (hsize_t)(i * N1X);
offset[1] = (hsize_t)(j * N1Y);
- size[0] = offset[0] + N1X;
- size[1] = offset[1] + N1Y;
- if(H5Dextend(dataset, size) < 0) TEST_ERROR;
+ size[0] = offset[0] + N1X;
+ size[1] = offset[1] + N1Y;
+ if (H5Dextend(dataset, size) < 0)
+ TEST_ERROR;
/* Select a hyperslab */
- if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
+ if ((file_space = H5Dget_space(dataset)) < 0)
+ TEST_ERROR;
+ if (H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0)
+ TEST_ERROR;
/* Write to the hyperslab */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR;
- if(H5Sclose(file_space) < 0) TEST_ERROR;
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0)
+ TEST_ERROR;
+ if (H5Sclose(file_space) < 0)
+ TEST_ERROR;
} /* end for */
/* Read the data */
- if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR;
- if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
- for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
+ if ((half_space = H5Screate_simple(2, half_dims, NULL)) < 0)
+ TEST_ERROR;
+ if ((file_space = H5Dget_space(dataset)) < 0)
+ TEST_ERROR;
+ for (i = 0; i < 10; i++) {
+ for (j = 0; j < 10; j++) {
/* Select a hyperslab */
offset[0] = (hsize_t)(i * N2X);
offset[1] = (hsize_t)(j * N2Y);
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
+ if (H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0)
+ TEST_ERROR;
/* Read */
- if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR;
+ if (H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0)
+ TEST_ERROR;
/* Compare */
- for(k = 0; k < N2X; k++)
- for(m = 0; m < N2Y; m++)
- if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) {
+ for (k = 0; k < N2X; k++)
+ for (m = 0; m < N2Y; m++)
+ if (buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) {
HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
- HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]);
+ HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m,
+ buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]);
TEST_ERROR;
} /* end if */
- } /* end for */
- } /* end for */
-
+ } /* end for */
+ } /* end for */
/* Cleanup */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
- if(H5Sclose(file_space) < 0) TEST_ERROR;
- if(H5Sclose(half_space) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+ if (H5Sclose(file_space) < 0)
+ TEST_ERROR;
+ if (H5Sclose(half_space) < 0)
+ TEST_ERROR;
PASSED();
return 0;
@@ -221,7 +244,6 @@ error:
} /* end write_data_deprec() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -235,70 +257,88 @@ error:
*-------------------------------------------------------------------------
*/
int
-main (void)
+main(void)
{
- hid_t file, mem_space, cparms;
- hid_t fapl;
- int nerrors = 0;
- static const hsize_t dims[2] = {N1X, N1Y};
- static const hsize_t chunk_dims[2] = {N2X, N2Y};
- static hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- char filename[1024];
- int i, j;
+ hid_t file, mem_space, cparms;
+ hid_t fapl;
+ int nerrors = 0;
+ static const hsize_t dims[2] = {N1X, N1Y};
+ static const hsize_t chunk_dims[2] = {N2X, N2Y};
+ static hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ char filename[1024];
+ int i, j;
h5_reset();
fapl = h5_fileaccess();
/* Initialize buffer and space */
- if(NULL == (buf1_data = (int *)HDcalloc(N1X * N1Y, sizeof(int))))
+ if (NULL == (buf1_data = (int *)HDcalloc(N1X * N1Y, sizeof(int))))
TEST_ERROR;
- if(NULL == (buf1 = (int **)HDcalloc(N1X, sizeof(buf1_data))))
+ if (NULL == (buf1 = (int **)HDcalloc(N1X, sizeof(buf1_data))))
TEST_ERROR;
for (i = 0; i < N1X; i++)
buf1[i] = buf1_data + (i * N1Y);
- if(NULL == (buf2_data = (int *)HDcalloc(N2X * N2Y, sizeof(int))))
+ if (NULL == (buf2_data = (int *)HDcalloc(N2X * N2Y, sizeof(int))))
TEST_ERROR;
- if(NULL == (buf2 = (int **)HDcalloc(N2X, sizeof(buf2_data))))
+ if (NULL == (buf2 = (int **)HDcalloc(N2X, sizeof(buf2_data))))
TEST_ERROR;
for (i = 0; i < N2X; i++)
buf2[i] = buf2_data + (i * N2Y);
- for(i = 0; i < N1X; i++)
- for(j = 0; j < N1Y; j++)
+ for (i = 0; i < N1X; i++)
+ for (j = 0; j < N1Y; j++)
buf1[i][j] = i * N1Y + j;
- if((mem_space = H5Screate_simple(2, dims, maxdims)) < 0) TEST_ERROR;
+ if ((mem_space = H5Screate_simple(2, dims, maxdims)) < 0)
+ TEST_ERROR;
/* Create the file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* Create the dataset creation property list */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if(H5Pset_chunk(cparms, 2, chunk_dims) < 0) TEST_ERROR;
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
+ if (H5Pset_chunk(cparms, 2, chunk_dims) < 0)
+ TEST_ERROR;
/* Test with incremental allocation */
- nerrors += write_data("extendible dataset with incr. allocation", file, "dataset1a", cparms, mem_space) < 0 ? 1 : 0;
+ nerrors +=
+ write_data("extendible dataset with incr. allocation", file, "dataset1a", cparms, mem_space) < 0 ? 1
+ : 0;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += write_data_deprec("extendible dataset with incr. allocation w/deprec. symbols", file, "dataset1b", cparms, mem_space) < 0 ? 1 : 0;
+ nerrors += write_data_deprec("extendible dataset with incr. allocation w/deprec. symbols", file,
+ "dataset1b", cparms, mem_space) < 0
+ ? 1
+ : 0;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Test with early allocation */
- if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR;
- nerrors += write_data("extendible dataset with early allocation", file, "dataset2a", cparms, mem_space) < 0 ? 1 : 0;
+ if (H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR;
+ nerrors +=
+ write_data("extendible dataset with early allocation", file, "dataset2a", cparms, mem_space) < 0 ? 1
+ : 0;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += write_data_deprec("extendible dataset with early allocation w/deprec. symbols", file, "dataset2b", cparms, mem_space) < 0 ? 1 : 0;
+ nerrors += write_data_deprec("extendible dataset with early allocation w/deprec. symbols", file,
+ "dataset2b", cparms, mem_space) < 0
+ ? 1
+ : 0;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- if(H5Pclose(cparms) < 0) TEST_ERROR;
- if(H5Sclose(mem_space) < 0) TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if (H5Pclose(cparms) < 0)
+ TEST_ERROR;
+ if (H5Sclose(mem_space) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if(nerrors) {
+ if (nerrors) {
HDprintf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S");
HDexit(EXIT_FAILURE);
} /* end if */
@@ -323,4 +363,3 @@ error:
HDprintf("*** One or more extend tests failed ***\n");
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/external.c b/test/external.c
index 227eecf..376204a 100644
--- a/test/external.c
+++ b/test/external.c
@@ -23,7 +23,6 @@
#define AEF_EXNAME_MAX_LEN 12 /* string buffer size for external file name */
/* used in __add_external_files() */
-
/*-------------------------------------------------------------------------
* Function: files_have_same_contents
*
@@ -42,11 +41,11 @@ files_have_same_contents(const char *name1, const char *name2)
{
int fd1 = 0;
int fd2 = 0;
- ssize_t n1 = 0;
- ssize_t n2 = 0;
+ ssize_t n1 = 0;
+ ssize_t n2 = 0;
char buf1[1024];
char buf2[1024];
- hbool_t ret = FALSE; /* not equal until proven otherwise */
+ hbool_t ret = FALSE; /* not equal until proven otherwise */
if ((fd1 = HDopen(name1, O_RDONLY)) < 0)
goto out;
@@ -54,39 +53,38 @@ files_have_same_contents(const char *name1, const char *name2)
goto out;
/* Loop until files are empty or we encounter a problem */
- while(1) {
+ while (1) {
HDmemset(buf1, 0, sizeof(buf1));
HDmemset(buf2, 0, sizeof(buf2));
n1 = HDread(fd1, buf1, sizeof(buf1));
- if(n1 < 0 || (size_t)n1 > sizeof(buf1))
+ if (n1 < 0 || (size_t)n1 > sizeof(buf1))
break;
n2 = HDread(fd2, buf2, sizeof(buf2));
- if(n2 < 0 || (size_t)n2 > sizeof(buf2))
+ if (n2 < 0 || (size_t)n2 > sizeof(buf2))
break;
- if(n1 != n2)
+ if (n1 != n2)
break;
- if(n1 == 0 && n2 == 0) {
+ if (n1 == 0 && n2 == 0) {
ret = TRUE;
break;
}
- if(HDmemcmp(buf1, buf2, (size_t)n1))
+ if (HDmemcmp(buf1, buf2, (size_t)n1))
break;
} /* end while */
out:
- if(fd1)
+ if (fd1)
HDclose(fd1);
- if(fd2)
+ if (fd2)
HDclose(fd2);
return ret;
} /* end files_have_same_contents() */
-
/*-------------------------------------------------------------------------
* Function: test_non_extendible
*
@@ -103,51 +101,50 @@ out:
static int
test_non_extendible(hid_t file)
{
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dset = -1; /* dataset */
- hsize_t cur_size[1] = {100}; /* data space current size */
- hsize_t max_size[1] = {100}; /* data space maximum size */
- int n = 0; /* number of external files */
- off_t file_offset = 0; /* external file offset */
- hsize_t file_size = 0; /* sizeof external file segment */
- haddr_t dset_addr = HADDR_UNDEF; /* address of dataset */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dset = -1; /* dataset */
+ hsize_t cur_size[1] = {100}; /* data space current size */
+ hsize_t max_size[1] = {100}; /* data space maximum size */
+ int n = 0; /* number of external files */
+ off_t file_offset = 0; /* external file offset */
+ hsize_t file_size = 0; /* sizeof external file segment */
+ haddr_t dset_addr = HADDR_UNDEF; /* address of dataset */
TESTING("fixed-size data space, exact storage");
/* Create the dataset and close */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0)
+ if (H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0)
FAIL_STACK_ERROR
- if((space = H5Screate_simple(1, cur_size, max_size)) < 0)
+ if ((space = H5Screate_simple(1, cur_size, max_size)) < 0)
FAIL_STACK_ERROR
- if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
/* Read dataset creation information */
- if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Test dataset address. Should be undefined. */
- H5E_BEGIN_TRY {
- dset_addr = H5Dget_offset(dset);
- } H5E_END_TRY;
- if(dset_addr != HADDR_UNDEF)
+ H5E_BEGIN_TRY { dset_addr = H5Dget_offset(dset); }
+ H5E_END_TRY;
+ if (dset_addr != HADDR_UNDEF)
FAIL_STACK_ERROR
/* Check external count */
- if((dcpl = H5Dget_create_plist(dset)) < 0)
+ if ((dcpl = H5Dget_create_plist(dset)) < 0)
FAIL_STACK_ERROR
- if((n = H5Pget_external_count(dcpl)) < 0)
+ if ((n = H5Pget_external_count(dcpl)) < 0)
FAIL_STACK_ERROR
- if(1 != n) {
+ if (1 != n) {
H5_FAILED();
HDputs(" Returned external count is wrong.");
HDprintf(" got: %d\n ans: 1\n", n);
@@ -155,37 +152,41 @@ test_non_extendible(hid_t file)
}
/* Verify external file settings */
- if(H5Pget_external(dcpl, 0, 0, NULL, &file_offset, &file_size) < 0)
+ if (H5Pget_external(dcpl, 0, 0, NULL, &file_offset, &file_size) < 0)
FAIL_STACK_ERROR
- if(file_offset != 0) {
+ if (file_offset != 0) {
H5_FAILED();
HDputs(" Wrong file offset.");
HDprintf(" got: %lu\n ans: 0\n", (unsigned long)file_offset);
goto error;
}
- if(file_size != (max_size[0] * sizeof(int))) {
+ if (file_size != (max_size[0] * sizeof(int))) {
H5_FAILED();
HDputs(" Wrong file size.");
- HDprintf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, (unsigned long)max_size[0]*sizeof(int));
+ HDprintf(" got: %lu\n ans: %lu\n", (unsigned long)file_size,
+ (unsigned long)max_size[0] * sizeof(int));
goto error;
}
/* Done (dataspace was previously closed) */
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(space);
H5Dclose(dset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_non_extendible() */
-
/*-------------------------------------------------------------------------
* Function: test_too_small
*
@@ -203,44 +204,45 @@ test_non_extendible(hid_t file)
static int
test_too_small(hid_t file)
{
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dset = -1; /* dataset */
- hsize_t cur_size[1] = {100}; /* current data space size */
- hsize_t max_size[1] = {100}; /* maximum data space size */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dset = -1; /* dataset */
+ hsize_t cur_size[1] = {100}; /* current data space size */
+ hsize_t max_size[1] = {100}; /* maximum data space size */
TESTING("external storage is too small");
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */
+ if (H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) <
+ 0) /* note -1 */
FAIL_STACK_ERROR
- if((space = H5Screate_simple(1, cur_size, max_size)) < 0)
+ if ((space = H5Screate_simple(1, cur_size, max_size)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- dset = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dset >= 0)
+ H5E_BEGIN_TRY { dset = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (dset >= 0)
FAIL_PUTS_ERROR(" Small external file succeeded instead of failing.");
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Pclose(dcpl);
H5Dclose(dset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_too_small() */
-
/*-------------------------------------------------------------------------
* Function: test_large_enough_current_eventual
*
@@ -259,40 +261,44 @@ test_too_small(hid_t file)
static int
test_large_enough_current_eventual(hid_t file)
{
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dset = -1; /* dataset */
- hsize_t cur_size[1] = {100}; /* current data space size */
- hsize_t max_size[1] = {200}; /* maximum data space size */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dset = -1; /* dataset */
+ hsize_t cur_size[1] = {100}; /* current data space size */
+ hsize_t max_size[1] = {200}; /* maximum data space size */
TESTING("extendible dataspace, exact external size");
- if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0)
+ if (H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0)
FAIL_STACK_ERROR
- if((space = H5Screate_simple(1, cur_size, max_size)) < 0)
+ if ((space = H5Screate_simple(1, cur_size, max_size)) < 0)
FAIL_STACK_ERROR
- if((dset = H5Dcreate2(file, "dset3", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset3", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_large_enough_current_eventual() */
-
/*-------------------------------------------------------------------------
* Function: test_large_enough_current_not_eventual
*
@@ -310,43 +316,46 @@ error:
static int
test_large_enough_current_not_eventual(hid_t file)
{
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dset = -1; /* dataset */
- hsize_t cur_size[1] = {100}; /* current data space size */
- hsize_t max_size[1] = {200}; /* maximum data space size */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dset = -1; /* dataset */
+ hsize_t cur_size[1] = {100}; /* current data space size */
+ hsize_t max_size[1] = {200}; /* maximum data space size */
TESTING("extendible dataspace, external storage is too small");
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */
+ if (H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) <
+ 0) /* note -1 */
FAIL_STACK_ERROR
- if((space = H5Screate_simple(1, cur_size, max_size)) < 0)
+ if ((space = H5Screate_simple(1, cur_size, max_size)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dset >= 0)
+ H5E_BEGIN_TRY { dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (dset >= 0)
FAIL_PUTS_ERROR(" Small external file succeeded instead of failing.");
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_large_enough_current_not_eventual() */
-
/*-------------------------------------------------------------------------
* Function: test_unlimited
*
@@ -364,76 +373,82 @@ test_large_enough_current_not_eventual(hid_t file)
static int
test_unlimited(hid_t file)
{
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dset = -1; /* dataset */
- hsize_t cur_size[1] = {100}; /* data space current size */
- hsize_t max_size[1] = {H5S_UNLIMITED}; /* data space maximum size */
- int n; /* number of external files */
- off_t file_offset; /* external file offset */
- hsize_t file_size; /* sizeof external file segment */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dset = -1; /* dataset */
+ hsize_t cur_size[1] = {100}; /* data space current size */
+ hsize_t max_size[1] = {H5S_UNLIMITED}; /* data space maximum size */
+ int n; /* number of external files */
+ off_t file_offset; /* external file offset */
+ hsize_t file_size; /* sizeof external file segment */
TESTING("unlimited dataspace, unlimited external storage");
/* Create dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0)
+ if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0)
FAIL_STACK_ERROR
- if((space = H5Screate_simple(1, cur_size, max_size)) < 0)
+ if ((space = H5Screate_simple(1, cur_size, max_size)) < 0)
FAIL_STACK_ERROR
- if((dset = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
/* Read dataset creation information */
- if((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((dcpl = H5Dget_create_plist(dset)) < 0)
+ if ((dcpl = H5Dget_create_plist(dset)) < 0)
FAIL_STACK_ERROR
- if((n = H5Pget_external_count(dcpl)) < 0)
+ if ((n = H5Pget_external_count(dcpl)) < 0)
FAIL_STACK_ERROR
- if(1 != n) {
+ if (1 != n) {
H5_FAILED();
HDputs(" Returned external count is wrong.");
HDprintf(" got: %d\n ans: 1\n", n);
goto error;
} /* end if */
- if(H5Pget_external(dcpl, 0, 0, NULL, &file_offset, &file_size) < 0)
+ if (H5Pget_external(dcpl, 0, 0, NULL, &file_offset, &file_size) < 0)
FAIL_STACK_ERROR
- if(file_offset != 0) {
+ if (file_offset != 0) {
H5_FAILED();
HDputs(" Wrong file offset.");
HDprintf(" got: %lu\n ans: 0\n", (unsigned long)file_offset);
goto error;
}
- if(H5F_UNLIMITED != file_size) {
+ if (H5F_UNLIMITED != file_size) {
H5_FAILED();
HDputs(" Wrong file size.");
HDprintf(" got: %lu\n ans: INF\n", (unsigned long)file_size);
goto error;
}
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_unlimited() */
-
/*-------------------------------------------------------------------------
* Function: __add_external_files
*
@@ -450,27 +465,17 @@ test_unlimited(hid_t file)
*-------------------------------------------------------------------------
*/
static int
-__add_external_files(
- hid_t dcpl_id,
- unsigned int n_external_files,
- off_t offset,
- hsize_t max_ext_size)
+__add_external_files(hid_t dcpl_id, unsigned int n_external_files, off_t offset, hsize_t max_ext_size)
{
- char exname[AEF_EXNAME_MAX_LEN+1];
+ char exname[AEF_EXNAME_MAX_LEN + 1];
unsigned int i = 0;
if (dcpl_id < 0) {
return -1;
}
for (i = 0; i < n_external_files; i++) {
- if (HDsnprintf(
- exname,
- AEF_EXNAME_MAX_LEN,
- "ext%d.data",
- i+1)
- > AEF_EXNAME_MAX_LEN)
- {
- HDfprintf(stderr, "External file %d overflows name buffer\n", i+1);
+ if (HDsnprintf(exname, AEF_EXNAME_MAX_LEN, "ext%d.data", i + 1) > AEF_EXNAME_MAX_LEN) {
+ HDfprintf(stderr, "External file %d overflows name buffer\n", i + 1);
fflush(stderr);
return -1;
}
@@ -483,7 +488,6 @@ __add_external_files(
return 0;
} /* end __add_external_files() */
-
/*-------------------------------------------------------------------------
* Function: test_multiple_files
*
@@ -500,9 +504,9 @@ __add_external_files(
static int
test_multiple_files(hid_t file)
{
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* dataspace */
- hid_t dset = -1; /* dataset */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* dataspace */
+ hid_t dset = -1; /* dataset */
hsize_t cur_size[1] = {100}; /* data space current size */
hsize_t max_size[1] = {100}; /* data space maximum size */
hsize_t max_ext_size; /* maximum size of external files */
@@ -510,7 +514,7 @@ test_multiple_files(hid_t file)
TESTING("multiple external files");
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
max_ext_size = (hsize_t)(sizeof(int) * max_size[0] / n_external_files);
@@ -519,20 +523,22 @@ test_multiple_files(hid_t file)
FAIL_STACK_ERROR;
}
- if((space = H5Screate_simple(1, cur_size, max_size)) < 0)
+ if ((space = H5Screate_simple(1, cur_size, max_size)) < 0)
FAIL_STACK_ERROR
- if((dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
/* Re-use space below */
/* ----------------------------------------------
* Verify that too-small external files will fail
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
max_ext_size -= 1;
@@ -541,28 +547,30 @@ test_multiple_files(hid_t file)
FAIL_STACK_ERROR;
}
- H5E_BEGIN_TRY {
- dset = H5Dcreate2(file, "dset7", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dset >= 0)
+ H5E_BEGIN_TRY { dset = H5Dcreate2(file, "dset7", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (dset >= 0)
FAIL_PUTS_ERROR(" Small external files succeeded instead of failing.");
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_multiple_files() */
-
/*-------------------------------------------------------------------------
* Function: test_add_to_unlimited
*
@@ -580,40 +588,38 @@ error:
static int
test_add_to_unlimited(void)
{
- hid_t dcpl = -1; /* dataset creation properties */
- herr_t status = FAIL; /* function return status */
- int n = 0; /* number of external files */
+ hid_t dcpl = -1; /* dataset creation properties */
+ herr_t status = FAIL; /* function return status */
+ int n = 0; /* number of external files */
TESTING("external file following unlimited file");
- if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0)
+ if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); }
+ H5E_END_TRY;
+ if (status >= 0)
FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed.");
- if((n = H5Pget_external_count(dcpl)) < 0)
+ if ((n = H5Pget_external_count(dcpl)) < 0)
FAIL_STACK_ERROR
- if(1 != n)
+ if (1 != n)
FAIL_PUTS_ERROR(" Wrong external file count returned.");
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY { H5Pclose(dcpl); }
+ H5E_END_TRY;
return 1;
} /* end test_add_to_unlimited() */
-
/*-------------------------------------------------------------------------
* Function: test_overflow
*
@@ -631,35 +637,33 @@ test_add_to_unlimited(void)
static int
test_overflow(void)
{
- hid_t dcpl = -1; /* dataset creation properties */
- herr_t status = FAIL; /* return status */
+ hid_t dcpl = -1; /* dataset creation properties */
+ herr_t status = FAIL; /* return status */
TESTING("address overflow in external files");
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0)
+ if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED - 1) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); }
+ H5E_END_TRY;
+ if (status >= 0)
FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed.");
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY { H5Pclose(dcpl); }
+ H5E_END_TRY;
return 1;
} /* end test_overflow() */
-
/*-------------------------------------------------------------------------
* Function: test_read_file_set
*
@@ -676,27 +680,27 @@ test_overflow(void)
static int
test_read_file_set(hid_t fapl)
{
- hid_t file = -1; /* file to write to */
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dset = -1; /* dataset */
- hid_t grp = -1; /* group to emit diagnostics */
- size_t i = 0; /* miscellaneous counter */
- char filename[1024]; /* file names */
- int part[PART_SIZE]; /* raw data buffer (partial) */
- int whole[TOTAL_SIZE]; /* raw data buffer (total) */
- hsize_t cur_size; /* current data space size */
- hid_t hs_space = -1; /* hyperslab data space */
- hsize_t hs_start = 30; /* hyperslab starting offset */
- hsize_t hs_count = 25; /* hyperslab size */
+ hid_t file = -1; /* file to write to */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dset = -1; /* dataset */
+ hid_t grp = -1; /* group to emit diagnostics */
+ size_t i = 0; /* miscellaneous counter */
+ char filename[1024]; /* file names */
+ int part[PART_SIZE]; /* raw data buffer (partial) */
+ int whole[TOTAL_SIZE]; /* raw data buffer (total) */
+ hsize_t cur_size; /* current data space size */
+ hid_t hs_space = -1; /* hyperslab data space */
+ hsize_t hs_start = 30; /* hyperslab starting offset */
+ hsize_t hs_count = 25; /* hyperslab size */
TESTING("read external dataset");
- if(HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
+ if (HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
TEST_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files(FALSE) < 0)
+ if (reset_raw_data_files(FALSE) < 0)
TEST_ERROR
/* Create the file and an initial group. This causes messages about
@@ -704,80 +708,87 @@ test_read_file_set(hid_t fapl)
* output looks like.
*/
h5_fixname(EXT_FNAME[1], fapl, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if (H5Gclose(grp) < 0)
FAIL_STACK_ERROR
- if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
/* Create the dcpl */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < N_EXT_FILES; i++) {
- HDsnprintf(filename, sizeof(filename), "extern_%dr.raw", (int) i + 1);
- if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
+ for (i = 0; i < N_EXT_FILES; i++) {
+ HDsnprintf(filename, sizeof(filename), "extern_%dr.raw", (int)i + 1);
+ if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
FAIL_STACK_ERROR
}
/* Create the dataspace */
cur_size = TOTAL_SIZE;
- if((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
+ if ((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
FAIL_STACK_ERROR
/* Create the dataset */
- if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Read the entire dataset */
HDmemset(whole, 0, sizeof(whole));
- if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
+ if (H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
FAIL_STACK_ERROR
/* Compare data */
- for(i = 0; i < TOTAL_SIZE; i++)
- if(whole[i] != (signed)i)
+ for (i = 0; i < TOTAL_SIZE; i++)
+ if (whole[i] != (signed)i)
FAIL_PUTS_ERROR("Incorrect value(s) read.");
/* Read via a hypserslab in the middle of the dataset */
/* Set up dataspace */
- if((hs_space = H5Scopy(space)) < 0)
+ if ((hs_space = H5Scopy(space)) < 0)
FAIL_STACK_ERROR
- if(H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0)
+ if (H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0)
FAIL_STACK_ERROR
/* Read */
HDmemset(whole, 0, sizeof(whole));
- if(H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, whole) < 0)
+ if (H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, whole) < 0)
FAIL_STACK_ERROR
/* Verify data */
- for(i = (size_t)hs_start; i < (size_t)(hs_start + hs_count); i++) {
- if(whole[i] != (signed)i)
+ for (i = (size_t)hs_start; i < (size_t)(hs_start + hs_count); i++) {
+ if (whole[i] != (signed)i)
FAIL_PUTS_ERROR("Incorrect value(s) read (hyperslab).");
} /* end for */
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Sclose(hs_space) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(hs_space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Gclose(grp);
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(space);
H5Sclose(hs_space);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_read_file_set() */
-
/*-------------------------------------------------------------------------
* Function: test_write_file_set
*
@@ -794,112 +805,117 @@ test_read_file_set(hid_t fapl)
static int
test_write_file_set(hid_t fapl)
{
- hid_t file = -1; /* file to which to write */
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t mem_space = -1; /* memory data space */
- hid_t file_space = -1; /* file data space */
- hid_t dset = -1; /* dataset */
- unsigned i = 0; /* miscellaneous counter */
- int part[PART_SIZE]; /* raw data buffer (partial) */
- int whole[TOTAL_SIZE]; /* raw data buffer (total) */
- hsize_t cur_size = 100; /* current data space size */
- hsize_t max_size = 200; /* maximum data space size */
- hsize_t hs_start = 100; /* hyperslab starting offset */
- hsize_t hs_count = 100; /* hyperslab size */
- char filename[1024]; /* file name */
+ hid_t file = -1; /* file to which to write */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t mem_space = -1; /* memory data space */
+ hid_t file_space = -1; /* file data space */
+ hid_t dset = -1; /* dataset */
+ unsigned i = 0; /* miscellaneous counter */
+ int part[PART_SIZE]; /* raw data buffer (partial) */
+ int whole[TOTAL_SIZE]; /* raw data buffer (total) */
+ hsize_t cur_size = 100; /* current data space size */
+ hsize_t max_size = 200; /* maximum data space size */
+ hsize_t hs_start = 100; /* hyperslab starting offset */
+ hsize_t hs_count = 100; /* hyperslab size */
+ char filename[1024]; /* file name */
TESTING("write external dataset");
- if(HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
+ if (HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
TEST_ERROR
/* Create another file */
h5_fixname(EXT_FNAME[2], fapl, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create the dcpl and external file list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < N_EXT_FILES; i++) {
+ for (i = 0; i < N_EXT_FILES; i++) {
hsize_t size;
- HDsnprintf(filename, sizeof(filename), "extern_%dw.raw", (int) i + 1);
+ HDsnprintf(filename, sizeof(filename), "extern_%dw.raw", (int)i + 1);
- if(i != N_EXT_FILES -1)
+ if (i != N_EXT_FILES - 1)
size = (hsize_t)sizeof(part);
else
size = H5F_UNLIMITED;
- if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), size) < 0)
+ if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), size) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Reset the raw data files */
- if(reset_raw_data_files(FALSE) < 0)
+ if (reset_raw_data_files(FALSE) < 0)
TEST_ERROR
/* Create the dataset */
- if((mem_space = H5Screate_simple(1, &cur_size, &max_size)) < 0)
+ if ((mem_space = H5Screate_simple(1, &cur_size, &max_size)) < 0)
FAIL_STACK_ERROR
- if((file_space = H5Scopy(mem_space)) < 0)
+ if ((file_space = H5Scopy(mem_space)) < 0)
FAIL_STACK_ERROR
- if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, file_space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, file_space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write the entire dataset and compare with the original */
- for(i = 0; i < cur_size; i++)
+ for (i = 0; i < cur_size; i++)
whole[i] = (int)i;
- if(H5Dwrite(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, whole) < 0)
+ if (H5Dwrite(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, whole) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < N_EXT_FILES; i++) {
+ for (i = 0; i < N_EXT_FILES; i++) {
char name1[64], name2[64];
HDsprintf(name1, "extern_%dr.raw", i + 1);
HDsprintf(name2, "extern_%dw.raw", i + 1);
- if(!files_have_same_contents(name1, name2))
+ if (!files_have_same_contents(name1, name2))
FAIL_PUTS_ERROR(" Output differs from expected value.")
} /* end for */
/* Extend the dataset by another 100 elements */
- if(H5Dset_extent(dset, &max_size) < 0)
+ if (H5Dset_extent(dset, &max_size) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(file_space) < 0)
+ if (H5Sclose(file_space) < 0)
FAIL_STACK_ERROR
- if((file_space = H5Dget_space(dset)) < 0)
+ if ((file_space = H5Dget_space(dset)) < 0)
FAIL_STACK_ERROR
/* Write second half of dataset */
- for(i = 0; i < hs_count; i++)
+ for (i = 0; i < hs_count; i++)
whole[i] = 100 + (int)i;
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, whole) < 0)
+ if (H5Dwrite(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, whole) < 0)
FAIL_STACK_ERROR
-
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(mem_space) < 0) FAIL_STACK_ERROR
- if(H5Sclose(file_space) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(mem_space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(file_space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(mem_space);
H5Sclose(file_space);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_write_file_set() */
-
- /*-------------------------------------------------------------------------
+/*-------------------------------------------------------------------------
* Function: test_path_absolute
*
* Purpose: Test absolute filenames for external files.
@@ -919,78 +935,83 @@ test_write_file_set(hid_t fapl)
static int
test_path_absolute(hid_t fapl)
{
- hid_t file = -1; /* file to write to */
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dset = -1; /* dataset */
- size_t i = 0; /* miscellaneous counter */
- char cwdpath[1024]; /* working directory */
- char filename[1088]; /* file name */
- int part[PART_SIZE]; /* raw data buffer (partial) */
- int whole[TOTAL_SIZE]; /* raw data buffer (total) */
- hsize_t cur_size; /* current data space size */
+ hid_t file = -1; /* file to write to */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dset = -1; /* dataset */
+ size_t i = 0; /* miscellaneous counter */
+ char cwdpath[1024]; /* working directory */
+ char filename[1088]; /* file name */
+ int part[PART_SIZE]; /* raw data buffer (partial) */
+ int whole[TOTAL_SIZE]; /* raw data buffer (total) */
+ hsize_t cur_size; /* current data space size */
TESTING("absolute filenames for external file");
h5_fixname(EXT_FNAME[3], fapl, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files(FALSE) < 0)
+ if (reset_raw_data_files(FALSE) < 0)
TEST_ERROR
/* Create the dcpl */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
+ if (NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
TEST_ERROR
- for(i = 0; i < N_EXT_FILES; i++) {
- HDsnprintf(filename, sizeof(filename), "%s%sextern_%dr.raw", cwdpath, H5_DIR_SEPS, (int) i + 1);
+ for (i = 0; i < N_EXT_FILES; i++) {
+ HDsnprintf(filename, sizeof(filename), "%s%sextern_%dr.raw", cwdpath, H5_DIR_SEPS, (int)i + 1);
#if defined(H5_HAVE_WINDOW_PATH)
/* For windows, test path-absolute case (\dir\file.raw) for the second file */
- if(i == 1)
+ if (i == 1)
HDsnprintf(filename, sizeof(filename), "%s%sextern_%dr.raw", cwdpath + 2, H5_DIR_SEPS, i + 1);
#endif
- if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
+ if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
FAIL_STACK_ERROR
} /* end for */
/* create the dataspace */
cur_size = TOTAL_SIZE;
- if((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
+ if ((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
FAIL_STACK_ERROR
/* create the dataset */
- if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Read the entire dataset and compare with the original */
HDmemset(whole, 0, sizeof(whole));
- if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
+ if (H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < TOTAL_SIZE; i++)
- if(whole[i] != (signed)i)
+ for (i = 0; i < TOTAL_SIZE; i++)
+ if (whole[i] != (signed)i)
FAIL_PUTS_ERROR("Incorrect value(s) read.");
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(space);
H5Pclose(dcpl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_path_absolute() */
-
/*-------------------------------------------------------------------------
* Function: test_path_relative
*
@@ -1009,73 +1030,78 @@ error:
static int
test_path_relative(hid_t fapl)
{
- hid_t file = -1; /* file to write to */
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dset = -1; /* dataset */
- size_t i = 0; /* miscellaneous counters */
- char filename[1024]; /* file name */
- int part[PART_SIZE]; /* raw data buffer (partial) */
- int whole[TOTAL_SIZE]; /* raw data buffer (total) */
- hsize_t cur_size; /* current data space size */
+ hid_t file = -1; /* file to write to */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dset = -1; /* dataset */
+ size_t i = 0; /* miscellaneous counters */
+ char filename[1024]; /* file name */
+ int part[PART_SIZE]; /* raw data buffer (partial) */
+ int whole[TOTAL_SIZE]; /* raw data buffer (total) */
+ hsize_t cur_size; /* current data space size */
TESTING("filenames relative to current directory for external file");
- if(HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
+ if (HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
TEST_ERROR
if (HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR;
h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
/* Reset the raw data files */
- if(reset_raw_data_files(FALSE) < 0)
+ if (reset_raw_data_files(FALSE) < 0)
TEST_ERROR
/* Create the dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
for (i = 0; i < N_EXT_FILES; i++) {
HDsnprintf(filename, sizeof(filename), "extern_%dr.raw", (int)i + 1);
- if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
+ if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
FAIL_STACK_ERROR
} /* end for */
cur_size = TOTAL_SIZE;
- if((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
+ if ((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
FAIL_STACK_ERROR
- if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Read the entire dataset and compare with the original */
HDmemset(whole, 0, sizeof(whole));
- if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
+ if (H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < TOTAL_SIZE; i++)
- if(whole[i] != (signed)i)
+ for (i = 0; i < TOTAL_SIZE; i++)
+ if (whole[i] != (signed)i)
FAIL_PUTS_ERROR("Incorrect value(s) read.");
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(space);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_path_relative() */
-
/*-------------------------------------------------------------------------
* Function: test_path_relative_cwd
*
@@ -1096,130 +1122,138 @@ error:
static int
test_path_relative_cwd(hid_t fapl)
{
- hid_t file = -1; /* file to write to */
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dapl = -1; /* dataset access property list */
- hid_t dapl2 = -1; /* copy of dapl */
- hid_t dset = -1; /* dataset */
- hid_t dset2 = -1; /* dataset, opened a second time */
- hid_t dset3 = -1; /* dataset, opened with different prefix */
- size_t i = 0; /* miscellaneous counters */
- char filename[1024]; /* file name */
- int part[PART_SIZE]; /* raw data buffer (partial) */
- int whole[TOTAL_SIZE]; /* raw data buffer (total) */
- hsize_t cur_size; /* current data space size */
- char buffer[1024]; /* buffer to read efile_prefix */
+ hid_t file = -1; /* file to write to */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dapl = -1; /* dataset access property list */
+ hid_t dapl2 = -1; /* copy of dapl */
+ hid_t dset = -1; /* dataset */
+ hid_t dset2 = -1; /* dataset, opened a second time */
+ hid_t dset3 = -1; /* dataset, opened with different prefix */
+ size_t i = 0; /* miscellaneous counters */
+ char filename[1024]; /* file name */
+ int part[PART_SIZE]; /* raw data buffer (partial) */
+ int whole[TOTAL_SIZE]; /* raw data buffer (total) */
+ hsize_t cur_size; /* current data space size */
+ char buffer[1024]; /* buffer to read efile_prefix */
TESTING("filenames relative to HDF5 file for external file");
- if(HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
+ if (HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
TEST_ERROR
- if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
+ if (HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR;
h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
/* Reset the raw data files */
- if(reset_raw_data_files(FALSE) < 0)
+ if (reset_raw_data_files(FALSE) < 0)
TEST_ERROR
/* Create the dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < N_EXT_FILES; i++) {
+ for (i = 0; i < N_EXT_FILES; i++) {
HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int)i + 1);
- if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
+ if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
FAIL_STACK_ERROR
} /* end for */
cur_size = TOTAL_SIZE;
- if((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
+ if ((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
FAIL_STACK_ERROR
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_efile_prefix(dapl, "${ORIGIN}") < 0)
+ if (H5Pset_efile_prefix(dapl, "${ORIGIN}") < 0)
FAIL_STACK_ERROR
- if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0)
+ if (H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0)
FAIL_STACK_ERROR
- if(HDstrcmp(buffer, "${ORIGIN}") != 0)
+ if (HDstrcmp(buffer, "${ORIGIN}") != 0)
FAIL_PUTS_ERROR("efile prefix not set correctly");
- if((dapl2 = H5Pcopy(dapl)) < 0)
+ if ((dapl2 = H5Pcopy(dapl)) < 0)
FAIL_STACK_ERROR
/* Create dataset */
- if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl2)) < 0)
+ if ((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl2)) < 0)
FAIL_STACK_ERROR
/* Reopen dataset with same efile_prefix property */
- if((dset2 = H5Dopen2(file, "dset1", dapl2)) < 0)
+ if ((dset2 = H5Dopen2(file, "dset1", dapl2)) < 0)
FAIL_STACK_ERROR
/* Reopen dataset with different efile_prefix property */
- if(H5Pset_efile_prefix(dapl, "//") < 0)
+ if (H5Pset_efile_prefix(dapl, "//") < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- dset3 = H5Dopen2(file, "dset1", dapl);
- } H5E_END_TRY;
- if(dset3 >= 0)
+ H5E_BEGIN_TRY { dset3 = H5Dopen2(file, "dset1", dapl); }
+ H5E_END_TRY;
+ if (dset3 >= 0)
FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded");
/* Read the entire dataset and compare with the original */
HDmemset(whole, 0, sizeof(whole));
- if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
+ if (H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < TOTAL_SIZE; i++)
- if(whole[i] != (signed)i)
+ for (i = 0; i < TOTAL_SIZE; i++)
+ if (whole[i] != (signed)i)
FAIL_PUTS_ERROR("Incorrect value(s) read.");
/* Close dataset */
- if(H5Dclose(dset2) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
/* Open dataset (use a differend prefix than for create.
* This works because the dataset was closed.
*/
- if(H5Pset_efile_prefix(dapl2, "${ORIGIN}/.") < 0)
+ if (H5Pset_efile_prefix(dapl2, "${ORIGIN}/.") < 0)
FAIL_STACK_ERROR
- if((dset = H5Dopen2(file, "dset1", dapl2)) < 0)
+ if ((dset = H5Dopen2(file, "dset1", dapl2)) < 0)
FAIL_STACK_ERROR
/* Reopen dataset with same efile_prefix property */
- if((dset2 = H5Dopen2(file, "dset1", dapl2)) < 0)
+ if ((dset2 = H5Dopen2(file, "dset1", dapl2)) < 0)
FAIL_STACK_ERROR
/* Reopen dataset with different efile_prefix property */
- if(H5Pset_efile_prefix(dapl, NULL) < 0)
+ if (H5Pset_efile_prefix(dapl, NULL) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- dset3 = H5Dopen2(file, "dset1", dapl);
- } H5E_END_TRY;
- if(dset3 >= 0)
+ H5E_BEGIN_TRY { dset3 = H5Dopen2(file, "dset1", dapl); }
+ H5E_END_TRY;
+ if (dset3 >= 0)
FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded");
/* Read the entire dataset and compare with the original */
HDmemset(whole, 0, sizeof(whole));
- if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
+ if (H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < TOTAL_SIZE; i++)
- if(whole[i] != (signed)i)
+ for (i = 0; i < TOTAL_SIZE; i++)
+ if (whole[i] != (signed)i)
FAIL_PUTS_ERROR("Incorrect value(s) read.");
- if(H5Dclose(dset2) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dapl2) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dapl2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dapl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dapl2);
H5Pclose(dapl);
H5Dclose(dset3);
@@ -1228,11 +1262,11 @@ error:
H5Pclose(dcpl);
H5Sclose(space);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_path_relative_cwd() */
-
/*-------------------------------------------------------------------------
* Function: test_h5d_get_access_plist
*
@@ -1249,89 +1283,95 @@ error:
static int
test_h5d_get_access_plist(hid_t fapl_id)
{
- hid_t fid = -1; /* file to write to */
- hid_t dcpl_id = -1; /* dataset creation properties */
- hid_t dapl_id = -1; /* dataset access properties */
- hid_t sid = -1; /* data space */
- hid_t did = -1; /* dataset */
- hsize_t dims = 0; /* dataset size */
- char *buffer = NULL; /* saved prefix name from dapl */
- char filename[1024]; /* file names */
+ hid_t fid = -1; /* file to write to */
+ hid_t dcpl_id = -1; /* dataset creation properties */
+ hid_t dapl_id = -1; /* dataset access properties */
+ hid_t sid = -1; /* data space */
+ hid_t did = -1; /* dataset */
+ hsize_t dims = 0; /* dataset size */
+ char * buffer = NULL; /* saved prefix name from dapl */
+ char filename[1024]; /* file names */
TESTING("H5Dget_access_plist() returns correct prefix");
- if(HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
+ if (HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0)
TEST_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files(FALSE) < 0)
+ if (reset_raw_data_files(FALSE) < 0)
TEST_ERROR
/* Create the file */
h5_fixname(EXT_FNAME[5], fapl_id, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
FAIL_STACK_ERROR
/* Create the dcpl and set external storage */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_external(dcpl_id, "extern_1r.raw", (off_t)0, (hsize_t)0) < 0)
+ if (H5Pset_external(dcpl_id, "extern_1r.raw", (off_t)0, (hsize_t)0) < 0)
FAIL_STACK_ERROR
/* Create the dapl and set the prefix */
- if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_efile_prefix(dapl_id, "someprefix") < 0)
+ if (H5Pset_efile_prefix(dapl_id, "someprefix") < 0)
FAIL_STACK_ERROR
/* Create the dataset */
- if((sid = H5Screate_simple(1, &dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, &dims, NULL)) < 0)
FAIL_STACK_ERROR
- if((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, dapl_id)) < 0)
+ if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, dapl_id)) < 0)
FAIL_STACK_ERROR
/* Close the dapl */
- if(H5Pclose(dapl_id) < 0)
+ if (H5Pclose(dapl_id) < 0)
FAIL_STACK_ERROR
dapl_id = -1;
/* Get a data access property list from the dataset */
- if((dapl_id = H5Dget_access_plist(did)) < 0)
+ if ((dapl_id = H5Dget_access_plist(did)) < 0)
FAIL_STACK_ERROR
/* Check the value for the external prefix */
- if((buffer = (char *)HDcalloc((size_t)64, sizeof(char))) == NULL)
+ if ((buffer = (char *)HDcalloc((size_t)64, sizeof(char))) == NULL)
TEST_ERROR
- if(H5Pget_efile_prefix(dapl_id, buffer, (size_t)64) < 0)
+ if (H5Pget_efile_prefix(dapl_id, buffer, (size_t)64) < 0)
FAIL_STACK_ERROR
- if(HDstrcmp(buffer, "someprefix") != 0)
+ if (HDstrcmp(buffer, "someprefix") != 0)
FAIL_PUTS_ERROR("external file prefix from dapl incorrect");
/* Close everything */
HDfree(buffer);
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl_id) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dapl_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dapl_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- if(buffer)
+error:
+ if (buffer)
HDfree(buffer);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Pclose(dcpl_id);
H5Pclose(dapl_id);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_h5d_get_access_plist() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1347,13 +1387,13 @@ test_h5d_get_access_plist(hid_t fapl_id)
int
main(void)
{
- hid_t fapl_id_old = -1; /* file access properties (old format) */
- hid_t fapl_id_new = -1; /* file access properties (new format) */
- hid_t fid = -1; /* file for test_1* functions */
- hid_t gid = -1; /* group to emit diagnostics */
- char filename[1024]; /* file name for test_1* funcs */
- unsigned latest_format; /* default or latest file format */
- int nerrors = 0; /* number of errors */
+ hid_t fapl_id_old = -1; /* file access properties (old format) */
+ hid_t fapl_id_new = -1; /* file access properties (new format) */
+ hid_t fid = -1; /* file for test_1* functions */
+ hid_t gid = -1; /* group to emit diagnostics */
+ char filename[1024]; /* file name for test_1* funcs */
+ unsigned latest_format; /* default or latest file format */
+ int nerrors = 0; /* number of errors */
h5_reset();
@@ -1362,9 +1402,9 @@ main(void)
h5_fixname(EXT_FNAME[0], fapl_id_old, filename, sizeof(filename));
/* Copy and set up a fapl for the latest file format */
- if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0)
+ if ((fapl_id_new = H5Pcopy(fapl_id_old)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* The file format doesn't matter for this test */
@@ -1372,11 +1412,11 @@ main(void)
HDputs("");
/* Test with old & new format groups */
- for(latest_format = FALSE; latest_format <= TRUE; latest_format++) {
+ for (latest_format = FALSE; latest_format <= TRUE; latest_format++) {
hid_t current_fapl_id = -1;
/* Set the fapl for different file formats */
- if(latest_format) {
+ if (latest_format) {
HDputs("\nTesting with the latest file format:");
current_fapl_id = fapl_id_new;
}
@@ -1386,13 +1426,14 @@ main(void)
}
/* Create the common file used by some of the tests */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, current_fapl_id)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, current_fapl_id)) < 0)
FAIL_STACK_ERROR
/* Create a group that will be used in the file set read test */
- if((gid = H5Gcreate2(fid, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* These tests use a common file */
nerrors += test_non_extendible(fid);
@@ -1417,19 +1458,22 @@ main(void)
nerrors += (h5_verify_cached_stabs(EXT_FNAME, current_fapl_id) < 0 ? 1 : 0);
/* Close the common file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
} /* end for old and new format */
- if(nerrors > 0) goto error;
+ if (nerrors > 0)
+ goto error;
/* Close the new ff fapl. h5_cleanup will take care of the old ff fapl */
- if(H5Pclose(fapl_id_new) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl_id_new) < 0)
+ FAIL_STACK_ERROR
HDputs("All external storage tests passed.");
/* Clean up files used by file set tests */
- if(h5_cleanup(EXT_FNAME, fapl_id_old)) {
+ if (h5_cleanup(EXT_FNAME, fapl_id_old)) {
HDremove("extern_1r.raw");
HDremove("extern_2r.raw");
HDremove("extern_3r.raw");
@@ -1446,14 +1490,15 @@ main(void)
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fapl_id_old);
H5Pclose(fapl_id_new);
H5Gclose(gid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
nerrors = MAX(1, nerrors);
HDprintf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s");
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/external_common.c b/test/external_common.c
index 85fdfa0..d0383b1 100644
--- a/test/external_common.c
+++ b/test/external_common.c
@@ -20,7 +20,6 @@
#include "external_common.h"
-
/*-------------------------------------------------------------------------
* Function: reset_raw_data_files
*
@@ -37,51 +36,51 @@
herr_t
reset_raw_data_files(hbool_t is_env)
{
- int fd = 0; /* external file descriptor */
- size_t i, j; /* iterators */
- hssize_t n; /* bytes of I/O */
- char filename[1024]; /* file name */
- int data[PART_SIZE]; /* raw data buffer */
- uint8_t *garbage = NULL; /* buffer of garbage data */
- size_t garbage_count; /* size of garbage buffer */
- size_t garbage_bytes; /* # of garbage bytes written to file */
+ int fd = 0; /* external file descriptor */
+ size_t i, j; /* iterators */
+ hssize_t n; /* bytes of I/O */
+ char filename[1024]; /* file name */
+ int data[PART_SIZE]; /* raw data buffer */
+ uint8_t *garbage = NULL; /* buffer of garbage data */
+ size_t garbage_count; /* size of garbage buffer */
+ size_t garbage_bytes; /* # of garbage bytes written to file */
/* Set up garbage buffer */
garbage_count = N_EXT_FILES * GARBAGE_PER_FILE;
- if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t))))
+ if (NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t))))
goto error;
- for(i = 0; i < garbage_count; i++)
+ for (i = 0; i < garbage_count; i++)
garbage[i] = 0xFF;
/* The *r files are pre-filled with data and are used to
* verify that read operations work correctly.
*/
- for(i = 0; i < N_EXT_FILES; i++) {
+ for (i = 0; i < N_EXT_FILES; i++) {
/* Open file */
- if(is_env)
+ if (is_env)
HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1);
else
HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
/* Write garbage data to the file. This allows us to test the
* the ability to set an offset in the raw data file.
*/
garbage_bytes = i * 10;
- n = HDwrite(fd, garbage, garbage_bytes);
- if(n < 0 || (size_t)n != garbage_bytes)
+ n = HDwrite(fd, garbage, garbage_bytes);
+ if (n < 0 || (size_t)n != garbage_bytes)
goto error;
/* Fill array with data */
- for(j = 0; j < PART_SIZE; j++) {
+ for (j = 0; j < PART_SIZE; j++) {
data[j] = (int)(i * 25 + j);
} /* end for */
/* Write raw data to the file. */
n = HDwrite(fd, data, sizeof(data));
- if(n != sizeof(data))
+ if (n != sizeof(data))
goto error;
/* Close this file */
@@ -93,22 +92,22 @@ reset_raw_data_files(hbool_t is_env)
* used to verify that write operations work correctly. The individual
* tests fill in the actual data.
*/
- for(i = 0; i < N_EXT_FILES; i++) {
+ for (i = 0; i < N_EXT_FILES; i++) {
/* Open file */
- if(is_env)
+ if (is_env)
HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1);
else
HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
/* Write garbage data to the file. This allows us to test the
* the ability to set an offset in the raw data file.
*/
garbage_bytes = i * 10;
- n = HDwrite(fd, garbage, garbage_bytes);
- if(n < 0 || (size_t)n != garbage_bytes)
+ n = HDwrite(fd, garbage, garbage_bytes);
+ if (n < 0 || (size_t)n != garbage_bytes)
goto error;
/* Close this file */
@@ -119,9 +118,9 @@ reset_raw_data_files(hbool_t is_env)
return SUCCEED;
error:
- if(fd)
+ if (fd)
HDclose(fd);
- if(garbage)
+ if (garbage)
HDfree(garbage);
return FAIL;
}
diff --git a/test/external_common.h b/test/external_common.h
index 3633ea3..a53bb3b 100644
--- a/test/external_common.h
+++ b/test/external_common.h
@@ -26,11 +26,10 @@
/* A similar collection of files is used for the tests that
* perform file I/O.
*/
-#define N_EXT_FILES 4
-#define PART_SIZE 25
-#define TOTAL_SIZE 100
-#define GARBAGE_PER_FILE 10
-
+#define N_EXT_FILES 4
+#define PART_SIZE 25
+#define TOTAL_SIZE 100
+#define GARBAGE_PER_FILE 10
#ifdef __cplusplus
extern "C" {
diff --git a/test/external_env.c b/test/external_env.c
index 262cde2..940bf82 100644
--- a/test/external_env.c
+++ b/test/external_env.c
@@ -16,11 +16,7 @@
*/
#include "external_common.h"
-static const char *EXT_ENV_FNAME[] = {
- "extern_env_dir/env_file_1",
- NULL
-};
-
+static const char *EXT_ENV_FNAME[] = {"extern_env_dir/env_file_1", NULL};
/*-------------------------------------------------------------------------
* Function: test_path_env
@@ -46,87 +42,93 @@ static const char *EXT_ENV_FNAME[] = {
static int
test_path_env(hid_t fapl)
{
- hid_t file = -1; /* file to write to */
- hid_t dcpl = -1; /* dataset creation properties */
- hid_t space = -1; /* data space */
- hid_t dapl = -1; /* dataset access property list */
- hid_t dset = -1; /* dataset */
- size_t i; /* miscellaneous counters */
- char filename[1024]; /* file name */
- int part[PART_SIZE]; /* raw data buffer (partial) */
- int whole[TOTAL_SIZE]; /* raw data buffer (total) */
- hsize_t cur_size; /* current data space size */
- char buffer[1024]; /* buffer to read efile_prefix */
+ hid_t file = -1; /* file to write to */
+ hid_t dcpl = -1; /* dataset creation properties */
+ hid_t space = -1; /* data space */
+ hid_t dapl = -1; /* dataset access property list */
+ hid_t dset = -1; /* dataset */
+ size_t i; /* miscellaneous counters */
+ char filename[1024]; /* file name */
+ int part[PART_SIZE]; /* raw data buffer (partial) */
+ int whole[TOTAL_SIZE]; /* raw data buffer (total) */
+ hsize_t cur_size; /* current data space size */
+ char buffer[1024]; /* buffer to read efile_prefix */
TESTING("prefix in HDF5_EXTFILE_PREFIX");
- if(HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST)
+ if (HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR;
h5_fixname(EXT_ENV_FNAME[0], fapl, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Reset the raw data files */
- if(reset_raw_data_files(TRUE) < 0)
+ if (reset_raw_data_files(TRUE) < 0)
TEST_ERROR
/* Create the dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < N_EXT_FILES; i++) {
- HDsnprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int) i + 1);
- if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
+ for (i = 0; i < N_EXT_FILES; i++) {
+ HDsnprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int)i + 1);
+ if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
FAIL_STACK_ERROR
} /* end for */
cur_size = TOTAL_SIZE;
- if((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
+ if ((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
FAIL_STACK_ERROR
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Set prefix to a nonexistent directory, will be overwritten by environment variable */
- if(H5Pset_efile_prefix(dapl, "someprefix") < 0)
+ if (H5Pset_efile_prefix(dapl, "someprefix") < 0)
FAIL_STACK_ERROR
- if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0)
+ if (H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0)
FAIL_STACK_ERROR
- if(HDstrcmp(buffer, "someprefix") != 0)
+ if (HDstrcmp(buffer, "someprefix") != 0)
FAIL_PUTS_ERROR("efile prefix not set correctly");
/* Create dataset */
- if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0)
FAIL_STACK_ERROR
/* Read the entire dataset and compare with the original */
HDmemset(whole, 0, sizeof(whole));
- if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
+ if (H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0)
FAIL_STACK_ERROR
- for(i = 0; i < TOTAL_SIZE; i++)
- if(whole[i] != (signed)i)
+ for (i = 0; i < TOTAL_SIZE; i++)
+ if (whole[i] != (signed)i)
FAIL_PUTS_ERROR("Incorrect value(s) read.");
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dapl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dapl);
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(space);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_path_env() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -142,12 +144,12 @@ error:
int
main(void)
{
- hid_t fapl_id_old = -1; /* file access properties (old format) */
- hid_t fapl_id_new = -1; /* file access properties (new format) */
- hid_t fid = -1; /* file for test_1* functions */
- hid_t gid = -1; /* group to emit diagnostics */
- unsigned latest_format; /* default or latest file format */
- int nerrors = 0; /* number of errors */
+ hid_t fapl_id_old = -1; /* file access properties (old format) */
+ hid_t fapl_id_new = -1; /* file access properties (new format) */
+ hid_t fid = -1; /* file for test_1* functions */
+ hid_t gid = -1; /* group to emit diagnostics */
+ unsigned latest_format; /* default or latest file format */
+ int nerrors = 0; /* number of errors */
h5_reset();
@@ -155,17 +157,17 @@ main(void)
fapl_id_old = h5_fileaccess();
/* Copy and set up a fapl for the latest file format */
- if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0)
+ if ((fapl_id_new = H5Pcopy(fapl_id_old)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Test with old & new format groups */
- for(latest_format = FALSE; latest_format <= TRUE; latest_format++) {
+ for (latest_format = FALSE; latest_format <= TRUE; latest_format++) {
hid_t current_fapl_id = -1;
/* Set the fapl for different file formats */
- if(latest_format) {
+ if (latest_format) {
HDputs("\nTesting with the latest file format:");
current_fapl_id = fapl_id_new;
} /* end if */
@@ -177,15 +179,17 @@ main(void)
nerrors += test_path_env(current_fapl_id);
} /* end for */
- if(nerrors > 0) goto error;
+ if (nerrors > 0)
+ goto error;
/* Close the new ff fapl. h5_cleanup will take care of the old ff fapl */
- if(H5Pclose(fapl_id_new) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl_id_new) < 0)
+ FAIL_STACK_ERROR
HDputs("All external storage tests passed.");
/* Clean up files used by file set tests */
- if(h5_cleanup(EXT_ENV_FNAME, fapl_id_old)) {
+ if (h5_cleanup(EXT_ENV_FNAME, fapl_id_old)) {
HDremove("extern_env_1r.raw");
HDremove("extern_env_2r.raw");
HDremove("extern_env_3r.raw");
@@ -202,14 +206,15 @@ main(void)
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fapl_id_old);
H5Pclose(fapl_id_new);
H5Gclose(gid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
nerrors = MAX(1, nerrors);
HDprintf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s");
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/external_fname.h b/test/external_fname.h
index f5aca6d..a4f51c1 100644
--- a/test/external_fname.h
+++ b/test/external_fname.h
@@ -23,15 +23,7 @@
/* Include test header files */
#include "h5test.h"
-static const char *EXT_FNAME[] = {
- "extern_1",
- "extern_2",
- "extern_3",
- "extern_4",
- "extern_dir/file_1",
- "extern_5",
- NULL
-};
+static const char *EXT_FNAME[] = {"extern_1", "extern_2", "extern_3", "extern_4",
+ "extern_dir/file_1", "extern_5", NULL};
#endif /* _EXTERNAL_FNAME_H */
-
diff --git a/test/farray.c b/test/farray.c
index b29768e..b6a6c31 100644
--- a/test/farray.c
+++ b/test/farray.c
@@ -20,64 +20,61 @@
* This file needs to access private datatypes from the H5FA package.
* This file also needs to access the fixed array testing code.
*/
-#define H5FA_FRIEND /*suppress error about including H5FApkg */
+#define H5FA_FRIEND /*suppress error about including H5FApkg */
#define H5FA_TESTING
-#include "H5FApkg.h" /* Fixed Arrays */
+#include "H5FApkg.h" /* Fixed Arrays */
/* Other private headers that this test requires */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Iprivate.h" /* IDs */
-#include "H5VMprivate.h" /* Vectors and arrays */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* Local macros */
/* Max. testfile name length */
-#define FARRAY_FILENAME_LEN 1024
+#define FARRAY_FILENAME_LEN 1024
/* Fixed array creation values */
-#define ELMT_SIZE sizeof(uint64_t)
-#define MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* 2^10 = 1024 elements per data block page */
+#define ELMT_SIZE sizeof(uint64_t)
+#define MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* 2^10 = 1024 elements per data block page */
/* Testing # of elements in the Fixed Array */
-#define TEST_NELMTS 20000
+#define TEST_NELMTS 20000
/* Convenience macros for computing earray state */
-#define FA_HDR_SIZE 28 /* hard-coded */
-#define DBLOCK_PREFIX 18 /* hard-coded */
+#define FA_HDR_SIZE 28 /* hard-coded */
+#define DBLOCK_PREFIX 18 /* hard-coded */
/* 4 giga-elements: max chunk size */
-#define MAX_NELMTS ((unsigned long long)4*1024*1024*1024) /* 4 giga-elements */
+#define MAX_NELMTS ((unsigned long long)4 * 1024 * 1024 * 1024) /* 4 giga-elements */
/* Iterator parameter values */
-#define FA_CYC_COUNT 4
-
+#define FA_CYC_COUNT 4
/* Local typedefs */
/* Types of tests to perform */
typedef enum {
- FARRAY_TEST_NORMAL, /* "Normal" test, with no testing parameters set */
- FARRAY_TEST_REOPEN, /* Set the reopen_array flag */
- FARRAY_TEST_NTESTS /* The number of test types, must be last */
+ FARRAY_TEST_NORMAL, /* "Normal" test, with no testing parameters set */
+ FARRAY_TEST_REOPEN, /* Set the reopen_array flag */
+ FARRAY_TEST_NTESTS /* The number of test types, must be last */
} farray_test_type_t;
/* Types of iteration to perform */
typedef enum {
- FARRAY_ITER_FW, /* "Forward" iteration */
- FARRAY_ITER_RV, /* "Reverse" iteration */
- FARRAY_ITER_RND, /* "Random" iteration */
- FARRAY_ITER_CYC, /* "Cyclic" iteration */
- FARRAY_ITER_NITERS /* The number of iteration types, must be last */
+ FARRAY_ITER_FW, /* "Forward" iteration */
+ FARRAY_ITER_RV, /* "Reverse" iteration */
+ FARRAY_ITER_RND, /* "Random" iteration */
+ FARRAY_ITER_CYC, /* "Cyclic" iteration */
+ FARRAY_ITER_NITERS /* The number of iteration types, must be last */
} farray_iter_type_t;
-
/* Fixed array state information */
typedef struct farray_state_t {
- hsize_t hdr_size; /* Size of header */
- hsize_t dblk_size; /* Size of data block */
- hsize_t nelmts; /* # of elements */
+ hsize_t hdr_size; /* Size of header */
+ hsize_t dblk_size; /* Size of data block */
+ hsize_t nelmts; /* # of elements */
} farray_state_t;
/* Forward decl. */
@@ -86,25 +83,20 @@ typedef struct farray_test_param_t farray_test_param_t;
/* Fixed array iterator class */
typedef struct farray_iter_t {
void *(*init)(const H5FA_create_t *cparam, const farray_test_param_t *tparam,
- hsize_t cnt); /* Initialize/allocate iterator private info */
- hssize_t (*next)(void *info); /* Get the next element to test */
- herr_t (*term)(void *info); /* Shutdown/free iterator private info */
+ hsize_t cnt); /* Initialize/allocate iterator private info */
+ hssize_t (*next)(void *info); /* Get the next element to test */
+ herr_t (*term)(void *info); /* Shutdown/free iterator private info */
} farray_iter_t;
-
/* Testing parameters */
struct farray_test_param_t {
- farray_test_type_t reopen_array; /* Whether to re-open the array during the test */
- hsize_t nelmts; /* # of elements to set for the fixed array */
- const farray_iter_t *fiter; /* Iterator to use for this test */
+ farray_test_type_t reopen_array; /* Whether to re-open the array during the test */
+ hsize_t nelmts; /* # of elements to set for the fixed array */
+ const farray_iter_t *fiter; /* Iterator to use for this test */
};
/* Local variables */
-const char *FILENAME[] = {
- "farray",
- "farray_tmp",
- NULL
-};
+const char *FILENAME[] = {"farray", "farray_tmp", NULL};
/* Filename to use for all tests */
char filename_g[FARRAY_FILENAME_LEN];
@@ -112,7 +104,6 @@ char filename_g[FARRAY_FILENAME_LEN];
/* Empty file size */
h5_stat_size_t empty_size_g;
-
/*-------------------------------------------------------------------------
* Function: init_cparam
*
@@ -128,15 +119,14 @@ init_cparam(H5FA_create_t *cparam, farray_test_param_t *tparam)
/* Wipe out background */
HDmemset(cparam, 0, sizeof(*cparam));
- cparam->cls = H5FA_CLS_TEST;
- cparam->raw_elmt_size = ELMT_SIZE;
- cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS;
- cparam->nelmts = tparam->nelmts;
+ cparam->cls = H5FA_CLS_TEST;
+ cparam->raw_elmt_size = ELMT_SIZE;
+ cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS;
+ cparam->nelmts = tparam->nelmts;
return SUCCEED;
} /* init_cparam() */
-
/*-------------------------------------------------------------------------
* Function: create_file
*
@@ -168,7 +158,6 @@ error:
return FAIL;
} /* create_file() */
-
/*-------------------------------------------------------------------------
* Function: check_stats
*
@@ -181,7 +170,7 @@ error:
static herr_t
check_stats(const H5FA_t *fa, const farray_state_t *state)
{
- H5FA_stat_t farray_stats; /* Statistics about the array */
+ H5FA_stat_t farray_stats; /* Statistics about the array */
/* Get statistics for fixed array and verify they are correct */
if (H5FA_get_stats(fa, &farray_stats) < 0)
@@ -190,19 +179,19 @@ check_stats(const H5FA_t *fa, const farray_state_t *state)
/* Compare information */
if (farray_stats.hdr_size != state->hdr_size) {
HDfprintf(stdout, "farray_stats.hdr_size = %" PRIuHSIZE ", state->hdr_size = %" PRIuHSIZE "\n",
- farray_stats.hdr_size, state->hdr_size);
+ farray_stats.hdr_size, state->hdr_size);
TEST_ERROR
}
if (farray_stats.dblk_size != state->dblk_size) {
HDfprintf(stdout, "farray_stats.dblk_size = %" PRIuHSIZE ", state->dblk_size = %" PRIuHSIZE "\n",
- farray_stats.dblk_size, state->dblk_size);
+ farray_stats.dblk_size, state->dblk_size);
TEST_ERROR
}
if (farray_stats.nelmts != state->nelmts) {
HDfprintf(stdout, "farray_stats.nelmts = %" PRIuHSIZE ", state->nelmts = %" PRIuHSIZE "\n",
- farray_stats.nelmts, state->nelmts);
+ farray_stats.nelmts, state->nelmts);
TEST_ERROR
}
@@ -213,7 +202,6 @@ error:
return FAIL;
} /* check_stats() */
-
/*-------------------------------------------------------------------------
* Function: set_fa_state
*
@@ -226,7 +214,7 @@ error:
static herr_t
set_fa_state(const H5FA_create_t *cparam, farray_state_t *state)
{
- size_t dblk_page_nelmts; /* # of elements per page */
+ size_t dblk_page_nelmts; /* # of elements per page */
/* Sanity check */
HDassert(cparam);
@@ -234,16 +222,16 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state)
/* Compute the state of the fixed array */
state->hdr_size = FA_HDR_SIZE;
- state->nelmts = cparam->nelmts;
+ state->nelmts = cparam->nelmts;
dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits;
if (state->nelmts > dblk_page_nelmts) {
- size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts);
- size_t dblk_page_init_size = (npages + 7) / 8;
- hsize_t checksum_size = npages * 4;
+ size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts);
+ size_t dblk_page_init_size = (npages + 7) / 8;
+ hsize_t checksum_size = npages * 4;
- state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size +
- state->nelmts * cparam->raw_elmt_size;
+ state->dblk_size =
+ DBLOCK_PREFIX + dblk_page_init_size + checksum_size + state->nelmts * cparam->raw_elmt_size;
}
else
state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size;
@@ -251,7 +239,6 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state)
return SUCCEED;
} /* end set_fa_state() */
-
/*-------------------------------------------------------------------------
* Function: reopen_file
*
@@ -262,8 +249,8 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state)
*-------------------------------------------------------------------------
*/
static int
-reopen_file(hid_t *fid, H5F_t **f, hid_t fapl_id,
- H5FA_t **fa, haddr_t fa_addr, const farray_test_param_t *tparam)
+reopen_file(hid_t *fid, H5F_t **f, hid_t fapl_id, H5FA_t **fa, haddr_t fa_addr,
+ const farray_test_param_t *tparam)
{
/* Check for closing & re-opening the array */
/* (actually will close & re-open the file as well) */
@@ -281,7 +268,7 @@ reopen_file(hid_t *fid, H5F_t **f, hid_t fapl_id,
if (H5Fclose(*fid) < 0)
FAIL_STACK_ERROR
*fid = H5I_INVALID_HID;
- *f = NULL;
+ *f = NULL;
}
/* Re-open the file */
@@ -309,7 +296,6 @@ error:
return FAIL;
} /* reopen_file() */
-
/*-------------------------------------------------------------------------
* Function: create_array
*
@@ -320,10 +306,9 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-create_array(H5F_t *f, const H5FA_create_t *cparam,
- H5FA_t **fa, haddr_t *fa_addr)
+create_array(H5F_t *f, const H5FA_create_t *cparam, H5FA_t **fa, haddr_t *fa_addr)
{
- farray_state_t state; /* State of extensible array */
+ farray_state_t state; /* State of extensible array */
/* Create array */
if (NULL == (*fa = H5FA_create(f, cparam, NULL)))
@@ -337,8 +322,8 @@ create_array(H5F_t *f, const H5FA_create_t *cparam,
/* Check array stats */
HDmemset(&state, 0, sizeof(state));
- state.hdr_size = FA_HDR_SIZE;
- state.nelmts = cparam->nelmts;
+ state.hdr_size = FA_HDR_SIZE;
+ state.nelmts = cparam->nelmts;
if (check_stats(*fa, &state))
TEST_ERROR
@@ -349,7 +334,6 @@ error:
return FAIL;
} /* create_array() */
-
/*-------------------------------------------------------------------------
* Function: verify_cparam
*
@@ -362,7 +346,7 @@ error:
static herr_t
verify_cparam(const H5FA_t *fa, const H5FA_create_t *cparam)
{
- H5FA_create_t test_cparam; /* Creation parameters for array */
+ H5FA_create_t test_cparam; /* Creation parameters for array */
/* Retrieve creation parameters */
HDmemset(&test_cparam, 0, sizeof(H5FA_create_t));
@@ -380,7 +364,6 @@ error:
return FAIL;
} /* verify_cparam() */
-
/*-------------------------------------------------------------------------
* Function: finish
*
@@ -394,7 +377,7 @@ error:
static herr_t
finish(hid_t fid, hid_t fapl_id, H5F_t *f, H5FA_t *fa, haddr_t fa_addr)
{
- h5_stat_size_t file_size; /* File size, after deleting array */
+ h5_stat_size_t file_size; /* File size, after deleting array */
/* Close the fixed array */
if (H5FA_close(fa) < 0)
@@ -423,7 +406,6 @@ error:
return FAIL;
} /* finish() */
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -437,13 +419,13 @@ error:
static unsigned
test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSED *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FA_t *fa = NULL; /* Fixed array wrapper */
- haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FA_t *fa = NULL; /* Fixed array wrapper */
+ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if (create_file(fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -452,57 +434,54 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE
TESTING("invalid fixed array creation parameters");
#ifndef NDEBUG
-{
- H5FA_create_t test_cparam; /* Creation parameters for array */
-
- /* Set invalid element size */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.raw_elmt_size = 0;
- H5E_BEGIN_TRY {
- fa = H5FA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(fa) {
- /* Close opened fixed array */
- H5FA_close(fa);
- fa = NULL;
-
- /* Indicate error */
- TEST_ERROR
- } /* end if */
-
- /* Set invalid max. # of elements bits */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.max_dblk_page_nelmts_bits = 0;
- H5E_BEGIN_TRY {
- fa = H5FA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(fa) {
- /* Close opened fixed array */
- H5FA_close(fa);
- fa = NULL;
+ {
+ H5FA_create_t test_cparam; /* Creation parameters for array */
+
+ /* Set invalid element size */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.raw_elmt_size = 0;
+ H5E_BEGIN_TRY { fa = H5FA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (fa) {
+ /* Close opened fixed array */
+ H5FA_close(fa);
+ fa = NULL;
- /* Indicate error */
- TEST_ERROR
- } /* end if */
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
+
+ /* Set invalid max. # of elements bits */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.max_dblk_page_nelmts_bits = 0;
+ H5E_BEGIN_TRY { fa = H5FA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (fa) {
+ /* Close opened fixed array */
+ H5FA_close(fa);
+ fa = NULL;
- /* Set invalid max. # of elements */
- HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.nelmts = 0;
- H5E_BEGIN_TRY {
- fa = H5FA_create(f, &test_cparam, NULL);
- } H5E_END_TRY;
- if(fa) {
- /* Close opened fixed array */
- H5FA_close(fa);
- fa = NULL;
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
+
+ /* Set invalid max. # of elements */
+ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
+ test_cparam.nelmts = 0;
+ H5E_BEGIN_TRY { fa = H5FA_create(f, &test_cparam, NULL); }
+ H5E_END_TRY;
+ if (fa) {
+ /* Close opened fixed array */
+ H5FA_close(fa);
+ fa = NULL;
- /* Indicate error */
- TEST_ERROR
- } /* end if */
+ /* Indicate error */
+ TEST_ERROR
+ } /* end if */
- PASSED();
-}
-#else /* NDEBUG */
+ PASSED();
+ }
+#else /* NDEBUG */
SKIPPED();
puts(" Not tested when assertions are disabled");
#endif /* NDEBUG */
@@ -513,7 +492,7 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE
TESTING("fixed array creation");
/* Create array */
- if(create_array(f, cparam, &fa, &fa_addr) < 0)
+ if (create_array(f, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
PASSED();
@@ -522,11 +501,11 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE
TESTING("verify array creation parameters");
/* Verify the creation parameters */
- if(verify_cparam(fa, cparam) < 0)
+ if (verify_cparam(fa, cparam) < 0)
TEST_ERROR
/* Close array, delete array, close file & verify file is empty */
- if(finish(file, fapl, f, fa, fa_addr) < 0)
+ if (finish(file, fapl, f, fa, fa_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -535,16 +514,17 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE
return 0;
error:
- H5E_BEGIN_TRY {
- if(fa)
+ H5E_BEGIN_TRY
+ {
+ if (fa)
H5FA_close(fa);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_create() */
-
/*-------------------------------------------------------------------------
* Function: test_reopen
*
@@ -558,13 +538,13 @@ error:
static unsigned
test_reopen(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FA_t *fa = NULL; /* Fixed array wrapper */
- haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FA_t *fa = NULL; /* Fixed array wrapper */
+ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if (create_file(fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -573,27 +553,27 @@ test_reopen(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
TESTING("create, close & reopen fixed array");
/* Create array */
- if(create_array(f, cparam, &fa, &fa_addr) < 0)
+ if (create_array(f, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
/* Close the fixed array */
- if(H5FA_close(fa) < 0)
+ if (H5FA_close(fa) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0)
TEST_ERROR
/* Re-open the array */
- if(NULL == (fa = H5FA_open(f, fa_addr, NULL)))
+ if (NULL == (fa = H5FA_open(f, fa_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
- if(verify_cparam(fa, cparam) < 0)
+ if (verify_cparam(fa, cparam) < 0)
TEST_ERROR
/* Close array, delete array, close file & verify file is empty */
- if(finish(file, fapl, f, fa, fa_addr) < 0)
+ if (finish(file, fapl, f, fa, fa_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -602,16 +582,17 @@ test_reopen(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
return 0;
error:
- H5E_BEGIN_TRY {
- if(fa)
+ H5E_BEGIN_TRY
+ {
+ if (fa)
H5FA_close(fa);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_reopen() */
-
/*-------------------------------------------------------------------------
* Function: test_open_twice
*
@@ -625,13 +606,13 @@ error:
static unsigned
test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t fid2 = H5I_INVALID_HID; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5F_t *f2 = NULL; /* Internal file object pointer */
- H5FA_t *fa = NULL; /* Fixed array wrapper */
- H5FA_t *fa2 = NULL; /* Fixed array wrapper */
- haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fid2 = H5I_INVALID_HID; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5F_t * f2 = NULL; /* Internal file object pointer */
+ H5FA_t *fa = NULL; /* Fixed array wrapper */
+ H5FA_t *fa2 = NULL; /* Fixed array wrapper */
+ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
if (create_file(fapl_id, &fid, &f) < 0)
@@ -701,19 +682,20 @@ test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tpara
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
if (fa)
H5FA_close(fa);
if (fa2)
H5FA_close(fa2);
H5Fclose(fid);
H5Fclose(fid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_open_twice() */
-
/*-------------------------------------------------------------------------
* Function: test_open_twice_diff
*
@@ -732,16 +714,16 @@ error:
static unsigned
test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam)
{
- char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t fid2 = H5I_INVALID_HID; /* File ID */
- hid_t fid0 = H5I_INVALID_HID; /* File ID */
- hid_t fid00 = H5I_INVALID_HID; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5F_t *f2 = NULL; /* Internal file object pointer */
- H5FA_t *fa = NULL; /* Fixed array wrapper */
- H5FA_t *fa2 = NULL; /* Fixed array wrapper */
- haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
+ char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fid2 = H5I_INVALID_HID; /* File ID */
+ hid_t fid0 = H5I_INVALID_HID; /* File ID */
+ hid_t fid00 = H5I_INVALID_HID; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5F_t * f2 = NULL; /* Internal file object pointer */
+ H5FA_t *fa = NULL; /* Fixed array wrapper */
+ H5FA_t *fa2 = NULL; /* Fixed array wrapper */
+ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
/* Display testing message */
TESTING("open fixed array twice, through different file handles");
@@ -834,7 +816,8 @@ test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
if (fa)
H5FA_close(fa);
if (fa2)
@@ -843,12 +826,12 @@ error:
H5Fclose(fid2);
H5Fclose(fid0);
H5Fclose(fid00);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_open_twice_diff() */
-
/*-------------------------------------------------------------------------
* Function: test_delete_open
*
@@ -862,15 +845,15 @@ error:
static unsigned
test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FA_t *fa = NULL; /* Fixed array wrapper */
- H5FA_t *fa2 = NULL; /* Fixed array wrapper */
- haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
- h5_stat_size_t file_size; /* File size, after deleting array */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FA_t * fa = NULL; /* Fixed array wrapper */
+ H5FA_t * fa2 = NULL; /* Fixed array wrapper */
+ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
+ h5_stat_size_t file_size; /* File size, after deleting array */
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if (create_file(fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -879,33 +862,32 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
TESTING("deleting open fixed array");
/* Create array */
- if(create_array(f, cparam, &fa, &fa_addr) < 0)
+ if (create_array(f, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
/* Open the array again */
- if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL)))
+ if (NULL == (fa2 = H5FA_open(f, fa_addr, NULL)))
FAIL_STACK_ERROR
/* Request that the array be deleted */
- if(H5FA_delete(f, fa_addr, NULL) < 0)
+ if (H5FA_delete(f, fa_addr, NULL) < 0)
FAIL_STACK_ERROR
/* Verify the creation parameters */
- if(verify_cparam(fa, cparam) < 0)
+ if (verify_cparam(fa, cparam) < 0)
TEST_ERROR
- if(verify_cparam(fa2, cparam) < 0)
+ if (verify_cparam(fa2, cparam) < 0)
TEST_ERROR
/* Close the second fixed array wrapper */
- if(H5FA_close(fa2) < 0)
+ if (H5FA_close(fa2) < 0)
FAIL_STACK_ERROR
fa2 = NULL;
/* Try re-opening the array again (should fail, as array will be deleted) */
- H5E_BEGIN_TRY {
- fa2 = H5FA_open(f, fa_addr, NULL);
- } H5E_END_TRY;
- if(fa2) {
+ H5E_BEGIN_TRY { fa2 = H5FA_open(f, fa_addr, NULL); }
+ H5E_END_TRY;
+ if (fa2) {
/* Close opened array */
H5FA_close(fa2);
@@ -914,19 +896,18 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
} /* end if */
/* Close the first fixed array wrapper */
- if(H5FA_close(fa) < 0)
+ if (H5FA_close(fa) < 0)
FAIL_STACK_ERROR
fa = NULL;
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0)
TEST_ERROR
/* Try re-opening the array again (should fail, as array is now deleted) */
- H5E_BEGIN_TRY {
- fa = H5FA_open(f, fa_addr, NULL);
- } H5E_END_TRY;
- if(fa) {
+ H5E_BEGIN_TRY { fa = H5FA_open(f, fa_addr, NULL); }
+ H5E_END_TRY;
+ if (fa) {
/* Close opened array */
H5FA_close(fa);
@@ -935,15 +916,15 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename_g, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename_g, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size_g)
+ if (file_size != empty_size_g)
TEST_ERROR
/* All tests passed */
@@ -952,23 +933,24 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
return 0;
error:
- H5E_BEGIN_TRY {
- if(fa)
+ H5E_BEGIN_TRY
+ {
+ if (fa)
H5FA_close(fa);
- if(fa2)
+ if (fa2)
H5FA_close(fa2);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_delete_open() */
/* Fixed array iterator info for forward iteration */
typedef struct fiter_fw_t {
- hsize_t idx; /* Index of next array location */
+ hsize_t idx; /* Index of next array location */
} fiter_fw_t;
-
/*-------------------------------------------------------------------------
* Function: fiter_fw_init
*
@@ -981,9 +963,9 @@ typedef struct fiter_fw_t {
*/
static void *
fiter_fw_init(const H5FA_create_t H5_ATTR_UNUSED *cparam, const farray_test_param_t H5_ATTR_UNUSED *tparam,
- hsize_t H5_ATTR_UNUSED cnt)
+ hsize_t H5_ATTR_UNUSED cnt)
{
- fiter_fw_t *fiter; /* Forward element iteration object */
+ fiter_fw_t *fiter; /* Forward element iteration object */
/* Allocate space for the element iteration object */
fiter = (fiter_fw_t *)HDmalloc(sizeof(fiter_fw_t));
@@ -993,10 +975,9 @@ fiter_fw_init(const H5FA_create_t H5_ATTR_UNUSED *cparam, const farray_test_para
fiter->idx = 0;
/* Return iteration object */
- return(fiter);
+ return (fiter);
} /* end fiter_fw_init() */
-
/*-------------------------------------------------------------------------
* Function: fiter_fw_next
*
@@ -1011,7 +992,7 @@ static hssize_t
fiter_fw_next(void *_fiter)
{
fiter_fw_t *fiter = (fiter_fw_t *)_fiter;
- hssize_t ret_val;
+ hssize_t ret_val;
/* Sanity check */
HDassert(fiter);
@@ -1019,10 +1000,9 @@ fiter_fw_next(void *_fiter)
/* Get the next array index to test */
ret_val = (hssize_t)fiter->idx++;
- return(ret_val);
+ return (ret_val);
} /* end fiter_fw_next() */
-
/*-------------------------------------------------------------------------
* Function: fiter_term
*
@@ -1042,22 +1022,21 @@ fiter_term(void *fiter)
/* Free iteration object */
HDfree(fiter);
- return(0);
+ return (0);
} /* end fiter_term() */
/* Fixed array iterator class for forward iteration */
static const farray_iter_t fa_iter_fw = {
- fiter_fw_init, /* Iterator init */
- fiter_fw_next, /* Next array index */
- fiter_term /* Iterator term */
+ fiter_fw_init, /* Iterator init */
+ fiter_fw_next, /* Next array index */
+ fiter_term /* Iterator term */
};
/* Fixed array iterator info for reverse iteration */
typedef struct fiter_rv_t {
- hsize_t idx; /* Index of next array location */
+ hsize_t idx; /* Index of next array location */
} fiter_rv_t;
-
/*-------------------------------------------------------------------------
* Function: fiter_rv_init
*
@@ -1070,9 +1049,9 @@ typedef struct fiter_rv_t {
*/
static void *
fiter_rv_init(const H5FA_create_t *cparam, const farray_test_param_t H5_ATTR_UNUSED *tparam,
- hsize_t H5_ATTR_UNUSED cnt)
+ hsize_t H5_ATTR_UNUSED cnt)
{
- fiter_rv_t *fiter; /* Reverse element iteration object */
+ fiter_rv_t *fiter; /* Reverse element iteration object */
/* Allocate space for the element iteration object */
fiter = (fiter_rv_t *)HDmalloc(sizeof(fiter_rv_t));
@@ -1082,10 +1061,9 @@ fiter_rv_init(const H5FA_create_t *cparam, const farray_test_param_t H5_ATTR_UNU
fiter->idx = cparam->nelmts - 1;
/* Return iteration object */
- return(fiter);
+ return (fiter);
} /* end fiter_rv_init() */
-
/*-------------------------------------------------------------------------
* Function: fiter_rv_next
*
@@ -1100,7 +1078,7 @@ static hssize_t
fiter_rv_next(void *_fiter)
{
fiter_rv_t *fiter = (fiter_rv_t *)_fiter;
- hssize_t ret_val;
+ hssize_t ret_val;
/* Sanity check */
HDassert(fiter);
@@ -1108,23 +1086,22 @@ fiter_rv_next(void *_fiter)
/* Get the next array index to test */
ret_val = (hssize_t)fiter->idx--;
- return(ret_val);
+ return (ret_val);
} /* end fiter_rv_next() */
/* Fixed array iterator class for reverse iteration */
static const farray_iter_t fa_iter_rv = {
- fiter_rv_init, /* Iterator init */
- fiter_rv_next, /* Next array index */
- fiter_term /* Iterator term */
+ fiter_rv_init, /* Iterator init */
+ fiter_rv_next, /* Next array index */
+ fiter_term /* Iterator term */
};
/* Fixed array iterator info for random iteration */
typedef struct fiter_rnd_t {
- hsize_t pos; /* Position in shuffled array */
- hsize_t *idx; /* Array of shuffled indices */
+ hsize_t pos; /* Position in shuffled array */
+ hsize_t *idx; /* Array of shuffled indices */
} fiter_rnd_t;
-
/*-------------------------------------------------------------------------
* Function: fiter_rnd_init
*
@@ -1137,10 +1114,10 @@ typedef struct fiter_rnd_t {
*/
static void *
fiter_rnd_init(const H5FA_create_t H5_ATTR_UNUSED *cparam, const farray_test_param_t H5_ATTR_UNUSED *tparam,
- hsize_t cnt)
+ hsize_t cnt)
{
- fiter_rnd_t *fiter; /* Random element iteration object */
- size_t u; /* Local index variable */
+ fiter_rnd_t *fiter; /* Random element iteration object */
+ size_t u; /* Local index variable */
/* Allocate space for the element iteration object */
fiter = (fiter_rnd_t *)HDmalloc(sizeof(fiter_rnd_t));
@@ -1152,27 +1129,26 @@ fiter_rnd_init(const H5FA_create_t H5_ATTR_UNUSED *cparam, const farray_test_par
/* Initialize reverse iteration info */
fiter->pos = 0;
- for(u = 0; u < (size_t)cnt; u++)
+ for (u = 0; u < (size_t)cnt; u++)
fiter->idx[u] = (hsize_t)u;
/* Randomly shuffle array indices */
- if(cnt > 1) {
- for(u = 0; u < (size_t)cnt; u++) {
- size_t swap_idx; /* Location to swap with when shuffling */
- hsize_t temp_idx; /* Temporary index */
-
- swap_idx = ((size_t)HDrandom() % ((size_t)cnt - u)) + u;
- temp_idx = fiter->idx[u];
- fiter->idx[u] = fiter->idx[swap_idx];
+ if (cnt > 1) {
+ for (u = 0; u < (size_t)cnt; u++) {
+ size_t swap_idx; /* Location to swap with when shuffling */
+ hsize_t temp_idx; /* Temporary index */
+
+ swap_idx = ((size_t)HDrandom() % ((size_t)cnt - u)) + u;
+ temp_idx = fiter->idx[u];
+ fiter->idx[u] = fiter->idx[swap_idx];
fiter->idx[swap_idx] = temp_idx;
} /* end for */
- } /* end if */
+ } /* end if */
/* Return iteration object */
- return(fiter);
+ return (fiter);
} /* end fiter_rnd_init() */
-
/*-------------------------------------------------------------------------
* Function: fiter_rnd_next
*
@@ -1187,7 +1163,7 @@ static hssize_t
fiter_rnd_next(void *_fiter)
{
fiter_rnd_t *fiter = (fiter_rnd_t *)_fiter;
- hssize_t ret_val;
+ hssize_t ret_val;
/* Sanity check */
HDassert(fiter);
@@ -1196,10 +1172,9 @@ fiter_rnd_next(void *_fiter)
ret_val = (hssize_t)fiter->idx[fiter->pos];
fiter->pos++;
- return(ret_val);
+ return (ret_val);
} /* end fiter_rnd_next() */
-
/*-------------------------------------------------------------------------
* Function: fiter_rnd_term
*
@@ -1225,24 +1200,23 @@ fiter_rnd_term(void *_fiter)
/* Free iteration object */
HDfree(fiter);
- return(0);
+ return (0);
} /* end fiter_rnd_term() */
/* Fixed array iterator class for random iteration */
static const farray_iter_t fa_iter_rnd = {
- fiter_rnd_init, /* Iterator init */
- fiter_rnd_next, /* Next array index */
- fiter_rnd_term /* Iterator term */
+ fiter_rnd_init, /* Iterator init */
+ fiter_rnd_next, /* Next array index */
+ fiter_rnd_term /* Iterator term */
};
/* Fixed array iterator info for cyclic iteration */
typedef struct fiter_cyc_t {
- hsize_t pos; /* Position in shuffled array */
- hsize_t cnt; /* # of elements to store */
- hsize_t cyc; /* Cycle of elements to choose from */
+ hsize_t pos; /* Position in shuffled array */
+ hsize_t cnt; /* # of elements to store */
+ hsize_t cyc; /* Cycle of elements to choose from */
} fiter_cyc_t;
-
/*-------------------------------------------------------------------------
* Function: fiter_cyc_init
*
@@ -1255,9 +1229,9 @@ typedef struct fiter_cyc_t {
*/
static void *
fiter_cyc_init(const H5FA_create_t H5_ATTR_UNUSED *cparam, const farray_test_param_t H5_ATTR_UNUSED *tparam,
- hsize_t cnt)
+ hsize_t cnt)
{
- fiter_cyc_t *fiter; /* Cyclic element iteration object */
+ fiter_cyc_t *fiter; /* Cyclic element iteration object */
/* Allocate space for the element iteration object */
fiter = (fiter_cyc_t *)HDmalloc(sizeof(fiter_cyc_t));
@@ -1269,10 +1243,9 @@ fiter_cyc_init(const H5FA_create_t H5_ATTR_UNUSED *cparam, const farray_test_par
fiter->cyc = 0;
/* Return iteration object */
- return(fiter);
+ return (fiter);
} /* end fiter_cyc_init() */
-
/*-------------------------------------------------------------------------
* Function: fiter_cyc_next
*
@@ -1287,7 +1260,7 @@ static hssize_t
fiter_cyc_next(void *_fiter)
{
fiter_cyc_t *fiter = (fiter_cyc_t *)_fiter;
- hssize_t ret_val;
+ hssize_t ret_val;
/* Sanity check */
HDassert(fiter);
@@ -1295,21 +1268,19 @@ fiter_cyc_next(void *_fiter)
/* Get the next array index to test */
ret_val = (hssize_t)fiter->pos;
fiter->pos += FA_CYC_COUNT;
- if(fiter->pos >= fiter->cnt)
+ if (fiter->pos >= fiter->cnt)
fiter->pos = ++fiter->cyc;
- return(ret_val);
+ return (ret_val);
} /* end fiter_cyc_next() */
-
/* Fixed array iterator class for cyclic iteration */
static const farray_iter_t fa_iter_cyc = {
- fiter_cyc_init, /* Iterator init */
- fiter_cyc_next, /* Next array index */
- fiter_term /* Iterator term */
+ fiter_cyc_init, /* Iterator init */
+ fiter_cyc_next, /* Next array index */
+ fiter_term /* Iterator term */
};
-
/*-------------------------------------------------------------------------
* Function: check_elmt
*
@@ -1328,22 +1299,21 @@ check_elmt(void *_relmt, void *_welmt)
uint64_t *relmt = (uint64_t *)_relmt;
uint64_t *welmt = (uint64_t *)_welmt;
- if(welmt == NULL) { /* check for fill value */
- if(*relmt != H5FA_TEST_FILL)
+ if (welmt == NULL) { /* check for fill value */
+ if (*relmt != H5FA_TEST_FILL)
TEST_ERROR
} /* end if */
else {
- if(*relmt != *welmt)
+ if (*relmt != *welmt)
TEST_ERROR
} /* end else */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end check_elmt() */
-
/*-------------------------------------------------------------------------
* Function: test_set_elmts
*
@@ -1356,21 +1326,21 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
- hsize_t nelmts, const char *test_str)
+test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, hsize_t nelmts,
+ const char *test_str)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FA_t *fa = NULL; /* Fixed array wrapper */
- void *fiter_info; /* Fixed array iterator info */
- farray_state_t state; /* State of fixed array */
- uint64_t welmt; /* Element to write */
- uint64_t relmt; /* Element to read */
- hsize_t cnt; /* Count of array indices */
- hssize_t sidx; /* Index value of next element in the fixed array */
- hsize_t idx; /* Index value of next element in the fixed array */
- hsize_t fa_nelmts; /* # of elements in fixed array */
- haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FA_t * fa = NULL; /* Fixed array wrapper */
+ void * fiter_info; /* Fixed array iterator info */
+ farray_state_t state; /* State of fixed array */
+ uint64_t welmt; /* Element to write */
+ uint64_t relmt; /* Element to read */
+ hsize_t cnt; /* Count of array indices */
+ hssize_t sidx; /* Index value of next element in the fixed array */
+ hsize_t idx; /* Index value of next element in the fixed array */
+ hsize_t fa_nelmts; /* # of elements in fixed array */
+ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
HDassert(nelmts);
/*
@@ -1379,111 +1349,110 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if (create_file(fapl, &file, &f) < 0)
TEST_ERROR
/* Create array */
- if(create_array(f, cparam, &fa, &fa_addr) < 0)
+ if (create_array(f, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
/* Verify the creation parameters */
- if(verify_cparam(fa, cparam) < 0)
+ if (verify_cparam(fa, cparam) < 0)
TEST_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0)
TEST_ERROR
- if(H5FA_get_nelmts(fa, &fa_nelmts) < 0)
+ if (H5FA_get_nelmts(fa, &fa_nelmts) < 0)
FAIL_STACK_ERROR
- if(nelmts > fa_nelmts)
+ if (nelmts > fa_nelmts)
TEST_ERROR
/* Verify array state */
HDmemset(&state, 0, sizeof(state));
- state.hdr_size = FA_HDR_SIZE;
- state.nelmts = cparam->nelmts;
+ state.hdr_size = FA_HDR_SIZE;
+ state.nelmts = cparam->nelmts;
state.dblk_size = 0;
- if(check_stats(fa, &state))
+ if (check_stats(fa, &state))
TEST_ERROR
/* Get all elements from empty array */
/* Initialize iterator */
- if(NULL == (fiter_info = tparam->fiter->init(cparam, tparam, nelmts)))
+ if (NULL == (fiter_info = tparam->fiter->init(cparam, tparam, nelmts)))
TEST_ERROR
/* Get elements of array */
- for(cnt = 0; cnt < nelmts; cnt++) {
+ for (cnt = 0; cnt < nelmts; cnt++) {
/* Get the array index */
- if((sidx = tparam->fiter->next(fiter_info)) < 0)
+ if ((sidx = tparam->fiter->next(fiter_info)) < 0)
TEST_ERROR
- idx = (hsize_t)sidx;
+ idx = (hsize_t)sidx;
/* Retrieve element of array (not set yet) */
relmt = (uint64_t)0;
- if(H5FA_get(fa, idx, &relmt) < 0)
+ if (H5FA_get(fa, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify that the retrieved is correct */
- if(check_elmt(&relmt, NULL))
+ if (check_elmt(&relmt, NULL))
TEST_ERROR
} /* end for */
/* Shutdown iterator */
- if(tparam->fiter->term(fiter_info) < 0)
+ if (tparam->fiter->term(fiter_info) < 0)
TEST_ERROR
-
/* Set (& get) all elements from empty array */
/* Initialize iterator */
- if(NULL == (fiter_info = tparam->fiter->init(cparam, tparam, nelmts)))
+ if (NULL == (fiter_info = tparam->fiter->init(cparam, tparam, nelmts)))
TEST_ERROR
/* Set elements of array */
- for(cnt = 0; cnt < nelmts; cnt++) {
+ for (cnt = 0; cnt < nelmts; cnt++) {
/* Get the array index */
- if((sidx = tparam->fiter->next(fiter_info)) < 0)
+ if ((sidx = tparam->fiter->next(fiter_info)) < 0)
TEST_ERROR
- idx = (hsize_t)sidx;
+ idx = (hsize_t)sidx;
relmt = (uint64_t)0;
- if(H5FA_get(fa, idx, &relmt) < 0)
+ if (H5FA_get(fa, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify that the retrieved element is correct */
- if(check_elmt(&relmt, NULL))
+ if (check_elmt(&relmt, NULL))
TEST_ERROR
/* Set element of array */
welmt = (uint64_t)7 + idx;
- if(H5FA_set(fa, idx, &welmt) < 0)
+ if (H5FA_set(fa, idx, &welmt) < 0)
FAIL_STACK_ERROR
/* Retrieve element of array (set now) */
relmt = (uint64_t)0;
- if(H5FA_get(fa, idx, &relmt) < 0)
+ if (H5FA_get(fa, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify that the retrieved element is correct */
- if(check_elmt(&relmt, &welmt))
+ if (check_elmt(&relmt, &welmt))
TEST_ERROR
} /* end for */
/* Verify array state */
HDmemset(&state, 0, sizeof(state));
set_fa_state(cparam, &state);
- if(check_stats(fa, &state))
+ if (check_stats(fa, &state))
TEST_ERROR
/* Shutdown iterator */
- if(tparam->fiter->term(fiter_info) < 0)
+ if (tparam->fiter->term(fiter_info) < 0)
TEST_ERROR
/* Close array, delete array, close file & verify file is empty */
- if(finish(file, fapl, f, fa, fa_addr) < 0)
+ if (finish(file, fapl, f, fa, fa_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -1492,16 +1461,17 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(fa)
+ H5E_BEGIN_TRY
+ {
+ if (fa)
H5FA_close(fa);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_set_elmts() */
-
/*-------------------------------------------------------------------------
* Function: test_skip_elmts
*
@@ -1514,19 +1484,19 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
- hsize_t skip_elmts, hbool_t check_rest, const char *test_str)
+test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, hsize_t skip_elmts,
+ hbool_t check_rest, const char *test_str)
{
- hid_t file = -1; /* File ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FA_t *fa = NULL; /* Extensible array wrapper */
- farray_state_t state; /* State of extensible array */
- uint64_t welmt; /* Element to write */
- uint64_t relmt; /* Element to read */
- hsize_t idx; /* Index value of element to get */
- hsize_t cnt; /* Count of array indices */
- hsize_t fa_nelmts; /* # of elements in fixed array */
- haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
+ hid_t file = -1; /* File ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FA_t * fa = NULL; /* Extensible array wrapper */
+ farray_state_t state; /* State of extensible array */
+ uint64_t welmt; /* Element to write */
+ uint64_t relmt; /* Element to read */
+ hsize_t idx; /* Index value of element to get */
+ hsize_t cnt; /* Count of array indices */
+ hsize_t fa_nelmts; /* # of elements in fixed array */
+ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
/*
* Display testing message
@@ -1534,33 +1504,33 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if (create_file(fapl, &file, &f) < 0)
TEST_ERROR
/* Create array */
- if(create_array(f, cparam, &fa, &fa_addr) < 0)
+ if (create_array(f, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
/* Verify the creation parameters */
- if(verify_cparam(fa, cparam) < 0)
+ if (verify_cparam(fa, cparam) < 0)
TEST_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0)
+ if (reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0)
TEST_ERROR
- if(H5FA_get_nelmts(fa, &fa_nelmts) < 0)
+ if (H5FA_get_nelmts(fa, &fa_nelmts) < 0)
FAIL_STACK_ERROR
- if(skip_elmts >= fa_nelmts)
+ if (skip_elmts >= fa_nelmts)
TEST_ERROR
/* Verify array state */
HDmemset(&state, 0, sizeof(state));
- state.hdr_size = FA_HDR_SIZE;
- state.nelmts = cparam->nelmts;
+ state.hdr_size = FA_HDR_SIZE;
+ state.nelmts = cparam->nelmts;
state.dblk_size = 0;
- if(check_stats(fa, &state))
+ if (check_stats(fa, &state))
TEST_ERROR
/* Set (& get) element after skipping elements */
@@ -1568,49 +1538,49 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
/* Retrieve element of array (not set yet) */
relmt = (uint64_t)0;
- if(H5FA_get(fa, idx, &relmt) < 0)
+ if (H5FA_get(fa, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify that the retrieved is correct */
- if(check_elmt(&relmt, NULL))
+ if (check_elmt(&relmt, NULL))
TEST_ERROR
/* Set element of array */
welmt = (uint64_t)7 + idx;
- if(H5FA_set(fa, idx, &welmt) < 0)
+ if (H5FA_set(fa, idx, &welmt) < 0)
FAIL_STACK_ERROR
/* Verify array state */
HDmemset(&state, 0, sizeof(state));
set_fa_state(cparam, &state);
- if(check_stats(fa, &state))
+ if (check_stats(fa, &state))
TEST_ERROR
/* Retrieve element of array (set now) */
relmt = (uint64_t)0;
- if(H5FA_get(fa, idx, &relmt) < 0)
+ if (H5FA_get(fa, idx, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify that the retrieved is correct */
- if(check_elmt(&relmt, &welmt))
+ if (check_elmt(&relmt, &welmt))
TEST_ERROR
- if(check_rest) {
+ if (check_rest) {
/* Get unset elements of array */
- for(cnt = 0; cnt < skip_elmts; cnt++) {
+ for (cnt = 0; cnt < skip_elmts; cnt++) {
/* Retrieve element of array (not set yet) */
relmt = (uint64_t)0;
- if(H5FA_get(fa, cnt, &relmt) < 0)
+ if (H5FA_get(fa, cnt, &relmt) < 0)
FAIL_STACK_ERROR
/* Verify that the retrieved is correct */
- if(check_elmt(&relmt, NULL))
+ if (check_elmt(&relmt, NULL))
TEST_ERROR
} /* end for */
- } /* end if */
+ } /* end if */
/* Close array, delete array, close file & verify file is empty */
- if(finish(file, fapl, f, fa, fa_addr) < 0)
+ if (finish(file, fapl, f, fa, fa_addr) < 0)
TEST_ERROR
/* All tests passed */
@@ -1619,16 +1589,17 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
return 0;
error:
- H5E_BEGIN_TRY {
- if(fa)
+ H5E_BEGIN_TRY
+ {
+ if (fa)
H5FA_close(fa);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* test_skip_elmts() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1642,28 +1613,29 @@ error:
int
main(void)
{
- H5FA_create_t cparam; /* Creation parameters for fixed array */
- farray_test_param_t tparam; /* Testing parameters */
- farray_test_type_t curr_test; /* Current test being worked on */
- farray_iter_type_t curr_iter; /* Current iteration type being worked on */
- hid_t fapl = -1; /* File access property list for data files */
- unsigned nerrors = 0; /* Cumulative error count */
- time_t curr_time; /* Current time, for seeding random number generator */
- int ExpressMode; /* Test express value */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ H5FA_create_t cparam; /* Creation parameters for fixed array */
+ farray_test_param_t tparam; /* Testing parameters */
+ farray_test_type_t curr_test; /* Current test being worked on */
+ farray_iter_type_t curr_iter; /* Current iteration type being worked on */
+ hid_t fapl = -1; /* File access property list for data files */
+ unsigned nerrors = 0; /* Cumulative error count */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ int ExpressMode; /* Test express value */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Reset library */
h5_reset();
- fapl = h5_fileaccess();
+ fapl = h5_fileaccess();
ExpressMode = GetTestExpress();
- if(ExpressMode > 1)
+ if (ExpressMode > 1)
HDprintf("***Express test mode on. Some tests may be skipped\n");
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g));
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Seed random #'s */
@@ -1672,29 +1644,29 @@ main(void)
/* Create an empty file to retrieve size */
{
- hid_t file; /* File ID */
+ hid_t file; /* File ID */
- if((file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/no array */
- if((empty_size_g = h5_get_file_size(filename_g, fapl)) < 0)
+ if ((empty_size_g = h5_get_file_size(filename_g, fapl)) < 0)
TEST_ERROR
}
/* Iterate over the testing parameters */
- for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; curr_test++) {
+ for (curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; curr_test++) {
/* Initialize the testing parameters */
HDmemset(&tparam, 0, sizeof(tparam));
tparam.nelmts = TEST_NELMTS;
/* Set appropriate testing parameters for each test */
- switch(curr_test) {
+ switch (curr_test) {
/* "Normal" testing parameters */
case FARRAY_TEST_NORMAL:
HDputs("Testing with NORMAL PARAMETERS");
@@ -1712,8 +1684,8 @@ main(void)
goto error;
} /* end switch */
- /* Initialize fixed array creation parameters */
- init_cparam(&cparam, &tparam);
+ /* Initialize fixed array creation parameters */
+ init_cparam(&cparam, &tparam);
/* Basic capability tests */
nerrors += test_create(fapl, &cparam, &tparam);
@@ -1722,11 +1694,11 @@ main(void)
nerrors += test_open_twice_diff(fapl, &cparam, &tparam);
nerrors += test_delete_open(fapl, &cparam, &tparam);
- /* Iterate over the type of capacity tests */
- for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; curr_iter++) {
+ /* Iterate over the type of capacity tests */
+ for (curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; curr_iter++) {
/* Set appropriate parameters for each type of iteration */
- switch(curr_iter) {
+ switch (curr_iter) {
/* "Forward" testing parameters */
case FARRAY_ITER_FW:
HDputs("Testing with forward iteration");
@@ -1759,16 +1731,20 @@ main(void)
/* Basic capacity tests */
nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)1, "setting 1 element of the array");
- nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts/2), "setting half of the array's elements ");
- nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)tparam.nelmts, "setting all the array elements");
+ nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts / 2),
+ "setting half of the array's elements ");
+ nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)tparam.nelmts,
+ "setting all the array elements");
} /* end for */
/* Check skipping elements */
nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)1, TRUE, "skipping to first element");
- nerrors += test_skip_elmts(fapl, &cparam, &tparam, ((hsize_t)1 << cparam.max_dblk_page_nelmts_bits), TRUE, "skipping to first element in data block page");
- nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), TRUE, "skipping to last element");
+ nerrors += test_skip_elmts(fapl, &cparam, &tparam, ((hsize_t)1 << cparam.max_dblk_page_nelmts_bits),
+ TRUE, "skipping to first element in data block page");
+ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), TRUE,
+ "skipping to last element");
- /* Create Fixed Array */
+ /* Create Fixed Array */
/* MAX_NELMTS succeeds on some platforms buy may fail on others:
*
* "H5FD_sec2_truncate(): unable to extend file properly"
@@ -1779,21 +1755,23 @@ main(void)
*
* have both been seen.
*/
- tparam.nelmts = MAX_NELMTS/17;
+ tparam.nelmts = MAX_NELMTS / 17;
init_cparam(&cparam, &tparam);
/* Set the last element in the Fixed Array */
- nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), FALSE, "skipping to last element");
+ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), FALSE,
+ "skipping to last element");
} /* end for */
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All fixed array tests passed.");
@@ -1805,12 +1783,11 @@ main(void)
error:
HDputs("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(fapl); }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/fheap.c b/test/fheap.c
index 715b935..9a73cd0 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -20,59 +20,59 @@
* This file needs to access private datatypes from the H5HF package.
* This file also needs to access the fractal heap testing code.
*/
-#define H5HF_FRIEND /*suppress error about including H5HFpkg */
+#define H5HF_FRIEND /*suppress error about including H5HFpkg */
#define H5HF_TESTING
-#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5HFpkg.h" /* Fractal heaps */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
#include "H5Fpkg.h"
/* Other private headers that this test requires */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VMprivate.h" /* Vectors and arrays */
/* Max. testfile name length */
-#define FHEAP_FILENAME_LEN 1024
+#define FHEAP_FILENAME_LEN 1024
/* Object size macros */
-#define SMALL_OBJ_SIZE1 10
-#define SMALL_OBJ_SIZE2 20
-#define NUM_FILL_OBJS 11
+#define SMALL_OBJ_SIZE1 10
+#define SMALL_OBJ_SIZE2 20
+#define NUM_FILL_OBJS 11
/* "Small" heap creation parameters */
-#define SMALL_DBLOCK_OVERHEAD 21 /* Overhead for direct blocks */
-#define SMALL_CHECKSUM_DBLOCKS TRUE /* Whether to checksum direct blocks */
-#define SMALL_MAN_WIDTH 4 /* Managed obj. table width */
-#define SMALL_MAN_START_BLOCK_SIZE 512 /* Managed obj. starting block size */
-#define SMALL_MAN_MAX_DIRECT_SIZE (64 * 1024) /* Managed obj. max. direct block size */
-#define SMALL_MAN_MAX_INDEX 32 /* Managed obj. # of bits for total heap size */
-#define SMALL_MAN_START_ROOT_ROWS 1 /* Managed obj. starting # of root indirect block rows */
-#define SMALL_ID_LEN 0 /* "Default" heap ID length */
-#define SMALL_STAND_SIZE (SMALL_MAN_MAX_DIRECT_SIZE - SMALL_DBLOCK_OVERHEAD) /* Standalone obj. min. size */
+#define SMALL_DBLOCK_OVERHEAD 21 /* Overhead for direct blocks */
+#define SMALL_CHECKSUM_DBLOCKS TRUE /* Whether to checksum direct blocks */
+#define SMALL_MAN_WIDTH 4 /* Managed obj. table width */
+#define SMALL_MAN_START_BLOCK_SIZE 512 /* Managed obj. starting block size */
+#define SMALL_MAN_MAX_DIRECT_SIZE (64 * 1024) /* Managed obj. max. direct block size */
+#define SMALL_MAN_MAX_INDEX 32 /* Managed obj. # of bits for total heap size */
+#define SMALL_MAN_START_ROOT_ROWS 1 /* Managed obj. starting # of root indirect block rows */
+#define SMALL_ID_LEN 0 /* "Default" heap ID length */
+#define SMALL_STAND_SIZE (SMALL_MAN_MAX_DIRECT_SIZE - SMALL_DBLOCK_OVERHEAD) /* Standalone obj. min. size */
/* "Large" heap creation parameters */
-#define LARGE_DBLOCK_OVERHEAD 21 /* Overhead for direct blocks */
- /* (coincidentally the same size as for small direct blocks) */
-#define LARGE_CHECKSUM_DBLOCKS FALSE /* Whether to checksum direct blocks */
-#define LARGE_MAN_WIDTH 32 /* Managed obj. table width */
-#define LARGE_MAN_START_BLOCK_SIZE 4096 /* Managed obj. starting block size */
-#define LARGE_MAN_MAX_DIRECT_SIZE (1024 * 1024) /* Managed obj. max. direct block size */
-#define LARGE_MAN_MAX_INDEX 64 /* Managed obj. # of bits for total heap size */
-#define LARGE_MAN_START_ROOT_ROWS 1 /* Managed obj. starting # of root indirect block rows */
-#define LARGE_ID_LEN 0 /* "Default" heap ID length */
-#define LARGE_STAND_SIZE (LARGE_MAN_MAX_DIRECT_SIZE - LARGE_DBLOCK_OVERHEAD) /* Standalone obj. min. size */
+#define LARGE_DBLOCK_OVERHEAD 21 /* Overhead for direct blocks */
+ /* (coincidentally the same size as for small direct blocks) */
+#define LARGE_CHECKSUM_DBLOCKS FALSE /* Whether to checksum direct blocks */
+#define LARGE_MAN_WIDTH 32 /* Managed obj. table width */
+#define LARGE_MAN_START_BLOCK_SIZE 4096 /* Managed obj. starting block size */
+#define LARGE_MAN_MAX_DIRECT_SIZE (1024 * 1024) /* Managed obj. max. direct block size */
+#define LARGE_MAN_MAX_INDEX 64 /* Managed obj. # of bits for total heap size */
+#define LARGE_MAN_START_ROOT_ROWS 1 /* Managed obj. starting # of root indirect block rows */
+#define LARGE_ID_LEN 0 /* "Default" heap ID length */
+#define LARGE_STAND_SIZE (LARGE_MAN_MAX_DIRECT_SIZE - LARGE_DBLOCK_OVERHEAD) /* Standalone obj. min. size */
/* Define this macro to enable all insertion tests */
/* #define ALL_INSERT_TESTS */
/* Heap metadata macros */
-#define MAX_HEAP_ID_LEN 64 /* Max. # of bytes to use for heap ID */
-#define HEAP_ID_LEN 7 /* # of bytes to use for heap ID */
-#define SMALL_HEAP_ID_LEN 7 /* # of bytes to use for "small" heap's IDs */
-#define LARGE_HEAP_ID_LEN 12 /* # of bytes to use for "large" heap's IDs */
+#define MAX_HEAP_ID_LEN 64 /* Max. # of bytes to use for heap ID */
+#define HEAP_ID_LEN 7 /* # of bytes to use for heap ID */
+#define SMALL_HEAP_ID_LEN 7 /* # of bytes to use for "small" heap's IDs */
+#define LARGE_HEAP_ID_LEN 12 /* # of bytes to use for "large" heap's IDs */
/* Max. # of rows in root indirect block */
#define HEAP_MAX_ROOT_ROWS(fh) H5HF_get_max_root_rows(fh)
/* Width of doubling table for heap */
@@ -87,98 +87,95 @@
#define DBLOCK_FREE(fh, r) H5HF_get_dblock_free_test(fh, r)
/* The number of settings for testing: page buffering, file space strategy and persisting free-space */
-#define NUM_PB_FS 6
-#define PAGE_BUFFER_PAGE_SIZE 4096
+#define NUM_PB_FS 6
+#define PAGE_BUFFER_PAGE_SIZE 4096
-const char *FILENAME[] = {
- "fheap",
- NULL
-};
+const char *FILENAME[] = {"fheap", NULL};
/* Types of tests to perform */
typedef enum {
- FHEAP_TEST_NORMAL, /* "Normal" test, with no testing parameters set */
- FHEAP_TEST_REOPEN, /* Set the reopen_heap flag */
- FHEAP_TEST_NTESTS /* The number of test types, must be last */
+ FHEAP_TEST_NORMAL, /* "Normal" test, with no testing parameters set */
+ FHEAP_TEST_REOPEN, /* Set the reopen_heap flag */
+ FHEAP_TEST_NTESTS /* The number of test types, must be last */
} fheap_test_type_t;
/* Order to delete objects */
typedef enum {
- FHEAP_DEL_FORWARD, /* Delete objects from 0 -> nobjs */
- FHEAP_DEL_REVERSE, /* Delete objects from nobjs -> 0 */
- FHEAP_DEL_HEAP, /* Delete entire heap at once */
- FHEAP_DEL_NDIRS /* The number of different deletion orders, must be last */
+ FHEAP_DEL_FORWARD, /* Delete objects from 0 -> nobjs */
+ FHEAP_DEL_REVERSE, /* Delete objects from nobjs -> 0 */
+ FHEAP_DEL_HEAP, /* Delete entire heap at once */
+ FHEAP_DEL_NDIRS /* The number of different deletion orders, must be last */
} fheap_test_del_dir_t;
/* Order to delete objects */
typedef enum {
- FHEAP_DEL_DRAIN_ALL, /* Don't drain half of objects first */
- FHEAP_DEL_DRAIN_HALF, /* Don't drain half of objects first */
- FHEAP_DEL_DRAIN_N /* The number of different ways to drain, must be last */
+ FHEAP_DEL_DRAIN_ALL, /* Don't drain half of objects first */
+ FHEAP_DEL_DRAIN_HALF, /* Don't drain half of objects first */
+ FHEAP_DEL_DRAIN_N /* The number of different ways to drain, must be last */
} fheap_test_del_drain_t;
/* Size of objects for "bulk" filling heap blocks */
typedef enum {
- FHEAP_TEST_FILL_LARGE, /* Fill heap blocks with "large" objects */
- FHEAP_TEST_FILL_SINGLE, /* Fill heap blocks with single object */
- FHEAP_TEST_FILL_N /* The number of different ways to test filling heap blocks, must be last */
+ FHEAP_TEST_FILL_LARGE, /* Fill heap blocks with "large" objects */
+ FHEAP_TEST_FILL_SINGLE, /* Fill heap blocks with single object */
+ FHEAP_TEST_FILL_N /* The number of different ways to test filling heap blocks, must be last */
} fheap_test_fill_t;
/* Whether to compress blocks (during random tests) */
typedef enum {
- FHEAP_TEST_NO_COMPRESS, /* Don't compress direct blocks */
- FHEAP_TEST_COMPRESS, /* Compress direct blocks */
- FHEAP_TEST_COMP_N /* The number of different ways to test compressing heap blocks, must be last */
+ FHEAP_TEST_NO_COMPRESS, /* Don't compress direct blocks */
+ FHEAP_TEST_COMPRESS, /* Compress direct blocks */
+ FHEAP_TEST_COMP_N /* The number of different ways to test compressing heap blocks, must be last */
} fheap_test_comp_t;
/* Testing parameters */
typedef struct fheap_test_param_t {
- fheap_test_type_t reopen_heap; /* Whether to re-open the heap during the test */
- fheap_test_del_dir_t del_dir; /* Whether to delete objects forward or reverse */
- fheap_test_del_drain_t drain_half; /* Whether to drain half of the objects & refill, when deleting objects */
- fheap_test_fill_t fill; /* How to "bulk" fill heap blocks */
- size_t actual_id_len; /* The actual length of heap IDs for a test */
- fheap_test_comp_t comp; /* Whether to compress the blocks or not */
- hid_t my_fcpl; /* File creation property list with file space strategy setting */
+ fheap_test_type_t reopen_heap; /* Whether to re-open the heap during the test */
+ fheap_test_del_dir_t del_dir; /* Whether to delete objects forward or reverse */
+ fheap_test_del_drain_t
+ drain_half; /* Whether to drain half of the objects & refill, when deleting objects */
+ fheap_test_fill_t fill; /* How to "bulk" fill heap blocks */
+ size_t actual_id_len; /* The actual length of heap IDs for a test */
+ fheap_test_comp_t comp; /* Whether to compress the blocks or not */
+ hid_t my_fcpl; /* File creation property list with file space strategy setting */
} fheap_test_param_t;
/* Heap state information */
typedef struct fheap_heap_state_t {
- size_t man_nobjs; /* # of managed objects within heap */
- hsize_t man_size; /* Size of managed object heap */
- hsize_t man_alloc_size; /* Size of managed object heap allocated */
- hsize_t man_free_space; /* Managed object free space within heap */
- size_t huge_nobjs; /* # of 'huge' objects within heap */
- hsize_t huge_size; /* Size of 'huge' object heap */
- size_t tiny_nobjs; /* # of 'tiny' objects within heap */
- hsize_t tiny_size; /* Size of 'tiny' object heap */
+ size_t man_nobjs; /* # of managed objects within heap */
+ hsize_t man_size; /* Size of managed object heap */
+ hsize_t man_alloc_size; /* Size of managed object heap allocated */
+ hsize_t man_free_space; /* Managed object free space within heap */
+ size_t huge_nobjs; /* # of 'huge' objects within heap */
+ hsize_t huge_size; /* Size of 'huge' object heap */
+ size_t tiny_nobjs; /* # of 'tiny' objects within heap */
+ hsize_t tiny_size; /* Size of 'tiny' object heap */
} fheap_heap_state_t;
/* Heap IDs to retain */
typedef struct fheap_heap_ids_t {
- size_t num_ids; /* # of heap IDs in array */
- size_t alloc_ids; /* # of heap IDs allocated in array */
- unsigned char *ids; /* Array of object heap IDs */
- size_t *lens; /* Array of object lengths */
- size_t *offs; /* Array of object offsets (in global shared write buffer) */
+ size_t num_ids; /* # of heap IDs in array */
+ size_t alloc_ids; /* # of heap IDs allocated in array */
+ unsigned char *ids; /* Array of object heap IDs */
+ size_t * lens; /* Array of object lengths */
+ size_t * offs; /* Array of object offsets (in global shared write buffer) */
} fheap_heap_ids_t;
/* Local variables */
-unsigned char *shared_wobj_g; /* Pointer to shared write buffer for objects */
-unsigned char *shared_robj_g; /* Pointer to shared read buffer for objects */
-size_t shared_obj_size_g; /* Size of shared objects */
-unsigned char *shared_ids_g = NULL; /* Array of shared object heap IDs */
-size_t *shared_lens_g = NULL; /* Array of shared object lengths */
-size_t *shared_offs_g = NULL; /* Array of shared object offsets */
-size_t shared_alloc_ids_g = 0; /* # of shared heap IDs allocated in array */
+unsigned char *shared_wobj_g; /* Pointer to shared write buffer for objects */
+unsigned char *shared_robj_g; /* Pointer to shared read buffer for objects */
+size_t shared_obj_size_g; /* Size of shared objects */
+unsigned char *shared_ids_g = NULL; /* Array of shared object heap IDs */
+size_t * shared_lens_g = NULL; /* Array of shared object lengths */
+size_t * shared_offs_g = NULL; /* Array of shared object offsets */
+size_t shared_alloc_ids_g = 0; /* # of shared heap IDs allocated in array */
/* Local routines */
static int init_small_cparam(H5HF_create_t *cparam);
static int init_large_cparam(H5HF_create_t *cparam);
static int check_stats(const H5HF_t *fh, const fheap_heap_state_t *state);
-static int del_objs(H5F_t *f, H5HF_t **fh, fheap_test_param_t *tparam,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids);
-
+static int del_objs(H5F_t *f, H5HF_t **fh, fheap_test_param_t *tparam, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids);
/*-------------------------------------------------------------------------
* Function: init_small_cparam
@@ -202,21 +199,20 @@ init_small_cparam(H5HF_create_t *cparam)
HDmemset(cparam, 0, sizeof(H5HF_create_t));
/* General parameters */
- cparam->id_len = SMALL_ID_LEN;
- cparam->max_man_size = SMALL_STAND_SIZE;
+ cparam->id_len = SMALL_ID_LEN;
+ cparam->max_man_size = SMALL_STAND_SIZE;
cparam->checksum_dblocks = SMALL_CHECKSUM_DBLOCKS;
/* Managed object doubling-table parameters */
- cparam->managed.width = SMALL_MAN_WIDTH;
+ cparam->managed.width = SMALL_MAN_WIDTH;
cparam->managed.start_block_size = SMALL_MAN_START_BLOCK_SIZE;
- cparam->managed.max_direct_size = SMALL_MAN_MAX_DIRECT_SIZE;
- cparam->managed.max_index = SMALL_MAN_MAX_INDEX;
- cparam->managed.start_root_rows = SMALL_MAN_START_ROOT_ROWS;
+ cparam->managed.max_direct_size = SMALL_MAN_MAX_DIRECT_SIZE;
+ cparam->managed.max_index = SMALL_MAN_MAX_INDEX;
+ cparam->managed.start_root_rows = SMALL_MAN_START_ROOT_ROWS;
- return(0);
+ return (0);
} /* init_small_cparam() */
-
/*-------------------------------------------------------------------------
* Function: init_large_cparam
*
@@ -239,21 +235,20 @@ init_large_cparam(H5HF_create_t *cparam)
HDmemset(cparam, 0, sizeof(H5HF_create_t));
/* General parameters */
- cparam->id_len = LARGE_ID_LEN;
- cparam->max_man_size = LARGE_STAND_SIZE;
+ cparam->id_len = LARGE_ID_LEN;
+ cparam->max_man_size = LARGE_STAND_SIZE;
cparam->checksum_dblocks = LARGE_CHECKSUM_DBLOCKS;
/* Managed object doubling-table parameters */
- cparam->managed.width = LARGE_MAN_WIDTH;
+ cparam->managed.width = LARGE_MAN_WIDTH;
cparam->managed.start_block_size = LARGE_MAN_START_BLOCK_SIZE;
- cparam->managed.max_direct_size = LARGE_MAN_MAX_DIRECT_SIZE;
- cparam->managed.max_index = LARGE_MAN_MAX_INDEX;
- cparam->managed.start_root_rows = LARGE_MAN_START_ROOT_ROWS;
+ cparam->managed.max_direct_size = LARGE_MAN_MAX_DIRECT_SIZE;
+ cparam->managed.max_index = LARGE_MAN_MAX_INDEX;
+ cparam->managed.start_root_rows = LARGE_MAN_START_ROOT_ROWS;
- return(0);
+ return (0);
} /* init_large_cparam() */
-
/*-------------------------------------------------------------------------
* Function: check_stats
*
@@ -271,52 +266,61 @@ init_large_cparam(H5HF_create_t *cparam)
static int
check_stats(const H5HF_t *fh, const fheap_heap_state_t *state)
{
- H5HF_stat_t heap_stats; /* Statistics about the heap */
+ H5HF_stat_t heap_stats; /* Statistics about the heap */
/* Get statistics for heap and verify they are correct */
- if(H5HF_stat_info(fh, &heap_stats) < 0)
+ if (H5HF_stat_info(fh, &heap_stats) < 0)
FAIL_STACK_ERROR
- if(heap_stats.man_nobjs != state->man_nobjs) {
- HDfprintf(stdout, "heap_stats.man_nobjs = %" PRIuHSIZE ", state->man_nobjs = %zu\n", heap_stats.man_nobjs, state->man_nobjs);
+ if (heap_stats.man_nobjs != state->man_nobjs) {
+ HDfprintf(stdout, "heap_stats.man_nobjs = %" PRIuHSIZE ", state->man_nobjs = %zu\n",
+ heap_stats.man_nobjs, state->man_nobjs);
TEST_ERROR
} /* end if */
- if(heap_stats.man_size != state->man_size) {
- HDfprintf(stdout, "heap_stats.man_size = %" PRIuHSIZE ", state->man_size = %" PRIuHSIZE "\n", heap_stats.man_size, state->man_size);
+ if (heap_stats.man_size != state->man_size) {
+ HDfprintf(stdout, "heap_stats.man_size = %" PRIuHSIZE ", state->man_size = %" PRIuHSIZE "\n",
+ heap_stats.man_size, state->man_size);
TEST_ERROR
} /* end if */
- if(heap_stats.man_alloc_size != state->man_alloc_size) {
- HDfprintf(stdout, "heap_stats.man_alloc_size = %" PRIuHSIZE ", state->man_alloc_size = %" PRIuHSIZE "\n", heap_stats.man_alloc_size, state->man_alloc_size);
+ if (heap_stats.man_alloc_size != state->man_alloc_size) {
+ HDfprintf(stdout,
+ "heap_stats.man_alloc_size = %" PRIuHSIZE ", state->man_alloc_size = %" PRIuHSIZE "\n",
+ heap_stats.man_alloc_size, state->man_alloc_size);
TEST_ERROR
} /* end if */
- if(heap_stats.man_free_space != state->man_free_space) {
- HDfprintf(stdout, "heap_stats.man_free_space = %" PRIuHSIZE ", state->man_free_space = %" PRIuHSIZE "\n", heap_stats.man_free_space, state->man_free_space);
+ if (heap_stats.man_free_space != state->man_free_space) {
+ HDfprintf(stdout,
+ "heap_stats.man_free_space = %" PRIuHSIZE ", state->man_free_space = %" PRIuHSIZE "\n",
+ heap_stats.man_free_space, state->man_free_space);
TEST_ERROR
} /* end if */
- if(heap_stats.huge_nobjs != state->huge_nobjs) {
- HDfprintf(stdout, "heap_stats.huge_nobjs = %" PRIuHSIZE ", state->huge_nobjs = %zu\n", heap_stats.huge_nobjs, state->huge_nobjs);
+ if (heap_stats.huge_nobjs != state->huge_nobjs) {
+ HDfprintf(stdout, "heap_stats.huge_nobjs = %" PRIuHSIZE ", state->huge_nobjs = %zu\n",
+ heap_stats.huge_nobjs, state->huge_nobjs);
TEST_ERROR
} /* end if */
- if(heap_stats.huge_size != state->huge_size) {
- HDfprintf(stdout, "heap_stats.huge_size = %" PRIuHSIZE ", state->huge_size = %" PRIuHSIZE "\n", heap_stats.huge_size, state->huge_size);
+ if (heap_stats.huge_size != state->huge_size) {
+ HDfprintf(stdout, "heap_stats.huge_size = %" PRIuHSIZE ", state->huge_size = %" PRIuHSIZE "\n",
+ heap_stats.huge_size, state->huge_size);
TEST_ERROR
} /* end if */
- if(heap_stats.tiny_nobjs != state->tiny_nobjs) {
- HDfprintf(stdout, "heap_stats.tiny_nobjs = %" PRIuHSIZE ", state->tiny_nobjs = %zu\n", heap_stats.tiny_nobjs, state->tiny_nobjs);
+ if (heap_stats.tiny_nobjs != state->tiny_nobjs) {
+ HDfprintf(stdout, "heap_stats.tiny_nobjs = %" PRIuHSIZE ", state->tiny_nobjs = %zu\n",
+ heap_stats.tiny_nobjs, state->tiny_nobjs);
TEST_ERROR
} /* end if */
- if(heap_stats.tiny_size != state->tiny_size) {
- HDfprintf(stdout, "heap_stats.tiny_size = %" PRIuHSIZE ", state->tiny_size = %" PRIuHSIZE "\n", heap_stats.tiny_size, state->tiny_size);
+ if (heap_stats.tiny_size != state->tiny_size) {
+ HDfprintf(stdout, "heap_stats.tiny_size = %" PRIuHSIZE ", state->tiny_size = %" PRIuHSIZE "\n",
+ heap_stats.tiny_size, state->tiny_size);
TEST_ERROR
} /* end if */
/* All tests passed */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* check_stats() */
-
/*-------------------------------------------------------------------------
* Function: op_memcpy
*
@@ -337,10 +341,9 @@ op_memcpy(const void *obj, size_t obj_len, void *op_data)
/* Make copy of the object */
HDmemcpy(op_data, obj, obj_len);
- return(SUCCEED);
+ return (SUCCEED);
} /* op_memcpy() */
-
/*-------------------------------------------------------------------------
* Function: add_obj
*
@@ -366,13 +369,12 @@ op_memcpy(const void *obj, size_t obj_len, void *op_data)
*-------------------------------------------------------------------------
*/
static int
-add_obj(H5HF_t *fh, size_t obj_off,
- size_t obj_size, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+add_obj(H5HF_t *fh, size_t obj_off, size_t obj_size, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
{
- unsigned char heap_id[MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */
- unsigned char *obj; /* Buffer for object to insert */
- size_t id_len; /* Size of fractal heap IDs */
- size_t robj_size; /* Object size read in */
+ unsigned char heap_id[MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */
+ unsigned char *obj; /* Buffer for object to insert */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t robj_size; /* Object size read in */
/* Sanity check */
HDassert(fh);
@@ -381,27 +383,27 @@ add_obj(H5HF_t *fh, size_t obj_off,
obj = &shared_wobj_g[obj_off];
/* Get information about heap ID lengths */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > MAX_HEAP_ID_LEN)
+ if (id_len > MAX_HEAP_ID_LEN)
TEST_ERROR
/* Insert object */
HDmemset(heap_id, 0, id_len);
- if(H5HF_insert(fh, obj_size, obj, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, obj, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for tracking the heap's state */
- if(state) {
- size_t tiny_max_len; /* Max. length of tiny objects */
- hbool_t tiny_len_extended; /* Do tiny objects use two bytes for the length? */
+ if (state) {
+ size_t tiny_max_len; /* Max. length of tiny objects */
+ hbool_t tiny_len_extended; /* Do tiny objects use two bytes for the length? */
/* Check information about tiny objects */
- if(H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
+ if (H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
FAIL_STACK_ERROR
/* Adjust state of heap */
- if(obj_size <= tiny_max_len) {
+ if (obj_size <= tiny_max_len) {
state->tiny_nobjs++;
state->tiny_size += obj_size;
} /* end if */
@@ -411,36 +413,39 @@ add_obj(H5HF_t *fh, size_t obj_off,
} /* end else */
/* Check free space left in heap */
- if(check_stats(fh, state))
+ if (check_stats(fh, state))
TEST_ERROR
} /* end if */
/* Read in object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(obj, shared_robj_g, obj_size))
+ if (HDmemcmp(obj, shared_robj_g, obj_size))
TEST_ERROR
/* If the heap IDs are to be retained, append them to the list */
- if(keep_ids) {
+ if (keep_ids) {
/* Check for needing to increase size of heap ID array */
- if(keep_ids->num_ids + 1 > keep_ids->alloc_ids) {
+ if (keep_ids->num_ids + 1 > keep_ids->alloc_ids) {
unsigned char *tmp_ids;
- size_t *tmp_lens;
- size_t *tmp_offs;
+ size_t * tmp_lens;
+ size_t * tmp_offs;
keep_ids->alloc_ids = MAX(1024, (keep_ids->alloc_ids * 2));
- if(NULL == (tmp_ids = (unsigned char *)H5MM_realloc(keep_ids->ids, id_len * keep_ids->alloc_ids)))
+ if (NULL ==
+ (tmp_ids = (unsigned char *)H5MM_realloc(keep_ids->ids, id_len * keep_ids->alloc_ids)))
TEST_ERROR
keep_ids->ids = tmp_ids;
- if(NULL == (tmp_lens = (size_t *)H5MM_realloc(keep_ids->lens, sizeof(size_t) * keep_ids->alloc_ids)))
+ if (NULL ==
+ (tmp_lens = (size_t *)H5MM_realloc(keep_ids->lens, sizeof(size_t) * keep_ids->alloc_ids)))
TEST_ERROR
keep_ids->lens = tmp_lens;
- if(NULL == (tmp_offs = (size_t *)H5MM_realloc(keep_ids->offs, sizeof(size_t) * keep_ids->alloc_ids)))
+ if (NULL ==
+ (tmp_offs = (size_t *)H5MM_realloc(keep_ids->offs, sizeof(size_t) * keep_ids->alloc_ids)))
TEST_ERROR
keep_ids->offs = tmp_offs;
} /* end if */
@@ -455,13 +460,12 @@ add_obj(H5HF_t *fh, size_t obj_off,
} /* end if */
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* add_obj() */
-
/*-------------------------------------------------------------------------
* Function: get_del_string
*
@@ -482,23 +486,22 @@ get_del_string(const fheap_test_param_t *tparam)
char *str;
/* Remove half of total objects from heap */
- if(tparam->del_dir == FHEAP_DEL_FORWARD)
- if(tparam->drain_half == FHEAP_DEL_DRAIN_ALL)
+ if (tparam->del_dir == FHEAP_DEL_FORWARD)
+ if (tparam->drain_half == FHEAP_DEL_DRAIN_ALL)
str = H5MM_strdup("(all - forward)");
else
str = H5MM_strdup("(half, refill, all - forward)");
- else if(tparam->del_dir == FHEAP_DEL_REVERSE)
- if(tparam->drain_half == FHEAP_DEL_DRAIN_ALL)
+ else if (tparam->del_dir == FHEAP_DEL_REVERSE)
+ if (tparam->drain_half == FHEAP_DEL_DRAIN_ALL)
str = H5MM_strdup("(all - reverse)");
else
str = H5MM_strdup("(half, refill, all - reverse)");
else
str = H5MM_strdup("(all - deleting heap)");
- return(str);
+ return (str);
} /* get_del_string() */
-
/*-------------------------------------------------------------------------
* Function: get_fill_size
*
@@ -515,22 +518,21 @@ get_del_string(const fheap_test_param_t *tparam)
H5_ATTR_PURE static size_t
get_fill_size(const fheap_test_param_t *tparam)
{
- switch(tparam->fill) {
+ switch (tparam->fill) {
case FHEAP_TEST_FILL_LARGE:
- return((size_t)(-1));
+ return ((size_t)(-1));
case FHEAP_TEST_FILL_SINGLE:
- return((size_t)0);
+ return ((size_t)0);
case FHEAP_TEST_FILL_N:
default:
HDassert(0 && "Unknown bulk fill type?!?");
} /* end switch */
- return(0);
+ return (0);
} /* get_fill_size() */
-
/*-------------------------------------------------------------------------
* Function: begin_test
*
@@ -553,11 +555,10 @@ get_fill_size(const fheap_test_param_t *tparam)
*/
H5_GCC_DIAG_OFF("format-nonliteral")
static int
-begin_test(fheap_test_param_t *tparam, const char *base_desc,
- fheap_heap_ids_t *keep_ids, size_t *fill_size)
+begin_test(fheap_test_param_t *tparam, const char *base_desc, fheap_heap_ids_t *keep_ids, size_t *fill_size)
{
- char *del_str = NULL; /* Deletion order description */
- char *test_desc = NULL; /* Test description */
+ char *del_str = NULL; /* Deletion order description */
+ char *test_desc = NULL; /* Test description */
/*
* Test filling & removing all (small) objects from root direct block of absolute heap
@@ -574,15 +575,14 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc,
HDmemset(keep_ids, 0, sizeof(fheap_heap_ids_t));
/* Retrieve "bulk" filling object size */
- if(fill_size)
+ if (fill_size)
*fill_size = get_fill_size(tparam);
/* Success */
- return(0);
+ return (0);
} /* end begin_test() */
H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: reopen_file
*
@@ -597,29 +597,29 @@ H5_GCC_DIAG_ON("format-nonliteral")
*-------------------------------------------------------------------------
*/
static int
-reopen_file(hid_t *file, H5F_t **f, const char *filename, hid_t fapl,
- H5HF_t **fh, haddr_t fh_addr, const fheap_test_param_t *tparam)
+reopen_file(hid_t *file, H5F_t **f, const char *filename, hid_t fapl, H5HF_t **fh, haddr_t fh_addr,
+ const fheap_test_param_t *tparam)
{
/* Check for closing & re-opening the heap */
/* (actually will close & re-open the file as well) */
- if(tparam->reopen_heap) {
+ if (tparam->reopen_heap) {
/* Close heap */
- if(H5HF_close(*fh) < 0)
+ if (H5HF_close(*fh) < 0)
FAIL_STACK_ERROR
*fh = NULL;
/* Close file */
- if(H5Fclose(*file) < 0)
+ if (H5Fclose(*file) < 0)
FAIL_STACK_ERROR
*file = (-1);
- *f = NULL;
+ *f = NULL;
/* Re-open the file */
- if((*file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((*file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (*f = (H5F_t *)H5VL_object(*file)))
+ if (NULL == (*f = (H5F_t *)H5VL_object(*file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -627,18 +627,17 @@ reopen_file(hid_t *file, H5F_t **f, const char *filename, hid_t fapl,
FAIL_STACK_ERROR
/* Re-open heap */
- if(NULL == (*fh = H5HF_open(*f, fh_addr)))
+ if (NULL == (*fh = H5HF_open(*f, fh_addr)))
FAIL_STACK_ERROR
} /* end if */
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end reopen_file() */
-
/*-------------------------------------------------------------------------
* Function: open_heap
*
@@ -654,23 +653,23 @@ error:
*-------------------------------------------------------------------------
*/
static int
-open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam,
- const fheap_test_param_t *tparam, hid_t *file, H5F_t **f, H5HF_t **fh,
- haddr_t *fh_addr, fheap_heap_state_t *state, h5_stat_size_t *empty_size)
+open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam, const fheap_test_param_t *tparam,
+ hid_t *file, H5F_t **f, H5HF_t **fh, haddr_t *fh_addr, fheap_heap_state_t *state,
+ h5_stat_size_t *empty_size)
{
- size_t id_len; /* Size of fractal heap IDs */
+ size_t id_len; /* Size of fractal heap IDs */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, (size_t)FHEAP_FILENAME_LEN);
/* Create the file to work on */
- if((*file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((*file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Check for deleting the entire heap */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
/* Get a pointer to the internal file object */
- if(NULL == (*f = (H5F_t *)H5VL_object(*file)))
+ if (NULL == (*f = (H5F_t *)H5VL_object(*file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -678,42 +677,42 @@ open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam,
FAIL_STACK_ERROR
/* Create absolute heap */
- if(NULL == (*fh = H5HF_create(*f, cparam)))
+ if (NULL == (*fh = H5HF_create(*f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(*fh, &id_len) < 0)
+ if (H5HF_get_id_len(*fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > tparam->actual_id_len)
+ if (id_len > tparam->actual_id_len)
TEST_ERROR
- if(H5HF_get_heap_addr(*fh, fh_addr) < 0)
+ if (H5HF_get_heap_addr(*fh, fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(*fh_addr))
+ if (!H5F_addr_defined(*fh_addr))
TEST_ERROR
HDmemset(state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(*fh, state))
+ if (check_stats(*fh, state))
TEST_ERROR
/* Prepare for querying the size of a file with an empty heap */
/* Close (empty) heap */
- if(H5HF_close(*fh) < 0)
+ if (H5HF_close(*fh) < 0)
FAIL_STACK_ERROR
*fh = NULL;
} /* end if */
/* Close file */
- if(H5Fclose(*file) < 0)
+ if (H5Fclose(*file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((*empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((*empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((*file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((*file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (*f = (H5F_t *)H5VL_object(*file)))
+ if (NULL == (*f = (H5F_t *)H5VL_object(*file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -721,36 +720,35 @@ open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam,
FAIL_STACK_ERROR
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Create absolute heap */
- if(NULL == (*fh = H5HF_create(*f, cparam)))
+ if (NULL == (*fh = H5HF_create(*f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(*fh, &id_len) < 0)
+ if (H5HF_get_id_len(*fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > tparam->actual_id_len)
+ if (id_len > tparam->actual_id_len)
TEST_ERROR
- if(H5HF_get_heap_addr(*fh, fh_addr) < 0)
+ if (H5HF_get_heap_addr(*fh, fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(*fh_addr))
+ if (!H5F_addr_defined(*fh_addr))
TEST_ERROR
HDmemset(state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(*fh, state))
+ if (check_stats(*fh, state))
TEST_ERROR
} /* end if */
else {
/* Re-open heap */
- if(NULL == (*fh = H5HF_open(*f, *fh_addr)))
+ if (NULL == (*fh = H5HF_open(*f, *fh_addr)))
FAIL_STACK_ERROR
} /* end else */
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end open_heap() */
-
/*-------------------------------------------------------------------------
* Function: reopen_heap
*
@@ -766,18 +764,17 @@ error:
*-------------------------------------------------------------------------
*/
static int
-reopen_heap(H5F_t *f, H5HF_t **fh, haddr_t fh_addr,
- const fheap_test_param_t *tparam)
+reopen_heap(H5F_t *f, H5HF_t **fh, haddr_t fh_addr, const fheap_test_param_t *tparam)
{
/* Check for closing & re-opening the heap */
- if(tparam->reopen_heap) {
+ if (tparam->reopen_heap) {
/* Close (empty) heap */
- if(H5HF_close(*fh) < 0)
+ if (H5HF_close(*fh) < 0)
FAIL_STACK_ERROR
*fh = NULL;
/* Re-open heap */
- if(NULL == (*fh = H5HF_open(f, fh_addr)))
+ if (NULL == (*fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
} /* end if */
@@ -788,7 +785,6 @@ error:
return -1;
} /* end reopen_heap() */
-
/*-------------------------------------------------------------------------
* Function: close_heap
*
@@ -803,60 +799,57 @@ error:
*-------------------------------------------------------------------------
*/
static int
-close_heap(char *filename, hid_t fapl, fheap_test_param_t *tparam,
- hid_t file, H5F_t *f, H5HF_t **fh, haddr_t fh_addr,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids,
- h5_stat_size_t empty_size)
+close_heap(char *filename, hid_t fapl, fheap_test_param_t *tparam, hid_t file, H5F_t *f, H5HF_t **fh,
+ haddr_t fh_addr, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids, h5_stat_size_t empty_size)
{
- h5_stat_size_t file_size; /* Size of file currently */
+ h5_stat_size_t file_size; /* Size of file currently */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- if(check_stats(*fh, state))
+ if (check_stats(*fh, state))
TEST_ERROR
/* Check for deleting the objects in the heap */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
/* Delete objects inserted (either forward or reverse order) */
- if(del_objs(f, fh, tparam, state, keep_ids))
+ if (del_objs(f, fh, tparam, state, keep_ids))
FAIL_STACK_ERROR
} /* end if */
/* Close the fractal heap */
- if(H5HF_close(*fh) < 0)
+ if (H5HF_close(*fh) < 0)
FAIL_STACK_ERROR
*fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Success */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* end close_heap() */
-
/*-------------------------------------------------------------------------
* Function: del_objs_half_refill
*
@@ -872,15 +865,14 @@ error:
*-------------------------------------------------------------------------
*/
static int
-del_objs_half_refill(H5F_t *f, H5HF_t **fh, fheap_test_param_t *tparam,
- fheap_heap_ids_t *keep_ids)
+del_objs_half_refill(H5F_t *f, H5HF_t **fh, fheap_test_param_t *tparam, fheap_heap_ids_t *keep_ids)
{
- unsigned char *wobj; /* Buffer for object to insert */
- haddr_t fh_addr = HADDR_UNDEF; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t half_nobjs; /* Half of total # of objects */
- size_t obj_idx; /* Index of the object to remove */
- size_t u; /* Local index variable */
+ unsigned char *wobj; /* Buffer for object to insert */
+ haddr_t fh_addr = HADDR_UNDEF; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t half_nobjs; /* Half of total # of objects */
+ size_t obj_idx; /* Index of the object to remove */
+ size_t u; /* Local index variable */
/* Sanity check */
HDassert(fh);
@@ -888,69 +880,68 @@ del_objs_half_refill(H5F_t *f, H5HF_t **fh, fheap_test_param_t *tparam,
HDassert(keep_ids);
/* Check for closing & re-opening the heap */
- if(tparam->reopen_heap) {
- if(H5HF_get_heap_addr(*fh, &fh_addr) < 0)
+ if (tparam->reopen_heap) {
+ if (H5HF_get_heap_addr(*fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
} /* end if */
/* Get information about heap ID lengths */
- if(H5HF_get_id_len(*fh, &id_len) < 0)
+ if (H5HF_get_id_len(*fh, &id_len) < 0)
FAIL_STACK_ERROR
/* Remove half of total objects from heap */
- if(tparam->del_dir == FHEAP_DEL_FORWARD)
+ if (tparam->del_dir == FHEAP_DEL_FORWARD)
obj_idx = 0;
else
obj_idx = keep_ids->num_ids - 1;
half_nobjs = keep_ids->num_ids / 2;
- for(u = 0; u < half_nobjs; u++) {
+ for (u = 0; u < half_nobjs; u++) {
/* Remove object from heap */
- if(H5HF_remove(*fh, &keep_ids->ids[id_len * obj_idx]) < 0)
+ if (H5HF_remove(*fh, &keep_ids->ids[id_len * obj_idx]) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Adjust index of object to delete next */
- if(tparam->del_dir == FHEAP_DEL_FORWARD)
+ if (tparam->del_dir == FHEAP_DEL_FORWARD)
obj_idx++;
else
obj_idx--;
} /* end for */
/* Re-insert half of total objects back into heap */
- if(tparam->del_dir == FHEAP_DEL_FORWARD)
+ if (tparam->del_dir == FHEAP_DEL_FORWARD)
obj_idx = 0;
else
obj_idx = keep_ids->num_ids - 1;
- for(u = 0; u < half_nobjs; u++) {
+ for (u = 0; u < half_nobjs; u++) {
/* Re-insert object */
wobj = &shared_wobj_g[keep_ids->offs[obj_idx]];
- if(H5HF_insert(*fh, keep_ids->lens[obj_idx], wobj, &keep_ids->ids[id_len * obj_idx]) < 0)
+ if (H5HF_insert(*fh, keep_ids->lens[obj_idx], wobj, &keep_ids->ids[id_len * obj_idx]) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Adjust index of object to delete next */
- if(tparam->del_dir == FHEAP_DEL_FORWARD)
+ if (tparam->del_dir == FHEAP_DEL_FORWARD)
obj_idx++;
else
obj_idx--;
} /* end for */
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* del_objs_half_refill() */
-
/*-------------------------------------------------------------------------
* Function: del_objs
*
@@ -966,13 +957,13 @@ error:
*-------------------------------------------------------------------------
*/
static int
-del_objs(H5F_t *f, H5HF_t **fh, fheap_test_param_t *tparam,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+del_objs(H5F_t *f, H5HF_t **fh, fheap_test_param_t *tparam, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids)
{
- haddr_t fh_addr = HADDR_UNDEF; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t obj_idx; /* Index of the object to remove */
- size_t u; /* Local index variable */
+ haddr_t fh_addr = HADDR_UNDEF; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t obj_idx; /* Index of the object to remove */
+ size_t u; /* Local index variable */
/* Sanity check */
HDassert(fh);
@@ -981,38 +972,38 @@ del_objs(H5F_t *f, H5HF_t **fh, fheap_test_param_t *tparam,
HDassert(keep_ids);
/* Check for first deleting half of objects & then re-inserting them */
- if(tparam->drain_half == FHEAP_DEL_DRAIN_HALF)
- if(del_objs_half_refill(f, fh, tparam, keep_ids))
+ if (tparam->drain_half == FHEAP_DEL_DRAIN_HALF)
+ if (del_objs_half_refill(f, fh, tparam, keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(tparam->reopen_heap) {
- if(H5HF_get_heap_addr(*fh, &fh_addr) < 0)
+ if (tparam->reopen_heap) {
+ if (H5HF_get_heap_addr(*fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
} /* end if */
/* Get information about heap ID lengths */
- if(H5HF_get_id_len(*fh, &id_len) < 0)
+ if (H5HF_get_id_len(*fh, &id_len) < 0)
FAIL_STACK_ERROR
/* Remove all objects from heap */
- if(tparam->del_dir == FHEAP_DEL_FORWARD)
+ if (tparam->del_dir == FHEAP_DEL_FORWARD)
obj_idx = 0;
else
obj_idx = keep_ids->num_ids - 1;
- for(u = 0; u < keep_ids->num_ids; u++) {
+ for (u = 0; u < keep_ids->num_ids; u++) {
/* Remove object from heap */
- if(H5HF_remove(*fh, &keep_ids->ids[id_len * obj_idx]) < 0)
+ if (H5HF_remove(*fh, &keep_ids->ids[id_len * obj_idx]) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Adjust index of object to delete next */
- if(tparam->del_dir == FHEAP_DEL_FORWARD)
+ if (tparam->del_dir == FHEAP_DEL_FORWARD)
obj_idx++;
else
obj_idx--;
@@ -1022,17 +1013,16 @@ del_objs(H5F_t *f, H5HF_t **fh, fheap_test_param_t *tparam,
HDmemset(state, 0, sizeof(fheap_heap_state_t));
/* Check up on heap... */
- if(check_stats(*fh, state))
+ if (check_stats(*fh, state))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* del_objs() */
-
/*-------------------------------------------------------------------------
* Function: fill_heap
*
@@ -1058,19 +1048,19 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids)
{
- unsigned char *wobj; /* Buffer for object to insert */
- unsigned char *curr_id_ptr; /* Pointer into shared ID array */
- size_t *curr_len_ptr; /* Pointer into shared length array */
- size_t *curr_off_ptr; /* Pointer into shared offset array */
- size_t num_ids = 0; /* # of heap IDs in array */
- size_t data_size; /* Size of data portion of heap block */
- size_t last_obj_len; /* Size of last object inserted into heap */
- size_t obj_off; /* Offset of object in shared write buffer */
- size_t id_len; /* Size of fractal heap IDs */
- unsigned u; /* Local index variable */
+ unsigned char *wobj; /* Buffer for object to insert */
+ unsigned char *curr_id_ptr; /* Pointer into shared ID array */
+ size_t * curr_len_ptr; /* Pointer into shared length array */
+ size_t * curr_off_ptr; /* Pointer into shared offset array */
+ size_t num_ids = 0; /* # of heap IDs in array */
+ size_t data_size; /* Size of data portion of heap block */
+ size_t last_obj_len; /* Size of last object inserted into heap */
+ size_t obj_off; /* Offset of object in shared write buffer */
+ size_t id_len; /* Size of fractal heap IDs */
+ unsigned u; /* Local index variable */
/* Sanity check */
HDassert(fh);
@@ -1078,44 +1068,47 @@ fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size,
HDassert(obj_size + 256 < shared_obj_size_g);
/* Initialize starting information */
- data_size = (size_t)DBLOCK_FREE(fh, block_row);
- wobj = shared_wobj_g;
- curr_id_ptr = shared_ids_g;
+ data_size = (size_t)DBLOCK_FREE(fh, block_row);
+ wobj = shared_wobj_g;
+ curr_id_ptr = shared_ids_g;
curr_len_ptr = shared_lens_g;
curr_off_ptr = shared_offs_g;
- obj_off = 0;
+ obj_off = 0;
/* Get information about heap ID lengths */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
/* Check for some "magic" object sizes */
- if(obj_size == 0)
+ if (obj_size == 0)
obj_size = data_size;
- else if(obj_size == (size_t)(-1))
+ else if (obj_size == (size_t)(-1))
obj_size = (data_size / NUM_FILL_OBJS) + 1;
/* Loop over inserting objects into the root direct block, until there's no more space */
- while(data_size >= obj_size) {
+ while (data_size >= obj_size) {
/* Increment object count */
num_ids++;
/* Check for needing to increase size of heap ID array */
- if(num_ids > shared_alloc_ids_g) {
+ if (num_ids > shared_alloc_ids_g) {
shared_alloc_ids_g = MAX(1024, (shared_alloc_ids_g * 2));
- if(NULL == (shared_ids_g = (unsigned char *)H5MM_realloc(shared_ids_g, id_len * shared_alloc_ids_g)))
+ if (NULL ==
+ (shared_ids_g = (unsigned char *)H5MM_realloc(shared_ids_g, id_len * shared_alloc_ids_g)))
TEST_ERROR
- if(NULL == (shared_lens_g = (size_t *)H5MM_realloc(shared_lens_g, sizeof(size_t) * shared_alloc_ids_g)))
+ if (NULL ==
+ (shared_lens_g = (size_t *)H5MM_realloc(shared_lens_g, sizeof(size_t) * shared_alloc_ids_g)))
TEST_ERROR
- if(NULL == (shared_offs_g = (size_t *)H5MM_realloc(shared_offs_g, sizeof(size_t) * shared_alloc_ids_g)))
+ if (NULL ==
+ (shared_offs_g = (size_t *)H5MM_realloc(shared_offs_g, sizeof(size_t) * shared_alloc_ids_g)))
TEST_ERROR
- curr_id_ptr = &shared_ids_g[(num_ids - 1) * id_len];
+ curr_id_ptr = &shared_ids_g[(num_ids - 1) * id_len];
curr_len_ptr = &shared_lens_g[(num_ids - 1)];
curr_off_ptr = &shared_offs_g[(num_ids - 1)];
} /* end if */
/* Insert object */
- if(H5HF_insert(fh, obj_size, wobj, curr_id_ptr) < 0)
+ if (H5HF_insert(fh, obj_size, wobj, curr_id_ptr) < 0)
FAIL_STACK_ERROR
*curr_len_ptr = obj_size;
*curr_off_ptr = obj_off;
@@ -1125,14 +1118,14 @@ fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size,
state->man_free_space -= obj_size;
/* Check stats for heap */
- if(check_stats(fh, state))
+ if (check_stats(fh, state))
TEST_ERROR
/* Adjust object & ID pointers */
wobj++;
obj_off++;
- if(obj_off > 255) {
- wobj = shared_wobj_g;
+ if (obj_off > 255) {
+ wobj = shared_wobj_g;
obj_off = 0;
} /* end if */
curr_id_ptr += id_len;
@@ -1144,7 +1137,7 @@ fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size,
} /* end while */
/* Check for adding smaller last object to heap block */
- if(data_size > 0) {
+ if (data_size > 0) {
/* Set size of last object in block */
last_obj_len = data_size;
@@ -1152,21 +1145,24 @@ fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size,
num_ids++;
/* Check for needing to increase size of heap ID array */
- if(num_ids > shared_alloc_ids_g) {
+ if (num_ids > shared_alloc_ids_g) {
shared_alloc_ids_g = MAX(1024, (shared_alloc_ids_g * 2));
- if(NULL == (shared_ids_g = (unsigned char *)H5MM_realloc(shared_ids_g, id_len * shared_alloc_ids_g)))
+ if (NULL ==
+ (shared_ids_g = (unsigned char *)H5MM_realloc(shared_ids_g, id_len * shared_alloc_ids_g)))
TEST_ERROR
- if(NULL == (shared_lens_g = (size_t *)H5MM_realloc(shared_lens_g, sizeof(size_t) * shared_alloc_ids_g)))
+ if (NULL ==
+ (shared_lens_g = (size_t *)H5MM_realloc(shared_lens_g, sizeof(size_t) * shared_alloc_ids_g)))
TEST_ERROR
- if(NULL == (shared_offs_g = (size_t *)H5MM_realloc(shared_offs_g, sizeof(size_t) * shared_alloc_ids_g)))
+ if (NULL ==
+ (shared_offs_g = (size_t *)H5MM_realloc(shared_offs_g, sizeof(size_t) * shared_alloc_ids_g)))
TEST_ERROR
- curr_id_ptr = &shared_ids_g[(num_ids - 1) * id_len];
+ curr_id_ptr = &shared_ids_g[(num_ids - 1) * id_len];
curr_len_ptr = &shared_lens_g[(num_ids - 1)];
curr_off_ptr = &shared_offs_g[(num_ids - 1)];
} /* end if */
/* Insert last object into the heap, using the remaining free space */
- if(H5HF_insert(fh, last_obj_len, wobj, curr_id_ptr) < 0)
+ if (H5HF_insert(fh, last_obj_len, wobj, curr_id_ptr) < 0)
FAIL_STACK_ERROR
*curr_len_ptr = last_obj_len;
*curr_off_ptr = obj_off;
@@ -1176,27 +1172,27 @@ fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size,
state->man_free_space -= last_obj_len;
/* Verify that the heap is full */
- if(check_stats(fh, state))
+ if (check_stats(fh, state))
TEST_ERROR
} /* end if */
else
- last_obj_len = obj_size; /* Normal sized last object */
+ last_obj_len = obj_size; /* Normal sized last object */
/* Verify reading the objects written out */
/* Verify all the objects */
- wobj = shared_wobj_g;
- curr_id_ptr = shared_ids_g;
+ wobj = shared_wobj_g;
+ curr_id_ptr = shared_ids_g;
curr_len_ptr = shared_lens_g;
curr_off_ptr = shared_offs_g;
- for(u = 0; u < num_ids; u++) {
+ for (u = 0; u < num_ids; u++) {
/* Read in object */
- if(H5HF_read(fh, curr_id_ptr, shared_robj_g) < 0)
+ if (H5HF_read(fh, curr_id_ptr, shared_robj_g) < 0)
FAIL_STACK_ERROR
/* Check that object is correct */
wobj = &shared_wobj_g[*curr_off_ptr];
- if(HDmemcmp(wobj, shared_robj_g, *curr_len_ptr))
+ if (HDmemcmp(wobj, shared_robj_g, *curr_len_ptr))
TEST_ERROR
/* Adjust object & ID pointers */
@@ -1206,15 +1202,18 @@ fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size,
} /* end for */
/* If the heap IDs are to be retained, append them to the list */
- if(keep_ids) {
+ if (keep_ids) {
/* Check for needing to increase size of heap ID array */
- if(keep_ids->num_ids + num_ids > keep_ids->alloc_ids) {
+ if (keep_ids->num_ids + num_ids > keep_ids->alloc_ids) {
keep_ids->alloc_ids = MAX(1024, (keep_ids->alloc_ids * 2));
- if(NULL == (keep_ids->ids = (unsigned char *)H5MM_realloc(keep_ids->ids, id_len * keep_ids->alloc_ids)))
+ if (NULL ==
+ (keep_ids->ids = (unsigned char *)H5MM_realloc(keep_ids->ids, id_len * keep_ids->alloc_ids)))
TEST_ERROR
- if(NULL == (keep_ids->lens = (size_t *)H5MM_realloc(keep_ids->lens, sizeof(size_t) * keep_ids->alloc_ids)))
+ if (NULL == (keep_ids->lens =
+ (size_t *)H5MM_realloc(keep_ids->lens, sizeof(size_t) * keep_ids->alloc_ids)))
TEST_ERROR
- if(NULL == (keep_ids->offs = (size_t *)H5MM_realloc(keep_ids->offs, sizeof(size_t) * keep_ids->alloc_ids)))
+ if (NULL == (keep_ids->offs =
+ (size_t *)H5MM_realloc(keep_ids->offs, sizeof(size_t) * keep_ids->alloc_ids)))
TEST_ERROR
} /* end if */
@@ -1228,13 +1227,12 @@ fill_heap(H5HF_t *fh, unsigned block_row, size_t obj_size,
} /* end if */
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_heap() */
-
/*-------------------------------------------------------------------------
* Function: fill_root_row
*
@@ -1250,18 +1248,18 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_root_row(H5HF_t *fh, unsigned row, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_root_row(H5HF_t *fh, unsigned row, size_t obj_size, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids)
{
- hsize_t first_free_space; /* Size of free space in heap after the first block */
- hsize_t all_free_space; /* Size of free space in heap after all blocks */
- hsize_t first_heap_size; /* Total size of the heap after the first block */
- hsize_t all_heap_size; /* Total size of the heap after all blocks */
- size_t block_size; /* Block size for row */
- size_t block_free; /* Free space in empty block of this row */
- unsigned width; /* Width of heap's doubling table */
- unsigned expand_rows; /* # of rows to expand heap by */
- unsigned u; /* Local index variable */
+ hsize_t first_free_space; /* Size of free space in heap after the first block */
+ hsize_t all_free_space; /* Size of free space in heap after all blocks */
+ hsize_t first_heap_size; /* Total size of the heap after the first block */
+ hsize_t all_heap_size; /* Total size of the heap after all blocks */
+ size_t block_size; /* Block size for row */
+ size_t block_free; /* Free space in empty block of this row */
+ unsigned width; /* Width of heap's doubling table */
+ unsigned expand_rows; /* # of rows to expand heap by */
+ unsigned u; /* Local index variable */
/* Sanity check */
HDassert(fh);
@@ -1270,49 +1268,49 @@ fill_root_row(H5HF_t *fh, unsigned row, size_t obj_size,
/* Get some information for the heap */
block_size = (size_t)DBLOCK_SIZE(fh, row);
block_free = (size_t)DBLOCK_FREE(fh, row);
- width = DTABLE_WIDTH(fh);
+ width = DTABLE_WIDTH(fh);
/* Compute the number of rows to expand heap by */
- if(row < 2)
+ if (row < 2)
expand_rows = 1;
- else if(POWER_OF_TWO(row))
+ else if (POWER_OF_TWO(row))
expand_rows = row;
else
expand_rows = 0;
/* Compute first block & all blocks heap size & free space */
- if(state->man_size == 0) {
- first_heap_size = block_size;
+ if (state->man_size == 0) {
+ first_heap_size = block_size;
first_free_space = block_free;
- all_heap_size = width * block_size;
- all_free_space = (width - 1) * block_free;
+ all_heap_size = width * block_size;
+ all_free_space = (width - 1) * block_free;
} /* end if */
- else if(expand_rows == 0) {
- all_heap_size = state->man_size;
- all_free_space = state->man_free_space;
- first_heap_size = all_heap_size;
+ else if (expand_rows == 0) {
+ all_heap_size = state->man_size;
+ all_free_space = state->man_free_space;
+ first_heap_size = all_heap_size;
first_free_space = all_free_space;
- all_free_space -= block_free; /* Account for shift from first free space */
- } /* end if */
+ all_free_space -= block_free; /* Account for shift from first free space */
+ } /* end if */
else {
- all_heap_size = state->man_size;
+ all_heap_size = state->man_size;
all_free_space = 0;
- for(u = 0; u < expand_rows; u++) {
+ for (u = 0; u < expand_rows; u++) {
all_heap_size += width * DBLOCK_SIZE(fh, row + u);
all_free_space += width * DBLOCK_FREE(fh, row + u);
} /* end for */
- first_heap_size = all_heap_size;
+ first_heap_size = all_heap_size;
first_free_space = all_free_space;
- all_free_space -= block_free; /* Account for shift from first free space */
- } /* end else */
+ all_free_space -= block_free; /* Account for shift from first free space */
+ } /* end else */
/* Loop over filling direct blocks, until root indirect row is full */
- state->man_size = first_heap_size;
+ state->man_size = first_heap_size;
state->man_free_space = first_free_space;
- for(u = 0; u < width; u++) {
+ for (u = 0; u < width; u++) {
/* Set heap's size & free space correctly */
- if(u == 1) {
- state->man_size = all_heap_size;
+ if (u == 1) {
+ state->man_size = all_heap_size;
state->man_free_space = all_free_space;
} /* end if */
@@ -1320,18 +1318,17 @@ fill_root_row(H5HF_t *fh, unsigned row, size_t obj_size,
state->man_alloc_size += block_size;
/* Fill a direct heap block up */
- if(fill_heap(fh, row, obj_size, state, keep_ids))
+ if (fill_heap(fh, row, obj_size, state, keep_ids))
TEST_ERROR
} /* end for */
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_root_row() */
-
/*-------------------------------------------------------------------------
* Function: fill_partial row
*
@@ -1347,11 +1344,11 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_partial_row(H5HF_t *fh, unsigned row, unsigned width,
- size_t obj_size, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_partial_row(H5HF_t *fh, unsigned row, unsigned width, size_t obj_size, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids)
{
- size_t block_size; /* Size of direct block in this row */
- unsigned u; /* Local index variable */
+ size_t block_size; /* Size of direct block in this row */
+ unsigned u; /* Local index variable */
/* Sanity check */
HDassert(fh);
@@ -1361,23 +1358,22 @@ fill_partial_row(H5HF_t *fh, unsigned row, unsigned width,
block_size = (size_t)DBLOCK_SIZE(fh, row);
/* Loop over filling direct blocks, until indirect row is full */
- for(u = 0; u < width; u++) {
+ for (u = 0; u < width; u++) {
/* Adjust stats for new block */
state->man_alloc_size += block_size;
/* Fill a direct heap block up */
- if(fill_heap(fh, row, obj_size, state, keep_ids))
+ if (fill_heap(fh, row, obj_size, state, keep_ids))
TEST_ERROR
} /* end for */
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_partial_row() */
-
/*-------------------------------------------------------------------------
* Function: fill_row
*
@@ -1393,25 +1389,23 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_row(H5HF_t *fh, unsigned row, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_row(H5HF_t *fh, unsigned row, size_t obj_size, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
{
/* Sanity check */
HDassert(fh);
HDassert(state);
/* Fill the entire row (with the partial row fill routine) */
- if(fill_partial_row(fh, row, DTABLE_WIDTH(fh), obj_size, state, keep_ids))
+ if (fill_partial_row(fh, row, DTABLE_WIDTH(fh), obj_size, state, keep_ids))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_row() */
-
/*-------------------------------------------------------------------------
* Function: fill_root_direct
*
@@ -1430,29 +1424,27 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_root_direct(H5HF_t *fh, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_root_direct(H5HF_t *fh, size_t obj_size, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
{
- unsigned max_dblock_rows; /* Max. # of direct block rows in indirect block */
- unsigned row; /* Row being created */
+ unsigned max_dblock_rows; /* Max. # of direct block rows in indirect block */
+ unsigned row; /* Row being created */
/* Get heap info */
max_dblock_rows = DTABLE_MAX_DROWS(fh);
HDassert(max_dblock_rows);
/* Loop over rows */
- for(row = 0; row < max_dblock_rows; row++)
- if(fill_root_row(fh, row, obj_size, state, keep_ids))
+ for (row = 0; row < max_dblock_rows; row++)
+ if (fill_root_row(fh, row, obj_size, state, keep_ids))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_root_direct() */
-
/*-------------------------------------------------------------------------
* Function: fill_2nd_indirect
*
@@ -1470,29 +1462,28 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_2nd_indirect(H5HF_t *fh, unsigned pos, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_2nd_indirect(H5HF_t *fh, unsigned pos, size_t obj_size, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids)
{
- unsigned max_dblock_rows; /* Max. # of direct block rows in indirect block */
- unsigned row; /* Current row to create */
+ unsigned max_dblock_rows; /* Max. # of direct block rows in indirect block */
+ unsigned row; /* Current row to create */
/* Get some information for the heap */
max_dblock_rows = IBLOCK_MAX_DROWS(fh, pos);
HDassert(max_dblock_rows);
/* Loop over rows */
- for(row = 0; row < max_dblock_rows; row++)
- if(fill_row(fh, row, obj_size, state, keep_ids))
+ for (row = 0; row < max_dblock_rows; row++)
+ if (fill_row(fh, row, obj_size, state, keep_ids))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_2nd_direct() */
-
/*-------------------------------------------------------------------------
* Function: fill_all_direct
*
@@ -1509,29 +1500,27 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_all_direct(H5HF_t *fh, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_all_direct(H5HF_t *fh, size_t obj_size, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
{
- unsigned max_dblock_rows; /* Max. # of direct block rows in indirect block */
- unsigned row; /* Row being created */
+ unsigned max_dblock_rows; /* Max. # of direct block rows in indirect block */
+ unsigned row; /* Row being created */
/* Get heap info */
max_dblock_rows = DTABLE_MAX_DROWS(fh);
HDassert(max_dblock_rows);
/* Loop over rows */
- for(row = 0; row < max_dblock_rows; row++)
- if(fill_row(fh, row, obj_size, state, keep_ids))
+ for (row = 0; row < max_dblock_rows; row++)
+ if (fill_row(fh, row, obj_size, state, keep_ids))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_all_direct() */
-
/*-------------------------------------------------------------------------
* Function: fill_2nd_indirect_row
*
@@ -1549,28 +1538,27 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_2nd_indirect_row(H5HF_t *fh, unsigned pos, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_2nd_indirect_row(H5HF_t *fh, unsigned pos, size_t obj_size, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids)
{
- unsigned width; /* Width of heap's doubling table */
- unsigned u; /* Local index variable */
+ unsigned width; /* Width of heap's doubling table */
+ unsigned u; /* Local index variable */
/* Get some information for the heap */
width = DTABLE_WIDTH(fh);
/* Loop over row of indirect blocks */
- for(u = 0; u < width; u++)
- if(fill_2nd_indirect(fh, pos, obj_size, state, keep_ids))
+ for (u = 0; u < width; u++)
+ if (fill_2nd_indirect(fh, pos, obj_size, state, keep_ids))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_2nd_direct_row() */
-
/*-------------------------------------------------------------------------
* Function: fill_all_2nd_indirect_rows
*
@@ -1588,28 +1576,26 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_all_2nd_indirect_rows(H5HF_t *fh, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_all_2nd_indirect_rows(H5HF_t *fh, size_t obj_size, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
{
- unsigned width; /* Width of heap's doubling table */
- unsigned u; /* Local index variable */
+ unsigned width; /* Width of heap's doubling table */
+ unsigned u; /* Local index variable */
/* Get some information for the heap */
width = DTABLE_WIDTH(fh);
/* Loop over rows of 2nd level deep indirect blocks */
- for(u = 0; u < (H5VM_log2_of2(width) + 1); u++)
- if(fill_2nd_indirect_row(fh, (u + 1), obj_size, state, keep_ids))
+ for (u = 0; u < (H5VM_log2_of2(width) + 1); u++)
+ if (fill_2nd_indirect_row(fh, (u + 1), obj_size, state, keep_ids))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_2nd_direct_row() */
-
/*-------------------------------------------------------------------------
* Function: fill_3rd_indirect
*
@@ -1627,28 +1613,27 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_3rd_indirect(H5HF_t *fh, unsigned pos, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_3rd_indirect(H5HF_t *fh, unsigned pos, size_t obj_size, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids)
{
- unsigned u; /* Local index variable */
+ unsigned u; /* Local index variable */
/* Fill all direct block rows in third level indirect block */
- if(fill_all_direct(fh, obj_size, state, keep_ids))
+ if (fill_all_direct(fh, obj_size, state, keep_ids))
TEST_ERROR
/* Fill rows of recursive indirect blocks in third level indirect block */
- for(u = 0; u < pos; u++)
- if(fill_2nd_indirect_row(fh, (u + 1), obj_size, state, keep_ids))
+ for (u = 0; u < pos; u++)
+ if (fill_2nd_indirect_row(fh, (u + 1), obj_size, state, keep_ids))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_3rd_indirect() */
-
/*-------------------------------------------------------------------------
* Function: fill_3rd_indirect_row
*
@@ -1666,29 +1651,28 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_3rd_indirect_row(H5HF_t *fh, unsigned pos, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_3rd_indirect_row(H5HF_t *fh, unsigned pos, size_t obj_size, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids)
{
- unsigned width; /* Width of heap's doubling table */
- unsigned u; /* Local index variable */
+ unsigned width; /* Width of heap's doubling table */
+ unsigned u; /* Local index variable */
/* Get some information for the heap */
width = DTABLE_WIDTH(fh);
/* Loop over row of 3rd level indirect blocks */
- for(u = 0; u < width; u++)
+ for (u = 0; u < width; u++)
/* Fill third level indirect block */
- if(fill_3rd_indirect(fh, pos, obj_size, state, keep_ids))
+ if (fill_3rd_indirect(fh, pos, obj_size, state, keep_ids))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_3rd_direct_row() */
-
/*-------------------------------------------------------------------------
* Function: fill_all_3rd_indirect_rows
*
@@ -1706,29 +1690,27 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_all_3rd_indirect_rows(H5HF_t *fh, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_all_3rd_indirect_rows(H5HF_t *fh, size_t obj_size, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
{
- unsigned width; /* Width of heap's doubling table */
- unsigned u; /* Local index variable */
+ unsigned width; /* Width of heap's doubling table */
+ unsigned u; /* Local index variable */
/* Get some information for the heap */
width = DTABLE_WIDTH(fh);
/* Loop over rows of 3rd level deep indirect blocks */
- for(u = 0; u < (H5VM_log2_of2(width) + 1); u++)
+ for (u = 0; u < (H5VM_log2_of2(width) + 1); u++)
/* Fill row of 3rd level indirect blocks */
- if(fill_3rd_indirect_row(fh, (u + 1), obj_size, state, keep_ids))
+ if (fill_3rd_indirect_row(fh, (u + 1), obj_size, state, keep_ids))
TEST_ERROR
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_all_3rd_direct_rows() */
-
/*-------------------------------------------------------------------------
* Function: fill_4th_indirect_row
*
@@ -1746,39 +1728,38 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_4th_indirect_row(H5HF_t *fh, unsigned pos, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_4th_indirect_row(H5HF_t *fh, unsigned pos, size_t obj_size, fheap_heap_state_t *state,
+ fheap_heap_ids_t *keep_ids)
{
- unsigned width; /* Width of heap's doubling table */
- unsigned u, v; /* Local index variables */
+ unsigned width; /* Width of heap's doubling table */
+ unsigned u, v; /* Local index variables */
/* Get some information for the heap */
width = DTABLE_WIDTH(fh);
/* Loop over row of 4th level indirect blocks */
- for(u = 0; u < width; u++) {
+ for (u = 0; u < width; u++) {
/* Fill all direct block rows in fourth level indirect block */
- if(fill_all_direct(fh, obj_size, state, keep_ids))
+ if (fill_all_direct(fh, obj_size, state, keep_ids))
TEST_ERROR
/* Fill all rows of 2nd level deep indirect blocks in fourth level indirect block */
- if(fill_all_2nd_indirect_rows(fh, obj_size, state, keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, obj_size, state, keep_ids))
TEST_ERROR
/* Fill rows of third level indirect blocks in fourth level indirect block */
- for(v = 0; v < pos; v++)
- if(fill_3rd_indirect_row(fh, (v + 1), obj_size, state, keep_ids))
+ for (v = 0; v < pos; v++)
+ if (fill_3rd_indirect_row(fh, (v + 1), obj_size, state, keep_ids))
TEST_ERROR
} /* end for */
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_4th_direct_row() */
-
/*-------------------------------------------------------------------------
* Function: fill_all_4th_indirect_rows
*
@@ -1796,47 +1777,45 @@ error:
*-------------------------------------------------------------------------
*/
static int
-fill_all_4th_indirect_rows(H5HF_t *fh, size_t obj_size,
- fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
+fill_all_4th_indirect_rows(H5HF_t *fh, size_t obj_size, fheap_heap_state_t *state, fheap_heap_ids_t *keep_ids)
{
- unsigned width; /* Width of heap's doubling table */
- unsigned u; /* Local index variable */
+ unsigned width; /* Width of heap's doubling table */
+ unsigned u; /* Local index variable */
/* Get some information for the heap */
width = DTABLE_WIDTH(fh);
/* Loop over rows of 4th level deep indirect blocks */
- for(u = 0; u < (H5VM_log2_of2(width) + 1); u++) {
+ for (u = 0; u < (H5VM_log2_of2(width) + 1); u++) {
/* Fill row of 4th level indirect blocks */
- if(fill_4th_indirect_row(fh, (u + 1), obj_size, state, keep_ids))
+ if (fill_4th_indirect_row(fh, (u + 1), obj_size, state, keep_ids))
TEST_ERROR
/* Account for root indirect block doubling # of rows again */
/* (From 16 rows to the max. # of rows: 22) */
/* (Note: this is tied to the particular doubling table/heap creation parameters) */
- if(u == 0) {
- unsigned max_root_rows; /* Maximum # of rows in root indirect block */
- unsigned row; /* Row in heap */
+ if (u == 0) {
+ unsigned max_root_rows; /* Maximum # of rows in root indirect block */
+ unsigned row; /* Row in heap */
/* Get some information for the heap */
max_root_rows = HEAP_MAX_ROOT_ROWS(fh);
/* Increase heap size & free space */
- for(row = 16; row < max_root_rows; row++) {
+ for (row = 16; row < max_root_rows; row++) {
state->man_size += width * DBLOCK_SIZE(fh, row);
state->man_free_space += width * DBLOCK_FREE(fh, row);
} /* end for */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
/* Operations succeeded */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* fill_all_4th_direct_rows() */
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -1853,38 +1832,38 @@ error:
static unsigned
test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_create_t test_cparam; /* Creation parameters for heap */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Heap address in file */
- h5_stat_size_t empty_size; /* File size, w/o heap */
- h5_stat_size_t file_size; /* File size, after deleting heap */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_create_t test_cparam; /* Creation parameters for heap */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Heap address in file */
+ h5_stat_size_t empty_size; /* File size, w/o heap */
+ h5_stat_size_t file_size; /* File size, after deleting heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -1896,48 +1875,48 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
*/
TESTING("fractal heap creation");
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
TEST_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
PASSED();
/* Query the type of address mapping */
TESTING("query heap creation parameters");
HDmemset(&test_cparam, 0, sizeof(H5HF_create_t));
- if(H5HF_get_cparam_test(fh, &test_cparam) < 0)
+ if (H5HF_get_cparam_test(fh, &test_cparam) < 0)
FAIL_STACK_ERROR
- if(H5HF_cmp_cparam_test(cparam, &test_cparam))
+ if (H5HF_cmp_cparam_test(cparam, &test_cparam))
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* All tests passed */
@@ -1946,15 +1925,16 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
return 0;
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_create() */
-
/*-------------------------------------------------------------------------
* Function: test_reopen
*
@@ -1971,42 +1951,42 @@ error:
static unsigned
test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_create_t test_cparam; /* Creation parameters for heap */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- h5_stat_size_t empty_size; /* File size, w/o heap */
- h5_stat_size_t file_size; /* File size, after deleting heap */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_state_t state; /* State of fractal heap */
- hbool_t page = FALSE; /* Paged aggregation strategy or not */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_create_t test_cparam; /* Creation parameters for heap */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ h5_stat_size_t empty_size; /* File size, w/o heap */
+ h5_stat_size_t file_size; /* File size, after deleting heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_state_t state; /* State of fractal heap */
+ hbool_t page = FALSE; /* Paged aggregation strategy or not */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
- if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)
+ if (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)
page = TRUE;
/* Ignore metadata tags in the file's cache */
@@ -2020,37 +2000,37 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
TESTING("create, close & reopen fractal heap");
/* Create heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
TEST_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for closing & re-opening the file */
- if(tparam->reopen_heap) {
+ if (tparam->reopen_heap) {
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -2060,53 +2040,54 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
} /* end if */
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Query the creation parameters */
HDmemset(&test_cparam, 0, sizeof(H5HF_create_t));
- if(H5HF_get_cparam_test(fh, &test_cparam) < 0)
+ if (H5HF_get_cparam_test(fh, &test_cparam) < 0)
FAIL_STACK_ERROR
- if(H5HF_cmp_cparam_test(cparam, &test_cparam))
+ if (H5HF_cmp_cparam_test(cparam, &test_cparam))
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(!page || (page && !tparam->reopen_heap))
- if(file_size != empty_size)
+ if (!page || (page && !tparam->reopen_heap))
+ if (file_size != empty_size)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_reopen() */
-
/*-------------------------------------------------------------------------
* Function: test_open_twice
*
@@ -2123,45 +2104,45 @@ error:
static unsigned
test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- hid_t file2 = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5F_t *f2 = NULL; /* Internal file object pointer */
- H5HF_create_t test_cparam; /* Creation parameters for heap */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- H5HF_t *fh2 = NULL; /* 2nd fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- h5_stat_size_t empty_size; /* File size, w/o heap */
- h5_stat_size_t file_size; /* File size, after deleting heap */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_state_t state; /* State of fractal heap */
- hbool_t page = FALSE; /* Paged aggregation strategy or not */
+ hid_t file = -1; /* File ID */
+ hid_t file2 = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5F_t * f2 = NULL; /* Internal file object pointer */
+ H5HF_create_t test_cparam; /* Creation parameters for heap */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ H5HF_t * fh2 = NULL; /* 2nd fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ h5_stat_size_t empty_size; /* File size, w/o heap */
+ h5_stat_size_t file_size; /* File size, after deleting heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_state_t state; /* State of fractal heap */
+ hbool_t page = FALSE; /* Paged aggregation strategy or not */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
- if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)
+ if (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)
page = TRUE;
/* Ignore metadata tags in the file's cache */
@@ -2174,46 +2155,46 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
TESTING("open fractal heap twice");
/* Create heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
TEST_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Open the heap again, through the first file handle */
- if(NULL == (fh2 = H5HF_open(f, fh_addr)))
+ if (NULL == (fh2 = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
HDmemset(&test_cparam, 0, sizeof(H5HF_create_t));
- if(H5HF_get_cparam_test(fh2, &test_cparam) < 0)
+ if (H5HF_get_cparam_test(fh2, &test_cparam) < 0)
FAIL_STACK_ERROR
- if(H5HF_cmp_cparam_test(cparam, &test_cparam))
+ if (H5HF_cmp_cparam_test(cparam, &test_cparam))
TEST_ERROR
/* Close the second fractal heap wrapper */
- if(H5HF_close(fh2) < 0)
+ if (H5HF_close(fh2) < 0)
FAIL_STACK_ERROR
fh2 = NULL;
/* Check for closing & re-opening the heap & file */
- if(reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
+ if (reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Re-open the file */
- if((file2 = H5Freopen(file)) < 0)
+ if ((file2 = H5Freopen(file)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f2 = (H5F_t *)H5VL_object(file2)))
+ if (NULL == (f2 = (H5F_t *)H5VL_object(file2)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -2221,18 +2202,18 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
FAIL_STACK_ERROR
/* Open the fractal heap through the second file handle */
- if(NULL == (fh2 = H5HF_open(f2, fh_addr)))
+ if (NULL == (fh2 = H5HF_open(f2, fh_addr)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
HDmemset(&test_cparam, 0, sizeof(H5HF_create_t));
- if(H5HF_get_cparam_test(fh2, &test_cparam) < 0)
+ if (H5HF_get_cparam_test(fh2, &test_cparam) < 0)
FAIL_STACK_ERROR
- if(H5HF_cmp_cparam_test(cparam, &test_cparam))
+ if (H5HF_cmp_cparam_test(cparam, &test_cparam))
TEST_ERROR
/* Close the first fractal heap wrapper */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
@@ -2240,29 +2221,29 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
/* (close before second file, to detect error on internal heap header's
* shared file information)
*/
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Close the second fractal heap wrapper */
- if(H5HF_close(fh2) < 0)
+ if (H5HF_close(fh2) < 0)
FAIL_STACK_ERROR
fh2 = NULL;
/* Delete heap */
- if(H5HF_delete(f2, fh_addr) < 0)
+ if (H5HF_delete(f2, fh_addr) < 0)
FAIL_STACK_ERROR
/* Close the second file */
- if(H5Fclose(file2) < 0)
+ if (H5Fclose(file2) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(!page || (page && !tparam->reopen_heap))
- if(file_size != empty_size)
+ if (!page || (page && !tparam->reopen_heap))
+ if (file_size != empty_size)
TEST_ERROR
/* All tests passed */
@@ -2271,19 +2252,20 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
return 0;
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- if(fh2)
+ if (fh2)
H5HF_close(fh2);
H5Fclose(file);
H5Fclose(file2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_open_twice() */
-
/*-------------------------------------------------------------------------
* Function: test_delete_open
*
@@ -2300,39 +2282,39 @@ error:
static unsigned
test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_create_t test_cparam; /* Creation parameters for heap */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- H5HF_t *fh2 = NULL; /* 2nd fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_create_t test_cparam; /* Creation parameters for heap */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ H5HF_t * fh2 = NULL; /* 2nd fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/no heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -2343,45 +2325,44 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
TESTING("deleting open fractal heap");
/* Create heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
TEST_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Open the heap again */
- if(NULL == (fh2 = H5HF_open(f, fh_addr)))
+ if (NULL == (fh2 = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Request that the heap be deleted */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
/* Verify the creation parameters */
HDmemset(&test_cparam, 0, sizeof(H5HF_create_t));
- if(H5HF_get_cparam_test(fh2, &test_cparam) < 0)
+ if (H5HF_get_cparam_test(fh2, &test_cparam) < 0)
FAIL_STACK_ERROR
- if(H5HF_cmp_cparam_test(cparam, &test_cparam))
+ if (H5HF_cmp_cparam_test(cparam, &test_cparam))
TEST_ERROR
/* Close the second fractal heap wrapper */
- if(H5HF_close(fh2) < 0)
+ if (H5HF_close(fh2) < 0)
FAIL_STACK_ERROR
fh2 = NULL;
/* Try re-opening the heap again (should fail, as heap will be deleted) */
- H5E_BEGIN_TRY {
- fh2 = H5HF_open(f, fh_addr);
- } H5E_END_TRY;
- if(fh2) {
+ H5E_BEGIN_TRY { fh2 = H5HF_open(f, fh_addr); }
+ H5E_END_TRY;
+ if (fh2) {
/* Close opened heap */
H5HF_close(fh2);
fh2 = NULL;
@@ -2391,22 +2372,22 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
} /* end if */
/* Close the first fractal heap wrapper */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for closing & re-opening the file */
- if(tparam->reopen_heap) {
+ if (tparam->reopen_heap) {
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -2416,10 +2397,9 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
} /* end if */
/* Try re-opening the heap again (should fail, as heap is now deleted) */
- H5E_BEGIN_TRY {
- fh = H5HF_open(f, fh_addr);
- } H5E_END_TRY;
- if(fh) {
+ H5E_BEGIN_TRY { fh = H5HF_open(f, fh_addr); }
+ H5E_END_TRY;
+ if (fh) {
/* Close opened heap */
H5HF_close(fh);
fh = NULL;
@@ -2429,15 +2409,15 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* All tests passed */
@@ -2446,17 +2426,18 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
return 0;
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- if(fh2)
+ if (fh2)
H5HF_close(fh2);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_delete_open() */
-
/*-------------------------------------------------------------------------
* Function: test_id_limits
*
@@ -2473,26 +2454,26 @@ error:
static unsigned
test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- H5HF_create_t tmp_cparam; /* Local heap creation parameters */
- unsigned deflate_level; /* Deflation level */
- size_t id_len; /* Size of fractal heap IDs */
- size_t tiny_max_len; /* Max. length of tiny objects */
- hbool_t tiny_len_extended; /* Do tiny objects use two bytes for the length? */
- hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ H5HF_create_t tmp_cparam; /* Local heap creation parameters */
+ unsigned deflate_level; /* Deflation level */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t tiny_max_len; /* Max. length of tiny objects */
+ hbool_t tiny_len_extended; /* Do tiny objects use two bytes for the length? */
+ hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -2505,285 +2486,272 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
/* Copy heap creation properties */
HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t));
-
/* Set the 'default' heap ID length */
tmp_cparam.id_len = 0;
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, &tmp_cparam)))
+ if (NULL == (fh = H5HF_create(f, &tmp_cparam)))
FAIL_STACK_ERROR
/* Test ID length information for heap */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != HEAP_ID_LEN)
+ if (id_len != HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
+ if (H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
FAIL_STACK_ERROR
- if(tiny_max_len != (HEAP_ID_LEN - 1))
+ if (tiny_max_len != (HEAP_ID_LEN - 1))
TEST_ERROR
- if(tiny_len_extended != FALSE)
+ if (tiny_len_extended != FALSE)
TEST_ERROR
- if(H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
+ if (H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
FAIL_STACK_ERROR
- if(huge_ids_direct != FALSE)
+ if (huge_ids_direct != FALSE)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
-
/* Set the heap ID length to the size needed for directly accessing 'huge' objects */
/* (with no I/O pipeline filters) */
tmp_cparam.id_len = 1;
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, &tmp_cparam)))
+ if (NULL == (fh = H5HF_create(f, &tmp_cparam)))
FAIL_STACK_ERROR
/* Test ID length information for heap */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != 17)
+ if (id_len != 17)
FAIL_STACK_ERROR
- if(H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
+ if (H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
FAIL_STACK_ERROR
- if(tiny_max_len != 16)
+ if (tiny_max_len != 16)
TEST_ERROR
- if(tiny_len_extended != FALSE)
+ if (tiny_len_extended != FALSE)
TEST_ERROR
- if(H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
+ if (H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
FAIL_STACK_ERROR
- if(huge_ids_direct != TRUE)
+ if (huge_ids_direct != TRUE)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
-
/* Set the heap ID length to the size needed for directly accessing 'huge' objects */
/* (with I/O pipeline filters) */
tmp_cparam.id_len = 1;
/* Set an I/O filter for heap data */
deflate_level = 6;
- if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
+ if (H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
FAIL_STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, &tmp_cparam)))
+ if (NULL == (fh = H5HF_create(f, &tmp_cparam)))
FAIL_STACK_ERROR
/* Test ID length information for heap */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != 29)
+ if (id_len != 29)
FAIL_STACK_ERROR
- if(H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
+ if (H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
FAIL_STACK_ERROR
- if(tiny_max_len != 27)
+ if (tiny_max_len != 27)
TEST_ERROR
- if(tiny_len_extended != TRUE)
+ if (tiny_len_extended != TRUE)
TEST_ERROR
- if(H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
+ if (H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
FAIL_STACK_ERROR
- if(huge_ids_direct != TRUE)
+ if (huge_ids_direct != TRUE)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Release the I/O pipeline filter information */
H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline);
-
/* Set the heap ID length to a size that's too small for 'managed' heap IDs */
tmp_cparam.id_len = 3;
/* Create absolute heap */
- H5E_BEGIN_TRY {
- fh = H5HF_create(f, &tmp_cparam);
- } H5E_END_TRY;
- if(NULL != fh)
+ H5E_BEGIN_TRY { fh = H5HF_create(f, &tmp_cparam); }
+ H5E_END_TRY;
+ if (NULL != fh)
FAIL_STACK_ERROR
-
/* Set the heap ID length a size that's large enough for 'tiny' & 'managed'
* objects, but too small for directly accessing 'huge' objects
*/
tmp_cparam.id_len = 8;
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, &tmp_cparam)))
+ if (NULL == (fh = H5HF_create(f, &tmp_cparam)))
FAIL_STACK_ERROR
/* Test ID length information for heap */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != 8)
+ if (id_len != 8)
FAIL_STACK_ERROR
- if(H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
+ if (H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
FAIL_STACK_ERROR
- if(tiny_max_len != 7)
+ if (tiny_max_len != 7)
TEST_ERROR
- if(tiny_len_extended != FALSE)
+ if (tiny_len_extended != FALSE)
TEST_ERROR
- if(H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
+ if (H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
FAIL_STACK_ERROR
- if(huge_ids_direct != FALSE)
+ if (huge_ids_direct != FALSE)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
-
/* Set the heap ID length a size that's large enough for directly
* directly accessing 'huge' objects
*/
tmp_cparam.id_len = 17;
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, &tmp_cparam)))
+ if (NULL == (fh = H5HF_create(f, &tmp_cparam)))
FAIL_STACK_ERROR
/* Test ID length information for heap */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != 17)
+ if (id_len != 17)
FAIL_STACK_ERROR
- if(H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
+ if (H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
FAIL_STACK_ERROR
- if(tiny_max_len != 16)
+ if (tiny_max_len != 16)
TEST_ERROR
- if(tiny_len_extended != FALSE)
+ if (tiny_len_extended != FALSE)
TEST_ERROR
- if(H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
+ if (H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
FAIL_STACK_ERROR
- if(huge_ids_direct != TRUE)
+ if (huge_ids_direct != TRUE)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
-
/* Set the heap ID length to the low side of the boundary condition for
* encoding 'tiny' objects in one byte
*/
tmp_cparam.id_len = 18;
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, &tmp_cparam)))
+ if (NULL == (fh = H5HF_create(f, &tmp_cparam)))
FAIL_STACK_ERROR
/* Test ID length information for heap */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != 18)
+ if (id_len != 18)
FAIL_STACK_ERROR
- if(H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
+ if (H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
FAIL_STACK_ERROR
- if(tiny_max_len != 16)
+ if (tiny_max_len != 16)
TEST_ERROR
- if(tiny_len_extended != FALSE)
+ if (tiny_len_extended != FALSE)
TEST_ERROR
- if(H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
+ if (H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
FAIL_STACK_ERROR
- if(huge_ids_direct != TRUE)
+ if (huge_ids_direct != TRUE)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
-
/* Set the heap ID length to the high side of the boundary condition for
* encoding 'tiny' objects in one byte
*/
tmp_cparam.id_len = 19;
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, &tmp_cparam)))
+ if (NULL == (fh = H5HF_create(f, &tmp_cparam)))
FAIL_STACK_ERROR
/* Test ID length information for heap */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != 19)
+ if (id_len != 19)
FAIL_STACK_ERROR
- if(H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
+ if (H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
FAIL_STACK_ERROR
- if(tiny_max_len != 17)
+ if (tiny_max_len != 17)
TEST_ERROR
- if(tiny_len_extended != TRUE)
+ if (tiny_len_extended != TRUE)
TEST_ERROR
- if(H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
+ if (H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
FAIL_STACK_ERROR
- if(huge_ids_direct != TRUE)
+ if (huge_ids_direct != TRUE)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
-
/* Set the heap ID length a size that's larger than what is needed for
* directly accessing 'huge' objects
*/
tmp_cparam.id_len = 45;
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, &tmp_cparam)))
+ if (NULL == (fh = H5HF_create(f, &tmp_cparam)))
FAIL_STACK_ERROR
/* Test ID length information for heap */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != 45)
+ if (id_len != 45)
FAIL_STACK_ERROR
- if(H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
+ if (H5HF_get_tiny_info_test(fh, &tiny_max_len, &tiny_len_extended) < 0)
FAIL_STACK_ERROR
- if(tiny_max_len != 43)
+ if (tiny_max_len != 43)
TEST_ERROR
- if(tiny_len_extended != TRUE)
+ if (tiny_len_extended != TRUE)
TEST_ERROR
- if(H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
+ if (H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
FAIL_STACK_ERROR
- if(huge_ids_direct != TRUE)
+ if (huge_ids_direct != TRUE)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
-
/* Set the heap ID length to a size that's too large to encode the length
* of 'tiny' objects
*/
tmp_cparam.id_len = H5HF_MAX_ID_LEN + 1;
/* Create absolute heap */
- H5E_BEGIN_TRY {
- fh = H5HF_create(f, &tmp_cparam);
- } H5E_END_TRY;
- if(NULL != fh)
+ H5E_BEGIN_TRY { fh = H5HF_create(f, &tmp_cparam); }
+ H5E_END_TRY;
+ if (NULL != fh)
FAIL_STACK_ERROR
-
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* All tests passed */
@@ -2792,15 +2760,16 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_id_limits() */
-
/*-------------------------------------------------------------------------
* Function: test_filtered_create
*
@@ -2817,24 +2786,24 @@ error:
static unsigned
test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- H5HF_create_t tmp_cparam; /* Local heap creation parameters */
- H5HF_create_t test_cparam; /* Temporary local heap creation parameters */
- unsigned deflate_level; /* Deflation level */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ H5HF_create_t tmp_cparam; /* Local heap creation parameters */
+ H5HF_create_t test_cparam; /* Temporary local heap creation parameters */
+ unsigned deflate_level; /* Deflation level */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -2847,37 +2816,36 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
/* Copy heap creation properties */
HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t));
-
/* Set an I/O filter for heap data */
deflate_level = 6;
- if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
+ if (H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
FAIL_STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, &tmp_cparam)))
+ if (NULL == (fh = H5HF_create(f, &tmp_cparam)))
FAIL_STACK_ERROR
/* Get heap's address */
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -2885,24 +2853,23 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Query the heap creation parameters */
HDmemset(&test_cparam, 0, sizeof(H5HF_create_t));
- if(H5HF_get_cparam_test(fh, &test_cparam) < 0)
+ if (H5HF_get_cparam_test(fh, &test_cparam) < 0)
FAIL_STACK_ERROR
- if(H5HF_cmp_cparam_test(&tmp_cparam, &test_cparam))
+ if (H5HF_cmp_cparam_test(&tmp_cparam, &test_cparam))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
-
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Release the I/O pipeline filter information */
@@ -2915,15 +2882,16 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_filtered_create() */
-
/*-------------------------------------------------------------------------
* Function: test_size
*
@@ -2940,24 +2908,24 @@ error:
static unsigned
test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- hsize_t empty_heap_size; /* Total size of empty heap on disk */
- hsize_t one_heap_size; /* Total size of heap on disk after inserting one object */
- hsize_t heap_size; /* Total size of heap on disk */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t *fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ hsize_t empty_heap_size; /* Total size of empty heap on disk */
+ hsize_t one_heap_size; /* Total size of heap on disk after inserting one object */
+ hsize_t heap_size; /* Total size of heap on disk */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -2967,51 +2935,49 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
/* Display testing message */
TESTING("querying heap statistics")
-
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
/* Get heap's address */
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
/* Get an empty heap's size */
empty_heap_size = 0;
- if(H5HF_size(fh, &empty_heap_size) < 0)
+ if (H5HF_size(fh, &empty_heap_size) < 0)
FAIL_STACK_ERROR
- if(empty_heap_size == 0)
+ if (empty_heap_size == 0)
TEST_ERROR
/* Insert an object */
- if(add_obj(fh, (size_t)0, (size_t)10, NULL, NULL) < 0)
+ if (add_obj(fh, (size_t)0, (size_t)10, NULL, NULL) < 0)
TEST_ERROR
/* Get the heap's size after inserting one object */
one_heap_size = 0;
- if(H5HF_size(fh, &one_heap_size) < 0)
+ if (H5HF_size(fh, &one_heap_size) < 0)
FAIL_STACK_ERROR
- if(one_heap_size <= empty_heap_size)
+ if (one_heap_size <= empty_heap_size)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
-
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3019,34 +2985,34 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Check the heap's size */
heap_size = 0;
- if(H5HF_size(fh, &heap_size) < 0)
+ if (H5HF_size(fh, &heap_size) < 0)
FAIL_STACK_ERROR
- if(heap_size != one_heap_size)
+ if (heap_size != one_heap_size)
TEST_ERROR
/* Insert another object */
- if(add_obj(fh, (size_t)1, (size_t)10, NULL, NULL) < 0)
+ if (add_obj(fh, (size_t)1, (size_t)10, NULL, NULL) < 0)
TEST_ERROR
/* Check the heap's size */
heap_size = 0;
- if(H5HF_size(fh, &heap_size) < 0)
+ if (H5HF_size(fh, &heap_size) < 0)
FAIL_STACK_ERROR
- if(heap_size != one_heap_size)
+ if (heap_size != one_heap_size)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* All tests passed */
@@ -3055,15 +3021,16 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_size() */
-
/*-------------------------------------------------------------------------
* Function: test_reopen_hdr
*
@@ -3083,23 +3050,23 @@ error:
static unsigned
test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
{
- hid_t file1 = -1; /* File ID */
- hid_t file2 = -2; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- hsize_t heap_size; /* Total size of heap on disk */
+ hid_t file1 = -1; /* File ID */
+ hid_t file2 = -2; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t *fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ hsize_t heap_size; /* Total size of heap on disk */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file1)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file1)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3109,41 +3076,39 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
/* Display testing message */
TESTING("reopening header through different file")
-
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
/* Get heap's address */
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
/* Insert an object */
- if(add_obj(fh, (size_t)0, (size_t)10, NULL, NULL) < 0)
+ if (add_obj(fh, (size_t)0, (size_t)10, NULL, NULL) < 0)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file1) < 0)
+ if (H5Fclose(file1) < 0)
FAIL_STACK_ERROR
-
/* Re-open the file */
- if((file1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Re-open the file again */
- if((file2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object (file1) */
- if(NULL == (f = (H5F_t *)H5VL_object(file1)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file1)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3151,57 +3116,56 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl)
FAIL_STACK_ERROR
/* Open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Close the heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file (file1) */
- if(H5Fclose(file1) < 0)
+ if (H5Fclose(file1) < 0)
FAIL_STACK_ERROR
-
/* Get a pointer to the internal file object (file2) */
- if(NULL == (f = (H5F_t *)H5VL_object(file2)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file2)))
FAIL_STACK_ERROR
/* Reopen the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Check the heap's size */
heap_size = 0;
- if(H5HF_size(fh, &heap_size) < 0)
+ if (H5HF_size(fh, &heap_size) < 0)
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
-
/* Close the file (file2) */
- if(H5Fclose(file2) < 0)
+ if (H5Fclose(file2) < 0)
FAIL_STACK_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
H5Fclose(file1);
H5Fclose(file2);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_reopen_hdr() */
-
/*-------------------------------------------------------------------------
* Function: test_man_insert_weird
*
@@ -3218,25 +3182,25 @@ error:
static unsigned
test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_state_t state; /* State of fractal heap */
- herr_t ret; /* Generic return value */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_state_t state; /* State of fractal heap */
+ herr_t ret; /* Generic return value */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3244,22 +3208,22 @@ test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
FAIL_STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
TEST_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/*
@@ -3268,46 +3232,47 @@ test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
TESTING("inserting 'weird' sized objects into absolute heap");
/* Attempt to insert 0-sized object into heap */
- H5E_BEGIN_TRY {
- ret = H5HF_insert(fh, (size_t)0, shared_wobj_g, heap_id);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5HF_insert(fh, (size_t)0, shared_wobj_g, heap_id); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
H5Eclear2(H5E_DEFAULT);
/* Insert a 1-sized object into heap (should be a 'tiny' object) */
- if(add_obj(fh, (size_t)10, (size_t)1, &state, NULL))
+ if (add_obj(fh, (size_t)10, (size_t)1, &state, NULL))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check for correctly sized heap */
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_insert_weird() */
#ifdef ALL_INSERT_TESTS
@@ -3329,23 +3294,23 @@ error:
static unsigned
test_man_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3353,65 +3318,66 @@ test_man_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
FAIL_STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
TEST_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
TEST_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/*
* Test inserting first (small) object into absolute heap
*/
TESTING("inserting first (small) object into absolute heap");
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check for correctly sized heap */
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_insert_first() */
-
/*-------------------------------------------------------------------------
* Function: test_man_insert_second
*
@@ -3429,23 +3395,23 @@ error:
static unsigned
test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3453,15 +3419,15 @@ test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -3469,43 +3435,44 @@ test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp
* Test inserting first (small) object into absolute heap
*/
TESTING("inserting two (small) objects into absolute heap");
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert second object */
- if(add_obj(fh, (size_t)20, SMALL_OBJ_SIZE2, &state, NULL))
+ if (add_obj(fh, (size_t)20, SMALL_OBJ_SIZE2, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_insert_second() */
-
/*-------------------------------------------------------------------------
* Function: test_man_insert_root_mult
*
@@ -3524,24 +3491,24 @@ error:
static unsigned
test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3549,15 +3516,15 @@ test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -3570,39 +3537,40 @@ test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
fill_size = get_fill_size(tparam);
/* Fill the heap up */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, NULL))
+ if (fill_heap(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_insert_root_mult() */
-
/*-------------------------------------------------------------------------
* Function: test_man_insert_force_indirect
*
@@ -3622,24 +3590,24 @@ error:
static unsigned
test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3647,15 +3615,15 @@ test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -3668,46 +3636,47 @@ test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par
fill_size = get_fill_size(tparam);
/* Fill the heap up */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, NULL))
+ if (fill_heap(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force root indirect block creation */
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space = (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_insert_force_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_insert_fill_second
*
@@ -3727,24 +3696,24 @@ error:
static unsigned
test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3752,15 +3721,15 @@ test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -3773,46 +3742,47 @@ test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
fill_size = get_fill_size(tparam);
/* Fill the first direct block heap up */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, NULL))
+ if (fill_heap(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill the second direct block heap up (also creates initial root indirect block) */
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space = (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, NULL))
+ if (fill_heap(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_insert_fill_second() */
-
/*-------------------------------------------------------------------------
* Function: test_man_insert_third_direct
*
@@ -3833,24 +3803,24 @@ error:
static unsigned
test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3858,15 +3828,15 @@ test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -3879,51 +3849,52 @@ test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
fill_size = get_fill_size(tparam);
/* Fill the first direct block up */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, NULL))
+ if (fill_heap(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill the second direct block heap up (also creates initial root indirect block) */
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space = (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, NULL))
+ if (fill_heap(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force creation of third direct block */
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_insert_third_direct() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_first_row
*
@@ -3943,24 +3914,24 @@ error:
static unsigned
test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -3968,15 +3939,15 @@ test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -3989,36 +3960,37 @@ test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t
fill_size = get_fill_size(tparam);
/* Fill first row of [root] indirect block */
- if(fill_root_row(fh, 0, fill_size, &state, NULL))
+ if (fill_root_row(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_first_row() */
-
/*-------------------------------------------------------------------------
* Function: test_man_start_second_row
*
@@ -4038,24 +4010,24 @@ error:
static unsigned
test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4063,15 +4035,15 @@ test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -4084,43 +4056,44 @@ test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
fill_size = get_fill_size(tparam);
/* Fill first root indirect row */
- if(fill_root_row(fh, 0, fill_size, &state, NULL))
+ if (fill_root_row(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force expanding root indirect block to two rows */
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_alloc_size += DBLOCK_SIZE(fh, 1);
state.man_free_space = cparam->managed.width * DBLOCK_FREE(fh, 1);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_start_second_row() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_second_row
*
@@ -4140,24 +4113,24 @@ error:
static unsigned
test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4165,15 +4138,15 @@ test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -4186,40 +4159,41 @@ test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
fill_size = get_fill_size(tparam);
/* Fill first root indirect row */
- if(fill_root_row(fh, 0, fill_size, &state, NULL))
+ if (fill_root_row(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill second root indirect row */
- if(fill_root_row(fh, 1, fill_size, &state, NULL))
+ if (fill_root_row(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_second_row() */
-
/*-------------------------------------------------------------------------
* Function: test_man_start_third_row
*
@@ -4240,24 +4214,24 @@ error:
static unsigned
test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4265,15 +4239,15 @@ test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -4286,15 +4260,15 @@ test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
fill_size = get_fill_size(tparam);
/* Fill first root indirect row */
- if(fill_root_row(fh, 0, fill_size, &state, NULL))
+ if (fill_root_row(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill second root indirect row */
- if(fill_root_row(fh, 1, fill_size, &state, NULL))
+ if (fill_root_row(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force expanding root indirect block to four rows */
@@ -4304,32 +4278,33 @@ test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
state.man_alloc_size += DBLOCK_SIZE(fh, 2);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 2);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 3);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_start_third_row() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_fourth_row
*
@@ -4349,25 +4324,25 @@ error:
static unsigned
test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variables */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4375,15 +4350,15 @@ test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -4396,37 +4371,38 @@ test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
fill_size = get_fill_size(tparam);
/* Loop over rows */
- for(u = 0; u < 4; u++)
- if(fill_root_row(fh, u, fill_size, &state, NULL))
+ for (u = 0; u < 4; u++)
+ if (fill_root_row(fh, u, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_fourth_row() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_all_root_direct
*
@@ -4446,24 +4422,24 @@ error:
static unsigned
test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4471,15 +4447,15 @@ test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -4492,36 +4468,37 @@ test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para
fill_size = get_fill_size(tparam);
/* Fill all direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_all_root_direct() */
-
/*-------------------------------------------------------------------------
* Function: test_man_first_recursive_indirect
*
@@ -4541,24 +4518,24 @@ error:
static unsigned
test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4566,15 +4543,15 @@ test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -4587,41 +4564,42 @@ test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_
fill_size = get_fill_size(tparam);
/* Fill direct blocks up */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force creation of first recursive indirect block */
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_first_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_second_direct_recursive_indirect
*
@@ -4642,24 +4620,24 @@ error:
static unsigned
test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4667,15 +4645,15 @@ test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhe
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -4689,48 +4667,49 @@ test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhe
fill_size = get_fill_size(tparam);
/* Fill direct blocks up */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill the first direct block in the recursive indirect block up */
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, NULL))
+ if (fill_heap(fh, 0, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force creation of second direct block in
* first recursive indirect block
*/
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_second_direct_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_first_recursive_indirect
*
@@ -4751,24 +4730,24 @@ error:
static unsigned
test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4776,15 +4755,15 @@ test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -4798,40 +4777,41 @@ test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first recursive indirect block */
- if(fill_2nd_indirect(fh, 1, fill_size, &state, NULL))
+ if (fill_2nd_indirect(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_first_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_second_recursive_indirect
*
@@ -4853,24 +4833,24 @@ error:
static unsigned
test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4878,15 +4858,15 @@ test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -4900,47 +4880,48 @@ test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill first recursive indirect block */
- if(fill_2nd_indirect(fh, 1, fill_size, &state, NULL))
+ if (fill_2nd_indirect(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force creation of second
* recursive indirect block
*/
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_second_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_second_recursive_indirect
*
@@ -4963,24 +4944,24 @@ error:
static unsigned
test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -4988,15 +4969,15 @@ test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5010,44 +4991,45 @@ test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill first recursive indirect block */
- if(fill_2nd_indirect(fh, 1, fill_size, &state, NULL))
+ if (fill_2nd_indirect(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill 2nd recursive indirect block */
- if(fill_2nd_indirect(fh, 1, fill_size, &state, NULL))
+ if (fill_2nd_indirect(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_second_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_recursive_indirect_row
*
@@ -5070,36 +5052,36 @@ error:
static unsigned
test_man_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5113,40 +5095,41 @@ test_man_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_te
fill_size = get_fill_size(tparam);
/* Fill direct blocks in root indirect block up */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill row of recursive indirect blocks */
- if(fill_2nd_indirect_row(fh, 1, fill_size, &state, NULL))
+ if (fill_2nd_indirect_row(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_recursive_indirect_row() */
-
/*-------------------------------------------------------------------------
* Function: test_man_start_2nd_recursive_indirect
*
@@ -5167,24 +5150,24 @@ error:
static unsigned
test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -5192,15 +5175,15 @@ test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5214,47 +5197,48 @@ test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
fill_size = get_fill_size(tparam);
/* Fill direct blocks in root indirect block up */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill row of recursive indirect blocks */
- if(fill_2nd_indirect_row(fh, 1, fill_size, &state, NULL))
+ if (fill_2nd_indirect_row(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force creation of second
* recursive indirect block
*/
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_start_2nd_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_recursive_indirect_two_deep
*
@@ -5275,24 +5259,24 @@ error:
static unsigned
test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -5300,15 +5284,15 @@ test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_te
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5322,40 +5306,41 @@ test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_te
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_recursive_indirect_two_deep() */
-
/*-------------------------------------------------------------------------
* Function: test_man_start_3rd_recursive_indirect
*
@@ -5377,24 +5362,24 @@ error:
static unsigned
test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -5402,15 +5387,15 @@ test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5424,47 +5409,48 @@ test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force creation of third level deep
* recursive indirect block
*/
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_start_3rd_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_first_3rd_recursive_indirect
*
@@ -5486,24 +5472,24 @@ error:
static unsigned
test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -5511,15 +5497,15 @@ test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5533,48 +5519,49 @@ test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all direct block rows in third level indirect block */
- if(fill_all_direct(fh, fill_size, &state, NULL))
+ if (fill_all_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill row of recursive indirect blocks in third level indirect block */
- if(fill_2nd_indirect_row(fh, 1, fill_size, &state, NULL))
+ if (fill_2nd_indirect_row(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_first_3rd_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_3rd_recursive_indirect_row
*
@@ -5596,24 +5583,24 @@ error:
static unsigned
test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -5621,15 +5608,15 @@ test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5637,50 +5624,52 @@ test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea
* Test inserting mult. (small) objects to fill all direct
* blocks in first recursive indirect block
*/
- TESTING("inserting objects to fill row of indirect blocks in recursive indirect blocks three levels deep");
+ TESTING(
+ "inserting objects to fill row of indirect blocks in recursive indirect blocks three levels deep");
/* Retrieve "bulk" filling object size */
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill 1st row of 3rd level indirect blocks */
- if(fill_3rd_indirect_row(fh, 1, fill_size, &state, NULL))
+ if (fill_3rd_indirect_row(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_3rd_recursive_indirect_row() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_all_3rd_recursive_indirect
*
@@ -5702,24 +5691,24 @@ error:
static unsigned
test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -5727,15 +5716,15 @@ test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5743,50 +5732,52 @@ test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea
* Test inserting mult. (small) objects to fill all direct
* blocks in first recursive indirect block
*/
- TESTING("inserting objects to fill row of indirect blocks in recursive indirect blocks three levels deep");
+ TESTING(
+ "inserting objects to fill row of indirect blocks in recursive indirect blocks three levels deep");
/* Retrieve "bulk" filling object size */
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_all_3rd_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_start_4th_recursive_indirect
*
@@ -5809,24 +5800,24 @@ error:
static unsigned
test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -5834,15 +5825,15 @@ test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5856,51 +5847,52 @@ test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force creation of four level deep
* recursive indirect block
*/
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_start_4th_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_first_4th_recursive_indirect
*
@@ -5923,24 +5915,24 @@ error:
static unsigned
test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -5948,15 +5940,15 @@ test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -5964,62 +5956,64 @@ test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh
* Test inserting mult. (small) objects to fill all direct
* blocks in first recursive indirect block
*/
- TESTING("inserting objects to fill first (3rd level) indirect block in recursive indirect block four levels deep");
+ TESTING("inserting objects to fill first (3rd level) indirect block in recursive indirect block four "
+ "levels deep");
/* Retrieve "bulk" filling object size */
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill direct block rows in fourth level indirect block */
- if(fill_all_direct(fh, fill_size, &state, NULL))
+ if (fill_all_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 2nd level deep indirect blocks in fourth level indirect block */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first row of 3rd level deep indirect blocks in fourth level indirect block */
- if(fill_3rd_indirect_row(fh, 1, fill_size, &state, NULL))
+ if (fill_3rd_indirect_row(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_first_4th_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_4th_recursive_indirect_row
*
@@ -6042,24 +6036,24 @@ error:
static unsigned
test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6067,15 +6061,15 @@ test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -6089,48 +6083,49 @@ test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill 1st row of 4th level indirect blocks */
- if(fill_4th_indirect_row(fh, 1, fill_size, &state, NULL))
+ if (fill_4th_indirect_row(fh, 1, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_4th_recursive_indirect_row() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_all_4th_recursive_indirect
*
@@ -6153,24 +6148,24 @@ error:
static unsigned
test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6178,15 +6173,15 @@ test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -6200,49 +6195,50 @@ test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 4th level indirect blocks */
- if(fill_all_4th_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_4th_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_all_4th_recursive_indirect() */
#endif /* ALL_INSERT_TESTS */
-
/*-------------------------------------------------------------------------
* Function: test_man_start_5th_recursive_indirect
*
@@ -6266,24 +6262,24 @@ error:
static unsigned
test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6291,15 +6287,15 @@ test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
@@ -6314,67 +6310,68 @@ test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t
fill_size = get_fill_size(tparam);
/* Fill direct blocks up in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap & file */
- if(reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
+ if (reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap & file */
- if(reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
+ if (reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap & file */
- if(reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
+ if (reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 4th level indirect blocks */
- if(fill_all_4th_indirect_rows(fh, fill_size, &state, NULL))
+ if (fill_all_4th_indirect_rows(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap & file */
- if(reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
+ if (reopen_file(&file, &f, filename, fapl, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to force creation of five level deep
* recursive indirect block
*/
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, NULL))
+ if (add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, NULL))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_start_5th_recursive_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_bogus
*
@@ -6392,29 +6389,29 @@ error:
static unsigned
test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
- unsigned long seed = 0; /* Random # seed */
- size_t id_len; /* Size of fractal heap IDs */
- hsize_t obj_off; /* Offset of object in heap */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
+ unsigned long seed = 0; /* Random # seed */
+ size_t id_len; /* Size of fractal heap IDs */
+ hsize_t obj_off; /* Offset of object in heap */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6422,22 +6419,22 @@ test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/*
@@ -6458,76 +6455,74 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
/* Set heap ID to random (non-null) value */
heap_id[0] = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN;
- for(u = 1; u < HEAP_ID_LEN; u++)
+ for (u = 1; u < HEAP_ID_LEN; u++)
heap_id[u] = (unsigned char)(HDrandom() + 1);
/* Try removing bogus heap ID from empty heap */
- H5E_BEGIN_TRY {
- ret = H5HF_remove(fh, heap_id);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5HF_remove(fh, heap_id); }
+ H5E_END_TRY;
+ if (ret >= 0)
FAIL_STACK_ERROR
/* Fill root direct blocks */
- if(fill_root_direct(fh, fill_size, &state, NULL))
+ if (fill_root_direct(fh, fill_size, &state, NULL))
FAIL_STACK_ERROR
/* Get offset of random heap ID */
- if(H5HF_get_id_off_test(fh, heap_id, &obj_off) < 0)
+ if (H5HF_get_id_off_test(fh, heap_id, &obj_off) < 0)
FAIL_STACK_ERROR
/* Make certain we can't accidentally use a valid heap ID */
- while(obj_off < state.man_size) {
+ while (obj_off < state.man_size) {
/* Set heap ID to random (non-null) value */
heap_id[0] = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN;
- for(u = 1; u < HEAP_ID_LEN; u++)
+ for (u = 1; u < HEAP_ID_LEN; u++)
heap_id[u] = (unsigned char)(HDrandom() + 1);
/* Get offset of random heap ID */
- if(H5HF_get_id_off_test(fh, heap_id, &obj_off) < 0)
+ if (H5HF_get_id_off_test(fh, heap_id, &obj_off) < 0)
FAIL_STACK_ERROR
} /* end while */
/* Try removing bogus heap ID from heap w/objects */
- H5E_BEGIN_TRY {
- ret = H5HF_remove(fh, heap_id);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5HF_remove(fh, heap_id); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
H5Eclear2(H5E_DEFAULT);
/* Try reading bogus heap ID from heap w/objects */
- H5E_BEGIN_TRY {
- ret = H5HF_read(fh, heap_id, shared_robj_g);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5HF_read(fh, heap_id, shared_robj_g); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
H5Eclear2(H5E_DEFAULT);
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_bogus() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_one
*
@@ -6545,28 +6540,28 @@ error:
static unsigned
test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
- unsigned char obj[SMALL_OBJ_SIZE1]; /* Buffer for object to insert */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
+ unsigned char obj[SMALL_OBJ_SIZE1]; /* Buffer for object to insert */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6574,40 +6569,40 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Prepare for querying the size of a file with an empty heap */
/* Close (empty) heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6615,7 +6610,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
STACK_ERROR
/* Re-open heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/*
@@ -6624,73 +6619,74 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
TESTING("removing single object from absolute heap");
/* Initialize the buffer for objects to insert */
- for(u = 0; u < sizeof(obj); u++)
+ for (u = 0; u < sizeof(obj); u++)
obj[u] = (unsigned char)u;
/* Insert object into heap */
- if(H5HF_insert(fh, sizeof(obj), obj, &heap_id) < 0)
+ if (H5HF_insert(fh, sizeof(obj), obj, &heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0) - sizeof(obj);
- state.man_nobjs = 1;
- if(check_stats(fh, &state))
+ state.man_nobjs = 1;
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.man_size = 0;
+ state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
- state.man_nobjs = 0;
- if(check_stats(fh, &state))
+ state.man_nobjs = 0;
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_one() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_two
*
@@ -6708,29 +6704,29 @@ error:
static unsigned
test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- unsigned char heap_id1[HEAP_ID_LEN]; /* Heap ID for first object */
- unsigned char heap_id2[HEAP_ID_LEN]; /* Heap ID for second object */
- unsigned char obj[SMALL_OBJ_SIZE1]; /* Buffer for object to insert */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ unsigned char heap_id1[HEAP_ID_LEN]; /* Heap ID for first object */
+ unsigned char heap_id2[HEAP_ID_LEN]; /* Heap ID for second object */
+ unsigned char obj[SMALL_OBJ_SIZE1]; /* Buffer for object to insert */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6738,40 +6734,40 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Prepare for querying the size of a file with an empty heap */
/* Close (empty) heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6779,7 +6775,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
STACK_ERROR
/* Re-open heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/*
@@ -6788,101 +6784,102 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara
TESTING("removing two objects from absolute heap");
/* Initialize the buffer for objects to insert */
- for(u = 0; u < sizeof(obj); u++)
+ for (u = 0; u < sizeof(obj); u++)
obj[u] = (unsigned char)u;
/* Insert first object into heap */
- if(H5HF_insert(fh, sizeof(obj), obj, &heap_id1) < 0)
+ if (H5HF_insert(fh, sizeof(obj), obj, &heap_id1) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0) - sizeof(obj);
- state.man_nobjs = 1;
- if(check_stats(fh, &state))
+ state.man_nobjs = 1;
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Insert second object into heap */
- if(H5HF_insert(fh, sizeof(obj), obj, &heap_id2) < 0)
+ if (H5HF_insert(fh, sizeof(obj), obj, &heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.man_free_space -= sizeof(obj);
state.man_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id1) < 0)
+ if (H5HF_remove(fh, heap_id1) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.man_free_space += sizeof(obj);
state.man_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove second object from heap */
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.man_size = 0;
+ state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
- state.man_nobjs = 0;
- if(check_stats(fh, &state))
+ state.man_nobjs = 0;
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_two() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_one_larger
*
@@ -6901,29 +6898,29 @@ error:
static unsigned
test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
- unsigned char *obj; /* Buffer for object to insert */
- size_t obj_len; /* Length of object to insert */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
+ unsigned char * obj; /* Buffer for object to insert */
+ size_t obj_len; /* Length of object to insert */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6931,40 +6928,40 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Prepare for querying the size of a file with an empty heap */
/* Close (empty) heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -6972,7 +6969,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
STACK_ERROR
/* Re-open heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/*
@@ -6982,75 +6979,76 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* Set up object to insert */
obj_len = (size_t)DBLOCK_SIZE(fh, 2) + 1;
- obj = shared_wobj_g;
+ obj = shared_wobj_g;
/* Insert object into heap */
- if(H5HF_insert(fh, obj_len, obj, &heap_id) < 0)
+ if (H5HF_insert(fh, obj_len, obj, &heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- for(u = 0; u < 4; u++) {
+ for (u = 0; u < 4; u++) {
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size = DBLOCK_SIZE(fh, 3);
state.man_free_space -= obj_len;
state.man_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.man_size = 0;
+ state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
- state.man_nobjs = 0;
- if(check_stats(fh, &state))
+ state.man_nobjs = 0;
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_one_larger() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_two_larger
*
@@ -7069,30 +7067,30 @@ error:
static unsigned
test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- unsigned char heap_id1[HEAP_ID_LEN]; /* Heap ID for first object */
- unsigned char heap_id2[HEAP_ID_LEN]; /* Heap ID for second object */
- unsigned char *obj; /* Buffer for object to insert */
- size_t obj_len; /* Length of object to insert */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ unsigned char heap_id1[HEAP_ID_LEN]; /* Heap ID for first object */
+ unsigned char heap_id2[HEAP_ID_LEN]; /* Heap ID for second object */
+ unsigned char * obj; /* Buffer for object to insert */
+ size_t obj_len; /* Length of object to insert */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -7100,40 +7098,40 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Prepare for querying the size of a file with an empty heap */
/* Close (empty) heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -7141,155 +7139,156 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
STACK_ERROR
/* Re-open heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/*
* Test removing two larger objects from absolute heap
*/
- if(tparam->del_dir == FHEAP_DEL_FORWARD)
+ if (tparam->del_dir == FHEAP_DEL_FORWARD)
TESTING("removing two larger objects from absolute heap (forward)")
else
TESTING("removing two larger objects from absolute heap (reverse)")
/* Set up first object to insert */
obj_len = (size_t)DBLOCK_SIZE(fh, 2) + 1;
- obj = shared_wobj_g;
+ obj = shared_wobj_g;
/* Insert object into heap */
- if(H5HF_insert(fh, obj_len, obj, &heap_id1) < 0)
+ if (H5HF_insert(fh, obj_len, obj, &heap_id1) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- for(u = 0; u < 4; u++) {
+ for (u = 0; u < 4; u++) {
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size = DBLOCK_SIZE(fh, 3);
state.man_free_space -= obj_len;
state.man_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Set up second object to insert */
obj_len = (size_t)DBLOCK_SIZE(fh, 4) + 1;
- obj = shared_wobj_g;
+ obj = shared_wobj_g;
/* Insert object into heap */
- if(H5HF_insert(fh, obj_len, obj, &heap_id2) < 0)
+ if (H5HF_insert(fh, obj_len, obj, &heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
/* (Goes to 8 rows because of doubling) */
- for(u = 4; u < 8; u++) {
+ for (u = 4; u < 8; u++) {
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size += DBLOCK_SIZE(fh, 5);
state.man_free_space -= obj_len;
state.man_nobjs = 2;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove objects in different orders */
- if(tparam->del_dir == FHEAP_DEL_FORWARD) {
+ if (tparam->del_dir == FHEAP_DEL_FORWARD) {
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id1) < 0)
+ if (H5HF_remove(fh, heap_id1) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.man_alloc_size -= DBLOCK_SIZE(fh, 3);
state.man_free_space += DBLOCK_SIZE(fh, 2) + 1;
state.man_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove second object from heap */
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
} /* end if */
else {
/* Remove second object from heap */
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
/* (Goes to 4 rows because of halving) */
- for(u = 4; u < 8; u++) {
+ for (u = 4; u < 8; u++) {
state.man_size -= DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space -= DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size -= DBLOCK_SIZE(fh, 5);
state.man_free_space += DBLOCK_SIZE(fh, 4) + 1;
state.man_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id1) < 0)
+ if (H5HF_remove(fh, heap_id1) < 0)
FAIL_STACK_ERROR
} /* end else */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.man_size = 0;
+ state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
- state.man_nobjs = 0;
- if(check_stats(fh, &state))
+ state.man_nobjs = 0;
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_two_larger() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_three_larger
*
@@ -7308,31 +7307,31 @@ error:
static unsigned
test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- unsigned char heap_id1[HEAP_ID_LEN]; /* Heap ID for first object */
- unsigned char heap_id2[HEAP_ID_LEN]; /* Heap ID for second object */
- unsigned char heap_id3[HEAP_ID_LEN]; /* Heap ID for third object */
- unsigned char *obj; /* Buffer for object to insert */
- size_t obj_len; /* Length of object to insert */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ unsigned char heap_id1[HEAP_ID_LEN]; /* Heap ID for first object */
+ unsigned char heap_id2[HEAP_ID_LEN]; /* Heap ID for second object */
+ unsigned char heap_id3[HEAP_ID_LEN]; /* Heap ID for third object */
+ unsigned char * obj; /* Buffer for object to insert */
+ size_t obj_len; /* Length of object to insert */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -7340,40 +7339,40 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Prepare for querying the size of a file with an empty heap */
/* Close (empty) heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -7381,214 +7380,215 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
STACK_ERROR
/* Re-open heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/*
* Test removing three larger objects from absolute heap
*/
- if(tparam->del_dir == FHEAP_DEL_FORWARD)
+ if (tparam->del_dir == FHEAP_DEL_FORWARD)
TESTING("removing three larger objects from absolute heap (forward)")
else
TESTING("removing three larger objects from absolute heap (reverse)")
/* Set up first object to insert */
obj_len = (size_t)DBLOCK_SIZE(fh, 2) + 1;
- obj = shared_wobj_g;
+ obj = shared_wobj_g;
/* Insert object into heap */
- if(H5HF_insert(fh, obj_len, obj, &heap_id1) < 0)
+ if (H5HF_insert(fh, obj_len, obj, &heap_id1) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- for(u = 0; u < 4; u++) {
+ for (u = 0; u < 4; u++) {
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size = DBLOCK_SIZE(fh, 3);
state.man_free_space -= obj_len;
state.man_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Set up second object to insert */
obj_len = (size_t)DBLOCK_SIZE(fh, 4) + 1;
- obj = shared_wobj_g;
+ obj = shared_wobj_g;
/* Insert object into heap */
- if(H5HF_insert(fh, obj_len, obj, &heap_id2) < 0)
+ if (H5HF_insert(fh, obj_len, obj, &heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
/* (Goes to 8 rows because of doubling) */
- for(u = 4; u < 8; u++) {
+ for (u = 4; u < 8; u++) {
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size += DBLOCK_SIZE(fh, 5);
state.man_free_space -= obj_len;
state.man_nobjs = 2;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Set up third object to insert */
obj_len = (size_t)DBLOCK_SIZE(fh, 7) + 1;
- obj = shared_wobj_g;
+ obj = shared_wobj_g;
/* Insert object into heap */
- if(H5HF_insert(fh, obj_len, obj, &heap_id3) < 0)
+ if (H5HF_insert(fh, obj_len, obj, &heap_id3) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
/* (Goes to 16 rows because of doubling) */
- for(u = 8; u < 16; u++) {
+ for (u = 8; u < 16; u++) {
state.man_size += DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size += DBLOCK_SIZE(fh, 8);
state.man_free_space -= obj_len;
state.man_nobjs = 3;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove objects in different orders */
- if(tparam->del_dir == FHEAP_DEL_FORWARD) {
+ if (tparam->del_dir == FHEAP_DEL_FORWARD) {
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id1) < 0)
+ if (H5HF_remove(fh, heap_id1) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.man_alloc_size -= DBLOCK_SIZE(fh, 3);
state.man_free_space += DBLOCK_SIZE(fh, 2) + 1;
state.man_nobjs = 2;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove second object from heap */
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.man_alloc_size -= DBLOCK_SIZE(fh, 5);
state.man_free_space += DBLOCK_SIZE(fh, 4) + 1;
state.man_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove third object from heap */
- if(H5HF_remove(fh, heap_id3) < 0)
+ if (H5HF_remove(fh, heap_id3) < 0)
FAIL_STACK_ERROR
} /* end if */
else {
/* Remove third object from heap */
- if(H5HF_remove(fh, heap_id3) < 0)
+ if (H5HF_remove(fh, heap_id3) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
/* (Goes to 8 rows because of halving) */
- for(u = 8; u < 16; u++) {
+ for (u = 8; u < 16; u++) {
state.man_size -= DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space -= DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size -= DBLOCK_SIZE(fh, 8);
state.man_free_space += DBLOCK_SIZE(fh, 7) + 1;
state.man_nobjs = 2;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove second object from heap */
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
/* (Goes to 4 rows because of halving) */
- for(u = 4; u < 8; u++) {
+ for (u = 4; u < 8; u++) {
state.man_size -= DBLOCK_SIZE(fh, u) * cparam->managed.width;
state.man_free_space -= DBLOCK_FREE(fh, u) * cparam->managed.width;
} /* end for */
state.man_alloc_size -= DBLOCK_SIZE(fh, 5);
state.man_free_space += DBLOCK_SIZE(fh, 4) + 1;
state.man_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id1) < 0)
+ if (H5HF_remove(fh, heap_id1) < 0)
FAIL_STACK_ERROR
} /* end else */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.man_size = 0;
+ state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
- state.man_nobjs = 0;
- if(check_stats(fh, &state))
+ state.man_nobjs = 0;
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_three_larger() */
-
/*-------------------------------------------------------------------------
* Function: test_man_incr_insert_remove
*
@@ -7605,57 +7605,57 @@ error:
static unsigned
test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- unsigned char **heap_id = NULL;
- unsigned char *heap_id_data = NULL;
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ unsigned char **heap_id = NULL;
+ unsigned char * heap_id_data = NULL;
struct a_type_t1 {
char a[10];
char b[40];
- } obj1, obj2; /* Objects to insert/remove */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_state_t state; /* State of fractal heap */
- int i, j;
+ } obj1, obj2; /* Objects to insert/remove */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_state_t state; /* State of fractal heap */
+ int i, j;
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Set up data array */
- if(NULL == (heap_id_data = (unsigned char *)HDcalloc(100 * MAX_HEAP_ID_LEN, sizeof(unsigned char))))
+ if (NULL == (heap_id_data = (unsigned char *)HDcalloc(100 * MAX_HEAP_ID_LEN, sizeof(unsigned char))))
TEST_ERROR;
- if(NULL == (heap_id = (unsigned char **)HDcalloc(100, sizeof(heap_id_data))))
+ if (NULL == (heap_id = (unsigned char **)HDcalloc(100, sizeof(heap_id_data))))
TEST_ERROR;
for (i = 0; i < 100; i++)
heap_id[i] = heap_id_data + (i * MAX_HEAP_ID_LEN);
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
STACK_ERROR
/* Create absolute heap */
- if(NULL == (fh = H5HF_create(f, cparam)))
+ if (NULL == (fh = H5HF_create(f, cparam)))
FAIL_STACK_ERROR
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > HEAP_ID_LEN)
+ if (id_len > HEAP_ID_LEN)
FAIL_STACK_ERROR
- if(H5HF_get_heap_addr(fh, &fh_addr) < 0)
+ if (H5HF_get_heap_addr(fh, &fh_addr) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fh_addr))
+ if (!H5F_addr_defined(fh_addr))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
FAIL_STACK_ERROR
/*
@@ -7665,33 +7665,33 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
HDmemset(&obj1, 0, sizeof(obj1));
HDmemset(&obj2, 0, sizeof(obj2));
- for(i = 0; i < 100; i++) {
- for(j = 0; j < i; j++) {
- if(H5HF_remove(fh, heap_id[j]) < 0)
+ for (i = 0; i < 100; i++) {
+ for (j = 0; j < i; j++) {
+ if (H5HF_remove(fh, heap_id[j]) < 0)
FAIL_STACK_ERROR
HDsprintf(obj2.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j);
- if(H5HF_insert(fh, (sizeof(obj2)), &obj2, heap_id[j]) < 0)
+ if (H5HF_insert(fh, (sizeof(obj2)), &obj2, heap_id[j]) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object */
HDmemset(heap_id[i], 0, id_len);
HDsprintf(obj1.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i);
- if(H5HF_insert(fh, (sizeof(obj1)), &obj1, heap_id[i]) < 0)
+ if (H5HF_insert(fh, (sizeof(obj1)), &obj1, heap_id[i]) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* All tests passed */
@@ -7703,11 +7703,13 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
return 0;
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
HDfree(heap_id);
HDfree(heap_id_data);
@@ -7715,7 +7717,6 @@ error:
return 1;
} /* test_man_incr_insert_remove() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_root_direct
*
@@ -7734,37 +7735,35 @@ error:
static unsigned
test_man_remove_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "removing all objects from root direct block of absolute heap %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill the heap up */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_heap(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -7775,21 +7774,22 @@ test_man_remove_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_root_direct() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_two_direct
*
@@ -7808,52 +7808,50 @@ error:
static unsigned
test_man_remove_two_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "removing all objects from two direct blocks of absolute heap %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill the first block in heap */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_heap(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Fill the second block in heap */
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space = (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_heap(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -7864,21 +7862,22 @@ test_man_remove_two_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_two_direct() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_first_row
*
@@ -7897,34 +7896,32 @@ error:
static unsigned
test_man_remove_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "removing all objects from first row of direct blocks of absolute heap %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill first row of direct blocks */
- if(fill_root_row(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_root_row(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -7935,21 +7932,22 @@ test_man_remove_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_first_row() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_first_two_rows
*
@@ -7968,36 +7966,34 @@ error:
static unsigned
test_man_remove_first_two_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "removing all objects from first two rows of direct blocks of absolute heap %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill first two rows of direct blocks */
- if(fill_root_row(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_root_row(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_root_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_root_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8008,21 +8004,22 @@ test_man_remove_first_two_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_par
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_first_two_rows() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_first_four_rows
*
@@ -8041,40 +8038,38 @@ error:
static unsigned
test_man_remove_first_four_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "removing all objects from first four rows of direct blocks of absolute heap %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill first two rows of direct blocks */
- if(fill_root_row(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_root_row(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_root_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_root_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_root_row(fh, 2, fill_size, &state, &keep_ids))
+ if (fill_root_row(fh, 2, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_root_row(fh, 3, fill_size, &state, &keep_ids))
+ if (fill_root_row(fh, 3, fill_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8085,21 +8080,22 @@ test_man_remove_first_four_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_first_four_rows() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_all_root_direct
*
@@ -8118,34 +8114,32 @@ error:
static unsigned
test_man_remove_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "removing all objects from all direct blocks of root group in absolute heap %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8156,21 +8150,22 @@ test_man_remove_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_all_root_direct() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_2nd_indirect
*
@@ -8189,38 +8184,36 @@ error:
static unsigned
test_man_remove_2nd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "removing all objects from 2nd level indirect blocks of absolute heap %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8231,21 +8224,22 @@ test_man_remove_2nd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_2nd_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_remove_3rd_indirect
*
@@ -8264,42 +8258,40 @@ error:
static unsigned
test_man_remove_3rd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "removing all objects from 3rd level indirect blocks of absolute heap %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8310,21 +8302,22 @@ test_man_remove_3rd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_remove_3rd_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_man_skip_start_block
*
@@ -8346,27 +8339,28 @@ error:
static unsigned
test_man_skip_start_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "inserting object that is too large for starting block, then remove all objects %s";
+ const char *base_desc =
+ "inserting object that is too large for starting block, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
- obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1;
+ obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1;
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
@@ -8374,12 +8368,11 @@ test_man_skip_start_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
state.man_free_space = cparam->managed.width * DBLOCK_FREE(fh, 0);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 1);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 2);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8390,21 +8383,22 @@ test_man_skip_start_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_skip_start_block() */
-
/*-------------------------------------------------------------------------
* Function: test_man_skip_start_block_add_back
*
@@ -8424,29 +8418,29 @@ error:
static unsigned
test_man_skip_start_block_add_back(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "skipping starting block, then adding object back to first block, then remove all objects %s";
+ const char *base_desc =
+ "skipping starting block, then adding object back to first block, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Insert object too large for starting block size */
- obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1;
+ obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1;
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
@@ -8454,30 +8448,29 @@ test_man_skip_start_block_add_back(hid_t fapl, H5HF_create_t *cparam, fheap_test
state.man_free_space = cparam->managed.width * DBLOCK_FREE(fh, 0);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 1);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 2);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert an object to fill up the heap block just created */
obj_size = (size_t)DBLOCK_FREE(fh, 2) - obj_size;
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert second "real" object, which should go in earlier direct block */
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)20, (size_t)SMALL_OBJ_SIZE2, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, (size_t)SMALL_OBJ_SIZE2, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8488,21 +8481,22 @@ test_man_skip_start_block_add_back(hid_t fapl, H5HF_create_t *cparam, fheap_test
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_skip_start_block_add_back() */
-
/*-------------------------------------------------------------------------
* Function: test_man_skip_start_block_add_skipped
*
@@ -8523,30 +8517,30 @@ error:
static unsigned
test_man_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "skipping starting block, then adding objects to backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "skipping starting block, then adding objects to backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Insert object too large for starting block size */
- obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1;
+ obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1;
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
@@ -8554,40 +8548,39 @@ test_man_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_t
state.man_free_space = cparam->managed.width * DBLOCK_FREE(fh, 0);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 1);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 2);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert an object to fill up the heap block just created */
obj_size = (size_t)DBLOCK_FREE(fh, 2) - obj_size;
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add rows of blocks to "backfill" direct blocks that were skipped */
- if(fill_row(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert another object, which should extend direct blocks, instead of backfill */
state.man_alloc_size += DBLOCK_SIZE(fh, 2);
- if(add_obj(fh, (size_t)20, (size_t)SMALL_OBJ_SIZE2, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, (size_t)SMALL_OBJ_SIZE2, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8598,21 +8591,22 @@ test_man_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_t
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_skip_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_skip_2nd_block
*
@@ -8633,36 +8627,36 @@ error:
static unsigned
test_man_skip_2nd_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "insert object to initial block, then add object too large for starting direct blocks, then remove all objects %s";
+ const char *base_desc = "insert object to initial block, then add object too large for starting direct "
+ "blocks, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Insert small object, to create root direct block */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -8673,15 +8667,14 @@ test_man_skip_2nd_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_alloc_size += DBLOCK_SIZE(fh, 2);
- state.man_free_space += (cparam->managed.width - 1 )* DBLOCK_FREE(fh, 0);
+ state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 1);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 2);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8692,21 +8685,22 @@ test_man_skip_2nd_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_skip_2nd_block() */
-
/*-------------------------------------------------------------------------
* Function: test_man_skip_2nd_block_add_skipped
*
@@ -8730,38 +8724,38 @@ error:
static unsigned
test_man_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned v; /* Local index variables */
/* Test description */
- const char *base_desc = "insert object to initial block, then add object too large for starting direct blocks, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "insert object to initial block, then add object too large for starting direct "
+ "blocks, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Insert small object, to create root direct block */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -8772,59 +8766,58 @@ test_man_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_tes
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 1);
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, 2);
state.man_alloc_size += DBLOCK_SIZE(fh, 2);
- state.man_free_space += (cparam->managed.width - 1 )* DBLOCK_FREE(fh, 0);
+ state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 1);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 2);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert an object to fill up the (smaller) heap block just created */
obj_size = (size_t)DBLOCK_FREE(fh, 0) - SMALL_OBJ_SIZE1;
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill remainder of 2 * start size block */
obj_size = (size_t)DBLOCK_FREE(fh, 2) - ((size_t)DBLOCK_SIZE(fh, 0) + 1);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert objects to fill remaining rows of the starting block size */
/* Fill remainder of first row of direct heap blocks up */
- for(v = 0; v < (cparam->managed.width - 1); v++) {
+ for (v = 0; v < (cparam->managed.width - 1); v++) {
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_heap(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Fill second row of direct blocks */
- if(fill_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to create new 2 * start size direct block */
state.man_alloc_size += DBLOCK_SIZE(fh, 2);
- if(add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -8835,21 +8828,22 @@ test_man_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_tes
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_skip_2nd_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_one_partial_skip_2nd_block_add_skipped
*
@@ -8873,51 +8867,52 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
/* Test description */
- const char *base_desc = "skipping blocks with indirect root, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "skipping blocks with indirect root, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill initial direct block */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_heap(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert small object, to create root indirect block */
state.man_size += (cparam->managed.width - 1) * DBLOCK_SIZE(fh, 0);
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
- if(add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -8931,67 +8926,66 @@ test_man_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 1);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 2);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 3);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert an object to fill up the (smaller) heap block just created */
obj_size = (size_t)DBLOCK_FREE(fh, 0) - SMALL_OBJ_SIZE1;
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill remainder of 4 * start size block */
obj_size = (size_t)DBLOCK_FREE(fh, 3) - ((size_t)DBLOCK_SIZE(fh, 2) + 1);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert objects to fill remaining heaps in first row */
- for(u = 0; u < (cparam->managed.width - 2); u++) {
+ for (u = 0; u < (cparam->managed.width - 2); u++) {
/* Fill a direct heap block up */
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(fill_heap(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_heap(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert objects to fill remaining heaps in second row */
- if(fill_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert objects to fill remaining heaps in third row */
- if(fill_row(fh, 2, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 2, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to create new 4 * start size direct block */
state.man_alloc_size += DBLOCK_SIZE(fh, 3);
- if(add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, (size_t)SMALL_OBJ_SIZE1, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -9002,21 +8996,22 @@ test_man_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_one_partial_skip_2nd_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_row_skip_add_skipped
*
@@ -9041,34 +9036,34 @@ error:
static unsigned
test_man_fill_row_skip_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "filling first row, then skipping rows, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling first row, then skipping rows, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill first row of direct blocks */
- if(fill_root_row(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_root_row(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -9082,46 +9077,45 @@ test_man_fill_row_skip_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 1);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 2);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 3);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill remainder of 4 * start size block */
obj_size = (size_t)DBLOCK_FREE(fh, 3) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert objects to fill remaining heaps in second row */
- if(fill_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert objects to fill remaining heaps in third row */
- if(fill_row(fh, 2, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 2, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to create new 4 * start size direct block */
state.man_alloc_size += DBLOCK_SIZE(fh, 3);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -9132,21 +9126,22 @@ test_man_fill_row_skip_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_row_skip_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_skip_direct_skip_indirect_two_rows_add_skipped
*
@@ -9166,32 +9161,33 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_direct_rows; /* Number of rows (of direct blocks) in root indirect block */
- unsigned row; /* Current row */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned num_direct_rows; /* Number of rows (of direct blocks) in root indirect block */
+ unsigned row; /* Current row */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
fheap_heap_state_t state; /* State of fractal heap */
- unsigned v; /* Local index variables */
+ unsigned v; /* Local index variables */
/* Test description */
- const char *base_desc = "skipping direct blocks to last row and skipping two rows of root indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "skipping direct blocks to last row and skipping two rows of root indirect "
+ "block, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Compute # direct block rows in root indirect block */
num_direct_rows = DTABLE_MAX_DROWS(fh);
@@ -9201,13 +9197,13 @@ test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
row++;
- } while(row < (num_direct_rows / 2));
+ } while (row < (num_direct_rows / 2));
/* Insert object to extend root block to middle of root direct blocks
*/
obj_size = (size_t)DBLOCK_SIZE(fh, row - 2) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, row - 1);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Compute heap size & free space when all direct blocks allocated */
@@ -9215,21 +9211,21 @@ test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
row++;
- } while(row < num_direct_rows);
+ } while (row < num_direct_rows);
/* Insert large objects into last row of direct blocks in root indirect
* block, to force extension of root indirect block that covers the first
* row of indirect blocks in root indirect block
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_direct_rows - 2) + 1;
- for(v = 0; v < cparam->managed.width; v++) {
+ for (v = 0; v < cparam->managed.width; v++) {
state.man_alloc_size += DBLOCK_SIZE(fh, num_direct_rows - 1);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Compute heap size & free space when root indirect block doubles again */
@@ -9237,19 +9233,18 @@ test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
row++;
- } while(row < (2 * num_direct_rows));
+ } while (row < (2 * num_direct_rows));
/* Insert large object, to force creation of indirect blocks with
* range of skipped blocks that are too small to hold the large object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_direct_rows - 2) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_direct_rows - 1);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -9260,21 +9255,22 @@ test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_skip_direct_skip_indirect_two_rows_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_direct_skip_indirect_start_block_add_skipped
*
@@ -9293,36 +9289,37 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_direct_skip_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_direct_skip_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "filling direct blocks and skipping blocks in non-root indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "filling direct blocks and skipping blocks in non-root indirect block, then "
+ "backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -9330,49 +9327,48 @@ test_man_fill_direct_skip_indirect_start_block_add_skipped(hid_t fapl, H5HF_crea
*/
obj_size = (size_t)DBLOCK_SIZE(fh, 2) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, 3);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add rows of blocks to "backfill" direct blocks that were skipped */
- if(fill_row(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert an object to fill up the (biggest) heap block created */
obj_size = (size_t)DBLOCK_FREE(fh, 3) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill direct block heaps with 2 * initial block size in nested indirect block */
- if(fill_row(fh, 2, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 2, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert one more object, to create new 4 * start size direct block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, 3);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -9383,21 +9379,22 @@ test_man_fill_direct_skip_indirect_start_block_add_skipped(hid_t fapl, H5HF_crea
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_direct_skip_indirect_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped
*
@@ -9417,42 +9414,44 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- unsigned row; /* Current row in indirect block */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ unsigned row; /* Current row in indirect block */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
/* Test description */
- const char *base_desc = "filling direct blocks and skipping row of non-root indirect blocks, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "filling direct blocks and skipping row of non-root indirect blocks, then "
+ "backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -9461,46 +9460,46 @@ test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of direct blocks that are smaller than large object's block size */
- for(row = 0; row < num_first_indirect_rows; row++) {
+ for (row = 0; row < num_first_indirect_rows; row++) {
/* Fill rows of direct blocks in skipped indirect blocks */
- for(u = 0; u < cparam->managed.width; u++)
- if(fill_row(fh, row, fill_size, &state, &keep_ids))
+ for (u = 0; u < cparam->managed.width; u++)
+ if (fill_row(fh, row, fill_size, &state, &keep_ids))
TEST_ERROR
/* Fill row of direct blocks in largest (i.e. non-skipped) indirect block */
- if(fill_row(fh, row, fill_size, &state, &keep_ids))
+ if (fill_row(fh, row, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -9511,21 +9510,22 @@ test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped
*
@@ -9546,51 +9546,54 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, except last one, and insert object too large for 2nd level indirect blocks, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, except last one, and insert object too "
+ "large for 2nd level indirect blocks, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first row (except one) of 2nd level indirect blocks */
- for(u = 0; u < cparam->managed.width - 1; u++)
+ for (u = 0; u < cparam->managed.width - 1; u++)
/* Fill all rows of 2nd level indirect blocks in root block */
- if(fill_2nd_indirect(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_2nd_indirect(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -9599,48 +9602,47 @@ test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in 2nd level indirect block's direct blocks
* (and rows of next 2nd level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in skipped 2nd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in current 2nd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -9651,21 +9653,22 @@ test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped
*
@@ -9689,42 +9692,44 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- unsigned row; /* Current row in indirect block */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ unsigned row; /* Current row in indirect block */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
/* Test description */
- const char *base_desc = "filling direct blocks and skipping row of non-root indirect blocks, then skip row of direct blocks, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "filling direct blocks and skipping row of non-root indirect blocks, then skip "
+ "row of direct blocks, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -9733,80 +9738,79 @@ test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object too large for initial block size in skipped indirect blocks */
obj_size = (size_t)DBLOCK_SIZE(fh, 3) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, 4);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (medium) block just created */
obj_size = (size_t)DBLOCK_FREE(fh, 4) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Finish off blocks in row of medium block size (just to make row filling easier below) */
obj_size = (size_t)DBLOCK_FREE(fh, 4);
- for(u = 1; u < cparam->managed.width; u++) {
+ for (u = 1; u < cparam->managed.width; u++) {
state.man_alloc_size += DBLOCK_SIZE(fh, 4);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of direct blocks that are smaller than large object's block size */
- for(row = 0; row < num_first_indirect_rows; row++) {
+ for (row = 0; row < num_first_indirect_rows; row++) {
/* Fill rows of direct blocks in skipped indirect blocks */
- for(u = 0; u < cparam->managed.width; u++)
- if(fill_row(fh, row, fill_size, &state, &keep_ids))
+ for (u = 0; u < cparam->managed.width; u++)
+ if (fill_row(fh, row, fill_size, &state, &keep_ids))
TEST_ERROR
/* Fill row of direct blocks in largest (i.e. non-skipped) indirect block */
/* (Skip the row of blocks filled above) */
- if(row != 4)
- if(fill_row(fh, row, fill_size, &state, &keep_ids))
+ if (row != 4)
+ if (fill_row(fh, row, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end while */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -9817,21 +9821,22 @@ test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_direct_skip_indirect_two_rows_add_skipped
*
@@ -9850,43 +9855,45 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- unsigned max_dblock_rows; /* Max. # of rows (of direct blocks) in the root indirect block */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ unsigned max_dblock_rows; /* Max. # of rows (of direct blocks) in the root indirect block */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks and skipping two rows of root indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "filling direct blocks and skipping two rows of root indirect block, then "
+ "backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
- max_dblock_rows = DTABLE_MAX_DROWS(fh);
+ max_dblock_rows = DTABLE_MAX_DROWS(fh);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -9894,71 +9901,70 @@ test_man_fill_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
*/
obj_size = (size_t)DBLOCK_SIZE(fh, max_dblock_rows - 2) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, max_dblock_rows - 1);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert an object to fill up the (biggest) heap block created */
obj_size = (size_t)DBLOCK_FREE(fh, max_dblock_rows - 1) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in indirect block's direct blocks */
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in first row of skipped 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block rows in second row of skipped 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in used 2nd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows in second row of skipped 2nd level indirect blocks (and used 2nd level block) */
/* Direct block rows in skipped 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Direct block row in used 2nd level indirect block */
- if(fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
+ if (fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, max_dblock_rows - 1);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -9969,21 +9975,22 @@ test_man_fill_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_direct_skip_indirect_two_rows_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped
*
@@ -10004,43 +10011,46 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- unsigned max_dblock_rows; /* Max. # of rows (of direct blocks) in the root indirect block */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ unsigned max_dblock_rows; /* Max. # of rows (of direct blocks) in the root indirect block */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks and skipping two rows of root indirect block, skip one row of root indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling direct blocks and skipping two rows of root indirect block, skip one row of root indirect "
+ "block, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
- max_dblock_rows = DTABLE_MAX_DROWS(fh);
+ max_dblock_rows = DTABLE_MAX_DROWS(fh);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of two rows of indirect blocks and
@@ -10048,20 +10058,20 @@ test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t
*/
obj_size = (size_t)DBLOCK_SIZE(fh, max_dblock_rows - 2) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, max_dblock_rows - 1);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert an object to fill up the (biggest) heap block created */
obj_size = (size_t)DBLOCK_FREE(fh, max_dblock_rows - 1) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object that can't fit in first row of indirect blocks
@@ -10070,76 +10080,76 @@ test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t
*/
obj_size = (size_t)DBLOCK_SIZE(fh, max_dblock_rows - 3) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, max_dblock_rows - 2);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert an object to fill up the (2nd biggest) heap block created */
obj_size = (size_t)DBLOCK_FREE(fh, max_dblock_rows - 2) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in indirect block's direct blocks */
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in first row of skipped 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block rows in second row of skipped 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in used 2nd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows in second row of skipped 2nd level indirect blocks (and used 2nd level block) */
/* Finish blocks in partially used 2nd level indirect block */
- if(fill_partial_row(fh, num_first_indirect_rows, cparam->managed.width - 1, fill_size, &state, &keep_ids))
+ if (fill_partial_row(fh, num_first_indirect_rows, cparam->managed.width - 1, fill_size, &state,
+ &keep_ids))
TEST_ERROR
/* Direct block rows in skipped 2nd level indirect blocks */
/* (less the one indirect block already used) */
- for(v = 0; v < cparam->managed.width - 1; v++)
- if(fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width - 1; v++)
+ if (fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Direct block row in used 3rd row 2nd level indirect block */
- if(fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
+ if (fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, max_dblock_rows - 1);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -10150,21 +10160,22 @@ test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_2nd_direct_skip_start_block_add_skipped
*
@@ -10184,44 +10195,46 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_2nd_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_2nd_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, and skip first rows of direct blocks of 3rd level indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, and skip first rows of direct blocks of "
+ "3rd level indirect block, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -10230,43 +10243,42 @@ test_man_fill_2nd_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t
*/
obj_size = (size_t)DBLOCK_SIZE(fh, 2) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, 3);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, 3) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in 3rd level indirect block's direct blocks */
- if(fill_row(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_row(fh, 2, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 2, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, 3);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -10277,21 +10289,22 @@ test_man_fill_2nd_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_2nd_direct_skip_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped
*
@@ -10313,52 +10326,55 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- /* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect block's direct blocks, and skip first rows of direct blocks of 3rd level indirect block's 2nd level indirect block, then backfill and extend, then remove all objects %s";
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ /* Test description */
+ const char *base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect block's direct "
+ "blocks, and skip first rows of direct blocks of 3rd level indirect block's 2nd level indirect "
+ "block, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in third level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -10367,45 +10383,44 @@ test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H
*/
obj_size = (size_t)DBLOCK_SIZE(fh, 2) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, 3);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, 3) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in (3rd level indirect block's) 2nd level
* indirect block's direct blocks
*/
- if(fill_row(fh, 0, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 0, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
- if(fill_row(fh, 2, fill_size, &state, &keep_ids))
+ if (fill_row(fh, 2, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, 3);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -10416,21 +10431,22 @@ test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped
*
@@ -10451,57 +10467,61 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(hid_t fapl,
+ H5HF_create_t * cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect block's direct blocks, and skip first row of indirect blocks of 3rd level indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level "
+ "indirect block's direct blocks, and skip first row of indirect blocks of 3rd "
+ "level indirect block, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in third level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -10510,50 +10530,49 @@ test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(h
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in (first 3rd level indirect block's) 2nd level
* indirect block's direct blocks
* (and second 3rd level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in 3rd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -10564,21 +10583,22 @@ test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(h
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped
*
@@ -10600,57 +10620,61 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(hid_t fapl,
+ H5HF_create_t * cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect block's direct blocks, and skip first two rows of indirect blocks of 3rd level indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level "
+ "indirect block's direct blocks, and skip first two rows of indirect blocks of "
+ "3rd level indirect block, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in third level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -10659,54 +10683,53 @@ test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows + 1);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows + 1) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in (first 3rd level indirect block's) 2nd level
* indirect block's direct blocks
* (and second 3rd level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in 3rd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Fill row of direct blocks in second 3rd level indirect block */
- if(fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
+ if (fill_row(fh, num_first_indirect_rows, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows + 1);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -10717,21 +10740,22 @@ test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped
*
@@ -10754,67 +10778,71 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling first row of 3rd level indirect blocks, except last one, fill all direct blocks in last 3rd level indirect block, and insert object too large for it's 2nd level indirect blocks, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, filling first row of 3rd level indirect "
+ "blocks, except last one, fill all direct blocks in last 3rd level indirect block, and insert object "
+ "too large for it's 2nd level indirect blocks, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks in root indirect block */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first row (except one) of 3rd level indirect blocks */
- for(u = 0; u < cparam->managed.width - 1; u++)
+ for (u = 0; u < cparam->managed.width - 1; u++)
/* Fill 3rd level indirect block */
- if(fill_3rd_indirect(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_3rd_indirect(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in last third level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -10823,49 +10851,48 @@ test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in 2nd level indirect block's direct blocks
* (and rows of next 3rd level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in current 3rd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -10876,21 +10903,22 @@ test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped
*
@@ -10914,73 +10942,78 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(
+ hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variables *//* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling first row of 3rd level indirect blocks, fill all direct blocks in next 3rd level indirect block, fill all 1st row of 2nd level indirect blocks, except last one, and insert object too large for 2nd level indirect block, then backfill and extend, then remove all objects %s";
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variables */ /* Test description */
+ const char * base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, filling first row of 3rd level indirect "
+ "blocks, fill all direct blocks in next 3rd level indirect block, fill all 1st row of 2nd level "
+ "indirect blocks, except last one, and insert object too large for 2nd level indirect block, then "
+ "backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks in 4th level indirect block */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first row of 3rd level indirect blocks */
- if(fill_3rd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_3rd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in 2nd row third level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first row (except one) of 2nd level indirect blocks */
- for(u = 0; u < cparam->managed.width - 1; u++)
- if(fill_2nd_indirect(fh, 1, fill_size, &state, &keep_ids))
+ for (u = 0; u < cparam->managed.width - 1; u++)
+ if (fill_2nd_indirect(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -10989,48 +11022,47 @@ test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_s
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in 2nd level indirect block's direct blocks
* (and rows of next 2nd level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in skipped 2nd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in current 2nd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -11041,21 +11073,22 @@ test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_s
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped
*
@@ -11077,65 +11110,69 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam,
+ fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill 4th level indirect block's direct blocks, and skip first row of 2nd indirect blocks of 4th level indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill "
+ "4th level indirect block's direct blocks, and skip first row of 2nd indirect blocks of 4th level "
+ "indirect block, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in fourth level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -11144,50 +11181,49 @@ test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in (first 4th level indirect block's) 2nd level
* indirect block's direct blocks
* (and second row of 2nd level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in 2nd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -11198,21 +11234,22 @@ test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
* Function: test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped
*
@@ -11236,81 +11273,86 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(
+ hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill 4th level indirect block's direct, 2nd level indirect blocks and 3rd level direct block, and skip first row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill "
+ "4th level indirect block's direct, 2nd level indirect blocks and 3rd level direct block, and skip "
+ "first row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then "
+ "backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in fourth level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks in fourth level indirect block */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in fourth level indirect block's 3rd level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -11319,50 +11361,49 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_blo
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in (first 4th level indirect block's first 3rd
* level block's) 2nd level indirect block's direct blocks
* (and rows of 2nd 3rd level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in 3rd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -11373,23 +11414,25 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_blo
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
- * Function: test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped
+ * Function:
+ *test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped
*
* Purpose: Test filling all direct blocks in root indirect block and all
* direct blocks in 2nd level indirect blocks, fill all direct
@@ -11413,114 +11456,120 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped(
+ hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill first row of 4th level indirect blocks, fill 2nd row 4th level indirect block's direct, 2nd level indirect blocks, first row of 3rd level indirect blocks, 3rd level direct block in 2nd row, and skip first row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill "
+ "first row of 4th level indirect blocks, fill 2nd row 4th level indirect block's direct, 2nd level "
+ "indirect blocks, first row of 3rd level indirect blocks, 3rd level direct block in 2nd row, and "
+ "skip first row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then "
+ "backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first row of 4th level indirect blocks */
- if(fill_4th_indirect_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_4th_indirect_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
- /* Account for root indirect block doubling # of rows again */
- /* (From 16 rows to the max. # of rows: 22) */
- /* (Note: this is tied to the particular doubling table/heap creation parameters) */
- {
- unsigned max_root_rows; /* Maximum # of rows in root indirect block */
- unsigned row; /* Row in heap */
+ /* Account for root indirect block doubling # of rows again */
+ /* (From 16 rows to the max. # of rows: 22) */
+ /* (Note: this is tied to the particular doubling table/heap creation parameters) */
+ {
+ unsigned max_root_rows; /* Maximum # of rows in root indirect block */
+ unsigned row; /* Row in heap */
- /* Get some information for the heap */
- max_root_rows = HEAP_MAX_ROOT_ROWS(fh);
+ /* Get some information for the heap */
+ max_root_rows = HEAP_MAX_ROOT_ROWS(fh);
- /* Increase heap size & free space */
- for(row = 16; row < max_root_rows; row++) {
- state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
- state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
- } /* end for */
- } /* end if */
+ /* Increase heap size & free space */
+ for (row = 16; row < max_root_rows; row++) {
+ state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
+ state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
+ } /* end for */
+ } /* end if */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in 2nd row 4th level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks in 2nd row 4th level indirect block */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first row of 3rd level indirect blocks in 2nd row 4th level indirect block */
- if(fill_3rd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_3rd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in 4th level indirect block's 2nd row of 3rd level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -11529,50 +11578,49 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in (first block in 2nd row 4th level indirect
* block's first 3rd level block's) 2nd level indirect block's direct
* blocks (and rows of 2nd 3rd level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in 3rd level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -11583,23 +11631,26 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
-} /* test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped() */
-
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
+} /* test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped()
+ */
/*-------------------------------------------------------------------------
- * Function: test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped
+ * Function:
+ *test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped
*
* Purpose: Test filling all direct blocks in root indirect block and all
* direct blocks in 2nd level indirect blocks, fill all direct
@@ -11625,96 +11676,101 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(
+ hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill first row of 3rd level indirect blocks in 4th level indirect block except last 3rd level block, fill direct blocks in 3rd level block, and skip row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill "
+ "first row of 3rd level indirect blocks in 4th level indirect block except last 3rd level block, "
+ "fill direct blocks in 3rd level block, and skip row of 2nd indirect blocks of 4th level indirect "
+ "block's 3rd level indirect block, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in 4th level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks in 4th level indirect block */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first row (except one) of 3rd level indirect blocks in 4th level indirect block */
- for(u = 0; u < cparam->managed.width - 1; u++) {
+ for (u = 0; u < cparam->managed.width - 1; u++) {
/* Fill all direct block rows in 3rd level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Fill row of 2nd level indirect blocks in 3rd level indirect block */
- if(fill_2nd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_2nd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in 4th level indirect block's last 3rd level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -11723,50 +11779,49 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_star
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in (4th level indirect block's first 3rd level
* block's) 2nd level indirect block's direct blocks (and rows of next 4th
* level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in 4th level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -11777,23 +11832,25 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_star
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped() */
-
/*-------------------------------------------------------------------------
- * Function: test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped
+ * Function:
+ *test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped
*
* Purpose: Test filling all direct blocks in root indirect block and all
* direct blocks in 2nd level indirect blocks, fill all direct
@@ -11819,132 +11876,138 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
+test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(
+ hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill first row of 4th level indirect blocks, except last one, fill first row of 3rd level indirect blocks in last 4th level indirect block except last 3rd level block, fill direct blocks in 3rd level block, and skip row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill "
+ "first row of 4th level indirect blocks, except last one, fill first row of 3rd level indirect "
+ "blocks in last 4th level indirect block except last 3rd level block, fill direct blocks in 3rd "
+ "level block, and skip row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect "
+ "block, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 3rd level indirect blocks */
- if(fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_3rd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill first row (except one) of 4th level indirect blocks */
- for(u = 0; u < cparam->managed.width - 1; u++) {
+ for (u = 0; u < cparam->managed.width - 1; u++) {
/* Fill all direct block rows in 4th level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks in 4th level indirect block */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Fill row of 3rd level indirect blocks in 4th level indirect block */
- if(fill_3rd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_3rd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in 4th level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks in 4th level indirect block */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill row (except one) of 3rd level indirect blocks in 4th level indirect block */
- for(u = 0; u < cparam->managed.width - 1; u++) {
+ for (u = 0; u < cparam->managed.width - 1; u++) {
/* Fill all direct block rows in 3rd level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Fill row of 2nd level indirect blocks in 3rd level indirect block */
- if(fill_2nd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
+ if (fill_2nd_indirect_row(fh, 1, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all direct block rows in 4th level indirect block's last 3rd level indirect block */
- if(fill_all_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_all_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
- /* Account for root indirect block doubling # of rows again */
- /* (From 16 rows to the max. # of rows: 22) */
- /* (Note: this is tied to the particular doubling table/heap creation parameters) */
- {
- unsigned max_root_rows; /* Maximum # of rows in root indirect block */
- unsigned row; /* Row in heap */
+ /* Account for root indirect block doubling # of rows again */
+ /* (From 16 rows to the max. # of rows: 22) */
+ /* (Note: this is tied to the particular doubling table/heap creation parameters) */
+ {
+ unsigned max_root_rows; /* Maximum # of rows in root indirect block */
+ unsigned row; /* Row in heap */
- /* Get some information for the heap */
- max_root_rows = HEAP_MAX_ROOT_ROWS(fh);
+ /* Get some information for the heap */
+ max_root_rows = HEAP_MAX_ROOT_ROWS(fh);
- /* Increase heap size & free space */
- for(row = 16; row < max_root_rows; row++) {
- state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
- state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
- } /* end for */
- } /* end if */
+ /* Increase heap size & free space */
+ for (row = 16; row < max_root_rows; row++) {
+ state.man_size += cparam->managed.width * DBLOCK_SIZE(fh, row);
+ state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, row);
+ } /* end for */
+ } /* end if */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert large object, to force creation of indirect block and
@@ -11953,50 +12016,49 @@ test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows) - obj_size;
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill rows skipped over in (4th level indirect block's first 3rd level
* block's) 2nd level indirect block's direct blocks (and rows of next 4th
* level indirect block's direct blocks)
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
/* Direct block rows in 2nd level indirect blocks */
- for(v = 0; v < cparam->managed.width; v++)
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
/* Direct block row in 4th level indirect block */
- if(fill_row(fh, u, fill_size, &state, &keep_ids))
+ if (fill_row(fh, u, fill_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Add one more object, to create another "large" block */
obj_size = SMALL_OBJ_SIZE1;
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -12007,20 +12069,22 @@ test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
-} /* test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped() */
-
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
+} /* test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped()
+ */
/*-------------------------------------------------------------------------
* Function: test_man_frag_simple
@@ -12044,92 +12108,90 @@ error:
static unsigned
test_man_frag_simple(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variables */
/* Test description */
const char *base_desc = "fragmenting small blocks, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Insert objects small enough to fit into initial blocks, but not to
* share them with other objects of the same size, until the next larger
* block size is reached.
*/
- obj_size = (size_t)DBLOCK_SIZE(fh, 0) / 2;
- state.man_size = DBLOCK_SIZE(fh, 0);
+ obj_size = (size_t)DBLOCK_SIZE(fh, 0) / 2;
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
- for(u = 0; u < cparam->managed.width; u++) {
+ for (u = 0; u < cparam->managed.width; u++) {
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
- if(u == 0) {
+ if (u == 0) {
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
} /* end if */
- } /* end for */
+ } /* end for */
state.man_size += DBLOCK_SIZE(fh, 1) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, 1) * cparam->managed.width;
- for(u = 0; u < cparam->managed.width; u++) {
+ for (u = 0; u < cparam->managed.width; u++) {
state.man_alloc_size += DBLOCK_SIZE(fh, 1);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* (Account for doubling root indirect block for rows 3-4 */
- for(u = 0; u < 2; u++) {
+ for (u = 0; u < 2; u++) {
state.man_size += DBLOCK_SIZE(fh, u + 2) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u + 2) * cparam->managed.width;
} /* end for */
/* Add one more object, to create a 2 * start_block_size block */
state.man_alloc_size += DBLOCK_SIZE(fh, 2);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Go back and fill in direct blocks of initial block size (which have large free space in them) */
obj_size = (size_t)DBLOCK_FREE(fh, 0) - obj_size;
- for(u = 0; u < cparam->managed.width; u++)
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ for (u = 0; u < cparam->managed.width; u++)
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
- for(u = 0; u < cparam->managed.width; u++)
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ for (u = 0; u < cparam->managed.width; u++)
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill in 2 * start_block_size block */
obj_size = (size_t)DBLOCK_FREE(fh, 2) - ((size_t)DBLOCK_SIZE(fh, 0) / 2);
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -12140,21 +12202,22 @@ test_man_frag_simple(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_frag_simple() */
-
/*-------------------------------------------------------------------------
* Function: test_man_frag_direct
*
@@ -12176,130 +12239,128 @@ error:
static unsigned
test_man_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned root_direct_rows; /* Number of rows in root indirect block */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned root_direct_rows; /* Number of rows in root indirect block */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
const char *base_desc = "fragmenting direct blocks, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Retrieve # of direct rows in root indirect block */
root_direct_rows = H5HF_get_dtable_max_drows_test(fh);
/* Insert objects small enough to fit into each direct block, but not to
* share them with other objects of the same size.
*/
- obj_size = (size_t)DBLOCK_SIZE(fh, 0) / 2;
- state.man_size = DBLOCK_SIZE(fh, 0);
+ obj_size = (size_t)DBLOCK_SIZE(fh, 0) / 2;
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0);
/* First row */
- for(u = 0; u < cparam->managed.width; u++) {
+ for (u = 0; u < cparam->managed.width; u++) {
state.man_alloc_size += DBLOCK_SIZE(fh, 0);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
- if(u == 0) {
+ if (u == 0) {
state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 0);
} /* end if */
- } /* end for */
+ } /* end for */
state.man_size += DBLOCK_SIZE(fh, 1) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, 1) * cparam->managed.width;
/* Second row */
- for(u = 0; u < cparam->managed.width; u++) {
+ for (u = 0; u < cparam->managed.width; u++) {
state.man_alloc_size += DBLOCK_SIZE(fh, 1);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* (Account for doubling root indirect block for rows 3-4 */
- for(u = 0; u < 2; u++) {
+ for (u = 0; u < 2; u++) {
state.man_size += DBLOCK_SIZE(fh, u + 2) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u + 2) * cparam->managed.width;
} /* end for */
/* Rows 3-4 */
- for(u = 0; u < 2; u++) {
+ for (u = 0; u < 2; u++) {
obj_size = (size_t)DBLOCK_SIZE(fh, u + 2) / 2;
- for(v = 0; v < cparam->managed.width; v++) {
+ for (v = 0; v < cparam->managed.width; v++) {
state.man_alloc_size += DBLOCK_SIZE(fh, u + 2);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
- } /* end for */
+ } /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* (Account for doubling root indirect block for rows 5-8 */
- for(u = 0; u < 4; u++) {
+ for (u = 0; u < 4; u++) {
state.man_size += DBLOCK_SIZE(fh, u + 4) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u + 4) * cparam->managed.width;
} /* end for */
/* Rows 5-8 */
- for(u = 0; u < 4; u++) {
+ for (u = 0; u < 4; u++) {
obj_size = (size_t)DBLOCK_SIZE(fh, u + 4) / 2;
- for(v = 0; v < cparam->managed.width; v++) {
+ for (v = 0; v < cparam->managed.width; v++) {
state.man_alloc_size += DBLOCK_SIZE(fh, u + 4);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
- } /* end for */
+ } /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* (Account for doubling root indirect block for rows 9-16 */
- for(u = 0; u < 8; u++) {
+ for (u = 0; u < 8; u++) {
state.man_size += DBLOCK_SIZE(fh, u + 8) * cparam->managed.width;
state.man_free_space += DBLOCK_FREE(fh, u + 8) * cparam->managed.width;
} /* end for */
/* Row 9 (last direct block row) */
obj_size = (size_t)DBLOCK_SIZE(fh, 8) / 2;
- for(v = 0; v < cparam->managed.width; v++) {
+ for (v = 0; v < cparam->managed.width; v++) {
state.man_alloc_size += DBLOCK_SIZE(fh, 8);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Go back and backfill all root block's direct blocks */
- for(u = 0; u < root_direct_rows; u++) {
+ for (u = 0; u < root_direct_rows; u++) {
obj_size = (size_t)DBLOCK_FREE(fh, u) - ((size_t)DBLOCK_SIZE(fh, u) / 2);
- for(v = 0; v < cparam->managed.width; v++)
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -12310,21 +12371,22 @@ test_man_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_frag_direct() */
-
/*-------------------------------------------------------------------------
* Function: test_man_frag_2nd_direct
*
@@ -12348,68 +12410,68 @@ error:
static unsigned
test_man_frag_2nd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned
+ num_first_indirect_rows; /* Number of rows (of direct blocks) in each of the first indirect blocks */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "fill root direct blocks, then fragment 2nd level indirect block's direct blocks, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "fill root direct blocks, then fragment 2nd level indirect block's direct "
+ "blocks, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Compute # of bits used in first row */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert objects small enough to fit into each direct block, but not to
* share them with other objects of the same size.
*/
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
obj_size = (size_t)DBLOCK_SIZE(fh, u) / 2;
- for(v = 0; v < cparam->managed.width; v++) {
+ for (v = 0; v < cparam->managed.width; v++) {
state.man_alloc_size += DBLOCK_SIZE(fh, u);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
- } /* end for */
+ } /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Go back and backfill all 2nd level indirect block's direct blocks */
- for(u = 0; u < num_first_indirect_rows; u++) {
+ for (u = 0; u < num_first_indirect_rows; u++) {
obj_size = (size_t)DBLOCK_FREE(fh, u) - ((size_t)DBLOCK_SIZE(fh, u) / 2);
- for(v = 0; v < cparam->managed.width; v++)
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -12420,21 +12482,22 @@ test_man_frag_2nd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_frag_2nd_direct() */
-
/*-------------------------------------------------------------------------
* Function: test_man_frag_3rd_direct
*
@@ -12459,76 +12522,76 @@ error:
static unsigned
test_man_frag_3rd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned root_direct_rows; /* Number of rows in root indirect block */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t fill_size; /* Size of objects for "bulk" filled blocks */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u, v; /* Local index variables */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned root_direct_rows; /* Number of rows in root indirect block */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t fill_size; /* Size of objects for "bulk" filled blocks */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "fill root direct blocks and 2nd level indirect blocks, then fragment 3rd level indirect block's direct blocks, then backfill and extend, then remove all objects %s";
+ const char *base_desc =
+ "fill root direct blocks and 2nd level indirect blocks, then fragment 3rd level indirect block's "
+ "direct blocks, then backfill and extend, then remove all objects %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
-
/* Compute # of direct rows in root indirect block */
root_direct_rows = DTABLE_MAX_DROWS(fh);
/* Fill direct blocks in root indirect block */
- if(fill_root_direct(fh, fill_size, &state, &keep_ids))
+ if (fill_root_direct(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Fill all rows of 2nd level indirect blocks in root indirect block */
- if(fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
+ if (fill_all_2nd_indirect_rows(fh, fill_size, &state, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert objects small enough to fit into each direct block, but not to
* share them with other objects of the same size.
*/
- for(u = 0; u < root_direct_rows; u++) {
+ for (u = 0; u < root_direct_rows; u++) {
obj_size = (size_t)DBLOCK_SIZE(fh, u) / 2;
- for(v = 0; v < cparam->managed.width; v++) {
+ for (v = 0; v < cparam->managed.width; v++) {
state.man_alloc_size += DBLOCK_SIZE(fh, u);
- if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
+ if (add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
- } /* end for */
+ } /* end for */
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Go back and backfill all 3rd level indirect block's direct blocks */
- for(u = 0; u < root_direct_rows; u++) {
+ for (u = 0; u < root_direct_rows; u++) {
obj_size = (size_t)DBLOCK_FREE(fh, u) - ((size_t)DBLOCK_SIZE(fh, u) / 2);
- for(v = 0; v < cparam->managed.width; v++)
- if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
+ for (v = 0; v < cparam->managed.width; v++)
+ if (add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
} /* end for */
-
/* Perform common file & heap close operations */
- if(close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
+ if (close_heap(filename, fapl, tparam, file, f, &fh, fh_addr, &state, &keep_ids, empty_size) < 0)
TEST_ERROR
/* Free resources */
@@ -12539,21 +12602,22 @@ test_man_frag_3rd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_man_frag_3rd_direct() */
-
/*-------------------------------------------------------------------------
* Function: test_huge_insert_one
*
@@ -12572,111 +12636,110 @@ error:
static unsigned
test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- unsigned char *heap_id = NULL; /* Heap ID for object */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ unsigned char * heap_id = NULL; /* Heap ID for object */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "insert one huge object, then remove %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Allocate heap ID(s) */
- if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
/* Make certain that 'huge' object's heap IDs are correct size */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != tparam->actual_id_len)
+ if (id_len != tparam->actual_id_len)
TEST_ERROR
/* Insert object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size = obj_size;
+ state.huge_size = obj_size;
state.huge_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in huge object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
/* Remove object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size = 0;
+ state.huge_size = 0;
state.huge_nobjs = 0;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
-
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Free resources */
@@ -12688,22 +12751,23 @@ test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(heap_id);
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_huge_insert_one() */
-
/*-------------------------------------------------------------------------
* Function: test_huge_insert_two
*
@@ -12722,189 +12786,188 @@ error:
static unsigned
test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- unsigned char *heap_id = NULL; /* Heap ID for first object */
- unsigned char *heap_id2 = NULL; /* Heap ID for second object */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ unsigned char * heap_id = NULL; /* Heap ID for first object */
+ unsigned char * heap_id2 = NULL; /* Heap ID for second object */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "insert two huge objects, then remove %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Allocate heap ID(s) */
- if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
/* Make certain that 'huge' object's heap IDs are correct size */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != tparam->actual_id_len)
+ if (id_len != tparam->actual_id_len)
TEST_ERROR
/* Insert object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size = obj_size;
+ state.huge_size = obj_size;
state.huge_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in huge object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert second object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size += obj_size ;
+ state.huge_size += obj_size;
state.huge_nobjs = 2;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in second huge object */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id2, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id2, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
- if(tparam->del_dir == FHEAP_DEL_FORWARD) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_FORWARD) {
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size = obj_size;
+ state.huge_size = obj_size;
state.huge_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove second object from heap */
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size = 0;
+ state.huge_size = 0;
state.huge_nobjs = 0;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
else {
/* Remove second object from heap */
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size = obj_size;
+ state.huge_size = obj_size;
state.huge_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size = 0;
+ state.huge_size = 0;
state.huge_nobjs = 0;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end else */
- } /* end if */
-
+ } /* end if */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Free resources */
@@ -12917,23 +12980,24 @@ test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(heap_id);
H5MM_xfree(heap_id2);
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_huge_insert_two() */
-
/*-------------------------------------------------------------------------
* Function: test_huge_insert_three
*
@@ -12952,262 +13016,261 @@ error:
static unsigned
test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- unsigned char *heap_id = NULL; /* Heap ID for first object */
- unsigned char *heap_id2 = NULL; /* Heap ID for second object */
- unsigned char *heap_id3 = NULL; /* Heap ID for third object */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ unsigned char * heap_id = NULL; /* Heap ID for first object */
+ unsigned char * heap_id2 = NULL; /* Heap ID for second object */
+ unsigned char * heap_id3 = NULL; /* Heap ID for third object */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "insert three huge objects, then remove %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Allocate heap ID(s) */
- if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id3 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id3 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
/* Make certain that 'huge' object's heap IDs are correct size */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != tparam->actual_id_len)
+ if (id_len != tparam->actual_id_len)
TEST_ERROR
/* Insert first object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size = obj_size;
+ state.huge_size = obj_size;
state.huge_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in first huge object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert second object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size += obj_size;
state.huge_nobjs = 2;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in second huge object */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id2, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id2, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert third object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 3;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id3) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id3) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id3, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id3, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size += obj_size;
state.huge_nobjs = 3;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in third huge object */
- if(H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id3, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id3, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
- if(tparam->del_dir == FHEAP_DEL_FORWARD) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_FORWARD) {
/* Remove first object from heap */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove second object from heap */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove third object from heap */
- if(H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id3) < 0)
+ if (H5HF_remove(fh, heap_id3) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
else {
/* Remove third object from heap */
- if(H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id3) < 0)
+ if (H5HF_remove(fh, heap_id3) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove second object from heap */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove first object from heap */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end else */
- } /* end if */
-
+ } /* end if */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Free resources */
@@ -13221,24 +13284,25 @@ test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(heap_id);
H5MM_xfree(heap_id2);
H5MM_xfree(heap_id3);
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_huge_insert_three() */
-
/*-------------------------------------------------------------------------
* Function: test_huge_insert_mix
*
@@ -13257,154 +13321,154 @@ error:
static unsigned
test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- unsigned char *heap_id = NULL; /* Heap ID for first object */
- unsigned char *heap_id2 = NULL; /* Heap ID for second object */
- unsigned char *heap_id3 = NULL; /* Heap ID for third object */
- unsigned char *heap_id4 = NULL; /* Heap ID for fourth object */
- unsigned char *heap_id5 = NULL; /* Heap ID for fifth object */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ unsigned char * heap_id = NULL; /* Heap ID for first object */
+ unsigned char * heap_id2 = NULL; /* Heap ID for second object */
+ unsigned char * heap_id3 = NULL; /* Heap ID for third object */
+ unsigned char * heap_id4 = NULL; /* Heap ID for fourth object */
+ unsigned char * heap_id5 = NULL; /* Heap ID for fifth object */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "insert mix of normal & huge objects, then remove %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Allocate heap ID(s) */
- if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id3 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id3 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id4 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id4 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id5 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id5 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
/* Make certain that 'huge' object's heap IDs are correct size */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != tparam->actual_id_len)
+ if (id_len != tparam->actual_id_len)
TEST_ERROR
/* Insert first object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size += obj_size;
state.huge_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in first huge object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert second object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size += obj_size;
state.huge_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in second huge object */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id2, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id2, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert third object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 3;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id3) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id3) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id3, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id3, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size += obj_size;
state.huge_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in third huge object */
- if(H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id3, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id3, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert fourth object small enough to fit into 'normal' heap blocks */
obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id4) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id4) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id4, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id4, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_MAN)
+ if (obj_type != H5HF_ID_TYPE_MAN)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
@@ -13417,31 +13481,31 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
state.man_free_space += DBLOCK_FREE(fh, 2) - obj_size;
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 2);
state.man_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in fourth ('normal') object */
- if(H5HF_get_obj_len(fh, heap_id4, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id4, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id4, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id4, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert fifth object small enough to fit into 'normal' heap blocks */
obj_size = (size_t)DBLOCK_SIZE(fh, 3) + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id5) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id5) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id5, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id5, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_MAN)
+ if (obj_type != H5HF_ID_TYPE_MAN)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
@@ -13455,180 +13519,179 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 4);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 5);
state.man_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in fifth ('normal') object */
- if(H5HF_get_obj_len(fh, heap_id5, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id5, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id5, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id5, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
- if(tparam->del_dir == FHEAP_DEL_FORWARD) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_FORWARD) {
/* Remove first object from heap */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove second object from heap */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove third object from heap */
- if(H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id3) < 0)
+ if (H5HF_remove(fh, heap_id3) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove fourth ('normal') object from heap */
- if(H5HF_remove(fh, heap_id4) < 0)
+ if (H5HF_remove(fh, heap_id4) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Remove fifth ('normal') object from heap */
- if(H5HF_remove(fh, heap_id5) < 0)
+ if (H5HF_remove(fh, heap_id5) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
} /* end if */
else {
/* Remove fifth ('normal') object from heap */
- if(H5HF_remove(fh, heap_id5) < 0)
+ if (H5HF_remove(fh, heap_id5) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Remove fourth ('normal') object from heap */
- if(H5HF_remove(fh, heap_id4) < 0)
+ if (H5HF_remove(fh, heap_id4) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Reset 'managed' object statistics after they are all removed */
- state.man_nobjs = 0;
- state.man_size = 0;
+ state.man_nobjs = 0;
+ state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
/* Remove third object from heap */
- if(H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id3) < 0)
+ if (H5HF_remove(fh, heap_id3) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove second object from heap */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
} /* end else */
/* Check up on heap... */
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
-
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Free resources */
@@ -13644,10 +13707,11 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(heap_id);
H5MM_xfree(heap_id2);
H5MM_xfree(heap_id3);
@@ -13656,14 +13720,14 @@ error:
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_huge_insert_mix() */
-
/*-------------------------------------------------------------------------
* Function: test_filtered_huge
*
@@ -13680,25 +13744,25 @@ error:
static unsigned
test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- H5HF_create_t tmp_cparam; /* Local heap creation parameters */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- unsigned char *heap_id = NULL; /* Heap ID for object */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned deflate_level; /* Deflation level */
- size_t old_actual_id_len = 0; /* Old actual ID length */
- hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */
- hbool_t pline_init = FALSE; /* Whether the I/O pipeline has been initialized */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ H5HF_create_t tmp_cparam; /* Local heap creation parameters */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ unsigned char * heap_id = NULL; /* Heap ID for object */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned deflate_level; /* Deflation level */
+ size_t old_actual_id_len = 0; /* Old actual ID length */
+ hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */
+ hbool_t pline_init = FALSE; /* Whether the I/O pipeline has been initialized */
/* Test description */
const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove %s";
@@ -13707,80 +13771,79 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam
/* Set an I/O filter for heap data */
deflate_level = 6;
- if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
+ if (H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
FAIL_STACK_ERROR
pline_init = TRUE;
/* Adjust actual ID length, if asking for IDs that can directly access 'huge' objects */
- if(cparam->id_len == 1) {
- old_actual_id_len = tparam->actual_id_len;
- tparam->actual_id_len = 29; /* 1 + 8 (file address size) + 8 (file length size) + 4 (filter mask length) + 8 (object length size) */
- } /* end if */
+ if (cparam->id_len == 1) {
+ old_actual_id_len = tparam->actual_id_len;
+ tparam->actual_id_len = 29; /* 1 + 8 (file address size) + 8 (file length size) + 4 (filter mask
+ length) + 8 (object length size) */
+ } /* end if */
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
-
/* Allocate heap ID(s) */
- if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
/* Make certain that 'huge' object's heap IDs are correct form */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != tparam->actual_id_len)
+ if (id_len != tparam->actual_id_len)
TEST_ERROR
- if(H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
+ if (H5HF_get_huge_info_test(fh, NULL, &huge_ids_direct) < 0)
FAIL_STACK_ERROR
- if(cparam->id_len == 1) {
- if(huge_ids_direct != TRUE)
+ if (cparam->id_len == 1) {
+ if (huge_ids_direct != TRUE)
TEST_ERROR
} /* end if */
- else
- if(tparam->actual_id_len >= 29) {
- if(huge_ids_direct != TRUE)
- TEST_ERROR
- } /* end if */
- else {
- if(huge_ids_direct != FALSE)
- TEST_ERROR
- } /* end else */
+ else if (tparam->actual_id_len >= 29) {
+ if (huge_ids_direct != TRUE)
+ TEST_ERROR
+ } /* end if */
+ else {
+ if (huge_ids_direct != FALSE)
+ TEST_ERROR
+ } /* end else */
/* Insert object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* QAK */
#ifdef QAK
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -13788,71 +13851,71 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam
STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
#endif /* QAK */
-/* QAK */
+ /* QAK */
/* Check up on heap... */
- state.huge_size = obj_size;
+ state.huge_size = obj_size;
state.huge_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in huge object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
/* Remove object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.huge_size = 0;
+ state.huge_size = 0;
state.huge_nobjs = 0;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Reset actual ID length, if asking for IDs that can directly access 'huge' objects */
- if(cparam->id_len == 1)
+ if (cparam->id_len == 1)
tparam->actual_id_len = old_actual_id_len;
/* Free resources */
@@ -13862,21 +13925,22 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(heap_id);
- if(fh)
+ if (fh)
H5HF_close(fh);
- if(pline_init)
+ if (pline_init)
H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_filtered_huge() */
-
/*-------------------------------------------------------------------------
* Function: test_tiny_insert_one
*
@@ -13895,111 +13959,110 @@ error:
static unsigned
test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- unsigned char *heap_id = NULL; /* Heap ID for object */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ unsigned char * heap_id = NULL; /* Heap ID for object */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "insert one tiny object, then remove %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Allocate heap ID(s) */
- if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
/* Make certain that 'tiny' object's heap IDs are correct size */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != tparam->actual_id_len)
+ if (id_len != tparam->actual_id_len)
TEST_ERROR
/* Insert object small enough to encode in heap ID */
obj_size = tparam->actual_id_len - 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_TINY)
+ if (obj_type != H5HF_ID_TYPE_TINY)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.tiny_size = obj_size;
+ state.tiny_size = obj_size;
state.tiny_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in tiny object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
/* Remove object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.tiny_size = 0;
+ state.tiny_size = 0;
state.tiny_nobjs = 0;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
-
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Free resources */
@@ -14011,22 +14074,23 @@ test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(heap_id);
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_tiny_insert_one() */
-
/*-------------------------------------------------------------------------
* Function: test_tiny_insert_two
*
@@ -14045,189 +14109,188 @@ error:
static unsigned
test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- unsigned char *heap_id = NULL; /* Heap ID for first object */
- unsigned char *heap_id2 = NULL; /* Heap ID for second object */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ unsigned char * heap_id = NULL; /* Heap ID for first object */
+ unsigned char * heap_id2 = NULL; /* Heap ID for second object */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "insert two tiny objects, then remove %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Allocate heap ID(s) */
- if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
/* Make certain that 'tiny' object's heap IDs are correct size */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != tparam->actual_id_len)
+ if (id_len != tparam->actual_id_len)
TEST_ERROR
/* Insert object small enough to encode in heap ID */
obj_size = tparam->actual_id_len - 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_TINY)
+ if (obj_type != H5HF_ID_TYPE_TINY)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.tiny_size = obj_size;
+ state.tiny_size = obj_size;
state.tiny_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in tiny object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert second object small enough to encode in heap ID */
obj_size = tparam->actual_id_len - 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_TINY)
+ if (obj_type != H5HF_ID_TYPE_TINY)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.tiny_size += obj_size ;
+ state.tiny_size += obj_size;
state.tiny_nobjs = 2;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in second tiny object */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id2, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id2, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
- if(tparam->del_dir == FHEAP_DEL_FORWARD) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_FORWARD) {
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.tiny_size = obj_size;
+ state.tiny_size = obj_size;
state.tiny_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove second object from heap */
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.tiny_size = 0;
+ state.tiny_size = 0;
state.tiny_nobjs = 0;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
else {
/* Remove second object from heap */
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.tiny_size = obj_size;
+ state.tiny_size = obj_size;
state.tiny_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.tiny_size = 0;
+ state.tiny_size = 0;
state.tiny_nobjs = 0;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end else */
- } /* end if */
-
+ } /* end if */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Free resources */
@@ -14240,23 +14303,24 @@ test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(heap_id);
H5MM_xfree(heap_id2);
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_tiny_insert_two() */
-
/*-------------------------------------------------------------------------
* Function: test_tiny_insert_mix
*
@@ -14276,181 +14340,181 @@ error:
static unsigned
test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- size_t id_len; /* Size of fractal heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- unsigned char *heap_id = NULL; /* Heap ID for first object */
- unsigned char *heap_id2 = NULL; /* Heap ID for second object */
- unsigned char *heap_id3 = NULL; /* Heap ID for third object */
- unsigned char *heap_id4 = NULL; /* Heap ID for fourth object */
- unsigned char *heap_id5 = NULL; /* Heap ID for fifth object */
- unsigned char *heap_id6 = NULL; /* Heap ID for sixth object */
- unsigned char *heap_id7 = NULL; /* Heap ID for seventh object */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ size_t id_len; /* Size of fractal heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ unsigned char * heap_id = NULL; /* Heap ID for first object */
+ unsigned char * heap_id2 = NULL; /* Heap ID for second object */
+ unsigned char * heap_id3 = NULL; /* Heap ID for third object */
+ unsigned char * heap_id4 = NULL; /* Heap ID for fourth object */
+ unsigned char * heap_id5 = NULL; /* Heap ID for fifth object */
+ unsigned char * heap_id6 = NULL; /* Heap ID for sixth object */
+ unsigned char * heap_id7 = NULL; /* Heap ID for seventh object */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "insert mix of normal, huge & tiny objects, then remove %s";
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Allocate heap ID(s) */
- if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id3 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id3 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id4 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id4 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id5 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id5 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id6 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id6 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
- if(NULL == (heap_id7 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
+ if (NULL == (heap_id7 = (unsigned char *)H5MM_malloc(tparam->actual_id_len)))
TEST_ERROR
/* Make certain that 'tiny' object's heap IDs are correct size */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len != tparam->actual_id_len)
+ if (id_len != tparam->actual_id_len)
TEST_ERROR
/* Insert first object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size += obj_size;
state.huge_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in first huge object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Check 'op' functionality on first huge object */
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_op(fh, heap_id, op_memcpy, shared_robj_g) < 0)
+ if (H5HF_op(fh, heap_id, op_memcpy, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert second object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size += obj_size;
state.huge_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in second huge object */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id2, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id2, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Check 'op' functionality on second huge object */
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_op(fh, heap_id2, op_memcpy, shared_robj_g) < 0)
+ if (H5HF_op(fh, heap_id2, op_memcpy, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert third object too large for managed heap blocks */
obj_size = SMALL_STAND_SIZE + 3;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id3) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id3) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id3, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id3, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_HUGE)
+ if (obj_type != H5HF_ID_TYPE_HUGE)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size += obj_size;
state.huge_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in third huge object */
- if(H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id3, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id3, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Check 'op' functionality on third huge object */
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_op(fh, heap_id3, op_memcpy, shared_robj_g) < 0)
+ if (H5HF_op(fh, heap_id3, op_memcpy, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert fourth object small enough to fit into 'normal' heap blocks */
obj_size = (size_t)DBLOCK_SIZE(fh, 0) + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id4) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id4) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id4, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id4, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_MAN)
+ if (obj_type != H5HF_ID_TYPE_MAN)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
@@ -14463,38 +14527,38 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
state.man_free_space += DBLOCK_FREE(fh, 2) - obj_size;
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 2);
state.man_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in fourth ('normal') object */
- if(H5HF_get_obj_len(fh, heap_id4, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id4, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id4, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id4, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Check 'op' functionality on fourth ('normal') object */
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_op(fh, heap_id4, op_memcpy, shared_robj_g) < 0)
+ if (H5HF_op(fh, heap_id4, op_memcpy, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert fifth object small enough to fit into 'normal' heap blocks */
obj_size = (size_t)DBLOCK_SIZE(fh, 3) + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id5) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id5) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id5, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id5, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_MAN)
+ if (obj_type != H5HF_ID_TYPE_MAN)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
@@ -14508,324 +14572,322 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
state.man_free_space += (cparam->managed.width - 1) * DBLOCK_FREE(fh, 4);
state.man_free_space += cparam->managed.width * DBLOCK_FREE(fh, 5);
state.man_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in fifth ('normal') object */
- if(H5HF_get_obj_len(fh, heap_id5, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id5, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id5, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id5, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Check 'op' functionality on fifth ('normal') object */
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_op(fh, heap_id5, op_memcpy, shared_robj_g) < 0)
+ if (H5HF_op(fh, heap_id5, op_memcpy, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
-
/* Insert sixth object small enough to encode in heap ID */
obj_size = tparam->actual_id_len - 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id6) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id6) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id6, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id6, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_TINY)
+ if (obj_type != H5HF_ID_TYPE_TINY)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
- state.tiny_size = obj_size;
+ state.tiny_size = obj_size;
state.tiny_nobjs = 1;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in tiny object */
- if(H5HF_get_obj_len(fh, heap_id6, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id6, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id6, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id6, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Check 'op' functionality on sixth ('tiny') object */
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_op(fh, heap_id6, op_memcpy, shared_robj_g) < 0)
+ if (H5HF_op(fh, heap_id6, op_memcpy, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Insert seventh object small enough to encode in heap ID */
obj_size = tparam->actual_id_len - 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id7) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id7) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id7, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id7, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_TINY)
+ if (obj_type != H5HF_ID_TYPE_TINY)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.tiny_size += obj_size;
state.tiny_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in tiny object */
- if(H5HF_get_obj_len(fh, heap_id7, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id7, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id7, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id7, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Check 'op' functionality on seventh ('tiny') object */
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_op(fh, heap_id7, op_memcpy, shared_robj_g) < 0)
+ if (H5HF_op(fh, heap_id7, op_memcpy, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
- if(tparam->del_dir == FHEAP_DEL_FORWARD) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_FORWARD) {
/* Remove first object from heap */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove second object from heap */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove third object from heap */
- if(H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id3) < 0)
+ if (H5HF_remove(fh, heap_id3) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove fourth ('normal') object from heap */
- if(H5HF_remove(fh, heap_id4) < 0)
+ if (H5HF_remove(fh, heap_id4) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Remove fifth ('normal') object from heap */
- if(H5HF_remove(fh, heap_id5) < 0)
+ if (H5HF_remove(fh, heap_id5) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Reset 'managed' object statistics after they are all removed */
- state.man_nobjs = 0;
- state.man_size = 0;
+ state.man_nobjs = 0;
+ state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
/* Remove sixth object from heap */
- if(H5HF_get_obj_len(fh, heap_id6, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id6, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id6) < 0)
+ if (H5HF_remove(fh, heap_id6) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.tiny_size -= robj_size;
state.tiny_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove seventh object from heap */
- if(H5HF_remove(fh, heap_id7) < 0)
+ if (H5HF_remove(fh, heap_id7) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
} /* end if */
else {
/* Remove seventh object from heap */
- if(H5HF_get_obj_len(fh, heap_id7, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id7, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id7) < 0)
+ if (H5HF_remove(fh, heap_id7) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.tiny_size -= robj_size;
state.tiny_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove sixth object from heap */
- if(H5HF_get_obj_len(fh, heap_id6, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id6, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id6) < 0)
+ if (H5HF_remove(fh, heap_id6) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.tiny_size -= robj_size;
state.tiny_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove fifth ('normal') object from heap */
- if(H5HF_remove(fh, heap_id5) < 0)
+ if (H5HF_remove(fh, heap_id5) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Remove fourth ('normal') object from heap */
- if(H5HF_remove(fh, heap_id4) < 0)
+ if (H5HF_remove(fh, heap_id4) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Reset 'managed' object statistics after they are all removed */
- state.man_nobjs = 0;
- state.man_size = 0;
+ state.man_nobjs = 0;
+ state.man_size = 0;
state.man_alloc_size = 0;
state.man_free_space = 0;
/* Remove third object from heap */
- if(H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id3, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id3) < 0)
+ if (H5HF_remove(fh, heap_id3) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove second object from heap */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
state.huge_size -= robj_size;
state.huge_nobjs--;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Remove first object from heap */
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
} /* end else */
/* Check up on heap... */
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
-
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Free resources */
@@ -14843,10 +14905,11 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(heap_id);
H5MM_xfree(heap_id2);
H5MM_xfree(heap_id3);
@@ -14857,14 +14920,14 @@ error:
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_tiny_insert_mix() */
-
/*-------------------------------------------------------------------------
* Function: test_filtered_man_root_direct
*
@@ -14881,23 +14944,23 @@ error:
static unsigned
test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- H5HF_create_t tmp_cparam; /* Local heap creation parameters */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ H5HF_create_t tmp_cparam; /* Local heap creation parameters */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
#ifdef NOT_YET
- h5_stat_size_t file_size; /* Size of file currently */
-#endif /* NOT_YET */
- unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned deflate_level; /* Deflation level */
+ h5_stat_size_t file_size; /* Size of file currently */
+#endif /* NOT_YET */
+ unsigned char heap_id[HEAP_ID_LEN]; /* Heap ID for object */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned deflate_level; /* Deflation level */
/* Test description */
const char *base_desc = "insert one 'managed' object into heap with I/O filters, then remove %s";
@@ -14906,46 +14969,45 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para
/* Set an I/O filter for heap data */
deflate_level = 6;
- if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
+ if (H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
FAIL_STACK_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
-
/* Insert object small enough to fit into direct heap block */
obj_size = (size_t)DBLOCK_SIZE(fh, 0) / 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_MAN)
+ if (obj_type != H5HF_ID_TYPE_MAN)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -14953,70 +15015,70 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Check up on heap... */
- state.man_size = DBLOCK_SIZE(fh, 0);
+ state.man_size = DBLOCK_SIZE(fh, 0);
state.man_alloc_size = DBLOCK_SIZE(fh, 0);
state.man_free_space = DBLOCK_FREE(fh, 0) - obj_size;
state.man_nobjs++;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in ('normal') object */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
/* Remove object from heap */
- if(H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id) < 0)
+ if (H5HF_remove(fh, heap_id) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Check up on heap... */
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Needs file free space to be persistent */
#ifdef NOT_YET
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
#endif /* NOT_YET */
@@ -15026,18 +15088,19 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_filtered_man_root_direct() */
-
/*-------------------------------------------------------------------------
* Function: test_filtered_man_root_indirect
*
@@ -15054,24 +15117,24 @@ error:
static unsigned
test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- H5HF_create_t tmp_cparam; /* Local heap creation parameters */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ H5HF_create_t tmp_cparam; /* Local heap creation parameters */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
#ifdef NOT_YET
- h5_stat_size_t file_size; /* Size of file currently */
-#endif /* NOT_YET */
- unsigned char heap_id1[HEAP_ID_LEN]; /* Heap ID for object #1 */
- unsigned char heap_id2[HEAP_ID_LEN]; /* Heap ID for object #2 */
- size_t obj_size; /* Size of object */
- size_t robj_size; /* Size of object read */
- unsigned char obj_type; /* Type of storage for object */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned deflate_level; /* Deflation level */
+ h5_stat_size_t file_size; /* Size of file currently */
+#endif /* NOT_YET */
+ unsigned char heap_id1[HEAP_ID_LEN]; /* Heap ID for object #1 */
+ unsigned char heap_id2[HEAP_ID_LEN]; /* Heap ID for object #2 */
+ size_t obj_size; /* Size of object */
+ size_t robj_size; /* Size of object read */
+ unsigned char obj_type; /* Type of storage for object */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned deflate_level; /* Deflation level */
/* Test description */
const char *base_desc = "insert two 'managed' objects into heap with I/O filters, then remove %s";
@@ -15080,55 +15143,54 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
/* Set an I/O filter for heap data */
deflate_level = 6;
- if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
+ if (H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
FAIL_STACK_ERROR
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Perform common test initialization operations */
- if(begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
+ if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
TEST_ERROR
-
/* Insert object #1, small enough to fit into direct heap block */
obj_size = (size_t)DBLOCK_SIZE(fh, 0) / 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id1) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id1) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id1, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id1, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_MAN)
+ if (obj_type != H5HF_ID_TYPE_MAN)
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Insert object #2, small enough to fit into direct heap block */
obj_size = (size_t)DBLOCK_SIZE(fh, 0) / 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, heap_id2) < 0)
FAIL_STACK_ERROR
- if(H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
+ if (H5HF_get_id_type_test(heap_id2, &obj_type) < 0)
FAIL_STACK_ERROR
- if(obj_type != H5HF_ID_TYPE_MAN)
+ if (obj_type != H5HF_ID_TYPE_MAN)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -15136,63 +15198,63 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Check up on heap... */
- state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
+ state.man_size = cparam->managed.width * DBLOCK_SIZE(fh, 0);
state.man_alloc_size = 2 * DBLOCK_SIZE(fh, 0);
state.man_free_space = (cparam->managed.width * DBLOCK_FREE(fh, 0)) - (obj_size * 2);
state.man_nobjs += 2;
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Read in ('normal') object #1 */
- if(H5HF_get_obj_len(fh, heap_id1, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id1, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id1, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id1, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Read in ('normal') object #2 */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(obj_size != robj_size)
+ if (obj_size != robj_size)
TEST_ERROR
HDmemset(shared_robj_g, 0, obj_size);
- if(H5HF_read(fh, heap_id2, shared_robj_g) < 0)
+ if (H5HF_read(fh, heap_id2, shared_robj_g) < 0)
FAIL_STACK_ERROR
- if(HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
+ if (HDmemcmp(shared_wobj_g, shared_robj_g, obj_size))
TEST_ERROR
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
- if(tparam->del_dir == FHEAP_DEL_FORWARD) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_FORWARD) {
/* Remove object #1 from heap */
- if(H5HF_get_obj_len(fh, heap_id1, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id1, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id1) < 0)
+ if (H5HF_remove(fh, heap_id1) < 0)
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -15200,35 +15262,35 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Remove object #2 from heap */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Check up on heap... */
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -15236,36 +15298,36 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Check up on heap... */
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
else {
/* Remove object #2 from heap */
- if(H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id2, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id2) < 0)
+ if (H5HF_remove(fh, heap_id2) < 0)
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -15273,35 +15335,35 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Remove object #1 from heap */
- if(H5HF_get_obj_len(fh, heap_id1, &robj_size) < 0)
+ if (H5HF_get_obj_len(fh, heap_id1, &robj_size) < 0)
FAIL_STACK_ERROR
- if(H5HF_remove(fh, heap_id1) < 0)
+ if (H5HF_remove(fh, heap_id1) < 0)
FAIL_STACK_ERROR
/* Check up on heap... */
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -15309,40 +15371,40 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Check up on heap... */
HDmemset(&state, 0, sizeof(fheap_heap_state_t));
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end else */
- } /* end if */
+ } /* end if */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Needs file free space to be persistent */
#ifdef NOT_YET
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
#endif /* NOT_YET */
@@ -15352,18 +15414,19 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- if(fh)
+ H5E_BEGIN_TRY
+ {
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_filtered_man_root_indirect() */
-
/*-------------------------------------------------------------------------
* Function: test_random
*
@@ -15384,22 +15447,22 @@ error:
static unsigned
test_random(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- H5HF_create_t tmp_cparam; /* Local heap creation parameters */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned long seed = 0; /* Random # seed */
- hsize_t total_obj_added; /* Size of objects added */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- size_t obj_size; /* Size of object */
- size_t obj_loc; /* Location of object in buffer */
- fheap_heap_state_t state; /* State of fractal heap */
- size_t u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ H5HF_create_t tmp_cparam; /* Local heap creation parameters */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned long seed = 0; /* Random # seed */
+ hsize_t total_obj_added; /* Size of objects added */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ size_t obj_size; /* Size of object */
+ size_t obj_loc; /* Location of object in buffer */
+ fheap_heap_state_t state; /* State of fractal heap */
+ size_t u; /* Local index variable */
/* Initialize the heap ID structure */
HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t));
@@ -15408,37 +15471,40 @@ test_random(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t));
/* Check if we are compressing the blocks */
- if(tparam->comp == FHEAP_TEST_COMPRESS) {
- unsigned deflate_level; /* Deflation level */
+ if (tparam->comp == FHEAP_TEST_COMPRESS) {
+ unsigned deflate_level; /* Deflation level */
/* Set an I/O filter for heap data */
deflate_level = 6;
- if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
+ if (H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) <
+ 0)
FAIL_STACK_ERROR
} /* end if */
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Get information about heap ID lengths */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > MAX_HEAP_ID_LEN)
+ if (id_len > MAX_HEAP_ID_LEN)
TEST_ERROR
/*
* Display testing message
*/
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
- if(tparam->comp == FHEAP_TEST_COMPRESS)
- TESTING("inserting random-sized objects in heap with compressed blocks, then remove all objects (all - deleting heap)")
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
+ TESTING("inserting random-sized objects in heap with compressed blocks, then remove all objects "
+ "(all - deleting heap)")
else
TESTING("inserting random-sized objects, then remove all objects (all - deleting heap)")
} /* end if */
else {
- if(tparam->comp == FHEAP_TEST_COMPRESS)
- TESTING("inserting random-sized objects in heap with compressed blocks, then remove all objects (all - random)")
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
+ TESTING("inserting random-sized objects in heap with compressed blocks, then remove all objects "
+ "(all - random)")
else
TESTING("inserting random-sized objects, then remove all objects (all - random)")
} /* end else */
@@ -15453,17 +15519,17 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
/* Loop over adding objects to the heap, until the size limit is reached */
total_obj_added = 0;
- while(total_obj_added < size_limit) {
+ while (total_obj_added < size_limit) {
/* Choose a random size of object (from 1 up to above standalone block size limit) */
obj_size = (((uint32_t)HDrandom() % (tmp_cparam.max_man_size + 255)) + 1);
- obj_loc = (tmp_cparam.max_man_size + 255) - obj_size;
+ obj_loc = (tmp_cparam.max_man_size + 255) - obj_size;
/* Insert object */
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Increment the amount of objects added */
@@ -15471,16 +15537,16 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
} /* end while */
/* Randomize the order of the IDs kept */
- for(u = 0; u < keep_ids.num_ids; u++) {
- size_t pos; /* Position to swap with */
+ for (u = 0; u < keep_ids.num_ids; u++) {
+ size_t pos; /* Position to swap with */
/* Choose a position to swap with */
/* (0 is current position) */
pos = ((size_t)HDrandom() % (keep_ids.num_ids - u));
/* If we chose a different position, swap with it */
- if(pos > 0) {
- unsigned char temp_id[MAX_HEAP_ID_LEN]; /* Temp. heap ID holder */
+ if (pos > 0) {
+ unsigned char temp_id[MAX_HEAP_ID_LEN]; /* Temp. heap ID holder */
/* Swap current position with future position */
/* (just swap the heap ID, the len & offset isn't used */
@@ -15488,52 +15554,52 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
HDmemcpy(&keep_ids.ids[u * id_len], &keep_ids.ids[(u + pos) * id_len], id_len);
HDmemcpy(&keep_ids.ids[(u + pos) * id_len], temp_id, id_len);
} /* end if */
- } /* end for */
+ } /* end for */
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
/* Delete objects inserted */
- for(u = 0; u < keep_ids.num_ids; u++) {
+ for (u = 0; u < keep_ids.num_ids; u++) {
/* Remove object from heap */
- if(H5HF_remove(fh, &keep_ids.ids[id_len * u]) < 0)
+ if (H5HF_remove(fh, &keep_ids.ids[id_len * u]) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
} /* end for */
/* Check up on heap... */
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Free resources */
- if(tparam->comp == FHEAP_TEST_COMPRESS)
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */
/* Free resources */
@@ -15544,25 +15610,26 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(tparam->comp == FHEAP_TEST_COMPRESS)
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */
- if(fh)
+ if (fh)
H5HF_close(fh);
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_random() */
-
/*-------------------------------------------------------------------------
* Function: test_random_pow2
*
@@ -15584,22 +15651,22 @@ error:
static unsigned
test_random_pow2(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- H5HF_create_t tmp_cparam; /* Local heap creation parameters */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- unsigned long seed = 0; /* Random # seed */
- hsize_t total_obj_added; /* Size of objects added */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- h5_stat_size_t file_size; /* Size of file currently */
- size_t obj_size; /* Size of object */
- size_t obj_loc; /* Location of object in buffer */
- fheap_heap_state_t state; /* State of fractal heap */
- size_t u; /* Local index variable */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ H5HF_create_t tmp_cparam; /* Local heap creation parameters */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ unsigned long seed = 0; /* Random # seed */
+ hsize_t total_obj_added; /* Size of objects added */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ h5_stat_size_t file_size; /* Size of file currently */
+ size_t obj_size; /* Size of object */
+ size_t obj_loc; /* Location of object in buffer */
+ fheap_heap_state_t state; /* State of fractal heap */
+ size_t u; /* Local index variable */
/* Initialize the heap ID structure */
HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t));
@@ -15608,39 +15675,44 @@ test_random_pow2(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_te
HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t));
/* Check if we are compressing the blocks */
- if(tparam->comp == FHEAP_TEST_COMPRESS) {
- unsigned deflate_level; /* Deflation level */
+ if (tparam->comp == FHEAP_TEST_COMPRESS) {
+ unsigned deflate_level; /* Deflation level */
/* Set an I/O filter for heap data */
deflate_level = 6;
- if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
+ if (H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) <
+ 0)
FAIL_STACK_ERROR
} /* end if */
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Get information about heap ID lengths */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > MAX_HEAP_ID_LEN)
+ if (id_len > MAX_HEAP_ID_LEN)
TEST_ERROR
/*
* Display testing message
*/
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
- if(tparam->comp == FHEAP_TEST_COMPRESS)
- TESTING("inserting random-sized objects with power of 2 distribution in heap with compressed blocks, then remove all objects (all - deleting heap)")
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
+ TESTING("inserting random-sized objects with power of 2 distribution in heap with compressed "
+ "blocks, then remove all objects (all - deleting heap)")
else
- TESTING("inserting random-sized objects with power of 2 distribution, then remove all objects (all - deleting heap)")
+ TESTING("inserting random-sized objects with power of 2 distribution, then remove all objects "
+ "(all - deleting heap)")
} /* end if */
else {
- if(tparam->comp == FHEAP_TEST_COMPRESS)
- TESTING("inserting random-sized objects with power of 2 distribution in heap with compressed blocks, then remove all objects (all - random)")
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
+ TESTING("inserting random-sized objects with power of 2 distribution in heap with compressed "
+ "blocks, then remove all objects (all - random)")
else
- TESTING("inserting random-sized objects with power of 2 distribution, then remove all objects (all - random)")
+ TESTING("inserting random-sized objects with power of 2 distribution, then remove all objects "
+ "(all - random)")
} /* end else */
/* Choose random # seed */
@@ -15653,29 +15725,29 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
/* Loop over adding objects to the heap, until the size limit is reached */
total_obj_added = 0;
- while(total_obj_added < size_limit) {
- size_t size_range = (tmp_cparam.managed.start_block_size / 8); /* Object size range */
+ while (total_obj_added < size_limit) {
+ size_t size_range = (tmp_cparam.managed.start_block_size / 8); /* Object size range */
/* Determine the size of the range for this object */
/* (50% of the objects inserted will use the initial size range,
* 25% of the objects will be twice as large, 12.5% will be
* four times larger, etc.)
*/
- while(HDrandom() < (RAND_MAX / 2) && size_range < tmp_cparam.max_man_size)
+ while (HDrandom() < (RAND_MAX / 2) && size_range < tmp_cparam.max_man_size)
size_range *= 2;
- if(size_range > (tmp_cparam.max_man_size + 255))
+ if (size_range > (tmp_cparam.max_man_size + 255))
size_range = tmp_cparam.max_man_size + 255;
/* Choose a random size of object (from 1 up to stand alone block size) */
obj_size = (((unsigned)HDrandom() % (size_range - 1)) + 1);
- obj_loc = (tmp_cparam.max_man_size + 255) - obj_size;
+ obj_loc = (tmp_cparam.max_man_size + 255) - obj_size;
/* Insert object */
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Increment the amount of objects added */
@@ -15683,16 +15755,16 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
} /* end while */
/* Randomize the order of the IDs kept */
- for(u = 0; u < keep_ids.num_ids; u++) {
- size_t pos; /* Position to swap with */
+ for (u = 0; u < keep_ids.num_ids; u++) {
+ size_t pos; /* Position to swap with */
/* Choose a position to swap with */
/* (0 is current position) */
pos = ((size_t)HDrandom() % (keep_ids.num_ids - u));
/* If we chose a different position, swap with it */
- if(pos > 0) {
- unsigned char temp_id[MAX_HEAP_ID_LEN]; /* Temp. heap ID holder */
+ if (pos > 0) {
+ unsigned char temp_id[MAX_HEAP_ID_LEN]; /* Temp. heap ID holder */
/* Swap current position with future position */
/* (just swap the heap ID, the len & offset isn't used */
@@ -15700,52 +15772,52 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
HDmemcpy(&keep_ids.ids[u * id_len], &keep_ids.ids[(u + pos) * id_len], id_len);
HDmemcpy(&keep_ids.ids[(u + pos) * id_len], temp_id, id_len);
} /* end if */
- } /* end for */
+ } /* end for */
/* Delete individual objects, if we won't be deleting the entire heap later */
- if(tparam->del_dir != FHEAP_DEL_HEAP) {
+ if (tparam->del_dir != FHEAP_DEL_HEAP) {
/* Delete objects inserted */
- for(u = 0; u < keep_ids.num_ids; u++) {
+ for (u = 0; u < keep_ids.num_ids; u++) {
/* Remove object from heap */
- if(H5HF_remove(fh, &keep_ids.ids[id_len * u]) < 0)
+ if (H5HF_remove(fh, &keep_ids.ids[id_len * u]) < 0)
FAIL_STACK_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
} /* end for */
/* Check up on heap... */
- if(check_stats(fh, &state))
+ if (check_stats(fh, &state))
TEST_ERROR
} /* end if */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Check for deleting the entire heap */
- if(tparam->del_dir == FHEAP_DEL_HEAP) {
+ if (tparam->del_dir == FHEAP_DEL_HEAP) {
/* Delete heap */
- if(H5HF_delete(f, fh_addr) < 0)
+ if (H5HF_delete(f, fh_addr) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
/* Free resources */
- if(tparam->comp == FHEAP_TEST_COMPRESS)
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */
/* Free resources */
@@ -15756,24 +15828,25 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- if(tparam->comp == FHEAP_TEST_COMPRESS)
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_random_pow2() */
-
/*-------------------------------------------------------------------------
* Function: test_write
*
@@ -15790,9 +15863,10 @@ error:
/* Custom filter used to verify that the filters are actually called and do not
* just silently fail */
static hbool_t test_write_filter_called;
-static size_t test_write_filter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
- void H5_ATTR_UNUSED **buf)
+static size_t
+test_write_filter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
+ const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes,
+ size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
{
test_write_filter_called = TRUE;
@@ -15802,29 +15876,29 @@ static size_t test_write_filter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATT
static unsigned
test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- H5HF_create_t tmp_cparam; /* Local heap creation parameters */
- size_t id_len; /* Size of fractal heap IDs */
- unsigned char tiny_heap_id[HEAP_ID_LEN]; /* Heap ID for 'tiny' object */
- unsigned char huge_heap_id[HEAP_ID_LEN]; /* Heap ID for 'huge' object */
- hbool_t id_changed = FALSE; /* Whether the heap ID changed */
- unsigned char *rewrite_obj = NULL; /* Pointer to re-write buffer for objects */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t obj_loc; /* Location of object in buffer */
- fheap_heap_state_t state; /* State of fractal heap */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ H5HF_create_t tmp_cparam; /* Local heap creation parameters */
+ size_t id_len; /* Size of fractal heap IDs */
+ unsigned char tiny_heap_id[HEAP_ID_LEN]; /* Heap ID for 'tiny' object */
+ unsigned char huge_heap_id[HEAP_ID_LEN]; /* Heap ID for 'huge' object */
+ hbool_t id_changed = FALSE; /* Whether the heap ID changed */
+ unsigned char * rewrite_obj = NULL; /* Pointer to re-write buffer for objects */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t obj_loc; /* Location of object in buffer */
+ fheap_heap_state_t state; /* State of fractal heap */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/*
* Display testing message
*/
- if(tparam->comp == FHEAP_TEST_COMPRESS)
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
TESTING("writing objects in heap with compressed blocks")
else
TESTING("writing objects in heap")
@@ -15836,95 +15910,94 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t));
/* Check if we are compressing the blocks */
- if(tparam->comp == FHEAP_TEST_COMPRESS) {
- H5Z_class2_t filter_class; /* Custom filter */
- unsigned deflate_level; /* Deflation level */
+ if (tparam->comp == FHEAP_TEST_COMPRESS) {
+ H5Z_class2_t filter_class; /* Custom filter */
+ unsigned deflate_level; /* Deflation level */
/* Set an I/O filter for heap data */
deflate_level = 6;
- if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) < 0)
+ if (H5Z_append(&tmp_cparam.pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &deflate_level) <
+ 0)
FAIL_STACK_ERROR
/* Register and append custom filter */
- filter_class.version = H5Z_CLASS_T_VERS;
- filter_class.id = H5Z_FILTER_RESERVED + 43;
+ filter_class.version = H5Z_CLASS_T_VERS;
+ filter_class.id = H5Z_FILTER_RESERVED + 43;
filter_class.encoder_present = TRUE;
filter_class.decoder_present = TRUE;
- filter_class.name = "custom_fheap_filter";
- filter_class.can_apply = NULL;
- filter_class.set_local = NULL;
- filter_class.filter = test_write_filter;
- if(H5Zregister(&filter_class) < 0) TEST_ERROR
- if(H5Z_append(&tmp_cparam.pline, H5Z_FILTER_RESERVED + 43, 0, (size_t)0, NULL) < 0)
+ filter_class.name = "custom_fheap_filter";
+ filter_class.can_apply = NULL;
+ filter_class.set_local = NULL;
+ filter_class.filter = test_write_filter;
+ if (H5Zregister(&filter_class) < 0)
+ TEST_ERROR
+ if (H5Z_append(&tmp_cparam.pline, H5Z_FILTER_RESERVED + 43, 0, (size_t)0, NULL) < 0)
FAIL_STACK_ERROR
test_write_filter_called = FALSE;
} /* end if */
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, &tmp_cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Get information about heap ID lengths */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > MAX_HEAP_ID_LEN)
+ if (id_len > MAX_HEAP_ID_LEN)
TEST_ERROR
-
/* Create 'tiny' and 'huge' objects */
obj_size = id_len / 2;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, tiny_heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, tiny_heap_id) < 0)
FAIL_STACK_ERROR
obj_size = tmp_cparam.max_man_size + 1;
- if(H5HF_insert(fh, obj_size, shared_wobj_g, huge_heap_id) < 0)
+ if (H5HF_insert(fh, obj_size, shared_wobj_g, huge_heap_id) < 0)
FAIL_STACK_ERROR
/* Verify that writing to 'huge' objects works for un-filtered heaps */
- H5E_BEGIN_TRY {
- ret = H5HF_write(fh, huge_heap_id, &id_changed, shared_wobj_g);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5HF_write(fh, huge_heap_id, &id_changed, shared_wobj_g); }
+ H5E_END_TRY;
HDassert(!id_changed);
- if(tparam->comp == FHEAP_TEST_COMPRESS) {
- if(ret >= 0)
+ if (tparam->comp == FHEAP_TEST_COMPRESS) {
+ if (ret >= 0)
TEST_ERROR
} /* end if */
else {
- if(ret < 0)
+ if (ret < 0)
FAIL_STACK_ERROR
} /* end else */
/* Verify that writing to 'tiny' objects return failure (for now) */
- H5E_BEGIN_TRY {
- ret = H5HF_write(fh, tiny_heap_id, &id_changed, shared_wobj_g);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5HF_write(fh, tiny_heap_id, &id_changed, shared_wobj_g); }
+ H5E_END_TRY;
HDassert(!id_changed);
- if(ret >= 0)
+ if (ret >= 0)
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Verify that the custom filter has been applied for the huge object (if
* applicable) */
- if(tparam->comp == FHEAP_TEST_COMPRESS) {
- if(!test_write_filter_called) TEST_ERROR
+ if (tparam->comp == FHEAP_TEST_COMPRESS) {
+ if (!test_write_filter_called)
+ TEST_ERROR
test_write_filter_called = FALSE;
} /* end if */
-
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -15932,66 +16005,66 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Initialize data to overwrite with */
rewrite_obj = (unsigned char *)H5MM_malloc(shared_obj_size_g);
- for(u = 0; u < shared_obj_size_g; u++)
+ for (u = 0; u < shared_obj_size_g; u++)
rewrite_obj[u] = (unsigned char)(shared_wobj_g[u] * 2);
/* Insert different sized objects, but stay out of "tiny" and "huge" zones */
obj_size = 20;
- for(u = 0; u < 40; u++) {
+ for (u = 0; u < 40; u++) {
obj_loc = u;
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
/* Check for closing & re-opening the heap */
- if(reopen_heap(f, &fh, fh_addr, tparam) < 0)
+ if (reopen_heap(f, &fh, fh_addr, tparam) < 0)
TEST_ERROR
/* Overwrite data just written */
- if(H5HF_write(fh, &keep_ids.ids[id_len * u], &id_changed, rewrite_obj) < 0)
+ if (H5HF_write(fh, &keep_ids.ids[id_len * u], &id_changed, rewrite_obj) < 0)
FAIL_STACK_ERROR
HDassert(!id_changed);
/* Read data back in */
- if(H5HF_read(fh, &keep_ids.ids[id_len * u], shared_robj_g) < 0)
+ if (H5HF_read(fh, &keep_ids.ids[id_len * u], shared_robj_g) < 0)
FAIL_STACK_ERROR
/* Compare data read in */
- if(HDmemcmp(rewrite_obj, shared_robj_g, obj_size))
+ if (HDmemcmp(rewrite_obj, shared_robj_g, obj_size))
TEST_ERROR
/* Change size of data to write */
- if(u < 20)
+ if (u < 20)
obj_size = (size_t)((float)obj_size * 1.3F);
else
obj_size = (size_t)((float)obj_size / 1.3F);
} /* end for */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Verify that the custom filter has been applied to the managed objects (if
* applicable) */
- if(tparam->comp == FHEAP_TEST_COMPRESS)
- if(!test_write_filter_called) TEST_ERROR
-
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
+ if (!test_write_filter_called)
+ TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -15999,38 +16072,38 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Verify changed objects */
obj_size = 20;
- for(u = 0; u < 40; u++) {
+ for (u = 0; u < 40; u++) {
/* Read data back in */
- if(H5HF_read(fh, &keep_ids.ids[id_len * u], shared_robj_g) < 0)
+ if (H5HF_read(fh, &keep_ids.ids[id_len * u], shared_robj_g) < 0)
FAIL_STACK_ERROR
/* Compare data read in */
- if(HDmemcmp(rewrite_obj, shared_robj_g, obj_size))
+ if (HDmemcmp(rewrite_obj, shared_robj_g, obj_size))
TEST_ERROR
/* Change size of data to write */
- if(u < 20)
+ if (u < 20)
obj_size = (size_t)((float)obj_size * 1.3F);
else
obj_size = (size_t)((float)obj_size / 1.3F);
} /* end for */
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Free resources */
- if(tparam->comp == FHEAP_TEST_COMPRESS)
+ if (tparam->comp == FHEAP_TEST_COMPRESS)
H5O_msg_reset(H5O_PLINE_ID, &tmp_cparam.pline); /* Release the I/O pipeline filter information */
/* Free resources */
@@ -16042,22 +16115,23 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
H5MM_xfree(rewrite_obj);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_write() */
-
/*-------------------------------------------------------------------------
* Function: test_bug1
*
@@ -16076,17 +16150,17 @@ error:
static unsigned
test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
{
- hid_t file = -1; /* File ID */
- char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5HF_t *fh = NULL; /* Fractal heap wrapper */
- haddr_t fh_addr; /* Address of fractal heap */
- size_t id_len; /* Size of fractal heap IDs */
- fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
- h5_stat_size_t empty_size; /* Size of a file with an empty heap */
- size_t obj_size; /* Size of object */
- size_t obj_loc; /* Location of object in buffer */
- fheap_heap_state_t state; /* State of fractal heap */
+ hid_t file = -1; /* File ID */
+ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5HF_t * fh = NULL; /* Fractal heap wrapper */
+ haddr_t fh_addr; /* Address of fractal heap */
+ size_t id_len; /* Size of fractal heap IDs */
+ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */
+ h5_stat_size_t empty_size; /* Size of a file with an empty heap */
+ size_t obj_size; /* Size of object */
+ size_t obj_loc; /* Location of object in buffer */
+ fheap_heap_state_t state; /* State of fractal heap */
/*
* Display testing message
@@ -16097,63 +16171,61 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
HDmemset(&keep_ids, 0, sizeof(fheap_heap_ids_t));
/* Perform common file & heap open operations */
- if(open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
+ if (open_heap(filename, fapl, cparam, tparam, &file, &f, &fh, &fh_addr, &state, &empty_size) < 0)
TEST_ERROR
/* Get information about heap ID lengths */
- if(H5HF_get_id_len(fh, &id_len) < 0)
+ if (H5HF_get_id_len(fh, &id_len) < 0)
FAIL_STACK_ERROR
- if(id_len > MAX_HEAP_ID_LEN)
+ if (id_len > MAX_HEAP_ID_LEN)
TEST_ERROR
/* Insert objects */
obj_size = 44;
- obj_loc = 1;
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ obj_loc = 1;
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
obj_size = 484;
- obj_loc = 2;
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ obj_loc = 2;
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
obj_size = 168;
- obj_loc = 3;
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ obj_loc = 3;
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
obj_size = 96;
- obj_loc = 4;
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ obj_loc = 4;
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
obj_size = 568;
- obj_loc = 5;
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ obj_loc = 5;
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
obj_size = 568;
- obj_loc = 6;
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ obj_loc = 6;
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
-
-
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -16161,29 +16233,28 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Remove one of the objects */
- if(H5HF_remove(fh, &keep_ids.ids[id_len * 4]) < 0)
+ if (H5HF_remove(fh, &keep_ids.ids[id_len * 4]) < 0)
FAIL_STACK_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
-
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
@@ -16191,25 +16262,24 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
FAIL_STACK_ERROR
/* Re-open the heap */
- if(NULL == (fh = H5HF_open(f, fh_addr)))
+ if (NULL == (fh = H5HF_open(f, fh_addr)))
FAIL_STACK_ERROR
/* Insert another object */
obj_size = 208;
- obj_loc = 6;
- if(add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
+ obj_loc = 6;
+ if (add_obj(fh, obj_loc, obj_size, NULL, &keep_ids))
TEST_ERROR
/* Close the fractal heap */
- if(H5HF_close(fh) < 0)
+ if (H5HF_close(fh) < 0)
FAIL_STACK_ERROR
fh = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
-
/* Free resources */
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
@@ -16218,21 +16288,22 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
/* All tests passed */
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(keep_ids.ids);
H5MM_xfree(keep_ids.lens);
H5MM_xfree(keep_ids.offs);
- if(fh)
+ if (fh)
H5HF_close(fh);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_bug1() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -16250,24 +16321,24 @@ error:
int
main(void)
{
- fheap_test_param_t tparam; /* Testing parameters */
- H5HF_create_t small_cparam; /* Creation parameters for "small" heap */
- H5HF_create_t large_cparam; /* Creation parameters for "large" heap */
- hid_t fapl = -1, def_fapl = -1; /* File access property list for data files */
- hid_t pb_fapl = -1; /* File access property list for data files */
- hid_t fcpl = -1, def_fcpl = -1; /* File creation property list for data files */
- fheap_test_type_t curr_test; /* Current test being worked on */
- unsigned u, v; /* Local index variable */
- unsigned nerrors = 0; /* Cumulative error count */
- unsigned num_pb_fs = 1; /* The number of settings to test for page buffering and file space handling */
- int ExpressMode; /* Express testing level */
- const char *envval; /* Environment variable */
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ fheap_test_param_t tparam; /* Testing parameters */
+ H5HF_create_t small_cparam; /* Creation parameters for "small" heap */
+ H5HF_create_t large_cparam; /* Creation parameters for "large" heap */
+ hid_t fapl = -1, def_fapl = -1; /* File access property list for data files */
+ hid_t pb_fapl = -1; /* File access property list for data files */
+ hid_t fcpl = -1, def_fcpl = -1; /* File creation property list for data files */
+ fheap_test_type_t curr_test; /* Current test being worked on */
+ unsigned u, v; /* Local index variable */
+ unsigned nerrors = 0; /* Cumulative error count */
+ unsigned num_pb_fs = 1; /* The number of settings to test for page buffering and file space handling */
+ int ExpressMode; /* Express testing level */
+ const char *envval; /* Environment variable */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Don't run this test using certain file drivers */
envval = HDgetenv("HDF5_DRIVER");
- if(envval == NULL)
+ if (envval == NULL)
envval = "nomatch";
/* Current VFD that does not support contigous address space */
@@ -16276,7 +16347,7 @@ main(void)
/* Reset library */
h5_reset();
- def_fapl = h5_fileaccess();
+ def_fapl = h5_fileaccess();
ExpressMode = GetTestExpress();
/*
@@ -16289,9 +16360,9 @@ main(void)
* Activate full testing when this feature is re-enabled
* in the future for parallel build.
*/
- if(ExpressMode > 1)
+ if (ExpressMode > 1)
HDprintf("***Express test mode on. Some tests may be skipped\n");
- else if(ExpressMode == 0) {
+ else if (ExpressMode == 0) {
#ifdef H5_HAVE_PARALLEL
num_pb_fs = NUM_PB_FS - 2;
#else
@@ -16304,47 +16375,48 @@ main(void)
init_large_cparam(&large_cparam);
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Allocate space for the shared objects */
shared_obj_size_g = large_cparam.max_man_size + 256;
- shared_wobj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g);
- shared_robj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g);
+ shared_wobj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g);
+ shared_robj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g);
/* Create a copy def_fapl and enable page buffering */
- if((pb_fapl = H5Pcopy(def_fapl)) < 0)
+ if ((pb_fapl = H5Pcopy(def_fapl)) < 0)
TEST_ERROR
- if(H5Pset_page_buffer_size(pb_fapl, PAGE_BUFFER_PAGE_SIZE, 0, 0) < 0)
+ if (H5Pset_page_buffer_size(pb_fapl, PAGE_BUFFER_PAGE_SIZE, 0, 0) < 0)
TEST_ERROR
/* Create a file creation property list */
- if((def_fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((def_fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR
/* Initialize the shared write buffer for objects */
- for(u = 0; u < shared_obj_size_g; u++)
+ for (u = 0; u < shared_obj_size_g; u++)
shared_wobj_g[u] = (unsigned char)u;
- for(v = 0; v < num_pb_fs; v++) {
+ for (v = 0; v < num_pb_fs; v++) {
/* Skip test when:
a) multi/split drivers and
b) persisting free-space or using paged aggregation strategy
because the library will fail file creation (temporary) for the above conditions */
- if(!contig_addr_vfd && v)
+ if (!contig_addr_vfd && v)
break;
- if((fcpl = H5Pcopy(def_fcpl)) < 0)
+ if ((fcpl = H5Pcopy(def_fcpl)) < 0)
TEST_ERROR
- switch(v) {
+ switch (v) {
case 0:
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)1) < 0)
TEST_ERROR
fapl = def_fapl;
break;
case 1:
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
TEST_ERROR
fapl = def_fapl;
/* This is a fix for the daily test failure from the checkin for libver bounds. */
@@ -16372,26 +16444,26 @@ main(void)
* library to use version 2 object header for the superblock extension
* message.
*/
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
break;
case 2:
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
TEST_ERROR
fapl = def_fapl;
break;
case 3:
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
TEST_ERROR
fapl = def_fapl;
break;
case 4:
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
TEST_ERROR
fapl = pb_fapl;
break;
case 5:
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
TEST_ERROR
fapl = pb_fapl;
break;
@@ -16402,7 +16474,7 @@ main(void)
}
/* Iterate over the testing parameters */
- for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; curr_test++) {
+ for (curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; curr_test++) {
/* Clear the testing parameters */
HDmemset(&tparam, 0, sizeof(fheap_test_param_t));
tparam.actual_id_len = HEAP_ID_LEN;
@@ -16411,7 +16483,7 @@ main(void)
tparam.my_fcpl = fcpl;
/* Set appropriate testing parameters for each test */
- switch(curr_test) {
+ switch (curr_test) {
/* "Normal" testing parameters */
case FHEAP_TEST_NORMAL:
HDputs("Testing with normal parameters");
@@ -16441,288 +16513,346 @@ main(void)
nerrors += test_reopen_hdr(fapl, &small_cparam, tparam.my_fcpl);
{
- fheap_test_fill_t fill; /* Size of objects to fill heap blocks with */
-
- /* Filling with different sized objects */
- for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; fill++) {
- tparam.fill = fill;
-
- /* Set appropriate testing parameters for each test */
- switch(fill) {
- /* "Bulk fill" heap blocks with 'large' objects */
- case FHEAP_TEST_FILL_LARGE:
- HDputs("Bulk-filling blocks w/large objects");
- break;
-
- /* "Bulk fill" heap blocks with 'single' objects */
- case FHEAP_TEST_FILL_SINGLE:
- HDputs("Bulk-filling blocks w/single object");
- break;
-
- /* An unknown test? */
- case FHEAP_TEST_FILL_N:
- default:
- goto error;
- } /* end switch */
+ fheap_test_fill_t fill; /* Size of objects to fill heap blocks with */
- /*
- * Test fractal heap managed object insertion
- */
+ /* Filling with different sized objects */
+ for (fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; fill++) {
+ tparam.fill = fill;
- /* "Weird" sized objects */
- nerrors += test_man_insert_weird(fapl, &small_cparam, &tparam);
-
-#ifdef ALL_INSERT_TESTS
- /* "Standard" sized objects, building from simple to complex heaps */
- nerrors += test_man_insert_first(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_second(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_root_mult(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_force_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_fill_second(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_third_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_first_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_second_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_second_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_third_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_fourth_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_all_root_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_first_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_second_direct_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_first_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_second_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_second_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_recursive_indirect_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_2nd_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_recursive_indirect_two_deep(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_first_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_recursive_indirect_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_all_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_4th_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_first_4th_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_4th_recursive_indirect_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_all_4th_recursive_indirect(fapl, &small_cparam, &tparam);
-#endif /* ALL_INSERT_TESTS */
- /* If this test fails, uncomment the tests above, which build up to this
- * level of complexity gradually. -QAK
- */
- if(ExpressMode > 1)
- HDprintf("***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n");
- else
- nerrors += test_man_start_5th_recursive_indirect(fapl, &small_cparam, &tparam);
-
- /*
- * Test fractal heap object deletion
- */
- /* Simple removal */
- nerrors += test_man_remove_bogus(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_one(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_two(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_one_larger(fapl, &small_cparam, &tparam);
- tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam);
- tparam.del_dir = FHEAP_DEL_REVERSE;
- nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam);
- tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam);
- tparam.del_dir = FHEAP_DEL_REVERSE;
- nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam);
-
- /* Incremental insert & removal */
- tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_man_incr_insert_remove(fapl, &small_cparam, &tparam);
-
- {
- fheap_test_del_dir_t del_dir; /* Deletion direction */
- fheap_test_del_drain_t drain_half; /* Deletion draining */
+ /* Set appropriate testing parameters for each test */
+ switch (fill) {
+ /* "Bulk fill" heap blocks with 'large' objects */
+ case FHEAP_TEST_FILL_LARGE:
+ HDputs("Bulk-filling blocks w/large objects");
+ break;
- /* More complex removal patterns */
- for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) {
- tparam.del_dir = del_dir;
- for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; drain_half++) {
- tparam.drain_half = drain_half;
- /* Don't need to test deletion directions when deleting entire heap */
- if(tparam.del_dir == FHEAP_DEL_HEAP && tparam.drain_half > FHEAP_DEL_DRAIN_ALL)
+ /* "Bulk fill" heap blocks with 'single' objects */
+ case FHEAP_TEST_FILL_SINGLE:
+ HDputs("Bulk-filling blocks w/single object");
break;
- /* Simple insertion patterns */
- nerrors += test_man_remove_root_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_two_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_first_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_first_two_rows(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_first_four_rows(fapl, &small_cparam, &tparam);
- if(ExpressMode > 1)
- HDprintf("***Express test mode on. Some tests skipped\n");
- else {
- nerrors += test_man_remove_all_root_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_2nd_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_3rd_indirect(fapl, &small_cparam, &tparam);
- } /* end else */
-
- /* Skip blocks insertion */
- /* (covers insertion & deletion of skipped blocks) */
- nerrors += test_man_skip_start_block(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_start_block_add_back(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_2nd_block(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_one_partial_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_row_skip_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_direct_skip_indirect_two_rows_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_indirect_two_rows_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- if(ExpressMode > 1)
- HDprintf("***Express test mode on. Some tests skipped\n");
- else {
- nerrors += test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- } /* end else */
-
- /* Fragmented insertion patterns */
- /* (covers insertion & deletion of fragmented blocks) */
- nerrors += test_man_frag_simple(fapl, &small_cparam, &tparam);
- nerrors += test_man_frag_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_frag_2nd_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_frag_3rd_direct(fapl, &small_cparam, &tparam);
- } /* end for */
- } /* end for */
+ /* An unknown test? */
+ case FHEAP_TEST_FILL_N:
+ default:
+ goto error;
+ } /* end switch */
- /* Reset deletion drain parameter */
- tparam.drain_half = FHEAP_DEL_DRAIN_ALL;
+ /*
+ * Test fractal heap managed object insertion
+ */
- } /* end block */
- } /* end for */
- } /* end block */
+ /* "Weird" sized objects */
+ nerrors += test_man_insert_weird(fapl, &small_cparam, &tparam);
+
+#ifdef ALL_INSERT_TESTS
+ /* "Standard" sized objects, building from simple to complex heaps */
+ nerrors += test_man_insert_first(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_second(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_root_mult(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_force_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_fill_second(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_third_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_first_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_second_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_second_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_third_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_fourth_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_all_root_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_first_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_second_direct_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_first_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_second_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_second_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_recursive_indirect_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_2nd_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_recursive_indirect_two_deep(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_first_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_3rd_recursive_indirect_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_all_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_4th_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_first_4th_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_4th_recursive_indirect_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_all_4th_recursive_indirect(fapl, &small_cparam, &tparam);
+#endif /* ALL_INSERT_TESTS */
+ /* If this test fails, uncomment the tests above, which build up to this
+ * level of complexity gradually. -QAK
+ */
+ if (ExpressMode > 1)
+ HDprintf(
+ "***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n");
+ else
+ nerrors += test_man_start_5th_recursive_indirect(fapl, &small_cparam, &tparam);
+
+ /*
+ * Test fractal heap object deletion
+ */
+ /* Simple removal */
+ nerrors += test_man_remove_bogus(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_one(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_two(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_one_larger(fapl, &small_cparam, &tparam);
+ tparam.del_dir = FHEAP_DEL_FORWARD;
+ nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam);
+ tparam.del_dir = FHEAP_DEL_REVERSE;
+ nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam);
+ tparam.del_dir = FHEAP_DEL_FORWARD;
+ nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam);
+ tparam.del_dir = FHEAP_DEL_REVERSE;
+ nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam);
+
+ /* Incremental insert & removal */
+ tparam.del_dir = FHEAP_DEL_FORWARD;
+ nerrors += test_man_incr_insert_remove(fapl, &small_cparam, &tparam);
+
+ {
+ fheap_test_del_dir_t del_dir; /* Deletion direction */
+ fheap_test_del_drain_t drain_half; /* Deletion draining */
+
+ /* More complex removal patterns */
+ for (del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) {
+ tparam.del_dir = del_dir;
+ for (drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N;
+ drain_half++) {
+ tparam.drain_half = drain_half;
+ /* Don't need to test deletion directions when deleting entire heap */
+ if (tparam.del_dir == FHEAP_DEL_HEAP &&
+ tparam.drain_half > FHEAP_DEL_DRAIN_ALL)
+ break;
+
+ /* Simple insertion patterns */
+ nerrors += test_man_remove_root_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_two_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_first_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_first_two_rows(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_first_four_rows(fapl, &small_cparam, &tparam);
+ if (ExpressMode > 1)
+ HDprintf("***Express test mode on. Some tests skipped\n");
+ else {
+ nerrors += test_man_remove_all_root_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_2nd_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_3rd_indirect(fapl, &small_cparam, &tparam);
+ } /* end else */
+
+ /* Skip blocks insertion */
+ /* (covers insertion & deletion of skipped blocks) */
+ nerrors += test_man_skip_start_block(fapl, &small_cparam, &tparam);
+ nerrors += test_man_skip_start_block_add_back(fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_skip_2nd_block(fapl, &small_cparam, &tparam);
+ nerrors += test_man_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_one_partial_skip_2nd_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_row_skip_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_skip_direct_skip_indirect_two_rows_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_direct_skip_indirect_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_direct_skip_indirect_two_rows_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_2nd_direct_skip_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ if (ExpressMode > 1)
+ HDprintf("***Express test mode on. Some tests skipped\n");
+ else {
+ nerrors +=
+ test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ nerrors +=
+ test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(
+ fapl, &small_cparam, &tparam);
+ } /* end else */
+
+ /* Fragmented insertion patterns */
+ /* (covers insertion & deletion of fragmented blocks) */
+ nerrors += test_man_frag_simple(fapl, &small_cparam, &tparam);
+ nerrors += test_man_frag_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_frag_2nd_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_frag_3rd_direct(fapl, &small_cparam, &tparam);
+ } /* end for */
+ } /* end for */
+
+ /* Reset deletion drain parameter */
+ tparam.drain_half = FHEAP_DEL_DRAIN_ALL;
+
+ } /* end block */
+ } /* end for */
+ } /* end block */
/*
* Test fractal heap 'huge' & 'tiny' object insertion & deletion
*/
{
- fheap_test_del_dir_t del_dir; /* Deletion direction */
- unsigned id_len; /* Length of heap IDs */
-
- /* Test "normal" & "direct" storage of 'huge' & 'tiny' heap IDs */
- for(id_len = 0; id_len < 3; id_len++) {
- /* Set the ID length for this test */
- small_cparam.id_len = (uint16_t)id_len;
-
- /* Print information about each test */
- switch(id_len) {
- /* Use "normal" form for 'huge' object's heap IDs */
- case 0:
- HDputs("Using 'normal' heap ID format for 'huge' objects");
- break;
-
- /* Use "direct" form for 'huge' object's heap IDs */
- case 1:
- HDputs("Using 'direct' heap ID format for 'huge' objects");
-
- /* Adjust actual length of heap IDs for directly storing 'huge' object's file offset & length in heap ID */
- tparam.actual_id_len = 17; /* 1 + 8 (file address size) + 8 (file length size) */
- break;
-
- /* Use "direct" storage for 'huge' objects and larger IDs for 'tiny' objects */
- case 2:
- small_cparam.id_len = 37;
- HDputs("Using 'direct' heap ID format for 'huge' objects and larger IDs for 'tiny' objects");
- tparam.actual_id_len = 37;
- break;
-
- /* An unknown test? */
- default:
- goto error;
- } /* end switch */
-
- /* Try several different methods of deleting objects */
- for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) {
- tparam.del_dir = del_dir;
+ fheap_test_del_dir_t del_dir; /* Deletion direction */
+ unsigned id_len; /* Length of heap IDs */
+
+ /* Test "normal" & "direct" storage of 'huge' & 'tiny' heap IDs */
+ for (id_len = 0; id_len < 3; id_len++) {
+ /* Set the ID length for this test */
+ small_cparam.id_len = (uint16_t)id_len;
+
+ /* Print information about each test */
+ switch (id_len) {
+ /* Use "normal" form for 'huge' object's heap IDs */
+ case 0:
+ HDputs("Using 'normal' heap ID format for 'huge' objects");
+ break;
- /* Test 'huge' object insert & delete */
- nerrors += test_huge_insert_one(fapl, &small_cparam, &tparam);
- nerrors += test_huge_insert_two(fapl, &small_cparam, &tparam);
- nerrors += test_huge_insert_three(fapl, &small_cparam, &tparam);
- nerrors += test_huge_insert_mix(fapl, &small_cparam, &tparam);
- nerrors += test_filtered_huge(fapl, &small_cparam, &tparam);
-
- /* Test 'tiny' object insert & delete */
- nerrors += test_tiny_insert_one(fapl, &small_cparam, &tparam);
- nerrors += test_tiny_insert_two(fapl, &small_cparam, &tparam);
- nerrors += test_tiny_insert_mix(fapl, &small_cparam, &tparam);
- } /* end for */
- } /* end for */
+ /* Use "direct" form for 'huge' object's heap IDs */
+ case 1:
+ HDputs("Using 'direct' heap ID format for 'huge' objects");
- /* Reset the "normal" heap ID lengths */
- small_cparam.id_len = 0;
- tparam.actual_id_len = HEAP_ID_LEN;
+ /* Adjust actual length of heap IDs for directly storing 'huge' object's file
+ * offset & length in heap ID */
+ tparam.actual_id_len = 17; /* 1 + 8 (file address size) + 8 (file length size) */
+ break;
+
+ /* Use "direct" storage for 'huge' objects and larger IDs for 'tiny' objects */
+ case 2:
+ small_cparam.id_len = 37;
+ HDputs("Using 'direct' heap ID format for 'huge' objects and larger IDs for "
+ "'tiny' objects");
+ tparam.actual_id_len = 37;
+ break;
+
+ /* An unknown test? */
+ default:
+ goto error;
+ } /* end switch */
+
+ /* Try several different methods of deleting objects */
+ for (del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) {
+ tparam.del_dir = del_dir;
+
+ /* Test 'huge' object insert & delete */
+ nerrors += test_huge_insert_one(fapl, &small_cparam, &tparam);
+ nerrors += test_huge_insert_two(fapl, &small_cparam, &tparam);
+ nerrors += test_huge_insert_three(fapl, &small_cparam, &tparam);
+ nerrors += test_huge_insert_mix(fapl, &small_cparam, &tparam);
+ nerrors += test_filtered_huge(fapl, &small_cparam, &tparam);
+
+ /* Test 'tiny' object insert & delete */
+ nerrors += test_tiny_insert_one(fapl, &small_cparam, &tparam);
+ nerrors += test_tiny_insert_two(fapl, &small_cparam, &tparam);
+ nerrors += test_tiny_insert_mix(fapl, &small_cparam, &tparam);
+ } /* end for */
+ } /* end for */
+
+ /* Reset the "normal" heap ID lengths */
+ small_cparam.id_len = 0;
+ tparam.actual_id_len = HEAP_ID_LEN;
} /* end block */
/* Test I/O filter support */
/* Try several different methods of deleting objects */
{
- fheap_test_del_dir_t del_dir; /* Deletion direction */
-
- for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) {
- tparam.del_dir = del_dir;
+ fheap_test_del_dir_t del_dir; /* Deletion direction */
- /* Controlled tests */
- /* XXX: Re-enable file size checks in these tests, after the file has persistent free space tracking working */
- nerrors += test_filtered_man_root_direct(fapl, &small_cparam, &tparam);
- nerrors += test_filtered_man_root_indirect(fapl, &small_cparam, &tparam);
-
- /* Random tests, with compressed blocks */
- tparam.comp = FHEAP_TEST_COMPRESS;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(50*1000*1000) : (hsize_t)(25*1000*1000)), fapl, &small_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(50*1000*1000) : (hsize_t)(2*1000*1000)), fapl, &small_cparam, &tparam);
+ for (del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) {
+ tparam.del_dir = del_dir;
- /* Reset block compression */
- tparam.comp = FHEAP_TEST_NO_COMPRESS;
- } /* end for */
- } /* end block */
+ /* Controlled tests */
+ /* XXX: Re-enable file size checks in these tests, after the file has persistent free
+ * space tracking working */
+ nerrors += test_filtered_man_root_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_filtered_man_root_indirect(fapl, &small_cparam, &tparam);
+
+ /* Random tests, with compressed blocks */
+ tparam.comp = FHEAP_TEST_COMPRESS;
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(50 * 1000 * 1000)
+ : (hsize_t)(25 * 1000 * 1000)),
+ fapl, &small_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(50 * 1000 * 1000)
+ : (hsize_t)(2 * 1000 * 1000)),
+ fapl, &small_cparam, &tparam);
+
+ /* Reset block compression */
+ tparam.comp = FHEAP_TEST_NO_COMPRESS;
+ } /* end for */
+ } /* end block */
/* Random object insertion & deletion */
- if(ExpressMode > 1)
+ if (ExpressMode > 1)
HDprintf("***Express test mode on. Some tests skipped\n");
else {
/* Random tests using "small" heap creation parameters */
HDputs("Using 'small' heap creation parameters");
/* (reduce size of tests when re-opening each time) */
- /* XXX: Try to speed things up enough that these tests don't have to be reduced when re-opening */
+ /* XXX: Try to speed things up enough that these tests don't have to be reduced when
+ * re-opening */
tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &small_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &small_cparam, &tparam);
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100 * 1000 * 1000)
+ : (hsize_t)(50 * 1000 * 1000)),
+ fapl, &small_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100 * 1000 * 1000)
+ : (hsize_t)(4 * 1000 * 1000)),
+ fapl, &small_cparam, &tparam);
tparam.del_dir = FHEAP_DEL_HEAP;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &small_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &small_cparam, &tparam);
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100 * 1000 * 1000)
+ : (hsize_t)(50 * 1000 * 1000)),
+ fapl, &small_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100 * 1000 * 1000)
+ : (hsize_t)(4 * 1000 * 1000)),
+ fapl, &small_cparam, &tparam);
/* Random tests using "large" heap creation parameters */
HDputs("Using 'large' heap creation parameters");
tparam.actual_id_len = LARGE_HEAP_ID_LEN;
/* (reduce size of tests when re-opening each time) */
- /* XXX: Try to speed things up enough that these tests don't have to be reduced when re-opening */
+ /* XXX: Try to speed things up enough that these tests don't have to be reduced when
+ * re-opening */
tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &large_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &large_cparam, &tparam);
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100 * 1000 * 1000)
+ : (hsize_t)(50 * 1000 * 1000)),
+ fapl, &large_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100 * 1000 * 1000)
+ : (hsize_t)(4 * 1000 * 1000)),
+ fapl, &large_cparam, &tparam);
tparam.del_dir = FHEAP_DEL_HEAP;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &large_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &large_cparam, &tparam);
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100 * 1000 * 1000)
+ : (hsize_t)(50 * 1000 * 1000)),
+ fapl, &large_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100 * 1000 * 1000)
+ : (hsize_t)(4 * 1000 * 1000)),
+ fapl, &large_cparam, &tparam);
/* Reset the "normal" heap ID length */
tparam.actual_id_len = SMALL_HEAP_ID_LEN;
@@ -16741,13 +16871,13 @@ main(void)
tparam.comp = FHEAP_TEST_NO_COMPRESS;
} /* end for */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
TEST_ERROR
} /* end num_pb_fs */
/* Tests that address specific bugs */
tparam.my_fcpl = def_fcpl;
- fapl = def_fapl;
+ fapl = def_fapl;
/* Tests that address specific bugs */
nerrors += test_bug1(fapl, &small_cparam, &tparam);
@@ -16755,7 +16885,7 @@ main(void)
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All fractal heap tests passed.");
@@ -16766,11 +16896,14 @@ main(void)
H5MM_xfree(shared_lens_g);
H5MM_xfree(shared_offs_g);
- if(H5Pclose(def_fcpl) < 0) TEST_ERROR
- if(H5Pclose(pb_fapl) < 0) TEST_ERROR
+ if (H5Pclose(def_fcpl) < 0)
+ TEST_ERROR
+ if (H5Pclose(pb_fapl) < 0)
+ TEST_ERROR
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
/* Clean up file used */
@@ -16780,7 +16913,8 @@ main(void)
error:
HDputs("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5MM_xfree(shared_wobj_g);
H5MM_xfree(shared_robj_g);
H5MM_xfree(shared_ids_g);
@@ -16790,10 +16924,11 @@ error:
H5Pclose(pb_fapl);
H5Pclose(def_fcpl);
H5Pclose(fcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
return 1;
} /* end main() */
-
diff --git a/test/file_image.c b/test/file_image.c
index d784df2..5b94a53 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -12,62 +12,60 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: file_image
-*
-* Test setting file images
-*
-*************************************************************/
+ *
+ * Test program: file_image
+ *
+ * Test setting file images
+ *
+ *************************************************************/
#include "h5test.h"
#include "H5Fprivate.h" /* required to test property removals */
-#define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0)
+#define VERIFY(condition, string) \
+ do { \
+ if (!(condition)) \
+ FAIL_PUTS_ERROR(string) \
+ } while (0)
/* Values for callback bit field */
-#define MALLOC 0x01
-#define MEMCPY 0x02
-#define REALLOC 0x04
-#define FREE 0x08
-#define UDATA_COPY 0x10
-#define UDATA_FREE 0x20
-
-#define RANK 2
-#define DIM0 1024
-#define DIM1 32
+#define MALLOC 0x01
+#define MEMCPY 0x02
+#define REALLOC 0x04
+#define FREE 0x08
+#define UDATA_COPY 0x10
+#define UDATA_FREE 0x20
+
+#define RANK 2
+#define DIM0 1024
+#define DIM1 32
#define DSET_NAME "test_dset"
#define FAMILY_SIZE (2 * 1024)
#define USERBLOCK_SIZE 512
-const char *FILENAME[] = {
- "file_image_core_test",
- NULL
-};
+const char *FILENAME[] = {"file_image_core_test", NULL};
/* need a second file name array, as the first file name array contains
* files we don't want to delete on cleanup.
*/
-const char *FILENAME2[] = {
- "sec2_get_file_image_test",
- "stdio_get_file_image_test",
- "core_get_file_image_test",
- "family_get_file_image_test",
- "multi_get_file_image_test",
- "split_get_file_image_test",
- "get_file_image_error_rejection_test",
- NULL
-};
+const char *FILENAME2[] = {"sec2_get_file_image_test",
+ "stdio_get_file_image_test",
+ "core_get_file_image_test",
+ "family_get_file_image_test",
+ "multi_get_file_image_test",
+ "split_get_file_image_test",
+ "get_file_image_error_rejection_test",
+ NULL};
typedef struct {
- unsigned char used_callbacks; /* Bitfield for tracking callbacks */
- H5FD_file_image_op_t malloc_src; /* Source of file image callbacks */
+ unsigned char used_callbacks; /* Bitfield for tracking callbacks */
+ H5FD_file_image_op_t malloc_src; /* Source of file image callbacks */
H5FD_file_image_op_t memcpy_src;
H5FD_file_image_op_t realloc_src;
H5FD_file_image_op_t free_src;
} udata_t;
-
/******************************************************************************
* Function: test_properties
*
@@ -85,16 +83,16 @@ typedef struct {
static int
test_properties(void)
{
- hid_t fapl_1 = -1;
- hid_t fapl_2 = -1;
- char *buffer = 0;
- int count = 10;
- void *temp = 0;
- char *temp2 = 0;
- int i;
- size_t size;
- size_t temp_size;
- int retval = 1;
+ hid_t fapl_1 = -1;
+ hid_t fapl_2 = -1;
+ char * buffer = 0;
+ int count = 10;
+ void * temp = 0;
+ char * temp2 = 0;
+ int i;
+ size_t size;
+ size_t temp_size;
+ int retval = 1;
TESTING("File image property list functions");
@@ -104,27 +102,31 @@ test_properties(void)
* property list functions. In the file driver tests further down, this will
* not be the case.
*/
- size = (size_t)count * sizeof(char);
+ size = (size_t)count * sizeof(char);
buffer = (char *)HDmalloc(size);
- for(i = 0; i < count - 1; i++)
+ for (i = 0; i < count - 1; i++)
buffer[i] = (char)(65 + i);
buffer[count - 1] = '\0';
/* Create fapl */
- if((fapl_1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR
+ if ((fapl_1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
/* Get file image stuff */
- if(H5Pget_file_image(fapl_1, (void **)&temp, &temp_size) < 0) FAIL_STACK_ERROR
+ if (H5Pget_file_image(fapl_1, (void **)&temp, &temp_size) < 0)
+ FAIL_STACK_ERROR
/* Check default values */
VERIFY(temp == NULL, "Default pointer is wrong");
VERIFY(temp_size == 0, "Default size is wrong");
/* Set file image stuff */
- if(H5Pset_file_image(fapl_1, (void *)buffer, size) < 0) FAIL_STACK_ERROR
+ if (H5Pset_file_image(fapl_1, (void *)buffer, size) < 0)
+ FAIL_STACK_ERROR
/* Get the same */
- if(H5Pget_file_image(fapl_1, (void **)&temp, &temp_size) < 0) FAIL_STACK_ERROR
+ if (H5Pget_file_image(fapl_1, (void **)&temp, &temp_size) < 0)
+ FAIL_STACK_ERROR
/* Check that sizes are the same, and that the buffers are identical but separate */
VERIFY(temp != NULL, "temp is null!");
@@ -133,36 +135,39 @@ test_properties(void)
VERIFY(0 == HDmemcmp(temp, buffer, size), "Buffers contain different data");
/* Copy the fapl */
- if((fapl_2 = H5Pcopy(fapl_1)) < 0) FAIL_STACK_ERROR
+ if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
+ FAIL_STACK_ERROR
/* Get values from the new fapl */
- if(H5Pget_file_image(fapl_2, (void **)&temp2, &temp_size) < 0) FAIL_STACK_ERROR
+ if (H5Pget_file_image(fapl_2, (void **)&temp2, &temp_size) < 0)
+ FAIL_STACK_ERROR
/* Check that sizes are the same, and that the buffers are identical but separate */
- VERIFY(temp_size == size,"Sizes of buffers don't match");
- VERIFY(temp2 != NULL,"Recieved buffer not set");
+ VERIFY(temp_size == size, "Sizes of buffers don't match");
+ VERIFY(temp2 != NULL, "Recieved buffer not set");
VERIFY(temp2 != buffer, "Retrieved buffer is the same as original");
VERIFY(temp2 != temp, "Retrieved buffer is the same as previously retrieved buffer");
- VERIFY(0 == HDmemcmp(temp2, buffer, size),"Buffers contain different data");
+ VERIFY(0 == HDmemcmp(temp2, buffer, size), "Buffers contain different data");
retval = 0;
error:
/* Close everything */
- if(H5Pclose(fapl_1) < 0) retval = 1;
- if(H5Pclose(fapl_2) < 0) retval = 1;
+ if (H5Pclose(fapl_1) < 0)
+ retval = 1;
+ if (H5Pclose(fapl_2) < 0)
+ retval = 1;
HDfree(buffer);
H5free_memory(temp);
H5free_memory(temp2);
- if(retval == 0)
+ if (retval == 0)
PASSED();
return retval;
} /* end test_properties() */
-
/******************************************************************************
* Function: malloc_cb
*
@@ -185,7 +190,6 @@ malloc_cb(size_t size, H5FD_file_image_op_t op, void *udata)
return HDmalloc(size);
}
-
/******************************************************************************
* Function: memcpy_cb
*
@@ -208,7 +212,6 @@ memcpy_cb(void *dest, const void *src, size_t size, H5FD_file_image_op_t op, voi
return HDmemcpy(dest, src, size);
}
-
/******************************************************************************
* Function: realloc_cb
*
@@ -228,10 +231,9 @@ realloc_cb(void *ptr, size_t size, H5FD_file_image_op_t op, void *udata)
u->used_callbacks |= REALLOC;
u->realloc_src = op;
- return HDrealloc(ptr,size);
+ return HDrealloc(ptr, size);
}
-
/******************************************************************************
* Function: free_cb
*
@@ -250,10 +252,9 @@ free_cb(void *ptr, H5FD_file_image_op_t op, void *udata)
u->used_callbacks |= FREE;
u->free_src = op;
HDfree(ptr);
- return(SUCCEED);
+ return (SUCCEED);
}
-
/******************************************************************************
* Function: udata_copy_cb
*
@@ -277,7 +278,6 @@ udata_copy_cb(void *udata)
return udata;
}
-
/******************************************************************************
* Function: udata_free_cb
*
@@ -298,10 +298,9 @@ udata_free_cb(void *udata)
udata_t *u = (udata_t *)udata;
u->used_callbacks |= UDATA_FREE;
- return(SUCCEED);
+ return (SUCCEED);
}
-
/******************************************************************************
* Function: reset_udata
*
@@ -320,7 +319,6 @@ reset_udata(udata_t *u)
u->malloc_src = u->memcpy_src = u->realloc_src = u->free_src = H5FD_FILE_IMAGE_OP_NO_OP;
}
-
/******************************************************************************
* Function: test_callbacks
*
@@ -334,19 +332,19 @@ reset_udata(udata_t *u)
static int
test_callbacks(void)
{
- H5FD_file_image_callbacks_t real_callbacks = {&malloc_cb, &memcpy_cb, &realloc_cb,
- &free_cb, &udata_copy_cb, &udata_free_cb, NULL};
+ H5FD_file_image_callbacks_t real_callbacks = {&malloc_cb, &memcpy_cb, &realloc_cb, &free_cb,
+ &udata_copy_cb, &udata_free_cb, NULL};
H5FD_file_image_callbacks_t null_callbacks = {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
H5FD_file_image_callbacks_t callbacks;
- hid_t fapl_1;
- hid_t fapl_2;
- udata_t *udata;
- char *file_image;
- char *temp_file_image;
- int count = 10;
- int i;
- size_t size;
- size_t temp_size;
+ hid_t fapl_1;
+ hid_t fapl_2;
+ udata_t * udata;
+ char * file_image;
+ char * temp_file_image;
+ int count = 10;
+ int i;
+ size_t size;
+ size_t temp_size;
TESTING("Callback use in property list operations");
@@ -358,18 +356,20 @@ test_callbacks(void)
real_callbacks.udata = (void *)udata;
/* Allocate and initialize file image buffer */
- size = (size_t)count * sizeof(char);
+ size = (size_t)count * sizeof(char);
file_image = (char *)HDmalloc(size);
- for(i = 0; i < count - 1; i++)
+ for (i = 0; i < count - 1; i++)
file_image[i] = (char)(65 + i);
file_image[count - 1] = '\0';
/* Create fapl */
- if((fapl_1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR
+ if ((fapl_1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
/* Get file image stuff */
callbacks = real_callbacks;
- if(H5Pget_file_image_callbacks(fapl_1, &callbacks) < 0) FAIL_STACK_ERROR
+ if (H5Pget_file_image_callbacks(fapl_1, &callbacks) < 0)
+ FAIL_STACK_ERROR
/* Check default values */
VERIFY(callbacks.image_malloc == NULL, "Default malloc callback is wrong");
@@ -380,14 +380,15 @@ test_callbacks(void)
VERIFY(callbacks.udata_free == NULL, "Default udata free callback is wrong");
VERIFY(callbacks.udata == NULL, "Default udata is wrong");
-
/* Set file image callbacks */
callbacks = real_callbacks;
- if(H5Pset_file_image_callbacks(fapl_1, &callbacks) < 0) FAIL_STACK_ERROR
+ if (H5Pset_file_image_callbacks(fapl_1, &callbacks) < 0)
+ FAIL_STACK_ERROR
/* Get file image callbacks */
callbacks = null_callbacks;
- if(H5Pget_file_image_callbacks(fapl_1, &callbacks) < 0) FAIL_STACK_ERROR
+ if (H5Pget_file_image_callbacks(fapl_1, &callbacks) < 0)
+ FAIL_STACK_ERROR
/* Verify values */
VERIFY(callbacks.image_malloc == &malloc_cb, "malloc callback was not set or retrieved properly");
@@ -398,50 +399,59 @@ test_callbacks(void)
VERIFY(callbacks.udata_free == &udata_free_cb, "udata free callback was not set or retrieved properly");
VERIFY(callbacks.udata == udata, "udata was not set or retrieved properly");
-
/*
* Check callbacks in internal function without a previously set file image
*/
/* Copy fapl */
reset_udata(udata);
- if((fapl_2 = H5Pcopy(fapl_1)) < 0) FAIL_STACK_ERROR
+ if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
+ FAIL_STACK_ERROR
/* Verify that the property's copy callback used the correct image callbacks */
VERIFY(udata->used_callbacks == (UDATA_COPY), "Copying a fapl with no image used incorrect callbacks");
/* Close fapl */
reset_udata(udata);
- if(H5Pclose(fapl_2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl_2) < 0)
+ FAIL_STACK_ERROR
/* Verify that the udata free callback was used */
VERIFY(udata->used_callbacks == (UDATA_FREE), "Closing a fapl with no image used incorrect callbacks");
/* Copy again */
- if((fapl_2 = H5Pcopy(fapl_1)) < 0) FAIL_STACK_ERROR
+ if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
+ FAIL_STACK_ERROR
/* Remove property from fapl */
reset_udata(udata);
- if(H5Premove(fapl_2, H5F_ACS_FILE_IMAGE_INFO_NAME) < 0) FAIL_STACK_ERROR
+ if (H5Premove(fapl_2, H5F_ACS_FILE_IMAGE_INFO_NAME) < 0)
+ FAIL_STACK_ERROR
/* Verify that the property's delete callback was called using the correct image callbacks */
- VERIFY(udata->used_callbacks == (UDATA_FREE), "Removing a property from a fapl with no image used incorrect callbacks");
+ VERIFY(udata->used_callbacks == (UDATA_FREE),
+ "Removing a property from a fapl with no image used incorrect callbacks");
/* Close it again */
- if(H5Pclose(fapl_2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl_2) < 0)
+ FAIL_STACK_ERROR
/* Get file image */
reset_udata(udata);
- if(H5Pget_file_image(fapl_1, (void **)&temp_file_image, &temp_size) < 0) FAIL_STACK_ERROR
+ if (H5Pget_file_image(fapl_1, (void **)&temp_file_image, &temp_size) < 0)
+ FAIL_STACK_ERROR
/* Verify that the correct callbacks were used */
- VERIFY(udata->used_callbacks == 0, "attempting to retrieve the image from a fapl without an image has an unexpected callback");
+ VERIFY(udata->used_callbacks == 0,
+ "attempting to retrieve the image from a fapl without an image has an unexpected callback");
/* Set file image */
reset_udata(udata);
- if(H5Pset_file_image(fapl_1, (void *)file_image, size) < 0) FAIL_STACK_ERROR
+ if (H5Pset_file_image(fapl_1, (void *)file_image, size) < 0)
+ FAIL_STACK_ERROR
- VERIFY(udata->used_callbacks == (MALLOC | MEMCPY), "Setting a file image (first time) used incorrect callbacks");
+ VERIFY(udata->used_callbacks == (MALLOC | MEMCPY),
+ "Setting a file image (first time) used incorrect callbacks");
/*
* Check callbacks in internal functions with a previously set file image
@@ -449,55 +459,68 @@ test_callbacks(void)
/* Copy fapl */
reset_udata(udata);
- if((fapl_2 = H5Pcopy(fapl_1)) < 0) FAIL_STACK_ERROR
+ if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
+ FAIL_STACK_ERROR
/* Verify that the property's copy callback used the correct image callbacks */
- VERIFY(udata->used_callbacks == (MALLOC | MEMCPY | UDATA_COPY), "Copying a fapl with an image used incorrect callbacks");
+ VERIFY(udata->used_callbacks == (MALLOC | MEMCPY | UDATA_COPY),
+ "Copying a fapl with an image used incorrect callbacks");
VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, "malloc callback has wrong source");
VERIFY(udata->memcpy_src == H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, "memcpy callback has wrong source");
/* Close fapl */
reset_udata(udata);
- if(H5Pclose(fapl_2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl_2) < 0)
+ FAIL_STACK_ERROR
/* Verify that the udata free callback was used */
- VERIFY(udata->used_callbacks == (FREE | UDATA_FREE), "Closing a fapl with an image used incorrect callbacks");
+ VERIFY(udata->used_callbacks == (FREE | UDATA_FREE),
+ "Closing a fapl with an image used incorrect callbacks");
VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, "free callback has wrong source");
/* Copy again */
- if((fapl_2 = H5Pcopy(fapl_1)) < 0) FAIL_STACK_ERROR
+ if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
+ FAIL_STACK_ERROR
/* Remove property from fapl */
reset_udata(udata);
- if(H5Premove(fapl_2, H5F_ACS_FILE_IMAGE_INFO_NAME) < 0) FAIL_STACK_ERROR
+ if (H5Premove(fapl_2, H5F_ACS_FILE_IMAGE_INFO_NAME) < 0)
+ FAIL_STACK_ERROR
/* Verify that the property's delete callback was called using the correct image callbacks */
- VERIFY(udata->used_callbacks == (FREE | UDATA_FREE), "Removing a property from a fapl with an image used incorrect callbacks");
+ VERIFY(udata->used_callbacks == (FREE | UDATA_FREE),
+ "Removing a property from a fapl with an image used incorrect callbacks");
VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, "free callback has wrong source");
/* Close it again */
- if(H5Pclose(fapl_2) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl_2) < 0)
+ FAIL_STACK_ERROR
/* Get file image */
reset_udata(udata);
- if(H5Pget_file_image(fapl_1, (void **)&temp_file_image, &temp_size) < 0) FAIL_STACK_ERROR
+ if (H5Pget_file_image(fapl_1, (void **)&temp_file_image, &temp_size) < 0)
+ FAIL_STACK_ERROR
/* Verify that the correct callbacks were used */
- VERIFY(udata->used_callbacks == (MALLOC | MEMCPY), "attempting to retrieve the image from a fapl with an image has an unexpected callback");
+ VERIFY(udata->used_callbacks == (MALLOC | MEMCPY),
+ "attempting to retrieve the image from a fapl with an image has an unexpected callback");
VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, "malloc callback has wrong source");
VERIFY(udata->memcpy_src == H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, "memcpy callback has wrong source");
/* Set file image */
reset_udata(udata);
- if(H5Pset_file_image(fapl_1, (void *)file_image, size) < 0) FAIL_STACK_ERROR
+ if (H5Pset_file_image(fapl_1, (void *)file_image, size) < 0)
+ FAIL_STACK_ERROR
- VERIFY(udata->used_callbacks == (FREE | MALLOC | MEMCPY), "Setting a file image (second time) used incorrect callbacks");
+ VERIFY(udata->used_callbacks == (FREE | MALLOC | MEMCPY),
+ "Setting a file image (second time) used incorrect callbacks");
VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, "malloc callback has wrong source");
VERIFY(udata->memcpy_src == H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, "memcpy callback has wrong source");
VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, "freec callback has wrong source");
/* Close stuff */
- if(H5Pclose(fapl_1) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl_1) < 0)
+ FAIL_STACK_ERROR
HDfree(file_image);
HDfree(temp_file_image);
HDfree(udata);
@@ -509,7 +532,6 @@ error:
return 1;
} /* test_callbacks() */
-
/******************************************************************************
* Function: test_core
*
@@ -524,22 +546,22 @@ error:
static int
test_core(void)
{
- hid_t fapl;
- hid_t file;
- hid_t dset;
- hid_t space;
- udata_t *udata;
- unsigned char *file_image;
- char filename[1024];
- char copied_filename[1024];
- const char *tmp = NULL;
- size_t size;
- hsize_t dims[2];
- int fd;
- h5_stat_t sb;
- herr_t ret;
- H5FD_file_image_callbacks_t callbacks = {&malloc_cb, &memcpy_cb, &realloc_cb,
- &free_cb, &udata_copy_cb, &udata_free_cb, NULL};
+ hid_t fapl;
+ hid_t file;
+ hid_t dset;
+ hid_t space;
+ udata_t * udata;
+ unsigned char * file_image;
+ char filename[1024];
+ char copied_filename[1024];
+ const char * tmp = NULL;
+ size_t size;
+ hsize_t dims[2];
+ int fd;
+ h5_stat_t sb;
+ herr_t ret;
+ H5FD_file_image_callbacks_t callbacks = {&malloc_cb, &memcpy_cb, &realloc_cb, &free_cb,
+ &udata_copy_cb, &udata_free_cb, NULL};
TESTING("Initial file image and callbacks in Core VFD");
@@ -579,16 +601,18 @@ test_core(void)
reset_udata(udata);
file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl);
VERIFY(file >= 0, "H5Fopen failed");
- VERIFY((udata->used_callbacks == MALLOC) ||
- (udata->used_callbacks == (MALLOC | UDATA_COPY | UDATA_FREE)), "opening a core file used the wrong callbacks");
- VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN, "Malloc callback came from wrong sourc in core open");
+ VERIFY((udata->used_callbacks == MALLOC) || (udata->used_callbacks == (MALLOC | UDATA_COPY | UDATA_FREE)),
+ "opening a core file used the wrong callbacks");
+ VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN,
+ "Malloc callback came from wrong sourc in core open");
/* Close file */
reset_udata(udata);
ret = H5Fclose(file);
VERIFY(ret >= 0, "H5Fclose failed");
VERIFY(udata->used_callbacks == FREE, "Closing a core file used the wrong callbacks");
- VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_FILE_CLOSE, "Free callback came from wrong sourc in core close");
+ VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_FILE_CLOSE,
+ "Free callback came from wrong sourc in core close");
/* Reopen file */
file = H5Fopen(copied_filename, H5F_ACC_RDWR, fapl);
@@ -597,19 +621,20 @@ test_core(void)
/* Set up a new dset */
dims[0] = DIM0;
dims[1] = DIM1;
- space = H5Screate_simple(RANK, dims, dims);
+ space = H5Screate_simple(RANK, dims, dims);
VERIFY(space >= 0, "H5Screate failed");
/* Create new dset, invoking H5FD_core_write */
reset_udata(udata);
dset = H5Dcreate2(file, DSET_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(dset >=0, "H5Dcreate failed");
+ VERIFY(dset >= 0, "H5Dcreate failed");
/* Flush the write and check the realloc callback */
ret = H5Fflush(file, H5F_SCOPE_LOCAL);
VERIFY(ret >= 0, "H5Fflush failed");
VERIFY(udata->used_callbacks == (REALLOC), "core write used the wrong callbacks");
- VERIFY(udata->realloc_src == H5FD_FILE_IMAGE_OP_FILE_RESIZE, "Realloc callback came from wrong source in core write");
+ VERIFY(udata->realloc_src == H5FD_FILE_IMAGE_OP_FILE_RESIZE,
+ "Realloc callback came from wrong source in core write");
/* Close dset and space */
ret = H5Dclose(dset);
@@ -622,26 +647,30 @@ test_core(void)
ret = H5Fclose(file);
VERIFY(ret >= 0, "H5Fclose failed");
VERIFY(udata->used_callbacks == (FREE), "Closing a core file used the wrong callbacks");
- VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_FILE_CLOSE, "Free callback came from wrong sourc in core close");
+ VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_FILE_CLOSE,
+ "Free callback came from wrong sourc in core close");
/* Create file image buffer */
fd = HDopen(copied_filename, O_RDONLY);
VERIFY(fd > 0, "open failed");
ret = HDfstat(fd, &sb);
VERIFY(ret == 0, "fstat failed");
- size = (size_t)sb.st_size;
+ size = (size_t)sb.st_size;
file_image = (unsigned char *)HDmalloc(size);
- if(HDread(fd, file_image, size) < 0)
+ if (HDread(fd, file_image, size) < 0)
FAIL_PUTS_ERROR("unable to read from file descriptor");
ret = HDclose(fd);
VERIFY(ret == 0, "close failed");
/* Set file image in plist */
- if(H5Pset_file_image(fapl, file_image, size) < 0) FAIL_STACK_ERROR
+ if (H5Pset_file_image(fapl, file_image, size) < 0)
+ FAIL_STACK_ERROR
/* Test open with file image */
- if((file = H5Fopen("dne.h5", H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fopen("dne.h5", H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Release resources */
h5_clean_files(FILENAME, fapl);
@@ -657,7 +686,6 @@ error:
return 1;
} /* end test_core() */
-
/******************************************************************************
* Function: test_get_file_image
*
@@ -680,35 +708,32 @@ error:
*/
H5_GCC_DIAG_OFF("format-nonliteral")
static int
-test_get_file_image(const char * test_banner,
- const int file_name_num,
- hid_t fapl,
- hbool_t user)
+test_get_file_image(const char *test_banner, const int file_name_num, hid_t fapl, hbool_t user)
{
- char file_name[1024] = "\0";
- void * insertion_ptr = NULL;
- void * image_ptr = NULL;
- void * file_image_ptr = NULL;
- hbool_t is_family_file = FALSE;
- hbool_t identical;
- int data[100];
- int i;
- int fd = -1;
- int result;
- hid_t driver = -1;
- hid_t file_id = -1;
- hid_t dset_id = -1;
- hid_t space_id = -1;
- hid_t core_fapl_id = -1;
- hid_t core_file_id = -1;
- herr_t err;
- hsize_t dims[2];
- ssize_t bytes_read;
- ssize_t image_size;
- ssize_t file_size;
+ char file_name[1024] = "\0";
+ void * insertion_ptr = NULL;
+ void * image_ptr = NULL;
+ void * file_image_ptr = NULL;
+ hbool_t is_family_file = FALSE;
+ hbool_t identical;
+ int data[100];
+ int i;
+ int fd = -1;
+ int result;
+ hid_t driver = -1;
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t space_id = -1;
+ hid_t core_fapl_id = -1;
+ hid_t core_file_id = -1;
+ herr_t err;
+ hsize_t dims[2];
+ ssize_t bytes_read;
+ ssize_t image_size;
+ ssize_t file_size;
h5_stat_t stat_buf;
- hid_t fcpl = -1;
- herr_t ret;
+ hid_t fcpl = -1;
+ herr_t ret;
TESTING(test_banner);
@@ -716,18 +741,18 @@ test_get_file_image(const char * test_banner,
driver = H5Pget_driver(fapl);
VERIFY(driver >= 0, "H5Pget_driver(fapl) failed");
- if(driver == H5FD_FAMILY)
+ if (driver == H5FD_FAMILY)
is_family_file = TRUE;
/* setup the file name */
h5_fixname(FILENAME2[file_name_num], fapl, file_name, sizeof(file_name));
- VERIFY(HDstrlen(file_name)>0, "h5_fixname failed");
+ VERIFY(HDstrlen(file_name) > 0, "h5_fixname failed");
fcpl = H5Pcreate(H5P_FILE_CREATE);
VERIFY(fcpl >= 0, "H5Pcreate");
- if(user) {
+ if (user) {
ret = H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE);
- VERIFY(ret >=0, "H5Pset_userblock");
+ VERIFY(ret >= 0, "H5Pset_userblock");
}
/* create the file */
@@ -735,15 +760,14 @@ test_get_file_image(const char * test_banner,
VERIFY(file_id >= 0, "H5Fcreate() failed.");
/* Set up data space for new new data set */
- dims[0] = 10;
- dims[1] = 10;
+ dims[0] = 10;
+ dims[1] = 10;
space_id = H5Screate_simple(2, dims, dims);
VERIFY(space_id >= 0, "H5Screate() failed");
/* Create a dataset */
- dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(dset_id >=0, "H5Dcreate() failed");
+ dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(dset_id >= 0, "H5Dcreate() failed");
/* write some data to the data set */
for (i = 0; i < 100; i++)
@@ -777,17 +801,17 @@ test_get_file_image(const char * test_banner,
err = H5Fclose(file_id);
VERIFY(err == SUCCEED, "H5Fclose(file_id) failed.");
- if(is_family_file) {
- char member_file_name[1024];
+ if (is_family_file) {
+ char member_file_name[1024];
ssize_t bytes_to_read;
ssize_t member_size;
ssize_t size_remaining;
- /*
+ /*
* Modifications need to be made to accommodate userblock when
* H5Fget_file_image() works for family driver
*/
- i = 0;
+ i = 0;
file_size = 0;
do {
@@ -801,7 +825,7 @@ test_get_file_image(const char * test_banner,
i++;
file_size += member_size;
- } while(member_size > 0);
+ } while (member_size > 0);
/* Since we use the eoa to calculate the image size, the file size
* may be larger. This is OK, as long as (in this specialized instance)
@@ -814,10 +838,10 @@ test_get_file_image(const char * test_banner,
VERIFY(file_image_ptr != NULL, "HDmalloc(2f) failed.");
size_remaining = image_size;
- insertion_ptr = file_image_ptr;
- i = 0;
+ insertion_ptr = file_image_ptr;
+ i = 0;
- while(size_remaining > 0) {
+ while (size_remaining > 0) {
/* construct the member file name */
HDsnprintf(member_file_name, 1024, file_name, i);
@@ -825,11 +849,12 @@ test_get_file_image(const char * test_banner,
fd = HDopen(member_file_name, O_RDONLY);
VERIFY(fd >= 0, "HDopen() failed.");
- if(size_remaining >= FAMILY_SIZE ){
- bytes_to_read = FAMILY_SIZE;
+ if (size_remaining >= FAMILY_SIZE) {
+ bytes_to_read = FAMILY_SIZE;
size_remaining -= FAMILY_SIZE;
- } else {
- bytes_to_read = size_remaining;
+ }
+ else {
+ bytes_to_read = size_remaining;
size_remaining = 0;
}
@@ -845,7 +870,8 @@ test_get_file_image(const char * test_banner,
result = HDclose(fd);
VERIFY(result == 0, "HDclose() failed.");
}
- } else {
+ }
+ else {
/* get the size of the test file */
result = HDstat(file_name, &stat_buf);
VERIFY(result == 0, "HDstat() failed.");
@@ -855,12 +881,12 @@ test_get_file_image(const char * test_banner,
* the remainder of the file is all '\0's.
*/
file_size = (ssize_t)stat_buf.st_size;
- if(user) {
+ if (user) {
VERIFY(file_size > USERBLOCK_SIZE, "file size !> userblock size.");
file_size -= USERBLOCK_SIZE;
}
- /* with latest mods to truncate call in core file drive,
+ /* with latest mods to truncate call in core file drive,
* file size should match image size
*/
VERIFY(file_size == image_size, "file size != image size.");
@@ -873,7 +899,7 @@ test_get_file_image(const char * test_banner,
fd = HDopen(file_name, O_RDONLY);
VERIFY(fd >= 0, "HDopen() failed.");
- if(user) {
+ if (user) {
HDoff_t off;
/* Position at userblock */
@@ -892,20 +918,19 @@ test_get_file_image(const char * test_banner,
/* verify that the file and the image contain the same data */
identical = TRUE;
- i = 0;
- while((i < (int)image_size) && identical) {
- if(((char *)image_ptr)[i] != ((char *)file_image_ptr)[i])
+ i = 0;
+ while ((i < (int)image_size) && identical) {
+ if (((char *)image_ptr)[i] != ((char *)file_image_ptr)[i])
identical = FALSE;
i++;
}
VERIFY(identical, "file and image differ.");
-
/* finally, verify that we can use the core file driver to open the image */
/* create fapl for core file driver */
core_fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- VERIFY(core_fapl_id >=0, "H5Pcreate() failed");
+ VERIFY(core_fapl_id >= 0, "H5Pcreate() failed");
/* setup core_fapl_id to use the core file driver */
err = H5Pset_fapl_core(core_fapl_id, (size_t)(64 * 1024), FALSE);
@@ -931,11 +956,11 @@ test_get_file_image(const char * test_banner,
h5_clean_files(FILENAME2, fapl);
/* discard the image buffer if it exists */
- if(image_ptr != NULL)
+ if (image_ptr != NULL)
HDfree(image_ptr);
/* discard the image buffer if it exists */
- if(file_image_ptr != NULL)
+ if (file_image_ptr != NULL)
HDfree(file_image_ptr);
PASSED();
@@ -947,7 +972,6 @@ error:
} /* end test_get_file_image() */
H5_GCC_DIAG_ON("format-nonliteral")
-
/******************************************************************************
* Function: test_get_file_image_error_rejection
*
@@ -964,24 +988,23 @@ H5_GCC_DIAG_ON("format-nonliteral")
static int
test_get_file_image_error_rejection(void)
{
- const char *memb_name[H5FD_MEM_NTYPES];
- char file_name[1024] = "\0";
- void * image_ptr = NULL;
- int data[100];
- int i;
- hid_t fapl_id = -1;
- hid_t file_id = -1;
- hid_t dset_id = -1;
- hid_t space_id = -1;
- herr_t err;
- hsize_t dims[2];
- ssize_t bytes_read;
- ssize_t image_size;
- hid_t memb_fapl[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- H5FD_mem_t mt;
- H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
-
+ const char *memb_name[H5FD_MEM_NTYPES];
+ char file_name[1024] = "\0";
+ void * image_ptr = NULL;
+ int data[100];
+ int i;
+ hid_t fapl_id = -1;
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t space_id = -1;
+ herr_t err;
+ hsize_t dims[2];
+ ssize_t bytes_read;
+ ssize_t image_size;
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ H5FD_mem_t mt;
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
TESTING("H5Fget_file_image() error rejection");
@@ -997,7 +1020,6 @@ test_get_file_image_error_rejection(void)
* good id, but not a file id
*/
-
/* setup fapl -- driver type doesn't matter much, so make it stdio */
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
VERIFY(fapl_id >= 0, "H5Pcreate(1) failed");
@@ -1007,28 +1029,26 @@ test_get_file_image_error_rejection(void)
/* setup the file name */
h5_fixname(FILENAME2[6], fapl_id, file_name, sizeof(file_name));
- VERIFY(HDstrlen(file_name)>0, "h5_fixname failed");
+ VERIFY(HDstrlen(file_name) > 0, "h5_fixname failed");
/* create the file */
file_id = H5Fcreate(file_name, 0, H5P_DEFAULT, fapl_id);
VERIFY(file_id >= 0, "H5Fcreate() failed.");
/* Set up data space for new new data set */
- dims[0] = 10;
- dims[1] = 10;
+ dims[0] = 10;
+ dims[1] = 10;
space_id = H5Screate_simple(2, dims, dims);
VERIFY(space_id >= 0, "H5Screate() failed");
/* Create a dataset */
- dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(dset_id >=0, "H5Dcreate() failed");
+ dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(dset_id >= 0, "H5Dcreate() failed");
/* write some data to the data set */
for (i = 0; i < 100; i++)
data[i] = i;
- err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, (void *)data);
+ err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)data);
VERIFY(err >= 0, "H5Dwrite() failed.");
/* Flush the file */
@@ -1044,25 +1064,22 @@ test_get_file_image_error_rejection(void)
VERIFY(image_ptr != NULL, "HDmalloc(1) failed.");
/* load the image of the file into the buffer */
- H5E_BEGIN_TRY {
- bytes_read = H5Fget_file_image(file_id, image_ptr, (size_t)(image_size - 1));
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { bytes_read = H5Fget_file_image(file_id, image_ptr, (size_t)(image_size - 1)); }
+ H5E_END_TRY;
VERIFY(bytes_read < 0, "H5Fget_file_image(2 -- test 1) succeeded.");
/* Call H5Fget_file_image() with good buffer and buffer size,
* but non-existant file_id. Should fail.
*/
- H5E_BEGIN_TRY {
- bytes_read = H5Fget_file_image((hid_t)0, image_ptr, (size_t)(image_size));
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { bytes_read = H5Fget_file_image((hid_t)0, image_ptr, (size_t)(image_size)); }
+ H5E_END_TRY;
VERIFY(bytes_read < 0, "H5Fget_file_image(3 -- test 1) succeeded.");
/* Call H5Fget_file_image() with good buffer and buffer size,
* but a file_id of the wrong type. Should fail.
*/
- H5E_BEGIN_TRY {
- bytes_read = H5Fget_file_image(dset_id, image_ptr, (size_t)(image_size));
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { bytes_read = H5Fget_file_image(dset_id, image_ptr, (size_t)(image_size)); }
+ H5E_END_TRY;
VERIFY(bytes_read < 0, "H5Fget_file_image(4 -- test 1) succeeded.");
/* Close dset and space */
@@ -1079,7 +1096,7 @@ test_get_file_image_error_rejection(void)
h5_clean_files(FILENAME2, fapl_id);
/* discard the image buffer if it exists */
- if(image_ptr != NULL)
+ if (image_ptr != NULL)
HDfree(image_ptr);
/************************** Test #2 **********************************/
@@ -1088,7 +1105,7 @@ test_get_file_image_error_rejection(void)
*/
/* setup parameters for multi file driver */
- for(mt = (H5FD_mem_t)0; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ for (mt = (H5FD_mem_t)0; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
memb_addr[mt] = HADDR_UNDEF;
memb_fapl[mt] = H5P_DEFAULT;
memb_map[mt] = H5FD_MEM_DRAW;
@@ -1105,10 +1122,10 @@ test_get_file_image_error_rejection(void)
memb_name[H5FD_MEM_BTREE] = "%s-b.h5";
memb_addr[H5FD_MEM_BTREE] = memb_addr[H5FD_MEM_SUPER] + TYPE_SLICE;
- memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
- memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
- memb_name[H5FD_MEM_DRAW] = "%s-r.h5";
- memb_addr[H5FD_MEM_DRAW] = memb_addr[H5FD_MEM_BTREE] + TYPE_SLICE;
+ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
+ memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
+ memb_name[H5FD_MEM_DRAW] = "%s-r.h5";
+ memb_addr[H5FD_MEM_DRAW] = memb_addr[H5FD_MEM_BTREE] + TYPE_SLICE;
memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP;
memb_fapl[H5FD_MEM_GHEAP] = H5P_DEFAULT;
@@ -1120,44 +1137,41 @@ test_get_file_image_error_rejection(void)
memb_name[H5FD_MEM_LHEAP] = "%s-l.h5";
memb_addr[H5FD_MEM_LHEAP] = memb_addr[H5FD_MEM_GHEAP] + TYPE_SLICE;
- memb_map[H5FD_MEM_OHDR] = H5FD_MEM_OHDR;
- memb_fapl[H5FD_MEM_OHDR] = H5P_DEFAULT;
- memb_name[H5FD_MEM_OHDR] = "%s-o.h5";
- memb_addr[H5FD_MEM_OHDR] = memb_addr[H5FD_MEM_LHEAP] + TYPE_SLICE;
+ memb_map[H5FD_MEM_OHDR] = H5FD_MEM_OHDR;
+ memb_fapl[H5FD_MEM_OHDR] = H5P_DEFAULT;
+ memb_name[H5FD_MEM_OHDR] = "%s-o.h5";
+ memb_addr[H5FD_MEM_OHDR] = memb_addr[H5FD_MEM_LHEAP] + TYPE_SLICE;
/* setup fapl */
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
VERIFY(fapl_id >= 0, "H5Pcreate(2) failed");
/* setup the fapl for the multi file driver */
- err = H5Pset_fapl_multi(fapl_id, memb_map, memb_fapl, memb_name,
- memb_addr, FALSE);
+ err = H5Pset_fapl_multi(fapl_id, memb_map, memb_fapl, memb_name, memb_addr, FALSE);
VERIFY(err >= 0, "H5Pset_fapl_multi failed");
/* setup the file name */
h5_fixname(FILENAME2[4], fapl_id, file_name, sizeof(file_name));
- VERIFY(HDstrlen(file_name)>0, "h5_fixname failed");
+ VERIFY(HDstrlen(file_name) > 0, "h5_fixname failed");
/* create the file */
file_id = H5Fcreate(file_name, 0, H5P_DEFAULT, fapl_id);
VERIFY(file_id >= 0, "H5Fcreate() failed.");
/* Set up data space for new new data set */
- dims[0] = 10;
- dims[1] = 10;
+ dims[0] = 10;
+ dims[1] = 10;
space_id = H5Screate_simple(2, dims, dims);
VERIFY(space_id >= 0, "H5Screate() failed");
/* Create a dataset */
- dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(dset_id >=0, "H5Dcreate() failed");
+ dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(dset_id >= 0, "H5Dcreate() failed");
/* write some data to the data set */
for (i = 0; i < 100; i++)
data[i] = i;
- err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, (void *)data);
+ err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)data);
VERIFY(err >= 0, "H5Dwrite() failed.");
/* Flush the file */
@@ -1165,9 +1179,8 @@ test_get_file_image_error_rejection(void)
VERIFY(err >= 0, "H5Fflush failed");
/* attempt to get the size of the file -- should fail */
- H5E_BEGIN_TRY {
- image_size = H5Fget_file_image(file_id, NULL, (size_t)0);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { image_size = H5Fget_file_image(file_id, NULL, (size_t)0); }
+ H5E_END_TRY;
VERIFY(image_size == -1, "H5Fget_file_image(5) succeeded.");
/* Close dset and space */
@@ -1198,28 +1211,26 @@ test_get_file_image_error_rejection(void)
/* setup the file name */
h5_fixname(FILENAME2[5], fapl_id, file_name, sizeof(file_name));
- VERIFY(HDstrlen(file_name)>0, "h5_fixname failed");
+ VERIFY(HDstrlen(file_name) > 0, "h5_fixname failed");
/* create the file */
file_id = H5Fcreate(file_name, 0, H5P_DEFAULT, fapl_id);
VERIFY(file_id >= 0, "H5Fcreate() failed.");
/* Set up data space for new new data set */
- dims[0] = 10;
- dims[1] = 10;
+ dims[0] = 10;
+ dims[1] = 10;
space_id = H5Screate_simple(2, dims, dims);
VERIFY(space_id >= 0, "H5Screate() failed");
/* Create a dataset */
- dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(dset_id >=0, "H5Dcreate() failed");
+ dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(dset_id >= 0, "H5Dcreate() failed");
/* write some data to the data set */
for (i = 0; i < 100; i++)
data[i] = i;
- err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, (void *)data);
+ err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)data);
VERIFY(err >= 0, "H5Dwrite() failed.");
/* Flush the file */
@@ -1227,9 +1238,8 @@ test_get_file_image_error_rejection(void)
VERIFY(err >= 0, "H5Fflush failed");
/* attempt to get the size of the file -- should fail */
- H5E_BEGIN_TRY {
- image_size = H5Fget_file_image(file_id, NULL, (size_t)0);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { image_size = H5Fget_file_image(file_id, NULL, (size_t)0); }
+ H5E_END_TRY;
VERIFY(image_size == -1, "H5Fget_file_image(6) succeeded.");
/* Close dset and space */
@@ -1258,28 +1268,26 @@ test_get_file_image_error_rejection(void)
VERIFY(err >= 0, "H5Pset_fapl_family failed");
h5_fixname(FILENAME2[3], fapl_id, file_name, sizeof(file_name));
- VERIFY(HDstrlen(file_name)>0, "h5_fixname failed");
+ VERIFY(HDstrlen(file_name) > 0, "h5_fixname failed");
/* create the file */
file_id = H5Fcreate(file_name, 0, H5P_DEFAULT, fapl_id);
VERIFY(file_id >= 0, "H5Fcreate() failed.");
/* Set up data space for new new data set */
- dims[0] = 10;
- dims[1] = 10;
+ dims[0] = 10;
+ dims[1] = 10;
space_id = H5Screate_simple(2, dims, dims);
VERIFY(space_id >= 0, "H5Screate() failed");
/* Create a dataset */
- dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(dset_id >=0, "H5Dcreate() failed");
+ dset_id = H5Dcreate2(file_id, "dset 0", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(dset_id >= 0, "H5Dcreate() failed");
/* write some data to the data set */
for (i = 0; i < 100; i++)
data[i] = i;
- err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, (void *)data);
+ err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)data);
VERIFY(err >= 0, "H5Dwrite() failed.");
/* Flush the file */
@@ -1287,9 +1295,8 @@ test_get_file_image_error_rejection(void)
VERIFY(err >= 0, "H5Fflush failed");
/* attempt to get the size of the file -- should fail */
- H5E_BEGIN_TRY {
- image_size = H5Fget_file_image(file_id, NULL, (size_t)0);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { image_size = H5Fget_file_image(file_id, NULL, (size_t)0); }
+ H5E_END_TRY;
VERIFY(image_size == -1, "H5Fget_file_image(7) succeeded.");
/* Close dset and space */
@@ -1320,8 +1327,8 @@ error:
int
main(void)
{
- int errors = 0;
- hid_t fapl;
+ int errors = 0;
+ hid_t fapl;
unsigned user;
h5_reset();
@@ -1333,33 +1340,30 @@ main(void)
errors += test_core();
/* Perform tests with/without user block */
- for(user = FALSE; user <= TRUE; user++) {
-
- /* test H5Fget_file_image() with sec2 driver */
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(H5Pset_fapl_sec2(fapl) < 0)
- errors++;
- else
- errors += test_get_file_image("H5Fget_file_image() with sec2 driver",
- 0, fapl, user);
-
- /* test H5Fget_file_image() with stdio driver */
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(H5Pset_fapl_stdio(fapl) < 0)
- errors++;
- else
- errors += test_get_file_image("H5Fget_file_image() with stdio driver",
- 1, fapl, user);
-
- /* test H5Fget_file_image() with core driver */
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(H5Pset_fapl_core(fapl, (size_t)(64 *1024), TRUE) < 0)
- errors++;
- else
- errors += test_get_file_image("H5Fget_file_image() with core driver",
- 2, fapl, user);
-
- } /* end for */
+ for (user = FALSE; user <= TRUE; user++) {
+
+ /* test H5Fget_file_image() with sec2 driver */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ if (H5Pset_fapl_sec2(fapl) < 0)
+ errors++;
+ else
+ errors += test_get_file_image("H5Fget_file_image() with sec2 driver", 0, fapl, user);
+
+ /* test H5Fget_file_image() with stdio driver */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ if (H5Pset_fapl_stdio(fapl) < 0)
+ errors++;
+ else
+ errors += test_get_file_image("H5Fget_file_image() with stdio driver", 1, fapl, user);
+
+ /* test H5Fget_file_image() with core driver */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ if (H5Pset_fapl_core(fapl, (size_t)(64 * 1024), TRUE) < 0)
+ errors++;
+ else
+ errors += test_get_file_image("H5Fget_file_image() with core driver", 2, fapl, user);
+
+ } /* end for */
#if 0
/* at present, H5Fget_file_image() rejects files opened with the
@@ -1386,13 +1390,11 @@ main(void)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- if(errors) {
- HDprintf("***** %d File Image TEST%s FAILED! *****\n",
- errors, errors > 1 ? "S" : "");
+ if (errors) {
+ HDprintf("***** %d File Image TEST%s FAILED! *****\n", errors, errors > 1 ? "S" : "");
return 1;
}
HDprintf("All File Image tests passed.\n");
return 0;
}
-
diff --git a/test/filenotclosed.c b/test/filenotclosed.c
index 2d050eb..13ce9fd 100644
--- a/test/filenotclosed.c
+++ b/test/filenotclosed.c
@@ -16,11 +16,10 @@
* application does not close the file. (See HDFFV-10160)
*/
-
#include "h5test.h"
-#define FILENAME "filenotclosed"
-#define DATASET_NAME "dset"
+#define FILENAME "filenotclosed"
+#define DATASET_NAME "dset"
/*-------------------------------------------------------------------------
* Function: catch_signal
@@ -33,12 +32,12 @@
*
*-------------------------------------------------------------------------
*/
-static void catch_signal(int H5_ATTR_UNUSED signo)
+static void
+catch_signal(int H5_ATTR_UNUSED signo)
{
HDexit(EXIT_FAILURE);
} /* catch_signal() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -55,22 +54,22 @@ static void catch_signal(int H5_ATTR_UNUSED signo)
int
main(void)
{
- hid_t fapl = -1; /* File access property lists */
- hid_t fid = -1; /* File ID */
- hid_t did = -1; /* Dataset ID */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t sid = -1; /* Dataspace ID */
- hsize_t cur_dim[1] = {5}; /* Current dimension sizes */
- hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dim[1] = {10}; /* Chunk dimension sizes */
- int buf[5] = {1, 2, 3, 4, 5}; /* The data to be written to the dataset */
- char filename[100]; /* File name */
- const char *env_h5_drvr; /* File Driver value from environment */
- hbool_t contig_addr_vfd; /* Contiguous address vfd */
-
- /* Get the VFD to use */
+ hid_t fapl = -1; /* File access property lists */
+ hid_t fid = -1; /* File ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t cur_dim[1] = {5}; /* Current dimension sizes */
+ hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dim[1] = {10}; /* Chunk dimension sizes */
+ int buf[5] = {1, 2, 3, 4, 5}; /* The data to be written to the dataset */
+ char filename[100]; /* File name */
+ const char *env_h5_drvr; /* File Driver value from environment */
+ hbool_t contig_addr_vfd; /* Contiguous address vfd */
+
+ /* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
/* Skip test when using VFDs that has different address spaces for each
@@ -79,7 +78,7 @@ main(void)
* split/multi driver. Please see HDFFV-10160.
*/
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(!contig_addr_vfd) {
+ if (!contig_addr_vfd) {
SKIPPED();
puts(" Temporary skipped for a spilt/multi driver");
HDexit(EXIT_SUCCESS);
@@ -88,51 +87,51 @@ main(void)
h5_reset();
/* To exit from the file for SIGABRT signal */
- if(HDsignal(SIGABRT, catch_signal) == SIG_ERR)
+ if (HDsignal(SIGABRT, catch_signal) == SIG_ERR)
TEST_ERROR
fapl = h5_fileaccess();
h5_fixname(FILENAME, fapl, filename, sizeof(filename));
/* Set to latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
/* Create the file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create the dcpl and set the chunk size */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
TEST_ERROR
/* Create the dataspace */
- if((sid = H5Screate_simple(1, cur_dim, max_dim)) < 0)
+ if ((sid = H5Screate_simple(1, cur_dim, max_dim)) < 0)
TEST_ERROR
/* Create the dataset */
- if((did = H5Dcreate2(fid, DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
/* Close the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/* Close the property lists */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
/* The file is not closed. */
diff --git a/test/fillval.c b/test/fillval.c
index 5ea296d..05570f0 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -26,18 +26,8 @@
*/
/* #define NO_FILLING */
-const char *FILENAME[] = {
- "fillval_1",
- "fillval_2",
- "fillval_3",
- "fillval_4",
- "fillval_5",
- "fillval_6",
- "fillval_7",
- "fillval_8",
- "fillval_9",
- NULL
-};
+const char *FILENAME[] = {"fillval_1", "fillval_2", "fillval_3", "fillval_4", "fillval_5",
+ "fillval_6", "fillval_7", "fillval_8", "fillval_9", NULL};
/* Common type for compound datatype operations */
typedef struct {
@@ -49,18 +39,17 @@ typedef struct {
/* Common type for compound+vl datatype operations */
typedef struct {
- int x;
- char *a;
- char *b;
- int y;
+ int x;
+ char *a;
+ char *b;
+ int y;
} comp_vl_datatype;
/* The fill_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory
* for version 1.4(after 1.4.3). To get this data file, simply compile
* gen_old_fill.c with HDF5 library (before v1.5) and run it. */
#define FILE_COMPATIBLE "fill_old.h5"
-#define FILE_NAME_RAW "fillval.raw"
-
+#define FILE_NAME_RAW "fillval.raw"
/*-------------------------------------------------------------------------
* Function: create_compound_type
@@ -78,31 +67,30 @@ typedef struct {
*
*-------------------------------------------------------------------------
*/
-static hid_t create_compound_type(void)
+static hid_t
+create_compound_type(void)
{
- hid_t ret_value=-1;
+ hid_t ret_value = -1;
- if((ret_value = H5Tcreate(H5T_COMPOUND, sizeof(comp_datatype))) < 0)
+ if ((ret_value = H5Tcreate(H5T_COMPOUND, sizeof(comp_datatype))) < 0)
+ goto error;
+ if (H5Tinsert(ret_value, "a", HOFFSET(comp_datatype, a), H5T_NATIVE_FLOAT) < 0)
goto error;
- if(H5Tinsert(ret_value, "a", HOFFSET(comp_datatype, a), H5T_NATIVE_FLOAT) < 0)
+ if (H5Tinsert(ret_value, "x", HOFFSET(comp_datatype, x), H5T_NATIVE_INT) < 0)
goto error;
- if(H5Tinsert(ret_value, "x", HOFFSET(comp_datatype, x), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(ret_value, "y", HOFFSET(comp_datatype, y), H5T_NATIVE_DOUBLE) < 0)
goto error;
- if(H5Tinsert(ret_value, "y", HOFFSET(comp_datatype, y), H5T_NATIVE_DOUBLE) < 0)
+ if (H5Tinsert(ret_value, "z", HOFFSET(comp_datatype, z), H5T_NATIVE_CHAR) < 0)
goto error;
- if(H5Tinsert(ret_value, "z", HOFFSET(comp_datatype, z), H5T_NATIVE_CHAR) < 0)
- goto error;
return ret_value;
error:
- H5E_BEGIN_TRY {
- H5Tclose(ret_value);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Tclose(ret_value); }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_compound_vl_type
*
@@ -120,33 +108,42 @@ error:
static hid_t
create_compound_vl_type(void)
{
- hid_t str_id = -1; /* Datatype for VL-string fields */
+ hid_t str_id = -1; /* Datatype for VL-string fields */
hid_t ret_value = -1;
/* Create a string datatype */
- if((str_id = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if(H5Tset_size(str_id, H5T_VARIABLE) < 0) TEST_ERROR
-
- if((ret_value = H5Tcreate(H5T_COMPOUND, sizeof(comp_vl_datatype))) < 0) TEST_ERROR
- if(H5Tinsert(ret_value, "x", HOFFSET(comp_vl_datatype, x), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(ret_value, "a", HOFFSET(comp_vl_datatype, a), str_id) < 0) TEST_ERROR
- if(H5Tinsert(ret_value, "b", HOFFSET(comp_vl_datatype, b), str_id) < 0) TEST_ERROR
- if(H5Tinsert(ret_value, "y", HOFFSET(comp_vl_datatype, y), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if ((str_id = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR
+ if (H5Tset_size(str_id, H5T_VARIABLE) < 0)
+ TEST_ERROR
+
+ if ((ret_value = H5Tcreate(H5T_COMPOUND, sizeof(comp_vl_datatype))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(ret_value, "x", HOFFSET(comp_vl_datatype, x), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(ret_value, "a", HOFFSET(comp_vl_datatype, a), str_id) < 0)
+ TEST_ERROR
+ if (H5Tinsert(ret_value, "b", HOFFSET(comp_vl_datatype, b), str_id) < 0)
+ TEST_ERROR
+ if (H5Tinsert(ret_value, "y", HOFFSET(comp_vl_datatype, y), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Close string datatype */
- if(H5Tclose(str_id) < 0) TEST_ERROR
+ if (H5Tclose(str_id) < 0)
+ TEST_ERROR
return ret_value;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(str_id);
H5Tclose(ret_value);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end create_compound_vl_type() */
-
/*-------------------------------------------------------------------------
* Function: test_getset
*
@@ -167,15 +164,15 @@ error:
static int
test_getset(void)
{
- hid_t dcpl=-1;
- int fill_i;
- hid_t type_ss=-1, type_si=-1;
+ hid_t dcpl = -1;
+ int fill_i;
+ hid_t type_ss = -1, type_si = -1;
struct fill_si {
- int v1, v2;
- } fill_si;
+ int v1, v2;
+ } fill_si;
struct fill_ss {
- short v1, v2;
- } fill_ss, fill_ss_rd;
+ short v1, v2;
+ } fill_ss, fill_ss_rd;
TESTING("property lists");
@@ -183,33 +180,29 @@ test_getset(void)
* Create the dataset creation property list and the data types that will
* be used during this test.
*/
- if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if((type_ss=H5Tcreate(H5T_COMPOUND, sizeof fill_ss)) < 0 ||
- H5Tinsert(type_ss, "v1", HOFFSET(struct fill_ss, v1),
- H5T_NATIVE_SHORT) < 0 ||
- H5Tinsert(type_ss, "v2", HOFFSET(struct fill_ss, v2),
- H5T_NATIVE_SHORT) < 0) {
- goto error;
- }
- if((type_si=H5Tcreate(H5T_COMPOUND, sizeof fill_si)) < 0 ||
- H5Tinsert(type_si, "v1", HOFFSET(struct fill_si, v1),
- H5T_NATIVE_INT) < 0 ||
- H5Tinsert(type_si, "v2", HOFFSET(struct fill_si, v2),
- H5T_NATIVE_INT) < 0) {
- goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if ((type_ss = H5Tcreate(H5T_COMPOUND, sizeof fill_ss)) < 0 ||
+ H5Tinsert(type_ss, "v1", HOFFSET(struct fill_ss, v1), H5T_NATIVE_SHORT) < 0 ||
+ H5Tinsert(type_ss, "v2", HOFFSET(struct fill_ss, v2), H5T_NATIVE_SHORT) < 0) {
+ goto error;
+ }
+ if ((type_si = H5Tcreate(H5T_COMPOUND, sizeof fill_si)) < 0 ||
+ H5Tinsert(type_si, "v1", HOFFSET(struct fill_si, v1), H5T_NATIVE_INT) < 0 ||
+ H5Tinsert(type_si, "v2", HOFFSET(struct fill_si, v2), H5T_NATIVE_INT) < 0) {
+ goto error;
}
/*
* Reading the fill value from a dataset creation property list that has
* no fill value should result in a failure.
*/
- H5E_BEGIN_TRY {
- H5Pget_fill_value(dcpl, H5T_NATIVE_INT, &fill_i);
- } H5E_END_TRY;
- if(fill_i != 0) {
- H5_FAILED();
- puts(" H5Pget_fill_value() should return default 0");
- goto error;
+ H5E_BEGIN_TRY { H5Pget_fill_value(dcpl, H5T_NATIVE_INT, &fill_i); }
+ H5E_END_TRY;
+ if (fill_i != 0) {
+ H5_FAILED();
+ puts(" H5Pget_fill_value() should return default 0");
+ goto error;
}
/*
@@ -217,58 +210,67 @@ test_getset(void)
*/
fill_ss.v1 = 1111;
fill_ss.v2 = 2222;
- if(H5Pset_fill_value(dcpl, type_ss, &fill_ss) < 0) goto error;
+ if (H5Pset_fill_value(dcpl, type_ss, &fill_ss) < 0)
+ goto error;
/*
* Get the fill value using the same data type that was used to set it.
*/
- if(H5Pget_fill_value(dcpl, type_ss, &fill_ss_rd) < 0) goto error;
- if(fill_ss.v1!=fill_ss_rd.v1 || fill_ss.v2!=fill_ss_rd.v2) {
- H5_FAILED();
- puts(" Failed to get fill value using same data type that was ");
- puts(" used to set the fill value.");
- goto error;
+ if (H5Pget_fill_value(dcpl, type_ss, &fill_ss_rd) < 0)
+ goto error;
+ if (fill_ss.v1 != fill_ss_rd.v1 || fill_ss.v2 != fill_ss_rd.v2) {
+ H5_FAILED();
+ puts(" Failed to get fill value using same data type that was ");
+ puts(" used to set the fill value.");
+ goto error;
}
/*
* Get the fill value using some other data type.
*/
- if(H5Pget_fill_value(dcpl, type_si, &fill_si) < 0) goto error;
- if(fill_ss.v1!=fill_si.v1 || fill_ss.v2!=fill_si.v2) {
- H5_FAILED();
- puts(" Failed to get fill value using a data type other than what");
- puts(" was used to set the fill value.");
- goto error;
+ if (H5Pget_fill_value(dcpl, type_si, &fill_si) < 0)
+ goto error;
+ if (fill_ss.v1 != fill_si.v1 || fill_ss.v2 != fill_si.v2) {
+ H5_FAILED();
+ puts(" Failed to get fill value using a data type other than what");
+ puts(" was used to set the fill value.");
+ goto error;
}
/*
* Reset the fill value
*/
- if(H5Pset_fill_value(dcpl, type_si, &fill_si) < 0) goto error;
- if(H5Pget_fill_value(dcpl, type_ss, &fill_ss) < 0) goto error;
- if(fill_si.v1!=fill_ss.v1 || fill_si.v2!=fill_ss.v2) {
- H5_FAILED();
- puts(" Resetting the fill value was unsuccessful.");
- goto error;
+ if (H5Pset_fill_value(dcpl, type_si, &fill_si) < 0)
+ goto error;
+ if (H5Pget_fill_value(dcpl, type_ss, &fill_ss) < 0)
+ goto error;
+ if (fill_si.v1 != fill_ss.v1 || fill_si.v2 != fill_ss.v2) {
+ H5_FAILED();
+ puts(" Resetting the fill value was unsuccessful.");
+ goto error;
}
/* Success */
- if(H5Pclose(dcpl) < 0) goto error;
- if(H5Tclose(type_si) < 0) goto error;
- if(H5Tclose(type_ss) < 0) goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Tclose(type_si) < 0)
+ goto error;
+ if (H5Tclose(type_ss) < 0)
+ goto error;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- H5Tclose(type_si);
- H5Tclose(type_ss);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dcpl);
+ H5Tclose(type_si);
+ H5Tclose(type_ss);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_getset_vl
*
@@ -287,82 +289,102 @@ static int
test_getset_vl(hid_t fapl)
{
hsize_t dims[1] = {2};
- hid_t fileid = (-1), spaceid = (-1), dtypeid = (-1), datasetid = (-1), plistid = (-1);
- char fill_value[] = "aaaa";
- char orig_fill_value[] = "aaaa";
- char *f1 = fill_value;
- char *f2;
- char filename[1024];
+ hid_t fileid = (-1), spaceid = (-1), dtypeid = (-1), datasetid = (-1), plistid = (-1);
+ char fill_value[] = "aaaa";
+ char orig_fill_value[] = "aaaa";
+ char * f1 = fill_value;
+ char * f2;
+ char filename[1024];
TESTING("property lists, with variable-length datatype");
/* Create string type. */
- if((dtypeid = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if(H5Tset_size(dtypeid, H5T_VARIABLE) < 0) TEST_ERROR
+ if ((dtypeid = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR
+ if (H5Tset_size(dtypeid, H5T_VARIABLE) < 0)
+ TEST_ERROR
/* Set up dataset creation property list, with fill value */
- if((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_fill_value(plistid, dtypeid, &f1) < 0) TEST_ERROR
+ if ((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_fill_value(plistid, dtypeid, &f1) < 0)
+ TEST_ERROR
/* Modify original fill value string */
fill_value[0] = 'b';
/* Retrieve fill value from property */
- if(H5Pget_fill_value(plistid, dtypeid, &f2) < 0) TEST_ERROR
+ if (H5Pget_fill_value(plistid, dtypeid, &f2) < 0)
+ TEST_ERROR
/* Verify that the fill value is the original value */
- if(HDstrcmp(f2, orig_fill_value)) TEST_ERROR
+ if (HDstrcmp(f2, orig_fill_value))
+ TEST_ERROR
/* Release the fill value retrieved */
HDfree(f2);
/* Open file. */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fileid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fileid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Write an dataset of this type. */
- if((spaceid = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
- if((datasetid = H5Dcreate2(fileid, "Dataset", dtypeid, spaceid, H5P_DEFAULT, plistid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((datasetid = H5Dcreate2(fileid, "Dataset", dtypeid, spaceid, H5P_DEFAULT, plistid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close IDs (except datatype) */
- if(H5Dclose(datasetid) < 0) TEST_ERROR
- if(H5Pclose(plistid) < 0) TEST_ERROR
- if(H5Sclose(spaceid) < 0) TEST_ERROR
- if(H5Fclose(fileid) < 0) TEST_ERROR
-
+ if (H5Dclose(datasetid) < 0)
+ TEST_ERROR
+ if (H5Pclose(plistid) < 0)
+ TEST_ERROR
+ if (H5Sclose(spaceid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fileid) < 0)
+ TEST_ERROR
/* Re-open file, group & dataset */
- if((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
- if((datasetid = H5Dopen2(fileid, "Dataset", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((datasetid = H5Dopen2(fileid, "Dataset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Get dataset's creation property list */
- if((plistid = H5Dget_create_plist(datasetid)) < 0) TEST_ERROR
+ if ((plistid = H5Dget_create_plist(datasetid)) < 0)
+ TEST_ERROR
/* Query fill value */
- if(H5Pget_fill_value(plistid, dtypeid, &f2) < 0) TEST_ERROR
+ if (H5Pget_fill_value(plistid, dtypeid, &f2) < 0)
+ TEST_ERROR
/* Verify that the fill value is the original value */
- if(HDstrcmp(f2, orig_fill_value)) TEST_ERROR
+ if (HDstrcmp(f2, orig_fill_value))
+ TEST_ERROR
/* Release the fill value retrieved */
HDfree(f2);
/* Close IDs */
- if(H5Dclose(datasetid) < 0) TEST_ERROR
- if(H5Fclose(fileid) < 0) TEST_ERROR
- if(H5Pclose(plistid) < 0) TEST_ERROR
- if(H5Tclose(dtypeid) < 0) TEST_ERROR
+ if (H5Dclose(datasetid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fileid) < 0)
+ TEST_ERROR
+ if (H5Pclose(plistid) < 0)
+ TEST_ERROR
+ if (H5Tclose(dtypeid) < 0)
+ TEST_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY {}
+ H5E_END_TRY;
return 1;
} /* end test_getset_vl() */
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -384,346 +406,444 @@ test_getset_vl(hid_t fapl)
static int
test_create(hid_t fapl, const char *base_name, H5D_layout_t layout)
{
- hid_t file=-1, space=-1, dcpl=-1, comp_type_id=-1;
- hid_t dset1=-1, dset2=-1, dset3=-1, dset4=-1, dset5=-1,
- dset6=-1, /* dset7=-1, */ dset8=-1, dset9=-1;
- hsize_t cur_size[5] = {2, 8, 8, 4, 2};
- hsize_t ch_size[5] = {1, 1, 1, 4, 1};
- short rd_s, fill_s = 0x1234;
- long rd_l, fill_l = 0x4321;
- char filename[1024];
- H5D_space_status_t allocation;
- H5D_alloc_time_t alloc_time;
+ hid_t file = -1, space = -1, dcpl = -1, comp_type_id = -1;
+ hid_t dset1 = -1, dset2 = -1, dset3 = -1, dset4 = -1, dset5 = -1, dset6 = -1, /* dset7=-1, */ dset8 = -1,
+ dset9 = -1;
+ hsize_t cur_size[5] = {2, 8, 8, 4, 2};
+ hsize_t ch_size[5] = {1, 1, 1, 4, 1};
+ short rd_s, fill_s = 0x1234;
+ long rd_l, fill_l = 0x4321;
+ char filename[1024];
+ H5D_space_status_t allocation;
+ H5D_alloc_time_t alloc_time;
H5D_fill_time_t fill_time;
- comp_datatype rd_c, fill_ctype;
+ comp_datatype rd_c, fill_ctype;
- if(H5D_CHUNKED==layout) {
- TESTING("chunked dataset creation");
- } else if(H5D_COMPACT==layout) {
+ if (H5D_CHUNKED == layout) {
+ TESTING("chunked dataset creation");
+ }
+ else if (H5D_COMPACT == layout) {
TESTING("compact dataset creation");
- } else {
- TESTING("contiguous dataset creation");
+ }
+ else {
+ TESTING("contiguous dataset creation");
}
/*
* Create a file.
*/
h5_fixname(base_name, fapl, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
- if((space=H5Screate_simple(5, cur_size, cur_size)) < 0) goto error;
- if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5D_CHUNKED==layout) {
- if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error;
- } else if(H5D_COMPACT==layout) {
- if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+ if ((space = H5Screate_simple(5, cur_size, cur_size)) < 0)
+ goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5D_CHUNKED == layout) {
+ if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
+ goto error;
+ }
+ else if (H5D_COMPACT == layout) {
+ if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
+ goto error;
}
/* Create a compound datatype */
- if((comp_type_id = create_compound_type()) < 0) goto error;
+ if ((comp_type_id = create_compound_type()) < 0)
+ goto error;
/* I. Test cases for late space allocation except compact dataset */
- if(H5D_COMPACT!=layout) {
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) goto error;
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5D_COMPACT != layout) {
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
+ goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
/* 1. Compound datatype test */
- if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error;
+ if (H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0)
+ goto error;
fill_ctype.y = 4444;
- if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error;
- if((dset9 = H5Dcreate2(file, "dset9", comp_type_id, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if (H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0)
+ goto error;
+ if ((dset9 = H5Dcreate2(file, "dset9", comp_type_id, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- /* The three datasets test three fill
- * conversion paths: small to large, large to small, and no conversion.
- * They depend on `short' being smaller than `long'.
- */
- /* 2. Small to large fill conversion */
+ /* The three datasets test three fill
+ * conversion paths: small to large, large to small, and no conversion.
+ * They depend on `short' being smaller than `long'.
+ */
+ /* 2. Small to large fill conversion */
#ifndef NO_FILLING
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fill_s) < 0) goto error;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fill_s) < 0)
+ goto error;
#endif
- if((dset1=H5Dcreate2(file, "dset1", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
+ if ((dset1 = H5Dcreate2(file, "dset1", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
- /* 3. Large to small fill conversion */
+ /* 3. Large to small fill conversion */
#ifndef NO_FILLING
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0)
+ goto error;
#endif
- if((dset2=H5Dcreate2(file, "dset2", H5T_NATIVE_SHORT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
+ if ((dset2 = H5Dcreate2(file, "dset2", H5T_NATIVE_SHORT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
- /* 4. No conversion */
+ /* 4. No conversion */
#ifndef NO_FILLING
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0)
+ goto error;
#endif
- if((dset3=H5Dcreate2(file, "dset3", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
+ if ((dset3 = H5Dcreate2(file, "dset3", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
/* 5. late space allocation and never write fill value */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
- if((dset4=H5Dcreate2(file, "dset4", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
+ if ((dset4 = H5Dcreate2(file, "dset4", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* 6. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC.
* Supposed to fail. */
- if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error;
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
- H5E_BEGIN_TRY {
- if(H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)!=FAIL)
+ if (H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0)
+ goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
+ H5E_BEGIN_TRY
+ {
+ if (H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
/* II. Test early space allocation cases */
- if(H5Pclose(dcpl) < 0) goto error;
- if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5D_CHUNKED==layout) {
- if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error;
- } else if(H5D_COMPACT==layout) {
- if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5D_CHUNKED == layout) {
+ if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
+ goto error;
}
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error;
+ else if (H5D_COMPACT == layout) {
+ if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
+ goto error;
+ }
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
/* 1. Compound datatype test */
- if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error;
+ if (H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0)
+ goto error;
fill_ctype.y = 4444;
- if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error;
- if((dset8 = H5Dcreate2(file, "dset8", comp_type_id, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if (H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0)
+ goto error;
+ if ((dset8 = H5Dcreate2(file, "dset8", comp_type_id, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
-
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0)
+ goto error;
/* 2. Never write fill value */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
- if((dset5 = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
+ if ((dset5 = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* 3. Write fill value at space allocation time */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
- if((dset6 = H5Dcreate2(file, "dset6", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
+ if ((dset6 = H5Dcreate2(file, "dset6", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
/* 4. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC.
* Supposed to fail. */
- if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error;
- H5E_BEGIN_TRY {
- if(H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)!=FAIL)
+ if (H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0)
+ goto error;
+ H5E_BEGIN_TRY
+ {
+ if (H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT) != FAIL)
goto error;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Close everything */
- if(H5D_COMPACT != layout) {
- if(H5Dclose(dset1) < 0) goto error;
- if(H5Dclose(dset2) < 0) goto error;
- if(H5Dclose(dset3) < 0) goto error;
- if(H5Dclose(dset4) < 0) goto error;
- if(H5Dclose(dset9) < 0) goto error;
- }
- if(H5Dclose(dset5) < 0) goto error;
- if(H5Dclose(dset6) < 0) goto error;
- if(H5Dclose(dset8) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if (H5D_COMPACT != layout) {
+ if (H5Dclose(dset1) < 0)
+ goto error;
+ if (H5Dclose(dset2) < 0)
+ goto error;
+ if (H5Dclose(dset3) < 0)
+ goto error;
+ if (H5Dclose(dset4) < 0)
+ goto error;
+ if (H5Dclose(dset9) < 0)
+ goto error;
+ }
+ if (H5Dclose(dset5) < 0)
+ goto error;
+ if (H5Dclose(dset6) < 0)
+ goto error;
+ if (H5Dclose(dset8) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
/* Open the file and get the dataset fill value from each dataset */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- goto error;
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ goto error;
/* I. Check cases for late space allocation except compact dataset */
- if(H5D_COMPACT != layout) {
+ if (H5D_COMPACT != layout) {
/* 1. Large to small conversion */
- if((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error;
- if((dcpl = H5Dget_create_plist(dset1)) < 0) goto error;
+ if ((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dcpl = H5Dget_create_plist(dset1)) < 0)
+ goto error;
#ifndef NO_FILLING
- if(H5Pget_fill_value(dcpl, H5T_NATIVE_SHORT, &rd_s) < 0) goto error;
- if(rd_s != fill_s) {
- H5_FAILED();
- HDprintf(" %d: Got a different fill value than what was set.",__LINE__);
- HDprintf(" Got %d, set %d\n", rd_s, fill_s);
- goto error;
+ if (H5Pget_fill_value(dcpl, H5T_NATIVE_SHORT, &rd_s) < 0)
+ goto error;
+ if (rd_s != fill_s) {
+ H5_FAILED();
+ HDprintf(" %d: Got a different fill value than what was set.", __LINE__);
+ HDprintf(" Got %d, set %d\n", rd_s, fill_s);
+ goto error;
}
#endif
- if(H5Dclose(dset1) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Dclose(dset1) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
/* 2. Small to large conversion */
- if((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0) goto error;
- if((dcpl = H5Dget_create_plist(dset2)) < 0) goto error;
+ if ((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dcpl = H5Dget_create_plist(dset2)) < 0)
+ goto error;
#ifndef NO_FILLING
- if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error;
- if(rd_l!=fill_l) {
- H5_FAILED();
- HDprintf(" %d: Got a different fill value than what was set.",__LINE__);
- HDprintf(" Got %ld, set %ld\n", rd_l, fill_l);
- goto error;
+ if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0)
+ goto error;
+ if (rd_l != fill_l) {
+ H5_FAILED();
+ HDprintf(" %d: Got a different fill value than what was set.", __LINE__);
+ HDprintf(" Got %ld, set %ld\n", rd_l, fill_l);
+ goto error;
}
#endif
- if(H5Dclose(dset2) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Dclose(dset2) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
/* 3. No conversion */
- if((dset3 = H5Dopen2(file, "dset3", H5P_DEFAULT)) < 0) goto error;
- if((dcpl = H5Dget_create_plist(dset3)) < 0) goto error;
+ if ((dset3 = H5Dopen2(file, "dset3", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dcpl = H5Dget_create_plist(dset3)) < 0)
+ goto error;
#ifndef NO_FILLING
- if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error;
- if(rd_l != fill_l) {
- H5_FAILED();
- HDprintf(" %d: Got a different fill value than what was set.",__LINE__);
- HDprintf(" Got %ld, set %ld\n", rd_l, fill_l);
- goto error;
+ if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0)
+ goto error;
+ if (rd_l != fill_l) {
+ H5_FAILED();
+ HDprintf(" %d: Got a different fill value than what was set.", __LINE__);
+ HDprintf(" Got %ld, set %ld\n", rd_l, fill_l);
+ goto error;
}
#endif
- if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error;
- if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error;
- if(alloc_time != H5D_ALLOC_TIME_LATE) {
+ if (H5Pget_alloc_time(dcpl, &alloc_time) < 0)
+ goto error;
+ if (H5Pget_fill_time(dcpl, &fill_time) < 0)
+ goto error;
+ if (alloc_time != H5D_ALLOC_TIME_LATE) {
H5_FAILED();
puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time.");
HDprintf(" Got %d\n", alloc_time);
}
- if(fill_time != H5D_FILL_TIME_ALLOC) {
+ if (fill_time != H5D_FILL_TIME_ALLOC) {
H5_FAILED();
puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time.");
HDprintf(" Got %d\n", fill_time);
}
- if(H5Dclose(dset3) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Dclose(dset3) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
/* 4. late space allocation and never write fill value */
- if((dset4 = H5Dopen2(file, "dset4", H5P_DEFAULT)) < 0) goto error;
- if(H5Dget_space_status(dset4, &allocation) < 0) goto error;
- if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) {
+ if ((dset4 = H5Dopen2(file, "dset4", H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dget_space_status(dset4, &allocation) < 0)
+ goto error;
+ if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) {
H5_FAILED();
puts(" Got allocated space instead of unallocated.");
HDprintf(" Got %d\n", allocation);
goto error;
}
- if((dcpl = H5Dget_create_plist(dset4)) < 0) goto error;
- if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error;
- if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error;
- if(alloc_time != H5D_ALLOC_TIME_LATE) {
- H5_FAILED();
- puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time.");
- HDprintf(" Got %d\n", alloc_time);
+ if ((dcpl = H5Dget_create_plist(dset4)) < 0)
+ goto error;
+ if (H5Pget_alloc_time(dcpl, &alloc_time) < 0)
+ goto error;
+ if (H5Pget_fill_time(dcpl, &fill_time) < 0)
+ goto error;
+ if (alloc_time != H5D_ALLOC_TIME_LATE) {
+ H5_FAILED();
+ puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time.");
+ HDprintf(" Got %d\n", alloc_time);
}
- if(fill_time != H5D_FILL_TIME_NEVER) {
- H5_FAILED();
- puts(" Got non-H5D_FILL_TIME_NEVER fill value write time.");
- HDprintf(" Got %d\n", fill_time);
+ if (fill_time != H5D_FILL_TIME_NEVER) {
+ H5_FAILED();
+ puts(" Got non-H5D_FILL_TIME_NEVER fill value write time.");
+ HDprintf(" Got %d\n", fill_time);
}
- if(H5Dclose(dset4) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Dclose(dset4) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
/* 5. Compound datatype test */
- if((dset9 = H5Dopen2(file, "dset9", H5P_DEFAULT)) < 0) goto error;
- if((dcpl = H5Dget_create_plist(dset9)) < 0) goto error;
- if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error;
- if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') {
- H5_FAILED();
- puts(" Got wrong fill value");
- HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n",
- (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z);
+ if ((dset9 = H5Dopen2(file, "dset9", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dcpl = H5Dget_create_plist(dset9)) < 0)
+ goto error;
+ if (H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0)
+ goto error;
+ if (!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 ||
+ rd_c.z != '\0') {
+ H5_FAILED();
+ puts(" Got wrong fill value");
+ HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y,
+ rd_c.x, rd_c.z);
}
- if(H5Dclose(dset9) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Dclose(dset9) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
}
/* II. Check early space allocation cases */
/* 1. Never write fill value */
- if((dset5 = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) goto error;
- if((dcpl = H5Dget_create_plist(dset5)) < 0) goto error;
- if(H5Dget_space_status(dset5, &allocation) < 0) goto error;
- if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) {
+ if ((dset5 = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dcpl = H5Dget_create_plist(dset5)) < 0)
+ goto error;
+ if (H5Dget_space_status(dset5, &allocation) < 0)
+ goto error;
+ if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) {
H5_FAILED();
- HDprintf(" %d: Got unallocated space instead of allocated.\n",__LINE__);
+ HDprintf(" %d: Got unallocated space instead of allocated.\n", __LINE__);
HDprintf(" Got %d\n", allocation);
goto error;
}
- if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error;
- if(alloc_time != H5D_ALLOC_TIME_EARLY) {
+ if (H5Pget_alloc_time(dcpl, &alloc_time) < 0)
+ goto error;
+ if (alloc_time != H5D_ALLOC_TIME_EARLY) {
H5_FAILED();
puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time.");
HDprintf(" Got %d\n", alloc_time);
}
- if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error;
- if(fill_time != H5D_FILL_TIME_NEVER) {
+ if (H5Pget_fill_time(dcpl, &fill_time) < 0)
+ goto error;
+ if (fill_time != H5D_FILL_TIME_NEVER) {
H5_FAILED();
puts(" Got non-H5D_FILL_TIME_NEVER fill value write time.");
HDprintf(" Got %d\n", fill_time);
}
- if(H5Dclose(dset5) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Dclose(dset5) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
/* 2. test writing fill value at space allocation time */
- if((dset6 = H5Dopen2(file, "dset6", H5P_DEFAULT)) < 0) goto error;
- if((dcpl = H5Dget_create_plist(dset6)) < 0) goto error;
- if(H5Dget_space_status(dset6, &allocation) < 0) goto error;
- if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) {
+ if ((dset6 = H5Dopen2(file, "dset6", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dcpl = H5Dget_create_plist(dset6)) < 0)
+ goto error;
+ if (H5Dget_space_status(dset6, &allocation) < 0)
+ goto error;
+ if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) {
H5_FAILED();
- HDprintf(" %d: Got unallocated space instead of allocated.\n",__LINE__);
+ HDprintf(" %d: Got unallocated space instead of allocated.\n", __LINE__);
HDprintf(" Got %d\n", allocation);
goto error;
}
- if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error;
- if(rd_l != fill_l) {
+ if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0)
+ goto error;
+ if (rd_l != fill_l) {
H5_FAILED();
- HDprintf(" %d: Got a different fill value than what was set.",__LINE__);
+ HDprintf(" %d: Got a different fill value than what was set.", __LINE__);
HDprintf(" Got %ld, set %ld\n", rd_l, fill_l);
goto error;
}
- if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error;
- if(alloc_time != H5D_ALLOC_TIME_EARLY) {
+ if (H5Pget_alloc_time(dcpl, &alloc_time) < 0)
+ goto error;
+ if (alloc_time != H5D_ALLOC_TIME_EARLY) {
H5_FAILED();
puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time.");
HDprintf(" Got %d\n", alloc_time);
}
- if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error;
- if(fill_time != H5D_FILL_TIME_ALLOC) {
+ if (H5Pget_fill_time(dcpl, &fill_time) < 0)
+ goto error;
+ if (fill_time != H5D_FILL_TIME_ALLOC) {
H5_FAILED();
puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time.");
HDprintf(" Got %d\n", fill_time);
}
- if(H5Dclose(dset6) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Dclose(dset6) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
/* 3. Compound datatype test */
- if((dset8 = H5Dopen2(file, "dset8", H5P_DEFAULT)) < 0) goto error;
- if((dcpl = H5Dget_create_plist(dset8)) < 0) goto error;
- if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error;
- if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') {
+ if ((dset8 = H5Dopen2(file, "dset8", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dcpl = H5Dget_create_plist(dset8)) < 0)
+ goto error;
+ if (H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0)
+ goto error;
+ if (!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 ||
+ rd_c.z != '\0') {
H5_FAILED();
puts(" Got wrong fill value");
- HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n",
- (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z);
+ HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x,
+ rd_c.z);
}
- if(H5Dclose(dset8) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Dclose(dset8) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
- if(H5Fclose(file) < 0) goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- H5Sclose(space);
- if(H5D_COMPACT != layout) {
- H5Dclose(dset1);
- H5Dclose(dset2);
- H5Dclose(dset3);
- H5Dclose(dset4);
- H5Dclose(dset9);
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dcpl);
+ H5Sclose(space);
+ if (H5D_COMPACT != layout) {
+ H5Dclose(dset1);
+ H5Dclose(dset2);
+ H5Dclose(dset3);
+ H5Dclose(dset4);
+ H5Dclose(dset9);
}
H5Dclose(dset5);
H5Dclose(dset6);
- H5Dclose(dset8);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Dclose(dset8);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
}
@@ -746,35 +866,34 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
- H5D_fill_time_t fill_time, H5D_layout_t layout,
- H5T_class_t datatype, hid_t ctype_id)
+test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_fill_time_t fill_time,
+ H5D_layout_t layout, H5T_class_t datatype, hid_t ctype_id)
{
- hid_t fspace=-1, mspace=-1, dset1=-1, dset2=-1;
- hsize_t cur_size[5] = {2, 8, 8, 4, 2};
- hsize_t one[5] = {1, 1, 1, 1, 1};
- hsize_t hs_size[5], hs_stride[5];
- hsize_t hs_offset[5], nelmts;
- int fillval=(-1), val_rd, should_be;
- int i, j, *buf=NULL, odd;
- unsigned u;
- comp_datatype rd_c, fill_c, should_be_c;
- comp_datatype *buf_c=NULL;
- H5D_space_status_t allocation;
+ hid_t fspace = -1, mspace = -1, dset1 = -1, dset2 = -1;
+ hsize_t cur_size[5] = {2, 8, 8, 4, 2};
+ hsize_t one[5] = {1, 1, 1, 1, 1};
+ hsize_t hs_size[5], hs_stride[5];
+ hsize_t hs_offset[5], nelmts;
+ int fillval = (-1), val_rd, should_be;
+ int i, j, *buf = NULL, odd;
+ unsigned u;
+ comp_datatype rd_c, fill_c, should_be_c;
+ comp_datatype * buf_c = NULL;
+ H5D_space_status_t allocation;
fill_c.a = 0;
fill_c.x = 0;
fill_c.y = 0;
fill_c.z = 0;
- if(datatype == H5T_INTEGER) {
- fillval = *(int*)_fillval;
+ if (datatype == H5T_INTEGER) {
+ fillval = *(int *)_fillval;
}
- else if(datatype == H5T_COMPOUND) {
- fill_c.a=((comp_datatype*)_fillval)->a;
- fill_c.x=((comp_datatype*)_fillval)->x;
- fill_c.y=((comp_datatype*)_fillval)->y;
- fill_c.z=((comp_datatype*)_fillval)->z;
+ else if (datatype == H5T_COMPOUND) {
+ fill_c.a = ((comp_datatype *)_fillval)->a;
+ fill_c.x = ((comp_datatype *)_fillval)->x;
+ fill_c.y = ((comp_datatype *)_fillval)->y;
+ fill_c.z = ((comp_datatype *)_fillval)->z;
}
else {
HDputs("Invalid type for test");
@@ -782,156 +901,162 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
}
/* Create dataset */
- if((fspace = H5Screate_simple(5, cur_size, cur_size)) < 0)
+ if ((fspace = H5Screate_simple(5, cur_size, cur_size)) < 0)
goto error;
- if(datatype == H5T_INTEGER && (dset1 = H5Dcreate2(file, dname, H5T_NATIVE_INT, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if (datatype == H5T_INTEGER &&
+ (dset1 = H5Dcreate2(file, dname, H5T_NATIVE_INT, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if(datatype == H5T_COMPOUND && (dset2 = H5Dcreate2(file, dname, ctype_id, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if (datatype == H5T_COMPOUND &&
+ (dset2 = H5Dcreate2(file, dname, ctype_id, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Read some data and make sure it's the fill value */
- if((mspace = H5Screate_simple(5, one, NULL)) < 0)
+ if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
goto error;
- for (i=0; i<1000; i++) {
- for (j=0; j<5; j++)
- hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL,
- one, NULL) < 0) goto error;
+ for (i = 0; i < 1000; i++) {
+ for (j = 0; j < 5; j++)
+ hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ goto error;
- /* case for atomic datatype */
- if(datatype==H5T_INTEGER) {
- if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT,
- &val_rd) < 0) goto error;
- if(fill_time!=H5D_FILL_TIME_NEVER && val_rd!=fillval) {
- H5_FAILED();
+ /* case for atomic datatype */
+ if (datatype == H5T_INTEGER) {
+ if (H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
+ goto error;
+ if (fill_time != H5D_FILL_TIME_NEVER && val_rd != fillval) {
+ H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
- HDfprintf(stdout," Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE "}, read: %u, "
- "Fill value: %u\n",
- hs_offset[0], hs_offset[1],
- hs_offset[2], hs_offset[3],
- hs_offset[4], val_rd, fillval);
- goto error;
+ HDfprintf(stdout,
+ " Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE
+ "}, read: %u, "
+ "Fill value: %u\n",
+ hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], val_rd,
+ fillval);
+ goto error;
+ }
+ /* case for compound datatype */
}
- /* case for compound datatype */
- }
- else if(datatype==H5T_COMPOUND) {
- if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT,
- &rd_c) < 0) goto error;
- if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) ||
- rd_c.x != fill_c.x || !H5_DBL_ABS_EQUAL(rd_c.y, fill_c.y) ||
- rd_c.z != fill_c.z)) {
+ else if (datatype == H5T_COMPOUND) {
+ if (H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0)
+ goto error;
+ if (fill_time != H5D_FILL_TIME_NEVER &&
+ (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) || rd_c.x != fill_c.x ||
+ !H5_DBL_ABS_EQUAL(rd_c.y, fill_c.y) || rd_c.z != fill_c.z)) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
- HDfprintf(stdout," Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE "}, read: %f, %d, %f, %c"
- "Fill value: %f, %d, %f, %c\n",
- hs_offset[0], hs_offset[1],
- hs_offset[2], hs_offset[3],
- hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z,
- (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z);
+ HDfprintf(stdout,
+ " Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE
+ "}, read: %f, %d, %f, %c"
+ "Fill value: %f, %d, %f, %c\n",
+ hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4],
+ (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)fill_c.a, fill_c.x, fill_c.y,
+ fill_c.z);
goto error;
}
}
}
- if(H5Sclose(mspace) < 0) goto error;
+ if (H5Sclose(mspace) < 0)
+ goto error;
/* Select all odd data locations in the file dataset */
- for (i=0, nelmts=1; i<5; i++) {
- hs_size[i] = cur_size[i]/2;
+ for (i = 0, nelmts = 1; i < 5; i++) {
+ hs_size[i] = cur_size[i] / 2;
hs_offset[i] = 0;
hs_stride[i] = 2;
nelmts *= hs_size[i];
}
- if((mspace=H5Screate_simple(5, hs_size, hs_size)) < 0) goto error;
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride,
- hs_size, NULL) < 0) goto error;
+ if ((mspace = H5Screate_simple(5, hs_size, hs_size)) < 0)
+ goto error;
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, hs_size, NULL) < 0)
+ goto error;
/* Read non-contiguous selection from empty dataset */
/* case for atomic datatype */
- if(datatype==H5T_INTEGER) {
+ if (datatype == H5T_INTEGER) {
/*check for overflow*/
HDassert((nelmts * sizeof(int)) == (hsize_t)((size_t)(nelmts * sizeof(int))));
buf = (int *)HDmalloc((size_t)(nelmts * sizeof(int)));
- if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0)
goto error;
/* Verify values, except if no fill value written */
- if(fill_time != H5D_FILL_TIME_NEVER) {
- for(u = 0; u < nelmts; u++) {
- if(buf[u] != fillval) {
+ if (fill_time != H5D_FILL_TIME_NEVER) {
+ for (u = 0; u < nelmts; u++) {
+ if (buf[u] != fillval) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
- HDfprintf(stdout," Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE "}, read: %u, "
- "Fill value: %u\n",
- hs_offset[0], hs_offset[1],
- hs_offset[2], hs_offset[3],
- hs_offset[4], buf[u], fillval);
+ HDfprintf(stdout,
+ " Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE
+ ", %" PRIuHSIZE "}, read: %u, "
+ "Fill value: %u\n",
+ hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], buf[u],
+ fillval);
goto error;
} /* end if */
- } /* end for */
- } /* end if */
+ } /* end for */
+ } /* end if */
}
/* case for compound datatype */
- else if(datatype == H5T_COMPOUND) {
+ else if (datatype == H5T_COMPOUND) {
/*check for overflow*/
- HDassert((nelmts * sizeof(comp_datatype)) ==
- (hsize_t)((size_t)(nelmts * sizeof(comp_datatype))));
- buf_c = (comp_datatype *)HDmalloc((size_t)nelmts * sizeof(comp_datatype));
+ HDassert((nelmts * sizeof(comp_datatype)) == (hsize_t)((size_t)(nelmts * sizeof(comp_datatype))));
+ buf_c = (comp_datatype *)HDmalloc((size_t)nelmts * sizeof(comp_datatype));
- if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0)
+ if (H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0)
goto error;
/* Verify values, except if no fill value written */
- if(fill_time != H5D_FILL_TIME_NEVER) {
- for(u = 0; u < nelmts; u++) {
- if(!H5_FLT_ABS_EQUAL(buf_c[u].a, fill_c.a) || buf_c[u].x != fill_c.x ||
- !H5_DBL_ABS_EQUAL(buf_c[u].y, fill_c.y) || buf_c[u].z != fill_c.z) {
+ if (fill_time != H5D_FILL_TIME_NEVER) {
+ for (u = 0; u < nelmts; u++) {
+ if (!H5_FLT_ABS_EQUAL(buf_c[u].a, fill_c.a) || buf_c[u].x != fill_c.x ||
+ !H5_DBL_ABS_EQUAL(buf_c[u].y, fill_c.y) || buf_c[u].z != fill_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
- HDfprintf(stdout," Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE "}, read: %f, %d, %f, %c"
- "Fill value: %f, %d, %f, %c\n",
- hs_offset[0], hs_offset[1],
- hs_offset[2], hs_offset[3],
- hs_offset[4],
- (double)buf_c[u].a, buf_c[u].x, buf_c[u].y, buf_c[u].z,
- (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z);
+ HDfprintf(stdout,
+ " Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE
+ ", %" PRIuHSIZE "}, read: %f, %d, %f, %c"
+ "Fill value: %f, %d, %f, %c\n",
+ hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4],
+ (double)buf_c[u].a, buf_c[u].x, buf_c[u].y, buf_c[u].z, (double)fill_c.a,
+ fill_c.x, fill_c.y, fill_c.z);
goto error;
} /* end if */
- } /* end for */
- } /* end if */
+ } /* end for */
+ } /* end if */
}
/* Write to all odd data locations */
/* case for atomic datatype */
- if(datatype == H5T_INTEGER) {
- for(u = 0; u < nelmts; u++)
+ if (datatype == H5T_INTEGER) {
+ for (u = 0; u < nelmts; u++)
buf[u] = 9999;
- if(H5Dwrite(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0)
goto error;
}
/* case for compound datatype */
- else if(datatype == H5T_COMPOUND) {
+ else if (datatype == H5T_COMPOUND) {
HDmemset(buf_c, 0, ((size_t)nelmts * sizeof(comp_datatype)));
- for(u = 0; u < nelmts; u++) {
- buf_c[u].a = 1111.11F;
- buf_c[u].x = 2222;
- buf_c[u].y = 3333.3333F;
- buf_c[u].z = 'd';
- }
- if(H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0)
+ for (u = 0; u < nelmts; u++) {
+ buf_c[u].a = 1111.11F;
+ buf_c[u].x = 2222;
+ buf_c[u].y = 3333.3333F;
+ buf_c[u].z = 'd';
+ }
+ if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0)
goto error;
}
/* Check if space is allocated */
- if(datatype==H5T_INTEGER && H5Dget_space_status(dset1, &allocation) < 0)
- goto error;
- if(datatype==H5T_COMPOUND && H5Dget_space_status(dset2, &allocation) < 0)
+ if (datatype == H5T_INTEGER && H5Dget_space_status(dset1, &allocation) < 0)
+ goto error;
+ if (datatype == H5T_COMPOUND && H5Dget_space_status(dset2, &allocation) < 0)
goto error;
- if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) {
+ if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) {
H5_FAILED();
- HDprintf(" %d: Got unallocated space instead of allocated.\n",__LINE__);
+ HDprintf(" %d: Got unallocated space instead of allocated.\n", __LINE__);
HDprintf(" Got %d\n", allocation);
goto error;
}
@@ -940,126 +1065,129 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
H5Sclose(mspace);
/* Read some data and make sure it's the right value */
- if((mspace = H5Screate_simple(5, one, NULL)) < 0)
+ if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
goto error;
- for(i = 0; i < 1000; i++) {
- for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
- odd += (int)(hs_offset[j]%2);
- } /* end for */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ for (i = 0; i < 1000; i++) {
+ for (j = 0, odd = 0; j < 5; j++) {
+ hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
+ odd += (int)(hs_offset[j] % 2);
+ } /* end for */
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
goto error;
- /* case for atomic datatype */
- if(datatype==H5T_INTEGER) {
- if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
+ /* case for atomic datatype */
+ if (datatype == H5T_INTEGER) {
+ if (H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
goto error;
- if(fill_time == H5D_FILL_TIME_ALLOC) {
+ if (fill_time == H5D_FILL_TIME_ALLOC) {
should_be = odd ? fillval : 9999;
- if(val_rd!=should_be) {
+ if (val_rd != should_be) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, "
- "should be: %u\n",
- (long)hs_offset[0], (long)hs_offset[1],
- (long)hs_offset[2], (long)hs_offset[3],
- (long)hs_offset[4], val_rd, should_be);
+ "should be: %u\n",
+ (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3],
+ (long)hs_offset[4], val_rd, should_be);
goto error;
}
- }
- else if(fill_time == H5D_FILL_TIME_NEVER && !odd) {
- should_be = 9999;
- if(val_rd!=should_be) {
- H5_FAILED();
+ }
+ else if (fill_time == H5D_FILL_TIME_NEVER && !odd) {
+ should_be = 9999;
+ if (val_rd != should_be) {
+ H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
- HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, "
- "should be: %u\n",
- (long)hs_offset[0], (long)hs_offset[1],
- (long)hs_offset[2], (long)hs_offset[3],
- (long)hs_offset[4], val_rd, should_be);
- goto error;
+ HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, "
+ "should be: %u\n",
+ (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3],
+ (long)hs_offset[4], val_rd, should_be);
+ goto error;
+ }
}
- } else if(fill_time == H5D_FILL_TIME_NEVER && odd) {
- /*Trash data. Don't compare*/
- }
- } /* end for datatype==H5T_INTEGER */
- /* case for compound datatype */
- else if(datatype==H5T_COMPOUND) {
- if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0)
+ else if (fill_time == H5D_FILL_TIME_NEVER && odd) {
+ /*Trash data. Don't compare*/
+ }
+ } /* end for datatype==H5T_INTEGER */
+ /* case for compound datatype */
+ else if (datatype == H5T_COMPOUND) {
+ if (H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0)
goto error;
- if(fill_time == H5D_FILL_TIME_ALLOC) {
- if(odd) {
- should_be_c.a=fill_c.a;
- should_be_c.x=fill_c.x;
- should_be_c.y=fill_c.y;
- should_be_c.z=fill_c.z;
- } else {
- should_be_c.a=buf_c[0].a;
- should_be_c.x=buf_c[0].x;
- should_be_c.y=buf_c[0].y;
- should_be_c.z=buf_c[0].z;
- }
- if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
- !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
+ if (fill_time == H5D_FILL_TIME_ALLOC) {
+ if (odd) {
+ should_be_c.a = fill_c.a;
+ should_be_c.x = fill_c.x;
+ should_be_c.y = fill_c.y;
+ should_be_c.z = fill_c.z;
+ }
+ else {
+ should_be_c.a = buf_c[0].a;
+ should_be_c.x = buf_c[0].x;
+ should_be_c.y = buf_c[0].y;
+ should_be_c.z = buf_c[0].z;
+ }
+ if (!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
+ !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
- "should be: %f,%d,%f,%c\n",
- (long)hs_offset[0], (long)hs_offset[1],
- (long)hs_offset[2], (long)hs_offset[3],
- (long)hs_offset[4],
- (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)should_be_c.a,
- should_be_c.x,should_be_c.y,should_be_c.z);
+ "should be: %f,%d,%f,%c\n",
+ (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3],
+ (long)hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z,
+ (double)should_be_c.a, should_be_c.x, should_be_c.y, should_be_c.z);
goto error;
- }
- } /* end for fill_time == H5D_FILL_TIME_ALLOC */
- else if(fill_time == H5D_FILL_TIME_NEVER && !odd) {
- should_be_c.a=buf_c[0].a;
- should_be_c.x=buf_c[0].x;
- should_be_c.y=buf_c[0].y;
- should_be_c.z=buf_c[0].z;
- if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
- !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
+ }
+ } /* end for fill_time == H5D_FILL_TIME_ALLOC */
+ else if (fill_time == H5D_FILL_TIME_NEVER && !odd) {
+ should_be_c.a = buf_c[0].a;
+ should_be_c.x = buf_c[0].x;
+ should_be_c.y = buf_c[0].y;
+ should_be_c.z = buf_c[0].z;
+ if (!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
+ !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
- "should be: %f,%d,%f,%c\n",
- (long)hs_offset[0], (long)hs_offset[1],
- (long)hs_offset[2], (long)hs_offset[3],
- (long)hs_offset[4],
- (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)should_be_c.a,
- should_be_c.x,should_be_c.y,should_be_c.z);
+ "should be: %f,%d,%f,%c\n",
+ (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3],
+ (long)hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z,
+ (double)should_be_c.a, should_be_c.x, should_be_c.y, should_be_c.z);
goto error;
}
- } /* end for fill_time == H5D_FILL_TIME_NEVER */
- else if(fill_time == H5D_FILL_TIME_NEVER && odd) {
+ } /* end for fill_time == H5D_FILL_TIME_NEVER */
+ else if (fill_time == H5D_FILL_TIME_NEVER && odd) {
/*Trash data. Don't compare*/
}
- } /* end for datatype==H5T_COMPOUND */
+ } /* end for datatype==H5T_COMPOUND */
}
- if(datatype == H5T_COMPOUND) {
+ if (datatype == H5T_COMPOUND) {
HDfree(buf_c);
buf_c = NULL;
} /* end if */
- if(H5Sclose(mspace) < 0) goto error;
- if(datatype==H5T_INTEGER && H5Dclose(dset1) < 0) goto error;
- if(datatype==H5T_COMPOUND && H5Dclose(dset2) < 0) goto error;
- if(H5Sclose(fspace) < 0) goto error;
+ if (H5Sclose(mspace) < 0)
+ goto error;
+ if (datatype == H5T_INTEGER && H5Dclose(dset1) < 0)
+ goto error;
+ if (datatype == H5T_COMPOUND && H5Dclose(dset2) < 0)
+ goto error;
+ if (H5Sclose(fspace) < 0)
+ goto error;
return 0;
- error:
- H5E_BEGIN_TRY {
- if(datatype==H5T_INTEGER) H5Dclose(dset1);
- if(datatype==H5T_COMPOUND) H5Dclose(dset2);
- H5Sclose(fspace);
- H5Sclose(mspace);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ if (datatype == H5T_INTEGER)
+ H5Dclose(dset1);
+ if (datatype == H5T_COMPOUND)
+ H5Dclose(dset2);
+ H5Sclose(fspace);
+ H5Sclose(mspace);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_rdwr
*
@@ -1081,158 +1209,187 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
static int
test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
{
- char filename[1024];
- hid_t file=-1, dcpl=-1, ctype_id=-1;
- hsize_t ch_size[5] = {2, 8, 8, 4, 2};
- int nerrors=0;
- int fillval = 0x4c70f1cd;
- comp_datatype fill_ctype={0,0,0,0};
-
- if(H5D_CHUNKED==layout) {
+ char filename[1024];
+ hid_t file = -1, dcpl = -1, ctype_id = -1;
+ hsize_t ch_size[5] = {2, 8, 8, 4, 2};
+ int nerrors = 0;
+ int fillval = 0x4c70f1cd;
+ comp_datatype fill_ctype = {0, 0, 0, 0};
+
+ if (H5D_CHUNKED == layout) {
TESTING("chunked dataset I/O");
- } else if(H5D_COMPACT==layout) {
+ }
+ else if (H5D_COMPACT == layout) {
TESTING("compact dataset I/O");
- } else {
+ }
+ else {
TESTING("contiguous dataset I/O");
}
h5_fixname(base_name, fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5D_CHUNKED == layout) {
- if(H5Pset_chunk(dcpl, 5, ch_size) < 0)
+ if (H5D_CHUNKED == layout) {
+ if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
goto error;
}
- else if(H5D_COMPACT == layout) {
- if(H5Pset_layout(dcpl, H5D_COMPACT) < 0)
+ else if (H5D_COMPACT == layout) {
+ if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
goto error;
}
- if((ctype_id = create_compound_type()) < 0)
+ if ((ctype_id = create_compound_type()) < 0)
goto error;
/* I. Test H5D_ALLOC_TIME_LATE space allocation cases */
- if(H5D_COMPACT != layout) {
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) goto error;
+ if (H5D_COMPACT != layout) {
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
+ goto error;
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
fillval = 0;
- nerrors += test_rdwr_cases(file, dcpl, "dset1", &fillval, H5D_FILL_TIME_ALLOC,
- layout, H5T_INTEGER, (hid_t)-1);
+ nerrors += test_rdwr_cases(file, dcpl, "dset1", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER,
+ (hid_t)-1);
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset2", &fillval, H5D_FILL_TIME_NEVER,
- layout, H5T_INTEGER, (hid_t)-1);
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
+ nerrors += test_rdwr_cases(file, dcpl, "dset2", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER,
+ (hid_t)-1);
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
fillval = 0x4c70f1cd;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset3", &fillval, H5D_FILL_TIME_ALLOC,
- layout, H5T_INTEGER, (hid_t)-1);
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+ nerrors += test_rdwr_cases(file, dcpl, "dset3", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER,
+ (hid_t)-1);
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset4", &fillval, H5D_FILL_TIME_NEVER,
- layout, H5T_INTEGER, (hid_t)-1);
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+ nerrors += test_rdwr_cases(file, dcpl, "dset4", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER,
+ (hid_t)-1);
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is undefined */
/* This case has been tested in test_create() function */
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
- if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset5", &fillval, H5D_FILL_TIME_NEVER,
- layout, H5T_INTEGER, (hid_t)-1);
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
+ if (H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0)
+ goto error;
+ nerrors += test_rdwr_cases(file, dcpl, "dset5", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER,
+ (hid_t)-1);
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
* as compound type */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
fill_ctype.y = 4444.4444F;
- if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC,
- layout, H5T_COMPOUND, ctype_id);
-
- if(H5Pclose(dcpl) < 0) goto error;
- if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5D_CHUNKED==layout) {
- if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error;
+ if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0)
+ goto error;
+ nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, layout,
+ H5T_COMPOUND, ctype_id);
+
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5D_CHUNKED == layout) {
+ if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
+ goto error;
}
}
-
/* II. Test H5D_ALLOC_TIME_EARLY space allocation cases */
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
fillval = 0;
- nerrors += test_rdwr_cases(file, dcpl, "dset6", &fillval, H5D_FILL_TIME_ALLOC,
- layout, H5T_INTEGER, (hid_t)-1);
+ nerrors +=
+ test_rdwr_cases(file, dcpl, "dset6", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER, (hid_t)-1);
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset7", &fillval, H5D_FILL_TIME_NEVER, layout,
- H5T_INTEGER, (hid_t)-1);
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
+ nerrors +=
+ test_rdwr_cases(file, dcpl, "dset7", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, (hid_t)-1);
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
fillval = 0x4c70f1cd;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset8", &fillval, H5D_FILL_TIME_ALLOC,
- layout, H5T_INTEGER, (hid_t)-1);
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+ nerrors +=
+ test_rdwr_cases(file, dcpl, "dset8", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER, (hid_t)-1);
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset9", &fillval, H5D_FILL_TIME_NEVER,
- layout, H5T_INTEGER, (hid_t)-1);
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+ nerrors +=
+ test_rdwr_cases(file, dcpl, "dset9", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, (hid_t)-1);
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is undefined */
/* This case has been tested in test_create() function */
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
- if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset10", &fillval, H5D_FILL_TIME_NEVER,
- layout, H5T_INTEGER, (hid_t)-1);
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
+ if (H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0)
+ goto error;
+ nerrors +=
+ test_rdwr_cases(file, dcpl, "dset10", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, (hid_t)-1);
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
* as compound type */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
fill_ctype.y = 4444.4444F;
- if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error;
- nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC,
- layout, H5T_COMPOUND, ctype_id);
-
+ if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0)
+ goto error;
+ nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND,
+ ctype_id);
- if(nerrors)
- goto error;
- if(H5Pclose(dcpl) < 0) goto error;
- if(H5Tclose(ctype_id) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if (nerrors)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Tclose(ctype_id) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
- H5Tclose(ctype_id);
+ H5Tclose(ctype_id);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return nerrors;
}
-
/*-------------------------------------------------------------------------
* Function: test_extend_init_integer
*
@@ -1249,10 +1406,10 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
static int
test_extend_init_integer(void *_buf, size_t nelmts, const void *_val)
{
- int *buf = (int *)_buf; /* Buffer to initialize */
- const int *val = (const int *)_val; /* Value to use */
+ int * buf = (int *)_buf; /* Buffer to initialize */
+ const int *val = (const int *)_val; /* Value to use */
- while(nelmts) {
+ while (nelmts) {
*buf++ = *val;
nelmts--;
} /* end while */
@@ -1260,7 +1417,6 @@ test_extend_init_integer(void *_buf, size_t nelmts, const void *_val)
return 0;
} /* end test_extend_init_integer() */
-
/*-------------------------------------------------------------------------
* Function: test_extend_verify_integer
*
@@ -1275,20 +1431,20 @@ test_extend_init_integer(void *_buf, size_t nelmts, const void *_val)
*-------------------------------------------------------------------------
*/
static int
-test_extend_verify_integer(unsigned lineno, const hsize_t *offset,
- const void *_test_val, const void *_compare_val)
+test_extend_verify_integer(unsigned lineno, const hsize_t *offset, const void *_test_val,
+ const void *_compare_val)
{
- const int *test_val = (const int *)_test_val; /* Value to test */
- const int *compare_val = (const int *)_compare_val; /* Value to compare against */
+ const int *test_val = (const int *)_test_val; /* Value to test */
+ const int *compare_val = (const int *)_compare_val; /* Value to compare against */
/* Verify value */
- if(*test_val != *compare_val) {
+ if (*test_val != *compare_val) {
HDfprintf(stdout, "%u: Value read was not expected.\n", lineno);
- HDfprintf(stdout," Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE "}, read: %d, "
- "expected: %d\n",
- offset[0], offset[1],
- offset[2], offset[3],
- offset[4], *test_val, *compare_val);
+ HDfprintf(stdout,
+ " Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE
+ "}, read: %d, "
+ "expected: %d\n",
+ offset[0], offset[1], offset[2], offset[3], offset[4], *test_val, *compare_val);
goto error;
} /* end if */
@@ -1298,7 +1454,6 @@ error:
return -1;
} /* end test_extend_verify_integer() */
-
/*-------------------------------------------------------------------------
* Function: test_extend_release_integer
*
@@ -1318,7 +1473,6 @@ test_extend_release_integer(void H5_ATTR_UNUSED *_elmt)
return 0;
} /* end test_extend_release_integer() */
-
/*-------------------------------------------------------------------------
* Function: test_extend_init_cmpd_vl
*
@@ -1335,10 +1489,10 @@ test_extend_release_integer(void H5_ATTR_UNUSED *_elmt)
static int
test_extend_init_cmpd_vl(void *_buf, size_t nelmts, const void *_val)
{
- comp_vl_datatype *buf = (comp_vl_datatype *)_buf; /* Buffer to initialize */
- const comp_vl_datatype *val = (const comp_vl_datatype *)_val; /* Value to use */
+ comp_vl_datatype * buf = (comp_vl_datatype *)_buf; /* Buffer to initialize */
+ const comp_vl_datatype *val = (const comp_vl_datatype *)_val; /* Value to use */
- while(nelmts) {
+ while (nelmts) {
/* Shallow copy all fields */
*buf = *val;
@@ -1353,7 +1507,6 @@ test_extend_init_cmpd_vl(void *_buf, size_t nelmts, const void *_val)
return 0;
} /* end test_extend_init_cmpd_vl() */
-
/*-------------------------------------------------------------------------
* Function: test_extend_verify_cmpd_vl
*
@@ -1368,23 +1521,23 @@ test_extend_init_cmpd_vl(void *_buf, size_t nelmts, const void *_val)
*-------------------------------------------------------------------------
*/
static int
-test_extend_verify_cmpd_vl(unsigned lineno, const hsize_t *offset,
- const void *_test_val, const void *_compare_val)
+test_extend_verify_cmpd_vl(unsigned lineno, const hsize_t *offset, const void *_test_val,
+ const void *_compare_val)
{
- const comp_vl_datatype *test_val = (const comp_vl_datatype *)_test_val; /* Value to test */
- const comp_vl_datatype *compare_val = (const comp_vl_datatype *)_compare_val; /* Value to compare against */
+ const comp_vl_datatype *test_val = (const comp_vl_datatype *)_test_val; /* Value to test */
+ const comp_vl_datatype *compare_val =
+ (const comp_vl_datatype *)_compare_val; /* Value to compare against */
/* Verify value */
- if((test_val->x != compare_val->x) ||
- HDstrcmp(test_val->a, compare_val->a) ||
- HDstrcmp(test_val->b, compare_val->b) ||
- (test_val->y != compare_val->y)) {
+ if ((test_val->x != compare_val->x) || HDstrcmp(test_val->a, compare_val->a) ||
+ HDstrcmp(test_val->b, compare_val->b) || (test_val->y != compare_val->y)) {
HDfprintf(stdout, "%u: Value read was not expected.\n", lineno);
- HDfprintf(stdout," Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE "}, read: {%d, '%s', '%s', %d} "
- "expected: {%d, '%s', '%s', %d}\n",
- offset[0], offset[1], offset[2], offset[3], offset[4],
- test_val->x, test_val->a, test_val->b, test_val->y,
- compare_val->x, compare_val->a, compare_val->b, compare_val->y);
+ HDfprintf(stdout,
+ " Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE
+ "}, read: {%d, '%s', '%s', %d} "
+ "expected: {%d, '%s', '%s', %d}\n",
+ offset[0], offset[1], offset[2], offset[3], offset[4], test_val->x, test_val->a,
+ test_val->b, test_val->y, compare_val->x, compare_val->a, compare_val->b, compare_val->y);
goto error;
} /* end if */
@@ -1394,7 +1547,6 @@ error:
return -1;
} /* end test_extend_verify_cmpd_vl() */
-
/*-------------------------------------------------------------------------
* Function: test_extend_release_cmpd_vl
*
@@ -1411,7 +1563,7 @@ error:
static int
test_extend_release_cmpd_vl(void *_elmt)
{
- comp_vl_datatype *elmt = (comp_vl_datatype *)_elmt; /* Element to free */
+ comp_vl_datatype *elmt = (comp_vl_datatype *)_elmt; /* Element to free */
/* Free memory for string fields */
HDfree(elmt->a);
@@ -1420,7 +1572,6 @@ test_extend_release_cmpd_vl(void *_elmt)
return 0;
} /* end test_extend_release_integer() */
-
/*-------------------------------------------------------------------------
* Function: test_extend_cases
*
@@ -1435,110 +1586,118 @@ test_extend_release_cmpd_vl(void *_elmt)
*-------------------------------------------------------------------------
*/
static int
-test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
- hsize_t *ch_size, hsize_t *start_size, hsize_t *max_size, hid_t dtype, void *fillval)
+test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, hsize_t *ch_size, hsize_t *start_size,
+ hsize_t *max_size, hid_t dtype, void *fillval)
{
- hid_t fspace = -1, mspace = -1; /* File & memory dataspaces */
- hid_t dset = -1; /* Dataset ID */
- hid_t dcpl = -1; /* Dataset creation property list */
- hsize_t extend_size[5]; /* Dimensions to extend to */
- hsize_t one[5] = {1, 1, 1, 1, 1}; /* Dimensions of single element dataspace */
- hsize_t hs_size[5], hs_stride[5], hs_offset[5];
- size_t nelmts;
- H5T_class_t dtype_class; /* Class of datatype */
- int (*init_rtn)(void *, size_t, const void *);
- int (*verify_rtn)(unsigned, const hsize_t *, const void *, const void *);
- int (*release_rtn)(void *);
- size_t val_size; /* Size of element */
- void *val_rd, *odd_val;
- const void *init_val, *should_be, *even_val;
- int val_rd_i, init_val_i = 9999;
+ hid_t fspace = -1, mspace = -1; /* File & memory dataspaces */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hsize_t extend_size[5]; /* Dimensions to extend to */
+ hsize_t one[5] = {1, 1, 1, 1, 1}; /* Dimensions of single element dataspace */
+ hsize_t hs_size[5], hs_stride[5], hs_offset[5];
+ size_t nelmts;
+ H5T_class_t dtype_class; /* Class of datatype */
+ int (*init_rtn)(void *, size_t, const void *);
+ int (*verify_rtn)(unsigned, const hsize_t *, const void *, const void *);
+ int (*release_rtn)(void *);
+ size_t val_size; /* Size of element */
+ void * val_rd, *odd_val;
+ const void * init_val, *should_be, *even_val;
+ int val_rd_i, init_val_i = 9999;
comp_vl_datatype init_val_c = {87, NULL, NULL, 129};
comp_vl_datatype val_rd_c;
- void *buf = NULL;
- unsigned odd; /* Whether an odd or even coord. was read */
- unsigned i, j; /* Local index variables */
+ void * buf = NULL;
+ unsigned odd; /* Whether an odd or even coord. was read */
+ unsigned i, j; /* Local index variables */
/* Set vl datatype init value strings */
init_val_c.a = HDstrdup("baz");
init_val_c.b = HDstrdup("mumble");
/* Make copy of dataset creation property list */
- if((dcpl = H5Pcopy(_dcpl)) < 0) TEST_ERROR
+ if ((dcpl = H5Pcopy(_dcpl)) < 0)
+ TEST_ERROR
#ifndef NO_FILLING
- if(H5Pset_fill_value(dcpl, dtype, fillval) < 0) TEST_ERROR
+ if (H5Pset_fill_value(dcpl, dtype, fillval) < 0)
+ TEST_ERROR
#endif
/* Get class of datatype */
- if((dtype_class = H5Tget_class(dtype)) < 0) TEST_ERROR
+ if ((dtype_class = H5Tget_class(dtype)) < 0)
+ TEST_ERROR
/* Create a dataspace */
- if((fspace = H5Screate_simple(5, start_size, max_size)) < 0) TEST_ERROR
+ if ((fspace = H5Screate_simple(5, start_size, max_size)) < 0)
+ TEST_ERROR
/* Create dataset */
- if((dset = H5Dcreate2(file, dset_name, dtype, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
-
+ if ((dset = H5Dcreate2(file, dset_name, dtype, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Set up pointers to elements */
- if(dtype_class == H5T_INTEGER) {
+ if (dtype_class == H5T_INTEGER) {
/* Initialize specific values for this datatype */
- val_size = sizeof(int);
- init_val = &init_val_i;
- init_rtn = test_extend_init_integer;
- verify_rtn = test_extend_verify_integer;
+ val_size = sizeof(int);
+ init_val = &init_val_i;
+ init_rtn = test_extend_init_integer;
+ verify_rtn = test_extend_verify_integer;
release_rtn = test_extend_release_integer;
- val_rd = &val_rd_i;
- odd_val = fillval;
- even_val = &init_val_i;
+ val_rd = &val_rd_i;
+ odd_val = fillval;
+ even_val = &init_val_i;
} /* end if */
else {
/* Sanity check */
assert(dtype_class == H5T_COMPOUND);
/* Initialize specific values for this datatype */
- val_size = sizeof(comp_vl_datatype);
- init_val = &init_val_c;
- init_rtn = test_extend_init_cmpd_vl;
- verify_rtn = test_extend_verify_cmpd_vl;
+ val_size = sizeof(comp_vl_datatype);
+ init_val = &init_val_c;
+ init_rtn = test_extend_init_cmpd_vl;
+ verify_rtn = test_extend_verify_cmpd_vl;
release_rtn = test_extend_release_cmpd_vl;
- val_rd = &val_rd_c;
- odd_val = fillval;
- even_val = &init_val_c;
+ val_rd = &val_rd_c;
+ odd_val = fillval;
+ even_val = &init_val_c;
} /* end else */
-
/* Read some data and make sure it's the fill value */
- if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR
- for(i = 0; i < 1000; i++) {
+ if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
+ TEST_ERROR
+ for (i = 0; i < 1000; i++) {
/* Set offset for random element */
- for(j = 0; j < 5; j++)
- hs_offset[j] = (hsize_t)HDrand() % start_size[j];
+ for (j = 0; j < 5; j++)
+ hs_offset[j] = (hsize_t)HDrand() % start_size[j];
/* Select the random element */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ TEST_ERROR
/* Read the random element */
- if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Verify the element read in */
- if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, fillval) < 0) TEST_ERROR
+ if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, fillval) < 0)
+ TEST_ERROR
/* Release any VL components */
- if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
} /* end for */
- if(H5Sclose(mspace) < 0) TEST_ERROR
-
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR
/* Initialize dataspace & hyperslab info */
- for(i = 0, nelmts = 1; i < 5; i++) {
- hs_size[i] = (start_size[i] + 1) / 2;
- hs_offset[i] = 0;
- hs_stride[i] = 2;
- nelmts *= hs_size[i];
+ for (i = 0, nelmts = 1; i < 5; i++) {
+ hs_size[i] = (start_size[i] + 1) / 2;
+ hs_offset[i] = 0;
+ hs_stride[i] = 2;
+ nelmts *= hs_size[i];
} /* end for */
/* Check for overflow */
@@ -1549,186 +1708,219 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
init_rtn(buf, nelmts, init_val);
/* Create dataspace describing memory buffer */
- if((mspace = H5Screate_simple(5, hs_size, hs_size)) < 0) TEST_ERROR
+ if ((mspace = H5Screate_simple(5, hs_size, hs_size)) < 0)
+ TEST_ERROR
/* Select elements within file dataspace */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, hs_size, NULL) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, hs_size, NULL) < 0)
+ TEST_ERROR
/* Write to all even data locations */
- if(H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* Close memory dataspace */
- if(H5Sclose(mspace) < 0) TEST_ERROR
-
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR
/* Read some data and make sure it's the right value */
- if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR
- for(i = 0; i < 1000; i++) {
+ if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
+ TEST_ERROR
+ for (i = 0; i < 1000; i++) {
/* Set offset for random element */
- for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = (hsize_t)HDrand() % start_size[j];
- odd += (unsigned)(hs_offset[j] % 2);
- } /* end for */
+ for (j = 0, odd = 0; j < 5; j++) {
+ hs_offset[j] = (hsize_t)HDrand() % start_size[j];
+ odd += (unsigned)(hs_offset[j] % 2);
+ } /* end for */
/* Select the random element */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ TEST_ERROR
/* Read the random element */
- if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Verify the element read in */
- should_be = odd ? odd_val : even_val;
- if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
+ should_be = odd ? odd_val : even_val;
+ if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
+ TEST_ERROR
/* Release any VL components */
- if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
} /* end for */
- if(H5Sclose(mspace) < 0) TEST_ERROR
-
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR
/* Extend the dataset one element in each dimension */
- for(i = 0; i < 5; i++)
+ for (i = 0; i < 5; i++)
extend_size[i] = start_size[i] + 1;
- if(H5Dset_extent(dset, extend_size) < 0) TEST_ERROR
+ if (H5Dset_extent(dset, extend_size) < 0)
+ TEST_ERROR
/* Re-open file dataspace */
- if(H5Sclose(fspace) < 0) TEST_ERROR
- if((fspace = H5Dget_space(dset)) < 0) TEST_ERROR
-
+ if (H5Sclose(fspace) < 0)
+ TEST_ERROR
+ if ((fspace = H5Dget_space(dset)) < 0)
+ TEST_ERROR
/* Read some data and make sure it's the right value */
- if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR
- for(i = 0; i < 1000; i++) {
+ if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
+ TEST_ERROR
+ for (i = 0; i < 1000; i++) {
/* Set offset for random element */
- for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
- if(hs_offset[j] >= start_size[j])
- odd = 1;
- else
- odd += (unsigned)(hs_offset[j] % 2);
- } /* end for */
+ for (j = 0, odd = 0; j < 5; j++) {
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
+ if (hs_offset[j] >= start_size[j])
+ odd = 1;
+ else
+ odd += (unsigned)(hs_offset[j] % 2);
+ } /* end for */
/* Select the random element */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ TEST_ERROR
/* Read the random element */
- if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Verify the element read in */
- should_be = odd ? odd_val : even_val;
- if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
+ should_be = odd ? odd_val : even_val;
+ if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
+ TEST_ERROR
/* Release any VL components */
- if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
} /* end for */
- if(H5Sclose(mspace) < 0) TEST_ERROR
-
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR
/* Extend the dataset to the maximum dimension sizes */
- if(H5Dset_extent(dset, max_size) < 0) TEST_ERROR
+ if (H5Dset_extent(dset, max_size) < 0)
+ TEST_ERROR
/* Re-open file dataspace */
- if(H5Sclose(fspace) < 0) TEST_ERROR
- if((fspace = H5Dget_space(dset)) < 0) TEST_ERROR
-
+ if (H5Sclose(fspace) < 0)
+ TEST_ERROR
+ if ((fspace = H5Dget_space(dset)) < 0)
+ TEST_ERROR
/* Read some data and make sure it's the right value */
- if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR
- for(i = 0; i < 1000; i++) {
+ if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
+ TEST_ERROR
+ for (i = 0; i < 1000; i++) {
/* Set offset for random element */
- for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = (hsize_t)HDrand() % max_size[j];
- if(hs_offset[j] >= start_size[j])
- odd = 1;
- else
- odd += (unsigned)(hs_offset[j] % 2);
- } /* end for */
+ for (j = 0, odd = 0; j < 5; j++) {
+ hs_offset[j] = (hsize_t)HDrand() % max_size[j];
+ if (hs_offset[j] >= start_size[j])
+ odd = 1;
+ else
+ odd += (unsigned)(hs_offset[j] % 2);
+ } /* end for */
/* Select the random element */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ TEST_ERROR
/* Read the random element */
- if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Verify the element read in */
- should_be = odd ? odd_val : even_val;
- if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
+ should_be = odd ? odd_val : even_val;
+ if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
+ TEST_ERROR
/* Release any VL components */
- if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
} /* end for */
- if(H5Sclose(mspace) < 0) TEST_ERROR
-
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR
/* Shrink the dataset to half of it's maximum size, plus 1/2 of a chunk */
- for(i = 0; i < 5; i++)
+ for (i = 0; i < 5; i++)
extend_size[i] = (max_size[i] / 2) + (ch_size[i] / 2);
- if(H5Dset_extent(dset, extend_size) < 0) TEST_ERROR
+ if (H5Dset_extent(dset, extend_size) < 0)
+ TEST_ERROR
/* Re-open file dataspace */
- if(H5Sclose(fspace) < 0) TEST_ERROR
- if((fspace = H5Dget_space(dset)) < 0) TEST_ERROR
-
+ if (H5Sclose(fspace) < 0)
+ TEST_ERROR
+ if ((fspace = H5Dget_space(dset)) < 0)
+ TEST_ERROR
/* Read some data and make sure it's the right value */
- if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR
- for(i = 0; i < 1000; i++) {
+ if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
+ TEST_ERROR
+ for (i = 0; i < 1000; i++) {
/* Set offset for random element */
- for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
- if(hs_offset[j] >= start_size[j])
- odd = 1;
- else
- odd += (unsigned)(hs_offset[j] % 2);
- } /* end for */
+ for (j = 0, odd = 0; j < 5; j++) {
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
+ if (hs_offset[j] >= start_size[j])
+ odd = 1;
+ else
+ odd += (unsigned)(hs_offset[j] % 2);
+ } /* end for */
/* Select the random element */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ TEST_ERROR
/* Read the random element */
- if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Verify the element read in */
- should_be = odd ? odd_val : even_val;
- if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
+ should_be = odd ? odd_val : even_val;
+ if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
+ TEST_ERROR
/* Release any VL components */
- if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
} /* end for */
- if(H5Sclose(mspace) < 0) TEST_ERROR
-
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR
/* Extend the dataset's size by one element, in a dimension that won't
* cause additional chunks to be needed */
extend_size[2] += 1;
- if(H5Dset_extent(dset, extend_size) < 0) TEST_ERROR
+ if (H5Dset_extent(dset, extend_size) < 0)
+ TEST_ERROR
/* Re-open file dataspace */
- if(H5Sclose(fspace) < 0) TEST_ERROR
- if((fspace = H5Dget_space(dset)) < 0) TEST_ERROR
-
+ if (H5Sclose(fspace) < 0)
+ TEST_ERROR
+ if ((fspace = H5Dget_space(dset)) < 0)
+ TEST_ERROR
/* Create dataspace for single element sized bufer */
- if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR
+ if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
+ TEST_ERROR
/* Set location for "top-most" element in dataset to write */
- for(i = 0; i < 5; i++)
+ for (i = 0; i < 5; i++)
hs_offset[i] = extend_size[i] - 1;
/* Select the element */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ TEST_ERROR
/* Write one element in a chunk that's 'partial' and overwrite a fill
* value that was initialized in the H5Dset_extent() routine. This will
@@ -1736,75 +1928,86 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
* next read of another fill-value initialized element in this chunk will
* fail.
*/
- if(H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* Read value back in */
- if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Verify the element read in is the value written out */
- if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, buf) < 0) TEST_ERROR
+ if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, buf) < 0)
+ TEST_ERROR
/* Set the element back to fillval */
- if(H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, fillval) < 0) TEST_ERROR
+ if (H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, fillval) < 0)
+ TEST_ERROR
/* Release any VL components */
- if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
-
/* Set location for another element initialized by H5Dset_extent() */
hs_offset[3] -= 1;
/* Select the element */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ TEST_ERROR
/* Read value back in */
- if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Verify the element read in is the fill-value */
- if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, fillval) < 0) TEST_ERROR
+ if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, fillval) < 0)
+ TEST_ERROR
/* Release any VL components */
- if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
-
/* Read some data and make sure it's the right value */
- for(i = 0; i < 1000; i++) {
+ for (i = 0; i < 1000; i++) {
/* Set offset for random element */
- for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
- if(hs_offset[j] >= start_size[j])
- odd = 1;
- else
- odd += (unsigned)(hs_offset[j] % 2);
- } /* end for */
+ for (j = 0, odd = 0; j < 5; j++) {
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
+ if (hs_offset[j] >= start_size[j])
+ odd = 1;
+ else
+ odd += (unsigned)(hs_offset[j] % 2);
+ } /* end for */
/* Select the random element */
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ TEST_ERROR
/* Read the random element */
- if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Verify the element read in */
- should_be = odd ? odd_val : even_val;
- if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
+ should_be = odd ? odd_val : even_val;
+ if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
+ TEST_ERROR
/* Release any VL components */
- if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
+ TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
} /* end for */
- if(H5Sclose(mspace) < 0) TEST_ERROR
-
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR
/* Release elements & memory buffer */
- for(i = 0; i < nelmts; i++)
+ for (i = 0; i < nelmts; i++)
release_rtn((void *)((char *)buf + (val_size * i)));
HDfree(init_val_c.a);
@@ -1812,9 +2015,12 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
HDfree(buf);
/* Cleanup IDs */
- if(H5Pclose(dcpl) < 0) TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Sclose(fspace) < 0) TEST_ERROR
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Sclose(fspace) < 0)
+ TEST_ERROR
return 0;
@@ -1823,17 +2029,18 @@ error:
HDfree(init_val_c.b);
HDfree(buf);
- H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- H5Dclose(dset);
- H5Sclose(fspace);
- H5Sclose(mspace);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dcpl);
+ H5Dclose(dset);
+ H5Sclose(fspace);
+ H5Sclose(mspace);
+ }
+ H5E_END_TRY;
return -1;
} /* end test_extend_cases() */
-
/*-------------------------------------------------------------------------
* Function: test_extend
*
@@ -1853,34 +2060,36 @@ error:
static int
test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
{
- hid_t file = -1; /* File ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t cmpd_vl_tid = -1; /* Compound+vl datatype ID */
- hsize_t start_size[5] = {8, 8, 8, 4, 2};
- hsize_t max_size[5] = {32, 32, 32, 16, 8};
- hsize_t ch_size[5] = {1, 8, 8, 4, 2};
+ hid_t file = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t cmpd_vl_tid = -1; /* Compound+vl datatype ID */
+ hsize_t start_size[5] = {8, 8, 8, 4, 2};
+ hsize_t max_size[5] = {32, 32, 32, 16, 8};
+ hsize_t ch_size[5] = {1, 8, 8, 4, 2};
#ifdef NO_FILLING
- int fillval_i = 0;
+ int fillval_i = 0;
#else
- int fillval_i = 0x4c70f1cd;
+ int fillval_i = 0x4c70f1cd;
#endif
- comp_vl_datatype fillval_c = {32, NULL, NULL, 64}; /* Fill value for compound+vl datatype tests */
- char filename[1024];
+ comp_vl_datatype fillval_c = {32, NULL, NULL, 64}; /* Fill value for compound+vl datatype tests */
+ char filename[1024];
/* Print testing message */
- if(H5D_CHUNKED == layout)
- TESTING("chunked dataset extend")
+ if (H5D_CHUNKED == layout)
+ TESTING("chunked dataset extend")
else
- TESTING("contiguous dataset extend")
+ TESTING("contiguous dataset extend")
/* Set vl datatype fill value strings */
fillval_c.a = HDstrdup("foo");
fillval_c.b = HDstrdup("bar");
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5D_CHUNKED == layout)
- if(H5Pset_chunk(dcpl, 5, ch_size) < 0) TEST_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5D_CHUNKED == layout)
+ if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
+ TEST_ERROR
#if 1
/*
@@ -1893,14 +2102,13 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
* first dimension can be extendible' as long as the test isn't skipped
* below.
*/
- if(H5D_CONTIGUOUS==layout) {
- max_size[0] = (max_size[0] * max_size[1] * max_size[2] *
- max_size[3] * max_size[4]) /
- (start_size[1] * start_size[2] * start_size[3] * start_size[4]);
- max_size[1] = start_size[1];
- max_size[2] = start_size[2];
- max_size[3] = start_size[3];
- max_size[4] = start_size[4];
+ if (H5D_CONTIGUOUS == layout) {
+ max_size[0] = (max_size[0] * max_size[1] * max_size[2] * max_size[3] * max_size[4]) /
+ (start_size[1] * start_size[2] * start_size[3] * start_size[4]);
+ max_size[1] = start_size[1];
+ max_size[2] = start_size[2];
+ max_size[3] = start_size[3];
+ max_size[4] = start_size[4];
}
#endif
@@ -1911,15 +2119,16 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
* `extendible contiguous non-external dataset' as long as the test isn't
* skipped below.
*/
- if(H5D_CONTIGUOUS==layout) {
- int fd;
- hsize_t nelmts;
+ if (H5D_CONTIGUOUS == layout) {
+ int fd;
+ hsize_t nelmts;
- nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4];
- if((fd = HDopen(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0 ||
- HDclose(fd) < 0) goto error;
- if(H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int)) < 0)
- goto error;
+ nelmts = max_size[0] * max_size[1] * max_size[2] * max_size[3] * max_size[4];
+ if ((fd = HDopen(FILE_NAME_RAW, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0 ||
+ HDclose(fd) < 0)
+ goto error;
+ if (H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts * sizeof(int)) < 0)
+ goto error;
}
#endif
@@ -1930,32 +2139,37 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
* dimension. If it's removed prematurely then you'll get one of the
* errors described above or `unable to select fill value region'.
*/
- if(H5D_CONTIGUOUS==layout) {
- SKIPPED();
- puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator");
- goto skip;
+ if (H5D_CONTIGUOUS == layout) {
+ SKIPPED();
+ puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator");
+ goto skip;
}
#endif
/* Create a file and dataset */
h5_fixname(base_name, fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Get the compound+vl datatype */
- if((cmpd_vl_tid = create_compound_vl_type()) < 0) TEST_ERROR
+ if ((cmpd_vl_tid = create_compound_vl_type()) < 0)
+ TEST_ERROR
/* Test integer datatype case */
- if(test_extend_cases(file, dcpl, "dset1", ch_size, start_size, max_size,
- H5T_NATIVE_INT, &fillval_i) < 0) TEST_ERROR
+ if (test_extend_cases(file, dcpl, "dset1", ch_size, start_size, max_size, H5T_NATIVE_INT, &fillval_i) < 0)
+ TEST_ERROR
/* Test compound+vl datatype datatype case */
- if(test_extend_cases(file, dcpl, "dset2", ch_size, start_size, max_size,
- cmpd_vl_tid, &fillval_c) < 0) TEST_ERROR
+ if (test_extend_cases(file, dcpl, "dset2", ch_size, start_size, max_size, cmpd_vl_tid, &fillval_c) < 0)
+ TEST_ERROR
/* Cleanup */
- if(H5Tclose(cmpd_vl_tid) < 0) TEST_ERROR
- if(H5Pclose(dcpl) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Tclose(cmpd_vl_tid) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
HDfree(fillval_c.a);
HDfree(fillval_c.b);
@@ -1968,25 +2182,28 @@ error:
HDfree(fillval_c.a);
HDfree(fillval_c.b);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(cmpd_vl_tid);
- H5Pclose(dcpl);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5Pclose(dcpl);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
skip:
HDfree(fillval_c.a);
HDfree(fillval_c.b);
- H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dcpl);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 0;
} /* end test_extend() */
-
/*-------------------------------------------------------------------------
* Function: test_compatible
*
@@ -2007,108 +2224,129 @@ skip:
static int
test_compatible(void)
{
- hid_t file=-1, dset1=-1, dset2=-1;
- hid_t dcpl1=-1, dcpl2=-1, fspace=-1, mspace=-1;
- int rd_fill=0, fill_val=4444, val_rd=0;
- hsize_t dims[2], one[2]={1,1};
- hsize_t hs_offset[2]={3,4};
+ hid_t file = -1, dset1 = -1, dset2 = -1;
+ hid_t dcpl1 = -1, dcpl2 = -1, fspace = -1, mspace = -1;
+ int rd_fill = 0, fill_val = 4444, val_rd = 0;
+ hsize_t dims[2], one[2] = {1, 1};
+ hsize_t hs_offset[2] = {3, 4};
H5D_fill_value_t status;
- const char *testfile = H5_get_srcdir_filename(FILE_COMPATIBLE); /* Corrected test file name */
+ const char * testfile = H5_get_srcdir_filename(FILE_COMPATIBLE); /* Corrected test file name */
TESTING("contiguous dataset compatibility with v. 1.4");
- if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
- HDprintf(" Could not open file %s. Try set $srcdir to point at the "
- "source directory of test\n", testfile);
- goto error;
- }
-
- if((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error;
- if((dcpl1 = H5Dget_create_plist(dset1)) < 0) goto error;
- if(H5Pfill_value_defined(dcpl1, &status) < 0) goto error;
- if(status != H5D_FILL_VALUE_UNDEFINED) {
- H5_FAILED();
- HDprintf(" %d: Got a different fill value than what was set.",__LINE__);
- HDprintf(" Got status=%ld, suppose to be H5D_FILL_VALUE_UNDEFINED\n",
- (long)status);
- goto error;
- }
- if((fspace = H5Dget_space(dset1)) < 0) goto error;
- if(H5Sget_simple_extent_dims(fspace, dims, NULL) < 0) goto error;
- if(dims[0] != 8 || dims[1] != 8) {
- H5_FAILED();
- puts(" Got a different dimension size than what was set.");
- HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]);
- goto error;
- }
- if((mspace = H5Screate_simple(2, one, NULL)) < 0) goto error;
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
- goto error;
- if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
- goto error;
- if(val_rd != 0) {
- H5_FAILED();
- puts(" Got a different value than what was set.");
- HDprintf(" Got %ld, set 0\n", (long)val_rd);
- goto error;
- }
- if(H5Pclose(dcpl1) < 0) goto error;
- if(H5Sclose(fspace) < 0) goto error;
- if(H5Sclose(mspace) < 0) goto error;
- if(H5Dclose(dset1) < 0) goto error;
-
-
- if((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0) goto error;
- if((dcpl2 = H5Dget_create_plist(dset2)) < 0) goto error;
- if(H5Pfill_value_defined(dcpl2, &status) < 0) goto error;
- if(status != H5D_FILL_VALUE_USER_DEFINED) {
- H5_FAILED();
- HDprintf(" %d: Got a different fill value than what was set.",__LINE__);
- HDprintf(" Got status=%ld, suppose to be H5D_FILL_VALUE_USER_DEFINED\n",
- (long)status);
- goto error;
- }
- if(H5Pget_fill_value(dcpl2, H5T_NATIVE_INT, &rd_fill) < 0) goto error;
- if(rd_fill != fill_val) {
- H5_FAILED();
- HDprintf(" %d: Got a different fill value than what was set.",__LINE__);
- HDprintf(" Got %ld, set %ld\n", (long)rd_fill, (long)fill_val);
- goto error;
- }
- fspace = -1;
- if((fspace = H5Dget_space(dset2)) < 0) goto error;
- dims[0] = dims[1] = (hsize_t)-1;
- if(H5Sget_simple_extent_dims(fspace, dims, NULL) < 0) goto error;
- if(dims[0] != 8 || dims[1] != 8) {
- H5_FAILED();
- puts(" Got a different dimension size than what was set.");
- HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]);
- goto error;
- }
- if((mspace=H5Screate_simple(2, one, NULL)) < 0) goto error;
- if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
- goto error;
- if(H5Dread(dset2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
- goto error;
- if(val_rd != fill_val) {
- H5_FAILED();
- puts(" Got a different value than what was set.");
- HDprintf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val);
- goto error;
- }
- if(H5Pclose(dcpl2) < 0) goto error;
- if(H5Sclose(fspace) < 0) goto error;
- if(H5Sclose(mspace) < 0) goto error;
- if(H5Dclose(dset2) < 0) goto error;
-
- if(H5Fclose(file) < 0) goto error;
-
- PASSED();
+ if ((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ HDprintf(" Could not open file %s. Try set $srcdir to point at the "
+ "source directory of test\n",
+ testfile);
+ goto error;
+ }
+
+ if ((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dcpl1 = H5Dget_create_plist(dset1)) < 0)
+ goto error;
+ if (H5Pfill_value_defined(dcpl1, &status) < 0)
+ goto error;
+ if (status != H5D_FILL_VALUE_UNDEFINED) {
+ H5_FAILED();
+ HDprintf(" %d: Got a different fill value than what was set.", __LINE__);
+ HDprintf(" Got status=%ld, suppose to be H5D_FILL_VALUE_UNDEFINED\n", (long)status);
+ goto error;
+ }
+ if ((fspace = H5Dget_space(dset1)) < 0)
+ goto error;
+ if (H5Sget_simple_extent_dims(fspace, dims, NULL) < 0)
+ goto error;
+ if (dims[0] != 8 || dims[1] != 8) {
+ H5_FAILED();
+ puts(" Got a different dimension size than what was set.");
+ HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]);
+ goto error;
+ }
+ if ((mspace = H5Screate_simple(2, one, NULL)) < 0)
+ goto error;
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ goto error;
+ if (H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
+ goto error;
+ if (val_rd != 0) {
+ H5_FAILED();
+ puts(" Got a different value than what was set.");
+ HDprintf(" Got %ld, set 0\n", (long)val_rd);
+ goto error;
+ }
+ if (H5Pclose(dcpl1) < 0)
+ goto error;
+ if (H5Sclose(fspace) < 0)
+ goto error;
+ if (H5Sclose(mspace) < 0)
+ goto error;
+ if (H5Dclose(dset1) < 0)
+ goto error;
+
+ if ((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((dcpl2 = H5Dget_create_plist(dset2)) < 0)
+ goto error;
+ if (H5Pfill_value_defined(dcpl2, &status) < 0)
+ goto error;
+ if (status != H5D_FILL_VALUE_USER_DEFINED) {
+ H5_FAILED();
+ HDprintf(" %d: Got a different fill value than what was set.", __LINE__);
+ HDprintf(" Got status=%ld, suppose to be H5D_FILL_VALUE_USER_DEFINED\n", (long)status);
+ goto error;
+ }
+ if (H5Pget_fill_value(dcpl2, H5T_NATIVE_INT, &rd_fill) < 0)
+ goto error;
+ if (rd_fill != fill_val) {
+ H5_FAILED();
+ HDprintf(" %d: Got a different fill value than what was set.", __LINE__);
+ HDprintf(" Got %ld, set %ld\n", (long)rd_fill, (long)fill_val);
+ goto error;
+ }
+ fspace = -1;
+ if ((fspace = H5Dget_space(dset2)) < 0)
+ goto error;
+ dims[0] = dims[1] = (hsize_t)-1;
+ if (H5Sget_simple_extent_dims(fspace, dims, NULL) < 0)
+ goto error;
+ if (dims[0] != 8 || dims[1] != 8) {
+ H5_FAILED();
+ puts(" Got a different dimension size than what was set.");
+ HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]);
+ goto error;
+ }
+ if ((mspace = H5Screate_simple(2, one, NULL)) < 0)
+ goto error;
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
+ goto error;
+ if (H5Dread(dset2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
+ goto error;
+ if (val_rd != fill_val) {
+ H5_FAILED();
+ puts(" Got a different value than what was set.");
+ HDprintf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val);
+ goto error;
+ }
+ if (H5Pclose(dcpl2) < 0)
+ goto error;
+ if (H5Sclose(fspace) < 0)
+ goto error;
+ if (H5Sclose(mspace) < 0)
+ goto error;
+ if (H5Dclose(dset2) < 0)
+ goto error;
+
+ if (H5Fclose(file) < 0)
+ goto error;
+
+ PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl1);
H5Sclose(fspace);
H5Sclose(mspace);
@@ -2117,7 +2355,8 @@ error:
H5Sclose(fspace);
H5Dclose(dset2);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
@@ -2144,37 +2383,38 @@ error:
static int
test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t fill_time)
{
- hid_t fspace=-1, dset1=-1, rspace = -1;
- herr_t ret;
- hsize_t ds_size[2] = {4, 4};
- hsize_t max_size[2] = {H5S_UNLIMITED,4};
- hsize_t chunk_size[2] = {1, 4};
- int fillval=(-1);
- int w_values[] = {42}; /* New value to be written */
- int f_values[4] = {88,88,88,88}; /* pre-seed read buffer with known values */
- int r_values[4] = {88,88,88,88}; /* pre-seed read buffer with known values */
- hsize_t coord[1][2]; /* coordinate(s) of point to write */
+ hid_t fspace = -1, dset1 = -1, rspace = -1;
+ herr_t ret;
+ hsize_t ds_size[2] = {4, 4};
+ hsize_t max_size[2] = {H5S_UNLIMITED, 4};
+ hsize_t chunk_size[2] = {1, 4};
+ int fillval = (-1);
+ int w_values[] = {42}; /* New value to be written */
+ int f_values[4] = {88, 88, 88, 88}; /* pre-seed read buffer with known values */
+ int r_values[4] = {88, 88, 88, 88}; /* pre-seed read buffer with known values */
+ hsize_t coord[1][2]; /* coordinate(s) of point to write */
hsize_t start[2], count[2];
- fillval = 0; /* default fill value is zero */
+ fillval = 0; /* default fill value is zero */
/* Create dataset with 4x4 integer dataset */
- if((fspace = H5Screate_simple(2, ds_size, max_size)) < 0)
+ if ((fspace = H5Screate_simple(2, ds_size, max_size)) < 0)
goto error;
- if((dset1 = H5Dcreate2(file, dname, H5T_NATIVE_INT, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset1 = H5Dcreate2(file, dname, H5T_NATIVE_INT, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/*
* Select a point in the file dataspace.
*/
- coord[0][0]=0; coord[0][1]=0;
- if (H5Sselect_elements( fspace, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord))
+ coord[0][0] = 0;
+ coord[0][1] = 0;
+ if (H5Sselect_elements(fspace, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord))
goto error;
/*
* Write single data point to the dataset.
*/
- if ((ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, fspace, H5P_DEFAULT, w_values))< 0) {
+ if ((ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, fspace, H5P_DEFAULT, w_values)) < 0) {
goto error;
}
@@ -2189,8 +2429,8 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t
if ((ret = H5Sselect_hyperslab(fspace, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
goto error;
if ((ret = H5Sselect_all(rspace)) < 0)
- goto error;
- if(H5Dread(dset1, H5T_NATIVE_INT, rspace, fspace, H5P_DEFAULT, &r_values) < 0)
+ goto error;
+ if (H5Dread(dset1, H5T_NATIVE_INT, rspace, fspace, H5P_DEFAULT, &r_values) < 0)
goto error;
/* Read the third row of elements: all fill */
@@ -2200,59 +2440,55 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t
count[1] = 4;
if ((ret = H5Sselect_hyperslab(fspace, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
goto error;
- if(H5Dread(dset1, H5T_NATIVE_INT, rspace, fspace, H5P_DEFAULT, &f_values) < 0)
+ if (H5Dread(dset1, H5T_NATIVE_INT, rspace, fspace, H5P_DEFAULT, &f_values) < 0)
goto error;
- if(fill_time != H5D_FILL_TIME_NEVER) {
+ if (fill_time != H5D_FILL_TIME_NEVER) {
/* check allocated chunk */
- if ((r_values[0] != w_values[0]) ||
- (r_values[1] != fillval) ||
- (r_values[2] != fillval) ||
- (r_values[3] != fillval)) {
+ if ((r_values[0] != w_values[0]) || (r_values[1] != fillval) || (r_values[2] != fillval) ||
+ (r_values[3] != fillval)) {
H5_FAILED();
HDfprintf(stdout, "%u: Allocated chunk value read was not correct.\n", (unsigned)__LINE__);
- HDprintf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n",
- (long)r_values[0], (long)r_values[1],
- (long)r_values[2], (long)r_values[3],
- (long)w_values[0], (long)fillval,
- (long)fillval, (long)fillval );
+ HDprintf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", (long)r_values[0],
+ (long)r_values[1], (long)r_values[2], (long)r_values[3], (long)w_values[0],
+ (long)fillval, (long)fillval, (long)fillval);
goto error;
}
/* check unallocated chunk */
- if ((f_values[0] != fillval) ||
- (f_values[1] != fillval) ||
- (f_values[2] != fillval) ||
- (f_values[3] != fillval)) {
+ if ((f_values[0] != fillval) || (f_values[1] != fillval) || (f_values[2] != fillval) ||
+ (f_values[3] != fillval)) {
H5_FAILED();
HDfprintf(stdout, "%u: Unallocated chunk value read was not correct.\n", (unsigned)__LINE__);
- HDprintf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n",
- (long)f_values[0], (long)f_values[1],
- (long)f_values[2], (long)f_values[3],
- (long)fillval, (long)fillval,
- (long)fillval, (long)fillval );
+ HDprintf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", (long)f_values[0],
+ (long)f_values[1], (long)f_values[2], (long)f_values[3], (long)fillval, (long)fillval,
+ (long)fillval, (long)fillval);
goto error;
}
/* for the "never fill" case expect to get trash values, so skip */
}
- else if(fill_time == H5D_FILL_TIME_NEVER) {
+ else if (fill_time == H5D_FILL_TIME_NEVER) {
}
- if(H5Sclose(rspace) < 0) goto error;
- if(H5Dclose(dset1) < 0) goto error;
- if(H5Sclose(fspace) < 0) goto error;
+ if (H5Sclose(rspace) < 0)
+ goto error;
+ if (H5Dclose(dset1) < 0)
+ goto error;
+ if (H5Sclose(fspace) < 0)
+ goto error;
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Dclose(dset1);
- H5Sclose(fspace);
- H5Sclose(rspace);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dset1);
+ H5Sclose(fspace);
+ H5Sclose(rspace);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_partalloc
*
@@ -2271,117 +2507,134 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t
static int
test_partalloc(hid_t fapl, const char *base_name)
{
- char filename[1024];
- hid_t file=-1, dcpl=-1;
- hsize_t ch_size[2] = {1, 4};
- int nerrors=0;
+ char filename[1024];
+ hid_t file = -1, dcpl = -1;
+ hsize_t ch_size[2] = {1, 4};
+ int nerrors = 0;
TESTING("chunked dataset partially allocated I/O");
h5_fixname(base_name, fapl, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dcpl, 2, ch_size) < 0) goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, 2, ch_size) < 0)
+ goto error;
/* I. Test H5D_ALLOC_TIME_LATE space allocation cases */
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) goto error;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, "\nALLOC_TIME_LATE\n" );
+ HDfprintf(stdout, "\nALLOC_TIME_LATE\n");
#endif
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, " FILL_TIME_ALLOC\n" );
+ HDfprintf(stdout, " FILL_TIME_ALLOC\n");
#endif
nerrors += test_partalloc_cases(file, dcpl, "dset1", H5D_FILL_TIME_ALLOC);
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, " FILL_TIME_NEVER\n" );
+ HDfprintf(stdout, " FILL_TIME_NEVER\n");
#endif
- nerrors += test_partalloc_cases(file, dcpl, "dset2", H5D_FILL_TIME_NEVER );
+ nerrors += test_partalloc_cases(file, dcpl, "dset2", H5D_FILL_TIME_NEVER);
/* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, " FILL_TIME_IFSET\n" );
+ HDfprintf(stdout, " FILL_TIME_IFSET\n");
#endif
- nerrors += test_partalloc_cases(file, dcpl, "dset3", H5D_FILL_TIME_IFSET );
+ nerrors += test_partalloc_cases(file, dcpl, "dset3", H5D_FILL_TIME_IFSET);
/* II. Test H5D_ALLOC_TIME_INCR space allocation cases */
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR) < 0) goto error;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, "\nALLOC_TIME_INCR\n" );
+ HDfprintf(stdout, "\nALLOC_TIME_INCR\n");
#endif
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, " FILL_TIME_ALLOC\n" );
+ HDfprintf(stdout, " FILL_TIME_ALLOC\n");
#endif
- nerrors += test_partalloc_cases(file, dcpl, "dset4", H5D_FILL_TIME_ALLOC );
+ nerrors += test_partalloc_cases(file, dcpl, "dset4", H5D_FILL_TIME_ALLOC);
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, " FILL_TIME_NEVER\n" );
+ HDfprintf(stdout, " FILL_TIME_NEVER\n");
#endif
- nerrors += test_partalloc_cases(file, dcpl, "dset5", H5D_FILL_TIME_NEVER );
+ nerrors += test_partalloc_cases(file, dcpl, "dset5", H5D_FILL_TIME_NEVER);
/* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, " FILL_TIME_IFSET\n" );
+ HDfprintf(stdout, " FILL_TIME_IFSET\n");
#endif
- nerrors += test_partalloc_cases(file, dcpl, "dset6", H5D_FILL_TIME_IFSET );
+ nerrors += test_partalloc_cases(file, dcpl, "dset6", H5D_FILL_TIME_IFSET);
/* III. Test H5D_ALLOC_TIME_EARLY space allocation cases */
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, "\nALLOC_TIME_EARLY\n" );
+ HDfprintf(stdout, "\nALLOC_TIME_EARLY\n");
#endif
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, " FILL_TIME_ALLOC\n" );
+ HDfprintf(stdout, " FILL_TIME_ALLOC\n");
#endif
- nerrors += test_partalloc_cases(file, dcpl, "dset7", H5D_FILL_TIME_ALLOC );
+ nerrors += test_partalloc_cases(file, dcpl, "dset7", H5D_FILL_TIME_ALLOC);
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, " FILL_TIME_NEVER\n" );
+ HDfprintf(stdout, " FILL_TIME_NEVER\n");
#endif
- nerrors += test_partalloc_cases(file, dcpl, "dset8", H5D_FILL_TIME_NEVER );
+ nerrors += test_partalloc_cases(file, dcpl, "dset8", H5D_FILL_TIME_NEVER);
/* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
+ goto error;
#ifdef DEBUG
- HDfprintf( stdout, " FILL_TIME_IFSET\n" );
+ HDfprintf(stdout, " FILL_TIME_IFSET\n");
#endif
- nerrors += test_partalloc_cases(file, dcpl, "dset9", H5D_FILL_TIME_IFSET );
+ nerrors += test_partalloc_cases(file, dcpl, "dset9", H5D_FILL_TIME_IFSET);
- if(nerrors)
- goto error;
- if(H5Pclose(dcpl) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if (nerrors)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return nerrors;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2399,25 +2652,25 @@ test_partalloc(hid_t fapl, const char *base_name)
int
main(int argc, char *argv[])
{
- int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1;
- hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
- unsigned new_format; /* Whether to use the new format or not */
+ int nerrors = 0, argno, test_contig = 1, test_chunk = 1, test_compact = 1;
+ hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
+ unsigned new_format; /* Whether to use the new format or not */
- if(argc >= 2) {
+ if (argc >= 2) {
test_contig = test_chunk = test_compact = 0;
- for(argno = 1; argno < argc; argno++) {
- if(!strcmp(argv[argno], "contiguous"))
+ for (argno = 1; argno < argc; argno++) {
+ if (!strcmp(argv[argno], "contiguous"))
test_contig = 1;
- else if(!strcmp(argv[argno], "chunked"))
+ else if (!strcmp(argv[argno], "chunked"))
test_chunk = 1;
- else if(!strcmp(argv[argno], "compact"))
- test_compact =1;
+ else if (!strcmp(argv[argno], "compact"))
+ test_compact = 1;
else {
HDfprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]);
HDexit(EXIT_FAILURE);
}
} /* end for */
- } /* end if */
+ } /* end if */
h5_reset();
fapl = h5_fileaccess();
@@ -2427,17 +2680,19 @@ main(int argc, char *argv[])
nerrors += test_getset_vl(fapl);
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
/* Loop over using new group format */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl;
/* Set the FAPL for the type of format */
- if(new_format) {
+ if (new_format) {
puts("\nTesting with new file format:");
my_fapl = fapl2;
} /* end if */
@@ -2447,27 +2702,27 @@ main(int argc, char *argv[])
} /* end else */
/* Chunked storage layout tests */
- if(test_chunk) {
+ if (test_chunk) {
nerrors += test_create(my_fapl, FILENAME[0], H5D_CHUNKED);
- nerrors += test_rdwr (my_fapl, FILENAME[2], H5D_CHUNKED);
+ nerrors += test_rdwr(my_fapl, FILENAME[2], H5D_CHUNKED);
nerrors += test_extend(my_fapl, FILENAME[4], H5D_CHUNKED);
nerrors += test_partalloc(my_fapl, FILENAME[8]);
} /* end if */
/* Contiguous storage layout tests */
- if(test_contig) {
+ if (test_contig) {
nerrors += test_create(my_fapl, FILENAME[1], H5D_CONTIGUOUS);
- nerrors += test_rdwr (my_fapl, FILENAME[3], H5D_CONTIGUOUS);
+ nerrors += test_rdwr(my_fapl, FILENAME[3], H5D_CONTIGUOUS);
nerrors += test_extend(my_fapl, FILENAME[5], H5D_CONTIGUOUS);
nerrors += test_compatible();
} /* end if */
/* Compact dataset storage tests */
- if(test_compact) {
+ if (test_compact) {
nerrors += test_create(my_fapl, FILENAME[6], H5D_COMPACT);
- nerrors += test_rdwr (my_fapl, FILENAME[7], H5D_COMPACT);
+ nerrors += test_rdwr(my_fapl, FILENAME[7], H5D_COMPACT);
} /* end if */
- } /* end for */
+ } /* end for */
/* Close 2nd FAPL */
H5Pclose(fapl2);
@@ -2475,11 +2730,11 @@ main(int argc, char *argv[])
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All fill value tests passed.");
- if(h5_cleanup(FILENAME, fapl))
+ if (h5_cleanup(FILENAME, fapl))
HDremove(FILE_NAME_RAW);
HDexit(EXIT_SUCCESS);
@@ -2488,4 +2743,3 @@ error:
HDputs("***** FILL VALUE TESTS FAILED *****");
HDexit(EXIT_FAILURE);
}
-
diff --git a/test/filter_fail.c b/test/filter_fail.c
index b3e5c8a..dca9a20 100644
--- a/test/filter_fail.c
+++ b/test/filter_fail.c
@@ -21,32 +21,27 @@
#include "h5test.h"
-#define DSET_NAME "dset_fail"
-#define H5Z_FILTER_FAIL_TEST 312
-#define DIM 10
-#define FILTER_CHUNK_DIM 2
+#define DSET_NAME "dset_fail"
+#define H5Z_FILTER_FAIL_TEST 312
+#define DIM 10
+#define FILTER_CHUNK_DIM 2
-const char *FILENAME[] = {
- "filter_fail_with_cache",
- "filter_fail_without_cache",
- NULL
-};
+const char *FILENAME[] = {"filter_fail_with_cache", "filter_fail_without_cache", NULL};
-static size_t filter_fail(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_fail(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_FAIL_TEST[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_FAIL_TEST, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "filter_fail_test", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_fail, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_FAIL_TEST, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "filter_fail_test", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_fail, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: filter_fail
*
@@ -62,22 +57,22 @@ const H5Z_class2_t H5Z_FAIL_TEST[1] = {{
*-------------------------------------------------------------------------
*/
static size_t
-filter_fail(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+filter_fail(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned int H5_ATTR_UNUSED *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf)
{
- int *dst = (int*)(*buf);
- size_t ret_value = 0;
+ int * dst = (int *)(*buf);
+ size_t ret_value = 0;
- if(flags & H5Z_FLAG_REVERSE) { /* do nothing during read */
+ if (flags & H5Z_FLAG_REVERSE) { /* do nothing during read */
*buf_size = nbytes;
ret_value = nbytes;
- } /* end if */
+ } /* end if */
else { /* Write data */
/* If it's the last chunk, pretend to fail. Otherwise, do nothing. */
- if(*dst == 8 || *dst == 9) {
+ if (*dst == 8 || *dst == 9) {
ret_value = 0;
- } else {
+ }
+ else {
*buf_size = nbytes;
ret_value = *buf_size;
}
@@ -86,7 +81,6 @@ filter_fail(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
return ret_value;
} /* end filter_fail() */
-
/*-------------------------------------------------------------------------
* Function: test_filter_write_failure
*
@@ -114,104 +108,116 @@ filter_fail(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
static herr_t
test_filter_write(char *file_name, hid_t my_fapl, hbool_t cache_enabled)
{
- hid_t file = -1;
- hid_t dataset=-1; /* dataset ID */
- hid_t sid=-1; /* dataspace ID */
- hid_t dcpl=-1; /* dataset creation property list ID */
- hsize_t dims[1]={DIM}; /* dataspace dimension - 10*/
- hsize_t chunk_dims[1]={FILTER_CHUNK_DIM}; /* chunk dimension - 2*/
- int points[DIM]; /* Data */
- herr_t ret; /* generic return value */
- int i;
-
- if(cache_enabled) {
+ hid_t file = -1;
+ hid_t dataset = -1; /* dataset ID */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t dcpl = -1; /* dataset creation property list ID */
+ hsize_t dims[1] = {DIM}; /* dataspace dimension - 10*/
+ hsize_t chunk_dims[1] = {FILTER_CHUNK_DIM}; /* chunk dimension - 2*/
+ int points[DIM]; /* Data */
+ herr_t ret; /* generic return value */
+ int i;
+
+ if (cache_enabled) {
TESTING("data writing when a mandatory filter fails and chunk cache is enabled");
- } else {
+ }
+ else {
TESTING("data writing when a mandatory filter fails and chunk cache is disabled");
}
/* Create file */
- if((file = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if ((file = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
/* create the data space */
- if((sid = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
/* Create dcpl and register the filter */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) TEST_ERROR
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ TEST_ERROR
- if(H5Zregister (H5Z_FAIL_TEST) < 0) TEST_ERROR
+ if (H5Zregister(H5Z_FAIL_TEST) < 0)
+ TEST_ERROR
/* Check that the filter was registered */
- if(TRUE != H5Zfilter_avail(H5Z_FILTER_FAIL_TEST)) FAIL_STACK_ERROR
+ if (TRUE != H5Zfilter_avail(H5Z_FILTER_FAIL_TEST))
+ FAIL_STACK_ERROR
/* Enable the filter as mandatory */
- if(H5Pset_filter(dcpl, H5Z_FILTER_FAIL_TEST, 0, (size_t)0, NULL) < 0)
+ if (H5Pset_filter(dcpl, H5Z_FILTER_FAIL_TEST, 0, (size_t)0, NULL) < 0)
TEST_ERROR
/* create a dataset */
- if((dataset = H5Dcreate2(file, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Initialize the write buffer */
- for(i = 0; i < DIM; i++)
+ for (i = 0; i < DIM; i++)
points[i] = i;
/* Write data. If the chunk cache is enabled, H5Dwrite should succeed. If it is
* diabled, H5Dwrite should fail. */
- if(cache_enabled) {
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points) < 0)
+ if (cache_enabled) {
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points) < 0)
TEST_ERROR
- } else {
+ }
+ else {
/* Data writing should fail */
- H5E_BEGIN_TRY {
- ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points);
- } H5E_END_TRY;
- if(ret >= 0) {
- H5_FAILED();
- puts(" Data writing is supposed to fail because the chunk can't be written to file.");
- TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points); }
+ H5E_END_TRY;
+ if (ret >= 0) {
+ H5_FAILED();
+ puts(" Data writing is supposed to fail because the chunk can't be written to file.");
+ TEST_ERROR
}
}
/* clean up objects used for this test */
- if(H5Pclose (dcpl) < 0) TEST_ERROR
- if(H5Sclose (sid) < 0) TEST_ERROR
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* Close dataset. If the chunk cache is enabled, the flushing of chunks should fail
* during H5Dclose. If it is diabled, H5Dwrite should fail but H5Dclose should succeed. */
- if(cache_enabled) {
- H5E_BEGIN_TRY {
- ret = H5Dclose (dataset);
- } H5E_END_TRY;
- if(ret >= 0) {
- H5_FAILED();
- puts(" Dataset is supposed to fail because the chunk can't be flushed to file.");
- TEST_ERROR
+ if (cache_enabled) {
+ H5E_BEGIN_TRY { ret = H5Dclose(dataset); }
+ H5E_END_TRY;
+ if (ret >= 0) {
+ H5_FAILED();
+ puts(" Dataset is supposed to fail because the chunk can't be flushed to file.");
+ TEST_ERROR
}
- } else {
- if(H5Dclose (dataset) < 0)
+ }
+ else {
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
}
/* Even though H5Dclose or H5Dwrite fails, it should release all resources.
* So the file should close successfully. */
- if(H5Fclose (file) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(dataset);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_filter_write() */
-
/*-------------------------------------------------------------------------
* Function: test_filter_read
*
@@ -233,48 +239,53 @@ error:
static herr_t
test_filter_read(char *file_name, hid_t my_fapl)
{
- hid_t file = -1;
- hid_t dataset=-1; /* dataset ID */
- hid_t sid = -1;
- hid_t mspace = -1;
- hsize_t dims[1]={DIM}; /* dataspace dimension - 10*/
- int rbuf[DIM]; /* Data */
- hsize_t dset_size = 0; /* Dataset storage size */
- hsize_t hs_offset[H5S_MAX_RANK];
- hsize_t hs_size[H5S_MAX_RANK];
- hsize_t stride[1] = {2};
- hsize_t zero[8];
- hsize_t nelmts = DIM/2;
- int i;
+ hid_t file = -1;
+ hid_t dataset = -1; /* dataset ID */
+ hid_t sid = -1;
+ hid_t mspace = -1;
+ hsize_t dims[1] = {DIM}; /* dataspace dimension - 10*/
+ int rbuf[DIM]; /* Data */
+ hsize_t dset_size = 0; /* Dataset storage size */
+ hsize_t hs_offset[H5S_MAX_RANK];
+ hsize_t hs_size[H5S_MAX_RANK];
+ hsize_t stride[1] = {2};
+ hsize_t zero[8];
+ hsize_t nelmts = DIM / 2;
+ int i;
TESTING("data reading when a mandatory filter fails");
/* Open file */
- if((file = H5Fopen(file_name, H5F_ACC_RDONLY, my_fapl)) < 0) TEST_ERROR
+ if ((file = H5Fopen(file_name, H5F_ACC_RDONLY, my_fapl)) < 0)
+ TEST_ERROR
/* Open dataset */
- if((dataset = H5Dopen2(file, DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dataset = H5Dopen2(file, DSET_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Verify the storage size is equal to 4 chunks */
- if((dset_size = H5Dget_storage_size(dataset)) == 0) TEST_ERROR
+ if ((dset_size = H5Dget_storage_size(dataset)) == 0)
+ TEST_ERROR
- if(dset_size != 4 * FILTER_CHUNK_DIM * sizeof(int)) TEST_ERROR
+ if (dset_size != 4 * FILTER_CHUNK_DIM * sizeof(int))
+ TEST_ERROR
/* Read the chunks */
HDmemset(rbuf, 0, DIM * sizeof(int));
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
TEST_ERROR
/* Check that the values read are the same as the values written.
* The last chunk should not be in the file. */
- for(i = 0; i < DIM; i++) {
- if(i < DIM-2 && rbuf[i] != i) {
+ for (i = 0; i < DIM; i++) {
+ if (i < DIM - 2 && rbuf[i] != i) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d\n", i);
HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]);
TEST_ERROR
- } else if(i >= DIM-2 && rbuf[i] != 0) {
+ }
+ else if (i >= DIM - 2 && rbuf[i] != 0) {
H5_FAILED();
HDprintf(" No value should be read.\n");
HDprintf(" At index %d\n", i);
@@ -284,37 +295,40 @@ test_filter_read(char *file_name, hid_t my_fapl)
}
/* Try to read in hyperslab simulating the h5dump's way of printing data */
- if((sid = H5Dget_space(dataset)) < 0) TEST_ERROR
+ if ((sid = H5Dget_space(dataset)) < 0)
+ TEST_ERROR
HDmemset(hs_offset, 0, sizeof(hs_offset));
- HDmemset(hs_size, 0, sizeof(hs_size));
- hs_size[0] = DIM/2;
+ HDmemset(hs_size, 0, sizeof(hs_size));
+ hs_size[0] = DIM / 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, stride, hs_size, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, stride, hs_size, NULL) < 0)
TEST_ERROR
/* create the data space */
- if((mspace = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
+ if ((mspace = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
HDmemset(zero, 0, sizeof zero);
- if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, zero, stride, &nelmts, NULL) < 0)
+ if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, zero, stride, &nelmts, NULL) < 0)
TEST_ERROR
HDmemset(rbuf, 0, DIM * sizeof(int));
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rbuf) < 0)
TEST_ERROR
/* Check that the values read are the same as the values written.
* The last chunk should not be in the file. */
- for(i = 0; i < DIM; i+=2) {
- if(i < DIM-2 && rbuf[i] != i) {
+ for (i = 0; i < DIM; i += 2) {
+ if (i < DIM - 2 && rbuf[i] != i) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d\n", i);
HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]);
TEST_ERROR
- } else if(i >= DIM-2 && rbuf[i] != 0) {
+ }
+ else if (i >= DIM - 2 && rbuf[i] != 0) {
H5_FAILED();
HDprintf(" No value should be read.\n");
HDprintf(" At index %d\n", i);
@@ -323,21 +337,27 @@ test_filter_read(char *file_name, hid_t my_fapl)
}
}
- if(H5Sclose (sid) < 0) TEST_ERROR
- if(H5Sclose (mspace) < 0) TEST_ERROR
- if(H5Dclose (dataset) < 0) TEST_ERROR
- if(H5Fclose (file) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Sclose(mspace);
H5Dclose(dataset);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_filter_read() */
@@ -357,13 +377,13 @@ error:
int
main(void)
{
- hid_t fapl;
- int mdc_nelmts = 0;
- size_t rdcc_nelmts = 0;
- size_t rdcc_nbytes = 0;
- double rdcc_w0 = 0;
- char filename[1024];
- unsigned nerrors = 0;
+ hid_t fapl;
+ int mdc_nelmts = 0;
+ size_t rdcc_nelmts = 0;
+ size_t rdcc_nbytes = 0;
+ double rdcc_w0 = 0;
+ char filename[1024];
+ unsigned nerrors = 0;
h5_reset();
fapl = h5_fileaccess();
@@ -372,19 +392,19 @@ main(void)
/* The chunk cache is used so that the flushing of data chunks happens
* during H5Dclose. All values are default. */
- nerrors += (test_filter_write(filename, fapl, TRUE) < 0 ? 1 : 0);
- nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0);
+ nerrors += (test_filter_write(filename, fapl, TRUE) < 0 ? 1 : 0);
+ nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0);
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
/* Disable the chunk cache so that the writing of data chunks happens
* during H5Dwrite. */
- if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
+ if (H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
TEST_ERROR
/* Run the test again. */
- nerrors += (test_filter_write(filename, fapl, FALSE) < 0 ? 1 : 0);
- nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0);
+ nerrors += (test_filter_write(filename, fapl, FALSE) < 0 ? 1 : 0);
+ nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0);
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
@@ -392,16 +412,17 @@ main(void)
h5_cleanup(FILENAME, fapl);
/* Make sure we can close the library */
- if(H5close() < 0) TEST_ERROR
+ if (H5close() < 0)
+ TEST_ERROR
- if (nerrors) TEST_ERROR
+ if (nerrors)
+ TEST_ERROR
HDexit(EXIT_SUCCESS);
error:
if (nerrors) {
- HDprintf("***** %u FAILURE%s! *****\n",
- nerrors, 1==nerrors?"":"S");
+ HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
}
} /* end main() */
diff --git a/test/filter_plugin.c b/test/filter_plugin.c
index 529a440..7956ab3 100644
--- a/test/filter_plugin.c
+++ b/test/filter_plugin.c
@@ -25,55 +25,50 @@
#include "H5Zpkg.h"
/* Filters IDs for test filter plugins */
-#define FILTER1_ID 257
-#define FILTER2_ID 258
-#define FILTER3_ID 259
-#define FILTER4_ID 260
+#define FILTER1_ID 257
+#define FILTER2_ID 258
+#define FILTER3_ID 259
+#define FILTER4_ID 260
-const char *FILENAME[] = {
- "filter_plugin",
- NULL
-};
-#define FILENAME_BUF_SIZE 1024
+const char *FILENAME[] = {"filter_plugin", NULL};
+#define FILENAME_BUF_SIZE 1024
/* Dataset names */
-#define DSET_DEFLATE_NAME "deflate dset"
-#define DSET_FILTER1_NAME "filter 1 dset"
-#define DSET_FILTER2_NAME "filter 2 dset"
-#define DSET_FILTER3_NAME "filter 3 dset"
+#define DSET_DEFLATE_NAME "deflate dset"
+#define DSET_FILTER1_NAME "filter 1 dset"
+#define DSET_FILTER2_NAME "filter 2 dset"
+#define DSET_FILTER3_NAME "filter 3 dset"
/* Array sizes used throughout the test */
-#define DSET_DIM1 100
-#define DSET_DIM2 200
-#define CHUNK_DIM1 2
-#define CHUNK_DIM2 25
-#define HYPERSLAB_OFFSET1 7
-#define HYPERSLAB_OFFSET2 30
-#define HYPERSLAB_SIZE1 4
-#define HYPERSLAB_SIZE2 50
+#define DSET_DIM1 100
+#define DSET_DIM2 200
+#define CHUNK_DIM1 2
+#define CHUNK_DIM2 25
+#define HYPERSLAB_OFFSET1 7
+#define HYPERSLAB_OFFSET2 30
+#define HYPERSLAB_SIZE1 4
+#define HYPERSLAB_SIZE2 50
/* Global size arrays */
-const hsize_t sizes_g[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */
-const hsize_t hs_sizes_g[2] = {HYPERSLAB_SIZE1, HYPERSLAB_SIZE2}; /* Hyperslab sizes */
-const hsize_t hs_offsets_g[2] = {HYPERSLAB_OFFSET1, HYPERSLAB_OFFSET2}; /* Hyperslab offsets */
-const hsize_t chunk_sizes_g[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */
+const hsize_t sizes_g[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */
+const hsize_t hs_sizes_g[2] = {HYPERSLAB_SIZE1, HYPERSLAB_SIZE2}; /* Hyperslab sizes */
+const hsize_t hs_offsets_g[2] = {HYPERSLAB_OFFSET1, HYPERSLAB_OFFSET2}; /* Hyperslab offsets */
+const hsize_t chunk_sizes_g[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */
/* Limit random number within 20000 */
-#define RANDOM_LIMIT 20000
+#define RANDOM_LIMIT 20000
/* Things used in the groups + filter plugins test */
-#define N_SUBGROUPS 1000
-#define SUBGROUP_PREFIX "subgroup_"
-#define TOP_LEVEL_GROUP_NAME "top-level group"
+#define N_SUBGROUPS 1000
+#define SUBGROUP_PREFIX "subgroup_"
+#define TOP_LEVEL_GROUP_NAME "top-level group"
/* Global arrays in which to save data */
-int **orig_deflate_g = NULL;
-int **orig_dynlib1_g = NULL;
-int **orig_dynlib2_g = NULL;
-int **orig_dynlib4_g = NULL;
+int **orig_deflate_g = NULL;
+int **orig_dynlib1_g = NULL;
+int **orig_dynlib2_g = NULL;
+int **orig_dynlib4_g = NULL;
-
-
/*-------------------------------------------------------------------------
* Function: free_2D_array
*
@@ -85,7 +80,8 @@ int **orig_dynlib4_g = NULL;
*-------------------------------------------------------------------------
*/
static herr_t
-free_2D_array(int ***arr) {
+free_2D_array(int ***arr)
+{
if (arr && *arr && (*arr)[0])
HDfree((*arr)[0]);
@@ -96,7 +92,6 @@ free_2D_array(int ***arr) {
return SUCCEED;
} /* end free_2D_array() */
-
/*-------------------------------------------------------------------------
* Function: allocate_and_init_2D_array
*
@@ -108,11 +103,12 @@ free_2D_array(int ***arr) {
*-------------------------------------------------------------------------
*/
static herr_t
-allocate_and_init_2D_array(int ***arr, const hsize_t *sizes, int **initial_values) {
+allocate_and_init_2D_array(int ***arr, const hsize_t *sizes, int **initial_values)
+{
- size_t r, c; /* Data rows and columns */
- size_t i; /* Iterator */
- size_t n_bytes; /* # of bytes to copy */
+ size_t r, c; /* Data rows and columns */
+ size_t i; /* Iterator */
+ size_t n_bytes; /* # of bytes to copy */
r = (size_t)sizes[0];
c = (size_t)sizes[1];
@@ -138,7 +134,6 @@ error:
return FAIL;
} /* end allocate_and_init_2D_array() */
-
/*-------------------------------------------------------------------------
* Function: compare_2D_arrays
*
@@ -149,8 +144,9 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-compare_2D_arrays(int **dset1, int **dset2, const hsize_t *sizes, /*OUT*/ hbool_t *are_same) {
- hsize_t i, j; /* index variables */
+compare_2D_arrays(int **dset1, int **dset2, const hsize_t *sizes, /*OUT*/ hbool_t *are_same)
+{
+ hsize_t i, j; /* index variables */
*are_same = TRUE;
@@ -168,7 +164,6 @@ compare_2D_arrays(int **dset1, int **dset2, const hsize_t *sizes, /*OUT*/ hbool_
} /* end compare_2D_arrays() */
-
/*-------------------------------------------------------------------------
* Function: ensure_filter_works
*
@@ -181,19 +176,19 @@ compare_2D_arrays(int **dset1, int **dset2, const hsize_t *sizes, /*OUT*/ hbool_
static herr_t
ensure_filter_works(hid_t fid, const char *name, hid_t dcpl_id)
{
- hid_t did = -1; /* Dataset ID */
- hid_t dxpl_id = -1; /* Dataset xfer property list ID */
- hid_t write_dxpl_id = -1; /* Dataset xfer property list ID for writing */
- hid_t sid = -1; /* Dataspace ID */
- void *tconv_buf = NULL; /* Temporary conversion buffer */
- int **orig = NULL; /* Data written to the dataset */
- int **read = NULL; /* Data read from the dataset */
- size_t r, c; /* Data rows and columns */
- size_t hs_r, hs_c, hs_offr, hs_offc; /* Hypserslab sizes and offsets */
- size_t i, j; /* Local index variables */
- int n = 0; /* Value written to point array */
- hbool_t are_same; /* Output from dataset compare function */
- int ***save_array = NULL; /* (Global) array where the final data go */
+ hid_t did = -1; /* Dataset ID */
+ hid_t dxpl_id = -1; /* Dataset xfer property list ID */
+ hid_t write_dxpl_id = -1; /* Dataset xfer property list ID for writing */
+ hid_t sid = -1; /* Dataspace ID */
+ void * tconv_buf = NULL; /* Temporary conversion buffer */
+ int ** orig = NULL; /* Data written to the dataset */
+ int ** read = NULL; /* Data read from the dataset */
+ size_t r, c; /* Data rows and columns */
+ size_t hs_r, hs_c, hs_offr, hs_offc; /* Hypserslab sizes and offsets */
+ size_t i, j; /* Local index variables */
+ int n = 0; /* Value written to point array */
+ hbool_t are_same; /* Output from dataset compare function */
+ int *** save_array = NULL; /* (Global) array where the final data go */
/* initialize */
r = (size_t)sizes_g[0];
@@ -348,8 +343,8 @@ ensure_filter_works(hid_t fid, const char *name, hid_t dcpl_id)
*/
TESTING(" filters (partial I/O)");
- hs_r = (size_t)hs_sizes_g[0];
- hs_c = (size_t)hs_sizes_g[1];
+ hs_r = (size_t)hs_sizes_g[0];
+ hs_c = (size_t)hs_sizes_g[1];
hs_offr = (size_t)hs_offsets_g[0];
hs_offc = (size_t)hs_offsets_g[1];
for (i = 0; i < hs_r; i++)
@@ -411,12 +406,14 @@ ensure_filter_works(hid_t fid, const char *name, hid_t dcpl_id)
error:
/* Clean up objects used for this test */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
H5Pclose(dxpl_id);
H5Pclose(write_dxpl_id);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* NULLs are okay here */
free_2D_array(&orig);
@@ -428,7 +425,6 @@ error:
return FAIL;
} /* end ensure_filter_works() */
-
/*-------------------------------------------------------------------------
* Function: test_dataset_write_with_filters
*
@@ -441,10 +437,10 @@ error:
static herr_t
test_dataset_write_with_filters(hid_t fid)
{
- hid_t dcpl_id = -1; /* Dataset creation property list ID */
- unsigned int compress_level; /* Deflate compression level */
- unsigned int filter1_data; /* Data used by filter 1 */
- unsigned int libver_values[4]; /* Used w/ the filter that makes HDF5 calls */
+ hid_t dcpl_id = -1; /* Dataset creation property list ID */
+ unsigned int compress_level; /* Deflate compression level */
+ unsigned int filter1_data; /* Data used by filter 1 */
+ unsigned int libver_values[4]; /* Used w/ the filter that makes HDF5 calls */
/*----------------------------------------------------------
* STEP 1: Test deflation by itself.
@@ -467,7 +463,7 @@ test_dataset_write_with_filters(hid_t fid)
/* Clean up objects used for this test */
if (H5Pclose(dcpl_id) < 0)
TEST_ERROR;
-#else /* H5_HAVE_FILTER_DEFLATE */
+#else /* H5_HAVE_FILTER_DEFLATE */
SKIPPED();
HDputs(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -570,14 +566,12 @@ test_dataset_write_with_filters(hid_t fid)
error:
/* Clean up objects used for this test */
- H5E_BEGIN_TRY {
- H5Pclose(dcpl_id);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { H5Pclose(dcpl_id); }
+ H5E_END_TRY
return FAIL;
} /* end test_dataset_write_with_filters() */
-
/*-------------------------------------------------------------------------
* Function: test_read_data
*
@@ -590,9 +584,9 @@ error:
static herr_t
test_read_data(hid_t did, int *origin_data)
{
- int **check = NULL;
- int *data_p = origin_data;
- size_t i, j; /* Local index variables */
+ int ** check = NULL;
+ int * data_p = origin_data;
+ size_t i, j; /* Local index variables */
if (allocate_and_init_2D_array(&check, sizes_g, NULL) < 0)
TEST_ERROR;
@@ -602,9 +596,9 @@ test_read_data(hid_t did, int *origin_data)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i = 0; i < sizes_g[0]; i++)
- for(j = 0; j < sizes_g[1]; j++) {
- if(*data_p != check[i][j])
+ for (i = 0; i < sizes_g[0]; i++)
+ for (j = 0; j < sizes_g[1]; j++) {
+ if (*data_p != check[i][j])
TEST_ERROR
data_p++;
}
@@ -621,8 +615,6 @@ error:
return FAIL;
} /* end test_read_data() */
-
-
/*-------------------------------------------------------------------------
* Function: test_dataset_read_with_filters
*
@@ -636,7 +628,7 @@ error:
static herr_t
test_dataset_read_with_filters(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
+ hid_t did = -1; /* Dataset ID */
/*----------------------------------------------------------
* STEP 1: Test deflation by itself.
@@ -657,7 +649,7 @@ test_dataset_read_with_filters(hid_t fid)
if (H5Dclose(did) < 0)
TEST_ERROR;
-#else /* H5_HAVE_FILTER_DEFLATE */
+#else /* H5_HAVE_FILTER_DEFLATE */
SKIPPED();
HDputs(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -711,14 +703,12 @@ test_dataset_read_with_filters(hid_t fid)
error:
/* Clean up objects used for this test */
- H5E_BEGIN_TRY {
- H5Dclose(did);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { H5Dclose(did); }
+ H5E_END_TRY
return FAIL;
} /* end test_dataset_read_with_filters() */
-
/*-------------------------------------------------------------------------
* Function: ensure_data_read_fails
*
@@ -731,17 +721,16 @@ error:
static herr_t
ensure_data_read_fails(hid_t did)
{
- int **check = NULL;
- herr_t ret = FAIL;
+ int ** check = NULL;
+ herr_t ret = FAIL;
if (allocate_and_init_2D_array(&check, sizes_g, NULL) < 0)
TEST_ERROR;
/* Read the dataset back (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, *check);
- } H5E_END_TRY
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, *check); }
+ H5E_END_TRY
+ if (ret >= 0)
TEST_ERROR;
free_2D_array(&check);
@@ -755,7 +744,6 @@ error:
return FAIL;
} /* end ensure_data_read_fails() */
-
/*-------------------------------------------------------------------------
* Function: test_no_read_when_plugins_disabled
*
@@ -769,8 +757,8 @@ error:
static herr_t
test_no_read_when_plugins_disabled(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- unsigned plugin_flags; /* Plugin access flags */
+ hid_t did = -1; /* Dataset ID */
+ unsigned plugin_flags; /* Plugin access flags */
TESTING("filter plugin 1 with filter plugins disabled");
@@ -804,16 +792,17 @@ test_no_read_when_plugins_disabled(hid_t fid)
error:
/* Clean up objects used for this test */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
plugin_flags |= (unsigned)H5PL_FILTER_PLUGIN;
H5PLset_loading_state(plugin_flags);
H5Dclose(did);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return FAIL;
} /* end test_no_read_when_plugins_disabled() */
-
/*-------------------------------------------------------------------------
* Function: test_creating_groups_using_plugins
*
@@ -826,11 +815,11 @@ error:
static herr_t
test_creating_groups_using_plugins(hid_t fid)
{
- hid_t gcpl_id = -1;
- hid_t gid = -1;
- hid_t sub_gid = -1;
- int i;
- char subgroup_name[256];
+ hid_t gcpl_id = -1;
+ hid_t gid = -1;
+ hid_t sub_gid = -1;
+ int i;
+ char subgroup_name[256];
TESTING("creating groups with filter plugin 4");
@@ -870,16 +859,17 @@ test_creating_groups_using_plugins(hid_t fid)
error:
/* Clean up objects used for this test */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(sub_gid);
H5Gclose(gid);
H5Pclose(gcpl_id);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return FAIL;
} /* end test_creating_groups_using_plugins() */
-
/*-------------------------------------------------------------------------
* Function: test_opening_groups_using_plugins
*
@@ -892,10 +882,10 @@ error:
static herr_t
test_opening_groups_using_plugins(hid_t fid)
{
- hid_t gid = -1;
- hid_t sub_gid = -1;
- int i;
- char subgroup_name[256];
+ hid_t gid = -1;
+ hid_t sub_gid = -1;
+ int i;
+ char subgroup_name[256];
TESTING("opening groups with filter plugin 4");
@@ -926,16 +916,16 @@ test_opening_groups_using_plugins(hid_t fid)
error:
/* Clean up objects used for this test */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Gclose(sub_gid);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return FAIL;
} /* end test_opening_groups_using_plugins() */
-
-
/*-------------------------------------------------------------------------
* Function: test_path_api_calls
*
@@ -992,8 +982,8 @@ test_path_api_calls(void)
/* Remove all existing paths */
for (u = n_paths; u > 0; u--)
- if (H5PLremove(u-1) < 0) {
- HDfprintf(stderr," at %u: %s\n", u, path);
+ if (H5PLremove(u - 1) < 0) {
+ HDfprintf(stderr, " at %u: %s\n", u, path);
TEST_ERROR;
}
@@ -1005,19 +995,16 @@ test_path_api_calls(void)
PASSED();
-
TESTING(" remove (index 0 in empty table)");
/* Try to remove index zero in an empty list (SHOULD FAIL) */
- H5E_BEGIN_TRY {
- ret = H5PLremove(0);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5PLremove(0); }
+ H5E_END_TRY
if (ret >= 0)
TEST_ERROR;
PASSED();
-
/****************/
/* H5PLappend() */
/****************/
@@ -1028,14 +1015,13 @@ test_path_api_calls(void)
for (u = 0; u < n_starting_paths; u++) {
HDsprintf(path, "a_path_%u", u);
if (H5PLappend(path) < 0) {
- HDfprintf(stderr," at %u: %s\n", u, path);
+ HDfprintf(stderr, " at %u: %s\n", u, path);
TEST_ERROR;
}
}
PASSED();
-
/**********************/
/* H5PLremove() again */
/**********************/
@@ -1043,16 +1029,14 @@ test_path_api_calls(void)
TESTING(" remove (index too high)");
/* Try to remove a path where the index is beyond the table capacity (SHOULD FAIL) */
- H5E_BEGIN_TRY {
- ret = H5PLremove(n_starting_paths);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5PLremove(n_starting_paths); }
+ H5E_END_TRY
if (ret >= 0)
TEST_ERROR
PASSED();
-
/*************/
/* H5PLget() */
/*************/
@@ -1061,7 +1045,7 @@ test_path_api_calls(void)
/* Get the path length by passing in NULL */
if ((path_len = H5PLget(0, NULL, 0)) <= 0) {
- HDfprintf(stderr," get path 0 length failed\n");
+ HDfprintf(stderr, " get path 0 length failed\n");
TEST_ERROR;
}
if (path_len != 8)
@@ -1069,24 +1053,23 @@ test_path_api_calls(void)
/* Get the path */
if ((path_len = H5PLget(0, path, 256)) <= 0) {
- HDfprintf(stderr," get 0 len: %zd : %s\n", path_len, path);
+ HDfprintf(stderr, " get 0 len: %zd : %s\n", path_len, path);
TEST_ERROR;
}
if (HDstrcmp(path, "a_path_0") != 0) {
- HDfprintf(stderr," get 0: %s\n", path);
+ HDfprintf(stderr, " get 0: %s\n", path);
TEST_ERROR;
}
PASSED();
-
TESTING(" get (high and low indices)");
/* Get path at index 1 */
if ((path_len = H5PLget(1, path, 256)) <= 0)
TEST_ERROR;
if (HDstrcmp(path, "a_path_1") != 0) {
- HDfprintf(stderr," get 1: %s\n", path);
+ HDfprintf(stderr, " get 1: %s\n", path);
TEST_ERROR;
}
@@ -1095,25 +1078,22 @@ test_path_api_calls(void)
TEST_ERROR;
HDsprintf(temp_name, "a_path_%u", n_starting_paths - 1);
if (HDstrcmp(path, temp_name) != 0) {
- HDfprintf(stderr," get %u: %s\n", n_starting_paths - 1, path);
+ HDfprintf(stderr, " get %u: %s\n", n_starting_paths - 1, path);
TEST_ERROR;
}
PASSED();
-
TESTING(" get (index too high)");
/* Get path at the last + 1 index (SHOULD FAIL) */
- H5E_BEGIN_TRY {
- path_len = H5PLget(n_starting_paths, NULL, 0);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { path_len = H5PLget(n_starting_paths, NULL, 0); }
+ H5E_END_TRY
if (path_len > 0)
TEST_ERROR;
PASSED();
-
/*****************/
/* H5PLprepend() */
/*****************/
@@ -1132,7 +1112,7 @@ test_path_api_calls(void)
if ((path_len = H5PLget(8, path, 256)) <= 0)
TEST_ERROR;
if (HDstrcmp(path, "a_path_9") != 0) {
- HDfprintf(stderr," get 8: %s\n", path);
+ HDfprintf(stderr, " get 8: %s\n", path);
TEST_ERROR;
}
@@ -1144,13 +1124,12 @@ test_path_api_calls(void)
PASSED();
-
TESTING(" prepend");
/* Prepend one path */
HDsprintf(path, "a_path_%d", n_starting_paths + 1);
if (H5PLprepend(path) < 0) {
- HDfprintf(stderr," prepend %u: %s\n", n_starting_paths + 1, path);
+ HDfprintf(stderr, " prepend %u: %s\n", n_starting_paths + 1, path);
TEST_ERROR;
}
@@ -1164,7 +1143,7 @@ test_path_api_calls(void)
if (H5PLget(8, path, 256) <= 0)
TEST_ERROR;
if (HDstrcmp(path, "a_path_7") != 0) {
- HDfprintf(stderr," get 8: %s\n", path);
+ HDfprintf(stderr, " get 8: %s\n", path);
TEST_ERROR;
}
@@ -1173,13 +1152,12 @@ test_path_api_calls(void)
TEST_ERROR;
HDsprintf(temp_name, "a_path_%d", n_starting_paths + 1);
if (HDstrcmp(path, temp_name) != 0) {
- HDfprintf(stderr," get 0: %s\n", path);
+ HDfprintf(stderr, " get 0: %s\n", path);
TEST_ERROR;
}
PASSED();
-
/*****************/
/* H5PLreplace() */
/*****************/
@@ -1189,7 +1167,7 @@ test_path_api_calls(void)
/* Replace one path at index 1 */
HDsprintf(path, "a_path_%u", n_starting_paths + 4);
if (H5PLreplace(path, 1) < 0) {
- HDfprintf(stderr," replace 1: %s\n", path);
+ HDfprintf(stderr, " replace 1: %s\n", path);
TEST_ERROR;
}
@@ -1208,7 +1186,7 @@ test_path_api_calls(void)
TEST_ERROR;
HDsprintf(temp_name, "a_path_%u", n_starting_paths + 1);
if (HDstrcmp(path, temp_name) != 0) {
- HDfprintf(stderr," get 0: %s\n", path);
+ HDfprintf(stderr, " get 0: %s\n", path);
TEST_ERROR;
}
@@ -1216,13 +1194,12 @@ test_path_api_calls(void)
if (H5PLget(2, path, 256) <= 0)
TEST_ERROR;
if (HDstrcmp(path, "a_path_1") != 0) {
- HDfprintf(stderr," get 2: %s\n", path);
+ HDfprintf(stderr, " get 2: %s\n", path);
TEST_ERROR;
}
PASSED();
-
/****************/
/* H5PLinsert() */
/****************/
@@ -1241,7 +1218,7 @@ test_path_api_calls(void)
if (H5PLget(4, path, 256) <= 0)
TEST_ERROR;
if (HDstrcmp(path, "a_path_4") != 0) {
- HDfprintf(stderr," get 4: %s\n", path);
+ HDfprintf(stderr, " get 4: %s\n", path);
TEST_ERROR;
}
@@ -1252,13 +1229,12 @@ test_path_api_calls(void)
TEST_ERROR;
PASSED();
-
TESTING(" insert");
/* Insert one path at index 3*/
HDsprintf(path, "a_path_%d", n_starting_paths + 5);
if (H5PLinsert(path, 3) < 0) {
- HDfprintf(stderr," insert 3: %s\n", path);
+ HDfprintf(stderr, " insert 3: %s\n", path);
TEST_ERROR;
}
@@ -1266,7 +1242,7 @@ test_path_api_calls(void)
if (H5PLget(4, path, 256) <= 0)
TEST_ERROR;
if (HDstrcmp(path, "a_path_2") != 0) {
- HDfprintf(stderr," get 4: %s\n", path);
+ HDfprintf(stderr, " get 4: %s\n", path);
TEST_ERROR;
}
@@ -1278,7 +1254,6 @@ test_path_api_calls(void)
PASSED();
-
/****************/
/* H5PLremove() */
/****************/
@@ -1292,8 +1267,8 @@ test_path_api_calls(void)
/* Remove all existing paths */
for (u = n_paths; u > 0; u--)
- if (H5PLremove(u-1) < 0) {
- HDfprintf(stderr," at %u: %s\n", u, path);
+ if (H5PLremove(u - 1) < 0) {
+ HDfprintf(stderr, " at %u: %s\n", u, path);
TEST_ERROR;
}
@@ -1305,14 +1280,12 @@ test_path_api_calls(void)
PASSED();
-
return SUCCEED;
error:
return FAIL;
} /* end test_path_api_calls() */
-
/*-------------------------------------------------------------------------
* Function: disable_chunk_cache
*
@@ -1323,11 +1296,12 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-disable_chunk_cache(hid_t fapl_id) {
- int mdc_nelmts;
- size_t rdcc_nelmts;
- size_t rdcc_nbytes;
- double rdcc_w0;
+disable_chunk_cache(hid_t fapl_id)
+{
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ size_t rdcc_nbytes;
+ double rdcc_w0;
if (H5Pget_cache(fapl_id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
TEST_ERROR;
@@ -1340,7 +1314,6 @@ error:
return FAIL;
} /* end disable_chunk_cache() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1353,12 +1326,12 @@ error:
int
main(void)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1;
- hid_t old_ff_fapl_id = -1;
- hid_t new_ff_fapl_id = -1;
- unsigned new_format;
- int nerrors = 0;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1;
+ hid_t old_ff_fapl_id = -1;
+ hid_t new_ff_fapl_id = -1;
+ unsigned new_format;
+ int nerrors = 0;
/*******************************************************************/
/* ENSURE THAT WRITING TO DATASETS AND CREATING GROUPS WORKS */
@@ -1453,7 +1426,7 @@ main(void)
nerrors += (test_dataset_read_with_filters(fid) < 0 ? 1 : 0);
/* Test creating groups using dynamically-loaded plugin filters */
- nerrors += (test_opening_groups_using_plugins(fid) < 0 ? 1 : 0);
+ nerrors += (test_opening_groups_using_plugins(fid) < 0 ? 1 : 0);
/* Close FAPLs */
if (H5Pclose(old_ff_fapl_id) < 0)
@@ -1493,9 +1466,9 @@ main(void)
TEST_ERROR;
/* When filters are disabled, make sure we can't read data from a
- * dataset that requires a filter plugin.
- */
- nerrors += (test_no_read_when_plugins_disabled(fid) < 0 ? 1 : 0);
+ * dataset that requires a filter plugin.
+ */
+ nerrors += (test_no_read_when_plugins_disabled(fid) < 0 ? 1 : 0);
if (H5Fclose(fid) < 0)
TEST_ERROR;
@@ -1530,7 +1503,7 @@ main(void)
/************************************/
/* Test the APIs for access to the filter plugin path table */
- nerrors += (test_path_api_calls() < 0 ? 1 : 0);
+ nerrors += (test_path_api_calls() < 0 ? 1 : 0);
if (nerrors)
TEST_ERROR;
@@ -1540,11 +1513,13 @@ main(void)
HDexit(EXIT_SUCCESS);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(old_ff_fapl_id);
H5Pclose(new_ff_fapl_id);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* Free up saved arrays (NULLs okay) */
free_2D_array(&orig_deflate_g);
@@ -1556,4 +1531,3 @@ error:
HDprintf("***** %d PLUGIN TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/filter_plugin1_dsets.c b/test/filter_plugin1_dsets.c
index a9a53ae..9810678 100644
--- a/test/filter_plugin1_dsets.c
+++ b/test/filter_plugin1_dsets.c
@@ -14,33 +14,39 @@
* Purpose: Test dataset filter plugin for the filter_pluging.c test.
*/
-
#include <stdlib.h>
#include <stdio.h>
#include "H5PLextern.h"
-#define FILTER1_ID 257
+#define FILTER1_ID 257
-static size_t add_sub_value(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t add_sub_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* Filter class struct */
const H5Z_class2_t FILTER_INFO[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- FILTER1_ID, /* Filter ID number */
- 1, /* Encoding enabled */
- 1, /* Decoding enabled */
- "test filter plugin 1", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)add_sub_value, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER1_ID, /* Filter ID number */
+ 1, /* Encoding enabled */
+ 1, /* Decoding enabled */
+ "test filter plugin 1", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)add_sub_value, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return FILTER_INFO;
+}
-
/*-------------------------------------------------------------------------
* Function: add_sub_value
*
@@ -55,12 +61,12 @@ const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
*-------------------------------------------------------------------------
*/
static size_t
-add_sub_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
- size_t nbytes, size_t *buf_size, void **buf)
+add_sub_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- int value = 0; /* Data value to add/subtract */
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int value = 0; /* Data value to add/subtract */
/* Check for the correct number of parameters */
if (0 == cd_nelmts)
@@ -90,4 +96,3 @@ add_sub_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_value
return nbytes;
} /* end add_sub_value() */
-
diff --git a/test/filter_plugin2_dsets.c b/test/filter_plugin2_dsets.c
index 6a79148..425bf81 100644
--- a/test/filter_plugin2_dsets.c
+++ b/test/filter_plugin2_dsets.c
@@ -19,28 +19,35 @@
#include "H5PLextern.h"
-#define FILTER2_ID 258
-#define MULTIPLIER 3
+#define FILTER2_ID 258
+#define MULTIPLIER 3
-static size_t mult_div_value(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t mult_div_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* Filter class struct */
const H5Z_class2_t FILTER_INFO[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- FILTER2_ID, /* Filter ID number */
- 1, /* Encoding enabled */
- 1, /* Decoding enabled */
- "test filter plugin 2", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)mult_div_value, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER2_ID, /* Filter ID number */
+ 1, /* Encoding enabled */
+ 1, /* Decoding enabled */
+ "test filter plugin 2", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)mult_div_value, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return FILTER_INFO;
+}
-
/*-------------------------------------------------------------------------
* Function: mult_div_value
*
@@ -55,11 +62,11 @@ const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
*-------------------------------------------------------------------------
*/
static size_t
-mult_div_value(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf)
+mult_div_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
if (cd_nelmts > 0)
@@ -85,4 +92,3 @@ mult_div_value(unsigned int flags, size_t cd_nelmts,
return nbytes;
} /* end mult_div_value() */
-
diff --git a/test/filter_plugin3_dsets.c b/test/filter_plugin3_dsets.c
index b43020f..55f13ef 100644
--- a/test/filter_plugin3_dsets.c
+++ b/test/filter_plugin3_dsets.c
@@ -20,29 +20,37 @@
#include "H5PLextern.h"
-#define FILTER3_ID 259
+#define FILTER3_ID 259
-#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
+#define PUSH_ERR(func, minor, str) \
+ H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
-static size_t add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* Filter class struct */
const H5Z_class2_t FILTER_INFO[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- FILTER3_ID, /* Filter ID number */
- 1, /* Encoding enabled */
- 1, /* Decoding enabled */
- "test filter plugin 3", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)add_sub_value_hdf5, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER3_ID, /* Filter ID number */
+ 1, /* Encoding enabled */
+ 1, /* Decoding enabled */
+ "test filter plugin 3", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)add_sub_value_hdf5, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return FILTER_INFO;
+}
-
/*-------------------------------------------------------------------------
* Function: add_sub_value_hdf5
*
@@ -61,15 +69,15 @@ const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
*-------------------------------------------------------------------------
*/
static size_t
-add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
- size_t nbytes, size_t *buf_size, void **buf)
+add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- int value = 0; /* Data value to add/subtract */
- unsigned majnum = 0; /* Output data from the HDF5 library call */
- unsigned minnum = 0;
- unsigned relnum = 0;
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int value = 0; /* Data value to add/subtract */
+ unsigned majnum = 0; /* Output data from the HDF5 library call */
+ unsigned minnum = 0;
+ unsigned relnum = 0;
/* Check for the library version.
* We don't do anything with this information - it's just to ensure that
@@ -116,4 +124,3 @@ add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_
return nbytes;
} /* end add_sub_value_hdf5() */
-
diff --git a/test/filter_plugin4_groups.c b/test/filter_plugin4_groups.c
index 88ea20d..a342d54 100644
--- a/test/filter_plugin4_groups.c
+++ b/test/filter_plugin4_groups.c
@@ -20,29 +20,36 @@
#include "H5PLextern.h"
-#define FILTER4_ID 260
-#define SUFFIX_LEN 8
-#define GROUP_SUFFIX ".h5group"
+#define FILTER4_ID 260
+#define SUFFIX_LEN 8
+#define GROUP_SUFFIX ".h5group"
-static size_t append_to_group_name(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t append_to_group_name(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* Filter class struct */
const H5Z_class2_t FILTER_INFO[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- FILTER4_ID, /* Filter ID number */
- 1, /* Encoding enabled */
- 1, /* Decoding enabled */
- "test filter plugin 4", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)append_to_group_name, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER4_ID, /* Filter ID number */
+ 1, /* Encoding enabled */
+ 1, /* Decoding enabled */
+ "test filter plugin 4", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)append_to_group_name, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return FILTER_INFO;
+}
-
/*-------------------------------------------------------------------------
* Function: append_to_group_name
*
@@ -57,10 +64,10 @@ const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
*-------------------------------------------------------------------------
*/
static size_t
-append_to_group_name(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf)
+append_to_group_name(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- size_t new_name_size = 0; /* Return value */
+ size_t new_name_size = 0; /* Return value */
/* Check for the correct number of parameters */
if (cd_nelmts > 0)
@@ -75,8 +82,8 @@ append_to_group_name(unsigned int flags, size_t cd_nelmts,
}
else {
/* WRITE - Append the suffix to the group name */
- void *outbuf = NULL; /* Pointer to new buffer */
- unsigned char *dst = NULL; /* Temporary pointer to destination buffer */
+ void * outbuf = NULL; /* Pointer to new buffer */
+ unsigned char *dst = NULL; /* Temporary pointer to destination buffer */
/* Get memory for the new, larger string buffer using the
* library's memory allocator.
@@ -95,12 +102,11 @@ append_to_group_name(unsigned int flags, size_t cd_nelmts,
H5free_memory(*buf);
/* Set return values */
- *buf_size = nbytes + SUFFIX_LEN;
- *buf = outbuf;
- outbuf = NULL;
+ *buf_size = nbytes + SUFFIX_LEN;
+ *buf = outbuf;
+ outbuf = NULL;
new_name_size = *buf_size;
}
return new_name_size;
} /* append_to_group_name() */
-
diff --git a/test/flush1.c b/test/flush1.c
index e01f4a5..dd5c7b9 100644
--- a/test/flush1.c
+++ b/test/flush1.c
@@ -24,36 +24,27 @@
#include "h5test.h"
/* This file needs to access the file driver testing code */
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
-#include "H5FDpkg.h" /* File drivers */
-
-const char *FILENAME[] = {
- "flush",
- "flush-swmr",
- "noflush",
- "noflush-swmr",
- "flush_extend",
- "flush_extend-swmr",
- "noflush_extend",
- "noflush_extend-swmr",
- NULL
-};
+#include "H5FDpkg.h" /* File drivers */
+
+const char *FILENAME[] = {"flush", "flush-swmr", "noflush",
+ "noflush-swmr", "flush_extend", "flush_extend-swmr",
+ "noflush_extend", "noflush_extend-swmr", NULL};
/* Number and size of dataset dims, chunk size, etc. */
-#define NDIMS 1
-#define NELEMENTS 10000
-#define CHUNK_SIZE 25
-#define FIRST_DSET_NAME "dset1"
-#define SECOND_DSET_NAME "dset2"
+#define NDIMS 1
+#define NELEMENTS 10000
+#define CHUNK_SIZE 25
+#define FIRST_DSET_NAME "dset1"
+#define SECOND_DSET_NAME "dset2"
/* Number of sub-groups created in the containing group */
-#define NGROUPS 100
+#define NGROUPS 100
-static hid_t create_file(const char *filename, hid_t fapl_id, hbool_t swmr);
+static hid_t create_file(const char *filename, hid_t fapl_id, hbool_t swmr);
static herr_t add_dset_to_file(hid_t fid, const char *dset_name);
-
/*-------------------------------------------------------------------------
* Function: create_file
*
@@ -70,49 +61,50 @@ static herr_t add_dset_to_file(hid_t fid, const char *dset_name);
static hid_t
create_file(const char *filename, hid_t fapl_id, hbool_t swmr)
{
- hid_t fid = -1; /* file ID */
- hid_t top_gid = -1; /* containing group ID */
- hid_t gid = -1; /* subgroup ID */
- char group_name[32]; /* group name */
- unsigned flags; /* file open flags */
- int i; /* iterator */
+ hid_t fid = -1; /* file ID */
+ hid_t top_gid = -1; /* containing group ID */
+ hid_t gid = -1; /* subgroup ID */
+ char group_name[32]; /* group name */
+ unsigned flags; /* file open flags */
+ int i; /* iterator */
flags = H5F_ACC_TRUNC | (swmr ? H5F_ACC_SWMR_WRITE : 0);
- if((fid = H5Fcreate(filename, flags, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid = H5Fcreate(filename, flags, H5P_DEFAULT, fapl_id)) < 0)
STACK_ERROR
/* Create a chunked dataset */
- if(add_dset_to_file(fid, FIRST_DSET_NAME) < 0)
+ if (add_dset_to_file(fid, FIRST_DSET_NAME) < 0)
TEST_ERROR
/* Create some groups */
- if((top_gid = H5Gcreate2(fid, "top_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((top_gid = H5Gcreate2(fid, "top_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
STACK_ERROR
- for(i = 0; i < NGROUPS; i++) {
+ for (i = 0; i < NGROUPS; i++) {
HDsprintf(group_name, "group%02d", i);
- if((gid = H5Gcreate2(top_gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(top_gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
STACK_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
STACK_ERROR
} /* end for */
- if(H5Gclose(top_gid) < 0)
+ if (H5Gclose(top_gid) < 0)
STACK_ERROR
return fid;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Gclose(gid);
H5Gclose(top_gid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end create_file() */
-
/*-------------------------------------------------------------------------
* Function: add_dset_to_file
*
@@ -128,37 +120,37 @@ error:
static herr_t
add_dset_to_file(hid_t fid, const char *dset_name)
{
- hid_t dcpl_id = -1; /* dataset creation plist ID */
- hid_t sid = -1; /* dataspace ID */
- hid_t did = -1; /* dataset ID */
- int *data = NULL; /* data buffer */
- hsize_t dims[1] = {NELEMENTS}; /* size of dataset */
- hsize_t chunk_dims[1] = {CHUNK_SIZE}; /* chunk size */
- int i; /* iterator */
+ hid_t dcpl_id = -1; /* dataset creation plist ID */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t did = -1; /* dataset ID */
+ int * data = NULL; /* data buffer */
+ hsize_t dims[1] = {NELEMENTS}; /* size of dataset */
+ hsize_t chunk_dims[1] = {CHUNK_SIZE}; /* chunk size */
+ int i; /* iterator */
/* Create a chunked dataset */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
STACK_ERROR
- if(H5Pset_chunk(dcpl_id, NDIMS, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl_id, NDIMS, chunk_dims) < 0)
STACK_ERROR
- if((sid = H5Screate_simple(NDIMS, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(NDIMS, dims, NULL)) < 0)
STACK_ERROR
- if((did = H5Dcreate2(fid, dset_name, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, dset_name, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
STACK_ERROR
/* Write some data */
- if(NULL == (data = (int *)HDcalloc((size_t)NELEMENTS, sizeof(int))))
+ if (NULL == (data = (int *)HDcalloc((size_t)NELEMENTS, sizeof(int))))
STACK_ERROR
- for(i = 0; i < NELEMENTS; i++)
+ for (i = 0; i < NELEMENTS; i++)
data[i] = i;
- if(H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0)
STACK_ERROR
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
STACK_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
STACK_ERROR
HDfree(data);
@@ -166,18 +158,19 @@ add_dset_to_file(hid_t fid, const char *dset_name)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl_id);
H5Sclose(sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(data);
return FAIL;
} /* end add_dset_to_file() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -196,19 +189,19 @@ error:
int
main(void)
{
- char *driver = NULL; /* name of current VFD (from env var) */
- hbool_t vfd_supports_swmr; /* whether the current VFD supports SWMR */
- hid_t fid = -1; /* file ID */
- hid_t fapl_id = -1; /* file access proplist ID */
- char filename[1024]; /* filename */
- hbool_t use_swmr; /* whether or not to use SWMR I/O */
+ char * driver = NULL; /* name of current VFD (from env var) */
+ hbool_t vfd_supports_swmr; /* whether the current VFD supports SWMR */
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access proplist ID */
+ char filename[1024]; /* filename */
+ hbool_t use_swmr; /* whether or not to use SWMR I/O */
h5_reset();
- if((fapl_id = h5_fileaccess()) < 0)
+ if ((fapl_id = h5_fileaccess()) < 0)
TEST_ERROR
/* Check if the current VFD supports SWMR */
- driver = HDgetenv("HDF5_DRIVER");
+ driver = HDgetenv("HDF5_DRIVER");
vfd_supports_swmr = H5FD__supports_swmr_test(driver);
/*************************************************/
@@ -219,20 +212,20 @@ main(void)
TESTING("H5Fflush (part1 with flush)");
h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
use_swmr = FALSE;
- if((fid = create_file(filename, fapl_id, use_swmr)) < 0)
+ if ((fid = create_file(filename, fapl_id, use_swmr)) < 0)
TEST_ERROR
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
FAIL_STACK_ERROR
PASSED();
/* Create a file and flush w/ SWMR I/O */
TESTING("H5Fflush (part1 with flush + SWMR)");
- if(vfd_supports_swmr) {
+ if (vfd_supports_swmr) {
h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
use_swmr = TRUE;
- if((fid = create_file(filename, fapl_id, use_swmr)) < 0)
+ if ((fid = create_file(filename, fapl_id, use_swmr)) < 0)
TEST_ERROR
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
FAIL_STACK_ERROR
PASSED();
} /* end if */
@@ -243,16 +236,16 @@ main(void)
TESTING("H5Fflush (part1 without flush)");
h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename));
use_swmr = FALSE;
- if((fid = create_file(filename, fapl_id, use_swmr)) < 0)
+ if ((fid = create_file(filename, fapl_id, use_swmr)) < 0)
TEST_ERROR
PASSED();
/* Create a file which will not be flushed w/ SWMR I/O */
TESTING("H5Fflush (part1 without flush + SWMR)");
- if(vfd_supports_swmr) {
+ if (vfd_supports_swmr) {
h5_fixname(FILENAME[3], fapl_id, filename, sizeof(filename));
use_swmr = TRUE;
- if((fid = create_file(filename, fapl_id, use_swmr)) < 0)
+ if ((fid = create_file(filename, fapl_id, use_swmr)) < 0)
TEST_ERROR
PASSED();
} /* end if */
@@ -263,28 +256,28 @@ main(void)
TESTING("H5Fflush (part1 with flush and later addition and another flush)");
h5_fixname(FILENAME[4], fapl_id, filename, sizeof(filename));
use_swmr = FALSE;
- if((fid = create_file(filename, fapl_id, use_swmr)) < 0)
+ if ((fid = create_file(filename, fapl_id, use_swmr)) < 0)
TEST_ERROR
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
FAIL_STACK_ERROR
- if(add_dset_to_file(fid, SECOND_DSET_NAME) < 0)
+ if (add_dset_to_file(fid, SECOND_DSET_NAME) < 0)
TEST_ERROR
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
FAIL_STACK_ERROR
PASSED();
/* Create a file, flush, add a dataset, flush w/ SWMR I/O */
TESTING("H5Fflush (part1 with flush and later addition and another flush + SWMR)");
- if(vfd_supports_swmr) {
+ if (vfd_supports_swmr) {
h5_fixname(FILENAME[5], fapl_id, filename, sizeof(filename));
use_swmr = TRUE;
- if((fid = create_file(filename, fapl_id, use_swmr)) < 0)
+ if ((fid = create_file(filename, fapl_id, use_swmr)) < 0)
TEST_ERROR
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
FAIL_STACK_ERROR
- if(add_dset_to_file(fid, SECOND_DSET_NAME) < 0)
+ if (add_dset_to_file(fid, SECOND_DSET_NAME) < 0)
TEST_ERROR
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
FAIL_STACK_ERROR
PASSED();
} /* end if */
@@ -295,31 +288,31 @@ main(void)
TESTING("H5Fflush (part1 with flush and later addition)");
h5_fixname(FILENAME[6], fapl_id, filename, sizeof(filename));
use_swmr = FALSE;
- if((fid = create_file(filename, fapl_id, use_swmr)) < 0)
+ if ((fid = create_file(filename, fapl_id, use_swmr)) < 0)
TEST_ERROR
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
FAIL_STACK_ERROR
- if(add_dset_to_file(fid, SECOND_DSET_NAME) < 0)
+ if (add_dset_to_file(fid, SECOND_DSET_NAME) < 0)
TEST_ERROR
PASSED();
/* Create a file, flush, add a dataset, (no flush) w/ SWMR I/O */
TESTING("H5Fflush (part1 with flush and later addition + SWMR)");
- if(vfd_supports_swmr) {
+ if (vfd_supports_swmr) {
h5_fixname(FILENAME[7], fapl_id, filename, sizeof(filename));
use_swmr = TRUE;
- if((fid = create_file(filename, fapl_id, use_swmr)) < 0)
+ if ((fid = create_file(filename, fapl_id, use_swmr)) < 0)
TEST_ERROR
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
FAIL_STACK_ERROR
- if(add_dset_to_file(fid, SECOND_DSET_NAME) < 0)
+ if (add_dset_to_file(fid, SECOND_DSET_NAME) < 0)
TEST_ERROR
PASSED();
} /* end if */
else
SKIPPED();
- if(!vfd_supports_swmr)
+ if (!vfd_supports_swmr)
HDprintf("NOTE: Some tests were skipped since the current VFD lacks SWMR support\n");
/* Flush console output streams */
@@ -327,17 +320,15 @@ main(void)
HDfflush(stderr);
/* DO NOT CLOSE FILE ID! */
- if(H5Pclose(fapl_id) < 0)
+ if (H5Pclose(fapl_id) < 0)
STACK_ERROR
/* _exit() is necessary since we want a hard close of the library */
HD_exit(EXIT_SUCCESS);
error:
- H5E_BEGIN_TRY {
- H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(fapl_id); }
+ H5E_END_TRY;
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/flush2.c b/test/flush2.c
index c3103d9..cc38cf1 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -23,39 +23,29 @@
#include "h5test.h"
/* This file needs to access the file driver testing code */
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
-#include "H5FDpkg.h" /* File drivers */
+#include "H5FDpkg.h" /* File drivers */
/* Make this private property (defined in H5Fprivate.h) available */
/* This is used in the helper routine clear_status_flags() */
-#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags"
+#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags"
-
-const char *FILENAME[] = {
- "flush",
- "flush-swmr",
- "noflush",
- "noflush-swmr",
- "flush_extend",
- "flush_extend-swmr",
- "noflush_extend",
- "noflush_extend-swmr",
- NULL
-};
+const char *FILENAME[] = {"flush", "flush-swmr", "noflush",
+ "noflush-swmr", "flush_extend", "flush_extend-swmr",
+ "noflush_extend", "noflush_extend-swmr", NULL};
/* Number and size of dataset dims, chunk size, etc. */
-#define NELEMENTS 10000
-#define FIRST_DSET_NAME "dset1"
-#define SECOND_DSET_NAME "dset2"
+#define NELEMENTS 10000
+#define FIRST_DSET_NAME "dset1"
+#define SECOND_DSET_NAME "dset2"
/* Number of sub-groups created in the containing group */
-#define NGROUPS 100
+#define NGROUPS 100
static hbool_t dset_ok(hid_t fid, const char *dset_name);
static hbool_t file_ok(const char *filename, hid_t fapl_id, hbool_t check_second_dset);
-
/*-------------------------------------------------------------------------
* Function: dset_ok
*
@@ -71,34 +61,34 @@ static hbool_t file_ok(const char *filename, hid_t fapl_id, hbool_t check_second
static hbool_t
dset_ok(hid_t fid, const char *dset_name)
{
- hid_t sid = -1; /* dataspace ID */
- hid_t did = -1; /* dataset ID */
- int *data = NULL; /* data buffer */
- hsize_t dims[1] = {0}; /* size of dataset */
- int i; /* iterator */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t did = -1; /* dataset ID */
+ int * data = NULL; /* data buffer */
+ hsize_t dims[1] = {0}; /* size of dataset */
+ int i; /* iterator */
/* Open the dataset and check size */
- if((did = H5Dopen2(fid, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, dset_name, H5P_DEFAULT)) < 0)
goto error;
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto error;
- if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto error;
- if(dims[0] != NELEMENTS)
+ if (dims[0] != NELEMENTS)
goto error;
/* Read the data */
- if(NULL == (data = (int *)HDcalloc((size_t)NELEMENTS, sizeof(int))))
+ if (NULL == (data = (int *)HDcalloc((size_t)NELEMENTS, sizeof(int))))
goto error;
- if(H5Dread(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0)
goto error;
- for(i = 0; i < NELEMENTS; i++)
- if(i != data[i])
+ for (i = 0; i < NELEMENTS; i++)
+ if (i != data[i])
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
HDfree(data);
@@ -106,17 +96,18 @@ dset_ok(hid_t fid, const char *dset_name)
return TRUE;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(data);
return FALSE;
} /* end dset_ok() */
-
/*-------------------------------------------------------------------------
* Function: file_ok
*
@@ -132,47 +123,49 @@ error:
static hbool_t
file_ok(const char *filename, hid_t fapl_id, hbool_t check_second_dset)
{
- hid_t fid = -1; /* file ID */
- hid_t top_gid = -1; /* containing group ID */
- hid_t gid = -1; /* subgroup ID */
- char group_name[32]; /* group name */
- int i; /* iterator */
+ hid_t fid = -1; /* file ID */
+ hid_t top_gid = -1; /* containing group ID */
+ hid_t gid = -1; /* subgroup ID */
+ char group_name[32]; /* group name */
+ int i; /* iterator */
/* open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id)) < 0)
goto error;
/* check datasets */
- if(!dset_ok(fid, FIRST_DSET_NAME))
+ if (!dset_ok(fid, FIRST_DSET_NAME))
goto error;
- if(check_second_dset)
- if(!dset_ok(fid, SECOND_DSET_NAME))
+ if (check_second_dset)
+ if (!dset_ok(fid, SECOND_DSET_NAME))
goto error;
/* check groups */
- if((top_gid = H5Gopen2(fid, "top_group", H5P_DEFAULT)) < 0)
+ if ((top_gid = H5Gopen2(fid, "top_group", H5P_DEFAULT)) < 0)
goto error;
- for(i = 0; i < NGROUPS; i++) {
+ for (i = 0; i < NGROUPS; i++) {
HDsprintf(group_name, "group%02d", i);
- if((gid = H5Gopen2(top_gid, group_name, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(top_gid, group_name, H5P_DEFAULT)) < 0)
goto error;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto error;
} /* end for */
- if(H5Gclose(top_gid) < 0)
+ if (H5Gclose(top_gid) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
return TRUE;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(top_gid);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FALSE;
} /* end file_ok() */
@@ -193,42 +186,43 @@ error:
static herr_t
clear_status_flags(const char *filename, hid_t fapl_id)
{
- hid_t new_fapl_id = -1; /* copy of the file access plist ID */
- hid_t fid = -1; /* file ID */
- hbool_t clear = TRUE;
+ hid_t new_fapl_id = -1; /* copy of the file access plist ID */
+ hid_t fid = -1; /* file ID */
+ hbool_t clear = TRUE;
/* Get a copy of fapl */
- if((new_fapl_id = H5Pcopy(fapl_id)) < 0)
+ if ((new_fapl_id = H5Pcopy(fapl_id)) < 0)
goto error;
/* Set this private property */
- if(H5Pset(new_fapl_id, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
+ if (H5Pset(new_fapl_id, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0)
goto error;
/* Has to open rw */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, new_fapl_id)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, new_fapl_id)) < 0)
goto error;
/* CLose the property list */
- if(H5Pclose(new_fapl_id) < 0)
+ if (H5Pclose(new_fapl_id) < 0)
goto error;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(new_fapl_id);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end clear_status_flags() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -245,19 +239,19 @@ error:
int
main(void)
{
- char *driver = NULL; /* name of current VFD (from env var) */
- hbool_t vfd_supports_swmr; /* whether the current VFD supports SWMR */
- hid_t fapl_id = -1; /* file access proplist ID */
- char filename[1024]; /* filename */
- hbool_t check_second_dset; /* whether or not to check the second dset */
- H5E_auto2_t func; /* for shutting off error reporting */
+ char * driver = NULL; /* name of current VFD (from env var) */
+ hbool_t vfd_supports_swmr; /* whether the current VFD supports SWMR */
+ hid_t fapl_id = -1; /* file access proplist ID */
+ char filename[1024]; /* filename */
+ hbool_t check_second_dset; /* whether or not to check the second dset */
+ H5E_auto2_t func; /* for shutting off error reporting */
h5_reset();
- if((fapl_id = h5_fileaccess()) < 0)
+ if ((fapl_id = h5_fileaccess()) < 0)
PUTS_ERROR("bad vfd-dependent fapl")
/* Check if the current VFD supports SWMR */
- driver = HDgetenv("HDF5_DRIVER");
+ driver = HDgetenv("HDF5_DRIVER");
vfd_supports_swmr = H5FD__supports_swmr_test(driver);
/* TEST 1 */
@@ -265,7 +259,7 @@ main(void)
TESTING("H5Fflush (part2 with flush)");
h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
check_second_dset = FALSE;
- if(file_ok(filename, fapl_id, check_second_dset))
+ if (file_ok(filename, fapl_id, check_second_dset))
PASSED();
else
TEST_ERROR
@@ -273,12 +267,12 @@ main(void)
/* TEST 2 */
/* Check the case where the file was flushed (w/SWMR) */
TESTING("H5Fflush (part2 with flush + SWMR)");
- if(vfd_supports_swmr) {
+ if (vfd_supports_swmr) {
h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
check_second_dset = FALSE;
- if(clear_status_flags(filename, fapl_id) < 0)
+ if (clear_status_flags(filename, fapl_id) < 0)
TEST_ERROR
- if(file_ok(filename, fapl_id, check_second_dset))
+ if (file_ok(filename, fapl_id, check_second_dset))
PASSED();
else
TEST_ERROR
@@ -290,14 +284,14 @@ main(void)
/* Check the case where the file was not flushed */
TESTING("H5Fflush (part2 without flush)");
/* Turn the error stack off (failures expected) */
- if(H5Eget_auto2(H5E_DEFAULT, &func, NULL) < 0)
+ if (H5Eget_auto2(H5E_DEFAULT, &func, NULL) < 0)
FAIL_STACK_ERROR
- if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename));
check_second_dset = FALSE;
- if(file_ok(filename, fapl_id, check_second_dset)) {
-#if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS)
+ if (file_ok(filename, fapl_id, check_second_dset)) {
+#if defined H5_HAVE_WIN32_API && !defined(hdf5_EXPORTS)
SKIPPED();
HDputs(" the DLL will flush the file even when calling _exit, skip this test temporarily");
#else
@@ -307,24 +301,24 @@ main(void)
else
PASSED();
/* Turn the error stack back on */
- if(H5Eset_auto2(H5E_DEFAULT, func, NULL) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, func, NULL) < 0)
FAIL_STACK_ERROR
/* TEST 4 */
/* Check the case where the file was not flushed (w/SWMR) */
TESTING("H5Fflush (part2 without flush + SWMR)");
- if(vfd_supports_swmr) {
+ if (vfd_supports_swmr) {
/* Turn the error stack off (failures expected) */
- if(H5Eget_auto2(H5E_DEFAULT, &func, NULL) < 0)
+ if (H5Eget_auto2(H5E_DEFAULT, &func, NULL) < 0)
FAIL_STACK_ERROR
- if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[3], fapl_id, filename, sizeof(filename));
check_second_dset = FALSE;
- if(clear_status_flags(filename, fapl_id) < 0)
+ if (clear_status_flags(filename, fapl_id) < 0)
TEST_ERROR
- if(file_ok(filename, fapl_id, check_second_dset)) {
-#if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS)
+ if (file_ok(filename, fapl_id, check_second_dset)) {
+#if defined H5_HAVE_WIN32_API && !defined(hdf5_EXPORTS)
SKIPPED();
HDputs(" the DLL will flush the file even when calling _exit, skip this test temporarily");
#else
@@ -334,7 +328,7 @@ main(void)
else
PASSED();
/* Turn the error stack back on */
- if(H5Eset_auto2(H5E_DEFAULT, func, NULL) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, func, NULL) < 0)
FAIL_STACK_ERROR
} /* end if */
else
@@ -347,7 +341,7 @@ main(void)
TESTING("H5Fflush (part2 with flush and later addition and another flush)");
check_second_dset = TRUE;
h5_fixname(FILENAME[4], fapl_id, filename, sizeof(filename));
- if(file_ok(filename, fapl_id, check_second_dset))
+ if (file_ok(filename, fapl_id, check_second_dset))
PASSED();
else
TEST_ERROR
@@ -357,12 +351,12 @@ main(void)
* added afterward and then flushed (w/SWMR)
*/
TESTING("H5Fflush (part2 with flush and later addition and another flush + SWMR)");
- if(vfd_supports_swmr) {
+ if (vfd_supports_swmr) {
check_second_dset = TRUE;
h5_fixname(FILENAME[5], fapl_id, filename, sizeof(filename));
- if(clear_status_flags(filename, fapl_id) < 0)
+ if (clear_status_flags(filename, fapl_id) < 0)
TEST_ERROR
- if(file_ok(filename, fapl_id, check_second_dset))
+ if (file_ok(filename, fapl_id, check_second_dset))
PASSED();
else
TEST_ERROR
@@ -376,14 +370,14 @@ main(void)
*/
TESTING("H5Fflush (part2 with flush and later addition)");
/* Turn the error stack off (failures expected) */
- if(H5Eget_auto2(H5E_DEFAULT, &func, NULL) < 0)
+ if (H5Eget_auto2(H5E_DEFAULT, &func, NULL) < 0)
FAIL_STACK_ERROR
- if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[6], fapl_id, filename, sizeof(filename));
check_second_dset = TRUE;
- if(file_ok(filename, fapl_id, check_second_dset)) {
-#if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS)
+ if (file_ok(filename, fapl_id, check_second_dset)) {
+#if defined H5_HAVE_WIN32_API && !defined(hdf5_EXPORTS)
SKIPPED()
HDputs(" the DLL will flush the file even when calling _exit, skip this test temporarily");
#else
@@ -393,7 +387,7 @@ main(void)
else
PASSED();
/* Turn the error stack back on */
- if(H5Eset_auto2(H5E_DEFAULT, func, NULL) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, func, NULL) < 0)
FAIL_STACK_ERROR
/* TEST 8 */
@@ -401,18 +395,18 @@ main(void)
* afterward and not flushed (w/ SWMR).
*/
TESTING("H5Fflush (part2 with flush and later addition + SWMR)");
- if(vfd_supports_swmr) {
+ if (vfd_supports_swmr) {
/* Turn the error stack off (failures expected) */
- if(H5Eget_auto2(H5E_DEFAULT, &func, NULL) < 0)
+ if (H5Eget_auto2(H5E_DEFAULT, &func, NULL) < 0)
FAIL_STACK_ERROR
- if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[7], fapl_id, filename, sizeof(filename));
check_second_dset = TRUE;
- if(clear_status_flags(filename, fapl_id) < 0)
+ if (clear_status_flags(filename, fapl_id) < 0)
TEST_ERROR
- if(file_ok(filename, fapl_id, check_second_dset)) {
-#if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS)
+ if (file_ok(filename, fapl_id, check_second_dset)) {
+#if defined H5_HAVE_WIN32_API && !defined(hdf5_EXPORTS)
SKIPPED();
HDputs(" the DLL will flush the file even when calling _exit, skip this test temporarily");
#else
@@ -422,13 +416,13 @@ main(void)
else
PASSED();
/* Turn the error stack back on */
- if(H5Eset_auto2(H5E_DEFAULT, func, NULL) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, func, NULL) < 0)
FAIL_STACK_ERROR
} /* end if */
else
SKIPPED()
- if(!vfd_supports_swmr)
+ if (!vfd_supports_swmr)
HDprintf("NOTE: Some tests were skipped since the current VFD lacks SWMR support\n");
h5_cleanup(FILENAME, fapl_id);
@@ -438,4 +432,3 @@ main(void)
error:
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/flushrefresh.c b/test/flushrefresh.c
index 2db1d6b..798d45a 100644
--- a/test/flushrefresh.c
+++ b/test/flushrefresh.c
@@ -23,7 +23,7 @@
*
*/
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
/* ======== */
@@ -31,7 +31,7 @@
/* ======== */
#include "testhdf5.h"
-#include "H5FDpkg.h" /* File Drivers */
+#include "H5FDpkg.h" /* File Drivers */
/* ======= */
/* Defines */
@@ -41,10 +41,10 @@
#define FILENAME "flushrefresh.h5"
/* Names of Signal Files */
-#define SIGNAL_TO_SCRIPT "flushrefresh_VERIFICATION_START"
+#define SIGNAL_TO_SCRIPT "flushrefresh_VERIFICATION_START"
#define SIGNAL_BETWEEN_PROCESSES_1 "flushrefresh_VERIFICATION_CHECKPOINT1"
#define SIGNAL_BETWEEN_PROCESSES_2 "flushrefresh_VERIFICATION_CHECKPOINT2"
-#define SIGNAL_FROM_SCRIPT "flushrefresh_VERIFICATION_DONE"
+#define SIGNAL_FROM_SCRIPT "flushrefresh_VERIFICATION_DONE"
/* Paths to Various Objects in the Testfile */
#define RG "/"
@@ -59,7 +59,7 @@
#define T3 "/Group3/CommittedDatatype3"
/* Flushed States */
-#define FLUSHED "FLUSHED"
+#define FLUSHED "FLUSHED"
#define NOT_FLUSHED "NOT_FLUSHED"
/* Error Handling */
@@ -67,26 +67,26 @@
For errors occurring in the spawned process (from the test script), use
the PROCESS_ERROR macro, which will send a signal to the main process so the
main process can propogate errors correctly. */
-FILE * errorfile;
+FILE *errorfile;
#define ERRFILE "flushrefresh_ERROR"
-#define PROCESS_ERROR \
- { \
- errorfile = HDfopen(ERRFILE, "w+"); \
- HDfprintf(errorfile, "Error occurred in flushrefresh.\n"); \
- HDfflush(errorfile); \
- HDfclose(errorfile); \
- TEST_ERROR; \
+#define PROCESS_ERROR \
+ { \
+ errorfile = HDfopen(ERRFILE, "w+"); \
+ HDfprintf(errorfile, "Error occurred in flushrefresh.\n"); \
+ HDfflush(errorfile); \
+ HDfclose(errorfile); \
+ TEST_ERROR; \
}
-#define CLEANUP_FILES \
- { \
- HDremove(ERRFILE); \
- HDremove(FILENAME); \
- HDremove(SIGNAL_TO_SCRIPT); \
- HDremove(SIGNAL_BETWEEN_PROCESSES_1); \
- HDremove(SIGNAL_BETWEEN_PROCESSES_2); \
- HDremove(SIGNAL_FROM_SCRIPT); \
- } \
+#define CLEANUP_FILES \
+ { \
+ HDremove(ERRFILE); \
+ HDremove(FILENAME); \
+ HDremove(SIGNAL_TO_SCRIPT); \
+ HDremove(SIGNAL_BETWEEN_PROCESSES_1); \
+ HDremove(SIGNAL_BETWEEN_PROCESSES_2); \
+ HDremove(SIGNAL_FROM_SCRIPT); \
+ }
/* ===================== */
/* Function Declarations */
@@ -97,13 +97,13 @@ int main(int argc, const char *argv[]);
/* Flush Test Framework */
herr_t test_flush(void);
-herr_t flush_verification(const char * obj_pathname, const char * expected);
-herr_t run_flush_verification_process(const char * obj_pathname, const char * expected);
+herr_t flush_verification(const char *obj_pathname, const char *expected);
+herr_t run_flush_verification_process(const char *obj_pathname, const char *expected);
/* Refresh Test Framework */
herr_t test_refresh(void);
-herr_t refresh_verification(const char * obj_pathname);
-herr_t start_refresh_verification_process(const char * obj_pathname);
+herr_t refresh_verification(const char *obj_pathname);
+herr_t start_refresh_verification_process(const char *obj_pathname);
herr_t end_refresh_verification_process(void);
/* Other Helper Functions */
@@ -114,7 +114,6 @@ herr_t end_verification(void);
/* Functions */
/* ========= */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -137,17 +136,18 @@ herr_t end_verification(void);
*
*-------------------------------------------------------------------------
*/
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
/* Variables */
const char *envval = NULL;
/* Initialize library */
- if(H5open() < 0)
+ if (H5open() < 0)
TEST_ERROR;
/* Parse command line options */
- if(argc == 1) {
+ if (argc == 1) {
/* No arguments supplied. Run main test routines if
* using sec2 or stdio driver, otherwise don't run
* anything. */
@@ -155,25 +155,32 @@ int main(int argc, const char *argv[])
/* Determine driver being used */
envval = HDgetenv("HDF5_DRIVER");
- if(envval == NULL || H5FD__supports_swmr_test(envval)) {
- if(test_flush() != SUCCEED) TEST_ERROR;
- if(test_refresh() != SUCCEED) TEST_ERROR;
+ if (envval == NULL || H5FD__supports_swmr_test(envval)) {
+ if (test_flush() != SUCCEED)
+ TEST_ERROR;
+ if (test_refresh() != SUCCEED)
+ TEST_ERROR;
} /* end if */
else {
- HDfprintf(stdout, "Skipping all flush/refresh tests (only run with SWMR-enabled file drivers).\n");
+ HDfprintf(stdout,
+ "Skipping all flush/refresh tests (only run with SWMR-enabled file drivers).\n");
/* Test script is expecting some signals, so send them out to end it. */
- if(end_verification() < 0) TEST_ERROR;
- if(end_verification() < 0) TEST_ERROR;
+ if (end_verification() < 0)
+ TEST_ERROR;
+ if (end_verification() < 0)
+ TEST_ERROR;
} /* end else */
}
- else if(argc == 3) {
+ else if (argc == 3) {
/* Two arguments supplied. Pass them to flush verification routine. */
- if(flush_verification(argv[1], argv[2]) != 0) PROCESS_ERROR;
+ if (flush_verification(argv[1], argv[2]) != 0)
+ PROCESS_ERROR;
}
- else if(argc == 2) {
+ else if (argc == 2) {
/* One argument supplied. Pass it to refresh verification routine. */
- if(refresh_verification(argv[1]) != 0) PROCESS_ERROR;
+ if (refresh_verification(argv[1]) != 0)
+ PROCESS_ERROR;
}
else {
/* Illegal number of arguments supplied. Error. */
@@ -188,7 +195,6 @@ error:
return EXIT_FAILURE;
} /* main */
-
/*-------------------------------------------------------------------------
* Function: test_flush
*
@@ -202,7 +208,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t test_flush(void)
+herr_t
+test_flush(void)
{
/**************************************************************************
*
@@ -239,26 +246,26 @@ herr_t test_flush(void)
**************************************************************************/
/**************************************************************************
- * Generated Test File will look like this:
- *
- * GROUP "/"
- * DATASET "Dataset1"
- * GROUP "Group1" {
- * DATASET "Dataset2"
- * GROUP "Group2" {
- * DATATYPE "CommittedDatatype3"
- * }
- * }
- * GROUP "Group3" {
- * DATASET "Dataset3"
- * DATATYPE "CommittedDatatype2"
- * }
- * DATATYPE "CommittedDatatype1"
+ * Generated Test File will look like this:
+ *
+ * GROUP "/"
+ * DATASET "Dataset1"
+ * GROUP "Group1" {
+ * DATASET "Dataset2"
+ * GROUP "Group2" {
+ * DATATYPE "CommittedDatatype3"
+ * }
+ * }
+ * GROUP "Group3" {
+ * DATASET "Dataset3"
+ * DATATYPE "CommittedDatatype2"
+ * }
+ * DATATYPE "CommittedDatatype1"
**************************************************************************/
/* Variables */
- hid_t fid,gid,gid2,gid3,sid,tid1,tid2,tid3,did,did2,did3,rid,fapl,status = 0;
- hsize_t dims[2] = {3,5};
+ hid_t fid, gid, gid2, gid3, sid, tid1, tid2, tid3, did, did2, did3, rid, fapl, status = 0;
+ hsize_t dims[2] = {3, 5};
/* Testing Message */
HDfprintf(stdout, "Testing individual object flush behavior:\n");
@@ -271,43 +278,60 @@ herr_t test_flush(void)
/* ================ */
/* Create file, open root group - have to use latest file format for SWMR */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR;
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
- if((rid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
+ if ((rid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create data space and types */
- if((sid = H5Screate_simple(2, dims, dims)) < 0) TEST_ERROR;
- if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if((tid2 = H5Tcopy(H5T_NATIVE_CHAR)) < 0) TEST_ERROR;
- if((tid3 = H5Tcopy(H5T_NATIVE_LONG)) < 0) TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims, dims)) < 0)
+ TEST_ERROR;
+ if ((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR;
+ if ((tid2 = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ TEST_ERROR;
+ if ((tid3 = H5Tcopy(H5T_NATIVE_LONG)) < 0)
+ TEST_ERROR;
/* Create Group1 */
- if((gid = H5Gcreate2(fid, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Group2 */
- if((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Group3 */
- if((gid3 = H5Gcreate2(fid, "Group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((gid3 = H5Gcreate2(fid, "Group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Dataset1 */
- if((did = H5Dcreate2(fid, "Dataset1", tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, "Dataset1", tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Dataset2 */
- if((did2 = H5Dcreate2(gid, "Dataset2", tid3, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((did2 = H5Dcreate2(gid, "Dataset2", tid3, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Dataset3 */
- if((did3 = H5Dcreate2(gid3, "Dataset3", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((did3 = H5Dcreate2(gid3, "Dataset3", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create CommittedDatatype1 */
- if((status = H5Tcommit2(fid, "CommittedDatatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((status = H5Tcommit2(fid, "CommittedDatatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create CommittedDatatype2 */
- if((status = H5Tcommit2(gid2, "CommittedDatatype2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((status = H5Tcommit2(gid2, "CommittedDatatype2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create CommittedDatatype3 */
- if((status = H5Tcommit2(gid3, "CommittedDatatype3", tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((status = H5Tcommit2(gid3, "CommittedDatatype3", tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* ============ */
/* FLUSH GROUPS */
@@ -317,57 +341,100 @@ herr_t test_flush(void)
TESTING("to ensure H5Gflush correctly flushes single groups");
/* First, let's verify that nothing is currently flushed. */
- if(run_flush_verification_process(RG, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if (run_flush_verification_process(RG, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
/* Then, flush the root group and verify it's the only thing on disk */
- if((status = H5Gflush(rid)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Gflush(rid)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
/* Flush Group1 and Verify it is recently flushed, and nothing
* else has changed. */
- if((status = H5Gflush(gid)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Gflush(gid)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
/* Flush Group2 and Verify it is recently flushed, and nothing
* else has changed. */
- if((status = H5Gflush(gid2)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Gflush(gid2)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
PASSED();
@@ -379,30 +446,52 @@ herr_t test_flush(void)
TESTING("to ensure H5Dflush correctly flushes single datasets");
/* Flush Dataset1 and verify it's the only thing that hits disk. */
- if((status = H5Dflush(did)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Dflush(did)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
/* Flush Dataset2 and verify it's the only thing that hits disk. */
- if((status = H5Dflush(did2)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Dflush(did2)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
PASSED();
@@ -414,30 +503,52 @@ herr_t test_flush(void)
TESTING("to ensure H5Tflush correctly flushes single datatypes");
/* Flush Datatype 1 and verify it's the only thing that hits disk. */
- if((status = H5Tflush(tid1)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Tflush(tid1)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
/* Flush Datatype 2 and verify it's the only thing that hits disk. */
- if((status = H5Tflush(tid2)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Tflush(tid2)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
PASSED();
@@ -449,61 +560,102 @@ herr_t test_flush(void)
TESTING("to ensure H5Oflush correctly flushes single objects");
/* Flush Group3 and verify it's the only thing that hits disk. */
- if((status = H5Oflush(gid3)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, NOT_FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Oflush(gid3)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
/* Flush Dataset3 and verify it's the only thing that hits disk. */
- if((status = H5Oflush(did3)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, NOT_FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Oflush(did3)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, NOT_FLUSHED) != 0)
+ TEST_ERROR;
/* Flush CommittedDatatype3 and verify it's the only thing that hits disk. */
- if((status = H5Oflush(tid3)) < 0) TEST_ERROR;
- if(run_flush_verification_process(RG, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(G3, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(D3, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T1, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T2, FLUSHED) != 0) TEST_ERROR;
- if(run_flush_verification_process(T3, FLUSHED) != 0) TEST_ERROR;
+ if ((status = H5Oflush(tid3)) < 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(RG, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(G3, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(D3, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T1, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T2, FLUSHED) != 0)
+ TEST_ERROR;
+ if (run_flush_verification_process(T3, FLUSHED) != 0)
+ TEST_ERROR;
PASSED();
/* ================== */
/* Cleanup and Return */
/* ================== */
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
- if(H5Gclose(gid2) < 0) TEST_ERROR;
- if(H5Dclose(did) < 0) TEST_ERROR;
- if(H5Dclose(did2) < 0) TEST_ERROR;
- if(H5Gclose(rid) < 0) TEST_ERROR;
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR;
+ if (H5Gclose(rid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* Delete test file */
HDremove(FILENAME);
- if(end_verification() < 0) TEST_ERROR;
+ if (end_verification() < 0)
+ TEST_ERROR;
return SUCCEED;
@@ -511,7 +663,6 @@ error:
return FAIL;
} /* end test_flush */
-
/*-------------------------------------------------------------------------
* Function: test_refresh
*
@@ -525,7 +676,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t test_refresh(void)
+herr_t
+test_refresh(void)
{
/**************************************************************************
*
@@ -562,30 +714,30 @@ herr_t test_refresh(void)
**************************************************************************/
/**************************************************************************
- * Generated Test File will look like this:
- *
- * GROUP "/"
- * DATASET "Dataset1"
- * GROUP "Group1" {
- * DATASET "Dataset2"
- * GROUP "Group2" {
- * DATATYPE "CommittedDatatype3"
- * }
- * }
- * GROUP "Group3" {
- * DATASET "Dataset3"
- * DATATYPE "CommittedDatatype2"
- * }
- * DATATYPE "CommittedDatatype1"
+ * Generated Test File will look like this:
+ *
+ * GROUP "/"
+ * DATASET "Dataset1"
+ * GROUP "Group1" {
+ * DATASET "Dataset2"
+ * GROUP "Group2" {
+ * DATATYPE "CommittedDatatype3"
+ * }
+ * }
+ * GROUP "Group3" {
+ * DATASET "Dataset3"
+ * DATATYPE "CommittedDatatype2"
+ * }
+ * DATATYPE "CommittedDatatype1"
**************************************************************************/
/* Variables */
- hid_t aid,fid,sid,tid1,did,dcpl,fapl = 0;
- hid_t gid,gid2,gid3,tid2,tid3,did2,did3;
- herr_t status = 0;
- hsize_t dims[2] = {50,50};
- hsize_t cdims[2] = {1,1};
- int fillval = 2;
+ hid_t aid, fid, sid, tid1, did, dcpl, fapl = 0;
+ hid_t gid, gid2, gid3, tid2, tid3, did2, did3;
+ herr_t status = 0;
+ hsize_t dims[2] = {50, 50};
+ hsize_t cdims[2] = {1, 1};
+ int fillval = 2;
/* Testing Message */
HDfprintf(stdout, "Testing individual object refresh behavior:\n");
@@ -598,48 +750,68 @@ herr_t test_refresh(void)
/* ================ */
/* Create File */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR;
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* Create data space and types */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if(H5Pset_chunk(dcpl, 2, cdims) < 0) TEST_ERROR;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) TEST_ERROR;
- if((sid = H5Screate_simple(2, dims, dims)) < 0) TEST_ERROR;
- if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if((tid2 = H5Tcopy(H5T_NATIVE_CHAR)) < 0) TEST_ERROR;
- if((tid3 = H5Tcopy(H5T_NATIVE_LONG)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, cdims) < 0)
+ TEST_ERROR;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ TEST_ERROR;
+ if ((sid = H5Screate_simple(2, dims, dims)) < 0)
+ TEST_ERROR;
+ if ((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR;
+ if ((tid2 = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ TEST_ERROR;
+ if ((tid3 = H5Tcopy(H5T_NATIVE_LONG)) < 0)
+ TEST_ERROR;
/* Create Group1 */
- if((gid = H5Gcreate2(fid, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((gid = H5Gcreate2(fid, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Group2 */
- if((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Group3 */
- if((gid3 = H5Gcreate2(fid, "Group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((gid3 = H5Gcreate2(fid, "Group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Dataset1 */
- if((did = H5Dcreate2(fid, "Dataset1", tid1, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((did = H5Dcreate2(fid, "Dataset1", tid1, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Dataset2 */
- if((did2 = H5Dcreate2(gid, "Dataset2", tid3, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((did2 = H5Dcreate2(gid, "Dataset2", tid3, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create Dataset3 */
- if((did3 = H5Dcreate2(gid3, "Dataset3", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((did3 = H5Dcreate2(gid3, "Dataset3", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create CommittedDatatype1 */
- if((status = H5Tcommit2(fid, "CommittedDatatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((status = H5Tcommit2(fid, "CommittedDatatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create CommittedDatatype2 */
- if((status = H5Tcommit2(gid2, "CommittedDatatype2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((status = H5Tcommit2(gid2, "CommittedDatatype2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create CommittedDatatype3 */
- if((status = H5Tcommit2(gid3, "CommittedDatatype3", tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((status = H5Tcommit2(gid3, "CommittedDatatype3", tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Flush File to Disk */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) TEST_ERROR;
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ TEST_ERROR;
/* ================ */
/* Refresh Datasets */
@@ -650,22 +822,32 @@ herr_t test_refresh(void)
/* Create an attribute on each object before flush. */
/* Verify First Dataset can be refreshed with H5Drefresh */
- if(start_refresh_verification_process(D1) != 0) TEST_ERROR;
+ if (start_refresh_verification_process(D1) != 0)
+ TEST_ERROR;
- if((aid = H5Acreate2(did, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Aclose(aid) < 0) TEST_ERROR;
- if(H5Oflush(did) < 0) TEST_ERROR;
+ if ((aid = H5Acreate2(did, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Oflush(did) < 0)
+ TEST_ERROR;
- if(end_refresh_verification_process() != 0) TEST_ERROR;
+ if (end_refresh_verification_process() != 0)
+ TEST_ERROR;
/* Verify Second Dataset can be refreshed with H5Drefresh */
- if(start_refresh_verification_process(D2) != 0) TEST_ERROR;
+ if (start_refresh_verification_process(D2) != 0)
+ TEST_ERROR;
- if((aid = H5Acreate2(did2, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Aclose(aid) < 0) TEST_ERROR;
- if(H5Oflush(did2) < 0) TEST_ERROR;
+ if ((aid = H5Acreate2(did2, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Oflush(did2) < 0)
+ TEST_ERROR;
- if(end_refresh_verification_process() != 0) TEST_ERROR;
+ if (end_refresh_verification_process() != 0)
+ TEST_ERROR;
PASSED();
@@ -676,22 +858,32 @@ herr_t test_refresh(void)
TESTING("to ensure that H5Grefresh correctly refreshes single groups");
/* Verify First Group can be refreshed with H5Grefresh */
- if(start_refresh_verification_process(G1) != 0) TEST_ERROR;
+ if (start_refresh_verification_process(G1) != 0)
+ TEST_ERROR;
- if((aid = H5Acreate2(gid, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Aclose(aid) < 0) TEST_ERROR;
- if(H5Oflush(gid) < 0) TEST_ERROR;
+ if ((aid = H5Acreate2(gid, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Oflush(gid) < 0)
+ TEST_ERROR;
- if(end_refresh_verification_process() != 0) TEST_ERROR;
+ if (end_refresh_verification_process() != 0)
+ TEST_ERROR;
/* Verify Second Group can be refreshed with H5Grefresh */
- if(start_refresh_verification_process(G2) != 0) TEST_ERROR;
+ if (start_refresh_verification_process(G2) != 0)
+ TEST_ERROR;
- if((aid = H5Acreate2(gid2, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Aclose(aid) < 0) TEST_ERROR;
- if(H5Oflush(gid2) < 0) TEST_ERROR;
+ if ((aid = H5Acreate2(gid2, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Oflush(gid2) < 0)
+ TEST_ERROR;
- if(end_refresh_verification_process() != 0) TEST_ERROR;
+ if (end_refresh_verification_process() != 0)
+ TEST_ERROR;
PASSED();
@@ -701,22 +893,32 @@ herr_t test_refresh(void)
TESTING("to ensure that H5Trefresh correctly refreshes single datatypes");
/* Verify First Committed Datatype can be refreshed with H5Trefresh */
- if(start_refresh_verification_process(T1) != 0) TEST_ERROR;
+ if (start_refresh_verification_process(T1) != 0)
+ TEST_ERROR;
- if((aid = H5Acreate2(tid1, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Aclose(aid) < 0) TEST_ERROR;
- if(H5Oflush(tid1) < 0) TEST_ERROR;
+ if ((aid = H5Acreate2(tid1, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Oflush(tid1) < 0)
+ TEST_ERROR;
- if(end_refresh_verification_process() != 0) TEST_ERROR;
+ if (end_refresh_verification_process() != 0)
+ TEST_ERROR;
/* Verify Second Committed Datatype can be refreshed with H5Trefresh */
- if(start_refresh_verification_process(T2) != 0) TEST_ERROR;
+ if (start_refresh_verification_process(T2) != 0)
+ TEST_ERROR;
- if((aid = H5Acreate2(tid2, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Aclose(aid) < 0) TEST_ERROR;
- if(H5Oflush(tid2) < 0) TEST_ERROR;
+ if ((aid = H5Acreate2(tid2, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Oflush(tid2) < 0)
+ TEST_ERROR;
- if(end_refresh_verification_process() != 0) TEST_ERROR;
+ if (end_refresh_verification_process() != 0)
+ TEST_ERROR;
PASSED();
/* =============== */
@@ -726,31 +928,46 @@ herr_t test_refresh(void)
TESTING("to ensure that H5Orefresh correctly refreshes single objects");
/* Verify Third Dataset can be refreshed with H5Orefresh */
- if(start_refresh_verification_process(D3) != 0) TEST_ERROR;
+ if (start_refresh_verification_process(D3) != 0)
+ TEST_ERROR;
- if((aid = H5Acreate2(did3, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Aclose(aid) < 0) TEST_ERROR;
- if(H5Oflush(did3) < 0) TEST_ERROR;
+ if ((aid = H5Acreate2(did3, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Oflush(did3) < 0)
+ TEST_ERROR;
- if(end_refresh_verification_process() != 0) TEST_ERROR;
+ if (end_refresh_verification_process() != 0)
+ TEST_ERROR;
/* Verify Third Group can be refreshed with H5Orefresh */
- if(start_refresh_verification_process(G3) != 0) TEST_ERROR;
+ if (start_refresh_verification_process(G3) != 0)
+ TEST_ERROR;
- if((aid = H5Acreate2(gid3, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Aclose(aid) < 0) TEST_ERROR;
- if(H5Oflush(gid3) < 0) TEST_ERROR;
+ if ((aid = H5Acreate2(gid3, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Oflush(gid3) < 0)
+ TEST_ERROR;
- if(end_refresh_verification_process() != 0) TEST_ERROR;
+ if (end_refresh_verification_process() != 0)
+ TEST_ERROR;
/* Verify Third Committed Datatype can be refreshed with H5Orefresh */
- if(start_refresh_verification_process(T3) != 0) TEST_ERROR;
+ if (start_refresh_verification_process(T3) != 0)
+ TEST_ERROR;
- if((aid = H5Acreate2(tid3, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Aclose(aid) < 0) TEST_ERROR;
- if(H5Oflush(tid3) < 0) TEST_ERROR;
+ if ((aid = H5Acreate2(tid3, "Attribute", tid1, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR;
+ if (H5Oflush(tid3) < 0)
+ TEST_ERROR;
- if(end_refresh_verification_process() != 0) TEST_ERROR;
+ if (end_refresh_verification_process() != 0)
+ TEST_ERROR;
PASSED();
@@ -759,24 +976,38 @@ herr_t test_refresh(void)
/* ================== */
/* Close Stuff */
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Tclose(tid1) < 0) TEST_ERROR;
- if(H5Tclose(tid2) < 0) TEST_ERROR;
- if(H5Tclose(tid3) < 0) TEST_ERROR;
- if(H5Dclose(did) < 0) TEST_ERROR;
- if(H5Dclose(did2) < 0) TEST_ERROR;
- if(H5Dclose(did3) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
- if(H5Gclose(gid2) < 0) TEST_ERROR;
- if(H5Gclose(gid3) < 0) TEST_ERROR;
- if(H5Sclose(sid) < 0) TEST_ERROR;
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid1) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid3) < 0)
+ TEST_ERROR;
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR;
+ if (H5Dclose(did3) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR;
+ if (H5Gclose(gid3) < 0)
+ TEST_ERROR;
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* Delete Test File */
HDremove(FILENAME);
- if(end_verification() < 0) TEST_ERROR;
+ if (end_verification() < 0)
+ TEST_ERROR;
return SUCCEED;
@@ -785,7 +1016,6 @@ error:
return FAIL;
} /* test_refresh() */
-
/*-------------------------------------------------------------------------
* Function: run_flush_verification_process
*
@@ -800,7 +1030,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t run_flush_verification_process(const char * obj_pathname, const char * expected)
+herr_t
+run_flush_verification_process(const char *obj_pathname, const char *expected)
{
HDremove(SIGNAL_FROM_SCRIPT);
@@ -808,10 +1039,12 @@ herr_t run_flush_verification_process(const char * obj_pathname, const char * ex
h5_send_message(SIGNAL_TO_SCRIPT, obj_pathname, expected);
/* Wait for Signal from SCRIPT indicating that verification process has completed. */
- if(h5_wait_message(SIGNAL_FROM_SCRIPT) < 0) TEST_ERROR;
+ if (h5_wait_message(SIGNAL_FROM_SCRIPT) < 0)
+ TEST_ERROR;
/* Check to see if any errors occurred */
- if(check_for_errors() < 0) TEST_ERROR;
+ if (check_for_errors() < 0)
+ TEST_ERROR;
/* Return */
return SUCCEED;
@@ -820,7 +1053,6 @@ error:
return FAIL;
} /* run_flush_verification_process */
-
/*-------------------------------------------------------------------------
* Function: flush_verification
*
@@ -838,41 +1070,50 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t flush_verification(const char * obj_pathname, const char * expected)
+herr_t
+flush_verification(const char *obj_pathname, const char *expected)
{
/* Variables */
- hid_t oid = -1, fid = -1;
- herr_t status = 0;
+ hid_t oid = -1, fid = -1;
+ herr_t status = 0;
H5O_info2_t oinfo;
/* Try to open the testfile and then obj_pathname within the file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT);
- oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT);
+ H5E_BEGIN_TRY
+ {
+ fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT);
+ oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT);
status = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Compare to expected result */
- if(HDstrcmp(expected, FLUSHED) == 0) {
- if((oid < 0) || (status < 0)) {
+ if (HDstrcmp(expected, FLUSHED) == 0) {
+ if ((oid < 0) || (status < 0)) {
HDfprintf(stderr, "Error! %s should be on disk, but was NOT!\n", obj_pathname);
PROCESS_ERROR;
} /* end if */
- } else if(HDstrcmp(expected, NOT_FLUSHED) == 0) {
- if((oid > 0) || (status > 0)) {
- HDfprintf(stderr, "Error! %s not expected to be flushed, but it was found on disk!\n", obj_pathname);
+ }
+ else if (HDstrcmp(expected, NOT_FLUSHED) == 0) {
+ if ((oid > 0) || (status > 0)) {
+ HDfprintf(stderr, "Error! %s not expected to be flushed, but it was found on disk!\n",
+ obj_pathname);
PROCESS_ERROR;
} /* end if */
- } else {
- HDfprintf(stderr, "Error! Bad verification parameters. %s is an invalid expected outcome.\n", expected);
+ }
+ else {
+ HDfprintf(stderr, "Error! Bad verification parameters. %s is an invalid expected outcome.\n",
+ expected);
PROCESS_ERROR;
} /* end if */
/* Cleanup */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Oclose(oid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return SUCCEED;
@@ -880,7 +1121,6 @@ error:
return FAIL;
} /* flush_verification */
-
/*-------------------------------------------------------------------------
* Function: start_refresh_verification_process
*
@@ -895,7 +1135,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t start_refresh_verification_process(const char * obj_pathname)
+herr_t
+start_refresh_verification_process(const char *obj_pathname)
{
HDremove(SIGNAL_BETWEEN_PROCESSES_1);
@@ -905,10 +1146,12 @@ herr_t start_refresh_verification_process(const char * obj_pathname)
/* Wait for Signal from VERIFICATION PROCESS indicating that it's opened the
target object and ready for MAIN PROCESS to modify it */
- if(h5_wait_message(SIGNAL_BETWEEN_PROCESSES_1) < 0) TEST_ERROR;
+ if (h5_wait_message(SIGNAL_BETWEEN_PROCESSES_1) < 0)
+ TEST_ERROR;
/* Check to see if any errors occurred */
- if(check_for_errors() < 0) TEST_ERROR;
+ if (check_for_errors() < 0)
+ TEST_ERROR;
/* Return */
return SUCCEED;
@@ -917,7 +1160,6 @@ error:
return FAIL;
} /* start_refresh_verification_process */
-
/*-------------------------------------------------------------------------
* Function: end_refresh_verification_process
*
@@ -933,7 +1175,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t end_refresh_verification_process(void)
+herr_t
+end_refresh_verification_process(void)
{
HDremove(SIGNAL_FROM_SCRIPT);
@@ -944,10 +1187,12 @@ herr_t end_refresh_verification_process(void)
/* Wait for Signal from SCRIPT indicating that the refresh verification
process has completed. */
- if(h5_wait_message(SIGNAL_FROM_SCRIPT) < 0) TEST_ERROR;
+ if (h5_wait_message(SIGNAL_FROM_SCRIPT) < 0)
+ TEST_ERROR;
/* Check to see if any errors occurred */
- if(check_for_errors() < 0) TEST_ERROR;
+ if (check_for_errors() < 0)
+ TEST_ERROR;
/* Return */
return SUCCEED;
@@ -956,7 +1201,6 @@ error:
return FAIL;
} /* end_refresh_verification_process */
-
/*-------------------------------------------------------------------------
* Function: refresh_verification
*
@@ -974,32 +1218,37 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t refresh_verification(const char * obj_pathname)
+herr_t
+refresh_verification(const char *obj_pathname)
{
/* Variables */
- hid_t oid,fid,status = 0;
- H5O_info2_t flushed_oinfo;
- H5O_info2_t refreshed_oinfo;
+ hid_t oid, fid, status = 0;
+ H5O_info2_t flushed_oinfo;
+ H5O_info2_t refreshed_oinfo;
H5O_native_info_t flushed_ninfo;
H5O_native_info_t refreshed_ninfo;
- int tries = 800, sleep_tries = 400;
- int token_cmp;
- hbool_t ok = FALSE;
+ int tries = 800, sleep_tries = 400;
+ int token_cmp;
+ hbool_t ok = FALSE;
HDremove(SIGNAL_BETWEEN_PROCESSES_2);
/* Open Object */
- if((fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT)) < 0) PROCESS_ERROR;
- if((oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT)) < 0) PROCESS_ERROR;
+ if ((fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT)) < 0)
+ PROCESS_ERROR;
+ if ((oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT)) < 0)
+ PROCESS_ERROR;
/* Get Object info */
- if((status = H5Oget_info3(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR;
- if((status = H5Oget_native_info(oid, &flushed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR;
+ if ((status = H5Oget_info3(oid, &flushed_oinfo, H5O_INFO_BASIC | H5O_INFO_NUM_ATTRS)) < 0)
+ PROCESS_ERROR;
+ if ((status = H5Oget_native_info(oid, &flushed_ninfo, H5O_NATIVE_INFO_HDR)) < 0)
+ PROCESS_ERROR;
/* Make sure there are no attributes on the object. This is just a sanity
check to ensure we didn't erroneously flush the attribute before
starting the verification. */
- if(flushed_oinfo.num_attrs != 0)
+ if (flushed_oinfo.num_attrs != 0)
PROCESS_ERROR;
/* Send Signal to MAIN PROCESS indicating that it can go ahead and modify the
@@ -1008,25 +1257,37 @@ herr_t refresh_verification(const char * obj_pathname)
/* Wait for Signal from MAIN PROCESS indicating that it's modified the
object and we can run verification now. */
- if(h5_wait_message(SIGNAL_BETWEEN_PROCESSES_2) < 0) PROCESS_ERROR;
+ if (h5_wait_message(SIGNAL_BETWEEN_PROCESSES_2) < 0)
+ PROCESS_ERROR;
/* Get object info again. This will NOT reflect what's on disk, only what's
in the cache. Thus, all values will be unchanged from above, despite
newer information being on disk. */
- if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR;
- if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR;
+ if ((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC | H5O_INFO_NUM_ATTRS)) < 0)
+ PROCESS_ERROR;
+ if ((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0)
+ PROCESS_ERROR;
/* Verify that before doing a refresh, getting the object info returns stale
information. (i.e., unchanged from above, despite new info on disk). */
- if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0) PROCESS_ERROR;
- if(token_cmp) PROCESS_ERROR;
- if(flushed_oinfo.type != refreshed_oinfo.type) PROCESS_ERROR;
- if(flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) PROCESS_ERROR;
- if(flushed_ninfo.hdr.version != refreshed_ninfo.hdr.version) PROCESS_ERROR;
- if(flushed_ninfo.hdr.flags != refreshed_ninfo.hdr.flags) PROCESS_ERROR;
- if(flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) PROCESS_ERROR;
- if(flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) PROCESS_ERROR;
- if(flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) PROCESS_ERROR;
+ if (H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0)
+ PROCESS_ERROR;
+ if (token_cmp)
+ PROCESS_ERROR;
+ if (flushed_oinfo.type != refreshed_oinfo.type)
+ PROCESS_ERROR;
+ if (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs)
+ PROCESS_ERROR;
+ if (flushed_ninfo.hdr.version != refreshed_ninfo.hdr.version)
+ PROCESS_ERROR;
+ if (flushed_ninfo.hdr.flags != refreshed_ninfo.hdr.flags)
+ PROCESS_ERROR;
+ if (flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs)
+ PROCESS_ERROR;
+ if (flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks)
+ PROCESS_ERROR;
+ if (flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total)
+ PROCESS_ERROR;
/* Refresh object */
/* The H5*refresh function called depends on which object we are trying
@@ -1034,18 +1295,22 @@ herr_t refresh_verification(const char * obj_pathname)
* test cases is easy). */
do {
- if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) {
- if(H5Drefresh(oid) < 0) PROCESS_ERROR;
+ if ((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) {
+ if (H5Drefresh(oid) < 0)
+ PROCESS_ERROR;
} /* end if */
- else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) {
- if(H5Grefresh(oid) < 0) PROCESS_ERROR;
+ else if ((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) {
+ if (H5Grefresh(oid) < 0)
+ PROCESS_ERROR;
} /* end if */
- else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) {
- if(H5Trefresh(oid) < 0) PROCESS_ERROR;
+ else if ((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) {
+ if (H5Trefresh(oid) < 0)
+ PROCESS_ERROR;
} /* end if */
- else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) ||
- (HDstrcmp(obj_pathname, T3) == 0)) {
- if(H5Orefresh(oid) < 0) PROCESS_ERROR;
+ else if ((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) ||
+ (HDstrcmp(obj_pathname, T3) == 0)) {
+ if (H5Orefresh(oid) < 0)
+ PROCESS_ERROR;
} /* end if */
else {
HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname);
@@ -1053,42 +1318,46 @@ herr_t refresh_verification(const char * obj_pathname)
} /* end else */
/* Get object info. This should now accurately reflect the refreshed object on disk. */
- if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR;
- if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR;
- if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0) PROCESS_ERROR;
+ if ((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC | H5O_INFO_NUM_ATTRS)) < 0)
+ PROCESS_ERROR;
+ if ((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0)
+ PROCESS_ERROR;
+ if (H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0)
+ PROCESS_ERROR;
/* Confirm following (first 4) attributes are the same: */
/* Confirm following (last 4) attributes are different */
- if( (!token_cmp) &&
- (flushed_oinfo.type == refreshed_oinfo.type) &&
- (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) &&
- (flushed_ninfo.hdr.version == refreshed_ninfo.hdr.version) &&
- (flushed_ninfo.hdr.flags == refreshed_ninfo.hdr.flags) &&
- (flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) &&
- (flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) &&
- (flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) ) {
+ if ((!token_cmp) && (flushed_oinfo.type == refreshed_oinfo.type) &&
+ (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) &&
+ (flushed_ninfo.hdr.version == refreshed_ninfo.hdr.version) &&
+ (flushed_ninfo.hdr.flags == refreshed_ninfo.hdr.flags) &&
+ (flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) &&
+ (flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) &&
+ (flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total)) {
ok = TRUE;
break;
}
- if(tries == sleep_tries)
+ if (tries == sleep_tries)
HDsleep(1);
- } while(--tries);
+ } while (--tries);
- if(!ok) {
- HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n",
- (int)flushed_oinfo.num_attrs, (int)flushed_ninfo.hdr.nmesgs,
- (int)flushed_ninfo.hdr.nchunks, (int)flushed_ninfo.hdr.space.total);
- HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n",
- (int)refreshed_oinfo.num_attrs, (int)refreshed_ninfo.hdr.nmesgs,
- (int)refreshed_ninfo.hdr.nchunks, (int)refreshed_ninfo.hdr.space.total);
+ if (!ok) {
+ HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", (int)flushed_oinfo.num_attrs,
+ (int)flushed_ninfo.hdr.nmesgs, (int)flushed_ninfo.hdr.nchunks,
+ (int)flushed_ninfo.hdr.space.total);
+ HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", (int)refreshed_oinfo.num_attrs,
+ (int)refreshed_ninfo.hdr.nmesgs, (int)refreshed_ninfo.hdr.nchunks,
+ (int)refreshed_ninfo.hdr.space.total);
PROCESS_ERROR;
}
/* Close objects */
- if(H5Oclose(oid) < 0) PROCESS_ERROR;
- if(H5Fclose(fid) < 0) PROCESS_ERROR;
+ if (H5Oclose(oid) < 0)
+ PROCESS_ERROR;
+ if (H5Fclose(fid) < 0)
+ PROCESS_ERROR;
/* Return */
return SUCCEED;
@@ -1097,7 +1366,6 @@ error:
return FAIL;
} /* refresh_verification */
-
/*-------------------------------------------------------------------------
* Function: check_for_errors()
*
@@ -1115,11 +1383,12 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t check_for_errors(void)
+herr_t
+check_for_errors(void)
{
- FILE * file;
+ FILE *file;
- if((file = HDfopen(ERRFILE, "r"))) {
+ if ((file = HDfopen(ERRFILE, "r"))) {
HDfclose(file);
HDremove(ERRFILE);
return FAIL;
@@ -1128,7 +1397,6 @@ herr_t check_for_errors(void)
return SUCCEED;
} /* check_for_errors */
-
/*-------------------------------------------------------------------------
* Function: end_verification
*
@@ -1142,7 +1410,8 @@ herr_t check_for_errors(void)
*
*-------------------------------------------------------------------------
*/
-herr_t end_verification(void)
+herr_t
+end_verification(void)
{
HDremove(SIGNAL_FROM_SCRIPT);
@@ -1150,11 +1419,11 @@ herr_t end_verification(void)
h5_send_message(SIGNAL_TO_SCRIPT, "VERIFICATION_DONE", "VERIFICATION_DONE");
/* Wait for Signal from SCRIPT indicating that we can continue. */
- if(h5_wait_message(SIGNAL_FROM_SCRIPT) < 0) TEST_ERROR;
+ if (h5_wait_message(SIGNAL_FROM_SCRIPT) < 0)
+ TEST_ERROR;
return SUCCEED;
error:
return FAIL;
} /* end_verification */
-
diff --git a/test/freespace.c b/test/freespace.c
index fb2b45d..4b6f54c 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -15,78 +15,74 @@
*/
#include "h5test.h"
-#define H5FS_FRIEND /*suppress error about including H5FSpkg */
+#define H5FS_FRIEND /*suppress error about including H5FSpkg */
#define H5FS_TESTING
-#include "H5FSpkg.h" /* Free space manager */
-
+#include "H5FSpkg.h" /* Free space manager */
/* Other private headers that this test requires */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5Fpkg.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Iprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VMprivate.h"
-#define FILENAME_LEN 1024
-
-#define TEST_FSPACE_SECT_TYPE 0
-#define TEST_FSPACE_SECT_TYPE_NEW 1
-#define TEST_FSPACE_SECT_TYPE_NONE 2
-
-#define TEST_FSPACE_SHRINK 80
-#define TEST_FSPACE_EXPAND 120
-#define TEST_MAX_SECT_SIZE (64 * 1024)
-#define TEST_MAX_INDEX 32
-
-#define TEST_SECT_ADDR60 60
-#define TEST_SECT_ADDR70 70
-#define TEST_SECT_ADDR80 80
-#define TEST_SECT_ADDR100 100
-#define TEST_SECT_ADDR150 150
-#define TEST_SECT_ADDR200 200
-#define TEST_SECT_ADDR300 300
-
-#define TEST_SECT_SIZE5 5
-#define TEST_SECT_SIZE10 10
-#define TEST_SECT_SIZE15 15
-#define TEST_SECT_SIZE20 20
-#define TEST_SECT_SIZE30 30
-#define TEST_SECT_SIZE40 40
-#define TEST_SECT_SIZE50 50
-#define TEST_SECT_SIZE80 80
-
-#define FSPACE_THRHD_DEF 1 /* Default: no alignment threshold */
-#define FSPACE_ALIGN_DEF 1 /* Default: no alignment */
-
-const char *FILENAME[] = {
- "frspace",
- NULL
-};
+#define FILENAME_LEN 1024
+
+#define TEST_FSPACE_SECT_TYPE 0
+#define TEST_FSPACE_SECT_TYPE_NEW 1
+#define TEST_FSPACE_SECT_TYPE_NONE 2
+
+#define TEST_FSPACE_SHRINK 80
+#define TEST_FSPACE_EXPAND 120
+#define TEST_MAX_SECT_SIZE (64 * 1024)
+#define TEST_MAX_INDEX 32
+
+#define TEST_SECT_ADDR60 60
+#define TEST_SECT_ADDR70 70
+#define TEST_SECT_ADDR80 80
+#define TEST_SECT_ADDR100 100
+#define TEST_SECT_ADDR150 150
+#define TEST_SECT_ADDR200 200
+#define TEST_SECT_ADDR300 300
+
+#define TEST_SECT_SIZE5 5
+#define TEST_SECT_SIZE10 10
+#define TEST_SECT_SIZE15 15
+#define TEST_SECT_SIZE20 20
+#define TEST_SECT_SIZE30 30
+#define TEST_SECT_SIZE40 40
+#define TEST_SECT_SIZE50 50
+#define TEST_SECT_SIZE80 80
+
+#define FSPACE_THRHD_DEF 1 /* Default: no alignment threshold */
+#define FSPACE_ALIGN_DEF 1 /* Default: no alignment */
+
+const char *FILENAME[] = {"frspace", NULL};
typedef struct frspace_state_t {
- hsize_t tot_space; /* Total amount of space tracked */
- hsize_t tot_sect_count; /* Total # of sections tracked */
- hsize_t serial_sect_count; /* # of serializable sections tracked */
- hsize_t ghost_sect_count; /* # of un-serializable sections tracked */
+ hsize_t tot_space; /* Total amount of space tracked */
+ hsize_t tot_sect_count; /* Total # of sections tracked */
+ hsize_t serial_sect_count; /* # of serializable sections tracked */
+ hsize_t ghost_sect_count; /* # of un-serializable sections tracked */
} frspace_state_t;
-haddr_t g_eoa=0;
-static haddr_t TEST_get_eoa(void);
-static void TEST_set_eoa(haddr_t);
+haddr_t g_eoa = 0;
+static haddr_t TEST_get_eoa(void);
+static void TEST_set_eoa(haddr_t);
/*
* TEST client
*/
typedef struct TEST_free_section_t {
- H5FS_section_info_t sect_info; /* Free space section information (must be first in struct) */
+ H5FS_section_info_t sect_info; /* Free space section information (must be first in struct) */
} TEST_free_section_t;
-
static herr_t TEST_sect_init_cls(H5FS_section_class_t *, void *);
static herr_t TEST_sect_free(H5FS_section_info_t *_sect);
-static herr_t TEST_sect_can_merge(const H5FS_section_info_t *, const H5FS_section_info_t *, void H5_ATTR_UNUSED *);
+static herr_t TEST_sect_can_merge(const H5FS_section_info_t *, const H5FS_section_info_t *,
+ void H5_ATTR_UNUSED *);
static herr_t TEST_sect_merging(H5FS_section_info_t **, H5FS_section_info_t *, void H5_ATTR_UNUSED *);
static herr_t TEST_sect_can_shrink(const H5FS_section_info_t *, void *);
static herr_t TEST_sect_shrinking(H5FS_section_info_t **, void *);
@@ -100,101 +96,95 @@ static unsigned test_fs_sect_change_class(hid_t fapl);
static unsigned test_fs_sect_extend(hid_t fapl);
static unsigned test_fs_sect_iterate(hid_t fapl);
-
H5FS_section_class_t TEST_FSPACE_SECT_CLS[1] = {{
- TEST_FSPACE_SECT_TYPE, /* Section type */
- 0, /* Extra serialized size */
- H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
- NULL, /* Class private info */
+ TEST_FSPACE_SECT_TYPE, /* Section type */
+ 0, /* Extra serialized size */
+ H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
+ NULL, /* Class private info */
/* Class methods */
- TEST_sect_init_cls, /* Initialize section class */
- NULL, /* Terminate section class */
+ TEST_sect_init_cls, /* Initialize section class */
+ NULL, /* Terminate section class */
/* Object methods */
- NULL, /* Add section */
- NULL, /* Serialize section */
- NULL, /* Deserialize section */
- TEST_sect_can_merge, /* Can sections merge? */
- TEST_sect_merging, /* Merge sections */
- TEST_sect_can_shrink, /* Can section shrink container?*/
- TEST_sect_shrinking, /* Shrink container w/section */
- TEST_sect_free, /* Free section */
- NULL, /* Check validity of section */
- NULL, /* Split section node for alignment */
- NULL, /* Dump debugging for section */
+ NULL, /* Add section */
+ NULL, /* Serialize section */
+ NULL, /* Deserialize section */
+ TEST_sect_can_merge, /* Can sections merge? */
+ TEST_sect_merging, /* Merge sections */
+ TEST_sect_can_shrink, /* Can section shrink container?*/
+ TEST_sect_shrinking, /* Shrink container w/section */
+ TEST_sect_free, /* Free section */
+ NULL, /* Check validity of section */
+ NULL, /* Split section node for alignment */
+ NULL, /* Dump debugging for section */
}};
H5FS_section_class_t TEST_FSPACE_SECT_CLS_NEW[1] = {{
- TEST_FSPACE_SECT_TYPE_NEW, /* Section type */
- 0, /* Extra serialized size */
- H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
- NULL, /* Class private info */
+ TEST_FSPACE_SECT_TYPE_NEW, /* Section type */
+ 0, /* Extra serialized size */
+ H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
+ NULL, /* Class private info */
/* Class methods */
- TEST_sect_init_cls, /* Initialize section class */
- NULL, /* Terminate section class */
+ TEST_sect_init_cls, /* Initialize section class */
+ NULL, /* Terminate section class */
/* Object methods */
- NULL, /* Add section */
- NULL, /* Serialize section */
- NULL, /* Deserialize section */
- TEST_sect_can_merge, /* Can sections merge? */
- TEST_sect_merging, /* Merge sections */
- NULL, /* Can section shrink container?*/
- NULL, /* Shrink container w/section */
- TEST_sect_free, /* Free section */
- NULL, /* Check validity of section */
- NULL, /* Split section node for alignment */
- NULL, /* Dump debugging for section */
+ NULL, /* Add section */
+ NULL, /* Serialize section */
+ NULL, /* Deserialize section */
+ TEST_sect_can_merge, /* Can sections merge? */
+ TEST_sect_merging, /* Merge sections */
+ NULL, /* Can section shrink container?*/
+ NULL, /* Shrink container w/section */
+ TEST_sect_free, /* Free section */
+ NULL, /* Check validity of section */
+ NULL, /* Split section node for alignment */
+ NULL, /* Dump debugging for section */
}};
H5FS_section_class_t TEST_FSPACE_SECT_CLS_NOINIT[1] = {{
- TEST_FSPACE_SECT_TYPE_NONE, /* Section type */
- 0, /* Extra serialized size */
- H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
- NULL, /* Class private info */
+ TEST_FSPACE_SECT_TYPE_NONE, /* Section type */
+ 0, /* Extra serialized size */
+ H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
+ NULL, /* Class private info */
/* Class methods */
- NULL, /* Initialize section class */
- NULL, /* Terminate section class */
+ NULL, /* Initialize section class */
+ NULL, /* Terminate section class */
/* Object methods */
- NULL, /* Add section */
- NULL, /* Serialize section */
- NULL, /* Deserialize section */
- TEST_sect_can_merge, /* Can sections merge? */
- TEST_sect_merging, /* Merge sections */
- NULL, /* Can section shrink container?*/
- NULL, /* Shrink container w/section */
- TEST_sect_free, /* Free section */
- NULL, /* Check validity of section */
- NULL, /* Split section node for alignment */
- NULL, /* Dump debugging for section */
+ NULL, /* Add section */
+ NULL, /* Serialize section */
+ NULL, /* Deserialize section */
+ TEST_sect_can_merge, /* Can sections merge? */
+ TEST_sect_merging, /* Merge sections */
+ NULL, /* Can section shrink container?*/
+ NULL, /* Shrink container w/section */
+ TEST_sect_free, /* Free section */
+ NULL, /* Check validity of section */
+ NULL, /* Split section node for alignment */
+ NULL, /* Dump debugging for section */
}};
-const H5FS_section_class_t *test_classes[] = {
- TEST_FSPACE_SECT_CLS,
- TEST_FSPACE_SECT_CLS_NEW,
- TEST_FSPACE_SECT_CLS_NOINIT
-};
-
+const H5FS_section_class_t *test_classes[] = {TEST_FSPACE_SECT_CLS, TEST_FSPACE_SECT_CLS_NEW,
+ TEST_FSPACE_SECT_CLS_NOINIT};
static void init_cparam(H5FS_create_t *);
static void init_sect_node(TEST_free_section_t *, haddr_t, hsize_t, unsigned, H5FS_section_state_t);
-static int check_stats(const H5F_t *, const H5FS_t *, frspace_state_t *);
+static int check_stats(const H5F_t *, const H5FS_t *, frspace_state_t *);
-#define NUM_SECTIONS 1000
+#define NUM_SECTIONS 1000
/* User data for free space section iterator callback */
typedef struct {
- hsize_t tot_size;
- hsize_t tot_sect_count;
+ hsize_t tot_size;
+ hsize_t tot_sect_count;
} TEST_iter_ud_t;
static herr_t TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata);
-
/*
* Tests
*/
@@ -205,8 +195,8 @@ static herr_t TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata);
static herr_t
TEST_sect_init_cls(H5FS_section_class_t *cls, void *_udata)
{
- herr_t ret_value = SUCCEED; /* Return value */
- unsigned *init_flags;
+ herr_t ret_value = SUCCEED; /* Return value */
+ unsigned *init_flags;
/* Check arguments. */
HDassert(cls);
@@ -223,17 +213,17 @@ TEST_sect_init_cls(H5FS_section_class_t *cls, void *_udata)
* true if second section adjoins the first section
*/
H5_ATTR_PURE static herr_t
-TEST_sect_can_merge(const H5FS_section_info_t *_sect1,
- const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
+TEST_sect_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_info_t *_sect2,
+ void H5_ATTR_UNUSED *_udata)
{
const TEST_free_section_t *sect1 = (const TEST_free_section_t *)_sect1;
const TEST_free_section_t *sect2 = (const TEST_free_section_t *)_sect2;
- htri_t ret_value; /* Return value */
+ htri_t ret_value; /* Return value */
/* Check arguments. */
HDassert(sect1);
HDassert(sect2);
- HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
+ HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr));
/* Check if second section adjoins first section */
@@ -246,29 +236,28 @@ TEST_sect_can_merge(const H5FS_section_info_t *_sect1,
* Merge the two sections (second section is merged into the first section)
*/
static herr_t
-TEST_sect_merging(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
- void H5_ATTR_UNUSED *_udata)
+TEST_sect_merging(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
{
- TEST_free_section_t **sect1 = (TEST_free_section_t **)_sect1;
- TEST_free_section_t *sect2 = (TEST_free_section_t *)_sect2;
- herr_t ret_value = SUCCEED; /* Return value */
+ TEST_free_section_t **sect1 = (TEST_free_section_t **)_sect1;
+ TEST_free_section_t * sect2 = (TEST_free_section_t *)_sect2;
+ herr_t ret_value = SUCCEED; /* Return value */
/* Check arguments. */
HDassert(sect1);
HDassert(((*sect1)->sect_info.type == TEST_FSPACE_SECT_TYPE) ||
- ((*sect1)->sect_info.type == TEST_FSPACE_SECT_TYPE_NEW) ||
- ((*sect1)->sect_info.type == TEST_FSPACE_SECT_TYPE_NONE));
+ ((*sect1)->sect_info.type == TEST_FSPACE_SECT_TYPE_NEW) ||
+ ((*sect1)->sect_info.type == TEST_FSPACE_SECT_TYPE_NONE));
HDassert(sect2);
HDassert((sect2->sect_info.type == TEST_FSPACE_SECT_TYPE) ||
- (sect2->sect_info.type == TEST_FSPACE_SECT_TYPE_NEW) ||
- (sect2->sect_info.type == TEST_FSPACE_SECT_TYPE_NONE));
+ (sect2->sect_info.type == TEST_FSPACE_SECT_TYPE_NEW) ||
+ (sect2->sect_info.type == TEST_FSPACE_SECT_TYPE_NONE));
HDassert(H5F_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr));
/* Add second section's size to first section */
(*sect1)->sect_info.size += sect2->sect_info.size;
/* Get rid of second section */
- if(TEST_sect_free((H5FS_section_info_t *)sect2) < 0)
+ if (TEST_sect_free((H5FS_section_info_t *)sect2) < 0)
TEST_ERROR
error:
return ret_value;
@@ -296,11 +285,11 @@ TEST_sect_free(H5FS_section_info_t *sect)
static herr_t
TEST_sect_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
- unsigned *can_shrink = (unsigned *)_udata;
- const TEST_free_section_t *sect = (const TEST_free_section_t *)_sect;
- haddr_t end, eoa;
+ unsigned * can_shrink = (unsigned *)_udata;
+ const TEST_free_section_t *sect = (const TEST_free_section_t *)_sect;
+ haddr_t end, eoa;
- if(can_shrink == NULL)
+ if (can_shrink == NULL)
return FALSE;
end = sect->sect_info.addr + sect->sect_info.size;
@@ -320,8 +309,8 @@ TEST_sect_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
static herr_t
TEST_sect_shrinking(H5FS_section_info_t **_sect, void *_udata)
{
- TEST_free_section_t **sect = (TEST_free_section_t **)_sect;
- unsigned *can_shrink = (unsigned *)_udata;
+ TEST_free_section_t **sect = (TEST_free_section_t **)_sect;
+ unsigned * can_shrink = (unsigned *)_udata;
/* address of the section is faked, so, doesn't need to do anything */
/* just free the section node */
@@ -336,16 +325,15 @@ error:
return FALSE;
}
-
/*
* iteration callback
*/
static herr_t
TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata)
{
- TEST_free_section_t *sect = (TEST_free_section_t *)_sect;
- TEST_iter_ud_t *udata = (TEST_iter_ud_t *)_udata;
- herr_t ret_value = SUCCEED; /* Return value */
+ TEST_free_section_t *sect = (TEST_free_section_t *)_sect;
+ TEST_iter_ud_t * udata = (TEST_iter_ud_t *)_udata;
+ herr_t ret_value = SUCCEED; /* Return value */
HDassert(sect);
HDassert(udata);
@@ -353,7 +341,7 @@ TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata)
udata->tot_size += sect->sect_info.size;
udata->tot_sect_count += 1;
- return(ret_value);
+ return (ret_value);
}
/* supporting routine for shrinking */
@@ -367,7 +355,7 @@ TEST_get_eoa(void)
static void
TEST_set_eoa(haddr_t val)
{
- g_eoa = val;
+ g_eoa = val;
}
/*
@@ -381,8 +369,8 @@ init_cparam(H5FS_create_t *cparam)
/* Set the free space creation parameters */
cparam->shrink_percent = TEST_FSPACE_SHRINK;
cparam->expand_percent = TEST_FSPACE_EXPAND;
- cparam->max_sect_size = TEST_MAX_SECT_SIZE;
- cparam->max_sect_addr = TEST_MAX_INDEX;
+ cparam->max_sect_size = TEST_MAX_SECT_SIZE;
+ cparam->max_sect_addr = TEST_MAX_INDEX;
} /* init_cparam() */
@@ -390,11 +378,12 @@ init_cparam(H5FS_create_t *cparam)
* Initialize free space section node
*/
static void
-init_sect_node(TEST_free_section_t *sect_node, haddr_t addr, hsize_t size, unsigned type, H5FS_section_state_t state)
+init_sect_node(TEST_free_section_t *sect_node, haddr_t addr, hsize_t size, unsigned type,
+ H5FS_section_state_t state)
{
- sect_node->sect_info.addr = addr;
- sect_node->sect_info.size = size;
- sect_node->sect_info.type = type;
+ sect_node->sect_info.addr = addr;
+ sect_node->sect_info.size = size;
+ sect_node->sect_info.type = type;
sect_node->sect_info.state = state;
} /* init_sect_node() */
@@ -404,30 +393,35 @@ init_sect_node(TEST_free_section_t *sect_node, haddr_t addr, hsize_t size, unsig
static int
check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state)
{
- H5FS_stat_t frspace_stats; /* Statistics about the heap */
+ H5FS_stat_t frspace_stats; /* Statistics about the heap */
/* Get statistics for heap and verify they are correct */
- if(H5FS_stat_info(f, frsp, &frspace_stats) < 0)
+ if (H5FS_stat_info(f, frsp, &frspace_stats) < 0)
FAIL_STACK_ERROR
- if(frspace_stats.tot_space != state->tot_space) {
+ if (frspace_stats.tot_space != state->tot_space) {
HDfprintf(stdout, "frspace_stats.tot_space = %" PRIuHSIZE ", state->tot_space = %" PRIuHSIZE "\n",
- frspace_stats.tot_space, state->tot_space);
+ frspace_stats.tot_space, state->tot_space);
TEST_ERROR
} /* end if */
- if(frspace_stats.tot_sect_count != state->tot_sect_count) {
- HDfprintf(stdout, "frspace_stats.tot_sect_count = %" PRIuHSIZE ", state->tot_sect_count = %" PRIuHSIZE "\n",
- frspace_stats.tot_sect_count, state->tot_sect_count);
+ if (frspace_stats.tot_sect_count != state->tot_sect_count) {
+ HDfprintf(stdout,
+ "frspace_stats.tot_sect_count = %" PRIuHSIZE ", state->tot_sect_count = %" PRIuHSIZE "\n",
+ frspace_stats.tot_sect_count, state->tot_sect_count);
TEST_ERROR
} /* end if */
- if(frspace_stats.serial_sect_count != state->serial_sect_count) {
- HDfprintf(stdout, "frspace_stats.serial_sect_count = %" PRIuHSIZE ", state->serial_sect_count = %" PRIuHSIZE "\n",
- frspace_stats.serial_sect_count, state->serial_sect_count);
+ if (frspace_stats.serial_sect_count != state->serial_sect_count) {
+ HDfprintf(stdout,
+ "frspace_stats.serial_sect_count = %" PRIuHSIZE ", state->serial_sect_count = %" PRIuHSIZE
+ "\n",
+ frspace_stats.serial_sect_count, state->serial_sect_count);
TEST_ERROR
} /* end if */
- if(frspace_stats.ghost_sect_count != state->ghost_sect_count) {
- HDfprintf(stdout, "frspace_stats.ghost_sect_count = %" PRIuHSIZE ", state->ghost_sect_count = %" PRIuHSIZE "\n",
- frspace_stats.ghost_sect_count, state->ghost_sect_count);
+ if (frspace_stats.ghost_sect_count != state->ghost_sect_count) {
+ HDfprintf(stdout,
+ "frspace_stats.ghost_sect_count = %" PRIuHSIZE ", state->ghost_sect_count = %" PRIuHSIZE
+ "\n",
+ frspace_stats.ghost_sect_count, state->ghost_sect_count);
TEST_ERROR
} /* end if */
@@ -448,16 +442,16 @@ error:
static unsigned
test_fs_create(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FS_t *frsp = NULL; /* pointer to free space structure */
- haddr_t fs_addr; /* address of free space */
- h5_stat_size_t file_size, empty_size; /* File size */
- frspace_state_t state; /* State of free space*/
- H5FS_create_t cparam, test_cparam; /* creation parameters */
- uint16_t nclasses;
- unsigned init_flags=0;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FS_t * frsp = NULL; /* pointer to free space structure */
+ haddr_t fs_addr; /* address of free space */
+ h5_stat_size_t file_size, empty_size; /* File size */
+ frspace_state_t state; /* State of free space*/
+ H5FS_create_t cparam, test_cparam; /* creation parameters */
+ uint16_t nclasses;
+ unsigned init_flags = 0;
TESTING("the creation/close/reopen/deletion of the free-space manager");
@@ -465,23 +459,23 @@ test_fs_create(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* initialize creation parameters for free-space manager */
@@ -491,60 +485,60 @@ test_fs_create(hid_t fapl)
/* Tag with the global free space tag */
H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
- if(frsp->nclasses != nclasses)
+ if (frsp->nclasses != nclasses)
TEST_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
HDmemset(&test_cparam, 0, sizeof(H5FS_create_t));
- if(H5FS__get_cparam_test(frsp, &test_cparam) < 0)
+ if (H5FS__get_cparam_test(frsp, &test_cparam) < 0)
FAIL_STACK_ERROR
- if(H5FS__cmp_cparam_test(&cparam, &test_cparam))
+ if (H5FS__cmp_cparam_test(&cparam, &test_cparam))
FAIL_STACK_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* reopen the free-space manager */
- if(NULL == (frsp = H5FS_open(f, fs_addr,
- nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_open(f, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF,
+ (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
if (frsp->nclasses != nclasses)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
+ if (H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -552,15 +546,16 @@ test_fs_create(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(frsp)
+ H5E_BEGIN_TRY
+ {
+ if (frsp)
H5FS_close(f, frsp);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_fs_create() */
-
/*
* Test 1:
* Create free-space manager
@@ -588,42 +583,42 @@ error:
static unsigned
test_fs_sect_add(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FS_t *frsp = NULL; /* pointer to free space structure */
- haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- uint16_t nclasses;
- H5FS_create_t cparam; /* creation parameters */
- frspace_state_t state; /* State of free space*/
-
- TEST_free_section_t *sect_node = NULL;
- unsigned init_flags=0;
- h5_stat_size_t file_size=0, tmp_file_size=0, fr_meta_size=0;
- unsigned can_shrink=FALSE;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FS_t * frsp = NULL; /* pointer to free space structure */
+ haddr_t fs_addr = HADDR_UNDEF; /* address of free space */
+ uint16_t nclasses;
+ H5FS_create_t cparam; /* creation parameters */
+ frspace_state_t state; /* State of free space*/
+
+ TEST_free_section_t *sect_node = NULL;
+ unsigned init_flags = 0;
+ h5_stat_size_t file_size = 0, tmp_file_size = 0, fr_meta_size = 0;
+ unsigned can_shrink = FALSE;
TESTING("adding a section via H5FS_sect_add() to free-space: test 1");
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
@@ -632,20 +627,20 @@ test_fs_sect_add(hid_t fapl)
/* Tag with the global free space tag */
H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
- if(NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
@@ -653,25 +648,25 @@ test_fs_sect_add(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
fr_meta_size = H5FS_HEADER_SIZE(f) + H5FS_SINFO_PREFIX_SIZE(f);
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((tmp_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
- if (tmp_file_size <= (file_size+fr_meta_size))
+ if (tmp_file_size <= (file_size + fr_meta_size))
TEST_ERROR
PASSED();
@@ -679,36 +674,36 @@ test_fs_sect_add(hid_t fapl)
TESTING("adding a section via H5FS_sect_add() to free-space with H5FS_CLS_GHOST_OBJ: test 2");
/* Get the size of a file w/empty heap*/
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
init_flags = H5FS_CLS_GHOST_OBJ;
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/* Create free list section node */
- if(NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
- 0, NULL) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node, 0, NULL) < 0)
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
@@ -716,24 +711,24 @@ test_fs_sect_add(hid_t fapl)
state.tot_sect_count += 1;
state.ghost_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
fr_meta_size = H5FS_HEADER_SIZE(f);
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((tmp_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
- if (tmp_file_size != (file_size+fr_meta_size))
+ if (tmp_file_size != (file_size + fr_meta_size))
TEST_ERROR
PASSED();
@@ -741,68 +736,68 @@ test_fs_sect_add(hid_t fapl)
TESTING("adding a section via H5FS_sect_add() to free-space: test 3");
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
- TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
+ TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
init_flags = 0;
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
- if(NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
/*
* Add section A
*/
- init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
- H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
+ FAIL_STACK_ERROR
/* nothing in free-space */
HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
+ if (H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -810,78 +805,78 @@ test_fs_sect_add(hid_t fapl)
TESTING("adding a section via H5FS_sect_add() to free-space: test 4");
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file w/empty heap*/
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
- TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
+ TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
init_flags = 0;
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
- if(NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
/*
* Add section A
*/
- init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
- H5FS_ADD_DESERIALIZING, &can_shrink) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_DESERIALIZING, &can_shrink) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node) < 0)
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
- if(TEST_sect_free((H5FS_section_info_t *)sect_node) < 0)
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node) < 0)
TEST_ERROR
sect_node = NULL;
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
+ if (H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -889,17 +884,18 @@ test_fs_sect_add(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(sect_node)
+ H5E_BEGIN_TRY
+ {
+ if (sect_node)
TEST_sect_free((H5FS_section_info_t *)sect_node);
- if(frsp)
+ if (frsp)
H5FS_close(f, frsp);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_fs_sect_add() */
-
/*
* To verify the finding of a section with the requested-size from free-space
*
@@ -923,19 +919,19 @@ error:
static unsigned
test_fs_sect_find(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FS_t *frsp = NULL; /* pointer to free space structure */
- haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- uint16_t nclasses;
- H5FS_create_t cparam; /* creation parameters */
- frspace_state_t state; /* State of free space*/
-
- TEST_free_section_t *sect_node1 = NULL, *sect_node2, *sect_node3 = NULL, *sect_node4 = NULL;
- TEST_free_section_t *node;
- htri_t node_found = FALSE;
- unsigned init_flags=0;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FS_t * frsp = NULL; /* pointer to free space structure */
+ haddr_t fs_addr = HADDR_UNDEF; /* address of free space */
+ uint16_t nclasses;
+ H5FS_create_t cparam; /* creation parameters */
+ frspace_state_t state; /* State of free space*/
+
+ TEST_free_section_t *sect_node1 = NULL, *sect_node2, *sect_node3 = NULL, *sect_node4 = NULL;
+ TEST_free_section_t *node;
+ htri_t node_found = FALSE;
+ unsigned init_flags = 0;
TESTING("H5FS_sect_find(): free-space is empty");
@@ -943,11 +939,11 @@ test_fs_sect_find(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
@@ -956,29 +952,29 @@ test_fs_sect_find(hid_t fapl)
/* Tag with the global free space tag */
H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node)) < 0)
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
- if (node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
@@ -987,11 +983,11 @@ test_fs_sect_find(hid_t fapl)
TESTING("H5FS_sect_find() a section equal to requested-size from free-space");
/* reopen the free-space manager */
- if(NULL == (frsp = H5FS_open(f, fs_addr, nclasses,
- test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ if (NULL == (frsp = H5FS_open(f, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF,
+ (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
if (frsp->nclasses != nclasses)
TEST_ERROR
@@ -999,13 +995,13 @@ test_fs_sect_find(hid_t fapl)
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
@@ -1013,100 +1009,99 @@ test_fs_sect_find(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
-
/*
* Add section C
*/
- if(NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node3, (haddr_t)(TEST_SECT_ADDR200), (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node3, (haddr_t)(TEST_SECT_ADDR200), (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
state.tot_space += sect_node3->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
state.tot_space += sect_node2->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section D
*/
- if(NULL == (sect_node4 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node4 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR300, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR300, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node4,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node4, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
state.tot_space += sect_node4->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
- if (!node_found) TEST_ERROR
+ if (!node_found)
+ TEST_ERROR
if ((node->sect_info.addr != TEST_SECT_ADDR100) || (node->sect_info.size != TEST_SECT_SIZE50))
TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
TEST_ERROR
/* remove sections A, C and D */
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node3) < 0)
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node3) < 0)
FAIL_STACK_ERROR
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node4) < 0)
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node4) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
- if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
TEST_ERROR
sect_node1 = NULL;
- if(TEST_sect_free((H5FS_section_info_t *)sect_node3) < 0)
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node3) < 0)
TEST_ERROR
sect_node3 = NULL;
- if(TEST_sect_free((H5FS_section_info_t *)sect_node4) < 0)
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node4) < 0)
TEST_ERROR
sect_node4 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
@@ -1115,11 +1110,11 @@ test_fs_sect_find(hid_t fapl)
TESTING("H5FS_sect_find() a section greater than requested-size from free-space");
/* reopen the free-space manager */
- if(NULL == (frsp = H5FS_open(f, fs_addr, nclasses,
- test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ if (NULL == (frsp = H5FS_open(f, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF,
+ (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
if (frsp->nclasses != nclasses)
TEST_ERROR
@@ -1127,13 +1122,13 @@ test_fs_sect_find(hid_t fapl)
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
@@ -1141,30 +1136,29 @@ test_fs_sect_find(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
state.tot_space += sect_node2->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
if (!node_found)
@@ -1172,21 +1166,21 @@ test_fs_sect_find(hid_t fapl)
if ((node->sect_info.addr != TEST_SECT_ADDR200) || (node->sect_info.size < TEST_SECT_SIZE50))
TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
TEST_ERROR
node = NULL;
/* remove sections A */
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
- if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
TEST_ERROR
sect_node1 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
@@ -1195,11 +1189,11 @@ test_fs_sect_find(hid_t fapl)
TESTING("H5FS_sect_find(): cannot find a section with requested-size from free-space");
/* reopen the free-space manager */
- if(NULL == (frsp = H5FS_open(f, fs_addr, nclasses,
- test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_open(f, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF,
+ (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
if (frsp->nclasses != nclasses)
TEST_ERROR
@@ -1207,13 +1201,13 @@ test_fs_sect_find(hid_t fapl)
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
@@ -1221,36 +1215,36 @@ test_fs_sect_find(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
- if (node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
/* remove sections A */
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
- if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
TEST_ERROR
sect_node1 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
+ if (H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1258,21 +1252,22 @@ test_fs_sect_find(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(sect_node1)
+ H5E_BEGIN_TRY
+ {
+ if (sect_node1)
TEST_sect_free((H5FS_section_info_t *)sect_node1);
- if(sect_node3)
+ if (sect_node3)
TEST_sect_free((H5FS_section_info_t *)sect_node3);
- if(sect_node4)
+ if (sect_node4)
TEST_sect_free((H5FS_section_info_t *)sect_node4);
- if(frsp)
- H5FS_close(f, frsp);
+ if (frsp)
+ H5FS_close(f, frsp);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_fs_sect_find() */
-
/*
* To verify that sections are merged when adding sections to free-space
*
@@ -1308,19 +1303,19 @@ error:
static unsigned
test_fs_sect_merge(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FS_t *frsp = NULL; /* pointer to free space structure */
- haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- uint16_t nclasses;
- H5FS_create_t cparam; /* creation parameters */
- frspace_state_t state; /* State of free space*/
-
- TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL, *sect_node3=NULL, *sect_node4=NULL;
- unsigned init_flags=0;
- htri_t node_found = FALSE;
- TEST_free_section_t *node;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FS_t * frsp = NULL; /* pointer to free space structure */
+ haddr_t fs_addr = HADDR_UNDEF; /* address of free space */
+ uint16_t nclasses;
+ H5FS_create_t cparam; /* creation parameters */
+ frspace_state_t state; /* State of free space*/
+
+ TEST_free_section_t *sect_node1 = NULL, *sect_node2 = NULL, *sect_node3 = NULL, *sect_node4 = NULL;
+ unsigned init_flags = 0;
+ htri_t node_found = FALSE;
+ TEST_free_section_t *node;
TESTING("the merge of sections when H5FS_sect_add() to free-space: test 1");
@@ -1331,11 +1326,11 @@ test_fs_sect_merge(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
@@ -1344,113 +1339,114 @@ test_fs_sect_merge(hid_t fapl)
/* Tag with the global free space tag */
H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section C
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_SECT_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/* section B & C are merged */
state.tot_space += TEST_SECT_SIZE30;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/* section A is merged with the merged section of B & C */
state.tot_space += TEST_SECT_SIZE10;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section D
*/
- if(NULL == (sect_node4 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node4 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node4,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node4, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/* section D is merged with the merged section of A & B & C */
state.tot_space += TEST_SECT_SIZE80;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
-
/* should be able to find the merged section of A, B, C & D */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE10+TEST_SECT_SIZE30+TEST_SECT_SIZE50+TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(
+ f, frsp, (hsize_t)(TEST_SECT_SIZE10 + TEST_SECT_SIZE30 + TEST_SECT_SIZE50 + TEST_SECT_SIZE80),
+ (H5FS_section_info_t **)&node)) < 0)
+ FAIL_STACK_ERROR
- if (!node_found) TEST_ERROR
+ if (!node_found)
+ TEST_ERROR
if ((node->sect_info.addr != TEST_SECT_ADDR60) ||
- (node->sect_info.size != (TEST_SECT_SIZE10+TEST_SECT_SIZE30+TEST_SECT_SIZE50+TEST_SECT_SIZE80)))
- TEST_ERROR
+ (node->sect_info.size != (TEST_SECT_SIZE10 + TEST_SECT_SIZE30 + TEST_SECT_SIZE50 + TEST_SECT_SIZE80)))
+ TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1461,98 +1457,99 @@ test_fs_sect_merge(hid_t fapl)
TESTING("the merge of sections when H5FS_sect_add() to free-space: test 2");
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
init_flags = H5FS_CLS_SEPAR_OBJ;
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_SECT_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/* section A & B are not merged because H5FS_CLS_SEPAR_OBJ is set */
state.tot_space += TEST_SECT_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* should not be able to find the merged section of A & B */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE30+TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE30 + TEST_SECT_SIZE50),
+ (H5FS_section_info_t **)&node)) < 0)
+ FAIL_STACK_ERROR
- if (node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
/* remove section A from free-space */
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ FAIL_STACK_ERROR
/* remove section B from free-space */
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node2) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node2) < 0)
+ FAIL_STACK_ERROR
/* Free the section node(s) */
- if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
sect_node1 = NULL;
- if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
+ TEST_ERROR
sect_node2 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1563,93 +1560,93 @@ test_fs_sect_merge(hid_t fapl)
TESTING("the merge of sections when H5FS_sect_add() to free-space: test 3");
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
init_flags = 0; /* reset */
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_SECT_SIZE10;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30,
+ TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/* sections A & B are not merged because H5FS_CLS_MERGE_SYM is set & section class type is different */
state.tot_space += TEST_SECT_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section C
*/
- if(NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE);
+ init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50,
+ TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/* sections B & C are merged because H5FS_CLS_MERGE_SYM is set & section class type is the same */
state.tot_space += TEST_SECT_SIZE50;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section D
*/
- if(NULL == (sect_node4 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node4 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node4,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node4, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/*
* section D is not merged with the merged section of B & C because
@@ -1659,68 +1656,73 @@ test_fs_sect_merge(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* should not be able to find a merged section of A, B, C & D */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE10+TEST_SECT_SIZE30+TEST_SECT_SIZE50+TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(
+ f, frsp, (hsize_t)(TEST_SECT_SIZE10 + TEST_SECT_SIZE30 + TEST_SECT_SIZE50 + TEST_SECT_SIZE80),
+ (H5FS_section_info_t **)&node)) < 0)
+ FAIL_STACK_ERROR
- if (node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
/* should be able to find the merged section of B & C */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE30+TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE30 + TEST_SECT_SIZE50),
+ (H5FS_section_info_t **)&node)) < 0)
+ FAIL_STACK_ERROR
- if (!node_found) TEST_ERROR
+ if (!node_found)
+ TEST_ERROR
if ((node->sect_info.addr != TEST_SECT_ADDR70) ||
- (node->sect_info.size != (TEST_SECT_SIZE30+TEST_SECT_SIZE50)))
- TEST_ERROR
+ (node->sect_info.size != (TEST_SECT_SIZE30 + TEST_SECT_SIZE50)))
+ TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
/* should be able to find section A */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE10), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE10), (H5FS_section_info_t **)&node)) <
+ 0)
+ FAIL_STACK_ERROR
- if (!node_found) TEST_ERROR
+ if (!node_found)
+ TEST_ERROR
if ((node->sect_info.addr != TEST_SECT_ADDR60) || (node->sect_info.size != TEST_SECT_SIZE10))
- TEST_ERROR
+ TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
/* should be able to find section D */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) <
+ 0)
+ FAIL_STACK_ERROR
- if (!node_found) TEST_ERROR
+ if (!node_found)
+ TEST_ERROR
if ((node->sect_info.addr != TEST_SECT_ADDR150) || (node->sect_info.size != TEST_SECT_SIZE80))
- TEST_ERROR
+ TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1728,15 +1730,17 @@ test_fs_sect_merge(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(sect_node1)
+ H5E_BEGIN_TRY
+ {
+ if (sect_node1)
TEST_sect_free((H5FS_section_info_t *)sect_node1);
- if(sect_node2)
+ if (sect_node2)
TEST_sect_free((H5FS_section_info_t *)sect_node2);
- if(frsp)
+ if (frsp)
H5FS_close(f, frsp);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_fs_sect_merge() */
@@ -1777,20 +1781,20 @@ error:
static unsigned
test_fs_sect_shrink(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FS_t *frsp = NULL; /* pointer to free space structure */
- haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- uint16_t nclasses;
- H5FS_create_t cparam; /* creation parameters */
- frspace_state_t state; /* State of free space*/
-
- TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL;
- unsigned init_flags=0;
- unsigned can_shrink=FALSE;
- htri_t node_found = FALSE;
- TEST_free_section_t *node;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FS_t * frsp = NULL; /* pointer to free space structure */
+ haddr_t fs_addr = HADDR_UNDEF; /* address of free space */
+ uint16_t nclasses;
+ H5FS_create_t cparam; /* creation parameters */
+ frspace_state_t state; /* State of free space*/
+
+ TEST_free_section_t *sect_node1 = NULL, *sect_node2 = NULL;
+ unsigned init_flags = 0;
+ unsigned can_shrink = FALSE;
+ htri_t node_found = FALSE;
+ TEST_free_section_t *node;
TESTING("shrinking of sections when H5FS_sect_add() to free-space: test 1");
@@ -1798,202 +1802,203 @@ test_fs_sect_shrink(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
+ TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
/* Tag with the global free space tag */
H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A that allow shrinking but its section class type does not define "can_shrink"
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50,
+ TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE);
can_shrink = FALSE;
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* section A should still be there in free-space */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) <
+ 0)
+ FAIL_STACK_ERROR
- if (!node_found) TEST_ERROR
+ if (!node_found)
+ TEST_ERROR
if ((node->sect_info.addr != TEST_SECT_ADDR100) || (node->sect_info.size != TEST_SECT_SIZE50))
- TEST_ERROR
+ TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
/*
* Re-add section A that allow shrinking and its section class type defines "can_shrink"
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
can_shrink = FALSE;
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
FAIL_STACK_ERROR
/* should have nothing in free-space */
HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* section A should not be there in free-space */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) <
+ 0)
FAIL_STACK_ERROR
- if (node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
+ if (H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
+ if (H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
-
TESTING("shrinking of sections when H5FS_sect_add() to free-space: test 2");
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
+ TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
/* does not allow merging */
init_flags = H5FS_CLS_SEPAR_OBJ;
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
+ FAIL_STACK_ERROR
/* free-space should be the same since section B is shrunk */
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* section B should not be there in free-space */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) <
+ 0)
+ FAIL_STACK_ERROR
if (node_found)
TEST_ERROR
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
-
/* section A should still be there in free-space */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE20), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE20), (H5FS_section_info_t **)&node)) <
+ 0)
+ FAIL_STACK_ERROR
- if (!node_found) TEST_ERROR
+ if (!node_found)
+ TEST_ERROR
if ((node->sect_info.addr != TEST_SECT_ADDR80) || (node->sect_info.size != TEST_SECT_SIZE20))
- TEST_ERROR
+ TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -2001,90 +2006,91 @@ test_fs_sect_shrink(hid_t fapl)
TESTING("shrinking of sections when H5FS_sect_add() to free-space: test 3");
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
+ TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
init_flags = 0; /* reset */
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
+ FAIL_STACK_ERROR
/* section A & B are merged and then strunk, so there is nothing in free-space */
HDmemset(&state, 0, sizeof(frspace_state_t));
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* section B should not be there in free-space */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) <
+ 0)
+ FAIL_STACK_ERROR
if (node_found)
TEST_ERROR
/* section A should not be there in free-space */
- if((node_found = H5FS_sect_find(f, frsp,
- (hsize_t)(TEST_SECT_SIZE30), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ if ((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE30), (H5FS_section_info_t **)&node)) <
+ 0)
+ FAIL_STACK_ERROR
- if (node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -2092,11 +2098,13 @@ test_fs_sect_shrink(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(frsp)
- H5FS_close(f, frsp);
+ H5E_BEGIN_TRY
+ {
+ if (frsp)
+ H5FS_close(f, frsp);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_sect_shrink() */
@@ -2120,18 +2128,18 @@ error:
static unsigned
test_fs_sect_change_class(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FS_t *frsp = NULL; /* pointer to free space structure */
- haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- uint16_t nclasses;
- H5FS_create_t cparam; /* creation parameters */
- frspace_state_t state; /* State of free space*/
-
- TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL, *sect_node3=NULL;
- unsigned init_flags=0;
- TEST_free_section_t *node;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FS_t * frsp = NULL; /* pointer to free space structure */
+ haddr_t fs_addr = HADDR_UNDEF; /* address of free space */
+ uint16_t nclasses;
+ H5FS_create_t cparam; /* creation parameters */
+ frspace_state_t state; /* State of free space*/
+
+ TEST_free_section_t *sect_node1 = NULL, *sect_node2 = NULL, *sect_node3 = NULL;
+ unsigned init_flags = 0;
+ TEST_free_section_t *node;
TESTING("the change of section class via H5FS_sect_change_class() in free-space: Test 1");
@@ -2139,11 +2147,11 @@ test_fs_sect_change_class(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
@@ -2153,91 +2161,89 @@ test_fs_sect_change_class(hid_t fapl)
H5AC_tag(H5AC__FREESPACE_TAG, NULL);
init_flags = H5FS_CLS_GHOST_OBJ;
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += TEST_SECT_SIZE30;
state.tot_sect_count += 1;
state.ghost_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50,
+ TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
state.tot_space += TEST_SECT_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
- if (H5FS_sect_change_class(f, frsp, (H5FS_section_info_t *)sect_node1,
- TEST_FSPACE_SECT_TYPE_NONE) < 0)
+ if (H5FS_sect_change_class(f, frsp, (H5FS_section_info_t *)sect_node1, TEST_FSPACE_SECT_TYPE_NONE) < 0)
TEST_ERROR
state.serial_sect_count += 1;
- state.ghost_sect_count -=1;
- if(check_stats(f, frsp, &state))
+ state.ghost_sect_count -= 1;
+ if (check_stats(f, frsp, &state))
TEST_ERROR
- if(H5FS_sect_find(f, frsp,
- (hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_find(f, frsp, (hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node) < 0)
+ FAIL_STACK_ERROR
if (node->sect_info.type != TEST_FSPACE_SECT_TYPE_NONE)
- TEST_ERROR
+ TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node2) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node2) < 0)
+ FAIL_STACK_ERROR
/* Free the section node(s) */
- if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
+ TEST_ERROR
sect_node2 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -2248,118 +2254,114 @@ test_fs_sect_change_class(hid_t fapl)
TESTING("the merge of sections when H5FS_sect_add() to free-space: test 2");
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
init_flags = H5FS_CLS_SEPAR_OBJ;
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50,
+ TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/*
* Add section C
*/
- if(NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80,
+ TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
/* change the class of B to A's class */
- if (H5FS_sect_change_class(f, frsp, (H5FS_section_info_t *)sect_node2,
- TEST_FSPACE_SECT_TYPE) < 0)
- TEST_ERROR
+ if (H5FS_sect_change_class(f, frsp, (H5FS_section_info_t *)sect_node2, TEST_FSPACE_SECT_TYPE) < 0)
+ TEST_ERROR
/* change the class of C to A's class */
- if (H5FS_sect_change_class(f, frsp, (H5FS_section_info_t *)sect_node3,
- TEST_FSPACE_SECT_TYPE) < 0)
- TEST_ERROR
+ if (H5FS_sect_change_class(f, frsp, (H5FS_section_info_t *)sect_node3, TEST_FSPACE_SECT_TYPE) < 0)
+ TEST_ERROR
/* the merge_list should be empty */
if (frsp->sinfo->merge_list)
- if (H5SL_count(frsp->sinfo->merge_list))
- TEST_ERROR
+ if (H5SL_count(frsp->sinfo->merge_list))
+ TEST_ERROR
/* verify that section B has changed class */
- if(H5FS_sect_find(f, frsp,
- (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_find(f, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node) < 0)
+ FAIL_STACK_ERROR
if (node->sect_info.type != TEST_FSPACE_SECT_TYPE)
- TEST_ERROR
+ TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
/* verify that section C has changed class */
- if(H5FS_sect_find(f, frsp,
- (hsize_t)TEST_SECT_SIZE80, (H5FS_section_info_t **)&node) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_find(f, frsp, (hsize_t)TEST_SECT_SIZE80, (H5FS_section_info_t **)&node) < 0)
+ FAIL_STACK_ERROR
if (node->sect_info.type != TEST_FSPACE_SECT_TYPE)
- TEST_ERROR
+ TEST_ERROR
- if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)node) < 0)
+ TEST_ERROR
/* remove section A from free-space */
- if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ FAIL_STACK_ERROR
/* Free the section node(s) */
- if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
- TEST_ERROR
+ if (TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
sect_node1 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -2367,19 +2369,20 @@ test_fs_sect_change_class(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(sect_node1)
+ H5E_BEGIN_TRY
+ {
+ if (sect_node1)
TEST_sect_free((H5FS_section_info_t *)sect_node1);
- if(sect_node2)
+ if (sect_node2)
TEST_sect_free((H5FS_section_info_t *)sect_node2);
- if(frsp)
+ if (frsp)
H5FS_close(f, frsp);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_sect_change_class() */
-
/*
* To verify the extension of a block using space from a section in free-space
*
@@ -2413,28 +2416,28 @@ error:
static unsigned
test_fs_sect_extend(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FS_t *frsp = NULL; /* pointer to free space structure */
- haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- uint16_t nclasses;
- H5FS_create_t cparam; /* creation parameters */
- frspace_state_t state; /* State of free space*/
- TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL;
- unsigned init_flags=0;
- htri_t status; /* Status of 'try' calls */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FS_t * frsp = NULL; /* pointer to free space structure */
+ haddr_t fs_addr = HADDR_UNDEF; /* address of free space */
+ uint16_t nclasses;
+ H5FS_create_t cparam; /* creation parameters */
+ frspace_state_t state; /* State of free space*/
+ TEST_free_section_t *sect_node1 = NULL, *sect_node2 = NULL;
+ unsigned init_flags = 0;
+ htri_t status; /* Status of 'try' calls */
TESTING("a block's extension by requested-size which is = adjoining free section's size: Test 1");
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Tag with the global free space tag */
@@ -2446,73 +2449,74 @@ test_fs_sect_extend(hid_t fapl)
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
state.tot_space += sect_node2->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Extend a block by requested-size */
- if((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
- FAIL_STACK_ERROR
- if(FALSE == status)
+ if ((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20,
+ (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
+ FAIL_STACK_ERROR
+ if (FALSE == status)
TEST_ERROR
/* Succeed in extending the block: free space info is decremented accordingly */
state.tot_space -= (hsize_t)TEST_SECT_SIZE40;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
PASSED();
@@ -2522,70 +2526,71 @@ test_fs_sect_extend(hid_t fapl)
*/
TESTING("a block's extension by requested-size which is > adjoining free section's size: Test 2");
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
state.tot_space += sect_node2->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Extend the block by requested-size */
- if((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE50, 0, NULL)) < 0)
- FAIL_STACK_ERROR
- if(TRUE == status)
+ if ((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20,
+ (hsize_t)TEST_SECT_SIZE50, 0, NULL)) < 0)
+ FAIL_STACK_ERROR
+ if (TRUE == status)
TEST_ERROR
/* Not able to extend the block: free space info remains the same */
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
PASSED();
@@ -2595,71 +2600,72 @@ test_fs_sect_extend(hid_t fapl)
*/
TESTING("a block's extension by requested-size which is < adjoining free section's size: Test 3");
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
state.tot_space += sect_node2->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Extend the block by requested-size */
- if((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE30, 0, NULL)) < 0)
- TEST_ERROR
- if(FALSE == status)
+ if ((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20,
+ (hsize_t)TEST_SECT_SIZE30, 0, NULL)) < 0)
+ TEST_ERROR
+ if (FALSE == status)
TEST_ERROR
/* Succeed in extending the block: total free space is decreased but other info remains the same */
state.tot_space -= 30;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
PASSED();
@@ -2669,90 +2675,92 @@ test_fs_sect_extend(hid_t fapl)
*/
TESTING("a block's extension by requested-size which does not adjoin any free section: Test 4");
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
/*
* Add section A
*/
- if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/*
* Add section B
*/
- if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE,
+ H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
state.tot_space += sect_node2->sect_info.size;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Extend the block by requested-size */
- if((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15, (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
- TEST_ERROR
- if(TRUE == status)
+ if ((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15,
+ (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
+ TEST_ERROR
+ if (TRUE == status)
TEST_ERROR
/* Not able to extend the block: free space manager info remains the same */
- if(check_stats(f, frsp, &state))
+ if (check_stats(f, frsp, &state))
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
PASSED();
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
- if(frsp)
+ H5E_BEGIN_TRY
+ {
+ if (frsp)
H5FS_close(f, frsp);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_sect_extend() */
-
/*
* To verify the iteration of free-space sections
*
@@ -2764,19 +2772,19 @@ error:
static unsigned
test_fs_sect_iterate(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FS_t *frsp = NULL; /* pointer to free space structure */
- haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- uint16_t nclasses;
- H5FS_create_t cparam; /* creation parameters */
-
- TEST_free_section_t *sect_node=NULL;
- unsigned init_flags=0, sect_size;
- TEST_iter_ud_t udata;
- int i;
- hsize_t tot_space, nsects;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FS_t * frsp = NULL; /* pointer to free space structure */
+ haddr_t fs_addr = HADDR_UNDEF; /* address of free space */
+ uint16_t nclasses;
+ H5FS_create_t cparam; /* creation parameters */
+
+ TEST_free_section_t *sect_node = NULL;
+ unsigned init_flags = 0, sect_size;
+ TEST_iter_ud_t udata;
+ int i;
+ hsize_t tot_space, nsects;
TESTING("iteration of sections in the free-space manager");
@@ -2784,63 +2792,62 @@ test_fs_sect_iterate(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
init_cparam(&cparam);
- nclasses = NELMTS(test_classes);
- udata.tot_size = 0;
+ nclasses = NELMTS(test_classes);
+ udata.tot_size = 0;
udata.tot_sect_count = 0;
/* Tag with the global free space tag */
H5AC_tag(H5AC__FREESPACE_TAG, NULL);
init_flags = H5FS_CLS_SEPAR_OBJ;
- if(NULL == (frsp = H5FS_create(f, &fs_addr,
- &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ if (NULL == (frsp = H5FS_create(f, &fs_addr, &cparam, nclasses, test_classes, &init_flags,
+ (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
+ FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_addr))
+ if (!H5F_addr_defined(fs_addr))
TEST_ERROR
for (i = 1; i <= NUM_SECTIONS; i++) {
- if(NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ if (NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
+ FAIL_STACK_ERROR
- sect_size = (unsigned)((i-1) % 9) + 1;
- init_sect_node(sect_node, (haddr_t)i*10, (hsize_t)sect_size, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
+ sect_size = (unsigned)((i - 1) % 9) + 1;
+ init_sect_node(sect_node, (haddr_t)i * 10, (hsize_t)sect_size, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
- H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, NULL) < 0)
+ FAIL_STACK_ERROR
} /* end for */
- if(H5FS_sect_iterate(f, frsp, TEST_sects_cb, &udata) < 0)
- TEST_ERROR
+ if (H5FS_sect_iterate(f, frsp, TEST_sects_cb, &udata) < 0)
+ TEST_ERROR
H5FS_sect_stats(frsp, &tot_space, &nsects);
if (udata.tot_size != tot_space)
- TEST_ERROR
+ TEST_ERROR
if (udata.tot_sect_count != nsects)
- TEST_ERROR
+ TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, frsp) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_close(f, frsp) < 0)
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, fs_addr) < 0)
- FAIL_STACK_ERROR
+ if (H5FS_delete(f, fs_addr) < 0)
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -2848,35 +2855,37 @@ test_fs_sect_iterate(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- if(frsp)
+ H5E_BEGIN_TRY
+ {
+ if (frsp)
H5FS_close(f, frsp);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_fs_sect_iterate() */
-
int
main(void)
{
- hid_t fapl = -1; /* File access property list for data files */
- unsigned nerrors = 0; /* Cumulative error count */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t fapl = -1; /* File access property list for data files */
+ unsigned nerrors = 0; /* Cumulative error count */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
h5_reset();
- if((fapl = h5_fileaccess()) < 0) {
+ if ((fapl = h5_fileaccess()) < 0) {
nerrors++;
PUTS_ERROR("Can't get VFD-dependent fapl")
} /* end if */
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* make sure alignment is not set for tests to succeed */
- if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0) {
+ if (H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0) {
nerrors++;
PUTS_ERROR("Can't set alignment")
} /* end if */
@@ -2893,12 +2902,13 @@ main(void)
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All free-space tests passed.");
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
h5_cleanup(FILENAME, fapl);
@@ -2906,12 +2916,11 @@ main(void)
error:
HDputs("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(fapl); }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
HDexit(EXIT_FAILURE);
} /* main() */
-
diff --git a/test/gen_bad_compound.c b/test/gen_bad_compound.c
index bd857b4..ec0933f 100644
--- a/test/gen_bad_compound.c
+++ b/test/gen_bad_compound.c
@@ -26,16 +26,17 @@
#define FILENAME "bad_compound.h5"
-int main()
+int
+main()
{
- hid_t file;
- hid_t cmpd_dt;
- hid_t sid;
- hid_t did;
- hid_t aid;
- hid_t gid;
- hsize_t dim = 1;
- herr_t ret;
+ hid_t file;
+ hid_t cmpd_dt;
+ hid_t sid;
+ hid_t did;
+ hid_t aid;
+ hid_t gid;
+ hsize_t dim = 1;
+ herr_t ret;
/* Create compound datatype, but don't insert fields */
cmpd_dt = H5Tcreate(H5T_COMPOUND, (size_t)8);
@@ -79,6 +80,5 @@ int main()
ret = H5Fclose(file);
assert(ret >= 0);
- return(0);
+ return (0);
}
-
diff --git a/test/gen_bad_offset.c b/test/gen_bad_offset.c
index b485e36..e9b37b8 100644
--- a/test/gen_bad_offset.c
+++ b/test/gen_bad_offset.c
@@ -16,15 +16,13 @@
*/
#include "h5test.h"
-#define TESTFILE "bad_offset.h5"
-#define GRP1 "group1"
-#define GRP2 "group2"
-#define DSET "dsetA"
-#define SOFT1 "soft_one"
-#define SOFT2 "soft_two"
+#define TESTFILE "bad_offset.h5"
+#define GRP1 "group1"
+#define GRP2 "group2"
+#define DSET "dsetA"
+#define SOFT1 "soft_one"
+#define SOFT2 "soft_two"
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -53,49 +51,49 @@
int
main(void)
{
- hid_t fid = -1, gid1 = -1, gid2 = -1; /* File and group IDs */
- hid_t did = -1, sid = -1; /* Dataset and dataspace IDs */
- int fd = -1; /* File descriptor */
- int64_t val = 999; /* Bad offset value */
+ hid_t fid = -1, gid1 = -1, gid2 = -1; /* File and group IDs */
+ hid_t did = -1, sid = -1; /* Dataset and dataspace IDs */
+ int fd = -1; /* File descriptor */
+ int64_t val = 999; /* Bad offset value */
/* Create the test file */
- if((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create two groups */
- if((gid1 = H5Gcreate2(fid, GRP1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(fid, GRP1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((gid2 = H5Gcreate2(gid1, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(gid1, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close the groups */
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
FAIL_STACK_ERROR
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
FAIL_STACK_ERROR
/* Create soft links to the groups */
- if(H5Lcreate_soft("/group1", fid, SOFT1, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("/group1", fid, SOFT1, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
- if(H5Lcreate_soft("/group1/group2", fid, SOFT2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("/group1/group2", fid, SOFT2, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Create a dataset */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
FAIL_STACK_ERROR
- if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Close the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -103,45 +101,46 @@ main(void)
*/
/* Open the file */
- if((fd = HDopen(TESTFILE, O_RDWR, 0663)) < 0)
+ if ((fd = HDopen(TESTFILE, O_RDWR, 0663)) < 0)
FAIL_STACK_ERROR
/* Position the file for /group1/group2: replace heap offset "8" by bad offset */
- if(HDlseek(fd, (HDoff_t)880, SEEK_SET) < 0)
+ if (HDlseek(fd, (HDoff_t)880, SEEK_SET) < 0)
FAIL_STACK_ERROR
/* Write the bad offset value to the file */
- if(HDwrite(fd, &val, sizeof(val)) < 0)
+ if (HDwrite(fd, &val, sizeof(val)) < 0)
FAIL_STACK_ERROR
/* Position the file for /dsetA: replace name offset into private heap "72" by bad offset */
- if(HDlseek(fd, (HDoff_t)1512, SEEK_SET) < 0)
+ if (HDlseek(fd, (HDoff_t)1512, SEEK_SET) < 0)
FAIL_STACK_ERROR
/* Write the bad offset value to the file */
- if(HDwrite(fd, &val, sizeof(val)) < 0)
+ if (HDwrite(fd, &val, sizeof(val)) < 0)
FAIL_STACK_ERROR
/* Position the file for /soft_one: replace link value offset in the scratch pad "32" by bad offset */
- if(HDlseek(fd, (HDoff_t)1616, SEEK_SET) < 0)
+ if (HDlseek(fd, (HDoff_t)1616, SEEK_SET) < 0)
FAIL_STACK_ERROR
/* Write the bad offset value to the file */
- if(HDwrite(fd, &val, sizeof(val)) < 0)
+ if (HDwrite(fd, &val, sizeof(val)) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(HDclose(fd) < 0)
+ if (HDclose(fd) < 0)
FAIL_STACK_ERROR
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid1);
H5Gclose(gid2);
H5Dclose(did);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/gen_bad_ohdr.c b/test/gen_bad_ohdr.c
index 0f85cfe..ca635a1 100644
--- a/test/gen_bad_ohdr.c
+++ b/test/gen_bad_ohdr.c
@@ -27,7 +27,7 @@
#include "H5Oprivate.h"
#ifdef H5O_ENABLE_BAD_MESG_COUNT
-#define FILENAME "tbad_msg_count.h5"
+#define FILENAME "tbad_msg_count.h5"
#define GROUPNAME "Group"
#define ATTRNAME1 "Attribute #1"
#define ATTRNAME2 "Attribute #2"
@@ -40,64 +40,80 @@
#define FALSE 0
#endif /* FALSE */
-int main(void)
+int
+main(void)
{
#ifdef H5O_ENABLE_BAD_MESG_COUNT
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t gcpl = -1; /* Group creation property list ID */
- hbool_t store_bad_mesg_count; /* Flag for storing a bad message count */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t gcpl = -1; /* Group creation property list ID */
+ hbool_t store_bad_mesg_count; /* Flag for storing a bad message count */
/* Create test file */
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* Create group creation property list */
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto error;
+ if ((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ goto error;
/* Add property for storing bad message count */
store_bad_mesg_count = TRUE;
- if(H5Pinsert2(gcpl, H5O_BAD_MESG_COUNT_NAME, H5O_BAD_MESG_COUNT_SIZE, &store_bad_mesg_count, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error;
+ if (H5Pinsert2(gcpl, H5O_BAD_MESG_COUNT_NAME, H5O_BAD_MESG_COUNT_SIZE, &store_bad_mesg_count, NULL, NULL,
+ NULL, NULL, NULL, NULL) < 0)
+ goto error;
/* Create group with bad object header message count */
- if((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) goto error;
+ if ((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0)
+ goto error;
/* Close group creation property list */
- if(H5Pclose(gcpl) < 0) goto error;
+ if (H5Pclose(gcpl) < 0)
+ goto error;
/* Create dataspace for attributes */
- if((sid = H5Screate(H5S_SCALAR)) < 0) goto error;
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ goto error;
/* Create attribute on root group */
- if((aid = H5Acreate2(gid, ATTRNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Aclose(aid) < 0) goto error;
+ if ((aid = H5Acreate2(gid, ATTRNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Aclose(aid) < 0)
+ goto error;
/* Create another attribute on root group */
- if((aid = H5Acreate2(gid, ATTRNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Aclose(aid) < 0) goto error;
+ if ((aid = H5Acreate2(gid, ATTRNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Aclose(aid) < 0)
+ goto error;
/* Close dataspace */
- if(H5Sclose(sid) < 0) goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
/* Close group */
- if(H5Gclose(gid) < 0) goto error;
+ if (H5Gclose(gid) < 0)
+ goto error;
/* Close file */
- if(H5Fclose(fid) < 0) goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(aid);
H5Sclose(sid);
H5Pclose(gcpl);
H5Fclose(fid);
- } H5E_END_TRY;
-#else /* H5O_ENABLE_BAD_MESG_COUNT */
+ }
+ H5E_END_TRY;
+#else /* H5O_ENABLE_BAD_MESG_COUNT */
HDputs("H5O_BAD_MESG_COUNT compiler macro not defined!");
#endif /* H5O_ENABLE_BAD_MESG_COUNT */
return 1;
}
-
diff --git a/test/gen_bogus.c b/test/gen_bogus.c
index ab2620f..b21adeb 100644
--- a/test/gen_bogus.c
+++ b/test/gen_bogus.c
@@ -44,114 +44,143 @@
static int
generate_datasets(hid_t loc_id, unsigned bogus_id)
{
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t did = -1; /* Dataset ID */
- uint8_t bogus_flags = 0; /* Flags for bogus message */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t did = -1; /* Dataset ID */
+ uint8_t bogus_flags = 0; /* Flags for bogus message */
/* Create dataspace for datasets */
- if((sid = H5Screate(H5S_SCALAR)) < 0) goto error;
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ goto error;
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
/* Add property for bogus message flags */
- if(H5Pinsert2(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, H5O_BOGUS_MSG_FLAGS_SIZE, &bogus_flags, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error;
+ if (H5Pinsert2(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, H5O_BOGUS_MSG_FLAGS_SIZE, &bogus_flags, NULL, NULL, NULL,
+ NULL, NULL, NULL) < 0)
+ goto error;
/* Add property for bogus message ID */
- if(H5Pinsert2(dcpl, H5O_BOGUS_MSG_ID_NAME, H5O_BOGUS_MSG_ID_SIZE, &bogus_id, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error;
+ if (H5Pinsert2(dcpl, H5O_BOGUS_MSG_ID_NAME, H5O_BOGUS_MSG_ID_SIZE, &bogus_id, NULL, NULL, NULL, NULL,
+ NULL, NULL) < 0)
+ goto error;
/* Create dataset with "bogus" message, but no message flags */
- if((did = H5Dcreate2(loc_id, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
- if(H5Dclose(did) < 0) goto error;
+ if ((did = H5Dcreate2(loc_id, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
/* Set "fail if unknown and open for write" message flag for bogus message */
bogus_flags = H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE;
- if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error;
+ if (H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
+ goto error;
/* Create second dataset, with "fail if unknown" message flag */
- if((did = H5Dcreate2(loc_id, "Dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
- if(H5Dclose(did) < 0) goto error;
+ if ((did = H5Dcreate2(loc_id, "Dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
/* Set "fail if unknown always" message flag for bogus message */
bogus_flags = H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS;
- if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error;
+ if (H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
+ goto error;
/* Create third dataset, with "fail if unknown always" message flag */
- if((did = H5Dcreate2(loc_id, "Dataset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
- if(H5Dclose(did) < 0) goto error;
+ if ((did = H5Dcreate2(loc_id, "Dataset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
/* Set "mark if unknown" message flag for bogus message */
bogus_flags = H5O_MSG_FLAG_MARK_IF_UNKNOWN;
- if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error;
+ if (H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
+ goto error;
/* Create fourth dataset, with "mark if unknown" message flag */
- if((did = H5Dcreate2(loc_id, "Dataset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
- if(H5Dclose(did) < 0) goto error;
+ if ((did = H5Dcreate2(loc_id, "Dataset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
/* Set "shareable" message flag for bogus message */
bogus_flags = H5O_MSG_FLAG_SHAREABLE;
- if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error;
+ if (H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
+ goto error;
/* Create fourth dataset, with "shareable" message flag */
- if((did = H5Dcreate2(loc_id, "Dataset5", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
- if(H5Dclose(did) < 0) goto error;
+ if ((did = H5Dcreate2(loc_id, "Dataset5", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
/* Close dataset creation property list */
- if(H5Pclose(dcpl) < 0) goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
/* Close dataspace */
- if(H5Sclose(sid) < 0) goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
H5Pclose(dcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* generate_datasets() */
#endif
-int main(void)
+int
+main(void)
{
#ifdef H5O_ENABLE_BOGUS
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
/* Create file for test datasets */
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* Create datasets in "/" group with bogus message H5O_BOGUS_VALID_ID */
- if(generate_datasets(fid, H5O_BOGUS_VALID_ID) < 0)
+ if (generate_datasets(fid, H5O_BOGUS_VALID_ID) < 0)
goto error;
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create datasets in "/group" with bogus message H5O_BOGUS_INVALID_ID */
- if(generate_datasets(gid, H5O_BOGUS_INVALID_ID) < 0)
+ if (generate_datasets(gid, H5O_BOGUS_INVALID_ID) < 0)
goto error;
/* Close the group */
- if(H5Gclose(gid) < 0) goto error;
+ if (H5Gclose(gid) < 0)
+ goto error;
/* Close file */
- if(H5Fclose(fid) < 0) goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
-#else /* H5O_ENABLE_BOGUS */
+ }
+ H5E_END_TRY;
+#else /* H5O_ENABLE_BOGUS */
HDputs("H5O_ENABLE_BOGUS compiler macro not defined!");
#endif /* H5O_ENABLE_BOGUS */
return 1;
}
-
diff --git a/test/gen_bounds.c b/test/gen_bounds.c
index 2f696e6..d7e9b8c 100644
--- a/test/gen_bounds.c
+++ b/test/gen_bounds.c
@@ -51,36 +51,35 @@
* Defines for gen_ref_files()
*/
/* File names used for references */
-#define FILENAME_REF_E_L "bounds_ref_earliest_latest.h5"
-#define FILENAME_REF_L_L "bounds_ref_latest_latest.h5"
-#define FILENAME_REF_V112_V112 "bounds_ref_v112_v112.h5"
-#define FILENAME_REF_V110_V110 "bounds_ref_v110_v110.h5"
-#define FILENAME_REF_V18_V18 "bounds_ref_v18_v18.h5"
+#define FILENAME_REF_E_L "bounds_ref_earliest_latest.h5"
+#define FILENAME_REF_L_L "bounds_ref_latest_latest.h5"
+#define FILENAME_REF_V112_V112 "bounds_ref_v112_v112.h5"
+#define FILENAME_REF_V110_V110 "bounds_ref_v110_v110.h5"
+#define FILENAME_REF_V18_V18 "bounds_ref_v18_v18.h5"
/* Dataset names for references */
-#define REVISED_REFS_DSET "Revised_refs_dset"
-#define OLD_REF_OBJ_DSET "Old_ref_object_dset"
-#define OLD_REF_REG_DSET "Old_ref_region_dset"
+#define REVISED_REFS_DSET "Revised_refs_dset"
+#define OLD_REF_OBJ_DSET "Old_ref_object_dset"
+#define OLD_REF_REG_DSET "Old_ref_region_dset"
-#define GROUP "Group"
-#define ATTR "Attr"
-#define DATASET "Dataset"
-#define POWER32 4294967296 /* 2^32 */
+#define GROUP "Group"
+#define ATTR "Attr"
+#define DATASET "Dataset"
+#define POWER32 4294967296 /* 2^32 */
/*
* Defines for gen_sel_files()
*/
/* File names for hyperslab/point selections */
-#define FILENAME_SEL_E_L "bounds_sel_earliest_latest.h5"
-#define FILENAME_SEL_L_L "bounds_sel_latest_latest.h5"
-#define FILENAME_SEL_V112_V112 "bounds_sel_v112_v112.h5"
-#define FILENAME_SEL_V110_V110 "bounds_sel_v110_v110.h5"
+#define FILENAME_SEL_E_L "bounds_sel_earliest_latest.h5"
+#define FILENAME_SEL_L_L "bounds_sel_latest_latest.h5"
+#define FILENAME_SEL_V112_V112 "bounds_sel_v112_v112.h5"
+#define FILENAME_SEL_V110_V110 "bounds_sel_v110_v110.h5"
/* Dataset names for hyperslab/point selections */
-#define SEL_EX_REG_DSET "Sel_ex32_reg_dset"
-#define SEL_EX_IRR_DSET "Sel_ex32_irr_dset"
-#define SEL_EX_PT_DSET "Sel_ex32_pt_dset"
-
+#define SEL_EX_REG_DSET "Sel_ex32_reg_dset"
+#define SEL_EX_IRR_DSET "Sel_ex32_irr_dset"
+#define SEL_EX_PT_DSET "Sel_ex32_pt_dset"
/***********************************************************************
* gen_earliest_latest() creates file "bounds_earliest_latest.h5"
@@ -108,45 +107,51 @@
#define CHK_DIM1 50
#define CHK_DIM2 50
-static herr_t gen_earliest_latest(void)
+static herr_t
+gen_earliest_latest(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t space = -1; /* Dataspace ID */
- hid_t dset = -1; /* Dataset ID */
- float *buf = NULL; /* Buffer for writing data */
- float *bufp = NULL; /* Pointer to data buffer */
- hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float * buf = NULL; /* Buffer for writing data */
+ float * bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
int i, j;
herr_t ret = SUCCEED; /* Generic return value */
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR;
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
/* Set the "use the earliest/latest version of the format" bounds
for creating objects in the file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
/* Create file */
- if((fid = H5Fcreate(FILENAME_E_L, H5F_ACC_TRUNC, fcpl, fapl)) <0)
+ if ((fid = H5Fcreate(FILENAME_E_L, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
TEST_ERROR;
/* Close file property lists */
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Pclose(fcpl) < 0) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR;
/*
* Add a chunked dataset with layout version 3 (default)
*/
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
- if (buf == NULL) TEST_ERROR;
+ if (buf == NULL)
+ TEST_ERROR;
/* Fill sample data */
bufp = buf;
@@ -155,59 +160,75 @@ static herr_t gen_earliest_latest(void)
*bufp = 100.0F;
/* Create the dataspace */
- if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create the dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set up for chunked data */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR;
/* Create and write the dataset */
dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if (dset < 0) TEST_ERROR;
+ if (dset < 0)
+ TEST_ERROR;
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (ret < 0) TEST_ERROR;
+ if (ret < 0)
+ TEST_ERROR;
/* Close property list and dataset, will reuse dataspace */
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Dclose(dset) < 0) TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
/*
* Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
*/
/* Create the dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set up for chunked data */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR;
/* Disable partial chunk filters, triggers layout version 4 */
- if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ if (H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
TEST_ERROR;
/* Create and write the dataset */
dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if (dset < 0) TEST_ERROR;
+ if (dset < 0)
+ TEST_ERROR;
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (ret < 0) TEST_ERROR;
+ if (ret < 0)
+ TEST_ERROR;
/* Release allocated buffer */
HDfree(buf);
bufp = buf = NULL;
/* Close everything */
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Dclose(dset) < 0) TEST_ERROR;
- if(H5Sclose(space) < 0) TEST_ERROR;
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(space);
H5Pclose(dcpl);
@@ -215,7 +236,8 @@ error:
H5Pclose(fapl);
H5Fclose(fid);
HDfree(buf);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* gen_earliest_latest */
@@ -229,46 +251,52 @@ error:
* Return: SUCCEED/FAIL
*
***********************************************************************/
-static herr_t gen_earliest_v18(void)
+static herr_t
+gen_earliest_v18(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t space = -1; /* Dataspace ID */
- hid_t dset = -1; /* Dataset ID */
- float *buf = NULL; /* Buffer for writing data */
- float *bufp = NULL; /* Pointer to data buffer */
- hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float * buf = NULL; /* Buffer for writing data */
+ float * bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
int i, j;
herr_t ret = SUCCEED; /* Generic return value */
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR;
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
/* Set the "use the earliest/v18 version of the format" bounds
for creating objects in the file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) < 0)
TEST_ERROR;
/* Create file */
- if((fid = H5Fcreate(FILENAME_E_18, H5F_ACC_TRUNC, fcpl, fapl)) <0)
+ if ((fid = H5Fcreate(FILENAME_E_18, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
TEST_ERROR;
/* Close file property lists */
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Pclose(fcpl) < 0) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR;
/*
* Add a chunked dataset with layout version 3 (default)
*/
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
- if (buf == NULL) TEST_ERROR;
+ if (buf == NULL)
+ TEST_ERROR;
/* Fill sample data */
bufp = buf;
@@ -277,35 +305,45 @@ static herr_t gen_earliest_v18(void)
*bufp = 100.0F;
/* Create the dataspace */
- if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create the dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set up for chunked data */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR;
/* Create and write the dataset */
dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if (dset < 0) TEST_ERROR;
+ if (dset < 0)
+ TEST_ERROR;
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (ret < 0) TEST_ERROR;
+ if (ret < 0)
+ TEST_ERROR;
/* Release allocated buffer */
HDfree(buf);
bufp = buf = NULL;
/* Close everything */
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Dclose(dset) < 0) TEST_ERROR;
- if(H5Sclose(space) < 0) TEST_ERROR;
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(space);
H5Pclose(dcpl);
@@ -313,7 +351,8 @@ error:
H5Pclose(fapl);
H5Fclose(fid);
HDfree(buf);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* gen_earliest_v18 */
@@ -331,38 +370,42 @@ error:
* Return: SUCCEED/FAIL
*
***********************************************************************/
-static herr_t gen_latest_latest(void)
+static herr_t
+gen_latest_latest(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t space = -1; /* Dataspace ID */
- hid_t dset = -1; /* Dataset ID */
- float *buf = NULL; /* Buffer for writing data */
- float *bufp = NULL; /* Pointer to data buffer */
- hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float * buf = NULL; /* Buffer for writing data */
+ float * bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
int i, j;
herr_t ret = SUCCEED; /* Generic return value */
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
/* Set the "use the latest/latest version of the format" bounds
for creating objects in the file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
/* Create the file with version 3 superblock */
fid = H5Fcreate(FILENAME_L_L, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if (fid < 0) TEST_ERROR;
+ if (fid < 0)
+ TEST_ERROR;
/*
* Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
*/
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
- if (buf == NULL) TEST_ERROR;
+ if (buf == NULL)
+ TEST_ERROR;
/* Fill sample data */
bufp = buf;
@@ -371,44 +414,55 @@ static herr_t gen_latest_latest(void)
*bufp = 100.0F;
/* Create the dataspace */
- if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create the dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set up for chunked data */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR;
/* Disable partial chunk filters, triggers layout version 4 */
- if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ if (H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
TEST_ERROR;
/* Create and write the dataset */
dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if (dset < 0) TEST_ERROR;
+ if (dset < 0)
+ TEST_ERROR;
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (ret < 0) TEST_ERROR;
+ if (ret < 0)
+ TEST_ERROR;
/* Release allocated buffer */
HDfree(buf);
bufp = buf = NULL;
/* Close everything */
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Dclose(dset) < 0) TEST_ERROR;
- if(H5Sclose(space) < 0) TEST_ERROR;
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(space);
H5Pclose(dcpl);
H5Fclose(fid);
HDfree(buf);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* gen_latest_latest */
@@ -424,46 +478,52 @@ error:
* Return: SUCCEED/FAIL
*
***********************************************************************/
-static herr_t gen_v18_latest(void)
+static herr_t
+gen_v18_latest(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t space = -1; /* Dataspace ID */
- hid_t dset = -1; /* Dataset ID */
- float *buf = NULL; /* Buffer for writing data */
- float *bufp = NULL; /* Pointer to data buffer */
- hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float * buf = NULL; /* Buffer for writing data */
+ float * bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
int i, j;
herr_t ret = SUCCEED; /* Generic return value */
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR;
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
/* Set the "use the v18/latest version of the format" bounds
for creating objects in the file, also trigger version 2 superblock */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
/* Create file */
- if((fid = H5Fcreate(FILENAME_18_L, H5F_ACC_TRUNC, fcpl, fapl)) <0)
+ if ((fid = H5Fcreate(FILENAME_18_L, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
TEST_ERROR;
/* Close file property lists */
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Pclose(fcpl) < 0) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR;
/*
* Add a chunked dataset with layout version 3 (default)
*/
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
- if (buf == NULL) TEST_ERROR;
+ if (buf == NULL)
+ TEST_ERROR;
/* Fill sample data */
bufp = buf;
@@ -472,34 +532,44 @@ static herr_t gen_v18_latest(void)
*bufp = 100.0F;
/* Create the dataspace */
- if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create the dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set up for chunked data */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR;
/* Create and write the dataset */
dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if (dset < 0) TEST_ERROR;
+ if (dset < 0)
+ TEST_ERROR;
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (ret < 0) TEST_ERROR;
+ if (ret < 0)
+ TEST_ERROR;
/* Release allocated buffer */
HDfree(buf);
bufp = buf = NULL;
/* Close property list and dataset, will reuse dataspace */
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Dclose(dset) < 0) TEST_ERROR;
- if(H5Sclose(space) < 0) TEST_ERROR;
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(space);
H5Pclose(dcpl);
@@ -507,7 +577,8 @@ error:
H5Pclose(fapl);
H5Fclose(fid);
HDfree(buf);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* gen_v18_latest */
@@ -522,46 +593,52 @@ error:
* Return: SUCCEED/FAIL
*
***********************************************************************/
-static herr_t gen_v18_v18(void)
+static herr_t
+gen_v18_v18(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t space = -1; /* Dataspace ID */
- hid_t dset = -1; /* Dataset ID */
- float *buf = NULL; /* Buffer for writing data */
- float *bufp = NULL; /* Pointer to data buffer */
- hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float * buf = NULL; /* Buffer for writing data */
+ float * bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
int i, j;
herr_t ret = SUCCEED; /* Generic return value */
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR;
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
/* Set the "use the v18 version of the format" bounds
for creating objects in the file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0)
TEST_ERROR;
/* Create file */
- if((fid = H5Fcreate(FILENAME_18_18, H5F_ACC_TRUNC, fcpl, fapl)) <0)
+ if ((fid = H5Fcreate(FILENAME_18_18, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
TEST_ERROR;
/* Close file property lists */
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Pclose(fcpl) < 0) TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR;
/*
* Add a chunked dataset with layout version 3 (default)
*/
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
- if (buf == NULL) TEST_ERROR;
+ if (buf == NULL)
+ TEST_ERROR;
/* Fill sample data */
bufp = buf;
@@ -570,36 +647,45 @@ static herr_t gen_v18_v18(void)
*bufp = 100.0F;
/* Create the dataspace */
- if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create the dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set up for chunked data */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR;
/* Create and write the dataset */
dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if (dset < 0) TEST_ERROR;
+ if (dset < 0)
+ TEST_ERROR;
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (ret < 0) TEST_ERROR;
+ if (ret < 0)
+ TEST_ERROR;
/* Close property list and dataset, will reuse dataspace */
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Dclose(dset) < 0) TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
/* Close the file, then reopen it with the latest version */
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
/* Set the "use the v18/latest version of the format" bounds
for creating a layout version 4 object in the file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
- if((fid = H5Fopen(FILENAME_18_18, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(FILENAME_18_18, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/*
@@ -607,35 +693,45 @@ static herr_t gen_v18_v18(void)
*/
/* Create the dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set up for chunked data */
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ TEST_ERROR;
/* Disable partial chunk filters */
- if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ if (H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
TEST_ERROR;
/* Create and write the dataset */
dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if (dset < 0) TEST_ERROR;
+ if (dset < 0)
+ TEST_ERROR;
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (ret < 0) TEST_ERROR;
+ if (ret < 0)
+ TEST_ERROR;
/* Release allocated buffer */
HDfree(buf);
bufp = buf = NULL;
/* Close everything */
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Dclose(dset) < 0) TEST_ERROR;
- if(H5Sclose(space) < 0) TEST_ERROR;
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset);
H5Sclose(space);
H5Pclose(dcpl);
@@ -643,7 +739,8 @@ error:
H5Pclose(fapl);
H5Fclose(fid);
HDfree(buf);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* gen_v18_v18 */
@@ -676,126 +773,129 @@ error:
* Return: SUCCEED/FAIL
*
***********************************************************************/
-static herr_t gen_sel_files(const char *filename, H5F_libver_t low_bound, H5F_libver_t high_bound)
+static herr_t
+gen_sel_files(const char *filename, H5F_libver_t low_bound, H5F_libver_t high_bound)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t fapl = H5I_INVALID_HID; /* File access property list */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hsize_t numparticles = 8388608;
- hsize_t total_particles = numparticles * 513;
- hsize_t vdsdims[1] = {total_particles}; /* Dataset dimension size */
- hsize_t coord[4]; /* Point selection */
- hsize_t ref_start; /* Starting location of hyperslab */
- hsize_t ref_stride; /* Stride of hyperslab */
- hsize_t ref_count; /* Element count of hyperslab */
- hsize_t ref_block; /* Block size of hyperslab */
- hid_t ref_sid = H5I_INVALID_HID; /* Dataspace ID for the reference dataset */
- hid_t ref_did = H5I_INVALID_HID; /* Dataset ID for the reference dataset */
- hsize_t ref_dims[1] = {1}; /* Dimension for reference dataset */
- hdset_reg_ref_t ref_wbuf[1]; /* Buffer for dataset region reference */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hsize_t numparticles = 8388608;
+ hsize_t total_particles = numparticles * 513;
+ hsize_t vdsdims[1] = {total_particles}; /* Dataset dimension size */
+ hsize_t coord[4]; /* Point selection */
+ hsize_t ref_start; /* Starting location of hyperslab */
+ hsize_t ref_stride; /* Stride of hyperslab */
+ hsize_t ref_count; /* Element count of hyperslab */
+ hsize_t ref_block; /* Block size of hyperslab */
+ hid_t ref_sid = H5I_INVALID_HID; /* Dataspace ID for the reference dataset */
+ hid_t ref_did = H5I_INVALID_HID; /* Dataset ID for the reference dataset */
+ hsize_t ref_dims[1] = {1}; /* Dimension for reference dataset */
+ hdset_reg_ref_t ref_wbuf[1]; /* Buffer for dataset region reference */
/*
* Create test file, attribute, group and dataset
*/
- /* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ /* Create the test file */
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create a dataset */
- if((sid = H5Screate_simple(1, vdsdims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, vdsdims, NULL)) < 0)
TEST_ERROR;
- if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set to use the low/high bounds in fapl */
- if(H5Pset_libver_bounds(fapl, low_bound, high_bound) < 0)
+ if (H5Pset_libver_bounds(fapl, low_bound, high_bound) < 0)
TEST_ERROR;
/* Open the file with fapl */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Open the dataset */
- if((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Get the dataset's dataspace */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
TEST_ERROR;
/* Create dataspace for the reference dataset */
ref_dims[0] = 1;
- if((ref_sid = H5Screate_simple(1, ref_dims, NULL)) < 0)
+ if ((ref_sid = H5Screate_simple(1, ref_dims, NULL)) < 0)
TEST_ERROR;
/* Generate regular hyperslab exceeding 32 */
- ref_start = 0;
- ref_count = 2;
- ref_block = 4;
+ ref_start = 0;
+ ref_count = 2;
+ ref_block = 4;
ref_stride = POWER32;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &ref_start, &ref_stride, &ref_count, &ref_block) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, &ref_start, &ref_stride, &ref_count, &ref_block) < 0)
TEST_ERROR;
/* Should succeed for v110 and above */
- if(high_bound >= H5F_LIBVER_V110) {
+ if (high_bound >= H5F_LIBVER_V110) {
/* Create the first reference */
- if(H5Rcreate(&ref_wbuf[0], fid, DATASET, H5R_DATASET_REGION, sid) < 0)
+ if (H5Rcreate(&ref_wbuf[0], fid, DATASET, H5R_DATASET_REGION, sid) < 0)
TEST_ERROR;
/* Create the reference datset */
- if((ref_did = H5Dcreate2(fid, SEL_EX_REG_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((ref_did = H5Dcreate2(fid, SEL_EX_REG_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write to the reference datset */
- if(H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf) < 0)
+ if (H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf) < 0)
TEST_ERROR;
- if(H5Dclose(ref_did) < 0)
+ if (H5Dclose(ref_did) < 0)
TEST_ERROR;
}
/* Generate irregular hyperslab exceeding 32 */
- ref_start = 8;
- ref_count = 5;
- ref_block = 2;
+ ref_start = 8;
+ ref_count = 5;
+ ref_block = 2;
ref_stride = POWER32;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_OR, &ref_start, &ref_stride, &ref_count, &ref_block) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_OR, &ref_start, &ref_stride, &ref_count, &ref_block) < 0)
TEST_ERROR;
/* Should succeed for v112 and above */
- if(high_bound >= H5F_LIBVER_V112) {
+ if (high_bound >= H5F_LIBVER_V112) {
/* Create the second reference */
- if(H5Rcreate(&ref_wbuf[0], fid, DATASET, H5R_DATASET_REGION, sid) < 0)
+ if (H5Rcreate(&ref_wbuf[0], fid, DATASET, H5R_DATASET_REGION, sid) < 0)
TEST_ERROR;
/* Create the reference datset */
- if((ref_did = H5Dcreate2(fid, SEL_EX_IRR_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((ref_did = H5Dcreate2(fid, SEL_EX_IRR_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write to the reference datset */
- if(H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf) < 0)
+ if (H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf) < 0)
TEST_ERROR;
- if(H5Dclose(ref_did) < 0)
+ if (H5Dclose(ref_did) < 0)
TEST_ERROR;
}
@@ -805,52 +905,55 @@ static herr_t gen_sel_files(const char *filename, H5F_libver_t low_bound, H5F_l
coord[2] = POWER32 + 1;
coord[3] = 19;
- if(H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord) < 0)
+ if (H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord) < 0)
TEST_ERROR;
/* Should succeed for v112 and above */
- if(high_bound >= H5F_LIBVER_V112) {
+ if (high_bound >= H5F_LIBVER_V112) {
/* Create the third reference */
- if(H5Rcreate(&ref_wbuf[0], fid, DATASET, H5R_DATASET_REGION, sid) < 0)
+ if (H5Rcreate(&ref_wbuf[0], fid, DATASET, H5R_DATASET_REGION, sid) < 0)
TEST_ERROR;
/* Create the reference datset */
- if((ref_did = H5Dcreate2(fid, SEL_EX_PT_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((ref_did = H5Dcreate2(fid, SEL_EX_PT_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write to the reference datset */
- if(H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf) < 0)
+ if (H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf) < 0)
TEST_ERROR;
- if(H5Dclose(ref_did) < 0)
+ if (H5Dclose(ref_did) < 0)
TEST_ERROR;
}
/* Closing */
- if(H5Sclose(ref_sid) < 0)
+ if (H5Sclose(ref_sid) < 0)
TEST_ERROR;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(ref_did);
H5Sclose(ref_sid);
H5Dclose(did);
H5Sclose(sid);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
@@ -887,97 +990,99 @@ error:
* Return: SUCCEED/FAIL
*
***********************************************************************/
-static herr_t gen_ref_files(const char *filename, H5F_libver_t low_bound, H5F_libver_t high_bound)
+static herr_t
+gen_ref_files(const char *filename, H5F_libver_t low_bound, H5F_libver_t high_bound)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hid_t fapl = H5I_INVALID_HID; /* File access property list */
- hid_t aid = H5I_INVALID_HID; /* Attribute ID */
- hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hsize_t dims[1] = {100}; /* Dimension size */
- unsigned *dwbuf = NULL; /* Buffer for writing data */
- hid_t ref_sid = H5I_INVALID_HID; /* Dataspace ID for the reference dataset */
- hid_t ref_did = H5I_INVALID_HID; /* Dataset ID for the reference dataset */
- hsize_t rev_ref_dims[1] = {3}; /* Dimension size for the reference dataset */
- H5R_ref_t rev_ref_wbuf[3]; /* Buffer for storing the revised references */
- hobj_ref_t old_ref_obj_wbuf[1]; /* Buffer for storing the old reference object */
- hdset_reg_ref_t old_ref_reg_wbuf[1]; /* Buffer for storing the old dataset region reference */
- hsize_t old_ref_dims[] = {1}; /* Dimension size for the reference dataset */
- hsize_t start[1]; /* Starting location of hyperslab */
- hsize_t stride[1]; /* Stride of hyperslab */
- hsize_t count[1]; /* Element count of hyperslab */
- hsize_t block[1]; /* Block size of hyperslab */
- unsigned i; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hsize_t dims[1] = {100}; /* Dimension size */
+ unsigned * dwbuf = NULL; /* Buffer for writing data */
+ hid_t ref_sid = H5I_INVALID_HID; /* Dataspace ID for the reference dataset */
+ hid_t ref_did = H5I_INVALID_HID; /* Dataset ID for the reference dataset */
+ hsize_t rev_ref_dims[1] = {3}; /* Dimension size for the reference dataset */
+ H5R_ref_t rev_ref_wbuf[3]; /* Buffer for storing the revised references */
+ hobj_ref_t old_ref_obj_wbuf[1]; /* Buffer for storing the old reference object */
+ hdset_reg_ref_t old_ref_reg_wbuf[1]; /* Buffer for storing the old dataset region reference */
+ hsize_t old_ref_dims[] = {1}; /* Dimension size for the reference dataset */
+ hsize_t start[1]; /* Starting location of hyperslab */
+ hsize_t stride[1]; /* Stride of hyperslab */
+ hsize_t count[1]; /* Element count of hyperslab */
+ hsize_t block[1]; /* Block size of hyperslab */
+ unsigned i; /* Local index variable */
/*
* Create test file, attribute, group and dataset
*/
- if((dwbuf = HDcalloc(sizeof(unsigned), 100)) == NULL)
+ if ((dwbuf = HDcalloc(sizeof(unsigned), 100)) == NULL)
TEST_ERROR;
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create dataspace for the attribute */
- if((asid = H5Screate(H5S_SCALAR)) < 0)
+ if ((asid = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR;
/* Create an attribute to the root group */
- if((aid = H5Acreate2(fid, ATTR, H5T_NATIVE_UINT, asid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(fid, ATTR, H5T_NATIVE_UINT, asid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create a group */
- if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create dataspace for the dataset */
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
TEST_ERROR;
/* Create a dataset in the group */
- if((did = H5Dcreate2(gid, DATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(gid, DATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Initialize data to write */
- for(i = 0; i < 100; i++)
+ for (i = 0; i < 100; i++)
dwbuf[i] = i * 3;
/* Write data to disk */
- if(H5Dwrite(did, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf) < 0)
TEST_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Sclose(asid) < 0)
+ if (H5Sclose(asid) < 0)
TEST_ERROR;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
- if(dwbuf) {
+ if (dwbuf) {
HDfree(dwbuf);
dwbuf = NULL;
}
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
/* Set to use the low/high bounds in fapl */
- if(H5Pset_libver_bounds(fapl, low_bound, high_bound) < 0)
+ if (H5Pset_libver_bounds(fapl, low_bound, high_bound) < 0)
TEST_ERROR;
/* Open the file with fapl */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) <0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/*
@@ -985,9 +1090,9 @@ static herr_t gen_ref_files(const char *filename, H5F_libver_t low_bound, H5F_l
*/
/* Retrieve dataspace for the existing dataset */
- if((did = H5Dopen2(fid, "/Group/Dataset", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "/Group/Dataset", H5P_DEFAULT)) < 0)
TEST_ERROR;
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
TEST_ERROR;
/* Select 15 2x1 hyperslabs for the dataset region reference */
@@ -995,100 +1100,102 @@ static herr_t gen_ref_files(const char *filename, H5F_libver_t low_bound, H5F_l
stride[0] = 5;
count[0] = 15;
block[0] = 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR;
-
- if(high_bound >= H5F_LIBVER_V112) {
+ if (high_bound >= H5F_LIBVER_V112) {
/* Create dataspace for the reference dataset */
- if((ref_sid = H5Screate_simple(1, rev_ref_dims, NULL)) < 0)
+ if ((ref_sid = H5Screate_simple(1, rev_ref_dims, NULL)) < 0)
TEST_ERROR;
/* Create a dataset with the revised reference type */
- ref_did = H5Dcreate2(fid, REVISED_REFS_DSET, H5T_STD_REF, ref_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ref_did =
+ H5Dcreate2(fid, REVISED_REFS_DSET, H5T_STD_REF, ref_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Store the reference to "Attr" */
- if(H5Rcreate_attr(fid, "/", "Attr", H5P_DEFAULT, &rev_ref_wbuf[0]) < 0)
+ if (H5Rcreate_attr(fid, "/", "Attr", H5P_DEFAULT, &rev_ref_wbuf[0]) < 0)
TEST_ERROR;
/* Store the reference to /Group */
- if(H5Rcreate_object(fid, "/Group", H5P_DEFAULT, &rev_ref_wbuf[1]) < 0)
+ if (H5Rcreate_object(fid, "/Group", H5P_DEFAULT, &rev_ref_wbuf[1]) < 0)
TEST_ERROR;
/* Store the dataset region referenced to /Group/Dataset */
- if(H5Rcreate_region(fid, "/Group/Dataset", sid, H5P_DEFAULT, &rev_ref_wbuf[2]) < 0)
+ if (H5Rcreate_region(fid, "/Group/Dataset", sid, H5P_DEFAULT, &rev_ref_wbuf[2]) < 0)
TEST_ERROR;
/* Write to the reference dataset */
- if(H5Dwrite(ref_did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rev_ref_wbuf) < 0)
+ if (H5Dwrite(ref_did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rev_ref_wbuf) < 0)
TEST_ERROR;
/* Destroy references */
- for(i = 0; i < 3; i++)
- if(H5Rdestroy(&rev_ref_wbuf[i]) < 0)
+ for (i = 0; i < 3; i++)
+ if (H5Rdestroy(&rev_ref_wbuf[i]) < 0)
TEST_ERROR;
/* Closing */
- if(H5Dclose(ref_did) < 0)
+ if (H5Dclose(ref_did) < 0)
TEST_ERROR;
- if(H5Sclose(ref_sid) < 0)
+ if (H5Sclose(ref_sid) < 0)
TEST_ERROR;
}
/* Create dataspace for the reference dataset */
- if((ref_sid = H5Screate_simple(1, old_ref_dims, NULL)) < 0)
+ if ((ref_sid = H5Screate_simple(1, old_ref_dims, NULL)) < 0)
TEST_ERROR;
/* Create a dataset with the old object reference type */
- if((ref_did = H5Dcreate2(fid, OLD_REF_OBJ_DSET, H5T_STD_REF_OBJ, ref_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((ref_did = H5Dcreate2(fid, OLD_REF_OBJ_DSET, H5T_STD_REF_OBJ, ref_sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create reference to /Group */
- if(H5Rcreate(&old_ref_obj_wbuf[0], fid, "/Group", H5R_OBJECT, -1) < 0)
+ if (H5Rcreate(&old_ref_obj_wbuf[0], fid, "/Group", H5R_OBJECT, -1) < 0)
TEST_ERROR;
/* Write to the reference dataset */
- if(H5Dwrite(ref_did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, old_ref_obj_wbuf) < 0)
+ if (H5Dwrite(ref_did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, old_ref_obj_wbuf) < 0)
TEST_ERROR;
/* Close the dataset */
- if(H5Dclose(ref_did) < 0)
+ if (H5Dclose(ref_did) < 0)
TEST_ERROR;
-
/* Create a dataset with the old dataset region reference type */
- if((ref_did = H5Dcreate2(fid, OLD_REF_REG_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((ref_did = H5Dcreate2(fid, OLD_REF_REG_DSET, H5T_STD_REF_DSETREG, ref_sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create dataset region reference */
- if(H5Rcreate(&old_ref_reg_wbuf[0], fid, "/Group/Dataset", H5R_DATASET_REGION, sid) < 0)
+ if (H5Rcreate(&old_ref_reg_wbuf[0], fid, "/Group/Dataset", H5R_DATASET_REGION, sid) < 0)
TEST_ERROR;
/* Write selection to the reference dataset */
- if(H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, old_ref_reg_wbuf) < 0)
+ if (H5Dwrite(ref_did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, old_ref_reg_wbuf) < 0)
TEST_ERROR;
/* Closing */
- if(H5Dclose(ref_did) < 0)
+ if (H5Dclose(ref_did) < 0)
TEST_ERROR;
- if(H5Sclose(ref_sid) < 0)
+ if (H5Sclose(ref_sid) < 0)
TEST_ERROR;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(ref_did);
H5Sclose(ref_sid);
H5Dclose(did);
@@ -1096,52 +1203,58 @@ error:
H5Pclose(fapl);
H5Fclose(fid);
HDfree(dwbuf);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* gen_ref_files() */
-int main(void)
+int
+main(void)
{
/* Generate file bounds_earliest_latest.h5 */
- if (gen_earliest_latest() < 0) TEST_ERROR;
+ if (gen_earliest_latest() < 0)
+ TEST_ERROR;
/* Generate file bounds_earliest_v18.h5 */
- if (gen_earliest_v18() < 0) TEST_ERROR;
+ if (gen_earliest_v18() < 0)
+ TEST_ERROR;
/* Generate file bounds_latest_latest.h5 */
- if (gen_latest_latest() < 0) TEST_ERROR;
+ if (gen_latest_latest() < 0)
+ TEST_ERROR;
/* Generate file bounds_v18_latest.h5 */
- if (gen_v18_latest() < 0) TEST_ERROR;
+ if (gen_v18_latest() < 0)
+ TEST_ERROR;
/* Generate file bounds_v18_v18.h5 */
- if (gen_v18_v18() < 0) TEST_ERROR;
-
+ if (gen_v18_v18() < 0)
+ TEST_ERROR;
/*
* Files generated via gen_ref_files()
*/
/* Generate bounds_ref_earliest_latest.h5 */
- if(gen_ref_files(FILENAME_REF_E_L, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
+ if (gen_ref_files(FILENAME_REF_E_L, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
/* Generate bounds_ref_latest_latest.h5 */
- if(gen_ref_files(FILENAME_REF_L_L, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (gen_ref_files(FILENAME_REF_L_L, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
/* Generate bounds_ref_v112_v112.h5 */
- if(gen_ref_files(FILENAME_REF_V112_V112, H5F_LIBVER_V112, H5F_LIBVER_V112) < 0)
+ if (gen_ref_files(FILENAME_REF_V112_V112, H5F_LIBVER_V112, H5F_LIBVER_V112) < 0)
TEST_ERROR;
/* Generate bounds_ref_v110_v110.h5 */
- if(gen_ref_files(FILENAME_REF_V110_V110, H5F_LIBVER_V110, H5F_LIBVER_V110) < 0)
+ if (gen_ref_files(FILENAME_REF_V110_V110, H5F_LIBVER_V110, H5F_LIBVER_V110) < 0)
TEST_ERROR;
/* Generate bounds_ref_v18_v18.h5 */
- if(gen_ref_files(FILENAME_REF_V18_V18, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0)
+ if (gen_ref_files(FILENAME_REF_V18_V18, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0)
TEST_ERROR;
/*
@@ -1149,19 +1262,19 @@ int main(void)
*/
/* Generate bounds_sel_earliest_latest.h5 */
- if(gen_sel_files(FILENAME_SEL_E_L, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
+ if (gen_sel_files(FILENAME_SEL_E_L, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
/* Generate bounds_sel_latest_latest.h5 */
- if(gen_sel_files(FILENAME_SEL_L_L, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (gen_sel_files(FILENAME_SEL_L_L, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR;
/* Generate bounds_sel_v112_v112.h5 */
- if(gen_sel_files(FILENAME_SEL_V112_V112, H5F_LIBVER_V112, H5F_LIBVER_V112) < 0)
+ if (gen_sel_files(FILENAME_SEL_V112_V112, H5F_LIBVER_V112, H5F_LIBVER_V112) < 0)
TEST_ERROR;
/* Generate bounds_sel_v110_v110.h5 */
- if(gen_sel_files(FILENAME_SEL_V110_V110, H5F_LIBVER_V110, H5F_LIBVER_V110) < 0)
+ if (gen_sel_files(FILENAME_SEL_V110_V110, H5F_LIBVER_V110, H5F_LIBVER_V110) < 0)
TEST_ERROR;
return EXIT_SUCCESS;
@@ -1169,4 +1282,3 @@ int main(void)
error:
return EXIT_FAILURE;
}
-
diff --git a/test/gen_cross.c b/test/gen_cross.c
index 2c1ff4d..37c6dcf 100644
--- a/test/gen_cross.c
+++ b/test/gen_cross.c
@@ -28,40 +28,40 @@
#include "h5test.h"
-#define H5FILE_NAME "data.h5"
-#define DATASETNAME "Array_le"
-#define DATASETNAME1 "Array_be"
-#define DATASETNAME2 "Scale_offset_float_data_le"
-#define DATASETNAME3 "Scale_offset_float_data_be"
-#define DATASETNAME4 "Scale_offset_double_data_le"
-#define DATASETNAME5 "Scale_offset_double_data_be"
-#define DATASETNAME6 "Scale_offset_char_data_le"
-#define DATASETNAME7 "Scale_offset_char_data_be"
-#define DATASETNAME8 "Scale_offset_short_data_le"
-#define DATASETNAME9 "Scale_offset_short_data_be"
-#define DATASETNAME10 "Scale_offset_int_data_le"
-#define DATASETNAME11 "Scale_offset_int_data_be"
-#define DATASETNAME12 "Scale_offset_long_long_data_le"
-#define DATASETNAME13 "Scale_offset_long_long_data_be"
-
-#define DATASETNAME14 "Fletcher_float_data_le"
-#define DATASETNAME15 "Fletcher_float_data_be"
-#define DATASETNAME16 "Deflate_float_data_le"
-#define DATASETNAME17 "Deflate_float_data_be"
+#define H5FILE_NAME "data.h5"
+#define DATASETNAME "Array_le"
+#define DATASETNAME1 "Array_be"
+#define DATASETNAME2 "Scale_offset_float_data_le"
+#define DATASETNAME3 "Scale_offset_float_data_be"
+#define DATASETNAME4 "Scale_offset_double_data_le"
+#define DATASETNAME5 "Scale_offset_double_data_be"
+#define DATASETNAME6 "Scale_offset_char_data_le"
+#define DATASETNAME7 "Scale_offset_char_data_be"
+#define DATASETNAME8 "Scale_offset_short_data_le"
+#define DATASETNAME9 "Scale_offset_short_data_be"
+#define DATASETNAME10 "Scale_offset_int_data_le"
+#define DATASETNAME11 "Scale_offset_int_data_be"
+#define DATASETNAME12 "Scale_offset_long_long_data_le"
+#define DATASETNAME13 "Scale_offset_long_long_data_be"
+
+#define DATASETNAME14 "Fletcher_float_data_le"
+#define DATASETNAME15 "Fletcher_float_data_be"
+#define DATASETNAME16 "Deflate_float_data_le"
+#define DATASETNAME17 "Deflate_float_data_be"
#ifdef H5_HAVE_FILTER_SZIP
-#define DATASETNAME18 "Szip_float_data_le"
-#define DATASETNAME19 "Szip_float_data_be"
+#define DATASETNAME18 "Szip_float_data_le"
+#define DATASETNAME19 "Szip_float_data_be"
#endif /* H5_HAVE_FILTER_SZIP */
-#define DATASETNAME20 "Shuffle_float_data_le"
-#define DATASETNAME21 "Shuffle_float_data_be"
-#define DATASETNAME22 "Nbit_float_data_le"
-#define DATASETNAME23 "Nbit_float_data_be"
+#define DATASETNAME20 "Shuffle_float_data_le"
+#define DATASETNAME21 "Shuffle_float_data_be"
+#define DATASETNAME22 "Nbit_float_data_le"
+#define DATASETNAME23 "Nbit_float_data_be"
-#define NX 6
-#define NY 6
-#define RANK 2
-#define CHUNK0 4
-#define CHUNK1 3
+#define NX 6
+#define NY 6
+#define RANK 2
+#define CHUNK0 4
+#define CHUNK1 3
int create_normal_dset(hid_t fid, hid_t fsid, hid_t msid);
int create_scale_offset_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
@@ -78,7 +78,6 @@ int create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
int create_shuffle_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
int create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
-
/*-------------------------------------------------------------------------
* Function: create_normal_dset
*
@@ -97,18 +96,18 @@ int create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
int
create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* file and dataset handles */
- hid_t dcpl = -1;
- float data[NX][NY]; /* data to write */
- float fillvalue = -2.2f;
- int i, j;
+ hid_t dataset = -1; /* file and dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
+ float fillvalue = -2.2f;
+ int i, j;
/*
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++)
- data[j][i] = ((float)(i + j + 1)) / 3;
+ for (i = 0; i < NY; i++)
+ data[j][i] = ((float)(i + j + 1)) / 3;
}
/*
* 1/3 2/3 3/3 4/3 5/3 6/3
@@ -123,69 +122,68 @@ create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
/*
* Create the dataset creation property list, set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace and
* little-endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME, H5T_IEEE_F64LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME, H5T_IEEE_F64LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/*
* Close dataset
*/
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace and
* big-endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME1, H5T_IEEE_F64BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME1, H5T_IEEE_F64BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/*
* Close dataset
*/
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dsets_float
*
@@ -204,79 +202,78 @@ error:
int
create_scale_offset_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* dataset handles */
- hid_t dcpl = -1;
- float data[NX][NY]; /* data to write */
- float fillvalue = -2.2f;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
+ float fillvalue = -2.2f;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = ((float)(i + j + 1))/3;
+ data[j][i] = ((float)(i + j + 1)) / 3;
}
/*
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_FLOAT_DSCALE, 3) < 0)
+ if (H5Pset_scaleoffset(dcpl, H5Z_SO_FLOAT_DSCALE, 3) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME2, H5T_IEEE_F32LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME2, H5T_IEEE_F32LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME3, H5T_IEEE_F32BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME3, H5T_IEEE_F32BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dsets_double
*
@@ -295,79 +292,78 @@ error:
int
create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* dataset handles */
- hid_t dcpl = -1;
- double data[NX][NY]; /* data to write */
- double fillvalue = -2.2f;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ double data[NX][NY]; /* data to write */
+ double fillvalue = -2.2f;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++)
- data[j][i] = ((double)(i + j + 1))/3;
+ for (i = 0; i < NY; i++)
+ data[j][i] = ((double)(i + j + 1)) / 3;
}
/*
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_FLOAT_DSCALE, 3) < 0)
+ if (H5Pset_scaleoffset(dcpl, H5Z_SO_FLOAT_DSCALE, 3) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME4, H5T_IEEE_F64LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME4, H5T_IEEE_F64LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_DOUBLE, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME5, H5T_IEEE_F64BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME5, H5T_IEEE_F64BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_DOUBLE, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dset_char
*
@@ -386,12 +382,12 @@ error:
int
create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* dataset handles */
- hid_t dcpl = -1;
- char data[NX][NY]; /* data to write */
- char fillvalue = -2;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ char data[NX][NY]; /* data to write */
+ char fillvalue = -2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
@@ -413,60 +409,59 @@ create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid)
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ if (H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME6, H5T_STD_I8LE, fsid, H5P_DEFAULT,
- dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME6, H5T_STD_I8LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_CHAR, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_CHAR, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME7, H5T_STD_I8BE, fsid, H5P_DEFAULT,
- dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME7, H5T_STD_I8BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_CHAR, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_CHAR, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dset_short
*
@@ -485,12 +480,12 @@ error:
int
create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* dataset handles */
- hid_t dcpl = -1;
- short data[NX][NY]; /* data to write */
- short fillvalue = -2;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ short data[NX][NY]; /* data to write */
+ short fillvalue = -2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
@@ -512,60 +507,59 @@ create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid)
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ if (H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME8, H5T_STD_I16LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME8, H5T_STD_I16LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_SHORT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_SHORT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME9, H5T_STD_I16BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME9, H5T_STD_I16BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_SHORT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_SHORT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dset_int
*
@@ -584,19 +578,19 @@ error:
int
create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* dataset handles */
- hid_t dcpl = -1;
- int data[NX][NY]; /* data to write */
- int fillvalue = -2;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ int data[NX][NY]; /* data to write */
+ int fillvalue = -2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++)
- data[j][i] = i + j;
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
}
/*
* 0 1 2 3 4 5
@@ -611,60 +605,59 @@ create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid)
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ if (H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME10, H5T_STD_I32LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME10, H5T_STD_I32LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME11, H5T_STD_I32BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME11, H5T_STD_I32BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dset_long_long
*
@@ -684,12 +677,12 @@ error:
int
create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* dataset handles */
- hid_t dcpl = -1;
- long long data[NX][NY]; /* data to write */
- long long fillvalue = -2;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ long long data[NX][NY]; /* data to write */
+ long long fillvalue = -2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
@@ -711,60 +704,59 @@ create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid)
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ if (H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_LLONG, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_LLONG, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME12, H5T_STD_I64LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME12, H5T_STD_I64LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_LLONG, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_LLONG, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME13, H5T_STD_I64BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME13, H5T_STD_I64BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_LLONG, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_LLONG, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_fletcher_dsets_float
*
@@ -783,79 +775,78 @@ error:
int
create_fletcher_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* dataset handles */
- hid_t dcpl = -1;
- float data[NX][NY]; /* data to write */
- float fillvalue = -2.2f;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
+ float fillvalue = -2.2f;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = ((float)(i + j + 1))/3;
+ data[j][i] = ((float)(i + j + 1)) / 3;
}
/*
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_filter(dcpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL) < 0)
+ if (H5Pset_filter(dcpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME14, H5T_IEEE_F32LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME14, H5T_IEEE_F32LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME15, H5T_IEEE_F32BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME15, H5T_IEEE_F32BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_deflate_dsets_float
*
@@ -875,69 +866,67 @@ int
create_deflate_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
#ifdef H5_HAVE_FILTER_DEFLATE
- hid_t dataset = -1; /* dataset handles */
- hid_t dcpl = -1;
- float data[NX][NY]; /* data to write */
- float fillvalue = -2.2f;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
+ float fillvalue = -2.2f;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = ((float)(i + j + 1))/3;
+ data[j][i] = ((float)(i + j + 1)) / 3;
}
/*
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_deflate (dcpl, 6) < 0)
+ if (H5Pset_deflate(dcpl, 6) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME16, H5T_IEEE_F32LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME16, H5T_IEEE_F32LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME17, H5T_IEEE_F32BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME17, H5T_IEEE_F32BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
-#else /* H5_HAVE_FILTER_DEFLATE */
- const char *not_supported= "Deflate filter is not enabled. Can't create the dataset.";
+#else /* H5_HAVE_FILTER_DEFLATE */
+ const char *not_supported = "Deflate filter is not enabled. Can't create the dataset.";
puts(not_supported);
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -946,10 +935,12 @@ create_deflate_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
#ifdef H5_HAVE_FILTER_DEFLATE
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -975,80 +966,79 @@ error:
int
create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- float data[NX][NY]; /* data to write */
- float fillvalue = -2.2f;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset; /* dataset handles */
+ hid_t dcpl;
+ float data[NX][NY]; /* data to write */
+ float fillvalue = -2.2f;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = ((float)(i + j + 1))/3;
+ data[j][i] = ((float)(i + j + 1)) / 3;
}
/*
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_szip(dcpl, H5_SZIP_NN_OPTION_MASK, 4) < 0)
+ if (H5Pset_szip(dcpl, H5_SZIP_NN_OPTION_MASK, 4) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME18, H5T_IEEE_F32LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME18, H5T_IEEE_F32LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME19, H5T_IEEE_F32BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME19, H5T_IEEE_F32BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
#endif /* H5_HAVE_FILTER_SZIP */
-
/*-------------------------------------------------------------------------
* Function: create_shuffle_dsets_float
*
@@ -1067,79 +1057,78 @@ error:
int
create_shuffle_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* dataset handles */
- hid_t dcpl = -1;
- float data[NX][NY]; /* data to write */
- float fillvalue = -2.2f;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
+ float fillvalue = -2.2f;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = ((float)(i + j + 1))/3;
+ data[j][i] = ((float)(i + j + 1)) / 3;
}
/*
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_shuffle (dcpl) < 0)
+ if (H5Pset_shuffle(dcpl) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace, little
* endian datatype and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME20, H5T_IEEE_F32LE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME20, H5T_IEEE_F32LE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if((dataset = H5Dcreate2(fid, DATASETNAME21, H5T_IEEE_F32BE, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME21, H5T_IEEE_F32BE, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_nbit_dsets_float
*
@@ -1158,100 +1147,99 @@ error:
int
create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset = -1; /* dataset handles */
- hid_t datatype = -1;
- hid_t dcpl = -1;
- size_t precision, offset;
- float data[NX][NY]; /* data to write */
- float fillvalue = -2.2f;
- hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
- int i, j;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t datatype = -1;
+ hid_t dcpl = -1;
+ size_t precision, offset;
+ float data[NX][NY]; /* data to write */
+ float fillvalue = -2.2f;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
/*
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = ((float)(i + j + 1))/3;
+ data[j][i] = ((float)(i + j + 1)) / 3;
}
/*
* Create the dataset creation property list, add the Scale-Offset
* filter, set the chunk size, and set the fill value.
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_nbit(dcpl) < 0)
+ if (H5Pset_nbit(dcpl) < 0)
TEST_ERROR
- if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk) < 0)
TEST_ERROR
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
TEST_ERROR
/* Define user-defined single-precision floating-point type for dataset.
* A 20-bit little-endian data type. */
- if((datatype = H5Tcopy(H5T_IEEE_F32LE)) < 0)
+ if ((datatype = H5Tcopy(H5T_IEEE_F32LE)) < 0)
TEST_ERROR
- if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ if (H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
TEST_ERROR
offset = 7;
- if(H5Tset_offset(datatype,offset) < 0)
+ if (H5Tset_offset(datatype, offset) < 0)
TEST_ERROR
precision = 20;
- if(H5Tset_precision(datatype,precision) < 0)
+ if (H5Tset_precision(datatype, precision) < 0)
TEST_ERROR
- if(H5Tset_size(datatype, (size_t)4) < 0)
+ if (H5Tset_size(datatype, (size_t)4) < 0)
TEST_ERROR
- if(H5Tset_ebias(datatype, (size_t)31) < 0)
+ if (H5Tset_ebias(datatype, (size_t)31) < 0)
TEST_ERROR
/*
* Create a new dataset within the file using defined dataspace,
* user-defined datatype, and default dataset creation properties.
*/
- if((dataset = H5Dcreate2(fid, DATASETNAME22, datatype, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME22, datatype, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if(H5Tset_order(datatype, H5T_ORDER_BE) < 0)
+ if (H5Tset_order(datatype, H5T_ORDER_BE) < 0)
TEST_ERROR
- if((dataset = H5Dcreate2(fid, DATASETNAME23, datatype, fsid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid, DATASETNAME23, datatype, fsid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
/*
* Close/release resources.
*/
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1264,20 +1252,20 @@ error:
*-------------------------------------------------------------------------
*/
int
-main (void)
+main(void)
{
- hid_t file = -1;
- hid_t filespace = -1;
- hid_t memspace = -1;
- hsize_t dimsf[RANK];
- hsize_t start[RANK] = {0, 0};
+ hid_t file = -1;
+ hid_t filespace = -1;
+ hid_t memspace = -1;
+ hsize_t dimsf[RANK];
+ hsize_t start[RANK] = {0, 0};
/*
* Create a new file using H5F_ACC_TRUNC access,
* default file creation properties, and default file
* access properties.
*/
- if((file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/*
@@ -1287,80 +1275,79 @@ main (void)
*/
dimsf[0] = NX + 1;
dimsf[1] = NY;
- if((filespace = H5Screate_simple(RANK, dimsf, NULL)) < 0)
+ if ((filespace = H5Screate_simple(RANK, dimsf, NULL)) < 0)
TEST_ERROR;
dimsf[0] = NX;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dimsf, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dimsf, NULL) < 0)
TEST_ERROR;
/* Create memory space. This does not include the extra row for fill
* values. */
HDassert(dimsf[0] == NX);
HDassert(dimsf[1] == NY);
- if((memspace = H5Screate_simple(RANK, dimsf, NULL)) < 0)
+ if ((memspace = H5Screate_simple(RANK, dimsf, NULL)) < 0)
TEST_ERROR;
/* Create a regular dataset */
- if(create_normal_dset(file, filespace, memspace) < 0)
+ if (create_normal_dset(file, filespace, memspace) < 0)
TEST_ERROR;
/* Create a dataset of FLOAT with scale-offset filter */
- if(create_scale_offset_dsets_float(file, filespace, memspace) < 0)
+ if (create_scale_offset_dsets_float(file, filespace, memspace) < 0)
TEST_ERROR;
/* Create a dataset of DOUBLE with scale-offset filter */
- if(create_scale_offset_dsets_double(file, filespace, memspace) < 0)
+ if (create_scale_offset_dsets_double(file, filespace, memspace) < 0)
TEST_ERROR;
/* Create a dataset of CHAR with scale-offset filter */
- if(create_scale_offset_dsets_char(file, filespace, memspace) < 0)
+ if (create_scale_offset_dsets_char(file, filespace, memspace) < 0)
TEST_ERROR;
/* Create a dataset of SHORT with scale-offset filter */
- if(create_scale_offset_dsets_short(file, filespace, memspace) < 0)
+ if (create_scale_offset_dsets_short(file, filespace, memspace) < 0)
TEST_ERROR;
/* Create a dataset of INT with scale-offset filter */
- if(create_scale_offset_dsets_int(file, filespace, memspace) < 0)
+ if (create_scale_offset_dsets_int(file, filespace, memspace) < 0)
TEST_ERROR;
/* Create a dataset of LONG LONG with scale-offset filter */
- if(create_scale_offset_dsets_long_long(file, filespace, memspace) < 0)
+ if (create_scale_offset_dsets_long_long(file, filespace, memspace) < 0)
TEST_ERROR;
/* Create a dataset of FLOAT with fletcher filter */
- if(create_fletcher_dsets_float(file, filespace, memspace) < 0)
+ if (create_fletcher_dsets_float(file, filespace, memspace) < 0)
TEST_ERROR;
/* Create a dataset of FLOAT with deflate filter */
- if(create_deflate_dsets_float(file, filespace, memspace) < 0)
+ if (create_deflate_dsets_float(file, filespace, memspace) < 0)
TEST_ERROR;
#ifdef H5_HAVE_FILTER_SZIP
/* Create a dataset of FLOAT with szip filter */
- if(create_szip_dsets_float(file, filespace, memspace) < 0)
+ if (create_szip_dsets_float(file, filespace, memspace) < 0)
TEST_ERROR;
-#else /* H5_HAVE_FILTER_SZIP */
+#else /* H5_HAVE_FILTER_SZIP */
HDputs("Szip filter is not enabled. Can't create the dataset.");
#endif /* H5_HAVE_FILTER_SZIP */
/* Create a dataset of FLOAT with shuffle filter */
- if(create_shuffle_dsets_float(file, filespace, memspace) < 0)
+ if (create_shuffle_dsets_float(file, filespace, memspace) < 0)
TEST_ERROR;
/* Create a dataset of FLOAT with nbit filter */
- if(create_nbit_dsets_float(file, filespace, memspace) < 0)
+ if (create_nbit_dsets_float(file, filespace, memspace) < 0)
TEST_ERROR;
-
/*
* Close/release resources.
*/
- if(H5Sclose(memspace) < 0)
+ if (H5Sclose(memspace) < 0)
TEST_ERROR;
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
HDexit(EXIT_SUCCESS);
@@ -1368,4 +1355,3 @@ main (void)
error:
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/gen_deflate.c b/test/gen_deflate.c
index 3409a81..22c901c 100644
--- a/test/gen_deflate.c
+++ b/test/gen_deflate.c
@@ -25,17 +25,15 @@
#include "h5test.h"
-#define TESTFILE "deflate.h5"
+#define TESTFILE "deflate.h5"
/* 2-D dataset with fixed dimensions */
-#define SPACE_RANK 2
-#define SPACE_DIM1 100
-#define SPACE_DIM2 200
-#define CHUNK_DIM1 50
-#define CHUNK_DIM2 50
+#define SPACE_RANK 2
+#define SPACE_DIM1 100
+#define SPACE_DIM2 200
+#define CHUNK_DIM1 50
+#define CHUNK_DIM2 50
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -49,55 +47,55 @@
int
main(void)
{
- hid_t fid = -1, sid = -1, did = -1, dcpl_id = -1;
- hsize_t dims[SPACE_RANK] = {SPACE_DIM1, SPACE_DIM2};
- hsize_t chunk_dims[SPACE_RANK] = {CHUNK_DIM1, CHUNK_DIM2};
- size_t i,j; /* Local index variables */
- int *data = NULL; /* Dataset data */
+ hid_t fid = -1, sid = -1, did = -1, dcpl_id = -1;
+ hsize_t dims[SPACE_RANK] = {SPACE_DIM1, SPACE_DIM2};
+ hsize_t chunk_dims[SPACE_RANK] = {CHUNK_DIM1, CHUNK_DIM2};
+ size_t i, j; /* Local index variables */
+ int * data = NULL; /* Dataset data */
/* Initialize the data */
/* (Try for something easily compressible) */
- if(NULL == (data = (int *)HDmalloc(SPACE_DIM1 * SPACE_DIM2 * sizeof(int))))
+ if (NULL == (data = (int *)HDmalloc(SPACE_DIM1 * SPACE_DIM2 * sizeof(int))))
TEST_ERROR
- for(i = 0; i < SPACE_DIM1; i++)
- for(j = 0; j < SPACE_DIM2; j++)
+ for (i = 0; i < SPACE_DIM1; i++)
+ for (j = 0; j < SPACE_DIM2; j++)
data[(i * SPACE_DIM2) + j] = (int)(j % 5);
/* Create the file */
- if((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create the dataspace */
- if((sid = H5Screate_simple(SPACE_RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(SPACE_RANK, dims, NULL)) < 0)
FAIL_STACK_ERROR
/* Create the dataset creation property list */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set up for deflated data */
- if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0)
FAIL_STACK_ERROR
- if(H5Pset_deflate(dcpl_id, 9) < 0)
+ if (H5Pset_deflate(dcpl_id, 9) < 0)
FAIL_STACK_ERROR
/* Create the compressed dataset */
- if((did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
FAIL_STACK_ERROR
/* Close everything */
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
HDfree(data);
@@ -105,15 +103,16 @@ main(void)
return EXIT_SUCCESS;
error:
- if(data)
+ if (data)
HDfree(data);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl_id);
H5Dclose(did);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/gen_file_image.c b/test/gen_file_image.c
index 9607cc2..44bf0d2 100644
--- a/test/gen_file_image.c
+++ b/test/gen_file_image.c
@@ -20,14 +20,13 @@
*/
#include "h5test.h"
-#define TESTFILE "file_image_core_test.h5"
+#define TESTFILE "file_image_core_test.h5"
/* 2-D dataset with fixed dimensions */
-#define SPACE_RANK 2
-#define SPACE_DIM1 128
-#define SPACE_DIM2 32
+#define SPACE_RANK 2
+#define SPACE_DIM1 128
+#define SPACE_DIM2 32
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -42,53 +41,54 @@ int
main(void)
{
hid_t fid = -1, sid = -1, did = -1;
- hsize_t dims[SPACE_RANK] = {SPACE_DIM1, SPACE_DIM2};
- size_t i,j; /* Local index variables */
- int *data = NULL; /* Dataset data */
+ hsize_t dims[SPACE_RANK] = {SPACE_DIM1, SPACE_DIM2};
+ size_t i, j; /* Local index variables */
+ int * data = NULL; /* Dataset data */
/* Initialize the data */
- if(NULL == (data = (int *)HDmalloc(SPACE_DIM1 * SPACE_DIM2 * sizeof(int))))
+ if (NULL == (data = (int *)HDmalloc(SPACE_DIM1 * SPACE_DIM2 * sizeof(int))))
TEST_ERROR
- for(i = 0; i < SPACE_DIM1; i++)
- for(j = 0; j < SPACE_DIM2; j++)
+ for (i = 0; i < SPACE_DIM1; i++)
+ for (j = 0; j < SPACE_DIM2; j++)
data[(i * SPACE_DIM2) + j] = (int)(j % 5);
/* Create the file */
- if((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create the dataspace */
- if((sid = H5Screate_simple(SPACE_RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(SPACE_RANK, dims, NULL)) < 0)
FAIL_STACK_ERROR
/* Create the compressed dataset */
- if((did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
FAIL_STACK_ERROR
/* Close everything */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
return EXIT_SUCCESS;
error:
- if(data)
+ if (data)
HDfree(data);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/gen_filespace.c b/test/gen_filespace.c
index bf49b7b..3803628 100644
--- a/test/gen_filespace.c
+++ b/test/gen_filespace.c
@@ -14,21 +14,21 @@
#include "hdf5.h"
#include <assert.h>
-#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
+#define NELMTS(X) (sizeof(X) / sizeof(X[0])) /* # of elements */
const char *FILENAMES[] = {
- "fsm_aggr_nopersist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + not persisting free-space */
- "fsm_aggr_persist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + persisting free-space */
- "paged_nopersist.h5", /* H5F_FSPACE_STRATEGY_PAGE + not persisting free-space */
- "paged_persist.h5", /* H5F_FSPACE_STRATEGY_PAGE + persisting free-space */
- "aggr.h5", /* H5F_FSPACE_STRATEGY_AGGR */
- "none.h5" /* H5F_FSPACE_STRATEGY_NONE */
+ "fsm_aggr_nopersist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + not persisting free-space */
+ "fsm_aggr_persist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + persisting free-space */
+ "paged_nopersist.h5", /* H5F_FSPACE_STRATEGY_PAGE + not persisting free-space */
+ "paged_persist.h5", /* H5F_FSPACE_STRATEGY_PAGE + persisting free-space */
+ "aggr.h5", /* H5F_FSPACE_STRATEGY_AGGR */
+ "none.h5" /* H5F_FSPACE_STRATEGY_NONE */
};
-#define DATASET "dset"
-#define NUM_ELMTS 100
-#define FALSE 0
-#define TRUE 1
+#define DATASET "dset"
+#define NUM_ELMTS 100
+#define FALSE 0
+#define TRUE 1
/*
* Compile and run this program in the trunk to generate
@@ -44,58 +44,61 @@ const char *FILENAMES[] = {
* compatibility testing via test_filespace_round_compatible() in test/tfile.c.
*
*/
-int main(void)
+int
+main(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list */
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dim[1]; /* Dimension sizes */
- int data[NUM_ELMTS]; /* Buffer for data */
- int i, j; /* Local index variables */
- H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
- unsigned fs_persist; /* Persisting free-space or not */
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dim[1]; /* Dimension sizes */
+ int data[NUM_ELMTS]; /* Buffer for data */
+ int i, j; /* Local index variables */
+ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
+ unsigned fs_persist; /* Persisting free-space or not */
j = 0;
- for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; fs_strategy++) {
- for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+ for (fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES;
+ fs_strategy++) {
+ for (fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
- if(fs_persist && fs_strategy >= H5F_FSPACE_STRATEGY_AGGR)
+ if (fs_persist && fs_strategy >= H5F_FSPACE_STRATEGY_AGGR)
continue;
/* Get a copy of the default file creation property */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto error;
- if(H5Pset_file_space_strategy(fcpl, fs_strategy, fs_persist, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, fs_strategy, fs_persist, (hsize_t)1) < 0)
goto error;
/* Create the file with the file space info */
- if((fid = H5Fcreate(FILENAMES[j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILENAMES[j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
goto error;
/* Create the dataset */
dim[0] = NUM_ELMTS;
- if((sid = H5Screate_simple(1, dim, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dim, NULL)) < 0)
goto error;
- if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
goto error;
- for(i = 0; i < NUM_ELMTS; i++)
+ for (i = 0; i < NUM_ELMTS; i++)
data[i] = i;
/* Write the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto error;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
goto error;
++j;
}
@@ -105,11 +108,13 @@ int main(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Sclose(did);
H5Pclose(fcpl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
diff --git a/test/gen_filters.c b/test/gen_filters.c
index ace86ba..502e041 100644
--- a/test/gen_filters.c
+++ b/test/gen_filters.c
@@ -13,18 +13,17 @@
#include "h5test.h"
-#define TESTFILE1 "test_filters.h5"
-#define TESTFILE2 "filter_error.h5"
-#define DSETNAME "dataset_with_filter"
+#define TESTFILE1 "test_filters.h5"
+#define TESTFILE2 "filter_error.h5"
+#define DSETNAME "dataset_with_filter"
/* Temporary filter IDs used for testing */
-#define H5Z_FILTER_BOGUS 305
+#define H5Z_FILTER_BOGUS 305
/* Local prototypes for filter functions */
-static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
-
/*-------------------------------------------------------------------------
* Function: create_file_with_bogus_filter
*
@@ -46,66 +45,78 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
static herr_t
test_filters_endianess(void)
{
- hid_t fid = -1; /* file ID */
- hid_t dsid = -1; /* dataset ID */
- hid_t sid = -1; /* dataspace ID */
- hid_t dcpl = -1; /* dataset creation property list ID */
- hsize_t dims[1] = {20}; /* dataspace dimensions */
- hsize_t chunk_dims[1] = {10}; /* chunk dimensions */
- int buf[20];
- int rank = 1;
- int i;
-
- for(i = 0; i < 20; i++)
+ hid_t fid = -1; /* file ID */
+ hid_t dsid = -1; /* dataset ID */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t dcpl = -1; /* dataset creation property list ID */
+ hsize_t dims[1] = {20}; /* dataspace dimensions */
+ hsize_t chunk_dims[1] = {10}; /* chunk dimensions */
+ int buf[20];
+ int rank = 1;
+ int i;
+
+ for (i = 0; i < 20; i++)
buf[i] = 1;
/* create a file using default properties */
- if((fid = H5Fcreate(TESTFILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if ((fid = H5Fcreate(TESTFILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* create a data space */
- if((sid = H5Screate_simple(rank, dims, NULL)) < 0) goto error;
+ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ goto error;
/* create dcpl */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dcpl, rank, chunk_dims) < 0) goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, rank, chunk_dims) < 0)
+ goto error;
- if(H5Pset_fletcher32(dcpl) < 0) goto error;
+ if (H5Pset_fletcher32(dcpl) < 0)
+ goto error;
/* create a dataset */
- if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
+ if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error;
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
/* close */
- if(H5Pclose(dcpl) < 0) goto error;
- if(H5Dclose(dsid) < 0) goto error;
- if(H5Sclose(sid) < 0) goto error;
- if(H5Fclose(fid) < 0) goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Dclose(dsid) < 0)
+ goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_filters_endianess() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "bogus", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_bogus, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_BOGUS, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "bogus", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_bogus, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: filter_bogus
*
@@ -122,13 +133,12 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
*/
static size_t
filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
+ void H5_ATTR_UNUSED **buf)
{
return nbytes;
}
-
/*-------------------------------------------------------------------------
* Function: create_file_with_bogus_filter
*
@@ -146,59 +156,72 @@ filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
static herr_t
create_file_with_bogus_filter(void)
{
- hid_t fid = -1; /* file ID */
- hid_t dsid = -1; /* dataset ID */
- hid_t sid = -1; /* dataspace ID */
- hid_t dcpl = -1; /* dataset creation property list ID */
- hsize_t dims[1] = {20}; /* dataspace dimensions */
- hsize_t chunk_dims[1] = {10}; /* chunk dimensions */
- int buf[20];
- int rank = 1;
- int i;
-
- for(i = 0; i < 20; i++)
+ hid_t fid = -1; /* file ID */
+ hid_t dsid = -1; /* dataset ID */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t dcpl = -1; /* dataset creation property list ID */
+ hsize_t dims[1] = {20}; /* dataspace dimensions */
+ hsize_t chunk_dims[1] = {10}; /* chunk dimensions */
+ int buf[20];
+ int rank = 1;
+ int i;
+
+ for (i = 0; i < 20; i++)
buf[i] = 1;
/* create a file using default properties */
- if((fid = H5Fcreate(TESTFILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if ((fid = H5Fcreate(TESTFILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* create a data space */
- if((sid = H5Screate_simple(rank, dims, NULL)) < 0) goto error;
+ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ goto error;
/* create dcpl */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
/* create chunking */
- if(H5Pset_chunk(dcpl, rank, chunk_dims) < 0) goto error;
+ if (H5Pset_chunk(dcpl, rank, chunk_dims) < 0)
+ goto error;
/* register bogus filter */
- if(H5Zregister (H5Z_BOGUS) < 0) goto error;
- if(H5Pset_filter(dcpl, H5Z_FILTER_BOGUS, 0, (size_t)0, NULL) < 0) goto error;
+ if (H5Zregister(H5Z_BOGUS) < 0)
+ goto error;
+ if (H5Pset_filter(dcpl, H5Z_FILTER_BOGUS, 0, (size_t)0, NULL) < 0)
+ goto error;
/* create a dataset */
- if((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
+ if ((dsid = H5Dcreate2(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error;
+ if (H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
/* close */
- if(H5Pclose(dcpl) < 0) goto error;
- if(H5Dclose(dsid) < 0) goto error;
- if(H5Sclose(sid) < 0) goto error;
- if(H5Fclose(fid) < 0) goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Dclose(dsid) < 0)
+ goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(dsid);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -213,20 +236,19 @@ error:
int
main(void)
{
- int nerrors = 0;
+ int nerrors = 0;
- nerrors += test_filters_endianess() < 0 ? 1 : 0;
- nerrors += create_file_with_bogus_filter() < 0 ? 1 : 0;
+ nerrors += test_filters_endianess() < 0 ? 1 : 0;
+ nerrors += create_file_with_bogus_filter() < 0 ? 1 : 0;
- if(nerrors)
- goto error;
- printf("All tests passed.\n");
+ if (nerrors)
+ goto error;
+ printf("All tests passed.\n");
- return 0;
+ return 0;
error:
- nerrors = MAX(1, nerrors);
- printf("***** %d GEN_FILTERS FAILURES *****\n", nerrors);
- return 1;
+ nerrors = MAX(1, nerrors);
+ printf("***** %d GEN_FILTERS FAILURES *****\n", nerrors);
+ return 1;
}
-
diff --git a/test/gen_mergemsg.c b/test/gen_mergemsg.c
index 6633eb0..7284786 100644
--- a/test/gen_mergemsg.c
+++ b/test/gen_mergemsg.c
@@ -25,25 +25,26 @@
#include <stdio.h>
#include "hdf5.h"
-#define FILENAME "mergemsg.h5"
-#define GROUP1 "grp1"
-#define GROUP2 "grp2"
-#define GROUP3 "grp3"
-#define ATTR1 "__111111111111__"
-#define ATTR1_LEN 11
-#define ATTR2 "__222222222__"
-#define ATTR2_LEN 11
-#define ATTR3 "__333333333__"
-#define ATTR3_LEN 1
-
-int main()
+#define FILENAME "mergemsg.h5"
+#define GROUP1 "grp1"
+#define GROUP2 "grp2"
+#define GROUP3 "grp3"
+#define ATTR1 "__111111111111__"
+#define ATTR1_LEN 11
+#define ATTR2 "__222222222__"
+#define ATTR2_LEN 11
+#define ATTR3 "__333333333__"
+#define ATTR3_LEN 1
+
+int
+main()
{
- hid_t fid; /* File ID */
- hid_t gid, gid2, gid3; /* Group IDs */
- hid_t aid; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t gid, gid2, gid3; /* Group IDs */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ herr_t ret; /* Generic return value */
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -69,7 +70,6 @@ int main()
ret = H5Fclose(fid);
assert(ret >= 0);
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
assert(fid > 0);
@@ -138,7 +138,6 @@ int main()
ret = H5Fclose(fid);
assert(ret >= 0);
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
assert(fid > 0);
@@ -167,9 +166,6 @@ int main()
ret = H5Fclose(fid);
assert(ret >= 0);
-
-
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
assert(fid > 0);
@@ -212,8 +208,6 @@ int main()
ret = H5Fclose(fid);
assert(ret >= 0);
-
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
assert(fid > 0);
@@ -260,7 +254,6 @@ int main()
ret = H5Fclose(fid);
assert(ret >= 0);
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
assert(fid > 0);
@@ -281,7 +274,6 @@ int main()
ret = H5Fclose(fid);
assert(ret >= 0);
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
assert(fid > 0);
@@ -324,7 +316,5 @@ int main()
ret = H5Fclose(fid);
assert(ret >= 0);
- return(0);
+ return (0);
}
-
-
diff --git a/test/gen_new_array.c b/test/gen_new_array.c
index 041b691..605b421 100644
--- a/test/gen_new_array.c
+++ b/test/gen_new_array.c
@@ -28,18 +28,17 @@
*/
#include "hdf5.h"
-#define TESTFILE "tarrnew.h5"
+#define TESTFILE "tarrnew.h5"
/* 1-D array datatype */
-#define ARRAY1_RANK 1
+#define ARRAY1_RANK 1
#define ARRAY1_DIM1 4
/* 2-D dataset with fixed dimensions */
-#define SPACE1_RANK 2
-#define SPACE1_DIM1 8
-#define SPACE1_DIM2 9
+#define SPACE1_RANK 2
+#define SPACE1_DIM1 8
+#define SPACE1_DIM2 9
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -59,75 +58,75 @@
int
main(void)
{
- typedef struct { /* Typedef for compound datatype */
- short i;
- float f[ARRAY1_DIM1];
- long l[ARRAY1_DIM1];
+ typedef struct { /* Typedef for compound datatype */
+ short i;
+ float f[ARRAY1_DIM1];
+ long l[ARRAY1_DIM1];
double d;
} s3_t;
- hid_t file, space, type, arr_type, dset;
- hsize_t tdims1[] = {ARRAY1_DIM1};
- hsize_t cur_dim[SPACE1_RANK]={SPACE1_DIM1,SPACE1_DIM2};
- herr_t ret; /* Generic return value */
+ hid_t file, space, type, arr_type, dset;
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ hsize_t cur_dim[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2};
+ herr_t ret; /* Generic return value */
/* Create the file */
file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file<0)
+ if (file < 0)
printf("file<0!\n");
/* Create the dataspace (for both datasets) */
space = H5Screate_simple(SPACE1_RANK, cur_dim, NULL);
- if(space<0)
+ if (space < 0)
printf("space<0!\n");
/* Create the compound datatype with array fields */
type = H5Tcreate(H5T_COMPOUND, sizeof(s3_t));
- if(type<0)
+ if (type < 0)
printf("type<0!\n");
/* Insert integer field */
- ret = H5Tinsert (type, "i", HOFFSET(s3_t,i), H5T_NATIVE_SHORT);
- if(ret<0)
+ ret = H5Tinsert(type, "i", HOFFSET(s3_t, i), H5T_NATIVE_SHORT);
+ if (ret < 0)
printf("field 1 insert<0!\n");
/* Creat the array datatype */
arr_type = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1);
- if(arr_type < 0)
+ if (arr_type < 0)
printf("arr_type<0!\n");
/* Insert float array field */
- ret = H5Tinsert (type, "f", HOFFSET(s3_t,f), arr_type);
- if(ret<0)
+ ret = H5Tinsert(type, "f", HOFFSET(s3_t, f), arr_type);
+ if (ret < 0)
printf("field 3 insert<0!\n");
/* Close array datatype */
- ret = H5Tclose (arr_type);
- if(ret<0)
+ ret = H5Tclose(arr_type);
+ if (ret < 0)
printf("field 3 array close<0!\n");
/* Creat the array datatype */
arr_type = H5Tarray_create2(H5T_NATIVE_LONG, ARRAY1_RANK, tdims1);
- if(arr_type < 0)
+ if (arr_type < 0)
printf("arr_type<0!\n");
/* Insert long array field */
- ret = H5Tinsert (type, "l", HOFFSET(s3_t,l), arr_type);
- if(ret<0)
+ ret = H5Tinsert(type, "l", HOFFSET(s3_t, l), arr_type);
+ if (ret < 0)
printf("field 3 insert<0!\n");
/* Close array datatype */
- ret = H5Tclose (arr_type);
- if(ret<0)
+ ret = H5Tclose(arr_type);
+ if (ret < 0)
printf("field 3 array close<0!\n");
/* Insert double field */
- ret = H5Tinsert (type, "d", HOFFSET(s3_t,d), H5T_NATIVE_DOUBLE);
- if(ret<0)
+ ret = H5Tinsert(type, "d", HOFFSET(s3_t, d), H5T_NATIVE_DOUBLE);
+ if (ret < 0)
printf("field 4 insert<0!\n");
/* Create the dataset with compound array fields */
dset = H5Dcreate2(file, "Dataset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset<0)
+ if (dset < 0)
printf("dset<0!\n");
H5Dclose(dset);
@@ -136,12 +135,12 @@ main(void)
/* Create the compound datatype with array fields */
type = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1);
- if(type < 0)
+ if (type < 0)
printf("type<0!\n");
/* Create the dataset with array datatype */
dset = H5Dcreate2(file, "Dataset2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset<0)
+ if (dset < 0)
printf("dset<0!\n");
H5Dclose(dset);
@@ -153,4 +152,3 @@ main(void)
return 0;
}
-
diff --git a/test/gen_new_fill.c b/test/gen_new_fill.c
index c012d8b..0080f3f 100644
--- a/test/gen_new_fill.c
+++ b/test/gen_new_fill.c
@@ -31,57 +31,74 @@
int
main(void)
{
- hid_t file=-1, dcpl=-1, space=-1, dset1=-1, dset2=-1;
- hsize_t cur_size[2]={8, 8};
- H5D_space_status_t allocation;
- int fill_val1 = 4444, fill_val2=5555;
+ hid_t file = -1, dcpl = -1, space = -1, dset1 = -1, dset2 = -1;
+ hsize_t cur_size[2] = {8, 8};
+ H5D_space_status_t allocation;
+ int fill_val1 = 4444, fill_val2 = 5555;
- if((file=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) <0) goto error;
- if((space=H5Screate_simple(2, cur_size, cur_size)) < 0) goto error;
- if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if ((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if ((space = H5Screate_simple(2, cur_size, cur_size)) < 0)
+ goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
/* Create a dataset with space being allocated and fill value written */
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error;
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill_val1) < 0) goto error;
- if((dset1 = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
- if(H5Dget_space_status(dset1, &allocation) < 0) goto error;
- if(allocation == H5D_SPACE_STATUS_NOT_ALLOCATED) {
- puts(" Got unallocated space instead of allocated.");
- printf(" Got %d\n", allocation);
- goto error;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill_val1) < 0)
+ goto error;
+ if ((dset1 = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dget_space_status(dset1, &allocation) < 0)
+ goto error;
+ if (allocation == H5D_SPACE_STATUS_NOT_ALLOCATED) {
+ puts(" Got unallocated space instead of allocated.");
+ printf(" Got %d\n", allocation);
+ goto error;
}
- if(H5Dclose(dset1) < 0) goto error;
+ if (H5Dclose(dset1) < 0)
+ goto error;
/* Create a dataset with space allocation being delayed */
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) goto error;
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill_val2) < 0) goto error;
- if((dset2 = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
- if(H5Dget_space_status(dset2, &allocation) < 0) goto error;
- if(allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) {
- puts(" Got allocated space instead of unallocated.");
- printf(" Got %d\n", allocation);
- goto error;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
+ goto error;
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ goto error;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill_val2) < 0)
+ goto error;
+ if ((dset2 = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dget_space_status(dset2, &allocation) < 0)
+ goto error;
+ if (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) {
+ puts(" Got allocated space instead of unallocated.");
+ printf(" Got %d\n", allocation);
+ goto error;
}
- if(H5Dclose(dset2) < 0) goto error;
+ if (H5Dclose(dset2) < 0)
+ goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Pclose(dcpl) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(space);
H5Dclose(dset1);
H5Dclose(dset2);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
-
diff --git a/test/gen_new_group.c b/test/gen_new_group.c
index 42a751f..f3f7357 100644
--- a/test/gen_new_group.c
+++ b/test/gen_new_group.c
@@ -29,75 +29,95 @@
#define FILENAME "group_new.h5"
-int main(void)
+int
+main(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t gid = -1; /* Group creation property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t gid = -1; /* Group creation property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error;
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
/* Adjust group creation parameters for root group */
/* (So that it is created in "dense storage" form) */
- if(H5Pset_link_phase_change(fcpl, 0, 0) < 0) goto error;
+ if (H5Pset_link_phase_change(fcpl, 0, 0) < 0)
+ goto error;
/* Copy the file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) goto error;
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
/* Create file for test groups */
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) <0) goto error;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ goto error;
/* Close file access property list */
- if(H5Pclose(fapl) < 0) goto error;
+ if (H5Pclose(fapl) < 0)
+ goto error;
/* Close file creation property list */
- if(H5Pclose(fcpl) < 0) goto error;
+ if (H5Pclose(fcpl) < 0)
+ goto error;
/* Create dataspace for datasets */
- if((sid = H5Screate(H5S_SCALAR)) < 0) goto error;
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ goto error;
/* Create empty group (w/default group creation properties) */
- if((gid = H5Gcreate2(fid, "empty", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Gclose(gid) < 0) goto error;
+ if ((gid = H5Gcreate2(fid, "empty", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(gid) < 0)
+ goto error;
/* Create group which will contain link messages (w/default group creation properties) */
- if((gid = H5Gcreate2(fid, "links", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if ((gid = H5Gcreate2(fid, "links", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* Create dataset in group */
- if((did = H5Dcreate2(gid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Dclose(did)<0) goto error;
+ if ((did = H5Dcreate2(gid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
/* Create second dataset in group */
- if((did = H5Dcreate2(gid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Dclose(did)<0) goto error;
+ if ((did = H5Dcreate2(gid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
/* Close dataspace */
- if(H5Sclose(sid) < 0) goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
/* Close group */
- if(H5Gclose(gid) < 0) goto error;
+ if (H5Gclose(gid) < 0)
+ goto error;
/* Close file */
- if(H5Fclose(fid) < 0) goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
H5Gclose(gid);
H5Pclose(fcpl);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
-
diff --git a/test/gen_new_mtime.c b/test/gen_new_mtime.c
index 90259c7..a0b5064 100644
--- a/test/gen_new_mtime.c
+++ b/test/gen_new_mtime.c
@@ -26,9 +26,8 @@
#include "hdf5.h"
-#define TESTFILE "tmtimen.h5"
+#define TESTFILE "tmtimen.h5"
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -48,21 +47,21 @@
int
main(void)
{
- hid_t file, space, dset;
+ hid_t file, space, dset;
/* Create the file */
file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file<0)
+ if (file < 0)
printf("file<0!\n");
/* Create the dataspace (for dataset) */
space = H5Screate(H5S_SCALAR);
- if(space<0)
+ if (space < 0)
printf("space<0!\n");
/* Create the dataset with compound array fields */
dset = H5Dcreate2(file, "Dataset1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset<0)
+ if (dset < 0)
printf("dset<0!\n");
H5Dclose(dset);
@@ -71,5 +70,3 @@ main(void)
return 0;
}
-
-
diff --git a/test/gen_new_super.c b/test/gen_new_super.c
index 36f2187..c3c22c1 100644
--- a/test/gen_new_super.c
+++ b/test/gen_new_super.c
@@ -25,10 +25,9 @@
#include "h5test.h"
-#define TESTFILE "tsupern.h5"
-#define ISTORE_IK 64
+#define TESTFILE "tsupern.h5"
+#define ISTORE_IK 64
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -44,15 +43,15 @@
int
main(void)
{
- hid_t file; /* File IDs for old & new files */
- hid_t fcpl; /* File creation property list */
- herr_t H5_ATTR_NDEBUG_UNUSED ret;
+ hid_t file; /* File IDs for old & new files */
+ hid_t fcpl; /* File creation property list */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret;
/* Create a file creation property list */
fcpl = H5Pcreate(H5P_FILE_CREATE);
HDassert(fcpl >= 0);
- ret = H5Pset_istore_k(fcpl,ISTORE_IK);
+ ret = H5Pset_istore_k(fcpl, ISTORE_IK);
HDassert(ret >= 0);
/* Creating a file with the non-default file creation property list should
@@ -60,7 +59,7 @@ main(void)
*/
/* Create file with custom file creation property list */
- file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT);
+ file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
HDassert(file >= 0);
/* Close FCPL */
@@ -73,4 +72,3 @@ main(void)
return EXIT_SUCCESS;
}
-
diff --git a/test/gen_noencoder.c b/test/gen_noencoder.c
index e6ac9cf..9b68bcd 100644
--- a/test/gen_noencoder.c
+++ b/test/gen_noencoder.c
@@ -32,18 +32,18 @@
int
main(void)
{
- hid_t file_id;
- hid_t dset_id;
- hid_t dcpl_id;
- hid_t space_id;
+ hid_t file_id;
+ hid_t dset_id;
+ hid_t dcpl_id;
+ hid_t space_id;
hsize_t dims, maxdims;
- int fill = 0;
- int write_buf[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ int fill = 0;
+ int write_buf[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
file_id = H5Fcreate("noencoder.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- dims = 10;
- maxdims = H5S_UNLIMITED;
+ dims = 10;
+ maxdims = H5S_UNLIMITED;
space_id = H5Screate_simple(1, &dims, &maxdims);
dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
@@ -52,8 +52,9 @@ main(void)
H5Pset_fill_value(dcpl_id, H5T_NATIVE_INT, &fill);
H5Pset_fill_time(dcpl_id, H5D_FILL_TIME_ALLOC);
-/* Create dataset noencoder_szip_dset.h5 */
- dset_id = H5Dcreate2(file_id, "noencoder_szip_dset.h5", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ /* Create dataset noencoder_szip_dset.h5 */
+ dset_id = H5Dcreate2(file_id, "noencoder_szip_dset.h5", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_id,
+ H5P_DEFAULT);
H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf);
@@ -68,8 +69,9 @@ main(void)
H5Pset_fill_value(dcpl_id, H5T_NATIVE_INT, &fill);
H5Pset_fill_time(dcpl_id, H5D_FILL_TIME_ALLOC);
-/* Create dataset noencoder_szip_shuffle_fletcher_dset.h5 */
- dset_id = H5Dcreate2(file_id, "noencoder_szip_shuffle_fletcher_dset.h5", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ /* Create dataset noencoder_szip_shuffle_fletcher_dset.h5 */
+ dset_id = H5Dcreate2(file_id, "noencoder_szip_shuffle_fletcher_dset.h5", H5T_NATIVE_INT, space_id,
+ H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf);
@@ -78,6 +80,5 @@ main(void)
H5Sclose(space_id);
H5Fclose(file_id);
- return(0);
+ return (0);
}
-
diff --git a/test/gen_nullspace.c b/test/gen_nullspace.c
index 26df3f1..9002309 100644
--- a/test/gen_nullspace.c
+++ b/test/gen_nullspace.c
@@ -26,19 +26,19 @@
#include "h5test.h"
-#define NULLFILE "tnullspace.h5"
-#define NULLDATASET "null_dataset"
-#define NULLATTR "null_attribute"
+#define NULLFILE "tnullspace.h5"
+#define NULLDATASET "null_dataset"
+#define NULLATTR "null_attribute"
int
main(void)
{
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
- hid_t sid; /* Dataspace ID */
- hid_t did; /* Dataset ID */
- hid_t attr; /* Attribute ID */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t did; /* Dataset ID */
+ hid_t attr; /* Attribute ID */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Create the file */
fid = H5Fcreate(NULLFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -81,5 +81,3 @@ main(void)
return EXIT_SUCCESS;
}
-
-
diff --git a/test/gen_old_array.c b/test/gen_old_array.c
index 402fd40..54e4101 100644
--- a/test/gen_old_array.c
+++ b/test/gen_old_array.c
@@ -27,18 +27,17 @@
*/
#include "hdf5.h"
-#define TESTFILE "tarrold.h5"
+#define TESTFILE "tarrold.h5"
/* 1-D array datatype */
-#define ARRAY1_RANK 1
+#define ARRAY1_RANK 1
#define ARRAY1_DIM1 4
/* 2-D dataset with fixed dimensions */
-#define SPACE1_RANK 2
-#define SPACE1_DIM1 8
-#define SPACE1_DIM2 9
+#define SPACE1_RANK 2
+#define SPACE1_DIM1 8
+#define SPACE1_DIM2 9
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -58,55 +57,55 @@
int
main(void)
{
- typedef struct { /* Typedef for compound datatype */
+ typedef struct { /* Typedef for compound datatype */
short i;
float f;
- long l;
+ long l;
} s2_t;
- typedef struct { /* Typedef for compound datatype */
- short i;
- float f[ARRAY1_DIM1];
- long l[ARRAY1_DIM1];
+ typedef struct { /* Typedef for compound datatype */
+ short i;
+ float f[ARRAY1_DIM1];
+ long l[ARRAY1_DIM1];
double d;
} s3_t;
- hid_t file, space, type, dset;
- size_t tdims1[] = {ARRAY1_DIM1};
- hsize_t cur_dim[SPACE1_RANK]={SPACE1_DIM1,SPACE1_DIM2};
- herr_t ret; /* Generic return value */
+ hid_t file, space, type, dset;
+ size_t tdims1[] = {ARRAY1_DIM1};
+ hsize_t cur_dim[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2};
+ herr_t ret; /* Generic return value */
/* Create the file */
file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file<0)
+ if (file < 0)
printf("file<0!\n");
/* Create the dataspace (for both datasets) */
space = H5Screate_simple(SPACE1_RANK, cur_dim, NULL);
- if(space<0)
+ if (space < 0)
printf("space<0!\n");
/* Create the compound datatype with non-array fields */
type = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
- if(type<0)
+ if (type < 0)
printf("type<0!\n");
/* Insert integer field */
- ret = H5Tinsert (type, "i", HOFFSET(s2_t,i), H5T_NATIVE_SHORT);
- if(ret<0)
+ ret = H5Tinsert(type, "i", HOFFSET(s2_t, i), H5T_NATIVE_SHORT);
+ if (ret < 0)
printf("field 1 insert<0!\n");
/* Insert float field */
- ret = H5Tinsert (type, "f", HOFFSET(s2_t,f), H5T_NATIVE_FLOAT);
- if(ret<0)
+ ret = H5Tinsert(type, "f", HOFFSET(s2_t, f), H5T_NATIVE_FLOAT);
+ if (ret < 0)
printf("field 3 insert<0!\n");
/* Insert long field */
- ret = H5Tinsert (type, "l", HOFFSET(s2_t,l), H5T_NATIVE_LONG);
- if(ret<0)
+ ret = H5Tinsert(type, "l", HOFFSET(s2_t, l), H5T_NATIVE_LONG);
+ if (ret < 0)
printf("field 3 insert<0!\n");
/* Create the dataset with compound non-array fields */
dset = H5Dcreate2(file, "Dataset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset<0)
+ if (dset < 0)
printf("dset<0!\n");
H5Dclose(dset);
@@ -115,32 +114,32 @@ main(void)
/* Create the compound datatype with array fields */
type = H5Tcreate(H5T_COMPOUND, sizeof(s3_t));
- if(type<0)
+ if (type < 0)
printf("type<0!\n");
/* Insert integer field */
- ret = H5Tinsert (type, "i", HOFFSET(s3_t,i), H5T_NATIVE_SHORT);
- if(ret<0)
+ ret = H5Tinsert(type, "i", HOFFSET(s3_t, i), H5T_NATIVE_SHORT);
+ if (ret < 0)
printf("field 1 insert<0!\n");
/* Insert float array field */
- ret = H5Tinsert_array (type, "f", HOFFSET(s3_t,f), ARRAY1_RANK, tdims1, NULL, H5T_NATIVE_FLOAT);
- if(ret<0)
+ ret = H5Tinsert_array(type, "f", HOFFSET(s3_t, f), ARRAY1_RANK, tdims1, NULL, H5T_NATIVE_FLOAT);
+ if (ret < 0)
printf("field 3 insert<0!\n");
/* Insert long array field */
- ret = H5Tinsert_array (type, "l", HOFFSET(s3_t,l), ARRAY1_RANK, tdims1, NULL, H5T_NATIVE_LONG);
- if(ret<0)
+ ret = H5Tinsert_array(type, "l", HOFFSET(s3_t, l), ARRAY1_RANK, tdims1, NULL, H5T_NATIVE_LONG);
+ if (ret < 0)
printf("field 3 insert<0!\n");
/* Insert double field */
- ret = H5Tinsert (type, "d", HOFFSET(s3_t,d), H5T_NATIVE_DOUBLE);
- if(ret<0)
+ ret = H5Tinsert(type, "d", HOFFSET(s3_t, d), H5T_NATIVE_DOUBLE);
+ if (ret < 0)
printf("field 4 insert<0!\n");
/* Create the dataset with compound array fields */
dset = H5Dcreate2(file, "Dataset2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset<0)
+ if (dset < 0)
printf("dset<0!\n");
H5Dclose(dset);
diff --git a/test/gen_old_group.c b/test/gen_old_group.c
index 55dbde3..b584493 100644
--- a/test/gen_old_group.c
+++ b/test/gen_old_group.c
@@ -31,28 +31,34 @@
#define FILENAME "group_old.h5"
-int main(void)
+int
+main(void)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group creation property list ID */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group creation property list ID */
/* Create file for test groups */
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) <0) goto error;
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* Create empty group that uses "symbol table" form to store links */
- if((gid = H5Gcreate2(fid, "old", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Gclose(gid) < 0) goto error;
+ if ((gid = H5Gcreate2(fid, "old", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(gid) < 0)
+ goto error;
/* Close file */
- if(H5Fclose(fid) < 0) goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
-
diff --git a/test/gen_old_layout.c b/test/gen_old_layout.c
index 0210786..4e56ae7 100644
--- a/test/gen_old_layout.c
+++ b/test/gen_old_layout.c
@@ -30,11 +30,10 @@
#include "hdf5.h"
#define TESTFILE "tlayouto.h5"
-#define SPACE_RANK 2
-#define SPACE_DIM0 (8*1024*1024*1024ULL)
-#define SPACE_DIM1 ((256*1024*1024ULL)+1ULL)
+#define SPACE_RANK 2
+#define SPACE_DIM0 (8 * 1024 * 1024 * 1024ULL)
+#define SPACE_DIM1 ((256 * 1024 * 1024ULL) + 1ULL)
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -54,34 +53,34 @@
int
main(void)
{
- hid_t file, space, dset, dcpl;
- herr_t ret;
- unsigned rank=SPACE_RANK; /* Rank of dataspace */
- hsize_t big_dims[SPACE_RANK]={SPACE_DIM0,SPACE_DIM1}; /* Large dimensions */
+ hid_t file, space, dset, dcpl;
+ herr_t ret;
+ unsigned rank = SPACE_RANK; /* Rank of dataspace */
+ hsize_t big_dims[SPACE_RANK] = {SPACE_DIM0, SPACE_DIM1}; /* Large dimensions */
/* Create the file */
file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file<0)
+ if (file < 0)
printf("file<0!\n");
/* Create the dataspace (for dataset) */
- space = H5Screate_simple(rank,big_dims,NULL);
- if(space<0)
+ space = H5Screate_simple(rank, big_dims, NULL);
+ if (space < 0)
printf("space<0!\n");
/* Create a dataset creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl<0)
+ if (dcpl < 0)
printf("dcpl<0!\n");
/* Make certain that the dataset's storage doesn't get allocated :-) */
- ret = H5Pset_alloc_time(dcpl,H5D_ALLOC_TIME_LATE);
- if(ret<0)
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE);
+ if (ret < 0)
printf("H5Pset_alloc_time() failed!\n");
/* Create the dataset with deferred storage allocation */
dset = H5Dcreate2(file, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if(dset<0)
+ if (dset < 0)
printf("dset<0!\n");
H5Dclose(dset);
@@ -91,4 +90,3 @@ main(void)
return 0;
}
-
diff --git a/test/gen_old_mtime.c b/test/gen_old_mtime.c
index e72c9b1..d4e1544 100644
--- a/test/gen_old_mtime.c
+++ b/test/gen_old_mtime.c
@@ -26,9 +26,8 @@
#include "hdf5.h"
-#define TESTFILE "tmtimeo.h5"
+#define TESTFILE "tmtimeo.h5"
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -48,21 +47,21 @@
int
main(void)
{
- hid_t file, space, dset;
+ hid_t file, space, dset;
/* Create the file */
file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file<0)
+ if (file < 0)
printf("file<0!\n");
/* Create the dataspace (for dataset) */
space = H5Screate(H5S_SCALAR);
- if(space<0)
+ if (space < 0)
printf("space<0!\n");
/* Create the dataset with compound array fields */
dset = H5Dcreate2(file, "Dataset1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset<0)
+ if (dset < 0)
printf("dset<0!\n");
H5Dclose(dset);
@@ -71,6 +70,3 @@ main(void)
return 0;
}
-
-
-
diff --git a/test/gen_plist.c b/test/gen_plist.c
index b6f5597..d0c7b4e 100644
--- a/test/gen_plist.c
+++ b/test/gen_plist.c
@@ -23,75 +23,70 @@ static int encode_plist(hid_t plist_id, int little_endian, int word_length, cons
int
main(void)
{
- hid_t dcpl1; /* dataset create prop. list */
- hid_t dapl1; /* dataset access prop. list */
- hid_t dxpl1; /* dataset xfer prop. list */
- hid_t gcpl1; /* group create prop. list */
- hid_t ocpypl1; /* object copy prop. list */
- hid_t ocpl1; /* object create prop. list */
- hid_t lcpl1; /* link create prop. list */
- hid_t lapl1; /* link access prop. list */
- hid_t fapl1; /* file access prop. list */
- hid_t fcpl1; /* file create prop. list */
- hid_t strcpl1; /* string create prop. list */
- hid_t acpl1; /* attribute create prop. list */
-
- herr_t ret = 0;
- hsize_t chunk_size = 16384; /* chunk size */
- int fill = 2; /* Fill value */
- hsize_t max_size[1]; /* data space maximum size */
- size_t nslots = 521 * 2;
- size_t nbytes = 1048576 * 10;
- double w0 = 0.5f;
- unsigned max_compact;
- unsigned min_dense;
- const char* c_to_f = "x+32";
- int little_endian;
- int word_length;
- H5AC_cache_config_t my_cache_config = {
- H5AC__CURR_CACHE_CONFIG_VERSION,
- 1 /*TRUE*/,
- 0 /*FALSE*/,
- 0 /*FALSE*/,
- "temp",
- 1 /*TRUE*/,
- 0 /*FALSE*/,
- ( 2 * 2048 * 1024),
- 0.3f,
- (64 * 1024 * 1024),
- (4 * 1024 * 1024),
- 60000,
- H5C_incr__threshold,
- 0.8f,
- 3.0f,
- 1 /*TRUE*/,
- (8 * 1024 * 1024),
- H5C_flash_incr__add_space,
- 2.0f,
- 0.25f,
- H5C_decr__age_out_with_threshold,
- 0.997f,
- 0.8f,
- 1 /*TRUE*/,
- (3 * 1024 * 1024),
- 3,
- 0 /*FALSE*/,
- 0.2f,
- (256 * 2048),
- H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY};
- H5AC_cache_image_config_t my_cache_image_config = {
- H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
- TRUE,
- FALSE,
- -1};
-
+ hid_t dcpl1; /* dataset create prop. list */
+ hid_t dapl1; /* dataset access prop. list */
+ hid_t dxpl1; /* dataset xfer prop. list */
+ hid_t gcpl1; /* group create prop. list */
+ hid_t ocpypl1; /* object copy prop. list */
+ hid_t ocpl1; /* object create prop. list */
+ hid_t lcpl1; /* link create prop. list */
+ hid_t lapl1; /* link access prop. list */
+ hid_t fapl1; /* file access prop. list */
+ hid_t fcpl1; /* file create prop. list */
+ hid_t strcpl1; /* string create prop. list */
+ hid_t acpl1; /* attribute create prop. list */
+
+ herr_t ret = 0;
+ hsize_t chunk_size = 16384; /* chunk size */
+ int fill = 2; /* Fill value */
+ hsize_t max_size[1]; /* data space maximum size */
+ size_t nslots = 521 * 2;
+ size_t nbytes = 1048576 * 10;
+ double w0 = 0.5f;
+ unsigned max_compact;
+ unsigned min_dense;
+ const char * c_to_f = "x+32";
+ int little_endian;
+ int word_length;
+ H5AC_cache_config_t my_cache_config = {H5AC__CURR_CACHE_CONFIG_VERSION,
+ 1 /*TRUE*/,
+ 0 /*FALSE*/,
+ 0 /*FALSE*/,
+ "temp",
+ 1 /*TRUE*/,
+ 0 /*FALSE*/,
+ (2 * 2048 * 1024),
+ 0.3f,
+ (64 * 1024 * 1024),
+ (4 * 1024 * 1024),
+ 60000,
+ H5C_incr__threshold,
+ 0.8f,
+ 3.0f,
+ 1 /*TRUE*/,
+ (8 * 1024 * 1024),
+ H5C_flash_incr__add_space,
+ 2.0f,
+ 0.25f,
+ H5C_decr__age_out_with_threshold,
+ 0.997f,
+ 0.8f,
+ 1 /*TRUE*/,
+ (3 * 1024 * 1024),
+ 3,
+ 0 /*FALSE*/,
+ 0.2f,
+ (256 * 2048),
+ H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY};
+ H5AC_cache_image_config_t my_cache_image_config = {H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, TRUE, FALSE,
+ -1};
/* check endianess */
{
short int word = 0x0001;
- char *byte = (char *) &word;
+ char * byte = (char *)&word;
- if(byte[0] == 1)
+ if (byte[0] == 1)
/* little endian */
little_endian = 1;
else
@@ -108,153 +103,147 @@ main(void)
H5open();
/******* ENCODE/DECODE DCPLS *****/
- if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
assert(dcpl1 > 0);
- if((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/def_dcpl_")) < 0)
+ if ((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/def_dcpl_")) < 0)
assert(ret > 0);
- if((ret = H5Pset_chunk(dcpl1, 1, &chunk_size)) < 0)
+ if ((ret = H5Pset_chunk(dcpl1, 1, &chunk_size)) < 0)
assert(ret > 0);
- if((ret = H5Pset_alloc_time(dcpl1, H5D_ALLOC_TIME_LATE)) < 0)
+ if ((ret = H5Pset_alloc_time(dcpl1, H5D_ALLOC_TIME_LATE)) < 0)
assert(ret > 0);
ret = H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32BE, (size_t)1, &fill, NULL, H5P_DEFAULT);
assert(ret >= 0);
- if((ret = H5Pset_fill_value(dcpl1, H5T_STD_I32BE, &fill)) < 0)
+ if ((ret = H5Pset_fill_value(dcpl1, H5T_STD_I32BE, &fill)) < 0)
assert(ret > 0);
- if((ret = H5Pset_dset_no_attrs_hint(dcpl1, FALSE)) < 0)
+ if ((ret = H5Pset_dset_no_attrs_hint(dcpl1, FALSE)) < 0)
assert(ret > 0);
max_size[0] = 100;
- if((ret = H5Pset_external(dcpl1, "ext1.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ if ((ret = H5Pset_external(dcpl1, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0)
assert(ret > 0);
- if((ret = H5Pset_external(dcpl1, "ext2.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ if ((ret = H5Pset_external(dcpl1, "ext2.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0)
assert(ret > 0);
- if((ret = H5Pset_external(dcpl1, "ext3.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ if ((ret = H5Pset_external(dcpl1, "ext3.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0)
assert(ret > 0);
- if((ret = H5Pset_external(dcpl1, "ext4.data", (off_t)0,
- (hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
+ if ((ret = H5Pset_external(dcpl1, "ext4.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) / 4))) < 0)
assert(ret > 0);
- if((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/dcpl_")) < 0)
+ if ((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/dcpl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(dcpl1)) < 0)
- assert(ret > 0);
-
+ if ((ret = H5Pclose(dcpl1)) < 0)
+ assert(ret > 0);
/******* ENCODE/DECODE DAPLS *****/
- if((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
assert(dapl1 > 0);
- if((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/def_dapl_")) < 0)
+ if ((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/def_dapl_")) < 0)
assert(ret > 0);
- if((ret = H5Pset_chunk_cache(dapl1, nslots, nbytes, w0)) < 0)
+ if ((ret = H5Pset_chunk_cache(dapl1, nslots, nbytes, w0)) < 0)
assert(ret > 0);
- if((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/dapl_")) < 0)
+ if ((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/dapl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(dapl1)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pclose(dapl1)) < 0)
+ assert(ret > 0);
/******* ENCODE/DECODE DXPLS *****/
- if((dxpl1 = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl1 = H5Pcreate(H5P_DATASET_XFER)) < 0)
assert(dxpl1 > 0);
- if((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/def_dxpl_")) < 0)
+ if ((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/def_dxpl_")) < 0)
assert(ret > 0);
- if((ret = H5Pset_btree_ratios(dxpl1, 0.2f, 0.6f, 0.2f)) < 0)
+ if ((ret = H5Pset_btree_ratios(dxpl1, 0.2f, 0.6f, 0.2f)) < 0)
assert(ret > 0);
- if((ret = H5Pset_hyper_vector_size(dxpl1, 5)) < 0)
+ if ((ret = H5Pset_hyper_vector_size(dxpl1, 5)) < 0)
assert(ret > 0);
#ifdef H5_HAVE_PARALLEL
- if((ret = H5Pset_dxpl_mpio(dxpl1, H5FD_MPIO_COLLECTIVE)) < 0)
+ if ((ret = H5Pset_dxpl_mpio(dxpl1, H5FD_MPIO_COLLECTIVE)) < 0)
assert(ret > 0);
- if((ret = H5Pset_dxpl_mpio_collective_opt(dxpl1, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
+ if ((ret = H5Pset_dxpl_mpio_collective_opt(dxpl1, H5FD_MPIO_INDIVIDUAL_IO)) < 0)
assert(ret > 0);
- if((ret = H5Pset_dxpl_mpio_chunk_opt(dxpl1, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
+ if ((ret = H5Pset_dxpl_mpio_chunk_opt(dxpl1, H5FD_MPIO_CHUNK_MULTI_IO)) < 0)
assert(ret > 0);
- if((ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl1, 30)) < 0)
+ if ((ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl1, 30)) < 0)
assert(ret > 0);
- if((ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl1, 40)) < 0)
+ if ((ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl1, 40)) < 0)
assert(ret > 0);
-#endif/* H5_HAVE_PARALLEL */
- if((ret = H5Pset_edc_check(dxpl1, H5Z_DISABLE_EDC)) < 0)
+#endif /* H5_HAVE_PARALLEL */
+ if ((ret = H5Pset_edc_check(dxpl1, H5Z_DISABLE_EDC)) < 0)
assert(ret > 0);
- if((ret = H5Pset_data_transform(dxpl1, c_to_f)) < 0)
+ if ((ret = H5Pset_data_transform(dxpl1, c_to_f)) < 0)
assert(ret > 0);
- if((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/dxpl_")) < 0)
+ if ((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/dxpl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(dxpl1)) < 0)
- assert(ret > 0);
-
+ if ((ret = H5Pclose(dxpl1)) < 0)
+ assert(ret > 0);
/******* ENCODE/DECODE GCPLS *****/
- if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ if ((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0)
assert(gcpl1 > 0);
- if((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/def_gcpl_")) < 0)
+ if ((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/def_gcpl_")) < 0)
assert(ret > 0);
- if((ret = H5Pset_local_heap_size_hint(gcpl1, 256)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pset_local_heap_size_hint(gcpl1, 256)) < 0)
+ assert(ret > 0);
- if((ret = H5Pset_link_phase_change(gcpl1, 2, 2)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pset_link_phase_change(gcpl1, 2, 2)) < 0)
+ assert(ret > 0);
/* Query the group creation properties */
- if((ret = H5Pget_link_phase_change(gcpl1, &max_compact, &min_dense)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pget_link_phase_change(gcpl1, &max_compact, &min_dense)) < 0)
+ assert(ret > 0);
- if((ret = H5Pset_est_link_info(gcpl1, 3, 9)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pset_est_link_info(gcpl1, 3, 9)) < 0)
+ assert(ret > 0);
- if((ret = H5Pset_link_creation_order(gcpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
- assert(ret > 0);
+ if ((ret = H5Pset_link_creation_order(gcpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ assert(ret > 0);
- if((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/gcpl_")) < 0)
+ if ((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/gcpl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(gcpl1)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pclose(gcpl1)) < 0)
+ assert(ret > 0);
/******* ENCODE/DECODE LCPLS *****/
- if((lcpl1 = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ if ((lcpl1 = H5Pcreate(H5P_LINK_CREATE)) < 0)
assert(lcpl1 > 0);
- if((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/def_lcpl_")) < 0)
+ if ((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/def_lcpl_")) < 0)
assert(ret > 0);
- if((ret = H5Pset_create_intermediate_group(lcpl1, 1 /*TRUE*/)) < 0)
+ if ((ret = H5Pset_create_intermediate_group(lcpl1, 1 /*TRUE*/)) < 0)
assert(ret > 0);
- if((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/lcpl_")) < 0)
+ if ((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/lcpl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(lcpl1)) < 0)
+ if ((ret = H5Pclose(lcpl1)) < 0)
assert(ret > 0);
/******* ENCODE/DECODE OCPYLS *****/
- if((ocpypl1 = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ if ((ocpypl1 = H5Pcreate(H5P_OBJECT_COPY)) < 0)
assert(ocpypl1 > 0);
- if((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/def_ocpypl_")) < 0)
+ if ((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/def_ocpypl_")) < 0)
assert(ret > 0);
ret = H5Pset_copy_object(ocpypl1, H5O_COPY_EXPAND_EXT_LINK_FLAG);
@@ -266,152 +255,152 @@ main(void)
ret = H5Padd_merge_committed_dtype_path(ocpypl1, "bar");
assert(ret >= 0);
- if((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/ocpypl_")) < 0)
+ if ((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/ocpypl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(ocpypl1)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pclose(ocpypl1)) < 0)
+ assert(ret > 0);
/******* ENCODE/DECODE OCPLS *****/
- if((ocpl1 = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
+ if ((ocpl1 = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
assert(ocpl1 > 0);
- if((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/def_ocpl_")) < 0)
+ if ((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/def_ocpl_")) < 0)
assert(ret > 0);
- if((ret = H5Pset_attr_creation_order(ocpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
- assert(ret > 0);
+ if ((ret = H5Pset_attr_creation_order(ocpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0)
+ assert(ret > 0);
- if((ret = H5Pset_attr_phase_change (ocpl1, 110, 105)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pset_attr_phase_change(ocpl1, 110, 105)) < 0)
+ assert(ret > 0);
- if((ret = H5Pset_filter (ocpl1, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
+ if ((ret = H5Pset_filter(ocpl1, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0)
assert(ret > 0);
- if((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/ocpl_")) < 0)
+ if ((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/ocpl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(ocpl1)) < 0)
+ if ((ret = H5Pclose(ocpl1)) < 0)
assert(ret > 0);
/******* ENCODE/DECODE LAPLS *****/
- if((lapl1 = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ if ((lapl1 = H5Pcreate(H5P_LINK_ACCESS)) < 0)
assert(lapl1 > 0);
- if((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/def_lapl_")) < 0)
+ if ((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/def_lapl_")) < 0)
assert(ret > 0);
- if((ret = H5Pset_nlinks(lapl1, (size_t)134)) < 0)
+ if ((ret = H5Pset_nlinks(lapl1, (size_t)134)) < 0)
assert(ret > 0);
- if((ret = H5Pset_elink_acc_flags(lapl1, H5F_ACC_RDONLY)) < 0)
+ if ((ret = H5Pset_elink_acc_flags(lapl1, H5F_ACC_RDONLY)) < 0)
assert(ret > 0);
- if((ret = H5Pset_elink_prefix(lapl1, "/tmpasodiasod")) < 0)
+ if ((ret = H5Pset_elink_prefix(lapl1, "/tmpasodiasod")) < 0)
assert(ret > 0);
/* Create FAPL for the elink FAPL */
- if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
assert(fapl1 > 0);
- if((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0)
+ if ((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0)
assert(ret > 0);
- if((ret = H5Pset_elink_fapl(lapl1, fapl1)) < 0)
+ if ((ret = H5Pset_elink_fapl(lapl1, fapl1)) < 0)
assert(ret > 0);
/* Close the elink's FAPL */
- if((ret = H5Pclose(fapl1)) < 0)
+ if ((ret = H5Pclose(fapl1)) < 0)
assert(ret > 0);
- if((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/lapl_")) < 0)
+ if ((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/lapl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(lapl1)) < 0)
+ if ((ret = H5Pclose(lapl1)) < 0)
assert(ret > 0);
/******* ENCODE/DECODE FAPLS *****/
- if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
assert(fapl1 > 0);
- if((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/def_fapl_")) < 0)
+ if ((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/def_fapl_")) < 0)
assert(ret > 0);
- if((ret = H5Pset_family_offset(fapl1, 1024)) < 0)
+ if ((ret = H5Pset_family_offset(fapl1, 1024)) < 0)
assert(ret > 0);
- if((ret = H5Pset_meta_block_size(fapl1, 2098452)) < 0)
+ if ((ret = H5Pset_meta_block_size(fapl1, 2098452)) < 0)
assert(ret > 0);
- if((ret = H5Pset_sieve_buf_size(fapl1, 1048576)) < 0)
+ if ((ret = H5Pset_sieve_buf_size(fapl1, 1048576)) < 0)
assert(ret > 0);
- if((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0)
+ if ((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0)
assert(ret > 0);
- if((ret = H5Pset_cache(fapl1, 1024, 128, 10485760, 0.3f)) < 0)
+ if ((ret = H5Pset_cache(fapl1, 1024, 128, 10485760, 0.3f)) < 0)
assert(ret > 0);
- if((ret = H5Pset_elink_file_cache_size(fapl1, 10485760)) < 0)
+ if ((ret = H5Pset_elink_file_cache_size(fapl1, 10485760)) < 0)
assert(ret > 0);
- if((ret = H5Pset_gc_references(fapl1, 1)) < 0)
+ if ((ret = H5Pset_gc_references(fapl1, 1)) < 0)
assert(ret > 0);
- if((ret = H5Pset_small_data_block_size(fapl1, 2048)) < 0)
+ if ((ret = H5Pset_small_data_block_size(fapl1, 2048)) < 0)
assert(ret > 0);
- if((ret = H5Pset_libver_bounds(fapl1, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
+ if ((ret = H5Pset_libver_bounds(fapl1, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
assert(ret > 0);
- if((ret = H5Pset_fclose_degree(fapl1, H5F_CLOSE_WEAK)) < 0)
+ if ((ret = H5Pset_fclose_degree(fapl1, H5F_CLOSE_WEAK)) < 0)
assert(ret > 0);
- if((ret = H5Pset_multi_type(fapl1, H5FD_MEM_GHEAP)) < 0)
+ if ((ret = H5Pset_multi_type(fapl1, H5FD_MEM_GHEAP)) < 0)
assert(ret > 0);
- if((ret = H5Pset_mdc_config(fapl1, &my_cache_config)) < 0)
+ if ((ret = H5Pset_mdc_config(fapl1, &my_cache_config)) < 0)
assert(ret > 0);
- if((ret = H5Pset_mdc_image_config(fapl1, &my_cache_image_config)) < 0)
+ if ((ret = H5Pset_mdc_image_config(fapl1, &my_cache_image_config)) < 0)
assert(ret > 0);
- if((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/fapl_")) < 0)
+ if ((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/fapl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(fapl1)) < 0)
+ if ((ret = H5Pclose(fapl1)) < 0)
assert(ret > 0);
/******* ENCODE/DECODE FCPLS *****/
- if((fcpl1 = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl1 = H5Pcreate(H5P_FILE_CREATE)) < 0)
assert(fcpl1 > 0);
- if((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/def_fcpl_")) < 0)
+ if ((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/def_fcpl_")) < 0)
assert(ret > 0);
- if((ret = H5Pset_userblock(fcpl1, 1024) < 0))
- assert(ret > 0);
+ if ((ret = H5Pset_userblock(fcpl1, 1024) < 0))
+ assert(ret > 0);
- if((ret = H5Pset_istore_k(fcpl1, 3) < 0))
- assert(ret > 0);
+ if ((ret = H5Pset_istore_k(fcpl1, 3) < 0))
+ assert(ret > 0);
- if((ret = H5Pset_sym_k(fcpl1, 4, 5) < 0))
- assert(ret > 0);
+ if ((ret = H5Pset_sym_k(fcpl1, 4, 5) < 0))
+ assert(ret > 0);
- if((ret = H5Pset_shared_mesg_nindexes(fcpl1, 8) < 0))
- assert(ret > 0);
+ if ((ret = H5Pset_shared_mesg_nindexes(fcpl1, 8) < 0))
+ assert(ret > 0);
- if((ret = H5Pset_shared_mesg_index(fcpl1, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
- assert(ret > 0);
+ if ((ret = H5Pset_shared_mesg_index(fcpl1, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0))
+ assert(ret > 0);
- if((ret = H5Pset_shared_mesg_phase_change(fcpl1, 60, 20) < 0))
- assert(ret > 0);
+ if ((ret = H5Pset_shared_mesg_phase_change(fcpl1, 60, 20) < 0))
+ assert(ret > 0);
- if((ret = H5Pset_sizes(fcpl1, 8, 4) < 0))
- assert(ret > 0);
+ if ((ret = H5Pset_sizes(fcpl1, 8, 4) < 0))
+ assert(ret > 0);
- if((ret = H5Pset_file_space_strategy(fcpl1, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pset_file_space_strategy(fcpl1, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1)) < 0)
+ assert(ret > 0);
- if((ret = H5Pset_file_space_page_size(fcpl1, (hsize_t)4096)) < 0)
- assert(ret > 0);
+ if ((ret = H5Pset_file_space_page_size(fcpl1, (hsize_t)4096)) < 0)
+ assert(ret > 0);
- if((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/fcpl_")) < 0)
+ if ((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/fcpl_")) < 0)
assert(ret > 0);
/* release resource */
- if((ret = H5Pclose(fcpl1)) < 0)
+ if ((ret = H5Pclose(fcpl1)) < 0)
assert(ret > 0);
/******* ENCODE/DECODE STRCPLS *****/
@@ -454,25 +443,26 @@ main(void)
static int
encode_plist(hid_t plist_id, int little_endian, int word_length, const char *filename_prefix)
{
- int fd = 0; /* file descriptor */
- herr_t ret = 0;
- void *temp_buf = NULL;
- size_t temp_size = 0;
+ int fd = 0; /* file descriptor */
+ herr_t ret = 0;
+ void * temp_buf = NULL;
+ size_t temp_size = 0;
ssize_t H5_ATTR_NDEBUG_UNUSED write_size;
- char filename[1024];
+ char filename[1024];
/* Generate filename */
- if((ret = HDsnprintf(filename, sizeof(filename), "%s%d%s", filename_prefix, word_length, little_endian ? "le" : "be")) < 0)
+ if ((ret = HDsnprintf(filename, sizeof(filename), "%s%d%s", filename_prefix, word_length,
+ little_endian ? "le" : "be")) < 0)
HDassert(ret > 0);
/* first call to encode returns only the size of the buffer needed */
- if((ret = H5Pencode2(plist_id, NULL, &temp_size, H5P_DEFAULT)) < 0)
+ if ((ret = H5Pencode2(plist_id, NULL, &temp_size, H5P_DEFAULT)) < 0)
HDassert(ret > 0);
temp_buf = (void *)HDmalloc(temp_size);
HDassert(temp_buf);
- if((ret = H5Pencode2(plist_id, temp_buf, &temp_size, H5P_DEFAULT)) < 0)
+ if ((ret = H5Pencode2(plist_id, temp_buf, &temp_size, H5P_DEFAULT)) < 0)
HDassert(ret > 0);
fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
@@ -487,4 +477,3 @@ encode_plist(hid_t plist_id, int little_endian, int word_length, const char *fil
return 1;
}
-
diff --git a/test/gen_sizes_lheap.c b/test/gen_sizes_lheap.c
index 0e62019..7a689b4 100644
--- a/test/gen_sizes_lheap.c
+++ b/test/gen_sizes_lheap.c
@@ -23,8 +23,7 @@
#include "hdf5.h"
-#define TESTFILE "tsizeslheap.h5"
-
+#define TESTFILE "tsizeslheap.h5"
/*-------------------------------------------------------------------------
* Function: main
@@ -45,30 +44,30 @@
int
main(void)
{
- hid_t file, space, dset, fcpl;
+ hid_t file, space, dset, fcpl;
/* Create the FCPL */
fcpl = H5Pcreate(H5P_FILE_CREATE);
- if(fcpl < 0)
+ if (fcpl < 0)
printf("fcpl < 0!\n");
/* Set sizeof_addr and sizeof_size to be 4 */
- if(H5Pset_sizes(fcpl, 4, 4) < 0)
+ if (H5Pset_sizes(fcpl, 4, 4) < 0)
printf("H5Pset_sizes < 0!\n");
/* Create the file */
file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
- if(file < 0)
+ if (file < 0)
printf("file < 0!\n");
/* Create the dataspace (for dataset) */
space = H5Screate(H5S_SCALAR);
- if(space < 0)
+ if (space < 0)
printf("space < 0!\n");
/* Create the dataset with compound array fields */
dset = H5Dcreate2(file, "Dataset1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset < 0)
+ if (dset < 0)
printf("dset < 0!\n");
H5Dclose(dset);
diff --git a/test/gen_specmetaread.c b/test/gen_specmetaread.c
index ca44f9a..4156d79 100644
--- a/test/gen_specmetaread.c
+++ b/test/gen_specmetaread.c
@@ -23,27 +23,26 @@
* the library on the trunk as of when this file is checked in.
*/
-
#include "h5test.h"
-#define FILENAME "specmetaread.h5"
-#define DIM 10
+#define FILENAME "specmetaread.h5"
+#define DIM 10
int
main(void)
{
- hid_t fid;
- hid_t fapl;
- hid_t did;
- hid_t space;
- hsize_t dim[1] = {DIM};
- unsigned data[DIM];
- unsigned u;
- herr_t H5_ATTR_NDEBUG_UNUSED ret;
+ hid_t fid;
+ hid_t fapl;
+ hid_t did;
+ hid_t space;
+ hsize_t dim[1] = {DIM};
+ unsigned data[DIM];
+ unsigned u;
+ herr_t H5_ATTR_NDEBUG_UNUSED ret;
/* Initialize the data */
- for(u = 0; u < DIM; u++)
- data[u] = u;
+ for (u = 0; u < DIM; u++)
+ data[u] = u;
/* Create a FAPL with the metadata and small data aggregators turned off */
fapl = H5Pcreate(H5P_FILE_ACCESS);
@@ -91,4 +90,3 @@ main(void)
return 0;
}
-
diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c
index 456cb5c..323709c 100644
--- a/test/gen_udlinks.c
+++ b/test/gen_udlinks.c
@@ -25,64 +25,74 @@
#include "hdf5.h"
#include <string.h>
-#define NAME_LE_1 "le_extlink1.h5"
-#define NAME_LE_2 "le_extlink2.h5"
-#define NAME_BE_1 "be_extlink1.h5"
-#define NAME_BE_2 "be_extlink2.h5"
+#define NAME_LE_1 "le_extlink1.h5"
+#define NAME_LE_2 "le_extlink2.h5"
+#define NAME_BE_1 "be_extlink1.h5"
+#define NAME_BE_2 "be_extlink2.h5"
#define NAME_BUF_SIZE 25
int
-main (void)
+main(void)
{
- hid_t fid1=-1;
- hid_t fid2=-1;
- hid_t gid=-1;
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
+ hid_t fid1 = -1;
+ hid_t fid2 = -1;
+ hid_t gid = -1;
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
- /* Name the files differently depending on the endianness of this platform */
+ /* Name the files differently depending on the endianness of this platform */
- switch(H5Tget_order(H5T_NATIVE_INT))
- {
- case H5T_ORDER_LE:
- strcpy(filename1, NAME_LE_1);
- strcpy(filename2, NAME_LE_2);
- break;
- case H5T_ORDER_BE:
- strcpy(filename1, NAME_BE_1);
- strcpy(filename2, NAME_BE_2);
- break;
- case H5T_ORDER_ERROR:
- case H5T_ORDER_VAX:
- case H5T_ORDER_MIXED:
- case H5T_ORDER_NONE:
- default:
- goto error;
- }
+ switch (H5Tget_order(H5T_NATIVE_INT)) {
+ case H5T_ORDER_LE:
+ strcpy(filename1, NAME_LE_1);
+ strcpy(filename2, NAME_LE_2);
+ break;
+ case H5T_ORDER_BE:
+ strcpy(filename1, NAME_BE_1);
+ strcpy(filename2, NAME_BE_2);
+ break;
+ case H5T_ORDER_ERROR:
+ case H5T_ORDER_VAX:
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_NONE:
+ default:
+ goto error;
+ }
- /* Create the two files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ /* Create the two files */
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
- /* Create two groups in the second file */
- if((gid = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if((H5Gclose(gid)) < 0) goto error;
- if((gid = H5Gcreate2(fid2, "group/subgroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if((H5Gclose(gid)) < 0) goto error;
+ /* Create two groups in the second file */
+ if ((gid = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if ((H5Gclose(gid)) < 0)
+ goto error;
+ if ((gid = H5Gcreate2(fid2, "group/subgroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if ((H5Gclose(gid)) < 0)
+ goto error;
- /* Create an external link in the first file pointing to the group in the second file */
- if(H5Lcreate_external(filename2, "group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) goto error;
+ /* Create an external link in the first file pointing to the group in the second file */
+ if (H5Lcreate_external(filename2, "group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto error;
- if((H5Fclose(fid1)) < 0) goto error;
- if((H5Fclose(fid2)) < 0) goto error;
+ if ((H5Fclose(fid1)) < 0)
+ goto error;
+ if ((H5Fclose(fid2)) < 0)
+ goto error;
- return 0;
+ return 0;
error:
- H5E_BEGIN_TRY {
- H5Fclose(fid1);
- H5Fclose(fid2);
- H5Gclose(gid);
- } H5E_END_TRY
- return 1;
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(fid1);
+ H5Fclose(fid2);
+ H5Gclose(gid);
+ }
+ H5E_END_TRY
+ return 1;
}
diff --git a/test/genall5.c b/test/genall5.c
index 3f55930..41fd86a 100644
--- a/test/genall5.c
+++ b/test/genall5.c
@@ -22,12 +22,11 @@
#include "cache_common.h"
#include "genall5.h"
-#define DSET_DIMS (1024 * 1024)
-#define DSET_SMALL_DIMS (64 * 1024)
-#define DSET_CHUNK_DIMS 1024
+#define DSET_DIMS (1024 * 1024)
+#define DSET_SMALL_DIMS (64 * 1024)
+#define DSET_CHUNK_DIMS 1024
#define DSET_COMPACT_DIMS 4096
-
/*-------------------------------------------------------------------------
* Function: ns_grp_0
*
@@ -48,16 +47,17 @@
*/
void
-ns_grp_0(hid_t fid, const char *group_name) {
- hid_t gid = -1;
- hid_t gcpl = -1;
+ns_grp_0(hid_t fid, const char *group_name)
+{
+ hid_t gid = -1;
+ hid_t gcpl = -1;
herr_t ret;
if (pass) {
gcpl = H5Pcreate(H5P_GROUP_CREATE);
if (gcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_0: H5Pcreate() failed";
}
HDassert(gcpl > 0);
@@ -67,7 +67,7 @@ ns_grp_0(hid_t fid, const char *group_name) {
ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_0: H5Pset_link_creation_order() failed";
}
HDassert(ret >= 0);
@@ -77,7 +77,7 @@ ns_grp_0(hid_t fid, const char *group_name) {
gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT);
if (gid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_0: H5Gcreate2() failed";
}
HDassert(gid > 0);
@@ -87,7 +87,7 @@ ns_grp_0(hid_t fid, const char *group_name) {
ret = H5Pclose(gcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_0: H5Pclose(gcpl) failed";
}
HDassert(ret >= 0);
@@ -97,7 +97,7 @@ ns_grp_0(hid_t fid, const char *group_name) {
ret = H5Gclose(gid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_0: H5Gclose(gid) failed";
}
HDassert(ret >= 0);
@@ -107,7 +107,6 @@ ns_grp_0(hid_t fid, const char *group_name) {
} /* ns_grp_0 */
-
/*-------------------------------------------------------------------------
* Function: vrfy_ns_grp_0
*
@@ -127,18 +126,20 @@ ns_grp_0(hid_t fid, const char *group_name) {
*-------------------------------------------------------------------------
*/
-void vrfy_ns_grp_0(hid_t fid, const char *group_name) {
- hid_t gid = -1;
- hid_t gcpl = -1;
+void
+vrfy_ns_grp_0(hid_t fid, const char *group_name)
+{
+ hid_t gid = -1;
+ hid_t gcpl = -1;
H5G_info_t grp_info;
- unsigned crt_order_flags = 0;
- herr_t ret;
+ unsigned crt_order_flags = 0;
+ herr_t ret;
if (pass) {
gid = H5Gopen2(fid, group_name, H5P_DEFAULT);
if (gid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_0: H5Gopen2() failed";
}
HDassert(gid > 0);
@@ -148,7 +149,7 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) {
gcpl = H5Gget_create_plist(gid);
if (gcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_0: H5Gget_create_plist() failed";
}
HDassert(gcpl > 0);
@@ -158,13 +159,12 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) {
ret = H5Pget_link_creation_order(gcpl, &crt_order_flags);
if (gcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_0: H5Pget_link_creation_order() failed";
}
- else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags) {
- pass = FALSE;
- failure_mssg =
- "vrfy_ns_grp_0: H5P_CRT_ORDER_TRACKED != crt_order_flags";
+ else if (H5P_CRT_ORDER_TRACKED != crt_order_flags) {
+ pass = FALSE;
+ failure_mssg = "vrfy_ns_grp_0: H5P_CRT_ORDER_TRACKED != crt_order_flags";
}
HDassert(ret >= 0);
HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags);
@@ -174,7 +174,7 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) {
ret = H5Pclose(gcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_0: H5Pclose() failed";
}
HDassert(ret >= 0);
@@ -185,24 +185,23 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) {
ret = H5Gget_info(gid, &grp_info);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_0: H5Gget_info() failed";
}
else if (H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type) {
- pass = FALSE;
- failure_mssg =
- "vrfy_ns_grp_0: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type";
+ pass = FALSE;
+ failure_mssg = "vrfy_ns_grp_0: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type";
}
else if (0 != grp_info.nlinks) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.nlinks";
}
else if (0 != grp_info.max_corder) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.max_corder";
}
- else if ( FALSE != grp_info.mounted) {
- pass = FALSE;
+ else if (FALSE != grp_info.mounted) {
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_0: FALSE != grp_info.mounted";
}
@@ -217,7 +216,7 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) {
ret = H5Gclose(gid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_0: H5Gclose() failed";
}
HDassert(ret >= 0);
@@ -226,7 +225,6 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) {
return;
} /* vrfy_ns_grp_0() */
-
/*-------------------------------------------------------------------------
* Function: ns_grp_c
*
@@ -247,18 +245,19 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) {
*/
void
-ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
- hid_t gid = -1;
- hid_t gcpl = -1;
+ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks)
+{
+ hid_t gid = -1;
+ hid_t gcpl = -1;
unsigned max_compact;
unsigned u;
- herr_t ret;
+ herr_t ret;
if (pass) {
gcpl = H5Pcreate(H5P_GROUP_CREATE);
if (gcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: H5Pcreate(H5P_GROUP_CREATE) failed";
}
HDassert(gcpl > 0);
@@ -268,7 +267,7 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: H5Pset_link_creation_order() failed";
}
HDassert(ret >= 0);
@@ -278,7 +277,7 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT);
if (gid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: H5Gcreate2() failed";
}
HDassert(gid > 0);
@@ -286,18 +285,18 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
if (pass) {
max_compact = 0;
- ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL);
+ ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: H5Pget_link_phase_change() failed";
}
else if (nlinks <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: nlinks <= 0";
}
else if (nlinks >= max_compact) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: nlinks >= max_compact";
}
@@ -316,28 +315,26 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: H5Lcreate_soft() failed";
}
HDassert(ret >= 0);
} /* end if */
else if (1 == (u % 3)) {
- ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT,
- H5P_DEFAULT);
+ ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: H5Lcreate_hard() failed";
}
HDassert(ret >= 0);
} /* end else-if */
else {
HDassert(2 == (u % 3));
- ret = H5Lcreate_external("external.h5", "/ext", gid, linkname,
- H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: H5Lcreate_external() failed";
}
HDassert(ret >= 0);
@@ -350,7 +347,7 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Pclose(gcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: H5Pclose(gcpl) failed";
}
HDassert(ret >= 0);
@@ -360,7 +357,7 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Gclose(gid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_c: H5Gclose(gid) failed";
}
HDassert(ret >= 0);
@@ -370,7 +367,6 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
} /* ns_grp_c() */
-
/*-------------------------------------------------------------------------
* Function: vrfy_ns_grp_c
*
@@ -391,19 +387,20 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
*/
void
-vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
- hid_t gid = -1;
- hid_t gcpl = -1;
+vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks)
+{
+ hid_t gid = -1;
+ hid_t gcpl = -1;
H5G_info_t grp_info;
- unsigned crt_order_flags = 0;
- unsigned u;
- herr_t ret;
+ unsigned crt_order_flags = 0;
+ unsigned u;
+ herr_t ret;
if (pass) {
gid = H5Gopen2(fid, group_name, H5P_DEFAULT);
if (gid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Gopen2() failed";
}
HDassert(gid > 0);
@@ -413,7 +410,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
gcpl = H5Gget_create_plist(gid);
if (gcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Gget_create_plist(gid) failed";
}
HDassert(gcpl > 0);
@@ -423,11 +420,11 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Pget_link_creation_order(gcpl, &crt_order_flags);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Pget_link_creation_order() failed";
}
- else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags) {
- pass = FALSE;
+ else if (H5P_CRT_ORDER_TRACKED != crt_order_flags) {
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5P_CRT_ORDER_TRACKED != crt_order_flags";
}
HDassert(ret >= 0);
@@ -438,7 +435,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Pclose(gcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Pclose() failed";
}
HDassert(ret >= 0);
@@ -449,24 +446,23 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Gget_info(gid, &grp_info);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Gget_info() failed";
}
else if (H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type) {
- pass = FALSE;
- failure_mssg =
- "vrfy_ns_grp_c: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type";
+ pass = FALSE;
+ failure_mssg = "vrfy_ns_grp_c: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type";
}
else if (nlinks != grp_info.nlinks) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.nlinks";
}
else if (nlinks != grp_info.max_corder) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.max_corder";
}
- else if ( FALSE != grp_info.mounted) {
- pass = FALSE;
+ else if (FALSE != grp_info.mounted) {
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: FALSE != grp_info.mounted";
}
@@ -480,14 +476,14 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
u = 0;
while ((pass) && (u < nlinks)) {
H5L_info2_t lnk_info;
- char linkname[16];
- htri_t link_exists;
+ char linkname[16];
+ htri_t link_exists;
HDsprintf(linkname, "%u", u);
link_exists = H5Lexists(gid, linkname, H5P_DEFAULT);
if (link_exists < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Lexists() failed";
}
HDassert(link_exists >= 0);
@@ -496,19 +492,19 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Lget_info() failed";
}
- else if ( TRUE != lnk_info.corder_valid) {
- pass = FALSE;
+ else if (TRUE != lnk_info.corder_valid) {
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: TRUE != lnk_info.corder_valid";
}
else if (u != lnk_info.corder) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: u != lnk_info.corder";
}
else if (H5T_CSET_ASCII != lnk_info.cset) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5T_CSET_ASCII != lnk_info.cset";
}
HDassert(ret >= 0);
@@ -520,32 +516,31 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
char *slinkval;
if (H5L_TYPE_SOFT != lnk_info.type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_SOFT != lnk_info.type";
}
else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: (HDstrlen(group_name) + 1) != lnk_info.u.val_size";
}
HDassert(H5L_TYPE_SOFT == lnk_info.type);
HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size);
- slinkval = (char *) HDmalloc(lnk_info.u.val_size);
+ slinkval = (char *)HDmalloc(lnk_info.u.val_size);
if (!slinkval) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: HDmalloc of slinkval failed";
}
HDassert(slinkval);
- ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size,
- H5P_DEFAULT);
+ ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed";
}
else if (0 != HDstrcmp(slinkval, group_name)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(slinkval, group_name)";
}
HDassert(ret >= 0);
@@ -555,10 +550,10 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
} /* end if */
else if (1 == (u % 3)) {
H5O_info2_t root_oinfo;
- int token_cmp = 0;
+ int token_cmp = 0;
if (H5L_TYPE_HARD != lnk_info.type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_HARD != lnk_info.type";
}
HDassert(H5L_TYPE_HARD == lnk_info.type);
@@ -567,17 +562,17 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Oget_info() failed.";
}
else {
- if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) {
- pass = FALSE;
+ if (H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) {
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Otoken_cmp() failed.";
}
if (token_cmp) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: root_oinfo.token != lnk_info.u.token";
}
}
@@ -585,14 +580,14 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
HDassert(!token_cmp);
} /* end else-if */
else {
- void *elinkval;
+ void * elinkval;
const char *file = NULL;
const char *path = NULL;
HDassert(2 == (u % 3));
if (H5L_TYPE_EXTERNAL != lnk_info.type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_EXTERNAL != lnk_info.type";
}
HDassert(H5L_TYPE_EXTERNAL == lnk_info.type);
@@ -600,30 +595,29 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
elinkval = HDmalloc(lnk_info.u.val_size);
if (!elinkval) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: HDmalloc of elinkval failed.";
}
HDassert(elinkval);
- ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size,
- H5P_DEFAULT);
+ ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed.";
}
HDassert(ret >= 0);
ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, &file, &path);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Lunpack_elink_val() failed.";
}
else if (0 != HDstrcmp(file, "external.h5")) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(file, \"external.h5\")";
}
else if (0 != HDstrcmp(path, "/ext")) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(path, \"/ext\")";
}
HDassert(ret >= 0);
@@ -640,7 +634,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Gclose(gid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Gclose() failed.";
}
HDassert(ret >= 0);
@@ -649,7 +643,6 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
return;
} /* vrfy_ns_grp_c() */
-
/*-------------------------------------------------------------------------
* Function: ns_grp_d
*
@@ -670,18 +663,19 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
*/
void
-ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
- hid_t gid = -1;
- hid_t gcpl = -1;
+ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks)
+{
+ hid_t gid = -1;
+ hid_t gcpl = -1;
unsigned max_compact;
unsigned u;
- herr_t ret;
+ herr_t ret;
if (pass) {
gcpl = H5Pcreate(H5P_GROUP_CREATE);
if (gcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: H5Pcreate() failed.";
}
HDassert(gcpl > 0);
@@ -691,7 +685,7 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: H5Pset_link_creation_order() failed.";
}
HDassert(ret >= 0);
@@ -701,7 +695,7 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT);
if (gid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: H5Gcreate2() failed.";
}
HDassert(gid > 0);
@@ -709,14 +703,14 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
if (pass) {
max_compact = 0;
- ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL);
+ ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: H5Pget_link_phase_change() failed.";
}
else if (nlinks <= max_compact) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: nlinks <= max_compact";
}
HDassert(ret >= 0);
@@ -730,21 +724,19 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
HDsprintf(linkname, "%u", u);
if (0 == (u % 3)) {
- ret = H5Lcreate_soft(group_name, gid, linkname,
- H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: H5Lcreate_soft() failed.";
}
HDassert(ret >= 0);
} /* end if */
else if (1 == (u % 3)) {
- ret = H5Lcreate_hard(fid, "/", gid, linkname,
- H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: H5Lcreate_hard() failed.";
}
HDassert(ret >= 0);
@@ -752,11 +744,10 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
else {
HDassert(2 == (u % 3));
- ret = H5Lcreate_external("external.h5", "/ext", gid, linkname,
- H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: H5Lcreate_external() failed.";
}
HDassert(ret >= 0);
@@ -769,7 +760,7 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Pclose(gcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: H5Pclose() failed.";
}
HDassert(ret >= 0);
@@ -779,7 +770,7 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Gclose(gid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ns_grp_d: H5Gclose() failed.";
}
HDassert(ret >= 0);
@@ -788,7 +779,6 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
return;
} /* ns_grp_d() */
-
/*-------------------------------------------------------------------------
* Function: vrfy_ns_grp_d
*
@@ -808,21 +798,21 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
*-------------------------------------------------------------------------
*/
-
void
-vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
- hid_t gid = -1;
- hid_t gcpl = -1;
+vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks)
+{
+ hid_t gid = -1;
+ hid_t gcpl = -1;
H5G_info_t grp_info;
- unsigned crt_order_flags = 0;
- unsigned u;
- herr_t ret;
+ unsigned crt_order_flags = 0;
+ unsigned u;
+ herr_t ret;
if (pass) {
gid = H5Gopen2(fid, group_name, H5P_DEFAULT);
if (gid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Gopen2() failed.";
}
HDassert(gid > 0);
@@ -832,7 +822,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
gcpl = H5Gget_create_plist(gid);
if (gcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Gget_create_plist() failed.";
}
HDassert(gcpl > 0);
@@ -842,11 +832,11 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Pget_link_creation_order(gcpl, &crt_order_flags);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Pget_link_creation_order() failed.";
}
else if (H5P_CRT_ORDER_TRACKED != crt_order_flags) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5P_CRT_ORDER_TRACKED != crt_order_flags";
}
HDassert(ret >= 0);
@@ -857,7 +847,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Pclose(gcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Pclose() failed.";
}
HDassert(ret >= 0);
@@ -868,23 +858,23 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Gget_info(gid, &grp_info);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Gget_info() failed.";
}
else if (H5G_STORAGE_TYPE_DENSE != grp_info.storage_type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5G_STORAGE_TYPE_DENSE != grp_info.storage_type";
}
else if (nlinks != grp_info.nlinks) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.nlinks";
}
else if (nlinks != grp_info.max_corder) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.max_corder";
}
- else if ( FALSE != grp_info.mounted) {
- pass = FALSE;
+ else if (FALSE != grp_info.mounted) {
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: FALSE != grp_info.mounted";
}
HDassert(ret >= 0);
@@ -897,14 +887,14 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
u = 0;
while ((pass) && (u < nlinks)) {
H5L_info2_t lnk_info;
- char linkname[16];
- htri_t link_exists;
+ char linkname[16];
+ htri_t link_exists;
HDsprintf(linkname, "%u", u);
link_exists = H5Lexists(gid, linkname, H5P_DEFAULT);
if (link_exists < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Lexists() failed.";
}
HDassert(link_exists >= 0);
@@ -913,19 +903,19 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Lget_info() failed.";
}
else if (TRUE != lnk_info.corder_valid) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: TRUE != lnk_info.corder_valid";
}
else if (u != lnk_info.corder) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: u != lnk_info.corder";
}
else if (H5T_CSET_ASCII != lnk_info.cset) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5T_CSET_ASCII != lnk_info.cset";
}
HDassert(ret >= 0);
@@ -937,32 +927,31 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
char *slinkval;
if (H5L_TYPE_SOFT != lnk_info.type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type";
}
else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type";
}
HDassert(H5L_TYPE_SOFT == lnk_info.type);
HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size);
- slinkval = (char *) HDmalloc(lnk_info.u.val_size);
+ slinkval = (char *)HDmalloc(lnk_info.u.val_size);
if (!slinkval) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: HDmalloc of slinkval failed";
}
HDassert(slinkval);
- ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size,
- H5P_DEFAULT);
+ ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Lget_val() failed";
}
else if (0 != HDstrcmp(slinkval, group_name)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(slinkval, group_name)";
}
HDassert(ret >= 0);
@@ -972,10 +961,10 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
} /* end if */
else if (1 == (u % 3)) {
H5O_info2_t root_oinfo;
- int token_cmp = 0;
+ int token_cmp = 0;
if (H5L_TYPE_HARD != lnk_info.type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_HARD != lnk_info.type";
}
HDassert(H5L_TYPE_HARD == lnk_info.type);
@@ -983,17 +972,17 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
HDmemset(&root_oinfo, 0, sizeof(root_oinfo));
ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed.";
}
else {
- if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) {
- pass = FALSE;
+ if (H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) {
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Otoken_cmp() failed.";
}
if (token_cmp) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: root_oinfo.token != lnk_info.u.token";
}
}
@@ -1001,14 +990,14 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
HDassert(!token_cmp);
} /* end else-if */
else {
- void *elinkval;
+ void * elinkval;
const char *file = NULL;
const char *path = NULL;
HDassert(2 == (u % 3));
if (H5L_TYPE_EXTERNAL != lnk_info.type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_EXTERNAL != lnk_info.type";
}
HDassert(H5L_TYPE_EXTERNAL == lnk_info.type);
@@ -1016,30 +1005,29 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
elinkval = HDmalloc(lnk_info.u.val_size);
if (!elinkval) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: HDmalloc of elinkval failed.";
}
HDassert(elinkval);
- ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size,
- H5P_DEFAULT);
+ ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Lget_val failed.";
}
HDassert(ret >= 0);
ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, &file, &path);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Lunpack_elink_val failed.";
}
else if (0 != HDstrcmp(file, "external.h5")) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(file, \"external.h5\").";
}
else if (0 != HDstrcmp(path, "/ext")) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(path, \"/ext\")";
}
HDassert(ret >= 0);
@@ -1056,7 +1044,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
ret = H5Gclose(gid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Gclose() failed.";
}
HDassert(ret >= 0);
@@ -1066,7 +1054,6 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
} /* vrfy_ns_grp_d() */
-
/*-------------------------------------------------------------------------
* Function: os_grp_0
*
@@ -1088,65 +1075,65 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
void
os_grp_0(hid_t fid, const char *group_name)
{
- hid_t gid = -1;
- hid_t fapl = -1;
+ hid_t gid = -1;
+ hid_t fapl = -1;
H5F_libver_t low, high;
herr_t ret;
- if ( pass ) { /* get the file's file access property list */
+ if (pass) { /* get the file's file access property list */
fapl = H5Fget_access_plist(fid);
- if ( fapl <= 0 ) {
- pass = FALSE;
+ if (fapl <= 0) {
+ pass = FALSE;
failure_mssg = "os_grp_0: H5Fget_access_plist() failed.";
}
HDassert(fapl > 0);
}
- if ( pass ) { /* get low and high bounds from fapl */
+ if (pass) { /* get low and high bounds from fapl */
ret = H5Pget_libver_bounds(fapl, &low, &high);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1).";
}
HDassert(ret >= 0);
}
- if ( pass ) { /* turn file format latest off */
- if(low >= H5F_LIBVER_V18) {
+ if (pass) { /* turn file format latest off */
+ if (low >= H5F_LIBVER_V18) {
ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1).";
}
HDassert(ret >= 0);
}
}
- if ( pass ) {
+ if (pass) {
gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if ( gid <= 0 ) {
- pass = FALSE;
+ if (gid <= 0) {
+ pass = FALSE;
failure_mssg = "os_grp_0: H5Gcreate2() failed.";
}
HDassert(gid > 0);
}
- if ( pass ) {
+ if (pass) {
ret = H5Gclose(gid);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_0: H5Gclose() failed.";
}
HDassert(ret >= 0);
}
- if ( pass ) { /* restore low and high bounds */
- if(low >= H5F_LIBVER_V18) {
+ if (pass) { /* restore low and high bounds */
+ if (low >= H5F_LIBVER_V18) {
ret = H5Fset_libver_bounds(fid, low, high);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1).";
}
HDassert(ret >= 0);
@@ -1156,7 +1143,6 @@ os_grp_0(hid_t fid, const char *group_name)
return;
} /* os_grp_0() */
-
/*-------------------------------------------------------------------------
* Function: vrfy_os_grp_0
*
@@ -1176,18 +1162,19 @@ os_grp_0(hid_t fid, const char *group_name)
*/
void
-vrfy_os_grp_0(hid_t fid, const char *group_name) {
- hid_t gid = -1;
- hid_t gcpl = -1;
+vrfy_os_grp_0(hid_t fid, const char *group_name)
+{
+ hid_t gid = -1;
+ hid_t gcpl = -1;
H5G_info_t grp_info;
- unsigned crt_order_flags = 0;
- herr_t ret;
+ unsigned crt_order_flags = 0;
+ herr_t ret;
if (pass) {
gid = H5Gopen2(fid, group_name, H5P_DEFAULT);
if (gid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: H5Gopen2() failed.";
}
HDassert(gid > 0);
@@ -1197,7 +1184,7 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) {
gcpl = H5Gget_create_plist(gid);
if (gcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: H5Gget_create_plist() failed.";
}
HDassert(gcpl > 0);
@@ -1208,11 +1195,11 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) {
ret = H5Pget_link_creation_order(gcpl, &crt_order_flags);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: H5Pget_link_creation_order() failed";
}
else if (0 != crt_order_flags) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: 0 != crt_order_flags";
}
HDassert(ret >= 0);
@@ -1223,7 +1210,7 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) {
ret = H5Pclose(gcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: H5Pclose() failed.";
}
HDassert(ret >= 0);
@@ -1234,23 +1221,23 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) {
ret = H5Gget_info(gid, &grp_info);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: H5Gget_info() failed.";
}
else if (H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type";
}
else if (0 != grp_info.nlinks) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: 0 != grp_info.nlinks";
}
else if (0 != grp_info.max_corder) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: 0 != grp_info.max_corder";
}
- else if ( FALSE != grp_info.mounted) {
- pass = FALSE;
+ else if (FALSE != grp_info.mounted) {
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: FALSE != grp_info.mounted";
}
HDassert(ret >= 0);
@@ -1264,7 +1251,7 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) {
ret = H5Gclose(gid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_0: H5Gclose() failed.";
}
HDassert(ret >= 0);
@@ -1273,7 +1260,6 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) {
return;
} /* vrfy_os_grp_0() */
-
/*-------------------------------------------------------------------------
* Function: os_grp_n
*
@@ -1296,45 +1282,45 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) {
void
os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
{
- hid_t gid = -1;
- unsigned u;
- hid_t fapl = -1;
+ hid_t gid = -1;
+ unsigned u;
+ hid_t fapl = -1;
H5F_libver_t low, high;
- herr_t ret;
+ herr_t ret;
- if ( pass ) { /* get the file's file access property list */
+ if (pass) { /* get the file's file access property list */
fapl = H5Fget_access_plist(fid);
- if ( fapl <= 0 ) {
- pass = FALSE;
+ if (fapl <= 0) {
+ pass = FALSE;
failure_mssg = "os_grp_n: H5Fget_access_plist() failed.";
}
HDassert(fapl > 0);
}
- if ( pass ) { /* get low and high bounds from fapl */
+ if (pass) { /* get low and high bounds from fapl */
ret = H5Pget_libver_bounds(fapl, &low, &high);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1).";
}
HDassert(ret >= 0);
}
- if ( pass ) { /* turn file format latest off */
- if(low >= H5F_LIBVER_V18) {
+ if (pass) { /* turn file format latest off */
+ if (low >= H5F_LIBVER_V18) {
ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1).";
}
HDassert(ret >= 0);
}
}
- if ( pass ) {
+ if (pass) {
gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if ( gid <= 0 ) {
- pass = FALSE;
+ if (gid <= 0) {
+ pass = FALSE;
failure_mssg = "os_grp_n: H5Gcreate2() failed.";
}
HDassert(gid > 0);
@@ -1343,15 +1329,15 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
HDassert(nlinks > 0);
u = 0;
- while ( ( pass ) && ( u < nlinks ) ) {
+ while ((pass) && (u < nlinks)) {
char linkname[32];
HDsprintf(linkname, "ln%d_%u", proc_num, u);
- if(0 == (u % 2)) {
+ if (0 == (u % 2)) {
ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_n: H5Lcreate_soft() failed.";
}
HDassert(ret >= 0);
@@ -1360,31 +1346,31 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
HDassert(1 == (u % 2));
ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_n: H5Lcreate_hard() failed.";
}
HDassert(ret >= 0);
} /* end else */
- u++;
+ u++;
} /* end while */
- if ( pass ) {
+ if (pass) {
ret = H5Gclose(gid);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_n: H5Gclose() failed.";
}
HDassert(ret >= 0);
}
- if ( pass ) { /* restore low and high bounds */
- if(low >= H5F_LIBVER_V18) {
+ if (pass) { /* restore low and high bounds */
+ if (low >= H5F_LIBVER_V18) {
ret = H5Fset_libver_bounds(fid, low, high);
- if ( ret < 0 ) {
- pass = FALSE;
+ if (ret < 0) {
+ pass = FALSE;
failure_mssg = "os_grp_n: H5Fset_libver_bounds() failed(2).";
}
HDassert(ret >= 0);
@@ -1394,7 +1380,6 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
return;
} /* os_grp_n() */
-
/*-------------------------------------------------------------------------
* Function: vrfy_os_grp_n
*
@@ -1414,20 +1399,20 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
*-------------------------------------------------------------------------
*/
void
-vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
- unsigned nlinks) {
- hid_t gid = -1;
- hid_t gcpl = -1;
+vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
+{
+ hid_t gid = -1;
+ hid_t gcpl = -1;
H5G_info_t grp_info;
- unsigned crt_order_flags = 0;
- unsigned u;
- herr_t ret;
+ unsigned crt_order_flags = 0;
+ unsigned u;
+ herr_t ret;
if (pass) {
gid = H5Gopen2(fid, group_name, H5P_DEFAULT);
if (gid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Gopen2() failed";
}
HDassert(gid > 0);
@@ -1437,7 +1422,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
gcpl = H5Gget_create_plist(gid);
if (gcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Gget_create_plist() failed";
}
HDassert(gcpl > 0);
@@ -1447,11 +1432,11 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
ret = H5Pget_link_creation_order(gcpl, &crt_order_flags);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Pget_link_creation_order";
}
else if (0 != crt_order_flags) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: 0 != crt_order_flags";
}
HDassert(ret >= 0);
@@ -1462,7 +1447,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
ret = H5Pclose(gcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Pclose() failed";
}
HDassert(ret >= 0);
@@ -1474,23 +1459,23 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
ret = H5Gget_info(gid, &grp_info);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Gget_info() failed";
}
else if (H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type";
}
else if (nlinks != grp_info.nlinks) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: nlinks != grp_info.nlinks";
}
else if (0 != grp_info.max_corder) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: 0 != grp_info.max_corder";
}
- else if ( FALSE != grp_info.mounted) {
- pass = FALSE;
+ else if (FALSE != grp_info.mounted) {
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: FALSE != grp_info.mounted";
}
HDassert(ret >= 0);
@@ -1503,14 +1488,14 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
u = 0;
while ((pass) && (u < nlinks)) {
H5L_info2_t lnk_info;
- char linkname[32];
- htri_t link_exists;
+ char linkname[32];
+ htri_t link_exists;
HDsprintf(linkname, "ln%d_%u", proc_num, u);
link_exists = H5Lexists(gid, linkname, H5P_DEFAULT);
if (link_exists < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Lexists() failed";
}
HDassert(link_exists >= 0);
@@ -1519,15 +1504,15 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Lget_info() failed";
}
- else if ( FALSE != lnk_info.corder_valid) {
- pass = FALSE;
+ else if (FALSE != lnk_info.corder_valid) {
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: FALSE != lnk_info.corder_valid";
}
else if (H5T_CSET_ASCII != lnk_info.cset) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5T_CSET_ASCII != lnk_info.cset";
}
HDassert(ret >= 0);
@@ -1538,33 +1523,32 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
char *slinkval;
if (H5L_TYPE_SOFT != lnk_info.type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5L_TYPE_SOFT != lnk_info.type";
}
else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: (HDstrlen(group_name) + 1) != lnk_info.u.val_size";
}
HDassert(H5L_TYPE_SOFT == lnk_info.type);
HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size);
- slinkval = (char *) HDmalloc(lnk_info.u.val_size);
+ slinkval = (char *)HDmalloc(lnk_info.u.val_size);
if (!slinkval) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: HDmalloc of slinkval failed";
}
HDassert(slinkval);
- ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size,
- H5P_DEFAULT);
+ ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, H5P_DEFAULT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Lget_val() failed";
}
else if (0 != HDstrcmp(slinkval, group_name)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: 0 != HDstrcmp(slinkval, group_name)";
}
HDassert(ret >= 0);
@@ -1574,12 +1558,12 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
} /* end if */
else {
H5O_info2_t root_oinfo;
- int token_cmp = 0;
+ int token_cmp = 0;
HDassert(1 == (u % 2));
if (H5L_TYPE_HARD != lnk_info.type) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5L_TYPE_HARD != lnk_info.type";
}
HDassert(H5L_TYPE_HARD == lnk_info.type);
@@ -1588,17 +1572,17 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed.";
}
else {
- if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) {
- pass = FALSE;
+ if (H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) {
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Otoken_cmp() failed.";
}
if (token_cmp) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: root_oinfo.token != lnk_info.u.token";
}
}
@@ -1613,7 +1597,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
ret = H5Gclose(gid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Gclose() failed.";
}
HDassert(ret >= 0);
@@ -1622,7 +1606,6 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
return;
} /* vrfy_os_grp_n() */
-
/*-------------------------------------------------------------------------
* Function: ds_ctg_i
*
@@ -1643,30 +1626,30 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
*-------------------------------------------------------------------------
*/
void
-ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
- int *wdata = NULL;
+ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data)
+{
+ int * wdata = NULL;
unsigned u;
- hid_t dsid = -1;
- hid_t sid = -1;
- hsize_t dims[1] = { DSET_DIMS };
- herr_t ret;
+ hid_t dsid = -1;
+ hid_t sid = -1;
+ hsize_t dims[1] = {DSET_DIMS};
+ herr_t ret;
if (pass) {
sid = H5Screate_simple(1, dims, NULL);
if (sid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_i: H5Screate_simple() failed";
}
HDassert(sid > 0);
}
if (pass) {
- dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (dsid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_i: H5Dcreate2() failed";
}
HDassert(dsid > 0);
@@ -1676,17 +1659,17 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sclose(sid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_i: H5Sclose() failed";
}
HDassert(ret >= 0);
}
if ((pass) && (write_data)) {
- wdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS);
+ wdata = (int *)HDmalloc(sizeof(int) * DSET_DIMS);
if (!wdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_i: HDmalloc of wdata failed.";
}
HDassert(wdata);
@@ -1694,13 +1677,12 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
if ((pass) && (write_data)) {
for (u = 0; u < DSET_DIMS; u++)
- wdata[u] = (int) u;
+ wdata[u] = (int)u;
- ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, wdata);
+ ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_i: H5Dwrite() failed.";
}
HDassert(ret >= 0);
@@ -1712,7 +1694,7 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dclose(dsid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_i: H5Dclose() failed";
}
HDassert(ret >= 0);
@@ -1721,7 +1703,6 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
return;
} /* ds_ctg_i */
-
/*-------------------------------------------------------------------------
* Function: vrfy_ds_ctg_i
*
@@ -1741,25 +1722,26 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
*-------------------------------------------------------------------------
*/
void
-vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
- int *rdata = NULL;
- unsigned u;
- hid_t dsid = -1;
- hid_t sid = -1;
- hid_t tid = -1;
- hid_t dcpl = -1;
+vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data)
+{
+ int * rdata = NULL;
+ unsigned u;
+ hid_t dsid = -1;
+ hid_t sid = -1;
+ hid_t tid = -1;
+ hid_t dcpl = -1;
H5D_space_status_t allocation;
- H5D_layout_t layout;
- int ndims;
- hsize_t dims[1], max_dims[1];
- htri_t type_equal;
- herr_t ret;
+ H5D_layout_t layout;
+ int ndims;
+ hsize_t dims[1], max_dims[1];
+ htri_t type_equal;
+ herr_t ret;
if (pass) {
dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT);
if (dsid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Dopen2() failed.";
}
HDassert(dsid > 0);
@@ -1769,7 +1751,7 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
sid = H5Dget_space(dsid);
if (sid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Dget_space() failed.";
}
HDassert(sid > 0);
@@ -1779,7 +1761,7 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ndims = H5Sget_simple_extent_ndims(sid);
if (1 != ndims) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: 1 != ndims";
}
HDassert(1 == ndims);
@@ -1789,15 +1771,15 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sget_simple_extent_dims(sid, dims, max_dims);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Sget_simple_extent_dims() failed";
}
- else if ( DSET_DIMS != dims[0]) {
- pass = FALSE;
+ else if (DSET_DIMS != dims[0]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != dims[0]";
}
- else if ( DSET_DIMS != max_dims[0]) {
- pass = FALSE;
+ else if (DSET_DIMS != max_dims[0]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != max_dims[0]";
}
HDassert(ret >= 0);
@@ -1809,7 +1791,7 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sclose(sid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Sclose() failed.";
}
HDassert(ret >= 0);
@@ -1819,7 +1801,7 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
tid = H5Dget_type(dsid);
if (tid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Dget_type() failed.";
}
HDassert(tid > 0);
@@ -1829,7 +1811,7 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
type_equal = H5Tequal(tid, H5T_NATIVE_INT);
if (1 != type_equal) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: type not H5T_NATIVE_INT";
}
HDassert(1 == type_equal);
@@ -1839,7 +1821,7 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Tclose(tid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Tclose() failed.";
}
HDassert(ret >= 0);
@@ -1849,28 +1831,27 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dget_space_status(dsid, &allocation);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Dget_space_status() failed.";
}
else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED";
}
- else if (!write_data
- && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) {
- pass = FALSE;
+ else if (!write_data && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED";
}
HDassert(ret >= 0);
- HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED)
- || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED));
+ HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) ||
+ (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED));
}
if (pass) {
dcpl = H5Dget_create_plist(dsid);
if (dcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Dget_create_plist() failed.";
}
HDassert(dcpl > 0);
@@ -1880,7 +1861,7 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
layout = H5Pget_layout(dcpl);
if (H5D_CONTIGUOUS != layout) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5D_CONTIGUOUS != layout";
}
HDassert(H5D_CONTIGUOUS == layout);
@@ -1890,27 +1871,26 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Pclose(dcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Pclose() failed.";
}
HDassert(ret >= 0);
}
if ((pass) && (write_data)) {
- rdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS);
+ rdata = (int *)HDmalloc(sizeof(int) * DSET_DIMS);
if (!rdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: HDmalloc of rdata failed.";
}
HDassert(rdata);
}
if ((pass) && (write_data)) {
- ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, rdata);
+ ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Dread() failed.";
}
HDassert(ret >= 0);
@@ -1918,12 +1898,12 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
if ((pass) && (write_data)) {
for (u = 0; u < DSET_DIMS; u++) {
- if ((int) u != rdata[u]) {
- pass = FALSE;
+ if ((int)u != rdata[u]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: u != rdata[u].";
break;
}
- HDassert((int )u == rdata[u]);
+ HDassert((int)u == rdata[u]);
}
HDfree(rdata);
@@ -1933,7 +1913,7 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dclose(dsid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_i: H5Dclose() failed";
}
HDassert(ret >= 0);
@@ -1943,7 +1923,6 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
} /* vrfy_ds_ctg_i() */
-
/*-------------------------------------------------------------------------
* Function: ds_chk_i
*
@@ -1964,21 +1943,22 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) {
*-------------------------------------------------------------------------
*/
void
-ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
- int *wdata = NULL;
+ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data)
+{
+ int * wdata = NULL;
unsigned u;
- hid_t dsid = -1;
- hid_t dcpl = -1;
- hid_t sid = -1;
- hsize_t dims[1] = { DSET_DIMS };
- hsize_t chunk_dims[1] = { DSET_CHUNK_DIMS };
- herr_t ret;
+ hid_t dsid = -1;
+ hid_t dcpl = -1;
+ hid_t sid = -1;
+ hsize_t dims[1] = {DSET_DIMS};
+ hsize_t chunk_dims[1] = {DSET_CHUNK_DIMS};
+ herr_t ret;
if (pass) {
sid = H5Screate_simple(1, dims, NULL);
if (sid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_chk_i: H5Screate_simple() failed.";
}
HDassert(sid > 0);
@@ -1988,7 +1968,7 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
if (dcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_chk_i: H5Pcreate() failed.";
}
HDassert(dcpl > 0);
@@ -1998,18 +1978,17 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Pset_chunk(dcpl, 1, chunk_dims);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_chk_i: H5Pset_chunk() failed.";
}
HDassert(ret >= 0);
}
if (pass) {
- dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
if (dsid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_chk_i: H5Dcreate2() failed";
}
HDassert(dsid > 0);
@@ -2019,7 +1998,7 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Pclose(dcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_chk_i: H5Pclose() failed.";
}
HDassert(ret >= 0);
@@ -2029,17 +2008,17 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sclose(sid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_chk_i: H5Sclose() failed.";
}
HDassert(ret >= 0);
}
if ((pass) && (write_data)) {
- wdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS);
+ wdata = (int *)HDmalloc(sizeof(int) * DSET_DIMS);
if (!wdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_chk_i: HDmalloc of wdata failed.";
}
HDassert(wdata);
@@ -2047,12 +2026,11 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
if ((pass) && (write_data)) {
for (u = 0; u < DSET_DIMS; u++)
- wdata[u] = (int) u;
+ wdata[u] = (int)u;
- ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, wdata);
+ ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_chk_i: H5Dwrite() failed.";
}
HDassert(ret >= 0);
@@ -2063,7 +2041,7 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dclose(dsid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_chk_i: H5Dclose() failed.";
}
HDassert(ret >= 0);
@@ -2072,7 +2050,6 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
return;
} /* ds_chk_i */
-
/*-------------------------------------------------------------------------
* Function: vrfy_ds_chk_i
*
@@ -2092,25 +2069,26 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
*-------------------------------------------------------------------------
*/
void
-vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
- int *rdata = NULL;
- unsigned u;
- hid_t dsid = -1;
- hid_t sid = -1;
- hid_t tid = -1;
- hid_t dcpl = -1;
+vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data)
+{
+ int * rdata = NULL;
+ unsigned u;
+ hid_t dsid = -1;
+ hid_t sid = -1;
+ hid_t tid = -1;
+ hid_t dcpl = -1;
H5D_space_status_t allocation;
- H5D_layout_t layout;
- int ndims;
- hsize_t dims[1], max_dims[1], chunk_dims[1];
- htri_t type_equal;
- herr_t ret;
+ H5D_layout_t layout;
+ int ndims;
+ hsize_t dims[1], max_dims[1], chunk_dims[1];
+ htri_t type_equal;
+ herr_t ret;
if (pass) {
dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT);
if (dsid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Dopen2() failed.";
}
HDassert(dsid > 0);
@@ -2120,7 +2098,7 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
sid = H5Dget_space(dsid);
if (sid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Dget_space() failed.";
}
HDassert(sid > 0);
@@ -2130,7 +2108,7 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ndims = H5Sget_simple_extent_ndims(sid);
if (1 != ndims) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: 1 != ndims";
}
HDassert(1 == ndims);
@@ -2140,15 +2118,15 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sget_simple_extent_dims(sid, dims, max_dims);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Sget_simple_extent_dims() failed";
}
- else if ( DSET_DIMS != dims[0]) {
- pass = FALSE;
+ else if (DSET_DIMS != dims[0]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != dims[0]";
}
- else if ( DSET_DIMS != max_dims[0]) {
- pass = FALSE;
+ else if (DSET_DIMS != max_dims[0]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != max_dims[0]";
}
HDassert(ret >= 0);
@@ -2160,7 +2138,7 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sclose(sid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Sclose() failed.";
}
HDassert(ret >= 0);
@@ -2170,7 +2148,7 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
tid = H5Dget_type(dsid);
if (tid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Dget_type() failed.";
}
HDassert(tid > 0);
@@ -2180,7 +2158,7 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
type_equal = H5Tequal(tid, H5T_NATIVE_INT);
if (1 != type_equal) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: tid != H5T_NATIVE_INT";
}
HDassert(1 == type_equal);
@@ -2190,7 +2168,7 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Tclose(tid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Tclose() failed.";
}
HDassert(ret >= 0);
@@ -2200,27 +2178,27 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dget_space_status(dsid, &allocation);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Dget_space_status() failed.";
}
else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED";
}
else if (!write_data && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED";
}
HDassert(ret >= 0);
- HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED)
- || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED));
+ HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) ||
+ (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED));
}
if (pass) {
dcpl = H5Dget_create_plist(dsid);
if (dcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Dget_create_plist() failed.";
}
HDassert(dcpl > 0);
@@ -2230,7 +2208,7 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
layout = H5Pget_layout(dcpl);
if (H5D_CHUNKED != layout) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5D_CHUNKED != layout";
}
HDassert(H5D_CHUNKED == layout);
@@ -2240,11 +2218,11 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Pget_chunk(dcpl, 1, chunk_dims);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Pget_chunk";
}
- else if ( DSET_CHUNK_DIMS != chunk_dims[0]) {
- pass = FALSE;
+ else if (DSET_CHUNK_DIMS != chunk_dims[0]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: ";
}
HDassert(ret >= 0);
@@ -2255,17 +2233,17 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Pclose(dcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Pclose() failed.";
}
HDassert(ret >= 0);
}
if ((pass) && (write_data)) {
- rdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS);
+ rdata = (int *)HDmalloc(sizeof(int) * DSET_DIMS);
if (!rdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: HDmalloc of rdata failed.";
}
HDassert(rdata);
@@ -2274,7 +2252,7 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
if ((pass) && (write_data)) {
ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Dread() failed.";
}
HDassert(ret >= 0);
@@ -2282,12 +2260,12 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
if ((pass) && (write_data)) {
for (u = 0; u < DSET_DIMS; u++) {
- if ((int) u != rdata[u]) {
- pass = FALSE;
+ if ((int)u != rdata[u]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: u != rdata[u]";
break;
}
- HDassert((int )u == rdata[u]);
+ HDassert((int)u == rdata[u]);
}
HDfree(rdata);
@@ -2297,7 +2275,7 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dclose(dsid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_chk_i: H5Dclose() failed.";
}
HDassert(ret >= 0);
@@ -2306,7 +2284,6 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
return;
} /* vrfy_ds_chk_i() */
-
/*-------------------------------------------------------------------------
* Function: ds_cpt_i
*
@@ -2327,20 +2304,21 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) {
*-------------------------------------------------------------------------
*/
void
-ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
- int *wdata = NULL;
+ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data)
+{
+ int * wdata = NULL;
unsigned u;
- hid_t dsid = -1;
- hid_t dcpl = -1;
- hid_t sid = -1;
- hsize_t dims[1] = { DSET_COMPACT_DIMS };
- herr_t ret;
+ hid_t dsid = -1;
+ hid_t dcpl = -1;
+ hid_t sid = -1;
+ hsize_t dims[1] = {DSET_COMPACT_DIMS};
+ herr_t ret;
if (pass) {
sid = H5Screate_simple(1, dims, NULL);
if (sid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_cpt_i: H5Screate_simple() failed.";
}
HDassert(sid > 0);
@@ -2350,7 +2328,7 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
if (dcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_cpt_i: H5Pcreate() failed.";
}
HDassert(dcpl > 0);
@@ -2360,18 +2338,17 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Pset_layout(dcpl, H5D_COMPACT);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_cpt_i: H5Pset_layout() failed.";
}
HDassert(ret >= 0);
}
if (pass) {
- dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
if (dsid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_cpt_i: H5Dcreate2() failed.";
}
HDassert(dsid > 0);
@@ -2381,7 +2358,7 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Pclose(dcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_cpt_i: H5Pclose() failed.";
}
HDassert(ret >= 0);
@@ -2391,17 +2368,17 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sclose(sid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_cpt_i: H5Sclose() failed.";
}
HDassert(ret >= 0);
}
if ((pass) && (write_data)) {
- wdata = (int *) HDmalloc(sizeof(int) * DSET_COMPACT_DIMS);
+ wdata = (int *)HDmalloc(sizeof(int) * DSET_COMPACT_DIMS);
if (!wdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_cpt_i: HDmalloc of wdata failed.";
}
HDassert(wdata);
@@ -2409,13 +2386,12 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
if ((pass) && (write_data)) {
for (u = 0; u < DSET_COMPACT_DIMS; u++)
- wdata[u] = (int) u;
+ wdata[u] = (int)u;
- ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, wdata);
+ ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_cpt_i: H5Dwrite() failed.";
}
HDassert(ret >= 0);
@@ -2427,7 +2403,7 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dclose(dsid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_cpt_i: H5Dclose() failed.";
}
HDassert(ret >= 0);
@@ -2437,7 +2413,6 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
} /* ds_cpt_i() */
-
/*-------------------------------------------------------------------------
* Function: vrfy_ds_cpt_i
*
@@ -2457,25 +2432,26 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
*-------------------------------------------------------------------------
*/
void
-vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
- int *rdata = NULL;
- unsigned u;
- hid_t dsid = -1;
- hid_t sid = -1;
- hid_t tid = -1;
- hid_t dcpl = -1;
+vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data)
+{
+ int * rdata = NULL;
+ unsigned u;
+ hid_t dsid = -1;
+ hid_t sid = -1;
+ hid_t tid = -1;
+ hid_t dcpl = -1;
H5D_space_status_t allocation;
- H5D_layout_t layout;
- int ndims;
- hsize_t dims[1], max_dims[1];
- htri_t type_equal;
- herr_t ret;
+ H5D_layout_t layout;
+ int ndims;
+ hsize_t dims[1], max_dims[1];
+ htri_t type_equal;
+ herr_t ret;
if (pass) {
dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT);
if (dsid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Dopen2() failed.";
}
HDassert(dsid > 0);
@@ -2485,7 +2461,7 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
sid = H5Dget_space(dsid);
if (sid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Dget_space() failed.";
}
HDassert(sid > 0);
@@ -2495,7 +2471,7 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ndims = H5Sget_simple_extent_ndims(sid);
if (1 != ndims) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: 1 != ndims";
}
HDassert(1 == ndims);
@@ -2505,15 +2481,15 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sget_simple_extent_dims(sid, dims, max_dims);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Sget_simple_extent_dims() failed";
}
- else if ( DSET_COMPACT_DIMS != dims[0]) {
- pass = FALSE;
+ else if (DSET_COMPACT_DIMS != dims[0]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != dims[0]";
}
- else if ( DSET_COMPACT_DIMS != max_dims[0]) {
- pass = FALSE;
+ else if (DSET_COMPACT_DIMS != max_dims[0]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != max_dims[0]";
}
HDassert(ret >= 0);
@@ -2525,7 +2501,7 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sclose(sid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Sclose() failed.";
}
HDassert(ret >= 0);
@@ -2535,7 +2511,7 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
tid = H5Dget_type(dsid);
if (tid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Dget_type() failed.";
}
HDassert(tid > 0);
@@ -2545,7 +2521,7 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
type_equal = H5Tequal(tid, H5T_NATIVE_INT);
if (1 != type_equal) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: type != H5T_NATIVE_INT";
}
HDassert(1 == type_equal);
@@ -2555,7 +2531,7 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Tclose(tid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Tclose() failed.";
}
HDassert(ret >= 0);
@@ -2565,13 +2541,12 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dget_space_status(dsid, &allocation);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Dget_space_status() failed.";
}
else if (H5D_SPACE_STATUS_ALLOCATED != allocation) {
- pass = FALSE;
- failure_mssg =
- "vrfy_ds_cpt_i: H5D_SPACE_STATUS_ALLOCATED != allocation";
+ pass = FALSE;
+ failure_mssg = "vrfy_ds_cpt_i: H5D_SPACE_STATUS_ALLOCATED != allocation";
}
HDassert(ret >= 0);
HDassert(H5D_SPACE_STATUS_ALLOCATED == allocation);
@@ -2581,7 +2556,7 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
dcpl = H5Dget_create_plist(dsid);
if (dcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Dget_create_plist() failed.";
}
HDassert(dcpl > 0);
@@ -2591,7 +2566,7 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
layout = H5Pget_layout(dcpl);
if (H5D_COMPACT != layout) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5D_COMPACT != layout";
}
HDassert(H5D_COMPACT == layout);
@@ -2601,27 +2576,26 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Pclose(dcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Pclose() failed.";
}
HDassert(ret >= 0);
}
if ((pass) && (write_data)) {
- rdata = (int *) HDmalloc(sizeof(int) * DSET_COMPACT_DIMS);
+ rdata = (int *)HDmalloc(sizeof(int) * DSET_COMPACT_DIMS);
if (!rdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: HDmalloc of rdata failed.";
}
HDassert(rdata);
}
if ((pass) && (write_data)) {
- ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, rdata);
+ ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Dread() failed.";
}
HDassert(ret >= 0);
@@ -2629,12 +2603,12 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
if ((pass) && (write_data)) {
for (u = 0; u < DSET_COMPACT_DIMS; u++) {
- if ((int) u != rdata[u]) {
- pass = FALSE;
+ if ((int)u != rdata[u]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: (int)u != rdata[u]";
break;
}
- HDassert((int )u == rdata[u]);
+ HDassert((int)u == rdata[u]);
}
HDfree(rdata);
@@ -2644,7 +2618,7 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dclose(dsid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_cpt_i: H5Dclose() failed.";
}
HDassert(ret >= 0);
@@ -2653,7 +2627,6 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
return;
} /* vrfy_ds_cpt_i() */
-
/*-------------------------------------------------------------------------
* Function: ds_ctg_v
*
@@ -2674,20 +2647,21 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) {
*-------------------------------------------------------------------------
*/
void
-ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
- hid_t dsid = -1;
- hid_t sid = -1;
- hid_t tid = -1;
- hsize_t dims[1] = { DSET_SMALL_DIMS };
- herr_t ret;
- hvl_t *wdata = NULL;
+ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data)
+{
+ hid_t dsid = -1;
+ hid_t sid = -1;
+ hid_t tid = -1;
+ hsize_t dims[1] = {DSET_SMALL_DIMS};
+ herr_t ret;
+ hvl_t * wdata = NULL;
unsigned u;
if (pass) {
sid = H5Screate_simple(1, dims, NULL);
if (sid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: H5Screate_simple";
}
HDassert(sid > 0);
@@ -2697,28 +2671,27 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
tid = H5Tvlen_create(H5T_NATIVE_INT);
if (tid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: H5Tvlen_create() failed.";
}
HDassert(tid > 0);
}
if (pass) {
- dsid = H5Dcreate2(fid, dset_name, tid, sid, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dsid = H5Dcreate2(fid, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (dsid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: H5Dcreate2() failed.";
}
HDassert(dsid > 0);
}
if ((pass) && (write_data)) {
- wdata = (hvl_t *) HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS);
+ wdata = (hvl_t *)HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS);
if (!wdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: HDmalloc of wdata failed.";
}
HDassert(wdata);
@@ -2726,25 +2699,25 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
if ((pass) && (write_data)) {
for (u = 0; u < DSET_SMALL_DIMS; u++) {
- int *tdata;
+ int * tdata;
unsigned len;
unsigned v;
- len = (u % 10) + 1;
- tdata = (int *) HDmalloc(sizeof(int) * len);
+ len = (u % 10) + 1;
+ tdata = (int *)HDmalloc(sizeof(int) * len);
if (!tdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: HDmalloc of tdata failed.";
break;
}
HDassert(tdata);
for (v = 0; v < len; v++)
- tdata[v] = (int) (u + v);
+ tdata[v] = (int)(u + v);
wdata[u].len = len;
- wdata[u].p = tdata;
+ wdata[u].p = tdata;
} /* end for */
}
@@ -2752,7 +2725,7 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: H5Dwrite() failed.";
}
HDassert(ret >= 0);
@@ -2762,7 +2735,7 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Treclaim(tid, sid, H5P_DEFAULT, wdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: H5Treclaim() failed.";
}
HDassert(ret >= 0);
@@ -2774,7 +2747,7 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sclose(sid);
if (sid < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: H5Sclose() failed.";
}
HDassert(ret >= 0);
@@ -2784,7 +2757,7 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Tclose(tid);
if (tid < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: H5Tclose() failed.";
}
HDassert(ret >= 0);
@@ -2794,7 +2767,7 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dclose(dsid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "ds_ctg_v: H5Dclose() failed.";
}
HDassert(ret >= 0);
@@ -2803,7 +2776,6 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
return;
} /* ds_ctg_v() */
-
/*-------------------------------------------------------------------------
* Function: vrfy_ds_ctg_v
*
@@ -2823,26 +2795,27 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
*-------------------------------------------------------------------------
*/
void
-vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
- hid_t dsid = -1;
- hid_t sid = -1;
- hid_t tid = -1;
- hid_t tmp_tid = -1;
- hid_t dcpl = -1;
+vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data)
+{
+ hid_t dsid = -1;
+ hid_t sid = -1;
+ hid_t tid = -1;
+ hid_t tmp_tid = -1;
+ hid_t dcpl = -1;
H5D_space_status_t allocation;
- H5D_layout_t layout;
- int ndims;
- hsize_t dims[1], max_dims[1];
- htri_t type_equal;
- hvl_t *rdata = NULL;
- unsigned u;
- herr_t ret;
+ H5D_layout_t layout;
+ int ndims;
+ hsize_t dims[1], max_dims[1];
+ htri_t type_equal;
+ hvl_t * rdata = NULL;
+ unsigned u;
+ herr_t ret;
if (pass) {
dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT);
if (dsid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Dopen2() failed.";
}
HDassert(dsid > 0);
@@ -2852,7 +2825,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
sid = H5Dget_space(dsid);
if (sid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Dget_space() failed";
}
HDassert(sid > 0);
@@ -2862,7 +2835,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ndims = H5Sget_simple_extent_ndims(sid);
if (1 != ndims) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: 1 != ndims";
}
HDassert(1 == ndims);
@@ -2872,15 +2845,15 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sget_simple_extent_dims(sid, dims, max_dims);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Sget_simple_extent_dims() failed.";
}
- else if ( DSET_SMALL_DIMS != dims[0]) {
- pass = FALSE;
+ else if (DSET_SMALL_DIMS != dims[0]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != dims[0]";
}
- else if ( DSET_SMALL_DIMS != max_dims[0]) {
- pass = FALSE;
+ else if (DSET_SMALL_DIMS != max_dims[0]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != max_dims[0]";
}
HDassert(ret >= 0);
@@ -2892,7 +2865,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
tid = H5Dget_type(dsid);
if (tid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Dget_type() failed.";
}
HDassert(tid > 0);
@@ -2902,7 +2875,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
tmp_tid = H5Tvlen_create(H5T_NATIVE_INT);
if (tmp_tid <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Tvlen_create() failed.";
}
HDassert(tmp_tid > 0);
@@ -2912,7 +2885,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
type_equal = H5Tequal(tid, tmp_tid);
if (1 != type_equal) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: type != vlen H5T_NATIVE_INT";
}
HDassert(1 == type_equal);
@@ -2922,7 +2895,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Tclose(tmp_tid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed.";
}
HDassert(ret >= 0);
@@ -2932,30 +2905,27 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dget_space_status(dsid, &allocation);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Dget_space_status() failed";
}
else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) {
- pass = FALSE;
- failure_mssg =
- "vrfy_ds_ctg_v: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED";
+ pass = FALSE;
+ failure_mssg = "vrfy_ds_ctg_v: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED";
}
- else if (!write_data
- && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) {
- pass = FALSE;
- failure_mssg =
- "vrfy_ds_ctg_v: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED";
+ else if (!write_data && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) {
+ pass = FALSE;
+ failure_mssg = "vrfy_ds_ctg_v: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED";
}
HDassert(ret >= 0);
- HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED)
- || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED));
+ HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) ||
+ (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED));
}
if (pass) {
dcpl = H5Dget_create_plist(dsid);
if (dcpl <= 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Dget_create_plist() failed.";
}
HDassert(dcpl > 0);
@@ -2965,7 +2935,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
layout = H5Pget_layout(dcpl);
if (H5D_CONTIGUOUS != layout) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5D_CONTIGUOUS != layout";
}
HDassert(H5D_CONTIGUOUS == layout);
@@ -2975,17 +2945,17 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Pclose(dcpl);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Pclose() failed.";
}
HDassert(ret >= 0);
}
if ((pass) && (write_data)) {
- rdata = (hvl_t *) HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS);
+ rdata = (hvl_t *)HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS);
if (!rdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: HDmalloc of rdata failed.";
}
HDassert(rdata);
@@ -2995,7 +2965,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dread(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Dread() failed.";
}
HDassert(ret >= 0);
@@ -3006,31 +2976,31 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
unsigned len;
unsigned v;
- len = (unsigned) rdata[u].len;
+ len = (unsigned)rdata[u].len;
for (v = 0; v < len; v++) {
- int *tdata = (int *) rdata[u].p;
+ int *tdata = (int *)rdata[u].p;
if (!tdata) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: !tdata";
break;
}
- else if ((int) (u + v) != tdata[v]) {
- pass = FALSE;
+ else if ((int)(u + v) != tdata[v]) {
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: (int)(u + v) != tdata[v]";
break;
}
HDassert(tdata);
- HDassert((int )(u + v) == tdata[v]);
+ HDassert((int)(u + v) == tdata[v]);
} /* end for */
- } /* end for */
+ } /* end for */
}
if ((pass) && (write_data)) {
ret = H5Treclaim(tid, sid, H5P_DEFAULT, rdata);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Treclaim() failed.";
}
HDassert(ret >= 0);
@@ -3042,7 +3012,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Sclose(sid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Sclose() failed.";
}
HDassert(ret >= 0);
@@ -3052,7 +3022,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Tclose(tid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed.";
}
HDassert(ret >= 0);
@@ -3062,7 +3032,7 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
ret = H5Dclose(dsid);
if (ret < 0) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "vrfy_ds_ctg_v: H5Dclose() failed.";
}
HDassert(ret >= 0);
@@ -3071,7 +3041,6 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
return;
} /* vrfy_ds_ctg_v() */
-
/*-------------------------------------------------------------------------
* Function: create_zoo
*
@@ -3109,26 +3078,26 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
HDassert(base_path);
/* Add & verify an empty "new style" group */
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/A", base_path);
HDassert(HDstrlen(full_path) < 1024);
ns_grp_0(fid, full_path);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/A", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_0(fid, full_path);
}
/* Add & verify a compact "new style" group (3 link messages) */
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/B", base_path);
HDassert(HDstrlen(full_path) < 1024);
ns_grp_c(fid, full_path, 3);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/B", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_c(fid, full_path, 3);
@@ -3137,26 +3106,26 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify a dense "new style" group (w/300 links, in v2 B-tree &
* fractal heap)
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/C", base_path);
HDassert(HDstrlen(full_path) < 1024);
ns_grp_d(fid, full_path, 300);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/C", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_d(fid, full_path, 300);
}
/* Add & verify an empty "old style" group to file */
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/D", base_path);
HDassert(HDstrlen(full_path) < 1024);
os_grp_0(fid, full_path);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/D", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_os_grp_0(fid, full_path);
@@ -3165,13 +3134,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify an "old style" group (w/300 links, in v1 B-tree &
* local heap) to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/E", base_path);
HDassert(HDstrlen(full_path) < 1024);
os_grp_n(fid, full_path, proc_num, 300);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/E", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_os_grp_n(fid, full_path, proc_num, 300);
@@ -3180,13 +3149,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify a contiguous dataset w/integer datatype (but no data)
* to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/F", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_ctg_i(fid, full_path, FALSE);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/F", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_i(fid, full_path, FALSE);
@@ -3195,13 +3164,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify a contiguous dataset w/integer datatype (with data)
* to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/G", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_ctg_i(fid, full_path, TRUE);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/G", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_i(fid, full_path, TRUE);
@@ -3210,13 +3179,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify a chunked dataset w/integer datatype (but no data)
* to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/H", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_chk_i(fid, full_path, FALSE);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/H", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_chk_i(fid, full_path, FALSE);
@@ -3225,13 +3194,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify a chunked dataset w/integer datatype (and data)
* to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/I", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_chk_i(fid, full_path, TRUE);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/I", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_chk_i(fid, full_path, TRUE);
@@ -3240,13 +3209,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify a compact dataset w/integer datatype (but no data)
* to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/J", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_cpt_i(fid, full_path, FALSE);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/J", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_cpt_i(fid, full_path, FALSE);
@@ -3255,13 +3224,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify a compact dataset w/integer datatype (and data)
* to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/K", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_cpt_i(fid, full_path, TRUE);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/K", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_cpt_i(fid, full_path, TRUE);
@@ -3270,13 +3239,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify a contiguous dataset w/variable-length datatype
* (but no data) to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/L", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_ctg_v(fid, full_path, FALSE);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/L", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_v(fid, full_path, FALSE);
@@ -3285,13 +3254,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify a contiguous dataset w/variable-length datatype
* (and data) to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/M", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_ctg_v(fid, full_path, TRUE);
}
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/M", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_v(fid, full_path, TRUE);
@@ -3300,7 +3269,6 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
return;
} /* create_zoo() */
-
/*-------------------------------------------------------------------------
* Function: validate_zoo
*
@@ -3336,14 +3304,14 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
HDassert(base_path);
/* validate an empty "new style" group */
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/A", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_0(fid, full_path);
}
/* validate a compact "new style" group (3 link messages) */
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/B", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_c(fid, full_path, 3);
@@ -3352,14 +3320,14 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate a dense "new style" group (w/300 links, in v2 B-tree &
* fractal heap)
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/C", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_d(fid, full_path, 300);
}
/* validate an empty "old style" group in file */
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/D", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_os_grp_0(fid, full_path);
@@ -3368,7 +3336,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate an "old style" group (w/300 links, in v1 B-tree &
* local heap)
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/E", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_os_grp_n(fid, full_path, proc_num, 300);
@@ -3377,7 +3345,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate a contiguous dataset w/integer datatype (but no data)
* in file.
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/F", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_i(fid, full_path, FALSE);
@@ -3386,7 +3354,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate a contiguous dataset w/integer datatype (with data)
* in file.
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/G", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_i(fid, full_path, TRUE);
@@ -3395,7 +3363,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate a chunked dataset w/integer datatype (but no data)
* in file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/H", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_chk_i(fid, full_path, FALSE);
@@ -3404,7 +3372,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate a chunked dataset w/integer datatype (and data)
* in file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/I", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_chk_i(fid, full_path, TRUE);
@@ -3413,7 +3381,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* Validate a compact dataset w/integer datatype (but no data)
* in file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/J", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_cpt_i(fid, full_path, FALSE);
@@ -3422,7 +3390,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate a compact dataset w/integer datatype (and data)
* in file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/K", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_cpt_i(fid, full_path, TRUE);
@@ -3431,7 +3399,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate a contiguous dataset w/variable-length datatype
* (but no data) to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/L", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_v(fid, full_path, FALSE);
@@ -3440,7 +3408,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate a contiguous dataset w/variable-length datatype
* (and data) to file
*/
- if ( pass ) {
+ if (pass) {
HDsprintf(full_path, "%s/M", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_v(fid, full_path, TRUE);
@@ -3448,4 +3416,3 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
return;
} /* validate_zoo() */
-
diff --git a/test/genall5.h b/test/genall5.h
index 20141de..a201b38 100644
--- a/test/genall5.h
+++ b/test/genall5.h
@@ -34,8 +34,7 @@ void os_grp_0(hid_t fid, const char *group_name);
void vrfy_os_grp_0(hid_t fid, const char *group_name);
void os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks);
-void vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
- unsigned nlinks);
+void vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks);
void ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data);
void vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data);
@@ -48,4 +47,3 @@ void vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data);
void ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data);
void vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data);
-
diff --git a/test/getname.c b/test/getname.c
index ef0d5ea..61feee6 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -18,39 +18,32 @@
* Purpose: Tests the "ID to name" functionality
*/
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
-#define H5I_FRIEND /*suppress error about including H5Ipkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5I_FRIEND /*suppress error about including H5Ipkg */
/* Define these macros to indicate that the testing APIs should be available */
#define H5G_TESTING
#define H5I_TESTING
#include "h5test.h"
-#include "H5Gpkg.h" /* Groups */
-#include "H5Ipkg.h" /* IDs */
-
+#include "H5Gpkg.h" /* Groups */
+#include "H5Ipkg.h" /* IDs */
/* Compound datatype */
typedef struct s1_t {
unsigned int a;
unsigned int b;
- float c;
+ float c;
} s1_t;
-const char *FILENAME[] = {
- "getname",
- "getname1",
- "getname2",
- "getname3",
- NULL
-};
+const char *FILENAME[] = {"getname", "getname1", "getname2", "getname3", NULL};
-#define NAME_BUF_SIZE 64
-#define SMALL_NAME_BUF_SIZE 2
+#define NAME_BUF_SIZE 64
+#define SMALL_NAME_BUF_SIZE 2
/* Object reference macros */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 8
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 8
/* Dataset region reference macros */
#define REFREG_DSETNAMEV "MATRIX"
@@ -59,27 +52,32 @@ const char *FILENAME[] = {
static int
check_name(hid_t id, const char *chk_name, const char *chk_user_path)
{
- char name[NAME_BUF_SIZE]; /* Buffer to hold name and its size */
- char user_path[NAME_BUF_SIZE]; /* Buffer to hold user path */
- size_t user_path_len; /* Length of user path */
- unsigned user_path_hidden; /* Whether the user path is hidden */
+ char name[NAME_BUF_SIZE]; /* Buffer to hold name and its size */
+ char user_path[NAME_BUF_SIZE]; /* Buffer to hold user path */
+ size_t user_path_len; /* Length of user path */
+ unsigned user_path_hidden; /* Whether the user path is hidden */
/* Get name */
*name = '\0';
- if(H5Iget_name(id, name, NAME_BUF_SIZE) < 0) TEST_ERROR
+ if (H5Iget_name(id, name, NAME_BUF_SIZE) < 0)
+ TEST_ERROR
/* Get user path */
*user_path = '\0';
- if(H5G__user_path_test(id, user_path, &user_path_len, &user_path_hidden) < 0) TEST_ERROR
+ if (H5G__user_path_test(id, user_path, &user_path_len, &user_path_hidden) < 0)
+ TEST_ERROR
/* Check on name from H5Iget_name() */
- if(HDstrcmp(name, chk_name)) goto error;
+ if (HDstrcmp(name, chk_name))
+ goto error;
/* Check on user path */
- if(HDstrcmp(user_path, chk_user_path)) goto error;
+ if (HDstrcmp(user_path, chk_user_path))
+ goto error;
/* Check that if user path is hidden, the name from H5Iget_name() and the user path should be different */
- if(user_path_hidden && !HDstrcmp(chk_name, chk_user_path)) TEST_ERROR
+ if (user_path_hidden && !HDstrcmp(chk_name, chk_user_path))
+ TEST_ERROR
/* Everything matches */
return 0;
@@ -92,20 +90,20 @@ error:
static int
test_main(hid_t file_id, hid_t fapl)
{
- char filename1[1024];
- char filename2[1024];
- char filename3[1024];
- hid_t file1_id, file2_id, file3_id;
- hid_t group_id, group2_id, group3_id, group4_id, group5_id, group6_id, group7_id;
- hid_t dataset_id, dataset2_id;
- hid_t space_id;
- hid_t type_id, type2_id;
- hsize_t dims[1] = { 5 };
- size_t name_len; /* Name length */
- H5O_info2_t oinfo; /* Object info structs */
- hid_t dtype; /* Object identifier for testing */
- hid_t dtype_anon; /* Object identifier for testing anonymous */
- ssize_t size; /* Size returned by H5Iget_name */
+ char filename1[1024];
+ char filename2[1024];
+ char filename3[1024];
+ hid_t file1_id, file2_id, file3_id;
+ hid_t group_id, group2_id, group3_id, group4_id, group5_id, group6_id, group7_id;
+ hid_t dataset_id, dataset2_id;
+ hid_t space_id;
+ hid_t type_id, type2_id;
+ hsize_t dims[1] = {5};
+ size_t name_len; /* Name length */
+ H5O_info2_t oinfo; /* Object info structs */
+ hid_t dtype; /* Object identifier for testing */
+ hid_t dtype_anon; /* Object identifier for testing anonymous */
+ ssize_t size; /* Size returned by H5Iget_name */
/* Initialize the file names */
h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
@@ -113,42 +111,46 @@ test_main(hid_t file_id, hid_t fapl)
h5_fixname(FILENAME[3], fapl, filename3, sizeof filename3);
/*-------------------------------------------------------------------------
- * Test H5Iget_name with one group
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with one group
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with one group");
/* Create group "g0" in the root group using absolute name */
- if((group_id = H5Gcreate2(file_id, "/g0", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g0", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g0", "/g0") < 0) TEST_ERROR
+ if (check_name(group_id, "/g0", "/g0") < 0)
+ TEST_ERROR
/* Close */
H5Gclose(group_id);
PASSED();
-
-
/*-------------------------------------------------------------------------
- * Test H5Iget_name with more than one group
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with more than one group
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with more than one group");
/* Create group "g1" in the root group using absolute name */
- if((group_id = H5Gcreate2(file_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create group "g2" in group "g1" using absolute name */
- if((group2_id = H5Gcreate2(file_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR
+ if (check_name(group_id, "/g1", "/g1") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g1/g2", "/g1/g2") < 0)
+ TEST_ERROR
/* Close */
H5Gclose(group_id);
@@ -156,106 +158,123 @@ test_main(hid_t file_id, hid_t fapl)
PASSED();
-
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gopen2
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gopen2
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Gopen2");
/* Reopen the group */
- if((group_id = H5Gopen2(file_id, "/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Reopen the group */
- if((group2_id = H5Gopen2(file_id, "/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file_id, "/g1/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR
+ if (check_name(group_id, "/g1", "/g1") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g1/g2", "/g1/g2") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-
-
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Dcreate2
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Dcreate2
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Dcreate2");
/* Create the dataspace */
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
/* Create a new dataset */
- if((dataset_id = H5Dcreate2(file_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dataset_id =
+ H5Dcreate2(file_id, "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR
+ if (check_name(dataset_id, "/d1", "/d1") < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
/* Reopen the group */
- if((group_id = H5Gopen2(file_id, "g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "g1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a new dataset inside "g1" */
- if((dataset_id = H5Dcreate2(group_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset_id =
+ H5Dcreate2(group_id, "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR
+ if (check_name(dataset_id, "/g1/d1", "/g1/d1") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Dopen2
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Dopen2
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Dopen2");
/* Reopen the dataset */
- if((dataset_id = H5Dopen2(file_id, "d1", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dataset_id = H5Dopen2(file_id, "d1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR
+ if (check_name(dataset_id, "/d1", "/d1") < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
/* Reopen the group */
- if((group_id = H5Gopen2(file_id, "g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "g1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Reopen the dataset */
- if((dataset_id = H5Dopen2(group_id, "d1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset_id = H5Dopen2(group_id, "d1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR
+ if (check_name(dataset_id, "/g1/d1", "/g1/d1") < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-
/*-------------------------------------------------------------------------
* Test H5Iget_name with a long path
*-------------------------------------------------------------------------
@@ -264,33 +283,46 @@ test_main(hid_t file_id, hid_t fapl)
TESTING("H5Iget_name with a long path");
/* Create group "g2/bar/baz" */
- if((group_id = H5Gcreate2(file_id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "g2/bar", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "g2/bar/baz", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "g2/bar", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "g2/bar/baz", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset */
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
- if((dataset_id = H5Dcreate2(group3_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((dataset_id = H5Dcreate2(group3_id, "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Reopen the dataset */
- if((dataset_id = H5Dopen2(file_id, "/g2/bar/baz/d1", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dataset_id = H5Dopen2(file_id, "/g2/bar/baz/d1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(dataset_id, "/g2/bar/baz/d1", "/g2/bar/baz/d1") < 0) TEST_ERROR
+ if (check_name(dataset_id, "/g2/bar/baz/d1", "/g2/bar/baz/d1") < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
/*-------------------------------------------------------------------------
* Test H5Iget_name with H5Tcommit2
*-------------------------------------------------------------------------
@@ -299,18 +331,24 @@ test_main(hid_t file_id, hid_t fapl)
TESTING("H5Iget_name with H5Tcommit2");
/* Create a datatype */
- if((type_id = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) TEST_ERROR
+ if ((type_id = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0)
+ TEST_ERROR
/* Insert fields */
- if(H5Tinsert(type_id, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(type_id, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(type_id, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0) TEST_ERROR
+ if (H5Tinsert(type_id, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(type_id, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(type_id, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0)
+ TEST_ERROR
/* Save datatype for later */
- if(H5Tcommit2(file_id, "t1", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Tcommit2(file_id, "t1", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR
+ if (check_name(type_id, "/t1", "/t1") < 0)
+ TEST_ERROR
/* Close datatype */
H5Tclose(type_id);
@@ -325,399 +363,503 @@ test_main(hid_t file_id, hid_t fapl)
TESTING("H5Iget_name with H5Topen2");
/* Open the named datatype */
- if((type_id = H5Topen2(file_id, "t1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((type_id = H5Topen2(file_id, "t1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR
+ if (check_name(type_id, "/t1", "/t1") < 0)
+ TEST_ERROR
/* Close datatype */
- if(H5Tclose(type_id) < 0) FAIL_STACK_ERROR
+ if (H5Tclose(type_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lmove and H5Gopen2
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lmove and H5Gopen2
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lmove and H5Gopen2");
/* Reopen the group */
- if((group_id = H5Gopen2(file_id, "/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Rename group */
- if(H5Lmove(file_id, "/g1", H5L_SAME_LOC, "/g1a", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/g1", H5L_SAME_LOC, "/g1a", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR
+ if (check_name(group_id, "/g1a", "/g1a") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lmove and H5Dopen2
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lmove and H5Dopen2
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lmove and H5Dopen2");
/* Reopen the dataset */
- if((dataset_id = H5Dopen2(file_id, "/d1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset_id = H5Dopen2(file_id, "/d1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Rename dataset */
- if(H5Lmove(file_id, "/d1", H5L_SAME_LOC, "/d1a", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/d1", H5L_SAME_LOC, "/d1a", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(dataset_id, "/d1a", "/d1a") < 0) FAIL_STACK_ERROR
+ if (check_name(dataset_id, "/d1a", "/d1a") < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lmove and H5Topen2
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lmove and H5Topen2
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lmove and H5Topen2");
/* Open the named datatype */
- if((type_id = H5Topen2(file_id, "/t1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((type_id = H5Topen2(file_id, "/t1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Rename datatype */
- if(H5Lmove(file_id, "/t1", H5L_SAME_LOC, "/t1a", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/t1", H5L_SAME_LOC, "/t1a", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(type_id, "/t1a", "/t1a") < 0) FAIL_STACK_ERROR
+ if (check_name(type_id, "/t1a", "/t1a") < 0)
+ FAIL_STACK_ERROR
/* Close datatype */
- if(H5Tclose(type_id) < 0) FAIL_STACK_ERROR
+ if (H5Tclose(type_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lmove and relative names
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Lmove and relative names
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lmove and relative names");
/* Create group "/g3" */
- if((group_id = H5Gcreate2(file_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create group "/g3/foo" using absolute name */
- if((group2_id = H5Gcreate2(file_id, "/g3/foo1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g3/foo1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Open group "/g3/foo" again */
- if((group3_id = H5Gopen2(file_id, "/g3/foo1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g3/foo1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Rename group */
- if(H5Lmove(group_id, "foo1", H5L_SAME_LOC, "foo2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(group_id, "foo1", H5L_SAME_LOC, "foo2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR
+ if (check_name(group_id, "/g3", "/g3") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g3/foo2", "/g3/foo2") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group3_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g3/foo2", "/g3/foo2") < 0)
+ TEST_ERROR
/* Rename group again */
- if(H5Lmove(file_id, "g3/foo2", H5L_SAME_LOC, "g3/foo1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "g3/foo2", H5L_SAME_LOC, "g3/foo1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR
+ if (check_name(group_id, "/g3", "/g3") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g3/foo1", "/g3/foo1") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group3_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g3/foo1", "/g3/foo1") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lmove and a long path
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lmove and a long path
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lmove and a long path");
/* Create group "g4/A/B" */
- if((group_id = H5Gcreate2(file_id, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "g4/A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "g4/A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "g4/A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "g4/A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create group "g5/C" */
- if((group4_id = H5Gcreate2(file_id, "g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group5_id = H5Gcreate2(file_id, "g5/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group4_id = H5Gcreate2(file_id, "g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group5_id = H5Gcreate2(file_id, "g5/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0)
+ TEST_ERROR
/* Move group "B" to "D"*/
- if(H5Lmove(file_id, "/g4/A/B", H5L_SAME_LOC, "/g5/C/D", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/g4/A/B", H5L_SAME_LOC, "/g5/C/D", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g5/C/D", "/g5/C/D") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g5/C/D", "/g5/C/D") < 0)
+ TEST_ERROR
/* Move group "/g5/C/D" back to "/g4/A/B" using relative name */
- if(H5Lmove(group5_id, "D", group2_id, "B", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(group5_id, "D", group2_id, "B", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0)
+ TEST_ERROR
/* Move group "/g4/A/B" to "/g4/F/B" using relative name */
- if(H5Lmove(group_id, "A", group_id, "F", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(group_id, "A", group_id, "F", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g4/F/B", "/g4/F/B") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g4/F/B", "/g4/F/B") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "/g4/F", "/g4/F") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g4/F", "/g4/F") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group5_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lmove and a long path #2
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lmove and a long path #2
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lmove and a long path #2");
/* Create group "g6/A/B" and "g7" */
- if((group_id = H5Gcreate2(file_id, "g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "g6/A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "g6/A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group4_id = H5Gcreate2(file_id, "g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "g6/A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "g6/A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group4_id = H5Gcreate2(file_id, "g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g6/A/B", "/g6/A/B") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g6/A/B", "/g6/A/B") < 0)
+ TEST_ERROR
/* Move group "A" to "C"*/
- if(H5Lmove(file_id, "/g6/A", H5L_SAME_LOC, "/g7/C", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/g6/A", H5L_SAME_LOC, "/g7/C", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g7/C", "/g7/C") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g7/C", "/g7/C") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group3_id, "/g7/C/B", "/g7/C/B") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g7/C/B", "/g7/C/B") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Ldelete
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Ldelete
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Ldelete");
/* Create a new group. */
- if((group_id = H5Gcreate2(file_id, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete */
- if(H5Ldelete(file_id, "/g8", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, "/g8", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "", "") < 0) TEST_ERROR
+ if (check_name(group_id, "", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Ldelete and a long path
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Ldelete and a long path
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Ldelete and a long path");
/* Create group "g9/a/b" */
- if((group_id = H5Gcreate2(file_id, "g9", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "g9/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "g9/a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "g9", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "g9/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "g9/a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete */
- if(H5Ldelete(file_id, "/g9/a", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, "/g9/a", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR
+ if (check_name(group2_id, "", "") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR
+ if (check_name(group3_id, "", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Recreate groups */
- if((group2_id = H5Gcreate2(group_id, "a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(group_id, "a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(group_id, "a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(group_id, "a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete, using relative path */
- if(H5Ldelete(group_id, "a", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(group_id, "a", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR
+ if (check_name(group2_id, "", "") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR
+ if (check_name(group3_id, "", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
/* Create group "g10/a/b" */
- if((group_id = H5Gcreate2(file_id, "g10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "g10/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "g10/a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "g10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "g10/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "g10/a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete */
- if(H5Ldelete(file_id, "/g10/a/b", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, "/g10/a/b", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR
+ if (check_name(group3_id, "", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Recreate group */
- if((group3_id = H5Gcreate2(group_id, "a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(group_id, "a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete, using relative path */
- if(H5Ldelete(group_id, "a/b", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(group_id, "a/b", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR
+ if (check_name(group3_id, "", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Ldelete, same names
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Ldelete, same names
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Ldelete, same names");
/* Create group "g11/g" */
- if((group_id = H5Gcreate2(file_id, "g11", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "g11/g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "g11", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "g11/g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create two datasets "g11/d" and "g11/g/d"*/
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_ERROR
- if((dataset_id = H5Dcreate2(group_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((dataset2_id = H5Dcreate2(group2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
+ if ((dataset_id =
+ H5Dcreate2(group_id, "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((dataset2_id =
+ H5Dcreate2(group2_id, "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete */
- if(H5Ldelete(file_id, "/g11/d", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, "/g11/d", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(dataset_id, "", "") < 0) TEST_ERROR
+ if (check_name(dataset_id, "", "") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(dataset2_id, "/g11/g/d", "/g11/g/d") < 0) TEST_ERROR
+ if (check_name(dataset2_id, "/g11/g/d", "/g11/g/d") < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Fmount; with IDs on the list
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Fmount; with IDs on the list
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Fmount; with IDs on the list");
/* Create a group "g12" in the first file */
- if((group_id = H5Gcreate2(file_id, "/g12", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g12", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
/* Create second file and dataset "d" in it */
- if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a dataspace */
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
/* Create the dataset */
- if((dataset_id = H5Dcreate2(file1_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dataset_id =
+ H5Dcreate2(file1_id, "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
/* Mount second file under "g12" in the first file */
- if(H5Fmount(file_id, "/g12", file1_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(file_id, "/g12", file1_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Access dataset D in the first file under "/G/D" name */
- if((dataset_id = H5Dopen2(file_id, "/g12/d", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dataset_id = H5Dopen2(file_id, "/g12/d", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(dataset_id, "/g12/d", "/g12/d") < 0) TEST_ERROR
+ if (check_name(dataset_id, "/g12/d", "/g12/d") < 0)
+ TEST_ERROR
- if(H5Funmount(file_id, "/g12") < 0) TEST_ERROR
+ if (H5Funmount(file_id, "/g12") < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR
-
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
/*-------------------------------------------------------------------------
* Test H5Iget_name with H5Fmount; long name
*-------------------------------------------------------------------------
@@ -726,199 +868,271 @@ test_main(hid_t file_id, hid_t fapl)
TESTING("H5Iget_name with H5Fmount; long name");
/* Create a group "g13/g1/g2" in the first file */
- if((group_id = H5Gcreate2(file_id, "/g13", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g13/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "/g13/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g13", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g13/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "/g13/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Create second file and group "g" in it */
file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if((group_id = H5Gcreate2(file1_id, "/g14", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g14/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file1_id, "/g14/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g14", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g14/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file1_id, "/g14/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Mount second file under "/g13/g1" in the first file */
- if(H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Access group in the first file */
- if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR
-
- if(H5Funmount(file_id, "/g13/g1") < 0) FAIL_STACK_ERROR
+ if (check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0)
+ TEST_ERROR
+ if (H5Funmount(file_id, "/g13/g1") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g14/g3/g4", "") < 0) TEST_ERROR
+ if (check_name(group_id, "/g14/g3/g4", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
-
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
/* Access group in the file to mount */
- if((group3_id = H5Gopen2(file1_id, "/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file1_id, "/g14/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Mount second file under "/g13/g1" in the first file(again) */
- if(H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Get a group ID for the parent of the newly mounted group */
- if((group2_id = H5Gopen2(file_id, "/g13", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file_id, "/g13", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Access group in the first file */
- if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR
- if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR
+ if (check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0)
+ TEST_ERROR
- if(H5Funmount(group2_id, "g1") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(group2_id, "g1") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g14/g3/g4", "") < 0) TEST_ERROR
- if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR
+ if (check_name(group_id, "/g14/g3/g4", "") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Mount second file under "/g13/g1" in the first file(again) */
- if(H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Get a group ID for the newly mounted group */
- if((group2_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Access group in the first file */
- if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR
- if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR
+ if (check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g13/g1", "/g13/g1") < 0)
+ TEST_ERROR
- if(H5Funmount(group2_id, ".") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(group2_id, ".") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g14/g3/g4", "") < 0) TEST_ERROR
- if(check_name(group2_id, "/", "") < 0) TEST_ERROR
+ if (check_name(group_id, "/g14/g3/g4", "") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
/* Mount second file under "/g13/g1" in the first file, using relative path */
- if((group3_id = H5Gopen2(file_id, "/g13", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g13", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g13", "/g13") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g13", "/g13") < 0)
+ TEST_ERROR
- if(H5Fmount(group3_id, "g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(group3_id, "g1", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Get a group ID for the newly mounted group */
- if((group2_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g13/g1", "/g13/g1") < 0)
+ TEST_ERROR
/* Access group in the first file */
- if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR
+ if (check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
/* Access group in the first file, with relative path */
- if((group_id = H5Gopen2(group2_id, "g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(group2_id, "g14/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR
+ if (check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
- if(H5Funmount(group2_id, ".") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(group2_id, ".") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/", "") < 0) TEST_ERROR
+ if (check_name(group2_id, "/", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Mount second file under "/g13/g1" in the first file, using relative path */
- if((group3_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g13/g1", "/g13/g1") < 0)
+ TEST_ERROR
- if(H5Fmount(group3_id, ".", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(group3_id, ".", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Get a group ID for the newly mounted group */
- if((group2_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g13/g1", "/g13/g1") < 0)
+ TEST_ERROR
/* Access group in the first file */
- if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR
+ if (check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
/* Access group in the first file, with relative path */
- if((group_id = H5Gopen2(group2_id, "g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(group2_id, "g14/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR
+ if (check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
- if(H5Funmount(group2_id, ".") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(group2_id, ".") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/", "") < 0) TEST_ERROR
- if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/", "") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g13/g1", "/g13/g1") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
-
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Funmount
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Funmount
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Funmount");
/* Create a group "g15/g1/g2" in the first file */
- if((group_id = H5Gcreate2(file_id, "/g15", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g15/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "/g15/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group4_id = H5Gcreate2(file_id, "/g15/g1/g2/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g15", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g15/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "/g15/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group4_id = H5Gcreate2(file_id, "/g15/g1/g2/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -929,47 +1143,62 @@ test_main(hid_t file_id, hid_t fapl)
/* Create second file and group "g" in it */
file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if((group_id = H5Gcreate2(file1_id, "/g16", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g16/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file1_id, "/g16/g4/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g16", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g16/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file1_id, "/g16/g4/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Access group in the first file */
- if((group_id = H5Gopen2(file_id, "/g15/g1/g2/g3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g15/g1/g2/g3", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Mount second file under "/g13/g1" in the first file */
- if(H5Fmount(file_id, "/g15/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file_id, "/g15/g1", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Access group in the second file */
- if((group2_id = H5Gopen2(file_id, "/g15/g1/g16/g4/g5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file_id, "/g15/g1/g16/g4/g5", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "", "/g15/g1/g2/g3") < 0) TEST_ERROR
+ if (check_name(group_id, "", "/g15/g1/g2/g3") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "/g15/g1/g16/g4/g5", "/g15/g1/g16/g4/g5") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g15/g1/g16/g4/g5", "/g15/g1/g16/g4/g5") < 0)
+ TEST_ERROR
- if(H5Funmount(file_id, "/g15/g1") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file_id, "/g15/g1") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g15/g1/g2/g3", "/g15/g1/g2/g3") < 0) TEST_ERROR
+ if (check_name(group_id, "/g15/g1/g2/g3", "/g15/g1/g2/g3") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "/g16/g4/g5", "") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g16/g4/g5", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
-
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
/*-------------------------------------------------------------------------
* Test H5Iget_name with a defined type dataset
*-------------------------------------------------------------------------
@@ -978,278 +1207,352 @@ test_main(hid_t file_id, hid_t fapl)
TESTING("H5Iget_name with a defined type dataset");
/* Create a datatype */
- if((type_id = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) FAIL_STACK_ERROR
+ if ((type_id = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0)
+ FAIL_STACK_ERROR
/* Insert fields */
- if(H5Tinsert(type_id, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(type_id, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(type_id, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
+ if (H5Tinsert(type_id, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(type_id, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(type_id, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create group "g17" */
- if((group_id = H5Gcreate2(file_id, "g17", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "g17", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Save datatype for later */
- if(H5Tcommit2(group_id, "t", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Tcommit2(group_id, "t", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create a dataspace */
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_ERROR
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create a new dataset */
- if((dataset_id = H5Dcreate2(group_id , "d", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset_id = H5Dcreate2(group_id, "d", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type_id) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
/* Open the named datatype */
- if((type_id = H5Topen2(file_id, "/g17/t", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((type_id = H5Topen2(file_id, "/g17/t", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(type_id, "/g17/t", "/g17/t") < 0) TEST_ERROR
+ if (check_name(type_id, "/g17/t", "/g17/t") < 0)
+ TEST_ERROR
/* Close datatype */
- if(H5Tclose(type_id) < 0) FAIL_STACK_ERROR
+ if (H5Tclose(type_id) < 0)
+ FAIL_STACK_ERROR
/* Reopen the dataset */
- if((dataset_id = H5Dopen2(file_id, "/g17/d", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset_id = H5Dopen2(file_id, "/g17/d", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get datatype*/
- if((type_id = H5Dget_type(dataset_id)) < 0) FAIL_STACK_ERROR
+ if ((type_id = H5Dget_type(dataset_id)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(type_id, "/g17/t", "/g17/t") < 0) TEST_ERROR
+ if (check_name(type_id, "/g17/t", "/g17/t") < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with objects that have two names
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with objects that have two names
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with datasets that have two names");
/* Open dataset named "d"*/
- if((dataset_id = H5Dopen2(file_id, "/g17/d", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset_id = H5Dopen2(file_id, "/g17/d", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create link to dataset named "link" */
- if(H5Lcreate_hard(dataset_id, ".", file_id, "/g17/link", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if((dataset2_id = H5Dopen2(file_id, "/g17/link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(dataset_id, ".", file_id, "/g17/link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if ((dataset2_id = H5Dopen2(file_id, "/g17/link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Make sure that the two IDs use two different names */
- if(check_name(dataset_id, "/g17/d", "/g17/d") < 0) TEST_ERROR
- if(check_name(dataset2_id, "/g17/link", "/g17/link") < 0) TEST_ERROR
+ if (check_name(dataset_id, "/g17/d", "/g17/d") < 0)
+ TEST_ERROR
+ if (check_name(dataset2_id, "/g17/link", "/g17/link") < 0)
+ TEST_ERROR
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset2_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with different files, test1
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with different files, test1
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with different files");
/* Create a new file using default properties. */
- if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a new file using default properties. */
- if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataspace */
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_ERROR
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create a new dataset */
- if((dataset_id = H5Dcreate2(file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset_id =
+ H5Dcreate2(file2_id, "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a new dataset */
- if((dataset2_id = H5Dcreate2(file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset2_id =
+ H5Dcreate2(file3_id, "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete */
- if(H5Ldelete(file2_id, "/d", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file2_id, "/d", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(dataset_id, "", "") < 0) TEST_ERROR
+ if (check_name(dataset_id, "", "") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(dataset2_id, "/d", "/d") < 0) TEST_ERROR
+ if (check_name(dataset2_id, "/d", "/d") < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file3_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file3_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with different files, test2
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with different files, test2
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with different files #2");
/* Create a new file using default properties. */
- if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a new file using default properties. */
- if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataspace */
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_ERROR
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create a new dataset */
- if((dataset_id = H5Dcreate2(file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset_id =
+ H5Dcreate2(file2_id, "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a new dataset */
- if((dataset2_id = H5Dcreate2(file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset2_id =
+ H5Dcreate2(file3_id, "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete */
- if(H5Ldelete(file3_id, "/d", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file3_id, "/d", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(dataset_id, "/d", "/d") < 0) TEST_ERROR
+ if (check_name(dataset_id, "/d", "/d") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(dataset2_id, "", "") < 0) TEST_ERROR
+ if (check_name(dataset2_id, "", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file3_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file3_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with a small buffer for name
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with a small buffer for name
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with a small buffer for name");
/* Reopen the group */
- if((group_id = H5Gopen2(file_id, "/g17", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g17", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
-{
- /*small buffer to hold name and its size */
- char name2[SMALL_NAME_BUF_SIZE];
+ {
+ /*small buffer to hold name and its size */
+ char name2[SMALL_NAME_BUF_SIZE];
- /* Get name */
- *name2 = '\0';
- name_len=(size_t)H5Iget_name(group_id, name2, SMALL_NAME_BUF_SIZE);
+ /* Get name */
+ *name2 = '\0';
+ name_len = (size_t)H5Iget_name(group_id, name2, SMALL_NAME_BUF_SIZE);
- /* Check that name is longer */
- if(name_len <= SMALL_NAME_BUF_SIZE) TEST_ERROR
- if(HDstrcmp(name2, "/")) TEST_ERROR
-}
+ /* Check that name is longer */
+ if (name_len <= SMALL_NAME_BUF_SIZE)
+ TEST_ERROR
+ if (HDstrcmp(name2, "/"))
+ TEST_ERROR
+ }
/* Verify */
- if(check_name(group_id, "/g17", "/g17") < 0) TEST_ERROR
+ if (check_name(group_id, "/g17", "/g17") < 0)
+ TEST_ERROR
/* Close */
H5Gclose(group_id);
PASSED();
-
/*-------------------------------------------------------------------------
- * Test H5Iget_name with a dynamic buffer for name
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with a dynamic buffer for name
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with a dynamic buffer for name");
/* Reopen the group */
- if((group_id = H5Gopen2(file_id, "/g17", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g17", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get name */
name_len = (size_t)H5Iget_name(group_id, NULL, NAME_BUF_SIZE);
-{
- /* dynamic buffer to hold name */
- char *name3;
+ {
+ /* dynamic buffer to hold name */
+ char *name3;
- /* Include the extra null character */
- name3 = (char *)HDmalloc(name_len + 1);
- if(!name3) TEST_ERROR
+ /* Include the extra null character */
+ name3 = (char *)HDmalloc(name_len + 1);
+ if (!name3)
+ TEST_ERROR
- /* Get name with dynamic buffer */
- *name3 = '\0';
- if(H5Iget_name(group_id, name3, name_len + 1) < 0) TEST_ERROR
+ /* Get name with dynamic buffer */
+ *name3 = '\0';
+ if (H5Iget_name(group_id, name3, name_len + 1) < 0)
+ TEST_ERROR
- /* Verify */
- if(HDstrcmp(name3, "/g17")) TEST_ERROR
- *name3 = '\0';
+ /* Verify */
+ if (HDstrcmp(name3, "/g17"))
+ TEST_ERROR
+ *name3 = '\0';
- /* Get name with smaller buffer */
- *name3 = '\0';
- if(H5Iget_name(group_id, name3, 3) < 0) TEST_ERROR
+ /* Get name with smaller buffer */
+ *name3 = '\0';
+ if (H5Iget_name(group_id, name3, 3) < 0)
+ TEST_ERROR
- /* Verify */
- if(HDstrcmp(name3, "/g")) TEST_ERROR
+ /* Verify */
+ if (HDstrcmp(name3, "/g"))
+ TEST_ERROR
- HDfree(name3);
-}
+ HDfree(name3);
+ }
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-/*-------------------------------------------------------------------------
- * Test H5Iget_name with invalid IDs
- *-------------------------------------------------------------------------
- */
-
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with invalid IDs
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with invalid IDs");
/* Create a dataspace */
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
/* Define a datatype */
- if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* Create a new dataset */
- if((dataset_id = H5Dcreate2(file_id , "d2", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dataset_id = H5Dcreate2(file_id, "d2", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
-{
- char name[NAME_BUF_SIZE]; /* Buffer to hold name and its size */
+ {
+ char name[NAME_BUF_SIZE]; /* Buffer to hold name and its size */
- /* Get name for non commited datatype, it should fail */
- H5E_BEGIN_TRY {
- if(H5Iget_name(type_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR
- } H5E_END_TRY;
+ /* Get name for non commited datatype, it should fail */
+ H5E_BEGIN_TRY
+ {
+ if (H5Iget_name(type_id, name, NAME_BUF_SIZE) > 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
- /* Get name for dataspace, it should fail */
- H5E_BEGIN_TRY {
- if(H5Iget_name(space_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR
- } H5E_END_TRY;
-}
+ /* Get name for dataspace, it should fail */
+ H5E_BEGIN_TRY
+ {
+ if (H5Iget_name(space_id, name, NAME_BUF_SIZE) > 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
+ }
/* Close */
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(space_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
/*-------------------------------------------------------------------------
* Test H5Iget_name with added names with mounting
*-------------------------------------------------------------------------
@@ -1258,701 +1561,969 @@ test_main(hid_t file_id, hid_t fapl)
TESTING("H5Iget_name with added names with mounting");
/* Create a group "g18/g2" in the first file */
- if((group_id = H5Gcreate2(file_id, "/g18", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g18/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g18", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g18/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Also create a dataset and a datatype */
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_ERROR
- if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
- if((dataset_id = H5Dcreate2(file_id, "g18/d2", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
+ if ((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if ((dataset_id =
+ H5Dcreate2(file_id, "g18/d2", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- if(H5Tcommit2(file_id, "g18/t2", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Tcommit2(file_id, "g18/t2", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create second file and group "/g3/g4/g5" in it */
- if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file1_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group4_id = H5Gcreate2(file1_id, "/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group5_id = H5Gcreate2(file1_id, "/g3/g4/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file1_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group4_id = H5Gcreate2(file1_id, "/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group5_id = H5Gcreate2(file1_id, "/g3/g4/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Mount first file at "g3/g4" in the second file */
- if(H5Fmount(file1_id, "/g3/g4", file_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(file1_id, "/g3/g4", file_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Get name for the group ID in the first file, should be "/g18/g2" still */
- if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g18/g2", "/g18/g2") < 0)
+ TEST_ERROR
/* Get name for the dataset ID in the first file, should be "/g18/g2/d2" still */
- if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR
+ if (check_name(dataset_id, "/g18/d2", "/g18/d2") < 0)
+ TEST_ERROR
/* Get name for the datatype ID in the first file, should be "/g18/g2/t2" still */
- if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR
+ if (check_name(type_id, "/g18/t2", "/g18/t2") < 0)
+ TEST_ERROR
/* Open the mounted group, dataset, and datatype through their new names */
- if((group6_id = H5Gopen2(file1_id, "/g3/g4/g18/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((dataset2_id = H5Dopen2(file1_id, "/g3/g4/g18/d2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((type2_id = H5Topen2(file1_id, "/g3/g4/g18/t2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group6_id = H5Gopen2(file1_id, "/g3/g4/g18/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((dataset2_id = H5Dopen2(file1_id, "/g3/g4/g18/d2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((type2_id = H5Topen2(file1_id, "/g3/g4/g18/t2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify names */
- if(check_name(group6_id, "/g3/g4/g18/g2", "/g3/g4/g18/g2") < 0) TEST_ERROR
- if(check_name(dataset2_id, "/g3/g4/g18/d2", "/g3/g4/g18/d2") < 0) TEST_ERROR
- if(check_name(type2_id, "/g3/g4/g18/t2", "/g3/g4/g18/t2") < 0) TEST_ERROR
+ if (check_name(group6_id, "/g3/g4/g18/g2", "/g3/g4/g18/g2") < 0)
+ TEST_ERROR
+ if (check_name(dataset2_id, "/g3/g4/g18/d2", "/g3/g4/g18/d2") < 0)
+ TEST_ERROR
+ if (check_name(type2_id, "/g3/g4/g18/t2", "/g3/g4/g18/t2") < 0)
+ TEST_ERROR
/* Verify that old IDs still refer to objects by their old names */
- if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR
- if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR
- if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g18/g2", "/g18/g2") < 0)
+ TEST_ERROR
+ if (check_name(dataset_id, "/g18/d2", "/g18/d2") < 0)
+ TEST_ERROR
+ if (check_name(type_id, "/g18/t2", "/g18/t2") < 0)
+ TEST_ERROR
/* Unmount */
- if(H5Funmount(file1_id, "/g3/g4") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1_id, "/g3/g4") < 0)
+ FAIL_STACK_ERROR
/* Get name for the IDs of the first file, should be unchanged */
- if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR
- if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR
- if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g18/g2", "/g18/g2") < 0)
+ TEST_ERROR
+ if (check_name(dataset_id, "/g18/d2", "/g18/d2") < 0)
+ TEST_ERROR
+ if (check_name(type_id, "/g18/t2", "/g18/t2") < 0)
+ TEST_ERROR
/* Get name for the IDs of the second file, should be local names now */
- if(check_name(group6_id, "/g18/g2", "") < 0) TEST_ERROR
- if(check_name(dataset2_id, "/g18/d2", "") < 0) TEST_ERROR
- if(check_name(type2_id, "/g18/t2", "") < 0) TEST_ERROR
-
- if(H5Tclose(type_id) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type2_id) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group6_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
+ if (check_name(group6_id, "/g18/g2", "") < 0)
+ TEST_ERROR
+ if (check_name(dataset2_id, "/g18/d2", "") < 0)
+ TEST_ERROR
+ if (check_name(type2_id, "/g18/t2", "") < 0)
+ TEST_ERROR
- PASSED();
+ if (H5Tclose(type_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group5_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group6_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
+ PASSED();
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Fclose
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Fclose
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Fclose");
/* Create a file and group "/g1/g2" in it */
- if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g1/g2", "/g1/g2") < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g1/g2", "/g1/g2") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Fmount and H5Ldelete
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Fmount and H5Ldelete
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Fmount and H5Ldelete");
/* Create a file and group "/g1/g2" in it */
- if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a new file and group "/g3/g4" in it */
- if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file2_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group4_id = H5Gcreate2(file2_id, "/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file2_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group4_id = H5Gcreate2(file2_id, "/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Mount first file at "/g3/g4" in the second file */
- if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the mounted group */
- if((group5_id = H5Gopen2(file2_id, "/g3/g4/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group5_id = H5Gopen2(file2_id, "/g3/g4/g1/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR
+ if (check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0)
+ TEST_ERROR
/* Delete */
- if(H5Ldelete(file1_id, "/g3/g4/g1/g2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file1_id, "/g3/g4/g1/g2", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group5_id, "", "") < 0) TEST_ERROR
+ if (check_name(group5_id, "", "") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR
+ if (check_name(group2_id, "", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group5_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Fmount and H5Lmove
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Fmount and H5Lmove
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Fmount and H5Lmove");
/* Create a file and group "/g1/g2" in it */
- if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a new file and group "/g3/g4" in it */
- if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file2_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group4_id = H5Gcreate2(file2_id, "/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file2_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group4_id = H5Gcreate2(file2_id, "/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Mount first file at "g3/g4" in the second file */
- if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g3/g4", "/g3/g4") < 0)
+ TEST_ERROR
/* Open the mounted group */
- if((group5_id = H5Gopen2(file2_id, "/g3/g4/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group5_id = H5Gopen2(file2_id, "/g3/g4/g1/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR
+ if (check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0)
+ TEST_ERROR
/* Open another mounted group, in the middle of the path */
- if((group6_id = H5Gopen2(file2_id, "/g3/g4/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group6_id = H5Gopen2(file2_id, "/g3/g4/g1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR
+ if (check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0)
+ TEST_ERROR
/* Rename group */
- if(H5Lmove(file2_id, "/g3/g4/g1/g2", H5L_SAME_LOC, "/g3/g4/g1/g5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file2_id, "/g3/g4/g1/g2", H5L_SAME_LOC, "/g3/g4/g1/g5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR
- if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR
+ if (check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g1/g5", "/g1/g5") < 0)
+ TEST_ERROR
/* Rename group */
- if(H5Lmove(file2_id, "/g3/g4/g1", H5L_SAME_LOC, "/g3/g4/g1a", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file2_id, "/g3/g4/g1", H5L_SAME_LOC, "/g3/g4/g1a", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group5_id, "/g3/g4/g1a/g5", "/g3/g4/g1a/g5") < 0) TEST_ERROR
- if(check_name(group2_id, "/g1a/g5", "/g1a/g5") < 0) TEST_ERROR
+ if (check_name(group5_id, "/g3/g4/g1a/g5", "/g3/g4/g1a/g5") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g1a/g5", "/g1a/g5") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group6_id, "/g3/g4/g1a", "/g3/g4/g1a") < 0) TEST_ERROR
- if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR
+ if (check_name(group6_id, "/g3/g4/g1a", "/g3/g4/g1a") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "/g1a", "/g1a") < 0)
+ TEST_ERROR
/* Rename middle group back, using relative path */
- if(H5Lmove(group3_id, "g4/g1a", H5L_SAME_LOC, "g4/g1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(group3_id, "g4/g1a", H5L_SAME_LOC, "g4/g1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR
- if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR
- if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR
- if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR
+ if (check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g1/g5", "/g1/g5") < 0)
+ TEST_ERROR
+ if (check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "/g1", "/g1") < 0)
+ TEST_ERROR
/* Rename end group back, using relative path */
- if(H5Lmove(group3_id, "g4/g1/g5", H5L_SAME_LOC, "g4/g1/g2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(group3_id, "g4/g1/g5", H5L_SAME_LOC, "g4/g1/g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR
- if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR
- if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR
+ if (check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g1/g2", "/g1/g2") < 0)
+ TEST_ERROR
+ if (check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "/g1", "/g1") < 0)
+ TEST_ERROR
/* Rename mount point */
- if(H5Lmove(file2_id, "/g3/g4", H5L_SAME_LOC, "/g3/g4a", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file2_id, "/g3/g4", H5L_SAME_LOC, "/g3/g4a", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g3/g4a", "/g3/g4a") < 0) TEST_ERROR
- if(check_name(group5_id, "/g3/g4a/g1/g2", "/g3/g4a/g1/g2") < 0) TEST_ERROR
- if(check_name(group6_id, "/g3/g4a/g1", "/g3/g4a/g1") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g3/g4a", "/g3/g4a") < 0)
+ TEST_ERROR
+ if (check_name(group5_id, "/g3/g4a/g1/g2", "/g3/g4a/g1/g2") < 0)
+ TEST_ERROR
+ if (check_name(group6_id, "/g3/g4a/g1", "/g3/g4a/g1") < 0)
+ TEST_ERROR
/* Rename mount point back, using relative path*/
- if(H5Lmove(group3_id, "g4a", H5L_SAME_LOC, "g4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(group3_id, "g4a", H5L_SAME_LOC, "g4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR
- if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR
- if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g3/g4", "/g3/g4") < 0)
+ TEST_ERROR
+ if (check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0)
+ TEST_ERROR
+ if (check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group6_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group5_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group6_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lcreate_hard
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lcreate_hard
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lcreate_hard");
/* Create group "g19/g1" */
- if((group_id = H5Gcreate2(file_id, "/g19", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g19/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g19", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g19/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create hard link to "g19/g1/ group */
- if(H5Lcreate_hard(file_id, "/g19/g1", H5L_SAME_LOC, "/g19/g2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(file_id, "/g19/g1", H5L_SAME_LOC, "/g19/g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g19/g1", "/g19/g1") < 0)
+ TEST_ERROR
/* Open the group */
- if((group3_id = H5Gopen2(file_id, "/g19/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g19/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g19/g2", "/g19/g2") < 0)
+ TEST_ERROR
/* Rename original group */
- if(H5Lmove(file_id, "/g19/g1", H5L_SAME_LOC, "/g19/g3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/g19/g1", H5L_SAME_LOC, "/g19/g3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g19/g3", "/g19/g3") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g19/g2", "/g19/g2") < 0)
+ TEST_ERROR
/* Rename original group back, using relative path */
- if(H5Lmove(group_id, "g3", H5L_SAME_LOC, "g1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(group_id, "g3", H5L_SAME_LOC, "g1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g19/g1", "/g19/g1") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g19/g2", "/g19/g2") < 0)
+ TEST_ERROR
/* Create another hard link to "/g19/g1" group */
- if(H5Lcreate_hard(file_id, "/g19/g1", H5L_SAME_LOC, "/g19/g3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(file_id, "/g19/g1", H5L_SAME_LOC, "/g19/g3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the group */
- if((group4_id = H5Gopen2(file_id, "/g19/g3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group4_id = H5Gopen2(file_id, "/g19/g3", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g19/g3", "/g19/g3") < 0)
+ TEST_ERROR
/* Delete group */
- if(H5Ldelete(file_id, "/g19/g3", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, "/g19/g3", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR
- if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g19/g1", "") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g19/g1", "/g19/g1") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g19/g2", "/g19/g2") < 0)
+ TEST_ERROR
/* Close the unlinked group */
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
/* Create another hard link to "/g19/g1" group */
- if(H5Lcreate_hard(file_id, "/g19/g1", H5L_SAME_LOC, "/g19/g3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(file_id, "/g19/g1", H5L_SAME_LOC, "/g19/g3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the group */
- if((group4_id = H5Gopen2(file_id, "/g19/g3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group4_id = H5Gopen2(file_id, "/g19/g3", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g19/g3", "/g19/g3") < 0)
+ TEST_ERROR
/* Delete group, using relative path */
- if(H5Ldelete(group_id, "g3", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(group_id, "g3", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR
- if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g19/g1", "") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g19/g1", "/g19/g1") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g19/g2", "/g19/g2") < 0)
+ TEST_ERROR
/* Close the unlinked group */
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lcreate_soft
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lcreate_soft
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lcreate_soft");
/* Create group "g20/g1" */
- if((group_id = H5Gcreate2(file_id, "/g20", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g20/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g20", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g20/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create symbolic link to "g20/g1/ group */
- if(H5Lcreate_soft("/g20/g1", file_id, "/g20/g2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/g20/g1", file_id, "/g20/g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g20/g1", "/g20/g1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g20/g1", "/g20/g1") < 0)
+ TEST_ERROR
/* Open the group */
- if((group3_id = H5Gopen2(file_id, "/g20/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g20/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g20/g2", "/g20/g2") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g20/g2", "/g20/g2") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lcreate_soft and move target
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lcreate_soft and move target
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lcreate_soft and move target");
/* Create group "g21/g1" */
- if((group_id = H5Gcreate2(file_id, "/g21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g21/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g21/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create symbolic link to "g21/g1/ group */
- if(H5Lcreate_soft("/g21/g1", file_id, "/g21/g2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/g21/g1", file_id, "/g21/g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g21/g1", "/g21/g1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g21/g1", "/g21/g1") < 0)
+ TEST_ERROR
/* Open the group */
- if((group3_id = H5Gopen2(file_id, "/g21/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g21/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Rename group */
- if(H5Lmove(file_id, "/g21/g1", H5L_SAME_LOC, "/g21/g3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/g21/g1", H5L_SAME_LOC, "/g21/g3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g21/g3", "/g21/g3") < 0) TEST_ERROR
- if(check_name(group3_id, "/g21/g2", "/g21/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g21/g3", "/g21/g3") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g21/g2", "/g21/g2") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lcreate_soft and move source
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lcreate_soft and move source
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lcreate_soft and move source");
/* Create group "g22/g1" */
- if((group_id = H5Gcreate2(file_id, "/g22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g22/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g22/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create symbolic link to "g22/g1/ group */
- if(H5Lcreate_soft("/g22/g1", file_id, "/g22/g2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/g22/g1", file_id, "/g22/g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g22/g1", "/g22/g1") < 0)
+ TEST_ERROR
/* Open the group */
- if((group3_id = H5Gopen2(file_id, "/g22/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g22/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Rename soft link */
- if(H5Lmove(file_id, "/g22/g2", H5L_SAME_LOC, "/g22/g3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/g22/g2", H5L_SAME_LOC, "/g22/g3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR
- if(check_name(group3_id, "/g22/g3", "/g22/g3") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g22/g1", "/g22/g1") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g22/g3", "/g22/g3") < 0)
+ TEST_ERROR
/* Rename soft link, using relative paths */
- if(H5Lmove(group_id, "g3", H5L_SAME_LOC, "g2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(group_id, "g3", H5L_SAME_LOC, "g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR
- if(check_name(group3_id, "/g22/g2", "/g22/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g22/g1", "/g22/g1") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g22/g2", "/g22/g2") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lcreate_soft and unlink target
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lcreate_soft and unlink target
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lcreate_soft and unlink target");
/* Create group "g23/g1" */
- if((group_id = H5Gcreate2(file_id, "/g23", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g23/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g23", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g23/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create symbolic link to "g23/g1/ group */
- if(H5Lcreate_soft("/g23/g1", file_id, "/g23/g2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/g23/g1", file_id, "/g23/g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g23/g1", "/g23/g1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g23/g1", "/g23/g1") < 0)
+ TEST_ERROR
/* Open the group */
- if((group3_id = H5Gopen2(file_id, "/g23/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g23/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete group */
- if(H5Ldelete(file_id, "/g23/g1", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, "/g23/g1", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g23/g2", "/g23/g2") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g23/g2", "/g23/g2") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Lcreate_soft and unlink source
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Lcreate_soft and unlink source
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with H5Lcreate_soft and unlink source");
/* Create group "g24/g1" */
- if((group_id = H5Gcreate2(file_id, "/g24", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g24/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g24", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g24/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create symbolic link to "g24/g1/ group */
- if(H5Lcreate_soft("/g24/g1", file_id, "/g24/g2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/g24/g1", file_id, "/g24/g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g24/g1", "/g24/g1") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g24/g1", "/g24/g1") < 0)
+ TEST_ERROR
/* Open the group */
- if((group3_id = H5Gopen2(file_id, "/g24/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g24/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete symbolic link */
- if(H5Ldelete(file_id, "/g24/g2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, "/g24/g2", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g24/g1", "") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g24/g1", "") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with several nested mounted files
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with several nested mounted files
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with several nested mounted files");
/* Create a group "g25/g1/g2" in the first file */
- if((group_id = H5Gcreate2(file_id, "/g25", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g25/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "/g25/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g25", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g25/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "/g25/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Create second file and group "/g26/g3/g4" in it */
- if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file1_id, "/g26", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g26/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file1_id, "/g26/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g26", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g26/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file1_id, "/g26/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Create third file and group "/g27/g5/g6" in it */
- if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file2_id, "/g27", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file2_id, "/g27/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file2_id, "/g27/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file2_id, "/g27", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file2_id, "/g27/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file2_id, "/g27/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Create fourth file and group "/g28/g5/g6" in it */
- if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file3_id, "/g28", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file3_id, "/g28/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file3_id, "/g28/g7/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file3_id, "/g28", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file3_id, "/g28/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file3_id, "/g28/g7/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Access group which will be hidden in the first file */
- if((group_id = H5Gopen2(file_id, "/g25/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g25/g1/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR
+ if (check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0)
+ TEST_ERROR
/* Mount second file under "/g25/g1" in the first file */
- if(H5Fmount(file_id, "/g25/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file_id, "/g25/g1", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR
+ if (check_name(group_id, "", "/g25/g1/g2") < 0)
+ TEST_ERROR
/* Access group which will be hidden in the second file */
- if((group2_id = H5Gopen2(file_id, "/g25/g1/g26/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file_id, "/g25/g1/g26/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0)
+ TEST_ERROR
/* Mount third file under "/g25/g1/g26/g3" in the first file */
- if(H5Fmount(file_id, "/g25/g1/g26/g3", file2_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file_id, "/g25/g1/g26/g3", file2_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR
+ if (check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0)
+ TEST_ERROR
/* Access group in the third file */
- if((group3_id = H5Gopen2(file_id, "/g25/g1/g26/g3/g27/g5/g6", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g25/g1/g26/g3/g27/g5/g6", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0)
+ TEST_ERROR
/* Mount fourth file under "/g25/g1/g26/g3/g27/g5" in the first file */
- if(H5Fmount(file_id, "/g25/g1/g26/g3/g27/g5", file3_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file_id, "/g25/g1/g26/g3/g27/g5", file3_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR
+ if (check_name(group3_id, "", "/g25/g1/g26/g3/g27/g5/g6") < 0)
+ TEST_ERROR
/* Access group in the fourth file */
- if((group4_id = H5Gopen2(file_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group4_id = H5Gopen2(file_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", "/g25/g1/g26/g3/g27/g5/g28/g7/g8") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", "/g25/g1/g26/g3/g27/g5/g28/g7/g8") < 0)
+ TEST_ERROR
- if(H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g28/g7/g8", "") < 0) TEST_ERROR
- if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR
- if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR
- if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g28/g7/g8", "") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "", "/g25/g1/g2") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file3_id) < 0)
+ FAIL_STACK_ERROR
- if(H5Funmount(file_id, "/g25/g1/g26/g3") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file_id, "/g25/g1/g26/g3") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g27/g5/g6", "") < 0) TEST_ERROR
- if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR
- if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g27/g5/g6", "") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "", "/g25/g1/g2") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2_id) < 0)
+ FAIL_STACK_ERROR
- if(H5Funmount(file_id, "/g25/g1") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file_id, "/g25/g1") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g26/g3/g4", "") < 0) TEST_ERROR
- if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g26/g3/g4", "") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name and H5Lmove with repeated path components
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name and H5Lmove with repeated path components
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name and H5Lmove with repeated path components");
/* Create a group "g29/g1/g2/g1/g2" in a file */
- if((group_id = H5Gcreate2(file_id, "/g29", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g29/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "/g29/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group4_id = H5Gcreate2(file_id, "/g29/g1/g2/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group5_id = H5Gcreate2(file_id, "/g29/g1/g2/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g29", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g29/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "/g29/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group4_id = H5Gcreate2(file_id, "/g29/g1/g2/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group5_id = H5Gcreate2(file_id, "/g29/g1/g2/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Rename group */
- if(H5Lmove(file_id, "/g29/g1/g2/g1/g2", H5L_SAME_LOC, "/g29/g1/g2/g1/g3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/g29/g1/g2/g1/g2", H5L_SAME_LOC, "/g29/g1/g2/g1/g3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group5_id, "/g29/g1/g2/g1/g3", "/g29/g1/g2/g1/g3") < 0) TEST_ERROR
+ if (check_name(group5_id, "/g29/g1/g2/g1/g3", "/g29/g1/g2/g1/g3") < 0)
+ TEST_ERROR
/* Rename group in middle of path, keeping within the same group */
- if(H5Lmove(file_id, "/g29/g1/g2/g1", H5L_SAME_LOC, "/g29/g1/g2/g3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/g29/g1/g2/g1", H5L_SAME_LOC, "/g29/g1/g2/g3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g29/g1/g2/g3", "/g29/g1/g2/g3") < 0) TEST_ERROR
- if(check_name(group5_id, "/g29/g1/g2/g3/g3", "/g29/g1/g2/g3/g3") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g29/g1/g2/g3", "/g29/g1/g2/g3") < 0)
+ TEST_ERROR
+ if (check_name(group5_id, "/g29/g1/g2/g3/g3", "/g29/g1/g2/g3/g3") < 0)
+ TEST_ERROR
/* Rename group in middle of path, moving to another group in file */
- if(H5Lmove(file_id, "/g29/g1/g2/g3", H5L_SAME_LOC, "/g29/g3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file_id, "/g29/g1/g2/g3", H5L_SAME_LOC, "/g29/g3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g29/g3", "/g29/g3") < 0) TEST_ERROR
- if(check_name(group5_id, "/g29/g3/g3", "/g29/g3/g3") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g29/g3", "/g29/g3") < 0)
+ TEST_ERROR
+ if (check_name(group5_id, "/g29/g3/g3", "/g29/g3/g3") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group5_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-/*-------------------------------------------------------------------------
- * Test H5Iget_name with higher mounted file
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with higher mounted file
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with higher mounted file");
/* Create a group "/g30/g1/g2" in the first file */
- if((group_id = H5Gcreate2(file_id, "/g30", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g30/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "/g30/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g30", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g30/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "/g30/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -1962,9 +2533,12 @@ test_main(hid_t file_id, hid_t fapl)
/* Create second file and group "/g31/g3/g4" in it */
file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if((group_id = H5Gcreate2(file1_id, "/g31", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g31/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file1_id, "/g31/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g31", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g31/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file1_id, "/g31/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -1974,9 +2548,12 @@ test_main(hid_t file_id, hid_t fapl)
/* Create third file and group "/g32/g5/g6" in it */
file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if((group_id = H5Gcreate2(file2_id, "/g32", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file2_id, "/g32/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file2_id, "/g32/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file2_id, "/g32", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file2_id, "/g32/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file2_id, "/g32/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -1986,9 +2563,12 @@ test_main(hid_t file_id, hid_t fapl)
/* Create fourth file and group "/g33/g5/g6" in it */
file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if((group_id = H5Gcreate2(file3_id, "/g33", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file3_id, "/g33/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file3_id, "/g33/g7/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file3_id, "/g33", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file3_id, "/g33/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file3_id, "/g33/g7/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -1996,73 +2576,102 @@ test_main(hid_t file_id, hid_t fapl)
H5Gclose(group3_id);
/* Access group which will be hidden in the first file */
- if((group_id = H5Gopen2(file_id, "/g30/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, "/g30/g1/g2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR
+ if (check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0)
+ TEST_ERROR
/* Mount second file under "/g30/g1" in the first file */
- if(H5Fmount(file_id, "/g30/g1", file1_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(file_id, "/g30/g1", file1_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR
+ if (check_name(group_id, "", "/g30/g1/g2") < 0)
+ TEST_ERROR
/* Access group which will be hidden in the second file */
- if((group2_id = H5Gopen2(file_id, "/g30/g1/g31/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file_id, "/g30/g1/g31/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0)
+ TEST_ERROR
/* Mount third file under "/g30/g1/g31/g3" in the first file */
- if(H5Fmount(file_id, "/g30/g1/g31/g3", file2_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(file_id, "/g30/g1/g31/g3", file2_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR
+ if (check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0)
+ TEST_ERROR
/* Access group which will be hidden in the third file */
- if((group3_id = H5Gopen2(file_id, "/g30/g1/g31/g3/g32/g5/g6", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group3_id = H5Gopen2(file_id, "/g30/g1/g31/g3/g32/g5/g6", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0)
+ TEST_ERROR
/* Mount fourth file under "/g30" in the first file, hiding the files below it */
- if(H5Fmount(file_id, "/g30", file3_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(file_id, "/g30", file3_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group3_id, "", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR
+ if (check_name(group3_id, "", "/g30/g1/g31/g3/g32/g5/g6") < 0)
+ TEST_ERROR
/* Access group which will be in the fourth file */
- if((group4_id = H5Gopen2(file_id, "/g30/g33/g7/g8", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group4_id = H5Gopen2(file_id, "/g30/g33/g7/g8", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g30/g33/g7/g8", "/g30/g33/g7/g8") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g30/g33/g7/g8", "/g30/g33/g7/g8") < 0)
+ TEST_ERROR
/* Unmount fourth file */
- if(H5Funmount(file_id, "/g30") < 0) TEST_ERROR
+ if (H5Funmount(file_id, "/g30") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group4_id, "/g33/g7/g8", "") < 0) TEST_ERROR
- if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR
- if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR
- if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g33/g7/g8", "") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "", "/g30/g1/g2") < 0)
+ TEST_ERROR
/* Unmount third file */
- if(H5Funmount(file_id, "/g30/g1/g31/g3") < 0) TEST_ERROR
+ if (H5Funmount(file_id, "/g30/g1/g31/g3") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group4_id, "/g33/g7/g8", "") < 0) TEST_ERROR
- if(check_name(group3_id, "/g32/g5/g6", "") < 0) TEST_ERROR
- if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR
- if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g33/g7/g8", "") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g32/g5/g6", "") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "", "/g30/g1/g2") < 0)
+ TEST_ERROR
/* Unmount second file */
- if(H5Funmount(file_id, "/g30/g1") < 0) TEST_ERROR
+ if (H5Funmount(file_id, "/g30/g1") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group4_id, "/g33/g7/g8", "") < 0) TEST_ERROR
- if(check_name(group3_id, "/g32/g5/g6", "") < 0) TEST_ERROR
- if(check_name(group2_id, "/g31/g3/g4", "") < 0) TEST_ERROR
- if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g33/g7/g8", "") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "/g32/g5/g6", "") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "/g31/g3/g4", "") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0)
+ TEST_ERROR
/* Close groups */
H5Gclose(group_id);
@@ -2077,166 +2686,230 @@ test_main(hid_t file_id, hid_t fapl)
PASSED();
-
-/*-------------------------------------------------------------------------
- * Test H5Iget_name with multiple hard links and mounted files
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with multiple hard links and mounted files
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with multiple hard links and mounted files");
/* Create second file and group "/g35/g3/g4" in it */
- if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file1_id, "/g35", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g35/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file1_id, "/g35/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g35", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g35/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file1_id, "/g35/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Create group "/g34/g1/g2" in first file */
- if((group_id = H5Gcreate2(file_id, "/g34", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g34/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "/g34/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g34", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g34/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "/g34/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create hard link to "/g34/g1/g2 group */
- if(H5Lcreate_hard(file_id, "/g34/g1/g2", H5L_SAME_LOC, "/g34/g2a", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(file_id, "/g34/g1/g2", H5L_SAME_LOC, "/g34/g2a", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0)
+ TEST_ERROR
/* Open the link to the group */
- if((group4_id = H5Gopen2(file_id, "/g34/g2a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group4_id = H5Gopen2(file_id, "/g34/g2a", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR
+ if (check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0)
+ TEST_ERROR
/* Mount second file under "/g34/g1" in the first file */
- if(H5Fmount(file_id, "/g34/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file_id, "/g34/g1", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "", "/g34/g1/g2") < 0) TEST_ERROR
- if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR
+ if (check_name(group3_id, "", "/g34/g1/g2") < 0)
+ TEST_ERROR
+ if (check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0)
+ TEST_ERROR
/* Unmount second file */
- if(H5Funmount(file_id, "/g34/g1") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file_id, "/g34/g1") < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR
- if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR
+ if (check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0)
+ TEST_ERROR
+ if (check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0)
+ TEST_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with mounted files and unlinking
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with mounted files and unlinking
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with mounted files and unlinking");
/* Create group "/g36/g1/g2" in first file */
- if((group_id = H5Gcreate2(file_id, "/g36", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "/g36/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file_id, "/g36/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/g36", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "/g36/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file_id, "/g36/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
/* Create second file and group "/g37/g4" in it */
- if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file1_id, "/g37", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g37/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file1_id, "/g37/g4/g5a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group4_id = H5Gcreate2(file1_id, "/g37/g4/g5b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g37", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g37/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file1_id, "/g37/g4/g5a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group4_id = H5Gcreate2(file1_id, "/g37/g4/g5b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Mount second file under "/g36/g1" in the first file */
- if(H5Fmount(file_id, "/g36/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file_id, "/g36/g1", file1_id, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open group in mounted file */
- if((group5_id = H5Gopen2(file_id, "/g36/g1/g37/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group5_id = H5Gopen2(file_id, "/g36/g1/g37/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group5_id, "/g36/g1/g37", "/g36/g1/g37") < 0) TEST_ERROR
+ if (check_name(group5_id, "/g36/g1/g37", "/g36/g1/g37") < 0)
+ TEST_ERROR
/* Open group to delete in mounted file */
- if((group6_id = H5Gopen2(file_id, "/g36/g1/g37/g4/g5a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group6_id = H5Gopen2(file_id, "/g36/g1/g37/g4/g5a", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group6_id, "/g36/g1/g37/g4/g5a", "/g36/g1/g37/g4/g5a") < 0) TEST_ERROR
+ if (check_name(group6_id, "/g36/g1/g37/g4/g5a", "/g36/g1/g37/g4/g5a") < 0)
+ TEST_ERROR
/* Delete end group in mounted file, using relative paths */
- if(H5Ldelete(group5_id, "g4/g5a", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(group5_id, "g4/g5a", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group6_id, "", "") < 0) TEST_ERROR
- if(check_name(group3_id, "", "") < 0) TEST_ERROR
+ if (check_name(group6_id, "", "") < 0)
+ TEST_ERROR
+ if (check_name(group3_id, "", "") < 0)
+ TEST_ERROR
/* Close deleted group */
- if(H5Gclose(group6_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group6_id) < 0)
+ FAIL_STACK_ERROR
/* Open groups to delete in mounted file */
- if((group6_id = H5Gopen2(file_id, "/g36/g1/g37/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group7_id = H5Gopen2(file_id, "/g36/g1/g37/g4/g5b", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group6_id = H5Gopen2(file_id, "/g36/g1/g37/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group7_id = H5Gopen2(file_id, "/g36/g1/g37/g4/g5b", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group6_id, "/g36/g1/g37/g4", "/g36/g1/g37/g4") < 0) TEST_ERROR
- if(check_name(group7_id, "/g36/g1/g37/g4/g5b", "/g36/g1/g37/g4/g5b") < 0) TEST_ERROR
+ if (check_name(group6_id, "/g36/g1/g37/g4", "/g36/g1/g37/g4") < 0)
+ TEST_ERROR
+ if (check_name(group7_id, "/g36/g1/g37/g4/g5b", "/g36/g1/g37/g4/g5b") < 0)
+ TEST_ERROR
/* Delete middle group in mounted file, using relative paths */
- if(H5Ldelete(group5_id, "g4", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(group5_id, "g4", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group6_id, "", "") < 0) TEST_ERROR
- if(check_name(group2_id, "", "") < 0) TEST_ERROR
- if(check_name(group7_id, "", "") < 0) TEST_ERROR
- if(check_name(group4_id, "", "") < 0) TEST_ERROR
+ if (check_name(group6_id, "", "") < 0)
+ TEST_ERROR
+ if (check_name(group2_id, "", "") < 0)
+ TEST_ERROR
+ if (check_name(group7_id, "", "") < 0)
+ TEST_ERROR
+ if (check_name(group4_id, "", "") < 0)
+ TEST_ERROR
/* Close deleted groups */
- if(H5Gclose(group6_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group7_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group6_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group7_id) < 0)
+ FAIL_STACK_ERROR
/* Close group in mounted file */
- if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group5_id) < 0)
+ FAIL_STACK_ERROR
- if(H5Funmount(file_id, "/g36/g1") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file_id, "/g36/g1") < 0)
+ FAIL_STACK_ERROR
/* Close */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group4_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
-
-/*-------------------------------------------------------------------------
- * Test H5Iget_name with mounting already mounted files
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with mounting already mounted files
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with mounting already mounted files");
/* Create file and group "/g38/g1/g2" in it */
- if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file1_id, "/g38", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g38/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file1_id, "/g38/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g38", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g38/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file1_id, "/g38/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -2244,11 +2917,15 @@ test_main(hid_t file_id, hid_t fapl)
H5Gclose(group3_id);
/* Create second file and group "/g39/g1/g2" in it */
- if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file2_id, "/g39", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file2_id, "/g39/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file2_id, "/g39/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file2_id, "/g39", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file2_id, "/g39/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file2_id, "/g39/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -2256,11 +2933,15 @@ test_main(hid_t file_id, hid_t fapl)
H5Gclose(group3_id);
/* Create third file and group "/g40/g5/g6" in it */
- if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((group_id = H5Gcreate2(file3_id, "/g40", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file3_id, "/g40/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file3_id, "/g40/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file3_id, "/g40", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file3_id, "/g40/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file3_id, "/g40/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -2268,34 +2949,46 @@ test_main(hid_t file_id, hid_t fapl)
H5Gclose(group3_id);
/* Mount second file under "/g38/g1" in the first file */
- if(H5Fmount(file1_id, "/g38/g1", file2_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(file1_id, "/g38/g1", file2_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if((group_id = H5Gopen2(file1_id, "/g38/g1/g39/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file1_id, "/g38/g1/g39/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR
+ if (check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0)
+ TEST_ERROR
/* Mount first file under "/g40/g5" in the third file */
- if(H5Fmount(file3_id, "/g40/g5", file1_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(file3_id, "/g40/g5", file1_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if((group2_id = H5Gopen2(file3_id, "/g40/g5/g38/g1/g39/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file3_id, "/g40/g5/g38/g1/g39/g3/g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g40/g5/g38/g1/g39/g3/g4", "/g40/g5/g38/g1/g39/g3/g4") < 0) TEST_ERROR
- if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g40/g5/g38/g1/g39/g3/g4", "/g40/g5/g38/g1/g39/g3/g4") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0)
+ TEST_ERROR
/* Unmount first file */
- if(H5Funmount(file3_id, "/g40/g5") < 0) TEST_ERROR
+ if (H5Funmount(file3_id, "/g40/g5") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group2_id, "/g38/g1/g39/g3/g4", "") < 0) TEST_ERROR
- if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g38/g1/g39/g3/g4", "") < 0)
+ TEST_ERROR
+ if (check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0)
+ TEST_ERROR
/* Unmount second file */
- if(H5Funmount(file1_id, "/g38/g1") < 0) TEST_ERROR
+ if (H5Funmount(file1_id, "/g38/g1") < 0)
+ TEST_ERROR
/* Verify */
- if(check_name(group_id, "/g39/g3/g4", "") < 0) TEST_ERROR
+ if (check_name(group_id, "/g39/g3/g4", "") < 0)
+ TEST_ERROR
/* Close */
H5Gclose(group_id);
@@ -2306,19 +2999,22 @@ test_main(hid_t file_id, hid_t fapl)
PASSED();
-/*-------------------------------------------------------------------------
- * Test H5Iget_name with opening object in unmounted file
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with opening object in unmounted file
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with opening object in unmounted file");
/* Create file and group "/g39/g1/g2" in it */
file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if((group_id = H5Gcreate2(file1_id, "/g41", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file1_id, "/g41/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file1_id, "/g41/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file1_id, "/g41", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file1_id, "/g41/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file1_id, "/g41/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -2328,9 +3024,12 @@ test_main(hid_t file_id, hid_t fapl)
/* Create second file and group "/g42/g1/g2" in it */
file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if((group_id = H5Gcreate2(file2_id, "/g42", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file2_id, "/g42/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group3_id = H5Gcreate2(file2_id, "/g42/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file2_id, "/g42", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file2_id, "/g42/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group3_id = H5Gcreate2(file2_id, "/g42/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close */
H5Gclose(group_id);
@@ -2338,20 +3037,26 @@ test_main(hid_t file_id, hid_t fapl)
H5Gclose(group3_id);
/* Mount second file under "/g41/g1" in the first file */
- if(H5Fmount(file1_id, "/g41/g1", file2_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(file1_id, "/g41/g1", file2_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if((group_id = H5Gopen2(file1_id, "/g41/g1/g42/g3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file1_id, "/g41/g1/g42/g3", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group_id, "/g41/g1/g42/g3", "/g41/g1/g42/g3") < 0) TEST_ERROR
+ if (check_name(group_id, "/g41/g1/g42/g3", "/g41/g1/g42/g3") < 0)
+ TEST_ERROR
/* Unmount file */
- if(H5Funmount(file1_id, "/g41/g1") < 0) TEST_ERROR
+ if (H5Funmount(file1_id, "/g41/g1") < 0)
+ TEST_ERROR
- if((group2_id = H5Gopen2(group_id, "g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(group_id, "g4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify */
- if(check_name(group2_id, "/g42/g3/g4", "") < 0) TEST_ERROR
+ if (check_name(group2_id, "/g42/g3/g4", "") < 0)
+ TEST_ERROR
/* Close */
H5Gclose(group_id);
@@ -2368,47 +3073,67 @@ test_main(hid_t file_id, hid_t fapl)
TESTING("H5Iget_name with anonymous datatypes");
/* Commit the type anonymously and link it in */
- if((dtype = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((dtype = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* Test H5Iget_name with created datatype, should fail because not committed */
- H5E_BEGIN_TRY {
- if((size = H5Iget_name(dtype, NULL, 0)) >= 0) TEST_ERROR
- } H5E_END_TRY;
-
- if(H5Tcommit_anon(file2_id, dtype, H5P_DEFAULT, H5P_DEFAULT)) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ if ((size = H5Iget_name(dtype, NULL, 0)) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
+
+ if (H5Tcommit_anon(file2_id, dtype, H5P_DEFAULT, H5P_DEFAULT))
+ TEST_ERROR
/* Test H5Iget_name with anonymously created datatype, should pass because committed */
- if((size = H5Iget_name(dtype, NULL, 0)) != 0) TEST_ERROR
+ if ((size = H5Iget_name(dtype, NULL, 0)) != 0)
+ TEST_ERROR
/* Create a link to the object */
- if(H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Commit a second datatype with no links to it and commit it */
- if((dtype_anon = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit_anon(file2_id, dtype_anon, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((dtype_anon = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit_anon(file2_id, dtype_anon, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Test H5Iget_name with anonymously created datatype, should pass because committed */
- if((size = H5Iget_name(dtype_anon, NULL,0)) != 0) TEST_ERROR
+ if ((size = H5Iget_name(dtype_anon, NULL, 0)) != 0)
+ TEST_ERROR
/* Store the address of the datatype for later use */
- if(H5Oget_info3(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
/* Update the reference count to dtype_anon to preserve the datatype */
- if(H5Oincr_refcount(dtype_anon) < 0) TEST_ERROR
+ if (H5Oincr_refcount(dtype_anon) < 0)
+ TEST_ERROR
- if(H5Tclose(dtype) < 0) TEST_ERROR
- if(H5Tclose(dtype_anon) < 0) TEST_ERROR
- if(H5Fclose(file2_id) < 0) TEST_ERROR
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR
+ if (H5Tclose(dtype_anon) < 0)
+ TEST_ERROR
+ if (H5Fclose(file2_id) < 0)
+ TEST_ERROR
/* Re-open the file and check that the anonymous datatypes persist */
- if((file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Check the H5Iget_name does not return an error for anon committed datatypes */
- if((dtype_anon = H5Oopen_by_token(file2_id, oinfo.token)) < 0) TEST_ERROR
+ if ((dtype_anon = H5Oopen_by_token(file2_id, oinfo.token)) < 0)
+ TEST_ERROR
- if((size = H5Iget_name(dtype_anon, NULL, 0)) != 0) TEST_ERROR
+ if ((size = H5Iget_name(dtype_anon, NULL, 0)) != 0)
+ TEST_ERROR
- if(H5Tclose(dtype_anon) < 0) TEST_ERROR
- if(H5Fclose(file2_id) < 0) TEST_ERROR
+ if (H5Tclose(dtype_anon) < 0)
+ TEST_ERROR
+ if (H5Fclose(file2_id) < 0)
+ TEST_ERROR
PASSED();
@@ -2421,302 +3146,350 @@ error:
static int
test_obj_ref(hid_t fapl)
{
- char filename1[1024];
- char filename2[1024];
- hid_t fid1, fid2; /* HDF5 File IDs */
- hid_t dataset, dataset2; /* Dataset ID */
- hid_t group, group2; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hobj_ref_t wbuf[SPACE1_DIM1]; /* Buffer to write to disk */
- int tu32[SPACE1_DIM1]; /* Int data */
- ssize_t namelen; /* Length of the name */
- int i; /* counting variables */
- char buf[100];
+ char filename1[1024];
+ char filename2[1024];
+ hid_t fid1, fid2; /* HDF5 File IDs */
+ hid_t dataset, dataset2; /* Dataset ID */
+ hid_t group, group2; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hobj_ref_t wbuf[SPACE1_DIM1]; /* Buffer to write to disk */
+ int tu32[SPACE1_DIM1]; /* Int data */
+ ssize_t namelen; /* Length of the name */
+ int i; /* counting variables */
+ char buf[100];
/* Initialize the file names */
h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[2], fapl, filename2, sizeof filename2);
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create dataspace for datasets */
- if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
+ if ((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
FAIL_STACK_ERROR
/* Create a group */
- if((group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a single dataset inside the second file, which will be mounted
* and used to mask objects in the first file */
- if((dataset = H5Dcreate2(fid2, "Dataset1", H5T_STD_U32LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(fid2, "Dataset1", H5T_STD_U32LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
/* Create a dataset(inside Group1) */
- if((dataset = H5Dcreate2(group, "Dataset1", H5T_STD_U32LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(group, "Dataset1", H5T_STD_U32LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize data buffer */
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
tu32[i] = i * 3;
/* Write selection to disk */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tu32) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tu32) < 0)
FAIL_STACK_ERROR
/* Close Dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
/* Create another dataset(inside Group1) */
- if((dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close Dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
/* Create a datatype to refer to */
- if((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0)
+ if ((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0)
FAIL_STACK_ERROR
/* Insert fields */
- if(H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0)
FAIL_STACK_ERROR
- if(H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0)
+ if (H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0)
FAIL_STACK_ERROR
/* Save datatype for later */
- if(H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Close datatype */
- if(H5Tclose(tid1) < 0)
+ if (H5Tclose(tid1) < 0)
FAIL_STACK_ERROR
/* Create a new group in group1 */
- if((group2 = H5Gcreate2(group, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2 = H5Gcreate2(group, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a hard link to group1 in group2 */
- if(H5Lcreate_hard(fid1, "/Group1", H5L_SAME_LOC, "/Group1/Group2/Link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(fid1, "/Group1", H5L_SAME_LOC, "/Group1/Group2/Link", H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Create dataset in that group */
- if((dataset = H5Dcreate2(group2, "Dataset4", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(group2, "Dataset4", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close Dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(group) < 0)
+ if (H5Gclose(group) < 0)
FAIL_STACK_ERROR
- if(H5Gclose(group2) < 0)
+ if (H5Gclose(group2) < 0)
FAIL_STACK_ERROR
/* Open up that hard link and make a new dataset there */
- if((group = H5Gopen2(fid1, "/Group1/Group2/Link", H5P_DEFAULT)) < 0)
+ if ((group = H5Gopen2(fid1, "/Group1/Group2/Link", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((dataset = H5Dcreate2(group, "Dataset5", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(group, "Dataset5", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
- if(H5Gclose(group) < 0)
+ if (H5Gclose(group) < 0)
FAIL_STACK_ERROR
-
/* Create a dataset to store references */
- if((dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create reference to dataset */
- if(H5Rcreate(&wbuf[0], fid1, "/Dataset3", H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&wbuf[0], fid1, "/Dataset3", H5R_OBJECT, (hid_t)-1) < 0)
FAIL_STACK_ERROR
/* Create reference to dataset */
- if(H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1) < 0)
FAIL_STACK_ERROR
/* Create reference to group */
- if(H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1) < 0)
FAIL_STACK_ERROR
/* Create reference to named datatype */
- if(H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1) < 0)
FAIL_STACK_ERROR
- if(H5Rcreate(&wbuf[4], fid1, "/Group1/Group2/Dataset4", H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&wbuf[4], fid1, "/Group1/Group2/Dataset4", H5R_OBJECT, (hid_t)-1) < 0)
FAIL_STACK_ERROR
- if(H5Rcreate(&wbuf[5], fid1, "/Group1/Group2", H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&wbuf[5], fid1, "/Group1/Group2", H5R_OBJECT, (hid_t)-1) < 0)
FAIL_STACK_ERROR
- if(H5Rcreate(&wbuf[6], fid1, "/Group1/Group2/Link/Dataset5", H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&wbuf[6], fid1, "/Group1/Group2/Link/Dataset5", H5R_OBJECT, (hid_t)-1) < 0)
FAIL_STACK_ERROR
/* Create reference to root group */
- if(H5Rcreate(&wbuf[7], fid1, "/", H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&wbuf[7], fid1, "/", H5R_OBJECT, (hid_t)-1) < 0)
FAIL_STACK_ERROR
/* Write selection to disk */
- if(H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
FAIL_STACK_ERROR
TESTING("getting path to normal dataset in root group");
- if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[0])) < 0) FAIL_STACK_ERROR
- *buf = '\0';
- namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
- if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
+ if ((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[0])) < 0)
+ FAIL_STACK_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(dataset2, (char *)buf, sizeof(buf));
+ if (H5Dclose(dataset2) < 0)
+ FAIL_STACK_ERROR
+ if (!((HDstrcmp(buf, "/Dataset3") == 0) && (namelen == 9)))
+ TEST_ERROR
*buf = '\0';
/* Check H5Rget_name returns the correct length of the name when name is NULL */
namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
- if(namelen != 9) TEST_ERROR
+ if (namelen != 9)
+ TEST_ERROR
/* Make sure size parameter is ignored */
namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
- if(namelen != 9) TEST_ERROR
+ if (namelen != 9)
+ TEST_ERROR
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char *)buf, sizeof(buf));
+ if (!((HDstrcmp(buf, "/Dataset3") == 0) && (namelen == 9)))
+ TEST_ERROR
PASSED();
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in /Group1");
- if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR
- *buf = '\0';
- namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
- if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
- *buf = '\0';
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
+ if ((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0)
+ FAIL_STACK_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(dataset2, (char *)buf, sizeof(buf));
+ if (H5Dclose(dataset2) < 0)
+ FAIL_STACK_ERROR
+ if (!((HDstrcmp(buf, "/Group1/Dataset2") == 0) && (namelen == 16)))
+ TEST_ERROR
+ *buf = '\0';
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char *)buf, sizeof(buf));
+ if (!((HDstrcmp(buf, "/Group1/Dataset2") == 0) && (namelen == 16)))
+ TEST_ERROR
PASSED();
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to /Group1");
- if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[2])) < 0) FAIL_STACK_ERROR
- *buf = '\0';
- namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
- *buf = '\0';
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
+ if ((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[2])) < 0)
+ FAIL_STACK_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(group, (char *)buf, sizeof(buf));
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+ if (!((HDstrcmp(buf, "/Group1") == 0) && (namelen == 7)))
+ TEST_ERROR
+ *buf = '\0';
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char *)buf, sizeof(buf));
+ if (!((HDstrcmp(buf, "/Group1") == 0) && (namelen == 7)))
+ TEST_ERROR
PASSED();
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to datatype in /Group1");
- if((tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[3])) < 0) FAIL_STACK_ERROR
- *buf = '\0';
- namelen = H5Iget_name(tid1, (char*)buf, sizeof(buf));
- if(H5Tclose(tid1) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
- *buf = '\0';
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
+ if ((tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[3])) < 0)
+ FAIL_STACK_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(tid1, (char *)buf, sizeof(buf));
+ if (H5Tclose(tid1) < 0)
+ FAIL_STACK_ERROR
+ if (!((HDstrcmp(buf, "/Group1/Datatype1") == 0) && (namelen == 17)))
+ TEST_ERROR
+ *buf = '\0';
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char *)buf, sizeof(buf));
+ if (!((HDstrcmp(buf, "/Group1/Datatype1") == 0) && (namelen == 17)))
+ TEST_ERROR
PASSED();
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in nested group");
- if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
- *buf = '\0';
- namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
- if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
- *buf = '\0';
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
+ if ((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0)
+ FAIL_STACK_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(dataset2, (char *)buf, sizeof(buf));
+ if (H5Dclose(dataset2) < 0)
+ FAIL_STACK_ERROR
+ if (!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) && (namelen == 23)))
+ TEST_ERROR
+ *buf = '\0';
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char *)buf, sizeof(buf));
+ if (!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) && (namelen == 23)))
+ TEST_ERROR
PASSED();
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to nested group");
- if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[5])) < 0) FAIL_STACK_ERROR
- *buf = '\0';
- namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
- *buf = '\0';
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
+ if ((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[5])) < 0)
+ FAIL_STACK_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(group, (char *)buf, sizeof(buf));
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+ if (!((HDstrcmp(buf, "/Group1/Group2") == 0) && (namelen == 14)))
+ TEST_ERROR
+ *buf = '\0';
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char *)buf, sizeof(buf));
+ if (!((HDstrcmp(buf, "/Group1/Group2") == 0) && (namelen == 14)))
+ TEST_ERROR
PASSED();
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset created via hard link");
- if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[6])) < 0) FAIL_STACK_ERROR
- *buf = '\0';
- namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
- if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
- *buf = '\0';
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
+ if ((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[6])) < 0)
+ FAIL_STACK_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(dataset2, (char *)buf, sizeof(buf));
+ if (H5Dclose(dataset2) < 0)
+ FAIL_STACK_ERROR
+ if (!((HDstrcmp(buf, "/Group1/Dataset5") == 0) && (namelen == 16)))
+ TEST_ERROR
+ *buf = '\0';
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char *)buf, sizeof(buf));
+ if (!((HDstrcmp(buf, "/Group1/Dataset5") == 0) && (namelen == 16)))
+ TEST_ERROR
PASSED();
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to root group");
- if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[7])) < 0) FAIL_STACK_ERROR
- *buf = '\0';
- namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
- *buf = '\0';
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
+ if ((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[7])) < 0)
+ FAIL_STACK_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(group, (char *)buf, sizeof(buf));
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+ if (!((HDstrcmp(buf, "/") == 0) && (namelen == 1)))
+ TEST_ERROR
+ *buf = '\0';
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char *)buf, sizeof(buf));
+ if (!((HDstrcmp(buf, "/") == 0) && (namelen == 1)))
+ TEST_ERROR
PASSED();
/* Now we mount fid2 at /Group2 and look for dataset4. It shouldn't be found */
- if(H5Fmount(fid1, "/Group1/Group2", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1, "/Group1/Group2", fid2, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
TESTING("getting path to dataset hidden by a mounted file");
- if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
- *buf = '\0';
- namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
- if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(namelen != 0) TEST_ERROR
- *buf = '\0';
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(namelen != 0) TEST_ERROR
+ if ((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0)
+ FAIL_STACK_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(dataset2, (char *)buf, sizeof(buf));
+ if (H5Dclose(dataset2) < 0)
+ FAIL_STACK_ERROR
+ if (namelen != 0)
+ TEST_ERROR
+ *buf = '\0';
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char *)buf, sizeof(buf));
+ if (namelen != 0)
+ TEST_ERROR
PASSED();
/* Now we try unlinking dataset2 from the file and searching for it. It shouldn't be found */
- if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0)
+ if ((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0)
FAIL_STACK_ERROR
- if(H5Ldelete(fid1, "/Group1/Dataset2", H5P_DEFAULT) < 0)
+ if (H5Ldelete(fid1, "/Group1/Dataset2", H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
TESTING("getting path to dataset that has been unlinked");
- *buf = '\0';
- namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
- if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(namelen != 0) TEST_ERROR
- *buf = '\0';
- namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(namelen != 0) TEST_ERROR
+ *buf = '\0';
+ namelen = H5Iget_name(dataset2, (char *)buf, sizeof(buf));
+ if (H5Dclose(dataset2) < 0)
+ FAIL_STACK_ERROR
+ if (namelen != 0)
+ TEST_ERROR
+ *buf = '\0';
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char *)buf, sizeof(buf));
+ if (namelen != 0)
+ TEST_ERROR
PASSED();
/* Close disk dataspace */
- if(H5Sclose(sid1) < 0)
+ if (H5Sclose(sid1) < 0)
FAIL_STACK_ERROR
/* Close Dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
return 0;
@@ -2728,51 +3501,53 @@ error:
static int
test_reg_ref(hid_t fapl)
{
- char filename1[1024];
- hid_t file_id; /* file identifier */
- hid_t dsetv_id; /*dataset identifiers*/
- hid_t dsetr_id;
- hid_t space_id, spacer_id;
- hsize_t dims[2] = {2,9};
- hsize_t dimsr[1] = {2};
- int rank = 2;
- int rankr = 1;
+ char filename1[1024];
+ hid_t file_id; /* file identifier */
+ hid_t dsetv_id; /*dataset identifiers*/
+ hid_t dsetr_id;
+ hid_t space_id, spacer_id;
+ hsize_t dims[2] = {2, 9};
+ hsize_t dimsr[1] = {2};
+ int rank = 2;
+ int rankr = 1;
hdset_reg_ref_t ref[2];
hdset_reg_ref_t ref_out[2];
- int data[2][9] = {{1,1,2,3,3,4,5,5,6},{1,2,2,3,4,4,5,6,6}};
- hsize_t start[2];
- hsize_t count[2];
- hsize_t coord[2][3] = {{0, 0, 1}, {6, 0, 8}};
- unsigned num_points = 3;
- ssize_t name_size1, name_size2;
- char buf1[NAME_BUF_SIZE], buf2[NAME_BUF_SIZE];
+ int data[2][9] = {{1, 1, 2, 3, 3, 4, 5, 5, 6}, {1, 2, 2, 3, 4, 4, 5, 6, 6}};
+ hsize_t start[2];
+ hsize_t count[2];
+ hsize_t coord[2][3] = {{0, 0, 1}, {6, 0, 8}};
+ unsigned num_points = 3;
+ ssize_t name_size1, name_size2;
+ char buf1[NAME_BUF_SIZE], buf2[NAME_BUF_SIZE];
/* Initialize the file name */
h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
/* Create file with default file create property but vfd access property. */
- if((file_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if ((file_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create dataspace for datasets */
- if((space_id = H5Screate_simple(rank, dims, NULL)) < 0)
- TEST_ERROR
- if((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0)
- TEST_ERROR
+ if ((space_id = H5Screate_simple(rank, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0)
+ TEST_ERROR
/* Create integer dataset */
- if((dsetv_id = H5Dcreate2(file_id, REFREG_DSETNAMEV, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if ((dsetv_id = H5Dcreate2(file_id, REFREG_DSETNAMEV, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
- /* Write data to the dataset */
- if(H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT, data) < 0)
- TEST_ERROR
- if(H5Dclose(dsetv_id) < 0)
- TEST_ERROR
+ /* Write data to the dataset */
+ if (H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetv_id) < 0)
+ TEST_ERROR
/* Dataset with references */
- if((dsetr_id = H5Dcreate2(file_id, REFREG_DSETNAMER, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if ((dsetr_id = H5Dcreate2(file_id, REFREG_DSETNAMER, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/*
* Create a reference to the hyperslab.
@@ -2781,44 +3556,43 @@ test_reg_ref(hid_t fapl)
start[1] = 3;
count[0] = 2;
count[1] = 3;
- if(H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
- TEST_ERROR
- if(H5Rcreate(&ref[0], file_id, REFREG_DSETNAMEV, H5R_DATASET_REGION, space_id) < 0)
- TEST_ERROR
+ if (H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&ref[0], file_id, REFREG_DSETNAMEV, H5R_DATASET_REGION, space_id) < 0)
+ TEST_ERROR
/* Create a reference to elements selection */
- if(H5Sselect_none(space_id) < 0)
- TEST_ERROR
- if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0)
- TEST_ERROR
- if(H5Rcreate(&ref[1], file_id, REFREG_DSETNAMEV, H5R_DATASET_REGION, space_id) < 0)
- TEST_ERROR
+ if (H5Sselect_none(space_id) < 0)
+ TEST_ERROR
+ if (H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&ref[1], file_id, REFREG_DSETNAMEV, H5R_DATASET_REGION, space_id) < 0)
+ TEST_ERROR
/* Write dataset with the references */
- if(H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0)
- TEST_ERROR
+ if (H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0)
+ TEST_ERROR
/* Close all objects */
- if(H5Sclose(space_id) < 0)
- TEST_ERROR
- if(H5Sclose(spacer_id) < 0)
- TEST_ERROR
- if(H5Dclose(dsetr_id) < 0)
- TEST_ERROR
- if(H5Fclose(file_id) < 0)
- TEST_ERROR
-
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(spacer_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetr_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
/* Reopen the file to read selections back */
- if((file_id = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
- TEST_ERROR
+ if ((file_id = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Reopen the dataset with object references and read references to the buffer */
- if((dsetr_id = H5Dopen2(file_id, REFREG_DSETNAMER, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if ((dsetr_id = H5Dopen2(file_id, REFREG_DSETNAMER, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_out) < 0)
- TEST_ERROR
+ if (H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_out) < 0)
+ TEST_ERROR
/* Get name of the dataset the first region reference points to using H5Rget_name */
TESTING("H5Rget_name to get name from region reference(hyperslab)");
@@ -2826,10 +3600,12 @@ test_reg_ref(hid_t fapl)
/* Check H5Rget_name returns the correct length of the name when name is NULL */
name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], NULL, 0);
- if(name_size1 != 7) TEST_ERROR
+ if (name_size1 != 7)
+ TEST_ERROR
- name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, NAME_BUF_SIZE );
- if(!((HDstrcmp(buf1, "/MATRIX") == 0) &&(name_size1 == 7))) TEST_ERROR
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char *)buf1, NAME_BUF_SIZE);
+ if (!((HDstrcmp(buf1, "/MATRIX") == 0) && (name_size1 == 7)))
+ TEST_ERROR
PASSED();
TESTING("H5Iget_name to get name from region reference(hyperslab)");
@@ -2838,39 +3614,45 @@ test_reg_ref(hid_t fapl)
dsetv_id = H5Rdereference2(dsetr_id, H5P_DEFAULT, H5R_DATASET_REGION, &ref_out[0]);
/* Get name of the dataset the first region reference points using H5Iget_name */
- *buf2 = '\0';
- name_size2 = H5Iget_name(dsetv_id, (char*)buf2, NAME_BUF_SIZE);
- if(!((HDstrcmp(buf2, "/MATRIX") == 0) &&(name_size2 == 7))) TEST_ERROR
+ *buf2 = '\0';
+ name_size2 = H5Iget_name(dsetv_id, (char *)buf2, NAME_BUF_SIZE);
+ if (!((HDstrcmp(buf2, "/MATRIX") == 0) && (name_size2 == 7)))
+ TEST_ERROR
- if(H5Dclose(dsetv_id) < 0) TEST_ERROR
+ if (H5Dclose(dsetv_id) < 0)
+ TEST_ERROR
PASSED();
/* Get name of the dataset the second region reference points to using H5Rget_name */
TESTING("H5Rget_name to get name from region reference(pnt selec)");
- *buf1 = '\0';
- name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[1], (char*)buf1, NAME_BUF_SIZE);
- if(!((HDstrcmp(buf1, "/MATRIX") == 0) &&(name_size1 == 7))) TEST_ERROR
+ *buf1 = '\0';
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[1], (char *)buf1, NAME_BUF_SIZE);
+ if (!((HDstrcmp(buf1, "/MATRIX") == 0) && (name_size1 == 7)))
+ TEST_ERROR
PASSED();
TESTING("H5Iget_name to get name from region reference(pnt selec)");
/* Dereference the second reference */
- if((dsetv_id = H5Rdereference2(dsetr_id, H5P_DEFAULT, H5R_DATASET_REGION, &ref_out[1])) < 0) TEST_ERROR
+ if ((dsetv_id = H5Rdereference2(dsetr_id, H5P_DEFAULT, H5R_DATASET_REGION, &ref_out[1])) < 0)
+ TEST_ERROR
/* Get name of the dataset the first region reference points using H5Iget_name */
- *buf2 = '\0';
- name_size2 = H5Iget_name(dsetv_id, (char*)buf2, NAME_BUF_SIZE);
- if(!((HDstrcmp(buf2, "/MATRIX") == 0) &&(name_size2 == 7))) TEST_ERROR
+ *buf2 = '\0';
+ name_size2 = H5Iget_name(dsetv_id, (char *)buf2, NAME_BUF_SIZE);
+ if (!((HDstrcmp(buf2, "/MATRIX") == 0) && (name_size2 == 7)))
+ TEST_ERROR
- if(H5Dclose(dsetv_id) < 0) TEST_ERROR
+ if (H5Dclose(dsetv_id) < 0)
+ TEST_ERROR
PASSED();
- if(H5Dclose(dsetr_id) < 0)
- TEST_ERROR
- if(H5Fclose(file_id) < 0)
- TEST_ERROR
+ if (H5Dclose(dsetr_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
return 0;
@@ -2878,7 +3660,6 @@ error:
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_elinks
*
@@ -2897,73 +3678,74 @@ error:
static int
test_elinks(hid_t fapl)
{
- char filename1[1024], filename2[1024]; /* Filenames */
- hid_t fid1, fid2; /* HDF5 File IDs */
- hid_t group, group2; /* Group IDs */
- char name[NAME_BUF_SIZE]; /* Buffer for storing object's name */
- ssize_t namelen; /* Length of object's name */
- hbool_t name_cached; /* Indicate if name is cached */
+ char filename1[1024], filename2[1024]; /* Filenames */
+ hid_t fid1, fid2; /* HDF5 File IDs */
+ hid_t group, group2; /* Group IDs */
+ char name[NAME_BUF_SIZE]; /* Buffer for storing object's name */
+ ssize_t namelen; /* Length of object's name */
+ hbool_t name_cached; /* Indicate if name is cached */
/* Initialize the file names */
h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[2], fapl, filename2, sizeof filename2);
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a group in the second file */
- if((group2 = H5Gcreate2(fid2, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((group2 = H5Gcreate2(fid2, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close Group */
- if(H5Gclose(group2) < 0)
+ if (H5Gclose(group2) < 0)
FAIL_STACK_ERROR
/* Create an external link in first file to the group in the second file */
- if(H5Lcreate_external(filename2, "Group2", fid1, "Link_to_Group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_external(filename2, "Group2", fid1, "Link_to_Group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Create an external link in second file to the external link in the first file */
- if(H5Lcreate_external(filename1, "Link_to_Group2", fid2, "Link_to_Link_to_Group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_external(filename1, "Link_to_Group2", fid2, "Link_to_Link_to_Group2", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Open the group in thesecond file through the external link */
- if((group = H5Gopen2(fid1, "Link_to_Group2", H5P_DEFAULT)) < 0)
+ if ((group = H5Gopen2(fid1, "Link_to_Group2", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Query the external link object's name */
- *name = '\0';
+ *name = '\0';
name_cached = FALSE;
- namelen = H5I__get_name_test(group, (char*)name, sizeof(name), &name_cached);
- if(!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached))
+ namelen = H5I__get_name_test(group, (char *)name, sizeof(name), &name_cached);
+ if (!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached))
TEST_ERROR
/* Close Group */
- if(H5Gclose(group) < 0)
+ if (H5Gclose(group) < 0)
FAIL_STACK_ERROR
/* Open the group in the second file through the external link to the external link */
- if((group = H5Gopen2(fid2, "Link_to_Link_to_Group2", H5P_DEFAULT)) < 0)
+ if ((group = H5Gopen2(fid2, "Link_to_Link_to_Group2", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Query the external link to external link object's name */
- *name = '\0';
+ *name = '\0';
name_cached = FALSE;
- namelen = H5I__get_name_test(group, (char*)name, sizeof(name), &name_cached);
- if(!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached))
+ namelen = H5I__get_name_test(group, (char *)name, sizeof(name), &name_cached);
+ if (!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached))
TEST_ERROR
/* Close Group */
- if(H5Gclose(group) < 0)
+ if (H5Gclose(group) < 0)
FAIL_STACK_ERROR
/* Close files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
return 0;
@@ -2975,10 +3757,10 @@ error:
int
main(void)
{
- hid_t file_id =(-1);
- int nerrors = 0;
+ hid_t file_id = (-1);
+ int nerrors = 0;
hid_t fapl;
- char filename0[1024];
+ char filename0[1024];
/* Reset the library and get the file access property list */
h5_reset();
@@ -2988,7 +3770,8 @@ main(void)
/* Create a new file_id using default create property but vfd access
* property.
*/
- if((file_id = H5Fcreate(filename0,H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename0, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Call "main" test routine */
nerrors += test_main(file_id, fapl);
@@ -3002,7 +3785,7 @@ main(void)
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if(nerrors)
+ if (nerrors)
goto error;
puts("All getname tests passed.");
@@ -3011,12 +3794,10 @@ main(void)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(file_id); }
+ H5E_END_TRY;
puts("***** GET NAME TESTS FAILED *****");
return 1;
}
-
diff --git a/test/gheap.c b/test/gheap.c
index 077f921..51e1dd2 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -21,7 +21,7 @@
*/
#include "h5test.h"
#include "H5ACprivate.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h"
#include "H5Fprivate.h"
#include "H5Gprivate.h"
@@ -35,28 +35,20 @@
#define GHEAP_REPEATED_ERR_LIM 20
/* Number of heap objects to test */
-#define GHEAP_TEST_NOBJS 1024
-
-#define GHEAP_REPEATED_ERR(MSG) \
-{ \
- nerrors++; \
- if(nerrors <= GHEAP_REPEATED_ERR_LIM) { \
- H5_FAILED(); \
- puts(MSG); \
- if(nerrors == GHEAP_REPEATED_ERR_LIM) \
- puts(" Suppressing further errors..."); \
- } /* end if */ \
-} /* end GHEAP_REPEATED_ERR */
-
-const char *FILENAME[] = {
- "gheap1",
- "gheap2",
- "gheap3",
- "gheap4",
- "gheapooo",
- NULL
-};
+#define GHEAP_TEST_NOBJS 1024
+#define GHEAP_REPEATED_ERR(MSG) \
+ { \
+ nerrors++; \
+ if (nerrors <= GHEAP_REPEATED_ERR_LIM) { \
+ H5_FAILED(); \
+ puts(MSG); \
+ if (nerrors == GHEAP_REPEATED_ERR_LIM) \
+ puts(" Suppressing further errors..."); \
+ } /* end if */ \
+ } /* end GHEAP_REPEATED_ERR */
+
+const char *FILENAME[] = {"gheap1", "gheap2", "gheap3", "gheap4", "gheapooo", NULL};
/*-------------------------------------------------------------------------
* Function: test_1
@@ -74,30 +66,30 @@ const char *FILENAME[] = {
*-------------------------------------------------------------------------
*/
static int
-test_1 (hid_t fapl)
+test_1(hid_t fapl)
{
- hid_t file = H5I_INVALID_HID;
- H5F_t *f = NULL;
- H5HG_t *obj = NULL;
- uint8_t out[GHEAP_TEST_NOBJS];
- uint8_t in[GHEAP_TEST_NOBJS];
- size_t u;
- size_t size;
- herr_t status;
- int nerrors = 0;
- char filename[1024];
+ hid_t file = H5I_INVALID_HID;
+ H5F_t * f = NULL;
+ H5HG_t *obj = NULL;
+ uint8_t out[GHEAP_TEST_NOBJS];
+ uint8_t in[GHEAP_TEST_NOBJS];
+ size_t u;
+ size_t size;
+ herr_t status;
+ int nerrors = 0;
+ char filename[1024];
TESTING("monotonically increasing lengths");
/* Allocate buffer for H5HG_t */
- if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
+ if (NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
goto error;
/* Open a clean file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if(NULL == (f = (H5F_t *)H5VL_object(file))) {
+ if (NULL == (f = (H5F_t *)H5VL_object(file))) {
H5_FAILED();
HDputs(" Unable to create file");
goto error;
@@ -108,17 +100,17 @@ test_1 (hid_t fapl)
* a clean file, the addresses allocated for the collections should also
* be monotonically increasing.
*/
- for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ for (u = 0; u < GHEAP_TEST_NOBJS; u++) {
size = u + 1;
HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
status = H5HG_insert(f, size, out, obj + u);
- if(status < 0) {
+ if (status < 0) {
H5_FAILED();
HDputs(" Unable to insert object into global heap");
nerrors++;
}
- else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) {
+ else if (u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) {
H5_FAILED();
HDputs(" Collection addresses are not monotonically increasing");
nerrors++;
@@ -128,16 +120,16 @@ test_1 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ for (u = 0; u < GHEAP_TEST_NOBJS; u++) {
size = u + 1;
HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- if(NULL == H5HG_read(f, obj + u, in, NULL)) {
+ if (NULL == H5HG_read(f, obj + u, in, NULL)) {
H5_FAILED();
HDputs(" Unable to read object");
nerrors++;
}
- else if(HDmemcmp(in, out, size)) {
+ else if (HDmemcmp(in, out, size)) {
H5_FAILED();
HDputs(" Value read doesn't match value written");
nerrors++;
@@ -148,24 +140,22 @@ test_1 (hid_t fapl)
HDfree(obj);
obj = NULL;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
- if(nerrors)
+ if (nerrors)
goto error;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- if(obj)
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ if (obj)
HDfree(obj);
return MAX(1, nerrors);
}
-
/*-------------------------------------------------------------------------
* Function: test_2
*
@@ -182,29 +172,29 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_2 (hid_t fapl)
+test_2(hid_t fapl)
{
- hid_t file = H5I_INVALID_HID;
- H5F_t *f = NULL;
- H5HG_t *obj = NULL;
- uint8_t out[GHEAP_TEST_NOBJS];
- uint8_t in[GHEAP_TEST_NOBJS];
- size_t u;
- size_t size;
- int nerrors = 0;
- char filename[1024];
+ hid_t file = H5I_INVALID_HID;
+ H5F_t * f = NULL;
+ H5HG_t *obj = NULL;
+ uint8_t out[GHEAP_TEST_NOBJS];
+ uint8_t in[GHEAP_TEST_NOBJS];
+ size_t u;
+ size_t size;
+ int nerrors = 0;
+ char filename[1024];
TESTING("monotonically decreasing lengths");
/* Allocate buffer for H5HG_t */
- if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
+ if (NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
goto error;
/* Open a clean file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if(NULL == (f = (H5F_t *)H5VL_object(file))) {
+ if (NULL == (f = (H5F_t *)H5VL_object(file))) {
H5_FAILED();
HDputs(" Unable to create file");
goto error;
@@ -213,11 +203,11 @@ test_2 (hid_t fapl)
/*
* Write the objects, monotonically decreasing in length.
*/
- for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ for (u = 0; u < GHEAP_TEST_NOBJS; u++) {
size = GHEAP_TEST_NOBJS - u;
HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- if(H5HG_insert(f, size, out, obj + u) < 0) {
+ if (H5HG_insert(f, size, out, obj + u) < 0) {
H5_FAILED();
HDputs(" Unable to insert object into global heap");
nerrors++;
@@ -227,16 +217,16 @@ test_2 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ for (u = 0; u < GHEAP_TEST_NOBJS; u++) {
size = GHEAP_TEST_NOBJS - u;
HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- if(NULL == H5HG_read(f, obj + u, in, NULL)) {
+ if (NULL == H5HG_read(f, obj + u, in, NULL)) {
H5_FAILED();
HDputs(" Unable to read object");
nerrors++;
}
- else if (memcmp (in, out, size)) {
+ else if (memcmp(in, out, size)) {
H5_FAILED();
HDputs(" Value read doesn't match value written");
nerrors++;
@@ -247,24 +237,22 @@ test_2 (hid_t fapl)
HDfree(obj);
obj = NULL;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
- if(nerrors)
+ if (nerrors)
goto error;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- if(obj)
+error:
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ if (obj)
HDfree(obj);
return MAX(1, nerrors);
}
-
/*-------------------------------------------------------------------------
* Function: test_3
*
@@ -281,41 +269,41 @@ test_2 (hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-test_3 (hid_t fapl)
+test_3(hid_t fapl)
{
- hid_t file = H5I_INVALID_HID;
- H5F_t *f = NULL;
- H5HG_t *obj = NULL;
- uint8_t out[GHEAP_TEST_NOBJS];
- size_t u;
- size_t size;
- herr_t status;
- int nerrors = 0;
- char filename[1024];
+ hid_t file = H5I_INVALID_HID;
+ H5F_t * f = NULL;
+ H5HG_t *obj = NULL;
+ uint8_t out[GHEAP_TEST_NOBJS];
+ size_t u;
+ size_t size;
+ herr_t status;
+ int nerrors = 0;
+ char filename[1024];
TESTING("complete object removal");
/* Allocate buffer for H5HG_t */
- if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
+ if (NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
goto error;
/* Open a clean file */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if(NULL == (f = (H5F_t *)H5VL_object(file))) {
+ if (NULL == (f = (H5F_t *)H5VL_object(file))) {
H5_FAILED();
HDputs(" Unable to create file");
goto error;
}
/* Create some stuff */
- for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ for (u = 0; u < GHEAP_TEST_NOBJS; u++) {
size = u % 30 + 100;
HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
status = H5HG_insert(f, size, out, obj + u);
- if (status<0) {
+ if (status < 0) {
H5_FAILED();
HDputs(" Unable to insert object into global heap");
nerrors++;
@@ -323,9 +311,9 @@ test_3 (hid_t fapl)
}
/* Remove everything */
- for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ for (u = 0; u < GHEAP_TEST_NOBJS; u++) {
status = H5HG_remove(f, obj + u);
- if (status<0) {
+ if (status < 0) {
H5_FAILED();
HDputs(" Unable to remove object");
nerrors++;
@@ -336,24 +324,22 @@ test_3 (hid_t fapl)
HDfree(obj);
obj = NULL;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
- if(nerrors)
+ if (nerrors)
goto error;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- if(obj)
+error:
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ if (obj)
HDfree(obj);
return MAX(1, nerrors);
}
-
/*-------------------------------------------------------------------------
* Function: test_4
*
@@ -371,41 +357,41 @@ test_3 (hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-test_4 (hid_t fapl)
+test_4(hid_t fapl)
{
- hid_t file = H5I_INVALID_HID;
- H5F_t *f = NULL;
- H5HG_t *obj = NULL;
- uint8_t out[GHEAP_TEST_NOBJS];
- size_t u;
- size_t size;
- herr_t status;
- int nerrors = 0;
- char filename[1024];
+ hid_t file = H5I_INVALID_HID;
+ H5F_t * f = NULL;
+ H5HG_t *obj = NULL;
+ uint8_t out[GHEAP_TEST_NOBJS];
+ size_t u;
+ size_t size;
+ herr_t status;
+ int nerrors = 0;
+ char filename[1024];
TESTING("partial object removal");
/* Allocate buffer for H5HG_t */
- if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
+ if (NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
goto error;
/* Open a clean file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if(NULL == (f = (H5F_t *)H5VL_object(file))) {
+ if (NULL == (f = (H5F_t *)H5VL_object(file))) {
H5_FAILED();
HDputs(" Unable to create file");
goto error;
}
- for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ for (u = 0; u < GHEAP_TEST_NOBJS; u++) {
/* Insert */
size = u % 30 + 100;
HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
status = H5HG_insert(f, size, out, obj + u);
- if (status<0) {
+ if (status < 0) {
H5_FAILED();
HDputs(" Unable to insert object into global heap");
nerrors++;
@@ -415,10 +401,10 @@ test_4 (hid_t fapl)
* next one has already been inserted. That is, insert A, B, C;
* remove B, insert D, E, F; remove E; etc.
*/
- if(1 == (u % 3)) {
+ if (1 == (u % 3)) {
H5Eclear2(H5E_DEFAULT);
status = H5HG_remove(f, obj + u - 1);
- if (status<0) {
+ if (status < 0) {
H5_FAILED();
HDputs(" Unable to remove object");
nerrors++;
@@ -431,24 +417,22 @@ test_4 (hid_t fapl)
HDfree(obj);
obj = NULL;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
- if(nerrors)
+ if (nerrors)
goto error;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- if(obj)
+error:
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ if (obj)
HDfree(obj);
return MAX(1, nerrors);
}
-
/*-------------------------------------------------------------------------
* Function: test_ooo_indices
*
@@ -469,24 +453,24 @@ test_4 (hid_t fapl)
static int
test_ooo_indices(hid_t fapl)
{
- hid_t file = H5I_INVALID_HID;
- H5F_t *f = NULL;
- unsigned i, j;
- H5HG_t *obj = NULL;
- herr_t status;
- int nerrors = 0;
- char filename[1024];
+ hid_t file = H5I_INVALID_HID;
+ H5F_t * f = NULL;
+ unsigned i, j;
+ H5HG_t * obj = NULL;
+ herr_t status;
+ int nerrors = 0;
+ char filename[1024];
TESTING("out of order indices");
- if(NULL == (obj = (H5HG_t *)HDmalloc(2000 * sizeof(*obj))))
+ if (NULL == (obj = (H5HG_t *)HDmalloc(2000 * sizeof(*obj))))
goto error;
/* Open a clean file */
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if(NULL == (f = (H5F_t *)H5VL_object(file))) {
+ if (NULL == (f = (H5F_t *)H5VL_object(file))) {
H5_FAILED();
HDputs(" Unable to create file");
goto error;
@@ -495,28 +479,28 @@ test_ooo_indices(hid_t fapl)
/* Alternately insert 1000 entries and remove the previous group of 1000
* entries, until the indices wrap around.
*/
- for(i = 0; i < 66; i++) {
+ for (i = 0; i < 66; i++) {
/* Insert 1000 entries. The index into the obj array will alternate up
* and down by 1000 so the previous set of insertions is preserved and
* can be deleted.
*/
- for(j=1000*((~i&1)); j<1000*((~i&1)+1); j++) {
+ for (j = 1000 * ((~i & 1)); j < 1000 * ((~i & 1) + 1); j++) {
H5Eclear2(H5E_DEFAULT);
status = H5HG_insert(f, sizeof(j), &j, &obj[j]);
- if (status<0)
+ if (status < 0)
GHEAP_REPEATED_ERR(" Unable to insert object into global heap")
/* Check that the index is as expected */
- if(obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1u << 16) - 1) + 1)
+ if (obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1u << 16) - 1) + 1)
GHEAP_REPEATED_ERR(" Unexpected global heap index");
}
/* Remove the previous 1000 entries */
- if(i>0)
- for(j=1000*(i&1); j<1000*((i&1)+1); j++) {
+ if (i > 0)
+ for (j = 1000 * (i & 1); j < 1000 * ((i & 1) + 1); j++) {
H5Eclear2(H5E_DEFAULT);
status = H5HG_remove(f, &obj[j]);
- if (status<0)
+ if (status < 0)
GHEAP_REPEATED_ERR(" Unable to remove object from global heap");
}
}
@@ -528,28 +512,28 @@ test_ooo_indices(hid_t fapl)
/* Reopen the file */
if (H5Fclose(file) < 0)
goto error;
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
goto error;
- if(NULL == (f = (H5F_t *)H5VL_object(file))) {
+ if (NULL == (f = (H5F_t *)H5VL_object(file))) {
H5_FAILED();
HDputs(" Unable to open file");
goto error;
} /* end if */
/* Read the objects to make sure the heap is still readable */
- for(i=0; i<1000; i++) {
- if(NULL == H5HG_read(f, &obj[i], &j, NULL))
+ for (i = 0; i < 1000; i++) {
+ if (NULL == H5HG_read(f, &obj[i], &j, NULL))
goto error;
- if(i != j) {
+ if (i != j) {
H5_FAILED();
HDputs(" Incorrect read value");
goto error;
}
}
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
- if(nerrors)
+ if (nerrors)
goto error;
HDfree(obj);
obj = NULL;
@@ -557,16 +541,14 @@ test_ooo_indices(hid_t fapl)
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- if(obj)
+error:
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ if (obj)
HDfree(obj);
return MAX(1, nerrors);
} /* end test_ooo_indices */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -577,18 +559,19 @@ test_ooo_indices(hid_t fapl)
*-------------------------------------------------------------------------
*/
int
-main (void)
+main(void)
{
- int nerrors = 0;
- hid_t fapl_id = H5I_INVALID_HID;
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ int nerrors = 0;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
h5_reset();
if ((fapl_id = h5_fileaccess()) < 0)
goto error;
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
nerrors += test_1(fapl_id);
@@ -606,20 +589,20 @@ main (void)
HDputs("All global heap tests passed.");
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
h5_cleanup(FILENAME, fapl_id);
HDexit(EXIT_SUCCESS);
- error:
- H5E_BEGIN_TRY {
- H5Pclose(fapl_id);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY { H5Pclose(fapl_id); }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
HDputs("*** TESTS FAILED ***");
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/h5test.c b/test/h5test.c
index d72a4c5..ff5020d 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -19,20 +19,20 @@
*
*/
-#undef NDEBUG /*override -DNDEBUG */
+#undef NDEBUG /*override -DNDEBUG */
#include "h5test.h"
#include "H5srcdir.h"
#include "H5srcdir_str.h"
/* Necessary for h5_verify_cached_stabs() */
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#define H5G_TESTING
#include "H5Gpkg.h"
#ifdef H5_HAVE_WIN32_API
#include <process.h>
-#endif /* H5_HAVE_WIN32_API */
+#endif /* H5_HAVE_WIN32_API */
/*
* Define these environment variables or constants to influence functions in
@@ -71,12 +71,12 @@
#ifndef HDF5_PARAPREFIX
#define HDF5_PARAPREFIX ""
#endif
-char *paraprefix = NULL; /* for command line option para-prefix */
+char *paraprefix = NULL; /* for command line option para-prefix */
#ifdef H5_HAVE_PARALLEL
-MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
+MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */
#endif
-#define READ_BUF_SIZE 65536
+#define READ_BUF_SIZE 65536
/*
* These are the letters that are appended to the file name when generating
@@ -93,13 +93,13 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
static const char *multi_letters = "msbrglo";
/* Length of multi-file VFD filename buffers */
-#define H5TEST_MULTI_FILENAME_LEN 1024
+#define H5TEST_MULTI_FILENAME_LEN 1024
/* Temporary file for sending signal messages */
#define TMP_SIGNAL_FILE "tmp_signal_file"
/* The # of seconds to wait for the message file--used by h5_wait_message() */
-#define MESSAGE_TIMEOUT 300 /* Timeout in seconds */
+#define MESSAGE_TIMEOUT 300 /* Timeout in seconds */
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
@@ -109,22 +109,19 @@ static char srcdir_testpath[1024] = "";
/* The strings that correspond to library version bounds H5F_libver_t in H5Fpublic.h */
/* This is used by h5_get_version_string() */
-const char *LIBVER_NAMES[] = {
- "earliest", /* H5F_LIBVER_EARLIEST = 0 */
- "v18", /* H5F_LIBVER_V18 = 1 */
- "v110", /* H5F_LIBVER_V110 = 2 */
- "v112", /* H5F_LIBVER_V112 = 3 */
- "latest", /* H5F_LIBVER_V114 = 4 */
- NULL
-};
+const char *LIBVER_NAMES[] = {"earliest", /* H5F_LIBVER_EARLIEST = 0 */
+ "v18", /* H5F_LIBVER_V18 = 1 */
+ "v110", /* H5F_LIBVER_V110 = 2 */
+ "v112", /* H5F_LIBVER_V112 = 3 */
+ "latest", /* H5F_LIBVER_V114 = 4 */
+ NULL};
/* Previous error reporting function */
static H5E_auto2_t err_func = NULL;
static herr_t h5_errors(hid_t estack, void *client_data);
-static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
- char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock);
-
+static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname,
+ size_t size, hbool_t nest_printf, hbool_t subst_for_superblock);
/*-------------------------------------------------------------------------
* Function: h5_errors
@@ -150,7 +147,6 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data)
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: h5_clean_files
*
@@ -169,7 +165,7 @@ h5_clean_files(const char *base_name[], hid_t fapl)
{
int i;
- for(i = 0; base_name[i]; i++) {
+ for (i = 0; base_name[i]; i++) {
h5_delete_test_file(base_name[i], fapl);
}
@@ -179,7 +175,6 @@ h5_clean_files(const char *base_name[], hid_t fapl)
return;
} /* end h5_clean_files() */
-
/*-------------------------------------------------------------------------
* Function: h5_delete_test_file
*
@@ -207,47 +202,50 @@ H5_GCC_DIAG_OFF("format-nonliteral")
void
h5_delete_test_file(const char *base_name, hid_t fapl)
{
- char filename[1024]; /* VFD-dependent filename to delete */
- char sub_filename[2048]; /* sub-files in multi & family VFDs */
- hid_t driver = -1; /* VFD ID */
+ char filename[1024]; /* VFD-dependent filename to delete */
+ char sub_filename[2048]; /* sub-files in multi & family VFDs */
+ hid_t driver = -1; /* VFD ID */
/* Get the VFD-dependent filename */
- if(NULL == h5_fixname(base_name, fapl, filename, sizeof(filename)))
+ if (NULL == h5_fixname(base_name, fapl, filename, sizeof(filename)))
return;
driver = H5Pget_driver(fapl);
- if(driver == H5FD_FAMILY) {
+ if (driver == H5FD_FAMILY) {
int j;
- for(j = 0; /*void*/; j++) {
+ for (j = 0; /*void*/; j++) {
HDsnprintf(sub_filename, sizeof(sub_filename), filename, j);
/* If we can't access the file, it probably doesn't exist
* and we are done deleting the sub-files.
*/
- if(HDaccess(sub_filename, F_OK) < 0)
+ if (HDaccess(sub_filename, F_OK) < 0)
break;
HDremove(sub_filename);
} /* end for */
- } else if(driver == H5FD_CORE) {
- hbool_t backing; /* Whether the core file has backing store */
+ }
+ else if (driver == H5FD_CORE) {
+ hbool_t backing; /* Whether the core file has backing store */
H5Pget_fapl_core(fapl, NULL, &backing);
/* If the file was stored to disk with bacing store, remove it */
- if(backing)
+ if (backing)
HDremove(filename);
- } else if (driver == H5FD_MULTI) {
+ }
+ else if (driver == H5FD_MULTI) {
H5FD_mem_t mt;
HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]);
HDremove(sub_filename);
}
- } else {
+ }
+ else {
HDremove(filename);
} /* end driver selection tree */
@@ -255,7 +253,6 @@ h5_delete_test_file(const char *base_name, hid_t fapl)
} /* end h5_delete_test_file() */
H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: h5_delete_all_test_files
*
@@ -279,16 +276,15 @@ H5_GCC_DIAG_ON("format-nonliteral")
void
h5_delete_all_test_files(const char *base_name[], hid_t fapl)
{
- int i; /* iterator */
+ int i; /* iterator */
- for(i = 0; base_name[i]; i++) {
+ for (i = 0; base_name[i]; i++) {
h5_delete_test_file(base_name[i], fapl);
} /* end for */
return;
} /* end h5_delete_all_test_files() */
-
/*-------------------------------------------------------------------------
* Function: h5_cleanup
*
@@ -306,9 +302,9 @@ h5_delete_all_test_files(const char *base_name[], hid_t fapl)
int
h5_cleanup(const char *base_name[], hid_t fapl)
{
- int retval = 0;
+ int retval = 0;
- if(GetTestCleanup()) {
+ if (GetTestCleanup()) {
/* Clean up files in base_name, and the FAPL */
h5_clean_files(base_name, fapl);
@@ -321,7 +317,6 @@ h5_cleanup(const char *base_name[], hid_t fapl)
return retval;
} /* end h5_cleanup() */
-
/*-------------------------------------------------------------------------
* Function: h5_test_shutdown
*
@@ -350,7 +345,6 @@ h5_test_shutdown(void)
return;
} /* end h5_test_shutdown() */
-
/*-------------------------------------------------------------------------
* Function: h5_restore_err
*
@@ -372,7 +366,6 @@ h5_restore_err(void)
err_func = NULL;
}
-
/*-------------------------------------------------------------------------
* Function: h5_reset
*
@@ -407,27 +400,27 @@ h5_reset(void)
* appropriate configure flags/macros. QAK - 2007/12/20
*/
#ifdef OLD_WAY
-{
- char filename[1024];
+ {
+ char filename[1024];
- /*
- * Cause the library to emit some diagnostics early so they don't
- * interfere with other formatted output.
- */
- HDsprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid());
- H5E_BEGIN_TRY {
- hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT);
- hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(grp);
- H5Fclose(file);
- HDunlink(filename);
- } H5E_END_TRY;
-}
+ /*
+ * Cause the library to emit some diagnostics early so they don't
+ * interfere with other formatted output.
+ */
+ HDsprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid());
+ H5E_BEGIN_TRY
+ {
+ hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(grp);
+ H5Fclose(file);
+ HDunlink(filename);
+ }
+ H5E_END_TRY;
+ }
#endif /* OLD_WAY */
}
-
/*-------------------------------------------------------------------------
* Function: h5_test_init
*
@@ -460,7 +453,6 @@ h5_test_init(void)
return;
} /* end h5_test_init() */
-
/*-------------------------------------------------------------------------
* Function: h5_fixname
*
@@ -489,7 +481,6 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, FALSE, FALSE));
}
-
/*-------------------------------------------------------------------------
* Function: h5_fixname_superblock
*
@@ -515,7 +506,6 @@ h5_fixname_superblock(const char *base_name, hid_t fapl_id, char *fullname, size
return (h5_fixname_real(base_name, fapl_id, ".h5", fullname, size, FALSE, TRUE));
}
-
/*-------------------------------------------------------------------------
* Function: h5_fixname_no_suffix
*
@@ -535,7 +525,6 @@ h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t s
return (h5_fixname_real(base_name, fapl, NULL, fullname, size, FALSE, FALSE));
}
-
/*-------------------------------------------------------------------------
* Function: h5_fixname_printf
*
@@ -561,7 +550,6 @@ h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size
return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, TRUE, FALSE));
}
-
/*-------------------------------------------------------------------------
* Function: h5_fixname_real
*
@@ -585,16 +573,16 @@ h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size
*-------------------------------------------------------------------------
*/
static char *
-h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
- char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock)
+h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size,
+ hbool_t nest_printf, hbool_t subst_for_superblock)
{
- const char *prefix = NULL;
- const char *env = NULL; /* HDF5_DRIVER environment variable */
- char *ptr, last = '\0';
- const char *suffix = _suffix;
- size_t i, j;
- hid_t driver = -1;
- int isppdriver = 0; /* if the driver is MPI parallel */
+ const char *prefix = NULL;
+ const char *env = NULL; /* HDF5_DRIVER environment variable */
+ char * ptr, last = '\0';
+ const char *suffix = _suffix;
+ size_t i, j;
+ hid_t driver = -1;
+ int isppdriver = 0; /* if the driver is MPI parallel */
if (!base_name || !fullname || size < 1)
return NULL;
@@ -602,13 +590,13 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
HDmemset(fullname, 0, size);
/* figure out the suffix */
- if(H5P_DEFAULT != fapl) {
- if((driver = H5Pget_driver(fapl)) < 0)
+ if (H5P_DEFAULT != fapl) {
+ if ((driver = H5Pget_driver(fapl)) < 0)
return NULL;
- if(suffix) {
- if(H5FD_FAMILY == driver) {
- if(subst_for_superblock)
+ if (suffix) {
+ if (H5FD_FAMILY == driver) {
+ if (subst_for_superblock)
suffix = "00000.h5";
else
suffix = nest_printf ? "%%05d.h5" : "%05d.h5";
@@ -622,19 +610,19 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
env = HDgetenv("HDF5_DRIVER");
#ifdef HDF5_DRIVER
/* Use the environment variable, then the compile-time constant */
- if(!env)
+ if (!env)
env = HDF5_DRIVER;
#endif
- if(env && !HDstrcmp(env, "split")) {
+ if (env && !HDstrcmp(env, "split")) {
/* split VFD */
- if(subst_for_superblock)
+ if (subst_for_superblock)
suffix = "-m.h5";
else
suffix = NULL;
}
else {
/* multi VFD */
- if(subst_for_superblock)
+ if (subst_for_superblock)
suffix = "-s.h5";
else
suffix = NULL;
@@ -652,13 +640,14 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
* (The #ifdef is needed to prevent compile failure in case MPI is not
* configured.)
*/
- if(isppdriver) {
+ if (isppdriver) {
#ifdef H5_HAVE_PARALLEL
- if(getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP"))
+ if (getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP"))
SetTestNoCleanup();
-#endif /* H5_HAVE_PARALLEL */
- } else {
- if(HDgetenv("HDF5_NOCLEANUP"))
+#endif /* H5_HAVE_PARALLEL */
+ }
+ else {
+ if (HDgetenv("HDF5_NOCLEANUP"))
SetTestNoCleanup();
}
@@ -668,7 +657,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
* (The #ifdef is needed to prevent compile failure in case MPI is not
* configured.)
*/
- if(isppdriver) {
+ if (isppdriver) {
#ifdef H5_HAVE_PARALLEL
/*
* For parallel:
@@ -687,20 +676,21 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
if (mpi_rank == 0)
HDprintf("*** Hint ***\n"
- "You can use environment variable HDF5_PARAPREFIX to "
- "run parallel test files in a\n"
- "different directory or to add file type prefix. e.g.,\n"
- " HDF5_PARAPREFIX=pfs:/PFS/user/me\n"
- " export HDF5_PARAPREFIX\n"
- "*** End of Hint ***\n");
+ "You can use environment variable HDF5_PARAPREFIX to "
+ "run parallel test files in a\n"
+ "different directory or to add file type prefix. e.g.,\n"
+ " HDF5_PARAPREFIX=pfs:/PFS/user/me\n"
+ " export HDF5_PARAPREFIX\n"
+ "*** End of Hint ***\n");
explained = TRUE;
#ifdef HDF5_PARAPREFIX
prefix = HDF5_PARAPREFIX;
-#endif /* HDF5_PARAPREFIX */
+#endif /* HDF5_PARAPREFIX */
}
-#endif /* H5_HAVE_PARALLEL */
- } else {
+#endif /* H5_HAVE_PARALLEL */
+ }
+ else {
/*
* For serial:
* First use the environment variable, then try the constant
@@ -710,7 +700,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
#ifdef HDF5_PREFIX
if (!prefix)
prefix = HDF5_PREFIX;
-#endif /* HDF5_PREFIX */
+#endif /* HDF5_PREFIX */
}
/* Prepend the prefix value to the base name */
@@ -727,8 +717,8 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
*/
char *user, *login;
- user = HDgetenv("USER");
- login = HDgetenv("LOGIN");
+ user = HDgetenv("USER");
+ login = HDgetenv("LOGIN");
subdir = (user ? user : login);
if (subdir) {
@@ -745,7 +735,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
if (!fullname[0]) {
/* We didn't append the prefix yet */
HDstrncpy(fullname, prefix, size);
- fullname[size -1] = '\0';
+ fullname[size - 1] = '\0';
}
if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) {
@@ -767,19 +757,23 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
HDstrcat(fullname, "/");
HDstrcat(fullname, base_name);
- } else {
+ }
+ else {
/* Buffer is too small */
return NULL;
}
- } else {
+ }
+ else {
if (HDsnprintf(fullname, size, "%s/%s", prefix, base_name) == (int)size)
/* Buffer is too small */
return NULL;
}
- } else if (HDstrlen(base_name) >= size) {
+ }
+ else if (HDstrlen(base_name) >= size) {
/* Buffer is too small */
return NULL;
- } else {
+ }
+ else {
HDstrcpy(fullname, base_name);
}
@@ -802,7 +796,6 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
return fullname;
}
-
/*-------------------------------------------------------------------------
* Function: h5_rmprefix
*
@@ -830,10 +823,9 @@ h5_rmprefix(const char *filename)
else
ret_ptr++;
- return(ret_ptr);
+ return (ret_ptr);
}
-
/*-------------------------------------------------------------------------
* Function: h5_fileaccess
*
@@ -852,28 +844,27 @@ h5_rmprefix(const char *filename)
hid_t
h5_fileaccess(void)
{
- hid_t fapl_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
/* Attempt to set up a file driver first */
- if(h5_get_vfd_fapl(fapl_id) < 0)
+ if (h5_get_vfd_fapl(fapl_id) < 0)
goto error;
/* Finally, check for libver bounds */
- if(h5_get_libver_fapl(fapl_id) < 0)
+ if (h5_get_libver_fapl(fapl_id) < 0)
goto error;
return fapl_id;
error:
- if(fapl_id != H5I_INVALID_HID)
+ if (fapl_id != H5I_INVALID_HID)
H5Pclose(fapl_id);
return H5I_INVALID_HID;
} /* end h5_fileaccess() */
-
/*-------------------------------------------------------------------------
* Function: h5_fileaccess_flags
*
@@ -892,28 +883,27 @@ error:
hid_t
h5_fileaccess_flags(unsigned flags)
{
- hid_t fapl_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
/* Attempt to set up a file driver first */
- if((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0)
+ if ((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0)
goto error;
/* Finally, check for libver bounds */
- if((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0)
+ if ((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0)
goto error;
return fapl_id;
error:
- if(fapl_id != H5I_INVALID_HID)
+ if (fapl_id != H5I_INVALID_HID)
H5Pclose(fapl_id);
return H5I_INVALID_HID;
} /* end h5_fileaccess_flags() */
-
/*-------------------------------------------------------------------------
* Function: h5_get_vfd_fapl
*
@@ -931,23 +921,23 @@ error:
herr_t
h5_get_vfd_fapl(hid_t fapl)
{
- const char *env = NULL; /* HDF5_DRIVER environment variable */
- const char *tok = NULL; /* strtok pointer */
- char *lasts = NULL; /* Context pointer for strtok_r() call */
- char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */
+ const char *env = NULL; /* HDF5_DRIVER environment variable */
+ const char *tok = NULL; /* strtok pointer */
+ char * lasts = NULL; /* Context pointer for strtok_r() call */
+ char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */
/* Get the environment variable, if it exists */
env = HDgetenv("HDF5_DRIVER");
#ifdef HDF5_DRIVER
/* Use the environment variable, then the compile-time constant */
- if(!env)
+ if (!env)
env = HDF5_DRIVER;
#endif
/* If the environment variable was not set, just return
* without modifying the FAPL.
*/
- if(!env || !*env)
+ if (!env || !*env)
goto done;
/* Get the first 'word' of the environment variable.
@@ -956,37 +946,42 @@ h5_get_vfd_fapl(hid_t fapl)
*/
HDstrncpy(buf, env, sizeof(buf));
buf[sizeof(buf) - 1] = '\0';
- if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
+ if (NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
goto done;
- if(!HDstrcmp(tok, "sec2")) {
+ if (!HDstrcmp(tok, "sec2")) {
/* POSIX (section 2) read() and write() system calls */
- if(H5Pset_fapl_sec2(fapl) < 0)
+ if (H5Pset_fapl_sec2(fapl) < 0)
goto error;
- } else if(!HDstrcmp(tok, "stdio")) {
+ }
+ else if (!HDstrcmp(tok, "stdio")) {
/* Standard C fread() and fwrite() system calls */
- if(H5Pset_fapl_stdio(fapl) < 0)
+ if (H5Pset_fapl_stdio(fapl) < 0)
goto error;
- } else if(!HDstrcmp(tok, "core")) {
+ }
+ else if (!HDstrcmp(tok, "core")) {
/* In-memory driver settings (backing store on, 1 MB increment) */
- if(H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0)
+ if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0)
goto error;
- } else if(!HDstrcmp(tok, "core_paged")) {
+ }
+ else if (!HDstrcmp(tok, "core_paged")) {
/* In-memory driver with write tracking and paging on */
- if(H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0)
+ if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0)
goto error;
- if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0)
+ if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0)
goto error;
- } else if(!HDstrcmp(tok, "split")) {
+ }
+ else if (!HDstrcmp(tok, "split")) {
/* Split meta data and raw data each using default driver */
- if(H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0)
goto error;
- } else if(!HDstrcmp(tok, "multi")) {
+ }
+ else if (!HDstrcmp(tok, "multi")) {
/* Multi-file driver, general case of the split driver */
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
- const char *memb_name[H5FD_MEM_NTYPES];
- char *sv[H5FD_MEM_NTYPES];
+ const char *memb_name[H5FD_MEM_NTYPES];
+ char * sv[H5FD_MEM_NTYPES];
haddr_t memb_addr[H5FD_MEM_NTYPES];
H5FD_mem_t mt;
@@ -996,48 +991,52 @@ h5_get_vfd_fapl(hid_t fapl)
HDmemset(memb_addr, 0, sizeof(memb_addr));
HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
memb_fapl[mt] = H5P_DEFAULT;
- sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN);
+ sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN);
HDassert(sv[mt]);
HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
} /* end for */
- if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
goto error;
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
HDfree(sv[mt]);
- } else if(!HDstrcmp(tok, "family")) {
+ }
+ else if (!HDstrcmp(tok, "family")) {
/* Family of files, each 1MB and using the default driver */
- hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */
+ hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */
/* Was a family size specified in the environment variable? */
- if((tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
+ if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024 * 1024);
- if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0)
goto error;
- } else if(!HDstrcmp(tok, "log")) {
+ }
+ else if (!HDstrcmp(tok, "log")) {
/* Log file access */
unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC;
/* Were special log file flags specified in the environment variable? */
- if((tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
+ if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts)))
log_flags = (unsigned)HDstrtol(tok, NULL, 0);
- if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
+ if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
goto error;
#ifdef H5_HAVE_DIRECT
- } else if(!HDstrcmp(tok, "direct")) {
+ }
+ else if (!HDstrcmp(tok, "direct")) {
/* Linux direct read() and write() system calls. Set memory boundary,
* file block size, and copy buffer size to the default values.
*/
- if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0)
+ if (H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0)
goto error;
#endif
- } else {
+ }
+ else {
/* Unknown driver */
goto error;
} /* end if */
@@ -1049,7 +1048,6 @@ error:
return -1;
} /* end h5_get_vfd_fapl() */
-
/*-------------------------------------------------------------------------
* Function: h5_get_libver_fapl
*
@@ -1067,23 +1065,23 @@ error:
herr_t
h5_get_libver_fapl(hid_t fapl)
{
- const char *env = NULL; /* HDF5_DRIVER environment variable */
- const char *tok = NULL; /* strtok pointer */
- char *lasts = NULL; /* Context pointer for strtok_r() call */
- char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */
+ const char *env = NULL; /* HDF5_DRIVER environment variable */
+ const char *tok = NULL; /* strtok pointer */
+ char * lasts = NULL; /* Context pointer for strtok_r() call */
+ char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */
/* Get the environment variable, if it exists */
env = HDgetenv("HDF5_LIBVER_BOUNDS");
#ifdef HDF5_LIBVER_BOUNDS
/* Use the environment variable, then the compile-time constant */
- if(!env)
+ if (!env)
env = HDF5_LIBVER_BOUNDS;
#endif
/* If the environment variable was not set, just return
* without modifying the FAPL.
*/
- if(!env || !*env)
+ if (!env || !*env)
goto done;
/* Get the first 'word' of the environment variable.
@@ -1092,12 +1090,12 @@ h5_get_libver_fapl(hid_t fapl)
*/
HDstrncpy(buf, env, sizeof(buf));
buf[sizeof(buf) - 1] = '\0';
- if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
+ if (NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts)))
goto done;
- if(!HDstrcmp(tok, "latest")) {
+ if (!HDstrcmp(tok, "latest")) {
/* use the latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
} /* end if */
else {
@@ -1112,7 +1110,6 @@ error:
return -1;
} /* end h5_get_libver_fapl() */
-
/*-------------------------------------------------------------------------
* Function: h5_no_hwconv
*
@@ -1133,7 +1130,6 @@ h5_no_hwconv(void)
H5Tunregister(H5T_PERS_HARD, NULL, (hid_t)-1, (hid_t)-1, NULL);
}
-
/*-------------------------------------------------------------------------
* Function: h5_show_hostname
*
@@ -1151,10 +1147,10 @@ h5_no_hwconv(void)
void
h5_show_hostname(void)
{
- char hostname[80];
+ char hostname[80];
#ifdef H5_HAVE_WIN32_API
WSADATA wsaData;
- int err;
+ int err;
#endif
/* try show the process or thread id in multiple processes cases*/
@@ -1165,8 +1161,8 @@ h5_show_hostname(void)
MPI_Initialized(&mpi_initialized);
MPI_Finalized(&mpi_finalized);
- if(mpi_initialized && !mpi_finalized) {
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ if (mpi_initialized && !mpi_finalized) {
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
HDprintf("MPI-process %d.", mpi_rank);
}
else
@@ -1177,8 +1173,8 @@ h5_show_hostname(void)
#endif
#ifdef H5_HAVE_WIN32_API
- err = WSAStartup( MAKEWORD(2,2), &wsaData );
- if ( err != 0 ) {
+ err = WSAStartup(MAKEWORD(2, 2), &wsaData);
+ if (err != 0) {
/* could not find a usable WinSock DLL */
return;
}
@@ -1189,10 +1185,9 @@ h5_show_hostname(void)
/* 2.2 in wVersion since that is the version we */
/* requested. */
- if ( LOBYTE( wsaData.wVersion ) != 2 ||
- HIBYTE( wsaData.wVersion ) != 2 ) {
+ if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) {
/* could not find a usable WinSock DLL */
- WSACleanup( );
+ WSACleanup();
return;
}
@@ -1210,7 +1205,6 @@ h5_show_hostname(void)
#endif
}
-
#ifdef H5_HAVE_PARALLEL
/*
* Function: h5_set_info_object
@@ -1228,16 +1222,17 @@ h5_show_hostname(void)
int
h5_set_info_object(void)
{
- char *envp; /* environment pointer */
- int ret_value=0;
+ char *envp; /* environment pointer */
+ int ret_value = 0;
/* handle any MPI INFO hints via $HDF5_MPI_INFO */
- if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){
+ if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL) {
char *next, *valp;
valp = envp = next = HDstrdup(envp);
- if (!valp) return 0;
+ if (!valp)
+ return 0;
/* create an INFO object if not created yet */
if (h5_io_info_g == MPI_INFO_NULL)
@@ -1245,14 +1240,14 @@ h5_set_info_object(void)
do {
size_t len;
- char *key_val, *endp, *namep;
+ char * key_val, *endp, *namep;
if (*valp == ';')
valp++;
/* copy key/value pair into temporary buffer */
- len = strcspn(valp, ";");
- next = &valp[len];
+ len = strcspn(valp, ";");
+ next = &valp[len];
key_val = (char *)HDcalloc(1, len + 1);
/* increment the next pointer past the terminating semicolon */
@@ -1265,7 +1260,8 @@ h5_set_info_object(void)
while (*namep && (*namep == ' ' || *namep == '\t'))
namep++;
- if (!*namep) continue; /* was all white space, so move to next k/v pair */
+ if (!*namep)
+ continue; /* was all white space, so move to next k/v pair */
/* eat up any ending white spaces */
endp = &namep[HDstrlen(namep) - 1];
@@ -1276,7 +1272,7 @@ h5_set_info_object(void)
/* find the '=' */
valp = HDstrchr(namep, '=');
- if (valp != NULL) { /* it's a valid key/value pairing */
+ if (valp != NULL) { /* it's a valid key/value pairing */
char *tmp_val = valp + 1;
/* change '=' to \0, move valp down one */
@@ -1309,7 +1305,6 @@ h5_set_info_object(void)
return ret_value;
}
-
/*
* Function: h5_dump_info_object
* Purpose: Display content of an MPI Info object
@@ -1320,28 +1315,26 @@ h5_set_info_object(void)
void
h5_dump_info_object(MPI_Info info)
{
- char key[MPI_MAX_INFO_KEY+1];
- char value[MPI_MAX_INFO_VAL+1];
- int flag;
- int i, nkeys;
+ char key[MPI_MAX_INFO_KEY + 1];
+ char value[MPI_MAX_INFO_VAL + 1];
+ int flag;
+ int i, nkeys;
HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL);
- if (info==MPI_INFO_NULL){
- HDprintf("object is MPI_INFO_NULL\n");
+ if (info == MPI_INFO_NULL) {
+ HDprintf("object is MPI_INFO_NULL\n");
}
else {
- MPI_Info_get_nkeys(info, &nkeys);
- HDprintf("object has %d items\n", nkeys);
- for (i=0; i<nkeys; i++){
- MPI_Info_get_nthkey(info, i, key);
- MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
- HDprintf("%s=%s\n", key, value);
- }
-
+ MPI_Info_get_nkeys(info, &nkeys);
+ HDprintf("object has %d items\n", nkeys);
+ for (i = 0; i < nkeys; i++) {
+ MPI_Info_get_nthkey(info, i, key);
+ MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+ HDprintf("%s=%s\n", key, value);
+ }
}
}
-#endif /* H5_HAVE_PARALLEL */
-
+#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
* Function: h5_get_file_size
@@ -1366,103 +1359,106 @@ H5_GCC_DIAG_OFF("format-nonliteral")
h5_stat_size_t
h5_get_file_size(const char *filename, hid_t fapl)
{
- char temp[2048]; /* Temporary buffer for file names */
- h5_stat_t sb; /* Structure for querying file info */
- int j = 0;
+ char temp[2048]; /* Temporary buffer for file names */
+ h5_stat_t sb; /* Structure for querying file info */
+ int j = 0;
- if(fapl == H5P_DEFAULT) {
+ if (fapl == H5P_DEFAULT) {
/* Get the file's statistics */
- if(0 == HDstat(filename, &sb))
- return((h5_stat_size_t)sb.st_size);
+ if (0 == HDstat(filename, &sb))
+ return ((h5_stat_size_t)sb.st_size);
} /* end if */
else {
- hid_t driver; /* VFD used for file */
+ hid_t driver; /* VFD used for file */
/* Get the driver used when creating the file */
- if((driver = H5Pget_driver(fapl)) < 0)
- return(-1);
+ if ((driver = H5Pget_driver(fapl)) < 0)
+ return (-1);
/* Check for simple cases */
- if(driver == H5FD_SEC2 || driver == H5FD_STDIO || driver == H5FD_CORE ||
+ if (driver == H5FD_SEC2 || driver == H5FD_STDIO || driver == H5FD_CORE ||
#ifdef H5_HAVE_WINDOWS
- driver == H5FD_WINDOWS ||
+ driver == H5FD_WINDOWS ||
#endif /* H5_HAVE_WINDOWS */
#ifdef H5_HAVE_DIRECT
- driver == H5FD_DIRECT ||
+ driver == H5FD_DIRECT ||
#endif /* H5_HAVE_DIRECT */
- driver == H5FD_LOG) {
+ driver == H5FD_LOG) {
/* Get the file's statistics */
- if(0 == HDstat(filename, &sb))
- return((h5_stat_size_t)sb.st_size);
+ if (0 == HDstat(filename, &sb))
+ return ((h5_stat_size_t)sb.st_size);
} /* end if */
- else if(driver == H5FD_MULTI) {
- H5FD_mem_t mt;
+ else if (driver == H5FD_MULTI) {
+ H5FD_mem_t mt;
h5_stat_size_t tot_size = 0;
HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
/* Create the filename to query */
HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
/* Check for existence of file */
- if(0 == HDaccess(temp, F_OK)) {
+ if (0 == HDaccess(temp, F_OK)) {
/* Get the file's statistics */
- if(0 != HDstat(temp, &sb))
- return(-1);
+ if (0 != HDstat(temp, &sb))
+ return (-1);
/* Add to total size */
tot_size += (h5_stat_size_t)sb.st_size;
} /* end if */
- } /* end for */
+ } /* end for */
/* Return total size */
- return(tot_size);
+ return (tot_size);
} /* end if */
#ifdef H5_HAVE_PARALLEL
- else if(driver == H5FD_MPIO) {
- MPI_File fh; /* MPI file handle used to open the file and verify its size */
- int mpi_ret;
+ else if (driver == H5FD_MPIO) {
+ MPI_File fh; /* MPI file handle used to open the file and verify its size */
+ int mpi_ret;
MPI_Offset file_size;
mpi_ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh);
- if (mpi_ret != MPI_SUCCESS) return -1;
+ if (mpi_ret != MPI_SUCCESS)
+ return -1;
mpi_ret = MPI_File_get_size(fh, &file_size);
- if (mpi_ret != MPI_SUCCESS) return -1;
+ if (mpi_ret != MPI_SUCCESS)
+ return -1;
mpi_ret = MPI_File_close(&fh);
- if (mpi_ret != MPI_SUCCESS) return -1;
+ if (mpi_ret != MPI_SUCCESS)
+ return -1;
return file_size;
}
#endif /* H5_HAVE_PARALLEL */
- else if(driver == H5FD_FAMILY) {
+ else if (driver == H5FD_FAMILY) {
h5_stat_size_t tot_size = 0;
/* Try all filenames possible, until we find one that's missing */
- for(j = 0; /*void*/; j++) {
+ for (j = 0; /*void*/; j++) {
/* Create the filename to query */
HDsnprintf(temp, sizeof temp, filename, j);
/* Check for existence of file */
- if(HDaccess(temp, F_OK) < 0)
+ if (HDaccess(temp, F_OK) < 0)
break;
/* Get the file's statistics */
- if(0 != HDstat(temp, &sb))
- return(-1);
+ if (0 != HDstat(temp, &sb))
+ return (-1);
/* Add to total size */
tot_size += (h5_stat_size_t)sb.st_size;
} /* end for */
/* Return total size */
- return(tot_size);
+ return (tot_size);
} /* end if */
else {
HDassert(0 && "Unknown VFD!");
} /* end else */
- } /* end else */
+ } /* end else */
- return(-1);
+ return (-1);
} /* end get_file_size() */
H5_GCC_DIAG_ON("format-nonliteral")
@@ -1475,18 +1471,17 @@ H5_ATTR_FORMAT(printf, 1, 2)
int
print_func(const char *format, ...)
{
- va_list arglist;
- int ret_value;
+ va_list arglist;
+ int ret_value;
- HDva_start(arglist, format);
- ret_value = HDvprintf(format, arglist);
- HDva_end(arglist);
- return ret_value;
+ HDva_start(arglist, format);
+ ret_value = HDvprintf(format, arglist);
+ HDva_end(arglist);
+ return ret_value;
}
#ifdef H5_HAVE_FILTER_SZIP
-
/*-------------------------------------------------------------------------
* Function: h5_szip_can_encode
*
@@ -1503,31 +1498,31 @@ print_func(const char *format, ...)
*
*-------------------------------------------------------------------------
*/
-int h5_szip_can_encode(void )
+int
+h5_szip_can_encode(void)
{
unsigned int filter_config_flags;
H5Zget_filter_info(H5Z_FILTER_SZIP, &filter_config_flags);
- if ((filter_config_flags &
- (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
+ if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
/* filter present but neither encode nor decode is supported (???) */
return -1;
- } else if ((filter_config_flags &
- (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
- H5Z_FILTER_CONFIG_DECODE_ENABLED) {
+ }
+ else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_DECODE_ENABLED) {
/* decoder only: read but not write */
return 0;
- } else if ((filter_config_flags &
- (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
- H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
+ }
+ else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
/* encoder only: write but not read (???) */
return -1;
- } else if ((filter_config_flags &
- (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
- (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
+ }
+ else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
return 1;
}
- return(-1);
+ return (-1);
}
#endif /* H5_HAVE_FILTER_SZIP */
@@ -1559,27 +1554,27 @@ int h5_szip_can_encode(void )
*-------------------------------------------------------------------------
*/
char *
-getenv_all(MPI_Comm comm, int root, const char* name)
+getenv_all(MPI_Comm comm, int root, const char *name)
{
- int mpi_size, mpi_rank, mpi_initialized, mpi_finalized;
- int len;
- static char* env = NULL;
+ int mpi_size, mpi_rank, mpi_initialized, mpi_finalized;
+ int len;
+ static char *env = NULL;
HDassert(name);
MPI_Initialized(&mpi_initialized);
MPI_Finalized(&mpi_finalized);
- if(mpi_initialized && !mpi_finalized) {
+ if (mpi_initialized && !mpi_finalized) {
MPI_Comm_rank(comm, &mpi_rank);
MPI_Comm_size(comm, &mpi_size);
HDassert(root < mpi_size);
/* The root task does the getenv call
* and sends the result to the other tasks */
- if(mpi_rank == root) {
+ if (mpi_rank == root) {
env = HDgetenv(name);
- if(env) {
+ if (env) {
len = (int)HDstrlen(env);
MPI_Bcast(&len, 1, MPI_INT, root, comm);
MPI_Bcast(env, len, MPI_CHAR, root, comm);
@@ -1592,17 +1587,17 @@ getenv_all(MPI_Comm comm, int root, const char* name)
}
else {
MPI_Bcast(&len, 1, MPI_INT, root, comm);
- if(len >= 0) {
- if(env == NULL)
- env = (char*) HDmalloc((size_t)len+1);
- else if(HDstrlen(env) < (size_t)len)
- env = (char*) HDrealloc(env, (size_t)len+1);
+ if (len >= 0) {
+ if (env == NULL)
+ env = (char *)HDmalloc((size_t)len + 1);
+ else if (HDstrlen(env) < (size_t)len)
+ env = (char *)HDrealloc(env, (size_t)len + 1);
MPI_Bcast(env, len, MPI_CHAR, root, comm);
env[len] = '\0';
}
else {
- if(env)
+ if (env)
HDfree(env);
env = NULL;
}
@@ -1613,7 +1608,7 @@ getenv_all(MPI_Comm comm, int root, const char* name)
}
else {
/* use original getenv */
- if(env)
+ if (env)
HDfree(env);
env = HDgetenv(name);
} /* end if */
@@ -1644,30 +1639,30 @@ getenv_all(MPI_Comm comm, int root, const char* name)
int
h5_make_local_copy(const char *origfilename, const char *local_copy_name)
{
- int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
- ssize_t nread; /* Number of bytes read in */
- void *buf = NULL; /* Buffer for copying data */
- const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */
+ int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
+ ssize_t nread; /* Number of bytes read in */
+ void * buf = NULL; /* Buffer for copying data */
+ const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */
/* Allocate copy buffer */
- if(NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE)))
+ if (NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE)))
goto error;
/* Copy old file into temporary file */
- if((fd_old = HDopen(filename, O_RDONLY)) < 0)
+ if ((fd_old = HDopen(filename, O_RDONLY)) < 0)
goto error;
- if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd_new = HDopen(local_copy_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
/* Copy data */
- while((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0)
- if(HDwrite(fd_new, buf, (size_t)nread) < 0)
+ while ((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0)
+ if (HDwrite(fd_new, buf, (size_t)nread) < 0)
goto error;
/* Close files */
- if(HDclose(fd_old) < 0)
+ if (HDclose(fd_old) < 0)
goto error;
- if(HDclose(fd_new) < 0)
+ if (HDclose(fd_new) < 0)
goto error;
/* Release memory */
@@ -1677,15 +1672,14 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name)
error:
/* ignore return values since we're already noted the problem */
- if(fd_old > 0)
+ if (fd_old > 0)
HDclose(fd_old);
- if(fd_new > 0)
+ if (fd_new > 0)
HDclose(fd_new);
HDfree(buf);
return -1;
} /* end h5_make_local_copy() */
-
/*-------------------------------------------------------------------------
* Function: h5_verify_cached_stabs_cb
*
@@ -1699,16 +1693,15 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name,
- const H5O_info2_t *oinfo, void H5_ATTR_UNUSED *udata)
+h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, const H5O_info2_t *oinfo,
+ void H5_ATTR_UNUSED *udata)
{
- if(oinfo->type == H5O_TYPE_GROUP)
+ if (oinfo->type == H5O_TYPE_GROUP)
return H5G__verify_cached_stabs_test(oid);
else
return SUCCEED;
} /* end h5_verify_cached_stabs_cb() */
-
/*-------------------------------------------------------------------------
* Function: h5_verify_cached_stabs
*
@@ -1732,27 +1725,26 @@ h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name,
herr_t
h5_verify_cached_stabs(const char *base_name[], hid_t fapl)
{
- hid_t file = -1;
- char filename[1024];
- int i = 0;
+ hid_t file = -1;
+ char filename[1024];
+ int i = 0;
- while(base_name[i]) {
+ while (base_name[i]) {
if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL)
continue;
- H5E_BEGIN_TRY {
- file = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
- } H5E_END_TRY
- if(file < 0) {
+ H5E_BEGIN_TRY { file = H5Fopen(filename, H5F_ACC_RDONLY, fapl); }
+ H5E_END_TRY
+ if (file < 0) {
i++;
continue;
} /* end if */
- if(H5Ovisit3(file, H5_INDEX_NAME, H5_ITER_NATIVE,
- h5_verify_cached_stabs_cb, NULL, H5O_INFO_BASIC) < 0)
+ if (H5Ovisit3(file, H5_INDEX_NAME, H5_ITER_NATIVE, h5_verify_cached_stabs_cb, NULL, H5O_INFO_BASIC) <
+ 0)
goto error;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
file = -1;
@@ -1762,9 +1754,8 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
return -1;
}
@@ -1802,18 +1793,18 @@ h5_send_message(const char *send, const char *arg1, const char *arg2)
signalfile = HDfopen(TMP_SIGNAL_FILE, "w+");
/* Write messages to signal file, if provided */
- if(arg2 != NULL) {
+ if (arg2 != NULL) {
HDassert(arg1);
HDfprintf(signalfile, "%s\n%s\n", arg1, arg2);
} /* end if */
- else if(arg1 != NULL) {
+ else if (arg1 != NULL) {
HDassert(arg2 == NULL);
HDfprintf(signalfile, "%s\n", arg1);
} /* end if */
else {
HDassert(arg1 == NULL);
HDassert(arg2 == NULL);
- }/* end else */
+ } /* end else */
HDfclose(signalfile);
@@ -1850,8 +1841,8 @@ h5_send_message(const char *send, const char *arg1, const char *arg2)
herr_t
h5_wait_message(const char *waitfor)
{
- FILE *returnfile;
- time_t t0,t1;
+ FILE * returnfile;
+ time_t t0, t1;
/* Start timer. If this function runs for too long (i.e.,
expected signal is never received), it will
@@ -1867,11 +1858,11 @@ h5_wait_message(const char *waitfor)
/* If we've been waiting for a signal for too long, then
it was likely never sent and we should fail rather
than loop infinitely */
- if(HDdifftime(t1, t0) > MESSAGE_TIMEOUT) {
+ if (HDdifftime(t1, t0) > MESSAGE_TIMEOUT) {
HDfprintf(stdout, "Error communicating between processes. Make sure test script is running.\n");
TEST_ERROR;
} /* end if */
- } /* end while */
+ } /* end while */
HDfclose(returnfile);
HDunlink(waitfor);
@@ -1888,63 +1879,95 @@ error:
* real VFDs.
*/
static H5FD_t *dummy_vfd_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
-static H5FD_t *dummy_vfd_open(const char H5_ATTR_UNUSED *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) { return NULL; }
+static H5FD_t *
+dummy_vfd_open(const char H5_ATTR_UNUSED *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id,
+ haddr_t H5_ATTR_UNUSED maxaddr)
+{
+ return NULL;
+}
static herr_t dummy_vfd_close(H5FD_t *_file);
-static herr_t dummy_vfd_close(H5FD_t H5_ATTR_UNUSED *_file) { return FAIL; }
+static herr_t
+dummy_vfd_close(H5FD_t H5_ATTR_UNUSED *_file)
+{
+ return FAIL;
+}
static haddr_t dummy_vfd_get_eoa(const H5FD_t *file, H5FD_mem_t type);
-static haddr_t dummy_vfd_get_eoa(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; }
+static haddr_t
+dummy_vfd_get_eoa(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type)
+{
+ return HADDR_UNDEF;
+}
static herr_t dummy_vfd_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static herr_t dummy_vfd_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t H5_ATTR_UNUSED addr) { return FAIL; }
+static herr_t
+dummy_vfd_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t H5_ATTR_UNUSED addr)
+{
+ return FAIL;
+}
static haddr_t dummy_vfd_get_eof(const H5FD_t *file, H5FD_mem_t type);
-static haddr_t dummy_vfd_get_eof(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; }
+static haddr_t
+dummy_vfd_get_eof(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type)
+{
+ return HADDR_UNDEF;
+}
-static herr_t dummy_vfd_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf);
-static herr_t dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) { return FAIL; }
+static herr_t dummy_vfd_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size,
+ void *buf);
+static herr_t
+dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id,
+ haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf)
+{
+ return FAIL;
+}
-static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf);
-static herr_t dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { return FAIL; }
+static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size,
+ const void *buf);
+static herr_t
+dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id,
+ haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf)
+{
+ return FAIL;
+}
/* Dummy VFD with the minimum parameters to make a VFD that can be registered */
static const H5FD_class_t H5FD_dummy_g = {
- "dummy", /* name */
- 1, /* maxaddr */
- H5F_CLOSE_WEAK, /* fc_degree */
- NULL, /* terminate */
- NULL, /* sb_size */
- NULL, /* sb_encode */
- NULL, /* sb_decode */
- 0, /* fapl_size */
- NULL, /* fapl_get */
- NULL, /* fapl_copy */
- NULL, /* fapl_free */
- 0, /* dxpl_size */
- NULL, /* dxpl_copy */
- NULL, /* dxpl_free */
- dummy_vfd_open, /* open */
- dummy_vfd_close, /* close */
- NULL, /* cmp */
- NULL, /* query */
- NULL, /* get_type_map */
- NULL, /* alloc */
- NULL, /* free */
- dummy_vfd_get_eoa, /* get_eoa */
- dummy_vfd_set_eoa, /* set_eoa */
- dummy_vfd_get_eof, /* get_eof */
- NULL, /* get_handle */
- dummy_vfd_read, /* read */
- dummy_vfd_write, /* write */
- NULL, /* flush */
- NULL, /* truncate */
- NULL, /* lock */
- NULL, /* unlock */
- H5FD_FLMAP_DICHOTOMY /* fl_map */
+ "dummy", /* name */
+ 1, /* maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
+ NULL, /* terminate */
+ NULL, /* sb_size */
+ NULL, /* sb_encode */
+ NULL, /* sb_decode */
+ 0, /* fapl_size */
+ NULL, /* fapl_get */
+ NULL, /* fapl_copy */
+ NULL, /* fapl_free */
+ 0, /* dxpl_size */
+ NULL, /* dxpl_copy */
+ NULL, /* dxpl_free */
+ dummy_vfd_open, /* open */
+ dummy_vfd_close, /* close */
+ NULL, /* cmp */
+ NULL, /* query */
+ NULL, /* get_type_map */
+ NULL, /* alloc */
+ NULL, /* free */
+ dummy_vfd_get_eoa, /* get_eoa */
+ dummy_vfd_set_eoa, /* set_eoa */
+ dummy_vfd_get_eof, /* get_eof */
+ NULL, /* get_handle */
+ dummy_vfd_read, /* read */
+ dummy_vfd_write, /* write */
+ NULL, /* flush */
+ NULL, /* truncate */
+ NULL, /* lock */
+ NULL, /* unlock */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
-
/*-------------------------------------------------------------------------
* Function: h5_get_dummy_vfd_class()
*
@@ -1968,10 +1991,10 @@ static const H5FD_class_t H5FD_dummy_g = {
H5FD_class_t *
h5_get_dummy_vfd_class(void)
{
- H5FD_class_t *vfd_class = NULL; /* Dummy VFD that will be returned */
+ H5FD_class_t *vfd_class = NULL; /* Dummy VFD that will be returned */
/* Create the class and initialize everything to zero/NULL */
- if(NULL == (vfd_class = (H5FD_class_t *)HDmalloc(sizeof(H5FD_class_t))))
+ if (NULL == (vfd_class = (H5FD_class_t *)HDmalloc(sizeof(H5FD_class_t))))
TEST_ERROR;
/* Copy the dummy VFD */
@@ -1980,7 +2003,7 @@ h5_get_dummy_vfd_class(void)
return vfd_class;
error:
- if(vfd_class)
+ if (vfd_class)
HDfree(vfd_class);
return NULL;
} /* h5_get_dummy_vfd_class */
@@ -2008,10 +2031,10 @@ error:
H5VL_class_t *
h5_get_dummy_vol_class(void)
{
- H5VL_class_t *vol_class = NULL; /* Dummy VOL class that will be returned */
+ H5VL_class_t *vol_class = NULL; /* Dummy VOL class that will be returned */
/* Create the class and initialize everything to zero/NULL */
- if(NULL == (vol_class = (H5VL_class_t *)HDcalloc((size_t)1, sizeof(H5VL_class_t))))
+ if (NULL == (vol_class = (H5VL_class_t *)HDcalloc((size_t)1, sizeof(H5VL_class_t))))
TEST_ERROR;
/* Fill in the minimum parameters to make a VOL connector class that
@@ -2022,7 +2045,7 @@ h5_get_dummy_vol_class(void)
return vol_class;
error:
- if(vol_class)
+ if (vol_class)
HDfree(vol_class);
return NULL;
} /* h5_get_dummy_vol_class */
@@ -2039,7 +2062,7 @@ error:
H5_ATTR_PURE const char *
h5_get_version_string(H5F_libver_t libver)
{
- return(LIBVER_NAMES[libver]);
+ return (LIBVER_NAMES[libver]);
} /* end of h5_get_version_string */
/*-------------------------------------------------------------------------
@@ -2057,14 +2080,14 @@ h5_get_version_string(H5F_libver_t libver)
int
h5_compare_file_bytes(char *f1name, char *f2name)
{
- FILE *f1ptr = NULL; /* two file pointers */
- FILE *f2ptr = NULL;
- off_t f1size = 0; /* size of the files */
- off_t f2size = 0;
- char f1char = 0; /* one char from each file */
- char f2char = 0;
- off_t ii = 0;
- int ret_value = 0; /* for error handling */
+ FILE *f1ptr = NULL; /* two file pointers */
+ FILE *f2ptr = NULL;
+ off_t f1size = 0; /* size of the files */
+ off_t f2size = 0;
+ char f1char = 0; /* one char from each file */
+ char f2char = 0;
+ off_t ii = 0;
+ int ret_value = 0; /* for error handling */
/* Open files for reading */
f1ptr = HDfopen(f1name, "rb");
@@ -2081,10 +2104,10 @@ h5_compare_file_bytes(char *f1name, char *f2name)
}
/* Get the file sizes and verify that they equal */
- HDfseek(f1ptr , 0 , SEEK_END);
+ HDfseek(f1ptr, 0, SEEK_END);
f1size = HDftell(f1ptr);
- HDfseek(f2ptr , 0 , SEEK_END);
+ HDfseek(f2ptr, 0, SEEK_END);
f2size = HDftell(f2ptr);
if (f1size != f2size) {
@@ -2097,11 +2120,11 @@ h5_compare_file_bytes(char *f1name, char *f2name)
HDrewind(f1ptr);
HDrewind(f2ptr);
for (ii = 0; ii < f1size; ii++) {
- if(HDfread(&f1char, 1, 1, f1ptr) != 1) {
+ if (HDfread(&f1char, 1, 1, f1ptr) != 1) {
ret_value = -1;
goto done;
}
- if(HDfread(&f2char, 1, 1, f2ptr) != 1) {
+ if (HDfread(&f2char, 1, 1, f2ptr) != 1) {
ret_value = -1;
goto done;
}
@@ -2129,21 +2152,22 @@ done:
*
*-------------------------------------------------------------------------
*/
-const char *H5_get_srcdir_filename(const char *filename)
+const char *
+H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = H5_get_srcdir();
/* Check for error */
- if(NULL == srcdir)
- return(NULL);
+ if (NULL == srcdir)
+ return (NULL);
else {
/* Build path to test file */
- if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) {
+ if ((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) {
HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename);
- return(srcdir_testpath);
+ return (srcdir_testpath);
} /* end if */
else
- return(NULL);
+ return (NULL);
} /* end else */
} /* end H5_get_srcdir_filename() */
@@ -2156,21 +2180,22 @@ const char *H5_get_srcdir_filename(const char *filename)
*
*-------------------------------------------------------------------------
*/
-const char *H5_get_srcdir(void)
+const char *
+H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
- if(NULL == srcdir)
+ if (NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
- if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
+ if ((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir);
- return(srcdir_path);
+ return (srcdir_path);
} /* end if */
else
- return(NULL);
+ return (NULL);
} /* end H5_get_srcdir() */
/*-------------------------------------------------------------------------
@@ -2190,13 +2215,13 @@ const char *H5_get_srcdir(void)
int
h5_duplicate_file_by_bytes(const char *orig, const char *dest)
{
- FILE *orig_ptr = NULL;
- FILE *dest_ptr = NULL;
- hsize_t fsize = 0;
+ FILE * orig_ptr = NULL;
+ FILE * dest_ptr = NULL;
+ hsize_t fsize = 0;
hsize_t read_size = 0;
- hsize_t max_buf = 0;
- void *dup_buf = NULL;
- int ret_value = 0;
+ hsize_t max_buf = 0;
+ void * dup_buf = NULL;
+ int ret_value = 0;
max_buf = 4096 * sizeof(char);
@@ -2206,7 +2231,7 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest)
goto done;
}
- HDfseek(orig_ptr , 0 , SEEK_END);
+ HDfseek(orig_ptr, 0, SEEK_END);
fsize = (hsize_t)HDftell(orig_ptr);
HDrewind(orig_ptr);
@@ -2217,7 +2242,7 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest)
}
read_size = MIN(fsize, max_buf);
- dup_buf = HDmalloc(read_size);
+ dup_buf = HDmalloc(read_size);
if (NULL == dup_buf) {
ret_value = -1;
goto done;
@@ -2258,17 +2283,17 @@ herr_t
h5_check_if_file_locking_enabled(hbool_t *is_enabled)
{
const char *filename = "locking_test_file";
- int pmode = O_RDWR | O_CREAT | O_TRUNC;
- int fd = -1;
+ int pmode = O_RDWR | O_CREAT | O_TRUNC;
+ int fd = -1;
*is_enabled = TRUE;
- if((fd = HDopen(filename, pmode, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd = HDopen(filename, pmode, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
/* Test HDflock() to see if it works */
- if(HDflock(fd, LOCK_EX | LOCK_NB) < 0) {
- if(ENOSYS == errno) {
+ if (HDflock(fd, LOCK_EX | LOCK_NB) < 0) {
+ if (ENOSYS == errno) {
/* When errno is set to ENOSYS, the file system does not support
* locking, so ignore it. This is most frequently used on
* Lustre. If we also want to check for disabled NFS locks
@@ -2276,18 +2301,18 @@ h5_check_if_file_locking_enabled(hbool_t *is_enabled)
* default here since that could also represent an actual
* error condition.
*/
- errno = 0;
+ errno = 0;
*is_enabled = FALSE;
}
else
goto error;
}
- if(HDflock(fd, LOCK_UN) < 0)
+ if (HDflock(fd, LOCK_UN) < 0)
goto error;
- if(HDclose(fd) < 0)
+ if (HDclose(fd) < 0)
goto error;
- if(HDremove(filename) < 0)
+ if (HDremove(filename) < 0)
goto error;
return SUCCEED;
@@ -2300,4 +2325,3 @@ error:
}
return FAIL;
} /* end h5_check_if_file_locking_enabled() */
-
diff --git a/test/h5test.h b/test/h5test.h
index 22047e1..66929cd 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -49,11 +49,11 @@
* 8
* 9 High: Highest level. All information.
*/
-#define VERBO_NONE 0 /* None */
-#define VERBO_DEF 3 /* Default */
-#define VERBO_LO 5 /* Low */
-#define VERBO_MED 7 /* Medium */
-#define VERBO_HI 9 /* High */
+#define VERBO_NONE 0 /* None */
+#define VERBO_DEF 3 /* Default */
+#define VERBO_LO 5 /* Low */
+#define VERBO_MED 7 /* Medium */
+#define VERBO_HI 9 /* High */
/*
* Verbose queries
@@ -64,18 +64,18 @@
/* Should be used internally by the libtest.a only. */
#define HDGetTestVerbosity() (TestVerbosity)
-#define VERBOSE_NONE (HDGetTestVerbosity()==VERBO_NONE)
-#define VERBOSE_DEF (HDGetTestVerbosity()>=VERBO_DEF)
-#define VERBOSE_LO (HDGetTestVerbosity()>=VERBO_LO)
-#define VERBOSE_MED (HDGetTestVerbosity()>=VERBO_MED)
-#define VERBOSE_HI (HDGetTestVerbosity()>=VERBO_HI)
+#define VERBOSE_NONE (HDGetTestVerbosity() == VERBO_NONE)
+#define VERBOSE_DEF (HDGetTestVerbosity() >= VERBO_DEF)
+#define VERBOSE_LO (HDGetTestVerbosity() >= VERBO_LO)
+#define VERBOSE_MED (HDGetTestVerbosity() >= VERBO_MED)
+#define VERBOSE_HI (HDGetTestVerbosity() >= VERBO_HI)
/*
* Test controls definitions.
*/
-#define SKIPTEST 1 /* Skip this test */
-#define ONLYTEST 2 /* Do only this test */
-#define BEGINTEST 3 /* Skip all tests before this test */
+#define SKIPTEST 1 /* Skip this test */
+#define ONLYTEST 2 /* Do only this test */
+#define BEGINTEST 3 /* Skip all tests before this test */
/*
* This contains the filename prefix specified as command line option for
@@ -83,14 +83,13 @@
*/
H5TEST_DLLVAR char *paraprefix;
#ifdef H5_HAVE_PARALLEL
-H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
+H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#endif
/*
* Print the current location on the standard output stream.
*/
-#define AT() HDprintf (" at %s:%d in %s()...\n", \
- __FILE__, __LINE__, FUNC);
+#define AT() HDprintf(" at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
/*
* The name of the test is printed by saying TESTING("something") which will
@@ -101,29 +100,78 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
* spaces. If the h5_errors() is used for automatic error handling then
* the H5_FAILED() macro is invoked automatically when an API function fails.
*/
-#define TESTING(WHAT) {HDprintf("Testing %-62s",WHAT); HDfflush(stdout);}
-#define TESTING_2(WHAT) {HDprintf(" Testing %-60s",WHAT); HDfflush(stdout);}
-#define PASSED() do {HDputs(" PASSED");HDfflush(stdout);} while (0)
-#define H5_FAILED() {HDputs("*FAILED*");HDfflush(stdout);}
-#define H5_WARNING() {HDputs("*WARNING*");HDfflush(stdout);}
-#define SKIPPED() {HDputs(" -SKIP-");HDfflush(stdout);}
-#define PUTS_ERROR(s) {HDputs(s); AT(); goto error;}
-#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
-#define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;}
-#define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \
- goto error;}
-#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); HDputs(s); goto error;}
+#define TESTING(WHAT) \
+ { \
+ HDprintf("Testing %-62s", WHAT); \
+ HDfflush(stdout); \
+ }
+#define TESTING_2(WHAT) \
+ { \
+ HDprintf(" Testing %-60s", WHAT); \
+ HDfflush(stdout); \
+ }
+#define PASSED() \
+ do { \
+ HDputs(" PASSED"); \
+ HDfflush(stdout); \
+ } while (0)
+#define H5_FAILED() \
+ { \
+ HDputs("*FAILED*"); \
+ HDfflush(stdout); \
+ }
+#define H5_WARNING() \
+ { \
+ HDputs("*WARNING*"); \
+ HDfflush(stdout); \
+ }
+#define SKIPPED() \
+ { \
+ HDputs(" -SKIP-"); \
+ HDfflush(stdout); \
+ }
+#define PUTS_ERROR(s) \
+ { \
+ HDputs(s); \
+ AT(); \
+ goto error; \
+ }
+#define TEST_ERROR \
+ { \
+ H5_FAILED(); \
+ AT(); \
+ goto error; \
+ }
+#define STACK_ERROR \
+ { \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ goto error; \
+ }
+#define FAIL_STACK_ERROR \
+ { \
+ H5_FAILED(); \
+ AT(); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ goto error; \
+ }
+#define FAIL_PUTS_ERROR(s) \
+ { \
+ H5_FAILED(); \
+ AT(); \
+ HDputs(s); \
+ goto error; \
+ }
/*
* Alarm definitions to wait up (terminate) a test that runs too long.
*/
-#define H5_ALARM_SEC 1200 /* default is 20 minutes */
-#define ALARM_ON TestAlarmOn()
-#define ALARM_OFF HDalarm(0)
+#define H5_ALARM_SEC 1200 /* default is 20 minutes */
+#define ALARM_ON TestAlarmOn()
+#define ALARM_OFF HDalarm(0)
/* Flags for h5_fileaccess_flags() */
-#define H5_FILEACCESS_VFD 0x01
-#define H5_FILEACCESS_LIBVER 0x02
+#define H5_FILEACCESS_VFD 0x01
+#define H5_FILEACCESS_LIBVER 0x02
/* Macros to create and fill 2D arrays with a single heap allocation.
* These can be used to replace large stack and global arrays which raise
@@ -151,67 +199,66 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
*
* HDfree(array);
*/
-#define H5TEST_ALLOCATE_2D_ARRAY(ARR, TYPE, DIMS_I, DIMS_J) \
-do { \
- /* Prefix with h5taa to avoid shadow warnings */ \
- size_t h5taa_pointers_size = 0; \
- size_t h5taa_data_size = 0; \
- int h5taa_i; \
- \
- h5taa_pointers_size = (DIMS_I) * sizeof(TYPE *); \
- h5taa_data_size = (DIMS_I) * (DIMS_J) * sizeof(TYPE); \
- \
- ARR = (TYPE **)HDmalloc(h5taa_pointers_size + h5taa_data_size); \
- \
- ARR[0] = (TYPE *)(ARR + (DIMS_I)); \
- \
- for (h5taa_i = 1; h5taa_i < (DIMS_I); h5taa_i++) \
- ARR[h5taa_i] = ARR[h5taa_i-1] + (DIMS_J); \
-} while(0)
-
-#define H5TEST_FILL_2D_ARRAY(ARR, TYPE, DIMS_I, DIMS_J) \
-do { \
- /* Prefix with h5tfa to avoid shadow warnings */ \
- int h5tfa_i = 0; \
- int h5tfa_j = 0; \
- TYPE h5tfa_count = 0; \
- \
- for (h5tfa_i = 0; h5tfa_i < (DIMS_I); h5tfa_i++) \
- for (h5tfa_j = 0; h5tfa_j < (DIMS_J); h5tfa_j++) { \
- ARR[h5tfa_i][h5tfa_j] = h5tfa_count; \
- h5tfa_count++; \
- } \
-} while(0)
+#define H5TEST_ALLOCATE_2D_ARRAY(ARR, TYPE, DIMS_I, DIMS_J) \
+ do { \
+ /* Prefix with h5taa to avoid shadow warnings */ \
+ size_t h5taa_pointers_size = 0; \
+ size_t h5taa_data_size = 0; \
+ int h5taa_i; \
+ \
+ h5taa_pointers_size = (DIMS_I) * sizeof(TYPE *); \
+ h5taa_data_size = (DIMS_I) * (DIMS_J) * sizeof(TYPE); \
+ \
+ ARR = (TYPE **)HDmalloc(h5taa_pointers_size + h5taa_data_size); \
+ \
+ ARR[0] = (TYPE *)(ARR + (DIMS_I)); \
+ \
+ for (h5taa_i = 1; h5taa_i < (DIMS_I); h5taa_i++) \
+ ARR[h5taa_i] = ARR[h5taa_i - 1] + (DIMS_J); \
+ } while (0)
+#define H5TEST_FILL_2D_ARRAY(ARR, TYPE, DIMS_I, DIMS_J) \
+ do { \
+ /* Prefix with h5tfa to avoid shadow warnings */ \
+ int h5tfa_i = 0; \
+ int h5tfa_j = 0; \
+ TYPE h5tfa_count = 0; \
+ \
+ for (h5tfa_i = 0; h5tfa_i < (DIMS_I); h5tfa_i++) \
+ for (h5tfa_j = 0; h5tfa_j < (DIMS_J); h5tfa_j++) { \
+ ARR[h5tfa_i][h5tfa_j] = h5tfa_count; \
+ h5tfa_count++; \
+ } \
+ } while (0)
#ifdef __cplusplus
extern "C" {
#endif
/* Generally useful testing routines */
-H5TEST_DLL void h5_clean_files(const char *base_name[], hid_t fapl);
-H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl);
-H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size);
-H5TEST_DLL char *h5_fixname_superblock(const char *base_name, hid_t fapl, char *fullname, size_t size);
-H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size);
-H5TEST_DLL char *h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size);
-H5TEST_DLL hid_t h5_fileaccess(void);
-H5TEST_DLL hid_t h5_fileaccess_flags(unsigned flags);
-H5TEST_DLL void h5_no_hwconv(void);
+H5TEST_DLL void h5_clean_files(const char *base_name[], hid_t fapl);
+H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl);
+H5TEST_DLL char * h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size);
+H5TEST_DLL char * h5_fixname_superblock(const char *base_name, hid_t fapl, char *fullname, size_t size);
+H5TEST_DLL char * h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size);
+H5TEST_DLL char * h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size);
+H5TEST_DLL hid_t h5_fileaccess(void);
+H5TEST_DLL hid_t h5_fileaccess_flags(unsigned flags);
+H5TEST_DLL void h5_no_hwconv(void);
H5TEST_DLL const char *h5_rmprefix(const char *filename);
-H5TEST_DLL void h5_reset(void);
-H5TEST_DLL void h5_restore_err(void);
-H5TEST_DLL void h5_show_hostname(void);
+H5TEST_DLL void h5_reset(void);
+H5TEST_DLL void h5_restore_err(void);
+H5TEST_DLL void h5_show_hostname(void);
H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl);
-H5TEST_DLL int print_func(const char *format, ...);
-H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name);
-H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl);
+H5TEST_DLL int print_func(const char *format, ...);
+H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name);
+H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl);
H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void);
H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void);
-H5TEST_DLL const char *h5_get_version_string(H5F_libver_t libver);
-H5TEST_DLL int h5_compare_file_bytes(char *fname1, char *fname2);
-H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const char *dest);
-H5TEST_DLL herr_t h5_check_if_file_locking_enabled(hbool_t *are_enabled);
+H5TEST_DLL const char * h5_get_version_string(H5F_libver_t libver);
+H5TEST_DLL int h5_compare_file_bytes(char *fname1, char *fname2);
+H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const char *dest);
+H5TEST_DLL herr_t h5_check_if_file_locking_enabled(hbool_t *are_enabled);
/* Functions that will replace components of a FAPL */
H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id);
@@ -228,47 +275,47 @@ H5TEST_DLL void h5_test_init(void);
H5TEST_DLL void h5_test_shutdown(void);
/* Routines for operating on the list of tests (for the "all in one" tests) */
-H5TEST_DLL void TestUsage(void);
-H5TEST_DLL void AddTest(const char *TheName, void (*TheCall) (void),
- void (*Cleanup) (void), const char *TheDescr,
- const void *Parameters);
-H5TEST_DLL void TestInfo(const char *ProgName);
-H5TEST_DLL void TestParseCmdLine(int argc, char *argv[]);
-H5TEST_DLL void PerformTests(void);
-H5TEST_DLL void TestSummary(void);
-H5TEST_DLL void TestCleanup(void);
-H5TEST_DLL void TestShutdown(void);
-H5TEST_DLL void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]));
-H5TEST_DLL int GetTestVerbosity(void);
-H5TEST_DLL int SetTestVerbosity(int newval);
-H5TEST_DLL int GetTestSummary(void);
-H5TEST_DLL int GetTestCleanup(void);
-H5TEST_DLL int SetTestNoCleanup(void);
-H5TEST_DLL int GetTestExpress(void);
-H5TEST_DLL int SetTestExpress(int newval);
-H5TEST_DLL void ParseTestVerbosity(char *argv);
-H5TEST_DLL int GetTestNumErrs(void);
-H5TEST_DLL void IncTestNumErrs(void);
+H5TEST_DLL void TestUsage(void);
+H5TEST_DLL void AddTest(const char *TheName, void (*TheCall)(void), void (*Cleanup)(void),
+ const char *TheDescr, const void *Parameters);
+H5TEST_DLL void TestInfo(const char *ProgName);
+H5TEST_DLL void TestParseCmdLine(int argc, char *argv[]);
+H5TEST_DLL void PerformTests(void);
+H5TEST_DLL void TestSummary(void);
+H5TEST_DLL void TestCleanup(void);
+H5TEST_DLL void TestShutdown(void);
+H5TEST_DLL void TestInit(const char *ProgName, void (*private_usage)(void),
+ int (*private_parser)(int ac, char *av[]));
+H5TEST_DLL int GetTestVerbosity(void);
+H5TEST_DLL int SetTestVerbosity(int newval);
+H5TEST_DLL int GetTestSummary(void);
+H5TEST_DLL int GetTestCleanup(void);
+H5TEST_DLL int SetTestNoCleanup(void);
+H5TEST_DLL int GetTestExpress(void);
+H5TEST_DLL int SetTestExpress(int newval);
+H5TEST_DLL void ParseTestVerbosity(char *argv);
+H5TEST_DLL int GetTestNumErrs(void);
+H5TEST_DLL void IncTestNumErrs(void);
H5TEST_DLL const void *GetTestParameters(void);
-H5TEST_DLL int TestErrPrintf(const char *format, ...) H5_ATTR_FORMAT(printf, 1, 2);
-H5TEST_DLL void SetTest(const char *testname, int action);
-H5TEST_DLL void TestAlarmOn(void);
-H5TEST_DLL void TestAlarmOff(void);
+H5TEST_DLL int TestErrPrintf(const char *format, ...) H5_ATTR_FORMAT(printf, 1, 2);
+H5TEST_DLL void SetTest(const char *testname, int action);
+H5TEST_DLL void TestAlarmOn(void);
+H5TEST_DLL void TestAlarmOff(void);
#ifdef H5_HAVE_FILTER_SZIP
H5TEST_DLL int h5_szip_can_encode(void);
#endif /* H5_HAVE_FILTER_SZIP */
#ifdef H5_HAVE_PARALLEL
-H5TEST_DLL int h5_set_info_object(void);
-H5TEST_DLL void h5_dump_info_object(MPI_Info info);
-H5TEST_DLL char* getenv_all(MPI_Comm comm, int root, const char* name);
+H5TEST_DLL int h5_set_info_object(void);
+H5TEST_DLL void h5_dump_info_object(MPI_Info info);
+H5TEST_DLL char *getenv_all(MPI_Comm comm, int root, const char *name);
#endif
/* Extern global variables */
H5TEST_DLLVAR int TestVerbosity;
-H5TEST_DLL void h5_send_message(const char *file, const char *arg1, const char *arg2);
+H5TEST_DLL void h5_send_message(const char *file, const char *arg1, const char *arg2);
H5TEST_DLL herr_t h5_wait_message(const char *file);
#ifdef __cplusplus
diff --git a/test/hdfs.c b/test/hdfs.c
index 31efa08..ee66314 100644
--- a/test/hdfs.c
+++ b/test/hdfs.c
@@ -23,12 +23,11 @@
* 2018-04-23
*/
-#include "h5test.h" /* testing utilities */
-#include "H5FDhdfs.h" /* this file driver's utilities */
-
+#include "h5test.h" /* testing utilities */
+#include "H5FDhdfs.h" /* this file driver's utilities */
#ifdef H5_HAVE_LIBHDFS
-#define HDFS_TEST_DEBUG 0
+#define HDFS_TEST_DEBUG 0
#define HDFS_TEST_MAX_BUF_SIZE 256
/*****************************************************************************
@@ -74,7 +73,6 @@
*
*****************************************************************************/
-
/*----------------------------------------------------------------------------
*
* ifdef flag: JSVERIFY_EXP_ACT
@@ -86,7 +84,6 @@
*/
#define JSVERIFY_EXP_ACT 1L
-
/*----------------------------------------------------------------------------
*
* Macro: JSFAILED_AT()
@@ -103,11 +100,11 @@
*
*----------------------------------------------------------------------------
*/
-#define JSFAILED_AT() { \
- HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \
-}
+#define JSFAILED_AT() \
+ { \
+ HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \
+ }
-
/*----------------------------------------------------------------------------
*
* Macro: FAIL_IF()
@@ -131,13 +128,12 @@
*
*----------------------------------------------------------------------------
*/
-#define FAIL_IF(condition) \
-if (condition) { \
- JSFAILED_AT() \
- goto error; \
-}
+#define FAIL_IF(condition) \
+ if (condition) { \
+ JSFAILED_AT() \
+ goto error; \
+ }
-
/*----------------------------------------------------------------------------
*
* Macro: FAIL_UNLESS()
@@ -161,14 +157,13 @@ if (condition) { \
*----------------------------------------------------------------------------
*/
#if 0 /* UNUSED */
-#define FAIL_UNLESS(condition) \
-if (!(condition)) { \
- JSFAILED_AT() \
- goto error; \
-}
+#define FAIL_UNLESS(condition) \
+ if (!(condition)) { \
+ JSFAILED_AT() \
+ goto error; \
+ }
#endif /* UNUSED */
-
/*----------------------------------------------------------------------------
*
* Macro: JSERR_LONG()
@@ -194,17 +189,17 @@ if (!(condition)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSERR_LONG(expected, actual, reason) { \
- JSFAILED_AT() \
- if (reason!= NULL) { \
- HDprintf("%s\n", (reason)); \
- } else { \
- HDprintf(" ! Expected %ld\n ! Actual %ld\n", \
- (long)(expected), (long)(actual)); \
- } \
-}
-
-
+#define JSERR_LONG(expected, actual, reason) \
+ { \
+ JSFAILED_AT() \
+ if (reason != NULL) { \
+ HDprintf("%s\n", (reason)); \
+ } \
+ else { \
+ HDprintf(" ! Expected %ld\n ! Actual %ld\n", (long)(expected), (long)(actual)); \
+ } \
+ }
+
/*----------------------------------------------------------------------------
*
* Macro: JSERR_STR()
@@ -233,22 +228,20 @@ if (!(condition)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSERR_STR(expected, actual, reason) { \
- const char *_reason = reason; \
- JSFAILED_AT() \
- if (_reason != NULL) { \
- HDprintf("%s\n", _reason); \
- } else { \
- HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", \
- (expected), (actual)); \
- } \
-}
-
-
+#define JSERR_STR(expected, actual, reason) \
+ { \
+ const char *_reason = reason; \
+ JSFAILED_AT() \
+ if (_reason != NULL) { \
+ HDprintf("%s\n", _reason); \
+ } \
+ else { \
+ HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", (expected), (actual)); \
+ } \
+ }
#ifdef JSVERIFY_EXP_ACT
-
/*----------------------------------------------------------------------------
*
* Macro: JSVERIFY()
@@ -265,13 +258,12 @@ if (!(condition)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY(expected, actual, reason) \
-if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY */
+#define JSVERIFY(expected, actual, reason) \
+ if ((long)(actual) != (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY */
-
/*----------------------------------------------------------------------------
*
* Macro: JSVERIFY_NOT()
@@ -288,13 +280,12 @@ if ((long)(actual) != (long)(expected)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_NOT(expected, actual, reason) \
-if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY_NOT */
+#define JSVERIFY_NOT(expected, actual, reason) \
+ if ((long)(actual) == (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY_NOT */
-
/*----------------------------------------------------------------------------
*
* Macro: JSVERIFY_STR()
@@ -311,12 +302,11 @@ if ((long)(actual) == (long)(expected)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_STR(expected, actual, reason) \
-if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY_STR */
-
+#define JSVERIFY_STR(expected, actual, reason) \
+ if (strcmp((actual), (expected)) != 0) { \
+ JSERR_STR((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY_STR */
#else
/* JSVERIFY_EXP_ACT not defined
@@ -324,7 +314,6 @@ if (strcmp((actual), (expected)) != 0) { \
* Repeats macros above, but with actual/expected parameters reversed.
*/
-
/*----------------------------------------------------------------------------
* Macro: JSVERIFY()
* See: JSVERIFY documentation above.
@@ -332,13 +321,12 @@ if (strcmp((actual), (expected)) != 0) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY(actual, expected, reason) \
-if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY */
+#define JSVERIFY(actual, expected, reason) \
+ if ((long)(actual) != (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY */
-
/*----------------------------------------------------------------------------
* Macro: JSVERIFY_NOT()
* See: JSVERIFY_NOT documentation above.
@@ -346,13 +334,12 @@ if ((long)(actual) != (long)(expected)) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_NOT(actual, expected, reason) \
-if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY_NOT */
+#define JSVERIFY_NOT(actual, expected, reason) \
+ if ((long)(actual) == (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY_NOT */
-
/*----------------------------------------------------------------------------
* Macro: JSVERIFY_STR()
* See: JSVERIFY_STR documentation above.
@@ -360,11 +347,11 @@ if ((long)(actual) == (long)(expected)) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_STR(actual, expected, reason) \
-if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY_STR */
+#define JSVERIFY_STR(actual, expected, reason) \
+ if (strcmp((actual), (expected)) != 0) { \
+ JSERR_STR((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY_STR */
#endif /* ifdef/else JSVERIFY_EXP_ACT */
@@ -373,7 +360,7 @@ if (strcmp((actual), (expected)) != 0) { \
********************************/
/* copied from src/hdfs.c */
-#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
+#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1)
#define HDFS_NAMENODE_NAME_MAX_SIZE 128
@@ -386,13 +373,13 @@ static const char filename_bard[] = "/tmp/t8.shakespeare.txt";
static const char filename_raven[] = "/tmp/Poe_Raven.txt";
static const char filename_example_h5[] = "/tmp/t.h5";
-static H5FD_hdfs_fapl_t default_fa = {
- 1, /* fa version */
- "localhost", /* namenode name */
- 0, /* namenode port */
- "", /* user name */
- "", /* kerberos path */
- 1024, /* buffer size */
+static H5FD_hdfs_fapl_t default_fa = {
+ 1, /* fa version */
+ "localhost", /* namenode name */
+ 0, /* namenode port */
+ "", /* user name */
+ "", /* kerberos path */
+ 1024, /* buffer size */
};
#endif /* H5_HAVE_LIBHDFS */
@@ -400,7 +387,6 @@ static H5FD_hdfs_fapl_t default_fa = {
* TEST FUNCTIONS *
******************/
-
/*---------------------------------------------------------------------------
*
* Function: test_fapl_config_validation()
@@ -442,28 +428,30 @@ test_fapl_config_validation(void)
*************************/
struct testcase {
- const char *msg;
- herr_t expected;
- H5FD_hdfs_fapl_t config;
+ const char * msg;
+ herr_t expected;
+ H5FD_hdfs_fapl_t config;
};
/************************
* test-local variables *
************************/
- hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id = -1; /* file access property list ID */
H5FD_hdfs_fapl_t config;
H5FD_hdfs_fapl_t fa_fetch;
- herr_t success = SUCCEED;
- unsigned int i = 0;
- unsigned int ncases = 6; /* should equal number of cases */
- struct testcase *case_ptr = NULL; /* dumb work-around for possible */
- /* dynamic cases creation because */
- /* of compiler warnings Wlarger-than */
- struct testcase cases_arr[] = {
- { "default config fapl",
+ herr_t success = SUCCEED;
+ unsigned int i = 0;
+ unsigned int ncases = 6; /* should equal number of cases */
+ struct testcase *case_ptr = NULL; /* dumb work-around for possible */
+ /* dynamic cases creation because */
+ /* of compiler warnings Wlarger-than */
+ struct testcase cases_arr[] = {
+ {
+ "default config fapl",
SUCCEED,
- { 1, /* version */
+ {
+ 1, /* version */
"localhost", /* namenode_name */
0, /* namenode_port number */
"some_user", /* user_name */
@@ -471,9 +459,11 @@ test_fapl_config_validation(void)
-1, /* stream_buffer_size */
},
},
- { "invalid version number (2)",
+ {
+ "invalid version number (2)",
FAIL,
- { 2, /* version */
+ {
+ 2, /* version */
"localhost", /* namenode_name */
0, /* namenode_port number */
"some_user", /* user_name */
@@ -481,9 +471,11 @@ test_fapl_config_validation(void)
-1, /* stream_buffer_size */
},
},
- { "invalid version number (0)",
+ {
+ "invalid version number (0)",
FAIL,
- { 0, /* version */
+ {
+ 0, /* version */
"localhost", /* namenode_name */
0, /* namenode_port number */
"some_user", /* user_name */
@@ -491,19 +483,23 @@ test_fapl_config_validation(void)
-1, /* stream_buffer_size */
},
},
- { "nonsense kerberos path still ok?",
+ {
+ "nonsense kerberos path still ok?",
SUCCEED,
- { 1, /* version */
- "localhost", /* namenode_name */
- 0, /* namenode_port number */
- "some_user", /* user_name */
+ {
+ 1, /* version */
+ "localhost", /* namenode_name */
+ 0, /* namenode_port number */
+ "some_user", /* user_name */
"pathToSomewhere", /* kerberos_ticket_cache path */
- -1, /* stream_buffer_size */
+ -1, /* stream_buffer_size */
},
},
- { "namenode port number too high",
+ {
+ "namenode port number too high",
FAIL,
- { 1, /* version */
+ {
+ 1, /* version */
"localhost", /* namenode_name */
88000, /* namenode_port number */
"some_user", /* user_name */
@@ -511,9 +507,11 @@ test_fapl_config_validation(void)
-1, /* stream_buffer_size */
},
},
- { "negative namenode port number",
+ {
+ "negative namenode port number",
FAIL,
- { 1, /* version */
+ {
+ 1, /* version */
"localhost", /* namenode_name */
-1, /* namenode_port number */
"some_user", /* user_name */
@@ -536,60 +534,46 @@ test_fapl_config_validation(void)
*---------------
*/
case_ptr = &cases_arr[i];
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 ) /* sanity-check */
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ FAIL_IF(fapl_id < 0) /* sanity-check */
/*-----------------------------------
* Actually test -- set fapl.
* Mute stack trace in failure cases.
*-----------------------------------
*/
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* `H5FD_hdfs_validate_config(...)` is static/private
* to src/hdfs.c and cannot (and should not?) be tested directly?
* Instead, validate config through public api.
*/
success = H5Pset_fapl_hdfs(fapl_id, &case_ptr->config);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- JSVERIFY( case_ptr->expected, success, case_ptr->msg )
+ JSVERIFY(case_ptr->expected, success, case_ptr->msg)
/* Make sure we can get back what we put in.
* Only valid if the fapl configuration does not result in error.
*/
if (success == SUCCEED) {
config = case_ptr->config;
- JSVERIFY( SUCCEED,
- H5Pget_fapl_hdfs(fapl_id, &fa_fetch),
- "unable to get fapl" )
- JSVERIFY( H5FD__CURR_HDFS_FAPL_T_VERSION,
- fa_fetch.version,
- "invalid version number" )
- JSVERIFY( config.version,
- fa_fetch.version,
- "version number mismatch" )
- JSVERIFY( config.namenode_port,
- fa_fetch.namenode_port,
- "namenode port mismatch" )
- JSVERIFY( config.stream_buffer_size,
- fa_fetch.stream_buffer_size,
- "streambuffer size mismatch" )
- JSVERIFY_STR( config.namenode_name,
- fa_fetch.namenode_name,
- NULL )
- JSVERIFY_STR( config.user_name,
- fa_fetch.user_name,
- NULL )
- JSVERIFY_STR( config.kerberos_ticket_cache,
- fa_fetch.kerberos_ticket_cache,
- NULL )
+ JSVERIFY(SUCCEED, H5Pget_fapl_hdfs(fapl_id, &fa_fetch), "unable to get fapl")
+ JSVERIFY(H5FD__CURR_HDFS_FAPL_T_VERSION, fa_fetch.version, "invalid version number")
+ JSVERIFY(config.version, fa_fetch.version, "version number mismatch")
+ JSVERIFY(config.namenode_port, fa_fetch.namenode_port, "namenode port mismatch")
+ JSVERIFY(config.stream_buffer_size, fa_fetch.stream_buffer_size, "streambuffer size mismatch")
+ JSVERIFY_STR(config.namenode_name, fa_fetch.namenode_name, NULL)
+ JSVERIFY_STR(config.user_name, fa_fetch.user_name, NULL)
+ JSVERIFY_STR(config.kerberos_ticket_cache, fa_fetch.kerberos_ticket_cache, NULL)
}
/*-----------------------------
* per-test sanitation/teardown
*-----------------------------
*/
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
} /* for each test case */
@@ -603,16 +587,14 @@ error:
***********/
if (fapl_id < 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
#endif /* H5_HAVE_LIBHDFS */
} /* end test_fapl_config_validation() */
-
/*-------------------------------------------------------------------------
*
* Function: test_hdfs_fapl()
@@ -647,10 +629,10 @@ test_hdfs_fapl(void)
* test-local variables *
************************/
- hid_t fapl_id = -1; /* file access property list ID */
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- H5FD_hdfs_fapl_t hdfs_fa_0 = {
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ H5FD_hdfs_fapl_t hdfs_fa_0 = {
1, /* version*/
"", /* node name */
9000, /* node port */
@@ -664,41 +646,38 @@ test_hdfs_fapl(void)
/* Set property list and file name for HDFS driver.
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
+ FAIL_IF(fapl_id < 0)
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &hdfs_fa_0) )
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &hdfs_fa_0))
driver_id = H5Pget_driver(fapl_id);
- FAIL_IF( driver_id < 0 )
+ FAIL_IF(driver_id < 0)
/****************
* Check that the VFD feature flags are correct
* SPEC MAY CHANGE
******************/
- FAIL_IF( H5FDdriver_query(driver_id, &driver_flags) < 0 )
+ FAIL_IF(H5FDdriver_query(driver_id, &driver_flags) < 0)
- JSVERIFY_NOT( 0, (driver_flags & H5FD_FEAT_DATA_SIEVE),
- "bit(s) in `driver_flags` must align with "
- "H5FD_FEAT_DATA_SIEVE" )
+ JSVERIFY_NOT(0, (driver_flags & H5FD_FEAT_DATA_SIEVE),
+ "bit(s) in `driver_flags` must align with "
+ "H5FD_FEAT_DATA_SIEVE")
- JSVERIFY( H5FD_FEAT_DATA_SIEVE, driver_flags,
- "H5FD_FEAT_DATA_SIEVE should be the only supported flag")
+ JSVERIFY(H5FD_FEAT_DATA_SIEVE, driver_flags, "H5FD_FEAT_DATA_SIEVE should be the only supported flag")
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
return 1;
#endif /* H5_HAVE_LIBHDFS */
} /* end test_hdfs_fapl() */
-
/*---------------------------------------------------------------------------
*
* Function: test_vfd_open()
@@ -746,10 +725,10 @@ test_vfd_open(void)
struct test_condition {
const char *message;
const char *url;
- unsigned flags;
- int which_fapl;
- haddr_t maxaddr;
- hbool_t might_use_other_driver;
+ unsigned flags;
+ int which_fapl;
+ haddr_t maxaddr;
+ hbool_t might_use_other_driver;
};
/************************
@@ -757,70 +736,80 @@ test_vfd_open(void)
************************/
struct test_condition failing_conditions[] = {
- { "default property list (H5P_DEFAULT) is invalid",
+ {
+ "default property list (H5P_DEFAULT) is invalid",
filename_bard,
H5F_ACC_RDONLY,
FAPL_H5P_DEFAULT,
MAXADDR,
TRUE,
},
- { "generic file access property list is invalid",
+ {
+ "generic file access property list is invalid",
filename_bard,
H5F_ACC_RDONLY,
FAPL_UNCONFIGURED,
MAXADDR,
TRUE,
},
- { "filename cannot be null",
+ {
+ "filename cannot be null",
NULL,
H5F_ACC_RDONLY,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "filename cannot be empty",
+ {
+ "filename cannot be empty",
"",
H5F_ACC_RDONLY,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "file at filename must exist",
+ {
+ "file at filename must exist",
filename_missing,
H5F_ACC_RDONLY,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "read-write flag not supported",
+ {
+ "read-write flag not supported",
filename_bard,
H5F_ACC_RDWR,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "truncate flag not supported",
+ {
+ "truncate flag not supported",
filename_bard,
H5F_ACC_TRUNC,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "create flag not supported",
+ {
+ "create flag not supported",
filename_bard,
H5F_ACC_CREAT,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "EXCL flag not supported",
+ {
+ "EXCL flag not supported",
filename_bard,
H5F_ACC_EXCL,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "maxaddr cannot be 0 (caught in `H5FD_open()`)",
+ {
+ "maxaddr cannot be 0 (caught in `H5FD_open()`)",
filename_bard,
H5F_ACC_RDONLY,
FAPL_HDFS,
@@ -828,20 +817,20 @@ test_vfd_open(void)
FALSE,
},
};
- unsigned i = 0;
- unsigned failing_conditions_count = 10;
- H5FD_t *fd = NULL;
- hid_t fapl_hdfs = -1;
- hid_t fapl_unconfigured = -1;
+ unsigned i = 0;
+ unsigned failing_conditions_count = 10;
+ H5FD_t *fd = NULL;
+ hid_t fapl_hdfs = -1;
+ hid_t fapl_unconfigured = -1;
TESTING("HDFS VFD-level open");
fapl_unconfigured = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_unconfigured < 0 )
+ FAIL_IF(fapl_unconfigured < 0)
fapl_hdfs = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_hdfs < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_hdfs, &default_fa) )
+ FAIL_IF(fapl_hdfs < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_hdfs, &default_fa))
/*********
* TESTS *
@@ -850,16 +839,15 @@ test_vfd_open(void)
/* all the test cases that will _not_ open
*/
for (i = 0; i < failing_conditions_count; i++) {
- struct test_condition T = failing_conditions[i];
- hid_t fapl_id = H5P_DEFAULT;
+ struct test_condition T = failing_conditions[i];
+ hid_t fapl_id = H5P_DEFAULT;
fd = NULL;
if (T.which_fapl == FAPL_UNCONFIGURED) {
fapl_id = fapl_unconfigured;
}
- else
- if (T.which_fapl == FAPL_HDFS) {
+ else if (T.which_fapl == FAPL_HDFS) {
fapl_id = fapl_hdfs;
}
@@ -867,18 +855,14 @@ test_vfd_open(void)
HDfprintf(stderr, "testing: %s\n", T.message);
#endif /* HDFS_TEST_DEBUG */
- H5E_BEGIN_TRY {
- fd = H5FDopen(T.url, T.flags, fapl_id, T.maxaddr);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fd = H5FDopen(T.url, T.flags, fapl_id, T.maxaddr); }
+ H5E_END_TRY;
if (NULL != fd) {
- if (TRUE == T.might_use_other_driver &&
- H5FD_HDFS != fd->driver_id)
- {
- HDfprintf(stderr, "\n!!!!! WARNING !!!!!\n" \
- " Successful open of file on local system " \
- "with non-HDFS VFD.\n");
- JSVERIFY(SUCCEED, H5FDclose(fd),
- "unable to close errant open");
+ if (TRUE == T.might_use_other_driver && H5FD_HDFS != fd->driver_id) {
+ HDfprintf(stderr, "\n!!!!! WARNING !!!!!\n"
+ " Successful open of file on local system "
+ "with non-HDFS VFD.\n");
+ JSVERIFY(SUCCEED, H5FDclose(fd), "unable to close errant open");
fd = NULL;
}
else {
@@ -887,36 +871,32 @@ test_vfd_open(void)
}
}
- FAIL_IF( NULL != fd ) /* sanity check */
+ FAIL_IF(NULL != fd) /* sanity check */
#if HDFS_TEST_DEBUG
- HDfprintf(stderr, "nominal open\n");
+ HDfprintf(stderr, "nominal open\n");
#endif /* HDFS_TEST_DEBUG */
/* finally, show that a file can be opened
*/
- fd = H5FDopen(
- filename_bard,
- H5F_ACC_RDONLY,
- fapl_hdfs,
- MAXADDR);
- FAIL_IF( NULL == fd )
+ fd = H5FDopen(filename_bard, H5F_ACC_RDONLY, fapl_hdfs, MAXADDR);
+ FAIL_IF(NULL == fd)
/************
* TEARDOWN *
************/
#if HDFS_TEST_DEBUG
- HDfprintf(stderr, "teardown...\n");
+ HDfprintf(stderr, "teardown...\n");
#endif /* HDFS_TEST_DEBUG */
- FAIL_IF( FAIL == H5FDclose(fd) )
+ FAIL_IF(FAIL == H5FDclose(fd))
fd = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_hdfs) )
+ FAIL_IF(FAIL == H5Pclose(fapl_hdfs))
fapl_hdfs = -1;
- FAIL_IF( FAIL == H5Pclose(fapl_unconfigured) )
+ FAIL_IF(FAIL == H5Pclose(fapl_unconfigured))
fapl_unconfigured = -1;
PASSED();
@@ -931,14 +911,16 @@ error:
if (fd) {
(void)H5FDclose(fd);
}
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
if (fapl_hdfs >= 0) {
(void)H5Pclose(fapl_hdfs);
}
if (fapl_unconfigured >= 0) {
(void)H5Pclose(fapl_unconfigured);
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
@@ -950,7 +932,6 @@ error:
} /* end test_vfd_open() */
-
/*---------------------------------------------------------------------------
*
* Function: test_eof_eoa()
@@ -993,8 +974,8 @@ test_eof_eoa(void)
* test-local variables *
************************/
- H5FD_t *fd_shakespeare = NULL;
- hid_t fapl_id = -1;
+ H5FD_t *fd_shakespeare = NULL;
+ hid_t fapl_id = -1;
TESTING("HDFS eof/eoa gets and sets");
@@ -1003,15 +984,11 @@ test_eof_eoa(void)
*********/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( 0 > fapl_id )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(0 > fapl_id)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
- fd_shakespeare = H5FDopen(
- filename_bard,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == fd_shakespeare )
+ fd_shakespeare = H5FDopen(filename_bard, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
+ FAIL_IF(NULL == fd_shakespeare)
/*********
* TESTS *
@@ -1019,46 +996,31 @@ test_eof_eoa(void)
/* verify as found
*/
- JSVERIFY( 5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL )
- JSVERIFY( H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
- "mismatch between DEFAULT and RAW memory types" )
- JSVERIFY( 0,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoA should be unset by H5FDopen" )
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL)
+ JSVERIFY(H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
+ "mismatch between DEFAULT and RAW memory types")
+ JSVERIFY(0, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA should be unset by H5FDopen")
/* set EoA below EoF
*/
- JSVERIFY( SUCCEED,
- H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202),
- "unable to set EoA (lower)" )
- JSVERIFY( 5458199,
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoF changed" )
- JSVERIFY( 44442202,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoA unchanged" )
+ JSVERIFY(SUCCEED, H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202), "unable to set EoA (lower)")
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed")
+ JSVERIFY(44442202, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA unchanged")
/* set EoA above EoF
*/
- JSVERIFY( SUCCEED,
- H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012),
- "unable to set EoA (higher)" )
- JSVERIFY( 5458199,
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoF changed" )
- JSVERIFY( 6789012,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoA unchanged" )
+ JSVERIFY(SUCCEED, H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012), "unable to set EoA (higher)")
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed")
+ JSVERIFY(6789012, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA unchanged")
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(fd_shakespeare) )
+ FAIL_IF(FAIL == H5FDclose(fd_shakespeare))
fd_shakespeare = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1074,9 +1036,8 @@ error:
(void)H5FDclose(fd_shakespeare);
}
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
@@ -1085,7 +1046,6 @@ error:
} /* end test_eof_eoa() */
-
/*-----------------------------------------------------------------------------
*
* Function: test_H5FDread_without_eoa_set_fails()
@@ -1112,10 +1072,10 @@ test_H5FDread_without_eoa_set_fails(void)
#else
- char buffer[HDFS_TEST_MAX_BUF_SIZE];
- unsigned int i = 0;
- H5FD_t *file_shakespeare = NULL;
- hid_t fapl_id = -1;
+ char buffer[HDFS_TEST_MAX_BUF_SIZE];
+ unsigned int i = 0;
+ H5FD_t *file_shakespeare = NULL;
+ hid_t fapl_id = -1;
TESTING("HDFS VFD read-eoa temporal coupling library limitation");
@@ -1126,18 +1086,13 @@ test_H5FDread_without_eoa_set_fails(void)
/* create HDFS fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(fapl_id < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
- file_shakespeare = H5FDopen(
- filename_bard,
- H5F_ACC_RDONLY,
- fapl_id,
- MAXADDR);
- FAIL_IF( NULL == file_shakespeare )
+ file_shakespeare = H5FDopen(filename_bard, H5F_ACC_RDONLY, fapl_id, MAXADDR);
+ FAIL_IF(NULL == file_shakespeare)
- JSVERIFY( 0, H5FDget_eoa(file_shakespeare, H5FD_MEM_DEFAULT),
- "EoA should remain unset by H5FDopen" )
+ JSVERIFY(0, H5FDget_eoa(file_shakespeare, H5FD_MEM_DEFAULT), "EoA should remain unset by H5FDopen")
/* zero buffer contents */
for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) {
@@ -1148,28 +1103,21 @@ test_H5FDread_without_eoa_set_fails(void)
* TEST *
********/
- H5E_BEGIN_TRY { /* mute stack trace on expected failure */
- JSVERIFY( FAIL,
- H5FDread(file_shakespeare,
- H5FD_MEM_DRAW,
- H5P_DEFAULT,
- 1200699,
- 102,
- buffer),
- "cannot read before eoa is set" )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{/* mute stack trace on expected failure */
+ JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer),
+ "cannot read before eoa is set")} H5E_END_TRY;
for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) {
- JSVERIFY( 0, (unsigned)buffer[i], "buffer was modified by write!" )
+ JSVERIFY(0, (unsigned)buffer[i], "buffer was modified by write!")
}
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(file_shakespeare) )
+ FAIL_IF(FAIL == H5FDclose(file_shakespeare))
file_shakespeare = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1185,9 +1133,8 @@ error:
(void)H5FDclose(file_shakespeare);
}
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
@@ -1196,8 +1143,6 @@ error:
} /* end test_H5FDread_without_eoa_set_fails() */
-
-
/*---------------------------------------------------------------------------
*
* Function: test_read()
@@ -1235,10 +1180,10 @@ test_read(void)
*************************/
struct testcase {
const char *message; /* purpose of test case */
- haddr_t eoa_set; /* set file EOA to this prior to read */
- size_t addr; /* offset of read in file */
- size_t len; /* length of read in file */
- herr_t success; /* expected return value of read function */
+ haddr_t eoa_set; /* set file EOA to this prior to read */
+ size_t addr; /* offset of read in file */
+ size_t len; /* length of read in file */
+ herr_t success; /* expected return value of read function */
const char *expected; /* expected contents of buffer; failure ignores */
};
@@ -1246,42 +1191,48 @@ test_read(void)
* test-local variables *
************************/
struct testcase cases[] = {
- { "successful range-get",
+ {
+ "successful range-get",
6464,
5691,
32, /* fancy quotes are three bytes each(?) */
SUCCEED,
"Quoth the Raven “Nevermore.”",
},
- { "read past EOA fails (EOA < EOF < addr)",
+ {
+ "read past EOA fails (EOA < EOF < addr)",
3000,
4000,
100,
FAIL,
NULL,
},
- { "read overlapping EOA fails (EOA < addr < EOF < (addr+len))",
+ {
+ "read overlapping EOA fails (EOA < addr < EOF < (addr+len))",
3000,
8000,
100,
FAIL,
NULL,
},
- { "read past EOA/EOF fails ((EOA==EOF) < addr)",
+ {
+ "read past EOA/EOF fails ((EOA==EOF) < addr)",
6464,
7000,
100,
FAIL,
NULL,
},
- { "read overlapping EOA/EOF fails (addr < (EOA==EOF) < (addr+len))",
+ {
+ "read overlapping EOA/EOF fails (addr < (EOA==EOF) < (addr+len))",
6464,
6400,
100,
FAIL,
NULL,
},
- { "read between EOF and EOA fails (EOF < addr < (addr+len) < EOA)",
+ {
+ "read between EOF and EOA fails (EOF < addr < (addr+len) < EOA)",
8000,
7000,
100,
@@ -1289,14 +1240,14 @@ test_read(void)
NULL,
},
};
- unsigned testcase_count = 6;
- unsigned test_i = 0;
- struct testcase test;
- herr_t open_return = FAIL;
- char buffer[HDFS_TEST_MAX_BUF_SIZE];
- unsigned int i = 0;
- H5FD_t *file_raven = NULL;
- hid_t fapl_id = -1;
+ unsigned testcase_count = 6;
+ unsigned test_i = 0;
+ struct testcase test;
+ herr_t open_return = FAIL;
+ char buffer[HDFS_TEST_MAX_BUF_SIZE];
+ unsigned int i = 0;
+ H5FD_t *file_raven = NULL;
+ hid_t fapl_id = -1;
TESTING("HDFS VFD read/range-gets");
@@ -1307,8 +1258,8 @@ test_read(void)
/* create HDFS fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(fapl_id < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
/* zero buffer contents */
for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) {
@@ -1317,14 +1268,11 @@ test_read(void)
/* open file
*/
- file_raven = H5FDopen(
- filename_raven,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF); /* Demonstrate success with "automatic" value */
- FAIL_IF( NULL == file_raven )
+ file_raven = H5FDopen(filename_raven, H5F_ACC_RDONLY, fapl_id,
+ HADDR_UNDEF); /* Demonstrate success with "automatic" value */
+ FAIL_IF(NULL == file_raven)
- JSVERIFY( 6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL )
+ JSVERIFY(6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL)
/*********
* TESTS *
@@ -1336,13 +1284,12 @@ test_read(void)
* per-test setup *
* -------------- */
- test = cases[test_i];
+ test = cases[test_i];
open_return = FAIL;
- FAIL_IF( HDFS_TEST_MAX_BUF_SIZE < test.len ) /* buffer too small! */
+ FAIL_IF(HDFS_TEST_MAX_BUF_SIZE < test.len) /* buffer too small! */
- FAIL_IF( FAIL ==
- H5FDset_eoa( file_raven, H5FD_MEM_DEFAULT, test.eoa_set) )
+ FAIL_IF(FAIL == H5FDset_eoa(file_raven, H5FD_MEM_DEFAULT, test.eoa_set))
/* zero buffer contents */
for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) {
@@ -1353,22 +1300,16 @@ test_read(void)
* conduct test *
* ------------ */
- H5E_BEGIN_TRY {
- open_return = H5FDread(
- file_raven,
- H5FD_MEM_DRAW,
- H5P_DEFAULT,
- test.addr,
- test.len,
- buffer);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ open_return = H5FDread(file_raven, H5FD_MEM_DRAW, H5P_DEFAULT, test.addr, test.len, buffer);
+ }
+ H5E_END_TRY;
- JSVERIFY( test.success,
- open_return,
- test.message )
+ JSVERIFY(test.success, open_return, test.message)
if (open_return == SUCCEED) {
- JSVERIFY_STR( test.expected, buffer, NULL )
+ JSVERIFY_STR(test.expected, buffer, NULL)
}
} /* for each testcase */
@@ -1377,10 +1318,10 @@ test_read(void)
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(file_raven) )
+ FAIL_IF(FAIL == H5FDclose(file_raven))
file_raven = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1392,13 +1333,12 @@ error:
* CLEANUP *
***********/
- if (file_raven != 0) {
+ if (file_raven != 0) {
(void)H5FDclose(file_raven);
}
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
@@ -1407,7 +1347,6 @@ error:
} /* end test_read() */
-
/*---------------------------------------------------------------------------
*
* Function: test_noops_and_autofails()
@@ -1455,9 +1394,9 @@ test_noops_and_autofails(void)
* test-local variables *
************************/
- hid_t fapl_id = -1;
- H5FD_t *file = NULL;
- const char data[36] = "The Force shall be with you, always";
+ hid_t fapl_id = -1;
+ H5FD_t *file = NULL;
+ const char data[36] = "The Force shall be with you, always";
TESTING("HDFS VFD always-fail and no-op routines");
@@ -1468,17 +1407,13 @@ test_noops_and_autofails(void)
/* create HDFS fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(fapl_id < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
/* open file
*/
- file = H5FDopen(
- filename_bard,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == file )
+ file = H5FDopen(filename_bard, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
+ FAIL_IF(NULL == file)
/*********
* TESTS *
@@ -1486,35 +1421,19 @@ test_noops_and_autofails(void)
/* auto-fail calls to write and truncate
*/
- H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
- H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data),
- "write must fail" )
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
- H5FDtruncate(file, H5P_DEFAULT, FALSE),
- "truncate must fail" )
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
- H5FDtruncate(file, H5P_DEFAULT, TRUE),
- "truncate must fail (closing)" )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data),
+ "write must fail")} H5E_END_TRY;
+
+ H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, FALSE), "truncate must fail")} H5E_END_TRY;
+
+ H5E_BEGIN_TRY{
+ JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), "truncate must fail (closing)")} H5E_END_TRY;
/* no-op calls to `lock()` and `unlock()`
*/
- JSVERIFY( SUCCEED,
- H5FDlock(file, TRUE),
- "lock always succeeds; has no effect" )
- JSVERIFY( SUCCEED,
- H5FDlock(file, FALSE),
- NULL )
- JSVERIFY( SUCCEED,
- H5FDunlock(file),
- NULL )
+ JSVERIFY(SUCCEED, H5FDlock(file, TRUE), "lock always succeeds; has no effect")
+ JSVERIFY(SUCCEED, H5FDlock(file, FALSE), NULL)
+ JSVERIFY(SUCCEED, H5FDunlock(file), NULL)
/* Lock/unlock with null file or similar error crashes tests.
* HDassert in calling heirarchy, `H5FD[un]lock()` and `H5FD_[un]lock()`
*/
@@ -1523,10 +1442,10 @@ test_noops_and_autofails(void)
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(file) )
+ FAIL_IF(FAIL == H5FDclose(file))
file = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1539,9 +1458,8 @@ error:
***********/
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
if (file != NULL) {
(void)H5FDclose(file);
@@ -1553,7 +1471,6 @@ error:
} /* end test_noops_and_autofails() */
-
/*---------------------------------------------------------------------------
*
* Function: test_cmp()
@@ -1577,15 +1494,12 @@ test_cmp(void)
{
TESTING("HDFS cmp (comparison)");
SKIPPED();
- HDfprintf(
- stderr,
- " TODO: Distinct valid fapls to open the same file.\n");
+ HDfprintf(stderr, " TODO: Distinct valid fapls to open the same file.\n");
return 0;
} /* end test_cmp() */
-
/*---------------------------------------------------------------------------
*
* Function: test_H5F_integration()
@@ -1632,7 +1546,7 @@ test_H5F_integration(void)
* test-local variables *
************************/
- hid_t file = -1;
+ hid_t file = -1;
hid_t fapl_id = -1;
TESTING("HDFS file access through HD5F library (H5F API)");
@@ -1642,8 +1556,8 @@ test_H5F_integration(void)
*********/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( 0 > fapl_id )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(0 > fapl_id)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
/*********
* TESTS *
@@ -1651,39 +1565,26 @@ test_H5F_integration(void)
/* Read-Write Open access is not allowed with this file driver.
*/
- H5E_BEGIN_TRY {
- FAIL_IF( 0 <= H5Fopen(
- filename_example_h5,
- H5F_ACC_RDWR,
- fapl_id) )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fopen(filename_example_h5, H5F_ACC_RDWR, fapl_id))} H5E_END_TRY;
/* H5Fcreate() is not allowed with this file driver.
*/
- H5E_BEGIN_TRY {
- FAIL_IF( 0 <= H5Fcreate(
- filename_missing,
- H5F_ACC_RDONLY,
- H5P_DEFAULT,
- fapl_id) )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{
+ FAIL_IF(0 <= H5Fcreate(filename_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY;
/* Successful open.
*/
- file = H5Fopen(
- filename_example_h5,
- H5F_ACC_RDONLY,
- fapl_id);
- FAIL_IF( file < 0 )
+ file = H5Fopen(filename_example_h5, H5F_ACC_RDONLY, fapl_id);
+ FAIL_IF(file < 0)
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5Fclose(file) )
+ FAIL_IF(FAIL == H5Fclose(file))
file = -1;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1695,13 +1596,13 @@ error:
***********/
#if HDFS_TEST_DEBUG
- HDprintf("\nerror!"); fflush(stdout);
+ HDprintf("\nerror!");
+ fflush(stdout);
#endif /* HDFS_TEST_DEBUG */
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
if (file > 0) {
(void)H5Fclose(file);
@@ -1713,7 +1614,6 @@ error:
} /* test_H5F_integration */
-
/*-------------------------------------------------------------------------
*
* Function: main
@@ -1739,17 +1639,15 @@ main(void)
#ifdef H5_HAVE_LIBHDFS
static char hdfs_namenode_name[HDFS_NAMENODE_NAME_MAX_SIZE] = "";
- const char *hdfs_namenode_name_env = NULL;
+ const char *hdfs_namenode_name_env = NULL;
hdfs_namenode_name_env = HDgetenv("HDFS_TEST_NAMENODE_NAME");
if (hdfs_namenode_name_env == NULL || hdfs_namenode_name_env[0] == '\0') {
HDstrncpy(hdfs_namenode_name, "localhost", HDFS_NAMENODE_NAME_MAX_SIZE);
}
else {
- HDstrncpy( /* TODO: error-check? */
- default_fa.namenode_name,
- hdfs_namenode_name_env,
- HDFS_NAMENODE_NAME_MAX_SIZE);
+ HDstrncpy(/* TODO: error-check? */
+ default_fa.namenode_name, hdfs_namenode_name_env, HDFS_NAMENODE_NAME_MAX_SIZE);
}
#endif /* H5_HAVE_LIBHDFS */
@@ -1768,9 +1666,7 @@ main(void)
nerrors += test_H5F_integration();
if (nerrors > 0) {
- HDprintf("***** %d hdfs TEST%s FAILED! *****\n",
- nerrors,
- nerrors > 1 ? "S" : "");
+ HDprintf("***** %d hdfs TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
nerrors = 1;
}
else {
@@ -1779,5 +1675,3 @@ main(void)
return nerrors; /* 0 if no errors, 1 if any errors */
} /* end main() */
-
-
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 27b31cf..43992de 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -23,17 +23,16 @@
#include "h5test.h"
#include "H5VMprivate.h"
-#define TEST_SMALL 0x0001
-#define TEST_MEDIUM 0x0002
+#define TEST_SMALL 0x0001
+#define TEST_MEDIUM 0x0002
-#define VARIABLE_SRC 0
-#define VARIABLE_DST 1
-#define VARIABLE_BOTH 2
+#define VARIABLE_SRC 0
+#define VARIABLE_DST 1
+#define VARIABLE_BOTH 2
-#define ARRAY_FILL_SIZE 4
+#define ARRAY_FILL_SIZE 4
#define ARRAY_OFFSET_NDIMS 3
-
/*-------------------------------------------------------------------------
* Function: init_full
*
@@ -49,23 +48,22 @@
static unsigned
init_full(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
- uint8_t acc = 128;
- unsigned total = 0;
- size_t i, j, k;
-
- for(i = 0; i < nx; i++)
- for(j = 0; j < ny; j++)
- for(k = 0; k < nz; k++) {
- total += acc;
- *array = acc;
- acc++;
- array++;
- } /* end for */
+ uint8_t acc = 128;
+ unsigned total = 0;
+ size_t i, j, k;
+
+ for (i = 0; i < nx; i++)
+ for (j = 0; j < ny; j++)
+ for (k = 0; k < nz; k++) {
+ total += acc;
+ *array = acc;
+ acc++;
+ array++;
+ } /* end for */
return total;
} /* end init_full() */
-
/*-------------------------------------------------------------------------
* Function: print_array
*
@@ -81,27 +79,26 @@ init_full(uint8_t *array, size_t nx, size_t ny, size_t nz)
static void
print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
- size_t i, j, k;
-
- for(i = 0; i < nx; i++) {
- if(nz > 1)
- HDprintf("i=%lu:\n", (unsigned long)i);
- else
- HDprintf("%03lu:", (unsigned long)i);
-
- for(j = 0; j < ny; j++) {
- if(nz > 1)
- HDprintf("%03lu:", (unsigned long)j);
- for(k = 0; k < nz; k++)
- HDprintf(" %3d", *array++);
- if(nz > 1)
+ size_t i, j, k;
+
+ for (i = 0; i < nx; i++) {
+ if (nz > 1)
+ HDprintf("i=%lu:\n", (unsigned long)i);
+ else
+ HDprintf("%03lu:", (unsigned long)i);
+
+ for (j = 0; j < ny; j++) {
+ if (nz > 1)
+ HDprintf("%03lu:", (unsigned long)j);
+ for (k = 0; k < nz; k++)
+ HDprintf(" %3d", *array++);
+ if (nz > 1)
+ HDprintf("\n");
+ } /* end for */
HDprintf("\n");
} /* end for */
- HDprintf("\n");
- } /* end for */
} /* end print_array() */
-
/*-------------------------------------------------------------------------
* Function: print_ref
*
@@ -121,7 +118,7 @@ print_ref(size_t nx, size_t ny, size_t nz)
{
uint8_t *array;
- if(NULL != (array = (uint8_t *)HDmalloc(nx * ny * nz))) {
+ if (NULL != (array = (uint8_t *)HDmalloc(nx * ny * nz))) {
HDprintf("Reference array:\n");
init_full(array, nx, ny, nz);
print_array(array, nx, ny, nz);
@@ -129,7 +126,6 @@ print_ref(size_t nx, size_t ny, size_t nz)
} /* end if */
} /* end print_ref() */
-
/*-------------------------------------------------------------------------
* Function: test_fill
*
@@ -145,79 +141,77 @@ print_ref(size_t nx, size_t ny, size_t nz)
*-------------------------------------------------------------------------
*/
static herr_t
-test_fill(size_t nx, size_t ny, size_t nz,
- size_t di, size_t dj, size_t dk,
- size_t ddx, size_t ddy, size_t ddz)
+test_fill(size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_t dk, size_t ddx, size_t ddy,
+ size_t ddz)
{
- uint8_t *dst = NULL; /*destination array */
- hsize_t hs_size[3]; /*hyperslab size */
- hsize_t dst_size[3]; /*destination total size */
- hsize_t dst_offset[3]; /*offset of hyperslab in dest */
- unsigned ref_value; /*reference value */
- unsigned acc; /*accumulator */
- size_t i, j, k, dx, dy, dz; /*counters */
- size_t u, v, w;
- unsigned ndims; /*hyperslab dimensionality */
- char dim[64], s[256]; /*temp string */
- unsigned fill_value; /*fill value */
+ uint8_t *dst = NULL; /*destination array */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
+ hsize_t dst_offset[3]; /*offset of hyperslab in dest */
+ unsigned ref_value; /*reference value */
+ unsigned acc; /*accumulator */
+ size_t i, j, k, dx, dy, dz; /*counters */
+ size_t u, v, w;
+ unsigned ndims; /*hyperslab dimensionality */
+ char dim[64], s[256]; /*temp string */
+ unsigned fill_value; /*fill value */
/*
* Dimensionality.
*/
- if(0 == nz) {
- if(0 == ny) {
+ if (0 == nz) {
+ if (0 == ny) {
ndims = 1;
ny = nz = 1;
- HDsprintf(dim, "%lu", (unsigned long) nx);
+ HDsprintf(dim, "%lu", (unsigned long)nx);
} /* end if */
else {
ndims = 2;
- nz = 1;
- HDsprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ nz = 1;
+ HDsprintf(dim, "%lux%lu", (unsigned long)nx, (unsigned long)ny);
} /* end else */
- } /* end if */
+ } /* end if */
else {
ndims = 3;
- HDsprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny,
- (unsigned long) nz);
+ HDsprintf(dim, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
} /* end else */
HDsprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim);
HDprintf("%-70s", s);
fflush(stdout);
/* Allocate array */
- if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
+ if (NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
init_full(dst, nx, ny, nz);
- for(i = 0; i < nx; i += di) {
- for(j = 0; j < ny; j += dj) {
- for(k = 0; k < nz; k += dk) {
- for(dx = 1; dx <= nx - i; dx += ddx) {
- for(dy = 1; dy <= ny - j; dy += ddy) {
- for(dz = 1; dz <= nz - k; dz += ddz) {
+ for (i = 0; i < nx; i += di) {
+ for (j = 0; j < ny; j += dj) {
+ for (k = 0; k < nz; k += dk) {
+ for (dx = 1; dx <= nx - i; dx += ddx) {
+ for (dy = 1; dy <= ny - j; dy += ddy) {
+ for (dz = 1; dz <= nz - k; dz += ddz) {
/* Describe the hyperslab */
- dst_size[0] = nx;
- dst_size[1] = ny;
- dst_size[2] = nz;
+ dst_size[0] = nx;
+ dst_size[1] = ny;
+ dst_size[2] = nz;
dst_offset[0] = i;
dst_offset[1] = j;
dst_offset[2] = k;
- hs_size[0] = dx;
- hs_size[1] = dy;
- hs_size[2] = dz;
+ hs_size[0] = dx;
+ hs_size[1] = dy;
+ hs_size[2] = dz;
- for(fill_value = 0; fill_value < 256; fill_value += 64) {
+ for (fill_value = 0; fill_value < 256; fill_value += 64) {
/*
* Initialize the full array, then subtract the
* original * fill values and add the new ones.
*/
ref_value = init_full(dst, nx, ny, nz);
- for(u = (size_t)dst_offset[0]; u < dst_offset[0] + dx; u++)
- for(v = (size_t)dst_offset[1]; v < dst_offset[1] + dy; v++)
- for(w = (size_t)dst_offset[2]; w < dst_offset[2] + dz; w++)
+ for (u = (size_t)dst_offset[0]; u < dst_offset[0] + dx; u++)
+ for (v = (size_t)dst_offset[1]; v < dst_offset[1] + dy; v++)
+ for (w = (size_t)dst_offset[2]; w < dst_offset[2] + dz; w++)
ref_value -= dst[u * ny * nz + v * nz + w];
ref_value += fill_value * (unsigned)dx * (unsigned)dy * (unsigned)dz;
@@ -229,14 +223,14 @@ test_fill(size_t nx, size_t ny, size_t nz,
* reference value.
*/
acc = 0;
- for(u = 0; u < nx; u++)
- for(v = 0; v < ny; v++)
- for(w = 0; w < nz; w++)
+ for (u = 0; u < nx; u++)
+ for (v = 0; v < ny; v++)
+ for (w = 0; w < nz; w++)
acc += dst[u * ny * nz + v * nz + w];
- if(acc != ref_value) {
+ if (acc != ref_value) {
H5_FAILED()
- if(!HDisatty(1)) {
+ if (!HDisatty(1)) {
/*
* Print debugging info unless output
* is going directly to a terminal.
@@ -244,26 +238,24 @@ test_fill(size_t nx, size_t ny, size_t nz,
AT();
HDprintf(" acc != ref_value\n");
HDprintf(" i=%lu, j=%lu, k=%lu, "
- "dx=%lu, dy=%lu, dz=%lu, "
- "fill=%d\n", (unsigned long)i,
- (unsigned long)j,
- (unsigned long)k,
- (unsigned long)dx,
- (unsigned long)dy,
- (unsigned long)dz, fill_value);
+ "dx=%lu, dy=%lu, dz=%lu, "
+ "fill=%d\n",
+ (unsigned long)i, (unsigned long)j, (unsigned long)k,
+ (unsigned long)dx, (unsigned long)dy, (unsigned long)dz,
+ fill_value);
print_ref(nx, ny, nz);
HDprintf("\n Result is:\n");
print_array(dst, nx, ny, nz);
} /* end if */
goto error;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
PASSED();
@@ -272,12 +264,11 @@ test_fill(size_t nx, size_t ny, size_t nz,
return SUCCEED;
error:
- if(dst)
+ if (dst)
HDfree(dst);
return FAIL;
} /* end test_fill() */
-
/*-------------------------------------------------------------------------
* Function: test_copy
*
@@ -305,48 +296,45 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_copy(int mode,
- size_t nx, size_t ny, size_t nz,
- size_t di, size_t dj, size_t dk,
- size_t ddx, size_t ddy, size_t ddz)
+test_copy(int mode, size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_t dk, size_t ddx, size_t ddy,
+ size_t ddz)
{
- uint8_t *src = NULL; /*source array */
- uint8_t *dst = NULL; /*destination array */
- hsize_t hs_size[3]; /*hyperslab size */
- hsize_t dst_size[3]; /*destination total size */
- hsize_t src_size[3]; /*source total size */
- hsize_t dst_offset[3]; /*offset of hyperslab in dest */
- hsize_t src_offset[3]; /*offset of hyperslab in source */
- unsigned ref_value; /*reference value */
- unsigned acc; /*accumulator */
+ uint8_t * src = NULL; /*source array */
+ uint8_t * dst = NULL; /*destination array */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
+ hsize_t src_size[3]; /*source total size */
+ hsize_t dst_offset[3]; /*offset of hyperslab in dest */
+ hsize_t src_offset[3]; /*offset of hyperslab in source */
+ unsigned ref_value; /*reference value */
+ unsigned acc; /*accumulator */
hsize_t i, j, k, dx, dy, dz; /*counters */
hsize_t u, v, w;
- unsigned ndims; /*hyperslab dimensionality */
+ unsigned ndims; /*hyperslab dimensionality */
char dim[64], s[256]; /*temp string */
const char *sub;
/*
* Dimensionality.
*/
- if(0 == nz) {
- if(0 == ny) {
+ if (0 == nz) {
+ if (0 == ny) {
ndims = 1;
ny = nz = 1;
- HDsprintf(dim, "%lu", (unsigned long) nx);
+ HDsprintf(dim, "%lu", (unsigned long)nx);
} /* end if */
else {
ndims = 2;
- nz = 1;
- HDsprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ nz = 1;
+ HDsprintf(dim, "%lux%lu", (unsigned long)nx, (unsigned long)ny);
} /* end else */
- } /* end if */
+ } /* end if */
else {
ndims = 3;
- HDsprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny,
- (unsigned long) nz);
+ HDsprintf(dim, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
} /* end else */
- switch(mode) {
+ switch (mode) {
case VARIABLE_SRC:
/*
* The hyperslab "travels" through the source array but the
@@ -383,31 +371,31 @@ test_copy(int mode,
/*
* Allocate arrays
*/
- if(NULL == (src = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
+ if (NULL == (src = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
- if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
+ if (NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
init_full(src, nx, ny, nz);
- for(i = 0; i < nx; i += di) {
- for(j = 0; j < ny; j += dj) {
- for(k = 0; k < nz; k += dk) {
- for(dx = 1; dx <= nx - i; dx += ddx) {
- for(dy = 1; dy <= ny - j; dy += ddy) {
- for(dz = 1; dz <= nz - k; dz += ddz) {
+ for (i = 0; i < nx; i += di) {
+ for (j = 0; j < ny; j += dj) {
+ for (k = 0; k < nz; k += dk) {
+ for (dx = 1; dx <= nx - i; dx += ddx) {
+ for (dy = 1; dy <= ny - j; dy += ddy) {
+ for (dz = 1; dz <= nz - k; dz += ddz) {
/*
* Describe the source and destination hyperslabs
* and the arrays to which they belong.
*/
- hs_size[0] = dx;
- hs_size[1] = dy;
- hs_size[2] = dz;
+ hs_size[0] = dx;
+ hs_size[1] = dy;
+ hs_size[2] = dz;
dst_size[0] = src_size[0] = nx;
dst_size[1] = src_size[1] = ny;
dst_size[2] = src_size[2] = nz;
- switch(mode) {
+ switch (mode) {
case VARIABLE_SRC:
dst_offset[0] = 0;
dst_offset[1] = 0;
@@ -444,38 +432,39 @@ test_copy(int mode,
* value to compare against later.
*/
ref_value = 0;
- for(u = src_offset[0]; u < src_offset[0] + dx; u++)
- for(v = src_offset[1]; v < src_offset[1] + dy; v++)
- for(w = src_offset[2]; w < src_offset[2] + dz; w++)
+ for (u = src_offset[0]; u < src_offset[0] + dx; u++)
+ for (v = src_offset[1]; v < src_offset[1] + dy; v++)
+ for (w = src_offset[2]; w < src_offset[2] + dz; w++)
ref_value += src[u * ny * nz + v * nz + w];
/*
* Set all loc values to 1 so we can detect writing
* outside the hyperslab.
*/
- for(u = 0; u < nx; u++)
- for(v = 0; v < ny; v++)
- for(w = 0; w < nz; w++)
+ for (u = 0; u < nx; u++)
+ for (v = 0; v < ny; v++)
+ for (w = 0; w < nz; w++)
dst[u * ny * nz + v * nz + w] = 1;
/*
* Copy a hyperslab from the global array to the
* local array.
*/
- H5VM_hyper_copy(ndims, hs_size, dst_size, dst_offset, dst, src_size, src_offset, src);
+ H5VM_hyper_copy(ndims, hs_size, dst_size, dst_offset, dst, src_size, src_offset,
+ src);
/*
* Sum the destination hyperslab. It should be
* the same as the reference value.
*/
acc = 0;
- for(u = dst_offset[0]; u < dst_offset[0] + dx; u++)
- for(v = dst_offset[1]; v < dst_offset[1] + dy; v++)
- for(w = dst_offset[2]; w < dst_offset[2] + dz; w++)
+ for (u = dst_offset[0]; u < dst_offset[0] + dx; u++)
+ for (v = dst_offset[1]; v < dst_offset[1] + dy; v++)
+ for (w = dst_offset[2]; w < dst_offset[2] + dz; w++)
acc += dst[u * ny * nz + v * nz + w];
- if(acc != ref_value) {
+ if (acc != ref_value) {
H5_FAILED()
- if(!HDisatty(1)) {
+ if (!HDisatty(1)) {
/*
* Print debugging info unless output is
* going directly to a terminal.
@@ -483,13 +472,9 @@ test_copy(int mode,
AT();
HDprintf(" acc != ref_value\n");
HDprintf(" i=%lu, j=%lu, k=%lu, "
- "dx=%lu, dy=%lu, dz=%lu\n",
- (unsigned long)i,
- (unsigned long)j,
- (unsigned long)k,
- (unsigned long)dx,
- (unsigned long)dy,
- (unsigned long)dz);
+ "dx=%lu, dy=%lu, dz=%lu\n",
+ (unsigned long)i, (unsigned long)j, (unsigned long)k,
+ (unsigned long)dx, (unsigned long)dy, (unsigned long)dz);
print_ref(nx, ny, nz);
HDprintf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
@@ -503,9 +488,9 @@ test_copy(int mode,
* we added the border of 1's to the hyperslab.
*/
acc = 0;
- for(u = 0; u < nx; u++)
- for(v = 0; v < ny; v++)
- for(w = 0; w < nz; w++)
+ for (u = 0; u < nx; u++)
+ for (v = 0; v < ny; v++)
+ for (w = 0; w < nz; w++)
acc += dst[u * ny * nz + v * nz + w];
/*
@@ -513,37 +498,33 @@ test_copy(int mode,
* optimization bug in the Mongoose 7.20 Irix64
* compiler.
*/
- if(acc + (unsigned) dx * (unsigned) dy
- * (unsigned) dz != ref_value + nx * ny * nz) {
+ if (acc + (unsigned)dx * (unsigned)dy * (unsigned)dz !=
+ ref_value + nx * ny * nz) {
H5_FAILED()
- if(!HDisatty(1)) {
+ if (!HDisatty(1)) {
/*
* Print debugging info unless output is
* going directly to a terminal.
*/
AT();
HDprintf(" acc != ref_value + nx*ny*nz - "
- "dx*dy*dz\n");
+ "dx*dy*dz\n");
HDprintf(" i=%lu, j=%lu, k=%lu, "
- "dx=%lu, dy=%lu, dz=%lu\n",
- (unsigned long)i,
- (unsigned long)j,
- (unsigned long)k,
- (unsigned long)dx,
- (unsigned long)dy,
- (unsigned long)dz);
+ "dx=%lu, dy=%lu, dz=%lu\n",
+ (unsigned long)i, (unsigned long)j, (unsigned long)k,
+ (unsigned long)dx, (unsigned long)dy, (unsigned long)dz);
print_ref(nx, ny, nz);
HDprintf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
} /* end if */
goto error;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
PASSED();
@@ -553,15 +534,14 @@ test_copy(int mode,
return SUCCEED;
error:
- if(src)
+ if (src)
HDfree(src);
- if(dst)
+ if (dst)
HDfree(dst);
return FAIL;
} /* end test_copy() */
-
/*-------------------------------------------------------------------------
* Function: test_multifill
*
@@ -583,32 +563,32 @@ error:
static herr_t
test_multifill(size_t nx)
{
- hsize_t size;
- hsize_t src_stride;
- hsize_t dst_stride;
- char s[64];
+ hsize_t size;
+ hsize_t src_stride;
+ hsize_t dst_stride;
+ char s[64];
struct a_struct {
- int left;
+ int left;
double mid;
- int right;
+ int right;
} fill, *src = NULL, *dst = NULL;
- hsize_t i, j;
+ hsize_t i, j;
HDprintf("%-70s", "Testing multi-byte fill value");
fflush(stdout);
/* Initialize the source and destination */
- if(NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src))))
+ if (NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src))))
TEST_ERROR
- if(NULL == (dst = (struct a_struct *)HDmalloc(nx * sizeof(*dst))))
+ if (NULL == (dst = (struct a_struct *)HDmalloc(nx * sizeof(*dst))))
TEST_ERROR
- for(i = 0; i < nx; i++) {
- src[i].left = 1111111;
- src[i].mid = 12345.6789F;
+ for (i = 0; i < nx; i++) {
+ src[i].left = 1111111;
+ src[i].mid = 12345.6789F;
src[i].right = 2222222;
- dst[i].left = 3333333;
- dst[i].mid = 98765.4321F;
+ dst[i].left = 3333333;
+ dst[i].mid = 98765.4321F;
dst[i].right = 4444444;
} /* end for */
@@ -616,8 +596,8 @@ test_multifill(size_t nx)
* Describe the fill value. The zero stride says to read the same thing
* over and over again.
*/
- fill.left = 55555555;
- fill.mid = 3.1415927F;
+ fill.left = 55555555;
+ fill.mid = 3.1415927F;
fill.right = 66666666;
src_stride = 0;
@@ -630,41 +610,39 @@ test_multifill(size_t nx)
* Copy the fill value into each element
*/
size = nx;
- H5VM_stride_copy(1, (hsize_t)sizeof(double), &size, &dst_stride,
- &(dst[0].mid), &src_stride, &(fill.mid));
+ H5VM_stride_copy(1, (hsize_t)sizeof(double), &size, &dst_stride, &(dst[0].mid), &src_stride, &(fill.mid));
/*
* Check
*/
s[0] = '\0';
- for(i = 0; i < nx; i++) {
- if(dst[i].left != 3333333)
+ for (i = 0; i < nx; i++) {
+ if (dst[i].left != 3333333)
HDsprintf(s, "bad dst[%lu].left", (unsigned long)i);
- else if(!H5_DBL_ABS_EQUAL(dst[i].mid, fill.mid))
+ else if (!H5_DBL_ABS_EQUAL(dst[i].mid, fill.mid))
/* Check if two DOUBLE values are equal. If their difference
* is smaller than the EPSILON value for double, they are
* considered equal. See the definition in h5test.h.
*/
HDsprintf(s, "bad dst[%lu].mid", (unsigned long)i);
- else if(dst[i].right != 4444444)
+ else if (dst[i].right != 4444444)
HDsprintf(s, "bad dst[%lu].right", (unsigned long)i);
- if(s[0]) {
+ if (s[0]) {
H5_FAILED()
- if(!HDisatty(1)) {
+ if (!HDisatty(1)) {
AT();
- HDprintf(" fill={%d,%g,%d}\n ", fill.left, fill.mid,
- fill.right);
- for(j = 0; j < sizeof(fill); j++)
+ HDprintf(" fill={%d,%g,%d}\n ", fill.left, fill.mid, fill.right);
+ for (j = 0; j < sizeof(fill); j++)
HDprintf(" %02x", ((uint8_t *)&fill)[j]);
- HDprintf("\n dst[%lu]={%d,%g,%d}\n ", (unsigned long)i,
- dst[i].left, dst[i].mid, dst[i].right);
- for(j = 0; j < sizeof(dst[i]); j++)
+ HDprintf("\n dst[%lu]={%d,%g,%d}\n ", (unsigned long)i, dst[i].left, dst[i].mid,
+ dst[i].right);
+ for (j = 0; j < sizeof(dst[i]); j++)
HDprintf(" %02x", ((uint8_t *)(dst + i))[j]);
HDprintf("\n");
} /* end if */
goto error;
} /* end if */
- } /* end for */
+ } /* end for */
PASSED();
@@ -674,15 +652,14 @@ test_multifill(size_t nx)
return SUCCEED;
error:
- if(src)
+ if (src)
HDfree(src);
- if(dst)
+ if (dst)
HDfree(dst);
return FAIL;
} /* end test_multifill() */
-
/*-------------------------------------------------------------------------
* Function: test_endian
*
@@ -702,41 +679,41 @@ error:
static herr_t
test_endian(size_t nx)
{
- uint8_t *src = NULL; /*source array */
- uint8_t *dst = NULL; /*destination array */
- hssize_t src_stride[2]; /*source strides */
- hssize_t dst_stride[2]; /*destination strides */
- hsize_t size[2]; /*size vector */
- hsize_t i, j;
+ uint8_t *src = NULL; /*source array */
+ uint8_t *dst = NULL; /*destination array */
+ hssize_t src_stride[2]; /*source strides */
+ hssize_t dst_stride[2]; /*destination strides */
+ hsize_t size[2]; /*size vector */
+ hsize_t i, j;
HDprintf("%-70s", "Testing endian conversion by stride");
fflush(stdout);
/* Initialize arrays */
- if(NULL == (src = (uint8_t *)HDmalloc(nx * 4)))
+ if (NULL == (src = (uint8_t *)HDmalloc(nx * 4)))
TEST_ERROR
- if(NULL == (dst = (uint8_t *)HDcalloc(nx , (size_t)4)))
+ if (NULL == (dst = (uint8_t *)HDcalloc(nx, (size_t)4)))
TEST_ERROR
- init_full(src, nx, (size_t)4,(size_t)1);
+ init_full(src, nx, (size_t)4, (size_t)1);
/* Initialize strides */
src_stride[0] = 0;
src_stride[1] = 1;
dst_stride[0] = 8;
dst_stride[1] = -1;
- size[0] = nx;
- size[1] = 4;
+ size[0] = nx;
+ size[1] = 4;
/* Copy the array */
H5VM_stride_copy_s(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src);
/* Compare */
- for(i = 0; i < nx; i++) {
- for(j = 0; j < 4; j++) {
- if(src[i * 4 + j] != dst[i * 4 + 3 - j]) {
+ for (i = 0; i < nx; i++) {
+ for (j = 0; j < 4; j++) {
+ if (src[i * 4 + j] != dst[i * 4 + 3 - j]) {
H5_FAILED()
- if(!HDisatty(1)) {
+ if (!HDisatty(1)) {
/*
* Print debugging info unless output is going directly
* to a terminal.
@@ -750,8 +727,8 @@ test_endian(size_t nx)
} /* end if */
goto error;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
PASSED();
@@ -761,15 +738,14 @@ test_endian(size_t nx)
return SUCCEED;
error:
- if(src)
+ if (src)
HDfree(src);
- if(dst)
+ if (dst)
HDfree(dst);
return FAIL;
} /* end test_endian() */
-
/*-------------------------------------------------------------------------
* Function: test_transpose
*
@@ -788,67 +764,65 @@ error:
static herr_t
test_transpose(size_t nx, size_t ny)
{
- int *src = NULL;
- int *dst = NULL;
- hsize_t src_stride[2], dst_stride[2];
- hsize_t size[2];
+ int * src = NULL;
+ int * dst = NULL;
+ hsize_t src_stride[2], dst_stride[2];
+ hsize_t size[2];
char s[256];
- hsize_t i, j;
+ hsize_t i, j;
- HDsprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx,
- (unsigned long)ny);
+ HDsprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, (unsigned long)ny);
HDprintf("%-70s", s);
fflush(stdout);
/* Initialize */
- if(NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src))))
+ if (NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src))))
TEST_ERROR
- if(NULL == (dst = (int *)HDcalloc(nx * ny, sizeof(*dst))))
+ if (NULL == (dst = (int *)HDcalloc(nx * ny, sizeof(*dst))))
TEST_ERROR
- for(i = 0; i < nx; i++)
- for(j = 0; j < ny; j++)
+ for (i = 0; i < nx; i++)
+ for (j = 0; j < ny; j++)
src[i * ny + j] = (int)(i * ny + j);
/* Build stride info */
- size[0] = nx;
- size[1] = ny;
+ size[0] = nx;
+ size[1] = ny;
src_stride[0] = 0;
src_stride[1] = sizeof(*src);
dst_stride[0] = (hsize_t)((1 - nx * ny) * sizeof(*src));
dst_stride[1] = (hsize_t)(nx * sizeof(*src));
/* Copy and transpose */
- H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst,
- src_stride, src);
+ H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, src_stride, src);
/* Check */
- for(i = 0; i < nx; i++) {
- for(j = 0; j < ny; j++) {
- if(src[i * ny + j] != dst[j * nx + i]) {
+ for (i = 0; i < nx; i++) {
+ for (j = 0; j < ny; j++) {
+ if (src[i * ny + j] != dst[j * nx + i]) {
H5_FAILED()
- if(!HDisatty(1)) {
+ if (!HDisatty(1)) {
AT();
HDprintf(" diff at i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j);
HDprintf(" Source is:\n");
- for(i = 0; i < nx; i++) {
+ for (i = 0; i < nx; i++) {
HDprintf("%3lu:", (unsigned long)i);
- for(j = 0; j < ny; j++)
+ for (j = 0; j < ny; j++)
HDprintf(" %6d", src[i * ny + j]);
HDprintf("\n");
} /* end for */
HDprintf("\n Destination is:\n");
for (i = 0; i < ny; i++) {
HDprintf("%3lu:", (unsigned long)i);
- for(j = 0; j < nx; j++)
+ for (j = 0; j < nx; j++)
HDprintf(" %6d", dst[i * nx + j]);
HDprintf("\n");
} /* end for */
- } /* end if */
+ } /* end if */
goto error;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
PASSED();
@@ -858,15 +832,14 @@ test_transpose(size_t nx, size_t ny)
return SUCCEED;
error:
- if(src)
+ if (src)
HDfree(src);
- if(dst)
+ if (dst)
HDfree(dst);
return FAIL;
} /* end test_transpose() */
-
/*-------------------------------------------------------------------------
* Function: test_sub_super
*
@@ -887,53 +860,50 @@ error:
static herr_t
test_sub_super(size_t nx, size_t ny)
{
- uint8_t *full = NULL; /*original image */
- uint8_t *half = NULL; /*image at 1/2 resolution */
- uint8_t *twice = NULL; /*2x2 pixels */
- hsize_t src_stride[4]; /*source stride info */
- hsize_t dst_stride[4]; /*destination stride info */
- hsize_t size[4]; /*number of sample points */
- hsize_t i, j;
- char s[256];
-
- HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
- (unsigned long)(2 * nx), (unsigned long)(2 * ny),
- (unsigned long)nx, (unsigned long)ny);
+ uint8_t *full = NULL; /*original image */
+ uint8_t *half = NULL; /*image at 1/2 resolution */
+ uint8_t *twice = NULL; /*2x2 pixels */
+ hsize_t src_stride[4]; /*source stride info */
+ hsize_t dst_stride[4]; /*destination stride info */
+ hsize_t size[4]; /*number of sample points */
+ hsize_t i, j;
+ char s[256];
+
+ HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)(2 * nx),
+ (unsigned long)(2 * ny), (unsigned long)nx, (unsigned long)ny);
HDprintf("%-70s", s);
fflush(stdout);
/* Initialize */
- if(NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny)))
+ if (NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny)))
TEST_ERROR
- if(NULL == (half = (uint8_t *)HDcalloc((size_t)1, nx * ny)))
+ if (NULL == (half = (uint8_t *)HDcalloc((size_t)1, nx * ny)))
TEST_ERROR
- if(NULL == (twice = (uint8_t *)HDcalloc((size_t)4, nx * ny)))
+ if (NULL == (twice = (uint8_t *)HDcalloc((size_t)4, nx * ny)))
TEST_ERROR
init_full(full, 2 * nx, 2 * ny, (size_t)1);
/* Setup */
- size[0] = nx;
- size[1] = ny;
+ size[0] = nx;
+ size[1] = ny;
src_stride[0] = (hsize_t)(2 * ny);
src_stride[1] = 2;
dst_stride[0] = 0;
dst_stride[1] = 1;
/* Copy */
- H5VM_stride_copy(2, (hsize_t)sizeof(uint8_t), size, dst_stride, half,
- src_stride, full);
+ H5VM_stride_copy(2, (hsize_t)sizeof(uint8_t), size, dst_stride, half, src_stride, full);
/* Check */
- for(i = 0; i < nx; i++) {
- for(j = 0; j < ny; j++) {
- if(full[4 * i * ny + 2 * j] != half[i * ny + j]) {
+ for (i = 0; i < nx; i++) {
+ for (j = 0; j < ny; j++) {
+ if (full[4 * i * ny + 2 * j] != half[i * ny + j]) {
H5_FAILED()
- if(!HDisatty(1)) {
+ if (!HDisatty(1)) {
AT();
- HDprintf(" full[%lu][%lu] != half[%lu][%lu]\n",
- (unsigned long)i * 2, (unsigned long)j * 2,
- (unsigned long)i, (unsigned long)j);
+ HDprintf(" full[%lu][%lu] != half[%lu][%lu]\n", (unsigned long)i * 2,
+ (unsigned long)j * 2, (unsigned long)i, (unsigned long)j);
HDprintf(" full is:\n");
print_array(full, 2 * nx, 2 * ny, (size_t)1);
HDprintf("\n half is:\n");
@@ -941,25 +911,24 @@ test_sub_super(size_t nx, size_t ny)
} /* end if */
goto error;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
PASSED();
/*
* Test replicating pixels to produce an image twice as large in each
* dimension.
*/
- HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
- (unsigned long)nx, (unsigned long)ny, (unsigned long)(2 * nx),
- (unsigned long)(2 * ny));
+ HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)nx, (unsigned long)ny,
+ (unsigned long)(2 * nx), (unsigned long)(2 * ny));
HDprintf("%-70s", s);
fflush(stdout);
/* Setup stride */
- size[0] = nx;
- size[1] = ny;
- size[2] = 2;
- size[3] = 2;
+ size[0] = nx;
+ size[1] = ny;
+ size[2] = 2;
+ size[3] = 2;
src_stride[0] = 0;
src_stride[1] = 1;
src_stride[2] = 0;
@@ -970,32 +939,27 @@ test_sub_super(size_t nx, size_t ny)
dst_stride[3] = sizeof(uint8_t);
/* Copy */
- H5VM_stride_copy(4, (hsize_t)sizeof(uint8_t), size, dst_stride, twice,
- src_stride, half);
+ H5VM_stride_copy(4, (hsize_t)sizeof(uint8_t), size, dst_stride, twice, src_stride, half);
/* Check */
s[0] = '\0';
- for(i = 0; i < nx; i++) {
- for(j = 0; j < ny; j++) {
- if(half[i * ny + j] != twice[4 * i * ny + 2 * j])
- HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
- (unsigned long)i, (unsigned long)j,
- (unsigned long)i * 2, (unsigned long)j * 2);
- else if(half[i * ny + j] != twice[4 * i * ny + 2 * j + 1])
- HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
- (unsigned long)i, (unsigned long)j,
- (unsigned long)i * 2, (unsigned long)j * 2 + 1);
- else if(half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j])
- HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
- (unsigned long)i, (unsigned long)j,
- (unsigned long)i * 2 + 1, (unsigned long)j * 2);
- else if(half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j + 1])
- HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
- (unsigned long)i, (unsigned long)j,
- (unsigned long)i * 2 + 1, (unsigned long)j * 2 + 1);
- if(s[0]) {
+ for (i = 0; i < nx; i++) {
+ for (j = 0; j < ny; j++) {
+ if (half[i * ny + j] != twice[4 * i * ny + 2 * j])
+ HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j,
+ (unsigned long)i * 2, (unsigned long)j * 2);
+ else if (half[i * ny + j] != twice[4 * i * ny + 2 * j + 1])
+ HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j,
+ (unsigned long)i * 2, (unsigned long)j * 2 + 1);
+ else if (half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j])
+ HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j,
+ (unsigned long)i * 2 + 1, (unsigned long)j * 2);
+ else if (half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j + 1])
+ HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j,
+ (unsigned long)i * 2 + 1, (unsigned long)j * 2 + 1);
+ if (s[0]) {
H5_FAILED()
- if(!HDisatty(1)) {
+ if (!HDisatty(1)) {
AT();
HDprintf(" %s\n Half is:\n", s);
print_array(half, nx, ny, (size_t)1);
@@ -1004,8 +968,8 @@ test_sub_super(size_t nx, size_t ny)
} /* end if */
goto error;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
PASSED();
@@ -1016,17 +980,16 @@ test_sub_super(size_t nx, size_t ny)
return SUCCEED;
error:
- if(full)
+ if (full)
HDfree(full);
- if(half)
+ if (half)
HDfree(half);
- if(twice)
+ if (twice)
HDfree(twice);
return FAIL;
} /* test_sub_super() */
-
/*-------------------------------------------------------------------------
* Function: test_array_fill
*
@@ -1046,30 +1009,30 @@ error:
static herr_t
test_array_fill(size_t lo, size_t hi)
{
- int *dst = NULL; /* Destination */
- int src[ARRAY_FILL_SIZE]; /* Source to duplicate */
- size_t u, v, w; /* Local index variables */
- char s[256];
+ int * dst = NULL; /* Destination */
+ int src[ARRAY_FILL_SIZE]; /* Source to duplicate */
+ size_t u, v, w; /* Local index variables */
+ char s[256];
- HDsprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo,(unsigned long)hi);
+ HDsprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo, (unsigned long)hi);
TESTING(s);
/* Initialize */
- if(NULL == (dst = (int *)HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi)))
+ if (NULL == (dst = (int *)HDcalloc(sizeof(int), ARRAY_FILL_SIZE * hi)))
TEST_ERROR
/* Setup */
- for(u = 0; u < ARRAY_FILL_SIZE; u++)
+ for (u = 0; u < ARRAY_FILL_SIZE; u++)
src[u] = (char)u;
/* Fill */
- for(w = lo; w <= hi; w++) {
+ for (w = lo; w <= hi; w++) {
H5VM_array_fill(dst, src, sizeof(src), w);
/* Check */
- for(u = 0; u < w; u++)
- for(v = 0; v < ARRAY_FILL_SIZE; v++)
- if(dst[(u * ARRAY_FILL_SIZE) + v] != src[v])
+ for (u = 0; u < w; u++)
+ for (v = 0; v < ARRAY_FILL_SIZE; v++)
+ if (dst[(u * ARRAY_FILL_SIZE) + v] != src[v])
TEST_ERROR
HDmemset(dst, 0, sizeof(int) * ARRAY_FILL_SIZE * w);
@@ -1082,12 +1045,11 @@ test_array_fill(size_t lo, size_t hi)
return SUCCEED;
error:
- if(dst)
+ if (dst)
HDfree(dst);
return FAIL;
} /* end test_array_fill() */
-
/*-------------------------------------------------------------------------
* Function: test_array_offset_n_calc
*
@@ -1107,20 +1069,21 @@ error:
static herr_t
test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
{
- hsize_t *a = NULL;
- hsize_t *temp_a; /* Array for stored calculated offsets */
- hsize_t off; /* Offset in array */
- size_t u, v, w; /* Local index variables */
- hsize_t dims[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of array to check */
- hsize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */
- hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */
- char s[256];
-
- HDsprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x);
+ hsize_t *a = NULL;
+ hsize_t *temp_a; /* Array for stored calculated offsets */
+ hsize_t off; /* Offset in array */
+ size_t u, v, w; /* Local index variables */
+ hsize_t dims[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of array to check */
+ hsize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */
+ hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */
+ char s[256];
+
+ HDsprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z, (unsigned long)y,
+ (unsigned long)x);
TESTING(s);
/* Initialize */
- if(NULL == (a = (hsize_t *)HDmalloc(sizeof(hsize_t) * x * y *z)))
+ if (NULL == (a = (hsize_t *)HDmalloc(sizeof(hsize_t) * x * y * z)))
TEST_ERROR
dims[0] = z;
@@ -1128,13 +1091,13 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
dims[2] = x;
/* Setup */
- for(u = 0, temp_a = a, off = 0; u < z; u++)
- for(v = 0; v < y; v++)
- for(w = 0; w < x; w++)
+ for (u = 0, temp_a = a, off = 0; u < z; u++)
+ for (v = 0; v < y; v++)
+ for (w = 0; w < x; w++)
*temp_a++ = off++;
/* Check offsets */
- for(u = 0; u < n; u++) {
+ for (u = 0; u < n; u++) {
/* Get random coordinate */
coords[0] = (hsize_t)((size_t)HDrandom() % z);
coords[1] = (hsize_t)((size_t)HDrandom() % y);
@@ -1144,20 +1107,21 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
off = H5VM_array_offset(ARRAY_OFFSET_NDIMS, dims, coords);
/* Check offset of coordinate */
- if(a[off] != off)
+ if (a[off] != off)
TEST_ERROR
/* Get coordinates of offset */
- if(H5VM_array_calc(off, ARRAY_OFFSET_NDIMS, dims, new_coords) < 0)
+ if (H5VM_array_calc(off, ARRAY_OFFSET_NDIMS, dims, new_coords) < 0)
TEST_ERROR
/* Check computed coordinates */
- for(v = 0; v < ARRAY_OFFSET_NDIMS; v++)
- if(coords[v] != new_coords[v]) {
- HDfprintf(stderr,"coords[%zu]=%" PRIuHSIZE ", new_coords[%zu]=%" PRIuHSIZE "\n", v, coords[v], v, new_coords[v]);
+ for (v = 0; v < ARRAY_OFFSET_NDIMS; v++)
+ if (coords[v] != new_coords[v]) {
+ HDfprintf(stderr, "coords[%zu]=%" PRIuHSIZE ", new_coords[%zu]=%" PRIuHSIZE "\n", v,
+ coords[v], v, new_coords[v]);
TEST_ERROR;
} /* end if */
- } /* end for */
+ } /* end for */
PASSED();
@@ -1166,13 +1130,12 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
return SUCCEED;
error:
- if(a)
+ if (a)
HDfree(a);
return FAIL;
} /* end test_array_offset_n_calc() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1190,32 +1153,32 @@ error:
int
main(int argc, char *argv[])
{
- herr_t status;
- int nerrors = 0;
- unsigned size_of_test;
+ herr_t status;
+ int nerrors = 0;
+ unsigned size_of_test;
/* Parse arguments or assume `small' & `medium' */
- if(1 == argc)
+ if (1 == argc)
size_of_test = TEST_SMALL | TEST_MEDIUM;
else {
int i;
- for(i = 1, size_of_test = 0; i < argc; i++) {
- if(!HDstrcmp(argv[i], "small"))
+ for (i = 1, size_of_test = 0; i < argc; i++) {
+ if (!HDstrcmp(argv[i], "small"))
size_of_test |= TEST_SMALL;
- else if(!HDstrcmp(argv[i], "medium"))
+ else if (!HDstrcmp(argv[i], "medium"))
size_of_test |= TEST_MEDIUM;
else {
HDprintf("unrecognized argument: %s\n", argv[i]);
HDexit(EXIT_FAILURE);
} /* end else */
- } /* end for */
- } /* end else */
+ } /* end for */
+ } /* end else */
HDprintf("Test sizes: ");
- if(size_of_test & TEST_SMALL)
+ if (size_of_test & TEST_SMALL)
HDprintf(" SMALL");
- if(size_of_test & TEST_MEDIUM)
+ if (size_of_test & TEST_MEDIUM)
HDprintf(" MEDIUM");
HDprintf("\n");
@@ -1228,33 +1191,33 @@ main(int argc, char *argv[])
*/
#ifdef H5_HAVE_THREADSAFE
H5open();
-#endif /* H5_HAVE_THREADSAFE */
+#endif /* H5_HAVE_THREADSAFE */
/*
*------------------------------
* TEST HYPERSLAB FILL OPERATION
*------------------------------
*/
- if(size_of_test & TEST_SMALL) {
- status = test_fill((size_t)11, (size_t)0, (size_t)0, (size_t)1,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ if (size_of_test & TEST_SMALL) {
+ status = test_fill((size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_fill((size_t)11, (size_t)10, (size_t)0, (size_t)1,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_fill((size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_fill((size_t)3, (size_t)5, (size_t)5, (size_t)1,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_fill((size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
- if(size_of_test & TEST_MEDIUM) {
- status = test_fill((size_t)113, (size_t)0, (size_t)0, (size_t)1,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ if (size_of_test & TEST_MEDIUM) {
+ status = test_fill((size_t)113, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_fill((size_t)15, (size_t)11, (size_t)0, (size_t)1,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_fill((size_t)15, (size_t)11, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_fill((size_t)5, (size_t)7, (size_t)7, (size_t)1,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_fill((size_t)5, (size_t)7, (size_t)7, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
@@ -1264,84 +1227,84 @@ main(int argc, char *argv[])
*/
/* exhaustive, one-dimensional test */
- if(size_of_test & TEST_SMALL) {
- status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)0, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ if (size_of_test & TEST_SMALL) {
+ status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)11, (size_t)0, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_DST, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)0, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
- if(size_of_test & TEST_MEDIUM) {
- status = test_copy(VARIABLE_SRC, (size_t)179, (size_t)0, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ if (size_of_test & TEST_MEDIUM) {
+ status = test_copy(VARIABLE_SRC, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)179, (size_t)0, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_DST, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)179, (size_t)0, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_BOTH, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/* exhaustive, two-dimensional test */
- if(size_of_test & TEST_SMALL) {
- status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)10, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ if (size_of_test & TEST_SMALL) {
+ status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)11, (size_t)10, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_DST, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)10, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
- if(size_of_test & TEST_MEDIUM) {
- status = test_copy(VARIABLE_SRC, (size_t)13, (size_t)19, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ if (size_of_test & TEST_MEDIUM) {
+ status = test_copy(VARIABLE_SRC, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)13, (size_t)19, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_DST, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)13, (size_t)19, (size_t)0,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_BOTH, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/* sparse, two-dimensional test */
- if(size_of_test & TEST_MEDIUM) {
- status = test_copy(VARIABLE_SRC, (size_t)73, (size_t)67, (size_t)0,
- (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
+ if (size_of_test & TEST_MEDIUM) {
+ status = test_copy(VARIABLE_SRC, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1,
+ (size_t)13, (size_t)11, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)73, (size_t)67, (size_t)0,
- (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
+ status = test_copy(VARIABLE_DST, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1,
+ (size_t)13, (size_t)11, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)73, (size_t)67, (size_t)0,
- (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
+ status = test_copy(VARIABLE_BOTH, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1,
+ (size_t)13, (size_t)11, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/* exhaustive, three-dimensional test */
- if(size_of_test & TEST_SMALL) {
- status = test_copy(VARIABLE_SRC, (size_t)3, (size_t)5, (size_t)5,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ if (size_of_test & TEST_SMALL) {
+ status = test_copy(VARIABLE_SRC, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)3, (size_t)5, (size_t)5,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_DST, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)3, (size_t)5, (size_t)5,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_BOTH, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
- if(size_of_test & TEST_MEDIUM) {
- status = test_copy(VARIABLE_SRC, (size_t)7, (size_t)9, (size_t)5,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ if (size_of_test & TEST_MEDIUM) {
+ status = test_copy(VARIABLE_SRC, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)7, (size_t)9, (size_t)5,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_DST, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)7, (size_t)9, (size_t)5,
- (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ status = test_copy(VARIABLE_BOTH, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
@@ -1349,11 +1312,11 @@ main(int argc, char *argv[])
* TEST MULTI-BYTE FILL
*---------------------
*/
- if(size_of_test & TEST_SMALL) {
+ if (size_of_test & TEST_SMALL) {
status = test_multifill((size_t)10);
nerrors += status < 0 ? 1 : 0;
} /* end if */
- if(size_of_test & TEST_MEDIUM) {
+ if (size_of_test & TEST_MEDIUM) {
status = test_multifill((size_t)500000);
nerrors += status < 0 ? 1 : 0;
} /* end if */
@@ -1362,7 +1325,7 @@ main(int argc, char *argv[])
* TEST TRANSLATION OPERATORS
*---------------------------
*/
- if(size_of_test & TEST_SMALL) {
+ if (size_of_test & TEST_SMALL) {
status = test_endian((size_t)10);
nerrors += status < 0 ? 1 : 0;
status = test_transpose((size_t)9, (size_t)9);
@@ -1370,7 +1333,7 @@ main(int argc, char *argv[])
status = test_transpose((size_t)3, (size_t)11);
nerrors += status < 0 ? 1 : 0;
} /* end if */
- if(size_of_test & TEST_MEDIUM) {
+ if (size_of_test & TEST_MEDIUM) {
status = test_endian((size_t)800000);
nerrors += status < 0 ? 1 : 0;
status = test_transpose((size_t)1200, (size_t)1200);
@@ -1383,11 +1346,11 @@ main(int argc, char *argv[])
* TEST SAMPLING OPERATIONS
*-------------------------
*/
- if(size_of_test & TEST_SMALL) {
+ if (size_of_test & TEST_SMALL) {
status = test_sub_super((size_t)5, (size_t)10);
nerrors += status < 0 ? 1 : 0;
} /* end if */
- if(size_of_test & TEST_MEDIUM) {
+ if (size_of_test & TEST_MEDIUM) {
status = test_sub_super((size_t)480, (size_t)640);
nerrors += status < 0 ? 1 : 0;
} /* end if */
@@ -1396,11 +1359,11 @@ main(int argc, char *argv[])
* TEST ARRAY FILL OPERATIONS
*-------------------------
*/
- if(size_of_test & TEST_SMALL) {
+ if (size_of_test & TEST_SMALL) {
status = test_array_fill((size_t)1, (size_t)9);
nerrors += status < 0 ? 1 : 0;
} /* end if */
- if(size_of_test & TEST_MEDIUM) {
+ if (size_of_test & TEST_MEDIUM) {
status = test_array_fill((size_t)9, (size_t)257);
nerrors += status < 0 ? 1 : 0;
} /* end if */
@@ -1409,23 +1372,20 @@ main(int argc, char *argv[])
* TEST ARRAY OFFSET OPERATIONS
*-------------------------
*/
- if(size_of_test & TEST_SMALL) {
- status = test_array_offset_n_calc((size_t)20, (size_t)7, (size_t)11,
- (size_t)13);
+ if (size_of_test & TEST_SMALL) {
+ status = test_array_offset_n_calc((size_t)20, (size_t)7, (size_t)11, (size_t)13);
nerrors += status < 0 ? 1 : 0;
} /* end if */
- if(size_of_test & TEST_MEDIUM) {
- status = test_array_offset_n_calc((size_t)500, (size_t)71,
- (size_t)193, (size_t)347);
+ if (size_of_test & TEST_MEDIUM) {
+ status = test_array_offset_n_calc((size_t)500, (size_t)71, (size_t)193, (size_t)347);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/*--- END OF TESTS ---*/
- if(nerrors) {
- HDprintf("***** %d HYPERSLAB TEST%s FAILED! *****\n", nerrors, 1
- == nerrors ? "" : "S");
- if(HDisatty(1))
+ if (nerrors) {
+ HDprintf("***** %d HYPERSLAB TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
+ if (HDisatty(1))
HDprintf("(Redirect output to a pager or a file to see debug output)\n");
HDexit(EXIT_FAILURE);
} /* end if */
@@ -1434,8 +1394,7 @@ main(int argc, char *argv[])
#ifdef H5_HAVE_THREADSAFE
H5close();
-#endif /* H5_HAVE_THREADSAFE */
+#endif /* H5_HAVE_THREADSAFE */
HDexit(EXIT_SUCCESS);
}
-
diff --git a/test/istore.c b/test/istore.c
index e80f260..a724359 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -17,7 +17,7 @@
* Purpose: Tests various aspects of indexed raw data storage.
*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "h5test.h"
@@ -29,26 +29,21 @@
#include "H5Oprivate.h"
#include "H5VMprivate.h"
-const char *FILENAME[] = {
- "istore",
- NULL
-};
+const char *FILENAME[] = {"istore", NULL};
-
-#define TEST_SMALL 0x0001
-#define TEST_MEDIUM 0x0002
-#define TEST_LARGE 0x0004
+#define TEST_SMALL 0x0001
+#define TEST_MEDIUM 0x0002
+#define TEST_LARGE 0x0004
/* The datatype of the dataset operated on by this test */
-#define TEST_DATATYPE H5T_NATIVE_UCHAR
+#define TEST_DATATYPE H5T_NATIVE_UCHAR
-#define TEST_CHUNK_SIZE 50
+#define TEST_CHUNK_SIZE 50
#define TEST_SPARSE_SIZE 1000000
hsize_t chunk_dims[H5O_LAYOUT_NDIMS];
hsize_t zero[H5O_LAYOUT_NDIMS];
-
/*-------------------------------------------------------------------------
* Function: is_sparse
*
@@ -68,23 +63,28 @@ hsize_t zero[H5O_LAYOUT_NDIMS];
static int
is_sparse(void)
{
- int fd;
- h5_stat_t sb;
-
- if ((fd = HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) return 0;
- if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
- if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
- if (HDclose(fd) < 0) return 0;
- if (HDstat("x.h5", &sb) < 0) return 0;
- if (HDremove("x.h5") < 0) return 0;
+ int fd;
+ h5_stat_t sb;
+
+ if ((fd = HDopen("x.h5", O_RDWR | O_TRUNC | O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0)
+ return 0;
+ if (HDlseek(fd, (off_t)(1024 * 1024), SEEK_SET) != 1024 * 1024)
+ return 0;
+ if (5 != HDwrite(fd, "hello", (size_t)5))
+ return 0;
+ if (HDclose(fd) < 0)
+ return 0;
+ if (HDstat("x.h5", &sb) < 0)
+ return 0;
+ if (HDremove("x.h5") < 0)
+ return 0;
#ifdef H5_HAVE_STAT_ST_BLOCKS
- return ((unsigned long)sb.st_blocks*512 < (unsigned long)sb.st_size);
+ return ((unsigned long)sb.st_blocks * 512 < (unsigned long)sb.st_size);
#else
return (0);
#endif
}
-
/*-------------------------------------------------------------------------
* Function: print_array
*
@@ -102,29 +102,29 @@ is_sparse(void)
static void
print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
- size_t i, j, k;
+ size_t i, j, k;
for (i = 0; i < nx; i++) {
- if (nz > 1) {
- HDfprintf(stderr,"i=%lu:\n", (unsigned long)i);
- } else {
- HDfprintf(stderr,"%03lu:", (unsigned long)i);
- }
+ if (nz > 1) {
+ HDfprintf(stderr, "i=%lu:\n", (unsigned long)i);
+ }
+ else {
+ HDfprintf(stderr, "%03lu:", (unsigned long)i);
+ }
- for (j = 0; j < ny; j++) {
- if (nz > 1)
- HDfprintf(stderr,"%03lu:", (unsigned long)j);
- for (k = 0; k < nz; k++) {
- HDfprintf(stderr," %3d", *array++);
+ for (j = 0; j < ny; j++) {
+ if (nz > 1)
+ HDfprintf(stderr, "%03lu:", (unsigned long)j);
+ for (k = 0; k < nz; k++) {
+ HDfprintf(stderr, " %3d", *array++);
+ }
+ if (nz > 1)
+ HDfprintf(stderr, "\n");
}
- if (nz > 1)
- HDfprintf(stderr,"\n");
- }
- HDfprintf(stderr,"\n");
+ HDfprintf(stderr, "\n");
}
}
-
/*-------------------------------------------------------------------------
* Function: new_object
*
@@ -150,29 +150,35 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
static hid_t
new_object(hid_t f, const char *name, int ndims, hsize_t dims[], hsize_t cdims[])
{
- hid_t dataset; /* Dataset ID */
- hid_t space; /* Dataspace ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t space; /* Dataspace ID */
+ hid_t dcpl; /* Dataset creation property list ID */
/* Create the dataset creation property list */
- if ((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
/* Set the chunk dimensions */
- if(H5Pset_chunk(dcpl, ndims, cdims) < 0) TEST_ERROR;
+ if (H5Pset_chunk(dcpl, ndims, cdims) < 0)
+ TEST_ERROR;
/* Create the dataspace */
- if((space = H5Screate_simple(ndims, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(ndims, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create the dataset */
- if((dataset = H5Dcreate2(f, name, TEST_DATATYPE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dcreate2(f, name, TEST_DATATYPE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Clean up */
/* Close property lists */
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
return dataset;
@@ -180,7 +186,6 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -201,11 +206,11 @@ error:
static herr_t
test_create(hid_t f, const char *prefix)
{
- hid_t dataset; /* Dataset ID */
- hsize_t dims[H5O_LAYOUT_NDIMS+1]; /* Dimensions of dataset */
- hsize_t my_chunk_dims[H5O_LAYOUT_NDIMS+1]; /* Dimensions of chunks */
- char name[256]; /* Dataset name */
- unsigned u; /* Local index variable */
+ hid_t dataset; /* Dataset ID */
+ hsize_t dims[H5O_LAYOUT_NDIMS + 1]; /* Dimensions of dataset */
+ hsize_t my_chunk_dims[H5O_LAYOUT_NDIMS + 1]; /* Dimensions of chunks */
+ char name[256]; /* Dataset name */
+ unsigned u; /* Local index variable */
TESTING("istore create");
@@ -216,11 +221,11 @@ test_create(hid_t f, const char *prefix)
/* Create chunked dataset of this dimensionality */
HDsnprintf(name, sizeof name, "%s_%02u", prefix, u);
- if((dataset = new_object(f, name, (int)u, dims, my_chunk_dims)) < 0)
+ if ((dataset = new_object(f, name, (int)u, dims, my_chunk_dims)) < 0)
return FAIL;
/* Close dataset created */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
return FAIL;
}
@@ -228,7 +233,6 @@ test_create(hid_t f, const char *prefix)
return SUCCEED;
}
-
/*-------------------------------------------------------------------------
* Function: test_extend
*
@@ -248,41 +252,41 @@ test_create(hid_t f, const char *prefix)
*-------------------------------------------------------------------------
*/
static herr_t
-test_extend(hid_t f, const char *prefix,
- size_t nx, size_t ny, size_t nz)
+test_extend(hid_t f, const char *prefix, size_t nx, size_t ny, size_t nz)
{
- hid_t dataset; /* Dataset ID */
- hid_t fspace; /* Dataset's file dataspace */
- hid_t mspace; /* Dataset's memory dataspace */
- size_t i, j, k, ctr;
- int ndims;
- uint8_t *buf = NULL, *check = NULL, *whole = NULL;
- char dims[64], s[256], name[256];
- hsize_t offset[3];
- hsize_t max_corner[3];
- hsize_t size[3];
- hsize_t whole_size[3];
- hsize_t nelmts;
+ hid_t dataset; /* Dataset ID */
+ hid_t fspace; /* Dataset's file dataspace */
+ hid_t mspace; /* Dataset's memory dataspace */
+ size_t i, j, k, ctr;
+ int ndims;
+ uint8_t *buf = NULL, *check = NULL, *whole = NULL;
+ char dims[64], s[256], name[256];
+ hsize_t offset[3];
+ hsize_t max_corner[3];
+ hsize_t size[3];
+ hsize_t whole_size[3];
+ hsize_t nelmts;
if (!nz) {
- if (!ny) {
- ndims = 1;
- ny = nz = 1;
- HDsprintf(dims, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- HDsprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ if (!ny) {
+ ndims = 1;
+ ny = nz = 1;
+ HDsprintf(dims, "%lu", (unsigned long)nx);
+ }
+ else {
+ ndims = 2;
+ nz = 1;
+ HDsprintf(dims, "%lux%lu", (unsigned long)nx, (unsigned long)ny);
+ }
}
- } else {
- ndims = 3;
- HDsprintf(dims, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
+ else {
+ ndims = 3;
+ HDsprintf(dims, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
}
HDsprintf(s, "istore extend: %s", dims);
TESTING(s);
- buf = (uint8_t *)HDmalloc(nx * ny * nz);
+ buf = (uint8_t *)HDmalloc(nx * ny * nz);
check = (uint8_t *)HDmalloc(nx * ny * nz);
whole = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz);
@@ -295,35 +299,36 @@ test_extend(hid_t f, const char *prefix,
/* Build the new empty object */
HDsprintf(name, "%s_%s", prefix, dims);
- if ((dataset=new_object(f, name, ndims, whole_size, whole_size)) < 0) {
- HDfprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name);
+ if ((dataset = new_object(f, name, ndims, whole_size, whole_size)) < 0) {
+ HDfprintf(stderr, " Cannot create %u-d object `%s'\n", ndims, name);
goto error;
}
/* Get dataset's dataspace */
- if((fspace=H5Dget_space(dataset)) < 0) TEST_ERROR;
-
- for (ctr = 0;
- H5VM_vector_lt_u((unsigned)ndims, max_corner, whole_size);
- ctr++) {
-
- /* Size and location */
- if (0 == ctr) {
- offset[0] = offset[1] = offset[2] = 0;
- size[0] = size[1] = size[2] = 1;
- nelmts = 1;
- } else {
- for (i=0, nelmts=1; i<(size_t)ndims; i++) {
- if (ctr % (size_t)ndims == i) {
- offset[i] = max_corner[i];
- size[i] = MIN(1, whole_size[i] - offset[i]);
- } else {
- offset[i] = 0;
- size[i] = max_corner[i];
+ if ((fspace = H5Dget_space(dataset)) < 0)
+ TEST_ERROR;
+
+ for (ctr = 0; H5VM_vector_lt_u((unsigned)ndims, max_corner, whole_size); ctr++) {
+
+ /* Size and location */
+ if (0 == ctr) {
+ offset[0] = offset[1] = offset[2] = 0;
+ size[0] = size[1] = size[2] = 1;
+ nelmts = 1;
}
- nelmts *= size[i];
+ else {
+ for (i = 0, nelmts = 1; i < (size_t)ndims; i++) {
+ if (ctr % (size_t)ndims == i) {
+ offset[i] = max_corner[i];
+ size[i] = MIN(1, whole_size[i] - offset[i]);
+ }
+ else {
+ offset[i] = 0;
+ size[i] = max_corner[i];
+ }
+ nelmts *= size[i];
+ }
}
- }
#if 0
if (0 == ctr)
@@ -344,89 +349,92 @@ test_extend(hid_t f, const char *prefix,
HDfprintf(stderr,"\n");
#endif
- /* Fill the source array */
- if (0 == nelmts) continue;
- HDmemset(buf, (signed)(128+ctr), (size_t)nelmts);
+ /* Fill the source array */
+ if (0 == nelmts)
+ continue;
+ HDmemset(buf, (signed)(128 + ctr), (size_t)nelmts);
/* Create dataspace for selection in memory */
- if((mspace=H5Screate_simple(1,&nelmts,NULL)) < 0) TEST_ERROR;
+ if ((mspace = H5Screate_simple(1, &nelmts, NULL)) < 0)
+ TEST_ERROR;
/* Select region in file dataspace */
- if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL) < 0) TEST_ERROR;
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, offset, NULL, size, NULL) < 0)
+ TEST_ERROR;
- /* Write to disk */
- if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
- H5_FAILED();
- HDfprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr);
- goto error;
- }
+ /* Write to disk */
+ if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED();
+ HDfprintf(stderr, " Write failed: ctr=%lu\n", (unsigned long)ctr);
+ goto error;
+ }
- /* Read from disk */
- HDmemset(check, 0xff, (size_t)nelmts);
- if (H5Dread(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, check) < 0) {
- H5_FAILED();
- HDfprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr);
- goto error;
- }
- if (HDmemcmp(buf, check, (size_t)nelmts)) {
- H5_FAILED();
- HDfprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr);
- HDfprintf(stderr," Wrote:\n");
- print_array(buf, (size_t)size[0], (size_t)size[1],
- (size_t)size[2]);
- HDfprintf(stderr," Read:\n");
- print_array(check, (size_t)size[0], (size_t)size[1],
- (size_t)size[2]);
- goto error;
- }
+ /* Read from disk */
+ HDmemset(check, 0xff, (size_t)nelmts);
+ if (H5Dread(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, check) < 0) {
+ H5_FAILED();
+ HDfprintf(stderr, " Read failed: ctr=%lu\n", (unsigned long)ctr);
+ goto error;
+ }
+ if (HDmemcmp(buf, check, (size_t)nelmts)) {
+ H5_FAILED();
+ HDfprintf(stderr, " Read check failed: ctr=%lu\n", (unsigned long)ctr);
+ HDfprintf(stderr, " Wrote:\n");
+ print_array(buf, (size_t)size[0], (size_t)size[1], (size_t)size[2]);
+ HDfprintf(stderr, " Read:\n");
+ print_array(check, (size_t)size[0], (size_t)size[1], (size_t)size[2]);
+ goto error;
+ }
/* Close memory dataspace */
- if(H5Sclose(mspace) < 0) TEST_ERROR;
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR;
- /* Write to `whole' buffer for later checking */
- H5VM_hyper_copy((unsigned)ndims, size,
- whole_size, offset, whole, /*dst*/
- size, H5VM_ZERO, buf); /*src*/
+ /* Write to `whole' buffer for later checking */
+ H5VM_hyper_copy((unsigned)ndims, size, whole_size, offset, whole, /*dst*/
+ size, H5VM_ZERO, buf); /*src*/
- /* Update max corner */
- for (i=0; i<(size_t)ndims; i++)
- max_corner[i] = MAX(max_corner[i], offset[i]+size[i]);
+ /* Update max corner */
+ for (i = 0; i < (size_t)ndims; i++)
+ max_corner[i] = MAX(max_corner[i], offset[i] + size[i]);
}
/* Now read the entire array back out and check it */
HDmemset(buf, 0xff, nx * ny * nz);
if (H5Dread(dataset, TEST_DATATYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5_FAILED();
- HDfprintf(stderr," Read failed for whole array.\n");
- goto error;
+ H5_FAILED();
+ HDfprintf(stderr, " Read failed for whole array.\n");
+ goto error;
}
- for (i=0; i<nx; i++) {
- for (j=0; j<ny; j++) {
- for (k=0; k<nz; k++) {
- if (whole[i*ny*nz + j*nz + k] != buf[i*ny*nz + j*nz + k]) {
- H5_FAILED();
- HDfprintf(stderr," Check failed at i=%lu", (unsigned long)i);
- if (ndims > 1) {
- HDfprintf(stderr,", j=%lu", (unsigned long)j);
- }
- if (ndims > 2) {
- HDfprintf(stderr,", k=%lu", (unsigned long)k);
+ for (i = 0; i < nx; i++) {
+ for (j = 0; j < ny; j++) {
+ for (k = 0; k < nz; k++) {
+ if (whole[i * ny * nz + j * nz + k] != buf[i * ny * nz + j * nz + k]) {
+ H5_FAILED();
+ HDfprintf(stderr, " Check failed at i=%lu", (unsigned long)i);
+ if (ndims > 1) {
+ HDfprintf(stderr, ", j=%lu", (unsigned long)j);
+ }
+ if (ndims > 2) {
+ HDfprintf(stderr, ", k=%lu", (unsigned long)k);
+ }
+ HDfprintf(stderr, "\n Check array is:\n");
+ print_array(whole, nx, ny, nz);
+ HDfprintf(stderr, " Value read is:\n");
+ print_array(buf, nx, ny, nz);
+ goto error;
+ }
}
- HDfprintf(stderr,"\n Check array is:\n");
- print_array(whole, nx, ny, nz);
- HDfprintf(stderr," Value read is:\n");
- print_array(buf, nx, ny, nz);
- goto error;
}
- }
- }
}
/* Close dataset's dataspace */
- if(H5Sclose(fspace) < 0) TEST_ERROR;
+ if (H5Sclose(fspace) < 0)
+ TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Free memory used */
HDfree(buf);
@@ -443,7 +451,6 @@ error:
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: test_sparse
*
@@ -462,40 +469,40 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_sparse(hid_t f, const char *prefix, size_t nblocks,
- size_t nx, size_t ny, size_t nz, int skip_test)
+test_sparse(hid_t f, const char *prefix, size_t nblocks, size_t nx, size_t ny, size_t nz, int skip_test)
{
- hid_t dataset; /* Dataset ID */
- hid_t fspace; /* Dataset's file dataspace */
- hid_t mspace; /* Dataset's memory dataspace */
- int ndims;
- hsize_t ctr;
- char dims[64], s[256], name[256];
- hsize_t offset[3];
- hsize_t size[3], total = 0;
- uint8_t *buf = NULL;
- hsize_t whole_size[3]; /* Size of dataset's dataspace */
- size_t u; /* Local index variable */
+ hid_t dataset; /* Dataset ID */
+ hid_t fspace; /* Dataset's file dataspace */
+ hid_t mspace; /* Dataset's memory dataspace */
+ int ndims;
+ hsize_t ctr;
+ char dims[64], s[256], name[256];
+ hsize_t offset[3];
+ hsize_t size[3], total = 0;
+ uint8_t *buf = NULL;
+ hsize_t whole_size[3]; /* Size of dataset's dataspace */
+ size_t u; /* Local index variable */
if (!nz) {
- if (!ny) {
- ndims = 1;
- ny = nz = 1;
- HDsprintf(dims, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- HDsprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ if (!ny) {
+ ndims = 1;
+ ny = nz = 1;
+ HDsprintf(dims, "%lu", (unsigned long)nx);
+ }
+ else {
+ ndims = 2;
+ nz = 1;
+ HDsprintf(dims, "%lux%lu", (unsigned long)nx, (unsigned long)ny);
+ }
}
- } else {
- ndims = 3;
- HDsprintf(dims, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
+ else {
+ ndims = 3;
+ HDsprintf(dims, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
}
HDsprintf(s, "istore sparse: %s", dims);
TESTING(s);
- if(skip_test){
+ if (skip_test) {
SKIPPED()
return SUCCEED;
}
@@ -503,8 +510,8 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
HDmemset(buf, 128, nx * ny * nz);
/* Set dimensions of dataset */
- for (u=0; u<(size_t)ndims; u++)
- whole_size[u]=TEST_SPARSE_SIZE;
+ for (u = 0; u < (size_t)ndims; u++)
+ whole_size[u] = TEST_SPARSE_SIZE;
/* Set dimensions of selection */
size[0] = nx;
@@ -513,58 +520,64 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
/* Build the new empty object */
HDsprintf(name, "%s_%s", prefix, dims);
- if ((dataset=new_object(f, name, ndims, whole_size, chunk_dims)) < 0) {
+ if ((dataset = new_object(f, name, ndims, whole_size, chunk_dims)) < 0) {
HDprintf(" Cannot create %u-d object `%s'\n", ndims, name);
goto error;
}
/* Get dataset's dataspace */
- if((fspace=H5Dget_space(dataset)) < 0) TEST_ERROR;
+ if ((fspace = H5Dget_space(dataset)) < 0)
+ TEST_ERROR;
/* Create dataspace for memory buffer */
- if((mspace=H5Screate_simple(ndims,size,NULL)) < 0) TEST_ERROR;
+ if ((mspace = H5Screate_simple(ndims, size, NULL)) < 0)
+ TEST_ERROR;
- for (ctr=0; ctr<nblocks; ctr++) {
- offset[0] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE-nx));
- offset[1] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE-ny));
- offset[2] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE-nz));
+ for (ctr = 0; ctr < nblocks; ctr++) {
+ offset[0] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE - nx));
+ offset[1] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE - ny));
+ offset[2] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE - nz));
/* Select region in file dataspace */
- if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL) < 0) TEST_ERROR;
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, offset, NULL, size, NULL) < 0)
+ TEST_ERROR;
- /* write to disk */
- if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
- H5_FAILED();
- HDprintf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
- HDprintf(" offset=(%lu", (unsigned long) (offset[0]));
- if (ndims > 1)
- HDprintf(",%lu", (unsigned long) (offset[1]));
- if (ndims > 2)
- HDprintf(",%lu", (unsigned long) (offset[2]));
- HDprintf("), size=(%lu", (unsigned long) (size[0]));
- if (ndims > 1)
- HDprintf(",%lu", (unsigned long) (size[1]));
- if (ndims > 2)
- HDprintf(",%lu", (unsigned long) (size[2]));
- HDprintf(")\n");
- goto error;
- }
- total += nx * ny * nz;
+ /* write to disk */
+ if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED();
+ HDprintf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
+ HDprintf(" offset=(%lu", (unsigned long)(offset[0]));
+ if (ndims > 1)
+ HDprintf(",%lu", (unsigned long)(offset[1]));
+ if (ndims > 2)
+ HDprintf(",%lu", (unsigned long)(offset[2]));
+ HDprintf("), size=(%lu", (unsigned long)(size[0]));
+ if (ndims > 1)
+ HDprintf(",%lu", (unsigned long)(size[1]));
+ if (ndims > 2)
+ HDprintf(",%lu", (unsigned long)(size[2]));
+ HDprintf(")\n");
+ goto error;
+ }
+ total += nx * ny * nz;
#if 0
HDfprintf(stderr,"ctr: ctr=%Zu, total=%Zu\n", ctr, total);
#endif
- /* We don't test reading yet.... */
+ /* We don't test reading yet.... */
}
/* Close memory dataspace */
- if(H5Sclose(mspace) < 0) TEST_ERROR;
+ if (H5Sclose(mspace) < 0)
+ TEST_ERROR;
/* Close dataset's dataspace */
- if(H5Sclose(fspace) < 0) TEST_ERROR;
+ if (H5Sclose(fspace) < 0)
+ TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
HDfree(buf);
PASSED();
@@ -575,7 +588,6 @@ error:
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -591,28 +603,32 @@ error:
int
main(int argc, char *argv[])
{
- hid_t fapl=-1, file=-1, fcpl=-1;
- herr_t status;
- int nerrors = 0;
- unsigned size_of_test;
- unsigned u; /* Local index variable */
- char filename[1024];
- int skip_test = 0;
- int has_sparse_support = 0;
+ hid_t fapl = -1, file = -1, fcpl = -1;
+ herr_t status;
+ int nerrors = 0;
+ unsigned size_of_test;
+ unsigned u; /* Local index variable */
+ char filename[1024];
+ int skip_test = 0;
+ int has_sparse_support = 0;
/* Parse arguments or assume these tests (`small', `medium' ) */
if (1 == argc) {
size_of_test = TEST_SMALL | TEST_MEDIUM | TEST_LARGE;
- } else {
- int i;
+ }
+ else {
+ int i;
for (i = 1, size_of_test = 0; i < argc; i++) {
if (!strcmp(argv[i], "small")) {
size_of_test |= TEST_SMALL;
- } else if (!strcmp(argv[i], "medium")) {
+ }
+ else if (!strcmp(argv[i], "medium")) {
size_of_test |= TEST_MEDIUM;
- } else if (!strcmp(argv[i], "large")) {
+ }
+ else if (!strcmp(argv[i], "large")) {
size_of_test |= TEST_LARGE;
- } else {
+ }
+ else {
HDprintf("unrecognized argument: %s\n", argv[i]);
}
}
@@ -645,19 +661,19 @@ main(int argc, char *argv[])
/* Create the test file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
HDprintf("Cannot create file %s; test aborted\n", filename);
HDexit(EXIT_FAILURE);
}
/* Initialize chunk dimensions */
- for(u = 0; u < H5O_LAYOUT_NDIMS; u++)
+ for (u = 0; u < H5O_LAYOUT_NDIMS; u++)
chunk_dims[u] = TEST_CHUNK_SIZE;
/*
- * Creation test: Creates empty objects with various raw data sizes
- * and alignments.
- */
+ * Creation test: Creates empty objects with various raw data sizes
+ * and alignments.
+ */
status = test_create(file, "create");
nerrors += status < 0 ? 1 : 0;
@@ -700,7 +716,7 @@ main(int argc, char *argv[])
* e.g.: Windows NTFS filesystems
*/
status = test_sparse(file, "sparse", (size_t)800, (size_t)50, (size_t)50, (size_t)50, skip_test);
- if(skip_test)
+ if (skip_test)
HDprintf(" The current VFD does not support sparse files on this platform.\n");
nerrors += status < 0 ? 1 : 0;
}
@@ -713,8 +729,7 @@ main(int argc, char *argv[])
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
if (nerrors) {
- HDprintf("***** %d I-STORE TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d I-STORE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
}
@@ -724,4 +739,3 @@ main(int argc, char *argv[])
HDexit(EXIT_SUCCESS);
}
-
diff --git a/test/lheap.c b/test/lheap.c
index dd430a3..17e3082 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -20,20 +20,16 @@
#include "h5test.h"
#include "H5srcdir.h"
#include "H5ACprivate.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5HLprivate.h"
#include "H5Iprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
-const char *FILENAME[] = {
- "lheap",
- NULL
-};
+const char *FILENAME[] = {"lheap", NULL};
#define TESTFILE "tsizeslheap.h5"
-#define NOBJS 40
-
+#define NOBJS 40
/*-------------------------------------------------------------------------
* Function: main
@@ -52,24 +48,25 @@ const char *FILENAME[] = {
int
main(void)
{
- hid_t fapl = H5P_DEFAULT; /* file access properties */
- hid_t file = -1; /* hdf5 file */
- H5F_t *f = NULL; /* hdf5 file pointer */
- char filename[1024]; /* file name */
- haddr_t heap_addr; /* local heap address */
- H5HL_t *heap = NULL; /* local heap */
- size_t obj[NOBJS]; /* offsets within the heap */
- int i, j; /* miscellaneous counters */
- char buf[1024]; /* the value to store */
- const char *s; /* value to read */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t fapl = H5P_DEFAULT; /* file access properties */
+ hid_t file = -1; /* hdf5 file */
+ H5F_t * f = NULL; /* hdf5 file pointer */
+ char filename[1024]; /* file name */
+ haddr_t heap_addr; /* local heap address */
+ H5HL_t * heap = NULL; /* local heap */
+ size_t obj[NOBJS]; /* offsets within the heap */
+ int i, j; /* miscellaneous counters */
+ char buf[1024]; /* the value to store */
+ const char *s; /* value to read */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Reset library */
h5_reset();
fapl = h5_fileaccess();
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/*
@@ -77,42 +74,42 @@ main(void)
*/
TESTING("local heap write");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if(FAIL == (file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)))
+ if (FAIL == (file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)))
goto error;
- if(NULL == (f = (H5F_t *)H5VL_object(file))) {
+ if (NULL == (f = (H5F_t *)H5VL_object(file))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- if(FAIL == H5AC_ignore_tags(f)) {
+ if (FAIL == H5AC_ignore_tags(f)) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- if(FAIL == H5HL_create(f, (size_t)0, &heap_addr/*out*/)) {
+ if (FAIL == H5HL_create(f, (size_t)0, &heap_addr /*out*/)) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) {
+ if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- for(i = 0; i < NOBJS; i++) {
+ for (i = 0; i < NOBJS; i++) {
HDsprintf(buf, "%03d-", i);
- for(j = 4; j < i; j++)
+ for (j = 4; j < i; j++)
buf[j] = (char)('0' + j % 10);
- if(j > 4)
+ if (j > 4)
buf[j] = '\0';
- if(UFAIL == (obj[i] = H5HL_insert(f, heap, strlen(buf) + 1, buf))) {
+ if (UFAIL == (obj[i] = H5HL_insert(f, heap, strlen(buf) + 1, buf))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
}
- if(FAIL == H5HL_unprotect(heap)) {
+ if (FAIL == H5HL_unprotect(heap)) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
@@ -127,9 +124,9 @@ main(void)
TESTING("local heap read");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if(FAIL == (file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)))
+ if (FAIL == (file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)))
goto error;
- if(NULL == (f = (H5F_t *)H5VL_object(file))) {
+ if (NULL == (f = (H5F_t *)H5VL_object(file))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
@@ -139,14 +136,14 @@ main(void)
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- for(i = 0; i < NOBJS; i++) {
+ for (i = 0; i < NOBJS; i++) {
HDsprintf(buf, "%03d-", i);
- for(j = 4; j < i; j++)
+ for (j = 4; j < i; j++)
buf[j] = (char)('0' + j % 10);
- if(j > 4)
+ if (j > 4)
buf[j] = '\0';
- if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) {
+ if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
@@ -166,7 +163,7 @@ main(void)
goto error;
}
- if(FAIL == H5HL_unprotect(heap)) {
+ if (FAIL == H5HL_unprotect(heap)) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
@@ -181,30 +178,31 @@ main(void)
TESTING("opening pre-created file with non-default sizes");
{
const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
- hid_t dset = -1;
- file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
- if(file >= 0){
- if((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0)
+ hid_t dset = -1;
+ file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
+ if (file >= 0) {
+ if ((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
}
else {
H5_FAILED();
- HDprintf("***cannot open the pre-created non-default sizes test file (%s)\n",
- testfile);
+ HDprintf("***cannot open the pre-created non-default sizes test file (%s)\n", testfile);
goto error;
} /* end else */
}
PASSED();
/* Verify symbol table messages are cached */
- if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
+ if (h5_verify_cached_stabs(FILENAME, fapl) < 0)
+ TEST_ERROR
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
HDputs("All local heap tests passed.");
@@ -212,14 +210,13 @@ main(void)
return EXIT_SUCCESS;
- error:
+error:
HDputs("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
return EXIT_FAILURE;
}
-
diff --git a/test/links.c b/test/links.c
index cd9f05c..43cd83d 100644
--- a/test/links.c
+++ b/test/links.c
@@ -19,14 +19,14 @@
* This file needs to access private information from the H5FD package.
* This file also needs to access the file driver testing code.
*/
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
/*
* This file needs to access private information from the H5G package.
* This file also needs to access the group testing code.
*/
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#define H5G_TESTING
#include "h5test.h"
@@ -38,104 +38,104 @@
#include "H5VLnative_private.h" /* Native VOL connector */
/* File for external link test. Created with gen_udlinks.c */
-#define LINKED_FILE "be_extlink2.h5"
+#define LINKED_FILE "be_extlink2.h5"
-#define TMPDIR "tmp_links/"
-#define TMPDIR2 "tmp2_links/"
+#define TMPDIR "tmp_links/"
+#define TMPDIR2 "tmp2_links/"
/* Symlinks for external link symlink test */
-#define SYMLINK1 TMPDIR "sym1.h5"
-#define SYMLINK2 TMPDIR2 "sym2.h5"
-
-const char *FILENAME[] = {
- "links0",
- "links1",
- "links2",
- "links3",
- "links4a", /* 4 */
- "links4b", /* 5 */
- "links4c", /* 6 */
- "links4d", /* 7 */
- "links5", /* 8 */
- "links6", /* 9 */
- "links7", /* 10 */
- "links8", /* 11 */
- "extlinks0", /* 12: main files */
- TMPDIR "extlinks0", /* 13: */
- "extlinks1", /* 14: target files */
- TMPDIR "extlinks1", /* 15: */
- "extlinks2", /* 16: */
- TMPDIR "extlinks2", /* 17: */
- "extlinks3", /* 18: */
- TMPDIR "extlinks3", /* 19: */
- "extlinks4", /* 20: */
- TMPDIR "extlinks4", /* 21: */
- "extlinks5", /* 22: */
- TMPDIR "extlinks6", /* 23: */
- "extlinks7", /* 24: */
- TMPDIR "extlinks7", /* 25: */
- TMPDIR "extlinks8", /* 26: */
- "extlinks9", /* 27: */
- TMPDIR "extlinks9", /* 28: */
- "extlinks10", /* 29: */ /* TESTS for windows */
- TMPDIR "extlinks10", /* 30: */
- TMPDIR "extlinks11", /* 31: */
- TMPDIR "extlinks12", /* 32: */
- "extlinks13", /* 33: */
- TMPDIR "extlinks13", /* 34: */
- TMPDIR "extlinks14", /* 35: */
- TMPDIR "extlinks15", /* 36: */
- "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */
- "extlinks16B", /* 38: */
- "extlinks17", /* 39: */
- "extlinks18A", /* 40: */
- "extlinks18B", /* 41: */
- "extlinks19A", /* 42: */
- "extlinks19B", /* 43: */
- "extlinks20", /* 44: */
- "extlinks21A", /* 45: Files for symlink() tests*/
- TMPDIR2 "extlinks21B", /* 46: */
- TMPDIR2 "extlinks21C", /* 47: */
- "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */
- TMPDIR "extlinks21D", /* 49: */
- TMPDIR "extlinks21E", /* 50: */
- "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */
- NULL
-};
-
-#define FAMILY_SIZE 1024
-#define CORE_INCREMENT 1024
-#define NUM40 40
+#define SYMLINK1 TMPDIR "sym1.h5"
+#define SYMLINK2 TMPDIR2 "sym2.h5"
+
+const char *FILENAME[] = {"links0",
+ "links1",
+ "links2",
+ "links3",
+ "links4a", /* 4 */
+ "links4b", /* 5 */
+ "links4c", /* 6 */
+ "links4d", /* 7 */
+ "links5", /* 8 */
+ "links6", /* 9 */
+ "links7", /* 10 */
+ "links8", /* 11 */
+ "extlinks0", /* 12: main files */
+ TMPDIR "extlinks0", /* 13: */
+ "extlinks1", /* 14: target files */
+ TMPDIR "extlinks1", /* 15: */
+ "extlinks2", /* 16: */
+ TMPDIR "extlinks2", /* 17: */
+ "extlinks3", /* 18: */
+ TMPDIR "extlinks3", /* 19: */
+ "extlinks4", /* 20: */
+ TMPDIR "extlinks4", /* 21: */
+ "extlinks5", /* 22: */
+ TMPDIR "extlinks6", /* 23: */
+ "extlinks7", /* 24: */
+ TMPDIR "extlinks7", /* 25: */
+ TMPDIR "extlinks8", /* 26: */
+ "extlinks9", /* 27: */
+ TMPDIR "extlinks9", /* 28: */
+ "extlinks10",
+ /* 29: */ /* TESTS for windows */
+ TMPDIR "extlinks10", /* 30: */
+ TMPDIR "extlinks11", /* 31: */
+ TMPDIR "extlinks12", /* 32: */
+ "extlinks13", /* 33: */
+ TMPDIR "extlinks13", /* 34: */
+ TMPDIR "extlinks14", /* 35: */
+ TMPDIR "extlinks15", /* 36: */
+ "extlinks16A",
+ /* 37: */ /* TESTS for H5P_set_elink_fapl */
+ "extlinks16B", /* 38: */
+ "extlinks17", /* 39: */
+ "extlinks18A", /* 40: */
+ "extlinks18B", /* 41: */
+ "extlinks19A", /* 42: */
+ "extlinks19B", /* 43: */
+ "extlinks20", /* 44: */
+ "extlinks21A", /* 45: Files for symlink() tests*/
+ TMPDIR2 "extlinks21B", /* 46: */
+ TMPDIR2 "extlinks21C", /* 47: */
+ "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */
+ TMPDIR "extlinks21D", /* 49: */
+ TMPDIR "extlinks21E", /* 50: */
+ "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */
+ NULL};
+
+#define FAMILY_SIZE 1024
+#define CORE_INCREMENT 1024
+#define NUM40 40
/* do not do check_all_closed() for "ext*" files and "tmp_links/ext*" */
-#define EXTSTOP 12
+#define EXTSTOP 12
-#define LINK_BUF_SIZE 1024
-#define NAME_BUF_SIZE 1024
-#define MAX_NAME_LEN ((64*1024)+1024)
+#define LINK_BUF_SIZE 1024
+#define NAME_BUF_SIZE 1024
+#define MAX_NAME_LEN ((64 * 1024) + 1024)
/* Link type IDs */
-#define UD_HARD_TYPE 201
-#define UD_CB_TYPE H5L_TYPE_MAX
-#define UD_PLIST_TYPE 128
+#define UD_HARD_TYPE 201
+#define UD_CB_TYPE H5L_TYPE_MAX
+#define UD_PLIST_TYPE 128
#define UD_CBFAIL_TYPE UD_PLIST_TYPE
-#define UD_ERROR_TYPE 189
-#define UD_BAD_TYPE1 H5L_TYPE_HARD
-#define UD_BAD_TYPE2 (H5L_TYPE_UD_MIN - 5)
-#define UD_BAD_VERS (H5L_LINK_CLASS_T_VERS + 1)
+#define UD_ERROR_TYPE 189
+#define UD_BAD_TYPE1 H5L_TYPE_HARD
+#define UD_BAD_TYPE2 (H5L_TYPE_UD_MIN - 5)
+#define UD_BAD_VERS (H5L_LINK_CLASS_T_VERS + 1)
-#define DEST_PROP_NAME "destination_group"
+#define DEST_PROP_NAME "destination_group"
#define REREG_TARGET_NAME "rereg_target"
-#define UD_CB_LINK_NAME "ud_callback_link"
+#define UD_CB_LINK_NAME "ud_callback_link"
#define NEW_UD_CB_LINK_NAME "ud_callback_link2"
-#define UD_CB_TARGET "ud_target"
-#define UD_CB_TARGET_LEN 10
+#define UD_CB_TARGET "ud_target"
+#define UD_CB_TARGET_LEN 10
#define LE_FILENAME "le_extlink1.h5"
#define BE_FILENAME "be_extlink1.h5"
-#define ELINK_CB_FAM_SIZE (hsize_t) 100
+#define ELINK_CB_FAM_SIZE (hsize_t)100
#define H5L_DIM1 100
#define H5L_DIM2 100
@@ -143,290 +143,250 @@ const char *FILENAME[] = {
#define FILTER_FILESIZE_MAX_FRACTION (double)0.9F
/* Creation order macros */
-#define CORDER_GROUP_NAME "corder_group"
-#define CORDER_SOFT_GROUP_NAME "corder_soft_group"
-#define CORDER_NLINKS 18
-#define CORDER_ITER_STOP 3
-#define CORDER_EST_ENTRY_LEN 9
+#define CORDER_GROUP_NAME "corder_group"
+#define CORDER_SOFT_GROUP_NAME "corder_soft_group"
+#define CORDER_NLINKS 18
+#define CORDER_ITER_STOP 3
+#define CORDER_EST_ENTRY_LEN 9
/* Timestamp macros */
-#define TIMESTAMP_GROUP_1 "timestamp1"
-#define TIMESTAMP_GROUP_2 "timestamp2"
+#define TIMESTAMP_GROUP_1 "timestamp1"
+#define TIMESTAMP_GROUP_2 "timestamp2"
/* Link iteration struct */
typedef struct {
- H5_iter_order_t order; /* Direction of iteration */
- unsigned ncalled; /* # of times callback is entered */
- unsigned nskipped; /* # of links skipped */
- int stop; /* # of iterations to stop after */
- int64_t curr; /* Current creation order value */
- size_t max_visit; /* Size of "visited link" flag array */
- hbool_t *visited; /* Pointer to array of "visited link" flags */
+ H5_iter_order_t order; /* Direction of iteration */
+ unsigned ncalled; /* # of times callback is entered */
+ unsigned nskipped; /* # of links skipped */
+ int stop; /* # of iterations to stop after */
+ int64_t curr; /* Current creation order value */
+ size_t max_visit; /* Size of "visited link" flag array */
+ hbool_t * visited; /* Pointer to array of "visited link" flags */
} link_iter_info_t;
/* Link visit structs */
typedef struct {
- const char *path; /* Path to link */
- H5L_type_t type; /* Type of link */
+ const char *path; /* Path to link */
+ H5L_type_t type; /* Type of link */
} link_visit_t;
-static const link_visit_t lvisit0[] = {
- {"Dataset_zero", H5L_TYPE_HARD},
- {"Group1", H5L_TYPE_HARD},
- {"Group1/Dataset_one", H5L_TYPE_HARD},
- {"Group1/Group2", H5L_TYPE_HARD},
- {"Group1/Group2/Dataset_two", H5L_TYPE_HARD},
- {"Group1/Group2/Type_two", H5L_TYPE_HARD},
- {"Group1/Group2/hard_zero", H5L_TYPE_HARD},
- {"Group1/Type_one", H5L_TYPE_HARD},
- {"Group1/hard_one", H5L_TYPE_HARD},
- {"Type_zero", H5L_TYPE_HARD},
- {"ext_dangle", H5L_TYPE_EXTERNAL},
- {"ext_one", H5L_TYPE_EXTERNAL},
- {"hard_one", H5L_TYPE_HARD},
- {"hard_two", H5L_TYPE_HARD},
- {"hard_zero", H5L_TYPE_HARD},
- {"soft_dangle", H5L_TYPE_SOFT},
- {"soft_one", H5L_TYPE_SOFT},
- {"soft_two", H5L_TYPE_SOFT}
-};
-static const link_visit_t lvisit1[] = {
- {"Dataset_one", H5L_TYPE_HARD},
- {"Group2", H5L_TYPE_HARD},
- {"Group2/Dataset_two", H5L_TYPE_HARD},
- {"Group2/Type_two", H5L_TYPE_HARD},
- {"Group2/hard_zero", H5L_TYPE_HARD},
- {"Group2/hard_zero/Dataset_zero", H5L_TYPE_HARD},
- {"Group2/hard_zero/Group1", H5L_TYPE_HARD},
- {"Group2/hard_zero/Type_zero", H5L_TYPE_HARD},
- {"Group2/hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
- {"Group2/hard_zero/ext_one", H5L_TYPE_EXTERNAL},
- {"Group2/hard_zero/hard_one", H5L_TYPE_HARD},
- {"Group2/hard_zero/hard_two", H5L_TYPE_HARD},
- {"Group2/hard_zero/hard_zero", H5L_TYPE_HARD},
- {"Group2/hard_zero/soft_dangle", H5L_TYPE_SOFT},
- {"Group2/hard_zero/soft_one", H5L_TYPE_SOFT},
- {"Group2/hard_zero/soft_two", H5L_TYPE_SOFT},
- {"Type_one", H5L_TYPE_HARD},
- {"hard_one", H5L_TYPE_HARD}
-};
-static const link_visit_t lvisit2[] = {
- {"Dataset_two", H5L_TYPE_HARD},
- {"Type_two", H5L_TYPE_HARD},
- {"hard_zero", H5L_TYPE_HARD},
- {"hard_zero/Dataset_zero", H5L_TYPE_HARD},
- {"hard_zero/Group1", H5L_TYPE_HARD},
- {"hard_zero/Group1/Dataset_one", H5L_TYPE_HARD},
- {"hard_zero/Group1/Group2", H5L_TYPE_HARD},
- {"hard_zero/Group1/Type_one", H5L_TYPE_HARD},
- {"hard_zero/Group1/hard_one", H5L_TYPE_HARD},
- {"hard_zero/Type_zero", H5L_TYPE_HARD},
- {"hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
- {"hard_zero/ext_one", H5L_TYPE_EXTERNAL},
- {"hard_zero/hard_one", H5L_TYPE_HARD},
- {"hard_zero/hard_two", H5L_TYPE_HARD},
- {"hard_zero/hard_zero", H5L_TYPE_HARD},
- {"hard_zero/soft_dangle", H5L_TYPE_SOFT},
- {"hard_zero/soft_one", H5L_TYPE_SOFT},
- {"hard_zero/soft_two", H5L_TYPE_SOFT}
-};
+static const link_visit_t lvisit0[] = {{"Dataset_zero", H5L_TYPE_HARD},
+ {"Group1", H5L_TYPE_HARD},
+ {"Group1/Dataset_one", H5L_TYPE_HARD},
+ {"Group1/Group2", H5L_TYPE_HARD},
+ {"Group1/Group2/Dataset_two", H5L_TYPE_HARD},
+ {"Group1/Group2/Type_two", H5L_TYPE_HARD},
+ {"Group1/Group2/hard_zero", H5L_TYPE_HARD},
+ {"Group1/Type_one", H5L_TYPE_HARD},
+ {"Group1/hard_one", H5L_TYPE_HARD},
+ {"Type_zero", H5L_TYPE_HARD},
+ {"ext_dangle", H5L_TYPE_EXTERNAL},
+ {"ext_one", H5L_TYPE_EXTERNAL},
+ {"hard_one", H5L_TYPE_HARD},
+ {"hard_two", H5L_TYPE_HARD},
+ {"hard_zero", H5L_TYPE_HARD},
+ {"soft_dangle", H5L_TYPE_SOFT},
+ {"soft_one", H5L_TYPE_SOFT},
+ {"soft_two", H5L_TYPE_SOFT}};
+static const link_visit_t lvisit1[] = {{"Dataset_one", H5L_TYPE_HARD},
+ {"Group2", H5L_TYPE_HARD},
+ {"Group2/Dataset_two", H5L_TYPE_HARD},
+ {"Group2/Type_two", H5L_TYPE_HARD},
+ {"Group2/hard_zero", H5L_TYPE_HARD},
+ {"Group2/hard_zero/Dataset_zero", H5L_TYPE_HARD},
+ {"Group2/hard_zero/Group1", H5L_TYPE_HARD},
+ {"Group2/hard_zero/Type_zero", H5L_TYPE_HARD},
+ {"Group2/hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
+ {"Group2/hard_zero/ext_one", H5L_TYPE_EXTERNAL},
+ {"Group2/hard_zero/hard_one", H5L_TYPE_HARD},
+ {"Group2/hard_zero/hard_two", H5L_TYPE_HARD},
+ {"Group2/hard_zero/hard_zero", H5L_TYPE_HARD},
+ {"Group2/hard_zero/soft_dangle", H5L_TYPE_SOFT},
+ {"Group2/hard_zero/soft_one", H5L_TYPE_SOFT},
+ {"Group2/hard_zero/soft_two", H5L_TYPE_SOFT},
+ {"Type_one", H5L_TYPE_HARD},
+ {"hard_one", H5L_TYPE_HARD}};
+static const link_visit_t lvisit2[] = {{"Dataset_two", H5L_TYPE_HARD},
+ {"Type_two", H5L_TYPE_HARD},
+ {"hard_zero", H5L_TYPE_HARD},
+ {"hard_zero/Dataset_zero", H5L_TYPE_HARD},
+ {"hard_zero/Group1", H5L_TYPE_HARD},
+ {"hard_zero/Group1/Dataset_one", H5L_TYPE_HARD},
+ {"hard_zero/Group1/Group2", H5L_TYPE_HARD},
+ {"hard_zero/Group1/Type_one", H5L_TYPE_HARD},
+ {"hard_zero/Group1/hard_one", H5L_TYPE_HARD},
+ {"hard_zero/Type_zero", H5L_TYPE_HARD},
+ {"hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
+ {"hard_zero/ext_one", H5L_TYPE_EXTERNAL},
+ {"hard_zero/hard_one", H5L_TYPE_HARD},
+ {"hard_zero/hard_two", H5L_TYPE_HARD},
+ {"hard_zero/hard_zero", H5L_TYPE_HARD},
+ {"hard_zero/soft_dangle", H5L_TYPE_SOFT},
+ {"hard_zero/soft_one", H5L_TYPE_SOFT},
+ {"hard_zero/soft_two", H5L_TYPE_SOFT}};
typedef struct {
- unsigned idx; /* Index in link visit structure */
- const link_visit_t *info; /* Pointer to the link visit structure to use */
+ unsigned idx; /* Index in link visit structure */
+ const link_visit_t *info; /* Pointer to the link visit structure to use */
} lvisit_ud_t;
-
/* Object visit structs */
typedef struct {
- const char *path; /* Path to object */
- H5O_type_t type; /* Type of object */
+ const char *path; /* Path to object */
+ H5O_type_t type; /* Type of object */
} obj_visit_t;
-static const obj_visit_t ovisit0_old[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_zero", H5O_TYPE_DATASET},
- {"Group1", H5O_TYPE_GROUP},
- {"Group1/Dataset_one", H5O_TYPE_DATASET},
- {"Group1/Group2", H5O_TYPE_GROUP},
- {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
- {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
- {"Type_zero", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit0_new[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_zero", H5O_TYPE_DATASET},
- {"Group1", H5O_TYPE_GROUP},
- {"Group1/Dataset_one", H5O_TYPE_DATASET},
- {"Group1/Group2", H5O_TYPE_GROUP},
- {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
- {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
- {"Type_zero", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit1_old[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_one", H5O_TYPE_DATASET},
- {"Group2", H5O_TYPE_GROUP},
- {"Group2/Dataset_two", H5O_TYPE_DATASET},
- {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"Group2/hard_zero", H5O_TYPE_GROUP},
- {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
- {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
- {"Type_one", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit1_new[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_one", H5O_TYPE_DATASET},
- {"Group2", H5O_TYPE_GROUP},
- {"Group2/Dataset_two", H5O_TYPE_DATASET},
- {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"Group2/hard_zero", H5O_TYPE_GROUP},
- {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
- {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
- {"Type_one", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit2_old[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_two", H5O_TYPE_DATASET},
- {"Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"hard_zero", H5O_TYPE_GROUP},
- {"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
- {"hard_zero/Group1", H5O_TYPE_GROUP},
- {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
- {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
- {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit2_new[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_two", H5O_TYPE_DATASET},
- {"Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"hard_zero", H5O_TYPE_GROUP},
- {"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
- {"hard_zero/Group1", H5O_TYPE_GROUP},
- {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
- {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
- {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}
-};
+static const obj_visit_t ovisit0_old[] = {{".", H5O_TYPE_GROUP},
+ {"Dataset_zero", H5O_TYPE_DATASET},
+ {"Group1", H5O_TYPE_GROUP},
+ {"Group1/Dataset_one", H5O_TYPE_DATASET},
+ {"Group1/Group2", H5O_TYPE_GROUP},
+ {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
+ {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
+ {"Type_zero", H5O_TYPE_NAMED_DATATYPE}};
+static const obj_visit_t ovisit0_new[] = {{".", H5O_TYPE_GROUP},
+ {"Dataset_zero", H5O_TYPE_DATASET},
+ {"Group1", H5O_TYPE_GROUP},
+ {"Group1/Dataset_one", H5O_TYPE_DATASET},
+ {"Group1/Group2", H5O_TYPE_GROUP},
+ {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
+ {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
+ {"Type_zero", H5O_TYPE_NAMED_DATATYPE}};
+static const obj_visit_t ovisit1_old[] = {{".", H5O_TYPE_GROUP},
+ {"Dataset_one", H5O_TYPE_DATASET},
+ {"Group2", H5O_TYPE_GROUP},
+ {"Group2/Dataset_two", H5O_TYPE_DATASET},
+ {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"Group2/hard_zero", H5O_TYPE_GROUP},
+ {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
+ {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
+ {"Type_one", H5O_TYPE_NAMED_DATATYPE}};
+static const obj_visit_t ovisit1_new[] = {{".", H5O_TYPE_GROUP},
+ {"Dataset_one", H5O_TYPE_DATASET},
+ {"Group2", H5O_TYPE_GROUP},
+ {"Group2/Dataset_two", H5O_TYPE_DATASET},
+ {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"Group2/hard_zero", H5O_TYPE_GROUP},
+ {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
+ {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
+ {"Type_one", H5O_TYPE_NAMED_DATATYPE}};
+static const obj_visit_t ovisit2_old[] = {{".", H5O_TYPE_GROUP},
+ {"Dataset_two", H5O_TYPE_DATASET},
+ {"Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"hard_zero", H5O_TYPE_GROUP},
+ {"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
+ {"hard_zero/Group1", H5O_TYPE_GROUP},
+ {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
+ {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
+ {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}};
+static const obj_visit_t ovisit2_new[] = {{".", H5O_TYPE_GROUP},
+ {"Dataset_two", H5O_TYPE_DATASET},
+ {"Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"hard_zero", H5O_TYPE_GROUP},
+ {"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
+ {"hard_zero/Group1", H5O_TYPE_GROUP},
+ {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
+ {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
+ {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}};
typedef struct {
- unsigned idx; /* Index in object visit structure */
- const obj_visit_t *info; /* Pointer to the object visit structure to use */
+ unsigned idx; /* Index in object visit structure */
+ const obj_visit_t *info; /* Pointer to the object visit structure to use */
} ovisit_ud_t;
static hid_t dcpl_g; /* for [un]minimized dataset object headers */
-static herr_t
-UD_hard_create(const char *link_name, hid_t loc_group, const void *udata,
- size_t udata_size, hid_t lcpl_id);
-static hid_t
-UD_hard_traverse(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id,
- hid_t dxpl_id);
-static herr_t
-UD_hard_delete(const char *link_name, hid_t file, const void *udata,
- size_t udata_size);
+static herr_t UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size,
+ hid_t lcpl_id);
+static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size,
+ hid_t lapl_id, hid_t dxpl_id);
+static herr_t UD_hard_delete(const char *link_name, hid_t file, const void *udata, size_t udata_size);
/* User-defined link class */
const H5L_class_t UD_hard_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
- "UD_hard_link", /* Link class name for debugging */
- UD_hard_create, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_hard_traverse, /* The actual traversal function */
- UD_hard_delete, /* Deletion callback */
- NULL /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
+ "UD_hard_link", /* Link class name for debugging */
+ UD_hard_create, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_hard_traverse, /* The actual traversal function */
+ UD_hard_delete, /* Deletion callback */
+ NULL /* Query callback */
}};
#ifndef H5_NO_DEPRECATED_SYMBOLS
-static herr_t
-UD_hard_create_deprec(const char *link_name, hid_t loc_group, const void *udata,
- size_t udata_size, hid_t lcpl_id);
-static hid_t
-UD_hard_traverse_deprec(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id,
- hid_t dxpl_id);
-static herr_t
-UD_hard_delete_deprec(const char *link_name, hid_t file, const void *udata,
- size_t udata_size);
+static herr_t UD_hard_create_deprec(const char *link_name, hid_t loc_group, const void *udata,
+ size_t udata_size, hid_t lcpl_id);
+static hid_t UD_hard_traverse_deprec(const char *link_name, hid_t cur_group, const void *udata,
+ size_t udata_size, hid_t lapl_id, hid_t dxpl_id);
+static herr_t UD_hard_delete_deprec(const char *link_name, hid_t file, const void *udata, size_t udata_size);
/* User-defined link class */
const H5L_class_t UD_hard_class_deprec[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
- "UD_hard_link_deprec", /* Link class name for debugging */
- UD_hard_create_deprec, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_hard_traverse_deprec, /* The actual traversal function */
- UD_hard_delete_deprec, /* Deletion callback */
- NULL /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
+ "UD_hard_link_deprec", /* Link class name for debugging */
+ UD_hard_create_deprec, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_hard_traverse_deprec, /* The actual traversal function */
+ UD_hard_delete_deprec, /* Deletion callback */
+ NULL /* Query callback */
}};
#endif
-static hid_t
-UD_rereg_traverse(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id,
- hid_t dxpl_id);
+static hid_t UD_rereg_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size,
+ hid_t lapl_id, hid_t dxpl_id);
/* This link class has the same ID number as the UD hard links but
* has a very different traversal function */
const H5L_class_t UD_rereg_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
- "UD_reregistered_type", /* Link class name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_rereg_traverse, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
+ "UD_reregistered_type", /* Link class name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_rereg_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
-static herr_t
-UD_cb_create(const char * link_name, hid_t loc_group, const void *udata,
- size_t udata_size, hid_t lcpl_id);
-static herr_t
-UD_cb_move(const char *new_name, hid_t new_loc, const void *udata,
- size_t udata_size);
-static hid_t
-UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata,
- size_t udata_size, hid_t lapl_id, hid_t dxpl_id);
-static herr_t
-UD_cb_delete(const char *link_name, hid_t file, const void *udata,
- size_t udata_size);
-static ssize_t
-UD_cb_query(const char * link_name, const void *udata, size_t udata_size,
- void *buf, size_t buf_size);
+static herr_t UD_cb_create(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size,
+ hid_t lcpl_id);
+static herr_t UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, size_t udata_size);
+static hid_t UD_cb_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size,
+ hid_t lapl_id, hid_t dxpl_id);
+static herr_t UD_cb_delete(const char *link_name, hid_t file, const void *udata, size_t udata_size);
+static ssize_t UD_cb_query(const char *link_name, const void *udata, size_t udata_size, void *buf,
+ size_t buf_size);
const H5L_class_t UD_cb_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_CB_TYPE, /* Link type id number */
- NULL, /* NULL name (to make sure this doesn't break anything */
- UD_cb_create, /* Creation callback */
- UD_cb_move, /* Move/rename callback */
- UD_cb_move, /* Copy callback */
- UD_cb_traverse, /* The actual traversal function */
- UD_cb_delete, /* Deletion callback */
- UD_cb_query /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_CB_TYPE, /* Link type id number */
+ NULL, /* NULL name (to make sure this doesn't break anything */
+ UD_cb_create, /* Creation callback */
+ UD_cb_move, /* Move/rename callback */
+ UD_cb_move, /* Copy callback */
+ UD_cb_traverse, /* The actual traversal function */
+ UD_cb_delete, /* Deletion callback */
+ UD_cb_query /* Query callback */
}};
-static hid_t
-UD_plist_traverse(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id,
- hid_t dxpl_id);
+static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size,
+ hid_t lapl_id, hid_t dxpl_id);
const H5L_class_t UD_plist_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
(H5L_type_t)UD_PLIST_TYPE, /* Link type id number */
- "UD_plist_link", /* Link class name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_plist_traverse, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ "UD_plist_link", /* Link class name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_plist_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
/*-------------------------------------------------------------------------
@@ -446,7 +406,6 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name)
HDstrcat(path_name, file_name);
}
-
/*-------------------------------------------------------------------------
* Function: mklinks
*
@@ -459,52 +418,63 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name)
static int
mklinks(hid_t fapl, hbool_t new_format)
{
- hid_t file, scalar, grp, d1;
- hsize_t size[1] = {1};
- char filename[NAME_BUF_SIZE];
+ hid_t file, scalar, grp, d1;
+ hsize_t size[1] = {1};
+ char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("link creation (w/new group format)")
else
TESTING("link creation")
/* Create a file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((scalar = H5Screate_simple(1, size, size)) < 0) TEST_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((scalar = H5Screate_simple(1, size, size)) < 0)
+ TEST_ERROR
/* Create a group */
- if((grp = H5Gcreate2(file, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(grp) < 0) TEST_ERROR
+ if ((grp = H5Gcreate2(file, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(grp) < 0)
+ TEST_ERROR
/* Create a dataset */
- if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(d1) < 0) TEST_ERROR
+ if ((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(d1) < 0)
+ TEST_ERROR
/* Create a hard link */
- if(H5Lcreate_hard(file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create a symbolic link */
- if(H5Lcreate_soft("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create a symbolic link to something that doesn't exist */
- if(H5Lcreate_soft("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create a recursive symbolic link */
- if(H5Lcreate_soft("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close */
- if(H5Sclose(scalar) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Sclose(scalar) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
- error:
+error:
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: new_links
*
@@ -517,73 +487,105 @@ mklinks(hid_t fapl, hbool_t new_format)
static int
new_links(hid_t fapl, hbool_t new_format)
{
- hid_t file_a, file_b=(-1);
- hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1);
- hid_t scalar=(-1);
- hid_t dset1=(-1), dset2=(-1);
- char filename[NAME_BUF_SIZE];
- hsize_t size[1] = {1};
-
- if(new_format)
+ hid_t file_a, file_b = (-1);
+ hid_t grp1_a = (-1), grp1_b = (-1), grp2_a = (-1), grp2_b = (-1);
+ hid_t scalar = (-1);
+ hid_t dset1 = (-1), dset2 = (-1);
+ char filename[NAME_BUF_SIZE];
+ hsize_t size[1] = {1};
+
+ if (new_format)
TESTING("H5Lcreate functions (w/new group format)")
else
TESTING("H5Lcreate functions")
/* Create two files */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
- if((scalar = H5Screate_simple (1, size, size)) < 0) TEST_ERROR
+ if ((scalar = H5Screate_simple(1, size, size)) < 0)
+ TEST_ERROR
/* Create two groups in each file */
- if((grp1_a = H5Gcreate2(file_a, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((grp2_a = H5Gcreate2(file_a, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((grp1_b = H5Gcreate2(file_b, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((grp1_a = H5Gcreate2(file_a, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((grp2_a = H5Gcreate2(file_a, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((grp1_b = H5Gcreate2(file_b, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create datasets */
- if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if ((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Create links within a file. Both of source and destination use
* H5L_SAME_LOC. Both hard and soft links should fail. */
- H5E_BEGIN_TRY {
- if(H5Lcreate_hard(H5L_SAME_LOC, "dataset1", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR
- } H5E_END_TRY;
- H5E_BEGIN_TRY {
- if(H5Lcreate_soft("dataset1", H5L_SAME_LOC, "soft", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcreate_hard(H5L_SAME_LOC, "dataset1", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcreate_soft("dataset1", H5L_SAME_LOC, "soft", H5P_DEFAULT, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Create links across files with hard link. Should fail. */
- H5E_BEGIN_TRY {
- if(H5Lcreate_hard(file_a, "dataset1", file_b, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcreate_hard(file_a, "dataset1", file_b, "hard", H5P_DEFAULT, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Create hard link to test H5L_SAME_LOC */
- if(H5Lcreate_hard(grp1_a, "dataset2", H5L_SAME_LOC, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(grp1_a, "dataset2", H5L_SAME_LOC, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create links to test hard links across different locations */
- if(H5Lcreate_hard(grp1_a, "dataset2", grp2_a, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(grp1_a, "dataset2", grp2_a, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close dataspace and files */
- if(H5Sclose(scalar) < 0) TEST_ERROR
- if(H5Dclose(dset1) < 0) TEST_ERROR
- if(H5Dclose(dset2) < 0) TEST_ERROR
- if(H5Gclose(grp1_a) < 0) TEST_ERROR
- if(H5Gclose(grp2_a) < 0) TEST_ERROR
- if(H5Gclose(grp1_b) < 0) TEST_ERROR
- if(H5Gclose(grp2_b) < 0) TEST_ERROR
- if(H5Fclose(file_a) < 0) TEST_ERROR
- if(H5Fclose(file_b) < 0) TEST_ERROR
+ if (H5Sclose(scalar) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset1) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset2) < 0)
+ TEST_ERROR
+ if (H5Gclose(grp1_a) < 0)
+ TEST_ERROR
+ if (H5Gclose(grp2_a) < 0)
+ TEST_ERROR
+ if (H5Gclose(grp1_b) < 0)
+ TEST_ERROR
+ if (H5Gclose(grp2_b) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_a) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_b) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Sclose(scalar);
H5Dclose(dset1);
H5Dclose(dset2);
@@ -593,11 +595,11 @@ new_links(hid_t fapl, hbool_t new_format)
H5Gclose(grp2_b);
H5Fclose(file_a);
H5Fclose(file_b);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: cklinks
*
@@ -611,140 +613,160 @@ new_links(hid_t fapl, hbool_t new_format)
static int
cklinks(hid_t fapl, hbool_t new_format)
{
- hid_t file;
- H5O_info2_t oinfo1, oinfo2;
- H5L_info2_t linfo;
- char linkval[LINK_BUF_SIZE];
- char filename[NAME_BUF_SIZE];
- int token_cmp;
- herr_t status;
+ hid_t file;
+ H5O_info2_t oinfo1, oinfo2;
+ H5L_info2_t linfo;
+ char linkval[LINK_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
+ int token_cmp;
+ herr_t status;
- if(new_format)
+ if (new_format)
TESTING("link queries (w/new group format)")
else
TESTING("link queries")
/* Open the file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Hard link */
- if(H5Oget_info_by_name3(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5O_TYPE_DATASET != oinfo2.type) {
+ if (H5Oget_info_by_name3(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5O_TYPE_DATASET != oinfo2.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR
- if(token_cmp) {
+ if (H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0)
+ FAIL_STACK_ERROR
+ if (token_cmp) {
H5_FAILED();
HDputs(" Hard link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
TEST_ERROR
} /* end if */
- if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
+ if (H5Lexists(file, "/", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ if (H5Lexists(file, "d1", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ if (H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ if (H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ if (H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
HDputs(" H5Lexists() should have failed for a path with missing components.");
TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
+ H5E_BEGIN_TRY { status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
HDputs(" H5Lexists() should have failed for a path with missing components.");
TEST_ERROR
} /* end if */
/* Symbolic link */
- if(H5Oget_info_by_name3(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5O_TYPE_DATASET != oinfo2.type) {
+ if (H5Oget_info_by_name3(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5O_TYPE_DATASET != oinfo2.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR
- if(token_cmp) {
+ if (H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0)
+ FAIL_STACK_ERROR
+ if (token_cmp) {
H5_FAILED();
HDputs(" Soft link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
TEST_ERROR
} /* end if */
- if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(linkval, "/d1")) {
+ if (H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(linkval, "/d1")) {
H5_FAILED();
HDputs(" Soft link test failed. Wrong link value");
TEST_ERROR
} /* end if */
- if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if (H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
/* Dangling link */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
status = H5Oget_info_by_name3(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
HDputs(" H5Oget_info_by_name() should have failed for a dangling link.");
TEST_ERROR
} /* end if */
- if(H5Lget_info2(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5L_TYPE_SOFT != linfo.type) {
+ if (H5Lget_info2(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5L_TYPE_SOFT != linfo.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
+ if (H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf(" %d: Can't retrieve link value\n", __LINE__);
TEST_ERROR
} /* end if */
- if(HDstrcmp(linkval, "foobar")) {
+ if (HDstrcmp(linkval, "foobar")) {
H5_FAILED();
HDputs(" Dangling link test failed. Wrong link value");
TEST_ERROR
} /* end if */
- if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if (H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
/* Recursive link */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
status = H5Oget_info_by_name3(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
HDputs(" H5Oget_info_by_name() should have failed for a recursive link.");
TEST_ERROR
} /* end if */
- if(H5Lget_info2(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5L_TYPE_SOFT != linfo.type) {
+ if (H5Lget_info2(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5L_TYPE_SOFT != linfo.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
+ if (H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf(" %d: Can't retrieve link value\n", __LINE__);
TEST_ERROR
} /* end if */
- if(HDstrcmp(linkval, "/grp1/recursive")) {
+ if (HDstrcmp(linkval, "/grp1/recursive")) {
H5_FAILED();
HDputs(" Recursive link test failed. Wrong link value");
TEST_ERROR
} /* end if */
/* Non-existent link */
- if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR
+ if (H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE)
+ FAIL_STACK_ERROR
/* Cleanup */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
@@ -753,7 +775,6 @@ error:
return FAIL;
} /* end cklinks() */
-
/*-------------------------------------------------------------------------
* Function: ck_new_links
*
@@ -767,35 +788,41 @@ error:
static int
ck_new_links(hid_t fapl, hbool_t new_format)
{
- hid_t file;
- H5O_info2_t oi_dset, oi_hard1, oi_hard2;
- char filename[NAME_BUF_SIZE];
- int token_cmp1, token_cmp2;
+ hid_t file;
+ H5O_info2_t oi_dset, oi_hard1, oi_hard2;
+ char filename[NAME_BUF_SIZE];
+ int token_cmp1, token_cmp2;
- if(new_format)
+ if (new_format)
TESTING("new link queries (w/new group format)")
else
TESTING("new link queries")
/* Open the file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Get hard link info */
- if(H5Oget_info_by_name3(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Oget_info_by_name3(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check hard links */
- if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) {
+ if (H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
}
- if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard1.token, &token_cmp1) < 0) TEST_ERROR
- if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard2.token, &token_cmp2) < 0) TEST_ERROR
- if(token_cmp1 || token_cmp2) {
+ if (H5Otoken_cmp(file, &oi_dset.token, &oi_hard1.token, &token_cmp1) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(file, &oi_dset.token, &oi_hard2.token, &token_cmp2) < 0)
+ TEST_ERROR
+ if (token_cmp1 || token_cmp2) {
H5_FAILED();
HDputs(" Hard link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
@@ -803,7 +830,8 @@ ck_new_links(hid_t fapl, hbool_t new_format)
}
/* Cleanup */
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
PASSED();
return 0;
@@ -812,7 +840,6 @@ error:
return -1;
} /* end ck_new_links() */
-
/*-------------------------------------------------------------------------
* Function: long_links
*
@@ -825,45 +852,54 @@ error:
static int
long_links(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t gid2 = -1; /* Datatype ID */
- char *objname = NULL; /* Name of object [Long] */
- size_t u; /* Local index variable */
- char filename[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t gid2 = -1; /* Datatype ID */
+ char * objname = NULL; /* Name of object [Long] */
+ size_t u; /* Local index variable */
+ char filename[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("long names for objects & links (w/new group format)")
else
TESTING("long names for objects & links")
/* Create files */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group with short name in file (used as target for hard links) */
- if((gid = H5Gcreate2(fid, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Construct very long file name */
- if((objname = (char *)HDmalloc((size_t)(MAX_NAME_LEN + 1))) == NULL) TEST_ERROR
- for(u = 0; u < MAX_NAME_LEN; u++)
+ if ((objname = (char *)HDmalloc((size_t)(MAX_NAME_LEN + 1))) == NULL)
+ TEST_ERROR
+ for (u = 0; u < MAX_NAME_LEN; u++)
objname[u] = 'a';
objname[MAX_NAME_LEN] = '\0';
/* Create hard link to existing object */
- if(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create soft link to existing object */
objname[0] = 'b';
- if(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create group with long name in existing group */
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close objects */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Release memory */
HDfree(objname);
@@ -871,17 +907,18 @@ long_links(hid_t fapl, hbool_t new_format)
PASSED();
return SUCCEED;
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
HDfree(objname);
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: toomany
*
@@ -894,12 +931,12 @@ long_links(hid_t fapl, hbool_t new_format)
static int
toomany(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("too many links (w/new group format)")
else
TESTING("too many links")
@@ -912,116 +949,172 @@ toomany(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group with short name in file (used as target for hard links) */
- if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create chain of hard links to existing object (no limit on #) */
- if(H5Lcreate_hard(fid, "final", fid, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard1", fid, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard2", fid, "hard3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard3", fid, "hard4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard4", fid, "hard5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard5", fid, "hard6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard6", fid, "hard7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard7", fid, "hard8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard8", fid, "hard9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard9", fid, "hard10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard10", fid, "hard11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard11", fid, "hard12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard12", fid, "hard13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard13", fid, "hard14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard14", fid, "hard15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard15", fid, "hard16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard16", fid, "hard17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard17", fid, "hard18", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard18", fid, "hard19", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard19", fid, "hard20", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "hard20", fid, "hard21", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(fid, "final", fid, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard1", fid, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard2", fid, "hard3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard3", fid, "hard4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard4", fid, "hard5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard5", fid, "hard6", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard6", fid, "hard7", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard7", fid, "hard8", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard8", fid, "hard9", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard9", fid, "hard10", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard10", fid, "hard11", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard11", fid, "hard12", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard12", fid, "hard13", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard13", fid, "hard14", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard14", fid, "hard15", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard15", fid, "hard16", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard16", fid, "hard17", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard17", fid, "hard18", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard18", fid, "hard19", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard19", fid, "hard20", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "hard20", fid, "hard21", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create chain of soft links to existing object (limited) */
- if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open file */
- if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open object through last hard link */
- if((gid = H5Gopen2(fid, "hard21", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "hard21", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/hard21")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/hard21"))
+ TEST_ERROR
/* Create object in hard-linked group */
- if((gid2 = H5Gcreate2(gid, "new_hard", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_hard", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group in hard-linked group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close hard-linked object */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Open object through too deep soft link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "soft17", H5P_DEFAULT);
- } H5E_END_TRY;
- if(gid >= 0) {
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (gid >= 0) {
H5_FAILED();
HDputs(" Should have failed for sequence of too many nested links.");
TEST_ERROR
} /* end if */
/* Open object through lesser soft link */
- if((gid = H5Gopen2(fid, "soft16", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "soft16", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/soft16")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/soft16"))
+ TEST_ERROR
/* Create object using soft links */
- if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close groups */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end toomany() */
-
/*-------------------------------------------------------------------------
* Function: test_lcpl
*
@@ -1034,17 +1127,17 @@ toomany(hid_t fapl, hbool_t new_format)
static int
test_lcpl(hid_t fapl, hbool_t new_format)
{
- hid_t file_id = -1;
- hid_t group_id = -1;
- hid_t space_id = -1;
- hid_t dset_id = -1;
- hid_t type_id = -1;
- hid_t lcpl_id = -1;
- H5L_info2_t linfo;
- char filename[1024];
- hsize_t dims[2];
-
- if(new_format)
+ hid_t file_id = -1;
+ hid_t group_id = -1;
+ hid_t space_id = -1;
+ hid_t dset_id = -1;
+ hid_t type_id = -1;
+ hid_t lcpl_id = -1;
+ H5L_info2_t linfo;
+ char filename[1024];
+ hsize_t dims[2];
+
+ if (new_format)
TESTING("link creation property lists (w/new group format)")
else
TESTING("link creation property lists")
@@ -1055,127 +1148,186 @@ test_lcpl(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create and link a group with the default LCPL */
- if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
+ if (H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5F_DEFAULT_CSET)
+ TEST_ERROR
/* Create and commit a datatype with the default LCPL */
- if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(type_id) < 0) TEST_ERROR
+ if ((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(type_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_info2(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
+ if (H5Lget_info2(file_id, "type", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5F_DEFAULT_CSET)
+ TEST_ERROR
/* Create a dataspace */
dims[0] = H5L_DIM1;
dims[1] = H5L_DIM2;
- if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR
+ if ((space_id = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
/* Create a dataset using the default LCPL */
- if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(dset_id) < 0) TEST_ERROR
+ if ((dset_id =
+ H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_info2(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
+ if (H5Lget_info2(file_id, "dataset", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5F_DEFAULT_CSET)
+ TEST_ERROR
/* Create a link creation property list with the UTF-8 character encoding */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0)
+ TEST_ERROR
/* Create and link a group with the new LCPL */
- if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Create and commit a datatype with the new LCPL */
- if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(type_id) < 0) TEST_ERROR
+ if ((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(type_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_info2(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info2(file_id, "type2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Create a dataset using the new LCPL */
- if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(dset_id) < 0) TEST_ERROR
+ if ((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Dclose(dset_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_info2(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info2(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Create a new link to the dataset with a different character encoding. */
- if(H5Pclose(lcpl_id) < 0) TEST_ERROR
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR
+ if (H5Pclose(lcpl_id) < 0)
+ TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0)
+ TEST_ERROR
- if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check that its character encoding is ASCII */
- if(H5Lget_info2(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+ if (H5Lget_info2(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_ASCII)
+ TEST_ERROR
/* Check that the first link's encoding hasn't changed */
- if(H5Lget_info2(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info2(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Make sure that LCPLs work properly for other API calls: */
/* H5Lcreate_soft */
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
- if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info2(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* H5Lmove */
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR
- if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info2(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0)
+ TEST_ERROR
+ if (H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_ASCII)
+ TEST_ERROR
/* H5Lcopy */
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
- if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info2(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0)
+ TEST_ERROR
+ if (H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* H5Lcreate_external */
- if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info2(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "extlink", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Close open IDs */
- if(H5Pclose(lcpl_id) < 0) TEST_ERROR
- if(H5Sclose(space_id) < 0) TEST_ERROR
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Pclose(lcpl_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Dclose(dset_id);
H5Tclose(type_id);
H5Pclose(lcpl_id);
H5Sclose(space_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_lcpl() */
-
/*-------------------------------------------------------------------------
* Function: test_move
*
@@ -1188,97 +1340,133 @@ error:
static int
test_move(hid_t fapl, hbool_t new_format)
{
- hid_t file_a = -1, file_b = -1;
- hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1;
- char filename[1024];
+ hid_t file_a = -1, file_b = -1;
+ hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1;
+ char filename[1024];
- if(new_format)
+ if (new_format)
TESTING("H5Lmove (w/new group format)")
else
TESTING("H5Lmove")
/* Create two new files */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create groups in first file */
- if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create hard, soft and external links. */
- if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Move a group within the file. Both of source and destination use
* H5L_SAME_LOC. Should fail. */
- H5E_BEGIN_TRY {
- if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=
+ FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Move a group across files. Should fail. */
- H5E_BEGIN_TRY {
- if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Move a soft link across files. Should succeed. */
- if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR
+ if (H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE)
+ TEST_ERROR
/* Move an external link across files. Should succeed. */
- if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR
+ if (H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE)
+ TEST_ERROR
/* Move a group across groups in the same file while renaming it. */
- if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if( H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Verify that the group is no longer in the original location */
- H5E_BEGIN_TRY {
- moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT);
- } H5E_END_TRY;
- if(moved_grp >= 0) {
+ H5E_BEGIN_TRY { moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (moved_grp >= 0) {
H5_FAILED();
HDputs(" Group still in original location?");
TEST_ERROR
} /* end if */
/* Use H5Lmove to rename a group without moving it. */
- if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group. */
- if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Use H5Lmove to move a group without renaming it. */
- if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group . */
- if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Move the group while giving long paths. */
- if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Verify that the group is in no previous locations */
- H5E_BEGIN_TRY {
- if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
- if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
- if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if ((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0)
+ FAIL_STACK_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0)
+ FAIL_STACK_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0)
+ FAIL_STACK_ERROR
+ if ((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0)
+ FAIL_STACK_ERROR
+ }
+ H5E_END_TRY;
H5Gclose(grp_1);
H5Gclose(grp_2);
@@ -1291,18 +1479,19 @@ test_move(hid_t fapl, hbool_t new_format)
error:
H5_FAILED();
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(grp_1);
H5Gclose(grp_2);
H5Gclose(grp_move);
H5Gclose(moved_grp);
H5Fclose(file_a);
H5Fclose(file_b);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_copy
*
@@ -1315,97 +1504,143 @@ error:
static int
test_copy(hid_t fapl, hbool_t new_format)
{
- hid_t file_a = -1, file_b = -1;
- hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1;
- char filename[1024];
+ hid_t file_a = -1, file_b = -1;
+ hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1;
+ char filename[1024];
- if(new_format)
+ if (new_format)
TESTING("H5Lcopy (w/new group format)")
else
TESTING("H5Lcopy")
/* Create two new files */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create groups in first file */
- if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create hard, soft and external links. */
- if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Copy a group within the file. Both of source and destination use
* H5L_SAME_LOC. Should fail. */
- H5E_BEGIN_TRY {
- if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=
+ FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Copy a group across files. Should fail. */
- H5E_BEGIN_TRY {
- if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Copy a soft link across files. Should succeed. */
- if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR
+ if (H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE)
+ TEST_ERROR
/* Copy an external link across files. Should succeed. */
- if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR
+ if (H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE)
+ TEST_ERROR
/* Move a group across groups in the same file while renaming it. */
- if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Verify that the group is also in the original location */
- if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Use H5Lcopy to create a group in the same location with a different name. */
- if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group. */
- if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Verify that the group is also in the original location */
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Use H5Lcopy to copy to a different location with the same name. */
- if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group . */
- if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Verify that the group is still in the previous location */
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Copy the group while giving long paths. */
- if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
/* Verify that the group is still in all previous original locations */
- if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
- if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
- if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
+ if ((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ TEST_ERROR
H5Gclose(grp_1);
H5Gclose(grp_2);
@@ -1418,18 +1653,19 @@ test_copy(hid_t fapl, hbool_t new_format)
error:
H5_FAILED();
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(grp_1);
H5Gclose(grp_2);
H5Gclose(grp_move);
H5Gclose(moved_grp);
H5Fclose(file_a);
H5Fclose(file_b);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_move_preserves
*
@@ -1443,21 +1679,21 @@ error:
static int
test_move_preserves(hid_t fapl_id, hbool_t new_format)
{
- hid_t file_id=-1;
- hid_t group_id=-1;
- hid_t fcpl_id=-1; /* Group creation property list ID */
- hid_t lcpl_id=-1;
- hid_t lcpl2_id=-1;
+ hid_t file_id = -1;
+ hid_t group_id = -1;
+ hid_t fcpl_id = -1; /* Group creation property list ID */
+ hid_t lcpl_id = -1;
+ hid_t lcpl2_id = -1;
H5O_info2_t oinfo;
H5L_info2_t linfo;
- H5T_cset_t old_cset;
- int64_t old_corder; /* Creation order value of link */
- time_t old_modification_time;
- time_t curr_time;
- unsigned crt_order_flags; /* Status of creation order info for GCPL */
- char filename[1024];
-
- if(new_format)
+ H5T_cset_t old_cset;
+ int64_t old_corder; /* Creation order value of link */
+ time_t old_modification_time;
+ time_t curr_time;
+ unsigned crt_order_flags; /* Status of creation order info for GCPL */
+ char filename[1024];
+
+ if (new_format)
TESTING("moving and copying links preserves their properties (w/new group format)")
else
TESTING("moving and copying links preserves their properties")
@@ -1465,140 +1701,211 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
/* Create a file creation property list with creation order stored for links
* in the root group
*/
- if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
- if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR
- if(crt_order_flags != 0) TEST_ERROR
- if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR
- if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR
- if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR
+ if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0)
+ TEST_ERROR
+ if (crt_order_flags != 0)
+ TEST_ERROR
+ if (H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ TEST_ERROR
+ if (H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0)
+ TEST_ERROR
+ if (crt_order_flags != H5P_CRT_ORDER_TRACKED)
+ TEST_ERROR
/* Create file */
/* (with creation order tracking for the root group) */
h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0)
+ TEST_ERROR
/* Create a link creation property list with the UTF-8 character encoding */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0)
+ TEST_ERROR
/* Create a group with that lcpl */
- if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Get the group's link's information */
- if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
old_cset = linfo.cset;
- if(old_cset != H5T_CSET_UTF8) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
+ if (old_cset != H5T_CSET_UTF8)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
old_corder = linfo.corder;
- if(old_corder != 0) TEST_ERROR
+ if (old_corder != 0)
+ TEST_ERROR
old_modification_time = oinfo.mtime;
/* If this test happens too quickly, the times will all be the same. Make sure the time changes. */
curr_time = HDtime(NULL);
- while(HDtime(NULL) <= curr_time)
+ while (HDtime(NULL) <= curr_time)
;
/* Close the file and reopen it */
- if(H5Fclose(file_id) < 0) TEST_ERROR
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ TEST_ERROR
/* Get the link's character set & modification time . They should be unchanged */
- if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(old_cset != linfo.cset) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(old_corder != linfo.corder) TEST_ERROR
-
- /* Create a new link to the group. It should have a different creation order value but the same modification time */
- if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_corder == linfo.corder) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 1) TEST_ERROR
- if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+ if (H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (old_cset != linfo.cset)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (old_corder != linfo.corder)
+ TEST_ERROR
+
+ /* Create a new link to the group. It should have a different creation order value but the same
+ * modification time */
+ if (H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_corder == linfo.corder)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 1)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_ASCII)
+ TEST_ERROR
/* Copy the first link to a UTF-8 name.
* Its creation order value should be different, but modification time
* should not change.
*/
- if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info2(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 2) TEST_ERROR
+ if (H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 2)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Move the link with the default property list. */
- if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info2(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 3) TEST_ERROR
+ if (H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 3)
+ TEST_ERROR
/* Check that its character encoding is not UTF-8 */
- if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
+ if (linfo.cset == H5T_CSET_UTF8)
+ TEST_ERROR
/* Check that the original link is unchanged */
- if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(old_corder != linfo.corder) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (old_corder != linfo.corder)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Move the first link to a UTF-8 name.
* Its creation order value will change, but modification time should not
* change. */
- if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info2(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 4) TEST_ERROR
+ if (H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 4)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Move the link again using the default property list. */
- if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info2(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 5) TEST_ERROR
+ if (H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info2(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 5)
+ TEST_ERROR
/* Check that its character encoding is not UTF-8 */
- if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
+ if (linfo.cset == H5T_CSET_UTF8)
+ TEST_ERROR
/* Close open IDs */
- if(H5Pclose(fcpl_id) < 0) TEST_ERROR
- if(H5Pclose(lcpl_id) < 0) TEST_ERROR
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Pclose(fcpl_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(lcpl_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl_id);
H5Pclose(lcpl_id);
H5Pclose(lcpl2_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_move_preserves() */
-
/*-------------------------------------------------------------------------
* Function: test_deprec
*
@@ -1612,16 +1919,16 @@ error:
static int
test_deprec(hid_t fapl, hbool_t new_format)
{
- hid_t file_id = -1;
- hid_t group1_id = -1;
- hid_t group2_id = -1;
- H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2;
- H5G_obj_t obj_type; /* Object type */
- hsize_t num_objs; /* Number of objects in a group */
- char filename[1024];
- char tmpstr[1024];
-
- if(new_format)
+ hid_t file_id = -1;
+ hid_t group1_id = -1;
+ hid_t group2_id = -1;
+ H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2;
+ H5G_obj_t obj_type; /* Object type */
+ hsize_t num_objs; /* Number of objects in a group */
+ char filename[1024];
+ char tmpstr[1024];
+
+ if (new_format)
TESTING("backwards compatibility (w/new group format)")
else
TESTING("backwards compatibility")
@@ -1629,48 +1936,74 @@ test_deprec(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create two groups in the file */
- if((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Test H5Gset and get comment */
- if(H5Gset_comment(file_id, "group1", "comment") < 0) FAIL_STACK_ERROR
- if(H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(tmpstr, "comment")) TEST_ERROR
+ if (H5Gset_comment(file_id, "group1", "comment") < 0)
+ FAIL_STACK_ERROR
+ if (H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(tmpstr, "comment"))
+ TEST_ERROR
/* Create links using H5Glink and H5Glink2 */
- if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) FAIL_STACK_ERROR
- if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) FAIL_STACK_ERROR
- if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) FAIL_STACK_ERROR
- if(H5Glink2(file_id, "dangle", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/dangle_soft_link") < 0) FAIL_STACK_ERROR
+ if (H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0)
+ FAIL_STACK_ERROR
+ if (H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0)
+ FAIL_STACK_ERROR
+ if (H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0)
+ FAIL_STACK_ERROR
+ if (H5Glink2(file_id, "dangle", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/dangle_soft_link") < 0)
+ FAIL_STACK_ERROR
/* Test getting the names for objects */
- if(H5Gget_objname_by_idx(group1_id, (hsize_t)0, tmpstr, sizeof(tmpstr)) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(tmpstr, "link_to_group2")) TEST_ERROR
- H5E_BEGIN_TRY {
- if(H5Gget_objname_by_idx(group1_id, (hsize_t)1, tmpstr, sizeof(tmpstr)) >= 0) TEST_ERROR
- } H5E_END_TRY;
+ if (H5Gget_objname_by_idx(group1_id, (hsize_t)0, tmpstr, sizeof(tmpstr)) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(tmpstr, "link_to_group2"))
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ if (H5Gget_objname_by_idx(group1_id, (hsize_t)1, tmpstr, sizeof(tmpstr)) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Test getting the type for objects */
- if((obj_type = H5Gget_objtype_by_idx(group1_id, (hsize_t)0)) < 0) FAIL_STACK_ERROR
- if(obj_type != H5G_GROUP) TEST_ERROR
- H5E_BEGIN_TRY {
- if(H5Gget_objtype_by_idx(group1_id, (hsize_t)1) >= 0) TEST_ERROR
- } H5E_END_TRY;
+ if ((obj_type = H5Gget_objtype_by_idx(group1_id, (hsize_t)0)) < 0)
+ FAIL_STACK_ERROR
+ if (obj_type != H5G_GROUP)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ if (H5Gget_objtype_by_idx(group1_id, (hsize_t)1) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Test getting the number of objects in a group */
- if(H5Gget_num_objs(file_id, &num_objs) < 0) FAIL_STACK_ERROR
- if(num_objs != 2) TEST_ERROR
- if(H5Gget_num_objs(group1_id, &num_objs) < 0) FAIL_STACK_ERROR
- if(num_objs != 1) TEST_ERROR
+ if (H5Gget_num_objs(file_id, &num_objs) < 0)
+ FAIL_STACK_ERROR
+ if (num_objs != 2)
+ TEST_ERROR
+ if (H5Gget_num_objs(group1_id, &num_objs) < 0)
+ FAIL_STACK_ERROR
+ if (num_objs != 1)
+ TEST_ERROR
/* Test that H5Glink created hard links properly */
- if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR
- if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR
+ if (H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0)
+ FAIL_STACK_ERROR
- if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) {
+ if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) {
H5_FAILED();
HDputs(" Hard link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
@@ -1678,10 +2011,12 @@ test_deprec(hid_t fapl, hbool_t new_format)
} /* end if */
/* Test for the other hard link created */
- if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR
- if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR
+ if (H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0)
+ FAIL_STACK_ERROR
- if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) {
+ if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) {
H5_FAILED();
HDputs(" Hard link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
@@ -1689,60 +2024,87 @@ test_deprec(hid_t fapl, hbool_t new_format)
} /* end if */
/* Test the soft link */
- if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) FAIL_STACK_ERROR
- if(sb_soft1.type != H5G_LINK) TEST_ERROR
- if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR
+ if (H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0)
+ FAIL_STACK_ERROR
+ if (sb_soft1.type != H5G_LINK)
+ TEST_ERROR
+ if (sb_soft1.linklen != HDstrlen("link_to_group1") + 1)
+ TEST_ERROR
- if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, tmpstr) < 0) FAIL_STACK_ERROR
- if(HDstrcmp("link_to_group1", tmpstr)) TEST_ERROR
+ if (H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, tmpstr) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp("link_to_group1", tmpstr))
+ TEST_ERROR
/* Test non-existing links with H5Gget_objinfo */
- H5E_BEGIN_TRY {
- if(H5Gget_objinfo(file_id, "/group2/soft_link_no_exist", TRUE, NULL) >= 0) FAIL_STACK_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Gget_objinfo(file_id, "/group2/soft_link_no_exist", TRUE, NULL) >= 0)
+ FAIL_STACK_ERROR
+ }
+ H5E_END_TRY;
/* Test the dangling soft link */
- if(H5Gget_objinfo(file_id, "/group2/dangle_soft_link", FALSE, &sb_soft2) < 0) FAIL_STACK_ERROR
- if(sb_soft2.type != H5G_LINK) TEST_ERROR
- if(sb_soft2.linklen != HDstrlen("dangle") + 1) TEST_ERROR
-
- if(H5Gget_linkval(group2_id, "dangle_soft_link", sb_soft2.linklen, tmpstr) < 0) FAIL_STACK_ERROR
- if(HDstrcmp("dangle", tmpstr)) TEST_ERROR
+ if (H5Gget_objinfo(file_id, "/group2/dangle_soft_link", FALSE, &sb_soft2) < 0)
+ FAIL_STACK_ERROR
+ if (sb_soft2.type != H5G_LINK)
+ TEST_ERROR
+ if (sb_soft2.linklen != HDstrlen("dangle") + 1)
+ TEST_ERROR
+ if (H5Gget_linkval(group2_id, "dangle_soft_link", sb_soft2.linklen, tmpstr) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp("dangle", tmpstr))
+ TEST_ERROR
/* Test H5Gmove and H5Gmove2 */
- if(H5Gmove(file_id, "group1", "moved_group1") < 0) FAIL_STACK_ERROR
- if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) FAIL_STACK_ERROR
+ if (H5Gmove(file_id, "group1", "moved_group1") < 0)
+ FAIL_STACK_ERROR
+ if (H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0)
+ FAIL_STACK_ERROR
/* Ensure that both groups can be opened */
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group1_id) < 0)
+ FAIL_STACK_ERROR
- if((group1_id = H5Gopen2(file_id, "moved_group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2_id = H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group1_id = H5Gopen2(file_id, "moved_group1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2_id = H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close open IDs */
- if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group2_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group1_id) < 0)
+ FAIL_STACK_ERROR
/* Test H5Gunlink */
- if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) FAIL_STACK_ERROR
+ if (H5Gunlink(file_id, "moved_group1/moved_group2") < 0)
+ FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- if(H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >=0) TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group2_id);
H5Gclose(group1_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_deprec() */
@@ -1759,137 +2121,155 @@ error:
static int
cklinks_deprec(hid_t fapl, hbool_t new_format)
{
- hid_t file;
- H5O_info1_t oinfo1, oinfo2;
- H5L_info1_t linfo;
- char linkval[LINK_BUF_SIZE];
- char filename[NAME_BUF_SIZE];
- herr_t status;
+ hid_t file;
+ H5O_info1_t oinfo1, oinfo2;
+ H5L_info1_t linfo;
+ char linkval[LINK_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
+ herr_t status;
- if(new_format)
+ if (new_format)
TESTING("link queries using deprecated routines (w/new group format)")
else
TESTING("link queries using deprecated routines")
/* Open the file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Hard link */
- if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5O_TYPE_DATASET != oinfo2.type) {
+ if (H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5O_TYPE_DATASET != oinfo2.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
+ if (H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
H5_FAILED();
HDputs(" Hard link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
TEST_ERROR
} /* end if */
- if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" H5Lexists() should have failed for a path with missing components.");
- TEST_ERROR
+ if (H5Lexists(file, "/", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ if (H5Lexists(file, "d1", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ if (H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ if (H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ if (H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
+ H5E_BEGIN_TRY { status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
HDputs(" H5Lexists() should have failed for a path with missing components.");
TEST_ERROR
} /* end if */
/* Symbolic link */
- if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5O_TYPE_DATASET != oinfo2.type) {
+ if (H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5O_TYPE_DATASET != oinfo2.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
+ if (H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
H5_FAILED();
HDputs(" Soft link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
TEST_ERROR
} /* end if */
- if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(linkval, "/d1")) {
+ if (H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(linkval, "/d1")) {
H5_FAILED();
HDputs(" Soft link test failed. Wrong link value");
TEST_ERROR
} /* end if */
- if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if (H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
/* Dangling link */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
HDputs(" H5Oget_info_by_name() should have failed for a dangling link.");
TEST_ERROR
} /* end if */
- if(H5Lget_info1(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5L_TYPE_SOFT != linfo.type) {
+ if (H5Lget_info1(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5L_TYPE_SOFT != linfo.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
+ if (H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf(" %d: Can't retrieve link value\n", __LINE__);
TEST_ERROR
} /* end if */
- if(HDstrcmp(linkval, "foobar")) {
+ if (HDstrcmp(linkval, "foobar")) {
H5_FAILED();
HDputs(" Dangling link test failed. Wrong link value");
TEST_ERROR
} /* end if */
- if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if (H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE)
+ FAIL_STACK_ERROR
/* Recursive link */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
H5_FAILED();
HDputs(" H5Oget_info_by_name() should have failed for a recursive link.");
TEST_ERROR
} /* end if */
- if(H5Lget_info1(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5L_TYPE_SOFT != linfo.type) {
+ if (H5Lget_info1(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5L_TYPE_SOFT != linfo.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
+ if (H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf(" %d: Can't retrieve link value\n", __LINE__);
TEST_ERROR
} /* end if */
- if(HDstrcmp(linkval, "/grp1/recursive")) {
+ if (HDstrcmp(linkval, "/grp1/recursive")) {
H5_FAILED();
HDputs(" Recursive link test failed. Wrong link value");
TEST_ERROR
} /* end if */
/* Non-existent link */
- if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR
+ if (H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE)
+ FAIL_STACK_ERROR
/* Cleanup */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
@@ -1910,17 +2290,17 @@ error:
static int
test_lcpl_deprec(hid_t fapl, hbool_t new_format)
{
- hid_t file_id = -1;
- hid_t group_id = -1;
- hid_t space_id = -1;
- hid_t dset_id = -1;
- hid_t type_id = -1;
- hid_t lcpl_id = -1;
- H5L_info1_t linfo;
- char filename[1024];
- hsize_t dims[2];
-
- if(new_format)
+ hid_t file_id = -1;
+ hid_t group_id = -1;
+ hid_t space_id = -1;
+ hid_t dset_id = -1;
+ hid_t type_id = -1;
+ hid_t lcpl_id = -1;
+ H5L_info1_t linfo;
+ char filename[1024];
+ hsize_t dims[2];
+
+ if (new_format)
TESTING("link creation property lists using deprecated routines (w/new group format)")
else
TESTING("link creation property lists using deprecated routines")
@@ -1931,123 +2311,183 @@ test_lcpl_deprec(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create and link a group with the default LCPL */
- if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
+ if (H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5F_DEFAULT_CSET)
+ TEST_ERROR
/* Create and commit a datatype with the default LCPL */
- if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(type_id) < 0) TEST_ERROR
+ if ((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(type_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_info1(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
+ if (H5Lget_info1(file_id, "type", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5F_DEFAULT_CSET)
+ TEST_ERROR
/* Create a dataspace */
dims[0] = H5L_DIM1;
dims[1] = H5L_DIM2;
- if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR
+ if ((space_id = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
/* Create a dataset using the default LCPL */
- if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(dset_id) < 0) TEST_ERROR
+ if ((dset_id =
+ H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_info1(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
+ if (H5Lget_info1(file_id, "dataset", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5F_DEFAULT_CSET)
+ TEST_ERROR
/* Create a link creation property list with the UTF-8 character encoding */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0)
+ TEST_ERROR
/* Create and link a group with the new LCPL */
- if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Create and commit a datatype with the new LCPL */
- if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(type_id) < 0) TEST_ERROR
+ if ((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(type_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_info1(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info1(file_id, "type2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Create a dataset using the new LCPL */
- if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(dset_id) < 0) TEST_ERROR
+ if ((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Dclose(dset_id) < 0)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_info1(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info1(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Create a new link to the dataset with a different character encoding. */
- if(H5Pclose(lcpl_id) < 0) TEST_ERROR
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR
+ if (H5Pclose(lcpl_id) < 0)
+ TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0)
+ TEST_ERROR
- if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check that its character encoding is ASCII */
- if(H5Lget_info1(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+ if (H5Lget_info1(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_ASCII)
+ TEST_ERROR
/* Check that the first link's encoding hasn't changed */
- if(H5Lget_info1(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info1(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Make sure that LCPLs work properly for other API calls: */
/* H5Lcreate_soft */
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
- if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info1(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* H5Lmove */
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR
- if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info1(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0)
+ TEST_ERROR
+ if (H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_ASCII)
+ TEST_ERROR
/* H5Lcopy */
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
- if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info1(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0)
+ TEST_ERROR
+ if (H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* H5Lcreate_external */
- if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info1(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "extlink", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Close open IDs */
- if(H5Pclose(lcpl_id) < 0) TEST_ERROR
- if(H5Sclose(space_id) < 0) TEST_ERROR
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Pclose(lcpl_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Dclose(dset_id);
H5Tclose(type_id);
H5Pclose(lcpl_id);
H5Sclose(space_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_lcpl_deprec() */
@@ -2064,158 +2504,231 @@ error:
static int
test_move_preserves_deprec(hid_t fapl_id, hbool_t new_format)
{
- hid_t file_id=-1;
- hid_t group_id=-1;
- hid_t fcpl_id=-1; /* Group creation property list ID */
- hid_t lcpl_id=-1;
- hid_t lcpl2_id=-1;
+ hid_t file_id = -1;
+ hid_t group_id = -1;
+ hid_t fcpl_id = -1; /* Group creation property list ID */
+ hid_t lcpl_id = -1;
+ hid_t lcpl2_id = -1;
H5O_info1_t oinfo;
H5L_info1_t linfo;
- H5T_cset_t old_cset;
- int64_t old_corder; /* Creation order value of link */
- time_t old_modification_time;
- time_t curr_time;
- unsigned crt_order_flags; /* Status of creation order info for GCPL */
- char filename[1024];
-
- if(new_format)
- TESTING("moving and copying links using deprecated routines preserves their properties (w/new group format)")
+ H5T_cset_t old_cset;
+ int64_t old_corder; /* Creation order value of link */
+ time_t old_modification_time;
+ time_t curr_time;
+ unsigned crt_order_flags; /* Status of creation order info for GCPL */
+ char filename[1024];
+
+ if (new_format)
+ TESTING("moving and copying links using deprecated routines preserves their properties (w/new group "
+ "format)")
else
TESTING("moving and copying links using deprecated routines preserves their properties")
/* Create a file creation property list with creation order stored for links
* in the root group
*/
- if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
- if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR
- if(crt_order_flags != 0) TEST_ERROR
- if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR
- if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR
- if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR
+ if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0)
+ TEST_ERROR
+ if (crt_order_flags != 0)
+ TEST_ERROR
+ if (H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ TEST_ERROR
+ if (H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0)
+ TEST_ERROR
+ if (crt_order_flags != H5P_CRT_ORDER_TRACKED)
+ TEST_ERROR
/* Create file */
/* (with creation order tracking for the root group) */
h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0)
+ TEST_ERROR
/* Create a link creation property list with the UTF-8 character encoding */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0)
+ TEST_ERROR
/* Create a group with that lcpl */
- if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Get the group's link's information */
- if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
old_cset = linfo.cset;
- if(old_cset != H5T_CSET_UTF8) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
+ if (old_cset != H5T_CSET_UTF8)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
old_corder = linfo.corder;
- if(old_corder != 0) TEST_ERROR
+ if (old_corder != 0)
+ TEST_ERROR
old_modification_time = oinfo.mtime;
/* If this test happens too quickly, the times will all be the same. Make sure the time changes. */
curr_time = HDtime(NULL);
- while(HDtime(NULL) <= curr_time)
+ while (HDtime(NULL) <= curr_time)
;
/* Close the file and reopen it */
- if(H5Fclose(file_id) < 0) TEST_ERROR
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ TEST_ERROR
/* Get the link's character set & modification time . They should be unchanged */
- if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(old_cset != linfo.cset) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(old_corder != linfo.corder) TEST_ERROR
-
- /* Create a new link to the group. It should have a different creation order value but the same modification time */
- if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_corder == linfo.corder) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 1) TEST_ERROR
- if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+ if (H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (old_cset != linfo.cset)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (old_corder != linfo.corder)
+ TEST_ERROR
+
+ /* Create a new link to the group. It should have a different creation order value but the same
+ * modification time */
+ if (H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_corder == linfo.corder)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 1)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_ASCII)
+ TEST_ERROR
/* Copy the first link to a UTF-8 name.
* Its creation order value should be different, but modification time
* should not change.
*/
- if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info1(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 2) TEST_ERROR
+ if (H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 2)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Move the link with the default property list. */
- if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info1(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 3) TEST_ERROR
+ if (H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 3)
+ TEST_ERROR
/* Check that its character encoding is not UTF-8 */
- if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
+ if (linfo.cset == H5T_CSET_UTF8)
+ TEST_ERROR
/* Check that the original link is unchanged */
- if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(old_corder != linfo.corder) TEST_ERROR
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (old_corder != linfo.corder)
+ TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Move the first link to a UTF-8 name.
* Its creation order value will change, but modification time should not
* change. */
- if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info1(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 4) TEST_ERROR
+ if (H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 4)
+ TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (linfo.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Move the link again using the default property list. */
- if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
- if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info1(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != 5) TEST_ERROR
+ if (H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (old_modification_time != oinfo.mtime)
+ TEST_ERROR
+ if (H5Lget_info1(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != 5)
+ TEST_ERROR
/* Check that its character encoding is not UTF-8 */
- if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
+ if (linfo.cset == H5T_CSET_UTF8)
+ TEST_ERROR
/* Close open IDs */
- if(H5Pclose(fcpl_id) < 0) TEST_ERROR
- if(H5Pclose(lcpl_id) < 0) TEST_ERROR
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Pclose(fcpl_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(lcpl_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl_id);
H5Pclose(lcpl_id);
H5Pclose(lcpl2_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_move_preserves_deprec() */
@@ -2231,16 +2744,16 @@ error:
static int
external_link_root_deprec(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5L_info1_t linfo; /* Link information */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
- const char *file; /* File from external link */
- const char *path; /* Path from external link */
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info1_t linfo; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
+ const char *file; /* File from external link */
+ const char *path; /* Path from external link */
+
+ if (new_format)
TESTING("external link to root using deprecated routines (w/new group format)")
else
TESTING("external link to root using deprecated routines")
@@ -2250,35 +2763,43 @@ external_link_root_deprec(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create file to point to */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Check that external links are registered with the library */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
/* Create file with link to first file */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to object in first file */
- if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check information for external link */
- if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
- if(H5L_TYPE_EXTERNAL != linfo.type) {
+ if (H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0)
+ goto error;
+ if (H5L_TYPE_EXTERNAL != linfo.type) {
H5_FAILED();
HDputs(" Unexpected object type - should have been an external link");
goto error;
}
- if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR
- if(HDstrcmp(file, filename1)) {
+ if (H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0)
+ TEST_ERROR
+ if (HDstrcmp(file, filename1)) {
H5_FAILED();
HDputs(" External link file name incorrect");
goto error;
}
- if(HDstrcmp(path, "/")) {
+ if (HDstrcmp(path, "/")) {
H5_FAILED();
HDputs(" External link path incorrect");
goto error;
@@ -2286,111 +2807,143 @@ external_link_root_deprec(hid_t fapl, hbool_t new_format)
/* Create external link to object in first file */
/* (add a few extra '/'s to make certain library normalizes external link object names) */
- if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check information for external link */
- if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
- if(H5L_TYPE_EXTERNAL != linfo.type) {
+ if (H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0)
+ goto error;
+ if (H5L_TYPE_EXTERNAL != linfo.type) {
H5_FAILED();
HDputs(" Unexpected object type - should have been an external link");
goto error;
}
- if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR
- if(HDstrcmp(file, filename1)) {
+ if (H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0)
+ TEST_ERROR
+ if (HDstrcmp(file, filename1)) {
H5_FAILED();
HDputs(" External link file name incorrect");
goto error;
}
- if(HDstrcmp(path, "/")) {
+ if (HDstrcmp(path, "/")) {
H5_FAILED();
HDputs(" External link path incorrect");
goto error;
}
/* Close and re-open file to ensure that data is written to disk */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create a new object using H5Gcreate2 through the external link
* directly
*/
- if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close file and group */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ if (H5I_nmembers(H5I_FILE) != 0)
+ TEST_ERROR
H5F_sfile_assert_num(0);
/* Open first file again with read-only access and check on objects created */
- if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open objects created through external link */
- if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check names */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/new_group")) TEST_ERROR
- if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/newer_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/new_group"))
+ TEST_ERROR
+ if (H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/newer_group"))
+ TEST_ERROR
/* Close opened objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ if (H5I_nmembers(H5I_FILE) != 0)
+ TEST_ERROR
H5F_sfile_assert_num(0);
/* Verify that new objects can't be created through a read-only external
* link.
*/
- if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
- H5E_BEGIN_TRY {
- gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY
- if(gid >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY
+ if (gid >= 0)
+ TEST_ERROR
/* Close second file again */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ if (H5I_nmembers(H5I_FILE) != 0)
+ TEST_ERROR
H5F_sfile_assert_num(0);
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_root_deprec() */
@@ -2407,17 +2960,16 @@ error:
static int
external_link_query_deprec(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- const char *file_name; /* Name of the file the external link points to */
- const char *object_name; /* Name of the object the external link points to */
- H5O_info1_t oi; /* Object information */
- H5L_info1_t li; /* Link information */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
- query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ const char *file_name; /* Name of the file the external link points to */
+ const char *object_name; /* Name of the object the external link points to */
+ H5O_info1_t oi; /* Object information */
+ H5L_info1_t li; /* Link information */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
+ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */
+
+ if (new_format)
TESTING("query aspects of external link using deprecated routines (w/new group format)")
else
TESTING("query aspects of external link using deprecated routines")
@@ -2427,15 +2979,19 @@ external_link_query_deprec(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file, with external link to object in second file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link */
/* (add a few extra '/'s to make certain library normalizes external link object names) */
- if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Get size of buffer for external link */
- if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
+ if (H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1)))
+ TEST_ERROR
if (H5L_TYPE_EXTERNAL != li.type) {
H5_FAILED();
HDputs(" Unexpected link class - should have been an external link");
@@ -2443,76 +2999,105 @@ external_link_query_deprec(hid_t fapl, hbool_t new_format)
}
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file to point to */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create object to link to */
- if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Get size of buffer for external link */
- if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
- if(H5L_TYPE_EXTERNAL != li.type) {
+ if (H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1)))
+ TEST_ERROR
+ if (H5L_TYPE_EXTERNAL != li.type) {
H5_FAILED();
HDputs(" Unexpected link class - should have been an external link");
goto error;
}
/* Get information for external link. It should be two strings right after each other */
- if(H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Extract the file and object names from the buffer */
- if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR
+ if (H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0)
+ TEST_ERROR
/* Compare the file and object names */
- if(HDstrcmp(file_name, filename2)) TEST_ERROR
- if(HDstrcmp(object_name, "/dst")) TEST_ERROR
+ if (HDstrcmp(file_name, filename2))
+ TEST_ERROR
+ if (HDstrcmp(object_name, "/dst"))
+ TEST_ERROR
/* Query information about object that external link points to */
- if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5O_TYPE_GROUP != oi.type) {
+ if (H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5O_TYPE_GROUP != oi.type) {
H5_FAILED();
HDputs(" Unexpected object type - should have been a group");
goto error;
}
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Make sure that passing in NULLs to H5Lunpack_elink_val works */
- if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR
+ if (H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0)
+ TEST_ERROR
/* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */
- H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR
- } H5E_END_TRY
- H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
- } H5E_END_TRY
- H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
- } H5E_END_TRY
- H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_query_deprec() */
@@ -2529,20 +3114,18 @@ error:
static int
external_link_closing_deprec(hid_t fapl, hbool_t new_format)
{
- hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4=(-1);
- hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1);
- hid_t lcpl_id=(-1);
- hsize_t dims[2];
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- filename4[NAME_BUF_SIZE], /* Names of files to externally link across */
- buf[NAME_BUF_SIZE]; /* misc. buffer */
+ hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4 = (-1);
+ hid_t gid = (-1), tid = (-1), tid2 = (-1), sid = (-1), did = (-1);
+ hid_t lcpl_id = (-1);
+ hsize_t dims[2];
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE],
+ filename4[NAME_BUF_SIZE], /* Names of files to externally link across */
+ buf[NAME_BUF_SIZE]; /* misc. buffer */
H5L_info1_t li;
H5O_info1_t oi;
hobj_ref_t obj_ref;
- if(new_format)
+ if (new_format)
TESTING("that external files are closed during traversal (w/new group format)")
else
TESTING("that external files are closed during traversal")
@@ -2562,175 +3145,263 @@ external_link_closing_deprec(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4);
/* Create four files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */
dims[0] = 2;
dims[1] = 2;
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* Create external links from each file to the next */
- if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close all files but the first */
- if(H5Fclose(fid4) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid4) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid3) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Test creating each kind of object */
- if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Test that getting info works */
- if(H5Lget_info1(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info1(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info1(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Test move */
- if(H5Lmove(fid1, "elink/elink/elink/group1", fid1,
- "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lmove(fid1, "elink/elink/elink/group1", fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open file 4 so we can do some fancy things */
- if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if(H5Lmove(fid1, "elink/elink/elink/type1", fid4,
- "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lmove(fid4, "dataset1", fid1,
- "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lmove(fid1, "elink/elink/elink/type1", fid4, "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lmove(fid4, "dataset1", fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file 4 again */
- if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid4) < 0)
+ FAIL_STACK_ERROR
/* Test copy (as of this test, it uses the same code as move) */
- if(H5Lcopy(fid1, "elink/elink/elink", fid1,
- "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcopy(fid1, "elink/elink/elink", fid1,
- "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcopy(fid1, "elink/elink/elink", fid1, "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcopy(fid1, "elink/elink/elink", fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Test H5Gset and get comment */
- if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(buf, "comment")) TEST_ERROR
+ if (H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(buf, "comment"))
+ TEST_ERROR
/* Test H5*open */
- if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Test H5*open2 */
- if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Test H5Oopen */
- if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Test H5Fmount */
- if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- H5E_BEGIN_TRY {
- if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR
- if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR
- } H5E_END_TRY
+ if ((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ if (H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ if (H5Funmount(fid1, "elink/elink/elink/mnt") >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
/* Test H5Rcreate */
- if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR
+ if (H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0)
+ TEST_ERROR
/* Test unlink */
- if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0)
+ TEST_ERROR
/* We've tested that the various functions above don't leave files open.
- * Now test that we can't confuse HDF5 by giving unusual paths with external links
- */
+ * Now test that we can't confuse HDF5 by giving unusual paths with external links
+ */
/* Create an external link that points to another external link */
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/elink", fid2, "elink2",
- H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename3, "/elink", fid2, "elink2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Do an external link traversal that recursively calls another external link. */
- if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create two more groups so that the last three elements in the path are
- * all within the same external file
- */
- if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ * all within the same external file
+ */
+ if ((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Add a few regular groups and a soft link in file2 using intermediate group creation */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
- if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink",
- lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Try to traverse this path. There are three soft traversals in a row;
* slink points to (file2)/elink2, which points to (file3)/elink, which
* points to file 4.
*/
- if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Lget_info1(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Some simpler tests */
- if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Lget_info1(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info1(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
-
+ if ((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(fid1, "elink/elink", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file1, the only file that should still be open */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Re-create each file. If they are hanging open, these creates will fail */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Cleanup */
- if(H5Sclose(sid) < 0) TEST_ERROR
- if(H5Tclose(tid2) < 0) TEST_ERROR
- if(H5Fclose(fid4) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid4) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid3) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Tclose(tid);
H5Dclose(did);
@@ -2740,21 +3411,22 @@ error:
H5Fclose(fid3);
H5Fclose(fid2);
H5Fclose(fid1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* external_link_closing_deprec() */
/* Callback functions for UD hard links. */
/* UD_hard_create increments the object's reference count */
static herr_t
-UD_hard_create_deprec(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata,
- size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id)
+UD_hard_create_deprec(const char H5_ATTR_UNUSED *link_name, hid_t loc_group, const void *udata,
+ size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id)
{
haddr_t addr;
- hid_t target_obj = -1;
- herr_t ret_value = 0;
+ hid_t target_obj = -1;
+ herr_t ret_value = 0;
- if(udata_size != sizeof(haddr_t)) {
+ if (udata_size != sizeof(haddr_t)) {
ret_value = -1;
goto done;
} /* end if */
@@ -2762,34 +3434,34 @@ UD_hard_create_deprec(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, co
addr = *((const haddr_t *)udata);
/* Open the object this link points to */
- target_obj= H5Oopen_by_addr(loc_group, addr);
- if(target_obj < 0) {
+ target_obj = H5Oopen_by_addr(loc_group, addr);
+ if (target_obj < 0) {
ret_value = -1;
goto done;
} /* end if */
/* Increment the reference count of the target object */
- if(H5Oincr_refcount(target_obj) < 0) {
+ if (H5Oincr_refcount(target_obj) < 0) {
ret_value = -1;
goto done;
} /* end if */
done:
/* Close the target object if we opened it */
- if(target_obj >= 0) {
- switch(H5Iget_type(target_obj)) {
+ if (target_obj >= 0) {
+ switch (H5Iget_type(target_obj)) {
case H5I_GROUP:
- if(H5Gclose(target_obj) < 0)
+ if (H5Gclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATASET:
- if(H5Dclose(target_obj) < 0)
+ if (H5Dclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATATYPE:
- if(H5Tclose(target_obj) < 0)
+ if (H5Tclose(target_obj) < 0)
ret_value = -1;
break;
@@ -2811,26 +3483,25 @@ done:
case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
- return FAIL;
+ return FAIL;
} /* end switch */
- } /* end if */
+ } /* end if */
return ret_value;
} /* end UD_hard_create() */
/* Traverse a hard link by opening the object */
static hid_t
-UD_hard_traverse_deprec(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id)
+UD_hard_traverse_deprec(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *udata,
+ size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id)
{
haddr_t addr;
- hid_t ret_value = -1;
+ hid_t ret_value = -1;
- if(udata_size != sizeof(haddr_t))
+ if (udata_size != sizeof(haddr_t))
return FAIL;
- addr = *((const haddr_t *) udata);
+ addr = *((const haddr_t *)udata);
ret_value = H5Oopen_by_addr(cur_group, addr); /* If this fails, our return value will be negative. */
@@ -2839,49 +3510,48 @@ UD_hard_traverse_deprec(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* UD_hard_delete decrements the object's reference count */
static herr_t
-UD_hard_delete_deprec(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata,
- size_t udata_size)
+UD_hard_delete_deprec(const char H5_ATTR_UNUSED *link_name, hid_t file, const void *udata, size_t udata_size)
{
haddr_t addr;
- hid_t target_obj = -1;
- herr_t ret_value = 0;
+ hid_t target_obj = -1;
+ herr_t ret_value = 0;
- if(udata_size != sizeof(haddr_t)) {
+ if (udata_size != sizeof(haddr_t)) {
ret_value = -1;
goto done;
} /* end if */
- addr = *((const haddr_t *) udata);
+ addr = *((const haddr_t *)udata);
/* Open the object this link points to */
- target_obj= H5Oopen_by_addr(file, addr);
- if(target_obj < 0) {
+ target_obj = H5Oopen_by_addr(file, addr);
+ if (target_obj < 0) {
ret_value = -1;
goto done;
} /* end if */
/* Decrement the reference count of the target object */
- if(H5Odecr_refcount(target_obj) < 0) {
+ if (H5Odecr_refcount(target_obj) < 0) {
ret_value = -1;
goto done;
} /* end if */
done:
/* Close the target object if we opened it */
- if(target_obj >= 0) {
- switch(H5Iget_type(target_obj)) {
+ if (target_obj >= 0) {
+ switch (H5Iget_type(target_obj)) {
case H5I_GROUP:
- if(H5Gclose(target_obj) < 0)
+ if (H5Gclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATASET:
- if(H5Dclose(target_obj) < 0)
+ if (H5Dclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATATYPE:
- if(H5Tclose(target_obj) < 0)
+ if (H5Tclose(target_obj) < 0)
ret_value = -1;
break;
@@ -2905,7 +3575,7 @@ done:
default:
return FAIL;
} /* end switch */
- } /* end if */
+ } /* end if */
return ret_value;
} /* end UD_hard_delete() */
@@ -2913,11 +3583,11 @@ done:
static int
ud_hard_links_deprec(hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5L_info1_t li; /* Link information */
- char objname[NAME_BUF_SIZE]; /* Object name */
- h5_stat_size_t empty_size; /* Size of an empty file */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info1_t li; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ h5_stat_size_t empty_size; /* Size of an empty file */
char filename[NAME_BUF_SIZE];
TESTING("user-defined hard link using deprecated routines (w/new group format)")
@@ -2925,70 +3595,98 @@ ud_hard_links_deprec(hid_t fapl)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Get the size of the empty file for reference */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Check that external links are registered and UD hard links are not */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ TEST_ERROR
/* Register "user-defined hard links" with the library */
- if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR
+ if (H5Lregister(UD_hard_class_deprec) < 0)
+ TEST_ERROR
/* Check that UD hard links are now registered */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ TEST_ERROR
/* Create a group for the UD hard link to point to */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Get address for the group to give to the hard link */
- if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create a user-defined "hard link" to the group using the address we got
* from H5Lget_info1 */
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t),
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close and re-open file to ensure that data is written to disk */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open group through UD link */
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/group"))
+ TEST_ERROR
/* Create object in group */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close groups*/
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Re-open group without using ud link to check that it was created properly */
- if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/group/new_group"))
+ TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Check that H5Lget_objinfo works on the hard link */
- if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* UD hard links have no query function, thus return a "link length" of 0 */
- if(li.u.val_size != 0) TEST_ERROR
- if(UD_HARD_TYPE != li.type) {
+ if (li.u.val_size != 0)
+ TEST_ERROR
+ if (UD_HARD_TYPE != li.type) {
H5_FAILED();
HDputs(" Unexpected link class - should have been a UD hard link");
goto error;
@@ -2996,190 +3694,245 @@ ud_hard_links_deprec(hid_t fapl)
/* Unlink the group pointed to by the UD link. It shouldn't be
* deleted because of the UD link. */
- if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/group", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Ensure we can open the group through the UD link */
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Unlink the group contained within it. */
- if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Now delete the UD link. This should cause the group to be
* deleted, too. */
- if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* The file should be empty again. */
- if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR
+ if (empty_size != h5_get_file_size(filename, fapl))
+ TEST_ERROR
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end ud_hard_links_deprec() */
static int
ud_link_reregister_deprec(hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5L_info1_t li; /* Link information */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
- h5_stat_size_t empty_size; /* Size of an empty file */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info1_t li; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ h5_stat_size_t empty_size; /* Size of an empty file */
TESTING("registering a new class for existing UD links using deprecated routines (w/new group format)")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Get the size of the empty file for reference */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Check that UD hard links are not registered */
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ TEST_ERROR
/* Register "user-defined hard links" with the library */
- if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR
+ if (H5Lregister(UD_hard_class_deprec) < 0)
+ TEST_ERROR
/* Check that UD hard links are registered */
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ TEST_ERROR
/* Point a UD defined hard link to a group in the same way as the previous test */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address),
- sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(li.u.address),
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Create a group named REREG_TARGET_NAME in the same group as the ud link */
- if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Now unregister UD hard links */
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ TEST_ERROR
/* Check that UD hard links are no longer registered */
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ TEST_ERROR
/* Verify that we can't traverse the ud link anymore */
- H5E_BEGIN_TRY {
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
/* Verify that we can't create any new links of this type */
- H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address),
- sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(li.u.address),
+ H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* Register a new kind of link with the same ID number */
- if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_rereg_class) < 0)
+ TEST_ERROR
/* Check that UD hard links are registered again */
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ TEST_ERROR
/* Open a group through the ud link (now a different class of link).
* It should be a different group
* than the UD hard link pointed to */
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/" REREG_TARGET_NAME))
+ TEST_ERROR
/* Create object in group */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close groups*/
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Re-open group without using ud link to check that it was created properly */
- if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/rereg_target/new_group"))
+ TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Unlink the group pointed to by the UD hard link. It shouldn't be
* deleted because the UD link incremented its reference count. */
- if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/group", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* What a mess! Re-register user-defined links to clean up the
* reference counts. We shouldn't actually need to unregister the
* other link type */
- if(H5Lregister(UD_hard_class_deprec) < 0) FAIL_STACK_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR
+ if (H5Lregister(UD_hard_class_deprec) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ FAIL_STACK_ERROR
/* Ensure we can open the group through the UD link (now that UD hard
* links have been registered) */
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Delete the UD hard link. This should cause the group to be
* deleted, too. */
- if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Unlink the other two groups so that we can make sure the file is empty */
- if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* The file should be empty again. */
- if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR
+ if (empty_size != h5_get_file_size(filename, fapl))
+ TEST_ERROR
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end ud_link_reregister_deprec() */
static int
ud_callbacks_deprec(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
hid_t lcpl = -1; /* Link Creation PL */
H5L_info1_t li; /* Link information */
char ud_target_name[] = UD_CB_TARGET; /* Link target name */
char filename[NAME_BUF_SIZE];
char query_buf[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("user-defined link callbacks using deprecated routines (w/new group format)")
else
TESTING("user-defined link callbacks using deprecated routines")
@@ -3187,40 +3940,57 @@ ud_callbacks_deprec(hid_t fapl, hbool_t new_format)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Check that registered link classes are, and unregistered ones aren't */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE)
+ TEST_ERROR
/* Hit two birds with one stone: register UD hard links from previous
* test to check that having two UD links registered at once presents
* no problems. */
- if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR
+ if (H5Lregister(UD_hard_class_deprec) < 0)
+ TEST_ERROR
/* Register user-defined link class. This is the one we'll actually be using. */
- if(H5Lregister(UD_cb_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_cb_class) < 0)
+ TEST_ERROR
/* Check that registered link classes are, and unregistered ones aren't */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE)
+ TEST_ERROR
/* Create a group for the UD link to point to */
- if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create a user-defined link to the group. These UD links behave like soft links. */
- if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Try opening group through UD link */
- if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Query the link to test its query callback */
- if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.u.val_size != 16) TEST_ERROR
+ if (H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.u.val_size != 16)
+ TEST_ERROR
if (UD_CB_TYPE != li.type) {
H5_FAILED();
HDputs(" Unexpected link class - should have been a UD hard link");
@@ -3228,64 +3998,93 @@ ud_callbacks_deprec(hid_t fapl, hbool_t new_format)
}
/* Fill the query buffer */
- if(H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR
+ if (H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(query_buf, "query succeeded") != 0)
+ TEST_ERROR
/* Move the link */
- if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Re-open group to ensure that move worked */
- if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Remove UD link */
- if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Test that the callbacks don't work if the link class is not registered */
/* Create a new link. Just for fun, give it a non-default character
* encoding (to test that LAPLs work) */
- if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR
- if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR
+ if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN,
+ lcpl, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(lcpl) < 0)
+ FAIL_STACK_ERROR
/* Check its character encoding */
- if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(li.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (li.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Unregister the link class so the library forgets what its callbacks do */
- if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR
+ if (H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0)
+ FAIL_STACK_ERROR
/* Now test that each of the callbacks fails */
- H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
- if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
- if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name,
+ (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ FAIL_STACK_ERROR
+ if (H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0)
+ FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0)
+ FAIL_STACK_ERROR
+ }
+ H5E_END_TRY
/* The query callback should NOT fail, but should be unable to give a linklen */
- if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(li.u.val_size != 0) TEST_ERROR
- if(li.type != UD_CB_TYPE) TEST_ERROR
+ if (H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (li.u.val_size != 0)
+ TEST_ERROR
+ if (li.type != UD_CB_TYPE)
+ TEST_ERROR
/* Unregister the UD hard links */
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Pclose (lcpl);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(lcpl);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end ud_callbacks_deprec() */
@@ -3302,17 +4101,17 @@ error:
static int
lapl_nlinks_deprec(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t plist = -1; /* lapl ID */
- hid_t tid = -1, sid = -1, did = -1; /* Other IDs */
- hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
- size_t nlinks; /* nlinks for H5Pset_nlinks */
- hsize_t dims[2];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t plist = -1; /* lapl ID */
+ hid_t tid = -1, sid = -1, did = -1; /* Other IDs */
+ hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ size_t nlinks; /* nlinks for H5Pset_nlinks */
+ hsize_t dims[2];
+
+ if (new_format)
TESTING("adjusting nlinks with LAPL using deprecated routines (w/new group format)")
else
TESTING("adjusting nlinks with LAPL using deprecated routines")
@@ -3325,76 +4124,110 @@ lapl_nlinks_deprec(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group with short name in file (used as target for links) */
- if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create chain of soft links to existing object (limited) */
- if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Create LAPL with higher-than-usual nlinks value */
/* Create a non-default lapl with udata set to point to the first group */
- if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
+ if ((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ TEST_ERROR
nlinks = 20;
- if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
+ if (H5Pset_nlinks(plist, nlinks) < 0)
+ TEST_ERROR
/* Ensure that nlinks was set successfully */
nlinks = 0;
- if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR
- if(nlinks != 20) TEST_ERROR
+ if (H5Pget_nlinks(plist, &nlinks) < 0)
+ TEST_ERROR
+ if (nlinks != 20)
+ TEST_ERROR
/* Open object through what is normally too many soft links using
* new property list */
- if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR
+ if ((gid = H5Oopen(fid, "soft17", plist)) < 0)
+ TEST_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/soft17")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/soft17"))
+ TEST_ERROR
/* Create group using soft link */
- if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close groups */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Set nlinks to a smaller number */
nlinks = 4;
- if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
+ if (H5Pset_nlinks(plist, nlinks) < 0)
+ TEST_ERROR
/* Ensure that nlinks was set successfully */
nlinks = 0;
- if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR
- if(nlinks != 4) TEST_ERROR
+ if (H5Pget_nlinks(plist, &nlinks) < 0)
+ TEST_ERROR
+ if (nlinks != 4)
+ TEST_ERROR
/* Try opening through what is now too many soft links */
- H5E_BEGIN_TRY {
- gid = H5Oopen(fid, "soft5", plist);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Oopen(fid, "soft5", plist); }
+ H5E_END_TRY;
if (gid >= 0) {
H5_FAILED();
HDputs(" Should have failed for sequence of too many nested links.");
@@ -3402,106 +4235,149 @@ lapl_nlinks_deprec(hid_t fapl, hbool_t new_format)
}
/* Open object through lesser soft link */
- if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR
+ if ((gid = H5Oopen(fid, "soft4", plist)) < 0)
+ TEST_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/soft4")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/soft4"))
+ TEST_ERROR
/* Test other functions that should use a LAPL */
nlinks = 20;
- if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
+ if (H5Pset_nlinks(plist, nlinks) < 0)
+ TEST_ERROR
/* Try copying and moving when both src and dst contain many soft links
* using a non-default LAPL
*/
- if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR
- if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if (H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
+ if (H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
/* H5Olink */
- if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if (H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
/* H5Lcreate_hard and H5Lcreate_soft */
- if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR
- if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if (H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
/* H5Ldelete */
- if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR
+ if (H5Ldelete(fid, "soft17/soft_link", plist) < 0)
+ TEST_ERROR
/* H5Lget_val and H5Lget_info1 */
- if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR
- if(H5Lget_info1(fid, "soft17", NULL, plist) < 0) TEST_ERROR
+ if (H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0)
+ TEST_ERROR
+ if (H5Lget_info1(fid, "soft17", NULL, plist) < 0)
+ TEST_ERROR
/* H5Lcreate_external and H5Lcreate_ud */
- if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR
- if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR
- if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if (H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
+ if (H5Lregister(UD_rereg_class) < 0)
+ TEST_ERROR
+ if (H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
/* Close plist */
- if(H5Pclose(plist) < 0) TEST_ERROR
+ if (H5Pclose(plist) < 0)
+ TEST_ERROR
/* Create a datatype and dataset as targets inside the group */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
dims[0] = 2;
dims[1] = 2;
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
- if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Try to open the objects using too many symlinks with default *APLs */
- H5E_BEGIN_TRY {
- if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0)
+ H5E_BEGIN_TRY
+ {
+ if ((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0)
FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
- if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0)
+ if ((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0)
FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
- if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0)
+ if ((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0)
FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* Create property lists with nlinks set */
- if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR
- if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR
+ if ((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0)
+ TEST_ERROR
+ if ((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0)
+ TEST_ERROR
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ TEST_ERROR
nlinks = 20;
- if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR
- if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR
- if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR
+ if (H5Pset_nlinks(gapl, nlinks) < 0)
+ TEST_ERROR
+ if (H5Pset_nlinks(tapl, nlinks) < 0)
+ TEST_ERROR
+ if (H5Pset_nlinks(dapl, nlinks) < 0)
+ TEST_ERROR
/* We should now be able to use these property lists to open each kind
* of object.
*/
- if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR
- if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR
- if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR
+ if ((gid = H5Gopen2(fid, "soft17", gapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0)
+ TEST_ERROR
+ if ((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0)
+ TEST_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close plists */
- if(H5Pclose(gapl) < 0) TEST_ERROR
- if(H5Pclose(tapl) < 0) TEST_ERROR
- if(H5Pclose(dapl) < 0) TEST_ERROR
+ if (H5Pclose(gapl) < 0)
+ TEST_ERROR
+ if (H5Pclose(tapl) < 0)
+ TEST_ERROR
+ if (H5Pclose(dapl) < 0)
+ TEST_ERROR
/* Unregister UD hard link class */
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gapl);
H5Pclose(dapl);
H5Pclose(tapl);
@@ -3512,7 +4388,8 @@ error:
H5Gclose(gid);
H5Pclose(plist);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end lapl_nlinks_deprec() */
@@ -3528,14 +4405,14 @@ error:
static int
linkinfo_deprec(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t tid = -1; /* Type ID */
- hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */
- H5L_info1_t li; /* Link information */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t tid = -1; /* Type ID */
+ hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */
+ H5L_info1_t li; /* Link information */
char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("link type field in H5Lget_info using deprecated routines (w/new group format)")
else
TESTING("link type field in H5Lget_info using deprecated routines")
@@ -3543,58 +4420,88 @@ linkinfo_deprec(hid_t fapl, hbool_t new_format)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Register a couple of user-defined link classes with the library */
- if(H5Lregister(UD_plist_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_plist_class) < 0)
+ TEST_ERROR
/* Create an object of each type */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
- if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close all objects */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Make sure that link type is correct when objects are queried */
- if(H5Lget_info1(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_HARD) TEST_ERROR
- if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_HARD) TEST_ERROR
- if(H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_HARD) TEST_ERROR
-
- if(H5Lget_info1(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR
- if(H5Lget_info1(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_SOFT) TEST_ERROR
- if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != UD_PLIST_TYPE) TEST_ERROR
+ if (H5Lget_info1(fid, "datatype", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_HARD)
+ TEST_ERROR
+ if (H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_HARD)
+ TEST_ERROR
+ if (H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_HARD)
+ TEST_ERROR
+
+ if (H5Lget_info1(fid, "ext_link", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_EXTERNAL)
+ TEST_ERROR
+ if (H5Lget_info1(fid, "softlink", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_SOFT)
+ TEST_ERROR
+ if (H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != UD_PLIST_TYPE)
+ TEST_ERROR
/* Ensure that passing a NULL pointer doesn't cause an error */
- if(H5Lget_info1(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info1(fid, "group", NULL, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Tclose (tid);
- H5Dclose (did);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(tid);
+ H5Dclose(did);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end linkinfo_deprec() */
@@ -3611,102 +4518,132 @@ error:
static int
corder_create_compact_deprec(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned nlinks; /* Number of link messages in group's header */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- unsigned u; /* Local index variable */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned nlinks; /* Number of link messages in group's header */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ unsigned u; /* Local index variable */
TESTING("creating compact group with creation order indexing using deprecated routines")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0)
+ TEST_ERROR
/* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on group's initial status */
- if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__is_empty_test(group_id) != TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Create several links, but keep group in compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
- if(nlinks != (u + 1)) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, &nlinks) != TRUE)
+ TEST_ERROR
+ if (nlinks != (u + 1))
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
} /* end for */
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open group created */
- if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
- if(nlinks != max_compact) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, &nlinks) != TRUE)
+ TEST_ERROR
+ if (nlinks != max_compact)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Loop through links, checking their creation order values */
/* (the name index is used, but the creation order value is in the same order) */
- for(u = 0; u < max_compact; u++) {
- H5L_info1_t linfo; /* Link information */
+ for (u = 0; u < max_compact; u++) {
+ H5L_info1_t linfo; /* Link information */
/* Retrieve information for link */
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify creation order of link */
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != u) TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != u)
+ TEST_ERROR
} /* end for */
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end corder_create_compact_deprec() */
@@ -3723,117 +4660,153 @@ error:
static int
corder_create_dense_deprec(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned nlinks; /* Number of link messages in group's header */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- unsigned u; /* Local index variable */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned nlinks; /* Number of link messages in group's header */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ unsigned u; /* Local index variable */
TESTING("creating dense group with creation order indexing using deprecated routines")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0)
+ TEST_ERROR
/* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on group's initial status */
- if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__is_empty_test(group_id) != TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
- if(nlinks != (u + 1)) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, &nlinks) != TRUE)
+ TEST_ERROR
+ if (nlinks != (u + 1))
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
} /* end for */
/* Create another link, to push group into dense form */
HDsnprintf(objname, sizeof(objname), "filler %u", max_compact);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve & verify # of records in the name & creation order indices */
- if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
- if(name_count != corder_count) TEST_ERROR
+ if (H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0)
+ TEST_ERROR
+ if (name_count != corder_count)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open group created */
- if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Loop through links, checking their creation order values */
/* (the name index is used, but the creation order value is in the same order) */
- for(u = 0; u < (max_compact + 1); u++) {
- H5L_info1_t linfo; /* Link information */
+ for (u = 0; u < (max_compact + 1); u++) {
+ H5L_info1_t linfo; /* Link information */
/* Retrieve information for link */
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify creation order of link */
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != u) TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != u)
+ TEST_ERROR
} /* end for */
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end corder_create_dense_deprec() */
@@ -3851,111 +4824,154 @@ error:
*-------------------------------------------------------------------------
*/
static int
-link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n,
- hbool_t hard_link, hbool_t use_index)
+link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, hbool_t hard_link,
+ hbool_t use_index)
{
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- char valname[NAME_BUF_SIZE]; /* Link value name */
- char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
- H5L_info1_t linfo; /* Link info struct */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
+ H5L_info1_t linfo; /* Link info struct */
/* Make link value for increasing/native order queries */
HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n);
/* Verify the link information for first link, in increasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in increasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in increasing creation order */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in increasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
/* Don't test "native" order if there is no creation order index, since
* there's not a good way to easily predict the link's order in the name
* index.
*/
- if(use_index) {
+ if (use_index) {
/* Verify the link information for first link, in native creation order (which is increasing) */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in native creation order (which is increasing) */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in native creation order (which is increasing) */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in native creation order (which is increasing) */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
} /* end if */
/* Verify the link information for first link, in decreasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in decreasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in decreasing creation order */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in decreasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
-
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
/* Verify the link information for first link, in increasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in increasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in increasing link name order */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in increasing link name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
/* Don't test "native" order queries on link name order, since there's not
* a good way to easily predict the order of the links in the name index.
@@ -3963,32 +4979,42 @@ link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n,
/* Verify the link information for first link, in decreasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in decreasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in decreasing link name order */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in decreasing link name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
/* Success */
- return(0);
+ return (0);
error:
/* Failure */
- return(-1);
+ return (-1);
} /* end link_info_by_idx_check_deprec() */
/*-------------------------------------------------------------------------
@@ -4004,170 +5030,229 @@ error:
static int
link_info_by_idx_deprec(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- unsigned hard_link; /* Create hard or soft link? */
- unsigned use_index; /* Use index on creation order values */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5L_info1_t linfo; /* Link info struct */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value name */
- char filename[NAME_BUF_SIZE];/* File name */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- unsigned u; /* Local index variable */
- ssize_t name_len; /* Length of name */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned hard_link; /* Create hard or soft link? */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ H5L_info1_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
+ herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
- for(hard_link = FALSE; hard_link <= TRUE; hard_link++) {
+ for (hard_link = FALSE; hard_link <= TRUE; hard_link++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
- if(hard_link) {
- if(use_index)
- TESTING("querying info by index w/creation order index, using hard links and deprecated routines")
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
+ if (hard_link) {
+ if (use_index)
+ TESTING("querying info by index w/creation order index, using hard links and deprecated "
+ "routines")
else
- TESTING("querying info by index w/o creation order index, using hard links and deprecated routines")
+ TESTING("querying info by index w/o creation order index, using hard links and "
+ "deprecated routines")
} /* end if */
else {
- if(use_index)
- TESTING("querying info by index w/creation order index, using soft links and deprecated routines")
+ if (use_index)
+ TESTING("querying info by index w/creation order index, using soft links and deprecated "
+ "routines")
else
- TESTING("querying info by index w/o creation order index, using soft links and deprecated routines")
+ TESTING("querying info by index w/o creation order index, using soft links and "
+ "deprecated routines")
} /* end else */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(
+ gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0)
+ TEST_ERROR
/* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Check for query on empty group */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(name_len >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (name_len >= 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Check for creating hard or soft link */
- if(hard_link) {
- hid_t group_id2; /* Group ID */
+ if (hard_link) {
+ hid_t group_id2; /* Group ID */
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end if */
else {
/* Make value for link */
HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Create soft link */
- if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end else */
/* Verify link information for new link */
- if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) != TRUE)
+ TEST_ERROR
/* Check for out of bound offset queries */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(name_len >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (name_len >= 0)
+ TEST_ERROR
/* Create more links, to push group into dense form */
- for(; u < (max_compact * 2); u++) {
+ for (; u < (max_compact * 2); u++) {
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Check for creating hard or soft link */
- if(hard_link) {
- hid_t group_id2; /* Group ID */
+ if (hard_link) {
+ hid_t group_id2; /* Group ID */
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end if */
else {
/* Make value for link */
HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Create soft link */
- if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end else */
/* Verify state of group */
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Verify link information for new link */
- if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Check for out of bound offset queries */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(name_len >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (name_len >= 0)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
- } /* end for */
+ } /* end for */
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end link_info_by_idx_deprec() */
@@ -4184,65 +5269,71 @@ error:
static int
link_info_by_idx_old_deprec(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- unsigned hard_link; /* Create hard or soft link? */
- H5L_info1_t linfo; /* Link info struct */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value name */
- char filename[NAME_BUF_SIZE];/* File name */
- haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
- unsigned u; /* Local index variable */
- ssize_t name_len; /* Length of name */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ unsigned hard_link; /* Create hard or soft link? */
+ H5L_info1_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
+ unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
+ herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
- for(hard_link = FALSE; hard_link <= TRUE; hard_link++) {
- if(hard_link)
+ for (hard_link = FALSE; hard_link <= TRUE; hard_link++) {
+ if (hard_link)
TESTING("querying info by index in old-style group, using hard links and deprecated routines")
else
TESTING("querying info by index in old-style group, using soft links and deprecated routines")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group to operate on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
+ for (u = 0; u < CORDER_NLINKS; u++) {
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Check for creating hard or soft link */
- if(hard_link) {
- H5O_info1_t oi; /* Buffer for querying object's info */
+ if (hard_link) {
+ H5O_info1_t oi; /* Buffer for querying object's info */
/* Create group */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
objno[u] = oi.addr;
/* Close group */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end if */
else {
/* Make value for link */
HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Create soft link */
- if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end else */
- } /* end for */
+ } /* end for */
/* Verify link information for created links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */
/* Make link name for increasing/native order queries */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -4251,34 +5342,50 @@ link_info_by_idx_old_deprec(hid_t fapl)
HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Verify link information (in increasing order) */
- if(hard_link) {
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ if (hard_link) {
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5F_addr_ne(linfo.u.address, objno[u]))
+ TEST_ERROR
} /* end if */
else {
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end else */
/* Verify link name (in increasing order) */
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
-
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
/* Verify link information (in native order - native is increasing) */
- if(hard_link) {
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ if (hard_link) {
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5F_addr_ne(linfo.u.address, objno[u]))
+ TEST_ERROR
} /* end if */
else {
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end else */
/* Verify link name (in native order - native is increasing) */
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
-
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
/* Make link name for decreasing order queries */
HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
@@ -4287,38 +5394,58 @@ link_info_by_idx_old_deprec(hid_t fapl)
HDsnprintf(valname, sizeof(valname), "value %02u", dec_u);
/* Verify link information (in decreasing order) */
- if(hard_link) {
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ if (hard_link) {
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5F_addr_ne(linfo.u.address, objno[dec_u]))
+ TEST_ERROR
} /* end if */
else {
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end else */
/* Verify link name (in decreasing order) */
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Check for creation order index queries */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(name_len >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (name_len >= 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
@@ -4326,10 +5453,12 @@ link_info_by_idx_old_deprec(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end link_info_by_idx_old_deprec() */
@@ -4346,305 +5475,398 @@ error:
static int
delete_by_idx_deprec(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- unsigned use_index; /* Use index on creation order values */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5L_info1_t linfo; /* Link info struct */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ H5L_info1_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("deleting links by creation order index in increasing order w/creation order index using deprecated routines")
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("deleting links by creation order index in increasing order w/creation "
+ "order index using deprecated routines")
else
- TESTING("deleting links by creation order index in increasing order w/o creation order index using deprecated routines")
+ TESTING("deleting links by creation order index in increasing order w/o creation "
+ "order index using deprecated routines")
} /* end if */
else {
- if(use_index)
- TESTING("deleting links by creation order index in decreasing order w/creation order index using deprecated routines")
+ if (use_index)
+ TESTING("deleting links by creation order index in decreasing order w/creation "
+ "order index using deprecated routines")
else
- TESTING("deleting links by creation order index in decreasing order w/o creation order index using deprecated routines")
+ TESTING("deleting links by creation order index in decreasing order w/o creation "
+ "order index using deprecated routines")
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("deleting links by name index in increasing order w/creation order index using deprecated routines")
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("deleting links by name index in increasing order w/creation order index "
+ "using deprecated routines")
else
- TESTING("deleting links by name index in increasing order w/o creation order index using deprecated routines")
+ TESTING("deleting links by name index in increasing order w/o creation order "
+ "index using deprecated routines")
} /* end if */
else {
- if(use_index)
- TESTING("deleting links by name index in decreasing order w/creation order index using deprecated routines")
+ if (use_index)
+ TESTING("deleting links by name index in decreasing order w/creation order index "
+ "using deprecated routines")
else
- TESTING("deleting links by name index in decreasing order w/o creation order index using deprecated routines")
+ TESTING("deleting links by name index in decreasing order w/o creation order "
+ "index using deprecated routines")
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED |
+ (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Delete links from one end */
/* Check for deletion on empty group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for deletion on non-existing group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < max_compact; u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify link information for new link */
- if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (compact) */
- if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) != TRUE)
+ TEST_ERROR
/* Check for out of bound deletion */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Delete links from compact group */
- for(u = 0; u < (max_compact - 1); u++) {
+ for (u = 0; u < (max_compact - 1); u++) {
/* Delete first link in appropriate order */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(linfo.corder != (u + 1)) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (linfo.corder != (u + 1))
+ TEST_ERROR
} /* end if */
else {
- if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR
+ if (linfo.corder != (max_compact - (u + 2)))
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2)));
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group (empty) */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
/* Create more links, to push group into dense form */
- for(u = 0; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group (dense) */
- if(u >= max_compact)
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (u >= max_compact)
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Verify link information for new link */
- if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Check for out of bound deletion again */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Delete links from dense group, in appropriate order */
- for(u = 0; u < ((max_compact * 2) - 1); u++) {
+ for (u = 0; u < ((max_compact * 2) - 1); u++) {
/* Delete first link in appropriate order */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(linfo.corder != (u + 1)) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (linfo.corder != (u + 1))
+ TEST_ERROR
} /* end if */
else {
- if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR
+ if (linfo.corder != ((max_compact * 2) - (u + 2)))
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2)));
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group (empty) */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Check for deletion on empty group again */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Delete links in middle */
/* Create more links, to push group into dense form */
- for(u = 0; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group (dense) */
- if(u >= max_compact)
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (u >= max_compact)
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Verify link information for new link */
- if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Delete every other link from dense group, in appropriate order */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Delete link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for current link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(linfo.corder != ((u * 2) + 1)) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (linfo.corder != ((u * 2) + 1))
+ TEST_ERROR
} /* end if */
else {
- if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR
+ if (linfo.corder != ((max_compact * 2) - ((u * 2) + 2)))
+ TEST_ERROR
} /* end else */
/* Verify the name for current link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1));
else
- HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2)));
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ HDsnprintf(objname, sizeof(objname), "filler %02u",
+ ((max_compact * 2) - ((u * 2) + 2)));
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete remaining links from dense group, in appropriate order */
- for(u = 0; u < (max_compact - 1); u++) {
+ for (u = 0; u < (max_compact - 1); u++) {
/* Delete link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(linfo.corder != ((u * 2) + 3)) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (linfo.corder != ((u * 2) + 3))
+ TEST_ERROR
} /* end if */
else {
- if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR
+ if (linfo.corder != ((max_compact * 2) - ((u * 2) + 4)))
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3));
else
- HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4)));
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ HDsnprintf(objname, sizeof(objname), "filler %02u",
+ ((max_compact * 2) - ((u * 2) + 4)));
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group (empty) */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end delete_by_idx_deprec() */
@@ -4661,194 +5883,243 @@ error:
static int
delete_by_idx_old_deprec(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- H5L_info1_t linfo; /* Link info struct */
- H5_iter_order_t order; /* Order within in the index */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ H5L_info1_t linfo; /* Link info struct */
+ H5_iter_order_t order; /* Order within in the index */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Print test banner */
- if(order == H5_ITER_INC)
- TESTING("deleting links by index in increasing order in old-style group using deprecated routines")
+ if (order == H5_ITER_INC)
+ TESTING(
+ "deleting links by index in increasing order in old-style group using deprecated routines")
else
- TESTING("deleting links by index in decreasing order in old-style group using deprecated routines")
+ TESTING(
+ "deleting links by index in decreasing order in old-style group using deprecated routines")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group to operate on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Delete links from one end */
/* Check for deletion in empty group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- H5O_info1_t oi; /* Buffer for querying object's info */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ H5O_info1_t oi; /* Buffer for querying object's info */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create group */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
objno[u] = oi.addr;
/* Close group */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Check for bad index type deletion */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for out of bounds deletion */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Delete links, in appropriate order */
- for(u = 0; u < (CORDER_NLINKS - 1); u++) {
- unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */
+ for (u = 0; u < (CORDER_NLINKS - 1); u++) {
+ unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */
/* Delete first link in appropriate order */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5F_addr_ne(linfo.u.address, objno[u + 1]))
+ TEST_ERROR
} /* end if */
else {
- if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ if (H5F_addr_ne(linfo.u.address, objno[dec_u]))
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check for deletion in empty group (again) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Delete links in middle */
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- H5O_info1_t oi; /* Buffer for querying object's info */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ H5O_info1_t oi; /* Buffer for querying object's info */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create group */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
objno[u] = oi.addr;
/* Close group */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Delete every other link from group, in appropriate order */
- for(u = 0; u < (CORDER_NLINKS / 2); u++) {
- unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */
+ for (u = 0; u < (CORDER_NLINKS / 2); u++) {
+ unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */
/* Delete link */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for current link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1]))
+ TEST_ERROR
} /* end if */
else {
- if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ if (H5F_addr_ne(linfo.u.address, objno[dec_u]))
+ TEST_ERROR
} /* end else */
/* Verify the name for current link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete remaining links from group, in appropriate order */
- for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) {
- unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */
+ for (u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) {
+ unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */
/* Delete link */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR
+ if (H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3]))
+ TEST_ERROR
} /* end if */
else {
- if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ if (H5F_addr_ne(linfo.u.address, objno[dec_u]))
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
@@ -4856,10 +6127,12 @@ delete_by_idx_old_deprec(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end delete_by_idx_old_deprec() */
@@ -4874,62 +6147,61 @@ error:
*-------------------------------------------------------------------------
*/
static int
-link_iterate_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info,
- void *_op_data)
+link_iterate_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info, void *_op_data)
{
- link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
- char objname[NAME_BUF_SIZE]; /* Object name */
- H5L_info1_t my_info; /* Local link info */
+ link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ H5L_info1_t my_info; /* Local link info */
/* Increment # of times the callback was called */
op_data->ncalled++;
/* Get the link information directly to compare */
- if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
+ if (H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
return H5_ITER_ERROR;
/* Check more things for link iteration (vs. group iteration) */
- if(info) {
+ if (info) {
/* Check for correct order of iteration */
/* (if we are operating in increasing or decreasing order) */
- if(op_data->order != H5_ITER_NATIVE)
- if(info->corder != op_data->curr)
+ if (op_data->order != H5_ITER_NATIVE)
+ if (info->corder != op_data->curr)
return H5_ITER_ERROR;
/* Compare link info structs */
- if(info->type != my_info.type)
+ if (info->type != my_info.type)
return H5_ITER_ERROR;
- if(info->corder_valid != my_info.corder_valid)
+ if (info->corder_valid != my_info.corder_valid)
return H5_ITER_ERROR;
- if(info->corder != my_info.corder)
+ if (info->corder != my_info.corder)
return H5_ITER_ERROR;
- if(info->cset != my_info.cset)
+ if (info->cset != my_info.cset)
return H5_ITER_ERROR;
- if(H5F_addr_ne(info->u.address, my_info.u.address))
+ if (H5F_addr_ne(info->u.address, my_info.u.address))
return H5_ITER_ERROR;
} /* end if */
/* Verify name of link */
HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder);
- if(HDstrcmp(link_name, objname))
+ if (HDstrcmp(link_name, objname))
return H5_ITER_ERROR;
/* Check if we've visited this link before */
- if((size_t)op_data->curr >= op_data->max_visit)
+ if ((size_t)op_data->curr >= op_data->max_visit)
return H5_ITER_ERROR;
- if(op_data->visited[op_data->curr])
+ if (op_data->visited[op_data->curr])
return H5_ITER_ERROR;
op_data->visited[op_data->curr] = TRUE;
/* Advance to next value, in correct direction */
- if(op_data->order != H5_ITER_DEC)
+ if (op_data->order != H5_ITER_DEC)
op_data->curr++;
else
op_data->curr--;
/* Check for stopping in the middle of iterating */
- if(op_data->stop > 0)
- if(--op_data->stop == 0)
+ if (op_data->stop > 0)
+ if (--op_data->stop == 0)
return CORDER_ITER_STOP;
return H5_ITER_CONT;
@@ -4963,7 +6235,7 @@ group_iterate_deprec_cb(hid_t group_id, const char *link_name, void *_op_data)
*/
static int
link_iterate_fail_deprec_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name,
- const H5L_info1_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
+ const H5L_info1_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
{
return H5_ITER_ERROR;
} /* end link_iterate_fail_deprec_cb() */
@@ -4978,130 +6250,152 @@ link_iterate_fail_deprec_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UN
*-------------------------------------------------------------------------
*/
static int
-link_iterate_check_deprec(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
- unsigned max_links, link_iter_info_t *iter_info)
+link_iterate_check_deprec(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, unsigned max_links,
+ link_iter_info_t *iter_info)
{
- unsigned v; /* Local index variable */
- hsize_t skip; /* # of links to skip in group */
- int gskip; /* # of links to skip in group, with H5Giterate */
- herr_t ret; /* Generic return value */
+ unsigned v; /* Local index variable */
+ hsize_t skip; /* # of links to skip in group */
+ int gskip; /* # of links to skip in group, with H5Giterate */
+ herr_t ret; /* Generic return value */
/* Iterate over links in group */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR
+ if (H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(skip != max_links) TEST_ERROR
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ if (skip != max_links)
+ TEST_ERROR
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
/* Iterate over links in group, with H5Giterate */
iter_info->nskipped = (unsigned)(gskip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR
+ if (H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(gskip != (int)max_links) TEST_ERROR
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ if (gskip != (int)max_links)
+ TEST_ERROR
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
/* Skip over some links in group */
iter_info->nskipped = (unsigned)(skip = max_links / 2);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR
+ if (H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(skip != max_links) TEST_ERROR
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ if (skip != max_links)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v + (max_links / 2)] == FALSE)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
- if(nvisit != (max_links / 2)) TEST_ERROR
+ if (nvisit != (max_links / 2))
+ TEST_ERROR
} /* end else */
/* Skip over some links in group, with H5Giterate */
iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR
+ if (H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(gskip != (int)max_links) TEST_ERROR
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ if (gskip != (int)max_links)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v + (max_links / 2)] == FALSE)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
- if(nvisit != (max_links / 2)) TEST_ERROR
+ if (nvisit != (max_links / 2))
+ TEST_ERROR
} /* end else */
/* Iterate over links in group, stopping in the middle */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR
- if(ret != CORDER_ITER_STOP) TEST_ERROR
- if(iter_info->ncalled != 3) TEST_ERROR
+ if ((ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info)) < 0)
+ TEST_ERROR
+ if (ret != CORDER_ITER_STOP)
+ TEST_ERROR
+ if (iter_info->ncalled != 3)
+ TEST_ERROR
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
iter_info->nskipped = (unsigned)(gskip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR
- if(ret != CORDER_ITER_STOP) TEST_ERROR
- if(iter_info->ncalled != 3) TEST_ERROR
+ if ((ret = H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info)) < 0)
+ TEST_ERROR
+ if (ret != CORDER_ITER_STOP)
+ TEST_ERROR
+ if (iter_info->ncalled != 3)
+ TEST_ERROR
/* Check for iteration routine indicating failure */
skip = 0;
- H5E_BEGIN_TRY {
- ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_fail_deprec_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_fail_deprec_cb, NULL); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Success */
return SUCCEED;
@@ -5127,177 +6421,219 @@ error:
static int
link_iterate_deprec(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- unsigned use_index; /* Use index on creation order values */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- link_iter_info_t iter_info; /* Iterator info */
- hbool_t *visited = NULL; /* Array of flags for visiting links */
- hsize_t skip; /* # of links to skip in group */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file_id = (-1); /* File ID */
+ hid_t group_id = (-1); /* Group ID */
+ hid_t gcpl_id = (-1); /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ link_iter_info_t iter_info; /* Iterator info */
+ hbool_t * visited = NULL; /* Array of flags for visiting links */
+ hsize_t skip; /* # of links to skip in group */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Allocate the "visited link" array */
iter_info.max_visit = max_compact * 2;
- if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR
+ if (NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit)))
+ TEST_ERROR
iter_info.visited = visited;
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("iterating over links by creation order index in increasing order w/creation order index using deprecated routines")
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("iterating over links by creation order index in increasing order "
+ "w/creation order index using deprecated routines")
else
- TESTING("iterating over links by creation order index in increasing order w/o creation order index using deprecated routines")
+ TESTING("iterating over links by creation order index in increasing order w/o "
+ "creation order index using deprecated routines")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
- TESTING("iterating over links by creation order index in decreasing order w/creation order index using deprecated routines")
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
+ TESTING("iterating over links by creation order index in decreasing order "
+ "w/creation order index using deprecated routines")
else
- TESTING("iterating over links by creation order index in decreasing order w/o creation order index using deprecated routines")
+ TESTING("iterating over links by creation order index in decreasing order w/o "
+ "creation order index using deprecated routines")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
- TESTING("iterating over links by creation order index in native order w/creation order index using deprecated routines")
+ if (use_index)
+ TESTING("iterating over links by creation order index in native order w/creation "
+ "order index using deprecated routines")
else
- TESTING("iterating over links by creation order index in native order w/o creation order index using deprecated routines")
+ TESTING("iterating over links by creation order index in native order w/o "
+ "creation order index using deprecated routines")
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("iterating over links by name index in increasing order w/creation order index using deprecated routines")
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("iterating over links by name index in increasing order w/creation order "
+ "index using deprecated routines")
else
- TESTING("iterating over links by name index in increasing order w/o creation order index using deprecated routines")
+ TESTING("iterating over links by name index in increasing order w/o creation "
+ "order index using deprecated routines")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
- TESTING("iterating over links by name index in decreasing order w/creation order index using deprecated routines")
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
+ TESTING("iterating over links by name index in decreasing order w/creation order "
+ "index using deprecated routines")
else
- TESTING("iterating over links by name index in decreasing order w/o creation order index using deprecated routines")
+ TESTING("iterating over links by name index in decreasing order w/o creation "
+ "order index using deprecated routines")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
- TESTING("iterating over links by name index in native order w/creation order index using deprecated routines")
+ if (use_index)
+ TESTING("iterating over links by name index in native order w/creation order "
+ "index using deprecated routines")
else
- TESTING("iterating over links by name index in native order w/o creation order index using deprecated routines")
+ TESTING("iterating over links by name index in native order w/o creation order "
+ "index using deprecated routines")
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED |
+ (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Check for iteration on empty group */
/* (should be OK) */
- if(H5Literate1(group_id, idx_type, order, NULL, link_iterate_deprec_cb, NULL) < 0) TEST_ERROR
+ if (H5Literate1(group_id, idx_type, order, NULL, link_iterate_deprec_cb, NULL) < 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < max_compact; u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (compact) */
- if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) != TRUE)
+ TEST_ERROR
/* Check for out of bound iteration on compact group */
skip = (hsize_t)u;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Test iteration over links in compact group */
- if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR
+ if (link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0)
+ TEST_ERROR
/* Create more links, to push group into dense form */
- for(; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ for (; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (dense) */
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound iteration on dense group */
skip = (hsize_t)u;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Test iteration over links in dense group */
- if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR
-
+ if (link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Free resources */
- if(visited)
+ if (visited)
HDfree(visited);
return SUCCEED;
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(visited)
+ if (visited)
HDfree(visited);
return FAIL;
@@ -5315,53 +6651,54 @@ error:
static int
link_iterate_old_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info, void *_op_data)
{
- link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
- char objname[NAME_BUF_SIZE]; /* Object name */
- H5L_info1_t my_info; /* Local link info */
+ link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ H5L_info1_t my_info; /* Local link info */
/* Increment # of times the callback was called */
op_data->ncalled++;
/* Get the link information directly to compare */
- if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
+ if (H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
return H5_ITER_ERROR;
/* Check more things for link iteration (vs. group iteration) */
- if(info) {
+ if (info) {
/* Compare link info structs */
- if(info->type != my_info.type)
+ if (info->type != my_info.type)
return H5_ITER_ERROR;
- if(info->corder_valid != my_info.corder_valid)
+ if (info->corder_valid != my_info.corder_valid)
return H5_ITER_ERROR;
- if(info->corder != my_info.corder)
+ if (info->corder != my_info.corder)
return H5_ITER_ERROR;
- if(info->cset != my_info.cset)
+ if (info->cset != my_info.cset)
return H5_ITER_ERROR;
- if(H5F_addr_ne(info->u.address, my_info.u.address))
+ if (H5F_addr_ne(info->u.address, my_info.u.address))
return H5_ITER_ERROR;
} /* end if */
/* Verify name of link */
- HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped)));
- if(HDstrcmp(link_name, objname))
+ HDsnprintf(objname, sizeof(objname), "filler %02u",
+ (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped)));
+ if (HDstrcmp(link_name, objname))
return H5_ITER_ERROR;
/* Check if we've visited this link before */
- if((size_t)op_data->curr >= op_data->max_visit)
+ if ((size_t)op_data->curr >= op_data->max_visit)
return H5_ITER_ERROR;
- if(op_data->visited[op_data->curr])
+ if (op_data->visited[op_data->curr])
return H5_ITER_ERROR;
op_data->visited[op_data->curr] = TRUE;
/* Advance to next value, in correct direction */
- if(op_data->order != H5_ITER_DEC)
+ if (op_data->order != H5_ITER_DEC)
op_data->curr++;
else
op_data->curr--;
/* Check for stopping in the middle of iterating */
- if(op_data->stop > 0)
- if(--op_data->stop == 0)
+ if (op_data->stop > 0)
+ if (--op_data->stop == 0)
return CORDER_ITER_STOP;
return H5_ITER_CONT;
@@ -5393,141 +6730,170 @@ group_iterate_old_deprec_cb(hid_t group_id, const char *link_name, void *_op_dat
*-------------------------------------------------------------------------
*/
static int
-link_iterate_old_check_deprec(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info)
+link_iterate_old_check_deprec(hid_t group_id, H5_iter_order_t order, unsigned max_links,
+ link_iter_info_t *iter_info)
{
- unsigned v; /* Local index variable */
- hsize_t skip; /* # of links to skip in group */
- int gskip; /* # of links to skip in group, with H5Giterate */
- herr_t ret; /* Generic return value */
+ unsigned v; /* Local index variable */
+ hsize_t skip; /* # of links to skip in group */
+ int gskip; /* # of links to skip in group, with H5Giterate */
+ herr_t ret; /* Generic return value */
/* Iterate over links in group */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR
+ if (H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(skip != max_links) TEST_ERROR
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ if (skip != max_links)
+ TEST_ERROR
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
/* Iterate over links in group, with H5Giterate */
iter_info->nskipped = (unsigned)(gskip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR
+ if (H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(gskip != (int)max_links) TEST_ERROR
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ if (gskip != (int)max_links)
+ TEST_ERROR
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
/* Skip over some links in group */
iter_info->nskipped = (unsigned)(skip = max_links / 2);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR
+ if (H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(skip != max_links) TEST_ERROR
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ if (skip != max_links)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v + (max_links / 2)] == FALSE)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
- if(nvisit != (max_links / 2)) TEST_ERROR
+ if (nvisit != (max_links / 2))
+ TEST_ERROR
} /* end else */
/* Skip over some links in group, with H5Giterate */
iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR
+ if (H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(gskip != (int)max_links) TEST_ERROR
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ if (gskip != (int)max_links)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v + (max_links / 2)] == FALSE)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
- if(nvisit != (max_links / 2)) TEST_ERROR
+ if (nvisit != (max_links / 2))
+ TEST_ERROR
} /* end else */
/* Iterate over links in group, stopping in the middle */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR
- if(ret != CORDER_ITER_STOP) TEST_ERROR
- if(iter_info->ncalled != 3) TEST_ERROR
+ if ((ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info)) < 0)
+ TEST_ERROR
+ if (ret != CORDER_ITER_STOP)
+ TEST_ERROR
+ if (iter_info->ncalled != 3)
+ TEST_ERROR
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
iter_info->nskipped = (unsigned)(gskip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR
- if(ret != CORDER_ITER_STOP) TEST_ERROR
- if(iter_info->ncalled != 3) TEST_ERROR
+ if ((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info)) < 0)
+ TEST_ERROR
+ if (ret != CORDER_ITER_STOP)
+ TEST_ERROR
+ if (iter_info->ncalled != 3)
+ TEST_ERROR
/* Check for iteration routine indicating failure */
skip = 0;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for iteration w/bad location ID */
skip = 0;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Literate1((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_deprec_cb, iter_info);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_deprec_cb, iter_info); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Success */
return SUCCEED;
@@ -5548,110 +6914,130 @@ error:
static int
link_iterate_old_deprec(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- H5_iter_order_t order; /* Order within in the index */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- link_iter_info_t iter_info; /* Iterator info */
- hbool_t *visited = NULL; /* Array of flags for visiting links */
- hsize_t skip; /* # of links to skip in group */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ H5_iter_order_t order; /* Order within in the index */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ link_iter_info_t iter_info; /* Iterator info */
+ hbool_t * visited = NULL; /* Array of flags for visiting links */
+ hsize_t skip; /* # of links to skip in group */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Allocate the "visited link" array */
iter_info.max_visit = CORDER_NLINKS;
- if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR
+ if (NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit)))
+ TEST_ERROR
iter_info.visited = visited;
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Print appropriate test message */
- if(order == H5_ITER_INC) {
- TESTING("iterating over links by name index in increasing order in old-style group using deprecated routines")
+ if (order == H5_ITER_INC) {
+ TESTING("iterating over links by name index in increasing order in old-style group using "
+ "deprecated routines")
} /* end if */
- else if(order == H5_ITER_DEC) {
- TESTING("iterating over links by name index in decreasing order in old-style group using deprecated routines")
+ else if (order == H5_ITER_DEC) {
+ TESTING("iterating over links by name index in decreasing order in old-style group using "
+ "deprecated routines")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- TESTING("iterating over links by name index in native order in old-style group using deprecated routines")
+ TESTING("iterating over links by name index in native order in old-style group using deprecated "
+ "routines")
} /* end else */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group with creation order tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check for iteration on empty group */
/* (should be OK) */
- if(H5Literate1(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_deprec_cb, NULL) < 0) TEST_ERROR
+ if (H5Literate1(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_deprec_cb, NULL) < 0)
+ TEST_ERROR
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (symbol table) */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound iteration on old-style group */
skip = (hsize_t)u;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for iteration on creation order */
/* (should fail) */
skip = (hsize_t)0;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Literate1(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_deprec_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Test iteration over links in group */
- if(link_iterate_old_check_deprec(group_id, order, u, &iter_info) < 0) TEST_ERROR
+ if (link_iterate_old_check_deprec(group_id, order, u, &iter_info) < 0)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
/* Free resources */
- if(visited)
+ if (visited)
HDfree(visited);
return SUCCEED;
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(visited)
+ if (visited)
HDfree(visited);
return FAIL;
} /* end link_iterate_old_deprec() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: external_link_root
*
@@ -5664,16 +7050,16 @@ error:
static int
external_link_root(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5L_info2_t linfo; /* Link information */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
- const char *file; /* File from external link */
- const char *path; /* Path from external link */
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info2_t linfo; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
+ const char *file; /* File from external link */
+ const char *path; /* Path from external link */
+
+ if (new_format)
TESTING("external link to root (w/new group format)")
else
TESTING("external link to root")
@@ -5683,35 +7069,43 @@ external_link_root(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create file to point to */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Check that external links are registered with the library */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
/* Create file with link to first file */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to object in first file */
- if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check information for external link */
- if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
- if(H5L_TYPE_EXTERNAL != linfo.type) {
+ if (H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0)
+ goto error;
+ if (H5L_TYPE_EXTERNAL != linfo.type) {
H5_FAILED();
HDputs(" Unexpected object type - should have been an external link");
goto error;
}
- if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR
- if(HDstrcmp(file, filename1)) {
+ if (H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0)
+ TEST_ERROR
+ if (HDstrcmp(file, filename1)) {
H5_FAILED();
HDputs(" External link file name incorrect");
goto error;
}
- if(HDstrcmp(path, "/")) {
+ if (HDstrcmp(path, "/")) {
H5_FAILED();
HDputs(" External link path incorrect");
goto error;
@@ -5719,115 +7113,146 @@ external_link_root(hid_t fapl, hbool_t new_format)
/* Create external link to object in first file */
/* (add a few extra '/'s to make certain library normalizes external link object names) */
- if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check information for external link */
- if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
- if(H5L_TYPE_EXTERNAL != linfo.type) {
+ if (H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0)
+ goto error;
+ if (H5L_TYPE_EXTERNAL != linfo.type) {
H5_FAILED();
HDputs(" Unexpected object type - should have been an external link");
goto error;
}
- if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR
- if(HDstrcmp(file, filename1)) {
+ if (H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0)
+ TEST_ERROR
+ if (HDstrcmp(file, filename1)) {
H5_FAILED();
HDputs(" External link file name incorrect");
goto error;
}
- if(HDstrcmp(path, "/")) {
+ if (HDstrcmp(path, "/")) {
H5_FAILED();
HDputs(" External link path incorrect");
goto error;
}
/* Close and re-open file to ensure that data is written to disk */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create a new object using H5Gcreate2 through the external link
* directly
*/
- if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close file and group */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ if (H5I_nmembers(H5I_FILE) != 0)
+ TEST_ERROR
H5F_sfile_assert_num(0);
/* Open first file again with read-only access and check on objects created */
- if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open objects created through external link */
- if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check names */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/new_group")) TEST_ERROR
- if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/newer_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/new_group"))
+ TEST_ERROR
+ if (H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/newer_group"))
+ TEST_ERROR
/* Close opened objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ if (H5I_nmembers(H5I_FILE) != 0)
+ TEST_ERROR
H5F_sfile_assert_num(0);
/* Verify that new objects can't be created through a read-only external
* link.
*/
- if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
- H5E_BEGIN_TRY {
- gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY
- if(gid >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY
+ if (gid >= 0)
+ TEST_ERROR
/* Close second file again */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ if (H5I_nmembers(H5I_FILE) != 0)
+ TEST_ERROR
H5F_sfile_assert_num(0);
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_root() */
-
/*-------------------------------------------------------------------------
* Function: external_link_path
*
@@ -5841,13 +7266,13 @@ error:
static int
external_link_path(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("external link to object on path (w/new group format)")
else
TESTING("external link to object on path")
@@ -5857,78 +7282,99 @@ external_link_path(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create file to point to */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create object down a path */
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create file with link to first file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to object in first file */
- if(H5Lcreate_external(filename1, "/A/B/C", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "/A/B/C", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/A/B/C"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close second file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file again and check on object created */
- if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open object created through external link */
- if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/A/B/C/new_group"))
+ TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_path() */
-
/*-------------------------------------------------------------------------
* Function: external_link_mult
*
@@ -5942,15 +7388,13 @@ error:
static int
external_link_mult(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1, fid2 = -1; /* File IDs */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */
-
- if(new_format)
+ hid_t fid = -1, fid2 = -1; /* File IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE],
+ filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */
+
+ if (new_format)
TESTING("external links across multiple files (w/new group format)")
else
TESTING("external links across multiple files")
@@ -5962,130 +7406,174 @@ external_link_mult(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4);
/* Create first file to point to */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create object down a path */
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file to point to */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link down a path */
- if((gid = H5Gcreate2(fid, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if((gid = H5Gcreate2(fid, "D/E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "D/E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create external link to object in first file */
- if(H5Lcreate_external(filename1, "/A/B/C", gid, "F", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "/A/B/C", gid, "F", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create third file to point to */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link down a path */
- if((gid = H5Gcreate2(fid, "G", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "G", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if((gid = H5Gcreate2(fid, "G/H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "G/H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create external link to object in second file */
- if(H5Lcreate_external(filename2, "/D/E/F", gid, "I", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/D/E/F", gid, "I", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create file with link to third file */
- if((fid=H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to object in first file */
- if(H5Lcreate_external(filename3, "/G/H/I", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename3, "/G/H/I", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/A/B/C"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close second file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file again and check on object created */
- if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open object created through external link */
- if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/A/B/C/new_group"))
+ TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open an object through external links */
- if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
- if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename4, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* The intermediate files should not stay open. Replace one of them with a new file. */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Open the other with write access and delete the external link in it */
- if((fid2 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- if(H5Ldelete(fid2, "G/H/I", H5P_DEFAULT) < 0) TEST_ERROR
+ if ((fid2 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if (H5Ldelete(fid2, "G/H/I", H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Cleanup */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_mult() */
-
/*-------------------------------------------------------------------------
* Function: external_link_self
*
@@ -6098,15 +7586,15 @@ error:
static int
external_link_self(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t lcpl_id = -1; /* Link Creation Property List ID */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
- char filename3[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t lcpl_id = -1; /* Link Creation Property List ID */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
+ char filename3[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external link to self (w/new group format)")
else
TESTING("external link to self")
@@ -6117,116 +7605,156 @@ external_link_self(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1);
/* Create file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create an lcpl with intermediate group creation set */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
+ TEST_ERROR
/* Create a series of groups within the file: /A/B and /X/Y/Z */
- if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if(H5Pclose (lcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(lcpl_id) < 0)
+ TEST_ERROR
/* Create external link to own root group*/
- if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/X")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/X"))
+ TEST_ERROR
/* Create object through external link */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close created group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close object opened through external link */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Check on object created */
- if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/X/new_group"))
+ TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Complicate things. Use this file as an intermediate file in a chain
* of external links that will go: file2 -> file1 -> file1 -> file3
*/
/* Create file2 with an external link to file1 */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
- if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file2 */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create file3 as a target */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open file1 and create an extlink pointing to file3 */
- if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file1 */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */
- if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
- if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create object through external link */
- if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Cleanup */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open up file3 and make sure the object was created successfully */
- if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Cleanup */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Pclose(lcpl_id);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_self() */
-
/*-------------------------------------------------------------------------
* Function: external_link_pingpong
*
@@ -6254,13 +7782,12 @@ error:
static int
external_link_pingpong(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1), gid2 = (-1); /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- if(new_format)
+ if (new_format)
TESTING("external links back and forth (w/new group format)")
else
TESTING("external links back and forth")
@@ -6270,84 +7797,110 @@ external_link_pingpong(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external links for chain */
- if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create final object */
- if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external links for chain */
- if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/final")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/final"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file again and check on object created */
- if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open object created through external link */
- if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/final/new_group"))
+ TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_pingpong() */
-
/*-------------------------------------------------------------------------
* Function: external_link_toomany
*
@@ -6381,13 +7934,12 @@ error:
static int
external_link_toomany(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- if(new_format)
+ if (new_format)
TESTING("too many external links (w/new group format)")
else
TESTING("too many external links")
@@ -6403,50 +7955,72 @@ external_link_toomany(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external links for chain */
- if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link8", fid, "link7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link10", fid, "link9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link12", fid, "link11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link14", fid, "link13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link16", fid, "link15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/final", fid, "link17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link8", fid, "link7", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link10", fid, "link9", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link12", fid, "link11", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link14", fid, "link13", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/link16", fid, "link15", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/final", fid, "link17", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external links for chain */
- if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/link7", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/link9", fid, "link8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/link11", fid, "link10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/link13", fid, "link12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/link15", fid, "link14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/link17", fid, "link16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link7", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link9", fid, "link8", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link11", fid, "link10", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link13", fid, "link12", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link15", fid, "link14", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/link17", fid, "link16", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create final object */
- if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "link1", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "link1", H5P_DEFAULT); }
+ H5E_END_TRY;
if (gid >= 0) {
H5_FAILED();
HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__);
@@ -6454,37 +8028,45 @@ external_link_toomany(hid_t fapl, hbool_t new_format)
}
/* Open object through external link */
- if((gid = H5Gopen2(fid, "link3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "link3", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/final")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/final"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close external object */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_toomany() */
-
/*-------------------------------------------------------------------------
* Function: external_link_dangling
*
@@ -6498,14 +8080,13 @@ error:
static int
external_link_dangling(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- hid_t rid = -1; /* Root Group ID */
- hid_t status = -1; /* Status */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ hid_t rid = -1; /* Root Group ID */
+ hid_t status = -1; /* Status */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+
+ if (new_format)
TESTING("dangling external links (w/new group format)")
else
TESTING("dangling external links")
@@ -6515,32 +8096,38 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create dangling external links */
- if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/missing", fid, "no_object", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/missing", fid, "no_object", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file (for dangling object test) */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Get root group ID */
- if((rid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((rid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Open object through dangling file external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "no_file", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); }
+ H5E_END_TRY;
if (gid >= 0) {
H5_FAILED();
HDputs(" Should have failed for sequence of too many nested links.");
@@ -6548,9 +8135,8 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
}
/* Open object through dangling object external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "no_object", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); }
+ H5E_END_TRY;
if (gid >= 0) {
H5_FAILED();
HDputs(" Should have failed for sequence of too many nested links.");
@@ -6558,33 +8144,38 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
}
/* Try to get name of object by index through dangling file external link */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
status = H5Lget_name_by_idx(rid, "no_file", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, 0, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
if (status >= 0) {
H5_FAILED();
- HDputs(" Retreiving name of object by index through dangling file external link should have failed.");
+ HDputs(
+ " Retreiving name of object by index through dangling file external link should have failed.");
} /* end if */
/* Close root group */
- if(H5Gclose(rid) < 0) TEST_ERROR
+ if (H5Gclose(rid) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_dangling() */
-
/*-------------------------------------------------------------------------
* Function: external_link_prefix
*
@@ -6603,14 +8194,12 @@ error:
static int
external_link_prefix(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- hid_t gapl_id = -1;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ hid_t gapl_id = -1;
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via H5Pset_elink_prefix()(w/new group format)")
else
TESTING("external links via H5Pset_elink_prefix()")
@@ -6622,34 +8211,40 @@ external_link_prefix(hid_t fapl, hbool_t new_format)
/* create tmp_links directory and get current working directory path */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ TEST_ERROR
/* set up name for target file: "tmp_links/extlinks2" */
h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file (without the absolute path) */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* set up prefix for external link */
- if((gapl_id = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR
- if(H5Pset_elink_prefix(gapl_id, TMPDIR) < 0) TEST_ERROR
+ if ((gapl_id = H5Pcreate(H5P_GROUP_ACCESS)) < 0)
+ TEST_ERROR
+ if (H5Pset_elink_prefix(gapl_id, TMPDIR) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", gapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", gapl_id); }
+ H5E_END_TRY;
/* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */
if (gid < 0) {
@@ -6659,26 +8254,30 @@ external_link_prefix(hid_t fapl, hbool_t new_format)
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_prefix() */
-
/*-------------------------------------------------------------------------
* Function: external_link_abs_mainpath: test 3
*
* Purpose: 1. target link: "extlinks3"
- * 2. main file: Linux:"/CWD/tmp_links/extlinks0"; Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
+ * 2. main file: Linux:"/CWD/tmp_links/extlinks0"; Windows: "<cur
+ *drive>:/CWD/tmp_links/extlinks0"
* 3. target file: "tmp_links/extlinks3"
* Should be able to access the target file via the main file's absolute path
*
@@ -6689,15 +8288,12 @@ error:
static int
external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via main file's absolute path (w/new group format)")
else
TESTING("external links via main file's absolute path")
@@ -6708,7 +8304,8 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3);
/* create tmp_links directory and get current working directory path */
- if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
+ if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
+ (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -6720,48 +8317,55 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file from absolute path set for main file */
- if(gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in tmp_links directory.");
- goto error;
+ if (gid < 0) {
+ H5_FAILED();
+ HDputs(" Should have found the file in tmp_links directory.");
+ goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_abs_mainpath() */
-
/*-------------------------------------------------------------------------
* Function: external_link_rel_mainpath: test 4
*
@@ -6777,13 +8381,11 @@ error:
static int
external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("external links via main file's CWD + relative path(w/new group format)")
else
TESTING("external links via main file's CWD + relative path")
@@ -6794,30 +8396,34 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- /* set up name for main file: "tmp_links/extlinks0" */
+ /* set up name for main file: "tmp_links/extlinks0" */
h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1);
/* set up name for target file: "tmp_links/extlinks4" */
h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file from the main file's relative pathname */
if (gid < 0) {
@@ -6827,17 +8433,21 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_rel_mainpath() */
@@ -6856,14 +8466,11 @@ error:
static int
external_link_cwd(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via current working directory(w/new group format)")
else
TESTING("external links via current working directory")
@@ -6872,7 +8479,8 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/* set up name for target file: "extlinks5" */
h5_fixname(FILENAME[22], fapl, filename2, sizeof filename2);
- if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
+ if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
+ (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -6884,52 +8492,60 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* Create the target file */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file from the current working directory */
- if(gid < 0) {
+ if (gid < 0) {
H5_FAILED();
HDputs(" Should have found the file in current working directory");
goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_cwd() */
-
/*-------------------------------------------------------------------------
* Function: external_link_abstar: test 6
*
- * Purpose: 1. target link: Linux:"/CWD/tmp_links/extlinks6"; Windows:"<cur drive>:/CWD/tmp_links/extlinks6"
+ * Purpose: 1. target link: Linux:"/CWD/tmp_links/extlinks6"; Windows:"<cur
+ *drive>:/CWD/tmp_links/extlinks6"
* 2. main file: "extlinks0"
* 3. target file: "tmp_links/extlinks6"
* Should be able to access the target file's absolute path
@@ -6941,15 +8557,12 @@ error:
static int
external_link_abstar(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via target's absolute path (w/new group format)")
else
TESTING("external links via target's absolute path")
@@ -6957,8 +8570,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp_links directory and get current working directory path */
- if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
+ /* create tmp_links directory and get current working directory path */
+ if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
+ (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -6973,50 +8587,60 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[23], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file with abolute path */
- if(gid < 0) {
+ if (gid < 0) {
H5_FAILED();
HDputs(" Should have found the file in tmp_links directory.");
goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_abstar() */
/*-------------------------------------------------------------------------
* Function: external_link_abstar_cur: test 7
*
- * Purpose: 1. target link: Linux: "/CWD/tmp_links/extlinks7"; Windows: "<cur drive>:/CWD/tmp_links/extlinks7"
+ * Purpose: 1. target link: Linux: "/CWD/tmp_links/extlinks7"; Windows: "<cur
+ *drive>:/CWD/tmp_links/extlinks7"
* 2. main file: "extlinks0"
* 3. target file: "extlinks7"
* Should be able to access the target file via the main file's CWD.
@@ -7028,15 +8652,12 @@ error:
static int
external_link_abstar_cur(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via main file's CWD (w/new group format)")
else
TESTING("external links via main file's CWD")
@@ -7048,35 +8669,41 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3);
/* create tmp_links directory and get current working directory path */
- if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
+ if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
+ (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
- /*
- * set up name for external linked target file:
- * Linux: "/CWD/tmp_links/extlinks7"
- * Windows: "<cur drive>:/CWD/tmp_links/extlinks7"
- */
+ /*
+ * set up name for external linked target file:
+ * Linux: "/CWD/tmp_links/extlinks7"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks7"
+ */
fix_ext_filename(tmpname, cwdpath, FILENAME[25]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file from main file's current working directory */
if (gid < 0) {
@@ -7086,21 +8713,24 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_abstar_cur() */
-
/*-------------------------------------------------------------------------
* Function: external_link_reltar: test 8
*
@@ -7116,12 +8746,11 @@ error:
static int
external_link_reltar(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE];
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("external links via main file's CWD + target's relative path(w/new group format)")
else
TESTING("external links via main file's CWD + target's relative path")
@@ -7130,50 +8759,59 @@ external_link_reltar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* create tmp_links directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
/* set up name for target file name: "tmp_links/extlinks8" */
/* set up name for external linked target file: "tmp_links/extlinks8" */
h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2);
/* Create the target file */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "///A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "///A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) {
+ if ((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) {
H5_FAILED();
HDputs(" Should have found the file in tmp_links directory.");
goto error;
} /* end if */
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_reltar() */
-
/*-------------------------------------------------------------------------
* Function: external_link_chdir: test 9
*
@@ -7191,13 +8829,11 @@ error:
static int
external_link_chdir(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("external links via chdir and found in current working directory (w/new group format)")
else
TESTING("external links via chdir and found in current working directory")
@@ -7208,34 +8844,41 @@ external_link_chdir(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2);
/* create tmp_links directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
/* set up name for target file name ("tmp_links/extlinks9") */
h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if (HDchdir(TMPDIR) < 0) TEST_ERROR
+ if (HDchdir(TMPDIR) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
- if (HDchdir("..") < 0) TEST_ERROR
+ if (HDchdir("..") < 0)
+ TEST_ERROR
/*
* Should be able to find the target file from:
@@ -7248,21 +8891,24 @@ external_link_chdir(hid_t fapl, hbool_t new_format)
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_chdir() */
-
/*-------------------------------------------------------------------------
* Function: external_set_elink_fapl1: test 10
*
@@ -7286,29 +8932,27 @@ error:
static int
external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
{
- hid_t fid=(-1);
- hid_t fidA=(-1), fidB=(-1);
- hid_t gidA=(-1), gidB=(-1);
- hid_t oidA=(-1), oidB=(-1);
- char filename1[NAME_BUF_SIZE],
- filename2A[NAME_BUF_SIZE],
- filename2B[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
- hid_t fam_fapl=-1, multi_fapl=-1;
- hid_t lapl_idA=-1, lapl_idB=-1;
- hid_t memb_fapl[H5FD_MEM_NTYPES];
- char sv[H5FD_MEM_NTYPES][64];
+ hid_t fid = (-1);
+ hid_t fidA = (-1), fidB = (-1);
+ hid_t gidA = (-1), gidB = (-1);
+ hid_t oidA = (-1), oidB = (-1);
+ char filename1[NAME_BUF_SIZE], filename2A[NAME_BUF_SIZE], filename2B[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE];
+ hid_t fam_fapl = -1, multi_fapl = -1;
+ hid_t lapl_idA = -1, lapl_idB = -1;
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][64];
H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
const char *memb_name[H5FD_MEM_NTYPES];
haddr_t memb_addr[H5FD_MEM_NTYPES];
- if(new_format)
+ if (new_format)
TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)")
else
TESTING("H5Pset/get_elink_fapl() with different physical layouts")
- if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
+ if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
+ (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -7321,25 +8965,26 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
/* create "family" fapl */
fam_fapl = h5_fileaccess();
- if(H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) TEST_ERROR;
+ if (H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR;
/* set up name for external linked target file A: "extlinks16A" */
/* set up name for target file A: "extlinks16A" */
h5_fixname(FILENAME[37], fam_fapl, filename2A, sizeof filename2A);
/* settings for multi file */
- HDmemset(memb_map, 0, sizeof memb_map);
+ HDmemset(memb_map, 0, sizeof memb_map);
HDmemset(memb_fapl, 0, sizeof memb_fapl);
HDmemset(memb_name, 0, sizeof memb_name);
HDmemset(memb_addr, 0, sizeof memb_addr);
HDmemset(sv, 0, sizeof sv);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
- memb_map[mt] = H5FD_MEM_SUPER;
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
+ memb_map[mt] = H5FD_MEM_SUPER;
memb_fapl[mt] = H5P_DEFAULT;
} /* end for */
- memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
+ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE;
memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP;
memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP;
@@ -7350,57 +8995,71 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
HDsnprintf(sv[H5FD_MEM_BTREE], sizeof(sv[H5FD_MEM_BTREE]), "%%s-%c.h5", 'b');
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
- memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6;
+ memb_addr[H5FD_MEM_BTREE] = HADDR_MAX / 6;
HDsnprintf(sv[H5FD_MEM_DRAW], sizeof(sv[H5FD_MEM_DRAW]), "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
- memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3;
+ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 3;
HDsnprintf(sv[H5FD_MEM_GHEAP], sizeof(sv[H5FD_MEM_GHEAP]), "%%s-%c.h5", 'g');
memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP];
- memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2;
+ memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX / 2;
HDsnprintf(sv[H5FD_MEM_LHEAP], sizeof(sv[H5FD_MEM_LHEAP]), "%%s-%c.h5", 'l');
memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP];
- memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX/3)*2;
+ memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX / 3) * 2;
HDsnprintf(sv[H5FD_MEM_OHDR], sizeof(sv[H5FD_MEM_OHDR]), "%%s-%c.h5", 'o');
memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR];
- memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX/6)*5;
+ memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX / 6) * 5;
/* create "multi" fapl */
multi_fapl = h5_fileaccess();
- if(H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0) TEST_ERROR;
+ if (H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
+ TEST_ERROR;
/* set up name for external linked target file B: "extlinks16B" */
/* set up name for target file B: "extlinks16B" */
h5_fixname(FILENAME[38], multi_fapl, filename2B, sizeof filename2B);
/* Create target file A to be a "family" file */
- if((fidA=H5Fcreate(filename2A, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR
- if((gidA=H5Gcreate2(fidA, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fidA = H5Fcreate(filename2A, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0)
+ TEST_ERROR
+ if ((gidA = H5Gcreate2(fidA, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create target file B to be a "multi" file */
- if((fidB=H5Fcreate(filename2B, H5F_ACC_TRUNC, H5P_DEFAULT, multi_fapl)) < 0) TEST_ERROR
- if((gidB=H5Gcreate2(fidB, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fidB = H5Fcreate(filename2B, H5F_ACC_TRUNC, H5P_DEFAULT, multi_fapl)) < 0)
+ TEST_ERROR
+ if ((gidB = H5Gcreate2(fidB, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target files */
- if(H5Gclose(gidA) < 0) TEST_ERROR
- if(H5Gclose(gidB) < 0) TEST_ERROR
- if(H5Fclose(fidA) < 0) TEST_ERROR
- if(H5Fclose(fidB) < 0) TEST_ERROR
+ if (H5Gclose(gidA) < 0)
+ TEST_ERROR
+ if (H5Gclose(gidB) < 0)
+ TEST_ERROR
+ if (H5Fclose(fidA) < 0)
+ TEST_ERROR
+ if (H5Fclose(fidB) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file A:/A */
- if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create external link to target file B:/B */
- if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Set file access property list for link access to use the family driver */
- if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
- if(H5Pset_elink_fapl(lapl_idA, fam_fapl) < 0) TEST_ERROR
+ if ((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ TEST_ERROR
+ if (H5Pset_elink_fapl(lapl_idA, fam_fapl) < 0)
+ TEST_ERROR
/* open target object A */
oidA = H5Oopen(fid, "ext_linkA", lapl_idA);
@@ -7413,8 +9072,10 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
}
/* Set file access property list for link access to use the multi driver */
- if((lapl_idB = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
- if(H5Pset_elink_fapl(lapl_idB, multi_fapl) < 0) TEST_ERROR
+ if ((lapl_idB = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ TEST_ERROR
+ if (H5Pset_elink_fapl(lapl_idB, multi_fapl) < 0)
+ TEST_ERROR
/* open target object B */
oidB = H5Oopen(fid, "ext_linkB", lapl_idB);
@@ -7427,33 +9088,41 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
}
/* closing */
- if(H5Pclose(lapl_idA) < 0) TEST_ERROR
- if(H5Pclose(lapl_idB) < 0) TEST_ERROR
- if(H5Pclose(fam_fapl) < 0) TEST_ERROR
- if(H5Pclose(multi_fapl) < 0) TEST_ERROR
- if(H5Oclose(oidA) < 0) TEST_ERROR
- if(H5Oclose(oidB) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Pclose(lapl_idA) < 0)
+ TEST_ERROR
+ if (H5Pclose(lapl_idB) < 0)
+ TEST_ERROR
+ if (H5Pclose(fam_fapl) < 0)
+ TEST_ERROR
+ if (H5Pclose(multi_fapl) < 0)
+ TEST_ERROR
+ if (H5Oclose(oidA) < 0)
+ TEST_ERROR
+ if (H5Oclose(oidB) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Pclose (lapl_idA);
- H5Pclose (lapl_idB);
- H5Pclose (fam_fapl);
- H5Pclose (multi_fapl);
- H5Gclose (gidA);
- H5Gclose (gidB);
- H5Oclose (oidA);
- H5Oclose (oidB);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(lapl_idA);
+ H5Pclose(lapl_idB);
+ H5Pclose(fam_fapl);
+ H5Pclose(multi_fapl);
+ H5Gclose(gidA);
+ H5Gclose(gidB);
+ H5Oclose(oidA);
+ H5Oclose(oidB);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_set_elink_fapl1() */
-
/*-------------------------------------------------------------------------
* Function: external_set_elink_fapl2: test 11
*
@@ -7480,47 +9149,48 @@ error:
static int
external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t core_fapl = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t dset = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t dapl_id = H5I_INVALID_HID;
- hid_t dcpl = H5I_INVALID_HID;
- char *filename1 = NULL;
- char *filename2 = NULL;
- char *tmpname = NULL;
- char *cwdpath = NULL;
- hsize_t dims[2];
- int **points = NULL;
- int *points_data = NULL;
- int i, j, n;
- h5_stat_size_t filesize;
- h5_stat_size_t new_filesize;
-
- if(new_format)
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t core_fapl = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t dapl_id = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ char * filename1 = NULL;
+ char * filename2 = NULL;
+ char * tmpname = NULL;
+ char * cwdpath = NULL;
+ hsize_t dims[2];
+ int ** points = NULL;
+ int * points_data = NULL;
+ int i, j, n;
+ h5_stat_size_t filesize;
+ h5_stat_size_t new_filesize;
+
+ if (new_format)
TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)")
else
TESTING("H5Pset/get_elink_fapl() with same physical layout")
/* Set up file names and paths */
- if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (filename2 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename2 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
+ if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
+ (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/* Set up data array */
- if(NULL == (points_data = (int *)HDcalloc(NUM40 * NUM40, sizeof(int))))
+ if (NULL == (points_data = (int *)HDcalloc(NUM40 * NUM40, sizeof(int))))
TEST_ERROR;
- if(NULL == (points = (int **)HDcalloc(NUM40, sizeof(points_data))))
+ if (NULL == (points = (int **)HDcalloc(NUM40, sizeof(points_data))))
TEST_ERROR;
for (i = 0; i < NUM40; i++)
points[i] = points_data + (i * NUM40);
@@ -7535,19 +9205,23 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
/* create fapl for the target file to be a "core" file */
core_fapl = h5_fileaccess();
- if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR
+ if (H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ TEST_ERROR
/* set up name for external linked target file: "extlinks17" */
/* set up name for target file: "extlinks17" */
h5_fixname(FILENAME[39], core_fapl, filename2, NAME_BUF_SIZE);
/* Create the target file to be a "core" file */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
dims[0] = NUM40;
dims[1] = NUM40;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
/* Create dataset creation property list */
if (dcpl_g == H5P_DEFAULT)
@@ -7556,60 +9230,78 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
dcpl = H5Pcopy(dcpl_g);
if (0 > dcpl)
TEST_ERROR;
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
+ TEST_ERROR;
/* create "Dataset" in group "A" of target file */
- if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Pclose(dcpl) < 0) TEST_ERROR
- if(H5Sclose(space) < 0) TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ if (H5Sclose(space) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* get size of target file */
filesize = h5_get_file_size(filename2, core_fapl);
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file: ext_link->extlinks17:/A/Dataset */
- if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* create fapl to be a "core" file without backing store */
- if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) TEST_ERROR
+ if (H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0)
+ TEST_ERROR
/* Set file access property list for link access to use the "core" driver */
- if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR
- if(H5Pset_elink_fapl(dapl_id, core_fapl) < 0) TEST_ERROR
+ if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ TEST_ERROR
+ if (H5Pset_elink_fapl(dapl_id, core_fapl) < 0)
+ TEST_ERROR
/* try to open the external linked target dataset */
did = H5Dopen2(fid, "ext_link", dapl_id);
- if(did < 0) {
+ if (did < 0) {
H5_FAILED();
HDputs(" Should succeed in opening the target dataset");
goto error;
}
/* Initialize the dataset */
- for(i = n = 0; i < NUM40; i++)
- for(j = 0; j < NUM40; j++)
+ for (i = n = 0; i < NUM40; i++)
+ for (j = 0; j < NUM40; j++)
points[i][j] = n++;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0)
+ TEST_ERROR
- if(H5Pclose(dapl_id) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Pclose(dapl_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
new_filesize = h5_get_file_size(filename2, core_fapl);
/* the file size should remain the same since there is no backing store */
- if(new_filesize != filesize) TEST_ERROR
+ if (new_filesize != filesize)
+ TEST_ERROR
- if(H5Pclose(core_fapl) < 0) TEST_ERROR
+ if (H5Pclose(core_fapl) < 0)
+ TEST_ERROR
HDfree(points);
HDfree(points_data);
@@ -7623,7 +9315,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(space);
H5Dclose(dset);
@@ -7632,7 +9325,8 @@ error:
H5Dclose(did);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(points);
HDfree(points_data);
@@ -7645,7 +9339,6 @@ error:
return FAIL;
} /* end external_set_elink_fapl2() */
-
/*-------------------------------------------------------------------------
* Function: external_set_elink_fapl3: test 12
*
@@ -7674,74 +9367,96 @@ error:
static int
external_set_elink_fapl3(hbool_t new_format)
{
- hid_t core_fapl = -1, stdio_fapl = -1;
- hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl;
+ hid_t core_fapl = -1, stdio_fapl = -1;
+ hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl;
- if(new_format)
+ if (new_format)
TESTING("H5Pset/get_fapl() (w/new group format)")
else
TESTING("H5Pset/get_fapl()")
/* create fapl for the target file to be a "core" file */
core_fapl = h5_fileaccess();
- if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR
+ if (H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ TEST_ERROR
stdio_fapl = h5_fileaccess();
- if(H5Pset_fapl_stdio(stdio_fapl) < 0) TEST_ERROR
+ if (H5Pset_fapl_stdio(stdio_fapl) < 0)
+ TEST_ERROR
/* Set file access property list for link access to use the "stdio" driver */
- if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
- if(H5Pset_elink_fapl(lapl_id, stdio_fapl) < 0) TEST_ERROR
+ if ((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ TEST_ERROR
+ if (H5Pset_elink_fapl(lapl_id, stdio_fapl) < 0)
+ TEST_ERROR
/* Verify that the driver for the link's fapl is the "stdio" driver */
- if((l_fapl = H5Pget_elink_fapl(lapl_id)) < 0) TEST_ERROR
- if(H5Pget_driver(l_fapl) != H5FD_STDIO) TEST_ERROR
- if(H5Pclose(l_fapl) < 0) TEST_ERROR
+ if ((l_fapl = H5Pget_elink_fapl(lapl_id)) < 0)
+ TEST_ERROR
+ if (H5Pget_driver(l_fapl) != H5FD_STDIO)
+ TEST_ERROR
+ if (H5Pclose(l_fapl) < 0)
+ TEST_ERROR
/* Set file access property list for link access to use the "core" driver */
- if(H5Pset_elink_fapl(lapl_id, core_fapl) < 0) TEST_ERROR
+ if (H5Pset_elink_fapl(lapl_id, core_fapl) < 0)
+ TEST_ERROR
/* Make a copy of the link access property */
- if((new_lapl_id = H5Pcopy(lapl_id)) < 0) TEST_ERROR
+ if ((new_lapl_id = H5Pcopy(lapl_id)) < 0)
+ TEST_ERROR
/* get the fapl set in lapl_id */
- if(H5Pget(lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR
- if(H5Pclose(lapl_id) < 0) TEST_ERROR
+ if (H5Pget(lapl_id, "external link fapl", &out_fapl) < 0)
+ TEST_ERROR
+ if (H5Pclose(lapl_id) < 0)
+ TEST_ERROR
/* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */
- if(H5Pclose(out_fapl) < 0) TEST_ERROR
+ if (H5Pclose(out_fapl) < 0)
+ TEST_ERROR
/* Verify that the driver for the copied link's fapl is the "core" driver */
- if((l_fapl = H5Pget_elink_fapl(new_lapl_id)) < 0) TEST_ERROR
- if(H5Pget_driver(l_fapl) != H5FD_CORE) TEST_ERROR
+ if ((l_fapl = H5Pget_elink_fapl(new_lapl_id)) < 0)
+ TEST_ERROR
+ if (H5Pget_driver(l_fapl) != H5FD_CORE)
+ TEST_ERROR
/* get the fapl set in new_lapl_id */
- if(H5Pget(new_lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR
- if(H5Premove(new_lapl_id, "external link fapl") < 0) TEST_ERROR
+ if (H5Pget(new_lapl_id, "external link fapl", &out_fapl) < 0)
+ TEST_ERROR
+ if (H5Premove(new_lapl_id, "external link fapl") < 0)
+ TEST_ERROR
/* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */
- if(H5Pclose(out_fapl) < 0) TEST_ERROR
+ if (H5Pclose(out_fapl) < 0)
+ TEST_ERROR
- if(H5Pclose(l_fapl) < 0) TEST_ERROR
- if(H5Pclose(new_lapl_id) < 0) TEST_ERROR
- if(H5Pclose(core_fapl) < 0) TEST_ERROR
- if(H5Pclose(stdio_fapl) < 0) TEST_ERROR
+ if (H5Pclose(l_fapl) < 0)
+ TEST_ERROR
+ if (H5Pclose(new_lapl_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(core_fapl) < 0)
+ TEST_ERROR
+ if (H5Pclose(stdio_fapl) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(l_fapl);
H5Pclose(lapl_id);
H5Pclose(new_lapl_id);
H5Pclose(core_fapl);
H5Pclose(stdio_fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_set_elink_fapl3() */
-
/*-------------------------------------------------------------------------
* Function: external_set_elink_acc_flags
*
@@ -7754,13 +9469,12 @@ error:
static int
external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t file1 = -1, file2 = -1, group = -1, subgroup = -1, gapl = -1;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE];
- herr_t ret;
- unsigned flags;
+ hid_t file1 = -1, file2 = -1, group = -1, subgroup = -1, gapl = -1;
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE];
+ herr_t ret;
+ unsigned flags;
- if(new_format)
+ if (new_format)
TESTING("H5Pset/get_elink_acc_flags() (w/new group format)")
else
TESTING("H5Pset/get_elink_acc_flags()")
@@ -7768,195 +9482,246 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo
/* Create parent and target files, and external link */
h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[41], fapl, filename2, sizeof filename2);
- if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/", file1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", file1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file2, leave file1 open (should be read-write) */
- if(H5Fclose(file2) < 0) TEST_ERROR
+ if (H5Fclose(file2) < 0)
+ TEST_ERROR
/* Create new gapl, and set elink access flags to be H5F_ACC_RDONLY */
- if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR
- if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) TEST_ERROR
+ if ((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0)
+ TEST_ERROR
+ if (H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0)
+ TEST_ERROR
/* Verify "get" routine functionality */
- if(H5Pget_elink_acc_flags(gapl, &flags) < 0) TEST_ERROR
- if(flags != H5F_ACC_RDONLY) TEST_ERROR
+ if (H5Pget_elink_acc_flags(gapl, &flags) < 0)
+ TEST_ERROR
+ if (flags != H5F_ACC_RDONLY)
+ TEST_ERROR
/* Attempt to create a group through the external link using gapl (should fail) */
- H5E_BEGIN_TRY {
- group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl);
- } H5E_END_TRY;
- if(group != FAIL) TEST_ERROR
+ H5E_BEGIN_TRY { group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl); }
+ H5E_END_TRY;
+ if (group != FAIL)
+ TEST_ERROR
/* Close file1 and reopen with read only access */
- if(H5Fclose(file1) < 0) TEST_ERROR
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if (H5Fclose(file1) < 0)
+ TEST_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Set elink access flags on gapl to be H5F_ACC_RDWR */
- if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) TEST_ERROR
+ if (H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0)
+ TEST_ERROR
/* Create a group through the external link using gapl (should succeed) */
- if((group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR
+ if ((group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0)
+ TEST_ERROR
/* Close group */
- if(H5Gclose(group) < 0) TEST_ERROR
+ if (H5Gclose(group) < 0)
+ TEST_ERROR
/* Unset elink access flags on gapl */
- if(H5Pset_elink_acc_flags(gapl, H5F_ACC_DEFAULT) < 0) TEST_ERROR
+ if (H5Pset_elink_acc_flags(gapl, H5F_ACC_DEFAULT) < 0)
+ TEST_ERROR
/* Attempt to create a group through the external link using gapl (should fail) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
subgroup = H5Gcreate2(file1, "/ext_link/group/subgroup", H5P_DEFAULT, H5P_DEFAULT, gapl);
- } H5E_END_TRY;
- if(subgroup != FAIL) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (subgroup != FAIL)
+ TEST_ERROR
/* Attempt to set SWMR flags on gapl.
* This is just a smoke check of the flags. The actual external link
* functionality is tested in the SWMR tests.
*/
/* Set SWMR reader flags on gapl */
- if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ) < 0) TEST_ERROR
+ if (H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ) < 0)
+ TEST_ERROR
/* Set SWMR writer flags on gapl */
- if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE) < 0) TEST_ERROR
+ if (H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE) < 0)
+ TEST_ERROR
/* Attempt to set invalid flags on gapl */
- H5E_BEGIN_TRY {
- ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC);
- } H5E_END_TRY;
- if(ret != FAIL) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL);
- } H5E_END_TRY;
- if(ret != FAIL) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT);
- } H5E_END_TRY;
- if(ret != FAIL) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC); }
+ H5E_END_TRY;
+ if (ret != FAIL)
+ TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL); }
+ H5E_END_TRY;
+ if (ret != FAIL)
+ TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT); }
+ H5E_END_TRY;
+ if (ret != FAIL)
+ TEST_ERROR
/* SWMR reader with write access */
- H5E_BEGIN_TRY {
- ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_READ);
- } H5E_END_TRY;
- if(ret != FAIL) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_READ); }
+ H5E_END_TRY;
+ if (ret != FAIL)
+ TEST_ERROR
/* SWMR writer with read-only access */
- H5E_BEGIN_TRY {
- ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE);
- } H5E_END_TRY;
- if(ret != FAIL) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE); }
+ H5E_END_TRY;
+ if (ret != FAIL)
+ TEST_ERROR
/* Close file1 */
- if(H5Fclose(file1) < 0) TEST_ERROR
+ if (H5Fclose(file1) < 0)
+ TEST_ERROR
/* Only run this part with VFDs that support SWMR */
- if(H5FD__supports_swmr_test(env_h5_drvr)) {
+ if (H5FD__supports_swmr_test(env_h5_drvr)) {
/* Reopen file1, with read-write and SWMR-write access */
/* Only supported under the latest file format */
- if(new_format) {
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR
+ if (new_format) {
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open a group through the external link using default gapl */
- if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify that the correct parameters have been set on file2 */
- if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR
- if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR
- if(flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE)) TEST_ERROR
+ if ((file2 = H5Iget_file_id(group)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fget_intent(file2, &flags) < 0)
+ FAIL_STACK_ERROR
+ if (flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE))
+ TEST_ERROR
/* Close file2 and group */
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
/* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */
- if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) FAIL_STACK_ERROR
+ if (H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0)
+ FAIL_STACK_ERROR
/* Open a group through the external link using gapl */
- if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0)
+ FAIL_STACK_ERROR
/* Verify that the correct parameters have been set on file2 */
- if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR
- if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR
- if(flags != H5F_ACC_RDWR) TEST_ERROR
+ if ((file2 = H5Iget_file_id(group)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fget_intent(file2, &flags) < 0)
+ FAIL_STACK_ERROR
+ if (flags != H5F_ACC_RDWR)
+ TEST_ERROR
/* Close file2 and group */
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
/* Close file1 */
- if(H5Fclose(file1) < 0) TEST_ERROR
+ if (H5Fclose(file1) < 0)
+ TEST_ERROR
}
/* Reopen file1, with read-only and SWMR-read access */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open a group through the external link using default gapl */
- if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify that the correct parameters have been set on file2 */
- if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR
- if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR
- if(flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ)) TEST_ERROR
+ if ((file2 = H5Iget_file_id(group)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fget_intent(file2, &flags) < 0)
+ FAIL_STACK_ERROR
+ if (flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ))
+ TEST_ERROR
/* Close file2 and group */
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
/* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */
- if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) FAIL_STACK_ERROR
+ if (H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0)
+ FAIL_STACK_ERROR
/* Open a group through the external link using gapl */
- if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0)
+ FAIL_STACK_ERROR
/* Verify that the correct parameters have been set on file2 */
- if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR
- if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR
- if(flags != H5F_ACC_RDONLY) TEST_ERROR
+ if ((file2 = H5Iget_file_id(group)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fget_intent(file2, &flags) < 0)
+ FAIL_STACK_ERROR
+ if (flags != H5F_ACC_RDONLY)
+ TEST_ERROR
/* Close file2 and group */
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
/* Close file1 */
- if(H5Fclose(file1) < 0) TEST_ERROR
+ if (H5Fclose(file1) < 0)
+ TEST_ERROR
} /* end if */
-
/* Verify that H5Fcreate and H5Fopen reject H5F_ACC_DEFAULT */
- H5E_BEGIN_TRY {
- file1 = H5Fcreate(filename1, H5F_ACC_DEFAULT, H5P_DEFAULT, fapl);
- } H5E_END_TRY;
- if(file1 != FAIL) TEST_ERROR
- H5E_BEGIN_TRY {
- file1 = H5Fcreate(filename1, H5F_ACC_TRUNC | H5F_ACC_DEFAULT, H5P_DEFAULT, fapl);
- } H5E_END_TRY;
- if(file1 != FAIL) TEST_ERROR
- H5E_BEGIN_TRY {
- file1 = H5Fopen(filename1, H5F_ACC_DEFAULT, fapl);
- } H5E_END_TRY;
- if(file1 != FAIL) TEST_ERROR
- H5E_BEGIN_TRY {
- file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_DEFAULT, fapl);
- } H5E_END_TRY;
- if(file1 != FAIL) TEST_ERROR
+ H5E_BEGIN_TRY { file1 = H5Fcreate(filename1, H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); }
+ H5E_END_TRY;
+ if (file1 != FAIL)
+ TEST_ERROR
+ H5E_BEGIN_TRY { file1 = H5Fcreate(filename1, H5F_ACC_TRUNC | H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); }
+ H5E_END_TRY;
+ if (file1 != FAIL)
+ TEST_ERROR
+ H5E_BEGIN_TRY { file1 = H5Fopen(filename1, H5F_ACC_DEFAULT, fapl); }
+ H5E_END_TRY;
+ if (file1 != FAIL)
+ TEST_ERROR
+ H5E_BEGIN_TRY { file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_DEFAULT, fapl); }
+ H5E_END_TRY;
+ if (file1 != FAIL)
+ TEST_ERROR
/* Close gapl */
- if(H5Pclose(gapl) < 0) TEST_ERROR
+ if (H5Pclose(gapl) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group);
H5Gclose(subgroup);
H5Fclose(file1);
H5Fclose(file2);
H5Pclose(gapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_set_elink_acc_flags() */
-
/*-------------------------------------------------------------------------
* Function: external_set_elink_cb
*
@@ -7966,34 +9731,38 @@ error:
* Failure: -1
*-------------------------------------------------------------------------
*/
- /* User data structure for callback function */
+/* User data structure for callback function */
typedef struct {
- const char *parent_file; /* Expected parent file name */
- const char *target_file; /* Expected target file name */
- hid_t base_fapl; /* Base fapl for family driver */
- hsize_t fam_size; /* Size of family files */
- int code; /* Code to control the actions taken by the callback */
+ const char *parent_file; /* Expected parent file name */
+ const char *target_file; /* Expected target file name */
+ hid_t base_fapl; /* Base fapl for family driver */
+ hsize_t fam_size; /* Size of family files */
+ int code; /* Code to control the actions taken by the callback */
} set_elink_cb_t;
/* Callback function */
static herr_t
-external_set_elink_cb_cb(const char *parent_file, const char *parent_group,
- const char *target_file, const char *target_obj, unsigned *flags,
- hid_t fapl, void *_op_data)
+external_set_elink_cb_cb(const char *parent_file, const char *parent_group, const char *target_file,
+ const char *target_obj, unsigned *flags, hid_t fapl, void *_op_data)
{
- set_elink_cb_t *op_data = (set_elink_cb_t *)_op_data;
+ set_elink_cb_t *op_data = (set_elink_cb_t *)_op_data;
/* Verify file and object names are correct */
- if (HDstrcmp(parent_file, op_data->parent_file)) return FAIL;
- if (HDstrcmp(parent_group, "/group1")) return FAIL;
- if (HDstrcmp(target_file, op_data->target_file)) return FAIL;
- if (HDstrcmp(target_obj, "/")) return FAIL;
+ if (HDstrcmp(parent_file, op_data->parent_file))
+ return FAIL;
+ if (HDstrcmp(parent_group, "/group1"))
+ return FAIL;
+ if (HDstrcmp(target_file, op_data->target_file))
+ return FAIL;
+ if (HDstrcmp(target_obj, "/"))
+ return FAIL;
/* Set flags to be read-write */
*flags = (*flags & ~H5F_ACC_RDONLY) | H5F_ACC_RDWR;
/* Set family file driver on fapl */
- if (H5Pset_fapl_family(fapl, op_data->fam_size, op_data->base_fapl) < 0) return FAIL;
+ if (H5Pset_fapl_family(fapl, op_data->fam_size, op_data->base_fapl) < 0)
+ return FAIL;
/* Codes to cause an invalid condition (and verify that an error is issued */
if (op_data->code == 1)
@@ -8008,15 +9777,13 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group,
static int
external_set_elink_cb(hid_t fapl, hbool_t new_format)
{
- hid_t file1 = -1, file2 = -1, group = -1, gapl = -1, fam_fapl = -1, ret_fapl = -1, base_driver;
- set_elink_cb_t op_data,
- *op_data_p;
+ hid_t file1 = -1, file2 = -1, group = -1, gapl = -1, fam_fapl = -1, ret_fapl = -1, base_driver;
+ set_elink_cb_t op_data, *op_data_p;
H5L_elink_traverse_t cb;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE];
- unsigned flags;
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE];
+ unsigned flags;
- if(new_format)
+ if (new_format)
TESTING("H5Pset/get_elink_cb() (w/new group format)")
else
TESTING("H5Pset/get_elink_cb()")
@@ -8028,96 +9795,126 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
/* Family file driver cannot be used with family or multi drivers for member files */
/* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI)
would report FALSE, causing problems */
- base_driver = H5Pget_driver(fapl);
- op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI
- || base_driver == H5FD_MPIO || base_driver == H5FD_CORE) ? H5P_DEFAULT : fapl;
+ base_driver = H5Pget_driver(fapl);
+ op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI ||
+ base_driver == H5FD_MPIO || base_driver == H5FD_CORE)
+ ? H5P_DEFAULT
+ : fapl;
op_data.fam_size = ELINK_CB_FAM_SIZE;
- op_data.code = 0;
+ op_data.code = 0;
/* Create family fapl */
- if ((fam_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
- if (H5Pset_fapl_family(fam_fapl, op_data.fam_size, op_data.base_fapl) < 0) TEST_ERROR
+ if ((fam_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
+ if (H5Pset_fapl_family(fam_fapl, op_data.fam_size, op_data.base_fapl) < 0)
+ TEST_ERROR
/* Create parent and target files, group, and external link */
h5_fixname(FILENAME[42], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[43], fam_fapl, filename2, sizeof filename2);
- if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR
- if((group = H5Gcreate2(file1, "group1",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/", group, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0)
+ TEST_ERROR
+ if ((group = H5Gcreate2(file1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", group, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close files and group */
- if(H5Fclose(file1) < 0) TEST_ERROR
- if(H5Fclose(file2) < 0) TEST_ERROR
- if(H5Gclose(group) < 0) TEST_ERROR
+ if (H5Fclose(file1) < 0)
+ TEST_ERROR
+ if (H5Fclose(file2) < 0)
+ TEST_ERROR
+ if (H5Gclose(group) < 0)
+ TEST_ERROR
/* Create new gapl, and set elink callback */
- if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR
- if(H5Pset_elink_cb(gapl, external_set_elink_cb_cb, &op_data) < 0) TEST_ERROR
+ if ((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0)
+ TEST_ERROR
+ if (H5Pset_elink_cb(gapl, external_set_elink_cb_cb, &op_data) < 0)
+ TEST_ERROR
/* Verify "get" routine functionality */
- if(H5Pget_elink_cb(gapl, &cb, (void **) &op_data_p) < 0) TEST_ERROR
- if(cb != external_set_elink_cb_cb) TEST_ERROR
- if(op_data_p != &op_data) TEST_ERROR
+ if (H5Pget_elink_cb(gapl, &cb, (void **)&op_data_p) < 0)
+ TEST_ERROR
+ if (cb != external_set_elink_cb_cb)
+ TEST_ERROR
+ if (op_data_p != &op_data)
+ TEST_ERROR
/* Open file1 with read only access */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Create a group through the external link using gapl */
- if((group = H5Gcreate2(file1, "/group1/ext_link/group2", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR
+ if ((group = H5Gcreate2(file1, "/group1/ext_link/group2", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0)
+ TEST_ERROR
/* Verify that the correct parameters have been set on file2 (somewhat
* redundant as the library would be unable to create the group otherwise)
*/
- if((file2 = H5Iget_file_id(group)) < 0) TEST_ERROR
- if(H5Fget_intent(file2, &flags) < 0) TEST_ERROR
- if(!(flags & H5F_ACC_RDWR)) TEST_ERROR
- if((ret_fapl = H5Fget_access_plist(file2)) < 0) TEST_ERROR
- if(H5FD_FAMILY != H5Pget_driver(ret_fapl)) TEST_ERROR
+ if ((file2 = H5Iget_file_id(group)) < 0)
+ TEST_ERROR
+ if (H5Fget_intent(file2, &flags) < 0)
+ TEST_ERROR
+ if (!(flags & H5F_ACC_RDWR))
+ TEST_ERROR
+ if ((ret_fapl = H5Fget_access_plist(file2)) < 0)
+ TEST_ERROR
+ if (H5FD_FAMILY != H5Pget_driver(ret_fapl))
+ TEST_ERROR
- if(H5Gclose(group) < 0) TEST_ERROR
- if(H5Fclose(file2) < 0) TEST_ERROR
- if(H5Pclose(ret_fapl) < 0) TEST_ERROR
- if(H5Pclose(fam_fapl) < 0) TEST_ERROR
+ if (H5Gclose(group) < 0)
+ TEST_ERROR
+ if (H5Fclose(file2) < 0)
+ TEST_ERROR
+ if (H5Pclose(ret_fapl) < 0)
+ TEST_ERROR
+ if (H5Pclose(fam_fapl) < 0)
+ TEST_ERROR
/* Modify the user data structure to cause the callback to fail next time */
op_data.code = 1;
/* Attempt to reopen group2 (should fail) */
- H5E_BEGIN_TRY {
- group = H5Gopen2(file1, "/group1/ext_link/group2", gapl);
- } H5E_END_TRY;
- if(group != FAIL) TEST_ERROR
+ H5E_BEGIN_TRY { group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); }
+ H5E_END_TRY;
+ if (group != FAIL)
+ TEST_ERROR
/* Modify the user data structure to cause the callback to return invalid flags */
op_data.code = 2;
/* Attempt to reopen group2 (should fail) */
- H5E_BEGIN_TRY {
- group = H5Gopen2(file1, "/group1/ext_link/group2", gapl);
- } H5E_END_TRY;
- if(group != FAIL) TEST_ERROR
+ H5E_BEGIN_TRY { group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); }
+ H5E_END_TRY;
+ if (group != FAIL)
+ TEST_ERROR
/* Close */
- if(H5Fclose(file1) < 0) TEST_ERROR
- if(H5Pclose(gapl) < 0) TEST_ERROR
+ if (H5Fclose(file1) < 0)
+ TEST_ERROR
+ if (H5Pclose(gapl) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group);
H5Fclose(file1);
H5Fclose(file2);
H5Pclose(gapl);
H5Pclose(ret_fapl);
H5Pclose(fam_fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_set_elink_cb() */
-
/*-------------------------------------------------------------------------
* Function: external_reset_register
*
@@ -8131,48 +9928,55 @@ error:
static int
external_reset_register(void)
{
- hid_t file;
- char filename[NAME_BUF_SIZE];
+ hid_t file;
+ char filename[NAME_BUF_SIZE];
TESTING("external links are registered after reset")
/* Create and close file */
h5_fixname(FILENAME[44], H5P_DEFAULT, filename, sizeof filename);
- if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Fclose(file) < 0) TEST_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
/* Reset the library */
H5close();
/* Re open file */
- if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create an external link */
- if (H5Lcreate_external("some_file", "some_obj", file, "ext_link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external("some_file", "some_obj", file, "ext_link1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file */
- if (H5Fclose(file) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
/* Try again to make sure the previous H5Lcreate_external call does not
* affect the ability to reset */
H5close();
- if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Lcreate_external("another_file", "another_obj", file, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if (H5Fclose(file) < 0) TEST_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external("another_file", "another_obj", file, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
- if(HDremove(filename) != 0) TEST_ERROR
+ if (HDremove(filename) != 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
return FAIL;
} /* end external_reset_register() */
-
#ifdef H5_HAVE_WINDOW_PATH
/*-------------------------------------------------------------------------
@@ -8191,15 +9995,12 @@ error:
static int
external_link_win1(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via main file's current drive/rel path(windows)(w/new group format)")
else
TESTING("external links via main file's current drive/rel path(windows)")
@@ -8207,7 +10008,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
+ if (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "/CWD/tmp_links/extlinks10" */
@@ -8220,47 +10021,55 @@ external_link_win1(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file via main file's CWD*/
- if(gid < 0) {
+ if (gid < 0) {
H5_FAILED();
HDputs(" Should have found the file in CWD.");
goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_win1() */
-
/*-------------------------------------------------------------------------
* Function: external_link_win2
*
@@ -8277,15 +10086,12 @@ error:
static int
external_link_win2(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via target's rel drive/abs path directly(windows)(w/new group format)")
else
TESTING("external links via target's rel drive/abs path directly(windows)")
@@ -8293,12 +10099,14 @@ external_link_win2(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp_links directory and get current working directory path */
- if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
+ /* create tmp_links directory and get current working directory path */
+ if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
+ (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/* set up name for target link: "/CWD/tmp_links/extlinks11" */
- HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */
+ HDstrcpy(tmpname,
+ &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */
HDstrcat(tmpname, "/");
HDstrcat(tmpname, FILENAME[31]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
@@ -8307,48 +10115,55 @@ external_link_win2(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[31], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file directly */
- if(gid < 0) {
+ if (gid < 0) {
H5_FAILED();
HDputs(" Should have found the file in tmp_links.");
goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_win2() */
-
/*-------------------------------------------------------------------------
* Function: external_link_win3
*
@@ -8365,15 +10180,12 @@ error:
static int
external_link_win3(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- int drive = 0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive = 0;
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)")
else
TESTING("external links via target's abs drive/rel path directly (windows)")
@@ -8387,31 +10199,35 @@ external_link_win3(hid_t fapl, hbool_t new_format)
/* set up name for target link: "<drive-letter>:tmp_links/extlinks12" */
drive = HDgetdrive();
- HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive + 'A' - 1), FILENAME[32]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "tmp_links/extlinks12" */
h5_fixname(FILENAME[32], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file directly */
if (gid < 0) {
@@ -8421,17 +10237,21 @@ external_link_win3(hid_t fapl, hbool_t new_format)
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_win3() */
@@ -8451,49 +10271,51 @@ external_link_win3(hid_t fapl, hbool_t new_format)
static int
external_link_win4(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive = 0;
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)")
else
TESTING("external links via main file's abs drive/rel path (windows)")
/* set up name for main file: "<drive-letter>:tmp_links/extlinks0" */
drive = HDgetdrive();
- HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive + 'A' - 1), FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* set up name for target link: "<drive-letter>:extlinks13" */
- HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[33]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive + 'A' - 1), FILENAME[33]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "tmp_links/extlinks13" */
h5_fixname(FILENAME[34], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file via main file's absolute drive/relative path */
if (gid < 0) {
@@ -8503,21 +10325,24 @@ external_link_win4(hid_t fapl, hbool_t new_format)
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_win4() */
-
/*-------------------------------------------------------------------------
* Function: external_link_win5
*
@@ -8534,21 +10359,18 @@ error:
static int
external_link_win5(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive = 0;
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via main file's rel drive/abs path (windows)(w/new group format)")
else
TESTING("external links via main file's rel drive/abs path (windows)")
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
+ if (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
drive = HDgetdrive();
if (drive >= 26)
@@ -8563,54 +10385,62 @@ external_link_win5(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* set up name for target link: "<drive-letter+1>:tmp_links/extlinks14" */
- HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[35]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive + 'A' - 1), FILENAME[35]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "tmp_links/extlinks14" */
h5_fixname(FILENAME[35], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file via main file's rel drive/abs path */
- if(gid < 0) {
+ if (gid < 0) {
H5_FAILED();
HDputs(" Should have found the file in CWD.");
goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_win5() */
-
/*-------------------------------------------------------------------------
* Function: external_link_win6
*
@@ -8627,15 +10457,12 @@ error:
static int
external_link_win6(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive = 0;
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("external links via target's current drive/rel path (windows)(w/new group format)")
else
TESTING("external links via target's current drive/rel path (windows)")
@@ -8653,30 +10480,35 @@ external_link_win6(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* set up name for target link: "<drive-letter+1>:tmp_links/extlinks15" */
- HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[36]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive + 'A' - 1), FILENAME[36]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "tmp/extlinks15" */
h5_fixname(FILENAME[36], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file via target file's rel path in current drive */
if (gid < 0) {
@@ -8686,21 +10518,24 @@ external_link_win6(hid_t fapl, hbool_t new_format)
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_win6() */
-
/*-------------------------------------------------------------------------
* Function: external_link_win7
*
@@ -8717,23 +10552,21 @@ error:
static int
external_link_win7(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via main file's UNC local host/main drive/rel path(windows)(w/new group format)")
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
+ TESTING(
+ "external links via main file's UNC local host/main drive/rel path(windows)(w/new group format)")
else
TESTING("external links via main file's UNC local host/main drive/rel path(windows)")
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
+ if (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "\\127.0.0.1\c$/tmp_links/extlinks10" */
@@ -8746,47 +10579,55 @@ external_link_win7(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file via main file's local host/main drive*/
- if(gid < 0) {
+ if (gid < 0) {
H5_FAILED();
HDputs(" Should have found the file in local host/main drive.");
goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_win7() */
-
/*-------------------------------------------------------------------------
* Function: external_link_win8
*
@@ -8804,78 +10645,86 @@ error:
static int
external_link_win8(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- int drive = 0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via target's Long UNC abs drive/abs path directly (windows)(w/new group format)")
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive = 0;
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
+ TESTING(
+ "external links via target's Long UNC abs drive/abs path directly (windows)(w/new group format)")
else
TESTING("external links via target's Long UNC abs drive/abs path directly (windows)")
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR
+ if (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
+ TEST_ERROR
/* create tmp_links directory */
- if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
/* set up name for target link: "<drive-letter>:\CWD\extlinks10" */
drive = HDgetdrive();
- HDsnprintf(tmpname, sizeof(tmpname), "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]);
+ HDsnprintf(tmpname, sizeof(tmpname), "\\\\?\\%c:%s\\%s", (drive + 'A' - 1), &cwdpath[2], FILENAME[30]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "extlinks10" */
h5_fixname(FILENAME[30], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file directly */
- if(gid < 0) {
+ if (gid < 0) {
H5_FAILED();
HDputs(" Should have found the file in tmp_links.");
goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_win8() */
-
/*-------------------------------------------------------------------------
* Function: external_link_win9
*
@@ -8892,23 +10741,22 @@ error:
static int
external_link_win9(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)(w/new group format)")
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+
+ if (new_format)
+ TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)(w/new group "
+ "format)")
else
TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)")
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR
+ if (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
+ TEST_ERROR
/* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp_links/extlinks10" */
HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */
@@ -8920,49 +10768,57 @@ external_link_win9(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* should be able to find the target file via main file's local host/main drive*/
- if(gid < 0) {
+ if (gid < 0) {
H5_FAILED();
HDputs(" Should have found the file in local host/main drive.");
goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_win9() */
#endif /* H5_HAVE_WINDOW_PATH */
-
/*-------------------------------------------------------------------------
* Function: external_link_recursive
*
@@ -8975,11 +10831,11 @@ error:
static int
external_link_recursive(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */
- if(new_format)
+ if (new_format)
TESTING("recursive external links (w/new group format)")
else
TESTING("recursive external links")
@@ -8988,21 +10844,24 @@ external_link_recursive(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
/* Create first file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create recursive external links */
- if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open object through dangling file external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "recursive", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); }
+ H5E_END_TRY;
if (gid >= 0) {
H5_FAILED();
HDputs(" Should have failed for recursive external links.");
@@ -9010,20 +10869,22 @@ external_link_recursive(hid_t fapl, hbool_t new_format)
}
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_recursive() */
-
/*-------------------------------------------------------------------------
* Function: external_link_query
*
@@ -9037,17 +10898,16 @@ error:
static int
external_link_query(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- const char *file_name; /* Name of the file the external link points to */
- const char *object_name; /* Name of the object the external link points to */
- H5O_info2_t oi; /* Object information */
- H5L_info2_t li; /* Link information */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
- query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ const char *file_name; /* Name of the file the external link points to */
+ const char *object_name; /* Name of the object the external link points to */
+ H5O_info2_t oi; /* Object information */
+ H5L_info2_t li; /* Link information */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
+ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */
+
+ if (new_format)
TESTING("query aspects of external link (w/new group format)")
else
TESTING("query aspects of external link")
@@ -9057,15 +10917,19 @@ external_link_query(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file, with external link to object in second file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link */
/* (add a few extra '/'s to make certain library normalizes external link object names) */
- if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Get size of buffer for external link */
- if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
+ if (H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1)))
+ TEST_ERROR
if (H5L_TYPE_EXTERNAL != li.type) {
H5_FAILED();
HDputs(" Unexpected link class - should have been an external link");
@@ -9073,80 +10937,108 @@ external_link_query(hid_t fapl, hbool_t new_format)
}
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file to point to */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create object to link to */
- if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Get size of buffer for external link */
- if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
- if(H5L_TYPE_EXTERNAL != li.type) {
+ if (H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1)))
+ TEST_ERROR
+ if (H5L_TYPE_EXTERNAL != li.type) {
H5_FAILED();
HDputs(" Unexpected link class - should have been an external link");
goto error;
}
/* Get information for external link. It should be two strings right after each other */
- if(H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Extract the file and object names from the buffer */
- if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR
+ if (H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0)
+ TEST_ERROR
/* Compare the file and object names */
- if(HDstrcmp(file_name, filename2)) TEST_ERROR
- if(HDstrcmp(object_name, "/dst")) TEST_ERROR
+ if (HDstrcmp(file_name, filename2))
+ TEST_ERROR
+ if (HDstrcmp(object_name, "/dst"))
+ TEST_ERROR
/* Query information about object that external link points to */
- if(H5Oget_info_by_name3(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5O_TYPE_GROUP != oi.type) {
+ if (H5Oget_info_by_name3(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5O_TYPE_GROUP != oi.type) {
H5_FAILED();
HDputs(" Unexpected object type - should have been a group");
goto error;
}
/* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Make sure that passing in NULLs to H5Lunpack_elink_val works */
- if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR
+ if (H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0)
+ TEST_ERROR
/* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */
- H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR
- } H5E_END_TRY
- H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
- } H5E_END_TRY
- H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
- } H5E_END_TRY
- H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_query() */
-
/*-------------------------------------------------------------------------
* Function: external_link_unlink_compact
*
@@ -9159,12 +11051,11 @@ error:
static int
external_link_unlink_compact(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- if(new_format)
+ if (new_format)
TESTING("unlinking external link in compact group (w/new group format)")
else
TESTING("unlinking external link in compact group")
@@ -9174,58 +11065,73 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file, with external link to object in second file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link */
- if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file to point to */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create object to link to */
- if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Unlink external link */
- if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "src", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Open second file */
- if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open group for external link */
- if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_unlink_compact() */
-
/*-------------------------------------------------------------------------
* Function: external_link_unlink_dense
*
@@ -9238,18 +11144,17 @@ error:
static int
external_link_unlink_dense(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gcpl = -1; /* Group creation property list ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- unsigned nmsgs; /* Number of messages in group's header */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned u; /* Local index variable */
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gcpl = -1; /* Group creation property list ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ unsigned nmsgs; /* Number of messages in group's header */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned u; /* Local index variable */
+
+ if (new_format)
TESTING("unlinking external link in dense group (w/new group format)")
else
TESTING("unlinking external link in dense group")
@@ -9259,112 +11164,151 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file, with external link to object in second file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Open root group */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check on root group's status */
- if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) != TRUE)
+ TEST_ERROR
/* Query the group creation properties */
- if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
+ if ((gcpl = H5Gget_create_plist(gid)) < 0)
+ TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Create external link */
- /* (This also covers the case of having an external link in a compact group that's converted to a dense group) */
- if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* (This also covers the case of having an external link in a compact group that's converted to a dense
+ * group) */
+ if (H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check on root group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
- if(nmsgs != 1) TEST_ERROR
- if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, &nmsgs) != TRUE)
+ TEST_ERROR
+ if (nmsgs != 1)
+ TEST_ERROR
+ if (H5G__has_stab_test(gid) == TRUE)
+ TEST_ERROR
/* Create enough objects in the root group to change it into a "dense" group */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
} /* end for */
/* Check on root group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
/* Close group creation property list */
- if(H5Pclose(gcpl) < 0) TEST_ERROR
+ if (H5Pclose(gcpl) < 0)
+ TEST_ERROR
/* Close root group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file to point to */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create object to link to */
- if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open root group */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Unlink external link */
- if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "src", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Remove enough objects in the root group to change it into a "compact" group */
- for(u = 0; u < ((max_compact - min_dense) + 1); u++) {
+ for (u = 0; u < ((max_compact - min_dense) + 1); u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Check on root group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
- if(nmsgs != (min_dense - 1)) TEST_ERROR
- if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, &nmsgs) != TRUE)
+ TEST_ERROR
+ if (nmsgs != (min_dense - 1))
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(gid) == TRUE)
+ TEST_ERROR
/* Close root group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Open second file */
- if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open group for external link (should be unaffected) */
- if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_unlink_dense() */
-
/*-------------------------------------------------------------------------
* Function: external_link_move
*
@@ -9377,13 +11321,12 @@ error:
static int
external_link_move(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- if(new_format)
+ if (new_format)
TESTING("move external link (w/new group format)")
else
TESTING("move external link")
@@ -9393,162 +11336,213 @@ external_link_move(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file, with external link to object in second file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link */
- if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file to point to */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create object to link to */
- if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
-/* Move external link to different name within same group */
+ /* Move external link to different name within same group */
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Move external link within same group */
- if(H5Lmove(fid, "src", H5L_SAME_LOC, "src2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(fid, "src", H5L_SAME_LOC, "src2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "src2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "src2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(objname, "/dst")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(objname, "/dst"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
/* Close external object */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Open second file */
- if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open group created through external link */
- if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
-/* Move external link to different group */
+ /* Move external link to different group */
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create another group, to move the external link into */
- if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Move external link to different group */
- if(H5Lmove(fid, "src2", gid, "src3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(fid, "src2", gid, "src3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close new group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(objname, "/dst")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(objname, "/dst"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
/* Close external object */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Open second file */
- if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open group created through external link */
- if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
-/* Move external link back to original group */
+ /* Move external link back to original group */
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(objname, "/dst")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(objname, "/dst"))
+ TEST_ERROR
/* Move external link back to original location */
- if(H5Lmove(fid, "/group2/src3", H5L_SAME_LOC, "/src", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(fid, "/group2/src3", H5L_SAME_LOC, "/src", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(objname, "/dst")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(objname, "/dst"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
/* Close external object */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Open second file */
- if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open group created through external link */
- if((gid = H5Gopen2(fid, "dst/new_group3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "dst/new_group3", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_move() */
-
/*-------------------------------------------------------------------------
* Function: external_link_ride
*
@@ -9562,18 +11556,17 @@ error:
static int
external_link_ride(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gcpl = -1; /* Group creation property list ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- unsigned nmsgs; /* Number of messages in group's header */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned u; /* Local index variable */
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gcpl = -1; /* Group creation property list ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ unsigned nmsgs; /* Number of messages in group's header */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned u; /* Local index variable */
+
+ if (new_format)
TESTING("external link along for the ride (w/new group format)")
else
TESTING("external link along for the ride")
@@ -9583,154 +11576,205 @@ external_link_ride(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file, with external link to object in second file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Open root group */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check on root group's status */
- if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) != TRUE)
+ TEST_ERROR
/* Query the group creation properties */
- if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
+ if ((gcpl = H5Gget_create_plist(gid)) < 0)
+ TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Create enough objects in the root group to change it into a "dense" group */
- for(u = 0; u < (max_compact + 1); u++) {
+ for (u = 0; u < (max_compact + 1); u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
} /* end for */
/* Check on root group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(new_format) {
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (new_format) {
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
} /* end if */
else {
- if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(gid) != TRUE)
+ TEST_ERROR
} /* end else */
/* Create external link */
/* (This also covers the case of adding an external link to a dense group) */
- if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check on root group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
/* Close group creation property list */
- if(H5Pclose(gcpl) < 0) TEST_ERROR
+ if (H5Pclose(gcpl) < 0)
+ TEST_ERROR
/* Close root group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create second file to point to */
- if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create object to link to */
- if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
-/* Remove enough objects to convert group containing external link back into compact form */
+ /* Remove enough objects to convert group containing external link back into compact form */
/* Open first file */
- if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/dst")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/dst"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close external object */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Open root group */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Remove enough objects in the root group to change it into a "compact" group */
- for(u = 0; u < ((max_compact - min_dense) + 3); u++) {
+ for (u = 0; u < ((max_compact - min_dense) + 3); u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Check on root group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
- if(nmsgs != (min_dense - 1)) TEST_ERROR
- if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, &nmsgs) != TRUE)
+ TEST_ERROR
+ if (nmsgs != (min_dense - 1))
+ TEST_ERROR
+ if (H5G__has_stab_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) == TRUE)
+ TEST_ERROR
/* Close root group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Open object through external link */
- if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/dst")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/dst"))
+ TEST_ERROR
/* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group in external file */
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
/* Close external object */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Open second file */
- if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open group created through external link */
- if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Open group created through external link */
- if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl);
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_ride() */
-
/*-------------------------------------------------------------------------
* Function: external_link_closing
*
@@ -9744,20 +11788,18 @@ error:
static int
external_link_closing(hid_t fapl, hbool_t new_format)
{
- hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4=(-1);
- hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1);
- hid_t lcpl_id=(-1);
- hsize_t dims[2];
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- filename4[NAME_BUF_SIZE], /* Names of files to externally link across */
- buf[NAME_BUF_SIZE]; /* misc. buffer */
+ hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4 = (-1);
+ hid_t gid = (-1), tid = (-1), tid2 = (-1), sid = (-1), did = (-1);
+ hid_t lcpl_id = (-1);
+ hsize_t dims[2];
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE],
+ filename4[NAME_BUF_SIZE], /* Names of files to externally link across */
+ buf[NAME_BUF_SIZE]; /* misc. buffer */
H5L_info2_t li;
H5O_info2_t oi;
hobj_ref_t obj_ref;
- if(new_format)
+ if (new_format)
TESTING("that external files are closed during traversal (w/new group format)")
else
TESTING("that external files are closed during traversal")
@@ -9777,175 +11819,263 @@ external_link_closing(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4);
/* Create four files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */
dims[0] = 2;
dims[1] = 2;
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* Create external links from each file to the next */
- if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close all files but the first */
- if(H5Fclose(fid4) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid4) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid3) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Test creating each kind of object */
- if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Test that getting info works */
- if(H5Lget_info2(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info2(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info2(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Test move */
- if(H5Lmove(fid1, "elink/elink/elink/group1", fid1,
- "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lmove(fid1, "elink/elink/elink/group1", fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open file 4 so we can do some fancy things */
- if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if(H5Lmove(fid1, "elink/elink/elink/type1", fid4,
- "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lmove(fid4, "dataset1", fid1,
- "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lmove(fid1, "elink/elink/elink/type1", fid4, "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lmove(fid4, "dataset1", fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file 4 again */
- if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid4) < 0)
+ FAIL_STACK_ERROR
/* Test copy (as of this test, it uses the same code as move) */
- if(H5Lcopy(fid1, "elink/elink/elink", fid1,
- "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcopy(fid1, "elink/elink/elink", fid1,
- "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcopy(fid1, "elink/elink/elink", fid1, "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcopy(fid1, "elink/elink/elink", fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Test H5Gset and get comment */
- if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(buf, "comment")) TEST_ERROR
+ if (H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(buf, "comment"))
+ TEST_ERROR
/* Test H5*open */
- if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Test H5*open2 */
- if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Test H5Oopen */
- if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Test H5Fmount */
- if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- H5E_BEGIN_TRY {
- if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR
- if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR
- } H5E_END_TRY
+ if ((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ if (H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ if (H5Funmount(fid1, "elink/elink/elink/mnt") >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
/* Test H5Rcreate */
- if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR
+ if (H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0)
+ TEST_ERROR
/* Test unlink */
- if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0)
+ TEST_ERROR
/* We've tested that the various functions above don't leave files open.
- * Now test that we can't confuse HDF5 by giving unusual paths with external links
- */
+ * Now test that we can't confuse HDF5 by giving unusual paths with external links
+ */
/* Create an external link that points to another external link */
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/elink", fid2, "elink2",
- H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename3, "/elink", fid2, "elink2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Do an external link traversal that recursively calls another external link. */
- if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create two more groups so that the last three elements in the path are
- * all within the same external file
- */
- if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ * all within the same external file
+ */
+ if ((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Add a few regular groups and a soft link in file2 using intermediate group creation */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
- if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink",
- lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", lcpl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Try to traverse this path. There are three soft traversals in a row;
* slink points to (file2)/elink2, which points to (file3)/elink, which
* points to file 4.
*/
- if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Lget_info2(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Some simpler tests */
- if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Lget_info2(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info2(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
-
+ if ((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(fid1, "elink/elink", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file1, the only file that should still be open */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Re-create each file. If they are hanging open, these creates will fail */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Cleanup */
- if(H5Sclose(sid) < 0) TEST_ERROR
- if(H5Tclose(tid2) < 0) TEST_ERROR
- if(H5Fclose(fid4) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid4) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid3) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Tclose(tid);
H5Dclose(did);
@@ -9955,11 +12085,11 @@ error:
H5Fclose(fid3);
H5Fclose(fid2);
H5Fclose(fid1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* external_link_closing() */
-
/*-------------------------------------------------------------------------
* Function: ext_link_endian
*
@@ -9974,63 +12104,78 @@ error:
static int
external_link_endian(hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t lapl_id = -1; /* Prop List ID */
- const char *pathbuf = H5_get_srcdir(); /* Path to the files */
- const char *namebuf;
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t lapl_id = -1; /* Prop List ID */
+ const char *pathbuf = H5_get_srcdir(); /* Path to the files */
+ const char *namebuf;
- if(new_format)
+ if (new_format)
TESTING("endianness of external links (w/new group format)")
else
TESTING("endianness of external links")
/* Create a link access property list with the path to the srcdir */
- if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
- if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR
+ if ((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ TEST_ERROR
+ if (H5Pset_elink_prefix(lapl_id, pathbuf) < 0)
+ TEST_ERROR
namebuf = H5_get_srcdir_filename(LE_FILENAME); /* Corrected test file name */
/* Test LE file; try to open a group through the external link */
- if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
- if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0)
+ TEST_ERROR
/* Open a group in the external file using that group ID */
- if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close the IDs */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
namebuf = H5_get_srcdir_filename(BE_FILENAME); /* Corrected test file name */
/* Test BE file; try to open a group through the external link */
- if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
- if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0)
+ TEST_ERROR
/* Open a group in the external file using that group ID */
- if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close the IDs */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: external_link_strong
*
@@ -10044,14 +12189,13 @@ error:
static int
external_link_strong(hid_t fapl, hbool_t new_format)
{
- hid_t my_fapl = (-1); /* File access property list */
- hid_t fid1 = (-1), fid2 = (-1); /* File ID */
- hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t my_fapl = (-1); /* File access property list */
+ hid_t fid1 = (-1), fid2 = (-1); /* File ID */
+ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("that external files work with strong file close degree (w/new group format)")
else
TESTING("that external files work with strong file close degree")
@@ -10061,57 +12205,82 @@ external_link_strong(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Copy file access property list */
- if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((my_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Set strong file close degree */
- if(H5Pset_fclose_degree(my_fapl, H5F_CLOSE_STRONG) < 0) TEST_ERROR
+ if (H5Pset_fclose_degree(my_fapl, H5F_CLOSE_STRONG) < 0)
+ TEST_ERROR
/* Create a group at /A/B/C in first file */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((gid1 = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid1) < 0) TEST_ERROR
- if((gid1 = H5Gcreate2(fid1, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid1) < 0) TEST_ERROR
- if((gid1 = H5Gcreate2(fid1, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid1) < 0) TEST_ERROR
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((gid1 = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
+ if ((gid1 = H5Gcreate2(fid1, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
+ if ((gid1 = H5Gcreate2(fid1, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Create an external link /W/X/DLINK in second file to <filename1>:/A/B/C */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid2 = H5Gcreate2(fid2, "/W", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if((gid2 = H5Gcreate2(fid2, "/W/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/A/B/C", gid2, "DLINK", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gcreate2(fid2, "/W", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gcreate2(fid2, "/W/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/A/B/C", gid2, "DLINK", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Access external link from file #1 */
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
- if((gid2 = H5Gopen2(fid2, "/W/X/DLINK", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gopen2(fid2, "/W/X/DLINK", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/A/B/C"))
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Close fapl */
- if(H5Pclose(my_fapl) < 0) TEST_ERROR
+ if (H5Pclose(my_fapl) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(my_fapl);
H5Gclose(fapl);
H5Gclose(gid2);
H5Gclose(gid1);
H5Fclose(fid2);
H5Fclose(fid1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end external_link_strong() */
-
/*-------------------------------------------------------------------------
* Function: external_symlink
*
@@ -10126,30 +12295,30 @@ static int
external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
#ifdef H5_HAVE_SYMLINK
- hid_t file1 = H5I_INVALID_HID;
- hid_t file2 = H5I_INVALID_HID;
- hid_t file3 = H5I_INVALID_HID;
- hid_t file4 = H5I_INVALID_HID;
- hid_t file5 = H5I_INVALID_HID;
- hid_t group2 = H5I_INVALID_HID;
- hid_t group3 = H5I_INVALID_HID;
- hid_t group4 = H5I_INVALID_HID;
- hid_t group5 = H5I_INVALID_HID;
- char *filename1 = NULL;
- char *filename2a = NULL;
- char *filename2b = NULL;
- char *filename3a = NULL;
- char *filename3b = NULL;
- char *filename4a = NULL;
- char *filename4b = NULL;
- char *filename5a = NULL;
- char *filename5b = NULL;
- char *tmpname = NULL;
- char *cwdpath = NULL;
- hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */
-#endif /* H5_HAVE_SYMLINK */
-
- if(new_format)
+ hid_t file1 = H5I_INVALID_HID;
+ hid_t file2 = H5I_INVALID_HID;
+ hid_t file3 = H5I_INVALID_HID;
+ hid_t file4 = H5I_INVALID_HID;
+ hid_t file5 = H5I_INVALID_HID;
+ hid_t group2 = H5I_INVALID_HID;
+ hid_t group3 = H5I_INVALID_HID;
+ hid_t group4 = H5I_INVALID_HID;
+ hid_t group5 = H5I_INVALID_HID;
+ char * filename1 = NULL;
+ char * filename2a = NULL;
+ char * filename2b = NULL;
+ char * filename3a = NULL;
+ char * filename3b = NULL;
+ char * filename4a = NULL;
+ char * filename4b = NULL;
+ char * filename5a = NULL;
+ char * filename5b = NULL;
+ char * tmpname = NULL;
+ char * cwdpath = NULL;
+ hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */
+#endif /* H5_HAVE_SYMLINK */
+
+ if (new_format)
TESTING("external links w/symlink files (w/new group format)")
else
TESTING("external links w/symlink files")
@@ -10158,47 +12327,46 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Skip test when using VFDs that can't provide a POSIX compatible file
* descriptor.
*/
- have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2")
- || !HDstrcmp(env_h5_drvr, "core")
- || !HDstrcmp(env_h5_drvr, "nomatch"));
- if(!have_posix_compat_vfd) {
+ have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2") || !HDstrcmp(env_h5_drvr, "core") ||
+ !HDstrcmp(env_h5_drvr, "nomatch"));
+ if (!have_posix_compat_vfd) {
SKIPPED();
HDputs(" Current VFD doesn't support POSIX I/O calls");
return SUCCEED;
}
- if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (filename2a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename2a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (filename2b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename2b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (filename3a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename3a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (filename3b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename3b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (filename4a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename4a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (filename4b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename4b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (filename5a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename5a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (filename5b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (filename5b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
- if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ if (NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
TEST_ERROR;
/* set up name for main file: "extlinks21A" */
h5_fixname(FILENAME[45], fapl, filename1, NAME_BUF_SIZE);
/* create tmp_links directory and get current working directory path */
- if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
+ if (HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
+ if (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* Set up names for files in the subdirectories */
@@ -10210,7 +12378,8 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */
/* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */
- if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR
+ if (HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST)
+ TEST_ERROR
/* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */
h5_fixname(FILENAME[47], fapl, filename3a, NAME_BUF_SIZE);
@@ -10223,103 +12392,138 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */
/* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */
- if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR
+ if (HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST)
+ TEST_ERROR
/* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */
h5_fixname(FILENAME[50], fapl, filename5a, NAME_BUF_SIZE);
h5_fixname(FILENAME[51], fapl, filename5b, NAME_BUF_SIZE);
/* Create file #1 in current directory */
- if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to file & object in temporary directory #2, using symlink #1 name */
- if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file #1 */
- if(H5Fclose(file1) < 0) TEST_ERROR
+ if (H5Fclose(file1) < 0)
+ TEST_ERROR
/* Create file #2 in tmp_links directory #2 */
- if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if(H5Fclose(file2) < 0) TEST_ERROR
+ if ((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if (H5Fclose(file2) < 0)
+ TEST_ERROR
/* Re-open file #2 in tmp_links directory through symlink */
- if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Create group in file #2 in temporary directory */
- if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create external link to file #3 & object in temporary directory #2 */
- if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close group in file #2 */
- if(H5Gclose(group2) < 0) TEST_ERROR
+ if (H5Gclose(group2) < 0)
+ TEST_ERROR
/* Close file #2 */
- if(H5Fclose(file2) < 0) TEST_ERROR
+ if (H5Fclose(file2) < 0)
+ TEST_ERROR
/* Create file #3 in temp. directory #2 */
- if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group in file #3 */
- if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create external link to file & object in temporary directory #1, using symlink #2 name */
- if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close group in file #3 */
- if(H5Gclose(group3) < 0) TEST_ERROR
+ if (H5Gclose(group3) < 0)
+ TEST_ERROR
/* Close file #3 */
- if(H5Fclose(file3) < 0) TEST_ERROR
+ if (H5Fclose(file3) < 0)
+ TEST_ERROR
/* Create file #4 in temporary directory #1 */
- if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group in file #4 in 'temporary' directory */
- if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create external link to file #5 & object in temporary directory #1 */
- if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close group in file #4 */
- if(H5Gclose(group4) < 0) TEST_ERROR
+ if (H5Gclose(group4) < 0)
+ TEST_ERROR
/* Close file #4 */
- if(H5Fclose(file4) < 0) TEST_ERROR
+ if (H5Fclose(file4) < 0)
+ TEST_ERROR
/* Create file #5 in temporary directory #1 */
- if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group in file #5 in 'temporary' directory #1 */
- if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group5) < 0) TEST_ERROR
+ if ((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group5) < 0)
+ TEST_ERROR
/* Close file #5 */
- if(H5Fclose(file5) < 0) TEST_ERROR
+ if (H5Fclose(file5) < 0)
+ TEST_ERROR
/* Actual tests... */
/* Reopen file #1 */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open group in file #2, through external link w/symlink */
- if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2) < 0) TEST_ERROR
+ if ((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2) < 0)
+ TEST_ERROR
/* Open group in file #3, through external link w/symlink to external link */
- if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3) < 0) TEST_ERROR
+ if ((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group3) < 0)
+ TEST_ERROR
/* Open group in file #4, through external link w/symlink to external link w/symlink */
- if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4) < 0) TEST_ERROR
+ if ((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group4) < 0)
+ TEST_ERROR
/* Open group in file #5, through external link w/symlink to external link w/symlink to external link */
- if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group5) < 0) TEST_ERROR
+ if ((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group5) < 0)
+ TEST_ERROR
/* Close file #1 */
- if(H5Fclose(file1) < 0) TEST_ERROR
+ if (H5Fclose(file1) < 0)
+ TEST_ERROR
HDfree(filename1);
HDfree(filename2a);
@@ -10338,7 +12542,8 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group5);
H5Gclose(group4);
H5Gclose(group3);
@@ -10348,7 +12553,8 @@ error:
H5Fclose(file3);
H5Fclose(file2);
H5Fclose(file1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(filename1);
HDfree(filename2a);
@@ -10364,7 +12570,7 @@ error:
return FAIL;
-#else /* H5_HAVE_SYMLINK */
+#else /* H5_HAVE_SYMLINK */
SKIPPED();
HDputs(" Current file system or operating system doesn't support symbolic links");
@@ -10372,7 +12578,6 @@ error:
#endif /* H5_HAVE_SYMLINK */
} /* end external_symlink() */
-
/*-------------------------------------------------------------------------
* Function: external_copy_invalid_object
*
@@ -10388,12 +12593,12 @@ error:
static int
external_copy_invalid_object(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t ocpyplid = -1; /* Object copy plist ID */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t ocpyplid = -1; /* Object copy plist ID */
+ char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("copying invalid external links to the source file (w/new group format)")
else
TESTING("copying invalid external links to the source file")
@@ -10402,46 +12607,58 @@ external_copy_invalid_object(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Create object copy plist, set expand external flag */
- if((ocpyplid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpyplid, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0) TEST_ERROR
+ if ((ocpyplid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpyplid, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0)
+ TEST_ERROR
/* Create file and group */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create an external link in the group to the source file with an invalid
* object name */
- if(H5Lcreate_external(filename, "no_object", fid, "/group1/link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "no_object", fid, "/group1/link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Copy the group containing the external link */
- if(H5Ocopy(fid, "group1", fid, "group2", ocpyplid, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid, "group1", fid, "group2", ocpyplid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Attempt to truncate the file again. If there is a lingering id for this
* file this will fail */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Close */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if(H5Pclose(ocpyplid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if (H5Pclose(ocpyplid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
H5Pclose(ocpyplid);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return FAIL;
} /* end external_copy_invalid_object */
-
/*-------------------------------------------------------------------------
* Function: external_dont_fail_to_source
*
@@ -10456,12 +12673,12 @@ error:
static int
external_dont_fail_to_source(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t oid = -1; /* Object ID */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t oid = -1; /* Object ID */
+ char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("that invalid external links don't open the source file (w/new group format)")
else
TESTING("that invalid external links don't open the source file")
@@ -10470,38 +12687,44 @@ external_dont_fail_to_source(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Create file and group */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create an external link with an invalid file name, but the same object
* name as the group. This way, if the external link is interpreted to
* refer to the source file, it will link to the group */
- if(H5Lcreate_external("no_file", "/group", fid, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external("no_file", "/group", fid, "link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Attempt to open the object the link points to. This should fail */
- H5E_BEGIN_TRY {
- oid = H5Oopen(fid, "link", H5P_DEFAULT);
- } H5E_END_TRY
- if(oid >= 0) FAIL_PUTS_ERROR("Succeeded in opening target of invalid external link")
+ H5E_BEGIN_TRY { oid = H5Oopen(fid, "link", H5P_DEFAULT); }
+ H5E_END_TRY
+ if (oid >= 0)
+ FAIL_PUTS_ERROR("Succeeded in opening target of invalid external link")
/* Close */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Oclose(oid);
H5Fclose(fid);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return FAIL;
} /* end external_dont_fail_to_source */
-
/*-------------------------------------------------------------------------
* Function: external_file_cache
*
@@ -10516,19 +12739,19 @@ error:
static int
external_file_cache(hid_t fapl, hbool_t new_format)
{
- hid_t my_fapl = -1; /* Temporary FAPL */
- hid_t fid1 = -1; /* File ID */
- hid_t fid2 = -1; /* File ID */
- hid_t fid3 = -1; /* File ID */
- hid_t fid4 = -1; /* File ID */
- hid_t oid = -1; /* Object ID */
- unsigned efc_size;
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
- char filename3[NAME_BUF_SIZE];
- char filename4[NAME_BUF_SIZE];
+ hid_t my_fapl = -1; /* Temporary FAPL */
+ hid_t fid1 = -1; /* File ID */
+ hid_t fid2 = -1; /* File ID */
+ hid_t fid3 = -1; /* File ID */
+ hid_t fid4 = -1; /* File ID */
+ hid_t oid = -1; /* Object ID */
+ unsigned efc_size;
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
+ char filename3[NAME_BUF_SIZE];
+ char filename4[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("external file cache with external links (w/new group format)")
else
TESTING("external file cache with external links")
@@ -10540,229 +12763,302 @@ external_file_cache(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4);
/* Verify that the default EFC size is 0 */
- if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) TEST_ERROR
- if(efc_size != 0)
+ if (H5Pget_elink_file_cache_size(fapl, &efc_size) < 0)
+ TEST_ERROR
+ if (efc_size != 0)
FAIL_PUTS_ERROR("default external file cache size is not 0")
/* Copy FAPL and enable external file caching */
- if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
- if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR
+ if ((my_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
+ if (H5Pset_elink_file_cache_size(my_fapl, 8) < 0)
+ TEST_ERROR
/* Verify that the external file cache size has been set */
- if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) TEST_ERROR
- if(efc_size != 8)
+ if (H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0)
+ TEST_ERROR
+ if (efc_size != 8)
FAIL_PUTS_ERROR("external file cache size different from expected")
/* Test 1: One file caches another */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close the target of the external link */
- if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oclose(oid) < 0) TEST_ERROR
+ if ((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
/* Verify that both files are now open */
H5F_sfile_assert_num(2);
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
/* Test 2: One file caches another, release parent's EFC */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close the target of the external link */
- if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oclose(oid) < 0) TEST_ERROR
+ if ((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
/* Verify that both files are now open */
H5F_sfile_assert_num(2);
/* Release file 1's EFC */
- if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR
+ if (H5Fclear_elink_file_cache(fid1) < 0)
+ TEST_ERROR
/* Verify that only the parent file is now open */
H5F_sfile_assert_num(1);
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
/* Test 3: "Y" shaped tree */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
/* Create links */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close files 2-4 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
- if(H5Fclose(fid4) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid3) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid4) < 0)
+ TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close one branch of the tree */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oclose(oid) < 0) TEST_ERROR
+ if ((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
/* Verify that files 2 and 3 are now open */
H5F_sfile_assert_num(3);
/* Open and close the other branch of the tree */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oclose(oid) < 0) TEST_ERROR
+ if ((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
/* Verify that all files are now open */
H5F_sfile_assert_num(4);
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that all files are now closed */
H5F_sfile_assert_num(0);
/* Test 4: "Y" shaped tree, release parent's EFC */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
/* Create links */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close files 2-4 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
- if(H5Fclose(fid4) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid3) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid4) < 0)
+ TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close one branch of the tree */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oclose(oid) < 0) TEST_ERROR
+ if ((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
/* Verify that files 2 and 3 are now open */
H5F_sfile_assert_num(3);
/* Open and close the other branch of the tree */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oclose(oid) < 0) TEST_ERROR
+ if ((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
/* Verify that all files are now open */
H5F_sfile_assert_num(4);
/* Release file 1's EFC */
- if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR
+ if (H5Fclear_elink_file_cache(fid1) < 0)
+ TEST_ERROR
/* Verify that only file 1 is now open */
H5F_sfile_assert_num(1);
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that all files are now closed */
H5F_sfile_assert_num(0);
/* Test 5: 3 file cycle */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
/* Create links */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close files 2-3 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid3) < 0)
+ TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close one complete cycle */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oclose(oid) < 0) TEST_ERROR
+ if ((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
/* Verify that all files are now open */
H5F_sfile_assert_num(3);
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that all files are now closed */
H5F_sfile_assert_num(0);
/* Test 6: 3 file cycle, release parent's EFC */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
/* Create links */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close files 2-3 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid3) < 0)
+ TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close one complete cycle */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oclose(oid) < 0) TEST_ERROR
+ if ((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
/* Verify that all files are now open */
H5F_sfile_assert_num(3);
/* Release file 1's EFC */
- if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR
+ if (H5Fclear_elink_file_cache(fid1) < 0)
+ TEST_ERROR
/* Verify that only file 1 is now open */
H5F_sfile_assert_num(1);
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that all files are now closed */
H5F_sfile_assert_num(0);
@@ -10774,19 +13070,20 @@ external_file_cache(hid_t fapl, hbool_t new_format)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Oclose(oid);
H5Fclose(fid1);
H5Fclose(fid2);
H5Fclose(fid3);
H5Fclose(fid4);
H5Pclose(my_fapl);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return FAIL;
} /* end external_file_cache */
-
/*-------------------------------------------------------------------------
* Function: external_open_twice
*
@@ -10800,16 +13097,16 @@ error:
static int
external_open_twice(hid_t fapl, hbool_t new_format)
{
- hid_t fid1 = -1; /* File ID */
- hid_t fid2 = -1; /* File ID */
- hid_t oid1 = -1; /* Object ID */
- hid_t oid2 = -1; /* Object ID */
- hid_t type = -1; /* Datatype ID */
- hid_t space = -1; /* Dataspace ID */
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid1 = -1; /* File ID */
+ hid_t fid2 = -1; /* File ID */
+ hid_t oid1 = -1; /* Object ID */
+ hid_t oid2 = -1; /* Object ID */
+ hid_t type = -1; /* Datatype ID */
+ hid_t space = -1; /* Dataspace ID */
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("opening object twice through elink (w/new group format)")
else
TESTING("opening object twice through elink")
@@ -10820,115 +13117,160 @@ external_open_twice(hid_t fapl, hbool_t new_format)
/* Test 1: Open root group twice */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Open the target of the external link twice */
- if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close both objects, in the reverse opening order (necessary to duplicate bug */
- if(H5Oclose(oid2) < 0) TEST_ERROR
- if(H5Oclose(oid1) < 0) TEST_ERROR
+ if (H5Oclose(oid2) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid1) < 0)
+ TEST_ERROR
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
/* Test 2: Open group twice */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create target group */
- if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(oid1) < 0) TEST_ERROR
+ if ((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(oid1) < 0)
+ TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Open the target of the external link twice */
- if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close both objects, in the reverse opening order (necessary to duplicate bug */
- if(H5Oclose(oid2) < 0) TEST_ERROR
- if(H5Oclose(oid1) < 0) TEST_ERROR
+ if (H5Oclose(oid2) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid1) < 0)
+ TEST_ERROR
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
/* Test 3: Open dataset twice */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create target dataset */
- if((space = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
- if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(oid1) < 0) TEST_ERROR
- if(H5Sclose(space) < 0) TEST_ERROR
+ if ((space = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR
+ if ((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(oid1) < 0)
+ TEST_ERROR
+ if (H5Sclose(space) < 0)
+ TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Open the target of the external link twice */
- if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close both objects, in the reverse opening order (necessary to duplicate bug */
- if(H5Oclose(oid2) < 0) TEST_ERROR
- if(H5Oclose(oid1) < 0) TEST_ERROR
+ if (H5Oclose(oid2) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid1) < 0)
+ TEST_ERROR
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
/* Test 4: Open datatype twice */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create target datatype */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(type) < 0) TEST_ERROR
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(type) < 0)
+ TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Open the target of the external link twice */
- if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close both objects, in the reverse opening order (necessary to duplicate bug */
- if(H5Oclose(oid2) < 0) TEST_ERROR
- if(H5Oclose(oid1) < 0) TEST_ERROR
+ if (H5Oclose(oid2) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid1) < 0)
+ TEST_ERROR
/* Close file 1 */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
@@ -10937,19 +13279,20 @@ external_open_twice(hid_t fapl, hbool_t new_format)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Oclose(oid1);
H5Oclose(oid2);
H5Tclose(type);
H5Fclose(fid1);
H5Fclose(fid2);
H5Sclose(space);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return FAIL;
} /* end external_open_twice() */
-
/*-------------------------------------------------------------------------
* Function: external_link_with_committed_datatype
*
@@ -10972,26 +13315,26 @@ error:
static int
external_link_with_committed_datatype(hid_t fapl, hbool_t new_format)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gid1 = -1, gid2 = -1; /* Group IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t sid2 = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t atid = -1; /* Attribute's datatype ID */
- hid_t did = -1; /* Dataset ID */
- hid_t dtid = -1; /* Dataset's datatype ID */
- hid_t dcpl = -1; /* Dataset creation property list */
- int wdata = 99; /* Attribute data written */
- int wbuf[60]; /* Data buffer for writing */
- int rbuf[60]; /* Data buffer for reading */
- int i; /* Local index variable */
- char filename1[NAME_BUF_SIZE]; /* File name for main file */
- char filename2[NAME_BUF_SIZE]; /* File name for target file */
- hsize_t dims[2] = {5, 12}; /* Dimension sizes */
- hsize_t chunks[2] = {3, 7}; /* Chunk sizes */
-
- if(new_format)
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gid1 = -1, gid2 = -1; /* Group IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t sid2 = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t atid = -1; /* Attribute's datatype ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t dtid = -1; /* Dataset's datatype ID */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ int wdata = 99; /* Attribute data written */
+ int wbuf[60]; /* Data buffer for writing */
+ int rbuf[60]; /* Data buffer for reading */
+ int i; /* Local index variable */
+ char filename1[NAME_BUF_SIZE]; /* File name for main file */
+ char filename2[NAME_BUF_SIZE]; /* File name for target file */
+ hsize_t dims[2] = {5, 12}; /* Dimension sizes */
+ hsize_t chunks[2] = {3, 7}; /* Chunk sizes */
+
+ if (new_format)
TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)")
else
TESTING("attach committed datatype to external group's attribute/dataset")
@@ -11001,159 +13344,210 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Main file */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create external link from main file to target file */
- if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create target file */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create group in target file */
- if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close the group */
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
/* Open the group which is externally linked to target file */
- if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a copy of integer datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
/* Commit the datatype to the main file root group */
- if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
/* Attach an attribute with the committed datatype to the group */
- if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write data to the attribute */
- if(H5Awrite(aid, tid, &wdata) < 0) FAIL_STACK_ERROR
+ if (H5Awrite(aid, tid, &wdata) < 0)
+ FAIL_STACK_ERROR
/* Get the attribute's datatype */
- if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR
+ if ((atid = H5Aget_type(aid)) < 0)
+ FAIL_STACK_ERROR
/* Verify the datatype is not committed */
- if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR
+ if (H5Tcommitted(atid) == TRUE)
+ FAIL_STACK_ERROR
/* Close the attribute */
- if(H5Aclose(aid) < 0) FAIL_STACK_ERROR
+ if (H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
/* Create a chunked dataset */
- if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) FAIL_STACK_ERROR
+ if ((sid2 = H5Screate_simple(2, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
if (dcpl_g == H5P_DEFAULT)
dcpl = H5Pcreate(H5P_DATASET_CREATE);
else
dcpl = H5Pcopy(dcpl_g);
- if (0 > dcpl) FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunks) < 0) FAIL_STACK_ERROR
+ if (0 > dcpl)
+ FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl, 2, chunks) < 0)
+ FAIL_STACK_ERROR
/* Initialize data buffers */
- for(i = 0; i < 60; i++) {
+ for (i = 0; i < 60; i++) {
wbuf[i] = i;
rbuf[i] = 0;
}
/* Create a dataset with the committed datatype in the group */
- if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write to the dataset */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ FAIL_STACK_ERROR
/* Get the dataset's datatype */
- if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR
+ if ((dtid = H5Dget_type(did)) < 0)
+ FAIL_STACK_ERROR
/* Verify the datatype is not committed */
- if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR
+ if (H5Tcommitted(dtid) == TRUE)
+ FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Close the dataset creation property list */
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
/* Close the dataspaces */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid2) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR
/* Close the datatypes */
- if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(atid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR
+ if (H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(atid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(dtid) < 0)
+ FAIL_STACK_ERROR
/* Close the group */
- if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid1) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
/* Open the mainfile */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open the committed datatype in the mainfile */
- if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify the datatype is committed */
- if(H5Tcommitted(tid) == FALSE) FAIL_STACK_ERROR
+ if (H5Tcommitted(tid) == FALSE)
+ FAIL_STACK_ERROR
/* Open the group which is externally linked to target file */
- if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Open the attribute attached to the group */
- if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the attribute's datatype */
- if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR
+ if ((atid = H5Aget_type(aid)) < 0)
+ FAIL_STACK_ERROR
/* Verify the attribute's datatype is not committed */
- if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR
+ if (H5Tcommitted(atid) == TRUE)
+ FAIL_STACK_ERROR
/* Close the attribute */
- if(H5Aclose(aid) < 0) FAIL_STACK_ERROR
+ if (H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
/* Delete the attribute */
- if(H5Adelete(gid1, "myAttribute") < 0) FAIL_STACK_ERROR
+ if (H5Adelete(gid1, "myAttribute") < 0)
+ FAIL_STACK_ERROR
/* Open the dataset in the group */
- if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the dataset's datatype */
- if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR
+ if ((dtid = H5Dget_type(did)) < 0)
+ FAIL_STACK_ERROR
/* Verify the dataset's datatype is not committed */
- if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR
+ if (H5Tcommitted(dtid) == TRUE)
+ FAIL_STACK_ERROR
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ FAIL_STACK_ERROR
/* Compare the data read should be the same as wbuf */
- if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) FAIL_STACK_ERROR
+ if (HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0)
+ FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Close the group */
- if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid1) < 0)
+ FAIL_STACK_ERROR
/* Close the datatypes */
- if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(atid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR
+ if (H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(atid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(dtid) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid2);
H5Fclose(fid1);
H5Gclose(gid1);
@@ -11170,12 +13564,12 @@ error:
H5Aclose(dtid);
H5Pclose(dcpl);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return FAIL;
} /* end external_link_with_committed_datatype() */
-
/*-------------------------------------------------------------------------
* Function: ud_hard_links
*
@@ -11189,14 +13583,14 @@ error:
/* Callback functions for UD hard links. */
/* UD_hard_create increments the object's reference count */
static herr_t
-UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata,
- size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id)
+UD_hard_create(const char H5_ATTR_UNUSED *link_name, hid_t loc_group, const void *udata, size_t udata_size,
+ hid_t H5_ATTR_UNUSED lcpl_id)
{
H5O_token_t token;
- hid_t target_obj = -1;
- herr_t ret_value = 0;
+ hid_t target_obj = -1;
+ herr_t ret_value = 0;
- if(udata_size != sizeof(H5O_token_t)) {
+ if (udata_size != sizeof(H5O_token_t)) {
ret_value = -1;
goto done;
} /* end if */
@@ -11205,33 +13599,33 @@ UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const voi
/* Open the object this link points to */
target_obj = H5Oopen_by_token(loc_group, token);
- if(target_obj < 0) {
+ if (target_obj < 0) {
ret_value = -1;
goto done;
} /* end if */
/* Increment the reference count of the target object */
- if(H5Oincr_refcount(target_obj) < 0) {
+ if (H5Oincr_refcount(target_obj) < 0) {
ret_value = -1;
goto done;
} /* end if */
done:
/* Close the target object if we opened it */
- if(target_obj >= 0) {
- switch(H5Iget_type(target_obj)) {
+ if (target_obj >= 0) {
+ switch (H5Iget_type(target_obj)) {
case H5I_GROUP:
- if(H5Gclose(target_obj) < 0)
+ if (H5Gclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATASET:
- if(H5Dclose(target_obj) < 0)
+ if (H5Dclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATATYPE:
- if(H5Tclose(target_obj) < 0)
+ if (H5Tclose(target_obj) < 0)
ret_value = -1;
break;
@@ -11253,23 +13647,22 @@ done:
case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
- return FAIL;
+ return FAIL;
} /* end switch */
- } /* end if */
+ } /* end if */
return ret_value;
} /* end UD_hard_create() */
/* Traverse a hard link by opening the object */
static hid_t
-UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id)
+UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *udata, size_t udata_size,
+ hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id)
{
H5O_token_t token;
- hid_t ret_value = -1;
+ hid_t ret_value = -1;
- if(udata_size != sizeof(H5O_token_t))
+ if (udata_size != sizeof(H5O_token_t))
return FAIL;
token = *(const H5O_token_t *)udata;
@@ -11282,14 +13675,13 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
/* UD_hard_delete decrements the object's reference count */
static herr_t
-UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata,
- size_t udata_size)
+UD_hard_delete(const char H5_ATTR_UNUSED *link_name, hid_t file, const void *udata, size_t udata_size)
{
H5O_token_t token;
- hid_t target_obj = -1;
- herr_t ret_value = 0;
+ hid_t target_obj = -1;
+ herr_t ret_value = 0;
- if(udata_size != sizeof(H5O_token_t)) {
+ if (udata_size != sizeof(H5O_token_t)) {
ret_value = -1;
goto done;
} /* end if */
@@ -11298,33 +13690,33 @@ UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *ud
/* Open the object this link points to */
target_obj = H5Oopen_by_token(file, token);
- if(target_obj < 0) {
+ if (target_obj < 0) {
ret_value = -1;
goto done;
} /* end if */
/* Decrement the reference count of the target object */
- if(H5Odecr_refcount(target_obj) < 0) {
+ if (H5Odecr_refcount(target_obj) < 0) {
ret_value = -1;
goto done;
} /* end if */
done:
/* Close the target object if we opened it */
- if(target_obj >= 0) {
- switch(H5Iget_type(target_obj)) {
+ if (target_obj >= 0) {
+ switch (H5Iget_type(target_obj)) {
case H5I_GROUP:
- if(H5Gclose(target_obj) < 0)
+ if (H5Gclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATASET:
- if(H5Dclose(target_obj) < 0)
+ if (H5Dclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATATYPE:
- if(H5Tclose(target_obj) < 0)
+ if (H5Tclose(target_obj) < 0)
ret_value = -1;
break;
@@ -11348,7 +13740,7 @@ done:
default:
return FAIL;
} /* end switch */
- } /* end if */
+ } /* end if */
return ret_value;
} /* end UD_hard_delete() */
@@ -11356,11 +13748,11 @@ done:
static int
ud_hard_links(hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5L_info2_t li; /* Link information */
- char objname[NAME_BUF_SIZE]; /* Object name */
- h5_stat_size_t empty_size; /* Size of an empty file */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info2_t li; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ h5_stat_size_t empty_size; /* Size of an empty file */
char filename[NAME_BUF_SIZE];
TESTING("user-defined hard link (w/new group format)")
@@ -11368,70 +13760,98 @@ ud_hard_links(hid_t fapl)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Get the size of the empty file for reference */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Check that external links are registered and UD hard links are not */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ TEST_ERROR
/* Register "user-defined hard links" with the library */
- if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_hard_class) < 0)
+ TEST_ERROR
/* Check that UD hard links are now registered */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ TEST_ERROR
/* Create a group for the UD hard link to point to */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Get address for the group to give to the hard link */
- if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create a user-defined "hard link" to the group using the address we got
* from H5Lget_info2 */
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), sizeof(H5O_token_t),
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close and re-open file to ensure that data is written to disk */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open group through UD link */
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/group"))
+ TEST_ERROR
/* Create object in group */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close groups*/
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Re-open group without using ud link to check that it was created properly */
- if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/group/new_group"))
+ TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Check that H5Lget_objinfo works on the hard link */
- if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* UD hard links have no query function, thus return a "link length" of 0 */
- if(li.u.val_size != 0) TEST_ERROR
- if(UD_HARD_TYPE != li.type) {
+ if (li.u.val_size != 0)
+ TEST_ERROR
+ if (UD_HARD_TYPE != li.type) {
H5_FAILED();
HDputs(" Unexpected link class - should have been a UD hard link");
goto error;
@@ -11439,40 +13859,49 @@ ud_hard_links(hid_t fapl)
/* Unlink the group pointed to by the UD link. It shouldn't be
* deleted because of the UD link. */
- if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/group", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Ensure we can open the group through the UD link */
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Unlink the group contained within it. */
- if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Now delete the UD link. This should cause the group to be
* deleted, too. */
- if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* The file should be empty again. */
- if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR
+ if (empty_size != h5_get_file_size(filename, fapl))
+ TEST_ERROR
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end ud_hard_links() */
-
/*-------------------------------------------------------------------------
* Function: UD_rereg_traverse
*
@@ -11487,13 +13916,13 @@ error:
* in the current group named REREG_TARGET_NAME
*/
static hid_t
-UD_rereg_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group,
- const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id)
+UD_rereg_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void H5_ATTR_UNUSED *udata,
+ size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, hid_t H5_ATTR_UNUSED dxpl_id)
{
hid_t ret_value;
- if((ret_value = H5Oopen(cur_group, REREG_TARGET_NAME, lapl_id)) < 0) TEST_ERROR
+ if ((ret_value = H5Oopen(cur_group, REREG_TARGET_NAME, lapl_id)) < 0)
+ TEST_ERROR
return ret_value;
@@ -11504,143 +13933,187 @@ error:
static int
ud_link_reregister(hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5L_info2_t li; /* Link information */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
- h5_stat_size_t empty_size; /* Size of an empty file */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info2_t li; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ h5_stat_size_t empty_size; /* Size of an empty file */
TESTING("registering a new class for existing UD links (w/new group format)")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Get the size of the empty file for reference */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Check that UD hard links are not registered */
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ TEST_ERROR
/* Register "user-defined hard links" with the library */
- if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_hard_class) < 0)
+ TEST_ERROR
/* Check that UD hard links are registered */
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ TEST_ERROR
/* Point a UD defined hard link to a group in the same way as the previous test */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token),
- sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), sizeof(H5O_token_t),
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Create a group named REREG_TARGET_NAME in the same group as the ud link */
- if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Now unregister UD hard links */
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ TEST_ERROR
/* Check that UD hard links are no longer registered */
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ TEST_ERROR
/* Verify that we can't traverse the ud link anymore */
- H5E_BEGIN_TRY {
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
/* Verify that we can't create any new links of this type */
- H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.token),
- sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), sizeof(H5O_token_t),
+ H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* Register a new kind of link with the same ID number */
- if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_rereg_class) < 0)
+ TEST_ERROR
/* Check that UD hard links are registered again */
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ TEST_ERROR
/* Open a group through the ud link (now a different class of link).
* It should be a different group
* than the UD hard link pointed to */
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/" REREG_TARGET_NAME))
+ TEST_ERROR
/* Create object in group */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close groups*/
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Re-open group without using ud link to check that it was created properly */
- if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/rereg_target/new_group"))
+ TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Unlink the group pointed to by the UD hard link. It shouldn't be
* deleted because the UD link incremented its reference count. */
- if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/group", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* What a mess! Re-register user-defined links to clean up the
* reference counts. We shouldn't actually need to unregister the
* other link type */
- if(H5Lregister(UD_hard_class) < 0) FAIL_STACK_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR
+ if (H5Lregister(UD_hard_class) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ FAIL_STACK_ERROR
/* Ensure we can open the group through the UD link (now that UD hard
* links have been registered) */
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Delete the UD hard link. This should cause the group to be
* deleted, too. */
- if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Unlink the other two groups so that we can make sure the file is empty */
- if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* The file should be empty again. */
- if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR
+ if (empty_size != h5_get_file_size(filename, fapl))
+ TEST_ERROR
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end ud_link_reregister() */
-
/*-------------------------------------------------------------------------
* Function: UD_cb_create
*
@@ -11654,17 +14127,23 @@ error:
/* Callback functions for UD "callback" links. */
/* Creation callback. Called during move as well. */
static herr_t
-UD_cb_create(const char * link_name, hid_t loc_group, const void *udata,
- size_t udata_size, hid_t lcpl_id)
+UD_cb_create(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size, hid_t lcpl_id)
{
- if(!link_name) TEST_ERROR
- if(loc_group < 0) TEST_ERROR
- if(udata_size > 0 && !udata) TEST_ERROR
- if(lcpl_id < 0) TEST_ERROR
+ if (!link_name)
+ TEST_ERROR
+ if (loc_group < 0)
+ TEST_ERROR
+ if (udata_size > 0 && !udata)
+ TEST_ERROR
+ if (lcpl_id < 0)
+ TEST_ERROR
- if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR
- if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
+ if (HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME))
+ TEST_ERROR
+ if (HDstrcmp((const char *)udata, UD_CB_TARGET))
+ TEST_ERROR
+ if (udata_size != UD_CB_TARGET_LEN)
+ TEST_ERROR
return SUCCEED;
@@ -11673,21 +14152,27 @@ error:
} /* end UD_cb_create() */
static hid_t
-UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata,
- size_t udata_size, hid_t lapl_id, hid_t H5_ATTR_UNUSED dxpl_id)
+UD_cb_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id)
{
const char *target = (const char *)udata;
- hid_t ret_value;
+ hid_t ret_value;
- if(!link_name) TEST_ERROR
- if(cur_group < 0) TEST_ERROR
- if(udata_size > 0 && !udata) TEST_ERROR
+ if (!link_name)
+ TEST_ERROR
+ if (cur_group < 0)
+ TEST_ERROR
+ if (udata_size > 0 && !udata)
+ TEST_ERROR
- if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR
- if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
+ if (HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME))
+ TEST_ERROR
+ if (HDstrcmp((const char *)udata, UD_CB_TARGET))
+ TEST_ERROR
+ if (udata_size != UD_CB_TARGET_LEN)
+ TEST_ERROR
- if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0)
+ if ((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0)
TEST_ERROR
return ret_value;
@@ -11698,16 +14183,21 @@ error:
/* Callback for when the link is moved or renamed */
static herr_t
-UD_cb_move(const char *new_name, hid_t new_loc, const void *udata,
- size_t udata_size)
+UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, size_t udata_size)
{
- if(!new_name) TEST_ERROR
- if(new_loc < 0) TEST_ERROR
- if(udata_size > 0 && !udata) TEST_ERROR
+ if (!new_name)
+ TEST_ERROR
+ if (new_loc < 0)
+ TEST_ERROR
+ if (udata_size > 0 && !udata)
+ TEST_ERROR
- if(HDstrcmp(new_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR
- if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
+ if (HDstrcmp(new_name, NEW_UD_CB_LINK_NAME))
+ TEST_ERROR
+ if (HDstrcmp((const char *)udata, UD_CB_TARGET))
+ TEST_ERROR
+ if (udata_size != UD_CB_TARGET_LEN)
+ TEST_ERROR
return SUCCEED;
@@ -11717,16 +14207,21 @@ error:
/* Callback for when the link is deleted. Also called during move */
static herr_t
-UD_cb_delete(const char *link_name, hid_t file, const void *udata,
- size_t udata_size)
+UD_cb_delete(const char *link_name, hid_t file, const void *udata, size_t udata_size)
{
- if(!link_name) TEST_ERROR
- if(file < 0) TEST_ERROR
- if(udata_size > 0 && !udata) TEST_ERROR
+ if (!link_name)
+ TEST_ERROR
+ if (file < 0)
+ TEST_ERROR
+ if (udata_size > 0 && !udata)
+ TEST_ERROR
- if(HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR
- if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
+ if (HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME))
+ TEST_ERROR
+ if (HDstrcmp((const char *)udata, UD_CB_TARGET))
+ TEST_ERROR
+ if (udata_size != UD_CB_TARGET_LEN)
+ TEST_ERROR
return SUCCEED;
@@ -11736,19 +14231,24 @@ error:
/* Callback for when the link is queried */
static ssize_t
-UD_cb_query(const char * link_name, const void *udata, size_t udata_size,
- void *buf, size_t buf_size)
+UD_cb_query(const char *link_name, const void *udata, size_t udata_size, void *buf, size_t buf_size)
{
- if(!link_name) TEST_ERROR
- if(udata_size > 0 && !udata) TEST_ERROR
+ if (!link_name)
+ TEST_ERROR
+ if (udata_size > 0 && !udata)
+ TEST_ERROR
- if(HDstrcmp(link_name, UD_CB_LINK_NAME)) TEST_ERROR
- if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
+ if (HDstrcmp(link_name, UD_CB_LINK_NAME))
+ TEST_ERROR
+ if (HDstrcmp((const char *)udata, UD_CB_TARGET))
+ TEST_ERROR
+ if (udata_size != UD_CB_TARGET_LEN)
+ TEST_ERROR
- if(buf) {
- if(buf_size < 16) TEST_ERROR
- HDstrcpy((char *)buf, "query succeeded");
+ if (buf) {
+ if (buf_size < 16)
+ TEST_ERROR
+ HDstrcpy((char *)buf, "query succeeded");
} /* end if */
/* There are 15 characters and a NULL in "query succeeded" */
@@ -11761,15 +14261,15 @@ error:
static int
ud_callbacks(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
hid_t lcpl = -1; /* Link Creation PL */
H5L_info2_t li; /* Link information */
char ud_target_name[] = UD_CB_TARGET; /* Link target name */
char filename[NAME_BUF_SIZE];
char query_buf[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("user-defined link callbacks (w/new group format)")
else
TESTING("user-defined link callbacks")
@@ -11777,40 +14277,57 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Check that registered link classes are, and unregistered ones aren't */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE)
+ TEST_ERROR
/* Hit two birds with one stone: register UD hard links from previous
* test to check that having two UD links registered at once presents
* no problems. */
- if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_hard_class) < 0)
+ TEST_ERROR
/* Register user-defined link class. This is the one we'll actually be using. */
- if(H5Lregister(UD_cb_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_cb_class) < 0)
+ TEST_ERROR
/* Check that registered link classes are, and unregistered ones aren't */
- if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
- if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR
+ if (H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE)
+ TEST_ERROR
+ if (H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE)
+ TEST_ERROR
/* Create a group for the UD link to point to */
- if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create a user-defined link to the group. These UD links behave like soft links. */
- if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Try opening group through UD link */
- if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Query the link to test its query callback */
- if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.u.val_size != 16) TEST_ERROR
+ if (H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.u.val_size != 16)
+ TEST_ERROR
if (UD_CB_TYPE != li.type) {
H5_FAILED();
HDputs(" Unexpected link class - should have been a UD hard link");
@@ -11818,68 +14335,96 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
}
/* Fill the query buffer */
- if(H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR
+ if (H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(query_buf, "query succeeded") != 0)
+ TEST_ERROR
/* Move the link */
- if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Re-open group to ensure that move worked */
- if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Remove UD link */
- if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Test that the callbacks don't work if the link class is not registered */
/* Create a new link. Just for fun, give it a non-default character
* encoding (to test that LAPLs work) */
- if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR
- if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR
+ if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN,
+ lcpl, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(lcpl) < 0)
+ FAIL_STACK_ERROR
/* Check its character encoding */
- if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(li.cset != H5T_CSET_UTF8) TEST_ERROR
+ if (H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (li.cset != H5T_CSET_UTF8)
+ TEST_ERROR
/* Unregister the link class so the library forgets what its callbacks do */
- if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR
+ if (H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0)
+ FAIL_STACK_ERROR
/* Now test that each of the callbacks fails */
- H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
- if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
- if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name,
+ (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ FAIL_STACK_ERROR
+ if (H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0)
+ FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0)
+ FAIL_STACK_ERROR
+ }
+ H5E_END_TRY
/* The query callback should NOT fail, but should be unable to give a linklen */
- if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(li.u.val_size != 0) TEST_ERROR
- if(li.type != UD_CB_TYPE) TEST_ERROR
+ if (H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (li.u.val_size != 0)
+ TEST_ERROR
+ if (li.type != UD_CB_TYPE)
+ TEST_ERROR
/* Unregister the UD hard links */
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Pclose (lcpl);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(lcpl);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end ud_callbacks() */
-
/*-------------------------------------------------------------------------
* Function: lapl_udata
*
@@ -11891,19 +14436,21 @@ error:
*-------------------------------------------------------------------------
*/
static hid_t
-UD_plist_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group,
- const void H5_ATTR_UNUSED *udata, size_t udata_size, hid_t lapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id)
+UD_plist_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void H5_ATTR_UNUSED *udata,
+ size_t udata_size, hid_t lapl_id, hid_t H5_ATTR_UNUSED dxpl_id)
{
- char target[NAME_BUF_SIZE];
+ char target[NAME_BUF_SIZE];
hid_t ret_value;
- if(udata_size != 0) TEST_ERROR
+ if (udata_size != 0)
+ TEST_ERROR
/* Get the name of the target from the property list. */
- if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR
+ if (H5Pget(lapl_id, DEST_PROP_NAME, target) < 0)
+ TEST_ERROR
- if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) TEST_ERROR
+ if ((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0)
+ TEST_ERROR
return ret_value;
@@ -11914,14 +14461,14 @@ error:
static int
lapl_udata(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t plist_id = -1; /* Property List ID */
- char group_a_name[NAME_BUF_SIZE];
- char group_b_name[NAME_BUF_SIZE];
- char filename[NAME_BUF_SIZE];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t plist_id = -1; /* Property List ID */
+ char group_a_name[NAME_BUF_SIZE];
+ char group_b_name[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
+
+ if (new_format)
TESTING("user data passed through lapl (w/new group format)")
else
TESTING("user data passed through lapl")
@@ -11929,80 +14476,110 @@ lapl_udata(hid_t fapl, hbool_t new_format)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Register UD link types from previous tests to check that having
* multiple types registered at once presents no problems. */
- if(H5Lregister(UD_cb_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_cb_class) < 0)
+ TEST_ERROR
/* Register the link class. We'll actually be using for this test. */
- if(H5Lregister(UD_plist_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_plist_class) < 0)
+ TEST_ERROR
/* Another link class from a previous test */
- if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_hard_class) < 0)
+ TEST_ERROR
/* Unregister the first link type registered to make sure this doesn't
* break anything. */
- if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) TEST_ERROR
+ if (H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0)
+ TEST_ERROR
/* Create two groups for the UD link to point to */
- if((gid = H5Gcreate2(fid, "group_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "group_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create a user-defined link to the group. These UD links have no udata. */
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
/* Create a non-default lapl with a new property pointing to group a*/
- if((plist_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
+ if ((plist_id = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ TEST_ERROR
HDstrcpy(group_a_name, "group_a");
- if(H5Pinsert2(plist_id, DEST_PROP_NAME, (size_t)NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if (H5Pinsert2(plist_id, DEST_PROP_NAME, (size_t)NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL,
+ NULL, NULL) < 0)
+ TEST_ERROR
/* Try opening group through UD link */
- if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR
- if((gid2 = H5Gcreate2(gid, "subgroup_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Oopen(fid, "ud_link", plist_id)) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "subgroup_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Verify that we can open the new group without using the ud link */
- if((gid2 = H5Gopen2(fid, "/group_a/subgroup_a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid, "/group_a/subgroup_a", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Now use the same ud link to access group_b */
strcpy(group_b_name, "group_b");
- if(H5Pset(plist_id, DEST_PROP_NAME, group_b_name) < 0) TEST_ERROR
+ if (H5Pset(plist_id, DEST_PROP_NAME, group_b_name) < 0)
+ TEST_ERROR
/* Create a subgroup */
- if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR
- if((gid2 = H5Gcreate2(gid, "subgroup_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Oopen(fid, "ud_link", plist_id)) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "subgroup_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Verify that we can open the new group without using the ud link */
- if((gid2 = H5Gopen2(fid, "/group_b/subgroup_b", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid, "/group_b/subgroup_b", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close property list */
- if(H5Pclose(plist_id) < 0) TEST_ERROR
+ if (H5Pclose(plist_id) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Pclose (plist_id);
- H5Gclose (gid);
- H5Gclose (gid2);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(plist_id);
+ H5Gclose(gid);
+ H5Gclose(gid2);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end lapl_udata() */
-
/*-------------------------------------------------------------------------
* Function: ud_link_errors
*
@@ -12014,26 +14591,28 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-UD_cbsucc_create(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED loc_group,
- const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id)
+UD_cbsucc_create(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED loc_group, const void *udata,
+ size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id)
{
/* Check to make sure that this "soft link" has a target */
- if(udata_size < 1 || !udata) return FAIL;
+ if (udata_size < 1 || !udata)
+ return FAIL;
return SUCCEED;
} /* end UD_cbsucc_create() */
static hid_t
-UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
- const void *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id)
+UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *udata,
+ size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, hid_t H5_ATTR_UNUSED dxpl_id)
{
const char *target = (const char *)udata;
- hid_t ret_value;
+ hid_t ret_value;
- if(!target) goto error;
+ if (!target)
+ goto error;
- if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) goto error;
+ if ((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0)
+ goto error;
return ret_value;
@@ -12044,7 +14623,7 @@ error:
/* Failure callback for when the link is moved or renamed */
static herr_t
UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc,
- const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
+ const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
{
/* This traversal function will always fail. */
return FAIL;
@@ -12053,7 +14632,7 @@ UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc
/* SuccessCallback for when the link is moved or renamed */
static herr_t
UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc,
- const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
+ const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
{
/* This traversal function will always succeed. */
return SUCCEED;
@@ -12062,7 +14641,7 @@ UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc
/* Callback for when the link is deleted. Also called during move */
static herr_t
UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file,
- const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
+ const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
{
/* This callback will always succeed */
return SUCCEED;
@@ -12071,7 +14650,7 @@ UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file
/* Callback for when the link is deleted. Also called during move */
static herr_t
UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file,
- const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
+ const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
{
/* This traversal function will always fail. */
/* Note: un-deletable links are in general a very bad idea! */
@@ -12081,7 +14660,7 @@ UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file
/* Callback for when the link is queried */
static ssize_t
UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED *udata,
- size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size)
+ size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size)
{
/* This traversal function will always fail. */
return FAIL;
@@ -12090,14 +14669,15 @@ UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED
/* Callback for when the link is queried */
static ssize_t
UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED *udata,
- size_t H5_ATTR_UNUSED udata_size, void *buf, size_t H5_ATTR_UNUSED buf_size)
+ size_t H5_ATTR_UNUSED udata_size, void *buf, size_t H5_ATTR_UNUSED buf_size)
{
/* This traversal function will return a buffer size,
* but will fail when a buffer is passed in ("writing to the buffer"
* fails
*/
- if(buf != NULL) return FAIL;
+ if (buf != NULL)
+ return FAIL;
return SUCCEED;
} /* end UD_cbfail_on_write_query() */
@@ -12105,14 +14685,14 @@ UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATT
/* Callback for when the link is queried */
static ssize_t
UD_cbsucc_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED *udata,
- size_t H5_ATTR_UNUSED udata_size, void *buf, size_t buf_size)
+ size_t H5_ATTR_UNUSED udata_size, void *buf, size_t buf_size)
{
/* This traversal function will return a buffer size,
* but will fail when a buffer is passed in ("writing to the buffer"
* fails
*/
- if(buf != NULL && buf_size >= 8)
+ if (buf != NULL && buf_size >= 8)
HDstrcpy((char *)buf, "succeed");
return 8;
@@ -12120,65 +14700,65 @@ UD_cbsucc_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED
/* This class is full of failing callbacks */
const H5L_class_t UD_cbfail_class1[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */
- "UD_cbfail_link1", /* Link class name for debugging */
- UD_cbsucc_create, /* Creation callback */
- UD_cbfail_move, /* Move/rename callback */
- UD_cbfail_move, /* Copy callback */
- UD_cbsucc_traverse, /* The actual traversal function */
- UD_cbfail_delete, /* Deletion callback */
- UD_cbfail_query /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */
+ "UD_cbfail_link1", /* Link class name for debugging */
+ UD_cbsucc_create, /* Creation callback */
+ UD_cbfail_move, /* Move/rename callback */
+ UD_cbfail_move, /* Copy callback */
+ UD_cbsucc_traverse, /* The actual traversal function */
+ UD_cbfail_delete, /* Deletion callback */
+ UD_cbfail_query /* Query callback */
}};
/* This class is has two failing callbacks, move and query */
const H5L_class_t UD_cbfail_class2[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */
- "UD_cbfail_link2", /* Link class name for debugging */
- UD_cbsucc_create, /* Creation callback */
- UD_cbfail_move, /* Move/rename callback */
- UD_cbsucc_move, /* Copy callback */
- UD_cbsucc_traverse, /* The actual traversal function */
- UD_cbsucc_delete, /* Deletion callback */
- UD_cbfail_on_write_query /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */
+ "UD_cbfail_link2", /* Link class name for debugging */
+ UD_cbsucc_create, /* Creation callback */
+ UD_cbfail_move, /* Move/rename callback */
+ UD_cbsucc_move, /* Copy callback */
+ UD_cbsucc_traverse, /* The actual traversal function */
+ UD_cbsucc_delete, /* Deletion callback */
+ UD_cbfail_on_write_query /* Query callback */
}};
/* All of these callbacks will succeed */
const H5L_class_t UD_cbfail_class3[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */
- "UD_cbfail_link3", /* Link class name for debugging */
- UD_cbsucc_create, /* Creation callback */
- UD_cbsucc_move, /* Move/rename callback */
- UD_cbsucc_move, /* Copy callback */
- UD_cbsucc_traverse, /* The actual traversal function */
- UD_cbsucc_delete, /* Deletion callback */
- UD_cbsucc_query /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */
+ "UD_cbfail_link3", /* Link class name for debugging */
+ UD_cbsucc_create, /* Creation callback */
+ UD_cbsucc_move, /* Move/rename callback */
+ UD_cbsucc_move, /* Copy callback */
+ UD_cbsucc_traverse, /* The actual traversal function */
+ UD_cbsucc_delete, /* Deletion callback */
+ UD_cbsucc_query /* Query callback */
}};
/* Link classes that are invalid for various reasons */
const H5L_class_t UD_error1_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
(H5L_type_t)UD_ERROR_TYPE, /* Link type id number */
- "UD_error_link", /* Link class name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- NULL, /* This class has no traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ "UD_error_link", /* Link class name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ NULL, /* This class has no traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
const H5L_class_t UD_error2_class[1] = {{
- UD_BAD_VERS, /* Invalid H5L_class_t version */
+ UD_BAD_VERS, /* Invalid H5L_class_t version */
(H5L_type_t)UD_ERROR_TYPE, /* Link type id number */
- "UD_error_link", /* Link class name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_cbsucc_traverse, /* Traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ "UD_error_link", /* Link class name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_cbsucc_traverse, /* Traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
const H5L_class_t UD_error3_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
@@ -12206,127 +14786,180 @@ const H5L_class_t UD_error4_class[1] = {{
static int
ud_link_errors(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
char group_name[NAME_BUF_SIZE];
char filename[NAME_BUF_SIZE];
char query_buf[NAME_BUF_SIZE];
- H5L_info2_t li; /* Link information */
+ H5L_info2_t li; /* Link information */
- if(new_format)
+ if (new_format)
TESTING("user-defined link error conditions (w/new group format)")
else
TESTING("user-defined link error conditions")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Try to register some invalid link classes */
- H5E_BEGIN_TRY {
- if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR
- if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR
- if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR
- if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lregister(UD_error1_class) >= 0)
+ TEST_ERROR
+ if (H5Lregister(UD_error2_class) >= 0)
+ TEST_ERROR
+ if (H5Lregister(UD_error3_class) >= 0)
+ TEST_ERROR
+ if (H5Lregister(UD_error4_class) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
/* Register the UD plist class. */
- if(H5Lregister(UD_plist_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_plist_class) < 0)
+ TEST_ERROR
/* Now register the first class we'll be using.
* It has the same ID as the plist class, and should replace it. */
- if(H5Lregister(UD_cbfail_class1) < 0) FAIL_STACK_ERROR
+ if (H5Lregister(UD_cbfail_class1) < 0)
+ FAIL_STACK_ERROR
/* Create a group for the UD link to point to */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Try to create internally defined links with H5Lcreate_ud */
- H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ if (H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
- /* Try to create a link with H5Lcreate_ud that has a NULL udata pointer, but a non-zero udata_size value */
- H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
- } H5E_END_TRY;
+ /* Try to create a link with H5Lcreate_ud that has a NULL udata pointer, but a non-zero udata_size value
+ */
+ H5E_BEGIN_TRY
+ {
+ if (H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Create a user-defined link to the group. */
strcpy(group_name, "/group");
- if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the group through the ud link */
- if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Now test that each of the callbacks will cause a failure if it returns -1 */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* The create callback will fail if we pass in no udata */
- if(H5Lcreate_ud(fid, "fail", (H5L_type_t)UD_CBFAIL_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
+ if (H5Lcreate_ud(fid, "fail", (H5L_type_t)UD_CBFAIL_TYPE, NULL, (size_t)0, H5P_DEFAULT,
+ H5P_DEFAULT) >= 0)
+ TEST_ERROR
/* The move and copy callbacks will fail */
- if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
- if(H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
+ if (H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ if (H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ TEST_ERROR
/* The traversal callback will fail if we remove its target */
- if(H5Ldelete(fid, "group", H5P_DEFAULT) < 0) TEST_ERROR
- if((gid = H5Gopen2(gid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR
+ if (H5Ldelete(fid, "group", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if ((gid = H5Gopen2(gid, "ud_link", H5P_DEFAULT)) >= 0)
+ TEST_ERROR
/* The deletion callback will always fail */
- if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR
+ if (H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0)
+ TEST_ERROR
/* The query callback will fail */
- if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR
- } H5E_END_TRY
+ if (H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
/* Now use a class with different callback functions */
- if(H5Lregister(UD_cbfail_class2) < 0) FAIL_STACK_ERROR
+ if (H5Lregister(UD_cbfail_class2) < 0)
+ FAIL_STACK_ERROR
/* Moving should still fail, but copying will succeed */
- H5E_BEGIN_TRY {
- if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
- } H5E_END_TRY
- if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ H5E_BEGIN_TRY
+ {
+ if (H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
+ if (H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* The query callback will succeed when we only want to get the size of the buffer... */
- if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(li.u.val_size != 0) TEST_ERROR
+ if (H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (li.u.val_size != 0)
+ TEST_ERROR
/* ...but fail when we try to write data to the buffer itself*/
- H5E_BEGIN_TRY {
- if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) >=0) TEST_ERROR
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ if (H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ }
+ H5E_END_TRY
/* Register a new class */
- if(H5Lregister(UD_cbfail_class3) < 0) FAIL_STACK_ERROR
+ if (H5Lregister(UD_cbfail_class3) < 0)
+ FAIL_STACK_ERROR
/* Now querying should succeed */
- if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(li.u.val_size != 8) TEST_ERROR
- if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR
+ if (H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (li.u.val_size != 8)
+ TEST_ERROR
+ if (H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(query_buf, "succeed") != 0)
+ TEST_ERROR
/* Moving and copying should both succeed */
- if(H5Lmove(fid, "copy_succ", H5L_SAME_LOC, "move_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcopy(fid, "ud_link", fid, "copy_succ2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(fid, "copy_succ", H5L_SAME_LOC, "move_succ", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcopy(fid, "ud_link", fid, "copy_succ2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Delete link (this callback should work now) */
- if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end ud_link_errors() */
-
/*-------------------------------------------------------------------------
* Function: lapl_nlinks
*
@@ -12340,17 +14973,17 @@ error:
static int
lapl_nlinks(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t plist = -1; /* lapl ID */
- hid_t tid = -1, sid = -1, did = -1; /* Other IDs */
- hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
- size_t nlinks; /* nlinks for H5Pset_nlinks */
- hsize_t dims[2];
-
- if(new_format)
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t plist = -1; /* lapl ID */
+ hid_t tid = -1, sid = -1, did = -1; /* Other IDs */
+ hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ size_t nlinks; /* nlinks for H5Pset_nlinks */
+ hsize_t dims[2];
+
+ if (new_format)
TESTING("adjusting nlinks with LAPL (w/new group format)")
else
TESTING("adjusting nlinks with LAPL")
@@ -12363,76 +14996,110 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group with short name in file (used as target for links) */
- if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create chain of soft links to existing object (limited) */
- if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Create LAPL with higher-than-usual nlinks value */
/* Create a non-default lapl with udata set to point to the first group */
- if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
+ if ((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ TEST_ERROR
nlinks = 20;
- if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
+ if (H5Pset_nlinks(plist, nlinks) < 0)
+ TEST_ERROR
/* Ensure that nlinks was set successfully */
nlinks = 0;
- if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR
- if(nlinks != 20) TEST_ERROR
+ if (H5Pget_nlinks(plist, &nlinks) < 0)
+ TEST_ERROR
+ if (nlinks != 20)
+ TEST_ERROR
/* Open object through what is normally too many soft links using
* new property list */
- if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR
+ if ((gid = H5Oopen(fid, "soft17", plist)) < 0)
+ TEST_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/soft17")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/soft17"))
+ TEST_ERROR
/* Create group using soft link */
- if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close groups */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Set nlinks to a smaller number */
nlinks = 4;
- if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
+ if (H5Pset_nlinks(plist, nlinks) < 0)
+ TEST_ERROR
/* Ensure that nlinks was set successfully */
nlinks = 0;
- if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR
- if(nlinks != 4) TEST_ERROR
+ if (H5Pget_nlinks(plist, &nlinks) < 0)
+ TEST_ERROR
+ if (nlinks != 4)
+ TEST_ERROR
/* Try opening through what is now too many soft links */
- H5E_BEGIN_TRY {
- gid = H5Oopen(fid, "soft5", plist);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Oopen(fid, "soft5", plist); }
+ H5E_END_TRY;
if (gid >= 0) {
H5_FAILED();
HDputs(" Should have failed for sequence of too many nested links.");
@@ -12440,106 +15107,149 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
}
/* Open object through lesser soft link */
- if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR
+ if ((gid = H5Oopen(fid, "soft4", plist)) < 0)
+ TEST_ERROR
/* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/soft4")) TEST_ERROR
+ if (H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/soft4"))
+ TEST_ERROR
/* Test other functions that should use a LAPL */
nlinks = 20;
- if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
+ if (H5Pset_nlinks(plist, nlinks) < 0)
+ TEST_ERROR
/* Try copying and moving when both src and dst contain many soft links
* using a non-default LAPL
*/
- if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR
- if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if (H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
+ if (H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
/* H5Olink */
- if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if (H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
/* H5Lcreate_hard and H5Lcreate_soft */
- if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR
- if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if (H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
/* H5Ldelete */
- if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR
+ if (H5Ldelete(fid, "soft17/soft_link", plist) < 0)
+ TEST_ERROR
/* H5Lget_val and H5Lget_info2 */
- if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR
- if(H5Lget_info2(fid, "soft17", NULL, plist) < 0) TEST_ERROR
+ if (H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(fid, "soft17", NULL, plist) < 0)
+ TEST_ERROR
/* H5Lcreate_external and H5Lcreate_ud */
- if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR
- if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR
- if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if (H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
+ if (H5Lregister(UD_rereg_class) < 0)
+ TEST_ERROR
+ if (H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0)
+ TEST_ERROR
/* Close plist */
- if(H5Pclose(plist) < 0) TEST_ERROR
+ if (H5Pclose(plist) < 0)
+ TEST_ERROR
/* Create a datatype and dataset as targets inside the group */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
dims[0] = 2;
dims[1] = 2;
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
- if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Try to open the objects using too many symlinks with default *APLs */
- H5E_BEGIN_TRY {
- if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0)
+ H5E_BEGIN_TRY
+ {
+ if ((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0)
FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
- if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0)
+ if ((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0)
FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
- if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0)
+ if ((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0)
FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* Create property lists with nlinks set */
- if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR
- if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR
+ if ((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0)
+ TEST_ERROR
+ if ((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0)
+ TEST_ERROR
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ TEST_ERROR
nlinks = 20;
- if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR
- if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR
- if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR
+ if (H5Pset_nlinks(gapl, nlinks) < 0)
+ TEST_ERROR
+ if (H5Pset_nlinks(tapl, nlinks) < 0)
+ TEST_ERROR
+ if (H5Pset_nlinks(dapl, nlinks) < 0)
+ TEST_ERROR
/* We should now be able to use these property lists to open each kind
* of object.
*/
- if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR
- if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR
- if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR
+ if ((gid = H5Gopen2(fid, "soft17", gapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0)
+ TEST_ERROR
+ if ((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0)
+ TEST_ERROR
/* Close objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close plists */
- if(H5Pclose(gapl) < 0) TEST_ERROR
- if(H5Pclose(tapl) < 0) TEST_ERROR
- if(H5Pclose(dapl) < 0) TEST_ERROR
+ if (H5Pclose(gapl) < 0)
+ TEST_ERROR
+ if (H5Pclose(tapl) < 0)
+ TEST_ERROR
+ if (H5Pclose(dapl) < 0)
+ TEST_ERROR
/* Unregister UD hard link class */
- if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR
+ if (H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gapl);
H5Pclose(dapl);
H5Pclose(tapl);
@@ -12550,11 +15260,11 @@ error:
H5Gclose(gid);
H5Pclose(plist);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end lapl_nlinks() */
-
/*-------------------------------------------------------------------------
* Function: linkinfo
*
@@ -12567,14 +15277,14 @@ error:
static int
linkinfo(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t tid = -1; /* Type ID */
- hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */
- H5L_info2_t li; /* Link information */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t tid = -1; /* Type ID */
+ hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */
+ H5L_info2_t li; /* Link information */
char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
TESTING("link type field in H5Lget_info (w/new group format)")
else
TESTING("link type field in H5Lget_info")
@@ -12582,62 +15292,91 @@ linkinfo(hid_t fapl, hbool_t new_format)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Register a couple of user-defined link classes with the library */
- if(H5Lregister(UD_plist_class) < 0) TEST_ERROR
+ if (H5Lregister(UD_plist_class) < 0)
+ TEST_ERROR
/* Create an object of each type */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
- if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close all objects */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Make sure that link type is correct when objects are queried */
- if(H5Lget_info2(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_HARD) TEST_ERROR
- if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_HARD) TEST_ERROR
- if(H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_HARD) TEST_ERROR
-
- if(H5Lget_info2(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR
- if(H5Lget_info2(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != H5L_TYPE_SOFT) TEST_ERROR
- if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(li.type != UD_PLIST_TYPE) TEST_ERROR
+ if (H5Lget_info2(fid, "datatype", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_HARD)
+ TEST_ERROR
+ if (H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_HARD)
+ TEST_ERROR
+ if (H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_HARD)
+ TEST_ERROR
+
+ if (H5Lget_info2(fid, "ext_link", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_EXTERNAL)
+ TEST_ERROR
+ if (H5Lget_info2(fid, "softlink", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != H5L_TYPE_SOFT)
+ TEST_ERROR
+ if (H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (li.type != UD_PLIST_TYPE)
+ TEST_ERROR
/* Ensure that passing a NULL pointer doesn't cause an error */
- if(H5Lget_info2(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info2(fid, "group", NULL, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Tclose (tid);
- H5Dclose (did);
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(tid);
+ H5Dclose(did);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return FAIL;
} /* end linkinfo() */
-
/*-------------------------------------------------------------------------
* Function: check_all_closed
*
@@ -12655,11 +15394,11 @@ error:
static int
check_all_closed(hid_t fapl, hbool_t new_format, int stopat)
{
- hid_t fid=-1;
- char filename[NAME_BUF_SIZE];
- int x;
+ hid_t fid = -1;
+ char filename[NAME_BUF_SIZE];
+ int x;
- if(new_format)
+ if (new_format)
TESTING("that all files were closed correctly (w/new group format)")
else
TESTING("that all files were closed correctly")
@@ -12669,20 +15408,21 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat)
* To check this, try to create every file used in this test. If
* a file is already open, creating it will fail.
*/
- for(x=0; FILENAME[x] != NULL && x < stopat; x++) {
+ for (x = 0; FILENAME[x] != NULL && x < stopat; x++) {
h5_fixname(FILENAME[x], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
}
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_END_TRY;
return FAIL;
} /* end check_all_closed() */
@@ -12698,88 +15438,120 @@ error:
static hid_t
build_visit_file(hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t tid = -1; /* Datatype ID */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t tid = -1; /* Datatype ID */
+ char filename[NAME_BUF_SIZE];
const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */
h5_fixname(FILENAME[9], fapl, filename, sizeof filename);
/* Create file for visiting */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group */
- if((gid = H5Gcreate2(fid, "/Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "/Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create nested group */
- if((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close groups */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create soft links to groups created */
- if(H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create dangling soft link */
- if(H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create hard links to all groups */
- if(H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "/Group1/Group2", fid, "hard_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "/Group1/Group2", fid, "hard_two", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create loops w/hard links */
- if(H5Lcreate_hard(fid, "/Group1", fid, "/Group1/hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(fid, "/Group1", fid, "/Group1/hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create external link to existing file */
- if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create dangling external link to non-existent file */
- if(H5Lcreate_external("foo.h5", "/group", fid, "/ext_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external("foo.h5", "/group", fid, "/ext_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Create dataset in each group */
- if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR
- if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
- if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
- if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* Create named datatype in each group */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(fid, "/Type_zero", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(fid, "/Type_zero", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(fid, "/Group1/Type_one", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(fid, "/Group1/Type_one", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tcommit2(fid, "/Group1/Group2/Type_two", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tcommit2(fid, "/Group1/Group2/Type_two", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
- return(fid);
+ return (fid);
error:
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_END_TRY;
return FAIL;
} /* end build_visit_file() */
-
/*-------------------------------------------------------------------------
* Function: visit_link_cb
*
@@ -12795,16 +15567,17 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info2_t
lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data;
/* Check for correct link information */
- if(HDstrcmp(op_data->info[op_data->idx].path, name)) return(H5_ITER_ERROR);
- if(op_data->info[op_data->idx].type != linfo->type) return(H5_ITER_ERROR);
+ if (HDstrcmp(op_data->info[op_data->idx].path, name))
+ return (H5_ITER_ERROR);
+ if (op_data->info[op_data->idx].type != linfo->type)
+ return (H5_ITER_ERROR);
/* Advance to next location in expected output */
op_data->idx++;
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
} /* end visit_link_cb() */
-
/*-------------------------------------------------------------------------
* Function: link_visit
*
@@ -12817,58 +15590,71 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info2_t
static int
link_visit(hid_t fapl, hbool_t new_format)
{
- lvisit_ud_t udata; /* User-data for visiting */
- hid_t fid = -1;
- hid_t gid = -1; /* Group ID */
+ lvisit_ud_t udata; /* User-data for visiting */
+ hid_t fid = -1;
+ hid_t gid = -1; /* Group ID */
- if(new_format)
+ if (new_format)
TESTING("link visiting (w/new group format)")
else
TESTING("link visiting")
/* Construct "interesting" file to visit */
- if((fid = build_visit_file(fapl)) < 0) TEST_ERROR
+ if ((fid = build_visit_file(fapl)) < 0)
+ TEST_ERROR
/* Visit all the links reachable from the root group (with file ID) */
- udata.idx = 0;
+ udata.idx = 0;
udata.info = lvisit0;
- if(H5Lvisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0)
+ FAIL_STACK_ERROR
/* Visit all the links reachable from the root group (with group ID) */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = lvisit0;
- if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Visit all the links reachable from each internal group */
- if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = lvisit1;
- if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = lvisit2;
- if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file created */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end link_visit() */
-
/*-------------------------------------------------------------------------
* Function: link_visit_by_name
*
@@ -12881,66 +15667,82 @@ error:
static int
link_visit_by_name(hid_t fapl, hbool_t new_format)
{
- lvisit_ud_t udata; /* User-data for visiting */
- hid_t fid = -1;
- hid_t gid = -1; /* Group ID */
+ lvisit_ud_t udata; /* User-data for visiting */
+ hid_t fid = -1;
+ hid_t gid = -1; /* Group ID */
- if(new_format)
+ if (new_format)
TESTING("link visiting by name (w/new group format)")
else
TESTING("link visiting by name")
/* Construct "interesting" file to visit */
- if((fid = build_visit_file(fapl)) < 0) TEST_ERROR
+ if ((fid = build_visit_file(fapl)) < 0)
+ TEST_ERROR
/* Visit all the links reachable from the root group (with file ID) */
- udata.idx = 0;
+ udata.idx = 0;
udata.info = lvisit0;
- if(H5Lvisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Visit all the links reachable from the root group (with group ID) */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = lvisit0;
- if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Visit all the links reachable from each internal group */
- udata.idx = 0;
+ udata.idx = 0;
udata.info = lvisit1;
- if(H5Lvisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = lvisit1;
- if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
- udata.idx = 0;
+ udata.idx = 0;
udata.info = lvisit2;
- if(H5Lvisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = lvisit2;
- if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file created */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end link_visit_by_name() */
-
/*-------------------------------------------------------------------------
* Function: visit_obj_cb
*
@@ -12956,16 +15758,17 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info2_t
ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data;
/* Check for correct object information */
- if(HDstrcmp(op_data->info[op_data->idx].path, name)) return(H5_ITER_ERROR);
- if(op_data->info[op_data->idx].type != oinfo->type) return(H5_ITER_ERROR);
+ if (HDstrcmp(op_data->info[op_data->idx].path, name))
+ return (H5_ITER_ERROR);
+ if (op_data->info[op_data->idx].type != oinfo->type)
+ return (H5_ITER_ERROR);
/* Advance to next location in expected output */
op_data->idx++;
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
} /* end visit_obj_cb() */
-
/*-------------------------------------------------------------------------
* Function: obj_visit
*
@@ -12978,58 +15781,71 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info2_t
static int
obj_visit(hid_t fapl, hbool_t new_format)
{
- ovisit_ud_t udata; /* User-data for visiting */
- hid_t fid = -1;
- hid_t gid = -1; /* Group ID */
+ ovisit_ud_t udata; /* User-data for visiting */
+ hid_t fid = -1;
+ hid_t gid = -1; /* Group ID */
- if(new_format)
+ if (new_format)
TESTING("object visiting (w/new group format)")
else
TESTING("object visiting")
/* Construct "interesting" file to visit */
- if((fid = build_visit_file(fapl)) < 0) TEST_ERROR
+ if ((fid = build_visit_file(fapl)) < 0)
+ TEST_ERROR
/* Visit all the objects reachable from the root group (with file ID) */
- udata.idx = 0;
+ udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
- if(H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0)
+ FAIL_STACK_ERROR
/* Visit all the objects reachable from the root group (with group ID) */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
- if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Visit all the objects reachable from each internal group */
- if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = new_format ? ovisit1_new : ovisit1_old;
- if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = new_format ? ovisit2_new : ovisit2_old;
- if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file created */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end obj_visit() */
-
/*-------------------------------------------------------------------------
* Function: obj_visit_by_name
*
@@ -13042,66 +15858,87 @@ error:
static int
obj_visit_by_name(hid_t fapl, hbool_t new_format)
{
- ovisit_ud_t udata; /* User-data for visiting */
- hid_t fid = -1;
- hid_t gid = -1; /* Group ID */
+ ovisit_ud_t udata; /* User-data for visiting */
+ hid_t fid = -1;
+ hid_t gid = -1; /* Group ID */
- if(new_format)
+ if (new_format)
TESTING("object visiting by name (w/new group format)")
else
TESTING("object visiting by name")
/* Construct "interesting" file to visit */
- if((fid = build_visit_file(fapl)) < 0) TEST_ERROR
+ if ((fid = build_visit_file(fapl)) < 0)
+ TEST_ERROR
/* Visit all the objects reachable from the root group (with file ID) */
- udata.idx = 0;
+ udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
- if(H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Visit all the objects reachable from the root group (with group ID) */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
- if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Visit all the objects reachable from each internal group */
- udata.idx = 0;
+ udata.idx = 0;
udata.info = new_format ? ovisit1_new : ovisit1_old;
- if(H5Ovisit_by_name3(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit_by_name3(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = new_format ? ovisit1_new : ovisit1_old;
- if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
- udata.idx = 0;
+ udata.idx = 0;
udata.info = new_format ? ovisit2_new : ovisit2_old;
- if(H5Ovisit_by_name3(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit_by_name3(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata,
+ H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- udata.idx = 0;
+ if ((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ udata.idx = 0;
udata.info = new_format ? ovisit2_new : ovisit2_old;
- if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file created */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end obj_visit_by_name() */
-
/*-------------------------------------------------------------------------
* Function: visit_obj_stop_cb
*
@@ -13111,17 +15948,17 @@ error:
*-------------------------------------------------------------------------
*/
static int
-visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info2_t H5_ATTR_UNUSED *oinfo, void *_op_data)
+visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name,
+ const H5O_info2_t H5_ATTR_UNUSED *oinfo, void *_op_data)
{
unsigned *op_data = (unsigned *)_op_data;
/* Increment the number of visited objects */
(*op_data)++;
- return(H5_ITER_STOP);
+ return (H5_ITER_STOP);
} /* end visit_obj_stop_cb() */
-
/*-------------------------------------------------------------------------
* Function: obj_visit_stop
*
@@ -13135,48 +15972,53 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name
static int
obj_visit_stop(hid_t fapl, hbool_t new_format)
{
- unsigned nvisited; /* User-data for visiting */
- hid_t fid = -1;
- herr_t ret; /* Return value */
+ unsigned nvisited; /* User-data for visiting */
+ hid_t fid = -1;
+ herr_t ret; /* Return value */
- if(new_format)
+ if (new_format)
TESTING("stopping object iteration (w/new group format)")
else
TESTING("stopping object iteration")
/* Construct "interesting" file to visit */
- if((fid = build_visit_file(fapl)) < 0) TEST_ERROR
+ if ((fid = build_visit_file(fapl)) < 0)
+ TEST_ERROR
/* Start iteration. The callback should only be called once because it
* returns H5_ITER_STOP
*/
nvisited = 0;
- if((ret = H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0)
+ if ((ret = H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0)
FAIL_STACK_ERROR
- if(ret != H5_ITER_STOP) TEST_ERROR
- if(nvisited != 1) TEST_ERROR
+ if (ret != H5_ITER_STOP)
+ TEST_ERROR
+ if (nvisited != 1)
+ TEST_ERROR
/* Same test with H5Ovisit_by_name */
nvisited = 0;
- if((ret = H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb,
- &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(ret != H5_ITER_STOP) TEST_ERROR
- if(nvisited != 1) TEST_ERROR
+ if ((ret = H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited,
+ H5O_INFO_BASIC, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (ret != H5_ITER_STOP)
+ TEST_ERROR
+ if (nvisited != 1)
+ TEST_ERROR
/* Close file created */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_END_TRY;
return FAIL;
} /* end obj_visit_stop() */
-
/*-------------------------------------------------------------------------
* Function: link_filters
*
@@ -13195,46 +16037,58 @@ static enum {
LFS_DECODED
} link_filter_state;
-static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id)
+static htri_t
+link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
- if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1;
+ if (dcpl_id >= 0 || type_id >= 0 || space_id >= 0)
+ return -1;
- if(link_filter_state >= LFS_ENCODED) return 1;
+ if (link_filter_state >= LFS_ENCODED)
+ return 1;
- if(link_filter_state != LFS_INIT) return -1;
+ if (link_filter_state != LFS_INIT)
+ return -1;
link_filter_state = LFS_CAN_APPLY_CALLED;
return 1;
} /* end link_fitler_can_apply */
-static herr_t link_filter_set_local(hid_t dcpl_id, hid_t type_id, hid_t space_id)
+static herr_t
+link_filter_set_local(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
- if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1;
+ if (dcpl_id >= 0 || type_id >= 0 || space_id >= 0)
+ return -1;
- if(link_filter_state >= LFS_ENCODED) return 0;
+ if (link_filter_state >= LFS_ENCODED)
+ return 0;
- if(link_filter_state != LFS_CAN_APPLY_CALLED) return -1;
+ if (link_filter_state != LFS_CAN_APPLY_CALLED)
+ return -1;
link_filter_state = LFS_SET_LOCAL_CALLED;
return 0;
} /* end link_filter_set_local */
-static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts,
- const unsigned int cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
- void H5_ATTR_UNUSED **buf)
+static size_t
+link_filter_filter(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes,
+ size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
{
- if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) return 0;
+ if (flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112)
+ return 0;
- if(link_filter_state == LFS_DECODED) return nbytes;
+ if (link_filter_state == LFS_DECODED)
+ return nbytes;
- if(flags & H5Z_FLAG_REVERSE) {
- if(link_filter_state != LFS_ENCODED) return 0;
+ if (flags & H5Z_FLAG_REVERSE) {
+ if (link_filter_state != LFS_ENCODED)
+ return 0;
link_filter_state = LFS_DECODED;
}
else {
- if(link_filter_state < LFS_SET_LOCAL_CALLED) return 0;
+ if (link_filter_state < LFS_SET_LOCAL_CALLED)
+ return 0;
link_filter_state = LFS_ENCODED;
} /* end else */
@@ -13244,25 +16098,25 @@ static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts,
static int
link_filters(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1, fcpl = -1;
- hid_t gid1 = -1, gid2 = -1, gcpl1 = -1, gcpl2 = -1;
- hid_t lcpl = -1;
- size_t cd_nelmts = 1;
- unsigned cd_value = 2112;
- unsigned cd_value_out;
- unsigned flags_out;
- unsigned filter_config_out;
- int nfilters = 0;
+ hid_t fid = -1, fcpl = -1;
+ hid_t gid1 = -1, gid2 = -1, gcpl1 = -1, gcpl2 = -1;
+ hid_t lcpl = -1;
+ size_t cd_nelmts = 1;
+ unsigned cd_value = 2112;
+ unsigned cd_value_out;
+ unsigned flags_out;
+ unsigned filter_config_out;
+ int nfilters = 0;
H5Z_class2_t filter_class;
- char name_out[24];
- char filename[NAME_BUF_SIZE];
- htri_t tri_ret;
- herr_t status;
+ char name_out[24];
+ char filename[NAME_BUF_SIZE];
+ htri_t tri_ret;
+ herr_t status;
/* This test actually always uses the new group format for the main group.
* The new format flag affects the version of object header messages,
* etc., which are important for this test. */
- if(new_format)
+ if (new_format)
TESTING("group link filters (w/new group format)")
else
TESTING("group link filters")
@@ -13273,242 +16127,361 @@ link_filters(hid_t fapl, hbool_t new_format)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create gcpl, force use of dense storage */
- if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
- if(H5Pset_link_phase_change(gcpl1, 2, 2) < 0) TEST_ERROR
+ if ((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_link_phase_change(gcpl1, 2, 2) < 0)
+ TEST_ERROR
/* Add deflate and checksum filters, if available */
- if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR
- if(tri_ret) {
- if(H5Pset_deflate(gcpl1, 6) < 0) TEST_ERROR
+ if ((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0)
+ TEST_ERROR
+ if (tri_ret) {
+ if (H5Pset_deflate(gcpl1, 6) < 0)
+ TEST_ERROR
nfilters++;
} /* end if */
- if((tri_ret = H5Zfilter_avail(H5Z_FILTER_FLETCHER32)) < 0) TEST_ERROR
- if(tri_ret) {
- if(H5Pset_fletcher32(gcpl1) < 0) TEST_ERROR
+ if ((tri_ret = H5Zfilter_avail(H5Z_FILTER_FLETCHER32)) < 0)
+ TEST_ERROR
+ if (tri_ret) {
+ if (H5Pset_fletcher32(gcpl1) < 0)
+ TEST_ERROR
nfilters++;
} /* end if */
/* Register and add custom filter */
- filter_class.version = H5Z_CLASS_T_VERS;
- filter_class.id = H5Z_FILTER_RESERVED + 42;
+ filter_class.version = H5Z_CLASS_T_VERS;
+ filter_class.id = H5Z_FILTER_RESERVED + 42;
filter_class.encoder_present = TRUE;
filter_class.decoder_present = TRUE;
- filter_class.name = "custom_link_filter";
- filter_class.can_apply = link_filter_can_apply;
- filter_class.set_local = link_filter_set_local;
- filter_class.filter = link_filter_filter;
- if(H5Zregister(&filter_class) < 0) TEST_ERROR
- if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR
+ filter_class.name = "custom_link_filter";
+ filter_class.can_apply = link_filter_can_apply;
+ filter_class.set_local = link_filter_set_local;
+ filter_class.filter = link_filter_filter;
+ if (H5Zregister(&filter_class) < 0)
+ TEST_ERROR
+ if (H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0)
+ TEST_ERROR
nfilters++;
/* Test various other filter functions for use on gcpl's */
- if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR
- if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR
+ if (H5Pget_nfilters(gcpl1) != nfilters)
+ TEST_ERROR
+ if (H5Pall_filters_avail(gcpl1) != TRUE)
+ TEST_ERROR
/* Create a group using this filter, add some soft links to it */
- if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file and group */
- if(H5Gclose(gid1) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Verify the filter has been applied */
- if(link_filter_state != LFS_ENCODED) TEST_ERROR
+ if (link_filter_state != LFS_ENCODED)
+ TEST_ERROR
/* Reopen file and group */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if ((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve gcpl, verify number of filters */
- if((gcpl2 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR
- if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR
- if(H5Pclose(gcpl2) < 0) TEST_ERROR
+ if ((gcpl2 = H5Gget_create_plist(gid1)) < 0)
+ TEST_ERROR
+ if (H5Pget_nfilters(gcpl2) != nfilters)
+ TEST_ERROR
+ if (H5Pclose(gcpl2) < 0)
+ TEST_ERROR
/* Now try copying gcpl1, and verify number of filters */
- if((gcpl2 = H5Pcopy(gcpl1)) < 0) TEST_ERROR
- if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR
- if(H5Pclose(gcpl2) < 0) TEST_ERROR
+ if ((gcpl2 = H5Pcopy(gcpl1)) < 0)
+ TEST_ERROR
+ if (H5Pget_nfilters(gcpl2) != nfilters)
+ TEST_ERROR
+ if (H5Pclose(gcpl2) < 0)
+ TEST_ERROR
/* Add another soft link */
- if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Copy the group */
- if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR
+ if (H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Verify that all links have been copied */
- if(H5Lexists(gid2, "link1", H5P_DEFAULT) != TRUE) TEST_ERROR
- if(H5Lexists(gid2, "link2", H5P_DEFAULT) != TRUE) TEST_ERROR
- if(H5Lexists(gid2, "link3", H5P_DEFAULT) != TRUE) TEST_ERROR
- if(H5Lexists(gid2, "link4", H5P_DEFAULT) != TRUE) TEST_ERROR
+ if (H5Lexists(gid2, "link1", H5P_DEFAULT) != TRUE)
+ TEST_ERROR
+ if (H5Lexists(gid2, "link2", H5P_DEFAULT) != TRUE)
+ TEST_ERROR
+ if (H5Lexists(gid2, "link3", H5P_DEFAULT) != TRUE)
+ TEST_ERROR
+ if (H5Lexists(gid2, "link4", H5P_DEFAULT) != TRUE)
+ TEST_ERROR
/* Retrieve gcpl, verify number of filters */
- if((gcpl2 = H5Gget_create_plist(gid2)) < 0) TEST_ERROR
- if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR
+ if ((gcpl2 = H5Gget_create_plist(gid2)) < 0)
+ TEST_ERROR
+ if (H5Pget_nfilters(gcpl2) != nfilters)
+ TEST_ERROR
/* Delete 3 links to force the group back into compact mode */
- if(H5Ldelete(gid1, "link2", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(gid1, "link3", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(gid1, "link4", H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(gid1, "link2", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(gid1, "link3", H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ldelete(gid1, "link4", H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file and groups */
- if(H5Gclose(gid1) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Reset link filter state */
link_filter_state = LFS_INIT;
/* Reopen file and group, add 2 links */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+ if ((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close file and group */
- if(H5Gclose(gid1) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Verify that the filter was reapplied */
- if(link_filter_state != LFS_ENCODED) TEST_ERROR
+ if (link_filter_state != LFS_ENCODED)
+ TEST_ERROR
/* Test H5Pget_filter_by_id2 and H5Pget_filter2 */
- if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out,
- &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR
- if(flags_out != 0 || cd_value_out != cd_value
- || HDstrcmp(filter_class.name, name_out)
- || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
- | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR
- if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts,
- &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR
- if(flags_out != 0 || cd_value_out != cd_value
- || HDstrcmp(filter_class.name, name_out)
- || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
- | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR
+ if (H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, &cd_nelmts, &cd_value_out,
+ (size_t)24, name_out, &filter_config_out) < 0)
+ TEST_ERROR
+ if (flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) ||
+ filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED))
+ TEST_ERROR
+ if (H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts, &cd_value_out, (size_t)24,
+ name_out, &filter_config_out) < 0)
+ TEST_ERROR
+ if (flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) ||
+ filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED))
+ TEST_ERROR
/* Test H5Pmodify_filter */
cd_value++;
- if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR
- if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out,
- &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR
- if(flags_out != 0 || cd_value_out != cd_value
- || HDstrcmp(filter_class.name, name_out)
- || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
- | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR
+ if (H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0)
+ TEST_ERROR
+ if (H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, &cd_nelmts, &cd_value_out,
+ (size_t)24, name_out, &filter_config_out) < 0)
+ TEST_ERROR
+ if (flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) ||
+ filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED))
+ TEST_ERROR
/* Test H5Premove_filter */
- if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR
- H5E_BEGIN_TRY {
- status = H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42,
- &flags_out, &cd_nelmts, &cd_value_out, (size_t)24, name_out,
- &filter_config_out);
- } H5E_END_TRY
- if(status >= 0) TEST_ERROR
+ if (H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ status = H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, &cd_nelmts, &cd_value_out,
+ (size_t)24, name_out, &filter_config_out);
+ }
+ H5E_END_TRY
+ if (status >= 0)
+ TEST_ERROR
/* Close remaining ids */
- if(H5Pclose(gcpl1) < 0) TEST_ERROR
- if(H5Pclose(gcpl2) < 0) TEST_ERROR
+ if (H5Pclose(gcpl1) < 0)
+ TEST_ERROR
+ if (H5Pclose(gcpl2) < 0)
+ TEST_ERROR
/* Now create an object in the compressed group, creating intermediate
* groups, to verify that the filter pipeline is inherited for the groups
* that are created along the way */
/* Reopen file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Create lcpl, setting the "create intermediate groups" flag */
- if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR
+ if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0)
+ TEST_ERROR
/* Create new group, with missing intermediate groups, in compressed group */
- if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close LCPL ID */
- if(H5Pclose(lcpl) < 0) TEST_ERROR
+ if (H5Pclose(lcpl) < 0)
+ TEST_ERROR
/* Verify that new group doesn't have filters */
- if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR
- if(H5Pget_nfilters(gcpl1) != 0) TEST_ERROR
+ if ((gcpl1 = H5Gget_create_plist(gid1)) < 0)
+ TEST_ERROR
+ if (H5Pget_nfilters(gcpl1) != 0)
+ TEST_ERROR
/* Close group & GCPL IDs */
- if(H5Pclose(gcpl1) < 0) TEST_ERROR
- if(H5Gclose(gid1) < 0) TEST_ERROR
+ if (H5Pclose(gcpl1) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
/* Open intermediate groups that were created and verify that they have filters */
- if((gid1 = H5Gopen2(fid, "group1/group2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR
- if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR
- if(H5Pclose(gcpl1) < 0) TEST_ERROR
- if(H5Gclose(gid1) < 0) TEST_ERROR
- if((gid1 = H5Gopen2(fid, "group1/group2/group3", H5P_DEFAULT)) < 0) TEST_ERROR
- if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR
- if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR
- if(H5Pclose(gcpl1) < 0) TEST_ERROR
- if(H5Gclose(gid1) < 0) TEST_ERROR
+ if ((gid1 = H5Gopen2(fid, "group1/group2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((gcpl1 = H5Gget_create_plist(gid1)) < 0)
+ TEST_ERROR
+ if (H5Pget_nfilters(gcpl1) != nfilters)
+ TEST_ERROR
+ if (H5Pclose(gcpl1) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
+ if ((gid1 = H5Gopen2(fid, "group1/group2/group3", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((gcpl1 = H5Gget_create_plist(gid1)) < 0)
+ TEST_ERROR
+ if (H5Pget_nfilters(gcpl1) != nfilters)
+ TEST_ERROR
+ if (H5Pclose(gcpl1) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Now create the same file with and without deflate, and verify that the
* file size is smaller with deflate */
/* But only if the deflate filter is available */
- if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR
- if(tri_ret) {
+ if ((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0)
+ TEST_ERROR
+ if (tri_ret) {
h5_stat_size_t filesize_filtered;
h5_stat_size_t filesize_unfiltered;
/* Create gcpl, force use of dense storage */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
- if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_link_phase_change(fcpl, 2, 2) < 0)
+ TEST_ERROR
/* Create file */
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR
/* Create links in file */
- if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("/", fid,
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft(
+ "/", fid,
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("/", fid,
+ "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
+ "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
+ "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
+ "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
+ "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Close file, get file size */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
filesize_unfiltered = h5_get_file_size(filename, fapl);
/* Set deflate fitler */
- if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR
+ if (H5Pset_deflate(fcpl, 6) < 0)
+ TEST_ERROR
/* Recreate the same file with the deflate filter */
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
- if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft("/", fid,
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft(
+ "/", fid,
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("/", fid,
+ "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
+ "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
+ "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
+ "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
+ "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Close file, get file size */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
filesize_filtered = h5_get_file_size(filename, fapl);
/* Check that the file size is smaller with the filter */
- if((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) TEST_ERROR
+ if ((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION))
+ TEST_ERROR
/* Close */
- if(H5Pclose(fcpl) < 0) TEST_ERROR
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR
} /* end if */
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid1);
H5Gclose(gid2);
H5Fclose(fid);
@@ -13516,11 +16489,11 @@ error:
H5Pclose(gcpl1);
H5Pclose(gcpl2);
H5Pclose(fcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end link_filters() */
-
/*-------------------------------------------------------------------------
* Function: obj_exists
*
@@ -13533,12 +16506,12 @@ error:
static int
obj_exists(hid_t fapl, hbool_t new_format)
{
- char filename[NAME_BUF_SIZE]; /* Buffer for file name */
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- herr_t status; /* Generic return value */
+ char filename[NAME_BUF_SIZE]; /* Buffer for file name */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ herr_t status; /* Generic return value */
- if(new_format)
+ if (new_format)
TESTING("object exists (w/new group format)")
else
TESTING("object exists")
@@ -13546,227 +16519,304 @@ obj_exists(hid_t fapl, hbool_t new_format)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
-/* Hard links */
+ /* Hard links */
/* Verify that H5Oexists_by_name() fails for non-existent link in root group */
- H5E_BEGIN_TRY {
- status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT);
- } H5E_END_TRY
- if(status >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT); }
+ H5E_END_TRY
+ if (status >= 0)
+ TEST_ERROR
/* Create a group, as a destination for testing */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() succeeds for hard linked object */
- if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT))
+ TEST_ERROR
/* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */
- H5E_BEGIN_TRY {
- status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT);
- } H5E_END_TRY
- if(status >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); }
+ H5E_END_TRY
+ if (status >= 0)
+ TEST_ERROR
-/* Soft links */
+ /* Soft links */
/* Create dangling soft-link in root group */
- if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */
- if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT))
+ TEST_ERROR
/* Create soft-link in root group that points to object */
- if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */
- if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT))
+ TEST_ERROR
/* Create dangling soft-link in non-root group */
- if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */
- if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT))
+ TEST_ERROR
/* Create soft-link in non-root group that points to object */
- if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */
- if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT))
+ TEST_ERROR
-/* External links */
+ /* External links */
/* Create dangling (file doesn't exist) external link in root group */
- if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */
- if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) TEST_ERROR
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root
+ * group */
+ if (FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT))
+ TEST_ERROR
/* Create dangling (object doesn't exist) external link in root group */
- if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */
- if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) TEST_ERROR
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root
+ * group */
+ if (FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT))
+ TEST_ERROR
/* Create external link in root group that points to object */
- if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */
- if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT))
+ TEST_ERROR
/* Create dangling (file doesn't exist) external link in non-root group */
- if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */
- if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) TEST_ERROR
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in
+ * non-root group */
+ if (FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT))
+ TEST_ERROR
/* Create dangling (object doesn't exist) external link in non-root group */
- if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */
- if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) TEST_ERROR
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in
+ * non-root group */
+ if (FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT))
+ TEST_ERROR
/* Create external link in non-root group that points to object */
- if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */
- if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) TEST_ERROR
+ /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object
+ */
+ if (TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT))
+ TEST_ERROR
-/* Soft->External links */
+ /* Soft->External links */
/* Create soft-link in root group that points to dangling (file doesn't exist) external link */
- if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT))
+ TEST_ERROR
/* Create soft-link in root group that points to dangling (object doesn't exist) external link */
- if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT))
+ TEST_ERROR
/* Create soft-link in root group that points to external link that points to object */
- if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT))
+ TEST_ERROR
- /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */
- if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root
+ * group */
+ if (H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT))
+ TEST_ERROR
- /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */
- if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root
+ * group */
+ if (H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT))
+ TEST_ERROR
/* Create soft-link in root group that points to external link in non-root group that points to object */
- if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT))
+ TEST_ERROR
/* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */
- if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT))
+ TEST_ERROR
/* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */
- if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT))
+ TEST_ERROR
/* Create soft-link in non-root group that points to external link that points to object */
- if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT))
+ TEST_ERROR
- /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */
- if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in
+ * non-root group */
+ if (H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT))
+ TEST_ERROR
- /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */
- if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in
+ * non-root group */
+ if (H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT))
+ TEST_ERROR
- /* Create soft-link in non-root group that points to external link in non-root group that points to object */
- if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ /* Create soft-link in non-root group that points to external link in non-root group that points to object
+ */
+ if (H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT))
+ TEST_ERROR
-/* External->Soft links */
+ /* External->Soft links */
/* Create external link in root group that points to dangling soft link in root group */
- if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT))
+ TEST_ERROR
/* Create external link in root group that points to soft link in root group that points to object */
- if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT))
+ TEST_ERROR
/* Create external link in root group that points to dangling soft link in non-root group */
- if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT))
+ TEST_ERROR
/* Create external link in root group that points to soft link in root group that points to object */
- if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT))
+ TEST_ERROR
/* Create external link in non-root group that points to dangling soft link in root group */
- if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT))
+ TEST_ERROR
/* Create external link in non-root group that points to soft link in root group that points to object */
- if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT))
+ TEST_ERROR
/* Create external link in non-root group that points to dangling soft link in non-root group */
- if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) TEST_ERROR
+ if (FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT))
+ TEST_ERROR
- /* Create external link in non-root group that points to soft link in non-root group that points to object */
- if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Create external link in non-root group that points to soft link in non-root group that points to object
+ */
+ if (H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) TEST_ERROR
+ if (TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT))
+ TEST_ERROR
/* Close file created */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end obj_exists() */
-
/*-------------------------------------------------------------------------
* Function: corder_create_empty
*
@@ -13779,96 +16829,120 @@ error:
static int
corder_create_empty(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- unsigned crt_order_flags; /* Status of creation order info for GCPL */
- herr_t ret; /* Generic return value */
- char filename[NAME_BUF_SIZE];/* File name */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned crt_order_flags; /* Status of creation order info for GCPL */
+ herr_t ret; /* Generic return value */
+ char filename[NAME_BUF_SIZE]; /* File name */
TESTING("creating empty group with creation order indexing")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set creation order indexing on group */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR
- if(crt_order_flags != 0) TEST_ERROR
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0)
+ TEST_ERROR
+ if (crt_order_flags != 0)
+ TEST_ERROR
/* Setting invalid combination of a group order creation order indexing on should fail */
- H5E_BEGIN_TRY {
- ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED);
- } H5E_END_TRY;
- if(ret > 0) {
+ H5E_BEGIN_TRY { ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); }
+ H5E_END_TRY;
+ if (ret > 0) {
H5_FAILED();
- HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking.");
+ HDputs(
+ " H5Pset_link_create_order() should have failed for a creation order index with no tracking.");
TEST_ERROR
} /* end if */
/* Set creation order tracking & indexing on group */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR
- if(crt_order_flags != 0) TEST_ERROR
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR
- if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0)
+ TEST_ERROR
+ if (crt_order_flags != 0)
+ TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0)
+ TEST_ERROR
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0)
+ TEST_ERROR
+ if (crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))
+ TEST_ERROR
/* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on group's status */
- if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(group_id) != TRUE)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open group created */
- if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check on group's status */
- if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve group creation property list for group */
- if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Gget_create_plist(group_id)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR
- if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0)
+ TEST_ERROR
+ if (crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end corder_create_empty() */
-
/*-------------------------------------------------------------------------
* Function: corder_create_compact
*
@@ -13882,106 +16956,135 @@ error:
static int
corder_create_compact(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned nlinks; /* Number of link messages in group's header */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- unsigned u; /* Local index variable */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned nlinks; /* Number of link messages in group's header */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ unsigned u; /* Local index variable */
TESTING("creating compact group with creation order indexing")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0)
+ TEST_ERROR
/* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on group's initial status */
- if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__is_empty_test(group_id) != TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Create several links, but keep group in compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
- if(nlinks != (u + 1)) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, &nlinks) != TRUE)
+ TEST_ERROR
+ if (nlinks != (u + 1))
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
} /* end for */
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open group created */
- if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
- if(nlinks != max_compact) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, &nlinks) != TRUE)
+ TEST_ERROR
+ if (nlinks != max_compact)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Loop through links, checking their creation order values */
/* (the name index is used, but the creation order value is in the same order) */
- for(u = 0; u < max_compact; u++) {
- H5L_info2_t linfo; /* Link information */
+ for (u = 0; u < max_compact; u++) {
+ H5L_info2_t linfo; /* Link information */
/* Retrieve information for link */
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify creation order of link */
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != u) TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != u)
+ TEST_ERROR
} /* end for */
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end corder_create_compact() */
-
/*-------------------------------------------------------------------------
* Function: corder_create_dense
*
@@ -13995,121 +17098,156 @@ error:
static int
corder_create_dense(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned nlinks; /* Number of link messages in group's header */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- unsigned u; /* Local index variable */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned nlinks; /* Number of link messages in group's header */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ unsigned u; /* Local index variable */
TESTING("creating dense group with creation order indexing")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0)
+ TEST_ERROR
/* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on group's initial status */
- if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__is_empty_test(group_id) != TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
- if(nlinks != (u + 1)) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, &nlinks) != TRUE)
+ TEST_ERROR
+ if (nlinks != (u + 1))
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
} /* end for */
/* Create another link, to push group into dense form */
HDsnprintf(objname, sizeof(objname), "filler %u", max_compact);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve & verify # of records in the name & creation order indices */
- if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
- if(name_count != corder_count) TEST_ERROR
+ if (H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0)
+ TEST_ERROR
+ if (name_count != corder_count)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open group created */
- if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Loop through links, checking their creation order values */
/* (the name index is used, but the creation order value is in the same order) */
- for(u = 0; u < (max_compact + 1); u++) {
- H5L_info2_t linfo; /* Link information */
+ for (u = 0; u < (max_compact + 1); u++) {
+ H5L_info2_t linfo; /* Link information */
/* Retrieve information for link */
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify creation order of link */
- if(linfo.corder_valid != TRUE) TEST_ERROR
- if(linfo.corder != u) TEST_ERROR
+ if (linfo.corder_valid != TRUE)
+ TEST_ERROR
+ if (linfo.corder != u)
+ TEST_ERROR
} /* end for */
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end corder_create_dense() */
-
/*-------------------------------------------------------------------------
* Function: corder_transition
*
@@ -14123,216 +17261,289 @@ error:
static int
corder_transition(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned nlinks; /* Number of link messages in group's header */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- h5_stat_size_t empty_size; /* Size of empty file */
- h5_stat_size_t file_size; /* Size of file after operating on it */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- unsigned u; /* Local index variable */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned nlinks; /* Number of link messages in group's header */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ h5_stat_size_t empty_size; /* Size of empty file */
+ h5_stat_size_t file_size; /* Size of file after operating on it */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ unsigned u; /* Local index variable */
TESTING("transitioning group with creation order indexing between dense & compact forms")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ FAIL_STACK_ERROR
/* Increase estimated link info, so the group's object header is large
* enough to hold all the link messages in one chunk
*/
- if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR
+ if (H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0)
+ TEST_ERROR
/* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ FAIL_STACK_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file with an empty group */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open group created */
- if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Create another link, to push group into dense form */
HDsnprintf(objname, sizeof(objname), "filler %u", max_compact);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve & verify # of records in the name & creation order indices */
- if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
- if(name_count != corder_count) TEST_ERROR
+ if (H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0)
+ TEST_ERROR
+ if (name_count != corder_count)
+ TEST_ERROR
/* Delete several links from group, until it resumes compact form */
- for(u = max_compact; u >= min_dense; u--) {
+ for (u = max_compact; u >= min_dense; u--) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(group_id, objname, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve & verify # of records in the name & creation order indices */
- if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
- if(name_count != corder_count) TEST_ERROR
+ if (H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0)
+ TEST_ERROR
+ if (name_count != corder_count)
+ TEST_ERROR
} /* end for */
/* Delete another link, to push group into compact form */
HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1));
- if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(group_id, objname, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
- if(nlinks != (min_dense - 1)) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, &nlinks) != TRUE)
+ TEST_ERROR
+ if (nlinks != (min_dense - 1))
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Re-add links to get back into dense form */
- for(u = (min_dense - 1); u < (max_compact + 1); u++) {
+ for (u = (min_dense - 1); u < (max_compact + 1); u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve & verify # of records in the name & creation order indices */
- if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
- if(name_count != corder_count) TEST_ERROR
+ if (H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0)
+ TEST_ERROR
+ if (name_count != corder_count)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* Open group created */
- if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve & verify # of records in the name & creation order indices */
- if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
- if(name_count != corder_count) TEST_ERROR
+ if (H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0)
+ TEST_ERROR
+ if (name_count != corder_count)
+ TEST_ERROR
/* Delete several links from group, until it resumes compact form */
- for(u = max_compact; u >= min_dense; u--) {
+ for (u = max_compact; u >= min_dense; u--) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(group_id, objname, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve & verify # of records in the name & creation order indices */
- if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
- if(name_count != corder_count) TEST_ERROR
+ if (H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0)
+ TEST_ERROR
+ if (name_count != corder_count)
+ TEST_ERROR
} /* end for */
/* Delete another link, to push group into compact form */
HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1));
- if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(group_id, objname, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
- if(nlinks != (min_dense - 1)) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, &nlinks) != TRUE)
+ TEST_ERROR
+ if (nlinks != (min_dense - 1))
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Re-add links to get back into dense form */
- for(u = (min_dense - 1); u < (max_compact + 1); u++) {
+ for (u = (min_dense - 1); u < (max_compact + 1); u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve & verify # of records in the name & creation order indices */
- if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
- if(name_count != corder_count) TEST_ERROR
+ if (H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0)
+ TEST_ERROR
+ if (name_count != corder_count)
+ TEST_ERROR
/* Delete all the links */
- for(u = max_compact; u > 0; u--) {
+ for (u = max_compact; u > 0; u--) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(group_id, objname, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end for */
HDsnprintf(objname, sizeof(objname), "filler %u", (unsigned)0);
- if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(group_id, objname, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
/* Get the size of the file now */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
- if(file_size != empty_size) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end corder_transition() */
-
/*-------------------------------------------------------------------------
* Function: corder_delete
*
@@ -14347,117 +17558,143 @@ error:
static int
corder_delete(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- unsigned reopen_file; /* Whether to re-open the file before deleting group */
- h5_stat_size_t empty_size; /* Size of empty file */
- h5_stat_size_t file_size; /* Size of file after operating on it */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- unsigned u; /* Local index variable */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ unsigned reopen_file; /* Whether to re-open the file before deleting group */
+ h5_stat_size_t empty_size; /* Size of empty file */
+ h5_stat_size_t file_size; /* Size of file after operating on it */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ unsigned u; /* Local index variable */
TESTING("deleting group with creation order indexing in dense form")
/* Loop to leave file open when deleting group, or to close & re-open file
* before deleting group */
- for(reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) {
+ for (reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) {
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- /* Creating file with latest format will enable paged aggregation with persistent fs */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ /* Creating file with latest format will enable paged aggregation with persistent fs */
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Get the size of an empty file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ FAIL_STACK_ERROR
/* Increase estimated link info, so the group's object header is large
* enough to hold all the link messages in one chunk
*/
- if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR
+ if (H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0)
+ TEST_ERROR
/* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ FAIL_STACK_ERROR
/* Create links until the group is in dense form */
- for(u = 0; u < max_compact * 2; u++) {
+ for (u = 0; u < max_compact * 2; u++) {
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group_id2) < 0) FAIL_STACK_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group_id2) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(group_id) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Retrieve & verify # of records in the name & creation order indices */
- if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
- if(name_count != corder_count) TEST_ERROR
+ if (H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0)
+ TEST_ERROR
+ if (name_count != corder_count)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group_id) < 0)
+ FAIL_STACK_ERROR
/* Check for deleting group without re-opening file */
- if(!reopen_file)
+ if (!reopen_file)
/* Delete the group with the creation order index */
- if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Check for deleting group after re-opening file */
- if(reopen_file) {
+ if (reopen_file) {
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Delete the group with the creation order index */
- if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
} /* end if */
/* Get the size of the file now */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
- if(file_size != empty_size) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
} /* end for */
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end corder_delete() */
-
/*-------------------------------------------------------------------------
* Function: link_info_by_idx_check
*
@@ -14472,111 +17709,153 @@ error:
*-------------------------------------------------------------------------
*/
static int
-link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
- hbool_t hard_link, hbool_t use_index)
+link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, hbool_t hard_link, hbool_t use_index)
{
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- char valname[NAME_BUF_SIZE]; /* Link value name */
- char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
- H5L_info2_t linfo; /* Link info struct */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
+ H5L_info2_t linfo; /* Link info struct */
/* Make link value for increasing/native order queries */
HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n);
/* Verify the link information for first link, in increasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in increasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in increasing creation order */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in increasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
/* Don't test "native" order if there is no creation order index, since
* there's not a good way to easily predict the link's order in the name
* index.
*/
- if(use_index) {
+ if (use_index) {
/* Verify the link information for first link, in native creation order (which is increasing) */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in native creation order (which is increasing) */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in native creation order (which is increasing) */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in native creation order (which is increasing) */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
} /* end if */
/* Verify the link information for first link, in decreasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in decreasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in decreasing creation order */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in decreasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
-
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
/* Verify the link information for first link, in increasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in increasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in increasing link name order */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in increasing link name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
/* Don't test "native" order queries on link name order, since there's not
* a good way to easily predict the order of the links in the name index.
@@ -14584,35 +17863,44 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
/* Verify the link information for first link, in decreasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != 0) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != 0)
+ TEST_ERROR
/* Verify the link information for new link, in decreasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.corder != (int64_t)n) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.corder != (int64_t)n)
+ TEST_ERROR
/* Verify value for new soft link, in decreasing link name order */
- if(!hard_link) {
+ if (!hard_link) {
HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end if */
/* Verify the name for new link, in decreasing link name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(linkname, tmpname))
+ TEST_ERROR
/* Success */
- return(0);
+ return (0);
error:
/* Failure */
- return(-1);
+ return (-1);
} /* end link_info_by_idx_check() */
-
/*-------------------------------------------------------------------------
* Function: link_info_by_idx
*
@@ -14626,34 +17914,34 @@ error:
static int
link_info_by_idx(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- unsigned hard_link; /* Create hard or soft link? */
- unsigned use_index; /* Use index on creation order values */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5L_info2_t linfo; /* Link info struct */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value name */
- char filename[NAME_BUF_SIZE];/* File name */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- unsigned u; /* Local index variable */
- ssize_t name_len; /* Length of name */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned hard_link; /* Create hard or soft link? */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ H5L_info2_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
+ herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
- for(hard_link = FALSE; hard_link <= TRUE; hard_link++) {
+ for (hard_link = FALSE; hard_link <= TRUE; hard_link++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
- if(hard_link) {
- if(use_index)
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
+ if (hard_link) {
+ if (use_index)
TESTING("querying info by index w/creation order index, using hard links")
else
TESTING("querying info by index w/o creation order index, using hard links")
} /* end if */
else {
- if(use_index)
+ if (use_index)
TESTING("querying info by index w/creation order index, using soft links")
else
TESTING("querying info by index w/o creation order index, using soft links")
@@ -14661,139 +17949,193 @@ link_info_by_idx(hid_t fapl)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(
+ gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0)
+ TEST_ERROR
/* Create group with creation order indexing & tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Check for query on empty group */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(name_len >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (name_len >= 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Check for creating hard or soft link */
- if(hard_link) {
- hid_t group_id2; /* Group ID */
+ if (hard_link) {
+ hid_t group_id2; /* Group ID */
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end if */
else {
/* Make value for link */
HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Create soft link */
- if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end else */
/* Verify link information for new link */
- if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group */
- if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) != TRUE)
+ TEST_ERROR
/* Check for out of bound offset queries */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(name_len >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (name_len >= 0)
+ TEST_ERROR
/* Create more links, to push group into dense form */
- for(; u < (max_compact * 2); u++) {
+ for (; u < (max_compact * 2); u++) {
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Check for creating hard or soft link */
- if(hard_link) {
- hid_t group_id2; /* Group ID */
+ if (hard_link) {
+ hid_t group_id2; /* Group ID */
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end if */
else {
/* Make value for link */
HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Create soft link */
- if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end else */
/* Verify state of group */
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Verify link information for new link */
- if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Check for out of bound offset queries */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(name_len >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (name_len >= 0)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
- } /* end for */
+ } /* end for */
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end link_info_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: link_info_by_idx_old
*
@@ -14807,75 +18149,83 @@ error:
static int
link_info_by_idx_old(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- H5F_t *f = NULL;
- unsigned hard_link; /* Create hard or soft link? */
- H5L_info2_t linfo; /* Link info struct */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value name */
- char filename[NAME_BUF_SIZE];/* File name */
- H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */
- void *vol_obj_file = NULL; /* Object of file_id */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
- unsigned u; /* Local index variable */
- ssize_t name_len; /* Length of name */
- int token_cmp;
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ H5F_t * f = NULL;
+ unsigned hard_link; /* Create hard or soft link? */
+ H5L_info2_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ H5O_token_t objtoken[CORDER_NLINKS]; /* Tokens (Addresses) of the objects created */
+ void * vol_obj_file = NULL; /* Object of file_id */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
+ unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
+ int token_cmp;
+ herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
- for(hard_link = FALSE; hard_link <= TRUE; hard_link++) {
- if(hard_link)
+ for (hard_link = FALSE; hard_link <= TRUE; hard_link++) {
+ if (hard_link)
TESTING("querying info by index in old-style group, using hard links")
else
TESTING("querying info by index in old-style group, using soft links")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Need the file struct to address encoding */
/* Retrieve VOL object */
- if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR
+ if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
+ TEST_ERROR
/* Retrieve file from VOL object */
- if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR
+ if (NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file)))
+ TEST_ERROR
/* Create group to operate on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
+ for (u = 0; u < CORDER_NLINKS; u++) {
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Check for creating hard or soft link */
- if(hard_link) {
- H5O_info2_t oi; /* Buffer for querying object's info */
+ if (hard_link) {
+ H5O_info2_t oi; /* Buffer for querying object's info */
/* Create group */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's object token */
- if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t));
/* Close group */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end if */
else {
/* Make value for link */
HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Create soft link */
- if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end else */
- } /* end for */
+ } /* end for */
/* Verify link information for created links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */
/* Make link name for increasing/native order queries */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -14884,36 +18234,54 @@ link_info_by_idx_old(hid_t fapl)
HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Verify link information (in increasing order) */
- if(hard_link) {
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (hard_link) {
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end if */
else {
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end else */
/* Verify link name (in increasing order) */
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
-
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
/* Verify link information (in native order - native is increasing) */
- if(hard_link) {
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (hard_link) {
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end if */
else {
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end else */
/* Verify link name (in native order - native is increasing) */
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
-
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
/* Make link name for decreasing order queries */
HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
@@ -14922,39 +18290,60 @@ link_info_by_idx_old(hid_t fapl)
HDsnprintf(valname, sizeof(valname), "value %02u", dec_u);
/* Verify link information (in decreasing order) */
- if(hard_link) {
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (hard_link) {
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end if */
else {
- if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ if (H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(valname, tmpval))
+ TEST_ERROR
} /* end else */
/* Verify link name (in decreasing order) */
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Check for creation order index queries */
- H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
- H5E_BEGIN_TRY {
- name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- } H5E_END_TRY;
- if(name_len >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (name_len >= 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
@@ -14962,14 +18351,15 @@ link_info_by_idx_old(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end link_info_by_idx_old() */
-
/*-------------------------------------------------------------------------
* Function: delete_by_idx
*
@@ -14983,309 +18373,399 @@ error:
static int
delete_by_idx(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- unsigned use_index; /* Use index on creation order values */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5L_info2_t linfo; /* Link info struct */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ H5L_info2_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("deleting links by creation order index in increasing order w/creation order index")
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("deleting links by creation order index in increasing order w/creation "
+ "order index")
else
- TESTING("deleting links by creation order index in increasing order w/o creation order index")
+ TESTING("deleting links by creation order index in increasing order w/o creation "
+ "order index")
} /* end if */
else {
- if(use_index)
- TESTING("deleting links by creation order index in decreasing order w/creation order index")
+ if (use_index)
+ TESTING("deleting links by creation order index in decreasing order w/creation "
+ "order index")
else
- TESTING("deleting links by creation order index in decreasing order w/o creation order index")
+ TESTING("deleting links by creation order index in decreasing order w/o creation "
+ "order index")
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
+ if (order == H5_ITER_INC) {
+ if (use_index)
TESTING("deleting links by name index in increasing order w/creation order index")
else
- TESTING("deleting links by name index in increasing order w/o creation order index")
+ TESTING(
+ "deleting links by name index in increasing order w/o creation order index")
} /* end if */
else {
- if(use_index)
+ if (use_index)
TESTING("deleting links by name index in decreasing order w/creation order index")
else
- TESTING("deleting links by name index in decreasing order w/o creation order index")
+ TESTING(
+ "deleting links by name index in decreasing order w/o creation order index")
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED |
+ (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Delete links from one end */
/* Check for deletion on empty group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for deletion on non-existing group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < max_compact; u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify link information for new link */
- if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (compact) */
- if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) != TRUE)
+ TEST_ERROR
/* Check for out of bound deletion */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Delete links from compact group */
- for(u = 0; u < (max_compact - 1); u++) {
+ for (u = 0; u < (max_compact - 1); u++) {
/* Delete first link in appropriate order */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(linfo.corder != (u + 1)) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (linfo.corder != (u + 1))
+ TEST_ERROR
} /* end if */
else {
- if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR
+ if (linfo.corder != (max_compact - (u + 2)))
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2)));
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group (empty) */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
/* Create more links, to push group into dense form */
- for(u = 0; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group (dense) */
- if(u >= max_compact)
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (u >= max_compact)
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Verify link information for new link */
- if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Check for out of bound deletion again */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Delete links from dense group, in appropriate order */
- for(u = 0; u < ((max_compact * 2) - 1); u++) {
+ for (u = 0; u < ((max_compact * 2) - 1); u++) {
/* Delete first link in appropriate order */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(linfo.corder != (u + 1)) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (linfo.corder != (u + 1))
+ TEST_ERROR
} /* end if */
else {
- if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR
+ if (linfo.corder != ((max_compact * 2) - (u + 2)))
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2)));
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group (empty) */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Check for deletion on empty group again */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Delete links in middle */
/* Create more links, to push group into dense form */
- for(u = 0; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Verify state of group (dense) */
- if(u >= max_compact)
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (u >= max_compact)
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Verify link information for new link */
- if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
+ if (link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0)
+ TEST_ERROR
} /* end for */
/* Delete every other link from dense group, in appropriate order */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Delete link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for current link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(linfo.corder != ((u * 2) + 1)) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (linfo.corder != ((u * 2) + 1))
+ TEST_ERROR
} /* end if */
else {
- if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR
+ if (linfo.corder != ((max_compact * 2) - ((u * 2) + 2)))
+ TEST_ERROR
} /* end else */
/* Verify the name for current link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1));
else
- HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2)));
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ HDsnprintf(objname, sizeof(objname), "filler %02u",
+ ((max_compact * 2) - ((u * 2) + 2)));
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete remaining links from dense group, in appropriate order */
- for(u = 0; u < (max_compact - 1); u++) {
+ for (u = 0; u < (max_compact - 1); u++) {
/* Delete link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(linfo.corder != ((u * 2) + 3)) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (linfo.corder != ((u * 2) + 3))
+ TEST_ERROR
} /* end if */
else {
- if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR
+ if (linfo.corder != ((max_compact * 2) - ((u * 2) + 4)))
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3));
else
- HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4)));
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ HDsnprintf(objname, sizeof(objname), "filler %02u",
+ ((max_compact * 2) - ((u * 2) + 4)));
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group (empty) */
- if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) == TRUE)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end delete_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: delete_by_idx_old
*
@@ -15299,211 +18779,266 @@ error:
static int
delete_by_idx_old(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- H5F_t *f = NULL;
- H5L_info2_t linfo; /* Link info struct */
- H5_iter_order_t order; /* Order within in the index */
- void *vol_obj_file = NULL; /* Object of file_id */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- unsigned u; /* Local index variable */
- int token_cmp;
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ H5F_t * f = NULL;
+ H5L_info2_t linfo; /* Link info struct */
+ H5_iter_order_t order; /* Order within in the index */
+ void * vol_obj_file = NULL; /* Object of file_id */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ H5O_token_t objtoken[CORDER_NLINKS]; /* Tokens (Addresses) of the objects created */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ int token_cmp;
+ herr_t ret; /* Generic return value */
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Print test banner */
- if(order == H5_ITER_INC)
+ if (order == H5_ITER_INC)
TESTING("deleting links by index in increasing order in old-style group")
else
TESTING("deleting links by index in decreasing order in old-style group")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Need the file struct to address encoding */
/* Retrieve VOL object */
- if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR
+ if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
+ TEST_ERROR
/* Retrieve file from VOL object */
- if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR
+ if (NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file)))
+ TEST_ERROR
/* Create group to operate on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Delete links from one end */
/* Check for deletion in empty group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- H5O_info2_t oi; /* Buffer for querying object's info */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ H5O_info2_t oi; /* Buffer for querying object's info */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create group */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's object token */
- if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t));
/* Close group */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Check for bad index type deletion */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for out of bounds deletion */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Delete links, in appropriate order */
- for(u = 0; u < (CORDER_NLINKS - 1); u++) {
- unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */
+ for (u = 0; u < (CORDER_NLINKS - 1); u++) {
+ unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */
/* Delete first link in appropriate order */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u + 1], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u + 1], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end if */
else {
- if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check for deletion in empty group (again) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Delete links in middle */
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- H5O_info2_t oi; /* Buffer for querying object's info */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ H5O_info2_t oi; /* Buffer for querying object's info */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create group */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's object token */
- if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t));
/* Close group */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Delete every other link from group, in appropriate order */
- for(u = 0; u < (CORDER_NLINKS / 2); u++) {
- unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */
+ for (u = 0; u < (CORDER_NLINKS / 2); u++) {
+ unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */
/* Delete link */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for current link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 1], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 1], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end if */
else {
- if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end else */
/* Verify the name for current link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete remaining links from group, in appropriate order */
- for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) {
- unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */
+ for (u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) {
+ unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */
/* Delete link */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC) {
- if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 3], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 3], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end if */
else {
- if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(order == H5_ITER_INC)
+ if (H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (order == H5_ITER_INC)
HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3));
else
HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
- if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ if (HDstrcmp(objname, tmpname))
+ TEST_ERROR
} /* end for */
/* Delete last link */
- if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify state of group */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
@@ -15511,15 +19046,16 @@ delete_by_idx_old(hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end delete_by_idx_old() */
-
/*-------------------------------------------------------------------------
* Function: link_iterate_cb
*
@@ -15530,66 +19066,65 @@ error:
*-------------------------------------------------------------------------
*/
static int
-link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info,
- void *_op_data)
+link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, void *_op_data)
{
- link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
- char objname[NAME_BUF_SIZE]; /* Object name */
- H5L_info2_t my_info; /* Local link info */
+ link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ H5L_info2_t my_info; /* Local link info */
/* Increment # of times the callback was called */
op_data->ncalled++;
/* Get the link information directly to compare */
- if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
+ if (H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
return H5_ITER_ERROR;
/* Check more things for link iteration (vs. group iteration) */
- if(info) {
+ if (info) {
int token_cmp;
/* Check for correct order of iteration */
/* (if we are operating in increasing or decreasing order) */
- if(op_data->order != H5_ITER_NATIVE)
- if(info->corder != op_data->curr)
+ if (op_data->order != H5_ITER_NATIVE)
+ if (info->corder != op_data->curr)
return H5_ITER_ERROR;
/* Compare link info structs */
- if(info->type != my_info.type)
+ if (info->type != my_info.type)
return H5_ITER_ERROR;
- if(info->corder_valid != my_info.corder_valid)
+ if (info->corder_valid != my_info.corder_valid)
return H5_ITER_ERROR;
- if(info->corder != my_info.corder)
+ if (info->corder != my_info.corder)
return H5_ITER_ERROR;
- if(info->cset != my_info.cset)
+ if (info->cset != my_info.cset)
return H5_ITER_ERROR;
- if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0)
return H5_ITER_ERROR;
- if(token_cmp)
+ if (token_cmp)
return H5_ITER_ERROR;
} /* end if */
/* Verify name of link */
HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder);
- if(HDstrcmp(link_name, objname))
+ if (HDstrcmp(link_name, objname))
return H5_ITER_ERROR;
/* Check if we've visited this link before */
- if((size_t)op_data->curr >= op_data->max_visit)
+ if ((size_t)op_data->curr >= op_data->max_visit)
return H5_ITER_ERROR;
- if(op_data->visited[op_data->curr])
+ if (op_data->visited[op_data->curr])
return H5_ITER_ERROR;
op_data->visited[op_data->curr] = TRUE;
/* Advance to next value, in correct direction */
- if(op_data->order != H5_ITER_DEC)
+ if (op_data->order != H5_ITER_DEC)
op_data->curr++;
else
op_data->curr--;
/* Check for stopping in the middle of iterating */
- if(op_data->stop > 0)
- if(--op_data->stop == 0)
+ if (op_data->stop > 0)
+ if (--op_data->stop == 0)
return CORDER_ITER_STOP;
return H5_ITER_CONT;
@@ -15614,7 +19149,6 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data)
} /* end group_iterate_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: link_iterate_fail_cb
*
@@ -15627,12 +19161,11 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data)
*/
static int
link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name,
- const H5L_info2_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
+ const H5L_info2_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
{
return H5_ITER_ERROR;
} /* end link_iterate_fail_cb() */
-
/*-------------------------------------------------------------------------
* Function: link_iterate_check
*
@@ -15643,138 +19176,160 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l
*-------------------------------------------------------------------------
*/
static int
-link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
- unsigned max_links, link_iter_info_t *iter_info)
+link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, unsigned max_links,
+ link_iter_info_t *iter_info)
{
- unsigned v; /* Local index variable */
- hsize_t skip; /* # of links to skip in group */
+ unsigned v; /* Local index variable */
+ hsize_t skip; /* # of links to skip in group */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- int gskip; /* # of links to skip in group, with H5Giterate */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- herr_t ret; /* Generic return value */
+ int gskip; /* # of links to skip in group, with H5Giterate */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ herr_t ret; /* Generic return value */
/* Iterate over links in group */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR
+ if (H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(skip != max_links) TEST_ERROR
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ if (skip != max_links)
+ TEST_ERROR
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, with H5Giterate */
iter_info->nskipped = (unsigned)(gskip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR
+ if (H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(gskip != (int)max_links) TEST_ERROR
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ if (gskip != (int)max_links)
+ TEST_ERROR
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Skip over some links in group */
iter_info->nskipped = (unsigned)(skip = max_links / 2);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR
+ if (H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(skip != max_links) TEST_ERROR
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ if (skip != max_links)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v + (max_links / 2)] == FALSE)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
- if(nvisit != (max_links / 2)) TEST_ERROR
+ if (nvisit != (max_links / 2))
+ TEST_ERROR
} /* end else */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some links in group, with H5Giterate */
iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR
+ if (H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(gskip != (int)max_links) TEST_ERROR
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ if (gskip != (int)max_links)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v + (max_links / 2)] == FALSE)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
- if(nvisit != (max_links / 2)) TEST_ERROR
- } /* end else */
+ if (nvisit != (max_links / 2))
+ TEST_ERROR
+ } /* end else */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Iterate over links in group, stopping in the middle */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR
- if(ret != CORDER_ITER_STOP) TEST_ERROR
- if(iter_info->ncalled != 3) TEST_ERROR
+ if ((ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0)
+ TEST_ERROR
+ if (ret != CORDER_ITER_STOP)
+ TEST_ERROR
+ if (iter_info->ncalled != 3)
+ TEST_ERROR
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
iter_info->nskipped = (unsigned)(gskip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info)) < 0) TEST_ERROR
- if(ret != CORDER_ITER_STOP) TEST_ERROR
- if(iter_info->ncalled != 3) TEST_ERROR
+ if ((ret = H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info)) < 0)
+ TEST_ERROR
+ if (ret != CORDER_ITER_STOP)
+ TEST_ERROR
+ if (iter_info->ncalled != 3)
+ TEST_ERROR
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Check for iteration routine indicating failure */
skip = 0;
- H5E_BEGIN_TRY {
- ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Success */
return SUCCEED;
@@ -15783,7 +19338,6 @@ error:
return FAIL;
} /* end link_iterate_check() */
-
/*-------------------------------------------------------------------------
* Function: link_iterate
*
@@ -15801,183 +19355,218 @@ error:
static int
link_iterate(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- unsigned use_index; /* Use index on creation order values */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- link_iter_info_t iter_info; /* Iterator info */
- hbool_t *visited = NULL; /* Array of flags for visiting links */
- hsize_t skip; /* # of links to skip in group */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file_id = (-1); /* File ID */
+ hid_t group_id = (-1); /* Group ID */
+ hid_t gcpl_id = (-1); /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ link_iter_info_t iter_info; /* Iterator info */
+ hbool_t * visited = NULL; /* Array of flags for visiting links */
+ hsize_t skip; /* # of links to skip in group */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Allocate the "visited link" array */
iter_info.max_visit = max_compact * 2;
- if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR
+ if (NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit)))
+ TEST_ERROR
iter_info.visited = visited;
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("iterating over links by creation order index in increasing order w/creation order index")
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("iterating over links by creation order index in increasing order "
+ "w/creation order index")
else
- TESTING("iterating over links by creation order index in increasing order w/o creation order index")
+ TESTING("iterating over links by creation order index in increasing order w/o "
+ "creation order index")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
- TESTING("iterating over links by creation order index in decreasing order w/creation order index")
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
+ TESTING("iterating over links by creation order index in decreasing order "
+ "w/creation order index")
else
- TESTING("iterating over links by creation order index in decreasing order w/o creation order index")
+ TESTING("iterating over links by creation order index in decreasing order w/o "
+ "creation order index")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
- TESTING("iterating over links by creation order index in native order w/creation order index")
+ if (use_index)
+ TESTING("iterating over links by creation order index in native order w/creation "
+ "order index")
else
- TESTING("iterating over links by creation order index in native order w/o creation order index")
+ TESTING("iterating over links by creation order index in native order w/o "
+ "creation order index")
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("iterating over links by name index in increasing order w/creation order index")
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("iterating over links by name index in increasing order w/creation order "
+ "index")
else
- TESTING("iterating over links by name index in increasing order w/o creation order index")
+ TESTING("iterating over links by name index in increasing order w/o creation "
+ "order index")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
- TESTING("iterating over links by name index in decreasing order w/creation order index")
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
+ TESTING("iterating over links by name index in decreasing order w/creation order "
+ "index")
else
- TESTING("iterating over links by name index in decreasing order w/o creation order index")
+ TESTING("iterating over links by name index in decreasing order w/o creation "
+ "order index")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
- TESTING("iterating over links by name index in native order w/creation order index")
+ if (use_index)
+ TESTING(
+ "iterating over links by name index in native order w/creation order index")
else
- TESTING("iterating over links by name index in native order w/o creation order index")
+ TESTING(
+ "iterating over links by name index in native order w/o creation order index")
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED |
+ (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Check for iteration on empty group */
/* (should be OK) */
- if(H5Literate2(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR
+ if (H5Literate2(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < max_compact; u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (compact) */
- if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) != TRUE)
+ TEST_ERROR
/* Check for out of bound iteration on compact group */
skip = (hsize_t)u;
- H5E_BEGIN_TRY {
- ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Test iteration over links in compact group */
- if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR
+ if (link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0)
+ TEST_ERROR
/* Create more links, to push group into dense form */
- for(; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ for (; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (dense) */
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound iteration on dense group */
skip = (hsize_t)u;
- H5E_BEGIN_TRY {
- ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Test iteration over links in dense group */
- if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR
-
+ if (link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Free resources */
- if(visited)
+ if (visited)
HDfree(visited);
return SUCCEED;
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(visited)
+ if (visited)
HDfree(visited);
return FAIL;
} /* end link_iterate() */
-
/*-------------------------------------------------------------------------
* Function: link_iterate_old_cb
*
@@ -15990,57 +19579,58 @@ error:
static int
link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, void *_op_data)
{
- link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
- char objname[NAME_BUF_SIZE]; /* Object name */
- H5L_info2_t my_info; /* Local link info */
+ link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ H5L_info2_t my_info; /* Local link info */
/* Increment # of times the callback was called */
op_data->ncalled++;
/* Get the link information directly to compare */
- if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
+ if (H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
return H5_ITER_ERROR;
/* Check more things for link iteration (vs. group iteration) */
- if(info) {
+ if (info) {
int token_cmp;
/* Compare link info structs */
- if(info->type != my_info.type)
+ if (info->type != my_info.type)
return H5_ITER_ERROR;
- if(info->corder_valid != my_info.corder_valid)
+ if (info->corder_valid != my_info.corder_valid)
return H5_ITER_ERROR;
- if(info->corder != my_info.corder)
+ if (info->corder != my_info.corder)
return H5_ITER_ERROR;
- if(info->cset != my_info.cset)
+ if (info->cset != my_info.cset)
return H5_ITER_ERROR;
- if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0)
return H5_ITER_ERROR;
- if(token_cmp)
+ if (token_cmp)
return H5_ITER_ERROR;
} /* end if */
/* Verify name of link */
- HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped)));
- if(HDstrcmp(link_name, objname))
+ HDsnprintf(objname, sizeof(objname), "filler %02u",
+ (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped)));
+ if (HDstrcmp(link_name, objname))
return H5_ITER_ERROR;
/* Check if we've visited this link before */
- if((size_t)op_data->curr >= op_data->max_visit)
+ if ((size_t)op_data->curr >= op_data->max_visit)
return H5_ITER_ERROR;
- if(op_data->visited[op_data->curr])
+ if (op_data->visited[op_data->curr])
return H5_ITER_ERROR;
op_data->visited[op_data->curr] = TRUE;
/* Advance to next value, in correct direction */
- if(op_data->order != H5_ITER_DEC)
+ if (op_data->order != H5_ITER_DEC)
op_data->curr++;
else
op_data->curr--;
/* Check for stopping in the middle of iterating */
- if(op_data->stop > 0)
- if(--op_data->stop == 0)
+ if (op_data->stop > 0)
+ if (--op_data->stop == 0)
return CORDER_ITER_STOP;
return H5_ITER_CONT;
@@ -16065,7 +19655,6 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data)
} /* end group_iterate_old_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: link_iterate_old_check
*
@@ -16078,148 +19667,170 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data)
static int
link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info)
{
- unsigned v; /* Local index variable */
- hsize_t skip; /* # of links to skip in group */
+ unsigned v; /* Local index variable */
+ hsize_t skip; /* # of links to skip in group */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- int gskip; /* # of links to skip in group, with H5Giterate */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- herr_t ret; /* Generic return value */
+ int gskip; /* # of links to skip in group, with H5Giterate */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ herr_t ret; /* Generic return value */
/* Iterate over links in group */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR
+ if (H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(skip != max_links) TEST_ERROR
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ if (skip != max_links)
+ TEST_ERROR
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, with H5Giterate */
iter_info->nskipped = (unsigned)(gskip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR
+ if (H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(gskip != (int)max_links) TEST_ERROR
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ if (gskip != (int)max_links)
+ TEST_ERROR
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Skip over some links in group */
iter_info->nskipped = (unsigned)(skip = max_links / 2);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR
+ if (H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(skip != max_links) TEST_ERROR
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ if (skip != max_links)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v + (max_links / 2)] == FALSE)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
- if(nvisit != (max_links / 2)) TEST_ERROR
+ if (nvisit != (max_links / 2))
+ TEST_ERROR
} /* end else */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some links in group, with H5Giterate */
iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR
+ if (H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0)
+ TEST_ERROR
/* Verify that we visited all the links */
- if(gskip != (int)max_links) TEST_ERROR
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ if (gskip != (int)max_links)
+ TEST_ERROR
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v + (max_links / 2)] == FALSE)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_links / 2); v++)
- if(iter_info->visited[v] == FALSE) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_links / 2); v++)
+ if (iter_info->visited[v] == FALSE)
+ TEST_ERROR
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_links; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_links; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
- if(nvisit != (max_links / 2)) TEST_ERROR
- } /* end else */
+ if (nvisit != (max_links / 2))
+ TEST_ERROR
+ } /* end else */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Iterate over links in group, stopping in the middle */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR
- if(ret != CORDER_ITER_STOP) TEST_ERROR
- if(iter_info->ncalled != 3) TEST_ERROR
+ if ((ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0)
+ TEST_ERROR
+ if (ret != CORDER_ITER_STOP)
+ TEST_ERROR
+ if (iter_info->ncalled != 3)
+ TEST_ERROR
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
iter_info->nskipped = (unsigned)(gskip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info)) < 0) TEST_ERROR
- if(ret != CORDER_ITER_STOP) TEST_ERROR
- if(iter_info->ncalled != 3) TEST_ERROR
+ if ((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info)) < 0)
+ TEST_ERROR
+ if (ret != CORDER_ITER_STOP)
+ TEST_ERROR
+ if (iter_info->ncalled != 3)
+ TEST_ERROR
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Check for iteration routine indicating failure */
skip = 0;
- H5E_BEGIN_TRY {
- ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for iteration w/bad location ID */
skip = 0;
- H5E_BEGIN_TRY {
- ret = H5Literate2((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Literate2((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
#ifndef H5_NO_DEPRECATED_SYMBOLS
- H5E_BEGIN_TRY {
- ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_cb, iter_info);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_cb, iter_info); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Success */
@@ -16229,7 +19840,6 @@ error:
return FAIL;
} /* end link_iterate_old_check() */
-
/*-------------------------------------------------------------------------
* Function: link_iterate_old
*
@@ -16242,29 +19852,30 @@ error:
static int
link_iterate_old(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- H5_iter_order_t order; /* Order within in the index */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- link_iter_info_t iter_info; /* Iterator info */
- hbool_t *visited = NULL; /* Array of flags for visiting links */
- hsize_t skip; /* # of links to skip in group */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ H5_iter_order_t order; /* Order within in the index */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ link_iter_info_t iter_info; /* Iterator info */
+ hbool_t * visited = NULL; /* Array of flags for visiting links */
+ hsize_t skip; /* # of links to skip in group */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Allocate the "visited link" array */
iter_info.max_visit = CORDER_NLINKS;
- if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR
+ if (NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit)))
+ TEST_ERROR
iter_info.visited = visited;
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Print appropriate test message */
- if(order == H5_ITER_INC) {
+ if (order == H5_ITER_INC) {
TESTING("iterating over links by name index in increasing order in old-style group")
} /* end if */
- else if(order == H5_ITER_DEC) {
+ else if (order == H5_ITER_DEC) {
TESTING("iterating over links by name index in decreasing order in old-style group")
} /* end else */
else {
@@ -16274,77 +19885,90 @@ link_iterate_old(hid_t fapl)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group with creation order tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check for iteration on empty group */
/* (should be OK) */
- if(H5Literate2(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR
+ if (H5Literate2(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0)
+ TEST_ERROR
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (symbol table) */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound iteration on old-style group */
skip = (hsize_t)u;
- H5E_BEGIN_TRY {
- ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for iteration on creation order */
/* (should fail) */
skip = (hsize_t)0;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Literate2(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Test iteration over links in group */
- if(link_iterate_old_check(group_id, order, u, &iter_info) < 0) TEST_ERROR
+ if (link_iterate_old_check(group_id, order, u, &iter_info) < 0)
+ TEST_ERROR
/* Close the group */
- if(H5Gclose(group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
/* Free resources */
- if(visited)
+ if (visited)
HDfree(visited);
return SUCCEED;
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(visited)
+ if (visited)
HDfree(visited);
return FAIL;
} /* end link_iterate_old() */
-
/*-------------------------------------------------------------------------
* Function: open_by_idx_check
*
@@ -16355,83 +19979,100 @@ error:
*-------------------------------------------------------------------------
*/
static int
-open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
- H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
+open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, H5_index_t idx_type,
+ H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
{
char mntname[NAME_BUF_SIZE]; /* Link value */
- hid_t group_id = -1; /* ID of group to test */
- H5O_info2_t oi; /* Buffer for querying object's info */
- H5O_token_t mnt_root_token; /* Token (address) of root group in file to mount */
- hid_t obj_id; /* ID of object opened */
- unsigned mnt_idx; /* Index to mount group on */
- unsigned u, v; /* Local index variables */
+ hid_t group_id = -1; /* ID of group to test */
+ H5O_info2_t oi; /* Buffer for querying object's info */
+ H5O_token_t mnt_root_token; /* Token (address) of root group in file to mount */
+ hid_t obj_id; /* ID of object opened */
+ unsigned mnt_idx; /* Index to mount group on */
+ unsigned u, v; /* Local index variables */
int token_cmp;
/* Work through main & soft link groups */
- for(v = 0; v < 2; v++) {
+ for (v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- if(0 == v)
+ if (0 == v)
group_id = main_group_id;
else
group_id = soft_group_id;
/* Open each object in main group by index and check that it's the correct one */
- for(u = 0; u < max_links; u++) {
+ for (u = 0; u < max_links; u++) {
/* Open the object */
- if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Get the object's information */
- if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
/* Check that the object is the correct one */
- if(order == H5_ITER_INC) {
- if(H5Otoken_cmp(obj_id, &oi.token, &objno[u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5Otoken_cmp(obj_id, &oi.token, &objno[u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
+ else if (order == H5_ITER_DEC) {
+ unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
- if(H5Otoken_cmp(obj_id, &oi.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
+ if (H5Otoken_cmp(obj_id, &oi.token, &objno[dec_u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
} /* end if */
else {
/* XXX: What to do about native order? */
} /* end else */
/* Close object */
- if(H5Oclose(obj_id) < 0) TEST_ERROR
+ if (H5Oclose(obj_id) < 0)
+ TEST_ERROR
} /* end for */
- } /* end for */
+ } /* end for */
/* Verify opening correct object by index when file mounting is present */
/* Get the address of the root group in the file to mount */
- if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0)
TEST_ERROR
HDmemcpy(&mnt_root_token, &oi.token, sizeof(mnt_root_token));
/* Mount a file over a group in main group */
mnt_idx = 2;
HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx);
- if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the object that the file is mounted on */
- if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Get the object's information */
- if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
/* Check that the object is the root of the mounted file and not in the previous file */
- if(H5Otoken_cmp(obj_id, &oi.token, &mnt_root_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Otoken_cmp(obj_id, &oi.token, &objno[mnt_idx], &token_cmp) < 0) TEST_ERROR
- if(!token_cmp) TEST_ERROR
+ if (H5Otoken_cmp(obj_id, &oi.token, &mnt_root_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Otoken_cmp(obj_id, &oi.token, &objno[mnt_idx], &token_cmp) < 0)
+ TEST_ERROR
+ if (!token_cmp)
+ TEST_ERROR
/* Close object */
- if(H5Oclose(obj_id) < 0) TEST_ERROR
+ if (H5Oclose(obj_id) < 0)
+ TEST_ERROR
/* Unmount the file */
- if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR
+ if (H5Funmount(main_group_id, mntname) < 0)
+ TEST_ERROR
/* Success */
return SUCCEED;
@@ -16440,7 +20081,6 @@ error:
return FAIL;
} /* end open_by_idx_check() */
-
/*-------------------------------------------------------------------------
* Function: open_by_idx
*
@@ -16454,215 +20094,262 @@ error:
static int
open_by_idx(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t mount_file_id = -1; /* File ID for file to mount */
- hid_t group_id = -1; /* Group ID */
- hid_t soft_group_id = -1; /* Group ID for soft links */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- unsigned use_index; /* Use index on creation order values */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5O_info2_t oi; /* Buffer for querying object's info */
- char filename[NAME_BUF_SIZE];/* File name */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[2 * NAME_BUF_SIZE]; /* Link value */
- H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */
- unsigned u; /* Local index variable */
- hid_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t mount_file_id = -1; /* File ID for file to mount */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ H5O_info2_t oi; /* Buffer for querying object's info */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
+ H5O_token_t * objno = NULL; /* Tokens (addresses) of the objects created */
+ unsigned u; /* Local index variable */
+ hid_t ret; /* Generic return value */
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Allocate object token array */
- if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR
+ if (NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2))))
+ TEST_ERROR
/* Create file to mount */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("open object by creation order index in increasing order w/creation order index")
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("open object by creation order index in increasing order w/creation "
+ "order index")
else
- TESTING("open object by creation order index in increasing order w/o creation order index")
+ TESTING("open object by creation order index in increasing order w/o creation "
+ "order index")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
- TESTING("open object by creation order index in decreasing order w/creation order index")
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
+ TESTING("open object by creation order index in decreasing order w/creation "
+ "order index")
else
- TESTING("open object by creation order index in decreasing order w/o creation order index")
+ TESTING("open object by creation order index in decreasing order w/o creation "
+ "order index")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
- TESTING("open object by creation order index in native order w/creation order index")
+ if (use_index)
+ TESTING(
+ "open object by creation order index in native order w/creation order index")
else
- TESTING("open object by creation order index in native order w/o creation order index")
+ TESTING("open object by creation order index in native order w/o creation order "
+ "index")
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
+ if (order == H5_ITER_INC) {
+ if (use_index)
TESTING("open object by name index in increasing order w/creation order index")
else
TESTING("open object by name index in increasing order w/o creation order index")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
TESTING("open object by name index in decreasing order w/creation order index")
else
TESTING("open object by name index in decreasing order w/o creation order index")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
+ if (use_index)
TESTING("open object by name index in native order w/creation order index")
else
TESTING("open object by name index in native order w/o creation order index")
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED |
+ (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on for soft links */
- if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((soft_group_id =
+ H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Try to open on object in an empty group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < max_compact; u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
objno[u] = oi.token;
/* Close group created */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
- if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
}
/* Verify state of group (compact) */
- if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) != TRUE)
+ TEST_ERROR
/* Check for out of bound open by index on compact group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Verify opening objects by index */
- if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR
+ if (open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0)
+ TEST_ERROR
/* Create more links, to push group into dense form */
- for(; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ for (; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
objno[u] = oi.token;
/* Close group created */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
- if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (dense) */
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound open by index on compact group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Verify opening objects by index */
- if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR
+ if (open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0)
+ TEST_ERROR
/* Close the groups */
- if(H5Gclose(group_id) < 0) TEST_ERROR
- if(H5Gclose(soft_group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
+ if (H5Gclose(soft_group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close the file for mounting */
- if(H5Fclose(mount_file_id) < 0) TEST_ERROR
+ if (H5Fclose(mount_file_id) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Free resources */
- if(objno)
+ if (objno)
HDfree(objno);
return SUCCEED;
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Gclose(soft_group_id);
H5Fclose(file_id);
H5Fclose(mount_file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(objno)
+ if (objno)
HDfree(objno);
return FAIL;
} /* end open_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: open_by_idx_check_old
*
@@ -16673,82 +20360,100 @@ error:
*-------------------------------------------------------------------------
*/
static int
-open_by_idx_check_old(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
- H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
+open_by_idx_check_old(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, H5_index_t idx_type,
+ H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
{
char mntname[NAME_BUF_SIZE]; /* Link value */
- hid_t group_id = -1; /* ID of group to test */
- H5O_info2_t oi; /* Buffer for querying object's info */
- H5O_token_t mnt_root_token; /* Token of root group in file to mount */
- hid_t obj_id; /* ID of object opened */
- unsigned mnt_idx; /* Index to mount group on */
- unsigned u, v; /* Local index variables */
- int cmp_value; /* Token comparison value */
+ hid_t group_id = -1; /* ID of group to test */
+ H5O_info2_t oi; /* Buffer for querying object's info */
+ H5O_token_t mnt_root_token; /* Token of root group in file to mount */
+ hid_t obj_id; /* ID of object opened */
+ unsigned mnt_idx; /* Index to mount group on */
+ unsigned u, v; /* Local index variables */
+ int cmp_value; /* Token comparison value */
/* Work through main & soft link groups */
- for(v = 0; v < 2; v++) {
+ for (v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- if(0 == v)
+ if (0 == v)
group_id = main_group_id;
else
group_id = soft_group_id;
/* Open each object in main group by index and check that it's the correct one */
- for(u = 0; u < max_links; u++) {
+ for (u = 0; u < max_links; u++) {
/* Open the object */
- if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Get the object's information */
- if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
/* Check that the object is the correct one */
- if(order == H5_ITER_INC) {
- if(H5Otoken_cmp(group_id, &oi.token, &objno[u], &cmp_value) < 0) TEST_ERROR
- if(0 != cmp_value) TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5Otoken_cmp(group_id, &oi.token, &objno[u], &cmp_value) < 0)
+ TEST_ERROR
+ if (0 != cmp_value)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
+ else if (order == H5_ITER_DEC) {
+ unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
- if(H5Otoken_cmp(group_id, &oi.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR
- if(0 != cmp_value) TEST_ERROR
+ if (H5Otoken_cmp(group_id, &oi.token, &objno[dec_u], &cmp_value) < 0)
+ TEST_ERROR
+ if (0 != cmp_value)
+ TEST_ERROR
} /* end if */
else {
/* XXX: What to do about native order? */
} /* end else */
/* Close object */
- if(H5Oclose(obj_id) < 0) TEST_ERROR
+ if (H5Oclose(obj_id) < 0)
+ TEST_ERROR
} /* end for */
- } /* end for */
+ } /* end for */
/* Verify opening correct object by index when file mounting is present */
/* Get the address of the root group in the file to mount */
- if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
mnt_root_token = oi.token;
/* Mount a file over a group in main group */
mnt_idx = 2;
HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx);
- if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the object that the file is mounted on */
- if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Get the object's information */
- if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
/* Check that the object is the root of the mounted file and not in the previous file */
- if(H5Otoken_cmp(group_id, &oi.token, &mnt_root_token, &cmp_value) < 0) TEST_ERROR
- if(0 != cmp_value) TEST_ERROR
- if(H5Otoken_cmp(group_id, &oi.token, &objno[mnt_idx], &cmp_value) < 0) TEST_ERROR
- if(0 == cmp_value) TEST_ERROR
+ if (H5Otoken_cmp(group_id, &oi.token, &mnt_root_token, &cmp_value) < 0)
+ TEST_ERROR
+ if (0 != cmp_value)
+ TEST_ERROR
+ if (H5Otoken_cmp(group_id, &oi.token, &objno[mnt_idx], &cmp_value) < 0)
+ TEST_ERROR
+ if (0 == cmp_value)
+ TEST_ERROR
/* Close object */
- if(H5Oclose(obj_id) < 0) TEST_ERROR
+ if (H5Oclose(obj_id) < 0)
+ TEST_ERROR
/* Unmount the file */
- if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR
+ if (H5Funmount(main_group_id, mntname) < 0)
+ TEST_ERROR
/* Success */
return SUCCEED;
@@ -16770,30 +20475,31 @@ error:
static int
open_by_idx_old(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t mount_file_id = -1; /* File ID for file to mount */
- hid_t group_id = -1; /* Group ID */
- hid_t soft_group_id = -1; /* Group ID for soft links */
- H5_iter_order_t order; /* Order within in the index */
- H5O_info2_t oi; /* Buffer for querying object's info */
- char filename[NAME_BUF_SIZE];/* File name */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[2 * NAME_BUF_SIZE]; /* Link value */
- H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */
- unsigned u; /* Local index variable */
- hid_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t mount_file_id = -1; /* File ID for file to mount */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ H5_iter_order_t order; /* Order within in the index */
+ H5O_info2_t oi; /* Buffer for querying object's info */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
+ H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */
+ unsigned u; /* Local index variable */
+ hid_t ret; /* Generic return value */
/* Create file to mount */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Print appropriate test message */
- if(order == H5_ITER_INC) {
+ if (order == H5_ITER_INC) {
TESTING("open object by name index in increasing order in old-style group")
} /* end if */
- else if(order == H5_ITER_DEC) {
+ else if (order == H5_ITER_DEC) {
TESTING("open object by name index in decreasing order in old-style group")
} /* end else */
else {
@@ -16803,89 +20509,106 @@ open_by_idx_old(hid_t fapl)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create old-style group */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create old-style group for soft links */
- if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
+ if ((soft_group_id =
+ H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Try to open on object in an empty group */
- H5E_BEGIN_TRY {
- ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2; /* Group ID */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
objno[u] = oi.token;
/* Close group created */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
- if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (symbol table) */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound open by index */
- H5E_BEGIN_TRY {
- ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for creation order index open */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Verify opening objects by index */
- if(open_by_idx_check_old(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR
+ if (open_by_idx_check_old(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0)
+ TEST_ERROR
/* Close the groups */
- if(H5Gclose(group_id) < 0) TEST_ERROR
- if(H5Gclose(soft_group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
+ if (H5Gclose(soft_group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
/* Close the file for mounting */
- if(H5Fclose(mount_file_id) < 0) TEST_ERROR
+ if (H5Fclose(mount_file_id) < 0)
+ TEST_ERROR
return SUCCEED;
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Gclose(soft_group_id);
H5Fclose(file_id);
H5Fclose(mount_file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end open_by_idx_old() */
-
/*-------------------------------------------------------------------------
* Function: object_info_check
*
@@ -16896,58 +20619,71 @@ error:
*-------------------------------------------------------------------------
*/
static int
-object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
- H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
+object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, H5_iter_order_t order,
+ unsigned max_links, H5O_token_t *objno)
{
char objname[NAME_BUF_SIZE]; /* Object name */
- hid_t group_id = -1; /* ID of group to test */
- H5O_info2_t oinfo; /* Buffer for querying object's info */
- unsigned u, v; /* Local index variables */
+ hid_t group_id = -1; /* ID of group to test */
+ H5O_info2_t oinfo; /* Buffer for querying object's info */
+ unsigned u, v; /* Local index variables */
int token_cmp;
/* Work through main & soft link groups */
- for(v = 0; v < 2; v++) {
+ for (v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- if(0 == v)
+ if (0 == v)
group_id = main_group_id;
else
group_id = soft_group_id;
/* Open each object in group by name and check that it's the correct one */
- for(u = 0; u < max_links; u++) {
+ for (u = 0; u < max_links; u++) {
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Query the object's information, by name */
- if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC | H5O_INFO_NUM_ATTRS,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check that the object is the correct one */
- if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(oinfo.num_attrs != u) TEST_ERROR
+ if (H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (oinfo.num_attrs != u)
+ TEST_ERROR
/* Query the object's information, by index */
- if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo,
+ H5O_INFO_BASIC | H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check that the object is the correct one */
- if(order == H5_ITER_INC) {
- if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(oinfo.num_attrs != u) TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (oinfo.num_attrs != u)
+ TEST_ERROR
} /* end if */
- else if(order == H5_ITER_DEC) {
- unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
-
- if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(oinfo.num_attrs != dec_u) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
+
+ if (H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (oinfo.num_attrs != dec_u)
+ TEST_ERROR
} /* end if */
else {
/* XXX: What to do about native order? */
} /* end else */
} /* end for */
- } /* end for */
+ } /* end for */
/* Success */
return SUCCEED;
@@ -16956,7 +20692,6 @@ error:
return FAIL;
} /* end object_info_check() */
-
/*-------------------------------------------------------------------------
* Function: object_info
*
@@ -16970,240 +20705,298 @@ error:
static int
object_info(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t soft_group_id = -1; /* Group ID for soft links */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- hid_t space_id = -1; /* Dataspace ID (for attributes) */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- unsigned use_index; /* Use index on creation order values */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5O_info2_t oinfo; /* Buffer for querying object's info */
- char filename[NAME_BUF_SIZE];/* File name */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[2 * NAME_BUF_SIZE]; /* Link value */
- char attrname[NAME_BUF_SIZE]; /* Attribute name */
- H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */
- herr_t ret; /* Generic return value */
- unsigned u, v; /* Local index variables */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ hid_t space_id = -1; /* Dataspace ID (for attributes) */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ H5O_info2_t oinfo; /* Buffer for querying object's info */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
+ char attrname[NAME_BUF_SIZE]; /* Attribute name */
+ H5O_token_t * objno = NULL; /* Tokens (addresses) of the objects created */
+ herr_t ret; /* Generic return value */
+ unsigned u, v; /* Local index variables */
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Allocate object token array */
- if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR
+ if (NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2))))
+ TEST_ERROR
/* Create dataspace for attributes */
- if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
+ if ((space_id = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("query object info by creation order index in increasing order w/creation order index")
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("query object info by creation order index in increasing order "
+ "w/creation order index")
else
- TESTING("query object info by creation order index in increasing order w/o creation order index")
+ TESTING("query object info by creation order index in increasing order w/o "
+ "creation order index")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
- TESTING("query object info by creation order index in decreasing order w/creation order index")
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
+ TESTING("query object info by creation order index in decreasing order "
+ "w/creation order index")
else
- TESTING("query object info by creation order index in decreasing order w/o creation order index")
+ TESTING("query object info by creation order index in decreasing order w/o "
+ "creation order index")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
- TESTING("query object info by creation order index in native order w/creation order index")
+ if (use_index)
+ TESTING("query object info by creation order index in native order w/creation "
+ "order index")
else
- TESTING("query object info by creation order index in native order w/o creation order index")
+ TESTING("query object info by creation order index in native order w/o creation "
+ "order index")
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("query object info by name index in increasing order w/creation order index")
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING(
+ "query object info by name index in increasing order w/creation order index")
else
- TESTING("query object info by name index in increasing order w/o creation order index")
+ TESTING("query object info by name index in increasing order w/o creation order "
+ "index")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
- TESTING("query object info by name index in decreasing order w/creation order index")
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
+ TESTING(
+ "query object info by name index in decreasing order w/creation order index")
else
- TESTING("query object info by name index in decreasing order w/o creation order index")
+ TESTING("query object info by name index in decreasing order w/o creation order "
+ "index")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
+ if (use_index)
TESTING("query object info by name index in native order w/creation order index")
else
- TESTING("query object info by name index in native order w/o creation order index")
+ TESTING(
+ "query object info by name index in native order w/o creation order index")
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED |
+ (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on for soft links */
- if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
-
+ if ((soft_group_id =
+ H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check for out of bound query by index on empty group */
- H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo,
+ H5O_INFO_BASIC, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
- hid_t attr_id; /* Attribute ID */
+ for (u = 0; u < max_compact; u++) {
+ hid_t group_id2; /* Group ID */
+ hid_t attr_id; /* Attribute ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
objno[u] = oinfo.token;
/* Create attributes on new object */
- for(v = 0; v < u; v++) {
+ for (v = 0; v < u; v++) {
/* Make name for attribute */
HDsnprintf(attrname, sizeof(attrname), "attr %02u", v);
/* Create attribute */
- if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close attribute */
- if(H5Aclose(attr_id) < 0) TEST_ERROR
+ if (H5Aclose(attr_id) < 0)
+ TEST_ERROR
} /* end for */
/* Close group created */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
- if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (compact) */
- if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) != TRUE)
+ TEST_ERROR
/* Check for out of bound query by index */
- H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo,
+ H5O_INFO_BASIC, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Verify querying objects by name */
- if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR
-
+ if (object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0)
+ TEST_ERROR
/* Create more links, to push group into dense form */
- for(; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
- hid_t attr_id; /* Attribute ID */
+ for (; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
+ hid_t attr_id; /* Attribute ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
objno[u] = oinfo.token;
/* Create attributes on new object */
- for(v = 0; v < u; v++) {
+ for (v = 0; v < u; v++) {
/* Make name for attribute */
HDsnprintf(attrname, sizeof(attrname), "attr %02u", v);
/* Create attribute */
- if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close attribute */
- if(H5Aclose(attr_id) < 0) TEST_ERROR
+ if (H5Aclose(attr_id) < 0)
+ TEST_ERROR
} /* end for */
/* Close group created */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
- if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (dense) */
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound query by index */
- H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo,
+ H5O_INFO_BASIC, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Verify querying objects by name */
- if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR
-
+ if (object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0)
+ TEST_ERROR
/* Close the groups */
- if(H5Gclose(group_id) < 0) TEST_ERROR
- if(H5Gclose(soft_group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
+ if (H5Gclose(soft_group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Free resources */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
- if(H5Sclose(space_id) < 0) TEST_ERROR
- if(objno)
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (objno)
HDfree(objno);
return SUCCEED;
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space_id);
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Gclose(soft_group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(objno)
+ if (objno)
HDfree(objno);
return FAIL;
} /* end object_info() */
-
/*-------------------------------------------------------------------------
* Function: object_info_check_old
*
@@ -17214,59 +21007,72 @@ error:
*-------------------------------------------------------------------------
*/
static int
-object_info_check_old(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
- H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
+object_info_check_old(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, H5_iter_order_t order,
+ unsigned max_links, H5O_token_t *objno)
{
char objname[NAME_BUF_SIZE]; /* Object name */
- hid_t group_id = -1; /* ID of group to test */
- H5O_info2_t oinfo; /* Buffer for querying object's info */
- unsigned u, v; /* Local index variables */
+ hid_t group_id = -1; /* ID of group to test */
+ H5O_info2_t oinfo; /* Buffer for querying object's info */
+ unsigned u, v; /* Local index variables */
/* Work through main & soft link groups */
- for(v = 0; v < 2; v++) {
+ for (v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- if(0 == v)
+ if (0 == v)
group_id = main_group_id;
else
group_id = soft_group_id;
/* Open each object in group by name and check that it's the correct one */
- for(u = 0; u < max_links; u++) {
- int cmp_value; /* Token comparison value */
+ for (u = 0; u < max_links; u++) {
+ int cmp_value; /* Token comparison value */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Query the object's information, by name */
- if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC | H5O_INFO_NUM_ATTRS,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check that the object is the correct one */
- if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR
- if(0 != cmp_value) TEST_ERROR
- if(oinfo.num_attrs != u) TEST_ERROR
+ if (H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0)
+ TEST_ERROR
+ if (0 != cmp_value)
+ TEST_ERROR
+ if (oinfo.num_attrs != u)
+ TEST_ERROR
/* Query the object's information, by index */
- if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo,
+ H5O_INFO_BASIC | H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check that the object is the correct one */
- if(order == H5_ITER_INC) {
- if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR
- if(0 != cmp_value) TEST_ERROR
- if(oinfo.num_attrs != u) TEST_ERROR
+ if (order == H5_ITER_INC) {
+ if (H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0)
+ TEST_ERROR
+ if (0 != cmp_value)
+ TEST_ERROR
+ if (oinfo.num_attrs != u)
+ TEST_ERROR
}
- else if(order == H5_ITER_DEC) {
- unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
-
- if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR
- if(0 != cmp_value) TEST_ERROR
- if(oinfo.num_attrs != dec_u) TEST_ERROR
+ else if (order == H5_ITER_DEC) {
+ unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
+
+ if (H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &cmp_value) < 0)
+ TEST_ERROR
+ if (0 != cmp_value)
+ TEST_ERROR
+ if (oinfo.num_attrs != dec_u)
+ TEST_ERROR
}
else {
/* XXX: What to do about native order? */
}
} /* end for */
- } /* end for */
+ } /* end for */
/* Success */
return SUCCEED;
@@ -17287,31 +21093,32 @@ error:
static int
object_info_old(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t soft_group_id = -1; /* Group ID for soft links */
- hid_t space_id = -1; /* Dataspace ID (for attributes) */
- H5_iter_order_t order; /* Order within in the index */
- H5O_info2_t oinfo; /* Buffer for querying object's info */
- char filename[NAME_BUF_SIZE];/* File name */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[2 * NAME_BUF_SIZE]; /* Link value */
- char attrname[NAME_BUF_SIZE]; /* Attribute name */
- H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */
- herr_t ret; /* Generic return value */
- unsigned u, v; /* Local index variables */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ hid_t space_id = -1; /* Dataspace ID (for attributes) */
+ H5_iter_order_t order; /* Order within in the index */
+ H5O_info2_t oinfo; /* Buffer for querying object's info */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
+ char attrname[NAME_BUF_SIZE]; /* Attribute name */
+ H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */
+ herr_t ret; /* Generic return value */
+ unsigned u, v; /* Local index variables */
/* Create dataspace for attributes */
- if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
+ if ((space_id = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Print appropriate test message */
- if(order == H5_ITER_INC) {
+ if (order == H5_ITER_INC) {
TESTING("query object info by name index in increasing order in old-style group")
} /* end if */
- else if(order == H5_ITER_DEC) {
+ else if (order == H5_ITER_DEC) {
TESTING("query object info by name index in decreasing order in old-style group")
} /* end else */
else {
@@ -17321,101 +21128,131 @@ object_info_old(hid_t fapl)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create old-style group */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create old-style group for soft links */
- if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((soft_group_id =
+ H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check for out of bound query by index on empty group */
- H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2; /* Group ID */
- hid_t attr_id; /* Attribute ID */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ hid_t group_id2; /* Group ID */
+ hid_t attr_id; /* Attribute ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
objno[u] = oinfo.token;
/* Create attributes on new object */
- for(v = 0; v < u; v++) {
+ for (v = 0; v < u; v++) {
/* Make name for attribute */
HDsnprintf(attrname, sizeof(attrname), "attr %02u", v);
/* Create attribute */
- if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close attribute */
- if(H5Aclose(attr_id) < 0) TEST_ERROR
+ if (H5Aclose(attr_id) < 0)
+ TEST_ERROR
} /* end for */
/* Close group created */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
- if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end for */
/* Verify state of group (symbol table) */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound query by index */
- H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for creation order index query */
- H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo,
+ H5O_INFO_BASIC, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Verify querying objects by name */
- if(object_info_check_old(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR
+ if (object_info_check_old(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0)
+ TEST_ERROR
/* Close the groups */
- if(H5Gclose(group_id) < 0) TEST_ERROR
- if(H5Gclose(soft_group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
+ if (H5Gclose(soft_group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
/* Free resources */
- if(H5Sclose(space_id) < 0) TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
return SUCCEED;
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space_id);
H5Gclose(group_id);
H5Gclose(soft_group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end object_info_old() */
-
/*-------------------------------------------------------------------------
* Function: group_info
*
@@ -17429,396 +21266,541 @@ error:
static int
group_info(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t soft_group_id = -1; /* Group ID for soft links */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- unsigned use_index; /* Use index on creation order values */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5G_info_t grp_info; /* Buffer for querying object's info */
- char filename[NAME_BUF_SIZE];/* File name */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char objname2[NAME_BUF_SIZE]; /* Object name */
- char valname[2 * NAME_BUF_SIZE]; /* Link value */
- herr_t ret; /* Generic return value */
- unsigned u, v; /* Local index variables */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ H5G_info_t grp_info; /* Buffer for querying object's info */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char objname2[NAME_BUF_SIZE]; /* Object name */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
+ herr_t ret; /* Generic return value */
+ unsigned u, v; /* Local index variables */
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0)
+ TEST_ERROR
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("query group info by creation order index in increasing order w/creation order index")
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING("query group info by creation order index in increasing order w/creation "
+ "order index")
else
- TESTING("query group info by creation order index in increasing order w/o creation order index")
+ TESTING("query group info by creation order index in increasing order w/o "
+ "creation order index")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
- TESTING("query group info by creation order index in decreasing order w/creation order index")
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
+ TESTING("query group info by creation order index in decreasing order w/creation "
+ "order index")
else
- TESTING("query group info by creation order index in decreasing order w/o creation order index")
+ TESTING("query group info by creation order index in decreasing order w/o "
+ "creation order index")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
- TESTING("query group info by creation order index in native order w/creation order index")
+ if (use_index)
+ TESTING("query group info by creation order index in native order w/creation "
+ "order index")
else
- TESTING("query group info by creation order index in native order w/o creation order index")
+ TESTING("query group info by creation order index in native order w/o creation "
+ "order index")
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
- TESTING("query group info by name index in increasing order w/creation order index")
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ TESTING(
+ "query group info by name index in increasing order w/creation order index")
else
- TESTING("query group info by name index in increasing order w/o creation order index")
+ TESTING(
+ "query group info by name index in increasing order w/o creation order index")
} /* end if */
- else if(order == H5_ITER_DEC) {
- if(use_index)
- TESTING("query group info by name index in decreasing order w/creation order index")
+ else if (order == H5_ITER_DEC) {
+ if (use_index)
+ TESTING(
+ "query group info by name index in decreasing order w/creation order index")
else
- TESTING("query group info by name index in decreasing order w/o creation order index")
+ TESTING(
+ "query group info by name index in decreasing order w/o creation order index")
} /* end else */
else {
HDassert(order == H5_ITER_NATIVE);
- if(use_index)
+ if (use_index)
TESTING("query group info by name index in native order w/creation order index")
else
TESTING("query group info by name index in native order w/o creation order index")
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Set creation order tracking & indexing on group */
- if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+ if (H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED |
+ (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Create group with creation order tracking on for soft links */
- if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((soft_group_id =
+ H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check for out of bound query by index on empty group */
- H5E_BEGIN_TRY {
- ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
- hid_t group_id2, group_id3; /* Group IDs */
+ for (u = 0; u < max_compact; u++) {
+ hid_t group_id2, group_id3; /* Group IDs */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's information */
- if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(group_id2, &grp_info) < 0)
+ TEST_ERROR
/* Check (new/empty) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != 0) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != 0)
+ TEST_ERROR
/* Retrieve group's information */
- if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new/empty) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != 0) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != 0)
+ TEST_ERROR
/* Retrieve group's information */
- if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new/empty) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != 0) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != 0)
+ TEST_ERROR
/* Create objects in new group created */
- for(v = 0; v <= u; v++) {
+ for (v = 0; v <= u; v++) {
/* Make name for link */
HDsnprintf(objname2, sizeof(objname2), "filler %02u", v);
/* Create hard link, with group object */
- if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id3 =
+ H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group created */
- if(H5Gclose(group_id3) < 0) TEST_ERROR
+ if (H5Gclose(group_id3) < 0)
+ TEST_ERROR
} /* end for */
/* Retrieve group's information */
- if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(group_id2, &grp_info) < 0)
+ TEST_ERROR
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve group's information */
- if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve group's information */
- if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve group's information */
- if(order != H5_ITER_NATIVE) {
- if(order == H5_ITER_INC) {
- if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (order != H5_ITER_NATIVE) {
+ if (order == H5_ITER_INC) {
+ if (H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end if */
else {
- if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end else */
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
} /* end if */
/* Close group created */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Retrieve main group's information */
- if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(group_id, &grp_info) < 0)
+ TEST_ERROR
/* Check main group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve main group's information, by name */
- if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check main group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve main group's information, by name */
- if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check main group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
- if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Retrieve soft link group's information, by name */
- if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(soft_group_id, &grp_info) < 0)
+ TEST_ERROR
/* Check soft link group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
} /* end for */
/* Verify state of group (compact) */
- if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+ if (H5G__has_links_test(group_id, NULL) != TRUE)
+ TEST_ERROR
/* Check for out of bound query by index */
- H5E_BEGIN_TRY {
- ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create more links, to push group into dense form */
- for(; u < (max_compact * 2); u++) {
- hid_t group_id2, group_id3; /* Group IDs */
+ for (; u < (max_compact * 2); u++) {
+ hid_t group_id2, group_id3; /* Group IDs */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's information */
- if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(group_id2, &grp_info) < 0)
+ TEST_ERROR
/* Check (new/empty) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != 0) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != 0)
+ TEST_ERROR
/* Retrieve group's information, by name */
- if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new/empty) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != 0) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != 0)
+ TEST_ERROR
/* Retrieve group's information, by name */
- if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new/empty) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != 0) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != 0)
+ TEST_ERROR
/* Create objects in new group created */
- for(v = 0; v <= u; v++) {
+ for (v = 0; v <= u; v++) {
/* Make name for link */
HDsnprintf(objname2, sizeof(objname2), "filler %02u", v);
/* Create hard link, with group object */
- if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id3 =
+ H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group created */
- if(H5Gclose(group_id3) < 0) TEST_ERROR
+ if (H5Gclose(group_id3) < 0)
+ TEST_ERROR
} /* end for */
/* Retrieve group's information */
- if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(group_id2, &grp_info) < 0)
+ TEST_ERROR
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_DENSE)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve group's information, by name */
- if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_DENSE)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve group's information, by name */
- if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_DENSE)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve group's information */
- if(order != H5_ITER_NATIVE) {
- if(order == H5_ITER_INC) {
- if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (order != H5_ITER_NATIVE) {
+ if (order == H5_ITER_INC) {
+ if (H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end if */
else {
- if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end else */
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_DENSE)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
} /* end if */
/* Close group created */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Retrieve main group's information */
- if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(group_id, &grp_info) < 0)
+ TEST_ERROR
/* Check main group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_DENSE)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve main group's information, by name */
- if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check main group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_DENSE)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve main group's information, by name */
- if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check main group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_DENSE)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
- if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Retrieve soft link group's information, by name */
- if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(soft_group_id, &grp_info) < 0)
+ TEST_ERROR
/* Check soft link group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
- if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_DENSE)
+ TEST_ERROR
+ if (grp_info.max_corder != (int64_t)(u + 1))
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
} /* end for */
/* Verify state of group (dense) */
- if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__is_new_dense_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound query by index */
- H5E_BEGIN_TRY {
- ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Close the groups */
- if(H5Gclose(group_id) < 0) TEST_ERROR
- if(H5Gclose(soft_group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
+ if (H5Gclose(soft_group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Free resources */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
return SUCCEED;
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Gclose(soft_group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end group_info() */
-
/*-------------------------------------------------------------------------
* Function: group_info_old
*
@@ -17832,24 +21814,24 @@ error:
static int
group_info_old(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t soft_group_id = -1; /* Group ID for soft links */
- H5_iter_order_t order; /* Order within in the index */
- H5G_info_t grp_info; /* Buffer for querying object's info */
- char filename[NAME_BUF_SIZE];/* File name */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char objname2[NAME_BUF_SIZE]; /* Object name */
- char valname[2 * NAME_BUF_SIZE]; /* Link value */
- herr_t ret; /* Generic return value */
- unsigned u, v; /* Local index variables */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ H5_iter_order_t order; /* Order within in the index */
+ H5G_info_t grp_info; /* Buffer for querying object's info */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char objname2[NAME_BUF_SIZE]; /* Object name */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
+ herr_t ret; /* Generic return value */
+ unsigned u, v; /* Local index variables */
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
- if(order == H5_ITER_INC) {
+ for (order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
+ if (order == H5_ITER_INC) {
TESTING("query group info by name index in increasing order in old-style group")
} /* end if */
- else if(order == H5_ITER_DEC) {
+ else if (order == H5_ITER_DEC) {
TESTING("query group info by name index in decreasing order in old-style group")
} /* end else */
else {
@@ -17859,166 +21841,236 @@ group_info_old(hid_t fapl)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create old-style group */
- if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create old-style group for soft links */
- if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((soft_group_id =
+ H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check for out of bound query by index on empty group */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create several links */
- for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2, group_id3; /* Group IDs */
+ for (u = 0; u < CORDER_NLINKS; u++) {
+ hid_t group_id2, group_id3; /* Group IDs */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
- if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve group's information */
- if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(group_id2, &grp_info) < 0)
+ TEST_ERROR
/* Check (new/empty) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != 0) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != 0)
+ TEST_ERROR
/* Retrieve group's information, by name */
- if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new/empty) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != 0) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != 0)
+ TEST_ERROR
/* Retrieve group's information, by name */
- if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new/empty) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != 0) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != 0)
+ TEST_ERROR
/* Create objects in new group created */
- for(v = 0; v <= u; v++) {
+ for (v = 0; v <= u; v++) {
/* Make name for link */
HDsnprintf(objname2, sizeof(objname2), "filler %02u", v);
/* Create hard link, with group object */
- if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close group created */
- if(H5Gclose(group_id3) < 0) TEST_ERROR
+ if (H5Gclose(group_id3) < 0)
+ TEST_ERROR
} /* end for */
/* Retrieve group's information */
- if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(group_id2, &grp_info) < 0)
+ TEST_ERROR
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve group's information, by name */
- if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve group's information, by name */
- if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve group's information */
- if(order != H5_ITER_NATIVE) {
- if(order == H5_ITER_INC) {
- if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (order != H5_ITER_NATIVE) {
+ if (order == H5_ITER_INC) {
+ if (H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end if */
else {
- if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
} /* end else */
/* Check (new) group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
} /* end if */
/* Close group created */
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Retrieve main group's information */
- if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(group_id, &grp_info) < 0)
+ TEST_ERROR
/* Check main group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve main group's information, by name */
- if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check main group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Retrieve main group's information, by name */
- if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Check main group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
- if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Retrieve soft link group's information, by name */
- if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR
+ if (H5Gget_info(soft_group_id, &grp_info) < 0)
+ TEST_ERROR
/* Check soft link group's information */
- if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR
- if(grp_info.max_corder != 0) TEST_ERROR
- if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
+ if (grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE)
+ TEST_ERROR
+ if (grp_info.max_corder != 0)
+ TEST_ERROR
+ if (grp_info.nlinks != (hsize_t)(u + 1))
+ TEST_ERROR
} /* end for */
/* Verify state of group (old-style) */
- if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+ if (H5G__has_stab_test(group_id) != TRUE)
+ TEST_ERROR
/* Check for out of bound query by index */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Check for bad index query by index group */
- H5E_BEGIN_TRY {
- ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, &grp_info, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, &grp_info,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Close the groups */
- if(H5Gclose(group_id) < 0) TEST_ERROR
- if(H5Gclose(soft_group_id) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
+ if (H5Gclose(soft_group_id) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
} /* end for */
@@ -18027,16 +22079,17 @@ group_info_old(hid_t fapl)
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(group_id);
H5Gclose(soft_group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end group_info_old() */
-
/*-------------------------------------------------------------------------
* Function: timestamps
*
@@ -18050,145 +22103,212 @@ error:
static int
timestamps(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1; /* Group ID */
- hid_t group_id2 = -1; /* Group ID */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- hid_t gcpl_id2 = -1; /* Group creation property list ID */
- H5O_info2_t oinfo, oinfo2; /* Object info for groups created */
- H5O_native_info_t ninfo, ninfo2; /* Native info for groups created */
- char filename[NAME_BUF_SIZE];/* File name */
- hbool_t track_times; /* The object timestamp setting */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t group_id2 = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ hid_t gcpl_id2 = -1; /* Group creation property list ID */
+ H5O_info2_t oinfo, oinfo2; /* Object info for groups created */
+ H5O_native_info_t ninfo, ninfo2; /* Native info for groups created */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ hbool_t track_times; /* The object timestamp setting */
/* Print test message */
TESTING("timestamps on objects")
/* Create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Query the object timestamp setting */
- if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR
+ if (H5Pget_obj_track_times(gcpl_id, &track_times) < 0)
+ TEST_ERROR
/* Check default timestamp information */
- if(track_times != TRUE) TEST_ERROR
+ if (track_times != TRUE)
+ TEST_ERROR
/* Set a non-default object timestamp setting */
- if(H5Pset_obj_track_times(gcpl_id, FALSE) < 0) TEST_ERROR
+ if (H5Pset_obj_track_times(gcpl_id, FALSE) < 0)
+ TEST_ERROR
/* Query the object timestamp setting */
- if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR
+ if (H5Pget_obj_track_times(gcpl_id, &track_times) < 0)
+ TEST_ERROR
/* Check default timestamp information */
- if(track_times != FALSE) TEST_ERROR
+ if (track_times != FALSE)
+ TEST_ERROR
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create group with non-default object timestamp setting */
- if((group_id = H5Gcreate2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id = H5Gcreate2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close the group creation property list */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
/* Create group with default object timestamp setting */
- if((group_id2 = H5Gcreate2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((group_id2 = H5Gcreate2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Retrieve the new groups' creation properties */
- if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR
- if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Gget_create_plist(group_id)) < 0)
+ TEST_ERROR
+ if ((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0)
+ TEST_ERROR
/* Query & verify the object timestamp settings */
- if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR
- if(track_times != FALSE) TEST_ERROR
- if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR
- if(track_times != TRUE) TEST_ERROR
+ if (H5Pget_obj_track_times(gcpl_id, &track_times) < 0)
+ TEST_ERROR
+ if (track_times != FALSE)
+ TEST_ERROR
+ if (H5Pget_obj_track_times(gcpl_id2, &track_times) < 0)
+ TEST_ERROR
+ if (track_times != TRUE)
+ TEST_ERROR
/* Query the object information for each group */
/* Generic info */
- if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR
- if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0)
+ TEST_ERROR
/* Native file format info */
- if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
- if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
+ if (H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0)
+ TEST_ERROR
+ if (H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0)
+ TEST_ERROR
/* Sanity check object information for each group */
/* Generic info */
- if(oinfo.atime != 0) TEST_ERROR
- if(oinfo.mtime != 0) TEST_ERROR
- if(oinfo.ctime != 0) TEST_ERROR
- if(oinfo.btime != 0) TEST_ERROR
- if(oinfo.atime == oinfo2.atime) TEST_ERROR
- if(oinfo.mtime == oinfo2.mtime) TEST_ERROR
- if(oinfo.ctime == oinfo2.ctime) TEST_ERROR
- if(oinfo.btime == oinfo2.btime) TEST_ERROR
+ if (oinfo.atime != 0)
+ TEST_ERROR
+ if (oinfo.mtime != 0)
+ TEST_ERROR
+ if (oinfo.ctime != 0)
+ TEST_ERROR
+ if (oinfo.btime != 0)
+ TEST_ERROR
+ if (oinfo.atime == oinfo2.atime)
+ TEST_ERROR
+ if (oinfo.mtime == oinfo2.mtime)
+ TEST_ERROR
+ if (oinfo.ctime == oinfo2.ctime)
+ TEST_ERROR
+ if (oinfo.btime == oinfo2.btime)
+ TEST_ERROR
/* Native file format info */
- if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR
- if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR
- if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR
- if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR
+ if ((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0)
+ TEST_ERROR
+ if ((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0)
+ TEST_ERROR
+ if (ninfo.hdr.space.total >= ninfo2.hdr.space.total)
+ TEST_ERROR
+ if (ninfo.hdr.space.meta >= ninfo2.hdr.space.meta)
+ TEST_ERROR
/* Close the property lists */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
- if(H5Pclose(gcpl_id2) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(gcpl_id2) < 0)
+ TEST_ERROR
/* Close the groups */
- if(H5Gclose(group_id) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
/* Open groups */
- if((group_id = H5Gopen2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group_id2 = H5Gopen2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group_id = H5Gopen2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group_id2 = H5Gopen2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Retrieve the groups' creation properties */
- if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR
- if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR
+ if ((gcpl_id = H5Gget_create_plist(group_id)) < 0)
+ TEST_ERROR
+ if ((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0)
+ TEST_ERROR
/* Query & verify the object timestamp settings */
- if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR
- if(track_times != FALSE) TEST_ERROR
- if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR
- if(track_times != TRUE) TEST_ERROR
+ if (H5Pget_obj_track_times(gcpl_id, &track_times) < 0)
+ TEST_ERROR
+ if (track_times != FALSE)
+ TEST_ERROR
+ if (H5Pget_obj_track_times(gcpl_id2, &track_times) < 0)
+ TEST_ERROR
+ if (track_times != TRUE)
+ TEST_ERROR
/* Query the object information for each group */
- if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR
- if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR
+ if (H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0)
+ TEST_ERROR
/* Native file format info */
- if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
- if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
+ if (H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0)
+ TEST_ERROR
+ if (H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0)
+ TEST_ERROR
/* Sanity check object information for each group */
/* Generic info */
- if(oinfo.atime != 0) TEST_ERROR
- if(oinfo.mtime != 0) TEST_ERROR
- if(oinfo.ctime != 0) TEST_ERROR
- if(oinfo.btime != 0) TEST_ERROR
- if(oinfo.atime == oinfo2.atime) TEST_ERROR
- if(oinfo.mtime == oinfo2.mtime) TEST_ERROR
- if(oinfo.ctime == oinfo2.ctime) TEST_ERROR
- if(oinfo.btime == oinfo2.btime) TEST_ERROR
+ if (oinfo.atime != 0)
+ TEST_ERROR
+ if (oinfo.mtime != 0)
+ TEST_ERROR
+ if (oinfo.ctime != 0)
+ TEST_ERROR
+ if (oinfo.btime != 0)
+ TEST_ERROR
+ if (oinfo.atime == oinfo2.atime)
+ TEST_ERROR
+ if (oinfo.mtime == oinfo2.mtime)
+ TEST_ERROR
+ if (oinfo.ctime == oinfo2.ctime)
+ TEST_ERROR
+ if (oinfo.btime == oinfo2.btime)
+ TEST_ERROR
/* Native file format info */
- if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR
- if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR
- if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR
- if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR
+ if ((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0)
+ TEST_ERROR
+ if ((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0)
+ TEST_ERROR
+ if (ninfo.hdr.space.total >= ninfo2.hdr.space.total)
+ TEST_ERROR
+ if (ninfo.hdr.space.meta >= ninfo2.hdr.space.meta)
+ TEST_ERROR
/* Close the property lists */
- if(H5Pclose(gcpl_id) < 0) TEST_ERROR
- if(H5Pclose(gcpl_id2) < 0) TEST_ERROR
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(gcpl_id2) < 0)
+ TEST_ERROR
/* Close the groups */
- if(H5Gclose(group_id) < 0) TEST_ERROR
- if(H5Gclose(group_id2) < 0) TEST_ERROR
+ if (H5Gclose(group_id) < 0)
+ TEST_ERROR
+ if (H5Gclose(group_id2) < 0)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
@@ -18196,16 +22316,17 @@ timestamps(hid_t fapl)
error:
/* Free resources */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(gcpl_id);
H5Gclose(group_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end timestamps() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -18217,40 +22338,43 @@ error:
int
main(void)
{
- hid_t fapl = -1, fapl2 = -1; /* File access property lists */
- int nerrors = 0;
- unsigned new_format; /* Whether to use the new format or not */
- unsigned minimize_dset_oh;
- unsigned efc; /* Whether to use the external file cache */
- const char *env_h5_drvr; /* File Driver value from environment */
+ hid_t fapl = -1, fapl2 = -1; /* File access property lists */
+ int nerrors = 0;
+ unsigned new_format; /* Whether to use the new format or not */
+ unsigned minimize_dset_oh;
+ unsigned efc; /* Whether to use the external file cache */
+ const char *env_h5_drvr; /* File Driver value from environment */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
h5_reset();
fapl = h5_fileaccess();
/* fapl2 uses "latest version bounds" */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
for (minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) {
if (minimize_dset_oh) {
HDprintf("\n-Testing with minimzed dataset object headers-\n");
dcpl_g = H5Pcreate(H5P_DATASET_CREATE);
- if (0 > dcpl_g) TEST_ERROR
+ if (0 > dcpl_g)
+ TEST_ERROR
}
else {
HDprintf("\n-Testing with unminimzed dataset object headers-\n");
dcpl_g = H5P_DEFAULT;
}
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl;
/* Check for FAPL to use */
- if(new_format) {
+ if (new_format) {
my_fapl = fapl2;
HDprintf("\n--Testing with 'new format'--\n");
}
@@ -18260,7 +22384,8 @@ main(void)
}
/* always enter tests without external cache */
- if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) TEST_ERROR
+ if (H5Pset_elink_file_cache_size(my_fapl, 0) < 0)
+ TEST_ERROR
/* General tests... (on both old & new format groups */
nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0;
@@ -18302,13 +22427,15 @@ main(void)
nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
/* Try external link tests both with and without the external file cache */
- for(efc = FALSE; efc <= TRUE; efc++) {
- if(efc) {
- if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR
+ for (efc = FALSE; efc <= TRUE; efc++) {
+ if (efc) {
+ if (H5Pset_elink_file_cache_size(my_fapl, 8) < 0)
+ TEST_ERROR
HDprintf("\n---Testing with external file cache---\n");
} /* end if */
else {
- if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) TEST_ERROR
+ if (H5Pset_elink_file_cache_size(my_fapl, 0) < 0)
+ TEST_ERROR
HDprintf("\n---Testing without external file cache---\n");
} /* end else */
@@ -18371,16 +22498,16 @@ main(void)
* so assume that everything that passed for external links
* above has already been tested for UD links.
*/
- if(new_format == TRUE) {
- nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+ if (new_format == TRUE) {
+ nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += ud_hard_links_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+ nerrors += ud_hard_links_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += ud_link_reregister_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- } /* end if */
+ nerrors += ud_link_reregister_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ } /* end if */
nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0;
#ifndef H5_NO_DEPRECATED_SYMBOLS
nerrors += ud_callbacks_deprec(my_fapl, new_format) < 0 ? 1 : 0;
@@ -18413,10 +22540,10 @@ main(void)
/* New group revision feature tests */
nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0;
-/* XXX: when creation order indexing is fully working, go back and add checks
- * to these tests to make certain that the creation order values are
- * correct.
- */
+ /* XXX: when creation order indexing is fully working, go back and add checks
+ * to these tests to make certain that the creation order values are
+ * correct.
+ */
nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0;
#ifndef H5_NO_DEPRECATED_SYMBOLS
nerrors += corder_create_compact_deprec(fapl2) < 0 ? 1 : 0;
@@ -18482,8 +22609,8 @@ main(void)
nerrors += external_reset_register() < 0 ? 1 : 0;
/* Results */
- if(nerrors) {
- HDprintf("***** %d LINK TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
+ if (nerrors) {
+ HDprintf("***** %d LINK TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
}
HDprintf("All link tests passed.\n");
@@ -18502,4 +22629,3 @@ error:
HDputs("*** TESTS FAILED ***");
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/links_env.c b/test/links_env.c
index efb8cfd..0e5d1c0 100644
--- a/test/links_env.c
+++ b/test/links_env.c
@@ -15,27 +15,24 @@
* Purpose: Tests hard, soft (symbolic) & external links.
*/
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#define H5G_TESTING
#include "h5test.h"
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
-#define TMPDIR "tmp_links_env/"
-#define NAME_BUF_SIZE 1024
+#define TMPDIR "tmp_links_env/"
+#define NAME_BUF_SIZE 1024
-const char *FILENAME[] = {
- "extlinks_env0", /* 0: main file */
- "extlinks_env1", /* 1: target file */
- TMPDIR "extlinks_env1", /* 2 */
- NULL
-};
+const char *FILENAME[] = {"extlinks_env0", /* 0: main file */
+ "extlinks_env1", /* 1: target file */
+ TMPDIR "extlinks_env1", /* 2 */
+ NULL};
static int external_link_env(hid_t fapl, hbool_t new_format);
-
/*-------------------------------------------------------------------------
* Function: external_link_env (moved from links.c)
*
@@ -59,21 +56,21 @@ static int external_link_env(hid_t fapl, hbool_t new_format);
static int
external_link_env(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- const char *envval = NULL; /* Pointer to environment variable */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE]; /* Holders for filename */
-
- if(new_format)
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ const char *envval = NULL; /* Pointer to environment variable */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE]; /* Holders for filename */
+
+ if (new_format)
TESTING("external links via environment variable (w/new group format)")
else
TESTING("external links via environment variable")
if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL)
envval = "nomatch";
- if (HDstrcmp(envval, ".:tmp_links_env")) TEST_ERROR
+ if (HDstrcmp(envval, ".:tmp_links_env"))
+ TEST_ERROR
/* Set up name for main file:"extlinks_env0" */
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
@@ -82,55 +79,62 @@ external_link_env(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Create "tmp_links_env" directory */
- if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
/* Set up name (location) for the target file: "tmp_links_env/extlinks1" */
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
/* Create the target file in "tmp_links_env" directory */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); }
+ H5E_END_TRY;
/* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */
if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp_links_env directory.");
- goto error;
+ H5_FAILED();
+ puts(" Should have found the file in tmp_links_env directory.");
+ goto error;
}
/* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return -1;
} /* end external_link_env() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -145,8 +149,8 @@ external_link_env(hid_t fapl, hbool_t new_format)
int
main(void)
{
- hid_t fapl; /* File access property lists */
- int nerrors = 0; /* Error from tests */
+ hid_t fapl; /* File access property lists */
+ int nerrors = 0; /* Error from tests */
h5_reset();
fapl = h5_fileaccess();
@@ -154,7 +158,8 @@ main(void)
nerrors += external_link_env(fapl, FALSE) < 0 ? 1 : 0;
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
nerrors += external_link_env(fapl, TRUE) < 0 ? 1 : 0;
@@ -164,9 +169,9 @@ main(void)
h5_cleanup(FILENAME, fapl);
/* Results */
- if(nerrors) {
- HDprintf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "s");
+ if (nerrors) {
+ HDprintf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n", nerrors,
+ 1 == nerrors ? "" : "s");
HDexit(EXIT_FAILURE);
}
HDprintf("All external Link (HDF5_EXT_PREFIX) tests passed.\n");
@@ -180,4 +185,3 @@ error:
HDputs("*** TESTS FAILED ***");
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/mf.c b/test/mf.c
index e8e8fc7..c4a2aa1 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -23,91 +23,88 @@
#include "h5test.h"
-#define H5MF_FRIEND /*suppress error about including H5MFpkg */
+#define H5MF_FRIEND /*suppress error about including H5MFpkg */
#include "H5MFpkg.h"
-#define H5FS_FRIEND /*suppress error about including H5FSpkg */
+#define H5FS_FRIEND /*suppress error about including H5FSpkg */
#include "H5FSpkg.h"
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
#include "H5Fpkg.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5FLprivate.h"
#include "H5Iprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VMprivate.h"
-#define FILENAME_LEN 1024
+#define FILENAME_LEN 1024
-#define TBLOCK_SIZE1 1
-#define TBLOCK_SIZE2 2
-#define TBLOCK_SIZE3 3
-#define TBLOCK_SIZE4 4
-#define TBLOCK_SIZE5 5
-#define TBLOCK_SIZE6 6
+#define TBLOCK_SIZE1 1
+#define TBLOCK_SIZE2 2
+#define TBLOCK_SIZE3 3
+#define TBLOCK_SIZE4 4
+#define TBLOCK_SIZE5 5
+#define TBLOCK_SIZE6 6
#ifdef PB_OUT
-#define TBLOCK_SIZE7 7
-#define TBLOCK_SIZE8 8
+#define TBLOCK_SIZE7 7
+#define TBLOCK_SIZE8 8
#endif /* PB_OUT */
-#define TBLOCK_SIZE10 10
-#define TBLOCK_SIZE11 11
-#define TBLOCK_SIZE20 20
-#define TBLOCK_SIZE30 30
-#define TBLOCK_SIZE36 36
-#define TBLOCK_SIZE40 40
-#define TBLOCK_SIZE50 50
-#define TBLOCK_SIZE80 80
-#define TBLOCK_SIZE90 90
-#define TBLOCK_SIZE98 98
-#define TBLOCK_SIZE100 100
-#define TBLOCK_SIZE150 150
-#define TBLOCK_SIZE200 200
-#define TBLOCK_SIZE600 600
-#define TBLOCK_SIZE700 700
-#define TBLOCK_SIZE1034 1034
-#define TBLOCK_SIZE1970 1970
-#define TBLOCK_SIZE2048 2048
-#define TBLOCK_SIZE2058 2058
-#define TBLOCK_SIZE2192 2192
-#define TBLOCK_SIZE3080 3080
-#define TBLOCK_SIZE3088 3088
-#define TBLOCK_SIZE3198 3198
-#define TBLOCK_SIZE3286 3286
-#define TBLOCK_SIZE3248 3248
-#define TBLOCK_SIZE3900 3900
-#define TBLOCK_SIZE4020 4020
-#define TBLOCK_SIZE4086 4086
-#define TBLOCK_SIZE4096 4096
-#define TBLOCK_SIZE4106 4106
-#define TBLOCK_SIZE5000 5000
-#define TBLOCK_SIZE6000 6000
-#define TBLOCK_SIZE8000 8000
-#define TBLOCK_SIZE8100 8100
-#define TBLOCK_SIZE8192 8192
-#define TBLOCK_SIZE8190 8190
-#define TBLOCK_SIZE12000 12000
-
-#define TBLOCK_ADDR70 70
-#define TBLOCK_ADDR100 100
-
-#define TEST_ALIGN16 16
-#define TEST_ALIGN1024 1024
-#define TEST_ALIGN4096 4096
-
-#define TEST_THRESHOLD10 10
-#define TEST_THRESHOLD3 3
-
-const char *FILENAME[] = {
- "mf",
- NULL
-};
+#define TBLOCK_SIZE10 10
+#define TBLOCK_SIZE11 11
+#define TBLOCK_SIZE20 20
+#define TBLOCK_SIZE30 30
+#define TBLOCK_SIZE36 36
+#define TBLOCK_SIZE40 40
+#define TBLOCK_SIZE50 50
+#define TBLOCK_SIZE80 80
+#define TBLOCK_SIZE90 90
+#define TBLOCK_SIZE98 98
+#define TBLOCK_SIZE100 100
+#define TBLOCK_SIZE150 150
+#define TBLOCK_SIZE200 200
+#define TBLOCK_SIZE600 600
+#define TBLOCK_SIZE700 700
+#define TBLOCK_SIZE1034 1034
+#define TBLOCK_SIZE1970 1970
+#define TBLOCK_SIZE2048 2048
+#define TBLOCK_SIZE2058 2058
+#define TBLOCK_SIZE2192 2192
+#define TBLOCK_SIZE3080 3080
+#define TBLOCK_SIZE3088 3088
+#define TBLOCK_SIZE3198 3198
+#define TBLOCK_SIZE3286 3286
+#define TBLOCK_SIZE3248 3248
+#define TBLOCK_SIZE3900 3900
+#define TBLOCK_SIZE4020 4020
+#define TBLOCK_SIZE4086 4086
+#define TBLOCK_SIZE4096 4096
+#define TBLOCK_SIZE4106 4106
+#define TBLOCK_SIZE5000 5000
+#define TBLOCK_SIZE6000 6000
+#define TBLOCK_SIZE8000 8000
+#define TBLOCK_SIZE8100 8100
+#define TBLOCK_SIZE8192 8192
+#define TBLOCK_SIZE8190 8190
+#define TBLOCK_SIZE12000 12000
+
+#define TBLOCK_ADDR70 70
+#define TBLOCK_ADDR100 100
+
+#define TEST_ALIGN16 16
+#define TEST_ALIGN1024 1024
+#define TEST_ALIGN4096 4096
+
+#define TEST_THRESHOLD10 10
+#define TEST_THRESHOLD3 3
+
+const char *FILENAME[] = {"mf", NULL};
typedef enum {
- TEST_NORMAL, /* size of aggregator is >= alignment size */
- TEST_AGGR_SMALL, /* size of aggregator is smaller than alignment size */
- TEST_NTESTS /* The number of test types, must be last */
+ TEST_NORMAL, /* size of aggregator is >= alignment size */
+ TEST_AGGR_SMALL, /* size of aggregator is smaller than alignment size */
+ TEST_NTESTS /* The number of test types, must be last */
} test_type_t;
static int check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state);
@@ -161,41 +158,46 @@ static unsigned test_page_alignment(const char *env_h5_drvr, hid_t fapl);
static int
check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state)
{
- H5FS_stat_t frspace_stats; /* Statistics about the heap */
+ H5FS_stat_t frspace_stats; /* Statistics about the heap */
HDassert(f);
HDassert(frsp);
/* Get statistics for free-space and verify they are correct */
- if(H5FS_stat_info(f, frsp, &frspace_stats) < 0)
+ if (H5FS_stat_info(f, frsp, &frspace_stats) < 0)
FAIL_STACK_ERROR
- if(frspace_stats.tot_space != state->tot_space) {
+ if (frspace_stats.tot_space != state->tot_space) {
HDfprintf(stdout, "frspace_stats.tot_space = %" PRIuHSIZE ", state->tot_space = %" PRIuHSIZE "\n",
frspace_stats.tot_space, state->tot_space);
TEST_ERROR
} /* end if */
- if(frspace_stats.tot_sect_count != state->tot_sect_count) {
- HDfprintf(stdout, "frspace_stats.tot_sect_count = %" PRIuHSIZE ", state->tot_sect_count = %" PRIuHSIZE "\n",
+ if (frspace_stats.tot_sect_count != state->tot_sect_count) {
+ HDfprintf(stdout,
+ "frspace_stats.tot_sect_count = %" PRIuHSIZE ", state->tot_sect_count = %" PRIuHSIZE "\n",
frspace_stats.tot_sect_count, state->tot_sect_count);
TEST_ERROR
} /* end if */
- if(frspace_stats.serial_sect_count != state->serial_sect_count) {
- HDfprintf(stdout, "frspace_stats.serial_sect_count = %" PRIuHSIZE ", state->serial_sect_count = %" PRIuHSIZE "\n",
+ if (frspace_stats.serial_sect_count != state->serial_sect_count) {
+ HDfprintf(stdout,
+ "frspace_stats.serial_sect_count = %" PRIuHSIZE ", state->serial_sect_count = %" PRIuHSIZE
+ "\n",
frspace_stats.serial_sect_count, state->serial_sect_count);
TEST_ERROR
} /* end if */
- if(frspace_stats.ghost_sect_count != state->ghost_sect_count) {
- HDfprintf(stdout, "frspace_stats.ghost_sect_count = %" PRIuHSIZE ", state->ghost_sect_count = %" PRIuHSIZE "\n",
+ if (frspace_stats.ghost_sect_count != state->ghost_sect_count) {
+ HDfprintf(stdout,
+ "frspace_stats.ghost_sect_count = %" PRIuHSIZE ", state->ghost_sect_count = %" PRIuHSIZE
+ "\n",
frspace_stats.ghost_sect_count, state->ghost_sect_count);
TEST_ERROR
} /* end if */
/* All tests passed */
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* check_stats() */
/*
@@ -212,16 +214,16 @@ error:
static unsigned
test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type;
haddr_t addr1, addr2;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MM_alloc() of file allocation");
@@ -229,22 +231,23 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
* type of metadata allocation.
*/
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -252,16 +255,16 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* nothing should be changed in meta_aggr */
@@ -282,40 +285,40 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
if (addr2 < (haddr_t)file_size)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TBLOCK_SIZE30+TBLOCK_SIZE50))
+ if (new_file_size != (file_size + TBLOCK_SIZE30 + TBLOCK_SIZE50))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30);
H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -325,14 +328,16 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support continuous address space");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_eoa() */
/*
@@ -357,16 +362,16 @@ error:
static unsigned
test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size = 0, new_file_size; /* file size */
- H5FD_mem_t type;
- haddr_t addr = 0;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size = 0, new_file_size; /* file size */
+ H5FD_mem_t type;
+ haddr_t addr = 0;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_try_shrink() of file allocation: test 1");
@@ -374,22 +379,23 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
* type of metadata allocation.
*/
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -397,11 +403,11 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -414,50 +420,52 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
/* nothing should be changed in meta_aggr */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != ma_size) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
+ if (new_ma_size != ma_size)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TBLOCK_SIZE30))
+ if (new_file_size != (file_size + TBLOCK_SIZE30))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* should succeed */
- if(H5MF_try_shrink(f, type, addr, (hsize_t)TBLOCK_SIZE30) <= 0)
+ if (H5MF_try_shrink(f, type, addr, (hsize_t)TBLOCK_SIZE30) <= 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if(new_ma_addr != ma_addr)
+ if (new_ma_addr != ma_addr)
TEST_ERROR
- if(new_ma_size != ma_size)
+ if (new_ma_size != ma_size)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
PASSED();
@@ -472,13 +480,13 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
/* Skip test when using VFDs that has different address spaces for each
* type of metadata allocation.
*/
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -489,23 +497,25 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* should not succeed in shrinking */
- if(H5MF_try_shrink(f, type, addr, (hsize_t)TBLOCK_SIZE30 - 10) > 0)
+ if (H5MF_try_shrink(f, type, addr, (hsize_t)TBLOCK_SIZE30 - 10) > 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != ma_size) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
+ if (new_ma_size != ma_size)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TBLOCK_SIZE30))
+ if (new_file_size != (file_size + TBLOCK_SIZE30))
TEST_ERROR
PASSED();
@@ -515,41 +525,42 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
-
TESTING("H5MF_try_shrink() of file allocation: test 3");
/* Skip test when using VFDs that has different address spaces for each
* type of metadata allocation.
*/
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* should not succeed in shrinking */
- if(H5MF_try_shrink(f, type, addr, (hsize_t)TBLOCK_SIZE30 + 10) > 0)
+ if (H5MF_try_shrink(f, type, addr, (hsize_t)TBLOCK_SIZE30 + 10) > 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != ma_size) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
+ if (new_ma_size != ma_size)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TBLOCK_SIZE30))
+ if (new_file_size != (file_size + TBLOCK_SIZE30))
TEST_ERROR
PASSED();
@@ -564,40 +575,40 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
/* Skip test when using VFDs that has different address spaces for each
* type of metadata allocation.
*/
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
/* should succeed in shrinking */
- if(H5MF_try_shrink(f, type, addr+10, (hsize_t)(TBLOCK_SIZE30 - 10)) <= 0)
+ if (H5MF_try_shrink(f, type, addr + 10, (hsize_t)(TBLOCK_SIZE30 - 10)) <= 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if(new_ma_addr != ma_addr)
+ if (new_ma_addr != ma_addr)
TEST_ERROR
- if(new_ma_size != ma_size)
+ if (new_ma_size != ma_size)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + 10))
+ if (new_file_size != (file_size + 10))
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -607,14 +618,16 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_eoa_shrink() */
/*
@@ -635,17 +648,17 @@ error:
static unsigned
test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* File size */
- H5FD_mem_t type;
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* File size */
+ H5FD_mem_t type;
haddr_t addr;
- htri_t was_extended;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ htri_t was_extended;
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_try_extend() of file allocation: test 1");
@@ -653,36 +666,37 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
* type of metadata allocation.
*/
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
- if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0)
+ if (H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0)
FAIL_STACK_ERROR
- if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0)
+ if (H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0)
FAIL_STACK_ERROR
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -697,29 +711,30 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
if (new_ma_addr != ma_addr)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TBLOCK_SIZE30))
+ if (new_file_size != (file_size + TBLOCK_SIZE30))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* should succeed */
- was_extended = H5MF_try_extend(f, type, (haddr_t)addr, (hsize_t)TBLOCK_SIZE30, (hsize_t)TBLOCK_SIZE50);
+ was_extended =
+ H5MF_try_extend(f, type, (haddr_t)addr, (hsize_t)TBLOCK_SIZE30, (hsize_t)TBLOCK_SIZE50);
- if(was_extended <= 0)
+ if (was_extended <= 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
@@ -727,15 +742,15 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
if (new_ma_addr != ma_addr)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size + TBLOCK_SIZE30 + TBLOCK_SIZE50))
+ if (new_file_size != (file_size + TBLOCK_SIZE30 + TBLOCK_SIZE50))
TEST_ERROR
PASSED();
@@ -750,17 +765,17 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
/* Skip test when using VFDs that has different address spaces for each
* type of metadata allocation.
*/
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
@@ -768,18 +783,19 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
type = H5FD_MEM_SUPER;
addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
- if(addr < (haddr_t)file_size)
+ if (addr < (haddr_t)file_size)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if(new_ma_addr != ma_addr)
+ if (new_ma_addr != ma_addr)
TEST_ERROR
- was_extended = H5MF_try_extend(f, type, (haddr_t)addr, (hsize_t)(TBLOCK_SIZE30-10), (hsize_t)(TBLOCK_SIZE50));
+ was_extended =
+ H5MF_try_extend(f, type, (haddr_t)addr, (hsize_t)(TBLOCK_SIZE30 - 10), (hsize_t)(TBLOCK_SIZE50));
/* should not succeed */
- if(was_extended > 0)
+ if (was_extended > 0)
TEST_ERROR
/* nothing should be changed in meta_aggr */
@@ -787,18 +803,18 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
if (new_ma_addr != ma_addr)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size + TBLOCK_SIZE30)
+ if (new_file_size != file_size + TBLOCK_SIZE30)
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -808,14 +824,16 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_eoa_extend() */
/*
@@ -844,159 +862,153 @@ error:
static unsigned
test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t file = -1; /* File ID */
- hid_t fapl2 = -1; /* File access property list */
- hid_t fcpl = -1; /* File creation property list */
+ hid_t file = -1; /* File ID */
+ hid_t fapl2 = -1; /* File access property list */
+ hid_t fcpl = -1; /* File creation property list */
- if(new_format)
+ if (new_format)
TESTING("'temporary' file space allocation with new library format")
else
TESTING("'temporary' file space allocation with old library format")
/* Can't run this test with multi-file VFDs */
- if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- haddr_t maxaddr; /* File's max. address */
- haddr_t tmp_addr; /* Temporary space file address */
- haddr_t norm_addr; /* Normal space file address */
- haddr_t check_addr; /* File address for checking for errors */
- unsigned char buf = 0; /* Buffer to read/write with */
- herr_t status; /* Generic status value */
+ if (HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ haddr_t maxaddr; /* File's max. address */
+ haddr_t tmp_addr; /* Temporary space file address */
+ haddr_t norm_addr; /* Normal space file address */
+ haddr_t check_addr; /* File address for checking for errors */
+ unsigned char buf = 0; /* Buffer to read/write with */
+ herr_t status; /* Generic status value */
/* Set the filename to use for this test */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
- if(new_format) {
+ if (new_format) {
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
} /* end if */
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, new_format?fapl2:fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, new_format ? fapl2 : fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Retrieve the file's maxaddr */
- if(H5F__get_maxaddr_test(file, &maxaddr) < 0)
+ if (H5F__get_maxaddr_test(file, &maxaddr) < 0)
FAIL_STACK_ERROR
/* Allocate some temporary address space */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)TBLOCK_SIZE30)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)TBLOCK_SIZE30)))
FAIL_STACK_ERROR
/* Check if temporary file address is valid */
- if(!H5F_IS_TMP_ADDR(f, tmp_addr))
+ if (!H5F_IS_TMP_ADDR(f, tmp_addr))
TEST_ERROR
- if(tmp_addr < (haddr_t)(maxaddr - TBLOCK_SIZE30))
+ if (tmp_addr < (haddr_t)(maxaddr - TBLOCK_SIZE30))
TEST_ERROR
/* Reading & writing with a temporary address value should fail */
- H5E_BEGIN_TRY {
- status = H5F_block_read(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), &buf);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5F_block_read(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), &buf); }
+ H5E_END_TRY;
+ if (status >= 0)
TEST_ERROR
- H5E_BEGIN_TRY {
- status = H5F_block_write(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), &buf);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5F_block_write(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), &buf); }
+ H5E_END_TRY;
+ if (status >= 0)
TEST_ERROR
/* Freeing a temporary address value should fail */
- H5E_BEGIN_TRY {
- status = H5MF_xfree(f, H5FD_MEM_SUPER, tmp_addr, (hsize_t)TBLOCK_SIZE30);
- } H5E_END_TRY;
- if(status >= 0)
+ H5E_BEGIN_TRY { status = H5MF_xfree(f, H5FD_MEM_SUPER, tmp_addr, (hsize_t)TBLOCK_SIZE30); }
+ H5E_END_TRY;
+ if (status >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
-
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate 1/3 of the file as temporary address space */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3))))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3))))
FAIL_STACK_ERROR
- if(!H5F_IS_TMP_ADDR(f, tmp_addr))
+ if (!H5F_IS_TMP_ADDR(f, tmp_addr))
TEST_ERROR
/* Allocate 1/3 of the file as normal address space */
- if(HADDR_UNDEF == (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)(maxaddr / 3))))
+ if (HADDR_UNDEF == (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)(maxaddr / 3))))
FAIL_STACK_ERROR
- if(H5F_IS_TMP_ADDR(f, norm_addr))
+ if (H5F_IS_TMP_ADDR(f, norm_addr))
TEST_ERROR
/* Test that pushing temporary space allocation into normal space fails */
- H5E_BEGIN_TRY {
- check_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3));
- } H5E_END_TRY;
- if(H5F_addr_defined(check_addr))
+ H5E_BEGIN_TRY { check_addr = H5MF_alloc_tmp(f, (hsize_t)(maxaddr / 3)); }
+ H5E_END_TRY;
+ if (H5F_addr_defined(check_addr))
TEST_ERROR
/* Test that pushing normal space allocation into temporary space fails */
- H5E_BEGIN_TRY {
- check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)(maxaddr / 3));
- } H5E_END_TRY;
- if(H5F_addr_defined(check_addr))
+ H5E_BEGIN_TRY { check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)(maxaddr / 3)); }
+ H5E_END_TRY;
+ if (H5F_addr_defined(check_addr))
TEST_ERROR
/* Free the normal block (so the file doesn't blow up to a huge size) */
- if(H5MF_xfree(f, H5FD_MEM_DRAW, norm_addr, (hsize_t)(maxaddr / 3)) < 0)
+ if (H5MF_xfree(f, H5FD_MEM_DRAW, norm_addr, (hsize_t)(maxaddr / 3)) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
PASSED();
@@ -1006,13 +1018,12 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
HDputs(" Current VFD doesn't support continuous address space");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_tmp() */
/*
@@ -1026,31 +1037,31 @@ error:
static unsigned
test_mf_fs_start(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FS_stat_t state;
-
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FS_stat_t state;
TESTING("H5MF_create_fstype()/H5MF__open_fstype() of free-space manager");
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -1058,54 +1069,55 @@ test_mf_fs_start(hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_start() */
-
/*
*-------------------------------------------------------------------------
* To verify that a block is allocated/freed from/to the free-space manager
@@ -1136,33 +1148,34 @@ error:
static unsigned
test_mf_fs_alloc_free(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
H5MF_free_section_t *sect_node = NULL;
- haddr_t addr;
- haddr_t tmp;
- H5FS_stat_t state;
+ haddr_t addr;
+ haddr_t tmp;
+ H5FS_stat_t state;
TESTING("H5MF_alloc()/H5MF_xfree() of free-space manager:test 1");
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -1170,27 +1183,27 @@ test_mf_fs_alloc_free(hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Create section A */
sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
/* Add section A to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -1198,21 +1211,21 @@ test_mf_fs_alloc_free(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 30 */
addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is section A in free-space */
- if(addr != TBLOCK_ADDR70)
+ if (addr != TBLOCK_ADDR70)
TEST_ERROR
state.tot_space -= TBLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block to free-space */
@@ -1221,21 +1234,22 @@ test_mf_fs_alloc_free(hid_t fapl)
state.tot_space += TBLOCK_SIZE30;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove section A from free-space */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) !=
+ TRUE)
TEST_ERROR
- if(tmp != TBLOCK_ADDR70)
+ if (tmp != TBLOCK_ADDR70)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -1247,27 +1261,27 @@ test_mf_fs_alloc_free(hid_t fapl)
TESTING("H5MF_alloc()/H5MF_xfree() of free-space manager:test 2");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Create section A */
sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
- /* Add section A to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ /* Add section A to free-space manager */
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -1275,20 +1289,20 @@ test_mf_fs_alloc_free(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 20 */
addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE20));
/* Verify that the allocated block is section A in free-space manager */
- if(addr != TBLOCK_ADDR70)
+ if (addr != TBLOCK_ADDR70)
TEST_ERROR
/* should still have 1 section of size 10 left in free-space manager */
state.tot_space -= (TBLOCK_SIZE20);
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block to free-space manager */
@@ -1296,21 +1310,22 @@ test_mf_fs_alloc_free(hid_t fapl)
/* Still 1 section in free-space because of merging */
state.tot_space += TBLOCK_SIZE20;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove section A from free-space */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) !=
+ TRUE)
TEST_ERROR
- if(tmp != TBLOCK_ADDR70)
+ if (tmp != TBLOCK_ADDR70)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -1322,27 +1337,27 @@ test_mf_fs_alloc_free(hid_t fapl)
TESTING("H5MF_alloc()/H5MF_xfree() of free-space manager:test 3");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Create section A */
sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
/* Add section A to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -1350,7 +1365,7 @@ test_mf_fs_alloc_free(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/*
@@ -1361,23 +1376,24 @@ test_mf_fs_alloc_free(hid_t fapl)
addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE40));
/* Verify that the allocated block is not section A in free-space */
- if(addr == TBLOCK_ADDR70)
+ if (addr == TBLOCK_ADDR70)
TEST_ERROR
/* free-space info should be the same */
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove section A from free-space */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) !=
+ TRUE)
TEST_ERROR
/* Verify that the block is section A in free-space */
- if(tmp != TBLOCK_ADDR70)
+ if (tmp != TBLOCK_ADDR70)
TEST_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block of size 40 to free-space */
@@ -1388,36 +1404,37 @@ test_mf_fs_alloc_free(hid_t fapl)
* The block is returned to free-space.
* It is shrunk and freed because it is at end of file.
*/
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_alloc_free() */
-
/*
*-------------------------------------------------------------------------
* To verify that a block allocated from the free-space manager can be extended
@@ -1460,34 +1477,35 @@ error:
static unsigned
test_mf_fs_extend(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl_new = -1; /* copy of fapl */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5MF_free_section_t *sect_node1 = NULL, *sect_node2=NULL;
- haddr_t addr;
- haddr_t tmp;
- H5FS_stat_t state; /* State of free space*/
- htri_t was_extended;
+ hid_t file = -1; /* File ID */
+ hid_t fapl_new = -1; /* copy of fapl */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5MF_free_section_t *sect_node1 = NULL, *sect_node2 = NULL;
+ haddr_t addr;
+ haddr_t tmp;
+ H5FS_stat_t state; /* State of free space*/
+ htri_t was_extended;
TESTING("H5MF_try_extend() of free-space manager:test 1");
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Turn off using meta/small data aggregator */
@@ -1495,27 +1513,27 @@ test_mf_fs_extend(hid_t fapl)
H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Create section A */
sect_node1 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
/* Add section A to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -1523,42 +1541,43 @@ test_mf_fs_extend(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 30 */
addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is section A in free-space manager */
- if(addr != TBLOCK_ADDR70)
+ if (addr != TBLOCK_ADDR70)
TEST_ERROR
state.tot_space -= TBLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Create section B */
sect_node2 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50);
/* Add section B to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
FAIL_STACK_ERROR
state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30, (hsize_t)TBLOCK_SIZE50);
+ was_extended = H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30,
+ (hsize_t)TBLOCK_SIZE50);
/* should succeed */
- if(was_extended <= 0)
+ if (was_extended <= 0)
TEST_ERROR
/* Section B is removed from free-space manager */
@@ -1566,32 +1585,33 @@ test_mf_fs_extend(hid_t fapl)
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the extended block to free-space manager */
- H5MF_xfree(f, H5FD_MEM_SUPER, addr, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50));
+ H5MF_xfree(f, H5FD_MEM_SUPER, addr, (hsize_t)(TBLOCK_SIZE30 + TBLOCK_SIZE50));
/* Verify that the extended block is back into free-space */
- state.tot_space += (TBLOCK_SIZE30+TBLOCK_SIZE50);
- state.tot_sect_count = 1;
+ state.tot_space += (TBLOCK_SIZE30 + TBLOCK_SIZE50);
+ state.tot_sect_count = 1;
state.serial_sect_count = 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove the extended block */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30 + TBLOCK_SIZE50),
+ f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
TEST_ERROR
- if(tmp != TBLOCK_ADDR70)
+ if (tmp != TBLOCK_ADDR70)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -1603,27 +1623,27 @@ test_mf_fs_extend(hid_t fapl)
TESTING("H5MF_try_extend() of free-space manager:test 2");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Create section A */
sect_node1 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
/* Add section A to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -1631,46 +1651,47 @@ test_mf_fs_extend(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 30 */
addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is section A in free-space manager */
- if(addr != TBLOCK_ADDR70)
+ if (addr != TBLOCK_ADDR70)
TEST_ERROR
state.tot_space -= TBLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Create section B */
sect_node2 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50);
/* Add section B to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
FAIL_STACK_ERROR
state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30, (hsize_t)(TBLOCK_SIZE50+10));
+ was_extended = H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30,
+ (hsize_t)(TBLOCK_SIZE50 + 10));
/* Should not be able to extend the allocated block */
- if(was_extended)
+ if (was_extended)
TEST_ERROR
/* free-space info should remain the same */
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the allocated block A to free-space */
@@ -1680,20 +1701,22 @@ test_mf_fs_extend(hid_t fapl)
/* rest of the info remains the same */
state.tot_space += TBLOCK_SIZE30;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove the merged sections A & B from free-space */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30 + TBLOCK_SIZE50),
+ f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
TEST_ERROR
- if(tmp != addr) TEST_ERROR
+ if (tmp != addr)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -1705,27 +1728,27 @@ test_mf_fs_extend(hid_t fapl)
TESTING("H5MF_try_extend() of free-space manager:test 3");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Create section A */
sect_node1 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30);
/* Add section A to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -1733,69 +1756,72 @@ test_mf_fs_extend(hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 30 */
addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is section A in free-space manager */
- if(addr != TBLOCK_ADDR70)
+ if (addr != TBLOCK_ADDR70)
TEST_ERROR
state.tot_space -= TBLOCK_SIZE30;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Create section B */
sect_node2 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50);
/* Add section B to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
FAIL_STACK_ERROR
state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30, (hsize_t)(TBLOCK_SIZE40));
+ was_extended = H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30,
+ (hsize_t)(TBLOCK_SIZE40));
/* Should succeed in extending the allocated block */
- if(was_extended <=0)
+ if (was_extended <= 0)
TEST_ERROR
/* Should have 1 section of size=10 left in free-space manager */
state.tot_space -= (TBLOCK_SIZE40);
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the extended block */
- H5MF_xfree(f, H5FD_MEM_SUPER, addr, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE40));
+ H5MF_xfree(f, H5FD_MEM_SUPER, addr, (hsize_t)(TBLOCK_SIZE30 + TBLOCK_SIZE40));
/* rest info is same, the extended section returned is merged with the section in free-space */
- state.tot_space += (TBLOCK_SIZE30+TBLOCK_SIZE40);
+ state.tot_space += (TBLOCK_SIZE30 + TBLOCK_SIZE40);
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove the merged sections A & B from free-space */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30 + TBLOCK_SIZE50),
+ f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
TEST_ERROR
- if(tmp != addr) TEST_ERROR
+ if (tmp != addr)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -1807,120 +1833,127 @@ test_mf_fs_extend(hid_t fapl)
TESTING("H5MF_try_extend() of free-space manager:test 4");
/* Re-open the file with meta/small data setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Create section A */
- sect_node1 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)(TBLOCK_SIZE30-10));
+ sect_node1 =
+ H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)(TBLOCK_SIZE30 - 10));
/* Add section A of size=20 to free-space */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
- state.tot_space += (TBLOCK_SIZE30-10);
+ state.tot_space += (TBLOCK_SIZE30 - 10);
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of size=20 */
- addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30-10));
+ addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30 - 10));
/* Verify that the allocated block is section A in free-space manager */
- if(addr != TBLOCK_ADDR70)
+ if (addr != TBLOCK_ADDR70)
TEST_ERROR
- state.tot_space -= (TBLOCK_SIZE30-10);
+ state.tot_space -= (TBLOCK_SIZE30 - 10);
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Create section B */
sect_node2 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50);
/* Add section B to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2))
FAIL_STACK_ERROR
state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Try to extend the allocated block */
- was_extended = H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)(TBLOCK_SIZE30-10), (hsize_t)TBLOCK_SIZE50);
+ was_extended = H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)TBLOCK_ADDR70, (hsize_t)(TBLOCK_SIZE30 - 10),
+ (hsize_t)TBLOCK_SIZE50);
/* Should not succeed in extending the allocated block */
- if(was_extended)
+ if (was_extended)
TEST_ERROR
/* Free-space info should be the same */
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the allocated block */
- H5MF_xfree(f, H5FD_MEM_SUPER, addr, (hsize_t)(TBLOCK_SIZE30-10));
+ H5MF_xfree(f, H5FD_MEM_SUPER, addr, (hsize_t)(TBLOCK_SIZE30 - 10));
- state.tot_space += (TBLOCK_SIZE30-10);
+ state.tot_space += (TBLOCK_SIZE30 - 10);
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Remove section A from free-space manger */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30-10), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30 - 10), f->shared->fs_man[H5FD_MEM_SUPER],
+ &tmp) != TRUE)
TEST_ERROR
- if(tmp != addr) TEST_ERROR
+ if (tmp != addr)
+ TEST_ERROR
/* Remove section B from free-space manager */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE50, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE50, f->shared->fs_man[H5FD_MEM_SUPER], &tmp) !=
+ TRUE)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl_new)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
FAIL_STACK_ERROR
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_new);
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_extend() */
/*
@@ -1952,47 +1985,47 @@ error:
static unsigned
test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- haddr_t addr, saddr;
- haddr_t tmp;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
- H5MF_free_section_t *sect_node=NULL;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ haddr_t addr, saddr;
+ haddr_t tmp;
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
+ H5MF_free_section_t *sect_node = NULL;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("A free-space section absorbs an aggregator: test 1");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Allocate a section from meta_aggr */
@@ -2000,18 +2033,21 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- /* Create a section */
- sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)(ma_addr+ma_size), (hsize_t)TBLOCK_SIZE2048);
+ /* Create a section */
+ sect_node =
+ H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)(ma_addr + ma_size), (hsize_t)TBLOCK_SIZE2048);
/* Add a section to free-space that adjoins end of the aggregator */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
- FAIL_STACK_ERROR
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ FAIL_STACK_ERROR
/* Verify that the section did absorb the aggregator */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(ma_addr+ma_size), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(ma_addr + ma_size),
+ f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
TEST_ERROR
- if(tmp != ma_addr) TEST_ERROR
+ if (tmp != ma_addr)
+ TEST_ERROR
/* Restore info for aggregator */
f->shared->meta_aggr.addr = ma_addr;
@@ -2020,7 +2056,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
/* Remove section from meta_aggr */
H5MF_xfree(f, H5FD_MEM_SUPER, addr, (hsize_t)TBLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -2033,22 +2069,22 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
TESTING("A free-space section absorbs an aggregator: test 2");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Allocate a section from meta_aggr */
@@ -2062,14 +2098,15 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)addr, (hsize_t)TBLOCK_SIZE30);
/* When adding, meta_aggr is absorbed onto the end of the section */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
FAIL_STACK_ERROR
/* Verify that the section did absorb the aggregator */
- if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(ma_size+TBLOCK_SIZE30), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
+ if (H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(ma_size + TBLOCK_SIZE30),
+ f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE)
TEST_ERROR
- if((tmp + TBLOCK_SIZE30) != ma_addr)
+ if ((tmp + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* restore info to meta_aggr */
@@ -2081,7 +2118,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
/* Remove section from sdata_aggr */
H5MF_xfree(f, H5FD_MEM_DRAW, saddr, (hsize_t)TBLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -2091,13 +2128,12 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_absorb() */
/*
@@ -2121,109 +2157,109 @@ error:
static unsigned
test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- hid_t fcpl; /* File creation property list */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ hid_t fcpl; /* File creation property list */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type;
haddr_t addr1, addr2;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 1");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* File creation property list template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR
/* Set to H5F_FSPACE_STRATEGY_AGGR strategy */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
TEST_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* Get the size of a file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
TEST_ERROR
/* Allocate first block from meta_aggr */
type = H5FD_MEM_SUPER;
- if((addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30)) == HADDR_UNDEF)
+ if ((addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30)) == HADDR_UNDEF)
TEST_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr1+TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
- if((addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50)) == HADDR_UNDEF)
+ if ((addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50)) == HADDR_UNDEF)
TEST_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr2+TBLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
- if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
+ if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != (file_size+TBLOCK_SIZE30+TBLOCK_SIZE50))
+ if (new_file_size != (file_size + TBLOCK_SIZE30 + TBLOCK_SIZE50))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
TEST_ERROR
/* Free the two blocks: order matters because of H5F_FSPACE_STRATEGY_AGGR strategy */
- if(H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE50) < 0)
+ if (H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE50) < 0)
TEST_ERROR
- if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30) < 0)
+ if (H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30) < 0)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
if (new_file_size != file_size)
TEST_ERROR
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
TEST_ERROR
PASSED();
@@ -2233,14 +2269,16 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file);
H5Pclose(fcpl);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc1() */
/*
@@ -2271,55 +2309,55 @@ error:
static unsigned
test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type;
haddr_t addr1, addr2, addr3;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 2");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of a file */
- if((file_size= h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr1+TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr2+TBLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
@@ -2329,39 +2367,39 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr3+TBLOCK_SIZE2058) != ma_addr)
+ if ((addr3 + TBLOCK_SIZE2058) != ma_addr)
TEST_ERROR
- if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
+ if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
/* Unused space is freed from the end of the file */
- if(new_file_size != (file_size+TBLOCK_SIZE30+TBLOCK_SIZE50+TBLOCK_SIZE2058))
+ if (new_file_size != (file_size + TBLOCK_SIZE30 + TBLOCK_SIZE50 + TBLOCK_SIZE2058))
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
- H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30+TBLOCK_SIZE50+TBLOCK_SIZE2058);
+ H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30 + TBLOCK_SIZE50 + TBLOCK_SIZE2058);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -2375,13 +2413,12 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc2() */
/*
@@ -2425,52 +2462,52 @@ error:
static unsigned
test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3, addr4, saddr1;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- haddr_t sdata_addr=HADDR_UNDEF;
- hsize_t sdata_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ haddr_t sdata_addr = HADDR_UNDEF;
+ hsize_t sdata_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator: test 3");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate first block from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
@@ -2478,18 +2515,19 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr2+TBLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
- if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
+ if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
/* Allocate first block from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if((saddr1+TBLOCK_SIZE30) != sdata_addr)
+ if ((saddr1 + TBLOCK_SIZE30) != sdata_addr)
+ TEST_ERROR
+ if (sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30))
TEST_ERROR
- if(sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) TEST_ERROR
/* Allocate third block, which is from file allocation not from meta_aggr */
addr3 = H5MF_alloc(f, type, (hsize_t)(TBLOCK_SIZE2058));
@@ -2497,17 +2535,20 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
/* info for meta_aggr shouldn't be changed */
- if(addr3 != (sdata_addr+sdata_size)) TEST_ERROR
- if((addr3+TBLOCK_SIZE2058) == new_ma_addr) TEST_ERROR
- if((new_ma_addr != ma_addr) || (new_ma_size != ma_size)) TEST_ERROR
+ if (addr3 != (sdata_addr + sdata_size))
+ TEST_ERROR
+ if ((addr3 + TBLOCK_SIZE2058) == new_ma_addr)
+ TEST_ERROR
+ if ((new_ma_addr != ma_addr) || (new_ma_size != ma_size))
+ TEST_ERROR
/* Allocate fourth block, which should be from meta_aggr */
addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr4+TBLOCK_SIZE50) != ma_addr)
+ if ((addr4 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
- if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50 + TBLOCK_SIZE50)))
+ if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50 + TBLOCK_SIZE50)))
TEST_ERROR
/* Free all the allocated blocks */
@@ -2517,15 +2558,15 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, addr4, (hsize_t)TBLOCK_SIZE50);
H5MF_xfree(f, stype, saddr1, (hsize_t)TBLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
PASSED();
@@ -2535,16 +2576,14 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc3() */
-
/*
*-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
@@ -2590,91 +2629,91 @@ error:
static unsigned
test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* File size */
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* File size */
+ H5FD_mem_t type, stype;
haddr_t addr1, addr2, saddr1, saddr2, saddr3;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 4");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate first block from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr1+TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
- if(ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30))
+ if (ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30))
TEST_ERROR
/* Allocate first block from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if((saddr1+TBLOCK_SIZE30) != sdata_addr)
+ if ((saddr1 + TBLOCK_SIZE30) != sdata_addr)
TEST_ERROR
/* Allocate second block from sdata_aggr */
saddr2 = H5MF_alloc(f, stype, (hsize_t)(TBLOCK_SIZE2048 - TBLOCK_SIZE30));
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if(saddr2+(TBLOCK_SIZE2048 - TBLOCK_SIZE30) != sdata_addr)
+ if (saddr2 + (TBLOCK_SIZE2048 - TBLOCK_SIZE30) != sdata_addr)
TEST_ERROR
/* Allocate third block from sdata_aggr */
saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if((saddr3+TBLOCK_SIZE50) != sdata_addr)
+ if ((saddr3 + TBLOCK_SIZE50) != sdata_addr)
TEST_ERROR
- if(sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE50))
+ if (sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE50))
TEST_ERROR
/* Allocate second block of 2058, which is from file allocation, not from meta_aggr */
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2058);
- if(addr2 != sdata_addr)
+ if (addr2 != sdata_addr)
TEST_ERROR
/* sdata_aggr is reset 0 */
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if((sdata_addr != 0) && (sdata_size != 0))
+ if ((sdata_addr != 0) && (sdata_size != 0))
TEST_ERROR
/* info is unchanged in meta_aggr */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if((new_ma_addr != ma_addr) && (new_ma_size != ma_size))
+ if ((new_ma_addr != ma_addr) && (new_ma_size != ma_size))
TEST_ERROR
/* Free all the allocated blocks */
@@ -2684,15 +2723,15 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, stype, saddr2, (hsize_t)TBLOCK_SIZE2048 - TBLOCK_SIZE30);
H5MF_xfree(f, stype, saddr3, (hsize_t)TBLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
PASSED();
@@ -2702,13 +2741,12 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc4() */
/*
@@ -2729,77 +2767,78 @@ error:
*
* Allocate third block (1970) from meta_aggr:
* request-size is > what is left in meta_aggr and is < meta_aggr->alloc_size
- * Result: A block of meta_aggr->alloc_size is extended via file allocation and is absorbed into the meta_aggr
- * The block of 1970 is allocated from there
- * There is space of 2046 left in meta_aggr
+ * Result: A block of meta_aggr->alloc_size is extended via file allocation and is absorbed into the
+ *meta_aggr The block of 1970 is allocated from there There is space of 2046 left in meta_aggr
*
*-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* File size */
- H5FD_mem_t type;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* File size */
+ H5FD_mem_t type;
haddr_t addr1, addr2, addr3;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 5");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate first block from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr1+TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if(addr2+TBLOCK_SIZE50 != ma_addr)
+ if (addr2 + TBLOCK_SIZE50 != ma_addr)
TEST_ERROR
- if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30+TBLOCK_SIZE50)))
+ if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
/* Allocate third block from meta_aggr */
addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1970);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if(addr3 != ma_addr) TEST_ERROR
- if((addr3+TBLOCK_SIZE1970) != new_ma_addr) TEST_ERROR
- if(new_ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE1970 - ma_size)))
+ if (addr3 != ma_addr)
+ TEST_ERROR
+ if ((addr3 + TBLOCK_SIZE1970) != new_ma_addr)
+ TEST_ERROR
+ if (new_ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE1970 - ma_size)))
TEST_ERROR
/* Free all the allocated blocks */
@@ -2807,15 +2846,15 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE50);
H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE1970);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
PASSED();
@@ -2825,13 +2864,12 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc5() */
/*
@@ -2871,43 +2909,43 @@ error:
static unsigned
test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size; /* file size */
+ H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3, saddr1;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
- H5FS_stat_t state;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0;
+ H5FS_stat_t state;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 6");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
type = H5FD_MEM_SUPER;
@@ -2916,45 +2954,50 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr1+TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate second block from meta_aggr */
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if(addr2+TBLOCK_SIZE50 != ma_addr)
+ if (addr2 + TBLOCK_SIZE50 != ma_addr)
TEST_ERROR
- if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
+ if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
/* Allocate first block from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if((saddr1+TBLOCK_SIZE30) != sdata_addr) TEST_ERROR
- if(sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) TEST_ERROR
+ if ((saddr1 + TBLOCK_SIZE30) != sdata_addr)
+ TEST_ERROR
+ if (sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30))
+ TEST_ERROR
/* Allocate third block from meta_aggr */
addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1970);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if((addr3+TBLOCK_SIZE1970) != new_ma_addr) TEST_ERROR
- if(addr3 != (sdata_addr+sdata_size)) TEST_ERROR
+ if ((addr3 + TBLOCK_SIZE1970) != new_ma_addr)
+ TEST_ERROR
+ if (addr3 != (sdata_addr + sdata_size))
+ TEST_ERROR
- if((ma_addr+TBLOCK_SIZE1970) == new_ma_addr) TEST_ERROR
- if(new_ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE1970))
+ if ((ma_addr + TBLOCK_SIZE1970) == new_ma_addr)
+ TEST_ERROR
+ if (new_ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE1970))
TEST_ERROR
/* Verify that meta_aggr's unused space of 1968 is freed to free-space */
HDmemset(&state, 0, sizeof(H5FS_stat_t));
- state.tot_space += (TBLOCK_SIZE2048 - (TBLOCK_SIZE30+TBLOCK_SIZE50));
+ state.tot_space += (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50));
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free all the allocated blocks */
@@ -2963,15 +3006,15 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE1970);
H5MF_xfree(f, stype, saddr1, (hsize_t)TBLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((new_file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(new_file_size != file_size)
+ if (new_file_size != file_size)
TEST_ERROR
PASSED();
@@ -2981,13 +3024,12 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc6() */
/*
@@ -3038,81 +3080,82 @@ error:
static unsigned
test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t empty_size, file_size;
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t empty_size, file_size;
+ H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3, saddr1, saddr2, saddr3;
- haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, sdata_size=0;
- H5FS_stat_t state;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, sdata_size = 0;
+ H5FS_stat_t state;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_alloc() of meta/sdata aggregator:test 7");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate the first block from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate the second block from meta_aggr */
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (addr2+TBLOCK_SIZE50 != ma_addr)
+ if (addr2 + TBLOCK_SIZE50 != ma_addr)
TEST_ERROR
if (ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50)))
TEST_ERROR
/* Allocate the first block from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr1+TBLOCK_SIZE30) != sdata_addr)
+ if ((saddr1 + TBLOCK_SIZE30) != sdata_addr)
TEST_ERROR
/* Allocate the second block from sdata_aggr */
saddr2 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE2048 - TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr2+(TBLOCK_SIZE2048 - TBLOCK_SIZE30)) != sdata_addr)
+ if ((saddr2 + (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) != sdata_addr)
+ TEST_ERROR
+ if (sdata_size != 0)
TEST_ERROR
- if (sdata_size != 0) TEST_ERROR
/* Allocate the third block from sdata_aggr */
saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if ((saddr3+TBLOCK_SIZE50) != sdata_addr)
+ if ((saddr3 + TBLOCK_SIZE50) != sdata_addr)
TEST_ERROR
if (sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE50))
TEST_ERROR
@@ -3121,14 +3164,19 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1970);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if (addr3 != sdata_addr) TEST_ERROR
- if ((addr3 + TBLOCK_SIZE1970) != ma_addr) TEST_ERROR
- if (ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE1970)) TEST_ERROR
+ if (addr3 != sdata_addr)
+ TEST_ERROR
+ if ((addr3 + TBLOCK_SIZE1970) != ma_addr)
+ TEST_ERROR
+ if (ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE1970))
+ TEST_ERROR
/* sdata_aggr info is reset to 0 */
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != HADDR_UNDEF) TEST_ERROR
- if (sdata_size != 0) TEST_ERROR
+ if (sdata_addr != HADDR_UNDEF)
+ TEST_ERROR
+ if (sdata_size != 0)
+ TEST_ERROR
/* Verify that meta_aggr's unused space of 1968 is freed to free-space */
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -3136,7 +3184,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
/* Free all the allocated blocks */
@@ -3147,11 +3195,11 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, stype, saddr2, (hsize_t)(TBLOCK_SIZE2048 - TBLOCK_SIZE30));
H5MF_xfree(f, stype, saddr3, (hsize_t)TBLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -3165,13 +3213,12 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_alloc7() */
/*
@@ -3201,50 +3248,50 @@ error:
static unsigned
test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t empty_size = 0, file_size;
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t empty_size = 0, file_size;
+ H5FD_mem_t type, stype;
haddr_t new_addr, addr, saddr;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
- htri_t was_extended;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0;
+ htri_t was_extended;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_try_extend() of meta/sdata aggregator: test 1");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate the first block from meta_aggr */
type = H5FD_MEM_SUPER;
addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr+TBLOCK_SIZE30) != ma_addr)
+ if ((addr + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Adjust meta_aggr's info info for testing */
@@ -3257,14 +3304,15 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
was_extended = H5MF_try_extend(f, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE50));
/* should succeed */
- if(!was_extended)
+ if (!was_extended)
TEST_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if(new_ma_addr != (addr+TBLOCK_SIZE50))
+ if (new_ma_addr != (addr + TBLOCK_SIZE50))
+ TEST_ERROR
+ if (new_ma_size != (f->shared->meta_aggr.alloc_size - TBLOCK_SIZE50))
TEST_ERROR
- if(new_ma_size != (f->shared->meta_aggr.alloc_size - TBLOCK_SIZE50)) TEST_ERROR
/* Free the allocated blocks */
H5MF_xfree(f, type, addr, (hsize_t)TBLOCK_SIZE50);
@@ -3273,14 +3321,15 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
was_extended = H5MF_try_extend(f, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE700));
/* should succeed */
- if(!was_extended)
+ if (!was_extended)
TEST_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if(new_ma_addr != (addr + TBLOCK_SIZE700))
+ if (new_ma_addr != (addr + TBLOCK_SIZE700))
+ TEST_ERROR
+ if (new_ma_size != (f->shared->meta_aggr.alloc_size * 2 - TBLOCK_SIZE700))
TEST_ERROR
- if(new_ma_size != (f->shared->meta_aggr.alloc_size * 2 - TBLOCK_SIZE700)) TEST_ERROR
/* Free the allocated blocks */
H5MF_xfree(f, type, addr, (hsize_t)TBLOCK_SIZE700);
@@ -3289,23 +3338,24 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
was_extended = H5MF_try_extend(f, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE2058));
/* should succeed */
- if(!was_extended)
+ if (!was_extended)
TEST_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
if (new_ma_addr != (addr + TBLOCK_SIZE2058))
TEST_ERROR
- if (new_ma_size != f->shared->meta_aggr.size) TEST_ERROR
+ if (new_ma_size != f->shared->meta_aggr.size)
+ TEST_ERROR
/* Free the allocated blocks */
H5MF_xfree(f, type, addr, (hsize_t)TBLOCK_SIZE2058);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
@@ -3322,27 +3372,27 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
TESTING("H5MF_try_extend() of meta/sdata aggregator: test 2");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate the first block from meta_aggr */
type = H5FD_MEM_SUPER;
addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr+TBLOCK_SIZE30) != ma_addr)
+ if ((addr + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate the first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
saddr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if((saddr+TBLOCK_SIZE50) != sdata_addr)
+ if ((saddr + TBLOCK_SIZE50) != sdata_addr)
TEST_ERROR
/* Adjust meta_aggr's info info for testing */
@@ -3354,14 +3404,14 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
/* should be able to fulfill request from the aggreqator itself */
was_extended = H5MF_try_extend(f, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE50));
- if(!was_extended)
+ if (!was_extended)
TEST_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if(new_ma_addr != (addr+TBLOCK_SIZE50))
+ if (new_ma_addr != (addr + TBLOCK_SIZE50))
TEST_ERROR
- if(new_ma_size != (f->shared->meta_aggr.alloc_size-TBLOCK_SIZE50))
+ if (new_ma_size != (f->shared->meta_aggr.alloc_size - TBLOCK_SIZE50))
TEST_ERROR
/* Restore info for meta_aggr */
@@ -3371,15 +3421,15 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, addr, (hsize_t)TBLOCK_SIZE30);
H5MF_xfree(f, stype, saddr, (hsize_t)TBLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -3392,27 +3442,27 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
TESTING("H5MF_try_extend() of meta/sdata aggregator: test 3");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate first block from meta_aggr */
type = H5FD_MEM_SUPER;
addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr+TBLOCK_SIZE30) != ma_addr)
+ if ((addr + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate first block from sdata_aggr */
stype = H5FD_MEM_DRAW;
saddr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if((saddr+TBLOCK_SIZE50) != sdata_addr)
+ if ((saddr + TBLOCK_SIZE50) != sdata_addr)
TEST_ERROR
/* Adjust meta_aggr's info info for testing */
@@ -3424,13 +3474,15 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
/* unable to fulfill request from the aggreqator itself */
was_extended = H5MF_try_extend(f, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TBLOCK_SIZE50));
- if(was_extended)
+ if (was_extended)
TEST_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != addr) TEST_ERROR
- if (new_ma_size != 0) TEST_ERROR
+ if (new_ma_addr != addr)
+ TEST_ERROR
+ if (new_ma_size != 0)
+ TEST_ERROR
/* restore info for meta_aggr */
f->shared->meta_aggr.addr = ma_addr;
@@ -3439,15 +3491,15 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, type, addr, (hsize_t)TBLOCK_SIZE30);
H5MF_xfree(f, stype, saddr, (hsize_t)TBLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -3457,13 +3509,12 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_extend() */
/*
@@ -3491,72 +3542,73 @@ error:
static unsigned
test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t empty_size = 0, file_size;
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t empty_size = 0, file_size;
+ H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3, saddr1;
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- haddr_t new_sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0;
- hsize_t sdata_size=0, new_sdata_size=0;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ haddr_t new_sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0;
+ hsize_t sdata_size = 0, new_sdata_size = 0;
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 1");
/* Skip test when using VFDs that don't use the metadata aggregator */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate block A from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
ma_addr = new_ma_addr - TBLOCK_SIZE30;
- if((addr1 + TBLOCK_SIZE30) != new_ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != new_ma_addr)
TEST_ERROR
/* should succeed */
- if(H5MF_try_shrink(f, type, addr1, (hsize_t)TBLOCK_SIZE30) <= 0)
+ if (H5MF_try_shrink(f, type, addr1, (hsize_t)TBLOCK_SIZE30) <= 0)
TEST_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if(new_ma_addr != ma_addr) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -3569,53 +3621,59 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 2");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate block A from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR
- if(ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) TEST_ERROR
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
+ TEST_ERROR
+ if (ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30))
+ TEST_ERROR
/* Allocate block B from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->sdata_aggr), NULL, &sdata_size);
/* should succeed */
- if(H5MF_try_shrink(f, stype, saddr1, (hsize_t)TBLOCK_SIZE50) <= 0)
+ if (H5MF_try_shrink(f, stype, saddr1, (hsize_t)TBLOCK_SIZE50) <= 0)
TEST_ERROR
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size);
- if(new_sdata_addr != saddr1) TEST_ERROR
- if(new_sdata_size != sdata_size + TBLOCK_SIZE50) TEST_ERROR
+ if (new_sdata_addr != saddr1)
+ TEST_ERROR
+ if (new_sdata_size != sdata_size + TBLOCK_SIZE50)
+ TEST_ERROR
/* meta_aggr info should be updated because the block is absorbed into the meta_aggr */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != (ma_size)) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
+ if (new_ma_size != (ma_size))
+ TEST_ERROR
H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -3628,56 +3686,57 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 3");
/* Skip test when using VFDs that don't use the metadata aggregator */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate block A from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr1+TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* Allocate block B from meta_aggr */
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr2+TBLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/* Allocate block C from meta_aggr */
- addr3 = H5MF_alloc(f, type, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50));
+ addr3 = H5MF_alloc(f, type, (hsize_t)(TBLOCK_SIZE30 + TBLOCK_SIZE50));
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr3+TBLOCK_SIZE30+TBLOCK_SIZE50) != ma_addr)
+ if ((addr3 + TBLOCK_SIZE30 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/* should not succeed */
- if(H5MF_try_shrink(f, type, addr2, (hsize_t)TBLOCK_SIZE50) > 0)
+ if (H5MF_try_shrink(f, type, addr2, (hsize_t)TBLOCK_SIZE50) > 0)
TEST_ERROR
/* aggregator info should be the same as before */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if(new_ma_addr != ma_addr) TEST_ERROR
+ if (new_ma_addr != ma_addr)
+ TEST_ERROR
H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30);
H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE50);
- H5MF_xfree(f, type, addr3, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50));
+ H5MF_xfree(f, type, addr3, (hsize_t)(TBLOCK_SIZE30 + TBLOCK_SIZE50));
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify the file is the correct size */
- if(file_size != empty_size)
+ if (file_size != empty_size)
TEST_ERROR
PASSED();
@@ -3687,13 +3746,12 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl)
HDputs(" Current VFD doesn't support metadata aggregator");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_aggr_absorb() */
/*
@@ -3731,117 +3789,122 @@ error:
static unsigned
test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- hid_t fapl1 = -1;
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size;
- H5FD_mem_t type;
+ hid_t file = -1; /* File ID */
+ hid_t fapl1 = -1;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size, new_file_size;
+ H5FD_mem_t type;
haddr_t addr1, addr2;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0;
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0;
htri_t was_extended;
- H5FS_stat_t state;
- hsize_t alignment=0, mis_align=0, tmp=0, accum=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
+ H5FS_stat_t state;
+ hsize_t alignment = 0, mis_align = 0, tmp = 0, accum = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MM_alloc() of file allocation with alignment: test 1");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Turn off using meta/small data aggregator */
- if((fapl1 = H5Pcopy(new_fapl)) < 0) TEST_ERROR
+ if ((fapl1 = H5Pcopy(new_fapl)) < 0)
+ TEST_ERROR
H5Pset_meta_block_size(fapl1, (hsize_t)0);
H5Pset_small_data_block_size(fapl1, (hsize_t)0);
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* get alignment setting */
- if(H5Pget_alignment(fapl1, NULL, &alignment) < 0)
+ if (H5Pget_alignment(fapl1, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
- if((tmp = (hsize_t)file_size % alignment))
- mis_align = alignment - tmp;
+ if ((tmp = (hsize_t)file_size % alignment))
+ mis_align = alignment - tmp;
accum = mis_align + TBLOCK_SIZE30;
/* Allocate a block of 30 from file allocation */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if(addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* there should be nothing in the aggregator */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if(ma_addr || ma_size) TEST_ERROR
+ if (ma_addr || ma_size)
+ TEST_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
}
/* calculate fragment for alignment of block 50 */
mis_align = 0;
if ((tmp = ((hsize_t)file_size + accum) % alignment))
- mis_align = alignment - tmp;
+ mis_align = alignment - tmp;
accum += (mis_align + TBLOCK_SIZE50);
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* there should be nothing in the aggregator */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if(ma_addr || ma_size) TEST_ERROR
+ if (ma_addr || ma_size)
+ TEST_ERROR
- if(mis_align) {
+ if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
}
H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30);
H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE50);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
if (new_file_size != file_size)
@@ -3859,48 +3922,50 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- if(have_alloc_vfd) {
+ if (have_alloc_vfd) {
/* Re-open the file with alignment and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* allocate a block of 50 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
/* address should be aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* shrink the block */
- if(H5MF_try_shrink(f, type, addr1, (hsize_t)TBLOCK_SIZE50) <= 0)
+ if (H5MF_try_shrink(f, type, addr1, (hsize_t)TBLOCK_SIZE50) <= 0)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
- if (new_file_size != (file_size-TBLOCK_SIZE50)) TEST_ERROR
+ if (new_file_size != (file_size - TBLOCK_SIZE50))
+ TEST_ERROR
PASSED();
} /* end if */
@@ -3914,49 +3979,53 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- if(have_alloc_vfd) {
+ if (have_alloc_vfd) {
/* Re-open the file with alignment and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* allocate a block of 50 */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
/* address should be aligned */
- if(addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* try to extend the block */
- was_extended = H5MF_try_extend(f, type, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE50, (hsize_t)TBLOCK_SIZE30);
+ was_extended =
+ H5MF_try_extend(f, type, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE50, (hsize_t)TBLOCK_SIZE30);
- if(was_extended <=0) TEST_ERROR
+ if (was_extended <= 0)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
+ if ((new_file_size = h5_get_file_size(filename, fapl1)) < 0)
TEST_ERROR
- if (new_file_size != (file_size+TBLOCK_SIZE30)) TEST_ERROR
+ if (new_file_size != (file_size + TBLOCK_SIZE30))
+ TEST_ERROR
PASSED();
} /* end if */
@@ -3965,13 +4034,12 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
HDputs(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_eoa() */
/*
@@ -4009,16 +4077,16 @@ error:
static unsigned
test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- h5_stat_size_t file_size;
- H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ h5_stat_size_t file_size;
+ H5F_t * f = NULL; /* Internal file object pointer */
H5MF_free_section_t *sect_node = NULL;
- haddr_t addr;
- H5FS_stat_t state;
- htri_t was_extended;
- hsize_t alignment=0, tmp=0, mis_align=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
+ haddr_t addr;
+ H5FS_stat_t state;
+ htri_t was_extended;
+ hsize_t alignment = 0, tmp = 0, mis_align = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of free-space manager with alignment: test 1");
@@ -4026,39 +4094,39 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
- TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
- TEST_ERROR
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ TEST_ERROR
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ TEST_ERROR
/* Create section A */
sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)alignment, (hsize_t)TBLOCK_SIZE50);
/* Add section A to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -4066,21 +4134,23 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 50 */
addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is section A in free-space */
- if(addr != (haddr_t)alignment) TEST_ERROR
- if(addr % alignment) TEST_ERROR
+ if (addr != (haddr_t)alignment)
+ TEST_ERROR
+ if (addr % alignment)
+ TEST_ERROR
state.tot_space -= TBLOCK_SIZE50;
state.tot_sect_count -= 1;
state.serial_sect_count -= 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block to free-space */
@@ -4089,39 +4159,38 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
state.tot_space += TBLOCK_SIZE50;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
TESTING("H5MF_alloc() of free-space manager with alignment: test 2");
-
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Create section A */
sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE8000);
/* Add section A to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -4129,45 +4198,48 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Allocate a block of 600 */
addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE600);
/* Verify that the allocated block is aligned */
- if (addr % alignment) TEST_ERROR
+ if (addr % alignment)
+ TEST_ERROR
/* should have 1 more section in free-space */
state.tot_space -= TBLOCK_SIZE600;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* try to extend the block */
- was_extended = H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)addr, (hsize_t)TBLOCK_SIZE600, (hsize_t)TBLOCK_SIZE200);
+ was_extended =
+ H5MF_try_extend(f, H5FD_MEM_SUPER, (haddr_t)addr, (hsize_t)TBLOCK_SIZE600, (hsize_t)TBLOCK_SIZE200);
- if(was_extended <=0) TEST_ERROR
+ if (was_extended <= 0)
+ TEST_ERROR
/* space should be decreased by 200, # of sections remain the same */
state.tot_space -= TBLOCK_SIZE200;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/* Free the block to free-space manager */
- H5MF_xfree(f, H5FD_MEM_SUPER, addr, (hsize_t)(TBLOCK_SIZE600+TBLOCK_SIZE200));
+ H5MF_xfree(f, H5FD_MEM_SUPER, addr, (hsize_t)(TBLOCK_SIZE600 + TBLOCK_SIZE200));
/* only 1 section in free-space because of merging */
- state.tot_space += (TBLOCK_SIZE600+TBLOCK_SIZE200);
- state.tot_sect_count = 1;
+ state.tot_space += (TBLOCK_SIZE600 + TBLOCK_SIZE200);
+ state.tot_sect_count = 1;
state.serial_sect_count = 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4177,34 +4249,34 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
- if((file_size = h5_get_file_size(filename, new_fapl)) < 0)
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
+ if ((file_size = h5_get_file_size(filename, new_fapl)) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
+ if (H5MF__start_fstype(f, (H5F_mem_page_t)H5FD_MEM_SUPER) < 0)
FAIL_STACK_ERROR
- if(f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
+ if (f->shared->fs_state[H5FD_MEM_SUPER] != H5F_FS_STATE_OPEN)
TEST_ERROR
- if(f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
+ if (f->shared->fs_man[H5FD_MEM_SUPER]->client != H5FS_CLIENT_FILE_ID)
TEST_ERROR
/* Create section A */
sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE700);
/* Add section A to free-space manager */
- if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
+ if (H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node))
FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(H5FS_stat_t));
@@ -4212,7 +4284,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
state.tot_sect_count += 1;
state.serial_sect_count += 1;
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
/*
* Allocate a block of 40
@@ -4222,11 +4294,12 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE40));
/* Verify that the allocated block is aligned */
- if(addr % alignment)
+ if (addr % alignment)
TEST_ERROR
/* verify that the allocated block is from file allocation, not section A in free-space */
- if (!(addr >= (haddr_t)file_size)) TEST_ERROR
+ if (!(addr >= (haddr_t)file_size))
+ TEST_ERROR
/* calculate fragment for alignment of block 40 from file allocation */
if ((tmp = (hsize_t)file_size % alignment))
@@ -4239,10 +4312,10 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
/* free-space info should be the same */
- if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
+ if (check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4252,13 +4325,12 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
HDputs(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_fs() */
/*
@@ -4362,69 +4434,69 @@ error:
static unsigned
test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size; /* File size */
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size; /* File size */
- H5FD_mem_t type;
- haddr_t addr1, addr2, addr3, addr4;
+ H5FD_mem_t type;
+ haddr_t addr1, addr2, addr3, addr4;
H5FS_stat_t state;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, mis_align=0;
- hsize_t alignment=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
-
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, mis_align = 0;
+ hsize_t alignment = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 1");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
- if((tmp = (hsize_t)file_size % alignment))
+ if ((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if(addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(H5FS_stat_t));
- if(mis_align) {
+ if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -4437,17 +4509,18 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* calculate fragment for alignment of block 50 */
mis_align = 0;
- if((tmp = ma_addr % alignment))
+ if ((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 50 from meta_aggr */
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if(addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -4455,7 +4528,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr2 + TBLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/* calculate fragment for alignment of block 80 */
@@ -4466,10 +4539,11 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if(addr3 % alignment) TEST_ERROR
+ if (addr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 80 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -4477,22 +4551,23 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr3 + TBLOCK_SIZE80) != ma_addr)
+ if ((addr3 + TBLOCK_SIZE80) != ma_addr)
TEST_ERROR
/* calculate fragment for alignment of block 1970 */
mis_align = 0;
- if((tmp = ma_addr % alignment))
+ if ((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 1970 from meta_aggr */
addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1970);
/* Verify that the allocated block is aligned */
- if(addr4 % alignment) TEST_ERROR
+ if (addr4 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 1970 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -4500,11 +4575,11 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr4 + TBLOCK_SIZE1970) != ma_addr)
+ if ((addr4 + TBLOCK_SIZE1970) != ma_addr)
TEST_ERROR
/* Verify total size of free space after all the allocations */
- if(check_stats(f, f->shared->fs_man[type], &state))
+ if (check_stats(f, f->shared->fs_man[type], &state))
TEST_ERROR
H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30);
@@ -4512,7 +4587,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE80);
H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE1970);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4522,13 +4597,12 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
HDputs(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc1() */
/*
@@ -4620,67 +4694,68 @@ error:
static unsigned
test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size; /* File size */
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size; /* File size */
+ H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3, saddr1;
- H5FS_stat_t state[H5FD_MEM_NTYPES];
- haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, sdata_size=0, mis_align=0;
- hsize_t alignment=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
+ H5FS_stat_t state[H5FD_MEM_NTYPES];
+ haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, sdata_size = 0, mis_align = 0;
+ hsize_t alignment = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 2");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
- if((tmp = (hsize_t)file_size % alignment))
+ if ((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if(addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(H5FS_stat_t) * H5FD_MEM_NTYPES);
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -4688,21 +4763,22 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr1 + TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
mis_align = 0;
- if((tmp = ma_addr % alignment))
+ if ((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if(addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -4710,7 +4786,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr2 + TBLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/*
@@ -4725,29 +4801,31 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
* block 30 is allocated from ma_addr
*/
mis_align = 0;
- if((alignment == TEST_ALIGN1024) && (tmp = ((ma_addr + ma_size) % alignment)))
+ if ((alignment == TEST_ALIGN1024) && (tmp = ((ma_addr + ma_size) % alignment)))
mis_align = alignment - tmp;
else if ((alignment == TEST_ALIGN4096) && (tmp = (ma_addr % alignment)))
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
/* fragment for alignment of block 30 for sdata_aggr is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
}
/* Verify that the allocated block is aligned */
- if (saddr1 % alignment) TEST_ERROR
+ if (saddr1 % alignment)
+ TEST_ERROR
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if(sdata_addr != (saddr1 + TBLOCK_SIZE30)) TEST_ERROR
+ if (sdata_addr != (saddr1 + TBLOCK_SIZE30))
+ TEST_ERROR
/*
* Calculate fragment for the allocation of block 80 from meta_aggr:
@@ -4759,7 +4837,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
* block 30 is allocated from ma_addr
*/
mis_align = 0;
- if((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment)))
+ if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment)))
mis_align = alignment - tmp;
else if ((alignment == TEST_ALIGN4096) && (tmp = ((sdata_addr + sdata_size) % alignment)))
mis_align = alignment - tmp;
@@ -4768,10 +4846,11 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if (addr3 % alignment) TEST_ERROR
+ if (addr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 80 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -4779,26 +4858,26 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr3 + TBLOCK_SIZE80) != ma_addr)
+ if ((addr3 + TBLOCK_SIZE80) != ma_addr)
TEST_ERROR
/* Verify total size of free space after all the allocations */
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &(state[type])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
- if(f->shared->fs_man[stype]) {
- if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[stype]) {
+ if (check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30);
H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE50);
H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE80);
H5MF_xfree(f, stype, saddr1, (hsize_t)TBLOCK_SIZE30);
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4808,13 +4887,12 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
HDputs(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc2() */
/*
@@ -4957,69 +5035,69 @@ error:
static unsigned
test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size;
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size;
+ H5FD_mem_t type, stype;
haddr_t addr1, addr2, addr3;
haddr_t saddr1, saddr2, saddr3;
- H5FS_stat_t state[H5FD_MEM_NTYPES];
- haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, sdata_size=0, mis_align=0;
- hsize_t alignment=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
-
+ H5FS_stat_t state[H5FD_MEM_NTYPES];
+ haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, sdata_size = 0, mis_align = 0;
+ hsize_t alignment = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 3");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* Re-open the file with alignment setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* calculate fragment for alignment of block 30 */
- if((tmp = (hsize_t)file_size % alignment))
+ if ((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if(addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(H5FS_stat_t) * H5FD_MEM_NTYPES);
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -5031,24 +5109,25 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* calculate fragment for alignment of block 50 */
mis_align = 0;
- if((tmp = ma_addr % alignment))
+ if ((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 50 from meta_aggr */
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if(addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
}
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr2 + TBLOCK_SIZE50) != ma_addr)
+ if ((addr2 + TBLOCK_SIZE50) != ma_addr)
TEST_ERROR
/*
@@ -5063,62 +5142,67 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
* block 30 is allocated from ma_addr
*/
mis_align = 0;
- if((alignment == TEST_ALIGN1024) && (tmp = ((ma_addr + ma_size) % alignment)))
+ if ((alignment == TEST_ALIGN1024) && (tmp = ((ma_addr + ma_size) % alignment)))
mis_align = alignment - tmp;
else if ((alignment == TEST_ALIGN4096) && (tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if(saddr1 % alignment) TEST_ERROR
+ if (saddr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 for sdata_aggr is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
}
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if(sdata_addr != (saddr1+TBLOCK_SIZE30)) TEST_ERROR
+ if (sdata_addr != (saddr1 + TBLOCK_SIZE30))
+ TEST_ERROR
/* calculate fragment for alignment of block 50 in sdata_aggr */
mis_align = 0;
- if((tmp = sdata_addr % alignment))
+ if ((tmp = sdata_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 50 from sdata_aggr */
saddr2 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if(saddr2 % alignment) TEST_ERROR
+ if (saddr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 for sdata_aggr is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
}
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if(sdata_addr != (saddr2 + TBLOCK_SIZE50)) TEST_ERROR
+ if (sdata_addr != (saddr2 + TBLOCK_SIZE50))
+ TEST_ERROR
/* calculate fragment for alignment of block 80 in sdata_aggr */
mis_align = 0;
- if((tmp = sdata_addr % alignment))
+ if ((tmp = sdata_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 80 from sdata_aggr */
saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if(saddr3 % alignment) TEST_ERROR
+ if (saddr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 80 for sdata_aggr is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
@@ -5130,17 +5214,18 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* calculate fragment for alignment of block 1034 */
mis_align = 0;
- if((tmp = sdata_addr % alignment))
+ if ((tmp = sdata_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 1034 for meta_aggr */
addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1034);
/* Verify that the allocated block is aligned */
- if(addr3 % alignment) TEST_ERROR
+ if (addr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 1034 for meta_aggr is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -5148,11 +5233,11 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* calculate unused space in meta_aggr that is freed to free-space after block 1034 */
mis_align = 0;
- if((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment)))
+ if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment)))
mis_align = alignment - tmp;
/* fragment for unused space in meta_aggr after block 1034 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -5160,21 +5245,21 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr3 + TBLOCK_SIZE1034) != ma_addr)
+ if ((addr3 + TBLOCK_SIZE1034) != ma_addr)
TEST_ERROR
/* Verify total size of free space after all allocations */
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &(state[type])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
- if(f->shared->fs_man[stype]) {
- if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[stype]) {
+ if (check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -5184,16 +5269,14 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
HDputs(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc3() */
-
/*
*-------------------------------------------------------------------------
* To verify that blocks allocated from the aggregator are aligned
@@ -5263,68 +5346,68 @@ error:
static unsigned
test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size;
- H5FD_mem_t type;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size;
+ H5FD_mem_t type;
haddr_t addr1, addr2, addr3;
- H5FS_stat_t state;
- haddr_t ma_addr=HADDR_UNDEF;
- hsize_t ma_size=0, saved_ma_size=0;
- hsize_t alignment=0, mis_align=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
-
+ H5FS_stat_t state;
+ haddr_t ma_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, saved_ma_size = 0;
+ hsize_t alignment = 0, mis_align = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 4");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file with alignment setting and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* calculate fragment for alignment of block 30 */
- if((tmp = (hsize_t)file_size % alignment))
+ if ((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if(addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(H5FS_stat_t));
- if(mis_align) {
+ if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -5332,21 +5415,23 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
saved_ma_size = ma_size;
- if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
+ TEST_ERROR
/* calculate fragment for alignment of block 2058 */
mis_align = 0;
- if((tmp = ma_addr % alignment))
+ if ((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 2058 from meta_aggr */
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2058);
/* Verify that the allocated block is aligned */
- if(addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 2058 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
@@ -5354,36 +5439,39 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr2 + TBLOCK_SIZE2058) != ma_addr) TEST_ERROR
+ if ((addr2 + TBLOCK_SIZE2058) != ma_addr)
+ TEST_ERROR
/* meta_aggr->size remains the same */
- if(ma_size != saved_ma_size) TEST_ERROR
+ if (ma_size != saved_ma_size)
+ TEST_ERROR
/* calculate fragment for alignment of block 5 from meta_aggr */
mis_align = 0;
- if((tmp = ma_addr % alignment))
+ if ((tmp = ma_addr % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 5 from meta_aggr */
addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE5);
/* fragment for alignment of block 5 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state.tot_space += mis_align;
state.tot_sect_count += 1;
state.serial_sect_count += 1;
}
/* Verify that the allocated block is aligned */
- if(addr3 % alignment) TEST_ERROR
+ if (addr3 % alignment)
+ TEST_ERROR
/* Verify total size of free space after all allocations */
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &state))
- TEST_ERROR
- }
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &state))
+ TEST_ERROR
+ }
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -5393,13 +5481,12 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
HDputs(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc4() */
/*
@@ -5473,73 +5560,74 @@ error:
static unsigned
test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size;
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size;
+ H5FD_mem_t type, stype;
haddr_t addr1, addr2, saddr1;
- H5FS_stat_t state[H5FD_MEM_NTYPES];
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
- haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0, new_sdata_size=0;
- hsize_t alignment=0, mis_align=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
-
+ H5FS_stat_t state[H5FD_MEM_NTYPES];
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF;
+ haddr_t sdata_addr = HADDR_UNDEF, new_sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0, new_sdata_size = 0;
+ hsize_t alignment = 0, mis_align = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 5");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file with alignment setting and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* calculate fragment for alignment of block 30 */
- if((tmp = (hsize_t)file_size % alignment))
+ if ((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if(addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if((addr1 + TBLOCK_SIZE30) != ma_addr) TEST_ERROR
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
+ TEST_ERROR
/* fragment for alignment of block 30 is freed to free-space */
HDmemset(&state, 0, sizeof(H5FS_stat_t) * H5FD_MEM_NTYPES);
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
@@ -5547,54 +5635,57 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* calculate fragment for alignment of block 30 from sdata_aggr */
mis_align = 0;
- if((tmp = (ma_addr + ma_size) % alignment))
+ if ((tmp = (ma_addr + ma_size) % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if(saddr1 % alignment) TEST_ERROR
+ if (saddr1 % alignment)
+ TEST_ERROR
/* fragment of alignment for block 30 in sdata_aggr is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[stype].tot_space += mis_align;
state[stype].tot_sect_count += 1;
state[stype].serial_sect_count += 1;
}
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if((saddr1+TBLOCK_SIZE30) != sdata_addr) TEST_ERROR
+ if ((saddr1 + TBLOCK_SIZE30) != sdata_addr)
+ TEST_ERROR
/* calculate fragment for alignment of block 2058 from meta_aggr */
mis_align = 0;
- if((tmp = (sdata_addr + sdata_size) % alignment))
+ if ((tmp = (sdata_addr + sdata_size) % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 2058 from meta_aggr */
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2058);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 2058 is freed to free-space */
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
}
/* Verify total size of free space after all allocations */
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &(state[type])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
- if(f->shared->fs_man[stype]) {
- if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[stype]) {
+ if (check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
/* nothing is changed in meta_aggr */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
@@ -5606,7 +5697,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if (new_sdata_addr != sdata_addr || new_sdata_size != sdata_size)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -5616,16 +5707,14 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
HDputs(" Current VFD doesn't support mis-aligned fragments");
} /* end else */
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_align_alloc5() */
-
/*
*-------------------------------------------------------------------------
* To verify that blocks allocated from the aggregator are aligned
@@ -5738,75 +5827,76 @@ error:
static unsigned
test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size;
- H5FD_mem_t type, stype;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ h5_stat_size_t file_size;
+ H5FD_mem_t type, stype;
haddr_t addr1, addr2;
haddr_t saddr1, saddr2, saddr3;
- H5FS_stat_t state[H5FD_MEM_NTYPES];
- haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
- hsize_t ma_size=0, new_ma_size=0, sdata_size=0;
- hsize_t alignment=0, mis_align=0, tmp=0;
- hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
+ H5FS_stat_t state[H5FD_MEM_NTYPES];
+ haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF;
+ hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0;
+ hsize_t alignment = 0, mis_align = 0, tmp = 0;
+ hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */
TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 6");
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
- && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(have_alloc_vfd) {
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") &&
+ HDstrcmp(env_h5_drvr, "multi"));
+ if (have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on (without alignment) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Re-open the file with alignment setting and meta/sdata setting */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* get alignment setting */
- if(H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
+ if (H5Pget_alignment(new_fapl, NULL, &alignment) < 0)
TEST_ERROR
/* calculate fragment for alignment of block 30 */
- if((tmp = (hsize_t)file_size % alignment))
+ if ((tmp = (hsize_t)file_size % alignment))
mis_align = alignment - tmp;
/* Allocate a block of 30 from meta_aggr */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (addr1 % alignment) TEST_ERROR
+ if (addr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 in meta_aggr is freed to free-space */
HDmemset(&state, 0, sizeof(H5FS_stat_t) * H5FD_MEM_NTYPES);
- if(mis_align) {
+ if (mis_align) {
state[type].tot_space += mis_align;
state[type].tot_sect_count += 1;
state[type].serial_sect_count += 1;
}
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
- if ((addr1+TBLOCK_SIZE30) != ma_addr)
+ if ((addr1 + TBLOCK_SIZE30) != ma_addr)
TEST_ERROR
/* calculate fragment for alignment of block 30 in sdata_aggr */
@@ -5815,11 +5905,12 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
mis_align = alignment - tmp;
/* Allocate a block of 30 from sdata_aggr */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
/* Verify that the allocated block is aligned */
- if (saddr1 % alignment) TEST_ERROR
+ if (saddr1 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 30 in sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5829,7 +5920,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr1+TBLOCK_SIZE30)) TEST_ERROR
+ if (sdata_addr != (saddr1 + TBLOCK_SIZE30))
+ TEST_ERROR
/* calculate fragment for alignment of block 50 in sdata_aggr */
mis_align = 0;
@@ -5840,7 +5932,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
saddr2 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50);
/* Verify that the allocated block is aligned */
- if (saddr2 % alignment) TEST_ERROR
+ if (saddr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 50 in sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5850,7 +5943,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr2+TBLOCK_SIZE50)) TEST_ERROR
+ if (sdata_addr != (saddr2 + TBLOCK_SIZE50))
+ TEST_ERROR
/* calculate fragment for alignment of block 80 in sdata_aggr */
mis_align = 0;
@@ -5861,7 +5955,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE80);
/* Verify that the allocated block is aligned */
- if (saddr3 % alignment) TEST_ERROR
+ if (saddr3 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 80 in sdata_aggr is freed to free-space */
if (mis_align) {
@@ -5871,7 +5966,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
}
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size);
- if (sdata_addr != (saddr3+TBLOCK_SIZE80)) TEST_ERROR
+ if (sdata_addr != (saddr3 + TBLOCK_SIZE80))
+ TEST_ERROR
/* calculate fragment for alignment of block 2058 */
/* remaining space in sdata_aggr is freed and shrunk */
@@ -5883,7 +5979,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2058);
/* Verify that the allocated block is aligned */
- if (addr2 % alignment) TEST_ERROR
+ if (addr2 % alignment)
+ TEST_ERROR
/* fragment for alignment of block 2058 is freed to free-space */
if (mis_align) {
@@ -5901,18 +5998,17 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
if (sdata_addr != HADDR_UNDEF || sdata_size != 0)
TEST_ERROR
- if(f->shared->fs_man[type]) {
- if(check_stats(f, f->shared->fs_man[type], &(state[type])))
- TEST_ERROR
- }
-
+ if (f->shared->fs_man[type]) {
+ if (check_stats(f, f->shared->fs_man[type], &(state[type])))
+ TEST_ERROR
+ }
- if(f->shared->fs_man[stype]) {
- if(check_stats(f, f->shared->fs_man[stype], &(state[stype])))
- TEST_ERROR
- }
+ if (f->shared->fs_man[stype]) {
+ if (check_stats(f, f->shared->fs_man[stype], &(state[stype])))
+ TEST_ERROR
+ }
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -5925,9 +6021,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
return 1;
} /* test_mf_align_alloc6() */
@@ -5938,15 +6033,15 @@ error:
static unsigned
test_mf_bug1(const char *env_h5_drvr, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t copied_fapl = -1; /* FAPL to use for this test */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type;
- haddr_t addr1, addr2;
- hsize_t block_size;
- hsize_t align;
- hbool_t split = FALSE, multi = FALSE;
+ hid_t file = -1; /* File ID */
+ hid_t copied_fapl = -1; /* FAPL to use for this test */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type;
+ haddr_t addr1, addr2;
+ hsize_t block_size;
+ hsize_t align;
+ hbool_t split = FALSE, multi = FALSE;
TESTING("H5MF_alloc() bug 1");
@@ -5954,143 +6049,150 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Copy fapl */
- if((copied_fapl = H5Pcopy(fapl)) < 0)
+ if ((copied_fapl = H5Pcopy(fapl)) < 0)
TEST_ERROR
/* Get metadata block size */
- if(H5Pget_meta_block_size(copied_fapl, &block_size) < 0)
+ if (H5Pget_meta_block_size(copied_fapl, &block_size) < 0)
TEST_ERROR
/* Set alignment to equal block size / 2 */
align = block_size / 2;
- if(H5Pset_alignment(copied_fapl, 0, align) < 0)
+ if (H5Pset_alignment(copied_fapl, 0, align) < 0)
TEST_ERROR
/* Check for split or multi driver */
- if(!HDstrcmp(env_h5_drvr, "split"))
+ if (!HDstrcmp(env_h5_drvr, "split"))
split = TRUE;
- else if(!HDstrcmp(env_h5_drvr, "multi"))
+ else if (!HDstrcmp(env_h5_drvr, "multi"))
multi = TRUE;
/* Add alignment to member files for split/multi driver */
- if(split || multi) {
+ if (split || multi) {
hid_t memb_fapl;
/* Creat fapl */
- if((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set alignment. Note that it is the block size of the parent FAPL that
* is important here. */
- if(H5Pset_alignment(memb_fapl, 0, align) < 0)
+ if (H5Pset_alignment(memb_fapl, 0, align) < 0)
TEST_ERROR
- if(split) {
+ if (split) {
/* Set split driver with new FAPLs */
- if(H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0)
+ if (H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0)
TEST_ERROR
} /* end if */
else {
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
- char *memb_name[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- hbool_t relax;
- H5FD_mem_t mt;
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char * memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
/* Get current multi settings */
HDmemset(memb_name, 0, sizeof memb_name);
- if(H5Pget_fapl_multi(copied_fapl, memb_map, NULL, memb_name, memb_addr, &relax) < 0)
+ if (H5Pget_fapl_multi(copied_fapl, memb_map, NULL, memb_name, memb_addr, &relax) < 0)
TEST_ERROR
/* Populate memb_fapl_arr, patch memb_addr so member file addresses
* are aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
memb_fapl_arr[mt] = memb_fapl;
- memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align;
+ memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align;
} /* end for */
/* Set multi driver with new FAPLs */
- if(H5Pset_fapl_multi(copied_fapl, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ if (H5Pset_fapl_multi(copied_fapl, memb_map, memb_fapl_arr, (const char *const *)memb_name,
+ memb_addr, relax) < 0)
TEST_ERROR
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
} /* end else */
/* Close memb_fapl */
- if(H5Pclose(memb_fapl) < 0)
+ if (H5Pclose(memb_fapl) < 0)
TEST_ERROR
} /* end if */
/* Reopen the file with alignment */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, copied_fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, copied_fapl)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
TEST_ERROR
/* Allocate a block of size align from meta_aggr. This should create an
* aggregator that extends to the end of the file, with
* block_size / 2 bytes remaining, and the end of the file aligned */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, align);
/* Verify that the allocated block is aligned */
- if(addr1 % align) TEST_ERROR
+ if (addr1 % align)
+ TEST_ERROR
/* Allocate a block of size align from meta_aggr. This should force the
* aggregator to extend to the end of the file, with 0 bytes remaining, and
* the end of the file aligned */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr2 = H5MF_alloc(f, type, align);
/* Verify that the allocated block is aligned */
- if(addr2 % align) TEST_ERROR
+ if (addr2 % align)
+ TEST_ERROR
/* Verify that the allocated block is placed align after the previous */
- if((addr2 - addr1) != align) TEST_ERROR
+ if ((addr2 - addr1) != align)
+ TEST_ERROR
/* Allocate a block of size block_size + 1 from meta_aggr. This should
* force the aggregator to extend to the end of the file, with 0 bytes
* remaining, and the end of the file unaligned */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, block_size + (hsize_t)1);
/* Verify that the allocated block is aligned */
- if(addr1 % align) TEST_ERROR
+ if (addr1 % align)
+ TEST_ERROR
/* Verify that the allocated block is placed block_size / 2 after the
* previous */
- if((addr1 - addr2) != align) TEST_ERROR
+ if ((addr1 - addr2) != align)
+ TEST_ERROR
/* Allocate a block of size 1. This should extend the aggregator from
* the previous allocation, and align the new block */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr2 = H5MF_alloc(f, type, (hsize_t)1);
/* Verify that the allocated block is aligned */
- if(addr2 % align) TEST_ERROR
+ if (addr2 % align)
+ TEST_ERROR
/* Verify that the allocated block is placed 3 * (block_size / 2) after
* the previous */
- if((addr2 - addr1) != (3 * align)) TEST_ERROR
+ if ((addr2 - addr1) != (3 * align))
+ TEST_ERROR
PASSED();
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_bug1() */
/*
@@ -6101,17 +6203,17 @@ error:
static unsigned
test_mf_fs_persist_split(void)
{
- hid_t file = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t fapl = -1; /* File access property list ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type, stype, btype; /* File allocation type */
- H5FS_stat_t fs_stat; /* Information for free-space manager */
- haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
- haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_DRAW */
- haddr_t baddr5, baddr6, baddr7, baddr8; /* File address for H5FD_MEM_BTREE */
- haddr_t tmp_addr; /* temporary variable for address */
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fapl = -1; /* File access property list ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype, btype; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
+ haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_DRAW */
+ haddr_t baddr5, baddr6, baddr7, baddr8; /* File address for H5FD_MEM_BTREE */
+ haddr_t tmp_addr; /* temporary variable for address */
TESTING("File's free-space managers are persistent for split-file");
@@ -6120,291 +6222,293 @@ test_mf_fs_persist_split(void)
*/
SKIPPED();
HDfprintf(stdout, " Persistent FSMs disabled in multi file driver.\n");
- return 0; /* <========== note return */
+ return 0; /* <========== note return */
/* File creation property list template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- /* for now, we don't support persistent free space managers
- * with the split file driver.
- */
- SKIPPED();
+ /* for now, we don't support persistent free space managers
+ * with the split file driver.
+ */
+ SKIPPED();
HDfprintf(stdout, " Persistent FSMs disabled in multi file driver.\n");
- return 0; /* <========== note return */
+ return 0; /* <========== note return */
/* File creation property list template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- FAIL_STACK_ERROR
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR
/* Set up split driver */
- if(H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT)<0)
+ if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* File creation property list template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate 4 blocks of type H5FD_MEM_SUPER */
type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
+ if (HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
/* Put block #1, #3 into H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ if (H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
/* Allocate 4 blocks of type H5FD_MEM_DRAW */
stype = H5FD_MEM_DRAW;
- if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE4)))
+ if (HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
/* Put block #1, #3 into H5FD_MEM_DRAW free-space manager */
- if(H5MF_xfree(f, stype, saddr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ if (H5MF_xfree(f, stype, saddr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, stype, saddr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, stype, saddr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Verify that the H5FD_MEM_SUPER free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ if (!H5F_addr_defined(f->shared->fs_addr[type]))
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ if (fs_stat.tot_space < (TBLOCK_SIZE1 + TBLOCK_SIZE3))
TEST_ERROR
- if(fs_stat.serial_sect_count < 2)
+ if (fs_stat.serial_sect_count < 2)
TEST_ERROR
/* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #3 still in free-space */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(tmp_addr != addr1)
+ if (tmp_addr != addr1)
TEST_ERROR
/* Verify that the free-space manager for H5FD_MEM_DRAW is there */
- if(!H5F_addr_defined(f->shared->fs_addr[stype]))
+ if (!H5F_addr_defined(f->shared->fs_addr[stype]))
TEST_ERROR
-
/* Start up H5FD_MEM_DRAW free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)stype) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)stype) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[stype], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[stype], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ if (fs_stat.tot_space < (TBLOCK_SIZE1 + TBLOCK_SIZE3))
TEST_ERROR
- if(fs_stat.serial_sect_count < 2)
+ if (fs_stat.serial_sect_count < 2)
TEST_ERROR
/* Retrieve blocks #1 from H5FD_MEM_DRAW free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(tmp_addr != saddr1)
+ if (tmp_addr != saddr1)
TEST_ERROR
/* Retrieve blocks #3 from H5FD_MEM_DRAW free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(tmp_addr != saddr3)
+ if (tmp_addr != saddr3)
TEST_ERROR
/* H5FD_MEM_DRAW free-space manager is going away at closing */
/* works for this one because the freeing of sect_addr is to H5FD_MEM_SUPER fs, not against itself */
/* Allocate 4 blocks of type H5FD_MEM_BTREE */
btype = H5FD_MEM_BTREE;
- if(HADDR_UNDEF == (baddr5 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE5)))
+ if (HADDR_UNDEF == (baddr5 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE5)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr6 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE6)))
+ if (HADDR_UNDEF == (baddr6 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE6)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr7 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE7)))
+ if (HADDR_UNDEF == (baddr7 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE7)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr8 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE8)))
+ if (HADDR_UNDEF == (baddr8 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE8)))
FAIL_STACK_ERROR
/* Put block #5 & #7 into H5FD_MEM_BTREE free-space manager */
- if(H5MF_xfree(f, btype, baddr5, (hsize_t)TBLOCK_SIZE5) < 0)
+ if (H5MF_xfree(f, btype, baddr5, (hsize_t)TBLOCK_SIZE5) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, btype, baddr7, (hsize_t)TBLOCK_SIZE7) < 0)
+ if (H5MF_xfree(f, btype, baddr7, (hsize_t)TBLOCK_SIZE7) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Verify that the free-space manager for H5FD_MEM_DRAW is not there */
- if(H5F_addr_defined(f->shared->fs_addr[stype]))
+ if (H5F_addr_defined(f->shared->fs_addr[stype]))
TEST_ERROR
/* Verify that the free-space manager for H5FD_MEM_SUPER is there */
- if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ if (!H5F_addr_defined(f->shared->fs_addr[type]))
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TBLOCK_SIZE3+TBLOCK_SIZE5+TBLOCK_SIZE7))
+ if (fs_stat.tot_space < (TBLOCK_SIZE3 + TBLOCK_SIZE5 + TBLOCK_SIZE7))
TEST_ERROR
/* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(tmp_addr != addr3)
+ if (tmp_addr != addr3)
TEST_ERROR
/* Retrieve block #7 from H5FD_MEM_BTREE free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE7)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE7)))
FAIL_STACK_ERROR
- if(tmp_addr != baddr7)
+ if (tmp_addr != baddr7)
TEST_ERROR
/* There should still be block #5 of H5FD_MEM_BTREE in H5FD_MEM_BTREE free-space manager */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Verify that the H5FD_MEM_SUPER free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ if (!H5F_addr_defined(f->shared->fs_addr[type]))
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < TBLOCK_SIZE5)
+ if (fs_stat.tot_space < TBLOCK_SIZE5)
TEST_ERROR
/* Closing */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file);
H5Pclose(fcpl);
H5Pclose(fapl);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_persist_split() */
-#define MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv) { \
- H5FD_mem_t mt; \
- HDmemset(memb_map, 0, sizeof memb_map); \
- HDmemset(memb_fapl, 0, sizeof memb_fapl); \
- HDmemset(memb_name, 0, sizeof memb_name); \
- HDmemset(memb_addr, 0, sizeof memb_addr); \
- HDmemset(sv, 0, sizeof sv); \
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { \
- memb_map[mt] = H5FD_MEM_SUPER; \
- memb_fapl[mt] = H5P_DEFAULT; \
- } \
- memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; \
- memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; \
- memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; \
- memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; \
- HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); \
- memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; \
- memb_addr[H5FD_MEM_SUPER] = 0; \
- HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); \
- memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; \
- memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; \
- HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); \
- memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; \
- memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; \
- HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); \
- memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; \
- memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; \
- HDsprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); \
- memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; \
- memb_addr[H5FD_MEM_LHEAP] = HADDR_MAX*2/3; \
- HDsprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); \
- memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; \
- memb_addr[H5FD_MEM_OHDR] = HADDR_MAX*5/6; \
-}
+#define MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv) \
+ { \
+ H5FD_mem_t mt; \
+ HDmemset(memb_map, 0, sizeof memb_map); \
+ HDmemset(memb_fapl, 0, sizeof memb_fapl); \
+ HDmemset(memb_name, 0, sizeof memb_name); \
+ HDmemset(memb_addr, 0, sizeof memb_addr); \
+ HDmemset(sv, 0, sizeof sv); \
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { \
+ memb_map[mt] = H5FD_MEM_SUPER; \
+ memb_fapl[mt] = H5P_DEFAULT; \
+ } \
+ memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; \
+ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; \
+ memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; \
+ memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; \
+ HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); \
+ memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; \
+ memb_addr[H5FD_MEM_SUPER] = 0; \
+ HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); \
+ memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; \
+ memb_addr[H5FD_MEM_BTREE] = HADDR_MAX / 6; \
+ HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); \
+ memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; \
+ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 3; \
+ HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); \
+ memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; \
+ memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX / 2; \
+ HDsprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); \
+ memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; \
+ memb_addr[H5FD_MEM_LHEAP] = HADDR_MAX * 2 / 3; \
+ HDsprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); \
+ memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; \
+ memb_addr[H5FD_MEM_OHDR] = HADDR_MAX * 5 / 6; \
+ }
/*
*-------------------------------------------------------------------------
@@ -6414,26 +6518,25 @@ error:
static unsigned
test_mf_fs_persist_multi(void)
{
- hid_t file = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t fapl = -1; /* File access property list ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type, stype, btype, gtype; /* File allocation type */
- H5FS_stat_t fs_stat; /* Information for free-space manager */
- haddr_t addr1, addr2, addr3, addr4; /* File allocation type */
- haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_SUPER */
- haddr_t baddr1, baddr2, baddr3, baddr4; /* File address for H5FD_MEM_DRAW */
- haddr_t gaddr1, gaddr2; /* File address for H5FD_MEM_GHEAP */
- haddr_t tmp_addr; /* Temporary variable for address */
- H5FS_section_info_t *node; /* Free space section node */
- htri_t node_found = FALSE; /* Indicate section is in free-space */
- H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */
- hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */
- char sv[H5FD_MEM_NTYPES][64]; /* Name generators */
- const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */
- haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */
-
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fapl = -1; /* File access property list ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype, btype, gtype; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4; /* File allocation type */
+ haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_SUPER */
+ haddr_t baddr1, baddr2, baddr3, baddr4; /* File address for H5FD_MEM_DRAW */
+ haddr_t gaddr1, gaddr2; /* File address for H5FD_MEM_GHEAP */
+ haddr_t tmp_addr; /* Temporary variable for address */
+ H5FS_section_info_t *node; /* Free space section node */
+ htri_t node_found = FALSE; /* Indicate section is in free-space */
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */
+ hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */
+ char sv[H5FD_MEM_NTYPES][64]; /* Name generators */
+ const char * memb_name[H5FD_MEM_NTYPES]; /* Name generators */
+ haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */
TESTING("File's free-space managers are persistent for multi-file");
@@ -6442,286 +6545,290 @@ test_mf_fs_persist_multi(void)
*/
SKIPPED();
HDfprintf(stdout, " Persistent FSMs disabled in multi file driver.\n");
- return 0; /* <========== note return */
+ return 0; /* <========== note return */
/* for now, we don't support persistent free space managers
* with the multi file driver.
*/
SKIPPED();
HDfprintf(stdout, " Persistent FSMs disabled in multi file driver.\n");
- return 0; /* <========== note return */
+ return 0; /* <========== note return */
/* File creation property list template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
FAIL_STACK_ERROR
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR
MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv)
- if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
TEST_ERROR;
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate 4 blocks of type H5FD_MEM_SUPER */
type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
+ if (HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
/* Put block #1, #3 into H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ if (H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
/* Allocate 4 blocks of type H5FD_MEM_DRAW */
stype = H5FD_MEM_DRAW;
- if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE4)))
+ if (HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
/* Put block #1, #3 into H5FD_MEM_DRAW free-space manager */
- if(H5MF_xfree(f, stype, saddr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ if (H5MF_xfree(f, stype, saddr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, stype, saddr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, stype, saddr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Verify that the H5FD_MEM_SUPER free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ if (!H5F_addr_defined(f->shared->fs_addr[type]))
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ if (fs_stat.tot_space < (TBLOCK_SIZE1 + TBLOCK_SIZE3))
TEST_ERROR
- if(fs_stat.serial_sect_count < 2)
+ if (fs_stat.serial_sect_count < 2)
TEST_ERROR
/* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #3 still in free-space */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(tmp_addr != addr1)
+ if (tmp_addr != addr1)
TEST_ERROR
/* Verify that the free-space manager for H5FD_MEM_DRAW is there */
- if(!H5F_addr_defined(f->shared->fs_addr[stype]))
+ if (!H5F_addr_defined(f->shared->fs_addr[stype]))
TEST_ERROR
/* Start up H5FD_MEM_DRAW free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)stype) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)stype) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[stype], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[stype], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ if (fs_stat.tot_space < (TBLOCK_SIZE1 + TBLOCK_SIZE3))
TEST_ERROR
- if(fs_stat.serial_sect_count < 2)
+ if (fs_stat.serial_sect_count < 2)
TEST_ERROR
/* Retrieve blocks #1 from H5FD_MEM_DRAW free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(tmp_addr != saddr1)
+ if (tmp_addr != saddr1)
TEST_ERROR
/* Retrieve blocks #3 from H5FD_MEM_DRAW free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(tmp_addr != saddr3)
+ if (tmp_addr != saddr3)
TEST_ERROR
/* Allocate 4 blocks of type H5FD_MEM_BTREE */
btype = H5FD_MEM_BTREE;
- if(HADDR_UNDEF == (baddr1 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (baddr1 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr2 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (baddr2 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr3 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (baddr3 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (baddr4 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE4)))
+ if (HADDR_UNDEF == (baddr4 = H5MF_alloc(f, btype, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
/* Put block #1 & #3 into H5FD_MEM_BTREE free-space manager */
- if(H5MF_xfree(f, btype, baddr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ if (H5MF_xfree(f, btype, baddr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, btype, baddr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, btype, baddr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Verify that the free-space manager for H5FD_MEM_SUPER is there */
- if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ if (!H5F_addr_defined(f->shared->fs_addr[type]))
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < TBLOCK_SIZE3)
+ if (fs_stat.tot_space < TBLOCK_SIZE3)
TEST_ERROR
/* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(tmp_addr != addr3)
+ if (tmp_addr != addr3)
TEST_ERROR
/* Verify that the free-space manager for H5FD_MEM_DRAW is not there */
- if(H5F_addr_defined(f->shared->fs_addr[stype]))
+ if (H5F_addr_defined(f->shared->fs_addr[stype]))
TEST_ERROR
/* Verify that the free-space manager for H5FD_MEM_BTREE is there */
- if(!H5F_addr_defined(f->shared->fs_addr[btype]))
+ if (!H5F_addr_defined(f->shared->fs_addr[btype]))
TEST_ERROR
/* Start up H5FD_MEM_BTREE free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)btype) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)btype) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[btype], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[btype], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3))
+ if (fs_stat.tot_space < (TBLOCK_SIZE1 + TBLOCK_SIZE3))
TEST_ERROR
- if(fs_stat.serial_sect_count < 2)
+ if (fs_stat.serial_sect_count < 2)
TEST_ERROR
/* Allocate 2 blocks of type H5FD_MEM_GHEAP */
gtype = H5FD_MEM_GHEAP;
- if(HADDR_UNDEF == (gaddr2 = H5MF_alloc(f, gtype, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (gaddr2 = H5MF_alloc(f, gtype, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (gaddr1 = H5MF_alloc(f, gtype, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (gaddr1 = H5MF_alloc(f, gtype, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
/* Put block #2 into H5FD_MEM_GHEAP free-space manager */
- if(H5MF_xfree(f, gtype, gaddr2, (hsize_t)TBLOCK_SIZE2) < 0)
+ if (H5MF_xfree(f, gtype, gaddr2, (hsize_t)TBLOCK_SIZE2) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* If H5FD_MEM_SUPER is there, should not find block #1 & #3 */
- if(H5F_addr_defined(f->shared->fs_addr[type])) {
+ if (H5F_addr_defined(f->shared->fs_addr[type])) {
/* Start up H5FD_MEM_SUPER free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)type) < 0)
FAIL_STACK_ERROR
- if((node_found = H5FS_sect_find(f, f->shared->fs_man[type],
- (hsize_t)TBLOCK_SIZE1, (H5FS_section_info_t **)&node)) < 0)
+ if ((node_found = H5FS_sect_find(f, f->shared->fs_man[type], (hsize_t)TBLOCK_SIZE1,
+ (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
- if(node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
- if((node_found = H5FS_sect_find(f, f->shared->fs_man[type],
- (hsize_t)TBLOCK_SIZE3, (H5FS_section_info_t **)&node)) < 0)
+ if ((node_found = H5FS_sect_find(f, f->shared->fs_man[type], (hsize_t)TBLOCK_SIZE3,
+ (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
- if(node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
}
/* Verify that the H5FD_MEM_GHEAP free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[gtype]))
+ if (!H5F_addr_defined(f->shared->fs_addr[gtype]))
TEST_ERROR
/* Start up H5FD_MEM_GHEAP free-space manager */
- if(H5MF__open_fstype(f, (H5F_mem_page_t)gtype) < 0)
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)gtype) < 0)
FAIL_STACK_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[gtype], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[gtype], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < TBLOCK_SIZE2)
+ if (fs_stat.tot_space < TBLOCK_SIZE2)
TEST_ERROR
/* Closing */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file);
H5Pclose(fcpl);
H5Pclose(fapl);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_persist_multi() */
#endif /* PB_OUT */
@@ -6733,41 +6840,43 @@ error:
static unsigned
test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t file = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t fapl2 = -1; /* File access property list ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type; /* File allocation type */
- H5FD_mem_t tt; /* File allocation type */
- H5FS_stat_t fs_stat; /* Information for free-space manager */
- haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
- haddr_t tmp_addr; /* Temporary variable for address */
-
- if(new_format)
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fapl2 = -1; /* File access property list ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ H5FD_mem_t tt; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
+ haddr_t tmp_addr; /* Temporary variable for address */
+
+ if (new_format)
TESTING("File's free-space is persistent with new library format")
else
TESTING("File's free-space is persistent with old library format")
- if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) {
+ if (HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) {
/* File creation property list template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
- if(new_format) {
+ if (new_format) {
/* Latest format */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set to paged aggregation and persisting free-space */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
TEST_ERROR
- } else {
+ }
+ else {
/* Setting: aggregation with persisting free-space */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
TEST_ERROR
}
@@ -6775,125 +6884,127 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate 6 blocks */
type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
+ if (HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE5)))
+ if (HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE5)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6)))
+ if (HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6)))
FAIL_STACK_ERROR
/* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ if (H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, addr5, (hsize_t)TBLOCK_SIZE5) < 0)
+ if (H5MF_xfree(f, type, addr5, (hsize_t)TBLOCK_SIZE5) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt);
/* Verify that H5FD_MEM_SUPER free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[tt]))
+ if (!H5F_addr_defined(f->shared->fs_addr[tt]))
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(!(f->shared->fs_man[tt]))
- if(H5MF__open_fstype(f, (H5F_mem_page_t)tt) < 0)
+ if (!(f->shared->fs_man[tt]))
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)tt) < 0)
FAIL_STACK_ERROR
/* Get info for free-space manager */
- if(H5FS_stat_info(f, f->shared->fs_man[tt], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[tt], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify free-space info */
- if(fs_stat.tot_space < (TBLOCK_SIZE1+TBLOCK_SIZE3+TBLOCK_SIZE5))
+ if (fs_stat.tot_space < (TBLOCK_SIZE1 + TBLOCK_SIZE3 + TBLOCK_SIZE5))
TEST_ERROR
- if(fs_stat.serial_sect_count < 3)
+ if (fs_stat.serial_sect_count < 3)
TEST_ERROR
/* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(tmp_addr != addr3)
+ if (tmp_addr != addr3)
TEST_ERROR
/* Retrieve block #1 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(tmp_addr != addr1)
+ if (tmp_addr != addr1)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Verify that H5FD_MEM_SUPER free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[tt]))
+ if (!H5F_addr_defined(f->shared->fs_addr[tt]))
TEST_ERROR
/* Retrieve block #5 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE5)))
+ if (HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE5)))
FAIL_STACK_ERROR
- if(tmp_addr != addr5)
+ if (tmp_addr != addr5)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
FAIL_STACK_ERROR
PASSED();
-
- } else {
+ }
+ else {
SKIPPED();
HDputs(" Current VFD doesn't support persisting free-space or paged aggregation strategy");
}
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file);
H5Pclose(fcpl);
H5Pclose(fapl2);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_persist() */
/*
@@ -6904,19 +7015,19 @@ error:
static unsigned
test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t file = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list */
- hid_t fapl2 = -1; /* File access property list */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type; /* File allocation type */
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ hid_t fapl2 = -1; /* File access property list */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
H5FS_stat_t fs_stat; /* Information for free-space manager */
- haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
- haddr_t addrx;
+ haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
+ haddr_t addrx;
H5FD_mem_t fs_type;
- hbool_t contig_addr_vfd;
+ hbool_t contig_addr_vfd;
- if(new_format)
+ if (new_format)
TESTING("File's free-space is going away with new library format")
else
TESTING("File's free-space is going away with old library format")
@@ -6924,160 +7035,165 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Current VFD that does not support contigous address space */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* File creation property list template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
- if(new_format) {
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (new_format) {
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
- } else {
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
+ }
+ else {
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
}
/* Set to aggregation and persisting free-space */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate 4 blocks */
type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
+ if (HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
/* Put block #1, #3 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ if (H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
/* Retrieve block #1, #3 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type);
/* Verify that the H5FD_MEM_SUPER free-space manager is not there */
- if(H5F_addr_defined(f->shared->fs_addr[fs_type]))
+ if (H5F_addr_defined(f->shared->fs_addr[fs_type]))
TEST_ERROR
/* Put block #3 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Verify that H5FD_MEM_SUPER free-space manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[fs_type]))
+ if (!H5F_addr_defined(f->shared->fs_addr[fs_type]))
TEST_ERROR
/* Start up H5FD_MEM_SUPER free-space manager */
- if(!(f->shared->fs_man[fs_type]))
- if(H5MF__open_fstype(f, (H5F_mem_page_t)fs_type) < 0)
+ if (!(f->shared->fs_man[fs_type]))
+ if (H5MF__open_fstype(f, (H5F_mem_page_t)fs_type) < 0)
FAIL_STACK_ERROR
/* Get info for H5FD_MEM_SUPER free-space manager */
- if(H5FS_stat_info(f, f->shared->fs_man[fs_type], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[fs_type], &fs_stat) < 0)
FAIL_STACK_ERROR
- if(!H5F_addr_defined(fs_stat.addr))
+ if (!H5F_addr_defined(fs_stat.addr))
TEST_ERROR
- if(fs_stat.tot_space < TBLOCK_SIZE3)
+ if (fs_stat.tot_space < TBLOCK_SIZE3)
TEST_ERROR
/* Allocate/free space accordingly so that the free-space manager will go away */
- if(new_format) {
- if(H5MF_xfree(f, type, addr4, (hsize_t)TBLOCK_SIZE4) < 0)
+ if (new_format) {
+ if (H5MF_xfree(f, type, addr4, (hsize_t)TBLOCK_SIZE4) < 0)
FAIL_STACK_ERROR
- } else {
- if(HADDR_UNDEF == (addrx = H5MF_alloc(f, type, (hsize_t)3)))
+ }
+ else {
+ if (HADDR_UNDEF == (addrx = H5MF_alloc(f, type, (hsize_t)3)))
FAIL_STACK_ERROR
}
/* The H5FD_MEM_SUPER free-space manager will go away at H5MF_close() */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Verify that the H5FD_MEM_SUPER free-space manager is not there */
- if(H5F_addr_defined(f->shared->fs_addr[fs_type]))
+ if (H5F_addr_defined(f->shared->fs_addr[fs_type]))
TEST_ERROR
/* Closing */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
FAIL_STACK_ERROR
PASSED();
-
- } else {
+ }
+ else {
SKIPPED();
HDputs(" Current VFD doesn't support persistent free-space manager");
}
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file);
H5Pclose(fcpl);
H5Pclose(fapl2);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_fs_gone() */
/*
@@ -7089,20 +7205,20 @@ error:
static unsigned
test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t file = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list template */
- hid_t fapl2 = -1; /* File access property list template */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type; /* File allocation type */
- H5FD_mem_t tt; /* File allocation type */
- haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
- H5F_fspace_strategy_t fs_type; /* File space handling strategy */
- hsize_t fs_threshold; /* Free-space section threshold */
- unsigned fs_persist; /* To persist free-space or not */
- hbool_t contig_addr_vfd;
-
- if(new_format)
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list template */
+ hid_t fapl2 = -1; /* File access property list template */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ H5FD_mem_t tt; /* File allocation type */
+ haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
+ H5F_fspace_strategy_t fs_type; /* File space handling strategy */
+ hsize_t fs_threshold; /* Free-space section threshold */
+ unsigned fs_persist; /* To persist free-space or not */
+ hbool_t contig_addr_vfd;
+
+ if (new_format)
TESTING("File space strategy/persisting/threshold with new library format")
else
TESTING("File space strategy/persisting/threshold with old library format")
@@ -7110,142 +7226,143 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for
/* Current VFD that does not support contigous address space */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
-
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ FAIL_STACK_ERROR
- if(new_format)
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (new_format)
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Test with TRUE or FALSE for persisting free-space */
- for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+ for (fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
- for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
+ for (fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
/* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */
- for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) {
+ for (fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) {
- if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE))
+ if (!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE))
continue;
/* Create file-creation template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set default file space information */
- if(H5Pset_file_space_strategy(fcpl, fs_type, (hbool_t)fs_persist, fs_threshold) < 0)
+ if (H5Pset_file_space_strategy(fcpl, fs_type, (hbool_t)fs_persist, fs_threshold) < 0)
FAIL_STACK_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate 6 blocks */
type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
+ if (HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE5)))
+ if (HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE5)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6)))
+ if (HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6)))
FAIL_STACK_ERROR
/* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ if (H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, addr5, (hsize_t)TBLOCK_SIZE5) < 0)
+ if (H5MF_xfree(f, type, addr5, (hsize_t)TBLOCK_SIZE5) < 0)
FAIL_STACK_ERROR
-
/* Close the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt);
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
- if(f->shared->fs_persist) {
- hssize_t nsects; /* # of free-space sections */
- int i; /* local index variable */
+ if (f->shared->fs_persist) {
+ hssize_t nsects; /* # of free-space sections */
+ int i; /* local index variable */
H5F_sect_info_t *sect_info; /* array to hold the free-space information */
/* Get the # of free-space sections in the file */
- if((nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, NULL)) < 0)
+ if ((nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, NULL)) < 0)
FAIL_STACK_ERROR
/* Verify no free-space sections */
/* paged aggregation has 1 section for last_small */
- if(fs_threshold > TBLOCK_SIZE5 && nsects && fs_type != H5F_FSPACE_STRATEGY_PAGE)
+ if (fs_threshold > TBLOCK_SIZE5 && nsects && fs_type != H5F_FSPACE_STRATEGY_PAGE)
TEST_ERROR
- if(nsects) {
+ if (nsects) {
/* Allocate storage for the free space section information */
sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t));
H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info);
/* Verify the size of free-space sections */
- for(i = 0; i < nsects; i++)
- if(sect_info[i].size < fs_threshold)
+ for (i = 0; i < nsects; i++)
+ if (sect_info[i].size < fs_threshold)
TEST_ERROR
- if(sect_info)
+ if (sect_info)
HDfree(sect_info);
}
- } else {
- if(H5F_addr_defined(f->shared->fs_addr[tt]))
+ }
+ else {
+ if (H5F_addr_defined(f->shared->fs_addr[tt]))
TEST_ERROR
}
/* Closing */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
} /* end for fs_type */
- } /* end for fs_threshold */
- } /* end for fs_persist */
+ } /* end for fs_threshold */
+ } /* end for fs_persist */
- if(H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
FAIL_STACK_ERROR
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl);
H5Pclose(fapl2);
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_strat_thres_persist() */
/*
@@ -7257,21 +7374,21 @@ error:
static unsigned
test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
- hid_t file = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list template */
- hid_t fapl2 = -1; /* File access property list template */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type; /* File allocation type */
- H5FD_mem_t tt; /* File allocation type */
- haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
- H5F_fspace_strategy_t fs_type; /* File space handling strategy */
- unsigned fs_persist; /* To persist free-space or not */
- H5FS_stat_t fs_state; /* Information for free-space manager */
- H5FS_stat_t fs_state_zero; /* Information for free-space manager */
- hbool_t contig_addr_vfd;
-
- if(new_format)
+ hid_t file = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list template */
+ hid_t fapl2 = -1; /* File access property list template */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ H5FD_mem_t tt; /* File allocation type */
+ haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
+ H5F_fspace_strategy_t fs_type; /* File space handling strategy */
+ unsigned fs_persist; /* To persist free-space or not */
+ H5FS_stat_t fs_state; /* Information for free-space manager */
+ H5FS_stat_t fs_state_zero; /* Information for free-space manager */
+ hbool_t contig_addr_vfd;
+
+ if (new_format)
TESTING("File space merge/shrink for section size < threshold with new library format")
else
TESTING("File space merge/shrink for section size < threshold with old library format")
@@ -7279,158 +7396,162 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format
/* Current VFD that does not support contigous address space */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
-
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
HDmemset(&fs_state_zero, 0, sizeof(H5FS_stat_t));
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0)
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
- if(new_format)
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (new_format)
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Test with TRUE or FALSE for persisting free-space */
- for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+ for (fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
/* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */
- for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) {
+ for (fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) {
/* Skip for multi/split driver: persisting free-space or paged aggregation strategy */
- if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE))
+ if (!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE))
continue;
/* Clear out free-space statistics */
HDmemset(&fs_state, 0, sizeof(H5FS_stat_t));
/* Create file-creation template */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set default file space information */
- if(H5Pset_file_space_strategy(fcpl, fs_type, fs_persist, (hsize_t)TEST_THRESHOLD3) < 0)
+ if (H5Pset_file_space_strategy(fcpl, fs_type, fs_persist, (hsize_t)TEST_THRESHOLD3) < 0)
FAIL_STACK_ERROR
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate 6 blocks */
type = H5FD_MEM_SUPER;
- if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
+ if (HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
+ if (HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
+ if (HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
+ if (HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE5)))
+ if (HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE5)))
FAIL_STACK_ERROR
- if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6)))
+ if (HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6)))
FAIL_STACK_ERROR
H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt);
/* For paged aggregation, the section in the page at EOF for small meta fs is not shrunk away */
- if(fs_type == H5F_FSPACE_STRATEGY_PAGE)
- if(H5FS_stat_info(f, f->shared->fs_man[tt], &fs_state) < 0)
+ if (fs_type == H5F_FSPACE_STRATEGY_PAGE)
+ if (H5FS_stat_info(f, f->shared->fs_man[tt], &fs_state) < 0)
FAIL_STACK_ERROR
/* Put block #3, #5 to H5FD_MEM_SUPER free-space manager */
- if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
+ if (H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, addr5, (hsize_t)TBLOCK_SIZE5) < 0)
+ if (H5MF_xfree(f, type, addr5, (hsize_t)TBLOCK_SIZE5) < 0)
FAIL_STACK_ERROR
fs_state.tot_space += TBLOCK_SIZE3 + TBLOCK_SIZE5;
fs_state.tot_sect_count += 2;
fs_state.serial_sect_count += 2;
- if(check_stats(f, f->shared->fs_man[tt], &fs_state))
+ if (check_stats(f, f->shared->fs_man[tt], &fs_state))
TEST_ERROR
/* section #2 is less than threshold but is merged into section #3 */
- if(H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE2) < 0)
+ if (H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE2) < 0)
FAIL_STACK_ERROR
fs_state.tot_space += TBLOCK_SIZE2;
- if(check_stats(f, f->shared->fs_man[tt], &fs_state))
+ if (check_stats(f, f->shared->fs_man[tt], &fs_state))
TEST_ERROR
- if(H5MF_xfree(f, type, addr4, (hsize_t)TBLOCK_SIZE4) < 0)
+ if (H5MF_xfree(f, type, addr4, (hsize_t)TBLOCK_SIZE4) < 0)
FAIL_STACK_ERROR
- if(H5MF_xfree(f, type, addr6, (hsize_t)TBLOCK_SIZE6) < 0)
+ if (H5MF_xfree(f, type, addr6, (hsize_t)TBLOCK_SIZE6) < 0)
FAIL_STACK_ERROR
- /* For paged aggregation, the sections in the page at EOF for small meta fs are merged but are not shrunk away */
- if(fs_type == H5F_FSPACE_STRATEGY_PAGE) {
+ /* For paged aggregation, the sections in the page at EOF for small meta fs are merged but are not
+ * shrunk away */
+ if (fs_type == H5F_FSPACE_STRATEGY_PAGE) {
fs_state.tot_sect_count = fs_state.serial_sect_count = 1;
fs_state.tot_space += (TBLOCK_SIZE4 + TBLOCK_SIZE6);
}
/* For old format: the sections at EOF are shrunk away */
- if(check_stats(f, f->shared->fs_man[tt], (fs_type == H5F_FSPACE_STRATEGY_PAGE) ? &fs_state:&fs_state_zero))
+ if (check_stats(f, f->shared->fs_man[tt],
+ (fs_type == H5F_FSPACE_STRATEGY_PAGE) ? &fs_state : &fs_state_zero))
TEST_ERROR
/* section #1 is less than threshold but is shrunk away */
- if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
+ if (H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0)
FAIL_STACK_ERROR
/* For paged aggregation, the section in the page at EOF for small meta fs is not shrunk away */
- if(fs_type == H5F_FSPACE_STRATEGY_PAGE)
+ if (fs_type == H5F_FSPACE_STRATEGY_PAGE)
fs_state.tot_space += TBLOCK_SIZE1;
/* For old format: the sections at EOF are shrunk away */
- if(check_stats(f, f->shared->fs_man[tt], (fs_type == H5F_FSPACE_STRATEGY_PAGE) ? &fs_state : &fs_state_zero))
+ if (check_stats(f, f->shared->fs_man[tt],
+ (fs_type == H5F_FSPACE_STRATEGY_PAGE) ? &fs_state : &fs_state_zero))
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Free-space manager should be empty */
- if(!(fs_type == H5F_FSPACE_STRATEGY_PAGE && fs_persist))
- if(H5F_addr_defined(f->shared->fs_addr[tt]))
+ if (!(fs_type == H5F_FSPACE_STRATEGY_PAGE && fs_persist))
+ if (H5F_addr_defined(f->shared->fs_addr[tt]))
TEST_ERROR
/* Closing */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
} /* end for fs_type */
- } /* end for fs_persist */
+ } /* end for fs_persist */
- if(H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
FAIL_STACK_ERROR
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl);
H5Pclose(fapl2);
H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_mf_strat_thres_gone() */
/*
@@ -7458,11 +7579,11 @@ error:
static unsigned
test_dichotomy(hid_t fapl)
{
- hid_t file = -1; /* File ID */
- char filename[FILENAME_LEN]; /* Filename to use */
- H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type, stype;
- haddr_t addr1, addr3, saddr1, saddr2;
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype;
+ haddr_t addr1, addr3, saddr1, saddr2;
TESTING("Allocation from raw or metadata free-space manager");
@@ -7470,22 +7591,22 @@ test_dichotomy(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
/* Allocate the first block of type H5FD_MEM_SUPER */
- type = H5FD_MEM_SUPER;
+ type = H5FD_MEM_SUPER;
addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* Allocate the second block of type H5FD_MEM_SUPER */
H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50);
/* Allocate the first block of type H5FD_MEM_DRAW */
- stype = H5FD_MEM_DRAW;
+ stype = H5FD_MEM_DRAW;
saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
/* Free the first block of type H5FD_MEM_SUPER */
@@ -7495,7 +7616,8 @@ test_dichotomy(hid_t fapl)
saddr2 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30);
/* Verify that saddr1 is not addr1 */
- if(saddr2 == addr1) TEST_ERROR
+ if (saddr2 == addr1)
+ TEST_ERROR
/* Free the first block of type H5FD_MEM_DRAW */
H5MF_xfree(f, stype, saddr1, (hsize_t)TBLOCK_SIZE30);
@@ -7504,20 +7626,20 @@ test_dichotomy(hid_t fapl)
addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30);
/* Verify that addr3 is not saddr1 */
- if(addr3 == saddr1) TEST_ERROR
+ if (addr3 == saddr1)
+ TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
+ return (1);
} /* test_dichotomy() */
/*
@@ -7531,42 +7653,44 @@ static int
set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t is_multi_or_split)
{
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
- char *memb_name[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- hbool_t relax;
- H5FD_mem_t mt;
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char * memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
HDassert(is_multi_or_split);
HDmemset(memb_name, 0, sizeof memb_name);
/* Get current split settings */
- if(H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
+ if (H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
TEST_ERROR
- if(is_multi_or_split) {
+ if (is_multi_or_split) {
/* Set memb_addr aligned */
memb_addr[H5FD_MEM_SUPER] = ((memb_addr[H5FD_MEM_SUPER] + pagesize - 1) / pagesize) * pagesize;
- memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
- } else {
+ memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
+ }
+ else {
/* Set memb_addr aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize;
} /* end else */
/* Set multi driver with new FAPLs */
- if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl_arr, (const char *const *)memb_name, memb_addr, relax) <
+ 0)
TEST_ERROR
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
return 0;
error:
- return(-1);
+ return (-1);
} /* set_multi_split() */
/*-------------------------------------------------------------------------
@@ -7586,55 +7710,56 @@ static unsigned
test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list */
- hid_t fapl_new = -1; /* File access property list ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- haddr_t addr2, addr3; /* Addresses for small metadata blocks */
- haddr_t saddr1; /* Addresses for small raw data blocks */
- haddr_t gaddr1; /* Addresses for large data blocks */
- hbool_t split = FALSE, multi = FALSE;
- char filename[FILENAME_LEN]; /* Filename to use */
- haddr_t found_addr; /* Address of the found section */
- unsigned fs_persist; /* To persist free-space or not */
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ hid_t fapl_new = -1; /* File access property list ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ haddr_t addr2, addr3; /* Addresses for small metadata blocks */
+ haddr_t saddr1; /* Addresses for small raw data blocks */
+ haddr_t gaddr1; /* Addresses for large data blocks */
+ hbool_t split = FALSE, multi = FALSE;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ haddr_t found_addr; /* Address of the found section */
+ unsigned fs_persist; /* To persist free-space or not */
TESTING("Paged aggregation for file space: H5MF_alloc/H5MF_xfree");
/* Check for split or multi driver */
- if(!HDstrcmp(env_h5_drvr, "split"))
+ if (!HDstrcmp(env_h5_drvr, "split"))
split = TRUE;
- else if(!HDstrcmp(env_h5_drvr, "multi"))
+ else if (!HDstrcmp(env_h5_drvr, "multi"))
multi = TRUE;
- if(!multi && !split) {
+ if (!multi && !split) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
- if(multi || split)
- if(set_multi_split(fapl_new, 4096, split) < 0)
+ if (multi || split)
+ if (set_multi_split(fapl_new, 4096, split) < 0)
TEST_ERROR;
/* Test with TRUE or FALSE for persisting free-space */
- for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+ for (fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
H5F_mem_page_t fs_type;
/* File creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR
/* Set the strategy to paged aggregation */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, fs_persist, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, fs_persist, (hsize_t)1) < 0)
TEST_ERROR
/* Create the file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR
/* Allocate 3 small metadata blocks: addr1, addr2, addr3 */
@@ -7645,13 +7770,14 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl)
/* Free the block with addr2 */
H5MF_xfree(f, H5FD_MEM_OHDR, addr2, (hsize_t)TBLOCK_SIZE1034);
- if(!fs_persist) {
+ if (!fs_persist) {
H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type);
/* Verify that the freed block with addr2 is found from the small metadata manager */
- if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0)
+ if (H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type],
+ &found_addr) < 0)
TEST_ERROR
- if(found_addr != addr2)
+ if (found_addr != addr2)
TEST_ERROR
} /* end if */
@@ -7662,11 +7788,12 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl)
/* Free the block with saddr1 */
H5MF_xfree(f, H5FD_MEM_DRAW, saddr1, (hsize_t)TBLOCK_SIZE30);
- if(!fs_persist) {
+ if (!fs_persist) {
/* Verify that the freed block with saddr1 is found from the small raw data manager */
- if(H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5F_MEM_PAGE_DRAW], &found_addr) < 0)
+ if (H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE30,
+ f->shared->fs_man[H5F_MEM_PAGE_DRAW], &found_addr) < 0)
TEST_ERROR
- if(found_addr != saddr1)
+ if (found_addr != saddr1)
TEST_ERROR
} /* end if */
@@ -7677,116 +7804,124 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl)
/* Free the block with gaddr1 */
H5MF_xfree(f, H5FD_MEM_DRAW, gaddr1, (hsize_t)TBLOCK_SIZE5000);
- if(!fs_persist) {
+ if (!fs_persist) {
H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type);
/* Verify that the freed block with gaddr1 is found from the large data manager */
- if(H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type], &found_addr) < 0)
+ if (H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type],
+ &found_addr) < 0)
TEST_ERROR
- if(found_addr != gaddr1)
+ if (found_addr != gaddr1)
TEST_ERROR
} /* end if */
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Close the property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
TEST_ERROR
- if(fs_persist) {
+ if (fs_persist) {
haddr_t prv_tag = HADDR_UNDEF;
/* Re-open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR
/* Set the freespace tag for the metadata cache */
- H5AC_tag(H5AC__FREESPACE_TAG, &prv_tag); \
+ H5AC_tag(H5AC__FREESPACE_TAG, &prv_tag);
/* Verify that the large generic manager is there */
H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type);
- if(!H5F_addr_defined(f->shared->fs_addr[fs_type]))
+ if (!H5F_addr_defined(f->shared->fs_addr[fs_type]))
TEST_ERROR
/* Verify that the small metadata manager is there */
- H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type);
- if(!H5F_addr_defined(f->shared->fs_addr[fs_type]))
+ H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_OHDR, f->shared->fs_page_size - 1,
+ (H5F_mem_page_t *)&fs_type);
+ if (!H5F_addr_defined(f->shared->fs_addr[fs_type]))
TEST_ERROR
/* Set up to use the small metadata manager */
- if(!(f->shared->fs_man[fs_type]))
- if(H5MF__open_fstype(f, fs_type) < 0)
+ if (!(f->shared->fs_man[fs_type]))
+ if (H5MF__open_fstype(f, fs_type) < 0)
TEST_ERROR
/* Verify that the freed block with addr2 is found from the small metadata manager */
- if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)(f->shared->fs_page_size-(addr3+TBLOCK_SIZE50)), f->shared->fs_man[fs_type], &found_addr) < 0)
+ if (H5MF__find_sect(f, H5FD_MEM_OHDR,
+ (hsize_t)(f->shared->fs_page_size - (addr3 + TBLOCK_SIZE50)),
+ f->shared->fs_man[fs_type], &found_addr) < 0)
TEST_ERROR
- if(found_addr != (addr3+TBLOCK_SIZE50))
+ if (found_addr != (addr3 + TBLOCK_SIZE50))
TEST_ERROR
/* Verify that the small raw data manager is there */
- if(!H5F_addr_defined(f->shared->fs_addr[H5F_MEM_PAGE_DRAW]))
+ if (!H5F_addr_defined(f->shared->fs_addr[H5F_MEM_PAGE_DRAW]))
TEST_ERROR
/* Set up to use the small raw data manager */
- if(!(f->shared->fs_man[H5F_MEM_PAGE_DRAW]))
- if(H5MF__open_fstype(f, H5F_MEM_PAGE_DRAW) < 0)
+ if (!(f->shared->fs_man[H5F_MEM_PAGE_DRAW]))
+ if (H5MF__open_fstype(f, H5F_MEM_PAGE_DRAW) < 0)
TEST_ERROR
/* Verify that the freed block with saddr1 is found from the small raw data manager */
- if(H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE30, f->shared->fs_man[H5F_MEM_PAGE_DRAW], &found_addr) < 0)
+ if (H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE30,
+ f->shared->fs_man[H5F_MEM_PAGE_DRAW], &found_addr) < 0)
TEST_ERROR
- if(found_addr != saddr1)
+ if (found_addr != saddr1)
TEST_ERROR
H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type);
- if(!(f->shared->fs_man[fs_type]))
+ if (!(f->shared->fs_man[fs_type]))
/* Set up to use the large data manager */
- if(H5MF__open_fstype(f, fs_type) < 0)
+ if (H5MF__open_fstype(f, fs_type) < 0)
TEST_ERROR
/* Verify that the freed block with gaddr1 is found from the large data manager */
- if(H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type], &found_addr) < 0)
+ if (H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type],
+ &found_addr) < 0)
TEST_ERROR
- if(found_addr != gaddr1)
+ if (found_addr != gaddr1)
TEST_ERROR
/* Reset the previous tag */
- H5AC_tag(prv_tag, NULL); \
+ H5AC_tag(prv_tag, NULL);
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
} /* end if fs_persist */
- } /* end for */
+ } /* end for */
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
TEST_ERROR
PASSED();
-
- } else {
+ }
+ else {
SKIPPED();
HDputs(" Current VFD doesn't support persisting free-space or paged aggregation strategy");
}
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fcpl);
H5Pclose(fapl_new);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_page_alloc_xfree() */
@@ -7807,72 +7942,78 @@ static unsigned
test_page_try_shrink(const char *env_h5_drvr, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list */
- H5F_t *f = NULL; /* Internal file object pointer */
- haddr_t addr1; /* Address for small metadata block */
- haddr_t saddr1; /* Address for small raw data block */
- haddr_t gaddr1; /* Address for large data block */
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
- htri_t status; /* status from shrinking */
- h5_stat_size_t file_size; /* File size */
- char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ haddr_t addr1; /* Address for small metadata block */
+ haddr_t saddr1; /* Address for small raw data block */
+ haddr_t gaddr1; /* Address for large data block */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ htri_t status; /* status from shrinking */
+ h5_stat_size_t file_size; /* File size */
+ char filename[FILENAME_LEN]; /* Filename to use */
TESTING("Paged aggregation for file space: H5MF_try_shrink()");
/* Current VFD that does not support continuous address space */
- contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") );
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* File creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set the strategy to paged aggregation */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
FAIL_STACK_ERROR
/* Create the file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
FAIL_STACK_ERROR
/* Allocate a small metadata block with addr1 */
addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50);
/* Try to shrink the block with addr1 */
- if((status = H5MF_try_shrink(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE50)) < 0)
+ if ((status = H5MF_try_shrink(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE50)) < 0)
FAIL_STACK_ERROR
- /* Couldn't shrink due to the section (remaining space in the page) is in the small metadata free-space manager */
- if(status == TRUE) TEST_ERROR
+ /* Couldn't shrink due to the section (remaining space in the page) is in the small metadata
+ * free-space manager */
+ if (status == TRUE)
+ TEST_ERROR
/* Allocate a small raw data block with saddr1 */
saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE50);
/* Try to shrink the block with saddr1 */
- if((status = H5MF_try_shrink(f, H5FD_MEM_DRAW, saddr1, (hsize_t)TBLOCK_SIZE50)) < 0)
+ if ((status = H5MF_try_shrink(f, H5FD_MEM_DRAW, saddr1, (hsize_t)TBLOCK_SIZE50)) < 0)
FAIL_STACK_ERROR
- /* Couldn't shrink due to the section (remaining space in the page) is in the small raw data free-space manager */
- if(status == TRUE) TEST_ERROR
+ /* Couldn't shrink due to the section (remaining space in the page) is in the small raw data
+ * free-space manager */
+ if (status == TRUE)
+ TEST_ERROR
/* Allocate a large data block with gaddr1 */
gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE5000);
/* Try to shrink the block with gaddr1 */
- if((status = H5MF_try_shrink(f, H5FD_MEM_DRAW, gaddr1, (hsize_t)TBLOCK_SIZE5000)) < 0)
+ if ((status = H5MF_try_shrink(f, H5FD_MEM_DRAW, gaddr1, (hsize_t)TBLOCK_SIZE5000)) < 0)
FAIL_STACK_ERROR
- /* Couldn't shrink due to the section (remaining space in the page) is in the large-sized free-space manager */
- if(status == TRUE) TEST_ERROR
+ /* Couldn't shrink due to the section (remaining space in the page) is in the large-sized free-space
+ * manager */
+ if (status == TRUE)
+ TEST_ERROR
/* Free the block with saddr1--merge to become 1 page, then return to the large manager */
H5MF_xfree(f, H5FD_MEM_DRAW, saddr1, (hsize_t)TBLOCK_SIZE50);
@@ -7880,36 +8021,38 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl)
/* Merge all 3 sections and shrunk */
H5MF_xfree(f, H5FD_MEM_OHDR, gaddr1, (hsize_t)TBLOCK_SIZE5000);
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Should be on page boundary */
- if(file_size % TBLOCK_SIZE4096)
+ if (file_size % TBLOCK_SIZE4096)
TEST_ERROR
/* Close the property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
PASSED();
-
- } else {
+ }
+ else {
SKIPPED();
HDputs(" Current VFD doesn't support paged aggregation");
}
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fcpl);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_page_try_shrink() */
@@ -7930,48 +8073,51 @@ static unsigned
test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list */
- H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ H5F_t * f = NULL; /* Internal file object pointer */
haddr_t addr1, addr2, addr3; /* Addresses for small metadata blocks */
haddr_t saddr1; /* Address for small raw data block */
hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
- htri_t was_extended; /* Whether the block can be extended or not */
- char filename[FILENAME_LEN]; /* Filename to use */
+ htri_t was_extended; /* Whether the block can be extended or not */
+ char filename[FILENAME_LEN]; /* Filename to use */
TESTING("Paged aggregation for file space: H5MF_try_extend() a small block");
/* Current VFD that does not support continuous address space */
- contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"));
+ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") &&
+ HDstrcmp(env_h5_drvr, "family"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* File creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set the strategy to paged aggregation */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
FAIL_STACK_ERROR
/* Create the file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
FAIL_STACK_ERROR
/* Allocate a small metadata block with addr1 */
addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE98);
/* Try extending the block with addr1 at EOF not crossing page boundary */
- was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE98, (hsize_t)3100);
+ was_extended =
+ H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE98, (hsize_t)3100);
/* Should succeed */
- if(was_extended != TRUE) TEST_ERROR
+ if (was_extended != TRUE)
+ TEST_ERROR
/* Allocate 2 small metadata blocks with addr2 and addr3--will be on another metadata page */
addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE100);
@@ -7979,23 +8125,29 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl)
/* The block with addr2 should be page aligned */
/* The block with addr3 resides right next to the block with addr2 */
- if(addr2 % TBLOCK_SIZE4096)
+ if (addr2 % TBLOCK_SIZE4096)
TEST_ERROR
- if(addr3 != (addr2 + TBLOCK_SIZE100))
+ if (addr3 != (addr2 + TBLOCK_SIZE100))
TEST_ERROR
/* Free the block with addr2 */
H5MF_xfree(f, H5FD_MEM_OHDR, addr2, (hsize_t)TBLOCK_SIZE100);
- /* Try extending the block with addr1 that will cross to the next page where the freed block with addr2 resides */
- was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3198, (hsize_t)TBLOCK_SIZE100);
+ /* Try extending the block with addr1 that will cross to the next page where the freed block with
+ * addr2 resides */
+ was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3198,
+ (hsize_t)TBLOCK_SIZE100);
/* Shouldn't succeed--should not cross page boundary */
- if(was_extended == TRUE) TEST_ERROR
+ if (was_extended == TRUE)
+ TEST_ERROR
- /* Try extending the block with addr1 into the free-space section that is big enough to fulfill the request */
- was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3198, (hsize_t)TBLOCK_SIZE50);
+ /* Try extending the block with addr1 into the free-space section that is big enough to fulfill the
+ * request */
+ was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3198,
+ (hsize_t)TBLOCK_SIZE50);
/* Should succeed */
- if(was_extended != TRUE) TEST_ERROR
+ if (was_extended != TRUE)
+ TEST_ERROR
/* Free the block with addr1 */
H5MF_xfree(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE3248);
@@ -8006,65 +8158,81 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl)
addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3286);
/* Try extending the block into the threshold with size > H5F_FILE_SPACE_PGEND_META_THRES */
- was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3286, (hsize_t)TBLOCK_SIZE11);
+ was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3286,
+ (hsize_t)TBLOCK_SIZE11);
/* Shouldn't succeed */
- if(was_extended == TRUE) TEST_ERROR
+ if (was_extended == TRUE)
+ TEST_ERROR
/* Try extending the block into the threshold with size < H5F_FILE_SPACE_PGEND_META_THRES */
- was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3286, (hsize_t)TBLOCK_SIZE2);
+ was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3286,
+ (hsize_t)TBLOCK_SIZE2);
/* Should succeed */
- if(was_extended != TRUE) TEST_ERROR
+ if (was_extended != TRUE)
+ TEST_ERROR
- /* Free the block with addr3--will merge with the remaining sections to become a page and then free the page */
+ /* Free the block with addr3--will merge with the remaining sections to become a page and then free
+ * the page */
H5MF_xfree(f, H5FD_MEM_OHDR, addr3, (hsize_t)TBLOCK_SIZE150);
/* Allocate a small raw data block with saddr1 */
saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE4086);
/* Try extending the block crossing the page boundary */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4086, (hsize_t)TBLOCK_SIZE11);
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4086,
+ (hsize_t)TBLOCK_SIZE11);
/* Shouldn't succeed */
- if(was_extended == TRUE) TEST_ERROR
+ if (was_extended == TRUE)
+ TEST_ERROR
/* Try extending the block not crossing page boundary */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4086, (hsize_t)TBLOCK_SIZE10);
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4086,
+ (hsize_t)TBLOCK_SIZE10);
/* Should succeed */
- if(was_extended != TRUE) TEST_ERROR
+ if (was_extended != TRUE)
+ TEST_ERROR
/* The extended block is now "large" in size */
/* Try extending the block */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4096, (hsize_t)TBLOCK_SIZE10);
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4096,
+ (hsize_t)TBLOCK_SIZE10);
/* Should succeed */
- if(was_extended != TRUE) TEST_ERROR
+ if (was_extended != TRUE)
+ TEST_ERROR
/* Try extending the large-sized block */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4106, (hsize_t)TBLOCK_SIZE5000);
- /* Should not succeed because the mis-aligned fragment in the page is in the large-sized free-space manager */
- if(was_extended == TRUE) TEST_ERROR
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)saddr1, (hsize_t)TBLOCK_SIZE4106,
+ (hsize_t)TBLOCK_SIZE5000);
+ /* Should not succeed because the mis-aligned fragment in the page is in the large-sized free-space
+ * manager */
+ if (was_extended == TRUE)
+ TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
PASSED();
-
- } else {
+ }
+ else {
SKIPPED();
HDputs(" Current VFD doesn't support paged aggregation");
}
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fcpl);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_page_small_try_extend() */
@@ -8085,127 +8253,149 @@ static unsigned
test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list */
- H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ H5F_t * f = NULL; /* Internal file object pointer */
haddr_t gaddr1, gaddr2, gaddr3, gaddr4; /* Addresses for large data blocks */
hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
- htri_t was_extended; /* Whether the block can be extended or not */
- char filename[FILENAME_LEN]; /* Filename to use */
+ htri_t was_extended; /* Whether the block can be extended or not */
+ char filename[FILENAME_LEN]; /* Filename to use */
TESTING("Paged aggregation for file space: H5MF_try_extend() a large block");
/* Current VFD that does not support continuous address space */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* File creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set the strategy to paged aggregation */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
FAIL_STACK_ERROR
/* Create the file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
FAIL_STACK_ERROR
/* Allocate a large data block with gaddr1 */
gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)6000);
/* Should be page aligned */
- if(gaddr1 % TBLOCK_SIZE4096)
+ if (gaddr1 % TBLOCK_SIZE4096)
TEST_ERROR
/* Extending the block with gaddr1 at EOF to become 2 pages */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr1, (hsize_t)TBLOCK_SIZE6000, (hsize_t)TBLOCK_SIZE2192);
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr1, (hsize_t)TBLOCK_SIZE6000,
+ (hsize_t)TBLOCK_SIZE2192);
/* Should succeed */
- if(was_extended != TRUE) TEST_ERROR
+ if (was_extended != TRUE)
+ TEST_ERROR
/* Allocate a large data block with gaddr2 */
gaddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8000);
/* Should be page aligned */
- if(gaddr2 % TBLOCK_SIZE4096)
+ if (gaddr2 % TBLOCK_SIZE4096)
TEST_ERROR
/* Try extending the block with gaddr1 */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr1, (hsize_t)TBLOCK_SIZE8192, (hsize_t)TBLOCK_SIZE50);
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr1, (hsize_t)TBLOCK_SIZE8192,
+ (hsize_t)TBLOCK_SIZE50);
/* Should not succeed */
- if(was_extended == TRUE) TEST_ERROR
+ if (was_extended == TRUE)
+ TEST_ERROR
/* Allocate a large data block with gaddr3 */
gaddr3 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8000);
/* Should be page aligned */
- if(gaddr3 % TBLOCK_SIZE4096)
+ if (gaddr3 % TBLOCK_SIZE4096)
TEST_ERROR
- /* Try extending the block with gaddr2--there is a free-space section big enough to fulfill the request */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8000, (hsize_t)TBLOCK_SIZE100);
+ /* Try extending the block with gaddr2--there is a free-space section big enough to fulfill the
+ * request */
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8000,
+ (hsize_t)TBLOCK_SIZE100);
/* Should succeed */
- if(was_extended == FALSE) TEST_ERROR
+ if (was_extended == FALSE)
+ TEST_ERROR
- /* Try extending the block with gaddr2--there is no free-space section big enough to fulfill the request */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8100, (hsize_t)TBLOCK_SIZE100);
+ /* Try extending the block with gaddr2--there is no free-space section big enough to fulfill the
+ * request */
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8100,
+ (hsize_t)TBLOCK_SIZE100);
/* Should not succeed */
- if(was_extended == TRUE) TEST_ERROR
+ if (was_extended == TRUE)
+ TEST_ERROR
- /* Try extending the block with gaddr2--there is a free-space section big enough to fulfill the request */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8100, (hsize_t)TBLOCK_SIZE90);
+ /* Try extending the block with gaddr2--there is a free-space section big enough to fulfill the
+ * request */
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8100,
+ (hsize_t)TBLOCK_SIZE90);
/* Should succeed */
- if(was_extended == FALSE) TEST_ERROR
+ if (was_extended == FALSE)
+ TEST_ERROR
/* Try extending the block with gaddr2 */
- /* There is no free-space section big enough to fulfill the request (request is < H5F_FILE_SPACE_PGEND_META_THRES) */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8190, (hsize_t)TBLOCK_SIZE5);
+ /* There is no free-space section big enough to fulfill the request (request is <
+ * H5F_FILE_SPACE_PGEND_META_THRES) */
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8190,
+ (hsize_t)TBLOCK_SIZE5);
/* Should not succeed */
- if(was_extended == TRUE) TEST_ERROR
+ if (was_extended == TRUE)
+ TEST_ERROR
/* Allocate a large data block with gaddr4 */
gaddr4 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE5000);
/* Should be page aligned */
- if(gaddr4 % TBLOCK_SIZE4096)
+ if (gaddr4 % TBLOCK_SIZE4096)
TEST_ERROR
- /* Free the block with gaddr3--will merge with remaining free space to become 2 pages + section (size 2) in previous page */
+ /* Free the block with gaddr3--will merge with remaining free space to become 2 pages + section (size
+ * 2) in previous page */
H5MF_xfree(f, H5FD_MEM_DRAW, gaddr3, (hsize_t)TBLOCK_SIZE8000);
- /* Try extending the block with gaddr2 crossing page boundary--there is free-space section big enough to fulfill the request */
- was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8190, (hsize_t)TBLOCK_SIZE5);
+ /* Try extending the block with gaddr2 crossing page boundary--there is free-space section big enough
+ * to fulfill the request */
+ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8190,
+ (hsize_t)TBLOCK_SIZE5);
/* Should succeed */
- if(was_extended == FALSE) TEST_ERROR
+ if (was_extended == FALSE)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
PASSED();
-
- } else {
+ }
+ else {
SKIPPED();
HDputs(" Current VFD doesn't support paged aggregation strategy");
}
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fcpl);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_page_large_try_extend() */
@@ -8226,39 +8416,39 @@ static unsigned
test_page_large(const char *env_h5_drvr, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list ID */
- H5F_t *f = NULL; /* Internal file object pointer */
- haddr_t gaddr1, gaddr2, gaddr3, gaddr4; /* Addresses for blocks */
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
- H5FS_stat_t fs_stat; /* Information for free-space manager */
- h5_stat_size_t file_size; /* File size */
- char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ haddr_t gaddr1, gaddr2, gaddr3, gaddr4; /* Addresses for blocks */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ h5_stat_size_t file_size; /* File size */
+ char filename[FILENAME_LEN]; /* Filename to use */
TESTING("Paged aggregation for file space: large allocations and de-allocations");
/* Current VFD that does not support continuous address space */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* File creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set the strategy to paged aggregation */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
FAIL_STACK_ERROR
/* Create the file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
FAIL_STACK_ERROR
/* Allocate a large data block with gaddr1 */
@@ -8266,20 +8456,20 @@ test_page_large(const char *env_h5_drvr, hid_t fapl)
gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE6000);
/* Should be page aligned */
- if(gaddr1 % TBLOCK_SIZE4096)
+ if (gaddr1 % TBLOCK_SIZE4096)
TEST_ERROR
/* Allocate a large data block with gaddr2--should be on another page */
/* Allocate 1 page + 3904 bytes; 192 bytes in free-space manager */
gaddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8000);
/* Should be page aligned */
- if(gaddr2 % TBLOCK_SIZE4096)
+ if (gaddr2 % TBLOCK_SIZE4096)
TEST_ERROR
/* Allocate a large data block with gaddr3--should be on another page */
/* Allocate 2 pages + 3808 bytes; 288 bytes in free-space manager */
gaddr3 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE12000);
- if(!H5F_addr_defined(gaddr3))
+ if (!H5F_addr_defined(gaddr3))
TEST_ERROR
/* Free the block with gaddr2 */
@@ -8287,32 +8477,33 @@ test_page_large(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, H5FD_MEM_DRAW, gaddr2, (hsize_t)TBLOCK_SIZE8000);
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify that the manager contains 2 free-space sections: 10384 and 288 */
- if(fs_stat.tot_sect_count != 2)
+ if (fs_stat.tot_sect_count != 2)
TEST_ERROR
- if(fs_stat.tot_space != (10384+288))
+ if (fs_stat.tot_space != (10384 + 288))
TEST_ERROR
- /* Allocate a large data block with gaddr4--there is a free-space section able to fulfill the request */
+ /* Allocate a large data block with gaddr4--there is a free-space section able to fulfill the request
+ */
/* Free-space sections: 2192 + 3192 + 288 = 5672 bytes */
gaddr4 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE5000);
/* Should be page aligned */
- if(gaddr4 % TBLOCK_SIZE4096)
+ if (gaddr4 % TBLOCK_SIZE4096)
TEST_ERROR
- if(gaddr4 != gaddr2)
+ if (gaddr4 != gaddr2)
TEST_ERROR
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify that that there are 3 free-space sections */
- if(fs_stat.tot_sect_count != 3)
+ if (fs_stat.tot_sect_count != 3)
TEST_ERROR
- if(fs_stat.tot_space != (2192+3192+288))
+ if (fs_stat.tot_space != (2192 + 3192 + 288))
TEST_ERROR
/* Free the two blocks with gaddr1 and gaddr4 */
@@ -8320,44 +8511,43 @@ test_page_large(const char *env_h5_drvr, hid_t fapl)
H5MF_xfree(f, H5FD_MEM_DRAW, gaddr4, (hsize_t)TBLOCK_SIZE5000);
/* Get free-space info */
- if(H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
FAIL_STACK_ERROR
/* Verify that that there are 2 free-space sections: 16384 (4 pages) + 288 */
- if(fs_stat.tot_sect_count != 2)
+ if (fs_stat.tot_sect_count != 2)
TEST_ERROR
- if(fs_stat.tot_space != (16384+288))
+ if (fs_stat.tot_space != (16384 + 288))
TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0)
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
/* Verify that file size end on a page boundary */
- if(file_size % TBLOCK_SIZE4096)
+ if (file_size % TBLOCK_SIZE4096)
TEST_ERROR
PASSED();
-
- } else {
+ }
+ else {
SKIPPED();
HDputs(" Current VFD doesn't support paged aggregation strategy");
}
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
- return(1);
+ H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_END_TRY;
+ return (1);
} /* test_page_large() */
@@ -8377,44 +8567,44 @@ error:
static unsigned
test_page_small(const char *env_h5_drvr, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list */
- H5F_t *f = NULL; /* Internal file object pointer */
- haddr_t addr2, addr3, addr4, addr5; /* Addresses for blocks */
- haddr_t addr9, addr10, addr11; /* Address for small metadata blocks */
- haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */
- H5FS_stat_t fs_stat; /* Information for free-space manager */
- char filename[FILENAME_LEN]; /* Filename to use */
- hbool_t multi= FALSE, split = FALSE, family = FALSE;
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ H5F_t * f = NULL; /* Internal file object pointer */
+ haddr_t addr2, addr3, addr4, addr5; /* Addresses for blocks */
+ haddr_t addr9, addr10, addr11; /* Address for small metadata blocks */
+ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hbool_t multi = FALSE, split = FALSE, family = FALSE;
TESTING("Paged aggregation for file space: small allocations and de-allocations");
- if(!HDstrcmp(env_h5_drvr, "split"))
+ if (!HDstrcmp(env_h5_drvr, "split"))
split = TRUE;
- else if(!HDstrcmp(env_h5_drvr, "multi"))
+ else if (!HDstrcmp(env_h5_drvr, "multi"))
multi = TRUE;
- else if(!HDstrcmp(env_h5_drvr, "family"))
+ else if (!HDstrcmp(env_h5_drvr, "family"))
family = TRUE;
- if(!multi && !split) {
+ if (!multi && !split) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* File creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set the strategy to paged aggregation */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
FAIL_STACK_ERROR
/* Create the file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
FAIL_STACK_ERROR
/* Allocate 2 small metadata blocks: addr1, addr2 */
@@ -8424,45 +8614,48 @@ test_page_small(const char *env_h5_drvr, hid_t fapl)
/* Allocate a small raw data block with saddr1 */
saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE30);
/* Should be on the second page and page aligned */
- if(saddr1 % TBLOCK_SIZE4096)
+ if (saddr1 % TBLOCK_SIZE4096)
TEST_ERROR
/* Allocate a small raw data block with saddr2 */
saddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE50);
/* Should not be page aligned */
- if(!(saddr2 % TBLOCK_SIZE4096))
+ if (!(saddr2 % TBLOCK_SIZE4096))
TEST_ERROR
/* Should be next to the block with saddr1 */
- if(saddr2 != (saddr1 + TBLOCK_SIZE30))
+ if (saddr2 != (saddr1 + TBLOCK_SIZE30))
TEST_ERROR
- /* Allocate a small metadata block with addr3--there is no free-space section big enough to fulfill the request */
+ /* Allocate a small metadata block with addr3--there is no free-space section big enough to fulfill
+ * the request */
addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE4020);
/* Should be on the third page and page aligned */
- if(addr3 % TBLOCK_SIZE4096)
+ if (addr3 % TBLOCK_SIZE4096)
TEST_ERROR
- /* Allocate a small metadata block with addr4--there is a free-space section big enough to fulfill the request */
+ /* Allocate a small metadata block with addr4--there is a free-space section big enough to fulfill the
+ * request */
addr4 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80);
/* Should not be page aligned */
- if(!(addr4 % TBLOCK_SIZE4096))
+ if (!(addr4 % TBLOCK_SIZE4096))
TEST_ERROR
/* Should be next to the block with addr2 */
- if(addr4 != (addr2 + TBLOCK_SIZE50))
+ if (addr4 != (addr2 + TBLOCK_SIZE50))
TEST_ERROR
- /* Allocate a small metadata block with addr5--there is a free-space section big enough to fulfill the request */
+ /* Allocate a small metadata block with addr5--there is a free-space section big enough to fulfill the
+ * request */
addr5 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE40);
/* Should not be page aligned */
- if(!(addr5 % TBLOCK_SIZE4096))
+ if (!(addr5 % TBLOCK_SIZE4096))
TEST_ERROR
/* Should be next to the block with addr3 */
- if(addr5 != (addr3 + TBLOCK_SIZE4020))
+ if (addr5 != (addr3 + TBLOCK_SIZE4020))
TEST_ERROR
/* Allocate a small metadata block with addr6--taking up the remaining space in the first page */
- if(family)
+ if (family)
H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3080);
else
H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3088);
@@ -8474,54 +8667,59 @@ test_page_small(const char *env_h5_drvr, hid_t fapl)
H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50);
addr9 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80);
- /* Free the block with saddr1 and saddr2--merge with remaining section to become a page which will be returned to the large manager */
+ /* Free the block with saddr1 and saddr2--merge with remaining section to become a page which will be
+ * returned to the large manager */
H5MF_xfree(f, H5FD_MEM_DRAW, saddr1, (hsize_t)TBLOCK_SIZE30);
H5MF_xfree(f, H5FD_MEM_DRAW, saddr2, (hsize_t)TBLOCK_SIZE50);
/* Verify that the large manager does contain a section with file space page size (default is 4096) */
- if(!f->shared->fs_man[H5F_MEM_PAGE_GENERIC])
+ if (!f->shared->fs_man[H5F_MEM_PAGE_GENERIC])
TEST_ERROR
- if(H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
+ if (H5FS_stat_info(f, f->shared->fs_man[H5F_MEM_PAGE_GENERIC], &fs_stat) < 0)
FAIL_STACK_ERROR
- if(fs_stat.tot_space != TBLOCK_SIZE4096)
+ if (fs_stat.tot_space != TBLOCK_SIZE4096)
TEST_ERROR
- /* Allocate a small metadata block with addr10--there is a free-space section big enough to fulfill the request */
+ /* Allocate a small metadata block with addr10--there is a free-space section big enough to fulfill
+ * the request */
addr10 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3900);
/* The block should be next to the block with addr9 */
- if(addr10 != (addr9 + TBLOCK_SIZE80))
+ if (addr10 != (addr9 + TBLOCK_SIZE80))
TEST_ERROR
/* Allocate a small metadata block with addr11 */
- /* The current free-space section is unable to fulfill the request; obtain a page from the large manager */
+ /* The current free-space section is unable to fulfill the request; obtain a page from the large
+ * manager */
addr11 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80);
/* The address of the block should be the same the freed block with saddr1 */
- if(addr11 != saddr1)
+ if (addr11 != saddr1)
TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
PASSED();
-
- } else {
+ }
+ else {
SKIPPED();
HDputs(" Current VFD doesn't support paged aggregation strategy");
}
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fcpl);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_page_small() */
@@ -8542,26 +8740,26 @@ static unsigned
test_page_alignment(const char *env_h5_drvr, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list ID */
- hid_t fcpl2 = -1; /* File creation property list ID */
- hid_t fapl_new = -1; /* File access property list ID */
- H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fcpl2 = -1; /* File creation property list ID */
+ hid_t fapl_new = -1; /* File access property list ID */
+ H5F_t * f = NULL; /* Internal file object pointer */
haddr_t addr1, addr2; /* Addresses for small metadata blocks */
haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */
haddr_t gaddr1, gaddr2; /* Addresses for blocks */
- char filename[FILENAME_LEN]; /* Filename to use */
+ char filename[FILENAME_LEN]; /* Filename to use */
hbool_t split = FALSE, multi = FALSE;
TESTING("Paged aggregation and H5Pset_alignment: verify proper alignment is used");
/* Check for split or multi driver */
- if(!HDstrcmp(env_h5_drvr, "split"))
+ if (!HDstrcmp(env_h5_drvr, "split"))
split = TRUE;
- else if(!HDstrcmp(env_h5_drvr, "multi"))
+ else if (!HDstrcmp(env_h5_drvr, "multi"))
multi = TRUE;
- if(!multi && !split) {
+ if (!multi && !split) {
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
@@ -8571,94 +8769,100 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
* page size when paged aggregation is enabled.
*/
- if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_new = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* The alignment to use will be the library's default file space page size */
- if(H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set alignment value to 16 */
- if(H5Pset_alignment(fapl_new, (hsize_t)0, (hsize_t)TEST_ALIGN16) < 0)
+ if (H5Pset_alignment(fapl_new, (hsize_t)0, (hsize_t)TEST_ALIGN16) < 0)
TEST_ERROR
- if(split || multi) {
- hid_t memb_fapl;
+ if (split || multi) {
+ hid_t memb_fapl;
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
- char *memb_name[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- hbool_t relax;
- H5FD_mem_t mt;
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char * memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
/* Create fapl */
- if((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set alignment */
- if(H5Pset_alignment(memb_fapl, 0, (hsize_t)TEST_ALIGN16) < 0)
+ if (H5Pset_alignment(memb_fapl, 0, (hsize_t)TEST_ALIGN16) < 0)
TEST_ERROR
HDmemset(memb_name, 0, sizeof memb_name);
- if(split) {
+ if (split) {
/* Set split driver with new FAPLs */
- if(H5Pset_fapl_split(fapl_new, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0)
+ if (H5Pset_fapl_split(fapl_new, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0)
TEST_ERROR
/* Get current multi settings */
- if(H5Pget_fapl_multi(fapl_new, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
+ if (H5Pget_fapl_multi(fapl_new, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
TEST_ERROR
/* Set memb_addr aligned */
- memb_addr[H5FD_MEM_SUPER] = ((memb_addr[H5FD_MEM_SUPER] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
- memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
+ memb_addr[H5FD_MEM_SUPER] =
+ ((memb_addr[H5FD_MEM_SUPER] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
+ memb_addr[H5FD_MEM_DRAW] =
+ ((memb_addr[H5FD_MEM_DRAW] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
/* Set split driver with new FAPLs */
- if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ if (H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl_arr, (const char *const *)memb_name,
+ memb_addr, relax) < 0)
TEST_ERROR
-
- } else {
+ }
+ else {
/* Get current multi settings */
- if(H5Pget_fapl_multi(fapl_new, memb_map, NULL, memb_name, memb_addr, &relax) < 0)
+ if (H5Pget_fapl_multi(fapl_new, memb_map, NULL, memb_name, memb_addr, &relax) < 0)
TEST_ERROR
/* Populate memb_fapl_arr */
/* Set memb_addr aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
memb_fapl_arr[mt] = memb_fapl;
- memb_addr[mt] = ((memb_addr[mt] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
+ memb_addr[mt] =
+ ((memb_addr[mt] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
}
/* Set multi driver with new FAPLs */
- if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ if (H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl_arr, (const char *const *)memb_name,
+ memb_addr, relax) < 0)
TEST_ERROR
} /* end else */
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
/* Close memb_fapl */
- if(H5Pclose(memb_fapl) < 0)
+ if (H5Pclose(memb_fapl) < 0)
TEST_ERROR
} /* end if */
/* File creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR
/* Set the strategy to paged aggregation and persisting free space */
/* The alignment to use will be the library's default file space page size */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
TEST_ERROR
/* Create the file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR
/* Allocate 2 small raw data blocks */
@@ -8666,11 +8870,11 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
saddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE50);
/* Should be on the second page and page aligned on 4096 (default file space page size) */
- if(saddr1 % TBLOCK_SIZE4096)
+ if (saddr1 % TBLOCK_SIZE4096)
TEST_ERROR
/* Should be next to the block with saddr1 */
- if(saddr2 != (saddr1 + TBLOCK_SIZE30))
+ if (saddr2 != (saddr1 + TBLOCK_SIZE30))
TEST_ERROR
/* Allocate 2 large raw data blocks */
@@ -8678,19 +8882,19 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
gaddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8000);
/* Should be on the 3rd page and page aligned */
- if(gaddr1 % TBLOCK_SIZE4096)
+ if (gaddr1 % TBLOCK_SIZE4096)
TEST_ERROR
/* Should be on the 4th page and page aligned */
- if(gaddr2 % TBLOCK_SIZE4096)
+ if (gaddr2 % TBLOCK_SIZE4096)
TEST_ERROR
/* Close the file creation property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/*
@@ -8699,18 +8903,18 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
*/
/* fapl_new has latest format and H5Pset_alignment set */
/* Disable small data block mechanism */
- if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0)
+ if (H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0)
TEST_ERROR
/* Disable metadata block mechanism */
- if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0)
+ if (H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0)
TEST_ERROR
/* Create the file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR
/* Allocate 2 small metadata blocks */
@@ -8718,12 +8922,12 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
addr2 = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE50);
/* Should be aligned on 16 */
- if(addr1 % TEST_ALIGN16 || addr2 % TEST_ALIGN16)
+ if (addr1 % TEST_ALIGN16 || addr2 % TEST_ALIGN16)
TEST_ERROR
/* addr2 should be right next to the block with addr1 */
- if((addr1 + TBLOCK_SIZE30) % TEST_ALIGN16)
- if(addr2 != (((addr1 + TBLOCK_SIZE30) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ if ((addr1 + TBLOCK_SIZE30) % TEST_ALIGN16)
+ if (addr2 != (((addr1 + TBLOCK_SIZE30) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
TEST_ERROR
/* Allocate 2 small raw data blocks */
@@ -8731,23 +8935,23 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
saddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE100);
/* Should be aligned on 16 */
- if(saddr1 % TEST_ALIGN16 || saddr2 % TEST_ALIGN16)
+ if (saddr1 % TEST_ALIGN16 || saddr2 % TEST_ALIGN16)
TEST_ERROR
- if(!multi && !split) {
+ if (!multi && !split) {
/* saddr1 should be right next to the block with addr2 */
- if((addr2 + TBLOCK_SIZE50) % TEST_ALIGN16)
- if(saddr1 != (((addr2 + TBLOCK_SIZE50) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ if ((addr2 + TBLOCK_SIZE50) % TEST_ALIGN16)
+ if (saddr1 != (((addr2 + TBLOCK_SIZE50) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
TEST_ERROR
}
/* saddr2 should be right next to the block with saddr1 */
- if((saddr1 + TBLOCK_SIZE80) % TEST_ALIGN16)
- if(saddr2 != (((saddr1 + TBLOCK_SIZE80) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ if ((saddr1 + TBLOCK_SIZE80) % TEST_ALIGN16)
+ if (saddr2 != (((saddr1 + TBLOCK_SIZE80) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/*
@@ -8755,23 +8959,23 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
* via H5Pset_alignment when paged aggregation not enabled.
*/
/* File creation property list */
- if((fcpl2 = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl2 = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR
/* Set file space page size */
- if(H5Pset_file_space_page_size(fcpl2, (hsize_t)TBLOCK_SIZE8192) < 0)
+ if (H5Pset_file_space_page_size(fcpl2, (hsize_t)TBLOCK_SIZE8192) < 0)
TEST_ERROR
/* Set strategy to H5F_FSPACE_STRATEGY_AGGR but meta/raw data block is 0 as set in fapl_new */
- if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
TEST_ERROR
/* fapl_new has latest format, H5Pset_alignment set, and disable meta/raw block */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl2, fapl_new)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl2, fapl_new)) < 0)
TEST_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR
/* Allocate 2 small raw data blocks */
@@ -8779,72 +8983,74 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
saddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE50);
/* Should be aligned on 16 */
- if(saddr1 % TEST_ALIGN16)
+ if (saddr1 % TEST_ALIGN16)
TEST_ERROR
- if(saddr2 % TEST_ALIGN16)
+ if (saddr2 % TEST_ALIGN16)
TEST_ERROR
/* saddr2 should be right next to the block with saddr1 */
- if((saddr1 + TBLOCK_SIZE30) % TEST_ALIGN16)
- if(saddr2 != (((saddr1 + TBLOCK_SIZE30) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ if ((saddr1 + TBLOCK_SIZE30) % TEST_ALIGN16)
+ if (saddr2 != (((saddr1 + TBLOCK_SIZE30) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
TEST_ERROR
/* Allocate a large raw data block */
gaddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE5000);
/* Should be aligned on 16 */
- if(gaddr1 % TEST_ALIGN16)
+ if (gaddr1 % TEST_ALIGN16)
TEST_ERROR
/* gaddr1 is right next to the block with saddr2 */
- if((saddr2 + TBLOCK_SIZE50) % TEST_ALIGN16)
- if(gaddr1 != (((saddr2 + TBLOCK_SIZE50) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
+ if ((saddr2 + TBLOCK_SIZE50) % TEST_ALIGN16)
+ if (gaddr1 != (((saddr2 + TBLOCK_SIZE50) / TEST_ALIGN16) + 1) * TEST_ALIGN16)
TEST_ERROR
/* There is no free-space manager involved for H5F_FSPACE_STRATEGY_AGGR strategy */
- if(f->shared->fs_man[H5FD_MEM_DRAW] || f->shared->fs_man[H5FD_MEM_SUPER])
+ if (f->shared->fs_man[H5FD_MEM_DRAW] || f->shared->fs_man[H5FD_MEM_SUPER])
TEST_ERROR
/* Closing */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
- if(H5Pclose(fcpl2) < 0)
+ if (H5Pclose(fcpl2) < 0)
TEST_ERROR
- if(H5Pclose(fapl_new) < 0)
+ if (H5Pclose(fapl_new) < 0)
TEST_ERROR
PASSED();
-
- } else {
+ }
+ else {
SKIPPED();
HDputs(" Current VFD doesn't support persisting free-space or paged aggregation strategy");
}
- return(0);
+ return (0);
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fcpl);
H5Pclose(fapl_new);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* test_page_alignment() */
int
main(void)
{
- hid_t fapl = -1; /* File access property list for data files */
- hid_t new_fapl = -1; /* File access property list for alignment & aggr setting */
- unsigned nerrors = 0; /* Cumulative error count */
- test_type_t curr_test; /* Current test being worked on */
- const char *env_h5_drvr; /* File Driver value from environment */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t fapl = -1; /* File access property list for data files */
+ hid_t new_fapl = -1; /* File access property list for alignment & aggr setting */
+ unsigned nerrors = 0; /* Cumulative error count */
+ test_type_t curr_test; /* Current test being worked on */
+ const char *env_h5_drvr; /* File Driver value from environment */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
h5_reset();
@@ -8852,11 +9058,13 @@ main(void)
fapl = h5_fileaccess();
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Make a copy of the FAPL before adjusting the alignment */
- if((new_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* For old library format--interaction with file allocation */
nerrors += test_mf_eoa(env_h5_drvr, fapl);
nerrors += test_mf_eoa_shrink(env_h5_drvr, fapl);
@@ -8883,16 +9091,16 @@ main(void)
nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl);
/* For old library format--tests for alignment */
- for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) {
+ for (curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) {
- switch(curr_test) {
+ switch (curr_test) {
case TEST_NORMAL: /* set alignment = 1024 */
- if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0)
+ if (H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0)
TEST_ERROR
break;
case TEST_AGGR_SMALL: /* set alignment = 4096 */
- if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN4096) < 0)
+ if (H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN4096) < 0)
TEST_ERROR
break;
@@ -8958,35 +9166,38 @@ main(void)
nerrors += test_page_large_try_extend(env_h5_drvr, fapl);
nerrors += test_page_small_try_extend(env_h5_drvr, fapl);
nerrors += test_page_try_shrink(env_h5_drvr, fapl);
- nerrors += test_page_alloc_xfree(env_h5_drvr, fapl); /* can handle multi/split */
- nerrors += test_page_alignment(env_h5_drvr, fapl); /* can handle multi/split */
+ nerrors += test_page_alloc_xfree(env_h5_drvr, fapl); /* can handle multi/split */
+ nerrors += test_page_alignment(env_h5_drvr, fapl); /* can handle multi/split */
/* tests for specific bugs */
nerrors += test_mf_bug1(env_h5_drvr, fapl);
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
h5_cleanup(FILENAME, fapl);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All free-space manager tests for file memory passed.");
- return(0);
+ return (0);
error:
HDputs("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(new_fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
- return(1);
+ return (1);
} /* main() */
-
diff --git a/test/mirror_vfd.c b/test/mirror_vfd.c
index 5aeb299..325999b 100644
--- a/test/mirror_vfd.c
+++ b/test/mirror_vfd.c
@@ -28,7 +28,7 @@
#ifdef H5_HAVE_MIRROR_VFD
-#include "H5FDmirror_priv.h" /* Private header for the mirror VFD */
+#include "H5FDmirror_priv.h" /* Private header for the mirror VFD */
/* For future consideration, IP address and port number might be
* environment variables?
@@ -43,8 +43,8 @@
/* Parameters for the "large chunked dataset" writing */
#define MAX_DSET_COUNT 255
-#define DSET_DIM 32
-#define CHUNK_DIM 8
+#define DSET_DIM 32
+#define CHUNK_DIM 8
#define CONCURRENT_COUNT 3 /* Number of files in concurrent test */
@@ -60,13 +60,13 @@
static unsigned int g_verbosity = DEFAULT_VERBOSITY;
/* Macro for selective debug printing / logging */
-#define LOGPRINT(lvl, ...) \
-do { \
- if ((lvl) <= g_verbosity) { \
- fprintf(g_log_stream, __VA_ARGS__); \
- fflush(g_log_stream); \
- } \
-} while (0)
+#define LOGPRINT(lvl, ...) \
+ do { \
+ if ((lvl) <= g_verbosity) { \
+ fprintf(g_log_stream, __VA_ARGS__); \
+ fflush(g_log_stream); \
+ } \
+ } while (0)
#define MIRROR_RW_DIR "mirror_rw/"
#define MIRROR_WO_DIR "mirror_wo/"
@@ -78,34 +78,30 @@ static char mesg[MIRR_MESG_SIZE + 1];
/* Convenience structure for passing file names via helper functions.
*/
struct mirrortest_filenames {
- char rw[H5FD_SPLITTER_PATH_MAX+1];
- char wo[H5FD_SPLITTER_PATH_MAX+1];
- char log[H5FD_SPLITTER_PATH_MAX+1];
+ char rw[H5FD_SPLITTER_PATH_MAX + 1];
+ char wo[H5FD_SPLITTER_PATH_MAX + 1];
+ char log[H5FD_SPLITTER_PATH_MAX + 1];
};
static FILE *g_log_stream = NULL; /* initialized at runtime */
-static herr_t _verify_datasets(unsigned min_dset, unsigned max_dset,
- hid_t *filespace_id, hid_t *dataset_id, hid_t memspace_id);
+static herr_t _verify_datasets(unsigned min_dset, unsigned max_dset, hid_t *filespace_id, hid_t *dataset_id,
+ hid_t memspace_id);
-static herr_t _create_chunking_ids(hid_t file_id, unsigned min_dset,
- unsigned max_dset, hsize_t *chunk_dims, hsize_t *dset_dims,
- hid_t *dataspace_ids, hid_t *filespace_ids, hid_t *dataset_ids,
- hid_t *memspace_id);
+static herr_t _create_chunking_ids(hid_t file_id, unsigned min_dset, unsigned max_dset, hsize_t *chunk_dims,
+ hsize_t *dset_dims, hid_t *dataspace_ids, hid_t *filespace_ids,
+ hid_t *dataset_ids, hid_t *memspace_id);
-static herr_t _close_chunking_ids(unsigned min_dset, unsigned max_dset,
- hid_t *dataspace_ids, hid_t *filespace_ids, hid_t *dataset_ids,
- hid_t *memspace_id);
+static herr_t _close_chunking_ids(unsigned min_dset, unsigned max_dset, hid_t *dataspace_ids,
+ hid_t *filespace_ids, hid_t *dataset_ids, hid_t *memspace_id);
-static herr_t _populate_filepath(const char *dirname, const char *_basename,
- hid_t fapl_id, char *path_out, hbool_t h5suffix);
+static herr_t _populate_filepath(const char *dirname, const char *_basename, hid_t fapl_id, char *path_out,
+ hbool_t h5suffix);
-static hid_t create_mirroring_split_fapl(const char *_basename,
- struct mirrortest_filenames *names);
+static hid_t create_mirroring_split_fapl(const char *_basename, struct mirrortest_filenames *names);
static void mybzero(void *dest, size_t size);
-
/* ----------------------------------------------------------------------------
* Function: mybzero
*
@@ -120,15 +116,14 @@ static void
mybzero(void *dest, size_t size)
{
size_t i = 0;
- char *s = NULL;
+ char * s = NULL;
HDassert(dest != NULL);
s = (char *)dest;
for (i = 0; i < size; i++) {
- *(s+i) = 0;
+ *(s + i) = 0;
}
} /* end mybzero() */
-
/* ----------------------------------------------------------------------------
* Function: _populate_filepath
*
@@ -144,41 +139,29 @@ mybzero(void *dest, size_t size)
* ----------------------------------------------------------------------------
*/
static herr_t
-_populate_filepath(const char *dirname, const char *_basename, hid_t fapl_id,
- char *path_out, hbool_t h5suffix)
+_populate_filepath(const char *dirname, const char *_basename, hid_t fapl_id, char *path_out,
+ hbool_t h5suffix)
{
char _path[H5FD_SPLITTER_PATH_MAX];
- if ((_basename == NULL) ||
- (*_basename == 0) ||
- (dirname == NULL) ||
- (*dirname == 0) ||
- (path_out == NULL))
- {
+ if ((_basename == NULL) || (*_basename == 0) || (dirname == NULL) || (*dirname == 0) ||
+ (path_out == NULL)) {
TEST_ERROR;
}
if (HDsnprintf(_path, H5FD_SPLITTER_PATH_MAX, "%s%s%s", dirname,
- (dirname[strlen(dirname)] == '/') ? "" : "/", /* slash iff needed */
- _basename)
- > H5FD_SPLITTER_PATH_MAX)
- {
+ (dirname[strlen(dirname)] == '/') ? "" : "/", /* slash iff needed */
+ _basename) > H5FD_SPLITTER_PATH_MAX) {
TEST_ERROR;
}
if (h5suffix == TRUE) {
- if (h5_fixname(_path, fapl_id, path_out,
- H5FD_SPLITTER_PATH_MAX)
- == NULL)
- {
+ if (h5_fixname(_path, fapl_id, path_out, H5FD_SPLITTER_PATH_MAX) == NULL) {
TEST_ERROR;
}
}
else {
- if (h5_fixname_no_suffix(_path, fapl_id, path_out,
- H5FD_SPLITTER_PATH_MAX)
- == NULL)
- {
+ if (h5_fixname_no_suffix(_path, fapl_id, path_out, H5FD_SPLITTER_PATH_MAX) == NULL) {
TEST_ERROR;
}
}
@@ -189,7 +172,6 @@ error:
return FAIL;
} /* end _populate_filepath() */
-
/* ---------------------------------------------------------------------------
* Function: build_paths
*
@@ -203,40 +185,27 @@ error:
* ---------------------------------------------------------------------------
*/
static herr_t
-build_paths(
- const char *_basename,
- H5FD_splitter_vfd_config_t *splitter_config,
- struct mirrortest_filenames *names)
+build_paths(const char *_basename, H5FD_splitter_vfd_config_t *splitter_config,
+ struct mirrortest_filenames *names)
{
char baselogname[H5FD_SPLITTER_PATH_MAX];
- if (_populate_filepath(MIRROR_RW_DIR, _basename,
- splitter_config->rw_fapl_id, names->rw, TRUE)
- == FAIL)
- {
+ if (_populate_filepath(MIRROR_RW_DIR, _basename, splitter_config->rw_fapl_id, names->rw, TRUE) == FAIL) {
TEST_ERROR;
}
- if (_populate_filepath(MIRROR_WO_DIR, _basename,
- splitter_config->wo_fapl_id, names->wo, TRUE)
- == FAIL)
- {
+ if (_populate_filepath(MIRROR_WO_DIR, _basename, splitter_config->wo_fapl_id, names->wo, TRUE) == FAIL) {
TEST_ERROR;
}
if (_basename == NULL || *_basename == 0)
return FAIL;
- if (HDsnprintf(baselogname, H5FD_SPLITTER_PATH_MAX, "%s_err.log",
- _basename)
- > H5FD_SPLITTER_PATH_MAX)
- {
+ if (HDsnprintf(baselogname, H5FD_SPLITTER_PATH_MAX, "%s_err.log", _basename) > H5FD_SPLITTER_PATH_MAX) {
TEST_ERROR;
}
- if (_populate_filepath(MIRROR_WO_DIR, baselogname,
- splitter_config->wo_fapl_id, names->log, FALSE)
- == FAIL)
- {
+ if (_populate_filepath(MIRROR_WO_DIR, baselogname, splitter_config->wo_fapl_id, names->log, FALSE) ==
+ FAIL) {
TEST_ERROR;
}
@@ -246,7 +215,6 @@ error:
return FAIL;
} /* end build_paths() */
-
/* ---------------------------------------------------------------------------
* Function: test_fapl_configuration
*
@@ -262,7 +230,7 @@ error:
static int
test_fapl_configuration(void)
{
- hid_t fapl_id;
+ hid_t fapl_id;
H5FD_mirror_fapl_t mirror_conf = {
H5FD_MIRROR_FAPL_MAGIC, /* magic */
H5FD_MIRROR_CURR_FAPL_T_VERSION, /* version */
@@ -294,9 +262,7 @@ test_fapl_configuration(void)
if (SERVER_HANDSHAKE_PORT != fa_out.handshake_port) {
TEST_ERROR;
}
- if (HDstrncmp(SERVER_IP_ADDRESS, (const char *)fa_out.remote_ip,
- H5FD_MIRROR_MAX_IP_LEN))
- {
+ if (HDstrncmp(SERVER_IP_ADDRESS, (const char *)fa_out.remote_ip, H5FD_MIRROR_MAX_IP_LEN)) {
TEST_ERROR;
}
@@ -314,29 +280,27 @@ error:
return -1;
} /* end test_fapl_configuration() */
+#define PRINT_BUFFER_DIFF(act, exp, len) \
+ do { \
+ size_t _x = 0; \
+ while ((act)[_x] == (exp)[_x]) { \
+ _x++; \
+ } \
+ if (_x != (len)) { \
+ size_t _y = 0; \
+ HDprintf("First bytes differ at %zu\n", _x); \
+ HDprintf("exp "); \
+ for (_y = _x; _y < (len); _y++) { \
+ HDprintf("%02X", (unsigned char)(exp)[_y]); \
+ } \
+ HDprintf("\nact "); \
+ for (_y = _x; _y < (len); _y++) { \
+ HDprintf("%02X", (unsigned char)(act)[_y]); \
+ } \
+ HDprintf("\n"); \
+ } \
+ } while (0); /* end PRINT_BUFFER_DIFF */
-
-#define PRINT_BUFFER_DIFF(act, exp, len) do { \
- size_t _x = 0; \
- while ((act)[_x] == (exp)[_x]) { \
- _x++; \
- } \
- if (_x != (len)) { \
- size_t _y = 0; \
- HDprintf("First bytes differ at %zu\n", _x); \
- HDprintf("exp "); \
- for (_y = _x; _y < (len); _y++) { \
- HDprintf("%02X", (unsigned char)(exp)[_y]); \
- } \
- HDprintf("\nact "); \
- for (_y = _x; _y < (len); _y++) { \
- HDprintf("%02X", (unsigned char)(act)[_y]); \
- } \
- HDprintf("\n"); \
- } \
-} while (0); /* end PRINT_BUFFER_DIFF */
-
-
/* ---------------------------------------------------------------------------
* Function: test_xmit_encode_decode
*
@@ -360,18 +324,18 @@ test_xmit_encode_decode(void)
* Use sequential values to easily generate the expected buffer with a
* for loop.
*/
- xmit_mock.magic = 0x00010203;
- xmit_mock.version = 0x04;
+ xmit_mock.magic = 0x00010203;
+ xmit_mock.version = 0x04;
xmit_mock.session_token = 0x05060708;
- xmit_mock.xmit_count = 0x090A0B0C;
- xmit_mock.op = 0x0D;
+ xmit_mock.xmit_count = 0x090A0B0C;
+ xmit_mock.op = 0x0D;
/* Test uint8_t encode/decode
*/
do {
unsigned char buf[8];
unsigned char expected[8];
- const uint8_t v = 200;
+ const uint8_t v = 200;
unsigned char out = 0;
/* Start of buffer uint8_t
@@ -379,7 +343,7 @@ test_xmit_encode_decode(void)
mybzero(buf, 8);
mybzero(expected, 8);
expected[0] = 200;
- out = 0;
+ out = 0;
if (H5FD__mirror_xmit_encode_uint8(buf, v) != 1) {
TEST_ERROR;
}
@@ -399,15 +363,15 @@ test_xmit_encode_decode(void)
mybzero(buf, 8);
mybzero(expected, 8);
expected[3] = v;
- out = 0;
- if (H5FD__mirror_xmit_encode_uint8((buf+3), v) != 1) {
+ out = 0;
+ if (H5FD__mirror_xmit_encode_uint8((buf + 3), v) != 1) {
TEST_ERROR;
}
if (HDmemcmp(buf, expected, 8) != 0) {
PRINT_BUFFER_DIFF(buf, expected, 8);
TEST_ERROR;
}
- if (H5FD__mirror_xmit_decode_uint8(&out, (buf+3)) != 1) {
+ if (H5FD__mirror_xmit_decode_uint8(&out, (buf + 3)) != 1) {
TEST_ERROR;
}
if (v != out) {
@@ -419,15 +383,15 @@ test_xmit_encode_decode(void)
mybzero(buf, 8);
mybzero(expected, 8);
expected[7] = v;
- out = 0;
- if (H5FD__mirror_xmit_encode_uint8((buf+7), v) != 1) {
+ out = 0;
+ if (H5FD__mirror_xmit_encode_uint8((buf + 7), v) != 1) {
TEST_ERROR;
}
if (HDmemcmp(buf, expected, 8) != 0) {
PRINT_BUFFER_DIFF(buf, expected, 8);
TEST_ERROR;
}
- if (H5FD__mirror_xmit_decode_uint8(&out, (buf+7)) != 1) {
+ if (H5FD__mirror_xmit_decode_uint8(&out, (buf + 7)) != 1) {
TEST_ERROR;
}
if (v != out) {
@@ -441,8 +405,8 @@ test_xmit_encode_decode(void)
do {
unsigned char buf[8];
unsigned char expected[8];
- const uint16_t v = 0x8F02;
- uint16_t out = 0;
+ const uint16_t v = 0x8F02;
+ uint16_t out = 0;
/* Start of buffer uint16_t
*/
@@ -450,7 +414,7 @@ test_xmit_encode_decode(void)
mybzero(expected, 8);
expected[0] = 0x8F;
expected[1] = 0x02;
- out = 0;
+ out = 0;
if (H5FD__mirror_xmit_encode_uint16(buf, v) != 2) {
TEST_ERROR;
}
@@ -471,22 +435,22 @@ test_xmit_encode_decode(void)
mybzero(expected, 8);
expected[3] = 0x8F;
expected[4] = 0x02;
- out = 0;
- if (H5FD__mirror_xmit_encode_uint16((buf+3), v) != 2) {
+ out = 0;
+ if (H5FD__mirror_xmit_encode_uint16((buf + 3), v) != 2) {
TEST_ERROR;
}
if (HDmemcmp(buf, expected, 8) != 0) {
PRINT_BUFFER_DIFF(buf, expected, 8);
TEST_ERROR;
}
- if (H5FD__mirror_xmit_decode_uint16(&out, (buf+3)) != 2) {
+ if (H5FD__mirror_xmit_decode_uint16(&out, (buf + 3)) != 2) {
TEST_ERROR;
}
if (out != v) {
TEST_ERROR;
}
/* slice */
- if (H5FD__mirror_xmit_decode_uint16(&out, (buf+4)) != 2) {
+ if (H5FD__mirror_xmit_decode_uint16(&out, (buf + 4)) != 2) {
TEST_ERROR;
}
if (out != 0x0200) {
@@ -499,15 +463,15 @@ test_xmit_encode_decode(void)
mybzero(expected, 8);
expected[6] = 0x8F;
expected[7] = 0x02;
- out = 0;
- if (H5FD__mirror_xmit_encode_uint16((buf+6), v) != 2) {
+ out = 0;
+ if (H5FD__mirror_xmit_encode_uint16((buf + 6), v) != 2) {
TEST_ERROR;
}
if (HDmemcmp(buf, expected, 8) != 0) {
PRINT_BUFFER_DIFF(buf, expected, 8);
TEST_ERROR;
}
- if (H5FD__mirror_xmit_decode_uint16(&out, (buf+6)) != 2) {
+ if (H5FD__mirror_xmit_decode_uint16(&out, (buf + 6)) != 2) {
TEST_ERROR;
}
if (out != v) {
@@ -521,8 +485,8 @@ test_xmit_encode_decode(void)
do {
unsigned char buf[8];
unsigned char expected[8];
- const uint32_t v = 0x8F020048;
- uint32_t out = 0;
+ const uint32_t v = 0x8F020048;
+ uint32_t out = 0;
/* Start of buffer uint32_t
*/
@@ -532,7 +496,7 @@ test_xmit_encode_decode(void)
expected[1] = 0x02;
expected[2] = 0x00;
expected[3] = 0x48;
- out = 0;
+ out = 0;
if (H5FD__mirror_xmit_encode_uint32(buf, v) != 4) {
TEST_ERROR;
}
@@ -555,22 +519,22 @@ test_xmit_encode_decode(void)
expected[4] = 0x02;
expected[5] = 0x00;
expected[6] = 0x48;
- out = 0;
- if (H5FD__mirror_xmit_encode_uint32((buf+3), v) != 4) {
+ out = 0;
+ if (H5FD__mirror_xmit_encode_uint32((buf + 3), v) != 4) {
TEST_ERROR;
}
if (HDmemcmp(buf, expected, 8) != 0) {
PRINT_BUFFER_DIFF(buf, expected, 8);
TEST_ERROR;
}
- if (H5FD__mirror_xmit_decode_uint32(&out, (buf+3)) != 4) {
+ if (H5FD__mirror_xmit_decode_uint32(&out, (buf + 3)) != 4) {
TEST_ERROR;
}
if (out != v) {
TEST_ERROR;
}
/* slice */
- if (H5FD__mirror_xmit_decode_uint32(&out, (buf+4)) != 4) {
+ if (H5FD__mirror_xmit_decode_uint32(&out, (buf + 4)) != 4) {
TEST_ERROR;
}
if (out != 0x02004800) {
@@ -585,15 +549,15 @@ test_xmit_encode_decode(void)
expected[5] = 0x02;
expected[6] = 0x00;
expected[7] = 0x48;
- out = 0;
- if (H5FD__mirror_xmit_encode_uint32((buf+4), v) != 4) {
+ out = 0;
+ if (H5FD__mirror_xmit_encode_uint32((buf + 4), v) != 4) {
TEST_ERROR;
}
if (HDmemcmp(buf, expected, 8) != 0) {
PRINT_BUFFER_DIFF(buf, expected, 8);
TEST_ERROR;
}
- if (H5FD__mirror_xmit_decode_uint32(&out, (buf+4)) != 4) {
+ if (H5FD__mirror_xmit_decode_uint32(&out, (buf + 4)) != 4) {
TEST_ERROR;
}
if (out != v) {
@@ -607,8 +571,8 @@ test_xmit_encode_decode(void)
do {
unsigned char buf[16];
unsigned char expected[16];
- const uint64_t v = 0x90DCBE17939CE4BB;
- uint64_t out = 0;
+ const uint64_t v = 0x90DCBE17939CE4BB;
+ uint64_t out = 0;
/* Start of buffer uint64_t
*/
@@ -622,7 +586,7 @@ test_xmit_encode_decode(void)
expected[5] = 0x9C;
expected[6] = 0xE4;
expected[7] = 0xBB;
- out = 0;
+ out = 0;
if (H5FD__mirror_xmit_encode_uint64(buf, v) != 8) {
TEST_ERROR;
}
@@ -649,22 +613,22 @@ test_xmit_encode_decode(void)
expected[8] = 0x9C;
expected[9] = 0xE4;
expected[10] = 0xBB;
- out = 0;
- if (H5FD__mirror_xmit_encode_uint64((buf+3), v) != 8) {
+ out = 0;
+ if (H5FD__mirror_xmit_encode_uint64((buf + 3), v) != 8) {
TEST_ERROR;
}
if (HDmemcmp(buf, expected, 16) != 0) {
PRINT_BUFFER_DIFF(buf, expected, 16);
TEST_ERROR;
}
- if (H5FD__mirror_xmit_decode_uint64(&out, (buf+3)) != 8) {
+ if (H5FD__mirror_xmit_decode_uint64(&out, (buf + 3)) != 8) {
TEST_ERROR;
}
if (out != v) {
TEST_ERROR;
}
/* slice */
- if (H5FD__mirror_xmit_decode_uint64(&out, (buf+6)) != 8) {
+ if (H5FD__mirror_xmit_decode_uint64(&out, (buf + 6)) != 8) {
TEST_ERROR;
}
if (out != 0x17939CE4BB000000) {
@@ -683,15 +647,15 @@ test_xmit_encode_decode(void)
expected[13] = 0x9C;
expected[14] = 0xE4;
expected[15] = 0xBB;
- out = 0;
- if (H5FD__mirror_xmit_encode_uint64((buf+8), v) != 8) {
+ out = 0;
+ if (H5FD__mirror_xmit_encode_uint64((buf + 8), v) != 8) {
TEST_ERROR;
}
if (HDmemcmp(buf, expected, 16) != 0) {
PRINT_BUFFER_DIFF(buf, expected, 16);
TEST_ERROR;
}
- if (H5FD__mirror_xmit_decode_uint64(&out, (buf+8)) != 8) {
+ if (H5FD__mirror_xmit_decode_uint64(&out, (buf + 8)) != 8) {
TEST_ERROR;
}
if (out != v) {
@@ -706,10 +670,10 @@ test_xmit_encode_decode(void)
* Then repeat from a different offset in the buffer and compare.
*/
do {
- unsigned char buf[H5FD_MIRROR_XMIT_HEADER_SIZE+8];
- unsigned char expected[H5FD_MIRROR_XMIT_HEADER_SIZE+8];
+ unsigned char buf[H5FD_MIRROR_XMIT_HEADER_SIZE + 8];
+ unsigned char expected[H5FD_MIRROR_XMIT_HEADER_SIZE + 8];
H5FD_mirror_xmit_t xmit_out;
- size_t i = 0;
+ size_t i = 0;
/* sanity check */
if (14 != H5FD_MIRROR_XMIT_HEADER_SIZE) {
@@ -718,51 +682,55 @@ test_xmit_encode_decode(void)
/* Populate the expected buffer; expect end padding of 0xFF
*/
- HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_HEADER_SIZE+8);
- for (i=0; i < H5FD_MIRROR_XMIT_HEADER_SIZE; i++) {
- expected[i+2] = (unsigned char)i;
+ HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_HEADER_SIZE + 8);
+ for (i = 0; i < H5FD_MIRROR_XMIT_HEADER_SIZE; i++) {
+ expected[i + 2] = (unsigned char)i;
}
/* Encode, and compare buffer contents
* Initial buffer is filled with 0xFF to match expected padding
*/
- HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_HEADER_SIZE+8);
- if (H5FD_mirror_xmit_encode_header((buf+2), &xmit_mock)
- != H5FD_MIRROR_XMIT_HEADER_SIZE)
- {
+ HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_HEADER_SIZE + 8);
+ if (H5FD_mirror_xmit_encode_header((buf + 2), &xmit_mock) != H5FD_MIRROR_XMIT_HEADER_SIZE) {
TEST_ERROR;
}
- if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_HEADER_SIZE+8) != 0) {
- PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_HEADER_SIZE+8);
+ if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_HEADER_SIZE + 8) != 0) {
+ PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_HEADER_SIZE + 8);
TEST_ERROR;
}
/* Decode from buffer
*/
- if (H5FD_mirror_xmit_decode_header(&xmit_out, (buf+2))
- != H5FD_MIRROR_XMIT_HEADER_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_header(&xmit_out, (buf + 2)) != H5FD_MIRROR_XMIT_HEADER_SIZE) {
TEST_ERROR;
}
- if (xmit_out.magic != xmit_mock.magic) TEST_ERROR;
- if (xmit_out.version != xmit_mock.version) TEST_ERROR;
- if (xmit_out.session_token != xmit_mock.session_token) TEST_ERROR;
- if (xmit_out.xmit_count != xmit_mock.xmit_count) TEST_ERROR;
- if (xmit_out.op != xmit_mock.op) TEST_ERROR;
+ if (xmit_out.magic != xmit_mock.magic)
+ TEST_ERROR;
+ if (xmit_out.version != xmit_mock.version)
+ TEST_ERROR;
+ if (xmit_out.session_token != xmit_mock.session_token)
+ TEST_ERROR;
+ if (xmit_out.xmit_count != xmit_mock.xmit_count)
+ TEST_ERROR;
+ if (xmit_out.op != xmit_mock.op)
+ TEST_ERROR;
/* Decode from different offset in buffer
* Observe changes when ingesting the padding
*/
- if (H5FD_mirror_xmit_decode_header(&xmit_out, (buf))
- != H5FD_MIRROR_XMIT_HEADER_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_header(&xmit_out, (buf)) != H5FD_MIRROR_XMIT_HEADER_SIZE) {
TEST_ERROR;
}
- if (xmit_out.magic != 0xFFFF0001) TEST_ERROR;
- if (xmit_out.version != 0x02) TEST_ERROR;
- if (xmit_out.session_token != 0x03040506) TEST_ERROR;
- if (xmit_out.xmit_count != 0x0708090A) TEST_ERROR;
- if (xmit_out.op != 0x0B) TEST_ERROR;
+ if (xmit_out.magic != 0xFFFF0001)
+ TEST_ERROR;
+ if (xmit_out.version != 0x02)
+ TEST_ERROR;
+ if (xmit_out.session_token != 0x03040506)
+ TEST_ERROR;
+ if (xmit_out.xmit_count != 0x0708090A)
+ TEST_ERROR;
+ if (xmit_out.op != 0x0B)
+ TEST_ERROR;
} while (0); /* end xmit header en/decode */
@@ -772,14 +740,14 @@ test_xmit_encode_decode(void)
* Then repeat from a different offset in the buffer and compare.
*/
do {
- unsigned char buf[H5FD_MIRROR_XMIT_EOA_SIZE+8];
- unsigned char expected[H5FD_MIRROR_XMIT_EOA_SIZE+8];
+ unsigned char buf[H5FD_MIRROR_XMIT_EOA_SIZE + 8];
+ unsigned char expected[H5FD_MIRROR_XMIT_EOA_SIZE + 8];
H5FD_mirror_xmit_eoa_t xmit_in;
H5FD_mirror_xmit_eoa_t xmit_out;
- size_t i = 0;
+ size_t i = 0;
/* sanity check */
- if ((14+9) != H5FD_MIRROR_XMIT_EOA_SIZE) {
+ if ((14 + 9) != H5FD_MIRROR_XMIT_EOA_SIZE) {
FAIL_PUTS_ERROR("Header size definition does not match test\n");
}
if (xmit_mock.op != 0x0D) {
@@ -788,61 +756,69 @@ test_xmit_encode_decode(void)
/* Populate the expected buffer; expect end padding of 0xFF
*/
- HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_EOA_SIZE+8);
- for (i=0; i < H5FD_MIRROR_XMIT_EOA_SIZE; i++) {
- expected[i+2] = (unsigned char)i;
+ HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_EOA_SIZE + 8);
+ for (i = 0; i < H5FD_MIRROR_XMIT_EOA_SIZE; i++) {
+ expected[i + 2] = (unsigned char)i;
}
/* Set xmit_in
*/
- xmit_in.pub = xmit_mock; /* shared/common */
- xmit_in.type = 0x0E;
+ xmit_in.pub = xmit_mock; /* shared/common */
+ xmit_in.type = 0x0E;
xmit_in.eoa_addr = 0x0F10111213141516;
/* Encode, and compare buffer contents
* Initial buffer is filled with 0xFF to match expected padding
*/
- HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_EOA_SIZE+8);
- if (H5FD_mirror_xmit_encode_set_eoa((buf+2), &xmit_in)
- != H5FD_MIRROR_XMIT_EOA_SIZE)
- {
+ HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_EOA_SIZE + 8);
+ if (H5FD_mirror_xmit_encode_set_eoa((buf + 2), &xmit_in) != H5FD_MIRROR_XMIT_EOA_SIZE) {
TEST_ERROR;
}
- if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_EOA_SIZE+8) != 0) {
- PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_EOA_SIZE+8);
+ if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_EOA_SIZE + 8) != 0) {
+ PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_EOA_SIZE + 8);
TEST_ERROR;
}
/* Decode from buffer
*/
- if (H5FD_mirror_xmit_decode_set_eoa(&xmit_out, (buf+2))
- != H5FD_MIRROR_XMIT_EOA_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_set_eoa(&xmit_out, (buf + 2)) != H5FD_MIRROR_XMIT_EOA_SIZE) {
TEST_ERROR;
}
- if (xmit_out.pub.magic != xmit_mock.magic) TEST_ERROR;
- if (xmit_out.pub.version != xmit_mock.version) TEST_ERROR;
- if (xmit_out.pub.session_token != xmit_mock.session_token) TEST_ERROR;
- if (xmit_out.pub.xmit_count != xmit_mock.xmit_count) TEST_ERROR;
- if (xmit_out.pub.op != xmit_mock.op) TEST_ERROR;
- if (xmit_out.type != 0x0E) TEST_ERROR;
- if (xmit_out.eoa_addr != 0x0F10111213141516) TEST_ERROR;
+ if (xmit_out.pub.magic != xmit_mock.magic)
+ TEST_ERROR;
+ if (xmit_out.pub.version != xmit_mock.version)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != xmit_mock.session_token)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != xmit_mock.xmit_count)
+ TEST_ERROR;
+ if (xmit_out.pub.op != xmit_mock.op)
+ TEST_ERROR;
+ if (xmit_out.type != 0x0E)
+ TEST_ERROR;
+ if (xmit_out.eoa_addr != 0x0F10111213141516)
+ TEST_ERROR;
/* Decode from different offset in buffer
* Observe changes when ingesting the padding
*/
- if (H5FD_mirror_xmit_decode_set_eoa(&xmit_out, (buf))
- != H5FD_MIRROR_XMIT_EOA_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_set_eoa(&xmit_out, (buf)) != H5FD_MIRROR_XMIT_EOA_SIZE) {
TEST_ERROR;
}
- if (xmit_out.pub.magic != 0xFFFF0001) TEST_ERROR;
- if (xmit_out.pub.version != 0x02) TEST_ERROR;
- if (xmit_out.pub.session_token != 0x03040506) TEST_ERROR;
- if (xmit_out.pub.xmit_count != 0x0708090A) TEST_ERROR;
- if (xmit_out.pub.op != 0x0B) TEST_ERROR;
- if (xmit_out.type != 0x0C) TEST_ERROR;
- if (xmit_out.eoa_addr != 0x0D0E0F1011121314) TEST_ERROR;
+ if (xmit_out.pub.magic != 0xFFFF0001)
+ TEST_ERROR;
+ if (xmit_out.pub.version != 0x02)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != 0x03040506)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != 0x0708090A)
+ TEST_ERROR;
+ if (xmit_out.pub.op != 0x0B)
+ TEST_ERROR;
+ if (xmit_out.type != 0x0C)
+ TEST_ERROR;
+ if (xmit_out.eoa_addr != 0x0D0E0F1011121314)
+ TEST_ERROR;
} while (0); /* end xmit set-eoa en/decode */
@@ -852,14 +828,14 @@ test_xmit_encode_decode(void)
* Then repeat from a different offset in the buffer and compare.
*/
do {
- unsigned char buf[H5FD_MIRROR_XMIT_LOCK_SIZE+8];
- unsigned char expected[H5FD_MIRROR_XMIT_LOCK_SIZE+8];
+ unsigned char buf[H5FD_MIRROR_XMIT_LOCK_SIZE + 8];
+ unsigned char expected[H5FD_MIRROR_XMIT_LOCK_SIZE + 8];
H5FD_mirror_xmit_lock_t xmit_in;
H5FD_mirror_xmit_lock_t xmit_out;
- size_t i = 0;
+ size_t i = 0;
/* sanity check */
- if ((14+8) != H5FD_MIRROR_XMIT_LOCK_SIZE) {
+ if ((14 + 8) != H5FD_MIRROR_XMIT_LOCK_SIZE) {
FAIL_PUTS_ERROR("Header size definition does not match test\n");
}
if (xmit_mock.op != 0x0D) {
@@ -868,58 +844,64 @@ test_xmit_encode_decode(void)
/* Populate the expected buffer; expect end padding of 0xFF
*/
- HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_LOCK_SIZE+8);
- for (i=0; i < H5FD_MIRROR_XMIT_LOCK_SIZE; i++) {
- expected[i+2] = (unsigned char)i;
+ HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_LOCK_SIZE + 8);
+ for (i = 0; i < H5FD_MIRROR_XMIT_LOCK_SIZE; i++) {
+ expected[i + 2] = (unsigned char)i;
}
/* Set xmit_in
*/
xmit_in.pub = xmit_mock; /* shared/common */
- xmit_in.rw = 0x0E0F101112131415;
+ xmit_in.rw = 0x0E0F101112131415;
/* Encode, and compare buffer contents
* Initial buffer is filled with 0xFF to match expected padding
*/
- HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_LOCK_SIZE+8);
- if (H5FD_mirror_xmit_encode_lock((buf+2), &xmit_in)
- != H5FD_MIRROR_XMIT_LOCK_SIZE)
- {
+ HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_LOCK_SIZE + 8);
+ if (H5FD_mirror_xmit_encode_lock((buf + 2), &xmit_in) != H5FD_MIRROR_XMIT_LOCK_SIZE) {
TEST_ERROR;
}
- if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_LOCK_SIZE+8) != 0) {
- PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_LOCK_SIZE+8);
+ if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_LOCK_SIZE + 8) != 0) {
+ PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_LOCK_SIZE + 8);
TEST_ERROR;
}
/* Decode from buffer
*/
- if (H5FD_mirror_xmit_decode_lock(&xmit_out, (buf+2))
- != H5FD_MIRROR_XMIT_LOCK_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_lock(&xmit_out, (buf + 2)) != H5FD_MIRROR_XMIT_LOCK_SIZE) {
TEST_ERROR;
}
- if (xmit_out.pub.magic != xmit_mock.magic) TEST_ERROR;
- if (xmit_out.pub.version != xmit_mock.version) TEST_ERROR;
- if (xmit_out.pub.session_token != xmit_mock.session_token) TEST_ERROR;
- if (xmit_out.pub.xmit_count != xmit_mock.xmit_count) TEST_ERROR;
- if (xmit_out.pub.op != xmit_mock.op) TEST_ERROR;
- if (xmit_out.rw != 0x0E0F101112131415) TEST_ERROR;
+ if (xmit_out.pub.magic != xmit_mock.magic)
+ TEST_ERROR;
+ if (xmit_out.pub.version != xmit_mock.version)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != xmit_mock.session_token)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != xmit_mock.xmit_count)
+ TEST_ERROR;
+ if (xmit_out.pub.op != xmit_mock.op)
+ TEST_ERROR;
+ if (xmit_out.rw != 0x0E0F101112131415)
+ TEST_ERROR;
/* Decode from different offset in buffer
* Observe changes when ingesting the padding
*/
- if (H5FD_mirror_xmit_decode_lock(&xmit_out, (buf))
- != H5FD_MIRROR_XMIT_LOCK_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_lock(&xmit_out, (buf)) != H5FD_MIRROR_XMIT_LOCK_SIZE) {
TEST_ERROR;
}
- if (xmit_out.pub.magic != 0xFFFF0001) TEST_ERROR;
- if (xmit_out.pub.version != 0x02) TEST_ERROR;
- if (xmit_out.pub.session_token != 0x03040506) TEST_ERROR;
- if (xmit_out.pub.xmit_count != 0x0708090A) TEST_ERROR;
- if (xmit_out.pub.op != 0x0B) TEST_ERROR;
- if (xmit_out.rw != 0x0C0D0E0F10111213) TEST_ERROR;
+ if (xmit_out.pub.magic != 0xFFFF0001)
+ TEST_ERROR;
+ if (xmit_out.pub.version != 0x02)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != 0x03040506)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != 0x0708090A)
+ TEST_ERROR;
+ if (xmit_out.pub.op != 0x0B)
+ TEST_ERROR;
+ if (xmit_out.rw != 0x0C0D0E0F10111213)
+ TEST_ERROR;
} while (0); /* end xmit lock en/decode */
@@ -932,14 +914,14 @@ test_xmit_encode_decode(void)
* string, with all following bytes in the encoded buffer being zeroed.
*/
do {
- unsigned char buf[H5FD_MIRROR_XMIT_OPEN_SIZE+8];
- unsigned char expected[H5FD_MIRROR_XMIT_OPEN_SIZE+8];
+ unsigned char buf[H5FD_MIRROR_XMIT_OPEN_SIZE + 8];
+ unsigned char expected[H5FD_MIRROR_XMIT_OPEN_SIZE + 8];
H5FD_mirror_xmit_open_t xmit_in;
H5FD_mirror_xmit_open_t xmit_out;
- size_t i = 0;
+ size_t i = 0;
/* sanity check */
- if ((14+20+4097) != H5FD_MIRROR_XMIT_OPEN_SIZE) {
+ if ((14 + 20 + 4097) != H5FD_MIRROR_XMIT_OPEN_SIZE) {
FAIL_PUTS_ERROR("Header size definition does not match test\n");
}
if (xmit_mock.op != 0x0D) {
@@ -948,90 +930,92 @@ test_xmit_encode_decode(void)
/* Populate the expected buffer; expect end padding of 0xFF
*/
- HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_OPEN_SIZE+8);
- for (i=0; i < H5FD_MIRROR_XMIT_OPEN_SIZE; i++) {
+ HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_OPEN_SIZE + 8);
+ for (i = 0; i < H5FD_MIRROR_XMIT_OPEN_SIZE; i++) {
/* 0x100 is "zero" in a byte, so encode will treat it as a NULL-
* terminator in the filepath string. Expect all zeroes following.
*/
- expected[i+2] = (i > 0xFF) ? 0 : (unsigned char)i;
+ expected[i + 2] = (i > 0xFF) ? 0 : (unsigned char)i;
}
/* Set xmit_in
*/
- xmit_in.pub = xmit_mock; /* shared/common */
- xmit_in.flags = 0x0E0F1011;
- xmit_in.maxaddr = 0x1213141516171819;
+ xmit_in.pub = xmit_mock; /* shared/common */
+ xmit_in.flags = 0x0E0F1011;
+ xmit_in.maxaddr = 0x1213141516171819;
xmit_in.size_t_blob = 0x1A1B1C1D1E1F2021;
- for (i=0x22; i < H5FD_MIRROR_XMIT_FILEPATH_MAX+0x22; i++) {
+ for (i = 0x22; i < H5FD_MIRROR_XMIT_FILEPATH_MAX + 0x22; i++) {
/* nonzero values repeat after 0x100, but will not be encoded */
- xmit_in.filename[i-0x22] = (char)(i % 0x100);
+ xmit_in.filename[i - 0x22] = (char)(i % 0x100);
}
- xmit_in.filename[H5FD_MIRROR_XMIT_FILEPATH_MAX-1] = 0;
+ xmit_in.filename[H5FD_MIRROR_XMIT_FILEPATH_MAX - 1] = 0;
/* Encode, and compare buffer contents
* Initial buffer is filled with 0xFF to match expected padding
*/
- HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_OPEN_SIZE+8);
- if (H5FD_mirror_xmit_encode_open((buf+2), &xmit_in)
- != H5FD_MIRROR_XMIT_OPEN_SIZE)
- {
+ HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_OPEN_SIZE + 8);
+ if (H5FD_mirror_xmit_encode_open((buf + 2), &xmit_in) != H5FD_MIRROR_XMIT_OPEN_SIZE) {
TEST_ERROR;
}
- if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_OPEN_SIZE+8) != 0) {
- PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_OPEN_SIZE+8);
+ if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_OPEN_SIZE + 8) != 0) {
+ PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_OPEN_SIZE + 8);
TEST_ERROR;
}
/* Decode from buffer
*/
- if (H5FD_mirror_xmit_decode_open(&xmit_out, (buf+2))
- != H5FD_MIRROR_XMIT_OPEN_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_open(&xmit_out, (buf + 2)) != H5FD_MIRROR_XMIT_OPEN_SIZE) {
TEST_ERROR;
}
- if (xmit_out.pub.magic != xmit_mock.magic) TEST_ERROR;
- if (xmit_out.pub.version != xmit_mock.version) TEST_ERROR;
- if (xmit_out.pub.session_token != xmit_mock.session_token) TEST_ERROR;
- if (xmit_out.pub.xmit_count != xmit_mock.xmit_count) TEST_ERROR;
- if (xmit_out.pub.op != xmit_mock.op) TEST_ERROR;
- if (xmit_out.flags != xmit_in.flags) TEST_ERROR;
- if (xmit_out.maxaddr != xmit_in.maxaddr) TEST_ERROR;
- if (xmit_out.size_t_blob != xmit_in.size_t_blob) TEST_ERROR;
- if (HDstrncmp(xmit_out.filename, xmit_in.filename,
- H5FD_MIRROR_XMIT_FILEPATH_MAX)
- != 0)
- {
- PRINT_BUFFER_DIFF(xmit_out.filename, xmit_in.filename,
- H5FD_MIRROR_XMIT_FILEPATH_MAX);
+ if (xmit_out.pub.magic != xmit_mock.magic)
+ TEST_ERROR;
+ if (xmit_out.pub.version != xmit_mock.version)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != xmit_mock.session_token)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != xmit_mock.xmit_count)
+ TEST_ERROR;
+ if (xmit_out.pub.op != xmit_mock.op)
+ TEST_ERROR;
+ if (xmit_out.flags != xmit_in.flags)
+ TEST_ERROR;
+ if (xmit_out.maxaddr != xmit_in.maxaddr)
+ TEST_ERROR;
+ if (xmit_out.size_t_blob != xmit_in.size_t_blob)
+ TEST_ERROR;
+ if (HDstrncmp(xmit_out.filename, xmit_in.filename, H5FD_MIRROR_XMIT_FILEPATH_MAX) != 0) {
+ PRINT_BUFFER_DIFF(xmit_out.filename, xmit_in.filename, H5FD_MIRROR_XMIT_FILEPATH_MAX);
TEST_ERROR;
}
/* Decode from different offset in buffer
* Observe changes when ingesting the padding
*/
- if (H5FD_mirror_xmit_decode_open(&xmit_out, (buf))
- != H5FD_MIRROR_XMIT_OPEN_SIZE)
- {
- TEST_ERROR;
- }
- if (xmit_out.pub.magic != 0xFFFF0001) TEST_ERROR;
- if (xmit_out.pub.version != 0x02) TEST_ERROR;
- if (xmit_out.pub.session_token != 0x03040506) TEST_ERROR;
- if (xmit_out.pub.xmit_count != 0x0708090A) TEST_ERROR;
- if (xmit_out.pub.op != 0x0B) TEST_ERROR;
- if (xmit_out.flags != 0x0C0D0E0F) TEST_ERROR;
- if (xmit_out.maxaddr != 0x1011121314151617) TEST_ERROR;
- if (xmit_out.size_t_blob != 0x18191A1B1C1D1E1F) TEST_ERROR;
+ if (H5FD_mirror_xmit_decode_open(&xmit_out, (buf)) != H5FD_MIRROR_XMIT_OPEN_SIZE) {
+ TEST_ERROR;
+ }
+ if (xmit_out.pub.magic != 0xFFFF0001)
+ TEST_ERROR;
+ if (xmit_out.pub.version != 0x02)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != 0x03040506)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != 0x0708090A)
+ TEST_ERROR;
+ if (xmit_out.pub.op != 0x0B)
+ TEST_ERROR;
+ if (xmit_out.flags != 0x0C0D0E0F)
+ TEST_ERROR;
+ if (xmit_out.maxaddr != 0x1011121314151617)
+ TEST_ERROR;
+ if (xmit_out.size_t_blob != 0x18191A1B1C1D1E1F)
+ TEST_ERROR;
/* update expected "filepath" in structure */
- for (i=0x20; i < H5FD_MIRROR_XMIT_FILEPATH_MAX+0x20; i++) {
- xmit_in.filename[i-0x20] = (i > 0xFF) ? 0 : (char)i;
+ for (i = 0x20; i < H5FD_MIRROR_XMIT_FILEPATH_MAX + 0x20; i++) {
+ xmit_in.filename[i - 0x20] = (i > 0xFF) ? 0 : (char)i;
}
- if (HDstrncmp(xmit_out.filename, xmit_in.filename,
- H5FD_MIRROR_XMIT_FILEPATH_MAX)
- != 0)
- {
- PRINT_BUFFER_DIFF(xmit_out.filename, xmit_in.filename,
- H5FD_MIRROR_XMIT_FILEPATH_MAX);
+ if (HDstrncmp(xmit_out.filename, xmit_in.filename, H5FD_MIRROR_XMIT_FILEPATH_MAX) != 0) {
+ PRINT_BUFFER_DIFF(xmit_out.filename, xmit_in.filename, H5FD_MIRROR_XMIT_FILEPATH_MAX);
TEST_ERROR;
}
@@ -1046,14 +1030,14 @@ test_xmit_encode_decode(void)
* string, with all following bytes in the encoded buffer being zeroed.
*/
do {
- unsigned char buf[H5FD_MIRROR_XMIT_REPLY_SIZE+8];
- unsigned char expected[H5FD_MIRROR_XMIT_REPLY_SIZE+8];
+ unsigned char buf[H5FD_MIRROR_XMIT_REPLY_SIZE + 8];
+ unsigned char expected[H5FD_MIRROR_XMIT_REPLY_SIZE + 8];
H5FD_mirror_xmit_reply_t xmit_in;
H5FD_mirror_xmit_reply_t xmit_out;
- size_t i = 0;
+ size_t i = 0;
/* sanity check */
- if ((14+4+256) != H5FD_MIRROR_XMIT_REPLY_SIZE) {
+ if ((14 + 4 + 256) != H5FD_MIRROR_XMIT_REPLY_SIZE) {
FAIL_PUTS_ERROR("Header size definition does not match test\n");
}
if (xmit_mock.op != 0x0D) {
@@ -1062,84 +1046,82 @@ test_xmit_encode_decode(void)
/* Populate the expected buffer; expect end padding of 0xFF
*/
- HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_REPLY_SIZE+8);
- for (i=0; i < H5FD_MIRROR_XMIT_REPLY_SIZE; i++) {
+ HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_REPLY_SIZE + 8);
+ for (i = 0; i < H5FD_MIRROR_XMIT_REPLY_SIZE; i++) {
/* 0x100 is "zero" in a byte, so encode will treat it as a NULL-
* terminator in the filepath string. Expect all zeroes following.
*/
- expected[i+2] = (i > 0xFF) ? 0 : (unsigned char)i;
+ expected[i + 2] = (i > 0xFF) ? 0 : (unsigned char)i;
}
/* Set xmit_in
*/
- xmit_in.pub = xmit_mock; /* shared/common */
+ xmit_in.pub = xmit_mock; /* shared/common */
xmit_in.status = 0x0E0F1011;
- for (i=0x12; i < H5FD_MIRROR_STATUS_MESSAGE_MAX+0x12; i++) {
+ for (i = 0x12; i < H5FD_MIRROR_STATUS_MESSAGE_MAX + 0x12; i++) {
/* nonzero values repeat after 0x100, but will not be encoded */
- xmit_in.message[i-0x12] = (char)(i % 0x100);
+ xmit_in.message[i - 0x12] = (char)(i % 0x100);
}
- xmit_in.message[H5FD_MIRROR_STATUS_MESSAGE_MAX-1] = 0;
+ xmit_in.message[H5FD_MIRROR_STATUS_MESSAGE_MAX - 1] = 0;
/* Encode, and compare buffer contents
* Initial buffer is filled with 0xFF to match expected padding
*/
- HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_REPLY_SIZE+8);
- if (H5FD_mirror_xmit_encode_reply((buf+2), &xmit_in)
- != H5FD_MIRROR_XMIT_REPLY_SIZE)
- {
+ HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_REPLY_SIZE + 8);
+ if (H5FD_mirror_xmit_encode_reply((buf + 2), &xmit_in) != H5FD_MIRROR_XMIT_REPLY_SIZE) {
TEST_ERROR;
}
- if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_REPLY_SIZE+8) != 0) {
- PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_REPLY_SIZE+8);
+ if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_REPLY_SIZE + 8) != 0) {
+ PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_REPLY_SIZE + 8);
TEST_ERROR;
}
/* Decode from buffer
*/
- if (H5FD_mirror_xmit_decode_reply(&xmit_out, (buf+2))
- != H5FD_MIRROR_XMIT_REPLY_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_reply(&xmit_out, (buf + 2)) != H5FD_MIRROR_XMIT_REPLY_SIZE) {
TEST_ERROR;
}
- if (xmit_out.pub.magic != xmit_mock.magic) TEST_ERROR;
- if (xmit_out.pub.version != xmit_mock.version) TEST_ERROR;
- if (xmit_out.pub.session_token != xmit_mock.session_token) TEST_ERROR;
- if (xmit_out.pub.xmit_count != xmit_mock.xmit_count) TEST_ERROR;
- if (xmit_out.pub.op != xmit_mock.op) TEST_ERROR;
- if (xmit_out.status != xmit_in.status) TEST_ERROR;
- if (HDstrncmp(xmit_out.message, xmit_in.message,
- H5FD_MIRROR_STATUS_MESSAGE_MAX)
- != 0)
- {
- PRINT_BUFFER_DIFF(xmit_out.message, xmit_in.message,
- H5FD_MIRROR_STATUS_MESSAGE_MAX);
+ if (xmit_out.pub.magic != xmit_mock.magic)
+ TEST_ERROR;
+ if (xmit_out.pub.version != xmit_mock.version)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != xmit_mock.session_token)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != xmit_mock.xmit_count)
+ TEST_ERROR;
+ if (xmit_out.pub.op != xmit_mock.op)
+ TEST_ERROR;
+ if (xmit_out.status != xmit_in.status)
+ TEST_ERROR;
+ if (HDstrncmp(xmit_out.message, xmit_in.message, H5FD_MIRROR_STATUS_MESSAGE_MAX) != 0) {
+ PRINT_BUFFER_DIFF(xmit_out.message, xmit_in.message, H5FD_MIRROR_STATUS_MESSAGE_MAX);
TEST_ERROR;
}
/* Decode from different offset in buffer
* Observe changes when ingesting the padding
*/
- if (H5FD_mirror_xmit_decode_reply(&xmit_out, (buf))
- != H5FD_MIRROR_XMIT_REPLY_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_reply(&xmit_out, (buf)) != H5FD_MIRROR_XMIT_REPLY_SIZE) {
TEST_ERROR;
}
- if (xmit_out.pub.magic != 0xFFFF0001) TEST_ERROR;
- if (xmit_out.pub.version != 0x02) TEST_ERROR;
- if (xmit_out.pub.session_token != 0x03040506) TEST_ERROR;
- if (xmit_out.pub.xmit_count != 0x0708090A) TEST_ERROR;
- if (xmit_out.pub.op != 0x0B) TEST_ERROR;
- if (xmit_out.status != 0x0C0D0E0F) TEST_ERROR;
+ if (xmit_out.pub.magic != 0xFFFF0001)
+ TEST_ERROR;
+ if (xmit_out.pub.version != 0x02)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != 0x03040506)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != 0x0708090A)
+ TEST_ERROR;
+ if (xmit_out.pub.op != 0x0B)
+ TEST_ERROR;
+ if (xmit_out.status != 0x0C0D0E0F)
+ TEST_ERROR;
/* update expected "message" in structure */
- for (i=0x10; i < H5FD_MIRROR_STATUS_MESSAGE_MAX+0x10; i++) {
- xmit_in.message[i-0x10] = (i > 0xFF) ? 0 : (char)i;
+ for (i = 0x10; i < H5FD_MIRROR_STATUS_MESSAGE_MAX + 0x10; i++) {
+ xmit_in.message[i - 0x10] = (i > 0xFF) ? 0 : (char)i;
}
- if (HDstrncmp(xmit_out.message, xmit_in.message,
- H5FD_MIRROR_STATUS_MESSAGE_MAX)
- != 0)
- {
- PRINT_BUFFER_DIFF(xmit_out.message, xmit_in.message,
- H5FD_MIRROR_STATUS_MESSAGE_MAX);
+ if (HDstrncmp(xmit_out.message, xmit_in.message, H5FD_MIRROR_STATUS_MESSAGE_MAX) != 0) {
+ PRINT_BUFFER_DIFF(xmit_out.message, xmit_in.message, H5FD_MIRROR_STATUS_MESSAGE_MAX);
TEST_ERROR;
}
@@ -1151,14 +1133,14 @@ test_xmit_encode_decode(void)
* Then repeat from a different offset in the buffer and compare.
*/
do {
- unsigned char buf[H5FD_MIRROR_XMIT_WRITE_SIZE+8];
- unsigned char expected[H5FD_MIRROR_XMIT_WRITE_SIZE+8];
+ unsigned char buf[H5FD_MIRROR_XMIT_WRITE_SIZE + 8];
+ unsigned char expected[H5FD_MIRROR_XMIT_WRITE_SIZE + 8];
H5FD_mirror_xmit_write_t xmit_in;
H5FD_mirror_xmit_write_t xmit_out;
- size_t i = 0;
+ size_t i = 0;
/* sanity check */
- if ((14+17) != H5FD_MIRROR_XMIT_WRITE_SIZE) {
+ if ((14 + 17) != H5FD_MIRROR_XMIT_WRITE_SIZE) {
FAIL_PUTS_ERROR("Header size definition does not match test\n");
}
if (xmit_mock.op != 0x0D) {
@@ -1167,9 +1149,9 @@ test_xmit_encode_decode(void)
/* Populate the expected buffer; expect end padding of 0xFF
*/
- HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_WRITE_SIZE+8);
- for (i=0; i < H5FD_MIRROR_XMIT_WRITE_SIZE; i++) {
- expected[i+2] = (unsigned char)i;
+ HDmemset(expected, 0xFF, H5FD_MIRROR_XMIT_WRITE_SIZE + 8);
+ for (i = 0; i < H5FD_MIRROR_XMIT_WRITE_SIZE; i++) {
+ expected[i + 2] = (unsigned char)i;
}
/* Set xmit_in
@@ -1182,49 +1164,59 @@ test_xmit_encode_decode(void)
/* Encode, and compare buffer contents
* Initial buffer is filled with 0xFF to match expected padding
*/
- HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_WRITE_SIZE+8);
- if (H5FD_mirror_xmit_encode_write((buf+2), &xmit_in)
- != H5FD_MIRROR_XMIT_WRITE_SIZE)
- {
+ HDmemset(buf, 0xFF, H5FD_MIRROR_XMIT_WRITE_SIZE + 8);
+ if (H5FD_mirror_xmit_encode_write((buf + 2), &xmit_in) != H5FD_MIRROR_XMIT_WRITE_SIZE) {
TEST_ERROR;
}
- if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_WRITE_SIZE+8) != 0) {
- PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_WRITE_SIZE+8);
+ if (HDmemcmp(buf, expected, H5FD_MIRROR_XMIT_WRITE_SIZE + 8) != 0) {
+ PRINT_BUFFER_DIFF(buf, expected, H5FD_MIRROR_XMIT_WRITE_SIZE + 8);
TEST_ERROR;
}
/* Decode from buffer
*/
- if (H5FD_mirror_xmit_decode_write(&xmit_out, (buf+2))
- != H5FD_MIRROR_XMIT_WRITE_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_write(&xmit_out, (buf + 2)) != H5FD_MIRROR_XMIT_WRITE_SIZE) {
TEST_ERROR;
}
- if (xmit_out.pub.magic != xmit_mock.magic) TEST_ERROR;
- if (xmit_out.pub.version != xmit_mock.version) TEST_ERROR;
- if (xmit_out.pub.session_token != xmit_mock.session_token) TEST_ERROR;
- if (xmit_out.pub.xmit_count != xmit_mock.xmit_count) TEST_ERROR;
- if (xmit_out.pub.op != xmit_mock.op) TEST_ERROR;
- if (xmit_out.type != 0x0E) TEST_ERROR;
- if (xmit_out.offset != 0x0F10111213141516) TEST_ERROR;
- if (xmit_out.size != 0x1718191A1B1C1D1E) TEST_ERROR;
+ if (xmit_out.pub.magic != xmit_mock.magic)
+ TEST_ERROR;
+ if (xmit_out.pub.version != xmit_mock.version)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != xmit_mock.session_token)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != xmit_mock.xmit_count)
+ TEST_ERROR;
+ if (xmit_out.pub.op != xmit_mock.op)
+ TEST_ERROR;
+ if (xmit_out.type != 0x0E)
+ TEST_ERROR;
+ if (xmit_out.offset != 0x0F10111213141516)
+ TEST_ERROR;
+ if (xmit_out.size != 0x1718191A1B1C1D1E)
+ TEST_ERROR;
/* Decode from different offset in buffer
* Observe changes when ingesting the padding
*/
- if (H5FD_mirror_xmit_decode_write(&xmit_out, (buf))
- != H5FD_MIRROR_XMIT_WRITE_SIZE)
- {
+ if (H5FD_mirror_xmit_decode_write(&xmit_out, (buf)) != H5FD_MIRROR_XMIT_WRITE_SIZE) {
TEST_ERROR;
}
- if (xmit_out.pub.magic != 0xFFFF0001) TEST_ERROR;
- if (xmit_out.pub.version != 0x02) TEST_ERROR;
- if (xmit_out.pub.session_token != 0x03040506) TEST_ERROR;
- if (xmit_out.pub.xmit_count != 0x0708090A) TEST_ERROR;
- if (xmit_out.pub.op != 0x0B) TEST_ERROR;
- if (xmit_out.type != 0x0C) TEST_ERROR;
- if (xmit_out.offset != 0x0D0E0F1011121314) TEST_ERROR;
- if (xmit_out.size != 0x15161718191A1B1C) TEST_ERROR;
+ if (xmit_out.pub.magic != 0xFFFF0001)
+ TEST_ERROR;
+ if (xmit_out.pub.version != 0x02)
+ TEST_ERROR;
+ if (xmit_out.pub.session_token != 0x03040506)
+ TEST_ERROR;
+ if (xmit_out.pub.xmit_count != 0x0708090A)
+ TEST_ERROR;
+ if (xmit_out.pub.op != 0x0B)
+ TEST_ERROR;
+ if (xmit_out.type != 0x0C)
+ TEST_ERROR;
+ if (xmit_out.offset != 0x0D0E0F1011121314)
+ TEST_ERROR;
+ if (xmit_out.size != 0x15161718191A1B1C)
+ TEST_ERROR;
} while (0); /* end xmit write en/decode */
@@ -1235,7 +1227,6 @@ error:
return -1;
} /* end test_xmit_encode_decode */
-
/* ---------------------------------------------------------------------------
* Function: create_mirroring_split_fapl
*
@@ -1255,19 +1246,18 @@ error:
* ---------------------------------------------------------------------------
*/
static hid_t
-create_mirroring_split_fapl(const char *_basename,
- struct mirrortest_filenames *names)
+create_mirroring_split_fapl(const char *_basename, struct mirrortest_filenames *names)
{
- H5FD_splitter_vfd_config_t splitter_config;
- H5FD_mirror_fapl_t mirror_conf;
- hid_t ret_value = H5I_INVALID_HID;
+ H5FD_splitter_vfd_config_t splitter_config;
+ H5FD_mirror_fapl_t mirror_conf;
+ hid_t ret_value = H5I_INVALID_HID;
if (_basename == NULL || *_basename == '\0') {
TEST_ERROR;
}
- splitter_config.magic = H5FD_SPLITTER_MAGIC;
- splitter_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ splitter_config.magic = H5FD_SPLITTER_MAGIC;
+ splitter_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
splitter_config.ignore_wo_errs = FALSE;
/* Create Splitter R/W channel driver (sec2)
@@ -1282,13 +1272,10 @@ create_mirroring_split_fapl(const char *_basename,
/* Create Splitter W/O channel driver (mirror)
*/
- mirror_conf.magic = H5FD_MIRROR_FAPL_MAGIC;
- mirror_conf.version = H5FD_MIRROR_CURR_FAPL_T_VERSION;
+ mirror_conf.magic = H5FD_MIRROR_FAPL_MAGIC;
+ mirror_conf.version = H5FD_MIRROR_CURR_FAPL_T_VERSION;
mirror_conf.handshake_port = SERVER_HANDSHAKE_PORT;
- if (HDstrncpy(mirror_conf.remote_ip, SERVER_IP_ADDRESS,
- H5FD_MIRROR_MAX_IP_LEN)
- == NULL)
- {
+ if (HDstrncpy(mirror_conf.remote_ip, SERVER_IP_ADDRESS, H5FD_MIRROR_MAX_IP_LEN) == NULL) {
TEST_ERROR;
}
splitter_config.wo_fapl_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -1307,16 +1294,10 @@ create_mirroring_split_fapl(const char *_basename,
/* Set file paths for w/o and logfile
*/
- if (HDstrncpy(splitter_config.wo_path, (const char *)names->wo,
- H5FD_SPLITTER_PATH_MAX)
- == NULL)
- {
+ if (HDstrncpy(splitter_config.wo_path, (const char *)names->wo, H5FD_SPLITTER_PATH_MAX) == NULL) {
TEST_ERROR;
}
- if (HDstrncpy(splitter_config.log_file_path, (const char *)names->log,
- H5FD_SPLITTER_PATH_MAX)
- == NULL)
- {
+ if (HDstrncpy(splitter_config.log_file_path, (const char *)names->log, H5FD_SPLITTER_PATH_MAX) == NULL) {
TEST_ERROR;
}
@@ -1356,7 +1337,6 @@ error:
return H5I_INVALID_HID;
} /* end create_mirroring_split_fapl() */
-
/* ---------------------------------------------------------------------------
* Function: test_create_and_close
*
@@ -1377,8 +1357,8 @@ static int
test_create_and_close(void)
{
struct mirrortest_filenames names;
- hid_t file_id = H5I_INVALID_HID;
- hid_t fapl_id = H5P_DEFAULT;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5P_DEFAULT;
TESTING("File creation and immediate close");
@@ -1413,14 +1393,15 @@ test_create_and_close(void)
return 0;
error:
- H5E_BEGIN_TRY{
+ H5E_BEGIN_TRY
+ {
(void)H5Fclose(file_id);
(void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_create_and_close() */
-
/* ----------------------------------------------------------------------------
* Function: create_datasets
*
@@ -1437,20 +1418,18 @@ error:
* ----------------------------------------------------------------------------
*/
static herr_t
-create_datasets(hid_t file_id,
- unsigned min_dset,
- unsigned max_dset)
+create_datasets(hid_t file_id, unsigned min_dset, unsigned max_dset)
{
- hid_t dataspace_ids[MAX_DSET_COUNT + 1];
- hid_t dataset_ids[MAX_DSET_COUNT + 1];
- hid_t filespace_ids[MAX_DSET_COUNT + 1];
- int data_chunk[CHUNK_DIM][CHUNK_DIM];
- unsigned int i, j, k, l, m;
- hsize_t offset[2];
- hid_t memspace_id = H5I_INVALID_HID;
- hsize_t a_size[2] = {CHUNK_DIM, CHUNK_DIM};
- hsize_t chunk_dims[2] = {CHUNK_DIM, CHUNK_DIM};
- hsize_t dset_dims[2] = {DSET_DIM, DSET_DIM};
+ hid_t dataspace_ids[MAX_DSET_COUNT + 1];
+ hid_t dataset_ids[MAX_DSET_COUNT + 1];
+ hid_t filespace_ids[MAX_DSET_COUNT + 1];
+ int data_chunk[CHUNK_DIM][CHUNK_DIM];
+ unsigned int i, j, k, l, m;
+ hsize_t offset[2];
+ hid_t memspace_id = H5I_INVALID_HID;
+ hsize_t a_size[2] = {CHUNK_DIM, CHUNK_DIM};
+ hsize_t chunk_dims[2] = {CHUNK_DIM, CHUNK_DIM};
+ hsize_t dset_dims[2] = {DSET_DIM, DSET_DIM};
HDassert(file_id >= 0);
HDassert(min_dset <= max_dset);
@@ -1465,7 +1444,7 @@ create_datasets(hid_t file_id,
for (i = 0; i < MAX_DSET_COUNT; i++) {
LOGPRINT(3, "clearing IDs [%d]\n", i);
dataspace_ids[i] = H5I_INVALID_HID;
- dataset_ids[i] = H5I_INVALID_HID;
+ dataset_ids[i] = H5I_INVALID_HID;
filespace_ids[i] = H5I_INVALID_HID;
}
@@ -1473,10 +1452,8 @@ create_datasets(hid_t file_id,
* Generate dataspace, dataset, and 'filespace' IDs
*/
- if (_create_chunking_ids(file_id, min_dset, max_dset, chunk_dims,
- dset_dims, dataspace_ids, filespace_ids, dataset_ids, &memspace_id)
- == FAIL)
- {
+ if (_create_chunking_ids(file_id, min_dset, max_dset, chunk_dims, dset_dims, dataspace_ids, filespace_ids,
+ dataset_ids, &memspace_id) == FAIL) {
TEST_ERROR;
}
@@ -1485,23 +1462,16 @@ create_datasets(hid_t file_id,
* for a given chunk 'location', write chunk data to each dataset.
*/
- for (i = 0; i < DSET_DIM; i += CHUNK_DIM)
- {
+ for (i = 0; i < DSET_DIM; i += CHUNK_DIM) {
LOGPRINT(3, "i: %d\n", i);
- for (j = 0; j < DSET_DIM; j += CHUNK_DIM)
- {
+ for (j = 0; j < DSET_DIM; j += CHUNK_DIM) {
LOGPRINT(3, " j: %d\n", j);
- for (m = min_dset; m <= max_dset; m++)
- {
+ for (m = min_dset; m <= max_dset; m++) {
LOGPRINT(3, " m: %d\n", m);
- for (k = 0; k < CHUNK_DIM; k++)
- {
- for (l = 0; l < CHUNK_DIM; l++)
- {
- data_chunk[k][l] = (int)((DSET_DIM * DSET_DIM * m) +
- (DSET_DIM * (i + k)) + j + l);
- LOGPRINT(3, " data_chunk[%d][%d]: %d\n",
- k, l, data_chunk[k][l]);
+ for (k = 0; k < CHUNK_DIM; k++) {
+ for (l = 0; l < CHUNK_DIM; l++) {
+ data_chunk[k][l] = (int)((DSET_DIM * DSET_DIM * m) + (DSET_DIM * (i + k)) + j + l);
+ LOGPRINT(3, " data_chunk[%d][%d]: %d\n", k, l, data_chunk[k][l]);
}
}
@@ -1509,21 +1479,15 @@ create_datasets(hid_t file_id,
offset[0] = (hsize_t)i;
offset[1] = (hsize_t)j;
LOGPRINT(3, " H5Sselect_hyperslab()\n");
- if (H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET,
- offset, NULL, a_size, NULL)
- < 0)
- {
+ if (H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL) < 0) {
TEST_ERROR;
}
LOGPRINT(3, " H5Dwrite()\n");
- if (H5Dwrite(dataset_ids[m], H5T_NATIVE_INT, memspace_id,
- filespace_ids[m], H5P_DEFAULT, data_chunk)
- < 0)
- {
+ if (H5Dwrite(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m], H5P_DEFAULT,
+ data_chunk) < 0) {
TEST_ERROR;
}
-
}
}
}
@@ -1532,10 +1496,7 @@ create_datasets(hid_t file_id,
* Read and verify data from datasets
*/
- if (_verify_datasets(min_dset, max_dset, filespace_ids, dataset_ids,
- memspace_id)
- == FAIL)
- {
+ if (_verify_datasets(min_dset, max_dset, filespace_ids, dataset_ids, memspace_id) == FAIL) {
TEST_ERROR;
}
@@ -1543,23 +1504,19 @@ create_datasets(hid_t file_id,
* Cleanup
*/
- if (_close_chunking_ids(min_dset, max_dset, dataspace_ids, filespace_ids,
- dataset_ids, &memspace_id)
- == FAIL)
- {
+ if (_close_chunking_ids(min_dset, max_dset, dataspace_ids, filespace_ids, dataset_ids, &memspace_id) ==
+ FAIL) {
TEST_ERROR;
}
return SUCCEED;
error:
- (void)_close_chunking_ids(min_dset, max_dset, dataspace_ids,
- filespace_ids, dataset_ids, &memspace_id);
+ (void)_close_chunking_ids(min_dset, max_dset, dataspace_ids, filespace_ids, dataset_ids, &memspace_id);
LOGPRINT(1, "create_datasets() FAILED\n");
return FAIL;
} /* end create_datasets() */
-
/* ----------------------------------------------------------------------------
* Function: _create_chunking_ids
*
@@ -1572,19 +1529,13 @@ error:
* ----------------------------------------------------------------------------
*/
static herr_t
-_create_chunking_ids(hid_t file_id,
- unsigned min_dset,
- unsigned max_dset,
- hsize_t *chunk_dims,
- hsize_t *dset_dims,
- hid_t *dataspace_ids,
- hid_t *filespace_ids,
- hid_t *dataset_ids,
- hid_t *memspace_id)
+_create_chunking_ids(hid_t file_id, unsigned min_dset, unsigned max_dset, hsize_t *chunk_dims,
+ hsize_t *dset_dims, hid_t *dataspace_ids, hid_t *filespace_ids, hid_t *dataset_ids,
+ hid_t *memspace_id)
{
char dset_name[DSET_NAME_LEN + 1];
- unsigned m = 0;
- hid_t dcpl_id = H5I_INVALID_HID;
+ unsigned m = 0;
+ hid_t dcpl_id = H5I_INVALID_HID;
LOGPRINT(2, "_create_chunking_ids()\n");
@@ -1607,8 +1558,7 @@ _create_chunking_ids(hid_t file_id,
for (m = min_dset; m <= max_dset; m++) {
dataspace_ids[m] = H5Screate_simple(2, dset_dims, NULL);
if (dataspace_ids[m] < 0) {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- "unable to create dataspace ID %d\n", m);
+ HDsnprintf(mesg, MIRR_MESG_SIZE, "unable to create dataspace ID %d\n", m);
FAIL_PUTS_ERROR(mesg);
}
}
@@ -1618,19 +1568,15 @@ _create_chunking_ids(hid_t file_id,
*/
for (m = min_dset; m <= max_dset; m++) {
- if (HDsnprintf(dset_name, DSET_NAME_LEN, "/dset%03d", m)
- > DSET_NAME_LEN)
- {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- "unable to compose dset name %d\n", m);
+ if (HDsnprintf(dset_name, DSET_NAME_LEN, "/dset%03d", m) > DSET_NAME_LEN) {
+ HDsnprintf(mesg, MIRR_MESG_SIZE, "unable to compose dset name %d\n", m);
FAIL_PUTS_ERROR(mesg);
}
- dataset_ids[m] = H5Dcreate(file_id, dset_name, H5T_STD_I32BE,
- dataspace_ids[m], H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ dataset_ids[m] =
+ H5Dcreate(file_id, dset_name, H5T_STD_I32BE, dataspace_ids[m], H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
if (dataset_ids[m] < 0) {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- "unable to create dset ID %d\n", m);
+ HDsnprintf(mesg, MIRR_MESG_SIZE, "unable to create dset ID %d\n", m);
FAIL_PUTS_ERROR(mesg);
}
}
@@ -1642,8 +1588,7 @@ _create_chunking_ids(hid_t file_id,
for (m = min_dset; m <= max_dset; m++) {
filespace_ids[m] = H5Dget_space(dataset_ids[m]);
if (filespace_ids[m] < 0) {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- "unable to create filespace ID %d\n", m);
+ HDsnprintf(mesg, MIRR_MESG_SIZE, "unable to create filespace ID %d\n", m);
FAIL_PUTS_ERROR(mesg);
}
}
@@ -1677,7 +1622,6 @@ error:
return FAIL;
} /* end _create_chunking_ids() */
-
/* ----------------------------------------------------------------------------
* Function: _open_chunking_ids
*
@@ -1690,16 +1634,10 @@ error:
* ----------------------------------------------------------------------------
*/
static herr_t
-_open_chunking_ids(
- hid_t file_id,
- unsigned min_dset,
- unsigned max_dset,
- hsize_t *chunk_dims,
- hid_t *filespace_ids,
- hid_t *dataset_ids,
- hid_t *memspace_id)
+_open_chunking_ids(hid_t file_id, unsigned min_dset, unsigned max_dset, hsize_t *chunk_dims,
+ hid_t *filespace_ids, hid_t *dataset_ids, hid_t *memspace_id)
{
- char dset_name[DSET_NAME_LEN+1];
+ char dset_name[DSET_NAME_LEN + 1];
unsigned m = 0;
LOGPRINT(2, "_open_chunking_ids()\n");
@@ -1709,11 +1647,8 @@ _open_chunking_ids(
*/
for (m = min_dset; m <= max_dset; m++) {
- if (HDsnprintf(dset_name, DSET_NAME_LEN, "/dset%03d", m)
- > DSET_NAME_LEN)
- {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- "unable to compose dset name %d\n", m);
+ if (HDsnprintf(dset_name, DSET_NAME_LEN, "/dset%03d", m) > DSET_NAME_LEN) {
+ HDsnprintf(mesg, MIRR_MESG_SIZE, "unable to compose dset name %d\n", m);
FAIL_PUTS_ERROR(mesg);
}
@@ -1731,8 +1666,7 @@ _open_chunking_ids(
for (m = min_dset; m <= max_dset; m++) {
filespace_ids[m] = H5Dget_space(dataset_ids[m]);
if (filespace_ids[m] < 0) {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- "unable to get filespace ID %d\n", m);
+ HDsnprintf(mesg, MIRR_MESG_SIZE, "unable to get filespace ID %d\n", m);
FAIL_PUTS_ERROR(mesg);
}
}
@@ -1753,7 +1687,6 @@ error:
return FAIL;
} /* end _open_chunking_ids() */
-
/* ---------------------------------------------------------------------------
* Function: _close_chunking_ids
*
@@ -1768,12 +1701,8 @@ error:
* ---------------------------------------------------------------------------
*/
static herr_t
-_close_chunking_ids(unsigned min_dset,
- unsigned max_dset,
- hid_t *dataspace_ids,
- hid_t *filespace_ids,
- hid_t *dataset_ids,
- hid_t *memspace_id)
+_close_chunking_ids(unsigned min_dset, unsigned max_dset, hid_t *dataspace_ids, hid_t *filespace_ids,
+ hid_t *dataset_ids, hid_t *memspace_id)
{
unsigned m;
@@ -1783,26 +1712,21 @@ _close_chunking_ids(unsigned min_dset,
LOGPRINT(3, "closing ids[%d]\n", m);
if (dataspace_ids) {
if (H5Sclose(dataspace_ids[m]) < 0) {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- "unable to close dataspace_id[%d]\n", m);
+ HDsnprintf(mesg, MIRR_MESG_SIZE, "unable to close dataspace_id[%d]\n", m);
FAIL_PUTS_ERROR(mesg);
}
}
if (H5Dclose(dataset_ids[m]) < 0) {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- "unable to close dataset_id[%d]\n", m);
+ HDsnprintf(mesg, MIRR_MESG_SIZE, "unable to close dataset_id[%d]\n", m);
FAIL_PUTS_ERROR(mesg);
}
if (H5Sclose(filespace_ids[m]) < 0) {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- "unable to close filespace_id[%d]\n", m);
+ HDsnprintf(mesg, MIRR_MESG_SIZE, "unable to close filespace_id[%d]\n", m);
FAIL_PUTS_ERROR(mesg);
}
}
- if ( (*memspace_id != H5I_INVALID_HID) &&
- (H5Sclose(*memspace_id) < 0) )
- {
+ if ((*memspace_id != H5I_INVALID_HID) && (H5Sclose(*memspace_id) < 0)) {
TEST_ERROR;
}
@@ -1813,7 +1737,6 @@ error:
return FAIL;
} /* end _close_chunking_ids() */
-
/* ---------------------------------------------------------------------------
* Function: _verify_datasets
*
@@ -1827,11 +1750,8 @@ error:
* ---------------------------------------------------------------------------
*/
static herr_t
-_verify_datasets(unsigned min_dset,
- unsigned max_dset,
- hid_t *filespace_ids,
- hid_t *dataset_ids,
- hid_t memspace_id)
+_verify_datasets(unsigned min_dset, unsigned max_dset, hid_t *filespace_ids, hid_t *dataset_ids,
+ hid_t memspace_id)
{
unsigned i, j, k, l, m;
int data_chunk[CHUNK_DIM][CHUNK_DIM];
@@ -1840,51 +1760,36 @@ _verify_datasets(unsigned min_dset,
LOGPRINT(2, "_verify_datasets()\n");
- for (i = 0; i < DSET_DIM; i += CHUNK_DIM)
- {
+ for (i = 0; i < DSET_DIM; i += CHUNK_DIM) {
LOGPRINT(3, "i: %d\n", i);
- for (j = 0; j < DSET_DIM; j += CHUNK_DIM)
- {
+ for (j = 0; j < DSET_DIM; j += CHUNK_DIM) {
LOGPRINT(3, " j: %d\n", j);
- for (m = min_dset; m <= max_dset; m++)
- {
+ for (m = min_dset; m <= max_dset; m++) {
LOGPRINT(3, " m: %d\n", m);
/* select on disk hyperslab */
offset[0] = (hsize_t)i;
offset[1] = (hsize_t)j;
- if (H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET,
- offset, NULL, a_size, NULL)
- < 0)
- {
+ if (H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, offset, NULL, a_size, NULL) < 0) {
TEST_ERROR;
}
- if (H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id,
- filespace_ids[m], H5P_DEFAULT, data_chunk)
- < 0)
- {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- " H5Dread() [%d][%d][%d]\n",
- i, j, m);
+ if (H5Dread(dataset_ids[m], H5T_NATIVE_INT, memspace_id, filespace_ids[m], H5P_DEFAULT,
+ data_chunk) < 0) {
+ HDsnprintf(mesg, MIRR_MESG_SIZE, " H5Dread() [%d][%d][%d]\n", i, j, m);
FAIL_PUTS_ERROR(mesg);
}
for (k = 0; k < CHUNK_DIM; k++) {
for (l = 0; l < CHUNK_DIM; l++) {
- if ((unsigned)data_chunk[k][l]
- !=
- ((DSET_DIM * DSET_DIM * m) +
- (DSET_DIM * (i + k)) + j + l))
- {
- HDsnprintf(mesg, MIRR_MESG_SIZE,
- " MISMATCH [%d][%d][%d][%d][%d]\n",
- i, j, m, k, l);
+ if ((unsigned)data_chunk[k][l] !=
+ ((DSET_DIM * DSET_DIM * m) + (DSET_DIM * (i + k)) + j + l)) {
+ HDsnprintf(mesg, MIRR_MESG_SIZE, " MISMATCH [%d][%d][%d][%d][%d]\n", i, j, m,
+ k, l);
FAIL_PUTS_ERROR(mesg);
}
}
}
-
}
}
}
@@ -1896,7 +1801,6 @@ error:
return FAIL;
} /* end _verify_datasets() */
-
/* ---------------------------------------------------------------------------
* Function: verify_datasets
*
@@ -1911,9 +1815,7 @@ error:
* ---------------------------------------------------------------------------
*/
static herr_t
-verify_datasets(hid_t file_id,
- unsigned min_dset,
- unsigned max_dset)
+verify_datasets(hid_t file_id, unsigned min_dset, unsigned max_dset)
{
hid_t dataset_ids[MAX_DSET_COUNT + 1];
hid_t filespace_ids[MAX_DSET_COUNT + 1];
@@ -1933,7 +1835,7 @@ verify_datasets(hid_t file_id,
for (i = 0; i < MAX_DSET_COUNT; i++) {
LOGPRINT(3, "clearing IDs [%d]\n", i);
- dataset_ids[i] = H5I_INVALID_HID;
+ dataset_ids[i] = H5I_INVALID_HID;
filespace_ids[i] = H5I_INVALID_HID;
}
@@ -1941,10 +1843,8 @@ verify_datasets(hid_t file_id,
* Generate dataspace, dataset, and 'filespace' IDs
*/
- if (_open_chunking_ids(file_id, min_dset, max_dset, chunk_dims,
- filespace_ids, dataset_ids, &memspace_id)
- == FAIL)
- {
+ if (_open_chunking_ids(file_id, min_dset, max_dset, chunk_dims, filespace_ids, dataset_ids,
+ &memspace_id) == FAIL) {
TEST_ERROR;
}
@@ -1952,10 +1852,7 @@ verify_datasets(hid_t file_id,
* Read and verify data from datasets
*/
- if (_verify_datasets(min_dset, max_dset, filespace_ids, dataset_ids,
- memspace_id)
- == FAIL)
- {
+ if (_verify_datasets(min_dset, max_dset, filespace_ids, dataset_ids, memspace_id) == FAIL) {
TEST_ERROR;
}
@@ -1963,10 +1860,7 @@ verify_datasets(hid_t file_id,
* Cleanup
*/
- if (_close_chunking_ids(min_dset, max_dset, NULL, filespace_ids,
- dataset_ids, &memspace_id)
- == FAIL)
- {
+ if (_close_chunking_ids(min_dset, max_dset, NULL, filespace_ids, dataset_ids, &memspace_id) == FAIL) {
TEST_ERROR;
}
@@ -1974,13 +1868,11 @@ verify_datasets(hid_t file_id,
error:
LOGPRINT(1, "verify_datasets() FAILED\n");
- (void)_close_chunking_ids(min_dset, max_dset, NULL, filespace_ids,
- dataset_ids, &memspace_id);
+ (void)_close_chunking_ids(min_dset, max_dset, NULL, filespace_ids, dataset_ids, &memspace_id);
return FAIL;
} /* end verify_datasets() */
-
/* ---------------------------------------------------------------------------
* Function: test_basic_dataset_write
*
@@ -2000,15 +1892,15 @@ static int
test_basic_dataset_write(void)
{
struct mirrortest_filenames names;
- hid_t file_id = H5I_INVALID_HID;
- hid_t fapl_id = H5P_DEFAULT;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t dspace_id = H5I_INVALID_HID;
- hid_t dtype_id = H5T_NATIVE_INT;
- hsize_t dims[2] = { DATABUFFER_SIZE, DATABUFFER_SIZE };
- int *buf = NULL;
- int i = 0;
- int j = 0;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5P_DEFAULT;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t dspace_id = H5I_INVALID_HID;
+ hid_t dtype_id = H5T_NATIVE_INT;
+ hsize_t dims[2] = {DATABUFFER_SIZE, DATABUFFER_SIZE};
+ int * buf = NULL;
+ int i = 0;
+ int j = 0;
TESTING("Mirror open and dataset writing");
@@ -2027,7 +1919,7 @@ test_basic_dataset_write(void)
}
for (i = 0; i < DATABUFFER_SIZE; i++) {
for (j = 0; j < DATABUFFER_SIZE; j++) {
- int k = i * DATABUFFER_SIZE + j;
+ int k = i * DATABUFFER_SIZE + j;
buf[k] = k;
}
}
@@ -2044,7 +1936,6 @@ test_basic_dataset_write(void)
}
file_id = H5I_INVALID_HID;
-
/* -------------------- */
/* TEST: Repoen and Write */
@@ -2057,15 +1948,12 @@ test_basic_dataset_write(void)
if (H5I_INVALID_HID == dspace_id) {
TEST_ERROR;
}
- dset_id = H5Dcreate2(file_id, "dataset", dtype_id, dspace_id, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, "dataset", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (H5I_INVALID_HID == dset_id) {
TEST_ERROR;
}
- if (H5Dwrite(dset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)
- == FAIL)
- {
+ if (H5Dwrite(dset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) == FAIL) {
TEST_ERROR;
}
@@ -2100,7 +1988,8 @@ test_basic_dataset_write(void)
return 0;
error:
- H5E_BEGIN_TRY{
+ H5E_BEGIN_TRY
+ {
(void)H5Fclose(file_id);
if (buf) {
HDfree(buf);
@@ -2110,11 +1999,11 @@ error:
if (fapl_id != H5P_DEFAULT && fapl_id > 0) {
(void)H5Pclose(fapl_id);
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_basic_dataset_write() */
-
/* ---------------------------------------------------------------------------
* Function: test_chunked_dataset_write
*
@@ -2134,8 +2023,8 @@ static int
test_chunked_dataset_write(void)
{
struct mirrortest_filenames names;
- hid_t file_id = H5I_INVALID_HID;
- hid_t fapl_id = H5P_DEFAULT;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5P_DEFAULT;
TESTING("Mirror open and dataset writing (chunked)");
@@ -2217,16 +2106,17 @@ test_chunked_dataset_write(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
(void)H5Fclose(file_id);
if (fapl_id != H5P_DEFAULT && fapl_id > 0) {
(void)H5Pclose(fapl_id);
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_chunked_dataset_write() */
-
/* ---------------------------------------------------------------------------
* Function: test_on_disk_zoo
*
@@ -2246,11 +2136,11 @@ error:
static int
test_on_disk_zoo(void)
{
- const char grp_name[] = "/only";
+ const char grp_name[] = "/only";
struct mirrortest_filenames names;
- hid_t file_id = H5I_INVALID_HID;
- hid_t grp_id = H5I_INVALID_HID;
- hid_t fapl_id = H5P_DEFAULT;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t grp_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5P_DEFAULT;
TESTING("'Zoo' of on-disk structures");
@@ -2268,8 +2158,7 @@ test_on_disk_zoo(void)
TEST_ERROR;
}
- grp_id = H5Gcreate2(file_id, grp_name, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT);
+ grp_id = H5Gcreate2(file_id, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp_id == H5I_INVALID_HID) {
TEST_ERROR;
}
@@ -2279,10 +2168,10 @@ test_on_disk_zoo(void)
* from cache_common and/or genall5.
*/
- if ( pass ) {
+ if (pass) {
create_zoo(file_id, grp_name, 0);
}
- if ( pass ) {
+ if (pass) {
if (H5Fclose(file_id) == FAIL) {
TEST_ERROR;
}
@@ -2291,10 +2180,10 @@ test_on_disk_zoo(void)
TEST_ERROR;
}
}
- if ( pass ) {
+ if (pass) {
validate_zoo(file_id, grp_name, 0); /* sanity-check */
}
- if ( !pass ) {
+ if (!pass) {
HDprintf(failure_mssg);
TEST_ERROR;
}
@@ -2325,17 +2214,18 @@ test_on_disk_zoo(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
(void)H5Fclose(file_id);
(void)H5Gclose(grp_id);
if (fapl_id != H5P_DEFAULT && fapl_id > 0) {
(void)H5Pclose(fapl_id);
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_on_disk_zoo() */
-
/* ---------------------------------------------------------------------------
* Function: test_vanishing_datasets
*
@@ -2360,17 +2250,17 @@ static int
test_vanishing_datasets(void)
{
struct mirrortest_filenames names;
- hid_t file_id = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t dspace_id = H5I_INVALID_HID;
- hid_t mirror_fapl_id = H5I_INVALID_HID;
- hsize_t dims[2] = {DATABUFFER_SIZE, DATABUFFER_SIZE};
- uint32_t buf[DATABUFFER_SIZE][DATABUFFER_SIZE]; /* consider malloc? */
- H5G_info_t group_info;
- unsigned int i, j, k;
- const unsigned int max_loops = 20;
- const unsigned int max_at_one_time = 3;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t dspace_id = H5I_INVALID_HID;
+ hid_t mirror_fapl_id = H5I_INVALID_HID;
+ hsize_t dims[2] = {DATABUFFER_SIZE, DATABUFFER_SIZE};
+ uint32_t buf[DATABUFFER_SIZE][DATABUFFER_SIZE]; /* consider malloc? */
+ H5G_info_t group_info;
+ unsigned int i, j, k;
+ const unsigned int max_loops = 20;
+ const unsigned int max_at_one_time = 3;
TESTING("Vanishing Datasets");
@@ -2395,15 +2285,12 @@ test_vanishing_datasets(void)
TEST_ERROR;
}
- for (i=0; i < max_loops; i++) {
+ for (i = 0; i < max_loops; i++) {
char namebuf[DSET_NAME_LEN + 1];
/* deleting datasets */
if (i >= max_at_one_time) {
- if (HDsnprintf(namebuf, DSET_NAME_LEN, "/dset%02d",
- (i - max_at_one_time) )
- > DSET_NAME_LEN)
- {
+ if (HDsnprintf(namebuf, DSET_NAME_LEN, "/dset%02d", (i - max_at_one_time)) > DSET_NAME_LEN) {
TEST_ERROR;
}
if (H5Ldelete(file_id, namebuf, H5P_DEFAULT) < 0) {
@@ -2413,27 +2300,22 @@ test_vanishing_datasets(void)
/* writing datasets */
if (i < (max_loops - max_at_one_time)) {
- if (HDsnprintf(namebuf, DSET_NAME_LEN, "/dset%02d", i)
- > DSET_NAME_LEN)
- {
+ if (HDsnprintf(namebuf, DSET_NAME_LEN, "/dset%02d", i) > DSET_NAME_LEN) {
TEST_ERROR;
}
- dset_id = H5Dcreate2(file_id, namebuf, H5T_STD_U32LE, dspace_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset_id =
+ H5Dcreate2(file_id, namebuf, H5T_STD_U32LE, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (H5I_INVALID_HID == dset_id) {
TEST_ERROR;
}
- for (j=0; j < DATABUFFER_SIZE; j++) {
- for (k=0; k < DATABUFFER_SIZE; k++) {
+ for (j = 0; j < DATABUFFER_SIZE; j++) {
+ for (k = 0; k < DATABUFFER_SIZE; k++) {
buf[j][k] = (uint32_t)i;
}
}
- if (H5Dwrite(dset_id, H5T_STD_U32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- buf)
- < 0)
- {
+ if (H5Dwrite(dset_id, H5T_STD_U32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
TEST_ERROR;
}
@@ -2459,8 +2341,7 @@ test_vanishing_datasets(void)
TEST_ERROR;
}
if (group_info.nlinks > 0) {
- HDfprintf(stderr, "links in rw file: %" PRIuHSIZE "\n",
- group_info.nlinks);
+ HDfprintf(stderr, "links in rw file: %" PRIuHSIZE "\n", group_info.nlinks);
HDfflush(stderr);
TEST_ERROR;
}
@@ -2475,8 +2356,7 @@ test_vanishing_datasets(void)
TEST_ERROR;
}
if (group_info.nlinks > 0) {
- HDfprintf(stderr, "links in wo file: %" PRIuHSIZE "\n",
- group_info.nlinks);
+ HDfprintf(stderr, "links in wo file: %" PRIuHSIZE "\n", group_info.nlinks);
HDfflush(stderr);
TEST_ERROR;
}
@@ -2502,7 +2382,8 @@ test_vanishing_datasets(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
if (mirror_fapl_id != H5I_INVALID_HID) {
H5Pclose(mirror_fapl_id);
}
@@ -2518,11 +2399,11 @@ error:
if (dspace_id != H5I_INVALID_HID) {
H5Sclose(dspace_id);
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_vanishing_datasets() */
-
/* ---------------------------------------------------------------------------
* Function: test_concurrent_access
*
@@ -2542,34 +2423,34 @@ test_concurrent_access(void)
{
struct file_bundle {
struct mirrortest_filenames names;
- hid_t dset_id;
- hid_t fapl_id;
- hid_t file_id;
+ hid_t dset_id;
+ hid_t fapl_id;
+ hid_t file_id;
} bundle[CONCURRENT_COUNT];
- hid_t dspace_id = H5I_INVALID_HID;
- hid_t dtype_id = H5T_NATIVE_INT;
- hsize_t dims[2] = { DATABUFFER_SIZE, DATABUFFER_SIZE };
- int *buf = NULL;
- int i = 0;
- int j = 0;
+ hid_t dspace_id = H5I_INVALID_HID;
+ hid_t dtype_id = H5T_NATIVE_INT;
+ hsize_t dims[2] = {DATABUFFER_SIZE, DATABUFFER_SIZE};
+ int * buf = NULL;
+ int i = 0;
+ int j = 0;
TESTING("Concurrent opened mirrored files");
/* blank bundle */
for (i = 0; i < CONCURRENT_COUNT; i++) {
- bundle[i].dset_id = H5I_INVALID_HID;
- bundle[i].fapl_id = H5I_INVALID_HID;
- bundle[i].file_id = H5I_INVALID_HID;
- *bundle[i].names.rw = '\0';
- *bundle[i].names.wo = '\0';
+ bundle[i].dset_id = H5I_INVALID_HID;
+ bundle[i].fapl_id = H5I_INVALID_HID;
+ bundle[i].file_id = H5I_INVALID_HID;
+ *bundle[i].names.rw = '\0';
+ *bundle[i].names.wo = '\0';
*bundle[i].names.log = '\0';
}
/* Create FAPL for Splitter[sec2|mirror]
*/
for (i = 0; i < CONCURRENT_COUNT; i++) {
- char _name[16] = "";
- hid_t _fapl_id = H5I_INVALID_HID;
+ char _name[16] = "";
+ hid_t _fapl_id = H5I_INVALID_HID;
HDsnprintf(_name, 15, "concurrent%d", i);
_fapl_id = create_mirroring_split_fapl(_name, &bundle[i].names);
if (H5I_INVALID_HID == _fapl_id) {
@@ -2586,7 +2467,7 @@ test_concurrent_access(void)
}
for (i = 0; i < DATABUFFER_SIZE; i++) {
for (j = 0; j < DATABUFFER_SIZE; j++) {
- int k = i * DATABUFFER_SIZE + j;
+ int k = i * DATABUFFER_SIZE + j;
buf[k] = k;
}
}
@@ -2605,16 +2486,15 @@ test_concurrent_access(void)
hid_t _file_id = H5I_INVALID_HID;
hid_t _dset_id = H5I_INVALID_HID;
- _file_id = H5Fcreate(bundle[i].names.rw, H5F_ACC_TRUNC, H5P_DEFAULT,
- bundle[i].fapl_id);
+ _file_id = H5Fcreate(bundle[i].names.rw, H5F_ACC_TRUNC, H5P_DEFAULT, bundle[i].fapl_id);
if (H5I_INVALID_HID == _file_id) {
TEST_ERROR;
}
- bundle[i].file_id = _file_id;
+ bundle[i].file_id = _file_id;
- _dset_id = H5Dcreate2(_file_id, "dataset", dtype_id, dspace_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ _dset_id =
+ H5Dcreate2(_file_id, "dataset", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (H5I_INVALID_HID == _dset_id) {
TEST_ERROR;
}
@@ -2625,10 +2505,7 @@ test_concurrent_access(void)
/* TEST: Write to files */
for (i = 0; i < CONCURRENT_COUNT; i++) {
- if (H5Dwrite(bundle[i].dset_id, dtype_id, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, buf)
- == FAIL)
- {
+ if (H5Dwrite(bundle[i].dset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) == FAIL) {
TEST_ERROR;
}
}
@@ -2670,7 +2547,8 @@ test_concurrent_access(void)
return 0;
error:
- H5E_BEGIN_TRY{
+ H5E_BEGIN_TRY
+ {
if (buf) {
HDfree(buf);
}
@@ -2680,11 +2558,11 @@ error:
(void)H5Fclose(bundle[i].file_id);
(void)H5Pclose(bundle[i].fapl_id);
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_concurrent_access() */
-
/* ---------------------------------------------------------------------------
* Function: main
*
@@ -2740,8 +2618,7 @@ main(void)
}
if (nerrors) {
- HDprintf("***** %d Mirror VFD TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ HDprintf("***** %d Mirror VFD TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
return EXIT_FAILURE;
}
@@ -2761,5 +2638,3 @@ main(void)
}
#endif /* H5_HAVE_MIRROR_VFD */
-
-
diff --git a/test/mount.c b/test/mount.c
index 4cc02e4..395a19a 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -18,28 +18,18 @@
* Purpose: Tests file mounting.
*/
#include "h5test.h"
-#include "H5Fprivate.h" /* File access */
-#include "H5Iprivate.h" /* IDs */
-
-const char *FILENAME[] = {
- "mount_1",
- "mount_2",
- "mount_3",
- "mount_4",
- "mount_5",
- "mount_6",
- "mount_7",
- NULL
-};
+#include "H5Fprivate.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
+
+const char *FILENAME[] = {"mount_1", "mount_2", "mount_3", "mount_4", "mount_5", "mount_6", "mount_7", NULL};
/* For "mount_after_close" test */
-#define RANK 2
-#define NX 4
-#define NY 5
-#define NAME_BUF_SIZE 40
+#define RANK 2
+#define NX 4
+#define NY 5
+#define NAME_BUF_SIZE 40
int bm[NX][NY], bm_out[NX][NY]; /* Data buffers */
-
/*-------------------------------------------------------------------------
* Function: setup
*
@@ -59,44 +49,58 @@ int bm[NX][NY], bm_out[NX][NY]; /* Data buffers */
static int
setup(hid_t fapl)
{
- hid_t file = -1;
- char filename[1024];
+ hid_t file = -1;
+ char filename[1024];
/* file 1 */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(H5Gcreate2(file, "/mnt1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(H5Gcreate2(file, "/mnt1/file1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(H5Gcreate2(file, "/mnt_unlink", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(H5Gcreate2(file, "/mnt_move_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_hard(file, "/mnt1/file1", H5L_SAME_LOC, "/file1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_hard(file, "/mnt1", H5L_SAME_LOC, "/mnt1_link", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(H5Gcreate2(file, "/mnt1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(H5Gcreate2(file, "/mnt1/file1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(H5Gcreate2(file, "/mnt_unlink", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(H5Gcreate2(file, "/mnt_move_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_hard(file, "/mnt1/file1", H5L_SAME_LOC, "/file1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_hard(file, "/mnt1", H5L_SAME_LOC, "/mnt1_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* file 2 */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(H5Gcreate2(file, "/file2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(H5Gcreate2(file, "/rename_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(H5Gcreate2(file, "/rename_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(H5Gcreate2(file, "/rename_a/x", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(H5Gcreate2(file, "/file2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(H5Gcreate2(file, "/rename_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(H5Gcreate2(file, "/rename_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(H5Gcreate2(file, "/rename_a/x", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* file 3 */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
return -1;
} /* end setup() */
-
/*-------------------------------------------------------------------------
* Function: test_basic
*
@@ -117,35 +121,42 @@ error:
static int
test_basic(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
- char filename1[1024], filename2[1024];
+ hid_t file1 = -1, file2 = -1, grp = -1;
+ char filename1[1024], filename2[1024];
TESTING("basic functionality");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if ((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grp) < 0)
+ FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1") < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
- if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Fclose(file1);
- H5Fclose(file2);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(file1);
+ H5Fclose(file2);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_basic() */
-
/*-------------------------------------------------------------------------
* Function: test_illegal
*
@@ -166,34 +177,32 @@ test_basic(hid_t fapl)
static int
test_illegal(hid_t fapl)
{
- hid_t file1 = -1, file1b = -1, file2 = -1, file3 = -1, file3b = -1, mnt = -1;
- char filename1[1024], filename2[1024], filename3[1024];
- herr_t status;
+ hid_t file1 = -1, file1b = -1, file2 = -1, file3 = -1, file3b = -1, mnt = -1;
+ char filename1[1024], filename2[1024], filename3[1024];
+ herr_t status;
TESTING("illegal mount operations");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
-
/* Open the files */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0 ||
- (file3 = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
- if((file1b = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
- if((file3b = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0 ||
+ (file3 = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((file1b = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((file3b = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Try mounting a file on itself */
- H5E_BEGIN_TRY {
- status = H5Fmount(file1, "/mnt1", file1, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Mounting a file on itself should have failed.");
- TEST_ERROR
+ H5E_BEGIN_TRY { status = H5Fmount(file1, "/mnt1", file1, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Mounting a file on itself should have failed.");
+ TEST_ERROR
} /* end if */
/*
@@ -201,18 +210,21 @@ test_illegal(hid_t fapl)
* point before we mount the first file or we'll end up mounting file3 at
* the root of file2 and the mount will succeed.
*/
- if((mnt = H5Gopen2(file1, "/mnt1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Fmount(mnt, ".", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Fmount(mnt, ".", file3, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Mounting two files at one mount point should have failed.");
- TEST_ERROR
+ if ((mnt = H5Gopen2(file1, "/mnt1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(mnt, ".", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { status = H5Fmount(mnt, ".", file3, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Mounting two files at one mount point should have failed.");
+ TEST_ERROR
} /* end if */
- if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR
- if(H5Gclose(mnt) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(mnt, ".") < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(mnt) < 0)
+ FAIL_STACK_ERROR
/*
* Try mounting the same file opened twice at the same place.
@@ -220,54 +232,64 @@ test_illegal(hid_t fapl)
* We have to open the mount point before we mount the first file or we'll
* end up mounting file3b at the root of file3 and the mount will succeed.
*/
- if((mnt = H5Gopen2(file1, "/mnt1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Fmount(mnt, ".", file3, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Fmount(mnt, ".", file3b, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Mounting same file opened twice at one mount point should have failed.");
- TEST_ERROR
+ if ((mnt = H5Gopen2(file1, "/mnt1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(mnt, ".", file3, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { status = H5Fmount(mnt, ".", file3b, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Mounting same file opened twice at one mount point should have failed.");
+ TEST_ERROR
} /* end if */
- if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR
- if(H5Gclose(mnt) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(mnt, ".") < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(mnt) < 0)
+ FAIL_STACK_ERROR
/* Try to create a "weak" cycle */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Fmount(file2, "/mnt1/file2", file1b, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Creating a cycle with mount points should have failed.");
- TEST_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { status = H5Fmount(file2, "/mnt1/file2", file1b, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Creating a cycle with mount points should have failed.");
+ TEST_ERROR
} /* end if */
- if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1") < 0)
+ FAIL_STACK_ERROR
/* Close everything and return */
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1b) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file3) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file3b) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1b) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file3) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file3b) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(mnt);
- H5Fclose(file1);
- H5Fclose(file1b);
- H5Fclose(file2);
- H5Fclose(file3);
- H5Fclose(file3b);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(mnt);
+ H5Fclose(file1);
+ H5Fclose(file1b);
+ H5Fclose(file2);
+ H5Fclose(file3);
+ H5Fclose(file3b);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_illegal() */
-
/*-------------------------------------------------------------------------
* Function: test_samefile
*
@@ -285,27 +307,26 @@ error:
static int
test_samefile(hid_t fapl)
{
- hid_t file1a = -1, file1b = -1, file2 = -1, file3 = -1;
- hid_t mnt1a = -1, mnt1b = -1;
- char filename1[1024], filename2[1024], filename3[1024];
- H5G_info_t grp_info;
- herr_t status;
+ hid_t file1a = -1, file1b = -1, file2 = -1, file3 = -1;
+ hid_t mnt1a = -1, mnt1b = -1;
+ char filename1[1024], filename2[1024], filename3[1024];
+ H5G_info_t grp_info;
+ herr_t status;
TESTING("same file mount operations");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
-
/* Open the files */
- if((file1a = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
- if((file1b = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
- if((file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
- if((file3 = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((file1a = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((file1b = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((file3 = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/*
* Try mounting different files at the same place in each of the "top"
@@ -314,22 +335,34 @@ test_samefile(hid_t fapl)
* We have to open the mount point before we mount the first file or we'll
* end up mounting file4 at the root of file3 and the mount will succeed.
*/
- if((mnt1a = H5Gopen2(file1a, "/mnt1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gget_info(mnt1a, &grp_info) < 0) FAIL_STACK_ERROR
- if(grp_info.mounted) FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.")
- if((mnt1b = H5Gopen2(file1b, "/mnt1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gget_info(mnt1b, &grp_info) < 0) FAIL_STACK_ERROR
- if(grp_info.mounted) FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.")
- if(H5Fmount(mnt1a, ".", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gget_info(mnt1a, &grp_info) < 0) FAIL_STACK_ERROR
- if(!grp_info.mounted) FAIL_PUTS_ERROR(" Group should have 'mounted' flag set.")
- H5E_BEGIN_TRY {
- status = H5Fmount(mnt1b, ".", file3, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) FAIL_PUTS_ERROR(" Mounting different files at one mount point should have failed.")
- if(H5Funmount(mnt1a, ".") < 0) FAIL_STACK_ERROR
- if(H5Gclose(mnt1a) < 0) FAIL_STACK_ERROR
- if(H5Gclose(mnt1b) < 0) FAIL_STACK_ERROR
+ if ((mnt1a = H5Gopen2(file1a, "/mnt1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gget_info(mnt1a, &grp_info) < 0)
+ FAIL_STACK_ERROR
+ if (grp_info.mounted)
+ FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.")
+ if ((mnt1b = H5Gopen2(file1b, "/mnt1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gget_info(mnt1b, &grp_info) < 0)
+ FAIL_STACK_ERROR
+ if (grp_info.mounted)
+ FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.")
+ if (H5Fmount(mnt1a, ".", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gget_info(mnt1a, &grp_info) < 0)
+ FAIL_STACK_ERROR
+ if (!grp_info.mounted)
+ FAIL_PUTS_ERROR(" Group should have 'mounted' flag set.")
+ H5E_BEGIN_TRY { status = H5Fmount(mnt1b, ".", file3, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0)
+ FAIL_PUTS_ERROR(" Mounting different files at one mount point should have failed.")
+ if (H5Funmount(mnt1a, ".") < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(mnt1a) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(mnt1b) < 0)
+ FAIL_STACK_ERROR
/*
* Try mounting same files at the same place in each of the "top"
@@ -338,46 +371,62 @@ test_samefile(hid_t fapl)
* We have to open the mount point before we mount the first file or we'll
* end up mounting file4 at the root of file3 and the mount will succeed.
*/
- if((mnt1a = H5Gopen2(file1a, "/mnt1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gget_info(mnt1a, &grp_info) < 0) FAIL_STACK_ERROR
- if(grp_info.mounted) FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.")
- if((mnt1b = H5Gopen2(file1b, "/mnt1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gget_info(mnt1b, &grp_info) < 0) FAIL_STACK_ERROR
- if(grp_info.mounted) FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.")
- if(H5Fmount(mnt1a, ".", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gget_info(mnt1a, &grp_info) < 0) FAIL_STACK_ERROR
- if(!grp_info.mounted) FAIL_PUTS_ERROR(" Group should have 'mounted' flag set.")
- H5E_BEGIN_TRY {
- status = H5Fmount(mnt1b, ".", file2, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) FAIL_PUTS_ERROR(" Mounting same files at one mount point should have failed.")
- if(H5Funmount(mnt1a, ".") < 0) FAIL_STACK_ERROR
- if(H5Gclose(mnt1a) < 0) FAIL_STACK_ERROR
- if(H5Gclose(mnt1b) < 0) FAIL_STACK_ERROR
-
+ if ((mnt1a = H5Gopen2(file1a, "/mnt1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gget_info(mnt1a, &grp_info) < 0)
+ FAIL_STACK_ERROR
+ if (grp_info.mounted)
+ FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.")
+ if ((mnt1b = H5Gopen2(file1b, "/mnt1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gget_info(mnt1b, &grp_info) < 0)
+ FAIL_STACK_ERROR
+ if (grp_info.mounted)
+ FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.")
+ if (H5Fmount(mnt1a, ".", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gget_info(mnt1a, &grp_info) < 0)
+ FAIL_STACK_ERROR
+ if (!grp_info.mounted)
+ FAIL_PUTS_ERROR(" Group should have 'mounted' flag set.")
+ H5E_BEGIN_TRY { status = H5Fmount(mnt1b, ".", file2, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0)
+ FAIL_PUTS_ERROR(" Mounting same files at one mount point should have failed.")
+ if (H5Funmount(mnt1a, ".") < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(mnt1a) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(mnt1b) < 0)
+ FAIL_STACK_ERROR
/* Close everything and return */
- if(H5Fclose(file1a) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1b) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file3) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file1a) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1b) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file3) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(mnt1a);
- H5Gclose(mnt1b);
- H5Fclose(file1a);
- H5Fclose(file1b);
- H5Fclose(file2);
- H5Fclose(file3);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(mnt1a);
+ H5Gclose(mnt1b);
+ H5Fclose(file1a);
+ H5Fclose(file1b);
+ H5Fclose(file2);
+ H5Fclose(file3);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_samefile() */
-
/*-------------------------------------------------------------------------
* Function: test_hide
*
@@ -399,32 +448,31 @@ error:
static int
test_hide(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
- H5O_info2_t oi1, oi2;
- char filename1[1024], filename2[1024];
- hbool_t same_obj;
+ hid_t file1 = -1, file2 = -1, grp = -1;
+ H5O_info2_t oi1, oi2;
+ char filename1[1024], filename2[1024];
+ hbool_t same_obj;
TESTING("name hiding under mount point");
h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1));
h5_fixname(FILENAME[1], fapl, filename2, sizeof(filename2));
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get information about file1:/mnt1/file1 for later */
- if(H5Oget_info_by_name3(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Build the virtual file */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Original names under file1:/mnt1 should not be accessible */
- H5E_BEGIN_TRY {
- grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT);
- } H5E_END_TRY;
- if(grp >= 0) {
+ H5E_BEGIN_TRY { grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (grp >= 0) {
H5_FAILED();
HDputs(" Name is still accessible under mount point.");
TEST_ERROR
@@ -434,45 +482,49 @@ test_hide(hid_t fapl)
* The original objects under file1:/mnt1 are still accessible by their
* other names. This is a rather stupid test but demonstrates a point.
*/
- if(H5Oget_info_by_name3(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
same_obj = TRUE;
- if(oi1.fileno == oi2.fileno) {
+ if (oi1.fileno == oi2.fileno) {
int token_cmp;
- if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
FAIL_STACK_ERROR
- if(token_cmp)
+ if (token_cmp)
same_obj = FALSE;
}
else
same_obj = FALSE;
- if(!same_obj) {
+ if (!same_obj) {
H5_FAILED();
HDputs(" Hard link failed for hidden object.");
TEST_ERROR
}
/* Unmount and close objects */
- if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1") < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(grp);
H5Fclose(file1);
H5Fclose(file2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_hide() */
-
/*-------------------------------------------------------------------------
* Function: test_assoc
*
@@ -493,70 +545,74 @@ error:
static int
test_assoc(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
- H5O_info2_t oi1, oi2;
- char filename1[1024], filename2[1024];
- hbool_t same_obj;
+ hid_t file1 = -1, file2 = -1;
+ H5O_info2_t oi1, oi2;
+ char filename1[1024], filename2[1024];
+ hbool_t same_obj;
TESTING("mount point open");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Open the files */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get information about the root of file2 */
- if(H5Oget_info3(file2, &oi1, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(file2, &oi1, H5O_INFO_BASIC) < 0)
FAIL_STACK_ERROR
/* Create the virtual file */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/*
* Get info about the mount point -- should be the same as the root group
* of file2.
*/
- if(H5Oget_info_by_name3(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
same_obj = TRUE;
- if(oi1.fileno == oi2.fileno) {
+ if (oi1.fileno == oi2.fileno) {
int token_cmp;
- if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
FAIL_STACK_ERROR
- if(token_cmp)
+ if (token_cmp)
same_obj = FALSE;
}
else
same_obj = FALSE;
- if(!same_obj) {
+ if (!same_obj) {
H5_FAILED();
HDputs(" Association failed.");
TEST_ERROR
} /* end if */
/* Shut down */
- if(H5Funmount(file1, "/mnt1_link") < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1_link") < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file2);
H5Fclose(file1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_assoc() */
-
/*-------------------------------------------------------------------------
* Function: test_mntlnk
*
@@ -578,47 +634,55 @@ error:
static int
test_mntlnk(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
- char filename1[1024], filename2[1024];
+ hid_t file1 = -1, file2 = -1, grp = -1;
+ char filename1[1024], filename2[1024];
TESTING("multi-linked mount point");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
-
/* Build the virtual file */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/*
* Can we see file2:/file2 as both file1:/mnt1/file2 and
* file1:/mnt1_link/file2?
*/
- if((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
- if((grp = H5Gopen2(file1, "/mnt1_link/file2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
+ if ((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grp) < 0)
+ FAIL_STACK_ERROR
+ if ((grp = H5Gopen2(file1, "/mnt1_link/file2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grp) < 0)
+ FAIL_STACK_ERROR
/* Unlink using second name */
- if(H5Funmount(file1, "/mnt1_link") < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1_link") < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(grp);
- H5Fclose(file1);
- H5Fclose(file2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(grp);
+ H5Fclose(file1);
+ H5Fclose(file2);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_mntlnk() */
-
/*-------------------------------------------------------------------------
* Function: test_move
*
@@ -640,48 +704,56 @@ error:
static int
test_move(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
- herr_t status;
- char filename1[1024], filename2[1024];
+ hid_t file1 = -1, file2 = -1;
+ herr_t status;
+ char filename1[1024], filename2[1024];
TESTING("object renaming");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* First rename an object in the mounted file, then try it across files */
- if(H5Lmove(file1, "/mnt1/rename_a/x", H5L_SAME_LOC, "/mnt1/rename_b/y", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Lmove(file1, "/mnt1/rename_b/y", H5L_SAME_LOC, "/y", H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Moving an object across files should't have been possible");
- TEST_ERROR
+ if (H5Lmove(file1, "/mnt1/rename_a/x", H5L_SAME_LOC, "/mnt1/rename_b/y", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY
+ {
+ status = H5Lmove(file1, "/mnt1/rename_b/y", H5L_SAME_LOC, "/y", H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Moving an object across files should't have been possible");
+ TEST_ERROR
} /* end if */
/* Shut down */
- if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1") < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file1);
- H5Fclose(file2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(file1);
+ H5Fclose(file2);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_move() */
-
/*-------------------------------------------------------------------------
* Function: test_preopen
*
@@ -702,46 +774,54 @@ error:
static int
test_preopen(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
+ hid_t file1 = -1, file2 = -1, grp = -1;
H5O_info2_t oinfo;
- char filename1[1024], filename2[1024];
+ char filename1[1024], filename2[1024];
TESTING("preopening objects under the mount point");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Open something under the mount point */
- if((grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Build the virtual file */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Now access the thing we previously opened */
- if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if (H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0)
+ FAIL_STACK_ERROR
/* Shut down */
- if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
- if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1") < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grp) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(grp);
- H5Fclose(file2);
- H5Fclose(file1);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(grp);
+ H5Fclose(file2);
+ H5Fclose(file1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_preopen() */
-
/*-------------------------------------------------------------------------
* Function: test_postopen
*
@@ -764,50 +844,59 @@ static int
test_postopen(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
+ hid_t file1 = -1, file2 = -1, grp = -1;
H5O_info2_t oinfo;
- char filename1[1024], filename2[1024];
+ char filename1[1024], filename2[1024];
TESTING("open object access after unmount");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Create the virtual file */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open some object in the mounted file */
- if((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Unmount the file */
- if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1") < 0)
+ FAIL_STACK_ERROR
/* Now access the thing we previously opened */
- if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if (H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0)
+ FAIL_STACK_ERROR
/* Try accessing it from the file */
- if(H5Oget_info_by_name3(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Shut down */
- if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(grp) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(grp);
- H5Fclose(file2);
- H5Fclose(file1);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(grp);
+ H5Fclose(file2);
+ H5Fclose(file1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_postopen() */
-
/*-------------------------------------------------------------------------
* Function: test_unlink
*
@@ -829,28 +918,31 @@ error:
static int
test_unlink(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, mnt = -1, root = -1;
+ hid_t file1 = -1, file2 = -1, mnt = -1, root = -1;
H5O_info2_t oinfo;
- char filename1[1024], filename2[1024];
- herr_t status;
+ char filename1[1024], filename2[1024];
+ herr_t status;
TESTING("mount point unlinking");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Open files */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/*
* Opening the mount point before mounting opens the group in the parent
* file, but opening the mount point after mounting is the same as
* opening the root group of the child file.
*/
- if((mnt = H5Gopen2(file1, "/mnt_unlink", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt_unlink", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if((root = H5Gopen2(file1, "/mnt_unlink", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((mnt = H5Gopen2(file1, "/mnt_unlink", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt_unlink", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if ((root = H5Gopen2(file1, "/mnt_unlink", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/*
* "/file2" of file2 should be visible as an absolute name through either
@@ -858,42 +950,48 @@ test_unlink(hid_t fapl)
* before the H5Fmount() and thus refers to the mount point itself rather
* than the group mounted there.
*/
- if(H5Oget_info_by_name3(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Incorrect traversal from mount point!");
- TEST_ERROR
+ if (H5Oget_info_by_name3(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Incorrect traversal from mount point!");
+ TEST_ERROR
} /* end if */
/* Unlink the mount point */
- if(H5Ldelete(file1, "/mnt_unlink", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file1, "/mnt_unlink", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/*
* We should still be able to get to "/file2" of file2 by starting at
* `root' which is still open, but not by name.
*/
- if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Traversal through mount point should not have worked!");
- TEST_ERROR
+ if (H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Traversal through mount point should not have worked!");
+ TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- status = H5Oget_info_by_name3(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Traversal through mount point should not have worked!");
- TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ status = H5Oget_info_by_name3(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Traversal through mount point should not have worked!");
+ TEST_ERROR
} /* end if */
/*
@@ -901,44 +999,48 @@ test_unlink(hid_t fapl)
* the mount point because the name doesn't exist anymore. We must
* supply the mount point directly.
*/
- H5E_BEGIN_TRY {
- status = H5Funmount(file1, "/mnt_unlink");
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
- TEST_ERROR
+ H5E_BEGIN_TRY { status = H5Funmount(file1, "/mnt_unlink"); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDprintf(" %d: Unmount by name should not have been allowed!\n", __LINE__);
+ TEST_ERROR
} /* end if */
- H5E_BEGIN_TRY {
- status = H5Funmount(file2, "/");
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
- TEST_ERROR
+ H5E_BEGIN_TRY { status = H5Funmount(file2, "/"); }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDprintf(" %d: Unmount by name should not have been allowed!\n", __LINE__);
+ TEST_ERROR
} /* end if */
- if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR
+ if (H5Funmount(mnt, ".") < 0)
+ FAIL_STACK_ERROR
/* Close files */
- if(H5Gclose(mnt) < 0) FAIL_STACK_ERROR
- if(H5Gclose(root) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(mnt) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(root) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(mnt);
- H5Gclose(root);
- H5Fclose(file2);
- H5Fclose(file1);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(mnt);
+ H5Gclose(root);
+ H5Fclose(file2);
+ H5Fclose(file1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_unlink() */
-
/*-------------------------------------------------------------------------
* Function: test_mvmpt
*
@@ -958,43 +1060,50 @@ error:
static int
test_mvmpt(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
- H5O_info2_t oinfo;
- char filename1[1024], filename2[1024];
+ hid_t file1 = -1, file2 = -1;
+ H5O_info2_t oinfo;
+ char filename1[1024], filename2[1024];
TESTING("mount point renaming");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt_move_a", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt_move_a", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Rename the mount point */
- if(H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Access something under the new name */
- if(H5Oget_info_by_name3(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Shut down */
- if(H5Funmount(file1, "/mnt_move_b") < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt_move_b") < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file1);
- H5Fclose(file2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(file1);
+ H5Fclose(file2);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_mvmpt() */
-
/*-------------------------------------------------------------------------
* Function: test_interlink
*
@@ -1014,42 +1123,47 @@ error:
static int
test_interlink(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
+ hid_t file1 = -1, file2 = -1;
#ifdef NOT_NOW
- hid_t type = -1, space = -1, dset = -1;
- hsize_t cur_dims[1] = {2};
+ hid_t type = -1, space = -1, dset = -1;
+ hsize_t cur_dims[1] = {2};
#endif /* NOT_NOW */
- char filename1[1024], filename2[1024];
- herr_t status;
+ char filename1[1024], filename2[1024];
+ herr_t status;
TESTING("interfile hard links");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Try an interfile hard link directly */
- H5E_BEGIN_TRY {
- status = H5Lcreate_hard(file1, "/mnt1/file2", H5L_SAME_LOC, "/file2", H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Interfile hard link should not have been allowed!");
- TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ status = H5Lcreate_hard(file1, "/mnt1/file2", H5L_SAME_LOC, "/file2", H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Interfile hard link should not have been allowed!");
+ TEST_ERROR
} /* end if */
/* Try an interfile hard link by renaming something */
- H5E_BEGIN_TRY {
- status = H5Lmove(file1, "/mnt1/file2", H5L_SAME_LOC, "/file2", H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) {
- H5_FAILED();
- HDputs(" Interfile renaming should not have been allowed!");
- TEST_ERROR
+ H5E_BEGIN_TRY
+ {
+ status = H5Lmove(file1, "/mnt1/file2", H5L_SAME_LOC, "/file2", H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ HDputs(" Interfile renaming should not have been allowed!");
+ TEST_ERROR
} /* end if */
/* Commented this code out until Jira issue #7638 is resolved. Once that
@@ -1058,48 +1172,59 @@ test_interlink(hid_t fapl)
*/
#ifdef NOT_NOW
/* Try an interfile hard link by sharing a data type */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
- if(H5Tcommit2(file1, "/type1", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if((space = H5Screate_simple(1, cur_dims, NULL)) < 0) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- dset = H5Dcreate2(file1, "/mnt1/file2/dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dset >= 0) {
- H5_FAILED();
- HDputs(" Dataset and shared type must be in the same file!");
- TEST_ERROR
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tcommit2(file1, "/type1", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if ((space = H5Screate_simple(1, cur_dims, NULL)) < 0)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY
+ {
+ dset = H5Dcreate2(file1, "/mnt1/file2/dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
+ if (dset >= 0) {
+ H5_FAILED();
+ HDputs(" Dataset and shared type must be in the same file!");
+ TEST_ERROR
} /* end if */
/* Close IDs */
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
-#else /* NOT_NOW */
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
+#else /* NOT_NOW */
SKIPPED();
HDputs(" Test skipped due file pointer sharing issue (Jira 7638).");
#endif /* NOT_NOW */
/* Shut down */
- if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1") < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
#ifdef NOT_NOW
- H5Dclose(dset);
- H5Sclose(space);
- H5Tclose(type);
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Tclose(type);
#endif /* NOT_NOW */
- H5Fclose(file1);
- H5Fclose(file2);
- } H5E_END_TRY;
+ H5Fclose(file1);
+ H5Fclose(file2);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_interlink() */
-
/*-------------------------------------------------------------------------
* Function: test_uniformity
*
@@ -1120,51 +1245,66 @@ error:
static int
test_uniformity(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
+ hid_t file1 = -1, file2 = -1;
H5O_info2_t oinfo;
- char filename1[1024], filename2[1024];
+ char filename1[1024], filename2[1024];
TESTING("file handle uniformity");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Access some things from the file1 handle */
- if(H5Oget_info_by_name3(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Access the same things from the file2 handle */
- if(H5Oget_info_by_name3(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Shut down */
- if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Funmount(file1, "/mnt1") < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file1);
- H5Fclose(file2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(file1);
+ H5Fclose(file2);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_uniformity() */
-
/*-------------------------------------------------------------------------
* Function: test_close
*
@@ -1184,66 +1324,76 @@ error:
static int
test_close(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
+ hid_t file1 = -1, file2 = -1;
H5O_info2_t oinfo;
- char filename1[1024], filename2[1024];
+ char filename1[1024], filename2[1024];
TESTING("file handle close");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/*
* Close file1 unmounting it from the virtual file. Objects in file1 are
* still accessible through the file2 handle.
*/
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
- H5_FAILED();
- HDputs(" File1 contents are not accessible!");
- TEST_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ H5_FAILED();
+ HDputs(" File1 contents are not accessible!");
+ TEST_ERROR
} /* end if */
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ if (H5I_nmembers(H5I_FILE) != 0)
+ TEST_ERROR
H5F_sfile_assert_num(0);
/* Build the virtual file again */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
- (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
+ (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/*
* Close file2. It is not actually closed because it's a child of file1.
*/
- if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file1) < 0)
+ FAIL_STACK_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ if (H5I_nmembers(H5I_FILE) != 0)
+ TEST_ERROR
H5F_sfile_assert_num(0);
/* Shut down */
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Fclose(file1);
- H5Fclose(file2);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(file1);
+ H5Fclose(file2);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_close() */
-
/*-------------------------------------------------------------------------
* Function: test_mount_after_close
*
@@ -1264,25 +1414,25 @@ test_close(hid_t fapl)
static int
test_mount_after_close(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidAB = -1, gidABM = -1, gidX = -1, gidXY = -1; /* Group identifiers */
- hid_t gidABMX = -1, gidABC = -1, gidABT = -1; /* Group IDs for testing */
- hid_t didABMXYD = -1; /* Dataset ID for testing */
- hid_t did = -1, sid = -1; /* Dataset and dataspace identifiers */
- char filename1[1024], filename2[1024]; /* Name of files to mount */
- char objname[NAME_BUF_SIZE]; /* Name of object opened */
- hsize_t dims[] = {NX,NY}; /* Dataset dimensions */
- int i, j; /* Local index variable */
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gidA = -1, gidAB = -1, gidABM = -1, gidX = -1, gidXY = -1; /* Group identifiers */
+ hid_t gidABMX = -1, gidABC = -1, gidABT = -1; /* Group IDs for testing */
+ hid_t didABMXYD = -1; /* Dataset ID for testing */
+ hid_t did = -1, sid = -1; /* Dataset and dataspace identifiers */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
+ char objname[NAME_BUF_SIZE]; /* Name of object opened */
+ hsize_t dims[] = {NX, NY}; /* Dataset dimensions */
+ int i, j; /* Local index variable */
TESTING("mounting on group after file is closed");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/*
- * Initialization of buffer matrix "bm"
- */
- for(i =0; i < NX; i++)
- for(j = 0; j < NY; j++)
+ * Initialization of buffer matrix "bm"
+ */
+ for (i = 0; i < NX; i++)
+ for (j = 0; j < NY; j++)
bm[i][j] = i + j;
/* Create first file and a groups in it. */
@@ -1293,146 +1443,192 @@ test_mount_after_close(hid_t fapl)
/A/B/M Group
/A/B/T -> /A
*/
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((gidAB = H5Gcreate2(gidA, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((gidAB = H5Gcreate2(gidA, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Mount point */
- if((gidABM = H5Gcreate2(gidAB, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gidABM = H5Gcreate2(gidAB, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Soft link */
- if(H5Lcreate_soft("./M/X/Y", gidAB, "C", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("./M/X/Y", gidAB, "C", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Soft link */
- if(H5Lcreate_soft("/A", gidAB, "T", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/A", gidAB, "T", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close groups and file */
- if(H5Gclose(gidABM) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gidAB) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gidA) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR
-
- /* Create second file and dataset "D" in it. */
- /* h5ls shows: */
- /* /X Group
- /X/T -> ./Y
- /X/Y Group
- /X/Y/D Dataset {4, 5}
- */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gidABM) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gidAB) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gidA) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create second file and dataset "D" in it. */
+ /* h5ls shows: */
+ /* /X Group
+ /X/T -> ./Y
+ /X/Y Group
+ /X/Y/D Dataset {4, 5}
+ */
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
dims[0] = NX;
dims[1] = NY;
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
- if((gidX = H5Gcreate2(fid2, "/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((gidXY = H5Gcreate2(gidX, "Y", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((did = H5Dcreate2(gidXY, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gidX = H5Gcreate2(fid2, "/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((gidXY = H5Gcreate2(gidX, "Y", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((did = H5Dcreate2(gidXY, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Soft link */
- if(H5Lcreate_soft("./Y", gidX, "T", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("./Y", gidX, "T", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Write data to the dataset. */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm) < 0)
+ FAIL_STACK_ERROR
/* Close all identifiers. */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gidXY) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gidX) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gidXY) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gidX) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
-/* Beginning of the actual test code */
+ /* Beginning of the actual test code */
- /*
- * Reopen both files
- */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
- /*
- * Open /A/B to use as a mount point
- */
- if((gidAB = H5Gopen2(fid1, "/A/B", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /*
+ * Reopen both files
+ */
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+ /*
+ * Open /A/B to use as a mount point
+ */
+ if ((gidAB = H5Gopen2(fid1, "/A/B", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- /*
- * Close the parent file. This keeps the file open because of the other handle on the group within
- */
+ /*
+ * Close the parent file. This keeps the file open because of the other handle on the group within
+ */
/* We close the file (it should stay open from the group) */
- if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
- /*
- * Mount second file under G in the first file.
- */
- if(H5Fmount(gidAB, "M", fid2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ /*
+ * Mount second file under G in the first file.
+ */
+ if (H5Fmount(gidAB, "M", fid2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open "normal" group in mounted file */
/* (This shows we successfully mounted) */
- if((gidABMX = H5Gopen2(gidAB, "M/X", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gidABMX = H5Gopen2(gidAB, "M/X", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
*objname = '\0';
- if(H5Iget_name(gidABMX, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(objname, "/A/B/M/X")) TEST_ERROR
+ if (H5Iget_name(gidABMX, objname, (size_t)NAME_BUF_SIZE) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(objname, "/A/B/M/X"))
+ TEST_ERROR
/* Close object in mounted file */
- if(H5Gclose(gidABMX) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gidABMX) < 0)
+ FAIL_STACK_ERROR
/* Open group in mounted file through softlink */
- if((gidABC = H5Gopen2(gidAB, "C", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gidABC = H5Gopen2(gidAB, "C", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
*objname = '\0';
- if(H5Iget_name(gidABC, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR
+ if (H5Iget_name(gidABC, objname, (size_t)NAME_BUF_SIZE) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(objname, "/A/B/C"))
+ TEST_ERROR
/* Close object in mounted file */
- if(H5Gclose(gidABC) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gidABC) < 0)
+ FAIL_STACK_ERROR
/* Open group in original file through softlink */
- if((gidABT = H5Gopen2(gidAB, "T", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gidABT = H5Gopen2(gidAB, "T", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
*objname = '\0';
- if(H5Iget_name(gidABT, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(objname, "/A/B/T")) TEST_ERROR
+ if (H5Iget_name(gidABT, objname, (size_t)NAME_BUF_SIZE) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(objname, "/A/B/T"))
+ TEST_ERROR
/* Close object in original file */
- if(H5Gclose(gidABT) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gidABT) < 0)
+ FAIL_STACK_ERROR
/* Open "normal" dataset in mounted file */
- if((didABMXYD = H5Dopen2(gidAB, "M/X/Y/D", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((didABMXYD = H5Dopen2(gidAB, "M/X/Y/D", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check name */
*objname = '\0';
- if(H5Iget_name(didABMXYD, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(objname, "/A/B/M/X/Y/D")) TEST_ERROR
+ if (H5Iget_name(didABMXYD, objname, (size_t)NAME_BUF_SIZE) < 0)
+ FAIL_STACK_ERROR
+ if (HDstrcmp(objname, "/A/B/M/X/Y/D"))
+ TEST_ERROR
/* Close object in mounted file */
- if(H5Dclose(didABMXYD) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(didABMXYD) < 0)
+ FAIL_STACK_ERROR
- if(H5Gclose(gidAB) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gidAB) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
/* Shut down */
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Sclose(sid);
- H5Dclose(did);
- H5Gclose(didABMXYD);
- H5Gclose(gidABT);
- H5Gclose(gidABC);
- H5Gclose(gidABMX);
- H5Gclose(gidXY);
- H5Gclose(gidX);
- H5Gclose(gidABM);
- H5Gclose(gidAB);
- H5Gclose(gidA);
- H5Fclose(fid1);
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Gclose(didABMXYD);
+ H5Gclose(gidABT);
+ H5Gclose(gidABC);
+ H5Gclose(gidABMX);
+ H5Gclose(gidXY);
+ H5Gclose(gidX);
+ H5Gclose(gidABM);
+ H5Gclose(gidAB);
+ H5Gclose(gidA);
+ H5Fclose(fid1);
H5Fclose(fid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_mount_after_close() */
-
/*-------------------------------------------------------------------------
* Function: test_mount_after_unmount
*
@@ -1453,21 +1649,18 @@ error:
static int
test_mount_after_unmount(hid_t fapl)
{
- hid_t fid1=-1, fid2=-1, fid3=-1, fid4=-1; /* File IDs */
- hid_t gidA=-1, gidB=-1, gidX=-1, gidY=-1, gidZ=-1; /* Group identifiers */
- hid_t gidBM=-1; /* Group identifiers */
- hid_t gidBMZ=-1; /* Group identifiers */
- hid_t gidAM=-1; /* Group identifiers */
- hid_t gidAMX=-1; /* Group identifiers */
- hid_t gidAMXX=-1; /* Group identifiers */
- hid_t gidAMXMY=-1; /* Group identifiers */
- hid_t gidXM=-1; /* Group identifiers */
- hid_t gidXX=-1; /* Group identifiers */
- char filename1[1024],
- filename2[1024],
- filename3[1024],
- filename4[1024]; /* Name of files to mount */
- char objname[NAME_BUF_SIZE]; /* Name of object opened */
+ hid_t fid1 = -1, fid2 = -1, fid3 = -1, fid4 = -1; /* File IDs */
+ hid_t gidA = -1, gidB = -1, gidX = -1, gidY = -1, gidZ = -1; /* Group identifiers */
+ hid_t gidBM = -1; /* Group identifiers */
+ hid_t gidBMZ = -1; /* Group identifiers */
+ hid_t gidAM = -1; /* Group identifiers */
+ hid_t gidAMX = -1; /* Group identifiers */
+ hid_t gidAMXX = -1; /* Group identifiers */
+ hid_t gidAMXMY = -1; /* Group identifiers */
+ hid_t gidXM = -1; /* Group identifiers */
+ hid_t gidXX = -1; /* Group identifiers */
+ char filename1[1024], filename2[1024], filename3[1024], filename4[1024]; /* Name of files to mount */
+ char objname[NAME_BUF_SIZE]; /* Name of object opened */
TESTING("mounting after file is unmounted");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
@@ -1476,205 +1669,204 @@ test_mount_after_unmount(hid_t fapl)
h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4);
/* Create first file and some groups in it. */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidAM = H5Gcreate2(gidA, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gcreate2(gidA, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidBM = H5Gcreate2(gidB, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidBM = H5Gcreate2(gidB, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidBM) < 0)
+ if (H5Gclose(gidBM) < 0)
TEST_ERROR
- if(H5Gclose(gidB) < 0)
+ if (H5Gclose(gidB) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
- /* Create second file and a group in it. */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Create second file and a group in it. */
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if((gidX = H5Gcreate2(fid2, "/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidX = H5Gcreate2(fid2, "/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidXM = H5Gcreate2(gidX, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidXM = H5Gcreate2(gidX, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidXM) < 0)
+ if (H5Gclose(gidXM) < 0)
TEST_ERROR
- if((gidXX = H5Gcreate2(gidX, "X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidXX = H5Gcreate2(gidX, "X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidXX) < 0)
+ if (H5Gclose(gidXX) < 0)
TEST_ERROR
- if(H5Gclose(gidX) < 0)
+ if (H5Gclose(gidX) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
- /* Create third file and a group in it. */
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Create third file and a group in it. */
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if((gidY = H5Gcreate2(fid3, "/Y", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidY = H5Gcreate2(fid3, "/Y", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidY) < 0)
+ if (H5Gclose(gidY) < 0)
TEST_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
- /* Create fourth file and a group in it. */
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Create fourth file and a group in it. */
+ if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if((gidZ = H5Gcreate2(fid4, "/Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidZ = H5Gcreate2(fid4, "/Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidZ) < 0)
+ if (H5Gclose(gidZ) < 0)
TEST_ERROR
- if(H5Fclose(fid4) < 0)
+ if (H5Fclose(fid4) < 0)
TEST_ERROR
+ /* Beginning of the actual test code */
-/* Beginning of the actual test code */
-
- /*
- * Reopen all three files
- */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ /*
+ * Reopen all three files
+ */
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((fid3 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid3 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- /*
- * Open /A & /B to use as a mount points
- */
- if((gidA = H5Gopen2(fid1, "/A", H5P_DEFAULT)) < 0)
+ /*
+ * Open /A & /B to use as a mount points
+ */
+ if ((gidA = H5Gopen2(fid1, "/A", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidB = H5Gopen2(fid1, "/B", H5P_DEFAULT)) < 0)
+ if ((gidB = H5Gopen2(fid1, "/B", H5P_DEFAULT)) < 0)
TEST_ERROR
- /*
- * Mount second file on /A/M in the first file.
- */
- if(H5Fmount(gidA, "M", fid2, H5P_DEFAULT) < 0)
+ /*
+ * Mount second file on /A/M in the first file.
+ */
+ if (H5Fmount(gidA, "M", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open group in mounted file */
/* (This shows we successfully mounted) */
- if((gidAMXX = H5Gopen2(gidA, "M/X/X", H5P_DEFAULT)) < 0)
+ if ((gidAMXX = H5Gopen2(gidA, "M/X/X", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name */
*objname = '\0';
- if(H5Iget_name( gidAMXX, objname, (size_t)NAME_BUF_SIZE ) < 0)
+ if (H5Iget_name(gidAMXX, objname, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(objname, "/A/M/X/X"))
+ if (HDstrcmp(objname, "/A/M/X/X"))
TEST_ERROR
/* Open group in mounted file #2 */
- if((gidAMX = H5Gopen2(gidA, "M/X", H5P_DEFAULT)) < 0)
+ if ((gidAMX = H5Gopen2(gidA, "M/X", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount third file */
- if(H5Fmount(gidAMX, "M", fid3, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidAMX, "M", fid3, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open group in mounted file #3 */
/* (This shows we successfully mounted) */
- if((gidAMXMY = H5Gopen2(gidAMX, "M/Y", H5P_DEFAULT)) < 0)
+ if ((gidAMXMY = H5Gopen2(gidAMX, "M/Y", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name */
*objname = '\0';
- if(H5Iget_name( gidAMXMY, objname, (size_t)NAME_BUF_SIZE ) < 0)
+ if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(objname, "/A/M/X/M/Y"))
+ if (HDstrcmp(objname, "/A/M/X/M/Y"))
TEST_ERROR
/* Unmount second file */
- if(H5Funmount(fid1, "/A/M") < 0)
- TEST_ERROR
+ if (H5Funmount(fid1, "/A/M") < 0)
+ TEST_ERROR
/* Check name */
*objname = '\0';
- if(H5Iget_name( gidAMXMY, objname, (size_t)NAME_BUF_SIZE ) < 0)
+ if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(objname, "/X/M/Y"))
+ if (HDstrcmp(objname, "/X/M/Y"))
TEST_ERROR
/* Rename object in file #3 that is "disconnected" from name hiearchy */
/* (It is "disconnected" because it's parent file has been unmounted) */
- if(H5Lmove(gidAMX,"M/Y",gidAMX,"M/Z", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if (H5Lmove(gidAMX, "M/Y", gidAMX, "M/Z", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close group in file #3 */
- if(H5Gclose(gidAMXMY) < 0)
- TEST_ERROR
+ if (H5Gclose(gidAMXMY) < 0)
+ TEST_ERROR
/* Re-open group in file #3 */
- if((gidAMXMY = H5Gopen2(gidAMX, "M/Z", H5P_DEFAULT)) < 0)
+ if ((gidAMXMY = H5Gopen2(gidAMX, "M/Z", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name again */
*objname = '\0';
- if(H5Iget_name( gidAMXMY, objname, (size_t)NAME_BUF_SIZE ) < 0)
- TEST_ERROR
- if(HDstrcmp(objname, "/X/M/Z"))
- TEST_ERROR
+ if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, "/X/M/Z"))
+ TEST_ERROR
/* Mount fourth file */
- if(H5Fmount(gidB, "M", fid4, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidB, "M", fid4, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open group in mounted file */
/* (This shows we successfully mounted) */
- if((gidBMZ = H5Gopen2(gidB, "M/Z", H5P_DEFAULT)) < 0)
+ if ((gidBMZ = H5Gopen2(gidB, "M/Z", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name */
*objname = '\0';
- if(H5Iget_name( gidBMZ, objname, (size_t)NAME_BUF_SIZE ) < 0)
+ if (H5Iget_name(gidBMZ, objname, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(objname, "/B/M/Z"))
+ if (HDstrcmp(objname, "/B/M/Z"))
TEST_ERROR
/* Unmount third file */
if (H5Funmount(fid2, "/X/M") < 0)
- TEST_ERROR
+ TEST_ERROR
/* Unmount fourth file */
if (H5Funmount(fid1, "/B/M") < 0)
- TEST_ERROR
+ TEST_ERROR
/* Close objects in mounted files */
- if(H5Gclose(gidBMZ) < 0)
- TEST_ERROR
- if(H5Gclose(gidAMXMY) < 0)
- TEST_ERROR
- if(H5Gclose(gidAMXX) < 0)
- TEST_ERROR
- if(H5Gclose(gidAMX) < 0)
- TEST_ERROR
+ if (H5Gclose(gidBMZ) < 0)
+ TEST_ERROR
+ if (H5Gclose(gidAMXMY) < 0)
+ TEST_ERROR
+ if (H5Gclose(gidAMXX) < 0)
+ TEST_ERROR
+ if (H5Gclose(gidAMX) < 0)
+ TEST_ERROR
/* Close objects in original file */
- if(H5Gclose(gidB) < 0)
- TEST_ERROR
- if(H5Gclose(gidA) < 0)
- TEST_ERROR
+ if (H5Gclose(gidB) < 0)
+ TEST_ERROR
+ if (H5Gclose(gidA) < 0)
+ TEST_ERROR
/* Close files */
- if(H5Fclose(fid4) < 0)
+ if (H5Fclose(fid4) < 0)
TEST_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
/* Shut down */
@@ -1682,29 +1874,30 @@ test_mount_after_unmount(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidZ);
- H5Gclose(gidY);
- H5Gclose(gidXX);
- H5Gclose(gidXM);
- H5Gclose(gidX);
- H5Gclose(gidBMZ);
- H5Gclose(gidBM);
- H5Gclose(gidB);
- H5Gclose(gidAMXMY);
- H5Gclose(gidAMXX);
- H5Gclose(gidAMX);
- H5Gclose(gidAM);
- H5Gclose(gidA);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidZ);
+ H5Gclose(gidY);
+ H5Gclose(gidXX);
+ H5Gclose(gidXM);
+ H5Gclose(gidX);
+ H5Gclose(gidBMZ);
+ H5Gclose(gidBM);
+ H5Gclose(gidB);
+ H5Gclose(gidAMXMY);
+ H5Gclose(gidAMXX);
+ H5Gclose(gidAMX);
+ H5Gclose(gidAM);
+ H5Gclose(gidA);
H5Fclose(fid4);
H5Fclose(fid3);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_missing_unmount
*
@@ -1725,12 +1918,10 @@ error:
static int
test_missing_unmount(hid_t fapl)
{
- hid_t fid1=-1, fid2=-1, fid3=-1; /* File IDs */
- hid_t gidA=-1, gidE=-1, gidM=-1; /* Group IDs */
- hid_t gidAE=-1, gidAEM=-1; /* Group IDs */
- char filename1[1024],
- filename2[1024],
- filename3[1024]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
+ hid_t gidA = -1, gidE = -1, gidM = -1; /* Group IDs */
+ hid_t gidAE = -1, gidAEM = -1; /* Group IDs */
+ char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
TESTING("missing unmount");
@@ -1739,107 +1930,104 @@ test_missing_unmount(hid_t fapl)
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidE = H5Gcreate2(fid2, "E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidE = H5Gcreate2(fid2, "E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidE) < 0)
+ if (H5Gclose(gidE) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Create file #3 */
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid3, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid3, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
-
/* Re-open files and mount file #2 in file #1 and file #3 in file #2 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open group in mounted file */
- if((gidAE = H5Gopen2(fid2, "A/E", H5P_DEFAULT)) < 0)
+ if ((gidAE = H5Gopen2(fid2, "A/E", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
- if((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(gidAE, ".", fid3, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidAE, ".", fid3, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open group in mounted file */
- if((gidAEM = H5Gopen2(fid3, "A/E/M", H5P_DEFAULT)) < 0)
+ if ((gidAEM = H5Gopen2(fid3, "A/E/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #3 */
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
/* (Still have all file #2 & #3 mounted and groups open in all three files) */
/* Unmount file #2 & #3 */
- if(H5Funmount(gidAE,".") < 0)
+ if (H5Funmount(gidAE, ".") < 0)
TEST_ERROR
/* Skip unmounting file #2 from file #1 */
/* Close groups in mounted file */
- if(H5Gclose(gidAEM) < 0)
+ if (H5Gclose(gidAEM) < 0)
TEST_ERROR
- if(H5Gclose(gidAE) < 0)
+ if (H5Gclose(gidAE) < 0)
TEST_ERROR
/* Close group in top file */
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -1847,20 +2035,21 @@ test_missing_unmount(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidM);
- H5Gclose(gidE);
- H5Gclose(gidAEM);
- H5Gclose(gidAE);
- H5Gclose(gidA);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidM);
+ H5Gclose(gidE);
+ H5Gclose(gidAEM);
+ H5Gclose(gidAE);
+ H5Gclose(gidA);
H5Fclose(fid3);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_missing_unmount() */
-
/*-------------------------------------------------------------------------
* Function: test_hold_open_file
*
@@ -1881,10 +2070,9 @@ error:
static int
test_hold_open_file(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
- char filename1[1024],
- filename2[1024]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("hold open w/file");
@@ -1892,89 +2080,87 @@ test_hold_open_file(hid_t fapl)
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Re-open files and mount file #2 in file #1 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
- if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Close group in mounted file */
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
/* Attempt to open group in mounted file */
/* (Should work because file is still mounted) */
- if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
/* Close group in mounted file */
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
/* Attempt to open group in mounted file */
/* (Should work because file is still mounted) */
- if((gidAM = H5Gopen2(gidA, "/A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(gidA, "/A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close group in mounted file */
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
/* Unmount file #2 */
- if(H5Funmount(gidA, ".") < 0)
+ if (H5Funmount(gidA, ".") < 0)
TEST_ERROR
/* Close group in top file */
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -1982,17 +2168,18 @@ test_hold_open_file(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidM);
- H5Gclose(gidAM);
- H5Gclose(gidA);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidM);
+ H5Gclose(gidAM);
+ H5Gclose(gidA);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_hold_open_file() */
-
/*-------------------------------------------------------------------------
* Function: test_hold_open_group
*
@@ -2013,10 +2200,9 @@ error:
static int
test_hold_open_group(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gid = -1, gidA = -1, gidM = -1, gidAM = -1, gidAM2 = -1; /* Group IDs */
- char filename1[1024],
- filename2[1024]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gid = -1, gidA = -1, gidM = -1, gidAM = -1, gidAM2 = -1; /* Group IDs */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("hold open w/group");
@@ -2024,113 +2210,111 @@ test_hold_open_group(hid_t fapl)
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Re-open files and mount file #2 in file #1 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
- if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Close group in parent file */
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
/* Keep fid1 & gidAM open, everything else closed */
/* Retry to opening group in mounted file */
/* (Should work because file is still mounted) */
- if((gidAM2 = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM2 = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close group in mounted file */
- if(H5Gclose(gidAM2) < 0)
+ if (H5Gclose(gidAM2) < 0)
TEST_ERROR
/* Close original group in mount file */
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
/* Attempt to open group in mounted file */
/* (Should work because file is still mounted) */
- if((gidAM2 = H5Gopen2(fid1, "/A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM2 = H5Gopen2(fid1, "/A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
/* Get ID of file #2 */
- if((fid2 = H5Iget_file_id(gidAM2)) < 0)
+ if ((fid2 = H5Iget_file_id(gidAM2)) < 0)
TEST_ERROR
/* Close group in mounted file */
- if(H5Gclose(gidAM2) < 0)
+ if (H5Gclose(gidAM2) < 0)
TEST_ERROR
/* Attempt to open group in mounted file */
/* (Should work because file is still mounted) */
- if((gidAM2 = H5Gopen2(fid2, "/A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM2 = H5Gopen2(fid2, "/A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Attempt to open group in parent file */
/* (Should work because files should be mounted together) */
- if((gid = H5Gopen2(gidAM2, "/", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(gidAM2, "/", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close group in mounted file */
- if(H5Gclose(gidAM2) < 0)
+ if (H5Gclose(gidAM2) < 0)
TEST_ERROR
/* Close group in parent file */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -2138,19 +2322,20 @@ test_hold_open_group(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidM);
- H5Gclose(gidAM);
- H5Gclose(gidAM2);
- H5Gclose(gidA);
- H5Gclose(gid);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidM);
+ H5Gclose(gidAM);
+ H5Gclose(gidAM2);
+ H5Gclose(gidA);
+ H5Gclose(gid);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_hold_open_group() */
-
/*-------------------------------------------------------------------------
* Function: test_fcdegree_same
*
@@ -2171,12 +2356,11 @@ error:
static int
test_fcdegree_same(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
- hid_t fapl_id = -1; /* FAPL IDs */
- herr_t ret; /* Generic return value */
- char filename1[1024],
- filename2[1024]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
+ hid_t fapl_id = -1; /* FAPL IDs */
+ herr_t ret; /* Generic return value */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("file close degrees must be same");
@@ -2184,98 +2368,95 @@ test_fcdegree_same(hid_t fapl)
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Re-open files and mount file #2 in file #1 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create FAPL & set file close degree for file #2 to be different */
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set file close mode to H5F_CLOSE_STRONG */
- if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG) < 0)
+ if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
TEST_ERROR
/* Try mounting file with different file close degree (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Fmount(gidA, ".", fid2, H5P_DEFAULT);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fmount(gidA, ".", fid2, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Set file close mode to H5F_CLOSE_WEAK */
- if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_WEAK) < 0)
+ if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_WEAK) < 0)
TEST_ERROR
/* Close file #2 & re-open with same file close degree as file #1 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
TEST_ERROR
/* Try mounting files again (should work now) */
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Verify opening group in mounted file */
- if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close group in mounted file */
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
/* Close group in parent file */
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
/* Close file #2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
/* Close FAPL ID */
- if(H5Pclose(fapl_id) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -2283,18 +2464,19 @@ test_fcdegree_same(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_id);
- H5Gclose(gidM);
- H5Gclose(gidAM);
- H5Gclose(gidA);
+ H5Gclose(gidM);
+ H5Gclose(gidAM);
+ H5Gclose(gidA);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_fcdegree_same() */
-
/*-------------------------------------------------------------------------
* Function: test_fcdegree_semi
*
@@ -2315,12 +2497,11 @@ error:
static int
test_fcdegree_semi(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
- hid_t fapl_id = -1; /* FAPL IDs */
- herr_t ret; /* Generic return value */
- char filename1[1024],
- filename2[1024]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
+ hid_t fapl_id = -1; /* FAPL IDs */
+ herr_t ret; /* Generic return value */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("'semi' file close degree");
@@ -2328,95 +2509,91 @@ test_fcdegree_semi(hid_t fapl)
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Create FAPL & set file close degree to be "semi" */
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set file close mode to H5F_CLOSE_SEMI */
- if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0)
+ if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0)
TEST_ERROR
/* Re-open files and mount file #2 in file #1 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl_id)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl_id)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
TEST_ERROR
/* Mount files together */
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Verify opening group in mounted file */
- if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #1 (should succeed, since file #2 is open still) */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
/* Try closing file #2 (should fail, since there are still objects open) */
- H5E_BEGIN_TRY {
- ret = H5Fclose(fid2);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fclose(fid2); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close group in parent file */
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
/* Try closing file #2 (should still fail, since there are still objects open in child file) */
- H5E_BEGIN_TRY {
- ret = H5Fclose(fid2);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fclose(fid2); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close group in mounted file */
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
/* Close file #2 (should succeed now) */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Close FAPL ID */
- if(H5Pclose(fapl_id) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -2424,18 +2601,19 @@ test_fcdegree_semi(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_id);
- H5Gclose(gidM);
- H5Gclose(gidAM);
- H5Gclose(gidA);
+ H5Gclose(gidM);
+ H5Gclose(gidAM);
+ H5Gclose(gidA);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_fcdegree_semi() */
-
/*-------------------------------------------------------------------------
* Function: test_fcdegree_strong
*
@@ -2456,13 +2634,12 @@ error:
static int
test_fcdegree_strong(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
- hid_t fapl_id = -1; /* FAPL IDs */
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
+ hid_t fapl_id = -1; /* FAPL IDs */
H5O_info2_t oinfo;
- char filename1[1024],
- filename2[1024]; /* Name of files to mount */
- herr_t ret; /* Generic return value */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
+ herr_t ret; /* Generic return value */
TESTING("'strong' file close degree");
@@ -2470,91 +2647,87 @@ test_fcdegree_strong(hid_t fapl)
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Create FAPL & set file close degree to be "strong" */
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR
/* Set file close mode to H5F_CLOSE_STRONG */
- if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG) < 0)
+ if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG) < 0)
TEST_ERROR
/* Re-open files and mount file #2 in file #1 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl_id)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl_id)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
TEST_ERROR
/* Mount files together */
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open group in mounted file */
- if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
/* Check that objects are still open */
- if(H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Close file #2 (should close open objects also) */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Check that objects are closed */
- H5E_BEGIN_TRY {
- ret = H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close FAPL ID */
- if(H5Pclose(fapl_id) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -2562,18 +2735,19 @@ test_fcdegree_strong(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_id);
- H5Gclose(gidM);
- H5Gclose(gidAM);
- H5Gclose(gidA);
+ H5Gclose(gidM);
+ H5Gclose(gidAM);
+ H5Gclose(gidA);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_fcdegree_strong() */
-
/*-------------------------------------------------------------------------
* Function: test_acc_perm
*
@@ -2596,13 +2770,11 @@ error:
static int
test_acc_perm(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t gidA = -1, gidB = -1, gidC = -1, gidM = -1, gidAM = -1, gidAMZ = -1; /* Group IDs */
- hid_t bad_id = -1; /* Bad ID from object create */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- char filename1[1024],
- filename2[1024],
- filename3[1024]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
+ hid_t gidA = -1, gidB = -1, gidC = -1, gidM = -1, gidAM = -1, gidAMZ = -1; /* Group IDs */
+ hid_t bad_id = -1; /* Bad ID from object create */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
TESTING("access permissions");
@@ -2611,152 +2783,145 @@ test_acc_perm(hid_t fapl)
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Re-open files and mount file #2 in file #1 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get and verify file name */
- if(H5Fget_name(gidA, name, NAME_BUF_SIZE) < 0)
+ if (H5Fget_name(gidA, name, NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(name, filename1) != 0)
+ if (HDstrcmp(name, filename1) != 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get and verify file name */
- if(H5Fget_name(fid2, name, NAME_BUF_SIZE) < 0)
+ if (H5Fget_name(fid2, name, NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(name, filename2) != 0)
+ if (HDstrcmp(name, filename2) != 0)
TEST_ERROR
/* Mount files together */
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Get and verify file name */
- if(H5Fget_name(fid2, name, NAME_BUF_SIZE) < 0)
+ if (H5Fget_name(fid2, name, NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(name, filename2) != 0)
+ if (HDstrcmp(name, filename2) != 0)
TEST_ERROR
/* Open group in mounted file */
- if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get and verify file name */
- if(H5Fget_name(gidAM, name, NAME_BUF_SIZE) < 0)
+ if (H5Fget_name(gidAM, name, NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(name, filename2) != 0)
+ if (HDstrcmp(name, filename2) != 0)
TEST_ERROR
/* Attempt to create objects in read only file (should fail) */
- H5E_BEGIN_TRY {
- bad_id = H5Gcreate2(gidAM, "Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(bad_id >= 0)
+ H5E_BEGIN_TRY { bad_id = H5Gcreate2(gidAM, "Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (bad_id >= 0)
TEST_ERROR
- H5E_BEGIN_TRY {
- bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(bad_id >= 0)
+ H5E_BEGIN_TRY { bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (bad_id >= 0)
TEST_ERROR
/* Attempt to create objects in read/write file (should succeed) */
- if((gidB = H5Gcreate2(fid2, "/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidB = H5Gcreate2(fid2, "/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidB) < 0)
+ if (H5Gclose(gidB) < 0)
TEST_ERROR
/* (Note that this object should get created in the "hidden" group for "A" in parent file) */
- if((gidC = H5Gcreate2(gidA, "C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidC = H5Gcreate2(gidA, "C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidC) < 0)
+ if (H5Gclose(gidC) < 0)
TEST_ERROR
/* Create file #3 (it will have R/W permissions) */
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount file #3 on file #2 */
- if(H5Fmount(gidAM, ".", fid3, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidAM, ".", fid3, H5P_DEFAULT) < 0)
TEST_ERROR
/* Attempt to create objects in read/write file (should succeed) */
- if((gidAMZ = H5Gcreate2(fid1, "/A/M/Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidAMZ = H5Gcreate2(fid1, "/A/M/Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get and verify file name */
- if(H5Fget_name(gidAMZ, name, NAME_BUF_SIZE) < 0)
+ if (H5Fget_name(gidAMZ, name, NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(name, filename3) != 0)
+ if (HDstrcmp(name, filename3) != 0)
TEST_ERROR
/* Close object in file #3 */
- if(H5Gclose(gidAMZ) < 0)
+ if (H5Gclose(gidAMZ) < 0)
TEST_ERROR
-
/* Attempt to create objects in read only file again (should fail) */
- H5E_BEGIN_TRY {
- bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(bad_id >= 0)
+ H5E_BEGIN_TRY { bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (bad_id >= 0)
TEST_ERROR
/* Close group in mounted file */
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
/* Close group in parent file */
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
/* Close file #3 */
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
/* Close file #2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -2764,21 +2929,22 @@ test_acc_perm(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidM);
- H5Gclose(gidAMZ);
- H5Gclose(gidAM);
- H5Gclose(gidC);
- H5Gclose(gidB);
- H5Gclose(gidA);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidM);
+ H5Gclose(gidAMZ);
+ H5Gclose(gidAM);
+ H5Gclose(gidC);
+ H5Gclose(gidB);
+ H5Gclose(gidA);
H5Fclose(fid3);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_acc_perm() */
-
/*-------------------------------------------------------------------------
* Function: test_mult_mount
*
@@ -2799,14 +2965,12 @@ error:
static int
test_mult_mount(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1, fid3_2 = -1; /* File IDs */
- hid_t gidA = -1, gidB = -1; /* Group IDs in file #1 */
- hid_t gidM = -1, gidN = -1, gidAM = -1; /* Group IDs in file #2 */
- hid_t gidS = -1, gidT = -1, gidU = -1, gidBS = -1, gidAMT = -1; /* Group IDs in file #3 */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- char filename1[1024],
- filename2[1024],
- filename3[1024]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1, fid3 = -1, fid3_2 = -1; /* File IDs */
+ hid_t gidA = -1, gidB = -1; /* Group IDs in file #1 */
+ hid_t gidM = -1, gidN = -1, gidAM = -1; /* Group IDs in file #2 */
+ hid_t gidS = -1, gidT = -1, gidU = -1, gidBS = -1, gidAMT = -1; /* Group IDs in file #3 */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
TESTING("multiple mounts");
@@ -2815,171 +2979,167 @@ test_mult_mount(hid_t fapl)
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidB) < 0)
+ if (H5Gclose(gidB) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if((gidN = H5Gcreate2(fid2, "N", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidN = H5Gcreate2(fid2, "N", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidN) < 0)
+ if (H5Gclose(gidN) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Create file #3 */
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidS = H5Gcreate2(fid3, "S", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidS = H5Gcreate2(fid3, "S", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidS) < 0)
+ if (H5Gclose(gidS) < 0)
TEST_ERROR
- if((gidT = H5Gcreate2(fid3, "T", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidT = H5Gcreate2(fid3, "T", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidT) < 0)
+ if (H5Gclose(gidT) < 0)
TEST_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
-
/* Re-open files and mount file #2 in file #1 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidB = H5Gopen2(fid1, "B", H5P_DEFAULT)) < 0)
+ if ((gidB = H5Gopen2(fid1, "B", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount files together */
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open group in mounted file */
- if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Open file #3 again */
- if((fid3 = H5Fopen(filename3, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fopen(filename3, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount file #3 on file #2 */
- if(H5Fmount(gidAM, ".", fid3, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidAM, ".", fid3, H5P_DEFAULT) < 0)
TEST_ERROR
/* Re-open file #3 */
- if((fid3_2 = H5Freopen(fid3)) < 0)
+ if ((fid3_2 = H5Freopen(fid3)) < 0)
TEST_ERROR
/* Mount file #3 on file #1 also */
- if(H5Fmount(gidB, ".", fid3_2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidB, ".", fid3_2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open object in file #3 through file #2 mount path */
- if((gidAMT = H5Gopen2(fid1, "A/M/T", H5P_DEFAULT)) < 0)
+ if ((gidAMT = H5Gopen2(fid1, "A/M/T", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name */
*name = '\0';
- if(H5Iget_name(gidAMT, name, (size_t)NAME_BUF_SIZE ) < 0)
+ if (H5Iget_name(gidAMT, name, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(name, "/A/M/T"))
+ if (HDstrcmp(name, "/A/M/T"))
TEST_ERROR
/* Create object in file #3 */
- if((gidU = H5Gcreate2(gidAMT, "U", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidU = H5Gcreate2(gidAMT, "U", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidU) < 0)
+ if (H5Gclose(gidU) < 0)
TEST_ERROR
/* Open object in file #3 through file #1 mount path */
- if((gidBS = H5Gopen2(fid1, "B/S", H5P_DEFAULT)) < 0)
+ if ((gidBS = H5Gopen2(fid1, "B/S", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name */
*name = '\0';
- if(H5Iget_name(gidBS, name, (size_t)NAME_BUF_SIZE ) < 0)
+ if (H5Iget_name(gidBS, name, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(name, "/B/S"))
+ if (HDstrcmp(name, "/B/S"))
TEST_ERROR
/* Re-open object created in file #3 through file #1 mount path */
- if((gidU = H5Gopen2(gidBS, "/B/T/U", H5P_DEFAULT)) < 0)
+ if ((gidU = H5Gopen2(gidBS, "/B/T/U", H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidU) < 0)
+ if (H5Gclose(gidU) < 0)
TEST_ERROR
/* Close groups in file #3 */
- if(H5Gclose(gidBS) < 0)
+ if (H5Gclose(gidBS) < 0)
TEST_ERROR
- if(H5Gclose(gidAMT) < 0)
+ if (H5Gclose(gidAMT) < 0)
TEST_ERROR
/* Close group in file #2 */
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
/* Close groups in file #1 */
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Gclose(gidB) < 0)
+ if (H5Gclose(gidB) < 0)
TEST_ERROR
/* Close file #3 IDs */
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
- if(H5Fclose(fid3_2) < 0)
+ if (H5Fclose(fid3_2) < 0)
TEST_ERROR
/* Close file #2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -2987,26 +3147,27 @@ test_mult_mount(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidU);
- H5Gclose(gidAMT);
- H5Gclose(gidT);
- H5Gclose(gidBS);
- H5Gclose(gidS);
- H5Gclose(gidAM);
- H5Gclose(gidN);
- H5Gclose(gidM);
- H5Gclose(gidB);
- H5Gclose(gidA);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidU);
+ H5Gclose(gidAMT);
+ H5Gclose(gidT);
+ H5Gclose(gidBS);
+ H5Gclose(gidS);
+ H5Gclose(gidAM);
+ H5Gclose(gidN);
+ H5Gclose(gidM);
+ H5Gclose(gidB);
+ H5Gclose(gidA);
H5Fclose(fid3_2);
H5Fclose(fid3);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_mult_mount() */
-
/*-------------------------------------------------------------------------
* Function: test_nested_survive
*
@@ -3027,15 +3188,13 @@ error:
static int
test_nested_survive(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t gidA = -1; /* Group IDs in file #1 */
- hid_t gidM = -1, gidAM = -1; /* Group IDs in file #2 */
- hid_t gidS = -1, gidMS = -1, gidAMS = -1; /* Group IDs in file #3 */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- ssize_t name_len; /* Filename length */
- char filename1[1024],
- filename2[1024],
- filename3[1024]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
+ hid_t gidA = -1; /* Group IDs in file #1 */
+ hid_t gidM = -1, gidAM = -1; /* Group IDs in file #2 */
+ hid_t gidS = -1, gidMS = -1, gidAMS = -1; /* Group IDs in file #3 */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ ssize_t name_len; /* Filename length */
+ char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
TESTING("nested mounts survive");
@@ -3044,163 +3203,158 @@ test_nested_survive(hid_t fapl)
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Create file #3 */
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidS = H5Gcreate2(fid3, "S", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidS = H5Gcreate2(fid3, "S", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidS) < 0)
+ if (H5Gclose(gidS) < 0)
TEST_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
-
/* Re-open files and mount file #2 in file #1 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount files together */
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open group in mounted file */
- if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Open file #3 again */
- if((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount file #3 on file #2 */
- if(H5Fmount(gidAM, ".", fid3, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidAM, ".", fid3, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open object in file #3 through file #1 mount path */
- if((gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT)) < 0)
+ if ((gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close group in file #3 */
- if(H5Gclose(gidAMS) < 0)
+ if (H5Gclose(gidAMS) < 0)
TEST_ERROR
/* Check name */
*name = '\0';
- if((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/A/M"))
+ if (name_len == 0 || HDstrcmp(name, "/A/M"))
TEST_ERROR
/* Unmount file #2 from file #1 */
- if(H5Funmount(gidA, ".") < 0)
+ if (H5Funmount(gidA, ".") < 0)
TEST_ERROR
/* Check name */
*name = '\0';
- if((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len != 0 || HDstrcmp(name, ""))
+ if (name_len != 0 || HDstrcmp(name, ""))
TEST_ERROR
/* Open object in file #3 through file #1 mount path (should fail) */
- H5E_BEGIN_TRY {
- gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT);
- } H5E_END_TRY;
- if(gidAMS >= 0)
+ H5E_BEGIN_TRY { gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (gidAMS >= 0)
TEST_ERROR
/* Open object in file #3 through file #2 mount path */
- if((gidMS = H5Gopen2(fid2, "M/S", H5P_DEFAULT)) < 0)
+ if ((gidMS = H5Gopen2(fid2, "M/S", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name */
*name = '\0';
- if(H5Iget_name(gidMS, name, (size_t)NAME_BUF_SIZE ) < 0)
+ if (H5Iget_name(gidMS, name, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(name, "/M/S"))
+ if (HDstrcmp(name, "/M/S"))
TEST_ERROR
/* Close group in file #3 */
- if(H5Gclose(gidMS) < 0)
+ if (H5Gclose(gidMS) < 0)
TEST_ERROR
/* Re-mount file #2 on file #1 */
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open object in file #3 through file #1 mount path again */
- if((gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT)) < 0)
+ if ((gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name */
*name = '\0';
- if(H5Iget_name(gidAMS, name, (size_t)NAME_BUF_SIZE ) < 0)
+ if (H5Iget_name(gidAMS, name, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR
- if(HDstrcmp(name, "/A/M/S"))
+ if (HDstrcmp(name, "/A/M/S"))
TEST_ERROR
/* Close group in file #3 */
- if(H5Gclose(gidAMS) < 0)
+ if (H5Gclose(gidAMS) < 0)
TEST_ERROR
/* Close group in file #2 */
- if(H5Gclose(gidAM) < 0)
+ if (H5Gclose(gidAM) < 0)
TEST_ERROR
/* Close groups in file #1 */
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
/* Close file #3 IDs */
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
/* Close file #2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -3208,21 +3362,22 @@ test_nested_survive(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidAMS);
- H5Gclose(gidMS);
- H5Gclose(gidS);
- H5Gclose(gidAM);
- H5Gclose(gidM);
- H5Gclose(gidA);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidAMS);
+ H5Gclose(gidMS);
+ H5Gclose(gidS);
+ H5Gclose(gidAM);
+ H5Gclose(gidM);
+ H5Gclose(gidA);
H5Fclose(fid3);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_nested_survive() */
-
/*-------------------------------------------------------------------------
* Function: test_close_parent
*
@@ -3243,13 +3398,12 @@ error:
static int
test_close_parent(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1; /* Group IDs in file #1 */
- hid_t gidM = -1; /* Group IDs in file #2 */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- ssize_t name_len; /* Filename length */
- char filename1[1024],
- filename2[1024]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gidA = -1; /* Group IDs in file #1 */
+ hid_t gidM = -1; /* Group IDs in file #2 */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ ssize_t name_len; /* Filename length */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("close parent");
@@ -3257,63 +3411,61 @@ test_close_parent(hid_t fapl)
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Create file #1 */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Re-open files and mount file #2 in file #1 */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount files together */
- if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open group in mounted file */
- if((gidM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close group in file #1 */
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
/* Close files #1 & #2 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
/* Both underlying shared files should be open still */
@@ -3321,27 +3473,27 @@ test_close_parent(hid_t fapl)
/* Check the name of "M" is still defined */
*name = '\0';
- if((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/A/M"))
+ if (name_len == 0 || HDstrcmp(name, "/A/M"))
TEST_ERROR
/* Unmount file #2 from file #1, closing file #1 */
- if(H5Funmount(gidM, "/A") < 0)
+ if (H5Funmount(gidM, "/A") < 0)
TEST_ERROR
/* Check the name of "M" is defined in its file */
*name = '\0';
- if((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/M"))
+ if (name_len == 0 || HDstrcmp(name, "/M"))
TEST_ERROR
/* Just file #2's underlying shared file should be open still */
H5F_sfile_assert_num(1);
/* Close group in file #2, letting file #2 close */
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
/* All underlying shared file structs should be closed */
@@ -3351,16 +3503,17 @@ test_close_parent(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidM);
- H5Gclose(gidA);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidM);
+ H5Gclose(gidA);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_close_parent() */
-
/*-------------------------------------------------------------------------
* Function: test_cut_graph
*
@@ -3416,25 +3569,20 @@ error:
static int
test_cut_graph(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1,
- fid4 = -1, fid5 = -1, fid6 = -1, fid7 = -1; /* File IDs */
- hid_t gidA = -1, gidB = -1; /* Group IDs in file #1 */
- hid_t gidD = -1, gidE = -1; /* Group IDs in file #2 */
- hid_t gidH = -1, gidI = -1; /* Group IDs in file #3 */
- hid_t gidK = -1; /* Group IDs in file #4 */
- hid_t gidM = -1; /* Group IDs in file #5 */
- hid_t gidO = -1; /* Group IDs in file #6 */
- hid_t gidQ = -1; /* Group IDs in file #7 */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- ssize_t name_len; /* Filename length */
- ssize_t obj_count; /* Number of objects open */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- filename4[NAME_BUF_SIZE],
- filename5[NAME_BUF_SIZE],
- filename6[NAME_BUF_SIZE],
- filename7[NAME_BUF_SIZE]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1, fid3 = -1, fid4 = -1, fid5 = -1, fid6 = -1, fid7 = -1; /* File IDs */
+ hid_t gidA = -1, gidB = -1; /* Group IDs in file #1 */
+ hid_t gidD = -1, gidE = -1; /* Group IDs in file #2 */
+ hid_t gidH = -1, gidI = -1; /* Group IDs in file #3 */
+ hid_t gidK = -1; /* Group IDs in file #4 */
+ hid_t gidM = -1; /* Group IDs in file #5 */
+ hid_t gidO = -1; /* Group IDs in file #6 */
+ hid_t gidQ = -1; /* Group IDs in file #7 */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ ssize_t name_len; /* Filename length */
+ ssize_t obj_count; /* Number of objects open */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE],
+ filename4[NAME_BUF_SIZE], filename5[NAME_BUF_SIZE], filename6[NAME_BUF_SIZE],
+ filename7[NAME_BUF_SIZE]; /* Name of files to mount */
TESTING("cutting mount graph");
@@ -3447,292 +3595,284 @@ test_cut_graph(hid_t fapl)
h5_fixname(FILENAME[6], fapl, filename7, sizeof filename3);
/* Create file #1 & it's groups */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidB) < 0)
+ if (H5Gclose(gidB) < 0)
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 & it's groups */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidD = H5Gcreate2(fid2, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidD = H5Gcreate2(fid2, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidD) < 0)
+ if (H5Gclose(gidD) < 0)
TEST_ERROR
- if((gidE = H5Gcreate2(fid2, "E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidE = H5Gcreate2(fid2, "E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidE) < 0)
+ if (H5Gclose(gidE) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Create file #3 & it's groups */
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidH = H5Gcreate2(fid3, "H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidH = H5Gcreate2(fid3, "H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidH) < 0)
+ if (H5Gclose(gidH) < 0)
TEST_ERROR
- if((gidI = H5Gcreate2(fid3, "I", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidI = H5Gcreate2(fid3, "I", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidI) < 0)
+ if (H5Gclose(gidI) < 0)
TEST_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
/* Create file #4 & it's group */
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidK = H5Gcreate2(fid4, "K", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidK = H5Gcreate2(fid4, "K", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidK) < 0)
+ if (H5Gclose(gidK) < 0)
TEST_ERROR
- if(H5Fclose(fid4) < 0)
+ if (H5Fclose(fid4) < 0)
TEST_ERROR
/* Create file #5 & it's group */
- if((fid5 = H5Fcreate(filename5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid5 = H5Fcreate(filename5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidM = H5Gcreate2(fid5, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gcreate2(fid5, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
- if(H5Fclose(fid5) < 0)
+ if (H5Fclose(fid5) < 0)
TEST_ERROR
/* Create file #6 & it's group */
- if((fid6 = H5Fcreate(filename6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid6 = H5Fcreate(filename6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidO = H5Gcreate2(fid6, "O", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidO = H5Gcreate2(fid6, "O", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidO) < 0)
+ if (H5Gclose(gidO) < 0)
TEST_ERROR
- if(H5Fclose(fid6) < 0)
+ if (H5Fclose(fid6) < 0)
TEST_ERROR
/* Create file #7 & it's group */
- if((fid7 = H5Fcreate(filename7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid7 = H5Fcreate(filename7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidQ = H5Gcreate2(fid7, "Q", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidQ = H5Gcreate2(fid7, "Q", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidQ) < 0)
+ if (H5Gclose(gidQ) < 0)
TEST_ERROR
- if(H5Fclose(fid7) < 0)
+ if (H5Fclose(fid7) < 0)
TEST_ERROR
-
/* Re-open files and build mount hierarchy */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount file #2 at /A */
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(fid1, "/A", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1, "/A", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Mount file #3 at /B */
- if((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(fid1, "/B", fid3, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1, "/B", fid3, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
/* Mount file #4 at /A/D */
- if((fid4 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid4 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(fid1, "/A/D", fid4, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1, "/A/D", fid4, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Fclose(fid4) < 0)
+ if (H5Fclose(fid4) < 0)
TEST_ERROR
/* Mount file #5 at /A/E */
- if((fid5 = H5Fopen(filename5, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid5 = H5Fopen(filename5, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(fid1, "/A/E", fid5, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1, "/A/E", fid5, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Fclose(fid5) < 0)
+ if (H5Fclose(fid5) < 0)
TEST_ERROR
/* Mount file #6 at /B/H */
- if((fid6 = H5Fopen(filename6, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid6 = H5Fopen(filename6, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(fid1, "/B/H", fid6, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1, "/B/H", fid6, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Fclose(fid6) < 0)
+ if (H5Fclose(fid6) < 0)
TEST_ERROR
/* Mount file #7 at /B/H */
- if((fid7 = H5Fopen(filename7, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid7 = H5Fopen(filename7, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(fid1, "/B/I", fid7, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1, "/B/I", fid7, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Fclose(fid7) < 0)
+ if (H5Fclose(fid7) < 0)
TEST_ERROR
/* Open object in file #5 */
- if((gidM = H5Gopen2(fid1, "A/E/M", H5P_DEFAULT)) < 0)
+ if ((gidM = H5Gopen2(fid1, "A/E/M", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name */
*name = '\0';
- if((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/A/E/M"))
+ if (name_len == 0 || HDstrcmp(name, "/A/E/M"))
TEST_ERROR
/* Open object in file #7 */
- if((gidQ = H5Gopen2(fid1, "B/I/Q", H5P_DEFAULT)) < 0)
+ if ((gidQ = H5Gopen2(fid1, "B/I/Q", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check name */
*name = '\0';
- if((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/B/I/Q"))
+ if (name_len == 0 || HDstrcmp(name, "/B/I/Q"))
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Get a new file ID for file #5 */
- if((fid5 = H5Iget_file_id(gidM)) < 0)
+ if ((fid5 = H5Iget_file_id(gidM)) < 0)
TEST_ERROR
/* Check the number of objects currently open */
- if((obj_count = H5Fget_obj_count(fid5, H5F_OBJ_ALL)) < 0)
+ if ((obj_count = H5Fget_obj_count(fid5, H5F_OBJ_ALL)) < 0)
TEST_ERROR
- if(obj_count != 2) /* one object and the file ID */
+ if (obj_count != 2) /* one object and the file ID */
TEST_ERROR
/* Close ID on file #5 */
- if(H5Fclose(fid5) < 0)
+ if (H5Fclose(fid5) < 0)
TEST_ERROR
-
/* Get a new file ID for file #7 */
- if((fid7 = H5Iget_file_id(gidQ)) < 0)
+ if ((fid7 = H5Iget_file_id(gidQ)) < 0)
TEST_ERROR
/* Check the number of objects currently open */
- if((obj_count = H5Fget_obj_count(fid7, H5F_OBJ_ALL)) < 0)
+ if ((obj_count = H5Fget_obj_count(fid7, H5F_OBJ_ALL)) < 0)
TEST_ERROR
- if(obj_count != 2) /* one object and the file ID */
+ if (obj_count != 2) /* one object and the file ID */
TEST_ERROR
/* Close ID on file #7 */
- if(H5Fclose(fid7) < 0)
+ if (H5Fclose(fid7) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
-
/* Unmount file #2 from file #1, cutting the graph */
- if(H5Funmount(gidM, "/A") < 0)
+ if (H5Funmount(gidM, "/A") < 0)
TEST_ERROR
/* Attempt to open an object in file #4, from file #1 */
- H5E_BEGIN_TRY {
- gidK = H5Gopen2(gidQ, "/A/D/K", H5P_DEFAULT);
- } H5E_END_TRY;
- if(gidK >= 0)
+ H5E_BEGIN_TRY { gidK = H5Gopen2(gidQ, "/A/D/K", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (gidK >= 0)
TEST_ERROR
/* Open object in file #4 from file #5 */
- if((gidK = H5Gopen2(gidM, "/D/K", H5P_DEFAULT)) < 0)
+ if ((gidK = H5Gopen2(gidM, "/D/K", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check the name of "K" is correct */
*name = '\0';
- if((name_len = H5Iget_name(gidK, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidK, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/D/K"))
+ if (name_len == 0 || HDstrcmp(name, "/D/K"))
TEST_ERROR
- if(H5Gclose(gidK) < 0)
+ if (H5Gclose(gidK) < 0)
TEST_ERROR
/* Attempt to open an object in file #6, from file #5 */
- H5E_BEGIN_TRY {
- gidO = H5Gopen2(gidM, "/B/H/O", H5P_DEFAULT);
- } H5E_END_TRY;
- if(gidO >= 0)
+ H5E_BEGIN_TRY { gidO = H5Gopen2(gidM, "/B/H/O", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (gidO >= 0)
TEST_ERROR
/* Open object in file #6 from file #7 */
- if((gidO = H5Gopen2(gidQ, "/B/H/O", H5P_DEFAULT)) < 0)
+ if ((gidO = H5Gopen2(gidQ, "/B/H/O", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check the name of "O" is correct */
*name = '\0';
- if((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/B/H/O"))
+ if (name_len == 0 || HDstrcmp(name, "/B/H/O"))
TEST_ERROR
- if(H5Gclose(gidO) < 0)
+ if (H5Gclose(gidO) < 0)
TEST_ERROR
/* Check the name of "M" is defined in its file */
*name = '\0';
- if((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/E/M"))
+ if (name_len == 0 || HDstrcmp(name, "/E/M"))
TEST_ERROR
/* Check the name of "Q" is still defined */
*name = '\0';
- if((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/B/I/Q"))
+ if (name_len == 0 || HDstrcmp(name, "/B/I/Q"))
TEST_ERROR
/* Check that all seven underlying files are still opened */
H5F_sfile_assert_num(7);
/* Close "M" in file #5, which should close files 2, 4 & 5 */
- if(H5Gclose(gidM) < 0)
+ if (H5Gclose(gidM) < 0)
TEST_ERROR
/* Check that only four underlying files are still opened */
H5F_sfile_assert_num(4);
/* Unmount file #3 from file #1, cutting the graph */
- if(H5Funmount(gidQ, "/B") < 0)
+ if (H5Funmount(gidQ, "/B") < 0)
TEST_ERROR
/* Check that only three underlying files are still opened */
@@ -3741,27 +3881,27 @@ test_cut_graph(hid_t fapl)
/* Check the name of "Q" is defined in its file */
*name = '\0';
- if((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/I/Q"))
+ if (name_len == 0 || HDstrcmp(name, "/I/Q"))
TEST_ERROR
/* Open object in file #6 from file #7 */
- if((gidO = H5Gopen2(gidQ, "/H/O", H5P_DEFAULT)) < 0)
+ if ((gidO = H5Gopen2(gidQ, "/H/O", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check the name of "O" is correct */
*name = '\0';
- if((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/H/O"))
+ if (name_len == 0 || HDstrcmp(name, "/H/O"))
TEST_ERROR
- if(H5Gclose(gidO) < 0)
+ if (H5Gclose(gidO) < 0)
TEST_ERROR
/* Close last object and let files 3, 6 & 7 close */
- if(H5Gclose(gidQ) < 0)
+ if (H5Gclose(gidQ) < 0)
TEST_ERROR
/* Verify that all underlying shared files have been closed now */
@@ -3771,29 +3911,30 @@ test_cut_graph(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidQ);
- H5Gclose(gidO);
- H5Gclose(gidM);
- H5Gclose(gidK);
- H5Gclose(gidI);
- H5Gclose(gidH);
- H5Gclose(gidE);
- H5Gclose(gidD);
- H5Gclose(gidB);
- H5Gclose(gidA);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidQ);
+ H5Gclose(gidO);
+ H5Gclose(gidM);
+ H5Gclose(gidK);
+ H5Gclose(gidI);
+ H5Gclose(gidH);
+ H5Gclose(gidE);
+ H5Gclose(gidD);
+ H5Gclose(gidB);
+ H5Gclose(gidA);
H5Fclose(fid7);
H5Fclose(fid6);
H5Fclose(fid5);
H5Fclose(fid4);
H5Fclose(fid3);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_cut_graph() */
-
/*-------------------------------------------------------------------------
* Function: test_symlink
*
@@ -3814,16 +3955,15 @@ error:
static int
test_symlink(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t gidA = -1, gidB = -1; /* Group IDs in file #1 */
- hid_t gidD = -1, gidE = -1; /* Group IDs in file #2 */
- hid_t gidH = -1, gidI = -1; /* Group IDs in file #3 */
- hid_t gidL = -1; /* Group IDs through soft link to file #3 */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- ssize_t name_len; /* Filename length */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE]; /* Name of files to mount */
+ hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
+ hid_t gidA = -1, gidB = -1; /* Group IDs in file #1 */
+ hid_t gidD = -1, gidE = -1; /* Group IDs in file #2 */
+ hid_t gidH = -1, gidI = -1; /* Group IDs in file #3 */
+ hid_t gidL = -1; /* Group IDs through soft link to file #3 */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ ssize_t name_len; /* Filename length */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE]; /* Name of files to mount */
TESTING("symlinks");
@@ -3832,110 +3972,106 @@ test_symlink(hid_t fapl)
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
/* Create file #1 & it's groups */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidA) < 0)
+ if (H5Gclose(gidA) < 0)
TEST_ERROR
- if((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidB) < 0)
+ if (H5Gclose(gidB) < 0)
TEST_ERROR
/* Create soft link to mounted object */
- if(H5Lcreate_soft("./A/D/H", fid1, "L", H5P_DEFAULT, H5P_DEFAULT) < 0) /* Soft link */
+ if (H5Lcreate_soft("./A/D/H", fid1, "L", H5P_DEFAULT, H5P_DEFAULT) < 0) /* Soft link */
TEST_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
-
/* Create file #2 & it's groups */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidD = H5Gcreate2(fid2, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidD = H5Gcreate2(fid2, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidD) < 0)
+ if (H5Gclose(gidD) < 0)
TEST_ERROR
- if((gidE = H5Gcreate2(fid2, "E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidE = H5Gcreate2(fid2, "E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidE) < 0)
+ if (H5Gclose(gidE) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
-
/* Create file #3 & it's groups */
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gidH = H5Gcreate2(fid3, "H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidH = H5Gcreate2(fid3, "H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidH) < 0)
+ if (H5Gclose(gidH) < 0)
TEST_ERROR
- if((gidI = H5Gcreate2(fid3, "I", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gidI = H5Gcreate2(fid3, "I", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gidI) < 0)
+ if (H5Gclose(gidI) < 0)
TEST_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
-
/* Re-open files and build mount hierarchy */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount file #2 at /A */
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(fid1, "/A", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1, "/A", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Attempt to open an object in file #3 (should fail) */
- H5E_BEGIN_TRY {
- gidL = H5Gopen2(fid1, "L", H5P_DEFAULT);
- } H5E_END_TRY;
- if(gidL >= 0)
+ H5E_BEGIN_TRY { gidL = H5Gopen2(fid1, "L", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (gidL >= 0)
TEST_ERROR
/* Mount file #3 at /A/D */
- if((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Fmount(fid1, "/A/D", fid3, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1, "/A/D", fid3, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
/* Open soft link to object in file #3 */
- if((gidL = H5Gopen2(fid1, "L", H5P_DEFAULT)) < 0)
+ if ((gidL = H5Gopen2(fid1, "L", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check the name of "L" is correct */
*name = '\0';
- if((name_len = H5Iget_name(gidL, name, (size_t)NAME_BUF_SIZE )) < 0)
+ if ((name_len = H5Iget_name(gidL, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR
- if(name_len == 0 || HDstrcmp(name, "/L"))
+ if (name_len == 0 || HDstrcmp(name, "/L"))
TEST_ERROR
/* Close file #1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
/* Verify that all 3 underlying shared files are still open */
H5F_sfile_assert_num(3);
/* Close object opened through soft link */
- if(H5Gclose(gidL) < 0)
+ if (H5Gclose(gidL) < 0)
TEST_ERROR
/* Verify that all underlying shared files have been closed now */
@@ -3945,22 +4081,23 @@ test_symlink(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gidL);
- H5Gclose(gidI);
- H5Gclose(gidH);
- H5Gclose(gidE);
- H5Gclose(gidD);
- H5Gclose(gidB);
- H5Gclose(gidA);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gidL);
+ H5Gclose(gidI);
+ H5Gclose(gidH);
+ H5Gclose(gidE);
+ H5Gclose(gidD);
+ H5Gclose(gidB);
+ H5Gclose(gidA);
H5Fclose(fid3);
H5Fclose(fid2);
- H5Fclose(fid1);
- } H5E_END_TRY;
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_symlink() */
-
/*-------------------------------------------------------------------------
* Function: test_sharedacc
*
@@ -3977,15 +4114,14 @@ error:
*
*-------------------------------------------------------------------------
*/
- static int
+static int
test_sharedacc(hid_t fapl)
{
hid_t fid1[2] = {-1, -1}, fid2[2] = {-1, -1}; /* File IDs */
hid_t gid = -1;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE]; /* Name of files to mount */
- int i, j, k; /* Counters */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE]; /* Name of files to mount */
+ int i, j, k; /* Counters */
TESTING("shared mount access");
@@ -3994,60 +4130,60 @@ test_sharedacc(hid_t fapl)
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
/* Create file #1 & its group */
- if((fid1[0] = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1[0] = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gid = H5Gcreate2(fid1[0], "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid1[0], "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
/* Create file #2 & its group */
- if((fid2[0] = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2[0] = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gid = H5Gcreate2(fid2[0], "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid2[0], "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
/* Test mount before reopen, then using reopened handle for access */
- if(H5Fmount(fid1[0], "/A", fid2[0], H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1[0], "/A", fid2[0], H5P_DEFAULT) < 0)
TEST_ERROR
- if((fid1[1] = H5Freopen(fid1[0])) < 0)
+ if ((fid1[1] = H5Freopen(fid1[0])) < 0)
TEST_ERROR
- if((fid2[1] = H5Freopen(fid2[0])) < 0)
+ if ((fid2[1] = H5Freopen(fid2[0])) < 0)
TEST_ERROR
- if((gid = H5Gopen2(fid1[1], "/A/B", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid1[1], "/A/B", H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
- if(H5Funmount(fid1[1], "/A") < 0)
+ if (H5Funmount(fid1[1], "/A") < 0)
TEST_ERROR
/* "Brute force" test of all possible ways of mounting, accessing, and
* unmounting files with multiple handles (mount after reopen) */
- for(i=0; i<2; i++)
- for(j=0; j<2; j++)
- for(k=0; k<2; k++) {
- if(H5Fmount(fid1[i], "/A", fid2[j], H5P_DEFAULT) < 0)
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
+ for (k = 0; k < 2; k++) {
+ if (H5Fmount(fid1[i], "/A", fid2[j], H5P_DEFAULT) < 0)
TEST_ERROR
- if((gid = H5Gopen2(fid1[k], "/A/B", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid1[k], "/A/B", H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
- if(H5Funmount(fid1[k], "/A") < 0)
+ if (H5Funmount(fid1[k], "/A") < 0)
TEST_ERROR
}
/* Close file IDs */
- for(i=0; i<2; i++) {
- if(H5Fclose(fid1[i]) < 0)
+ for (i = 0; i < 2; i++) {
+ if (H5Fclose(fid1[i]) < 0)
TEST_ERROR
- if(H5Fclose(fid2[i]) < 0)
+ if (H5Fclose(fid2[i]) < 0)
TEST_ERROR
}
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -4055,17 +4191,18 @@ test_sharedacc(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gid);
- for(i=0; i<2; i++) {
- H5Fclose(fid1[i]);
- H5Fclose(fid2[i]);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ for (i = 0; i < 2; i++) {
+ H5Fclose(fid1[i]);
+ H5Fclose(fid2[i]);
+ }
}
- } H5E_END_TRY;
+ H5E_END_TRY;
return 1;
} /* end test_sharedacc() */
-
/*-------------------------------------------------------------------------
* Function: test_sharedclose
*
@@ -4083,14 +4220,13 @@ error:
*
*-------------------------------------------------------------------------
*/
- static int
+static int
test_sharedclose(hid_t fapl)
{
hid_t fid1a = -1, fid1b = -1, fid2 = -1, fid3 = -2; /* File IDs */
hid_t gid1 = -1, gid2 = -1, gid3 = -1;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE]; /* Name of files to mount */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE]; /* Name of files to mount */
TESTING("closing shared mounts");
@@ -4099,112 +4235,112 @@ test_sharedclose(hid_t fapl)
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
/* Create file #1a & its group */
- if((fid1a = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1a = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gid1 = H5Gcreate2(fid1a, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(fid1a, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create file #1b & its groups */
- if((fid1b = H5Freopen(fid1a)) < 0)
+ if ((fid1b = H5Freopen(fid1a)) < 0)
TEST_ERROR
- if((gid2 = H5Gcreate2(fid1b, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(fid1b, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gid3 = H5Gcreate2(fid1b, "B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid3 = H5Gcreate2(fid1b, "B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create file #3 */
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount file #2 to file #1a */
- if(H5Fmount(gid1, ".", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(gid1, ".", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Mount file #3 to file #1b */
- if(H5Fmount(gid2, ".", fid3, H5P_DEFAULT) < 0)
+ if (H5Fmount(gid2, ".", fid3, H5P_DEFAULT) < 0)
TEST_ERROR
/* Close file #1b. It should be held open by the groups in it. */
- if(H5Fclose(fid1b) < 0)
+ if (H5Fclose(fid1b) < 0)
TEST_ERROR
/* Close file #3. It should be held open by the groups in its parent. */
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
TEST_ERROR
/* Close group B in file #1b. This should not close file #1b and #3. */
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR
/* Check that file #3 is still open */
H5F_sfile_assert_num(3);
/* Close group B/C in file #1b. This should close file #1b and #3. */
- if(H5Gclose(gid3) < 0)
+ if (H5Gclose(gid3) < 0)
TEST_ERROR
/* Check that file #3 has been closed */
H5F_sfile_assert_num(2);
/* Unmount file 2 and close the rest of the handles */
- if(H5Funmount(fid1a, "A") < 0)
+ if (H5Funmount(fid1a, "A") < 0)
TEST_ERROR
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
- if(H5Fclose(fid1a) < 0)
+ if (H5Fclose(fid1a) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
/* Create file #1 & its group */
- if((fid1a = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1a = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((gid1 = H5Gcreate2(fid1a, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(fid1a, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create file #1b & its group */
- if((fid1b = H5Freopen(fid1a)) < 0)
+ if ((fid1b = H5Freopen(fid1a)) < 0)
TEST_ERROR
- if((gid2 = H5Gcreate2(fid1b, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(fid1b, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create file #2 */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Mount file #2 to file #1 */
- if(H5Fmount(fid1a, "A", fid2, H5P_DEFAULT) < 0)
+ if (H5Fmount(fid1a, "A", fid2, H5P_DEFAULT) < 0)
TEST_ERROR
/* Close file #1b. It should be held open by the group in it. */
- if(H5Fclose(fid1b) < 0)
+ if (H5Fclose(fid1b) < 0)
TEST_ERROR
/* Close the group in file #1b. This should close file # 1b. */
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
TEST_ERROR
/* Unmount file 2 and close the rest of the handles */
- if(H5Funmount(fid1a, "A") < 0)
+ if (H5Funmount(fid1a, "A") < 0)
TEST_ERROR
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
- if(H5Fclose(fid1a) < 0)
+ if (H5Fclose(fid1a) < 0)
TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0)
+ if (H5I_nmembers(H5I_FILE) != 0)
TEST_ERROR
H5F_sfile_assert_num(0);
@@ -4212,19 +4348,20 @@ test_sharedclose(hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gid1);
- H5Gclose(gid2);
- H5Gclose(gid3);
- H5Fclose(fid1a);
- H5Fclose(fid1b);
- H5Fclose(fid2);
- H5Fclose(fid3);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid1);
+ H5Gclose(gid2);
+ H5Gclose(gid3);
+ H5Fclose(fid1a);
+ H5Fclose(fid1b);
+ H5Fclose(fid2);
+ H5Fclose(fid3);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_sharedclose() */
-
/*-------------------------------------------------------------------------
* Function: test_multisharedclose
*
@@ -4242,15 +4379,13 @@ error:
*
*-------------------------------------------------------------------------
*/
- static int
+static int
test_multisharedclose(hid_t fapl)
{
hid_t fid1 = -1, fid2 = -1; /* File IDs */
hid_t gid1 = -1, gid2 = -1, gid3 = -1;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- filename4[NAME_BUF_SIZE]; /* Name of files to mount */
+ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE],
+ filename4[NAME_BUF_SIZE]; /* Name of files to mount */
TESTING("closing multiple shared mounts");
@@ -4260,95 +4395,128 @@ test_multisharedclose(hid_t fapl)
h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4);
/* Create master file with three groups to serve as mount points */
- if ((fid1 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Gclose(H5Gcreate2(fid1, "mnt1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Gclose(H5Gcreate2(fid1, "mnt2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Gclose(H5Gcreate2(fid1, "mnt3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Fclose(fid1) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid1, "mnt1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid1, "mnt2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid1, "mnt3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Create child file with group */
- if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Gclose(H5Gcreate2(fid1, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Fclose(fid1) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid1, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Create child file with group */
- if ((fid1 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Gclose(H5Gcreate2(fid1, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Fclose(fid1) < 0) TEST_ERROR
+ if ((fid1 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid1, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Create child file with group */
- if ((fid1 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Gclose(H5Gcreate2(fid1, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Fclose(fid1) < 0) TEST_ERROR
-
+ if ((fid1 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid1, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Open master and child 1 and mount child 1 to master */
- if ((fid1 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
- if ((fid2 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Fmount(fid1, "mnt1", fid2, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((fid1 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Fmount(fid1, "mnt1", fid2, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group in child 1 */
- if ((gid1 = H5Gopen2(fid1, "mnt1/grp", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid1 = H5Gopen2(fid1, "mnt1/grp", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close both files. They will be held open by gid1 */
- if (H5Idec_ref(fid2) < 0) TEST_ERROR
- if (H5Idec_ref(fid1) < 0) TEST_ERROR
-
+ if (H5Idec_ref(fid2) < 0)
+ TEST_ERROR
+ if (H5Idec_ref(fid1) < 0)
+ TEST_ERROR
/* Open master and child 2 and mount child 2 to master */
- if ((fid1 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
- if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Fmount(fid1, "mnt2", fid2, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((fid1 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Fmount(fid1, "mnt2", fid2, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group in child 2 */
- if ((gid2 = H5Gopen2(fid1, "mnt2/grp", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid1, "mnt2/grp", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close both files. They will be held open by gid2 */
- if (H5Idec_ref(fid2) < 0) TEST_ERROR
- if (H5Idec_ref(fid1) < 0) TEST_ERROR
-
+ if (H5Idec_ref(fid2) < 0)
+ TEST_ERROR
+ if (H5Idec_ref(fid1) < 0)
+ TEST_ERROR
/* Open master and child 3 and mount child 3 to master */
- if ((fid1 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
- if ((fid2 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Fmount(fid1, "mnt3", fid2, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((fid1 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Fmount(fid1, "mnt3", fid2, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group in child 3 */
- if ((gid3 = H5Gopen2(fid1, "mnt3/grp", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid3 = H5Gopen2(fid1, "mnt3/grp", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close both files. They will be held open by gid3 */
- if (H5Idec_ref(fid2) < 0) TEST_ERROR
- if (H5Idec_ref(fid1) < 0) TEST_ERROR
-
+ if (H5Idec_ref(fid2) < 0)
+ TEST_ERROR
+ if (H5Idec_ref(fid1) < 0)
+ TEST_ERROR
/* Close gid1. This will close child 1. */
- if (H5Idec_ref(gid1) < 0) TEST_ERROR
+ if (H5Idec_ref(gid1) < 0)
+ TEST_ERROR
/* Close gid2. This will close child 2. */
- if (H5Idec_ref(gid2) < 0) TEST_ERROR
+ if (H5Idec_ref(gid2) < 0)
+ TEST_ERROR
/* Close gid3. This will close child 3 and the master file. */
- if (H5Idec_ref(gid3) < 0) TEST_ERROR
+ if (H5Idec_ref(gid3) < 0)
+ TEST_ERROR
/* Check that all file IDs have been closed */
- if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ if (H5I_nmembers(H5I_FILE) != 0)
+ TEST_ERROR
H5F_sfile_assert_num(0);
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gid1);
- H5Gclose(gid2);
- H5Gclose(gid3);
- H5Fclose(fid2);
- H5Fclose(fid2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid1);
+ H5Gclose(gid2);
+ H5Gclose(gid3);
+ H5Fclose(fid2);
+ H5Fclose(fid2);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_multisharedclose() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -4368,12 +4536,13 @@ error:
int
main(void)
{
- int nerrors = 0;
- hid_t fapl = -1;
+ int nerrors = 0;
+ hid_t fapl = -1;
h5_reset();
fapl = h5_fileaccess();
- if (setup(fapl) < 0) goto error;
+ if (setup(fapl) < 0)
+ goto error;
nerrors += test_basic(fapl);
nerrors += test_illegal(fapl);
@@ -4410,7 +4579,8 @@ main(void)
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if (nerrors) goto error;
+ if (nerrors)
+ goto error;
HDputs("All mount tests passed.");
h5_cleanup(FILENAME, fapl);
@@ -4421,4 +4591,3 @@ error:
HDputs("***** MOUNT ERRORS *****");
return 1;
}
-
diff --git a/test/mtime.c b/test/mtime.c
index 8294e80..c28b81a 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -23,16 +23,12 @@
#include "h5test.h"
#include "H5srcdir.h"
-const char *FILENAME[] = {
- "mtime",
- NULL
-};
-
-#define TESTFILE1 "tmtimeo.h5"
-#define MTIME1 1055531866
-#define TESTFILE2 "tmtimen.h5"
-#define MTIME2 1041606478
+const char *FILENAME[] = {"mtime", NULL};
+#define TESTFILE1 "tmtimeo.h5"
+#define MTIME1 1055531866
+#define TESTFILE2 "tmtimen.h5"
+#define MTIME2 1041606478
/*-------------------------------------------------------------------------
* Function: main
@@ -56,14 +52,14 @@ const char *FILENAME[] = {
int
main(void)
{
- hid_t fapl, file, space, dset;
- hsize_t size[1] = {2};
- time_t now;
- struct tm *tm;
- H5O_info2_t oi1, oi2;
- signed char buf1[32], buf2[32];
- char filename[1024];
- int token_cmp;
+ hid_t fapl, file, space, dset;
+ hsize_t size[1] = {2};
+ time_t now;
+ struct tm * tm;
+ H5O_info2_t oi1, oi2;
+ signed char buf1[32], buf2[32];
+ char filename[1024];
+ int token_cmp;
h5_reset();
fapl = h5_fileaccess();
@@ -72,15 +68,19 @@ main(void)
/* Create the file, create a dataset, then close the file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
+ if ((space = H5Screate_simple(1, size, NULL)) < 0)
TEST_ERROR;
- if((space = H5Screate_simple(1, size, NULL)) < 0) TEST_ERROR;
- if((dset = H5Dcreate2(file, "dset", H5T_NATIVE_SCHAR, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset", H5T_NATIVE_SCHAR, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
now = HDtime(NULL);
- if(H5Dclose(dset) < 0) TEST_ERROR;
- if(H5Sclose(space) < 0) TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/*
* Open the file and get the modification time. We'll test the
@@ -88,16 +88,23 @@ main(void)
* knowing its name.
*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
- if(H5Oget_info_by_name3(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR;
- if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Oget_info3(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR;
- if(H5Otoken_cmp(file, &oi1.token, &oi2.token, &token_cmp) < 0)TEST_ERROR;
- if(H5Dclose(dset) < 0) TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR;
+ if (H5Oget_info_by_name3(file, "dset", &oi1, H5O_INFO_BASIC | H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ TEST_ERROR;
+ if ((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Oget_info3(dset, &oi2, H5O_INFO_BASIC | H5O_INFO_TIME) < 0)
+ TEST_ERROR;
+ if (H5Otoken_cmp(file, &oi1.token, &oi2.token, &token_cmp) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/* Compare object tokens & times from the two ways of calling H5Oget_info() */
- if(token_cmp || oi1.ctime != oi2.ctime) {
+ if (token_cmp || oi1.ctime != oi2.ctime) {
H5_FAILED();
HDputs(" Calling H5Oget_info() with the dataset ID returned");
HDputs(" different values than calling it with a file and dataset");
@@ -106,24 +113,24 @@ main(void)
}
/* Compare times -- they must be within 60 seconds of one another */
- if(0 == oi1.ctime) {
+ if (0 == oi1.ctime) {
SKIPPED();
HDputs(" The modification time could not be decoded on this OS.");
HDputs(" Modification times will be mantained in the file but");
HDputs(" cannot be queried on this system. See H5O_mtime_decode().");
return 0;
- } else if(HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) {
+ }
+ else if (HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) {
H5_FAILED();
tm = HDlocaltime(&(oi1.ctime));
- HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm);
+ HDstrftime((char *)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm);
tm = HDlocaltime(&now);
- HDstrftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm);
+ HDstrftime((char *)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm);
HDprintf(" got: %s\n ans: %s\n", buf1, buf2);
goto error;
}
PASSED();
-
/* Check opening existing file with old-style modification time information
* and make certain that the time is correct
*/
@@ -133,22 +140,22 @@ main(void)
const char *testfile = H5_get_srcdir_filename(TESTFILE1); /* Corrected test file name */
file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
- if(file >= 0){
- if(H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ if (file >= 0) {
+ if (H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0)
TEST_ERROR;
- if(oi1.ctime != MTIME1) {
+ if (oi1.ctime != MTIME1) {
H5_FAILED();
- /* If this fails, examine H5Omtime.c. Modification time is very
- * system dependent (e.g., on Windows DST must be hardcoded). */
+ /* If this fails, examine H5Omtime.c. Modification time is very
+ * system dependent (e.g., on Windows DST must be hardcoded). */
puts(" Old modification time incorrect");
goto error;
}
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
}
else {
H5_FAILED();
- HDprintf("***cannot open the pre-created old modification test file (%s)\n",
- testfile);
+ HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile);
goto error;
} /* end else */
}
@@ -163,27 +170,28 @@ main(void)
const char *testfile = H5_get_srcdir_filename(TESTFILE2); /* Corrected test file name */
file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
- if(file >= 0){
- if(H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ if (file >= 0) {
+ if (H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0)
TEST_ERROR;
- if(oi2.ctime != MTIME2) {
- H5_FAILED();
- HDputs(" Modification time incorrect.");
- goto error;
+ if (oi2.ctime != MTIME2) {
+ H5_FAILED();
+ HDputs(" Modification time incorrect.");
+ goto error;
}
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
}
else {
H5_FAILED();
- HDprintf("***cannot open the pre-created old modification test file (%s)\n",
- testfile);
+ HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile);
goto error;
} /* end else */
}
PASSED();
/* Verify symbol table messages are cached */
- if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
+ if (h5_verify_cached_stabs(FILENAME, fapl) < 0)
+ TEST_ERROR
/* All looks good */
HDputs("All modification time tests passed.");
@@ -194,4 +202,3 @@ main(void)
error:
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/ntypes.c b/test/ntypes.c
index 34425c4..52fe1da 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -20,46 +20,41 @@
#include "h5test.h"
-const char *FILENAME[] = {
- "ntypes",
- NULL
-};
-
-#define DIM0 100
-#define DIM1 200
-#define DIM3 20
-
-
-int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
-short spoints2[DIM0][DIM1], scheck2[DIM0][DIM1];
-int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5];
-
-#define DSET_ATOMIC_NAME_1 "atomic_type_1"
-#define DSET_ATOMIC_NAME_2 "atomic_type_2"
-#define DSET_ATOMIC_NAME_3 "atomic_type_3"
-#define DSET_ATOMIC_NAME_4 "atomic_type_4"
-#define DSET_ATOMIC_NAME_5 "atomic_type_5"
-#define DSET_COMPOUND_NAME "compound_type"
-#define DSET_COMPOUND_NAME_2 "compound_type_2"
-#define DSET_COMPOUND_NAME_3 "compound_type_3"
-#define DSET_COMPOUND_NAME_4 "compound_type_4"
-#define DSET_ENUM_NAME "enum_type"
-#define DSET_ARRAY_NAME "array_type"
-#define DSET_ARRAY2_NAME "array_type_2"
-#define DSET_VL_NAME "vl_type"
-#define DSET_VLSTR_NAME "vlstr_type"
-#define DSET_STR_NAME "str_type"
-#define DSET_OPAQUE_NAME "opaque_type"
-#define DSET1_BITFIELD_NAME "bitfield_type_1"
-#define DSET2_BITFIELD_NAME "bitfield_type_2"
-
-#define SPACE1_DIM1 4
-#define SPACE1_RANK 1
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 10
-#define SPACE2_DIM2 10
-#define BITFIELD_ENUMB 8
-
+const char *FILENAME[] = {"ntypes", NULL};
+
+#define DIM0 100
+#define DIM1 200
+#define DIM3 20
+
+int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
+short spoints2[DIM0][DIM1], scheck2[DIM0][DIM1];
+int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5];
+
+#define DSET_ATOMIC_NAME_1 "atomic_type_1"
+#define DSET_ATOMIC_NAME_2 "atomic_type_2"
+#define DSET_ATOMIC_NAME_3 "atomic_type_3"
+#define DSET_ATOMIC_NAME_4 "atomic_type_4"
+#define DSET_ATOMIC_NAME_5 "atomic_type_5"
+#define DSET_COMPOUND_NAME "compound_type"
+#define DSET_COMPOUND_NAME_2 "compound_type_2"
+#define DSET_COMPOUND_NAME_3 "compound_type_3"
+#define DSET_COMPOUND_NAME_4 "compound_type_4"
+#define DSET_ENUM_NAME "enum_type"
+#define DSET_ARRAY_NAME "array_type"
+#define DSET_ARRAY2_NAME "array_type_2"
+#define DSET_VL_NAME "vl_type"
+#define DSET_VLSTR_NAME "vlstr_type"
+#define DSET_STR_NAME "str_type"
+#define DSET_OPAQUE_NAME "opaque_type"
+#define DSET1_BITFIELD_NAME "bitfield_type_1"
+#define DSET2_BITFIELD_NAME "bitfield_type_2"
+
+#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE2_RANK 2
+#define SPACE2_DIM1 10
+#define SPACE2_DIM2 10
+#define BITFIELD_ENUMB 8
/*-------------------------------------------------------------------------
* Function: test_atomic_dtype
@@ -80,59 +75,63 @@ int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5];
static herr_t
test_atomic_dtype(hid_t file)
{
- hid_t dataset = -1, space = -1;
- hid_t dtype = -1, native_type = -1;
- int i, j, n;
- hsize_t dims[2];
- void *tmp = NULL;
+ hid_t dataset = -1, space = -1;
+ hid_t dtype = -1, native_type = -1;
+ int i, j, n;
+ hsize_t dims[2];
+ void * tmp = NULL;
TESTING("atomic datatype");
/* Initialize the dataset */
- for(i = n = 0; i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
+ for (i = n = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
ipoints2[i][j] = n++;
/* Create the data space */
dims[0] = DIM0;
dims[1] = DIM1;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
/*------------------- Test data values ------------------------*/
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_1, H5T_STD_I32BE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_1, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Open dataset again to check H5Tget_native_type */
- if((dataset = H5Dopen2(file, DSET_ATOMIC_NAME_1, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_ATOMIC_NAME_1, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Verify the datatype retrieved and converted */
- if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_INT))
+ if (H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_INT))
TEST_ERROR;
- if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I32BE))
+ if (H5Tget_size(native_type) < H5Tget_size(H5T_STD_I32BE))
TEST_ERROR;
- if(H5T_INTEGER != H5Tget_class(native_type))
+ if (H5T_INTEGER != H5Tget_class(native_type))
TEST_ERROR;
/* Read the dataset back. The temporary buffer is for special platforms
* like Cray. */
- if(NULL == (tmp = HDmalloc((size_t)(DIM0 * DIM1 * H5Tget_size(native_type)))))
+ if (NULL == (tmp = HDmalloc((size_t)(DIM0 * DIM1 * H5Tget_size(native_type)))))
TEST_ERROR
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
TEST_ERROR;
/* Copy data from temporary buffer to destination buffer */
@@ -141,139 +140,156 @@ test_atomic_dtype(hid_t file)
tmp = NULL;
/* Convert to the integer type */
- if(H5Tconvert(native_type, H5T_NATIVE_INT, (DIM0 * DIM1), icheck2, NULL, H5P_DEFAULT) < 0)
+ if (H5Tconvert(native_type, H5T_NATIVE_INT, (DIM0 * DIM1), icheck2, NULL, H5P_DEFAULT) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i = 0; i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
- if(ipoints2[i][j] != icheck2[i][j]) {
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ if (ipoints2[i][j] != icheck2[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
goto error;
} /* end if */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
- if(H5Tclose(dtype) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
/*------------------ Test different data types ----------------*/
/* Create the dataset of H5T_STD_I64LE */
- if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_2, H5T_STD_I64LE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_2, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Verify the datatype retrieved and converted */
- if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_LLONG))
+ if (H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_LLONG))
TEST_ERROR;
- if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I64LE))
+ if (H5Tget_size(native_type) < H5Tget_size(H5T_STD_I64LE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(native_type))
+ if (H5T_INTEGER != H5Tget_class(native_type))
TEST_ERROR;
- if(H5Dclose(dataset) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
- if(H5Tclose(dtype) < 0) TEST_ERROR;
-
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
/* Create the dataset of H5T_STD_I8LE */
- if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_3, H5T_STD_I8LE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_3, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_ASCEND)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_ASCEND)) < 0)
TEST_ERROR;
/* Verify the datatype retrieved and converted */
- if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_CHAR))
+ if (H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_CHAR))
TEST_ERROR;
- if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I8LE))
+ if (H5Tget_size(native_type) < H5Tget_size(H5T_STD_I8LE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(native_type))
+ if (H5T_INTEGER != H5Tget_class(native_type))
TEST_ERROR;
- if(H5Dclose(dataset) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
- if(H5Tclose(dtype) < 0) TEST_ERROR;
-
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
/* Create the dataset of H5T_IEEE_F32BE */
- if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_4, H5T_IEEE_F32BE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_4, H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0)
TEST_ERROR;
/* Verify the datatype retrieved and converted */
- if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_FLOAT))
+ if (H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_FLOAT))
TEST_ERROR;
- if(H5Tget_size(native_type) < H5Tget_size(H5T_IEEE_F32BE))
+ if (H5Tget_size(native_type) < H5Tget_size(H5T_IEEE_F32BE))
TEST_ERROR;
- if(H5T_FLOAT!=H5Tget_class(native_type))
+ if (H5T_FLOAT != H5Tget_class(native_type))
TEST_ERROR;
- if(H5Dclose(dataset) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
- if(H5Tclose(dtype) < 0) TEST_ERROR;
-
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
/* Create the dataset of H5T_IEEE_F64BE */
- if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_5, H5T_IEEE_F64BE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_5, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0)
TEST_ERROR;
/* Verify the datatype retrieved and converted */
- if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_DOUBLE))
+ if (H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_DOUBLE))
TEST_ERROR;
- if(H5Tget_size(native_type) < H5Tget_size(H5T_IEEE_F64BE))
+ if (H5Tget_size(native_type) < H5Tget_size(H5T_IEEE_F64BE))
TEST_ERROR;
- if(H5T_FLOAT != H5Tget_class(native_type))
+ if (H5T_FLOAT != H5Tget_class(native_type))
TEST_ERROR;
- if(H5Dclose(dataset) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
- if(H5Tclose(dtype) < 0) TEST_ERROR;
-
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
- if(tmp)
+ if (tmp)
HDfree(tmp);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Tclose(native_type);
H5Tclose(dtype);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_dtype2
*
@@ -294,244 +310,274 @@ static herr_t
test_compound_dtype2(hid_t file)
{
typedef struct s2 {
- short c2;
- long l2;
- long long ll2;
+ short c2;
+ long l2;
+ long long ll2;
} s2;
typedef struct s1 {
- char c;
- int i;
- s2 st;
- unsigned long long l;
+ char c;
+ int i;
+ s2 st;
+ unsigned long long l;
} s1;
- hid_t dataset = -1, space = -1;
- hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, tid_m = -1,
- tid_m2 = -1, mem_id = -1, nest_mem_id = -1;
- int i, j, n;
- hsize_t dims[2];
- s1 *temp_point = NULL, *temp_check = NULL;
- s1 *points = NULL, *check = NULL;
- void *tmp = NULL, *bkg = NULL;
+ hid_t dataset = -1, space = -1;
+ hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, tid_m = -1, tid_m2 = -1, mem_id = -1,
+ nest_mem_id = -1;
+ int i, j, n;
+ hsize_t dims[2];
+ s1 * temp_point = NULL, *temp_check = NULL;
+ s1 * points = NULL, *check = NULL;
+ void * tmp = NULL, *bkg = NULL;
TESTING("nested compound datatype");
/* Allocate space for the points & check arrays */
- if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1)))
+ if (NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1)))
TEST_ERROR;
- if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1)))
+ if (NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1)))
TEST_ERROR;
/* Initialize the dataset */
- for(i = n = 0, temp_point = points; i < DIM0; i++) {
- for(j = 0; j < DIM1; j++, temp_point++) {
- temp_point->c = 't';
- temp_point->i = n++;
- temp_point->st.c2 = (short)(i + j);
- temp_point->st.l2 = (i * 5 + j * 50) * n;
+ for (i = n = 0, temp_point = points; i < DIM0; i++) {
+ for (j = 0; j < DIM1; j++, temp_point++) {
+ temp_point->c = 't';
+ temp_point->i = n++;
+ temp_point->st.c2 = (short)(i + j);
+ temp_point->st.l2 = (i * 5 + j * 50) * n;
temp_point->st.ll2 = (i * 10 + j * 100) * n;
- temp_point->l = (unsigned long long)((i * 40 + j * 400) * n);
+ temp_point->l = (unsigned long long)((i * 40 + j * 400) * n);
} /* end for */
- } /* end for */
+ } /* end for */
/* Create the data space */
dims[0] = DIM0;
dims[1] = DIM1;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create compound datatype for disk storage */
- if((tid2=H5Tcreate(H5T_COMPOUND, sizeof(s2))) < 0) TEST_ERROR;
- if((tid=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR;
+ if ((tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s2))) < 0)
+ TEST_ERROR;
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ TEST_ERROR;
/* Insert and pack members */
- if(H5Tinsert(tid2, "c2", HOFFSET(s2, c2), H5T_STD_I16BE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid2, "c2", HOFFSET(s2, c2), H5T_STD_I16BE) < 0)
+ TEST_ERROR;
#if H5_SIZEOF_LONG == 4
- if(H5Tinsert(tid2, "l2", HOFFSET(s2, l2), H5T_STD_I32LE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid2, "l2", HOFFSET(s2, l2), H5T_STD_I32LE) < 0)
+ TEST_ERROR;
#elif H5_SIZEOF_LONG == 8
- if(H5Tinsert(tid2, "l2", HOFFSET(s2, l2), H5T_STD_I64LE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid2, "l2", HOFFSET(s2, l2), H5T_STD_I64LE) < 0)
+ TEST_ERROR;
#else
#error "Unknown 'long' size"
#endif
#if H5_SIZEOF_LONG_LONG == 4
- if(H5Tinsert(tid2, "ll2", HOFFSET(s2, ll2), H5T_STD_I32BE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid2, "ll2", HOFFSET(s2, ll2), H5T_STD_I32BE) < 0)
+ TEST_ERROR;
#elif H5_SIZEOF_LONG_LONG == 8
- if(H5Tinsert(tid2, "ll2", HOFFSET(s2, ll2), H5T_STD_I64BE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid2, "ll2", HOFFSET(s2, ll2), H5T_STD_I64BE) < 0)
+ TEST_ERROR;
#else
#error "Unknown 'long long' size"
#endif
- if(H5Tinsert(tid, "c", HOFFSET(s1, c), H5T_STD_U8LE) < 0) TEST_ERROR;
- if(H5Tinsert(tid, "i", HOFFSET(s1, i), H5T_STD_I32LE) < 0) TEST_ERROR;
- if(H5Tinsert(tid, "st", HOFFSET(s1, st), tid2) < 0) TEST_ERROR;
+ if (H5Tinsert(tid, "c", HOFFSET(s1, c), H5T_STD_U8LE) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid, "i", HOFFSET(s1, i), H5T_STD_I32LE) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid, "st", HOFFSET(s1, st), tid2) < 0)
+ TEST_ERROR;
#if H5_SIZEOF_LONG_LONG == 4
- if(H5Tinsert(tid, "l", HOFFSET(s1, l), H5T_STD_U32BE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid, "l", HOFFSET(s1, l), H5T_STD_U32BE) < 0)
+ TEST_ERROR;
#elif H5_SIZEOF_LONG_LONG == 8
- if(H5Tinsert(tid, "l", HOFFSET(s1, l), H5T_STD_U64BE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid, "l", HOFFSET(s1, l), H5T_STD_U64BE) < 0)
+ TEST_ERROR;
#else
#error "Unknown 'long long' size"
#endif
/* Take away the paddings */
- if(H5Tpack(tid) < 0) TEST_ERROR;
+ if (H5Tpack(tid) < 0)
+ TEST_ERROR;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_COMPOUND_NAME_2, tid, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, DSET_COMPOUND_NAME_2, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create compound datatype for memory */
- if((tid_m2 = H5Tcreate(H5T_COMPOUND, sizeof(s2))) < 0) TEST_ERROR;
- if((tid_m = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR;
+ if ((tid_m2 = H5Tcreate(H5T_COMPOUND, sizeof(s2))) < 0)
+ TEST_ERROR;
+ if ((tid_m = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ TEST_ERROR;
/* Insert members */
- if(H5Tinsert(tid_m2, "c2", HOFFSET(s2, c2), H5T_NATIVE_SHORT) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m2, "l2", HOFFSET(s2, l2), H5T_NATIVE_LONG) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m2, "ll2", HOFFSET(s2, ll2), H5T_NATIVE_LLONG) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "i", HOFFSET(s1, i), H5T_NATIVE_INT) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "st", HOFFSET(s1, st), tid_m2) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_ULLONG) < 0) TEST_ERROR;
+ if (H5Tinsert(tid_m2, "c2", HOFFSET(s2, c2), H5T_NATIVE_SHORT) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m2, "l2", HOFFSET(s2, l2), H5T_NATIVE_LONG) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m2, "ll2", HOFFSET(s2, ll2), H5T_NATIVE_LLONG) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "i", HOFFSET(s1, i), H5T_NATIVE_INT) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "st", HOFFSET(s1, st), tid_m2) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_ULLONG) < 0)
+ TEST_ERROR;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
-
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
/* Open dataset again to check H5Tget_native_type */
- if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_2, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_2, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Tequal(native_type, tid_m) != TRUE)
+ if (H5Tequal(native_type, tid_m) != TRUE)
TEST_ERROR;
/* Verify the datatype of each field retrieved and converted */
/* check the char member */
- if((mem_id = H5Tget_member_type(native_type, 0)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 0)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_SCHAR))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_SCHAR))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I8LE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I8LE))
TEST_ERROR;
- if(H5T_INTEGER != H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
/* check the integer member */
- if((mem_id = H5Tget_member_type(native_type, 1)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 1)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_INT))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_INT))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I32LE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I32LE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
/* check the unsigned long long member */
- if((mem_id = H5Tget_member_type(native_type, 3)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 3)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_ULLONG))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_ULLONG))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U64BE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U64BE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
/* check the nested compound member */
- if((nest_mem_id = H5Tget_member_type(native_type, 2)) < 0)
+ if ((nest_mem_id = H5Tget_member_type(native_type, 2)) < 0)
TEST_ERROR;
- if((mem_id = H5Tget_member_type(nest_mem_id, 0)) < 0)
+ if ((mem_id = H5Tget_member_type(nest_mem_id, 0)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_SHORT))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_SHORT))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I16BE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I16BE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
- if((mem_id = H5Tget_member_type(nest_mem_id, 1)) < 0)
+ if ((mem_id = H5Tget_member_type(nest_mem_id, 1)) < 0)
+ TEST_ERROR;
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LONG))
+ TEST_ERROR;
+#if H5_SIZEOF_LONG == 4
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I32LE))
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LONG))
+#elif H5_SIZEOF_LONG == 8
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64LE))
TEST_ERROR;
-#if H5_SIZEOF_LONG==4
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I32LE)) TEST_ERROR;
-#elif H5_SIZEOF_LONG==8
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64LE)) TEST_ERROR;
#else
#error "Unknown 'long' size"
#endif
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
- if((mem_id = H5Tget_member_type(nest_mem_id, 2)) < 0)
+ if ((mem_id = H5Tget_member_type(nest_mem_id, 2)) < 0)
+ TEST_ERROR;
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG))
+ TEST_ERROR;
+#if H5_SIZEOF_LONG_LONG == 4
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I32LE))
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG))
+#elif H5_SIZEOF_LONG_LONG == 8
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64LE))
TEST_ERROR;
-#if H5_SIZEOF_LONG_LONG==4
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I32LE)) TEST_ERROR;
-#elif H5_SIZEOF_LONG_LONG==8
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64LE)) TEST_ERROR;
#else
#error "Unknown 'long long' size"
#endif
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
/* Read the dataset back. Temporary buffer is for special platforms like
* Cray */
- if(NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
+ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR
- if(NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1)))
+ if (NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1)))
TEST_ERROR;
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
TEST_ERROR;
- HDmemcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type));
+ HDmemcpy(check, tmp, DIM0 * DIM1 * H5Tget_size(native_type));
HDfree(tmp);
tmp = NULL;
- if(H5Tconvert(native_type, tid_m, (DIM0 * DIM1), check, bkg, H5P_DEFAULT) < 0)
+ if (H5Tconvert(native_type, tid_m, (DIM0 * DIM1), check, bkg, H5P_DEFAULT) < 0)
TEST_ERROR;
HDfree(bkg);
bkg = NULL;
/* Check that the values read are the same as the values written */
- for(i = 0, temp_point = points, temp_check = check; i < DIM0; i++) {
- for(j = 0; j < DIM1; j++, temp_point++, temp_check++) {
- if(temp_point->c != temp_check->c ||
- temp_point->i != temp_check->i ||
- temp_point->st.c2 != temp_check->st.c2 ||
- temp_point->st.l2 != temp_check->st.l2 ||
- temp_point->st.ll2 != temp_check->st.ll2 ||
- temp_point->l != temp_check->l ) {
+ for (i = 0, temp_point = points, temp_check = check; i < DIM0; i++) {
+ for (j = 0; j < DIM1; j++, temp_point++, temp_check++) {
+ if (temp_point->c != temp_check->c || temp_point->i != temp_check->i ||
+ temp_point->st.c2 != temp_check->st.c2 || temp_point->st.l2 != temp_check->st.l2 ||
+ temp_point->st.ll2 != temp_check->st.ll2 || temp_point->l != temp_check->l) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
goto error;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close temporary datatypes */
- if(H5Tclose(tid2) < 0) TEST_ERROR;
- if(H5Tclose(tid) < 0) TEST_ERROR;
- if(H5Tclose(tid_m2) < 0) TEST_ERROR;
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid_m2) < 0)
+ TEST_ERROR;
/* Close HDF5 objects */
H5Dclose(dataset);
@@ -547,16 +593,17 @@ test_compound_dtype2(hid_t file)
return 0;
error:
- if(tmp)
+ if (tmp)
HDfree(tmp);
- if(bkg)
+ if (bkg)
HDfree(bkg);
- if(points)
+ if (points)
HDfree(points);
- if(check)
+ if (check)
HDfree(check);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid);
H5Tclose(tid2);
H5Tclose(tid_m);
@@ -567,12 +614,12 @@ error:
H5Dclose(dataset);
H5Tclose(dtype);
H5Tclose(native_type);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_dtype
*
@@ -593,32 +640,32 @@ static herr_t
test_compound_dtype(hid_t file)
{
typedef struct {
- char c;
- unsigned int i;
- long long l;
+ char c;
+ unsigned int i;
+ long long l;
} s1;
- hid_t dataset = -1, space = -1;
- hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, mem_id = -1;
- int i, j, n;
- hsize_t dims[2];
- s1 *temp_point = NULL;
- s1 *temp_check = NULL;
- s1 *points = NULL;
- s1 *check = NULL;
- void *tmp = NULL;
- void *bkg = NULL;
+ hid_t dataset = -1, space = -1;
+ hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, mem_id = -1;
+ int i, j, n;
+ hsize_t dims[2];
+ s1 * temp_point = NULL;
+ s1 * temp_check = NULL;
+ s1 * points = NULL;
+ s1 * check = NULL;
+ void * tmp = NULL;
+ void * bkg = NULL;
TESTING("compound datatype");
/* Allocate space for the points & check arrays */
- if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1)))
+ if (NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1)))
TEST_ERROR;
- if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1)))
+ if (NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1)))
TEST_ERROR;
/* Initialize the dataset */
- for(i = n = 0, temp_point = points; i < DIM0; i++)
- for(j = 0; j < DIM1; j++, temp_point++) {
+ for (i = n = 0, temp_point = points; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++, temp_point++) {
temp_point->c = 't';
temp_point->i = (unsigned int)(n++);
temp_point->l = (i * 10 + j * 100) * n;
@@ -627,106 +674,117 @@ test_compound_dtype(hid_t file)
/* Create the data space */
dims[0] = DIM0;
dims[1] = DIM1;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create compound datatype for disk storage */
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR;
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ TEST_ERROR;
/* Insert members */
- if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR;
- if(H5Tinsert(tid, "i", 1, H5T_STD_U32LE) < 0) TEST_ERROR;
- if(H5Tinsert(tid, "l", 5, H5T_STD_I64BE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid, "i", 1, H5T_STD_U32LE) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid, "l", 5, H5T_STD_I64BE) < 0)
+ TEST_ERROR;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_COMPOUND_NAME, tid, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_COMPOUND_NAME, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
TEST_ERROR;
/* Create compound datatype for datatype in memory */
- if((tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR;
- if(H5Tinsert(tid2, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR;
- if(H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_UINT) < 0) TEST_ERROR;
- if(H5Tinsert(tid2, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR;
+ if ((tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid2, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_UINT) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid2, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0)
+ TEST_ERROR;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if (H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
-
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
/* Open dataset again to check H5Tget_native_type */
- if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_COMPOUND_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Tequal(native_type, tid2) != TRUE)
+ if (H5Tequal(native_type, tid2) != TRUE)
TEST_ERROR;
/* Verify the datatype of each field retrieved and converted */
- if((mem_id = H5Tget_member_type(native_type, 0)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 0)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U8LE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U8LE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
- if((mem_id = H5Tget_member_type(native_type, 1)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 1)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UINT))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UINT))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U32LE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U32LE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
- if((mem_id = H5Tget_member_type(native_type, 2)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 2)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64BE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64BE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
/* Read the dataset back. Temporary buffer is for special platforms like
* Cray */
- if(NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
+ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR
- if(NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1)))
+ if (NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1)))
TEST_ERROR
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
TEST_ERROR;
HDmemcpy(check, tmp, DIM0 * DIM1 * H5Tget_size(native_type));
HDfree(tmp);
tmp = NULL;
- if(H5Tconvert(native_type, tid2, (DIM0 * DIM1), check, bkg, H5P_DEFAULT) < 0)
+ if (H5Tconvert(native_type, tid2, (DIM0 * DIM1), check, bkg, H5P_DEFAULT) < 0)
TEST_ERROR;
HDfree(bkg);
bkg = NULL;
/* Check that the values read are the same as the values written */
- for(i = 0, temp_point = points, temp_check = check; i < DIM0; i++)
- for(j = 0; j < DIM1; j++, temp_point++, temp_check++)
- if(temp_point->c != temp_check->c ||
- temp_point->i != temp_check->i ||
- temp_point->l != temp_check->l ) {
+ for (i = 0, temp_point = points, temp_check = check; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++, temp_point++, temp_check++)
+ if (temp_point->c != temp_check->c || temp_point->i != temp_check->i ||
+ temp_point->l != temp_check->l) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
@@ -734,7 +792,8 @@ test_compound_dtype(hid_t file)
} /* end if */
/* Close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
H5Dclose(dataset);
H5Tclose(dtype);
@@ -750,16 +809,17 @@ test_compound_dtype(hid_t file)
error:
/* Free memory for test data */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- if(bkg)
+ if (bkg)
HDfree(bkg);
- if(points)
+ if (points)
HDfree(points);
- if(check)
+ if (check)
HDfree(check);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid);
H5Sclose(space);
H5Tclose(mem_id);
@@ -767,12 +827,12 @@ error:
H5Tclose(dtype);
H5Tclose(native_type);
H5Tclose(tid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_dtype3
*
@@ -793,169 +853,184 @@ static herr_t
test_compound_dtype3(hid_t file)
{
typedef struct {
- char c;
- int a[5];
- long long l;
+ char c;
+ int a[5];
+ long long l;
} s1;
- hid_t dataset = -1, space = -1;
- hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, tid_m = -1,
- tid_m2 = -1, mem_id = -1, nest_mem_id = -1;
- hsize_t array_dims[1] = {5};
- int i, j, k, n;
- hsize_t dims[2];
- s1 *temp_point = NULL, *temp_check = NULL;
- s1 *points = NULL, *check = NULL;
- void *tmp = NULL, *bkg = NULL;
+ hid_t dataset = -1, space = -1;
+ hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, tid_m = -1, tid_m2 = -1, mem_id = -1,
+ nest_mem_id = -1;
+ hsize_t array_dims[1] = {5};
+ int i, j, k, n;
+ hsize_t dims[2];
+ s1 * temp_point = NULL, *temp_check = NULL;
+ s1 * points = NULL, *check = NULL;
+ void * tmp = NULL, *bkg = NULL;
TESTING("compound datatype with array as field");
/* Allocate space for the points & check arrays */
- if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1)))
+ if (NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1)))
TEST_ERROR;
- if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1)))
+ if (NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1)))
TEST_ERROR;
/* Initialize the dataset */
- for(i = n = 0, temp_point = points; i < DIM0; i++)
- for(j = 0; j < DIM1; j++, temp_point++) {
+ for (i = n = 0, temp_point = points; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++, temp_point++) {
temp_point->c = 't';
temp_point->l = (i * 10 + j * 100) * n;
- for(k = 0; k < 5; k++)
+ for (k = 0; k < 5; k++)
(temp_point->a)[k] = n++;
} /* end for */
/* Create the data space */
dims[0] = DIM0;
dims[1] = DIM1;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create array datatype */
- if((tid2 = H5Tarray_create2(H5T_STD_I32LE, 1, array_dims)) < 0) TEST_ERROR;
+ if ((tid2 = H5Tarray_create2(H5T_STD_I32LE, 1, array_dims)) < 0)
+ TEST_ERROR;
/* Create compound datatype for disk storage */
- if((tid = H5Tcreate(H5T_COMPOUND, 29)) < 0) TEST_ERROR;
+ if ((tid = H5Tcreate(H5T_COMPOUND, 29)) < 0)
+ TEST_ERROR;
/* Insert members */
- if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR;
- if(H5Tinsert(tid, "a", 1, tid2) < 0) TEST_ERROR;
- if(H5Tinsert(tid, "l", 21, H5T_STD_I64BE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid, "a", 1, tid2) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid, "l", 21, H5T_STD_I64BE) < 0)
+ TEST_ERROR;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_COMPOUND_NAME_3, tid, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, DSET_COMPOUND_NAME_3, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create array datatype */
- if((tid_m2 = H5Tarray_create2(H5T_NATIVE_INT, 1, array_dims)) < 0) TEST_ERROR;
+ if ((tid_m2 = H5Tarray_create2(H5T_NATIVE_INT, 1, array_dims)) < 0)
+ TEST_ERROR;
/* Create compound datatype for datatype in memory */
- if((tid_m = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "a", HOFFSET(s1, a), tid_m2) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR;
+ if ((tid_m = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "a", HOFFSET(s1, a), tid_m2) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0)
+ TEST_ERROR;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR;
- if(H5Tclose(tid2) < 0) TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
-
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
/* Open dataset again to check H5Tget_native_type */
- if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_3, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_3, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Verify the datatype of each field retrieved and converted */
/* check the char member */
- if((mem_id = H5Tget_member_type(native_type, 0)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 0)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U8LE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U8LE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
/* check the array member */
- if((mem_id = H5Tget_member_type(native_type, 1)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 1)) < 0)
TEST_ERROR;
- if(H5T_ARRAY!=H5Tget_class(mem_id))
+ if (H5T_ARRAY != H5Tget_class(mem_id))
TEST_ERROR;
- if((nest_mem_id = H5Tget_super(mem_id)) < 0)
+ if ((nest_mem_id = H5Tget_super(mem_id)) < 0)
TEST_ERROR;
- if(H5Tget_order(nest_mem_id) != H5Tget_order(H5T_NATIVE_INT))
+ if (H5Tget_order(nest_mem_id) != H5Tget_order(H5T_NATIVE_INT))
TEST_ERROR;
- if(H5Tget_size(nest_mem_id) < H5Tget_size(H5T_STD_I32LE))
+ if (H5Tget_size(nest_mem_id) < H5Tget_size(H5T_STD_I32LE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(nest_mem_id))
+ if (H5T_INTEGER != H5Tget_class(nest_mem_id))
TEST_ERROR;
H5Tclose(nest_mem_id);
H5Tclose(mem_id);
/* check the long long member */
- if((mem_id = H5Tget_member_type(native_type, 2)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 2)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64BE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64BE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
/* Read the dataset back. Temporary buffer is for special platforms like
* Cray */
- if(NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
+ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR;
- if(NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1)))
+ if (NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1)))
TEST_ERROR;
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
TEST_ERROR;
HDmemcpy(check, tmp, DIM0 * DIM1 * H5Tget_size(native_type));
HDfree(tmp);
tmp = NULL;
- if(H5Tconvert(native_type, tid_m, (DIM0 * DIM1), check, bkg, H5P_DEFAULT) < 0)
+ if (H5Tconvert(native_type, tid_m, (DIM0 * DIM1), check, bkg, H5P_DEFAULT) < 0)
TEST_ERROR;
HDfree(bkg);
bkg = NULL;
/* Check that the values read are the same as the values written */
- for(i = 0, temp_point = points, temp_check = check; i < DIM0; i++)
- for(j = 0; j < DIM1; j++, temp_point++, temp_check++) {
- if(temp_point->c != temp_check->c ||
- temp_point->l != temp_check->l ) {
+ for (i = 0, temp_point = points, temp_check = check; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++, temp_point++, temp_check++) {
+ if (temp_point->c != temp_check->c || temp_point->l != temp_check->l) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
goto error;
} /* end if */
- for(k = 0; k < 5; k++) {
- if(temp_point->a[k] != temp_check->a[k]) {
+ for (k = 0; k < 5; k++) {
+ if (temp_point->a[k] != temp_check->a[k]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d,%d\n", i, j, k);
goto error;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
H5Dclose(dataset);
H5Tclose(dtype);
@@ -972,16 +1047,17 @@ test_compound_dtype3(hid_t file)
error:
/* Free memory for test data */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- if(bkg)
+ if (bkg)
HDfree(bkg);
- if(points)
+ if (points)
HDfree(points);
- if(check)
+ if (check)
HDfree(check);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Tclose(mem_id);
H5Tclose(nest_mem_id);
@@ -992,12 +1068,12 @@ error:
H5Tclose(tid2);
H5Tclose(tid_m);
H5Tclose(tid_m2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_compound_opaque
*
@@ -1018,159 +1094,173 @@ static herr_t
test_compound_opaque(hid_t file)
{
typedef struct {
- char c;
- unsigned char o[5];
- long long l;
+ char c;
+ unsigned char o[5];
+ long long l;
} s1;
- hid_t dataset = -1, space = -1;
- hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, tid_m = -1,
- mem_id = -1;
- int i, j, k, n;
- hsize_t dims[2];
- s1 *temp_point = NULL, *temp_check = NULL;
- s1 *points = NULL, *check = NULL;
- void *tmp = NULL, *bkg = NULL;
+ hid_t dataset = -1, space = -1;
+ hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, tid_m = -1, mem_id = -1;
+ int i, j, k, n;
+ hsize_t dims[2];
+ s1 * temp_point = NULL, *temp_check = NULL;
+ s1 * points = NULL, *check = NULL;
+ void * tmp = NULL, *bkg = NULL;
TESTING("compound datatype with opaque field");
/* Allocate space for the points & check arrays */
- if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1)))
+ if (NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1)))
TEST_ERROR;
- if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1)))
+ if (NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1)))
TEST_ERROR;
/* Initialize the dataset */
- for(i = n = 0, temp_point = points; i < DIM0; i++)
- for(j = 0; j < DIM1; j++, temp_point++) {
+ for (i = n = 0, temp_point = points; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++, temp_point++) {
temp_point->c = 't';
temp_point->l = (i * 10 + j * 100) * n;
- for(k = 0; k < 5; k++)
+ for (k = 0; k < 5; k++)
(temp_point->o)[k] = (unsigned char)(n++);
} /* end for */
/* Create the data space */
dims[0] = DIM0;
dims[1] = DIM1;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
/* Create opaque datatype */
- if((tid2 = H5Tcreate(H5T_OPAQUE, sizeof(temp_point->o))) < 0) TEST_ERROR;
- if(H5Tset_tag(tid2, "testing opaque field") < 0) TEST_ERROR;
+ if ((tid2 = H5Tcreate(H5T_OPAQUE, sizeof(temp_point->o))) < 0)
+ TEST_ERROR;
+ if (H5Tset_tag(tid2, "testing opaque field") < 0)
+ TEST_ERROR;
/* Create compound datatype for disk storage */
- if((tid = H5Tcreate(H5T_COMPOUND, 14)) < 0) TEST_ERROR;
+ if ((tid = H5Tcreate(H5T_COMPOUND, 14)) < 0)
+ TEST_ERROR;
/* Insert members */
- if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR;
- if(H5Tinsert(tid, "o", 1, tid2) < 0) TEST_ERROR;
- if(H5Tinsert(tid, "l", 6, H5T_STD_I64BE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid, "o", 1, tid2) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid, "l", 6, H5T_STD_I64BE) < 0)
+ TEST_ERROR;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_COMPOUND_NAME_4, tid, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, DSET_COMPOUND_NAME_4, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create compound datatype for datatype in memory */
- if((tid_m = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "o", HOFFSET(s1, o), tid2) < 0) TEST_ERROR;
- if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR;
+ if ((tid_m = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "o", HOFFSET(s1, o), tid2) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0)
+ TEST_ERROR;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR;
- if(H5Tclose(tid2) < 0) TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
-
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
/* Open dataset again to check H5Tget_native_type */
- if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_4, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_4, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Verify the datatype of each field retrieved and converted */
/* check the char member */
- if((mem_id = H5Tget_member_type(native_type, 0)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 0)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U8LE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U8LE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
/* check the array member */
- if((mem_id = H5Tget_member_type(native_type, 1)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 1)) < 0)
TEST_ERROR;
- if(H5T_OPAQUE!=H5Tget_class(mem_id))
+ if (H5T_OPAQUE != H5Tget_class(mem_id))
TEST_ERROR;
- if(H5Tget_size(mem_id) != sizeof(temp_point->o))
+ if (H5Tget_size(mem_id) != sizeof(temp_point->o))
TEST_ERROR;
H5Tclose(mem_id);
/* check the long long member */
- if((mem_id = H5Tget_member_type(native_type, 2)) < 0)
+ if ((mem_id = H5Tget_member_type(native_type, 2)) < 0)
TEST_ERROR;
- if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG))
+ if (H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG))
TEST_ERROR;
- if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64BE))
+ if (H5Tget_size(mem_id) < H5Tget_size(H5T_STD_I64BE))
TEST_ERROR;
- if(H5T_INTEGER!=H5Tget_class(mem_id))
+ if (H5T_INTEGER != H5Tget_class(mem_id))
TEST_ERROR;
H5Tclose(mem_id);
/* Read the dataset back. Temporary buffer is for special platforms like
* Cray */
- if(NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
+ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR;
- if(NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1)))
+ if (NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1)))
TEST_ERROR;
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
TEST_ERROR;
HDmemcpy(check, tmp, DIM0 * DIM1 * H5Tget_size(native_type));
HDfree(tmp);
tmp = NULL;
- if(H5Tconvert(native_type, tid_m, (DIM0 * DIM1), check, bkg, H5P_DEFAULT) < 0)
+ if (H5Tconvert(native_type, tid_m, (DIM0 * DIM1), check, bkg, H5P_DEFAULT) < 0)
TEST_ERROR;
HDfree(bkg);
bkg = NULL;
/* Check that the values read are the same as the values written */
- for(i = 0, temp_point = points, temp_check = check; i < DIM0; i++)
- for(j = 0; j < DIM1; j++, temp_point++, temp_check++) {
- if(temp_point->c != temp_check->c ||
- temp_point->l != temp_check->l ) {
+ for (i = 0, temp_point = points, temp_check = check; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++, temp_point++, temp_check++) {
+ if (temp_point->c != temp_check->c || temp_point->l != temp_check->l) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
goto error;
} /* end if */
- for(k = 0; k < 5; k++) {
- if(temp_point->o[k] != temp_check->o[k]) {
+ for (k = 0; k < 5; k++) {
+ if (temp_point->o[k] != temp_check->o[k]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d,%d\n", i, j, k);
goto error;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
H5Dclose(dataset);
H5Tclose(dtype);
@@ -1186,16 +1276,17 @@ test_compound_opaque(hid_t file)
error:
/* Free memory for test data */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- if(bkg)
+ if (bkg)
HDfree(bkg);
- if(points)
+ if (points)
HDfree(points);
- if(check)
+ if (check)
HDfree(check);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Tclose(mem_id);
H5Dclose(dataset);
@@ -1204,12 +1295,12 @@ error:
H5Tclose(tid);
H5Tclose(tid2);
H5Tclose(tid_m);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_enum_dtype
*
@@ -1229,101 +1320,102 @@ error:
static herr_t
test_enum_dtype(hid_t file)
{
- hid_t dataset = -1, space = -1;
- hid_t tid = -1, tid_m = -1, dtype = -1, native_type = -1;
- int i, j, n;
- hsize_t dims[2];
- void *tmp = NULL;
- short colors[8];
+ hid_t dataset = -1, space = -1;
+ hid_t tid = -1, tid_m = -1, dtype = -1, native_type = -1;
+ int i, j, n;
+ hsize_t dims[2];
+ void * tmp = NULL;
+ short colors[8];
unsigned char sub_colors[16];
- const char *mname[] = { "RED",
- "GREEN",
- "BLUE",
- "YELLOW",
- "PINK",
- "PURPLE",
- "ORANGE",
- "WHITE" };
+ const char * mname[] = {"RED", "GREEN", "BLUE", "YELLOW", "PINK", "PURPLE", "ORANGE", "WHITE"};
TESTING("enum datatype");
/* Initialize the dataset */
- for(i = 0; i < DIM0; i++)
- for(j = 0, n = 0; j < DIM1; j++, n++)
+ for (i = 0; i < DIM0; i++)
+ for (j = 0, n = 0; j < DIM1; j++, n++)
spoints2[i][j] = (short)((i * 10 + j * 100 + n) % 8);
/* Create the data space */
dims[0] = DIM0;
dims[1] = DIM1;
- if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
/* Construct enum type based on native type */
- if((tid = H5Tenum_create(H5T_STD_I16LE)) < 0) TEST_ERROR;
+ if ((tid = H5Tenum_create(H5T_STD_I16LE)) < 0)
+ TEST_ERROR;
- for(i = 0; i < 8; i++) {
- sub_colors[i * 2] = (unsigned char)i;
+ for (i = 0; i < 8; i++) {
+ sub_colors[i * 2] = (unsigned char)i;
sub_colors[i * 2 + 1] = 0;
- if(H5Tenum_insert(tid, mname[i], &(sub_colors[i*2])) < 0) TEST_ERROR;
+ if (H5Tenum_insert(tid, mname[i], &(sub_colors[i * 2])) < 0)
+ TEST_ERROR;
} /* end for */
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_ENUM_NAME, tid, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_ENUM_NAME, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Construct enum type based on native type in memory */
- if((tid_m = H5Tenum_create(H5T_NATIVE_SHORT)) < 0) TEST_ERROR;
+ if ((tid_m = H5Tenum_create(H5T_NATIVE_SHORT)) < 0)
+ TEST_ERROR;
- for(i = 0; i < 8; i++) {
+ for (i = 0; i < 8; i++) {
colors[i] = (short)i;
- if(H5Tenum_insert(tid_m, mname[i], &(colors[i])) < 0) TEST_ERROR;
+ if (H5Tenum_insert(tid_m, mname[i], &(colors[i])) < 0)
+ TEST_ERROR;
} /* end for */
/* Write the data to the dataset */
- if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, spoints2) < 0)
+ if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, spoints2) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
/* Open dataset again to check H5Tget_native_type */
- if((dataset = H5Dopen2(file, DSET_ENUM_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_ENUM_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Read the dataset back. Temporary buffer is for special platforms like
* Cray */
- if(NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
+ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
TEST_ERROR;
HDmemcpy(scheck2, tmp, DIM0 * DIM1 * H5Tget_size(native_type));
HDfree(tmp);
tmp = NULL;
- if(H5Tconvert(native_type, tid_m, (DIM0 * DIM1), scheck2, NULL, H5P_DEFAULT) < 0)
+ if (H5Tconvert(native_type, tid_m, (DIM0 * DIM1), scheck2, NULL, H5P_DEFAULT) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i = 0; i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
- if(spoints2[i][j] != scheck2[i][j]) {
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ if (spoints2[i][j] != scheck2[i][j]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" spoints2[i][j]=%hd, scheck2[i][j]=%hd\n", spoints2[i][j],
- scheck2[i][j]);
+ HDprintf(" spoints2[i][j]=%hd, scheck2[i][j]=%hd\n", spoints2[i][j], scheck2[i][j]);
goto error;
} /* end if */
@@ -1336,22 +1428,23 @@ test_enum_dtype(hid_t file)
error:
/* Free memory for test data */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dataset);
H5Tclose(dtype);
H5Tclose(native_type);
H5Tclose(tid);
H5Tclose(tid_m);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_array_dtype
*
@@ -1372,109 +1465,124 @@ static herr_t
test_array_dtype(hid_t file)
{
typedef struct {
- char c;
- int i;
+ char c;
+ int i;
long long l;
} s1;
- hid_t dataset = -1, space = -1;
- hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, tid3 = -1, tid_m = -1;
- int i, j, k, n;
- hsize_t space_dims[2], array_dims[1]={5};
- s1 *temp_point = NULL, *temp_check = NULL;
- s1 *points = NULL, *check = NULL;
- void *tmp = NULL;
+ hid_t dataset = -1, space = -1;
+ hid_t dtype = -1, native_type = -1, tid = -1, tid2 = -1, tid3 = -1, tid_m = -1;
+ int i, j, k, n;
+ hsize_t space_dims[2], array_dims[1] = {5};
+ s1 * temp_point = NULL, *temp_check = NULL;
+ s1 * points = NULL, *check = NULL;
+ void * tmp = NULL;
TESTING("array of compound datatype");
/* Allocate space for the points & check arrays */
- if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1 * 5)))
+ if (NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1 * 5)))
TEST_ERROR;
- if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1 * 5)))
+ if (NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1 * 5)))
TEST_ERROR;
/* Initialize the dataset */
- for(i = n = 0, temp_point = points; i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
- for(k = 0; k < 5; k++,temp_point++) {
- temp_point->c= 't';
- temp_point->i= n++;
- temp_point->l= (i * 10 + j * 100) * n;
+ for (i = n = 0, temp_point = points; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ for (k = 0; k < 5; k++, temp_point++) {
+ temp_point->c = 't';
+ temp_point->i = n++;
+ temp_point->l = (i * 10 + j * 100) * n;
} /* end for */
/* Create the data space */
space_dims[0] = DIM0;
space_dims[1] = DIM1;
- if((space = H5Screate_simple(2, space_dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, space_dims, NULL)) < 0)
+ TEST_ERROR;
/* Create compound datatype for disk storage */
- if((tid2 = H5Tcreate(H5T_COMPOUND, 13)) < 0) TEST_ERROR;
+ if ((tid2 = H5Tcreate(H5T_COMPOUND, 13)) < 0)
+ TEST_ERROR;
/* Insert members */
- if(H5Tinsert(tid2, "c", 0, H5T_STD_U8BE) < 0) TEST_ERROR;
- if(H5Tinsert(tid2, "i", 1, H5T_STD_U32LE) < 0) TEST_ERROR;
- if(H5Tinsert(tid2, "l", 5, H5T_STD_I64BE) < 0) TEST_ERROR;
+ if (H5Tinsert(tid2, "c", 0, H5T_STD_U8BE) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid2, "i", 1, H5T_STD_U32LE) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid2, "l", 5, H5T_STD_I64BE) < 0)
+ TEST_ERROR;
/* Create array datatype for disk storage */
- if((tid = H5Tarray_create2(tid2, 1, array_dims)) < 0) TEST_ERROR;
+ if ((tid = H5Tarray_create2(tid2, 1, array_dims)) < 0)
+ TEST_ERROR;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_ARRAY_NAME, tid, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_ARRAY_NAME, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create compound datatype for datatype in memory */
- if((tid3 = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR;
- if(H5Tinsert(tid3, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR;
- if(H5Tinsert(tid3, "i", HOFFSET(s1, i), H5T_NATIVE_UINT) < 0) TEST_ERROR;
- if(H5Tinsert(tid3, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR;
+ if ((tid3 = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid3, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid3, "i", HOFFSET(s1, i), H5T_NATIVE_UINT) < 0)
+ TEST_ERROR;
+ if (H5Tinsert(tid3, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0)
+ TEST_ERROR;
/* Create array datatype for memory */
- if((tid_m = H5Tarray_create2(tid3, 1, array_dims)) < 0) TEST_ERROR;
+ if ((tid_m = H5Tarray_create2(tid3, 1, array_dims)) < 0)
+ TEST_ERROR;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR;
- if(H5Tclose(tid2) < 0) TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
/* Open dataset again to check H5Tget_native_type */
- if((dataset = H5Dopen2(file, DSET_ARRAY_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_ARRAY_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Read the dataset back. Temporary buffer is for special platforms like
* Cray */
- if(NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
+ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
TEST_ERROR;
HDmemcpy(check, tmp, DIM0 * DIM1 * H5Tget_size(native_type));
HDfree(tmp);
tmp = NULL;
- if(H5Tconvert(native_type, tid_m, (DIM0 * DIM1), check, NULL, H5P_DEFAULT) < 0)
+ if (H5Tconvert(native_type, tid_m, (DIM0 * DIM1), check, NULL, H5P_DEFAULT) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i = 0, temp_point = points, temp_check = check; i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
- for(k = 0; k < 5; k++, temp_point++, temp_check++)
- if(temp_point->c != temp_check->c ||
- temp_point->i != temp_check->i ||
- temp_point->l != temp_check->l ) {
+ for (i = 0, temp_point = points, temp_check = check; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ for (k = 0; k < 5; k++, temp_point++, temp_check++)
+ if (temp_point->c != temp_check->c || temp_point->i != temp_check->i ||
+ temp_point->l != temp_check->l) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
@@ -1482,11 +1590,16 @@ test_array_dtype(hid_t file)
} /* end if */
/* Close HDF5 objects */
- if(H5Dclose(dataset)) TEST_ERROR;
- if(H5Tclose(native_type)) TEST_ERROR;
- if(H5Tclose(dtype)) TEST_ERROR;
- if(H5Tclose(tid_m) < 0) TEST_ERROR;
- if(H5Tclose(tid3) < 0) TEST_ERROR;
+ if (H5Dclose(dataset))
+ TEST_ERROR;
+ if (H5Tclose(native_type))
+ TEST_ERROR;
+ if (H5Tclose(dtype))
+ TEST_ERROR;
+ if (H5Tclose(tid_m) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid3) < 0)
+ TEST_ERROR;
/* Free memory for test data */
HDfree(points);
@@ -1497,14 +1610,15 @@ test_array_dtype(hid_t file)
error:
/* Free memory for test data */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- if(points)
+ if (points)
HDfree(points);
- if(check)
+ if (check)
HDfree(check);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dataset);
H5Tclose(dtype);
@@ -1513,12 +1627,12 @@ error:
H5Tclose(tid2);
H5Tclose(tid3);
H5Tclose(tid_m);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_array_dtype2
*
@@ -1538,77 +1652,84 @@ error:
static herr_t
test_array_dtype2(hid_t file)
{
- hid_t dataset = -1, space = -1;
- hid_t dtype = -1, native_type = -1, tid = -1, tid_m = -1;
- int i, j, k, n;
- hsize_t space_dims[2], array_dims[1] = {5};
- void *tmp = NULL;
+ hid_t dataset = -1, space = -1;
+ hid_t dtype = -1, native_type = -1, tid = -1, tid_m = -1;
+ int i, j, k, n;
+ hsize_t space_dims[2], array_dims[1] = {5};
+ void * tmp = NULL;
TESTING("array of atomic datatype");
/* Initialize the dataset */
- for(i = n = 0;i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
- for(k = 0; k < 5; k++)
+ for (i = n = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ for (k = 0; k < 5; k++)
ipoints3[i][j][k] = n++;
/* Create the data space */
space_dims[0] = DIM0;
space_dims[1] = DIM1;
- if((space = H5Screate_simple(2, space_dims, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, space_dims, NULL)) < 0)
+ TEST_ERROR;
/* Create array datatype for disk storage */
- if((tid = H5Tarray_create2(H5T_STD_I32LE, 1, array_dims)) < 0) TEST_ERROR;
+ if ((tid = H5Tarray_create2(H5T_STD_I32LE, 1, array_dims)) < 0)
+ TEST_ERROR;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_ARRAY2_NAME, tid, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_ARRAY2_NAME, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create array datatype for memory */
- if((tid_m = H5Tarray_create2(H5T_NATIVE_INT, 1, array_dims)) < 0) TEST_ERROR;
+ if ((tid_m = H5Tarray_create2(H5T_NATIVE_INT, 1, array_dims)) < 0)
+ TEST_ERROR;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints3) < 0)
+ if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints3) < 0)
TEST_ERROR;
/* Close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
/* Close dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
/* Open dataset again to check H5Tget_native_type */
- if((dataset = H5Dopen2(file, DSET_ARRAY2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_ARRAY2_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Read the dataset back. Temporary buffer is for special platforms like
* Cray */
- if(NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
+ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type))))
TEST_ERROR
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0)
TEST_ERROR;
HDmemcpy(icheck3, tmp, DIM0 * DIM1 * H5Tget_size(native_type));
HDfree(tmp);
tmp = NULL;
- if(H5Tconvert(native_type, tid_m, (DIM0 * DIM1), icheck3, NULL, H5P_DEFAULT) < 0)
+ if (H5Tconvert(native_type, tid_m, (DIM0 * DIM1), icheck3, NULL, H5P_DEFAULT) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i = 0; i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
- for(k = 0; k < 5; k++)
- if(icheck3[i][j][k] != ipoints3[i][j][k]) {
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ for (k = 0; k < 5; k++)
+ if (icheck3[i][j][k] != ipoints3[i][j][k]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d,%d\n", i, j);
@@ -1616,32 +1737,37 @@ test_array_dtype2(hid_t file)
} /* end if */
/* Close HDF5 objects */
- if(H5Dclose(dataset)) TEST_ERROR;
- if(H5Tclose(native_type)) TEST_ERROR;
- if(H5Tclose(dtype)) TEST_ERROR;
- if(H5Tclose(tid_m) < 0) TEST_ERROR;
+ if (H5Dclose(dataset))
+ TEST_ERROR;
+ if (H5Tclose(native_type))
+ TEST_ERROR;
+ if (H5Tclose(dtype))
+ TEST_ERROR;
+ if (H5Tclose(tid_m) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
/* Free memory for test data */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dataset);
H5Tclose(dtype);
H5Tclose(native_type);
H5Tclose(tid);
H5Tclose(tid_m);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_vl_dtype
*
@@ -1661,153 +1787,175 @@ error:
static herr_t
test_vl_dtype(hid_t file)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hvl_t *t1, *t2; /* Temporary pointer to VL information */
- hsize_t dims1[] = {SPACE1_DIM1};
- hid_t dataset = -1, space = -1;
- hid_t dtype = -1, native_type = -1, nat_super_type = -1, tid = -1, tid2 = -1, tid_m = -1, tid_m2 = -1;
- size_t i, j, k;
- void **tmp = NULL;
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hvl_t * t1, *t2; /* Temporary pointer to VL information */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t dataset = -1, space = -1;
+ hid_t dtype = -1, native_type = -1, nat_super_type = -1, tid = -1, tid2 = -1, tid_m = -1, tid_m2 = -1;
+ size_t i, j, k;
+ void ** tmp = NULL;
TESTING("variable length datatype");
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
wdata[i].p = HDmalloc((i + 1) * sizeof(hvl_t));
- if(NULL == wdata[i].p) {
+ if (NULL == wdata[i].p) {
H5_FAILED();
- HDprintf(" Cannot allocate memory for VL data! i=%u\n",(unsigned)i);
+ HDprintf(" Cannot allocate memory for VL data! i=%u\n", (unsigned)i);
goto error;
} /* end if */
wdata[i].len = i + 1;
- for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
+ for (t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
t1->p = HDmalloc((j + 1) * sizeof(unsigned int));
- if(NULL == t1->p) {
+ if (NULL == t1->p) {
H5_FAILED();
- HDprintf(" Cannot allocate memory for VL data! i=%u, j=%u\n",(unsigned)i,(unsigned)j);
+ HDprintf(" Cannot allocate memory for VL data! i=%u, j=%u\n", (unsigned)i, (unsigned)j);
goto error;
} /* end if */
t1->len = j + 1;
- for(k = 0; k < (j + 1); k++)
+ for (k = 0; k < (j + 1); k++)
((unsigned int *)t1->p)[k] = (unsigned int)(i * 100 + j * 10 + k);
} /* end for */
- } /* end for */
+ } /* end for */
/* Create dataspace for datasets */
- if((space = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
+ TEST_ERROR;
/* Create the base VL type */
- if((tid2 = H5Tvlen_create (H5T_STD_U32LE)) < 0) TEST_ERROR;
+ if ((tid2 = H5Tvlen_create(H5T_STD_U32LE)) < 0)
+ TEST_ERROR;
/* Create a VL datatype for disk storage */
- if((tid = H5Tvlen_create(tid2)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(tid2)) < 0)
+ TEST_ERROR
/* Create a dataset */
- if((dataset = H5Dcreate2(file, DSET_VL_NAME, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET_VL_NAME, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create a base VL datatype for memory */
- if((tid_m2 = H5Tvlen_create(H5T_NATIVE_UINT)) < 0) TEST_ERROR;
+ if ((tid_m2 = H5Tvlen_create(H5T_NATIVE_UINT)) < 0)
+ TEST_ERROR;
/* Create a VL datatype for memory */
- if((tid_m = H5Tvlen_create (tid_m2)) < 0) TEST_ERROR;
+ if ((tid_m = H5Tvlen_create(tid_m2)) < 0)
+ TEST_ERROR;
/* Write dataset to disk */
- if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
+ if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR;
- if(H5Tclose(tid) < 0) TEST_ERROR;
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR;
/* Open a dataset */
- if((dataset = H5Dopen2(file, DSET_VL_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_VL_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get native datatype for dataset */
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Also get native base type for this nested VL type. Should be an integer type. */
- if((nat_super_type = H5Tget_super(native_type)) < 0)
+ if ((nat_super_type = H5Tget_super(native_type)) < 0)
TEST_ERROR;
- if((nat_super_type = H5Tget_super(nat_super_type)) < 0)
+ if ((nat_super_type = H5Tget_super(nat_super_type)) < 0)
TEST_ERROR;
/* Read dataset from disk */
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR;
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
+ TEST_ERROR;
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(wdata[i].len != rdata[i].len) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
H5_FAILED();
- HDprintf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ HDprintf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", (int)i,
+ (int)wdata[i].len, (int)i, (int)rdata[i].len);
goto error;
} /* end if */
- for(t1 = (hvl_t *)wdata[i].p, t2 = (hvl_t *)rdata[i].p, j = 0; j < rdata[i].len; j++, t1++, t2++) {
- if(t1->len != t2->len) {
+ for (t1 = (hvl_t *)wdata[i].p, t2 = (hvl_t *)rdata[i].p, j = 0; j < rdata[i].len; j++, t1++, t2++) {
+ if (t1->len != t2->len) {
H5_FAILED();
- HDprintf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ HDprintf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", (int)i,
+ (int)wdata[i].len, (int)i, (int)rdata[i].len);
goto error;
} /* end if */
/* use temporary buffer to convert datatype. This is for special
* platforms like Cray */
- if(NULL == (tmp = (void **)HDmalloc(t2->len * sizeof(unsigned int))))
+ if (NULL == (tmp = (void **)HDmalloc(t2->len * sizeof(unsigned int))))
TEST_ERROR
HDmemcpy(tmp, t2->p, t2->len * H5Tget_size(nat_super_type));
- if(H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT) < 0)
+ if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT) < 0)
TEST_ERROR;
- for(k = 0; k < t2->len; k++) {
- if(((unsigned int *)t1->p)[k] != ((unsigned int *)tmp)[k]) {
+ for (k = 0; k < t2->len; k++) {
+ if (((unsigned int *)t1->p)[k] != ((unsigned int *)tmp)[k]) {
H5_FAILED();
- HDprintf(" VL data don't match!, wdata[%u].p=%d, rdata[%u].p=%u\n",
- (unsigned)i, ((unsigned int*)t1->p)[k], (unsigned)i, ((unsigned int*)tmp)[k]);
+ HDprintf(" VL data don't match!, wdata[%u].p=%d, rdata[%u].p=%u\n", (unsigned)i,
+ ((unsigned int *)t1->p)[k], (unsigned)i, ((unsigned int *)tmp)[k]);
goto error;
} /* end if */
- } /* end for */
+ } /* end for */
HDfree(tmp);
tmp = NULL;
} /* end for */
- } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
- if(H5Treclaim(native_type, space, H5P_DEFAULT, rdata) < 0) TEST_ERROR;
+ if (H5Treclaim(native_type, space, H5P_DEFAULT, rdata) < 0)
+ TEST_ERROR;
/* Reclaim the write VL data */
- if(H5Treclaim(native_type, space, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
+ if (H5Treclaim(native_type, space, H5P_DEFAULT, wdata) < 0)
+ TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(native_type) < 0) TEST_ERROR;
- native_type = -1; /* reset so that error handling can check for VL reclaim */
- if(H5Tclose(dtype) < 0) TEST_ERROR;
- if(H5Tclose(tid_m) < 0) TEST_ERROR;
- if(H5Tclose(tid_m2) < 0) TEST_ERROR;
-
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ native_type = -1; /* reset so that error handling can check for VL reclaim */
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid_m) < 0)
+ TEST_ERROR;
+ if (H5Tclose(tid_m2) < 0)
+ TEST_ERROR;
/* Close disk dataspace */
- if(H5Sclose(space) < 0) TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
/* Free memory for test data */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- H5E_BEGIN_TRY {
- if(native_type > 0) {
+ H5E_BEGIN_TRY
+ {
+ if (native_type > 0) {
H5Treclaim(native_type, space, H5P_DEFAULT, rdata);
H5Treclaim(native_type, space, H5P_DEFAULT, wdata);
} /* end if */
@@ -1820,12 +1968,12 @@ error:
H5Tclose(tid2);
H5Tclose(tid_m);
H5Tclose(tid_m2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_vl_type() */
-
/*-------------------------------------------------------------------------
* Function: test_vlstr_dtype
*
@@ -1846,88 +1994,100 @@ static herr_t
test_vlstr_dtype(hid_t file)
{
/* Information to write */
- const char *wdata[SPACE1_DIM1]= {
- "Four score and seven years ago our forefathers brought forth on this continent a new nation,",
- "conceived in liberty and dedicated to the proposition that all men are created equal.",
- "Now we are engaged in a great civil war,",
- "testing whether that nation or any nation so conceived and so dedicated can long endure."
- };
- char *rdata[SPACE1_DIM1]; /* Information read in */
- hbool_t rdata_alloc = FALSE; /* Whether the read data is allocated */
- hid_t dataset = -1; /* Dataset ID */
- hid_t sid1 = -1; /* Dataspace ID */
- hid_t tid1 = -1, dtype = -1, native_type = -1; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i; /* counting variable */
+ const char *wdata[SPACE1_DIM1] = {
+ "Four score and seven years ago our forefathers brought forth on this continent a new nation,",
+ "conceived in liberty and dedicated to the proposition that all men are created equal.",
+ "Now we are engaged in a great civil war,",
+ "testing whether that nation or any nation so conceived and so dedicated can long endure."};
+ char * rdata[SPACE1_DIM1]; /* Information read in */
+ hbool_t rdata_alloc = FALSE; /* Whether the read data is allocated */
+ hid_t dataset = -1; /* Dataset ID */
+ hid_t sid1 = -1; /* Dataspace ID */
+ hid_t tid1 = -1, dtype = -1, native_type = -1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ unsigned i; /* counting variable */
/* Output message about test being performed */
TESTING("variable length string datatype");
/* Create dataspace for datasets */
- if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) TEST_ERROR;
+ if ((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
+ TEST_ERROR;
/* Create a datatype to refer to */
- if((tid1 = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR;
+ if ((tid1 = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR;
- if(H5Tset_size(tid1,H5T_VARIABLE) < 0) TEST_ERROR;
- if(H5T_STRING != H5Tget_class(tid1) || !H5Tis_variable_str(tid1))
+ if (H5Tset_size(tid1, H5T_VARIABLE) < 0)
+ TEST_ERROR;
+ if (H5T_STRING != H5Tget_class(tid1) || !H5Tis_variable_str(tid1))
TEST_ERROR;
/* Create a dataset */
- if((dataset = H5Dcreate2(file, DSET_VLSTR_NAME, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dcreate2(file, DSET_VLSTR_NAME, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Write dataset to disk */
- if(H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
+ if (H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Open a dataset */
- if((dataset = H5Dopen2(file, DSET_VLSTR_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_VLSTR_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get datatype for dataset */
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
/* Construct native type */
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Check if the data type is equal */
- if(!H5Tequal(native_type, tid1))
+ if (!H5Tequal(native_type, tid1))
TEST_ERROR;
/* Read dataset from disk */
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR;
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
+ TEST_ERROR;
rdata_alloc = TRUE;
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
H5_FAILED();
- HDprintf(" VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
- (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
+ HDprintf(" VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i,
+ (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
goto error;
} /* end if */
- if(HDstrcmp(wdata[i], rdata[i]) != 0 ) {
+ if (HDstrcmp(wdata[i], rdata[i]) != 0) {
H5_FAILED();
- HDprintf(" VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
- (int)i, wdata[i], (int)i, rdata[i]);
+ HDprintf(" VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i],
+ (int)i, rdata[i]);
goto error;
} /* end if */
- } /* end for */
+ } /* end for */
/* Close Dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid1) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
+ if (H5Tclose(tid1) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
/* Close disk dataspace */
- if(H5Sclose(sid1) < 0) TEST_ERROR;
+ if (H5Sclose(sid1) < 0)
+ TEST_ERROR;
/* Free memory for rdata */
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
HDfree(rdata[i]);
rdata_alloc = FALSE;
@@ -1935,24 +2095,25 @@ test_vlstr_dtype(hid_t file)
return 0;
error:
- if(rdata_alloc) {
+ if (rdata_alloc) {
/* Free memory for rdata */
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
HDfree(rdata[i]);
} /* end if */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Tclose(dtype);
H5Tclose(native_type);
H5Tclose(sid1);
H5Tclose(tid1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_vlstr_dtype() */
-
/*-------------------------------------------------------------------------
* Function: test_str_dtype
*
@@ -1972,99 +2133,109 @@ error:
static herr_t
test_str_dtype(hid_t file)
{
- const char wdata[SPACE1_DIM1][4]= {
- "one",
- "two",
- "3rd",
- "4th"
- }; /* Information to write */
- char rdata[SPACE1_DIM1][4]; /* Information read in */
- hid_t dataset = -1; /* Dataset ID */
- hid_t sid1 = -1; /* Dataspace ID */
- hid_t tid1 = -1, dtype = -1, native_type = -1; /* Datatype ID */
+ const char wdata[SPACE1_DIM1][4] = {"one", "two", "3rd", "4th"}; /* Information to write */
+ char rdata[SPACE1_DIM1][4]; /* Information read in */
+ hid_t dataset = -1; /* Dataset ID */
+ hid_t sid1 = -1; /* Dataspace ID */
+ hid_t tid1 = -1, dtype = -1, native_type = -1; /* Datatype ID */
hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i; /* counting variable */
+ unsigned i; /* counting variable */
/* Output message about test being performed */
TESTING("fixed-length string datatype");
/* Create dataspace for datasets */
- if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) TEST_ERROR;
+ if ((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
+ TEST_ERROR;
/* Create a datatype to refer to */
- if((tid1 = H5Tcopy (H5T_C_S1)) < 0) TEST_ERROR;
+ if ((tid1 = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR;
- if(H5Tset_size(tid1, 4) < 0) TEST_ERROR;
- if(H5T_STRING != H5Tget_class(tid1)) TEST_ERROR;
+ if (H5Tset_size(tid1, 4) < 0)
+ TEST_ERROR;
+ if (H5T_STRING != H5Tget_class(tid1))
+ TEST_ERROR;
/* Create a dataset */
- if((dataset = H5Dcreate2(file, DSET_STR_NAME, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dcreate2(file, DSET_STR_NAME, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Write dataset to disk */
- if(H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
+ if (H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Open a dataset */
- if((dataset = H5Dopen2(file, DSET_STR_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_STR_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Get datatype for dataset */
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
/* Construct native type */
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Check if the data type is equal */
- if(!H5Tequal(native_type, tid1) || H5T_STRING!=H5Tget_class(native_type))
+ if (!H5Tequal(native_type, tid1) || H5T_STRING != H5Tget_class(native_type))
TEST_ERROR;
/* Read dataset from disk */
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR;
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
+ TEST_ERROR;
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
H5_FAILED();
- HDprintf(" data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
- (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
+ HDprintf(" data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i,
+ (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
goto error;
} /* end if */
- if(HDstrcmp(wdata[i], rdata[i]) != 0 ) {
+ if (HDstrcmp(wdata[i], rdata[i]) != 0) {
H5_FAILED();
- HDprintf(" data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
- (int)i, wdata[i], (int)i, rdata[i]);
+ HDprintf(" data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], (int)i,
+ rdata[i]);
goto error;
} /* end if */
- } /* end for */
+ } /* end for */
/* Close Dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid1) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
+ if (H5Tclose(tid1) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
/* Close disk dataspace */
- if(H5Sclose(sid1) < 0) TEST_ERROR;
+ if (H5Sclose(sid1) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Tclose(dtype);
H5Tclose(native_type);
H5Tclose(tid1);
H5Tclose(sid1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_str_dtype() */
-
/*-------------------------------------------------------------------------
* Function: test_refer_dtype
*
@@ -2088,124 +2259,126 @@ test_refer_dtype(hid_t file)
typedef struct s1_t {
unsigned int a;
unsigned int b;
- float c;
+ float c;
} s1_t;
- hid_t dataset = -1; /* Dataset ID */
- hid_t group = -1; /* Group ID */
- hid_t sid1 = -1; /* Dataspace ID */
- hid_t tid1 = -1, dtype = -1, native_type = -1; /* Datatype ID */
- hsize_t dims1[] = {1};
- H5O_type_t obj_type; /* Object type */
- hobj_ref_t *wbuf = NULL, /* buffer to write to disk */
- *rbuf = NULL; /* buffer read from disk */
+ hid_t dataset = -1; /* Dataset ID */
+ hid_t group = -1; /* Group ID */
+ hid_t sid1 = -1; /* Dataspace ID */
+ hid_t tid1 = -1, dtype = -1, native_type = -1; /* Datatype ID */
+ hsize_t dims1[] = {1};
+ H5O_type_t obj_type; /* Object type */
+ hobj_ref_t *wbuf = NULL, /* buffer to write to disk */
+ *rbuf = NULL; /* buffer read from disk */
/* Output message about test being performed */
TESTING("reference datatype");
/* Allocate write & read buffers */
- if(NULL == (wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)))))
+ if (NULL == (wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)))))
TEST_ERROR
- if(NULL == (rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)))))
+ if (NULL == (rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)))))
TEST_ERROR
/* Create dataspace for datasets */
- if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
+ if ((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
TEST_ERROR;
/* Create a group */
- if((group = H5Gcreate2(file, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gcreate2(file, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a datatype to refer to */
- if((tid1 = H5Tcreate (H5T_COMPOUND, sizeof(s1_t))) < 0)
+ if ((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0)
TEST_ERROR;
/* Insert fields */
- if(H5Tinsert (tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0)
TEST_ERROR;
- if(H5Tinsert (tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0)
TEST_ERROR;
- if(H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0)
+ if (H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0)
TEST_ERROR;
/* Save datatype for later */
- if(H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid1) < 0)
+ if (H5Tclose(tid1) < 0)
TEST_ERROR;
/* Close group */
- if(H5Gclose(group) < 0)
+ if (H5Gclose(group) < 0)
TEST_ERROR;
/* Create a dataset */
- if((dataset = H5Dcreate2(file, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset =
+ H5Dcreate2(file, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create reference to named datatype */
- if(H5Rcreate(wbuf, file, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(wbuf, file, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1) < 0)
TEST_ERROR;
- if(H5Rget_obj_type2(dataset, H5R_OBJECT, wbuf, &obj_type) < 0)
+ if (H5Rget_obj_type2(dataset, H5R_OBJECT, wbuf, &obj_type) < 0)
TEST_ERROR;
- if(obj_type != H5O_TYPE_NAMED_DATATYPE)
+ if (obj_type != H5O_TYPE_NAMED_DATATYPE)
TEST_ERROR;
/* Write selection to disk */
- if(H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
TEST_ERROR;
/* Close disk dataspace */
- if(H5Sclose(sid1) < 0)
+ if (H5Sclose(sid1) < 0)
TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR;
/* Open the dataset */
- if((dataset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Get datatype for dataset */
- if((dtype = H5Dget_type(dataset)) < 0)
+ if ((dtype = H5Dget_type(dataset)) < 0)
TEST_ERROR;
/* Construct native type */
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Check if the data type is equal */
- if(!H5Tequal(native_type, H5T_STD_REF_OBJ))
+ if (!H5Tequal(native_type, H5T_STD_REF_OBJ))
TEST_ERROR;
/* Read selection from disk */
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
TEST_ERROR;
/* Open datatype object */
- if((tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, rbuf)) < 0)
+ if ((tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, rbuf)) < 0)
TEST_ERROR;
/* Verify correct datatype */
- if(H5Tget_class(tid1) != H5T_COMPOUND)
+ if (H5Tget_class(tid1) != H5T_COMPOUND)
TEST_ERROR;
- if(H5Tget_nmembers(tid1)!=3)
+ if (H5Tget_nmembers(tid1) != 3)
TEST_ERROR;
/* Close datatype */
- if(H5Tclose(tid1) < 0)
+ if (H5Tclose(tid1) < 0)
TEST_ERROR;
- if(H5Tclose(native_type) < 0)
+ if (H5Tclose(native_type) < 0)
TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR;
/* Free memory buffers */
@@ -2217,23 +2390,24 @@ test_refer_dtype(hid_t file)
return 0;
error:
- if(wbuf)
+ if (wbuf)
HDfree(wbuf);
- if(rbuf)
+ if (rbuf)
HDfree(rbuf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid1);
H5Gclose(group);
H5Tclose(tid1);
H5Tclose(dtype);
H5Tclose(native_type);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-} /* test_refer_dtype() */
-
+} /* test_refer_dtype() */
/*-------------------------------------------------------------------------
* Function: test_refer_dtype2
@@ -2254,172 +2428,171 @@ error:
static herr_t
test_refer_dtype2(hid_t file)
{
- hid_t dset1 = -1, /* Dataset ID */
- dset2 = -1; /* Dereferenced dataset ID */
- hid_t sid1 = -1, /* Dataspace ID #1 */
- sid2 = -1; /* Dataspace ID #2 */
+ hid_t dset1 = -1, /* Dataset ID */
+ dset2 = -1; /* Dereferenced dataset ID */
+ hid_t sid1 = -1, /* Dataspace ID #1 */
+ sid2 = -1; /* Dataspace ID #2 */
hid_t dtype = -1, native_type = -1;
- hsize_t dims1[] = { 1 }, dims2[] = { SPACE2_DIM1, SPACE2_DIM2 };
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hdset_reg_ref_t wbuf, /* buffer to write to disk */
- rbuf; /* buffer read from disk */
- uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */
- *drbuf = NULL; /* Buffer for reading numeric data from disk */
- uint8_t *tu8 = NULL; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Object type */
- int i; /* counting variables */
+ hsize_t dims1[] = {1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hdset_reg_ref_t wbuf, /* buffer to write to disk */
+ rbuf; /* buffer read from disk */
+ uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */
+ *drbuf = NULL; /* Buffer for reading numeric data from disk */
+ uint8_t * tu8 = NULL; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Object type */
+ int i; /* counting variables */
/* Output message about test being performed */
TESTING("dataset region reference");
/* Allocate write & read buffers */
- if(NULL == (dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2)))
+ if (NULL == (dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2)))
TEST_ERROR
- if(NULL == (drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2)))
+ if (NULL == (drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2)))
TEST_ERROR
/* Create dataspace for datasets */
- if((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0)
+ if ((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0)
TEST_ERROR;
/* Create a dataset */
- if((dset2 = H5Dcreate2(file, "Dataset2", H5T_STD_U8LE, sid2, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset2 = H5Dcreate2(file, "Dataset2", H5T_STD_U8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
+ for (tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
*tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
- if(H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf) < 0)
+ if (H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf) < 0)
TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dset2) < 0)
+ if (H5Dclose(dset2) < 0)
TEST_ERROR;
/* Create dataspace for the reference dataset */
- if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
+ if ((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
TEST_ERROR;
/* Create a reference dataset */
- if((dset1 = H5Dcreate2(file, "Dataset1", H5T_STD_REF_DSETREG, sid1,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset1 = H5Dcreate2(file, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create references */
/* Select 6x6 hyperslab for first reference */
- start[0] = 2;
- start[1] = 2;
+ start[0] = 2;
+ start[1] = 2;
stride[0] = 1;
stride[1] = 1;
- count[0] = 1;
- count[1] = 1;
- block[0] = 6;
- block[1] = 6;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 6;
+ block[1] = 6;
- if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR;
- if((int)H5Sget_select_npoints(sid2) != 36)
+ if ((int)H5Sget_select_npoints(sid2) != 36)
TEST_ERROR;
/* Store first dataset region */
- if(H5Rcreate(&wbuf, file, "/Dataset2", H5R_DATASET_REGION, sid2) < 0)
+ if (H5Rcreate(&wbuf, file, "/Dataset2", H5R_DATASET_REGION, sid2) < 0)
TEST_ERROR;
- if(H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf, &obj_type) < 0)
+ if (H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf, &obj_type) < 0)
TEST_ERROR;
- if(obj_type != H5O_TYPE_DATASET)
+ if (obj_type != H5O_TYPE_DATASET)
TEST_ERROR;
/* Write selection to disk */
- if(H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
TEST_ERROR;
/* Close disk dataspace */
- if(H5Sclose(sid1) < 0)
+ if (H5Sclose(sid1) < 0)
TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dset1) < 0)
+ if (H5Dclose(dset1) < 0)
TEST_ERROR;
/* Close uint8 dataset dataspace */
- if(H5Sclose(sid2) < 0)
+ if (H5Sclose(sid2) < 0)
TEST_ERROR;
/* Open the dataset */
- if((dset1 = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0)
+ if ((dset1 = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Get datatype for dataset */
- if((dtype = H5Dget_type(dset1)) < 0)
+ if ((dtype = H5Dget_type(dset1)) < 0)
TEST_ERROR;
/* Construct native type */
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
/* Check if the data type is equal */
- if(!H5Tequal(native_type, H5T_STD_REF_DSETREG))
+ if (!H5Tequal(native_type, H5T_STD_REF_DSETREG))
TEST_ERROR;
/* Read selection from disk */
- if(H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
TEST_ERROR;
/* Try to open objects */
- if((dset2 = H5Rdereference2(dset1, H5P_DEFAULT, H5R_DATASET_REGION, &rbuf)) < 0)
+ if ((dset2 = H5Rdereference2(dset1, H5P_DEFAULT, H5R_DATASET_REGION, &rbuf)) < 0)
TEST_ERROR;
/* Check what H5Rget_obj_type2 function returns */
- if(H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf, &obj_type) < 0)
+ if (H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf, &obj_type) < 0)
TEST_ERROR;
- if(obj_type != H5O_TYPE_DATASET)
+ if (obj_type != H5O_TYPE_DATASET)
TEST_ERROR;
/* Check information in referenced dataset */
- if((sid1 = H5Dget_space(dset2)) < 0)
+ if ((sid1 = H5Dget_space(dset2)) < 0)
TEST_ERROR;
- if((int)H5Sget_simple_extent_npoints(sid1) != 100)
+ if ((int)H5Sget_simple_extent_npoints(sid1) != 100)
TEST_ERROR;
/* Read from disk */
- if(H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf) < 0)
+ if (H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf) < 0)
TEST_ERROR;
- for(tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
- if(*tu8 != (uint8_t)(i * 3))
+ for (tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
+ if (*tu8 != (uint8_t)(i * 3))
TEST_ERROR;
/* Get the hyperslab selection */
- if((sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf)) < 0)
+ if ((sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf)) < 0)
TEST_ERROR;
/* Verify correct hyperslab selected */
- if((int)H5Sget_select_npoints(sid2) != 36)
+ if ((int)H5Sget_select_npoints(sid2) != 36)
TEST_ERROR;
- if((int)H5Sget_select_hyper_nblocks(sid2) != 1)
+ if ((int)H5Sget_select_hyper_nblocks(sid2) != 1)
TEST_ERROR;
/* Close region space */
- if(H5Sclose(sid2) < 0)
+ if (H5Sclose(sid2) < 0)
TEST_ERROR;
/* Close first space */
- if(H5Sclose(sid1) < 0)
+ if (H5Sclose(sid1) < 0)
TEST_ERROR;
/* Close dereferenced Dataset */
- if(H5Dclose(dset2) < 0)
+ if (H5Dclose(dset2) < 0)
TEST_ERROR;
/* Close Dataset */
- if(H5Dclose(dset1) < 0)
+ if (H5Dclose(dset1) < 0)
TEST_ERROR;
/* Free memory buffers */
@@ -2431,23 +2604,24 @@ test_refer_dtype2(hid_t file)
error:
/* Free memory buffers */
- if(dwbuf)
+ if (dwbuf)
HDfree(dwbuf);
- if(drbuf)
+ if (drbuf)
HDfree(drbuf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid2);
H5Sclose(sid1);
H5Tclose(dtype);
H5Tclose(native_type);
H5Dclose(dset2);
H5Dclose(dset1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-} /* test_refer_dtype2() */
-
+} /* test_refer_dtype2() */
/*-------------------------------------------------------------------------
* Function: test_opaque_dtype
@@ -2469,72 +2643,85 @@ static herr_t
test_opaque_dtype(hid_t file)
{
hid_t type = -1, space = -1, dset = -1;
- hid_t dataset = -1, dtype = -1, native_type = -1;
- size_t i;
- unsigned char wbuf[32], rbuf[32];
- hsize_t nelmts;
+ hid_t dataset = -1, dtype = -1, native_type = -1;
+ size_t i;
+ unsigned char wbuf[32], rbuf[32];
+ hsize_t nelmts;
TESTING("opaque datatype");
/* opaque_1 */
nelmts = sizeof(wbuf);
- if((type = H5Tcreate(H5T_OPAQUE, 1)) < 0) TEST_ERROR;
- if(H5Tset_tag(type, "testing 1-byte opaque type") < 0) TEST_ERROR;
- if((space = H5Screate_simple(1, &nelmts, NULL)) < 0) TEST_ERROR;
- if((dset = H5Dcreate2(file, DSET_OPAQUE_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((type = H5Tcreate(H5T_OPAQUE, 1)) < 0)
+ TEST_ERROR;
+ if (H5Tset_tag(type, "testing 1-byte opaque type") < 0)
+ TEST_ERROR;
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) < 0)
+ TEST_ERROR;
+ if ((dset = H5Dcreate2(file, DSET_OPAQUE_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- for(i = 0; i < sizeof(wbuf); i++)
+ for (i = 0; i < sizeof(wbuf); i++)
wbuf[i] = (unsigned char)(0xff ^ i);
- if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
- if(H5Sclose(space) < 0) TEST_ERROR;
- if(H5Dclose(dset) < 0) TEST_ERROR;
-
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset) < 0)
+ TEST_ERROR;
/* Open dataset again to check H5Tget_native_type */
- if((dataset = H5Dopen2(file, DSET_OPAQUE_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset = H5Dopen2(file, DSET_OPAQUE_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR;
- if(!H5Tequal(native_type, type)) TEST_ERROR;
+ if (!H5Tequal(native_type, type))
+ TEST_ERROR;
- if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
TEST_ERROR;
- for(i = 0; i < sizeof(rbuf); i++)
- if(rbuf[i] != wbuf[i]) {
+ for (i = 0; i < sizeof(rbuf); i++)
+ if (rbuf[i] != wbuf[i]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %u\n", (unsigned)i);
goto error;
} /* end if */
- if(H5Tclose(type) < 0) TEST_ERROR;
- if(H5Tclose(dtype) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if (H5Tclose(type) < 0)
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Tclose(type);
H5Tclose(dtype);
H5Tclose(native_type);
H5Dclose(dset);
H5Dclose(dataset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_opaque_dtype */
-
/*-------------------------------------------------------------------------
* Function: test_bitfield_dtype
*
@@ -2557,61 +2744,76 @@ error:
static herr_t
test_bitfield_dtype(hid_t file)
{
- hid_t type=-1, space=-1, dset1=-1, dset2=-1;
- hid_t dataset1=-1, dataset2=-1, dtype=-1, native_type=-1;
- size_t ntype_size, i;
- unsigned char wbuf[BITFIELD_ENUMB*sizeof(int)];
- unsigned char *p=NULL;
- void *rbuf = NULL;
- unsigned int intw[BITFIELD_ENUMB], intr[BITFIELD_ENUMB];
+ hid_t type = -1, space = -1, dset1 = -1, dset2 = -1;
+ hid_t dataset1 = -1, dataset2 = -1, dtype = -1, native_type = -1;
+ size_t ntype_size, i;
+ unsigned char wbuf[BITFIELD_ENUMB * sizeof(int)];
+ unsigned char *p = NULL;
+ void * rbuf = NULL;
+ unsigned int intw[BITFIELD_ENUMB], intr[BITFIELD_ENUMB];
hsize_t nelmts;
TESTING("bitfield datatype");
nelmts = BITFIELD_ENUMB;
- if((type = H5Tcopy(H5T_STD_B32BE)) < 0) TEST_ERROR;
+ if ((type = H5Tcopy(H5T_STD_B32BE)) < 0)
+ TEST_ERROR;
- if((space = H5Screate_simple(1, &nelmts, NULL)) < 0) TEST_ERROR;
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) < 0)
+ TEST_ERROR;
/* Create and write to dataset1 with a unsigned char buffer */
- if((dset1 = H5Dcreate2(file, DSET1_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dset1 = H5Dcreate2(file, DSET1_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR;
- for(i = 0; i < BITFIELD_ENUMB*sizeof(int); i++)
+ for (i = 0; i < BITFIELD_ENUMB * sizeof(int); i++)
wbuf[i] = (unsigned char)((unsigned int)0xff ^ (unsigned int)i);
- if(H5Dwrite(dset1, H5T_NATIVE_B32, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
- if(H5Dclose(dset1) < 0) TEST_ERROR;
+ if (H5Dwrite(dset1, H5T_NATIVE_B32, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset1) < 0)
+ TEST_ERROR;
/* Create and write to dataset2 with a unsigned int buffer */
- if((dset2 = H5Dcreate2(file, DSET2_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dset2 = H5Dcreate2(file, DSET2_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR;
- for(i = 0; i < BITFIELD_ENUMB; i++)
- intw[i] = (unsigned int)0xff << (unsigned int)((i*8)%32);
+ for (i = 0; i < BITFIELD_ENUMB; i++)
+ intw[i] = (unsigned int)0xff << (unsigned int)((i * 8) % 32);
- if(H5Dwrite(dset2, H5T_NATIVE_B32, H5S_ALL, H5S_ALL, H5P_DEFAULT, intw) < 0) TEST_ERROR;
- if(H5Dclose(dset2) < 0) TEST_ERROR;
- if(H5Sclose(space) < 0) TEST_ERROR;
- if(H5Tclose(type) < 0) TEST_ERROR;
+ if (H5Dwrite(dset2, H5T_NATIVE_B32, H5S_ALL, H5S_ALL, H5P_DEFAULT, intw) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset2) < 0)
+ TEST_ERROR;
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
+ if (H5Tclose(type) < 0)
+ TEST_ERROR;
/* Open dataset1 again to check H5Tget_native_type */
- if((dataset1 = H5Dopen2(file, DSET1_BITFIELD_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset1 = H5Dopen2(file, DSET1_BITFIELD_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset1)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset1)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR;
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ TEST_ERROR;
- if((ntype_size = H5Tget_size(native_type)) == 0) TEST_ERROR;
+ if ((ntype_size = H5Tget_size(native_type)) == 0)
+ TEST_ERROR;
- rbuf = HDmalloc((size_t)nelmts*ntype_size);
+ rbuf = HDmalloc((size_t)nelmts * ntype_size);
/* Read the data and compare them */
- if(H5Dread(dataset1, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
+ if (H5Dread(dataset1, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR;
p = (unsigned char *)rbuf;
- for(i = 0; i < BITFIELD_ENUMB*4; i++) {
- if(*p != wbuf[i]) {
+ for (i = 0; i < BITFIELD_ENUMB * 4; i++) {
+ if (*p != wbuf[i]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %zu\n", i);
@@ -2620,23 +2822,31 @@ test_bitfield_dtype(hid_t file)
p++;
}
- if(H5Tclose(dtype) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
- if(H5Dclose(dataset1) < 0) TEST_ERROR;
- if(rbuf) HDfree(rbuf);
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dataset1) < 0)
+ TEST_ERROR;
+ if (rbuf)
+ HDfree(rbuf);
/* Open dataset2 again to check H5Tget_native_type */
- if((dataset2 = H5Dopen2(file, DSET2_BITFIELD_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((dataset2 = H5Dopen2(file, DSET2_BITFIELD_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if((dtype = H5Dget_type(dataset2)) < 0) TEST_ERROR;
+ if ((dtype = H5Dget_type(dataset2)) < 0)
+ TEST_ERROR;
- if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR;
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ TEST_ERROR;
/* Read the data and compare them */
- if(H5Dread(dataset2, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, intr) < 0) TEST_ERROR;
+ if (H5Dread(dataset2, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, intr) < 0)
+ TEST_ERROR;
- for(i = 0; i < BITFIELD_ENUMB; i++) {
- if(intr[i] != intw[i]) {
+ for (i = 0; i < BITFIELD_ENUMB; i++) {
+ if (intr[i] != intw[i]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %zu\n", i);
@@ -2644,15 +2854,19 @@ test_bitfield_dtype(hid_t file)
}
}
- if(H5Tclose(dtype) < 0) TEST_ERROR;
- if(H5Tclose(native_type) < 0) TEST_ERROR;
- if(H5Dclose(dataset2) < 0) TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dataset2) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Tclose(type);
H5Tclose(dtype);
@@ -2661,12 +2875,12 @@ error:
H5Dclose(dset2);
H5Dclose(dataset1);
H5Dclose(dataset2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_bitfield_dtype */
-
/*-------------------------------------------------------------------------
* Function: test_ninteger
*
@@ -2686,27 +2900,27 @@ error:
static herr_t
test_ninteger(void)
{
- hid_t fid1 = -1; /* file ID */
- hid_t fid2 = -1; /* file ID */
- hid_t did1 = -1; /* dataset ID */
- hid_t did2 = -1; /* dataset ID */
- hid_t sid1 = -1; /* dataspace ID */
- hid_t dcpl1 = -1; /* dataset creation property list ID */
- hid_t dcpl2 = -1; /* dataset creation property list ID */
- hid_t tid1 = -1; /* file datatype */
- hid_t tid2 = -1; /* file datatype */
- hid_t nid1 = -1; /* native datatype */
- hid_t nid2 = -1; /* native datatype */
- hsize_t dims[1] = {DIM3}; /* dataspace dimensions */
- hsize_t nelmts; /* number of elements in dataset */
- int rank = 1; /* rank of dataset */
- int buf[DIM3];
- int chk[DIM3];
- int i;
+ hid_t fid1 = -1; /* file ID */
+ hid_t fid2 = -1; /* file ID */
+ hid_t did1 = -1; /* dataset ID */
+ hid_t did2 = -1; /* dataset ID */
+ hid_t sid1 = -1; /* dataspace ID */
+ hid_t dcpl1 = -1; /* dataset creation property list ID */
+ hid_t dcpl2 = -1; /* dataset creation property list ID */
+ hid_t tid1 = -1; /* file datatype */
+ hid_t tid2 = -1; /* file datatype */
+ hid_t nid1 = -1; /* native datatype */
+ hid_t nid2 = -1; /* native datatype */
+ hsize_t dims[1] = {DIM3}; /* dataspace dimensions */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank = 1; /* rank of dataset */
+ int buf[DIM3];
+ int chk[DIM3];
+ int i;
TESTING("native integer ");
- for(i = 0; i < DIM3; i++)
+ for (i = 0; i < DIM3; i++)
buf[i] = i;
/*-------------------------------------------------------------------------
@@ -2714,26 +2928,34 @@ test_ninteger(void)
*-------------------------------------------------------------------------
*/
/* create a file using default properties */
- if((fid1 = H5Fcreate("tstint1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fcreate("tstint1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* create a data space */
- if((sid1 = H5Screate_simple(rank, dims, NULL)) < 0) FAIL_STACK_ERROR
+ if ((sid1 = H5Screate_simple(rank, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* create dcpl */
- if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* create a dataset */
- if((did1 = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, sid1, H5P_DEFAULT, dcpl1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((did1 = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, sid1, H5P_DEFAULT, dcpl1, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* write */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ FAIL_STACK_ERROR
/* close */
- if(H5Sclose(sid1) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl1) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
/*-------------------------------------------------------------------------
* step 2: open and create another file copying the data from file1
@@ -2741,71 +2963,87 @@ test_ninteger(void)
*/
/* open */
- if((fid1 = H5Fopen("tstint1.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fid1 = H5Fopen("tstint1.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open dataset */
- if((did1 = H5Dopen2(fid1, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((did1 = H5Dopen2(fid1, "dset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- if((sid1 = H5Dget_space(did1)) < 0) FAIL_STACK_ERROR
+ if ((sid1 = H5Dget_space(did1)) < 0)
+ FAIL_STACK_ERROR
/* get dcpl */
- if((dcpl1 = H5Dget_create_plist(did1)) < 0) FAIL_STACK_ERROR
+ if ((dcpl1 = H5Dget_create_plist(did1)) < 0)
+ FAIL_STACK_ERROR
/* get file datatype */
- if((tid1 = H5Dget_type(did1)) < 0) FAIL_STACK_ERROR
+ if ((tid1 = H5Dget_type(did1)) < 0)
+ FAIL_STACK_ERROR
/* get native datatype */
- if((nid1 = H5Tget_native_type(tid1, H5T_DIR_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((nid1 = H5Tget_native_type(tid1, H5T_DIR_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* get size */
- if(H5Tget_size(nid1) == 0) FAIL_STACK_ERROR
+ if (H5Tget_size(nid1) == 0)
+ FAIL_STACK_ERROR
/* get rank */
- if((rank = H5Sget_simple_extent_ndims(sid1)) < 0) FAIL_STACK_ERROR
+ if ((rank = H5Sget_simple_extent_ndims(sid1)) < 0)
+ FAIL_STACK_ERROR
HDmemset(dims, 0, sizeof dims);
/* get dimension */
- if(H5Sget_simple_extent_dims(sid1, dims, NULL) < 0) FAIL_STACK_ERROR
+ if (H5Sget_simple_extent_dims(sid1, dims, NULL) < 0)
+ FAIL_STACK_ERROR
nelmts = 1;
- for(i = 0; i < rank; i++)
+ for (i = 0; i < rank; i++)
nelmts *= dims[i];
/* read */
- if(H5Dread(did1, nid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, chk) < 0) FAIL_STACK_ERROR
+ if (H5Dread(did1, nid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, chk) < 0)
+ FAIL_STACK_ERROR
/* create a file using default properties */
- if((fid2 = H5Fcreate("tstint2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fid2 = H5Fcreate("tstint2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* create a dataset using the native type */
- if((did2 = H5Dcreate2(fid2, "dset", nid1, sid1, H5P_DEFAULT, dcpl1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((did2 = H5Dcreate2(fid2, "dset", nid1, sid1, H5P_DEFAULT, dcpl1, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* write */
- if(H5Dwrite(did2, nid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, chk) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(did2, nid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, chk) < 0)
+ FAIL_STACK_ERROR
/* get dcpl */
- if((dcpl2 = H5Dget_create_plist(did2)) < 0) FAIL_STACK_ERROR
+ if ((dcpl2 = H5Dget_create_plist(did2)) < 0)
+ FAIL_STACK_ERROR
/* get file datatype */
- if((tid2 = H5Dget_type(did2)) < 0) FAIL_STACK_ERROR
+ if ((tid2 = H5Dget_type(did2)) < 0)
+ FAIL_STACK_ERROR
/* get native datatype */
- if((nid2 = H5Tget_native_type(tid2, H5T_DIR_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((nid2 = H5Tget_native_type(tid2, H5T_DIR_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* check */
- if(H5Tget_precision(nid1) != H5Tget_precision(nid2)) {
+ if (H5Tget_precision(nid1) != H5Tget_precision(nid2)) {
HDprintf(" Precision differ.\n");
TEST_ERROR
} /* end if */
/* compare dataset creation property lists */
- if(H5Pequal(dcpl1, dcpl2) <= 0) {
+ if (H5Pequal(dcpl1, dcpl2) <= 0) {
HDprintf(" Property lists differ.\n");
TEST_ERROR
} /* end if */
/* check */
- for(i = 0; i < DIM3; i++)
- if(buf[i] != chk[i]) {
+ for (i = 0; i < DIM3; i++)
+ if (buf[i] != chk[i]) {
H5_FAILED();
HDprintf(" Read different values than written.\n");
HDprintf(" At index %d\n", i);
@@ -2813,23 +3051,35 @@ test_ninteger(void)
} /* end if */
/* close */
- if(H5Sclose(sid1) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl1) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl2) < 0) FAIL_STACK_ERROR
- if(H5Tclose(tid1) < 0) FAIL_STACK_ERROR
- if(H5Tclose(tid2) < 0) FAIL_STACK_ERROR
- if(H5Tclose(nid1) < 0) FAIL_STACK_ERROR
- if(H5Tclose(nid2) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did1) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(tid1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(tid2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(nid1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(nid2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl1);
H5Pclose(dcpl2);
H5Tclose(tid1);
@@ -2841,12 +3091,12 @@ error:
H5Sclose(sid1);
H5Fclose(fid1);
H5Fclose(fid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_ninteger() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2862,41 +3112,41 @@ error:
int
main(void)
{
- hid_t file, fapl;
- int nerrors = 0;
- char filename[1024];
+ hid_t file, fapl;
+ int nerrors = 0;
+ char filename[1024];
h5_reset();
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- nerrors += test_atomic_dtype(file) < 0 ? 1 : 0;
- nerrors += test_compound_dtype(file) < 0 ? 1 : 0;
- nerrors += test_compound_dtype2(file) < 0 ? 1 : 0;
- nerrors += test_compound_dtype3(file) < 0 ? 1 : 0;
- nerrors += test_compound_opaque(file) < 0 ? 1 : 0;
- nerrors += test_enum_dtype(file) < 0 ? 1 : 0;
- nerrors += test_array_dtype(file) < 0 ? 1 : 0;
- nerrors += test_array_dtype2(file) < 0 ? 1 : 0;
- nerrors += test_vl_dtype(file) < 0 ? 1 : 0;
- nerrors += test_vlstr_dtype(file) < 0 ? 1 : 0;
- nerrors += test_str_dtype(file) < 0 ? 1 : 0;
- nerrors += test_refer_dtype(file) < 0 ? 1 : 0;
- nerrors += test_refer_dtype2(file) < 0 ? 1 : 0;
- nerrors += test_opaque_dtype(file) < 0 ? 1 : 0;
- nerrors += test_bitfield_dtype(file) < 0 ? 1 : 0;
- nerrors += test_ninteger() < 0 ? 1 : 0;
-
- if(H5Fclose(file) < 0)
+ nerrors += test_atomic_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_compound_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_compound_dtype2(file) < 0 ? 1 : 0;
+ nerrors += test_compound_dtype3(file) < 0 ? 1 : 0;
+ nerrors += test_compound_opaque(file) < 0 ? 1 : 0;
+ nerrors += test_enum_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_array_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_array_dtype2(file) < 0 ? 1 : 0;
+ nerrors += test_vl_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_vlstr_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_str_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_refer_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_refer_dtype2(file) < 0 ? 1 : 0;
+ nerrors += test_opaque_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_bitfield_dtype(file) < 0 ? 1 : 0;
+ nerrors += test_ninteger() < 0 ? 1 : 0;
+
+ if (H5Fclose(file) < 0)
goto error;
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if(nerrors)
+ if (nerrors)
goto error;
HDprintf("All native datatype tests passed.\n");
@@ -2905,15 +3155,15 @@ main(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file);
h5_cleanup(FILENAME, fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
nerrors = MAX(1, nerrors);
- HDprintf("***** %d DATASET TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return 1;
}
-
diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c
index ef76fe6..095169c 100644
--- a/test/null_vol_connector.c
+++ b/test/null_vol_connector.c
@@ -15,129 +15,147 @@
* (registration, etc.).
*/
-
/* Public HDF5 header */
#include "hdf5.h"
/* For HDF5 plugin functionality */
#include "H5PLextern.h"
-
/* This connector's header */
#include "null_vol_connector.h"
/* The VOL class struct */
static const H5VL_class_t null_vol_g = {
- 0, /* version */
- NULL_VOL_CONNECTOR_VALUE, /* value */
- NULL_VOL_CONNECTOR_NAME, /* name */
- 0, /* capability flags */
- NULL, /* initialize */
- NULL, /* terminate */
- { /* info_cls */
- (size_t)0, /* size */
- NULL, /* copy */
- NULL, /* compare */
- NULL, /* free */
- NULL, /* to_str */
- NULL, /* from_str */
+ 0, /* version */
+ NULL_VOL_CONNECTOR_VALUE, /* value */
+ NULL_VOL_CONNECTOR_NAME, /* name */
+ 0, /* capability flags */
+ NULL, /* initialize */
+ NULL, /* terminate */
+ {
+ /* info_cls */
+ (size_t)0, /* size */
+ NULL, /* copy */
+ NULL, /* compare */
+ NULL, /* free */
+ NULL, /* to_str */
+ NULL, /* from_str */
},
- { /* wrap_cls */
- NULL, /* get_object */
- NULL, /* get_wrap_ctx */
- NULL, /* wrap_object */
- NULL, /* unwrap_object */
- NULL, /* free_wrap_ctx */
+ {
+ /* wrap_cls */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* unwrap_object */
+ NULL, /* free_wrap_ctx */
},
- { /* attribute_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* read */
- NULL, /* write */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* attribute_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* dataset_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* read */
- NULL, /* write */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* dataset_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* datatype_cls */
- NULL, /* commit */
- NULL, /* open */
- NULL, /* get_size */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* datatype_cls */
+ NULL, /* commit */
+ NULL, /* open */
+ NULL, /* get_size */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* file_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* file_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* group_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* group_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* link_cls */
- NULL, /* create */
- NULL, /* copy */
- NULL, /* move */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ {
+ /* link_cls */
+ NULL, /* create */
+ NULL, /* copy */
+ NULL, /* move */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
- { /* object_cls */
- NULL, /* open */
- NULL, /* copy */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ {
+ /* object_cls */
+ NULL, /* open */
+ NULL, /* copy */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
- { /* introspect_cls */
- NULL, /* get_conn_cls */
- NULL, /* opt_query */
+ {
+ /* introspect_cls */
+ NULL, /* get_conn_cls */
+ NULL, /* opt_query */
},
- { /* request_cls */
- NULL, /* wait */
- NULL, /* notify */
- NULL, /* cancel */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* free */
+ {
+ /* request_cls */
+ NULL, /* wait */
+ NULL, /* notify */
+ NULL, /* cancel */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* free */
},
- { /* blob_cls */
- NULL, /* put */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ {
+ /* blob_cls */
+ NULL, /* put */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
- { /* token_cls */
- NULL, /* cmp */
- NULL, /* to_str */
- NULL /* from_str */
+ {
+ /* token_cls */
+ NULL, /* cmp */
+ NULL, /* to_str */
+ NULL /* from_str */
},
- NULL /* optional */
+ NULL /* optional */
};
/* These two functions are necessary to load this plugin using
* the HDF5 library.
*/
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_VOL;}
-const void *H5PLget_plugin_info(void) {return &null_vol_g;}
-
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_VOL;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return &null_vol_g;
+}
diff --git a/test/null_vol_connector.h b/test/null_vol_connector.h
index 11c8826..e4c7cd894 100644
--- a/test/null_vol_connector.h
+++ b/test/null_vol_connector.h
@@ -18,8 +18,7 @@
#ifndef _null_vol_connector_H
#define _null_vol_connector_H
-#define NULL_VOL_CONNECTOR_VALUE ((H5VL_class_value_t)160)
-#define NULL_VOL_CONNECTOR_NAME "null_vol_connector"
+#define NULL_VOL_CONNECTOR_VALUE ((H5VL_class_value_t)160)
+#define NULL_VOL_CONNECTOR_NAME "null_vol_connector"
#endif /* _null_vol_connector_H */
-
diff --git a/test/objcopy.c b/test/objcopy.c
index 5174700..383bd05 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -23,172 +23,155 @@
#include "H5Iprivate.h"
#include "H5Pprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
/*
* This file needs to access private information from the H5S package.
* This file also needs to access the dataspace testing code.
*/
-#define H5S_FRIEND /*suppress error about including H5Spkg */
+#define H5S_FRIEND /*suppress error about including H5Spkg */
#define H5S_TESTING
-#include "H5Spkg.h" /* Dataspaces */
+#include "H5Spkg.h" /* Dataspaces */
/*
* This file needs to access private information from the H5P package.
* This file also needs to access the property list testing code.
*/
-#define H5P_FRIEND /*suppress error about including H5Ppkg */
+#define H5P_FRIEND /*suppress error about including H5Ppkg */
#define H5P_TESTING
-#include "H5Ppkg.h" /* Property Lists */
+#include "H5Ppkg.h" /* Property Lists */
/*
* This file needs to access private information from the H5D package.
* This file also needs to access the dataset testing code.
*/
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
#define H5D_TESTING
-#include "H5Dpkg.h" /* Datasets */
+#include "H5Dpkg.h" /* Datasets */
/*
* This file needs to access private information from the H5O package.
* This file also needs to access the dataspace testing code.
*/
-#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
-#include "H5Opkg.h" /* Object header */
+#include "H5Opkg.h" /* Object header */
-
-const char *FILENAME[] = {
- "objcopy_src",
- "objcopy_dst",
- "objcopy_ext",
- "objcopy_src2",
- "verbound_src",
- "verbound_dst",
- NULL
-};
+const char *FILENAME[] = {"objcopy_src", "objcopy_dst", "objcopy_ext", "objcopy_src2",
+ "verbound_src", "verbound_dst", NULL};
/* Configuration, really a series of bit flags. Maximum value is all three
* bit flags enabled.
*/
-#define CONFIG_SHARE_SRC 1
-#define CONFIG_SHARE_DST 2
+#define CONFIG_SHARE_SRC 1
+#define CONFIG_SHARE_DST 2
#define CONFIG_SRC_NEW_FORMAT 4
#define CONFIG_DST_NEW_FORMAT 8
-#define CONFIG_DENSE 16
-#define MAX_CONFIGURATION 31
+#define CONFIG_DENSE 16
+#define MAX_CONFIGURATION 31
-#define FILE_EXT "objcopy_ext.dat"
+#define FILE_EXT "objcopy_ext.dat"
/* The fill_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory
* for version 1.4(after 1.4.3). To get this data file, simply compile
* gen_old_fill.c with HDF5 library (before v1.5) and run it. */
-#define FILE_OLD_LAYOUT "fill_old.h5"
-
-
-#define NAME_DATATYPE_SIMPLE "H5T_NATIVE_INT"
-#define NAME_DATATYPE_SIMPLE2 "H5T_NATIVE_INT-2"
-#define NAME_DATATYPE_VL "vlen of int"
-#define NAME_DATATYPE_VL_VL "vlen of vlen of int"
-#define NAME_DATASET_SIMPLE "dataset_simple"
-#define NAME_DATASET_SIMPLE2 "dataset_simple_copy"
-#define NAME_DATASET_SIMPLE3 "dataset_simple_another_copy"
-#define NAME_DATASET_COMPOUND "dataset_compound"
-#define NAME_DATASET_CHUNKED "dataset_chunked"
-#define NAME_DATASET_CHUNKED_SINGLE "dataset_chunked_single"
-#define NAME_DATASET_CHUNKED2 "dataset_chunked2"
-#define NAME_DATASET_CHUNKED2_SINGLE "dataset_chunked2_single"
-#define NAME_DATASET_CHUNKED3 "dataset_chunked3"
-#define NAME_DATASET_CHUNKED3_SINGLE "dataset_chunked3_single"
-#define NAME_DATASET_CHUNKED4 "dataset_chunked4"
-#define NAME_DATASET_CHUNKED4_SINGLE "dataset_chunked4_single"
-#define NAME_DATASET_COMPACT "dataset_compact"
-#define NAME_DATASET_EXTERNAL "dataset_ext"
+#define FILE_OLD_LAYOUT "fill_old.h5"
+
+#define NAME_DATATYPE_SIMPLE "H5T_NATIVE_INT"
+#define NAME_DATATYPE_SIMPLE2 "H5T_NATIVE_INT-2"
+#define NAME_DATATYPE_VL "vlen of int"
+#define NAME_DATATYPE_VL_VL "vlen of vlen of int"
+#define NAME_DATASET_SIMPLE "dataset_simple"
+#define NAME_DATASET_SIMPLE2 "dataset_simple_copy"
+#define NAME_DATASET_SIMPLE3 "dataset_simple_another_copy"
+#define NAME_DATASET_COMPOUND "dataset_compound"
+#define NAME_DATASET_CHUNKED "dataset_chunked"
+#define NAME_DATASET_CHUNKED_SINGLE "dataset_chunked_single"
+#define NAME_DATASET_CHUNKED2 "dataset_chunked2"
+#define NAME_DATASET_CHUNKED2_SINGLE "dataset_chunked2_single"
+#define NAME_DATASET_CHUNKED3 "dataset_chunked3"
+#define NAME_DATASET_CHUNKED3_SINGLE "dataset_chunked3_single"
+#define NAME_DATASET_CHUNKED4 "dataset_chunked4"
+#define NAME_DATASET_CHUNKED4_SINGLE "dataset_chunked4_single"
+#define NAME_DATASET_COMPACT "dataset_compact"
+#define NAME_DATASET_EXTERNAL "dataset_ext"
#define NAME_DATASET_NAMED_DTYPE "dataset_named_dtype"
-#define NAME_DATASET_NAMED_DTYPE2 "dataset_named_dtype2"
-#define NAME_DATASET_MULTI_OHDR "dataset_multi_ohdr"
+#define NAME_DATASET_NAMED_DTYPE2 "dataset_named_dtype2"
+#define NAME_DATASET_MULTI_OHDR "dataset_multi_ohdr"
#define NAME_DATASET_MULTI_OHDR2 "dataset_multi_ohdr2"
-#define NAME_DATASET_VL "dataset_vl"
-#define NAME_DATASET_VL2 "dataset_vl2"
-#define NAME_DATASET_VL_VL "dataset_vl_vl"
-#define NAME_DATASET_VL_VL2 "dataset_vl_vl2"
-#define NAME_DATASET_CMPD_VL "dataset_cmpd_vl"
-#define NAME_DATASET_SUB_SUB "/g0/g00/g000/dataset_simple"
-#define NAME_GROUP_UNCOPIED "/uncopied"
-#define NAME_GROUP_EMPTY "/empty"
-#define NAME_GROUP_TOP "/g0"
-#define NAME_GROUP_TOP2 "/g1"
-#define NAME_GROUP_TOP3 "/g2"
-#define NAME_GROUP_TOP4 "/g3"
-#define NAME_GROUP_SUB "/g0/g00"
-#define NAME_GROUP_SUB_2 "/g0/g01"
-#define NAME_GROUP_SUB_SUB "/g0/g00/g000"
-#define NAME_GROUP_SUB_SUB2 "g000"
-#define NAME_GROUP_DATASET "/g0/dataset_simple"
-#define NAME_GROUP_LINK "/g_links"
-#define NAME_GROUP_LINK2 "/g_links2"
-#define NAME_GROUP_LOOP "g_loop"
-#define NAME_GROUP_LOOP2 "g_loop2"
-#define NAME_GROUP_LOOP3 "g_loop3"
-#define NAME_GROUP_REF "ref_grp"
-#define NAME_LINK_DATASET "/g_links/dataset_simple"
-#define NAME_LINK_HARD "/g_links/hard_link_to_dataset_simple"
-#define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple"
-#define NAME_LINK_SOFT2 "/g_links2/soft_link_to_dataset_simple"
-#define NAME_LINK_EXTERN "/g_links/external_link_to_dataset_simple"
-#define NAME_LINK_EXTERN2 "/g_links2/external_link_to_dataset_simple"
-#define NAME_LINK_SOFT_DANGLE "/g_links/soft_link_to_nowhere"
-#define NAME_LINK_SOFT_DANGLE2 "/g_links2/soft_link_to_nowhere"
-#define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere"
-#define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere"
-#define NAME_OLD_FORMAT "/dset1"
-
-#define NAME_BUF_SIZE 1024
-#define ATTR_NAME_LEN 80
-#define DIM_SIZE_1 12
-#define DIM_SIZE_2 6
-#define MAX_DIM_SIZE_1 100
-#define MAX_DIM_SIZE_2 80
-#define CHUNK_SIZE_1 5 /* Not an even fraction of dimension sizes, so we test copying partial chunks */
-#define CHUNK_SIZE_2 5
-#define NUM_SUB_GROUPS 20
-#define NUM_WIDE_LOOP_GROUPS 10
-#define NUM_DATASETS 10
-#define ATTR_CMPD_STRING "ThisIsAString"
-
-char src_obj_full_name[215]; /* the full path + name of the object to be copied */
-
-unsigned num_attributes_g; /* Number of attributes created */
+#define NAME_DATASET_VL "dataset_vl"
+#define NAME_DATASET_VL2 "dataset_vl2"
+#define NAME_DATASET_VL_VL "dataset_vl_vl"
+#define NAME_DATASET_VL_VL2 "dataset_vl_vl2"
+#define NAME_DATASET_CMPD_VL "dataset_cmpd_vl"
+#define NAME_DATASET_SUB_SUB "/g0/g00/g000/dataset_simple"
+#define NAME_GROUP_UNCOPIED "/uncopied"
+#define NAME_GROUP_EMPTY "/empty"
+#define NAME_GROUP_TOP "/g0"
+#define NAME_GROUP_TOP2 "/g1"
+#define NAME_GROUP_TOP3 "/g2"
+#define NAME_GROUP_TOP4 "/g3"
+#define NAME_GROUP_SUB "/g0/g00"
+#define NAME_GROUP_SUB_2 "/g0/g01"
+#define NAME_GROUP_SUB_SUB "/g0/g00/g000"
+#define NAME_GROUP_SUB_SUB2 "g000"
+#define NAME_GROUP_DATASET "/g0/dataset_simple"
+#define NAME_GROUP_LINK "/g_links"
+#define NAME_GROUP_LINK2 "/g_links2"
+#define NAME_GROUP_LOOP "g_loop"
+#define NAME_GROUP_LOOP2 "g_loop2"
+#define NAME_GROUP_LOOP3 "g_loop3"
+#define NAME_GROUP_REF "ref_grp"
+#define NAME_LINK_DATASET "/g_links/dataset_simple"
+#define NAME_LINK_HARD "/g_links/hard_link_to_dataset_simple"
+#define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple"
+#define NAME_LINK_SOFT2 "/g_links2/soft_link_to_dataset_simple"
+#define NAME_LINK_EXTERN "/g_links/external_link_to_dataset_simple"
+#define NAME_LINK_EXTERN2 "/g_links2/external_link_to_dataset_simple"
+#define NAME_LINK_SOFT_DANGLE "/g_links/soft_link_to_nowhere"
+#define NAME_LINK_SOFT_DANGLE2 "/g_links2/soft_link_to_nowhere"
+#define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere"
+#define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere"
+#define NAME_OLD_FORMAT "/dset1"
+
+#define NAME_BUF_SIZE 1024
+#define ATTR_NAME_LEN 80
+#define DIM_SIZE_1 12
+#define DIM_SIZE_2 6
+#define MAX_DIM_SIZE_1 100
+#define MAX_DIM_SIZE_2 80
+#define CHUNK_SIZE_1 5 /* Not an even fraction of dimension sizes, so we test copying partial chunks */
+#define CHUNK_SIZE_2 5
+#define NUM_SUB_GROUPS 20
+#define NUM_WIDE_LOOP_GROUPS 10
+#define NUM_DATASETS 10
+#define ATTR_CMPD_STRING "ThisIsAString"
+
+char src_obj_full_name[215]; /* the full path + name of the object to be copied */
+
+unsigned num_attributes_g; /* Number of attributes created */
/* Table containing object id and object name */
/* (Used for detecting duplicate objects when comparing groups */
static struct {
- size_t nalloc; /* number of slots allocated */
- size_t nobjs; /* number of objects */
- H5O_token_t *obj; /* Tokens of objects seen */
+ size_t nalloc; /* number of slots allocated */
+ size_t nobjs; /* number of objects */
+ H5O_token_t *obj; /* Tokens of objects seen */
} idtab_g;
/* Local function prototypes */
-static int
-compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
- const void *buf1, const void *buf2, hid_t obj_owner);
-static int
-compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf);
-static int
-compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags);
-static int
-compare_idx_type(hid_t fapl, hid_t did, H5D_chunk_index_t new_type, H5D_chunk_index_t old_type);
-
-static int
-test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl);
-static int
-attach_attribute_compound_vlstr(hid_t loc_id);
-static int
-compare_attribute_compound_vlstr(hid_t loc, hid_t loc2);
+static int compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, const void *buf1,
+ const void *buf2, hid_t obj_owner);
+static int compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf);
+static int compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags);
+static int compare_idx_type(hid_t fapl, hid_t did, H5D_chunk_index_t new_type, H5D_chunk_index_t old_type);
+static int test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl);
+static int attach_attribute_compound_vlstr(hid_t loc_id);
+static int compare_attribute_compound_vlstr(hid_t loc, hid_t loc2);
/*-------------------------------------------------------------------------
* Function: token_insert
@@ -205,25 +188,24 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2);
static void
token_insert(H5O_info2_t *oi)
{
- size_t n;
+ size_t n;
/* Don't add it if the link count is 1 because such an object can only
* be encountered once. */
- if(oi->rc < 2)
+ if (oi->rc < 2)
return;
/* Extend the table */
- if(idtab_g.nobjs >= idtab_g.nalloc) {
- idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc);
- idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0]));
+ if (idtab_g.nobjs >= idtab_g.nalloc) {
+ idtab_g.nalloc = MAX(256, 2 * idtab_g.nalloc);
+ idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0]));
} /* end if */
/* Insert the entry */
- n = idtab_g.nobjs++;
+ n = idtab_g.nobjs++;
idtab_g.obj[n] = oi->token;
} /* end token_insert() */
-
/*-------------------------------------------------------------------------
* Function: token_lookup
*
@@ -241,21 +223,21 @@ static H5_ATTR_PURE hbool_t
token_lookup(hid_t loc_id, H5O_info2_t *oi)
{
size_t n;
- int token_cmp;
+ int token_cmp;
- if(oi->rc < 2) return FALSE; /*only one link possible*/
+ if (oi->rc < 2)
+ return FALSE; /*only one link possible*/
- for(n = 0; n < idtab_g.nobjs; n++) {
- if(H5Otoken_cmp(loc_id, &idtab_g.obj[n], &oi->token, &token_cmp) < 0)
+ for (n = 0; n < idtab_g.nobjs; n++) {
+ if (H5Otoken_cmp(loc_id, &idtab_g.obj[n], &oi->token, &token_cmp) < 0)
return FALSE;
- if(!token_cmp)
+ if (!token_cmp)
return TRUE;
}
return FALSE;
} /* end token_lookup() */
-
/*-------------------------------------------------------------------------
* Function: token_reset
*
@@ -271,13 +253,12 @@ token_lookup(hid_t loc_id, H5O_info2_t *oi)
static void
token_reset(void)
{
- if(idtab_g.obj)
+ if (idtab_g.obj)
HDfree(idtab_g.obj);
- idtab_g.obj = NULL;
+ idtab_g.obj = NULL;
idtab_g.nalloc = idtab_g.nobjs = 0;
} /* end token_reset() */
-
/*-------------------------------------------------------------------------
* Function: attach_ref_attr
*
@@ -293,50 +274,68 @@ token_reset(void)
static herr_t
attach_ref_attr(hid_t file_id, hid_t loc_id)
{
- char dsetname1[] = "dataset1_pointed_by_ref_attr";
- char dsetname2[] = "dataset2_pointed_by_ref_attr";
- hid_t did1 = (-1), did2 = (-1), aid = (-1), sid = (-1), sid_ref = (-1);
- hsize_t dims[2] = {2,9};
- hsize_t dims_ref[1] = {2};
+ char dsetname1[] = "dataset1_pointed_by_ref_attr";
+ char dsetname2[] = "dataset2_pointed_by_ref_attr";
+ hid_t did1 = (-1), did2 = (-1), aid = (-1), sid = (-1), sid_ref = (-1);
+ hsize_t dims[2] = {2, 9};
+ hsize_t dims_ref[1] = {2};
hobj_ref_t ref[2];
- int data1[2][9] = {{1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,18}};
- int data2[2][9] = {{2,2,2,2,2,2,2,2,2},{2,2,2,2,2,2,2,2,18}};
+ int data1[2][9] = {{1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 18}};
+ int data2[2][9] = {{2, 2, 2, 2, 2, 2, 2, 2, 2}, {2, 2, 2, 2, 2, 2, 2, 2, 18}};
/* creates two simple datasets */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
- if((sid_ref = H5Screate_simple(1, dims_ref, NULL)) < 0) TEST_ERROR
- if((did1 = H5Dcreate2(file_id, dsetname1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data1) < 0) TEST_ERROR
- if((did2 = H5Dcreate2(file_id, dsetname2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data2) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((sid_ref = H5Screate_simple(1, dims_ref, NULL)) < 0)
+ TEST_ERROR
+ if ((did1 = H5Dcreate2(file_id, dsetname1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1) < 0)
+ TEST_ERROR
+ if ((did2 = H5Dcreate2(file_id, dsetname2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2) < 0)
+ TEST_ERROR
/* create an attribute with two object references */
- if(H5Rcreate(&ref[0], file_id, dsetname1, H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR
- if(H5Rcreate(&ref[1], file_id, dsetname2, H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR
- if((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF_OBJ, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Awrite(aid, H5T_STD_REF_OBJ, ref) < 0) TEST_ERROR
+ if (H5Rcreate(&ref[0], file_id, dsetname1, H5R_OBJECT, (hid_t)-1) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&ref[1], file_id, dsetname2, H5R_OBJECT, (hid_t)-1) < 0)
+ TEST_ERROR
+ if ((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF_OBJ, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Awrite(aid, H5T_STD_REF_OBJ, ref) < 0)
+ TEST_ERROR
- if(H5Sclose(sid) < 0) TEST_ERROR
- if(H5Sclose(sid_ref) < 0) TEST_ERROR
- if(H5Dclose(did1) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
+ if (H5Sclose(sid_ref) < 0)
+ TEST_ERROR
+ if (H5Dclose(did1) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Sclose(sid_ref);
H5Dclose(did1);
H5Dclose(did2);
H5Aclose(aid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return(-1);
+ return (-1);
}
-
/*-------------------------------------------------------------------------
* Function: attach_reg_ref_attr
*
@@ -352,66 +351,87 @@ error:
static herr_t
attach_reg_ref_attr(hid_t file_id, hid_t loc_id)
{
- const char dsetnamev[] = "dataset_pointed_by_reg_ref_attr";
- hid_t aid = (-1);
- hid_t space_id = (-1); /* dataspace identifiers */
- hid_t spacer_id = (-1); /* dataspace identifiers */
- hid_t dsetv_id = (-1); /*dataset identifiers*/
- hsize_t dims[2] = {2,9};
- hsize_t dimsr[1] = {2};
- int rank = 2;
- int rankr =1;
+ const char dsetnamev[] = "dataset_pointed_by_reg_ref_attr";
+ hid_t aid = (-1);
+ hid_t space_id = (-1); /* dataspace identifiers */
+ hid_t spacer_id = (-1); /* dataspace identifiers */
+ hid_t dsetv_id = (-1); /*dataset identifiers*/
+ hsize_t dims[2] = {2, 9};
+ hsize_t dimsr[1] = {2};
+ int rank = 2;
+ int rankr = 1;
hdset_reg_ref_t ref[2];
- int data[2][9] = {{1,1,2,3,3,4,5,5,999},{1,2,2,3,4,4,5,6,999}};
- hsize_t start[2] = {0, 3};
- hsize_t count[2] = {2, 3};
- hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
- size_t num_points = 3;
+ int data[2][9] = {{1, 1, 2, 3, 3, 4, 5, 5, 999}, {1, 2, 2, 3, 4, 4, 5, 6, 999}};
+ hsize_t start[2] = {0, 3};
+ hsize_t count[2] = {2, 3};
+ hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
+ size_t num_points = 3;
/* create a 2D dataset */
- if((space_id = H5Screate_simple(rank, dims, NULL)) < 0) TEST_ERROR
- if((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0) TEST_ERROR
- if((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data) < 0) TEST_ERROR
+ if ((space_id = H5Screate_simple(rank, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0)
+ TEST_ERROR
+ if ((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
/* create reg_ref of block selection */
- if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR
- if(H5Rcreate(&ref[0], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&ref[0], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0)
+ TEST_ERROR
/* create reg_ref of point selection */
- if(H5Sselect_none(space_id) < 0) TEST_ERROR
- if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR
- if(H5Rcreate(&ref[1], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0) TEST_ERROR
+ if (H5Sselect_none(space_id) < 0)
+ TEST_ERROR
+ if (H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&ref[1], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0)
+ TEST_ERROR
/* create reg_ref attribute */
- if((aid = H5Acreate2(loc_id, "reg_ref_attr", H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Awrite(aid, H5T_STD_REF_DSETREG, ref) < 0) TEST_ERROR
+ if ((aid = H5Acreate2(loc_id, "reg_ref_attr", H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Awrite(aid, H5T_STD_REF_DSETREG, ref) < 0)
+ TEST_ERROR
/* attach the reg_ref attribute to the dataset itself */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if((aid = H5Acreate2(dsetv_id, "reg_ref_attr", H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Awrite(aid, H5T_STD_REF_DSETREG, ref) < 0) TEST_ERROR
-
- if(H5Sclose(spacer_id) < 0) TEST_ERROR
- if(H5Sclose(space_id) < 0) TEST_ERROR
- if(H5Dclose(dsetv_id) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if ((aid = H5Acreate2(dsetv_id, "reg_ref_attr", H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Awrite(aid, H5T_STD_REF_DSETREG, ref) < 0)
+ TEST_ERROR
+ if (H5Sclose(spacer_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetv_id) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(spacer_id);
H5Sclose(space_id);
H5Dclose(dsetv_id);
H5Aclose(aid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return(-1);
+ return (-1);
}
-
/*-------------------------------------------------------------------------
* Function: create_reg_ref_dataset
*
@@ -427,84 +447,116 @@ error:
static herr_t
create_reg_ref_dataset(hid_t file_id, hid_t loc_id)
{
- const char dsetnamev[] = "dataset_pointed_by_ref_dset";
- const char dsetnamer[] = "dataset_with_reg_ref";
- const char dsetnamer1[] = "compact_dataset_with_reg_ref";
- const char dsetnamer2[] = "compressed_dataset_with_reg_ref";
- hid_t space_id = (-1); /* dataspace identifiers */
- hid_t spacer_id = (-1);
- hid_t dsetv_id = (-1); /*dataset identifiers*/
- hid_t dsetr_id = (-1);
- hsize_t dims[2] = {2,9};
- hsize_t dimsr[1] = {2};
- int rank = 2;
- int rankr =1;
- hsize_t chunk_size=1;
+ const char dsetnamev[] = "dataset_pointed_by_ref_dset";
+ const char dsetnamer[] = "dataset_with_reg_ref";
+ const char dsetnamer1[] = "compact_dataset_with_reg_ref";
+ const char dsetnamer2[] = "compressed_dataset_with_reg_ref";
+ hid_t space_id = (-1); /* dataspace identifiers */
+ hid_t spacer_id = (-1);
+ hid_t dsetv_id = (-1); /*dataset identifiers*/
+ hid_t dsetr_id = (-1);
+ hsize_t dims[2] = {2, 9};
+ hsize_t dimsr[1] = {2};
+ int rank = 2;
+ int rankr = 1;
+ hsize_t chunk_size = 1;
hdset_reg_ref_t ref[2];
- int data[2][9] = {{1,1,2,3,3,4,5,5,6},{1,2,2,3,4,4,5,6,6}};
- hsize_t start[2];
- hsize_t count[2];
- hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
- size_t num_points = 3;
- hid_t pid = (-1);
-
- if((space_id = H5Screate_simple(rank, dims, NULL)) < 0) TEST_ERROR
- if((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0) TEST_ERROR
- if((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data) < 0) TEST_ERROR
- if((dsetr_id = H5Dcreate2(loc_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ int data[2][9] = {{1, 1, 2, 3, 3, 4, 5, 5, 6}, {1, 2, 2, 3, 4, 4, 5, 6, 6}};
+ hsize_t start[2];
+ hsize_t count[2];
+ hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
+ size_t num_points = 3;
+ hid_t pid = (-1);
+
+ if ((space_id = H5Screate_simple(rank, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0)
+ TEST_ERROR
+ if ((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+ if ((dsetr_id = H5Dcreate2(loc_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
start[0] = 0;
start[1] = 3;
count[0] = 2;
count[1] = 3;
- if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR
- if(H5Rcreate(&ref[0], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0) TEST_ERROR
- if(H5Sselect_none(space_id) < 0) TEST_ERROR
- if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR
- if(H5Rcreate(&ref[1], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0) TEST_ERROR
- if(H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR
- if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&ref[0], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0)
+ TEST_ERROR
+ if (H5Sselect_none(space_id) < 0)
+ TEST_ERROR
+ if (H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&ref[1], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetr_id) < 0)
+ TEST_ERROR
/* create and set compact plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_layout(pid, H5D_COMPACT) < 0)
+ TEST_ERROR
- if((dsetr_id = H5Dcreate2(loc_id, dsetnamer1, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Pclose(pid) < 0) TEST_ERROR
- if(H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0) TEST_ERROR
- if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+ if ((dsetr_id = H5Dcreate2(loc_id, dsetnamer1, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetr_id) < 0)
+ TEST_ERROR
/* create and set comp & chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, &chunk_size) < 0) TEST_ERROR
- if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, &chunk_size) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(pid, 9) < 0)
+ TEST_ERROR
- if((dsetr_id = H5Dcreate2(loc_id, dsetnamer2, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Pclose(pid) < 0) TEST_ERROR
- if(H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR
- if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+ if ((dsetr_id = H5Dcreate2(loc_id, dsetnamer2, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetr_id) < 0)
+ TEST_ERROR
- if(H5Sclose(space_id) < 0) TEST_ERROR
- if(H5Sclose(spacer_id) < 0) TEST_ERROR
- if(H5Dclose(dsetv_id) < 0) TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(spacer_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetv_id) < 0)
+ TEST_ERROR
return 0;
-
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space_id);
H5Sclose(spacer_id);
H5Dclose(dsetr_id);
H5Dclose(dsetv_id);
H5Pclose(pid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return(-1);
+ return (-1);
}
-
/*-------------------------------------------------------------------------
* Function: attach_attribute_vl
*
@@ -520,51 +572,49 @@ error:
static int
test_copy_attach_attribute_vl(hid_t loc_id)
{
- hid_t aid = -1, sid = -1, tid=-1;
- hvl_t buf[4];
- hsize_t dim1=4;
+ hid_t aid = -1, sid = -1, tid = -1;
+ hvl_t buf[4];
+ hsize_t dim1 = 4;
unsigned int i, j;
- int ret_value = -1;
+ int ret_value = -1;
- if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
+ if ((sid = H5Screate_simple(1, &dim1, NULL)) < 0)
goto done;
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
goto done;
- for(i = 0; i < 4; i++) {
- buf[i].len = i*3+1;
- buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
- for(j = 0; j < buf[i].len; j++)
+ for (i = 0; i < 4; i++) {
+ buf[i].len = i * 3 + 1;
+ buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
+ for (j = 0; j < buf[i].len; j++)
((int *)buf[i].p)[j] = (int)(j + 1);
} /* end for */
- if((aid = H5Acreate2(loc_id, "vlen attribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(loc_id, "vlen attribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto done;
- if(H5Awrite(aid, tid, buf) < 0)
+ if (H5Awrite(aid, tid, buf) < 0)
goto done;
ret_value = 0;
done:
- if(tid >0 && sid > 0) {
+ if (tid > 0 && sid > 0) {
hid_t dxpl_id = H5Pcreate(H5P_DATASET_XFER);
H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL);
H5Treclaim(tid, sid, dxpl_id, buf);
H5Pclose(dxpl_id);
}
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
- if(tid > 0)
+ if (tid > 0)
H5Tclose(tid);
- if(aid > 0)
+ if (aid > 0)
H5Aclose(aid);
return ret_value;
} /* end of attach_attribute_vl */
-
-
/*-------------------------------------------------------------------------
* Function: test_copy_attach_attributes
*
@@ -580,22 +630,22 @@ done:
static int
test_copy_attach_attributes(hid_t loc_id, hid_t type_id)
{
- hid_t aid = -1, sid = -1;
- char attr_name[ATTR_NAME_LEN];
- int attr_data[2];
- hsize_t dim1 = 2;
- hid_t acpl = -1;
- unsigned u;
- int ret_value = -1;
-
- if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
+ hid_t aid = -1, sid = -1;
+ char attr_name[ATTR_NAME_LEN];
+ int attr_data[2];
+ hsize_t dim1 = 2;
+ hid_t acpl = -1;
+ unsigned u;
+ int ret_value = -1;
+
+ if ((sid = H5Screate_simple(1, &dim1, NULL)) < 0)
goto done;
/* Create attribute creation plist */
- if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
+ if ((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
goto done;
- for(u = 0; u < num_attributes_g; u++) {
+ for (u = 0; u < num_attributes_g; u++) {
HDsprintf(attr_name, "%u attr", u);
/* Set attribute data */
@@ -603,40 +653,38 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id)
attr_data[1] = (int)(200 * u);
/* Set attribute character set (alternate) */
- if(u % 2) {
- if(H5Pset_char_encoding(acpl, H5T_CSET_ASCII) < 0)
+ if (u % 2) {
+ if (H5Pset_char_encoding(acpl, H5T_CSET_ASCII) < 0)
goto done;
} /* end if */
- else
- if(H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0)
- goto done;
+ else if (H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0)
+ goto done;
- if((aid = H5Acreate2(loc_id, attr_name, type_id, sid, acpl, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(loc_id, attr_name, type_id, sid, acpl, H5P_DEFAULT)) < 0)
goto done;
- if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
goto done;
- if(aid > 0)
+ if (aid > 0)
H5Aclose(aid);
- aid = -1;
+ aid = -1;
}
ret_value = 0;
done:
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
- if(aid > 0)
+ if (aid > 0)
H5Aclose(aid);
- if(acpl > 0)
+ if (acpl > 0)
H5Pclose(acpl);
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: test_copy_attach_paired_attributes
*
@@ -652,19 +700,21 @@ done:
static int
test_copy_attach_paired_attributes(hid_t loc_id, hid_t loc_id2, hid_t type_id)
{
- hid_t aid = -1, sid = -1;
- char attr_name[ATTR_NAME_LEN];
- int attr_data[2];
- hid_t acpl = -1;
- unsigned u;
- hsize_t dim1 = 2;
-
- if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 ) goto done;
+ hid_t aid = -1, sid = -1;
+ char attr_name[ATTR_NAME_LEN];
+ int attr_data[2];
+ hid_t acpl = -1;
+ unsigned u;
+ hsize_t dim1 = 2;
+
+ if ((sid = H5Screate_simple(1, &dim1, NULL)) < 0)
+ goto done;
/* Create attribute creation plist */
- if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0) goto done;
+ if ((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
+ goto done;
- for(u = 0; u < num_attributes_g; u++) {
+ for (u = 0; u < num_attributes_g; u++) {
HDsprintf(attr_name, "%u attr", u);
/* Set attribute data */
@@ -672,40 +722,48 @@ test_copy_attach_paired_attributes(hid_t loc_id, hid_t loc_id2, hid_t type_id)
attr_data[1] = (int)(200 * u);
/* Set attribute character set (alternate) */
- if(u % 2) {
- if(H5Pset_char_encoding(acpl, H5T_CSET_ASCII) < 0) goto done;
+ if (u % 2) {
+ if (H5Pset_char_encoding(acpl, H5T_CSET_ASCII) < 0)
+ goto done;
} /* end if */
- else
- if(H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0) goto done;
+ else if (H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0)
+ goto done;
/* Add attribute to first object */
- if((aid = H5Acreate2(loc_id, attr_name, type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto done;
- if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0) goto done;
- if(H5Aclose(aid) < 0) goto done;
+ if ((aid = H5Acreate2(loc_id, attr_name, type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto done;
+ if (H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
+ goto done;
+ if (H5Aclose(aid) < 0)
+ goto done;
/* Add attribute to second object */
- if((aid = H5Acreate2(loc_id2, attr_name, type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto done;
- if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0) goto done;
- if(H5Aclose(aid) < 0) goto done;
+ if ((aid = H5Acreate2(loc_id2, attr_name, type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto done;
+ if (H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
+ goto done;
+ if (H5Aclose(aid) < 0)
+ goto done;
}
- if(H5Sclose(sid) < 0) goto done;
- if(H5Pclose(acpl) < 0) goto done;
+ if (H5Sclose(sid) < 0)
+ goto done;
+ if (H5Pclose(acpl) < 0)
+ goto done;
return 0;
done:
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
- if(aid > 0)
+ if (aid > 0)
H5Aclose(aid);
- if(acpl > 0)
+ if (acpl > 0)
H5Pclose(acpl);
return -1;
} /* end test_copy_attach_paired_attributes() */
-
/*-------------------------------------------------------------------------
* Function: compare_attribute
*
@@ -721,86 +779,110 @@ done:
static int
compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf, hid_t obj_owner)
{
- hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- size_t elmt_size; /* Size of datatype */
- htri_t is_committed; /* If the datatype is committed */
- htri_t is_committed2; /* If the datatype is committed */
- H5A_info_t ainfo; /* Attribute info */
- H5A_info_t ainfo2; /* Attribute info */
- hssize_t nelmts; /* # of elements in dataspace */
- void *rbuf = NULL; /* Buffer for reading raw data */
- void *rbuf2 = NULL; /* Buffer for reading raw data */
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ size_t elmt_size; /* Size of datatype */
+ htri_t is_committed; /* If the datatype is committed */
+ htri_t is_committed2; /* If the datatype is committed */
+ H5A_info_t ainfo; /* Attribute info */
+ H5A_info_t ainfo2; /* Attribute info */
+ hssize_t nelmts; /* # of elements in dataspace */
+ void * rbuf = NULL; /* Buffer for reading raw data */
+ void * rbuf2 = NULL; /* Buffer for reading raw data */
/* Check the character sets are equal */
- if(H5Aget_info(aid, &ainfo) < 0) TEST_ERROR
- if(H5Aget_info(aid2, &ainfo2) < 0) TEST_ERROR
- if(ainfo.cset != ainfo2.cset) TEST_ERROR
+ if (H5Aget_info(aid, &ainfo) < 0)
+ TEST_ERROR
+ if (H5Aget_info(aid2, &ainfo2) < 0)
+ TEST_ERROR
+ if (ainfo.cset != ainfo2.cset)
+ TEST_ERROR
/* Check the creation orders are equal (if appropriate) */
- if(ainfo.corder_valid != ainfo2.corder_valid) TEST_ERROR
- if(ainfo.corder_valid)
- if(ainfo.corder != ainfo2.corder) TEST_ERROR
+ if (ainfo.corder_valid != ainfo2.corder_valid)
+ TEST_ERROR
+ if (ainfo.corder_valid)
+ if (ainfo.corder != ainfo2.corder)
+ TEST_ERROR
/* Check the datatypes are equal */
/* Open the datatype for the source attribute */
- if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
+ if ((tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
/* Open the datatype for the destination attribute */
- if((tid2 = H5Aget_type(aid2)) < 0) TEST_ERROR
+ if ((tid2 = H5Aget_type(aid2)) < 0)
+ TEST_ERROR
/* Check that both datatypes are committed/not committed */
- if((is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
- if((is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
- if(is_committed != is_committed2) TEST_ERROR
+ if ((is_committed = H5Tcommitted(tid)) < 0)
+ TEST_ERROR
+ if ((is_committed2 = H5Tcommitted(tid2)) < 0)
+ TEST_ERROR
+ if (is_committed != is_committed2)
+ TEST_ERROR
/* Compare the datatypes */
- if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if (H5Tequal(tid, tid2) != TRUE)
+ TEST_ERROR
/* Determine the size of datatype (for later) */
- if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
+ if ((elmt_size = H5Tget_size(tid)) == 0)
+ TEST_ERROR
/* Check the dataspaces are equal */
/* Open the dataspace for the source attribute */
- if((sid = H5Aget_space(aid)) < 0) TEST_ERROR
+ if ((sid = H5Aget_space(aid)) < 0)
+ TEST_ERROR
/* Open the dataspace for the destination attribute */
- if((sid2 = H5Aget_space(aid2)) < 0) TEST_ERROR
+ if ((sid2 = H5Aget_space(aid2)) < 0)
+ TEST_ERROR
/* Compare the dataspaces */
- if(H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
+ if (H5Sextent_equal(sid, sid2) != TRUE)
+ TEST_ERROR
/* Determine the number of elements in dataspace (for later) */
- if((nelmts = H5Sget_simple_extent_npoints(sid2)) < 0) TEST_ERROR
+ if ((nelmts = H5Sget_simple_extent_npoints(sid2)) < 0)
+ TEST_ERROR
/* Check the raw data is equal */
/* Allocate & initialize space for the raw data buffers */
- if((rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
- if((rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if ((rbuf = HDcalloc(elmt_size, (size_t)nelmts)) == NULL)
+ TEST_ERROR
+ if ((rbuf2 = HDcalloc(elmt_size, (size_t)nelmts)) == NULL)
+ TEST_ERROR
/* Read data from the source attribute */
- if(H5Aread(aid, tid, rbuf) < 0) TEST_ERROR
+ if (H5Aread(aid, tid, rbuf) < 0)
+ TEST_ERROR
/* Read data from the destination attribute */
- if(H5Aread(aid2, tid2, rbuf2) < 0) TEST_ERROR
+ if (H5Aread(aid2, tid2, rbuf2) < 0)
+ TEST_ERROR
/* Check raw data read in against data written out */
- if(wbuf) {
- if(!compare_data(aid, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, obj_owner)) TEST_ERROR
- if(!compare_data(aid2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, obj_owner)) TEST_ERROR
+ if (wbuf) {
+ if (!compare_data(aid, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, obj_owner))
+ TEST_ERROR
+ if (!compare_data(aid2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, obj_owner))
+ TEST_ERROR
} /* end if */
/* Don't have written data, just compare data between the two attributes */
- else
- if(!compare_data(aid, aid2, pid, tid, (size_t)nelmts, rbuf, rbuf2, obj_owner)) TEST_ERROR
+ else if (!compare_data(aid, aid2, pid, tid, (size_t)nelmts, rbuf, rbuf2, obj_owner))
+ TEST_ERROR
/* Reclaim vlen data, if necessary */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE)
- if(H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
- if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE)
- if(H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR
+ if (H5Tdetect_class(tid2, H5T_VLEN) == TRUE)
+ if (H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0)
+ TEST_ERROR
/* Release raw data buffers */
HDfree(rbuf);
@@ -809,34 +891,39 @@ compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf, hid_t obj_
rbuf2 = NULL;
/* close the source dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the destination dataspace */
- if(H5Sclose(sid2) < 0) TEST_ERROR
+ if (H5Sclose(sid2) < 0)
+ TEST_ERROR
/* close the source datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the destination datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
return TRUE;
error:
- if(rbuf)
+ if (rbuf)
HDfree(rbuf);
- if(rbuf2)
+ if (rbuf2)
HDfree(rbuf2);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid2);
H5Sclose(sid);
H5Tclose(tid2);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FALSE;
} /* end compare_attribute() */
-
/*-------------------------------------------------------------------------
* Function: compare_std_attributes
*
@@ -855,62 +942,75 @@ error:
static int
compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
{
- hid_t aid = -1, aid2 = -1; /* Attribute IDs */
- H5O_info2_t oinfo1, oinfo2; /* Object info */
- unsigned cpy_flags; /* Object copy flags */
+ hid_t aid = -1, aid2 = -1; /* Attribute IDs */
+ H5O_info2_t oinfo1, oinfo2; /* Object info */
+ unsigned cpy_flags; /* Object copy flags */
/* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
- if(pid != H5P_DEFAULT) {
- if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ if (pid != H5P_DEFAULT) {
+ if (H5Pget_copy_object(pid, &cpy_flags) < 0)
+ TEST_ERROR
} /* end if */
else
cpy_flags = 0;
/* Check the number of attributes on source dataset */
- if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
+ if (H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0)
+ TEST_ERROR
/* Check the number of attributes on destination dataset */
- if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
+ if (H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0)
+ TEST_ERROR
- if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) {
+ if (cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) {
/* Check that the destination has no attributes */
- if(oinfo2.num_attrs != 0) TEST_ERROR
+ if (oinfo2.num_attrs != 0)
+ TEST_ERROR
} /* end if */
else {
- char attr_name[ATTR_NAME_LEN]; /* Attribute name */
- unsigned i; /* Local index variable */
+ char attr_name[ATTR_NAME_LEN]; /* Attribute name */
+ unsigned i; /* Local index variable */
/* Compare the number of attributes */
- if(oinfo1.num_attrs != oinfo2.num_attrs) TEST_ERROR
+ if (oinfo1.num_attrs != oinfo2.num_attrs)
+ TEST_ERROR
/* Check the attributes are equal */
- for(i = 0; i < (unsigned)oinfo1.num_attrs; i++) {
- if((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Aget_name(aid, (size_t)ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
+ for (i = 0; i < (unsigned)oinfo1.num_attrs; i++) {
+ if ((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Aget_name(aid, (size_t)ATTR_NAME_LEN, attr_name) < 0)
+ TEST_ERROR
- if((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check the attributes are equal */
- if(!compare_attribute(aid, aid2, pid, NULL, oid)) TEST_ERROR
+ if (!compare_attribute(aid, aid2, pid, NULL, oid))
+ TEST_ERROR
/* Close the attributes */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Aclose(aid2) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid2) < 0)
+ TEST_ERROR
} /* end for */
- } /* end if */
+ } /* end if */
/* Objects should be the same. :-) */
return TRUE;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid2);
H5Aclose(aid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FALSE;
} /* end compare_std_attributes() */
-
/*-------------------------------------------------------------------------
* Function: compare_data
*
@@ -924,166 +1024,192 @@ error:
*-------------------------------------------------------------------------
*/
static int
-compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
- const void *buf1, const void *buf2, hid_t obj_owner)
+compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, const void *buf1,
+ const void *buf2, hid_t obj_owner)
{
- size_t elmt_size; /* Size of an element */
+ size_t elmt_size; /* Size of an element */
/* Check size of each element */
- if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
+ if ((elmt_size = H5Tget_size(tid)) == 0)
+ TEST_ERROR
/* If the type is a compound containing a vlen, loop over all elements for
* each compound member. Compounds containing reference are not supported
* yet. */
- if((H5Tget_class(tid) == H5T_COMPOUND)
- && (H5Tdetect_class(tid, H5T_VLEN) == TRUE)) {
- hid_t memb_id; /* Member id */
- const uint8_t *memb1; /* Pointer to current member */
- const uint8_t *memb2; /* Pointer to current member */
- int nmembs; /* Number of members */
- size_t memb_off; /* Member offset */
- size_t memb_size; /* Member size */
- unsigned memb_idx; /* Member index */
- size_t elmt; /* Current element */
+ if ((H5Tget_class(tid) == H5T_COMPOUND) && (H5Tdetect_class(tid, H5T_VLEN) == TRUE)) {
+ hid_t memb_id; /* Member id */
+ const uint8_t *memb1; /* Pointer to current member */
+ const uint8_t *memb2; /* Pointer to current member */
+ int nmembs; /* Number of members */
+ size_t memb_off; /* Member offset */
+ size_t memb_size; /* Member size */
+ unsigned memb_idx; /* Member index */
+ size_t elmt; /* Current element */
/* Get number of members in compound */
- if((nmembs = H5Tget_nmembers(tid)) < 0) TEST_ERROR
+ if ((nmembs = H5Tget_nmembers(tid)) < 0)
+ TEST_ERROR
/* Loop over members */
- for(memb_idx=0; memb_idx<(unsigned)nmembs; memb_idx++) {
+ for (memb_idx = 0; memb_idx < (unsigned)nmembs; memb_idx++) {
/* Get member offset. Note that we cannot check for an error here.
*/
memb_off = H5Tget_member_offset(tid, memb_idx);
/* Get member id */
- if((memb_id = H5Tget_member_type(tid, memb_idx)) < 0) TEST_ERROR
+ if ((memb_id = H5Tget_member_type(tid, memb_idx)) < 0)
+ TEST_ERROR
/* Get member size */
- if((memb_size = H5Tget_size(memb_id)) == 0) TEST_ERROR
+ if ((memb_size = H5Tget_size(memb_id)) == 0)
+ TEST_ERROR
/* Set up pointers to member in the first element */
memb1 = (const uint8_t *)buf1 + memb_off;
memb2 = (const uint8_t *)buf2 + memb_off;
/* Check if this member contains (or is) a vlen */
- if(H5Tget_class(memb_id) == H5T_VLEN) {
- hid_t base_id; /* vlen base type id */
+ if (H5Tget_class(memb_id) == H5T_VLEN) {
+ hid_t base_id; /* vlen base type id */
/* Get base type of vlen datatype */
- if((base_id = H5Tget_super(memb_id)) < 0) TEST_ERROR
+ if ((base_id = H5Tget_super(memb_id)) < 0)
+ TEST_ERROR
/* Iterate over all elements, recursively calling this function
* for each */
- for(elmt=0; elmt<nelmts; elmt++) {
+ for (elmt = 0; elmt < nelmts; elmt++) {
/* Check vlen lengths */
- if(((const hvl_t *)((const void *)memb1))->len
- != ((const hvl_t *)((const void *)memb2))->len)
+ if (((const hvl_t *)((const void *)memb1))->len !=
+ ((const hvl_t *)((const void *)memb2))->len)
TEST_ERROR
/* Check vlen data */
- if(!compare_data(parent1, parent2, pid, base_id,
- ((const hvl_t *)((const void *)memb1))->len,
- ((const hvl_t *)((const void *)memb1))->p,
- ((const hvl_t *)((const void *)memb2))->p, obj_owner))
+ if (!compare_data(parent1, parent2, pid, base_id,
+ ((const hvl_t *)((const void *)memb1))->len,
+ ((const hvl_t *)((const void *)memb1))->p,
+ ((const hvl_t *)((const void *)memb2))->p, obj_owner))
TEST_ERROR
/* Update member pointers */
memb1 += elmt_size;
memb2 += elmt_size;
} /* end for */
- } else {
+ }
+ else {
/* vlens cannot currently be nested below the top layer of a
* compound */
HDassert(H5Tdetect_class(memb_id, H5T_VLEN) == FALSE);
/* Iterate over all elements, calling memcmp() for each */
- for(elmt=0; elmt<nelmts; elmt++) {
- if(HDmemcmp(memb1, memb2, memb_size))
+ for (elmt = 0; elmt < nelmts; elmt++) {
+ if (HDmemcmp(memb1, memb2, memb_size))
TEST_ERROR
/* Update member pointers */
memb1 += elmt_size;
memb2 += elmt_size;
} /* end for */
- } /* end else */
- } /* end for */
- } else if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ } /* end else */
+ } /* end for */
+ }
+ else if (H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
const hvl_t *vl_buf1, *vl_buf2; /* Aliases for buffers to compare */
- hid_t base_tid; /* Base type of vlen datatype */
- size_t u; /* Local index variable */
+ hid_t base_tid; /* Base type of vlen datatype */
+ size_t u; /* Local index variable */
/* Check for "simple" vlen datatype */
- if(H5Tget_class(tid) != H5T_VLEN) TEST_ERROR
+ if (H5Tget_class(tid) != H5T_VLEN)
+ TEST_ERROR
/* Get base type of vlen datatype */
- if((base_tid = H5Tget_super(tid)) < 0) TEST_ERROR
+ if ((base_tid = H5Tget_super(tid)) < 0)
+ TEST_ERROR
/* Loop over elements in buffers */
vl_buf1 = (const hvl_t *)buf1;
vl_buf2 = (const hvl_t *)buf2;
- for(u = 0; u < nelmts; u++, vl_buf1++, vl_buf2++) {
+ for (u = 0; u < nelmts; u++, vl_buf1++, vl_buf2++) {
/* Check vlen lengths */
- if(vl_buf1->len != vl_buf2->len) TEST_ERROR
+ if (vl_buf1->len != vl_buf2->len)
+ TEST_ERROR
/* Check vlen data */
- if(!compare_data(parent1, parent2, pid, base_tid, vl_buf1->len, vl_buf1->p, vl_buf2->p, obj_owner)) TEST_ERROR
+ if (!compare_data(parent1, parent2, pid, base_tid, vl_buf1->len, vl_buf1->p, vl_buf2->p,
+ obj_owner))
+ TEST_ERROR
} /* end for */
- if(H5Tclose(base_tid) < 0) TEST_ERROR
+ if (H5Tclose(base_tid) < 0)
+ TEST_ERROR
} /* end if */
- else if(H5Tdetect_class(tid, H5T_REFERENCE) == TRUE) {
- size_t u; /* Local index variable */
+ else if (H5Tdetect_class(tid, H5T_REFERENCE) == TRUE) {
+ size_t u; /* Local index variable */
/* Check for "simple" reference datatype */
- if(H5Tget_class(tid) != H5T_REFERENCE) TEST_ERROR
+ if (H5Tget_class(tid) != H5T_REFERENCE)
+ TEST_ERROR
/* Check for object or region reference */
- if(H5Tequal(tid, H5T_STD_REF_OBJ) > 0) {
- const hobj_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
+ if (H5Tequal(tid, H5T_STD_REF_OBJ) > 0) {
+ const hobj_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
/* Loop over elements in buffers */
ref_buf1 = (const hobj_ref_t *)buf1;
ref_buf2 = (const hobj_ref_t *)buf2;
- for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
- hid_t obj1_id, obj2_id; /* IDs for objects referenced */
+ for (u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
+ hid_t obj1_id, obj2_id; /* IDs for objects referenced */
H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */
/* Check for types of objects handled */
- if(H5Rget_obj_type2(parent1, H5R_OBJECT, ref_buf1, &obj1_type) < 0) TEST_ERROR
- if(H5Rget_obj_type2(parent2, H5R_OBJECT, ref_buf2, &obj2_type) < 0) TEST_ERROR
- if(obj1_type != obj2_type) TEST_ERROR
+ if (H5Rget_obj_type2(parent1, H5R_OBJECT, ref_buf1, &obj1_type) < 0)
+ TEST_ERROR
+ if (H5Rget_obj_type2(parent2, H5R_OBJECT, ref_buf2, &obj2_type) < 0)
+ TEST_ERROR
+ if (obj1_type != obj2_type)
+ TEST_ERROR
/* Open referenced objects */
- if((obj1_id = H5Rdereference2(parent1, H5P_DEFAULT, H5R_OBJECT, ref_buf1)) < 0) TEST_ERROR
- if((obj2_id = H5Rdereference2(parent2, H5P_DEFAULT, H5R_OBJECT, ref_buf2)) < 0) TEST_ERROR
+ if ((obj1_id = H5Rdereference2(parent1, H5P_DEFAULT, H5R_OBJECT, ref_buf1)) < 0)
+ TEST_ERROR
+ if ((obj2_id = H5Rdereference2(parent2, H5P_DEFAULT, H5R_OBJECT, ref_buf2)) < 0)
+ TEST_ERROR
/* break the infinite loop when the ref_object points to itself */
- if(obj_owner > 0) {
+ if (obj_owner > 0) {
H5O_info2_t oinfo1, oinfo2;
- int token_cmp;
-
- if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR
- if(!token_cmp) {
- if(H5Oclose(obj1_id) < 0) TEST_ERROR
- if(H5Oclose(obj2_id) < 0) TEST_ERROR
+ int token_cmp;
+
+ if (H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0)
+ TEST_ERROR
+ if (!token_cmp) {
+ if (H5Oclose(obj1_id) < 0)
+ TEST_ERROR
+ if (H5Oclose(obj2_id) < 0)
+ TEST_ERROR
return TRUE;
}
}
/* Check for types of objects handled */
- switch(obj1_type) {
+ switch (obj1_type) {
case H5O_TYPE_DATASET:
- if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_GROUP:
- if(compare_groups(obj1_id, obj2_id, pid, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(obj1_id, obj2_id, pid, -1, 0) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_NAMED_DATATYPE:
- if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
+ if (H5Tequal(obj1_id, obj2_id) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_MAP:
@@ -1096,57 +1222,72 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
} /* end switch */
/* Close objects */
- if(H5Oclose(obj1_id) < 0) TEST_ERROR
- if(H5Oclose(obj2_id) < 0) TEST_ERROR
+ if (H5Oclose(obj1_id) < 0)
+ TEST_ERROR
+ if (H5Oclose(obj2_id) < 0)
+ TEST_ERROR
} /* end for */
- } /* end if */
- else if(H5Tequal(tid, H5T_STD_REF_DSETREG) > 0) {
- const hdset_reg_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
+ } /* end if */
+ else if (H5Tequal(tid, H5T_STD_REF_DSETREG) > 0) {
+ const hdset_reg_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
/* Loop over elements in buffers */
ref_buf1 = (const hdset_reg_ref_t *)buf1;
ref_buf2 = (const hdset_reg_ref_t *)buf2;
- for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
- hid_t obj1_id, obj2_id; /* IDs for objects referenced */
- hid_t obj1_sid, obj2_sid; /* Dataspace IDs for objects referenced */
+ for (u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
+ hid_t obj1_id, obj2_id; /* IDs for objects referenced */
+ hid_t obj1_sid, obj2_sid; /* Dataspace IDs for objects referenced */
H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */
/* Check for types of objects handled */
- if(H5Rget_obj_type2(parent1, H5R_DATASET_REGION, ref_buf1, &obj1_type) < 0) TEST_ERROR
- if(H5Rget_obj_type2(parent2, H5R_DATASET_REGION, ref_buf2, &obj2_type) < 0) TEST_ERROR
- if(obj1_type != obj2_type) TEST_ERROR
+ if (H5Rget_obj_type2(parent1, H5R_DATASET_REGION, ref_buf1, &obj1_type) < 0)
+ TEST_ERROR
+ if (H5Rget_obj_type2(parent2, H5R_DATASET_REGION, ref_buf2, &obj2_type) < 0)
+ TEST_ERROR
+ if (obj1_type != obj2_type)
+ TEST_ERROR
/* Open referenced objects */
- if((obj1_id = H5Rdereference2(parent1, H5P_DEFAULT, H5R_DATASET_REGION, ref_buf1)) < 0) TEST_ERROR
- if((obj2_id = H5Rdereference2(parent2, H5P_DEFAULT, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR
+ if ((obj1_id = H5Rdereference2(parent1, H5P_DEFAULT, H5R_DATASET_REGION, ref_buf1)) < 0)
+ TEST_ERROR
+ if ((obj2_id = H5Rdereference2(parent2, H5P_DEFAULT, H5R_DATASET_REGION, ref_buf2)) < 0)
+ TEST_ERROR
/* break the infinite loop when the ref_object points to itself */
- if(obj_owner > 0) {
+ if (obj_owner > 0) {
H5O_info2_t oinfo1, oinfo2;
- int token_cmp;
-
- if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR
- if(!token_cmp) {
- if(H5Oclose(obj1_id) < 0) TEST_ERROR
- if(H5Oclose(obj2_id) < 0) TEST_ERROR
+ int token_cmp;
+
+ if (H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0)
+ TEST_ERROR
+ if (!token_cmp) {
+ if (H5Oclose(obj1_id) < 0)
+ TEST_ERROR
+ if (H5Oclose(obj2_id) < 0)
+ TEST_ERROR
return TRUE;
}
}
/* Check for types of objects handled */
- switch(obj1_type) {
+ switch (obj1_type) {
case H5O_TYPE_DATASET:
- if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_GROUP:
- if(compare_groups(obj1_id, obj2_id, pid, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(obj1_id, obj2_id, pid, -1, 0) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_NAMED_DATATYPE:
- if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
+ if (H5Tequal(obj1_id, obj2_id) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_MAP:
@@ -1159,26 +1300,33 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
} /* end switch */
/* Close objects */
- if(H5Oclose(obj1_id) < 0) TEST_ERROR
- if(H5Oclose(obj2_id) < 0) TEST_ERROR
+ if (H5Oclose(obj1_id) < 0)
+ TEST_ERROR
+ if (H5Oclose(obj2_id) < 0)
+ TEST_ERROR
/* Get regions for referenced datasets */
- if((obj1_sid = H5Rget_region(parent1, H5R_DATASET_REGION, ref_buf1)) < 0) TEST_ERROR
- if((obj2_sid = H5Rget_region(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR
+ if ((obj1_sid = H5Rget_region(parent1, H5R_DATASET_REGION, ref_buf1)) < 0)
+ TEST_ERROR
+ if ((obj2_sid = H5Rget_region(parent2, H5R_DATASET_REGION, ref_buf2)) < 0)
+ TEST_ERROR
/* Check if dataspaces are the same shape */
- if(H5Sselect_shape_same(obj1_sid, obj2_sid) < 0) TEST_ERROR
+ if (H5Sselect_shape_same(obj1_sid, obj2_sid) < 0)
+ TEST_ERROR
/* Close dataspaces */
- if(H5Sclose(obj1_sid) < 0) TEST_ERROR
- if(H5Sclose(obj2_sid) < 0) TEST_ERROR
+ if (H5Sclose(obj1_sid) < 0)
+ TEST_ERROR
+ if (H5Sclose(obj2_sid) < 0)
+ TEST_ERROR
} /* end for */
- } /* end if */
+ } /* end if */
else
TEST_ERROR
} /* end else */
- else
- if(HDmemcmp(buf1, buf2, (elmt_size * nelmts))) TEST_ERROR
+ else if (HDmemcmp(buf1, buf2, (elmt_size * nelmts)))
+ TEST_ERROR
/* Data should be the same. :-) */
return TRUE;
@@ -1187,7 +1335,6 @@ error:
return FALSE;
} /* end compare_data() */
-
/*-------------------------------------------------------------------------
* Function: compare_datasets
*
@@ -1203,81 +1350,98 @@ error:
static int
compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
{
- hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list IDs */
- size_t elmt_size; /* Size of datatype */
- htri_t is_committed; /* If the datatype is committed */
- htri_t is_committed2; /* If the datatype is committed */
- int nfilters; /* Number of filters applied to dataset */
- hssize_t nelmts; /* # of elements in dataspace */
- void *rbuf = NULL; /* Buffer for reading raw data */
- void *rbuf2 = NULL; /* Buffer for reading raw data */
- H5D_space_status_t space_status; /* Dataset's raw dataspace status */
- H5D_space_status_t space_status2; /* Dataset's raw dataspace status */
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list IDs */
+ size_t elmt_size; /* Size of datatype */
+ htri_t is_committed; /* If the datatype is committed */
+ htri_t is_committed2; /* If the datatype is committed */
+ int nfilters; /* Number of filters applied to dataset */
+ hssize_t nelmts; /* # of elements in dataspace */
+ void * rbuf = NULL; /* Buffer for reading raw data */
+ void * rbuf2 = NULL; /* Buffer for reading raw data */
+ H5D_space_status_t space_status; /* Dataset's raw dataspace status */
+ H5D_space_status_t space_status2; /* Dataset's raw dataspace status */
/* Check the datatypes are equal */
/* Open the datatype for the source dataset */
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
/* Open the datatype for the destination dataset */
- if((tid2 = H5Dget_type(did2)) < 0) TEST_ERROR
+ if ((tid2 = H5Dget_type(did2)) < 0)
+ TEST_ERROR
/* Check that both datatypes are committed/not committed */
- if((is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
- if((is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
- if(is_committed != is_committed2) TEST_ERROR
+ if ((is_committed = H5Tcommitted(tid)) < 0)
+ TEST_ERROR
+ if ((is_committed2 = H5Tcommitted(tid2)) < 0)
+ TEST_ERROR
+ if (is_committed != is_committed2)
+ TEST_ERROR
/* Compare the datatypes */
- if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if (H5Tequal(tid, tid2) != TRUE)
+ TEST_ERROR
/* Determine the size of datatype (for later) */
- if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
-
+ if ((elmt_size = H5Tget_size(tid)) == 0)
+ TEST_ERROR
/* Check the dataspaces are equal */
/* Open the dataspace for the source dataset */
- if((sid = H5Dget_space(did)) < 0) TEST_ERROR
+ if ((sid = H5Dget_space(did)) < 0)
+ TEST_ERROR
/* Open the dataspace for the destination dataset */
- if((sid2 = H5Dget_space(did2)) < 0) TEST_ERROR
+ if ((sid2 = H5Dget_space(did2)) < 0)
+ TEST_ERROR
/* Compare the dataspaces */
- if(H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
+ if (H5Sextent_equal(sid, sid2) != TRUE)
+ TEST_ERROR
/* Determine the number of elements in dataspace (for later) */
- if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) TEST_ERROR
-
+ if ((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
+ TEST_ERROR
/* Check the dataset creation property lists are equal */
/* Open the dataset creation property list for the source dataset */
- if((dcpl = H5Dget_create_plist(did)) < 0) TEST_ERROR
+ if ((dcpl = H5Dget_create_plist(did)) < 0)
+ TEST_ERROR
/* Open the dataset creation property list for the destination dataset */
- if((dcpl2 = H5Dget_create_plist(did2)) < 0) TEST_ERROR
+ if ((dcpl2 = H5Dget_create_plist(did2)) < 0)
+ TEST_ERROR
/* Compare the rest of the dataset creation property lists */
- if(H5Pequal(dcpl, dcpl2) != TRUE) TEST_ERROR
+ if (H5Pequal(dcpl, dcpl2) != TRUE)
+ TEST_ERROR
/* Get the number of filters on dataset (for later) */
- if((nfilters = H5Pget_nfilters(dcpl)) < 0) TEST_ERROR
+ if ((nfilters = H5Pget_nfilters(dcpl)) < 0)
+ TEST_ERROR
/* close the source dataset creation property list */
- if(H5Pclose(dcpl) < 0) TEST_ERROR
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
/* close the destination dataset creation property list */
- if(H5Pclose(dcpl2) < 0) TEST_ERROR
-
+ if (H5Pclose(dcpl2) < 0)
+ TEST_ERROR
/* Check the allocated storage is the same */
/* Check that the space allocation status is the same */
- if(H5Dget_space_status(did, &space_status) < 0) TEST_ERROR
- if(H5Dget_space_status(did2, &space_status2) < 0) TEST_ERROR
- if(space_status != space_status2) TEST_ERROR
+ if (H5Dget_space_status(did, &space_status) < 0)
+ TEST_ERROR
+ if (H5Dget_space_status(did2, &space_status2) < 0)
+ TEST_ERROR
+ if (space_status != space_status2)
+ TEST_ERROR
/* Check that the space used is the same */
/* (Don't check if the dataset is filtered (i.e. compressed, etc.) and
@@ -1285,38 +1449,47 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
* data in each dataset will (probably) be different and the storage
* size will thus vary)
*/
- if(!(nfilters > 0 && (H5Tdetect_class(tid, H5T_VLEN) ||
- (H5Tdetect_class(tid, H5T_REFERENCE) && H5Tequal(tid, H5T_STD_REF_DSETREG))))) {
- hsize_t storage_size = H5Dget_storage_size(did); /* Dataset's raw data storage size */
- hsize_t storage_size2 = H5Dget_storage_size(did2); /* 2nd Dataset's raw data storage size */
+ if (!(nfilters > 0 && (H5Tdetect_class(tid, H5T_VLEN) ||
+ (H5Tdetect_class(tid, H5T_REFERENCE) && H5Tequal(tid, H5T_STD_REF_DSETREG))))) {
+ hsize_t storage_size = H5Dget_storage_size(did); /* Dataset's raw data storage size */
+ hsize_t storage_size2 = H5Dget_storage_size(did2); /* 2nd Dataset's raw data storage size */
- if(storage_size != storage_size2) TEST_ERROR
+ if (storage_size != storage_size2)
+ TEST_ERROR
} /* end if */
/* Check the raw data is equal */
/* Allocate & initialize space for the raw data buffers */
- if((rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
- if((rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if ((rbuf = HDcalloc(elmt_size, (size_t)nelmts)) == NULL)
+ TEST_ERROR
+ if ((rbuf2 = HDcalloc(elmt_size, (size_t)nelmts)) == NULL)
+ TEST_ERROR
/* Read data from datasets */
- if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
- if(H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+ if (H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR
+ if (H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf2) < 0)
+ TEST_ERROR
/* Check raw data read in against data written out */
- if(wbuf) {
- if(!compare_data(did, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, did)) TEST_ERROR
- if(!compare_data(did2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, did2)) TEST_ERROR
+ if (wbuf) {
+ if (!compare_data(did, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, did))
+ TEST_ERROR
+ if (!compare_data(did2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, did2))
+ TEST_ERROR
} /* end if */
/* Don't have written data, just compare data between the two datasets */
- else
- if(!compare_data(did, did2, pid, tid, (size_t)nelmts, rbuf, rbuf2, did)) TEST_ERROR
+ else if (!compare_data(did, did2, pid, tid, (size_t)nelmts, rbuf, rbuf2, did))
+ TEST_ERROR
/* Reclaim vlen data, if necessary */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE)
- if(H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
- if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE)
- if(H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR
+ if (H5Tdetect_class(tid2, H5T_VLEN) == TRUE)
+ if (H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0)
+ TEST_ERROR
/* Release raw data buffers */
HDfree(rbuf);
@@ -1325,30 +1498,34 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
rbuf2 = NULL;
/* close the source dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the destination dataspace */
- if(H5Sclose(sid2) < 0) TEST_ERROR
+ if (H5Sclose(sid2) < 0)
+ TEST_ERROR
/* close the source datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the destination datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
-
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* Check if the attributes are equal */
- if(compare_std_attributes(did, did2, pid) != TRUE) TEST_ERROR
-
+ if (compare_std_attributes(did, did2, pid) != TRUE)
+ TEST_ERROR
/* Datasets should be the same. :-) */
return TRUE;
error:
- H5E_BEGIN_TRY {
- if(rbuf)
+ H5E_BEGIN_TRY
+ {
+ if (rbuf)
HDfree(rbuf);
- if(rbuf2)
+ if (rbuf2)
HDfree(rbuf2);
H5Pclose(dcpl2);
H5Pclose(dcpl);
@@ -1356,11 +1533,11 @@ error:
H5Sclose(sid);
H5Tclose(tid2);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FALSE;
} /* end compare_datasets() */
-
/*-------------------------------------------------------------------------
* Function: compare_groups
*
@@ -1376,102 +1553,126 @@ error:
static int
compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
{
- H5G_info_t ginfo; /* Group info struct */
- H5G_info_t ginfo2; /* Group info struct */
- hsize_t idx; /* Index over the objects in group */
- unsigned cpy_flags; /* Object copy flags */
+ H5G_info_t ginfo; /* Group info struct */
+ H5G_info_t ginfo2; /* Group info struct */
+ hsize_t idx; /* Index over the objects in group */
+ unsigned cpy_flags; /* Object copy flags */
/* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
- if(pid != H5P_DEFAULT) {
- if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ if (pid != H5P_DEFAULT) {
+ if (H5Pget_copy_object(pid, &cpy_flags) < 0)
+ TEST_ERROR
} /* end if */
else
cpy_flags = 0;
/* Check if both groups have the same # of objects */
- if(H5Gget_info(gid, &ginfo) < 0) TEST_ERROR
- if(H5Gget_info(gid2, &ginfo2) < 0) TEST_ERROR
- if((cpy_flags & H5O_COPY_SHALLOW_HIERARCHY_FLAG) && depth == 0) {
- if(ginfo2.nlinks != 0) TEST_ERROR
+ if (H5Gget_info(gid, &ginfo) < 0)
+ TEST_ERROR
+ if (H5Gget_info(gid2, &ginfo2) < 0)
+ TEST_ERROR
+ if ((cpy_flags & H5O_COPY_SHALLOW_HIERARCHY_FLAG) && depth == 0) {
+ if (ginfo2.nlinks != 0)
+ TEST_ERROR
} /* end if */
else {
- if(ginfo.nlinks != ginfo2.nlinks) TEST_ERROR
+ if (ginfo.nlinks != ginfo2.nlinks)
+ TEST_ERROR
} /* end if */
/* Check contents of groups */
- if(ginfo2.nlinks > 0) {
- char objname[NAME_BUF_SIZE]; /* Name of object in group */
- char objname2[NAME_BUF_SIZE]; /* Name of object in group */
- H5L_info2_t linfo; /* Link information */
- H5L_info2_t linfo2; /* Link information */
+ if (ginfo2.nlinks > 0) {
+ char objname[NAME_BUF_SIZE]; /* Name of object in group */
+ char objname2[NAME_BUF_SIZE]; /* Name of object in group */
+ H5L_info2_t linfo; /* Link information */
+ H5L_info2_t linfo2; /* Link information */
/* Loop over contents of groups */
- for(idx = 0; idx < ginfo.nlinks; idx++) {
+ for (idx = 0; idx < ginfo.nlinks; idx++) {
/* Check name of objects */
- if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_name_by_idx(gid2, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, objname2)) TEST_ERROR
+ if (H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname, (size_t)NAME_BUF_SIZE,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_name_by_idx(gid2, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname2,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, objname2))
+ TEST_ERROR
/* Get link info */
- if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.type != linfo2.type) TEST_ERROR
+ if (H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.type != linfo2.type)
+ TEST_ERROR
/* Extra checks for "real" objects */
- if(linfo.type == H5L_TYPE_HARD) {
- hid_t oid, oid2; /* IDs of objects within group */
- H5O_info2_t oinfo, oinfo2; /* Data model object info */
- H5O_native_info_t ninfo, ninfo2; /* Native file format object info */
+ if (linfo.type == H5L_TYPE_HARD) {
+ hid_t oid, oid2; /* IDs of objects within group */
+ H5O_info2_t oinfo, oinfo2; /* Data model object info */
+ H5O_native_info_t ninfo, ninfo2; /* Native file format object info */
/* Compare some pieces of the object info */
/* Get data model object info */
- if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Get native object info */
- if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(oinfo.type != oinfo2.type) TEST_ERROR
- if(oinfo.rc != oinfo2.rc) TEST_ERROR
+ if (oinfo.type != oinfo2.type)
+ TEST_ERROR
+ if (oinfo.rc != oinfo2.rc)
+ TEST_ERROR
/* If NULL messages are preserved, the number of messages
* should be the same in the destination.
* Otherwise, it should simply be true that the number
* of messages hasn't increased.
*/
- if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) {
- if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs)
+ if (H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) {
+ if (ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs)
;
- else
- if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs) TEST_ERROR
- }
+ else if (ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs)
+ TEST_ERROR
+ }
/* Check for object already having been compared */
- if(token_lookup(gid, &oinfo))
+ if (token_lookup(gid, &oinfo))
continue;
else
token_insert(&oinfo);
/* Open objects */
- if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((oid2 = H5Oopen(gid2, objname2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((oid2 = H5Oopen(gid2, objname2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Compare objects within group */
- switch(oinfo.type) {
+ switch (oinfo.type) {
case H5O_TYPE_GROUP:
/* Compare groups */
- if(compare_groups(oid, oid2, pid, depth - 1, copy_flags) != TRUE) TEST_ERROR
+ if (compare_groups(oid, oid2, pid, depth - 1, copy_flags) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_DATASET:
/* Compare datasets */
- if(compare_datasets(oid, oid2, pid, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(oid, oid2, pid, NULL) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_NAMED_DATATYPE:
/* Compare datatypes */
- if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR
+ if (H5Tequal(oid, oid2) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_MAP:
@@ -1485,47 +1686,53 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
} /* end switch */
/* Close objects */
- if(H5Oclose(oid) < 0) TEST_ERROR
- if(H5Oclose(oid2) < 0) TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid2) < 0)
+ TEST_ERROR
} /* end if */
else {
/* Check that both links are the same size */
- if(linfo.u.val_size != linfo2.u.val_size) TEST_ERROR
+ if (linfo.u.val_size != linfo2.u.val_size)
+ TEST_ERROR
/* Compare link values */
- if(linfo.type == H5L_TYPE_SOFT ||
- (linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX)) {
- char linkval[NAME_BUF_SIZE]; /* Link value */
- char linkval2[NAME_BUF_SIZE]; /* Link value */
+ if (linfo.type == H5L_TYPE_SOFT ||
+ (linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX)) {
+ char linkval[NAME_BUF_SIZE]; /* Link value */
+ char linkval2[NAME_BUF_SIZE]; /* Link value */
/* Get link values */
HDassert(linfo.u.val_size <= NAME_BUF_SIZE);
- if(H5Lget_val(gid, objname, linkval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_val(gid2, objname2, linkval2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_val(gid, objname, linkval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_val(gid2, objname2, linkval2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Compare link data */
- if(HDmemcmp(linkval, linkval2, linfo.u.val_size)) TEST_ERROR
+ if (HDmemcmp(linkval, linkval2, linfo.u.val_size))
+ TEST_ERROR
} /* end else-if */
else {
-HDassert(0 && "Unknown type of link");
+ HDassert(0 && "Unknown type of link");
} /* end else */
- } /* end else */
- } /* end for */
- } /* end if */
+ } /* end else */
+ } /* end for */
+ } /* end if */
/* Check if the attributes are equal */
- if(compare_std_attributes(gid, gid2, pid) != TRUE) TEST_ERROR
+ if (compare_std_attributes(gid, gid2, pid) != TRUE)
+ TEST_ERROR
/* Groups should be the same. :-) */
return TRUE;
error:
- H5E_BEGIN_TRY {
- } H5E_END_TRY;
+ H5E_BEGIN_TRY {}
+ H5E_END_TRY;
return FALSE;
} /* end compare_groups() */
-
/*-------------------------------------------------------------------------
* Function: compare_idx_type
*
@@ -1544,29 +1751,29 @@ static int
compare_idx_type(hid_t fapl, hid_t did, H5D_chunk_index_t new_type, H5D_chunk_index_t old_type)
{
H5D_chunk_index_t idx_type; /* Dataset chunk index type */
- H5F_libver_t low; /* File format low bound */
+ H5F_libver_t low; /* File format low bound */
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0)
- FAIL_STACK_ERROR
+ if (H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
/* Check if we are using the latest version of the format */
- if(H5Pget_libver_bounds(fapl, &low, NULL) < 0)
- FAIL_STACK_ERROR
+ if (H5Pget_libver_bounds(fapl, &low, NULL) < 0)
+ FAIL_STACK_ERROR
/* Verify index type */
- if(low == H5F_LIBVER_LATEST) {
- if(idx_type != new_type)
+ if (low == H5F_LIBVER_LATEST) {
+ if (idx_type != new_type)
+ TEST_ERROR
+ }
+ else if (idx_type != old_type)
TEST_ERROR
- } else if(idx_type != old_type)
- TEST_ERROR
return TRUE;
error:
return FALSE;
} /* compare_idx_type() */
-
/*-------------------------------------------------------------------------
* Function: test_copy_named_datatype
*
@@ -1583,10 +1790,10 @@ error:
static int
test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): named datatype");
@@ -1598,68 +1805,85 @@ test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create named datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the datatype from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATATYPE_SIMPLE, fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATATYPE_SIMPLE, fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the datatype for copy */
- if((tid = H5Topen2(fid_src, NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid_src, NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the copied datatype */
- if((tid2 = H5Topen2(fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid2 = H5Topen2(fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Compare the datatypes */
- if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if (H5Tequal(tid, tid2) != TRUE)
+ TEST_ERROR
/* close the destination datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* close the source datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid2);
H5Tclose(tid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_named_datatype */
-
/*-------------------------------------------------------------------------
* Function: test_copy_named_datatype_vl
*
@@ -1676,10 +1900,10 @@ error:
static int
test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): named vlen datatype");
@@ -1691,68 +1915,85 @@ test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create named datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the datatype from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATATYPE_VL, fid_dst, NAME_DATATYPE_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATATYPE_VL, fid_dst, NAME_DATATYPE_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the datatype for copy */
- if((tid = H5Topen2(fid_src, NAME_DATATYPE_VL, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid_src, NAME_DATATYPE_VL, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the copied datatype */
- if((tid2 = H5Topen2(fid_dst, NAME_DATATYPE_VL, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid2 = H5Topen2(fid_dst, NAME_DATATYPE_VL, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Compare the datatypes */
- if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if (H5Tequal(tid, tid2) != TRUE)
+ TEST_ERROR
/* close the destination datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* close the source datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid2);
H5Tclose(tid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_named_datatype_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_named_datatype_vl_vl
*
@@ -1769,10 +2010,10 @@ error:
static int
test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): named nested vlen datatype");
@@ -1784,74 +2025,93 @@ test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create first vlen datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create second (nested) vlen datatype */
- if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if ((tid2 = H5Tvlen_create(tid)) < 0)
+ TEST_ERROR
/* create named datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_VL_VL, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_VL_VL, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the first datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the second datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the datatype from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATATYPE_VL_VL, fid_dst, NAME_DATATYPE_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATATYPE_VL_VL, fid_dst, NAME_DATATYPE_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the datatype for copy */
- if((tid = H5Topen2(fid_src, NAME_DATATYPE_VL_VL, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid_src, NAME_DATATYPE_VL_VL, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the copied datatype */
- if((tid2 = H5Topen2(fid_dst, NAME_DATATYPE_VL_VL, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid2 = H5Topen2(fid_dst, NAME_DATATYPE_VL_VL, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Compare the datatypes */
- if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if (H5Tequal(tid, tid2) != TRUE)
+ TEST_ERROR
/* close the destination datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* close the source datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid2);
H5Tclose(tid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_named_datatype_vl_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_named_datatype_attr_self
*
@@ -1870,16 +2130,16 @@ error:
static int
test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- hid_t aid = -1; /* Attribute ID */
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dims[2] = {3, 4}; /* Dataspace dimensions */
- H5O_info2_t oinfo, oinfo2; /* Object info */
- H5G_info_t ginfo; /* Group info */
- hbool_t same_type;
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dims[2] = {3, 4}; /* Dataspace dimensions */
+ H5O_info2_t oinfo, oinfo2; /* Object info */
+ H5G_info_t ginfo; /* Group info */
+ hbool_t same_type;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): named datatype with self-referential attribute");
@@ -1891,119 +2151,150 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create named datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataspace */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
/* create attribute */
- if((aid = H5Acreate2(tid, "attr_self", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((aid = H5Acreate2(tid, "attr_self", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach other attributes to the dataset */
- if(test_copy_attach_attributes(tid, tid) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(tid, tid) < 0)
+ TEST_ERROR
/* close the attribute */
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the datatype from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATATYPE_SIMPLE, fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATATYPE_SIMPLE, fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the source datatype */
- if((tid = H5Topen2(fid_src, NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid = H5Topen2(fid_src, NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the copied datatype */
- if((tid2 = H5Topen2(fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid2 = H5Topen2(fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Compare the datatypes */
- if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if (H5Tequal(tid, tid2) != TRUE)
+ TEST_ERROR
/* close the source datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* open the destination attribute */
- if((aid = H5Aopen(tid2, "attr_self", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((aid = H5Aopen(tid2, "attr_self", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination attribute's datatype */
- if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
+ if ((tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
/* verify that the attribute's datatype is committed */
- if(H5Tcommitted(tid) != TRUE) TEST_ERROR
+ if (H5Tcommitted(tid) != TRUE)
+ TEST_ERROR
/* verify that the tokens of the datatypes are the same */
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
same_type = TRUE;
- if(oinfo.fileno == oinfo2.fileno) {
+ if (oinfo.fileno == oinfo2.fileno) {
int token_cmp;
- if(H5Otoken_cmp(tid2, &oinfo.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) same_type = FALSE;
+ if (H5Otoken_cmp(tid2, &oinfo.token, &oinfo2.token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ same_type = FALSE;
}
else
same_type = FALSE;
- if(!same_type)
+ if (!same_type)
FAIL_PUTS_ERROR("destination attribute does not use the same committed datatype")
/* Verify that there are only 2 links int he destination root group */
- if(H5Gget_info(fid_dst, &ginfo) < 0)
- if(ginfo.nlinks != 2)
- FAIL_PUTS_ERROR("unexpected number of links in destination root group")
+ if (H5Gget_info(fid_dst, &ginfo) < 0)
+ if (ginfo.nlinks != 2)
+ FAIL_PUTS_ERROR("unexpected number of links in destination root group")
/* close the attribute */
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
/* close the datatypes */
- if(H5Tclose(tid2) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid2);
H5Tclose(tid);
H5Sclose(sid);
H5Aclose(aid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_named_datatype_attr_self */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_simple
*
@@ -2020,21 +2311,21 @@ error:
static int
test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- hsize_t dim2d[2]; /* Dataset dimensions */
- int i, j; /* local index variables */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ int i, j; /* local index variables */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): simple dataset");
/* Initialize write buffer */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -2044,82 +2335,103 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create 2D int dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_simple */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_versionbounds
*
@@ -2141,29 +2453,30 @@ error:
static int
test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
{
- hid_t fid_src = -1, fid_dst = -1; /* Source and destination file IDs */
- hid_t fapl_dst = -1; /* File access plist for dest file */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did_src = -1, did_dst = -1; /* Source and destination dataset IDs */
- int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- hsize_t dim2d[2]; /* Dataset dimensions */
- char src_fname[NAME_BUF_SIZE]; /* Name of source file */
- char dst_fname[NAME_BUF_SIZE]; /* Name of destination file */
- H5F_libver_t low, high; /* File format bounds */
- unsigned srcdset_layoutversion; /* Layout version of source dataset */
- int i, j; /* Local index variables */
- H5D_t *dsetp = NULL; /* Pointer to internal dset structure */
- herr_t ret; /* Generic return value */
+ hid_t fid_src = -1, fid_dst = -1; /* Source and destination file IDs */
+ hid_t fapl_dst = -1; /* File access plist for dest file */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did_src = -1, did_dst = -1; /* Source and destination dataset IDs */
+ int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ char src_fname[NAME_BUF_SIZE]; /* Name of source file */
+ char dst_fname[NAME_BUF_SIZE]; /* Name of destination file */
+ H5F_libver_t low, high; /* File format bounds */
+ unsigned srcdset_layoutversion; /* Layout version of source dataset */
+ int i, j; /* Local index variables */
+ H5D_t * dsetp = NULL; /* Pointer to internal dset structure */
+ herr_t ret; /* Generic return value */
TESTING("H5Ocopy(): simple dataset with version bounds");
/* Initialize write buffer */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Create a file access property list for destination file */
- if ((fapl_dst = h5_fileaccess()) < 0) TEST_ERROR
+ if ((fapl_dst = h5_fileaccess()) < 0)
+ TEST_ERROR
/* Initialize the filenames */
h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname);
@@ -2174,129 +2487,153 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
/* Create source file */
fid_src = H5Fcreate(src_fname, H5F_ACC_TRUNC, fcpl_src, fapl_src);
- if (fid_src < 0) TEST_ERROR
+ if (fid_src < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* Create 2D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* Create 2D int dataset in SRC file */
- did_src = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (did_src < 0) TEST_ERROR
+ did_src =
+ H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (did_src < 0)
+ TEST_ERROR
/* Write data into SRC file */
ret = H5Dwrite(did_src, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
/* Get the internal dset ptr to get the fill version for verifying later */
- if ((dsetp = (H5D_t *)H5VL_object(did_src)) == NULL) TEST_ERROR
+ if ((dsetp = (H5D_t *)H5VL_object(did_src)) == NULL)
+ TEST_ERROR
srcdset_layoutversion = dsetp->shared->layout.version;
/* Close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did_src) < 0) TEST_ERROR
+ if (H5Dclose(did_src) < 0)
+ TEST_ERROR
/* Close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* Open the source file with read-only */
fid_src = H5Fopen(src_fname, H5F_ACC_RDONLY, fapl_src);
- if (fid_src < 0) TEST_ERROR
+ if (fid_src < 0)
+ TEST_ERROR
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combinations. Create a destination file and copy the
source dataset to it, then verify */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds */
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(fapl_dst, low, high);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl_dst, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
continue;
/* Create destination file */
fid_dst = H5Fcreate(dst_fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_dst);
- if (fid_dst < 0) TEST_ERROR
+ if (fid_dst < 0)
+ TEST_ERROR
/* Create an uncopied object in destination file so that tokens
in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Try to copy the dataset */
- H5E_BEGIN_TRY {
- ret = H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT,
+ H5P_DEFAULT);
+ }
+ H5E_END_TRY;
/* If copy failed, check if the failure is expected */
- if (ret < 0)
- {
+ if (ret < 0) {
/* Failure is valid if layout version of source dataset is
greater than destination */
if (srcdset_layoutversion <= H5O_layout_ver_bounds[high])
TEST_ERROR
/* Close the DST file before continue */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
continue;
}
/* Close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Open destination file */
fid_dst = H5Fopen(dst_fname, H5F_ACC_RDWR, fapl_dst);
- if (fid_dst < 0) TEST_ERROR
+ if (fid_dst < 0)
+ TEST_ERROR
/* Open the datasets to compare */
did_src = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT);
- if (did_src < 0) TEST_ERROR
+ if (did_src < 0)
+ TEST_ERROR
did_dst = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT);
- if (did_dst < 0) TEST_ERROR
+ if (did_dst < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
if (compare_datasets(did_src, did_dst, H5P_DEFAULT, buf) != TRUE)
TEST_ERROR
/* Close the datasets */
- if(H5Dclose(did_dst) < 0) TEST_ERROR
- if(H5Dclose(did_src) < 0) TEST_ERROR
+ if (H5Dclose(did_dst) < 0)
+ TEST_ERROR
+ if (H5Dclose(did_src) < 0)
+ TEST_ERROR
/* Close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
} /* for high */
- } /* for low */
+ } /* for low */
/* Close property list and source file */
- if (H5Pclose(fapl_dst) < 0) TEST_ERROR
- if (H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Pclose(fapl_dst) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did_dst);
H5Dclose(did_src);
H5Sclose(sid);
H5Pclose(fapl_dst);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_versionbounds */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_simple_samefile
*
@@ -2313,20 +2650,20 @@ error:
static int
test_copy_dataset_simple_samefile(hid_t fcpl, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- hsize_t dim2d[2]; /* Dataset dimensions */
- int i, j; /* local index variables */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ int i, j; /* local index variables */
+ char filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): simple dataset within the same file");
/* Initialize write buffer */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
@@ -2335,72 +2672,89 @@ test_copy_dataset_simple_samefile(hid_t fcpl, hid_t fapl)
token_reset();
/* create source file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create 2D int dataset at SRC file */
- if((did = H5Dcreate2(fid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* open the source file with read-write */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid, NAME_DATASET_SIMPLE, fid, NAME_DATASET_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid, NAME_DATASET_SIMPLE, fid, NAME_DATASET_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_simple_samefile */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_simple_empty
*
@@ -2419,18 +2773,20 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t test_open)
+test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t test_open)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hsize_t dim2d[2]; /* Dataset dimensions */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
-
- if(test_open) {
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ if (test_open) {
TESTING("H5Ocopy(): empty and openend contiguous dataset");
- } else {
+ }
+ else {
TESTING("H5Ocopy(): empty contiguous dataset");
}
@@ -2442,84 +2798,104 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create 2D int dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
-
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
}
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
}
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_simple_empty */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compound
*
@@ -2536,24 +2912,24 @@ error:
static int
test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hsize_t dim1d[1]; /* Dataset dimensions */
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hsize_t dim1d[1]; /* Dataset dimensions */
typedef struct comp_t {
- int a;
+ int a;
double d;
} comp_t;
- comp_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- int i; /* Local index variable */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ comp_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ int i; /* Local index variable */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): compound dataset");
HDmemset(buf, 0, sizeof(buf));
- for(i = 0; i < DIM_SIZE_1; i++) {
+ for (i = 0; i < DIM_SIZE_1; i++) {
buf[i].a = i;
buf[i].d = (double)1.0F / (double)(i + 1);
} /* end for */
@@ -2566,90 +2942,115 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
- if(H5Tinsert(tid, "int_name", HOFFSET(comp_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(tid, "double_name", HOFFSET(comp_t, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(comp_t))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "int_name", HOFFSET(comp_t, a), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "double_name", HOFFSET(comp_t, d), H5T_NATIVE_DOUBLE) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_COMPOUND, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_COMPOUND, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_COMPOUND, fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_COMPOUND, fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_COMPOUND, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_COMPOUND, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_compound */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_chunked
*
@@ -2666,27 +3067,27 @@ error:
static int
test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hsize_t max_dim1d[1]; /* Dataset max. dimensions */
- hsize_t dim2d[2]; /* Dataset dimensions */
- hsize_t chunk_dim1d[1] ={CHUNK_SIZE_1}; /* Chunk dimensions */
- hsize_t chunk_dim2d[2] ={CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
- float buf1d[DIM_SIZE_1]; /* Buffer for writing data */
- float buf2d[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- int i, j; /* Local index variables */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hsize_t max_dim1d[1]; /* Dataset max. dimensions */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ hsize_t chunk_dim2d[2] = {CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
+ float buf1d[DIM_SIZE_1]; /* Buffer for writing data */
+ float buf2d[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ int i, j; /* Local index variables */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): chunked dataset");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
+ for (i = 0; i < DIM_SIZE_1; i++) {
buf1d[i] = (float)i / 2.0F;
- for(j = 0; j < DIM_SIZE_2; j++)
+ for (j = 0; j < DIM_SIZE_2; j++)
buf2d[i][j] = (float)i + ((float)j / 100.0F);
} /* end for */
@@ -2698,36 +3099,47 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set 1-D dataspace dimensions */
- dim1d[0] = DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
max_dim1d[0] = H5S_UNLIMITED;
/* create 1-D dataspace */
- if((sid = H5Screate_simple(1, dim1d, max_dim1d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, max_dim1d)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, chunk_dim1d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1d) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* Create 1-D dataset: chunked, non-filterd, with data
@@ -2735,74 +3147,99 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
* H5D_ALLOC_TIME_INC (default)
*/
/* create 1-D dataspace */
- if((sid = H5Screate_simple(1, dim1d, dim1d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, dim1d)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, dim1d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, dim1d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1d) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Set 2-D dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2-D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, chunk_dim2d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Set allocation time to early */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* Create 2-D dataset: chunked, non-filterd, with data, dims=chunk dims,
@@ -2810,258 +3247,336 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
*/
/* create 2-D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create and set chunk plist to be the same as dims2d */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, dim2d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, dim2d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* Create 2-D dataset: chunked, non-filterd, with data, dims=chunk dims,
* H5D_ALLOC_TIME_EARLY
*/
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/*
* Create 2-D dataset: chunked, non-filterd, with data, dims=max dims=chunk dims,
* H5D_ALLOC_TIME_LATE
*/
/* create 2-D dataspace */
- if((sid = H5Screate_simple(2, dim2d, dim2d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, dim2d)) < 0)
+ TEST_ERROR
/* create and set chunk plist to be the same as dims2d */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, dim2d) < 0) TEST_ERROR
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, dim2d) < 0)
+ TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_LATE) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the datasets from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED2, fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED3, fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED2, fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED3, fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED_SINGLE, fid_dst, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED2_SINGLE, fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED3_SINGLE, fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED4_SINGLE, fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED_SINGLE, fid_dst, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED2_SINGLE, fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED3_SINGLE, fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED4_SINGLE, fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the 1-D destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_EARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_EARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf1d) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf1d) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the 1-D destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf1d) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf1d) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the 2-D dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the 2-D dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the 2-D dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the 2-D dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the 2-D dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf2d) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Pclose(pid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_chunked */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_chunked_empty
*
@@ -3079,17 +3594,17 @@ error:
static int
test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hsize_t max_dim1d[1]; /* Dataset max. dimensions */
- hsize_t dim2d[2]; /* Dataset dimensions */
- hsize_t chunk_dim1d[1] ={CHUNK_SIZE_1}; /* Chunk dimensions */
- hsize_t chunk_dim2d[2] ={CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hsize_t max_dim1d[1]; /* Dataset max. dimensions */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ hsize_t chunk_dim2d[2] = {CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): empty chunked dataset");
@@ -3101,33 +3616,43 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set 1-D dataspace dimensions */
- dim1d[0] = DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
max_dim1d[0] = H5S_UNLIMITED;
/* create 1-D dataspace */
- if((sid = H5Screate_simple(1, dim1d, max_dim1d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, max_dim1d)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, chunk_dim1d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* create 1-D dataset: chunked, empty, non-filtered,
@@ -3138,66 +3663,87 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
dim1d[0] = DIM_SIZE_1;
/* create 1-D dataspace */
- if((sid = H5Screate_simple(1, dim1d, dim1d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, dim1d)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, dim1d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, dim1d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Set 2-D dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2-D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, chunk_dim2d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Set allocation time to early */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* create 2-D dataset: chunked, empty, non-filtered,
@@ -3209,42 +3755,56 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
dim2d[1] = DIM_SIZE_2;
/* create 2-D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, dim2d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, dim2d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* create 2-D dataset: chunked, empty, non-filtered, dims=chunk dims
* H5D_ALLOC_TIME_EARLY
*/
/* Set allocation time to early */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* create 2-D dataset: chunked, empty, non-filtered,
@@ -3256,209 +3816,270 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
dim2d[1] = DIM_SIZE_2;
/* create 2-D dataspace */
- if((sid = H5Screate_simple(2, dim2d, dim2d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, dim2d)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, dim2d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, dim2d) < 0)
+ TEST_ERROR
/* Set allocation time to late */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_LATE) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the datasets from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED_SINGLE, fid_dst, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED2, fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED2_SINGLE, fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED3, fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED3_SINGLE, fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED4_SINGLE, fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED_SINGLE, fid_dst, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED2, fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED2_SINGLE, fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED3, fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED3_SINGLE, fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED4_SINGLE, fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset NAME_DATASET_CHUNKED in SRC file */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED at destination */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_EARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_EARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset NAME_DATASET_CHUNKED_SINGLE in SRC file */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED_SINGLE at destination */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset NAME_DATASET_CHUNKED2 in SRC file */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED2 at destination */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset "NAME_DATASET_CHUNKED2_SINGLE in SRC file */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED2_SINGLE at destination */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset NAME_DATASET_CHUNKED3 in SRC file */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED3 at destinaion */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset NAME_DATASET_CHUNKED3_SINGLE in SRC file */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED3_SINGLE at destination */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset NAME_DATASET_CHUNKED4_SINGLE in SRC file */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED4_SINGLE at destination */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Pclose(pid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_chunked_empty */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_chunked_sparse
*
@@ -3476,30 +4097,30 @@ error:
static int
test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hsize_t new_dim1d[1]; /* Dataset dimensions */
- hsize_t max_dim1d[1]; /* Dataset max. dimensions */
- hsize_t dim2d[2]; /* Dataset dimensions */
- hsize_t new_dim2d[2]; /* Dataset dimensions */
- hsize_t max_dim2d[2]; /* Dataset max. dimensions */
- hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
- hsize_t chunk_dim2d[2] = {CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
- float buf1d[DIM_SIZE_1]; /* Buffer for writing data */
- float buf2d[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- int i, j; /* Local index variables */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hsize_t new_dim1d[1]; /* Dataset dimensions */
+ hsize_t max_dim1d[1]; /* Dataset max. dimensions */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ hsize_t new_dim2d[2]; /* Dataset dimensions */
+ hsize_t max_dim2d[2]; /* Dataset max. dimensions */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ hsize_t chunk_dim2d[2] = {CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
+ float buf1d[DIM_SIZE_1]; /* Buffer for writing data */
+ float buf2d[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ int i, j; /* Local index variables */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): sparse dataset");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
+ for (i = 0; i < DIM_SIZE_1; i++) {
buf1d[i] = (float)i / 10.0F;
- for(j = 0; j < DIM_SIZE_2; j++)
+ for (j = 0; j < DIM_SIZE_2; j++)
buf2d[i][j] = (float)i + ((float)j / 100.0F);
} /* end for */
@@ -3511,271 +4132,335 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set 1-D dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
- max_dim1d[0]=H5S_UNLIMITED;
+ dim1d[0] = DIM_SIZE_1;
+ max_dim1d[0] = H5S_UNLIMITED;
/* create 1-D dataspace */
- if((sid = H5Screate_simple(1, dim1d, max_dim1d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, max_dim1d)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, chunk_dim1d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1d) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* Set extended dataset dimensions */
new_dim1d[0] = DIM_SIZE_1 * 2;
/* Extend dataset's dimensions */
- if(H5Dset_extent(did, new_dim1d) < 0) TEST_ERROR
+ if (H5Dset_extent(did, new_dim1d) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Change 1-D dataspace dimensions */
- dim1d[0] = DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
max_dim1d[0] = MAX_DIM_SIZE_1;
/* create 1-D dataspace */
- if((sid = H5Screate_simple(1, dim1d, max_dim1d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, max_dim1d)) < 0)
+ TEST_ERROR
/* Set allocation time to early */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1d) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* Set extended dataset dimensions */
new_dim1d[0] = DIM_SIZE_1 * 2;
/* Extend dataset's dimensions */
- if(H5Dset_extent(did, new_dim1d) < 0) TEST_ERROR
+ if (H5Dset_extent(did, new_dim1d) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Set 2-D dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
- max_dim2d[0]=H5S_UNLIMITED;
- max_dim2d[1]=H5S_UNLIMITED;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
+ max_dim2d[0] = H5S_UNLIMITED;
+ max_dim2d[1] = H5S_UNLIMITED;
/* create 2-D dataspace */
- if((sid = H5Screate_simple(2, dim2d, max_dim2d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, max_dim2d)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, chunk_dim2d) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* Set extended dataset dimensions */
new_dim2d[0] = DIM_SIZE_1 * 2;
new_dim2d[1] = DIM_SIZE_2 * 2;
/* Extend dataset's dimensions */
- if(H5Dset_extent(did, new_dim2d) < 0) TEST_ERROR
+ if (H5Dset_extent(did, new_dim2d) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Change 2-D dataspace dimensions */
- dim2d[0] = DIM_SIZE_1;
- dim2d[1] = DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
max_dim2d[0] = MAX_DIM_SIZE_1;
max_dim2d[1] = MAX_DIM_SIZE_2;
/* create 2-D dataspace */
- if((sid = H5Screate_simple(2, dim2d, max_dim2d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, max_dim2d)) < 0)
+ TEST_ERROR
/* Set allocation time to early */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED4, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED4, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2d) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* Set extended dataset dimensions */
new_dim2d[0] = DIM_SIZE_1 * 2;
new_dim2d[1] = DIM_SIZE_2 * 2;
/* Extend dataset's dimensions */
- if(H5Dset_extent(did, new_dim2d) < 0) TEST_ERROR
+ if (H5Dset_extent(did, new_dim2d) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the datasets from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED2, fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED3, fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED4, fid_dst, NAME_DATASET_CHUNKED4, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED2, fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED3, fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED4, fid_dst, NAME_DATASET_CHUNKED4, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_EARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_EARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_BT2, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_BT2, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED4, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED4, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED4, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED4, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the array index type is correct */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Pclose(pid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_chunked_sparse */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compressed
*
@@ -3793,16 +4478,16 @@ static int
test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
#ifdef H5_HAVE_FILTER_DEFLATE
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hsize_t dim2d[2]; /* Dataset dimensions */
- hsize_t chunk_dim2d[2] ={CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
- float buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- int i, j; /* Local index variables */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ hsize_t chunk_dim2d[2] = {CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
+ float buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ int i, j; /* Local index variables */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
#endif /* H5_HAVE_FILTER_DEFLATE */
TESTING("H5Ocopy(): compressed dataset");
@@ -3810,11 +4495,11 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
#ifndef H5_HAVE_FILTER_DEFLATE
SKIPPED();
puts(" Deflation filter not available");
-#else /* H5_HAVE_FILTER_DEFLATE */
+#else /* H5_HAVE_FILTER_DEFLATE */
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 100.0F; /* Something easy to compress */
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 100.0F; /* Something easy to compress */
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -3824,262 +4509,351 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create and set comp & chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
- if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, chunk_dim2d) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(pid, 9) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Set allocation time to early */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* create 2-D dataset: chunked, filtered, with data
* dims=max dims=chunk dims, H5D_ALLOC_TIME_INC(default)
*/
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, dim2d)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, dim2d)) < 0)
+ TEST_ERROR
/* create and set comp & chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, dim2d) < 0) TEST_ERROR
- if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, dim2d) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(pid, 9) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* create 2-D dataset: chunked, filtered, with data
* dims=chunk dims, H5D_ALLOC_TIME_EARLY
*/
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* Set allocation time to early */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* create 2-D dataset: chunked, filtered, with data
* dims=chunk dims, H5D_ALLOC_TIME_LATE
*/
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create and set comp & chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, dim2d) < 0) TEST_ERROR
- if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, dim2d) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(pid, 9) < 0)
+ TEST_ERROR
/* Set allocation time to late */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_LATE) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED2, fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED2_SINGLE, fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED3_SINGLE, fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED4_SINGLE, fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED2, fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED2_SINGLE, fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED3_SINGLE, fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED4_SINGLE, fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* Re-open the source and destination files for verification */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset NAME_DATASET_CHUNKED2_SINGLE at source */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED2_SINGLE at destination */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset NAME_DATASET_CHUNKED3_SINGLE at source */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED3_SINGLE at destination */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED3_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset NAME_DATASET_CHUNKED4_SINGLE at source */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the copied dataset NAME_DATASET_CHUNKED4_SINGLE at destination */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED4_SINGLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
- TEST_ERROR
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_SINGLE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -4087,19 +4861,20 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
#ifdef H5_HAVE_FILTER_DEFLATE
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Pclose(pid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
#endif /* H5_HAVE_FILTER_DEFLATE */
} /* end test_copy_dataset_compressed */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_no_edge_filt
*
@@ -4119,36 +4894,37 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
- hid_t dst_fapl, hbool_t test_open)
+test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t test_open)
{
#ifdef H5_HAVE_FILTER_DEFLATE
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hsize_t dim2d[2]; /* Dataset dimensions */
- hsize_t chunk_dim2d[2] ={CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
- float buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- int i, j; /* Local index variables */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ hsize_t chunk_dim2d[2] = {CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
+ float buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ int i, j; /* Local index variables */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
#endif /* H5_HAVE_FILTER_DEFLATE */
- if(test_open) {
+ if (test_open) {
TESTING("H5Ocopy(): compressed and opened dataset with no edge filters");
- } else {
+ }
+ else {
TESTING("H5Ocopy(): compressed dataset with no edge filters");
}
#ifndef H5_HAVE_FILTER_DEFLATE
SKIPPED();
puts(" Deflation filter not available");
-#else /* H5_HAVE_FILTER_DEFLATE */
+#else /* H5_HAVE_FILTER_DEFLATE */
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 100.0F; /* Something easy to compress */
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 100.0F; /* Something easy to compress */
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -4158,85 +4934,109 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create and set comp & chunk plist, and disable partial chunk filters */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
- if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
- if(H5Pset_chunk_opts(pid, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, chunk_dim2d) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(pid, 9) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk_opts(pid, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
-
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
}
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
}
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* H5Pset_chunk_opts() will set layout version to 4 which will use latest indexing available */
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_FARRAY) != TRUE)
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_FARRAY) != TRUE)
TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -4244,19 +5044,20 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
#ifdef H5_HAVE_FILTER_DEFLATE
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Pclose(pid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
#endif /* H5_HAVE_FILTER_DEFLATE */
} /* end test_copy_dataset_no_edge_filt */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compact
*
@@ -4276,25 +5077,26 @@ error:
static int
test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t test_open)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hsize_t dim2d[2]; /* Dataset dimensions */
- float buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- int i, j; /* Local index variables */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
-
- if(test_open) {
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ float buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ int i, j; /* Local index variables */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ if (test_open) {
TESTING("H5Ocopy(): compact and opened dataset");
- } else {
+ }
+ else {
TESTING("H5Ocopy(): compact dataset");
}
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
buf[i][j] = (float)i + (float)j / 100.0F;
/* Initialize the filenames */
@@ -4305,94 +5107,118 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create and set compact plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_layout(pid, H5D_COMPACT) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_COMPACT, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_COMPACT, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
}
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_COMPACT, fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_COMPACT, fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_COMPACT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_COMPACT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
}
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Pclose(pid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_compact */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_external
*
@@ -4409,25 +5235,25 @@ error:
static int
test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- int i;
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ int i;
hsize_t size;
hsize_t dim1d[1];
- int buf[DIM_SIZE_1];
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1];
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): external dataset");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = i;
/* create an empty external file */
- HDfclose(HDfopen (FILE_EXT, "w"));
+ HDfclose(HDfopen(FILE_EXT, "w"));
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -4437,87 +5263,110 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* set dataset creation plist */
- size = DIM_SIZE_1 * sizeof (int);
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_external(pid, FILE_EXT, (off_t)0, size) < 0) TEST_ERROR
+ size = DIM_SIZE_1 * sizeof(int);
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_external(pid, FILE_EXT, (off_t)0, size) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_EXTERNAL, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_EXTERNAL, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close external plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_EXTERNAL, fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_EXTERNAL, fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_EXTERNAL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_EXTERNAL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Pclose(pid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_external */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_named_dtype
*
@@ -4535,20 +5384,20 @@ error:
static int
test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- int i;
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ int i;
hsize_t dim1d[1];
- int buf[DIM_SIZE_1];
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1];
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): dataset that uses named datatype");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = i;
/* Initialize the filenames */
@@ -4559,86 +5408,110 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hi
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create named datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_named_dtype */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_named_dtype_hier
*
@@ -4656,21 +5529,21 @@ error:
static int
test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- int i;
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ int i;
hsize_t dim1d[1];
- int buf[DIM_SIZE_1];
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1];
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): hier. of datasets using named datatype inside hier.");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = i;
/* Initialize the filenames */
@@ -4681,90 +5554,119 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Create group to place all objects in */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create named datatype _inside_ hierarchy to copy */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(gid, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(gid, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create first dataset at SRC file */
- if((did = H5Dcreate2(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create second dataset at SRC file */
- if((did = H5Dcreate2(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
@@ -4772,11 +5674,11 @@ error:
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_named_dtype_hier */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_named_dtype_hier_outside
*
@@ -4795,21 +5697,21 @@ error:
static int
test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- int i;
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ int i;
hsize_t dim1d[1];
- int buf[DIM_SIZE_1];
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1];
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): hier. of datasets using named datatype outside hier.");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = i;
/* Initialize the filenames */
@@ -4820,90 +5722,119 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Create group to place all objects in */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create named datatype _outside_ hierarchy to copy */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create first dataset at SRC file */
- if((did = H5Dcreate2(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create second dataset at SRC file */
- if((did = H5Dcreate2(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
@@ -4911,11 +5842,11 @@ error:
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_named_dtype_hier_outside */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_multi_ohdr_chunks
*
@@ -4935,26 +5866,28 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t test_open)
+test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t test_open)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- int i;
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ int i;
hsize_t dim1d[1];
- int buf[DIM_SIZE_1];
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1];
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
- if(test_open) {
+ if (test_open) {
TESTING("H5Ocopy(): opened datasets that have multiple ohdr chunks");
- } else {
+ }
+ else {
TESTING("H5Ocopy(): datasets that have multiple ohdr chunks");
}
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = i;
/* Initialize the filenames */
@@ -4965,94 +5898,122 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fa
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Create group to place all objects in */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create first dataset at SRC file */
- if((did = H5Dcreate2(gid, NAME_DATASET_MULTI_OHDR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, NAME_DATASET_MULTI_OHDR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* create second dataset at SRC file */
- if((did2 = H5Dcreate2(gid, NAME_DATASET_MULTI_OHDR2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dcreate2(gid, NAME_DATASET_MULTI_OHDR2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* Add attributes to datasets in a way that creates lots of chunks */
- if(test_copy_attach_paired_attributes(did, did2, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_paired_attributes(did, did2, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the first dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* close the second dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
-
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
}
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(test_open) {
+ if (test_open) {
/* close the second dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
-
- } else
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
+ }
+ else
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Sclose(sid);
@@ -5060,11 +6021,11 @@ error:
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_multi_ohdr_chunks */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_attr_named_dtype
*
@@ -5082,21 +6043,21 @@ error:
static int
test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- int i;
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ int i;
hsize_t dim1d[1];
- int buf[DIM_SIZE_1];
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1];
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): objects with attributes using named datatypes");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = i;
/* Initialize the filenames */
@@ -5107,93 +6068,122 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Create group to place all objects in */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create named datatype _outside_ hierarchy to copy */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create first dataset at SRC file */
- if((did = H5Dcreate2(gid, NAME_DATASET_MULTI_OHDR, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, NAME_DATASET_MULTI_OHDR, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* create second dataset at SRC file */
- if((did2 = H5Dcreate2(gid, NAME_DATASET_MULTI_OHDR2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dcreate2(gid, NAME_DATASET_MULTI_OHDR2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* Add attributes to datasets in a way that creates lots of chunks */
- if(test_copy_attach_paired_attributes(did, did2, tid) < 0) TEST_ERROR
+ if (test_copy_attach_paired_attributes(did, did2, tid) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the first dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the second dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Tclose(tid);
@@ -5202,11 +6192,11 @@ error:
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_attr_named_dtype */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_contig_vl
*
@@ -5224,24 +6214,24 @@ error:
static int
test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): contiguous dataset with VLEN datatype");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].len = i+1;
- buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
- for(j = 0; j < buf[i].len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].len = i + 1;
+ buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
+ for (j = 0; j < buf[i].len; j++)
((int *)buf[i].p)[j] = (int)(i * 10 + j);
} /* end for */
@@ -5253,83 +6243,107 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Treclaim(tid, sid, H5P_DEFAULT, buf);
@@ -5338,11 +6352,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_contig_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_chunked_vl
*
@@ -5360,26 +6374,26 @@ error:
static int
test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): chunked dataset with VLEN datatype");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].len = i+1;
- buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
- for(j = 0; j < buf[i].len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].len = i + 1;
+ buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
+ for (j = 0; j < buf[i].len; j++)
((int *)buf[i].p)[j] = (int)(i * 10 + j);
} /* end for */
@@ -5391,128 +6405,161 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, chunk_dim1d) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Set allocation time to early */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL2, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL2, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_VL2, fid_dst, NAME_DATASET_VL2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL2, fid_dst, NAME_DATASET_VL2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Treclaim(tid, sid, H5P_DEFAULT, buf);
@@ -5522,11 +6569,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_chunked_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compact_vl
*
@@ -5544,25 +6591,25 @@ error:
static int
test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): compact dataset with VLEN datatype");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].len = i+1;
- buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
- for(j = 0; j < buf[i].len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].len = i + 1;
+ buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
+ for (j = 0; j < buf[i].len; j++)
((int *)buf[i].p)[j] = (int)(i * 10 + j);
} /* end for */
@@ -5574,90 +6621,117 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create and set compact plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_layout(pid, H5D_COMPACT) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close compact plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Treclaim(tid, sid, H5P_DEFAULT, buf);
@@ -5666,11 +6740,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_compact_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_attribute_vl
*
@@ -5688,13 +6762,13 @@ error:
static int
test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t aid = -1, aid2 = -1; /* Attribute IDs */
- hsize_t dim2d[2]; /* Dataset dimensions */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t aid = -1, aid2 = -1; /* Attribute IDs */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): variable length attribute");
@@ -5706,74 +6780,100 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create 2D int dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach VL attribute to the dataset */
- if(test_copy_attach_attribute_vl(did) < 0) TEST_ERROR
+ if (test_copy_attach_attribute_vl(did) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the attributes are equal */
- if((aid = H5Aopen_by_idx(did, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((aid2 = H5Aopen_by_idx(did2, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(compare_attribute(aid, aid2, H5P_DEFAULT, NULL, did) != TRUE) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Aclose(aid2) < 0) TEST_ERROR
+ if ((aid = H5Aopen_by_idx(did, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((aid2 = H5Aopen_by_idx(did2, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (compare_attribute(aid, aid2, H5P_DEFAULT, NULL, did) != TRUE)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid2) < 0)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid2);
H5Aclose(aid);
H5Dclose(did2);
@@ -5781,7 +6881,8 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_simple_empty */
@@ -5799,67 +6900,67 @@ error:
static int
attach_attribute_compound_vlstr(hid_t loc_id)
{
- hid_t aid = -1; /* Attribute ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t vl_str_tid = -1; /* Variable length string datatype ID */
- hid_t cmpd_tid = -1; /* Compound datatype ID */
- hsize_t dim1 = 1; /* Dimension size */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t vl_str_tid = -1; /* Variable length string datatype ID */
+ hid_t cmpd_tid = -1; /* Compound datatype ID */
+ hsize_t dim1 = 1; /* Dimension size */
typedef struct { /* Compound structure for the attribute */
- int i;
+ int i;
char *v;
} s1;
size_t len;
- s1 buf = {0, NULL}; /* Buffer */
- int ret_value = -1; /* Return value */
+ s1 buf = {0, NULL}; /* Buffer */
+ int ret_value = -1; /* Return value */
/* Create dataspace */
- if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
+ if ((sid = H5Screate_simple(1, &dim1, NULL)) < 0)
goto done;
/* Create an integer datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
goto done;
/* Create a variable length string */
- if((vl_str_tid = H5Tcopy(H5T_C_S1)) < 0)
+ if ((vl_str_tid = H5Tcopy(H5T_C_S1)) < 0)
goto done;
- if(H5Tset_size(vl_str_tid, H5T_VARIABLE) < 0)
+ if (H5Tset_size(vl_str_tid, H5T_VARIABLE) < 0)
goto done;
/* Create a compound datatype with a variable length string and an integer */
- if((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ if ((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
goto done;
- if(H5Tinsert(cmpd_tid, "i", HOFFSET(s1, i), tid) < 0)
+ if (H5Tinsert(cmpd_tid, "i", HOFFSET(s1, i), tid) < 0)
goto done;
- if(H5Tinsert(cmpd_tid, "v", HOFFSET(s1, v), vl_str_tid) < 0)
+ if (H5Tinsert(cmpd_tid, "v", HOFFSET(s1, v), vl_str_tid) < 0)
goto done;
/* Attach an attribute to the object */
- if((aid = H5Acreate2(loc_id, "attr_cmpd_vlstr", cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(loc_id, "attr_cmpd_vlstr", cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto done;
/* Write to the attribute */
- len = HDstrlen(ATTR_CMPD_STRING) + 1;
+ len = HDstrlen(ATTR_CMPD_STRING) + 1;
buf.i = 9;
- if(NULL == (buf.v = (char *)HDcalloc(len, sizeof(char))))
+ if (NULL == (buf.v = (char *)HDcalloc(len, sizeof(char))))
goto done;
HDstrncpy(buf.v, ATTR_CMPD_STRING, len);
- if(H5Awrite(aid, cmpd_tid, &buf) < 0)
+ if (H5Awrite(aid, cmpd_tid, &buf) < 0)
goto done;
ret_value = 0;
done:
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
- if(tid > 0)
+ if (tid > 0)
H5Tclose(tid);
- if(vl_str_tid > 0)
+ if (vl_str_tid > 0)
H5Tclose(vl_str_tid);
- if(cmpd_tid > 0)
+ if (cmpd_tid > 0)
H5Tclose(cmpd_tid);
- if(aid > 0)
+ if (aid > 0)
H5Aclose(aid);
HDfree(buf.v);
@@ -5882,71 +6983,79 @@ done:
static int
compare_attribute_compound_vlstr(hid_t loc, hid_t loc2)
{
- hid_t aid = -1, aid2 = -1; /* Attribute IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t aid = -1, aid2 = -1; /* Attribute IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
hid_t dxpl_id = -1;
- typedef struct { /* Compound structure for the attribute */
- int i;
- char *v;
+ typedef struct { /* Compound structure for the attribute */
+ int i;
+ char *v;
} s1;
- s1 rbuf; /* Buffer for data read */
- s1 rbuf2; /* Buffer for data read */
+ s1 rbuf; /* Buffer for data read */
+ s1 rbuf2; /* Buffer for data read */
/* Open the attributes attached to the objects */
- if((aid = H5Aopen_by_idx(loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if((aid2 = H5Aopen_by_idx(loc2, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((aid = H5Aopen_by_idx(loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((aid2 = H5Aopen_by_idx(loc2, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the attributes' datatypes */
- if((tid = H5Aget_type(aid)) < 0)
- FAIL_STACK_ERROR
- if((tid2 = H5Aget_type(aid2)) < 0)
- FAIL_STACK_ERROR
+ if ((tid = H5Aget_type(aid)) < 0)
+ FAIL_STACK_ERROR
+ if ((tid2 = H5Aget_type(aid2)) < 0)
+ FAIL_STACK_ERROR
/* Get the attributes' dataspaces */
- if((sid = H5Aget_space(aid)) < 0)
- FAIL_STACK_ERROR
- if((sid2 = H5Aget_space(aid2)) < 0)
- FAIL_STACK_ERROR
+ if ((sid = H5Aget_space(aid)) < 0)
+ FAIL_STACK_ERROR
+ if ((sid2 = H5Aget_space(aid2)) < 0)
+ FAIL_STACK_ERROR
/* Read the attributes */
- if(H5Aread(aid, tid, &rbuf) < 0)
- FAIL_STACK_ERROR
- if(H5Aread(aid2, tid2, &rbuf2) < 0)
- FAIL_STACK_ERROR
+ if (H5Aread(aid, tid, &rbuf) < 0)
+ FAIL_STACK_ERROR
+ if (H5Aread(aid2, tid2, &rbuf2) < 0)
+ FAIL_STACK_ERROR
/* Compare the attributes' data */
- if(rbuf.i != rbuf2.i)
- FAIL_STACK_ERROR
- if(HDstrlen(rbuf.v) != HDstrlen(rbuf2.v))
- FAIL_STACK_ERROR
- if(HDmemcmp(rbuf.v, rbuf2.v, HDstrlen(rbuf.v)))
- FAIL_STACK_ERROR
+ if (rbuf.i != rbuf2.i)
+ FAIL_STACK_ERROR
+ if (HDstrlen(rbuf.v) != HDstrlen(rbuf2.v))
+ FAIL_STACK_ERROR
+ if (HDmemcmp(rbuf.v, rbuf2.v, HDstrlen(rbuf.v)))
+ FAIL_STACK_ERROR
/* Reclaim vlen buffer */
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid, sid, dxpl_id, &rbuf) < 0) TEST_ERROR
- if(H5Treclaim(tid, sid, dxpl_id, &rbuf2) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid, sid, dxpl_id, &rbuf) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid, sid, dxpl_id, &rbuf2) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
/* Close the dataspaces */
- if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR
- if(H5Sclose(sid2) < 0)
- FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR
/* Close the attributes */
- if(H5Aclose(aid) < 0)
- FAIL_STACK_ERROR
- if(H5Aclose(aid2) < 0)
- FAIL_STACK_ERROR
+ if (H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Aclose(aid2) < 0)
+ FAIL_STACK_ERROR
return TRUE;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid);
H5Aclose(aid2);
H5Treclaim(tid, sid, H5P_DEFAULT, &rbuf);
@@ -5956,7 +7065,8 @@ error:
H5Tclose(tid);
H5Tclose(tid2);
H5Pclose(dxpl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FALSE;
} /* compare_attribute_compound_vlstr() */
@@ -5980,14 +7090,14 @@ error:
static int
test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t aid = -1, aid2 = -1; /* Attribute IDs */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hsize_t dim2d[2]; /* Dataset dimensions */
- char src_filename[NAME_BUF_SIZE]; /* Source file name */
- char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t aid = -1, aid2 = -1; /* Attribute IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ char src_filename[NAME_BUF_SIZE]; /* Source file name */
+ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
TESTING("H5Ocopy(): attribute with compound datatype consisting of variable length string");
@@ -5999,118 +7109,120 @@ test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ FAIL_STACK_ERROR
/* set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
- FAIL_STACK_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ FAIL_STACK_ERROR
/* create 2D int dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
/* attach an attribute to the dataset */
- if(attach_attribute_compound_vlstr(did) < 0)
- FAIL_STACK_ERROR
+ if (attach_attribute_compound_vlstr(did) < 0)
+ FAIL_STACK_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* create a group */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* attach attribute to the group */
- if(attach_attribute_compound_vlstr(gid) < 0)
- FAIL_STACK_ERROR
+ if (attach_attribute_compound_vlstr(gid) < 0)
+ FAIL_STACK_ERROR
/* close the group */
- if(H5Gclose(gid) < 0)
- FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0)
- FAIL_STACK_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ FAIL_STACK_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ FAIL_STACK_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ FAIL_STACK_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* open the src dataset */
- if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* compare the data of the attributes attached to the two datasets */
- if(compare_attribute_compound_vlstr(did, did2) < 0)
- FAIL_STACK_ERROR
+ if (compare_attribute_compound_vlstr(did, did2) < 0)
+ FAIL_STACK_ERROR
/* close the datasets */
- if(H5Dclose(did2) < 0)
- FAIL_STACK_ERROR
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Copy the group */
- if(H5Ocopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the src group */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* compare the data of the attributes attached to the two groups */
- if(compare_attribute_compound_vlstr(gid, gid2) < 0)
- FAIL_STACK_ERROR
+ if (compare_attribute_compound_vlstr(gid, gid2) < 0)
+ FAIL_STACK_ERROR
/* close the groups */
- if(H5Gclose(gid) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(gid2) < 0)
- FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid_src) < 0)
+ FAIL_STACK_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid2);
H5Aclose(aid);
H5Dclose(did2);
@@ -6120,11 +7232,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_attribute_compound_vlstr() */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compressed_vl
*
@@ -6143,18 +7255,18 @@ static int
test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
#ifdef H5_HAVE_FILTER_DEFLATE
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- hsize_t dim2d[2]; /* Dataset dimensions */
- hsize_t chunk_dim2d[2] ={CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
- hvl_t buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- int i, j, k; /* Local index variables */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ hsize_t chunk_dim2d[2] = {CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
+ hvl_t buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ int i, j, k; /* Local index variables */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
#endif /* H5_HAVE_FILTER_DEFLATE */
TESTING("H5Ocopy(): compressed dataset with VLEN datatype");
@@ -6162,12 +7274,12 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
#ifndef H5_HAVE_FILTER_DEFLATE
SKIPPED();
puts(" Deflation filter not available");
-#else /* H5_HAVE_FILTER_DEFLATE */
+#else /* H5_HAVE_FILTER_DEFLATE */
/* set initial data values */
for (i = 0; i < DIM_SIZE_1; i++) {
for (j = 0; j < DIM_SIZE_2; j++) {
buf[i][j].len = (size_t)(j + 1);
- buf[i][j].p = (int *)HDmalloc(buf[i][j].len * sizeof(int));
+ buf[i][j].p = (int *)HDmalloc(buf[i][j].len * sizeof(int));
for (k = 0; k < (int)buf[i][j].len; k++)
((int *)buf[i][j].p)[k] = i * 10000 + j * 100 + k;
}
@@ -6181,85 +7293,113 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create and set comp & chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
- if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, chunk_dim2d) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(pid, 9) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -6267,7 +7407,8 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
#ifdef H5_HAVE_FILTER_DEFLATE
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Pclose(pid);
@@ -6277,12 +7418,12 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
#endif /* H5_HAVE_FILTER_DEFLATE */
} /* end test_copy_dataset_compressed_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_group_empty
*
@@ -6299,10 +7440,10 @@ error:
static int
test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): empty group");
@@ -6314,68 +7455,85 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the group from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_group_empty */
-
/*-------------------------------------------------------------------------
* Function: test_copy_root_group
*
@@ -6392,23 +7550,23 @@ error:
static int
test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t gid_sub = -1; /* Sub-group ID */
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t gid_sub = -1; /* Sub-group ID */
hsize_t dim2d[2];
- int buf[DIM_SIZE_1][DIM_SIZE_2];
- int i, j;
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): root group");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -6418,83 +7576,111 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* add a dataset to the group */
- if((did = H5Dcreate2(fid_src, NAME_GROUP_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_GROUP_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create a sub-group */
- if((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid_sub) < 0) TEST_ERROR
+ if ((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid_sub) < 0)
+ TEST_ERROR
/* create another sub-group */
- if((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid_sub) < 0) TEST_ERROR
+ if ((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid_sub) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the group from SRC to DST */
- if(H5Ocopy(fid_src, "/", fid_dst, "/root_from_src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, "/", fid_dst, "/root_from_src", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, "/root_from_src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, "/root_from_src", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did);
H5Gclose(gid_sub);
@@ -6502,11 +7688,11 @@ error:
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_root_group */
-
/*-------------------------------------------------------------------------
* Function: test_copy_group
*
@@ -6523,23 +7709,23 @@ error:
static int
test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t gid_sub = -1; /* Sub-group ID */
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t gid_sub = -1; /* Sub-group ID */
hsize_t dim2d[2];
- int buf[DIM_SIZE_1][DIM_SIZE_2];
- int i, j;
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): simple nested groups");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -6549,84 +7735,111 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* add a dataset to the group */
- if((did = H5Dcreate2(fid_src, NAME_GROUP_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_GROUP_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create a sub-group */
- if((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if( H5Gclose(gid_sub) < 0) TEST_ERROR
+ if ((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid_sub) < 0)
+ TEST_ERROR
/* create another sub-group */
- if((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if( H5Gclose(gid_sub) < 0) TEST_ERROR
+ if ((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid_sub) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the group from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did);
H5Gclose(gid_sub);
@@ -6634,11 +7847,11 @@ error:
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_group */
-
/*-------------------------------------------------------------------------
* Function: test_copy_group_deep
*
@@ -6655,24 +7868,24 @@ error:
static int
test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t gid_sub = -1, gid_sub2; /* Sub-group IDs */
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t gid_sub = -1, gid_sub2; /* Sub-group IDs */
hsize_t dim2d[2];
- int buf[DIM_SIZE_1][DIM_SIZE_2];
- int i, j, k; /* Local index variables */
- char objname[NAME_BUF_SIZE]; /* Sub-group & dataset name buffer */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j, k; /* Local index variables */
+ char objname[NAME_BUF_SIZE]; /* Sub-group & dataset name buffer */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): deep nested groups");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -6682,93 +7895,120 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create nested sub-groups & datasets */
- for(i = 0; i < NUM_SUB_GROUPS; i++) {
+ for (i = 0; i < NUM_SUB_GROUPS; i++) {
HDsprintf(objname, "Group #%d", i);
- if((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- for(j = 0; j < NUM_SUB_GROUPS; j++) {
+ for (j = 0; j < NUM_SUB_GROUPS; j++) {
HDsprintf(objname, "Group #%d", j);
- if((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- for(k = 0; k < NUM_DATASETS; k++) {
+ for (k = 0; k < NUM_DATASETS; k++) {
HDsprintf(objname, "Dataset #%d", k);
/* add a dataset to the group */
- if((did = H5Dcreate2(gid_sub2, objname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid_sub2, objname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
} /* end for */
- if(H5Gclose(gid_sub2) < 0) TEST_ERROR
+ if (H5Gclose(gid_sub2) < 0)
+ TEST_ERROR
} /* end for */
- if(H5Gclose(gid_sub) < 0) TEST_ERROR
+ if (H5Gclose(gid_sub) < 0)
+ TEST_ERROR
} /* end for */
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the group from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did);
H5Gclose(gid_sub);
@@ -6776,11 +8016,11 @@ error:
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_group_deep */
-
/*-------------------------------------------------------------------------
* Function: test_copy_group_loop
*
@@ -6797,11 +8037,11 @@ error:
static int
test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t gid_sub = -1, gid_sub2=-1; /* Sub-group IDs */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t gid_sub = -1, gid_sub2 = -1; /* Sub-group IDs */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): nested groups with loop");
@@ -6813,84 +8053,106 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* create sub-groups */
- if((gid_sub = H5Gcreate2(gid, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid_sub = H5Gcreate2(gid, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if((gid_sub2 = H5Gcreate2(gid, NAME_GROUP_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid_sub2 = H5Gcreate2(gid, NAME_GROUP_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create link to top group */
- if(H5Lcreate_hard(gid, ".", gid_sub2, NAME_GROUP_LOOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_hard(gid, ".", gid_sub2, NAME_GROUP_LOOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* close sub sub group */
- if( H5Gclose(gid_sub2) < 0) TEST_ERROR
+ if (H5Gclose(gid_sub2) < 0)
+ TEST_ERROR
/* close sub group */
- if( H5Gclose(gid_sub) < 0) TEST_ERROR
+ if (H5Gclose(gid_sub) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the group from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid_sub2);
H5Gclose(gid_sub);
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_group_loop */
-
/*-------------------------------------------------------------------------
* Function: test_copy_group_wide_loop
*
@@ -6912,13 +8174,13 @@ error:
static int
test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t gid_sub = -1, gid_sub2=-1; /* Sub-group IDs */
- unsigned u, v; /* Local index variables */
- char objname[NAME_BUF_SIZE]; /* Object name buffer */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t gid_sub = -1, gid_sub2 = -1; /* Sub-group IDs */
+ unsigned u, v; /* Local index variables */
+ char objname[NAME_BUF_SIZE]; /* Object name buffer */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): wide nested groups with loop");
@@ -6930,96 +8192,120 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* create wide sub-group hierarchy, with multiple links to higher groups */
- for(u = 0; u < NUM_WIDE_LOOP_GROUPS; u++) {
+ for (u = 0; u < NUM_WIDE_LOOP_GROUPS; u++) {
HDsprintf(objname, "%s-%u", NAME_GROUP_SUB, u);
- if((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- for(v = 0; v < NUM_WIDE_LOOP_GROUPS; v++) {
+ for (v = 0; v < NUM_WIDE_LOOP_GROUPS; v++) {
HDsprintf(objname, "%s-%u", NAME_GROUP_SUB_SUB2, v);
- if((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create link to top group */
- if(H5Lcreate_hard(gid, ".", gid_sub2, NAME_GROUP_LOOP, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(gid, ".", gid_sub2, NAME_GROUP_LOOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create link to sub-group */
- if(H5Lcreate_hard(gid_sub, ".", gid_sub2, NAME_GROUP_LOOP2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(gid_sub, ".", gid_sub2, NAME_GROUP_LOOP2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create link to self :-) */
- if(H5Lcreate_hard(gid_sub2, ".", gid_sub2, NAME_GROUP_LOOP3, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(gid_sub2, ".", gid_sub2, NAME_GROUP_LOOP3, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* close sub sub group */
- if(H5Gclose(gid_sub2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid_sub2) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* close sub group */
- if( H5Gclose(gid_sub) < 0) TEST_ERROR
+ if (H5Gclose(gid_sub) < 0)
+ TEST_ERROR
} /* end for */
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the group from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid_sub2);
H5Gclose(gid_sub);
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_group_wide_loop */
-
/*-------------------------------------------------------------------------
* Function: test_copy_group_links
*
@@ -7036,29 +8322,29 @@ error:
static int
test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t plid = -1; /* Object copy plist ID */
- hsize_t dim2d[2];
- hsize_t dim1d[1];
+ hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t plid = -1; /* Object copy plist ID */
+ hsize_t dim2d[2];
+ hsize_t dim1d[1];
H5L_info2_t linfo;
- int buf[DIM_SIZE_1][DIM_SIZE_2];
- int i, j;
- unsigned expand_soft;
- unsigned expand_ext;
- unsigned copy_options;
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
- char ext_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j;
+ unsigned expand_soft;
+ unsigned expand_ext;
+ unsigned copy_options;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+ char ext_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): group with links");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -7069,198 +8355,268 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create file to hold external dataset */
- if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create groups at the SRC file. Group 2 will hold dangling links. */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((gid2 = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the groups */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
- if(test_copy_attach_attributes(gid2, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (test_copy_attach_attributes(gid2, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* add a dataset to the group */
- if((did = H5Dcreate2(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Now create a 1-D dataset in an external file */
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_2;
+ dim1d[0] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* add a dataset to the external file */
- if((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* make a hard link to the dataset */
- if(H5Lcreate_hard(fid_src, NAME_LINK_DATASET, H5L_SAME_LOC, NAME_LINK_HARD, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(fid_src, NAME_LINK_DATASET, H5L_SAME_LOC, NAME_LINK_HARD, H5P_DEFAULT, H5P_DEFAULT) <
+ 0)
+ FAIL_STACK_ERROR
/* make a soft link to the dataset */
- if(H5Lcreate_soft(NAME_LINK_DATASET, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft(NAME_LINK_DATASET, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* make an external link to the external dataset */
- if(H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* make a dangling soft link */
- if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* make a dangling external link */
- if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* close the groups */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the SRC and EXT files */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
- if(H5Fclose(fid_ext) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid_ext) < 0)
+ TEST_ERROR
/* Create the object copy plist */
- if((plid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
+ if ((plid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
/* Loop over all configurations (expand soft/external links) */
- for(expand_soft=0; expand_soft<=1; expand_soft++) {
- for(expand_ext=0; expand_ext<=1; expand_ext++) {
+ for (expand_soft = 0; expand_soft <= 1; expand_soft++) {
+ for (expand_ext = 0; expand_ext <= 1; expand_ext++) {
/* Set the correct copy options on the obj copy plist */
copy_options = 0;
- if(expand_soft)
+ if (expand_soft)
copy_options |= H5O_COPY_EXPAND_SOFT_LINK_FLAG;
- if(expand_ext)
+ if (expand_ext)
copy_options |= H5O_COPY_EXPAND_EXT_LINK_FLAG;
- if(H5Pset_copy_object(plid, copy_options) < 0) TEST_ERROR
+ if (H5Pset_copy_object(plid, copy_options) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files
+ * aren't the same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the group from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, plid, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, plid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* If expand_soft is set to true, verify that the soft link is now a
* hard link, and compare the expanded dataset, then delete it and
* re-add it as a soft link so compare_groups() works */
- if(expand_soft) {
+ if (expand_soft) {
/* Check link type */
- if(H5Lget_info2(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.type != H5L_TYPE_HARD)
+ if (H5Lget_info2(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.type != H5L_TYPE_HARD)
FAIL_PUTS_ERROR("Soft link was not expanded to a hard link")
/* Compare datasets */
- if((did = H5Dopen2(fid_src, NAME_LINK_DATASET, H5P_DEFAULT)) < 0) TEST_ERROR
- if((did2 = H5Dopen2(fid_dst, NAME_LINK_SOFT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_LINK_DATASET, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_LINK_SOFT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* Delete expanded dataset, add soft link */
- if(H5Ldelete(fid_dst, NAME_LINK_SOFT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_soft(NAME_LINK_DATASET, fid_dst, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(fid_dst, NAME_LINK_SOFT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_soft(NAME_LINK_DATASET, fid_dst, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close datasets */
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
} /* end if */
/* If expand_ext is set to true, verify that the external link is
* now a hard link, and compare the expanded dataset, then delete it
* and re-add it as an external link so compare_groups() works */
- if(expand_ext) {
+ if (expand_ext) {
/* Check link type */
- if(H5Lget_info2(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.type != H5L_TYPE_HARD)
+ if (H5Lget_info2(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.type != H5L_TYPE_HARD)
FAIL_PUTS_ERROR("External link was not expanded to a hard link")
/* Compare datasets */
- if((fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
- if((did = H5Dopen2(fid_ext, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((did2 = H5Dopen2(fid_dst, NAME_LINK_EXTERN, H5P_DEFAULT)) < 0) TEST_ERROR
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if ((fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
+ if ((did = H5Dopen2(fid_ext, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_LINK_EXTERN, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* Delete expanded dataset, add external link */
- if(H5Ldelete(fid_dst, NAME_LINK_EXTERN, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_dst, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(fid_dst, NAME_LINK_EXTERN, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_dst, NAME_LINK_EXTERN,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close datasets and external file */
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
- if(H5Fclose(fid_ext) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid_ext) < 0)
+ TEST_ERROR
} /* end if */
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Now try to copy the group containing the dangling link. They
* should always be copied as the same type of link, never expanded
* to hard links. */
- if(H5Ocopy(fid_src, NAME_GROUP_LINK2, fid_dst, NAME_GROUP_LINK2, plid, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_LINK2, fid_dst, NAME_GROUP_LINK2, plid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the original and copied groups */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Compare the groups */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* Close groups */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
} /* end for */
- } /* end for */
+ } /* end for */
/* Close the object copy plist */
- if(H5Pclose(plid) < 0) TEST_ERROR
+ if (H5Pclose(plid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did2);
H5Dclose(did);
@@ -7270,11 +8626,11 @@ error:
H5Fclose(fid_dst);
H5Fclose(fid_src);
H5Pclose(plid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_group_links */
-
/*-------------------------------------------------------------------------
* Function: test_copy_soft_link
*
@@ -7295,26 +8651,27 @@ error:
static int
test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t test_open)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t gid = -1; /* Group ID */
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t gid = -1; /* Group ID */
hsize_t dim2d[2];
- int buf[DIM_SIZE_1][DIM_SIZE_2];
- int i, j;
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
- if(test_open) {
+ if (test_open) {
TESTING("H5Ocopy(): openend object through soft link");
- } else {
+ }
+ else {
TESTING("H5Ocopy(): object through soft link");
}
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -7324,93 +8681,118 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fa
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* add a dataset to the group */
- if((did = H5Dcreate2(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* make a soft link to the dataset */
- if(H5Lcreate_soft(NAME_LINK_DATASET, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft(NAME_LINK_DATASET, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
- if(!test_open) {
+ if (!test_open) {
/* close the dataset */
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid_src) < 0)
+ FAIL_STACK_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
}
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_LINK_SOFT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_LINK_SOFT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* open the dataset through the soft link for copy */
- if((did = H5Dopen2(fid_src, NAME_LINK_SOFT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_LINK_SOFT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
}
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did2);
H5Dclose(did);
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_soft_link */
-
/*-------------------------------------------------------------------------
* Function: test_copy_ext_link
*
@@ -7427,23 +8809,23 @@ error:
static int
test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t gid = -1; /* Group ID */
+ hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t gid = -1; /* Group ID */
hsize_t dim2d[2];
- int buf[DIM_SIZE_1][DIM_SIZE_2];
- int i, j;
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
- char ext_filename[NAME_BUF_SIZE];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+ char ext_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): object through external link");
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -7454,97 +8836,127 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* add a dataset to the group */
- if((did = H5Dcreate2(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* create file to hold external links to the src file */
- if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group in the file that will hold the external link */
- if((gid = H5Gcreate2(fid_ext, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_ext, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create an external link to the dataset in the source file */
- if(H5Lcreate_external(src_filename, NAME_LINK_DATASET, fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lcreate_external(src_filename, NAME_LINK_DATASET, fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* close the group and file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid_ext) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid_ext) < 0)
+ TEST_ERROR
/* open the "extern" file with read-only */
- if((fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_ext, NAME_LINK_EXTERN, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_ext, NAME_LINK_EXTERN, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset through the external link */
- if((did = H5Dopen2(fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the EXT file */
- if(H5Fclose(fid_ext) < 0) TEST_ERROR
+ if (H5Fclose(fid_ext) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did2);
H5Dclose(did);
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_ext_link */
-
/*-------------------------------------------------------------------------
* Function: test_copy_exist
*
@@ -7562,22 +8974,22 @@ error:
static int
test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset IDs */
- int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- hsize_t dim2d[2]; /* Dataset dimensions */
- int i, j; /* local index variables */
- herr_t ret; /* Generic return value */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset IDs */
+ int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ int i, j; /* local index variables */
+ herr_t ret; /* Generic return value */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): existing object");
/* Initialize write buffer */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -7587,72 +8999,91 @@ test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create 2D int dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE,fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* try to copy the dataset from SRC to DST again (should fail) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if( ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_exist */
-
/*-------------------------------------------------------------------------
* Function: test_copy_path
*
@@ -7670,23 +9101,23 @@ error:
static int
test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t gid = -1; /* Group ID */
- int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- hsize_t dim2d[2]; /* Dataset dimensions */
- int i, j; /* local index variables */
- herr_t ret; /* Generic return value */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t gid = -1; /* Group ID */
+ int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ int i, j; /* local index variables */
+ herr_t ret; /* Generic return value */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): full path");
/* Initialize write buffer */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -7696,99 +9127,129 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create 2D int dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST (should fail - intermediate groups not there) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Ocopy(fid_src, NAME_DATASET_SUB_SUB, fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if( ret >= 0) TEST_ERROR
+ }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
/* Create the intermediate groups in destination file */
- if((gid = H5Gcreate2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if((gid = H5Gcreate2(fid_dst, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_dst, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
- if((gid = H5Gcreate2(fid_dst, NAME_GROUP_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_dst, NAME_GROUP_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST, using full path */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Sclose(sid);
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_path */
-
/*-------------------------------------------------------------------------
* Function: test_copy_same_file_named_datatype
*
@@ -7805,9 +9266,9 @@ error:
static int
test_copy_same_file_named_datatype(hid_t fcpl_src, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ char filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): named datatype in same file");
@@ -7818,46 +9279,55 @@ test_copy_same_file_named_datatype(hid_t fcpl_src, hid_t fapl)
token_reset();
/* create source file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create named datatype */
- if((H5Tcommit2(fid, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
+ if ((H5Tcommit2(fid, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the datatype from SRC to DST */
- if(H5Ocopy(fid, NAME_DATATYPE_SIMPLE, fid, NAME_DATATYPE_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid, NAME_DATATYPE_SIMPLE, fid, NAME_DATATYPE_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the copied datatype */
- if((tid2 = H5Topen2(fid, NAME_DATATYPE_SIMPLE2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((tid2 = H5Topen2(fid, NAME_DATATYPE_SIMPLE2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Compare the datatypes */
- if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if (H5Tequal(tid, tid2) != TRUE)
+ TEST_ERROR
/* close the destination datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* close the source datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid2);
H5Tclose(tid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_same_file_named_datatype */
-
/*-------------------------------------------------------------------------
* Function: test_copy_old_layout
*
@@ -7878,15 +9348,16 @@ error:
static int
test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t src_fapl = -1; /* Source file FAPL ID */
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t src_fapl = -1; /* Source file FAPL ID */
const char *src_filename = H5_get_srcdir_filename(FILE_OLD_LAYOUT); /* Corrected test file name */
- char dst_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
- if(test_open) {
+ if (test_open) {
TESTING("H5Ocopy(): opened dataset with old layout format");
- } else {
+ }
+ else {
TESTING("H5Ocopy(): dataset with old layout format");
}
@@ -7897,66 +9368,82 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open)
token_reset();
/* Setup */
- if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR
+ if ((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0)
+ TEST_ERROR
/* open source file (read-only) */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* Close source FAPL */
- if(H5Pclose(src_fapl) < 0) TEST_ERROR
+ if (H5Pclose(src_fapl) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(test_open) {
+ if (test_open) {
/* open the source dataset */
- if((did = H5Dopen2(fid_src, NAME_OLD_FORMAT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_OLD_FORMAT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
}
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_OLD_FORMAT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_OLD_FORMAT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* open the source dataset */
- if((did = H5Dopen2(fid_src, NAME_OLD_FORMAT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_OLD_FORMAT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
}
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(src_fapl);
H5Dclose(did2);
H5Dclose(did);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_old_layout */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compact_named_vl
*
@@ -7974,25 +9461,25 @@ error:
static int
test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid_copy=-1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid_copy = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): compact dataset with named VLEN datatype");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].len = i+1;
- buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
- for(j = 0; j < buf[i].len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].len = i + 1;
+ buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
+ for (j = 0; j < buf[i].len; j++)
((int *)buf[i].p)[j] = (int)(i * 10 + j);
} /* end for */
@@ -8004,99 +9491,129 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* make a copy of the datatype for later use */
- if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
+ if ((tid_copy = H5Tcopy(tid)) < 0)
+ TEST_ERROR
/* named datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create and set compact plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_layout(pid, H5D_COMPACT) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close compact plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid_copy) < 0) TEST_ERROR
+ if (H5Tclose(tid_copy) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
@@ -8107,11 +9624,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_compact_named_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_contig_named_vl
*
@@ -8129,24 +9646,24 @@ error:
static int
test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid_copy=-1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid_copy = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): contigous dataset with named VLEN datatype");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].len = i+1;
- buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
- for(j = 0; j < buf[i].len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].len = i + 1;
+ buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
+ for (j = 0; j < buf[i].len; j++)
((int *)buf[i].p)[j] = (int)(i * 10 + j);
} /* end for */
@@ -8158,92 +9675,119 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* make a copy of the datatype for later use */
- if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
+ if ((tid_copy = H5Tcopy(tid)) < 0)
+ TEST_ERROR
/* named datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid_copy) < 0) TEST_ERROR
+ if (H5Tclose(tid_copy) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Treclaim(tid_copy, sid, H5P_DEFAULT, buf);
@@ -8253,11 +9797,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_contig_named_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_chunked_named_vl
*
@@ -8276,32 +9820,34 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t test_open)
+test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t test_open)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid_copy=-1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
-
- if(test_open) {
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid_copy = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ if (test_open) {
TESTING("H5Ocopy(): chunked and opened dataset with named VLEN datatype");
- } else {
+ }
+ else {
TESTING("H5Ocopy(): chunked dataset with named VLEN datatype");
}
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].len = i+1;
- buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
- for(j = 0; j < buf[i].len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].len = i + 1;
+ buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
+ for (j = 0; j < buf[i].len; j++)
((int *)buf[i].p)[j] = (int)(i * 10 + j);
} /* end for */
@@ -8313,104 +9859,134 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* make a copy of the datatype for later use */
- if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
+ if ((tid_copy = H5Tcopy(tid)) < 0)
+ TEST_ERROR
/* named datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- /* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ /* create and set chunk plist */
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, chunk_dim1d) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close compact plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
}
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
}
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid_copy) < 0) TEST_ERROR
+ if (H5Tclose(tid_copy) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
@@ -8421,11 +9997,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_chunked_named_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compressed_named_vl
*
@@ -8443,26 +10019,26 @@ error:
static int
test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid_copy=-1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid_copy = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): compressed dataset with named VLEN datatype");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].len = i+1;
- buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
- for(j = 0; j < buf[i].len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].len = i + 1;
+ buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int));
+ for (j = 0; j < buf[i].len; j++)
((int *)buf[i].p)[j] = (int)(i * 10 + j);
} /* end for */
@@ -8474,100 +10050,131 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* make a copy of the datatype for later use */
- if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
+ if ((tid_copy = H5Tcopy(tid)) < 0)
+ TEST_ERROR
/* named datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- /* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
- if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ /* create and set chunk plist */
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, chunk_dim1d) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(pid, 9) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close compact plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid_copy) < 0) TEST_ERROR
+ if (H5Tclose(tid_copy) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
@@ -8578,11 +10185,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_compressed_named_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compact_vl_vl
*
@@ -8600,41 +10207,40 @@ error:
static int
test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid=-1, tid2=-1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j, k; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- hvl_t *tvl; /* Temporary pointer to VL information */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j, k; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ hvl_t * tvl; /* Temporary pointer to VL information */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): compact dataset with nested VLEN datatype");
/* set initial data values */
- for(i=0; i<DIM_SIZE_1; i++) {
- buf[i].p=HDmalloc((i+1)*sizeof(hvl_t));
- if(buf[i].p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].p = HDmalloc((i + 1) * sizeof(hvl_t));
+ if (buf[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
return 1;
} /* end if */
- buf[i].len=i+1;
- for(tvl = (hvl_t *)buf[i].p,j=0; j<(i+1); j++, tvl++) {
- tvl->p=HDmalloc((j+1)*sizeof(unsigned int));
- if(tvl->p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ buf[i].len = i + 1;
+ for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) {
+ tvl->p = HDmalloc((j + 1) * sizeof(unsigned int));
+ if (tvl->p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return 1;
} /* end if */
- tvl->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)tvl->p)[k]=i*100+j*10+k;
+ tvl->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)tvl->p)[k] = i * 100 + j * 10 + k;
} /* end for */
- } /* end for */
-
+ } /* end for */
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -8644,93 +10250,123 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create nested VL datatype */
- if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if ((tid2 = H5Tvlen_create(tid)) < 0)
+ TEST_ERROR
/* create and set compact plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_layout(pid, H5D_COMPACT) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close compact plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid2, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Treclaim(tid2, sid, H5P_DEFAULT, buf);
@@ -8741,11 +10377,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_compact_vl_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_contig_vl_vl
*
@@ -8764,47 +10400,48 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t test_open)
+test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t test_open)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid=-1, tid2=-1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j, k; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- hvl_t *tvl; /* Temporary pointer to VL information */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
-
- if(test_open) {
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j, k; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ hvl_t * tvl; /* Temporary pointer to VL information */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ if (test_open) {
TESTING("H5Ocopy(): contigous and opened dataset with nested VLEN datatype");
- } else {
+ }
+ else {
TESTING("H5Ocopy(): contigous dataset with nested VLEN datatype");
}
/* set initial data values */
- for(i=0; i<DIM_SIZE_1; i++) {
- buf[i].p=HDmalloc((i+1)*sizeof(hvl_t));
- if(buf[i].p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].p = HDmalloc((i + 1) * sizeof(hvl_t));
+ if (buf[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
TEST_ERROR
} /* end if */
- buf[i].len=i+1;
- for(tvl = (hvl_t *)buf[i].p,j=0; j<(i+1); j++, tvl++) {
- tvl->p=HDmalloc((j+1)*sizeof(unsigned int));
- if(tvl->p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ buf[i].len = i + 1;
+ for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) {
+ tvl->p = HDmalloc((j + 1) * sizeof(unsigned int));
+ if (tvl->p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
TEST_ERROR
} /* end if */
- tvl->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)tvl->p)[k]=i*100+j*10+k;
+ tvl->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)tvl->p)[k] = i * 100 + j * 10 + k;
} /* end for */
- } /* end for */
-
+ } /* end for */
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -8814,96 +10451,125 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create nested VL datatype */
- if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if ((tid2 = H5Tvlen_create(tid)) < 0)
+ TEST_ERROR
/* create and set compact plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close compact plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
}
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
}
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid2, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Treclaim(tid2, sid, H5P_DEFAULT, buf);
@@ -8914,11 +10580,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_contig_vl_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_chunked_vl_vl
*
@@ -8936,41 +10602,41 @@ error:
static int
test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid2=-1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j, k; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- hvl_t *tvl; /* Temporary pointer to VL information */
- hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j, k; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ hvl_t * tvl; /* Temporary pointer to VL information */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): chunked dataset with nested VLEN datatype");
/* set initial data values */
- for(i=0; i<DIM_SIZE_1; i++) {
- buf[i].p=HDmalloc((i+1)*sizeof(hvl_t));
- if(buf[i].p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].p = HDmalloc((i + 1) * sizeof(hvl_t));
+ if (buf[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
TEST_ERROR
} /* end if */
- buf[i].len=i+1;
- for(tvl = (hvl_t *)buf[i].p,j=0; j<(i+1); j++, tvl++) {
- tvl->p=HDmalloc((j+1)*sizeof(unsigned int));
- if(tvl->p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ buf[i].len = i + 1;
+ for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) {
+ tvl->p = HDmalloc((j + 1) * sizeof(unsigned int));
+ if (tvl->p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
TEST_ERROR
} /* end if */
- tvl->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)tvl->p)[k]=i*100+j*10+k;
+ tvl->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)tvl->p)[k] = i * 100 + j * 10 + k;
} /* end for */
- } /* end for */
+ } /* end for */
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -8980,131 +10646,165 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create nested VL datatype */
- if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if ((tid2 = H5Tvlen_create(tid)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, chunk_dim1d) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Set allocation time to early */
- if(H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(pid, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL2, tid2, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL2, tid2, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_VL_VL2, fid_dst, NAME_DATASET_VL_VL2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL_VL2, fid_dst, NAME_DATASET_VL_VL2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_FARRAY, H5D_CHUNK_IDX_BTREE) != TRUE)
TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- if(compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
+ if (compare_idx_type(src_fapl, did2, H5D_CHUNK_IDX_NONE, H5D_CHUNK_IDX_BTREE) != TRUE)
TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
-
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid2, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
@@ -9115,11 +10815,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_chunked_vl_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compressed_vl_vl
*
@@ -9138,47 +10838,49 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t test_open)
+test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t test_open)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid2=-1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j, k; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- hvl_t *tvl; /* Temporary pointer to VL information */
- hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
-
- if(test_open) {
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j, k; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ hvl_t * tvl; /* Temporary pointer to VL information */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ if (test_open) {
TESTING("H5Ocopy(): compressed and opened dataset with nested VLEN datatype");
- } else {
+ }
+ else {
TESTING("H5Ocopy(): compressed dataset with nested VLEN datatype");
}
/* set initial data values */
- for(i=0; i<DIM_SIZE_1; i++) {
- buf[i].p=HDmalloc((i+1)*sizeof(hvl_t));
- if(buf[i].p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].p = HDmalloc((i + 1) * sizeof(hvl_t));
+ if (buf[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
TEST_ERROR
} /* end if */
- buf[i].len=i+1;
- for(tvl = (hvl_t *)buf[i].p,j=0; j<(i+1); j++, tvl++) {
- tvl->p=HDmalloc((j+1)*sizeof(unsigned int));
- if(tvl->p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ buf[i].len = i + 1;
+ for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) {
+ tvl->p = HDmalloc((j + 1) * sizeof(unsigned int));
+ if (tvl->p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
TEST_ERROR
} /* end if */
- tvl->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)tvl->p)[k]=i*100+j*10+k;
+ tvl->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)tvl->p)[k] = i * 100 + j * 10 + k;
} /* end for */
- } /* end for */
+ } /* end for */
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -9188,99 +10890,128 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create nested VL datatype */
- if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if ((tid2 = H5Tvlen_create(tid)) < 0)
+ TEST_ERROR
- /* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
- if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ /* create and set chunk plist */
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, chunk_dim1d) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(pid, 9) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close compact plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
}
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(!test_open) {
+ if (!test_open) {
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
}
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid2, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
@@ -9291,7 +11022,8 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_compressed_vl_vl */
@@ -9299,12 +11031,11 @@ error:
* Common data structure for the copy_dataset_*_cmpd_vl tests.
*/
typedef struct cmpd_vl_t {
- int a;
- hvl_t b;
+ int a;
+ hvl_t b;
double c;
} cmpd_vl_t;
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_contig_cmpd_vl
*
@@ -9322,27 +11053,27 @@ typedef struct cmpd_vl_t {
static int
test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t tid2 = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t did2 = -1; /* Dataset ID */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t tid2 = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t did2 = -1; /* Dataset ID */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): contiguous dataset with compound VLEN datatype");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].a = (int)(i * (i - 1));
- buf[i].b.len = i+1;
- buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
- for(j = 0; j < buf[i].b.len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].a = (int)(i * (i - 1));
+ buf[i].b.len = i + 1;
+ buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
+ for (j = 0; j < buf[i].b.len; j++)
((int *)buf[i].b.p)[j] = (int)(i * 10 + j);
buf[i].c = 1.0F / ((float)i + 1.0F);
} /* end for */
@@ -9355,88 +11086,118 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid2 = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(cmpd_vl_t))) < 0) TEST_ERROR
- if(H5Tinsert(tid, "a", HOFFSET(cmpd_vl_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(tid, "b", HOFFSET(cmpd_vl_t, b), tid2) < 0) TEST_ERROR
- if(H5Tinsert(tid, "c", HOFFSET(cmpd_vl_t, c), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
+ if ((tid2 = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(cmpd_vl_t))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "a", HOFFSET(cmpd_vl_t, a), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "b", HOFFSET(cmpd_vl_t, b), tid2) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "c", HOFFSET(cmpd_vl_t, c), H5T_NATIVE_DOUBLE) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CMPD_VL, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CMPD_VL, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_CMPD_VL, fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CMPD_VL, fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Treclaim(tid, sid, H5P_DEFAULT, buf);
@@ -9446,11 +11207,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_contig_cmpd_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_chunked_cmpd_vl
*
@@ -9468,27 +11229,27 @@ error:
static int
test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
- cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): chunked dataset with compound VLEN datatype");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].a = (int)(i * (i - 1));
- buf[i].b.len = i+1;
- buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
- for(j = 0; j < buf[i].b.len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].a = (int)(i * (i - 1));
+ buf[i].b.len = i + 1;
+ buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
+ for (j = 0; j < buf[i].b.len; j++)
((int *)buf[i].b.p)[j] = (int)(i * 10 + j);
buf[i].c = 1.0F / ((float)i + 1.0F);
} /* end for */
@@ -9501,95 +11262,127 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid2 = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(cmpd_vl_t))) < 0) TEST_ERROR
- if(H5Tinsert(tid, "a", HOFFSET(cmpd_vl_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(tid, "b", HOFFSET(cmpd_vl_t, b), tid2) < 0) TEST_ERROR
- if(H5Tinsert(tid, "c", HOFFSET(cmpd_vl_t, c), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
+ if ((tid2 = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(cmpd_vl_t))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "a", HOFFSET(cmpd_vl_t, a), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "b", HOFFSET(cmpd_vl_t, b), tid2) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "c", HOFFSET(cmpd_vl_t, c), H5T_NATIVE_DOUBLE) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, chunk_dim1d) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CMPD_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CMPD_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close chunk plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_CMPD_VL, fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CMPD_VL, fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Treclaim(tid, sid, H5P_DEFAULT, buf);
@@ -9600,11 +11393,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_chunked_cmpd_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compact_cmpd_vl
*
@@ -9622,26 +11415,26 @@ error:
static int
test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Dataset creation property list ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t dxpl_id = -1; /* Dataset transfer property list ID */
- unsigned int i, j; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): compact dataset with compound VLEN datatype");
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].a = (int)(i * (i - 1));
- buf[i].b.len = i+1;
- buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
- for(j = 0; j < buf[i].b.len; j++)
+ for (i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].a = (int)(i * (i - 1));
+ buf[i].b.len = i + 1;
+ buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
+ for (j = 0; j < buf[i].b.len; j++)
((int *)buf[i].b.p)[j] = (int)(i * 10 + j);
buf[i].c = 1.0F / ((float)i + 1.0F);
} /* end for */
@@ -9654,95 +11447,127 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid2 = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(cmpd_vl_t))) < 0) TEST_ERROR
- if(H5Tinsert(tid, "a", HOFFSET(cmpd_vl_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(tid, "b", HOFFSET(cmpd_vl_t, b), tid2) < 0) TEST_ERROR
- if(H5Tinsert(tid, "c", HOFFSET(cmpd_vl_t, c), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
+ if ((tid2 = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(cmpd_vl_t))) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "a", HOFFSET(cmpd_vl_t, a), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "b", HOFFSET(cmpd_vl_t, b), tid2) < 0)
+ TEST_ERROR
+ if (H5Tinsert(tid, "c", HOFFSET(cmpd_vl_t, c), H5T_NATIVE_DOUBLE) < 0)
+ TEST_ERROR
/* create and set compact plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_layout(pid, H5D_COMPACT) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_CMPD_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_CMPD_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close compact plist */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy the dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_CMPD_VL, fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CMPD_VL, fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the dataset for copy */
- if((did = H5Dopen2(fid_src, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open the destination dataset */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the destination dataset */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the source dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
- if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if (H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0)
+ TEST_ERROR
+ if (H5Treclaim(tid, sid, dxpl_id, buf) < 0)
+ TEST_ERROR
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
} /* end if */
/* close datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did2);
H5Dclose(did);
H5Treclaim(tid, sid, H5P_DEFAULT, buf);
@@ -9753,11 +11578,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_compact_cmpd_vl */
-
/*-------------------------------------------------------------------------
* Function: test_copy_null_ref
*
@@ -9779,17 +11604,17 @@ error:
static int
test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Object copy property list ID */
- hid_t did1 = -1, did2 = -1; /* Dataset IDs */
- hsize_t dim1d[1] = {2}; /* Dataset dimensions */
- hobj_ref_t obj_buf[2]; /* Buffer for object refs */
- hdset_reg_ref_t reg_buf[2]; /* Buffer for region refs */
- char zeros[MAX(sizeof(obj_buf),sizeof(reg_buf))]; /* Array of zeros, for memcmp */
- char src_filename[NAME_BUF_SIZE];
- char mid_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Object copy property list ID */
+ hid_t did1 = -1, did2 = -1; /* Dataset IDs */
+ hsize_t dim1d[1] = {2}; /* Dataset dimensions */
+ hobj_ref_t obj_buf[2]; /* Buffer for object refs */
+ hdset_reg_ref_t reg_buf[2]; /* Buffer for region refs */
+ char zeros[MAX(sizeof(obj_buf), sizeof(reg_buf))]; /* Array of zeros, for memcmp */
+ char src_filename[NAME_BUF_SIZE];
+ char mid_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): NULL references");
@@ -9805,121 +11630,150 @@ test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap
token_reset();
/* Create source file */
- if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ if ((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
TEST_ERROR
/* Create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* Create object reference dataset at SRC file */
- if((did1 = H5Dcreate2(fid1, "obj_ref_dset", H5T_STD_REF_OBJ, sid,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did1 = H5Dcreate2(fid1, "obj_ref_dset", H5T_STD_REF_OBJ, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create region reference dataset at SRC file */
- if((did2 = H5Dcreate2(fid1, "reg_ref_dset", H5T_STD_REF_DSETREG,
- sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dcreate2(fid1, "reg_ref_dset", H5T_STD_REF_DSETREG, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create references */
- if(H5Rcreate(&obj_buf[0], did1, ".", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR
- if(H5Rcreate(&obj_buf[1], did2, ".", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR
- if(H5Rcreate(&reg_buf[0], did1, ".", H5R_DATASET_REGION, sid) < 0)
+ if (H5Rcreate(&obj_buf[0], did1, ".", H5R_OBJECT, (hid_t)-1) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&obj_buf[1], did2, ".", H5R_OBJECT, (hid_t)-1) < 0)
TEST_ERROR
- if(H5Rcreate(&reg_buf[1], did2, ".", H5R_DATASET_REGION, sid) < 0)
+ if (H5Rcreate(&reg_buf[0], did1, ".", H5R_DATASET_REGION, sid) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&reg_buf[1], did2, ".", H5R_DATASET_REGION, sid) < 0)
TEST_ERROR
/* Write data into file */
- if(H5Dwrite(did1, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf)
- < 0) TEST_ERROR
- if(H5Dwrite(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- reg_buf) < 0) TEST_ERROR
+ if (H5Dwrite(did1, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, reg_buf) < 0)
+ TEST_ERROR
/* Close datasets */
- if(H5Dclose(did1) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did1) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* Create middle file */
- if((fid2 = H5Fcreate(mid_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ if ((fid2 = H5Fcreate(mid_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
TEST_ERROR
/* Copy the source file to the middle file. Note the expand references
* flag is not set. */
- if(H5Ocopy(fid1, "/", fid2, "/A", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid1, "/", fid2, "/A", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close source file */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Open copied datasets */
- if((did1 = H5Dopen2(fid2, "/A/obj_ref_dset", H5P_DEFAULT)) < 0) TEST_ERROR
- if((did2 = H5Dopen2(fid2, "/A/reg_ref_dset", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did1 = H5Dopen2(fid2, "/A/obj_ref_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did2 = H5Dopen2(fid2, "/A/reg_ref_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Read copied datasets */
- if(H5Dread(did1, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf)
- < 0) TEST_ERROR
- if(H5Dread(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- reg_buf) < 0) TEST_ERROR
+ if (H5Dread(did1, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf) < 0)
+ TEST_ERROR
+ if (H5Dread(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, reg_buf) < 0)
+ TEST_ERROR
/* Verify that the references contain only "0" bytes */
- if(HDmemcmp(obj_buf, zeros, sizeof(obj_buf))) TEST_ERROR
- if(HDmemcmp(reg_buf, zeros, sizeof(reg_buf))) TEST_ERROR
+ if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf)))
+ TEST_ERROR
+ if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf)))
+ TEST_ERROR
/* Close datasets */
- if(H5Dclose(did1) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did1) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* Create destination file */
- if((fid1 = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ if ((fid1 = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
TEST_ERROR
/* Create object copy property list */
- if((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
/* Set the "expand references" flag */
- if(H5Pset_copy_object(pid, H5O_COPY_EXPAND_REFERENCE_FLAG) < 0) TEST_ERROR
+ if (H5Pset_copy_object(pid, H5O_COPY_EXPAND_REFERENCE_FLAG) < 0)
+ TEST_ERROR
/* Copy the middle file to the destination file. Note the expand references
* flag *is* set, even though the references are now NULL. */
- if(H5Ocopy(fid2, "/", fid1, "/AA", pid, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid2, "/", fid1, "/AA", pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close source file */
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Open copied datasets */
- if((did1 = H5Dopen2(fid1, "/AA/A/obj_ref_dset", H5P_DEFAULT)) < 0) TEST_ERROR
- if((did2 = H5Dopen2(fid1, "/AA/A/reg_ref_dset", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did1 = H5Dopen2(fid1, "/AA/A/obj_ref_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did2 = H5Dopen2(fid1, "/AA/A/reg_ref_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Read copied datasets */
- if(H5Dread(did1, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf)
- < 0) TEST_ERROR
- if(H5Dread(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- reg_buf) < 0) TEST_ERROR
+ if (H5Dread(did1, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf) < 0)
+ TEST_ERROR
+ if (H5Dread(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, reg_buf) < 0)
+ TEST_ERROR
/* Verify that the references contain only "0" bytes */
- if(HDmemcmp(obj_buf, zeros, sizeof(obj_buf))) TEST_ERROR
- if(HDmemcmp(reg_buf, zeros, sizeof(reg_buf))) TEST_ERROR
+ if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf)))
+ TEST_ERROR
+ if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf)))
+ TEST_ERROR
/* Close */
- if(H5Pclose(pid) < 0) TEST_ERROR
- if(H5Dclose(did1) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
- if(H5Fclose(fid1) < 0) TEST_ERROR
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did1) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pid);
H5Dclose(did1);
H5Dclose(did2);
H5Fclose(fid1);
H5Fclose(fid2);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_null_ref */
-
/*-------------------------------------------------------------------------
* Function: test_copy_null_ref_open
*
@@ -9944,21 +11798,21 @@ error:
static int
test_copy_null_ref_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t pid = -1; /* Object copy property list ID */
- hid_t did1 = -1, did2 = -1; /* Dataset IDs */
- hid_t did3 = -1, did4 = -1; /* Dataset IDs */
- hid_t did5 = -1, did6 = -1; /* Dataset IDs */
- hid_t dcpl = -1; /* Dataset creation property list */
- hsize_t chunk_dim1d[1] = {2}; /* Chunk dimensions */
- hsize_t dim1d[1] = {3}; /* Dataset dimensions */
- hobj_ref_t obj_buf[3]; /* Buffer for object refs */
- hdset_reg_ref_t reg_buf[3]; /* Buffer for region refs */
- char zeros[MAX(sizeof(obj_buf),sizeof(reg_buf))]; /* Array of zeros, for memcmp */
- char src_filename[NAME_BUF_SIZE];
- char mid_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Object copy property list ID */
+ hid_t did1 = -1, did2 = -1; /* Dataset IDs */
+ hid_t did3 = -1, did4 = -1; /* Dataset IDs */
+ hid_t did5 = -1, did6 = -1; /* Dataset IDs */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hsize_t chunk_dim1d[1] = {2}; /* Chunk dimensions */
+ hsize_t dim1d[1] = {3}; /* Dataset dimensions */
+ hobj_ref_t obj_buf[3]; /* Buffer for object refs */
+ hdset_reg_ref_t reg_buf[3]; /* Buffer for region refs */
+ char zeros[MAX(sizeof(obj_buf), sizeof(reg_buf))]; /* Array of zeros, for memcmp */
+ char src_filename[NAME_BUF_SIZE];
+ char mid_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): NULL references for opened datasets");
@@ -9974,118 +11828,150 @@ test_copy_null_ref_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds
token_reset();
/* Create source file */
- if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ if ((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
TEST_ERROR
/* Create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
- /* create and set chunk plist */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dim1d) < 0) TEST_ERROR
- if(H5Pset_deflate(dcpl, 9) < 0) TEST_ERROR
- if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) TEST_ERROR
+ /* create and set chunk plist */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(dcpl, 1, chunk_dim1d) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(dcpl, 9) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ TEST_ERROR
/* Create object reference dataset at SRC file */
- if((did1 = H5Dcreate2(fid1, "obj_ref_dset", H5T_STD_REF_OBJ, sid,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did1 = H5Dcreate2(fid1, "obj_ref_dset", H5T_STD_REF_OBJ, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create region reference dataset at SRC file */
- if((did2 = H5Dcreate2(fid1, "reg_ref_dset", H5T_STD_REF_DSETREG,
- sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dcreate2(fid1, "reg_ref_dset", H5T_STD_REF_DSETREG, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* Create references */
- if(H5Rcreate(&obj_buf[0], did1, ".", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR
- if(H5Rcreate(&obj_buf[1], did2, ".", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR
- if(H5Rcreate(&reg_buf[0], did1, ".", H5R_DATASET_REGION, sid) < 0)
+ if (H5Rcreate(&obj_buf[0], did1, ".", H5R_OBJECT, (hid_t)-1) < 0)
TEST_ERROR
- if(H5Rcreate(&reg_buf[1], did2, ".", H5R_DATASET_REGION, sid) < 0)
+ if (H5Rcreate(&obj_buf[1], did2, ".", H5R_OBJECT, (hid_t)-1) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&reg_buf[0], did1, ".", H5R_DATASET_REGION, sid) < 0)
+ TEST_ERROR
+ if (H5Rcreate(&reg_buf[1], did2, ".", H5R_DATASET_REGION, sid) < 0)
TEST_ERROR
/* Write data into file */
- if(H5Dwrite(did1, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf)
- < 0) TEST_ERROR
- if(H5Dwrite(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- reg_buf) < 0) TEST_ERROR
-
+ if (H5Dwrite(did1, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, reg_buf) < 0)
+ TEST_ERROR
/* Create middle file */
- if((fid2 = H5Fcreate(mid_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ if ((fid2 = H5Fcreate(mid_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
TEST_ERROR
/* Copy the source file to the middle file. Note the expand references
* flag is not set. */
- if(H5Ocopy(fid1, "/", fid2, "/A", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid1, "/", fid2, "/A", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close datasets in source file */
- if(H5Dclose(did1) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did1) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* Close source file */
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
/* Open copied datasets */
- if((did3 = H5Dopen2(fid2, "/A/obj_ref_dset", H5P_DEFAULT)) < 0) TEST_ERROR
- if((did4 = H5Dopen2(fid2, "/A/reg_ref_dset", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did3 = H5Dopen2(fid2, "/A/obj_ref_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did4 = H5Dopen2(fid2, "/A/reg_ref_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Read copied datasets */
- if(H5Dread(did3, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf)
- < 0) TEST_ERROR
- if(H5Dread(did4, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- reg_buf) < 0) TEST_ERROR
+ if (H5Dread(did3, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf) < 0)
+ TEST_ERROR
+ if (H5Dread(did4, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, reg_buf) < 0)
+ TEST_ERROR
/* Verify that the references contain only "0" bytes */
- if(HDmemcmp(obj_buf, zeros, sizeof(obj_buf))) TEST_ERROR
- if(HDmemcmp(reg_buf, zeros, sizeof(reg_buf))) TEST_ERROR
+ if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf)))
+ TEST_ERROR
+ if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf)))
+ TEST_ERROR
/* Create destination file */
- if((fid3 = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
- TEST_ERROR
+ if ((fid3 = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* Create object copy property list */
- if((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
/* Set the "expand references" flag */
- if(H5Pset_copy_object(pid, H5O_COPY_EXPAND_REFERENCE_FLAG) < 0) TEST_ERROR
+ if (H5Pset_copy_object(pid, H5O_COPY_EXPAND_REFERENCE_FLAG) < 0)
+ TEST_ERROR
/* Copy the middle file to the destination file. Note the expand references
* flag *is* set, even though the references are now NULL. */
- if(H5Ocopy(fid2, "/", fid3, "/AA", pid, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid2, "/", fid3, "/AA", pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Close datasets in middle file */
- if(H5Dclose(did3) < 0) TEST_ERROR
- if(H5Dclose(did4) < 0) TEST_ERROR
+ if (H5Dclose(did3) < 0)
+ TEST_ERROR
+ if (H5Dclose(did4) < 0)
+ TEST_ERROR
/* Close the middle file */
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Open copied datasets */
- if((did5 = H5Dopen2(fid3, "/AA/A/obj_ref_dset", H5P_DEFAULT)) < 0) TEST_ERROR
- if((did6 = H5Dopen2(fid3, "/AA/A/reg_ref_dset", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did5 = H5Dopen2(fid3, "/AA/A/obj_ref_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did6 = H5Dopen2(fid3, "/AA/A/reg_ref_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Read copied datasets */
- if(H5Dread(did5, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf)
- < 0) TEST_ERROR
- if(H5Dread(did6, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- reg_buf) < 0) TEST_ERROR
+ if (H5Dread(did5, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_buf) < 0)
+ TEST_ERROR
+ if (H5Dread(did6, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, reg_buf) < 0)
+ TEST_ERROR
/* Verify that the references contain only "0" bytes */
- if(HDmemcmp(obj_buf, zeros, sizeof(obj_buf))) TEST_ERROR
- if(HDmemcmp(reg_buf, zeros, sizeof(reg_buf))) TEST_ERROR
+ if (HDmemcmp(obj_buf, zeros, sizeof(obj_buf)))
+ TEST_ERROR
+ if (HDmemcmp(reg_buf, zeros, sizeof(reg_buf)))
+ TEST_ERROR
/* Close */
- if(H5Pclose(pid) < 0) TEST_ERROR
- if(H5Pclose(dcpl) < 0) TEST_ERROR
- if(H5Dclose(did5) < 0) TEST_ERROR
- if(H5Dclose(did6) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ if (H5Dclose(did5) < 0)
+ TEST_ERROR
+ if (H5Dclose(did6) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid3) < 0)
+ TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pid);
H5Pclose(dcpl);
H5Sclose(sid);
@@ -10098,11 +11984,11 @@ error:
H5Fclose(fid1);
H5Fclose(fid2);
H5Fclose(fid3);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_null_ref_open */
-
/*-------------------------------------------------------------------------
* Function: test_copy_attr_crt_order
*
@@ -10120,11 +12006,11 @@ error:
static int
test_copy_attr_crt_order(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gcplid = -1; /* Group creation property list ID */
- hid_t gid1 = -1, gid2 = -1; /* Group IDs */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gcplid = -1; /* Group creation property list ID */
+ hid_t gid1 = -1, gid2 = -1; /* Group IDs */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): attributes with creation order");
@@ -10136,95 +12022,109 @@ test_copy_attr_crt_order(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
token_reset();
/* Create source file */
- if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ if ((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
TEST_ERROR
/* Create GCPL */
- if((gcplid = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcplid = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Create group with creation order tracked */
- if(H5Pset_attr_creation_order(gcplid, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR
- if((gid1 = H5Gcreate2(fid1, NAME_GROUP_TOP, H5P_DEFAULT, gcplid, H5P_DEFAULT))
- < 0)
+ if (H5Pset_attr_creation_order(gcplid, H5P_CRT_ORDER_TRACKED) < 0)
+ TEST_ERROR
+ if ((gid1 = H5Gcreate2(fid1, NAME_GROUP_TOP, H5P_DEFAULT, gcplid, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Add attributes to group */
- if(test_copy_attach_attributes(gid1, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid1, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Close group */
- if(H5Gclose(gid1) < 0) TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
/* Create group with creation order tracked and indexed */
- if(H5Pset_attr_creation_order(gcplid, H5P_CRT_ORDER_TRACKED
- | H5P_CRT_ORDER_INDEXED) < 0)
+ if (H5Pset_attr_creation_order(gcplid, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
TEST_ERROR
- if((gid1 = H5Gcreate2(fid1, NAME_GROUP_TOP2, H5P_DEFAULT, gcplid,
- H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(fid1, NAME_GROUP_TOP2, H5P_DEFAULT, gcplid, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Add attributes to group */
- if(test_copy_attach_attributes(gid1, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid1, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Close group */
- if(H5Gclose(gid1) < 0) TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcplid) < 0) TEST_ERROR
-
+ if (H5Pclose(gcplid) < 0)
+ TEST_ERROR
/* Create destination file */
- if((fid2 = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ if ((fid2 = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
TEST_ERROR
/* Copy the groups to the destination file */
- if(H5Ocopy(fid1, NAME_GROUP_TOP, fid2, NAME_GROUP_TOP, H5P_DEFAULT,
- H5P_DEFAULT) < 0)
+ if (H5Ocopy(fid1, NAME_GROUP_TOP, fid2, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
- if(H5Ocopy(fid1, NAME_GROUP_TOP2, fid2, NAME_GROUP_TOP2, H5P_DEFAULT,
- H5P_DEFAULT) < 0)
+ if (H5Ocopy(fid1, NAME_GROUP_TOP2, fid2, NAME_GROUP_TOP2, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Open groups with creation order tracked */
- if((gid1 = H5Gopen2(fid1, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) TEST_ERROR
- if((gid2 = H5Gopen2(fid2, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid1 = H5Gopen2(fid1, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gopen2(fid2, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Compare the attributes */
- if(compare_std_attributes(gid1, gid2, H5P_DEFAULT) != TRUE) TEST_ERROR
+ if (compare_std_attributes(gid1, gid2, H5P_DEFAULT) != TRUE)
+ TEST_ERROR
/* Close groups */
- if(H5Gclose(gid1) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Open groups with creation order tracked and indexed */
- if((gid1 = H5Gopen2(fid1, NAME_GROUP_TOP2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((gid2 = H5Gopen2(fid2, NAME_GROUP_TOP2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid1 = H5Gopen2(fid1, NAME_GROUP_TOP2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((gid2 = H5Gopen2(fid2, NAME_GROUP_TOP2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Compare the attributes */
- if(compare_std_attributes(gid1, gid2, H5P_DEFAULT) != TRUE) TEST_ERROR
+ if (compare_std_attributes(gid1, gid2, H5P_DEFAULT) != TRUE)
+ TEST_ERROR
/* Close groups */
- if(H5Gclose(gid1) < 0) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid1) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close */
- if(H5Fclose(fid1) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid1);
H5Gclose(gid2);
H5Pclose(gcplid);
H5Fclose(fid1);
H5Fclose(fid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_attr_crt_order */
-
/*-------------------------------------------------------------------------
* Function: test_copy_committed_datatype_merge
*
@@ -10239,32 +12139,32 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
- hid_t dst_fapl, hbool_t reopen)
+test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t reopen)
{
- hid_t fid_src1 = -1, fid_src2 = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- unsigned int i; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info2_t oinfo; /* Object info */
- H5O_token_t exp_token; /* Expected object token */
- char src1_filename[NAME_BUF_SIZE];
- char src2_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
- int token_cmp;
-
- if(reopen) {
+ hid_t fid_src1 = -1, fid_src2 = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ unsigned int i; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ int buf[DIM_SIZE_1]; /* Buffer for writing data */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
+ char src1_filename[NAME_BUF_SIZE];
+ char src2_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
+
+ if (reopen) {
TESTING("H5Ocopy(): merging committed datatypes with reopen")
} /* end if */
else
TESTING("H5Ocopy(): merging committed datatypes")
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = (int)i;
/* Initialize the filenames */
@@ -10276,185 +12176,262 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
token_reset();
/* create source files */
- if((fid_src1 = H5Fcreate(src1_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
- if((fid_src2 = H5Fcreate(src2_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src1 = H5Fcreate(src1_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
+ if ((fid_src2 = H5Fcreate(src2_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/*
* Populate source file 1
*/
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype */
- if((H5Tcommit2(fid_src1, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src1, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src1, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src1, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file 1 */
- if(H5Fclose(fid_src1) < 0) TEST_ERROR
+ if (H5Fclose(fid_src1) < 0)
+ TEST_ERROR
/*
* Populate source file 2
*/
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype */
- if((H5Tcommit2(fid_src2, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src2, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src2, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src2, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file 1 */
- if(H5Fclose(fid_src2) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_src2) < 0)
+ TEST_ERROR
/* open the source files with read-only */
- if((fid_src1 = H5Fopen(src1_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
- if((fid_src2 = H5Fopen(src2_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src1 = H5Fopen(src1_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
+ if ((fid_src2 = H5Fopen(src2_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* Create ocpl and set merge named dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/*
* First copy each entire file to the destination file (each with their own
* group), and verify the committed datatypes are merged
*/
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy SRC1 to DST */
- if(H5Ocopy(fid_src1, "/", fid_dst, NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src1, "/", fid_dst, NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy SRC2 to DST */
- if(H5Ocopy(fid_src2, "/", fid_dst, NAME_GROUP_TOP2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src2, "/", fid_dst, NAME_GROUP_TOP2, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open SRC1 committed dtype, get token */
- if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open SRC1 dset dtype, check token */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open SRC2 committed dtype, check token */
- if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open SRC2 dset dtype, check token */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Now copy only the datasets to the destination file, and verify the committed
* datatypes are merged
*/
/* recreate destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* copy SRC1 to DST */
- if(H5Ocopy(fid_src1, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src1, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy SRC2 to DST */
- if(H5Ocopy(fid_src2, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src2, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE2, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open SRC1 dset dtype, get token */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open SRC2 dset dtype, check token */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close the SRC files */
- if(H5Fclose(fid_src1) < 0) TEST_ERROR
- if(H5Fclose(fid_src2) < 0) TEST_ERROR
+ if (H5Fclose(fid_src1) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid_src2) < 0)
+ TEST_ERROR
/* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid_src1);
H5Fclose(fid_src2);
H5Fclose(fid_dst);
@@ -10462,11 +12439,11 @@ error:
H5Sclose(sid);
H5Dclose(did);
H5Pclose(ocpypl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_committed_datatype_merge */
-
/*-------------------------------------------------------------------------
* Function: test_copy_committed_datatype_merge_same_file
*
@@ -10484,27 +12461,27 @@ error:
static int
test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reopen)
{
- hid_t fid = -1; /* File ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid = -1; /* Group ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- unsigned int i; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info2_t oinfo; /* Object info */
- H5O_token_t exp_token; /* Expected object token */
- char filename[NAME_BUF_SIZE];
- int token_cmp;
-
- if(reopen)
+ hid_t fid = -1; /* File ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ unsigned int i; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ int buf[DIM_SIZE_1]; /* Buffer for writing data */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
+ char filename[NAME_BUF_SIZE];
+ int token_cmp;
+
+ if (reopen)
TESTING("H5Ocopy(): merging committed datatypes to the source file with reopen")
else
TESTING("H5Ocopy(): merging committed datatypes to the source file")
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = (int)i;
/* Initialize the filename */
@@ -10514,72 +12491,95 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo
token_reset();
/* create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/*
* Populate first group
*/
/* Create group */
- if((gid = H5Gcreate2(fid, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype */
- if((H5Tcommit2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/*
* Populate second group
*/
/* Create group */
- if((gid = H5Gcreate2(fid, NAME_GROUP_TOP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, NAME_GROUP_TOP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype */
- if((H5Tcommit2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
-
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create ocpl and set merge committed dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/*
* First copy each group to the destination group 3 (each with their own
@@ -10588,168 +12588,257 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo
* corresponding source datatype.
*/
/* Create destination group */
- if((gid = H5Gcreate2(fid, NAME_GROUP_TOP3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, NAME_GROUP_TOP3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* copy group 1 to DST */
- if(H5Ocopy(fid, NAME_GROUP_TOP, fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid, NAME_GROUP_TOP, fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy group 2 to DST */
- if(H5Ocopy(fid, NAME_GROUP_TOP2, fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid, NAME_GROUP_TOP2, fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open group 1 source committed dtype, get token */
- if((tid = H5Topen2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open group 1 source dset dtype, check token */
- if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open group 1 committed dtype, check token */
- if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open group 1 dset dtype, check token */
- if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open group 2 source committed dtype, get token and make sure it is
* different from group 1 source committed dtype */
- if((tid = H5Topen2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(!token_cmp) TEST_ERROR
+ if ((tid = H5Topen2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (!token_cmp)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open group 2 source dset dtype, check token */
- if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open group 2 committed dtype, check token */
- if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open group 2 dset dtype, check token */
- if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* Now copy only the datasets to the destination group, and verify the committed
* datatypes are merged as expected
*/
/* Create destination group */
- if((gid = H5Gcreate2(fid, NAME_GROUP_TOP4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, NAME_GROUP_TOP4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* copy SRC1 to DST */
- if(H5Ocopy(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE,
+ ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy SRC2 to DST */
- if(H5Ocopy(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2,
+ ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid) < 0) TEST_ERROR
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open group 1 source dset dtype, get token */
- if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open group 1 dset dtype, check token */
- if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open group 2 source dset dtype, get token and make sure it is
* different from group 1 source dset dtype */
- if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(!token_cmp) TEST_ERROR
+ if ((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (!token_cmp)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open group 2 dset dtype, check token */
- if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Tclose(tid);
H5Sclose(sid);
H5Dclose(did);
H5Pclose(ocpypl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_committed_datatype_merge_same_file */
-
-
/*-------------------------------------------------------------------------
* Function: test_copy_committed_dt_merge_sugg
*
@@ -10766,30 +12855,30 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
- hid_t dst_fapl, hbool_t reopen)
+test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t reopen)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- unsigned int i; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info2_t oinfo; /* Object info */
- H5O_token_t exp_token; /* Expected object token */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
- int token_cmp;
-
- if(reopen)
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ unsigned int i; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ int buf[DIM_SIZE_1]; /* Buffer for writing data */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
+
+ if (reopen)
TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen")
else
TESTING("H5Ocopy(): merging committed datatypes with suggestions")
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = (int)i;
/* Initialize the filenames */
@@ -10800,189 +12889,254 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/*
* Populate source file
*/
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/*
* Populate destination file
*/
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype "a" */
- if((H5Tcommit2(fid_dst, "/a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_dst, "/a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype "b" */
- if((H5Tcommit2(fid_dst, "/b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_dst, "/b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* Create ocpl and set merge committed dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/*
* First copy dataset using "/b" as a suggestion, and verify that it uses
* datatype "b" in the destination file
*/
/* Add datatype suggestion */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, "/b") < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, "/b") < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype "b", get token */
- if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open dset dtype, check token */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Now free suggestions, copy dataset without any suggestions, and verify
* that it uses datatype "a" in the destination file
*/
/* Free suggestions */
- if(H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* Delete destination dataset */
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE2, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype "a", get token */
- if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open dset 2 dtype, check token */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open committed dtype "b", get token */
- if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open dset dtype, check token */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid_src);
H5Fclose(fid_dst);
H5Tclose(tid);
H5Sclose(sid);
H5Dclose(did);
H5Pclose(ocpypl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_committed_dt_merge_sugg */
-
/*-------------------------------------------------------------------------
* Function: test_copy_committed_dt_merge_attr
*
@@ -10999,32 +13153,32 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
- hid_t dst_fapl, hbool_t reopen)
+test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t reopen)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t gid = -1; /* Group ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- unsigned int i; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info2_t oinfo; /* Object info */
- H5O_token_t exp_token; /* Expected object token */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
- int token_cmp;
-
- if(reopen)
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ unsigned int i; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ int buf[DIM_SIZE_1]; /* Buffer for writing data */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
+
+ if (reopen)
TESTING("H5Ocopy(): merging committed datatypes with attributes and reopen")
else
TESTING("H5Ocopy(): merging committed datatypes with attributes")
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = (int)i;
/* Initialize the filenames */
@@ -11035,129 +13189,171 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/*
* Populate source file
*/
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/*
* Populate destination file
*/
/* Create group */
- if((gid = H5Gcreate2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* create anonymous committed datatype */
- if((H5Tcommit_anon(fid_dst, tid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit_anon(fid_dst, tid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create attribute at SRC file */
- if((aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Awrite(aid, tid, buf) < 0) TEST_ERROR
+ if (H5Awrite(aid, tid, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the attribute */
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* Create ocpl and set merge committed dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/*
* Copy dataset and verify that it uses the same committed datatype as the
* already existing attribute in the destination file.
*/
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open attribute dtype, get token */
- if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_TOP, "attr", H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_TOP, "attr", H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
/* Open dset dtype, check token */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid_src);
H5Fclose(fid_dst);
H5Tclose(tid);
@@ -11166,46 +13362,47 @@ error:
H5Aclose(aid);
H5Gclose(gid);
H5Pclose(ocpypl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_committed_dt_merge_attr */
/*
* Defines used for the committed datatype tests
*/
-#define SRC_ROOT_GROUP "src_root"
-#define ROOT_NDT_INT "root_ndt_int"
+#define SRC_ROOT_GROUP "src_root"
+#define ROOT_NDT_INT "root_ndt_int"
#define GROUP_NDT_SHORT "group_ndt_short"
-#define SRC_GRP "src_grp"
-#define DST_GRP "dst_grp"
-#define DST_GRP2 "dst_grp2"
+#define SRC_GRP "src_grp"
+#define DST_GRP "dst_grp"
+#define DST_GRP2 "dst_grp2"
-#define SRC_NDT_SHORT "src_ndt_short"
+#define SRC_NDT_SHORT "src_ndt_short"
#define SRC_NDT_INT "src_ndt_int"
-#define SRC_NDT_INT2 "src_ndt_int2"
-#define SRC_NDT_FLOAT "src_ndt_float"
-#define SRC_NDT_DOUBLE "src_ndt_double"
+#define SRC_NDT_INT2 "src_ndt_int2"
+#define SRC_NDT_FLOAT "src_ndt_float"
+#define SRC_NDT_DOUBLE "src_ndt_double"
-#define DST_NDT_SHORT "dst_ndt_short"
+#define DST_NDT_SHORT "dst_ndt_short"
#define DST_NDT_INT "dst_ndt_int"
-#define DST_NDT_FLOAT "dst_ndt_float"
-#define DST_NDT_DOUBLE "dst_ndt_double"
+#define DST_NDT_FLOAT "dst_ndt_float"
+#define DST_NDT_DOUBLE "dst_ndt_double"
-#define SRC_NDT_DSET "src_ndt_dset"
-#define SRC_NDT_DSET2 "src_ndt_dset2"
-#define SRC_NDT_DSET3 "src_ndt_dset3"
+#define SRC_NDT_DSET "src_ndt_dset"
+#define SRC_NDT_DSET2 "src_ndt_dset2"
+#define SRC_NDT_DSET3 "src_ndt_dset3"
-#define SRC_DSET "src_dset"
-#define SRC_DSET1 "src_dset1"
+#define SRC_DSET "src_dset"
+#define SRC_DSET1 "src_dset1"
-#define SRC_ATTR "src_attr"
+#define SRC_ATTR "src_attr"
-#define DST_ATTR_ANON_SHORT "dst_attr_anon_short"
-#define DST_ATTR_ANON_INT "dst_attr_anon_int"
+#define DST_ATTR_ANON_SHORT "dst_attr_anon_short"
+#define DST_ATTR_ANON_INT "dst_attr_anon_int"
#define DST_ATTR "dst_attr"
-#define DST_ATTR2 "dst_attr2"
+#define DST_ATTR2 "dst_attr2"
/*-------------------------------------------------------------------------
* Function: test_copy_cdt_hier_merge
@@ -11232,32 +13429,32 @@ error:
static int
test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t reopen)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid = -1; /* Group IDs */
- hid_t f_tid = -1; /* Datatype ID for root group */
- hid_t g_tid = -1; /* Datatype ID for group */
- hid_t anon_tid = -1; /* Anonymous datatype */
- hid_t aid = -1; /* Attribute ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- int i; /* Local index variable */
- hsize_t dim1d[1]; /* dimension sizes */
- int buf[DIM_SIZE_1]; /* Buffer for data */
- H5O_token_t exp_token_int, exp_token_short; /* Expected object tokenes */
- H5O_info2_t oinfo; /* Object info */
- char src_filename[NAME_BUF_SIZE]; /* Source file name */
- char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
- int token_cmp;
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1; /* Group IDs */
+ hid_t f_tid = -1; /* Datatype ID for root group */
+ hid_t g_tid = -1; /* Datatype ID for group */
+ hid_t anon_tid = -1; /* Anonymous datatype */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ int i; /* Local index variable */
+ hsize_t dim1d[1]; /* dimension sizes */
+ int buf[DIM_SIZE_1]; /* Buffer for data */
+ H5O_token_t exp_token_int, exp_token_short; /* Expected object tokenes */
+ H5O_info2_t oinfo; /* Object info */
+ char src_filename[NAME_BUF_SIZE]; /* Source file name */
+ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
+ int token_cmp;
- if(reopen)
+ if (reopen)
TESTING("H5Ocopy(): hier. of committed datatypes and merging with reopen")
else
TESTING("H5Ocopy(): hier. of committed datatypes and merging ")
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = i;
/* Initialize the filenames */
@@ -11270,260 +13467,393 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
/*
* Populate source file
*/
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create and commit committed datatype (int) to root group */
- if((f_tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_src, ROOT_NDT_INT, f_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((f_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, ROOT_NDT_INT, f_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create group /g0 */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create and commit committed datatype (short) to group /g0 */
- if((g_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0) TEST_ERROR
- if((H5Tcommit2(gid, GROUP_NDT_SHORT, g_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((g_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(gid, GROUP_NDT_SHORT, g_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create dataset of native int in /g0 */
- if((did = H5Dcreate2(gid, SRC_DSET1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, SRC_DSET1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data to dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create dataset of committed datatype (short) in /g0 */
- if((did = H5Dcreate2(gid, SRC_NDT_DSET2, g_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, SRC_NDT_DSET2, g_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data to dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create dataset of committed datatype (int) in /g0 */
- if((did = H5Dcreate2(gid, SRC_NDT_DSET3, f_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, SRC_NDT_DSET3, f_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data to dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the datatypes */
- if(H5Tclose(f_tid) < 0) TEST_ERROR
- if(H5Tclose(g_tid) < 0) TEST_ERROR
+ if (H5Tclose(f_tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(g_tid) < 0)
+ TEST_ERROR
/* close group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/*
* Populate destination file
*/
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* create group /uncopied */
- if((gid = H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create and commit anonymous datatype (short) to /uncopied */
- if((anon_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0) TEST_ERROR
- if((H5Tcommit_anon(gid, anon_tid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((anon_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit_anon(gid, anon_tid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create attribute of anon ndt (short) in /uncopied */
- if((aid = H5Acreate2(gid, DST_ATTR_ANON_SHORT, anon_tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if ((aid = H5Acreate2(gid, DST_ATTR_ANON_SHORT, anon_tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the attribute */
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(anon_tid) < 0) TEST_ERROR
+ if (H5Tclose(anon_tid) < 0)
+ TEST_ERROR
/* create and commit anonymous datatype (int) to /uncopied */
- if((anon_tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit_anon(gid, anon_tid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((anon_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit_anon(gid, anon_tid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create attribute of anon ndt (int) in /uncopied */
- if((aid = H5Acreate2(gid, DST_ATTR_ANON_INT, anon_tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if ((aid = H5Acreate2(gid, DST_ATTR_ANON_INT, anon_tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the attribute */
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(anon_tid) < 0) TEST_ERROR
+ if (H5Tclose(anon_tid) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
}
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create ocpl and set merge committed datatype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/*
* Test 1 : copy / in SRC file to DST file
*/
- if(H5Ocopy(fid_src, "/", fid_dst, SRC_ROOT_GROUP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, "/", fid_dst, SRC_ROOT_GROUP, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* get token of committed datatype at root group */
- if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP "/" ROOT_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP "/" ROOT_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token_int, &oinfo.token, sizeof(exp_token_int));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* get token of committed datatype at /g0 */
- if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token_short, &oinfo.token, sizeof(exp_token_short));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* verify the datatype of first dataset is not committed */
- if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_DSET1, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Tcommitted(tid)) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_DSET1, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Tcommitted(tid))
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* check token of datatype for second dataset */
- if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* check token of datatype for third dataset */
- if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* Test 2: copy /g0 in SRC to DST
*/
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* get token of committed datatype at /g0 */
- if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* verify the datatype of first dataset is not committed */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_DSET1, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Tcommitted(tid)) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_DSET1, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Tcommitted(tid))
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* check token of datatype for second dataset */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* check token of datatype for third dataset */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/*
* Test 3: copy datsets in /g0 at SRC to DST group /uncopied
*/
- if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_DSET1, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_DSET1, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET2, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET3, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_DSET1, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_DSET1, ocpypl_id,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET2, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2,
+ ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET3, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3,
+ ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open attribute with anon ndt (short), get token */
- if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_SHORT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if ((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_SHORT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if ((tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
/* Open attribute with anon ndt (int), get token */
- if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_INT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if ((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_INT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if ((tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
/* verify the datatype of first dataset is not committed */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_DSET1, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Tcommitted(tid)) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_DSET1, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Tcommitted(tid))
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* check token of datatype for second dataset */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* check token of datatype for third dataset */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid);
H5Tclose(f_tid);
H5Tclose(g_tid);
@@ -11535,11 +13865,11 @@ error:
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_cdt_hier_merge */
-
/*-------------------------------------------------------------------------
* Function: test_copy_cdt_merge_cdt
*
@@ -11571,21 +13901,21 @@ error:
static int
test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t reopen)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid1 = -1, tid2 = -1; /* Datatype IDs */
- hid_t tid3 = -1, tid4 = -1; /* Datatype IDs */
- hid_t tid5 = -1, tid = -1; /* Datatype IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- hsize_t dim1d[1]; /* dimension sizes */
- H5O_info2_t oinfo; /* Object info */
- H5O_token_t exp_token; /* Expected object token */
- char src_filename[NAME_BUF_SIZE]; /* Source file name */
- char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
- int token_cmp;
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid1 = -1, tid2 = -1; /* Datatype IDs */
+ hid_t tid3 = -1, tid4 = -1; /* Datatype IDs */
+ hid_t tid5 = -1, tid = -1; /* Datatype IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ hsize_t dim1d[1]; /* dimension sizes */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
+ char src_filename[NAME_BUF_SIZE]; /* Source file name */
+ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
+ int token_cmp;
- if(reopen)
+ if (reopen)
TESTING("H5Ocopy(): merging various committed datatypes with reopen")
else
TESTING("H5Ocopy(): merging various committed datatypes")
@@ -11600,179 +13930,260 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds
/*
* Populate source file
*/
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create committed datatype (short) */
- if((tid1 = H5Tcopy(H5T_NATIVE_SHORT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_src, SRC_NDT_SHORT, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid1 = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, SRC_NDT_SHORT, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create committed datatype (float) */
- if((tid2 = H5Tcopy(H5T_NATIVE_FLOAT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_src, SRC_NDT_FLOAT, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid2 = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, SRC_NDT_FLOAT, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create committed datatype (int) */
- if((tid3 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_src, SRC_NDT_INT, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid3 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, SRC_NDT_INT, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create an attribute of committed datatype (int); attach to committed datatype (int) */
- if((aid = H5Acreate2(tid3, SRC_ATTR, tid3, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid3, SRC_ATTR, tid3, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
/* create committed datatype (double) */
- if((tid4 = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_src, SRC_NDT_DOUBLE, tid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid4 = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, SRC_NDT_DOUBLE, tid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an anonymous committed datatype (short) */
- if((tid5 = H5Tcopy(H5T_NATIVE_SHORT)) < 0) TEST_ERROR
- if((H5Tcommit_anon(fid_src, tid5, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid5 = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit_anon(fid_src, tid5, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute of anon ndt (short); attach to committed datatype (double) */
- if((aid = H5Acreate2(tid4, SRC_ATTR, tid5, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid4, SRC_ATTR, tid5, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
/* close the committed datatypes */
- if(H5Tclose(tid1) < 0) TEST_ERROR
- if(H5Tclose(tid2) < 0) TEST_ERROR
- if(H5Tclose(tid3) < 0) TEST_ERROR
- if(H5Tclose(tid4) < 0) TEST_ERROR
- if(H5Tclose(tid5) < 0) TEST_ERROR
+ if (H5Tclose(tid1) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid3) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid4) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid5) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/*
* Populate destination file
*/
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* create committed datatype (integer) */
- if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_dst, DST_NDT_INT, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_dst, DST_NDT_INT, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create committed datatype (float) */
- if((tid2 = H5Tcopy(H5T_NATIVE_FLOAT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_dst, DST_NDT_FLOAT, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid2 = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_dst, DST_NDT_FLOAT, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute of native integer; attach to committed datatype (float) */
- if((aid = H5Acreate2(tid2, DST_ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid2, DST_ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
/* create committed datatype (double) */
- if((tid3 = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_dst, DST_NDT_DOUBLE, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid3 = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_dst, DST_NDT_DOUBLE, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create anonymous committed datatype (short) */
- if((tid4 = H5Tcopy(H5T_NATIVE_SHORT)) < 0) TEST_ERROR
- if((H5Tcommit_anon(fid_dst, tid4, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid4 = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit_anon(fid_dst, tid4, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute of anon ndt (short); attach to ndt (double) */
- if((aid = H5Acreate2(tid3, DST_ATTR, tid4, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid3, DST_ATTR, tid4, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
/* close the committed datatypes */
- if(H5Tclose(tid1) < 0) TEST_ERROR
- if(H5Tclose(tid2) < 0) TEST_ERROR
- if(H5Tclose(tid3) < 0) TEST_ERROR
- if(H5Tclose(tid4) < 0) TEST_ERROR
+ if (H5Tclose(tid1) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid3) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid4) < 0)
+ TEST_ERROR
/* close the dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create ocpl and set merge committed dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/* copy everything in SRC to DST */
- if(H5Ocopy(fid_src, "/", fid_dst, SRC_ROOT_GROUP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, "/", fid_dst, SRC_ROOT_GROUP, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/*
* Verification
*/
/* get token of committed datatype: /src_root/src_ndt_double */
- if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* get token of committed datatype: /dst_ndt_double */
- if((tid = H5Topen2(fid_dst, "/" DST_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/" DST_NDT_DOUBLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* get token of committed datatype: /src_root/src_ndt_float */
- if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_FLOAT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* get token of committed datatype: /dst_ndt_float */
- if((tid = H5Topen2(fid_dst, "/" DST_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/" DST_NDT_FLOAT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* get token of committed datatype: /src_root/src_ndt_int */
- if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* get token of committed datatype: /dst_ndt_int */
- if((tid = H5Topen2(fid_dst, "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/" DST_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* get token of committed datatype: /src_root/src_ndt_short */
- if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* open attribute; get its dtype; get dtype's token: /src_root/src_ndt_double/dst_attr */
- if((aid = H5Aopen_by_name(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
+ if ((aid = H5Aopen_by_name(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
/* close the files */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close the object copy property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(ocpypl_id);
H5Tclose(tid);
H5Tclose(tid1);
@@ -11784,12 +14195,11 @@ error:
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_cdt_merge_cdt */
-
-
/*-------------------------------------------------------------------------
* Function: test_copy_cdt_merge_suggs
*
@@ -11804,19 +14214,18 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
- hid_t dst_fapl, hbool_t reopen)
+test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t reopen)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- H5O_info2_t oinfo; /* Object info */
- H5O_token_t exp_token; /* Expected object token */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
- int token_cmp;
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
- if(reopen)
+ if (reopen)
TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen")
else
TESTING("H5Ocopy(): merging committed datatypes with suggestions")
@@ -11832,204 +14241,280 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
* Populate source file
*/
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create committed datatype: "/src_ndt_int" */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
- if((H5Tcommit2(fid_src, SRC_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, SRC_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/*
* Populate destination file
*/
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* create committed datatype: "/dst_ndt_int" */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(fid_dst, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_dst, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Create a group /uncopied */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 1
*/
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* Create ocpl and set merge committed dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/* copy "/src_ndt_int" from SRC file to "/uncopied/src_ndt_int" at DST file */
- if(H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, ocpypl_id, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* open committed dtype "/dst_ndt_int", get its token */
- if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* check token of "/uncopied/src_ndt_int" */
- if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 2
*/
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* add committed datatype search suggestion: "/uncopied/src_ndt_int" */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT) < 0)
+ TEST_ERROR
/* copy "/src_ndt_int" from SRC file to "/src_ndt_int" at DST file */
- if(H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, SRC_NDT_INT, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, SRC_NDT_INT, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* open committed dtype "/uncopied/src_ndt_int", get its token */
- if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* check token of "/src_ndt_int" */
- if((tid = H5Topen2(fid_dst, SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, SRC_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 3
*/
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* remove "/uncopied/src_ndt_int" from DST file */
- if(H5Ldelete(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy "/src_ndt_int" from SRC file to "/uncopied/src_ndt_int" at DST file */
/* use default ocpypl_id -- without merging and suggestion */
- if(H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy "/src_ndt_int" from SRC file to "/src_ndt_int2" at DST file */
/* copy with merging and search suggestion: "/uncopied/src_ndt_int" */
- if(H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, SRC_NDT_INT2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, SRC_NDT_INT2, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype "/uncopied/src_ndt_int", get its token */
- if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* check token of "/src_ndt_int2" */
- if((tid = H5Topen2(fid_dst, SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, SRC_NDT_INT2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 4
*/
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* add committed datatype search suggestion */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, DST_NDT_INT) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, DST_NDT_INT) < 0)
+ TEST_ERROR
/* copy "src_ndt_int" from SRC file to "/uncopied/src_ndt_int2" at DST file */
/* copy with merging and search suggestion: "/dst_ndt_int, /uncopied/src_ndt_int" */
- if(H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_INT, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, ocpypl_id, H5P_DEFAULT) <
+ 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype "/dst_dt_int", get its token */
- if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* check token of "/uncopied/src_ndt_int2" */
- if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid_src);
H5Fclose(fid_dst);
H5Tclose(tid);
H5Pclose(ocpypl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_cdt_merge_suggs */
-
/*-------------------------------------------------------------------------
* Function: test_copy_cdt_merge_dset_suggs
*
@@ -12044,30 +14529,29 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
- hid_t dst_fapl, hbool_t reopen)
+test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t reopen)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- unsigned int i; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info2_t oinfo; /* Object info */
- H5O_token_t exp_token; /* Expected object token */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
- int token_cmp;
-
- if(reopen)
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ unsigned int i; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ int buf[DIM_SIZE_1]; /* Buffer for writing data */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
+
+ if (reopen)
TESTING("H5Ocopy(): merging committed datatypes of datasets with suggestions and reopen")
else
TESTING("H5Ocopy(): merging committed datatypes of datasets with suggestions")
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = (int)i;
/* Initialize the filenames */
@@ -12081,237 +14565,332 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
* Populate source file
*/
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create committed datatype: "/src_ndt_int" */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
- if((H5Tcommit2(fid_src, SRC_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_src, SRC_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create dataset */
- if((did = H5Dcreate2(fid_src, SRC_NDT_DSET, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, SRC_NDT_DSET, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data to dataset */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
- /* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ /* close the dataset */
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/*
* Populate destination file
*/
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* create committed datatype: "/dst_ndt_int" */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
- if((H5Tcommit2(fid_dst, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_dst, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Create a group "/uncopied" */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/*
* Test 1
*/
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* Create ocpl and set merge committed dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/* copy "/src_ndt_dset" from SRC file to "/uncopied/src_ndt_dset" at DST file */
- if(H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, ocpypl_id,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype "/dst_ndt_int", get its token */
- if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* check token of datatype for the copied dataset: "/uncopied/src_ndt_dset" */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 2
*/
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* add committed datatype search suggestion: "/uncopied/src_ndt_dset" */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET) < 0)
+ TEST_ERROR
/* copy "/src_ndt_dset" from SRC file to "/src_ndt_dset" at DST file */
- if(H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, SRC_NDT_DSET, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, SRC_NDT_DSET, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype token */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* check token of datatype for the copied dataset: "/src_ndt_dset" */
- if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 3
*/
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* remove "/uncopied/src_ndt_dset" */
- if(H5Ldelete(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy "src_ndt_dset" from SRC file to "/uncopied/src_ndt_dset" at DST file */
/* use default ocpypl_id -- without merging and suggestion */
- if(H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy "src_ndt_dset" from SRC file to "/src_ndt_dset2" at DST file */
/* use merging and suggested searching path: "/uncopied/src_ndt_dset" */
- if(H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, SRC_NDT_DSET2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, SRC_NDT_DSET2, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* open the copied dataset: /uncopied/src_ndt_dset", get its token */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* check token of datatype for the copied dataset: "/src_ndt_dset2" */
- if((did = H5Dopen2(fid_dst, SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, SRC_NDT_DSET2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 4
*/
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* add committed datatype search suggestion: "/src_ndt_dset" */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, SRC_NDT_DSET) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, SRC_NDT_DSET) < 0)
+ TEST_ERROR
/* copy /src_ndt_dset from SRC file to /uncopied/src_ndt_dset2 at DST */
/* use merging and suggested search paths: "/src_ndt_dset, /uncopied/src_ndt_dset" */
- if(H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, SRC_NDT_DSET, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, ocpypl_id,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* open the copied dataset: "/src_ndt_dset", get its datatype token */
- if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* check token of datatype for the copied dataset: /uncopied/src_ndt_dset2 */
- if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid_src);
H5Fclose(fid_dst);
H5Tclose(tid);
H5Sclose(sid);
H5Dclose(did);
H5Pclose(ocpypl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_cdt_merge_dset_suggs */
-
/*-------------------------------------------------------------------------
* Function: test_copy_cdt_merge_all_suggs
*
@@ -12325,24 +14904,23 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
- hid_t dst_fapl, hbool_t reopen)
+test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t reopen)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t gid = -1; /* Group ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t did = -1; /* Dataset ID */
- hid_t exp_did = -1; /* Dataset ID */
- hid_t tid_short = -1; /* Datatype ID */
- hid_t exp_tid = -1; /* Expected datatype ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- hsize_t dim1d[1]; /* Dataset dimensions */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
-
- if(reopen)
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t gid = -1; /* Group ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t exp_did = -1; /* Dataset ID */
+ hid_t tid_short = -1; /* Datatype ID */
+ hid_t exp_tid = -1; /* Expected datatype ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ if (reopen)
TESTING("H5Ocopy(): merging different committed datatypes with suggestions and reopen")
else
TESTING("H5Ocopy(): merging different committed datatypes with suggestions")
@@ -12359,419 +14937,573 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
*/
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* set dataspace dimension, create dataspace */
dim1d[0] = DIM_SIZE_1;
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create a group */
- if((gid = H5Gcreate2(fid_src, SRC_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, SRC_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create committed datatype in group */
- if((tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0) TEST_ERROR
- if((H5Tcommit2(gid, SRC_NDT_SHORT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(gid, SRC_NDT_SHORT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create first dataset in group */
- if((did = H5Dcreate2(gid, SRC_NDT_DSET, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, SRC_NDT_DSET, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing */
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* create committed datatype in group */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(gid, SRC_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(gid, SRC_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create second dataset in group */
- if((did = H5Dcreate2(gid, SRC_NDT_DSET2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, SRC_NDT_DSET2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing */
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* create third dataset in group */
- if((did = H5Dcreate2(gid, SRC_DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, SRC_DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* get datatype */
- if((tid_short = H5Topen2(fid_src, "/" SRC_GRP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid_short = H5Topen2(fid_src, "/" SRC_GRP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute attached to the dataset */
- if((aid = H5Acreate2(did, SRC_ATTR, tid_short, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, SRC_ATTR, tid_short, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* closing */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Tclose(tid_short) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid_short) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/*
* Populate DST file
*/
/* create DST file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* set dataspace dimension, create dataspace */
dim1d[0] = DIM_SIZE_2;
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/* create committed datatype in root group */
- if((tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)TEST_ERROR
- if((H5Tcommit2(fid_dst, DST_NDT_SHORT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_dst, DST_NDT_SHORT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* create committed datatype in root group */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
- if((H5Tcommit2(fid_dst, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_dst, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute attached to committed datatype */
- if((aid = H5Acreate2(tid, DST_ATTR, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid, DST_ATTR, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* closing */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
-
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* create committed datatype in root group */
- if((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)TEST_ERROR
- if((H5Tcommit2(fid_dst, DST_NDT_FLOAT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_dst, DST_NDT_FLOAT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute attached to committed datatype */
- if((aid = H5Acreate2(tid, DST_ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid, DST_ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
/* create a group */
- if((gid = H5Gcreate2(fid_dst, DST_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_dst, DST_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create a committed datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((H5Tcommit2(gid, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(gid, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute attached to committed datatype */
- if((aid = H5Acreate2(gid, DST_ATTR, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(gid, DST_ATTR, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* closing */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* create an attribute attached to group */
- if((aid = H5Acreate2(gid, DST_ATTR2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(gid, DST_ATTR2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* closing */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* create a group */
- if((gid = H5Gcreate2(fid_dst, DST_GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_dst, DST_GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create a committed datatype in group */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
- if((H5Tcommit2(gid, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(gid, DST_NDT_INT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute attached to group */
- if((aid = H5Acreate2(gid, DST_ATTR, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(gid, DST_ATTR, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* closing */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* create a committed datatype in group */
- if((tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)TEST_ERROR
- if((H5Tcommit2(gid, DST_NDT_SHORT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(gid, DST_NDT_SHORT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* closing */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* create a committed datatype at root group */
- if((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)TEST_ERROR
- if((H5Tcommit2(fid_dst, DST_NDT_DOUBLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ TEST_ERROR
+ if ((H5Tcommit2(fid_dst, DST_NDT_DOUBLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* get datatype */
- if((tid_short = H5Topen2(fid_dst, "/" DST_GRP2 "/" DST_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((tid_short = H5Topen2(fid_dst, "/" DST_GRP2 "/" DST_NDT_SHORT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute attached to committed datatype */
- if((aid = H5Acreate2(tid, DST_ATTR, tid_short, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid, DST_ATTR, tid_short, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* closing */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Tclose(tid_short) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid_short) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 1
*/
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* Create ocpl and set merge committed dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/* copy "/src_grp/src_ndt_dset2" from SRC file to DST file */
- if(H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET2, fid_dst, "A_src_dset2", ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET2, fid_dst, "A_src_dset2", ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* get datatype for attribute attached to the group */
- if((aid = H5Aopen_by_name(fid_dst, DST_GRP, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((exp_tid = H5Aget_type(aid)) < 0) TEST_ERROR
+ if ((aid = H5Aopen_by_name(fid_dst, DST_GRP, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((exp_tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
/* open datatype of dataset */
- if((did = H5Dopen2(fid_dst, "A_src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, "A_src_dset2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
/* should be the same */
- if(!H5Tequal(exp_tid, tid)) TEST_ERROR
+ if (!H5Tequal(exp_tid, tid))
+ TEST_ERROR
/* closing */
- if(H5Tclose(exp_tid) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(exp_tid) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 2
*/
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* add committed datatype search suggestion */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, "/" DST_GRP2) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, "/" DST_GRP2) < 0)
+ TEST_ERROR
/* copy "/src_grp/src_ndt_dset2" from SRC file to DST file */
- if(H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET2, fid_dst, "B_src_dset2", ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET2, fid_dst, "B_src_dset2", ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* get datatype for attribute attached to the group */
- if((aid = H5Aopen_by_name(fid_dst, DST_GRP2, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((exp_tid = H5Aget_type(aid)) < 0) TEST_ERROR
+ if ((aid = H5Aopen_by_name(fid_dst, DST_GRP2, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((exp_tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
/* open datatype of dataset */
- if((did = H5Dopen2(fid_dst, "B_src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, "B_src_dset2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
/* should be the same */
- if(!H5Tequal(exp_tid, tid)) TEST_ERROR
+ if (!H5Tequal(exp_tid, tid))
+ TEST_ERROR
/* closing */
- if(H5Tclose(exp_tid) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(exp_tid) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 3
*/
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* add another committed datatype search suggestion */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, "/" DST_GRP "/" DST_NDT_INT) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, "/" DST_GRP "/" DST_NDT_INT) < 0)
+ TEST_ERROR
/* copy "/src_grp/src_ndt_dset2" from SRC file to DST file */
- if(H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET2, fid_dst, "C_src_dset2", ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET2, fid_dst, "C_src_dset2", ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* open committed dtype "/dst_grp/dst_dt_int", get its token */
- if((exp_tid = H5Topen2(fid_dst, "/" DST_GRP "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((exp_tid = H5Topen2(fid_dst, "/" DST_GRP "/" DST_NDT_INT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open datatype of dataset */
- if((did = H5Dopen2(fid_dst, "C_src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, "C_src_dset2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
/* should be the same */
- if(!H5Tequal(exp_tid, tid)) TEST_ERROR
+ if (!H5Tequal(exp_tid, tid))
+ TEST_ERROR
/* closing */
- if(H5Tclose(exp_tid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(exp_tid) < 0)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 4
*/
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* delete the group */
- if(H5Ldelete(fid_dst, "/" DST_GRP, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(fid_dst, "/" DST_GRP, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* free the search suggestion paths */
- if(H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0)
+ TEST_ERROR
/* copy "/src_grp/src_ndt_dset2" from SRC file to DST file */
- if(H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET2, fid_dst, "D_src_dset2", ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET2, fid_dst, "D_src_dset2", ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* open datatype of dataset */
- if((exp_did = H5Dopen2(fid_dst, "A_src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((exp_tid = H5Dget_type(exp_did)) < 0) TEST_ERROR
+ if ((exp_did = H5Dopen2(fid_dst, "A_src_dset2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((exp_tid = H5Dget_type(exp_did)) < 0)
+ TEST_ERROR
/* Open datatype of dataset */
- if((did = H5Dopen2(fid_dst, "C_src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, "C_src_dset2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
/* should be the same */
- if(!H5Tequal(exp_tid, tid)) TEST_ERROR
+ if (!H5Tequal(exp_tid, tid))
+ TEST_ERROR
/* closing */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* open datatype of dataset */
- if((did = H5Dopen2(fid_dst, "D_src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, "D_src_dset2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
/* should be the same */
- if(!H5Tequal(exp_tid, tid)) TEST_ERROR
+ if (!H5Tequal(exp_tid, tid))
+ TEST_ERROR
/* closing */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* closing */
- if(H5Tclose(exp_tid) < 0) TEST_ERROR
- if(H5Dclose(exp_did) < 0) TEST_ERROR
+ if (H5Tclose(exp_tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(exp_did) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 5
*/
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* Add committed datatype search suggestion */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, "/" DST_NDT_DOUBLE) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, "/" DST_NDT_DOUBLE) < 0)
+ TEST_ERROR
/* copy "/src_grp/src_ndt_dset" from SRC file to DST file */
- if(H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET, fid_dst, "A_src_dset", ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET, fid_dst, "A_src_dset", ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* open attribute's dtype attached to committed datatype /dst_ndt_double */
- if((aid = H5Aopen_by_name(fid_dst, DST_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((exp_tid = H5Aget_type(aid)) < 0) TEST_ERROR
+ if ((aid = H5Aopen_by_name(fid_dst, DST_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((exp_tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
/* Open datatype of dataset, check token */
- if((did = H5Dopen2(fid_dst, "A_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, "A_src_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
/* should be the same */
- if(!H5Tequal(exp_tid, tid)) TEST_ERROR
+ if (!H5Tequal(exp_tid, tid))
+ TEST_ERROR
/* closing */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Tclose(exp_tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Tclose(exp_tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Test 6
*/
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* Add committed datatype search suggestion */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, "/" DST_NDT_SHORT) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, "/" DST_NDT_SHORT) < 0)
+ TEST_ERROR
/* copy "/src_grp/src_ndt_dset" from SRC file to DST file */
- if(H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET, fid_dst, "B_src_dset", ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, "/" SRC_GRP "/" SRC_NDT_DSET, fid_dst, "B_src_dset", ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* open committed dtype "/dst_ndt_short" */
- if((exp_tid = H5Topen2(fid_dst, "/" DST_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((exp_tid = H5Topen2(fid_dst, "/" DST_NDT_SHORT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* open datatype of dataset, check token */
- if((did = H5Dopen2(fid_dst, "B_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, "B_src_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
/* should be the same */
- if(!H5Tequal(exp_tid, tid)) TEST_ERROR
+ if (!H5Tequal(exp_tid, tid))
+ TEST_ERROR
/* closing */
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Tclose(exp_tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Tclose(exp_tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
- /* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ /* close property list */
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid_src);
H5Fclose(fid_dst);
H5Tclose(tid);
@@ -12782,11 +15514,11 @@ error:
H5Aclose(aid);
H5Sclose(sid);
H5Pclose(ocpypl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_cdt_merge_all_suggs */
-
/*-------------------------------------------------------------------------
* Function: test_copy_set_mcdt_search_cb
*
@@ -12802,46 +15534,45 @@ error:
*/
/* User data struct for the callback */
typedef struct mcdt_search_cb_ud {
- H5O_mcdt_search_ret_t search_action; /* Return value for callback */
- unsigned called; /* # of times callback has been called */
+ H5O_mcdt_search_ret_t search_action; /* Return value for callback */
+ unsigned called; /* # of times callback has been called */
} mcdt_search_cb_ud;
/* The user callback function */
static H5O_mcdt_search_ret_t
mcdt_search_cb(void *_udata)
{
- mcdt_search_cb_ud *udata = (mcdt_search_cb_ud *)_udata;
+ mcdt_search_cb_ud *udata = (mcdt_search_cb_ud *)_udata;
udata->called++;
- return(udata->search_action);
+ return (udata->search_action);
} /* mcdt_search_cb() */
static int
-test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
- hid_t dst_fapl, hbool_t reopen)
+test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, hbool_t reopen)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- unsigned int i; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info2_t oinfo; /* Object info */
- H5O_token_t exp_token; /* Expected object token */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
- mcdt_search_cb_ud cb_udata; /* User data for callback */
- int token_cmp;
-
- if(reopen)
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ unsigned int i; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ int buf[DIM_SIZE_1]; /* Buffer for writing data */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+ mcdt_search_cb_ud cb_udata; /* User data for callback */
+ int token_cmp;
+
+ if (reopen)
TESTING("H5Ocopy(): H5Pset_mcdt_search_cb and reopen")
else
TESTING("H5Ocopy(): H5Pset_mcdt_search_cb")
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = (int)i;
/* Initialize the filenames */
@@ -12852,304 +15583,414 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/*
* Populate source file
*/
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* named datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* Create an uncopied group in destination file */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/*
* Populate destination file
*/
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype "a" */
- if((H5Tcommit2(fid_dst, "/a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_dst, "/a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype "b" */
- if((H5Tcommit2(fid_dst, "/b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_dst, "/b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* Create ocpl and set merge committed dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/*
* First copy dataset using "/b" as a suggestion, and verify that it uses
* datatype "b" in the destination file
*/
/* Add datatype suggestion */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, "/b") < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, "/b") < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype "b", get token */
- if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open dset dtype, check token */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Set callback to continue the search
*/
cb_udata.search_action = H5O_MCDT_SEARCH_CONT;
- cb_udata.called = 0;
+ cb_udata.called = 0;
/* Free suggestions */
- if(H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0)
+ TEST_ERROR
/* Add datatype suggestion to group "/uncopied" */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, NAME_GROUP_UNCOPIED) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, NAME_GROUP_UNCOPIED) < 0)
+ TEST_ERROR
/* Continue the global search */
- if(H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cb, &cb_udata) < 0)
- TEST_ERROR
+ if (H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cb, &cb_udata) < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE2, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify callback has been called exactly once */
- if(cb_udata.called != 1) TEST_ERROR
+ if (cb_udata.called != 1)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype "a", get token */
- if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open copied dataset and its dtype, check token */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Stop the search, default action is to create an anonymous committed datatype
*/
cb_udata.search_action = H5O_MCDT_SEARCH_STOP;
- cb_udata.called = 0;
+ cb_udata.called = 0;
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE3, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE3, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify callback has been called exactly once */
- if(cb_udata.called != 1) TEST_ERROR
+ if (cb_udata.called != 1)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype "a", get token */
- if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open the copied dataset and get its dtype, tokens should not be equal */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(!token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (!token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open committed dtype "b", get token */
- if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open the copied dataset and get its dtype, tokens should not be equal */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(!token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (!token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Stop the search, default action is to create an anonymous committed datatype.
* Disable suggestion list.
*/
cb_udata.search_action = H5O_MCDT_SEARCH_STOP;
- cb_udata.called = 0;
+ cb_udata.called = 0;
/* Free suggestions */
- if(H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* Delete dataset */
- if(H5Ldelete(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE3, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE3, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Verify callback has been called exactly once */
- if(cb_udata.called != 1) TEST_ERROR
+ if (cb_udata.called != 1)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Open committed dtype "a", get token */
- if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open the copied dataset and get its dtype, tokens should not be equal */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(!token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (!token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Open committed dtype "b", get token */
- if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if ((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* Open the copied dataset and get its dtype, tokens should not be equal */
- if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
- if(!token_cmp) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0)
+ TEST_ERROR
+ if (!token_cmp)
+ TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid_src);
H5Fclose(fid_dst);
H5Tclose(tid);
H5Sclose(sid);
H5Dclose(did);
H5Pclose(ocpypl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_set_mcdt_search_cb */
-
/*-------------------------------------------------------------------------
* Function: test_copy_set_get_mcdt_cb
*
@@ -13169,7 +16010,7 @@ mcdt_search_cbA(void *_udata)
{
H5O_mcdt_search_ret_t *action = (H5O_mcdt_search_ret_t *)_udata;
- return(*action);
+ return (*action);
} /* mcdt_search_cb() */
static H5O_mcdt_search_ret_t
@@ -13177,36 +16018,36 @@ mcdt_search_cbB(void *_udata)
{
H5O_mcdt_search_ret_t *action = (H5O_mcdt_search_ret_t *)_udata;
- return(*action);
+ return (*action);
} /* mnt_search_cb() */
/* The main test function */
static int
-test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
- hid_t dst_fapl, hbool_t reopen)
+test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ hbool_t reopen)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t ocpypl_id = -1; /* Object copy plist ID */
- unsigned int i; /* Local index variables */
- hsize_t dim1d[1]; /* Dataset dimensions */
- int buf[DIM_SIZE_1]; /* Buffer for writing data */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
- H5O_mcdt_search_cb_t mcdt_cb = NULL; /* The callback function */
- H5O_mcdt_search_ret_t mcdt_udataA; /* User data for callback */
- H5O_mcdt_search_ret_t mcdt_udataB; /* User data for callback */
- H5O_mcdt_search_ret_t *mcdt_udata_p = NULL; /* Pointer to user data for callback */
-
- if(reopen)
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t ocpypl_id = -1; /* Object copy plist ID */
+ unsigned int i; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ int buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+ H5O_mcdt_search_cb_t mcdt_cb = NULL; /* The callback function */
+ H5O_mcdt_search_ret_t mcdt_udataA; /* User data for callback */
+ H5O_mcdt_search_ret_t mcdt_udataB; /* User data for callback */
+ H5O_mcdt_search_ret_t *mcdt_udata_p = NULL; /* Pointer to user data for callback */
+
+ if (reopen)
TESTING("H5Ocopy(): H5Pset/get_mcdt_search_cb and reopen")
else
TESTING("H5Ocopy(): H5Pset/get_mcdt_search_cb")
/* set initial data values */
- for(i = 0; i < DIM_SIZE_1; i++)
+ for (i = 0; i < DIM_SIZE_1; i++)
buf[i] = (int)i;
/* Initialize the filenames */
@@ -13217,103 +16058,132 @@ test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim1d[0]=DIM_SIZE_1;
+ dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(1, dim1d, NULL)) < 0)
+ TEST_ERROR
/*
* Populate source file
*/
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create dataset at SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data into file */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* Create an uncopied group in destination file */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/*
* Populate destination file
*/
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype "a" */
- if((H5Tcommit2(fid_dst, "/a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_dst, "/a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* create datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* committed datatype "b" */
- if((H5Tcommit2(fid_dst, "/b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_dst, "/b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* Create ocpl and set merge committed dtype flag */
- if((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- if(H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0) TEST_ERROR
+ if ((ocpypl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
+ if (H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG) < 0)
+ TEST_ERROR
/*
* First copy dataset using "/b" as a suggestion, and verify that it uses
* datatype "b" in the destination file
*/
/* Add datatype suggestion */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, "/b") < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, "/b") < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
/* Verify "get" routine functionality */
- if(H5Pget_mcdt_search_cb(ocpypl_id, &mcdt_cb, (void **) &mcdt_udata_p) < 0) TEST_ERROR
+ if (H5Pget_mcdt_search_cb(ocpypl_id, &mcdt_cb, (void **)&mcdt_udata_p) < 0)
+ TEST_ERROR
- if(mcdt_cb != NULL) TEST_ERROR
- if(mcdt_udata_p != NULL) TEST_ERROR
+ if (mcdt_cb != NULL)
+ TEST_ERROR
+ if (mcdt_udata_p != NULL)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Set callback to continue the search
@@ -13321,130 +16191,161 @@ test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
mcdt_udataA = H5O_MCDT_SEARCH_CONT;
/* Free suggestions */
- if(H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0)
+ TEST_ERROR
/* Add datatype suggestion to group "/uncopied" */
- if(H5Padd_merge_committed_dtype_path(ocpypl_id, NAME_GROUP_UNCOPIED) < 0) TEST_ERROR
+ if (H5Padd_merge_committed_dtype_path(ocpypl_id, NAME_GROUP_UNCOPIED) < 0)
+ TEST_ERROR
/* Continue the global search */
- if(H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cbA, &mcdt_udataA) < 0)
- TEST_ERROR
+ if (H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cbA, &mcdt_udataA) < 0)
+ TEST_ERROR
/* open the destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE2, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
- mcdt_cb = NULL;
+ mcdt_cb = NULL;
mcdt_udata_p = NULL;
/* Verify "get" routine functionality */
- if(H5Pget_mcdt_search_cb(ocpypl_id, &mcdt_cb, (void **) &mcdt_udata_p) < 0) TEST_ERROR
+ if (H5Pget_mcdt_search_cb(ocpypl_id, &mcdt_cb, (void **)&mcdt_udata_p) < 0)
+ TEST_ERROR
- if(mcdt_cb != mcdt_search_cbA) TEST_ERROR
- if(mcdt_udata_p != &mcdt_udataA) TEST_ERROR
+ if (mcdt_cb != mcdt_search_cbA)
+ TEST_ERROR
+ if (mcdt_udata_p != &mcdt_udataA)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
-
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/*
* Stop the search, default action is to create an anonymous committed datatype
*/
mcdt_udataB = H5O_MCDT_SEARCH_STOP;
- if(H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cbA, &mcdt_udataB) < 0)
- TEST_ERROR
+ if (H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cbA, &mcdt_udataB) < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
- /* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE3, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ /* copy SRC dset to DST */
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE3, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
- mcdt_cb = NULL;
+ mcdt_cb = NULL;
mcdt_udata_p = NULL;
/* Verify "get" routine functionality */
- if(H5Pget_mcdt_search_cb(ocpypl_id, &mcdt_cb, (void **) &mcdt_udata_p) < 0) TEST_ERROR
+ if (H5Pget_mcdt_search_cb(ocpypl_id, &mcdt_cb, (void **)&mcdt_udata_p) < 0)
+ TEST_ERROR
- if(mcdt_cb != mcdt_search_cbA) TEST_ERROR
- if(mcdt_udata_p != &mcdt_udataB) TEST_ERROR
+ if (mcdt_cb != mcdt_search_cbA)
+ TEST_ERROR
+ if (mcdt_udata_p != &mcdt_udataB)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
- /* Free suggestions */
- if(H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0) TEST_ERROR
+ /* Free suggestions */
+ if (H5Pfree_merge_committed_dtype_paths(ocpypl_id) < 0)
+ TEST_ERROR
- if(H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cbB, &mcdt_udataB) < 0)
- TEST_ERROR
+ if (H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cbB, &mcdt_udataB) < 0)
+ TEST_ERROR
/* open destination file */
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* Delete dataset */
- if(H5Ldelete(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ldelete(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* copy SRC dset to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE3, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE3, ocpypl_id, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(reopen) {
+ if (reopen) {
/* Reopen file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
- if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
+ if ((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0)
+ TEST_ERROR
} /* end if */
- mcdt_cb = NULL;
+ mcdt_cb = NULL;
mcdt_udata_p = NULL;
/* Verify "get" routine functionality */
- if(H5Pget_mcdt_search_cb(ocpypl_id, &mcdt_cb, (void **) &mcdt_udata_p) < 0) TEST_ERROR
+ if (H5Pget_mcdt_search_cb(ocpypl_id, &mcdt_cb, (void **)&mcdt_udata_p) < 0)
+ TEST_ERROR
- if(mcdt_cb != mcdt_search_cbB) TEST_ERROR
- if(mcdt_udata_p != &mcdt_udataB) TEST_ERROR
+ if (mcdt_cb != mcdt_search_cbB)
+ TEST_ERROR
+ if (mcdt_udata_p != &mcdt_udataB)
+ TEST_ERROR
/* Close destination file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close property list */
- if(H5Pclose(ocpypl_id) < 0) TEST_ERROR
+ if (H5Pclose(ocpypl_id) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid_src);
H5Fclose(fid_dst);
H5Tclose(tid);
H5Sclose(sid);
H5Dclose(did);
H5Pclose(ocpypl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_set_get_mcdt_search_cb */
-
/*-------------------------------------------------------------------------
* Function: test_copy_iterate
*
@@ -13460,29 +16361,29 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_copy_iterate_cb(hid_t loc_id, const char *name,
- const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data)
+test_copy_iterate_cb(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info,
+ void *op_data)
{
hid_t dst_loc_id = *((hid_t *)op_data);
- if(H5Ocopy(loc_id, name, dst_loc_id, name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Ocopy(loc_id, name, dst_loc_id, name, H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
error:
- return(H5_ITER_ERROR);
+ return (H5_ITER_ERROR);
} /* end test_copy_iterate_cb */
static int
test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gid = -1; /* Group ID */
- int i;
- char grp_name[16];
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gid = -1; /* Group ID */
+ int i;
+ char grp_name[16];
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): inside H5Literate() callback");
@@ -13494,54 +16395,62 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl
token_reset();
/* Create source file */
- if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ if ((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
TEST_ERROR
/* Create groups */
- for(i=0; i<9; i++) {
+ for (i = 0; i < 9; i++) {
HDsnprintf(grp_name, sizeof(grp_name), "grp%d", i);
- if((gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
TEST_ERROR
} /* end for */
/* Create destination file */
- if((fid2 = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ if ((fid2 = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
TEST_ERROR
/* Close files */
- if(H5Fclose(fid1) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
/* Reopen files */
- if((fid1 = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR
+ if ((fid1 = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0)
+ TEST_ERROR
/* Iterate over links in the root group, copying each object */
- if((gid = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, &fid2) < 0)
+ if ((gid = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, &fid2) < 0)
TEST_ERROR
/* Close */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid1) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid1) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid2) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid1);
H5Fclose(fid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_iterate */
-
/*-------------------------------------------------------------------------
* Function: test_copy_option
*
@@ -13556,29 +16465,29 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
- unsigned flag, hbool_t crt_intermediate_grp, const char* test_desciption)
+test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, unsigned flag,
+ hbool_t crt_intermediate_grp, const char *test_desciption)
{
- hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid=-1, gid2=-1, gid_ref=-1; /* Group IDs */
- hid_t gid_sub=-1, gid_sub_sub=-1; /* Sub-group ID */
- hid_t pid=-1, lcpl_id=-1; /* Property IDs */
- unsigned cpy_flags; /* Object copy flags */
- int depth = -1; /* Copy depth */
- hsize_t dim2d[2];
- int buf[DIM_SIZE_1][DIM_SIZE_2];
- int i, j;
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1, gid2 = -1, gid_ref = -1; /* Group IDs */
+ hid_t gid_sub = -1, gid_sub_sub = -1; /* Sub-group ID */
+ hid_t pid = -1, lcpl_id = -1; /* Property IDs */
+ unsigned cpy_flags; /* Object copy flags */
+ int depth = -1; /* Copy depth */
+ hsize_t dim2d[2];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING(test_desciption);
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -13588,233 +16497,327 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* add a dataset to the top group */
- if((did = H5Dcreate2(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create a sub-group */
- if((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* add a dataset to the sub group */
- if((did = H5Dcreate2(gid_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create sub-sub-group */
- if((gid_sub_sub = H5Gcreate2(gid_sub, NAME_GROUP_SUB_SUB2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid_sub_sub = H5Gcreate2(gid_sub, NAME_GROUP_SUB_SUB2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* add a dataset to the sub sub group */
- if((did = H5Dcreate2(gid_sub_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid_sub_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
- if(H5Gclose(gid_sub_sub) < 0) TEST_ERROR
+ if (H5Gclose(gid_sub_sub) < 0)
+ TEST_ERROR
- if(H5Gclose(gid_sub) < 0) TEST_ERROR
+ if (H5Gclose(gid_sub) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
- if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
/* Create group to copy */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft(NAME_DATASET_SUB_SUB, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft(NAME_DATASET_SUB_SUB, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Create group to compare with */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5L_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5L_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
} /* end if */
- if((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0) {
- char ext_filename[NAME_BUF_SIZE];
+ if ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0) {
+ char ext_filename[NAME_BUF_SIZE];
h5_fixname(FILENAME[2], src_fapl, ext_filename, sizeof ext_filename);
/* Create the external file and dataset */
- if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Fclose(fid_ext) < 0) TEST_ERROR
+ if ((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid_ext) < 0)
+ TEST_ERROR
/* Create group to copy */
- if(!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
} /* end if */
- else
- if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ else if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create group to compare with */
- if(!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
} /* end if */
- else
- if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid_src, NAME_LINK_EXTERN2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ else if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_LINK_EXTERN2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
} /* end if */
- if((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
- if((gid_ref = H5Gcreate2(fid_src, NAME_GROUP_REF, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
+ if ((gid_ref = H5Gcreate2(fid_src, NAME_GROUP_REF, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute of object references */
- if(attach_ref_attr(fid_src, gid_ref) < 0) TEST_ERROR
+ if (attach_ref_attr(fid_src, gid_ref) < 0)
+ TEST_ERROR
/* create an attribute of region references */
- if(attach_reg_ref_attr(fid_src, gid_ref) < 0) TEST_ERROR
+ if (attach_reg_ref_attr(fid_src, gid_ref) < 0)
+ TEST_ERROR
/* create a dataset of region references */
- if(create_reg_ref_dataset(fid_src, gid_ref) < 0) TEST_ERROR
+ if (create_reg_ref_dataset(fid_src, gid_ref) < 0)
+ TEST_ERROR
/* Close group holding reference objects */
- if(H5Gclose(gid_ref) < 0) TEST_ERROR
+ if (H5Gclose(gid_ref) < 0)
+ TEST_ERROR
} /* end if */
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
/* (except when expanding soft links */
- if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0) TEST_ERROR
+ if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0)
+ TEST_ERROR
} /* end if */
- else
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ else if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* Create an uncopied object in destination file so that tokens in source and destination
files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create property to pass copy options */
- if((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
/* set options for object copy */
- if(H5Pset_copy_object(pid, flag) < 0) TEST_ERROR
+ if (H5Pset_copy_object(pid, flag) < 0)
+ TEST_ERROR
/* Verify object copy flags */
- if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
- if(cpy_flags != flag) TEST_ERROR
+ if (H5Pget_copy_object(pid, &cpy_flags) < 0)
+ TEST_ERROR
+ if (cpy_flags != flag)
+ TEST_ERROR
/* copy the group from SRC to DST */
- if(crt_intermediate_grp) {
+ if (crt_intermediate_grp) {
/* Create link creation plist to pass in intermediate group creation */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
+ TEST_ERROR
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0)
+ TEST_ERROR
- if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(lcpl_id) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, "/new_g0/new_g00", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- } else if(((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
- || ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0)) {
- if(H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, "/new_g0/new_g00", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else if (((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) || ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0)) {
+ if (H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
+ if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
/* Unlink dataset to copy from original location */
/* (So group comparison works properly) */
- if(H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- } else if(flag & (H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG)) {
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else if (flag & (H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG)) {
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- } else if(flag & H5O_COPY_SHALLOW_HIERARCHY_FLAG) {
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else if (flag & H5O_COPY_SHALLOW_HIERARCHY_FLAG) {
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Set the copy depth */
depth = 1;
- } else if((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
- if(H5Ocopy(fid_src, NAME_GROUP_REF, fid_dst, NAME_GROUP_REF, pid, H5P_DEFAULT) < 0) TEST_ERROR
+ }
+ else if ((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
+ if (H5Ocopy(fid_src, NAME_GROUP_REF, fid_dst, NAME_GROUP_REF, pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_REF, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_REF, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_REF, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- } else {
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_REF, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else {
/* Unknown flag */
TEST_ERROR
} /* end else */
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, pid, depth, flag) != TRUE) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (compare_groups(gid, gid2, pid, depth, flag) != TRUE)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close properties */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(lcpl_id);
H5Pclose(pid);
H5Sclose(sid);
@@ -13826,11 +16829,11 @@ error:
H5Fclose(fid_dst);
H5Fclose(fid_src);
H5Fclose(fid_ext);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_option */
-
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_open
*
@@ -13874,32 +16877,32 @@ error:
static int
test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t did3 = -1, did4 = -1; /* Dataset IDs */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t pid = -1; /* Dataset creation property list */
- hsize_t chunk_dim2d[2] = {CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimension sizes */
- int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- int newbuf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
- hsize_t dim2d[2]; /* Dataset dimensions */
- int i, j; /* local index variables */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t did3 = -1, did4 = -1; /* Dataset IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t pid = -1; /* Dataset creation property list */
+ hsize_t chunk_dim2d[2] = {CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimension sizes */
+ int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ int newbuf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ int i, j; /* local index variables */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): copying objects while opened");
/* Initialize write buffer */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize another write buffer */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- newbuf[i][j] = 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ newbuf[i][j] = 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -13909,38 +16912,53 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
- /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the
+ * same */
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* create and set chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 2, chunk_dim2d) < 0)
+ TEST_ERROR
/* create 2D dataset in SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create 2D chunked dataset in SRC file */
- if((did2 = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dcreate2(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* attach attributes to the dataset */
- if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
- if(test_copy_attach_attributes(did2, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (test_copy_attach_attributes(did2, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/*
* Test case 1
@@ -13950,218 +16968,295 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst
* Copy within the same file
*/
/* copy the opened dataset to another location in SRC file */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_src, NAME_DATASET_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_src, NAME_DATASET_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the copied dataset */
- if((did3 = H5Dopen2(fid_src, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((did4 = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did3 = H5Dopen2(fid_src, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did4 = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did3, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
- if(compare_datasets(did2, did4, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did3, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
+ if (compare_datasets(did2, did4, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the copied dataset */
- if(H5Dclose(did3) < 0) TEST_ERROR
- if(H5Dclose(did4) < 0) TEST_ERROR
+ if (H5Dclose(did3) < 0)
+ TEST_ERROR
+ if (H5Dclose(did4) < 0)
+ TEST_ERROR
/*
* Copy to another file
*/
/* copy the opened dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the copied dataset in DST file */
- if((did3 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((did4 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did3 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did4 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did3, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
- if(compare_datasets(did2, did4, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did3, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
+ if (compare_datasets(did2, did4, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the copied dataset in DST file */
- if(H5Dclose(did3) < 0) TEST_ERROR
- if(H5Dclose(did4) < 0) TEST_ERROR
+ if (H5Dclose(did3) < 0)
+ TEST_ERROR
+ if (H5Dclose(did4) < 0)
+ TEST_ERROR
/* close the dataset in SRC file */
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/*
* Test case 2
*/
/* reopen the dataset in SRC file */
- if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if((did2 = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did2 = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write another set of data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf) < 0) TEST_ERROR
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf) < 0)
+ TEST_ERROR
/*
* Copy within the same file
*/
/* copy the opened dataset to another location in SRC file */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_src, "NEW_DATASET_SIMPLE", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_src, "NEW_DATASET_CHUNKED", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_src, "NEW_DATASET_SIMPLE", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_src, "NEW_DATASET_CHUNKED", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the copied dataset */
- if((did3 = H5Dopen2(fid_src, "NEW_DATASET_SIMPLE", H5P_DEFAULT)) < 0) TEST_ERROR
- if((did4 = H5Dopen2(fid_src, "NEW_DATASET_CHUNKED", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did3 = H5Dopen2(fid_src, "NEW_DATASET_SIMPLE", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did4 = H5Dopen2(fid_src, "NEW_DATASET_CHUNKED", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did3, H5P_DEFAULT, newbuf) != TRUE) TEST_ERROR
- if(compare_datasets(did2, did4, H5P_DEFAULT, newbuf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did3, H5P_DEFAULT, newbuf) != TRUE)
+ TEST_ERROR
+ if (compare_datasets(did2, did4, H5P_DEFAULT, newbuf) != TRUE)
+ TEST_ERROR
/* close the copied dataset in SRC file */
- if(H5Dclose(did3) < 0) TEST_ERROR
- if(H5Dclose(did4) < 0) TEST_ERROR
+ if (H5Dclose(did3) < 0)
+ TEST_ERROR
+ if (H5Dclose(did4) < 0)
+ TEST_ERROR
/*
* Copy to another file
*/
/* copy the opened dataset from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, "NEW_DATASET_SIMPLE", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, "NEW_DATASET_CHUNKED", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, "NEW_DATASET_SIMPLE", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, "NEW_DATASET_CHUNKED", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the copied dataset in DST file */
- if((did3 = H5Dopen2(fid_dst, "NEW_DATASET_SIMPLE", H5P_DEFAULT)) < 0) TEST_ERROR
- if((did4 = H5Dopen2(fid_dst, "NEW_DATASET_CHUNKED", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did3 = H5Dopen2(fid_dst, "NEW_DATASET_SIMPLE", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did4 = H5Dopen2(fid_dst, "NEW_DATASET_CHUNKED", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did3, H5P_DEFAULT, newbuf) != TRUE) TEST_ERROR
- if(compare_datasets(did2, did4, H5P_DEFAULT, newbuf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did3, H5P_DEFAULT, newbuf) != TRUE)
+ TEST_ERROR
+ if (compare_datasets(did2, did4, H5P_DEFAULT, newbuf) != TRUE)
+ TEST_ERROR
/* close the copied dataset in DST file */
- if(H5Dclose(did3) < 0) TEST_ERROR
- if(H5Dclose(did4) < 0) TEST_ERROR
+ if (H5Dclose(did3) < 0)
+ TEST_ERROR
+ if (H5Dclose(did4) < 0)
+ TEST_ERROR
/* close the dataset at SRC file */
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/*
* Test case 3
*/
/* make a copy of the datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
/* commit the datatype */
- if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* close the datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* open the committed datatype */
tid = H5Topen2(fid_src, NAME_DATATYPE_SIMPLE, H5P_DEFAULT);
/* create 2D dataset with the opened committed datatype in SRC file */
- if((did = H5Dcreate2(fid_src, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data to the dataset */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/*
* Copy within the same file
*/
/* copy the opened dataset (with the opened committed datatype) to another location in SRC file */
- if(H5Ocopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_src, NAME_DATASET_NAMED_DTYPE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_src, NAME_DATASET_NAMED_DTYPE2, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the copied dataset */
- if((did2 = H5Dopen2(fid_src, NAME_DATASET_NAMED_DTYPE2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_src, NAME_DATASET_NAMED_DTYPE2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the copied dataset in SRC file */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/*
* Copy to another file
*/
/* copy the opened dataset (with the opened committed datatype) from SRC to DST */
- if(H5Ocopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE2, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the copied dataset in DST file */
- if((did2 = H5Dopen2(fid_dst, NAME_DATASET_NAMED_DTYPE2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did2 = H5Dopen2(fid_dst, NAME_DATASET_NAMED_DTYPE2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the datasets are equal */
- if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if (compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
/* close the copied dataset in DST file */
- if(H5Dclose(did2) < 0) TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
/* close the dataset at SRC file */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close the committed datatype at SRC file */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/*
* Test case 4
*/
/* create a group in SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* create 2D int dataset in the group at SRC file */
- if((did = H5Dcreate2(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* write data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/*
* Copy within the same file
*/
/* copy the opened group (together with opened dataset) to another location in SRC file */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_src, "COPIED_GROUP", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_src, "COPIED_GROUP", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the copied group at SRC */
- if((gid2 = H5Gopen2(fid_src, "COPIED_GROUP", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid_src, "COPIED_GROUP", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the DST dataset */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/*
* Copy to another file
*/
/* copy the opened group (together with opened dataset) to DST file */
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, "COPIED_GROUP", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, "COPIED_GROUP", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the copied group at DST */
- if((gid2 = H5Gopen2(fid_dst, "COPIED_GROUP", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, "COPIED_GROUP", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE)
+ TEST_ERROR
/* close the group in DST file */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* close the group in SRC file */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the dataset in SRC file */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Dclose(did2);
H5Sclose(sid);
@@ -14169,11 +17264,11 @@ error:
H5Gclose(gid2);
H5Fclose(fid_dst);
H5Fclose(fid_src);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_dataset_open */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -14193,13 +17288,13 @@ error:
int
main(void)
{
- int nerrors = 0;
+ int nerrors = 0;
hid_t fapl, fapl2;
- hid_t fcpl_shared, ocpl;
- unsigned max_compact, min_dense;
- int configuration; /* Configuration of tests. */
- int ExpressMode;
- hbool_t same_file; /* Whether to run tests that only use one file */
+ hid_t fcpl_shared, ocpl;
+ unsigned max_compact, min_dense;
+ int configuration; /* Configuration of tests. */
+ int ExpressMode;
+ hbool_t same_file; /* Whether to run tests that only use one file */
/* Setup */
h5_reset();
@@ -14210,23 +17305,31 @@ main(void)
HDprintf("***Express test mode on. Some tests may be skipped\n");
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
/* Create an FCPL with sharing enabled */
- if((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
- if(H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0) TEST_ERROR
- if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, 10) < 0) TEST_ERROR
+ if ((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0)
+ TEST_ERROR
+ if (H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, 10) < 0)
+ TEST_ERROR
/* Obtain the default attribute storage phase change values */
- if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) TEST_ERROR
- if(H5Pget_attr_phase_change(ocpl, &max_compact, &min_dense) < 0) TEST_ERROR
- if(H5Pclose(ocpl) < 0) TEST_ERROR
+ if ((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pget_attr_phase_change(ocpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
+ if (H5Pclose(ocpl) < 0)
+ TEST_ERROR
/* Test in all configurations */
- for(configuration = 0; configuration <= MAX_CONFIGURATION; configuration++) {
+ for (configuration = 0; configuration <= MAX_CONFIGURATION; configuration++) {
hid_t src_fapl;
hid_t dst_fapl;
hid_t fcpl_src;
@@ -14238,11 +17341,11 @@ main(void)
same_file = TRUE;
/* No need to test dense attributes with old format */
- if(!(configuration & CONFIG_SRC_NEW_FORMAT) && (configuration & CONFIG_DENSE))
+ if (!(configuration & CONFIG_SRC_NEW_FORMAT) && (configuration & CONFIG_DENSE))
continue;
/* Test with and without shared messages */
- if(configuration & CONFIG_SHARE_SRC) {
+ if (configuration & CONFIG_SHARE_SRC) {
HDputs("\nTesting with shared src messages:");
fcpl_src = fcpl_shared;
}
@@ -14250,9 +17353,9 @@ main(void)
HDputs("\nTesting without shared src messages:");
fcpl_src = H5P_DEFAULT;
}
- if(configuration & CONFIG_SHARE_DST) {
+ if (configuration & CONFIG_SHARE_DST) {
HDputs("Testing with shared dst messages:");
- fcpl_dst = fcpl_shared;
+ fcpl_dst = fcpl_shared;
same_file = FALSE;
}
else {
@@ -14261,12 +17364,12 @@ main(void)
}
/* Set the FAPL for the source file's type of format */
- if(configuration & CONFIG_SRC_NEW_FORMAT) {
+ if (configuration & CONFIG_SRC_NEW_FORMAT) {
HDputs("Testing with latest format for source file:");
src_fapl = fapl2;
/* Test with and without dense attributes */
- if(configuration & CONFIG_DENSE) {
+ if (configuration & CONFIG_DENSE) {
HDputs("Testing with dense attributes:");
num_attributes_g = max_compact + 1;
}
@@ -14277,14 +17380,14 @@ main(void)
} /* end if */
else {
HDputs("Testing with oldest file format for source file:");
- src_fapl = fapl;
+ src_fapl = fapl;
num_attributes_g = 4;
} /* end else */
/* Set the FAPL for the destination file's type of format */
- if(configuration & CONFIG_DST_NEW_FORMAT) {
+ if (configuration & CONFIG_DST_NEW_FORMAT) {
HDputs("Testing with latest format for destination file:");
- dst_fapl = fapl2;
+ dst_fapl = fapl2;
same_file = FALSE;
} /* end if */
else {
@@ -14340,38 +17443,31 @@ main(void)
nerrors += test_copy_attr_crt_order(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_WITHOUT_ATTR_FLAG, FALSE,
+ "H5Ocopy(): without attributes");
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, 0, TRUE,
+ "H5Ocopy(): with missing groups");
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_EXPAND_SOFT_LINK_FLAG,
+ FALSE, "H5Ocopy(): expand soft link");
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_EXPAND_EXT_LINK_FLAG,
+ FALSE, "H5Ocopy(): expand external link");
nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- H5O_COPY_WITHOUT_ATTR_FLAG,
- FALSE, "H5Ocopy(): without attributes");
- nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- 0,
- TRUE, "H5Ocopy(): with missing groups");
- nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- H5O_COPY_EXPAND_SOFT_LINK_FLAG,
- FALSE, "H5Ocopy(): expand soft link");
+ H5O_COPY_EXPAND_SOFT_LINK_FLAG | H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE,
+ "H5Ocopy(): expand soft and external links");
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_SHALLOW_HIERARCHY_FLAG,
+ FALSE, "H5Ocopy(): shallow group copy");
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG,
+ FALSE, "H5Ocopy(): expand object reference");
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_PRESERVE_NULL_FLAG,
+ FALSE, "H5Ocopy(): preserve NULL messages");
nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- H5O_COPY_EXPAND_EXT_LINK_FLAG,
- FALSE, "H5Ocopy(): expand external link");
- nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- H5O_COPY_EXPAND_SOFT_LINK_FLAG | H5O_COPY_EXPAND_EXT_LINK_FLAG,
- FALSE, "H5Ocopy(): expand soft and external links");
- nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- H5O_COPY_SHALLOW_HIERARCHY_FLAG,
- FALSE, "H5Ocopy(): shallow group copy");
- nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- H5O_COPY_EXPAND_REFERENCE_FLAG,
- FALSE, "H5Ocopy(): expand object reference");
- nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- H5O_COPY_PRESERVE_NULL_FLAG,
- FALSE, "H5Ocopy(): preserve NULL messages");
- nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG,
- TRUE, "H5Ocopy(): preserve NULL messages");
+ H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG, TRUE,
+ "H5Ocopy(): preserve NULL messages");
nerrors += test_copy_dataset_open(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
/* Tests that do not use attributes and do not need to be tested
* multiple times for different attribute configurations */
- if(configuration < CONFIG_DENSE) {
+ if (configuration < CONFIG_DENSE) {
unsigned reopen;
nerrors += test_copy_named_datatype(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
@@ -14379,10 +17475,10 @@ main(void)
nerrors += test_copy_named_datatype_vl_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
/* Loop over reopening the file */
- for(reopen = FALSE; reopen <= TRUE; reopen++) {
+ for (reopen = FALSE; reopen <= TRUE; reopen++) {
nerrors += test_copy_committed_datatype_merge(fcpl_src, fcpl_dst, src_fapl, dst_fapl, reopen);
- if(same_file)
+ if (same_file)
nerrors += test_copy_committed_datatype_merge_same_file(fcpl_src, src_fapl, reopen);
nerrors += test_copy_committed_dt_merge_sugg(fcpl_src, fcpl_dst, src_fapl, dst_fapl, reopen);
@@ -14446,9 +17542,9 @@ main(void)
nerrors += test_copy_iterate(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
} /* end if */
-/* TODO: not implemented
- nerrors += test_copy_mount(src_fapl);
-*/
+ /* TODO: not implemented
+ nerrors += test_copy_mount(src_fapl);
+ */
} /* end for */
/* Reset file token checking info */
@@ -14458,13 +17554,12 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
/* Results */
- if(nerrors) {
- HDprintf("***** %d OBJECT COPY TEST%s FAILED! *****\n",
- nerrors, (1 == nerrors ? "" : "S"));
+ if (nerrors) {
+ HDprintf("***** %d OBJECT COPY TEST%s FAILED! *****\n", nerrors, (1 == nerrors ? "" : "S"));
HDexit(EXIT_FAILURE);
} /* end if */
- HDputs ("All object copying tests passed.");
+ HDputs("All object copying tests passed.");
/* close property list.
* NOTE: if this property list is not closed and the test is
@@ -14496,4 +17591,3 @@ main(void)
error:
HDexit(EXIT_FAILURE);
} /* main */
-
diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c
index 20c6138..8470e53 100644
--- a/test/objcopy_ref.c
+++ b/test/objcopy_ref.c
@@ -20,71 +20,66 @@
#include "testhdf5.h"
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
-
-const char *FILENAME[] = {
- "objcopy_ref_src",
- "objcopy_ref_dst",
- "objcopy_ref_ext",
- "objcopy_ref_src2",
- "verbound_ref_src",
- "verbound_ref_dst",
- NULL
-};
+#include "H5Fpkg.h" /* File access */
+
+const char *FILENAME[] = {"objcopy_ref_src",
+ "objcopy_ref_dst",
+ "objcopy_ref_ext",
+ "objcopy_ref_src2",
+ "verbound_ref_src",
+ "verbound_ref_dst",
+ NULL};
/* Configuration, really a series of bit flags. Maximum value is all three
* bit flags enabled.
*/
-#define CONFIG_SHARE_SRC 1
-#define CONFIG_SHARE_DST 2
+#define CONFIG_SHARE_SRC 1
+#define CONFIG_SHARE_DST 2
#define CONFIG_SRC_NEW_FORMAT 4
#define CONFIG_DST_NEW_FORMAT 8
-#define CONFIG_DENSE 16
-#define MAX_CONFIGURATION 31
+#define CONFIG_DENSE 16
+#define MAX_CONFIGURATION 31
-#define NAME_DATASET_SIMPLE "dataset_simple"
+#define NAME_DATASET_SIMPLE "dataset_simple"
#define NAME_DATASET_SUB_SUB "/g0/g00/g000/dataset_simple"
-#define NAME_GROUP_UNCOPIED "/uncopied"
-#define NAME_GROUP_TOP "/g0"
-#define NAME_GROUP_SUB "/g0/g00"
-#define NAME_GROUP_SUB_SUB2 "g000"
-#define NAME_GROUP_LINK "/g_links"
-#define NAME_GROUP_LINK2 "/g_links2"
-#define NAME_GROUP_REF "ref_grp"
-#define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple"
-#define NAME_LINK_SOFT2 "/g_links2/soft_link_to_dataset_simple"
-#define NAME_LINK_EXTERN "/g_links/external_link_to_dataset_simple"
-#define NAME_LINK_EXTERN2 "/g_links2/external_link_to_dataset_simple"
+#define NAME_GROUP_UNCOPIED "/uncopied"
+#define NAME_GROUP_TOP "/g0"
+#define NAME_GROUP_SUB "/g0/g00"
+#define NAME_GROUP_SUB_SUB2 "g000"
+#define NAME_GROUP_LINK "/g_links"
+#define NAME_GROUP_LINK2 "/g_links2"
+#define NAME_GROUP_REF "ref_grp"
+#define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple"
+#define NAME_LINK_SOFT2 "/g_links2/soft_link_to_dataset_simple"
+#define NAME_LINK_EXTERN "/g_links/external_link_to_dataset_simple"
+#define NAME_LINK_EXTERN2 "/g_links2/external_link_to_dataset_simple"
#define NAME_LINK_SOFT_DANGLE "/g_links/soft_link_to_nowhere"
-#define NAME_LINK_SOFT_DANGLE2 "/g_links2/soft_link_to_nowhere"
-#define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere"
-#define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere"
+#define NAME_LINK_SOFT_DANGLE2 "/g_links2/soft_link_to_nowhere"
+#define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere"
+#define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere"
-#define NAME_BUF_SIZE 1024
+#define NAME_BUF_SIZE 1024
#define ATTR_NAME_LEN 80
-#define DIM_SIZE_1 12
-#define DIM_SIZE_2 6
+#define DIM_SIZE_1 12
+#define DIM_SIZE_2 6
-unsigned num_attributes_g; /* Number of attributes created */
+unsigned num_attributes_g; /* Number of attributes created */
/* Table containing object id and object name */
/* (Used for detecting duplicate objects when comparing groups */
static struct {
- size_t nalloc; /* number of slots allocated */
- size_t nobjs; /* number of objects */
- H5O_token_t *obj; /* tokens for objects seen */
+ size_t nalloc; /* number of slots allocated */
+ size_t nobjs; /* number of objects */
+ H5O_token_t *obj; /* tokens for objects seen */
} idtab_g;
/* Local function prototypes */
-static int
-compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
- const void *buf1, const void *buf2, hid_t obj_owner);
-static int
-compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf);
-static int
-compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags);
+static int compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, const void *buf1,
+ const void *buf2, hid_t obj_owner);
+static int compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf);
+static int compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags);
/*-------------------------------------------------------------------------
* Function: token_insert
@@ -101,25 +96,24 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
static void
token_insert(H5O_info2_t *oinfo)
{
- size_t n;
+ size_t n;
/* Don't add it if the link count is 1 because such an object can only
* be encountered once. */
- if(oinfo->rc < 2)
+ if (oinfo->rc < 2)
return;
/* Extend the table */
- if(idtab_g.nobjs >= idtab_g.nalloc) {
+ if (idtab_g.nobjs >= idtab_g.nalloc) {
idtab_g.nalloc = MAX(256, 2 * idtab_g.nalloc);
- idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0]));
+ idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0]));
}
/* Insert the entry */
- n = idtab_g.nobjs++;
+ n = idtab_g.nobjs++;
idtab_g.obj[n] = oinfo->token;
} /* end token_insert() */
-
/*-------------------------------------------------------------------------
* Function: token_lookup
*
@@ -137,22 +131,21 @@ static H5_ATTR_PURE hbool_t
token_lookup(hid_t loc_id, H5O_info2_t *oinfo)
{
size_t n;
- int token_cmp;
+ int token_cmp;
- if(oinfo->rc < 2)
+ if (oinfo->rc < 2)
return FALSE; /*only one link possible*/
- for(n = 0; n < idtab_g.nobjs; n++) {
- if(H5Otoken_cmp(loc_id, &(idtab_g.obj[n]), &oinfo->token, &token_cmp) < 0)
+ for (n = 0; n < idtab_g.nobjs; n++) {
+ if (H5Otoken_cmp(loc_id, &(idtab_g.obj[n]), &oinfo->token, &token_cmp) < 0)
return FALSE;
- if(0 == token_cmp)
+ if (0 == token_cmp)
return TRUE;
}
return FALSE;
} /* end token_lookup() */
-
/*-------------------------------------------------------------------------
* Function: token_reset
*
@@ -168,13 +161,12 @@ token_lookup(hid_t loc_id, H5O_info2_t *oinfo)
static void
token_reset(void)
{
- if(idtab_g.obj)
+ if (idtab_g.obj)
HDfree(idtab_g.obj);
- idtab_g.obj = NULL;
+ idtab_g.obj = NULL;
idtab_g.nalloc = idtab_g.nobjs = 0;
} /* end token_reset() */
-
/*-------------------------------------------------------------------------
* Function: attach_ref_attr
*
@@ -187,41 +179,61 @@ token_reset(void)
static herr_t
attach_ref_attr(hid_t file_id, hid_t loc_id)
{
- char dsetname1[] = "dataset1_pointed_by_ref_attr";
- char dsetname2[] = "dataset2_pointed_by_ref_attr";
- hid_t did1 = (-1), did2 = (-1), aid = (-1), sid = (-1), sid_ref = (-1);
- hsize_t dims[2] = {2,9};
- hsize_t dims_ref[1] = {2};
+ char dsetname1[] = "dataset1_pointed_by_ref_attr";
+ char dsetname2[] = "dataset2_pointed_by_ref_attr";
+ hid_t did1 = (-1), did2 = (-1), aid = (-1), sid = (-1), sid_ref = (-1);
+ hsize_t dims[2] = {2, 9};
+ hsize_t dims_ref[1] = {2};
H5R_ref_t ref[2];
- int data1[2][9] = {{1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,18}};
- int data2[2][9] = {{2,2,2,2,2,2,2,2,2},{2,2,2,2,2,2,2,2,18}};
+ int data1[2][9] = {{1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 18}};
+ int data2[2][9] = {{2, 2, 2, 2, 2, 2, 2, 2, 2}, {2, 2, 2, 2, 2, 2, 2, 2, 18}};
/* creates two simple datasets */
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
- if((sid_ref = H5Screate_simple(1, dims_ref, NULL)) < 0) TEST_ERROR
- if((did1 = H5Dcreate2(file_id, dsetname1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data1) < 0) TEST_ERROR
- if((did2 = H5Dcreate2(file_id, dsetname2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data2) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((sid_ref = H5Screate_simple(1, dims_ref, NULL)) < 0)
+ TEST_ERROR
+ if ((did1 = H5Dcreate2(file_id, dsetname1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1) < 0)
+ TEST_ERROR
+ if ((did2 = H5Dcreate2(file_id, dsetname2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2) < 0)
+ TEST_ERROR
/* create an attribute with two object references */
- if(H5Rcreate_object(file_id, dsetname1, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR
- if(H5Rcreate_object(file_id, dsetname2, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR
- if((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Awrite(aid, H5T_STD_REF, ref) < 0) TEST_ERROR
-
- if(H5Sclose(sid) < 0) TEST_ERROR
- if(H5Sclose(sid_ref) < 0) TEST_ERROR
- if(H5Dclose(did1) < 0) TEST_ERROR
- if(H5Dclose(did2) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Rdestroy(&ref[0]) < 0) TEST_ERROR
- if(H5Rdestroy(&ref[1]) < 0) TEST_ERROR
+ if (H5Rcreate_object(file_id, dsetname1, H5P_DEFAULT, &ref[0]) < 0)
+ TEST_ERROR
+ if (H5Rcreate_object(file_id, dsetname2, H5P_DEFAULT, &ref[1]) < 0)
+ TEST_ERROR
+ if ((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Awrite(aid, H5T_STD_REF, ref) < 0)
+ TEST_ERROR
+
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
+ if (H5Sclose(sid_ref) < 0)
+ TEST_ERROR
+ if (H5Dclose(did1) < 0)
+ TEST_ERROR
+ if (H5Dclose(did2) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Rdestroy(&ref[0]) < 0)
+ TEST_ERROR
+ if (H5Rdestroy(&ref[1]) < 0)
+ TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Sclose(sid_ref);
H5Dclose(did1);
@@ -229,9 +241,10 @@ error:
H5Aclose(aid);
H5Rdestroy(&ref[0]);
H5Rdestroy(&ref[1]);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return(-1);
+ return (-1);
}
/*-------------------------------------------------------------------------
@@ -250,69 +263,90 @@ static herr_t
attach_reg_ref_attr(hid_t file_id, hid_t loc_id)
{
const char dsetnamev[] = "dataset_pointed_by_reg_ref_attr";
- hid_t aid = (-1);
- hid_t space_id = (-1); /* dataspace identifiers */
- hid_t spacer_id = (-1); /* dataspace identifiers */
- hid_t dsetv_id = (-1); /*dataset identifiers*/
- hsize_t dims[2] = {2,9};
- hsize_t dimsr[1] = {2};
- int rank = 2;
- int rankr =1;
- H5R_ref_t ref[2];
- int data[2][9] = {{1,1,2,3,3,4,5,5,999},{1,2,2,3,4,4,5,6,999}};
- hsize_t start[2] = {0, 3};
- hsize_t count[2] = {2, 3};
- hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
- size_t num_points = 3;
+ hid_t aid = (-1);
+ hid_t space_id = (-1); /* dataspace identifiers */
+ hid_t spacer_id = (-1); /* dataspace identifiers */
+ hid_t dsetv_id = (-1); /*dataset identifiers*/
+ hsize_t dims[2] = {2, 9};
+ hsize_t dimsr[1] = {2};
+ int rank = 2;
+ int rankr = 1;
+ H5R_ref_t ref[2];
+ int data[2][9] = {{1, 1, 2, 3, 3, 4, 5, 5, 999}, {1, 2, 2, 3, 4, 4, 5, 6, 999}};
+ hsize_t start[2] = {0, 3};
+ hsize_t count[2] = {2, 3};
+ hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
+ size_t num_points = 3;
/* create a 2D dataset */
- if((space_id = H5Screate_simple(rank, dims, NULL)) < 0) TEST_ERROR
- if((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0) TEST_ERROR
- if((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data) < 0) TEST_ERROR
+ if ((space_id = H5Screate_simple(rank, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0)
+ TEST_ERROR
+ if ((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
/* create reg_ref of block selection */
- if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR
- if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+ if (H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0)
+ TEST_ERROR
/* create reg_ref of point selection */
- if(H5Sselect_none(space_id) < 0) TEST_ERROR
- if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR
- if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR
+ if (H5Sselect_none(space_id) < 0)
+ TEST_ERROR
+ if (H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0)
+ TEST_ERROR
+ if (H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0)
+ TEST_ERROR
/* create reg_ref attribute */
- if((aid = H5Acreate2(loc_id, "reg_ref_attr", H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Awrite(aid, H5T_STD_REF, ref) < 0) TEST_ERROR
+ if ((aid = H5Acreate2(loc_id, "reg_ref_attr", H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Awrite(aid, H5T_STD_REF, ref) < 0)
+ TEST_ERROR
/* attach the reg_ref attribute to the dataset itself */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if((aid = H5Acreate2(dsetv_id, "reg_ref_attr", H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Awrite(aid, H5T_STD_REF, ref) < 0) TEST_ERROR
-
- if(H5Sclose(spacer_id) < 0) TEST_ERROR
- if(H5Sclose(space_id) < 0) TEST_ERROR
- if(H5Dclose(dsetv_id) < 0) TEST_ERROR
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Rdestroy(&ref[0]) < 0) TEST_ERROR
- if(H5Rdestroy(&ref[1]) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if ((aid = H5Acreate2(dsetv_id, "reg_ref_attr", H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Awrite(aid, H5T_STD_REF, ref) < 0)
+ TEST_ERROR
+ if (H5Sclose(spacer_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetv_id) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Rdestroy(&ref[0]) < 0)
+ TEST_ERROR
+ if (H5Rdestroy(&ref[1]) < 0)
+ TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(spacer_id);
H5Sclose(space_id);
H5Dclose(dsetv_id);
H5Aclose(aid);
H5Rdestroy(&ref[0]);
H5Rdestroy(&ref[1]);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return(-1);
+ return (-1);
}
-
/*-------------------------------------------------------------------------
* Function: create_reg_ref_dataset
*
@@ -328,75 +362,109 @@ error:
static herr_t
create_reg_ref_dataset(hid_t file_id, hid_t loc_id)
{
- const char dsetnamev[] = "dataset_pointed_by_ref_dset";
- const char dsetnamer[] = "dataset_with_reg_ref";
+ const char dsetnamev[] = "dataset_pointed_by_ref_dset";
+ const char dsetnamer[] = "dataset_with_reg_ref";
const char dsetnamer1[] = "compact_dataset_with_reg_ref";
const char dsetnamer2[] = "compressed_dataset_with_reg_ref";
- hid_t space_id = (-1); /* dataspace identifiers */
- hid_t spacer_id = (-1);
- hid_t dsetv_id = (-1); /*dataset identifiers*/
- hid_t dsetr_id = (-1);
- hsize_t dims[2] = {2,9};
- hsize_t dimsr[1] = {2};
- int rank = 2;
- int rankr =1;
- hsize_t chunk_size=1;
- H5R_ref_t ref[2];
- int data[2][9] = {{1,1,2,3,3,4,5,5,6},{1,2,2,3,4,4,5,6,6}};
- hsize_t start[2];
- hsize_t count[2];
- hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
- size_t num_points = 3;
- hid_t pid = (-1);
-
- if((space_id = H5Screate_simple(rank, dims, NULL)) < 0) TEST_ERROR
- if((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0) TEST_ERROR
- if((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data) < 0) TEST_ERROR
- if((dsetr_id = H5Dcreate2(loc_id, dsetnamer, H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ hid_t space_id = (-1); /* dataspace identifiers */
+ hid_t spacer_id = (-1);
+ hid_t dsetv_id = (-1); /*dataset identifiers*/
+ hid_t dsetr_id = (-1);
+ hsize_t dims[2] = {2, 9};
+ hsize_t dimsr[1] = {2};
+ int rank = 2;
+ int rankr = 1;
+ hsize_t chunk_size = 1;
+ H5R_ref_t ref[2];
+ int data[2][9] = {{1, 1, 2, 3, 3, 4, 5, 5, 6}, {1, 2, 2, 3, 4, 4, 5, 6, 6}};
+ hsize_t start[2];
+ hsize_t count[2];
+ hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
+ size_t num_points = 3;
+ hid_t pid = (-1);
+
+ if ((space_id = H5Screate_simple(rank, dims, NULL)) < 0)
+ TEST_ERROR
+ if ((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0)
+ TEST_ERROR
+ if ((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+ if ((dsetr_id = H5Dcreate2(loc_id, dsetnamer, H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
start[0] = 0;
start[1] = 3;
count[0] = 2;
count[1] = 3;
- if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR
- if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR
- if(H5Sselect_none(space_id) < 0) TEST_ERROR
- if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR
- if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR
- if(H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR
- if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+ if (H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+ if (H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0)
+ TEST_ERROR
+ if (H5Sselect_none(space_id) < 0)
+ TEST_ERROR
+ if (H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0)
+ TEST_ERROR
+ if (H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetr_id) < 0)
+ TEST_ERROR
/* create and set compact plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_layout(pid, H5D_COMPACT) < 0)
+ TEST_ERROR
- if((dsetr_id = H5Dcreate2(loc_id, dsetnamer1, H5T_STD_REF, spacer_id, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Pclose(pid) < 0) TEST_ERROR
- if(H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0) TEST_ERROR
- if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+ if ((dsetr_id = H5Dcreate2(loc_id, dsetnamer1, H5T_STD_REF, spacer_id, H5P_DEFAULT, pid, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetr_id) < 0)
+ TEST_ERROR
/* create and set comp & chunk plist */
- if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(pid, 1, &chunk_size) < 0) TEST_ERROR
- if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_chunk(pid, 1, &chunk_size) < 0)
+ TEST_ERROR
+ if (H5Pset_deflate(pid, 9) < 0)
+ TEST_ERROR
- if((dsetr_id = H5Dcreate2(loc_id, dsetnamer2, H5T_STD_REF, spacer_id, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Pclose(pid) < 0) TEST_ERROR
- if(H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR
- if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+ if ((dsetr_id = H5Dcreate2(loc_id, dsetnamer2, H5T_STD_REF, spacer_id, H5P_DEFAULT, pid, H5P_DEFAULT)) <
+ 0)
+ TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
+ if (H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetr_id) < 0)
+ TEST_ERROR
- if(H5Sclose(space_id) < 0) TEST_ERROR
- if(H5Sclose(spacer_id) < 0) TEST_ERROR
- if(H5Dclose(dsetv_id) < 0) TEST_ERROR
- if(H5Rdestroy(&ref[0]) < 0) TEST_ERROR
- if(H5Rdestroy(&ref[1]) < 0) TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(spacer_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dsetv_id) < 0)
+ TEST_ERROR
+ if (H5Rdestroy(&ref[0]) < 0)
+ TEST_ERROR
+ if (H5Rdestroy(&ref[1]) < 0)
+ TEST_ERROR
return 0;
-
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space_id);
H5Sclose(spacer_id);
H5Dclose(dsetr_id);
@@ -404,9 +472,10 @@ error:
H5Pclose(pid);
H5Rdestroy(&ref[0]);
H5Rdestroy(&ref[1]);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return(-1);
+ return (-1);
}
/*-------------------------------------------------------------------------
@@ -424,22 +493,22 @@ error:
static int
test_copy_attach_attributes(hid_t loc_id, hid_t type_id)
{
- hid_t aid = -1, sid = -1;
- char attr_name[ATTR_NAME_LEN];
- int attr_data[2];
- hsize_t dim1 = 2;
- hid_t acpl = -1;
- unsigned u;
- int ret_value = -1;
-
- if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
+ hid_t aid = -1, sid = -1;
+ char attr_name[ATTR_NAME_LEN];
+ int attr_data[2];
+ hsize_t dim1 = 2;
+ hid_t acpl = -1;
+ unsigned u;
+ int ret_value = -1;
+
+ if ((sid = H5Screate_simple(1, &dim1, NULL)) < 0)
goto done;
/* Create attribute creation plist */
- if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
+ if ((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
goto done;
- for(u = 0; u < num_attributes_g; u++) {
+ for (u = 0; u < num_attributes_g; u++) {
HDsprintf(attr_name, "%u attr", u);
/* Set attribute data */
@@ -447,34 +516,33 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id)
attr_data[1] = (int)(200 * u);
/* Set attribute character set (alternate) */
- if(u % 2) {
- if(H5Pset_char_encoding(acpl, H5T_CSET_ASCII) < 0)
+ if (u % 2) {
+ if (H5Pset_char_encoding(acpl, H5T_CSET_ASCII) < 0)
goto done;
} /* end if */
- else
- if(H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0)
- goto done;
+ else if (H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0)
+ goto done;
- if((aid = H5Acreate2(loc_id, attr_name, type_id, sid, acpl, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(loc_id, attr_name, type_id, sid, acpl, H5P_DEFAULT)) < 0)
goto done;
- if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
goto done;
- if(aid > 0)
+ if (aid > 0)
H5Aclose(aid);
- aid = -1;
+ aid = -1;
}
ret_value = 0;
done:
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
- if(aid > 0)
+ if (aid > 0)
H5Aclose(aid);
- if(acpl > 0)
+ if (acpl > 0)
H5Pclose(acpl);
return ret_value;
@@ -495,86 +563,110 @@ done:
static int
compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf, hid_t obj_owner)
{
- hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- size_t elmt_size; /* Size of datatype */
- htri_t is_committed; /* If the datatype is committed */
- htri_t is_committed2; /* If the datatype is committed */
- H5A_info_t ainfo; /* Attribute info */
- H5A_info_t ainfo2; /* Attribute info */
- hssize_t nelmts; /* # of elements in dataspace */
- void *rbuf = NULL; /* Buffer for reading raw data */
- void *rbuf2 = NULL; /* Buffer for reading raw data */
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ size_t elmt_size; /* Size of datatype */
+ htri_t is_committed; /* If the datatype is committed */
+ htri_t is_committed2; /* If the datatype is committed */
+ H5A_info_t ainfo; /* Attribute info */
+ H5A_info_t ainfo2; /* Attribute info */
+ hssize_t nelmts; /* # of elements in dataspace */
+ void * rbuf = NULL; /* Buffer for reading raw data */
+ void * rbuf2 = NULL; /* Buffer for reading raw data */
/* Check the character sets are equal */
- if(H5Aget_info(aid, &ainfo) < 0) TEST_ERROR
- if(H5Aget_info(aid2, &ainfo2) < 0) TEST_ERROR
- if(ainfo.cset != ainfo2.cset) TEST_ERROR
+ if (H5Aget_info(aid, &ainfo) < 0)
+ TEST_ERROR
+ if (H5Aget_info(aid2, &ainfo2) < 0)
+ TEST_ERROR
+ if (ainfo.cset != ainfo2.cset)
+ TEST_ERROR
/* Check the creation orders are equal (if appropriate) */
- if(ainfo.corder_valid != ainfo2.corder_valid) TEST_ERROR
- if(ainfo.corder_valid)
- if(ainfo.corder != ainfo2.corder) TEST_ERROR
+ if (ainfo.corder_valid != ainfo2.corder_valid)
+ TEST_ERROR
+ if (ainfo.corder_valid)
+ if (ainfo.corder != ainfo2.corder)
+ TEST_ERROR
/* Check the datatypes are equal */
/* Open the datatype for the source attribute */
- if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
+ if ((tid = H5Aget_type(aid)) < 0)
+ TEST_ERROR
/* Open the datatype for the destination attribute */
- if((tid2 = H5Aget_type(aid2)) < 0) TEST_ERROR
+ if ((tid2 = H5Aget_type(aid2)) < 0)
+ TEST_ERROR
/* Check that both datatypes are committed/not committed */
- if((is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
- if((is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
- if(is_committed != is_committed2) TEST_ERROR
+ if ((is_committed = H5Tcommitted(tid)) < 0)
+ TEST_ERROR
+ if ((is_committed2 = H5Tcommitted(tid2)) < 0)
+ TEST_ERROR
+ if (is_committed != is_committed2)
+ TEST_ERROR
/* Compare the datatypes */
- if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if (H5Tequal(tid, tid2) != TRUE)
+ TEST_ERROR
/* Determine the size of datatype (for later) */
- if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
+ if ((elmt_size = H5Tget_size(tid)) == 0)
+ TEST_ERROR
/* Check the dataspaces are equal */
/* Open the dataspace for the source attribute */
- if((sid = H5Aget_space(aid)) < 0) TEST_ERROR
+ if ((sid = H5Aget_space(aid)) < 0)
+ TEST_ERROR
/* Open the dataspace for the destination attribute */
- if((sid2 = H5Aget_space(aid2)) < 0) TEST_ERROR
+ if ((sid2 = H5Aget_space(aid2)) < 0)
+ TEST_ERROR
/* Compare the dataspaces */
- if(H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
+ if (H5Sextent_equal(sid, sid2) != TRUE)
+ TEST_ERROR
/* Determine the number of elements in dataspace (for later) */
- if((nelmts = H5Sget_simple_extent_npoints(sid2)) < 0) TEST_ERROR
+ if ((nelmts = H5Sget_simple_extent_npoints(sid2)) < 0)
+ TEST_ERROR
/* Check the raw data is equal */
/* Allocate & initialize space for the raw data buffers */
- if((rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
- if((rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if ((rbuf = HDcalloc(elmt_size, (size_t)nelmts)) == NULL)
+ TEST_ERROR
+ if ((rbuf2 = HDcalloc(elmt_size, (size_t)nelmts)) == NULL)
+ TEST_ERROR
/* Read data from the source attribute */
- if(H5Aread(aid, tid, rbuf) < 0) TEST_ERROR
+ if (H5Aread(aid, tid, rbuf) < 0)
+ TEST_ERROR
/* Read data from the destination attribute */
- if(H5Aread(aid2, tid2, rbuf2) < 0) TEST_ERROR
+ if (H5Aread(aid2, tid2, rbuf2) < 0)
+ TEST_ERROR
/* Check raw data read in against data written out */
- if(wbuf) {
- if(!compare_data(aid, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, obj_owner)) TEST_ERROR
- if(!compare_data(aid2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, obj_owner)) TEST_ERROR
+ if (wbuf) {
+ if (!compare_data(aid, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, obj_owner))
+ TEST_ERROR
+ if (!compare_data(aid2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, obj_owner))
+ TEST_ERROR
} /* end if */
/* Don't have written data, just compare data between the two attributes */
- else
- if(!compare_data(aid, aid2, pid, tid, (size_t)nelmts, rbuf, rbuf2, obj_owner)) TEST_ERROR
+ else if (!compare_data(aid, aid2, pid, tid, (size_t)nelmts, rbuf, rbuf2, obj_owner))
+ TEST_ERROR
/* Reclaim vlen data, if necessary */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE || H5Tdetect_class(tid, H5T_REFERENCE) == TRUE)
- if(H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
- if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE || H5Tdetect_class(tid2, H5T_REFERENCE) == TRUE)
- if(H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE || H5Tdetect_class(tid, H5T_REFERENCE) == TRUE)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR
+ if (H5Tdetect_class(tid2, H5T_VLEN) == TRUE || H5Tdetect_class(tid2, H5T_REFERENCE) == TRUE)
+ if (H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0)
+ TEST_ERROR
/* Release raw data buffers */
HDfree(rbuf);
@@ -583,34 +675,39 @@ compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf, hid_t obj_
rbuf2 = NULL;
/* close the source dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the destination dataspace */
- if(H5Sclose(sid2) < 0) TEST_ERROR
+ if (H5Sclose(sid2) < 0)
+ TEST_ERROR
/* close the source datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the destination datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
return TRUE;
error:
- if(rbuf)
+ if (rbuf)
HDfree(rbuf);
- if(rbuf2)
+ if (rbuf2)
HDfree(rbuf2);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid2);
H5Sclose(sid);
H5Tclose(tid2);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FALSE;
} /* end compare_attribute() */
-
/*-------------------------------------------------------------------------
* Function: compare_std_attributes
*
@@ -629,62 +726,75 @@ error:
static int
compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
{
- hid_t aid = -1, aid2 = -1; /* Attribute IDs */
- H5O_info2_t oinfo1, oinfo2; /* Object info */
- unsigned cpy_flags; /* Object copy flags */
+ hid_t aid = -1, aid2 = -1; /* Attribute IDs */
+ H5O_info2_t oinfo1, oinfo2; /* Object info */
+ unsigned cpy_flags; /* Object copy flags */
/* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
- if(pid != H5P_DEFAULT) {
- if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ if (pid != H5P_DEFAULT) {
+ if (H5Pget_copy_object(pid, &cpy_flags) < 0)
+ TEST_ERROR
} /* end if */
else
cpy_flags = 0;
/* Check the number of attributes on source dataset */
- if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
+ if (H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0)
+ TEST_ERROR
/* Check the number of attributes on destination dataset */
- if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
+ if (H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0)
+ TEST_ERROR
- if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) {
+ if (cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) {
/* Check that the destination has no attributes */
- if(oinfo2.num_attrs != 0) TEST_ERROR
+ if (oinfo2.num_attrs != 0)
+ TEST_ERROR
} /* end if */
else {
- char attr_name[ATTR_NAME_LEN]; /* Attribute name */
- unsigned i; /* Local index variable */
+ char attr_name[ATTR_NAME_LEN]; /* Attribute name */
+ unsigned i; /* Local index variable */
/* Compare the number of attributes */
- if(oinfo1.num_attrs != oinfo2.num_attrs) TEST_ERROR
+ if (oinfo1.num_attrs != oinfo2.num_attrs)
+ TEST_ERROR
/* Check the attributes are equal */
- for(i = 0; i < (unsigned)oinfo1.num_attrs; i++) {
- if((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Aget_name(aid, (size_t)ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
+ for (i = 0; i < (unsigned)oinfo1.num_attrs; i++) {
+ if ((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Aget_name(aid, (size_t)ATTR_NAME_LEN, attr_name) < 0)
+ TEST_ERROR
- if((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check the attributes are equal */
- if(!compare_attribute(aid, aid2, pid, NULL, oid)) TEST_ERROR
+ if (!compare_attribute(aid, aid2, pid, NULL, oid))
+ TEST_ERROR
/* Close the attributes */
- if(H5Aclose(aid) < 0) TEST_ERROR
- if(H5Aclose(aid2) < 0) TEST_ERROR
+ if (H5Aclose(aid) < 0)
+ TEST_ERROR
+ if (H5Aclose(aid2) < 0)
+ TEST_ERROR
} /* end for */
- } /* end if */
+ } /* end if */
/* Objects should be the same. :-) */
return TRUE;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid2);
H5Aclose(aid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FALSE;
} /* end compare_std_attributes() */
-
/*-------------------------------------------------------------------------
* Function: compare_data
*
@@ -698,166 +808,192 @@ error:
*-------------------------------------------------------------------------
*/
static int
-compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
- const void *buf1, const void *buf2, hid_t obj_owner)
+compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, const void *buf1,
+ const void *buf2, hid_t obj_owner)
{
- size_t elmt_size; /* Size of an element */
+ size_t elmt_size; /* Size of an element */
/* Check size of each element */
- if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
+ if ((elmt_size = H5Tget_size(tid)) == 0)
+ TEST_ERROR
/* If the type is a compound containing a vlen, loop over all elements for
* each compound member. Compounds containing reference are not supported
* yet. */
- if((H5Tget_class(tid) == H5T_COMPOUND)
- && (H5Tdetect_class(tid, H5T_VLEN) == TRUE)) {
- hid_t memb_id; /* Member id */
- const uint8_t *memb1; /* Pointer to current member */
- const uint8_t *memb2; /* Pointer to current member */
- int nmembs; /* Number of members */
- size_t memb_off; /* Member offset */
- size_t memb_size; /* Member size */
- unsigned memb_idx; /* Member index */
- size_t elmt; /* Current element */
+ if ((H5Tget_class(tid) == H5T_COMPOUND) && (H5Tdetect_class(tid, H5T_VLEN) == TRUE)) {
+ hid_t memb_id; /* Member id */
+ const uint8_t *memb1; /* Pointer to current member */
+ const uint8_t *memb2; /* Pointer to current member */
+ int nmembs; /* Number of members */
+ size_t memb_off; /* Member offset */
+ size_t memb_size; /* Member size */
+ unsigned memb_idx; /* Member index */
+ size_t elmt; /* Current element */
/* Get number of members in compound */
- if((nmembs = H5Tget_nmembers(tid)) < 0) TEST_ERROR
+ if ((nmembs = H5Tget_nmembers(tid)) < 0)
+ TEST_ERROR
/* Loop over members */
- for(memb_idx=0; memb_idx<(unsigned)nmembs; memb_idx++) {
+ for (memb_idx = 0; memb_idx < (unsigned)nmembs; memb_idx++) {
/* Get member offset. Note that we cannot check for an error here.
*/
memb_off = H5Tget_member_offset(tid, memb_idx);
/* Get member id */
- if((memb_id = H5Tget_member_type(tid, memb_idx)) < 0) TEST_ERROR
+ if ((memb_id = H5Tget_member_type(tid, memb_idx)) < 0)
+ TEST_ERROR
/* Get member size */
- if((memb_size = H5Tget_size(memb_id)) == 0) TEST_ERROR
+ if ((memb_size = H5Tget_size(memb_id)) == 0)
+ TEST_ERROR
/* Set up pointers to member in the first element */
memb1 = (const uint8_t *)buf1 + memb_off;
memb2 = (const uint8_t *)buf2 + memb_off;
/* Check if this member contains (or is) a vlen */
- if(H5Tget_class(memb_id) == H5T_VLEN) {
- hid_t base_id; /* vlen base type id */
+ if (H5Tget_class(memb_id) == H5T_VLEN) {
+ hid_t base_id; /* vlen base type id */
/* Get base type of vlen datatype */
- if((base_id = H5Tget_super(memb_id)) < 0) TEST_ERROR
+ if ((base_id = H5Tget_super(memb_id)) < 0)
+ TEST_ERROR
/* Iterate over all elements, recursively calling this function
* for each */
- for(elmt=0; elmt<nelmts; elmt++) {
+ for (elmt = 0; elmt < nelmts; elmt++) {
/* Check vlen lengths */
- if(((const hvl_t *)((const void *)memb1))->len
- != ((const hvl_t *)((const void *)memb2))->len)
+ if (((const hvl_t *)((const void *)memb1))->len !=
+ ((const hvl_t *)((const void *)memb2))->len)
TEST_ERROR
/* Check vlen data */
- if(!compare_data(parent1, parent2, pid, base_id,
- ((const hvl_t *)((const void *)memb1))->len,
- ((const hvl_t *)((const void *)memb1))->p,
- ((const hvl_t *)((const void *)memb2))->p, obj_owner))
+ if (!compare_data(parent1, parent2, pid, base_id,
+ ((const hvl_t *)((const void *)memb1))->len,
+ ((const hvl_t *)((const void *)memb1))->p,
+ ((const hvl_t *)((const void *)memb2))->p, obj_owner))
TEST_ERROR
/* Update member pointers */
memb1 += elmt_size;
memb2 += elmt_size;
} /* end for */
- } else {
+ }
+ else {
/* vlens cannot currently be nested below the top layer of a
* compound */
HDassert(H5Tdetect_class(memb_id, H5T_VLEN) == FALSE);
/* Iterate over all elements, calling memcmp() for each */
- for(elmt=0; elmt<nelmts; elmt++) {
- if(HDmemcmp(memb1, memb2, memb_size))
+ for (elmt = 0; elmt < nelmts; elmt++) {
+ if (HDmemcmp(memb1, memb2, memb_size))
TEST_ERROR
/* Update member pointers */
memb1 += elmt_size;
memb2 += elmt_size;
} /* end for */
- } /* end else */
- } /* end for */
- } else if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ } /* end else */
+ } /* end for */
+ }
+ else if (H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
const hvl_t *vl_buf1, *vl_buf2; /* Aliases for buffers to compare */
- hid_t base_tid; /* Base type of vlen datatype */
- size_t u; /* Local index variable */
+ hid_t base_tid; /* Base type of vlen datatype */
+ size_t u; /* Local index variable */
/* Check for "simple" vlen datatype */
- if(H5Tget_class(tid) != H5T_VLEN) TEST_ERROR
+ if (H5Tget_class(tid) != H5T_VLEN)
+ TEST_ERROR
/* Get base type of vlen datatype */
- if((base_tid = H5Tget_super(tid)) < 0) TEST_ERROR
+ if ((base_tid = H5Tget_super(tid)) < 0)
+ TEST_ERROR
/* Loop over elements in buffers */
vl_buf1 = (const hvl_t *)buf1;
vl_buf2 = (const hvl_t *)buf2;
- for(u = 0; u < nelmts; u++, vl_buf1++, vl_buf2++) {
+ for (u = 0; u < nelmts; u++, vl_buf1++, vl_buf2++) {
/* Check vlen lengths */
- if(vl_buf1->len != vl_buf2->len) TEST_ERROR
+ if (vl_buf1->len != vl_buf2->len)
+ TEST_ERROR
/* Check vlen data */
- if(!compare_data(parent1, parent2, pid, base_tid, vl_buf1->len, vl_buf1->p, vl_buf2->p, obj_owner)) TEST_ERROR
+ if (!compare_data(parent1, parent2, pid, base_tid, vl_buf1->len, vl_buf1->p, vl_buf2->p,
+ obj_owner))
+ TEST_ERROR
} /* end for */
- if(H5Tclose(base_tid) < 0) TEST_ERROR
+ if (H5Tclose(base_tid) < 0)
+ TEST_ERROR
} /* end if */
- else if(H5Tdetect_class(tid, H5T_REFERENCE) == TRUE) {
- size_t u; /* Local index variable */
+ else if (H5Tdetect_class(tid, H5T_REFERENCE) == TRUE) {
+ size_t u; /* Local index variable */
/* Check for "simple" reference datatype */
- if(H5Tget_class(tid) != H5T_REFERENCE) TEST_ERROR
+ if (H5Tget_class(tid) != H5T_REFERENCE)
+ TEST_ERROR
/* Check for object or region reference */
- if(H5Tequal(tid, H5T_STD_REF) > 0) {
- H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
+ if (H5Tequal(tid, H5T_STD_REF) > 0) {
+ H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
/* Loop over elements in buffers */
ref_buf1 = (H5R_ref_t *)buf1;
ref_buf2 = (H5R_ref_t *)buf2;
- for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
- hid_t obj1_id, obj2_id; /* IDs for objects referenced */
+ for (u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
+ hid_t obj1_id, obj2_id; /* IDs for objects referenced */
H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */
/* Check for types of objects handled */
- if(H5Rget_obj_type3(ref_buf1, H5P_DEFAULT, &obj1_type) < 0) TEST_ERROR
- if(H5Rget_obj_type3(ref_buf2, H5P_DEFAULT, &obj2_type) < 0) TEST_ERROR
- if(obj1_type != obj2_type) TEST_ERROR
+ if (H5Rget_obj_type3(ref_buf1, H5P_DEFAULT, &obj1_type) < 0)
+ TEST_ERROR
+ if (H5Rget_obj_type3(ref_buf2, H5P_DEFAULT, &obj2_type) < 0)
+ TEST_ERROR
+ if (obj1_type != obj2_type)
+ TEST_ERROR
/* Open referenced objects */
- if((obj1_id = H5Ropen_object(ref_buf1, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((obj2_id = H5Ropen_object(ref_buf2, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((obj1_id = H5Ropen_object(ref_buf1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((obj2_id = H5Ropen_object(ref_buf2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* break the infinite loop when the ref_object points to itself */
- if(obj_owner > 0) {
+ if (obj_owner > 0) {
H5O_info2_t oinfo1, oinfo2;
- int token_cmp;
-
- if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR
- if(0 == token_cmp) {
- if(H5Oclose(obj1_id) < 0) TEST_ERROR
- if(H5Oclose(obj2_id) < 0) TEST_ERROR
+ int token_cmp;
+
+ if (H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ if (H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0)
+ TEST_ERROR
+ if (0 == token_cmp) {
+ if (H5Oclose(obj1_id) < 0)
+ TEST_ERROR
+ if (H5Oclose(obj2_id) < 0)
+ TEST_ERROR
return TRUE;
}
}
/* Check for types of objects handled */
- switch(obj1_type) {
+ switch (obj1_type) {
case H5O_TYPE_DATASET:
- if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_GROUP:
- if(compare_groups(obj1_id, obj2_id, pid, -1, 0) != TRUE) TEST_ERROR
+ if (compare_groups(obj1_id, obj2_id, pid, -1, 0) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_NAMED_DATATYPE:
- if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
+ if (H5Tequal(obj1_id, obj2_id) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_MAP:
@@ -870,30 +1006,37 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
} /* end switch */
/* Close objects */
- if(H5Oclose(obj1_id) < 0) TEST_ERROR
- if(H5Oclose(obj2_id) < 0) TEST_ERROR
+ if (H5Oclose(obj1_id) < 0)
+ TEST_ERROR
+ if (H5Oclose(obj2_id) < 0)
+ TEST_ERROR
- if(H5Rget_type(ref_buf1) == H5R_DATASET_REGION2) {
- hid_t obj1_sid, obj2_sid; /* Dataspace IDs for objects referenced */
+ if (H5Rget_type(ref_buf1) == H5R_DATASET_REGION2) {
+ hid_t obj1_sid, obj2_sid; /* Dataspace IDs for objects referenced */
/* Get regions for referenced datasets */
- if((obj1_sid = H5Ropen_region(ref_buf1, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((obj2_sid = H5Ropen_region(ref_buf2, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((obj1_sid = H5Ropen_region(ref_buf1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((obj2_sid = H5Ropen_region(ref_buf2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check if dataspaces are the same shape */
- if(H5Sselect_shape_same(obj1_sid, obj2_sid) < 0) TEST_ERROR
+ if (H5Sselect_shape_same(obj1_sid, obj2_sid) < 0)
+ TEST_ERROR
/* Close dataspaces */
- if(H5Sclose(obj1_sid) < 0) TEST_ERROR
- if(H5Sclose(obj2_sid) < 0) TEST_ERROR
+ if (H5Sclose(obj1_sid) < 0)
+ TEST_ERROR
+ if (H5Sclose(obj2_sid) < 0)
+ TEST_ERROR
} /* end if */
- } /* end for */
- } /* end if */
+ } /* end for */
+ } /* end if */
else
TEST_ERROR
} /* end else */
- else
- if(HDmemcmp(buf1, buf2, (elmt_size * nelmts))) TEST_ERROR
+ else if (HDmemcmp(buf1, buf2, (elmt_size * nelmts)))
+ TEST_ERROR
/* Data should be the same. :-) */
return TRUE;
@@ -902,7 +1045,6 @@ error:
return FALSE;
} /* end compare_data() */
-
/*-------------------------------------------------------------------------
* Function: compare_datasets
*
@@ -918,81 +1060,98 @@ error:
static int
compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
{
- hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
- hid_t tid = -1, tid2 = -1; /* Datatype IDs */
- hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list IDs */
- size_t elmt_size; /* Size of datatype */
- htri_t is_committed; /* If the datatype is committed */
- htri_t is_committed2; /* If the datatype is committed */
- int nfilters; /* Number of filters applied to dataset */
- hssize_t nelmts; /* # of elements in dataspace */
- void *rbuf = NULL; /* Buffer for reading raw data */
- void *rbuf2 = NULL; /* Buffer for reading raw data */
- H5D_space_status_t space_status; /* Dataset's raw dataspace status */
- H5D_space_status_t space_status2; /* Dataset's raw dataspace status */
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list IDs */
+ size_t elmt_size; /* Size of datatype */
+ htri_t is_committed; /* If the datatype is committed */
+ htri_t is_committed2; /* If the datatype is committed */
+ int nfilters; /* Number of filters applied to dataset */
+ hssize_t nelmts; /* # of elements in dataspace */
+ void * rbuf = NULL; /* Buffer for reading raw data */
+ void * rbuf2 = NULL; /* Buffer for reading raw data */
+ H5D_space_status_t space_status; /* Dataset's raw dataspace status */
+ H5D_space_status_t space_status2; /* Dataset's raw dataspace status */
/* Check the datatypes are equal */
/* Open the datatype for the source dataset */
- if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if ((tid = H5Dget_type(did)) < 0)
+ TEST_ERROR
/* Open the datatype for the destination dataset */
- if((tid2 = H5Dget_type(did2)) < 0) TEST_ERROR
+ if ((tid2 = H5Dget_type(did2)) < 0)
+ TEST_ERROR
/* Check that both datatypes are committed/not committed */
- if((is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
- if((is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
- if(is_committed != is_committed2) TEST_ERROR
+ if ((is_committed = H5Tcommitted(tid)) < 0)
+ TEST_ERROR
+ if ((is_committed2 = H5Tcommitted(tid2)) < 0)
+ TEST_ERROR
+ if (is_committed != is_committed2)
+ TEST_ERROR
/* Compare the datatypes */
- if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if (H5Tequal(tid, tid2) != TRUE)
+ TEST_ERROR
/* Determine the size of datatype (for later) */
- if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
-
+ if ((elmt_size = H5Tget_size(tid)) == 0)
+ TEST_ERROR
/* Check the dataspaces are equal */
/* Open the dataspace for the source dataset */
- if((sid = H5Dget_space(did)) < 0) TEST_ERROR
+ if ((sid = H5Dget_space(did)) < 0)
+ TEST_ERROR
/* Open the dataspace for the destination dataset */
- if((sid2 = H5Dget_space(did2)) < 0) TEST_ERROR
+ if ((sid2 = H5Dget_space(did2)) < 0)
+ TEST_ERROR
/* Compare the dataspaces */
- if(H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
+ if (H5Sextent_equal(sid, sid2) != TRUE)
+ TEST_ERROR
/* Determine the number of elements in dataspace (for later) */
- if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) TEST_ERROR
-
+ if ((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
+ TEST_ERROR
/* Check the dataset creation property lists are equal */
/* Open the dataset creation property list for the source dataset */
- if((dcpl = H5Dget_create_plist(did)) < 0) TEST_ERROR
+ if ((dcpl = H5Dget_create_plist(did)) < 0)
+ TEST_ERROR
/* Open the dataset creation property list for the destination dataset */
- if((dcpl2 = H5Dget_create_plist(did2)) < 0) TEST_ERROR
+ if ((dcpl2 = H5Dget_create_plist(did2)) < 0)
+ TEST_ERROR
/* Compare the rest of the dataset creation property lists */
- if(H5Pequal(dcpl, dcpl2) != TRUE) TEST_ERROR
+ if (H5Pequal(dcpl, dcpl2) != TRUE)
+ TEST_ERROR
/* Get the number of filters on dataset (for later) */
- if((nfilters = H5Pget_nfilters(dcpl)) < 0) TEST_ERROR
+ if ((nfilters = H5Pget_nfilters(dcpl)) < 0)
+ TEST_ERROR
/* close the source dataset creation property list */
- if(H5Pclose(dcpl) < 0) TEST_ERROR
+ if (H5Pclose(dcpl) < 0)
+ TEST_ERROR
/* close the destination dataset creation property list */
- if(H5Pclose(dcpl2) < 0) TEST_ERROR
-
+ if (H5Pclose(dcpl2) < 0)
+ TEST_ERROR
/* Check the allocated storage is the same */
/* Check that the space allocation status is the same */
- if(H5Dget_space_status(did, &space_status) < 0) TEST_ERROR
- if(H5Dget_space_status(did2, &space_status2) < 0) TEST_ERROR
- if(space_status != space_status2) TEST_ERROR
+ if (H5Dget_space_status(did, &space_status) < 0)
+ TEST_ERROR
+ if (H5Dget_space_status(did2, &space_status2) < 0)
+ TEST_ERROR
+ if (space_status != space_status2)
+ TEST_ERROR
/* Check that the space used is the same */
/* (Don't check if the dataset is filtered (i.e. compressed, etc.) and
@@ -1000,38 +1159,47 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
* data in each dataset will (probably) be different and the storage
* size will thus vary)
*/
- if(!(nfilters > 0 && (H5Tdetect_class(tid, H5T_VLEN) ||
- (H5Tdetect_class(tid, H5T_REFERENCE) && H5Tequal(tid, H5T_STD_REF))))) {
- hsize_t storage_size = H5Dget_storage_size(did); /* Dataset's raw data storage size */
- hsize_t storage_size2 = H5Dget_storage_size(did2); /* 2nd Dataset's raw data storage size */
+ if (!(nfilters > 0 && (H5Tdetect_class(tid, H5T_VLEN) ||
+ (H5Tdetect_class(tid, H5T_REFERENCE) && H5Tequal(tid, H5T_STD_REF))))) {
+ hsize_t storage_size = H5Dget_storage_size(did); /* Dataset's raw data storage size */
+ hsize_t storage_size2 = H5Dget_storage_size(did2); /* 2nd Dataset's raw data storage size */
- if(storage_size != storage_size2) TEST_ERROR
+ if (storage_size != storage_size2)
+ TEST_ERROR
} /* end if */
/* Check the raw data is equal */
/* Allocate & initialize space for the raw data buffers */
- if((rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
- if((rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if ((rbuf = HDcalloc(elmt_size, (size_t)nelmts)) == NULL)
+ TEST_ERROR
+ if ((rbuf2 = HDcalloc(elmt_size, (size_t)nelmts)) == NULL)
+ TEST_ERROR
/* Read data from datasets */
- if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
- if(H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+ if (H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR
+ if (H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf2) < 0)
+ TEST_ERROR
/* Check raw data read in against data written out */
- if(wbuf) {
- if(!compare_data(did, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, did)) TEST_ERROR
- if(!compare_data(did2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, did2)) TEST_ERROR
+ if (wbuf) {
+ if (!compare_data(did, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, did))
+ TEST_ERROR
+ if (!compare_data(did2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, did2))
+ TEST_ERROR
} /* end if */
/* Don't have written data, just compare data between the two datasets */
- else
- if(!compare_data(did, did2, pid, tid, (size_t)nelmts, rbuf, rbuf2, did)) TEST_ERROR
+ else if (!compare_data(did, did2, pid, tid, (size_t)nelmts, rbuf, rbuf2, did))
+ TEST_ERROR
/* Reclaim vlen data, if necessary */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE || H5Tdetect_class(tid, H5T_REFERENCE) == TRUE)
- if(H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
- if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE || H5Tdetect_class(tid2, H5T_REFERENCE) == TRUE)
- if(H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+ if (H5Tdetect_class(tid, H5T_VLEN) == TRUE || H5Tdetect_class(tid, H5T_REFERENCE) == TRUE)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR
+ if (H5Tdetect_class(tid2, H5T_VLEN) == TRUE || H5Tdetect_class(tid2, H5T_REFERENCE) == TRUE)
+ if (H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0)
+ TEST_ERROR
/* Release raw data buffers */
HDfree(rbuf);
@@ -1040,30 +1208,34 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
rbuf2 = NULL;
/* close the source dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
/* close the destination dataspace */
- if(H5Sclose(sid2) < 0) TEST_ERROR
+ if (H5Sclose(sid2) < 0)
+ TEST_ERROR
/* close the source datatype */
- if(H5Tclose(tid) < 0) TEST_ERROR
+ if (H5Tclose(tid) < 0)
+ TEST_ERROR
/* close the destination datatype */
- if(H5Tclose(tid2) < 0) TEST_ERROR
-
+ if (H5Tclose(tid2) < 0)
+ TEST_ERROR
/* Check if the attributes are equal */
- if(compare_std_attributes(did, did2, pid) != TRUE) TEST_ERROR
-
+ if (compare_std_attributes(did, did2, pid) != TRUE)
+ TEST_ERROR
/* Datasets should be the same. :-) */
return TRUE;
error:
- H5E_BEGIN_TRY {
- if(rbuf)
+ H5E_BEGIN_TRY
+ {
+ if (rbuf)
HDfree(rbuf);
- if(rbuf2)
+ if (rbuf2)
HDfree(rbuf2);
H5Pclose(dcpl2);
H5Pclose(dcpl);
@@ -1071,11 +1243,11 @@ error:
H5Sclose(sid);
H5Tclose(tid2);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FALSE;
} /* end compare_datasets() */
-
/*-------------------------------------------------------------------------
* Function: compare_groups
*
@@ -1091,103 +1263,126 @@ error:
static int
compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
{
- H5G_info_t ginfo; /* Group info struct */
- H5G_info_t ginfo2; /* Group info struct */
- hsize_t idx; /* Index over the objects in group */
- unsigned cpy_flags; /* Object copy flags */
+ H5G_info_t ginfo; /* Group info struct */
+ H5G_info_t ginfo2; /* Group info struct */
+ hsize_t idx; /* Index over the objects in group */
+ unsigned cpy_flags; /* Object copy flags */
/* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
- if(pid != H5P_DEFAULT) {
- if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ if (pid != H5P_DEFAULT) {
+ if (H5Pget_copy_object(pid, &cpy_flags) < 0)
+ TEST_ERROR
} /* end if */
else
cpy_flags = 0;
/* Check if both groups have the same # of objects */
- if(H5Gget_info(gid, &ginfo) < 0) TEST_ERROR
- if(H5Gget_info(gid2, &ginfo2) < 0) TEST_ERROR
- if((cpy_flags & H5O_COPY_SHALLOW_HIERARCHY_FLAG) && depth == 0) {
- if(ginfo2.nlinks != 0) TEST_ERROR
+ if (H5Gget_info(gid, &ginfo) < 0)
+ TEST_ERROR
+ if (H5Gget_info(gid2, &ginfo2) < 0)
+ TEST_ERROR
+ if ((cpy_flags & H5O_COPY_SHALLOW_HIERARCHY_FLAG) && depth == 0) {
+ if (ginfo2.nlinks != 0)
+ TEST_ERROR
} /* end if */
else {
- if(ginfo.nlinks != ginfo2.nlinks) TEST_ERROR
+ if (ginfo.nlinks != ginfo2.nlinks)
+ TEST_ERROR
} /* end if */
/* Check contents of groups */
- if(ginfo2.nlinks > 0) {
- char objname[NAME_BUF_SIZE]; /* Name of object in group */
- char objname2[NAME_BUF_SIZE]; /* Name of object in group */
- H5L_info2_t linfo; /* Link information */
- H5L_info2_t linfo2; /* Link information */
+ if (ginfo2.nlinks > 0) {
+ char objname[NAME_BUF_SIZE]; /* Name of object in group */
+ char objname2[NAME_BUF_SIZE]; /* Name of object in group */
+ H5L_info2_t linfo; /* Link information */
+ H5L_info2_t linfo2; /* Link information */
/* Loop over contents of groups */
- for(idx = 0; idx < ginfo.nlinks; idx++) {
+ for (idx = 0; idx < ginfo.nlinks; idx++) {
/* Check name of objects */
- if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_name_by_idx(gid2, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(objname, objname2)) TEST_ERROR
+ if (H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname, (size_t)NAME_BUF_SIZE,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_name_by_idx(gid2, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname2,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(objname, objname2))
+ TEST_ERROR
/* Get link info */
- if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR
- if(linfo.type != linfo2.type) TEST_ERROR
+ if (H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (linfo.type != linfo2.type)
+ TEST_ERROR
/* Extra checks for "real" objects */
- if(linfo.type == H5L_TYPE_HARD) {
- hid_t oid, oid2; /* IDs of objects within group */
- H5O_info2_t oinfo, oinfo2; /* Data model object info */
- H5O_native_info_t ninfo, ninfo2; /* Native file format object info */
+ if (linfo.type == H5L_TYPE_HARD) {
+ hid_t oid, oid2; /* IDs of objects within group */
+ H5O_info2_t oinfo, oinfo2; /* Data model object info */
+ H5O_native_info_t ninfo, ninfo2; /* Native file format object info */
/* Compare some pieces of the object info */
/* Get data model object info */
- if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Get native object info */
- if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if(oinfo.type != oinfo2.type) TEST_ERROR
- if(oinfo.rc != oinfo2.rc) TEST_ERROR
+ if (oinfo.type != oinfo2.type)
+ TEST_ERROR
+ if (oinfo.rc != oinfo2.rc)
+ TEST_ERROR
/* If NULL messages are preserved, the number of messages
* should be the same in the destination.
* Otherwise, it should simply be true that the number
* of messages hasn't increased.
*/
- if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) {
- if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs)
+ if (H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) {
+ if (ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs)
;
- else
- if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs)
- TEST_ERROR
- }
+ else if (ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs)
+ TEST_ERROR
+ }
/* Check for object already having been compared */
- if(token_lookup(gid, &oinfo))
+ if (token_lookup(gid, &oinfo))
continue;
else
token_insert(&oinfo);
/* Open objects */
- if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((oid2 = H5Oopen(gid2, objname2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((oid2 = H5Oopen(gid2, objname2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Compare objects within group */
- switch(oinfo.type) {
+ switch (oinfo.type) {
case H5O_TYPE_GROUP:
/* Compare groups */
- if(compare_groups(oid, oid2, pid, depth - 1, copy_flags) != TRUE) TEST_ERROR
+ if (compare_groups(oid, oid2, pid, depth - 1, copy_flags) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_DATASET:
/* Compare datasets */
- if(compare_datasets(oid, oid2, pid, NULL) != TRUE) TEST_ERROR
+ if (compare_datasets(oid, oid2, pid, NULL) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_NAMED_DATATYPE:
/* Compare datatypes */
- if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR
+ if (H5Tequal(oid, oid2) != TRUE)
+ TEST_ERROR
break;
case H5O_TYPE_MAP:
@@ -1201,43 +1396,50 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
} /* end switch */
/* Close objects */
- if(H5Oclose(oid) < 0) TEST_ERROR
- if(H5Oclose(oid2) < 0) TEST_ERROR
+ if (H5Oclose(oid) < 0)
+ TEST_ERROR
+ if (H5Oclose(oid2) < 0)
+ TEST_ERROR
} /* end if */
else {
/* Check that both links are the same size */
- if(linfo.u.val_size != linfo2.u.val_size) TEST_ERROR
+ if (linfo.u.val_size != linfo2.u.val_size)
+ TEST_ERROR
/* Compare link values */
- if(linfo.type == H5L_TYPE_SOFT ||
- (linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX)) {
- char linkval[NAME_BUF_SIZE]; /* Link value */
- char linkval2[NAME_BUF_SIZE]; /* Link value */
+ if (linfo.type == H5L_TYPE_SOFT ||
+ (linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX)) {
+ char linkval[NAME_BUF_SIZE]; /* Link value */
+ char linkval2[NAME_BUF_SIZE]; /* Link value */
/* Get link values */
HDassert(linfo.u.val_size <= NAME_BUF_SIZE);
- if(H5Lget_val(gid, objname, linkval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_val(gid2, objname2, linkval2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if (H5Lget_val(gid, objname, linkval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lget_val(gid2, objname2, linkval2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Compare link data */
- if(HDmemcmp(linkval, linkval2, linfo.u.val_size)) TEST_ERROR
+ if (HDmemcmp(linkval, linkval2, linfo.u.val_size))
+ TEST_ERROR
} /* end else-if */
else {
-HDassert(0 && "Unknown type of link");
+ HDassert(0 && "Unknown type of link");
} /* end else */
- } /* end else */
- } /* end for */
- } /* end if */
+ } /* end else */
+ } /* end for */
+ } /* end if */
/* Check if the attributes are equal */
- if(compare_std_attributes(gid, gid2, pid) != TRUE) TEST_ERROR
+ if (compare_std_attributes(gid, gid2, pid) != TRUE)
+ TEST_ERROR
/* Groups should be the same. :-) */
return TRUE;
error:
- H5E_BEGIN_TRY {
- } H5E_END_TRY;
+ H5E_BEGIN_TRY {}
+ H5E_END_TRY;
return FALSE;
} /* end compare_groups() */
@@ -1255,29 +1457,29 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
- unsigned flag, hbool_t crt_intermediate_grp, const char* test_desciption)
+test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, unsigned flag,
+ hbool_t crt_intermediate_grp, const char *test_desciption)
{
- hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid=-1, gid2=-1, gid_ref=-1; /* Group IDs */
- hid_t gid_sub=-1, gid_sub_sub=-1; /* Sub-group ID */
- hid_t pid=-1, lcpl_id=-1; /* Property IDs */
- unsigned cpy_flags; /* Object copy flags */
- int depth = -1; /* Copy depth */
- hsize_t dim2d[2];
- int buf[DIM_SIZE_1][DIM_SIZE_2];
- int i, j;
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1, gid2 = -1, gid_ref = -1; /* Group IDs */
+ hid_t gid_sub = -1, gid_sub_sub = -1; /* Sub-group ID */
+ hid_t pid = -1, lcpl_id = -1; /* Property IDs */
+ unsigned cpy_flags; /* Object copy flags */
+ int depth = -1; /* Copy depth */
+ hsize_t dim2d[2];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING(test_desciption);
/* set initial data values */
- for (i=0; i<DIM_SIZE_1; i++)
- for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = 10000 + 100*i+j;
+ for (i = 0; i < DIM_SIZE_1; i++)
+ for (j = 0; j < DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100 * i + j;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -1287,233 +1489,327 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
token_reset();
/* create source file */
- if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if ((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
/* create group at the SRC file */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* attach attributes to the group */
- if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0)
+ TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
/* add a dataset to the top group */
- if((did = H5Dcreate2(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create a sub-group */
- if((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* add a dataset to the sub group */
- if((did = H5Dcreate2(gid_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* create sub-sub-group */
- if((gid_sub_sub = H5Gcreate2(gid_sub, NAME_GROUP_SUB_SUB2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid_sub_sub = H5Gcreate2(gid_sub, NAME_GROUP_SUB_SUB2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* add a dataset to the sub sub group */
- if((did = H5Dcreate2(gid_sub_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if ((did = H5Dcreate2(gid_sub_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
/* close dataset */
- if(H5Dclose(did) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
/* close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
- if(H5Gclose(gid_sub_sub) < 0) TEST_ERROR
+ if (H5Gclose(gid_sub_sub) < 0)
+ TEST_ERROR
- if(H5Gclose(gid_sub) < 0) TEST_ERROR
+ if (H5Gclose(gid_sub) < 0)
+ TEST_ERROR
/* close the group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
- if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
/* Create group to copy */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft(NAME_DATASET_SUB_SUB, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft(NAME_DATASET_SUB_SUB, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Create group to compare with */
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5L_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5L_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
} /* end if */
- if((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0) {
- char ext_filename[NAME_BUF_SIZE];
+ if ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0) {
+ char ext_filename[NAME_BUF_SIZE];
h5_fixname(FILENAME[2], src_fapl, ext_filename, sizeof ext_filename);
/* Create the external file and dataset */
- if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
- if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Fclose(fid_ext) < 0) TEST_ERROR
+ if ((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ TEST_ERROR
+ if ((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid_ext) < 0)
+ TEST_ERROR
/* Create group to copy */
- if(!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
} /* end if */
- else
- if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ else if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Create group to compare with */
- if(!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
- if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
+ if ((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
} /* end if */
- else
- if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid_src, NAME_LINK_EXTERN2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ else if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((did = H5Dcreate2(fid_src, NAME_LINK_EXTERN2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ TEST_ERROR
+ if (H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close dataspace */
- if(H5Sclose(sid) < 0) TEST_ERROR
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR
} /* end if */
- if((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
- if((gid_ref = H5Gcreate2(fid_src, NAME_GROUP_REF, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
+ if ((gid_ref = H5Gcreate2(fid_src, NAME_GROUP_REF, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create an attribute of new object references */
- if(attach_ref_attr(fid_src, gid_ref) < 0) TEST_ERROR
+ if (attach_ref_attr(fid_src, gid_ref) < 0)
+ TEST_ERROR
/* create an attribute of region references */
- if(attach_reg_ref_attr(fid_src, gid_ref) < 0) TEST_ERROR
+ if (attach_reg_ref_attr(fid_src, gid_ref) < 0)
+ TEST_ERROR
/* create a dataset of region references */
- if(create_reg_ref_dataset(fid_src, gid_ref) < 0) TEST_ERROR
+ if (create_reg_ref_dataset(fid_src, gid_ref) < 0)
+ TEST_ERROR
/* Close group holding reference objects */
- if(H5Gclose(gid_ref) < 0) TEST_ERROR
+ if (H5Gclose(gid_ref) < 0)
+ TEST_ERROR
} /* end if */
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* open the source file with read-only */
/* (except when expanding soft links */
- if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0) TEST_ERROR
+ if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0)
+ TEST_ERROR
} /* end if */
- else
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+ else if ((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ TEST_ERROR
/* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+ if ((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ TEST_ERROR
/* Create an uncopied object in destination file so that tokens in source and destination
files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* create property to pass copy options */
- if((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
+ if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ TEST_ERROR
/* set options for object copy */
- if(H5Pset_copy_object(pid, flag) < 0) TEST_ERROR
+ if (H5Pset_copy_object(pid, flag) < 0)
+ TEST_ERROR
/* Verify object copy flags */
- if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
- if(cpy_flags != flag) TEST_ERROR
+ if (H5Pget_copy_object(pid, &cpy_flags) < 0)
+ TEST_ERROR
+ if (cpy_flags != flag)
+ TEST_ERROR
/* copy the group from SRC to DST */
- if(crt_intermediate_grp) {
+ if (crt_intermediate_grp) {
/* Create link creation plist to pass in intermediate group creation */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
+ TEST_ERROR
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0) TEST_ERROR
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0)
+ TEST_ERROR
- if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+ if (H5Pclose(lcpl_id) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, "/new_g0/new_g00", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- } else if(((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
- || ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0)) {
- if(H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, "/new_g0/new_g00", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else if (((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) || ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0)) {
+ if (H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
- if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
+ if ((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
/* Unlink dataset to copy from original location */
/* (So group comparison works properly) */
- if(H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- } else if(flag & (H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG)) {
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else if (flag & (H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG)) {
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- } else if(flag & H5O_COPY_SHALLOW_HIERARCHY_FLAG) {
- if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else if (flag & H5O_COPY_SHALLOW_HIERARCHY_FLAG) {
+ if (H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Set the copy depth */
depth = 1;
- } else if((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
- if(H5Ocopy(fid_src, NAME_GROUP_REF, fid_dst, NAME_GROUP_REF, pid, H5P_DEFAULT) < 0) TEST_ERROR
+ }
+ else if ((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
+ if (H5Ocopy(fid_src, NAME_GROUP_REF, fid_dst, NAME_GROUP_REF, pid, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_REF, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid_src, NAME_GROUP_REF, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_REF, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- } else {
+ if ((gid2 = H5Gopen2(fid_dst, NAME_GROUP_REF, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else {
/* Unknown flag */
TEST_ERROR
} /* end else */
/* Check if the groups are equal */
- if(compare_groups(gid, gid2, pid, depth, flag) != TRUE) TEST_ERROR
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (compare_groups(gid, gid2, pid, depth, flag) != TRUE)
+ TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0)
+ TEST_ERROR
/* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_dst) < 0)
+ TEST_ERROR
/* close properties */
- if(H5Pclose(pid) < 0) TEST_ERROR
+ if (H5Pclose(pid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(lcpl_id);
H5Pclose(pid);
H5Sclose(sid);
@@ -1525,7 +1821,8 @@ error:
H5Fclose(fid_dst);
H5Fclose(fid_src);
H5Fclose(fid_ext);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_copy_option */
@@ -1548,12 +1845,12 @@ error:
int
main(void)
{
- int nerrors = 0;
+ int nerrors = 0;
hid_t fapl, fapl2;
- hid_t fcpl_shared, ocpl;
- unsigned max_compact, min_dense;
- int configuration; /* Configuration of tests. */
- int ExpressMode;
+ hid_t fcpl_shared, ocpl;
+ unsigned max_compact, min_dense;
+ int configuration; /* Configuration of tests. */
+ int ExpressMode;
/* Setup */
h5_reset();
@@ -1564,39 +1861,47 @@ main(void)
HDprintf("***Express test mode on. Some tests may be skipped\n");
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
/* Create an FCPL with sharing enabled */
- if((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
- if(H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0) TEST_ERROR
- if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, 10) < 0) TEST_ERROR
+ if ((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0)
+ TEST_ERROR
+ if (H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, 10) < 0)
+ TEST_ERROR
/* Obtain the default attribute storage phase change values */
- if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) TEST_ERROR
- if(H5Pget_attr_phase_change(ocpl, &max_compact, &min_dense) < 0) TEST_ERROR
- if(H5Pclose(ocpl) < 0) TEST_ERROR
+ if ((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pget_attr_phase_change(ocpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
+ if (H5Pclose(ocpl) < 0)
+ TEST_ERROR
/* Test in all configurations */
- for(configuration = 0; configuration <= MAX_CONFIGURATION; configuration++) {
+ for (configuration = 0; configuration <= MAX_CONFIGURATION; configuration++) {
hid_t src_fapl;
hid_t dst_fapl;
hid_t fcpl_src;
hid_t fcpl_dst;
/* No need to test dense attributes with old format */
- if(!(configuration & CONFIG_SRC_NEW_FORMAT) && (configuration & CONFIG_DENSE))
+ if (!(configuration & CONFIG_SRC_NEW_FORMAT) && (configuration & CONFIG_DENSE))
continue;
/* TODO Region references currently do not support copy from new format to old format
* (this may be fixed once H5Sencode/decode and H5CXis fixed) */
- if((configuration & CONFIG_SRC_NEW_FORMAT) && !(configuration & CONFIG_DST_NEW_FORMAT))
+ if ((configuration & CONFIG_SRC_NEW_FORMAT) && !(configuration & CONFIG_DST_NEW_FORMAT))
continue;
/* Test with and without shared messages */
- if(configuration & CONFIG_SHARE_SRC) {
+ if (configuration & CONFIG_SHARE_SRC) {
HDputs("\nTesting with shared src messages:");
fcpl_src = fcpl_shared;
}
@@ -1604,7 +1909,7 @@ main(void)
HDputs("\nTesting without shared src messages:");
fcpl_src = H5P_DEFAULT;
}
- if(configuration & CONFIG_SHARE_DST) {
+ if (configuration & CONFIG_SHARE_DST) {
HDputs("Testing with shared dst messages:");
fcpl_dst = fcpl_shared;
}
@@ -1614,12 +1919,12 @@ main(void)
}
/* Set the FAPL for the source file's type of format */
- if(configuration & CONFIG_SRC_NEW_FORMAT) {
+ if (configuration & CONFIG_SRC_NEW_FORMAT) {
HDputs("Testing with latest format for source file:");
src_fapl = fapl2;
/* Test with and without dense attributes */
- if(configuration & CONFIG_DENSE) {
+ if (configuration & CONFIG_DENSE) {
HDputs("Testing with dense attributes:");
num_attributes_g = max_compact + 1;
}
@@ -1630,12 +1935,12 @@ main(void)
} /* end if */
else {
HDputs("Testing with oldest file format for source file:");
- src_fapl = fapl;
+ src_fapl = fapl;
num_attributes_g = 4;
} /* end else */
/* Set the FAPL for the destination file's type of format */
- if(configuration & CONFIG_DST_NEW_FORMAT) {
+ if (configuration & CONFIG_DST_NEW_FORMAT) {
HDputs("Testing with latest format for destination file:");
dst_fapl = fapl2;
} /* end if */
@@ -1645,9 +1950,8 @@ main(void)
} /* end else */
/* The tests... */
- nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
- H5O_COPY_EXPAND_REFERENCE_FLAG,
- FALSE, "H5Ocopy(): expand object reference");
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG,
+ FALSE, "H5Ocopy(): expand object reference");
} /* end for */
/* Reset file token checking info */
@@ -1657,13 +1961,12 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
/* Results */
- if(nerrors) {
- HDprintf("***** %d OBJECT COPY TEST%s FAILED! *****\n",
- nerrors, (1 == nerrors ? "" : "S"));
+ if (nerrors) {
+ HDprintf("***** %d OBJECT COPY TEST%s FAILED! *****\n", nerrors, (1 == nerrors ? "" : "S"));
HDexit(EXIT_FAILURE);
} /* end if */
- HDputs ("All object copying tests passed.");
+ HDputs("All object copying tests passed.");
/* close property list.
* NOTE: if this property list is not closed and the test is
@@ -1695,4 +1998,3 @@ main(void)
error:
HDexit(EXIT_FAILURE);
} /* main */
-
diff --git a/test/ohdr.c b/test/ohdr.c
index e5ba215..14d021b 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -16,30 +16,25 @@
*/
#include "h5test.h"
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Iprivate.h" /* Identifiers */
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Iprivate.h" /* Identifiers */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/*
* This file needs to access private datatypes from the H5O package.
* This file also needs to access the object header testing code.
*/
-#define H5O_FRIEND /* suppress error about including H5Opkg */
+#define H5O_FRIEND /* suppress error about including H5Opkg */
#define H5O_TESTING
#include "H5Opkg.h"
/*
* This file needs to access private datatypes from the H5G package.
*/
-#define H5G_FRIEND /* suppress error about including H5Gpkg */
+#define H5G_FRIEND /* suppress error about including H5Gpkg */
#include "H5Gpkg.h"
-const char *FILENAME[] = {
- "ohdr",
- "ohdr_min_a",
- "ohdr_min_b",
- NULL
-};
+const char *FILENAME[] = {"ohdr", "ohdr_min_a", "ohdr_min_b", NULL};
/* used for object header size comparison */
#define EQ 1
@@ -50,12 +45,12 @@ const char *FILENAME[] = {
* To get this data file, define H5O_ENABLE_BOGUS in src/H5Oprivate, rebuild
* the library and simply compile gen_bogus.c with that HDF5 library and run it.
*/
-#define FILE_BOGUS "tbogus.h5"
-#define TESTFILE_LEN 256
+#define FILE_BOGUS "tbogus.h5"
+#define TESTFILE_LEN 256
/* */
-#define FILE_OHDR_SWMR "ohdr_swmr.h5"
-#define DSET_NAME "COMPACT_DSET"
+#define FILE_OHDR_SWMR "ohdr_swmr.h5"
+#define DSET_NAME "COMPACT_DSET"
#define OBJ_VERSION_LATEST 2
/*
@@ -70,14 +65,14 @@ const char *FILENAME[] = {
static herr_t
test_cont(char *filename, hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f = NULL;
+ hid_t file = -1;
+ H5F_t * f = NULL;
H5O_hdr_info_t hdr_info;
- H5O_loc_t oh_locA, oh_locB;
- time_t time_new;
- const char *short_name = "T";
- const char *long_name = "This is the message";
- size_t nchunks;
+ H5O_loc_t oh_locA, oh_locB;
+ time_t time_new;
+ const char * short_name = "T";
+ const char * long_name = "This is the message";
+ size_t nchunks;
TESTING("object header continuation block");
@@ -85,9 +80,9 @@ test_cont(char *filename, hid_t fapl)
HDmemset(&oh_locB, 0, sizeof(oh_locB));
/* Create the file to operate on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
if (H5AC_ignore_tags(f) < 0) {
H5_FAILED();
@@ -95,65 +90,65 @@ test_cont(char *filename, hid_t fapl)
goto error;
} /* end if */
- if(H5O_create(f, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0)
- FAIL_STACK_ERROR
+ if (H5O_create(f, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA /*out*/) < 0)
+ FAIL_STACK_ERROR
- if(H5O_create(f, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0)
- FAIL_STACK_ERROR
+ if (H5O_create(f, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locB /*out*/) < 0)
+ FAIL_STACK_ERROR
time_new = 11111111;
- if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name) < 0)
+ if (H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
+ if (H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
+ if (H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
+ if (H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
+ if (H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
+ if (H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name) < 0)
+ if (H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name) < 0)
FAIL_STACK_ERROR
- if(1 != H5O_link(&oh_locA, 1))
+ if (1 != H5O_link(&oh_locA, 1))
FAIL_STACK_ERROR
- if(1 != H5O_link(&oh_locB, 1))
+ if (1 != H5O_link(&oh_locB, 1))
FAIL_STACK_ERROR
- if(H5AC_prep_for_file_flush(f) < 0)
+ if (H5AC_prep_for_file_flush(f) < 0)
FAIL_STACK_ERROR
- if(H5AC_flush(f) < 0)
+ if (H5AC_flush(f) < 0)
FAIL_STACK_ERROR
- if(H5AC_secure_from_file_flush(f) < 0)
+ if (H5AC_secure_from_file_flush(f) < 0)
FAIL_STACK_ERROR
- if(H5O__expunge_chunks_test(&oh_locA) < 0)
+ if (H5O__expunge_chunks_test(&oh_locA) < 0)
FAIL_STACK_ERROR
- if(H5O_get_hdr_info(&oh_locA, &hdr_info) < 0)
+ if (H5O_get_hdr_info(&oh_locA, &hdr_info) < 0)
FAIL_STACK_ERROR
nchunks = hdr_info.nchunks;
/* remove the 1st H5O_NAME_ID message */
- if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE) < 0)
+ if (H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE) < 0)
FAIL_STACK_ERROR
- if(H5O_get_hdr_info(&oh_locA, &hdr_info) < 0)
+ if (H5O_get_hdr_info(&oh_locA, &hdr_info) < 0)
FAIL_STACK_ERROR
- if(hdr_info.nchunks >= nchunks)
+ if (hdr_info.nchunks >= nchunks)
TEST_ERROR
- if(H5O_close(&oh_locA, NULL) < 0)
+ if (H5O_close(&oh_locA, NULL) < 0)
FAIL_STACK_ERROR
- if(H5O_close(&oh_locB, NULL) < 0)
+ if (H5O_close(&oh_locB, NULL) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -161,11 +156,13 @@ test_cont(char *filename, hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5O_close(&oh_locA, NULL);
H5O_close(&oh_locB, NULL);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_cont() */
@@ -181,90 +178,90 @@ error:
static herr_t
test_ohdr_cache(char *filename, hid_t fapl)
{
- hid_t file = -1; /* File ID */
- hid_t my_fapl; /* FAPL ID */
- H5AC_cache_config_t mdc_config; /* Metadata cache configuration info */
- H5F_t *f = NULL; /* File handle */
- H5HL_t *lheap, *lheap2, *lheap3; /* Pointer to local heaps */
- haddr_t lheap_addr, lheap_addr2, lheap_addr3; /* Local heap addresses */
- H5O_loc_t oh_loc; /* Object header location */
- time_t time_new; /* Time value for modification time message */
- unsigned rc; /* Refcount for object */
+ hid_t file = -1; /* File ID */
+ hid_t my_fapl; /* FAPL ID */
+ H5AC_cache_config_t mdc_config; /* Metadata cache configuration info */
+ H5F_t * f = NULL; /* File handle */
+ H5HL_t * lheap, *lheap2, *lheap3; /* Pointer to local heaps */
+ haddr_t lheap_addr, lheap_addr2, lheap_addr3; /* Local heap addresses */
+ H5O_loc_t oh_loc; /* Object header location */
+ time_t time_new; /* Time value for modification time message */
+ unsigned rc; /* Refcount for object */
TESTING("object header creation in cache");
/* Make a copy of the FAPL */
- if((my_fapl = H5Pcopy(fapl)) < 0)
+ if ((my_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
/* Tweak down the size of the metadata cache to only 64K */
mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- if(H5Pget_mdc_config(my_fapl, &mdc_config) < 0)
+ if (H5Pget_mdc_config(my_fapl, &mdc_config) < 0)
FAIL_STACK_ERROR
mdc_config.set_initial_size = TRUE;
- mdc_config.initial_size = 32 * 1024;
- mdc_config.max_size = 64 * 1024;
- mdc_config.min_size = 8 * 1024;
- if(H5Pset_mdc_config(my_fapl, &mdc_config) < 0)
+ mdc_config.initial_size = 32 * 1024;
+ mdc_config.max_size = 64 * 1024;
+ mdc_config.min_size = 8 * 1024;
+ if (H5Pset_mdc_config(my_fapl, &mdc_config) < 0)
FAIL_STACK_ERROR
/* Create the file to operate on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(my_fapl) < 0)
+ if (H5Pclose(my_fapl) < 0)
FAIL_STACK_ERROR
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
- if(H5AC_ignore_tags(f) < 0)
+ if (H5AC_ignore_tags(f) < 0)
FAIL_STACK_ERROR
/* Create object (local heap) that occupies most of cache */
- if(H5HL_create(f, (31 * 1024), &lheap_addr) < 0)
+ if (H5HL_create(f, (31 * 1024), &lheap_addr) < 0)
FAIL_STACK_ERROR
/* Protect local heap (which actually pins it in the cache) */
- if(NULL == (lheap = H5HL_protect(f, lheap_addr, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (lheap = H5HL_protect(f, lheap_addr, H5AC__READ_ONLY_FLAG)))
FAIL_STACK_ERROR
/* Create an object header */
HDmemset(&oh_loc, 0, sizeof(oh_loc));
- if(H5O_create(f, (size_t)2048, (size_t)1, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0)
+ if (H5O_create(f, (size_t)2048, (size_t)1, H5P_GROUP_CREATE_DEFAULT, &oh_loc /*out*/) < 0)
FAIL_STACK_ERROR
/* Query object header information */
rc = 0;
- if(H5O__get_rc_test(&oh_loc, &rc) < 0)
+ if (H5O__get_rc_test(&oh_loc, &rc) < 0)
FAIL_STACK_ERROR
- if(0 != rc)
+ if (0 != rc)
TEST_ERROR
/* Create object (local heap) that occupies most of cache */
- if(H5HL_create(f, (31 * 1024), &lheap_addr2) < 0)
+ if (H5HL_create(f, (31 * 1024), &lheap_addr2) < 0)
FAIL_STACK_ERROR
/* Protect local heap (which actually pins it in the cache) */
- if(NULL == (lheap2 = H5HL_protect(f, lheap_addr2, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (lheap2 = H5HL_protect(f, lheap_addr2, H5AC__READ_ONLY_FLAG)))
FAIL_STACK_ERROR
/* Unprotect local heap (which actually unpins it from the cache) */
- if(H5HL_unprotect(lheap2) < 0)
+ if (H5HL_unprotect(lheap2) < 0)
FAIL_STACK_ERROR
/* Create object header message in new object header */
time_new = 11111111;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
+ if (H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
/* Create object (local heap) that occupies most of cache */
- if(H5HL_create(f, (31 * 1024), &lheap_addr3) < 0)
+ if (H5HL_create(f, (31 * 1024), &lheap_addr3) < 0)
FAIL_STACK_ERROR
/* Protect local heap (which actually pins it in the cache) */
- if(NULL == (lheap3 = H5HL_protect(f, lheap_addr3, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (lheap3 = H5HL_protect(f, lheap_addr3, H5AC__READ_ONLY_FLAG)))
FAIL_STACK_ERROR
/* Unprotect local heap (which actually unpins it from the cache) */
- if(H5HL_unprotect(lheap3) < 0)
+ if (H5HL_unprotect(lheap3) < 0)
FAIL_STACK_ERROR
/* Query object header information */
@@ -274,24 +271,24 @@ test_ohdr_cache(char *filename, hid_t fapl)
* a non-invasive way -QAK)
*/
rc = 0;
- if(H5O__get_rc_test(&oh_loc, &rc) < 0)
+ if (H5O__get_rc_test(&oh_loc, &rc) < 0)
FAIL_STACK_ERROR
- if(0 != rc)
+ if (0 != rc)
TEST_ERROR
/* Decrement reference count o object header */
- if(H5O_dec_rc_by_loc(&oh_loc) < 0)
+ if (H5O_dec_rc_by_loc(&oh_loc) < 0)
FAIL_STACK_ERROR
/* Close object header created */
- if(H5O_close(&oh_loc, NULL) < 0)
+ if (H5O_close(&oh_loc, NULL) < 0)
FAIL_STACK_ERROR
/* Unprotect local heap (which actually unpins it from the cache) */
- if(H5HL_unprotect(lheap) < 0)
+ if (H5HL_unprotect(lheap) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -299,9 +296,8 @@ test_ohdr_cache(char *filename, hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
return FAIL;
} /* test_ohdr_cache() */
@@ -316,120 +312,122 @@ error:
static herr_t
test_ohdr_swmr(hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t plist = -1; /* Dataset creation property list */
- size_t compact_size = 1024; /* The size of compact dataset */
- int *wbuf = NULL; /* Buffer for writing */
- hsize_t dims[1]; /* Dimension sizes */
- size_t u; /* Iterator */
- int n; /* Data variable */
- H5O_native_info_t ninfo; /* Information for the object */
-
- if(new_format) {
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t plist = -1; /* Dataset creation property list */
+ size_t compact_size = 1024; /* The size of compact dataset */
+ int * wbuf = NULL; /* Buffer for writing */
+ hsize_t dims[1]; /* Dimension sizes */
+ size_t u; /* Iterator */
+ int n; /* Data variable */
+ H5O_native_info_t ninfo; /* Information for the object */
+
+ if (new_format) {
TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format");
- } else {
- TESTING("exercise the coding for the re-read of the object header for SWMR access: non-latest-format");
+ }
+ else {
+ TESTING(
+ "exercise the coding for the re-read of the object header for SWMR access: non-latest-format");
} /* end if */
/* File access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Create the file with/without latest format: ensure version 2 object header for SWMR */
- if(new_format) {
+ if (new_format) {
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
- if((fid = H5Fcreate(FILE_OHDR_SWMR, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILE_OHDR_SWMR, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
} /* end if */
else {
- if((fid = H5Fcreate(FILE_OHDR_SWMR, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILE_OHDR_SWMR, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
} /* end else */
/* Initialize data */
wbuf = (int *)HDcalloc(compact_size, sizeof(int));
- n = 0;
- for(u = 0; u < compact_size; u++)
+ n = 0;
+ for (u = 0; u < compact_size; u++)
wbuf[u] = n++;
/* Create a small data space for compact dataset */
dims[0] = (hsize_t)compact_size;
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
FAIL_STACK_ERROR
/* Create property list for compact dataset creation */
- if((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
/* Set the layout for the compact dataset */
- if(H5Pset_layout(plist, H5D_COMPACT) < 0)
+ if (H5Pset_layout(plist, H5D_COMPACT) < 0)
FAIL_STACK_ERROR
/* Create a compact dataset */
- if((did = H5Dcreate2(fid, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write to the compact dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Open the file for SWMR write with/without latest format */
- if((fid = H5Fopen(FILE_OHDR_SWMR, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(FILE_OHDR_SWMR, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the compact dataset */
- if((did = H5Dopen2(fid, DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_NAME, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get the object information */
- if(H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR) < 0)
+ if (H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR) < 0)
FAIL_STACK_ERROR
- if(new_format)
- if(ninfo.hdr.version != OBJ_VERSION_LATEST)
+ if (new_format)
+ if (ninfo.hdr.version != OBJ_VERSION_LATEST)
FAIL_STACK_ERROR
/* The size of object header should be greater than the speculative read size of H5O_SPEC_READ_SIZE */
/* This will exercise the coding for the re-read of the object header for SWMR access */
- if(ninfo.hdr.space.total < H5O_SPEC_READ_SIZE)
+ if (ninfo.hdr.space.total < H5O_SPEC_READ_SIZE)
TEST_ERROR;
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
/* Close the dataset creation property list */
- if(H5Pclose(plist) < 0)
+ if (H5Pclose(plist) < 0)
FAIL_STACK_ERROR
/* Close the file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Remove the test file */
- if(HDremove(FILE_OHDR_SWMR) < 0)
+ if (HDremove(FILE_OHDR_SWMR) < 0)
FAIL_STACK_ERROR
/* Free the buffer */
@@ -440,7 +438,8 @@ test_ohdr_swmr(hbool_t new_format)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Dclose(did);
H5Sclose(sid);
@@ -448,7 +447,8 @@ error:
H5Pclose(fapl);
HDremove(FILE_OHDR_SWMR);
HDfree(wbuf);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* test_ohdr_swmr() */
@@ -469,59 +469,59 @@ error:
static herr_t
test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
{
- hid_t fid = -1; /* file ID */
- hid_t gid = -1; /* group ID */
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t loc = -1; /* location: file or group ID */
- hid_t fid_bogus = -1; /* bogus file ID */
- hid_t gid_bogus = -1; /* bogus group ID */
- hid_t loc_bogus = -1; /* location: bogus file or group ID */
- char testfile[TESTFILE_LEN];
+ hid_t fid = -1; /* file ID */
+ hid_t gid = -1; /* group ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t loc = -1; /* location: file or group ID */
+ hid_t fid_bogus = -1; /* bogus file ID */
+ hid_t gid_bogus = -1; /* bogus group ID */
+ hid_t loc_bogus = -1; /* location: bogus file or group ID */
+ char testfile[TESTFILE_LEN];
/* create a different name for a local copy of the data file to be
opened with rd/wr file permissions in case build and test are
done in the source directory. */
HDstrncpy(testfile, FILE_BOGUS, TESTFILE_LEN);
- testfile[TESTFILE_LEN - 1]='\0';
+ testfile[TESTFILE_LEN - 1] = '\0';
HDstrncat(testfile, ".copy", 5);
/* Make a copy of the data file from svn. */
- if(h5_make_local_copy(FILE_BOGUS, testfile) < 0)
- FAIL_STACK_ERROR
+ if (h5_make_local_copy(FILE_BOGUS, testfile) < 0)
+ FAIL_STACK_ERROR
TESTING("object with unknown header message and no flags set");
/* Open filename */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Open FILE_BOGUS */
- if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Set up location ID depending on bogus_id */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ if (bogus_id == H5O_BOGUS_INVALID_ID) {
/* Open "group" in FILE_BOGUS */
- if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
+ if ((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
loc_bogus = gid_bogus;
/* Create "group" in filename */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
loc = gid;
-
- } else { /* H5O_BOGUS_VALID_ID */
+ }
+ else { /* H5O_BOGUS_VALID_ID */
loc_bogus = fid_bogus;
- loc = fid;
+ loc = fid;
} /* end else */
- /* Open the dataset with the unknown header message, but no extra flags */
- if((did = H5Dopen2(loc_bogus, "Dataset1", H5P_DEFAULT)) < 0)
+ /* Open the dataset with the unknown header message, but no extra flags */
+ if ((did = H5Dopen2(loc_bogus, "Dataset1", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -529,9 +529,9 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
TESTING("object with unknown header message & 'shareable' flag set");
/* Open the dataset with the unknown header message, adn "shareable" flag */
- if((did = H5Dopen2(loc_bogus, "Dataset5", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_bogus, "Dataset5", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -539,9 +539,9 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
TESTING("object in r/o file with unknown header message & 'fail if unknown and open for write' flag set");
/* Open the dataset with the unknown header message, and "fail if unknown and open for write" flag */
- if((did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -549,10 +549,9 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
TESTING("object in r/o file with unknown header message & 'fail if unknown always' flag set");
/* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */
- H5E_BEGIN_TRY {
- did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT);
- } H5E_END_TRY;
- if(did >= 0) {
+ H5E_BEGIN_TRY { did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (did >= 0) {
H5Dclose(did);
TEST_ERROR
} /* end if */
@@ -562,157 +561,161 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
TESTING("object with unknown header message & 'mark if unknown' flag set");
/* Copy object with "mark if unknown" flag on message into file (FILENAME[0]) that can be modified */
- if(H5Ocopy(loc_bogus, "Dataset4", loc, "Dataset4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Ocopy(loc_bogus, "Dataset4", loc, "Dataset4", H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Closing: filename */
- if(bogus_id == H5O_BOGUS_INVALID_ID)
- if(H5Gclose(gid) < 0)
+ if (bogus_id == H5O_BOGUS_INVALID_ID)
+ if (H5Gclose(gid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Re-open filename, with read-only permissions */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Set up location ID depending on bogus_id */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ if (bogus_id == H5O_BOGUS_INVALID_ID) {
/* Open "group" in filename */
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
loc = gid;
- } else
+ }
+ else
loc = fid;
/* Open the dataset with the "mark if unknown" message */
- if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Check that the "unknown" message was _NOT_ marked */
- if(H5O__check_msg_marked_test(did, FALSE) < 0)
+ if (H5O__check_msg_marked_test(did, FALSE) < 0)
FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Close "group" in filename depending on bogus_id */
- if(bogus_id == H5O_BOGUS_INVALID_ID)
- if(H5Gclose(gid) < 0)
+ if (bogus_id == H5O_BOGUS_INVALID_ID)
+ if (H5Gclose(gid) < 0)
FAIL_STACK_ERROR
/* Close filename (to flush change to object header) */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Re-open filename */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Set up location ID depending on bogus_id */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ if (bogus_id == H5O_BOGUS_INVALID_ID) {
/* Open "group" in filename */
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
loc = gid;
- } else
+ }
+ else
loc = fid;
/* Open the dataset with the "mark if unknown" message */
- if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create data space */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
FAIL_STACK_ERROR
/* Create an attribute, to get the object header into write access */
- if((aid = H5Acreate2(did, "Attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "Attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
/* Close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Close "group" in filename depending on bogus_id */
- if(bogus_id == H5O_BOGUS_INVALID_ID)
- if(H5Gclose(gid) < 0)
+ if (bogus_id == H5O_BOGUS_INVALID_ID)
+ if (H5Gclose(gid) < 0)
FAIL_STACK_ERROR
/* Close filename (to flush change to object header) */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Re-open filename */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Set up location ID depending on bogus_id */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ if (bogus_id == H5O_BOGUS_INVALID_ID) {
/* Open "group" in filename */
- if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
loc = gid;
- } else
+ }
+ else
loc = fid;
/* Re-open the dataset with the "mark if unknown" message */
- if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Check that the "unknown" message was marked */
- if(H5O__check_msg_marked_test(did, TRUE) < 0)
+ if (H5O__check_msg_marked_test(did, TRUE) < 0)
FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Closing: filename */
- if(bogus_id == H5O_BOGUS_INVALID_ID)
- if(H5Gclose(gid) < 0)
+ if (bogus_id == H5O_BOGUS_INVALID_ID)
+ if (H5Gclose(gid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
PASSED();
/* Closing: FILE_BOGUS */
- if(bogus_id == H5O_BOGUS_INVALID_ID)
- if(H5Gclose(gid_bogus) < 0)
+ if (bogus_id == H5O_BOGUS_INVALID_ID)
+ if (H5Gclose(gid_bogus) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid_bogus) < 0)
+ if (H5Fclose(fid_bogus) < 0)
FAIL_STACK_ERROR
TESTING("object in r/w file with unknown header message & 'fail if unknown and open for write' flag set");
/* Open FILE_BOGUS with RW intent this time */
- if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid_bogus = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Set up location ID */
- if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ if (bogus_id == H5O_BOGUS_INVALID_ID) {
/* Open "group" in FILE_BOGUS */
- if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
+ if ((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
loc_bogus = gid_bogus;
- } else
+ }
+ else
loc_bogus = fid_bogus;
- /* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write" flag */
- H5E_BEGIN_TRY {
- did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT);
- } H5E_END_TRY;
- if(did >= 0) {
+ /* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write"
+ * flag */
+ H5E_BEGIN_TRY { did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (did >= 0) {
H5Dclose(did);
TEST_ERROR
} /* end if */
@@ -722,19 +725,18 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
TESTING("object in r/w file with unknown header message & 'fail if unknown always' flag set");
/* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */
- H5E_BEGIN_TRY {
- did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT);
- } H5E_END_TRY;
- if(did >= 0) {
+ H5E_BEGIN_TRY { did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (did >= 0) {
H5Dclose(did);
TEST_ERROR
} /* end if */
/* Closing: FILE_BOGUS */
- if(bogus_id == H5O_BOGUS_INVALID_ID)
- if(H5Gclose(gid_bogus) < 0)
+ if (bogus_id == H5O_BOGUS_INVALID_ID)
+ if (H5Gclose(gid_bogus) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid_bogus) < 0)
+ if (H5Fclose(fid_bogus) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -742,7 +744,8 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Gclose(gid);
H5Fclose(fid_bogus);
@@ -750,7 +753,8 @@ error:
H5Dclose(did);
H5Sclose(sid);
H5Aclose(aid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* test_unknown() */
@@ -764,7 +768,7 @@ count_attributes(hid_t dset_id)
{
H5O_info2_t info;
- if(H5Oget_info3(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5Oget_info3(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0)
return -1;
else
return (int)info.num_attrs; /* should never exceed int bounds */
@@ -780,7 +784,7 @@ _oh_getsize(hid_t did, hsize_t *size_out)
{
H5O_native_info_t ninfo;
- if(FAIL == H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR))
+ if (FAIL == H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR))
return FAIL;
*size_out = ninfo.hdr.space.total;
@@ -799,14 +803,14 @@ oh_compare(hid_t did1, hid_t did2)
hsize_t space1 = 0;
hsize_t space2 = 0;
- if(FAIL == _oh_getsize(did1, &space1))
+ if (FAIL == _oh_getsize(did1, &space1))
return -1;
- if(FAIL == _oh_getsize(did2, &space2))
+ if (FAIL == _oh_getsize(did2, &space2))
return -2;
- if(space1 < space2)
+ if (space1 < space2)
return LT;
- else if(space1 > space2)
+ else if (space1 > space2)
return GT;
else
return EQ;
@@ -817,55 +821,56 @@ oh_compare(hid_t did1, hid_t did2)
* Conduct additions side-by-side with a standard datataset and one with
* minimized dataset object headers.
*/
-#define ATTR_NAME_MAX 64
-#define ATTR_SHORT "first"
-#define ATTR_LONG "second"
-#define N_ATTRS 64
+#define ATTR_NAME_MAX 64
+#define ATTR_SHORT "first"
+#define ATTR_LONG "second"
+#define N_ATTRS 64
static herr_t
test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id)
{
- hsize_t dims[1] = {0}; /* dataspace extent */
- char filename[512] = "";
+ hsize_t dims[1] = {0}; /* dataspace extent */
+ char filename[512] = "";
char attr_name[ATTR_NAME_MAX] = "";
- hid_t fid = H5I_INVALID_HID;
- hid_t dcpl_id = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t aid = H5I_INVALID_HID;
- char *in_buf = NULL;
- char *out_buf = NULL;
- size_t buf_size = 0;
- int out_val = 0;
- int in_val = 0;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t aid = H5I_INVALID_HID;
+ char * in_buf = NULL;
+ char * out_buf = NULL;
+ size_t buf_size = 0;
+ int out_val = 0;
+ int in_val = 0;
int i;
TESTING("adding attributes to datasets created with H5Pset_dset_no_attrs_hint()")
/* Create the test file */
- if(NULL == h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)))
+ if (NULL == h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)))
TEST_ERROR;
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID)
TEST_ERROR;
/* Set the 'no attrs' hint on the dcpl */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) == H5I_INVALID_HID)
TEST_ERROR;
- if(H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) < 0)
+ if (H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) < 0)
TEST_ERROR;
/* The dataset doesn't need to contain data */
dims[0] = 0;
- if((sid = H5Screate_simple(1, dims, NULL)) == H5I_INVALID_HID)
+ if ((sid = H5Screate_simple(1, dims, NULL)) == H5I_INVALID_HID)
TEST_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, "H5Pset_dset_no_attrs_hint", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) == H5I_INVALID_HID)
+ if ((did = H5Dcreate2(fid, "H5Pset_dset_no_attrs_hint", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id,
+ H5P_DEFAULT)) == H5I_INVALID_HID)
TEST_ERROR;
/* Close */
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
TEST_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
/**********************************************
@@ -873,9 +878,9 @@ test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id)
**********************************************/
buf_size = HDstrlen(ATTR_LONG) + 1;
- if(NULL == (in_buf = (char *)HDcalloc(buf_size, sizeof(char))))
+ if (NULL == (in_buf = (char *)HDcalloc(buf_size, sizeof(char))))
TEST_ERROR;
- if(NULL == (out_buf = (char *)HDcalloc(buf_size, sizeof(char))))
+ if (NULL == (out_buf = (char *)HDcalloc(buf_size, sizeof(char))))
TEST_ERROR;
/* Create a string attribute on the dataset
@@ -884,93 +889,95 @@ test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id)
* to it.
*/
dims[0] = buf_size;
- if((sid = H5Screate_simple(1, dims, NULL)) == H5I_INVALID_HID)
+ if ((sid = H5Screate_simple(1, dims, NULL)) == H5I_INVALID_HID)
TEST_ERROR;
- if((aid = H5Acreate2(did, "string_attr", H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID)
+ if ((aid = H5Acreate2(did, "string_attr", H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) ==
+ H5I_INVALID_HID)
TEST_ERROR;
/* Write attribute data */
HDstrcpy(in_buf, ATTR_SHORT);
- if(H5Awrite(aid, H5T_NATIVE_CHAR, in_buf) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_CHAR, in_buf) < 0)
TEST_ERROR;
/* Make sure the count is correct */
- if(count_attributes(did) != 1)
+ if (count_attributes(did) != 1)
TEST_ERROR;
/* Read the data back and verify */
- if(H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0)
+ if (H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0)
TEST_ERROR;
- if(HDstrcmp(in_buf, out_buf))
+ if (HDstrcmp(in_buf, out_buf))
TEST_ERROR;
/* modify the string attribute */
HDmemset(in_buf, 0, buf_size);
HDstrcpy(in_buf, ATTR_LONG);
- if(H5Awrite(aid, H5T_NATIVE_CHAR, in_buf) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_CHAR, in_buf) < 0)
TEST_ERROR;
- if(count_attributes(did) != 1)
+ if (count_attributes(did) != 1)
TEST_ERROR;
/* Read the data back and verify */
- if(H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0)
+ if (H5Aread(aid, H5T_NATIVE_CHAR, out_buf) < 0)
TEST_ERROR;
- if(HDstrcmp(in_buf, out_buf))
+ if (HDstrcmp(in_buf, out_buf))
TEST_ERROR;
/* Close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR;
/***************************************
* ADD A BUNCH OF (INTEGER) ATTRIBUTES *
***************************************/
- if((sid = H5Screate(H5S_SCALAR)) == H5I_INVALID_HID)
+ if ((sid = H5Screate(H5S_SCALAR)) == H5I_INVALID_HID)
TEST_ERROR;
/* Loop over a reasonable number of attributes */
- for(i = 0; i < N_ATTRS; i++) {
+ for (i = 0; i < N_ATTRS; i++) {
/* Set the attribute's name */
- if(HDsnprintf(attr_name, ATTR_NAME_MAX, "int_attr_%d", i) < 0)
+ if (HDsnprintf(attr_name, ATTR_NAME_MAX, "int_attr_%d", i) < 0)
TEST_ERROR;
/* Create an integer attribute on the dataset */
- if((aid = H5Acreate2(did, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID)
+ if ((aid = H5Acreate2(did, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) ==
+ H5I_INVALID_HID)
TEST_ERROR;
/* Write attribute data */
in_val = i;
- if(H5Awrite(aid, H5T_NATIVE_INT, &in_val) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_INT, &in_val) < 0)
TEST_ERROR;
/* Make sure the count is correct (already has one attribute) */
- if(count_attributes(did) != i + 2)
+ if (count_attributes(did) != i + 2)
TEST_ERROR;
/* Read the data back and verify */
- if(H5Aread(aid, H5T_NATIVE_INT, &out_val) < 0)
+ if (H5Aread(aid, H5T_NATIVE_INT, &out_val) < 0)
TEST_ERROR;
- if(in_val != out_val)
+ if (in_val != out_val)
TEST_ERROR;
/* Close */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
TEST_ERROR;
}
/* Close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
/* Close the remaining IDs */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
/* Free memory */
@@ -980,14 +987,16 @@ test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id)
PASSED();
return SUCCEED;
-error :
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
(void)H5Pclose(dcpl_id);
(void)H5Sclose(sid);
(void)H5Dclose(did);
(void)H5Aclose(aid);
(void)H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(in_buf);
HDfree(out_buf);
@@ -1037,123 +1046,145 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id)
* file-minimized | F_x | F_Y | F_N
*/
-
/*********
* SETUP *
*********/
/* Set filenames (not in a test, can't use TEST_ERROR) */
- if(h5_fixname(FILENAME[1], fapl_id, filename_a, sizeof(filename_a)) == NULL)
+ if (h5_fixname(FILENAME[1], fapl_id, filename_a, sizeof(filename_a)) == NULL)
return FAIL;
- if(h5_fixname(FILENAME[2], fapl_id, filename_b, sizeof(filename_b)) == NULL)
+ if (h5_fixname(FILENAME[2], fapl_id, filename_b, sizeof(filename_b)) == NULL)
return FAIL;
for (compact = 0; compact < 2; compact++) { /* 0 or 1 */
- if(compact)
+ if (compact)
TESTING("minimized dset object headers size comparisons (compact)")
else
TESTING("minimized dset object headers size comparisons")
dcpl_default = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_default < 0) TEST_ERROR
+ if (dcpl_default < 0)
+ TEST_ERROR
dcpl_minimize = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_minimize < 0) TEST_ERROR
+ if (dcpl_minimize < 0)
+ TEST_ERROR
ret = H5Pset_dset_no_attrs_hint(dcpl_minimize, TRUE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
dcpl_dontmin = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_dontmin < 0) TEST_ERROR
+ if (dcpl_dontmin < 0)
+ TEST_ERROR
ret = H5Pset_dset_no_attrs_hint(dcpl_dontmin, FALSE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
- if(compact) {
+ if (compact) {
ret = H5Pset_layout(dcpl_default, H5D_COMPACT);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
ret = H5Pset_layout(dcpl_minimize, H5D_COMPACT);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
ret = H5Pset_layout(dcpl_dontmin, H5D_COMPACT);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
}
dspace_id = H5Screate_simple(1, array_10, NULL);
- if(dspace_id < 0) TEST_ERROR
+ if (dspace_id < 0)
+ TEST_ERROR
int_type_id = H5Tcopy(H5T_NATIVE_INT);
- if(int_type_id < 0) TEST_ERROR
+ if (int_type_id < 0)
+ TEST_ERROR
file_f_id = H5Fcreate(filename_a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if(file_f_id < 0) TEST_ERROR
+ if (file_f_id < 0)
+ TEST_ERROR
- dset_f_x_id = H5Dcreate2(file_f_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT);
- if(dset_f_x_id < 0) TEST_ERROR
+ dset_f_x_id =
+ H5Dcreate2(file_f_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT);
+ if (dset_f_x_id < 0)
+ TEST_ERROR
- dset_f_N_id = H5Dcreate2(file_f_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT);
- if(dset_f_N_id < 0) TEST_ERROR
+ dset_f_N_id =
+ H5Dcreate2(file_f_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT);
+ if (dset_f_N_id < 0)
+ TEST_ERROR
- dset_f_Y_id = H5Dcreate2(file_f_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT);
- if(dset_f_x_id < 0) TEST_ERROR
+ dset_f_Y_id =
+ H5Dcreate2(file_f_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT);
+ if (dset_f_x_id < 0)
+ TEST_ERROR
file_F_id = H5Fcreate(filename_b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if(file_F_id < 0) TEST_ERROR
+ if (file_F_id < 0)
+ TEST_ERROR
ret = H5Fset_dset_no_attrs_hint(file_F_id, TRUE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
- dset_F_x_id = H5Dcreate2(file_F_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT);
- if(dset_F_x_id < 0) TEST_ERROR
+ dset_F_x_id =
+ H5Dcreate2(file_F_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT);
+ if (dset_F_x_id < 0)
+ TEST_ERROR
- dset_F_N_id = H5Dcreate2(file_F_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT);
- if(dset_F_N_id < 0) TEST_ERROR
+ dset_F_N_id =
+ H5Dcreate2(file_F_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT);
+ if (dset_F_N_id < 0)
+ TEST_ERROR
- dset_F_Y_id = H5Dcreate2(file_F_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT);
- if(dset_F_Y_id < 0) TEST_ERROR
+ dset_F_Y_id =
+ H5Dcreate2(file_F_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT);
+ if (dset_F_Y_id < 0)
+ TEST_ERROR
/*********
* TESTS *
*********/
- if(oh_compare(dset_f_x_id, dset_f_x_id) != EQ) TEST_ERROR /* identity */
+ if (oh_compare(dset_f_x_id, dset_f_x_id) != EQ)
+ TEST_ERROR /* identity */
- if(oh_compare(dset_f_x_id, dset_f_N_id) != EQ) TEST_ERROR
- if(oh_compare(dset_f_x_id, dset_f_Y_id) != GT) TEST_ERROR
- if(oh_compare(dset_f_N_id, dset_f_Y_id) != GT) TEST_ERROR
+ if (oh_compare(dset_f_x_id, dset_f_N_id) != EQ)
+ TEST_ERROR if (oh_compare(dset_f_x_id, dset_f_Y_id) != GT)
+ TEST_ERROR if (oh_compare(dset_f_N_id, dset_f_Y_id) != GT) TEST_ERROR
- if(oh_compare(dset_F_x_id, dset_F_N_id) != EQ) TEST_ERROR
- if(oh_compare(dset_F_x_id, dset_F_Y_id) != EQ) TEST_ERROR
- if(oh_compare(dset_F_N_id, dset_F_Y_id) != EQ) TEST_ERROR
+ if (oh_compare(dset_F_x_id, dset_F_N_id) != EQ)
+ TEST_ERROR if (oh_compare(dset_F_x_id, dset_F_Y_id) != EQ)
+ TEST_ERROR if (oh_compare(dset_F_N_id, dset_F_Y_id) != EQ) TEST_ERROR
- if(oh_compare(dset_F_x_id, dset_f_Y_id) != EQ) TEST_ERROR
- if(oh_compare(dset_F_x_id, dset_f_x_id) != LT) TEST_ERROR
+ if (oh_compare(dset_F_x_id, dset_f_Y_id) != EQ)
+ TEST_ERROR if (oh_compare(dset_F_x_id, dset_f_x_id) != LT) TEST_ERROR
- /************
- * TEARDOWN *
- ************/
+ /************
+ * TEARDOWN *
+ ************/
- if(H5Sclose(dspace_id) < 0) TEST_ERROR
- if(H5Tclose(int_type_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_default) < 0) TEST_ERROR
- if(H5Pclose(dcpl_minimize) < 0) TEST_ERROR
- if(H5Pclose(dcpl_dontmin) < 0) TEST_ERROR
+ if (H5Sclose(dspace_id) < 0) TEST_ERROR if (H5Tclose(int_type_id) < 0)
+ TEST_ERROR if (H5Pclose(dcpl_default) < 0) TEST_ERROR if (H5Pclose(dcpl_minimize) < 0)
+ TEST_ERROR if (H5Pclose(dcpl_dontmin) < 0) TEST_ERROR
- if(H5Fclose(file_f_id) < 0) TEST_ERROR
- if(H5Dclose(dset_f_x_id) < 0) TEST_ERROR
- if(H5Dclose(dset_f_N_id) < 0) TEST_ERROR
- if(H5Dclose(dset_f_Y_id) < 0) TEST_ERROR
+ if (H5Fclose(file_f_id) < 0) TEST_ERROR if (H5Dclose(dset_f_x_id) < 0)
+ TEST_ERROR if (H5Dclose(dset_f_N_id) < 0) TEST_ERROR if (H5Dclose(dset_f_Y_id) < 0)
+ TEST_ERROR
- if(H5Fclose(file_F_id) < 0) TEST_ERROR
- if(H5Dclose(dset_F_x_id) < 0) TEST_ERROR
- if(H5Dclose(dset_F_N_id) < 0) TEST_ERROR
- if(H5Dclose(dset_F_Y_id) < 0) TEST_ERROR
+ if (H5Fclose(file_F_id) < 0) TEST_ERROR if (H5Dclose(dset_F_x_id) < 0)
+ TEST_ERROR if (H5Dclose(dset_F_N_id) < 0) TEST_ERROR if (H5Dclose(dset_F_Y_id) < 0)
+ TEST_ERROR
- PASSED();
+ PASSED();
} /* compact and non-compact */
return SUCCEED;
-error :
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
(void)H5Pclose(dcpl_default);
(void)H5Pclose(dcpl_minimize);
(void)H5Pclose(dcpl_dontmin);
@@ -1169,7 +1200,8 @@ error :
(void)H5Dclose(dset_F_x_id);
(void)H5Dclose(dset_F_N_id);
(void)H5Dclose(dset_F_Y_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* test_minimized_dset_ohdr_size_comparisons */
@@ -1181,8 +1213,8 @@ test_minimized_dset_ohdr_with_filter(hid_t fapl_id)
{
char filename[512] = "";
const hsize_t extents[1] = {1024}; /* extents of dataspace */
- const unsigned filter_values[] = {0}; /* TBD */
- const hsize_t chunk_dim[] = {32}; /* needed for filter */
+ const unsigned filter_values[] = {0}; /* TBD */
+ const hsize_t chunk_dim[] = {32}; /* needed for filter */
const int ndims = 1;
hid_t dspace_id = -1;
hid_t dtype_id = -1;
@@ -1210,79 +1242,110 @@ test_minimized_dset_ohdr_with_filter(hid_t fapl_id)
* SETUP *
*********/
- if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL)
+ if (h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL)
TEST_ERROR
dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_mx_id < 0) TEST_ERROR
+ if (dcpl_mx_id < 0)
+ TEST_ERROR
ret = H5Pset_dset_no_attrs_hint(dcpl_mx_id, TRUE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
dcpl_xZ_id = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_xZ_id < 0) TEST_ERROR
+ if (dcpl_xZ_id < 0)
+ TEST_ERROR
ret = H5Pset_chunk(dcpl_xZ_id, ndims, chunk_dim);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
ret = H5Pset_filter(dcpl_xZ_id, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, 0, filter_values);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
dcpl_mZ_id = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_mZ_id < 0) TEST_ERROR
+ if (dcpl_mZ_id < 0)
+ TEST_ERROR
ret = H5Pset_dset_no_attrs_hint(dcpl_mZ_id, TRUE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
ret = H5Pset_chunk(dcpl_mZ_id, ndims, chunk_dim);
- if(ret < 0) TEST_ERROR
- ret = H5Pset_filter( dcpl_mZ_id, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, 0, filter_values);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
+ ret = H5Pset_filter(dcpl_mZ_id, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, 0, filter_values);
+ if (ret < 0)
+ TEST_ERROR
dspace_id = H5Screate_simple(1, extents, extents);
- if(dspace_id < 0) TEST_ERROR
+ if (dspace_id < 0)
+ TEST_ERROR
dtype_id = H5Tcopy(H5T_NATIVE_INT);
- if(dtype_id < 0) TEST_ERROR
+ if (dtype_id < 0)
+ TEST_ERROR
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if(file_id < 0) TEST_ERROR
+ if (file_id < 0)
+ TEST_ERROR
dset_xx_id = H5Dcreate2(file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset_xx_id < 0) TEST_ERROR
+ if (dset_xx_id < 0)
+ TEST_ERROR
dset_mx_id = H5Dcreate2(file_id, "Mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT);
- if(dset_mx_id < 0) TEST_ERROR
+ if (dset_mx_id < 0)
+ TEST_ERROR
dset_xZ_id = H5Dcreate2(file_id, "xZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xZ_id, H5P_DEFAULT);
- if(dset_xZ_id < 0) TEST_ERROR
+ if (dset_xZ_id < 0)
+ TEST_ERROR
dset_mZ_id = H5Dcreate2(file_id, "MZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mZ_id, H5P_DEFAULT);
- if(dset_mZ_id < 0) TEST_ERROR
+ if (dset_mZ_id < 0)
+ TEST_ERROR
/*********
* TESTS *
*********/
- if(oh_compare(dset_mx_id, dset_xx_id) != LT) TEST_ERROR
- if(oh_compare(dset_mx_id, dset_xZ_id) != LT) TEST_ERROR
- if(oh_compare(dset_mZ_id, dset_mx_id) != GT) TEST_ERROR
- if(oh_compare(dset_mZ_id, dset_xZ_id) != LT) TEST_ERROR
+ if (oh_compare(dset_mx_id, dset_xx_id) != LT)
+ TEST_ERROR
+ if (oh_compare(dset_mx_id, dset_xZ_id) != LT)
+ TEST_ERROR
+ if (oh_compare(dset_mZ_id, dset_mx_id) != GT)
+ TEST_ERROR
+ if (oh_compare(dset_mZ_id, dset_xZ_id) != LT)
+ TEST_ERROR
/************
* TEARDOWN *
************/
- if(H5Sclose(dspace_id) < 0) TEST_ERROR
- if(H5Tclose(dtype_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_xZ_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_mx_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_mZ_id) < 0) TEST_ERROR
- if(H5Dclose(dset_xx_id) < 0) TEST_ERROR
- if(H5Dclose(dset_xZ_id) < 0) TEST_ERROR
- if(H5Dclose(dset_mx_id) < 0) TEST_ERROR
- if(H5Dclose(dset_mZ_id) < 0) TEST_ERROR
- if(H5Fclose(file_id) < 0) TEST_ERROR
+ if (H5Sclose(dspace_id) < 0)
+ TEST_ERROR
+ if (H5Tclose(dtype_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl_xZ_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl_mx_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl_mZ_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_xx_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_xZ_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_mx_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_mZ_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
(void)H5Sclose(dspace_id);
(void)H5Tclose(dtype_id);
(void)H5Pclose(dcpl_xZ_id);
@@ -1293,7 +1356,8 @@ error:
(void)H5Dclose(dset_mx_id);
(void)H5Dclose(dset_mZ_id);
(void)H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* test_minimized_dset_ohdr_with_filter */
@@ -1326,11 +1390,15 @@ test_minimized_dset_ohdr_modification_times(hid_t _fapl_id)
hid_t fapl_id = -1;
herr_t ret;
- unsigned i = 0; /* for testcase loop */
- unsigned n_cases = 2; /* must match `cases` array size below */
+ unsigned i = 0; /* for testcase loop */
+ unsigned n_cases = 2; /* must match `cases` array size below */
struct testcase cases[2] = {
- { 1, }, /* version 1 object header */
- { 2, }, /* version 2 object header */
+ {
+ 1,
+ }, /* version 1 object header */
+ {
+ 2,
+ }, /* version 2 object header */
};
/* dcpl suffixes:
@@ -1349,38 +1417,50 @@ test_minimized_dset_ohdr_modification_times(hid_t _fapl_id)
* SETUP *
*********/
- if(h5_fixname(FILENAME[1], _fapl_id, filename, sizeof(filename)) == NULL)
+ if (h5_fixname(FILENAME[1], _fapl_id, filename, sizeof(filename)) == NULL)
TEST_ERROR
dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_mx_id < 0) TEST_ERROR
+ if (dcpl_mx_id < 0)
+ TEST_ERROR
ret = H5Pset_dset_no_attrs_hint(dcpl_mx_id, TRUE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
dcpl_xT_id = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_xT_id < 0) TEST_ERROR
+ if (dcpl_xT_id < 0)
+ TEST_ERROR
ret = H5Pset_obj_track_times(dcpl_xT_id, TRUE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
dcpl_mT_id = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_mT_id < 0) TEST_ERROR
+ if (dcpl_mT_id < 0)
+ TEST_ERROR
ret = H5Pset_dset_no_attrs_hint(dcpl_mT_id, TRUE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
ret = H5Pset_obj_track_times(dcpl_mT_id, TRUE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
dcpl_mN_id = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_mN_id < 0) TEST_ERROR
+ if (dcpl_mN_id < 0)
+ TEST_ERROR
ret = H5Pset_dset_no_attrs_hint(dcpl_mN_id, TRUE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
ret = H5Pset_obj_track_times(dcpl_mN_id, FALSE);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
dspace_id = H5Screate_simple(1, extents, extents);
- if(dspace_id < 0) TEST_ERROR
+ if (dspace_id < 0)
+ TEST_ERROR
dtype_id = H5Tcopy(H5T_NATIVE_INT);
- if(dtype_id < 0) TEST_ERROR
+ if (dtype_id < 0)
+ TEST_ERROR
for (i = 0; i < n_cases; i++) {
@@ -1389,55 +1469,76 @@ test_minimized_dset_ohdr_modification_times(hid_t _fapl_id)
* -------------- */
fapl_id = H5Pcopy(_fapl_id);
- if(fapl_id < 0) TEST_ERROR
+ if (fapl_id < 0)
+ TEST_ERROR
- if(cases[i].oh_version > 1) {
+ if (cases[i].oh_version > 1) {
ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_V18, H5F_LIBVER_V110);
- if(ret < 0) TEST_ERROR
+ if (ret < 0)
+ TEST_ERROR
}
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if(file_id < 0) TEST_ERROR
+ if (file_id < 0)
+ TEST_ERROR
- dset_xx_id = H5Dcreate2( file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset_xx_id < 0) TEST_ERROR
+ dset_xx_id = H5Dcreate2(file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset_xx_id < 0)
+ TEST_ERROR
dset_mx_id = H5Dcreate2(file_id, "mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT);
- if(dset_mx_id < 0) TEST_ERROR
+ if (dset_mx_id < 0)
+ TEST_ERROR
dset_xT_id = H5Dcreate2(file_id, "xT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xT_id, H5P_DEFAULT);
- if(dset_xT_id < 0) TEST_ERROR
+ if (dset_xT_id < 0)
+ TEST_ERROR
dset_mT_id = H5Dcreate2(file_id, "mT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mT_id, H5P_DEFAULT);
- if(dset_mT_id < 0) TEST_ERROR
+ if (dset_mT_id < 0)
+ TEST_ERROR
dset_mN_id = H5Dcreate2(file_id, "mN", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mN_id, H5P_DEFAULT);
- if(dset_mN_id < 0) TEST_ERROR
+ if (dset_mN_id < 0)
+ TEST_ERROR
/* ----- *
* TESTS *
* ----- */
/* sanity check */
- if(oh_compare(dset_mx_id, dset_xx_id) != LT) TEST_ERROR
- if(oh_compare(dset_mx_id, dset_xT_id) != LT) TEST_ERROR
+ if (oh_compare(dset_mx_id, dset_xx_id) != LT)
+ TEST_ERROR
+ if (oh_compare(dset_mx_id, dset_xT_id) != LT)
+ TEST_ERROR
- if(oh_compare(dset_xx_id, dset_xT_id) != EQ) TEST_ERROR
- if(oh_compare(dset_mx_id, dset_mT_id) != EQ) TEST_ERROR
- if(oh_compare(dset_mN_id, dset_mT_id) != LT) TEST_ERROR
+ if (oh_compare(dset_xx_id, dset_xT_id) != EQ)
+ TEST_ERROR
+ if (oh_compare(dset_mx_id, dset_mT_id) != EQ)
+ TEST_ERROR
+ if (oh_compare(dset_mN_id, dset_mT_id) != LT)
+ TEST_ERROR
- if(oh_compare(dset_mT_id, dset_xT_id) != LT) TEST_ERROR
+ if (oh_compare(dset_mT_id, dset_xT_id) != LT)
+ TEST_ERROR
/* ----------------- *
* per-case teardown *
* ----------------- */
- if(H5Dclose(dset_xx_id) < 0) TEST_ERROR
- if(H5Dclose(dset_xT_id) < 0) TEST_ERROR
- if(H5Dclose(dset_mx_id) < 0) TEST_ERROR
- if(H5Dclose(dset_mT_id) < 0) TEST_ERROR
- if(H5Dclose(dset_mN_id) < 0) TEST_ERROR
- if(H5Fclose(file_id) < 0) TEST_ERROR
- if(H5Pclose(fapl_id) < 0) TEST_ERROR
+ if (H5Dclose(dset_xx_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_xT_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_mx_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_mT_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_mN_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR
} /* for each version tested */
@@ -1445,18 +1546,25 @@ test_minimized_dset_ohdr_modification_times(hid_t _fapl_id)
* TEARDOWN *
************/
- if(H5Sclose(dspace_id) < 0) TEST_ERROR
- if(H5Tclose(dtype_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_xT_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_mx_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_mT_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_mN_id) < 0) TEST_ERROR
+ if (H5Sclose(dspace_id) < 0)
+ TEST_ERROR
+ if (H5Tclose(dtype_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl_xT_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl_mx_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl_mT_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl_mN_id) < 0)
+ TEST_ERROR
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
(void)H5Sclose(dspace_id);
(void)H5Tclose(dtype_id);
(void)H5Pclose(dcpl_xT_id);
@@ -1470,7 +1578,8 @@ error:
(void)H5Dclose(dset_mN_id);
(void)H5Fclose(file_id);
(void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* test_minimized_dset_ohdr_modification_times */
@@ -1481,7 +1590,7 @@ static herr_t
test_minimized_dset_ohdr_fillvalue_backwards_compatability(hid_t _fapl_id)
{
char filename[512] = "";
- const hsize_t extents[1] = {64}; /* extents of dataspace */
+ const hsize_t extents[1] = {64}; /* extents of dataspace */
const int fill[1] = {343}; /* fill value of dataset */
hid_t file_id = -1;
hid_t dtype_id = -1;
@@ -1499,79 +1608,103 @@ test_minimized_dset_ohdr_fillvalue_backwards_compatability(hid_t _fapl_id)
TESTING("minimized dset object headers with fill values and different libver support");
fapl_id = H5Pcopy(_fapl_id);
- if(fapl_id < 0) TEST_ERROR
+ if (fapl_id < 0)
+ TEST_ERROR
- if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL)
+ if (h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL)
TEST_ERROR
dspace_id = H5Screate_simple(1, extents, extents);
- if(dspace_id < 0) TEST_ERROR
+ if (dspace_id < 0)
+ TEST_ERROR
dtype_id = H5Tcopy(H5T_NATIVE_INT);
- if(dtype_id < 0) TEST_ERROR
+ if (dtype_id < 0)
+ TEST_ERROR
dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl_id < 0) TEST_ERROR
+ if (dcpl_id < 0)
+ TEST_ERROR
ret = H5Pset_dset_no_attrs_hint(dcpl_id, TRUE);
- if(ret == FAIL) TEST_ERROR;
+ if (ret == FAIL)
+ TEST_ERROR;
ret = H5Pset_fill_value(dcpl_id, dtype_id, fill);
- if(ret == FAIL) TEST_ERROR;
+ if (ret == FAIL)
+ TEST_ERROR;
ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST);
- if(ret == FAIL) TEST_ERROR;
+ if (ret == FAIL)
+ TEST_ERROR;
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if(file_id < 0) TEST_ERROR
+ if (file_id < 0)
+ TEST_ERROR
dset_0_id = H5Dcreate2(file_id, "fullrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
- if(dset_0_id < 0) TEST_ERROR
+ if (dset_0_id < 0)
+ TEST_ERROR
/* Close file and re-open with different libver bounds.
* Dataset "fullrange" must also be closed for expected reopen behavior.
*/
- if(H5Fclose(file_id) < 0) TEST_ERROR;
- if(H5Dclose(dset_0_id) < 0) TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset_0_id) < 0)
+ TEST_ERROR
ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_V18, H5F_LIBVER_LATEST);
- if(ret == FAIL) TEST_ERROR;
+ if (ret == FAIL)
+ TEST_ERROR;
file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
- if(file_id < 0) TEST_ERROR
+ if (file_id < 0)
+ TEST_ERROR
dset_1_id = H5Dcreate2(file_id, "upperrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
- if(dset_1_id < 0) TEST_ERROR
+ if (dset_1_id < 0)
+ TEST_ERROR
/* re-open "fullrange" dataset
*/
- dset_0_id = H5Dopen2(file_id, "fullrange", H5P_DEFAULT);
- if(dset_0_id < 0) TEST_ERROR
+ dset_0_id = H5Dopen2(file_id, "fullrange", H5P_DEFAULT);
+ if (dset_0_id < 0)
+ TEST_ERROR
/*********
* TESTS *
*********/
/* dset not supporting pre-1.08 should be smaller? */
- if(oh_compare(dset_1_id, dset_0_id) != LT) TEST_ERROR
+ if (oh_compare(dset_1_id, dset_0_id) != LT)
+ TEST_ERROR
/************
* TEARDOWN *
************/
- if(H5Sclose(dspace_id) < 0) TEST_ERROR
- if(H5Tclose(dtype_id) < 0) TEST_ERROR
- if(H5Pclose(dcpl_id) < 0) TEST_ERROR
- if(H5Pclose(fapl_id) < 0) TEST_ERROR
- if(H5Dclose(dset_0_id) < 0) TEST_ERROR
- if(H5Dclose(dset_1_id) < 0) TEST_ERROR
- if(H5Fclose(file_id) < 0) TEST_ERROR;
+ if (H5Sclose(dspace_id) < 0)
+ TEST_ERROR
+ if (H5Tclose(dtype_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(dcpl_id) < 0)
+ TEST_ERROR
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_0_id) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_1_id) < 0)
+ TEST_ERROR
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR;
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
(void)H5Sclose(dspace_id);
(void)H5Tclose(dtype_id);
(void)H5Pclose(dcpl_id);
@@ -1579,11 +1712,11 @@ error:
(void)H5Dclose(dset_0_id);
(void)H5Dclose(dset_1_id);
(void)H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* test_minimized_dset_ohdr_fillvalue_backwards_compatability */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1600,27 +1733,28 @@ error:
int
main(void)
{
- hid_t fapl = -1;
- hid_t file = -1;
- H5F_t *f = NULL;
- const char *env_h5_drvr; /* File driver value from environment */
- hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */
- char filename[1024];
+ hid_t fapl = -1;
+ hid_t file = -1;
+ H5F_t * f = NULL;
+ const char * env_h5_drvr; /* File driver value from environment */
+ hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */
+ char filename[1024];
H5O_hdr_info_t hdr_info; /* Object info */
H5O_loc_t oh_loc; /* Object header locations */
- H5F_libver_t low, high; /* File format bounds */
- time_t time_new, ro;
- int i; /* Local index variable */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- herr_t ret; /* Generic return value */
+ H5F_libver_t low, high; /* File format bounds */
+ time_t time_new, ro;
+ int i; /* Local index variable */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ herr_t ret; /* Generic return value */
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
/* Check for VFD which stores data in multiple files */
- single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"));
+ single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") &&
+ HDstrcmp(env_h5_drvr, "family"));
/* Reset library */
h5_reset();
@@ -1628,286 +1762,286 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- const char *low_string; /* Message for library version low bound */
- const char *high_string; /* Message for library version high bound */
- char msg[80]; /* Message for file format version */
-
- /* Set version bounds before opening the file */
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(fapl, low, high);
- } H5E_END_TRY;
-
- if (ret < 0) /* Invalid low/high combinations */
- continue;
-
- /* Display info about testing */
- low_string = h5_get_version_string(low);
- high_string = h5_get_version_string(high);
- HDsprintf(msg, "Using file format version: (%s, %s)", low_string,
- high_string);
- HDputs(msg);
-
- /* test on object continuation block */
- if(test_cont(filename, fapl) < 0)
- TEST_ERROR
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ const char *low_string; /* Message for library version low bound */
+ const char *high_string; /* Message for library version high bound */
+ char msg[80]; /* Message for file format version */
+
+ /* Set version bounds before opening the file */
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl, low, high); }
+ H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Display info about testing */
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
+ HDsprintf(msg, "Using file format version: (%s, %s)", low_string, high_string);
+ HDputs(msg);
+
+ /* test on object continuation block */
+ if (test_cont(filename, fapl) < 0)
+ TEST_ERROR
- /* Create the file to operate on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
- FAIL_STACK_ERROR
- if(H5AC_ignore_tags(f) < 0) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
- } /* end if */
-
- /*
- * Test object header creation
- * (using default group creation property list only because it's convenient)
- */
- TESTING("object header creation");
- HDmemset(&oh_loc, 0, sizeof(oh_loc));
- if(H5O_create(f, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0)
- FAIL_STACK_ERROR
- PASSED();
+ /* Create the file to operate on */
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
+ FAIL_STACK_ERROR
+ if (H5AC_ignore_tags(f) < 0) {
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
+ } /* end if */
+
+ /*
+ * Test object header creation
+ * (using default group creation property list only because it's convenient)
+ */
+ TESTING("object header creation");
+ HDmemset(&oh_loc, 0, sizeof(oh_loc));
+ if (H5O_create(f, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc /*out*/) < 0)
+ FAIL_STACK_ERROR
+ PASSED();
- /* create a new message */
- TESTING("message creation");
- time_new = 11111111;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
- FAIL_STACK_ERROR
- if(1 != H5O_link(&oh_loc, 1))
- FAIL_STACK_ERROR
- if(H5AC_prep_for_file_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_secure_from_file_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
- FAIL_STACK_ERROR
- if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
- FAIL_STACK_ERROR
- if(ro != time_new)
- TEST_ERROR
- PASSED();
-
- /*
- * Test modification of an existing message.
- */
- TESTING("message modification");
- time_new = 33333333;
- if(H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
- FAIL_STACK_ERROR
- if(H5AC_prep_for_file_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_secure_from_file_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
- FAIL_STACK_ERROR
- if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
- FAIL_STACK_ERROR
- if(ro != time_new)
- TEST_ERROR
+ /* create a new message */
+ TESTING("message creation");
+ time_new = 11111111;
+ if (H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
+ FAIL_STACK_ERROR
+ if (1 != H5O_link(&oh_loc, 1))
+ FAIL_STACK_ERROR
+ if (H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ FAIL_STACK_ERROR
+ if (NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
+ FAIL_STACK_ERROR
+ if (ro != time_new)
+ TEST_ERROR
+ PASSED();
+
+ /*
+ * Test modification of an existing message.
+ */
+ TESTING("message modification");
+ time_new = 33333333;
+ if (H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ FAIL_STACK_ERROR
+ if (NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
+ FAIL_STACK_ERROR
+ if (ro != time_new)
+ TEST_ERROR
- /* Make certain that chunk #0 in the object header can be encoded with a 1-byte size */
- if(H5O_get_hdr_info(&oh_loc, &hdr_info) < 0)
- FAIL_STACK_ERROR
- if(hdr_info.space.total >=256)
- TEST_ERROR
+ /* Make certain that chunk #0 in the object header can be encoded with a 1-byte size */
+ if (H5O_get_hdr_info(&oh_loc, &hdr_info) < 0)
+ FAIL_STACK_ERROR
+ if (hdr_info.space.total >= 256)
+ TEST_ERROR
- PASSED();
-
- /*
- * Test creation of a bunch of messages one after another to see
- * what happens when the object header overflows in core.
- * (Use 'old' MTIME message here, because it is large enough to be
- * replaced with a continuation message (the new one is too small)
- * and the library doesn't understand how to migrate more than one
- * message from an object header currently - QAK - 10/8/03)
- */
- TESTING("object header overflow in memory");
- for(i = 0; i < 40; i++) {
- time_new = (i + 1) * 1000 + 1000000;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new) < 0)
+ PASSED();
+
+ /*
+ * Test creation of a bunch of messages one after another to see
+ * what happens when the object header overflows in core.
+ * (Use 'old' MTIME message here, because it is large enough to be
+ * replaced with a continuation message (the new one is too small)
+ * and the library doesn't understand how to migrate more than one
+ * message from an object header currently - QAK - 10/8/03)
+ */
+ TESTING("object header overflow in memory");
+ for (i = 0; i < 40; i++) {
+ time_new = (i + 1) * 1000 + 1000000;
+ if (H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+ if (H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
- } /* end for */
- if(H5AC_prep_for_file_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_secure_from_file_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
- FAIL_STACK_ERROR
- /* Make certain that chunk #0 in the object header will be encoded with a 2-byte size */
- if(H5O_get_hdr_info(&oh_loc, &hdr_info) < 0)
- FAIL_STACK_ERROR
- if(hdr_info.space.total < 256)
- TEST_ERROR
+ /* Make certain that chunk #0 in the object header will be encoded with a 2-byte size */
+ if (H5O_get_hdr_info(&oh_loc, &hdr_info) < 0)
+ FAIL_STACK_ERROR
+ if (hdr_info.space.total < 256)
+ TEST_ERROR
- PASSED();
+ PASSED();
- /* Close & re-open file & object header */
- /* (makes certain that an object header in the new format that transitions
- * between 1-byte chunk #0 size encoding and 2-byte chunk #0 size encoding
- * works correctly - QAK)
- */
- TESTING("close & re-open object header");
- if(H5O_close(&oh_loc, NULL) < 0)
- FAIL_STACK_ERROR
- if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
- if(NULL == (f = (H5F_t *)H5VL_object(file)))
- FAIL_STACK_ERROR
- if (H5AC_ignore_tags(f) < 0)
- FAIL_STACK_ERROR
- oh_loc.file = f;
- if(H5O_open(&oh_loc) < 0)
- FAIL_STACK_ERROR
- PASSED();
-
- /*
- * Test creation of a bunch of messages one after another to see
- * what happens when the object header overflows on disk.
- */
- TESTING("object header overflow on disk");
- for(i = 0; i < 10; i++) {
- time_new = (i + 1) * 1000 + 10;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
+ /* Close & re-open file & object header */
+ /* (makes certain that an object header in the new format that transitions
+ * between 1-byte chunk #0 size encoding and 2-byte chunk #0 size encoding
+ * works correctly - QAK)
+ */
+ TESTING("close & re-open object header");
+ if (H5O_close(&oh_loc, NULL) < 0)
FAIL_STACK_ERROR
- if(H5AC_prep_for_file_flush(f) < 0)
+ if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5AC_flush(f) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
- if(H5AC_secure_from_file_flush(f) < 0)
+ if (NULL == (f = (H5F_t *)H5VL_object(file)))
FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_ignore_tags(f) < 0)
FAIL_STACK_ERROR
- } /* end for */
- PASSED();
-
- /*
- * Delete all time messages.
- */
- TESTING("message deletion");
- if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE) < 0)
- FAIL_STACK_ERROR
- if(H5O_msg_remove(&oh_loc, H5O_MTIME_ID, H5O_ALL, TRUE) < 0)
- FAIL_STACK_ERROR
- if(H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
- FAIL_STACK_ERROR
- if(H5O_msg_read(&oh_loc, H5O_MTIME_ID, &ro))
- FAIL_STACK_ERROR
- PASSED();
-
-
- /*
- * Constant message handling.
- * (can't write to them, but should be able to remove them)
- */
- TESTING("constant message handling");
- time_new = 22222222;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &time_new) < 0)
- FAIL_STACK_ERROR
- if(H5AC_prep_for_file_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_secure_from_file_flush(f) < 0)
- FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
- FAIL_STACK_ERROR
- if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
- FAIL_STACK_ERROR
- if(ro != time_new)
- TEST_ERROR
- time_new = 33333333;
- H5E_BEGIN_TRY {
- ret = H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
- if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE) < 0)
- FAIL_STACK_ERROR
- PASSED();
-
-
- /* release resources */
- TESTING("object header closing");
- if(H5O_close(&oh_loc, NULL) < 0)
- FAIL_STACK_ERROR
- PASSED();
+ oh_loc.file = f;
+ if (H5O_open(&oh_loc) < 0)
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /*
+ * Test creation of a bunch of messages one after another to see
+ * what happens when the object header overflows on disk.
+ */
+ TESTING("object header overflow on disk");
+ for (i = 0; i < 10; i++) {
+ time_new = (i + 1) * 1000 + 10;
+ if (H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+ PASSED();
+
+ /*
+ * Delete all time messages.
+ */
+ TESTING("message deletion");
+ if (H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE) < 0)
+ FAIL_STACK_ERROR
+ if (H5O_msg_remove(&oh_loc, H5O_MTIME_ID, H5O_ALL, TRUE) < 0)
+ FAIL_STACK_ERROR
+ if (H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
+ FAIL_STACK_ERROR
+ if (H5O_msg_read(&oh_loc, H5O_MTIME_ID, &ro))
+ FAIL_STACK_ERROR
+ PASSED();
+
+ /*
+ * Constant message handling.
+ * (can't write to them, but should be able to remove them)
+ */
+ TESTING("constant message handling");
+ time_new = 22222222;
+ if (H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &time_new) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
+ if (H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ FAIL_STACK_ERROR
+ if (NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
+ FAIL_STACK_ERROR
+ if (ro != time_new)
+ TEST_ERROR
+ time_new = 33333333;
+ H5E_BEGIN_TRY { ret = H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new); }
+ H5E_END_TRY;
+ if (ret >= 0)
+ TEST_ERROR
+ if (H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE) < 0)
+ FAIL_STACK_ERROR
+ PASSED();
- /* Close the file we created */
- if(H5Fclose(file) < 0)
- TEST_ERROR
+ /* release resources */
+ TESTING("object header closing");
+ if (H5O_close(&oh_loc, NULL) < 0)
+ FAIL_STACK_ERROR
+ PASSED();
- /* Test reading datasets with undefined object header messages
- * and the various "fail/mark if unknown" object header message flags
- */
- HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID");
- if(single_file_vfd) {
- if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0)
+ /* Close the file we created */
+ if (H5Fclose(file) < 0)
TEST_ERROR
- } /* end if */
- else {
- SKIPPED();
- HDputs(" Unknown header message test not supported with the current VFD.");
- } /* end else */
- HDputs("Accessing objects with unknown header messages: H5O_BOGUS_INVALID_ID");
- if(single_file_vfd) {
- if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0)
+
+ /* Test reading datasets with undefined object header messages
+ * and the various "fail/mark if unknown" object header message flags
+ */
+ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID");
+ if (single_file_vfd) {
+ if (test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0)
+ TEST_ERROR
+ } /* end if */
+ else {
+ SKIPPED();
+ HDputs(" Unknown header message test not supported with the current VFD.");
+ } /* end else */
+ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_INVALID_ID");
+ if (single_file_vfd) {
+ if (test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0)
+ TEST_ERROR
+ } /* end if */
+ else {
+ SKIPPED();
+ HDputs(" Unknown header message test not supported with the current VFD.");
+ } /* end else */
+
+ /* Test object header creation metadata cache issues */
+ if (test_ohdr_cache(filename, fapl) < 0)
TEST_ERROR
- } /* end if */
- else {
- SKIPPED();
- HDputs(" Unknown header message test not supported with the current VFD.");
- } /* end else */
-
- /* Test object header creation metadata cache issues */
- if(test_ohdr_cache(filename, fapl) < 0)
- TEST_ERROR
- if(test_minimized_dset_ohdr_attribute_addition(fapl) < 0)
- TEST_ERROR
+ if (test_minimized_dset_ohdr_attribute_addition(fapl) < 0)
+ TEST_ERROR
- if(test_minimized_dset_ohdr_size_comparisons(fapl) < 0)
- TEST_ERROR
+ if (test_minimized_dset_ohdr_size_comparisons(fapl) < 0)
+ TEST_ERROR
- if(test_minimized_dset_ohdr_with_filter(fapl) < 0)
- TEST_ERROR
+ if (test_minimized_dset_ohdr_with_filter(fapl) < 0)
+ TEST_ERROR
- if(test_minimized_dset_ohdr_modification_times(fapl) < 0)
- TEST_ERROR
+ if (test_minimized_dset_ohdr_modification_times(fapl) < 0)
+ TEST_ERROR
- if(test_minimized_dset_ohdr_fillvalue_backwards_compatability(fapl) < 0)
- TEST_ERROR
+ if (test_minimized_dset_ohdr_fillvalue_backwards_compatability(fapl) < 0)
+ TEST_ERROR
- } /* high */
- } /* low */
+ } /* high */
+ } /* low */
/* Verify symbol table messages are cached */
- if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
+ if (h5_verify_cached_stabs(FILENAME, fapl) < 0)
+ TEST_ERROR
/* A test to exercise the re-read of the object header for SWMR access */
- if(test_ohdr_swmr(TRUE) < 0) TEST_ERROR
- if(test_ohdr_swmr(FALSE) < 0) TEST_ERROR
+ if (test_ohdr_swmr(TRUE) < 0)
+ TEST_ERROR
+ if (test_ohdr_swmr(FALSE) < 0)
+ TEST_ERROR
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
HDputs("All object header tests passed.");
@@ -1916,12 +2050,11 @@ main(void)
error:
HDputs("*** TESTS FAILED ***");
- H5E_BEGIN_TRY {
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(file); }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
return 1;
} /* end main() */
-
diff --git a/test/page_buffer.c b/test/page_buffer.c
index 773b863..ca33872 100644
--- a/test/page_buffer.c
+++ b/test/page_buffer.c
@@ -12,41 +12,39 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: cache_page_buffer
-*
-* Tests the Page Buffer Feature.
-*
-*************************************************************/
+ *
+ * Test program: cache_page_buffer
+ *
+ * Tests the Page Buffer Feature.
+ *
+ *************************************************************/
#include "h5test.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Iprivate.h"
#include "H5PBprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/*
* This file needs to access private information from the H5F package.
*/
-#define H5MF_FRIEND /*suppress error about including H5MFpkg */
+#define H5MF_FRIEND /*suppress error about including H5MFpkg */
#include "H5MFpkg.h"
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
#include "H5Fpkg.h"
-
-#define FILENAME_LEN 1024
+#define FILENAME_LEN 1024
/* test routines */
#ifdef H5_HAVE_PARALLEL
-static unsigned verify_page_buffering_disabled(hid_t orig_fapl,
- const char *env_h5_drvr);
+static unsigned verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr);
#else
-#define NUM_DSETS 5
-#define NX 100
-#define NY 50
+#define NUM_DSETS 5
+#define NX 100
+#define NY 50
static unsigned test_args(hid_t fapl, const char *env_h5_drvr);
static unsigned test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr);
@@ -59,13 +57,10 @@ static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl);
static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size);
#endif /* H5_HAVE_PARALLEL */
-const char *FILENAME[] = {
- "filepaged",
- NULL
-};
+const char *FILENAME[] = {"filepaged", NULL};
#ifndef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: create_file()
*
@@ -91,122 +86,123 @@ const char *FILENAME[] = {
static unsigned
create_file(char *filename, hid_t fcpl, hid_t fapl)
{
- hid_t file_id = -1;
- hid_t dset_id = -1;
- hid_t grp_id = -1;
- hid_t filespace = -1;
- hsize_t dimsf[2] = {NX, NY}; /* dataset dimensions */
- int *data = NULL; /* pointer to data buffer to write */
- hid_t dcpl = -1;
- int i;
- int num_elements;
- int j;
- char dset_name[32];
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t grp_id = -1;
+ hid_t filespace = -1;
+ hsize_t dimsf[2] = {NX, NY}; /* dataset dimensions */
+ int * data = NULL; /* pointer to data buffer to write */
+ hid_t dcpl = -1;
+ int i;
+ int num_elements;
+ int j;
+ char dset_name[32];
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR;
- if((grp_id = H5Gcreate2(file_id, "GROUP", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((grp_id = H5Gcreate2(file_id, "GROUP", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- num_elements = NX * NY;
- if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ num_elements = NX * NY;
+ if ((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
TEST_ERROR
- for (i=0; i < (int)num_elements; i++)
+ for (i = 0; i < (int)num_elements; i++)
data[i] = i;
- if((filespace = H5Screate_simple(2, dimsf, NULL)) < 0)
+ if ((filespace = H5Screate_simple(2, dimsf, NULL)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR;
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
FAIL_STACK_ERROR;
- for(i=0 ; i<NUM_DSETS; i++) {
+ for (i = 0; i < NUM_DSETS; i++) {
HDsprintf(dset_name, "D1dset%d", i);
- if((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR;
HDsprintf(dset_name, "D2dset%d", i);
- if((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR;
HDsprintf(dset_name, "D3dset%d", i);
- if((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR;
HDsprintf(dset_name, "dset%d", i);
- if((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR;
HDmemset(data, 0, (size_t)num_elements * sizeof(int));
- if((dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR;
- for (j=0; j < num_elements; j++) {
- if(data[j] != j) {
+ for (j = 0; j < num_elements; j++) {
+ if (data[j] != j) {
HDfprintf(stderr, "Read different values than written\n");
FAIL_STACK_ERROR;
}
}
HDsprintf(dset_name, "D1dset%d", i);
- if(H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
+ if (H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
HDsprintf(dset_name, "D2dset%d", i);
- if(H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
+ if (H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
HDsprintf(dset_name, "D3dset%d", i);
- if(H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
+ if (H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
}
- if(H5Gclose(grp_id) < 0)
+ if (H5Gclose(grp_id) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
FAIL_STACK_ERROR;
HDfree(data);
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(filespace);
H5Gclose(grp_id);
H5Fclose(file_id);
- if(data)
+ if (data)
HDfree(data);
- } H5E_END_TRY;
- return(1);
+ }
+ H5E_END_TRY;
+ return (1);
} /* create_file */
-
/*-------------------------------------------------------------------------
* Function: open_file()
*
@@ -228,75 +224,76 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-open_file(char *filename, hid_t fapl, hsize_t page_size,
- size_t page_buffer_size)
+open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size)
{
- hid_t file_id = -1;
- hid_t dset_id = -1;
- hid_t grp_id = -1;
- int *data = NULL; /* pointer to data buffer to write */
- int i;
- int j;
- int num_elements;
- char dset_name[32];
- H5F_t *f = NULL;
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t grp_id = -1;
+ int * data = NULL; /* pointer to data buffer to write */
+ int i;
+ int j;
+ int num_elements;
+ char dset_name[32];
+ H5F_t *f = NULL;
- if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file_id)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file_id)))
FAIL_STACK_ERROR;
- if(f->shared->page_buf == NULL)
+ if (f->shared->page_buf == NULL)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->page_size != page_size)
+ if (f->shared->page_buf->page_size != page_size)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->max_size != page_buffer_size)
+ if (f->shared->page_buf->max_size != page_buffer_size)
FAIL_STACK_ERROR;
- if((grp_id = H5Gopen2(file_id, "GROUP", H5P_DEFAULT)) < 0)
+ if ((grp_id = H5Gopen2(file_id, "GROUP", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- num_elements = NX * NY;
- if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ num_elements = NX * NY;
+ if ((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
TEST_ERROR
- for(i=0 ; i<NUM_DSETS; i++) {
+ for (i = 0; i < NUM_DSETS; i++) {
HDsprintf(dset_name, "dset%d", i);
- if((dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(dset_id) < 0)
+ if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR;
- for (j=0; j < num_elements; j++) {
- if(data[j] != j) {
+ for (j = 0; j < num_elements; j++) {
+ if (data[j] != j) {
HDfprintf(stderr, "Read different values than written\n");
FAIL_STACK_ERROR;
}
}
}
- if(H5Gclose(grp_id) < 0)
+ if (H5Gclose(grp_id) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
HDfree(data);
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(grp_id);
H5Fclose(file_id);
- if(data)
+ if (data)
HDfree(data);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
#endif /* H5_HAVE_PARALLEL */
@@ -311,45 +308,47 @@ error:
static unsigned
set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize)
{
- hbool_t split = FALSE;
- hbool_t multi = FALSE;
+ hbool_t split = FALSE;
+ hbool_t multi = FALSE;
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
- char *memb_name[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- hbool_t relax;
- H5FD_mem_t mt;
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char * memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
/* Check for split or multi driver */
- if(!HDstrcmp(env_h5_drvr, "split"))
+ if (!HDstrcmp(env_h5_drvr, "split"))
split = TRUE;
- else if(!HDstrcmp(env_h5_drvr, "multi"))
+ else if (!HDstrcmp(env_h5_drvr, "multi"))
multi = TRUE;
- if(split || multi) {
+ if (split || multi) {
HDmemset(memb_name, 0, sizeof memb_name);
/* Get current split settings */
- if(H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
+ if (H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
TEST_ERROR
- if(split) {
+ if (split) {
/* Set memb_addr aligned */
memb_addr[H5FD_MEM_SUPER] = ((memb_addr[H5FD_MEM_SUPER] + pagesize - 1) / pagesize) * pagesize;
- memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
- } else {
+ memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
+ }
+ else {
/* Set memb_addr aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize;
} /* end else */
/* Set multi driver with new FAPLs */
- if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl_arr, (const char *const *)memb_name, memb_addr,
+ relax) < 0)
TEST_ERROR
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
} /* end if */
@@ -362,7 +361,7 @@ error:
} /* set_multi_split() */
#ifndef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: test_args()
*
@@ -387,159 +386,151 @@ error:
static unsigned
test_args(hid_t orig_fapl, const char *env_h5_drvr)
{
- char filename[FILENAME_LEN]; /* Filename to use */
- hid_t file_id = -1; /* File ID */
- hid_t fcpl = -1;
- hid_t fapl = -1;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
herr_t ret;
TESTING("Settings for Page Buffering");
h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
- if((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR
+ if ((fapl = H5Pcopy(orig_fapl)) < 0)
+ TEST_ERROR
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR;
-
/* Test setting a page buffer without Paged Aggregation enabled -
* should fail
*/
- if(H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
- if(file_id >= 0)
+ if (file_id >= 0)
TEST_ERROR;
-
/* Test setting a page buffer with a size smaller than a single
* page size - should fail
*/
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
TEST_ERROR;
- if(H5Pset_file_space_page_size(fcpl, 512) < 0)
+ if (H5Pset_file_space_page_size(fcpl, 512) < 0)
TEST_ERROR;
- if(H5Pset_page_buffer_size(fapl, 511, 0, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, 511, 0, 0) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
- if(file_id >= 0)
+ if (file_id >= 0)
TEST_ERROR;
-
/* Test setting a page buffer with sum of min meta and raw
* data percentage > 100 - should fail
*/
- H5E_BEGIN_TRY {
- ret = H5Pset_page_buffer_size(fapl, 512, 50, 51);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_page_buffer_size(fapl, 512, 50, 51); }
+ H5E_END_TRY;
- if(ret >= 0)
+ if (ret >= 0)
TEST_ERROR;
- if(set_multi_split(env_h5_drvr, fapl, 512) != 0)
+ if (set_multi_split(env_h5_drvr, fapl, 512) != 0)
TEST_ERROR;
/* Test setting a page buffer with a size equal to a single page size */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
TEST_ERROR;
- if(H5Pset_file_space_page_size(fcpl, 512) < 0)
+ if (H5Pset_file_space_page_size(fcpl, 512) < 0)
TEST_ERROR;
- if(H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0)
TEST_ERROR;
- if(create_file(filename, fcpl, fapl) != 0)
+ if (create_file(filename, fcpl, fapl) != 0)
TEST_ERROR;
- if(open_file(filename, fapl, 512, 512) != 0)
+ if (open_file(filename, fapl, 512, 512) != 0)
TEST_ERROR;
-
/* Test setting a page buffer with a size slightly larger than a
* single page size
*/
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
TEST_ERROR;
- if(H5Pset_file_space_page_size(fcpl, 512) < 0)
+ if (H5Pset_file_space_page_size(fcpl, 512) < 0)
TEST_ERROR;
- if(H5Pset_page_buffer_size(fapl, 513, 0, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, 513, 0, 0) < 0)
TEST_ERROR;
- if(create_file(filename, fcpl, fapl) != 0)
+ if (create_file(filename, fcpl, fapl) != 0)
TEST_ERROR;
- if(open_file(filename, fapl, 512, 512) != 0)
+ if (open_file(filename, fapl, 512, 512) != 0)
TEST_ERROR;
- if(set_multi_split(env_h5_drvr, fapl, 4194304) != 0)
+ if (set_multi_split(env_h5_drvr, fapl, 4194304) != 0)
TEST_ERROR;
-
/* Test setting a large page buffer size and page size */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
TEST_ERROR;
- if(H5Pset_file_space_page_size(fcpl, 4194304) < 0)
+ if (H5Pset_file_space_page_size(fcpl, 4194304) < 0)
TEST_ERROR;
- if(H5Pset_page_buffer_size(fapl, 16777216, 0, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, 16777216, 0, 0) < 0)
TEST_ERROR;
- if(create_file(filename, fcpl, fapl) != 0)
+ if (create_file(filename, fcpl, fapl) != 0)
TEST_ERROR;
- if(open_file(filename, fapl, 4194304, 16777216) != 0)
+ if (open_file(filename, fapl, 4194304, 16777216) != 0)
TEST_ERROR;
- if(set_multi_split(env_h5_drvr, fapl, 1) != 0)
+ if (set_multi_split(env_h5_drvr, fapl, 1) != 0)
TEST_ERROR;
-
/* Test setting a 512 byte page buffer size and page size */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
TEST_ERROR;
- if(H5Pset_file_space_page_size(fcpl, 512) < 0)
+ if (H5Pset_file_space_page_size(fcpl, 512) < 0)
TEST_ERROR;
- if(H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, 512, 0, 0) < 0)
TEST_ERROR;
- if(create_file(filename, fcpl, fapl) != 0)
+ if (create_file(filename, fcpl, fapl) != 0)
TEST_ERROR;
- if(open_file(filename, fapl, 512, 512) != 0)
+ if (open_file(filename, fapl, 512, 512) != 0)
TEST_ERROR;
-
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(fcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_args */
-
/*-------------------------------------------------------------------------
* Function: test_raw_data_handling()
*
@@ -573,44 +564,44 @@ error:
static unsigned
test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr)
{
- char filename[FILENAME_LEN]; /* Filename to use */
- hid_t file_id = -1; /* File ID */
- hid_t fcpl = -1;
- hid_t fapl = -1;
- size_t base_page_cnt;
- size_t page_count = 0;
- int i, num_elements = 2000;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+ size_t base_page_cnt;
+ size_t page_count = 0;
+ int i, num_elements = 2000;
haddr_t addr = HADDR_UNDEF;
- int *data = NULL;
- H5F_t *f = NULL;
+ int * data = NULL;
+ H5F_t * f = NULL;
TESTING("Raw Data Handling");
h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
- if((fapl = H5Pcopy(orig_fapl)) < 0)
+ if ((fapl = H5Pcopy(orig_fapl)) < 0)
TEST_ERROR
- if(set_multi_split(env_h5_drvr, fapl, sizeof(int)*200) != 0)
+ if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0)
TEST_ERROR;
- if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ if ((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
TEST_ERROR;
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
TEST_ERROR;
- if(H5Pset_file_space_page_size(fcpl, sizeof(int)*200) < 0)
+ if (H5Pset_file_space_page_size(fcpl, sizeof(int) * 200) < 0)
TEST_ERROR;
- if(H5Pset_page_buffer_size(fapl, sizeof(int)*2000, 0, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, sizeof(int) * 2000, 0, 0) < 0)
TEST_ERROR;
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file_id)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file_id)))
FAIL_STACK_ERROR;
/* opening the file inserts one or more pages into the page buffer.
@@ -618,125 +609,125 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr)
* the expected value.
*/
base_page_cnt = H5SL_count(f->shared->page_buf->slist_ptr);
- if(base_page_cnt != 1)
+ if (base_page_cnt != 1)
TEST_ERROR;
/* allocate space for a 2000 elements */
- if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
/* initialize all the elements to have a value of -1 */
- for(i=0 ; i<num_elements ; i++)
+ for (i = 0; i < num_elements; i++)
data[i] = -1;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int)*(size_t)num_elements, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int) * (size_t)num_elements, data) < 0)
FAIL_STACK_ERROR;
/* update the first 50 elements to have values 0-49 - this will be
a page buffer update with 1 page resulting in the page
buffer. */
/* Changes: 100 */
- for(i=0 ; i<100 ; i++)
+ for (i = 0; i < 100; i++)
data[i] = i;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- page_count ++;
+ page_count++;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
FAIL_STACK_ERROR;
/* update elements 300 - 450, with values 300 - - this will
bring two more pages into the page buffer. */
- for(i=0 ; i<150 ; i++)
- data[i] = i+300;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*300), sizeof(int)*150, data) < 0)
+ for (i = 0; i < 150; i++)
+ data[i] = i + 300;
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 300), sizeof(int) * 150, data) < 0)
FAIL_STACK_ERROR;
page_count += 2;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
FAIL_STACK_ERROR;
/* update elements 100 - 300, this will go to disk but also update
existing pages in the page buffer. */
- for(i=0 ; i<200 ; i++)
- data[i] = i+100;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*100), sizeof(int)*200, data) < 0)
+ for (i = 0; i < 200; i++)
+ data[i] = i + 100;
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 100), sizeof(int) * 200, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
FAIL_STACK_ERROR;
/* Update elements 225-300 - this will update an existing page in the PB */
/* Changes: 450 - 600; 150 */
- for(i=0 ; i<150 ; i++)
- data[i] = i+450;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*450), sizeof(int)*150, data) < 0)
+ for (i = 0; i < 150; i++)
+ data[i] = i + 450;
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 450), sizeof(int) * 150, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
FAIL_STACK_ERROR;
/* Do a full page write to block 600-800 - should bypass the PB */
- for(i=0 ; i<200 ; i++)
- data[i] = i+600;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*600), sizeof(int)*200, data) < 0)
+ for (i = 0; i < 200; i++)
+ data[i] = i + 600;
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 600), sizeof(int) * 200, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
FAIL_STACK_ERROR;
/* read elements 800 - 1200, this should not affect the PB, and should read -1s */
- if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*800), sizeof(int)*400, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 800), sizeof(int) * 400, data) < 0)
FAIL_STACK_ERROR;
- for (i=0; i < 400; i++) {
- if(data[i] != -1) {
+ for (i = 0; i < 400; i++) {
+ if (data[i] != -1) {
HDfprintf(stderr, "Read different values than written\n");
FAIL_STACK_ERROR;
}
}
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
FAIL_STACK_ERROR;
/* read elements 1200 - 1201, this should read -1 and bring in an
* entire page of addr 1200
*/
- if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*1200), sizeof(int)*1, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 1200), sizeof(int) * 1, data) < 0)
FAIL_STACK_ERROR;
- for (i=0; i < 1; i++) {
- if(data[i] != -1) {
+ for (i = 0; i < 1; i++) {
+ if (data[i] != -1) {
HDfprintf(stderr, "Read different values than written\n");
TEST_ERROR;
}
}
- page_count ++;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ page_count++;
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
TEST_ERROR;
/* read elements 175 - 225, this should use the PB existing pages */
/* Changes: 350 - 450 */
/* read elements 175 - 225, this should use the PB existing pages */
- if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*350), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 350), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- for (i=0; i < 100; i++) {
- if(data[i] != i+350) {
+ for (i = 0; i < 100; i++) {
+ if (data[i] != i + 350) {
HDfprintf(stderr, "Read different values than written\n");
TEST_ERROR;
}
}
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
TEST_ERROR;
/* read elements 0 - 800 using the VFD.. this should result in -1s
except for the writes that went through the PB (100-300 & 600-800) */
- if(H5FD_read(f->shared->lf, H5FD_MEM_DRAW, addr, sizeof(int)*800, data) < 0)
+ if (H5FD_read(f->shared->lf, H5FD_MEM_DRAW, addr, sizeof(int) * 800, data) < 0)
FAIL_STACK_ERROR;
i = 0;
while (i < 800) {
- if((i>=100 && i<300) || (i>=600)) {
- if(data[i] != i) {
+ if ((i >= 100 && i < 300) || (i >= 600)) {
+ if (data[i] != i) {
HDfprintf(stderr, "Read different values than written\n");
TEST_ERROR;
}
}
else {
- if(data[i] != -1) {
+ if (data[i] != -1) {
HDfprintf(stderr, "Read different values than written\n");
TEST_ERROR;
}
@@ -747,12 +738,12 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr)
/* read elements 0 - 800 using the PB.. this should result in all
* what we have written so far and should get the updates from the PB
*/
- if(H5F_block_read(f, H5FD_MEM_DRAW, addr, sizeof(int)*800, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, addr, sizeof(int) * 800, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
TEST_ERROR;
- for (i=0; i < 800; i++) {
- if(data[i] != i) {
+ for (i = 0; i < 800; i++) {
+ if (data[i] != i) {
HDfprintf(stderr, "Read different values than written\n");
TEST_ERROR;
}
@@ -762,43 +753,43 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr)
* also evict existing pages from the PB (page 400 & 1200 that are
* existing).
*/
- for(i=0 ; i<1000 ; i++)
+ for (i = 0; i < 1000; i++)
data[i] = 0;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*400), sizeof(int)*1000, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 400), sizeof(int) * 1000, data) < 0)
FAIL_STACK_ERROR;
page_count -= 2;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
TEST_ERROR;
/* read elements 0 - 1000.. this should go to disk then update the
* buffer result 200-400 with existing pages
*/
- if(H5F_block_read(f, H5FD_MEM_DRAW, addr, sizeof(int)*1000, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, addr, sizeof(int) * 1000, data) < 0)
FAIL_STACK_ERROR;
- i=0;
+ i = 0;
while (i < 1000) {
- if(i<400) {
- if(data[i] != i) {
+ if (i < 400) {
+ if (data[i] != i) {
HDfprintf(stderr, "Read different values than written\n");
TEST_ERROR;
}
}
else {
- if(data[i] != 0) {
+ if (data[i] != 0) {
HDfprintf(stderr, "Read different values than written\n");
TEST_ERROR;
}
}
i++;
}
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
TEST_ERROR;
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
HDfree(data);
@@ -806,17 +797,18 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(fcpl);
H5Fclose(file_id);
- if(data)
+ if (data)
HDfree(data);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_raw_data_handling */
-
/*-------------------------------------------------------------------------
* Function: test_lru_processing()
*
@@ -850,50 +842,50 @@ error:
static unsigned
test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr)
{
- char filename[FILENAME_LEN]; /* Filename to use */
- hid_t file_id = -1; /* File ID */
- hid_t fcpl = -1;
- hid_t fapl = -1;
- size_t base_page_cnt;
- size_t page_count = 0;
- int i;
- int num_elements = 2000;
- haddr_t addr = HADDR_UNDEF;
- haddr_t search_addr = HADDR_UNDEF;
- int *data = NULL;
- H5F_t *f = NULL;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+ size_t base_page_cnt;
+ size_t page_count = 0;
+ int i;
+ int num_elements = 2000;
+ haddr_t addr = HADDR_UNDEF;
+ haddr_t search_addr = HADDR_UNDEF;
+ int * data = NULL;
+ H5F_t * f = NULL;
TESTING("LRU Processing");
h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
- if((fapl = H5Pcopy(orig_fapl)) < 0)
+ if ((fapl = H5Pcopy(orig_fapl)) < 0)
FAIL_STACK_ERROR
- if(set_multi_split(env_h5_drvr, fapl, sizeof(int)*200) != 0)
+ if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0)
TEST_ERROR;
- if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ if ((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
TEST_ERROR;
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_file_space_page_size(fcpl, sizeof(int)*200) < 0)
+ if (H5Pset_file_space_page_size(fcpl, sizeof(int) * 200) < 0)
FAIL_STACK_ERROR;
/* keep 2 pages at max in the page buffer */
- if(H5Pset_page_buffer_size(fapl, sizeof(int)*400, 20, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, sizeof(int) * 400, 20, 0) < 0)
FAIL_STACK_ERROR;
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file_id)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file_id)))
FAIL_STACK_ERROR;
/* opening the file inserts one or more pages into the page buffer.
@@ -901,42 +893,42 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr)
* the expected value.
*/
base_page_cnt = H5SL_count(f->shared->page_buf->slist_ptr);
- if(base_page_cnt != 1)
+ if (base_page_cnt != 1)
TEST_ERROR;
/* allocate space for a 2000 elements */
- if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
/* initialize all the elements to have a value of -1 */
- for(i=0 ; i<num_elements ; i++)
+ for (i = 0; i < num_elements; i++)
data[i] = -1;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int)*(size_t)num_elements, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int) * (size_t)num_elements, data) < 0)
FAIL_STACK_ERROR;
/* update the first 100 elements to have values 0-99 - this will be
* a page buffer update with 1 page resulting in the page
* buffer.
*/
- for(i=0 ; i<100 ; i++)
+ for (i = 0; i < 100; i++)
data[i] = i;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- page_count ++;
+ page_count++;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count + base_page_cnt)
TEST_ERROR;
/* update elements 300 - 450, with values 300 - 449 - this will
* bring two pages into the page buffer and evict 0.
*/
- for(i=0 ; i<150 ; i++)
- data[i] = i+300;
+ for (i = 0; i < 150; i++)
+ data[i] = i + 300;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*300), sizeof(int)*150, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 300), sizeof(int) * 150, data) < 0)
FAIL_STACK_ERROR;
page_count = 2;
@@ -944,114 +936,114 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr)
/* at this point, the page buffer entry created at file open should
* have been evicted -- thus no further need to consider base_page_cnt.
*/
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
/* The two pages should be the ones with address 100 and 200; 0
should have been evicted */
/* Changes: 200, 400 */
search_addr = addr;
- if(NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ if (NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
- search_addr = addr + sizeof(int)*200;
- if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 200;
+ if (NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
- search_addr = addr + sizeof(int)*400;
- if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 400;
+ if (NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
/* update elements 150-151, this will update existing pages in the
page buffer and move it to the top of the LRU. */
/* Changes: 300 - 301 */
- for(i=0 ; i<1 ; i++)
- data[i] = i+300;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*300), sizeof(int)*1, data) < 0)
+ for (i = 0; i < 1; i++)
+ data[i] = i + 300;
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 300), sizeof(int) * 1, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
/* read elements 600 - 601, this should read -1 and bring in an
entire page of addr 600, and evict page 200 */
/* Changes: 1200 - 1201; 1200, 400 */
- if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*1200), sizeof(int)*1, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 1200), sizeof(int) * 1, data) < 0)
FAIL_STACK_ERROR;
- for (i=0; i < 1; i++) {
- if(data[i] != -1) {
+ for (i = 0; i < 1; i++) {
+ if (data[i] != -1) {
HDfprintf(stderr, "Read different values than written\n");
TEST_ERROR;
} /* end if */
- } /* end for */
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ } /* end for */
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
/* Changes: 400 */
- search_addr = addr + sizeof(int)*400;
- if(NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 400;
+ if (NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
/* Changes: 200 */
- search_addr = addr + sizeof(int)*200;
- if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 200;
+ if (NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
/* Changes: 1200 */
- search_addr = addr + sizeof(int)*1200;
- if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 1200;
+ if (NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
/* read elements 175 - 225, this should move 100 to the top, evict 600 and bring in 200 */
/* Changes: 350 - 450; 200, 1200, 400 */
- if(H5F_block_read(f, H5FD_MEM_DRAW, addr+(sizeof(int)*350), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 350), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- for (i=0; i < 100; i++) {
- if(data[i] != i+350) {
+ for (i = 0; i < 100; i++) {
+ if (data[i] != i + 350) {
HDfprintf(stderr, "Read different values than written\n");
TEST_ERROR;
} /* end if */
- } /* end for */
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ } /* end for */
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
/* Changes: 1200 */
- search_addr = addr + sizeof(int)*1200;
- if(NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 1200;
+ if (NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
/* Changes: 200 */
- search_addr = addr + sizeof(int)*200;
- if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 200;
+ if (NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
/* Changes: 400 */
- search_addr = addr + sizeof(int)*400;
- if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 400;
+ if (NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
/* update elements 200 - 700 to value 0, this will go to disk but
also discarding existing pages from the PB (page 200). */
/* Changes: 400 - 1400; 400 */
- for(i=0 ; i<1000 ; i++)
+ for (i = 0; i < 1000; i++)
data[i] = 0;
- if(H5F_block_write(f, H5FD_MEM_DRAW, addr+(sizeof(int)*400), sizeof(int)*1000, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, addr + (sizeof(int) * 400), sizeof(int) * 1000, data) < 0)
FAIL_STACK_ERROR;
page_count -= 1;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
/* Changes: 200 */
- search_addr = addr + sizeof(int)*200;
- if(NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 200;
+ if (NULL == H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
/* Changes: 400 */
- search_addr = addr + sizeof(int)*400;
- if(NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
+ search_addr = addr + sizeof(int) * 400;
+ if (NULL != H5SL_search(f->shared->page_buf->slist_ptr, &(search_addr)))
FAIL_STACK_ERROR;
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
HDfree(data);
@@ -1059,17 +1051,18 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(fcpl);
H5Fclose(file_id);
- if(data)
+ if (data)
HDfree(data);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_lru_processing */
-
/*-------------------------------------------------------------------------
* Function: test_min_threshold()
*
@@ -1104,55 +1097,55 @@ error:
static unsigned
test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr)
{
- char filename[FILENAME_LEN]; /* Filename to use */
- hid_t file_id = -1; /* File ID */
- hid_t fcpl = -1;
- hid_t fapl = -1;
- size_t base_raw_cnt = 0;
- size_t base_meta_cnt = 0;
- size_t page_count = 0;
- int i;
- int num_elements = 1000;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+ size_t base_raw_cnt = 0;
+ size_t base_meta_cnt = 0;
+ size_t page_count = 0;
+ int i;
+ int num_elements = 1000;
H5PB_t *page_buf;
haddr_t meta_addr = HADDR_UNDEF;
- haddr_t raw_addr = HADDR_UNDEF;
- int *data = NULL;
- H5F_t *f = NULL;
+ haddr_t raw_addr = HADDR_UNDEF;
+ int * data = NULL;
+ H5F_t * f = NULL;
TESTING("Minimum Metadata threshold Processing");
HDprintf("\n");
h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
- if((fapl = H5Pcopy(orig_fapl)) < 0)
+ if ((fapl = H5Pcopy(orig_fapl)) < 0)
TEST_ERROR
- if(set_multi_split(env_h5_drvr, fapl, sizeof(int)*200) != 0)
+ if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0)
TEST_ERROR;
- if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ if ((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
TEST_ERROR;
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_file_space_page_size(fcpl, sizeof(int)*200) < 0)
+ if (H5Pset_file_space_page_size(fcpl, sizeof(int) * 200) < 0)
FAIL_STACK_ERROR;
HDprintf("\tMinimum metadata threshold = 100%%\n");
/* keep 5 pages at max in the page buffer and 5 meta page minimum */
- if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 100, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, sizeof(int) * 1000, 100, 0) < 0)
FAIL_STACK_ERROR;
/* create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file_id)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file_id)))
FAIL_STACK_ERROR;
/* opening the file inserts one or more pages into the page buffer.
@@ -1162,27 +1155,27 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr)
HDassert(f->shared);
HDassert(f->shared->page_buf);
- base_raw_cnt = f->shared->page_buf->raw_count;
+ base_raw_cnt = f->shared->page_buf->raw_count;
base_meta_cnt = f->shared->page_buf->meta_count;
- if(base_raw_cnt != 0)
+ if (base_raw_cnt != 0)
TEST_ERROR;
- if(base_meta_cnt != 1)
+ if (base_meta_cnt != 1)
TEST_ERROR;
page_buf = f->shared->page_buf;
- if(page_buf->min_meta_count != 5)
+ if (page_buf->min_meta_count != 5)
TEST_ERROR;
- if(page_buf->min_raw_count != 0)
+ if (page_buf->min_raw_count != 0)
TEST_ERROR;
- if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
- if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
/* write all raw data, this would end up in page buffer since there
@@ -1190,104 +1183,103 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr)
*
* Not necessarily -- opening the file may may load a metadata page.
*/
- for(i=0 ; i<100 ; i++)
+ for (i = 0; i < 100; i++)
data[i] = i;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 400), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 600), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 800), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
page_count += 5;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(page_buf->raw_count != 5 - base_meta_cnt)
+ if (page_buf->raw_count != 5 - base_meta_cnt)
TEST_ERROR;
/* write all meta data, this would end up in page buffer */
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*50, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 200), sizeof(int) * 50, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*50, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 400), sizeof(int) * 50, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*50, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 600), sizeof(int) * 50, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*50, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 800), sizeof(int) * 50, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(page_buf->meta_count != 5)
+ if (page_buf->meta_count != 5)
TEST_ERROR;
- if(page_buf->raw_count != 0)
+ if (page_buf->raw_count != 0)
TEST_ERROR;
/* write and read more raw data and make sure that they don't end up in
* page buffer since the minimum metadata is actually the entire
* page buffer
*/
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*350), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 350), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*500), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 500), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*750), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 750), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*900), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 900), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(page_buf->meta_count != 5)
+ if (page_buf->meta_count != 5)
TEST_ERROR;
- if(page_buf->raw_count != 0)
+ if (page_buf->raw_count != 0)
TEST_ERROR;
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
-
HDprintf("\tMinimum raw data threshold = 100%%\n");
page_count = 0;
/* keep 5 pages at max in the page buffer and 5 raw page minimum */
/* Changes: 1000 */
- if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 0, 100) < 0)
+ if (H5Pset_page_buffer_size(fapl, sizeof(int) * 1000, 0, 100) < 0)
TEST_ERROR;
/* create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file_id)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file_id)))
FAIL_STACK_ERROR;
/* opening the file inserts one or more pages into the page buffer.
@@ -1297,127 +1289,126 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr)
HDassert(f->shared);
HDassert(f->shared->page_buf);
- base_raw_cnt = f->shared->page_buf->raw_count;
+ base_raw_cnt = f->shared->page_buf->raw_count;
base_meta_cnt = f->shared->page_buf->meta_count;
- if(base_raw_cnt != 0)
+ if (base_raw_cnt != 0)
TEST_ERROR;
- if(base_meta_cnt != 1)
+ if (base_meta_cnt != 1)
TEST_ERROR;
page_buf = f->shared->page_buf;
- if(page_buf->min_meta_count != 0)
+ if (page_buf->min_meta_count != 0)
TEST_ERROR;
- if(page_buf->min_raw_count != 5)
+ if (page_buf->min_raw_count != 5)
FAIL_STACK_ERROR;
- if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
- if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int) * (size_t)num_elements)))
TEST_ERROR;
/* write all meta data, this would end up in page buffer since there
* is no raw data yet
*/
- for(i=0 ; i<100 ; i++)
+ for (i = 0; i < 100; i++)
data[i] = i;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 400), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 600), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 800), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
page_count += 5;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(page_buf->meta_count != 5 - base_raw_cnt)
+ if (page_buf->meta_count != 5 - base_raw_cnt)
TEST_ERROR;
/* write/read all raw data, this would end up in page buffer */
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 400), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 600), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 800), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(page_buf->raw_count != 5)
+ if (page_buf->raw_count != 5)
TEST_ERROR;
- if(page_buf->meta_count != 0)
+ if (page_buf->meta_count != 0)
TEST_ERROR;
/* write and read more meta data and make sure that they don't end up in
* page buffer since the minimum metadata is actually the entire
* page buffer
*/
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*100), sizeof(int)*50, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 100), sizeof(int) * 50, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*350), sizeof(int)*50, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 350), sizeof(int) * 50, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*500), sizeof(int)*50, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 500), sizeof(int) * 50, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*750), sizeof(int)*50, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 750), sizeof(int) * 50, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*900), sizeof(int)*50, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 900), sizeof(int) * 50, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(page_buf->raw_count != 5)
+ if (page_buf->raw_count != 5)
TEST_ERROR;
- if(page_buf->meta_count != 0)
+ if (page_buf->meta_count != 0)
TEST_ERROR;
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
-
HDprintf("\tMinimum metadata threshold = 40%%, Minimum rawdata threshold = 40%%\n");
page_count = 0;
/* keep 5 pages at max in the page buffer 2 meta pages, 2 raw pages
* minimum
*/
- if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 40, 40) < 0)
+ if (H5Pset_page_buffer_size(fapl, sizeof(int) * 1000, 40, 40) < 0)
TEST_ERROR;
/* create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file_id)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file_id)))
FAIL_STACK_ERROR;
/* opening the file inserts one or more pages into the page buffer.
@@ -1427,262 +1418,262 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr)
* metadata entry counts.
*/
- if(base_raw_cnt != 0)
+ if (base_raw_cnt != 0)
TEST_ERROR;
- if(base_meta_cnt != 1)
+ if (base_meta_cnt != 1)
TEST_ERROR;
page_buf = f->shared->page_buf;
- if(page_buf->min_meta_count != 2)
+ if (page_buf->min_meta_count != 2)
TEST_ERROR;
- if(page_buf->min_raw_count != 2)
+ if (page_buf->min_raw_count != 2)
TEST_ERROR;
- if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
- if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
/* initialize all the elements to have a value of -1 */
- for(i=0 ; i<num_elements ; i++)
+ for (i = 0; i < num_elements; i++)
data[i] = -1;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int) * (size_t)num_elements, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int) * (size_t)num_elements, data) < 0)
FAIL_STACK_ERROR;
/* fill the page buffer with raw data */
- for(i=0 ; i<100 ; i++)
+ for (i = 0; i < 100; i++)
data[i] = i;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 400), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 600), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 800), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
page_count += 5;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
TEST_ERROR;
- if(f->shared->page_buf->raw_count != 5 - base_meta_cnt)
+ if (f->shared->page_buf->raw_count != 5 - base_meta_cnt)
TEST_ERROR;
/* add 3 meta entries evicting 3 raw entries */
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 400), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->meta_count != 3)
+ if (f->shared->page_buf->meta_count != 3)
TEST_ERROR;
- if(f->shared->page_buf->raw_count != 2)
+ if (f->shared->page_buf->raw_count != 2)
TEST_ERROR;
/* adding more meta entires should replace meta entries since raw data
* is at its minimum
*/
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 600), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 800), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->meta_count != 3)
+ if (f->shared->page_buf->meta_count != 3)
TEST_ERROR;
- if(f->shared->page_buf->raw_count != 2)
+ if (f->shared->page_buf->raw_count != 2)
TEST_ERROR;
/* bring existing raw entires up the LRU */
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*750), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 750), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
/* adding 2 raw entries (even with 1 call) should only evict 1 meta
* entry and another raw entry
*/
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*350), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 350), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->meta_count != 2)
+ if (f->shared->page_buf->meta_count != 2)
TEST_ERROR;
- if(f->shared->page_buf->raw_count != 3)
+ if (f->shared->page_buf->raw_count != 3)
TEST_ERROR;
/* adding 2 meta entries should replace 2 entires at the bottom of the LRU */
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*98), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 98), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*242), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 242), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->meta_count != 2)
+ if (f->shared->page_buf->meta_count != 2)
TEST_ERROR;
- if(f->shared->page_buf->raw_count != 3)
+ if (f->shared->page_buf->raw_count != 3)
TEST_ERROR;
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
HDprintf("\tMinimum metadata threshold = 20%%\n");
page_count = 0;
/* keep 5 pages at max in the page buffer and 1 meta page minimum */
- if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 39, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, sizeof(int) * 1000, 39, 0) < 0)
TEST_ERROR;
/* create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file_id)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file_id)))
FAIL_STACK_ERROR;
page_buf = f->shared->page_buf;
- if(page_buf->min_meta_count != 1)
+ if (page_buf->min_meta_count != 1)
TEST_ERROR;
- if(page_buf->min_raw_count != 0)
+ if (page_buf->min_raw_count != 0)
TEST_ERROR;
- if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
- if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
/* initialize all the elements to have a value of -1 */
- for(i=0 ; i<num_elements ; i++)
+ for (i = 0; i < num_elements; i++)
data[i] = -1;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int) * (size_t)num_elements, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int) * (size_t)num_elements, data) < 0)
FAIL_STACK_ERROR;
/* fill the page buffer with raw data */
- for(i=0 ; i<100 ; i++)
+ for (i = 0; i < 100; i++)
data[i] = i;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 400), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 600), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 800), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
page_count += 5;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
/* add 2 meta entries evicting 2 raw entries */
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->meta_count != 2)
+ if (f->shared->page_buf->meta_count != 2)
TEST_ERROR;
- if(f->shared->page_buf->raw_count != 3)
+ if (f->shared->page_buf->raw_count != 3)
TEST_ERROR;
/* bring the rest of the raw entries up the LRU */
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*500), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 500), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*700), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 700), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*900), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 900), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
/* write one more raw entry which replace one meta entry */
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*100), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 100), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->meta_count != 1)
+ if (f->shared->page_buf->meta_count != 1)
TEST_ERROR;
- if(f->shared->page_buf->raw_count != 4)
+ if (f->shared->page_buf->raw_count != 4)
TEST_ERROR;
/* write one more raw entry which should replace another raw entry
* keeping min threshold of meta entries
*/
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*300), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 300), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->meta_count != 1)
+ if (f->shared->page_buf->meta_count != 1)
TEST_ERROR;
- if(f->shared->page_buf->raw_count != 4)
+ if (f->shared->page_buf->raw_count != 4)
TEST_ERROR;
/* write a metadata entry that should replace the metadata entry
* at the bottom of the LRU
*/
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*500), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 500), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
+ if (H5SL_count(f->shared->page_buf->slist_ptr) != page_count)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->meta_count != 1)
+ if (f->shared->page_buf->meta_count != 1)
TEST_ERROR;
- if(f->shared->page_buf->raw_count != 4)
+ if (f->shared->page_buf->raw_count != 4)
TEST_ERROR;
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
HDfree(data);
@@ -1693,19 +1684,20 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr)
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(fcpl);
H5Fclose(file_id);
- if(data)
+ if (data)
HDfree(data);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_min_threshold */
-
/*-------------------------------------------------------------------------
* Function: test_stats_collection()
*
@@ -1739,50 +1731,50 @@ error:
static unsigned
test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr)
{
- char filename[FILENAME_LEN]; /* Filename to use */
- hid_t file_id = -1; /* File ID */
- hid_t fcpl = -1;
- hid_t fapl = -1;
- int i;
- int num_elements = 1000;
- size_t base_raw_cnt = 0;
- size_t base_meta_cnt = 0;
- haddr_t meta_addr = HADDR_UNDEF;
- haddr_t raw_addr = HADDR_UNDEF;
- int *data = NULL;
- H5F_t *f = NULL;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+ int i;
+ int num_elements = 1000;
+ size_t base_raw_cnt = 0;
+ size_t base_meta_cnt = 0;
+ haddr_t meta_addr = HADDR_UNDEF;
+ haddr_t raw_addr = HADDR_UNDEF;
+ int * data = NULL;
+ H5F_t * f = NULL;
TESTING("Statistics Collection");
h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
- if((fapl = H5Pcopy(orig_fapl)) < 0)
+ if ((fapl = H5Pcopy(orig_fapl)) < 0)
TEST_ERROR
- if(set_multi_split(env_h5_drvr, fapl, sizeof(int)*200) != 0)
+ if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0)
TEST_ERROR;
- if((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
+ if ((data = (int *)HDcalloc((size_t)num_elements, sizeof(int))) == NULL)
TEST_ERROR
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
TEST_ERROR;
- if(H5Pset_file_space_page_size(fcpl, sizeof(int)*200) < 0)
+ if (H5Pset_file_space_page_size(fcpl, sizeof(int) * 200) < 0)
TEST_ERROR;
/* keep 5 pages at max in the page buffer */
- if(H5Pset_page_buffer_size(fapl, sizeof(int)*1000, 20, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, sizeof(int) * 1000, 20, 0) < 0)
TEST_ERROR;
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(file_id)))
+ if (NULL == (f = (H5F_t *)H5VL_object(file_id)))
FAIL_STACK_ERROR;
/* opening the file inserts one or more pages into the page buffer.
@@ -1793,137 +1785,136 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr)
HDassert(f->shared);
HDassert(f->shared->page_buf);
- base_raw_cnt = f->shared->page_buf->raw_count;
+ base_raw_cnt = f->shared->page_buf->raw_count;
base_meta_cnt = f->shared->page_buf->meta_count;
- if(base_raw_cnt != 0)
+ if (base_raw_cnt != 0)
TEST_ERROR;
- if(base_meta_cnt != 1)
+ if (base_meta_cnt != 1)
TEST_ERROR;
/* reset statistics before we begin the tests */
- if(H5Freset_page_buffering_stats(file_id) < 0)
+ if (H5Freset_page_buffering_stats(file_id) < 0)
FAIL_STACK_ERROR;
- if(HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (meta_addr = H5MF_alloc(f, H5FD_MEM_SUPER, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
- if(HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int)*(size_t)num_elements)))
+ if (HADDR_UNDEF == (raw_addr = H5MF_alloc(f, H5FD_MEM_DRAW, sizeof(int) * (size_t)num_elements)))
FAIL_STACK_ERROR;
-
/* initialize all the elements to have a value of -1 */
- for(i=0 ; i<num_elements ; i++)
+ for (i = 0; i < num_elements; i++)
data[i] = -1;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*(size_t)num_elements, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int) * (size_t)num_elements, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*(size_t)num_elements, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int) * (size_t)num_elements, data) < 0)
FAIL_STACK_ERROR;
- for(i=0 ; i<200 ; i++)
+ for (i = 0; i < 200; i++)
data[i] = i;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 400), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 600), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 800), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 600), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*500), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 500), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*700), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 700), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*900), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 900), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*200, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 400), sizeof(int) * 200, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*100), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 100), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*300), sizeof(int)*100, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 300), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_write(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*182, data) < 0)
+ if (H5F_block_write(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 800), sizeof(int) * 182, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*400), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 400), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr, sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*200), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 200), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*600), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 600), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_DRAW, raw_addr+(sizeof(int)*800), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_DRAW, raw_addr + (sizeof(int) * 800), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*400), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 400), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*600), sizeof(int)*200, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 600), sizeof(int) * 200, data) < 0)
FAIL_STACK_ERROR;
- if(H5F_block_read(f, H5FD_MEM_SUPER, meta_addr+(sizeof(int)*800), sizeof(int)*100, data) < 0)
+ if (H5F_block_read(f, H5FD_MEM_SUPER, meta_addr + (sizeof(int) * 800), sizeof(int) * 100, data) < 0)
FAIL_STACK_ERROR;
- if(f->shared->page_buf->accesses[0] != 8)
+ if (f->shared->page_buf->accesses[0] != 8)
TEST_ERROR;
- if(f->shared->page_buf->accesses[1] != 16)
+ if (f->shared->page_buf->accesses[1] != 16)
TEST_ERROR;
- if(f->shared->page_buf->bypasses[0] != 3)
+ if (f->shared->page_buf->bypasses[0] != 3)
TEST_ERROR;
- if(f->shared->page_buf->bypasses[1] != 1)
+ if (f->shared->page_buf->bypasses[1] != 1)
TEST_ERROR;
- if(f->shared->page_buf->hits[0] != 0)
+ if (f->shared->page_buf->hits[0] != 0)
TEST_ERROR;
- if(f->shared->page_buf->hits[1] != 4)
+ if (f->shared->page_buf->hits[1] != 4)
TEST_ERROR;
- if(f->shared->page_buf->misses[0] != 8)
+ if (f->shared->page_buf->misses[0] != 8)
TEST_ERROR;
- if(f->shared->page_buf->misses[1] != 11)
+ if (f->shared->page_buf->misses[1] != 11)
TEST_ERROR;
- if(f->shared->page_buf->evictions[0] != 5 + base_meta_cnt)
+ if (f->shared->page_buf->evictions[0] != 5 + base_meta_cnt)
TEST_ERROR;
- if(f->shared->page_buf->evictions[1] != 9 + base_raw_cnt)
+ if (f->shared->page_buf->evictions[1] != 9 + base_raw_cnt)
TEST_ERROR;
{
@@ -1933,83 +1924,83 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr)
unsigned evictions[2];
unsigned bypasses[2];
- if(H5Fget_page_buffering_stats(file_id, accesses, hits, misses, evictions, bypasses) < 0)
+ if (H5Fget_page_buffering_stats(file_id, accesses, hits, misses, evictions, bypasses) < 0)
FAIL_STACK_ERROR;
- if(accesses[0] != 8)
+ if (accesses[0] != 8)
TEST_ERROR;
- if(accesses[1] != 16)
+ if (accesses[1] != 16)
TEST_ERROR;
- if(bypasses[0] != 3)
+ if (bypasses[0] != 3)
TEST_ERROR;
- if(bypasses[1] != 1)
+ if (bypasses[1] != 1)
TEST_ERROR;
- if(hits[0] != 0)
+ if (hits[0] != 0)
TEST_ERROR;
- if(hits[1] != 4)
+ if (hits[1] != 4)
TEST_ERROR;
- if(misses[0] != 8)
+ if (misses[0] != 8)
TEST_ERROR;
- if(misses[1] != 11)
+ if (misses[1] != 11)
TEST_ERROR;
- if(evictions[0] != 5 + base_meta_cnt)
+ if (evictions[0] != 5 + base_meta_cnt)
TEST_ERROR;
- if(evictions[1] != 9 + base_raw_cnt)
+ if (evictions[1] != 9 + base_raw_cnt)
TEST_ERROR;
- if(H5Freset_page_buffering_stats(file_id) < 0)
+ if (H5Freset_page_buffering_stats(file_id) < 0)
FAIL_STACK_ERROR;
- if(H5Fget_page_buffering_stats(file_id, accesses, hits, misses, evictions, bypasses) < 0)
+ if (H5Fget_page_buffering_stats(file_id, accesses, hits, misses, evictions, bypasses) < 0)
FAIL_STACK_ERROR;
- if(accesses[0] != 0)
+ if (accesses[0] != 0)
TEST_ERROR;
- if(accesses[1] != 0)
+ if (accesses[1] != 0)
TEST_ERROR;
- if(bypasses[0] != 0)
+ if (bypasses[0] != 0)
TEST_ERROR;
- if(bypasses[1] != 0)
+ if (bypasses[1] != 0)
TEST_ERROR;
- if(hits[0] != 0)
+ if (hits[0] != 0)
TEST_ERROR;
- if(hits[1] != 0)
+ if (hits[1] != 0)
TEST_ERROR;
- if(misses[0] != 0)
+ if (misses[0] != 0)
TEST_ERROR;
- if(misses[1] != 0)
+ if (misses[1] != 0)
TEST_ERROR;
- if(evictions[0] != 0)
+ if (evictions[0] != 0)
TEST_ERROR;
- if(evictions[1] != 0)
+ if (evictions[1] != 0)
TEST_ERROR;
} /* end block */
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
HDfree(data);
-
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(fcpl);
H5Fclose(file_id);
- if(data)
+ if (data)
HDfree(data);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_stats_collection */
#endif /* #ifndef H5_HAVE_PARALLEL */
-
/*-------------------------------------------------------------------------
* Function: verify_page_buffering_disabled()
*
@@ -2034,77 +2025,74 @@ error:
static unsigned
verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr)
{
- char filename[FILENAME_LEN]; /* Filename to use */
- hid_t file_id = -1; /* File ID */
- hid_t fcpl = -1;
- hid_t fapl = -1;
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
TESTING("Page Buffering Disabled");
h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
-
/* first, try to create a file with page buffering enabled */
- if((fapl = H5Pcopy(orig_fapl)) < 0)
+ if ((fapl = H5Pcopy(orig_fapl)) < 0)
TEST_ERROR
- if(set_multi_split(env_h5_drvr, fapl, 4096) != 0)
+ if (set_multi_split(env_h5_drvr, fapl, 4096) != 0)
TEST_ERROR;
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_file_space_page_size(fcpl, 4096) < 0)
+ if (H5Pset_file_space_page_size(fcpl, 4096) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_page_buffer_size(fapl, 4096*8, 0, 0) < 0)
+ if (H5Pset_page_buffer_size(fapl, 4096 * 8, 0, 0) < 0)
FAIL_STACK_ERROR;
/* try to create the file -- should fail */
- H5E_BEGIN_TRY {
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
- if(file_id >= 0)
+ if (file_id >= 0)
TEST_ERROR;
/* now, create a file, close it, and then try to open it with page
* buffering enabled.
*/
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_file_space_page_size(fcpl, 4096) < 0)
+ if (H5Pset_file_space_page_size(fcpl, 4096) < 0)
FAIL_STACK_ERROR;
/* create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* close the file */
- if(H5Fclose(file_id) < 0)
+ if (H5Fclose(file_id) < 0)
FAIL_STACK_ERROR;
/* try to open the file using the fapl prepared above which enables
* page buffering. Should fail.
*/
- H5E_BEGIN_TRY {
- file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
- if(file_id >= 0)
+ if (file_id >= 0)
TEST_ERROR;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -2113,18 +2101,19 @@ verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr)
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(fcpl);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* verify_page_buffering_disabled() */
#endif /* H5_HAVE_PARALLEL */
-
/*-------------------------------------------------------------------------
* Function: main()
*
@@ -2141,37 +2130,37 @@ error:
int
main(void)
{
- hid_t fapl = -1; /* File access property list for data files */
- unsigned nerrors = 0; /* Cumulative error count */
- const char *env_h5_drvr = NULL; /* File Driver value from environment */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t fapl = -1; /* File access property list for data files */
+ unsigned nerrors = 0; /* Cumulative error count */
+ const char *env_h5_drvr = NULL; /* File Driver value from environment */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
h5_reset();
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
/* Temporary skip testing with multi/split drivers:
* Page buffering depends on paged aggregation which is
* currently disabled for multi/split drivers.
*/
- if((0 == HDstrcmp(env_h5_drvr, "multi")) ||
- (0 == HDstrcmp(env_h5_drvr, "split"))) {
+ if ((0 == HDstrcmp(env_h5_drvr, "multi")) || (0 == HDstrcmp(env_h5_drvr, "split"))) {
SKIPPED()
HDputs("Skip page buffering test because paged aggregation is disabled for multi/split drivers");
HDexit(EXIT_SUCCESS);
} /* end if */
- if((fapl = h5_fileaccess()) < 0) {
+ if ((fapl = h5_fileaccess()) < 0) {
nerrors++;
PUTS_ERROR("Can't get VFD-dependent fapl")
} /* end if */
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
#ifdef H5_HAVE_PARALLEL
@@ -2191,11 +2180,12 @@ main(void)
h5_clean_files(FILENAME, fapl);
- if(nerrors)
+ if (nerrors)
goto error;
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
HDputs("All Page Buffering tests passed.");
@@ -2203,15 +2193,13 @@ main(void)
HDexit(EXIT_SUCCESS);
error:
- HDprintf("***** %d Page Buffering TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ HDprintf("***** %d Page Buffering TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(fapl); }
+ H5E_END_TRY;
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
HDexit(EXIT_FAILURE);
} /* main() */
-
diff --git a/test/pool.c b/test/pool.c
index 59f9201..05304e5 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -20,9 +20,9 @@
* This file needs to access private datatypes from the H5MP package.
* This file also needs to access the memory pool testing code.
*/
-#define H5MP_FRIEND /*suppress error about including H5MPpkg */
+#define H5MP_FRIEND /*suppress error about including H5MPpkg */
#define H5MP_TESTING
-#include "H5MPpkg.h" /* Memory Pools */
+#include "H5MPpkg.h" /* Memory Pools */
/* Other private headers that this test requires */
@@ -34,10 +34,9 @@
#define MPOOL_LARGE_BLOCK (MPOOL_PAGE_SIZE * 3)
#define MPOOL_NUM_SMALL_BLOCKS 64
#define MPOOL_SMALL_BLOCK 1
-#define MPOOL_NUM_RANDOM 10*1024
+#define MPOOL_NUM_RANDOM 10 * 1024
#define MPOOL_RANDOM_MAX_SIZE (MPOOL_PAGE_SIZE * 2)
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -54,9 +53,9 @@
static int
test_create(void)
{
- H5MP_pool_t *mp; /* Memory pool */
- H5MP_page_t *page; /* Memory pool page */
- size_t free_size; /* Free size in pool */
+ H5MP_pool_t *mp; /* Memory pool */
+ H5MP_page_t *page; /* Memory pool page */
+ size_t free_size; /* Free size in pool */
/*
* Test memory pool creation
@@ -64,23 +63,23 @@ test_create(void)
TESTING("memory pool creation");
/* Create a memory pool */
- if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
+ if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Check free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != 0)
+ if (free_size != 0)
TEST_ERROR
/* Check first page */
- if(H5MP_get_pool_first_page(mp, &page) < 0)
+ if (H5MP_get_pool_first_page(mp, &page) < 0)
TEST_ERROR
- if(page != NULL)
+ if (page != NULL)
TEST_ERROR
/* Close the memory pool */
- if(H5MP_close(mp) < 0)
+ if (H5MP_close(mp) < 0)
TEST_ERROR
PASSED();
@@ -88,15 +87,16 @@ test_create(void)
return 0;
error:
- H5E_BEGIN_TRY {
- if(mp)
+ H5E_BEGIN_TRY
+ {
+ if (mp)
H5MP_close(mp);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_create() */
-
/*-------------------------------------------------------------------------
* Function: test_close_one
*
@@ -113,7 +113,7 @@ error:
static int
test_close_one(void)
{
- H5MP_pool_t *mp; /* Memory pool */
+ H5MP_pool_t *mp; /* Memory pool */
/*
* Test memory pool closing
@@ -121,15 +121,15 @@ test_close_one(void)
TESTING("closing pool with blocks still allocated in one page");
/* Create a memory pool */
- if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
+ if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Allocate space in pool */
- if(NULL == H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK))
+ if (NULL == H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK))
TEST_ERROR
/* Close the memory pool */
- if(H5MP_close(mp) < 0)
+ if (H5MP_close(mp) < 0)
TEST_ERROR
PASSED();
@@ -137,15 +137,16 @@ test_close_one(void)
return 0;
error:
- H5E_BEGIN_TRY {
- if(mp)
+ H5E_BEGIN_TRY
+ {
+ if (mp)
H5MP_close(mp);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_close_one() */
-
/*-------------------------------------------------------------------------
* Function: test_allocate_first
*
@@ -162,10 +163,10 @@ error:
static int
test_allocate_first(void)
{
- H5MP_pool_t *mp; /* Memory pool */
- H5MP_page_t *page; /* Memory pool page */
- size_t free_size; /* Free size in pool */
- void *spc; /* Pointer to space allocated */
+ H5MP_pool_t *mp; /* Memory pool */
+ H5MP_page_t *page; /* Memory pool page */
+ size_t free_size; /* Free size in pool */
+ void * spc; /* Pointer to space allocated */
/*
* Test memory pool allocation
@@ -173,56 +174,60 @@ test_allocate_first(void)
TESTING("allocating first block in pool");
/* Create a memory pool */
- if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
+ if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Allocate space in pool */
- if(NULL == (spc = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
+ if (NULL == (spc = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
TEST_ERROR
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
+ if (free_size !=
+ MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
+ H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
TEST_ERROR
/* Get first page */
- if(H5MP_get_pool_first_page(mp, &page) < 0)
+ if (H5MP_get_pool_first_page(mp, &page) < 0)
TEST_ERROR
- if(page == NULL)
+ if (page == NULL)
TEST_ERROR
/* Check page's free space */
- if(H5MP_get_page_free_size(page, &free_size) < 0)
+ if (H5MP_get_page_free_size(page, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
+ if (free_size !=
+ MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
+ H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Check next page */
- if(H5MP_get_page_next_page(page, &page) < 0)
+ if (H5MP_get_page_next_page(page, &page) < 0)
TEST_ERROR
- if(page != NULL)
+ if (page != NULL)
TEST_ERROR
/* Free space in pool */
H5MP_free(mp, spc);
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))
+ if (free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Close the memory pool */
- if(H5MP_close(mp) < 0)
+ if (H5MP_close(mp) < 0)
TEST_ERROR
PASSED();
@@ -230,56 +235,56 @@ test_allocate_first(void)
TESTING("allocating large first block in pool");
/* Create a memory pool */
- if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
+ if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Allocate space in pool */
- if(NULL == (spc = H5MP_malloc(mp, (size_t)MPOOL_LARGE_BLOCK)))
+ if (NULL == (spc = H5MP_malloc(mp, (size_t)MPOOL_LARGE_BLOCK)))
TEST_ERROR
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != 0)
+ if (free_size != 0)
TEST_ERROR
/* Get first page */
- if(H5MP_get_pool_first_page(mp, &page) < 0)
+ if (H5MP_get_pool_first_page(mp, &page) < 0)
TEST_ERROR
- if(page == NULL)
+ if (page == NULL)
TEST_ERROR
/* Check page's free space */
- if(H5MP_get_page_free_size(page, &free_size) < 0)
+ if (H5MP_get_page_free_size(page, &free_size) < 0)
TEST_ERROR
- if(free_size != 0)
+ if (free_size != 0)
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Check next page */
- if(H5MP_get_page_next_page(page, &page) < 0)
+ if (H5MP_get_page_next_page(page, &page) < 0)
TEST_ERROR
- if(page != NULL)
+ if (page != NULL)
TEST_ERROR
/* Free space in pool */
H5MP_free(mp, spc);
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_LARGE_BLOCK + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)))
+ if (free_size != MPOOL_LARGE_BLOCK + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Close the memory pool */
- if(H5MP_close(mp) < 0)
+ if (H5MP_close(mp) < 0)
TEST_ERROR
PASSED();
@@ -287,15 +292,16 @@ test_allocate_first(void)
return 0;
error:
- H5E_BEGIN_TRY {
- if(mp)
+ H5E_BEGIN_TRY
+ {
+ if (mp)
H5MP_close(mp);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_allocate_first() */
-
/*-------------------------------------------------------------------------
* Function: test_allocate_split
*
@@ -313,10 +319,10 @@ error:
static int
test_allocate_split(void)
{
- H5MP_pool_t *mp; /* Memory pool */
- size_t free_size; /* Free size in pool */
- void *spc1; /* Pointer to space allocated */
- void *spc2; /* Pointer to space allocated */
+ H5MP_pool_t *mp; /* Memory pool */
+ size_t free_size; /* Free size in pool */
+ void * spc1; /* Pointer to space allocated */
+ void * spc2; /* Pointer to space allocated */
/*
* Test memory pool allocation
@@ -324,65 +330,72 @@ test_allocate_split(void)
TESTING("splitting block in pool");
/* Create a memory pool */
- if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
+ if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Allocate space in pool */
- if(NULL == (spc1 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
+ if (NULL == (spc1 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
TEST_ERROR
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
+ if (free_size !=
+ MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
+ H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Allocate more space in pool */
- if(NULL == (spc2 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
+ if (NULL == (spc2 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
TEST_ERROR
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - (((H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) * 2) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
+ if (free_size !=
+ MPOOL_PAGE_SIZE -
+ (((H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) * 2) +
+ H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Free first block in pool */
H5MP_free(mp, spc1);
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
+ if (free_size !=
+ MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
+ H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Free second block in pool (should merge with first block) */
H5MP_free(mp, spc2);
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))
+ if (free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Close the memory pool */
- if(H5MP_close(mp) < 0)
+ if (H5MP_close(mp) < 0)
TEST_ERROR
PASSED();
@@ -390,15 +403,16 @@ test_allocate_split(void)
return 0;
error:
- H5E_BEGIN_TRY {
- if(mp)
+ H5E_BEGIN_TRY
+ {
+ if (mp)
H5MP_close(mp);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_allocate_split() */
-
/*-------------------------------------------------------------------------
* Function: test_allocate_many_small
*
@@ -415,10 +429,10 @@ error:
static int
test_allocate_many_small(void)
{
- H5MP_pool_t *mp; /* Memory pool */
- size_t free_size; /* Free size in pool */
- void *spc[MPOOL_NUM_SMALL_BLOCKS]; /* Pointers to space allocated */
- int i; /* Local index variable */
+ H5MP_pool_t *mp; /* Memory pool */
+ size_t free_size; /* Free size in pool */
+ void * spc[MPOOL_NUM_SMALL_BLOCKS]; /* Pointers to space allocated */
+ int i; /* Local index variable */
/*
* Test memory pool allocation
@@ -426,41 +440,44 @@ test_allocate_many_small(void)
TESTING("allocating many small blocks");
/* Create a memory pool */
- if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
+ if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Allocate space in pool */
- for(i = 0; i < MPOOL_NUM_SMALL_BLOCKS; i++)
- if(NULL == (spc[i] = H5MP_malloc(mp, (size_t)MPOOL_SMALL_BLOCK)))
+ for (i = 0; i < MPOOL_NUM_SMALL_BLOCKS; i++)
+ if (NULL == (spc[i] = H5MP_malloc(mp, (size_t)MPOOL_SMALL_BLOCK)))
TEST_ERROR
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - (((H5MP_BLOCK_ALIGN(MPOOL_SMALL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) * MPOOL_NUM_SMALL_BLOCKS) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
+ if (free_size != MPOOL_PAGE_SIZE -
+ (((H5MP_BLOCK_ALIGN(MPOOL_SMALL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) *
+ MPOOL_NUM_SMALL_BLOCKS) +
+ H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Free blocks in pool */
/* (Tests free block merging with block after it */
- for(i = (MPOOL_NUM_SMALL_BLOCKS - 1); i >= 0; i--)
+ for (i = (MPOOL_NUM_SMALL_BLOCKS - 1); i >= 0; i--)
H5MP_free(mp, spc[i]);
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))
+ if (free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Close the memory pool */
- if(H5MP_close(mp) < 0)
+ if (H5MP_close(mp) < 0)
TEST_ERROR
PASSED();
@@ -468,15 +485,16 @@ test_allocate_many_small(void)
return 0;
error:
- H5E_BEGIN_TRY {
- if(mp)
+ H5E_BEGIN_TRY
+ {
+ if (mp)
H5MP_close(mp);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_allocate_many_small() */
-
/*-------------------------------------------------------------------------
* Function: test_allocate_new_page
*
@@ -494,12 +512,12 @@ error:
static int
test_allocate_new_page(void)
{
- H5MP_pool_t *mp; /* Memory pool */
- size_t free_size; /* Free size in pool */
- size_t u; /* Local index variable */
- void *spc[MPOOL_NUM_NORMAL_BLOCKS]; /* Pointer to space allocated */
- void *spc1; /* Pointer to space allocated */
- void *spc2; /* Pointer to space allocated */
+ H5MP_pool_t *mp; /* Memory pool */
+ size_t free_size; /* Free size in pool */
+ size_t u; /* Local index variable */
+ void * spc[MPOOL_NUM_NORMAL_BLOCKS]; /* Pointer to space allocated */
+ void * spc1; /* Pointer to space allocated */
+ void * spc2; /* Pointer to space allocated */
/*
* Test memory pool allocation
@@ -507,43 +525,46 @@ test_allocate_new_page(void)
TESTING("allocate normal-sized block in new page");
/* Create a memory pool */
- if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
+ if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Allocate space in pool */
- for(u = 0; u < MPOOL_NUM_NORMAL_BLOCKS; u++)
- if(NULL == (spc[u] = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
+ for (u = 0; u < MPOOL_NUM_NORMAL_BLOCKS; u++)
+ if (NULL == (spc[u] = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
TEST_ERROR
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != (MPOOL_PAGE_SIZE * 3) - (((H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) * MPOOL_NUM_NORMAL_BLOCKS) + (H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)) * 3)))
+ if (free_size != (MPOOL_PAGE_SIZE * 3) - (((H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) +
+ H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) *
+ MPOOL_NUM_NORMAL_BLOCKS) +
+ (H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)) * 3)))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Free blocks in pool */
/* (Free alternating blocks, in two passes, which tests block merging w/both neighbors) */
- for(u = 0; u < MPOOL_NUM_NORMAL_BLOCKS; u+=2)
+ for (u = 0; u < MPOOL_NUM_NORMAL_BLOCKS; u += 2)
H5MP_free(mp, spc[u]);
- for(u = 1; u < MPOOL_NUM_NORMAL_BLOCKS; u+=2)
+ for (u = 1; u < MPOOL_NUM_NORMAL_BLOCKS; u += 2)
H5MP_free(mp, spc[u]);
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != ((MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) * 3))
+ if (free_size != ((MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) * 3))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Close the memory pool */
- if(H5MP_close(mp) < 0)
+ if (H5MP_close(mp) < 0)
TEST_ERROR
PASSED();
@@ -551,25 +572,27 @@ test_allocate_new_page(void)
TESTING("allocate large-sized block in new page");
/* Create a memory pool */
- if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
+ if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Allocate space in pool */
/* (Normal sized block) */
- if(NULL == (spc1 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
+ if (NULL == (spc1 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
TEST_ERROR
/* (Larger sized block) */
- if(NULL == (spc2 = H5MP_malloc(mp, (size_t)MPOOL_LARGE_BLOCK)))
+ if (NULL == (spc2 = H5MP_malloc(mp, (size_t)MPOOL_LARGE_BLOCK)))
TEST_ERROR
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
+ if (free_size !=
+ MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
+ H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Free blocks in pool */
@@ -577,18 +600,18 @@ test_allocate_new_page(void)
H5MP_free(mp, spc2);
/* Check pool's free space */
- if(H5MP_get_pool_free_size(mp, &free_size) < 0)
+ if (H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR
- if(free_size != ((MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) +
- MPOOL_LARGE_BLOCK + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))))
+ if (free_size != ((MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) + MPOOL_LARGE_BLOCK +
+ H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Close the memory pool */
- if(H5MP_close(mp) < 0)
+ if (H5MP_close(mp) < 0)
TEST_ERROR
PASSED();
@@ -596,15 +619,16 @@ test_allocate_new_page(void)
return 0;
error:
- H5E_BEGIN_TRY {
- if(mp)
+ H5E_BEGIN_TRY
+ {
+ if (mp)
H5MP_close(mp);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_allocate_new_page() */
-
/*-------------------------------------------------------------------------
* Function: test_allocate_random
*
@@ -621,13 +645,13 @@ error:
static int
test_allocate_random(void)
{
- H5MP_pool_t *mp; /* Memory pool */
- size_t u; /* Local index variable */
- time_t curr_time; /* Current time, for seeding random number generator */
- size_t *blk_size = NULL; /* Pointer to block sizes */
- void **spc = NULL; /* Pointer to space allocated */
- size_t swap_idx; /* Location to swap with when shuffling */
- void *swap_ptr; /* Pointer to swap when shuffling */
+ H5MP_pool_t *mp; /* Memory pool */
+ size_t u; /* Local index variable */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ size_t * blk_size = NULL; /* Pointer to block sizes */
+ void ** spc = NULL; /* Pointer to space allocated */
+ size_t swap_idx; /* Location to swap with when shuffling */
+ void * swap_ptr; /* Pointer to swap when shuffling */
/*
* Test memory pool allocation
@@ -643,62 +667,62 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
HDsrandom((unsigned)curr_time);
/* Create a memory pool */
- if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
+ if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Allocate space for the block sizes */
- if(NULL == (blk_size = (size_t *)HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
+ if (NULL == (blk_size = (size_t *)HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Allocate space for the block pointers */
- if(NULL == (spc = (void **)HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
+ if (NULL == (spc = (void **)HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Initialize the block sizes with random values */
- for(u = 0; u < MPOOL_NUM_RANDOM; u++)
+ for (u = 0; u < MPOOL_NUM_RANDOM; u++)
blk_size[u] = (size_t)(HDrandom() % MPOOL_RANDOM_MAX_SIZE) + 1;
/* Allocate space in pool */
- for(u = 0; u < MPOOL_NUM_RANDOM; u++)
- if(NULL == (spc[u] = H5MP_malloc(mp, blk_size[u])))
+ for (u = 0; u < MPOOL_NUM_RANDOM; u++)
+ if (NULL == (spc[u] = H5MP_malloc(mp, blk_size[u])))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Shuffle pointers to free */
- for(u = 0; u < MPOOL_NUM_RANDOM; u++) {
- swap_idx = (size_t)(HDrandom() % (int)(MPOOL_NUM_RANDOM - u)) + u;
- swap_ptr = spc[u];
- spc[u] = spc[swap_idx];
+ for (u = 0; u < MPOOL_NUM_RANDOM; u++) {
+ swap_idx = (size_t)(HDrandom() % (int)(MPOOL_NUM_RANDOM - u)) + u;
+ swap_ptr = spc[u];
+ spc[u] = spc[swap_idx];
spc[swap_idx] = swap_ptr;
} /* end for */
/* Free blocks in pool */
- for(u = 0; u < MPOOL_NUM_RANDOM; u++)
+ for (u = 0; u < MPOOL_NUM_RANDOM; u++)
H5MP_free(mp, spc[u]);
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Initialize the block sizes with random values */
- for(u = 0; u < MPOOL_NUM_RANDOM; u++)
+ for (u = 0; u < MPOOL_NUM_RANDOM; u++)
blk_size[u] = (size_t)(HDrandom() % MPOOL_RANDOM_MAX_SIZE) + 1;
/* Allocate space in pool (again) */
/* (Leave allocated to test closing pool with many blocks still allocated) */
- for(u = 0; u < MPOOL_NUM_RANDOM; u++)
- if(NULL == (spc[u] = H5MP_malloc(mp, blk_size[u])))
+ for (u = 0; u < MPOOL_NUM_RANDOM; u++)
+ if (NULL == (spc[u] = H5MP_malloc(mp, blk_size[u])))
TEST_ERROR
/* Check that free space totals match */
- if(H5MP_pool_is_free_size_correct(mp) <= 0)
+ if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR
/* Close the memory pool */
- if(H5MP_close(mp) < 0)
+ if (H5MP_close(mp) < 0)
TEST_ERROR
/* Free memory for block sizes & pointers */
@@ -710,19 +734,20 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
return 0;
error:
- if(blk_size)
+ if (blk_size)
HDfree(blk_size);
- if(spc)
+ if (spc)
HDfree(spc);
- H5E_BEGIN_TRY {
- if(mp)
+ H5E_BEGIN_TRY
+ {
+ if (mp)
H5MP_close(mp);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_allocate_random() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -757,7 +782,7 @@ main(void)
nerrors += test_allocate_new_page();
nerrors += test_allocate_random();
- if(nerrors)
+ if (nerrors)
goto error;
puts("All memory pool tests passed.");
@@ -767,4 +792,3 @@ error:
puts("*** TESTS FAILED ***");
return 1;
}
-
diff --git a/test/reserved.c b/test/reserved.c
index 7e53d9c..7149237 100644
--- a/test/reserved.c
+++ b/test/reserved.c
@@ -14,12 +14,7 @@
#include "h5test.h"
#ifdef BROKEN
-const char *FILENAME[] = {
- "rsrv_heap",
- "rsrv_ohdr",
- "rsrv_vlen",
- NULL
-};
+const char *FILENAME[] = {"rsrv_heap", "rsrv_ohdr", "rsrv_vlen", NULL};
/*-------------------------------------------------------------------------
* Function: rsrv_heap
@@ -43,11 +38,11 @@ const char *FILENAME[] = {
static herr_t
rsrv_heap(void)
{
- hid_t file_id=(-1), dataset_id=(-1), dataspace_id=(-1);
- hid_t fapl=(-1), fcpl=(-1);
- hsize_t dims[1] = {1};
- char filename[1024], dset_name[10];
- int i;
+ hid_t file_id = (-1), dataset_id = (-1), dataspace_id = (-1);
+ hid_t fapl = (-1), fcpl = (-1);
+ hsize_t dims[1] = {1};
+ char filename[1024], dset_name[10];
+ int i;
TESTING("Reserving file space for heap");
@@ -57,80 +52,96 @@ rsrv_heap(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Set file address sizes to be very small. */
fcpl = H5Pcreate(H5P_FILE_CREATE);
- if(fcpl < 0) TEST_ERROR;
- if(H5Pset_sizes(fcpl, (size_t)2,(size_t)2) < 0) TEST_ERROR;
+ if (fcpl < 0)
+ TEST_ERROR;
+ if (H5Pset_sizes(fcpl, (size_t)2, (size_t)2) < 0)
+ TEST_ERROR;
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
- if(file_id < 0) TEST_ERROR;
+ if (file_id < 0)
+ TEST_ERROR;
/* Write datasets until the file is full, at which point HDF5
* should throw an error.
*/
- for(i = 0; i < 200; i++) {
- H5E_BEGIN_TRY {
- dataspace_id = H5Screate_simple(1, dims, dims);
- } H5E_END_TRY
+ for (i = 0; i < 200; i++) {
+ H5E_BEGIN_TRY { dataspace_id = H5Screate_simple(1, dims, dims); }
+ H5E_END_TRY
HDsprintf(dset_name, "Dset %d", i);
- H5E_BEGIN_TRY {
- dataset_id = H5Dcreate2(file_id, dset_name, H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ dataset_id = H5Dcreate2(file_id, dset_name, H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY
- if(dataset_id < 0)
+ if (dataset_id < 0)
break;
- H5E_BEGIN_TRY {
- H5Dwrite(dataset_id, H5T_NATIVE_INT, dataspace_id, dataspace_id, H5P_DEFAULT, &i);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { H5Dwrite(dataset_id, H5T_NATIVE_INT, dataspace_id, dataspace_id, H5P_DEFAULT, &i); }
+ H5E_END_TRY
- if(H5Dclose(dataset_id) < 0) TEST_ERROR;
- if(H5Sclose(dataspace_id) < 0) TEST_ERROR;
+ if (H5Dclose(dataset_id) < 0)
+ TEST_ERROR;
+ if (H5Sclose(dataspace_id) < 0)
+ TEST_ERROR;
} /* end for */
/* The loop should have broken before completing--the file should not have had
* enough address space to hold 200 datasets (or this test needs to be updated!).
*/
- if(i == 200)
+ if (i == 200)
TEST_ERROR;
/* Close the file, property lists, and library */
- if(H5Fclose(file_id) < 0) TEST_ERROR;
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Pclose(fcpl) < 0) TEST_ERROR;
- if(H5close() < 0) TEST_ERROR;
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR;
+ if (H5close() < 0)
+ TEST_ERROR;
/* Re-open the library and try to read a dataset from the file we created */
- if(H5open() < 0) TEST_ERROR;
+ if (H5open() < 0)
+ TEST_ERROR;
HDsprintf(dset_name, "Dset %d", i - 2);
file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
- if(file_id < 0) TEST_ERROR;
+ if (file_id < 0)
+ TEST_ERROR;
dataset_id = H5Dopen2(file_id, dset_name, H5P_DEFAULT);
/* If we can read a dataset from the file, the file has been flushed to disk
* (if the heap or object headers weren't flushed, the file would be empty).
*/
- if(dataset_id == H5I_BADID)
- TEST_ERROR;
+ if (dataset_id == H5I_BADID)
+ TEST_ERROR;
- if(H5Dclose(dataset_id) < 0) TEST_ERROR;
- if(H5Fclose(file_id) < 0) TEST_ERROR;
+ if (H5Dclose(dataset_id) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
/* Close everything we can and exit */
- H5E_BEGIN_TRY {
- H5Dclose(dataset_id);
- H5Sclose(dataspace_id);
- H5Pclose(fcpl);
- H5Pclose(fapl);
- H5Fclose(file_id);
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dataset_id);
+ H5Sclose(dataspace_id);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
+ H5Fclose(file_id);
+ }
+ H5E_END_TRY
return 1;
}
@@ -156,13 +167,13 @@ error:
static herr_t
rsrv_ohdr(void)
{
- hid_t file_id=(-1), dataset_id=(-1), dataspace_id=(-1);
- hid_t fapl=(-1), fcpl=(-1), aid, attr_id;
- hsize_t dims[2];
- herr_t status;
- int attrval[4][6];
- char filename[1024], attrname[20];
- int i;
+ hid_t file_id = (-1), dataset_id = (-1), dataspace_id = (-1);
+ hid_t fapl = (-1), fcpl = (-1), aid, attr_id;
+ hsize_t dims[2];
+ herr_t status;
+ int attrval[4][6];
+ char filename[1024], attrname[20];
+ int i;
TESTING("Reserving file space for object headers");
@@ -171,39 +182,47 @@ rsrv_ohdr(void)
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
fcpl = H5Pcreate(H5P_FILE_CREATE);
- if(fcpl < 0) TEST_ERROR;
- if(H5Pset_sizes(fcpl, (size_t)2,(size_t)2) < 0) TEST_ERROR;
+ if (fcpl < 0)
+ TEST_ERROR;
+ if (H5Pset_sizes(fcpl, (size_t)2, (size_t)2) < 0)
+ TEST_ERROR;
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
- if(file_id < 0) TEST_ERROR;
+ if (file_id < 0)
+ TEST_ERROR;
/* Create the data space for the dataset. */
- dims[0] = 4;
- dims[1] = 6;
+ dims[0] = 4;
+ dims[1] = 6;
dataspace_id = H5Screate_simple(2, dims, NULL);
- if(dataspace_id < 0) TEST_ERROR;
+ if (dataspace_id < 0)
+ TEST_ERROR;
/* Create the dataset. */
- dataset_id = H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dataset_id < 0) TEST_ERROR;
+ dataset_id =
+ H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dataset_id < 0)
+ TEST_ERROR;
- for(i = 0; i < 6; i++) {
+ for (i = 0; i < 6; i++) {
attrval[0][i] = 0;
attrval[1][i] = 1;
attrval[2][i] = 2;
attrval[3][i] = 3;
} /* end for */
- for(i = 0; i < 2000; i++) {
+ for (i = 0; i < 2000; i++) {
HDsprintf(attrname, "attr %d", i);
- H5E_BEGIN_TRY{
- aid = H5Screate_simple(2, dims, NULL);
+ H5E_BEGIN_TRY
+ {
+ aid = H5Screate_simple(2, dims, NULL);
attr_id = H5Acreate2(dataset_id, attrname, H5T_STD_I32BE, aid, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr_id, H5T_NATIVE_INT, attrval);
status = H5Aclose(attr_id);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
- if(status < 0)
+ if (status < 0)
break;
} /* end for */
@@ -211,48 +230,60 @@ rsrv_ohdr(void)
* enough address space to hold 2000 attributes (or this test needs to be updated
!).
*/
- if(i == 2000)
+ if (i == 2000)
TEST_ERROR;
/* End access to the dataset and dataspace and release resources. */
- if(H5Dclose(dataset_id) < 0) TEST_ERROR;
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Pclose(fcpl) < 0) TEST_ERROR;
- if(H5Sclose(dataspace_id) < 0) TEST_ERROR;
+ if (H5Dclose(dataset_id) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR;
+ if (H5Sclose(dataspace_id) < 0)
+ TEST_ERROR;
/* Close the file and the library. */
- if(H5Fclose(file_id) < 0) TEST_ERROR;
- if(H5close() < 0) TEST_ERROR;
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR;
+ if (H5close() < 0)
+ TEST_ERROR;
/* Re-open the library and try to read a dataset from the file we created */
- if(H5open() < 0) TEST_ERROR;
+ if (H5open() < 0)
+ TEST_ERROR;
file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
- if(file_id < 0) TEST_ERROR;
+ if (file_id < 0)
+ TEST_ERROR;
dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT);
/* If we can read the dataset from the file, the file has been flushed to disk
* (if the heap or object headers weren't flushed, the file would be empty).
*/
- if(dataset_id == H5I_BADID)
+ if (dataset_id == H5I_BADID)
TEST_ERROR;
- if(H5Dclose(dataset_id) < 0) TEST_ERROR;
- if(H5Fclose(file_id) < 0) TEST_ERROR;
+ if (H5Dclose(dataset_id) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
/* Close everything we can and exit */
- H5E_BEGIN_TRY {
- H5Dclose(dataset_id);
- H5Sclose(dataspace_id);
- H5Pclose(fcpl);
- H5Pclose(fapl);
- H5Fclose(file_id);
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dataset_id);
+ H5Sclose(dataspace_id);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
+ H5Fclose(file_id);
+ }
+ H5E_END_TRY
return 1;
}
@@ -280,16 +311,16 @@ error:
static herr_t
rsrv_vlen(void)
{
- hid_t file_id=(-1), dataset_id=(-1), dataspace_id=(-1), type_id=(-1);
- hid_t fapl=(-1), fcpl=(-1), mem_space_id=(-1);
- hssize_t offset[1];
- hsize_t start[1];
- hsize_t dims[1], count[1];
- herr_t status;
- int i;
- int write_buf[20];
- char filename[1024];
- hvl_t vlen_data;
+ hid_t file_id = (-1), dataset_id = (-1), dataspace_id = (-1), type_id = (-1);
+ hid_t fapl = (-1), fcpl = (-1), mem_space_id = (-1);
+ hssize_t offset[1];
+ hsize_t start[1];
+ hsize_t dims[1], count[1];
+ herr_t status;
+ int i;
+ int write_buf[20];
+ char filename[1024];
+ hvl_t vlen_data;
TESTING("Reserved space with variable length data");
@@ -299,103 +330,126 @@ rsrv_vlen(void)
/* Make file address space very small */
fcpl = H5Pcreate(H5P_FILE_CREATE);
- if(fcpl < 0) TEST_ERROR;
- if(H5Pset_sizes(fcpl, (size_t)2,(size_t)2) < 0) TEST_ERROR;
+ if (fcpl < 0)
+ TEST_ERROR;
+ if (H5Pset_sizes(fcpl, (size_t)2, (size_t)2) < 0)
+ TEST_ERROR;
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
- if(file_id < 0) TEST_ERROR;
+ if (file_id < 0)
+ TEST_ERROR;
/* Create the data space for the dataset. */
- dims[0] = 2000;
+ dims[0] = 2000;
dataspace_id = H5Screate_simple(1, dims, NULL);
- if(dataspace_id < 0) TEST_ERROR;
+ if (dataspace_id < 0)
+ TEST_ERROR;
/* Create a variable length type */
type_id = H5Tvlen_create(H5T_NATIVE_INT);
- if(type_id < 0) TEST_ERROR;
+ if (type_id < 0)
+ TEST_ERROR;
/* Create the dataset. */
dataset_id = H5Dcreate2(file_id, "/dset", type_id, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dataset_id < 0) TEST_ERROR;
+ if (dataset_id < 0)
+ TEST_ERROR;
/* Create some data to write */
- for(i = 0; i < 20; i++)
+ for (i = 0; i < 20; i++)
write_buf[i] = i + 1;
vlen_data.p = write_buf;
/* Create a memory dataspace for writing */
- dims[0] = 1;
+ dims[0] = 1;
mem_space_id = H5Screate_simple(1, dims, NULL);
- if(mem_space_id < 0) TEST_ERROR;
+ if (mem_space_id < 0)
+ TEST_ERROR;
/* Create a selection to write to */
start[0] = 0;
count[0] = 1;
- if(H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0) TEST_ERROR;
+ if (H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR;
- for(i = 0; i< 2000; i++) {
- vlen_data.len = (i%20) + 1;
+ for (i = 0; i < 2000; i++) {
+ vlen_data.len = (i % 20) + 1;
offset[0] = i;
- if( H5Soffset_simple(dataspace_id, offset) <0) TEST_ERROR;
+ if (H5Soffset_simple(dataspace_id, offset) < 0)
+ TEST_ERROR;
H5E_BEGIN_TRY
- status = H5Dwrite(dataset_id, type_id, mem_space_id, dataspace_id, H5P_DEFAULT, &vlen_data);
+ status = H5Dwrite(dataset_id, type_id, mem_space_id, dataspace_id, H5P_DEFAULT, &vlen_data);
H5E_END_TRY
- if(status < 0)
+ if (status < 0)
break;
} /* end for */
/* The loop should have broken before completing--the file should not have had
* enough address space to hold 2000 attributes (or this test needs to be updated!).
*/
- if(i == 2000)
+ if (i == 2000)
TEST_ERROR;
/* End access to the dataset and dataspace and release resources. */
- if(H5Dclose(dataset_id) < 0) TEST_ERROR;
- if(H5Pclose(fcpl) < 0) TEST_ERROR;
- if(H5Pclose(fapl) < 0) TEST_ERROR;
- if(H5Sclose(dataspace_id) < 0) TEST_ERROR;
- if(H5Tclose(type_id) < 0) TEST_ERROR;
- if(H5Sclose(mem_space_id) < 0) TEST_ERROR;
+ if (H5Dclose(dataset_id) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR;
+ if (H5Pclose(fapl) < 0)
+ TEST_ERROR;
+ if (H5Sclose(dataspace_id) < 0)
+ TEST_ERROR;
+ if (H5Tclose(type_id) < 0)
+ TEST_ERROR;
+ if (H5Sclose(mem_space_id) < 0)
+ TEST_ERROR;
/* Close the file and the library. */
- if(H5Fclose(file_id) < 0) TEST_ERROR;
- if(H5close() < 0) TEST_ERROR;
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR;
+ if (H5close() < 0)
+ TEST_ERROR;
/* Re-open the library and try to read a dataset from the file we created */
- if(H5open() < 0) TEST_ERROR;
+ if (H5open() < 0)
+ TEST_ERROR;
file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
- if(file_id < 0) TEST_ERROR;
+ if (file_id < 0)
+ TEST_ERROR;
dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT);
/* If we can read the dataset from the file, the file has been flushed to disk
* (if the heap or object headers weren't flushed, the file would be empty).
*/
- if(dataset_id == H5I_BADID)
+ if (dataset_id == H5I_BADID)
TEST_ERROR;
- if(H5Dclose(dataset_id) < 0) TEST_ERROR;
- if(H5Fclose(file_id) < 0) TEST_ERROR;
+ if (H5Dclose(dataset_id) < 0)
+ TEST_ERROR;
+ if (H5Fclose(file_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
/* Close everything we can and exit */
- H5E_BEGIN_TRY {
- H5Dclose(dataset_id);
- H5Sclose(dataspace_id);
- H5Sclose(mem_space_id);
- H5Tclose(type_id);
- H5Pclose(fcpl);
- H5Pclose(fapl);
- H5Fclose(file_id);
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dataset_id);
+ H5Sclose(dataspace_id);
+ H5Sclose(mem_space_id);
+ H5Tclose(type_id);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
+ H5Fclose(file_id);
+ }
+ H5E_END_TRY
return 1;
}
#endif /* BROKEN */
@@ -425,36 +479,35 @@ main(void)
* (Also, we should try to make this test work with all the VFDs)
*/
#ifdef BROKEN
- int num_errs=0;
- hid_t fapl;
+ int num_errs = 0;
+ hid_t fapl;
const char *envval = NULL;
envval = HDgetenv("HDF5_DRIVER");
if (envval == NULL)
envval = "nomatch";
-/* QAK: should be able to use the core driver? */
- if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) {
- num_errs+=rsrv_ohdr();
- num_errs+=rsrv_heap();
- num_errs+=rsrv_vlen();
-
- if(num_errs > 0)
- HDprintf("**** %d FAILURE%s! ****\n", num_errs, num_errs==1?"":"S");
- else
- HDputs("All address space reservation tests passed.");
-
- fapl = h5_fileaccess();
- h5_cleanup(FILENAME, fapl);
- return num_errs;
+ /* QAK: should be able to use the core driver? */
+ if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") &&
+ HDstrcmp(envval, "family")) {
+ num_errs += rsrv_ohdr();
+ num_errs += rsrv_heap();
+ num_errs += rsrv_vlen();
+
+ if (num_errs > 0)
+ HDprintf("**** %d FAILURE%s! ****\n", num_errs, num_errs == 1 ? "" : "S");
+ else
+ HDputs("All address space reservation tests passed.");
+
+ fapl = h5_fileaccess();
+ h5_cleanup(FILENAME, fapl);
+ return num_errs;
}
- else
- {
- HDputs("All address space reservation tests skippped - Incompatible with current Virtual File Driver");
+ else {
+ HDputs(
+ "All address space reservation tests skippped - Incompatible with current Virtual File Driver");
}
#endif /* BROKEN */
SKIPPED();
return 0;
-
}
-
diff --git a/test/ros3.c b/test/ros3.c
index 732aadb..7ecba0e 100644
--- a/test/ros3.c
+++ b/test/ros3.c
@@ -77,7 +77,6 @@
*
*****************************************************************************/
-
/*----------------------------------------------------------------------------
*
* ifdef flag: JSVERIFY_EXP_ACT
@@ -89,7 +88,6 @@
*/
#define JSVERIFY_EXP_ACT 1L
-
/*----------------------------------------------------------------------------
*
* Macro: JSFAILED_AT()
@@ -106,10 +104,10 @@
*
*----------------------------------------------------------------------------
*/
-#define JSFAILED_AT() { \
- HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \
-}
-
+#define JSFAILED_AT() \
+ { \
+ HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \
+ }
/*----------------------------------------------------------------------------
*
@@ -134,12 +132,11 @@
*
*----------------------------------------------------------------------------
*/
-#define FAIL_IF(condition) \
-if (condition) { \
- JSFAILED_AT() \
- goto error; \
-}
-
+#define FAIL_IF(condition) \
+ if (condition) { \
+ JSFAILED_AT() \
+ goto error; \
+ }
/*----------------------------------------------------------------------------
*
@@ -164,14 +161,13 @@ if (condition) { \
*----------------------------------------------------------------------------
*/
#if 0 /* UNUSED */
-#define FAIL_UNLESS(condition) \
-if (!(condition)) { \
- JSFAILED_AT() \
- goto error; \
-}
+#define FAIL_UNLESS(condition) \
+ if (!(condition)) { \
+ JSFAILED_AT() \
+ goto error; \
+ }
#endif
-
/*----------------------------------------------------------------------------
*
* Macro: JSERR_LONG()
@@ -202,16 +198,17 @@ jserr_long(long expected, long actual, const char *reason)
{
if (reason != NULL) {
HDprintf("%s\n", reason);
- } else {
+ }
+ else {
HDprintf(" ! Expected %ld\n ! Actual %ld\n", expected, actual);
}
}
-#define JSERR_LONG(expected, actual, reason) { \
- JSFAILED_AT() \
- jserr_long((long)(expected), (long)(actual), (reason)); \
-}
-
+#define JSERR_LONG(expected, actual, reason) \
+ { \
+ JSFAILED_AT() \
+ jserr_long((long)(expected), (long)(actual), (reason)); \
+ }
/*----------------------------------------------------------------------------
*
@@ -246,19 +243,20 @@ jserr_str(const char *expected, const char *actual, const char *reason)
{
if (reason != NULL) {
HDprintf("%s\n", reason);
- } else {
+ }
+ else {
HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", expected, actual);
}
}
-#define JSERR_STR(expected, actual, reason) { \
- JSFAILED_AT() \
- jserr_str((expected), (actual), (reason)); \
-}
+#define JSERR_STR(expected, actual, reason) \
+ { \
+ JSFAILED_AT() \
+ jserr_str((expected), (actual), (reason)); \
+ }
#ifdef JSVERIFY_EXP_ACT
-
/*----------------------------------------------------------------------------
*
* Macro: JSVERIFY()
@@ -275,12 +273,11 @@ jserr_str(const char *expected, const char *actual, const char *reason)
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY(expected, actual, reason) \
-if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY */
-
+#define JSVERIFY(expected, actual, reason) \
+ if ((long)(actual) != (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY */
/*----------------------------------------------------------------------------
*
@@ -298,12 +295,11 @@ if ((long)(actual) != (long)(expected)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_NOT(expected, actual, reason) \
-if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY_NOT */
-
+#define JSVERIFY_NOT(expected, actual, reason) \
+ if ((long)(actual) == (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY_NOT */
/*----------------------------------------------------------------------------
*
@@ -321,12 +317,11 @@ if ((long)(actual) == (long)(expected)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_STR(expected, actual, reason) \
-if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY_STR */
-
+#define JSVERIFY_STR(expected, actual, reason) \
+ if (strcmp((actual), (expected)) != 0) { \
+ JSERR_STR((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY_STR */
#else
/* JSVERIFY_EXP_ACT not defined
@@ -334,7 +329,6 @@ if (strcmp((actual), (expected)) != 0) { \
* Repeats macros above, but with actual/expected parameters reversed.
*/
-
/*----------------------------------------------------------------------------
* Macro: JSVERIFY()
* See: JSVERIFY documentation above.
@@ -342,12 +336,11 @@ if (strcmp((actual), (expected)) != 0) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY(actual, expected, reason) \
-if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY */
-
+#define JSVERIFY(actual, expected, reason) \
+ if ((long)(actual) != (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY */
/*----------------------------------------------------------------------------
* Macro: JSVERIFY_NOT()
@@ -356,12 +349,11 @@ if ((long)(actual) != (long)(expected)) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_NOT(actual, expected, reason) \
-if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY_NOT */
-
+#define JSVERIFY_NOT(actual, expected, reason) \
+ if ((long)(actual) == (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY_NOT */
/*----------------------------------------------------------------------------
* Macro: JSVERIFY_STR()
@@ -370,11 +362,11 @@ if ((long)(actual) == (long)(expected)) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_STR(actual, expected, reason) \
-if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY_STR */
+#define JSVERIFY_STR(actual, expected, reason) \
+ if (strcmp((actual), (expected)) != 0) { \
+ JSERR_STR((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY_STR */
#endif /* ifdef/else JSVERIFY_EXP_ACT */
@@ -382,16 +374,16 @@ if (strcmp((actual), (expected)) != 0) { \
* OTHER MACROS AND DEFINITIONS *
********************************/
-#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
+#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1)
#define S3_TEST_PROFILE_NAME "ros3_vfd_test"
#define S3_TEST_MAX_URL_SIZE 256
#define S3_TEST_RESOURCE_TEXT_RESTRICTED "t8.shakespeare.txt"
-#define S3_TEST_RESOURCE_TEXT_PUBLIC "Poe_Raven.txt"
-#define S3_TEST_RESOURCE_H5_PUBLIC "GMODO-SVM01.h5"
-#define S3_TEST_RESOURCE_MISSING "missing.csv"
+#define S3_TEST_RESOURCE_TEXT_PUBLIC "Poe_Raven.txt"
+#define S3_TEST_RESOURCE_H5_PUBLIC "GMODO-SVM01.h5"
+#define S3_TEST_RESOURCE_MISSING "missing.csv"
static char url_text_restricted[S3_TEST_MAX_URL_SIZE] = "";
static char url_text_public[S3_TEST_MAX_URL_SIZE] = "";
@@ -410,17 +402,13 @@ static char s3_test_aws_region[16];
static char s3_test_aws_access_key_id[64];
static char s3_test_aws_secret_access_key[128];
-H5FD_ros3_fapl_t restricted_access_fa = {
- H5FD_CURR_ROS3_FAPL_T_VERSION, /* fapl version */
- TRUE, /* authenticate */
- "", /* aws region */
- "", /* access key id */
- ""}; /* secret access key */
-
-H5FD_ros3_fapl_t anonymous_fa = {
- H5FD_CURR_ROS3_FAPL_T_VERSION,
- FALSE, "", "", "" };
+H5FD_ros3_fapl_t restricted_access_fa = {H5FD_CURR_ROS3_FAPL_T_VERSION, /* fapl version */
+ TRUE, /* authenticate */
+ "", /* aws region */
+ "", /* access key id */
+ ""}; /* secret access key */
+H5FD_ros3_fapl_t anonymous_fa = {H5FD_CURR_ROS3_FAPL_T_VERSION, FALSE, "", "", ""};
/*---------------------------------------------------------------------------
*
@@ -454,92 +442,108 @@ test_fapl_config_validation(void)
*************************/
struct testcase {
- const char *msg;
- herr_t expected;
- H5FD_ros3_fapl_t config;
+ const char * msg;
+ herr_t expected;
+ H5FD_ros3_fapl_t config;
};
/************************
* test-local variables *
************************/
- hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id = -1; /* file access property list ID */
H5FD_ros3_fapl_t config;
H5FD_ros3_fapl_t fa_fetch;
- herr_t success = SUCCEED;
- unsigned int i = 0;
- unsigned int ncases = 8; /* should equal number of cases */
- struct testcase *case_ptr = NULL; /* dumb work-around for possible */
- /* dynamic cases creation because */
- /* of compiler warnings Wlarger-than */
- struct testcase cases_arr[] = {
- { "non-authenticating config allows empties.\n",
+ herr_t success = SUCCEED;
+ unsigned int i = 0;
+ unsigned int ncases = 8; /* should equal number of cases */
+ struct testcase *case_ptr = NULL; /* dumb work-around for possible */
+ /* dynamic cases creation because */
+ /* of compiler warnings Wlarger-than */
+ struct testcase cases_arr[] = {
+ {
+ "non-authenticating config allows empties.\n",
SUCCEED,
- { H5FD_CURR_ROS3_FAPL_T_VERSION, /* version */
- FALSE, /* authenticate */
- "", /* aws_region */
- "", /* secret_id */
- "", /* secret_key */
+ {
+ H5FD_CURR_ROS3_FAPL_T_VERSION, /* version */
+ FALSE, /* authenticate */
+ "", /* aws_region */
+ "", /* secret_id */
+ "", /* secret_key */
},
},
- { "authenticating config asks for populated strings.\n",
+ {
+ "authenticating config asks for populated strings.\n",
FAIL,
- { H5FD_CURR_ROS3_FAPL_T_VERSION,
+ {
+ H5FD_CURR_ROS3_FAPL_T_VERSION,
TRUE,
"",
"",
"",
},
},
- { "populated strings; key is the empty string?\n",
+ {
+ "populated strings; key is the empty string?\n",
SUCCEED,
- { H5FD_CURR_ROS3_FAPL_T_VERSION,
+ {
+ H5FD_CURR_ROS3_FAPL_T_VERSION,
TRUE,
"region",
"me",
"",
},
},
- { "id cannot be empty.\n",
+ {
+ "id cannot be empty.\n",
FAIL,
- { H5FD_CURR_ROS3_FAPL_T_VERSION,
+ {
+ H5FD_CURR_ROS3_FAPL_T_VERSION,
TRUE,
"",
"me",
"",
},
},
- { "region cannot be empty.\n",
+ {
+ "region cannot be empty.\n",
FAIL,
- { H5FD_CURR_ROS3_FAPL_T_VERSION,
+ {
+ H5FD_CURR_ROS3_FAPL_T_VERSION,
TRUE,
"where",
"",
"",
},
},
- { "all strings populated.\n",
+ {
+ "all strings populated.\n",
SUCCEED,
- { H5FD_CURR_ROS3_FAPL_T_VERSION,
+ {
+ H5FD_CURR_ROS3_FAPL_T_VERSION,
TRUE,
"where",
"who",
"thisIsA GREAT seeeecrit",
},
},
- { "incorrect version should fail\n",
+ {
+ "incorrect version should fail\n",
FAIL,
- { 12345,
+ {
+ 12345,
FALSE,
"",
"",
"",
},
},
- { "non-authenticating config cares not for (de)population"
+ {
+ "non-authenticating config cares not for (de)population"
"of strings.\n",
SUCCEED,
- { H5FD_CURR_ROS3_FAPL_T_VERSION,
+ {
+ H5FD_CURR_ROS3_FAPL_T_VERSION,
FALSE,
"someregion",
"someid",
@@ -568,58 +572,46 @@ test_fapl_config_validation(void)
*---------------
*/
case_ptr = &cases_arr[i];
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 ) /* sanity-check */
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ FAIL_IF(fapl_id < 0) /* sanity-check */
/*-----------------------------------
* Actually test.
* Mute stack trace in failure cases.
*-----------------------------------
*/
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* `H5FD_ros3_validate_config(...)` is static/private
* to src/ros3.c and cannot (and should not?) be tested directly?
* Instead, validate config through public api.
*/
success = H5Pset_fapl_ros3(fapl_id, &case_ptr->config);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- JSVERIFY( case_ptr->expected, success, case_ptr->msg )
+ JSVERIFY(case_ptr->expected, success, case_ptr->msg)
/* Make sure we can get back what we put in.
* Only valid if the fapl configuration does not result in error.
*/
if (success == SUCCEED) {
config = case_ptr->config;
- JSVERIFY( SUCCEED,
- H5Pget_fapl_ros3(fapl_id, &fa_fetch),
- "unable to get fapl" )
-
- JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION,
- fa_fetch.version,
- "invalid version number" )
- JSVERIFY( config.version,
- fa_fetch.version,
- "version number mismatch" )
- JSVERIFY( config.authenticate,
- fa_fetch.authenticate,
- "authentication flag mismatch" )
- JSVERIFY_STR( config.aws_region,
- fa_fetch.aws_region,
- NULL )
- JSVERIFY_STR( config.secret_id,
- fa_fetch.secret_id,
- NULL )
- JSVERIFY_STR( config.secret_key,
- fa_fetch.secret_key,
- NULL )
+ JSVERIFY(SUCCEED, H5Pget_fapl_ros3(fapl_id, &fa_fetch), "unable to get fapl")
+
+ JSVERIFY(H5FD_CURR_ROS3_FAPL_T_VERSION, fa_fetch.version, "invalid version number")
+ JSVERIFY(config.version, fa_fetch.version, "version number mismatch")
+ JSVERIFY(config.authenticate, fa_fetch.authenticate, "authentication flag mismatch")
+ JSVERIFY_STR(config.aws_region, fa_fetch.aws_region, NULL)
+ JSVERIFY_STR(config.secret_id, fa_fetch.secret_id, NULL)
+ JSVERIFY_STR(config.secret_key, fa_fetch.secret_key, NULL)
}
/*-----------------------------
* per-test sanitation/teardown
*-----------------------------
*/
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
} /* for each test case */
@@ -633,14 +625,12 @@ error:
***********/
if (fapl_id < 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
} /* test_fapl_config_validation */
-
/*-------------------------------------------------------------------------
*
* Function: test_ros3_fapl()
@@ -669,15 +659,15 @@ test_ros3_fapl(void)
* test-local variables *
************************/
- hid_t fapl_id = -1; /* file access property list ID */
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- H5FD_ros3_fapl_t ros3_fa_0 = {
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ H5FD_ros3_fapl_t ros3_fa_0 = {
H5FD_CURR_ROS3_FAPL_T_VERSION, /* version */
- FALSE, /* authenticate */
- "", /* aws_region */
- "", /* secret_id */
- "plugh", /* secret_key */
+ FALSE, /* authenticate */
+ "", /* aws_region */
+ "", /* secret_id */
+ "plugh", /* secret_key */
};
TESTING("ROS3 fapl ");
@@ -685,40 +675,37 @@ test_ros3_fapl(void)
/* Set property list and file name for ROS3 driver.
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
+ FAIL_IF(fapl_id < 0)
- FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &ros3_fa_0) )
+ FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &ros3_fa_0))
driver_id = H5Pget_driver(fapl_id);
- FAIL_IF( driver_id < 0 )
+ FAIL_IF(driver_id < 0)
/****************
* Check that the VFD feature flags are correct
* SPEC MAY CHANGE
******************/
- FAIL_IF( H5FDdriver_query(driver_id, &driver_flags) < 0 )
+ FAIL_IF(H5FDdriver_query(driver_id, &driver_flags) < 0)
- JSVERIFY_NOT( 0, (driver_flags & H5FD_FEAT_DATA_SIEVE),
- "bit(s) in `driver_flags` must align with "
- "H5FD_FEAT_DATA_SIEVE" )
+ JSVERIFY_NOT(0, (driver_flags & H5FD_FEAT_DATA_SIEVE),
+ "bit(s) in `driver_flags` must align with "
+ "H5FD_FEAT_DATA_SIEVE")
- JSVERIFY( H5FD_FEAT_DATA_SIEVE, driver_flags,
- "H5FD_FEAT_DATA_SIEVE should be the only supported flag")
+ JSVERIFY(H5FD_FEAT_DATA_SIEVE, driver_flags, "H5FD_FEAT_DATA_SIEVE should be the only supported flag")
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
return 1;
} /* test_ros3_fapl() */
-
/*---------------------------------------------------------------------------
*
* Function: test_vfd_open()
@@ -745,7 +732,6 @@ test_vfd_open(void)
* test-local macros *
*********************/
-
#define FAPL_H5P_DEFAULT -2
#define FAPL_FILE_ACCESS -3
#define FAPL_ROS3_ANON -4
@@ -767,73 +753,83 @@ test_vfd_open(void)
************************/
struct test_condition tests[] = {
- { "default property list (H5P_DEFAULT) is invalid",
+ {
+ "default property list (H5P_DEFAULT) is invalid",
url_text_public,
H5F_ACC_RDONLY,
FAPL_H5P_DEFAULT,
MAXADDR,
},
- { "generic file access property list is invalid",
+ {
+ "generic file access property list is invalid",
url_text_public,
H5F_ACC_RDONLY,
FAPL_FILE_ACCESS,
MAXADDR,
},
- { "filename cannot be null",
+ {
+ "filename cannot be null",
NULL,
H5F_ACC_RDONLY,
FAPL_ROS3_ANON,
MAXADDR,
},
- { "filename cannot be empty",
+ {
+ "filename cannot be empty",
"",
H5F_ACC_RDONLY,
FAPL_ROS3_ANON,
MAXADDR,
},
- { "filename must exist",
+ {
+ "filename must exist",
url_missing,
H5F_ACC_RDONLY,
FAPL_ROS3_ANON,
MAXADDR,
},
- { "read-write flag not supported",
+ {
+ "read-write flag not supported",
url_text_public,
H5F_ACC_RDWR,
FAPL_ROS3_ANON,
MAXADDR,
},
- { "truncate flag not supported",
+ {
+ "truncate flag not supported",
url_text_public,
H5F_ACC_TRUNC,
FAPL_ROS3_ANON,
MAXADDR,
},
- { "create flag not supported",
+ {
+ "create flag not supported",
url_text_public,
H5F_ACC_CREAT,
FAPL_ROS3_ANON,
MAXADDR,
},
- { "EXCL flag not supported",
+ {
+ "EXCL flag not supported",
url_text_public,
H5F_ACC_EXCL,
FAPL_ROS3_ANON,
MAXADDR,
},
- { "maxaddr cannot be 0 (caught in `H5FD_open()`)",
+ {
+ "maxaddr cannot be 0 (caught in `H5FD_open()`)",
url_text_public,
H5F_ACC_RDONLY,
FAPL_ROS3_ANON,
0,
},
};
- H5FD_t *fd = NULL;
- hbool_t curl_ready = FALSE;
- hid_t fapl_id = -1;
- hid_t fapl_file_access = -1;
- unsigned i = 0;
- unsigned tests_count = 10;
+ H5FD_t * fd = NULL;
+ hbool_t curl_ready = FALSE;
+ hid_t fapl_id = -1;
+ hid_t fapl_file_access = -1;
+ unsigned i = 0;
+ unsigned tests_count = 10;
TESTING("ROS3 VFD-level open");
@@ -844,15 +840,15 @@ test_vfd_open(void)
return 0;
}
- FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) )
+ FAIL_IF(CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT))
curl_ready = TRUE;
fapl_file_access = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_file_access < 0 )
+ FAIL_IF(fapl_file_access < 0)
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &anonymous_fa) )
+ FAIL_IF(fapl_id < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &anonymous_fa))
/*********
* TESTS *
@@ -861,8 +857,8 @@ test_vfd_open(void)
/* all the test cases that will _not_ open
*/
for (i = 0; i < tests_count; i++) {
- struct test_condition T = tests[i];
- hid_t _fapl_id = H5P_DEFAULT;
+ struct test_condition T = tests[i];
+ hid_t _fapl_id = H5P_DEFAULT;
fd = NULL;
@@ -871,35 +867,30 @@ test_vfd_open(void)
else if (T.which_fapl == FAPL_ROS3_ANON)
_fapl_id = fapl_id;
- H5E_BEGIN_TRY {
- fd = H5FDopen(T.url, T.flags, _fapl_id, T.maxaddr);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fd = H5FDopen(T.url, T.flags, _fapl_id, T.maxaddr); }
+ H5E_END_TRY;
if (NULL != fd)
JSVERIFY(1, 0, T.message); /* wrapper to print message and fail */
}
- FAIL_IF( NULL != fd )
+ FAIL_IF(NULL != fd)
/* finally, show that a file can be opened
*/
- fd = H5FDopen(
- url_text_public,
- H5F_ACC_RDONLY,
- fapl_id,
- MAXADDR);
- FAIL_IF( NULL == fd )
+ fd = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, MAXADDR);
+ FAIL_IF(NULL == fd)
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(fd) )
+ FAIL_IF(FAIL == H5FDclose(fd))
fd = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
- FAIL_IF( FAIL == H5Pclose(fapl_file_access) )
+ FAIL_IF(FAIL == H5Pclose(fapl_file_access))
fapl_file_access = -1;
curl_global_cleanup();
@@ -917,14 +908,12 @@ error:
(void)H5FDclose(fd);
}
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
if (fapl_file_access >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_file_access);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_file_access); }
+ H5E_END_TRY;
}
if (curl_ready == TRUE) {
curl_global_cleanup();
@@ -938,7 +927,6 @@ error:
} /* test_vfd_open */
-
/*---------------------------------------------------------------------------
*
* Function: test_eof_eoa()
@@ -973,9 +961,9 @@ test_eof_eoa(void)
* test-local variables *
************************/
- H5FD_t *fd_shakespeare = NULL;
- hbool_t curl_ready = FALSE;
- hid_t fapl_id = -1;
+ H5FD_t *fd_shakespeare = NULL;
+ hbool_t curl_ready = FALSE;
+ hid_t fapl_id = -1;
TESTING("ROS3 eof/eoa gets and sets");
@@ -997,19 +985,15 @@ test_eof_eoa(void)
* SETUP *
*********/
- FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) )
+ FAIL_IF(CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT))
curl_ready = TRUE;
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( 0 > fapl_id )
- FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) )
+ FAIL_IF(0 > fapl_id)
+ FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa))
- fd_shakespeare = H5FDopen(
- url_text_restricted,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == fd_shakespeare )
+ fd_shakespeare = H5FDopen(url_text_restricted, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
+ FAIL_IF(NULL == fd_shakespeare)
/*********
* TESTS *
@@ -1017,45 +1001,30 @@ test_eof_eoa(void)
/* verify as found
*/
- JSVERIFY( 5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL )
- JSVERIFY( H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
- "mismatch between DEFAULT and RAW memory types" )
- JSVERIFY( 0,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoA should be unset by H5FDopen" )
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL)
+ JSVERIFY(H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
+ "mismatch between DEFAULT and RAW memory types")
+ JSVERIFY(0, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA should be unset by H5FDopen")
/* set EoA below EoF
*/
- JSVERIFY( SUCCEED,
- H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202),
- "unable to set EoA (lower)" )
- JSVERIFY( 5458199,
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoF changed" )
- JSVERIFY( 44442202,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoA unchanged" )
+ JSVERIFY(SUCCEED, H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202), "unable to set EoA (lower)")
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed")
+ JSVERIFY(44442202, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA unchanged")
/* set EoA above EoF
*/
- JSVERIFY( SUCCEED,
- H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012),
- "unable to set EoA (higher)" )
- JSVERIFY( 5458199,
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoF changed" )
- JSVERIFY( 6789012,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoA unchanged" )
+ JSVERIFY(SUCCEED, H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012), "unable to set EoA (higher)")
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed")
+ JSVERIFY(6789012, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA unchanged")
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(fd_shakespeare) )
+ FAIL_IF(FAIL == H5FDclose(fd_shakespeare))
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
curl_global_cleanup();
@@ -1069,19 +1038,19 @@ error:
* CLEANUP *
***********/
- if (fd_shakespeare) (void)H5FDclose(fd_shakespeare);
- if (TRUE == curl_ready) curl_global_cleanup();
+ if (fd_shakespeare)
+ (void)H5FDclose(fd_shakespeare);
+ if (TRUE == curl_ready)
+ curl_global_cleanup();
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
} /* test_eof_eoa */
-
/*-----------------------------------------------------------------------------
*
* Function: test_H5FDread_without_eoa_set_fails()
@@ -1099,10 +1068,10 @@ error:
static int
test_H5FDread_without_eoa_set_fails(void)
{
- char buffer[256];
- unsigned int i = 0;
- H5FD_t *file_shakespeare = NULL;
- hid_t fapl_id = -1;
+ char buffer[256];
+ unsigned int i = 0;
+ H5FD_t * file_shakespeare = NULL;
+ hid_t fapl_id = -1;
TESTING("ROS3 VFD read-eoa temporal coupling library limitation ");
@@ -1127,18 +1096,13 @@ test_H5FDread_without_eoa_set_fails(void)
/* create ROS3 fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) )
+ FAIL_IF(fapl_id < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa))
- file_shakespeare = H5FDopen(
- url_text_restricted,
- H5F_ACC_RDONLY,
- fapl_id,
- MAXADDR);
- FAIL_IF( NULL == file_shakespeare )
+ file_shakespeare = H5FDopen(url_text_restricted, H5F_ACC_RDONLY, fapl_id, MAXADDR);
+ FAIL_IF(NULL == file_shakespeare)
- JSVERIFY( 0, H5FDget_eoa(file_shakespeare, H5FD_MEM_DEFAULT),
- "EoA should remain unset by H5FDopen" )
+ JSVERIFY(0, H5FDget_eoa(file_shakespeare, H5FD_MEM_DEFAULT), "EoA should remain unset by H5FDopen")
for (i = 0; i < 256; i++)
buffer[i] = 0; /* zero buffer contents */
@@ -1147,26 +1111,19 @@ test_H5FDread_without_eoa_set_fails(void)
* TEST *
********/
- H5E_BEGIN_TRY { /* mute stack trace on expected failure */
- JSVERIFY( FAIL,
- H5FDread(file_shakespeare,
- H5FD_MEM_DRAW,
- H5P_DEFAULT,
- 1200699,
- 102,
- buffer),
- "cannot read before eoa is set" )
- } H5E_END_TRY;
- JSVERIFY_STR( "", buffer, "buffer should remain untouched" )
+ H5E_BEGIN_TRY{/* mute stack trace on expected failure */
+ JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer),
+ "cannot read before eoa is set")} H5E_END_TRY;
+ JSVERIFY_STR("", buffer, "buffer should remain untouched")
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(file_shakespeare) )
+ FAIL_IF(FAIL == H5FDclose(file_shakespeare))
file_shakespeare = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1177,19 +1134,18 @@ error:
* CLEANUP *
***********/
- if (file_shakespeare) { (void)H5FDclose(file_shakespeare); }
+ if (file_shakespeare) {
+ (void)H5FDclose(file_shakespeare);
+ }
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
} /* test_H5FDread_without_eoa_set_fails */
-
-
/*---------------------------------------------------------------------------
*
* Function: test_read()
@@ -1230,42 +1186,48 @@ test_read(void)
* test-local variables *
************************/
struct testcase cases[] = {
- { "successful range-get",
+ {
+ "successful range-get",
6464,
5691,
32, /* fancy quotes are three bytes each(?) */
SUCCEED,
"Quoth the Raven “Nevermore.”",
},
- { "read past EOA fails (EOA < EOF < addr)",
+ {
+ "read past EOA fails (EOA < EOF < addr)",
3000,
4000,
100,
FAIL,
NULL,
},
- { "read overlapping EOA fails (EOA < addr < EOF < (addr+len))",
+ {
+ "read overlapping EOA fails (EOA < addr < EOF < (addr+len))",
3000,
8000,
100,
FAIL,
NULL,
},
- { "read past EOA/EOF fails ((EOA==EOF) < addr)",
+ {
+ "read past EOA/EOF fails ((EOA==EOF) < addr)",
6464,
7000,
100,
FAIL,
NULL,
},
- { "read overlapping EOA/EOF fails (addr < (EOA==EOF) < (addr+len))",
+ {
+ "read overlapping EOA/EOF fails (addr < (EOA==EOF) < (addr+len))",
6464,
6400,
100,
FAIL,
NULL,
},
- { "read between EOF and EOA fails (EOF < addr < (addr+len) < EOA)",
+ {
+ "read between EOF and EOA fails (EOF < addr < (addr+len) < EOA)",
8000,
7000,
100,
@@ -1273,14 +1235,14 @@ test_read(void)
NULL,
},
};
- unsigned testcase_count = 6;
- unsigned test_i = 0;
- struct testcase test;
- herr_t open_return = FAIL;
- char buffer[S3_TEST_MAX_URL_SIZE];
- unsigned int i = 0;
- H5FD_t *file_raven = NULL;
- hid_t fapl_id = -1;
+ unsigned testcase_count = 6;
+ unsigned test_i = 0;
+ struct testcase test;
+ herr_t open_return = FAIL;
+ char buffer[S3_TEST_MAX_URL_SIZE];
+ unsigned int i = 0;
+ H5FD_t * file_raven = NULL;
+ hid_t fapl_id = -1;
TESTING("ROS3 VFD read/range-gets");
@@ -1305,19 +1267,19 @@ test_read(void)
/* create ROS3 fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) )
+ FAIL_IF(fapl_id < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa))
/* open file
*/
- file_raven = H5FDopen( /* will open with "authenticating" fapl */
- url_text_public, /* TODO: check return state: anon access of restricted says OK? (not NULL) */
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF); /* Demonstrate success with "automatic" value */
- FAIL_IF( NULL == file_raven )
+ file_raven =
+ H5FDopen( /* will open with "authenticating" fapl */
+ url_text_public, /* TODO: check return state: anon access of restricted says OK? (not NULL)
+ */
+ H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF); /* Demonstrate success with "automatic" value */
+ FAIL_IF(NULL == file_raven)
- JSVERIFY( 6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL )
+ JSVERIFY(6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL)
/*********
* TESTS *
@@ -1332,10 +1294,9 @@ test_read(void)
test = cases[test_i];
open_return = FAIL;
- FAIL_IF( S3_TEST_MAX_URL_SIZE < test.len ) /* buffer too small! */
+ FAIL_IF(S3_TEST_MAX_URL_SIZE < test.len) /* buffer too small! */
- FAIL_IF( FAIL ==
- H5FD_set_eoa( file_raven, H5FD_MEM_DEFAULT, test.eoa_set) )
+ FAIL_IF(FAIL == H5FD_set_eoa(file_raven, H5FD_MEM_DEFAULT, test.eoa_set))
for (i = 0; i < S3_TEST_MAX_URL_SIZE; i++) /* zero buffer contents */
buffer[i] = 0;
@@ -1344,21 +1305,15 @@ test_read(void)
* conduct test *
* ------------ */
- H5E_BEGIN_TRY {
- open_return = H5FDread(
- file_raven,
- H5FD_MEM_DRAW,
- H5P_DEFAULT,
- test.addr,
- test.len,
- buffer);
- } H5E_END_TRY;
-
- JSVERIFY( test.success,
- open_return,
- test.message )
+ H5E_BEGIN_TRY
+ {
+ open_return = H5FDread(file_raven, H5FD_MEM_DRAW, H5P_DEFAULT, test.addr, test.len, buffer);
+ }
+ H5E_END_TRY;
+
+ JSVERIFY(test.success, open_return, test.message)
if (open_return == SUCCEED)
- JSVERIFY_STR( test.expected, buffer, NULL )
+ JSVERIFY_STR(test.expected, buffer, NULL)
} /* for each testcase */
@@ -1366,10 +1321,10 @@ test_read(void)
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(file_raven) )
+ FAIL_IF(FAIL == H5FDclose(file_raven))
file_raven = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1383,16 +1338,14 @@ error:
if (file_raven)
(void)H5FDclose(file_raven);
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
} /* test_read */
-
/*---------------------------------------------------------------------------
*
* Function: test_noops_and_autofails()
@@ -1427,14 +1380,13 @@ test_noops_and_autofails(void)
* test-local variables *
************************/
- hbool_t curl_ready = FALSE;
- hid_t fapl_id = -1;
- H5FD_t *file = NULL;
- const char data[36] = "The Force shall be with you, always";
+ hbool_t curl_ready = FALSE;
+ hid_t fapl_id = -1;
+ H5FD_t * file = NULL;
+ const char data[36] = "The Force shall be with you, always";
TESTING("ROS3 VFD always-fail and no-op routines");
-
if (FALSE == s3_test_bucket_defined) {
SKIPPED();
puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
@@ -1446,23 +1398,19 @@ test_noops_and_autofails(void)
* SETUP *
*********/
- FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) )
+ FAIL_IF(CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT))
curl_ready = TRUE;
/* create ROS3 fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- JSVERIFY( SUCCEED, H5Pset_fapl_ros3(fapl_id, &anonymous_fa), NULL )
+ FAIL_IF(fapl_id < 0)
+ JSVERIFY(SUCCEED, H5Pset_fapl_ros3(fapl_id, &anonymous_fa), NULL)
/* open file
*/
- file = H5FDopen(
- url_text_public,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == file )
+ file = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
+ FAIL_IF(NULL == file)
/*********
* TESTS *
@@ -1470,35 +1418,19 @@ test_noops_and_autofails(void)
/* auto-fail calls to write and truncate
*/
- H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
- H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data),
- "write must fail" )
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
- H5FDtruncate(file, H5P_DEFAULT, FALSE),
- "truncate must fail" )
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
- H5FDtruncate(file, H5P_DEFAULT, TRUE),
- "truncate must fail (closing)" )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data),
+ "write must fail")} H5E_END_TRY;
+
+ H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, FALSE), "truncate must fail")} H5E_END_TRY;
+
+ H5E_BEGIN_TRY{
+ JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), "truncate must fail (closing)")} H5E_END_TRY;
/* no-op calls to `lock()` and `unlock()`
*/
- JSVERIFY( SUCCEED,
- H5FDlock(file, TRUE),
- "lock always succeeds; has no effect" )
- JSVERIFY( SUCCEED,
- H5FDlock(file, FALSE),
- NULL )
- JSVERIFY( SUCCEED,
- H5FDunlock(file),
- NULL )
+ JSVERIFY(SUCCEED, H5FDlock(file, TRUE), "lock always succeeds; has no effect")
+ JSVERIFY(SUCCEED, H5FDlock(file, FALSE), NULL)
+ JSVERIFY(SUCCEED, H5FDunlock(file), NULL)
/* Lock/unlock with null file or similar error crashes tests.
* HDassert in calling heirarchy, `H5FD[un]lock()` and `H5FD_[un]lock()`
*/
@@ -1507,10 +1439,10 @@ test_noops_and_autofails(void)
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(file) )
+ FAIL_IF(FAIL == H5FDclose(file))
file = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
curl_global_cleanup();
@@ -1525,18 +1457,20 @@ error:
***********/
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
+ }
+ if (file) {
+ (void)H5FDclose(file);
+ }
+ if (curl_ready == TRUE) {
+ curl_global_cleanup();
}
- if (file) { (void)H5FDclose(file); }
- if (curl_ready == TRUE) { curl_global_cleanup(); }
return 1;
} /* test_noops_and_autofails*/
-
/*---------------------------------------------------------------------------
*
* Function: test_cmp()
@@ -1571,11 +1505,11 @@ test_cmp(void)
* test-local variables *
************************/
- H5FD_t *fd_raven = NULL;
- H5FD_t *fd_shakes = NULL;
- H5FD_t *fd_raven_2 = NULL;
- hbool_t curl_ready = FALSE;
- hid_t fapl_id = -1;
+ H5FD_t *fd_raven = NULL;
+ H5FD_t *fd_shakes = NULL;
+ H5FD_t *fd_raven_2 = NULL;
+ hbool_t curl_ready = FALSE;
+ hid_t fapl_id = -1;
TESTING("ROS3 cmp (comparison)");
@@ -1597,54 +1531,41 @@ test_cmp(void)
* SETUP *
*********/
- FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) )
+ FAIL_IF(CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT))
curl_ready = TRUE;
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( 0 > fapl_id )
- JSVERIFY( SUCCEED, H5Pset_fapl_ros3(fapl_id, &restricted_access_fa),
- NULL )
+ FAIL_IF(0 > fapl_id)
+ JSVERIFY(SUCCEED, H5Pset_fapl_ros3(fapl_id, &restricted_access_fa), NULL)
- fd_raven = H5FDopen(
- url_text_public,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == fd_raven )
+ fd_raven = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
+ FAIL_IF(NULL == fd_raven)
- fd_shakes = H5FDopen(
- url_text_restricted,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == fd_shakes )
+ fd_shakes = H5FDopen(url_text_restricted, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
+ FAIL_IF(NULL == fd_shakes)
- fd_raven_2 = H5FDopen(
- url_text_public,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == fd_raven_2 )
+ fd_raven_2 = H5FDopen(url_text_public, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
+ FAIL_IF(NULL == fd_raven_2)
/*********
* TESTS *
*********/
- JSVERIFY( 0, H5FDcmp(fd_raven, fd_raven_2), NULL )
- JSVERIFY( -1, H5FDcmp(fd_raven, fd_shakes), NULL )
- JSVERIFY( -1, H5FDcmp(fd_shakes, fd_raven_2), NULL )
+ JSVERIFY(0, H5FDcmp(fd_raven, fd_raven_2), NULL)
+ JSVERIFY(-1, H5FDcmp(fd_raven, fd_shakes), NULL)
+ JSVERIFY(-1, H5FDcmp(fd_shakes, fd_raven_2), NULL)
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(fd_raven) )
+ FAIL_IF(FAIL == H5FDclose(fd_raven))
fd_raven = NULL;
- FAIL_IF( FAIL == H5FDclose(fd_shakes) )
+ FAIL_IF(FAIL == H5FDclose(fd_shakes))
fd_shakes = NULL;
- FAIL_IF( FAIL == H5FDclose(fd_raven_2) )
+ FAIL_IF(FAIL == H5FDclose(fd_raven_2))
fd_raven_2 = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
curl_global_cleanup();
@@ -1658,21 +1579,23 @@ error:
* CLEANUP *
***********/
- if (fd_raven != NULL) (void)H5FDclose(fd_raven);
- if (fd_raven_2 != NULL) (void)H5FDclose(fd_raven_2);
- if (fd_shakes != NULL) (void)H5FDclose(fd_shakes);
- if (TRUE == curl_ready) curl_global_cleanup();
+ if (fd_raven != NULL)
+ (void)H5FDclose(fd_raven);
+ if (fd_raven_2 != NULL)
+ (void)H5FDclose(fd_raven_2);
+ if (fd_shakes != NULL)
+ (void)H5FDclose(fd_shakes);
+ if (TRUE == curl_ready)
+ curl_global_cleanup();
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
} /* test_cmp */
-
/*---------------------------------------------------------------------------
*
* Function: test_H5F_integration()
@@ -1730,8 +1653,8 @@ test_H5F_integration(void)
*********/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( 0 > fapl_id )
- FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) )
+ FAIL_IF(0 > fapl_id)
+ FAIL_IF(FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa))
/*********
* TESTS *
@@ -1739,39 +1662,25 @@ test_H5F_integration(void)
/* Read-Write Open access is not allowed with this file driver.
*/
- H5E_BEGIN_TRY {
- FAIL_IF( 0 <= H5Fopen(
- url_h5_public,
- H5F_ACC_RDWR,
- fapl_id) )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fopen(url_h5_public, H5F_ACC_RDWR, fapl_id))} H5E_END_TRY;
/* H5Fcreate() is not allowed with this file driver.
*/
- H5E_BEGIN_TRY {
- FAIL_IF( 0 <= H5Fcreate(
- url_missing,
- H5F_ACC_RDONLY,
- H5P_DEFAULT,
- fapl_id) )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fcreate(url_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY;
/* Successful open.
*/
- file = H5Fopen(
- url_h5_public,
- H5F_ACC_RDONLY,
- fapl_id);
- FAIL_IF( file < 0 )
+ file = H5Fopen(url_h5_public, H5F_ACC_RDONLY, fapl_id);
+ FAIL_IF(file < 0)
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5Fclose(file) )
+ FAIL_IF(FAIL == H5Fclose(file))
file = -1;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1781,12 +1690,12 @@ error:
/***********
* CLEANUP *
***********/
-HDprintf("\nerror!"); fflush(stdout);
+ HDprintf("\nerror!");
+ fflush(stdout);
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
if (file > 0)
(void)H5Fclose(file);
@@ -1797,7 +1706,6 @@ HDprintf("\nerror!"); fflush(stdout);
#endif /* H5_HAVE_ROS3_VFD */
-
/*-------------------------------------------------------------------------
*
* Function: main
@@ -1816,7 +1724,7 @@ int
main(void)
{
#ifdef H5_HAVE_ROS3_VFD
- int nerrors = 0;
+ int nerrors = 0;
const char *bucket_url_env = NULL;
#endif /* H5_HAVE_ROS3_VFD */
@@ -1831,50 +1739,35 @@ main(void)
bucket_url_env = HDgetenv("HDF5_ROS3_TEST_BUCKET_URL");
if (bucket_url_env == NULL || bucket_url_env[0] == '\0') {
- HDprintf("WARNING: S3 bucket url is not defined in enviornment " \
+ HDprintf("WARNING: S3 bucket url is not defined in enviornment "
"variable 'HDF5_ROS3_TEST_BUCKET_URL'!\n");
- } else {
+ }
+ else {
HDstrncpy(s3_test_bucket_url, bucket_url_env, S3_TEST_MAX_URL_SIZE);
s3_test_bucket_defined = TRUE;
}
- if (S3_TEST_MAX_URL_SIZE < HDsnprintf(
- url_text_restricted,
- (size_t)S3_TEST_MAX_URL_SIZE,
- "%s/%s",
- (const char *)s3_test_bucket_url,
- (const char *)S3_TEST_RESOURCE_TEXT_RESTRICTED))
- {
+ if (S3_TEST_MAX_URL_SIZE < HDsnprintf(url_text_restricted, (size_t)S3_TEST_MAX_URL_SIZE, "%s/%s",
+ (const char *)s3_test_bucket_url,
+ (const char *)S3_TEST_RESOURCE_TEXT_RESTRICTED)) {
HDprintf("* ros3 setup failed (text_restricted) ! *\n");
return 1;
}
- if (S3_TEST_MAX_URL_SIZE < HDsnprintf(
- url_text_public,
- (size_t)S3_TEST_MAX_URL_SIZE,
- "%s/%s",
- (const char *)s3_test_bucket_url,
- (const char *)S3_TEST_RESOURCE_TEXT_PUBLIC))
- {
+ if (S3_TEST_MAX_URL_SIZE < HDsnprintf(url_text_public, (size_t)S3_TEST_MAX_URL_SIZE, "%s/%s",
+ (const char *)s3_test_bucket_url,
+ (const char *)S3_TEST_RESOURCE_TEXT_PUBLIC)) {
HDprintf("* ros3 setup failed (text_public) ! *\n");
return 1;
}
- if (S3_TEST_MAX_URL_SIZE < HDsnprintf(
- url_h5_public,
- (size_t)S3_TEST_MAX_URL_SIZE,
- "%s/%s",
- (const char *)s3_test_bucket_url,
- (const char *)S3_TEST_RESOURCE_H5_PUBLIC))
- {
+ if (S3_TEST_MAX_URL_SIZE < HDsnprintf(url_h5_public, (size_t)S3_TEST_MAX_URL_SIZE, "%s/%s",
+ (const char *)s3_test_bucket_url,
+ (const char *)S3_TEST_RESOURCE_H5_PUBLIC)) {
HDprintf("* ros3 setup failed (h5_public) ! *\n");
return 1;
}
- if (S3_TEST_MAX_URL_SIZE < HDsnprintf(
- url_missing,
- S3_TEST_MAX_URL_SIZE,
- "%s/%s",
- (const char *)s3_test_bucket_url,
- (const char *)S3_TEST_RESOURCE_MISSING))
- {
+ if (S3_TEST_MAX_URL_SIZE < HDsnprintf(url_missing, S3_TEST_MAX_URL_SIZE, "%s/%s",
+ (const char *)s3_test_bucket_url,
+ (const char *)S3_TEST_RESOURCE_MISSING)) {
HDprintf("* ros3 setup failed (missing) ! *\n");
return 1;
}
@@ -1891,22 +1784,15 @@ main(void)
/* attempt to load test credentials
* if unable, certain tests will be skipped
*/
- if (SUCCEED == H5FD_s3comms_load_aws_profile(
- S3_TEST_PROFILE_NAME,
- s3_test_aws_access_key_id,
- s3_test_aws_secret_access_key,
- s3_test_aws_region))
- {
+ if (SUCCEED == H5FD_s3comms_load_aws_profile(S3_TEST_PROFILE_NAME, s3_test_aws_access_key_id,
+ s3_test_aws_secret_access_key, s3_test_aws_region)) {
s3_test_credentials_loaded = 1;
- HDstrncpy(restricted_access_fa.aws_region,
- (const char *)s3_test_aws_region,
- H5FD_ROS3_MAX_REGION_LEN);
- HDstrncpy(restricted_access_fa.secret_id,
- (const char *)s3_test_aws_access_key_id,
- H5FD_ROS3_MAX_SECRET_ID_LEN);
- HDstrncpy(restricted_access_fa.secret_key,
- (const char *)s3_test_aws_secret_access_key,
- H5FD_ROS3_MAX_SECRET_KEY_LEN);
+ HDstrncpy(restricted_access_fa.aws_region, (const char *)s3_test_aws_region,
+ H5FD_ROS3_MAX_REGION_LEN);
+ HDstrncpy(restricted_access_fa.secret_id, (const char *)s3_test_aws_access_key_id,
+ H5FD_ROS3_MAX_SECRET_ID_LEN);
+ HDstrncpy(restricted_access_fa.secret_key, (const char *)s3_test_aws_secret_access_key,
+ H5FD_ROS3_MAX_SECRET_KEY_LEN);
}
/******************
@@ -1926,11 +1812,10 @@ main(void)
nerrors += test_H5F_integration();
if (nerrors > 0) {
- HDprintf("***** %d ros3 TEST%s FAILED! *****\n",
- nerrors,
- nerrors > 1 ? "S" : "");
+ HDprintf("***** %d ros3 TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
nerrors = 1;
- } else {
+ }
+ else {
HDprintf("All ros3 tests passed.\n");
}
return nerrors; /* 0 if no errors, 1 if any errors */
@@ -1943,4 +1828,3 @@ main(void)
#endif /* H5_HAVE_ROS3_VFD */
} /* main() */
-
diff --git a/test/s3comms.c b/test/s3comms.c
index ef48d7a..862914e 100644
--- a/test/s3comms.c
+++ b/test/s3comms.c
@@ -67,7 +67,6 @@
*
*****************************************************************************/
-
/*----------------------------------------------------------------------------
*
* ifdef flag: JSVERIFY_EXP_ACT
@@ -79,7 +78,6 @@
*/
#define JSVERIFY_EXP_ACT 1L
-
/*----------------------------------------------------------------------------
*
* Macro: JSFAILED_AT()
@@ -96,10 +94,10 @@
*
*----------------------------------------------------------------------------
*/
-#define JSFAILED_AT() { \
- HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \
-}
-
+#define JSFAILED_AT() \
+ { \
+ HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \
+ }
/*----------------------------------------------------------------------------
*
@@ -124,12 +122,11 @@
*
*----------------------------------------------------------------------------
*/
-#define FAIL_IF(condition) \
-if (condition) { \
- JSFAILED_AT() \
- goto error; \
-}
-
+#define FAIL_IF(condition) \
+ if (condition) { \
+ JSFAILED_AT() \
+ goto error; \
+ }
/*----------------------------------------------------------------------------
*
@@ -153,12 +150,11 @@ if (condition) { \
*
*----------------------------------------------------------------------------
*/
-#define FAIL_UNLESS(condition) \
-if (!(condition)) { \
- JSFAILED_AT() \
- goto error; \
-}
-
+#define FAIL_UNLESS(condition) \
+ if (!(condition)) { \
+ JSFAILED_AT() \
+ goto error; \
+ }
/*----------------------------------------------------------------------------
*
@@ -190,16 +186,17 @@ jserr_long(long expected, long actual, const char *reason)
{
if (reason != NULL) {
HDprintf("%s\n", reason);
- } else {
+ }
+ else {
HDprintf(" ! Expected %ld\n ! Actual %ld\n", expected, actual);
}
}
-#define JSERR_LONG(expected, actual, reason) { \
- JSFAILED_AT() \
- jserr_long((long)(expected), (long)(actual), reason);\
-}
-
+#define JSERR_LONG(expected, actual, reason) \
+ { \
+ JSFAILED_AT() \
+ jserr_long((long)(expected), (long)(actual), reason); \
+ }
/*----------------------------------------------------------------------------
*
@@ -234,21 +231,22 @@ jserr_str(const char *expected, const char *actual, const char *reason)
{
if (reason != NULL) {
HDprintf("%s\n", reason);
- } else {
+ }
+ else {
HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", expected, actual);
}
}
-#define JSERR_STR(expected, actual, reason) { \
- JSFAILED_AT() \
- jserr_str((expected), (actual), (reason)); \
-}
+#define JSERR_STR(expected, actual, reason) \
+ { \
+ JSFAILED_AT() \
+ jserr_str((expected), (actual), (reason)); \
+ }
#ifdef JSVERIFY_EXP_ACT
/* VERIFY rountines with paramter order (<expected>, <actual> [, <msg> ])
*/
-
/*----------------------------------------------------------------------------
*
* Macro: JSVERIFY()
@@ -265,11 +263,11 @@ jserr_str(const char *expected, const char *actual, const char *reason)
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY(expected, actual, reason) \
-if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY */
+#define JSVERIFY(expected, actual, reason) \
+ if ((long)(actual) != (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY */
#if 0 /* UNUSED */
@@ -289,14 +287,13 @@ if ((long)(actual) != (long)(expected)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_NOT(expected, actual, reason) \
-if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY_NOT */
+#define JSVERIFY_NOT(expected, actual, reason) \
+ if ((long)(actual) == (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY_NOT */
#endif /* JSVERIFY_NOT unused */
-
/*----------------------------------------------------------------------------
*
* Macro: JSVERIFY_STR()
@@ -313,12 +310,11 @@ if ((long)(actual) == (long)(expected)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_STR(expected, actual, reason) \
-if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY_STR */
-
+#define JSVERIFY_STR(expected, actual, reason) \
+ if (strcmp((actual), (expected)) != 0) { \
+ JSERR_STR((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY_STR */
#else
/* JSVERIFY_EXP_ACT not defined
@@ -326,7 +322,6 @@ if (strcmp((actual), (expected)) != 0) { \
* Repeats macros above, but with actual/expected parameters reversed.
*/
-
/*----------------------------------------------------------------------------
* Macro: JSVERIFY()
* See: JSVERIFY documentation above.
@@ -334,11 +329,11 @@ if (strcmp((actual), (expected)) != 0) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY(actual, expected, reason) \
-if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY */
+#define JSVERIFY(actual, expected, reason) \
+ if ((long)(actual) != (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY */
#if 0 /* UNUSED */
@@ -349,14 +344,13 @@ if ((long)(actual) != (long)(expected)) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_NOT(actual, expected, reason) \
-if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY_NOT */
+#define JSVERIFY_NOT(actual, expected, reason) \
+ if ((long)(actual) == (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY_NOT */
#endif /* JSVERIFY_NOT unused */
-
/*----------------------------------------------------------------------------
* Macro: JSVERIFY_STR()
* See: JSVERIFY_STR documentation above.
@@ -364,22 +358,21 @@ if ((long)(actual) == (long)(expected)) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_STR(actual, expected, reason) \
-if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY_STR */
+#define JSVERIFY_STR(actual, expected, reason) \
+ if (strcmp((actual), (expected)) != 0) { \
+ JSERR_STR((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY_STR */
#endif /* ifdef/else JSVERIFY_EXP_ACT */
-
#define S3_TEST_PROFILE_NAME "ros3_vfd_test"
#define S3_TEST_RESOURCE_TEXT_RESTRICTED "t8.shakespeare.txt"
-#define S3_TEST_RESOURCE_TEXT_PUBLIC "Poe_Raven.txt"
-#define S3_TEST_RESOURCE_MISSING "missing.csv"
+#define S3_TEST_RESOURCE_TEXT_PUBLIC "Poe_Raven.txt"
+#define S3_TEST_RESOURCE_MISSING "missing.csv"
-#define S3_TEST_RUN_TIMEOUT 0 /* run tests that might hang */
+#define S3_TEST_RUN_TIMEOUT 0 /* run tests that might hang */
#define S3_TEST_MAX_URL_SIZE 256 /* char array size */
/* Global variables for aws test profile.
@@ -394,7 +387,6 @@ static char s3_test_aws_secret_access_key[128] = "";
static char s3_test_bucket_url[S3_TEST_MAX_URL_SIZE] = "";
static hbool_t s3_test_bucket_defined = FALSE;
-
/*---------------------------------------------------------------------------
*
* Function: test_macro_format_credential()
@@ -421,15 +413,13 @@ test_macro_format_credential(void)
const char date[] = "20130524";
const char region[] = "us-east-1";
const char service[] = "s3";
- const char expected[] =
- "AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request";
+ const char expected[] = "AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request";
TESTING("test_macro_format_credential");
- FAIL_IF( S3COMMS_MAX_CREDENTIAL_SIZE <
- S3COMMS_FORMAT_CREDENTIAL(dest, access, date, region, service) )
+ FAIL_IF(S3COMMS_MAX_CREDENTIAL_SIZE < S3COMMS_FORMAT_CREDENTIAL(dest, access, date, region, service))
- JSVERIFY_STR( expected, dest, NULL )
+ JSVERIFY_STR(expected, dest, NULL)
PASSED();
return 0;
@@ -439,7 +429,6 @@ error:
} /* end test_macro_format_credential() */
-
/*---------------------------------------------------------------------------
*
* Function: test_aws_canonical_request()
@@ -470,54 +459,65 @@ test_aws_canonical_request(void)
};
struct testcase {
- const char *exp_request;
- const char *exp_headers;
- const char *verb;
- const char *resource;
- unsigned int listsize;
- struct header list[5];
+ const char * exp_request;
+ const char * exp_headers;
+ const char * verb;
+ const char * resource;
+ unsigned int listsize;
+ struct header list[5];
};
/************************
* test-local variables *
************************/
- struct testcase cases[] = {
- { "GET\n/some/path.file\n\nhost:somebucket.someserver.somedomain\nrange:bytes=150-244\n\nhost;range\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ struct testcase cases[] = {
+ {
+ "GET\n/some/"
+ "path.file\n\nhost:somebucket.someserver.somedomain\nrange:bytes=150-244\n\nhost;"
+ "range\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"host;range",
"GET",
"/some/path.file",
2,
- { {"Range", "bytes=150-244"},
+ {
+ {"Range", "bytes=150-244"},
{"Host", "somebucket.someserver.somedomain"},
},
},
- { "HEAD\n/bucketpath/myfile.dat\n\nhost:place.domain\nx-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-date:19411207T150803Z\n\nhost;x-amz-content-sha256;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
- "host;x-amz-content-sha256;x-amz-date",
- "HEAD",
- "/bucketpath/myfile.dat",
- 3,
- { {"x-amz-content-sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
- {"host", "place.domain"},
- {"x-amz-date", "19411207T150803Z"},
- }
- },
- { "PUT\n/\n\n\n\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ {"HEAD\n/bucketpath/"
+ "myfile.dat\n\nhost:place.domain\nx-amz-content-sha256:"
+ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-date:"
+ "19411207T150803Z\n\nhost;x-amz-content-sha256;x-amz-"
+ "date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "host;x-amz-content-sha256;x-amz-date",
+ "HEAD",
+ "/bucketpath/myfile.dat",
+ 3,
+ {
+ {"x-amz-content-sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
+ {"host", "place.domain"},
+ {"x-amz-date", "19411207T150803Z"},
+ }},
+ {
+ "PUT\n/\n\n\n\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"",
"PUT",
"/",
0,
- {{"",""},}, /* unused; satisfies compiler */
+ {
+ {"", ""},
+ }, /* unused; satisfies compiler */
},
}; /* struct testcase cases[] */
- struct testcase *C = NULL;
- char cr_dest[512]; /* canonical request */
- hrb_t *hrb = NULL; /* http request buffer object */
- unsigned int i = 0; /* looping/indexing */
- unsigned int j = 0; /* looping/indexing */
- hrb_node_t *node = NULL; /* http headers list pointer */
- unsigned int n_cases = 3;
- char sh_dest[64]; /* signed headers */
+ struct testcase *C = NULL;
+ char cr_dest[512]; /* canonical request */
+ hrb_t * hrb = NULL; /* http request buffer object */
+ unsigned int i = 0; /* looping/indexing */
+ unsigned int j = 0; /* looping/indexing */
+ hrb_node_t * node = NULL; /* http headers list pointer */
+ unsigned int n_cases = 3;
+ char sh_dest[64]; /* signed headers */
TESTING("test_aws_canonical_request");
@@ -525,49 +525,40 @@ test_aws_canonical_request(void)
/* pre-test bookkeeping
*/
C = &cases[i];
- for (j = 0; j < 256; j++) { cr_dest[j] = 0; } /* zero request buffer */
- for (j = 0; j < 64; j++) { sh_dest[j] = 0; } /* zero headers buffer */
+ for (j = 0; j < 256; j++) {
+ cr_dest[j] = 0;
+ } /* zero request buffer */
+ for (j = 0; j < 64; j++) {
+ sh_dest[j] = 0;
+ } /* zero headers buffer */
/* create HTTP request object with given verb, resource/path
*/
- hrb = H5FD_s3comms_hrb_init_request(C->verb,
- C->resource,
- "HTTP/1.1");
+ hrb = H5FD_s3comms_hrb_init_request(C->verb, C->resource, "HTTP/1.1");
HDassert(hrb->body == NULL);
/* Create headers list from test case input
*/
for (j = 0; j < C->listsize; j++) {
- FAIL_IF( FAIL ==
- H5FD_s3comms_hrb_node_set(
- &node,
- C->list[j].name,
- C->list[j].value));
+ FAIL_IF(FAIL == H5FD_s3comms_hrb_node_set(&node, C->list[j].name, C->list[j].value));
}
hrb->first_header = node;
/* test
*/
- JSVERIFY( SUCCEED,
- H5FD_s3comms_aws_canonical_request(
- cr_dest,
- 512,
- sh_dest,
- 64,
- hrb),
- " unable to compose canonical request" )
- JSVERIFY_STR( C->exp_headers, sh_dest, NULL )
- JSVERIFY_STR( C->exp_request, cr_dest, NULL )
+ JSVERIFY(SUCCEED, H5FD_s3comms_aws_canonical_request(cr_dest, 512, sh_dest, 64, hrb),
+ " unable to compose canonical request")
+ JSVERIFY_STR(C->exp_headers, sh_dest, NULL)
+ JSVERIFY_STR(C->exp_request, cr_dest, NULL)
/* tear-down
*/
while (node != NULL) {
- FAIL_IF( FAIL ==
- H5FD_s3comms_hrb_node_set(&node, node->name, NULL));
+ FAIL_IF(FAIL == H5FD_s3comms_hrb_node_set(&node, node->name, NULL));
}
HDassert(NULL == node);
- FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb));
+ FAIL_IF(FAIL == H5FD_s3comms_hrb_destroy(&hrb));
HDassert(NULL == hrb);
} /* for each test case */
@@ -576,35 +567,20 @@ test_aws_canonical_request(void)
* ERROR CASES *
***************/
- /* malformed hrb and/or node-list
- */
- JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(
- cr_dest,
- 20,
- sh_dest,
- 20,
- NULL),
- "http request object cannot be null" )
+ /* malformed hrb and/or node-list
+ */
+ JSVERIFY(FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, 20, sh_dest, 20, NULL),
+ "http request object cannot be null")
hrb = H5FD_s3comms_hrb_init_request("GET", "/", "HTTP/1.1");
- JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(
- NULL,
- 20,
- sh_dest,
- 20,
- hrb),
- "canonical request destination cannot be NULL" )
-
- JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(
- cr_dest,
- 20,
- NULL,
- 20,
- hrb),
- "signed headers destination cannot be null" )
-
- FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb) )
- HDassert( NULL == hrb );
+ JSVERIFY(FAIL, H5FD_s3comms_aws_canonical_request(NULL, 20, sh_dest, 20, hrb),
+ "canonical request destination cannot be NULL")
+
+ JSVERIFY(FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, 20, NULL, 20, hrb),
+ "signed headers destination cannot be null")
+
+ FAIL_IF(FAIL == H5FD_s3comms_hrb_destroy(&hrb))
+ HDassert(NULL == hrb);
PASSED();
return 0;
@@ -613,8 +589,8 @@ error:
if (node != NULL) {
while (node != NULL)
- (void)H5FD_s3comms_hrb_node_set(&node, node->name, NULL);
- HDassert( node == NULL );
+ (void)H5FD_s3comms_hrb_node_set(&node, node->name, NULL);
+ HDassert(node == NULL);
}
if (hrb != NULL) {
(void)H5FD_s3comms_hrb_destroy(&hrb);
@@ -624,7 +600,6 @@ error:
} /* end test_aws_canonical_request() */
-
/*---------------------------------------------------------------------------
*
* Function: test_bytes_to_hex
@@ -662,20 +637,20 @@ test_bytes_to_hex(void)
************************/
struct testcase cases[] = {
- { "52F3000C9A",
- {82,243,0,12,154},
+ {
+ "52F3000C9A",
+ {82, 243, 0, 12, 154},
5,
FALSE,
},
- { "009a0cf3005200", /* lowercase alphas */
- {0,154,12,243,0,82,0},
+ {
+ "009a0cf3005200", /* lowercase alphas */
+ {0, 154, 12, 243, 0, 82, 0},
7,
TRUE,
},
- { "",
- {17,63,26,56},
- 0,
- FALSE, /* irrelevant */
+ {
+ "", {17, 63, 26, 56}, 0, FALSE, /* irrelevant */
},
};
int i = 0;
@@ -683,8 +658,6 @@ test_bytes_to_hex(void)
char out[17];
int out_off = 0;
-
-
TESTING("bytes-to-hex");
for (i = 0; i < n_cases; i++) {
@@ -692,25 +665,15 @@ test_bytes_to_hex(void)
out[out_off] = 0;
}
- JSVERIFY( SUCCEED,
- H5FD_s3comms_bytes_to_hex(out,
- cases[i].in,
- cases[i].size,
- cases[i].lower),
- NULL )
+ JSVERIFY(SUCCEED, H5FD_s3comms_bytes_to_hex(out, cases[i].in, cases[i].size, cases[i].lower), NULL)
JSVERIFY_STR(cases[i].exp, out, NULL)
}
/* dest cannot be null
*/
- JSVERIFY( FAIL,
- H5FD_s3comms_bytes_to_hex(
- NULL,
- (const unsigned char *)"nada",
- 5,
- FALSE),
- "destination cannot be null" )
+ JSVERIFY(FAIL, H5FD_s3comms_bytes_to_hex(NULL, (const unsigned char *)"nada", 5, FALSE),
+ "destination cannot be null")
PASSED();
return 0;
@@ -720,7 +683,6 @@ error:
} /* end test_bytes_to_hex() */
-
/*---------------------------------------------------------------------------
*
* Function: test_hrb_init_request()
@@ -759,35 +721,40 @@ test_hrb_init_request(void)
************************/
struct testcase cases[] = {
- { "get HTTP request just as we provided",
+ {
+ "get HTTP request just as we provided",
"GET",
"/path/to/some/file",
"/path/to/some/file",
"HTTP/1.1",
FALSE,
},
- { "null verb substitues to GET",
+ {
+ "null verb substitues to GET",
NULL,
"/MYPATH/MYFILE.tiff",
"/MYPATH/MYFILE.tiff",
"HTTP/1.1",
FALSE,
},
- { "demonstrate non-GET verb",
+ {
+ "demonstrate non-GET verb",
"HEAD",
"/MYPATH/MYFILE.tiff",
"/MYPATH/MYFILE.tiff",
"HTTP/1.1",
FALSE,
},
- { "slash prepended to resource path, if necessary",
+ {
+ "slash prepended to resource path, if necessary",
NULL,
"MYPATH/MYFILE.tiff",
"/MYPATH/MYFILE.tiff",
NULL,
FALSE,
},
- { "null resource path causes problem",
+ {
+ "null resource path causes problem",
"GET",
NULL,
NULL,
@@ -798,36 +765,32 @@ test_hrb_init_request(void)
struct testcase *C = NULL;
unsigned int i = 0;
unsigned int ncases = 5;
- hrb_t *req = NULL;
+ hrb_t * req = NULL;
TESTING("hrb_init_request");
for (i = 0; i < ncases; i++) {
- C = &cases[i];
- req = H5FD_s3comms_hrb_init_request(
- C->verb,
- C->resource,
- C->version);
+ C = &cases[i];
+ req = H5FD_s3comms_hrb_init_request(C->verb, C->resource, C->version);
if (cases[i].ret_null == TRUE) {
- FAIL_IF( req != NULL );
+ FAIL_IF(req != NULL);
}
else {
- FAIL_IF( req == NULL );
- JSVERIFY( S3COMMS_HRB_MAGIC, req->magic, NULL )
+ FAIL_IF(req == NULL);
+ JSVERIFY(S3COMMS_HRB_MAGIC, req->magic, NULL)
if (C->verb == NULL) {
- JSVERIFY_STR( "GET", req->verb, NULL )
+ JSVERIFY_STR("GET", req->verb, NULL)
}
else {
- JSVERIFY_STR( req->verb, C->verb, NULL )
+ JSVERIFY_STR(req->verb, C->verb, NULL)
}
- JSVERIFY_STR( "HTTP/1.1", req->version, NULL )
- JSVERIFY_STR( C->exp_res, req->resource, NULL )
- FAIL_IF( req->first_header != NULL );
- FAIL_IF( req->body != NULL );
- JSVERIFY( 0, req->body_len, NULL )
- JSVERIFY( SUCCEED, H5FD_s3comms_hrb_destroy(&req),
- "unable to destroy hrb_t" )
- FAIL_IF( NULL != req ); /* should annull pointer as well as free */
+ JSVERIFY_STR("HTTP/1.1", req->version, NULL)
+ JSVERIFY_STR(C->exp_res, req->resource, NULL)
+ FAIL_IF(req->first_header != NULL);
+ FAIL_IF(req->body != NULL);
+ JSVERIFY(0, req->body_len, NULL)
+ JSVERIFY(SUCCEED, H5FD_s3comms_hrb_destroy(&req), "unable to destroy hrb_t")
+ FAIL_IF(NULL != req); /* should annull pointer as well as free */
}
} /* end for each testcase */
@@ -842,7 +805,6 @@ error:
} /* end test_hrb_init_request() */
-
/*---------------------------------------------------------------------------
*
* Function: test_hrb_node_set()
@@ -890,11 +852,11 @@ test_hrb_node_set(void)
* representing the empty list.
*/
typedef struct testcase {
- const char *message;
- node_mock_t delta;
- herr_t returned;
- const char *given[11]; /* name/value pairs in array; NULL sentinel */
- const char *expected[11];
+ const char *message;
+ node_mock_t delta;
+ herr_t returned;
+ const char *given[11]; /* name/value pairs in array; NULL sentinel */
+ const char *expected[11];
} testcase;
/************************
@@ -902,188 +864,279 @@ test_hrb_node_set(void)
************************/
testcase cases[] = {
- { "cannot remove node from null list",
- { "Host", NULL },
+ {
+ "cannot remove node from null list",
+ {"Host", NULL},
FAIL,
{NULL},
{NULL},
},
- { "cannot create list with NULL field name",
- { NULL, "somevalue" },
+ {
+ "cannot create list with NULL field name",
+ {NULL, "somevalue"},
FAIL,
{NULL},
{NULL},
},
- { "create a new list",
- { "Host", "somevalue" },
+ {
+ "create a new list",
+ {"Host", "somevalue"},
SUCCEED,
{NULL},
- { "Host", "somevalue",
+ {
+ "Host",
+ "somevalue",
NULL,
},
},
- { "insert new node at head list",
- { "Host", "somevalue" },
+ {
+ "insert new node at head list",
+ {"Host", "somevalue"},
SUCCEED,
- { "Range", "bytes=20-40",
+ {
+ "Range",
+ "bytes=20-40",
NULL,
},
- { "Host", "somevalue",
- "Range", "bytes=20-40",
+ {
+ "Host",
+ "somevalue",
+ "Range",
+ "bytes=20-40",
NULL,
},
},
- { "append new node at list end",
- { "x-amz-date", "somevalue" },
+ {
+ "append new node at list end",
+ {"x-amz-date", "somevalue"},
SUCCEED,
- { "Range", "bytes=20-40",
+ {
+ "Range",
+ "bytes=20-40",
NULL,
},
- { "Range", "bytes=20-40",
- "x-amz-date", "somevalue",
+ {
+ "Range",
+ "bytes=20-40",
+ "x-amz-date",
+ "somevalue",
NULL,
},
},
- { "insert new node inside list",
- { "Intermediary", "somevalue" },
+ {
+ "insert new node inside list",
+ {"Intermediary", "somevalue"},
SUCCEED,
- { "Host", "somehost" ,
- "Range", "bytes=20-40",
+ {
+ "Host",
+ "somehost",
+ "Range",
+ "bytes=20-40",
NULL,
},
- { "Host", "somehost",
- "Intermediary", "somevalue",
- "Range", "bytes=20-40",
+ {
+ "Host",
+ "somehost",
+ "Intermediary",
+ "somevalue",
+ "Range",
+ "bytes=20-40",
NULL,
},
},
- { "modify node",
- { "Range", "bytes=40-80" },
+ {
+ "modify node",
+ {"Range", "bytes=40-80"},
SUCCEED,
- { "Host", "somehost",
- "Range", "bytes=20-40",
+ {
+ "Host",
+ "somehost",
+ "Range",
+ "bytes=20-40",
NULL,
},
- { "Host", "somehost",
- "Range", "bytes=40-80",
+ {
+ "Host",
+ "somehost",
+ "Range",
+ "bytes=40-80",
NULL,
},
},
- { "modify node with new case",
- { "RANGE", "bytes=40-80" },
+ {
+ "modify node with new case",
+ {"RANGE", "bytes=40-80"},
SUCCEED,
- { "Host", "somehost",
- "Range", "bytes=20-40",
+ {
+ "Host",
+ "somehost",
+ "Range",
+ "bytes=20-40",
NULL,
},
- { "Host", "somehost",
- "RANGE", "bytes=40-80",
+ {
+ "Host",
+ "somehost",
+ "RANGE",
+ "bytes=40-80",
NULL,
},
},
- { "cannot add node with no name",
- { NULL, "bytes=40-80" },
+ {
+ "cannot add node with no name",
+ {NULL, "bytes=40-80"},
FAIL,
- { "Host", "somehost",
+ {
+ "Host",
+ "somehost",
NULL,
},
- { "Host", "somehost",
+ {
+ "Host",
+ "somehost",
NULL,
},
},
- { "add node with 'empty' name",
- { "", "bytes=40-80" },
+ {
+ "add node with 'empty' name",
+ {"", "bytes=40-80"},
SUCCEED,
- { "Host", "somehost",
+ {
+ "Host",
+ "somehost",
NULL,
},
- { "", "bytes=40-80",
- "Host", "somehost",
+ {
+ "",
+ "bytes=40-80",
+ "Host",
+ "somehost",
NULL,
},
},
- { "remove node from end of list",
- { "Host", NULL },
+ {
+ "remove node from end of list",
+ {"Host", NULL},
SUCCEED,
- { "Date", "Thr, 25 Jan 2018",
- "Host", "somehost",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
+ "Host",
+ "somehost",
NULL,
},
- { "Date", "Thr, 25 Jan 2018",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
NULL,
},
},
- { "remove node from middle of list",
- { "Host", NULL },
+ {
+ "remove node from middle of list",
+ {"Host", NULL},
SUCCEED,
- { "Date", "Thr, 25 Jan 2018",
- "Host", "somehost",
- "Range", "bytes=20-40",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
+ "Host",
+ "somehost",
+ "Range",
+ "bytes=20-40",
NULL,
},
- { "Date", "Thr, 25 Jan 2018",
- "Range", "bytes=20-40",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
+ "Range",
+ "bytes=20-40",
NULL,
},
},
- { "remove node from start of list",
- { "Date", NULL },
+ {
+ "remove node from start of list",
+ {"Date", NULL},
SUCCEED,
- { "Date", "Thr, 25 Jan 2018",
- "Host", "somehost",
- "Range", "bytes=20-40",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
+ "Host",
+ "somehost",
+ "Range",
+ "bytes=20-40",
NULL,
},
- { "Host", "somehost",
- "Range", "bytes=20-40",
+ {
+ "Host",
+ "somehost",
+ "Range",
+ "bytes=20-40",
NULL,
},
},
- { "remove only node in list",
- { "Date", NULL },
+ {
+ "remove only node in list",
+ {"Date", NULL},
SUCCEED,
- { "Date", "Thr, 25 Jan 2018",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
NULL,
},
- { NULL,
+ {
+ NULL,
},
},
- { "attempt to remove absent node fails",
- { "Host", NULL },
+ {
+ "attempt to remove absent node fails",
+ {"Host", NULL},
FAIL,
- { "Date", "Thr, 25 Jan 2018",
- "Range", "bytes=20-40",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
+ "Range",
+ "bytes=20-40",
NULL,
},
- { "Date", "Thr, 25 Jan 2018",
- "Range", "bytes=20-40",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
+ "Range",
+ "bytes=20-40",
NULL,
},
},
- { "removal is case-insensitive",
- { "hOsT", NULL },
+ {
+ "removal is case-insensitive",
+ {"hOsT", NULL},
SUCCEED,
- { "Date", "Thr, 25 Jan 2018",
- "Host", "somehost",
- "Range", "bytes=20-40",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
+ "Host",
+ "somehost",
+ "Range",
+ "bytes=20-40",
NULL,
},
- { "Date", "Thr, 25 Jan 2018",
- "Range", "bytes=20-40",
+ {
+ "Date",
+ "Thr, 25 Jan 2018",
+ "Range",
+ "bytes=20-40",
NULL,
},
},
};
- unsigned testcases_count = 16;
- unsigned test_i = 0;
- hrb_node_t *list = NULL;
+ unsigned testcases_count = 16;
+ unsigned test_i = 0;
+ hrb_node_t *list = NULL;
TESTING("hrb_node_t (test_hrb_node_set)");
for (test_i = 0; test_i < testcases_count; test_i++) {
- const hrb_node_t *node = NULL;
- const testcase *test = &(cases[test_i]);
- unsigned mock_i = 0;
+ const hrb_node_t *node = NULL;
+ const testcase * test = &(cases[test_i]);
+ unsigned mock_i = 0;
/*********
* SETUP *
@@ -1091,10 +1144,9 @@ test_hrb_node_set(void)
for (mock_i = 0; test->given[mock_i] != NULL; mock_i += 2) {
const char *name = test->given[mock_i];
- const char *valu = test->given[mock_i+1];
+ const char *valu = test->given[mock_i + 1];
- FAIL_IF( SUCCEED !=
- H5FD_s3comms_hrb_node_set(&list, name, valu) )
+ FAIL_IF(SUCCEED != H5FD_s3comms_hrb_node_set(&list, name, valu))
}
/********
* TEST *
@@ -1102,37 +1154,32 @@ test_hrb_node_set(void)
/* perform modification on list
*/
- JSVERIFY( test->returned,
- H5FD_s3comms_hrb_node_set(&list,
- test->delta.name,
- test->delta.value),
- test->message )
-
+ JSVERIFY(test->returned, H5FD_s3comms_hrb_node_set(&list, test->delta.name, test->delta.value),
+ test->message)
/* verify resulting list
*/
- node = list;
+ node = list;
mock_i = 0;
while (test->expected[mock_i] != NULL && node != NULL) {
const char *name = test->expected[mock_i];
- const char *valu = test->expected[mock_i+1];
+ const char *valu = test->expected[mock_i + 1];
- JSVERIFY_STR( name, node->name, NULL )
- JSVERIFY_STR( valu, node->value, NULL )
+ JSVERIFY_STR(name, node->name, NULL)
+ JSVERIFY_STR(valu, node->value, NULL)
mock_i += 2;
node = node->next;
}
- FAIL_IF( test->expected[mock_i] != NULL )
- FAIL_IF( node != NULL )
+ FAIL_IF(test->expected[mock_i] != NULL)
+ FAIL_IF(node != NULL)
/************
* TEARDOWN *
************/
while (list != NULL) {
- FAIL_IF( SUCCEED !=
- H5FD_s3comms_hrb_node_set(&list, list->name, NULL) )
+ FAIL_IF(SUCCEED != H5FD_s3comms_hrb_node_set(&list, list->name, NULL))
}
} /* end for each testcase */
@@ -1148,8 +1195,6 @@ error:
} /* end test_hrb_node_t() */
-
-
/*---------------------------------------------------------------------------
*
* Function: test_HMAC_SHA256()
@@ -1172,13 +1217,13 @@ test_HMAC_SHA256(void)
*************************/
struct testcase {
- herr_t ret; /* SUCCEED/FAIL expected from call */
- const unsigned char key[SHA256_DIGEST_LENGTH];
- size_t key_len;
- const char *msg;
- size_t msg_len;
- const char *exp; /* not used if ret == FAIL */
- size_t dest_size; /* if 0, `dest` is not malloc'd */
+ herr_t ret; /* SUCCEED/FAIL expected from call */
+ const unsigned char key[SHA256_DIGEST_LENGTH];
+ size_t key_len;
+ const char * msg;
+ size_t msg_len;
+ const char * exp; /* not used if ret == FAIL */
+ size_t dest_size; /* if 0, `dest` is not malloc'd */
};
/************************
@@ -1186,33 +1231,33 @@ test_HMAC_SHA256(void)
************************/
struct testcase cases[] = {
- { SUCCEED,
- { 0xdb, 0xb8, 0x93, 0xac, 0xc0, 0x10, 0x96, 0x49,
- 0x18, 0xf1, 0xfd, 0x43, 0x3a, 0xdd, 0x87, 0xc7,
- 0x0e, 0x8b, 0x0d, 0xb6, 0xbe, 0x30, 0xc1, 0xfb,
- 0xea, 0xfe, 0xfa, 0x5e, 0xc6, 0xba, 0x83, 0x78,
+ {
+ SUCCEED,
+ {
+ 0xdb, 0xb8, 0x93, 0xac, 0xc0, 0x10, 0x96, 0x49, 0x18, 0xf1, 0xfd,
+ 0x43, 0x3a, 0xdd, 0x87, 0xc7, 0x0e, 0x8b, 0x0d, 0xb6, 0xbe, 0x30,
+ 0xc1, 0xfb, 0xea, 0xfe, 0xfa, 0x5e, 0xc6, 0xba, 0x83, 0x78,
},
SHA256_DIGEST_LENGTH,
- "AWS4-HMAC-SHA256\n20130524T000000Z\n20130524/us-east-1/s3/aws4_request\n7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972",
- HDstrlen("AWS4-HMAC-SHA256\n20130524T000000Z\n20130524/us-east-1/s3/aws4_request\n7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972"),
+ "AWS4-HMAC-SHA256\n20130524T000000Z\n20130524/us-east-1/s3/"
+ "aws4_request\n7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972",
+ HDstrlen("AWS4-HMAC-SHA256\n20130524T000000Z\n20130524/us-east-1/s3/"
+ "aws4_request\n7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972"),
"f0e8bdb87c964420e857bd35b5d6ed310bd44f0170aba48dd91039c6036bdb41",
SHA256_DIGEST_LENGTH * 2 + 1, /* +1 for null terminator */
},
- { SUCCEED,
- {'J','e','f','e'},
+ {
+ SUCCEED,
+ {'J', 'e', 'f', 'e'},
4,
"what do ya want for nothing?",
28,
"5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843",
SHA256_DIGEST_LENGTH * 2 + 1,
},
- { FAIL,
- "DOESN'T MATTER",
- 14,
- "ALSO IRRELEVANT",
- 15,
- NULL,
- 0, /* dest -> null, resulting in immediate error */
+ {
+ FAIL, "DOESN'T MATTER", 14, "ALSO IRRELEVANT", 15, NULL,
+ 0, /* dest -> null, resulting in immediate error */
},
};
char *dest = NULL;
@@ -1223,44 +1268,32 @@ test_HMAC_SHA256(void)
for (i = 0; i < n_cases; i++) {
if (cases[i].dest_size == 0) {
- dest = NULL;
- } else {
- dest = (char *)HDmalloc(sizeof(char) * cases[i].dest_size);
- HDassert(dest != NULL);
+ dest = NULL;
+ }
+ else {
+ dest = (char *)HDmalloc(sizeof(char) * cases[i].dest_size);
+ HDassert(dest != NULL);
}
- JSVERIFY( cases[i].ret,
- H5FD_s3comms_HMAC_SHA256(
- cases[i].key,
- cases[i].key_len,
- cases[i].msg,
- cases[i].msg_len,
- dest),
- cases[i].msg );
+ JSVERIFY(
+ cases[i].ret,
+ H5FD_s3comms_HMAC_SHA256(cases[i].key, cases[i].key_len, cases[i].msg, cases[i].msg_len, dest),
+ cases[i].msg);
if (cases[i].ret == SUCCEED) {
#ifdef VERBOSE
- if (0 !=
- strncmp(cases[i].exp,
- dest,
- HDstrlen(cases[i].exp)))
- {
+ if (0 != strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp))) {
/* print out how wrong things are, and then fail
*/
dest = (char *)realloc(dest, cases[i].dest_size + 1);
HDassert(dest != NULL);
dest[cases[i].dest_size] = 0;
- HDfprintf(stdout,
- "ERROR:\n!!! \"%s\"\n != \"%s\"\n",
- cases[i].exp,
- dest);
+ HDfprintf(stdout, "ERROR:\n!!! \"%s\"\n != \"%s\"\n", cases[i].exp, dest);
TEST_ERROR;
}
-#else /* VERBOSE not defined */
+#else /* VERBOSE not defined */
/* simple pass/fail test
*/
- JSVERIFY( 0,
- strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)),
- NULL);
+ JSVERIFY(0, strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)), NULL);
#endif /* VERBOSE */
}
free(dest);
@@ -1275,7 +1308,6 @@ error:
} /* end test_HMAC_SHA256() */
-
/*----------------------------------------------------------------------------
*
* Function: test_nlowercase()
@@ -1310,15 +1342,18 @@ test_nlowercase(void)
* in this test, kept as the null character for simplicity.
*/
struct testcase cases[] = {
- { "HALlEluJAh",
+ {
+ "HALlEluJAh",
6,
"hallel",
},
- { "all\0 lower",
+ {
+ "all\0 lower",
10,
"all\0 lower",
},
- { "to meeeeeee",
+ {
+ "to meeeeeee",
0,
"",
},
@@ -1332,22 +1367,14 @@ test_nlowercase(void)
for (i = 0; i < n_cases; i++) {
dest = (char *)HDmalloc(sizeof(char) * 16);
- JSVERIFY( SUCCEED,
- H5FD_s3comms_nlowercase(dest,
- cases[i].in,
- cases[i].len),
- cases[i].in )
+ JSVERIFY(SUCCEED, H5FD_s3comms_nlowercase(dest, cases[i].in, cases[i].len), cases[i].in)
if (cases[i].len > 0) {
- JSVERIFY( 0, strncmp(dest, cases[i].exp, cases[i].len), NULL )
+ JSVERIFY(0, strncmp(dest, cases[i].exp, cases[i].len), NULL)
}
free(dest);
} /* end for each testcase */
- JSVERIFY( FAIL,
- H5FD_s3comms_nlowercase(NULL,
- cases[0].in,
- cases[0].len),
- "null distination should fail" )
+ JSVERIFY(FAIL, H5FD_s3comms_nlowercase(NULL, cases[0].in, cases[0].len), "null distination should fail")
PASSED();
return 0;
@@ -1358,7 +1385,6 @@ error:
} /* end test_nlowercase() */
-
/*---------------------------------------------------------------------------
*
* Function: test_parse_url()
@@ -1388,34 +1414,38 @@ test_parse_url(void)
} const_purl_t;
struct testcase {
- const char *url;
- herr_t exp_ret; /* expected return; */
- /* if FAIL, `expected` is unused */
- const_purl_t expected;
- const char *msg;
+ const char *url;
+ herr_t exp_ret; /* expected return; */
+ /* if FAIL, `expected` is unused */
+ const_purl_t expected;
+ const char * msg;
};
/************************
* test-local variables *
************************/
- parsed_url_t *purl = NULL;
+ parsed_url_t * purl = NULL;
unsigned int i = 0;
unsigned int ncases = 15;
struct testcase cases[] = {
- { NULL,
+ {
+ NULL,
FAIL,
- { NULL, NULL, NULL, NULL, NULL },
+ {NULL, NULL, NULL, NULL, NULL},
"null url",
},
- { "",
+ {
+ "",
FAIL,
- { NULL, NULL, NULL, NULL, NULL },
+ {NULL, NULL, NULL, NULL, NULL},
"empty url",
},
- { "ftp://[1000:4000:0002:2010]",
+ {
+ "ftp://[1000:4000:0002:2010]",
SUCCEED,
- { "ftp",
+ {
+ "ftp",
"[1000:4000:0002:2010]",
NULL,
NULL,
@@ -1423,9 +1453,11 @@ test_parse_url(void)
},
"IPv6 ftp and empty path (root)",
},
- { "ftp://[1000:4000:0002:2010]:2040",
+ {
+ "ftp://[1000:4000:0002:2010]:2040",
SUCCEED,
- { "ftp",
+ {
+ "ftp",
"[1000:4000:0002:2010]",
"2040",
NULL,
@@ -1433,9 +1465,11 @@ test_parse_url(void)
},
"root IPv6 ftp with port",
},
- { "http://some.domain.org:9000/path/to/resource.txt",
+ {
+ "http://some.domain.org:9000/path/to/resource.txt",
SUCCEED,
- { "http",
+ {
+ "http",
"some.domain.org",
"9000",
"path/to/resource.txt",
@@ -1443,9 +1477,11 @@ test_parse_url(void)
},
"without query",
},
- { "https://domain.me:00/file.txt?some_params unchecked",
+ {
+ "https://domain.me:00/file.txt?some_params unchecked",
SUCCEED,
- { "https",
+ {
+ "https",
"domain.me",
"00",
"file.txt",
@@ -1453,9 +1489,11 @@ test_parse_url(void)
},
"with query",
},
- { "ftp://domain.com/",
+ {
+ "ftp://domain.com/",
SUCCEED,
- { "ftp",
+ {
+ "ftp",
"domain.com",
NULL,
NULL,
@@ -1463,9 +1501,11 @@ test_parse_url(void)
},
"explicit root w/out port",
},
- { "ftp://domain.com:1234/",
+ {
+ "ftp://domain.com:1234/",
SUCCEED,
- { "ftp",
+ {
+ "ftp",
"domain.com",
"1234",
NULL,
@@ -1473,24 +1513,47 @@ test_parse_url(void)
},
"explicit root with port",
},
- { "ftp://domain.com:1234/file?",
+ {
+ "ftp://domain.com:1234/file?",
FAIL,
- { NULL, NULL, NULL, NULL, NULL, },
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ },
"empty query is invalid",
},
- { "ftp://:1234/file",
+ {
+ "ftp://:1234/file",
FAIL,
- { NULL, NULL, NULL, NULL, NULL, },
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ },
"no host",
},
- { "h&r block",
+ {
+ "h&r block",
FAIL,
- { NULL, NULL, NULL, NULL, NULL, },
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ },
"no scheme (bad URL)",
},
- { "http://domain.com?a=b&d=b",
+ {
+ "http://domain.com?a=b&d=b",
SUCCEED,
- { "http",
+ {
+ "http",
"domain.com",
NULL,
NULL,
@@ -1498,9 +1561,11 @@ test_parse_url(void)
},
"QUERY with implict PATH",
},
- { "http://[5]/path?a=b&d=b",
+ {
+ "http://[5]/path?a=b&d=b",
SUCCEED,
- { "http",
+ {
+ "http",
"[5]",
NULL,
"path",
@@ -1508,14 +1573,28 @@ test_parse_url(void)
},
"IPv6 extraction is really dumb",
},
- { "http://[1234:5678:0910:1112]:port/path",
+ {
+ "http://[1234:5678:0910:1112]:port/path",
FAIL,
- { NULL, NULL, NULL, NULL, NULL, },
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ },
"non-decimal PORT (port)",
},
- { "http://mydomain.com:01a3/path",
+ {
+ "http://mydomain.com:01a3/path",
FAIL,
- { NULL, NULL, NULL, NULL, NULL, },
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ },
"non-decimal PORT (01a3)",
},
};
@@ -1527,70 +1606,63 @@ test_parse_url(void)
*********/
for (i = 0; i < ncases; i++) {
- HDassert( purl == NULL );
+ HDassert(purl == NULL);
- JSVERIFY( cases[i].exp_ret,
- H5FD_s3comms_parse_url(cases[i].url, &purl),
- cases[i].msg )
+ JSVERIFY(cases[i].exp_ret, H5FD_s3comms_parse_url(cases[i].url, &purl), cases[i].msg)
if (cases[i].exp_ret == FAIL) {
/* on FAIL, `purl` should be untouched--remains NULL */
- FAIL_UNLESS( purl == NULL )
+ FAIL_UNLESS(purl == NULL)
}
else {
/* on SUCCEED, `purl` should be set */
- FAIL_IF( purl == NULL )
+ FAIL_IF(purl == NULL)
if (cases[i].expected.scheme != NULL) {
- FAIL_IF( NULL == purl->scheme )
- JSVERIFY_STR( cases[i].expected.scheme,
- purl->scheme,
- cases[i].msg )
- } else {
- FAIL_UNLESS( NULL == purl->scheme )
+ FAIL_IF(NULL == purl->scheme)
+ JSVERIFY_STR(cases[i].expected.scheme, purl->scheme, cases[i].msg)
+ }
+ else {
+ FAIL_UNLESS(NULL == purl->scheme)
}
if (cases[i].expected.host != NULL) {
- FAIL_IF( NULL == purl->host )
- JSVERIFY_STR( cases[i].expected.host,
- purl->host,
- cases[i].msg )
- } else {
- FAIL_UNLESS( NULL == purl->host )
+ FAIL_IF(NULL == purl->host)
+ JSVERIFY_STR(cases[i].expected.host, purl->host, cases[i].msg)
+ }
+ else {
+ FAIL_UNLESS(NULL == purl->host)
}
if (cases[i].expected.port != NULL) {
- FAIL_IF( NULL == purl->port )
- JSVERIFY_STR( cases[i].expected.port,
- purl->port,
- cases[i].msg )
- } else {
- FAIL_UNLESS( NULL == purl->port )
+ FAIL_IF(NULL == purl->port)
+ JSVERIFY_STR(cases[i].expected.port, purl->port, cases[i].msg)
+ }
+ else {
+ FAIL_UNLESS(NULL == purl->port)
}
if (cases[i].expected.path != NULL) {
- FAIL_IF( NULL == purl->path )
- JSVERIFY_STR( cases[i].expected.path,
- purl->path,
- cases[i].msg )
- } else {
- FAIL_UNLESS( NULL == purl->path )
+ FAIL_IF(NULL == purl->path)
+ JSVERIFY_STR(cases[i].expected.path, purl->path, cases[i].msg)
+ }
+ else {
+ FAIL_UNLESS(NULL == purl->path)
}
if (cases[i].expected.query != NULL) {
- FAIL_IF( NULL == purl->query )
- JSVERIFY_STR( cases[i].expected.query,
- purl->query,
- cases[i].msg )
- } else {
- FAIL_UNLESS( NULL == purl->query )
+ FAIL_IF(NULL == purl->query)
+ JSVERIFY_STR(cases[i].expected.query, purl->query, cases[i].msg)
+ }
+ else {
+ FAIL_UNLESS(NULL == purl->query)
}
} /* end if parse-url return SUCCEED/FAIL */
/* per-test cleanup
* well-behaved, even if `purl` is NULL
*/
- FAIL_IF( FAIL == H5FD_s3comms_free_purl(purl) )
+ FAIL_IF(FAIL == H5FD_s3comms_free_purl(purl))
purl = NULL;
} /* end for each testcase */
@@ -1608,7 +1680,6 @@ error:
} /* end test_parse_url() */
-
/*---------------------------------------------------------------------------
*
* Function: test_percent_encode_char()
@@ -1645,10 +1716,10 @@ test_percent_encode_char(void)
************************/
struct testcase cases[] = {
- {'$', "%24", 3}, /* u+0024 dollar sign */
- {' ', "%20", 3}, /* u+0020 space */
- {'^', "%5E", 3}, /* u+0094 carat */
- {'/', "%2F", 3}, /* u+002f solidus (forward slash) */
+ {'$', "%24", 3}, /* u+0024 dollar sign */
+ {' ', "%20", 3}, /* u+0020 space */
+ {'^', "%5E", 3}, /* u+0094 carat */
+ {'/', "%2F", 3}, /* u+002f solidus (forward slash) */
/* {??, "%C5%8C", 6},*/ /* u+014c Latin Capital Letter O with Macron */
/* Not included because it is multibyte "wide" character that poses */
/* issues both in the underlying function and in being written in */
@@ -1667,23 +1738,14 @@ test_percent_encode_char(void)
TESTING("percent encode characters");
for (i = 0; i < n_cases; i++) {
- JSVERIFY( SUCCEED,
- H5FD_s3comms_percent_encode_char(
- dest,
- (const unsigned char)cases[i].c,
- &dest_len),
- NULL )
- JSVERIFY(cases[i].exp_len, dest_len, NULL )
- JSVERIFY(0, strncmp(dest, cases[i].exp, dest_len), NULL )
- JSVERIFY_STR( cases[i].exp, dest, NULL )
+ JSVERIFY(SUCCEED, H5FD_s3comms_percent_encode_char(dest, (const unsigned char)cases[i].c, &dest_len),
+ NULL)
+ JSVERIFY(cases[i].exp_len, dest_len, NULL)
+ JSVERIFY(0, strncmp(dest, cases[i].exp, dest_len), NULL)
+ JSVERIFY_STR(cases[i].exp, dest, NULL)
}
- JSVERIFY( FAIL,
- H5FD_s3comms_percent_encode_char(
- NULL,
- (const unsigned char)'^',
- &dest_len),
- NULL )
+ JSVERIFY(FAIL, H5FD_s3comms_percent_encode_char(NULL, (const unsigned char)'^', &dest_len), NULL)
PASSED();
return 0;
@@ -1692,7 +1754,6 @@ error:
return -1;
} /* end test_percent_encode_char() */
-
/*---------------------------------------------------------------------------
* Function: test_s3r_open()
*
@@ -1710,7 +1771,7 @@ test_s3r_get_filesize(void)
* test-local variables *
************************/
- char url_raven[S3_TEST_MAX_URL_SIZE];
+ char url_raven[S3_TEST_MAX_URL_SIZE];
s3r_t *handle = NULL;
TESTING("s3r_get_filesize");
@@ -1724,23 +1785,17 @@ test_s3r_get_filesize(void)
return 0;
}
- FAIL_IF( S3_TEST_MAX_URL_SIZE <
- HDsnprintf(url_raven,
- S3_TEST_MAX_URL_SIZE,
- "%s/%s",
- s3_test_bucket_url,
- S3_TEST_RESOURCE_TEXT_PUBLIC) );
+ FAIL_IF(S3_TEST_MAX_URL_SIZE < HDsnprintf(url_raven, S3_TEST_MAX_URL_SIZE, "%s/%s", s3_test_bucket_url,
+ S3_TEST_RESOURCE_TEXT_PUBLIC));
- JSVERIFY( 0, H5FD_s3comms_s3r_get_filesize(NULL),
- "filesize of the null handle should be 0" )
+ JSVERIFY(0, H5FD_s3comms_s3r_get_filesize(NULL), "filesize of the null handle should be 0")
handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL);
- FAIL_IF( handle == NULL )
+ FAIL_IF(handle == NULL)
- JSVERIFY( 6464, H5FD_s3comms_s3r_get_filesize(handle), NULL )
+ JSVERIFY(6464, H5FD_s3comms_s3r_get_filesize(handle), NULL)
-
- FAIL_IF( SUCCEED != H5FD_s3comms_s3r_close(handle) )
+ FAIL_IF(SUCCEED != H5FD_s3comms_s3r_close(handle))
PASSED();
return 0;
@@ -1753,7 +1808,6 @@ error:
} /* end test_s3r_get_filesize() */
-
/*---------------------------------------------------------------------------
* Function: test_s3r_open()
*
@@ -1771,16 +1825,16 @@ test_s3r_open(void)
* test-local variables *
************************/
- char url_missing[S3_TEST_MAX_URL_SIZE];
- char url_raven[S3_TEST_MAX_URL_SIZE];
- char url_raven_badport[S3_TEST_MAX_URL_SIZE];
- char url_shakespeare[S3_TEST_MAX_URL_SIZE];
- unsigned char signing_key[SHA256_DIGEST_LENGTH];
- struct tm *now = NULL;
- char iso8601now[ISO8601_SIZE];
- s3r_t *handle = NULL;
- hbool_t curl_ready = FALSE;
- parsed_url_t *purl = NULL;
+ char url_missing[S3_TEST_MAX_URL_SIZE];
+ char url_raven[S3_TEST_MAX_URL_SIZE];
+ char url_raven_badport[S3_TEST_MAX_URL_SIZE];
+ char url_shakespeare[S3_TEST_MAX_URL_SIZE];
+ unsigned char signing_key[SHA256_DIGEST_LENGTH];
+ struct tm * now = NULL;
+ char iso8601now[ISO8601_SIZE];
+ s3r_t * handle = NULL;
+ hbool_t curl_ready = FALSE;
+ parsed_url_t *purl = NULL;
TESTING("s3r_open");
@@ -1801,65 +1855,46 @@ test_s3r_open(void)
* PRE-TEST SETUP *
******************/
- FAIL_IF( S3_TEST_MAX_URL_SIZE <
- HDsnprintf(url_shakespeare,
- S3_TEST_MAX_URL_SIZE,
- "%s/%s",
- s3_test_bucket_url,
- S3_TEST_RESOURCE_TEXT_RESTRICTED) );
-
- FAIL_IF( S3_TEST_MAX_URL_SIZE <
- HDsnprintf(url_missing,
- S3_TEST_MAX_URL_SIZE,
- "%s/%s",
- s3_test_bucket_url,
- S3_TEST_RESOURCE_MISSING) );
-
- FAIL_IF( S3_TEST_MAX_URL_SIZE <
- HDsnprintf(url_raven,
- S3_TEST_MAX_URL_SIZE,
- "%s/%s",
- s3_test_bucket_url,
- S3_TEST_RESOURCE_TEXT_PUBLIC) );
+ FAIL_IF(S3_TEST_MAX_URL_SIZE < HDsnprintf(url_shakespeare, S3_TEST_MAX_URL_SIZE, "%s/%s",
+ s3_test_bucket_url, S3_TEST_RESOURCE_TEXT_RESTRICTED));
+
+ FAIL_IF(S3_TEST_MAX_URL_SIZE < HDsnprintf(url_missing, S3_TEST_MAX_URL_SIZE, "%s/%s", s3_test_bucket_url,
+ S3_TEST_RESOURCE_MISSING));
+
+ FAIL_IF(S3_TEST_MAX_URL_SIZE < HDsnprintf(url_raven, S3_TEST_MAX_URL_SIZE, "%s/%s", s3_test_bucket_url,
+ S3_TEST_RESOURCE_TEXT_PUBLIC));
/* Set given bucket url with invalid/inactive port number for badport.
* Note, this sort of micro-management of parsed_url_t is not advised
*/
- FAIL_IF( FAIL == H5FD_s3comms_parse_url(s3_test_bucket_url, &purl) )
+ FAIL_IF(FAIL == H5FD_s3comms_parse_url(s3_test_bucket_url, &purl))
if (purl->port == NULL) {
purl->port = (char *)H5MM_malloc(sizeof(char) * 5);
- FAIL_IF( purl->port == NULL );
- FAIL_IF( 5 < HDsnprintf(purl->port, 5, "9000") )
- } else if (strcmp(purl->port, "9000") != 0) {
- FAIL_IF( 5 < HDsnprintf(purl->port, 5, "9000") )
- } else {
- FAIL_IF( 5 < HDsnprintf(purl->port, 5, "1234") )
+ FAIL_IF(purl->port == NULL);
+ FAIL_IF(5 < HDsnprintf(purl->port, 5, "9000"))
+ }
+ else if (strcmp(purl->port, "9000") != 0) {
+ FAIL_IF(5 < HDsnprintf(purl->port, 5, "9000"))
+ }
+ else {
+ FAIL_IF(5 < HDsnprintf(purl->port, 5, "1234"))
}
- FAIL_IF( S3_TEST_MAX_URL_SIZE <
- HDsnprintf(url_raven_badport,
- S3_TEST_MAX_URL_SIZE,
- "%s://%s:%s/%s",
- purl->scheme,
- purl->host,
- purl->port,
- S3_TEST_RESOURCE_TEXT_PUBLIC) );
+ FAIL_IF(S3_TEST_MAX_URL_SIZE < HDsnprintf(url_raven_badport, S3_TEST_MAX_URL_SIZE, "%s://%s:%s/%s",
+ purl->scheme, purl->host, purl->port,
+ S3_TEST_RESOURCE_TEXT_PUBLIC));
curl_global_init(CURL_GLOBAL_DEFAULT);
curl_ready = TRUE;
now = gmnow();
- FAIL_IF( now == NULL )
- FAIL_IF( ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1) );
+ FAIL_IF(now == NULL)
+ FAIL_IF(ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1));
/* It is desired to have means available to verify that signing_key
* was set successfully and to an expected value.
*/
- FAIL_IF( FAIL ==
- H5FD_s3comms_signing_key(
- signing_key,
- (const char *)s3_test_aws_secret_access_key,
- (const char *)s3_test_aws_region,
- (const char *)iso8601now) );
+ FAIL_IF(FAIL == H5FD_s3comms_signing_key(signing_key, (const char *)s3_test_aws_secret_access_key,
+ (const char *)s3_test_aws_region, (const char *)iso8601now));
/*************************
* OPEN NONEXISTENT FILE *
@@ -1868,16 +1903,14 @@ test_s3r_open(void)
/* attempt anonymously
*/
handle = H5FD_s3comms_s3r_open(url_missing, NULL, NULL, NULL);
- FAIL_IF( handle != NULL );
+ FAIL_IF(handle != NULL);
/* attempt with authentication
*/
- handle = H5FD_s3comms_s3r_open(
- url_missing,
- (const char *)s3_test_aws_region,
- (const char *)s3_test_aws_access_key_id,
- (const unsigned char *)signing_key);
- FAIL_IF( handle != NULL );
+ handle =
+ H5FD_s3comms_s3r_open(url_missing, (const char *)s3_test_aws_region,
+ (const char *)s3_test_aws_access_key_id, (const unsigned char *)signing_key);
+ FAIL_IF(handle != NULL);
/*************************
* INACTIVE PORT ON HOST *
@@ -1886,7 +1919,7 @@ test_s3r_open(void)
#if S3_TEST_RUN_TIMEOUT
HDprintf("Opening on inactive port may hang for a minute; waiting for timeout\n");
handle = H5FD_s3comms_s3r_open(url_raven_badport, NULL, NULL, NULL);
- FAIL_IF( handle != NULL );
+ FAIL_IF(handle != NULL);
#endif
/*******************************
@@ -1896,25 +1929,20 @@ test_s3r_open(void)
/* anonymous access on restricted file
*/
handle = H5FD_s3comms_s3r_open(url_shakespeare, NULL, NULL, NULL);
- FAIL_IF( handle != NULL );
+ FAIL_IF(handle != NULL);
/* passed in a bad ID
*/
- handle = H5FD_s3comms_s3r_open(
- url_shakespeare,
- (const char *)s3_test_aws_region,
- "I_MADE_UP_MY_ID",
- (const unsigned char *)signing_key);
- FAIL_IF( handle != NULL );
+ handle = H5FD_s3comms_s3r_open(url_shakespeare, (const char *)s3_test_aws_region, "I_MADE_UP_MY_ID",
+ (const unsigned char *)signing_key);
+ FAIL_IF(handle != NULL);
/* using an invalid signing key
*/
- handle = H5FD_s3comms_s3r_open(
- url_shakespeare,
- (const char *)s3_test_aws_region,
- (const char *)s3_test_aws_access_key_id,
- (const unsigned char *)EMPTY_SHA256);
- FAIL_IF( handle != NULL );
+ handle =
+ H5FD_s3comms_s3r_open(url_shakespeare, (const char *)s3_test_aws_region,
+ (const char *)s3_test_aws_access_key_id, (const unsigned char *)EMPTY_SHA256);
+ FAIL_IF(handle != NULL);
/*******************************
* SUCCESSFUL OPEN (AND CLOSE) *
@@ -1923,48 +1951,35 @@ test_s3r_open(void)
/* anonymous
*/
handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL);
- FAIL_IF( handle == NULL );
- JSVERIFY( 6464, H5FD_s3comms_s3r_get_filesize(handle),
- "did not get expected filesize" )
- JSVERIFY( SUCCEED,
- H5FD_s3comms_s3r_close(handle),
- "unable to close file" )
+ FAIL_IF(handle == NULL);
+ JSVERIFY(6464, H5FD_s3comms_s3r_get_filesize(handle), "did not get expected filesize")
+ JSVERIFY(SUCCEED, H5FD_s3comms_s3r_close(handle), "unable to close file")
handle = NULL;
/* using authentication on anonymously-accessible file?
*/
- handle = H5FD_s3comms_s3r_open(
- url_raven,
- (const char *)s3_test_aws_region,
- (const char *)s3_test_aws_access_key_id,
- (const unsigned char *)signing_key);
- FAIL_IF( handle == NULL );
- JSVERIFY( 6464, H5FD_s3comms_s3r_get_filesize(handle), NULL )
- JSVERIFY( SUCCEED,
- H5FD_s3comms_s3r_close(handle),
- "unable to close file" )
+ handle =
+ H5FD_s3comms_s3r_open(url_raven, (const char *)s3_test_aws_region,
+ (const char *)s3_test_aws_access_key_id, (const unsigned char *)signing_key);
+ FAIL_IF(handle == NULL);
+ JSVERIFY(6464, H5FD_s3comms_s3r_get_filesize(handle), NULL)
+ JSVERIFY(SUCCEED, H5FD_s3comms_s3r_close(handle), "unable to close file")
handle = NULL;
/* authenticating
*/
- handle = H5FD_s3comms_s3r_open(
- url_shakespeare,
- (const char *)s3_test_aws_region,
- (const char *)s3_test_aws_access_key_id,
- (const unsigned char *)signing_key);
- FAIL_IF( handle == NULL );
- JSVERIFY( 5458199, H5FD_s3comms_s3r_get_filesize(handle), NULL )
- JSVERIFY( SUCCEED,
- H5FD_s3comms_s3r_close(handle),
- "unable to close file" )
+ handle =
+ H5FD_s3comms_s3r_open(url_shakespeare, (const char *)s3_test_aws_region,
+ (const char *)s3_test_aws_access_key_id, (const unsigned char *)signing_key);
+ FAIL_IF(handle == NULL);
+ JSVERIFY(5458199, H5FD_s3comms_s3r_get_filesize(handle), NULL)
+ JSVERIFY(SUCCEED, H5FD_s3comms_s3r_close(handle), "unable to close file")
handle = NULL;
-
-
curl_global_cleanup();
curl_ready = FALSE;
- FAIL_IF( FAIL == H5FD_s3comms_free_purl(purl) )
+ FAIL_IF(FAIL == H5FD_s3comms_free_purl(purl))
purl = NULL;
PASSED();
@@ -1985,7 +2000,6 @@ error:
} /* end test_s3r_open() */
-
/*---------------------------------------------------------------------------
*
* Function: test_s3r_read()
@@ -2017,11 +2031,11 @@ test_s3r_read(void)
* test-local variables *
************************/
- char url_raven[S3_TEST_MAX_URL_SIZE];
- char buffer[S3COMMS_TEST_BUFFER_SIZE];
- s3r_t *handle = NULL;
- hbool_t curl_ready = FALSE;
- unsigned int i = 0;
+ char url_raven[S3_TEST_MAX_URL_SIZE];
+ char buffer[S3COMMS_TEST_BUFFER_SIZE];
+ s3r_t * handle = NULL;
+ hbool_t curl_ready = FALSE;
+ unsigned int i = 0;
TESTING("test_s3r_read");
@@ -2037,12 +2051,8 @@ test_s3r_read(void)
curl_global_init(CURL_GLOBAL_DEFAULT);
curl_ready = TRUE;
- FAIL_IF( S3_TEST_MAX_URL_SIZE <
- HDsnprintf(url_raven,
- S3_TEST_MAX_URL_SIZE,
- "%s/%s",
- s3_test_bucket_url,
- S3_TEST_RESOURCE_TEXT_PUBLIC) );
+ FAIL_IF(S3_TEST_MAX_URL_SIZE < HDsnprintf(url_raven, S3_TEST_MAX_URL_SIZE, "%s/%s", s3_test_bucket_url,
+ S3_TEST_RESOURCE_TEXT_PUBLIC));
for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++)
buffer[i] = '\0';
@@ -2050,8 +2060,8 @@ test_s3r_read(void)
/* open file
*/
handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL);
- FAIL_IF( handle == NULL )
- JSVERIFY( 6464, H5FD_s3comms_s3r_get_filesize(handle), NULL )
+ FAIL_IF(handle == NULL)
+ JSVERIFY(6464, H5FD_s3comms_s3r_get_filesize(handle), NULL)
for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++)
buffer[i] = '\0';
@@ -2060,18 +2070,10 @@ test_s3r_read(void)
* read start of file *
**********************/
- JSVERIFY( SUCCEED,
- H5FD_s3comms_s3r_read(
- handle,
- (haddr_t)0,
- (size_t)118,
- buffer),
- NULL )
- JSVERIFY_STR (
- "Once upon a midnight dreary, while I pondered, weak and weary,\n" \
- "Over many a quaint and curious volume of forgotten lore",
- buffer,
- NULL )
+ JSVERIFY(SUCCEED, H5FD_s3comms_s3r_read(handle, (haddr_t)0, (size_t)118, buffer), NULL)
+ JSVERIFY_STR("Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ "Over many a quaint and curious volume of forgotten lore",
+ buffer, NULL)
for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++)
buffer[i] = '\0';
@@ -2080,16 +2082,8 @@ test_s3r_read(void)
* read arbitrary range *
************************/
- JSVERIFY( SUCCEED,
- H5FD_s3comms_s3r_read(
- handle,
- (haddr_t)2540,
- (size_t)54,
- buffer),
- NULL )
- JSVERIFY_STR( "the grave and stern decorum of the countenance it wore",
- buffer,
- NULL )
+ JSVERIFY(SUCCEED, H5FD_s3comms_s3r_read(handle, (haddr_t)2540, (size_t)54, buffer), NULL)
+ JSVERIFY_STR("the grave and stern decorum of the countenance it wore", buffer, NULL)
for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++)
buffer[i] = '\0';
@@ -2098,15 +2092,8 @@ test_s3r_read(void)
* read one character *
**********************/
- JSVERIFY(SUCCEED,
- H5FD_s3comms_s3r_read(
- handle,
- (haddr_t)2540,
- (size_t)1,
- buffer),
- NULL )
- JSVERIFY_STR( "t", buffer, NULL )
-
+ JSVERIFY(SUCCEED, H5FD_s3comms_s3r_read(handle, (haddr_t)2540, (size_t)1, buffer), NULL)
+ JSVERIFY_STR("t", buffer, NULL)
for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++)
buffer[i] = '\0';
@@ -2115,18 +2102,14 @@ test_s3r_read(void)
* read to EoF *
***************/
- JSVERIFY( SUCCEED,
- H5FD_s3comms_s3r_read(
- handle,
- (haddr_t)6370,
- (size_t)0,
- buffer),
- NULL )
- JSVERIFY( 0,
- strncmp(buffer,
- "And my soul from out that shadow that lies floating on the floor\nShall be lifted—nevermore!\n",
- 94),
- buffer )
+ JSVERIFY(SUCCEED, H5FD_s3comms_s3r_read(handle, (haddr_t)6370, (size_t)0, buffer), NULL)
+ JSVERIFY(
+ 0,
+ strncmp(
+ buffer,
+ "And my soul from out that shadow that lies floating on the floor\nShall be lifted—nevermore!\n",
+ 94),
+ buffer)
for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++)
buffer[i] = '\0';
@@ -2135,48 +2118,34 @@ test_s3r_read(void)
* read past eof *
*****************/
- JSVERIFY( FAIL,
- H5FD_s3comms_s3r_read(
- handle,
- (haddr_t)6400,
- (size_t)100, /* 6400+100 > 6464 */
- buffer),
- NULL )
- JSVERIFY( 0, strcmp("", buffer), NULL )
+ JSVERIFY(FAIL,
+ H5FD_s3comms_s3r_read(handle, (haddr_t)6400, (size_t)100, /* 6400+100 > 6464 */
+ buffer),
+ NULL)
+ JSVERIFY(0, strcmp("", buffer), NULL)
/************************
* read starts past eof *
************************/
- JSVERIFY( FAIL,
- H5FD_s3comms_s3r_read(
- handle,
- (haddr_t)1200699, /* 1200699 > 6464 */
- (size_t)100,
- buffer),
- NULL )
- JSVERIFY( 0, strcmp("", buffer), NULL )
+ JSVERIFY(FAIL,
+ H5FD_s3comms_s3r_read(handle, (haddr_t)1200699, /* 1200699 > 6464 */
+ (size_t)100, buffer),
+ NULL)
+ JSVERIFY(0, strcmp("", buffer), NULL)
/**********************
* read starts on eof *
**********************/
- JSVERIFY( FAIL,
- H5FD_s3comms_s3r_read(
- handle,
- (haddr_t)6464,
- (size_t)0,
- buffer),
- NULL )
- JSVERIFY( 0, strcmp("", buffer), NULL )
+ JSVERIFY(FAIL, H5FD_s3comms_s3r_read(handle, (haddr_t)6464, (size_t)0, buffer), NULL)
+ JSVERIFY(0, strcmp("", buffer), NULL)
/*************
* TEAR DOWN *
*************/
- JSVERIFY( SUCCEED,
- H5FD_s3comms_s3r_close(handle),
- "unable to close file" )
+ JSVERIFY(SUCCEED, H5FD_s3comms_s3r_close(handle), "unable to close file")
handle = NULL;
curl_global_cleanup();
@@ -2202,7 +2171,6 @@ error:
} /* end test_s3r_read() */
-
/*---------------------------------------------------------------------------
*
* Function: test_signing_key()
@@ -2226,10 +2194,10 @@ test_signing_key(void)
*************************/
struct testcase {
- const char *region;
- const char *secret_key;
- const char *when;
- unsigned char exp[SHA256_DIGEST_LENGTH];
+ const char * region;
+ const char * secret_key;
+ const char * when;
+ unsigned char exp[SHA256_DIGEST_LENGTH];
};
/************************
@@ -2237,13 +2205,14 @@ test_signing_key(void)
************************/
struct testcase cases[] = {
- { "us-east-1",
+ {
+ "us-east-1",
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"20130524T000000Z",
- { 0xdb, 0xb8, 0x93, 0xac, 0xc0, 0x10, 0x96, 0x49,
- 0x18, 0xf1, 0xfd, 0x43, 0x3a, 0xdd, 0x87, 0xc7,
- 0x0e, 0x8b, 0x0d, 0xb6, 0xbe, 0x30, 0xc1, 0xfb,
- 0xea, 0xfe, 0xfa, 0x5e, 0xc6, 0xba, 0x83, 0x78,
+ {
+ 0xdb, 0xb8, 0x93, 0xac, 0xc0, 0x10, 0x96, 0x49, 0x18, 0xf1, 0xfd,
+ 0x43, 0x3a, 0xdd, 0x87, 0xc7, 0x0e, 0x8b, 0x0d, 0xb6, 0xbe, 0x30,
+ 0xc1, 0xfb, 0xea, 0xfe, 0xfa, 0x5e, 0xc6, 0xba, 0x83, 0x78,
},
},
};
@@ -2254,68 +2223,37 @@ test_signing_key(void)
TESTING("signing_key");
for (i = 0; i < ncases; i++) {
- key = (unsigned char *)HDmalloc(sizeof(unsigned char) * \
- SHA256_DIGEST_LENGTH);
- HDassert(key != NULL);
+ key = (unsigned char *)HDmalloc(sizeof(unsigned char) * SHA256_DIGEST_LENGTH);
+ HDassert(key != NULL);
- JSVERIFY( SUCCEED,
- H5FD_s3comms_signing_key(
- key,
- cases[i].secret_key,
- cases[i].region,
- cases[i].when),
- NULL )
+ JSVERIFY(SUCCEED, H5FD_s3comms_signing_key(key, cases[i].secret_key, cases[i].region, cases[i].when),
+ NULL)
- JSVERIFY( 0,
- strncmp((const char *)cases[i].exp,
- (const char *)key,
- SHA256_DIGEST_LENGTH),
- (const char *)cases[i].exp )
+ JSVERIFY(0, strncmp((const char *)cases[i].exp, (const char *)key, SHA256_DIGEST_LENGTH),
+ (const char *)cases[i].exp)
free(key);
key = NULL;
}
-
/***************
* ERROR CASES *
***************/
- key = (unsigned char *)HDmalloc(sizeof(unsigned char) * \
- SHA256_DIGEST_LENGTH);
+ key = (unsigned char *)HDmalloc(sizeof(unsigned char) * SHA256_DIGEST_LENGTH);
HDassert(key != NULL);
- JSVERIFY( FAIL,
- H5FD_s3comms_signing_key(
- NULL,
- cases[0].secret_key,
- cases[0].region,
- cases[0].when),
- "destination cannot be NULL" )
-
- JSVERIFY( FAIL,
- H5FD_s3comms_signing_key(
- key,
- NULL,
- cases[0].region,
- cases[0].when),
- "secret key cannot be NULL" )
-
- JSVERIFY( FAIL,
- H5FD_s3comms_signing_key(
- key,
- cases[0].secret_key,
- NULL,
- cases[0].when),
- "aws region cannot be NULL" )
-
- JSVERIFY( FAIL,
- H5FD_s3comms_signing_key(
- key,
- cases[0].secret_key,
- cases[0].region,
- NULL),
- "time string cannot be NULL" )
+ JSVERIFY(FAIL, H5FD_s3comms_signing_key(NULL, cases[0].secret_key, cases[0].region, cases[0].when),
+ "destination cannot be NULL")
+
+ JSVERIFY(FAIL, H5FD_s3comms_signing_key(key, NULL, cases[0].region, cases[0].when),
+ "secret key cannot be NULL")
+
+ JSVERIFY(FAIL, H5FD_s3comms_signing_key(key, cases[0].secret_key, NULL, cases[0].when),
+ "aws region cannot be NULL")
+
+ JSVERIFY(FAIL, H5FD_s3comms_signing_key(key, cases[0].secret_key, cases[0].region, NULL),
+ "time string cannot be NULL")
free(key);
key = NULL;
@@ -2332,7 +2270,6 @@ error:
} /* end test_signing_key() */
-
/*---------------------------------------------------------------------------
*
* Function: test_tostringtosign()
@@ -2361,41 +2298,39 @@ test_tostringtosign(void)
* test-local variables *
************************/
- const char canonreq[] = "GET\n/test.txt\n\nhost:examplebucket.s3.amazonaws.com\nrange:bytes=0-9\nx-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-date:20130524T000000Z\n\nhost;range;x-amz-content-sha256;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
+ const char canonreq[] = "GET\n/"
+ "test.txt\n\nhost:examplebucket.s3.amazonaws.com\nrange:bytes=0-9\nx-amz-content-"
+ "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-"
+ "date:20130524T000000Z\n\nhost;range;x-amz-content-sha256;x-amz-"
+ "date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
const char iso8601now[] = "20130524T000000Z";
const char region[] = "us-east-1";
- char s2s[512];
+ char s2s[512];
TESTING("s3comms tostringtosign");
- JSVERIFY( SUCCEED,
- H5FD_s3comms_tostringtosign(s2s, canonreq, iso8601now, region),
- "unable to create string to sign" )
+ JSVERIFY(SUCCEED, H5FD_s3comms_tostringtosign(s2s, canonreq, iso8601now, region),
+ "unable to create string to sign")
- JSVERIFY_STR( "AWS4-HMAC-SHA256\n20130524T000000Z\n20130524/us-east-1/s3/aws4_request\n7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972",
- s2s, NULL )
+ JSVERIFY_STR("AWS4-HMAC-SHA256\n20130524T000000Z\n20130524/us-east-1/s3/"
+ "aws4_request\n7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972",
+ s2s, NULL)
- JSVERIFY( FAIL,
- H5FD_s3comms_tostringtosign(s2s, NULL, iso8601now, region),
- "canonical request string cannot be NULL" )
+ JSVERIFY(FAIL, H5FD_s3comms_tostringtosign(s2s, NULL, iso8601now, region),
+ "canonical request string cannot be NULL")
- JSVERIFY( FAIL,
- H5FD_s3comms_tostringtosign(s2s, canonreq, NULL, region),
- "time string cannot be NULL" )
+ JSVERIFY(FAIL, H5FD_s3comms_tostringtosign(s2s, canonreq, NULL, region), "time string cannot be NULL")
- JSVERIFY( FAIL,
- H5FD_s3comms_tostringtosign(s2s, canonreq, iso8601now, NULL),
- "aws region cannot be NULL" )
+ JSVERIFY(FAIL, H5FD_s3comms_tostringtosign(s2s, canonreq, iso8601now, NULL), "aws region cannot be NULL")
PASSED();
return 0;
-error :
+error:
return -1;
} /* end test_tostringtosign() */
-
/*----------------------------------------------------------------------------
*
* Function: test_trim()
@@ -2428,39 +2363,42 @@ test_trim(void)
************************/
struct testcase cases[] = {
- { "block string",
+ {
+ "block string",
12,
"block string",
12,
},
- { " \n\r \t",
+ {
+ " \n\r \t",
6,
"",
0,
},
- { " \twhite b4",
+ {
+ " \twhite b4",
10,
"white b4",
8,
},
- { "white after\r\n ",
+ {
+ "white after\r\n ",
15,
"white after",
11,
},
- { " on\nends\t",
+ {
+ " on\nends\t",
9,
"on\nends",
7,
},
};
- char dest[32];
- size_t dest_len = 0;
- int i = 0;
- int n_cases = 5;
- char *str = NULL;
-
-
+ char dest[32];
+ size_t dest_len = 0;
+ int i = 0;
+ int n_cases = 5;
+ char * str = NULL;
TESTING("s3comms trim");
@@ -2470,28 +2408,24 @@ test_trim(void)
HDassert(str != NULL);
HDstrncpy(str, cases[i].in, cases[i].in_len);
- JSVERIFY( SUCCEED,
- H5FD_s3comms_trim(dest, str, cases[i].in_len, &dest_len),
- NULL )
- JSVERIFY( cases[i].exp_len, dest_len, cases[i].in )
+ JSVERIFY(SUCCEED, H5FD_s3comms_trim(dest, str, cases[i].in_len, &dest_len), NULL)
+ JSVERIFY(cases[i].exp_len, dest_len, cases[i].in)
if (dest_len > 0) {
- JSVERIFY( 0, strncmp(cases[i].exp, dest, dest_len),
- cases[i].exp )
+ JSVERIFY(0, strncmp(cases[i].exp, dest, dest_len), cases[i].exp)
}
free(str);
str = NULL;
} /* end for each testcase */
- JSVERIFY( SUCCEED, H5FD_s3comms_trim(dest, NULL, 3, &dest_len),
- "should not fail when trimming a null string" );
- JSVERIFY( 0, dest_len, "trimming NULL string writes 0 characters" )
+ JSVERIFY(SUCCEED, H5FD_s3comms_trim(dest, NULL, 3, &dest_len),
+ "should not fail when trimming a null string");
+ JSVERIFY(0, dest_len, "trimming NULL string writes 0 characters")
HDassert(str == NULL);
str = (char *)HDmalloc(sizeof(char *) * 11);
HDassert(str != NULL);
memcpy(str, "some text ", 11); /* string with null terminator */
- JSVERIFY( FAIL, H5FD_s3comms_trim(NULL, str, 10, &dest_len),
- "destination for trim cannot be NULL" );
+ JSVERIFY(FAIL, H5FD_s3comms_trim(NULL, str, 10, &dest_len), "destination for trim cannot be NULL");
free(str);
str = NULL;
@@ -2506,7 +2440,6 @@ error:
} /* end test_trim() */
-
/*----------------------------------------------------------------------------
*
* Function: test_uriencode()
@@ -2538,68 +2471,61 @@ test_uriencode(void)
* test-local variables *
************************/
- struct testcase cases[] = {
- { "/path/to/resource.jpg",
- 21,
- FALSE,
- "/path/to/resource.jpg",
- },
- { "/path/to/resource.jpg",
- 21,
- TRUE,
- "%2Fpath%2Fto%2Fresource.jpg",
- },
- { "string got_spaa ces",
- 20,
- TRUE,
- "string%20got_spaa%20%20ces",
- },
- { "sp ac~es/and-sl ash.encoded",
- 27,
- TRUE,
- "sp%20ac~es%2Fand-sl%20ash.encoded",
- },
- { "sp ac~es/and-sl ash.unencoded",
- 29,
- FALSE,
- "sp%20ac~es/and-sl%20ash.unencoded",
- },
- { "/path/to/resource.txt",
- 0,
- FALSE,
- "",
-
- }
- };
- char *dest = NULL;
- size_t dest_written = 0;
- int i = 0;
- int ncases = 6;
- size_t str_len = 0;
-
-
+ struct testcase cases[] = {{
+ "/path/to/resource.jpg",
+ 21,
+ FALSE,
+ "/path/to/resource.jpg",
+ },
+ {
+ "/path/to/resource.jpg",
+ 21,
+ TRUE,
+ "%2Fpath%2Fto%2Fresource.jpg",
+ },
+ {
+ "string got_spaa ces",
+ 20,
+ TRUE,
+ "string%20got_spaa%20%20ces",
+ },
+ {
+ "sp ac~es/and-sl ash.encoded",
+ 27,
+ TRUE,
+ "sp%20ac~es%2Fand-sl%20ash.encoded",
+ },
+ {
+ "sp ac~es/and-sl ash.unencoded",
+ 29,
+ FALSE,
+ "sp%20ac~es/and-sl%20ash.unencoded",
+ },
+ {
+ "/path/to/resource.txt",
+ 0,
+ FALSE,
+ "",
+
+ }};
+ char * dest = NULL;
+ size_t dest_written = 0;
+ int i = 0;
+ int ncases = 6;
+ size_t str_len = 0;
TESTING("s3comms uriencode")
for (i = 0; i < ncases; i++) {
str_len = cases[i].s_len;
- dest = (char *)HDmalloc(sizeof(char) * str_len * 3 + 1);
- FAIL_IF( dest == NULL )
-
- JSVERIFY( SUCCEED,
- H5FD_s3comms_uriencode(
- dest,
- cases[i].str,
- str_len,
- cases[i].encode_slash,
- &dest_written),
- NULL );
- JSVERIFY( HDstrlen(cases[i].expected),
- dest_written,
- NULL )
- JSVERIFY( 0,
- strncmp(dest, cases[i].expected, dest_written),
- cases[i].expected );
+ dest = (char *)HDmalloc(sizeof(char) * str_len * 3 + 1);
+ FAIL_IF(dest == NULL)
+
+ JSVERIFY(SUCCEED,
+ H5FD_s3comms_uriencode(dest, cases[i].str, str_len, cases[i].encode_slash, &dest_written),
+ NULL);
+ JSVERIFY(HDstrlen(cases[i].expected), dest_written, NULL)
+ JSVERIFY(0, strncmp(dest, cases[i].expected, dest_written), cases[i].expected);
free(dest);
dest = NULL;
@@ -2612,12 +2538,10 @@ test_uriencode(void)
dest = (char *)HDmalloc(sizeof(char) * 15);
HDassert(dest != NULL);
- JSVERIFY( FAIL,
- H5FD_s3comms_uriencode(NULL, "word$", 5, false, &dest_written),
- "destination cannot be NULL" );
- JSVERIFY( FAIL,
- H5FD_s3comms_uriencode(dest, NULL, 5, false, &dest_written),
- "source string cannot be NULL" );
+ JSVERIFY(FAIL, H5FD_s3comms_uriencode(NULL, "word$", 5, false, &dest_written),
+ "destination cannot be NULL");
+ JSVERIFY(FAIL, H5FD_s3comms_uriencode(dest, NULL, 5, false, &dest_written),
+ "source string cannot be NULL");
free(dest);
dest = NULL;
@@ -2635,8 +2559,6 @@ error:
#endif /* H5_HAVE_ROS3_VFD */
-
-
/*-------------------------------------------------------------------------
* Function: main()
*
@@ -2658,7 +2580,7 @@ int
main(void)
{
#ifdef H5_HAVE_ROS3_VFD
- int nerrors = 0;
+ int nerrors = 0;
const char *bucket_url_env = NULL;
h5_reset();
@@ -2675,24 +2597,20 @@ main(void)
s3_test_aws_region[0] = '\0';
s3_test_bucket_url[0] = '\0';
-/* TODO: unit/regression test for H5FD_s3comms_load_aws_profile()
- * requires a few test files and/or manipulation of default path
- */
+ /* TODO: unit/regression test for H5FD_s3comms_load_aws_profile()
+ * requires a few test files and/or manipulation of default path
+ */
/* attempt to load test credentials
* if unable, certain tests will be skipped
*/
- if (SUCCEED == H5FD_s3comms_load_aws_profile(
- S3_TEST_PROFILE_NAME,
- s3_test_aws_access_key_id,
- s3_test_aws_secret_access_key,
- s3_test_aws_region))
- {
+ if (SUCCEED == H5FD_s3comms_load_aws_profile(S3_TEST_PROFILE_NAME, s3_test_aws_access_key_id,
+ s3_test_aws_secret_access_key, s3_test_aws_region)) {
s3_test_credentials_loaded = 1;
}
bucket_url_env = HDgetenv("HDF5_ROS3_TEST_BUCKET_URL");
if (bucket_url_env == NULL || bucket_url_env[0] == '\0') {
- HDprintf("WARNING: S3 bucket url is not defined in enviornment " \
+ HDprintf("WARNING: S3 bucket url is not defined in enviornment "
"variable 'HDF5_ROS3_TEST_BUCKET_URL'!\n");
}
else {
@@ -2702,26 +2620,24 @@ main(void)
/* tests ordered rougly by dependence */
nerrors += test_macro_format_credential() < 0 ? 1 : 0;
- nerrors += test_trim() < 0 ? 1 : 0;
- nerrors += test_nlowercase() < 0 ? 1 : 0;
- nerrors += test_uriencode() < 0 ? 1 : 0;
- nerrors += test_percent_encode_char() < 0 ? 1 : 0;
- nerrors += test_bytes_to_hex() < 0 ? 1 : 0;
- nerrors += test_HMAC_SHA256() < 0 ? 1 : 0;
- nerrors += test_signing_key() < 0 ? 1 : 0;
- nerrors += test_hrb_node_set() < 0 ? 1 : 0;
- nerrors += test_hrb_init_request() < 0 ? 1 : 0;
- nerrors += test_parse_url() < 0 ? 1 : 0;
- nerrors += test_aws_canonical_request() < 0 ? 1 : 0;
- nerrors += test_tostringtosign() < 0 ? 1 : 0;
- nerrors += test_s3r_open() < 0 ? 1 : 0;
- nerrors += test_s3r_get_filesize() < 0 ? 1 : 0;
- nerrors += test_s3r_read() < 0 ? 1 : 0;
+ nerrors += test_trim() < 0 ? 1 : 0;
+ nerrors += test_nlowercase() < 0 ? 1 : 0;
+ nerrors += test_uriencode() < 0 ? 1 : 0;
+ nerrors += test_percent_encode_char() < 0 ? 1 : 0;
+ nerrors += test_bytes_to_hex() < 0 ? 1 : 0;
+ nerrors += test_HMAC_SHA256() < 0 ? 1 : 0;
+ nerrors += test_signing_key() < 0 ? 1 : 0;
+ nerrors += test_hrb_node_set() < 0 ? 1 : 0;
+ nerrors += test_hrb_init_request() < 0 ? 1 : 0;
+ nerrors += test_parse_url() < 0 ? 1 : 0;
+ nerrors += test_aws_canonical_request() < 0 ? 1 : 0;
+ nerrors += test_tostringtosign() < 0 ? 1 : 0;
+ nerrors += test_s3r_open() < 0 ? 1 : 0;
+ nerrors += test_s3r_get_filesize() < 0 ? 1 : 0;
+ nerrors += test_s3r_read() < 0 ? 1 : 0;
if (nerrors) {
- HDprintf("***** %d S3comms TEST%s FAILED! *****\n",
- nerrors,
- nerrors > 1 ? "S" : "");
+ HDprintf("***** %d S3comms TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
return 1;
}
@@ -2737,4 +2653,3 @@ main(void)
#endif /* H5_HAVE_ROS3_VFD */
} /* end main() */
-
diff --git a/test/set_extent.c b/test/set_extent.c
index 17bdb1b..133ba48 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -27,122 +27,98 @@
*-------------------------------------------------------------------------
*/
-const char *FILENAME[] = {
- "set_extent1",
- "set_extent2",
- "set_extent3",
- "set_extent4",
- "set_extent5",
- "set_extent6",
- NULL
-};
-
-#define NAME_BUF_SIZE 1024
+const char *FILENAME[] = {"set_extent1", "set_extent2", "set_extent3", "set_extent4",
+ "set_extent5", "set_extent6", NULL};
+
+#define NAME_BUF_SIZE 1024
#define EXT_FILE_NAME1 "ext1.bin"
#define EXT_FILE_NAME2 "ext2.bin"
-#define CONFIG_COMPRESS 0x01u
-#define CONFIG_FILL 0x02u
-#define CONFIG_EARLY_ALLOC 0x04u
-#define CONFIG_UNFILT_EDGE 0x08u
-#define CONFIG_ALL (CONFIG_COMPRESS + CONFIG_FILL \
- + CONFIG_EARLY_ALLOC + CONFIG_UNFILT_EDGE)
-#define FILL_VALUE -1
-#define DO_RANKS_PRINT_CONFIG(TEST) { \
- HDprintf(" Config:\n"); \
- HDprintf(" Test: %s\n", TEST); \
- HDprintf(" Compression: %s\n", (config & CONFIG_COMPRESS ? "yes" : "no")); \
- HDprintf(" Fill value: %s\n", (do_fillvalue ? "yes" : "no")); \
- HDprintf(" Early allocation: %s\n", (config & CONFIG_EARLY_ALLOC ? "yes" \
- : "no")); \
- HDprintf(" Edge chunk filters: %s\n", (config & CONFIG_UNFILT_EDGE \
- ? "disabled" : "enabled")); \
-} /* end DO_RANKS_PRINT_CONFIG */
-
-#define RANK1 1
-#define RANK2 2
-#define RANK3 3
-#define DIM0 5
-#define DIM1 5
-#define DIM2 5
-#define DIMS0 3
-#define DIMS1 3
-#define DIMS2 3
-#define DIME0 7
-#define DIME1 7
-#define DIME2 7
-#define ISTORE_IK 64
-#define RAND4_NITER 100
+#define CONFIG_COMPRESS 0x01u
+#define CONFIG_FILL 0x02u
+#define CONFIG_EARLY_ALLOC 0x04u
+#define CONFIG_UNFILT_EDGE 0x08u
+#define CONFIG_ALL (CONFIG_COMPRESS + CONFIG_FILL + CONFIG_EARLY_ALLOC + CONFIG_UNFILT_EDGE)
+#define FILL_VALUE -1
+#define DO_RANKS_PRINT_CONFIG(TEST) \
+ { \
+ HDprintf(" Config:\n"); \
+ HDprintf(" Test: %s\n", TEST); \
+ HDprintf(" Compression: %s\n", (config & CONFIG_COMPRESS ? "yes" : "no")); \
+ HDprintf(" Fill value: %s\n", (do_fillvalue ? "yes" : "no")); \
+ HDprintf(" Early allocation: %s\n", (config & CONFIG_EARLY_ALLOC ? "yes" : "no")); \
+ HDprintf(" Edge chunk filters: %s\n", (config & CONFIG_UNFILT_EDGE ? "disabled" : "enabled")); \
+ } /* end DO_RANKS_PRINT_CONFIG */
+
+#define RANK1 1
+#define RANK2 2
+#define RANK3 3
+#define DIM0 5
+#define DIM1 5
+#define DIM2 5
+#define DIMS0 3
+#define DIMS1 3
+#define DIMS2 3
+#define DIME0 7
+#define DIME1 7
+#define DIME2 7
+#define ISTORE_IK 64
+#define RAND4_NITER 100
#define RAND4_SPARSE_SWITCH 10
-#define RAND4_FAIL_DUMP(NDIM_SETS, J, K, L, M) { \
- H5_FAILED(); AT(); \
- test_random_rank4_dump(NDIM_SETS, dim_log, cdims, J, K, L, M); \
- goto error; \
-} /* end RAND4_FAIL_DUMP */
-#define RAND4_VL_NITER 40
+#define RAND4_FAIL_DUMP(NDIM_SETS, J, K, L, M) \
+ { \
+ H5_FAILED(); \
+ AT(); \
+ test_random_rank4_dump(NDIM_SETS, dim_log, cdims, J, K, L, M); \
+ goto error; \
+ } /* end RAND4_FAIL_DUMP */
+#define RAND4_VL_NITER 40
#define RAND4_VL_SPARSE_SWITCH 5
typedef enum rank4_index_t {
- RANK4_INDEX_BTREE = 0, /* Use b-tree (1/2) as chunk index */
- RANK4_INDEX_FARRAY, /* Use fixed array as chunk index */
- RANK4_INDEX_EARRAY, /* Use extensible array as chunk index */
- RANK4_NINDICES, /* Must be last */
+ RANK4_INDEX_BTREE = 0, /* Use b-tree (1/2) as chunk index */
+ RANK4_INDEX_FARRAY, /* Use fixed array as chunk index */
+ RANK4_INDEX_EARRAY, /* Use extensible array as chunk index */
+ RANK4_NINDICES, /* Must be last */
} rank4_index_t;
-static int do_ranks( hid_t fapl, hbool_t new_format );
-static int do_layouts( hid_t fapl );
-
-static int test_rank1( hid_t fapl,
- hid_t dcpl,
- hbool_t do_fill_value,
- hbool_t disable_edge_filters,
- hbool_t set_istore_k);
-static int test_rank2( hid_t fapl,
- hid_t dcpl,
- hbool_t do_fill_value,
- hbool_t disable_edge_filters,
- hbool_t set_istore_k);
-static int test_rank3( hid_t fapl,
- hid_t dcpl,
- hbool_t do_fill_value,
- hbool_t disable_edge_filters,
- hbool_t set_istore_k);
-static int test_random_rank4( hid_t fapl,
- hid_t dcpl,
- hbool_t do_fillvalue,
- hbool_t disable_edge_filters,
- hbool_t do_sparse,
- rank4_index_t index_type);
-static int test_random_rank4_vl( hid_t fapl,
- hid_t dcpl,
- hbool_t do_fillvalue,
- hbool_t disable_edge_filters,
- hbool_t do_sparse,
- rank4_index_t index_type);
-
-static int test_external( hid_t fapl );
-static int test_layouts( H5D_layout_t layout, hid_t fapl );
-static void test_random_rank4_dump( unsigned ndim_sets, hsize_t dim_log[][4],
- hsize_t cdims[4], int j, int k, int l, int m );
+static int do_ranks(hid_t fapl, hbool_t new_format);
+static int do_layouts(hid_t fapl);
+
+static int test_rank1(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
+ hbool_t set_istore_k);
+static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
+ hbool_t set_istore_k);
+static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
+ hbool_t set_istore_k);
+static int test_random_rank4(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
+ hbool_t do_sparse, rank4_index_t index_type);
+static int test_random_rank4_vl(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
+ hbool_t do_sparse, rank4_index_t index_type);
+
+static int test_external(hid_t fapl);
+static int test_layouts(H5D_layout_t layout, hid_t fapl);
+static void test_random_rank4_dump(unsigned ndim_sets, hsize_t dim_log[][4], hsize_t cdims[4], int j, int k,
+ int l, int m);
/*-------------------------------------------------------------------------
* main
*-------------------------------------------------------------------------
*/
-int main( void )
+int
+main(void)
{
- hid_t fapl; /* file access property list */
- hid_t fapl2; /* file access property list w/latest format set */
- unsigned new_format; /* Whether to use the latest file format */
- unsigned chunk_cache; /* Whether to enable chunk caching */
- int nerrors = 0;
- const char *env_h5_drvr; /* File Driver value from environment */
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
-
+ hid_t fapl; /* file access property list */
+ hid_t fapl2; /* file access property list w/latest format set */
+ unsigned new_format; /* Whether to use the latest file format */
+ unsigned chunk_cache; /* Whether to enable chunk caching */
+ int nerrors = 0;
+ const char *env_h5_drvr; /* File Driver value from environment */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
/* Current VFD that does not support contigous address space */
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
@@ -154,31 +130,35 @@ int main( void )
fapl = h5_fileaccess();
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Set chunk cache so only part of the chunks can be cached on fapl */
- if(H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75F) < 0) TEST_ERROR
+ if (H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75F) < 0)
+ TEST_ERROR
/* Disable chunk caching on fapl2 */
- if(H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0F) < 0) TEST_ERROR
+ if (H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0F) < 0)
+ TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
/* Test with old & new format groups */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl;
/* Test chunked datasets with and without chunk cache */
- for(chunk_cache = FALSE; chunk_cache <= TRUE; chunk_cache++) {
+ for (chunk_cache = FALSE; chunk_cache <= TRUE; chunk_cache++) {
/* Output message about the type of format */
- if(new_format)
+ if (new_format)
HDprintf("Testing with new file format");
else
HDprintf("Testing with old file format");
/* Set the FAPL for the chunk cache settings */
- if(chunk_cache) {
+ if (chunk_cache) {
HDputs(" and chunk cache enabled:");
my_fapl = fapl;
} /* end if */
@@ -188,32 +168,33 @@ int main( void )
} /* end else */
/* Set the FAPL for the type of format */
- if(new_format) {
+ if (new_format) {
/* Set the "use the latest version of the format" bounds for
* creating objects in the file */
- if(H5Pset_libver_bounds(my_fapl, H5F_LIBVER_LATEST,
- H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(my_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
} /* end if */
else
/* Set the "use the earliest version of the format" bounds for
* creating objects in the file */
- if(H5Pset_libver_bounds(my_fapl, H5F_LIBVER_EARLIEST,
- H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(my_fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
/* Tests which use chunked datasets */
- if(!new_format || (new_format && contig_addr_vfd))
- nerrors += do_ranks( my_fapl, new_format ) < 0 ? 1 : 0;
+ if (!new_format || (new_format && contig_addr_vfd))
+ nerrors += do_ranks(my_fapl, new_format) < 0 ? 1 : 0;
} /* end for */
/* Tests which do not use chunked datasets */
- if(!new_format || (new_format && contig_addr_vfd)) {
- nerrors += test_external( fapl ) < 0 ? 1 : 0;
- nerrors += do_layouts( fapl ) < 0 ? 1 : 0;
+ if (!new_format || (new_format && contig_addr_vfd)) {
+ nerrors += test_external(fapl) < 0 ? 1 : 0;
+ nerrors += do_layouts(fapl) < 0 ? 1 : 0;
}
} /* end for */
/* Close 2nd FAPL */
- if(H5Pclose(fapl2) < 0) TEST_ERROR
+ if (H5Pclose(fapl2) < 0)
+ TEST_ERROR
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
@@ -223,7 +204,7 @@ int main( void )
HDremove(EXT_FILE_NAME1);
HDremove(EXT_FILE_NAME2);
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All H5Dset_extent tests passed.");
@@ -231,180 +212,174 @@ int main( void )
error:
nerrors = MAX(1, nerrors);
- HDprintf("***** %d H5Dset_extent TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d H5Dset_extent TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return 1;
}
-
/*-------------------------------------------------------------------------
-* test with several ranks
-*-------------------------------------------------------------------------
-*/
-static int do_ranks( hid_t fapl, hbool_t new_format )
+ * test with several ranks
+ *-------------------------------------------------------------------------
+ */
+static int
+do_ranks(hid_t fapl, hbool_t new_format)
{
- hbool_t do_fillvalue = FALSE;
- hbool_t disable_edge_filters = FALSE;
+ hbool_t do_fillvalue = FALSE;
+ hbool_t disable_edge_filters = FALSE;
rank4_index_t index_type;
- hid_t dcpl = -1;
- int fillvalue = FILL_VALUE;
- unsigned config;
+ hid_t dcpl = -1;
+ int fillvalue = FILL_VALUE;
+ unsigned config;
TESTING_2("datasets with ranks 1 to 4 (all configurations)");
/* Loop over different configurations for tests */
- for(config=0; config<=CONFIG_ALL; config++) {
+ for (config = 0; config <= CONFIG_ALL; config++) {
/* Create DCPL and add appropriate settings */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(config & CONFIG_COMPRESS) {
+ if (config & CONFIG_COMPRESS) {
#ifdef H5_HAVE_FILTER_DEFLATE
- if(H5Pset_deflate(dcpl, 9) < 0)
+ if (H5Pset_deflate(dcpl, 9) < 0)
TEST_ERROR
-#else /* H5_HAVE_FILTER_DEFLATE */
- if(H5Pclose(dcpl) < 0)
+#else /* H5_HAVE_FILTER_DEFLATE */
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
continue;
-#endif /* H5_HAVE_FILTER_DEFLATE */
+#endif /* H5_HAVE_FILTER_DEFLATE */
} /* end if */
- if(config & CONFIG_FILL) {
+ if (config & CONFIG_FILL) {
do_fillvalue = TRUE;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
TEST_ERROR
} /* end if */
else
do_fillvalue = FALSE;
- if(config & CONFIG_EARLY_ALLOC)
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ if (config & CONFIG_EARLY_ALLOC)
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
TEST_ERROR
- if(config & CONFIG_UNFILT_EDGE)
+ if (config & CONFIG_UNFILT_EDGE)
disable_edge_filters = TRUE;
else
disable_edge_filters = FALSE;
/* Run tests */
- if(do_fillvalue) {
+ if (do_fillvalue) {
unsigned ifset;
/* Iterate over different fill times */
- for(ifset=0; ifset<=1; ifset++) {
- if(ifset) {
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
+ for (ifset = 0; ifset <= 1; ifset++) {
+ if (ifset) {
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
TEST_ERROR
} /* end if */
- else
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
- TEST_ERROR
+ else if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ TEST_ERROR
- if(test_rank1(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
+ if (test_rank1(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
DO_RANKS_PRINT_CONFIG("Rank 1")
- HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET"
- : "H5D_FILL_TIME_ALLOC"));
+ HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC"));
goto error;
} /* end if */
- if(test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
+ if (test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
DO_RANKS_PRINT_CONFIG("Rank 2")
- HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET"
- : "H5D_FILL_TIME_ALLOC"));
+ HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC"));
goto error;
} /* end if */
- if(test_rank3(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
+ if (test_rank3(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
DO_RANKS_PRINT_CONFIG("Rank 3")
- HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET"
- : "H5D_FILL_TIME_ALLOC"));
+ HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC"));
goto error;
} /* end if */
- if(test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE) < 0) {
+ if (test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE) < 0) {
DO_RANKS_PRINT_CONFIG("Rank 2 with non-default indexed storage B-tree")
- HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET"
- : "H5D_FILL_TIME_ALLOC"));
+ HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC"));
goto error;
} /* end if */
- } /* end for */
- } /* end if */
+ } /* end for */
+ } /* end if */
else {
/* These tests expect fill values to be written even if there is no
* fill value defined */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
TEST_ERROR
- if(test_rank1(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
+ if (test_rank1(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
DO_RANKS_PRINT_CONFIG("Rank 1")
goto error;
} /* end if */
- if(test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
+ if (test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
DO_RANKS_PRINT_CONFIG("Rank 2")
goto error;
} /* end if */
- if(test_rank3(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
+ if (test_rank3(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
DO_RANKS_PRINT_CONFIG("Rank 3")
goto error;
} /* end if */
- if(test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE) < 0) {
+ if (test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE) < 0) {
DO_RANKS_PRINT_CONFIG("Rank 2 with non-default indexed storage B-tree")
goto error;
} /* end if */
- } /* end else */
+ } /* end else */
/* The rank 4 test expects the fill value to be written only if
* defined */
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
+ if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
TEST_ERROR
/* Iterate over different index types, but only if using the new format
*/
- for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; index_type++) {
+ for (index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; index_type++) {
/* Standard test */
- if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) {
+ if (test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4")
HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
- ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray"
- : "earray"));
+ ? "btree"
+ : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray"));
goto error;
} /* end if */
/* VL test */
- if(test_random_rank4_vl(fapl, dcpl, do_fillvalue,
- disable_edge_filters, FALSE, index_type) < 0) {
+ if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length")
HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
- ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray"
- : "earray"));
+ ? "btree"
+ : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray"));
goto error;
} /* end if */
/* Sparse allocation test (regular and VL) */
- if(!(config & CONFIG_EARLY_ALLOC)) {
- if(test_random_rank4(fapl, dcpl, do_fillvalue,
- disable_edge_filters, TRUE, index_type) < 0) {
+ if (!(config & CONFIG_EARLY_ALLOC)) {
+ if (test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4 with sparse allocation")
- HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
- ? "btree" : (index_type == RANK4_INDEX_FARRAY
- ? "farray" : "earray"));
+ HDprintf(" Index: %s\n",
+ index_type == RANK4_INDEX_BTREE
+ ? "btree"
+ : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray"));
goto error;
} /* end if */
- if(test_random_rank4_vl(fapl, dcpl, do_fillvalue,
- disable_edge_filters, TRUE, index_type) < 0) {
+ if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) <
+ 0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length with sparse allocation")
- HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
- ? "btree" : (index_type == RANK4_INDEX_FARRAY
- ? "farray" : "earray"));
+ HDprintf(" Index: %s\n",
+ index_type == RANK4_INDEX_BTREE
+ ? "btree"
+ : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray"));
goto error;
} /* end if */
- } /* end if */
+ } /* end if */
/* Break out if using the old format */
- if(!new_format)
+ if (!new_format)
break;
} /* end for */
/* Close dcpl */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
} /* end for */
@@ -413,36 +388,34 @@ static int do_ranks( hid_t fapl, hbool_t new_format )
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { H5Pclose(dcpl); }
+ H5E_END_TRY
return -1;
} /* end do_ranks */
-
/*-------------------------------------------------------------------------
-* test with different storage layouts
-*-------------------------------------------------------------------------
-*/
-static int do_layouts( hid_t fapl )
+ * test with different storage layouts
+ *-------------------------------------------------------------------------
+ */
+static int
+do_layouts(hid_t fapl)
{
- hid_t new_fapl = -1;
+ hid_t new_fapl = -1;
H5F_libver_t low, high; /* Low and high bounds */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
TESTING("storage layout use - tested with all low/high library format bounds");
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Copy plist to use locally to avoid modifying the original */
new_fapl = H5Pcopy(fapl);
/* Set version bounds */
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(new_fapl, low, high);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
{
@@ -451,26 +424,24 @@ static int do_layouts( hid_t fapl )
continue;
}
- if (test_layouts( H5D_COMPACT, new_fapl ) < 0)
+ if (test_layouts(H5D_COMPACT, new_fapl) < 0)
goto error;
- if (test_layouts( H5D_CONTIGUOUS, new_fapl ) < 0)
+ if (test_layouts(H5D_CONTIGUOUS, new_fapl) < 0)
goto error;
if (H5Pclose(new_fapl) < 0)
goto error;
} /* end for high */
- } /* end for low */
+ } /* end for low */
PASSED();
return 0;
error:
- H5E_BEGIN_TRY
- {
- H5Pclose(new_fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(new_fapl); }
+ H5E_END_TRY;
return -1;
}
@@ -479,23 +450,20 @@ error:
*-------------------------------------------------------------------------
*/
-static int test_rank1( hid_t fapl,
- hid_t dcpl,
- hbool_t do_fill_value,
- hbool_t disable_edge_filters,
- hbool_t set_istore_k)
+static int
+test_rank1(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k)
{
- hid_t fid=-1;
- hid_t did=-1;
- hid_t sid=-1;
- hid_t my_dcpl=-1;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t sid = -1;
+ hid_t my_dcpl = -1;
hid_t fcpl;
- hsize_t dims_o[RANK1] = {DIM0}; /* original dimensions */
- hsize_t dims_s[RANK1] = {DIMS0}; /* shrinking dimensions */
- hsize_t dims_e[RANK1] = {DIME0}; /* extended dimensions */
- hsize_t dims_c[RANK1] = {2}; /* chunk dimensions */
- hsize_t dims_r[RANK1]; /* read dimensions */
+ hsize_t dims_o[RANK1] = {DIM0}; /* original dimensions */
+ hsize_t dims_s[RANK1] = {DIMS0}; /* shrinking dimensions */
+ hsize_t dims_e[RANK1] = {DIME0}; /* extended dimensions */
+ hsize_t dims_c[RANK1] = {2}; /* chunk dimensions */
+ hsize_t dims_r[RANK1]; /* read dimensions */
hsize_t maxdims[RANK1] = {H5S_UNLIMITED};
int buf_o[DIM0];
int buf_s[DIMS0];
@@ -505,43 +473,43 @@ static int test_rank1( hid_t fapl,
int comp_value;
char filename[NAME_BUF_SIZE];
- if(do_fill_value)
+ if (do_fill_value)
comp_value = FILL_VALUE;
else
comp_value = 0;
- for(i = 0; i < DIM0; i++ )
+ for (i = 0; i < DIM0; i++)
buf_o[i] = 2;
/* create a file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR
/* set non-default indexed storage B-tree internal 'K' value */
- if(set_istore_k)
- if(H5Pset_istore_k(fcpl,ISTORE_IK) < 0)
+ if (set_istore_k)
+ if (H5Pset_istore_k(fcpl, ISTORE_IK) < 0)
TEST_ERROR
/* create a new file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
TEST_ERROR
/* close property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
TEST_ERROR
/* create the data space with unlimited dimensions. */
- if((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
+ if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
TEST_ERROR
/* modify dataset creation properties, i.e. enable chunking. */
- if((my_dcpl = H5Pcopy (dcpl)) < 0)
+ if ((my_dcpl = H5Pcopy(dcpl)) < 0)
TEST_ERROR
- if(H5Pset_chunk(my_dcpl, RANK1, dims_c) < 0)
+ if (H5Pset_chunk(my_dcpl, RANK1, dims_c) < 0)
TEST_ERROR
- if(disable_edge_filters)
- if(H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ if (disable_edge_filters)
+ if (H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
TEST_ERROR
/*-------------------------------------------------------------------------
@@ -550,21 +518,21 @@ static int test_rank1( hid_t fapl,
*/
/* create a dataset */
- if((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* write */
- if(H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
TEST_ERROR
-#if defined (H5_SET_EXTENT_DEBUG)
+#if defined(H5_SET_EXTENT_DEBUG)
HDprintf("\n buf_o: ");
- for (i = 0; i < (int)dims_o[0]; i++ )
+ for (i = 0; i < (int)dims_o[0]; i++)
HDprintf("%d ", buf_o[i]);
HDprintf("\n");
#endif
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/*-------------------------------------------------------------------------
@@ -573,22 +541,22 @@ static int test_rank1( hid_t fapl,
*/
/* set new dimensions for the array. */
- if(H5Dset_extent(did , dims_e) < 0)
+ if (H5Dset_extent(did, dims_e) < 0)
TEST_ERROR
/* get the space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
TEST_ERROR
/* get dimensions */
- if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/* check dimensions */
- for( i = 0; i < RANK1; i++ )
+ for (i = 0; i < RANK1; i++)
if (dims_r[i] != dims_e[i])
TEST_ERROR
@@ -596,89 +564,85 @@ static int test_rank1( hid_t fapl,
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
TEST_ERROR
-
-#if defined (H5_SET_EXTENT_DEBUG)
+#if defined(H5_SET_EXTENT_DEBUG)
HDprintf("\n buf_e: ");
- for (i = 0; i < (int)dims_r[0]; i++ )
+ for (i = 0; i < (int)dims_r[0]; i++)
HDprintf("%d ", buf_e[i]);
HDprintf("\n");
#endif
/* compare the read array with the expanded array */
- for (i = 0; i < (int)dims_r[0]; i++ )
- if(i >= DIM0) {
- if(buf_e[i] != comp_value) {
+ for (i = 0; i < (int)dims_r[0]; i++)
+ if (i >= DIM0) {
+ if (buf_e[i] != comp_value) {
HDprintf("buf_e[%d] = %d\n", i, buf_e[i]);
HDprintf("expected = %d\n", comp_value);
TEST_ERROR
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(buf_e[i] != buf_o[i])
+ if (buf_e[i] != buf_o[i])
TEST_ERROR
} /* end else */
-
-
/*-------------------------------------------------------------------------
* shrink
*-------------------------------------------------------------------------
*/
/* set new dimensions for the array. */
- if(H5Dset_extent(did , dims_s) < 0)
+ if (H5Dset_extent(did, dims_s) < 0)
TEST_ERROR
/* get the space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
TEST_ERROR
/* get dimensions */
- if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/* check dimensions */
- for( i = 0; i < RANK1; i++ )
+ for (i = 0; i < RANK1; i++)
if (dims_r[i] != dims_s[i])
TEST_ERROR
/* for this case we close and reopen file */
- if(set_istore_k) {
- if(H5Dclose(did) < 0)
+ if (set_istore_k) {
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
- if((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0)
+ if ((did = H5Dopen2(fid, "dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
} /* end if */
-
/*-------------------------------------------------------------------------
* read
*-------------------------------------------------------------------------
*/
/* read */
- if(H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0)
TEST_ERROR
-#if defined (H5_SET_EXTENT_DEBUG)
+#if defined(H5_SET_EXTENT_DEBUG)
HDprintf("\n dims_r: ");
- for (i = 0; i < (int)dims_r[0]; i++ )
+ for (i = 0; i < (int)dims_r[0]; i++)
HDprintf("%d ", buf_s[i]);
HDprintf("\n");
#endif
/* compare the read array with the shrinked array */
- for( i = 0; i < (int)dims_r[0]; i++ )
- if(buf_s[i] != buf_o[i]) {
+ for (i = 0; i < (int)dims_r[0]; i++)
+ if (buf_s[i] != buf_o[i]) {
HDprintf("buf_s[%d] = %d\n", i, buf_s[i]);
HDprintf("buf_o[%d] = %d\n", i, buf_o[i]);
TEST_ERROR
@@ -690,51 +654,50 @@ static int test_rank1( hid_t fapl,
*/
/* set new dimensions for the array */
- if(H5Dset_extent(did, dims_o) < 0)
+ if (H5Dset_extent(did, dims_o) < 0)
TEST_ERROR
/* get the space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
TEST_ERROR
/* get dimensions. */
- if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/* check dimensions */
- for( i = 0; i < RANK1; i++ )
+ for (i = 0; i < RANK1; i++)
if (dims_r[i] != dims_o[i])
TEST_ERROR
/* read */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
TEST_ERROR
-#if defined (H5_SET_EXTENT_DEBUG)
+#if defined(H5_SET_EXTENT_DEBUG)
HDprintf("\n dims_r: ");
- for (i = 0; i < (int)dims_r[0]; i++ )
+ for (i = 0; i < (int)dims_r[0]; i++)
HDprintf("%d ", buf_r[i]);
HDprintf("\n");
#endif
/* compare the read array with the original array */
- for(i = 0; i < (int)dims_r[0]; i++ )
- if(i >= DIMS0 ) {
- if(buf_r[i] != comp_value) {
- HDprintf("buf_r[%d] = %d\n", i, buf_r[i] );
+ for (i = 0; i < (int)dims_r[0]; i++)
+ if (i >= DIMS0) {
+ if (buf_r[i] != comp_value) {
+ HDprintf("buf_r[%d] = %d\n", i, buf_r[i]);
HDprintf("expected = %d\n", comp_value);
TEST_ERROR
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(buf_r[i] != buf_o[i])
+ if (buf_r[i] != buf_o[i])
TEST_ERROR
} /* end else */
-
/*-------------------------------------------------------------------------
* shrink to 0
*-------------------------------------------------------------------------
@@ -743,22 +706,22 @@ static int test_rank1( hid_t fapl,
dims_s[0] = 0;
/* set new dimensions for the array. */
- if(H5Dset_extent(did , dims_s) < 0)
+ if (H5Dset_extent(did, dims_s) < 0)
TEST_ERROR
/* get the space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
TEST_ERROR
/* get dimensions */
- if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/* check dimensions */
- for( i = 0; i < RANK1; i++ )
- if(dims_r[i] != dims_s[i])
+ for (i = 0; i < RANK1; i++)
+ if (dims_r[i] != dims_s[i])
TEST_ERROR
/*-------------------------------------------------------------------------
@@ -766,7 +729,7 @@ static int test_rank1( hid_t fapl,
*-------------------------------------------------------------------------
*/
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
/*-------------------------------------------------------------------------
@@ -774,29 +737,28 @@ static int test_rank1( hid_t fapl,
*-------------------------------------------------------------------------
*/
-
- if((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
+ if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
TEST_ERROR
- if((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* set new dimensions for the array */
- dims_o[ 0 ] = 0;
- if(H5Dset_extent( did , dims_o ) < 0)
+ dims_o[0] = 0;
+ if (H5Dset_extent(did, dims_o) < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR
/*-------------------------------------------------------------------------
* close property list
*-------------------------------------------------------------------------
*/
- if(H5Pclose(my_dcpl) < 0)
+ if (H5Pclose(my_dcpl) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
return 0;
@@ -805,12 +767,13 @@ error:
H5E_BEGIN_TRY
{
- H5Dclose( did );
- H5Sclose( sid );
- H5Pclose( my_dcpl );
- H5Pclose( fcpl );
- H5Fclose( fid );
- } H5E_END_TRY;
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(my_dcpl);
+ H5Pclose(fcpl);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return -1;
} /* end test_rank1() */
@@ -820,30 +783,33 @@ error:
*-------------------------------------------------------------------------
*/
-static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k) {
-
- hid_t fid = -1;
- hid_t did = -1;
- hid_t sid = -1;
- hid_t my_dcpl = -1;
- hid_t fcpl;
- hsize_t dims_o[RANK2] = { DIM0, DIM1 }; /* original dimensions */
- hsize_t dims_s[RANK2] = { DIMS0, DIMS1 }; /* shrinking dimensions */
- hsize_t dims_e[RANK2] = { DIME0, DIME1 }; /* extended dimensions */
- hsize_t dims_c[RANK2] = { 2, 2 }; /* chunk dimensions */
- hsize_t dims_r[RANK2]; /* read dimensions */
- hsize_t maxdims[RANK2] = { H5S_UNLIMITED, H5S_UNLIMITED };
- int buf_o[DIM0][DIM1];
- int buf_s[DIMS0][DIMS1];
- int buf_e[DIME0][DIME1];
- int buf_r[DIM0][DIM1];
- int i, j;
- int comp_value;
- char filename[NAME_BUF_SIZE];
+static int
+test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k)
+{
+
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t sid = -1;
+ hid_t my_dcpl = -1;
+ hid_t fcpl;
+ hsize_t dims_o[RANK2] = {DIM0, DIM1}; /* original dimensions */
+ hsize_t dims_s[RANK2] = {DIMS0, DIMS1}; /* shrinking dimensions */
+ hsize_t dims_e[RANK2] = {DIME0, DIME1}; /* extended dimensions */
+ hsize_t dims_c[RANK2] = {2, 2}; /* chunk dimensions */
+ hsize_t dims_r[RANK2]; /* read dimensions */
+ hsize_t maxdims[RANK2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ int buf_o[DIM0][DIM1];
+ int buf_s[DIMS0][DIMS1];
+ int buf_e[DIME0][DIME1];
+ int buf_r[DIM0][DIM1];
+ int i, j;
+ int comp_value;
+ char filename[NAME_BUF_SIZE];
if (do_fill_value) {
comp_value = FILL_VALUE;
- } else {
+ }
+ else {
comp_value = 0;
}
@@ -863,7 +829,6 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
if (H5Pset_istore_k(fcpl, ISTORE_IK) < 0) {
TEST_ERROR
}
-
}
/* create a new file */
@@ -888,25 +853,25 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
if (H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
TEST_ERROR
- /*-------------------------------------------------------------------------
- * Procedure 1
- * a. Write an array AxB. These are the dimensions for creating the dataset
- * b. Define a greater array CxD where C > A and D > B
- * c. Read data back
- * d. Verify if new dimensions are C and D
- * e. Verify if data from A to C and B to D is what it is to be expected
- *
- * original data is
- *
- * 2 2 2 2
- * 2 2 2 2
- * 2 2 2 2
- * 2 2 2 2
- *
- *-------------------------------------------------------------------------
- */
-
- /* create a dataset */
+ /*-------------------------------------------------------------------------
+ * Procedure 1
+ * a. Write an array AxB. These are the dimensions for creating the dataset
+ * b. Define a greater array CxD where C > A and D > B
+ * c. Read data back
+ * d. Verify if new dimensions are C and D
+ * e. Verify if data from A to C and B to D is what it is to be expected
+ *
+ * original data is
+ *
+ * 2 2 2 2
+ * 2 2 2 2
+ * 2 2 2 2
+ * 2 2 2 2
+ *
+ *-------------------------------------------------------------------------
+ */
+
+ /* create a dataset */
if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) {
TEST_ERROR
}
@@ -916,10 +881,10 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
TEST_ERROR
}
-#if defined (H5_SET_EXTENT_DEBUG2)
+#if defined(H5_SET_EXTENT_DEBUG2)
HDprintf("\n");
- for (i = 0; i < (int)dims_o[0]; i++ ) {
- for (j = 0; j < (int)dims_o[1]; j++ ) {
+ for (i = 0; i < (int)dims_o[0]; i++) {
+ for (j = 0; j < (int)dims_o[1]; j++) {
HDprintf("%d ", buf_o[i][j]);
}
HDprintf("\n");
@@ -931,19 +896,19 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * set new dimensions for the array; expand it
- * data is now, extended space was initialized with fill value or default value
- *
- * 2 2 2 2 1 1 1
- * 2 2 2 2 1 1 1
- * 2 2 2 2 1 1 1
- * 2 2 2 2 1 1 1
- * 1 1 1 1 1 1 1
- * 1 1 1 1 1 1 1
- * 1 1 1 1 1 1 1
- *
- *-------------------------------------------------------------------------
- */
+ * set new dimensions for the array; expand it
+ * data is now, extended space was initialized with fill value or default value
+ *
+ * 2 2 2 2 1 1 1
+ * 2 2 2 2 1 1 1
+ * 2 2 2 2 1 1 1
+ * 2 2 2 2 1 1 1
+ * 1 1 1 1 1 1 1
+ * 1 1 1 1 1 1 1
+ * 1 1 1 1 1 1 1
+ *
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array. */
if (H5Dset_extent(did, dims_e) < 0) {
@@ -974,26 +939,27 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
TEST_ERROR
-#if defined (H5_SET_EXTENT_DEBUG2)
+#if defined(H5_SET_EXTENT_DEBUG2)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
HDprintf("%d ", buf_e[i][j]);
}
HDprintf("\n");
}
#endif
- /* compare the read array with the expanded array */
- for (i = 0; i < (int) dims_r[0]; i++) {
- for (j = 0; j < (int) dims_r[1]; j++) {
+ /* compare the read array with the expanded array */
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
if (i >= DIM0 || j >= DIM1) {
if (buf_e[i][j] != comp_value) {
HDprintf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]);
HDprintf("value = %d\n", comp_value);
TEST_ERROR
}
- } else {
+ }
+ else {
if (buf_e[i][j] != buf_o[i][j])
TEST_ERROR
}
@@ -1001,20 +967,20 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- *
- * Procedure 2
- * a. Define a smaller array ExF where E < A and F < B
- * b. Read data back
- * c. Verify if new dimensions are E and F
- * d. Verify if data up until E and F is what to be expected
- *
- * data is now
- *
- * 2 2
- * 2 2
- *
- *-------------------------------------------------------------------------
- */
+ *
+ * Procedure 2
+ * a. Define a smaller array ExF where E < A and F < B
+ * b. Read data back
+ * c. Verify if new dimensions are E and F
+ * d. Verify if data up until E and F is what to be expected
+ *
+ * data is now
+ *
+ * 2 2
+ * 2 2
+ *
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array. */
if (H5Dset_extent(did, dims_s) < 0) {
@@ -1058,23 +1024,22 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
if ((did = H5Dopen2(fid, "dset1", H5P_DEFAULT)) < 0) {
TEST_ERROR
}
-
}
/*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
+ * read
+ *-------------------------------------------------------------------------
+ */
/* read */
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) {
TEST_ERROR
}
-#if defined (H5_SET_EXTENT_DEBUG2)
+#if defined(H5_SET_EXTENT_DEBUG2)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
HDprintf("%d ", buf_s[i][j]);
}
HDprintf("\n");
@@ -1082,8 +1047,8 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
#endif
/* compare the read array with the shrinked array */
- for (i = 0; i < (int) dims_r[0]; i++) {
- for (j = 0; j < (int) dims_r[1]; j++) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
if (buf_s[i][j] != buf_o[i][j]) {
HDprintf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]);
HDprintf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]);
@@ -1093,16 +1058,16 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * set new dimensions for the array; expand it back to original size
- * data is now, extended space was initialized with fill value or default value
- *
- * 2 2 1 1
- * 2 2 1 1
- * 1 1 1 1
- * 1 1 1 1
- *
- *-------------------------------------------------------------------------
- */
+ * set new dimensions for the array; expand it back to original size
+ * data is now, extended space was initialized with fill value or default value
+ *
+ * 2 2 1 1
+ * 2 2 1 1
+ * 1 1 1 1
+ * 1 1 1 1
+ *
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array */
if (H5Dset_extent(did, dims_o) < 0) {
@@ -1130,34 +1095,35 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
+ * read
+ *-------------------------------------------------------------------------
+ */
/* read */
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
TEST_ERROR
-#if defined (H5_SET_EXTENT_DEBUG2)
+#if defined(H5_SET_EXTENT_DEBUG2)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
HDprintf("%d ", buf_r[i][j]);
}
HDprintf("\n");
}
#endif
- /* compare the read array with the original array */
- for (i = 0; i < (int) dims_r[0]; i++) {
- for (j = 0; j < (int) dims_r[1]; j++) {
+ /* compare the read array with the original array */
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
if (i >= DIMS0 || j >= DIMS1) {
if (buf_r[i][j] != comp_value) {
HDprintf("buf_r[%d][%d] = %d\n", i, j, buf_r[i][j]);
HDprintf("value = %d\n", comp_value);
TEST_ERROR
}
- } else {
+ }
+ else {
if (buf_r[i][j] != buf_o[i][j])
TEST_ERROR
}
@@ -1165,10 +1131,10 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * shrink to 0
- *
- *-------------------------------------------------------------------------
- */
+ * shrink to 0
+ *
+ *-------------------------------------------------------------------------
+ */
dims_s[0] = 0;
dims_s[1] = 0;
@@ -1199,11 +1165,11 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * expand then shrink to 0 in dimension 1 while expanding again in
- * dimension 0
- *
- *-------------------------------------------------------------------------
- */
+ * expand then shrink to 0 in dimension 1 while expanding again in
+ * dimension 0
+ *
+ *-------------------------------------------------------------------------
+ */
/* expand to original dimensions for the array. */
if (H5Dset_extent(did, dims_o) < 0) {
@@ -1239,18 +1205,18 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * close dataset
- *-------------------------------------------------------------------------
- */
+ * close dataset
+ *-------------------------------------------------------------------------
+ */
if (H5Dclose(did) < 0) {
TEST_ERROR
}
/*-------------------------------------------------------------------------
- * test a dataset with non initialized chunks
- *-------------------------------------------------------------------------
- */
+ * test a dataset with non initialized chunks
+ *-------------------------------------------------------------------------
+ */
if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) {
TEST_ERROR
@@ -1273,9 +1239,9 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * close property list
- *-------------------------------------------------------------------------
- */
+ * close property list
+ *-------------------------------------------------------------------------
+ */
if (H5Pclose(my_dcpl) < 0) {
TEST_ERROR
@@ -1292,18 +1258,18 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
return 0;
- error:
+error:
H5E_BEGIN_TRY
- {
- H5Dclose(did);
- H5Sclose(sid);
- H5Pclose(my_dcpl);
- H5Pclose(fcpl);
- H5Fclose(fid);
- }H5E_END_TRY;
+ {
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(my_dcpl);
+ H5Pclose(fcpl);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return -1;
-
}
/*-------------------------------------------------------------------------
@@ -1311,30 +1277,33 @@ static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
*-------------------------------------------------------------------------
*/
-static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k) {
-
- hid_t fid = -1;
- hid_t did = -1;
- hid_t sid = -1;
- hid_t my_dcpl = -1;
- hid_t fcpl;
- hsize_t dims_o[RANK3] = { DIM0, DIM1, DIM2 }; /* original dimensions */
- hsize_t dims_s[RANK3] = { DIMS0, DIMS1, DIMS2 }; /* shrinking dimensions */
- hsize_t dims_e[RANK3] = { DIME0, DIME1, DIME2 }; /* extended dimensions */
- hsize_t dims_c[RANK3] = { 2, 2, 2 }; /* chunk dimensions */
- hsize_t dims_r[RANK3]; /* read dimensions */
- hsize_t maxdims[RANK3] = { H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED };
- int buf_o[DIM0][DIM1][DIM2];
- int buf_s[DIMS0][DIMS1][DIMS2];
- int buf_e[DIME0][DIME1][DIME2];
- int buf_r[DIM0][DIM1][DIM2];
- int i, j, k;
- int comp_value;
- char filename[NAME_BUF_SIZE];
+static int
+test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k)
+{
+
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t sid = -1;
+ hid_t my_dcpl = -1;
+ hid_t fcpl;
+ hsize_t dims_o[RANK3] = {DIM0, DIM1, DIM2}; /* original dimensions */
+ hsize_t dims_s[RANK3] = {DIMS0, DIMS1, DIMS2}; /* shrinking dimensions */
+ hsize_t dims_e[RANK3] = {DIME0, DIME1, DIME2}; /* extended dimensions */
+ hsize_t dims_c[RANK3] = {2, 2, 2}; /* chunk dimensions */
+ hsize_t dims_r[RANK3]; /* read dimensions */
+ hsize_t maxdims[RANK3] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED};
+ int buf_o[DIM0][DIM1][DIM2];
+ int buf_s[DIMS0][DIMS1][DIMS2];
+ int buf_e[DIME0][DIME1][DIME2];
+ int buf_r[DIM0][DIM1][DIM2];
+ int i, j, k;
+ int comp_value;
+ char filename[NAME_BUF_SIZE];
if (do_fill_value) {
comp_value = FILL_VALUE;
- } else {
+ }
+ else {
comp_value = 0;
}
@@ -1356,7 +1325,6 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
if (H5Pset_istore_k(fcpl, ISTORE_IK) < 0) {
TEST_ERROR
}
-
}
/* create a new file */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
@@ -1385,12 +1353,12 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
if (H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
TEST_ERROR
- /*-------------------------------------------------------------------------
- * create, write array
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * create, write array
+ *-------------------------------------------------------------------------
+ */
- /* create a dataset */
+ /* create a dataset */
if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) {
TEST_ERROR
}
@@ -1400,17 +1368,16 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
TEST_ERROR
}
-#if defined (H5_SET_EXTENT_DEBUG3)
+#if defined(H5_SET_EXTENT_DEBUG3)
HDprintf("\n");
- for (i = 0; i < (int)dims_o[0]; i++ ) {
- for (j = 0; j < (int)dims_o[1]; j++ ) {
- for( k = 0; k < (int)dims_o[2]; k++ ) {
+ for (i = 0; i < (int)dims_o[0]; i++) {
+ for (j = 0; j < (int)dims_o[1]; j++) {
+ for (k = 0; k < (int)dims_o[2]; k++) {
HDprintf("%d ", buf_o[i][j][k]);
}
HDprintf("[%d] ", j);
}
HDprintf("\n");
-
}
HDprintf("\n");
#endif
@@ -1420,10 +1387,10 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * set new dimensions for the array; expand it
- *
- *-------------------------------------------------------------------------
- */
+ * set new dimensions for the array; expand it
+ *
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array. */
if (H5Dset_extent(did, dims_e) < 0) {
@@ -1454,32 +1421,32 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
TEST_ERROR
-#if defined (H5_SET_EXTENT_DEBUG3)
+#if defined(H5_SET_EXTENT_DEBUG3)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
- for( k = 0; k < (int)dims_r[2]; k++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
+ for (k = 0; k < (int)dims_r[2]; k++) {
HDprintf("%d ", buf_e[i][j][k]);
}
HDprintf("[%d] ", j);
}
HDprintf("\n");
-
}
HDprintf("\n");
#endif
- /* compare the read array with the expanded array */
- for (i = 0; i < (int) dims_r[0]; i++) {
- for (j = 0; j < (int) dims_r[1]; j++) {
- for (k = 0; k < (int) dims_r[2]; k++) {
+ /* compare the read array with the expanded array */
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
+ for (k = 0; k < (int)dims_r[2]; k++) {
if (i >= DIM0 || j >= DIM1 || k >= DIM2) {
if (buf_e[i][j][k] != comp_value) {
HDprintf("buf_e[%d][%d][%d] = %d\n", i, j, k, buf_e[i][j][k]);
HDprintf("value = %d\n", comp_value);
TEST_ERROR
}
- } else {
+ }
+ else {
if (buf_e[i][j][k] != buf_o[i][j][k])
TEST_ERROR
}
@@ -1488,9 +1455,9 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * shrink
- *-------------------------------------------------------------------------
- */
+ * shrink
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array. */
if (H5Dset_extent(did, dims_s) < 0) {
@@ -1534,38 +1501,36 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
if ((did = H5Dopen2(fid, "dset1", H5P_DEFAULT)) < 0) {
TEST_ERROR
}
-
}
/*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
+ * read
+ *-------------------------------------------------------------------------
+ */
/* read */
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) {
TEST_ERROR
}
-#if defined (H5_SET_EXTENT_DEBUG3)
+#if defined(H5_SET_EXTENT_DEBUG3)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
- for( k = 0; k < (int)dims_r[2]; k++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
+ for (k = 0; k < (int)dims_r[2]; k++) {
HDprintf("%d ", buf_s[i][j][k]);
}
- HDprintf("[%d] ", j);
+ HDprintf("[%d] ", j);
}
HDprintf("\n");
-
}
HDprintf("\n");
#endif
/* compare the read array with the shrinked array */
- for (i = 0; i < (int) dims_r[0]; i++) {
- for (j = 0; j < (int) dims_r[1]; j++) {
- for (k = 0; k < (int) dims_r[2]; k++) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
+ for (k = 0; k < (int)dims_r[2]; k++) {
if (buf_s[i][j][k] != buf_o[i][j][k]) {
HDprintf("buf_s[%d][%d][%d] = %d\n", i, j, k, buf_s[i][j][k]);
HDprintf("buf_o[%d][%d][%d] = %d\n", i, j, k, buf_o[i][j][k]);
@@ -1576,9 +1541,9 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * set new dimensions for the array; expand it back to original size
- *-------------------------------------------------------------------------
- */
+ * set new dimensions for the array; expand it back to original size
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array */
if (H5Dset_extent(did, dims_o) < 0) {
@@ -1609,33 +1574,33 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
TEST_ERROR
-#if defined (H5_SET_EXTENT_DEBUG3)
+#if defined(H5_SET_EXTENT_DEBUG3)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
- for( k = 0; k < (int)dims_r[2]; k++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
+ for (k = 0; k < (int)dims_r[2]; k++) {
HDprintf("%d ", buf_r[i][j][k]);
}
- HDprintf("[%d] ", j);
+ HDprintf("[%d] ", j);
}
HDprintf("\n");
-
}
HDprintf("\n");
#endif
- /* compare the read array with the original array */
- for (i = 0; i < (int) dims_r[0]; i++) {
- for (j = 0; j < (int) dims_r[1]; j++) {
- for (k = 0; k < (int) dims_r[2]; k++) {
+ /* compare the read array with the original array */
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
+ for (k = 0; k < (int)dims_r[2]; k++) {
if (i >= DIMS0 || j >= DIMS1 || k >= DIMS2) {
if (buf_r[i][j][k] != comp_value) {
HDprintf("buf_r[%d][%d][%d] = %d\n", i, j, k, buf_r[i][j][k]);
HDprintf("value = %d\n", comp_value);
TEST_ERROR
}
- } else {
+ }
+ else {
if (buf_r[i][j][k] != buf_o[i][j][k])
TEST_ERROR
}
@@ -1644,10 +1609,10 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * shrink to 0
- *
- *-------------------------------------------------------------------------
- */
+ * shrink to 0
+ *
+ *-------------------------------------------------------------------------
+ */
dims_s[0] = 0;
dims_s[1] = 0;
@@ -1679,18 +1644,18 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * close dataset
- *-------------------------------------------------------------------------
- */
+ * close dataset
+ *-------------------------------------------------------------------------
+ */
if (H5Dclose(did) < 0) {
TEST_ERROR
}
/*-------------------------------------------------------------------------
- * test a dataset with non initialized chunks
- *-------------------------------------------------------------------------
- */
+ * test a dataset with non initialized chunks
+ *-------------------------------------------------------------------------
+ */
if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0) {
TEST_ERROR
@@ -1714,9 +1679,9 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
}
/*-------------------------------------------------------------------------
- * close property list
- *-------------------------------------------------------------------------
- */
+ * close property list
+ *-------------------------------------------------------------------------
+ */
if (H5Pclose(my_dcpl) < 0) {
TEST_ERROR
@@ -1728,49 +1693,51 @@ static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t dis
return 0;
- error:
+error:
H5E_BEGIN_TRY
- {
- H5Dclose(did);
- H5Sclose(sid);
- H5Pclose(my_dcpl);
- H5Pclose(fcpl);
- H5Fclose(fid);
- }H5E_END_TRY;
+ {
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(my_dcpl);
+ H5Pclose(fcpl);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return -1;
-
}
/*-------------------------------------------------------------------------
* test usage with external storage
*-------------------------------------------------------------------------
*/
-static int test_external(hid_t fapl) {
-
- hid_t fid = -1;
- hid_t did = -1;
- hid_t sid = -1;
- hid_t dcpl = -1;
- hsize_t dims_o[RANK2] = { DIM0, DIM1 }; /* original dimensions */
- hsize_t dims_s[RANK2] = { DIMS0, DIMS1 }; /* shrinking dimensions */
- hsize_t dims_e[RANK2] = { DIME0, DIM1 }; /* extended dimensions, dimension 1 is the original */
- hsize_t dims_r[RANK2]; /* read dimensions */
- hsize_t maxdims[RANK2] = { DIME0, DIM1 }; /* only the first dimension can be extendible */
- int buf_o[DIM0][DIM1]; /* original buffer, for writing */
- int buf_s[DIMS0][DIMS1]; /* shrinked buffer, for reading */
- int buf_e[DIME0][DIM1]; /* extended buffer, for writing, dimension 1 is the original */
- int buf_ro[DIM0][DIM1]; /* original buffer for reading */
- int i, j;
- int comp_value = 0;
- char filename[NAME_BUF_SIZE];
+static int
+test_external(hid_t fapl)
+{
+
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t sid = -1;
+ hid_t dcpl = -1;
+ hsize_t dims_o[RANK2] = {DIM0, DIM1}; /* original dimensions */
+ hsize_t dims_s[RANK2] = {DIMS0, DIMS1}; /* shrinking dimensions */
+ hsize_t dims_e[RANK2] = {DIME0, DIM1}; /* extended dimensions, dimension 1 is the original */
+ hsize_t dims_r[RANK2]; /* read dimensions */
+ hsize_t maxdims[RANK2] = {DIME0, DIM1}; /* only the first dimension can be extendible */
+ int buf_o[DIM0][DIM1]; /* original buffer, for writing */
+ int buf_s[DIMS0][DIMS1]; /* shrinked buffer, for reading */
+ int buf_e[DIME0][DIM1]; /* extended buffer, for writing, dimension 1 is the original */
+ int buf_ro[DIM0][DIM1]; /* original buffer for reading */
+ int i, j;
+ int comp_value = 0;
+ char filename[NAME_BUF_SIZE];
hsize_t size; /* number of bytes reserved in the file for the data */
hsize_t max_size[2];
max_size[0] = dims_e[0];
max_size[1] = dims_e[1];
- size = max_size[0] * max_size[1] * sizeof(int) / 2;
+ size = max_size[0] * max_size[1] * sizeof(int) / 2;
for (i = 0; i < DIM0; i++) {
for (j = 0; j < DIM1; j++) {
@@ -1785,39 +1752,38 @@ static int test_external(hid_t fapl) {
if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- /* modify dataset creation properties */
+ /* modify dataset creation properties */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if (H5Pset_external(dcpl, EXT_FILE_NAME1, (off_t) 0, size) < 0)
+ if (H5Pset_external(dcpl, EXT_FILE_NAME1, (off_t)0, size) < 0)
FAIL_STACK_ERROR
- if (H5Pset_external(dcpl, EXT_FILE_NAME2, (off_t) 0, size) < 0)
+ if (H5Pset_external(dcpl, EXT_FILE_NAME2, (off_t)0, size) < 0)
FAIL_STACK_ERROR
- {
-
- char name[256]; /*external file name */
- off_t file_offset; /*external file offset */
- hsize_t file_size; /*sizeof external file segment */
+ {
- if (H5Pget_external(dcpl, 0, sizeof(name), name, &file_offset, &file_size) < 0)
- FAIL_STACK_ERROR
+ char name[256]; /*external file name */
+ off_t file_offset; /*external file offset */
+ hsize_t file_size; /*sizeof external file segment */
- }
+ if (H5Pget_external(dcpl, 0, sizeof(name), name, &file_offset, &file_size) < 0)
+ FAIL_STACK_ERROR
+ }
/*-------------------------------------------------------------------------
- * Write an array AxB. These are the dimensions for creating the dataset
- *
- * original data is
- *
- * 2 2 2 2
- * 2 2 2 2
- * 2 2 2 2
- * 2 2 2 2
- *
- *-------------------------------------------------------------------------
- */
+ * Write an array AxB. These are the dimensions for creating the dataset
+ *
+ * original data is
+ *
+ * 2 2 2 2
+ * 2 2 2 2
+ * 2 2 2 2
+ * 2 2 2 2
+ *
+ *-------------------------------------------------------------------------
+ */
/* create the data space with unlimited dimensions. */
if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0)
@@ -1829,61 +1795,61 @@ static int test_external(hid_t fapl) {
if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- /*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * read
+ *-------------------------------------------------------------------------
+ */
- /* read */
+ /* read */
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ro) < 0)
FAIL_STACK_ERROR
-#if defined (H5_SET_EXTENT_DEBUG)
+#if defined(H5_SET_EXTENT_DEBUG)
HDprintf("\n");
- for (i = 0; i < (int)dims_o[0]; i++ ) {
- for (j = 0; j < (int)dims_o[1]; j++ ) {
+ for (i = 0; i < (int)dims_o[0]; i++) {
+ for (j = 0; j < (int)dims_o[1]; j++) {
HDprintf("%d ", buf_ro[i][j]);
}
HDprintf("\n");
}
#endif
- /*-------------------------------------------------------------------------
- * expand
- *-------------------------------------------------------------------------
- */
-
- /*-------------------------------------------------------------------------
- * set new dimensions for the array; expand it
- * data is now, extended space was initialized with default value
- *
- * 2 2 2 2
- * 2 2 2 2
- * 2 2 2 2
- * 2 2 2 2
- * 0 0 0 0
- * 0 0 0 0
- * 0 0 0 0
- *
- *-------------------------------------------------------------------------
- */
-
- /* set new dimensions for the array. */
+ /*-------------------------------------------------------------------------
+ * expand
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * set new dimensions for the array; expand it
+ * data is now, extended space was initialized with default value
+ *
+ * 2 2 2 2
+ * 2 2 2 2
+ * 2 2 2 2
+ * 2 2 2 2
+ * 0 0 0 0
+ * 0 0 0 0
+ * 0 0 0 0
+ *
+ *-------------------------------------------------------------------------
+ */
+
+ /* set new dimensions for the array. */
if (H5Dset_extent(did, dims_e) < 0)
FAIL_STACK_ERROR
- /* get the space */
+ /* get the space */
if ((sid = H5Dget_space(did)) < 0)
FAIL_STACK_ERROR
- /* get dimensions */
+ /* get dimensions */
if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
FAIL_STACK_ERROR
if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- /* check dimensions */
+ /* check dimensions */
for (i = 0; i < RANK2; i++) {
if (dims_r[i] != dims_e[i])
TEST_ERROR
@@ -1893,26 +1859,27 @@ static int test_external(hid_t fapl) {
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
FAIL_STACK_ERROR
-#if defined (H5_SET_EXTENT_DEBUG)
+#if defined(H5_SET_EXTENT_DEBUG)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
HDprintf("%d ", buf_e[i][j]);
}
HDprintf("\n");
}
#endif
- /* compare the read array with the expanded array */
- for (i = 0; i < (int) dims_r[0]; i++) {
- for (j = 0; j < (int) dims_r[1]; j++) {
+ /* compare the read array with the expanded array */
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
if (i >= DIM0 || j >= DIM1) {
if (buf_e[i][j] != comp_value) {
HDprintf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]);
HDprintf("value = %d\n", comp_value);
TEST_ERROR
}
- } else {
+ }
+ else {
if (buf_e[i][j] != buf_o[i][j])
TEST_ERROR
}
@@ -1920,59 +1887,59 @@ static int test_external(hid_t fapl) {
}
/*-------------------------------------------------------------------------
- * shrink
- *
- * data is now
- *
- * 2 2
- * 2 2
- *
- *-------------------------------------------------------------------------
- */
+ * shrink
+ *
+ * data is now
+ *
+ * 2 2
+ * 2 2
+ *
+ *-------------------------------------------------------------------------
+ */
/* set new dimensions for the array. */
if (H5Dset_extent(did, dims_s) < 0)
FAIL_STACK_ERROR
- /* get the space */
+ /* get the space */
if ((sid = H5Dget_space(did)) < 0)
FAIL_STACK_ERROR
- /* get dimensions */
+ /* get dimensions */
if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
FAIL_STACK_ERROR
if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- /* check dimensions */
+ /* check dimensions */
for (i = 0; i < RANK2; i++) {
if (dims_r[i] != dims_s[i])
TEST_ERROR
}
/*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
+ * read
+ *-------------------------------------------------------------------------
+ */
/* read */
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0)
FAIL_STACK_ERROR
-#if defined (H5_SET_EXTENT_DEBUG)
+#if defined(H5_SET_EXTENT_DEBUG)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
HDprintf("%d ", buf_s[i][j]);
}
HDprintf("\n");
}
#endif
- /* compare the read array with the shrinked array */
- for (i = 0; i < (int) dims_r[0]; i++) {
- for (j = 0; j < (int) dims_r[1]; j++) {
+ /* compare the read array with the shrinked array */
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
if (buf_s[i][j] != buf_o[i][j]) {
HDprintf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]);
HDprintf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]);
@@ -1982,27 +1949,27 @@ static int test_external(hid_t fapl) {
}
/*-------------------------------------------------------------------------
- * negative test
- * try to extend dimension above maximum
- *-------------------------------------------------------------------------
- */
+ * negative test
+ * try to extend dimension above maximum
+ *-------------------------------------------------------------------------
+ */
dims_e[1] = DIME1;
H5E_BEGIN_TRY
- {
-
- /* set new dimensions for the array. */
- if (H5Dset_extent(did, dims_e) == SUCCEED) {
- TEST_ERROR
- }
+ {
- }H5E_END_TRY;
+ /* set new dimensions for the array. */
+ if (H5Dset_extent(did, dims_e) == SUCCEED) {
+ TEST_ERROR
+ }
+ }
+ H5E_END_TRY;
/*-------------------------------------------------------------------------
- * close property list
- *-------------------------------------------------------------------------
- */
+ * close property list
+ *-------------------------------------------------------------------------
+ */
if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
@@ -2017,15 +1984,16 @@ static int test_external(hid_t fapl) {
return 0;
- error:
+error:
H5E_BEGIN_TRY
- {
- H5Dclose(did);
- H5Sclose(sid);
- H5Pclose(dcpl);
- H5Fclose(fid);
- }H5E_END_TRY;
+ {
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(dcpl);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return -1;
}
@@ -2033,21 +2001,23 @@ static int test_external(hid_t fapl) {
* test usage with layouts compact and contiguous
*-------------------------------------------------------------------------
*/
-static int test_layouts(H5D_layout_t layout, hid_t fapl) {
-
- hid_t fid = -1;
- hid_t did = -1;
- hid_t sid = -1;
- hid_t dcpl = -1;
- herr_t ret;
- hsize_t dims_o[RANK2] = { DIM0, DIM1 }; /* original dimensions */
- hsize_t dims_s[RANK2] = { DIMS0, DIMS1 }; /* shrinking dimensions */
- hsize_t dims_e[RANK2] = { DIME0, DIME1 }; /* extended dimensions */
- hsize_t dims_r[RANK2]; /* read dimensions */
- int buf_o[DIM0][DIM1];
- int buf_r[DIM0][DIM1];
- int i, j;
- char filename[NAME_BUF_SIZE];
+static int
+test_layouts(H5D_layout_t layout, hid_t fapl)
+{
+
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t sid = -1;
+ hid_t dcpl = -1;
+ herr_t ret;
+ hsize_t dims_o[RANK2] = {DIM0, DIM1}; /* original dimensions */
+ hsize_t dims_s[RANK2] = {DIMS0, DIMS1}; /* shrinking dimensions */
+ hsize_t dims_e[RANK2] = {DIME0, DIME1}; /* extended dimensions */
+ hsize_t dims_r[RANK2]; /* read dimensions */
+ int buf_o[DIM0][DIM1];
+ int buf_r[DIM0][DIM1];
+ int i, j;
+ char filename[NAME_BUF_SIZE];
for (i = 0; i < DIM0; i++) {
for (j = 0; j < DIM1; j++) {
@@ -2085,10 +2055,10 @@ static int test_layouts(H5D_layout_t layout, hid_t fapl) {
TEST_ERROR
}
-#if defined (H5_SET_EXTENT_DEBUG4)
+#if defined(H5_SET_EXTENT_DEBUG4)
HDprintf("\n");
- for (i = 0; i < (int)dims_o[0]; i++ ) {
- for (j = 0; j < (int)dims_o[1]; j++ ) {
+ for (i = 0; i < (int)dims_o[0]; i++) {
+ for (j = 0; j < (int)dims_o[1]; j++) {
HDprintf("%d ", buf_o[i][j]);
}
HDprintf("\n");
@@ -2100,22 +2070,18 @@ static int test_layouts(H5D_layout_t layout, hid_t fapl) {
}
/*-------------------------------------------------------------------------
- * negative test
- * try to extend dimension
- *-------------------------------------------------------------------------
- */
-
- H5E_BEGIN_TRY
- {
-
- ret = H5Dset_extent(did, dims_e);
+ * negative test
+ * try to extend dimension
+ *-------------------------------------------------------------------------
+ */
- }H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dset_extent(did, dims_e); }
+ H5E_END_TRY;
if (ret >= 0)
TEST_ERROR
- /* get the space */
+ /* get the space */
if ((sid = H5Dget_space(did)) < 0) {
TEST_ERROR
}
@@ -2139,33 +2105,29 @@ static int test_layouts(H5D_layout_t layout, hid_t fapl) {
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
TEST_ERROR
-#if defined (H5_SET_EXTENT_DEBUG4)
+#if defined(H5_SET_EXTENT_DEBUG4)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
HDprintf("%d ", buf_r[i][j]);
}
HDprintf("\n");
}
#endif
- /*-------------------------------------------------------------------------
- * negative test
- * try to shrink dimension
- *-------------------------------------------------------------------------
- */
-
- H5E_BEGIN_TRY
- {
-
- ret = H5Dset_extent(did, dims_s);
+ /*-------------------------------------------------------------------------
+ * negative test
+ * try to shrink dimension
+ *-------------------------------------------------------------------------
+ */
- }H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dset_extent(did, dims_s); }
+ H5E_END_TRY;
if (ret >= 0)
TEST_ERROR
- /* get the space */
+ /* get the space */
if ((sid = H5Dget_space(did)) < 0) {
TEST_ERROR
}
@@ -2186,19 +2148,19 @@ static int test_layouts(H5D_layout_t layout, hid_t fapl) {
}
/*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
+ * read
+ *-------------------------------------------------------------------------
+ */
/* read */
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0) {
TEST_ERROR
}
-#if defined (H5_SET_EXTENT_DEBUG4)
+#if defined(H5_SET_EXTENT_DEBUG4)
HDprintf("\n");
- for (i = 0; i < (int)dims_r[0]; i++ ) {
- for (j = 0; j < (int)dims_r[1]; j++ ) {
+ for (i = 0; i < (int)dims_r[0]; i++) {
+ for (j = 0; j < (int)dims_r[1]; j++) {
HDprintf("%d ", buf_r[i][j]);
}
HDprintf("\n");
@@ -2206,9 +2168,9 @@ static int test_layouts(H5D_layout_t layout, hid_t fapl) {
#endif
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ * close
+ *-------------------------------------------------------------------------
+ */
if (H5Dclose(did) < 0) {
TEST_ERROR
@@ -2224,20 +2186,19 @@ static int test_layouts(H5D_layout_t layout, hid_t fapl) {
return 0;
- error:
+error:
H5E_BEGIN_TRY
- {
- H5Dclose(did);
- H5Sclose(sid);
- H5Pclose(dcpl);
- H5Fclose(fid);
- }H5E_END_TRY;
+ {
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(dcpl);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return -1;
-
}
-
/*-------------------------------------------------------------------------
* Function: test_random_rank4
*
@@ -2253,31 +2214,31 @@ static int test_layouts(H5D_layout_t layout, hid_t fapl) {
*
*-------------------------------------------------------------------------
*/
-static int test_random_rank4( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
- hbool_t disable_edge_filters, hbool_t do_sparse,
- rank4_index_t index_type )
+static int
+test_random_rank4(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
+ hbool_t do_sparse, rank4_index_t index_type)
{
- hid_t file = -1;
- hid_t dset = -1;
- hid_t fspace = -1;
- hid_t mspace = -1;
- hid_t my_dcpl = -1;
- hsize_t dims[4] = {10, 10, 10, 10}; /* Dataset's dimensions */
- hsize_t max_dims[4] = {10, 10, 10, 10}; /* Maximum dimensions */
- hsize_t old_dims[4]; /* Old dataset dimensions */
- hsize_t min_unwritten_dims[4]; /* Minimum dimensions since last write */
- hsize_t *valid_dims = old_dims; /* Dimensions of region still containing written data */
- hsize_t cdims[4]; /* Chunk dimensions */
- const hsize_t mdims[4] = {10, 10, 10, 10}; /* Memory buffer dimensions */
- const hsize_t start[4] = {0, 0, 0, 0}; /* Start for hyperslabe operations on memory */
- static int rbuf[10][10][10][10]; /* Read buffer */
- static int wbuf[10][10][10][10]; /* Write buffer */
- static hsize_t dim_log[RAND4_NITER+1][4]; /* Log of dataset dimensions */
- hbool_t zero_dim = FALSE; /* Whether a dimension is 0 */
- hbool_t writing = TRUE; /* Whether we're writing to the dset */
- unsigned scalar_iter; /* Iteration to shrink dset to 1x1x1x1 */
- volatile unsigned i, j, k, l, m; /* Local indices */
- char filename[NAME_BUF_SIZE];
+ hid_t file = -1;
+ hid_t dset = -1;
+ hid_t fspace = -1;
+ hid_t mspace = -1;
+ hid_t my_dcpl = -1;
+ hsize_t dims[4] = {10, 10, 10, 10}; /* Dataset's dimensions */
+ hsize_t max_dims[4] = {10, 10, 10, 10}; /* Maximum dimensions */
+ hsize_t old_dims[4]; /* Old dataset dimensions */
+ hsize_t min_unwritten_dims[4]; /* Minimum dimensions since last write */
+ hsize_t * valid_dims = old_dims; /* Dimensions of region still containing written data */
+ hsize_t cdims[4]; /* Chunk dimensions */
+ const hsize_t mdims[4] = {10, 10, 10, 10}; /* Memory buffer dimensions */
+ const hsize_t start[4] = {0, 0, 0, 0}; /* Start for hyperslabe operations on memory */
+ static int rbuf[10][10][10][10]; /* Read buffer */
+ static int wbuf[10][10][10][10]; /* Write buffer */
+ static hsize_t dim_log[RAND4_NITER + 1][4]; /* Log of dataset dimensions */
+ hbool_t zero_dim = FALSE; /* Whether a dimension is 0 */
+ hbool_t writing = TRUE; /* Whether we're writing to the dset */
+ unsigned scalar_iter; /* Iteration to shrink dset to 1x1x1x1 */
+ volatile unsigned i, j, k, l, m; /* Local indices */
+ char filename[NAME_BUF_SIZE];
/* create a new file */
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
@@ -2285,14 +2246,14 @@ static int test_random_rank4( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
TEST_ERROR
/* Set maximum dimensions as appropriate for index type */
- if(index_type == RANK4_INDEX_BTREE)
- for(i=0; i<4; i++)
+ if (index_type == RANK4_INDEX_BTREE)
+ for (i = 0; i < 4; i++)
max_dims[i] = H5S_UNLIMITED;
- else if(index_type == RANK4_INDEX_EARRAY)
+ else if (index_type == RANK4_INDEX_EARRAY)
max_dims[1] = H5S_UNLIMITED;
/* Generate random chunk dimensions, 2-4 */
- for(i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
cdims[i] = (hsize_t)((HDrandom() % 3) + 2);
/* Pick iteration to shrink dataset to 1x1x1x1 */
@@ -2300,142 +2261,136 @@ static int test_random_rank4( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
/* Generate initial dataset size, 1-10, unless using fixed array index or
* scalar_iter is 0 */
- for(i=0; i<4; i++) {
- dims[i] = (hsize_t)(index_type != RANK4_INDEX_FARRAY
- ? (0 == scalar_iter ? 1 : ((HDrandom() % 10) + 1)) : 10);
+ for (i = 0; i < 4; i++) {
+ dims[i] = (hsize_t)(
+ index_type != RANK4_INDEX_FARRAY ? (0 == scalar_iter ? 1 : ((HDrandom() % 10) + 1)) : 10);
dim_log[0][i] = dims[i];
} /* end for */
/* Create dataset */
- if((fspace = H5Screate_simple(4, dims, max_dims)) < 0)
+ if ((fspace = H5Screate_simple(4, dims, max_dims)) < 0)
TEST_ERROR
- if((my_dcpl = H5Pcopy(dcpl)) < 0)
+ if ((my_dcpl = H5Pcopy(dcpl)) < 0)
TEST_ERROR
- if(H5Pset_chunk(my_dcpl, 4, cdims) < 0)
+ if (H5Pset_chunk(my_dcpl, 4, cdims) < 0)
TEST_ERROR
- if(disable_edge_filters)
- if(H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ if (disable_edge_filters)
+ if (H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
TEST_ERROR
- if((dset = H5Dcreate2(file, "dset", H5T_NATIVE_INT, fspace, H5P_DEFAULT,
- my_dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset", H5T_NATIVE_INT, fspace, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Sclose(fspace) < 0)
+ if (H5Sclose(fspace) < 0)
TEST_ERROR
/* Create memory space, and set initial selection */
- if((mspace = H5Screate_simple(4, mdims, NULL)) < 0)
+ if ((mspace = H5Screate_simple(4, mdims, NULL)) < 0)
TEST_ERROR
- if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL)
- < 0)
+ if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Main loop */
- for(i=0; i<RAND4_NITER; i++) {
+ for (i = 0; i < RAND4_NITER; i++) {
/* Generate random write buffer */
- if(writing && !zero_dim) {
- for(j=0; j<dims[0]; j++)
- for(k=0; k<dims[1]; k++)
- for(l=0; l<dims[2]; l++)
- for(m=0; m<dims[3]; m++)
+ if (writing && !zero_dim) {
+ for (j = 0; j < dims[0]; j++)
+ for (k = 0; k < dims[1]; k++)
+ for (l = 0; l < dims[2]; l++)
+ for (m = 0; m < dims[3]; m++)
wbuf[j][k][l][m] = HDrandom();
/* Write data */
- if(H5Dwrite(dset, H5T_NATIVE_INT, mspace, H5S_ALL, H5P_DEFAULT,
- wbuf) < 0)
- RAND4_FAIL_DUMP(i+1, -1, -1, -1, -1)
+ if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ RAND4_FAIL_DUMP(i + 1, -1, -1, -1, -1)
} /* end if */
/* Generate new dataset size, 0-10 (0 much less likely). If i is
* scalar_iter, set all dims to 1. */
zero_dim = FALSE;
- for(j=0; j<4; j++) {
+ for (j = 0; j < 4; j++) {
old_dims[j] = dims[j];
- if((dims[j] = (hsize_t)(i == scalar_iter ? 1 : (HDrandom() % 11)))
- == 0)
- if((dims[j] = (hsize_t)(HDrandom() % 11)) == 0)
+ if ((dims[j] = (hsize_t)(i == scalar_iter ? 1 : (HDrandom() % 11))) == 0)
+ if ((dims[j] = (hsize_t)(HDrandom() % 11)) == 0)
zero_dim = TRUE;
- dim_log[i+1][j] = dims[j];
+ dim_log[i + 1][j] = dims[j];
} /* end for */
/* If writing is disabled, update min_unwritten_dims */
- if(!writing)
- for(j=0; j<4; j++)
- if(old_dims[j] < min_unwritten_dims[j])
+ if (!writing)
+ for (j = 0; j < 4; j++)
+ if (old_dims[j] < min_unwritten_dims[j])
min_unwritten_dims[j] = old_dims[j];
/* Resize dataset */
- if(H5Dset_extent(dset, dims) < 0)
- RAND4_FAIL_DUMP(i+2, -1, -1, -1, -1)
+ if (H5Dset_extent(dset, dims) < 0)
+ RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
- if(!zero_dim) {
+ if (!zero_dim) {
/* Read data from resized dataset */
- if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims,
- NULL) < 0)
- RAND4_FAIL_DUMP(i+2, -1, -1, -1, -1)
- if(H5Dread(dset, H5T_NATIVE_INT, mspace, H5S_ALL, H5P_DEFAULT, rbuf)
- < 0)
- RAND4_FAIL_DUMP(i+2, -1, -1, -1, -1)
+ if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
+ if (H5Dread(dset, H5T_NATIVE_INT, mspace, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
/* Verify correctness of read data */
- if(do_fillvalue) {
- for(j=0; j<dims[0]; j++)
- for(k=0; k<dims[1]; k++)
- for(l=0; l<dims[2]; l++)
- for(m=0; m<dims[3]; m++)
- if(j >= valid_dims[0] || k >= valid_dims[1]
- || l >= valid_dims[2]
- || m >= valid_dims[3]) {
- if(FILL_VALUE != rbuf[j][k][l][m])
- RAND4_FAIL_DUMP(i+2, (int)j, (int)k, (int)l, (int)m)
+ if (do_fillvalue) {
+ for (j = 0; j < dims[0]; j++)
+ for (k = 0; k < dims[1]; k++)
+ for (l = 0; l < dims[2]; l++)
+ for (m = 0; m < dims[3]; m++)
+ if (j >= valid_dims[0] || k >= valid_dims[1] || l >= valid_dims[2] ||
+ m >= valid_dims[3]) {
+ if (FILL_VALUE != rbuf[j][k][l][m])
+ RAND4_FAIL_DUMP(i + 2, (int)j, (int)k, (int)l, (int)m)
} /* end if */
- else
- if(wbuf[j][k][l][m] != rbuf[j][k][l][m])
- RAND4_FAIL_DUMP(i+2, (int)j, (int)k, (int)l, (int)m)
+ else if (wbuf[j][k][l][m] != rbuf[j][k][l][m])
+ RAND4_FAIL_DUMP(i + 2, (int)j, (int)k, (int)l, (int)m)
} /* end if */
else {
- for(j=0; j<MIN(dims[0],valid_dims[0]); j++)
- for(k=0; k<MIN(dims[1],valid_dims[1]); k++)
- for(l=0; l<MIN(dims[2],valid_dims[2]); l++)
- for(m=0; m<MIN(dims[3],valid_dims[3]); m++)
- if(wbuf[j][k][l][m] != rbuf[j][k][l][m])
- RAND4_FAIL_DUMP(i+2, (int)j, (int)k, (int)l, (int)m)
+ for (j = 0; j < MIN(dims[0], valid_dims[0]); j++)
+ for (k = 0; k < MIN(dims[1], valid_dims[1]); k++)
+ for (l = 0; l < MIN(dims[2], valid_dims[2]); l++)
+ for (m = 0; m < MIN(dims[3], valid_dims[3]); m++)
+ if (wbuf[j][k][l][m] != rbuf[j][k][l][m])
+ RAND4_FAIL_DUMP(i + 2, (int)j, (int)k, (int)l, (int)m)
} /* end else */
- } /* end if */
+ } /* end if */
/* Handle the switch between writing and not writing */
- if(do_sparse && !(i % RAND4_SPARSE_SWITCH)) {
+ if (do_sparse && !(i % RAND4_SPARSE_SWITCH)) {
writing = !writing;
- if(!writing) {
- for(j=0; j<4; j++)
+ if (!writing) {
+ for (j = 0; j < 4; j++)
min_unwritten_dims[j] = old_dims[j];
valid_dims = min_unwritten_dims;
} /* end if */
else
valid_dims = old_dims;
} /* end if */
- } /* end for */
+ } /* end for */
/* Close */
- if(H5Sclose(mspace) < 0)
+ if (H5Sclose(mspace) < 0)
TEST_ERROR
- if(H5Pclose(my_dcpl) < 0)
+ if (H5Pclose(my_dcpl) < 0)
TEST_ERROR
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(fspace);
H5Sclose(mspace);
H5Pclose(dcpl);
H5Dclose(dset);
H5Fclose(file);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return -1;
} /* end test_random_rank4 */
@@ -2455,55 +2410,55 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_random_rank4_vl( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
- hbool_t disable_edge_filters, hbool_t do_sparse,
- rank4_index_t index_type )
+static int
+test_random_rank4_vl(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
+ hbool_t do_sparse, rank4_index_t index_type)
{
- hid_t file = -1;
- hid_t dset = -1;
- hid_t type = -1;
- hid_t fspace = -1;
- hid_t mspace = -1;
- hid_t my_dcpl = -1;
- hsize_t dims[4] = {10, 10, 10, 10}; /* Dataset's dimensions */
- hsize_t max_dims[4] = {10, 10, 10, 10}; /* Maximum dimensions */
- hsize_t old_dims[4]; /* Old dataset dimensions */
- hsize_t min_unwritten_dims[4]; /* Minimum dimensions since last write */
- hsize_t *valid_dims = old_dims; /* Dimensions of region still containing written data */
- hsize_t cdims[4]; /* Chunk dimensions */
- const hsize_t mdims[4] = {10, 10, 10, 10}; /* Memory buffer dimensions */
- const hsize_t start[4] = {0, 0, 0, 0}; /* Start for hyperslab operations on memory */
- static hvl_t rbuf[10][10][10][10]; /* Read buffer */
- static hvl_t wbuf[10][10][10][10]; /* Write buffer */
- static hsize_t dim_log[RAND4_NITER+1][4]; /* Log of dataset dimensions */
- hbool_t zero_dim = FALSE; /* Whether a dimension is 0 */
- hbool_t writing = TRUE; /* Whether we're writing to the dset */
- hvl_t fill_value; /* Fill value */
- unsigned scalar_iter; /* Iteration to shrink dset to 1x1x1x1 */
- volatile unsigned i, j, k, l, m; /* Local indices */
- char filename[NAME_BUF_SIZE];
+ hid_t file = -1;
+ hid_t dset = -1;
+ hid_t type = -1;
+ hid_t fspace = -1;
+ hid_t mspace = -1;
+ hid_t my_dcpl = -1;
+ hsize_t dims[4] = {10, 10, 10, 10}; /* Dataset's dimensions */
+ hsize_t max_dims[4] = {10, 10, 10, 10}; /* Maximum dimensions */
+ hsize_t old_dims[4]; /* Old dataset dimensions */
+ hsize_t min_unwritten_dims[4]; /* Minimum dimensions since last write */
+ hsize_t * valid_dims = old_dims; /* Dimensions of region still containing written data */
+ hsize_t cdims[4]; /* Chunk dimensions */
+ const hsize_t mdims[4] = {10, 10, 10, 10}; /* Memory buffer dimensions */
+ const hsize_t start[4] = {0, 0, 0, 0}; /* Start for hyperslab operations on memory */
+ static hvl_t rbuf[10][10][10][10]; /* Read buffer */
+ static hvl_t wbuf[10][10][10][10]; /* Write buffer */
+ static hsize_t dim_log[RAND4_NITER + 1][4]; /* Log of dataset dimensions */
+ hbool_t zero_dim = FALSE; /* Whether a dimension is 0 */
+ hbool_t writing = TRUE; /* Whether we're writing to the dset */
+ hvl_t fill_value; /* Fill value */
+ unsigned scalar_iter; /* Iteration to shrink dset to 1x1x1x1 */
+ volatile unsigned i, j, k, l, m; /* Local indices */
+ char filename[NAME_BUF_SIZE];
/* Initialize fill value buffers so they aren't freed in case of an error */
fill_value.len = 0;
- fill_value.p = NULL;
- for(i=0; i<dims[0]; i++)
- for(j=0; j<dims[1]; j++)
- for(k=0; k<dims[2]; k++)
- for(l=0; l<dims[3]; l++) {
+ fill_value.p = NULL;
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
+ for (k = 0; k < dims[2]; k++)
+ for (l = 0; l < dims[3]; l++) {
rbuf[i][j][k][l].len = 0;
- rbuf[i][j][k][l].p = NULL;
+ rbuf[i][j][k][l].p = NULL;
wbuf[i][j][k][l].len = 0;
- wbuf[i][j][k][l].p = NULL;
+ wbuf[i][j][k][l].p = NULL;
} /* end for */
/* Allocate space for VL write buffers, since these never need to be
* reallocated */
- for(i=0; i<dims[0]; i++)
- for(j=0; j<dims[1]; j++)
- for(k=0; k<dims[2]; k++)
- for(l=0; l<dims[3]; l++) {
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
+ for (k = 0; k < dims[2]; k++)
+ for (l = 0; l < dims[3]; l++) {
wbuf[i][j][k][l].len = 2;
- if(NULL == (wbuf[i][j][k][l].p = HDmalloc(2 * sizeof(int))))
+ if (NULL == (wbuf[i][j][k][l].p = HDmalloc(2 * sizeof(int))))
TEST_ERROR;
} /* end for */
@@ -2513,18 +2468,18 @@ static int test_random_rank4_vl( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
TEST_ERROR
/* Create VL type */
- if((type = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ if ((type = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
TEST_ERROR
/* Set maximum dimensions as appropriate for index type */
- if(index_type == RANK4_INDEX_BTREE)
- for(i=0; i<4; i++)
+ if (index_type == RANK4_INDEX_BTREE)
+ for (i = 0; i < 4; i++)
max_dims[i] = H5S_UNLIMITED;
- else if(index_type == RANK4_INDEX_EARRAY)
+ else if (index_type == RANK4_INDEX_EARRAY)
max_dims[1] = H5S_UNLIMITED;
/* Generate random chunk dimensions, 2-4 */
- for(i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
cdims[i] = (hsize_t)((HDrandom() % 3) + 2);
/* Pick iteration to shrink dataset to 1x1x1x1 */
@@ -2532,179 +2487,167 @@ static int test_random_rank4_vl( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
/* Generate initial dataset size, 1-10, unless using fixed array index or
* scalar_iter is 0 */
- for(i=0; i<4; i++) {
- dims[i] = (hsize_t)(index_type != RANK4_INDEX_FARRAY
- ? (0 == scalar_iter ? 1 : ((HDrandom() % 10) + 1)) : 10);
+ for (i = 0; i < 4; i++) {
+ dims[i] = (hsize_t)(
+ index_type != RANK4_INDEX_FARRAY ? (0 == scalar_iter ? 1 : ((HDrandom() % 10) + 1)) : 10);
dim_log[0][i] = dims[i];
} /* end for */
/* Make a copy of the dcpl */
- if((my_dcpl = H5Pcopy(dcpl)) < 0)
+ if ((my_dcpl = H5Pcopy(dcpl)) < 0)
TEST_ERROR
/* Create VL fill value, if requested */
- if(do_fillvalue) {
+ if (do_fillvalue) {
fill_value.len = 2;
- if(NULL == (fill_value.p = HDmalloc(2 * sizeof(int))))
- TEST_ERROR
- ((int *)fill_value.p)[0] = 1;
+ if (NULL == (fill_value.p = HDmalloc(2 * sizeof(int))))
+ TEST_ERROR((int *)fill_value.p)[0] = 1;
((int *)fill_value.p)[1] = 2;
- if(H5Pset_fill_value(my_dcpl, type, &fill_value) < 0)
+ if (H5Pset_fill_value(my_dcpl, type, &fill_value) < 0)
TEST_ERROR
} /* end if */
/* Create dataset */
- if((fspace = H5Screate_simple(4, dims, max_dims)) < 0)
+ if ((fspace = H5Screate_simple(4, dims, max_dims)) < 0)
TEST_ERROR
- if(H5Pset_chunk(my_dcpl, 4, cdims) < 0)
+ if (H5Pset_chunk(my_dcpl, 4, cdims) < 0)
TEST_ERROR
- if(disable_edge_filters)
- if(H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ if (disable_edge_filters)
+ if (H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
TEST_ERROR
- if((dset = H5Dcreate2(file, "dset", type, fspace, H5P_DEFAULT, my_dcpl,
- H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "dset", type, fspace, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Sclose(fspace) < 0)
+ if (H5Sclose(fspace) < 0)
TEST_ERROR
/* Create memory space, and set initial selection */
- if((mspace = H5Screate_simple(4, mdims, NULL)) < 0)
+ if ((mspace = H5Screate_simple(4, mdims, NULL)) < 0)
TEST_ERROR
- if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL)
- < 0)
+ if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Main loop */
- for(i=0; i<RAND4_VL_NITER; i++) {
+ for (i = 0; i < RAND4_VL_NITER; i++) {
/* Generate random write buffer */
- if(writing && !zero_dim) {
- for(j=0; j<dims[0]; j++)
- for(k=0; k<dims[1]; k++)
- for(l=0; l<dims[2]; l++)
- for(m=0; m<dims[3]; m++) {
+ if (writing && !zero_dim) {
+ for (j = 0; j < dims[0]; j++)
+ for (k = 0; k < dims[1]; k++)
+ for (l = 0; l < dims[2]; l++)
+ for (m = 0; m < dims[3]; m++) {
((int *)wbuf[j][k][l][m].p)[0] = HDrandom();
((int *)wbuf[j][k][l][m].p)[1] = HDrandom();
} /* end for */
/* Write data */
- if(H5Dwrite(dset, type, mspace, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
- RAND4_FAIL_DUMP(i+1, -1, -1, -1, -1)
+ if (H5Dwrite(dset, type, mspace, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ RAND4_FAIL_DUMP(i + 1, -1, -1, -1, -1)
} /* end if */
/* Generate new dataset size, 0-10 (0 much less likely). If i is
* scalar_iter, set all dims to 1. */
zero_dim = FALSE;
- for(j=0; j<4; j++) {
+ for (j = 0; j < 4; j++) {
old_dims[j] = dims[j];
- if((dims[j] = (hsize_t)(i == scalar_iter ? 1 : (HDrandom() % 11)))
- == 0)
- if((dims[j] = (hsize_t)(HDrandom() % 11)) == 0)
+ if ((dims[j] = (hsize_t)(i == scalar_iter ? 1 : (HDrandom() % 11))) == 0)
+ if ((dims[j] = (hsize_t)(HDrandom() % 11)) == 0)
zero_dim = TRUE;
- dim_log[i+1][j] = dims[j];
+ dim_log[i + 1][j] = dims[j];
} /* end for */
/* If writing is disabled, update min_unwritten_dims */
- if(!writing)
- for(j=0; j<4; j++)
- if(old_dims[j] < min_unwritten_dims[j])
+ if (!writing)
+ for (j = 0; j < 4; j++)
+ if (old_dims[j] < min_unwritten_dims[j])
min_unwritten_dims[j] = old_dims[j];
/* Resize dataset */
- if(H5Dset_extent(dset, dims) < 0)
- RAND4_FAIL_DUMP(i+2, -1, -1, -1, -1)
+ if (H5Dset_extent(dset, dims) < 0)
+ RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
- if(!zero_dim) {
+ if (!zero_dim) {
/* Read data from resized dataset */
- if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims,
- NULL) < 0)
- RAND4_FAIL_DUMP(i+2, -1, -1, -1, -1)
- if(H5Dread(dset, type, mspace, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- RAND4_FAIL_DUMP(i+2, -1, -1, -1, -1)
+ if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
+ if (H5Dread(dset, type, mspace, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
/* Verify correctness of read data */
- if(do_fillvalue) {
- for(j=0; j<dims[0]; j++)
- for(k=0; k<dims[1]; k++)
- for(l=0; l<dims[2]; l++)
- for(m=0; m<dims[3]; m++)
- if(j >= valid_dims[0] || k >= valid_dims[1]
- || l >= valid_dims[2]
- || m >= valid_dims[3]) {
- if(((int *)fill_value.p)[0]
- != ((int *)rbuf[j][k][l][m].p)[0]
- || ((int *)fill_value.p)[1]
- != ((int *)rbuf[j][k][l][m].p)[1])
- RAND4_FAIL_DUMP(i+2, (int)j, (int)k, (int)l, (int)m)
+ if (do_fillvalue) {
+ for (j = 0; j < dims[0]; j++)
+ for (k = 0; k < dims[1]; k++)
+ for (l = 0; l < dims[2]; l++)
+ for (m = 0; m < dims[3]; m++)
+ if (j >= valid_dims[0] || k >= valid_dims[1] || l >= valid_dims[2] ||
+ m >= valid_dims[3]) {
+ if (((int *)fill_value.p)[0] != ((int *)rbuf[j][k][l][m].p)[0] ||
+ ((int *)fill_value.p)[1] != ((int *)rbuf[j][k][l][m].p)[1])
+ RAND4_FAIL_DUMP(i + 2, (int)j, (int)k, (int)l, (int)m)
} /* end if */
- else
- if(((int *)wbuf[j][k][l][m].p)[0]
- != ((int *)rbuf[j][k][l][m].p)[0]
- || ((int *)wbuf[j][k][l][m].p)[1]
- != ((int *)rbuf[j][k][l][m].p)[1])
- RAND4_FAIL_DUMP(i+2, (int)j, (int)k, (int)l, (int)m)
+ else if (((int *)wbuf[j][k][l][m].p)[0] != ((int *)rbuf[j][k][l][m].p)[0] ||
+ ((int *)wbuf[j][k][l][m].p)[1] != ((int *)rbuf[j][k][l][m].p)[1])
+ RAND4_FAIL_DUMP(i + 2, (int)j, (int)k, (int)l, (int)m)
} /* end if */
else {
- for(j=0; j<MIN(dims[0],valid_dims[0]); j++)
- for(k=0; k<MIN(dims[1],valid_dims[1]); k++)
- for(l=0; l<MIN(dims[2],valid_dims[2]); l++)
- for(m=0; m<MIN(dims[3],valid_dims[3]); m++)
- if(((int *)wbuf[j][k][l][m].p)[0]
- != ((int *)rbuf[j][k][l][m].p)[0]
- || ((int *)wbuf[j][k][l][m].p)[1]
- != ((int *)rbuf[j][k][l][m].p)[1])
- RAND4_FAIL_DUMP(i+2, (int)j, (int)k, (int)l, (int)m)
+ for (j = 0; j < MIN(dims[0], valid_dims[0]); j++)
+ for (k = 0; k < MIN(dims[1], valid_dims[1]); k++)
+ for (l = 0; l < MIN(dims[2], valid_dims[2]); l++)
+ for (m = 0; m < MIN(dims[3], valid_dims[3]); m++)
+ if (((int *)wbuf[j][k][l][m].p)[0] != ((int *)rbuf[j][k][l][m].p)[0] ||
+ ((int *)wbuf[j][k][l][m].p)[1] != ((int *)rbuf[j][k][l][m].p)[1])
+ RAND4_FAIL_DUMP(i + 2, (int)j, (int)k, (int)l, (int)m)
} /* end else */
/* Free read buffer */
- if(H5Treclaim(type, mspace, H5P_DEFAULT, rbuf) < 0)
+ if (H5Treclaim(type, mspace, H5P_DEFAULT, rbuf) < 0)
TEST_ERROR
} /* end if */
/* Handle the switch between writing and not writing */
- if(do_sparse && !(i % RAND4_VL_SPARSE_SWITCH)) {
+ if (do_sparse && !(i % RAND4_VL_SPARSE_SWITCH)) {
writing = !writing;
- if(!writing) {
- for(j=0; j<4; j++)
+ if (!writing) {
+ for (j = 0; j < 4; j++)
min_unwritten_dims[j] = old_dims[j];
valid_dims = min_unwritten_dims;
} /* end if */
else
valid_dims = old_dims;
} /* end if */
- } /* end for */
+ } /* end for */
/* Close */
- if(H5Sselect_all(mspace) < 0)
+ if (H5Sselect_all(mspace) < 0)
TEST_ERROR
- if(H5Treclaim(type, mspace, H5P_DEFAULT, wbuf) < 0)
+ if (H5Treclaim(type, mspace, H5P_DEFAULT, wbuf) < 0)
TEST_ERROR
free(fill_value.p);
- if(H5Sclose(mspace) < 0)
+ if (H5Sclose(mspace) < 0)
TEST_ERROR
- if(H5Pclose(my_dcpl) < 0)
+ if (H5Pclose(my_dcpl) < 0)
TEST_ERROR
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR
- if(H5Tclose(type) < 0)
+ if (H5Tclose(type) < 0)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
- for(i=0; i<dims[0]; i++)
- for(j=0; j<dims[1]; j++)
- for(k=0; k<dims[2]; k++)
- for(l=0; l<dims[3]; l++) {
- if(rbuf[i][j][k][l].p)
+ H5E_BEGIN_TRY
+ {
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
+ for (k = 0; k < dims[2]; k++)
+ for (l = 0; l < dims[3]; l++) {
+ if (rbuf[i][j][k][l].p)
HDfree(rbuf[i][j][k][l].p);
- if(wbuf[i][j][k][l].p)
+ if (wbuf[i][j][k][l].p)
HDfree(wbuf[i][j][k][l].p);
} /* end for */
- if(fill_value.p)
+ if (fill_value.p)
HDfree(fill_value.p);
H5Sclose(fspace);
H5Sclose(mspace);
@@ -2712,7 +2655,8 @@ error:
H5Dclose(dset);
H5Tclose(type);
H5Fclose(file);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return -1;
} /* end test_random_rank4_vl */
@@ -2720,21 +2664,19 @@ error:
* test_random_rank4_dump: Dump debugging info from test_random_rank4 to screen
* after failure.
*/
-static void test_random_rank4_dump( unsigned ndim_sets, hsize_t dim_log[][4],
- hsize_t cdims[4], int j, int k, int l, int m )
+static void
+test_random_rank4_dump(unsigned ndim_sets, hsize_t dim_log[][4], hsize_t cdims[4], int j, int k, int l, int m)
{
unsigned i;
- HDprintf(" Chunk dimensions: ( %u, %u, %u, %u )\n", (unsigned)cdims[0],
- (unsigned)cdims[1], (unsigned)cdims[2], (unsigned)cdims[3]);
+ HDprintf(" Chunk dimensions: ( %u, %u, %u, %u )\n", (unsigned)cdims[0], (unsigned)cdims[1],
+ (unsigned)cdims[2], (unsigned)cdims[3]);
HDprintf(" Log of dataset dimensions (oldest first):\n");
- for(i=0; i<ndim_sets; i++)
- HDprintf(" Iteration %-3u: ( %2u, %2u, %2u, %2u )\n", i,
- (unsigned)dim_log[i][0], (unsigned)dim_log[i][1],
- (unsigned)dim_log[i][2], (unsigned)dim_log[i][3]);
- if(j>=0)
+ for (i = 0; i < ndim_sets; i++)
+ HDprintf(" Iteration %-3u: ( %2u, %2u, %2u, %2u )\n", i, (unsigned)dim_log[i][0],
+ (unsigned)dim_log[i][1], (unsigned)dim_log[i][2], (unsigned)dim_log[i][3]);
+ if (j >= 0)
HDprintf(" First incorrect value read: ( %d, %d, %d, %d )\n", j, k, l, m);
return;
} /* end test_random_rank4_dump */
-
diff --git a/test/space_overflow.c b/test/space_overflow.c
index 82ddb3b..4838fc7 100644
--- a/test/space_overflow.c
+++ b/test/space_overflow.c
@@ -26,7 +26,6 @@
*/
#include "hdf5.h"
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -46,20 +45,20 @@
int
main(void)
{
- hid_t file, space, dset;
- hsize_t cur_dim[H5S_MAX_RANK];
- int i;
+ hid_t file, space, dset;
+ hsize_t cur_dim[H5S_MAX_RANK];
+ int i;
file = H5Fcreate("th5s.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file < 0)
+ if (file < 0)
printf("file<0!\n");
- for(i = 0; i < H5S_MAX_RANK; i++)
+ for (i = 0; i < H5S_MAX_RANK; i++)
cur_dim[i] = 1;
space = H5Screate_simple(H5S_MAX_RANK, cur_dim, NULL);
- if(space < 0)
+ if (space < 0)
printf("space<0!\n");
dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset < 0)
+ if (dset < 0)
printf("dset<0!\n");
H5Sclose(space);
H5Dclose(dset);
diff --git a/test/stab.c b/test/stab.c
index ed4b5a0..739a1ba 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -16,70 +16,66 @@
* Tuesday, November 24, 1998
*/
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5G_TESTING
#include "h5test.h"
-#include "H5Gpkg.h" /* Groups */
+#include "H5Gpkg.h" /* Groups */
-const char *FILENAME[] = {
- "stab",
- NULL
-};
+const char *FILENAME[] = {"stab", NULL};
-#define NAME_BUF_SIZE 1024
+#define NAME_BUF_SIZE 1024
/* Definitions for 'long' test */
-#define LONG_NAME_LEN 40960
+#define LONG_NAME_LEN 40960
/* Definitions for 'large' test */
-#define LARGE_NOBJS 5000
+#define LARGE_NOBJS 5000
/* Definitions for 'lifecycle' test */
-#define LIFECYCLE_TOP_GROUP "top"
-#define LIFECYCLE_BOTTOM_GROUP "bottom %u"
-#define LIFECYCLE_LOCAL_HEAP_SIZE_HINT 256
-#define LIFECYCLE_MAX_COMPACT 4
-#define LIFECYCLE_MIN_DENSE 3
-#define LIFECYCLE_EST_NUM_ENTRIES 4
-#define LIFECYCLE_EST_NAME_LEN 8
+#define LIFECYCLE_TOP_GROUP "top"
+#define LIFECYCLE_BOTTOM_GROUP "bottom %u"
+#define LIFECYCLE_LOCAL_HEAP_SIZE_HINT 256
+#define LIFECYCLE_MAX_COMPACT 4
+#define LIFECYCLE_MIN_DENSE 3
+#define LIFECYCLE_EST_NUM_ENTRIES 4
+#define LIFECYCLE_EST_NAME_LEN 8
/* Definitions for 'long_compact' test */
-#define LONG_COMPACT_LENGTH ((64 * 1024) + 1024)
+#define LONG_COMPACT_LENGTH ((64 * 1024) + 1024)
/* Definitions for 'read_old' test */
-#define READ_OLD_NGROUPS 100
+#define READ_OLD_NGROUPS 100
/* The group_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory
* for version 1.6. To get this data file, simply compile gen_old_group.c with
* the HDF5 library in that branch and run it. */
-#define FILE_OLD_GROUPS "group_old.h5"
+#define FILE_OLD_GROUPS "group_old.h5"
#define FILE_OLD_GROUPS_COPY "group_old_copy.h5"
/* Definitions for 'no_compact' test */
-#define NO_COMPACT_TOP_GROUP "top"
-#define NO_COMPACT_BOTTOM_GROUP "bottom %u"
-#define NO_COMPACT_MAX_COMPACT 0
-#define NO_COMPACT_MIN_DENSE 0
+#define NO_COMPACT_TOP_GROUP "top"
+#define NO_COMPACT_BOTTOM_GROUP "bottom %u"
+#define NO_COMPACT_MAX_COMPACT 0
+#define NO_COMPACT_MIN_DENSE 0
/* Definitions for 'gcpl_on_root' test */
-#define GCPL_ON_ROOT_MIDDLE_GROUP "/middle"
-#define GCPL_ON_ROOT_BOTTOM_GROUP "/middle/bottom"
-#define GCPL_ON_ROOT_MAX_COMPACT 4
-#define GCPL_ON_ROOT_MIN_DENSE 2
+#define GCPL_ON_ROOT_MIDDLE_GROUP "/middle"
+#define GCPL_ON_ROOT_BOTTOM_GROUP "/middle/bottom"
+#define GCPL_ON_ROOT_MAX_COMPACT 4
+#define GCPL_ON_ROOT_MIN_DENSE 2
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Definitions for 'old_api' test */
-#define OLD_API_GROUP "/old_api"
+#define OLD_API_GROUP "/old_api"
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Definitions for 'corrupt_stab_msg' test */
-#define CORRUPT_STAB_FILE "corrupt_stab_msg.h5"
-#define CORRUPT_STAB_TMP_FILE "corrupt_stab_msg_tmp.h5"
-#define CORRUPT_STAB_DSET "DS1"
-
+#define CORRUPT_STAB_FILE "corrupt_stab_msg.h5"
+#define CORRUPT_STAB_TMP_FILE "corrupt_stab_msg_tmp.h5"
+#define CORRUPT_STAB_DSET "DS1"
/*-------------------------------------------------------------------------
* Function: test_misc
@@ -98,72 +94,89 @@ const char *FILENAME[] = {
static int
test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t g1 = (-1), g2 = (-1), g3 = (-1);
- char filename[NAME_BUF_SIZE];
- char comment[64];
+ hid_t fid = (-1); /* File ID */
+ hid_t g1 = (-1), g2 = (-1), g3 = (-1);
+ char filename[NAME_BUF_SIZE];
+ char comment[64];
- if(new_format)
+ if (new_format)
TESTING("miscellaneous group tests (w/new group format)")
else
TESTING("miscellaneous group tests")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR
/* Create initial groups for testing, then close */
- if((g1 = H5Gcreate2(fid, "test_1a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((g2 = H5Gcreate2(g1, "sub_1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((g3 = H5Gcreate2(fid, "test_1b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oset_comment(g3, "hello world") < 0) TEST_ERROR
- if(H5Gclose(g1) < 0) TEST_ERROR
- if(H5Gclose(g2) < 0) TEST_ERROR
- if(H5Gclose(g3) < 0) TEST_ERROR
+ if ((g1 = H5Gcreate2(fid, "test_1a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((g2 = H5Gcreate2(g1, "sub_1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((g3 = H5Gcreate2(fid, "test_1b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oset_comment(g3, "hello world") < 0)
+ TEST_ERROR
+ if (H5Gclose(g1) < 0)
+ TEST_ERROR
+ if (H5Gclose(g2) < 0)
+ TEST_ERROR
+ if (H5Gclose(g3) < 0)
+ TEST_ERROR
/* Open all groups with absolute names to check for exsistence */
- if((g1 = H5Gopen2(fid, "/test_1a", H5P_DEFAULT)) < 0) TEST_ERROR
- if((g2 = H5Gopen2(fid, "/test_1a/sub_1", H5P_DEFAULT)) < 0) TEST_ERROR
- if((g3 = H5Gopen2(fid, "/test_1b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_comment_by_name(g3, "././.", comment, sizeof comment, H5P_DEFAULT) < 0) TEST_ERROR
- if(HDstrcmp(comment, "hello world")) {
- H5_FAILED();
- HDputs(" Read the wrong comment string from the group.");
- HDprintf(" got: \"%s\"\n ans: \"hello world\"\n", comment);
- TEST_ERROR
+ if ((g1 = H5Gopen2(fid, "/test_1a", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((g2 = H5Gopen2(fid, "/test_1a/sub_1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((g3 = H5Gopen2(fid, "/test_1b", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Oget_comment_by_name(g3, "././.", comment, sizeof comment, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if (HDstrcmp(comment, "hello world")) {
+ H5_FAILED();
+ HDputs(" Read the wrong comment string from the group.");
+ HDprintf(" got: \"%s\"\n ans: \"hello world\"\n", comment);
+ TEST_ERROR
}
- if(H5Gclose(g1) < 0) TEST_ERROR
- if(H5Gclose(g2) < 0) TEST_ERROR
- if(H5Gclose(g3) < 0) TEST_ERROR
+ if (H5Gclose(g1) < 0)
+ TEST_ERROR
+ if (H5Gclose(g2) < 0)
+ TEST_ERROR
+ if (H5Gclose(g3) < 0)
+ TEST_ERROR
/* Check that creating groups with no-op names isn't allowed */
- H5E_BEGIN_TRY {
- g1 = H5Gcreate2(fid, "/", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY
- if(g1 >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { g1 = H5Gcreate2(fid, "/", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY
+ if (g1 >= 0)
+ TEST_ERROR
- H5E_BEGIN_TRY {
- g1 = H5Gcreate2(fid, "./././", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY
- if(g1 >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { g1 = H5Gcreate2(fid, "./././", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY
+ if (g1 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Gclose(g1);
- H5Gclose(g2);
- H5Gclose(g3);
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(g1);
+ H5Gclose(g2);
+ H5Gclose(g3);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Purpose: Creates a group with a very long name
*
@@ -179,43 +192,53 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format)
static int
test_long(hid_t fcpl, hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t g1 = (-1), g2 = (-1);
- char *name1 = NULL, *name2 = NULL;
- char filename[NAME_BUF_SIZE];
- size_t i;
+ hid_t fid = (-1); /* File ID */
+ hid_t g1 = (-1), g2 = (-1);
+ char * name1 = NULL, *name2 = NULL;
+ char filename[NAME_BUF_SIZE];
+ size_t i;
- if(new_format)
+ if (new_format)
TESTING("long names (w/new group format)")
else
TESTING("long names")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR
/* Group names */
name1 = (char *)HDmalloc((size_t)LONG_NAME_LEN);
- for(i = 0; i < LONG_NAME_LEN; i++)
- name1[i] = (char)('A' + i%26);
+ for (i = 0; i < LONG_NAME_LEN; i++)
+ name1[i] = (char)('A' + i % 26);
name1[LONG_NAME_LEN - 1] = '\0';
- name2 = (char *)HDmalloc((size_t)((2 * LONG_NAME_LEN) + 2));
+ name2 = (char *)HDmalloc((size_t)((2 * LONG_NAME_LEN) + 2));
HDsprintf(name2, "%s/%s", name1, name1);
/* Create groups */
- if((g1 = H5Gcreate2(fid, name1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((g2 = H5Gcreate2(g1, name1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(g1) < 0) TEST_ERROR
- if(H5Gclose(g2) < 0) TEST_ERROR
+ if ((g1 = H5Gcreate2(fid, name1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((g2 = H5Gcreate2(g1, name1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(g1) < 0)
+ TEST_ERROR
+ if (H5Gclose(g2) < 0)
+ TEST_ERROR
/* Open groups */
- if((g1 = H5Gopen2(fid, name1, H5P_DEFAULT)) < 0) TEST_ERROR
- if((g2 = H5Gopen2(fid, name2, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(g1) < 0) TEST_ERROR
- if(H5Gclose(g2) < 0) TEST_ERROR
+ if ((g1 = H5Gopen2(fid, name1, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((g2 = H5Gopen2(fid, name2, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(g1) < 0)
+ TEST_ERROR
+ if (H5Gclose(g2) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Release name buffers */
HDfree(name2);
@@ -225,17 +248,18 @@ test_long(hid_t fcpl, hid_t fapl, hbool_t new_format)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(g1);
H5Gclose(g2);
H5Fclose(fid);
HDfree(name2);
HDfree(name1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_long() */
-
/*-------------------------------------------------------------------------
* Function: test_large
*
@@ -254,53 +278,62 @@ error:
static int
test_large(hid_t fcpl, hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t cwg = (-1), dir = (-1); /* Group IDs */
- char filename[NAME_BUF_SIZE];
- char name[NAME_BUF_SIZE];
- int i;
+ hid_t fid = (-1); /* File ID */
+ hid_t cwg = (-1), dir = (-1); /* Group IDs */
+ char filename[NAME_BUF_SIZE];
+ char name[NAME_BUF_SIZE];
+ int i;
- if(new_format)
+ if (new_format)
TESTING("large directories (w/new group format)")
else
TESTING("large directories")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR
/*
* Create a directory that has so many entries that the root
* of the B-tree ends up splitting.
*/
- if((cwg = H5Gcreate2(fid, "/big", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(new_format)
- if(H5G__has_stab_test(cwg) != FALSE) TEST_ERROR
- for(i = 0; i < LARGE_NOBJS; i++) {
+ if ((cwg = H5Gcreate2(fid, "/big", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (new_format)
+ if (H5G__has_stab_test(cwg) != FALSE)
+ TEST_ERROR
+ for (i = 0; i < LARGE_NOBJS; i++) {
HDsprintf(name, "%05d%05d", (HDrandom() % 100000), i);
- if((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(dir) < 0) TEST_ERROR
+ if ((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if (H5Gclose(dir) < 0)
+ TEST_ERROR
}
- if(new_format)
- if(H5G__is_new_dense_test(cwg) != TRUE) TEST_ERROR
- if(H5Gclose(cwg) < 0) TEST_ERROR
+ if (new_format)
+ if (H5G__is_new_dense_test(cwg) != TRUE)
+ TEST_ERROR
+ if (H5Gclose(cwg) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Gclose(dir);
- H5Gclose(cwg);
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(dir);
+ H5Gclose(cwg);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_large() */
-
/*-------------------------------------------------------------------------
* Function: lifecycle
*
@@ -320,202 +353,274 @@ test_large(hid_t fcpl, hid_t fapl, hbool_t new_format)
static int
lifecycle(hid_t fcpl, hid_t fapl2)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Datatype ID */
- hid_t gcpl = (-1); /* Group creation property list ID */
- size_t lheap_size_hint; /* Local heap size hint */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned est_num_entries; /* Estimated # of entries in group */
- unsigned est_name_len; /* Estimated length of entry name */
- unsigned nmsgs; /* Number of messages in group's header */
- H5O_native_info_t ninfo; /* Object info */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
- h5_stat_size_t empty_size; /* Size of an empty file */
- unsigned u; /* Local index variable */
- h5_stat_size_t file_size; /* Size of each file created */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
+ hid_t gcpl = (-1); /* Group creation property list ID */
+ size_t lheap_size_hint; /* Local heap size hint */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned est_num_entries; /* Estimated # of entries in group */
+ unsigned est_name_len; /* Estimated length of entry name */
+ unsigned nmsgs; /* Number of messages in group's header */
+ H5O_native_info_t ninfo; /* Object info */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ h5_stat_size_t empty_size; /* Size of an empty file */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t file_size; /* Size of each file created */
TESTING("group lifecycle");
/* Create file */
h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Get size of file as empty */
- if((empty_size = h5_get_file_size(filename, fapl2)) < 0) TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl2)) < 0)
+ TEST_ERROR
/* Re-open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ TEST_ERROR
/* Set up group creation property list */
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Query default group creation property settings */
- if(H5Pget_local_heap_size_hint(gcpl, &lheap_size_hint) < 0) TEST_ERROR
- if(lheap_size_hint != H5G_CRT_GINFO_LHEAP_SIZE_HINT) TEST_ERROR
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
- if(max_compact != H5G_CRT_GINFO_MAX_COMPACT) TEST_ERROR
- if(min_dense != H5G_CRT_GINFO_MIN_DENSE) TEST_ERROR
- if(H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0) TEST_ERROR
- if(est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES) TEST_ERROR
- if(est_name_len != H5G_CRT_GINFO_EST_NAME_LEN) TEST_ERROR
+ if (H5Pget_local_heap_size_hint(gcpl, &lheap_size_hint) < 0)
+ TEST_ERROR
+ if (lheap_size_hint != H5G_CRT_GINFO_LHEAP_SIZE_HINT)
+ TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
+ if (max_compact != H5G_CRT_GINFO_MAX_COMPACT)
+ TEST_ERROR
+ if (min_dense != H5G_CRT_GINFO_MIN_DENSE)
+ TEST_ERROR
+ if (H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0)
+ TEST_ERROR
+ if (est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES)
+ TEST_ERROR
+ if (est_name_len != H5G_CRT_GINFO_EST_NAME_LEN)
+ TEST_ERROR
/* Set GCPL parameters */
- if(H5Pset_local_heap_size_hint(gcpl, (size_t)LIFECYCLE_LOCAL_HEAP_SIZE_HINT) < 0) TEST_ERROR
- if(H5Pset_link_phase_change(gcpl, LIFECYCLE_MAX_COMPACT, LIFECYCLE_MIN_DENSE) < 0) TEST_ERROR
- if(H5Pset_est_link_info(gcpl, LIFECYCLE_EST_NUM_ENTRIES, LIFECYCLE_EST_NAME_LEN) < 0) TEST_ERROR
+ if (H5Pset_local_heap_size_hint(gcpl, (size_t)LIFECYCLE_LOCAL_HEAP_SIZE_HINT) < 0)
+ TEST_ERROR
+ if (H5Pset_link_phase_change(gcpl, LIFECYCLE_MAX_COMPACT, LIFECYCLE_MIN_DENSE) < 0)
+ TEST_ERROR
+ if (H5Pset_est_link_info(gcpl, LIFECYCLE_EST_NUM_ENTRIES, LIFECYCLE_EST_NAME_LEN) < 0)
+ TEST_ERROR
/* Create group for testing lifecycle */
- if((gid = H5Gcreate2(fid, LIFECYCLE_TOP_GROUP, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, LIFECYCLE_TOP_GROUP, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Query group creation property settings */
- if(H5Pget_local_heap_size_hint(gcpl, &lheap_size_hint) < 0) TEST_ERROR
- if(lheap_size_hint != LIFECYCLE_LOCAL_HEAP_SIZE_HINT) TEST_ERROR
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
- if(max_compact != LIFECYCLE_MAX_COMPACT) TEST_ERROR
- if(min_dense != LIFECYCLE_MIN_DENSE) TEST_ERROR
- if(H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0) TEST_ERROR
- if(est_num_entries != LIFECYCLE_EST_NUM_ENTRIES) TEST_ERROR
- if(est_name_len != LIFECYCLE_EST_NAME_LEN) TEST_ERROR
+ if (H5Pget_local_heap_size_hint(gcpl, &lheap_size_hint) < 0)
+ TEST_ERROR
+ if (lheap_size_hint != LIFECYCLE_LOCAL_HEAP_SIZE_HINT)
+ TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
+ if (max_compact != LIFECYCLE_MAX_COMPACT)
+ TEST_ERROR
+ if (min_dense != LIFECYCLE_MIN_DENSE)
+ TEST_ERROR
+ if (H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0)
+ TEST_ERROR
+ if (est_num_entries != LIFECYCLE_EST_NUM_ENTRIES)
+ TEST_ERROR
+ if (est_name_len != LIFECYCLE_EST_NAME_LEN)
+ TEST_ERROR
/* Use internal testing routine to check that the group has no links or symbol table */
- if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) != TRUE)
+ TEST_ERROR
/* Create first "bottom" group */
HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on bottom group's status */
- if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid2) != TRUE)
+ TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Check on top group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
- if(nmsgs != 1) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, &nmsgs) != TRUE)
+ TEST_ERROR
+ if (nmsgs != 1)
+ TEST_ERROR
/* Create several more bottom groups, to push the top group almost to a symbol table */
/* (Start counting at '1', since we've already created one bottom group */
- for(u = 1; u < LIFECYCLE_MAX_COMPACT; u++) {
+ for (u = 1; u < LIFECYCLE_MAX_COMPACT; u++) {
HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on bottom group's status */
- if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid2) != TRUE)
+ TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
} /* end for */
/* Check on top group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
- if(nmsgs != LIFECYCLE_MAX_COMPACT) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != FALSE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, &nmsgs) != TRUE)
+ TEST_ERROR
+ if (nmsgs != LIFECYCLE_MAX_COMPACT)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != FALSE)
+ TEST_ERROR
/* Check that the object header is only one chunk and the space has been allocated correctly */
- if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
- if(ninfo.hdr.space.total != 151) TEST_ERROR
- if(ninfo.hdr.space.free != 0) TEST_ERROR
- if(ninfo.hdr.nmesgs != 6) TEST_ERROR
- if(ninfo.hdr.nchunks != 1) TEST_ERROR
+ if (H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0)
+ TEST_ERROR
+ if (ninfo.hdr.space.total != 151)
+ TEST_ERROR
+ if (ninfo.hdr.space.free != 0)
+ TEST_ERROR
+ if (ninfo.hdr.nmesgs != 6)
+ TEST_ERROR
+ if (ninfo.hdr.nchunks != 1)
+ TEST_ERROR
/* Create one more "bottom" group, which should push top group into using a symbol table */
HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on bottom group's status */
- if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid2) != TRUE)
+ TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Check on top group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
/* Check that the object header is still one chunk and the space has been allocated correctly */
- if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
- if(ninfo.hdr.space.total != 151) TEST_ERROR
- if(ninfo.hdr.space.free != 92) TEST_ERROR
- if(ninfo.hdr.nmesgs != 3) TEST_ERROR
- if(ninfo.hdr.nchunks != 1) TEST_ERROR
+ if (H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0)
+ TEST_ERROR
+ if (ninfo.hdr.space.total != 151)
+ TEST_ERROR
+ if (ninfo.hdr.space.free != 92)
+ TEST_ERROR
+ if (ninfo.hdr.nmesgs != 3)
+ TEST_ERROR
+ if (ninfo.hdr.nchunks != 1)
+ TEST_ERROR
/* Unlink objects from top group */
- while(u >= LIFECYCLE_MIN_DENSE) {
+ while (u >= LIFECYCLE_MIN_DENSE) {
HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
u--;
} /* end while */
/* Check on top group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
/* Unlink one more object from the group, which should transform back to using links */
HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
u--;
/* Check on top group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
- if(nmsgs != (LIFECYCLE_MIN_DENSE - 1)) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, &nmsgs) != TRUE)
+ TEST_ERROR
+ if (nmsgs != (LIFECYCLE_MIN_DENSE - 1))
+ TEST_ERROR
/* Unlink last two objects from top group */
HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
u--;
HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check on top group's status */
- if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) != TRUE)
+ TEST_ERROR
/* Close top group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Unlink top group */
- if(H5Ldelete(fid, LIFECYCLE_TOP_GROUP, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, LIFECYCLE_TOP_GROUP, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR
+ if (H5Pclose(gcpl) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Get size of file as empty */
- if((file_size = h5_get_file_size(filename, fapl2)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl2)) < 0)
+ TEST_ERROR
/* Verify that file is correct size */
- if(file_size != empty_size) TEST_ERROR
-
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gcpl);
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end lifecycle() */
-
/*-------------------------------------------------------------------------
* Function: long_compact
*
@@ -534,124 +639,155 @@ error:
static int
long_compact(hid_t fcpl, hid_t fapl2)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Group ID */
- char *objname = NULL; /* Object name */
- char filename[NAME_BUF_SIZE];
- h5_stat_size_t empty_size; /* Size of an empty file */
- h5_stat_size_t file_size; /* Size of each file created */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Group ID */
+ char * objname = NULL; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ h5_stat_size_t empty_size; /* Size of an empty file */
+ h5_stat_size_t file_size; /* Size of each file created */
TESTING("long link names in compact groups");
/* Create file */
h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Get size of file as empty */
- if((empty_size = h5_get_file_size(filename, fapl2)) < 0) TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl2)) < 0)
+ TEST_ERROR
/* Construct very long object name template */
- if(NULL == (objname = (char *)HDmalloc((size_t)(LONG_COMPACT_LENGTH + 1)))) TEST_ERROR
+ if (NULL == (objname = (char *)HDmalloc((size_t)(LONG_COMPACT_LENGTH + 1))))
+ TEST_ERROR
HDmemset(objname, 'a', (size_t)LONG_COMPACT_LENGTH);
objname[LONG_COMPACT_LENGTH] = '\0';
/* Re-open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ TEST_ERROR
/* Create top group */
- if((gid = H5Gcreate2(fid, "top", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, "top", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Use internal testing routine to check that the group has no links or dense storage */
- if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) != TRUE)
+ TEST_ERROR
/* Create first group with "long" name */
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on bottom group's status */
- if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid2) != TRUE)
+ TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Check on top group's status */
/* (Should have dense storage to hold links, since name is too long for object header message) */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
/* Create second group with "long" name */
objname[0] = 'b';
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on bottom group's status */
- if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid2) != TRUE)
+ TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Check on top group's status */
/* (Should have dense storage to hold links, since name is too long for object header message) */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
/* Unlink second object from top group */
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check on top group's status */
/* (Should still be dense storage to hold links, since name is too long for object header message) */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
/* Unlink first object from top group */
objname[0] = 'a';
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check on top group's status */
/* (Should have deleted the dense storage now) */
- if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) != TRUE)
+ TEST_ERROR
/* Free object name */
HDfree(objname);
objname = NULL;
/* Close top group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Unlink top group */
- if(H5Ldelete(fid, "top", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "top", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Get size of file as empty */
- if((file_size = h5_get_file_size(filename, fapl2)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl2)) < 0)
+ TEST_ERROR
/* Verify that file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(objname)
+ if (objname)
HDfree(objname);
return 1;
} /* end long_compact() */
-
/*-------------------------------------------------------------------------
* Function: read_old
*
@@ -669,76 +805,95 @@ error:
static int
read_old(void)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Group ID */
- char objname[NAME_BUF_SIZE]; /* Object name */
- unsigned u; /* Local index variable */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Group ID */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ unsigned u; /* Local index variable */
TESTING("reading old groups");
/* Make a copy of the data file from svn. */
- if(h5_make_local_copy(FILE_OLD_GROUPS, FILE_OLD_GROUPS_COPY) < 0) TEST_ERROR
+ if (h5_make_local_copy(FILE_OLD_GROUPS, FILE_OLD_GROUPS_COPY) < 0)
+ TEST_ERROR
/* Open copied file */
- if((fid = H5Fopen(FILE_OLD_GROUPS_COPY, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(FILE_OLD_GROUPS_COPY, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Attempt to open "old" group */
- if((gid = H5Gopen2(fid, "old", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gopen2(fid, "old", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on old group's status */
- if(H5G__is_empty_test(gid) == FALSE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == FALSE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(gid) != TRUE)
+ TEST_ERROR
/* Create a bunch of objects in the group */
- for(u = 0; u < READ_OLD_NGROUPS; u++) {
+ for (u = 0; u < READ_OLD_NGROUPS; u++) {
HDsprintf(objname, "Group %u", u);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on bottom group's status */
- if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid2) != TRUE)
+ TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
} /* end for */
/* Check on old group's status */
/* (Should stay in old "symbol table" form) */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(gid) != TRUE)
+ TEST_ERROR
/* Delete new objects from old group */
- for(u = 0; u < READ_OLD_NGROUPS; u++) {
+ for (u = 0; u < READ_OLD_NGROUPS; u++) {
HDsprintf(objname, "Group %u", u);
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Check on old group's status */
/* (Should stay in old "symbol table" form, but have no links) */
- if(H5G__is_empty_test(gid) == FALSE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == FALSE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(gid) != TRUE)
+ TEST_ERROR
/* Close old group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end read_old() */
-
/*-------------------------------------------------------------------------
* Function: no_compact
*
@@ -757,103 +912,129 @@ error:
static int
no_compact(hid_t fcpl, hid_t fapl2)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Datatype ID */
- hid_t gcpl = (-1); /* Group creation property list ID */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
- h5_stat_size_t empty_size; /* Size of an empty file */
- h5_stat_size_t file_size; /* Size of each file created */
- unsigned est_num_entries; /* Estimated # of entries in group */
- unsigned est_name_len; /* Estimated length of entry name */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
+ hid_t gcpl = (-1); /* Group creation property list ID */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ h5_stat_size_t empty_size; /* Size of an empty file */
+ h5_stat_size_t file_size; /* Size of each file created */
+ unsigned est_num_entries; /* Estimated # of entries in group */
+ unsigned est_name_len; /* Estimated length of entry name */
TESTING("group without compact form");
/* Create file */
h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Get size of file as empty */
- if((empty_size = h5_get_file_size(filename, fapl2)) < 0) TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl2)) < 0)
+ TEST_ERROR
/* Re-open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0)
+ TEST_ERROR
/* Set up group creation property list */
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if ((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
/* Set GCPL parameters */
- if(H5Pset_link_phase_change(gcpl, NO_COMPACT_MAX_COMPACT, NO_COMPACT_MIN_DENSE) < 0) TEST_ERROR
+ if (H5Pset_link_phase_change(gcpl, NO_COMPACT_MAX_COMPACT, NO_COMPACT_MIN_DENSE) < 0)
+ TEST_ERROR
/* Check information for default group creation */
- if(H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0) TEST_ERROR
- if(est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES) TEST_ERROR
- if(est_name_len != H5G_CRT_GINFO_EST_NAME_LEN) TEST_ERROR
+ if (H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0)
+ TEST_ERROR
+ if (est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES)
+ TEST_ERROR
+ if (est_name_len != H5G_CRT_GINFO_EST_NAME_LEN)
+ TEST_ERROR
/* Create group for testing no compact form */
- if((gid = H5Gcreate2(fid, NO_COMPACT_TOP_GROUP, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gcreate2(fid, NO_COMPACT_TOP_GROUP, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR
+ if (H5Pclose(gcpl) < 0)
+ TEST_ERROR
/* Use internal testing routine to check that the group has no links or dense storage */
- if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) != TRUE)
+ TEST_ERROR
/* Create first "bottom" group */
HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Check on bottom group's status */
- if(H5G__is_empty_test(gid2) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid2) != TRUE)
+ TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Check on top group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
/* Unlink object from top group */
HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0);
- if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check on top group's status */
- if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) != TRUE)
+ TEST_ERROR
/* Close top group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Unlink top group */
- if(H5Ldelete(fid, NO_COMPACT_TOP_GROUP, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, NO_COMPACT_TOP_GROUP, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Get size of file as empty */
- if((file_size = h5_get_file_size(filename, fapl2)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl2)) < 0)
+ TEST_ERROR
/* Verify that file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gcpl);
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end no_compact() */
-
/*-------------------------------------------------------------------------
* Function: gcpl_on_root
*
@@ -871,15 +1052,15 @@ error:
static int
gcpl_on_root(hid_t fapl2)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Datatype ID */
- hid_t fcpl = (-1); /* File creation property list ID */
- hid_t gcpl = (-1); /* Group creation property list ID */
- hid_t lcpl = (-1); /* Link creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
+ hid_t fcpl = (-1); /* File creation property list ID */
+ hid_t gcpl = (-1); /* Group creation property list ID */
+ hid_t lcpl = (-1); /* Link creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ char filename[NAME_BUF_SIZE];
TESTING("setting root group creation properties");
@@ -887,94 +1068,126 @@ gcpl_on_root(hid_t fapl2)
h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
/* Set up file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
/* Set GCPL parameters */
- if(H5Pset_link_phase_change(fcpl, GCPL_ON_ROOT_MAX_COMPACT, GCPL_ON_ROOT_MIN_DENSE) < 0) TEST_ERROR
+ if (H5Pset_link_phase_change(fcpl, GCPL_ON_ROOT_MAX_COMPACT, GCPL_ON_ROOT_MIN_DENSE) < 0)
+ TEST_ERROR
/* Query the group creation properties from the FCPL */
- if(H5Pget_link_phase_change(fcpl, &max_compact, &min_dense) < 0) TEST_ERROR
- if(max_compact != GCPL_ON_ROOT_MAX_COMPACT) TEST_ERROR
- if(min_dense != GCPL_ON_ROOT_MIN_DENSE) TEST_ERROR
+ if (H5Pget_link_phase_change(fcpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
+ if (max_compact != GCPL_ON_ROOT_MAX_COMPACT)
+ TEST_ERROR
+ if (min_dense != GCPL_ON_ROOT_MIN_DENSE)
+ TEST_ERROR
/* Create file with modified root group creation properties */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0) TEST_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0)
+ TEST_ERROR
/* Close FCPL */
- if(H5Pclose(fcpl) < 0) TEST_ERROR
+ if (H5Pclose(fcpl) < 0)
+ TEST_ERROR
/* Open the root group */
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
- if(max_compact != GCPL_ON_ROOT_MAX_COMPACT) TEST_ERROR
- if(min_dense != GCPL_ON_ROOT_MIN_DENSE) TEST_ERROR
+ if ((gcpl = H5Gget_create_plist(gid)) < 0)
+ TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
+ if (max_compact != GCPL_ON_ROOT_MAX_COMPACT)
+ TEST_ERROR
+ if (min_dense != GCPL_ON_ROOT_MIN_DENSE)
+ TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR
+ if (H5Pclose(gcpl) < 0)
+ TEST_ERROR
/* Create a link creation property list, with intermediate group creation set */
- if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_create_intermediate_group(lcpl, TRUE) < 0) TEST_ERROR
+ if ((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0)
+ TEST_ERROR
+ if (H5Pset_create_intermediate_group(lcpl, TRUE) < 0)
+ TEST_ERROR
/* Create a group and intermediate groups, to check if root group settings are inherited */
- if((gid2 = H5Gcreate2(gid, GCPL_ON_ROOT_BOTTOM_GROUP, lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gcreate2(gid, GCPL_ON_ROOT_BOTTOM_GROUP, lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close LCPL */
- if(H5Pclose(lcpl) < 0) TEST_ERROR
+ if (H5Pclose(lcpl) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if((gcpl = H5Gget_create_plist(gid2)) < 0) TEST_ERROR
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
- if(max_compact != H5G_CRT_GINFO_MAX_COMPACT) TEST_ERROR
- if(min_dense != H5G_CRT_GINFO_MIN_DENSE) TEST_ERROR
+ if ((gcpl = H5Gget_create_plist(gid2)) < 0)
+ TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
+ if (max_compact != H5G_CRT_GINFO_MAX_COMPACT)
+ TEST_ERROR
+ if (min_dense != H5G_CRT_GINFO_MIN_DENSE)
+ TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR
+ if (H5Pclose(gcpl) < 0)
+ TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Open the middle group */
- if((gid2 = H5Gopen2(fid, GCPL_ON_ROOT_MIDDLE_GROUP, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gid2 = H5Gopen2(fid, GCPL_ON_ROOT_MIDDLE_GROUP, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Query the group creation properties */
- if((gcpl = H5Gget_create_plist(gid2)) < 0) TEST_ERROR
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
- if(max_compact != GCPL_ON_ROOT_MAX_COMPACT) TEST_ERROR
- if(min_dense != GCPL_ON_ROOT_MIN_DENSE) TEST_ERROR
+ if ((gcpl = H5Gget_create_plist(gid2)) < 0)
+ TEST_ERROR
+ if (H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0)
+ TEST_ERROR
+ if (max_compact != GCPL_ON_ROOT_MAX_COMPACT)
+ TEST_ERROR
+ if (min_dense != GCPL_ON_ROOT_MIN_DENSE)
+ TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR
+ if (H5Pclose(gcpl) < 0)
+ TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ if (H5Gclose(gid2) < 0)
+ TEST_ERROR
/* Close root group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(lcpl);
H5Gclose(gcpl);
H5Gclose(gid2);
H5Gclose(gid);
H5Gclose(fcpl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end gcpl_on_root() */
-
/*-------------------------------------------------------------------------
* Function: old_api
*
@@ -992,11 +1205,11 @@ static int
old_api(hid_t fapl)
{
#ifndef H5_NO_DEPRECATED_SYMBOLS
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- h5_stat_size_t small_file_size; /* Size of small group file */
- h5_stat_size_t large_file_size; /* Size of large group file */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ h5_stat_size_t small_file_size; /* Size of small group file */
+ h5_stat_size_t large_file_size; /* Size of large group file */
+ char filename[NAME_BUF_SIZE];
#endif /* H5_NO_DEPRECATED_SYMBOLS */
TESTING("old API routines");
@@ -1006,47 +1219,59 @@ old_api(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a group, with the old API routine and a "small" heap */
- if((gid = H5Gcreate1(fid, OLD_API_GROUP, (size_t)0)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate1(fid, OLD_API_GROUP, (size_t)0)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file with a "small" heap for group */
- if((small_file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
-
+ if ((small_file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a group, with the old API routine and a "large" heap */
- if((gid = H5Gcreate1(fid, OLD_API_GROUP, (size_t)10000)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate1(fid, OLD_API_GROUP, (size_t)10000)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Re-open group */
- if((gid = H5Gopen1(fid, OLD_API_GROUP)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen1(fid, OLD_API_GROUP)) < 0)
+ FAIL_STACK_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file with a "large" heap for group */
- if((large_file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((large_file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Check that the file with a "large" group heap is actually bigger */
- if(large_file_size <= small_file_size) TEST_ERROR
+ if (large_file_size <= small_file_size)
+ TEST_ERROR
PASSED();
-#else /* H5_NO_DEPRECATED_SYMBOLS */
+#else /* H5_NO_DEPRECATED_SYMBOLS */
/* Shut compiler up */
fapl = fapl;
@@ -1058,15 +1283,16 @@ old_api(hid_t fapl)
#ifndef H5_NO_DEPRECATED_SYMBOLS
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end old_api() */
-
/*-------------------------------------------------------------------------
* Function: corrupt_stab_msg
*
@@ -1084,51 +1310,62 @@ error:
static int
corrupt_stab_msg(void)
{
- hid_t fid = (-1); /* File ID */
- hid_t did = (-1); /* Dataset ID */
+ hid_t fid = (-1); /* File ID */
+ hid_t did = (-1); /* Dataset ID */
TESTING("corrupt symbol table message");
/* Make a copy of the data file from svn. */
- if(h5_make_local_copy(CORRUPT_STAB_FILE, CORRUPT_STAB_TMP_FILE) < 0) TEST_ERROR
+ if (h5_make_local_copy(CORRUPT_STAB_FILE, CORRUPT_STAB_TMP_FILE) < 0)
+ TEST_ERROR
#ifndef H5_STRICT_FORMAT_CHECKS
/* Open temp file through HDF5 library */
- if((fid = H5Fopen(CORRUPT_STAB_TMP_FILE, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(CORRUPT_STAB_TMP_FILE, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Open dataset */
- if((did = H5Dopen2(fid, CORRUPT_STAB_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, CORRUPT_STAB_DSET, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close dataset and file */
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
/* Now reopen with read only access. This verifies that the issue has been
* corrected, as the symbol table message is not patched in read only mode.
*/
/* Open file */
- if((fid = H5Fopen(CORRUPT_STAB_TMP_FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(CORRUPT_STAB_TMP_FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Open dataset */
- if((did = H5Dopen2(fid, CORRUPT_STAB_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((did = H5Dopen2(fid, CORRUPT_STAB_DSET, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Close dataset and file */
- if(H5Dclose(did) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Dclose(did) < 0)
+ TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
#else /* H5_STRICT_FORMAT_CHECKS */
/* Open file */
- if((fid = H5Fopen(CORRUPT_STAB_TMP_FILE, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((fid = H5Fopen(CORRUPT_STAB_TMP_FILE, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/* Verify that an error is thrown when we try to access the dataset */
- H5E_BEGIN_TRY {
- did = H5Dopen2(fid, CORRUPT_STAB_DSET, H5P_DEFAULT);
- } H5E_END_TRY
- if(did >= 0) TEST_ERROR
+ H5E_BEGIN_TRY { did = H5Dopen2(fid, CORRUPT_STAB_DSET, H5P_DEFAULT); }
+ H5E_END_TRY
+ if (did >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
#endif /* H5_STRICT_FORMAT_CHECKS */
@@ -1137,15 +1374,16 @@ corrupt_stab_msg(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end corrupt_stab_msg() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1165,16 +1403,16 @@ error:
int
main(void)
{
- hid_t fapl, fapl2; /* File access property list IDs */
- hid_t fcpl, fcpl2; /* File creation property list ID */
- unsigned new_format; /* Whether to use the new format or not */
- const char *env_h5_drvr; /* File Driver value from environment */
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
- int nerrors = 0;
+ hid_t fapl, fapl2; /* File access property list IDs */
+ hid_t fcpl, fcpl2; /* File creation property list ID */
+ unsigned new_format; /* Whether to use the new format or not */
+ const char *env_h5_drvr; /* File Driver value from environment */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ int nerrors = 0;
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
/* VFD that does not support contigous address space */
@@ -1185,31 +1423,35 @@ main(void)
fapl = h5_fileaccess();
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
/* Set up file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
- if((fcpl2 = H5Pcopy(fcpl)) < 0) TEST_ERROR
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ TEST_ERROR
+ if ((fcpl2 = H5Pcopy(fcpl)) < 0)
+ TEST_ERROR
/* Set to use paged aggregation strategy and persisting free-space */
/* Skip testing for multi/split drivers */
- if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0)
TEST_ERROR
/* Loop over using new group format */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl = fapl;
hid_t my_fcpl = fcpl;
- if(!contig_addr_vfd)
+ if (!contig_addr_vfd)
continue;
- if(new_format) {
+ if (new_format) {
my_fapl = fapl2;
- my_fcpl = fcpl2; /* Set to use paged aggregation and persisting free-space */
+ my_fcpl = fcpl2; /* Set to use paged aggregation and persisting free-space */
}
/* Perform basic tests, with old & new style groups */
@@ -1219,7 +1461,7 @@ main(void)
} /* end for */
/* New format group specific tests (require new format features) */
- if(contig_addr_vfd) {
+ if (contig_addr_vfd) {
nerrors += lifecycle(fcpl2, fapl2);
nerrors += long_compact(fcpl2, fapl2);
nerrors += read_old();
@@ -1240,7 +1482,7 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
/* Check for test errors */
- if(nerrors)
+ if (nerrors)
goto error;
HDputs("All symbol table tests passed.");
@@ -1258,4 +1500,3 @@ error:
HDputs("*** TESTS FAILED ***");
return 1;
}
-
diff --git a/test/swmr.c b/test/swmr.c
index a1bc87d..61d312b 100644
--- a/test/swmr.c
+++ b/test/swmr.c
@@ -12,53 +12,49 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: swmr
-*
-* To test new public routines from SWMR project:
-* H5Pget/set_metadata_read_attempts()
-* H5Fget_metadata_read_retry_info()
-* H5Fstart_swmr_write()
-* H5Pget/set_object_flush_cb()
-* H5Pget/set_append_flush()
-*
-*************************************************************/
+ *
+ * Test program: swmr
+ *
+ * To test new public routines from SWMR project:
+ * H5Pget/set_metadata_read_attempts()
+ * H5Fget_metadata_read_retry_info()
+ * H5Fstart_swmr_write()
+ * H5Pget/set_object_flush_cb()
+ * H5Pget/set_append_flush()
+ *
+ *************************************************************/
#include "h5test.h"
#include "H5Iprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/*
* This file needs to access private information from the H5F package.
* This file also needs to access the file, file driver, dataset,
* and object header testing code.
*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
#define H5D_TESTING
-#include "H5Dpkg.h" /* Datasets */
+#include "H5Dpkg.h" /* Datasets */
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
-#include "H5FDpkg.h" /* File drivers */
+#include "H5FDpkg.h" /* File drivers */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
-#include "H5Opkg.h" /* Object headers */
-
-
-const char *FILENAME[] = {
- "swmr0", /* 0 */
- "swmr1", /* 1 */
- "swmr2", /* 2 */
- NULL
-};
+#include "H5Opkg.h" /* Object headers */
+const char *FILENAME[] = {"swmr0", /* 0 */
+ "swmr1", /* 1 */
+ "swmr2", /* 2 */
+ NULL};
-#define NAME_BUF_SIZE 1024 /* Length of file name */
+#define NAME_BUF_SIZE 1024 /* Length of file name */
/* Tests for H5Pget/set_metadata_read_attempts(), H5Fget_metadata_read_retry_info */
static int test_metadata_read_attempts(hid_t in_fapl);
@@ -72,15 +68,15 @@ static int test_start_swmr_write_stress_ohdr(hid_t in_fapl);
/* Tests for H5Pget/set_object_flush_cb() */
static herr_t flush_cb(hid_t obj_id, void *_udata);
-static int test_object_flush_cb(hid_t in_fapl);
+static int test_object_flush_cb(hid_t in_fapl);
/* Tests for H5Pget/set_append_flush() */
static herr_t append_cb(hid_t dset_id, hsize_t *cur_dims, void *_udata);
static herr_t append_cb2(hid_t dset_id, hsize_t *cur_dims, void *_udata);
-static int test_append_flush_generic(void);
-static int test_append_flush_dataset_chunked(hid_t in_fapl);
-static int test_append_flush_dataset_fixed(hid_t in_fapl);
-static int test_append_flush_dataset_multiple(hid_t in_fapl);
+static int test_append_flush_generic(void);
+static int test_append_flush_dataset_chunked(hid_t in_fapl);
+static int test_append_flush_dataset_fixed(hid_t in_fapl);
+static int test_append_flush_dataset_multiple(hid_t in_fapl);
/* Tests for file open flags/SWMR flags: single process access */
static int test_file_lock_same(hid_t fapl);
@@ -116,15 +112,15 @@ static int test_multiple_same(hid_t in_fapl, hbool_t new_format);
static int
test_metadata_read_attempts(hid_t in_fapl)
{
- hid_t fapl = -1; /* File access property list */
- hid_t file_fapl = -1; /* The file's access property list */
- hid_t fid = -1, fid1 = -1, fid2 = -1; /* File IDs */
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- hbool_t compat_w_default_vfd; /* current VFD compat w/ H5P_DEFAULT? */
- unsigned attempts; /* The # of read attempts */
- char filename[NAME_BUF_SIZE]; /* File name */
- herr_t ret; /* Generic return value */
+ hid_t fapl = -1; /* File access property list */
+ hid_t file_fapl = -1; /* The file's access property list */
+ hid_t fid = -1, fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ hbool_t compat_w_default_vfd; /* current VFD compat w/ H5P_DEFAULT? */
+ unsigned attempts; /* The # of read attempts */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
TESTING("H5Pget/set_metadata_read_attempts()");
@@ -148,7 +144,7 @@ test_metadata_read_attempts(hid_t in_fapl)
}
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
@@ -161,50 +157,51 @@ test_metadata_read_attempts(hid_t in_fapl)
* file access property list.
*/
/* Get # of read attempts -- should be the default: 1 */
- if(H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 1)
+ if (attempts != 1)
TEST_ERROR
/* Set the # of read attempts to 0--should fail */
- H5E_BEGIN_TRY {
- ret = H5Pset_metadata_read_attempts(fapl, 0);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_metadata_read_attempts(fapl, 0); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Set the # of read attempts to a # > 0--should succeed */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
TEST_ERROR
/* Retrieve the # of read attempts -- should be 9 */
- if(H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 9)
+ if (attempts != 9)
TEST_ERROR
- /* Set the # of read attempts to the default for non-SWMR access: H5F_METADATA_READ_ATTEMPTS --should succeed */
- if(H5Pset_metadata_read_attempts(fapl, H5F_METADATA_READ_ATTEMPTS) < 0)
+ /* Set the # of read attempts to the default for non-SWMR access: H5F_METADATA_READ_ATTEMPTS --should
+ * succeed */
+ if (H5Pset_metadata_read_attempts(fapl, H5F_METADATA_READ_ATTEMPTS) < 0)
TEST_ERROR
/* Retrieve the # of read attempts -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
- /* Set the # of read attempts to the default for SWMR access: H5F_SWMR_METADATA_READ_ATEMPTS --should succeed */
- if(H5Pset_metadata_read_attempts(fapl, H5F_SWMR_METADATA_READ_ATTEMPTS) < 0)
+ /* Set the # of read attempts to the default for SWMR access: H5F_SWMR_METADATA_READ_ATEMPTS --should
+ * succeed */
+ if (H5Pset_metadata_read_attempts(fapl, H5F_SWMR_METADATA_READ_ATTEMPTS) < 0)
TEST_ERROR
/* Retrieve the # of read attempts -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/*
@@ -216,173 +213,173 @@ test_metadata_read_attempts(hid_t in_fapl)
*/
/* Test 1 */
/* Create a file with non-SWMR access and default fapl */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 2 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access and default read attempts */
- if((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 3 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access and fapl (non-default & set to 9) */
- if((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be 9 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 9)
+ if (attempts != 9)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 4 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 1) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 1) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access and fapl (non-default & set to 1) */
- if((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be 1 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 1)
+ if (attempts != 1)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 5 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR_READ and fapl (non-default read attempts but unset) */
- if((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/*
@@ -394,241 +391,241 @@ test_metadata_read_attempts(hid_t in_fapl)
*/
/* Test 1 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create a file with non-SWMR access and default read attempts */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 2 */
/* Open the file with non-SWMR access and default fapl */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 3 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Open the file with non-SWMR access and fapl (non-default & set to 9) */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be 9 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 9)
+ if (attempts != 9)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 4 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 1) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 1) < 0)
FAIL_STACK_ERROR
/* Open the file with non-SWMR access and fapl (non-default & set to 1) */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be 1 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 1)
+ if (attempts != 1)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 5 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Open the file with non-SWMR_READ and fapl (non-default but unset) */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Open file again with non-SWMR access and default fapl */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Open file again with SWMR access and default read attempts */
- if((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -640,85 +637,85 @@ test_metadata_read_attempts(hid_t in_fapl)
*/
/* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Open file again with SWMR access and default read attempts */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Open file again with SWMR access and fapl (non-default & set to 9) */
- if((fid2 = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Re-open fid1 */
- if((fid = H5Freopen(fid1)) < 0)
+ if ((fid = H5Freopen(fid1)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Re-open fid2 */
- if((fid = H5Freopen(fid2)) < 0)
+ if ((fid = H5Freopen(fid2)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS, not 9 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close all the files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
@@ -730,110 +727,111 @@ test_metadata_read_attempts(hid_t in_fapl)
*/
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Open file again with non-SWMR access and default fapl */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Open file again with non-SWMR access and fapl (non-default & set to 9) */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Re-open fid1 */
- if((fid = H5Freopen(fid1)) < 0)
+ if ((fid = H5Freopen(fid1)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Re-open fid2 */
- if((fid = H5Freopen(fid2)) < 0)
+ if ((fid = H5Freopen(fid2)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close all the files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(file_fapl);
H5Fclose(fid);
H5Fclose(fid1);
H5Fclose(fid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
} /* test_metadata_read_attempts() */
/*
@@ -846,80 +844,80 @@ error:
static int
test_metadata_read_retry_info(hid_t in_fapl)
{
- hid_t fapl, new_fapl; /* File access property list */
- hid_t fid, fid1; /* File IDs */
- H5F_retry_info_t info, info1; /* The collection of metadata retries */
- H5F_t *f = NULL, *f1 = NULL; /* Internal file object pointers */
- unsigned i, j, n; /* Local index variables */
- hid_t did1, did2; /* Dataset IDs */
- hid_t sid; /* Dataspace ID */
- hid_t dcpl; /* Dataset creation property list */
- hsize_t dims[2] = {6, 10}; /* Dataset dimensions */
- char filename[NAME_BUF_SIZE]; /* File name */
- int buf[6][10], chkbuf1[6][10], chkbuf2[6][10]; /* Buffers for data */
- hsize_t max_dims_1un[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Dataset maximum dimensions */
- hsize_t max_dims_2un[2] = {500, H5S_UNLIMITED}; /* Dataset maximum dimensions */
- hsize_t chunk_dims[2] = {2, 2}; /* Chunk dimensions */
+ hid_t fapl, new_fapl; /* File access property list */
+ hid_t fid, fid1; /* File IDs */
+ H5F_retry_info_t info, info1; /* The collection of metadata retries */
+ H5F_t * f = NULL, *f1 = NULL; /* Internal file object pointers */
+ unsigned i, j, n; /* Local index variables */
+ hid_t did1, did2; /* Dataset IDs */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataset creation property list */
+ hsize_t dims[2] = {6, 10}; /* Dataset dimensions */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ int buf[6][10], chkbuf1[6][10], chkbuf2[6][10]; /* Buffers for data */
+ hsize_t max_dims_1un[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Dataset maximum dimensions */
+ hsize_t max_dims_2un[2] = {500, H5S_UNLIMITED}; /* Dataset maximum dimensions */
+ hsize_t chunk_dims[2] = {2, 2}; /* Chunk dimensions */
/* Output message about test being performed */
TESTING("H5Fset_metadata_read_retry_info()");
/* Get a copy of the parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create a file without SWMR access */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 1 unlimited dimension: extensible array indexing will be used */
- if((sid = H5Screate_simple(2, dims, max_dims_1un)) < 0)
+ if ((sid = H5Screate_simple(2, dims, max_dims_1un)) < 0)
FAIL_STACK_ERROR
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR
- if((did1 = H5Dcreate2(fid, "DSET_1UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "DSET_1UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 2 unlimited dimension: v2 Btree indexing will be used */
- if((sid = H5Screate_simple(2, dims, max_dims_2un)) < 0)
+ if ((sid = H5Screate_simple(2, dims, max_dims_2un)) < 0)
FAIL_STACK_ERROR
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dcreate2(fid, "DSET_2UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, "DSET_2UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize buffer data */
- for(i = n = 0; i < 6; i++)
- for(j = 0; j < 10; j++)
- buf[i][j] = (int)n++;
+ for (i = n = 0; i < 6; i++)
+ for (j = 0; j < 10; j++)
+ buf[i][j] = (int)n++;
/* Write to the 2 datasets */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
FAIL_STACK_ERROR
/* Closing */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -931,68 +929,67 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.retries should all be NULL
*/
/* Open the file without SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2) < 0)
FAIL_STACK_ERROR
/* Retrieve retries information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 0 */
- if(info.nbins != 0)
+ if (info.nbins != 0)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
-
/*
* Open a file with SWMR access, default # of read attempts--
* info.nbins should be 2
* info.retries should all be NULL
*/
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retries information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 2 */
- if(info.nbins != 2)
+ if (info.nbins != 2)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1000,33 +997,33 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.nbins should be 1
* info.retries should all be NULL
*/
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_metadata_read_attempts(new_fapl, 10) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 10) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 1 */
- if(info.nbins != 1)
+ if (info.nbins != 1)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1034,32 +1031,32 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.nbins should be 3
* info.retries should all be NULL
*/
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_metadata_read_attempts(new_fapl, 101) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 101) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 3 */
- if(info.nbins != 3)
+ if (info.nbins != 3)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1067,33 +1064,33 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.nbins should be 4
* info.retries should all be NULL
*/
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_metadata_read_attempts(new_fapl, 10000) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 10000) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 4 */
- if(info.nbins != 4)
+ if (info.nbins != 4)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1101,75 +1098,74 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.nbins should be 0
* info.retries should all be NULL
*/
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_metadata_read_attempts(new_fapl, 1) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 1) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 0 */
- if(info.nbins != 0)
+ if (info.nbins != 0)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
-
/*
* Case 2: tests on retries info
*/
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Read data from the dataset */
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Read data from the dataset */
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 2 */
- if(info.nbins != 2)
+ if (info.nbins != 2)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Get a pointer to the internal file object */
- if((f = (H5F_t *)H5VL_object(fid)) == NULL)
+ if ((f = (H5F_t *)H5VL_object(fid)) == NULL)
FAIL_STACK_ERROR
/*
@@ -1180,45 +1176,45 @@ test_metadata_read_retry_info(hid_t in_fapl)
*/
/* v2 B-tree leaf node: log retry 99 for 500 times */
- for(i = 0; i < 500; i++) {
- if(H5F_track_metadata_read_retries(f, H5AC_BT2_LEAF_ID, 99) < 0)
+ for (i = 0; i < 500; i++) {
+ if (H5F_track_metadata_read_retries(f, H5AC_BT2_LEAF_ID, 99) < 0)
FAIL_STACK_ERROR
}
/* Extensive array data block: log retry 10 for 1000 times */
- for(i = 0; i < 1000; i++)
- if(H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 10) < 0)
+ for (i = 0; i < 1000; i++)
+ if (H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 10) < 0)
FAIL_STACK_ERROR
/* File's superblock: log retry 1 for 1 time */
- if(H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
+ if (H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
FAIL_STACK_ERROR
/* Retrieve the collection of metadata read retries */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Verify retries for v2 B-tree leaf node */
- if(info.retries[4][0] != 0)
+ if (info.retries[4][0] != 0)
TEST_ERROR
- if(info.retries[4][1] != 500)
+ if (info.retries[4][1] != 500)
TEST_ERROR
/* Verify retries for extensive array data block */
- if(info.retries[15][0] != 0)
+ if (info.retries[15][0] != 0)
TEST_ERROR
- if(info.retries[15][1] != 1000)
+ if (info.retries[15][1] != 1000)
TEST_ERROR
/* Verify retries for file's superblock */
- if(info.retries[20][0] != 1)
+ if (info.retries[20][0] != 1)
TEST_ERROR
- if(info.retries[20][1] != 0)
+ if (info.retries[20][1] != 0)
TEST_ERROR
/* Free memory for info.retries */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ if (info.retries[i] != NULL)
H5free_memory(info.retries[i]);
}
@@ -1231,145 +1227,145 @@ test_metadata_read_retry_info(hid_t in_fapl)
*/
/* Object header: log retry 5 for 5 times */
- for(i = 0; i < 5; i++) {
- if(H5F_track_metadata_read_retries(f, H5AC_OHDR_ID, 5) < 0)
+ for (i = 0; i < 5; i++) {
+ if (H5F_track_metadata_read_retries(f, H5AC_OHDR_ID, 5) < 0)
TEST_ERROR
}
/* Extensive array data block: log retry 4 for 1 time */
- if(H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 4) < 0)
+ if (H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 4) < 0)
TEST_ERROR
/* Fixed array header : log retry 50 for 10000 times */
- for(i = 0; i < 10000; i++) {
- if(H5F_track_metadata_read_retries(f, H5AC_FARRAY_HDR_ID, 50) < 0)
+ for (i = 0; i < 10000; i++) {
+ if (H5F_track_metadata_read_retries(f, H5AC_FARRAY_HDR_ID, 50) < 0)
TEST_ERROR
}
/* File's superblock: log retry 1 for 1 more time */
- if(H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
+ if (H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
FAIL_STACK_ERROR
/* Retrieve the collection of metadata read retries */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/*
* Verify info has both previous + current retries information:
*/
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- switch(i) {
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ switch (i) {
case 0: /* Object header */
- if(info.retries[i][0] != 5)
+ if (info.retries[i][0] != 5)
TEST_ERROR
- if(info.retries[i][1] != 0)
+ if (info.retries[i][1] != 0)
TEST_ERROR
break;
case 4: /* v2 B-tree leaf node */
- if(info.retries[i][0] != 0)
+ if (info.retries[i][0] != 0)
TEST_ERROR
- if(info.retries[i][1] != 500)
+ if (info.retries[i][1] != 500)
TEST_ERROR
break;
case 15: /* Extensive array data block */
- if(info.retries[i][0] != 1)
+ if (info.retries[i][0] != 1)
TEST_ERROR
- if(info.retries[i][1] != 1000)
+ if (info.retries[i][1] != 1000)
TEST_ERROR
break;
case 17: /* Fixed array header */
- if(info.retries[i][0] != 0)
+ if (info.retries[i][0] != 0)
TEST_ERROR
- if(info.retries[i][1] != 10000)
+ if (info.retries[i][1] != 10000)
TEST_ERROR
break;
case 20: /* File's superblock */
- if(info.retries[i][0] != 2)
+ if (info.retries[i][0] != 2)
TEST_ERROR
- if(info.retries[i][1] != 0)
+ if (info.retries[i][1] != 0)
TEST_ERROR
break;
default:
- if(info.retries[i] != NULL)
+ if (info.retries[i] != NULL)
TEST_ERROR
break;
}
}
/* Free memory for info.retries */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
H5free_memory(info.retries[i]);
/* Closing */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Get a copy of the file access property list */
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
/* Set the number of metadata read attempts to 101 */
- if(H5Pset_metadata_read_attempts(new_fapl, 101) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 101) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if((f = (H5F_t *)H5VL_object(fid)) == NULL)
+ if ((f = (H5F_t *)H5VL_object(fid)) == NULL)
FAIL_STACK_ERROR
/* File's superblock: log retry 1 for 1 time */
- if(H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
+ if (H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
FAIL_STACK_ERROR
/* Retrieve the collection of metadata read retries */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 3 */
- if(info.nbins != 3)
+ if (info.nbins != 3)
TEST_ERROR
/* Verify retries info */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- switch(i) {
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ switch (i) {
case 20: /* File's superblock */
- if(info.retries[i][0] != 1)
+ if (info.retries[i][0] != 1)
TEST_ERROR
- if(info.retries[i][1] != 0)
+ if (info.retries[i][1] != 0)
TEST_ERROR
- if(info.retries[i][2] != 0)
+ if (info.retries[i][2] != 0)
TEST_ERROR
break;
default:
- if(info.retries[i] != NULL)
+ if (info.retries[i] != NULL)
TEST_ERROR
break;
}
}
/* Free memory */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
H5free_memory(info.retries[i]);
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1385,39 +1381,39 @@ test_metadata_read_retry_info(hid_t in_fapl)
* retries should all be NULL
*/
/* Open the file without SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Re-open fid */
- if((fid1 = H5Freopen(fid)) < 0)
+ if ((fid1 = H5Freopen(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve retries information for fid */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Retrieve retries information for fid1*/
- if(H5Fget_metadata_read_retry_info(fid1, &info1)< 0)
+ if (H5Fget_metadata_read_retry_info(fid1, &info1) < 0)
FAIL_STACK_ERROR
/* Should be 0 */
- if(info.nbins != 0)
+ if (info.nbins != 0)
TEST_ERROR
- if(info1.nbins != 0)
+ if (info1.nbins != 0)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ if (info.retries[i] != NULL)
TEST_ERROR
- if(info1.retries[i] != NULL)
+ if (info1.retries[i] != NULL)
TEST_ERROR
}
/* Closing */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
/*
@@ -1427,95 +1423,96 @@ test_metadata_read_retry_info(hid_t in_fapl)
* --increment retries for metadata item: free-space sections (retries[9][1])--
*/
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object for fid */
- if((f = (H5F_t *)H5VL_object(fid)) == NULL)
+ if ((f = (H5F_t *)H5VL_object(fid)) == NULL)
FAIL_STACK_ERROR
/* Re-open fid */
- if((fid1 = H5Freopen(fid)) < 0)
+ if ((fid1 = H5Freopen(fid)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object for fid1 */
- if((f1 = (H5F_t *)H5VL_object(fid1)) == NULL)
+ if ((f1 = (H5F_t *)H5VL_object(fid1)) == NULL)
FAIL_STACK_ERROR
/* For fid: fixed array data block page--log retry 9 for 500 times */
- for(i = 0; i < 500; i++) {
- if(H5F_track_metadata_read_retries(f, H5AC_FARRAY_DBLK_PAGE_ID, 9) < 0)
+ for (i = 0; i < 500; i++) {
+ if (H5F_track_metadata_read_retries(f, H5AC_FARRAY_DBLK_PAGE_ID, 9) < 0)
FAIL_STACK_ERROR
}
/* For fid1: free-space sections--log retry 99 for 1000 times */
- for(i = 0; i < 1000; i++) {
- if(H5F_track_metadata_read_retries(f1, H5AC_FSPACE_SINFO_ID, 99) < 0)
+ for (i = 0; i < 1000; i++) {
+ if (H5F_track_metadata_read_retries(f1, H5AC_FSPACE_SINFO_ID, 99) < 0)
FAIL_STACK_ERROR
}
/* Retrieve the collection of metadata read retries for fid */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Retrieve the collection of metadata read retries for fid1 */
- if(H5Fget_metadata_read_retry_info(fid1, &info1) < 0)
+ if (H5Fget_metadata_read_retry_info(fid1, &info1) < 0)
FAIL_STACK_ERROR
/* Verify nbins for fid & fid1: should be 2 */
- if(info.nbins != 2)
+ if (info.nbins != 2)
TEST_ERROR
- if(info1.nbins != 2)
+ if (info1.nbins != 2)
TEST_ERROR
/* Verify retries for fid: fixed array data block page */
- if(info.retries[19][0] != 500)
+ if (info.retries[19][0] != 500)
TEST_ERROR
- if(info.retries[19][1] != 0)
+ if (info.retries[19][1] != 0)
TEST_ERROR
/* Verify retries for fid: free-space sections */
/* (Since file was re-opened) */
- if(info.retries[9][0] != 0)
+ if (info.retries[9][0] != 0)
TEST_ERROR
- if(info.retries[9][1] != 1000)
+ if (info.retries[9][1] != 1000)
TEST_ERROR
/* Verify retries for fid1: free-space sections */
- if(info1.retries[9][0] != 0)
+ if (info1.retries[9][0] != 0)
TEST_ERROR
- if(info1.retries[9][1] != 1000)
+ if (info1.retries[9][1] != 1000)
TEST_ERROR
/* Verify retries for fid1: fixed array data block page */
/* (Since file was re-opened) */
- if(info1.retries[19][0] != 500)
+ if (info1.retries[19][0] != 500)
TEST_ERROR
- if(info1.retries[19][1] != 0)
+ if (info1.retries[19][1] != 0)
TEST_ERROR
/* Free memory for info.retries and info1.retries */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ if (info.retries[i] != NULL)
H5free_memory(info.retries[i]);
- if(info1.retries[i] != NULL)
+ if (info1.retries[i] != NULL)
H5free_memory(info1.retries[i]);
} /* end for */
/* Closing */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(new_fapl);
H5Dclose(did1);
@@ -1524,14 +1521,13 @@ error:
H5Pclose(dcpl);
H5Fclose(fid);
H5Fclose(fid1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_metadata_read_retry_info() */
-
-
/*
* Tests for H5Fstart_swmr_write()
*/
@@ -1567,39 +1563,39 @@ error:
static int
test_start_swmr_write(hid_t in_fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property */
- hid_t gid = -1; /* Group ID */
- hid_t dcpl = -1; /* Dataset creation property */
- hid_t file_fapl = -1; /* File access property for the file */
- hid_t did1 = -1, did2 = -1, did3 = -1; /* Dataset IDs */
- hid_t did1_a = -1, did1_b = -1;
- hid_t sid1 = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
- hsize_t dim[1] = {1}; /* Dimension sizes */
- hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dim[1] = {2}; /* Chunk dimension sizes */
- hsize_t dim2[2] = {5, 10}; /* Dimension sizes */
- hsize_t max_dim2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dim2[2] = {2, 7}; /* Chunk dimension sizes */
- H5D_chunk_index_t idx_type; /* Dataset chunk index type */
- int wdata = 99; /* Data to write */
- int rdata; /* Data read */
- unsigned attempts; /* The retrieved # of read attempts */
- char filename[NAME_BUF_SIZE]; /* File name */
- herr_t ret; /* Return value */
-
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property */
+ hid_t gid = -1; /* Group ID */
+ hid_t dcpl = -1; /* Dataset creation property */
+ hid_t file_fapl = -1; /* File access property for the file */
+ hid_t did1 = -1, did2 = -1, did3 = -1; /* Dataset IDs */
+ hid_t did1_a = -1, did1_b = -1;
+ hid_t sid1 = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
+ hsize_t dim[1] = {1}; /* Dimension sizes */
+ hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dim[1] = {2}; /* Chunk dimension sizes */
+ hsize_t dim2[2] = {5, 10}; /* Dimension sizes */
+ hsize_t max_dim2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dim2[2] = {2, 7}; /* Chunk dimension sizes */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ int wdata = 99; /* Data to write */
+ int rdata; /* Data read */
+ unsigned attempts; /* The retrieved # of read attempts */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ herr_t ret; /* Return value */
/* Get a copy of the parameter fapl (non-latest-format) */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
- if(new_format) {
+ if (new_format) {
TESTING("H5Fstart_swmr_write() when creating/opening a file with latest format");
- /* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- FAIL_STACK_ERROR
- } else {
+ /* Set to use the latest library format */
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
+ }
+ else {
TESTING("H5Fstart_swmr_write() when creating/opening a file without latest format");
} /* end if */
@@ -1611,89 +1607,91 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format)
*/
/* Create the file with SWMR write + non-latest-format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT,
+ fapl)) < 0)
FAIL_STACK_ERROR
/* Get the file's access_property list */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from the file's fapl */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
/* Should be 100 */
- if(attempts != (new_format ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS))
+ if (attempts != (new_format ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS))
TEST_ERROR;
/* Close the property list */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Create "dataset1" */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
FAIL_STACK_ERROR
- if((sid1 = H5Screate_simple(1, dim, max_dim)) < 0)
+ if ((sid1 = H5Screate_simple(1, dim, max_dim)) < 0)
FAIL_STACK_ERROR;
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(did1, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did1, &idx_type) < 0)
FAIL_STACK_ERROR;
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ if (idx_type != H5D_CHUNK_IDX_EARRAY)
FAIL_PUTS_ERROR("should be using extensible array as index");
/* Write to the dataset */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
FAIL_STACK_ERROR;
/* Should fail to enable SWMR for non-latest-format */
/* Should succeed in enabling SWMR for latest format */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(new_format) {
- if(ret < 0) TEST_ERROR
- } else if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (new_format) {
+ if (ret < 0)
+ TEST_ERROR
+ }
+ else if (ret >= 0)
TEST_ERROR
/* Read from the dataset */
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
FAIL_STACK_ERROR;
/* Verify the data is correct */
- if(wdata != rdata)
+ if (wdata != rdata)
TEST_ERROR
/* Close "dataset1", dataspace, dataset creation property list */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid1) < 0)
+ if (H5Sclose(sid1) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
/* Get the file's access_property list */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
/* Should be 100 */
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR;
/* Close the file access property list */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/*
@@ -1701,151 +1699,151 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format)
*/
/* Open the file again with write + non-latest-format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get the file's access_property list */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
/* Should be 1 */
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR;
/* Close the property list */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR;
/* open "dataset1", keep it open */
- if((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* open "dataset1" second time */
- if((did1_a = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
+ if ((did1_a = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* open "dataset1" third time */
- if((did1_b = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
+ if ((did1_b = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Write to "dataset1" */
wdata = 88;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
FAIL_STACK_ERROR;
/* Create a group */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create "dataset2" in the group, keep it open */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
FAIL_STACK_ERROR
- if((sid2 = H5Screate_simple(2, dim2, max_dim2)) < 0)
+ if ((sid2 = H5Screate_simple(2, dim2, max_dim2)) < 0)
FAIL_STACK_ERROR;
- if((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Get the chunk index type for "dataset2" */
- if(H5D__layout_idx_type_test(did2, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did2, &idx_type) < 0)
FAIL_STACK_ERROR;
- if(idx_type != H5D_CHUNK_IDX_BT2)
+ if (idx_type != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("should be using v2 B-tree chunk indexing");
/* Should succeed in enabling SWMR writing */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
FAIL_STACK_ERROR;
/* Get the file's access_property list */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
/* Should be 100 */
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR;
/* Close the property list */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR;
rdata = 0;
/* Read from "dataset1" via did1_b (multiple opens) */
- if(H5Dread(did1_b, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ if (H5Dread(did1_b, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
FAIL_STACK_ERROR;
- if(wdata != rdata)
+ if (wdata != rdata)
FAIL_STACK_ERROR;
- if(H5Dclose(did1_b) < 0)
+ if (H5Dclose(did1_b) < 0)
FAIL_STACK_ERROR;
/* Read from "dataset1" */
rdata = 0;
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
FAIL_STACK_ERROR;
- if(wdata != rdata)
+ if (wdata != rdata)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
rdata = 0;
/* Read from "dataset1" via did1_a (multiple opens) */
- if(H5Dread(did1_a, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ if (H5Dread(did1_a, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
FAIL_STACK_ERROR;
- if(wdata != rdata)
+ if (wdata != rdata)
FAIL_STACK_ERROR;
- if(H5Dclose(did1_a) < 0)
+ if (H5Dclose(did1_a) < 0)
FAIL_STACK_ERROR;
/* Close "dataset2", dataspace, dataset creation property list */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid2) < 0)
+ if (H5Sclose(sid2) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
/* Create "dataset3" */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
FAIL_STACK_ERROR
- if((sid3 = H5Screate_simple(2, dim2, max_dim2)) < 0)
+ if ((sid3 = H5Screate_simple(2, dim2, max_dim2)) < 0)
FAIL_STACK_ERROR;
- if((did3 = H5Dcreate2(fid, "dataset3", H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dcreate2(fid, "dataset3", H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Get the chunk index type for "dataset3" */
- if(H5D__layout_idx_type_test(did3, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did3, &idx_type) < 0)
FAIL_STACK_ERROR;
- if(idx_type != H5D_CHUNK_IDX_BT2)
+ if (idx_type != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("should be using v2 B-tree as index");
/* Close "dataset3", dataspace, dataset creation property list */
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid3) < 0)
+ if (H5Sclose(sid3) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
/* Close the group */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
FAIL_STACK_ERROR;
/* Close the file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -1853,7 +1851,8 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fapl);
H5Pclose(file_fapl);
@@ -1867,7 +1866,8 @@ error:
H5Sclose(sid1);
H5Sclose(sid2);
H5Sclose(sid3);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_start_swmr_write() */
@@ -1928,42 +1928,42 @@ error:
static int
test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t fid2 = -1; /* File ID */
- hid_t fapl = -1; /* A copy of file access property */
- hid_t new_fapl = -1; /* A copy of file access property */
- hid_t gid = -1; /* Group ID */
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t bad_fid = -1; /* Test fid (should never represent a real ID) */
- herr_t ret; /* Return value */
- char filename[NAME_BUF_SIZE]; /* File name */
+ hid_t fid = -1; /* File ID */
+ hid_t fid2 = -1; /* File ID */
+ hid_t fapl = -1; /* A copy of file access property */
+ hid_t new_fapl = -1; /* A copy of file access property */
+ hid_t gid = -1; /* Group ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t bad_fid = -1; /* Test fid (should never represent a real ID) */
+ herr_t ret; /* Return value */
+ char filename[NAME_BUF_SIZE]; /* File name */
/* Create a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
- if((new_fapl = H5Pcopy(in_fapl)) < 0)
+ if ((new_fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
- if(new_format) {
+ if (new_format) {
TESTING("H5Fstart_swmr_write() on failure conditions for latest format");
- if((fapl = H5Pcopy(new_fapl)) < 0)
- FAIL_STACK_ERROR
- } else {
+ if ((fapl = H5Pcopy(new_fapl)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else {
TESTING("H5Fstart_swmr_write() on failure conditions for without latest format");
}
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
-
/*
* (A) When creating a file:
*/
@@ -1971,65 +1971,62 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format)
/* Case 1 */
/* Create the file with SWMR_WRITE + with/without latest format */
- fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl);
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl);
/* Should fail to enable SWMR writing when the file is already in SWMR writing mode */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Case 2 */
- if(new_format) {
+ if (new_format) {
/* Create the file with write + latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create and commit a named datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
FAIL_STACK_ERROR;
- if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when there is an opened named datatype */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the datatype */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
-
- } else {
+ }
+ else {
/* Create a file with write + non-latest-format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
} /* end if */
@@ -2038,117 +2035,111 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format)
*/
/* Create a file with write + latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl)) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Case 1 */
/* Open the file with SWMR write + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when the file is already in SWMR writing mode */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Case 2 */
/* Open the file with read only access + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when the file is opened with read only access */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Case 3 */
/* Open the file file with SWMR read access + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when the file is opened with SWMR read access only */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Case 4 */
/* Open the file with write + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Create and commit a named datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
FAIL_STACK_ERROR;
- if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
/* Create dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
FAIL_STACK_ERROR;
/* Attach an attribute to the named datatype */
- if((aid = H5Acreate2(tid, "attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid, "attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when there are opened named datatype and attribute */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the datatype */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
/* Still fail to enable SWMR writing when the attribute is still opened */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR;
/* Close the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
-
/*
* (C) Failure cases for multiple opens
*/
@@ -2156,163 +2147,158 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format)
/* Case 1 */
/* Create a file with write + with/without latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT,
+ fapl)) < 0)
FAIL_STACK_ERROR;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Open the file with write + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Should fail for a second call to enable SWMR writing mode */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
-
/* Case 2 */
/* Open the file with write + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Re-open the same file */
- if((fid2 = H5Freopen(fid)) < 0)
+ if ((fid2 = H5Freopen(fid)) < 0)
FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing mode for fid2 */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid2);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid2); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the files */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR;
/* Case 3 */
/* Open the file with write + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Open the same file */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing for fid */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Should fail to enable SWMR writing for fid2 */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid2);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid2); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the files */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR;
- if(!new_format) {
+ if (!new_format) {
/*
* (D) When opening a file which is created without the latest format:
*/
- /* Create a file with write + without latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Create a file with write + without latest format */
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Case 1 */
- /* Should fail to open the file with SWMR write + latest format due to superblock version not at least 3 */
- H5E_BEGIN_TRY {
- bad_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, new_fapl);
- } H5E_END_TRY;
- if(bad_fid >= 0)
+ /* Should fail to open the file with SWMR write + latest format due to superblock version not at least
+ * 3 */
+ H5E_BEGIN_TRY { bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, new_fapl); }
+ H5E_END_TRY;
+ if (bad_fid >= 0)
TEST_ERROR
/* Case 2 */
- /* Should fail to open the file with SWMR write + non-latest-format due to superblock version not at least 3 */
- H5E_BEGIN_TRY {
- bad_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(bad_fid >= 0)
+ /* Should fail to open the file with SWMR write + non-latest-format due to superblock version not at
+ * least 3 */
+ H5E_BEGIN_TRY { bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (bad_fid >= 0)
TEST_ERROR
/* Case 3 */
/* Open the file with write + latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing due to superblock version not at least 3 */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
-
/* Case 4 */
/* Open the file with write + non-latest-format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
} /* not new */
/* Close the file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Gclose(gid);
H5Dclose(did);
@@ -2324,7 +2310,8 @@ error:
* It never needs to be closed in the normal case.
*/
H5Fclose(bad_fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_err_start_swmr_write() */
@@ -2364,81 +2351,83 @@ test_start_swmr_write_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t H5_ATTR_UNUSE
return 0;
} /* test_start_swmr_write_concur() */
-#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
+#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
static int
test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
{
- hid_t fid = -1, fid1 = -1, fid2 = -1; /* File IDs */
- hid_t fapl; /* File access property list */
- pid_t childpid=0; /* Child process ID */
- pid_t tmppid; /* Child process ID returned by waitpid */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int child_exit_val; /* Exit status of the child */
- char filename[NAME_BUF_SIZE]; /* File name */
-
- hid_t did = -1, did1 = -1, did2 = -1, did3 = -1;
- hid_t sid = -1;
- hid_t dcpl = -1;
+ hid_t fid = -1, fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t fapl; /* File access property list */
+ pid_t childpid = 0; /* Child process ID */
+ pid_t tmppid; /* Child process ID returned by waitpid */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int child_exit_val; /* Exit status of the child */
+ char filename[NAME_BUF_SIZE]; /* File name */
+
+ hid_t did = -1, did1 = -1, did2 = -1, did3 = -1;
+ hid_t sid = -1;
+ hid_t dcpl = -1;
hsize_t chunk_dims[1] = {1};
- hsize_t maxdims[1] = {H5S_UNLIMITED};
- hsize_t dims[1] = {1};
- int wdata = 0;
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ hsize_t dims[1] = {1};
+ int wdata = 0;
int out_pdf[2];
int in_pdf[2];
int notify = 0;
/* Output message about test being performed */
- if(new_format) {
+ if (new_format) {
TESTING("H5Fstart_swmr_write()--concurrent access for latest format");
- } else {
+ }
+ else {
TESTING("H5Fstart_swmr_write()--concurrent access for non-latest-format");
} /* end if */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if(new_format) {
+ if (new_format) {
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- } else {
+ }
+ else {
/* Create the test file without latest format but with SWMR write */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
} /* end if */
- /* Create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ /* Create a chunked dataset with 1 extendible dimension */
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/*
@@ -2448,67 +2437,70 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
*/
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ /* Close unused write end for out_pdf */
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Should fail */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* Open the test file */
- fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
+ fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl);
+ }
+ H5E_END_TRY;
+ if (fid >= 0)
HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* child process terminated abnormally */
+ }
+ else /* child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -2518,264 +2510,264 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
*/
/* Create 2 pipes */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
- if(HDpipe(in_pdf) < 0)
+ if (HDpipe(in_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid1 = -1, child_fid2; /* File IDs */
- hid_t child_did1 = -1, child_did2 = -1; /* Dataset IDs */
- int child_notify = 0;
- int rdata = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid1 = -1, child_fid2; /* File IDs */
+ hid_t child_did1 = -1, child_did2 = -1; /* Dataset IDs */
+ int child_notify = 0;
+ int rdata = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
- /* close unused read end for in_pdf */
- if(HDclose(in_pdf[0]) < 0)
+ /* close unused read end for in_pdf */
+ if (HDclose(in_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Should succeed in opening the test file 2 times */
- if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
HDexit(EXIT_FAILURE);
- if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
HDexit(EXIT_FAILURE);
- /* open "dataset" 2 times */
- if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0)
+ /* open "dataset" 2 times */
+ if ((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0)
HDexit(EXIT_FAILURE);
- if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0)
HDexit(EXIT_FAILURE);
- /* Read from "dataset" via child_did1 */
- rdata = 0;
- if(H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ /* Read from "dataset" via child_did1 */
+ rdata = 0;
+ if (H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
HDexit(EXIT_FAILURE);
- if(rdata != 88)
+ if (rdata != 88)
HDexit(EXIT_FAILURE);
- /* Notify parent process */
+ /* Notify parent process */
child_notify = 2;
- if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0)
- HDexit(EXIT_FAILURE);
+ if (HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0)
+ HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 3) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 3) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
- /* Refresh "dataset" via child_did2 */
- if(H5Drefresh(child_did2) < 0)
+ /* Refresh "dataset" via child_did2 */
+ if (H5Drefresh(child_did2) < 0)
HDexit(EXIT_FAILURE);
- /* Read from "dataset" child_did2 */
- rdata = 0;
- if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ /* Read from "dataset" child_did2 */
+ rdata = 0;
+ if (H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
HDexit(EXIT_FAILURE);
- if(rdata != 99)
+ if (rdata != 99)
HDexit(EXIT_FAILURE);
- /* Read from "dataset" child_did1 */
- rdata = 0;
- if(H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ /* Read from "dataset" child_did1 */
+ rdata = 0;
+ if (H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
HDexit(EXIT_FAILURE);
- if(rdata != 99)
+ if (rdata != 99)
HDexit(EXIT_FAILURE);
- /* Close the dataset */
- if(H5Dclose(child_did1))
+ /* Close the dataset */
+ if (H5Dclose(child_did1))
HDexit(EXIT_FAILURE);
- if(H5Dclose(child_did2))
+ if (H5Dclose(child_did2))
HDexit(EXIT_FAILURE);
- /* Close the file */
- if(H5Fclose(child_fid1) < 0)
+ /* Close the file */
+ if (H5Fclose(child_fid1) < 0)
HDexit(EXIT_FAILURE);
- if(H5Fclose(child_fid2) < 0)
+ if (H5Fclose(child_fid2) < 0)
HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
- if(HDclose(in_pdf[1]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
+ if (HDclose(in_pdf[1]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Close unused write end for in_pdf */
- if(HDclose(in_pdf[1]) < 0)
+ if (HDclose(in_pdf[1]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* open "dataset", keep it open */
- if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((did3 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- /* Write to "dataset" */
+ /* Write to "dataset" */
wdata = 88;
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
FAIL_STACK_ERROR;
/* Flush to disk */
- if(H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0)
FAIL_STACK_ERROR;
/* Enable SWMR writing mode */
- if(H5Fstart_swmr_write(fid1) < 0)
+ if (H5Fstart_swmr_write(fid1) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Wait for notification from child process */
- while(notify != 2) {
- if(HDread(in_pdf[0], &notify, sizeof(int)) < 0)
+ while (notify != 2) {
+ if (HDread(in_pdf[0], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
}
- /* Write to "dataset" */
+ /* Write to "dataset" */
wdata = 99;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
FAIL_STACK_ERROR;
/* Flush to disk */
- if(H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0)
FAIL_STACK_ERROR;
/* Notify child process */
notify = 3;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the dataset */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR
/* Close the pipes */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
- if(HDclose(in_pdf[0]) < 0)
+ if (HDclose(in_pdf[0]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
-
/*
* Case (3):
* Verify concurrent file open with H5F_ACC_RDONLY
* will fail with H5Fstart_swmr_write()
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ /* Close unused write end for out_pdf */
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Should fail in opening the test file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
} /* end if */
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Enable SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -2785,74 +2777,74 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ /* Close unused write end for out_pdf */
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Should fail in opening the test file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
} /* end if */
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Enable SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -2862,90 +2854,92 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ /* Close unused write end for out_pdf */
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Should fail in opening the test file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Enable SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Pclose(dcpl);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
@@ -2962,20 +2956,20 @@ error:
static int
test_start_swmr_write_stress_ohdr(hid_t in_fapl)
{
- hid_t fid = -1; /* File IDs */
- hid_t fapl; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* File name */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t aid = -1; /* Attribute ID */
- hsize_t chunk_dims[2] = {10, 10};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- char fill[256]; /* Fill value for dataset */
- char attr_data[32]; /* Data value for attribute */
- hsize_t dims[2] = {1,1};
- unsigned chunk_num; /* Object header chunk # for dataspace message */
+ hid_t fid = -1; /* File IDs */
+ hid_t fapl; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t aid = -1; /* Attribute ID */
+ hsize_t chunk_dims[2] = {10, 10};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ char fill[256]; /* Fill value for dataset */
+ char attr_data[32]; /* Data value for attribute */
+ hsize_t dims[2] = {1, 1};
+ unsigned chunk_num; /* Object header chunk # for dataspace message */
/* Output message about test being performed */
TESTING("H5Fstart_swmr_write()--stress object header messages");
@@ -2984,122 +2978,123 @@ test_start_swmr_write_stress_ohdr(hid_t in_fapl)
HDmemset(fill, 0, sizeof(fill));
HDmemset(attr_data, 0, sizeof(attr_data));
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Tcopy(H5T_C_S1)) < 0)
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
FAIL_STACK_ERROR;
- if(H5Tset_size(tid, 256) < 0)
+ if (H5Tset_size(tid, 256) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_fill_value(dcpl, tid, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, tid, &fill) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, "dataset", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dataset", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Retrieve the chunk # for the dataspace message */
chunk_num = UINT_MAX;
- if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0)
+ if (H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0)
FAIL_STACK_ERROR;
/* Should be in chunk #0 for now */
- if(0 != chunk_num)
+ if (0 != chunk_num)
TEST_ERROR;
/* Create a second chunked dataset with 2 extendible dimensions */
/* (So that the original dataset's object header can't be extended) */
- if((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Tcopy(H5T_C_S1)) < 0)
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
FAIL_STACK_ERROR;
- if(H5Tset_size(tid, 256) < 0)
+ if (H5Tset_size(tid, 256) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_fill_value(dcpl, tid, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, tid, &fill) < 0)
FAIL_STACK_ERROR;
- if((did2 = H5Dcreate2(fid, "dataset2", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, "dataset2", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Close the second dataset */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
/* Close the objects for the dataset creation */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
/* Create attribute on original dataset, to push dataspace header message out of header chunk #0 */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Tcopy(H5T_C_S1)) < 0)
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
FAIL_STACK_ERROR;
- if(H5Tset_size(tid, 32) < 0)
+ if (H5Tset_size(tid, 32) < 0)
FAIL_STACK_ERROR;
- if(H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0)
+ if (H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0)
FAIL_STACK_ERROR;
- if((aid = H5Acreate2(did, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Awrite(aid, tid, attr_data) < 0)
+ if (H5Awrite(aid, tid, attr_data) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
FAIL_STACK_ERROR
/* Retrieve the chunk # for the dataspace message */
chunk_num = UINT_MAX;
- if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0)
+ if (H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0)
FAIL_STACK_ERROR;
/* Should be in chunk #0 for now */
- if(1 != chunk_num)
+ if (1 != chunk_num)
TEST_ERROR;
/* Enable SWMR write */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
FAIL_STACK_ERROR;
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the FAPL */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(aid);
H5Sclose(tid);
H5Sclose(sid);
@@ -3108,7 +3103,8 @@ error:
H5Pclose(dcpl);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_start_swmr_write_stress_ohdr() */
@@ -3121,7 +3117,7 @@ error:
static herr_t
flush_cb(hid_t H5_ATTR_UNUSED obj_id, void *_udata)
{
- unsigned *flush_ct = (unsigned*)_udata;
+ unsigned *flush_ct = (unsigned *)_udata;
++(*flush_ct);
return 0;
}
@@ -3145,20 +3141,20 @@ flush_cb(hid_t H5_ATTR_UNUSED obj_id, void *_udata)
static int
test_object_flush_cb(hid_t in_fapl)
{
- hid_t fapl = -1; /* A copy of file access property list */
- hid_t ffapl = -1; /* A file's file access property list */
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t did1 = -1, did2 = -1; /* Dataset IDs */
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dims[2] = {5, 10}; /* Dataset dimension sizes */
- int buf[50]; /* Data buffer */
- H5F_flush_cb_t ret_cb; /* The callback function set in object flush property */
- void *ret_ct; /* The user data set in object flush property */
- unsigned flush_ct = 0; /* The user data for object flush property */
- char filename[NAME_BUF_SIZE]; /* File name */
- int i; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fapl = -1; /* A copy of file access property list */
+ hid_t ffapl = -1; /* A file's file access property list */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t did1 = -1, did2 = -1; /* Dataset IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dims[2] = {5, 10}; /* Dataset dimension sizes */
+ int buf[50]; /* Data buffer */
+ H5F_flush_cb_t ret_cb; /* The callback function set in object flush property */
+ void * ret_ct; /* The user data set in object flush property */
+ unsigned flush_ct = 0; /* The user data for object flush property */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ int i; /* Local index variable */
+ herr_t ret; /* Generic return value */
TESTING("H5Pget/set_obj_flush_cb()");
@@ -3167,10 +3163,9 @@ test_object_flush_cb(hid_t in_fapl)
* To verify the failure condition in setting object flush property
*/
/* Should fail if the callback function is not defined but user data is defined */
- H5E_BEGIN_TRY {
- ret = H5Pset_object_flush_cb(fapl, NULL, &flush_ct);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_object_flush_cb(fapl, NULL, &flush_ct); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/*
@@ -3180,14 +3175,14 @@ test_object_flush_cb(hid_t in_fapl)
*/
/* Create a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Retrieve object flush property values for the default file access property list */
- if(H5Pget_object_flush_cb(fapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(fapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Should be null */
- if(ret_cb != NULL || ret_ct != NULL)
+ if (ret_cb != NULL || ret_ct != NULL)
TEST_ERROR
/*
@@ -3196,22 +3191,22 @@ test_object_flush_cb(hid_t in_fapl)
* non-default file access property list.
*/
/* Set the object flush property */
- if(H5Pset_object_flush_cb(fapl, flush_cb, &flush_ct) < 0)
+ if (H5Pset_object_flush_cb(fapl, flush_cb, &flush_ct) < 0)
TEST_ERROR
/* Increment the counter */
++flush_ct;
/* Retrieve object flush property values for the non-default file access property list */
- if(H5Pget_object_flush_cb(fapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(fapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != flush_cb || *(unsigned *)ret_ct != 1)
+ if (ret_cb != flush_cb || *(unsigned *)ret_ct != 1)
TEST_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
/*
@@ -3222,40 +3217,40 @@ test_object_flush_cb(hid_t in_fapl)
/* Reset values */
flush_ct = 0;
- ret_cb = NULL;
- ret_ct = NULL;
+ ret_cb = NULL;
+ ret_ct = NULL;
/* Make a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the test file: without setting object flush property in fapl */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Retrieve the object flush property values */
- if(H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != NULL || ret_ct != NULL)
+ if (ret_cb != NULL || ret_ct != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/*
@@ -3267,95 +3262,95 @@ test_object_flush_cb(hid_t in_fapl)
*/
/* Reset values */
flush_ct = 0;
- ret_cb = NULL;
- ret_ct = NULL;
+ ret_cb = NULL;
+ ret_ct = NULL;
/* Set the object flush property */
- if(H5Pset_object_flush_cb(fapl, flush_cb, &flush_ct) < 0)
+ if (H5Pset_object_flush_cb(fapl, flush_cb, &flush_ct) < 0)
FAIL_STACK_ERROR
/* Open the test file: with object flush property setting in fapl */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Create a dataset */
- if((sid = H5Screate_simple(2, dims, dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, dims)) < 0)
FAIL_STACK_ERROR;
/* Create a dataset */
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize data buffer */
- for(i = 0; i < 50; i++)
- buf[i] = i + 1;
+ for (i = 0; i < 50; i++)
+ buf[i] = i + 1;
/* Write to the dataset */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
FAIL_STACK_ERROR;
/* Flush the dataset object */
- if(H5Oflush(did1) < 0)
+ if (H5Oflush(did1) < 0)
FAIL_STACK_ERROR;
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Retrieve the object flush property values */
- if(H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != flush_cb || *(unsigned *)ret_ct != 1)
+ if (ret_cb != flush_cb || *(unsigned *)ret_ct != 1)
TEST_ERROR
/* Create a group */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Flush the group */
- if(H5Gflush(gid) < 0)
+ if (H5Gflush(gid) < 0)
TEST_ERROR
/* Retrieve the object flush property values */
- if(H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != flush_cb || *(unsigned *)ret_ct != 2)
+ if (ret_cb != flush_cb || *(unsigned *)ret_ct != 2)
TEST_ERROR
/* Create a dataset */
- if((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Flush the dataset */
- if(H5Dflush(did2) < 0)
+ if (H5Dflush(did2) < 0)
FAIL_STACK_ERROR;
/* Retrieve the object flush property values */
- if(H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != flush_cb || *(unsigned *)ret_ct != 3)
+ if (ret_cb != flush_cb || *(unsigned *)ret_ct != 3)
TEST_ERROR
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -3363,7 +3358,8 @@ test_object_flush_cb(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(ffapl);
H5Sclose(sid);
@@ -3371,7 +3367,8 @@ error:
H5Dclose(did2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_object_flush_cb() */
@@ -3380,7 +3377,6 @@ error:
* Tests for H5Pset/get_append_flush()
*/
-
/* The callback function for append flush property */
static herr_t
append_cb(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void *_udata)
@@ -3390,7 +3386,6 @@ append_cb(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void *
return 0;
} /* append_cb() */
-
/* The callback function for append flush property */
static herr_t
append_cb2(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void *_udata)
@@ -3400,8 +3395,6 @@ append_cb2(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void
return 0;
} /* append_cb2() */
-
-
/*
* test_append_flush_generic()
*
@@ -3423,17 +3416,16 @@ append_cb2(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void
static int
test_append_flush_generic(void)
{
- hid_t dapl = -1; /* A copy of dataset access property */
- hsize_t boundary[3]; /* The boundary for append flush property */
- unsigned count = 0; /* The user data for append flush property */
- hsize_t ret_boundary[3]; /* The boundary set in append flush property */
- H5D_append_cb_t ret_cb; /* The callback function set in append flush property */
- unsigned *ret_count; /* The user data set in append flush property */
- herr_t ret; /* The return value */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hsize_t boundary[3]; /* The boundary for append flush property */
+ unsigned count = 0; /* The user data for append flush property */
+ hsize_t ret_boundary[3]; /* The boundary set in append flush property */
+ H5D_append_cb_t ret_cb; /* The callback function set in append flush property */
+ unsigned * ret_count; /* The user data set in append flush property */
+ herr_t ret; /* The return value */
TESTING("H5Fget/set_append_flush() for a generic dataset access property list");
-
/*
* Case (1)
* To verify the retrieved append flush property values:
@@ -3441,21 +3433,21 @@ test_append_flush_generic(void)
*/
/* Create a copy of dataset access property list */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(dapl, 2, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(dapl, 2, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
FAIL_STACK_ERROR
/* Verify expected values */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0)
TEST_ERROR;
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
/* Close the property list */
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
/*
@@ -3468,28 +3460,25 @@ test_append_flush_generic(void)
*/
/* Create a copy of dataset access property list */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Invalid dataset rank: zero value */
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 0, NULL, NULL, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 0, NULL, NULL, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Invalid dataset rank: > H5S_MAX_RANK */
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, H5S_MAX_RANK+1, NULL, NULL, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, H5S_MAX_RANK + 1, NULL, NULL, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* No boundary specified */
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 2, NULL, NULL, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, NULL, NULL, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Set up a valid boundary */
@@ -3497,28 +3486,25 @@ test_append_flush_generic(void)
boundary[1] = 1;
/* Undefined callback function but defined user data */
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 2, boundary, NULL, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, boundary, NULL, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Invalid boundary size: negative value */
boundary[0] = (hsize_t)-1;
boundary[1] = 1;
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Invalid boundary size: H5S_UNLIMITED */
boundary[0] = 1;
boundary[1] = H5S_UNLIMITED;
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/*
@@ -3529,29 +3515,29 @@ test_append_flush_generic(void)
* -- the # of boundary sizes retrieved does not exceed MIN(input ndims, the ndims set)
*/
boundary[0] = boundary[1] = 1;
- boundary[2] = 0;
- count = 1;
- if(H5Pset_append_flush(dapl, 2, boundary, append_cb, &count) < 0)
+ boundary[2] = 0;
+ count = 1;
+ if (H5Pset_append_flush(dapl, 2, boundary, append_cb, &count) < 0)
FAIL_STACK_ERROR;
++count;
/* Verify expected values: with boundary rank > set boundary rank */
- if(H5Pget_append_flush(dapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(dapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
- if(ret_boundary[0] != 1 || ret_boundary[1] != 1 || boundary[2] != 0)
+ if (ret_boundary[0] != 1 || ret_boundary[1] != 1 || boundary[2] != 0)
TEST_ERROR;
- if(ret_cb == NULL || ret_count == NULL || *ret_count != 2)
+ if (ret_cb == NULL || ret_count == NULL || *ret_count != 2)
TEST_ERROR
/* Verify expected values: with boundary rank < set boundary rank */
HDmemset(ret_boundary, 0, sizeof(ret_boundary));
- if(H5Pget_append_flush(dapl, 1, ret_boundary, NULL, NULL) < 0)
+ if (H5Pget_append_flush(dapl, 1, ret_boundary, NULL, NULL) < 0)
TEST_ERROR
- if(ret_boundary[0] != 1 || ret_boundary[1] != 0 || boundary[2] != 0)
+ if (ret_boundary[0] != 1 || ret_boundary[1] != 0 || boundary[2] != 0)
TEST_ERROR;
/* Closing */
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -3559,9 +3545,8 @@ test_append_flush_generic(void)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(dapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(dapl); }
+ H5E_END_TRY;
return -1;
} /* test_append_flush_generic() */
@@ -3585,26 +3570,26 @@ error:
static int
test_append_flush_dataset_chunked(hid_t in_fapl)
{
- hid_t fid = -1; /* file ID */
+ hid_t fid = -1; /* file ID */
hid_t fapl = -1; /* A copy of file access property */
- hid_t did1 = -1, did2 = -1; /* The datset ID */
- hid_t sid = -1; /* The dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t did1 = -1, did2 = -1; /* The datset ID */
+ hid_t sid = -1; /* The dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
hid_t ddapl = -1; /* The dataset access property of the opened dataset */
- hsize_t boundary[3]; /* Boundary size */
- unsigned count = 0; /* User data */
+ hsize_t boundary[3]; /* Boundary size */
+ unsigned count = 0; /* User data */
- hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
- H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
- unsigned *ret_count; /* The user data set in the append flush property */
+ hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
+ H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
+ unsigned * ret_count; /* The user data set in the append flush property */
- char filename[NAME_BUF_SIZE]; /* file name */
+ char filename[NAME_BUF_SIZE]; /* file name */
- hsize_t dims[2] = {100, 0}; /* The dataset dimension sizes */
- hsize_t maxdims[2] = {100, H5S_UNLIMITED}; /* The dataset maximum dimension sizes */
- hsize_t chunk_dims[2] = {5,2}; /* The chunk dimesion sizes */
+ hsize_t dims[2] = {100, 0}; /* The dataset dimension sizes */
+ hsize_t maxdims[2] = {100, H5S_UNLIMITED}; /* The dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {5, 2}; /* The chunk dimesion sizes */
TESTING("H5Fget/set_append_flush() for a chunked dataset's access property list");
@@ -3617,47 +3602,46 @@ test_append_flush_dataset_chunked(hid_t in_fapl)
*/
/* Get a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
-
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the test file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did1)) < 0)
+ if ((ddapl = H5Dget_access_plist(did1)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
/* Close the dataset's access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
/*
@@ -3670,44 +3654,41 @@ test_append_flush_dataset_chunked(hid_t in_fapl)
* -- boundary (non-zero) is set for a non-extendible dimension
*/
/* Create a copy of dataset access property list */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Set boundary dimension rank > the rank of dataset to be created */
HDmemset(boundary, 0, sizeof(boundary));
- if(H5Pset_append_flush(dapl, 3, boundary, NULL, NULL) < 0)
+ if (H5Pset_append_flush(dapl, 3, boundary, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Should fail to Create the dataset */
- H5E_BEGIN_TRY {
- did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl);
- } H5E_END_TRY;
- if(did2 >= 0)
+ H5E_BEGIN_TRY { did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); }
+ H5E_END_TRY;
+ if (did2 >= 0)
TEST_ERROR
/* Set boundary for a non-extendible dimension */
boundary[0] = boundary[1] = 1;
- if(H5Pset_append_flush(dapl, 2, boundary, NULL, NULL) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Should fail to create the dataset */
- H5E_BEGIN_TRY {
- did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl);
- } H5E_END_TRY;
- if(did2 >= 0)
+ H5E_BEGIN_TRY { did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); }
+ H5E_END_TRY;
+ if (did2 >= 0)
TEST_ERROR
/* Create and close the dataset */
- if((did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
/* Should fail to open the dataset */
- H5E_BEGIN_TRY {
- did2 = H5Dopen2(fid, "dataset2", dapl);
- } H5E_END_TRY;
- if(did2 >= 0)
+ H5E_BEGIN_TRY { did2 = H5Dopen2(fid, "dataset2", dapl); }
+ H5E_END_TRY;
+ if (did2 >= 0)
TEST_ERROR
/*
@@ -3721,52 +3702,52 @@ test_append_flush_dataset_chunked(hid_t in_fapl)
boundary[0] = 0;
boundary[1] = 1;
- if(H5Pset_append_flush(dapl, 2, boundary, append_cb, &count) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, append_cb, &count) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
FAIL_STACK_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
HDmemset(ret_boundary, 0, sizeof(ret_boundary));
- ret_cb = NULL;
+ ret_cb = NULL;
ret_count = NULL;
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != append_cb || ret_count != &count)
+ if (ret_cb != append_cb || ret_count != &count)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
TEST_ERROR
HDmemset(ret_boundary, 0, sizeof(ret_boundary));
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 1, ret_boundary, NULL, NULL) < 0)
+ if (H5Pget_append_flush(ddapl, 1, ret_boundary, NULL, NULL) < 0)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR
/* Closing */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -3774,7 +3755,8 @@ test_append_flush_dataset_chunked(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(dapl);
H5Pclose(ddapl);
@@ -3783,7 +3765,8 @@ error:
H5Pclose(fapl);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_append_flush_dataset_chunked() */
@@ -3801,21 +3784,21 @@ error:
static int
test_append_flush_dataset_fixed(hid_t in_fapl)
{
- hid_t fid = -1; /* file ID */
+ hid_t fid = -1; /* file ID */
hid_t fapl = -1; /* A copy of file access property */
- hid_t did1 = -1, did2 = -1; /* The datset ID */
- hid_t sid = -1; /* The dataspace ID */
- hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t did1 = -1, did2 = -1; /* The datset ID */
+ hid_t sid = -1; /* The dataspace ID */
+ hid_t dapl = -1; /* A copy of dataset access property */
hid_t ddapl = -1; /* The dataset access property of the opened dataset */
- hsize_t boundary[3]; /* Boundary size */
- unsigned count = 0; /* User data */
+ hsize_t boundary[3]; /* Boundary size */
+ unsigned count = 0; /* User data */
- hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
- H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
- unsigned *ret_count; /* The user data set in the append flush property */
+ hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
+ H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
+ unsigned * ret_count; /* The user data set in the append flush property */
- char filename[NAME_BUF_SIZE]; /* file name */
+ char filename[NAME_BUF_SIZE]; /* file name */
hsize_t dims[1] = {100};
@@ -3830,43 +3813,42 @@ test_append_flush_dataset_fixed(hid_t in_fapl)
*/
/* Get a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
-
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the test file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a dataset */
- if((sid = H5Screate_simple(1, dims, dims)) < 0)
+ if ((sid = H5Screate_simple(1, dims, dims)) < 0)
FAIL_STACK_ERROR;
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did1)) < 0)
+ if ((ddapl = H5Dget_access_plist(did1)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
/* Close the dataset's access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
/*
@@ -3880,57 +3862,57 @@ test_append_flush_dataset_fixed(hid_t in_fapl)
* zero boundary, null callback function, null user data
*/
/* Create a copy of dataset access property list */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
boundary[0] = 1;
boundary[1] = boundary[2] = 0;
- if(H5Pset_append_flush(dapl, 3, boundary, append_cb, &count) < 0)
+ if (H5Pset_append_flush(dapl, 3, boundary, append_cb, &count) < 0)
FAIL_STACK_ERROR
/* Should succeed to create the dataset: append flush property has no effect */
- if((did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, dapl)) < 0)
+ if ((did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, dapl)) < 0)
TEST_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR
/* Closing */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
/* Should succeed in opening the dataset: append flush property has no effect */
- if((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
TEST_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
/*
* Case (3)--
@@ -3941,39 +3923,39 @@ test_append_flush_dataset_fixed(hid_t in_fapl)
*/
HDmemset(boundary, 0, sizeof(boundary));
- if(H5Pset_append_flush(dapl, 1, boundary, append_cb, &count) < 0)
+ if (H5Pset_append_flush(dapl, 1, boundary, append_cb, &count) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
FAIL_STACK_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 1, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 1, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR
/* Closing */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -3981,7 +3963,8 @@ test_append_flush_dataset_fixed(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dapl);
H5Pclose(ddapl);
H5Dclose(did1);
@@ -3989,7 +3972,8 @@ error:
H5Pclose(fapl);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_append_flush_dataset_fixed() */
@@ -4018,29 +4002,29 @@ error:
static int
test_append_flush_dataset_multiple(hid_t in_fapl)
{
- hid_t fid = -1; /* file ID */
+ hid_t fid = -1; /* file ID */
hid_t fapl = -1; /* A copy of file access property */
- hid_t did1 = -1, did2 = -1; /* The datset ID */
- hid_t sid = -1; /* The dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t did1 = -1, did2 = -1; /* The datset ID */
+ hid_t sid = -1; /* The dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
hid_t dapl1 = -1; /* A copy of dataset access property */
hid_t dapl2 = -1; /* A copy of dataset access property */
hid_t ddapl = -1; /* The dataset access property of the opened dataset */
- hsize_t boundary1[3]; /* Boundary size */
- hsize_t boundary2[3]; /* Boundary size */
- unsigned count1 = 0; /* User data */
- unsigned count2 = 0; /* User data */
+ hsize_t boundary1[3]; /* Boundary size */
+ hsize_t boundary2[3]; /* Boundary size */
+ unsigned count1 = 0; /* User data */
+ unsigned count2 = 0; /* User data */
- hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
- H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
- unsigned *ret_count; /* The user data set in the append flush property */
+ hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
+ H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
+ unsigned * ret_count; /* The user data set in the append flush property */
- char filename[NAME_BUF_SIZE]; /* file name */
+ char filename[NAME_BUF_SIZE]; /* file name */
- hsize_t dims[2] = {0, 0}; /* The dataset dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* The dataset maximum dimension sizes */
- hsize_t chunk_dims[2] = {5,2}; /* The chunk dimesion sizes */
+ hsize_t dims[2] = {0, 0}; /* The dataset dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* The dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {5, 2}; /* The chunk dimesion sizes */
TESTING("H5Fget/set_append_flush() for multiple opens of a chunked dataset");
@@ -4055,85 +4039,85 @@ test_append_flush_dataset_multiple(hid_t in_fapl)
*/
/* Create a copy of dataset access property list */
- if((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
- if((dapl2 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl2 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
boundary1[0] = 0;
boundary1[1] = 1;
- count1 = 0;
- if(H5Pset_append_flush(dapl1, 2, boundary1, append_cb, &count1) < 0)
+ count1 = 0;
+ if (H5Pset_append_flush(dapl1, 2, boundary1, append_cb, &count1) < 0)
FAIL_STACK_ERROR
boundary2[0] = 1;
boundary2[1] = 0;
- count2 = 0;
- if(H5Pset_append_flush(dapl2, 2, boundary2, append_cb2, &count2) < 0)
+ count2 = 0;
+ if (H5Pset_append_flush(dapl2, 2, boundary2, append_cb2, &count2) < 0)
FAIL_STACK_ERROR
/* Get a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the test file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl1)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl1)) < 0)
FAIL_STACK_ERROR;
/* Open the dataset */
- if((did2 = H5Dopen2(fid, "dataset1", dapl2)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset1", dapl2)) < 0)
FAIL_STACK_ERROR;
/* Get the dataset's access property list for did1 */
- if((ddapl = H5Dget_access_plist(did1)) < 0)
+ if ((ddapl = H5Dget_access_plist(did1)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values: should be the setting in dapl1 */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != append_cb || ret_count != &count1)
+ if (ret_cb != append_cb || ret_count != &count1)
TEST_ERROR
/* Close the dataset's access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
/* Get the dataset's access property list for did2 */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values: should be the setting in dapl1 */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != append_cb || ret_count != &count1)
+ if (ret_cb != append_cb || ret_count != &count1)
TEST_ERROR
/* Close the dataset's access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
H5Dclose(did1);
H5Dclose(did2);
@@ -4149,70 +4133,69 @@ test_append_flush_dataset_multiple(hid_t in_fapl)
* H5Pget_append_flush(did2, ...)
* -- should return append flush property values set in dapl1
*/
- if((did1 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
/* Open the dataset with append flush setting in dapl2 */
- if((did1 = H5Dopen2(fid, "dataset2", dapl2)) < 0)
+ if ((did1 = H5Dopen2(fid, "dataset2", dapl2)) < 0)
FAIL_STACK_ERROR;
/* Open the dataset with append flush setting in dapl1 */
- if((did2 = H5Dopen2(fid, "dataset2", dapl1)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset2", dapl1)) < 0)
FAIL_STACK_ERROR;
/* Get the dataset's access property list for did1 */
- if((ddapl = H5Dget_access_plist(did1)) < 0)
+ if ((ddapl = H5Dget_access_plist(did1)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values: should be the setting in dapl2 */
- if(ret_boundary[0] != 1 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 1 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != append_cb2 || ret_count != &count2)
+ if (ret_cb != append_cb2 || ret_count != &count2)
TEST_ERROR
/* Close the access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
-
/* Get the dataset's access property list for did2 */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values: should be the setting in dapl2 */
- if(ret_boundary[0] != 1 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 1 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != append_cb2 || ret_count != &count2)
+ if (ret_cb != append_cb2 || ret_count != &count2)
TEST_ERROR
/* Closing */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl2) < 0)
+ if (H5Pclose(dapl2) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl1) < 0)
+ if (H5Pclose(dapl1) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -4220,7 +4203,8 @@ test_append_flush_dataset_multiple(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(dapl1);
H5Pclose(dapl2);
@@ -4230,13 +4214,12 @@ error:
H5Pclose(fapl);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_append_flush_dataset_multiple() */
-
-
/****************************************************************
**
** test_file_lock_same():
@@ -4248,18 +4231,18 @@ error:
static int
test_file_lock_same(hid_t in_fapl)
{
- hid_t fid = -1, fid2 = -1; /* File IDs */
- hid_t fapl = -1; /* File access property list */
- unsigned intent; /* File access flags */
- char filename[NAME_BUF_SIZE]; /* file name */
+ hid_t fid = -1, fid2 = -1; /* File IDs */
+ hid_t fapl = -1; /* File access property list */
+ unsigned intent; /* File access flags */
+ char filename[NAME_BUF_SIZE]; /* file name */
/* Output message about test being performed */
TESTING("File open with different combinations of flags--single process access");
/* Set locking in the fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_file_locking(fapl, TRUE, TRUE) < 0)
+ if (H5Pset_file_locking(fapl, TRUE, TRUE) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
@@ -4269,122 +4252,121 @@ test_file_lock_same(hid_t in_fapl)
* Case 1: 1) RDWR 2) RDWR : should succeed
*/
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check file intent */
- if(H5Fget_intent(fid, &intent) < 0)
- FAIL_STACK_ERROR
+ if (H5Fget_intent(fid, &intent) < 0)
+ FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDWR)
- TEST_ERROR
+ if (intent != H5F_ACC_RDWR)
+ TEST_ERROR
/* Open the same file with RDWR */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid2, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDWR)
- TEST_ERROR
+ if (H5Fget_intent(fid2, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDWR)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
/*
* Case 2: 1) RDWR 2) RDONLY : should succeed
*/
/* Open file with RDWR */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDWR)
- TEST_ERROR
+ if (H5Fget_intent(fid, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDWR)
+ TEST_ERROR
/* Open file with RDONLY */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent: should get intent from 1st open */
- if(H5Fget_intent(fid2, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDWR)
- TEST_ERROR
+ if (H5Fget_intent(fid2, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDWR)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
/*
* Case 3: 1) RDONLY 2) RDWR : should fail
*/
/* Open file with RDONLY */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDONLY)
- TEST_ERROR
+ if (H5Fget_intent(fid, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDONLY)
+ TEST_ERROR
/* Open file with RDWR should fail */
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/*
* Case 4: 1) RDONLY 2) RDONLY : should succeed
*/
/* Open file with RDONLY */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDONLY)
- TEST_ERROR
+ if (H5Fget_intent(fid, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDONLY)
+ TEST_ERROR
/* Open file with RDONLY */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid2, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDONLY)
- TEST_ERROR
+ if (H5Fget_intent(fid2, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDONLY)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4392,11 +4374,13 @@ test_file_lock_same(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Fclose(fid);
- H5Fclose(fid2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl);
+ H5Fclose(fid);
+ H5Fclose(fid2);
+ }
+ H5E_END_TRY;
return -1;
} /* end test_file_lock_same() */
@@ -4412,30 +4396,30 @@ error:
static int
test_file_lock_swmr_same(hid_t in_fapl)
{
- hid_t fid, fid2; /* File IDs */
- hid_t fapl; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* file name */
+ hid_t fid, fid2; /* File IDs */
+ hid_t fapl; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* file name */
/* Output message about test being performed */
TESTING("File open with different combinations of flags + SWMR flags--single process access");
/* Set locking in the fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -4445,38 +4429,34 @@ test_file_lock_swmr_same(hid_t in_fapl)
/*
* Case a: RDWR|SWRM_READ : should fail
*/
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
+ TEST_ERROR
/*
* Case b: RDWR|SWMM_WRTE|SWMR_READ : should fail
*/
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
+ TEST_ERROR
/*
* Case c: RDONLY|SWMM_WRITE : should fail
*/
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
+ TEST_ERROR
/*
* Case d: RDONLY|SWMM_WRITE|SWMR_READ : should fail
*/
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_WRITE|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
+ TEST_ERROR
/*
* Cases 1 - 12: combinations of different flags for 1st and 2nd opens
@@ -4485,195 +4465,190 @@ test_file_lock_swmr_same(hid_t in_fapl)
/*
* Case 1: 1) RDWR 2) RDWR|SWMR_WRITE : should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 2: 1) RDWR 2) RDONLY|SWMR_READ : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- TEST_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
- TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 3: 1) RDWR|SWMR_WRITE 2)RDWR : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 4: 1) RDWR|SWMR_WRITE 2) RDWR|SWMR_WRITE : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 5: 1) RDWR|SWMR_WRITE 2) RDONLY|SWMR_READ : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 6: 1) RDWR|SWMR_WRITE 2) RDONLY : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 7: 1) RDONLY|SWMR_READ 2)RDWR : should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 8: 1) RDONLY|SWMR_READ 2) RDWR|SWMR_WRITE : should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 9: 1) RDONLY|SWMR_READ 2) RDONLY|SWMR_READ : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 10: 1) RDONLY|SWMR_READ 2) RDONLY : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 11: 1) RDONLY 2) RDWR|SWMR_WRITE: should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 12: 1) RDONLY 2) RDONLY|SWMR_READ : should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid2 >=0 )
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4681,16 +4656,17 @@ test_file_lock_swmr_same(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Fclose(fid);
- H5Fclose(fid2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl);
+ H5Fclose(fid);
+ H5Fclose(fid2);
+ }
+ H5E_END_TRY;
return -1;
} /* end test_file_lock_swmr_same() */
-
/****************************************************************
**
** test_file_lock_concur():
@@ -4717,33 +4693,33 @@ test_file_lock_concur(hid_t H5_ATTR_UNUSED in_fapl)
static int
test_file_lock_concur(hid_t in_fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* file name */
- pid_t childpid=0; /* Child process ID */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int out_pdf[2];
- int notify = 0;
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* file name */
+ pid_t childpid = 0; /* Child process ID */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int out_pdf[2];
+ int notify = 0;
/* Output message about test being performed */
TESTING("File open with different combinations of flags--concurrent access");
/* Set locking in the fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_file_locking(fapl, TRUE, TRUE) < 0)
+ if (H5Pset_file_locking(fapl, TRUE, TRUE) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -4751,148 +4727,148 @@ test_file_lock_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
- /* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
- TEST_ERROR
- } else
+ if (WIFEXITED(child_status)) {
+ /* Check exit status of the child */
+ if (WEXITSTATUS(child_status) != 0)
+ TEST_ERROR
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 2: 1) RDWR 2) RDONLY : should fail
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Opens the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Opens the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -4900,74 +4876,74 @@ test_file_lock_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Opens the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
} /* end if */
- /* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ /* close unused read end for out_pdf */
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Opens the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -4975,41 +4951,40 @@ test_file_lock_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Opens the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); }
+ H5E_END_TRY;
/* Should succeed */
- if(child_fid >= 0) {
+ if (child_fid >= 0) {
/* Close the file */
- if(H5Fclose(child_fid) < 0)
- HDexit(EXIT_FAILURE);
+ if (H5Fclose(child_fid) < 0)
+ HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
} /* end if */
@@ -5018,40 +4993,41 @@ test_file_lock_concur(hid_t in_fapl)
} /* end if */
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Create file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -5059,10 +5035,12 @@ test_file_lock_concur(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
@@ -5096,37 +5074,37 @@ test_file_lock_swmr_concur(hid_t H5_ATTR_UNUSED in_fapl)
static int
test_file_lock_swmr_concur(hid_t in_fapl)
{
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* file name */
- pid_t childpid=0; /* Child process ID */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int out_pdf[2];
- int notify = 0;
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* file name */
+ pid_t childpid = 0; /* Child process ID */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int out_pdf[2];
+ int notify = 0;
/* Output message about test being performed */
TESTING("File open with different combintations of flags + SWMR flags--concurrent access");
/* Set locking in the fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_file_locking(fapl, TRUE, TRUE) < 0)
+ if (H5Pset_file_locking(fapl, TRUE, TRUE) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5134,74 +5112,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5209,74 +5187,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5284,299 +5262,299 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- /* Notify child process */
+ /* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 4: 1) RDWR|SWMR_WRITE 2) RDWR|SWMR_WRITE : should fail
*/
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 5: 1) RDWR|SWMR_WRITE 2) RDONLY|SWMR_READ : should succeed
*/
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
/* Should succeed */
- if(child_fid >= 0) {
- if(H5Fclose(child_fid) < 0)
+ if (child_fid >= 0) {
+ if (H5Fclose(child_fid) < 0)
FAIL_STACK_ERROR
HDexit(EXIT_SUCCESS);
}
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 6: 1) RDWR|SWMR_WRITE 2) RDONLY : should fail
*/
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- /* Notify child process */
+ /* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5584,74 +5562,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- /* Notify child process */
+ /* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5659,74 +5637,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5734,77 +5712,77 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
/* Should succeed */
- if(child_fid >= 0) {
- if(H5Fclose(child_fid) < 0)
+ if (child_fid >= 0) {
+ if (H5Fclose(child_fid) < 0)
FAIL_STACK_ERROR
HDexit(EXIT_SUCCESS);
}
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5812,76 +5790,77 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- if((child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Should succeed */
- if(child_fid >= 0) {
- if(H5Fclose(child_fid) < 0)
+ if (child_fid >= 0) {
+ if (H5Fclose(child_fid) < 0)
FAIL_STACK_ERROR
HDexit(EXIT_SUCCESS);
}
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- /* Notify child process */
+ /* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5889,74 +5868,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
- FAIL_STACK_ERROR
+ if (HDpipe(out_pdf) < 0)
+ FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* Close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5964,81 +5943,81 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
/* Should succeed */
- if(child_fid >= 0) {
- if(H5Fclose(child_fid) < 0)
+ if (child_fid >= 0) {
+ if (H5Fclose(child_fid) < 0)
FAIL_STACK_ERROR
HDexit(EXIT_SUCCESS);
}
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -6046,10 +6025,12 @@ test_file_lock_swmr_concur(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
@@ -6072,15 +6053,15 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri
HDputs(" Test skipped due to fork or waitpid not defined.");
return 0;
#else
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* file name */
- pid_t childpid=0; /* Child process ID */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int out_pdf[2];
- int notify = 0;
- int exit_status = 0;
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* file name */
+ pid_t childpid = 0; /* Child process ID */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int out_pdf[2];
+ int notify = 0;
+ int exit_status = 0;
herr_t ret;
if (turn_locking_on && env_var_override)
@@ -6093,24 +6074,24 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri
TESTING("File locking: OFF")
/* Copy the incoming fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
TEST_ERROR
/* Set locking in the fapl */
- if(H5Pset_file_locking(fapl, turn_locking_on ? TRUE : FALSE, TRUE) < 0)
+ if (H5Pset_file_locking(fapl, turn_locking_on ? TRUE : FALSE, TRUE) < 0)
TEST_ERROR
/* If requested, set the environment variable */
if (env_var_override) {
- if(HDsetenv("HDF5_USE_FILE_LOCKING", turn_locking_on ? "FALSE" : "TRUE", TRUE) < 0)
+ if (HDsetenv("HDF5_USE_FILE_LOCKING", turn_locking_on ? "FALSE" : "TRUE", TRUE) < 0)
TEST_ERROR
- if(H5F__reparse_file_lock_variable_test() < 0)
+ if (H5F__reparse_file_lock_variable_test() < 0)
TEST_ERROR
}
else {
- if(HDsetenv("HDF5_USE_FILE_LOCKING", "", TRUE) < 0)
+ if (HDsetenv("HDF5_USE_FILE_LOCKING", "", TRUE) < 0)
TEST_ERROR
- if(H5F__reparse_file_lock_variable_test() < 0)
+ if (H5F__reparse_file_lock_variable_test() < 0)
TEST_ERROR
}
@@ -6118,11 +6099,11 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Open a file for read-only and then read-write. This will fail
@@ -6130,69 +6111,71 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
TEST_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
TEST_ERROR
- if(childpid == 0) {
+ if (childpid == 0) {
/* Child process */
- hid_t child_fid = H5I_INVALID_HID; /* File ID */
- int child_notify = 0;
+ hid_t child_fid = H5I_INVALID_HID; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open and close the test file */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- ret = H5Fclose(child_fid);
- } H5E_END_TRY;
+ ret = H5Fclose(child_fid);
+ }
+ H5E_END_TRY;
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
- if(H5I_INVALID_HID == child_fid || FAIL == ret)
+ if (H5I_INVALID_HID == child_fid || FAIL == ret)
HDexit(EXIT_FAILURE);
else
HDexit(EXIT_SUCCESS);
} /* end child process work */
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
TEST_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
TEST_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
TEST_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
TEST_ERROR
/* Check exit status of the child */
- if(WIFEXITED(child_status))
+ if (WIFEXITED(child_status))
exit_status = WEXITSTATUS(child_status);
else
TEST_ERROR
@@ -6204,21 +6187,21 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri
* locks on, env var override: PASS
* locks off, env var override: FAIL
*/
- if(turn_locking_on && !env_var_override && (0 == exit_status))
+ if (turn_locking_on && !env_var_override && (0 == exit_status))
TEST_ERROR
- else if(!turn_locking_on && !env_var_override && (0 != exit_status))
+ else if (!turn_locking_on && !env_var_override && (0 != exit_status))
TEST_ERROR
- else if(turn_locking_on && env_var_override && (0 != exit_status))
+ else if (turn_locking_on && env_var_override && (0 != exit_status))
TEST_ERROR
- else if(!turn_locking_on && env_var_override && (0 == exit_status))
+ else if (!turn_locking_on && env_var_override && (0 == exit_status))
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Close the copied property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
PASSED();
@@ -6226,19 +6209,19 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
#endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */
} /* end test_file_locking() */
-
/****************************************************************
**
** test_different_lock_flags():
@@ -6249,52 +6232,51 @@ error:
static int
test_different_lock_flags(hid_t in_fapl)
{
- hid_t fid1 = H5I_INVALID_HID; /* File ID */
- hid_t fid2 = H5I_INVALID_HID; /* File ID */
- hid_t fid3 = H5I_INVALID_HID; /* File ID */
- hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* File name */
+ hid_t fid1 = H5I_INVALID_HID; /* File ID */
+ hid_t fid2 = H5I_INVALID_HID; /* File ID */
+ hid_t fid3 = H5I_INVALID_HID; /* File ID */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* File name */
TESTING("Using different lock flags")
/* Copy the incoming fapl */
- if((fapl_id = H5Pcopy(in_fapl)) < 0)
+ if ((fapl_id = H5Pcopy(in_fapl)) < 0)
TEST_ERROR
/* Set locking in the fapl */
- if(H5Pset_file_locking(fapl_id, TRUE, TRUE) < 0)
+ if (H5Pset_file_locking(fapl_id, TRUE, TRUE) < 0)
TEST_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
/* Create the test file */
- if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR
/* Open the test file with the same flags (should pass) */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR
/* Unset locking in the fapl */
- if(H5Pset_file_locking(fapl_id, FALSE, FALSE) < 0)
+ if (H5Pset_file_locking(fapl_id, FALSE, FALSE) < 0)
TEST_ERROR
/* Open the test file with different flags (should FAIL) */
- H5E_BEGIN_TRY {
- fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
- } H5E_END_TRY;
- if(H5I_INVALID_HID != fid3)
+ H5E_BEGIN_TRY { fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); }
+ H5E_END_TRY;
+ if (H5I_INVALID_HID != fid3)
FAIL_PUTS_ERROR("Should not have been able to open a file with different locking flags")
/* Close the files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
TEST_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
TEST_ERROR
/* Close the copied property list */
- if(H5Pclose(fapl_id) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR
PASSED();
@@ -6302,12 +6284,14 @@ test_different_lock_flags(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_id);
H5Fclose(fid1);
H5Fclose(fid2);
H5Fclose(fid3);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_different_lock_flags() */
@@ -6315,48 +6299,47 @@ error:
static int
test_swmr_vfd_flag(void)
{
- hid_t fid = -1; /* file ID */
- hid_t sec2_fapl = -1; /* fapl ID of a VFD that supports SWMR writes (sec2) */
- hid_t bad_fapl = -1; /* fapl ID of a VFD that does not support SWMR writes (stdio) */
- char filename[NAME_BUF_SIZE]; /* file name */
+ hid_t fid = -1; /* file ID */
+ hid_t sec2_fapl = -1; /* fapl ID of a VFD that supports SWMR writes (sec2) */
+ hid_t bad_fapl = -1; /* fapl ID of a VFD that does not support SWMR writes (stdio) */
+ char filename[NAME_BUF_SIZE]; /* file name */
TESTING("SWMR-enabled VFD flag functionality");
/* Attempt to open a file using a SWMR-compatible VFD. */
- if((sec2_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((sec2_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_fapl_sec2(sec2_fapl) < 0)
+ if (H5Pset_fapl_sec2(sec2_fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_libver_bounds(sec2_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(sec2_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[0], sec2_fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, sec2_fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, sec2_fapl)) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Attempt to open a file using a non-SWMR-compatible VFD. */
- if((bad_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((bad_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_fapl_stdio(bad_fapl) < 0)
+ if (H5Pset_fapl_stdio(bad_fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_libver_bounds(bad_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(bad_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
fid = -1;
h5_fixname(FILENAME[0], bad_fapl, filename, sizeof(filename));
- H5E_BEGIN_TRY {
- fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, bad_fapl);
- } H5E_END_TRY;
- if(fid >= 0)
+ H5E_BEGIN_TRY { fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, bad_fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
TEST_ERROR;
- if(H5Pclose(sec2_fapl) < 0)
+ if (H5Pclose(sec2_fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(bad_fapl) < 0)
+ if (H5Pclose(bad_fapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -6364,11 +6347,13 @@ test_swmr_vfd_flag(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(sec2_fapl);
H5Pclose(bad_fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_swmr_vfd_flag() */
@@ -6382,18 +6367,18 @@ error:
static int
test_bug_refresh(hid_t in_fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl;
+ hid_t fid = -1; /* File ID */
+ hid_t fapl;
H5F_t *f;
- hid_t gid1, gid2, gid3, gid4, gid5, gid6, gid7, gid8, gid9;
- char filename[NAME_BUF_SIZE]; /* File name */
+ hid_t gid1, gid2, gid3, gid4, gid5, gid6, gid7, gid8, gid9;
+ char filename[NAME_BUF_SIZE]; /* File name */
/* Create a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
@@ -6402,45 +6387,54 @@ test_bug_refresh(hid_t in_fapl)
TESTING("H5Orefresh failure conditions");
/* Create a file with the latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
FAIL_STACK_ERROR
/* Create groups: compact to dense storage */
- if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid2 = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid3 = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid3 = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid4 = H5Gcreate2(fid, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid4 = H5Gcreate2(fid, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid5 = H5Gcreate2(fid, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid5 = H5Gcreate2(fid, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid6 = H5Gcreate2(fid, "group6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid6 = H5Gcreate2(fid, "group6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid7 = H5Gcreate2(fid, "group7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid7 = H5Gcreate2(fid, "group7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid8 = H5Gcreate2(fid, "group8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid8 = H5Gcreate2(fid, "group8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid9 = H5Gcreate2(fid, "group9", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid9 = H5Gcreate2(fid, "group9", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
TEST_ERROR
- if(H5Grefresh(gid1) < 0) TEST_ERROR
- if(H5Grefresh(gid2) < 0) TEST_ERROR
- if(H5Grefresh(gid3) < 0) TEST_ERROR
- if(H5Grefresh(gid4) < 0) TEST_ERROR
- if(H5Grefresh(gid5) < 0) TEST_ERROR
- if(H5Grefresh(gid6) < 0) TEST_ERROR
- if(H5Grefresh(gid7) < 0) TEST_ERROR
- if(H5Grefresh(gid8) < 0) TEST_ERROR
- if(H5Grefresh(gid9) < 0) TEST_ERROR
+ if (H5Grefresh(gid1) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid2) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid3) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid4) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid5) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid6) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid7) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid8) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid9) < 0)
+ TEST_ERROR
H5Gclose(gid1);
H5Gclose(gid2);
@@ -6457,7 +6451,8 @@ test_bug_refresh(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid1);
H5Gclose(gid2);
H5Gclose(gid3);
@@ -6469,7 +6464,8 @@ error:
H5Gclose(gid9);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_bug_refresh() */
@@ -6512,27 +6508,27 @@ test_refresh_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t H5_ATTR_UNUSED new_for
return 0;
} /* test_refresh_concur() */
-#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
+#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
static int
test_refresh_concur(hid_t in_fapl, hbool_t new_format)
{
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- pid_t childpid=0; /* Child process ID */
- pid_t tmppid; /* Child process ID returned by waitpid */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int child_exit_val; /* Exit status of the child */
- char filename[NAME_BUF_SIZE]; /* File name */
-
- hid_t did = -1;
- hid_t sid = -1;
- hid_t dcpl = -1;
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ pid_t childpid = 0; /* Child process ID */
+ pid_t tmppid; /* Child process ID returned by waitpid */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int child_exit_val; /* Exit status of the child */
+ char filename[NAME_BUF_SIZE]; /* File name */
+
+ hid_t did = -1;
+ hid_t sid = -1;
+ hid_t dcpl = -1;
hsize_t chunk_dims[1] = {1};
- hsize_t maxdims[1] = {H5S_UNLIMITED};
- hsize_t dims[1] = { 1 };
- hsize_t new_dims[1] = {2};
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ hsize_t dims[1] = {1};
+ hsize_t new_dims[1] = {2};
int out_pdf[2];
int in_pdf[2];
@@ -6540,271 +6536,274 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format)
int wbuf[2];
/* Output message about test being performed */
- if(new_format) {
+ if (new_format) {
TESTING("H5Drefresh()--concurrent access for latest format");
- } else {
+ }
+ else {
TESTING("H5Drefresh()--concurrent access for non-latest-format");
} /* end if */
-
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if(new_format) {
+ if (new_format) {
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- } else {
+ }
+ else {
/* Create the test file without latest format but with SWMR write */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Create 2 pipes */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
- if(HDpipe(in_pdf) < 0)
+ if (HDpipe(in_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid1 = -1; /* File ID */
- hid_t child_fid2 = -1; /* File ID */
- hid_t child_did1 = -1, child_did2 = -1;
- hid_t child_sid = -1;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid1 = -1; /* File ID */
+ hid_t child_fid2 = -1; /* File ID */
+ hid_t child_did1 = -1, child_did2 = -1;
+ hid_t child_sid = -1;
hsize_t tdims[1];
- int rbuf[2] = {0, 0};
- int child_notify = 0;
+ int rbuf[2] = {0, 0};
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* close unused read end for in_pdf */
- if(HDclose(in_pdf[0]) < 0)
+ if (HDclose(in_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1)
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1)
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
/* Open the file 2 times */
- if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
HDexit(EXIT_FAILURE);
- if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
HDexit(EXIT_FAILURE);
/* Open the dataset 2 times */
- if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0)
HDexit(EXIT_FAILURE);
- if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0)
HDexit(EXIT_FAILURE);
/* Get the dataset's dataspace via did1 */
- if((child_sid = H5Dget_space(child_did1)) < 0)
+ if ((child_sid = H5Dget_space(child_did1)) < 0)
HDexit(EXIT_FAILURE);
- if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0)
HDexit(EXIT_FAILURE);
- if(tdims[0] != 1)
+ if (tdims[0] != 1)
HDexit(EXIT_FAILURE);
/* Read from the dataset via did2 */
- if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
HDexit(EXIT_FAILURE);
/* Verify the data is correct */
- if(rbuf[0] != 99)
+ if (rbuf[0] != 99)
HDexit(EXIT_FAILURE);
/* Notify parent process */
child_notify = 2;
- if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0)
+ if (HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 3)
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 3)
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
/* Refresh dataset via did1 */
- if(H5Drefresh(child_did1) < 0)
+ if (H5Drefresh(child_did1) < 0)
HDexit(EXIT_FAILURE);
/* Get the dataset's dataspace and verify */
- if((child_sid = H5Dget_space(child_did1)) < 0)
+ if ((child_sid = H5Dget_space(child_did1)) < 0)
HDexit(EXIT_FAILURE);
- if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0)
HDexit(EXIT_FAILURE);
- if(tdims[0] != 2)
+ if (tdims[0] != 2)
HDexit(EXIT_FAILURE);
/* Read from the dataset */
- if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
HDexit(EXIT_FAILURE);
/* Verify the data is correct */
- if(rbuf[0] != 100 || rbuf[1] != 100)
+ if (rbuf[0] != 100 || rbuf[1] != 100)
HDexit(EXIT_FAILURE);
/* Close the 2 datasets */
- if(H5Dclose(child_did1) < 0)
+ if (H5Dclose(child_did1) < 0)
HDexit(EXIT_FAILURE);
- if(H5Dclose(child_did2) < 0)
+ if (H5Dclose(child_did2) < 0)
HDexit(EXIT_FAILURE);
/* Close the 2 files */
- if(H5Fclose(child_fid1) < 0)
+ if (H5Fclose(child_fid1) < 0)
HDexit(EXIT_FAILURE);
- if(H5Fclose(child_fid2) < 0)
+ if (H5Fclose(child_fid2) < 0)
HDexit(EXIT_FAILURE);
/* Close the pipes */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
- if(HDclose(in_pdf[1]) < 0)
+ if (HDclose(in_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
}
/* Close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Close unused write end for in_pdf */
- if(HDclose(in_pdf[1]) < 0)
+ if (HDclose(in_pdf[1]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did = H5Dopen2(fid, "dataset", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Write to the dataset */
wbuf[0] = wbuf[1] = 99;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
FAIL_STACK_ERROR;
/* Flush to disk */
- if(H5Fflush(fid, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_LOCAL) < 0)
FAIL_STACK_ERROR;
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
-
/* Wait for notification from child process */
- while(notify != 2) {
- if(HDread(in_pdf[0], &notify, sizeof(int)) < 0)
+ while (notify != 2) {
+ if (HDread(in_pdf[0], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
}
/* Cork the metadata cache, to prevent the object header from being
* flushed before the data has been written */
- if(H5Odisable_mdc_flushes(did) < 0)
+ if (H5Odisable_mdc_flushes(did) < 0)
FAIL_STACK_ERROR;
/* Extend the dataset */
- if(H5Dset_extent(did, new_dims) < 0)
+ if (H5Dset_extent(did, new_dims) < 0)
FAIL_STACK_ERROR;
/* Write to the dataset */
wbuf[0] = wbuf[1] = 100;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
FAIL_STACK_ERROR;
/* Uncork the metadata cache */
- if(H5Oenable_mdc_flushes(did) < 0)
+ if (H5Oenable_mdc_flushes(did) < 0)
FAIL_STACK_ERROR;
/* Flush to disk */
- if(H5Fflush(fid, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_LOCAL) < 0)
FAIL_STACK_ERROR;
/* Notify child process */
notify = 3;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipes */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
- if(HDclose(in_pdf[0]) < 0)
+ if (HDclose(in_pdf[0]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
H5Pclose(dcpl);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
@@ -6827,302 +6826,303 @@ error:
static int
test_multiple_same(hid_t in_fapl, hbool_t new_format)
{
- hid_t fid = -1, fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t fapl; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* File name */
- hid_t did = -1, did1 = -1, did2 = -1, did3 = -1;
- hid_t sid = -1;
- hid_t dcpl = -1;
+ hid_t fid = -1, fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
+ hid_t fapl; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ hid_t did = -1, did1 = -1, did2 = -1, did3 = -1;
+ hid_t sid = -1;
+ hid_t dcpl = -1;
hsize_t chunk_dims[2] = {1, 2};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t dims[2] = {1, 1};
- int rbuf = 0;
- int wbuf = 0;
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t dims[2] = {1, 1};
+ int rbuf = 0;
+ int wbuf = 0;
/* Output message about test being performed */
- if(new_format) {
+ if (new_format) {
TESTING("multiple--single process access for latest format");
- } else {
+ }
+ else {
TESTING("multiple--single process access for non-latest-format");
} /* end if */
-
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if(new_format) {
+ if (new_format) {
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- } else {
+ }
+ else {
/* Create the test file without latest format but with SWMR write */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Case 1 */
/* Open the file 3 times: SWMR-write, read-write, read-only */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset 3 times with fid1, fid2, fid3 */
- if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
-
/* Write to the dataset via did1 */
wbuf = 88;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh via did2 */
- if(H5Drefresh(did2) < 0)
+ if (H5Drefresh(did2) < 0)
FAIL_STACK_ERROR;
/* Read from the dataset via did2 */
rbuf = 0;
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data is correct */
- if(rbuf != 88)
+ if (rbuf != 88)
FAIL_STACK_ERROR;
/* Write to the dataset via did3 */
wbuf = 99;
- if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh via did1 */
- if(H5Drefresh(did1) < 0)
+ if (H5Drefresh(did1) < 0)
FAIL_STACK_ERROR;
/* Read from the dataset via did1 */
rbuf = 0;
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data is correct */
- if(rbuf != 99)
+ if (rbuf != 99)
FAIL_STACK_ERROR;
/* Close datasets */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR;
/* Close files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
FAIL_STACK_ERROR
/* Case 2 */
/* Open the file 3 times: read-write, read-only, read-write */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset 3 times with fid1, fid2, fid3 */
- if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write to the dataset via did1 */
wbuf = 88;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh via did2 */
- if(H5Drefresh(did2) < 0)
+ if (H5Drefresh(did2) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did2 */
rbuf = 0;
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Write to dataset via did3 */
wbuf = 99;
- if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Enable SWMR write */
- if(H5Fstart_swmr_write(fid1) < 0)
+ if (H5Fstart_swmr_write(fid1) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did1 and verify data is correct */
rbuf = 0;
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Write to dataset via did2 */
wbuf = 100;
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh dataset via did3 */
- if(H5Drefresh(did3) < 0)
+ if (H5Drefresh(did3) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did3 and verify data is correct */
rbuf = 0;
- if(H5Dread(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Close datasets */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR;
/* Close files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
FAIL_STACK_ERROR
/* Case 3 */
/* Open the file 3 times: read-write, read-only, read-only */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset 3 times with fid1, fid2, fid3 */
- if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write to the dataset via did1 */
wbuf = 88;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh dataset via did2 */
- if(H5Drefresh(did2) < 0)
+ if (H5Drefresh(did2) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did2 and verify data is correct */
rbuf = 0;
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Close dataset via did2 */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
/* Close file via fid2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/* Write to dataset via did3 */
wbuf = 99;
- if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Close dataset via did3 */
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR;
/* Close file via fid3 */
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
FAIL_STACK_ERROR
/* Enable SWMR writing */
- if(H5Fstart_swmr_write(fid1) < 0)
+ if (H5Fstart_swmr_write(fid1) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did1 and verify data is correct */
rbuf = 0;
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Close dataset via did1 */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
/* Close file via fid1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Dclose(did1);
H5Dclose(did2);
@@ -7134,7 +7134,8 @@ error:
H5Fclose(fid1);
H5Fclose(fid2);
H5Fclose(fid3);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
@@ -7148,18 +7149,18 @@ error:
int
main(void)
{
- int nerrors = 0; /* The # of errors */
- hid_t fapl = -1; /* File access property list ID */
- char *driver = NULL; /* VFD string (from env variable) */
- char *lock_env_var = NULL; /* file locking env var pointer */
- hbool_t use_file_locking; /* read from env var */
- hbool_t file_locking_enabled = FALSE; /* Checks if the file system supports locks */
+ int nerrors = 0; /* The # of errors */
+ hid_t fapl = -1; /* File access property list ID */
+ char * driver = NULL; /* VFD string (from env variable) */
+ char * lock_env_var = NULL; /* file locking env var pointer */
+ hbool_t use_file_locking; /* read from env var */
+ hbool_t file_locking_enabled = FALSE; /* Checks if the file system supports locks */
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
driver = HDgetenv("HDF5_DRIVER");
- if(!H5FD__supports_swmr_test(driver)) {
+ if (!H5FD__supports_swmr_test(driver)) {
HDprintf("This VFD does not support SWMR I/O\n");
return EXIT_SUCCESS;
} /* end if */
@@ -7169,14 +7170,14 @@ main(void)
* disabled.
*/
lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING");
- if(lock_env_var && !HDstrcmp(lock_env_var, "FALSE"))
+ if (lock_env_var && !HDstrcmp(lock_env_var, "FALSE"))
use_file_locking = FALSE;
else
use_file_locking = TRUE;
/* Check if file locking is enabled on this file system */
- if(use_file_locking)
- if(h5_check_if_file_locking_enabled(&file_locking_enabled) < 0) {
+ if (use_file_locking)
+ if (h5_check_if_file_locking_enabled(&file_locking_enabled) < 0) {
HDprintf("Error when determining if file locks are enabled\n");
return EXIT_FAILURE;
}
@@ -7222,7 +7223,7 @@ main(void)
nerrors += test_append_flush_dataset_fixed(fapl);
nerrors += test_append_flush_dataset_multiple(fapl);
- if(use_file_locking && file_locking_enabled) {
+ if (use_file_locking && file_locking_enabled) {
/*
* Tests for:
* file open flags--single process access
@@ -7246,7 +7247,7 @@ main(void)
/* Tests SWMR VFD compatibility flag.
* Only needs to run when the VFD is the default (sec2).
*/
- if(NULL == driver || !HDstrcmp(driver, "") || !HDstrcmp(driver, "sec2"))
+ if (NULL == driver || !HDstrcmp(driver, "") || !HDstrcmp(driver, "sec2"))
nerrors += test_swmr_vfd_flag();
/* Test multiple opens via different locking flags */
@@ -7263,7 +7264,7 @@ main(void)
nerrors += test_file_locking(fapl, FALSE, FALSE);
}
- if(nerrors)
+ if (nerrors)
goto error;
HDprintf("All tests passed.\n");
@@ -7274,9 +7275,7 @@ main(void)
error:
nerrors = MAX(1, nerrors);
- HDprintf("***** %d SWMR TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d SWMR TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/swmr_addrem_writer.c b/test/swmr_addrem_writer.c
index 7ad74ed..fd3096f 100644
--- a/test/swmr_addrem_writer.c
+++ b/test/swmr_addrem_writer.c
@@ -39,18 +39,16 @@
/****************/
/* The maximum # of records to add/remove from the dataset in one step */
-#define MAX_SIZE_CHANGE 10
+#define MAX_SIZE_CHANGE 10
/********************/
/* Local Prototypes */
/********************/
static hid_t open_skeleton(const char *filename, unsigned verbose);
-static int addrem_records(hid_t fid, unsigned verbose, unsigned long nops,
- unsigned long flush_count);
-static void usage(void);
+static int addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long flush_count);
+static void usage(void);
-
/*-------------------------------------------------------------------------
* Function: open_skeleton
*
@@ -72,44 +70,44 @@ static void usage(void);
static hid_t
open_skeleton(const char *filename, unsigned verbose)
{
- hid_t fid; /* File ID for new HDF5 file */
- hid_t fapl; /* File access property list */
- hid_t sid; /* Dataspace ID */
- hsize_t dim[2]; /* Dataspace dimension */
- unsigned u, v; /* Local index variable */
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t fapl; /* File access property list */
+ hid_t sid; /* Dataspace ID */
+ hsize_t dim[2]; /* Dataspace dimension */
+ unsigned u, v; /* Local index variable */
HDassert(filename);
/* Create file access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
return -1;
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
/* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
return -1;
/* Close file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Opening datasets\n");
/* Open the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++) {
- if((symbol_info[u][v].dsid = H5Dopen2(fid, symbol_info[u][v].name, H5P_DEFAULT)) < 0)
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++) {
+ if ((symbol_info[u][v].dsid = H5Dopen2(fid, symbol_info[u][v].name, H5P_DEFAULT)) < 0)
return -1;
- if((sid = H5Dget_space(symbol_info[u][v].dsid)) < 0)
+ if ((sid = H5Dget_space(symbol_info[u][v].dsid)) < 0)
return -1;
- if(2 != H5Sget_simple_extent_ndims(sid))
+ if (2 != H5Sget_simple_extent_ndims(sid))
return -1;
- if(H5Sget_simple_extent_dims(sid, dim, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dim, NULL) < 0)
return -1;
symbol_info[u][v].nrecords = dim[1];
} /* end for */
@@ -117,7 +115,6 @@ open_skeleton(const char *filename, unsigned verbose)
return fid;
}
-
/*-------------------------------------------------------------------------
* Function: addrem_records
*
@@ -144,13 +141,13 @@ open_skeleton(const char *filename, unsigned verbose)
static int
addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long flush_count)
{
- hid_t tid; /* Datatype ID for records */
- hid_t mem_sid; /* Memory dataspace ID */
- hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
- hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */
- symbol_t buf[MAX_SIZE_CHANGE]; /* Write buffer */
- unsigned long op_to_flush; /* # of operations before flush */
- unsigned long u, v; /* Local index variables */
+ hid_t tid; /* Datatype ID for records */
+ hid_t mem_sid; /* Memory dataspace ID */
+ hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
+ hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */
+ symbol_t buf[MAX_SIZE_CHANGE]; /* Write buffer */
+ unsigned long op_to_flush; /* # of operations before flush */
+ unsigned long u, v; /* Local index variables */
HDassert(fid > 0);
@@ -158,19 +155,19 @@ addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long fl
HDmemset(&buf, 0, sizeof(buf));
/* Create a dataspace for the record to add */
- if((mem_sid = H5Screate_simple(2, count, NULL)) < 0)
+ if ((mem_sid = H5Screate_simple(2, count, NULL)) < 0)
return -1;
/* Create datatype for appending records */
- if((tid = create_symbol_datatype()) < 0)
+ if ((tid = create_symbol_datatype()) < 0)
return -1;
/* Add and remove records to random datasets, according to frequency
* distribution */
op_to_flush = flush_count;
- for(u=0; u<nops; u++) {
- symbol_info_t *symbol; /* Symbol to write record to */
- hid_t file_sid; /* Dataset's space ID */
+ for (u = 0; u < nops; u++) {
+ symbol_info_t *symbol; /* Symbol to write record to */
+ hid_t file_sid; /* Dataset's space ID */
/* Get a random dataset, according to the symbol distribution */
symbol = choose_dataset();
@@ -178,16 +175,16 @@ addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long fl
/* Decide whether to shrink or expand, and by how much */
count[1] = (hsize_t)HDrandom() % (MAX_SIZE_CHANGE * 2) + 1;
- if(count[1] > MAX_SIZE_CHANGE) {
+ if (count[1] > MAX_SIZE_CHANGE) {
/* Add records */
count[1] -= MAX_SIZE_CHANGE;
/* Set the buffer's IDs (equal to its position) */
- for(v=0; v<count[1]; v++)
+ for (v = 0; v < count[1]; v++)
buf[v].rec_id = (uint64_t)symbol->nrecords + (uint64_t)v;
/* Set the memory space to the correct size */
- if(H5Sset_extent_simple(mem_sid, 2, count, NULL) < 0)
+ if (H5Sset_extent_simple(mem_sid, 2, count, NULL) < 0)
return -1;
/* Get the coordinates to write */
@@ -195,71 +192,71 @@ addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long fl
/* Cork the metadata cache, to prevent the object header from being
* flushed before the data has been written */
- if(H5Odisable_mdc_flushes(symbol->dsid) < 0)
+ if (H5Odisable_mdc_flushes(symbol->dsid) < 0)
return -1;
- /* Extend the dataset's dataspace to hold the new record */
- symbol->nrecords+= count[1];
+ /* Extend the dataset's dataspace to hold the new record */
+ symbol->nrecords += count[1];
dim[1] = symbol->nrecords;
- if(H5Dset_extent(symbol->dsid, dim) < 0)
+ if (H5Dset_extent(symbol->dsid, dim) < 0)
return -1;
/* Get the dataset's dataspace */
- if((file_sid = H5Dget_space(symbol->dsid)) < 0)
+ if ((file_sid = H5Dget_space(symbol->dsid)) < 0)
return -1;
/* Choose the last record in the dataset */
- if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
return -1;
/* Write record to the dataset */
- if(H5Dwrite(symbol->dsid, tid, mem_sid, file_sid, H5P_DEFAULT, &buf) < 0)
+ if (H5Dwrite(symbol->dsid, tid, mem_sid, file_sid, H5P_DEFAULT, &buf) < 0)
return -1;
/* Uncork the metadata cache */
- if(H5Oenable_mdc_flushes(symbol->dsid) < 0)
+ if (H5Oenable_mdc_flushes(symbol->dsid) < 0)
return -1;
/* Close the dataset's dataspace */
- if(H5Sclose(file_sid) < 0)
+ if (H5Sclose(file_sid) < 0)
return -1;
} /* end if */
else {
/* Shrink the dataset's dataspace */
- if(count[1] > symbol->nrecords)
+ if (count[1] > symbol->nrecords)
symbol->nrecords = 0;
else
symbol->nrecords -= count[1];
dim[1] = symbol->nrecords;
- if(H5Dset_extent(symbol->dsid, dim) < 0)
+ if (H5Dset_extent(symbol->dsid, dim) < 0)
return -1;
} /* end else */
/* Check for flushing file */
- if(flush_count > 0) {
+ if (flush_count > 0) {
/* Decrement count of records to write before flushing */
op_to_flush--;
/* Check for counter being reached */
- if(0 == op_to_flush) {
+ if (0 == op_to_flush) {
/* Flush contents of file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
return -1;
/* Reset flush counter */
op_to_flush = flush_count;
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing datasets\n");
/* Close the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++)
- if(H5Dclose(symbol_info[u][v].dsid) < 0)
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++)
+ if (H5Dclose(symbol_info[u][v].dsid) < 0)
return -1;
return 0;
@@ -285,29 +282,30 @@ usage(void)
HDexit(EXIT_FAILURE);
}
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- hid_t fid; /* File ID for file opened */
- long nops = 0; /* # of times to grow or shrink the dataset */
- long flush_count = 1000; /* # of records to write between flushing file */
- unsigned verbose = 1; /* Whether to emit some informational messages */
- unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */
- unsigned random_seed = 0; /* Random # seed */
- unsigned u; /* Local index variable */
- int temp;
+ hid_t fid; /* File ID for file opened */
+ long nops = 0; /* # of times to grow or shrink the dataset */
+ long flush_count = 1000; /* # of records to write between flushing file */
+ unsigned verbose = 1; /* Whether to emit some informational messages */
+ unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */
+ unsigned random_seed = 0; /* Random # seed */
+ unsigned u; /* Local index variable */
+ int temp;
/* Parse command line options */
- if(argc < 2)
+ if (argc < 2)
usage();
- if(argc > 1) {
+ if (argc > 1) {
u = 1;
- while(u < (unsigned)argc) {
- if(argv[u][0] == '-') {
- switch(argv[u][1]) {
+ while (u < (unsigned)argc) {
+ if (argv[u][0] == '-') {
+ switch (argv[u][1]) {
/* # of records to write between flushing file */
case 'f':
flush_count = HDatol(argv[u + 1]);
- if(flush_count < 0)
+ if (flush_count < 0)
usage();
u += 2;
break;
@@ -321,8 +319,8 @@ int main(int argc, const char *argv[])
/* Random # seed */
case 'r':
use_seed = 1;
- temp = HDatoi(argv[u + 1]);
- if(temp < 0)
+ temp = HDatoi(argv[u + 1]);
+ if (temp < 0)
usage();
else
random_seed = (unsigned)temp;
@@ -333,31 +331,31 @@ int main(int argc, const char *argv[])
usage();
break;
} /* end switch */
- } /* end if */
+ } /* end if */
else {
/* Get the number of records to append */
nops = HDatol(argv[u]);
- if(nops <= 0)
+ if (nops <= 0)
usage();
u++;
} /* end else */
- } /* end while */
- } /* end if */
- if(nops <= 0)
+ } /* end while */
+ } /* end if */
+ if (nops <= 0)
usage();
- if(flush_count >= nops)
+ if (flush_count >= nops)
usage();
/* Emit informational message */
- if(verbose) {
+ if (verbose) {
HDfprintf(stderr, "Parameters:\n");
HDfprintf(stderr, "\t# of operations between flushes = %ld\n", flush_count);
HDfprintf(stderr, "\t# of operations = %ld\n", nops);
} /* end if */
/* Set the random seed */
- if(0 == use_seed) {
+ if (0 == use_seed) {
struct timeval t;
HDgettimeofday(&t, NULL);
random_seed = (unsigned)(t.tv_usec);
@@ -367,19 +365,19 @@ int main(int argc, const char *argv[])
HDfprintf(stderr, "Using writer random seed: %u\n", random_seed);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Generating symbol names\n");
/* Generate dataset names */
- if(generate_symbols() < 0)
+ if (generate_symbols() < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Opening skeleton file: %s\n", FILENAME);
/* Open file skeleton */
- if((fid = open_skeleton(FILENAME, verbose)) < 0) {
+ if ((fid = open_skeleton(FILENAME, verbose)) < 0) {
HDfprintf(stderr, "Error opening skeleton file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
@@ -388,31 +386,31 @@ int main(int argc, const char *argv[])
h5_send_message(WRITER_MESSAGE, NULL, NULL);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Adding and removing records\n");
/* Grow and shrink datasets */
- if(addrem_records(fid, verbose, (unsigned long)nops, (unsigned long)flush_count) < 0) {
+ if (addrem_records(fid, verbose, (unsigned long)nops, (unsigned long)flush_count) < 0) {
HDfprintf(stderr, "Error adding and removing records from datasets!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Releasing symbols\n");
/* Clean up the symbols */
- if(shutdown_symbols() < 0) {
+ if (shutdown_symbols() < 0) {
HDfprintf(stderr, "Error releasing symbols!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing objects\n");
/* Close objects opened */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
HDfprintf(stderr, "Error closing file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
diff --git a/test/swmr_check_compat_vfd.c b/test/swmr_check_compat_vfd.c
index 9b4fbb5..74b023f 100644
--- a/test/swmr_check_compat_vfd.c
+++ b/test/swmr_check_compat_vfd.c
@@ -20,11 +20,10 @@
#include "h5test.h"
/* This file needs to access the file driver testing code */
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
-#include "H5FDpkg.h" /* File drivers */
+#include "H5FDpkg.h" /* File drivers */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -46,7 +45,7 @@ main(void)
driver = HDgetenv("HDF5_DRIVER");
- if(H5FD__supports_swmr_test(driver))
+ if (H5FD__supports_swmr_test(driver))
return EXIT_SUCCESS;
else
return EXIT_FAILURE;
diff --git a/test/swmr_common.c b/test/swmr_common.c
index 7ae1fad..2b1c5d0 100644
--- a/test/swmr_common.c
+++ b/test/swmr_common.c
@@ -74,25 +74,13 @@ unsigned symbol_count[NLEVELS] = {100, 200, 400, 800, 1600};
/* Array of dataset information entries (1 per dataset) */
symbol_info_t *symbol_info[NLEVELS];
-hsize_t PLANES[N_SOURCES][RANK] = {
- {1, SM_HEIGHT, WIDTH},
- {1, LG_HEIGHT, WIDTH},
- {1, SM_HEIGHT, WIDTH},
- {1, LG_HEIGHT, WIDTH},
- {1, SM_HEIGHT, WIDTH},
- {1, LG_HEIGHT, WIDTH}
-};
-
-char FILE_NAMES[N_SOURCES][NAME_LEN] = {
- {"vds_swmr_src_a.h5"},
- {"vds_swmr_src_b.h5"},
- {"vds_swmr_src_c.h5"},
- {"vds_swmr_src_d.h5"},
- {"vds_swmr_src_e.h5"},
- {"vds_swmr_src_f.h5"}
-};
-
-char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5";
+hsize_t PLANES[N_SOURCES][RANK] = {{1, SM_HEIGHT, WIDTH}, {1, LG_HEIGHT, WIDTH}, {1, SM_HEIGHT, WIDTH},
+ {1, LG_HEIGHT, WIDTH}, {1, SM_HEIGHT, WIDTH}, {1, LG_HEIGHT, WIDTH}};
+
+char FILE_NAMES[N_SOURCES][NAME_LEN] = {{"vds_swmr_src_a.h5"}, {"vds_swmr_src_b.h5"}, {"vds_swmr_src_c.h5"},
+ {"vds_swmr_src_d.h5"}, {"vds_swmr_src_e.h5"}, {"vds_swmr_src_f.h5"}};
+
+char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5";
char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
char VDS_DSET_NAME[NAME_LEN] = "vds_dset";
@@ -111,8 +99,8 @@ char VDS_DSET_NAME[NAME_LEN] = "vds_dset";
symbol_info_t *
choose_dataset(void)
{
- unsigned level; /* The level of the dataset */
- unsigned offset; /* The "offset" of the dataset at that level */
+ unsigned level; /* The level of the dataset */
+ unsigned offset; /* The "offset" of the dataset at that level */
/* Determine level of dataset */
level = symbol_mapping[HDrandom() % NMAPPING];
@@ -123,7 +111,6 @@ choose_dataset(void)
return &symbol_info[level][offset];
} /* end choose_dataset() */
-
/*-------------------------------------------------------------------------
* Function: create_symbol_datatype
*
@@ -140,31 +127,30 @@ choose_dataset(void)
hid_t
create_symbol_datatype(void)
{
- hid_t sym_type_id; /* Datatype ID for symbol */
- hid_t opaq_type_id; /* Datatype ID for opaque part of record */
+ hid_t sym_type_id; /* Datatype ID for symbol */
+ hid_t opaq_type_id; /* Datatype ID for opaque part of record */
/* Create opaque datatype to represent other information for this record */
- if((opaq_type_id = H5Tcreate(H5T_OPAQUE, (size_t)DTYPE_SIZE)) < 0)
+ if ((opaq_type_id = H5Tcreate(H5T_OPAQUE, (size_t)DTYPE_SIZE)) < 0)
return -1;
/* Create compound datatype for symbol */
- if((sym_type_id = H5Tcreate(H5T_COMPOUND, sizeof(symbol_t))) < 0)
+ if ((sym_type_id = H5Tcreate(H5T_COMPOUND, sizeof(symbol_t))) < 0)
return -1;
/* Insert fields in symbol datatype */
- if(H5Tinsert(sym_type_id, "rec_id", HOFFSET(symbol_t, rec_id), H5T_NATIVE_UINT64) < 0)
+ if (H5Tinsert(sym_type_id, "rec_id", HOFFSET(symbol_t, rec_id), H5T_NATIVE_UINT64) < 0)
return -1;
- if(H5Tinsert(sym_type_id, "info", HOFFSET(symbol_t, info), opaq_type_id) < 0)
+ if (H5Tinsert(sym_type_id, "info", HOFFSET(symbol_t, info), opaq_type_id) < 0)
return -1;
/* Close opaque datatype */
- if(H5Tclose(opaq_type_id) < 0)
+ if (H5Tclose(opaq_type_id) < 0)
return -1;
return sym_type_id;
} /* end create_symbol_datatype() */
-
/*-------------------------------------------------------------------------
* Function: generate_name
*
@@ -198,7 +184,6 @@ generate_name(char *name_buf, unsigned level, unsigned count)
return 0;
} /* end generate_name() */
-
/*-------------------------------------------------------------------------
* Function: generate_symbols
*
@@ -214,25 +199,24 @@ generate_name(char *name_buf, unsigned level, unsigned count)
int
generate_symbols(void)
{
- unsigned u, v; /* Local index variables */
+ unsigned u, v; /* Local index variables */
- for(u = 0; u < NLEVELS; u++) {
+ for (u = 0; u < NLEVELS; u++) {
symbol_info[u] = (symbol_info_t *)HDmalloc(symbol_count[u] * sizeof(symbol_info_t));
- for(v = 0; v < symbol_count[u]; v++) {
+ for (v = 0; v < symbol_count[u]; v++) {
char name_buf[64];
generate_name(name_buf, u, v);
symbol_info[u][v].name = (char *)HDmalloc(HDstrlen(name_buf) + 1);
HDstrcpy(symbol_info[u][v].name, name_buf);
- symbol_info[u][v].dsid = -1;
+ symbol_info[u][v].dsid = -1;
symbol_info[u][v].nrecords = 0;
} /* end for */
- } /* end for */
+ } /* end for */
return 0;
} /* end generate_symbols() */
-
/*-------------------------------------------------------------------------
* Function: shutdown_symbols
*
@@ -248,11 +232,11 @@ generate_symbols(void)
int
shutdown_symbols(void)
{
- unsigned u, v; /* Local index variables */
+ unsigned u, v; /* Local index variables */
/* Clean up the symbols */
- for(u = 0; u < NLEVELS; u++) {
- for(v = 0; v < symbol_count[u]; v++)
+ for (u = 0; u < NLEVELS; u++) {
+ for (v = 0; v < symbol_count[u]; v++)
HDfree(symbol_info[u][v].name);
HDfree(symbol_info[u]);
} /* end for */
@@ -260,7 +244,6 @@ shutdown_symbols(void)
return 0;
} /* end shutdown_symbols() */
-
/*-------------------------------------------------------------------------
* Function: print_metadata_retries_info
*
@@ -277,33 +260,33 @@ int
print_metadata_retries_info(hid_t fid)
{
H5F_retry_info_t info;
- unsigned i;
+ unsigned i;
/* Retrieve the collection of retries */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
return (-1);
/* Print information for each non-NULL retries[i] */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
unsigned power;
unsigned j;
- if(NULL == info.retries[i])
+ if (NULL == info.retries[i])
continue;
HDfprintf(stderr, "Metadata read retries for item %u:\n", i);
power = 1;
- for(j = 0; j < info.nbins; j++) {
- if(info.retries[i][j])
- HDfprintf(stderr, "\t# of retries for %u - %u retries: %u\n",
- power, (power * 10) - 1, info.retries[i][j]);
+ for (j = 0; j < info.nbins; j++) {
+ if (info.retries[i][j])
+ HDfprintf(stderr, "\t# of retries for %u - %u retries: %u\n", power, (power * 10) - 1,
+ info.retries[i][j]);
power *= 10;
} /* end for */
- } /* end for */
+ } /* end for */
/* Free memory for each non-NULL retries[i] */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
H5free_memory(info.retries[i]);
return 0;
diff --git a/test/swmr_common.h b/test/swmr_common.h
index a0bc581..ce29111 100644
--- a/test/swmr_common.h
+++ b/test/swmr_common.h
@@ -24,12 +24,12 @@
/* Macros */
/**********/
-#define NLEVELS 5 /* # of datasets in the SWMR test file */
+#define NLEVELS 5 /* # of datasets in the SWMR test file */
-#define NMAPPING 9
+#define NMAPPING 9
-#define FILENAME "swmr_data.h5" /* SWMR test file name */
-#define DTYPE_SIZE 150 /* Data size in opaque type */
+#define FILENAME "swmr_data.h5" /* SWMR test file name */
+#define DTYPE_SIZE 150 /* Data size in opaque type */
/* The message sent by writer that the file open is done--releasing the file lock */
#define WRITER_MESSAGE "SWMR_WRITER_MESSAGE"
@@ -40,22 +40,22 @@
/* Information about a symbol/dataset */
typedef struct {
- char *name; /* Dataset name for symbol */
- hid_t dsid; /* Dataset ID for symbol */
- hsize_t nrecords; /* Number of records for the symbol */
+ char * name; /* Dataset name for symbol */
+ hid_t dsid; /* Dataset ID for symbol */
+ hsize_t nrecords; /* Number of records for the symbol */
} symbol_info_t;
/* A symbol's record */
typedef struct {
- uint64_t rec_id; /* ID for this record (unique in symbol) */
- uint8_t info[DTYPE_SIZE]; /* "Other" information for this record */
+ uint64_t rec_id; /* ID for this record (unique in symbol) */
+ uint8_t info[DTYPE_SIZE]; /* "Other" information for this record */
} symbol_t;
/********************/
/* Global Variables */
/********************/
H5TEST_DLLVAR symbol_info_t *symbol_info[NLEVELS];
-H5TEST_DLLVAR unsigned symbol_count[NLEVELS];
+H5TEST_DLLVAR unsigned symbol_count[NLEVELS];
/**************/
/* Prototypes */
@@ -64,12 +64,12 @@ H5TEST_DLLVAR unsigned symbol_count[NLEVELS];
extern "C" {
#endif
-H5TEST_DLL symbol_info_t * choose_dataset(void);
-H5TEST_DLL hid_t create_symbol_datatype(void);
-H5TEST_DLL int generate_name(char *name_buf, unsigned level, unsigned count);
-H5TEST_DLL int generate_symbols(void);
-H5TEST_DLL int shutdown_symbols(void);
-H5TEST_DLL int print_metadata_retries_info(hid_t fid);
+H5TEST_DLL symbol_info_t *choose_dataset(void);
+H5TEST_DLL hid_t create_symbol_datatype(void);
+H5TEST_DLL int generate_name(char *name_buf, unsigned level, unsigned count);
+H5TEST_DLL int generate_symbols(void);
+H5TEST_DLL int shutdown_symbols(void);
+H5TEST_DLL int print_metadata_retries_info(hid_t fid);
#ifdef __cplusplus
}
diff --git a/test/swmr_generator.c b/test/swmr_generator.c
index 7fb08df..931da94 100644
--- a/test/swmr_generator.c
+++ b/test/swmr_generator.c
@@ -31,27 +31,24 @@
/*
* This file needs to access testing codefrom the H5O package.
*/
-#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
-#include "H5Opkg.h" /* Object headers */
-
+#include "H5Opkg.h" /* Object headers */
/****************/
/* Local Macros */
/****************/
-#define CHUNK_SIZE 50 /* Chunk size for created datasets */
+#define CHUNK_SIZE 50 /* Chunk size for created datasets */
/********************/
/* Local Prototypes */
/********************/
-static int gen_skeleton(const char *filename, hbool_t verbose,
- hbool_t swmr_write, int comp_level, const char *index_type,
- unsigned random_seed);
+static int gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write, int comp_level,
+ const char *index_type, unsigned random_seed);
static void usage(void);
-
/*-------------------------------------------------------------------------
* Function: gen_skeleton
*
@@ -83,34 +80,35 @@ static void usage(void);
*-------------------------------------------------------------------------
*/
static int
-gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write,
- int comp_level, const char *index_type, unsigned random_seed)
+gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write, int comp_level,
+ const char *index_type, unsigned random_seed)
{
- hid_t fid; /* File ID for new HDF5 file */
- hid_t fcpl; /* File creation property list */
- hid_t fapl; /* File access property list */
- hid_t dcpl; /* Dataset creation property list */
- hid_t tid; /* Datatype for dataset elements */
- hid_t sid; /* Dataspace ID */
- hid_t aid; /* Attribute ID */
- hsize_t dims[2] = {1, 0}; /* Dataset starting dimensions */
- hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* Dataset maximum dimensions */
- hsize_t chunk_dims[2] = {1, CHUNK_SIZE}; /* Chunk dimensions */
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t fcpl; /* File creation property list */
+ hid_t fapl; /* File access property list */
+ hid_t dcpl; /* Dataset creation property list */
+ hid_t tid; /* Datatype for dataset elements */
+ hid_t sid; /* Dataspace ID */
+ hid_t aid; /* Attribute ID */
+ hsize_t dims[2] = {1, 0}; /* Dataset starting dimensions */
+ hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* Dataset maximum dimensions */
+ hsize_t chunk_dims[2] = {1, CHUNK_SIZE}; /* Chunk dimensions */
#ifdef FILLVAL_WORKS
- symbol_t fillval; /* Dataset fill value */
-#endif /* FILLVAL_WORKS */
- unsigned u, v; /* Local index variable */
+ symbol_t fillval; /* Dataset fill value */
+#endif /* FILLVAL_WORKS */
+ unsigned u, v; /* Local index variable */
HDassert(filename);
HDassert(index_type);
/* Create file access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
return -1;
- /* Can create a file for SWMR support with: (a) (write+latest-format) or (b) (SWMR write+non-latest-format) */
- if(!swmr_write) {
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ /* Can create a file for SWMR support with: (a) (write+latest-format) or (b) (SWMR
+ * write+non-latest-format) */
+ if (!swmr_write) {
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
}
@@ -118,54 +116,54 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write,
* With one unlimited dimension, we get the extensible array index
* type, with two unlimited dimensions, we get a v2 B-tree.
*/
- if(!HDstrcmp(index_type, "b2"))
+ if (!HDstrcmp(index_type, "b2"))
max_dims[0] = H5S_UNLIMITED;
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Creating file\n");
/* Create the file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (swmr_write ? H5F_ACC_SWMR_WRITE : 0), fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (swmr_write ? H5F_ACC_SWMR_WRITE : 0), fcpl, fapl)) < 0)
return -1;
/* Close file creation property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
return -1;
/* Close file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
/* Create attribute with (shared) random number seed - for sparse test */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
return -1;
- if((aid = H5Acreate2(fid, "seed", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(fid, "seed", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- if(H5Awrite(aid, H5T_NATIVE_UINT, &random_seed) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_UINT, &random_seed) < 0)
return -1;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
return -1;
/* Create datatype for creating datasets */
- if((tid = create_symbol_datatype()) < 0)
+ if ((tid = create_symbol_datatype()) < 0)
return -1;
/* Create dataspace for creating datasets */
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
return -1;
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
return -1;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
return -1;
- if(comp_level >= 0) {
- if(H5Pset_deflate(dcpl, (unsigned)comp_level) < 0)
+ if (comp_level >= 0) {
+ if (H5Pset_deflate(dcpl, (unsigned)comp_level) < 0)
return -1;
} /* end if */
#ifdef FILLVAL_WORKS
@@ -174,23 +172,24 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write,
* here when this is fixed. -NAF 8/11/11 */
HDmemset(&fillval, 0, sizeof(fillval));
fillval.rec_id = (uint64_t)ULLONG_MAX;
- if(H5Pset_fill_value(dcpl, tid, &fillval) < 0)
+ if (H5Pset_fill_value(dcpl, tid, &fillval) < 0)
return -1;
#endif /* FILLVAL_WORKS */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Creating datasets\n");
/* Create the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++) {
- hid_t dsid; /* Dataset ID */
- char name_buf[64];
- hbool_t move_dataspace_message = FALSE; /* Whether to move the dataspace message out of object header chunk #0 */
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++) {
+ hid_t dsid; /* Dataset ID */
+ char name_buf[64];
+ hbool_t move_dataspace_message =
+ FALSE; /* Whether to move the dataspace message out of object header chunk #0 */
generate_name(name_buf, u, v);
- if((dsid = H5Dcreate2(fid, name_buf, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, name_buf, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
return -1;
/* Determine if the dataspace message for this dataset should be
@@ -198,38 +197,38 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write,
* (Set to TRUE for every fourth dataset)
*/
move_dataspace_message = !(HDrandom() % 4);
- if(move_dataspace_message) {
- unsigned chunk_num; /* Object header chunk # for dataspace message */
+ if (move_dataspace_message) {
+ unsigned chunk_num; /* Object header chunk # for dataspace message */
/* Move the dataspace message to a new object header chunk */
- if(H5O__msg_move_to_new_chunk_test(dsid, H5O_SDSPACE_ID) < 0)
+ if (H5O__msg_move_to_new_chunk_test(dsid, H5O_SDSPACE_ID) < 0)
return -1;
/* Retrieve the chunk # for the dataspace message */
chunk_num = UINT_MAX;
- if(H5O__msg_get_chunkno_test(dsid, H5O_SDSPACE_ID, &chunk_num) < 0)
+ if (H5O__msg_get_chunkno_test(dsid, H5O_SDSPACE_ID, &chunk_num) < 0)
return -1;
/* Should not be in chunk #0 for now */
- if(0 == chunk_num)
+ if (0 == chunk_num)
return -1;
} /* end if */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
return -1;
} /* end for */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing objects\n");
/* Close everythign */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
return -1;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
return -1;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
return 0;
@@ -258,27 +257,28 @@ usage(void)
HDexit(EXIT_FAILURE);
} /* end usage() */
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- int comp_level = -1; /* Compression level (-1 is no compression) */
- hbool_t verbose = TRUE; /* Whether to emit some informational messages */
- hbool_t swmr_write = FALSE; /* Whether to create file with SWMR_WRITE access */
- const char *index_type = "b1"; /* Chunk index type */
- hbool_t use_seed = FALSE; /* Set to TRUE if a seed was set on the command line */
- unsigned random_seed = 0; /* Random # seed */
- unsigned u; /* Local index variables */
- int temp;
+ int comp_level = -1; /* Compression level (-1 is no compression) */
+ hbool_t verbose = TRUE; /* Whether to emit some informational messages */
+ hbool_t swmr_write = FALSE; /* Whether to create file with SWMR_WRITE access */
+ const char *index_type = "b1"; /* Chunk index type */
+ hbool_t use_seed = FALSE; /* Set to TRUE if a seed was set on the command line */
+ unsigned random_seed = 0; /* Random # seed */
+ unsigned u; /* Local index variables */
+ int temp;
/* Parse command line options */
- if(argc > 1) {
+ if (argc > 1) {
u = 1;
- while(u < (unsigned)argc) {
- if(argv[u][0] == '-') {
- switch(argv[u][1]) {
+ while (u < (unsigned)argc) {
+ if (argv[u][0] == '-') {
+ switch (argv[u][1]) {
/* Compress dataset chunks */
case 'c':
comp_level = HDatoi(argv[u + 1]);
- if(comp_level < -1 || comp_level > 9)
+ if (comp_level < -1 || comp_level > 9)
usage();
u += 2;
break;
@@ -286,8 +286,7 @@ int main(int argc, const char *argv[])
/* Chunk index type */
case 'i':
index_type = argv[u + 1];
- if(HDstrcmp(index_type, "ea")
- && HDstrcmp(index_type, "b2"))
+ if (HDstrcmp(index_type, "ea") && HDstrcmp(index_type, "b2"))
usage();
u += 2;
break;
@@ -295,8 +294,8 @@ int main(int argc, const char *argv[])
/* Random # seed */
case 'r':
use_seed = TRUE;
- temp = HDatoi(argv[u + 1]);
- if(temp < 0)
+ temp = HDatoi(argv[u + 1]);
+ if (temp < 0)
usage();
else
random_seed = (unsigned)temp;
@@ -319,12 +318,12 @@ int main(int argc, const char *argv[])
usage();
break;
} /* end switch */
- } /* end if */
- } /* end while */
- } /* end if */
+ } /* end if */
+ } /* end while */
+ } /* end if */
/* Emit informational message */
- if(verbose) {
+ if (verbose) {
HDfprintf(stderr, "Parameters:\n");
HDfprintf(stderr, "\tswmr writes %s\n", swmr_write ? "on" : "off");
HDfprintf(stderr, "\tcompression level = %d\n", comp_level);
@@ -332,7 +331,7 @@ int main(int argc, const char *argv[])
} /* end if */
/* Set the random seed */
- if(!use_seed) {
+ if (!use_seed) {
struct timeval t;
HDgettimeofday(&t, NULL);
@@ -343,11 +342,11 @@ int main(int argc, const char *argv[])
HDfprintf(stderr, "Using generator random seed (used in sparse test only): %u\n", random_seed);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Generating skeleton file: %s\n", FILENAME);
/* Generate file skeleton */
- if(gen_skeleton(FILENAME, verbose, swmr_write, comp_level, index_type, random_seed) < 0) {
+ if (gen_skeleton(FILENAME, verbose, swmr_write, comp_level, index_type, random_seed) < 0) {
HDfprintf(stderr, "Error generating skeleton file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
diff --git a/test/swmr_reader.c b/test/swmr_reader.c
index ee263e3..e80fa71 100644
--- a/test/swmr_reader.c
+++ b/test/swmr_reader.c
@@ -35,19 +35,17 @@
/* Local Prototypes */
/********************/
-static int check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file,
- const char *sym_name, symbol_t *record, hid_t rec_sid);
-static int read_records(const char *filename, hbool_t verbose, FILE *verbose_file,
- unsigned random_seed, unsigned long nseconds, unsigned poll_time,
- unsigned ncommon, unsigned nrandom);
+static int check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file, const char *sym_name,
+ symbol_t *record, hid_t rec_sid);
+static int read_records(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned random_seed,
+ unsigned long nseconds, unsigned poll_time, unsigned ncommon, unsigned nrandom);
/*******************/
/* Local Variables */
/*******************/
-static hid_t symbol_tid = -1; /* The type ID for the SWMR datasets */
+static hid_t symbol_tid = -1; /* The type ID for the SWMR datasets */
-
/*-------------------------------------------------------------------------
* Function: check_dataset
*
@@ -81,13 +79,13 @@ static hid_t symbol_tid = -1; /* The type ID for the SWMR datasets */
*-------------------------------------------------------------------------
*/
static int
-check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file,
- const char *sym_name, symbol_t *record, hid_t rec_sid)
+check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file, const char *sym_name, symbol_t *record,
+ hid_t rec_sid)
{
- hid_t dsid; /* Dataset ID */
- hid_t file_sid; /* Dataset's space ID */
- hssize_t snpoints; /* Number of elements in dataset */
- hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
+ hid_t dsid; /* Dataset ID */
+ hid_t file_sid; /* Dataset's space ID */
+ hssize_t snpoints; /* Number of elements in dataset */
+ hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
HDassert(fid >= 0);
HDassert(sym_name);
@@ -95,60 +93,62 @@ check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file,
HDassert(rec_sid >= 0);
/* Open dataset for symbol */
- if((dsid = H5Dopen2(fid, sym_name, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, sym_name, H5P_DEFAULT)) < 0)
return -1;
/* Get the dataset's dataspace */
- if((file_sid = H5Dget_space(dsid)) < 0)
+ if ((file_sid = H5Dget_space(dsid)) < 0)
return -1;
/* Get the number of elements (= records, for 1-D datasets) */
- if((snpoints = H5Sget_simple_extent_npoints(file_sid)) < 0)
+ if ((snpoints = H5Sget_simple_extent_npoints(file_sid)) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Symbol = '%s', # of records = %lld\n", sym_name, (long long)snpoints);
/* Check if there are records for symbol */
- if(snpoints > 0) {
+ if (snpoints > 0) {
/* Choose the last record in the dataset */
start[1] = (hsize_t)(snpoints - 1);
- if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
return -1;
/* Read record from dataset */
record->rec_id = (uint64_t)ULLONG_MAX;
- if(H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0)
+ if (H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0)
return -1;
/* Verify record value */
- if(record->rec_id != start[1]) {
+ if (record->rec_id != start[1]) {
struct timeval tv;
HDgettimeofday(&tv, NULL);
- if(verbose) {
+ if (verbose) {
HDfprintf(verbose_file, "*** ERROR ***\n");
HDfprintf(verbose_file, "Incorrect record value!\n");
- HDfprintf(verbose_file, "Time = %llu.%llu, Symbol = '%s', # of records = %lld, record->rec_id = %llu\n", (unsigned long long)tv.tv_sec, (unsigned long long)tv.tv_usec, sym_name, (long long)snpoints, (unsigned long long)record->rec_id);
+ HDfprintf(verbose_file,
+ "Time = %llu.%llu, Symbol = '%s', # of records = %lld, record->rec_id = %llu\n",
+ (unsigned long long)tv.tv_sec, (unsigned long long)tv.tv_usec, sym_name,
+ (long long)snpoints, (unsigned long long)record->rec_id);
} /* end if */
return -1;
} /* end if */
- } /* end if */
+ } /* end if */
/* Close the dataset's dataspace */
- if(H5Sclose(file_sid) < 0)
+ if (H5Sclose(file_sid) < 0)
return -1;
/* Close dataset for symbol */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
return -1;
return 0;
} /* end check_dataset() */
-
/*-------------------------------------------------------------------------
* Function: read_records
*
@@ -191,20 +191,19 @@ check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file,
*-------------------------------------------------------------------------
*/
static int
-read_records(const char *filename, hbool_t verbose, FILE *verbose_file,
- unsigned random_seed, unsigned long nseconds, unsigned poll_time,
- unsigned ncommon, unsigned nrandom)
+read_records(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned random_seed,
+ unsigned long nseconds, unsigned poll_time, unsigned ncommon, unsigned nrandom)
{
- time_t start_time; /* Starting time */
- time_t curr_time; /* Current time */
- symbol_info_t **sym_com = NULL; /* Pointers to array of common dataset IDs */
- symbol_info_t **sym_rand = NULL; /* Pointers to array of random dataset IDs */
- hid_t mem_sid; /* Memory dataspace ID */
- hid_t fid; /* SWMR test file ID */
- hid_t fapl; /* file access property list */
- symbol_t record; /* The record to read from the dataset */
- unsigned v; /* Local index variable */
- hbool_t use_log_vfd = FALSE; /* Use the log VFD (set this manually) */
+ time_t start_time; /* Starting time */
+ time_t curr_time; /* Current time */
+ symbol_info_t **sym_com = NULL; /* Pointers to array of common dataset IDs */
+ symbol_info_t **sym_rand = NULL; /* Pointers to array of random dataset IDs */
+ hid_t mem_sid; /* Memory dataspace ID */
+ hid_t fid; /* SWMR test file ID */
+ hid_t fapl; /* file access property list */
+ symbol_t record; /* The record to read from the dataset */
+ unsigned v; /* Local index variable */
+ hbool_t use_log_vfd = FALSE; /* Use the log VFD (set this manually) */
HDassert(filename);
HDassert(nseconds != 0);
@@ -215,69 +214,69 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file,
HDmemset(&record, 0, sizeof(record));
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Choosing datasets\n");
/* Allocate space for 'common' datasets, if any */
- if(ncommon > 0) {
+ if (ncommon > 0) {
/* Allocate array to hold pointers to symbols for common datasets */
- if(NULL == (sym_com = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * ncommon)))
+ if (NULL == (sym_com = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * ncommon)))
return -1;
/* Open the common datasets */
- for(v = 0; v < ncommon; v++) {
- unsigned offset; /* Offset of symbol to use */
+ for (v = 0; v < ncommon; v++) {
+ unsigned offset; /* Offset of symbol to use */
/* Determine the offset of the symbol, within level 0 symbols */
/* (level 0 symbols are the most common symbols) */
- offset = (unsigned)((unsigned)HDrandom() % symbol_count[0]);
+ offset = (unsigned)((unsigned)HDrandom() % symbol_count[0]);
sym_com[v] = &symbol_info[0][offset];
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Common symbol #%u = '%s'\n", v, symbol_info[0][offset].name);
} /* end for */
- } /* end if */
+ } /* end if */
/* Allocate space for 'random' datasets, if any */
- if(nrandom > 0) {
+ if (nrandom > 0) {
/* Allocate array to hold pointers to symbols for random datasets */
- if(NULL == (sym_rand = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * nrandom)))
+ if (NULL == (sym_rand = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * nrandom)))
return -1;
/* Determine the random datasets */
- for(v = 0; v < nrandom; v++) {
- symbol_info_t *sym; /* Symbol to use */
+ for (v = 0; v < nrandom; v++) {
+ symbol_info_t *sym; /* Symbol to use */
/* Determine the symbol, within all symbols */
- if(NULL == (sym = choose_dataset()))
+ if (NULL == (sym = choose_dataset()))
return -1;
sym_rand[v] = sym;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Random symbol #%u = '%s'\n", v, sym->name);
} /* end for */
- } /* end if */
+ } /* end if */
/* Create a dataspace for the record to read */
- if((mem_sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((mem_sid = H5Screate(H5S_SCALAR)) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Reading records\n");
/* Get the starting time */
start_time = HDtime(NULL);
- curr_time = start_time;
+ curr_time = start_time;
/* Create file access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
return -1;
/* Log I/O when verbose output it enbabled */
- if(use_log_vfd) {
+ if (use_log_vfd) {
char verbose_name[1024];
HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_reader.log.%u", random_seed);
@@ -286,52 +285,52 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file,
} /* end if */
/* Loop over reading records until [at least] the correct # of seconds have passed */
- while(curr_time < (time_t)(start_time + (time_t)nseconds)) {
+ while (curr_time < (time_t)(start_time + (time_t)nseconds)) {
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Opening file: %s\n", filename);
/* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
return -1;
/* Check 'common' datasets, if any */
- if(ncommon > 0) {
+ if (ncommon > 0) {
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Checking common symbols\n");
/* Iterate over common datasets */
- for(v = 0; v < ncommon; v++) {
+ for (v = 0; v < ncommon; v++) {
/* Check common dataset */
- if(check_dataset(fid, verbose, verbose_file, sym_com[v]->name, &record, mem_sid) < 0)
+ if (check_dataset(fid, verbose, verbose_file, sym_com[v]->name, &record, mem_sid) < 0)
return -1;
HDmemset(&record, 0, sizeof(record));
} /* end for */
- } /* end if */
+ } /* end if */
/* Check 'random' datasets, if any */
- if(nrandom > 0) {
+ if (nrandom > 0) {
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Checking random symbols\n");
/* Iterate over random datasets */
- for(v = 0; v < nrandom; v++) {
+ for (v = 0; v < nrandom; v++) {
/* Check random dataset */
- if(check_dataset(fid, verbose, verbose_file, sym_rand[v]->name, &record, mem_sid) < 0)
+ if (check_dataset(fid, verbose, verbose_file, sym_rand[v]->name, &record, mem_sid) < 0)
return -1;
HDmemset(&record, 0, sizeof(record));
} /* end for */
- } /* end if */
+ } /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Closing file\n");
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/* Sleep for the appropriate # of seconds */
@@ -342,25 +341,25 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file,
} /* end while */
/* Close the memory dataspace */
- if(H5Sclose(mem_sid) < 0)
+ if (H5Sclose(mem_sid) < 0)
return -1;
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Closing datasets\n");
/* Close 'random' datasets, if any */
- if(nrandom > 0) {
+ if (nrandom > 0) {
/* Release array holding dataset ID's for random datasets */
HDfree(sym_rand);
} /* end if */
/* Close 'common' datasets, if any */
- if(ncommon > 0) {
+ if (ncommon > 0) {
/* Release array holding dataset ID's for common datasets */
HDfree(sym_com);
} /* end if */
@@ -387,31 +386,32 @@ usage(void)
HDexit(EXIT_FAILURE);
}
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- long nseconds = 0; /* # of seconds to test */
- int poll_time = 1; /* # of seconds between polling */
- int ncommon = 5; /* # of common symbols to poll */
- int nrandom = 10; /* # of random symbols to poll */
- hbool_t verbose = TRUE; /* Whether to emit some informational messages */
- FILE *verbose_file = NULL; /* File handle for verbose output */
- hbool_t use_seed = FALSE; /* Set to 1 if a seed was set on the command line */
- unsigned random_seed = 0; /* Random # seed */
- unsigned u; /* Local index variables */
- int temp;
+ long nseconds = 0; /* # of seconds to test */
+ int poll_time = 1; /* # of seconds between polling */
+ int ncommon = 5; /* # of common symbols to poll */
+ int nrandom = 10; /* # of random symbols to poll */
+ hbool_t verbose = TRUE; /* Whether to emit some informational messages */
+ FILE * verbose_file = NULL; /* File handle for verbose output */
+ hbool_t use_seed = FALSE; /* Set to 1 if a seed was set on the command line */
+ unsigned random_seed = 0; /* Random # seed */
+ unsigned u; /* Local index variables */
+ int temp;
/* Parse command line options */
- if(argc < 2)
+ if (argc < 2)
usage();
- if(argc > 1) {
+ if (argc > 1) {
u = 1;
- while(u < (unsigned)argc) {
- if(argv[u][0] == '-') {
- switch(argv[u][1]) {
+ while (u < (unsigned)argc) {
+ if (argv[u][0] == '-') {
+ switch (argv[u][1]) {
/* # of common symbols to poll */
case 'h':
ncommon = HDatoi(argv[u + 1]);
- if(ncommon < 0)
+ if (ncommon < 0)
usage();
u += 2;
break;
@@ -419,7 +419,7 @@ int main(int argc, const char *argv[])
/* # of random symbols to poll */
case 'l':
nrandom = HDatoi(argv[u + 1]);
- if(nrandom < 0)
+ if (nrandom < 0)
usage();
u += 2;
break;
@@ -433,8 +433,8 @@ int main(int argc, const char *argv[])
/* Random # seed */
case 'r':
use_seed = TRUE;
- temp = HDatoi(argv[u + 1]);
- if(temp < 0)
+ temp = HDatoi(argv[u + 1]);
+ if (temp < 0)
usage();
else
random_seed = (unsigned)temp;
@@ -444,7 +444,7 @@ int main(int argc, const char *argv[])
/* # of seconds between polling */
case 's':
poll_time = HDatoi(argv[u + 1]);
- if(poll_time < 0)
+ if (poll_time < 0)
usage();
u += 2;
break;
@@ -453,24 +453,24 @@ int main(int argc, const char *argv[])
usage();
break;
} /* end switch */
- } /* end if */
+ } /* end if */
else {
/* Get the number of records to append */
nseconds = HDatol(argv[u]);
- if(nseconds <= 0)
+ if (nseconds <= 0)
usage();
u++;
} /* end else */
- } /* end while */
- } /* end if */
- if(nseconds <= 0)
+ } /* end while */
+ } /* end if */
+ if (nseconds <= 0)
usage();
- if(poll_time >= nseconds)
+ if (poll_time >= nseconds)
usage();
/* Set the random seed */
- if(!use_seed) {
+ if (!use_seed) {
struct timeval t;
HDgettimeofday(&t, NULL);
@@ -479,18 +479,18 @@ int main(int argc, const char *argv[])
HDsrandom(random_seed);
/* Open output file */
- if(verbose) {
+ if (verbose) {
char verbose_name[1024];
HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_reader.out.%u", random_seed);
- if(NULL == (verbose_file = HDfopen(verbose_name, "w"))) {
+ if (NULL == (verbose_file = HDfopen(verbose_name, "w"))) {
HDfprintf(stderr, "Can't open verbose output file!\n");
HDexit(EXIT_FAILURE);
}
} /* end if */
/* Emit informational message */
- if(verbose) {
+ if (verbose) {
HDfprintf(verbose_file, "Parameters:\n");
HDfprintf(verbose_file, "\t# of seconds between polling = %d\n", poll_time);
HDfprintf(verbose_file, "\t# of common symbols to poll = %d\n", ncommon);
@@ -502,45 +502,45 @@ int main(int argc, const char *argv[])
HDfprintf(stdout, "Using reader random seed: %u\n", random_seed);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Generating symbol names\n");
/* Generate dataset names */
- if(generate_symbols() < 0) {
+ if (generate_symbols() < 0) {
HDfprintf(stderr, "Error generating symbol names!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Create datatype for creating datasets */
- if((symbol_tid = create_symbol_datatype()) < 0)
+ if ((symbol_tid = create_symbol_datatype()) < 0)
return -1;
/* Reading records from datasets */
- if(read_records(FILENAME, verbose, verbose_file, random_seed, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) {
+ if (read_records(FILENAME, verbose, verbose_file, random_seed, (unsigned long)nseconds,
+ (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) {
HDfprintf(stderr, "Error reading records from datasets (random_seed = %u)!\n", random_seed);
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Releasing symbols\n");
/* Clean up the symbols */
- if(shutdown_symbols() < 0) {
+ if (shutdown_symbols() < 0) {
HDfprintf(stderr, "Error releasing symbols!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Closing objects\n");
/* Close objects created */
- if(H5Tclose(symbol_tid) < 0) {
+ if (H5Tclose(symbol_tid) < 0) {
HDfprintf(stderr, "Error closing symbol datatype!\n");
HDexit(EXIT_FAILURE);
} /* end if */
return 0;
}
-
diff --git a/test/swmr_remove_reader.c b/test/swmr_remove_reader.c
index b02d16f..9017793 100644
--- a/test/swmr_remove_reader.c
+++ b/test/swmr_remove_reader.c
@@ -42,13 +42,11 @@ static hid_t symbol_tid = -1;
/* Local Prototypes */
/********************/
-static int check_dataset(hid_t fid, unsigned verbose, const char *sym_name,
- symbol_t *record, hid_t rec_sid);
-static int read_records(const char *filename, unsigned verbose, unsigned long nseconds,
- unsigned poll_time, unsigned ncommon, unsigned nrandom);
+static int check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *record, hid_t rec_sid);
+static int read_records(const char *filename, unsigned verbose, unsigned long nseconds, unsigned poll_time,
+ unsigned ncommon, unsigned nrandom);
static void usage(void);
-
/*-------------------------------------------------------------------------
* Function: check_dataset
*
@@ -79,13 +77,12 @@ static void usage(void);
*-------------------------------------------------------------------------
*/
static int
-check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *record,
- hid_t rec_sid)
+check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *record, hid_t rec_sid)
{
- hid_t dsid; /* Dataset ID */
- hid_t file_sid; /* Dataset's space ID */
- hssize_t snpoints; /* Number of elements in dataset */
- hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
+ hid_t dsid; /* Dataset ID */
+ hid_t file_sid; /* Dataset's space ID */
+ hssize_t snpoints; /* Number of elements in dataset */
+ hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
HDassert(fid >= 0);
HDassert(sym_name);
@@ -93,67 +90,67 @@ check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *recor
HDassert(rec_sid >= 0);
/* Open dataset for symbol */
- if((dsid = H5Dopen2(fid, sym_name, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, sym_name, H5P_DEFAULT)) < 0)
return -1;
/* Get the dataset's dataspace */
- if((file_sid = H5Dget_space(dsid)) < 0)
+ if ((file_sid = H5Dget_space(dsid)) < 0)
return -1;
/* Get the number of elements (= records, for 1-D datasets) */
- if((snpoints = H5Sget_simple_extent_npoints(file_sid)) < 0)
+ if ((snpoints = H5Sget_simple_extent_npoints(file_sid)) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Symbol = '%s', # of records = %lld\n", sym_name, (long long)snpoints);
/* Check if there are records for symbol */
- if(snpoints > 0) {
+ if (snpoints > 0) {
/* Choose a random record in the dataset, choosing the last record half
* the time */
start[1] = (hsize_t)(HDrandom() % (snpoints * 2));
- if(start[1] > (hsize_t)(snpoints - 1))
+ if (start[1] > (hsize_t)(snpoints - 1))
start[1] = (hsize_t)(snpoints - 1);
- if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
return -1;
- /* Read record from dataset */
+ /* Read record from dataset */
#ifdef FILLVAL_WORKS
/* When shrinking the dataset, we cannot guarantee that the buffer will
* even be touched, unless there is a fill value. Since fill values do
* not work with SWMR currently (see note in swmr_generator.c), we
* simply initialize rec_id to 0. */
record->rec_id = (uint64_t)ULLONG_MAX - 1;
-#else /* FILLVAL_WORKS */
+#else /* FILLVAL_WORKS */
record->rec_id = (uint64_t)0;
#endif /* FILLVAL_WORKS */
- if(H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0)
+ if (H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0)
return -1;
/* Verify record value - note that it may be the fill value, because the
* chunk may be deleted before the object header has the updated
* dimensions */
- if(record->rec_id != start[1] && record->rec_id != (uint64_t)0) {
+ if (record->rec_id != start[1] && record->rec_id != (uint64_t)0) {
HDfprintf(stderr, "*** ERROR ***\n");
HDfprintf(stderr, "Incorrect record value!\n");
- HDfprintf(stderr, "Symbol = '%s', # of records = %lld, record->rec_id = %llx\n", sym_name, (long long)snpoints, (unsigned long long)record->rec_id);
+ HDfprintf(stderr, "Symbol = '%s', # of records = %lld, record->rec_id = %llx\n", sym_name,
+ (long long)snpoints, (unsigned long long)record->rec_id);
return -1;
} /* end if */
- } /* end if */
+ } /* end if */
/* Close the dataset's dataspace */
- if(H5Sclose(file_sid) < 0)
+ if (H5Sclose(file_sid) < 0)
return -1;
/* Close dataset for symbol */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
return -1;
return 0;
} /* end check_dataset() */
-
/*-------------------------------------------------------------------------
* Function: read_records
*
@@ -190,18 +187,18 @@ check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *recor
*-------------------------------------------------------------------------
*/
static int
-read_records(const char *filename, unsigned verbose, unsigned long nseconds,
- unsigned poll_time, unsigned ncommon, unsigned nrandom)
+read_records(const char *filename, unsigned verbose, unsigned long nseconds, unsigned poll_time,
+ unsigned ncommon, unsigned nrandom)
{
- time_t start_time; /* Starting time */
- time_t curr_time; /* Current time */
- symbol_info_t **sym_com = NULL; /* Pointers to array of common dataset IDs */
- symbol_info_t **sym_rand = NULL; /* Pointers to array of random dataset IDs */
- hid_t mem_sid; /* Memory dataspace ID */
- hid_t fid; /* SWMR test file ID */
- hid_t fapl; /* File access property list */
- symbol_t record; /* The record to add to the dataset */
- unsigned v; /* Local index variable */
+ time_t start_time; /* Starting time */
+ time_t curr_time; /* Current time */
+ symbol_info_t **sym_com = NULL; /* Pointers to array of common dataset IDs */
+ symbol_info_t **sym_rand = NULL; /* Pointers to array of random dataset IDs */
+ hid_t mem_sid; /* Memory dataspace ID */
+ hid_t fid; /* SWMR test file ID */
+ hid_t fapl; /* File access property list */
+ symbol_t record; /* The record to add to the dataset */
+ unsigned v; /* Local index variable */
HDassert(filename);
HDassert(nseconds != 0);
@@ -212,114 +209,114 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds,
HDmemset(&record, 0, sizeof(record));
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Choosing datasets\n");
/* Allocate space for 'common' datasets, if any */
- if(ncommon > 0) {
+ if (ncommon > 0) {
/* Allocate array to hold pointers to symbols for common datasets */
- if(NULL == (sym_com = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * ncommon)))
+ if (NULL == (sym_com = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * ncommon)))
return -1;
/* Open the common datasets */
- for(v = 0; v < ncommon; v++) {
- unsigned offset; /* Offset of symbol to use */
+ for (v = 0; v < ncommon; v++) {
+ unsigned offset; /* Offset of symbol to use */
/* Determine the offset of the symbol, within level 0 symbols */
/* (level 0 symbols are the most common symbols) */
- offset = (unsigned)HDrandom() % symbol_count[0];
+ offset = (unsigned)HDrandom() % symbol_count[0];
sym_com[v] = &symbol_info[0][offset];
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Common symbol #%u = '%s'\n", v, symbol_info[0][offset].name);
} /* end for */
- } /* end if */
+ } /* end if */
/* Allocate space for 'random' datasets, if any */
- if(nrandom > 0) {
+ if (nrandom > 0) {
/* Allocate array to hold pointers to symbols for random datasets */
- if(NULL == (sym_rand = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * nrandom)))
+ if (NULL == (sym_rand = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * nrandom)))
return -1;
/* Determine the random datasets */
- for(v = 0; v < nrandom; v++) {
- symbol_info_t *sym; /* Symbol to use */
+ for (v = 0; v < nrandom; v++) {
+ symbol_info_t *sym; /* Symbol to use */
/* Determine the symbol, within all symbols */
- if(NULL == (sym = choose_dataset()))
+ if (NULL == (sym = choose_dataset()))
return -1;
sym_rand[v] = sym;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Random symbol #%u = '%s'\n", v, sym->name);
} /* end for */
- } /* end if */
+ } /* end if */
/* Create a dataspace for the record to read */
- if((mem_sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((mem_sid = H5Screate(H5S_SCALAR)) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Reading records\n");
/* Get the starting time */
start_time = HDtime(NULL);
- curr_time = start_time;
+ curr_time = start_time;
/* Create file access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
return -1;
/* Loop over reading records until [at least] the correct # of seconds have passed */
- while(curr_time < (time_t)(start_time + (time_t)nseconds)) {
+ while (curr_time < (time_t)(start_time + (time_t)nseconds)) {
/* Emit informational message */
- if(verbose)
- HDfprintf(stderr, "Opening file: %s\n", filename);
+ if (verbose)
+ HDfprintf(stderr, "Opening file: %s\n", filename);
/* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
return -1;
/* Check 'common' datasets, if any */
- if(ncommon > 0) {
+ if (ncommon > 0) {
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Checking common symbols\n");
/* Iterate over common datasets */
- for(v = 0; v < ncommon; v++) {
+ for (v = 0; v < ncommon; v++) {
/* Check common dataset */
- if(check_dataset(fid, verbose, sym_com[v]->name, &record, mem_sid) < 0)
+ if (check_dataset(fid, verbose, sym_com[v]->name, &record, mem_sid) < 0)
return -1;
HDmemset(&record, 0, sizeof(record));
} /* end for */
- } /* end if */
+ } /* end if */
/* Check 'random' datasets, if any */
- if(nrandom > 0) {
+ if (nrandom > 0) {
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Checking random symbols\n");
/* Iterate over random datasets */
- for(v = 0; v < nrandom; v++) {
+ for (v = 0; v < nrandom; v++) {
/* Check random dataset */
- if(check_dataset(fid, verbose, sym_rand[v]->name, &record, mem_sid) < 0)
+ if (check_dataset(fid, verbose, sym_rand[v]->name, &record, mem_sid) < 0)
return -1;
HDmemset(&record, 0, sizeof(record));
} /* end for */
- } /* end if */
+ } /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing file\n");
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/* Sleep for the appropriate # of seconds */
@@ -330,25 +327,25 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds,
} /* end while */
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
/* Close the memory dataspace */
- if(H5Sclose(mem_sid) < 0)
+ if (H5Sclose(mem_sid) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing datasets\n");
/* Close 'random' datasets, if any */
- if(nrandom > 0) {
+ if (nrandom > 0) {
/* Release array holding dataset ID's for random datasets */
HDfree(sym_rand);
} /* end if */
/* Close 'common' datasets, if any */
- if(ncommon > 0) {
+ if (ncommon > 0) {
/* Release array holding dataset ID's for common datasets */
HDfree(sym_com);
} /* end if */
@@ -373,30 +370,31 @@ usage(void)
HDexit(EXIT_FAILURE);
}
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- long nseconds = 0; /* # of seconds to test */
- int poll_time = 1; /* # of seconds between polling */
- int ncommon = 5; /* # of common symbols to poll */
- int nrandom = 10; /* # of random symbols to poll */
- unsigned verbose = 1; /* Whether to emit some informational messages */
- unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */
- unsigned random_seed = 0; /* Random # seed */
- unsigned u; /* Local index variables */
- int temp;
+ long nseconds = 0; /* # of seconds to test */
+ int poll_time = 1; /* # of seconds between polling */
+ int ncommon = 5; /* # of common symbols to poll */
+ int nrandom = 10; /* # of random symbols to poll */
+ unsigned verbose = 1; /* Whether to emit some informational messages */
+ unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */
+ unsigned random_seed = 0; /* Random # seed */
+ unsigned u; /* Local index variables */
+ int temp;
/* Parse command line options */
- if(argc < 2)
+ if (argc < 2)
usage();
- if(argc > 1) {
+ if (argc > 1) {
u = 1;
- while(u < (unsigned)argc) {
- if(argv[u][0] == '-') {
- switch(argv[u][1]) {
+ while (u < (unsigned)argc) {
+ if (argv[u][0] == '-') {
+ switch (argv[u][1]) {
/* # of common symbols to poll */
case 'h':
ncommon = HDatoi(argv[u + 1]);
- if(ncommon < 0)
+ if (ncommon < 0)
usage();
u += 2;
break;
@@ -404,7 +402,7 @@ int main(int argc, const char *argv[])
/* # of random symbols to poll */
case 'l':
nrandom = HDatoi(argv[u + 1]);
- if(nrandom < 0)
+ if (nrandom < 0)
usage();
u += 2;
break;
@@ -418,8 +416,8 @@ int main(int argc, const char *argv[])
/* Random # seed */
case 'r':
use_seed = 1;
- temp = HDatoi(argv[u + 1]);
- if(temp < 0)
+ temp = HDatoi(argv[u + 1]);
+ if (temp < 0)
usage();
else
random_seed = (unsigned)temp;
@@ -429,7 +427,7 @@ int main(int argc, const char *argv[])
/* # of seconds between polling */
case 's':
poll_time = HDatoi(argv[u + 1]);
- if(poll_time < 0)
+ if (poll_time < 0)
usage();
u += 2;
break;
@@ -438,24 +436,24 @@ int main(int argc, const char *argv[])
usage();
break;
} /* end switch */
- } /* end if */
+ } /* end if */
else {
/* Get the number of records to append */
nseconds = HDatol(argv[u]);
- if(nseconds <= 0)
+ if (nseconds <= 0)
usage();
u++;
} /* end else */
- } /* end while */
- } /* end if */
- if(nseconds <= 0)
+ } /* end while */
+ } /* end if */
+ if (nseconds <= 0)
usage();
- if(poll_time >= nseconds)
+ if (poll_time >= nseconds)
usage();
/* Emit informational message */
- if(verbose) {
+ if (verbose) {
HDfprintf(stderr, "Parameters:\n");
HDfprintf(stderr, "\t# of seconds between polling = %d\n", poll_time);
HDfprintf(stderr, "\t# of common symbols to poll = %d\n", ncommon);
@@ -464,7 +462,7 @@ int main(int argc, const char *argv[])
} /* end if */
/* Set the random seed */
- if(0 == use_seed) {
+ if (0 == use_seed) {
struct timeval t;
HDgettimeofday(&t, NULL);
random_seed = (unsigned)(t.tv_usec);
@@ -474,41 +472,42 @@ int main(int argc, const char *argv[])
HDfprintf(stderr, "Using reader random seed: %u\n", random_seed);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Generating symbol names\n");
/* Generate dataset names */
- if(generate_symbols() < 0) {
+ if (generate_symbols() < 0) {
HDfprintf(stderr, "Error generating symbol names!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Create datatype for creating datasets */
- if((symbol_tid = create_symbol_datatype()) < 0)
+ if ((symbol_tid = create_symbol_datatype()) < 0)
return -1;
/* Reading records from datasets */
- if(read_records(FILENAME, verbose, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) {
+ if (read_records(FILENAME, verbose, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon,
+ (unsigned)nrandom) < 0) {
HDfprintf(stderr, "Error reading records from datasets!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Releasing symbols\n");
/* Clean up the symbols */
- if(shutdown_symbols() < 0) {
+ if (shutdown_symbols() < 0) {
HDfprintf(stderr, "Error releasing symbols!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing objects\n");
/* Close objects created */
- if(H5Tclose(symbol_tid) < 0) {
+ if (H5Tclose(symbol_tid) < 0) {
HDfprintf(stderr, "Error closing symbol datatype!\n");
HDexit(EXIT_FAILURE);
} /* end if */
diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c
index 504ea8a..491c6b2 100644
--- a/test/swmr_remove_writer.c
+++ b/test/swmr_remove_writer.c
@@ -39,18 +39,16 @@
/****************/
/* The maximum number of records to remove in one step */
-#define MAX_REMOVE_SIZE 10
+#define MAX_REMOVE_SIZE 10
/********************/
/* Local Prototypes */
/********************/
static hid_t open_skeleton(const char *filename, unsigned verbose, unsigned old);
-static int remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks,
- unsigned long flush_count);
-static void usage(void);
+static int remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks, unsigned long flush_count);
+static void usage(void);
-
/*-------------------------------------------------------------------------
* Function: open_skeleton
*
@@ -72,46 +70,46 @@ static void usage(void);
static hid_t
open_skeleton(const char *filename, unsigned verbose, unsigned old)
{
- hid_t fid; /* File ID for new HDF5 file */
- hid_t fapl; /* File access property list */
- hid_t sid; /* Dataspace ID */
- hsize_t dim[2]; /* Dataspace dimensions */
- unsigned u, v; /* Local index variable */
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t fapl; /* File access property list */
+ hid_t sid; /* Dataspace ID */
+ hsize_t dim[2]; /* Dataspace dimensions */
+ unsigned u, v; /* Local index variable */
HDassert(filename);
/* Create file access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
return -1;
- if(!old) {
+ if (!old) {
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
}
/* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
return -1;
/* Close file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Opening datasets\n");
/* Open the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++) {
- if((symbol_info[u][v].dsid = H5Dopen2(fid, symbol_info[u][v].name, H5P_DEFAULT)) < 0)
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++) {
+ if ((symbol_info[u][v].dsid = H5Dopen2(fid, symbol_info[u][v].name, H5P_DEFAULT)) < 0)
return -1;
- if((sid = H5Dget_space(symbol_info[u][v].dsid)) < 0)
+ if ((sid = H5Dget_space(symbol_info[u][v].dsid)) < 0)
return -1;
- if(2 != H5Sget_simple_extent_ndims(sid))
+ if (2 != H5Sget_simple_extent_ndims(sid))
return -1;
- if(H5Sget_simple_extent_dims(sid, dim, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dim, NULL) < 0)
return -1;
symbol_info[u][v].nrecords = dim[1];
} /* end for */
@@ -119,7 +117,6 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old)
return fid;
}
-
/*-------------------------------------------------------------------------
* Function: remove_records
*
@@ -146,56 +143,56 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old)
static int
remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks, unsigned long flush_count)
{
- unsigned long shrink_to_flush; /* # of removals before flush */
- hsize_t dim[2] = {1,0}; /* Dataspace dimensions */
- unsigned long u, v; /* Local index variables */
+ unsigned long shrink_to_flush; /* # of removals before flush */
+ hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */
+ unsigned long u, v; /* Local index variables */
HDassert(fid >= 0);
/* Remove records from random datasets, according to frequency distribution */
shrink_to_flush = flush_count;
- for(u = 0; u < nshrinks; u++) {
- symbol_info_t *symbol; /* Symbol to remove record from */
- hsize_t remove_size; /* Size to reduce dataset dimension by */
+ for (u = 0; u < nshrinks; u++) {
+ symbol_info_t *symbol; /* Symbol to remove record from */
+ hsize_t remove_size; /* Size to reduce dataset dimension by */
/* Get a random dataset, according to the symbol distribution */
symbol = choose_dataset();
/* Shrink the dataset's dataspace */
remove_size = (hsize_t)HDrandom() % MAX_REMOVE_SIZE + 1;
- if(remove_size > symbol->nrecords)
+ if (remove_size > symbol->nrecords)
symbol->nrecords = 0;
else
symbol->nrecords -= remove_size;
dim[1] = symbol->nrecords;
- if(H5Dset_extent(symbol->dsid, dim) < 0)
+ if (H5Dset_extent(symbol->dsid, dim) < 0)
return -1;
/* Check for flushing file */
- if(flush_count > 0) {
+ if (flush_count > 0) {
/* Decrement count of records to write before flushing */
shrink_to_flush--;
/* Check for counter being reached */
- if(0 == shrink_to_flush) {
+ if (0 == shrink_to_flush) {
/* Flush contents of file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
return -1;
/* Reset flush counter */
shrink_to_flush = flush_count;
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing datasets\n");
/* Close the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++)
- if(H5Dclose(symbol_info[u][v].dsid) < 0)
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++)
+ if (H5Dclose(symbol_info[u][v].dsid) < 0)
return -1;
return 0;
@@ -219,30 +216,31 @@ usage(void)
HDexit(EXIT_FAILURE);
}
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- hid_t fid; /* File ID for file opened */
- long nshrinks = 0; /* # of times to shrink the dataset */
- long flush_count = 1000; /* # of records to write between flushing file */
- unsigned verbose = 1; /* Whether to emit some informational messages */
- unsigned old = 0; /* Whether to use non-latest-format when opening file */
- unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */
- unsigned random_seed = 0; /* Random # seed */
- unsigned u; /* Local index variable */
- int temp;
+ hid_t fid; /* File ID for file opened */
+ long nshrinks = 0; /* # of times to shrink the dataset */
+ long flush_count = 1000; /* # of records to write between flushing file */
+ unsigned verbose = 1; /* Whether to emit some informational messages */
+ unsigned old = 0; /* Whether to use non-latest-format when opening file */
+ unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */
+ unsigned random_seed = 0; /* Random # seed */
+ unsigned u; /* Local index variable */
+ int temp;
/* Parse command line options */
- if(argc < 2)
+ if (argc < 2)
usage();
- if(argc > 1) {
+ if (argc > 1) {
u = 1;
- while(u < (unsigned)argc) {
- if(argv[u][0] == '-') {
- switch(argv[u][1]) {
+ while (u < (unsigned)argc) {
+ if (argv[u][0] == '-') {
+ switch (argv[u][1]) {
/* # of records to write between flushing file */
case 'f':
flush_count = HDatol(argv[u + 1]);
- if(flush_count < 0)
+ if (flush_count < 0)
usage();
u += 2;
break;
@@ -255,8 +253,8 @@ int main(int argc, const char *argv[])
/* Random # seed */
case 'r':
- use_seed = 1;
- temp = HDatoi(argv[u + 1]);
+ use_seed = 1;
+ temp = HDatoi(argv[u + 1]);
random_seed = (unsigned)temp;
u += 2;
break;
@@ -271,31 +269,31 @@ int main(int argc, const char *argv[])
usage();
break;
} /* end switch */
- } /* end if */
+ } /* end if */
else {
/* Get the number of records to append */
nshrinks = HDatol(argv[u]);
- if(nshrinks <= 0)
+ if (nshrinks <= 0)
usage();
u++;
} /* end else */
- } /* end while */
- } /* end if */
- if(nshrinks <= 0)
+ } /* end while */
+ } /* end if */
+ if (nshrinks <= 0)
usage();
- if(flush_count >= nshrinks)
+ if (flush_count >= nshrinks)
usage();
/* Emit informational message */
- if(verbose) {
+ if (verbose) {
HDfprintf(stderr, "Parameters:\n");
HDfprintf(stderr, "\t# of shrinks between flushes = %ld\n", flush_count);
HDfprintf(stderr, "\t# of shrinks = %ld\n", nshrinks);
} /* end if */
/* Set the random seed */
- if(0 == use_seed) {
+ if (0 == use_seed) {
struct timeval t;
HDgettimeofday(&t, NULL);
random_seed = (unsigned)(t.tv_usec);
@@ -305,19 +303,19 @@ int main(int argc, const char *argv[])
HDfprintf(stderr, "Using writer random seed: %u\n", random_seed);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Generating symbol names\n");
/* Generate dataset names */
- if(generate_symbols() < 0)
+ if (generate_symbols() < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Opening skeleton file: %s\n", FILENAME);
/* Open file skeleton */
- if((fid = open_skeleton(FILENAME, verbose, old)) < 0) {
+ if ((fid = open_skeleton(FILENAME, verbose, old)) < 0) {
HDfprintf(stderr, "Error opening skeleton file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
@@ -326,31 +324,31 @@ int main(int argc, const char *argv[])
h5_send_message(WRITER_MESSAGE, NULL, NULL);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Removing records\n");
/* Remove records from datasets */
- if(remove_records(fid, verbose, (unsigned long)nshrinks, (unsigned long)flush_count) < 0) {
+ if (remove_records(fid, verbose, (unsigned long)nshrinks, (unsigned long)flush_count) < 0) {
HDfprintf(stderr, "Error removing records from datasets!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Releasing symbols\n");
/* Clean up the symbols */
- if(shutdown_symbols() < 0) {
+ if (shutdown_symbols() < 0) {
HDfprintf(stderr, "Error releasing symbols!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing objects\n");
/* Close objects opened */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
HDfprintf(stderr, "Error closing file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
diff --git a/test/swmr_sparse_reader.c b/test/swmr_sparse_reader.c
index 2d558df..e871226 100644
--- a/test/swmr_sparse_reader.c
+++ b/test/swmr_sparse_reader.c
@@ -48,13 +48,12 @@ static hid_t symbol_tid = (-1);
/* Local Prototypes */
/********************/
-static int check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol,
- symbol_t *record, hid_t rec_sid);
-static int read_records(const char *filename, unsigned verbose, unsigned long nrecords,
- unsigned poll_time, unsigned reopen_count);
+static int check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t *record,
+ hid_t rec_sid);
+static int read_records(const char *filename, unsigned verbose, unsigned long nrecords, unsigned poll_time,
+ unsigned reopen_count);
static void usage(void);
-
/*-------------------------------------------------------------------------
* Function: check_dataset
*
@@ -86,13 +85,12 @@ static void usage(void);
*-------------------------------------------------------------------------
*/
static int
-check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t *record,
- hid_t rec_sid)
+check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t *record, hid_t rec_sid)
{
- hid_t dsid; /* Dataset ID */
- hid_t file_sid; /* Dataset's space ID */
- hsize_t start[2] = {0, 0}; /* Hyperslab selection values */
- hsize_t count[2] = {1, 1}; /* Hyperslab selection values */
+ hid_t dsid; /* Dataset ID */
+ hid_t file_sid; /* Dataset's space ID */
+ hsize_t start[2] = {0, 0}; /* Hyperslab selection values */
+ hsize_t count[2] = {1, 1}; /* Hyperslab selection values */
HDassert(fid >= 0);
HDassert(symbol);
@@ -100,48 +98,50 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t
HDassert(rec_sid >= 0);
/* Open dataset for symbol */
- if((dsid = H5Dopen2(fid, symbol->name, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, symbol->name, H5P_DEFAULT)) < 0)
return -1;
/* Get the dataset's dataspace */
- if((file_sid = H5Dget_space(dsid)) < 0)
+ if ((file_sid = H5Dget_space(dsid)) < 0)
return -1;
/* Choose the random record in the dataset (will be the same as chosen by
* the writer) */
start[1] = (hsize_t)HDrandom() % symbol->nrecords;
- if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
return -1;
/* Emit informational message */
- if(verbose)
- HDfprintf(stderr, "Symbol = '%s', location = %" PRIuMAX ",%" PRIuMAX "\n", symbol->name, (uintmax_t)start[0], (uintmax_t)start[1]);
+ if (verbose)
+ HDfprintf(stderr, "Symbol = '%s', location = %" PRIuMAX ",%" PRIuMAX "\n", symbol->name,
+ (uintmax_t)start[0], (uintmax_t)start[1]);
/* Read record from dataset */
record->rec_id = (uint64_t)ULLONG_MAX;
- if(H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0)
+ if (H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0)
return -1;
/* Verify record value */
- if(record->rec_id != start[1]) {
+ if (record->rec_id != start[1]) {
HDfprintf(stderr, "*** ERROR ***\n");
HDfprintf(stderr, "Incorrect record value!\n");
- HDfprintf(stderr, "Symbol = '%s', location = %" PRIuMAX ",%" PRIuMAX ", record->rec_id = %" PRIu64 "\n", symbol->name, (uintmax_t)start[0], (uintmax_t)start[1], record->rec_id);
+ HDfprintf(stderr,
+ "Symbol = '%s', location = %" PRIuMAX ",%" PRIuMAX ", record->rec_id = %" PRIu64 "\n",
+ symbol->name, (uintmax_t)start[0], (uintmax_t)start[1], record->rec_id);
return -1;
} /* end if */
/* Close the dataset's dataspace */
- if(H5Sclose(file_sid) < 0)
+ if (H5Sclose(file_sid) < 0)
return -1;
/* Close dataset for symbol */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
return -1;
return 0;
} /* end check_dataset() */
-
/*-------------------------------------------------------------------------
* Function: read_records
*
@@ -170,42 +170,42 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t
*-------------------------------------------------------------------------
*/
static int
-read_records(const char *filename, unsigned verbose, unsigned long nrecords,
- unsigned poll_time, unsigned reopen_count)
+read_records(const char *filename, unsigned verbose, unsigned long nrecords, unsigned poll_time,
+ unsigned reopen_count)
{
- hid_t fid; /* File ID */
- hid_t aid; /* Attribute ID */
- time_t start_time; /* Starting time */
- hid_t mem_sid; /* Memory dataspace ID */
- symbol_t record; /* The record to add to the dataset */
- unsigned seed; /* Seed for random number generator */
- unsigned iter_to_reopen = reopen_count; /* # of iterations until reopen */
- unsigned long u; /* Local index variable */
- hid_t fapl;
+ hid_t fid; /* File ID */
+ hid_t aid; /* Attribute ID */
+ time_t start_time; /* Starting time */
+ hid_t mem_sid; /* Memory dataspace ID */
+ symbol_t record; /* The record to add to the dataset */
+ unsigned seed; /* Seed for random number generator */
+ unsigned iter_to_reopen = reopen_count; /* # of iterations until reopen */
+ unsigned long u; /* Local index variable */
+ hid_t fapl;
HDassert(filename);
HDassert(poll_time != 0);
/* Create file access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
return -1;
H5Pset_fclose_degree(fapl, H5F_CLOSE_SEMI);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Opening file: %s\n", filename);
/* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
return -1;
/* Seed the random number generator with the attribute in the file */
- if((aid = H5Aopen(fid, "seed", H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(fid, "seed", H5P_DEFAULT)) < 0)
return -1;
- if(H5Aread(aid, H5T_NATIVE_UINT, &seed) < 0)
+ if (H5Aread(aid, H5T_NATIVE_UINT, &seed) < 0)
return -1;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
return -1;
HDsrandom(seed);
@@ -214,21 +214,21 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords,
HDmemset(&record, 0, sizeof(record));
/* Create a dataspace for the record to read */
- if((mem_sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((mem_sid = H5Screate(H5S_SCALAR)) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Reading records\n");
/* Get the starting time */
start_time = HDtime(NULL);
/* Read records */
- for(u = 0; u < nrecords; u++) {
- symbol_info_t *symbol = NULL; /* Symbol (dataset) */
- htri_t attr_exists; /* Whether the sequence number attribute exists */
- unsigned long file_u; /* Attribute sequence number (writer's "u") */
+ for (u = 0; u < nrecords; u++) {
+ symbol_info_t *symbol = NULL; /* Symbol (dataset) */
+ htri_t attr_exists; /* Whether the sequence number attribute exists */
+ unsigned long file_u; /* Attribute sequence number (writer's "u") */
/* Get a random dataset, according to the symbol distribution */
symbol = choose_dataset();
@@ -240,26 +240,26 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords,
/* Wait until we can read the dataset */
do {
/* Check if sequence attribute exists */
- if((attr_exists = H5Aexists_by_name(fid, symbol->name, "seq", H5P_DEFAULT)) < 0)
+ if ((attr_exists = H5Aexists_by_name(fid, symbol->name, "seq", H5P_DEFAULT)) < 0)
return -1;
- if(attr_exists) {
+ if (attr_exists) {
/* Read sequence number attribute */
- if((aid = H5Aopen_by_name(fid, symbol->name, "seq", H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen_by_name(fid, symbol->name, "seq", H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- if(H5Aread(aid, H5T_NATIVE_ULONG, &file_u) < 0)
+ if (H5Aread(aid, H5T_NATIVE_ULONG, &file_u) < 0)
return -1;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
return -1;
/* Check if sequence number is at least u - if so, this should
* guarantee that this record has been written */
- if(file_u >= u)
+ if (file_u >= u)
break;
} /* end if */
/* Check for timeout */
- if(HDtime(NULL) >= (time_t)(start_time + (time_t)TIMEOUT)) {
+ if (HDtime(NULL) >= (time_t)(start_time + (time_t)TIMEOUT)) {
HDfprintf(stderr, "Reader timed out\n");
return -1;
} /* end if */
@@ -268,56 +268,56 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords,
HDsleep(poll_time);
/* Retrieve and print the collection of metadata read retries */
- if(print_metadata_retries_info(fid) < 0)
+ if (print_metadata_retries_info(fid) < 0)
HDfprintf(stderr, "Warning: could not obtain metadata retries info\n");
/* Reopen the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
return -1;
iter_to_reopen = reopen_count;
- } while(1);
+ } while (1);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Checking dataset %lu\n", u);
/* Check dataset */
- if(check_dataset(fid, verbose, symbol, &record, mem_sid) < 0)
+ if (check_dataset(fid, verbose, symbol, &record, mem_sid) < 0)
return -1;
HDmemset(&record, 0, sizeof(record));
/* Check for reopen */
iter_to_reopen--;
- if(iter_to_reopen == 0) {
+ if (iter_to_reopen == 0) {
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Reopening file: %s\n", filename);
/* Retrieve and print the collection of metadata read retries */
- if(print_metadata_retries_info(fid) < 0)
+ if (print_metadata_retries_info(fid) < 0)
HDfprintf(stderr, "Warning: could not obtain metadata retries info\n");
/* Reopen the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
return -1;
iter_to_reopen = reopen_count;
} /* end if */
- } /* end while */
+ } /* end while */
/* Retrieve and print the collection of metadata read retries */
- if(print_metadata_retries_info(fid) < 0)
+ if (print_metadata_retries_info(fid) < 0)
HDfprintf(stderr, "Warning: could not obtain metadata retries info\n");
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/* Close the memory dataspace */
- if(H5Sclose(mem_sid) < 0)
+ if (H5Sclose(mem_sid) < 0)
return -1;
return 0;
@@ -341,26 +341,27 @@ usage(void)
HDexit(EXIT_FAILURE);
} /* end usage() */
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- long nrecords = 0; /* # of records to read */
- int poll_time = 1; /* # of seconds to sleep when waiting for writer */
- int reopen_count = 1; /* # of reads between reopens */
- unsigned verbose = 1; /* Whether to emit some informational messages */
- unsigned u; /* Local index variables */
+ long nrecords = 0; /* # of records to read */
+ int poll_time = 1; /* # of seconds to sleep when waiting for writer */
+ int reopen_count = 1; /* # of reads between reopens */
+ unsigned verbose = 1; /* Whether to emit some informational messages */
+ unsigned u; /* Local index variables */
/* Parse command line options */
- if(argc < 2)
+ if (argc < 2)
usage();
- if(argc > 1) {
+ if (argc > 1) {
u = 1;
- while(u < (unsigned)argc) {
- if(argv[u][0] == '-') {
- switch(argv[u][1]) {
+ while (u < (unsigned)argc) {
+ if (argv[u][0] == '-') {
+ switch (argv[u][1]) {
/* # of reads between reopens */
case 'n':
reopen_count = HDatoi(argv[u + 1]);
- if(reopen_count < 0)
+ if (reopen_count < 0)
usage();
u += 2;
break;
@@ -374,7 +375,7 @@ int main(int argc, const char *argv[])
/* # of seconds between polling */
case 's':
poll_time = HDatoi(argv[u + 1]);
- if(poll_time < 0)
+ if (poll_time < 0)
usage();
u += 2;
break;
@@ -383,20 +384,20 @@ int main(int argc, const char *argv[])
usage();
break;
} /* end switch */
- } /* end if */
+ } /* end if */
else {
/* Get the number of records to read */
nrecords = HDatol(argv[u]);
- if(nrecords <= 0)
+ if (nrecords <= 0)
usage();
u++;
} /* end else */
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
/* Emit informational message */
- if(verbose) {
+ if (verbose) {
HDfprintf(stderr, "Parameters:\n");
HDfprintf(stderr, "\t# of seconds between polling = %d\n", poll_time);
HDfprintf(stderr, "\t# of reads between reopens = %d\n", reopen_count);
@@ -404,41 +405,42 @@ int main(int argc, const char *argv[])
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Generating symbol names\n");
/* Generate dataset names */
- if(generate_symbols() < 0) {
+ if (generate_symbols() < 0) {
HDfprintf(stderr, "Error generating symbol names!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Create datatype for creating datasets */
- if((symbol_tid = create_symbol_datatype()) < 0)
+ if ((symbol_tid = create_symbol_datatype()) < 0)
return -1;
/* Reading records from datasets */
- if(read_records(FILENAME, verbose, (unsigned long) nrecords, (unsigned)poll_time, (unsigned)reopen_count) < 0) {
+ if (read_records(FILENAME, verbose, (unsigned long)nrecords, (unsigned)poll_time,
+ (unsigned)reopen_count) < 0) {
HDfprintf(stderr, "Error reading records from datasets!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Releasing symbols\n");
/* Clean up the symbols */
- if(shutdown_symbols() < 0) {
+ if (shutdown_symbols() < 0) {
HDfprintf(stderr, "Error releasing symbols!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing objects\n");
/* Close objects created */
- if(H5Tclose(symbol_tid) < 0) {
+ if (H5Tclose(symbol_tid) < 0) {
HDfprintf(stderr, "Error closing symbol datatype!\n");
HDexit(EXIT_FAILURE);
} /* end if */
diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c
index 1892fe2..4706b7a 100644
--- a/test/swmr_sparse_writer.c
+++ b/test/swmr_sparse_writer.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
- /*-------------------------------------------------------------------------
+/*-------------------------------------------------------------------------
*
* Created: swmr_sparse_writer.c
*
@@ -44,11 +44,8 @@
/********************/
static hid_t open_skeleton(const char *filename, unsigned verbose);
-static int add_records(hid_t fid, unsigned verbose, unsigned long nrecords,
- unsigned long flush_count);
-static void usage(void);
-
-
+static int add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long flush_count);
+static void usage(void);
/*-------------------------------------------------------------------------
* Function: open_skeleton
@@ -71,55 +68,54 @@ static void usage(void);
static hid_t
open_skeleton(const char *filename, unsigned verbose)
{
- hid_t fid; /* File ID for new HDF5 file */
- hid_t fapl; /* File access property list */
- hid_t aid; /* Attribute ID */
- unsigned seed; /* Seed for random number generator */
- unsigned u, v; /* Local index variable */
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t fapl; /* File access property list */
+ hid_t aid; /* Attribute ID */
+ unsigned seed; /* Seed for random number generator */
+ unsigned u, v; /* Local index variable */
HDassert(filename);
/* Create file access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
return -1;
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
/* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
return -1;
/* Close file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Opening datasets\n");
/* Seed the random number generator with the attribute in the file */
- if((aid = H5Aopen(fid, "seed", H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(fid, "seed", H5P_DEFAULT)) < 0)
return -1;
- if(H5Aread(aid, H5T_NATIVE_UINT, &seed) < 0)
+ if (H5Aread(aid, H5T_NATIVE_UINT, &seed) < 0)
return -1;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
return -1;
HDsrandom(seed);
/* Open the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++) {
- if((symbol_info[u][v].dsid = H5Dopen2(fid, symbol_info[u][v].name, H5P_DEFAULT)) < 0)
- return(-1);
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++) {
+ if ((symbol_info[u][v].dsid = H5Dopen2(fid, symbol_info[u][v].name, H5P_DEFAULT)) < 0)
+ return (-1);
symbol_info[u][v].nrecords = 0;
} /* end for */
return fid;
}
-
/*-------------------------------------------------------------------------
* Function: add_records
*
@@ -146,17 +142,17 @@ open_skeleton(const char *filename, unsigned verbose)
static int
add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long flush_count)
{
- hid_t tid; /* Datatype ID for records */
- hid_t mem_sid; /* Memory dataspace ID */
- hsize_t start[2] = {0, 0}; /* Hyperslab selection values */
- hsize_t count[2] = {1, 1}; /* Hyperslab selection values */
- symbol_t record; /* The record to add to the dataset */
- unsigned long rec_to_flush; /* # of records left to write before flush */
+ hid_t tid; /* Datatype ID for records */
+ hid_t mem_sid; /* Memory dataspace ID */
+ hsize_t start[2] = {0, 0}; /* Hyperslab selection values */
+ hsize_t count[2] = {1, 1}; /* Hyperslab selection values */
+ symbol_t record; /* The record to add to the dataset */
+ unsigned long rec_to_flush; /* # of records left to write before flush */
#ifdef OUT
- volatile int dummy; /* Dummy varialbe for busy sleep */
-#endif /* OUT */
- hsize_t dim[2] = {1,0}; /* Dataspace dimensions */
- unsigned long u, v; /* Local index variables */
+ volatile int dummy; /* Dummy varialbe for busy sleep */
+#endif /* OUT */
+ hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */
+ unsigned long u, v; /* Local index variables */
HDassert(fid >= 0);
@@ -165,48 +161,49 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f
HDmemset(&record, 0, sizeof(record));
/* Create a dataspace for the record to add */
- if((mem_sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((mem_sid = H5Screate(H5S_SCALAR)) < 0)
return -1;
/* Create datatype for appending records */
- if((tid = create_symbol_datatype()) < 0)
+ if ((tid = create_symbol_datatype()) < 0)
return -1;
/* Add records to random datasets, according to frequency distribution */
rec_to_flush = flush_count;
- for(u = 0; u < nrecords; u++) {
- symbol_info_t *symbol; /* Symbol to write record to */
- hid_t file_sid; /* Dataset's space ID */
- hid_t aid; /* Attribute ID */
- hbool_t corked; /* Whether the dataset was corked */
+ for (u = 0; u < nrecords; u++) {
+ symbol_info_t *symbol; /* Symbol to write record to */
+ hid_t file_sid; /* Dataset's space ID */
+ hid_t aid; /* Attribute ID */
+ hbool_t corked; /* Whether the dataset was corked */
/* Get a random dataset, according to the symbol distribution */
symbol = choose_dataset();
/* If this is the first time the dataset has been opened, extend it and
* add the sequence attribute */
- if(symbol->nrecords == 0) {
+ if (symbol->nrecords == 0) {
symbol->nrecords = nrecords / 5;
- dim[1] = symbol->nrecords;
+ dim[1] = symbol->nrecords;
/* Cork the metadata cache, to prevent the object header from being
* flushed before the data has been written */
- if(H5Odisable_mdc_flushes(symbol->dsid) < 0)
+ if (H5Odisable_mdc_flushes(symbol->dsid) < 0)
return -1;
corked = TRUE;
- if(H5Dset_extent(symbol->dsid, dim) < 0)
+ if (H5Dset_extent(symbol->dsid, dim) < 0)
return -1;
- if((file_sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((file_sid = H5Screate(H5S_SCALAR)) < 0)
return -1;
- if((aid = H5Acreate2(symbol->dsid, "seq", H5T_NATIVE_ULONG, file_sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(symbol->dsid, "seq", H5T_NATIVE_ULONG, file_sid, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
return -1;
- if(H5Sclose(file_sid) < 0)
+ if (H5Sclose(file_sid) < 0)
return -1;
} /* end if */
else {
- if((aid = H5Aopen(symbol->dsid, "seq", H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(symbol->dsid, "seq", H5P_DEFAULT)) < 0)
return -1;
corked = FALSE;
} /* end else */
@@ -218,15 +215,15 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f
record.rec_id = start[1];
/* Get the dataset's dataspace */
- if((file_sid = H5Dget_space(symbol->dsid)) < 0)
+ if ((file_sid = H5Dget_space(symbol->dsid)) < 0)
return -1;
/* Choose a random record in the dataset */
- if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
return -1;
/* Write record to the dataset */
- if(H5Dwrite(symbol->dsid, tid, mem_sid, file_sid, H5P_DEFAULT, &record) < 0)
+ if (H5Dwrite(symbol->dsid, tid, mem_sid, file_sid, H5P_DEFAULT, &record) < 0)
return -1;
/* Write the sequence number attribute. Since we synchronize the random
@@ -235,37 +232,37 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f
* flush dependencies on the object header, the reader will be
* guaranteed to see the written data if the sequence attribute is >=u.
*/
- if(H5Awrite(aid, H5T_NATIVE_ULONG, &u) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_ULONG, &u) < 0)
return -1;
/* Close the attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
return -1;
/* Uncork the metadata cache, if it's been */
- if(corked)
- if(H5Oenable_mdc_flushes(symbol->dsid) < 0)
+ if (corked)
+ if (H5Oenable_mdc_flushes(symbol->dsid) < 0)
return -1;
/* Close the dataset's dataspace */
- if(H5Sclose(file_sid) < 0)
+ if (H5Sclose(file_sid) < 0)
return -1;
/* Check for flushing file */
- if(flush_count > 0) {
+ if (flush_count > 0) {
/* Decrement count of records to write before flushing */
rec_to_flush--;
/* Check for counter being reached */
- if(0 == rec_to_flush) {
+ if (0 == rec_to_flush) {
/* Flush contents of file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
return -1;
/* Reset flush counter */
rec_to_flush = flush_count;
} /* end if */
- } /* end if */
+ } /* end if */
#ifdef OUT
/* Busy wait, to let readers catch up */
@@ -273,30 +270,30 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f
* at the top of the file.
*/
dummy = 0;
- for(v=0; v<BUSY_WAIT; v++)
+ for (v = 0; v < BUSY_WAIT; v++)
dummy++;
- if((unsigned long)dummy != v)
+ if ((unsigned long)dummy != v)
return -1;
#endif /* OUT */
} /* end for */
/* Close the memory dataspace */
- if(H5Sclose(mem_sid) < 0)
+ if (H5Sclose(mem_sid) < 0)
return -1;
/* Close the datatype */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing datasets\n");
/* Close the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++)
- if(H5Dclose(symbol_info[u][v].dsid) < 0)
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++)
+ if (H5Dclose(symbol_info[u][v].dsid) < 0)
return -1;
return 0;
@@ -320,26 +317,27 @@ usage(void)
HDexit(EXIT_FAILURE);
}
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- hid_t fid; /* File ID for file opened */
- long nrecords = 0; /* # of records to append */
- long flush_count = 1000; /* # of records to write between flushing file */
- unsigned verbose = 1; /* Whether to emit some informational messages */
- unsigned u; /* Local index variable */
+ hid_t fid; /* File ID for file opened */
+ long nrecords = 0; /* # of records to append */
+ long flush_count = 1000; /* # of records to write between flushing file */
+ unsigned verbose = 1; /* Whether to emit some informational messages */
+ unsigned u; /* Local index variable */
/* Parse command line options */
- if(argc < 2)
+ if (argc < 2)
usage();
- if(argc > 1) {
+ if (argc > 1) {
u = 1;
- while(u < (unsigned)argc) {
- if(argv[u][0] == '-') {
- switch(argv[u][1]) {
+ while (u < (unsigned)argc) {
+ if (argv[u][0] == '-') {
+ switch (argv[u][1]) {
/* # of records to write between flushing file */
case 'f':
flush_count = HDatol(argv[u + 1]);
- if(flush_count < 0)
+ if (flush_count < 0)
usage();
u += 2;
break;
@@ -354,43 +352,43 @@ int main(int argc, const char *argv[])
usage();
break;
} /* end switch */
- } /* end if */
+ } /* end if */
else {
/* Get the number of records to append */
nrecords = HDatol(argv[u]);
- if(nrecords <= 0)
+ if (nrecords <= 0)
usage();
u++;
} /* end else */
- } /* end while */
- } /* end if */
- if(nrecords <= 0)
+ } /* end while */
+ } /* end if */
+ if (nrecords <= 0)
usage();
- if(flush_count >= nrecords)
+ if (flush_count >= nrecords)
usage();
/* Emit informational message */
- if(verbose) {
+ if (verbose) {
HDfprintf(stderr, "Parameters:\n");
HDfprintf(stderr, "\t# of records between flushes = %ld\n", flush_count);
HDfprintf(stderr, "\t# of records to write = %ld\n", nrecords);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Generating symbol names\n");
/* Generate dataset names */
- if(generate_symbols() < 0)
+ if (generate_symbols() < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Opening skeleton file: %s\n", FILENAME);
/* Open file skeleton */
- if((fid = open_skeleton(FILENAME, verbose)) < 0) {
+ if ((fid = open_skeleton(FILENAME, verbose)) < 0) {
HDfprintf(stderr, "Error opening skeleton file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
@@ -399,31 +397,31 @@ int main(int argc, const char *argv[])
h5_send_message(WRITER_MESSAGE, NULL, NULL);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Adding records\n");
/* Append records to datasets */
- if(add_records(fid, verbose, (unsigned long)nrecords, (unsigned long)flush_count) < 0) {
+ if (add_records(fid, verbose, (unsigned long)nrecords, (unsigned long)flush_count) < 0) {
HDfprintf(stderr, "Error appending records to datasets!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Releasing symbols\n");
/* Clean up the symbols */
- if(shutdown_symbols() < 0) {
+ if (shutdown_symbols() < 0) {
HDfprintf(stderr, "Error releasing symbols!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(stderr, "Closing objects\n");
/* Close objects opened */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
HDfprintf(stderr, "Error closing file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c
index 0527229..1d74db3 100644
--- a/test/swmr_start_write.c
+++ b/test/swmr_start_write.c
@@ -36,17 +36,15 @@
/* Local Prototypes */
/********************/
-static hid_t create_file(const char *filename, hbool_t verbose,
- FILE *verbose_file, unsigned random_seed);
-static int create_datasets(hid_t fid, int comp_level, hbool_t verbose,
- FILE *verbose_file, const char *index_type);
-static int add_records(hid_t fid, hbool_t verbose, FILE *verbose_file,
- unsigned long nrecords, unsigned long flush_count);
-static void usage(void);
+static hid_t create_file(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned random_seed);
+static int create_datasets(hid_t fid, int comp_level, hbool_t verbose, FILE *verbose_file,
+ const char *index_type);
+static int add_records(hid_t fid, hbool_t verbose, FILE *verbose_file, unsigned long nrecords,
+ unsigned long flush_count);
+static void usage(void);
-#define CHUNK_SIZE 50 /* Chunk size for created datasets */
+#define CHUNK_SIZE 50 /* Chunk size for created datasets */
-
/*-------------------------------------------------------------------------
* Function: create_file
*
@@ -66,61 +64,59 @@ static void usage(void);
*-------------------------------------------------------------------------
*/
static hid_t
-create_file(const char *filename, hbool_t verbose, FILE *verbose_file,
- unsigned random_seed)
+create_file(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned random_seed)
{
- hid_t fid; /* File ID for new HDF5 file */
- hid_t fcpl; /* File creation property list */
- hid_t fapl; /* File access property list */
- hid_t sid; /* Dataspace ID */
- hid_t aid; /* Attribute ID */
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t fcpl; /* File creation property list */
+ hid_t fapl; /* File access property list */
+ hid_t sid; /* Dataspace ID */
+ hid_t aid; /* Attribute ID */
HDassert(filename);
/* Create file access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
return -1;
/* We ALWAYS select the latest file format for SWMR */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Creating file without SWMR access\n");
/* Create the file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
return -1;
/* Close file creation property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
return -1;
/* Close file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
/* Create attribute with (shared) random number seed - for sparse test */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
return -1;
- if((aid = H5Acreate2(fid, "seed", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(fid, "seed", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- if(H5Awrite(aid, H5T_NATIVE_UINT, &random_seed) < 0)
+ if (H5Awrite(aid, H5T_NATIVE_UINT, &random_seed) < 0)
return -1;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
return -1;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
return -1;
return fid;
} /* end create_file() */
-
/*-------------------------------------------------------------------------
* Function: create_datasets
*
@@ -140,53 +136,53 @@ create_file(const char *filename, hbool_t verbose, FILE *verbose_file,
*-------------------------------------------------------------------------
*/
static int
-create_datasets(hid_t fid, int comp_level, hbool_t verbose, FILE *verbose_file,
- const char *index_type)
+create_datasets(hid_t fid, int comp_level, hbool_t verbose, FILE *verbose_file, const char *index_type)
{
- hid_t dcpl; /* Dataset creation property list */
- hid_t tid; /* Datatype for dataset elements */
- hid_t sid; /* Dataspace ID */
- hsize_t dims[2] = {1, 0}; /* Dataset starting dimensions */
- hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* Dataset maximum dimensions */
- hsize_t chunk_dims[2] = {1, CHUNK_SIZE}; /* Chunk dimensions */
- unsigned u, v; /* Local index variable */
+ hid_t dcpl; /* Dataset creation property list */
+ hid_t tid; /* Datatype for dataset elements */
+ hid_t sid; /* Dataspace ID */
+ hsize_t dims[2] = {1, 0}; /* Dataset starting dimensions */
+ hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* Dataset maximum dimensions */
+ hsize_t chunk_dims[2] = {1, CHUNK_SIZE}; /* Chunk dimensions */
+ unsigned u, v; /* Local index variable */
HDassert(index_type);
/* Create datatype for creating datasets */
- if((tid = create_symbol_datatype()) < 0)
+ if ((tid = create_symbol_datatype()) < 0)
return -1;
/* There are two chunk indexes tested here.
* With one unlimited dimension, we get the extensible array index
* type, with two unlimited dimensions, we get a v-2 B-tree.
*/
- if(!HDstrcmp(index_type, "b2"))
+ if (!HDstrcmp(index_type, "b2"))
max_dims[0] = H5S_UNLIMITED;
/* Create dataspace for creating datasets */
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
return -1;
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
return -1;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
return -1;
- if(comp_level >= 0) {
- if(H5Pset_deflate(dcpl, (unsigned)comp_level) < 0)
+ if (comp_level >= 0) {
+ if (H5Pset_deflate(dcpl, (unsigned)comp_level) < 0)
return -1;
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Creating datasets\n");
/* Create the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++) {
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++) {
- if((symbol_info[u][v].dsid = H5Dcreate2(fid, symbol_info[u][v].name, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((symbol_info[u][v].dsid =
+ H5Dcreate2(fid, symbol_info[u][v].name, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
return -1;
symbol_info[u][v].nrecords = 0;
@@ -195,7 +191,6 @@ create_datasets(hid_t fid, int comp_level, hbool_t verbose, FILE *verbose_file,
return 0;
} /* create_datasets() */
-
/*-------------------------------------------------------------------------
* Function: add_records
*
@@ -215,16 +210,15 @@ create_datasets(hid_t fid, int comp_level, hbool_t verbose, FILE *verbose_file,
*-------------------------------------------------------------------------
*/
static int
-add_records(hid_t fid, hbool_t verbose, FILE *verbose_file,
- unsigned long nrecords, unsigned long flush_count)
+add_records(hid_t fid, hbool_t verbose, FILE *verbose_file, unsigned long nrecords, unsigned long flush_count)
{
- hid_t tid; /* Datatype ID for records */
- hid_t mem_sid; /* Memory dataspace ID */
- hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
- hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */
- symbol_t record; /* The record to add to the dataset */
- unsigned long rec_to_flush; /* # of records left to write before flush */
- unsigned long u, v; /* Local index variables */
+ hid_t tid; /* Datatype ID for records */
+ hid_t mem_sid; /* Memory dataspace ID */
+ hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
+ hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */
+ symbol_t record; /* The record to add to the dataset */
+ unsigned long rec_to_flush; /* # of records left to write before flush */
+ unsigned long u, v; /* Local index variables */
HDassert(fid >= 0);
@@ -233,18 +227,18 @@ add_records(hid_t fid, hbool_t verbose, FILE *verbose_file,
HDmemset(&record, 0, sizeof(record));
/* Create a dataspace for the record to add */
- if((mem_sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((mem_sid = H5Screate(H5S_SCALAR)) < 0)
return -1;
/* Create datatype for appending records */
- if((tid = create_symbol_datatype()) < 0)
+ if ((tid = create_symbol_datatype()) < 0)
return -1;
/* Add records to random datasets, according to frequency distribution */
rec_to_flush = flush_count;
- for(u = 0; u < nrecords; u++) {
- symbol_info_t *symbol; /* Symbol to write record to */
- hid_t file_sid; /* Dataset's space ID */
+ for (u = 0; u < nrecords; u++) {
+ symbol_info_t *symbol; /* Symbol to write record to */
+ hid_t file_sid; /* Dataset's space ID */
/* Get a random dataset, according to the symbol distribution */
symbol = choose_dataset();
@@ -257,68 +251,68 @@ add_records(hid_t fid, hbool_t verbose, FILE *verbose_file,
/* Cork the metadata cache, to prevent the object header from being
* flushed before the data has been written */
- if(H5Odisable_mdc_flushes(symbol->dsid) < 0)
+ if (H5Odisable_mdc_flushes(symbol->dsid) < 0)
return -1;
/* Extend the dataset's dataspace to hold the new record */
symbol->nrecords++;
dim[1] = symbol->nrecords;
- if(H5Dset_extent(symbol->dsid, dim) < 0)
+ if (H5Dset_extent(symbol->dsid, dim) < 0)
return -1;
/* Get the dataset's dataspace */
- if((file_sid = H5Dget_space(symbol->dsid)) < 0)
+ if ((file_sid = H5Dget_space(symbol->dsid)) < 0)
return -1;
/* Choose the last record in the dataset */
- if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
return -1;
/* Write record to the dataset */
- if(H5Dwrite(symbol->dsid, tid, mem_sid, file_sid, H5P_DEFAULT, &record) < 0)
+ if (H5Dwrite(symbol->dsid, tid, mem_sid, file_sid, H5P_DEFAULT, &record) < 0)
return -1;
/* Uncork the metadata cache */
- if(H5Oenable_mdc_flushes(symbol->dsid) < 0)
+ if (H5Oenable_mdc_flushes(symbol->dsid) < 0)
return -1;
/* Close the dataset's dataspace */
- if(H5Sclose(file_sid) < 0)
+ if (H5Sclose(file_sid) < 0)
return -1;
/* Check for flushing file */
- if(flush_count > 0) {
+ if (flush_count > 0) {
/* Decrement count of records to write before flushing */
rec_to_flush--;
/* Check for counter being reached */
- if(0 == rec_to_flush) {
+ if (0 == rec_to_flush) {
/* Flush contents of file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
return -1;
/* Reset flush counter */
rec_to_flush = flush_count;
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
/* Close the memory dataspace */
- if(H5Sclose(mem_sid) < 0)
+ if (H5Sclose(mem_sid) < 0)
return -1;
/* Close the datatype */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Closing datasets\n");
/* Close the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++)
- if(H5Dclose(symbol_info[u][v].dsid) < 0)
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++)
+ if (H5Dclose(symbol_info[u][v].dsid) < 0)
return -1;
return 0;
@@ -353,36 +347,37 @@ usage(void)
/*
* Can test with different scenarios as below:
* 1) create_file(), create_datasets(), H5Fstart_swmr_write(), add_records(), H5Fclose().
- * 2) create_file(), create_close_datasets(), open_datasets(), H5Fstart_swmr_write(), add_records(), H5Fclose().
- * 3) create_file(), create_close_datasets(), H5Fclose(),
- * open_file(), open_dataset(), H5Fstart_swmr_write(), add_records(), H5Fclose().
+ * 2) create_file(), create_close_datasets(), open_datasets(), H5Fstart_swmr_write(), add_records(),
+ *H5Fclose(). 3) create_file(), create_close_datasets(), H5Fclose(), open_file(), open_dataset(),
+ *H5Fstart_swmr_write(), add_records(), H5Fclose().
*/
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- hid_t fid; /* File ID for file opened */
- long nrecords = 0; /* # of records to append */
- long flush_count = 10000; /* # of records to write between flushing file */
- hbool_t verbose = TRUE; /* Whether to emit some informational messages */
- FILE *verbose_file = NULL; /* File handle for verbose output */
- hbool_t use_seed = FALSE; /* Set to TRUE if a seed was set on the command line */
- unsigned random_seed = 0; /* Random # seed */
- int comp_level = -1; /* Compression level (-1 is no compression) */
- const char *index_type = "b1"; /* Chunk index type */
- unsigned u; /* Local index variable */
- int temp; /* Temporary variable */
+ hid_t fid; /* File ID for file opened */
+ long nrecords = 0; /* # of records to append */
+ long flush_count = 10000; /* # of records to write between flushing file */
+ hbool_t verbose = TRUE; /* Whether to emit some informational messages */
+ FILE * verbose_file = NULL; /* File handle for verbose output */
+ hbool_t use_seed = FALSE; /* Set to TRUE if a seed was set on the command line */
+ unsigned random_seed = 0; /* Random # seed */
+ int comp_level = -1; /* Compression level (-1 is no compression) */
+ const char *index_type = "b1"; /* Chunk index type */
+ unsigned u; /* Local index variable */
+ int temp; /* Temporary variable */
/* Parse command line options */
- if(argc < 2)
+ if (argc < 2)
usage();
- if(argc > 1) {
+ if (argc > 1) {
u = 1;
- while(u < (unsigned)argc) {
- if(argv[u][0] == '-') {
- switch(argv[u][1]) {
+ while (u < (unsigned)argc) {
+ if (argv[u][0] == '-') {
+ switch (argv[u][1]) {
/* Compress dataset chunks */
case 'c':
comp_level = HDatoi(argv[u + 1]);
- if(comp_level < -1 || comp_level > 9)
+ if (comp_level < -1 || comp_level > 9)
usage();
u += 2;
break;
@@ -390,8 +385,7 @@ int main(int argc, const char *argv[])
/* Chunk index type */
case 'i':
index_type = argv[u + 1];
- if(HDstrcmp(index_type, "ea")
- && HDstrcmp(index_type, "b2"))
+ if (HDstrcmp(index_type, "ea") && HDstrcmp(index_type, "b2"))
usage();
u += 2;
break;
@@ -399,7 +393,7 @@ int main(int argc, const char *argv[])
/* # of records to write between flushing file */
case 'f':
flush_count = HDatol(argv[u + 1]);
- if(flush_count < 0)
+ if (flush_count < 0)
usage();
u += 2;
break;
@@ -413,8 +407,8 @@ int main(int argc, const char *argv[])
/* Random # seed */
case 'r':
use_seed = TRUE;
- temp = HDatoi(argv[u + 1]);
- if(temp < 0)
+ temp = HDatoi(argv[u + 1]);
+ if (temp < 0)
usage();
else
random_seed = (unsigned)temp;
@@ -425,25 +419,25 @@ int main(int argc, const char *argv[])
usage();
break;
} /* end switch */
- } /* end if */
+ } /* end if */
else {
/* Get the number of records to append */
nrecords = HDatol(argv[u]);
- if(nrecords <= 0)
+ if (nrecords <= 0)
usage();
u++;
} /* end else */
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
- if(nrecords <= 0)
+ if (nrecords <= 0)
usage();
- if(flush_count >= nrecords)
+ if (flush_count >= nrecords)
usage();
/* Set the random seed */
- if(!use_seed) {
+ if (!use_seed) {
struct timeval t;
HDgettimeofday(&t, NULL);
@@ -452,18 +446,18 @@ int main(int argc, const char *argv[])
HDsrandom(random_seed);
/* Open output file */
- if(verbose) {
+ if (verbose) {
char verbose_name[1024];
HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_writer.out.%u", random_seed);
- if(NULL == (verbose_file = HDfopen(verbose_name, "w"))) {
+ if (NULL == (verbose_file = HDfopen(verbose_name, "w"))) {
HDfprintf(stderr, "Can't open verbose output file!\n");
HDexit(EXIT_FAILURE);
}
} /* end if */
/* Emit informational message */
- if(verbose) {
+ if (verbose) {
HDfprintf(verbose_file, "Parameters:\n");
HDfprintf(verbose_file, "\tindex type = %s\n", index_type);
HDfprintf(verbose_file, "\tcompression level = %d\n", comp_level);
@@ -475,27 +469,27 @@ int main(int argc, const char *argv[])
HDfprintf(stdout, "Using writer random seed: %u\n", random_seed);
/* Create the test file */
- if((fid = create_file(FILENAME, verbose, verbose_file, random_seed)) < 0) {
+ if ((fid = create_file(FILENAME, verbose, verbose_file, random_seed)) < 0) {
HDfprintf(stderr, "Error creating the file...\n");
HDexit(EXIT_FAILURE);
}
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Generating symbol names\n");
/* Generate dataset names */
- if(generate_symbols() < 0)
+ if (generate_symbols() < 0)
return -1;
/* Create the datasets in the file */
- if(create_datasets(fid, comp_level, verbose, verbose_file, index_type) < 0) {
+ if (create_datasets(fid, comp_level, verbose, verbose_file, index_type) < 0) {
HDfprintf(stderr, "Error creating datasets...\n");
HDexit(EXIT_FAILURE);
}
/* Enable SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0) {
+ if (H5Fstart_swmr_write(fid) < 0) {
HDfprintf(stderr, "Error starting SWMR writing mode...\n");
HDexit(EXIT_FAILURE);
}
@@ -504,35 +498,34 @@ int main(int argc, const char *argv[])
h5_send_message(WRITER_MESSAGE, NULL, NULL);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Adding records\n");
/* Append records to datasets */
- if(add_records(fid, verbose, verbose_file, (unsigned long)nrecords, (unsigned long)flush_count) < 0) {
+ if (add_records(fid, verbose, verbose_file, (unsigned long)nrecords, (unsigned long)flush_count) < 0) {
HDfprintf(stderr, "Error appending records to datasets!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Releasing symbols\n");
/* Clean up the symbols */
- if(shutdown_symbols() < 0) {
+ if (shutdown_symbols() < 0) {
HDfprintf(stderr, "Error releasing symbols!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Closing the file\n");
/* Close objects opened */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
HDfprintf(stderr, "Error closing file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
return 0;
} /* main() */
-
diff --git a/test/swmr_writer.c b/test/swmr_writer.c
index 656a5b2..97ed501 100644
--- a/test/swmr_writer.c
+++ b/test/swmr_writer.c
@@ -35,13 +35,12 @@
/* Local Prototypes */
/********************/
-static hid_t open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file,
- unsigned random_seed, hbool_t old);
-static int add_records(hid_t fid, hbool_t verbose, FILE *verbose_file,
- unsigned long nrecords, unsigned long flush_count);
-static void usage(void);
+static hid_t open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned random_seed,
+ hbool_t old);
+static int add_records(hid_t fid, hbool_t verbose, FILE *verbose_file, unsigned long nrecords,
+ unsigned long flush_count);
+static void usage(void);
-
/*-------------------------------------------------------------------------
* Function: open_skeleton
*
@@ -70,27 +69,26 @@ static void usage(void);
*-------------------------------------------------------------------------
*/
static hid_t
-open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file,
- unsigned random_seed, hbool_t old)
+open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned random_seed, hbool_t old)
{
- hid_t fid; /* File ID for new HDF5 file */
- hid_t fapl; /* File access property list */
- unsigned u, v; /* Local index variable */
- hbool_t use_log_vfd = FALSE; /* Use the log VFD (set this manually) */
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t fapl; /* File access property list */
+ unsigned u, v; /* Local index variable */
+ hbool_t use_log_vfd = FALSE; /* Use the log VFD (set this manually) */
HDassert(filename);
/* Create file access property list */
- if((fapl = h5_fileaccess()) < 0)
+ if ((fapl = h5_fileaccess()) < 0)
return -1;
- if(!old) {
+ if (!old) {
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
}
- if(use_log_vfd) {
+ if (use_log_vfd) {
char verbose_name[1024];
HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_writer.log.%u", random_seed);
@@ -99,21 +97,21 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file,
} /* end if */
/* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
return -1;
/* Close file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Opening datasets\n");
/* Open the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++) {
- if((symbol_info[u][v].dsid = H5Dopen2(fid, symbol_info[u][v].name, H5P_DEFAULT)) < 0)
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++) {
+ if ((symbol_info[u][v].dsid = H5Dopen2(fid, symbol_info[u][v].name, H5P_DEFAULT)) < 0)
return -1;
symbol_info[u][v].nrecords = 0;
} /* end for */
@@ -121,7 +119,6 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file,
return fid;
}
-
/*-------------------------------------------------------------------------
* Function: add_records
*
@@ -149,16 +146,15 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file,
*-------------------------------------------------------------------------
*/
static int
-add_records(hid_t fid, hbool_t verbose, FILE *verbose_file,
- unsigned long nrecords, unsigned long flush_count)
+add_records(hid_t fid, hbool_t verbose, FILE *verbose_file, unsigned long nrecords, unsigned long flush_count)
{
- hid_t tid; /* Datatype ID for records */
- hid_t mem_sid; /* Memory dataspace ID */
- hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
- hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */
- symbol_t record; /* The record to add to the dataset */
- unsigned long rec_to_flush; /* # of records left to write before flush */
- unsigned long u, v; /* Local index variables */
+ hid_t tid; /* Datatype ID for records */
+ hid_t mem_sid; /* Memory dataspace ID */
+ hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
+ hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */
+ symbol_t record; /* The record to add to the dataset */
+ unsigned long rec_to_flush; /* # of records left to write before flush */
+ unsigned long u, v; /* Local index variables */
HDassert(fid >= 0);
@@ -167,18 +163,18 @@ add_records(hid_t fid, hbool_t verbose, FILE *verbose_file,
HDmemset(&record, 0, sizeof(record));
/* Create a dataspace for the record to add */
- if((mem_sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((mem_sid = H5Screate(H5S_SCALAR)) < 0)
return -1;
/* Create datatype for appending records */
- if((tid = create_symbol_datatype()) < 0)
+ if ((tid = create_symbol_datatype()) < 0)
return -1;
/* Add records to random datasets, according to frequency distribution */
rec_to_flush = flush_count;
- for(u = 0; u < nrecords; u++) {
- symbol_info_t *symbol; /* Symbol to write record to */
- hid_t file_sid; /* Dataset's space ID */
+ for (u = 0; u < nrecords; u++) {
+ symbol_info_t *symbol; /* Symbol to write record to */
+ hid_t file_sid; /* Dataset's space ID */
/* Get a random dataset, according to the symbol distribution */
symbol = choose_dataset();
@@ -191,68 +187,68 @@ add_records(hid_t fid, hbool_t verbose, FILE *verbose_file,
/* Cork the metadata cache, to prevent the object header from being
* flushed before the data has been written */
- if(H5Odisable_mdc_flushes(symbol->dsid) < 0)
+ if (H5Odisable_mdc_flushes(symbol->dsid) < 0)
return -1;
/* Extend the dataset's dataspace to hold the new record */
symbol->nrecords++;
dim[1] = symbol->nrecords;
- if(H5Dset_extent(symbol->dsid, dim) < 0)
+ if (H5Dset_extent(symbol->dsid, dim) < 0)
return -1;
/* Get the dataset's dataspace */
- if((file_sid = H5Dget_space(symbol->dsid)) < 0)
+ if ((file_sid = H5Dget_space(symbol->dsid)) < 0)
return -1;
/* Choose the last record in the dataset */
- if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
return -1;
/* Write record to the dataset */
- if(H5Dwrite(symbol->dsid, tid, mem_sid, file_sid, H5P_DEFAULT, &record) < 0)
+ if (H5Dwrite(symbol->dsid, tid, mem_sid, file_sid, H5P_DEFAULT, &record) < 0)
return -1;
/* Uncork the metadata cache */
- if(H5Oenable_mdc_flushes(symbol->dsid) < 0)
+ if (H5Oenable_mdc_flushes(symbol->dsid) < 0)
return -1;
/* Close the dataset's dataspace */
- if(H5Sclose(file_sid) < 0)
+ if (H5Sclose(file_sid) < 0)
return -1;
/* Check for flushing file */
- if(flush_count > 0) {
+ if (flush_count > 0) {
/* Decrement count of records to write before flushing */
rec_to_flush--;
/* Check for counter being reached */
- if(0 == rec_to_flush) {
+ if (0 == rec_to_flush) {
/* Flush contents of file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
return -1;
/* Reset flush counter */
rec_to_flush = flush_count;
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
/* Close the memory dataspace */
- if(H5Sclose(mem_sid) < 0)
+ if (H5Sclose(mem_sid) < 0)
return -1;
/* Close the datatype */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Closing datasets\n");
/* Close the datasets */
- for(u = 0; u < NLEVELS; u++)
- for(v = 0; v < symbol_count[u]; v++)
- if(H5Dclose(symbol_info[u][v].dsid) < 0)
+ for (u = 0; u < NLEVELS; u++)
+ for (v = 0; v < symbol_count[u]; v++)
+ if (H5Dclose(symbol_info[u][v].dsid) < 0)
return -1;
return 0;
@@ -278,31 +274,32 @@ usage(void)
HDexit(EXIT_FAILURE);
}
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- hid_t fid; /* File ID for file opened */
- long nrecords = 0; /* # of records to append */
- long flush_count = 10000; /* # of records to write between flushing file */
- hbool_t verbose = TRUE; /* Whether to emit some informational messages */
- FILE *verbose_file = NULL; /* File handle for verbose output */
- hbool_t old = FALSE; /* Whether to use non-latest-format when opening file */
- hbool_t use_seed = FALSE; /* Set to TRUE if a seed was set on the command line */
- unsigned random_seed = 0; /* Random # seed */
- unsigned u; /* Local index variable */
- int temp;
+ hid_t fid; /* File ID for file opened */
+ long nrecords = 0; /* # of records to append */
+ long flush_count = 10000; /* # of records to write between flushing file */
+ hbool_t verbose = TRUE; /* Whether to emit some informational messages */
+ FILE * verbose_file = NULL; /* File handle for verbose output */
+ hbool_t old = FALSE; /* Whether to use non-latest-format when opening file */
+ hbool_t use_seed = FALSE; /* Set to TRUE if a seed was set on the command line */
+ unsigned random_seed = 0; /* Random # seed */
+ unsigned u; /* Local index variable */
+ int temp;
/* Parse command line options */
- if(argc < 2)
+ if (argc < 2)
usage();
- if(argc > 1) {
+ if (argc > 1) {
u = 1;
- while(u < (unsigned)argc) {
- if(argv[u][0] == '-') {
- switch(argv[u][1]) {
+ while (u < (unsigned)argc) {
+ if (argv[u][0] == '-') {
+ switch (argv[u][1]) {
/* # of records to write between flushing file */
case 'f':
flush_count = HDatol(argv[u + 1]);
- if(flush_count < 0)
+ if (flush_count < 0)
usage();
u += 2;
break;
@@ -315,8 +312,8 @@ int main(int argc, const char *argv[])
/* Random # seed */
case 'r':
- use_seed = TRUE;
- temp = HDatoi(argv[u + 1]);
+ use_seed = TRUE;
+ temp = HDatoi(argv[u + 1]);
random_seed = (unsigned)temp;
u += 2;
break;
@@ -331,24 +328,24 @@ int main(int argc, const char *argv[])
usage();
break;
} /* end switch */
- } /* end if */
+ } /* end if */
else {
/* Get the number of records to append */
nrecords = HDatol(argv[u]);
- if(nrecords <= 0)
+ if (nrecords <= 0)
usage();
u++;
} /* end else */
- } /* end while */
- } /* end if */
- if(nrecords <= 0)
+ } /* end while */
+ } /* end if */
+ if (nrecords <= 0)
usage();
- if(flush_count >= nrecords)
+ if (flush_count >= nrecords)
usage();
/* Set the random seed */
- if(!use_seed) {
+ if (!use_seed) {
struct timeval t;
HDgettimeofday(&t, NULL);
@@ -357,18 +354,18 @@ int main(int argc, const char *argv[])
HDsrandom(random_seed);
/* Open output file */
- if(verbose) {
+ if (verbose) {
char verbose_name[1024];
HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_writer.out.%u", random_seed);
- if(NULL == (verbose_file = HDfopen(verbose_name, "w"))) {
+ if (NULL == (verbose_file = HDfopen(verbose_name, "w"))) {
HDfprintf(stderr, "Can't open verbose output file!\n");
HDexit(EXIT_FAILURE);
}
} /* end if */
/* Emit informational message */
- if(verbose) {
+ if (verbose) {
HDfprintf(verbose_file, "Parameters:\n");
HDfprintf(verbose_file, "\t# of records between flushes = %ld\n", flush_count);
HDfprintf(verbose_file, "\t# of records to write = %ld\n", nrecords);
@@ -378,19 +375,19 @@ int main(int argc, const char *argv[])
HDfprintf(stdout, "Using writer random seed: %u\n", random_seed);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Generating symbol names\n");
/* Generate dataset names */
- if(generate_symbols() < 0)
+ if (generate_symbols() < 0)
return -1;
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Opening skeleton file: %s\n", FILENAME);
/* Open file skeleton */
- if((fid = open_skeleton(FILENAME, verbose, verbose_file, random_seed, old)) < 0) {
+ if ((fid = open_skeleton(FILENAME, verbose, verbose_file, random_seed, old)) < 0) {
HDfprintf(stderr, "Error opening skeleton file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
@@ -399,35 +396,34 @@ int main(int argc, const char *argv[])
h5_send_message(WRITER_MESSAGE, NULL, NULL);
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Adding records\n");
/* Append records to datasets */
- if(add_records(fid, verbose, verbose_file, (unsigned long)nrecords, (unsigned long)flush_count) < 0) {
+ if (add_records(fid, verbose, verbose_file, (unsigned long)nrecords, (unsigned long)flush_count) < 0) {
HDfprintf(stderr, "Error appending records to datasets!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Releasing symbols\n");
/* Clean up the symbols */
- if(shutdown_symbols() < 0) {
+ if (shutdown_symbols() < 0) {
HDfprintf(stderr, "Error releasing symbols!\n");
HDexit(EXIT_FAILURE);
} /* end if */
/* Emit informational message */
- if(verbose)
+ if (verbose)
HDfprintf(verbose_file, "Closing objects\n");
/* Close objects opened */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
HDfprintf(stderr, "Error closing file!\n");
HDexit(EXIT_FAILURE);
} /* end if */
return 0;
}
-
diff --git a/test/tarray.c b/test/tarray.c
index e643fb0..ba0982f 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -12,59 +12,57 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tarray
-*
-* Test the Array Datatype functionality
-*
-*************************************************************/
+ *
+ * Test program: tarray
+ *
+ * Test the Array Datatype functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
#include "H5srcdir.h"
-#define FILENAME "tarray1.h5"
-#define TESTFILE "tarrold.h5"
+#define FILENAME "tarray1.h5"
+#define TESTFILE "tarrold.h5"
/* 1-D array datatype */
-#define ARRAY1_RANK 1
-#define ARRAY1_DIM1 4
+#define ARRAY1_RANK 1
+#define ARRAY1_DIM1 4
/* 3-D array datatype */
-#define ARRAY2_RANK 3
-#define ARRAY2_DIM1 3
-#define ARRAY2_DIM2 4
-#define ARRAY2_DIM3 5
+#define ARRAY2_RANK 3
+#define ARRAY2_DIM1 3
+#define ARRAY2_DIM2 4
+#define ARRAY2_DIM3 5
/* 2-D array datatype */
-#define ARRAY3_RANK 2
-#define ARRAY3_DIM1 6
-#define ARRAY3_DIM2 3
+#define ARRAY3_RANK 2
+#define ARRAY3_DIM1 6
+#define ARRAY3_DIM2 3
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
/* Parameters used with the test_array_bkg() test */
-#define FIELDNAME "ArrayofStructures"
-#define LENGTH 5
-#define ALEN 10
-#define RANK 1
-#define NMAX 100
+#define FIELDNAME "ArrayofStructures"
+#define LENGTH 5
+#define ALEN 10
+#define RANK 1
+#define NMAX 100
/* Struct used with test_array_bkg() test */
-typedef struct
-{
- int nsubfields;
- char *name[NMAX];
- size_t offset[NMAX];
- hid_t datatype[NMAX];
+typedef struct {
+ int nsubfields;
+ char * name[NMAX];
+ size_t offset[NMAX];
+ hid_t datatype[NMAX];
} CmpDTSinfo;
/* Forward declarations for custom vlen memory manager functions */
void *test_array_alloc_custom(size_t size, void *info);
-void test_array_free_custom(void *mem, void *info);
-
+void test_array_free_custom(void *mem, void *info);
/*-------------------------------------------------------------------------
* Function: test_array_atomic_1d
@@ -79,25 +77,25 @@ void test_array_free_custom(void *mem, void *info);
static void
test_array_atomic_1d(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i, j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Atomic Datatypes Functionality\n"));
/* Allocate and initialize array data to write */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++)
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
wdata[i][j] = i * 10 + j;
/* Create file */
@@ -136,7 +134,6 @@ test_array_atomic_1d(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -146,7 +143,7 @@ test_array_atomic_1d(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the datatype */
- tid1 = H5Dget_type (dataset);
+ tid1 = H5Dget_type(dataset);
CHECK(tid1, FAIL, "H5Dget_type");
/* Check the array rank */
@@ -158,9 +155,10 @@ test_array_atomic_1d(void)
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims; i++)
- if(rdims1[i] != tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
@@ -169,10 +167,11 @@ test_array_atomic_1d(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++)
- if(wdata[i][j] != rdata[i][j]) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d]=%d, rdata[%d][%d]=%d\n", (int)i, (int)j, (int)wdata[i][j], (int)i, (int)j, (int)rdata[i][j]);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ if (wdata[i][j] != rdata[i][j]) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d]=%d, rdata[%d][%d]=%d\n",
+ (int)i, (int)j, (int)wdata[i][j], (int)i, (int)j, (int)rdata[i][j]);
continue;
} /* end if */
@@ -189,7 +188,6 @@ test_array_atomic_1d(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_atomic_1d() */
-
/*-------------------------------------------------------------------------
* Function: test_array_funcs
*
@@ -203,48 +201,46 @@ test_array_atomic_1d(void)
static void
test_array_funcs(void)
{
- hid_t type; /* Datatype ID */
- hsize_t tdims1[] = {ARRAY1_DIM1};
- size_t size;
- H5T_pad_t inpad;
- H5T_norm_t norm;
- H5T_cset_t cset;
- H5T_str_t strpad;
- herr_t ret; /* Generic return value */
+ hid_t type; /* Datatype ID */
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ size_t size;
+ H5T_pad_t inpad;
+ H5T_norm_t norm;
+ H5T_cset_t cset;
+ H5T_str_t strpad;
+ herr_t ret; /* Generic return value */
/* Create a datatype to refer to */
type = H5Tarray_create2(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1);
CHECK(type, FAIL, "H5Tarray_create2");
- size=H5Tget_precision(type);
+ size = H5Tget_precision(type);
CHECK(size, 0, "H5Tget_precision");
- size=H5Tget_size(type);
+ size = H5Tget_size(type);
CHECK(size, 0, "H5Tget_size");
- size=H5Tget_ebias(type);
+ size = H5Tget_ebias(type);
CHECK(size, 0, "H5Tget_ebias");
- ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
+ ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
CHECK(ret, FAIL, "H5Tset_pad");
- inpad=H5Tget_inpad(type);
+ inpad = H5Tget_inpad(type);
CHECK(inpad, FAIL, "H5Tget_inpad");
- norm=H5Tget_norm(type);
+ norm = H5Tget_norm(type);
CHECK(norm, FAIL, "H5Tget_norm");
- ret=H5Tset_offset(type, (size_t)16);
+ ret = H5Tset_offset(type, (size_t)16);
CHECK(ret, FAIL, "H5Tset_offset");
- H5E_BEGIN_TRY {
- cset=H5Tget_cset(type);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { cset = H5Tget_cset(type); }
+ H5E_END_TRY;
VERIFY(cset, FAIL, "H5Tget_cset");
- H5E_BEGIN_TRY {
- strpad=H5Tget_strpad(type);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); }
+ H5E_END_TRY;
VERIFY(strpad, FAIL, "H5Tget_strpad");
/* Close datatype */
@@ -252,7 +248,6 @@ test_array_funcs(void)
CHECK(ret, FAIL, "H5Tclose");
} /* end test_array_funcs() */
-
/*-------------------------------------------------------------------------
* Function: test_array_atomic_3d
*
@@ -266,27 +261,27 @@ test_array_funcs(void)
static void
test_array_atomic_3d(void)
{
- int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
- int rdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information read in */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3};
- int ndims; /* Array rank for reading */
- hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
+ int rdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information read in */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims2[] = {ARRAY2_DIM1, ARRAY2_DIM2, ARRAY2_DIM3};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i, j, k, l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 3-D Array of Atomic Datatypes Functionality\n"));
/* Allocate and initialize array data to write */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY2_DIM1; j++)
- for(k = 0; k < ARRAY2_DIM2; k++)
- for(l = 0; l < ARRAY2_DIM3; l++)
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY2_DIM1; j++)
+ for (k = 0; k < ARRAY2_DIM2; k++)
+ for (l = 0; l < ARRAY2_DIM3; l++)
wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l;
/* Create file */
@@ -325,7 +320,6 @@ test_array_atomic_3d(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -335,7 +329,7 @@ test_array_atomic_3d(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the datatype */
- tid = H5Dget_type (dataset);
+ tid = H5Dget_type(dataset);
CHECK(tid, FAIL, "H5Dget_type");
/* Check the array rank */
@@ -347,9 +341,10 @@ test_array_atomic_3d(void)
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims; i++)
- if(rdims2[i] != tdims2[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n", (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims2[i] != tdims2[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",
+ (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]);
continue;
} /* end if */
@@ -358,12 +353,15 @@ test_array_atomic_3d(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY2_DIM1; j++)
- for(k = 0; k < ARRAY2_DIM2; k++)
- for(l = 0; l < ARRAY2_DIM3; l++)
- if(wdata[i][j][k][l] != rdata[i][j][k][l]) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n", (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j, (int)k, (int)l, (int)rdata[i][j][k][l]);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY2_DIM1; j++)
+ for (k = 0; k < ARRAY2_DIM2; k++)
+ for (l = 0; l < ARRAY2_DIM3; l++)
+ if (wdata[i][j][k][l] != rdata[i][j][k][l]) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, "
+ "rdata[%d][%d][%d][%d]=%d\n",
+ (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j,
+ (int)k, (int)l, (int)rdata[i][j][k][l]);
continue;
} /* end if */
@@ -381,7 +379,6 @@ test_array_atomic_3d(void)
} /* end test_array_atomic_3d() */
-
/*-------------------------------------------------------------------------
* Function: test_array_array_atomic
*
@@ -395,31 +392,31 @@ test_array_atomic_3d(void)
static void
test_array_array_atomic(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
- int rdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information read in */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid1; /* 1-D array Datatype ID */
- hid_t tid2; /* 2-D array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2};
- int ndims1; /* Array rank for reading */
- int ndims2; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
+ int rdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information read in */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid1; /* 1-D array Datatype ID */
+ hid_t tid2; /* 2-D array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ hsize_t tdims2[] = {ARRAY3_DIM1, ARRAY3_DIM2};
+ int ndims1; /* Array rank for reading */
+ int ndims2; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i, j, k, l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array 2-D Arrays of Atomic Datatypes Functionality\n"));
/* Allocate and initialize array data to write */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++)
- for(k = 0; k < ARRAY3_DIM1; k++)
- for(l = 0; l < ARRAY3_DIM2; l++)
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ for (k = 0; k < ARRAY3_DIM1; k++)
+ for (l = 0; l < ARRAY3_DIM2; l++)
wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l;
/* Create file */
@@ -464,7 +461,6 @@ test_array_array_atomic(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -486,9 +482,10 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims1; i++)
- if(rdims1[i] != tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
+ for (i = 0; i < ndims1; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
@@ -505,9 +502,10 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims2; i++)
- if(rdims2[i] != tdims2[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n", (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]);
+ for (i = 0; i < ndims2; i++)
+ if (rdims2[i] != tdims2[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",
+ (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]);
continue;
} /* end if */
@@ -516,12 +514,15 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++)
- for(k = 0; k < ARRAY3_DIM1; k++)
- for(l = 0; l < ARRAY3_DIM2; l++)
- if(wdata[i][j][k][l] != rdata[i][j][k][l]) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n", (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j, (int)k, (int)l, (int)rdata[i][j][k][l]);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ for (k = 0; k < ARRAY3_DIM1; k++)
+ for (l = 0; l < ARRAY3_DIM2; l++)
+ if (wdata[i][j][k][l] != rdata[i][j][k][l]) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, "
+ "rdata[%d][%d][%d][%d]=%d\n",
+ (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j,
+ (int)k, (int)l, (int)rdata[i][j][k][l]);
continue;
} /* end if */
@@ -540,7 +541,6 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_array_atomic() */
-
/*-------------------------------------------------------------------------
* Function: test_array_compound_atomic
*
@@ -554,35 +554,35 @@ test_array_array_atomic(void)
static void
test_array_compound_atomic(void)
{
- typedef struct { /* Typedef for compound datatype */
- int i;
+ typedef struct { /* Typedef for compound datatype */
+ int i;
float f;
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- int i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int nmemb; /* Number of compound members */
+ char * mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ int i, j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Compound Atomic Datatypes Functionality\n"));
/* Initialize array data to write */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++) {
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
wdata[i][j].i = i * 10 + j;
wdata[i][j].f = (float)i * 2.5F + (float)j;
} /* end for */
@@ -639,7 +639,6 @@ test_array_compound_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -654,31 +653,32 @@ test_array_compound_atomic(void)
/* Check the array rank */
ndims = H5Tget_array_ndims(tid1);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid1, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims; i++)
- if(rdims1[i] != tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Get the compound datatype */
- tid2 = H5Tget_super (tid1);
+ tid2 = H5Tget_super(tid1);
CHECK(tid2, FAIL, "H5Tget_super");
/* Check the number of members */
nmemb = H5Tget_nmembers(tid2);
- VERIFY(nmemb,2,"H5Tget_nmembers");
+ VERIFY(nmemb, 2, "H5Tget_nmembers");
/* Check the 1st field's name */
mname = H5Tget_member_name(tid2, 0);
CHECK_PTR(mname, "H5Tget_member_name");
- if(HDstrcmp(mname, "i") != 0)
+ if (HDstrcmp(mname, "i") != 0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
@@ -689,7 +689,7 @@ test_array_compound_atomic(void)
/* Check the 1st field's datatype */
mtid = H5Tget_member_type(tid2, 0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret = H5Tequal(mtid,H5T_NATIVE_INT)) <= 0)
+ if ((ret = H5Tequal(mtid, H5T_NATIVE_INT)) <= 0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
@@ -697,7 +697,7 @@ test_array_compound_atomic(void)
/* Check the 2nd field's name */
mname = H5Tget_member_name(tid2, 1);
CHECK_PTR(mname, "H5Tget_member_name");
- if(HDstrcmp(mname, "f") != 0)
+ if (HDstrcmp(mname, "f") != 0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
@@ -708,7 +708,7 @@ test_array_compound_atomic(void)
/* Check the 2nd field's datatype */
mtid = H5Tget_member_type(tid2, 1);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret = H5Tequal(mtid, H5T_NATIVE_FLOAT)) <= 0)
+ if ((ret = H5Tequal(mtid, H5T_NATIVE_FLOAT)) <= 0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
@@ -722,17 +722,21 @@ test_array_compound_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++) {
- if(wdata[i][j].i != rdata[i][j].i) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", (int)i, (int)j, (int)wdata[i][j].i, (int)i, (int)j, (int)rdata[i][j].i);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ if (wdata[i][j].i != rdata[i][j].i) {
+ TestErrPrintf(
+ "Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", (int)i,
+ (int)j, (int)wdata[i][j].i, (int)i, (int)j, (int)rdata[i][j].i);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(wdata[i][j].f, rdata[i][j].f)) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n", (int)i, (int)j, (double)wdata[i][j].f, (int)i, (int)j, (double)rdata[i][j].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i][j].f, rdata[i][j].f)) {
+ TestErrPrintf(
+ "Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n", (int)i,
+ (int)j, (double)wdata[i][j].f, (int)i, (int)j, (double)rdata[i][j].f);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Close Datatype */
ret = H5Tclose(tid1);
@@ -747,7 +751,6 @@ test_array_compound_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_compound_atomic() */
-
/*-------------------------------------------------------------------------
* Function: test_array_compound_array
*
@@ -761,39 +764,39 @@ test_array_compound_atomic(void)
static void
test_array_compound_array(void)
{
- typedef struct { /* Typedef for compound datatype */
- int i;
+ typedef struct { /* Typedef for compound datatype */
+ int i;
float f[ARRAY1_DIM1];
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
hsize_t sdims1[] = {SPACE1_DIM1};
hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- H5T_class_t mclass; /* Datatype class for field */
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int nmemb; /* Number of compound members */
+ char * mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ H5T_class_t mclass; /* Datatype class for field */
+ int i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Compound Array Datatypes Functionality\n"));
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].i=i*10+j;
- for(k=0; k<ARRAY1_DIM1; k++)
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].i = i * 10 + j;
+ for (k = 0; k < ARRAY1_DIM1; k++)
wdata[i][j].f[k] = (float)i * 10.0F + (float)j * 2.5F + (float)k;
} /* end for */
@@ -810,7 +813,7 @@ test_array_compound_array(void)
CHECK(tid2, FAIL, "H5Tcreate");
/* Insert integer field */
- ret = H5Tinsert (tid2, "i", HOFFSET(s1_t,i), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid2, "i", HOFFSET(s1_t, i), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
/* Create an array of floats datatype */
@@ -857,7 +860,6 @@ test_array_compound_array(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -867,98 +869,100 @@ test_array_compound_array(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the datatype */
- tid1 = H5Dget_type (dataset);
+ tid1 = H5Dget_type(dataset);
CHECK(tid1, FAIL, "H5Dget_type");
/* Check the array rank */
- ndims=H5Tget_array_ndims(tid1);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(tid1);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid1, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Get the compound datatype */
- tid2 = H5Tget_super (tid1);
+ tid2 = H5Tget_super(tid1);
CHECK(tid2, FAIL, "H5Tget_super");
/* Check the number of members */
- nmemb=H5Tget_nmembers(tid2);
- VERIFY(nmemb,2,"H5Tget_nmembers");
+ nmemb = H5Tget_nmembers(tid2);
+ VERIFY(nmemb, 2, "H5Tget_nmembers");
/* Check the 1st field's name */
- mname=H5Tget_member_name(tid2,0);
+ mname = H5Tget_member_name(tid2, 0);
CHECK_PTR(mname, "H5Tget_member_name");
- if(HDstrcmp(mname,"i")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ if (HDstrcmp(mname, "i") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 1st field's offset */
- off=H5Tget_member_offset(tid2,0);
- VERIFY(off, HOFFSET(s1_t,i), "H5Tget_member_offset");
+ off = H5Tget_member_offset(tid2, 0);
+ VERIFY(off, HOFFSET(s1_t, i), "H5Tget_member_offset");
/* Check the 1st field's datatype */
- mtid=H5Tget_member_type(tid2,0);
+ mtid = H5Tget_member_type(tid2, 0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_NATIVE_INT)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
- mname=H5Tget_member_name(tid2,1);
+ mname = H5Tget_member_name(tid2, 1);
CHECK_PTR(mname, "H5Tget_member_name");
- if(HDstrcmp(mname,"f")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ if (HDstrcmp(mname, "f") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 2nd field's offset */
- off=H5Tget_member_offset(tid2,1);
- VERIFY(off, HOFFSET(s1_t,f), "H5Tget_member_offset");
+ off = H5Tget_member_offset(tid2, 1);
+ VERIFY(off, HOFFSET(s1_t, f), "H5Tget_member_offset");
/* Check the 2nd field's datatype */
- mtid=H5Tget_member_type(tid2,1);
+ mtid = H5Tget_member_type(tid2, 1);
CHECK(mtid, FAIL, "H5Tget_member_type");
/* Get the 2nd field's class */
- mclass=H5Tget_class(mtid);
+ mclass = H5Tget_class(mtid);
VERIFY(mclass, H5T_ARRAY, "H5Tget_class");
/* Check the array rank */
- ndims=H5Tget_array_ndims(mtid);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(mtid);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(mtid, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Nested array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Nested array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Check the nested array's datatype */
- tid3=H5Tget_super(mtid);
+ tid3 = H5Tget_super(mtid);
CHECK(tid3, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid3,H5T_NATIVE_FLOAT))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
+ if ((ret = H5Tequal(tid3, H5T_NATIVE_FLOAT)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
/* Close the array's base type datatype */
- ret=H5Tclose(tid3);
+ ret = H5Tclose(tid3);
CHECK(mtid, FAIL, "H5Tclose");
/* Close the member datatype */
- ret=H5Tclose(mtid);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Close Compound Datatype */
@@ -966,23 +970,28 @@ test_array_compound_array(void)
CHECK(ret, FAIL, "H5Tclose");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- for(j=0; j<ARRAY1_DIM1; j++) {
- if(wdata[i][j].i!=rdata[i][j].i) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",(int)i,(int)j,(int)wdata[i][j].i,(int)i,(int)j,(int)rdata[i][j].i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ if (wdata[i][j].i != rdata[i][j].i) {
+ TestErrPrintf(
+ "Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", (int)i,
+ (int)j, (int)wdata[i][j].i, (int)i, (int)j, (int)rdata[i][j].i);
continue;
} /* end if */
- for(k=0; k<ARRAY1_DIM1; k++)
- if(!H5_FLT_ABS_EQUAL(wdata[i][j].f[k],rdata[i][j].f[k])) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f[%d]=%f, rdata[%d][%d].f[%d]=%f\n",(int)i,(int)j,(int)k,(double)wdata[i][j].f[k],(int)i,(int)j,(int)k,(double)rdata[i][j].f[k]);
+ for (k = 0; k < ARRAY1_DIM1; k++)
+ if (!H5_FLT_ABS_EQUAL(wdata[i][j].f[k], rdata[i][j].f[k])) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f[%d]=%f, "
+ "rdata[%d][%d].f[%d]=%f\n",
+ (int)i, (int)j, (int)k, (double)wdata[i][j].f[k], (int)i, (int)j, (int)k,
+ (double)rdata[i][j].f[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close Datatype */
ret = H5Tclose(tid1);
@@ -1026,9 +1035,9 @@ test_array_compound_array(void)
void *
test_array_alloc_custom(size_t size, void *info)
{
- void *ret_value = NULL; /* Pointer to return */
- size_t *mem_used = (size_t *)info; /* Pointer to the memory used */
- size_t extra; /* Extra space needed */
+ void * ret_value = NULL; /* Pointer to return */
+ size_t *mem_used = (size_t *)info; /* Pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
@@ -1036,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info)
*/
extra = MAX(sizeof(void *), sizeof(size_t));
- if((ret_value = HDmalloc(extra+size)) != NULL) {
+ if ((ret_value = HDmalloc(extra + size)) != NULL) {
*(size_t *)ret_value = size;
*mem_used += size;
} /* end if */
@@ -1045,7 +1054,6 @@ test_array_alloc_custom(size_t size, void *info)
return ret_value;
} /* end test_array_alloc_custom() */
-
/*-------------------------------------------------------------------------
* Function: test_array_free_custom
*
@@ -1062,9 +1070,9 @@ test_array_alloc_custom(size_t size, void *info)
void
test_array_free_custom(void *_mem, void *info)
{
- unsigned char *mem = NULL; /* Pointer to mem to be freed */
- size_t *mem_used = (size_t *)info; /* Pointer to the memory used */
- size_t extra; /* Extra space needed */
+ unsigned char *mem = NULL; /* Pointer to mem to be freed */
+ size_t * mem_used = (size_t *)info; /* Pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
@@ -1072,7 +1080,7 @@ test_array_free_custom(void *_mem, void *info)
*/
extra = MAX(sizeof(void *), sizeof(size_t));
- if(_mem != NULL) {
+ if (_mem != NULL) {
mem = ((unsigned char *)_mem) - extra;
*mem_used -= *(size_t *)((void *)mem);
HDfree(mem);
@@ -1081,7 +1089,6 @@ test_array_free_custom(void *_mem, void *info)
return;
} /* end test_array_free_custom() */
-
/*-------------------------------------------------------------------------
* Function: test_array_vlen_atomic
*
@@ -1095,35 +1102,35 @@ test_array_free_custom(void *_mem, void *info)
static void
test_array_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Atomic Datatype ID */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Atomic Datatype ID */
hsize_t sdims1[] = {SPACE1_DIM1};
hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- size_t mem_used=0; /* Memory used during allocation */
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ size_t mem_used = 0; /* Memory used during allocation */
+ int i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Atomic Variable-Length Datatypes Functionality\n"));
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((size_t)(i+j+1) * sizeof(unsigned int));
- wdata[i][j].len = (size_t)(i+j+1);
- for(k=0; k<(i+j+1); k++)
- ((unsigned int *)wdata[i][j].p)[k] = (unsigned int)(i*100+j*10+k);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int));
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for (k = 0; k < (i + j + 1); k++)
+ ((unsigned int *)wdata[i][j].p)[k] = (unsigned int)(i * 100 + j * 10 + k);
} /* end for */
/* Create file */
@@ -1170,7 +1177,6 @@ test_array_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1180,45 +1186,46 @@ test_array_vlen_atomic(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the dataspace */
- sid1 = H5Dget_space (dataset);
+ sid1 = H5Dget_space(dataset);
CHECK(sid1, FAIL, "H5Dget_space");
/* Get the datatype */
- tid1 = H5Dget_type (dataset);
+ tid1 = H5Dget_type(dataset);
CHECK(tid1, FAIL, "H5Dget_type");
/* Check the array rank */
- ndims=H5Tget_array_ndims(tid1);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(tid1);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid1, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Get the VL datatype */
- tid2 = H5Tget_super (tid1);
+ tid2 = H5Tget_super(tid1);
CHECK(tid2, FAIL, "H5Tget_super");
/* Get the 2nd field's class */
- mclass=H5Tget_class(tid2);
+ mclass = H5Tget_class(tid2);
VERIFY(mclass, H5T_VLEN, "H5Tget_class");
/* Check the VL datatype's base type */
- tid3=H5Tget_super(tid2);
+ tid3 = H5Tget_super(tid2);
CHECK(tid3, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid3,H5T_NATIVE_UINT))<=0)
- TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret);
+ if ((ret = H5Tequal(tid3, H5T_NATIVE_UINT)) <= 0)
+ TestErrPrintf("VL base datatype is incorrect!, ret=%d\n", (int)ret);
/* Close the array's base type datatype */
- ret=H5Tclose(tid3);
+ ret = H5Tclose(tid3);
CHECK(ret, FAIL, "H5Tclose");
/* Close VL Datatype */
@@ -1226,56 +1233,61 @@ test_array_vlen_atomic(void)
CHECK(ret, FAIL, "H5Tclose");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_array_alloc_custom,&mem_used,test_array_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_array_alloc_custom, &mem_used, test_array_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* # elements allocated = (1 + 2 + 3 + 4) + (2 + 3 + 4 + 5) +
* (3 + 4 + 5 + 6) + (4 + 5 + 6 + 7) = 64 elements
*/
- VERIFY(size,64*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+ VERIFY(size, 64 * sizeof(unsigned int), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* # elements allocated = (1 + 2 + 3 + 4) + (2 + 3 + 4 + 5) +
* (3 + 4 + 5 + 6) + (4 + 5 + 6 + 7) = 64 elements
*/
- VERIFY(mem_used,64*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, 64 * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- for(j=0; j<ARRAY1_DIM1; j++) {
- if(wdata[i][j].len!=rdata[i][j].len) {
- TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",(int)i,(int)j,(int)wdata[i][j].len,(int)i,(int)j,(int)rdata[i][j].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ if (wdata[i][j].len != rdata[i][j].len) {
+ TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",
+ (int)i, (int)j, (int)wdata[i][j].len, (int)i, (int)j, (int)rdata[i][j].len);
continue;
} /* end if */
- for(k=0; k<(int)rdata[i][j].len; k++) {
- if( ((unsigned int *)wdata[i][j].p)[k] != ((unsigned int *)rdata[i][j].p)[k] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d][%d].p[%d]=%d, rdata[%d][%d].p[%d]=%d\n",(int)i,(int)j,(int)k, (int)((unsigned int *)wdata[i][j].p)[k], (int)i,(int)j,(int)k, (int)((unsigned int *)rdata[i][j].p)[k]);
+ for (k = 0; k < (int)rdata[i][j].len; k++) {
+ if (((unsigned int *)wdata[i][j].p)[k] != ((unsigned int *)rdata[i][j].p)[k]) {
+ TestErrPrintf(
+ "VL data values don't match!, wdata[%d][%d].p[%d]=%d, rdata[%d][%d].p[%d]=%d\n",
+ (int)i, (int)j, (int)k, (int)((unsigned int *)wdata[i][j].p)[k], (int)i, (int)j,
+ (int)k, (int)((unsigned int *)rdata[i][j].p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
- ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close dataset transfer property list */
@@ -1296,7 +1308,6 @@ test_array_vlen_atomic(void)
} /* end test_array_vlen_atomic() */
-
/*-------------------------------------------------------------------------
* Function: test_array_vlen_array
*
@@ -1310,37 +1321,38 @@ test_array_vlen_atomic(void)
static void
test_array_vlen_array(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hid_t tid4; /* Atomic Datatype ID */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hid_t tid4; /* Atomic Datatype ID */
hsize_t sdims1[] = {SPACE1_DIM1};
hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- size_t mem_used=0; /* Memory used during allocation */
- int i,j,k,l; /* Index variables */
- herr_t ret; /* Generic return value */
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ size_t mem_used = 0; /* Memory used during allocation */
+ int i, j, k, l; /* Index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of 1-D Array Variable-Length Datatypes Functionality\n"));
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p = HDmalloc((size_t)(i+j+1) * sizeof(unsigned int) * (size_t)ARRAY1_DIM1);
- wdata[i][j].len = (size_t)(i+j+1);
- for(k=0; k<(i+j+1); k++)
- for(l=0; l<ARRAY1_DIM1; l++)
- ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l] = (unsigned int)(i*1000+j*100+k*10+l);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int) * (size_t)ARRAY1_DIM1);
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for (k = 0; k < (i + j + 1); k++)
+ for (l = 0; l < ARRAY1_DIM1; l++)
+ ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] =
+ (unsigned int)(i * 1000 + j * 100 + k * 10 + l);
}
/* Create file */
@@ -1395,7 +1407,6 @@ test_array_vlen_array(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1405,73 +1416,74 @@ test_array_vlen_array(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the dataspace */
- sid1 = H5Dget_space (dataset);
+ sid1 = H5Dget_space(dataset);
CHECK(sid1, FAIL, "H5Dget_space");
/* Get the datatype */
- tid1 = H5Dget_type (dataset);
+ tid1 = H5Dget_type(dataset);
CHECK(tid1, FAIL, "H5Dget_type");
/* Check the array rank */
- ndims=H5Tget_array_ndims(tid1);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(tid1);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid1, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Get the VL datatype */
- tid2 = H5Tget_super (tid1);
+ tid2 = H5Tget_super(tid1);
CHECK(tid2, FAIL, "H5Tget_super");
/* Get the VL datatype's class */
- mclass=H5Tget_class(tid2);
+ mclass = H5Tget_class(tid2);
VERIFY(mclass, H5T_VLEN, "H5Tget_class");
/* Check the VL datatype's base type */
- tid3=H5Tget_super(tid2);
+ tid3 = H5Tget_super(tid2);
CHECK(tid3, FAIL, "H5Tget_super");
/* Get the nested array datatype's class */
- mclass=H5Tget_class(tid3);
+ mclass = H5Tget_class(tid3);
VERIFY(mclass, H5T_ARRAY, "H5Tget_class");
/* Check the array rank */
- ndims=H5Tget_array_ndims(tid3);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(tid3);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid3, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Check the array's base type */
- tid4=H5Tget_super(tid3);
+ tid4 = H5Tget_super(tid3);
CHECK(tid4, FAIL, "H5Tget_super");
-
- if((ret=H5Tequal(tid4,H5T_NATIVE_UINT))<=0)
- TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret);
+ if ((ret = H5Tequal(tid4, H5T_NATIVE_UINT)) <= 0)
+ TestErrPrintf("VL base datatype is incorrect!, ret=%d\n", (int)ret);
/* Close the array's base type datatype */
- ret=H5Tclose(tid4);
+ ret = H5Tclose(tid4);
CHECK(ret, FAIL, "H5Tclose");
/* Close the nested array datatype */
- ret=H5Tclose(tid3);
+ ret = H5Tclose(tid3);
CHECK(ret, FAIL, "H5Tclose");
/* Close VL Datatype */
@@ -1479,58 +1491,66 @@ test_array_vlen_array(void)
CHECK(ret, FAIL, "H5Tclose");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_array_alloc_custom,&mem_used,test_array_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_array_alloc_custom, &mem_used, test_array_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* # elements allocated = (1 + 2 + 3 + 4) + (2 + 3 + 4 + 5) +
* (3 + 4 + 5 + 6) + (4 + 5 + 6 + 7) = 64*ARRAY1_DIM1 elements
*/
- VERIFY(size,64*(sizeof(unsigned int)*ARRAY1_DIM1),"H5Dvlen_get_buf_size");
+ VERIFY(size, 64 * (sizeof(unsigned int) * ARRAY1_DIM1), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* # elements allocated = (1 + 2 + 3 + 4) + (2 + 3 + 4 + 5) +
* (3 + 4 + 5 + 6) + (4 + 5 + 6 + 7) = 64*ARRAY1_DIM1 elements
*/
- VERIFY(mem_used,64*(sizeof(unsigned int)*ARRAY1_DIM1),"H5Dread");
+ VERIFY(mem_used, 64 * (sizeof(unsigned int) * ARRAY1_DIM1), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- for(j=0; j<ARRAY1_DIM1; j++) {
- if(wdata[i][j].len!=rdata[i][j].len) {
- TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",(int)i,(int)j,(int)wdata[i][j].len,(int)i,(int)j,(int)rdata[i][j].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ if (wdata[i][j].len != rdata[i][j].len) {
+ TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",
+ (int)i, (int)j, (int)wdata[i][j].len, (int)i, (int)j, (int)rdata[i][j].len);
continue;
} /* end if */
- for(k=0; k<(int)rdata[i][j].len; k++) {
- for(l=0; l<ARRAY1_DIM1; l++) {
- if( ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l] != ((unsigned int *)rdata[i][j].p)[k*ARRAY1_DIM1+l] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d][%d].p[%d][%d]=%d, rdata[%d][%d].p[%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l, (int)((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l], (int)i,(int)j,(int)k,(int)l, (int)((unsigned int *)rdata[i][j].p)[k*ARRAY1_DIM1+l]);
+ for (k = 0; k < (int)rdata[i][j].len; k++) {
+ for (l = 0; l < ARRAY1_DIM1; l++) {
+ if (((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] !=
+ ((unsigned int *)rdata[i][j].p)[k * ARRAY1_DIM1 + l]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d][%d].p[%d][%d]=%d, "
+ "rdata[%d][%d].p[%d][%d]=%d\n",
+ (int)i, (int)j, (int)k, (int)l,
+ (int)((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l], (int)i,
+ (int)j, (int)k, (int)l,
+ (int)((unsigned int *)rdata[i][j].p)[k * ARRAY1_DIM1 + l]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
- ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close dataset transfer property list */
@@ -1551,7 +1571,6 @@ test_array_vlen_array(void)
} /* end test_array_vlen_array() */
-
/*-------------------------------------------------------------------------
* Function: test_array_bkg
*
@@ -1566,35 +1585,35 @@ test_array_vlen_array(void)
static void
test_array_bkg(void)
{
- herr_t status = -1;
+ herr_t status = -1;
- hid_t fid, array_dt;
- hid_t space;
- hid_t type;
- hid_t dataset;
+ hid_t fid, array_dt;
+ hid_t space;
+ hid_t type;
+ hid_t dataset;
- hsize_t dim[] = {LENGTH};
- hsize_t dima[] = {ALEN};
+ hsize_t dim[] = {LENGTH};
+ hsize_t dima[] = {ALEN};
- int i, j;
- unsigned ndims[3] = {1,1,1};
+ int i, j;
+ unsigned ndims[3] = {1, 1, 1};
typedef struct {
- int a[ALEN];
- float b[ALEN];
- double c[ALEN];
+ int a[ALEN];
+ float b[ALEN];
+ double c[ALEN];
} CmpField;
- CmpField cf[LENGTH];
- CmpField cfr[LENGTH];
- CmpDTSinfo *dtsinfo = NULL;
+ CmpField cf[LENGTH];
+ CmpField cfr[LENGTH];
+ CmpDTSinfo *dtsinfo = NULL;
typedef struct {
- float b[ALEN];
+ float b[ALEN];
} fld_t;
- fld_t fld[LENGTH];
- fld_t fldr[LENGTH];
+ fld_t fld[LENGTH];
+ fld_t fldr[LENGTH];
/* Output message about test being performed */
MESSAGE(5, ("Testing Partial I/O of Array Fields in Compound Datatype Functionality\n"));
@@ -1610,8 +1629,7 @@ test_array_bkg(void)
cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j;
cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j);
} /* end for */
- } /* end for */
-
+ } /* end for */
/* Set the number of data members */
/* ------------------------------ */
@@ -1619,9 +1637,9 @@ test_array_bkg(void)
/* Initialize the offsets */
/* ----------------------- */
- dtsinfo->offset[0] = HOFFSET(CmpField, a);
- dtsinfo->offset[1] = HOFFSET(CmpField, b);
- dtsinfo->offset[2] = HOFFSET(CmpField, c);
+ dtsinfo->offset[0] = HOFFSET(CmpField, a);
+ dtsinfo->offset[1] = HOFFSET(CmpField, b);
+ dtsinfo->offset[2] = HOFFSET(CmpField, c);
/* Initialize the data type IDs */
/* ---------------------------- */
@@ -1629,17 +1647,15 @@ test_array_bkg(void)
dtsinfo->datatype[1] = H5T_NATIVE_FLOAT;
dtsinfo->datatype[2] = H5T_NATIVE_DOUBLE;
-
/* Initialize the names of data members */
/* ------------------------------------ */
for (i = 0; i < dtsinfo->nsubfields; i++)
- dtsinfo->name[i] = (char *)HDcalloc((size_t)20, sizeof(char));
+ dtsinfo->name[i] = (char *)HDcalloc((size_t)20, sizeof(char));
HDstrcpy(dtsinfo->name[0], "One");
HDstrcpy(dtsinfo->name[1], "Two");
HDstrcpy(dtsinfo->name[2], "Three");
-
/* Create file */
/* ----------- */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1647,22 +1663,21 @@ test_array_bkg(void)
/* Create data space */
/* ----------------- */
- space = H5Screate_simple(RANK, dim, NULL);
+ space = H5Screate_simple(RANK, dim, NULL);
CHECK(space, FAIL, "H5Screate_simple");
/* Create the memory data type */
/* --------------------------- */
- type = H5Tcreate(H5T_COMPOUND, sizeof(CmpField));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(CmpField));
CHECK(type, FAIL, "H5Tcreate");
-
/* Add members to the compound data type */
/* -------------------------------------- */
- for ( i = 0; i < dtsinfo->nsubfields; i++) {
+ for (i = 0; i < dtsinfo->nsubfields; i++) {
array_dt = H5Tarray_create2(dtsinfo->datatype[i], ndims[i], dima);
CHECK(array_dt, FAIL, "H5Tarray_create2");
- status = H5Tinsert (type, dtsinfo->name[i], dtsinfo->offset[i], array_dt);
+ status = H5Tinsert(type, dtsinfo->name[i], dtsinfo->offset[i], array_dt);
CHECK(status, FAIL, "H5Tinsert");
status = H5Tclose(array_dt);
@@ -1686,28 +1701,29 @@ test_array_bkg(void)
/* ------------------- */
for (i = 0; i < LENGTH; i++) {
for (j = 0; j < ALEN; j++) {
- if(cf[i].a[j]!=cfr[i].a[j]) {
- TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
+ if (cf[i].a[j] != cfr[i].a[j]) {
+ TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n", (int)i,
+ (int)j, (int)cf[i].a[j], (int)i, (int)j, (int)cfr[i].a[j]);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
- TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]);
+ if (!H5_FLT_ABS_EQUAL(cf[i].b[j], cfr[i].b[j])) {
+ TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].b[j], (int)i, (int)j, (double)cfr[i].b[j]);
continue;
} /* end if */
- if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
- TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]);
+ if (!H5_DBL_ABS_EQUAL(cf[i].c[j], cfr[i].c[j])) {
+ TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].c[j], (int)i, (int)j, (double)cfr[i].c[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
-
+ } /* end for */
+ } /* end for */
/* Release memory resources */
/* ------------------------ */
for (i = 0; i < dtsinfo->nsubfields; i++)
HDfree(dtsinfo->name[i]);
-
/* Release IDs */
/* ----------- */
status = H5Tclose(type);
@@ -1722,7 +1738,6 @@ test_array_bkg(void)
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
-
/******************************/
/* Reopen the file and update */
/******************************/
@@ -1739,33 +1754,34 @@ test_array_bkg(void)
array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dima);
CHECK(array_dt, FAIL, "H5Tarray_create2");
- status = H5Tinsert (type, "Two", HOFFSET(fld_t, b), array_dt);
+ status = H5Tinsert(type, "Two", HOFFSET(fld_t, b), array_dt);
CHECK(status, FAIL, "H5Tinsert");
/* Initialize the data to overwrite */
/* -------------------------------- */
- for (i=0; i< LENGTH; i++)
+ for (i = 0; i < LENGTH; i++)
for (j = 0; j < ALEN; j++)
cf[i].b[j] = fld[i].b[j] = 1.313F;
- status = H5Dwrite (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld);
+ status = H5Dwrite(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld);
CHECK(status, FAIL, "H5Dwrite");
/* Read just the field changed */
- status = H5Dread (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fldr);
+ status = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fldr);
CHECK(status, FAIL, "H5Dread");
- for (i=0; i< LENGTH; i++)
+ for (i = 0; i < LENGTH; i++)
for (j = 0; j < ALEN; j++)
- if(!H5_FLT_ABS_EQUAL(fld[i].b[j],fldr[i].b[j])) {
- TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(double)fld[i].b[j],(int)i,(int)j,(double)fldr[i].b[j]);
+ if (!H5_FLT_ABS_EQUAL(fld[i].b[j], fldr[i].b[j])) {
+ TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)fld[i].b[j], (int)i, (int)j, (double)fldr[i].b[j]);
continue;
} /* end if */
- status = H5Tclose (type);
+ status = H5Tclose(type);
CHECK(status, FAIL, "H5Tclose");
- status = H5Tclose (array_dt);
+ status = H5Tclose(array_dt);
CHECK(status, FAIL, "H5Tclose");
type = H5Dget_type(dataset);
@@ -1779,25 +1795,28 @@ test_array_bkg(void)
/* ------------------- */
for (i = 0; i < LENGTH; i++) {
for (j = 0; j < ALEN; j++) {
- if(cf[i].a[j]!=cfr[i].a[j]) {
- TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
+ if (cf[i].a[j] != cfr[i].a[j]) {
+ TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n", (int)i,
+ (int)j, (int)cf[i].a[j], (int)i, (int)j, (int)cfr[i].a[j]);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
- TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]);
+ if (!H5_FLT_ABS_EQUAL(cf[i].b[j], cfr[i].b[j])) {
+ TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].b[j], (int)i, (int)j, (double)cfr[i].b[j]);
continue;
} /* end if */
- if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
- TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]);
+ if (!H5_DBL_ABS_EQUAL(cf[i].c[j], cfr[i].c[j])) {
+ TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].c[j], (int)i, (int)j, (double)cfr[i].c[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
- status = H5Tclose (type);
+ status = H5Tclose(type);
CHECK(status, FAIL, "H5Tclose");
status = H5Fclose(fid);
@@ -1816,10 +1835,9 @@ test_array_bkg(void)
type = H5Dget_type(dataset);
CHECK(type, FAIL, "H5Dget_type");
-
/* Reset the data to read in */
/* ------------------------- */
- HDmemset(cfr, 0, sizeof(CmpField)*LENGTH);
+ HDmemset(cfr, 0, sizeof(CmpField) * LENGTH);
status = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfr);
CHECK(status, FAIL, "H5Dread");
@@ -1828,25 +1846,28 @@ test_array_bkg(void)
/* ------------------- */
for (i = 0; i < LENGTH; i++) {
for (j = 0; j < ALEN; j++) {
- if(cf[i].a[j]!=cfr[i].a[j]) {
- TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
+ if (cf[i].a[j] != cfr[i].a[j]) {
+ TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n", (int)i,
+ (int)j, (int)cf[i].a[j], (int)i, (int)j, (int)cfr[i].a[j]);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
- TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]);
+ if (!H5_FLT_ABS_EQUAL(cf[i].b[j], cfr[i].b[j])) {
+ TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].b[j], (int)i, (int)j, (double)cfr[i].b[j]);
continue;
} /* end if */
- if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
- TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]);
+ if (!H5_DBL_ABS_EQUAL(cf[i].c[j], cfr[i].c[j])) {
+ TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].c[j], (int)i, (int)j, (double)cfr[i].c[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
- status = H5Tclose (type);
+ status = H5Tclose(type);
CHECK(status, FAIL, "H5Tclose");
status = H5Fclose(fid);
@@ -1855,7 +1876,6 @@ test_array_bkg(void)
HDfree(dtsinfo);
} /* end test_array_bkg() */
-
/*-------------------------------------------------------------------------
* Function: test_compat
*
@@ -1873,20 +1893,20 @@ static void
test_compat(void)
{
const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Datatype ID */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Datatype ID */
hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- int i; /* Index variables */
- herr_t ret; /* Generic return value */
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ int nmemb; /* Number of compound members */
+ char * mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ int i; /* Index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Array Datatypes Compatibility Functionality\n"));
@@ -1906,78 +1926,78 @@ test_compat(void)
CHECK_I(fid1, "H5Fopen");
/* Only try to proceed if the file is around */
- if (fid1 >= 0){
+ if (fid1 >= 0) {
/* Open the first dataset (with no array fields) */
dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
CHECK_I(dataset, "H5Dopen2");
/* Get the datatype */
- tid1=H5Dget_type(dataset);
+ tid1 = H5Dget_type(dataset);
CHECK_I(tid1, "H5Dget_type");
/* Verify datatype class */
- mclass=H5Tget_class(tid1);
+ mclass = H5Tget_class(tid1);
VERIFY(mclass, H5T_COMPOUND, "H5Tget_class");
/* Get the number of compound datatype fields */
- nmemb=H5Tget_nmembers(tid1);
- VERIFY(nmemb,3,"H5Tget_nmembers");
+ nmemb = H5Tget_nmembers(tid1);
+ VERIFY(nmemb, 3, "H5Tget_nmembers");
/* Check the 1st field's name */
- mname=H5Tget_member_name(tid1,0);
+ mname = H5Tget_member_name(tid1, 0);
CHECK_PTR(mname, "H5Tget_member_name");
- if(HDstrcmp(mname,"i")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ if (HDstrcmp(mname, "i") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 1st field's offset */
- off=H5Tget_member_offset(tid1,0);
+ off = H5Tget_member_offset(tid1, 0);
VERIFY(off, 0, "H5Tget_member_offset");
/* Check the 1st field's datatype */
- mtid=H5Tget_member_type(tid1,0);
+ mtid = H5Tget_member_type(tid1, 0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_STD_I16LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
- mname=H5Tget_member_name(tid1,1);
+ mname = H5Tget_member_name(tid1, 1);
CHECK_PTR(mname, "H5Tget_member_name");
- if(HDstrcmp(mname,"f")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ if (HDstrcmp(mname, "f") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 2nd field's offset */
- off=H5Tget_member_offset(tid1,1);
+ off = H5Tget_member_offset(tid1, 1);
VERIFY(off, 4, "H5Tget_member_offset");
/* Check the 2nd field's datatype */
- mtid=H5Tget_member_type(tid1,1);
+ mtid = H5Tget_member_type(tid1, 1);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_IEEE_F32LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_IEEE_F32LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 3rd field's name */
- mname=H5Tget_member_name(tid1,2);
+ mname = H5Tget_member_name(tid1, 2);
CHECK_PTR(mname, "H5Tget_member_name");
- if(HDstrcmp(mname,"l")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ if (HDstrcmp(mname, "l") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 3rd field's offset */
- off=H5Tget_member_offset(tid1,2);
+ off = H5Tget_member_offset(tid1, 2);
VERIFY(off, 8, "H5Tget_member_offset");
/* Check the 3rd field's datatype */
- mtid=H5Tget_member_type(tid1,2);
+ mtid = H5Tget_member_type(tid1, 2);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_STD_I32LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_STD_I32LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Close the datatype */
@@ -1988,149 +2008,154 @@ test_compat(void)
ret = H5Dclose(dataset);
CHECK_I(ret, "H5Dclose");
-
/* Open the second dataset (with array fields) */
dataset = H5Dopen2(fid1, "Dataset2", H5P_DEFAULT);
CHECK_I(dataset, "H5Dopen2");
/* Get the datatype */
- tid1=H5Dget_type(dataset);
+ tid1 = H5Dget_type(dataset);
CHECK_I(tid1, "H5Dget_type");
/* Verify datatype class */
- mclass=H5Tget_class(tid1);
+ mclass = H5Tget_class(tid1);
VERIFY(mclass, H5T_COMPOUND, "H5Tget_class");
/* Get the number of compound datatype fields */
- nmemb=H5Tget_nmembers(tid1);
- VERIFY(nmemb,4,"H5Tget_nmembers");
+ nmemb = H5Tget_nmembers(tid1);
+ VERIFY(nmemb, 4, "H5Tget_nmembers");
/* Check the 1st field's name */
- mname=H5Tget_member_name(tid1,0);
+ mname = H5Tget_member_name(tid1, 0);
CHECK_PTR(mname, "H5Tget_member_name");
- if(mname && HDstrcmp(mname,"i")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- if(mname) H5free_memory(mname);
+ if (mname && HDstrcmp(mname, "i") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
+ if (mname)
+ H5free_memory(mname);
/* Check the 1st field's offset */
- off=H5Tget_member_offset(tid1,0);
+ off = H5Tget_member_offset(tid1, 0);
VERIFY(off, 0, "H5Tget_member_offset");
/* Check the 1st field's datatype */
- mtid=H5Tget_member_type(tid1,0);
+ mtid = H5Tget_member_type(tid1, 0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_STD_I16LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
- mname=H5Tget_member_name(tid1,1);
+ mname = H5Tget_member_name(tid1, 1);
CHECK_PTR(mname, "H5Tget_member_name");
- if(mname && HDstrcmp(mname,"f")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- if(mname) H5free_memory(mname);
+ if (mname && HDstrcmp(mname, "f") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
+ if (mname)
+ H5free_memory(mname);
/* Check the 2nd field's offset */
- off=H5Tget_member_offset(tid1,1);
+ off = H5Tget_member_offset(tid1, 1);
VERIFY(off, 4, "H5Tget_member_offset");
/* Check the 2nd field's datatype */
- mtid=H5Tget_member_type(tid1,1);
+ mtid = H5Tget_member_type(tid1, 1);
CHECK(mtid, FAIL, "H5Tget_member_type");
/* Verify datatype class */
- mclass=H5Tget_class(mtid);
+ mclass = H5Tget_class(mtid);
VERIFY(mclass, H5T_ARRAY, "H5Tget_class");
/* Check the array rank */
- ndims=H5Tget_array_ndims(mtid);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(mtid);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(mtid, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Check the array's base datatype */
- tid2=H5Tget_super(mtid);
+ tid2 = H5Tget_super(mtid);
CHECK(tid2, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid2,H5T_IEEE_F32LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(tid2);
+ if ((ret = H5Tequal(tid2, H5T_IEEE_F32LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(tid2);
CHECK(ret, FAIL, "H5Tclose");
- ret=H5Tclose(mtid);
+ ret = H5Tclose(mtid);
CHECK(ret, FAIL, "H5Tclose");
/* Check the 3rd field's name */
- mname=H5Tget_member_name(tid1,2);
+ mname = H5Tget_member_name(tid1, 2);
CHECK_PTR(mname, "H5Tget_member_name");
- if(mname && HDstrcmp(mname,"l")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- if(mname) H5free_memory(mname);
+ if (mname && HDstrcmp(mname, "l") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
+ if (mname)
+ H5free_memory(mname);
/* Check the 3rd field's offset */
- off=H5Tget_member_offset(tid1,2);
+ off = H5Tget_member_offset(tid1, 2);
VERIFY(off, 20, "H5Tget_member_offset");
/* Check the 3rd field's datatype */
- mtid=H5Tget_member_type(tid1,2);
+ mtid = H5Tget_member_type(tid1, 2);
CHECK(mtid, FAIL, "H5Tget_member_type");
/* Verify datatype class */
- mclass=H5Tget_class(mtid);
+ mclass = H5Tget_class(mtid);
VERIFY(mclass, H5T_ARRAY, "H5Tget_class");
/* Check the array rank */
- ndims=H5Tget_array_ndims(mtid);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(mtid);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(mtid, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Check the array's base datatype */
- tid2=H5Tget_super(mtid);
+ tid2 = H5Tget_super(mtid);
CHECK(tid2, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid2,H5T_STD_I32LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(tid2);
+ if ((ret = H5Tequal(tid2, H5T_STD_I32LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(tid2);
CHECK(ret, FAIL, "H5Tclose");
- ret=H5Tclose(mtid);
+ ret = H5Tclose(mtid);
CHECK(ret, FAIL, "H5Tclose");
/* Check the 4th field's name */
- mname=H5Tget_member_name(tid1,3);
+ mname = H5Tget_member_name(tid1, 3);
CHECK_PTR(mname, "H5Tget_member_name");
- if(mname && HDstrcmp(mname,"d")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- if(mname) H5free_memory(mname);
+ if (mname && HDstrcmp(mname, "d") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
+ if (mname)
+ H5free_memory(mname);
/* Check the 4th field's offset */
- off=H5Tget_member_offset(tid1,3);
+ off = H5Tget_member_offset(tid1, 3);
VERIFY(off, 36, "H5Tget_member_offset");
/* Check the 4th field's datatype */
- mtid=H5Tget_member_type(tid1,3);
+ mtid = H5Tget_member_type(tid1, 3);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_IEEE_F64LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_IEEE_F64LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Close the datatype */
@@ -2146,11 +2171,10 @@ test_compat(void)
CHECK_I(ret, "H5Fclose");
} /* end if */
else
- HDprintf("***cannot open the pre-created compound datatype test file (%s)\n",testfile);
+ HDprintf("***cannot open the pre-created compound datatype test file (%s)\n", testfile);
} /* end test_compat() */
-
/*-------------------------------------------------------------------------
* Function: test_array
*
@@ -2167,22 +2191,21 @@ test_array(void)
MESSAGE(5, ("Testing Array Datatypes\n"));
/* These tests use the same file... */
- test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */
- test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */
- test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */
- test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */
- test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */
- test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */
- test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
- test_array_funcs(); /* Test type functions with array types */
+ test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */
+ test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */
+ test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */
+ test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */
+ test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */
+ test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */
+ test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
+ test_array_funcs(); /* Test type functions with array types */
- test_array_bkg(); /* Read compound datatype with array fields and background fields read */
+ test_array_bkg(); /* Read compound datatype with array fields and background fields read */
/* This test uses a custom file */
- test_compat(); /* Test compatibility changes for compound datatype fields */
-
-} /* end test_array() */
+ test_compat(); /* Test compatibility changes for compound datatype fields */
+} /* end test_array() */
/*-------------------------------------------------------------------------
* Function: cleanup_array
@@ -2201,4 +2224,3 @@ cleanup_array(void)
{
remove(FILENAME);
} /* end cleanup_array() */
-
diff --git a/test/tattr.c b/test/tattr.c
index 496dd6c..7bc215d 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -12,12 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tattr
-*
-* Test the attribute functionality
-*
-*************************************************************/
+ *
+ * Test program: tattr
+ *
+ * Test the attribute functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
#include "H5VLnative_private.h"
@@ -26,44 +26,44 @@
* This file needs to access private information from the H5O package.
* This file also needs to access the object header testing code.
*/
-#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
-#include "H5Opkg.h" /* Object headers */
+#include "H5Opkg.h" /* Object headers */
/*
* This file needs to access private information from the H5A package.
* This file also needs to access the attribute testing code.
*/
-#define H5A_FRIEND /*suppress error about including H5Apkg */
+#define H5A_FRIEND /*suppress error about including H5Apkg */
#define H5A_TESTING
-#include "H5Apkg.h" /* Attributes */
+#include "H5Apkg.h" /* Attributes */
/*
* This file needs to access private information from the H5F package.
* This file also needs to access the file testing code.
*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
-#define FILENAME "tattr.h5"
-#define NAME_BUF_SIZE 1024
-#define ATTR_NAME_LEN 16
-#define ATTR_MAX_DIMS 7
-#define ATTR_TMP_NAME "a really long temp_name"
-#define CORDER_ITER_STOP 3
+#define FILENAME "tattr.h5"
+#define NAME_BUF_SIZE 1024
+#define ATTR_NAME_LEN 16
+#define ATTR_MAX_DIMS 7
+#define ATTR_TMP_NAME "a really long temp_name"
+#define CORDER_ITER_STOP 3
/* 3-D dataset with fixed dimensions */
-#define SPACE1_RANK 3
-#define SPACE1_DIM1 3
-#define SPACE1_DIM2 15
-#define SPACE1_DIM3 13
+#define SPACE1_RANK 3
+#define SPACE1_DIM1 3
+#define SPACE1_DIM2 15
+#define SPACE1_DIM3 13
/* Dataset Information */
#define DSET1_NAME "Dataset1"
#define DSET2_NAME "Dataset2"
#define DSET3_NAME "Dataset3"
-#define NUM_DSETS 3
+#define NUM_DSETS 3
/* Group Information */
#define GROUP1_NAME "/Group1"
@@ -74,81 +74,84 @@
#define TYPE1_NAME "/Type"
/* Attribute Rank & Dimensions */
-#define ATTR1_NAME "Attr1"
-#define ATTR1_RANK 1
-#define ATTR1_DIM1 3
-int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */
+#define ATTR1_NAME "Attr1"
+#define ATTR1_RANK 1
+#define ATTR1_DIM1 3
+int attr_data1[ATTR1_DIM1] = {512, -234, 98123}; /* Test data for 1st attribute */
/* rank & dimensions for another attribute */
-#define ATTR1A_NAME "Attr1_a"
-int attr_data1a[ATTR1_DIM1]={256,11945,-22107};
-
-#define ATTR2_NAME "Attr2"
-#define ATTR2_RANK 2
-#define ATTR2_DIM1 2
-#define ATTR2_DIM2 2
-int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data for 2nd attribute */
-
-#define ATTR3_NAME "Attr3"
-#define ATTR3_RANK 3
-#define ATTR3_DIM1 2
-#define ATTR3_DIM2 2
-#define ATTR3_DIM3 2
-double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3F,-26.1F}, {0.123F,-10.0F}},{{973.23F,-0.91827F},{2.0F,23.0F}}}; /* Test data for 3rd attribute */
-
-#define ATTR4_NAME "Attr4"
-#define ATTR4_RANK 2
-#define ATTR4_DIM1 2
-#define ATTR4_DIM2 2
-#define ATTR4_FIELDNAME1 "i"
-#define ATTR4_FIELDNAME2 "d"
-#define ATTR4_FIELDNAME3 "c"
-size_t attr4_field1_off=0;
-size_t attr4_field2_off=0;
-size_t attr4_field3_off=0;
+#define ATTR1A_NAME "Attr1_a"
+int attr_data1a[ATTR1_DIM1] = {256, 11945, -22107};
+
+#define ATTR2_NAME "Attr2"
+#define ATTR2_RANK 2
+#define ATTR2_DIM1 2
+#define ATTR2_DIM2 2
+int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, {197814, -3}}; /* Test data for 2nd attribute */
+
+#define ATTR3_NAME "Attr3"
+#define ATTR3_RANK 3
+#define ATTR3_DIM1 2
+#define ATTR3_DIM2 2
+#define ATTR3_DIM3 2
+double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {
+ {{2.3F, -26.1F}, {0.123F, -10.0F}},
+ {{973.23F, -0.91827F}, {2.0F, 23.0F}}}; /* Test data for 3rd attribute */
+
+#define ATTR4_NAME "Attr4"
+#define ATTR4_RANK 2
+#define ATTR4_DIM1 2
+#define ATTR4_DIM2 2
+#define ATTR4_FIELDNAME1 "i"
+#define ATTR4_FIELDNAME2 "d"
+#define ATTR4_FIELDNAME3 "c"
+size_t attr4_field1_off = 0;
+size_t attr4_field2_off = 0;
+size_t attr4_field3_off = 0;
struct attr4_struct {
- int i;
+ int i;
double d;
- char c;
- } attr_data4[ATTR4_DIM1][ATTR4_DIM2]={{{3,-26.1F,'d'},{-100000, 0.123F,'3'}},
- {{-23,981724.2F,'Q'},{0,2.0F,'\n'}}}; /* Test data for 4th attribute */
+ char c;
+} attr_data4[ATTR4_DIM1][ATTR4_DIM2] = {
+ {{3, -26.1F, 'd'}, {-100000, 0.123F, '3'}},
+ {{-23, 981724.2F, 'Q'}, {0, 2.0F, '\n'}}}; /* Test data for 4th attribute */
-#define ATTR5_NAME "Attr5"
-#define ATTR5_RANK 0
-float attr_data5=-5.123F; /* Test data for 5th attribute */
+#define ATTR5_NAME "Attr5"
+#define ATTR5_RANK 0
+float attr_data5 = -5.123F; /* Test data for 5th attribute */
-#define ATTR6_RANK 3
-#define ATTR6_DIM1 100
-#define ATTR6_DIM2 100
-#define ATTR6_DIM3 100
+#define ATTR6_RANK 3
+#define ATTR6_DIM1 100
+#define ATTR6_DIM2 100
+#define ATTR6_DIM3 100
-#define ATTR7_NAME "attr 1 - 000000"
-#define ATTR8_NAME "attr 2"
+#define ATTR7_NAME "attr 1 - 000000"
+#define ATTR8_NAME "attr 2"
-#define LINK1_NAME "Link1"
+#define LINK1_NAME "Link1"
-#define NATTR_MANY_OLD 350
-#define NATTR_MANY_NEW 35000
+#define NATTR_MANY_OLD 350
+#define NATTR_MANY_NEW 35000
#define BUG2_NATTR 100
#define BUG2_NATTR2 16
-#define BUG3_DSET_NAME "dset"
-#define BUG3_DT_NAME "dt"
-#define BUG3_ATTR_NAME "attr"
+#define BUG3_DSET_NAME "dset"
+#define BUG3_DT_NAME "dt"
+#define BUG3_ATTR_NAME "attr"
/* Used by test_attr_delete_last_dense() */
-#define GRPNAME "grp"
+#define GRPNAME "grp"
#define ATTRNAME "attr"
-#define DIM0 100
-#define DIM1 100
-#define RANK 2
+#define DIM0 100
+#define DIM1 100
+#define RANK 2
/* Used by test_attr_info_null_info_pointer() */
#define GET_INFO_NULL_POINTER_ATTR_NAME "NullInfoPointerAttr"
/* Used by test_attr_rename_invalid_name() */
-#define INVALID_RENAME_TEST_ATTR_NAME "InvalidRenameTestAttr"
+#define INVALID_RENAME_TEST_ATTR_NAME "InvalidRenameTestAttr"
#define INVALID_RENAME_TEST_NEW_ATTR_NAME "InvalidRenameTestNewAttr"
/* Used by test_attr_get_name_invalid_buf() */
@@ -156,17 +159,16 @@ float attr_data5=-5.123F; /* Test data for 5th attribute */
/* Attribute iteration struct */
typedef struct {
- H5_iter_order_t order; /* Direction of iteration */
- unsigned ncalled; /* # of times callback is entered */
- unsigned nskipped; /* # of attributes skipped */
- int stop; /* # of iterations to stop after */
- hsize_t curr; /* Current creation order value */
- size_t max_visit; /* Size of "visited attribute" flag array */
- hbool_t *visited; /* Pointer to array of "visited attribute" flags */
+ H5_iter_order_t order; /* Direction of iteration */
+ unsigned ncalled; /* # of times callback is entered */
+ unsigned nskipped; /* # of attributes skipped */
+ int stop; /* # of iterations to stop after */
+ hsize_t curr; /* Current creation order value */
+ size_t max_visit; /* Size of "visited attribute" flag array */
+ hbool_t * visited; /* Pointer to array of "visited attribute" flags */
} attr_iter_info_t;
-static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo,
- void *op_data);
+static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *op_data);
/* Global dcpl ID, can be re-set as a generated dcpl for various operations
* across multiple tests.
@@ -174,8 +176,6 @@ static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo,
*/
static hid_t dcpl_g = H5P_DEFAULT;
-
-
/****************************************************************
**
** test_attr_basic_write(): Test basic H5A (attribute) code.
@@ -185,21 +185,21 @@ static hid_t dcpl_g = H5P_DEFAULT;
static void
test_attr_basic_write(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr, attr2; /* Attribute ID */
- hsize_t attr_size; /* storage size for attribute */
- ssize_t attr_name_size; /* size of attribute name */
- char *attr_name=NULL; /* name of attribute */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
- int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */
- int i;
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hid_t attr, attr2; /* Attribute ID */
+ hsize_t attr_size; /* storage size for attribute */
+ ssize_t attr_name_size; /* size of attribute name */
+ char * attr_name = NULL; /* name of attribute */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2};
+ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
+ int i;
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Scalar Attribute Writing Functions\n"));
@@ -273,9 +273,10 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i,
+ attr_data1[i], i, read_data1[i]);
/* Close attribute */
ret = H5Aclose(attr);
@@ -297,11 +298,11 @@ test_attr_basic_write(hid_t fapl)
attr_name_size = H5Aget_name(attr, (size_t)0, NULL);
CHECK(attr_name_size, FAIL, "H5Aget_name");
- if(attr_name_size > 0) {
- attr_name = (char*)HDcalloc((size_t)(attr_name_size + 1), sizeof(char));
+ if (attr_name_size > 0) {
+ attr_name = (char *)HDcalloc((size_t)(attr_name_size + 1), sizeof(char));
CHECK_PTR(attr_name, "HDcalloc");
- if(attr_name) {
+ if (attr_name) {
ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name);
CHECK(ret, FAIL, "H5Aget_name");
ret = HDstrcmp(attr_name, ATTR_TMP_NAME);
@@ -310,16 +311,17 @@ test_attr_basic_write(hid_t fapl)
HDfree(attr_name);
attr_name = NULL;
} /* end if */
- } /* end if */
+ } /* end if */
/* Read attribute information immediately, without closing attribute */
ret = H5Aread(attr, H5T_NATIVE_INT, read_data1);
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i,
+ attr_data1[i], i, read_data1[i]);
/* Close attribute */
ret = H5Aclose(attr);
@@ -333,11 +335,11 @@ test_attr_basic_write(hid_t fapl)
attr_name_size = H5Aget_name(attr2, (size_t)0, NULL);
CHECK(attr_name_size, FAIL, "H5Aget_name");
- if(attr_name_size > 0) {
- attr_name = (char*)HDcalloc((size_t)(attr_name_size+1), sizeof(char));
+ if (attr_name_size > 0) {
+ attr_name = (char *)HDcalloc((size_t)(attr_name_size + 1), sizeof(char));
CHECK_PTR(attr_name, "HDcalloc");
- if(attr_name) {
+ if (attr_name) {
ret = (herr_t)H5Aget_name(attr2, (size_t)(attr_name_size + 1), attr_name);
CHECK(ret, FAIL, "H5Aget_name");
ret = HDstrcmp(attr_name, ATTR1A_NAME);
@@ -346,16 +348,17 @@ test_attr_basic_write(hid_t fapl)
HDfree(attr_name);
attr_name = NULL;
} /* end if */
- } /* end if */
+ } /* end if */
/* Read attribute information immediately, without closing attribute */
ret = H5Aread(attr2, H5T_NATIVE_INT, read_data1);
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(attr_data1a[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1a[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d, read_data1[%d]=%d\n", __LINE__,
+ i, attr_data1a[i], i, read_data1[i]);
/* Close attribute */
ret = H5Aclose(attr2);
@@ -413,8 +416,7 @@ test_attr_basic_write(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_basic_write() */
-
+} /* test_attr_basic_write() */
/****************************************************************
**
@@ -424,15 +426,15 @@ test_attr_basic_write(hid_t fapl)
static void
test_attr_basic_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
- hid_t attr; /* Attribute ID */
- H5O_info2_t oinfo; /* Object info */
- int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t attr; /* Attribute ID */
+ H5O_info2_t oinfo; /* Object info */
+ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
- int i, j; /* Local index variables */
- herr_t ret; /* Generic return value */
+ int i, j; /* Local index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -459,9 +461,10 @@ test_attr_basic_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i,
+ attr_data1[i], i, read_data1[i]);
/* Close attribute */
ret = H5Aclose(attr);
@@ -488,10 +491,11 @@ test_attr_basic_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR2_DIM1; i++)
- for(j = 0; j < ATTR2_DIM2; j++)
- if(attr_data2[i][j] != read_data2[i][j])
- TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", __LINE__, i, j, attr_data2[i][j], i, j, read_data1[i]);
+ for (i = 0; i < ATTR2_DIM1; i++)
+ for (j = 0; j < ATTR2_DIM2; j++)
+ if (attr_data2[i][j] != read_data2[i][j])
+ TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",
+ __LINE__, i, j, attr_data2[i][j], i, j, read_data1[i]);
/* Close attribute */
ret = H5Aclose(attr);
@@ -504,8 +508,7 @@ test_attr_basic_read(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_basic_read() */
-
+} /* test_attr_basic_read() */
/****************************************************************
**
@@ -516,13 +519,13 @@ test_attr_basic_read(hid_t fapl)
static void
test_attr_flush(hid_t fapl)
{
- hid_t fil, /* File ID */
- att, /* Attribute ID */
- spc, /* Dataspace ID */
- set; /* Dataset ID */
- double wdata=3.14159F; /* Data to write */
- double rdata; /* Data read in */
- herr_t ret; /* Generic return value */
+ hid_t fil, /* File ID */
+ att, /* Attribute ID */
+ spc, /* Dataspace ID */
+ set; /* Dataset ID */
+ double wdata = 3.14159F; /* Data to write */
+ double rdata; /* Data read in */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Attribute Flushing\n"));
@@ -539,40 +542,39 @@ test_attr_flush(hid_t fapl)
att = H5Acreate2(set, ATTR1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT);
CHECK(att, FAIL, "H5Acreate2");
- ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
+ ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!H5_DBL_ABS_EQUAL(rdata, (double)0.0f))
- TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
+ if (!H5_DBL_ABS_EQUAL(rdata, (double)0.0f))
+ TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, (double)0.0F);
- ret=H5Fflush(fil, H5F_SCOPE_GLOBAL);
+ ret = H5Fflush(fil, H5F_SCOPE_GLOBAL);
CHECK(ret, FAIL, "H5Fflush");
- ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
+ ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!H5_DBL_ABS_EQUAL(rdata, (double)0.0f))
- TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
+ if (!H5_DBL_ABS_EQUAL(rdata, (double)0.0f))
+ TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, (double)0.0F);
- ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata);
+ ret = H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata);
CHECK(ret, FAIL, "H5Awrite");
- ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
+ ret = H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!H5_DBL_ABS_EQUAL(rdata,wdata))
- TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,wdata);
+ if (!H5_DBL_ABS_EQUAL(rdata, wdata))
+ TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n", rdata, wdata);
- ret=H5Sclose(spc);
+ ret = H5Sclose(spc);
CHECK(ret, FAIL, "H5Sclose");
- ret=H5Aclose(att);
+ ret = H5Aclose(att);
CHECK(ret, FAIL, "H5Aclose");
- ret=H5Dclose(set);
+ ret = H5Dclose(set);
CHECK(ret, FAIL, "H5Dclose");
- ret=H5Fclose(fil);
+ ret = H5Fclose(fil);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_flush() */
-
+} /* test_attr_flush() */
/****************************************************************
**
@@ -582,17 +584,17 @@ test_attr_flush(hid_t fapl)
static void
test_attr_plist(hid_t fapl)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hid_t dsid = H5I_INVALID_HID; /* Dataspace ID (for dataset) */
- hid_t asid = H5I_INVALID_HID; /* Dataspace ID (for attribute) */
- hid_t aid = H5I_INVALID_HID; /* Attribute ID */
- hid_t acpl_id = H5I_INVALID_HID; /* Attribute creation property list ID */
- hid_t aapl_id = H5I_INVALID_HID; /* Attribute access property list ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- H5T_cset_t cset; /* Character set for attributes */
- herr_t ret; /* Generic return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t dsid = H5I_INVALID_HID; /* Dataspace ID (for dataset) */
+ hid_t asid = H5I_INVALID_HID; /* Dataspace ID (for attribute) */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t acpl_id = H5I_INVALID_HID; /* Attribute creation property list ID */
+ hid_t aapl_id = H5I_INVALID_HID; /* Attribute access property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ H5T_cset_t cset; /* Character set for attributes */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Attribute Property Lists\n"));
@@ -695,8 +697,7 @@ test_attr_plist(hid_t fapl)
CHECK(ret, FAIL, "H5Dclose");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_plist() */
-
+} /* test_attr_plist() */
/****************************************************************
**
@@ -707,15 +708,15 @@ test_attr_plist(hid_t fapl)
static void
test_attr_compound_write(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t tid1; /* Attribute datatype ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2};
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t tid1; /* Attribute datatype ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR4_DIM1, ATTR4_DIM2};
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Multiple Attribute Functions\n"));
@@ -740,13 +741,13 @@ test_attr_compound_write(hid_t fapl)
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(struct attr4_struct));
CHECK(tid1, FAIL, "H5Tcreate");
attr4_field1_off = HOFFSET(struct attr4_struct, i);
- ret = H5Tinsert(tid1, ATTR4_FIELDNAME1, attr4_field1_off, H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, ATTR4_FIELDNAME1, attr4_field1_off, H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
attr4_field2_off = HOFFSET(struct attr4_struct, d);
- ret = H5Tinsert(tid1, ATTR4_FIELDNAME2, attr4_field2_off, H5T_NATIVE_DOUBLE);
+ ret = H5Tinsert(tid1, ATTR4_FIELDNAME2, attr4_field2_off, H5T_NATIVE_DOUBLE);
CHECK(ret, FAIL, "H5Tinsert");
attr4_field3_off = HOFFSET(struct attr4_struct, c);
- ret = H5Tinsert(tid1, ATTR4_FIELDNAME3, attr4_field3_off, H5T_NATIVE_SCHAR);
+ ret = H5Tinsert(tid1, ATTR4_FIELDNAME3, attr4_field3_off, H5T_NATIVE_SCHAR);
CHECK(ret, FAIL, "H5Tinsert");
/* Create dataspace for 1st attribute */
@@ -784,8 +785,7 @@ test_attr_compound_write(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_compound_write() */
-
+} /* test_attr_compound_write() */
/****************************************************************
**
@@ -795,26 +795,26 @@ test_attr_compound_write(hid_t fapl)
static void
test_attr_compound_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t space; /* Attribute dataspace */
- hid_t type; /* Attribute datatype */
- hid_t attr; /* Attribute ID */
- char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
- int rank; /* Attribute rank */
- hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */
- H5T_class_t t_class; /* Attribute datatype class */
- H5T_order_t order; /* Attribute datatype order */
- size_t size; /* Attribute datatype size as stored in file */
- int fields; /* # of Attribute datatype fields */
- char *fieldname; /* Name of a field */
- size_t offset; /* Attribute datatype field offset */
- hid_t field; /* Attribute field datatype */
+ hid_t fid1; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t space; /* Attribute dataspace */
+ hid_t type; /* Attribute datatype */
+ hid_t attr; /* Attribute ID */
+ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
+ int rank; /* Attribute rank */
+ hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */
+ H5T_class_t t_class; /* Attribute datatype class */
+ H5T_order_t order; /* Attribute datatype order */
+ size_t size; /* Attribute datatype size as stored in file */
+ int fields; /* # of Attribute datatype fields */
+ char * fieldname; /* Name of a field */
+ size_t offset; /* Attribute datatype field offset */
+ hid_t field; /* Attribute field datatype */
struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; /* Buffer for reading 4th attribute */
- ssize_t name_len; /* Length of attribute name */
- H5O_info2_t oinfo; /* Object info */
- int i, j; /* Local index variables */
- herr_t ret; /* Generic return value */
+ ssize_t name_len; /* Length of attribute name */
+ H5O_info2_t oinfo; /* Object info */
+ int i, j; /* Local index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -833,7 +833,8 @@ test_attr_compound_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 1, "H5Oget_info3");
/* Open 1st attribute for the dataset */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Dataspace */
@@ -843,9 +844,9 @@ test_attr_compound_read(hid_t fapl)
VERIFY(rank, ATTR4_RANK, "H5Sget_simple_extent_ndims");
ret = H5Sget_simple_extent_dims(space, dims, NULL);
CHECK(ret, FAIL, "H5Sget_simple_extent_dims");
- if(dims[0] != ATTR4_DIM1)
+ if (dims[0] != ATTR4_DIM1)
TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n", (int)dims[0], ATTR4_DIM1);
- if(dims[1] != ATTR4_DIM2)
+ if (dims[1] != ATTR4_DIM2)
TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n", (int)dims[1], ATTR4_DIM2);
H5Sclose(space);
@@ -856,11 +857,10 @@ test_attr_compound_read(hid_t fapl)
VERIFY(t_class, H5T_COMPOUND, "H5Tget_class");
fields = H5Tget_nmembers(type);
VERIFY(fields, 3, "H5Tget_nmembers");
- for(i = 0; i < fields; i++) {
+ for (i = 0; i < fields; i++) {
fieldname = H5Tget_member_name(type, (unsigned)i);
- if(!(HDstrcmp(fieldname, ATTR4_FIELDNAME1) ||
- HDstrcmp(fieldname, ATTR4_FIELDNAME2) ||
- HDstrcmp(fieldname, ATTR4_FIELDNAME3)))
+ if (!(HDstrcmp(fieldname, ATTR4_FIELDNAME1) || HDstrcmp(fieldname, ATTR4_FIELDNAME2) ||
+ HDstrcmp(fieldname, ATTR4_FIELDNAME3)))
TestErrPrintf("invalid field name for field #%d: %s\n", i, fieldname);
H5free_memory(fieldname);
} /* end for */
@@ -905,18 +905,22 @@ test_attr_compound_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR4_DIM1; i++)
- for(j = 0; j < ATTR4_DIM2; j++)
- if(HDmemcmp(&attr_data4[i][j], &read_data4[i][j], sizeof(struct attr4_struct))) {
- HDprintf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i);
- HDprintf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d);
- TestErrPrintf("%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n", __LINE__, i, j, attr_data4[i][j].c, i, j, read_data4[i][j].c);
+ for (i = 0; i < ATTR4_DIM1; i++)
+ for (j = 0; j < ATTR4_DIM2; j++)
+ if (HDmemcmp(&attr_data4[i][j], &read_data4[i][j], sizeof(struct attr4_struct))) {
+ HDprintf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",
+ __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i);
+ HDprintf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",
+ __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d);
+ TestErrPrintf(
+ "%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",
+ __LINE__, i, j, attr_data4[i][j].c, i, j, read_data4[i][j].c);
} /* end if */
/* Verify Name */
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR4_NAME), "H5Aget_name");
- if(HDstrcmp(attr_name, ATTR4_NAME))
+ if (HDstrcmp(attr_name, ATTR4_NAME))
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR4_NAME);
/* Close attribute datatype */
@@ -934,8 +938,7 @@ test_attr_compound_read(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_compound_read() */
-
+} /* test_attr_compound_read() */
/****************************************************************
**
@@ -945,13 +948,13 @@ test_attr_compound_read(hid_t fapl)
static void
test_attr_scalar_write(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -1000,8 +1003,7 @@ test_attr_scalar_write(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_scalar_write() */
-
+} /* test_attr_scalar_write() */
/****************************************************************
**
@@ -1011,14 +1013,14 @@ test_attr_scalar_write(hid_t fapl)
static void
test_attr_scalar_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- H5S_class_t stype; /* Dataspace class */
- float rdata = 0.0F; /* Buffer for reading 1st attribute */
- H5O_info2_t oinfo; /* Object info */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ H5S_class_t stype; /* Dataspace class */
+ float rdata = 0.0F; /* Buffer for reading 1st attribute */
+ H5O_info2_t oinfo; /* Object info */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Scalar Attribute Reading Functions\n"));
@@ -1045,9 +1047,9 @@ test_attr_scalar_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(rdata, attr_data5))
- HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
- "H5Aread", (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__);
+ if (!H5_FLT_ABS_EQUAL(rdata, attr_data5))
+ HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Aread",
+ (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__);
/* Get the attribute's dataspace */
sid = H5Aget_space(attr);
@@ -1071,8 +1073,7 @@ test_attr_scalar_read(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_scalar_read() */
-
+} /* test_attr_scalar_read() */
/****************************************************************
**
@@ -1083,16 +1084,16 @@ test_attr_scalar_read(hid_t fapl)
static void
test_attr_mult_write(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
- hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3};
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2};
+ hsize_t dims4[] = {ATTR3_DIM1, ATTR3_DIM2, ATTR3_DIM3};
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Multiple Attribute Functions\n"));
@@ -1192,8 +1193,7 @@ test_attr_mult_write(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_mult_write() */
-
+} /* test_attr_mult_write() */
/****************************************************************
**
@@ -1203,25 +1203,25 @@ test_attr_mult_write(hid_t fapl)
static void
test_attr_mult_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t space; /* Attribute dataspace */
- hid_t type; /* Attribute datatype */
- hid_t attr; /* Attribute ID */
- char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
- char temp_name[ATTR_NAME_LEN]; /* Buffer for mangling attribute names */
- int rank; /* Attribute rank */
- hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */
- H5T_class_t t_class; /* Attribute datatype class */
- H5T_order_t order; /* Attribute datatype order */
- size_t size; /* Attribute datatype size as stored in file */
- int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
- int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
+ hid_t fid1; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t space; /* Attribute dataspace */
+ hid_t type; /* Attribute datatype */
+ hid_t attr; /* Attribute ID */
+ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
+ char temp_name[ATTR_NAME_LEN]; /* Buffer for mangling attribute names */
+ int rank; /* Attribute rank */
+ hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */
+ H5T_class_t t_class; /* Attribute datatype class */
+ H5T_order_t order; /* Attribute datatype order */
+ size_t size; /* Attribute datatype size as stored in file */
+ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
+ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */
- ssize_t name_len; /* Length of attribute name */
- H5O_info2_t oinfo; /* Object info */
- int i, j, k; /* Local index values */
- herr_t ret; /* Generic return value */
+ ssize_t name_len; /* Length of attribute name */
+ H5O_info2_t oinfo; /* Object info */
+ int i, j, k; /* Local index values */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -1240,7 +1240,8 @@ test_attr_mult_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 3, "H5Oget_info3");
/* Open 1st attribute for the dataset */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Dataspace */
@@ -1250,7 +1251,7 @@ test_attr_mult_read(hid_t fapl)
VERIFY(rank, ATTR1_RANK, "H5Sget_simple_extent_ndims");
ret = H5Sget_simple_extent_dims(space, dims, NULL);
CHECK(ret, FAIL, "H5Sget_simple_extent_dims");
- if(dims[0] != ATTR1_DIM1)
+ if (dims[0] != ATTR1_DIM1)
TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n", (int)dims[0], ATTR1_DIM1);
H5Sclose(space);
@@ -1270,22 +1271,23 @@ test_attr_mult_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i,
+ attr_data1[i], i, read_data1[i]);
/* Verify Name */
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name");
- if(HDstrcmp(attr_name, ATTR1_NAME))
+ if (HDstrcmp(attr_name, ATTR1_NAME))
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR1_NAME);
/* Verify Name with too small of a buffer */
- name_len = H5Aget_name(attr,HDstrlen(ATTR1_NAME), attr_name);
+ name_len = H5Aget_name(attr, HDstrlen(ATTR1_NAME), attr_name);
VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name");
- HDstrcpy(temp_name, ATTR1_NAME); /* make a copy of the name */
- temp_name[HDstrlen(ATTR1_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */
- if(HDstrcmp(attr_name, temp_name))
+ HDstrcpy(temp_name, ATTR1_NAME); /* make a copy of the name */
+ temp_name[HDstrlen(ATTR1_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */
+ if (HDstrcmp(attr_name, temp_name))
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name);
/* Close attribute */
@@ -1293,7 +1295,8 @@ test_attr_mult_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Open 2nd attribute for the dataset */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)1, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)1, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Dataspace */
@@ -1303,9 +1306,9 @@ test_attr_mult_read(hid_t fapl)
VERIFY(rank, ATTR2_RANK, "H5Sget_simple_extent_ndims");
ret = H5Sget_simple_extent_dims(space, dims, NULL);
CHECK(ret, FAIL, "H5Sget_simple_extent_dims");
- if(dims[0] != ATTR2_DIM1)
+ if (dims[0] != ATTR2_DIM1)
TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n", (int)dims[0], ATTR2_DIM1);
- if(dims[1] != ATTR2_DIM2)
+ if (dims[1] != ATTR2_DIM2)
TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n", (int)dims[1], ATTR2_DIM2);
H5Sclose(space);
@@ -1325,23 +1328,24 @@ test_attr_mult_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR2_DIM1; i++)
- for(j = 0; j < ATTR2_DIM2; j++)
- if(attr_data2[i][j] != read_data2[i][j])
- TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n", __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
+ for (i = 0; i < ATTR2_DIM1; i++)
+ for (j = 0; j < ATTR2_DIM2; j++)
+ if (attr_data2[i][j] != read_data2[i][j])
+ TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",
+ __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
/* Verify Name */
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name");
- if(HDstrcmp(attr_name, ATTR2_NAME))
+ if (HDstrcmp(attr_name, ATTR2_NAME))
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR2_NAME);
/* Verify Name with too small of a buffer */
name_len = H5Aget_name(attr, HDstrlen(ATTR2_NAME), attr_name);
VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name");
- HDstrcpy(temp_name, ATTR2_NAME); /* make a copy of the name */
- temp_name[HDstrlen(ATTR2_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */
- if(HDstrcmp(attr_name, temp_name))
+ HDstrcpy(temp_name, ATTR2_NAME); /* make a copy of the name */
+ temp_name[HDstrlen(ATTR2_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */
+ if (HDstrcmp(attr_name, temp_name))
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name);
/* Close attribute */
@@ -1349,7 +1353,8 @@ test_attr_mult_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Open 2nd attribute for the dataset */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Dataspace */
@@ -1359,11 +1364,11 @@ test_attr_mult_read(hid_t fapl)
VERIFY(rank, ATTR3_RANK, "H5Sget_simple_extent_ndims");
ret = H5Sget_simple_extent_dims(space, dims, NULL);
CHECK(ret, FAIL, "H5Sget_simple_extent_dims");
- if(dims[0] != ATTR3_DIM1)
+ if (dims[0] != ATTR3_DIM1)
TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n", (int)dims[0], ATTR3_DIM1);
- if(dims[1] != ATTR3_DIM2)
+ if (dims[1] != ATTR3_DIM2)
TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n", (int)dims[1], ATTR3_DIM2);
- if(dims[2] != ATTR3_DIM3)
+ if (dims[2] != ATTR3_DIM3)
TestErrPrintf("attribute dimensions different: dims[2]=%d, should be %d\n", (int)dims[2], ATTR3_DIM3);
H5Sclose(space);
@@ -1383,24 +1388,26 @@ test_attr_mult_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR3_DIM1; i++)
- for(j = 0; j < ATTR3_DIM2; j++)
- for(k = 0; k < ATTR3_DIM3; k++)
- if(!H5_DBL_ABS_EQUAL(attr_data3[i][j][k], read_data3[i][j][k]))
- TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n", __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]);
+ for (i = 0; i < ATTR3_DIM1; i++)
+ for (j = 0; j < ATTR3_DIM2; j++)
+ for (k = 0; k < ATTR3_DIM3; k++)
+ if (!H5_DBL_ABS_EQUAL(attr_data3[i][j][k], read_data3[i][j][k]))
+ TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, "
+ "read_data3[%d][%d][%d]=%f\n",
+ __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]);
/* Verify Name */
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name");
- if(HDstrcmp(attr_name, ATTR3_NAME))
+ if (HDstrcmp(attr_name, ATTR3_NAME))
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME);
/* Verify Name with too small of a buffer */
name_len = H5Aget_name(attr, HDstrlen(ATTR3_NAME), attr_name);
VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name");
- HDstrcpy(temp_name, ATTR3_NAME); /* make a copy of the name */
- temp_name[HDstrlen(ATTR3_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */
- if(HDstrcmp(attr_name, temp_name))
+ HDstrcpy(temp_name, ATTR3_NAME); /* make a copy of the name */
+ temp_name[HDstrlen(ATTR3_NAME) - 1] = '\0'; /* truncate it to match the one retrieved */
+ if (HDstrcmp(attr_name, temp_name))
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, temp_name);
/* Close attribute */
@@ -1414,8 +1421,7 @@ test_attr_mult_read(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_mult_read() */
-
+} /* test_attr_mult_read() */
/****************************************************************
**
@@ -1423,40 +1429,38 @@ test_attr_mult_read(hid_t fapl)
**
****************************************************************/
static herr_t
-attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR_UNUSED *ainfo,
- void *op_data)
+attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *op_data)
{
- int *count = (int *)op_data;
- herr_t ret = 0;
+ int * count = (int *)op_data;
+ herr_t ret = 0;
- switch(*count) {
+ switch (*count) {
case 0:
- if(HDstrcmp(name, ATTR1_NAME))
+ if (HDstrcmp(name, ATTR1_NAME))
TestErrPrintf("attribute name different: name=%s, should be %s\n", name, ATTR1_NAME);
- (*count)++;
- break;
+ (*count)++;
+ break;
case 1:
- if(HDstrcmp(name, ATTR2_NAME))
+ if (HDstrcmp(name, ATTR2_NAME))
TestErrPrintf("attribute name different: name=%s, should be %s\n", name, ATTR2_NAME);
- (*count)++;
- break;
+ (*count)++;
+ break;
case 2:
- if(HDstrcmp(name, ATTR3_NAME))
+ if (HDstrcmp(name, ATTR3_NAME))
TestErrPrintf("attribute name different: name=%s, should be %s\n", name, ATTR3_NAME);
- (*count)++;
- break;
+ (*count)++;
+ break;
default:
ret = -1;
break;
- } /* end switch() */
+ } /* end switch() */
- return(ret);
+ return (ret);
} /* end attr_op1() */
-
/****************************************************************
**
** test_attr_iterate(): Test H5A (attribute) iterator code.
@@ -1465,12 +1469,12 @@ attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR
static void
test_attr_iterate(hid_t fapl)
{
- hid_t file; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- int count; /* operator data for the iterator */
- H5O_info2_t oinfo; /* Object info */
- herr_t ret; /* Generic return value */
+ hid_t file; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ int count; /* operator data for the iterator */
+ H5O_info2_t oinfo; /* Object info */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -1498,7 +1502,7 @@ test_attr_iterate(hid_t fapl)
/* Iterate over attributes on dataset */
count = 0;
- ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count);
+ ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count);
VERIFY(ret, 0, "H5Aiterate2");
/* Close dataset */
@@ -1516,7 +1520,7 @@ test_attr_iterate(hid_t fapl)
/* Iterate over attributes on dataset */
count = 0;
- ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count);
+ ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_op1, &count);
VERIFY(ret, 0, "H5Aiterate2");
/* Close dataset */
@@ -1526,8 +1530,7 @@ test_attr_iterate(hid_t fapl)
/* Close file */
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_iterate() */
-
+} /* test_attr_iterate() */
/****************************************************************
**
@@ -1537,13 +1540,13 @@ test_attr_iterate(hid_t fapl)
static void
test_attr_delete(hid_t fapl)
{
- hid_t fid1; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t attr; /* Attribute ID */
- char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
- ssize_t name_len; /* Length of attribute name */
- H5O_info2_t oinfo; /* Object info */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t attr; /* Attribute ID */
+ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
+ ssize_t name_len; /* Length of attribute name */
+ H5O_info2_t oinfo; /* Object info */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -1580,28 +1583,30 @@ test_attr_delete(hid_t fapl)
VERIFY(oinfo.num_attrs, 2, "H5Oget_info3");
/* Open 1st attribute for the dataset */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Name */
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name");
- if(HDstrcmp(attr_name, ATTR1_NAME))
- TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME);
+ if (HDstrcmp(attr_name, ATTR1_NAME))
+ TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR1_NAME);
/* Close attribute */
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Open last (formally 3rd) attribute for the dataset */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)1, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)1, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Name */
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name");
- if(HDstrcmp(attr_name, ATTR3_NAME))
- TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME);
+ if (HDstrcmp(attr_name, ATTR3_NAME))
+ TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME);
/* Close attribute */
ret = H5Aclose(attr);
@@ -1617,14 +1622,15 @@ test_attr_delete(hid_t fapl)
VERIFY(oinfo.num_attrs, 1, "H5Oget_info3");
/* Open last (formally 3rd) attribute for the dataset */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Name */
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name");
- if(HDstrcmp(attr_name, ATTR3_NAME))
- TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME);
+ if (HDstrcmp(attr_name, ATTR3_NAME))
+ TestErrPrintf("attribute name different: attr_name=%s, should be %s\n", attr_name, ATTR3_NAME);
/* Close attribute */
ret = H5Aclose(attr);
@@ -1646,8 +1652,7 @@ test_attr_delete(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_delete() */
-
+} /* test_attr_delete() */
/****************************************************************
**
@@ -1658,17 +1663,17 @@ test_attr_delete(hid_t fapl)
static void
test_attr_dtype_shared(hid_t fapl)
{
- hid_t file_id; /* File ID */
- hid_t dset_id; /* Dataset ID */
- hid_t space_id; /* Dataspace ID for dataset & attribute */
- hid_t type_id; /* Datatype ID for named datatype */
- hid_t attr_id; /* Attribute ID */
- int data = 8; /* Data to write */
- int rdata = 0; /* Read read in */
- H5O_info2_t oinfo; /* Object's information */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t file_id; /* File ID */
+ hid_t dset_id; /* Dataset ID */
+ hid_t space_id; /* Dataspace ID for dataset & attribute */
+ hid_t type_id; /* Datatype ID for named datatype */
+ hid_t attr_id; /* Attribute ID */
+ int data = 8; /* Data to write */
+ int rdata = 0; /* Read read in */
+ H5O_info2_t oinfo; /* Object's information */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Shared Datatypes with Attributes\n"));
@@ -1683,7 +1688,7 @@ test_attr_dtype_shared(hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
@@ -1771,7 +1776,6 @@ test_attr_dtype_shared(hid_t fapl)
ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(file_id, FAIL, "H5Fopen");
@@ -1822,8 +1826,7 @@ test_attr_dtype_shared(hid_t fapl)
/* Check size of file */
filesize = h5_get_file_size(FILENAME, fapl);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dtype_shared() */
-
+} /* test_attr_dtype_shared() */
/****************************************************************
**
@@ -1834,17 +1837,17 @@ test_attr_dtype_shared(hid_t fapl)
static void
test_attr_duplicate_ids(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t gid1, gid2; /* Group ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr, attr2; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */
- int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */
- int i;
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t gid1, gid2; /* Group ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hid_t attr, attr2; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
+ int rewrite_data[ATTR1_DIM1] = {1234, -423, 9907256}; /* Test data for rewrite */
+ int i;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing operations with two ID handles\n"));
@@ -1861,8 +1864,7 @@ test_attr_duplicate_ids(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT,
- dcpl_g, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -1915,8 +1917,8 @@ test_attr_duplicate_ids(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(0 != read_data1[i])
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (0 != read_data1[i])
TestErrPrintf("%d: attribute data different: read_data1[%d]=%d\n", __LINE__, i, read_data1[i]);
/* Open attribute for the second time */
@@ -1964,9 +1966,10 @@ test_attr_duplicate_ids(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i,
+ attr_data1[i], i, read_data1[i]);
/* Open attribute for the second time */
attr2 = H5Aopen(dataset, ATTR1_NAME, H5P_DEFAULT);
@@ -1981,9 +1984,10 @@ test_attr_duplicate_ids(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(read_data1[i] != rewrite_data[i])
- TestErrPrintf("%d: attribute data different: read_data1[%d]=%d, rewrite_data[%d]=%d\n", __LINE__, i, read_data1[i], i, rewrite_data[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (read_data1[i] != rewrite_data[i])
+ TestErrPrintf("%d: attribute data different: read_data1[%d]=%d, rewrite_data[%d]=%d\n", __LINE__,
+ i, read_data1[i], i, rewrite_data[i]);
/* Close attribute */
ret = H5Aclose(attr);
@@ -2013,8 +2017,7 @@ test_attr_duplicate_ids(hid_t fapl)
CHECK(gid1, FAIL, "H5Gcreate2");
/* Create hard link to the first group */
- ret = H5Lcreate_hard(gid1, GROUP1_NAME, H5L_SAME_LOC, GROUP2_NAME, H5P_DEFAULT,
- H5P_DEFAULT);
+ ret = H5Lcreate_hard(gid1, GROUP1_NAME, H5L_SAME_LOC, GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lcreate_hard");
/* Try to create an attribute on the group */
@@ -2038,9 +2041,10 @@ test_attr_duplicate_ids(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i,
+ attr_data1[i], i, read_data1[i]);
/* Close attribute */
ret = H5Aclose(attr);
@@ -2067,8 +2071,7 @@ test_attr_duplicate_ids(hid_t fapl)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_duplicate_ids() */
-
+} /* test_attr_duplicate_ids() */
/****************************************************************
**
@@ -2079,18 +2082,18 @@ test_attr_duplicate_ids(hid_t fapl)
static int
test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
{
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- hid_t attr; /* Attribute ID */
- unsigned value; /* Attribute value */
- unsigned u; /* Local index variable */
- int old_nerrs; /* Number of errors when entering this check */
- herr_t ret; /* Generic return value */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t attr; /* Attribute ID */
+ unsigned value; /* Attribute value */
+ unsigned u; /* Local index variable */
+ int old_nerrs; /* Number of errors when entering this check */
+ herr_t ret; /* Generic return value */
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
/* Re-open all the attributes by name and verify the data */
- for(u = 0; u < max_attr; u++) {
+ for (u = 0; u < max_attr; u++) {
/* Open attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Aopen(loc_id, attrname, H5P_DEFAULT);
@@ -2107,20 +2110,22 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
} /* end for */
/* Re-open all the attributes by index and verify the data */
- for(u = 0; u < max_attr; u++) {
- ssize_t name_len; /* Length of attribute name */
- char check_name[ATTR_NAME_LEN]; /* Buffer for checking attribute names */
+ for (u = 0; u < max_attr; u++) {
+ ssize_t name_len; /* Length of attribute name */
+ char check_name[ATTR_NAME_LEN]; /* Buffer for checking attribute names */
/* Open attribute */
- attr = H5Aopen_by_idx(loc_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen_by_idx(loc_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Name */
HDsprintf(attrname, "attr %02u", u);
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, check_name);
VERIFY(name_len, HDstrlen(attrname), "H5Aget_name");
- if(HDstrcmp(check_name, attrname))
- TestErrPrintf("attribute name different: attrname = '%s', should be '%s'\n", check_name, attrname);
+ if (HDstrcmp(check_name, attrname))
+ TestErrPrintf("attribute name different: attrname = '%s', should be '%s'\n", check_name,
+ attrname);
/* Read data from the attribute */
ret = H5Aread(attr, H5T_NATIVE_UINT, &value);
@@ -2133,12 +2138,11 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
} /* end for */
/* Retrieve current # of errors */
- if(old_nerrs == GetTestNumErrs())
- return(0);
+ if (old_nerrs == GetTestNumErrs())
+ return (0);
else
- return(-1);
-} /* test_attr_dense_verify() */
-
+ return (-1);
+} /* test_attr_dense_verify() */
/****************************************************************
**
@@ -2149,19 +2153,19 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
static void
test_attr_dense_create(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dense Attribute Storage Creation\n"));
@@ -2176,7 +2180,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
@@ -2191,7 +2195,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -2213,7 +2218,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes, until just before converting to dense storage */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -2273,8 +2278,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
/* Check size of file */
filesize = h5_get_file_size(FILENAME, fapl);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_create() */
-
+} /* test_attr_dense_create() */
/****************************************************************
**
@@ -2285,19 +2289,19 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_open(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Opening Attributes in Dense Storage\n"));
@@ -2312,7 +2316,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
@@ -2327,7 +2331,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -2353,7 +2358,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes, until just before converting to dense storage */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -2417,8 +2422,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
/* Check size of file */
filesize = h5_get_file_size(FILENAME, fapl);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_open() */
-
+} /* test_attr_dense_open() */
/****************************************************************
**
@@ -2429,21 +2433,21 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_delete(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- H5O_info2_t oinfo; /* Object info */
- int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ H5O_info2_t oinfo; /* Object info */
+ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deleting Attributes in Dense Storage\n"));
@@ -2468,7 +2472,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
@@ -2483,7 +2487,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
if (use_min_dset_oh) {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
- } else {
+ }
+ else {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
}
@@ -2509,7 +2514,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes, until well into dense storage */
- for(u = 0; u < (max_compact * 2); u++) {
+ for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -2545,7 +2550,6 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -2555,7 +2559,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Delete attributes until the attributes revert to compact storage again */
- for(u--; u >= min_dense; u--) {
+ for (u--; u >= min_dense; u--) {
/* Delete attribute */
HDsprintf(attrname, "attr %02u", u);
ret = H5Adelete(dataset, attrname);
@@ -2611,8 +2615,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
/* Check size of file */
filesize = h5_get_file_size(FILENAME, fapl);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_delete() */
-
+} /* test_attr_dense_delete() */
/****************************************************************
**
@@ -2623,23 +2626,23 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_rename(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- H5O_info2_t oinfo; /* Object info */
- unsigned u; /* Local index variable */
- int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
- unsigned use_corder; /* Track creation order or not */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ H5O_info2_t oinfo; /* Object info */
+ unsigned u; /* Local index variable */
+ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
+ unsigned use_corder; /* Track creation order or not */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Renaming Attributes in Dense Storage\n"));
@@ -2664,7 +2667,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
@@ -2679,7 +2682,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
if (use_min_dset_oh) {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, H5I_INVALID_HID, "H5Pcopy");
- } else {
+ }
+ else {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate");
}
@@ -2689,9 +2693,9 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Using creation order or not */
- for(use_corder = FALSE; use_corder <= TRUE; use_corder++) {
+ for (use_corder = FALSE; use_corder <= TRUE; use_corder++) {
- if(use_corder) {
+ if (use_corder) {
ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
CHECK(ret, FAIL, "H5Pset_attr_creation_order");
}
@@ -2705,7 +2709,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes, until well into dense storage */
- for(u = 0; u < (max_compact * 2); u++) {
+ for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -2740,13 +2744,13 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
- if(!use_corder) {
+ if (!use_corder) {
/* Unlink dataset with attributes */
ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
}
- } /* end for use_corder */
+ } /* end for use_corder */
/* Close dataspace */
ret = H5Sclose(sid);
@@ -2760,7 +2764,6 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, H5I_INVALID_HID, "H5Fopen");
@@ -2770,8 +2773,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
/* Verify renamed attributes */
- for(u = 0; u < (max_compact * 2); u++) {
- unsigned value; /* Attribute value */
+ for (u = 0; u < (max_compact * 2); u++) {
+ unsigned value; /* Attribute value */
/* Open attribute */
HDsprintf(attrname, "new attr %02u", u);
@@ -2803,8 +2806,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Check size of file */
filesize = h5_get_file_size(FILENAME, fapl);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_rename() */
-
+} /* test_attr_dense_rename() */
/****************************************************************
**
@@ -2815,22 +2817,22 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- size_t mesg_count; /* # of shared messages */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- H5O_info2_t oinfo; /* Object info */
- unsigned u; /* Local index variable */
- int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ size_t mesg_count; /* # of shared messages */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ H5O_info2_t oinfo; /* Object info */
+ unsigned u; /* Local index variable */
+ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Unlinking Object with Attributes in Dense Storage\n"));
@@ -2853,7 +2855,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
@@ -2868,7 +2870,8 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
if (use_min_dset_oh) {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
- } else {
+ }
+ else {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
}
@@ -2890,7 +2893,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes, until well into dense storage */
- for(u = 0; u < (max_compact * 2); u++) {
+ for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -2926,7 +2929,6 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -2947,8 +2949,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
/* Check size of file */
filesize = h5_get_file_size(FILENAME, fapl);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_unlink() */
-
+} /* test_attr_dense_unlink() */
/****************************************************************
**
@@ -2959,19 +2960,19 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_limits(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned max_compact, rmax_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense, rmin_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned max_compact, rmax_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense, rmin_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Phase Change Limits For Attributes in Dense Storage\n"));
@@ -2986,7 +2987,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
@@ -3001,15 +3002,16 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
/* Change limits on compact/dense attribute storage */
max_compact = 0;
- min_dense = 0;
- ret = H5Pset_attr_phase_change(dcpl, max_compact, min_dense);
+ min_dense = 0;
+ ret = H5Pset_attr_phase_change(dcpl, max_compact, min_dense);
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Create a dataset */
@@ -3026,12 +3028,10 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
ret = H5Pclose(dcpl);
CHECK(ret, FAIL, "H5Pclose");
-
/* Check on dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
-
/* Add first attribute, which should be immediately in dense storage */
/* Create attribute */
@@ -3052,7 +3052,6 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
-
/* Add second attribute, to allow deletions to be checked easily */
/* Create attribute */
@@ -3073,7 +3072,6 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
-
/* Delete second attribute, attributes should still be stored densely */
/* Delete attribute */
@@ -3084,7 +3082,6 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
-
/* Delete first attribute, attributes should not be stored densely */
/* Delete attribute */
@@ -3097,7 +3094,6 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
-
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -3117,8 +3113,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
/* Check size of file */
filesize = h5_get_file_size(FILENAME, fapl);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_dense_limits() */
-
+} /* test_attr_dense_limits() */
/****************************************************************
**
@@ -3129,23 +3124,23 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t gid1, gid2; /* Group ID */
- hid_t sid, sid2; /* Dataspace ID */
- hid_t attr, attr2, add_attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- hsize_t dims[] = {ATTR1_DIM1};
- int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading attribute */
- int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */
- unsigned scalar_data = 1317; /* scalar data for attribute */
- unsigned read_scalar; /* variable for reading attribute*/
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- unsigned u, i; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t gid1, gid2; /* Group ID */
+ hid_t sid, sid2; /* Dataspace ID */
+ hid_t attr, attr2, add_attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hsize_t dims[] = {ATTR1_DIM1};
+ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading attribute */
+ int rewrite_data[ATTR1_DIM1] = {1234, -423, 9907256}; /* Test data for rewrite */
+ unsigned scalar_data = 1317; /* scalar data for attribute */
+ unsigned read_scalar; /* variable for reading attribute*/
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ unsigned u, i; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing operations with two IDs for Dense Storage\n"));
@@ -3173,7 +3168,8 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -3195,7 +3191,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes, until just before converting to dense storage */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -3272,10 +3268,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(0 != read_data1[i])
- TestErrPrintf("%d: attribute data different: read_data1[%d]=%d\n", __LINE__,
- i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (0 != read_data1[i])
+ TestErrPrintf("%d: attribute data different: read_data1[%d]=%d\n", __LINE__, i, read_data1[i]);
/* Open attribute for the second time */
attr2 = H5Aopen(dataset, attrname, H5P_DEFAULT);
@@ -3325,9 +3320,10 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i,
+ attr_data1[i], i, read_data1[i]);
/* Open attribute for the second time */
attr2 = H5Aopen(dataset, attrname, H5P_DEFAULT);
@@ -3342,9 +3338,10 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(read_data1[i] != rewrite_data[i])
- TestErrPrintf("%d: attribute data different: read_data1[%d]=%d, rewrite_data[%d]=%d\n", __LINE__, i, read_data1[i], i, rewrite_data[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (read_data1[i] != rewrite_data[i])
+ TestErrPrintf("%d: attribute data different: read_data1[%d]=%d, rewrite_data[%d]=%d\n", __LINE__,
+ i, read_data1[i], i, rewrite_data[i]);
/* Close attribute */
ret = H5Aclose(attr);
@@ -3378,13 +3375,11 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
/* Open first attribute for the dataset */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4,
- H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Open attribute for the second time */
- attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4,
- H5P_DEFAULT, H5P_DEFAULT);
+ attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Write attribute information with the second ID */
@@ -3396,9 +3391,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- if(read_scalar != scalar_data)
- TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n",
- __LINE__, read_scalar, scalar_data);
+ if (read_scalar != scalar_data)
+ TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n", __LINE__, read_scalar,
+ scalar_data);
/* Close attribute */
ret = H5Aclose(attr);
@@ -3434,14 +3429,12 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
/* Open attribute of the dataset for the first time */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2,
- H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Delete a few attributes until the storage switches to compact */
- for(u = max_compact; u >= min_dense - 1; u--) {
- ret = H5Adelete_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u,
- H5P_DEFAULT);
+ for (u = max_compact; u >= min_dense - 1; u--) {
+ ret = H5Adelete_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Adelete_by_idx");
}
@@ -3450,8 +3443,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Open attribute for the second time */
- attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2,
- H5P_DEFAULT, H5P_DEFAULT);
+ attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Write attribute information with the second ID */
@@ -3463,9 +3455,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- if(read_scalar != scalar_data)
- TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n",
- __LINE__, read_scalar, scalar_data);
+ if (read_scalar != scalar_data)
+ TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n", __LINE__, read_scalar,
+ scalar_data);
/* Close attribute */
ret = H5Aclose(attr);
@@ -3501,12 +3493,11 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Open attribute of the dataset for the first time */
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3,
- H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Delete a few attributes until the storage switches to compact */
- for(u = min_dense-1; u <= max_compact; u++) {
+ for (u = min_dense - 1; u <= max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
add_attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -3526,8 +3517,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
/* Open attribute for the second time */
- attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3,
- H5P_DEFAULT, H5P_DEFAULT);
+ attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Write attribute information with the second ID */
@@ -3539,9 +3529,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- if(read_scalar != scalar_data)
- TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n",
- __LINE__, read_scalar, scalar_data);
+ if (read_scalar != scalar_data)
+ TestErrPrintf("%d: attribute data different: read_scalar=%d, scalar_data=%d\n", __LINE__, read_scalar,
+ scalar_data);
/* Close attribute */
ret = H5Aclose(attr);
@@ -3571,12 +3561,11 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(gid1, FAIL, "H5Gcreate2");
/* Create hard link to the first group */
- ret = H5Lcreate_hard(gid1, GROUP1_NAME, H5L_SAME_LOC, GROUP2_NAME, H5P_DEFAULT,
- H5P_DEFAULT);
+ ret = H5Lcreate_hard(gid1, GROUP1_NAME, H5L_SAME_LOC, GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lcreate_hard");
/* Add attributes, until just before converting to dense storage */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(gid1, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -3616,9 +3605,10 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i = 0; i < ATTR1_DIM1; i++)
- if(attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i,
+ attr_data1[i], i, read_data1[i]);
/* Close attribute */
ret = H5Aclose(attr);
@@ -3645,8 +3635,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_dense_dup_ids() */
-
+} /* test_attr_dense_dup_ids() */
/****************************************************************
**
@@ -3657,24 +3646,24 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
static void
test_attr_big(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t big_sid; /* "Big" dataspace ID */
- hsize_t dims[ATTR6_RANK] = {ATTR6_DIM1, ATTR6_DIM2, ATTR6_DIM3}; /* Attribute dimensions */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- unsigned nshared_indices; /* # of shared message indices */
- H5F_libver_t low, high; /* File format bounds */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t big_sid; /* "Big" dataspace ID */
+ hsize_t dims[ATTR6_RANK] = {ATTR6_DIM1, ATTR6_DIM2, ATTR6_DIM3}; /* Attribute dimensions */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ unsigned nshared_indices; /* # of shared message indices */
+ H5F_libver_t low, high; /* File format bounds */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Storing 'Big' Attributes in Dense Storage\n"));
@@ -3689,7 +3678,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
@@ -3708,7 +3697,8 @@ test_attr_big(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -3733,14 +3723,12 @@ test_attr_big(hid_t fcpl, hid_t fapl)
ret = H5Pclose(dcpl);
CHECK(ret, FAIL, "H5Pclose");
-
/* Check on dataset's attribute storage status */
is_empty = H5O__is_attr_empty_test(dataset);
VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test");
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
-
/* Add first "small" attribute, which should be in compact storage */
/* Create attribute */
@@ -3759,7 +3747,6 @@ test_attr_big(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
-
/* Add second "small" attribute, which should stay in compact storage */
/* Create attribute */
@@ -3778,14 +3765,13 @@ test_attr_big(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
-
/* Add first "big" attribute, which should push storage into dense form */
/* Create attribute */
u = 2;
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT);
- if(low == H5F_LIBVER_LATEST) {
+ if (low == H5F_LIBVER_LATEST) {
CHECK(attr, FAIL, "H5Acreate2");
/* Close attribute */
@@ -3802,7 +3788,6 @@ test_attr_big(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test");
-
/* Add second "big" attribute, which should leave storage in dense form */
/* Create attribute */
@@ -3825,7 +3810,6 @@ test_attr_big(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test");
-
/* Delete second "small" attribute, attributes should still be stored densely */
/* Delete attribute */
@@ -3840,7 +3824,6 @@ test_attr_big(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test");
-
/* Delete second "big" attribute, attributes should still be stored densely */
/* Delete attribute */
@@ -3855,7 +3838,6 @@ test_attr_big(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, (nshared_indices ? FALSE : TRUE), "H5O__is_attr_dense_test");
-
/* Delete first "big" attribute, attributes should _not_ be stored densely */
/* Delete attribute */
@@ -3870,7 +3852,6 @@ test_attr_big(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
-
/* Delete first "small" attribute, should be no attributes now */
/* Delete attribute */
@@ -3898,7 +3879,6 @@ test_attr_big(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
} /* end else */
-
/* Close dataspaces */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -3920,8 +3900,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Check size of file */
filesize = h5_get_file_size(FILENAME, fapl);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_big() */
-
+} /* test_attr_big() */
/****************************************************************
**
@@ -3932,20 +3911,20 @@ test_attr_big(hid_t fcpl, hid_t fapl)
static void
test_attr_null_space(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t null_sid; /* "null" dataspace ID */
- hid_t attr_sid; /* Attribute's dataspace ID */
- hid_t attr; /* Attribute ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned value; /* Attribute value */
- htri_t cmp; /* Results of comparison */
- hsize_t storage_size; /* Size of storage for attribute */
- H5A_info_t ainfo; /* Attribute info */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t null_sid; /* "null" dataspace ID */
+ hid_t attr_sid; /* Attribute's dataspace ID */
+ hid_t attr; /* Attribute ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned value; /* Attribute value */
+ htri_t cmp; /* Results of comparison */
+ hsize_t storage_size; /* Size of storage for attribute */
+ H5A_info_t ainfo; /* Attribute info */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Storing Attributes with 'null' dataspace\n"));
@@ -3960,7 +3939,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
@@ -3979,7 +3958,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
-
/* Add attribute with 'null' dataspace */
/* Create attribute */
@@ -3990,7 +3968,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Try to read data from the attribute */
/* (shouldn't fail, but should leave buffer alone) */
value = 23;
- ret = H5Aread(attr, H5T_NATIVE_UINT, &value);
+ ret = H5Aread(attr, H5T_NATIVE_UINT, &value);
CHECK(ret, FAIL, "H5Aread");
VERIFY(value, 23, "H5Aread");
@@ -4020,7 +3998,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
-
/* Add another attribute with 'null' dataspace */
/* Create attribute */
@@ -4031,7 +4008,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Try to write data to the attribute */
/* (shouldn't fail, but should leave buffer alone) */
value = 23;
- ret = H5Awrite(attr, H5T_NATIVE_UINT, &value);
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, &value);
CHECK(ret, FAIL, "H5Awrite");
VERIFY(value, 23, "H5Awrite");
@@ -4047,7 +4024,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open the file and check on the attributes */
/* Re-open file */
@@ -4058,7 +4034,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dopen2");
-
/* Open first attribute */
HDstrcpy(attrname, "null attr #2");
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
@@ -4067,7 +4042,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Try to read data from the attribute */
/* (shouldn't fail, but should leave buffer alone) */
value = 23;
- ret = H5Aread(attr, H5T_NATIVE_UINT, &value);
+ ret = H5Aread(attr, H5T_NATIVE_UINT, &value);
CHECK(ret, FAIL, "H5Aread");
VERIFY(value, 23, "H5Aread");
@@ -4097,7 +4072,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
-
/* Open second attribute */
HDstrcpy(attrname, "null attr");
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
@@ -4106,7 +4080,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Try to write data to the attribute */
/* (shouldn't fail, but should leave buffer alone) */
value = 23;
- ret = H5Awrite(attr, H5T_NATIVE_UINT, &value);
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, &value);
CHECK(ret, FAIL, "H5Awrite");
VERIFY(value, 23, "H5Awrite");
@@ -4114,7 +4088,6 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
-
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
@@ -4127,19 +4100,16 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Close dataspaces */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(null_sid);
CHECK(ret, FAIL, "H5Sclose");
-
/* Check size of file */
filesize = h5_get_file_size(FILENAME, fapl);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
-} /* test_attr_null_space() */
-
+} /* test_attr_null_space() */
/****************************************************************
**
@@ -4151,11 +4121,11 @@ static void
test_attr_deprec(hid_t fcpl, hid_t fapl)
{
#ifndef H5_NO_DEPRECATED_SYMBOLS
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deprecated Attribute Routines\n"));
@@ -4172,7 +4142,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
-
/* Add attribute to dataset */
/* Create attribute */
@@ -4194,7 +4163,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open the file and operate on the attribute */
/* Re-open file */
@@ -4205,7 +4173,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dopen2");
-
/* Get number of attributes with bad ID */
ret = H5Aget_num_attrs((hid_t)-1);
VERIFY(ret, FAIL, "H5Aget_num_attrs");
@@ -4230,7 +4197,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
-
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
@@ -4240,14 +4206,14 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
#else /* H5_NO_DEPRECATED_SYMBOLS */
/* Shut compiler up */
- fcpl = fcpl; fapl = fapl;
+ fcpl = fcpl;
+ fapl = fapl;
/* Output message about test being skipped */
MESSAGE(5, ("Skipping Test On Deprecated Attribute Routines\n"));
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-} /* test_attr_deprec() */
-
+} /* test_attr_deprec() */
/****************************************************************
**
@@ -4258,15 +4224,15 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
static void
test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t gid; /* Group ID */
- hid_t sid; /* Dataspace ID */
- hid_t aid; /* Attribute ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned nattr = (new_format ? NATTR_MANY_NEW : NATTR_MANY_OLD); /* Number of attributes */
- htri_t exists; /* Whether the attribute exists or not */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t gid; /* Group ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t aid; /* Attribute ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned nattr = (new_format ? NATTR_MANY_NEW : NATTR_MANY_OLD); /* Number of attributes */
+ htri_t exists; /* Whether the attribute exists or not */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Storing Many Attributes\n"));
@@ -4284,7 +4250,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gcreate2");
/* Create many attributes */
- for(u = 0; u < nattr; u++) {
+ for (u = 0; u < nattr; u++) {
HDsprintf(attrname, "a-%06u", u);
exists = H5Aexists(gid, attrname);
@@ -4323,7 +4289,6 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open the file and check on the attributes */
/* Re-open file */
@@ -4335,8 +4300,8 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gopen2");
/* Verify attributes */
- for(u = 0; u < nattr; u++) {
- unsigned value; /* Attribute value */
+ for (u = 0; u < nattr; u++) {
+ unsigned value; /* Attribute value */
HDsprintf(attrname, "a-%06u", u);
@@ -4371,12 +4336,10 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Close dataspaces */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_many() */
-
+} /* test_attr_many() */
/****************************************************************
**
@@ -4387,14 +4350,14 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
static void
test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
hid_t dcpl; /* Dataset creation property list ID */
- unsigned crt_order_flags;/* Creation order flags */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- herr_t ret; /* Generic return value */
+ unsigned crt_order_flags; /* Creation order flags */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Code for Attributes with Creation Order Info\n"));
@@ -4407,7 +4370,8 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -4429,7 +4393,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pset_attr_creation_order");
ret = H5Pget_attr_creation_order(dcpl, &crt_order_flags);
CHECK(ret, FAIL, "H5Pget_attr_creation_order");
- VERIFY(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) , "H5Pget_attr_creation_order");
+ VERIFY(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "H5Pget_attr_creation_order");
/* Create dataspace for dataset */
sid = H5Screate(H5S_SCALAR);
@@ -4461,7 +4425,6 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -4483,7 +4446,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
/* Query the attribute creation properties */
ret = H5Pget_attr_creation_order(dcpl, &crt_order_flags);
CHECK(ret, FAIL, "H5Pget_attr_creation_order");
- VERIFY(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) , "H5Pget_attr_creation_order");
+ VERIFY(crt_order_flags, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "H5Pget_attr_creation_order");
/* Close property list */
ret = H5Pclose(dcpl);
@@ -4496,8 +4459,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_corder_create_basic() */
-
+} /* test_attr_corder_create_basic() */
/****************************************************************
**
@@ -4508,21 +4470,21 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
static void
test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Compact Storage of Attributes with Creation Order Info\n"));
@@ -4535,7 +4497,8 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -4561,8 +4524,8 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -4586,7 +4549,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Create several attributes, but keep storage in compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -4609,7 +4572,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
} /* end for */
- } /* end for */
+ } /* end for */
/* Close Datasets */
ret = H5Dclose(dset1);
@@ -4631,7 +4594,6 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -4645,8 +4607,8 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dopen2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -4674,8 +4636,8 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
/* Loop through attributes, checking their creation order values */
/* (the name index is used, but the creation order value is in the same order) */
- for(u = 0; u < max_compact; u++) {
- H5A_info_t ainfo; /* Attribute information */
+ for (u = 0; u < max_compact; u++) {
+ H5A_info_t ainfo; /* Attribute information */
/* Retrieve information for attribute */
HDsprintf(attrname, "attr %02u", u);
@@ -4686,7 +4648,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
VERIFY(ainfo.corder_valid, TRUE, "H5Aget_info_by_name");
VERIFY(ainfo.corder, u, "H5Aget_info_by_name");
} /* end for */
- } /* end for */
+ } /* end for */
/* Close Datasets */
ret = H5Dclose(dset1);
@@ -4699,8 +4661,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_corder_create_compact() */
-
+} /* test_attr_corder_create_compact() */
/****************************************************************
**
@@ -4711,23 +4672,23 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
static void
test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dense Storage of Attributes with Creation Order Info\n"));
@@ -4740,7 +4701,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -4766,8 +4728,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -4791,7 +4753,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Create several attributes, but keep storage in compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -4863,7 +4825,6 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -4877,8 +4838,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dopen2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -4906,8 +4867,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
/* Loop through attributes, checking their creation order values */
/* (the name index is used, but the creation order value is in the same order) */
- for(u = 0; u < (max_compact + 1); u++) {
- H5A_info_t ainfo; /* Attribute information */
+ for (u = 0; u < (max_compact + 1); u++) {
+ H5A_info_t ainfo; /* Attribute information */
/* Retrieve information for attribute */
HDsprintf(attrname, "attr %02u", u);
@@ -4918,7 +4879,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
VERIFY(ainfo.corder_valid, TRUE, "H5Aget_info_by_name");
VERIFY(ainfo.corder, u, "H5Aget_info_by_name");
} /* end for */
- } /* end for */
+ } /* end for */
/* Close Datasets */
ret = H5Dclose(dset1);
@@ -4931,8 +4892,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_corder_create_dense() */
-
+} /* test_attr_corder_create_dense() */
/****************************************************************
**
@@ -4944,13 +4904,13 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
static void
test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t gcpl_id = -1; /* Group creation property list ID */
- hid_t gid = -1; /* Group ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- int buf; /* Attribute data */
- herr_t ret; /* Generic return value */
+ hid_t fid = -1; /* File ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ int buf; /* Attribute data */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Creating Attributes w/New & Old Format\n"));
@@ -4998,7 +4958,6 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file, without "use the latest format" flag */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -5039,8 +4998,7 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl)
/* Close attribute dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_corder_create_reopen() */
-
+} /* test_attr_corder_create_reopen() */
/****************************************************************
**
@@ -5051,23 +5009,23 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl)
static void
test_attr_corder_transition(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Storage Transitions of Attributes with Creation Order Info\n"));
@@ -5080,7 +5038,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -5097,10 +5056,10 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
sid = H5Screate(H5S_SCALAR);
CHECK(sid, FAIL, "H5Screate");
-/* XXX: Try to find a way to resize dataset's object header so that the object
- * header can have one chunk, then retrieve "empty" file size and check
- * that size after everything is deleted -QAK
- */
+ /* XXX: Try to find a way to resize dataset's object header so that the object
+ * header can have one chunk, then retrieve "empty" file size and check
+ * that size after everything is deleted -QAK
+ */
/* Create datasets */
dset1 = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
CHECK(dset1, FAIL, "H5Dcreate2");
@@ -5110,8 +5069,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -5151,7 +5110,6 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -5165,8 +5123,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dopen2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -5184,7 +5142,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
} /* end switch */
/* Create several attributes, but keep storage in compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -5236,7 +5194,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
/* Delete several attributes from object, until attribute storage resumes compact form */
- for(u = max_compact; u >= min_dense; u--) {
+ for (u = max_compact; u >= min_dense; u--) {
HDsprintf(attrname, "attr %02u", u);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5271,7 +5229,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Re-add attributes to get back into dense form */
- for(u = (min_dense - 1); u < (max_compact + 1); u++) {
+ for (u = (min_dense - 1); u < (max_compact + 1); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -5313,7 +5271,6 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -5327,8 +5284,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dopen2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -5360,7 +5317,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
/* Delete several attributes from object, until attribute storage resumes compact form */
- for(u = max_compact; u >= min_dense; u--) {
+ for (u = max_compact; u >= min_dense; u--) {
HDsprintf(attrname, "attr %02u", u);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5395,7 +5352,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Re-add attributes to get back into dense form */
- for(u = (min_dense - 1); u < (max_compact + 1); u++) {
+ for (u = (min_dense - 1); u < (max_compact + 1); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -5425,7 +5382,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
/* Delete all attributes */
- for(u = max_compact; u > 0; u--) {
+ for (u = max_compact; u > 0; u--) {
HDsprintf(attrname, "attr %02u", u);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5450,8 +5407,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_corder_transition() */
-
+} /* test_attr_corder_transition() */
/****************************************************************
**
@@ -5462,28 +5418,28 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
static void
test_attr_corder_delete(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- unsigned reopen_file; /* Whether to re-open the file before deleting group */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ unsigned reopen_file; /* Whether to re-open the file before deleting group */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
#ifdef LATER
- h5_stat_size_t empty_size; /* Size of empty file */
- h5_stat_size_t file_size; /* Size of file after operating on it */
-#endif /* LATER */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ h5_stat_size_t empty_size; /* Size of empty file */
+ h5_stat_size_t file_size; /* Size of file after operating on it */
+#endif /* LATER */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deleting Object w/Dense Attribute Storage and Creation Order Info\n"));
@@ -5496,7 +5452,8 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -5509,7 +5466,6 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense);
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
-
/* XXX: Try to find a way to resize dataset's object header so that the object
* header can have one chunk, then retrieve "empty" file size and check
* that size after everything is deleted -QAK
@@ -5528,10 +5484,9 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
CHECK(empty_size, FAIL, "h5_get_file_size");
#endif /* LATER */
-
/* Loop to leave file open when deleting dataset, or to close & re-open file
* before deleting dataset */
- for(reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) {
+ for (reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) {
/* Create test file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -5545,8 +5500,8 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -5570,7 +5525,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Create attributes, until attribute storage is in dense form */
- for(u = 0; u < max_compact * 2; u++) {
+ for (u = 0; u < max_compact * 2; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -5609,7 +5564,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Dclose");
/* Check for deleting datasets without re-opening file */
- if(!reopen_file) {
+ if (!reopen_file) {
ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT);
@@ -5623,7 +5578,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
/* Check for deleting dataset after re-opening file */
- if(reopen_file) {
+ if (reopen_file) {
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -5647,7 +5602,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
CHECK(file_size, FAIL, "h5_get_file_size");
VERIFY(file_size, empty_size, "h5_get_file_size");
#endif /* LATER */
- } /* end for */
+ } /* end for */
/* Close property list */
ret = H5Pclose(dcpl);
@@ -5656,8 +5611,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_corder_delete() */
-
+} /* test_attr_corder_delete() */
/*-------------------------------------------------------------------------
* Function: attr_info_by_idx_check
@@ -5677,13 +5631,12 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
- hbool_t use_index)
+attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t use_index)
{
- char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
- H5A_info_t ainfo; /* Attribute info struct */
- int old_nerrs; /* Number of errors when entering this check */
- herr_t ret; /* Generic return value */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
+ H5A_info_t ainfo; /* Attribute info struct */
+ int old_nerrs; /* Number of errors when entering this check */
+ herr_t ret; /* Generic return value */
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
@@ -5702,20 +5655,21 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
- if(HDstrcmp(attrname, tmpname))
+ if (HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
-
/* Don't test "native" order if there is no creation order index, since
* there's not a good way to easily predict the attribute's order in the name
* index.
*/
- if(use_index) {
+ if (use_index) {
/* Verify the information for first attribute, in native creation order */
HDmemset(&ainfo, 0, sizeof(ainfo));
- ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &ainfo, H5P_DEFAULT);
+ ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &ainfo,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_idx");
VERIFY(ainfo.corder, 0, "H5Aget_info_by_idx");
@@ -5727,13 +5681,13 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing native order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
- if(HDstrcmp(attrname, tmpname))
+ if (HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
} /* end if */
-
/* Verify the information for first attribute, in decreasing creation order */
HDmemset(&ainfo, 0, sizeof(ainfo));
ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &ainfo, H5P_DEFAULT);
@@ -5748,12 +5702,12 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
- if(HDstrcmp(attrname, tmpname))
+ if (HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
-
/* Verify the information for first attribute, in increasing name order */
HDmemset(&ainfo, 0, sizeof(ainfo));
ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &ainfo, H5P_DEFAULT);
@@ -5768,17 +5722,16 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
- if(HDstrcmp(attrname, tmpname))
+ if (HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
-
/* Don't test "native" order queries on link name order, since there's not
* a good way to easily predict the order of the links in the name index.
*/
-
/* Verify the information for first attribute, in decreasing name order */
HDmemset(&ainfo, 0, sizeof(ainfo));
ret = H5Aget_info_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &ainfo, H5P_DEFAULT);
@@ -5793,19 +5746,19 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname,
+ (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
- if(HDstrcmp(attrname, tmpname))
+ if (HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
/* Retrieve current # of errors */
- if(old_nerrs == GetTestNumErrs())
- return(0);
+ if (old_nerrs == GetTestNumErrs())
+ return (0);
else
- return(-1);
+ return (-1);
} /* end attr_info_by_idx_check() */
-
/****************************************************************
**
** test_attr_info_by_idx(): Test basic H5A (attribute) code.
@@ -5815,26 +5768,26 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
static void
test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- H5A_info_t ainfo; /* Attribute information */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- unsigned use_index; /* Use index on creation order values */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ H5A_info_t ainfo; /* Attribute information */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ unsigned use_index; /* Use index on creation order values */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -5844,7 +5797,8 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -5854,9 +5808,9 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Output message about test being performed */
- if(use_index)
+ if (use_index)
MESSAGE(5, ("Testing Querying Attribute Info By Index w/Creation Order Index\n"))
else
MESSAGE(5, ("Testing Querying Attribute Info By Index w/o Creation Order Index\n"))
@@ -5866,8 +5820,9 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- if(new_format == TRUE) {
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ if (new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(
+ dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
CHECK(ret, FAIL, "H5Pset_attr_creation_order");
} /* end if */
@@ -5880,8 +5835,8 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -5905,13 +5860,15 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Check for query on non-existant attribute */
- ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, H5P_DEFAULT);
+ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo,
+ H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_name_by_idx");
/* Create attributes, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -5940,15 +5897,18 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Check for out of bound offset queries */
- ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, H5P_DEFAULT);
+ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo,
+ H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, H5P_DEFAULT);
+ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo,
+ H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_name_by_idx");
/* Create more attributes, to push into dense form */
- for(; u < (max_compact * 2); u++) {
+ for (; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -5980,21 +5940,24 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
- if(new_format) {
+ if (new_format) {
/* Retrieve & verify # of records in the name & creation order indices */
ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count);
CHECK(ret, FAIL, "H5O__attr_dense_info_test");
- if(use_index)
+ if (use_index)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test");
} /* end if */
/* Check for out of bound offset queries */
- ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, H5P_DEFAULT);
+ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo,
+ H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, H5P_DEFAULT);
+ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo,
+ H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_name_by_idx");
} /* end for */
@@ -6018,8 +5981,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_info_by_idx() */
-
+} /* test_attr_info_by_idx() */
/***************************************************************
**
@@ -6048,21 +6010,24 @@ test_attr_info_null_info_pointer(hid_t fcpl, hid_t fapl)
attr = H5Acreate2(fid, GET_INFO_NULL_POINTER_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
- H5E_BEGIN_TRY {
- err_ret = H5Aget_info(attr, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { err_ret = H5Aget_info(attr, NULL); }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Aget_info");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Aget_info_by_name(fid, ".", GET_INFO_NULL_POINTER_ATTR_NAME, NULL, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Aget_info_by_name");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Aget_info_by_idx(fid, ".", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Aget_info_by_idx");
@@ -6079,7 +6044,6 @@ test_attr_info_null_info_pointer(hid_t fcpl, hid_t fapl)
CHECK(err_ret, FAIL, "H5Fclose");
}
-
/***************************************************************
**
** test_attr_rename_invalid_name(): A test to ensure that
@@ -6107,51 +6071,49 @@ test_attr_rename_invalid_name(hid_t fcpl, hid_t fapl)
attr = H5Acreate2(fid, INVALID_RENAME_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
- H5E_BEGIN_TRY {
- err_ret = H5Arename(fid, NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { err_ret = H5Arename(fid, NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME); }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename");
- H5E_BEGIN_TRY {
- err_ret = H5Arename(fid, "", INVALID_RENAME_TEST_NEW_ATTR_NAME);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { err_ret = H5Arename(fid, "", INVALID_RENAME_TEST_NEW_ATTR_NAME); }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename");
- H5E_BEGIN_TRY {
- err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, NULL); }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename");
- H5E_BEGIN_TRY {
- err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, "");
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { err_ret = H5Arename(fid, INVALID_RENAME_TEST_ATTR_NAME, ""); }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Arename_by_name(fid, ".", NULL, INVALID_RENAME_TEST_NEW_ATTR_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename_by_name");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Arename_by_name(fid, ".", "", INVALID_RENAME_TEST_NEW_ATTR_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename_by_name");
- H5E_BEGIN_TRY {
- err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, NULL, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, NULL, H5P_DEFAULT); }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename_by_name");
- H5E_BEGIN_TRY {
- err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, "", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { err_ret = H5Arename_by_name(fid, ".", INVALID_RENAME_TEST_ATTR_NAME, "", H5P_DEFAULT); }
+ H5E_END_TRY;
CHECK(err_ret, SUCCEED, "H5Arename_by_name");
@@ -6168,7 +6130,6 @@ test_attr_rename_invalid_name(hid_t fcpl, hid_t fapl)
CHECK(err_ret, FAIL, "H5Fclose");
}
-
/***************************************************************
**
** test_attr_get_name_invalid_buf(): A test to ensure that
@@ -6194,18 +6155,20 @@ test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Create attribute */
- attr = H5Acreate2(fid, GET_NAME_INVALID_BUF_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Acreate2(fid, GET_NAME_INVALID_BUF_TEST_ATTR_NAME, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
- H5E_BEGIN_TRY {
- err_ret = H5Aget_name(attr, 1, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { err_ret = H5Aget_name(attr, 1, NULL); }
+ H5E_END_TRY;
VERIFY(err_ret, FAIL, "H5Aget_name");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
err_ret = H5Aget_name_by_idx(fid, ".", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, 1, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(err_ret, FAIL, "H5Aget_name_by_idx");
@@ -6222,7 +6185,6 @@ test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl)
CHECK(err_ret, FAIL, "H5Fclose");
}
-
/****************************************************************
**
** test_attr_delete_by_idx(): Test basic H5A (attribute) code.
@@ -6232,28 +6194,28 @@ test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl)
static void
test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- H5A_info_t ainfo; /* Attribute information */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- unsigned use_index; /* Use index on creation order values */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ H5A_info_t ainfo; /* Attribute information */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -6263,7 +6225,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -6273,48 +6236,57 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Increasing Order w/Creation Order Index\n"))
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Increasing "
+ "Order w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Increasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Increasing "
+ "Order w/o Creation Order Index\n"))
} /* end if */
else {
- if(use_index)
- MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Decreasing Order w/Creation Order Index\n"))
+ if (use_index)
+ MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Decreasing "
+ "Order w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Decreasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Deleting Attribute By Creation Order Index in Decreasing "
+ "Order w/o Creation Order Index\n"))
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
- MESSAGE(5, ("Testing Deleting Attribute By Name Index in Increasing Order w/Creation Order Index\n"))
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ MESSAGE(5, ("Testing Deleting Attribute By Name Index in Increasing Order "
+ "w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Deleting Attribute By Name Index in Increasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Deleting Attribute By Name Index in Increasing Order w/o "
+ "Creation Order Index\n"))
} /* end if */
else {
- if(use_index)
- MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order w/Creation Order Index\n"))
+ if (use_index)
+ MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order "
+ "w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Deleting Attribute By Name Index in Decreasing Order w/o "
+ "Creation Order Index\n"))
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- if(new_format == TRUE) {
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ if (new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(
+ dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
CHECK(ret, FAIL, "H5Pset_attr_creation_order");
} /* end if */
@@ -6327,8 +6299,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -6356,10 +6328,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(ret, FAIL, "H5Adelete_by_idx");
/* Create attributes, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
- attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -6390,8 +6363,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end for */
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -6409,27 +6382,29 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Delete attributes from compact storage */
- for(u = 0; u < (max_compact - 1); u++) {
+ for (u = 0; u < (max_compact - 1); u++) {
/* Delete first attribute in appropriate order */
ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Adelete_by_idx");
/* Verify the attribute information for first attribute in appropriate order */
HDmemset(&ainfo, 0, sizeof(ainfo));
- ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo, H5P_DEFAULT);
- if(new_format) {
- if(order == H5_ITER_INC) {
+ ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo,
+ H5P_DEFAULT);
+ if (new_format) {
+ if (order == H5_ITER_INC) {
VERIFY(ainfo.corder, (u + 1), "H5Aget_info_by_idx");
} /* end if */
else {
VERIFY(ainfo.corder, (max_compact - (u + 2)), "H5Aget_info_by_idx");
} /* end else */
- } /* end if */
+ } /* end if */
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- if(order == H5_ITER_INC)
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ if (order == H5_ITER_INC)
HDsprintf(attrname, "attr %02u", (u + 1));
else
HDsprintf(attrname, "attr %02u", (max_compact - (u + 2)));
@@ -6447,8 +6422,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end for */
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -6466,10 +6441,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Create more attributes, to push into dense form */
- for(u = 0; u < (max_compact * 2); u++) {
+ for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
- attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -6481,7 +6457,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Verify state of object */
- if(u >= max_compact) {
+ if (u >= max_compact) {
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
} /* end if */
@@ -6500,11 +6476,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
- if(new_format) {
+ if (new_format) {
/* Retrieve & verify # of records in the name & creation order indices */
ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count);
CHECK(ret, FAIL, "H5O__attr_dense_info_test");
- if(use_index)
+ if (use_index)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test");
} /* end if */
@@ -6515,8 +6491,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end for */
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -6534,27 +6510,29 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Delete attributes from dense storage */
- for(u = 0; u < ((max_compact * 2) - 1); u++) {
+ for (u = 0; u < ((max_compact * 2) - 1); u++) {
/* Delete first attribute in appropriate order */
ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Adelete_by_idx");
/* Verify the attribute information for first attribute in appropriate order */
HDmemset(&ainfo, 0, sizeof(ainfo));
- ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo, H5P_DEFAULT);
- if(new_format) {
- if(order == H5_ITER_INC) {
+ ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo,
+ H5P_DEFAULT);
+ if (new_format) {
+ if (order == H5_ITER_INC) {
VERIFY(ainfo.corder, (u + 1), "H5Aget_info_by_idx");
} /* end if */
else {
VERIFY(ainfo.corder, ((max_compact * 2) - (u + 2)), "H5Aget_info_by_idx");
} /* end else */
- } /* end if */
+ } /* end if */
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- if(order == H5_ITER_INC)
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ if (order == H5_ITER_INC)
HDsprintf(attrname, "attr %02u", (u + 1));
else
HDsprintf(attrname, "attr %02u", ((max_compact * 2) - (u + 2)));
@@ -6575,13 +6553,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(ret, FAIL, "H5Adelete_by_idx");
} /* end for */
-
- /* Delete attributes in middle */
-
+ /* Delete attributes in middle */
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -6599,10 +6575,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Create attributes, to push into dense form */
- for(u = 0; u < (max_compact * 2); u++) {
+ for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
- attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -6614,7 +6591,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Verify state of object */
- if(u >= max_compact) {
+ if (u >= max_compact) {
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
} /* end if */
@@ -6623,11 +6600,11 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = attr_info_by_idx_check(my_dataset, attrname, (hsize_t)u, use_index);
CHECK(ret, FAIL, "attr_info_by_idx_check");
} /* end for */
- } /* end for */
+ } /* end for */
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -6645,38 +6622,41 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Delete every other attribute from dense storage, in appropriate order */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Delete attribute */
ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Adelete_by_idx");
/* Verify the attribute information for first attribute in appropriate order */
HDmemset(&ainfo, 0, sizeof(ainfo));
- ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, &ainfo, H5P_DEFAULT);
- if(new_format) {
- if(order == H5_ITER_INC) {
+ ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, &ainfo,
+ H5P_DEFAULT);
+ if (new_format) {
+ if (order == H5_ITER_INC) {
VERIFY(ainfo.corder, ((u * 2) + 1), "H5Aget_info_by_idx");
} /* end if */
else {
- VERIFY(ainfo.corder, ((max_compact * 2) - ((u * 2) + 2)), "H5Aget_info_by_idx");
+ VERIFY(ainfo.corder, ((max_compact * 2) - ((u * 2) + 2)),
+ "H5Aget_info_by_idx");
} /* end else */
- } /* end if */
+ } /* end if */
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- if(order == H5_ITER_INC)
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ if (order == H5_ITER_INC)
HDsprintf(attrname, "attr %02u", ((u * 2) + 1));
else
HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 2)));
ret = HDstrcmp(attrname, tmpname);
VERIFY(ret, 0, "H5Aget_name_by_idx");
} /* end for */
- } /* end for */
+ } /* end for */
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -6694,27 +6674,30 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Delete remaining attributes from dense storage, in appropriate order */
- for(u = 0; u < (max_compact - 1); u++) {
+ for (u = 0; u < (max_compact - 1); u++) {
/* Delete attribute */
ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Adelete_by_idx");
/* Verify the attribute information for first attribute in appropriate order */
HDmemset(&ainfo, 0, sizeof(ainfo));
- ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo, H5P_DEFAULT);
- if(new_format) {
- if(order == H5_ITER_INC) {
+ ret = H5Aget_info_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, &ainfo,
+ H5P_DEFAULT);
+ if (new_format) {
+ if (order == H5_ITER_INC) {
VERIFY(ainfo.corder, ((u * 2) + 3), "H5Aget_info_by_idx");
} /* end if */
else {
- VERIFY(ainfo.corder, ((max_compact * 2) - ((u * 2) + 4)), "H5Aget_info_by_idx");
+ VERIFY(ainfo.corder, ((max_compact * 2) - ((u * 2) + 4)),
+ "H5Aget_info_by_idx");
} /* end else */
- } /* end if */
+ } /* end if */
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
- if(order == H5_ITER_INC)
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0,
+ tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ if (order == H5_ITER_INC)
HDsprintf(attrname, "attr %02u", ((u * 2) + 3));
else
HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 4)));
@@ -6747,8 +6730,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close property list */
ret = H5Pclose(dcpl);
@@ -6757,8 +6740,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_delete_by_idx() */
-
+} /* test_attr_delete_by_idx() */
/****************************************************************
**
@@ -6766,63 +6748,62 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
**
****************************************************************/
static herr_t
-attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info,
- void *_op_data)
+attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data)
{
- attr_iter_info_t *op_data = (attr_iter_info_t *)_op_data; /* User data */
- char attrname[NAME_BUF_SIZE]; /* Object name */
- H5A_info_t my_info; /* Local attribute info */
+ attr_iter_info_t *op_data = (attr_iter_info_t *)_op_data; /* User data */
+ char attrname[NAME_BUF_SIZE]; /* Object name */
+ H5A_info_t my_info; /* Local attribute info */
/* Increment # of times the callback was called */
op_data->ncalled++;
/* Get the attribute information directly to compare */
- if(H5Aget_info_by_name(loc_id, ".", attr_name, &my_info, H5P_DEFAULT) < 0)
- return(H5_ITER_ERROR);
+ if (H5Aget_info_by_name(loc_id, ".", attr_name, &my_info, H5P_DEFAULT) < 0)
+ return (H5_ITER_ERROR);
/* Check more things for revised attribute iteration (vs. older attribute iteration) */
- if(info) {
+ if (info) {
/* Check for correct order of iteration */
/* (if we are operating in increasing or decreasing order) */
- if(op_data->order != H5_ITER_NATIVE)
- if(info->corder != op_data->curr)
- return(H5_ITER_ERROR);
+ if (op_data->order != H5_ITER_NATIVE)
+ if (info->corder != op_data->curr)
+ return (H5_ITER_ERROR);
/* Compare attribute info structs */
- if(info->corder_valid != my_info.corder_valid)
- return(H5_ITER_ERROR);
- if(info->corder != my_info.corder)
- return(H5_ITER_ERROR);
- if(info->cset != my_info.cset)
- return(H5_ITER_ERROR);
- if(info->data_size != my_info.data_size)
- return(H5_ITER_ERROR);
+ if (info->corder_valid != my_info.corder_valid)
+ return (H5_ITER_ERROR);
+ if (info->corder != my_info.corder)
+ return (H5_ITER_ERROR);
+ if (info->cset != my_info.cset)
+ return (H5_ITER_ERROR);
+ if (info->data_size != my_info.data_size)
+ return (H5_ITER_ERROR);
} /* end if */
/* Verify name of link */
HDsprintf(attrname, "attr %02u", (unsigned)my_info.corder);
- if(HDstrcmp(attr_name, attrname))
- return(H5_ITER_ERROR);
+ if (HDstrcmp(attr_name, attrname))
+ return (H5_ITER_ERROR);
/* Check if we've visited this link before */
- if((size_t)op_data->curr >= op_data->max_visit)
- return(H5_ITER_ERROR);
- if(op_data->visited[op_data->curr])
- return(H5_ITER_ERROR);
+ if ((size_t)op_data->curr >= op_data->max_visit)
+ return (H5_ITER_ERROR);
+ if (op_data->visited[op_data->curr])
+ return (H5_ITER_ERROR);
op_data->visited[op_data->curr] = TRUE;
/* Advance to next value, in correct direction */
- if(op_data->order != H5_ITER_DEC)
+ if (op_data->order != H5_ITER_DEC)
op_data->curr++;
else
op_data->curr--;
/* Check for stopping in the middle of iterating */
- if(op_data->stop > 0)
- if(--op_data->stop == 0)
- return(CORDER_ITER_STOP);
+ if (op_data->stop > 0)
+ if (--op_data->stop == 0)
+ return (CORDER_ITER_STOP);
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
} /* end attr_iterate2_cb() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -6835,11 +6816,10 @@ attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info,
static herr_t
attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data)
{
- return(attr_iterate2_cb(loc_id, attr_name, NULL, _op_data));
+ return (attr_iterate2_cb(loc_id, attr_name, NULL, _op_data));
} /* end attr_iterate1_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: attr_iterate2_fail_cb
*
@@ -6856,12 +6836,11 @@ attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data)
*/
static int
attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *attr_name,
- const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
+ const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
{
- return(H5_ITER_ERROR);
+ return (H5_ITER_ERROR);
} /* end attr_iterate2_fail_cb() */
-
/*-------------------------------------------------------------------------
* Function: attr_iterate_check
*
@@ -6876,263 +6855,251 @@ attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *
*-------------------------------------------------------------------------
*/
static int
-attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id,
- H5_index_t idx_type, H5_iter_order_t order, unsigned max_attrs,
- attr_iter_info_t *iter_info)
+attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ unsigned max_attrs, attr_iter_info_t *iter_info)
{
- unsigned v; /* Local index variable */
- hsize_t skip; /* # of attributes to skip on object */
+ unsigned v; /* Local index variable */
+ hsize_t skip; /* # of attributes to skip on object */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- unsigned oskip; /* # of attributes to skip on object, with H5Aiterate1 */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- int old_nerrs; /* Number of errors when entering this check */
- herr_t ret; /* Generic return value */
+ unsigned oskip; /* # of attributes to skip on object, with H5Aiterate1 */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ int old_nerrs; /* Number of errors when entering this check */
+ herr_t ret; /* Generic return value */
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
/* Iterate over attributes on object */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_cb, iter_info);
CHECK(ret, FAIL, "H5Aiterate2");
/* Verify that we visited all the attributes */
VERIFY(skip, max_attrs, "H5Aiterate2");
- for(v = 0; v < max_attrs; v++)
+ for (v = 0; v < max_attrs; v++)
VERIFY(iter_info->visited[v], TRUE, "H5Aiterate2");
-
/* Iterate over attributes on object */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aiterate_by_name");
/* Verify that we visited all the attributes */
VERIFY(skip, max_attrs, "H5Aiterate_by_name");
- for(v = 0; v < max_attrs; v++)
+ for (v = 0; v < max_attrs; v++)
VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name");
-
/* Iterate over attributes on object */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aiterate_by_name");
/* Verify that we visited all the attributes */
VERIFY(skip, max_attrs, "H5Aiterate_by_name");
- for(v = 0; v < max_attrs; v++)
+ for (v = 0; v < max_attrs; v++)
VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name");
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over attributes on object, with H5Aiterate1 */
iter_info->nskipped = oskip = 0;
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate1(obj_id, &oskip, attr_iterate1_cb, iter_info);
CHECK(ret, FAIL, "H5Aiterate1");
/* Verify that we visited all the attributes */
VERIFY(skip, max_attrs, "H5Aiterate1");
- for(v = 0; v < max_attrs; v++)
+ for (v = 0; v < max_attrs; v++)
VERIFY(iter_info->visited[v], TRUE, "H5Aiterate1");
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/* Skip over some attributes on object */
iter_info->nskipped = (unsigned)(skip = max_attrs / 2);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_cb, iter_info);
CHECK(ret, FAIL, "H5Aiterate2");
/* Verify that we visited all the attributes */
VERIFY(skip, max_attrs, "H5Aiterate2");
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_attrs / 2); v++)
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_attrs / 2); v++)
VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate2");
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_attrs / 2); v++)
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_attrs / 2); v++)
VERIFY(iter_info->visited[v], TRUE, "H5Aiterate2");
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_attrs; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_attrs; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
VERIFY(skip, (max_attrs / 2), "H5Aiterate2");
} /* end else */
-
/* Skip over some attributes on object */
iter_info->nskipped = (unsigned)(skip = max_attrs / 2);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aiterate_by_name");
/* Verify that we visited all the attributes */
VERIFY(skip, max_attrs, "H5Aiterate_by_name");
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_attrs / 2); v++)
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_attrs / 2); v++)
VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate_by_name");
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_attrs / 2); v++)
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_attrs / 2); v++)
VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name");
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_attrs; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_attrs; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
VERIFY(skip, (max_attrs / 2), "H5Aiterate_by_name");
} /* end else */
-
/* Skip over some attributes on object */
iter_info->nskipped = (unsigned)(skip = max_attrs / 2);
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? skip : ((max_attrs - 1) - skip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aiterate_by_name");
/* Verify that we visited all the attributes */
VERIFY(skip, max_attrs, "H5Aiterate_by_name");
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_attrs / 2); v++)
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_attrs / 2); v++)
VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate_by_name");
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_attrs / 2); v++)
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_attrs / 2); v++)
VERIFY(iter_info->visited[v], TRUE, "H5Aiterate_by_name");
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_attrs; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_attrs; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
VERIFY(skip, (max_attrs / 2), "H5Aiterate_by_name");
} /* end else */
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some attributes on object, with H5Aiterate1 */
iter_info->nskipped = oskip = max_attrs / 2;
- iter_info->order = order;
- iter_info->stop = -1;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)oskip : ((max_attrs - 1) - oskip);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)oskip : ((max_attrs - 1) - oskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate1(obj_id, &oskip, attr_iterate1_cb, iter_info);
CHECK(ret, FAIL, "H5Aiterate1");
/* Verify that we visited all the links */
VERIFY(oskip, max_attrs, "H5Aiterate1");
- if(order == H5_ITER_INC) {
- for(v = 0; v < (max_attrs / 2); v++)
+ if (order == H5_ITER_INC) {
+ for (v = 0; v < (max_attrs / 2); v++)
VERIFY(iter_info->visited[v + (max_attrs / 2)], TRUE, "H5Aiterate1");
} /* end if */
- else if(order == H5_ITER_DEC) {
- for(v = 0; v < (max_attrs / 2); v++)
+ else if (order == H5_ITER_DEC) {
+ for (v = 0; v < (max_attrs / 2); v++)
VERIFY(iter_info->visited[v], TRUE, "H5Aiterate1");
} /* end if */
else {
- unsigned nvisit = 0; /* # of links visited */
+ unsigned nvisit = 0; /* # of links visited */
HDassert(order == H5_ITER_NATIVE);
- for(v = 0; v < max_attrs; v++)
- if(iter_info->visited[v] == TRUE)
+ for (v = 0; v < max_attrs; v++)
+ if (iter_info->visited[v] == TRUE)
nvisit++;
VERIFY(skip, (max_attrs / 2), "H5Aiterate1");
- } /* end else */
+ } /* end else */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/* Iterate over attributes on object, stopping in the middle */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_cb, iter_info);
CHECK(ret, FAIL, "H5Aiterate2");
VERIFY(ret, CORDER_ITER_STOP, "H5Aiterate2");
VERIFY(iter_info->ncalled, 3, "H5Aiterate2");
-
/* Iterate over attributes on object, stopping in the middle */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aiterate_by_name");
VERIFY(ret, CORDER_ITER_STOP, "H5Aiterate_by_name");
VERIFY(iter_info->ncalled, 3, "H5Aiterate_by_name");
-
/* Iterate over attributes on object, stopping in the middle */
iter_info->nskipped = (unsigned)(skip = 0);
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_cb, iter_info, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aiterate_by_name");
VERIFY(ret, CORDER_ITER_STOP, "H5Aiterate_by_name");
VERIFY(iter_info->ncalled, 3, "H5Aiterate_by_name");
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over attributes on object, stopping in the middle, with H5Aiterate1() */
iter_info->nskipped = oskip = 0;
- iter_info->order = order;
- iter_info->stop = 3;
- iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_attrs - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
ret = H5Aiterate1(obj_id, &oskip, attr_iterate1_cb, iter_info);
CHECK(ret, FAIL, "H5Aiterate1");
@@ -7140,10 +7107,9 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id,
VERIFY(iter_info->ncalled, 3, "H5Aiterate1");
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/* Check for iteration routine indicating failure */
skip = 0;
- ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_fail_cb, NULL);
+ ret = H5Aiterate2(obj_id, idx_type, order, &skip, attr_iterate2_fail_cb, NULL);
VERIFY(ret, FAIL, "H5Aiterate2");
skip = 0;
@@ -7151,17 +7117,16 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id,
VERIFY(ret, FAIL, "H5Aiterate_by_name");
skip = 0;
- ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_fail_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate_by_name(obj_id, ".", idx_type, order, &skip, attr_iterate2_fail_cb, NULL, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aiterate_by_name");
/* Retrieve current # of errors */
- if(old_nerrs == GetTestNumErrs())
- return(0);
+ if (old_nerrs == GetTestNumErrs())
+ return (0);
else
- return(-1);
+ return (-1);
} /* end attr_iterate_check() */
-
/****************************************************************
**
** test_attr_iterate2(): Test basic H5A (attribute) code.
@@ -7171,30 +7136,30 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id,
static void
test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- attr_iter_info_t iter_info; /* Iterator info */
- hbool_t *visited = NULL; /* Array of flags for visiting links */
- hsize_t idx; /* Start index for iteration */
- unsigned use_index; /* Use index on creation order values */
- const char *dsetname; /* Name of dataset for attributes */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ attr_iter_info_t iter_info; /* Iterator info */
+ hbool_t * visited = NULL; /* Array of flags for visiting links */
+ hsize_t idx; /* Start index for iteration */
+ unsigned use_index; /* Use index on creation order values */
+ const char * dsetname; /* Name of dataset for attributes */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -7204,7 +7169,8 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -7215,53 +7181,62 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Allocate the "visited link" array */
iter_info.max_visit = max_compact * 2;
- visited = (hbool_t*)HDmalloc(sizeof(hbool_t) * iter_info.max_visit);
+ visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit);
CHECK_PTR(visited, "HDmalloc");
iter_info.visited = visited;
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in Increasing Order w/Creation Order Index\n"))
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in "
+ "Increasing Order w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in Increasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in "
+ "Increasing Order w/o Creation Order Index\n"))
} /* end if */
else {
- if(use_index)
- MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in Decreasing Order w/Creation Order Index\n"))
+ if (use_index)
+ MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in "
+ "Decreasing Order w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in Decreasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Iterating over Attributes By Creation Order Index in "
+ "Decreasing Order w/o Creation Order Index\n"))
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
- MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Increasing Order w/Creation Order Index\n"))
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Increasing Order "
+ "w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Increasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Increasing Order "
+ "w/o Creation Order Index\n"))
} /* end if */
else {
- if(use_index)
- MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order w/Creation Order Index\n"))
+ if (use_index)
+ MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order "
+ "w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Iterating over Attributes By Name Index in Decreasing Order "
+ "w/o Creation Order Index\n"))
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- if(new_format == TRUE) {
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ if (new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(
+ dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
CHECK(ret, FAIL, "H5Pset_attr_creation_order");
} /* end if */
@@ -7274,21 +7249,21 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
- dsetname = DSET1_NAME;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
- dsetname = DSET2_NAME;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
- dsetname = DSET3_NAME;
+ dsetname = DSET3_NAME;
break;
default:
@@ -7305,17 +7280,20 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = H5Aiterate2(my_dataset, idx_type, order, NULL, attr_iterate2_cb, NULL);
CHECK(ret, FAIL, "H5Aiterate2");
- ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, NULL, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, NULL, attr_iterate2_cb, NULL,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aiterate_by_name");
- ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, NULL, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, NULL, attr_iterate2_cb, NULL,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aiterate_by_name");
/* Create attributes, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
- attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -7346,11 +7324,13 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(ret, FAIL, "H5Aiterate2");
idx = u;
- ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL,
+ H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aiterate_by_name");
idx = u;
- ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL,
+ H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aiterate_by_name");
/* Test iteration over attributes stored compactly */
@@ -7358,23 +7338,22 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "attr_iterate_check");
} /* end for */
-
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
- dsetname = DSET1_NAME;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
- dsetname = DSET2_NAME;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
- dsetname = DSET3_NAME;
+ dsetname = DSET3_NAME;
break;
default:
@@ -7382,10 +7361,11 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Create more attributes, to push into dense form */
- for(u = max_compact; u < (max_compact * 2); u++) {
+ for (u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
- attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -7397,7 +7377,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Verify state of object */
- if(u >= max_compact) {
+ if (u >= max_compact) {
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
} /* end if */
@@ -7416,11 +7396,11 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
- if(new_format) {
+ if (new_format) {
/* Retrieve & verify # of records in the name & creation order indices */
ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count);
CHECK(ret, FAIL, "H5O__attr_dense_info_test");
- if(use_index)
+ if (use_index)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test");
} /* end if */
@@ -7431,11 +7411,13 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(ret, FAIL, "H5Aiterate2");
idx = u;
- ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate_by_name(fid, dsetname, idx_type, order, &idx, attr_iterate2_cb, NULL,
+ H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aiterate_by_name");
idx = u;
- ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL, H5P_DEFAULT);
+ ret = H5Aiterate_by_name(my_dataset, ".", idx_type, order, &idx, attr_iterate2_cb, NULL,
+ H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aiterate_by_name");
/* Test iteration over attributes stored densely */
@@ -7455,8 +7437,8 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close property list */
ret = H5Pclose(dcpl);
@@ -7468,8 +7450,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Free the "visited link" array */
HDfree(visited);
-} /* test_attr_iterate2() */
-
+} /* test_attr_iterate2() */
/*-------------------------------------------------------------------------
* Function: attr_open_by_idx_check
@@ -7485,20 +7466,19 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
- unsigned max_attrs)
+attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, unsigned max_attrs)
{
- hid_t attr_id; /* ID of attribute to test */
- H5A_info_t ainfo; /* Attribute info */
- int old_nerrs; /* Number of errors when entering this check */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t attr_id; /* ID of attribute to test */
+ H5A_info_t ainfo; /* Attribute info */
+ int old_nerrs; /* Number of errors when entering this check */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
/* Open each attribute on object by index and check that it's the correct one */
- for(u = 0; u < max_attrs; u++) {
+ for (u = 0; u < max_attrs; u++) {
/* Open the attribute */
attr_id = H5Aopen_by_idx(obj_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen_by_idx");
@@ -7508,10 +7488,10 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
CHECK(ret, FAIL, "H5Aget_info");
/* Check that the object is the correct one */
- if(order == H5_ITER_INC) {
+ if (order == H5_ITER_INC) {
VERIFY(ainfo.corder, u, "H5Aget_info");
} /* end if */
- else if(order == H5_ITER_DEC) {
+ else if (order == H5_ITER_DEC) {
VERIFY(ainfo.corder, (max_attrs - (u + 1)), "H5Aget_info");
} /* end if */
else {
@@ -7524,13 +7504,12 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
} /* end for */
/* Retrieve current # of errors */
- if(old_nerrs == GetTestNumErrs())
- return(0);
+ if (old_nerrs == GetTestNumErrs())
+ return (0);
else
- return(-1);
+ return (-1);
} /* end attr_open_by_idx_check() */
-
/****************************************************************
**
** test_attr_open_by_idx(): Test basic H5A (attribute) code.
@@ -7540,27 +7519,27 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
static void
test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- H5_index_t idx_type; /* Type of index to operate on */
- H5_iter_order_t order; /* Order within in the index */
- unsigned use_index; /* Use index on creation order values */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -7570,7 +7549,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -7580,48 +7560,57 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ for (idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
+ for (order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(idx_type == H5_INDEX_CRT_ORDER) {
- if(order == H5_ITER_INC) {
- if(use_index)
- MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Increasing Order w/Creation Order Index\n"))
+ if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Increasing "
+ "Order w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Increasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Increasing "
+ "Order w/o Creation Order Index\n"))
} /* end if */
else {
- if(use_index)
- MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Decreasing Order w/Creation Order Index\n"))
+ if (use_index)
+ MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Decreasing "
+ "Order w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Decreasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Opening Attributes By Creation Order Index in Decreasing "
+ "Order w/o Creation Order Index\n"))
} /* end else */
- } /* end if */
+ } /* end if */
else {
- if(order == H5_ITER_INC) {
- if(use_index)
- MESSAGE(5, ("Testing Opening Attributes By Name Index in Increasing Order w/Creation Order Index\n"))
+ if (order == H5_ITER_INC) {
+ if (use_index)
+ MESSAGE(5, ("Testing Opening Attributes By Name Index in Increasing Order "
+ "w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Opening Attributes By Name Index in Increasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Opening Attributes By Name Index in Increasing Order w/o "
+ "Creation Order Index\n"))
} /* end if */
else {
- if(use_index)
- MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order w/Creation Order Index\n"))
+ if (use_index)
+ MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order "
+ "w/Creation Order Index\n"))
else
- MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order w/o Creation Order Index\n"))
+ MESSAGE(5, ("Testing Opening Attributes By Name Index in Decreasing Order w/o "
+ "Creation Order Index\n"))
} /* end else */
- } /* end else */
+ } /* end else */
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- if(new_format == TRUE) {
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ if (new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(
+ dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
CHECK(ret, FAIL, "H5Pset_attr_creation_order");
} /* end if */
@@ -7634,8 +7623,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -7659,14 +7648,16 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Check for opening an attribute on an object with no attributes */
- ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
+ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT,
+ H5P_DEFAULT);
VERIFY(ret_id, FAIL, "H5Aopen_by_idx");
/* Create attributes, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
- attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -7692,7 +7683,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Check for out of bound opening an attribute on an object */
- ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
+ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT,
+ H5P_DEFAULT);
VERIFY(ret_id, FAIL, "H5Aopen_by_idx");
/* Test opening attributes by index stored compactly */
@@ -7700,10 +7692,9 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "attr_open_by_idx_check");
} /* end for */
-
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
break;
@@ -7721,10 +7712,11 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Create more attributes, to push into dense form */
- for(u = max_compact; u < (max_compact * 2); u++) {
+ for (u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
- attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ attr =
+ H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
@@ -7736,7 +7728,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Verify state of object */
- if(u >= max_compact) {
+ if (u >= max_compact) {
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
} /* end if */
@@ -7755,17 +7747,18 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
- if(new_format) {
+ if (new_format) {
/* Retrieve & verify # of records in the name & creation order indices */
ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count);
CHECK(ret, FAIL, "H5O__attr_dense_info_test");
- if(use_index)
+ if (use_index)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test");
} /* end if */
/* Check for out of bound opening an attribute on an object */
- ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
+ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT,
+ H5P_DEFAULT);
VERIFY(ret_id, FAIL, "H5Aopen_by_idx");
/* Test opening attributes by index stored compactly */
@@ -7785,8 +7778,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close property list */
ret = H5Pclose(dcpl);
@@ -7795,8 +7788,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_open_by_idx() */
-
+} /* test_attr_open_by_idx() */
/*-------------------------------------------------------------------------
* Function: attr_open_check
@@ -7812,21 +7804,20 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
- unsigned max_attrs)
+attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, unsigned max_attrs)
{
- hid_t attr_id; /* ID of attribute to test */
- H5A_info_t ainfo; /* Attribute info */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- int old_nerrs; /* Number of errors when entering this check */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t attr_id; /* ID of attribute to test */
+ H5A_info_t ainfo; /* Attribute info */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ int old_nerrs; /* Number of errors when entering this check */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
/* Open each attribute on object by index and check that it's the correct one */
- for(u = 0; u < max_attrs; u++) {
+ for (u = 0; u < max_attrs; u++) {
/* Open the attribute */
HDsprintf(attrname, "attr %02u", u);
attr_id = H5Aopen(obj_id, attrname, H5P_DEFAULT);
@@ -7843,7 +7834,6 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
-
/* Open the attribute */
attr_id = H5Aopen_by_name(obj_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen_by_name");
@@ -7859,7 +7849,6 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
-
/* Open the attribute */
attr_id = H5Aopen_by_name(fid, dsetname, attrname, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen_by_name");
@@ -7877,13 +7866,12 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
} /* end for */
/* Retrieve current # of errors */
- if(old_nerrs == GetTestNumErrs())
- return(0);
+ if (old_nerrs == GetTestNumErrs())
+ return (0);
else
- return(-1);
+ return (-1);
} /* end attr_open_check() */
-
/****************************************************************
**
** test_attr_open_by_name(): Test basic H5A (attribute) code.
@@ -7893,26 +7881,26 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
static void
test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- unsigned use_index; /* Use index on creation order values */
- const char *dsetname; /* Name of dataset for attributes */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ unsigned use_index; /* Use index on creation order values */
+ const char *dsetname; /* Name of dataset for attributes */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -7922,7 +7910,8 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -7932,9 +7921,9 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(use_index)
+ if (use_index)
MESSAGE(5, ("Testing Opening Attributes By Name w/Creation Order Index\n"))
else
MESSAGE(5, ("Testing Opening Attributes By Name w/o Creation Order Index\n"))
@@ -7944,8 +7933,9 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- if(new_format == TRUE) {
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ if (new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(
+ dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
CHECK(ret, FAIL, "H5Pset_attr_creation_order");
} /* end if */
@@ -7958,21 +7948,21 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
- dsetname = DSET1_NAME;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
- dsetname = DSET2_NAME;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
- dsetname = DSET3_NAME;
+ dsetname = DSET3_NAME;
break;
default:
@@ -7996,7 +7986,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(ret_id, FAIL, "H5Aopen_by_name");
/* Create attributes, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -8039,23 +8029,22 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "attr_open_check");
} /* end for */
-
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
- dsetname = DSET1_NAME;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
- dsetname = DSET2_NAME;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
- dsetname = DSET3_NAME;
+ dsetname = DSET3_NAME;
break;
default:
@@ -8063,7 +8052,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Create more attributes, to push into dense form */
- for(u = max_compact; u < (max_compact * 2); u++) {
+ for (u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -8078,7 +8067,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Verify state of object */
- if(u >= max_compact) {
+ if (u >= max_compact) {
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
} /* end if */
@@ -8097,11 +8086,11 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
- if(new_format) {
+ if (new_format) {
/* Retrieve & verify # of records in the name & creation order indices */
ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count);
CHECK(ret, FAIL, "H5O__attr_dense_info_test");
- if(use_index)
+ if (use_index)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test");
} /* end if */
@@ -8141,8 +8130,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_open_by_name() */
-
+} /* test_attr_open_by_name() */
/****************************************************************
**
@@ -8153,25 +8141,25 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
static void
test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- hsize_t nattrs; /* Number of attributes on object */
- hsize_t name_count; /* # of records in name index */
- hsize_t corder_count; /* # of records in creation order index */
- unsigned use_index; /* Use index on creation order values */
- const char *dsetname; /* Name of dataset for attributes */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned curr_dset; /* Current dataset to work on */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ hsize_t nattrs; /* Number of attributes on object */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ unsigned use_index; /* Use index on creation order values */
+ const char *dsetname; /* Name of dataset for attributes */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned curr_dset; /* Current dataset to work on */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -8181,7 +8169,8 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -8191,9 +8180,9 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Loop over using index for creation order value */
- for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ for (use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
- if(use_index)
+ if (use_index)
MESSAGE(5, ("Testing Creating Attributes By Name w/Creation Order Index\n"))
else
MESSAGE(5, ("Testing Creating Attributes By Name w/o Creation Order Index\n"))
@@ -8203,8 +8192,9 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- if(new_format == TRUE) {
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ if (new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(
+ dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
CHECK(ret, FAIL, "H5Pset_attr_creation_order");
} /* end if */
@@ -8217,21 +8207,21 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(dset3, FAIL, "H5Dcreate2");
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
- dsetname = DSET1_NAME;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
- dsetname = DSET2_NAME;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
- dsetname = DSET3_NAME;
+ dsetname = DSET3_NAME;
break;
default:
@@ -8245,10 +8235,11 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Create attributes, up to limit of compact form */
- for(u = 0; u < max_compact; u++) {
+ for (u = 0; u < max_compact; u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
- attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate_by_name");
/* Write data into the attribute */
@@ -8278,23 +8269,22 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "attr_open_check");
} /* end for */
-
/* Work on all the datasets */
- for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
- switch(curr_dset) {
+ for (curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) {
+ switch (curr_dset) {
case 0:
my_dataset = dset1;
- dsetname = DSET1_NAME;
+ dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
- dsetname = DSET2_NAME;
+ dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
- dsetname = DSET3_NAME;
+ dsetname = DSET3_NAME;
break;
default:
@@ -8302,10 +8292,11 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end switch */
/* Create more attributes, to push into dense form */
- for(u = max_compact; u < (max_compact * 2); u++) {
+ for (u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
HDsprintf(attrname, "attr %02u", u);
- attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate_by_name");
/* Write data into the attribute */
@@ -8317,7 +8308,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Verify state of object */
- if(u >= max_compact) {
+ if (u >= max_compact) {
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
} /* end if */
@@ -8336,11 +8327,11 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
is_dense = H5O__is_attr_dense_test(my_dataset);
VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test");
- if(new_format) {
+ if (new_format) {
/* Retrieve & verify # of records in the name & creation order indices */
ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count);
CHECK(ret, FAIL, "H5O__attr_dense_info_test");
- if(use_index)
+ if (use_index)
VERIFY(name_count, corder_count, "H5O__attr_dense_info_test");
VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test");
} /* end if */
@@ -8370,7 +8361,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_create_by_name() */
+} /* test_attr_create_by_name() */
/****************************************************************
**
@@ -8381,28 +8372,28 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
static void
test_attr_shared_write(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t my_fcpl; /* File creation property list ID */
- hid_t dataset, dataset2; /* Dataset IDs */
- hid_t attr_tid; /* Attribute's datatype ID */
- hid_t sid, big_sid; /* Dataspace IDs */
- hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- htri_t is_shared; /* Is attributes shared? */
- hsize_t shared_refcount; /* Reference count of shared attribute */
- unsigned attr_value; /* Attribute value */
- unsigned *big_value; /* Data for "big" attribute */
- size_t mesg_count; /* # of shared messages */
- unsigned test_shared; /* Index over shared component type */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t my_fcpl; /* File creation property list ID */
+ hid_t dataset, dataset2; /* Dataset IDs */
+ hid_t attr_tid; /* Attribute's datatype ID */
+ hid_t sid, big_sid; /* Dataspace IDs */
+ hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_shared; /* Is attributes shared? */
+ hsize_t shared_refcount; /* Reference count of shared attribute */
+ unsigned attr_value; /* Attribute value */
+ unsigned * big_value; /* Data for "big" attribute */
+ size_t mesg_count; /* # of shared messages */
+ unsigned test_shared; /* Index over shared component type */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Writing Shared & Unshared Attributes in Compact & Dense Storage\n"));
@@ -8421,7 +8412,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
CHECK(big_sid, FAIL, "H5Screate_simple");
/* Loop over type of shared components */
- for(test_shared = 0; test_shared < 3; test_shared++) {
+ for (test_shared = 0; test_shared < 3; test_shared++) {
/* Make copy of file creation property list */
my_fcpl = H5Pcopy(fcpl);
CHECK(my_fcpl, FAIL, "H5Pcopy");
@@ -8431,7 +8422,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
CHECK(attr_tid, FAIL, "H5Tcopy");
/* Special setup for each type of shared components */
- if(test_shared == 0) {
+ if (test_shared == 0) {
/* Make attributes > 500 bytes shared */
ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
@@ -8469,16 +8460,15 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
/* Commit datatype to file */
- if(test_shared == 2) {
+ if (test_shared == 2) {
ret = H5Tcommit2(fid, TYPE1_NAME, attr_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
} /* end if */
@@ -8487,7 +8477,8 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -8499,7 +8490,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
CHECK(dataset2, FAIL, "H5Dcreate2");
/* Check on dataset's message storage status */
- if(test_shared != 0) {
+ if (test_shared != 0) {
/* Datasets' datatypes can be shared */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -8526,12 +8517,12 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes to each dataset, until after converting to dense storage */
- for(u = 0; u < max_compact * 2; u++) {
+ for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
HDsprintf(attrname, "attr %02u", u);
/* Alternate between creating "small" & "big" attributes */
- if(u % 2) {
+ if (u % 2) {
/* Create "small" attribute on first dataset */
attr = H5Acreate2(dataset, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -8542,7 +8533,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
attr_value = u + 1;
- ret = H5Awrite(attr, attr_tid, &attr_value);
+ ret = H5Awrite(attr, attr_tid, &attr_value);
CHECK(ret, FAIL, "H5Awrite");
} /* end if */
else {
@@ -8561,7 +8552,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
big_value[0] = u + 1;
- ret = H5Awrite(attr, attr_tid, big_value);
+ ret = H5Awrite(attr, attr_tid, big_value);
CHECK(ret, FAIL, "H5Awrite");
/* Check refcount for attribute */
@@ -8576,14 +8567,13 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Check on dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset);
- if(u < max_compact)
+ if (u < max_compact)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
else
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
-
/* Alternate between creating "small" & "big" attributes */
- if(u % 2) {
+ if (u % 2) {
/* Create "small" attribute on second dataset */
attr = H5Acreate2(dataset2, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -8594,7 +8584,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
attr_value = u + 1;
- ret = H5Awrite(attr, attr_tid, &attr_value);
+ ret = H5Awrite(attr, attr_tid, &attr_value);
CHECK(ret, FAIL, "H5Awrite");
} /* end if */
else {
@@ -8613,7 +8603,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
big_value[0] = u + 1;
- ret = H5Awrite(attr, attr_tid, big_value);
+ ret = H5Awrite(attr, attr_tid, big_value);
CHECK(ret, FAIL, "H5Awrite");
/* Check refcount for attribute */
@@ -8628,7 +8618,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Check on dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset2);
- if(u < max_compact)
+ if (u < max_compact)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
else
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
@@ -8645,8 +8635,8 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Dclose");
/* Check on shared message status now */
- if(test_shared != 0) {
- if(test_shared == 1) {
+ if (test_shared != 0) {
+ if (test_shared == 1) {
/* Check on datatype storage status */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -8666,7 +8656,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Ldelete");
/* Unlink committed datatype */
- if(test_shared == 2) {
+ if (test_shared == 2) {
ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
} /* end if */
@@ -8676,7 +8666,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test");
- if(test_shared != 0) {
+ if (test_shared != 0) {
/* Check on datatype storage status */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -8705,7 +8695,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Release memory */
HDfree(big_value);
-} /* test_attr_shared_write() */
+} /* test_attr_shared_write() */
/****************************************************************
**
@@ -8716,29 +8706,29 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
static void
test_attr_shared_rename(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t my_fcpl; /* File creation property list ID */
- hid_t dataset, dataset2; /* Dataset ID2 */
- hid_t attr_tid; /* Attribute's datatype ID */
- hid_t sid, big_sid; /* Dataspace IDs */
- hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
- char attrname2[NAME_BUF_SIZE]; /* Name of attribute on second dataset */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- htri_t is_shared; /* Is attributes shared? */
- hsize_t shared_refcount; /* Reference count of shared attribute */
- unsigned attr_value; /* Attribute value */
- unsigned *big_value; /* Data for "big" attribute */
- size_t mesg_count; /* # of shared messages */
- unsigned test_shared; /* Index over shared component type */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t my_fcpl; /* File creation property list ID */
+ hid_t dataset, dataset2; /* Dataset ID2 */
+ hid_t attr_tid; /* Attribute's datatype ID */
+ hid_t sid, big_sid; /* Dataspace IDs */
+ hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
+ char attrname2[NAME_BUF_SIZE]; /* Name of attribute on second dataset */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_shared; /* Is attributes shared? */
+ hsize_t shared_refcount; /* Reference count of shared attribute */
+ unsigned attr_value; /* Attribute value */
+ unsigned * big_value; /* Data for "big" attribute */
+ size_t mesg_count; /* # of shared messages */
+ unsigned test_shared; /* Index over shared component type */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Renaming Shared & Unshared Attributes in Compact & Dense Storage\n"));
@@ -8757,7 +8747,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(big_sid, FAIL, "H5Screate_simple");
/* Loop over type of shared components */
- for(test_shared = 0; test_shared < 3; test_shared++) {
+ for (test_shared = 0; test_shared < 3; test_shared++) {
/* Make copy of file creation property list */
my_fcpl = H5Pcopy(fcpl);
CHECK(my_fcpl, FAIL, "H5Pcopy");
@@ -8767,7 +8757,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(attr_tid, FAIL, "H5Tcopy");
/* Special setup for each type of shared components */
- if(test_shared == 0) {
+ if (test_shared == 0) {
/* Make attributes > 500 bytes shared */
ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
@@ -8805,16 +8795,15 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
/* Commit datatype to file */
- if(test_shared == 2) {
+ if (test_shared == 2) {
ret = H5Tcommit2(fid, TYPE1_NAME, attr_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
} /* end if */
@@ -8823,7 +8812,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -8835,7 +8825,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(dataset2, FAIL, "H5Dcreate2");
/* Check on dataset's message storage status */
- if(test_shared != 0) {
+ if (test_shared != 0) {
/* Datasets' datatypes can be shared */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -8862,12 +8852,12 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes to each dataset, until after converting to dense storage */
- for(u = 0; u < max_compact * 2; u++) {
+ for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
HDsprintf(attrname, "attr %02u", u);
/* Alternate between creating "small" & "big" attributes */
- if(u % 2) {
+ if (u % 2) {
/* Create "small" attribute on first dataset */
attr = H5Acreate2(dataset, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -8878,7 +8868,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
attr_value = u + 1;
- ret = H5Awrite(attr, attr_tid, &attr_value);
+ ret = H5Awrite(attr, attr_tid, &attr_value);
CHECK(ret, FAIL, "H5Awrite");
} /* end if */
else {
@@ -8897,7 +8887,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
big_value[0] = u + 1;
- ret = H5Awrite(attr, attr_tid, big_value);
+ ret = H5Awrite(attr, attr_tid, big_value);
CHECK(ret, FAIL, "H5Awrite");
/* Check refcount for attribute */
@@ -8912,14 +8902,13 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Check on dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset);
- if(u < max_compact)
+ if (u < max_compact)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
else
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
-
/* Alternate between creating "small" & "big" attributes */
- if(u % 2) {
+ if (u % 2) {
/* Create "small" attribute on second dataset */
attr = H5Acreate2(dataset2, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -8930,7 +8919,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
attr_value = u + 1;
- ret = H5Awrite(attr, attr_tid, &attr_value);
+ ret = H5Awrite(attr, attr_tid, &attr_value);
CHECK(ret, FAIL, "H5Awrite");
} /* end if */
else {
@@ -8949,7 +8938,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
big_value[0] = u + 1;
- ret = H5Awrite(attr, attr_tid, big_value);
+ ret = H5Awrite(attr, attr_tid, big_value);
CHECK(ret, FAIL, "H5Awrite");
/* Check refcount for attribute */
@@ -8964,12 +8953,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Check on dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset2);
- if(u < max_compact)
+ if (u < max_compact)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
else
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
-
/* Create new attribute name */
HDsprintf(attrname2, "new attr %02u", u);
@@ -8977,14 +8965,13 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
ret = H5Arename_by_name(fid, DSET2_NAME, attrname, attrname2, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Arename_by_name");
-
/* Check refcount on attributes now */
/* Check refcount on renamed attribute */
attr = H5Aopen(dataset2, attrname2, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
- if(u % 2) {
+ if (u % 2) {
/* Check that attribute is not shared */
is_shared = H5A__is_shared_test(attr);
VERIFY(is_shared, FALSE, "H5A__is_shared_test");
@@ -9008,7 +8995,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
- if(u % 2) {
+ if (u % 2) {
/* Check that attribute is not shared */
is_shared = H5A__is_shared_test(attr);
VERIFY(is_shared, FALSE, "H5A__is_shared_test");
@@ -9028,19 +9015,17 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
-
/* Change second dataset's attribute's name back to original */
ret = H5Arename_by_name(fid, DSET2_NAME, attrname2, attrname, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Arename_by_name");
-
/* Check refcount on attributes now */
/* Check refcount on renamed attribute */
attr = H5Aopen(dataset2, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
- if(u % 2) {
+ if (u % 2) {
/* Check that attribute is not shared */
is_shared = H5A__is_shared_test(attr);
VERIFY(is_shared, FALSE, "H5A__is_shared_test");
@@ -9064,7 +9049,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
- if(u % 2) {
+ if (u % 2) {
/* Check that attribute is not shared */
is_shared = H5A__is_shared_test(attr);
VERIFY(is_shared, FALSE, "H5A__is_shared_test");
@@ -9085,7 +9070,6 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
} /* end for */
-
/* Close attribute's datatype */
ret = H5Tclose(attr_tid);
CHECK(ret, FAIL, "H5Tclose");
@@ -9097,8 +9081,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Dclose");
/* Check on shared message status now */
- if(test_shared != 0) {
- if(test_shared == 1) {
+ if (test_shared != 0) {
+ if (test_shared == 1) {
/* Check on datatype storage status */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -9118,7 +9102,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Ldelete");
/* Unlink committed datatype */
- if(test_shared == 2) {
+ if (test_shared == 2) {
ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
} /* end if */
@@ -9128,7 +9112,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test");
- if(test_shared != 0) {
+ if (test_shared != 0) {
/* Check on datatype storage status */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -9157,7 +9141,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Release memory */
HDfree(big_value);
-} /* test_attr_shared_rename() */
+} /* test_attr_shared_rename() */
/****************************************************************
**
@@ -9168,28 +9152,28 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
static void
test_attr_shared_delete(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t my_fcpl; /* File creation property list ID */
- hid_t dataset, dataset2; /* Dataset IDs */
- hid_t attr_tid; /* Attribute's datatype ID */
- hid_t sid, big_sid; /* Dataspace IDs */
- hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- htri_t is_shared; /* Is attributes shared? */
- hsize_t shared_refcount; /* Reference count of shared attribute */
- unsigned attr_value; /* Attribute value */
- unsigned *big_value; /* Data for "big" attribute */
- size_t mesg_count; /* # of shared messages */
- unsigned test_shared; /* Index over shared component type */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t my_fcpl; /* File creation property list ID */
+ hid_t dataset, dataset2; /* Dataset IDs */
+ hid_t attr_tid; /* Attribute's datatype ID */
+ hid_t sid, big_sid; /* Dataspace IDs */
+ hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_shared; /* Is attributes shared? */
+ hsize_t shared_refcount; /* Reference count of shared attribute */
+ unsigned attr_value; /* Attribute value */
+ unsigned * big_value; /* Data for "big" attribute */
+ size_t mesg_count; /* # of shared messages */
+ unsigned test_shared; /* Index over shared component type */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deleting Shared & Unshared Attributes in Compact & Dense Storage\n"));
@@ -9208,7 +9192,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
CHECK(big_sid, FAIL, "H5Screate_simple");
/* Loop over type of shared components */
- for(test_shared = 0; test_shared < 3; test_shared++) {
+ for (test_shared = 0; test_shared < 3; test_shared++) {
/* Make copy of file creation property list */
my_fcpl = H5Pcopy(fcpl);
CHECK(my_fcpl, FAIL, "H5Pcopy");
@@ -9218,7 +9202,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
CHECK(attr_tid, FAIL, "H5Tcopy");
/* Special setup for each type of shared components */
- if(test_shared == 0) {
+ if (test_shared == 0) {
/* Make attributes > 500 bytes shared */
ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
@@ -9256,16 +9240,15 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
/* Commit datatype to file */
- if(test_shared == 2) {
+ if (test_shared == 2) {
ret = H5Tcommit2(fid, TYPE1_NAME, attr_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
} /* end if */
@@ -9274,7 +9257,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -9286,7 +9270,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
CHECK(dataset2, FAIL, "H5Dcreate2");
/* Check on dataset's message storage status */
- if(test_shared != 0) {
+ if (test_shared != 0) {
/* Datasets' datatypes can be shared */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -9313,12 +9297,12 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes to each dataset, until after converting to dense storage */
- for(u = 0; u < max_compact * 2; u++) {
+ for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
HDsprintf(attrname, "attr %02u", u);
/* Alternate between creating "small" & "big" attributes */
- if(u % 2) {
+ if (u % 2) {
/* Create "small" attribute on first dataset */
attr = H5Acreate2(dataset, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -9329,7 +9313,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
attr_value = u + 1;
- ret = H5Awrite(attr, attr_tid, &attr_value);
+ ret = H5Awrite(attr, attr_tid, &attr_value);
CHECK(ret, FAIL, "H5Awrite");
} /* end if */
else {
@@ -9348,7 +9332,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
big_value[0] = u + 1;
- ret = H5Awrite(attr, attr_tid, big_value);
+ ret = H5Awrite(attr, attr_tid, big_value);
CHECK(ret, FAIL, "H5Awrite");
/* Check refcount for attribute */
@@ -9363,14 +9347,13 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Check on dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset);
- if(u < max_compact)
+ if (u < max_compact)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
else
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
-
/* Alternate between creating "small" & "big" attributes */
- if(u % 2) {
+ if (u % 2) {
/* Create "small" attribute on second dataset */
attr = H5Acreate2(dataset2, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -9381,7 +9364,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
attr_value = u + 1;
- ret = H5Awrite(attr, attr_tid, &attr_value);
+ ret = H5Awrite(attr, attr_tid, &attr_value);
CHECK(ret, FAIL, "H5Awrite");
} /* end if */
else {
@@ -9400,7 +9383,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
big_value[0] = u + 1;
- ret = H5Awrite(attr, attr_tid, big_value);
+ ret = H5Awrite(attr, attr_tid, big_value);
CHECK(ret, FAIL, "H5Awrite");
/* Check refcount for attribute */
@@ -9415,15 +9398,14 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Check on dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset2);
- if(u < max_compact)
+ if (u < max_compact)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
else
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
} /* end for */
-
/* Delete attributes from second dataset */
- for(u = 0; u < max_compact * 2; u++) {
+ for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
HDsprintf(attrname, "attr %02u", u);
@@ -9431,14 +9413,13 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
ret = H5Adelete_by_name(fid, DSET2_NAME, attrname, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Adelete_by_name");
-
/* Check refcount on attributes now */
/* Check refcount on first dataset's attribute */
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
- if(u % 2) {
+ if (u % 2) {
/* Check that attribute is not shared */
is_shared = H5A__is_shared_test(attr);
VERIFY(is_shared, FALSE, "H5A__is_shared_test");
@@ -9459,7 +9440,6 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
} /* end for */
-
/* Close attribute's datatype */
ret = H5Tclose(attr_tid);
CHECK(ret, FAIL, "H5Tclose");
@@ -9471,8 +9451,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Dclose");
/* Check on shared message status now */
- if(test_shared != 0) {
- if(test_shared == 1) {
+ if (test_shared != 0) {
+ if (test_shared == 1) {
/* Check on datatype storage status */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -9492,7 +9472,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Ldelete");
/* Unlink committed datatype */
- if(test_shared == 2) {
+ if (test_shared == 2) {
ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
} /* end if */
@@ -9502,7 +9482,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test");
- if(test_shared != 0) {
+ if (test_shared != 0) {
/* Check on datatype storage status */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -9531,7 +9511,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Release memory */
HDfree(big_value);
-} /* test_attr_shared_delete() */
+} /* test_attr_shared_delete() */
/****************************************************************
**
@@ -9542,28 +9522,28 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
static void
test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t my_fcpl; /* File creation property list ID */
- hid_t dataset, dataset2; /* Dataset IDs */
- hid_t attr_tid; /* Attribute's datatype ID */
- hid_t sid, big_sid; /* Dataspace IDs */
- hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
- unsigned max_compact; /* Maximum # of attributes to store compactly */
- unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- htri_t is_shared; /* Is attributes shared? */
- hsize_t shared_refcount; /* Reference count of shared attribute */
- unsigned attr_value; /* Attribute value */
- unsigned *big_value; /* Data for "big" attribute */
- size_t mesg_count; /* # of shared messages */
- unsigned test_shared; /* Index over shared component type */
- unsigned u; /* Local index variable */
- h5_stat_size_t empty_filesize; /* Size of empty file */
- h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t my_fcpl; /* File creation property list ID */
+ hid_t dataset, dataset2; /* Dataset IDs */
+ hid_t attr_tid; /* Attribute's datatype ID */
+ hid_t sid, big_sid; /* Dataspace IDs */
+ hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
+ unsigned max_compact; /* Maximum # of attributes to store compactly */
+ unsigned min_dense; /* Minimum # of attributes to store "densely" */
+ htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_shared; /* Is attributes shared? */
+ hsize_t shared_refcount; /* Reference count of shared attribute */
+ unsigned attr_value; /* Attribute value */
+ unsigned * big_value; /* Data for "big" attribute */
+ size_t mesg_count; /* # of shared messages */
+ unsigned test_shared; /* Index over shared component type */
+ unsigned u; /* Local index variable */
+ h5_stat_size_t empty_filesize; /* Size of empty file */
+ h5_stat_size_t filesize; /* Size of file after modifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Unlinking Object with Shared Attributes in Compact & Dense Storage\n"));
@@ -9582,7 +9562,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
CHECK(big_sid, FAIL, "H5Screate_simple");
/* Loop over type of shared components */
- for(test_shared = 0; test_shared < 3; test_shared++) {
+ for (test_shared = 0; test_shared < 3; test_shared++) {
/* Make copy of file creation property list */
my_fcpl = H5Pcopy(fcpl);
CHECK(my_fcpl, FAIL, "H5Pcopy");
@@ -9592,7 +9572,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
CHECK(attr_tid, FAIL, "H5Tcopy");
/* Special setup for each type of shared components */
- if(test_shared == 0) {
+ if (test_shared == 0) {
/* Make attributes > 500 bytes shared */
ret = H5Pset_shared_mesg_nindexes(my_fcpl, (unsigned)1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
@@ -9630,16 +9610,15 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Get size of file */
empty_filesize = h5_get_file_size(FILENAME, fapl);
- if(empty_filesize < 0)
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
/* Commit datatype to file */
- if(test_shared == 2) {
+ if (test_shared == 2) {
ret = H5Tcommit2(fid, TYPE1_NAME, attr_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
} /* end if */
@@ -9648,7 +9627,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
if (dcpl_g == H5P_DEFAULT) {
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- } else {
+ }
+ else {
dcpl = H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcopy");
}
@@ -9660,7 +9640,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
CHECK(dataset2, FAIL, "H5Dcreate2");
/* Check on dataset's message storage status */
- if(test_shared != 0) {
+ if (test_shared != 0) {
/* Datasets' datatypes can be shared */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -9687,12 +9667,12 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
/* Add attributes to each dataset, until after converting to dense storage */
- for(u = 0; u < max_compact * 2; u++) {
+ for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
HDsprintf(attrname, "attr %02u", u);
/* Alternate between creating "small" & "big" attributes */
- if(u % 2) {
+ if (u % 2) {
/* Create "small" attribute on first dataset */
attr = H5Acreate2(dataset, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -9703,7 +9683,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
attr_value = u + 1;
- ret = H5Awrite(attr, attr_tid, &attr_value);
+ ret = H5Awrite(attr, attr_tid, &attr_value);
CHECK(ret, FAIL, "H5Awrite");
} /* end if */
else {
@@ -9722,7 +9702,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
big_value[0] = u + 1;
- ret = H5Awrite(attr, attr_tid, big_value);
+ ret = H5Awrite(attr, attr_tid, big_value);
CHECK(ret, FAIL, "H5Awrite");
/* Check refcount for attribute */
@@ -9737,14 +9717,13 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Check on dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset);
- if(u < max_compact)
+ if (u < max_compact)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
else
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
-
/* Alternate between creating "small" & "big" attributes */
- if(u % 2) {
+ if (u % 2) {
/* Create "small" attribute on second dataset */
attr = H5Acreate2(dataset2, attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -9755,7 +9734,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
attr_value = u + 1;
- ret = H5Awrite(attr, attr_tid, &attr_value);
+ ret = H5Awrite(attr, attr_tid, &attr_value);
CHECK(ret, FAIL, "H5Awrite");
} /* end if */
else {
@@ -9774,7 +9753,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Write data into the attribute */
big_value[0] = u + 1;
- ret = H5Awrite(attr, attr_tid, big_value);
+ ret = H5Awrite(attr, attr_tid, big_value);
CHECK(ret, FAIL, "H5Awrite");
/* Check refcount for attribute */
@@ -9789,13 +9768,12 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Check on dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset2);
- if(u < max_compact)
+ if (u < max_compact)
VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test");
else
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
} /* end for */
-
/* Close attribute's datatype */
ret = H5Tclose(attr_tid);
CHECK(ret, FAIL, "H5Tclose");
@@ -9808,13 +9786,12 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
-
/* Check on first dataset's attribute storage status */
is_dense = H5O__is_attr_dense_test(dataset);
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
/* Check ref count on attributes of first dataset */
- for(u = 0; u < max_compact * 2; u++) {
+ for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
HDsprintf(attrname, "attr %02u", u);
@@ -9822,7 +9799,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
- if(u % 2) {
+ if (u % 2) {
/* Check that attribute is not shared */
is_shared = H5A__is_shared_test(attr);
VERIFY(is_shared, FALSE, "H5A__is_shared_test");
@@ -9852,7 +9829,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Ldelete");
/* Unlink committed datatype */
- if(test_shared == 2) {
+ if (test_shared == 2) {
ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
} /* end if */
@@ -9862,7 +9839,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test");
- if(test_shared != 0) {
+ if (test_shared != 0) {
/* Check on datatype storage status */
ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count);
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
@@ -9891,7 +9868,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Release memory */
HDfree(big_value);
-} /* test_attr_shared_unlink() */
+} /* test_attr_shared_unlink() */
/****************************************************************
**
@@ -9907,11 +9884,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
static void
test_attr_bug1(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
- hid_t aid; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- herr_t ret; /* Generic return status */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ herr_t ret; /* Generic return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing Allocating and De-allocating Attributes in Unusual Way\n"));
@@ -9933,7 +9910,6 @@ test_attr_bug1(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file and create another group, then attribute on first group */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -9962,7 +9938,6 @@ test_attr_bug1(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file and create another group, then another attribute on first group */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -9995,7 +9970,6 @@ test_attr_bug1(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file and re-create attributes on first group */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid, FAIL, "H5Fopen");
@@ -10032,11 +10006,10 @@ test_attr_bug1(hid_t fcpl, hid_t fapl)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Close dataspace ID */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Gclose");
-} /* test_attr_bug1() */
+} /* test_attr_bug1() */
/****************************************************************
**
@@ -10052,17 +10025,17 @@ test_attr_bug1(hid_t fcpl, hid_t fapl)
static void
test_attr_bug2(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
- hid_t aid; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hid_t gcpl; /* Group creation property list */
- hsize_t dims[2] = {10, 100}; /* Attribute dimensions */
- char aname[16]; /* Attribute name */
- unsigned i; /* index */
- herr_t ret; /* Generic return status */
- htri_t tri_ret; /* htri_t return status */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hid_t gcpl; /* Group creation property list */
+ hsize_t dims[2] = {10, 100}; /* Attribute dimensions */
+ char aname[16]; /* Attribute name */
+ unsigned i; /* index */
+ herr_t ret; /* Generic return status */
+ htri_t tri_ret; /* htri_t return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing Allocating and De-allocating Attributes in Unusual Way\n"));
@@ -10075,7 +10048,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl)
/* Not doing this with the latest format actually triggers a different bug.
* This will be tested here as soon as it is fixed. -NAF
*/
- ret = H5Pset_attr_phase_change (gcpl, BUG2_NATTR+10, BUG2_NATTR+5);
+ ret = H5Pset_attr_phase_change(gcpl, BUG2_NATTR + 10, BUG2_NATTR + 5);
CHECK(ret, FAIL, "H5Pset_attr_phase_change");
/* Create dataspace ID for attributes */
@@ -10090,7 +10063,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gcreate2");
/* Create attributes on group */
- for (i=0; i<BUG2_NATTR; i++) {
+ for (i = 0; i < BUG2_NATTR; i++) {
HDsprintf(aname, "%03u", i);
aid = H5Acreate2(gid, aname, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
@@ -10100,7 +10073,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl)
}
/* Delete every other attribute */
- for (i=1; i<BUG2_NATTR; i+=2) {
+ for (i = 1; i < BUG2_NATTR; i += 2) {
HDsprintf(aname, "%03u", i);
ret = H5Adelete(gid, aname);
CHECK(ret, FAIL, "H5Adelete");
@@ -10167,7 +10140,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gcreate2");
/* Create attributes on group */
- for (i=0; i<BUG2_NATTR2; i++) {
+ for (i = 0; i < BUG2_NATTR2; i++) {
HDsprintf(aname, "%03u", i);
aid = H5Acreate2(gid, aname, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
@@ -10177,7 +10150,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl)
}
/* Delete every other attribute */
- for (i=0; i<BUG2_NATTR2; i++) {
+ for (i = 0; i < BUG2_NATTR2; i++) {
HDsprintf(aname, "%03u", i);
ret = H5Adelete(gid, aname);
CHECK(ret, FAIL, "H5Adelete");
@@ -10195,7 +10168,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl)
ret = H5Pclose(gcpl);
CHECK(ret, FAIL, "H5Pclose");
-} /* test_attr_bug2() */
+} /* test_attr_bug2() */
/****************************************************************
**
@@ -10208,17 +10181,16 @@ test_attr_bug2(hid_t fcpl, hid_t fapl)
static void
test_attr_bug3(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t aid1, aid2; /* Attribute IDs */
- hid_t sid1, sid2; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t did; /* Dataset ID */
- hsize_t dims1[2] = {2, 2},
- dims2[2] = {3, 3}; /* Dimensions */
- int wdata1[2][2];
- unsigned wdata2[3][3]; /* Write buffers */
- unsigned u, v; /* Local index variables */
- herr_t ret; /* Generic return status */
+ hid_t fid; /* File ID */
+ hid_t aid1, aid2; /* Attribute IDs */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t did; /* Dataset ID */
+ hsize_t dims1[2] = {2, 2}, dims2[2] = {3, 3}; /* Dimensions */
+ int wdata1[2][2];
+ unsigned wdata2[3][3]; /* Write buffers */
+ unsigned u, v; /* Local index variables */
+ herr_t ret; /* Generic return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing Attributes in the Same Header as their Datatypes\n"));
@@ -10266,11 +10238,11 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
CHECK(aid2, FAIL, "H5Aopen");
/* Initialize the write buffers */
- for(u = 0; u < dims1[0]; u++)
- for(v = 0; v < dims1[1]; v++)
+ for (u = 0; u < dims1[0]; u++)
+ for (v = 0; v < dims1[1]; v++)
wdata1[u][v] = (int)((u * dims1[1]) + v);
- for(u = 0; u < dims2[0]; u++)
- for(v = 0; v < dims2[1]; v++)
+ for (u = 0; u < dims2[0]; u++)
+ for (v = 0; v < dims2[1]; v++)
wdata2[u][v] = (unsigned)((u * dims2[1]) + v);
/* Write data to the attributes */
@@ -10332,7 +10304,7 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_bug3() */
+} /* test_attr_bug3() */
/****************************************************************
**
@@ -10346,14 +10318,14 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
static void
test_attr_bug4(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
hid_t aid1, aid2, aid3; /* Attribute IDs */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hid_t did; /* Dataset ID */
- hsize_t dims[1] = {5}; /* Attribute dimensions */
- herr_t ret; /* Generic return status */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hid_t did; /* Dataset ID */
+ hsize_t dims[1] = {5}; /* Attribute dimensions */
+ herr_t ret; /* Generic return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing that attributes can always be added to named datatypes\n"));
@@ -10414,7 +10386,7 @@ test_attr_bug4(hid_t fcpl, hid_t fapl)
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_bug4() */
+} /* test_attr_bug4() */
/****************************************************************
**
@@ -10426,16 +10398,14 @@ test_attr_bug4(hid_t fcpl, hid_t fapl)
static void
test_attr_bug5(hid_t fcpl, hid_t fapl)
{
- hid_t fid1, fid2; /* File IDs */
- hid_t gid1, gid2; /* Group IDs */
- hid_t did1, did2; /* Dataset IDs */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t aidg1, aidg2,
- aidd1, aidd2,
- aidt1, aidt2; /* Attribute IDs */
- hid_t sid; /* Dataspace ID */
- hsize_t dims[1] = {5}; /* Attribute dimensions */
- herr_t ret; /* Generic return status */
+ hid_t fid1, fid2; /* File IDs */
+ hid_t gid1, gid2; /* Group IDs */
+ hid_t did1, did2; /* Dataset IDs */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t aidg1, aidg2, aidd1, aidd2, aidt1, aidt2; /* Attribute IDs */
+ hid_t sid; /* Dataspace ID */
+ hsize_t dims[1] = {5}; /* Attribute dimensions */
+ herr_t ret; /* Generic return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing Opening an Attribute Through Multiple Files Concurrently\n"));
@@ -10571,7 +10541,7 @@ test_attr_bug5(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
ret = H5Fclose(fid2);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_bug5() */
+} /* test_attr_bug5() */
/****************************************************************
**
@@ -10582,13 +10552,13 @@ test_attr_bug5(hid_t fcpl, hid_t fapl)
static void
test_attr_bug6(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
- hid_t aid1, aid2; /* Attribute IDs */
- hid_t sid; /* Dataspace ID */
- hsize_t dims[ATTR1_RANK] = {ATTR1_DIM1}; /* Attribute dimensions */
- int intar[ATTR1_DIM1]; /* Data reading buffer */
- herr_t ret; /* Generic return status */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ hid_t aid1, aid2; /* Attribute IDs */
+ hid_t sid; /* Dataspace ID */
+ hsize_t dims[ATTR1_RANK] = {ATTR1_DIM1}; /* Attribute dimensions */
+ int intar[ATTR1_DIM1]; /* Data reading buffer */
+ herr_t ret; /* Generic return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing that empty attribute can be read\n"));
@@ -10631,7 +10601,7 @@ test_attr_bug6(hid_t fcpl, hid_t fapl)
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_bug6() */
+} /* test_attr_bug6() */
/****************************************************************
**
@@ -10646,19 +10616,18 @@ test_attr_bug6(hid_t fcpl, hid_t fapl)
static void
test_attr_bug7(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t aid; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t dims_s = 140; /* Small attribute dimensions */
- hsize_t dims_l = 65480; /* Large attribute dimensions */
- H5A_info_t ainfo; /* Attribute info */
- herr_t ret; /* Generic return status */
+ hid_t fid; /* File ID */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t dims_s = 140; /* Small attribute dimensions */
+ hsize_t dims_l = 65480; /* Large attribute dimensions */
+ H5A_info_t ainfo; /* Attribute info */
+ herr_t ret; /* Generic return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing adding and deleting large attributes\n"));
-
/* Create committed datatype to operate on. Use a committed datatype so that
* there is nothing after the object header and the first chunk can expand and
* contract as necessary. */
@@ -10694,8 +10663,9 @@ test_attr_bug7(hid_t fcpl, hid_t fapl)
CHECK(tid, FAIL, "H5Topen2");
ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims_s)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
+ if (ainfo.data_size != dims_s)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
/*
* Create another small attribute. Should cause chunk size field to expand by
@@ -10721,12 +10691,14 @@ test_attr_bug7(hid_t fcpl, hid_t fapl)
CHECK(tid, FAIL, "H5Topen2");
ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims_s)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
+ if (ainfo.data_size != dims_s)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
ret = H5Aget_info_by_name(tid, ".", ATTR2_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims_s)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
+ if (ainfo.data_size != dims_s)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
/*
* Create large attribute. Should cause chunk size field to expand by 2 bytes
@@ -10754,16 +10726,19 @@ test_attr_bug7(hid_t fcpl, hid_t fapl)
CHECK(tid, FAIL, "H5Topen2");
ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims_s)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
+ if (ainfo.data_size != dims_s)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
ret = H5Aget_info_by_name(tid, ".", ATTR2_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims_s)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
+ if (ainfo.data_size != dims_s)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
ret = H5Aget_info_by_name(tid, ".", ATTR3_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims_l)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_l);
+ if (ainfo.data_size != dims_l)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims_l);
/*
* Delete last two attributes - should merge into a null message that is too
@@ -10791,8 +10766,9 @@ test_attr_bug7(hid_t fcpl, hid_t fapl)
CHECK(tid, FAIL, "H5Topen2");
ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims_s)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
+ if (ainfo.data_size != dims_s)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
/*
* Create large attribute. Should cause chunk size field to expand by 3 bytes
@@ -10818,12 +10794,14 @@ test_attr_bug7(hid_t fcpl, hid_t fapl)
CHECK(tid, FAIL, "H5Topen2");
ret = H5Aget_info_by_name(tid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims_s)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
+ if (ainfo.data_size != dims_s)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims_s);
ret = H5Aget_info_by_name(tid, ".", ATTR2_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims_l)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims_l);
+ if (ainfo.data_size != dims_l)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims_l);
/* Close IDs */
ret = H5Tclose(tid);
@@ -10832,7 +10810,7 @@ test_attr_bug7(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_bug7() */
+} /* test_attr_bug7() */
/****************************************************************
**
@@ -10851,22 +10829,21 @@ test_attr_bug7(hid_t fcpl, hid_t fapl)
static void
test_attr_bug8(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t aid; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- hid_t gid; /* Group ID */
- hid_t oid; /* Object ID */
- hsize_t dims = 256; /* Attribute dimensions */
+ hid_t fid; /* File ID */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t gid; /* Group ID */
+ hid_t oid; /* Object ID */
+ hsize_t dims = 256; /* Attribute dimensions */
H5O_info2_t oinfo; /* Object info */
- H5A_info_t ainfo; /* Attribute info */
- haddr_t root_addr; /* Root group address */
- haddr_t link_addr; /* Link (to root group) address */
- herr_t ret; /* Generic return status */
+ H5A_info_t ainfo; /* Attribute info */
+ haddr_t root_addr; /* Root group address */
+ haddr_t link_addr; /* Link (to root group) address */
+ herr_t ret; /* Generic return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing attribute expanding object header with undecoded messages\n"));
-
/* Create committed datatype to operate on. Use a committed datatype so that
* there is nothing after the object header and the first chunk can expand and
* contract as necessary. */
@@ -10906,8 +10883,9 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Oget_info");
ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr);
CHECK(ret, FAIL, "H5VLnative_token_to_addr");
- if(link_addr != root_addr)
- TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr);
+ if (link_addr != root_addr)
+ TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n",
+ (long long unsigned)link_addr, (long long unsigned)root_addr);
/* Close file */
ret = H5Fclose(fid);
@@ -10953,12 +10931,14 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Oget_info");
ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr);
CHECK(ret, FAIL, "H5VLnative_token_to_addr");
- if(link_addr != root_addr)
- TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr);
+ if (link_addr != root_addr)
+ TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n",
+ (long long unsigned)link_addr, (long long unsigned)root_addr);
ret = H5Aget_info_by_name(gid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
- if(ainfo.data_size != dims)
- TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n", (long long unsigned)ainfo.data_size, (long long unsigned)dims);
+ if (ainfo.data_size != dims)
+ TestErrPrintf("attribute data size different: data_size=%llu, should be %llu\n",
+ (long long unsigned)ainfo.data_size, (long long unsigned)dims);
/* Close IDs */
ret = H5Oclose(oid);
@@ -10969,7 +10949,7 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_attr_bug8() */
+} /* test_attr_bug8() */
/****************************************************************
**
@@ -10990,17 +10970,17 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
static void
test_attr_bug9(hid_t fcpl, hid_t fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dims[1] = {32768}; /* Attribute dimensions */
- int create_link; /* Whether to create a soft link */
- unsigned max_compact; /* Setting from fcpl */
- unsigned min_dense; /* Setting from fcpl */
- char aname[11]; /* Attribute name */
- unsigned i; /* Local index variable */
- herr_t ret; /* Generic return status */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dims[1] = {32768}; /* Attribute dimensions */
+ int create_link; /* Whether to create a soft link */
+ unsigned max_compact; /* Setting from fcpl */
+ unsigned min_dense; /* Setting from fcpl */
+ char aname[11]; /* Attribute name */
+ unsigned i; /* Local index variable */
+ herr_t ret; /* Generic return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing that attributes can always be added to named datatypes\n"));
@@ -11014,7 +10994,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Run with and without the soft link */
- for(create_link = 0; create_link < 2; create_link++) {
+ for (create_link = 0; create_link < 2; create_link++) {
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(fid, FAIL, "H5Fcreate");
@@ -11032,7 +11012,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gopen2");
/* Create enough attributes to cause a change to dense storage */
- for(i = 0; i < max_compact + 1; i++) {
+ for (i = 0; i < max_compact + 1; i++) {
/* Create attribute */
HDsnprintf(aname, sizeof(aname), "%u", i);
aid = H5Acreate2(gid, aname, H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -11044,7 +11024,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl)
/* Create enough soft links that exactly one goes into chunk 1 if
* requested */
- if(i == 0 && create_link) {
+ if (i == 0 && create_link) {
ret = H5Lcreate_soft("b", gid, "a", H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lcreate_soft");
ret = H5Lcreate_soft("d", gid, "c", H5P_DEFAULT, H5P_DEFAULT);
@@ -11052,7 +11032,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl)
ret = H5Lcreate_soft("f", gid, "e", H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lcreate_soft");
} /* end if */
- } /* end for */
+ } /* end for */
/* Close IDs */
ret = H5Gclose(gid);
@@ -11065,7 +11045,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_attr_bug9() */
+} /* test_attr_bug9() */
/****************************************************************
**
@@ -11078,14 +11058,14 @@ test_attr_bug9(hid_t fcpl, hid_t fapl)
static void
test_attr_delete_last_dense(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
- hid_t aid; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
hsize_t dim2[2] = {DIM0, DIM1}; /* Dimension sizes */
- int i, j; /* Local index variables */
- double *data = NULL; /* Pointer to the data buffer */
- herr_t ret; /* Generic return status */
+ int i, j; /* Local index variables */
+ double *data = NULL; /* Pointer to the data buffer */
+ herr_t ret; /* Generic return status */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deleting the last large attribute stored densely\n"));
@@ -11111,8 +11091,8 @@ test_attr_delete_last_dense(hid_t fcpl, hid_t fapl)
CHECK_PTR(data, "HDmalloc");
/* Initialize the data */
- for(i = 0; i < DIM0; i++)
- for(j = 0; j < DIM1; j++)
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
*(data + i * DIM1 + j) = i + j;
/* Write to the attribute */
@@ -11148,10 +11128,10 @@ test_attr_delete_last_dense(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
/* Free the data buffer */
- if(data)
+ if (data)
HDfree(data);
-} /* test_attr_delete_last_dense() */
+} /* test_attr_delete_last_dense() */
/****************************************************************
**
@@ -11161,13 +11141,13 @@ test_attr_delete_last_dense(hid_t fcpl, hid_t fapl)
void
test_attr(void)
{
- hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
- hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */
- hid_t dcpl = -1; /* Dataset creation property list */
- unsigned new_format; /* Whether to use the new format or not */
- unsigned use_shared; /* Whether to use shared attributes or not */
- unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */
- herr_t ret; /* Generic return value */
+ hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
+ hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ unsigned new_format; /* Whether to use the new format or not */
+ unsigned use_shared; /* Whether to use shared attributes or not */
+ unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */
+ herr_t ret; /* Generic return value */
MESSAGE(5, ("Testing Attributes\n"));
@@ -11192,11 +11172,12 @@ test_attr(void)
ret = H5Pset_shared_mesg_index(fcpl2, (unsigned)0, H5O_SHMESG_ATTR_FLAG, (unsigned)1);
CHECK_I(ret, "H5Pset_shared_mesg_index");
- for(minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) {
- if(minimize_dset_oh == 0) {
+ for (minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) {
+ if (minimize_dset_oh == 0) {
MESSAGE(7, ("testing with default dataset object headers\n"));
dcpl_g = H5P_DEFAULT;
- } else {
+ }
+ else {
MESSAGE(7, ("testing with minimzied dataset object headers\n"));
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
@@ -11205,123 +11186,154 @@ test_attr(void)
dcpl_g = dcpl;
}
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl;
/* Set the FAPL for the type of format */
- if(new_format) {
+ if (new_format) {
MESSAGE(7, ("testing with new file format\n"));
my_fapl = fapl2;
- } else {
+ }
+ else {
MESSAGE(7, ("testing with old file format\n"));
my_fapl = fapl;
}
/* These next two tests use the same file information */
- test_attr_basic_write(my_fapl); /* Test basic H5A writing code */
- test_attr_basic_read(my_fapl); /* Test basic H5A reading code */
+ test_attr_basic_write(my_fapl); /* Test basic H5A writing code */
+ test_attr_basic_read(my_fapl); /* Test basic H5A reading code */
/* These next two tests use their own file information */
- test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */
- test_attr_plist(my_fapl); /* Test attribute property lists */
+ test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */
+ test_attr_plist(my_fapl); /* Test attribute property lists */
/* These next two tests use the same file information */
- test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */
- test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */
+ test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */
+ test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */
/* These next two tests use the same file information */
- test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */
- test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */
+ test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */
+ test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */
/* These next four tests use the same file information */
- test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */
- test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */
- test_attr_iterate(my_fapl); /* Test H5A iterator code */
- test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */
+ test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */
+ test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */
+ test_attr_iterate(my_fapl); /* Test H5A iterator code */
+ test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */
/* This next test uses its own file information */
- test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */
+ test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */
/* This next test uses its own file information */
test_attr_duplicate_ids(my_fapl);
- for(use_shared = FALSE; use_shared <= TRUE; use_shared++) {
+ for (use_shared = FALSE; use_shared <= TRUE; use_shared++) {
hid_t my_fcpl;
- if(new_format == TRUE && use_shared) {
+ if (new_format == TRUE && use_shared) {
MESSAGE(7, ("testing with shared attributes\n"));
my_fcpl = fcpl2;
- } else {
+ }
+ else {
MESSAGE(7, ("testing without shared attributes\n"));
my_fcpl = fcpl;
}
- test_attr_big(my_fcpl, my_fapl); /* Test storing big attribute */
- test_attr_null_space(my_fcpl, my_fapl); /* Test storing attribute with NULL dataspace */
- test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */
- test_attr_many(new_format, my_fcpl, my_fapl); /* Test storing lots of attributes */
- test_attr_info_null_info_pointer(my_fcpl, my_fapl); /* Test passing a NULL attribute info pointer to H5Aget_info(_by_name/_by_idx) */
- test_attr_rename_invalid_name(my_fcpl, my_fapl); /* Test passing a NULL or empty attribute name to H5Arename(_by_name) */
- test_attr_get_name_invalid_buf(my_fcpl, my_fapl); /* Test passing NULL buffer to H5Aget_name(_by_idx) */
+ test_attr_big(my_fcpl, my_fapl); /* Test storing big attribute */
+ test_attr_null_space(my_fcpl, my_fapl); /* Test storing attribute with NULL dataspace */
+ test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */
+ test_attr_many(new_format, my_fcpl, my_fapl); /* Test storing lots of attributes */
+ test_attr_info_null_info_pointer(my_fcpl,
+ my_fapl); /* Test passing a NULL attribute info pointer to
+ H5Aget_info(_by_name/_by_idx) */
+ test_attr_rename_invalid_name(
+ my_fcpl,
+ my_fapl); /* Test passing a NULL or empty attribute name to H5Arename(_by_name) */
+ test_attr_get_name_invalid_buf(
+ my_fcpl, my_fapl); /* Test passing NULL buffer to H5Aget_name(_by_idx) */
/* New attribute API routine tests */
- test_attr_info_by_idx(new_format, my_fcpl, my_fapl); /* Test querying attribute info by index */
- test_attr_delete_by_idx(new_format, my_fcpl, my_fapl); /* Test deleting attribute by index */
- test_attr_iterate2(new_format, my_fcpl, my_fapl); /* Test iterating over attributes by index */
+ test_attr_info_by_idx(new_format, my_fcpl,
+ my_fapl); /* Test querying attribute info by index */
+ test_attr_delete_by_idx(new_format, my_fcpl, my_fapl); /* Test deleting attribute by index */
+ test_attr_iterate2(new_format, my_fcpl,
+ my_fapl); /* Test iterating over attributes by index */
test_attr_open_by_idx(new_format, my_fcpl, my_fapl); /* Test opening attributes by index */
test_attr_open_by_name(new_format, my_fcpl, my_fapl); /* Test opening attributes by name */
test_attr_create_by_name(new_format, my_fcpl, my_fapl); /* Test creating attributes by name */
/* Tests that address specific bugs */
- test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */
- test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */
- test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */
- test_attr_bug4(my_fcpl, my_fapl); /* Test attributes on named datatypes */
- test_attr_bug5(my_fcpl, my_fapl); /* Test opening/closing attributes through different file handles */
- test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */
+ test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */
+ test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */
+ test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */
+ test_attr_bug4(my_fcpl, my_fapl); /* Test attributes on named datatypes */
+ test_attr_bug5(my_fcpl,
+ my_fapl); /* Test opening/closing attributes through different file handles */
+ test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */
/* test_attr_bug7 is specific to the "new" object header format,
* and in fact fails if used with the old format due to the
* attributes being larger than 64K */
- test_attr_bug8(my_fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */
- test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */
+ test_attr_bug8(my_fcpl,
+ my_fapl); /* Test attribute expanding object header with undecoded messages */
+ test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */
/* tests specific to the "new format" */
if (new_format == TRUE) {
/* General attribute tests */
- test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */
- test_attr_dense_open(my_fcpl, my_fapl); /* Test opening attributes in dense storage */
- test_attr_dense_delete(my_fcpl, my_fapl); /* Test deleting attributes in dense storage */
- test_attr_dense_rename(my_fcpl, my_fapl); /* Test renaming attributes in dense storage */
- test_attr_dense_unlink(my_fcpl, my_fapl); /* Test unlinking object with attributes in dense storage */
- test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */
- test_attr_dense_dup_ids(my_fcpl, my_fapl); /* Test duplicated IDs for dense attribute storage */
+ test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */
+ test_attr_dense_open(my_fcpl, my_fapl); /* Test opening attributes in dense storage */
+ test_attr_dense_delete(my_fcpl, my_fapl); /* Test deleting attributes in dense storage */
+ test_attr_dense_rename(my_fcpl, my_fapl); /* Test renaming attributes in dense storage */
+ test_attr_dense_unlink(
+ my_fcpl, my_fapl); /* Test unlinking object with attributes in dense storage */
+ test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */
+ test_attr_dense_dup_ids(my_fcpl,
+ my_fapl); /* Test duplicated IDs for dense attribute storage */
/* Attribute creation order tests */
- test_attr_corder_create_basic(my_fcpl, my_fapl);/* Test creating an object w/attribute creation order info */
- test_attr_corder_create_compact(my_fcpl, my_fapl); /* Test compact attribute storage on an object w/attribute creation order info */
- test_attr_corder_create_dense(my_fcpl, my_fapl);/* Test dense attribute storage on an object w/attribute creation order info */
- test_attr_corder_create_reopen(my_fcpl, my_fapl);/* Test creating attributes w/reopening file from using new format to using old format */
- test_attr_corder_transition(my_fcpl, my_fapl); /* Test attribute storage transitions on an object w/attribute creation order info */
- test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage w/attribute creation order info */
+ test_attr_corder_create_basic(
+ my_fcpl, my_fapl); /* Test creating an object w/attribute creation order info */
+ test_attr_corder_create_compact(my_fcpl,
+ my_fapl); /* Test compact attribute storage on an object
+ w/attribute creation order info */
+ test_attr_corder_create_dense(my_fcpl,
+ my_fapl); /* Test dense attribute storage on an object
+ w/attribute creation order info */
+ test_attr_corder_create_reopen(my_fcpl,
+ my_fapl); /* Test creating attributes w/reopening file from
+ using new format to using old format */
+ test_attr_corder_transition(my_fcpl,
+ my_fapl); /* Test attribute storage transitions on an object
+ w/attribute creation order info */
+ test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage
+ w/attribute creation order info */
/* More complex tests with exclusively both "new format" and "shared" attributes */
- if(use_shared == TRUE) {
- test_attr_shared_write(my_fcpl, my_fapl); /* Test writing to shared attributes in compact & dense storage */
- test_attr_shared_rename(my_fcpl, my_fapl); /* Test renaming shared attributes in compact & dense storage */
- test_attr_shared_delete(my_fcpl, my_fapl); /* Test deleting shared attributes in compact & dense storage */
- test_attr_shared_unlink(my_fcpl, my_fapl); /* Test unlinking object with shared attributes in compact & dense storage */
- } /* if using shared attributes */
+ if (use_shared == TRUE) {
+ test_attr_shared_write(
+ my_fcpl,
+ my_fapl); /* Test writing to shared attributes in compact & dense storage */
+ test_attr_shared_rename(
+ my_fcpl,
+ my_fapl); /* Test renaming shared attributes in compact & dense storage */
+ test_attr_shared_delete(
+ my_fcpl,
+ my_fapl); /* Test deleting shared attributes in compact & dense storage */
+ test_attr_shared_unlink(my_fcpl, my_fapl); /* Test unlinking object with shared
+ attributes in compact & dense storage */
+ } /* if using shared attributes */
test_attr_delete_last_dense(my_fcpl, my_fapl);
/* test_attr_bug7 is specific to the "new" object header format,
* and in fact fails if used with the old format due to the
* attributes being larger than 64K */
- test_attr_bug7(my_fcpl, my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */
+ test_attr_bug7(my_fcpl,
+ my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */
} /* if using "new format" */
- } /* for unshared/shared attributes */
- } /* for old/new format */
+ } /* for unshared/shared attributes */
+ } /* for old/new format */
if (minimize_dset_oh != 0) {
ret = H5Pclose(dcpl);
@@ -11342,8 +11354,7 @@ test_attr(void)
CHECK(ret, FAIL, "H5Pclose");
ret = H5Pclose(fapl2);
CHECK(ret, FAIL, "H5Pclose");
-} /* test_attr() */
-
+} /* test_attr() */
/*-------------------------------------------------------------------------
* Function: cleanup_attr
@@ -11364,4 +11375,3 @@ cleanup_attr(void)
{
HDremove(FILENAME);
}
-
diff --git a/test/tcheck_version.c b/test/tcheck_version.c
index 2611178..62c0138 100644
--- a/test/tcheck_version.c
+++ b/test/tcheck_version.c
@@ -29,17 +29,17 @@
#include "h5test.h"
-#define progname "tcheck_version"
+#define progname "tcheck_version"
/* prototypes */
void showhelp(void);
void parse(int ac, char **av);
-void abort_intercept (int H5_ATTR_UNUSED sig);
+void abort_intercept(int H5_ATTR_UNUSED sig);
/* global variables */
-unsigned major = H5_VERS_MAJOR;
-unsigned minor = H5_VERS_MINOR;
-unsigned release = H5_VERS_RELEASE;
+unsigned major = H5_VERS_MAJOR;
+unsigned minor = H5_VERS_MINOR;
+unsigned release = H5_VERS_RELEASE;
void
showhelp(void)
@@ -53,43 +53,43 @@ showhelp(void)
HDprintf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE);
}
-
void
parse(int ac, char **av)
{
char *pt;
- while (--ac > 0){
- pt = *(++av);
- if (*pt != '-') {
- HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av);
- HDexit(EXIT_FAILURE);
- }else{
- switch(*(++pt)) {
- case 't': /* option -t */
- switch(*(++pt)) {
- case 'M':
- major++;
- break;
- case 'm':
- minor++;
- break;
- case 'r':
- release++;
- break;
- default:
- HDfprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av);
- HDexit(EXIT_FAILURE);
- }
- break;
- case 'h': /* help page */
- showhelp();
- HDexit(EXIT_SUCCESS);
- default:
+ while (--ac > 0) {
+ pt = *(++av);
+ if (*pt != '-') {
HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av);
HDexit(EXIT_FAILURE);
}
- }
+ else {
+ switch (*(++pt)) {
+ case 't': /* option -t */
+ switch (*(++pt)) {
+ case 'M':
+ major++;
+ break;
+ case 'm':
+ minor++;
+ break;
+ case 'r':
+ release++;
+ break;
+ default:
+ HDfprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av);
+ HDexit(EXIT_FAILURE);
+ }
+ break;
+ case 'h': /* help page */
+ showhelp();
+ HDexit(EXIT_SUCCESS);
+ default:
+ HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av);
+ HDexit(EXIT_FAILURE);
+ }
+ }
}
}
@@ -103,7 +103,7 @@ parse(int ac, char **av)
* This tries to eliminate those side effects.
*/
H5_ATTR_NORETURN void
-abort_intercept (int H5_ATTR_UNUSED sig)
+abort_intercept(int H5_ATTR_UNUSED sig)
{
HDexit(6);
}
diff --git a/test/tchecksum.c b/test/tchecksum.c
index 82dc135..36b5709 100644
--- a/test/tchecksum.c
+++ b/test/tchecksum.c
@@ -30,13 +30,12 @@
/**********/
/* Macros */
/**********/
-#define BUF_LEN 3093 /* No particular value */
+#define BUF_LEN 3093 /* No particular value */
/*******************/
/* Local variables */
/*******************/
-
/****************************************************************
**
** test_chksum_size_one(): Checksum 1 byte buffer
@@ -45,8 +44,8 @@
static void
test_chksum_size_one(void)
{
- uint8_t buf[1] = {23}; /* Buffer to checksum */
- uint32_t chksum; /* Checksum value */
+ uint8_t buf[1] = {23}; /* Buffer to checksum */
+ uint32_t chksum; /* Checksum value */
/* Buffer w/real data */
chksum = H5_checksum_fletcher32(buf, sizeof(buf));
@@ -70,7 +69,6 @@ test_chksum_size_one(void)
VERIFY(chksum, 0x8ba9414b, "H5_checksum_lookup3");
} /* test_chksum_size_one() */
-
/****************************************************************
**
** test_chksum_size_two(): Checksum 2 byte buffer
@@ -79,8 +77,8 @@ test_chksum_size_one(void)
static void
test_chksum_size_two(void)
{
- uint8_t buf[2] = {23, 187}; /* Buffer to checksum */
- uint32_t chksum; /* Checksum value */
+ uint8_t buf[2] = {23, 187}; /* Buffer to checksum */
+ uint32_t chksum; /* Checksum value */
/* Buffer w/real data */
chksum = H5_checksum_fletcher32(buf, sizeof(buf));
@@ -104,7 +102,6 @@ test_chksum_size_two(void)
VERIFY(chksum, 0x62cd61b3, "H5_checksum_lookup3");
} /* test_chksum_size_two() */
-
/****************************************************************
**
** test_chksum_size_three(): Checksum 3 byte buffer
@@ -113,8 +110,8 @@ test_chksum_size_two(void)
static void
test_chksum_size_three(void)
{
- uint8_t buf[3] = {23, 187, 98}; /* Buffer to checksum */
- uint32_t chksum; /* Checksum value */
+ uint8_t buf[3] = {23, 187, 98}; /* Buffer to checksum */
+ uint32_t chksum; /* Checksum value */
/* Buffer w/real data */
chksum = H5_checksum_fletcher32(buf, sizeof(buf));
@@ -138,7 +135,6 @@ test_chksum_size_three(void)
VERIFY(chksum, 0x6bd0060f, "H5_checksum_lookup3");
} /* test_chksum_size_three() */
-
/****************************************************************
**
** test_chksum_size_four(): Checksum 4 byte buffer
@@ -147,8 +143,8 @@ test_chksum_size_three(void)
static void
test_chksum_size_four(void)
{
- uint8_t buf[4] = {23, 187, 98, 217};/* Buffer to checksum */
- uint32_t chksum; /* Checksum value */
+ uint8_t buf[4] = {23, 187, 98, 217}; /* Buffer to checksum */
+ uint32_t chksum; /* Checksum value */
/* Buffer w/real data */
chksum = H5_checksum_fletcher32(buf, sizeof(buf));
@@ -172,7 +168,6 @@ test_chksum_size_four(void)
VERIFY(chksum, 0x049396b8, "H5_checksum_lookup3");
} /* test_chksum_size_four() */
-
/****************************************************************
**
** test_chksum_large(): Checksum larger buffer
@@ -181,16 +176,16 @@ test_chksum_size_four(void)
static void
test_chksum_large(void)
{
- uint8_t *large_buf; /* Buffer for checksum calculations */
- uint32_t chksum; /* Checksum value */
- size_t u; /* Local index variable */
+ uint8_t *large_buf; /* Buffer for checksum calculations */
+ uint32_t chksum; /* Checksum value */
+ size_t u; /* Local index variable */
/* Allocate the buffer */
large_buf = (uint8_t *)HDmalloc((size_t)BUF_LEN);
CHECK_PTR(large_buf, "HDmalloc");
/* Initialize buffer w/known data */
- for(u = 0; u < BUF_LEN; u++)
+ for (u = 0; u < BUF_LEN; u++)
large_buf[u] = (uint8_t)(u * 3);
/* Buffer w/real data */
@@ -218,7 +213,6 @@ test_chksum_large(void)
HDfree(large_buf);
} /* test_chksum_large() */
-
/****************************************************************
**
** test_checksum(): Main checksum testing routine.
@@ -231,15 +225,14 @@ test_checksum(void)
MESSAGE(5, ("Testing checksum algorithms\n"));
/* Various checks for fletcher32 checksum algorithm */
- test_chksum_size_one(); /* Test buffer w/only 1 byte */
- test_chksum_size_two(); /* Test buffer w/only 2 bytes */
- test_chksum_size_three(); /* Test buffer w/only 3 bytes */
- test_chksum_size_four(); /* Test buffer w/only 4 bytes */
- test_chksum_large(); /* Test buffer w/larger # of bytes */
+ test_chksum_size_one(); /* Test buffer w/only 1 byte */
+ test_chksum_size_two(); /* Test buffer w/only 2 bytes */
+ test_chksum_size_three(); /* Test buffer w/only 3 bytes */
+ test_chksum_size_four(); /* Test buffer w/only 4 bytes */
+ test_chksum_large(); /* Test buffer w/larger # of bytes */
} /* test_checksum() */
-
/*-------------------------------------------------------------------------
* Function: cleanup_checksum
*
@@ -257,4 +250,3 @@ cleanup_checksum(void)
{
/* no file to clean */
}
-
diff --git a/test/tconfig.c b/test/tconfig.c
index 1a81d50..196ccce 100644
--- a/test/tconfig.c
+++ b/test/tconfig.c
@@ -12,12 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tconfig
-*
-* Test the definitions in the H5config.h as much as possible
-*
-*************************************************************/
+ *
+ * Test program: tconfig
+ *
+ * Test the definitions in the H5config.h as much as possible
+ *
+ *************************************************************/
#include "testhdf5.h"
@@ -25,28 +25,25 @@
/* verify C int type: verify the size of signed and unsigned int type
* with the macro size.
*/
-#define vrfy_cint_type(ctype, uctype, ctype_macro) \
- /* check signed type size */ \
- vrfy_macrosize(ctype, ctype_macro, #ctype_macro);\
- /* check unsigned type size */ \
+#define vrfy_cint_type(ctype, uctype, ctype_macro) \
+ /* check signed type size */ \
+ vrfy_macrosize(ctype, ctype_macro, #ctype_macro); \
+ /* check unsigned type size */ \
vrfy_macrosize(uctype, ctype_macro, #ctype_macro);
/* verify C type sizes: verify the sizeof type with the macro size. */
-#define vrfy_ctype(type, macro) \
- vrfy_macrosize(type, macro, #macro);
+#define vrfy_ctype(type, macro) vrfy_macrosize(type, macro, #macro);
/* verify if the sizeof(type) matches size defined in macro. */
/* Needs this extra step so that we can print the macro name. */
-#define vrfy_macrosize(type, macro, macroname) \
- if (sizeof(type) != macro) \
- TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", \
- #type, sizeof(type), macroname, (int)macro);
+#define vrfy_macrosize(type, macro, macroname) \
+ if (sizeof(type) != macro) \
+ TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", #type, sizeof(type), macroname, (int)macro);
/* local routine prototypes */
void test_config_ctypes(void);
void test_exit_definitions(void);
-
/*-------------------------------------------------------------------------
* Function: test_configure
*
@@ -68,7 +65,6 @@ test_configure(void)
test_exit_definitions();
}
-
/*-------------------------------------------------------------------------
* Function: cleanup_configure
*
@@ -89,7 +85,6 @@ cleanup_configure(void)
/* no file to clean */
}
-
/*-------------------------------------------------------------------------
* Function: test_config_ctypes
*
@@ -118,7 +113,7 @@ test_config_ctypes(void)
vrfy_cint_type(long, unsigned long, H5_SIZEOF_LONG);
vrfy_ctype(float, H5_SIZEOF_FLOAT);
vrfy_ctype(double, H5_SIZEOF_DOUBLE);
-#if H5_SIZEOF_LONG_DOUBLE >0
+#if H5_SIZEOF_LONG_DOUBLE > 0
vrfy_ctype(long double, H5_SIZEOF_LONG_DOUBLE);
#endif
@@ -197,10 +192,8 @@ test_config_ctypes(void)
#if H5_SIZEOF_SSIZE_T > 0
vrfy_ctype(ssize_t, H5_SIZEOF_SSIZE_T);
#endif
-
}
-
/*-------------------------------------------------------------------------
* Function: test_exit_definitions
*
@@ -220,10 +213,8 @@ test_exit_definitions(void)
{
/* Verify the EXIT_SUCCESS and EXIT_FAILURE are 0 and 1 respectively. */
/* This should be true for POSIX compliant systems. */
- if (EXIT_SUCCESS != 0) \
- TestErrPrintf("Error: EXIT_SUCCESS is %d, should be %d\n", \
- EXIT_SUCCESS, 0);
- if (EXIT_FAILURE != 1) \
- TestErrPrintf("Error: EXIT_FAILURE is %d, should be %d\n", \
- EXIT_FAILURE, 1);
+ if (EXIT_SUCCESS != 0)
+ TestErrPrintf("Error: EXIT_SUCCESS is %d, should be %d\n", EXIT_SUCCESS, 0);
+ if (EXIT_FAILURE != 1)
+ TestErrPrintf("Error: EXIT_FAILURE is %d, should be %d\n", EXIT_FAILURE, 1);
}
diff --git a/test/tcoords.c b/test/tcoords.c
index f639d4b..e92bdde 100644
--- a/test/tcoords.c
+++ b/test/tcoords.c
@@ -12,25 +12,25 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tcoords
-*
-* Test the element coordinates for dataspace selection. For
-* chunked dataset, when the hyperslab selection of some
-* dimensions is full, the library optimize it by "flattenning"
-* the fully selected dimensions. This program tests if the
-* coordinates of selected elements are correctly calculated.
-*
-*************************************************************/
+ *
+ * Test program: tcoords
+ *
+ * Test the element coordinates for dataspace selection. For
+ * chunked dataset, when the hyperslab selection of some
+ * dimensions is full, the library optimize it by "flattenning"
+ * the fully selected dimensions. This program tests if the
+ * coordinates of selected elements are correctly calculated.
+ *
+ *************************************************************/
#include "testhdf5.h"
-#define FILENAME "coord.h5"
+#define FILENAME "coord.h5"
-#define SINGLE_END_DSET "single_end_dset"
-#define MULTI_ENDS_SEL_HYPER_DSET "multiple_ends_dset"
+#define SINGLE_END_DSET "single_end_dset"
+#define MULTI_ENDS_SEL_HYPER_DSET "multiple_ends_dset"
-#define NAME_LEN 128
+#define NAME_LEN 128
/* Data written to the dataset for single block test. Global variable
* for convenience. */
@@ -42,63 +42,37 @@ int da_buffer[2][3][6][2];
** one block.
**
*************************************************************/
-static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
+static void
+test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
{
- hid_t sid, plid, did, msid;
- char dset_name[NAME_LEN]; /* Dataset name */
- size_t elmts_numb;
- herr_t ret; /* Generic error return */
- int i, j, k;
- hsize_t da_dims[4] = { 2, 3, 6, 2 };
- hsize_t da_chunksize[4] = { 1, 3, 3, 2 };
+ hid_t sid, plid, did, msid;
+ char dset_name[NAME_LEN]; /* Dataset name */
+ size_t elmts_numb;
+ herr_t ret; /* Generic error return */
+ int i, j, k;
+ hsize_t da_dims[4] = {2, 3, 6, 2};
+ hsize_t da_chunksize[4] = {1, 3, 3, 2};
/* For testing the full selection in the fastest-growing end */
- int mem1_buffer[1][1][6][2];
- hsize_t mem1_dims[4] = { 1, 1, 6, 2 };
- hsize_t da_elmts1[12][4] = { {0, 0, 0, 0},
- {0, 0, 0, 1},
- {0, 0, 1, 0},
- {0, 0, 1, 1},
- {0, 0, 2, 0},
- {0, 0, 2, 1},
- {0, 0, 3, 0},
- {0, 0, 3, 1},
- {0, 0, 4, 0},
- {0, 0, 4, 1},
- {0, 0, 5, 0},
- {0, 0, 5, 1} };
+ int mem1_buffer[1][1][6][2];
+ hsize_t mem1_dims[4] = {1, 1, 6, 2};
+ hsize_t da_elmts1[12][4] = {{0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 1, 0}, {0, 0, 1, 1},
+ {0, 0, 2, 0}, {0, 0, 2, 1}, {0, 0, 3, 0}, {0, 0, 3, 1},
+ {0, 0, 4, 0}, {0, 0, 4, 1}, {0, 0, 5, 0}, {0, 0, 5, 1}};
/* For testing the full selection in the slowest-growing end */
- int mem2_buffer[2][3][1][1];
- hsize_t mem2_dims[4] = { 2, 3, 1, 1 };
- hsize_t da_elmts2[6][4] = { {0, 0, 0, 0},
- {0, 1, 0, 0},
- {0, 2, 0, 0},
- {1, 0, 0, 0},
- {1, 1, 0, 0},
- {1, 2, 0, 0} };
+ int mem2_buffer[2][3][1][1];
+ hsize_t mem2_dims[4] = {2, 3, 1, 1};
+ hsize_t da_elmts2[6][4] = {{0, 0, 0, 0}, {0, 1, 0, 0}, {0, 2, 0, 0},
+ {1, 0, 0, 0}, {1, 1, 0, 0}, {1, 2, 0, 0}};
/* For testing the full selection in the middle dimensions */
- int mem3_buffer[1][3][6][1];
- hsize_t mem3_dims[4] = { 1, 3, 6, 1 };
- hsize_t da_elmts3[18][4] = { {0, 0, 0, 0},
- {0, 0, 1, 0},
- {0, 0, 2, 0},
- {0, 0, 3, 0},
- {0, 0, 4, 0},
- {0, 0, 5, 0},
- {0, 1, 0, 0},
- {0, 1, 1, 0},
- {0, 1, 2, 0},
- {0, 1, 3, 0},
- {0, 1, 4, 0},
- {0, 1, 5, 0},
- {0, 2, 0, 0},
- {0, 2, 1, 0},
- {0, 2, 2, 0},
- {0, 2, 3, 0},
- {0, 2, 4, 0},
- {0, 2, 5, 0} };
+ int mem3_buffer[1][3][6][1];
+ hsize_t mem3_dims[4] = {1, 3, 6, 1};
+ hsize_t da_elmts3[18][4] = {{0, 0, 0, 0}, {0, 0, 1, 0}, {0, 0, 2, 0}, {0, 0, 3, 0}, {0, 0, 4, 0},
+ {0, 0, 5, 0}, {0, 1, 0, 0}, {0, 1, 1, 0}, {0, 1, 2, 0}, {0, 1, 3, 0},
+ {0, 1, 4, 0}, {0, 1, 5, 0}, {0, 2, 0, 0}, {0, 2, 1, 0}, {0, 2, 2, 0},
+ {0, 2, 3, 0}, {0, 2, 4, 0}, {0, 2, 5, 0}};
/* Create and write the dataset */
sid = H5Screate_simple(4, da_dims, da_dims);
@@ -107,7 +81,7 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
plid = H5Pcreate(H5P_DATASET_CREATE);
CHECK(plid, FAIL, "H5Pcreate");
- if(is_chunked) {
+ if (is_chunked) {
ret = H5Pset_chunk(plid, 4, da_chunksize);
CHECK(ret, FAIL, "H5Pset_chunk");
}
@@ -115,18 +89,18 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
/* Construct dataset's name */
memset(dset_name, 0, (size_t)NAME_LEN);
strcat(dset_name, SINGLE_END_DSET);
- if(is_chunked)
+ if (is_chunked)
strcat(dset_name, "_chunked");
did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");
/* Initialize the data to be written to file */
- for(i=0; i<2; i++) {
- for(j=0; j<3; j++) {
- for(k=0; k<6; k++) {
- da_buffer[i][j][k][0] = i*100 + j*10 + k;
- da_buffer[i][j][k][1] = i*100 + j*10 + k + 1;
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 6; k++) {
+ da_buffer[i][j][k][0] = i * 100 + j * 10 + k;
+ da_buffer[i][j][k][1] = i * 100 + j * 10 + k + 1;
}
}
}
@@ -137,7 +111,6 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
ret = H5Dclose(did);
CHECK(ret, FAIL, "H5Dclose");
-
/* ****** Case 1: ******
* Testing the full selection in the fastest-growing end */
did = H5Dopen2(file, dset_name, H5P_DEFAULT);
@@ -165,9 +138,9 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<6; i++)
- for(j=0; j<2; j++)
- if(da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 2; j++)
+ if (da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
TestErrPrintf("%u: Read different values than written at index 0,0,%d,%d\n", __LINE__, i, j);
}
@@ -198,10 +171,12 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<2; i++)
- for(j=0; j<3; j++)
- if(da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,0, da_buffer = %d, mem2_buffer = %d\n", __LINE__, i, j, da_buffer[i][j][0][0], mem2_buffer[i][j][0][0]);
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++)
+ if (da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
+ TestErrPrintf("%u: Read different values than written at index %d,%d,0,0, da_buffer = %d, "
+ "mem2_buffer = %d\n",
+ __LINE__, i, j, da_buffer[i][j][0][0], mem2_buffer[i][j][0][0]);
}
/* ****** Case 3: ******
@@ -231,13 +206,12 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<3; i++)
- for(j=0; j<6; j++)
- if(da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 6; j++)
+ if (da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0\n", __LINE__, i, j);
}
-
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -251,42 +225,43 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
** of only one block.
**
*************************************************************/
-static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
+static void
+test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
{
- hid_t sid, did, msid;
- char dset_name[NAME_LEN]; /* Dataset name */
- herr_t ret; /* Generic error return */
- int i, j;
- hsize_t da_dims[4] = { 2, 3, 6, 2 };
+ hid_t sid, did, msid;
+ char dset_name[NAME_LEN]; /* Dataset name */
+ herr_t ret; /* Generic error return */
+ int i, j;
+ hsize_t da_dims[4] = {2, 3, 6, 2};
/* For testing the full selection in the fastest-growing end */
- int mem1_buffer[1][1][6][2];
- hsize_t mem1_dims[4] = { 1, 1, 6, 2 };
- hsize_t mem1_start[4] = { 0, 0, 0, 0 };
- hsize_t mem1_count[4] = { 1, 1, 1, 1 };
- hsize_t mem1_stride[4] = { 1, 1, 1, 1 };
- hsize_t mem1_block[4] = { 1, 1, 6, 2 };
+ int mem1_buffer[1][1][6][2];
+ hsize_t mem1_dims[4] = {1, 1, 6, 2};
+ hsize_t mem1_start[4] = {0, 0, 0, 0};
+ hsize_t mem1_count[4] = {1, 1, 1, 1};
+ hsize_t mem1_stride[4] = {1, 1, 1, 1};
+ hsize_t mem1_block[4] = {1, 1, 6, 2};
/* For testing the full selection in the slowest-growing end */
- int mem2_buffer[2][3][1][1];
- hsize_t mem2_dims[4] = { 2, 3, 1, 1 };
- hsize_t mem2_start[4] = { 0, 0, 0, 0 };
- hsize_t mem2_count[4] = { 1, 1, 1, 1 };
- hsize_t mem2_stride[4] = { 1, 1, 1, 1 };
- hsize_t mem2_block[4] = { 2, 3, 1, 1 };
+ int mem2_buffer[2][3][1][1];
+ hsize_t mem2_dims[4] = {2, 3, 1, 1};
+ hsize_t mem2_start[4] = {0, 0, 0, 0};
+ hsize_t mem2_count[4] = {1, 1, 1, 1};
+ hsize_t mem2_stride[4] = {1, 1, 1, 1};
+ hsize_t mem2_block[4] = {2, 3, 1, 1};
/* For testing the full selection in the middle dimensions */
- int mem3_buffer[1][3][6][1];
- hsize_t mem3_dims[4] = { 1, 3, 6, 1 };
- hsize_t mem3_start[4] = { 0, 0, 0, 0 };
- hsize_t mem3_count[4] = { 1, 1, 1, 1 };
- hsize_t mem3_stride[4] = { 1, 1, 1, 1 };
- hsize_t mem3_block[4] = { 1, 3, 6, 1 };
+ int mem3_buffer[1][3][6][1];
+ hsize_t mem3_dims[4] = {1, 3, 6, 1};
+ hsize_t mem3_start[4] = {0, 0, 0, 0};
+ hsize_t mem3_count[4] = {1, 1, 1, 1};
+ hsize_t mem3_stride[4] = {1, 1, 1, 1};
+ hsize_t mem3_block[4] = {1, 3, 6, 1};
/* Construct dataset's name */
memset(dset_name, 0, NAME_LEN);
strcat(dset_name, SINGLE_END_DSET);
- if(is_chunked)
+ if (is_chunked)
strcat(dset_name, "_chunked");
/* Dataspace for the dataset in file */
@@ -318,9 +293,9 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<6; i++)
- for(j=0; j<2; j++)
- if(da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 2; j++)
+ if (da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
TestErrPrintf("%u: Read different values than written at index 0,0,%d,%d\n", __LINE__, i, j);
}
@@ -349,9 +324,9 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<2; i++)
- for(j=0; j<3; j++)
- if(da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++)
+ if (da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
TestErrPrintf("%u: Read different values than written at index %d,%d,0,0\n", __LINE__, i, j);
}
@@ -380,75 +355,73 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<3; i++)
- for(j=0; j<6; j++)
- if(da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 6; j++)
+ if (da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0\n", __LINE__, i, j);
}
-
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
}
-
-
/***********************************************************
**
** test_multiple_end(): Test full hyperslab selection of
** multiple blocks.
**
*************************************************************/
-static void test_multiple_ends(hid_t file, hbool_t is_chunked)
+static void
+test_multiple_ends(hid_t file, hbool_t is_chunked)
{
- hid_t sid, plid, did, msid;
- char dset_name[NAME_LEN]; /* Dataset name */
- herr_t ret; /* Generic error return */
- int i, j, k, l, m, n, p;
- hsize_t da_dims[8] = { 4, 5, 3, 4, 2, 3, 6, 2 };
- hsize_t da_chunksize[8] = { 1, 5, 3, 2, 2, 3, 3, 2 };
- int data_buf[4][5][3][4][2][3][6][2];
+ hid_t sid, plid, did, msid;
+ char dset_name[NAME_LEN]; /* Dataset name */
+ herr_t ret; /* Generic error return */
+ int i, j, k, l, m, n, p;
+ hsize_t da_dims[8] = {4, 5, 3, 4, 2, 3, 6, 2};
+ hsize_t da_chunksize[8] = {1, 5, 3, 2, 2, 3, 3, 2};
+ int data_buf[4][5][3][4][2][3][6][2];
/* For testing the full selections in the fastest-growing end and in the middle dimensions */
- int mem1_buffer[1][1][1][4][2][1][6][2];
- hsize_t mem1_dims[8] = { 1, 1, 1, 4, 2, 1, 6, 2 };
- hsize_t mem1_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem1_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem1_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem1_block[8] = { 1, 1, 1, 4, 2, 1, 6, 2 };
+ int mem1_buffer[1][1][1][4][2][1][6][2];
+ hsize_t mem1_dims[8] = {1, 1, 1, 4, 2, 1, 6, 2};
+ hsize_t mem1_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem1_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem1_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem1_block[8] = {1, 1, 1, 4, 2, 1, 6, 2};
/* For testing the full selections in the slowest-growing end and in the middle dimensions */
- int mem2_buffer[4][5][1][4][2][1][1][1];
- hsize_t mem2_dims[8] = { 4, 5, 1, 4, 2, 1, 1, 1 };
- hsize_t mem2_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem2_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem2_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem2_block[8] = { 4, 5, 1, 4, 2, 1, 1, 1 };
+ int mem2_buffer[4][5][1][4][2][1][1][1];
+ hsize_t mem2_dims[8] = {4, 5, 1, 4, 2, 1, 1, 1};
+ hsize_t mem2_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem2_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem2_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem2_block[8] = {4, 5, 1, 4, 2, 1, 1, 1};
/* For testing two unadjacent full selections in the middle dimensions */
- int mem3_buffer[1][5][3][1][1][3][6][1];
- hsize_t mem3_dims[8] = { 1, 5, 3, 1, 1, 3, 6, 1 };
- hsize_t mem3_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem3_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem3_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem3_block[8] = { 1, 5, 3, 1, 1, 3, 6, 1 };
+ int mem3_buffer[1][5][3][1][1][3][6][1];
+ hsize_t mem3_dims[8] = {1, 5, 3, 1, 1, 3, 6, 1};
+ hsize_t mem3_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem3_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem3_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem3_block[8] = {1, 5, 3, 1, 1, 3, 6, 1};
/* For testing the full selections in the fastest-growing end and the slowest-growing end */
- int mem4_buffer[4][5][1][1][1][1][6][2];
- hsize_t mem4_dims[8] = { 4, 5, 1, 1, 1, 1, 6, 2 };
- hsize_t mem4_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem4_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem4_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem4_block[8] = { 4, 5, 1, 1, 1, 1, 6, 2 };
+ int mem4_buffer[4][5][1][1][1][1][6][2];
+ hsize_t mem4_dims[8] = {4, 5, 1, 1, 1, 1, 6, 2};
+ hsize_t mem4_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem4_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem4_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem4_block[8] = {4, 5, 1, 1, 1, 1, 6, 2};
/* For testing the full selections in the fastest-growing end and slowest-growing end,
* also in the middle dimensions */
- int mem5_buffer[4][5][1][4][2][1][6][2];
- hsize_t mem5_dims[8] = { 4, 5, 1, 4, 2, 1, 6, 2 };
- hsize_t mem5_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem5_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem5_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem5_block[8] = { 4, 5, 1, 4, 2, 1, 6, 2 };
+ int mem5_buffer[4][5][1][4][2][1][6][2];
+ hsize_t mem5_dims[8] = {4, 5, 1, 4, 2, 1, 6, 2};
+ hsize_t mem5_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem5_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem5_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem5_block[8] = {4, 5, 1, 4, 2, 1, 6, 2};
/* Create and write the dataset */
sid = H5Screate_simple(8, da_dims, da_dims);
@@ -457,7 +430,7 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
plid = H5Pcreate(H5P_DATASET_CREATE);
CHECK(plid, FAIL, "H5Pcreate");
- if(is_chunked) {
+ if (is_chunked) {
ret = H5Pset_chunk(plid, 8, da_chunksize);
CHECK(ret, FAIL, "H5Pset_chunk");
}
@@ -465,21 +438,23 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
/* Construct dataset's name */
memset(dset_name, 0, NAME_LEN);
strcat(dset_name, MULTI_ENDS_SEL_HYPER_DSET);
- if(is_chunked)
+ if (is_chunked)
strcat(dset_name, "_chunked");
did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");
- for(i=0; i<4; i++)
- for(j=0; j<5; j++)
- for(k=0; k<3; k++)
- for(l=0; l<4; l++)
- for(m=0; m<2; m++)
- for(n=0; n<3; n++)
- for(p=0; p<6; p++) {
- data_buf[i][j][k][l][m][n][p][0] = i*1000000 + j*100000 + k*10000 + l*1000 + m*100 + n*10 + p;
- data_buf[i][j][k][l][m][n][p][1] = i*1000000 + j*100000 + k*10000 + l*1000 + m*100 + n*10 + p + 1;
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 5; j++)
+ for (k = 0; k < 3; k++)
+ for (l = 0; l < 4; l++)
+ for (m = 0; m < 2; m++)
+ for (n = 0; n < 3; n++)
+ for (p = 0; p < 6; p++) {
+ data_buf[i][j][k][l][m][n][p][0] =
+ i * 1000000 + j * 100000 + k * 10000 + l * 1000 + m * 100 + n * 10 + p;
+ data_buf[i][j][k][l][m][n][p][1] = i * 1000000 + j * 100000 + k * 10000 +
+ l * 1000 + m * 100 + n * 10 + p + 1;
}
ret = H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data_buf);
@@ -512,12 +487,13 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<4; i++)
- for(j=0; j<2; j++)
- for(k=0; k<6; k++)
- for(l=0; l<2; l++)
- if(data_buf[0][0][0][i][j][0][k][l] != mem1_buffer[0][0][0][i][j][0][k][l]) {
- TestErrPrintf("%u: Read different values than written at index 0,0,0,%d,%d,0,%d,%d\n", __LINE__, i, j, k, l);
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 2; j++)
+ for (k = 0; k < 6; k++)
+ for (l = 0; l < 2; l++)
+ if (data_buf[0][0][0][i][j][0][k][l] != mem1_buffer[0][0][0][i][j][0][k][l]) {
+ TestErrPrintf("%u: Read different values than written at index 0,0,0,%d,%d,0,%d,%d\n",
+ __LINE__, i, j, k, l);
}
/* ****** Case 2: ******
@@ -544,12 +520,13 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<4; i++)
- for(j=0; j<5; j++)
- for(k=0; k<4; k++)
- for(l=0; l<2; l++)
- if(data_buf[i][j][0][k][l][0][0][0] != mem2_buffer[i][j][0][k][l][0][0][0]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,%d,%d,0,0,0\n", __LINE__, i, j, k, l);
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 5; j++)
+ for (k = 0; k < 4; k++)
+ for (l = 0; l < 2; l++)
+ if (data_buf[i][j][0][k][l][0][0][0] != mem2_buffer[i][j][0][k][l][0][0][0]) {
+ TestErrPrintf("%u: Read different values than written at index %d,%d,0,%d,%d,0,0,0\n",
+ __LINE__, i, j, k, l);
}
/* ****** Case 3: ******
@@ -576,12 +553,13 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<5; i++)
- for(j=0; j<3; j++)
- for(k=0; k<3; k++)
- for(l=0; l<6; l++)
- if(data_buf[0][i][j][0][0][k][l][0] != mem3_buffer[0][i][j][0][0][k][l][0]) {
- TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0,0,%d,%d,0\n", __LINE__, i, j, k, l);
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 3; j++)
+ for (k = 0; k < 3; k++)
+ for (l = 0; l < 6; l++)
+ if (data_buf[0][i][j][0][0][k][l][0] != mem3_buffer[0][i][j][0][0][k][l][0]) {
+ TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0,0,%d,%d,0\n",
+ __LINE__, i, j, k, l);
}
/* ****** Case 4: ******
@@ -608,15 +586,15 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<4; i++)
- for(j=0; j<5; j++)
- for(k=0; k<6; k++)
- for(l=0; l<2; l++)
- if(data_buf[i][j][0][0][0][0][k][l] != mem4_buffer[i][j][0][0][0][0][k][l]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,0,0,0,%d,%d\n", __LINE__, i, j, k, l);
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 5; j++)
+ for (k = 0; k < 6; k++)
+ for (l = 0; l < 2; l++)
+ if (data_buf[i][j][0][0][0][0][k][l] != mem4_buffer[i][j][0][0][0][0][k][l]) {
+ TestErrPrintf("%u: Read different values than written at index %d,%d,0,0,0,0,%d,%d\n",
+ __LINE__, i, j, k, l);
}
-
/* ****** Case 5: ******
* Testing the full selections in the fastest-growing end and the slowest-growing end,
* and also in the middle dimensions */
@@ -642,17 +620,18 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<4; i++)
- for(j=0; j<5; j++)
- for(k=0; k<4; k++)
- for(l=0; l<2; l++)
- for(m=0; m<6; m++)
- for(n=0; n<2; n++)
- if(data_buf[i][j][0][k][l][0][m][n] != mem5_buffer[i][j][0][k][l][0][m][n]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,%d,%d,0,%d,%d\n", __LINE__, i, j, k, l, m, n);
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 5; j++)
+ for (k = 0; k < 4; k++)
+ for (l = 0; l < 2; l++)
+ for (m = 0; m < 6; m++)
+ for (n = 0; n < 2; n++)
+ if (data_buf[i][j][0][k][l][0][m][n] != mem5_buffer[i][j][0][k][l][0][m][n]) {
+ TestErrPrintf(
+ "%u: Read different values than written at index %d,%d,0,%d,%d,0,%d,%d\n",
+ __LINE__, i, j, k, l, m, n);
}
-
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -660,18 +639,18 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
CHECK(ret, FAIL, "H5Pclose");
}
-
/****************************************************************
**
** test_coords(): Main testing routine.
**
****************************************************************/
-void test_coords(void)
+void
+test_coords(void)
{
hid_t fid;
hbool_t is_chunk[2] = {TRUE, FALSE};
int i;
- herr_t ret; /* Generic error return */
+ herr_t ret; /* Generic error return */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
@@ -691,7 +670,6 @@ void test_coords(void)
CHECK(ret, FAIL, "H5Fclose");
}
-
/*-------------------------------------------------------------------------
* Function: cleanup_coords
*
diff --git a/test/testframe.c b/test/testframe.c
index cfb62ec..22f694e 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -24,38 +24,36 @@
/*
* Definitions for the testing structure.
*/
-#define MAXTESTNAME 16
-#define MAXTESTDESC 64
+#define MAXTESTNAME 16
+#define MAXTESTDESC 64
typedef struct TestStruct {
- int NumErrors;
- char Description[MAXTESTDESC];
- int SkipFlag;
- char Name[MAXTESTNAME];
+ int NumErrors;
+ char Description[MAXTESTDESC];
+ int SkipFlag;
+ char Name[MAXTESTNAME];
void (*Call)(void);
void (*Cleanup)(void);
const void *Parameters;
} TestStruct;
-
/*
* Variables used by testing framework.
*/
-static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */
-static int num_errs = 0; /* Total number of errors during testing */
-int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */
-static int Summary = 0; /* Show test summary. Default is no. */
-static int CleanUp = 1; /* Do cleanup or not. Default is yes. */
-static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */
-static TestStruct *Test = NULL; /* Array of tests */
-static unsigned TestAlloc = 0; /* Size of the Test array */
-static unsigned Index = 0;
-static const void *Test_parameters = NULL;
-static const char *TestProgName = NULL;
-static void (*TestPrivateUsage)(void) = NULL;
+static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */
+static int num_errs = 0; /* Total number of errors during testing */
+int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */
+static int Summary = 0; /* Show test summary. Default is no. */
+static int CleanUp = 1; /* Do cleanup or not. Default is yes. */
+static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */
+static TestStruct *Test = NULL; /* Array of tests */
+static unsigned TestAlloc = 0; /* Size of the Test array */
+static unsigned Index = 0;
+static const void *Test_parameters = NULL;
+static const char *TestProgName = NULL;
+static void (*TestPrivateUsage)(void) = NULL;
static int (*TestPrivateParser)(int ac, char *av[]) = NULL;
-
/*
* Setup a test function and add it to the list of tests.
* It must have no parameters and returns void.
@@ -70,7 +68,8 @@ static int (*TestPrivateParser)(int ac, char *av[]) = NULL;
* exit EXIT_FAILURE if error is encountered.
*/
void
-AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr, const void *Parameters)
+AddTest(const char *TheName, void (*TheCall)(void), void (*Cleanup)(void), const char *TheDescr,
+ const void *Parameters)
{
/* Sanity checking */
if (HDstrlen(TheDescr) >= MAXTESTDESC) {
@@ -83,41 +82,41 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
} /* end if */
/* Check for increasing the Test array size */
- if(Index >= TestAlloc) {
- TestStruct *newTest = Test; /* New array of tests */
- unsigned newAlloc = MAX(1, TestAlloc * 2); /* New array size */
+ if (Index >= TestAlloc) {
+ TestStruct *newTest = Test; /* New array of tests */
+ unsigned newAlloc = MAX(1, TestAlloc * 2); /* New array size */
/* Reallocate array */
- if(NULL == (newTest = (TestStruct *)HDrealloc(Test, newAlloc * sizeof(TestStruct)))) {
- HDprintf("Out of memory for tests, Index = %u, TestAlloc = %u, newAlloc = %u\n", Index, TestAlloc, newAlloc);
+ if (NULL == (newTest = (TestStruct *)HDrealloc(Test, newAlloc * sizeof(TestStruct)))) {
+ HDprintf("Out of memory for tests, Index = %u, TestAlloc = %u, newAlloc = %u\n", Index, TestAlloc,
+ newAlloc);
HDexit(EXIT_FAILURE);
} /* end if */
/* Update info */
- Test = newTest;
+ Test = newTest;
TestAlloc = newAlloc;
} /* end if */
/* Set up test function */
HDstrcpy(Test[Index].Description, TheDescr);
- if(*TheName != '-') {
+ if (*TheName != '-') {
HDstrcpy(Test[Index].Name, TheName);
Test[Index].SkipFlag = 0;
}
- else { /* skip test by default */
- HDstrcpy(Test[Index].Name, TheName+1);
+ else { /* skip test by default */
+ HDstrcpy(Test[Index].Name, TheName + 1);
Test[Index].SkipFlag = 1;
}
- Test[Index].Call = TheCall;
- Test[Index].Cleanup = Cleanup;
- Test[Index].NumErrors = -1;
+ Test[Index].Call = TheCall;
+ Test[Index].Cleanup = Cleanup;
+ Test[Index].NumErrors = -1;
Test[Index].Parameters = Parameters;
/* Increment test count */
Index++;
}
-
/*
* Initialize testing framework
*
@@ -132,7 +131,8 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
* Albert Cheng 2004/08/17
* Added the ProgName, private_usage and private_parser arguments.
*/
-void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]))
+void
+TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]))
{
/*
* Turn off automatic error reporting since we do it ourselves. Besides,
@@ -146,13 +146,12 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p
* Record the program name and private routines if provided.
*/
TestProgName = ProgName;
- if(NULL != private_usage)
+ if (NULL != private_usage)
TestPrivateUsage = private_usage;
- if(NULL != private_parser)
+ if (NULL != private_parser)
TestPrivateParser = private_parser;
}
-
/*
* Print test usage.
* First print the common test options, then the extra options if provided.
@@ -160,12 +159,13 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p
* Modification:
* 2004/08/18 Albert Cheng. Add TestPrivateUsage feature.
*/
-void TestUsage(void)
+void
+TestUsage(void)
{
unsigned i;
- print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n",
- TestProgName, (TestPrivateUsage ? "<extra options>" : ""));
+ print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", TestProgName,
+ (TestPrivateUsage ? "<extra options>" : ""));
print_func(" [-[e]x[clude] name]+ \n");
print_func(" [-o[nly] name]+ \n");
print_func(" [-b[egin] name] \n");
@@ -180,7 +180,7 @@ void TestUsage(void)
print_func("summary prints a summary of test results at the end\n");
print_func("cleanoff does not delete *.hdf files after execution of tests\n");
print_func("help print out this information\n");
- if (TestPrivateUsage){
+ if (TestPrivateUsage) {
print_func("\nExtra options\n");
TestPrivateUsage();
}
@@ -195,21 +195,20 @@ void TestUsage(void)
print_func("\n\n");
}
-
/*
* Print test info.
*/
-void TestInfo(const char *ProgName)
+void
+TestInfo(const char *ProgName)
{
unsigned major, minor, release;
H5get_libversion(&major, &minor, &release);
- print_func("\nFor help use: %s -help\n",ProgName);
+ print_func("\nFor help use: %s -help\n", ProgName);
print_func("Linked with hdf5 version %u.%u release %u\n", major, minor, release);
}
-
/*
* Parse command line information.
* argc, argv: the usual command line argument count and strings
@@ -220,60 +219,62 @@ void TestInfo(const char *ProgName)
* Modification:
* 2004/08/18 Albert Cheng. Add extra_parse feature.
*/
-void TestParseCmdLine(int argc, char *argv[])
+void
+TestParseCmdLine(int argc, char *argv[])
{
hbool_t skipped_all = FALSE;
- int ret_code;
+ int ret_code;
- while (argv++, --argc > 0){
+ while (argv++, --argc > 0) {
if ((HDstrcmp(*argv, "-verbose") == 0) || (HDstrcmp(*argv, "-v") == 0)) {
- if (argc > 0){
- --argc; ++argv;
+ if (argc > 0) {
+ --argc;
+ ++argv;
ParseTestVerbosity(*argv);
}
- else{
+ else {
TestUsage();
HDexit(EXIT_FAILURE);
}
}
- else if (((HDstrcmp(*argv, "-exclude") == 0) ||
- (HDstrcmp(*argv, "-x") == 0))) {
- if (argc > 0){
- --argc; ++argv;
+ else if (((HDstrcmp(*argv, "-exclude") == 0) || (HDstrcmp(*argv, "-x") == 0))) {
+ if (argc > 0) {
+ --argc;
+ ++argv;
SetTest(*argv, SKIPTEST);
}
- else{
+ else {
TestUsage();
HDexit(EXIT_FAILURE);
}
}
- else if (((HDstrcmp(*argv, "-begin") == 0) ||
- (HDstrcmp(*argv, "-b") == 0))) {
- if (argc > 0){
- --argc; ++argv;
+ else if (((HDstrcmp(*argv, "-begin") == 0) || (HDstrcmp(*argv, "-b") == 0))) {
+ if (argc > 0) {
+ --argc;
+ ++argv;
SetTest(*argv, BEGINTEST);
}
- else{
+ else {
TestUsage();
HDexit(EXIT_FAILURE);
}
}
- else if (((HDstrcmp(*argv, "-only") == 0) ||
- (HDstrcmp(*argv, "-o") == 0))) {
- if(argc > 0) {
+ else if (((HDstrcmp(*argv, "-only") == 0) || (HDstrcmp(*argv, "-o") == 0))) {
+ if (argc > 0) {
unsigned Loop;
- --argc; ++argv;
+ --argc;
+ ++argv;
/* Skip all tests, then activate only one. */
- if(!skipped_all) {
- for(Loop = 0; Loop < Index; Loop++)
+ if (!skipped_all) {
+ for (Loop = 0; Loop < Index; Loop++)
Test[Loop].SkipFlag = 1;
skipped_all = TRUE;
} /* end if */
SetTest(*argv, ONLYTEST);
}
- else{
+ else {
TestUsage();
HDexit(EXIT_FAILURE);
}
@@ -292,33 +293,33 @@ void TestParseCmdLine(int argc, char *argv[])
/* non-standard option. Break out. */
break;
}
-
}
/* Call extra parsing function if provided. */
- if (NULL != TestPrivateParser){
- ret_code=TestPrivateParser(argc+1, argv-1);
+ if (NULL != TestPrivateParser) {
+ ret_code = TestPrivateParser(argc + 1, argv - 1);
if (ret_code != 0)
HDexit(EXIT_FAILURE);
}
}
-
/*
* Perform Tests.
*/
-void PerformTests(void)
+void
+PerformTests(void)
{
- unsigned Loop;
+ unsigned Loop;
for (Loop = 0; Loop < Index; Loop++)
if (Test[Loop].SkipFlag) {
MESSAGE(2, ("Skipping -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name));
- } else {
+ }
+ else {
MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name));
MESSAGE(5, ("===============================================\n"));
Test[Loop].NumErrors = num_errs;
- Test_parameters = Test[Loop].Parameters;
+ Test_parameters = Test[Loop].Parameters;
ALARM_ON;
Test[Loop].Call();
ALARM_OFF;
@@ -327,22 +328,22 @@ void PerformTests(void)
MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors));
}
- Test_parameters = NULL; /* clear it. */
+ Test_parameters = NULL; /* clear it. */
MESSAGE(2, ("\n\n"))
if (num_errs)
- print_func("!!! %d Error(s) were detected !!!\n\n", (int) num_errs);
+ print_func("!!! %d Error(s) were detected !!!\n\n", (int)num_errs);
else
print_func("All tests were successful. \n\n");
}
-
/*
* Display test summary.
*/
-void TestSummary(void)
+void
+TestSummary(void)
{
- unsigned Loop;
+ unsigned Loop;
print_func("Summary of Test Results:\n");
print_func("Name of Test Errors Description of Test\n");
@@ -358,52 +359,53 @@ void TestSummary(void)
print_func("\n\n");
}
-
/*
* Cleanup files from testing
*/
-void TestCleanup(void)
+void
+TestCleanup(void)
{
- unsigned Loop;
+ unsigned Loop;
MESSAGE(2, ("\nCleaning Up temp files...\n\n"));
/* call individual cleanup routines in each source module */
for (Loop = 0; Loop < Index; Loop++)
- if (!Test[Loop].SkipFlag && Test[Loop].Cleanup!=NULL)
+ if (!Test[Loop].SkipFlag && Test[Loop].Cleanup != NULL)
Test[Loop].Cleanup();
}
-
/*
* Shutdown the test infrastructure
*/
-void TestShutdown(void)
+void
+TestShutdown(void)
{
- if(Test)
+ if (Test)
HDfree(Test);
}
-
/*
* Retrieve the verbosity level for the testing framework
*/
-H5_ATTR_PURE int GetTestVerbosity(void)
+H5_ATTR_PURE int
+GetTestVerbosity(void)
{
- return(TestVerbosity);
+ return (TestVerbosity);
}
/*
* Set the verbosity level for the testing framework.
* Return previous verbosity level.
*/
-int SetTestVerbosity(int newval)
+int
+SetTestVerbosity(int newval)
{
int oldval;
- oldval = TestVerbosity;
+ oldval = TestVerbosity;
TestVerbosity = newval;
- return(oldval);
+ return (oldval);
}
/*
@@ -433,28 +435,28 @@ int SetTestVerbosity(int newval)
I think this can be easily implemented in the test library (libh5test.a)
so that all tests can just call it to check the status of $HDF5TestExpress.
*/
-int GetTestExpress(void)
+int
+GetTestExpress(void)
{
- char * env_val;
+ char *env_val;
/* set it here for now. Should be done in something like h5test_init(). */
- if(TestExpress==-1)
- {
+ if (TestExpress == -1) {
env_val = getenv("HDF5TestExpress");
- if(env_val == NULL)
+ if (env_val == NULL)
SetTestExpress(1);
- else if(strcmp(env_val, "0") == 0)
+ else if (strcmp(env_val, "0") == 0)
SetTestExpress(0);
- else if(strcmp(env_val, "1") == 0)
+ else if (strcmp(env_val, "1") == 0)
SetTestExpress(1);
- else if(strcmp(env_val, "2") == 0)
+ else if (strcmp(env_val, "2") == 0)
SetTestExpress(2);
else
SetTestExpress(3);
}
- return(TestExpress);
+ return (TestExpress);
}
/*
@@ -462,50 +464,55 @@ int GetTestExpress(void)
* Return previous TestExpress mode.
* Values: non-zero means TestExpress mode is on, 0 means off.
*/
-int SetTestExpress(int newval)
+int
+SetTestExpress(int newval)
{
int oldval;
- oldval = TestExpress;
+ oldval = TestExpress;
TestExpress = newval;
- return(oldval);
+ return (oldval);
}
/*
* Retrieve Summary request value.
* 0 means no summary, 1 means yes.
*/
-H5_ATTR_PURE int GetTestSummary(void)
+H5_ATTR_PURE int
+GetTestSummary(void)
{
- return(Summary);
+ return (Summary);
}
/*
* Retrieve Cleanup request value.
* 0 means no Cleanup, 1 means yes.
*/
-H5_ATTR_PURE int GetTestCleanup(void)
+H5_ATTR_PURE int
+GetTestCleanup(void)
{
- return(CleanUp);
+ return (CleanUp);
}
/*
* Set cleanup to no.
* Return previous cleanup value.
*/
-int SetTestNoCleanup(void)
+int
+SetTestNoCleanup(void)
{
int oldval;
- oldval = CleanUp;
+ oldval = CleanUp;
CleanUp = 0;
- return(oldval);
+ return (oldval);
}
/*
* Parse an argument string for verbosity level and set it.
*/
-void ParseTestVerbosity(char *argv)
+void
+ParseTestVerbosity(char *argv)
{
if (*argv == 'l')
SetTestVerbosity(VERBO_LO);
@@ -517,34 +524,33 @@ void ParseTestVerbosity(char *argv)
SetTestVerbosity(atoi(argv));
}
-
/*
* Retrieve the number of testing errors for the testing framework
*/
-H5_ATTR_PURE int GetTestNumErrs(void)
+H5_ATTR_PURE int
+GetTestNumErrs(void)
{
- return(num_errs);
+ return (num_errs);
}
-
/*
* Increment the number of testing errors
*/
-void IncTestNumErrs(void)
+void
+IncTestNumErrs(void)
{
num_errs++;
}
-
/*
* Retrieve the current Test Parameters pointer.
*/
-H5_ATTR_PURE const void *GetTestParameters(void)
+H5_ATTR_PURE const void *
+GetTestParameters(void)
{
- return(Test_parameters);
+ return (Test_parameters);
}
-
/*
* This routine is designed to provide equivalent functionality to 'printf'
* and also increment the error count for the testing framework.
@@ -553,7 +559,7 @@ int
TestErrPrintf(const char *format, ...)
{
va_list arglist;
- int ret_value;
+ int ret_value;
/* Increment the error count */
num_errs++;
@@ -567,7 +573,6 @@ TestErrPrintf(const char *format, ...)
return ret_value;
}
-
/*
* Set (control) which test will be tested.
* SKIPTEST: skip this test
@@ -575,59 +580,59 @@ TestErrPrintf(const char *format, ...)
* BEGINETEST: skip all tests before this test
*
*/
-void SetTest(const char *testname, int action)
+void
+SetTest(const char *testname, int action)
{
unsigned Loop;
- switch (action){
- case SKIPTEST:
- for (Loop = 0; Loop < Index; Loop++)
- if (HDstrcmp(testname, Test[Loop].Name) == 0){
- Test[Loop].SkipFlag = 1;
- break;
- }
- break;
- case BEGINTEST:
- for (Loop = 0; Loop < Index; Loop++) {
- if (HDstrcmp(testname, Test[Loop].Name) != 0)
- Test[Loop].SkipFlag = 1;
- else{
- /* Found it. Set it to run. Done. */
- Test[Loop].SkipFlag = 0;
- break;
+ switch (action) {
+ case SKIPTEST:
+ for (Loop = 0; Loop < Index; Loop++)
+ if (HDstrcmp(testname, Test[Loop].Name) == 0) {
+ Test[Loop].SkipFlag = 1;
+ break;
+ }
+ break;
+ case BEGINTEST:
+ for (Loop = 0; Loop < Index; Loop++) {
+ if (HDstrcmp(testname, Test[Loop].Name) != 0)
+ Test[Loop].SkipFlag = 1;
+ else {
+ /* Found it. Set it to run. Done. */
+ Test[Loop].SkipFlag = 0;
+ break;
+ }
}
- }
- break;
- case ONLYTEST:
- for (Loop = 0; Loop < Index; Loop++) {
- if (HDstrcmp(testname, Test[Loop].Name) == 0) {
- /* Found it. Set it to run. Break to skip the rest. */
- Test[Loop].SkipFlag = 0;
- break;
+ break;
+ case ONLYTEST:
+ for (Loop = 0; Loop < Index; Loop++) {
+ if (HDstrcmp(testname, Test[Loop].Name) == 0) {
+ /* Found it. Set it to run. Break to skip the rest. */
+ Test[Loop].SkipFlag = 0;
+ break;
+ }
}
- }
- break;
- default:
- /* error */
- HDprintf("*** ERROR: Unknown action (%d) for SetTest\n", action);
- break;
+ break;
+ default:
+ /* error */
+ HDprintf("*** ERROR: Unknown action (%d) for SetTest\n", action);
+ break;
}
}
-
/*
* Enable alarm on test execution, configurable by environment variable
*/
-void TestAlarmOn(void)
+void
+TestAlarmOn(void)
{
- char * env_val = HDgetenv("HDF5_ALARM_SECONDS"); /* Alarm environment */
- unsigned long alarm_sec = H5_ALARM_SEC; /* Number of seconds before alarm goes off */
+ char * env_val = HDgetenv("HDF5_ALARM_SECONDS"); /* Alarm environment */
+ unsigned long alarm_sec = H5_ALARM_SEC; /* Number of seconds before alarm goes off */
/* Get the alarm value from the environment variable, if set */
- if(env_val != NULL)
+ if (env_val != NULL)
alarm_sec = (unsigned)HDstrtoul(env_val, (char **)NULL, 10);
/* Set the number of seconds before alarm goes off */
HDalarm((unsigned)alarm_sec);
}
-
diff --git a/test/testhdf5.c b/test/testhdf5.c
index 72acf6c..152719a 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -45,34 +45,34 @@ main(int argc, char *argv[])
AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL);
AddTest("metadata", test_metadata, cleanup_metadata, "Encoding/decoding metadata", NULL);
AddTest("checksum", test_checksum, cleanup_checksum, "Checksum algorithm", NULL);
- AddTest("tst", test_tst, NULL, "Ternary Search Trees", NULL);
- AddTest("heap", test_heap, NULL, "Memory Heaps", NULL);
- AddTest("skiplist", test_skiplist, NULL, "Skip Lists", NULL);
- AddTest("refstr", test_refstr, NULL, "Reference Counted Strings", NULL);
+ AddTest("tst", test_tst, NULL, "Ternary Search Trees", NULL);
+ AddTest("heap", test_heap, NULL, "Memory Heaps", NULL);
+ AddTest("skiplist", test_skiplist, NULL, "Skip Lists", NULL);
+ AddTest("refstr", test_refstr, NULL, "Reference Counted Strings", NULL);
AddTest("file", test_file, cleanup_file, "Low-Level File I/O", NULL);
AddTest("objects", test_h5o, cleanup_h5o, "Generic Object Functions", NULL);
- AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
- AddTest("coords", test_coords, cleanup_coords, "Dataspace coordinates", NULL);
- AddTest("sohm", test_sohm, cleanup_sohm, "Shared Object Header Messages", NULL);
- AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL);
- AddTest("select", test_select, cleanup_select, "Selections", NULL);
- AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
- AddTest("ref_deprec", test_reference_deprec, cleanup_reference_deprec, "Deprecated References", NULL);
- AddTest("ref", test_reference, cleanup_reference, "References", NULL);
- AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
- AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
- AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
- AddTest("array", test_array, cleanup_array, "Array Datatypes", NULL);
- AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
- AddTest("unicode", test_unicode, cleanup_unicode, "UTF-8 Encoding", NULL);
- AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL);
- AddTest("misc", test_misc, cleanup_misc, "Miscellaneous", NULL);
+ AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
+ AddTest("coords", test_coords, cleanup_coords, "Dataspace coordinates", NULL);
+ AddTest("sohm", test_sohm, cleanup_sohm, "Shared Object Header Messages", NULL);
+ AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL);
+ AddTest("select", test_select, cleanup_select, "Selections", NULL);
+ AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
+ AddTest("ref_deprec", test_reference_deprec, cleanup_reference_deprec, "Deprecated References", NULL);
+ AddTest("ref", test_reference, cleanup_reference, "References", NULL);
+ AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
+ AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
+ AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
+ AddTest("array", test_array, cleanup_array, "Array Datatypes", NULL);
+ AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
+ AddTest("unicode", test_unicode, cleanup_unicode, "UTF-8 Encoding", NULL);
+ AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL);
+ AddTest("misc", test_misc, cleanup_misc, "Miscellaneous", NULL);
/* Display testing information */
TestInfo(argv[0]);
/* Parse command line arguments */
- TestParseCmdLine(argc,argv);
+ TestParseCmdLine(argc, argv);
/* Perform requested testing */
PerformTests();
@@ -94,5 +94,4 @@ main(int argc, char *argv[])
HDexit(EXIT_FAILURE);
else
HDexit(EXIT_SUCCESS);
-} /* end main() */
-
+} /* end main() */
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 6b13cae..872e6b4 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -23,154 +23,178 @@
/* Use %ld to print the value because long should cover most cases. */
/* Used to make certain a return value _is_not_ a value */
-#define CHECK(ret, val, where) do { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d " \
- "in %s returned %ld \n", \
- where, (int)__LINE__, __FILE__, \
- (long)(ret)); \
- } \
- if ((ret) == (val)) { \
- TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
-} while(0)
-
-#define CHECK_I(ret,where) { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \
- (where), (int)__LINE__, __FILE__, (long)(ret)); \
- } \
- if ((ret)<0) { \
- TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
- (where), (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
-}
+#define CHECK(ret, val, where) \
+ do { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d " \
+ "in %s returned %ld \n", \
+ where, (int)__LINE__, __FILE__, (long)(ret)); \
+ } \
+ if ((ret) == (val)) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", \
+ where, (long)(ret), (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+ } while (0)
+
+#define CHECK_I(ret, where) \
+ { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", (where), (int)__LINE__, \
+ __FILE__, (long)(ret)); \
+ } \
+ if ((ret) < 0) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", (where), (long)(ret), \
+ (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+ }
/* Check that a pointer is valid (i.e.: not NULL) */
-#define CHECK_PTR(ret,where) { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
- (where), (int)__LINE__, __FILE__, (ret)); \
- } \
- if (!(ret)) { \
- TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
- (where), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
-}
+#define CHECK_PTR(ret, where) \
+ { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
+ __FILE__, (ret)); \
+ } \
+ if (!(ret)) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", (where), (int)__LINE__, \
+ __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+ }
/* Check that a pointer is NULL */
-#define CHECK_PTR_NULL(ret,where) { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
- (where), (int)__LINE__, __FILE__, (ret)); \
- } \
- if (ret) { \
- TestErrPrintf ("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", \
- (where), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
-}
+#define CHECK_PTR_NULL(ret, where) \
+ { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
+ __FILE__, (ret)); \
+ } \
+ if (ret) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", (where), \
+ (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+ }
/* Check that two pointers are equal */
-#define CHECK_PTR_EQ(ret, val, where) { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
- (where), (int)__LINE__, __FILE__, (const void *)(ret)); \
- } \
- if (ret != val) { \
- TestErrPrintf ("*** UNEXPECTED RETURN from %s: returned value of %p is not equal to %p line %4d in %s\n", \
- (where), (const void *)(ret), (const void *)(val), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
-}
+#define CHECK_PTR_EQ(ret, val, where) \
+ { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
+ __FILE__, (const void *)(ret)); \
+ } \
+ if (ret != val) { \
+ TestErrPrintf( \
+ "*** UNEXPECTED RETURN from %s: returned value of %p is not equal to %p line %4d in %s\n", \
+ (where), (const void *)(ret), (const void *)(val), (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+ }
/* Used to make certain a return value _is_ a value */
-#define VERIFY(_x, _val, where) do { \
- long __x = (long)_x, __val = (long)_val; \
- if(VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s had value " \
- "%ld \n", (where), (int)__LINE__, __FILE__, __x); \
- } \
- if((__x) != (__val)) { \
- TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
- "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
-} while(0)
+#define VERIFY(_x, _val, where) \
+ do { \
+ long __x = (long)_x, __val = (long)_val; \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s had value " \
+ "%ld \n", \
+ (where), (int)__LINE__, __FILE__, __x); \
+ } \
+ if ((__x) != (__val)) { \
+ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
+ "in %s\n", \
+ (where), __val, __x, (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+ } while (0)
/* Used to make certain a (non-'long' type's) return value _is_ a value */
-#define VERIFY_TYPE(_x, _val, _type, _format, where) do { \
- _type __x = (_type)_x, __val = (_type)_val; \
- if(VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s had value " \
- _format " \n", (where), (int)__LINE__, __FILE__, __x); \
- } \
- if((__x) != (__val)) { \
- TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format " at line %4d " \
- "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
-} while(0)
+#define VERIFY_TYPE(_x, _val, _type, _format, where) \
+ do { \
+ _type __x = (_type)_x, __val = (_type)_val; \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s had value " _format " \n", (where), \
+ (int)__LINE__, __FILE__, __x); \
+ } \
+ if ((__x) != (__val)) { \
+ TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format \
+ " at line %4d " \
+ "in %s\n", \
+ (where), __val, __x, (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+ } while (0)
/* Used to make certain a string return value _is_ a value */
-#define VERIFY_STR(x, val, where) do { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s had value " \
- "%s \n", (where), (int)__LINE__, __FILE__, x); \
- } \
- if (HDstrcmp(x, val)) { \
- TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \
- "in %s\n", where, val, x, (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
-} while(0)
+#define VERIFY_STR(x, val, where) \
+ do { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s had value " \
+ "%s \n", \
+ (where), (int)__LINE__, __FILE__, x); \
+ } \
+ if (HDstrcmp(x, val)) { \
+ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \
+ "in %s\n", \
+ where, val, x, (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+ } while (0)
/* Used to document process through a test and to check for errors */
-#define RESULT(ret,func) do { \
- if (VERBOSE_MED) { \
- print_func(" Call to routine: %15s at line %4d in %s returned " \
- "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
- } \
- if (VERBOSE_HI) \
- H5Eprint2(H5E_DEFAULT, stdout); \
- if ((ret) == FAIL) { \
- TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
-} while(0)
+#define RESULT(ret, func) \
+ do { \
+ if (VERBOSE_MED) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned " \
+ "%ld\n", \
+ func, (int)__LINE__, __FILE__, (long)(ret)); \
+ } \
+ if (VERBOSE_HI) \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ if ((ret) == FAIL) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", \
+ func, (long)(ret), (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+ } while (0)
/* Used to document process through a test */
#if defined(H5_HAVE_PARALLEL) && defined(H5_PARALLEL_TEST)
-#define MESSAGE(V,A) { \
- int mpi_rank; \
- \
- MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \
- if(mpi_rank == 0 && HDGetTestVerbosity() > (V)) \
- print_func A ; \
-}
+#define MESSAGE(V, A) \
+ { \
+ int mpi_rank; \
+ \
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \
+ if (mpi_rank == 0 && HDGetTestVerbosity() > (V)) \
+ print_func A; \
+ }
#else /* H5_HAVE_PARALLEL */
-#define MESSAGE(V,A) {if (HDGetTestVerbosity() > (V)) print_func A;}
+#define MESSAGE(V, A) \
+ { \
+ if (HDGetTestVerbosity() > (V)) \
+ print_func A; \
+ }
#endif /* H5_HAVE_PARALLEL */
/* Used to indicate an error that is complex to check for */
-#define ERROR(where) do { \
- if(VERBOSE_HI) \
- print_func(" Call to routine: %15s at line %4d in %s returned " \
- "invalid result\n", where, (int)__LINE__, __FILE__); \
- TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", \
- where, (int)__LINE__, __FILE__); \
-} while(0)
+#define ERROR(where) \
+ do { \
+ if (VERBOSE_HI) \
+ print_func(" Call to routine: %15s at line %4d in %s returned " \
+ "invalid result\n", \
+ where, (int)__LINE__, __FILE__); \
+ TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", where, (int)__LINE__, __FILE__); \
+ } while (0)
/* definitions for command strings */
-#define VERBOSITY_STR "Verbosity"
-#define SKIP_STR "Skip"
-#define TEST_STR "Test"
-#define CLEAN_STR "Cleanup"
+#define VERBOSITY_STR "Verbosity"
+#define SKIP_STR "Skip"
+#define TEST_STR "Test"
+#define CLEAN_STR "Cleanup"
#ifdef __cplusplus
extern "C" {
diff --git a/test/testmeta.c b/test/testmeta.c
index 9a40e6f..fee1954 100644
--- a/test/testmeta.c
+++ b/test/testmeta.c
@@ -22,35 +22,35 @@
* but the H5Gcreate2 error does not.
*/
-
#include "h5test.h"
-#define FILEN "testmeta.h5"
+#define FILEN "testmeta.h5"
-#define CHUNK_SIZE 512
+#define CHUNK_SIZE 512
-#define NDATAARRAYS 3
+#define NDATAARRAYS 3
/*#define NPOINTS 2048*/
-#define NPOINTS 20
-#define NEXTARRAYS 10
-#define NDATAOBJECTS 100000
+#define NPOINTS 20
+#define NEXTARRAYS 10
+#define NDATAOBJECTS 100000
-int main(void)
+int
+main(void)
{
- hid_t file_id, prop_id, memspace_id, type_id;
- hid_t group_id;
- hid_t dataset_id, dataspace_id;
- herr_t status;
- hsize_t dims[1];
- hsize_t maxdims[1];
- float data[NPOINTS];
- float floatval;
- unsigned numdataobj = 0;
- unsigned i, j;
- char name[80];
- hsize_t start[1] = {0};
- hsize_t stride[1] = {1};
- hsize_t count[1] = {1};
+ hid_t file_id, prop_id, memspace_id, type_id;
+ hid_t group_id;
+ hid_t dataset_id, dataspace_id;
+ herr_t status;
+ hsize_t dims[1];
+ hsize_t maxdims[1];
+ float data[NPOINTS];
+ float floatval;
+ unsigned numdataobj = 0;
+ unsigned i, j;
+ char name[80];
+ hsize_t start[1] = {0};
+ hsize_t stride[1] = {1};
+ hsize_t count[1] = {1};
/* Create a file */
file_id = H5Fcreate(FILEN, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -60,8 +60,8 @@ int main(void)
dataspace_id = H5Screate(H5S_SCALAR);
/* Create dataset */
- dataset_id = H5Dcreate2(file_id, "/NumDataObj",
- H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset_id = H5Dcreate2(file_id, "/NumDataObj", H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
/* Write value to NumDataObj dataset */
status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj);
@@ -74,17 +74,18 @@ int main(void)
/* Set up for extendible dataset */
prop_id = H5Pcreate(H5P_DATASET_CREATE);
dims[0] = CHUNK_SIZE;
- status = H5Pset_chunk(prop_id, 1, dims);
+ status = H5Pset_chunk(prop_id, 1, dims);
/* Create dataspace */
- dims[0] = 1;
- maxdims[0] = H5S_UNLIMITED;
+ dims[0] = 1;
+ maxdims[0] = H5S_UNLIMITED;
dataspace_id = H5Screate_simple(1, dims, maxdims);
- for(i = 0; i < NEXTARRAYS; i++) {
+ for (i = 0; i < NEXTARRAYS; i++) {
/* Create dataset */
sprintf(name, "/ExtArray%06d", i);
- dataset_id = H5Dcreate2(file_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT);
+ dataset_id =
+ H5Dcreate2(file_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT);
/* Close the identifier */
status = H5Dclose(dataset_id);
@@ -98,7 +99,7 @@ int main(void)
group_id = H5Gcreate2(file_id, "/DataArray", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(group_id);
- for(j = 0; j < NDATAOBJECTS; j++) {
+ for (j = 0; j < NDATAOBJECTS; j++) {
/* Removed print statement as it would lock system resources on Windows */
/*
* HDprintf("\rWriting Object #%d of %d", j+1, NDATAOBJECTS);
@@ -109,23 +110,24 @@ int main(void)
/* Create group to hold data arrays for this object */
HDsprintf(name, "/DataArray/%06d", j);
group_id = H5Gcreate2(file_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(group_id < 0) {
+ if (group_id < 0) {
HDfprintf(stderr, "Failed to create DataArray group.\n");
status = H5Fclose(file_id);
return -1;
}
/* Loop over data arrays */
- for(i = 0; i < NDATAARRAYS; i++) {
+ for (i = 0; i < NDATAARRAYS; i++) {
/* Create dataspace */
- dims[0]=NPOINTS;
- maxdims[0]=NPOINTS;
- dataspace_id = H5Screate_simple(1 ,dims, maxdims);
+ dims[0] = NPOINTS;
+ maxdims[0] = NPOINTS;
+ dataspace_id = H5Screate_simple(1, dims, maxdims);
/* Create dataset */
HDsprintf(name, "DataArray%06d", i);
- dataset_id = H5Dcreate2(group_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dataset_id < 0) {
+ dataset_id = H5Dcreate2(group_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
+ if (dataset_id < 0) {
HDfprintf(stderr, "Failed to create DataArray dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -133,7 +135,7 @@ int main(void)
/* Write the data array data */
status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- if(status < 0) {
+ if (status < 0) {
HDfprintf(stderr, "Failed to write DataArray dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -146,7 +148,7 @@ int main(void)
/* Open NumDataObj dataset */
dataset_id = H5Dopen2(file_id, "/NumDataObj", H5P_DEFAULT);
- if(dataset_id < 0) {
+ if (dataset_id < 0) {
HDfprintf(stderr, "Failed to open NumDataObj dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -154,8 +156,8 @@ int main(void)
/* Write value to NumDataObj dataset */
numdataobj = j + 1;
- status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj);
- if(status < 0) {
+ status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj);
+ if (status < 0) {
HDfprintf(stderr, "Failed to write NumDataObj dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -166,11 +168,11 @@ int main(void)
status = H5Gclose(group_id);
/* Extend attribute arrays */
- for(i = 0; i < NEXTARRAYS; i++) {
+ for (i = 0; i < NEXTARRAYS; i++) {
/* Open extendable dataset */
HDsprintf(name, "/ExtArray%06d", i);
dataset_id = H5Dopen2(file_id, name, H5P_DEFAULT);
- if(dataset_id < 0) {
+ if (dataset_id < 0) {
HDfprintf(stderr, "Failed to open ExtArray dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -178,25 +180,25 @@ int main(void)
/* Extend attribute dataset */
dims[0] = (hsize_t)j + 1;
- status = H5Dset_extent(dataset_id, dims);
- if(status < 0) {
+ status = H5Dset_extent(dataset_id, dims);
+ if (status < 0) {
HDfprintf(stderr, "Failed to extend DataArray dataset.\n");
status = H5Fclose(file_id);
return -1;
} /* end if */
/* Select element and write value to attribute dataset */
- dims[0] = 1;
- memspace_id = H5Screate_simple(1, dims, dims);
+ dims[0] = 1;
+ memspace_id = H5Screate_simple(1, dims, dims);
dataspace_id = H5Dget_space(dataset_id);
- type_id = H5Dget_type(dataset_id);
+ type_id = H5Dget_type(dataset_id);
start[0] = 0;
- status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, start, stride, count, NULL);
+ status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, start, stride, count, NULL);
start[0] = (hssize_t)j;
- status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, stride, count, NULL);
- status = H5Dwrite(dataset_id, type_id, memspace_id, dataspace_id, H5P_DEFAULT, &floatval);
- if(status < 0) {
+ status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, stride, count, NULL);
+ status = H5Dwrite(dataset_id, type_id, memspace_id, dataspace_id, H5P_DEFAULT, &floatval);
+ if (status < 0) {
HDfprintf(stderr, "Failed to write DataArray dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -210,7 +212,6 @@ int main(void)
}
}
-
/* Close the file */
status = H5Fclose(file_id);
@@ -218,4 +219,3 @@ int main(void)
return 0;
}
-
diff --git a/test/tfile.c b/test/tfile.c
index e7dfcbe..2d42cc5 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -12,136 +12,136 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tfile
-*
-* Test the low-level file I/O features.
-*
-*************************************************************/
+ *
+ * Test program: tfile
+ *
+ * Test the low-level file I/O features.
+ *
+ *************************************************************/
#include "testhdf5.h"
#include "H5srcdir.h"
#include "H5Iprivate.h"
#include "H5Pprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5private.h"
/*
* This file needs to access private information from the H5F package.
* This file also needs to access the file testing code.
*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
-#include "H5Dpkg.h" /* Dataset access */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#include "H5Dpkg.h" /* Dataset access */
-#define H5S_FRIEND /*suppress error about including H5Spkg */
-#include "H5Spkg.h" /* Dataspace */
+#define H5S_FRIEND /*suppress error about including H5Spkg */
+#include "H5Spkg.h" /* Dataspace */
-#define H5T_FRIEND /*suppress error about including H5Tpkg */
-#include "H5Tpkg.h" /* Datatype */
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#include "H5Tpkg.h" /* Datatype */
-#define H5A_FRIEND /*suppress error about including H5Apkg */
-#include "H5Apkg.h" /* Attributes */
+#define H5A_FRIEND /*suppress error about including H5Apkg */
+#include "H5Apkg.h" /* Attributes */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
-#include "H5Opkg.h" /* Object headers */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#include "H5Opkg.h" /* Object headers */
-#define BAD_USERBLOCK_SIZE1 (hsize_t)1
-#define BAD_USERBLOCK_SIZE2 (hsize_t)2
-#define BAD_USERBLOCK_SIZE3 (hsize_t)3
-#define BAD_USERBLOCK_SIZE4 (hsize_t)64
-#define BAD_USERBLOCK_SIZE5 (hsize_t)511
-#define BAD_USERBLOCK_SIZE6 (hsize_t)513
-#define BAD_USERBLOCK_SIZE7 (hsize_t)6144
+#define BAD_USERBLOCK_SIZE1 (hsize_t)1
+#define BAD_USERBLOCK_SIZE2 (hsize_t)2
+#define BAD_USERBLOCK_SIZE3 (hsize_t)3
+#define BAD_USERBLOCK_SIZE4 (hsize_t)64
+#define BAD_USERBLOCK_SIZE5 (hsize_t)511
+#define BAD_USERBLOCK_SIZE6 (hsize_t)513
+#define BAD_USERBLOCK_SIZE7 (hsize_t)6144
-#define F1_USERBLOCK_SIZE (hsize_t)0
-#define F1_OFFSET_SIZE sizeof(haddr_t)
-#define F1_LENGTH_SIZE sizeof(hsize_t)
-#define F1_SYM_LEAF_K 4
-#define F1_SYM_INTERN_K 16
-#define FILE1 "tfile1.h5"
-#define SFILE1 "sys_file1"
+#define F1_USERBLOCK_SIZE (hsize_t)0
+#define F1_OFFSET_SIZE sizeof(haddr_t)
+#define F1_LENGTH_SIZE sizeof(hsize_t)
+#define F1_SYM_LEAF_K 4
+#define F1_SYM_INTERN_K 16
+#define FILE1 "tfile1.h5"
+#define SFILE1 "sys_file1"
#define REOPEN_FILE "tfile_reopen.h5"
#define REOPEN_DSET "dset"
-#define F2_USERBLOCK_SIZE (hsize_t)512
-#define F2_OFFSET_SIZE 8
-#define F2_LENGTH_SIZE 8
-#define F2_SYM_LEAF_K 8
-#define F2_SYM_INTERN_K 32
-#define F2_RANK 2
-#define F2_DIM0 4
-#define F2_DIM1 6
-#define F2_DSET "dset"
-#define FILE2 "tfile2.h5"
-
-#define F3_USERBLOCK_SIZE (hsize_t)0
-#define F3_OFFSET_SIZE F2_OFFSET_SIZE
-#define F3_LENGTH_SIZE F2_LENGTH_SIZE
-#define F3_SYM_LEAF_K F2_SYM_LEAF_K
-#define F3_SYM_INTERN_K F2_SYM_INTERN_K
-#define FILE3 "tfile3.h5"
-
-#define GRP_NAME "/group"
-#define DSET_NAME "dataset"
-#define ATTR_NAME "attr"
-#define TYPE_NAME "type"
-#define FILE4 "tfile4.h5"
-
-#define OBJ_ID_COUNT_0 0
-#define OBJ_ID_COUNT_1 1
-#define OBJ_ID_COUNT_2 2
-#define OBJ_ID_COUNT_3 3
-#define OBJ_ID_COUNT_4 4
-#define OBJ_ID_COUNT_6 6
-#define OBJ_ID_COUNT_8 8
-
-#define GROUP1 "Group1"
-#define DSET1 "Dataset1"
-#define DSET2 "/Group1/Dataset2"
-
-#define TESTA_GROUPNAME "group"
-#define TESTA_DSETNAME "dataset"
-#define TESTA_ATTRNAME "attribute"
-#define TESTA_DTYPENAME "compound"
-#define TESTA_NAME_BUF_SIZE 64
-#define TESTA_RANK 2
-#define TESTA_NX 4
-#define TESTA_NY 5
-
-#define USERBLOCK_SIZE ((hsize_t) 512)
+#define F2_USERBLOCK_SIZE (hsize_t)512
+#define F2_OFFSET_SIZE 8
+#define F2_LENGTH_SIZE 8
+#define F2_SYM_LEAF_K 8
+#define F2_SYM_INTERN_K 32
+#define F2_RANK 2
+#define F2_DIM0 4
+#define F2_DIM1 6
+#define F2_DSET "dset"
+#define FILE2 "tfile2.h5"
+
+#define F3_USERBLOCK_SIZE (hsize_t)0
+#define F3_OFFSET_SIZE F2_OFFSET_SIZE
+#define F3_LENGTH_SIZE F2_LENGTH_SIZE
+#define F3_SYM_LEAF_K F2_SYM_LEAF_K
+#define F3_SYM_INTERN_K F2_SYM_INTERN_K
+#define FILE3 "tfile3.h5"
+
+#define GRP_NAME "/group"
+#define DSET_NAME "dataset"
+#define ATTR_NAME "attr"
+#define TYPE_NAME "type"
+#define FILE4 "tfile4.h5"
+
+#define OBJ_ID_COUNT_0 0
+#define OBJ_ID_COUNT_1 1
+#define OBJ_ID_COUNT_2 2
+#define OBJ_ID_COUNT_3 3
+#define OBJ_ID_COUNT_4 4
+#define OBJ_ID_COUNT_6 6
+#define OBJ_ID_COUNT_8 8
+
+#define GROUP1 "Group1"
+#define DSET1 "Dataset1"
+#define DSET2 "/Group1/Dataset2"
+
+#define TESTA_GROUPNAME "group"
+#define TESTA_DSETNAME "dataset"
+#define TESTA_ATTRNAME "attribute"
+#define TESTA_DTYPENAME "compound"
+#define TESTA_NAME_BUF_SIZE 64
+#define TESTA_RANK 2
+#define TESTA_NX 4
+#define TESTA_NY 5
+
+#define USERBLOCK_SIZE ((hsize_t)512)
/* Declarations for test_filespace_*() */
-#define FILENAME_LEN 1024 /* length of file name */
-#define DSETNAME "dset" /* Name of dataset */
-#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
-#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */
-#define FILE5 "tfile5.h5" /* Test file */
-#define TEST_THRESHOLD10 10 /* Free space section threshold */
-#define FSP_SIZE_DEF 4096 /* File space page size default */
-#define FSP_SIZE512 512 /* File space page size */
-#define FSP_SIZE1G 1024*1024*1024 /* File space page size */
+#define FILENAME_LEN 1024 /* length of file name */
+#define DSETNAME "dset" /* Name of dataset */
+#define NELMTS(X) (sizeof(X) / sizeof(X[0])) /* # of elements */
+#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */
+#define FILE5 "tfile5.h5" /* Test file */
+#define TEST_THRESHOLD10 10 /* Free space section threshold */
+#define FSP_SIZE_DEF 4096 /* File space page size default */
+#define FSP_SIZE512 512 /* File space page size */
+#define FSP_SIZE1G 1024 * 1024 * 1024 /* File space page size */
/* Declaration for test_libver_macros2() */
-#define FILE6 "tfile6.h5" /* Test file */
+#define FILE6 "tfile6.h5" /* Test file */
/* Declaration for test_get_obj_ids() */
-#define FILE7 "tfile7.h5" /* Test file */
-#define NGROUPS 2
-#define NDSETS 4
+#define FILE7 "tfile7.h5" /* Test file */
+#define NGROUPS 2
+#define NDSETS 4
/* Declaration for test_incr_filesize() */
-#define FILE8 "tfile8.h5" /* Test file */
+#define FILE8 "tfile8.h5" /* Test file */
/* Files created under 1.6 branch and 1.8 branch--used in test_filespace_compatible() */
const char *OLD_FILENAME[] = {
- "filespace_1_6.h5", /* 1.6 HDF5 file */
- "filespace_1_8.h5" /* 1.8 HDF5 file */
+ "filespace_1_6.h5", /* 1.6 HDF5 file */
+ "filespace_1_8.h5" /* 1.8 HDF5 file */
};
/* Files created in 1.10.0 release --used in test_filespace_1.10.0_compatible() */
@@ -157,27 +157,23 @@ const char *OLD_1_10_0_FILENAME[] = {
/* Files used in test_filespace_round_compatible() */
const char *FSPACE_FILENAMES[] = {
- "fsm_aggr_nopersist.h5", /* H5F_FILE_SPACE_AGGR, not persisting free-space */
- "fsm_aggr_persist.h5", /* H5F_FILE_SPACE_AGGR, persisting free-space */
- "paged_nopersist.h5", /* H5F_FILE_SPACE_PAGE, not persisting free-space */
- "paged_persist.h5", /* H5F_FILE_SPACE_PAGE, persisting free-space */
- "aggr.h5", /* H5F_FILE_SPACE_AGGR */
- "none.h5" /* H5F_FILE_SPACE_NONE */
-};
-
-const char *FILESPACE_NAME[] = {
- "tfilespace",
- NULL
+ "fsm_aggr_nopersist.h5", /* H5F_FILE_SPACE_AGGR, not persisting free-space */
+ "fsm_aggr_persist.h5", /* H5F_FILE_SPACE_AGGR, persisting free-space */
+ "paged_nopersist.h5", /* H5F_FILE_SPACE_PAGE, not persisting free-space */
+ "paged_persist.h5", /* H5F_FILE_SPACE_PAGE, persisting free-space */
+ "aggr.h5", /* H5F_FILE_SPACE_AGGR */
+ "none.h5" /* H5F_FILE_SPACE_NONE */
};
+const char *FILESPACE_NAME[] = {"tfilespace", NULL};
/* Declarations for test_libver_bounds_copy(): */
/* SRC_FILE: source file created under 1.8 branch with latest format */
/* DST_FILE: destination file for copying the dataset in SRC_FILE */
/* DSET_DS1: the dataset created in SRC_FILE to be copied to DST_FILE */
-#define SRC_FILE "fill18.h5"
-#define DST_FILE "fill18_copy.h5"
-#define DSET_DS1 "DS1"
+#define SRC_FILE "fill18.h5"
+#define DST_FILE "fill18_copy.h5"
+#define DSET_DS1 "DS1"
/* Local test function declarations for version bounds */
static void test_libver_bounds_low_high(void);
@@ -191,18 +187,15 @@ static void test_libver_bounds_datatype(hid_t fapl);
static void test_libver_bounds_datatype_check(hid_t fapl, hid_t tid);
static void test_libver_bounds_attributes(hid_t fapl);
-#define DSET_NULL "DSET_NULL"
-#define DSET "DSET"
-#define DSETA "DSETA"
-#define DSETB "DSETB"
-#define DSETC "DSETC"
+#define DSET_NULL "DSET_NULL"
+#define DSET "DSET"
+#define DSETA "DSETA"
+#define DSETB "DSETB"
+#define DSETC "DSETC"
-static void
-create_objects(hid_t, hid_t, hid_t *, hid_t *, hid_t *, hid_t *);
-static void
-test_obj_count_and_id(hid_t, hid_t, hid_t, hid_t, hid_t, hid_t);
-static void
-check_file_id(hid_t, hid_t);
+static void create_objects(hid_t, hid_t, hid_t *, hid_t *, hid_t *, hid_t *);
+static void test_obj_count_and_id(hid_t, hid_t, hid_t, hid_t, hid_t, hid_t);
+static void check_file_id(hid_t, hid_t);
/* Helper routine used by test_rw_noupdate() */
static int cal_chksum(const char *file, uint32_t *chksum);
@@ -217,14 +210,14 @@ static void test_rw_noupdate(void);
static void
test_file_create(void)
{
- hid_t fid1, fid2, fid3; /* HDF5 File IDs */
- hid_t tmpl1, tmpl2; /*file creation templates */
- hsize_t ublock; /*sizeof userblock */
- size_t parm; /*file-creation parameters */
- size_t parm2; /*file-creation parameters */
- unsigned iparm;
- unsigned iparm2;
- herr_t ret; /*generic return value */
+ hid_t fid1, fid2, fid3; /* HDF5 File IDs */
+ hid_t tmpl1, tmpl2; /*file creation templates */
+ hsize_t ublock; /*sizeof userblock */
+ size_t parm; /*file-creation parameters */
+ size_t parm2; /*file-creation parameters */
+ unsigned iparm;
+ unsigned iparm2;
+ herr_t ret; /*generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File Creation I/O\n"));
@@ -316,33 +309,26 @@ test_file_create(void)
CHECK(tmpl1, FAIL, "H5Pcreate");
/* Try setting some bad userblock sizes */
- H5E_BEGIN_TRY {
- ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE1);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE1); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_userblock");
- H5E_BEGIN_TRY {
- ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE2); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_userblock");
- H5E_BEGIN_TRY {
- ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE3);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE3); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_userblock");
- H5E_BEGIN_TRY {
- ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE4);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE4); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_userblock");
- H5E_BEGIN_TRY {
- ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE5);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE5); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_userblock");
- H5E_BEGIN_TRY {
- ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE6);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE6); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_userblock");
- H5E_BEGIN_TRY {
- ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE7);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE7); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_userblock");
/* Set the new file-creation parameters */
@@ -368,36 +354,37 @@ test_file_create(void)
/* Make certain we can create a dataset properly in the file with the userblock */
{
- hid_t dataset_id, dataspace_id; /* identifiers */
- hsize_t dims[F2_RANK];
- unsigned data[F2_DIM0][F2_DIM1];
- unsigned i,j;
-
- /* Create the data space for the dataset. */
- dims[0] = F2_DIM0;
- dims[1] = F2_DIM1;
- dataspace_id = H5Screate_simple(F2_RANK, dims, NULL);
- CHECK(dataspace_id, FAIL, "H5Screate_simple");
-
- /* Create the dataset. */
- dataset_id = H5Dcreate2(fid2, F2_DSET, H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset_id, FAIL, "H5Dcreate2");
-
- for(i = 0; i < F2_DIM0; i++)
- for(j = 0; j < F2_DIM1; j++)
- data[i][j] = i * 10 + j;
-
- /* Write data to the new dataset */
- ret = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- CHECK(ret, FAIL, "H5Dwrite");
-
- /* End access to the dataset and release resources used by it. */
- ret = H5Dclose(dataset_id);
- CHECK(ret, FAIL, "H5Dclose");
-
- /* Terminate access to the data space. */
- ret = H5Sclose(dataspace_id);
- CHECK(ret, FAIL, "H5Sclose");
+ hid_t dataset_id, dataspace_id; /* identifiers */
+ hsize_t dims[F2_RANK];
+ unsigned data[F2_DIM0][F2_DIM1];
+ unsigned i, j;
+
+ /* Create the data space for the dataset. */
+ dims[0] = F2_DIM0;
+ dims[1] = F2_DIM1;
+ dataspace_id = H5Screate_simple(F2_RANK, dims, NULL);
+ CHECK(dataspace_id, FAIL, "H5Screate_simple");
+
+ /* Create the dataset. */
+ dataset_id =
+ H5Dcreate2(fid2, F2_DSET, H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset_id, FAIL, "H5Dcreate2");
+
+ for (i = 0; i < F2_DIM0; i++)
+ for (j = 0; j < F2_DIM1; j++)
+ data[i][j] = i * 10 + j;
+
+ /* Write data to the new dataset */
+ ret = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* End access to the dataset and release resources used by it. */
+ ret = H5Dclose(dataset_id);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Terminate access to the data space. */
+ ret = H5Sclose(dataspace_id);
+ CHECK(ret, FAIL, "H5Sclose");
}
/* Get the file-creation template */
@@ -476,7 +463,7 @@ test_file_create(void)
/* Close third file */
ret = H5Fclose(fid3);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_file_create() */
+} /* test_file_create() */
/****************************************************************
**
@@ -486,17 +473,17 @@ test_file_create(void)
static void
test_file_open(void)
{
- hid_t fid1, fid2; /*HDF5 File IDs */
- hid_t did; /*dataset ID */
- hid_t fapl_id; /*file access property list ID */
- hid_t tmpl1; /*file creation templates */
- hsize_t ublock; /*sizeof user block */
- size_t parm; /*file-creation parameters */
- size_t parm2; /*file-creation parameters */
- unsigned iparm;
- unsigned iparm2;
- unsigned intent;
- herr_t ret; /*generic return value */
+ hid_t fid1, fid2; /*HDF5 File IDs */
+ hid_t did; /*dataset ID */
+ hid_t fapl_id; /*file access property list ID */
+ hid_t tmpl1; /*file creation templates */
+ hsize_t ublock; /*sizeof user block */
+ size_t parm; /*file-creation parameters */
+ size_t parm2; /*file-creation parameters */
+ unsigned iparm;
+ unsigned iparm2;
+ unsigned intent;
+ herr_t ret; /*generic return value */
/*
* Test single file open
@@ -541,7 +528,6 @@ test_file_open(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/*
* Test two file opens: one is opened H5F_ACC_RDONLY and H5F_CLOSE_WEAK.
* It's closed with an object left open. Then another is opened
@@ -594,7 +580,7 @@ test_file_open(void)
ret = H5Pclose(fapl_id);
CHECK(ret, FAIL, "H5Pclose");
-} /* test_file_open() */
+} /* test_file_open() */
/****************************************************************
**
@@ -604,12 +590,12 @@ test_file_open(void)
static void
test_file_reopen(void)
{
- hid_t fid = -1; /* file ID from initial open */
- hid_t rfid = -1; /* file ID from reopen */
- hid_t did = -1; /* dataset ID (both opens) */
- hid_t sid = -1; /* dataspace ID for dataset creation */
- hsize_t dims = 6; /* dataspace size */
- herr_t ret; /* Generic return value */
+ hid_t fid = -1; /* file ID from initial open */
+ hid_t rfid = -1; /* file ID from reopen */
+ hid_t did = -1; /* dataset ID (both opens) */
+ hid_t sid = -1; /* dataspace ID for dataset creation */
+ hsize_t dims = 6; /* dataspace size */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing File Re-opening\n"));
@@ -647,7 +633,7 @@ test_file_reopen(void)
CHECK(ret, FAIL, "H5Fclose");
HDremove(REOPEN_FILE);
-} /* test_file_reopen() */
+} /* test_file_reopen() */
/****************************************************************
**
@@ -658,11 +644,11 @@ test_file_reopen(void)
static void
test_file_close(void)
{
- hid_t fid1, fid2;
- hid_t fapl_id, access_id;
- hid_t dataset_id, group_id1, group_id2, group_id3;
- H5F_close_degree_t fc_degree;
- herr_t ret;
+ hid_t fid1, fid2;
+ hid_t fapl_id, access_id;
+ hid_t dataset_id, group_id1, group_id2, group_id3;
+ H5F_close_degree_t fc_degree;
+ herr_t ret;
/* Test behavior while opening file multiple times with different
* file close degree value
@@ -698,7 +684,6 @@ test_file_close(void)
ret = H5Fclose(fid2);
CHECK(ret, FAIL, "H5Fclose");
-
/* Test behavior while opening file multiple times with different file
* close degree
*/
@@ -723,7 +708,6 @@ test_file_close(void)
ret = H5Fclose(fid2);
CHECK(ret, FAIL, "H5Fclose");
-
/* Test behavior while opening file multiple times with file close
* degree STRONG */
ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG);
@@ -757,7 +741,6 @@ test_file_close(void)
ret = H5Fclose(fid2);
CHECK(ret, FAIL, "H5Fclose");
-
/* Test behavior while opening file multiple times with file close
* degree SEMI */
ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI);
@@ -822,7 +805,6 @@ test_file_close(void)
ret = H5Fclose(fid2);
CHECK(ret, FAIL, "H5Fclose");
-
/* Test behavior while opening file multiple times with file close
* degree WEAK */
ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_WEAK);
@@ -849,8 +831,7 @@ test_file_close(void)
create_objects(fid1, fid2, &dataset_id, &group_id1, &group_id2, &group_id3);
/* Create more new files and test object count and ID list functions */
- test_obj_count_and_id(fid1, fid2, dataset_id, group_id1,
- group_id2, group_id3);
+ test_obj_count_and_id(fid1, fid2, dataset_id, group_id1, group_id2, group_id3);
/* Close first open */
ret = H5Fclose(fid1);
@@ -873,7 +854,6 @@ test_file_close(void)
ret = H5Gclose(group_id3);
CHECK(ret, FAIL, "H5Gclose");
-
/* Test behavior while opening file multiple times with file close
* degree DEFAULT */
ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_DEFAULT);
@@ -902,10 +882,10 @@ test_file_close(void)
access_id = H5Fget_access_plist(fid1);
CHECK(access_id, FAIL, "H5Fget_access_plist");
- ret= H5Pget_fclose_degree(access_id, &fc_degree);
+ ret = H5Pget_fclose_degree(access_id, &fc_degree);
CHECK(ret, FAIL, "H5Pget_fclose_degree");
- switch(fc_degree) {
+ switch (fc_degree) {
case H5F_CLOSE_STRONG:
/* Close first open */
ret = H5Fclose(fid1);
@@ -966,83 +946,83 @@ test_file_close(void)
**
****************************************************************/
static void
-create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1,
- hid_t *ret_gid2, hid_t *ret_gid3)
+create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, hid_t *ret_gid2, hid_t *ret_gid3)
{
- ssize_t oid_count;
- herr_t ret;
+ ssize_t oid_count;
+ herr_t ret;
/* Check reference counts of file IDs and opened object IDs.
* The verification is hard-coded. If in any case, this testing
* is changed, remember to check this part and update the macros.
*/
{
- oid_count = H5Fget_obj_count(fid1, H5F_OBJ_ALL);
- CHECK(oid_count, FAIL, "H5Fget_obj_count");
- VERIFY(oid_count, OBJ_ID_COUNT_2, "H5Fget_obj_count");
+ oid_count = H5Fget_obj_count(fid1, H5F_OBJ_ALL);
+ CHECK(oid_count, FAIL, "H5Fget_obj_count");
+ VERIFY(oid_count, OBJ_ID_COUNT_2, "H5Fget_obj_count");
- oid_count = H5Fget_obj_count(fid1, H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR);
- CHECK(oid_count, FAIL, "H5Fget_obj_count");
- VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count");
+ oid_count = H5Fget_obj_count(fid1, H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR);
+ CHECK(oid_count, FAIL, "H5Fget_obj_count");
+ VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count");
- oid_count = H5Fget_obj_count(fid2, H5F_OBJ_ALL);
- CHECK(oid_count, FAIL, "H5Fget_obj_count");
- VERIFY(oid_count, OBJ_ID_COUNT_2, "H5Fget_obj_count");
+ oid_count = H5Fget_obj_count(fid2, H5F_OBJ_ALL);
+ CHECK(oid_count, FAIL, "H5Fget_obj_count");
+ VERIFY(oid_count, OBJ_ID_COUNT_2, "H5Fget_obj_count");
- oid_count = H5Fget_obj_count(fid2, H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR);
- CHECK(oid_count, FAIL, "H5Fget_obj_count");
- VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count");
+ oid_count = H5Fget_obj_count(fid2, H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR);
+ CHECK(oid_count, FAIL, "H5Fget_obj_count");
+ VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count");
}
/* create a dataset in the first file open */
{
- hid_t dataset_id, dataspace_id; /* identifiers */
- hsize_t dims[F2_RANK];
- unsigned data[F2_DIM0][F2_DIM1];
- unsigned i,j;
-
- /* Create the data space for the dataset. */
- dims[0] = F2_DIM0;
- dims[1] = F2_DIM1;
- dataspace_id = H5Screate_simple(F2_RANK, dims, NULL);
- CHECK(dataspace_id, FAIL, "H5Screate_simple");
-
- /* Create the dataset. */
- dataset_id = H5Dcreate2(fid1, "/dset", H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset_id, FAIL, "H5Dcreate2");
-
- for(i = 0; i < F2_DIM0; i++)
- for(j = 0; j < F2_DIM1; j++)
- data[i][j] = i * 10 + j;
-
- /* Write data to the new dataset */
- ret = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- CHECK(ret, FAIL, "H5Dwrite");
-
- if(ret_did != NULL)
- *ret_did = dataset_id;
-
- /* Terminate access to the data space. */
- ret = H5Sclose(dataspace_id);
- CHECK(ret, FAIL, "H5Sclose");
+ hid_t dataset_id, dataspace_id; /* identifiers */
+ hsize_t dims[F2_RANK];
+ unsigned data[F2_DIM0][F2_DIM1];
+ unsigned i, j;
+
+ /* Create the data space for the dataset. */
+ dims[0] = F2_DIM0;
+ dims[1] = F2_DIM1;
+ dataspace_id = H5Screate_simple(F2_RANK, dims, NULL);
+ CHECK(dataspace_id, FAIL, "H5Screate_simple");
+
+ /* Create the dataset. */
+ dataset_id =
+ H5Dcreate2(fid1, "/dset", H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset_id, FAIL, "H5Dcreate2");
+
+ for (i = 0; i < F2_DIM0; i++)
+ for (j = 0; j < F2_DIM1; j++)
+ data[i][j] = i * 10 + j;
+
+ /* Write data to the new dataset */
+ ret = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ if (ret_did != NULL)
+ *ret_did = dataset_id;
+
+ /* Terminate access to the data space. */
+ ret = H5Sclose(dataspace_id);
+ CHECK(ret, FAIL, "H5Sclose");
}
/* Create a group in the second file open */
{
- hid_t gid1, gid2, gid3;
+ hid_t gid1, gid2, gid3;
gid1 = H5Gcreate2(fid2, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid1, FAIL, "H5Gcreate2");
- if(ret_gid1 != NULL)
+ if (ret_gid1 != NULL)
*ret_gid1 = gid1;
gid2 = H5Gopen2(fid2, "/group", H5P_DEFAULT);
CHECK(gid2, FAIL, "H5Gopen2");
- if(ret_gid2 != NULL)
+ if (ret_gid2 != NULL)
*ret_gid2 = gid2;
gid3 = H5Gopen2(fid2, "/group", H5P_DEFAULT);
CHECK(gid3, FAIL, "H5Gopen2");
- if(ret_gid3 != NULL)
+ if (ret_gid3 != NULL)
*ret_gid3 = gid3;
}
@@ -1051,21 +1031,21 @@ create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1,
* is changed, remember to check this part and update the macros.
*/
{
- oid_count = H5Fget_obj_count(fid1, H5F_OBJ_ALL);
- CHECK(oid_count, FAIL, "H5Fget_obj_count");
- VERIFY(oid_count, OBJ_ID_COUNT_6, "H5Fget_obj_count");
+ oid_count = H5Fget_obj_count(fid1, H5F_OBJ_ALL);
+ CHECK(oid_count, FAIL, "H5Fget_obj_count");
+ VERIFY(oid_count, OBJ_ID_COUNT_6, "H5Fget_obj_count");
- oid_count = H5Fget_obj_count(fid1, H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR);
- CHECK(oid_count, FAIL, "H5Fget_obj_count");
- VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count");
+ oid_count = H5Fget_obj_count(fid1, H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR);
+ CHECK(oid_count, FAIL, "H5Fget_obj_count");
+ VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count");
- oid_count = H5Fget_obj_count(fid2, H5F_OBJ_ALL);
- CHECK(oid_count, FAIL, "H5Fget_obj_count");
- VERIFY(oid_count, OBJ_ID_COUNT_6, "H5Fget_obj_count");
+ oid_count = H5Fget_obj_count(fid2, H5F_OBJ_ALL);
+ CHECK(oid_count, FAIL, "H5Fget_obj_count");
+ VERIFY(oid_count, OBJ_ID_COUNT_6, "H5Fget_obj_count");
- oid_count = H5Fget_obj_count(fid2, H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR);
- CHECK(oid_count, FAIL, "H5Fget_obj_count");
- VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count");
+ oid_count = H5Fget_obj_count(fid2, H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR);
+ CHECK(oid_count, FAIL, "H5Fget_obj_count");
+ VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count");
}
}
@@ -1080,35 +1060,35 @@ create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1,
static void
test_get_obj_ids(void)
{
- hid_t fid, gid[NGROUPS], dset[NDSETS];
- hid_t filespace;
- hsize_t file_dims[F2_RANK] = {F2_DIM0, F2_DIM1};
- ssize_t oid_count, ret_count;
- hid_t *oid_list = NULL;
- herr_t ret;
- int i, m, n;
+ hid_t fid, gid[NGROUPS], dset[NDSETS];
+ hid_t filespace;
+ hsize_t file_dims[F2_RANK] = {F2_DIM0, F2_DIM1};
+ ssize_t oid_count, ret_count;
+ hid_t * oid_list = NULL;
+ herr_t ret;
+ int i, m, n;
ssize_t oid_list_size = NDSETS;
- char gname[64], dname[64];
+ char gname[64], dname[64];
/* Create a new file */
fid = H5Fcreate(FILE7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
- filespace = H5Screate_simple(F2_RANK, file_dims, NULL);
+ filespace = H5Screate_simple(F2_RANK, file_dims, NULL);
CHECK(filespace, FAIL, "H5Screate_simple");
/* creates NGROUPS groups under the root group */
- for(m = 0; m < NGROUPS; m++) {
+ for (m = 0; m < NGROUPS; m++) {
HDsprintf(gname, "group%d", m);
gid[m] = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid[m], FAIL, "H5Gcreate2");
}
/* create NDSETS datasets under the root group */
- for(n = 0; n < NDSETS; n++) {
- HDsprintf(dname, "dataset%d", n);
- dset[n] = H5Dcreate2(fid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset[n], FAIL, "H5Dcreate2");
+ for (n = 0; n < NDSETS; n++) {
+ HDsprintf(dname, "dataset%d", n);
+ dset[n] = H5Dcreate2(fid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset[n], FAIL, "H5Dcreate2");
}
/* The number of opened objects should be NGROUPS + NDSETS + 1. One is opened file. */
@@ -1128,8 +1108,8 @@ test_get_obj_ids(void)
/* Close all object IDs on the list except the file ID. The first ID is supposed to be file ID according
* to the library design */
- for(i = 0; i< ret_count; i++) {
- if(fid != oid_list[i]) {
+ for (i = 0; i < ret_count; i++) {
+ if (fid != oid_list[i]) {
ret = H5Oclose(oid_list[i]);
CHECK(ret, FAIL, "H5Oclose");
}
@@ -1147,8 +1127,8 @@ test_get_obj_ids(void)
VERIFY(ret_count, oid_list_size, "H5Fget_obj_count");
/* Close all object IDs on the list except the file ID. The first ID is still the file ID */
- for(i = 0; i< ret_count; i++) {
- if(fid != oid_list[i]) {
+ for (i = 0; i < ret_count; i++) {
+ if (fid != oid_list[i]) {
ret = H5Oclose(oid_list[i]);
CHECK(ret, FAIL, "H5Oclose");
}
@@ -1165,10 +1145,10 @@ test_get_obj_ids(void)
CHECK(fid, FAIL, "H5Fopen");
/* Open NDSETS datasets under the root group */
- for(n = 0; n < NDSETS; n++) {
- HDsprintf(dname, "dataset%d", n);
- dset[n] = H5Dopen2(fid, dname, H5P_DEFAULT);
- CHECK(dset[n], FAIL, "H5Dcreate2");
+ for (n = 0; n < NDSETS; n++) {
+ HDsprintf(dname, "dataset%d", n);
+ dset[n] = H5Dopen2(fid, dname, H5P_DEFAULT);
+ CHECK(dset[n], FAIL, "H5Dcreate2");
}
/* Close the file first */
@@ -1188,8 +1168,8 @@ test_get_obj_ids(void)
VERIFY(ret_count, NDSETS, "H5Fget_obj_count");
/* Close all open objects with H5Oclose */
- for(n = 0; n < oid_count; n++)
- H5Oclose(oid_list[n]);
+ for (n = 0; n < oid_count; n++)
+ H5Oclose(oid_list[n]);
HDfree(oid_list);
}
@@ -1202,12 +1182,12 @@ test_get_obj_ids(void)
static void
test_get_file_id(void)
{
- hid_t fid, fid2, fid3;
- hid_t datatype_id, dataset_id, dataspace_id, group_id, attr_id;
- hid_t plist;
- hsize_t dims[F2_RANK];
- unsigned intent;
- herr_t ret;
+ hid_t fid, fid2, fid3;
+ hid_t datatype_id, dataset_id, dataspace_id, group_id, attr_id;
+ hid_t plist;
+ hsize_t dims[F2_RANK];
+ unsigned intent;
+ herr_t ret;
/* Create a file */
fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1263,12 +1243,13 @@ test_get_file_id(void)
/* Create a dataset in the group. Make a duplicated file ID from the
* dataset. And close this duplicated ID.
*/
- dims[0] = F2_DIM0;
- dims[1] = F2_DIM1;
+ dims[0] = F2_DIM0;
+ dims[1] = F2_DIM1;
dataspace_id = H5Screate_simple(F2_RANK, dims, NULL);
CHECK(dataspace_id, FAIL, "H5Screate_simple");
- dataset_id = H5Dcreate2(group_id, DSET_NAME, H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset_id =
+ H5Dcreate2(group_id, DSET_NAME, H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset_id, FAIL, "H5Dcreate2");
/* Test H5Iget_file_id() */
@@ -1301,9 +1282,8 @@ test_get_file_id(void)
plist = H5Pcreate(H5P_FILE_ACCESS);
CHECK(plist, FAIL, "H5Pcreate");
- H5E_BEGIN_TRY {
- fid2 = H5Iget_file_id(plist);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid2 = H5Iget_file_id(plist); }
+ H5E_END_TRY;
VERIFY(fid2, FAIL, "H5Iget_file_id");
/* Close objects */
@@ -1337,15 +1317,15 @@ test_get_file_id(void)
static void
check_file_id(hid_t fid, hid_t object_id)
{
- hid_t new_fid;
- herr_t ret;
+ hid_t new_fid;
+ herr_t ret;
/* Return a duplicated file ID even not expecting user to do it.
* And close this duplicated ID
*/
new_fid = H5Iget_file_id(object_id);
- if(fid >=0)
+ if (fid >= 0)
VERIFY(new_fid, fid, "H5Iget_file_id");
else
CHECK(new_fid, FAIL, "H5Iget_file_id");
@@ -1360,12 +1340,11 @@ check_file_id(hid_t fid, hid_t object_id)
**
****************************************************************/
static void
-test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
- hid_t gid2, hid_t gid3)
+test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, hid_t gid2, hid_t gid3)
{
- hid_t fid3, fid4;
- ssize_t oid_count, ret_count;
- herr_t ret;
+ hid_t fid3, fid4;
+ ssize_t oid_count, ret_count;
+ herr_t ret;
/* Create two new files */
fid3 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1403,30 +1382,29 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_8, "H5Fget_obj_count");
- if(oid_count > 0) {
+ if (oid_count > 0) {
hid_t *oid_list;
oid_list = (hid_t *)HDcalloc((size_t)oid_count, sizeof(hid_t));
- if(oid_list != NULL) {
- int i;
+ if (oid_list != NULL) {
+ int i;
- ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list);
- CHECK(ret_count, FAIL, "H5Fget_obj_ids");
+ ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list);
+ CHECK(ret_count, FAIL, "H5Fget_obj_ids");
- for(i = 0; i < oid_count; i++) {
+ for (i = 0; i < oid_count; i++) {
H5I_type_t id_type;
id_type = H5Iget_type(oid_list[i]);
- switch(id_type) {
+ switch (id_type) {
case H5I_FILE:
- if(oid_list[i] != fid1 && oid_list[i] != fid2
- && oid_list[i] != fid3 && oid_list[i] != fid4)
+ if (oid_list[i] != fid1 && oid_list[i] != fid2 && oid_list[i] != fid3 &&
+ oid_list[i] != fid4)
ERROR("H5Fget_obj_ids");
break;
case H5I_GROUP:
- if(oid_list[i] != gid1 && oid_list[i] != gid2
- && oid_list[i] != gid3)
+ if (oid_list[i] != gid1 && oid_list[i] != gid2 && oid_list[i] != gid3)
ERROR("H5Fget_obj_ids");
break;
@@ -1454,11 +1432,11 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
default:
ERROR("H5Fget_obj_ids");
} /* end switch */
- } /* end for */
+ } /* end for */
HDfree(oid_list);
} /* end if */
- } /* end if */
+ } /* end if */
/* close the two new files */
ret = H5Fclose(fid3);
@@ -1478,11 +1456,11 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
static void
test_file_perm(void)
{
- hid_t file; /* File opened with read-write permission */
- hid_t filero; /* Same file opened with read-only permission */
- hid_t dspace; /* Dataspace ID */
- hid_t dset; /* Dataset ID */
- herr_t ret;
+ hid_t file; /* File opened with read-write permission */
+ hid_t filero; /* Same file opened with read-only permission */
+ hid_t dspace; /* Dataspace ID */
+ hid_t dset; /* Dataset ID */
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File Permissions\n"));
@@ -1506,11 +1484,13 @@ test_file_perm(void)
CHECK(filero, FAIL, "H5Fopen");
/* Create a dataset with the read-only file handle (should fail) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dset = H5Dcreate2(filero, F2_DSET, H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(dset, FAIL, "H5Dcreate2");
- if(dset!=FAIL) {
+ if (dset != FAIL) {
ret = H5Dclose(dset);
CHECK(ret, FAIL, "H5Dclose");
} /* end if */
@@ -1536,14 +1516,14 @@ test_file_perm(void)
static void
test_file_perm2(void)
{
- hid_t file; /* File opened with read-write permission */
- hid_t filero; /* Same file opened with read-only permission */
- hid_t dspace; /* Dataspace ID */
- hid_t group; /* Group ID */
- hid_t dset; /* Dataset ID */
- hid_t type; /* Datatype ID */
- hid_t attr; /* Attribute ID */
- herr_t ret;
+ hid_t file; /* File opened with read-write permission */
+ hid_t filero; /* Same file opened with read-only permission */
+ hid_t dspace; /* Dataspace ID */
+ hid_t group; /* Group ID */
+ hid_t dset; /* Dataset ID */
+ hid_t type; /* Datatype ID */
+ hid_t attr; /* Attribute ID */
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File Permissions again\n"));
@@ -1563,30 +1543,29 @@ test_file_perm2(void)
CHECK(filero, FAIL, "H5Fopen");
/* Create a group with the read-only file handle (should fail) */
- H5E_BEGIN_TRY {
- group = H5Gcreate2(filero, "MY_GROUP", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { group = H5Gcreate2(filero, "MY_GROUP", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(group, FAIL, "H5Gcreate2");
/* Create a dataset with the read-only file handle (should fail) */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dset = H5Dcreate2(filero, F2_DSET, H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(dset, FAIL, "H5Dcreate2");
/* Create an attribute with the read-only file handle (should fail) */
- H5E_BEGIN_TRY {
- attr = H5Acreate2(filero, "MY_ATTR", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { attr = H5Acreate2(filero, "MY_ATTR", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(attr, FAIL, "H5Acreate2");
type = H5Tcopy(H5T_NATIVE_SHORT);
CHECK(type, FAIL, "H5Tcopy");
/* Commit a datatype with the read-only file handle (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Tcommit2(filero, "MY_DTYPE", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Tcommit2(filero, "MY_DTYPE", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Tcommit2");
ret = H5Tclose(type);
@@ -1599,7 +1578,6 @@ test_file_perm2(void)
CHECK(ret, FAIL, "H5Sclose");
} /* end test_file_perm2() */
-
/****************************************************************
**
** test_file_is_accessible(): low-level file test routine.
@@ -1607,22 +1585,22 @@ test_file_perm2(void)
** H5Fis_accessible() API call.
**
*****************************************************************/
-#define FILE_IS_ACCESSIBLE "tfile_is_accessible"
+#define FILE_IS_ACCESSIBLE "tfile_is_accessible"
static void
test_file_is_accessible(const char *env_h5_drvr)
{
- hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
- hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
- hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
- int fd; /* POSIX file descriptor */
- char filename[FILENAME_LEN]; /* Filename to use */
- char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */
- ssize_t nbytes; /* Number of bytes written */
- unsigned u; /* Local index variable */
- unsigned char buf[1024]; /* Buffer of data to write */
- htri_t is_hdf5; /* Whether a file is an HDF5 file */
- int posix_ret; /* Return value from POSIX calls */
- herr_t ret; /* Return value from HDF5 calls */
+ hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
+ hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
+ int fd; /* POSIX file descriptor */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */
+ ssize_t nbytes; /* Number of bytes written */
+ unsigned u; /* Local index variable */
+ unsigned char buf[1024]; /* Buffer of data to write */
+ htri_t is_hdf5; /* Whether a file is an HDF5 file */
+ int posix_ret; /* Return value from POSIX calls */
+ herr_t ret; /* Return value from HDF5 calls */
/* Output message about test being performed */
MESSAGE(5, ("Testing Detection of HDF5 Files\n"));
@@ -1662,7 +1640,7 @@ test_file_is_accessible(const char *env_h5_drvr)
/* This test is not currently working for the family VFD.
* There are failures when creating files with userblocks.
*/
- if(0 != HDstrcmp(env_h5_drvr, "family")) {
+ if (0 != HDstrcmp(env_h5_drvr, "family")) {
/* Create a file creation property list with a non-default user block size */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate");
@@ -1713,7 +1691,7 @@ test_file_is_accessible(const char *env_h5_drvr)
/* Initialize information to write */
for (u = 0; u < 1024; u++)
- buf[u]=(unsigned char)u;
+ buf[u] = (unsigned char)u;
/* Write some information */
nbytes = HDwrite(fd, buf, (size_t)1024);
@@ -1727,7 +1705,6 @@ test_file_is_accessible(const char *env_h5_drvr)
is_hdf5 = H5Fis_accessible(filename, fapl_id);
VERIFY(is_hdf5, FALSE, "H5Fis_accessible (non-HDF5 file)");
-
/* Clean up files */
h5_delete_test_file(filename, fapl_id);
@@ -1737,7 +1714,6 @@ test_file_is_accessible(const char *env_h5_drvr)
} /* end test_file_is_accessible() */
-
/****************************************************************
**
** test_file_ishdf5(): low-level file test routine.
@@ -1749,18 +1725,18 @@ test_file_is_accessible(const char *env_h5_drvr)
static void
test_file_ishdf5(const char *env_h5_drvr)
{
- hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
- hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
- hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
- int fd; /* POSIX file descriptor */
- char filename[FILENAME_LEN]; /* Filename to use */
- char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */
- ssize_t nbytes; /* Number of bytes written */
- unsigned u; /* Local index variable */
- unsigned char buf[1024]; /* Buffer of data to write */
- htri_t is_hdf5; /* Whether a file is an HDF5 file */
- int posix_ret; /* Return value from POSIX calls */
- herr_t ret; /* Return value from HDF5 calls */
+ hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
+ hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
+ int fd; /* POSIX file descriptor */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */
+ ssize_t nbytes; /* Number of bytes written */
+ unsigned u; /* Local index variable */
+ unsigned char buf[1024]; /* Buffer of data to write */
+ htri_t is_hdf5; /* Whether a file is an HDF5 file */
+ int posix_ret; /* Return value from POSIX calls */
+ herr_t ret; /* Return value from HDF5 calls */
/* Output message about test being performed */
MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n"));
@@ -1800,7 +1776,7 @@ test_file_ishdf5(const char *env_h5_drvr)
/* This test is not currently working for the family VFD.
* There are failures when creating files with userblocks.
*/
- if(0 != HDstrcmp(env_h5_drvr, "family")) {
+ if (0 != HDstrcmp(env_h5_drvr, "family")) {
/* Create a file creation property list with a non-default user block size */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate");
@@ -1837,8 +1813,8 @@ test_file_ishdf5(const char *env_h5_drvr)
CHECK(fd, (-1), "HDopen");
/* Initialize information to write */
- for(u = 0; u < 1024; u++)
- buf[u]=(unsigned char)u;
+ for (u = 0; u < 1024; u++)
+ buf[u] = (unsigned char)u;
/* Write some information */
nbytes = HDwrite(fd, buf, (size_t)1024);
@@ -1852,7 +1828,6 @@ test_file_ishdf5(const char *env_h5_drvr)
is_hdf5 = H5Fis_hdf5(sb_filename);
VERIFY(is_hdf5, FALSE, "H5Fis_hdf5");
-
/* Clean up files */
h5_delete_test_file(filename, fapl_id);
@@ -1863,23 +1838,22 @@ test_file_ishdf5(const char *env_h5_drvr)
} /* end test_file_ishdf5() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/****************************************************************
**
** test_file_delete(): tests H5Fdelete for all VFDs
**
*****************************************************************/
-#define FILE_DELETE "test_file_delete"
-#define FILE_DELETE_NOT_HDF5 "test_file_delete_not_hdf5"
+#define FILE_DELETE "test_file_delete"
+#define FILE_DELETE_NOT_HDF5 "test_file_delete_not_hdf5"
static void
test_file_delete(hid_t fapl_id)
{
- hid_t fid = H5I_INVALID_HID; /* File to be deleted */
- char filename[FILENAME_LEN]; /* Filename to use */
- htri_t is_hdf5; /* Whether a file is an HDF5 file */
- int fd; /* POSIX file descriptor */
- int iret;
- herr_t ret;
+ hid_t fid = H5I_INVALID_HID; /* File to be deleted */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ htri_t is_hdf5; /* Whether a file is an HDF5 file */
+ int fd; /* POSIX file descriptor */
+ int iret;
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing Deletion of HDF5 Files\n"));
@@ -1908,9 +1882,8 @@ test_file_delete(hid_t fapl_id)
VERIFY(is_hdf5, TRUE, "H5Fis_accessible");
/* Attempt to delete the file - should fail */
- H5E_BEGIN_TRY {
- ret = H5Fdelete(filename, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Fdelete(filename, fapl_id); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Fdelete");
/* Verify that the file still exists */
@@ -1941,15 +1914,13 @@ test_file_delete(hid_t fapl_id)
* may not have been created since we created it with
* open(2) and not the library.
*/
- H5E_BEGIN_TRY {
- is_hdf5 = H5Fis_accessible(filename, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { is_hdf5 = H5Fis_accessible(filename, fapl_id); }
+ H5E_END_TRY;
CHECK(is_hdf5, TRUE, "H5Fis_accessible");
/* Try to delete it (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Fdelete(filename, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Fdelete(filename, fapl_id); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Fdelete");
/* Delete the file */
@@ -1958,7 +1929,6 @@ test_file_delete(hid_t fapl_id)
} /* end test_file_delete() */
-
/****************************************************************
**
** test_file_open_dot(): low-level file test routine.
@@ -1969,12 +1939,12 @@ test_file_delete(hid_t fapl_id)
static void
test_file_open_dot(void)
{
- hid_t fid; /* File ID */
- hid_t gid, gid2; /* Group IDs */
- hid_t did; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid, tid2; /* Datatype IDs */
- herr_t ret;
+ hid_t fid; /* File ID */
+ hid_t gid, gid2; /* Group IDs */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid, tid2; /* Datatype IDs */
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing opening objects with \".\" for a name\n"));
@@ -1992,27 +1962,23 @@ test_file_open_dot(void)
CHECK(sid, FAIL, "H5Screate");
/* Create a dataset with no name using the file ID */
- H5E_BEGIN_TRY {
- did = H5Dcreate2(fid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { did = H5Dcreate2(fid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(did, FAIL, "H5Dcreate2");
/* Create a dataset with no name using the group ID */
- H5E_BEGIN_TRY {
- did = H5Dcreate2(gid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { did = H5Dcreate2(gid, ".", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(did, FAIL, "H5Dcreate2");
/* Open a dataset with no name using the file ID */
- H5E_BEGIN_TRY {
- did = H5Dopen2(fid, ".", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { did = H5Dopen2(fid, ".", H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(did, FAIL, "H5Dopen2");
/* Open a dataset with no name using the group ID */
- H5E_BEGIN_TRY {
- did = H5Dopen2(gid, ".", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { did = H5Dopen2(gid, ".", H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(did, FAIL, "H5Dopen2");
/* Make a copy of a datatype to use for creating a named datatype */
@@ -2020,39 +1986,33 @@ test_file_open_dot(void)
CHECK(tid, FAIL, "H5Tcopy");
/* Create a named datatype with no name using the file ID */
- H5E_BEGIN_TRY {
- ret = H5Tcommit2(fid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Tcommit2(fid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Tcommit2");
/* Create a named datatype with no name using the group ID */
- H5E_BEGIN_TRY {
- ret = H5Tcommit2(gid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Tcommit2(gid, ".", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Tcommit2");
/* Open a named datatype with no name using the file ID */
- H5E_BEGIN_TRY {
- tid2 = H5Topen2(fid, ".", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tid2 = H5Topen2(fid, ".", H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tid2, FAIL, "H5Topen2");
/* Open a named datatype with no name using the group ID */
- H5E_BEGIN_TRY {
- tid2 = H5Topen2(gid, ".", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tid2 = H5Topen2(gid, ".", H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tid2, FAIL, "H5Topen2");
/* Create a group with no name using the file ID */
- H5E_BEGIN_TRY {
- gid2 = H5Gcreate2(fid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid2 = H5Gcreate2(fid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(gid2, FAIL, "H5Gcreate2");
/* Create a group with no name using the group ID */
- H5E_BEGIN_TRY {
- gid2 = H5Gcreate2(gid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid2 = H5Gcreate2(gid, ".", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(gid2, FAIL, "H5Gcreate2");
/* Open a group with no name using the file ID (should open the root group) */
@@ -2069,7 +2029,6 @@ test_file_open_dot(void)
ret = H5Gclose(gid2);
CHECK(ret, FAIL, "H5Gclose");
-
/* Close everything */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -2092,14 +2051,14 @@ test_file_open_dot(void)
static void
test_file_open_overlap(void)
{
- hid_t fid1, fid2;
- hid_t did1, did2;
- hid_t gid;
- hid_t sid;
- ssize_t nobjs; /* # of open objects */
- unsigned intent;
- unsigned long fileno1, fileno2; /* File number */
- herr_t ret; /* Generic return value */
+ hid_t fid1, fid2;
+ hid_t did1, did2;
+ hid_t gid;
+ hid_t sid;
+ ssize_t nobjs; /* # of open objects */
+ unsigned intent;
+ unsigned long fileno1, fileno2; /* File number */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing opening overlapping file opens\n"));
@@ -2119,10 +2078,10 @@ test_file_open_overlap(void)
/* Check the file numbers */
fileno1 = 0;
- ret = H5Fget_fileno(fid1, &fileno1);
+ ret = H5Fget_fileno(fid1, &fileno1);
CHECK(ret, FAIL, "H5Fget_fileno");
fileno2 = 0;
- ret = H5Fget_fileno(fid2, &fileno2);
+ ret = H5Fget_fileno(fid2, &fileno2);
CHECK(ret, FAIL, "H5Fget_fileno");
VERIFY(fileno1, fileno2, "H5Fget_fileno");
@@ -2143,8 +2102,8 @@ test_file_open_overlap(void)
CHECK(did1, FAIL, "H5Dcreate2");
/* Check number of objects opened in first file */
- nobjs = H5Fget_obj_count(fid1, H5F_OBJ_LOCAL|H5F_OBJ_ALL);
- VERIFY(nobjs, 3, "H5Fget_obj_count"); /* 3 == file, dataset & group */
+ nobjs = H5Fget_obj_count(fid1, H5F_OBJ_LOCAL | H5F_OBJ_ALL);
+ VERIFY(nobjs, 3, "H5Fget_obj_count"); /* 3 == file, dataset & group */
/* Close dataset */
ret = H5Dclose(did1);
@@ -2158,14 +2117,13 @@ test_file_open_overlap(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Create dataset with second file ID */
did2 = H5Dcreate2(fid2, DSET2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(did2, FAIL, "H5Dcreate2");
/* Check number of objects opened in first file */
nobjs = H5Fget_obj_count(fid2, H5F_OBJ_ALL);
- VERIFY(nobjs, 2, "H5Fget_obj_count"); /* 3 == file & dataset */
+ VERIFY(nobjs, 2, "H5Fget_obj_count"); /* 3 == file & dataset */
/* Close dataspace */
ret = H5Sclose(sid);
@@ -2204,13 +2162,13 @@ test_file_getname(void)
hsize_t dims[TESTA_RANK] = {TESTA_NX, TESTA_NY};
char name[TESTA_NAME_BUF_SIZE];
ssize_t name_len;
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing H5Fget_name() functionality\n"));
/* Create a new file_id using default properties. */
- file_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
+ file_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file_id, FAIL, "H5Fcreate");
/* Get and verify file name */
@@ -2233,13 +2191,13 @@ test_file_getname(void)
/* Try get file name from data space. Supposed to fail because
* it's illegal operation. */
- H5E_BEGIN_TRY {
- name_len = H5Fget_name(space_id, name, (size_t)TESTA_NAME_BUF_SIZE);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { name_len = H5Fget_name(space_id, name, (size_t)TESTA_NAME_BUF_SIZE); }
+ H5E_END_TRY;
VERIFY(name_len, FAIL, "H5Fget_name");
/* Create a new dataset */
- dataset_id = H5Dcreate2(file_id, TESTA_DSETNAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset_id =
+ H5Dcreate2(file_id, TESTA_DSETNAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset_id, FAIL, "H5Dcreate2");
/* Get and verify file name */
@@ -2261,10 +2219,10 @@ test_file_getname(void)
CHECK(type_id, FAIL, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert (type_id, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(type_id, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert (type_id, "b", HOFFSET(s1_t,b), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(type_id, "b", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save it on file */
@@ -2307,21 +2265,21 @@ test_file_getname(void)
static void
test_file_double_root_open(void)
{
- hid_t file1_id, file2_id;
- hid_t grp1_id, grp2_id;
- herr_t ret; /* Generic return value */
+ hid_t file1_id, file2_id;
+ hid_t grp1_id, grp2_id;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing double root group open\n"));
file1_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file1_id, FAIL, "H5Fcreate");
- file2_id = H5Fopen (FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file2_id = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(file2_id, FAIL, "H5Fopen");
- grp1_id = H5Gopen2(file1_id, "/", H5P_DEFAULT);
+ grp1_id = H5Gopen2(file1_id, "/", H5P_DEFAULT);
CHECK(grp1_id, FAIL, "H5Gopen2");
- grp2_id = H5Gopen2(file2_id, "/", H5P_DEFAULT);
+ grp2_id = H5Gopen2(file2_id, "/", H5P_DEFAULT);
CHECK(grp2_id, FAIL, "H5Gopen2");
/* Note "assymetric" close order */
@@ -2346,21 +2304,21 @@ test_file_double_root_open(void)
static void
test_file_double_group_open(void)
{
- hid_t file1_id, file2_id;
- hid_t grp1_id, grp2_id;
- herr_t ret; /* Generic return value */
+ hid_t file1_id, file2_id;
+ hid_t grp1_id, grp2_id;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing double non-root group open\n"));
file1_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file1_id, FAIL, "H5Fcreate");
- file2_id = H5Fopen (FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file2_id = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(file2_id, FAIL, "H5Fopen");
- grp1_id = H5Gcreate2(file1_id, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ grp1_id = H5Gcreate2(file1_id, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(grp1_id, FAIL, "H5Gcreate2");
- grp2_id = H5Gopen2(file2_id, GRP_NAME, H5P_DEFAULT);
+ grp2_id = H5Gopen2(file2_id, GRP_NAME, H5P_DEFAULT);
CHECK(grp2_id, FAIL, "H5Gopen2");
/* Note "assymetric" close order */
@@ -2385,26 +2343,27 @@ test_file_double_group_open(void)
static void
test_file_double_dataset_open(void)
{
- hid_t file1_id, file2_id;
- hid_t dset1_id, dset2_id;
- hid_t space_id;
- herr_t ret; /* Generic return value */
+ hid_t file1_id, file2_id;
+ hid_t dset1_id, dset2_id;
+ hid_t space_id;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing double dataset open\n"));
file1_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file1_id, FAIL, "H5Fcreate");
- file2_id = H5Fopen (FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file2_id = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(file2_id, FAIL, "H5Fopen");
/* Create dataspace for dataset */
space_id = H5Screate(H5S_SCALAR);
CHECK(space_id, FAIL, "H5Screate");
- dset1_id = H5Dcreate2(file1_id, DSET_NAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset1_id =
+ H5Dcreate2(file1_id, DSET_NAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset1_id, FAIL, "H5Dcreate2");
- dset2_id = H5Dopen2(file2_id, DSET_NAME, H5P_DEFAULT);
+ dset2_id = H5Dopen2(file2_id, DSET_NAME, H5P_DEFAULT);
CHECK(dset2_id, FAIL, "H5Dopen2");
/* Close "supporting" dataspace */
@@ -2436,26 +2395,27 @@ test_file_double_dataset_open(void)
static void
test_file_double_file_dataset_open(hbool_t new_format)
{
- hid_t fapl = -1; /* File access property list */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t did1 = -1, did2 = -1; /* Dataset IDs */
- hid_t sid1 = -1, sid2 = -1; /* Dataspace IDs */
- hid_t tid1 = -1, tid2 = -1; /* Datatype IDs */
- hsize_t dims[1] = {5}, dims2[2] = {1, 4}; /* Dimension sizes */
- hsize_t e_ext_dims[1] = {7}; /* Expanded dimension sizes */
- hsize_t s_ext_dims[1] = {3}; /* Shrunk dimension sizes */
- hsize_t max_dims0[1] = {8}; /* Maximum dimension sizes */
- hsize_t max_dims1[1] = {H5S_UNLIMITED}; /* Maximum dimesion sizes for extensible array index */
- hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */
- hsize_t chunks[1] = {2}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */
- hsize_t size; /* File size */
- char filename[FILENAME_LEN]; /* Filename to use */
- const char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */
- const char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */
- char* buffer[5]; /* Output buffer */
- int wbuf[4] = {1, 2, 3, 4}; /* Input data */
- herr_t ret; /* Generic return value */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t did1 = -1, did2 = -1; /* Dataset IDs */
+ hid_t sid1 = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t tid1 = -1, tid2 = -1; /* Datatype IDs */
+ hsize_t dims[1] = {5}, dims2[2] = {1, 4}; /* Dimension sizes */
+ hsize_t e_ext_dims[1] = {7}; /* Expanded dimension sizes */
+ hsize_t s_ext_dims[1] = {3}; /* Shrunk dimension sizes */
+ hsize_t max_dims0[1] = {8}; /* Maximum dimension sizes */
+ hsize_t max_dims1[1] = {H5S_UNLIMITED}; /* Maximum dimesion sizes for extensible array index */
+ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */
+ hsize_t chunks[1] = {2}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */
+ hsize_t size; /* File size */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ const char *data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */
+ const char *e_data[] = {"String 1", "String 2", "String 3", "String 4",
+ "String 5", "String 6", "String 7"}; /* Input Data */
+ char * buffer[5]; /* Output buffer */
+ int wbuf[4] = {1, 2, 3, 4}; /* Input data */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing double file and dataset open/close\n"));
@@ -2463,7 +2423,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
/* Setting up test file */
fapl = h5_fileaccess();
CHECK(fapl, FAIL, "H5Pcreate");
- if(new_format) {
+ if (new_format) {
ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
} /* end if */
@@ -2579,7 +2539,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(fid2, FAIL, "H5Fopen");
/* Second file's dataset open */
- did2 = H5Dopen2(fid2, "/dset_fa", H5P_DEFAULT );
+ did2 = H5Dopen2(fid2, "/dset_fa", H5P_DEFAULT);
CHECK(did2, FAIL, "H5Dopen2");
tid2 = H5Tcopy(did2);
@@ -2624,7 +2584,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(fid2, FAIL, "H5Fopen");
/* Second file's dataset open */
- did2 = H5Dopen2(fid2, "/dset_ea", H5P_DEFAULT );
+ did2 = H5Dopen2(fid2, "/dset_ea", H5P_DEFAULT);
CHECK(did2, FAIL, "H5Dopen2");
tid2 = H5Tcopy(did2);
@@ -2638,7 +2598,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(tid1, FAIL, "H5Tcopy");
/* Second file's dataset read */
- HDmemset(buffer, 0, sizeof(char*) * 5);
+ HDmemset(buffer, 0, sizeof(char *) * 5);
ret = H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
CHECK(ret, FAIL, "H5Dread");
ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, buffer);
@@ -2653,7 +2613,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(ret, FAIL, "H5Fclose");
/* First file's dataset read */
- HDmemset(buffer, 0, sizeof(char*) * 5);
+ HDmemset(buffer, 0, sizeof(char *) * 5);
ret = H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
CHECK(ret, FAIL, "H5Dread");
ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, buffer);
@@ -2697,7 +2657,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(fid2, FAIL, "H5Fopen");
/* Second file's dataset open */
- did2 = H5Dopen2(fid2, "/dset_bt2", H5P_DEFAULT );
+ did2 = H5Dopen2(fid2, "/dset_bt2", H5P_DEFAULT);
CHECK(did2, FAIL, "H5Dopen2");
/* First file's dataset close */
@@ -2723,7 +2683,8 @@ test_file_double_file_dataset_open(hbool_t new_format)
/*
* Scenario 4
* --trigger H5AC_protect: Assertion `f->shared' failed
- * from second call to H5Dset_extent->...H5D__earray_idx_remove->H5EA_get...H5EA__iblock_protect...H5AC_protect
+ * from second call to
+ * H5Dset_extent->...H5D__earray_idx_remove->H5EA_get...H5EA__iblock_protect...H5AC_protect
*/
/* First file open */
fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl);
@@ -2749,7 +2710,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(fid2, FAIL, "H5Fopen");
/* Second file's dataset open */
- did2 = H5Dopen2(fid2, "/dset_ea", H5P_DEFAULT );
+ did2 = H5Dopen2(fid2, "/dset_ea", H5P_DEFAULT);
CHECK(did2, FAIL, "H5Dopen2");
/* First file's dataset close */
@@ -2791,23 +2752,23 @@ test_file_double_file_dataset_open(hbool_t new_format)
static void
test_file_double_datatype_open(void)
{
- hid_t file1_id, file2_id;
- hid_t type1_id, type2_id;
- herr_t ret; /* Generic return value */
+ hid_t file1_id, file2_id;
+ hid_t type1_id, type2_id;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing double dataset open\n"));
file1_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file1_id, FAIL, "H5Fcreate");
- file2_id = H5Fopen (FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file2_id = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(file2_id, FAIL, "H5Fopen");
- type1_id = H5Tcopy(H5T_NATIVE_INT);
+ type1_id = H5Tcopy(H5T_NATIVE_INT);
CHECK(type1_id, FAIL, "H5Tcopy");
- ret = H5Tcommit2(file1_id, TYPE_NAME, type1_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Tcommit2(file1_id, TYPE_NAME, type1_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
- type2_id = H5Topen2(file2_id, TYPE_NAME, H5P_DEFAULT);
+ type2_id = H5Topen2(file2_id, TYPE_NAME, H5P_DEFAULT);
CHECK(type2_id, FAIL, "H5Topen2");
/* Note "assymetric" close order */
@@ -2836,15 +2797,15 @@ test_file_double_datatype_open(void)
static void
test_userblock_file_size(void)
{
- hid_t file1_id, file2_id;
- hid_t group1_id, group2_id;
- hid_t dset1_id, dset2_id;
- hid_t space_id;
- hid_t fcpl2_id;
- hsize_t dims[2] = {3, 4};
- hsize_t filesize1, filesize2, filesize;
- unsigned long fileno1, fileno2; /* File number */
- herr_t ret; /* Generic return value */
+ hid_t file1_id, file2_id;
+ hid_t group1_id, group2_id;
+ hid_t dset1_id, dset2_id;
+ hid_t space_id;
+ hid_t fcpl2_id;
+ hsize_t dims[2] = {3, 4};
+ hsize_t filesize1, filesize2, filesize;
+ unsigned long fileno1, fileno2; /* File number */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing file size with user block\n"));
@@ -2863,10 +2824,10 @@ test_userblock_file_size(void)
/* Check the file numbers */
fileno1 = 0;
- ret = H5Fget_fileno(file1_id, &fileno1);
+ ret = H5Fget_fileno(file1_id, &fileno1);
CHECK(ret, FAIL, "H5Fget_fileno");
fileno2 = 0;
- ret = H5Fget_fileno(file2_id, &fileno2);
+ ret = H5Fget_fileno(file2_id, &fileno2);
CHECK(ret, FAIL, "H5Fget_fileno");
CHECK(fileno1, fileno2, "H5Fget_fileno");
@@ -2919,7 +2880,8 @@ test_userblock_file_size(void)
CHECK(ret, FAIL, "H5Fget_filesize");
/* Verify that the file sizes differ exactly by the userblock size */
- VERIFY_TYPE((unsigned long long)filesize2, (unsigned long long)(filesize1 + USERBLOCK_SIZE), unsigned long long, "%llu", "H5Fget_filesize");
+ VERIFY_TYPE((unsigned long long)filesize2, (unsigned long long)(filesize1 + USERBLOCK_SIZE),
+ unsigned long long, "%llu", "H5Fget_filesize");
/* Close files */
ret = H5Fclose(file1_id);
@@ -2960,9 +2922,9 @@ test_userblock_file_size(void)
static void
test_cached_stab_info(void)
{
- hid_t file_id;
- hid_t group_id;
- herr_t ret; /* Generic return value */
+ hid_t file_id;
+ hid_t group_id;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing cached symbol table information\n"));
@@ -3001,12 +2963,12 @@ test_cached_stab_info(void)
static int
cal_chksum(const char *file, uint32_t *chksum)
{
- int curr_num_errs = GetTestNumErrs(); /* Retrieve the current # of errors */
- int fdes = -1; /* File descriptor */
- void *file_data = NULL; /* Copy of file data */
- ssize_t bytes_read; /* # of bytes read */
+ int curr_num_errs = GetTestNumErrs(); /* Retrieve the current # of errors */
+ int fdes = -1; /* File descriptor */
+ void * file_data = NULL; /* Copy of file data */
+ ssize_t bytes_read; /* # of bytes read */
h5_stat_t sb; /* Stat buffer for file */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Open the file */
fdes = HDopen(file, O_RDONLY);
@@ -3020,7 +2982,7 @@ cal_chksum(const char *file, uint32_t *chksum)
file_data = HDmalloc((size_t)sb.st_size);
CHECK_PTR(file_data, "HDmalloc");
- if(file_data) {
+ if (file_data) {
/* Read file's data into memory */
bytes_read = HDread(fdes, file_data, (size_t)sb.st_size);
CHECK(bytes_read == sb.st_size, FALSE, "HDmalloc");
@@ -3036,7 +2998,7 @@ cal_chksum(const char *file, uint32_t *chksum)
ret = HDclose(fdes);
CHECK(ret, FAIL, "HDclose");
- return((GetTestNumErrs() == curr_num_errs) ? 0 : -1);
+ return ((GetTestNumErrs() == curr_num_errs) ? 0 : -1);
} /* cal_chksum() */
/****************************************************************
@@ -3055,9 +3017,9 @@ cal_chksum(const char *file, uint32_t *chksum)
static void
test_rw_noupdate(void)
{
- herr_t ret; /* Generic return value */
- hid_t fid; /* File ID */
- uint32_t chksum1, chksum2; /* Checksum value */
+ herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ uint32_t chksum1, chksum2; /* Checksum value */
/* Output message about test being performed */
MESSAGE(5, ("Testing to verify that nothing is written if nothing is changed.\n"));
@@ -3103,20 +3065,20 @@ test_rw_noupdate(void)
static int
test_userblock_alignment_helper1(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- int curr_num_errs = GetTestNumErrs(); /* Retrieve the current # of errors */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ int curr_num_errs = GetTestNumErrs(); /* Retrieve the current # of errors */
+ herr_t ret; /* Generic return value */
/* Create a file with FAPL & FCPL */
fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(fid, FAIL, "H5Fcreate");
/* Only proceed further if file ID is OK */
- if(fid > 0) {
- hid_t gid; /* Group ID */
- hid_t sid; /* Dataspace ID */
- hid_t did; /* Dataset ID */
- int val = 2; /* Dataset value */
+ if (fid > 0) {
+ hid_t gid; /* Group ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t did; /* Dataset ID */
+ int val = 2; /* Dataset value */
/* Create a group */
gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -3149,7 +3111,7 @@ test_userblock_alignment_helper1(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* end if */
- return((GetTestNumErrs() == curr_num_errs) ? 0 : -1);
+ return ((GetTestNumErrs() == curr_num_errs) ? 0 : -1);
} /* end test_userblock_alignment_helper1() */
/****************************************************************
@@ -3164,19 +3126,19 @@ test_userblock_alignment_helper1(hid_t fcpl, hid_t fapl)
static int
test_userblock_alignment_helper2(hid_t fapl, hbool_t open_rw)
{
- hid_t fid; /* File ID */
- int curr_num_errs = GetTestNumErrs(); /* Retrieve the current # of errors */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ int curr_num_errs = GetTestNumErrs(); /* Retrieve the current # of errors */
+ herr_t ret; /* Generic return value */
/* Re-open file */
fid = H5Fopen(FILE1, (open_rw ? H5F_ACC_RDWR : H5F_ACC_RDONLY), fapl);
CHECK(fid, FAIL, "H5Fopen");
/* Only proceed further if file ID is OK */
- if(fid > 0) {
+ if (fid > 0) {
hid_t gid; /* Group ID */
hid_t did; /* Dataset ID */
- int val = -1; /* Dataset value */
+ int val = -1; /* Dataset value */
/* Open group */
gid = H5Gopen2(fid, "group1", H5P_DEFAULT);
@@ -3196,8 +3158,8 @@ test_userblock_alignment_helper2(hid_t fapl, hbool_t open_rw)
CHECK(ret, FAIL, "H5Dclose");
/* Only create new objects if file is open R/W */
- if(open_rw) {
- hid_t gid2; /* Group ID */
+ if (open_rw) {
+ hid_t gid2; /* Group ID */
/* Create a new group */
gid2 = H5Gcreate2(gid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -3217,7 +3179,7 @@ test_userblock_alignment_helper2(hid_t fapl, hbool_t open_rw)
CHECK(ret, FAIL, "H5Fclose");
} /* end if */
- return((GetTestNumErrs() == curr_num_errs) ? 0 : -1);
+ return ((GetTestNumErrs() == curr_num_errs) ? 0 : -1);
} /* end test_userblock_alignment_helper2() */
/****************************************************************
@@ -3233,10 +3195,10 @@ test_userblock_alignment_helper2(hid_t fapl, hbool_t open_rw)
static void
test_userblock_alignment(void)
{
- hid_t fid; /* File ID */
- hid_t fcpl; /* File creation property list ID */
- hid_t fapl; /* File access property list ID */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t fcpl; /* File creation property list ID */
+ hid_t fapl; /* File access property list ID */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing that non-zero userblocks and object alignment interact correctly.\n"));
@@ -3270,7 +3232,6 @@ test_userblock_alignment(void)
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
-
/* Case 2:
* Userblock size = 512, alignment = 16
* (userblock is integral mult. of alignment)
@@ -3301,7 +3262,6 @@ test_userblock_alignment(void)
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
-
/* Case 3:
* Userblock size = 512, alignment = 512
* (userblock is equal to alignment)
@@ -3332,7 +3292,6 @@ test_userblock_alignment(void)
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
-
/* Case 4:
* Userblock size = 512, alignment = 3
* (userblock & alignment each individually valid, but userblock is
@@ -3353,9 +3312,8 @@ test_userblock_alignment(void)
CHECK(ret, FAIL, "H5Pset_alignment");
/* Create a file with FAPL & FCPL */
- H5E_BEGIN_TRY {
- fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
VERIFY(fid, FAIL, "H5Fcreate");
/* Release property lists */
@@ -3364,7 +3322,6 @@ test_userblock_alignment(void)
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
-
/* Case 5:
* Userblock size = 512, alignment = 1024
* (userblock & alignment each individually valid, but userblock is
@@ -3385,9 +3342,8 @@ test_userblock_alignment(void)
CHECK(ret, FAIL, "H5Pset_alignment");
/* Create a file with FAPL & FCPL */
- H5E_BEGIN_TRY {
- fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
VERIFY(fid, FAIL, "H5Fcreate");
/* Release property lists */
@@ -3396,7 +3352,6 @@ test_userblock_alignment(void)
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
-
/* Case 6:
* File created with:
* Userblock size = 512, alignment = 512
@@ -3452,13 +3407,14 @@ test_userblock_alignment(void)
static void
test_userblock_alignment_paged(void)
{
- hid_t fid; /* File ID */
- hid_t fcpl; /* File creation property list ID */
- hid_t fapl; /* File access property list ID */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t fcpl; /* File creation property list ID */
+ hid_t fapl; /* File access property list ID */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
- MESSAGE(5, ("Testing interaction between userblock and alignment (via paged aggregation and H5Pset_alignment)\n"));
+ MESSAGE(5, ("Testing interaction between userblock and alignment (via paged aggregation and "
+ "H5Pset_alignment)\n"));
/*
* Case 1:
@@ -3559,9 +3515,8 @@ test_userblock_alignment_paged(void)
CHECK(ret, FAIL, "H5Pset_alignment");
/* Create a file with FAPL & FCPL */
- H5E_BEGIN_TRY {
- fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
VERIFY(fid, FAIL, "H5Fcreate");
/* Release property lists */
@@ -3635,9 +3590,8 @@ test_userblock_alignment_paged(void)
CHECK(ret, FAIL, "H5Pset_alignment");
/* Create a file with FAPL & FCPL */
- H5E_BEGIN_TRY {
- fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
VERIFY(fid, FAIL, "H5Fcreate");
/* Release property lists */
@@ -3673,9 +3627,8 @@ test_userblock_alignment_paged(void)
CHECK(ret, FAIL, "H5Pset_alignment");
/* Create a file with FAPL & FCPL */
- H5E_BEGIN_TRY {
- fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
VERIFY(fid, FAIL, "H5Fcreate");
/* Release property lists */
@@ -3749,9 +3702,8 @@ test_userblock_alignment_paged(void)
CHECK(ret, FAIL, "H5Pset_alignment");
/* Create a file with FAPL & FCPL */
- H5E_BEGIN_TRY {
- fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
VERIFY(fid, FAIL, "H5Fcreate");
/* Release property lists */
@@ -3863,23 +3815,24 @@ test_userblock_alignment_paged(void)
static void
test_filespace_info(const char *env_h5_drvr)
{
- hid_t fid; /* File IDs */
- hid_t fapl, new_fapl; /* File access property lists */
- hid_t fcpl, fcpl1, fcpl2; /* File creation property lists */
- H5F_fspace_strategy_t strategy; /* File space strategy */
- hbool_t persist; /* Persist free-space or not */
- hsize_t threshold; /* Free-space section threshold */
- unsigned new_format; /* New or old format */
- H5F_fspace_strategy_t fs_strategy; /* File space strategy--iteration variable */
- unsigned fs_persist; /* Persist free-space or not--iteration variable */
- hsize_t fs_threshold; /* Free-space section threshold--iteration variable */
- hsize_t fsp_size; /* File space page size */
- char filename[FILENAME_LEN]; /* Filename to use */
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
- herr_t ret; /* Return value */
+ hid_t fid; /* File IDs */
+ hid_t fapl, new_fapl; /* File access property lists */
+ hid_t fcpl, fcpl1, fcpl2; /* File creation property lists */
+ H5F_fspace_strategy_t strategy; /* File space strategy */
+ hbool_t persist; /* Persist free-space or not */
+ hsize_t threshold; /* Free-space section threshold */
+ unsigned new_format; /* New or old format */
+ H5F_fspace_strategy_t fs_strategy; /* File space strategy--iteration variable */
+ unsigned fs_persist; /* Persist free-space or not--iteration variable */
+ hsize_t fs_threshold; /* Free-space section threshold--iteration variable */
+ hsize_t fsp_size; /* File space page size */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ herr_t ret; /* Return value */
/* Output message about test being performed */
- MESSAGE(5, ("Testing file creation public routines: H5Pget/set_file_space_strategy & H5Pget/set_file_space_page_size\n"));
+ MESSAGE(5, ("Testing file creation public routines: H5Pget/set_file_space_strategy & "
+ "H5Pget/set_file_space_page_size\n"));
contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
@@ -3939,21 +3892,18 @@ test_filespace_info(const char *env_h5_drvr)
CHECK(fcpl, FAIL, "H5Pcreate");
/* Setting to 0: should fail */
- H5E_BEGIN_TRY {
- ret = H5Pset_file_space_page_size(fcpl, 0);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_file_space_page_size(fcpl, 0); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_file_space_page_size");
/* Setting to 511: should fail */
- H5E_BEGIN_TRY {
- ret = H5Pset_file_space_page_size(fcpl, 511);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_file_space_page_size(fcpl, 511); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_file_space_page_size");
/* Setting to 1GB+1: should fail */
- H5E_BEGIN_TRY {
- ret = H5Pset_file_space_page_size(fcpl, FSP_SIZE1G+1);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_file_space_page_size(fcpl, FSP_SIZE1G + 1); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_file_space_page_size");
/* Setting to 512: should succeed */
@@ -4061,11 +4011,11 @@ test_filespace_info(const char *env_h5_drvr)
* File space page size: set to 512
*
*/
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl;
/* Set the FAPL for the type of format */
- if(new_format) {
+ if (new_format) {
MESSAGE(5, ("Testing with new group format\n"));
my_fapl = new_fapl;
} /* end if */
@@ -4075,15 +4025,16 @@ test_filespace_info(const char *env_h5_drvr)
} /* end else */
/* Test with TRUE or FALSE for persisting free-space */
- for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
+ for (fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
/* Test with free-space section threshold size: 0 to 10 */
- for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
+ for (fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
/* Test with 4 file space strategies */
- for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; fs_strategy++) {
+ for (fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES;
+ fs_strategy++) {
- if(!contig_addr_vfd && (fs_strategy == H5F_FSPACE_STRATEGY_PAGE || fs_persist))
+ if (!contig_addr_vfd && (fs_strategy == H5F_FSPACE_STRATEGY_PAGE || fs_persist))
continue;
/* Create file creation property list template */
@@ -4104,10 +4055,11 @@ test_filespace_info(const char *env_h5_drvr)
/* Verify file space information */
VERIFY(strategy, fs_strategy, "H5Pget_file_space_strategy");
- if(fs_strategy < H5F_FSPACE_STRATEGY_AGGR) {
+ if (fs_strategy < H5F_FSPACE_STRATEGY_AGGR) {
VERIFY(persist, (hbool_t)fs_persist, "H5Pget_file_space_strategy");
VERIFY(threshold, fs_threshold, "H5Pget_file_space_strategy");
- } else {
+ }
+ else {
VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
VERIFY(threshold, 1, "H5Pget_file_space_strategy");
}
@@ -4132,10 +4084,11 @@ test_filespace_info(const char *env_h5_drvr)
/* Verify file space information */
VERIFY(strategy, fs_strategy, "H5Pget_file_space_strategy");
- if(fs_strategy < H5F_FSPACE_STRATEGY_AGGR) {
+ if (fs_strategy < H5F_FSPACE_STRATEGY_AGGR) {
VERIFY(persist, fs_persist, "H5Pget_file_space_strategy");
VERIFY(threshold, fs_threshold, "H5Pget_file_space_strategy");
- } else {
+ }
+ else {
VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
VERIFY(threshold, 1, "H5Pget_file_space_strategy");
}
@@ -4163,10 +4116,11 @@ test_filespace_info(const char *env_h5_drvr)
/* Verify file space information */
VERIFY(strategy, fs_strategy, "H5Pget_file_space_strategy");
- if(fs_strategy < H5F_FSPACE_STRATEGY_AGGR) {
+ if (fs_strategy < H5F_FSPACE_STRATEGY_AGGR) {
VERIFY(persist, fs_persist, "H5Pget_file_space_strategy");
VERIFY(threshold, fs_threshold, "H5Pget_file_space_strategy");
- } else {
+ }
+ else {
VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
VERIFY(threshold, 1, "H5Pget_file_space_strategy");
}
@@ -4188,14 +4142,14 @@ test_filespace_info(const char *env_h5_drvr)
ret = H5Pclose(fcpl2);
CHECK(ret, FAIL, "H5Pclose");
} /* end for file space strategy type */
- } /* end for free-space section threshold */
- } /* end for fs_persist */
+ } /* end for free-space section threshold */
+ } /* end for fs_persist */
/* close fapl_ and remove the file */
h5_clean_files(FILESPACE_NAME, my_fapl);
} /* end for new_format */
-} /* test_filespace_info() */
+} /* test_filespace_info() */
/****************************************************************
**
@@ -4209,42 +4163,44 @@ static int
set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t split)
{
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
- char *memb_name[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- hbool_t relax;
- H5FD_mem_t mt;
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char * memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
HDassert(split);
HDmemset(memb_name, 0, sizeof memb_name);
/* Get current split settings */
- if(H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
+ if (H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
TEST_ERROR
- if(split) {
+ if (split) {
/* Set memb_addr aligned */
memb_addr[H5FD_MEM_SUPER] = ((memb_addr[H5FD_MEM_SUPER] + pagesize - 1) / pagesize) * pagesize;
- memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
- } else {
+ memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
+ }
+ else {
/* Set memb_addr aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize;
} /* end else */
/* Set multi driver with new FAPLs */
- if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl_arr, (const char *const *)memb_name, memb_addr, relax) <
+ 0)
TEST_ERROR
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
return 0;
error:
- return(-1);
+ return (-1);
} /* set_multi_split() */
@@ -4259,29 +4215,29 @@ error:
static void
test_file_freespace(const char *env_h5_drvr)
{
- hid_t file; /* File opened with read-write permission */
- h5_stat_size_t empty_filesize; /* Size of file when empty */
- h5_stat_size_t mod_filesize; /* Size of file after being modified */
- hssize_t free_space; /* Amount of free space in file */
- hid_t fcpl; /* File creation property list */
- hid_t fapl, new_fapl; /* File access property list IDs */
- hid_t dspace; /* Dataspace ID */
- hid_t dset; /* Dataset ID */
- hid_t dcpl; /* Dataset creation property list */
- int k; /* Local index variable */
- unsigned u; /* Local index variable */
- char filename[FILENAME_LEN]; /* Filename to use */
- char name[32]; /* Dataset name */
- unsigned new_format; /* To use old or new format */
- hbool_t split_vfd, multi_vfd; /* Indicate multi/split driver */
- hsize_t expected_freespace; /* Freespace expected */
- hsize_t expected_fs_del; /* Freespace expected after delete */
- herr_t ret; /* Return value */
+ hid_t file; /* File opened with read-write permission */
+ h5_stat_size_t empty_filesize; /* Size of file when empty */
+ h5_stat_size_t mod_filesize; /* Size of file after being modified */
+ hssize_t free_space; /* Amount of free space in file */
+ hid_t fcpl; /* File creation property list */
+ hid_t fapl, new_fapl; /* File access property list IDs */
+ hid_t dspace; /* Dataspace ID */
+ hid_t dset; /* Dataset ID */
+ hid_t dcpl; /* Dataset creation property list */
+ int k; /* Local index variable */
+ unsigned u; /* Local index variable */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ char name[32]; /* Dataset name */
+ unsigned new_format; /* To use old or new format */
+ hbool_t split_vfd, multi_vfd; /* Indicate multi/split driver */
+ hsize_t expected_freespace; /* Freespace expected */
+ hsize_t expected_fs_del; /* Freespace expected after delete */
+ herr_t ret; /* Return value */
split_vfd = !HDstrcmp(env_h5_drvr, "split");
multi_vfd = !HDstrcmp(env_h5_drvr, "multi");
- if(!split_vfd && !multi_vfd) {
+ if (!split_vfd && !multi_vfd) {
fapl = h5_fileaccess();
h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename);
@@ -4296,16 +4252,16 @@ test_file_freespace(const char *env_h5_drvr)
CHECK(fcpl, FAIL, "H5Pcreate");
/* Test with old & new format */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl;
/* Set the FAPL for the type of format */
- if(new_format) {
+ if (new_format) {
MESSAGE(5, ("Testing with new group format\n"));
my_fapl = new_fapl;
- if(multi_vfd || split_vfd) {
+ if (multi_vfd || split_vfd) {
ret = set_multi_split(new_fapl, FSP_SIZE_DEF, split_vfd);
CHECK(ret, FAIL, "set_multi_split");
}
@@ -4314,17 +4270,21 @@ test_file_freespace(const char *env_h5_drvr)
CHECK(ret, FAIL, "H5P_set_file_space_strategy");
expected_freespace = 4534;
- if(split_vfd) expected_freespace = 427;
- if(multi_vfd) expected_freespace = 248;
+ if (split_vfd)
+ expected_freespace = 427;
+ if (multi_vfd)
+ expected_freespace = 248;
expected_fs_del = 0;
} /* end if */
else {
MESSAGE(5, ("Testing with old group format\n"));
/* Default: non-paged aggregation, non-persistent free-space */
- my_fapl = fapl;
+ my_fapl = fapl;
expected_freespace = 2464;
- if(split_vfd) expected_freespace = 264;
- if(multi_vfd) expected_freespace = 0;
+ if (split_vfd)
+ expected_freespace = 264;
+ if (multi_vfd)
+ expected_freespace = 0;
expected_fs_del = 4096;
} /* end else */
@@ -4361,7 +4321,7 @@ test_file_freespace(const char *env_h5_drvr)
CHECK(ret, FAIL, "H5Pset_alloc_time");
/* Create datasets in file */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
HDsprintf(name, "Dataset %u", u);
dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
CHECK(dset, FAIL, "H5Dcreate2");
@@ -4384,7 +4344,7 @@ test_file_freespace(const char *env_h5_drvr)
VERIFY(free_space, expected_freespace, "H5Fget_freespace");
/* Delete datasets in file */
- for(k = 9; k >= 0; k--) {
+ for (k = 9; k >= 0; k--) {
HDsprintf(name, "Dataset %u", (unsigned)k);
ret = H5Ldelete(file, name, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
@@ -4422,30 +4382,30 @@ test_file_freespace(const char *env_h5_drvr)
static void
test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
{
- char filename[FILENAME_LEN]; /* Filename to use */
- hid_t file; /* File ID */
- hid_t fcpl; /* File creation property list template */
- hid_t fapl; /* File access property list template */
- hssize_t free_space; /* Amount of free-space in the file */
- hid_t dspace; /* Dataspace ID */
- hid_t dset; /* Dataset ID */
- hid_t dcpl; /* Dataset creation property list */
- char name[32]; /* Dataset name */
- hssize_t nsects = 0; /* # of free-space sections */
- hssize_t nall; /* # of free-space sections for all types of data */
- hssize_t nmeta = 0, nraw = 0; /* # of free-space sections for meta/raw/generic data */
- H5F_sect_info_t sect_info[15]; /* Array to hold free-space information */
- H5F_sect_info_t all_sect_info[15]; /* Array to hold free-space information for all types of data */
- H5F_sect_info_t meta_sect_info[15]; /* Array to hold free-space information for metadata */
- H5F_sect_info_t raw_sect_info[15]; /* Array to hold free-space information for raw data */
- hsize_t total = 0; /* sum of the free-space section sizes */
- hsize_t tmp_tot = 0; /* Sum of the free-space section sizes */
- hsize_t last_size; /* Size of last free-space section */
- hsize_t dims[1]; /* Dimension sizes */
- unsigned u; /* Local index variable */
- H5FD_mem_t type;
- hbool_t split_vfd = FALSE, multi_vfd = FALSE;
- herr_t ret; /* Return value */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file; /* File ID */
+ hid_t fcpl; /* File creation property list template */
+ hid_t fapl; /* File access property list template */
+ hssize_t free_space; /* Amount of free-space in the file */
+ hid_t dspace; /* Dataspace ID */
+ hid_t dset; /* Dataset ID */
+ hid_t dcpl; /* Dataset creation property list */
+ char name[32]; /* Dataset name */
+ hssize_t nsects = 0; /* # of free-space sections */
+ hssize_t nall; /* # of free-space sections for all types of data */
+ hssize_t nmeta = 0, nraw = 0; /* # of free-space sections for meta/raw/generic data */
+ H5F_sect_info_t sect_info[15]; /* Array to hold free-space information */
+ H5F_sect_info_t all_sect_info[15]; /* Array to hold free-space information for all types of data */
+ H5F_sect_info_t meta_sect_info[15]; /* Array to hold free-space information for metadata */
+ H5F_sect_info_t raw_sect_info[15]; /* Array to hold free-space information for raw data */
+ hsize_t total = 0; /* sum of the free-space section sizes */
+ hsize_t tmp_tot = 0; /* Sum of the free-space section sizes */
+ hsize_t last_size; /* Size of last free-space section */
+ hsize_t dims[1]; /* Dimension sizes */
+ unsigned u; /* Local index variable */
+ H5FD_mem_t type;
+ hbool_t split_vfd = FALSE, multi_vfd = FALSE;
+ herr_t ret; /* Return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing H5Fget_free_sections()--free-space section info in the file\n"));
@@ -4453,7 +4413,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
split_vfd = !HDstrcmp(env_h5_drvr, "split");
multi_vfd = !HDstrcmp(env_h5_drvr, "multi");
- if(!split_vfd && !multi_vfd) {
+ if (!split_vfd && !multi_vfd) {
fapl = h5_fileaccess();
h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename);
@@ -4462,7 +4422,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl, FAIL, "H5Pcreate");
- if(new_format) {
+ if (new_format) {
ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
@@ -4471,12 +4431,12 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
CHECK(ret, FAIL, "H5Pget_file_space_strategy");
/* Set up paged aligned address space for multi/split driver */
- if(multi_vfd || split_vfd) {
+ if (multi_vfd || split_vfd) {
ret = set_multi_split(fapl, FSP_SIZE_DEF, split_vfd);
CHECK(ret, FAIL, "set_multi_split");
}
-
- } else {
+ }
+ else {
ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1);
CHECK(ret, FAIL, "H5Pget_file_space_strategy");
}
@@ -4495,8 +4455,8 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
/* Create 1 large dataset */
dims[0] = 1200;
- dspace = H5Screate_simple(1, dims, NULL);
- dset = H5Dcreate2(file, "Dataset_large", H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ dspace = H5Screate_simple(1, dims, NULL);
+ dset = H5Dcreate2(file, "Dataset_large", H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
CHECK(dset, FAIL, "H5Dcreate2");
/* Close dataset */
@@ -4512,7 +4472,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
CHECK(dspace, FAIL, "H5Screate");
/* Create datasets in file */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
HDsprintf(name, "Dataset %u", u);
dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
CHECK(dset, FAIL, "H5Dcreate2");
@@ -4530,13 +4490,13 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
CHECK(ret, FAIL, "H5Pclose");
/* Delete odd-numbered datasets in file */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
HDsprintf(name, "Dataset %u", u);
- if(u % 2) {
+ if (u % 2) {
ret = H5Ldelete(file, name, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
} /* end if */
- } /* end for */
+ } /* end for */
/* Close file */
ret = H5Fclose(file);
@@ -4559,26 +4519,26 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
VERIFY(nsects, FAIL, "H5Fget_free_sections");
/* Retrieve and verify free space info for all the sections */
- HDmemset(all_sect_info, 0, sizeof(all_sect_info));
+ HDmemset(all_sect_info, 0, sizeof(all_sect_info));
nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)nall, all_sect_info);
VERIFY(nsects, nall, "H5Fget_free_sections");
/* Verify the amount of free-space is correct */
- for(u = 0; u < nall; u++)
+ for (u = 0; u < nall; u++)
total += all_sect_info[u].size;
VERIFY(free_space, total, "H5Fget_free_sections");
/* Save the last section's size */
- last_size = all_sect_info[nall-1].size;
+ last_size = all_sect_info[nall - 1].size;
/* Retrieve and verify free space info for -1 sections */
- HDmemset(sect_info, 0, sizeof(sect_info));
+ HDmemset(sect_info, 0, sizeof(sect_info));
nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)(nall - 1), sect_info);
VERIFY(nsects, nall, "H5Fget_free_sections");
/* Verify the amount of free-space is correct */
total = 0;
- for(u = 0; u < (nall - 1); u++) {
+ for (u = 0; u < (nall - 1); u++) {
VERIFY(sect_info[u].addr, all_sect_info[u].addr, "H5Fget_free_sections");
VERIFY(sect_info[u].size, all_sect_info[u].size, "H5Fget_free_sections");
total += sect_info[u].size;
@@ -4586,13 +4546,13 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
VERIFY(((hsize_t)free_space - last_size), total, "H5Fget_free_sections");
/* Retrieve and verify free-space info for +1 sections */
- HDmemset(sect_info, 0, sizeof(sect_info));
+ HDmemset(sect_info, 0, sizeof(sect_info));
nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)(nall + 1), sect_info);
VERIFY(nsects, nall, "H5Fget_free_sections");
/* Verify amount of free-space is correct */
total = 0;
- for(u = 0; u < nall; u++) {
+ for (u = 0; u < nall; u++) {
VERIFY(sect_info[u].addr, all_sect_info[u].addr, "H5Fget_free_sections");
VERIFY(sect_info[u].size, all_sect_info[u].size, "H5Fget_free_sections");
total += sect_info[u].size;
@@ -4601,24 +4561,25 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
VERIFY(sect_info[nall].size, 0, "H5Fget_free_sections");
VERIFY(free_space, total, "H5Fget_free_sections");
- HDmemset(meta_sect_info, 0, sizeof(meta_sect_info));
- if(multi_vfd) {
+ HDmemset(meta_sect_info, 0, sizeof(meta_sect_info));
+ if (multi_vfd) {
hssize_t ntmp;
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) {
- if(type == H5FD_MEM_DRAW || type == H5FD_MEM_GHEAP)
+ for (type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) {
+ if (type == H5FD_MEM_DRAW || type == H5FD_MEM_GHEAP)
continue;
/* Get the # of free-space sections in the file for metadata */
ntmp = H5Fget_free_sections(file, type, (size_t)0, NULL);
CHECK(ntmp, FAIL, "H5Fget_free_sections");
- if(ntmp > 0) {
+ if (ntmp > 0) {
nsects = H5Fget_free_sections(file, type, (size_t)ntmp, &meta_sect_info[nmeta]);
VERIFY(nsects, ntmp, "H5Fget_free_sections");
nmeta += ntmp;
}
}
- } else {
+ }
+ else {
/* Get the # of free-space sections in the file for metadata */
nmeta = H5Fget_free_sections(file, H5FD_MEM_SUPER, (size_t)0, NULL);
CHECK(nmeta, FAIL, "H5Fget_free_sections");
@@ -4633,19 +4594,19 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
CHECK(nraw, FAIL, "H5Fget_free_sections");
/* Retrieve and verify free-space sections for raw data */
- HDmemset(raw_sect_info, 0, sizeof(raw_sect_info));
+ HDmemset(raw_sect_info, 0, sizeof(raw_sect_info));
nsects = H5Fget_free_sections(file, H5FD_MEM_DRAW, (size_t)nraw, raw_sect_info);
VERIFY(nsects, nraw, "H5Fget_free_sections");
/* Sum all the free-space sections */
- for(u = 0; u < nmeta; u++)
+ for (u = 0; u < nmeta; u++)
tmp_tot += meta_sect_info[u].size;
- for(u = 0; u < nraw; u++)
+ for (u = 0; u < nraw; u++)
tmp_tot += raw_sect_info[u].size;
/* Verify free-space info */
- VERIFY(nmeta+nraw, nall, "H5Fget_free_sections");
+ VERIFY(nmeta + nraw, nall, "H5Fget_free_sections");
VERIFY(tmp_tot, total, "H5Fget_free_sections");
/* Closing */
@@ -4659,7 +4620,6 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
} /* end test_sects_freespace() */
-
/****************************************************************
**
** test_filespace_compatible():
@@ -4672,53 +4632,53 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
static void
test_filespace_compatible(void)
{
- int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
- hid_t fid = -1; /* File id */
- hid_t did = -1; /* Dataset id */
- hid_t fcpl; /* File creation property list template */
- int check[100]; /* Temporary buffer for verifying dataset data */
- int rdbuf[100]; /* Temporary buffer for reading in dataset data */
- uint8_t buf[READ_OLD_BUFSIZE]; /* temporary buffer for reading */
- ssize_t nread; /* Number of bytes read in */
- unsigned i, j; /* Local index variable */
- hssize_t free_space; /* Amount of free-space in the file */
- hbool_t persist; /* Persist free-space or not */
- hsize_t threshold; /* Free-space section threshold */
- H5F_fspace_strategy_t strategy; /* File space handling strategy */
- herr_t ret; /* Return value */
+ int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
+ hid_t fid = -1; /* File id */
+ hid_t did = -1; /* Dataset id */
+ hid_t fcpl; /* File creation property list template */
+ int check[100]; /* Temporary buffer for verifying dataset data */
+ int rdbuf[100]; /* Temporary buffer for reading in dataset data */
+ uint8_t buf[READ_OLD_BUFSIZE]; /* temporary buffer for reading */
+ ssize_t nread; /* Number of bytes read in */
+ unsigned i, j; /* Local index variable */
+ hssize_t free_space; /* Amount of free-space in the file */
+ hbool_t persist; /* Persist free-space or not */
+ hsize_t threshold; /* Free-space section threshold */
+ H5F_fspace_strategy_t strategy; /* File space handling strategy */
+ herr_t ret; /* Return value */
/* Output message about test being performed */
MESSAGE(5, ("File space compatibility testing for 1.6 and 1.8 files\n"));
- for(j = 0; j < NELMTS(OLD_FILENAME); j++) {
+ for (j = 0; j < NELMTS(OLD_FILENAME); j++) {
const char *filename = H5_get_srcdir_filename(OLD_FILENAME[j]); /* Corrected test file name */
/* Open and copy the test file into a temporary file */
- fd_old = HDopen(filename, O_RDONLY);
- CHECK(fd_old, FAIL, "HDopen");
- fd_new = HDopen(FILE5, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW);
- CHECK(fd_new, FAIL, "HDopen");
+ fd_old = HDopen(filename, O_RDONLY);
+ CHECK(fd_old, FAIL, "HDopen");
+ fd_new = HDopen(FILE5, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
+ CHECK(fd_new, FAIL, "HDopen");
- /* Copy data */
- while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) {
+ /* Copy data */
+ while ((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) {
ssize_t write_err = HDwrite(fd_new, buf, (size_t)nread);
CHECK(write_err, -1, "HDwrite");
} /* end while */
- /* Close the files */
- ret = HDclose(fd_old);
- CHECK(ret, FAIL, "HDclose");
- ret = HDclose(fd_new);
- CHECK(ret, FAIL, "HDclose");
+ /* Close the files */
+ ret = HDclose(fd_old);
+ CHECK(ret, FAIL, "HDclose");
+ ret = HDclose(fd_new);
+ CHECK(ret, FAIL, "HDclose");
/* Open the temporary test file */
- fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK(fid, FAIL, "H5Fopen");
+ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
- /* There should not be any free space in the file */
- free_space = H5Fget_freespace(fid);
- CHECK(free_space, FAIL, "H5Fget_freespace");
- VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
+ /* There should not be any free space in the file */
+ free_space = H5Fget_freespace(fid);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+ VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
/* Get the file's file creation property list */
fcpl = H5Fget_create_plist(fid);
@@ -4735,27 +4695,27 @@ test_filespace_compatible(void)
VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
VERIFY(threshold, 1, "H5Pget_file_space_strategy");
- /* Generate raw data */
- for(i = 0; i < 100; i++)
- check[i] = (int)i;
+ /* Generate raw data */
+ for (i = 0; i < 100; i++)
+ check[i] = (int)i;
- /* Open and read the dataset */
- did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT);
- CHECK(did, FAIL, "H5Dopen");
- ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdbuf);
- CHECK(ret, FAIL, "H5Dread");
+ /* Open and read the dataset */
+ did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdbuf);
+ CHECK(ret, FAIL, "H5Dread");
- /* Verify the data read is correct */
- for(i = 0; i < 100; i++)
- VERIFY(rdbuf[i], check[i], "test_compatible");
+ /* Verify the data read is correct */
+ for (i = 0; i < 100; i++)
+ VERIFY(rdbuf[i], check[i], "test_compatible");
- /* Close the dataset */
- ret = H5Dclose(did);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
- /* Remove the dataset */
- ret = H5Ldelete(fid, DSETNAME, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Ldelete");
+ /* Remove the dataset */
+ ret = H5Ldelete(fid, DSETNAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
/* Close the plist */
ret = H5Pclose(fcpl);
@@ -4765,22 +4725,22 @@ test_filespace_compatible(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Re-Open the file */
- fid = H5Fopen(FILE5, H5F_ACC_RDONLY, H5P_DEFAULT);
- CHECK(fid, FAIL, "H5Fopen");
+ /* Re-Open the file */
+ fid = H5Fopen(FILE5, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
- /* The dataset should not be there */
- did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT);
- VERIFY(did, FAIL, "H5Dopen");
+ /* The dataset should not be there */
+ did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT);
+ VERIFY(did, FAIL, "H5Dopen");
- /* There should not be any free space in the file */
- free_space = H5Fget_freespace(fid);
- CHECK(free_space, FAIL, "H5Fget_freespace");
- VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
+ /* There should not be any free space in the file */
+ free_space = H5Fget_freespace(fid);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+ VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
- /* Close the file */
- ret = H5Fclose(fid);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
} /* end for */
} /* test_filespace_compatible */
@@ -4790,10 +4750,13 @@ test_filespace_compatible(void)
** Verify that the latest file space management can open, read and
** modify 1.10.0 HDF5 files :
** h5fc_ext1_i.h5: H5F_FILE_SPACE_ALL, default threshold; has superblock extension but no fsinfo message
-** h5fc_ext1_f.h5: H5F_FILE_SPACE_ALL_PERSIST, default threshold; has superblock extension with fsinfo message
-** h5fc_ext2_if.h5: H5F_FILE_SPACE_ALL, non-default threshold; has superblock extension with fsinfo message
+** h5fc_ext1_f.h5: H5F_FILE_SPACE_ALL_PERSIST, default threshold; has superblock extension with fsinfo
+*message
+** h5fc_ext2_if.h5: H5F_FILE_SPACE_ALL, non-default threshold; has superblock extension with fsinfo
+*message
** h5fc_ext2_sf.h5: H5F_FILE_SPACE_VFD, default threshold; has superblock extension with fsinfo message
-** h5fc_ext3_isf.h5: H5F_FILE_SPACE_AGGR_VFD, default threshold; has superblock extension with fsinfo message
+** h5fc_ext3_isf.h5: H5F_FILE_SPACE_AGGR_VFD, default threshold; has superblock extension with fsinfo
+*message
** h5fc_ext_none.h5: H5F_FILE_SPACE_ALL, default threshold; without superblock extension
** The above files are copied from release 1.10.0 tools/h5format_convert/testfiles.
**
@@ -4801,22 +4764,22 @@ test_filespace_compatible(void)
static void
test_filespace_1_10_0_compatible(void)
{
- hid_t fid = -1; /* File id */
- hid_t did = -1; /* Dataset id */
- hid_t fcpl; /* File creation property list */
- hbool_t persist; /* Persist free-space or not */
- hsize_t threshold; /* Free-space section threshold */
- H5F_fspace_strategy_t strategy; /* File space handling strategy */
- int wbuf[24]; /* Buffer for dataset data */
- int rdbuf[24]; /* Buffer for dataset data */
- int status; /* Status from copying the existing file */
- unsigned i, j; /* Local index variable */
- herr_t ret; /* Return value */
+ hid_t fid = -1; /* File id */
+ hid_t did = -1; /* Dataset id */
+ hid_t fcpl; /* File creation property list */
+ hbool_t persist; /* Persist free-space or not */
+ hsize_t threshold; /* Free-space section threshold */
+ H5F_fspace_strategy_t strategy; /* File space handling strategy */
+ int wbuf[24]; /* Buffer for dataset data */
+ int rdbuf[24]; /* Buffer for dataset data */
+ int status; /* Status from copying the existing file */
+ unsigned i, j; /* Local index variable */
+ herr_t ret; /* Return value */
/* Output message about test being performed */
MESSAGE(5, ("File space compatibility testing for 1.10.0 files\n"));
- for(j = 0; j < NELMTS(OLD_1_10_0_FILENAME); j++) {
+ for (j = 0; j < NELMTS(OLD_1_10_0_FILENAME); j++) {
/* Make a copy of the test file */
status = h5_make_local_copy(OLD_1_10_0_FILENAME[j], FILE5);
CHECK(status, FAIL, "h5_make_local_copy");
@@ -4833,7 +4796,7 @@ test_filespace_1_10_0_compatible(void)
ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
CHECK(ret, FAIL, "H5Pget_file_space_strategy");
- switch(j) {
+ switch (j) {
case 0:
VERIFY(strategy, H5F_FILE_SPACE_STRATEGY_DEF, "H5Pget_file_space_strategy");
VERIFY(persist, H5F_FREE_SPACE_PERSIST_DEF, "H5Pget_file_space_strategy");
@@ -4843,8 +4806,8 @@ test_filespace_1_10_0_compatible(void)
did = H5Dopen2(fid, "/DSET_EA", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
- for(i = 0; i < 24; i++)
- wbuf[i] = (int)j+1;
+ for (i = 0; i < 24; i++)
+ wbuf[i] = (int)j + 1;
/* Write to the dataset */
ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -4864,8 +4827,8 @@ test_filespace_1_10_0_compatible(void)
did = H5Dopen2(fid, "/DSET_NDATA_BT2", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
- for(i = 0; i < 24; i++)
- wbuf[i] = (int)j+1;
+ for (i = 0; i < 24; i++)
+ wbuf[i] = (int)j + 1;
/* Write to the dataset */
ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -4885,8 +4848,8 @@ test_filespace_1_10_0_compatible(void)
did = H5Dopen2(fid, "/DSET_NONE", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
- for(i = 0; i < 24; i++)
- wbuf[i] = (int)j+1;
+ for (i = 0; i < 24; i++)
+ wbuf[i] = (int)j + 1;
/* Write to the dataset */
ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -4906,8 +4869,8 @@ test_filespace_1_10_0_compatible(void)
did = H5Dopen2(fid, "/GROUP/DSET_NDATA_EA", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
- for(i = 0; i < 24; i++)
- wbuf[i] = (int)j+1;
+ for (i = 0; i < 24; i++)
+ wbuf[i] = (int)j + 1;
/* Write to the dataset */
ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -4927,8 +4890,8 @@ test_filespace_1_10_0_compatible(void)
did = H5Dopen2(fid, "/GROUP/DSET_NDATA_FA", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
- for(i = 0; i < 24; i++)
- wbuf[i] = (int)j+1;
+ for (i = 0; i < 24; i++)
+ wbuf[i] = (int)j + 1;
/* Write to the dataset */
ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -4947,8 +4910,8 @@ test_filespace_1_10_0_compatible(void)
did = H5Dopen2(fid, "/GROUP/DSET_NDATA_NONE", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
- for(i = 0; i < 24; i++)
- wbuf[i] = (int)j+1;
+ for (i = 0; i < 24; i++)
+ wbuf[i] = (int)j + 1;
/* Write to the dataset */
ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -4960,7 +4923,7 @@ test_filespace_1_10_0_compatible(void)
break;
default:
- break;
+ break;
}
/* Close the plist */
@@ -4975,7 +4938,7 @@ test_filespace_1_10_0_compatible(void)
fid = H5Fopen(FILE5, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
- switch(j) {
+ switch (j) {
case 0:
/* Open and read the dataset */
did = H5Dopen2(fid, "/DSET_EA", H5P_DEFAULT);
@@ -4985,8 +4948,8 @@ test_filespace_1_10_0_compatible(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the data read is correct */
- for(i = 0; i < 24; i++)
- VERIFY(rdbuf[i], j+1, "test_compatible");
+ for (i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j + 1, "test_compatible");
/* Close the dataset */
ret = H5Dclose(did);
@@ -5002,8 +4965,8 @@ test_filespace_1_10_0_compatible(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the data read is correct */
- for(i = 0; i < 24; i++)
- VERIFY(rdbuf[i], j+1, "test_compatible");
+ for (i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j + 1, "test_compatible");
/* Close the dataset */
ret = H5Dclose(did);
@@ -5019,8 +4982,8 @@ test_filespace_1_10_0_compatible(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the data read is correct */
- for(i = 0; i < 24; i++)
- VERIFY(rdbuf[i], j+1, "test_compatible");
+ for (i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j + 1, "test_compatible");
/* Close the dataset */
ret = H5Dclose(did);
@@ -5036,8 +4999,8 @@ test_filespace_1_10_0_compatible(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the data read is correct */
- for(i = 0; i < 24; i++)
- VERIFY(rdbuf[i], j+1, "test_compatible");
+ for (i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j + 1, "test_compatible");
/* Close the dataset */
ret = H5Dclose(did);
@@ -5054,8 +5017,8 @@ test_filespace_1_10_0_compatible(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the data read is correct */
- for(i = 0; i < 24; i++)
- VERIFY(rdbuf[i], j+1, "test_compatible");
+ for (i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j + 1, "test_compatible");
/* Close the dataset */
ret = H5Dclose(did);
@@ -5072,8 +5035,8 @@ test_filespace_1_10_0_compatible(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the data read is correct */
- for(i = 0; i < 24; i++)
- VERIFY(rdbuf[i], j+1, "test_compatible");
+ for (i = 0; i < 24; i++)
+ VERIFY(rdbuf[i], j + 1, "test_compatible");
/* Close the dataset */
ret = H5Dclose(did);
@@ -5081,7 +5044,7 @@ test_filespace_1_10_0_compatible(void)
break;
default:
- break;
+ break;
}
/* Close the file */
@@ -5115,52 +5078,51 @@ test_filespace_1_10_0_compatible(void)
static void
test_filespace_round_compatible(void)
{
- hid_t fid = -1; /* File id */
- hid_t fcpl = -1; /* File creation property list ID */
- unsigned j; /* Local index variable */
- H5F_fspace_strategy_t strategy; /* File space strategy */
- hbool_t persist; /* Persist free-space or not */
- hsize_t threshold; /* Free-space section threshold */
- hssize_t free_space; /* Amount of free space in the file */
- int status; /* Status from copying the existing file */
- herr_t ret; /* Return value */
+ hid_t fid = -1; /* File id */
+ hid_t fcpl = -1; /* File creation property list ID */
+ unsigned j; /* Local index variable */
+ H5F_fspace_strategy_t strategy; /* File space strategy */
+ hbool_t persist; /* Persist free-space or not */
+ hsize_t threshold; /* Free-space section threshold */
+ hssize_t free_space; /* Amount of free space in the file */
+ int status; /* Status from copying the existing file */
+ herr_t ret; /* Return value */
/* Output message about test being performed */
MESSAGE(5, ("File space compatibility testing for files from trunk to 1_8 to trunk\n"));
- for(j = 0; j < NELMTS(FSPACE_FILENAMES); j++) {
+ for (j = 0; j < NELMTS(FSPACE_FILENAMES); j++) {
/* Make a copy of the test file */
status = h5_make_local_copy(FSPACE_FILENAMES[j], FILE5);
- CHECK(status, FAIL, "h5_make_local_copy");
+ CHECK(status, FAIL, "h5_make_local_copy");
- /* Open the temporary test file */
- fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK(fid, FAIL, "H5Fopen");
+ /* Open the temporary test file */
+ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
- /* Get the file's creation property list */
- fcpl = H5Fget_create_plist(fid);
- CHECK(fcpl, FAIL, "H5Fget_create_plist");
+ /* Get the file's creation property list */
+ fcpl = H5Fget_create_plist(fid);
+ CHECK(fcpl, FAIL, "H5Fget_create_plist");
- ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
- CHECK(ret, FAIL, "H5Pget_file_space_strategy");
- VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
- VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
- VERIFY(threshold, 1, "H5Pget_file_space_strategy");
+ ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space_strategy");
+ VERIFY(strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5Pget_file_space_strategy");
+ VERIFY(persist, FALSE, "H5Pget_file_space_strategy");
+ VERIFY(threshold, 1, "H5Pget_file_space_strategy");
- /* There should not be any free space in the file */
- free_space = H5Fget_freespace(fid);
- CHECK(free_space, FAIL, "H5Fget_freespace");
- VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
+ /* There should not be any free space in the file */
+ free_space = H5Fget_freespace(fid);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+ VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
- /* Closing */
- ret = H5Fclose(fid);
- ret = H5Pclose(fcpl);
- CHECK(ret, FAIL, "H5Fclose");
+ /* Closing */
+ ret = H5Fclose(fid);
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Fclose");
} /* end for */
} /* test_filespace_round_compatible */
-
/****************************************************************
**
** test_libver_bounds_real():
@@ -5170,13 +5132,13 @@ test_filespace_round_compatible(void)
**
****************************************************************/
static void
-test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
- H5F_libver_t libver_mod, unsigned oh_vers_mod)
+test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F_libver_t libver_mod,
+ unsigned oh_vers_mod)
{
- hid_t file, group; /* Handles */
- hid_t fapl; /* File access property list */
- H5O_native_info_t ninfo; /* Object info */
- herr_t ret; /* Return value */
+ hid_t file, group; /* Handles */
+ hid_t fapl; /* File access property list */
+ H5O_native_info_t ninfo; /* Object info */
+ herr_t ret; /* Return value */
/*
* Create a new file using the creation properties.
@@ -5255,7 +5217,6 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
CHECK(ret, FAIL, "H5Pclose");
} /* end test_libver_bounds_real() */
-
/*-------------------------------------------------------------------------
* Function: test_libver_bounds_open
*
@@ -5266,22 +5227,22 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
*
*-------------------------------------------------------------------------
*/
-#define VERBFNAME "tverbounds_dspace.h5"
-#define VERBDSNAME "dataset 1"
-#define SPACE1_DIM1 3
+#define VERBFNAME "tverbounds_dspace.h5"
+#define VERBDSNAME "dataset 1"
+#define SPACE1_DIM1 3
static void
test_libver_bounds_open(void)
{
- hid_t file = -1; /* File ID */
- hid_t space = -1; /* Dataspace ID */
- hid_t dset = -1; /* Dataset ID */
- hid_t fapl = -1; /* File access property list ID */
- hid_t new_fapl = -1;/* File access property list ID for reopened file */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hsize_t dim[1] = {SPACE1_DIM1}; /* Dataset dimensions */
- H5F_libver_t low, high; /* File format bounds */
- hsize_t chunk_dim[1] = {SPACE1_DIM1}; /* Chunk dimensions */
- herr_t ret; /* Generic return value */
+ hid_t file = -1; /* File ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t new_fapl = -1; /* File access property list ID for reopened file */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hsize_t dim[1] = {SPACE1_DIM1}; /* Dataset dimensions */
+ H5F_libver_t low, high; /* File format bounds */
+ hsize_t chunk_dim[1] = {SPACE1_DIM1}; /* Chunk dimensions */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Opening File in Various Version Bounds\n"));
@@ -5310,9 +5271,9 @@ test_libver_bounds_open(void)
dataset, then close the file */
/* Set version bounds to (LATEST, LATEST) */
- low = H5F_LIBVER_LATEST;
+ low = H5F_LIBVER_LATEST;
high = H5F_LIBVER_LATEST;
- ret = H5Pset_libver_bounds(fapl, low, high);
+ ret = H5Pset_libver_bounds(fapl, low, high);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
/* Create the file */
@@ -5331,23 +5292,20 @@ test_libver_bounds_open(void)
/* Attempt to open latest file with (earliest, v18), should fail */
ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18);
- H5E_BEGIN_TRY {
- file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); }
+ H5E_END_TRY;
VERIFY(file, FAIL, "Attempted to open latest file with earliest version");
/* Attempt to open latest file with (v18, v18), should fail */
ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18);
- H5E_BEGIN_TRY {
- file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl); }
+ H5E_END_TRY;
VERIFY(file, FAIL, "Attempted to open latest file with v18 bounds");
/* Opening VERBFNAME in these combination should succeed.
For each low bound, verify that it is upgraded properly */
high = H5F_LIBVER_LATEST;
- for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
- {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
H5F_libver_t new_low = H5F_LIBVER_EARLIEST;
/* Set version bounds for opening file */
@@ -5382,7 +5340,6 @@ test_libver_bounds_open(void)
CHECK(ret, FAIL, "H5Pclose");
} /* end test_libver_bounds_open() */
-
/*-------------------------------------------------------------------------
* Function: test_libver_bounds_copy
*
@@ -5407,11 +5364,11 @@ test_libver_bounds_open(void)
static void
test_libver_bounds_copy(void)
{
- hid_t src_fid = -1; /* File ID */
- hid_t dst_fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list ID */
- const char *src_fname; /* Source file name */
- herr_t ret; /* Generic return value */
+ hid_t src_fid = -1; /* File ID */
+ hid_t dst_fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ const char *src_fname; /* Source file name */
+ herr_t ret; /* Generic return value */
/* Output message about the test being performed */
MESSAGE(5, ("Testing H5Ocopy a dataset in a 1.8 library file to a 1.10 library file\n"));
@@ -5501,9 +5458,9 @@ test_libver_bounds(void)
static void
test_libver_bounds_low_high(void)
{
- hid_t fapl = H5I_INVALID_HID; /* File access property list */
- H5F_libver_t low, high; /* Low and high bounds */
- herr_t ret; /* The return value */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* The return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing setting (low, high) format version bounds\n"));
@@ -5513,22 +5470,24 @@ test_libver_bounds_low_high(void)
CHECK(fapl, H5I_INVALID_HID, "H5Pcreate");
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* Set the low/high version bounds */
ret = H5Pset_libver_bounds(fapl, low, high);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Should fail: invalid combinations */
- if(high == H5F_LIBVER_EARLIEST) {
+ if (high == H5F_LIBVER_EARLIEST) {
VERIFY(ret, FAIL, "H5Pset_libver_bounds");
continue;
}
/* Should fail: invalid combinations */
- if(high < low) {
+ if (high < low) {
VERIFY(ret, FAIL, "H5Pset_libver_bounds");
continue;
}
@@ -5550,7 +5509,6 @@ test_libver_bounds_low_high(void)
} /* end test_libver_bounds_low_high() */
-
/***********************************************************************
**
** test_libver_bounds_super():
@@ -5573,8 +5531,8 @@ test_libver_bounds_low_high(void)
static void
test_libver_bounds_super(hid_t fapl)
{
- hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
- herr_t ret; /* The return value */
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ herr_t ret; /* The return value */
/* Create a default fcpl: #A */
/* This will result in superblock version 0 */
@@ -5662,7 +5620,6 @@ test_libver_bounds_super(hid_t fapl)
} /* end test_libver_bounds_super() */
-
/**************************************************************************************************
**
** test_libver_bounds_super_create():
@@ -5715,19 +5672,18 @@ test_libver_bounds_super(hid_t fapl)
static void
test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- H5F_t *f = NULL; /* Internal file pointer */
- H5F_libver_t low, high; /* Low and high bounds */
- hbool_t ok; /* The result is ok or not */
- herr_t ret; /* The return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ H5F_t * f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ hbool_t ok; /* The result is ok or not */
+ herr_t ret; /* The return value */
/* Try to create the file */
- H5E_BEGIN_TRY {
- fid = H5Fcreate(FILE8, H5F_ACC_TRUNC | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fcreate(FILE8, H5F_ACC_TRUNC | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), fcpl, fapl); }
+ H5E_END_TRY;
/* Get the internal file pointer if the create succeeds */
- if(fid >= 0) {
+ if (fid >= 0) {
f = (H5F_t *)H5VL_object(fid);
CHECK(f, NULL, "H5VL_object");
}
@@ -5736,41 +5692,41 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n
ret = H5Pget_libver_bounds(fapl, &low, &high);
CHECK(ret, FAIL, "H5Pget_libver_bounds");
- if(non_def_fsm && high < H5F_LIBVER_V110)
+ if (non_def_fsm && high < H5F_LIBVER_V110)
VERIFY(fid, H5I_INVALID_HID, "H5Fcreate");
- else if(is_swmr) { /* SWMR is enabled */
- if(high >= H5F_LIBVER_V110) { /* Should succeed */
+ else if (is_swmr) { /* SWMR is enabled */
+ if (high >= H5F_LIBVER_V110) { /* Should succeed */
VERIFY(fid >= 0, TRUE, "H5Fcreate");
VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds");
VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds");
-
- } else /* Should fail */
+ }
+ else /* Should fail */
VERIFY(fid >= 0, FALSE, "H5Fcreate");
-
- } else { /* Should succeed */
+ }
+ else { /* Should succeed */
VERIFY(fid >= 0, TRUE, "H5Fcreate");
VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds");
- switch(low) {
+ switch (low) {
case H5F_LIBVER_EARLIEST:
- ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF ||
- f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 ||
- f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
- VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
- break;
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF ||
+ f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 ||
+ f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
+ VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+ break;
case H5F_LIBVER_V18:
- ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
- VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
- break;
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
+ VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+ break;
case H5F_LIBVER_V110:
case H5F_LIBVER_V112:
case H5F_LIBVER_V114:
- ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3);
- VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
- break;
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3);
+ VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+ break;
case H5F_LIBVER_ERROR:
case H5F_LIBVER_NBOUNDS:
@@ -5781,7 +5737,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n
} /* end else */
- if(fid >= 0) { /* Close the file */
+ if (fid >= 0) { /* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
}
@@ -5879,26 +5835,25 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n
static void
test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- H5F_t *f = NULL; /* Internal file pointer */
- hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
- unsigned super_vers; /* Superblock version */
- H5F_libver_t low, high; /* Low and high bounds */
- herr_t ret; /* Return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ H5F_t * f = NULL; /* Internal file pointer */
+ hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
+ unsigned super_vers; /* Superblock version */
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* Return value */
/* Create the file with the input fcpl and fapl */
- H5E_BEGIN_TRY {
- fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); }
+ H5E_END_TRY;
/* Retrieve the low/high bounds */
ret = H5Pget_libver_bounds(fapl, &low, &high);
CHECK(ret, FAIL, "H5Pget_libver_bounds");
- if(non_def_fsm && high < H5F_LIBVER_V110) {
+ if (non_def_fsm && high < H5F_LIBVER_V110) {
VERIFY(fid, H5I_INVALID_HID, "H5Fcreate");
-
- } else {
+ }
+ else {
VERIFY(fid >= 0, TRUE, "H5Fcreate");
/* Get the internal file pointer */
@@ -5917,53 +5872,57 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non
CHECK(new_fapl, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high bounds in new_fapl */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(new_fapl, low, high);
- } H5E_END_TRY;
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); }
+ H5E_END_TRY;
/* Invalid combinations */
if (ret < 0)
continue;
/* Open the file with or without SWMR access */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
fid = H5Fopen(FILE8, H5F_ACC_RDWR | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), new_fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(non_def_fsm && high < H5F_LIBVER_V110) {
+ if (non_def_fsm && high < H5F_LIBVER_V110) {
VERIFY(fid, H5I_INVALID_HID, "H5Fopen");
continue;
}
/* Get the internal file pointer if the open succeeds */
- if(fid >= 0) {
+ if (fid >= 0) {
f = (H5F_t *)H5VL_object(fid);
CHECK(f, NULL, "H5VL_object");
}
/* Verify the file open succeeds or fails */
- switch(super_vers) {
+ switch (super_vers) {
case 3:
- if(high >= H5F_LIBVER_V110) {
+ if (high >= H5F_LIBVER_V110) {
/* Should succeed */
VERIFY(fid >= 0, TRUE, "H5Fopen");
- VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds");
+ VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE,
+ "HDF5_superblock_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- } else /* Should fail */
+ }
+ else /* Should fail */
VERIFY(fid >= 0, FALSE, "H5Fopen");
break;
case 2:
- if(is_swmr) /* Should fail */
+ if (is_swmr) /* Should fail */
VERIFY(fid >= 0, FALSE, "H5Fopen");
else { /* Should succeed */
VERIFY(fid >= 0, TRUE, "H5Fopen");
- VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds");
+ VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE,
+ "HDF5_superblock_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
@@ -5973,7 +5932,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non
case 1:
case 0:
- if(is_swmr) /* Should fail */
+ if (is_swmr) /* Should fail */
VERIFY(fid >= 0, FALSE, "H5Fopen");
else { /* Should succeed */
VERIFY(fid >= 0, TRUE, "H5Fopen");
@@ -5987,8 +5946,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non
default:
break;
} /* end switch */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close the file access property list */
ret = H5Pclose(new_fapl);
@@ -6026,15 +5985,15 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non
static void
test_libver_bounds_obj(hid_t fapl)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
- hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
- H5F_t *f = NULL; /* Internal file pointer */
- H5F_libver_t low, high; /* Low and high bounds */
- H5O_native_info_t ninfo; /* Object info */
- H5G_info_t ginfo; /* Group info */
- herr_t ret; /* Return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
+ H5F_t * f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ H5O_native_info_t ninfo; /* Object info */
+ H5G_info_t ginfo; /* Group info */
+ herr_t ret; /* Return value */
/* Retrieve the low/high bounds from the input fapl */
ret = H5Pget_libver_bounds(fapl, &low, &high);
@@ -6093,21 +6052,19 @@ test_libver_bounds_obj(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file with the fapl; create a group and verify the
object header version, then delete the group and close the file.*/
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(new_fapl, low, high);
- } H5E_END_TRY;
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid combinations */
continue;
/* Open the file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); }
+ H5E_END_TRY;
- if(fid >=0 ) { /* The file open succeeds */
+ if (fid >= 0) { /* The file open succeeds */
/* Get the internal file pointer */
f = (H5F_t *)H5VL_object(fid);
@@ -6122,7 +6079,7 @@ test_libver_bounds_obj(hid_t fapl)
CHECK(ret, FAIL, "H5Gget_info");
/* Verify group storage type */
- if(f->shared->low_bound >= H5F_LIBVER_V18)
+ if (f->shared->low_bound >= H5F_LIBVER_V18)
/* Links in group are stored in object header */
VERIFY(ginfo.storage_type, H5G_STORAGE_TYPE_COMPACT, "H5Gget_info");
else
@@ -6149,8 +6106,8 @@ test_libver_bounds_obj(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close the file access property list */
ret = H5Pclose(new_fapl);
@@ -6186,20 +6143,20 @@ test_libver_bounds_obj(hid_t fapl)
static void
test_libver_bounds_dataset(hid_t fapl)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
- H5D_t *dset = NULL; /* Internal dataset pointer */
- H5F_t *f = NULL; /* Internal file pointer */
- H5F_libver_t low, high; /* Low and high bounds */
- herr_t ret; /* Return value */
- hsize_t fix_dims2[2] = {10, 4}; /* Dimension sizes */
- hsize_t fix_chunks2[2] = {4, 3}; /* Chunk dimension sizes */
- hsize_t dims2[2] = {1, 4}; /* Dimension sizes */
- hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunks2[2] = {4, 5}; /* Chunk dimension sizes */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+ H5D_t * dset = NULL; /* Internal dataset pointer */
+ H5F_t * f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* Return value */
+ hsize_t fix_dims2[2] = {10, 4}; /* Dimension sizes */
+ hsize_t fix_chunks2[2] = {4, 3}; /* Chunk dimension sizes */
+ hsize_t dims2[2] = {1, 4}; /* Dimension sizes */
+ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunks2[2] = {4, 5}; /* Chunk dimension sizes */
/* Retrieve the low/high bounds from the input fapl */
ret = H5Pget_libver_bounds(fapl, &low, &high);
@@ -6222,12 +6179,13 @@ test_libver_bounds_dataset(hid_t fapl)
CHECK(dset, NULL, "H5VL_object");
/* Verify version for layout and fill value messages */
- if(low == H5F_LIBVER_EARLIEST) {
+ if (low == H5F_LIBVER_EARLIEST) {
/* For layout message: the earliest version the library will set is 3 */
/* For fill value message: the earliest version the library will set is 2 */
VERIFY(dset->shared->layout.version, H5O_LAYOUT_VERSION_DEFAULT, "H5O_layout_ver_bounds");
VERIFY(dset->shared->dcpl_cache.fill.version, H5O_FILL_VERSION_2, "H5O_fill_ver_bounds");
- } else {
+ }
+ else {
VERIFY(dset->shared->layout.version, H5O_layout_ver_bounds[low], "H5O_layout_ver_bounds");
VERIFY(dset->shared->dcpl_cache.fill.version, H5O_fill_ver_bounds[low], "H5O_fill_ver_bounds");
}
@@ -6256,11 +6214,10 @@ test_libver_bounds_dataset(hid_t fapl)
CHECK(ret, FAIL, "H5Pset_chunk_opts");
/* Create the chunked dataset */
- H5E_BEGIN_TRY {
- did = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { did = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); }
+ H5E_END_TRY;
- if(did >= 0) {
+ if (did >= 0) {
/* Get the internal dataset pointer */
dset = (H5D_t *)H5VL_object(did);
@@ -6304,21 +6261,19 @@ test_libver_bounds_dataset(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file with the fapl and create the chunked dataset */
/* Verify the dataset's layout, fill value and filter pipleline message versions */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(new_fapl, low, high);
- } H5E_END_TRY;
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
continue;
/* Open the file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); }
+ H5E_END_TRY;
- if(fid >=0 ) { /* The file open succeeds */
+ if (fid >= 0) { /* The file open succeeds */
/* Get the internal file pointer */
f = (H5F_t *)H5VL_object(fid);
@@ -6334,21 +6289,25 @@ test_libver_bounds_dataset(hid_t fapl)
/* Verify the dataset's layout, fill value and filter pipeline message versions */
/* Also verify the chunk indexing type */
- if(f->shared->low_bound == H5F_LIBVER_EARLIEST) {
+ if (f->shared->low_bound == H5F_LIBVER_EARLIEST) {
/* For layout message: the earliest version the library will set is 3 */
/* For fill value message: the earliest version the library will set is 2 */
VERIFY(dset->shared->layout.version, H5O_LAYOUT_VERSION_DEFAULT, "H5O_layout_ver_bounds");
VERIFY(dset->shared->dcpl_cache.fill.version, H5O_FILL_VERSION_2, "H5O_fill_ver_bounds");
- } else {
- VERIFY(dset->shared->layout.version, H5O_layout_ver_bounds[f->shared->low_bound], "H5O_layout_ver_bounds");
- VERIFY(dset->shared->dcpl_cache.fill.version, H5O_fill_ver_bounds[f->shared->low_bound], "H5O_fill_ver_bounds");
+ }
+ else {
+ VERIFY(dset->shared->layout.version, H5O_layout_ver_bounds[f->shared->low_bound],
+ "H5O_layout_ver_bounds");
+ VERIFY(dset->shared->dcpl_cache.fill.version, H5O_fill_ver_bounds[f->shared->low_bound],
+ "H5O_fill_ver_bounds");
}
/* Verify the filter pipeline message version */
- VERIFY(dset->shared->dcpl_cache.pline.version, H5O_pline_ver_bounds[f->shared->low_bound], "H5O_pline_ver_bounds");
+ VERIFY(dset->shared->dcpl_cache.pline.version, H5O_pline_ver_bounds[f->shared->low_bound],
+ "H5O_pline_ver_bounds");
/* Verify the dataset's chunk indexing type */
- if(dset->shared->layout.version == H5O_LAYOUT_VERSION_LATEST)
+ if (dset->shared->layout.version == H5O_LAYOUT_VERSION_LATEST)
VERIFY(dset->shared->layout.u.chunk.idx_type, H5D_CHUNK_IDX_BT2, "chunk_index_type");
else
VERIFY(dset->shared->layout.u.chunk.idx_type, H5D_CHUNK_IDX_BTREE, "chunk_index_type");
@@ -6366,8 +6325,8 @@ test_libver_bounds_dataset(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close the file access property list */
ret = H5Pclose(new_fapl);
@@ -6410,22 +6369,22 @@ test_libver_bounds_dataset(hid_t fapl)
static void
test_libver_bounds_dataspace(hid_t fapl)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
- hid_t did = H5I_INVALID_HID, did_null = H5I_INVALID_HID; /* Dataset IDs */
- hid_t did_compact = H5I_INVALID_HID, did_contig = H5I_INVALID_HID; /* Dataset IDs */
- hid_t sid = H5I_INVALID_HID, sid_null = H5I_INVALID_HID; /* Dataspace IDs */
- hid_t sid_compact = H5I_INVALID_HID, sid_contig = H5I_INVALID_HID; /* Dataspace IDs */
- hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
- hid_t dcpl_compact = H5I_INVALID_HID, dcpl_contig = H5I_INVALID_HID; /* Dataset creation property lists */
- H5S_t *space = NULL, *space_null = NULL; /* Internal dataspace pointers */
- H5F_t *f = NULL; /* Internal file pointer */
- H5F_libver_t low, high; /* Low and high bounds */
- hsize_t dims[1] = {1}; /* Dimension sizes */
- hsize_t dims2[2] = {5, 4}; /* Dimension sizes */
- hsize_t max_dims[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunks[1] = {4}; /* Chunk dimension sizes */
- herr_t ret; /* Return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t did = H5I_INVALID_HID, did_null = H5I_INVALID_HID; /* Dataset IDs */
+ hid_t did_compact = H5I_INVALID_HID, did_contig = H5I_INVALID_HID; /* Dataset IDs */
+ hid_t sid = H5I_INVALID_HID, sid_null = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t sid_compact = H5I_INVALID_HID, sid_contig = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+ hid_t dcpl_compact = H5I_INVALID_HID, dcpl_contig = H5I_INVALID_HID; /* Dataset creation property lists */
+ H5S_t * space = NULL, *space_null = NULL; /* Internal dataspace pointers */
+ H5F_t * f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ hsize_t dims[1] = {1}; /* Dimension sizes */
+ hsize_t dims2[2] = {5, 4}; /* Dimension sizes */
+ hsize_t max_dims[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunks[1] = {4}; /* Chunk dimension sizes */
+ herr_t ret; /* Return value */
/* Retrieve the low/high bounds from the input fapl */
ret = H5Pget_libver_bounds(fapl, &low, &high);
@@ -6517,24 +6476,22 @@ test_libver_bounds_dataspace(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file and create the chunked/compact/contiguous datasets */
/* Verify the dataspace message version for the three datasets */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- hid_t tmp_sid, tmp_sid_compact, tmp_sid_contig; /* Dataspace IDs */
- H5S_t *tmp_space, *tmp_space_compact, *tmp_space_contig; /* Internal dataspace pointers */
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ hid_t tmp_sid, tmp_sid_compact, tmp_sid_contig; /* Dataspace IDs */
+ H5S_t *tmp_space, *tmp_space_compact, *tmp_space_contig; /* Internal dataspace pointers */
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(new_fapl, low, high);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
continue;
/* Open the file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); }
+ H5E_END_TRY;
- if(fid >=0 ) { /* The file open succeeds */
+ if (fid >= 0) { /* The file open succeeds */
/* Get the internal file pointer */
f = (H5F_t *)H5VL_object(fid);
@@ -6551,7 +6508,8 @@ test_libver_bounds_dataspace(hid_t fapl)
CHECK(tmp_space, NULL, "H5I_object");
/* Create the compact dataset */
- did_compact = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid_compact, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT);
+ did_compact = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid_compact, H5P_DEFAULT, dcpl_compact,
+ H5P_DEFAULT);
CHECK(did_compact, H5I_INVALID_HID, "H5Dcreate2");
/* Get the internal dataspace pointer for the compact dataset */
@@ -6561,7 +6519,8 @@ test_libver_bounds_dataspace(hid_t fapl)
CHECK(tmp_space_compact, NULL, "H5I_object");
/* Create the contiguous dataset */
- did_contig = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid_contig, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT);
+ did_contig =
+ H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid_contig, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT);
CHECK(did_contig, H5I_INVALID_HID, "H5Dcreate2");
/* Get the internal dataspace pointer for the contiguous dataset */
@@ -6571,9 +6530,12 @@ test_libver_bounds_dataspace(hid_t fapl)
CHECK(tmp_space_contig, NULL, "H5I_object");
/* Verify versions for the three dataspaces */
- VERIFY(tmp_space->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound], "H5O_sdspace_ver_bounds");
- VERIFY(tmp_space_compact->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound], "H5O_sdspace_ver_bounds");
- VERIFY(tmp_space_contig->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound], "H5O_sdspace_ver_bounds");
+ VERIFY(tmp_space->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound],
+ "H5O_sdspace_ver_bounds");
+ VERIFY(tmp_space_compact->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound],
+ "H5O_sdspace_ver_bounds");
+ VERIFY(tmp_space_contig->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound],
+ "H5O_sdspace_ver_bounds");
/* Close the three datasets */
ret = H5Dclose(did);
@@ -6604,8 +6566,8 @@ test_libver_bounds_dataspace(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close the file access property list */
ret = H5Pclose(new_fapl);
@@ -6629,7 +6591,6 @@ test_libver_bounds_dataspace(hid_t fapl)
} /* end test_libver_bounds_dataspace() */
-
/****************************************************************
**
** test_libver_bounds_datatype():
@@ -6648,15 +6609,15 @@ test_libver_bounds_dataspace(hid_t fapl)
static void
test_libver_bounds_datatype(hid_t fapl)
{
- hid_t tid = H5I_INVALID_HID, tid_enum = H5I_INVALID_HID, tid_array = H5I_INVALID_HID; /* Datatype IDs */
- hid_t tid_compound = H5I_INVALID_HID, tid_vlen = H5I_INVALID_HID; /* Datatype IDs */
- int enum_value; /* Value for enum datatype */
+ hid_t tid = H5I_INVALID_HID, tid_enum = H5I_INVALID_HID, tid_array = H5I_INVALID_HID; /* Datatype IDs */
+ hid_t tid_compound = H5I_INVALID_HID, tid_vlen = H5I_INVALID_HID; /* Datatype IDs */
+ int enum_value; /* Value for enum datatype */
typedef struct s1 { /* Data structure for compound datatype */
char c;
int i;
} s1;
- hsize_t dims[1] = {1}; /* Dimension sizes */
- herr_t ret; /* Return value */
+ hsize_t dims[1] = {1}; /* Dimension sizes */
+ herr_t ret; /* Return value */
/* Create integer datatype */
tid = H5Tcopy(H5T_NATIVE_INT);
@@ -6665,7 +6626,7 @@ test_libver_bounds_datatype(hid_t fapl)
test_libver_bounds_datatype_check(fapl, tid);
/* Create enum datatype */
- tid_enum = H5Tenum_create(tid);
+ tid_enum = H5Tenum_create(tid);
enum_value = 0;
H5Tenum_insert(tid_enum, "val1", &enum_value);
enum_value = 1;
@@ -6740,22 +6701,22 @@ test_libver_bounds_datatype(hid_t fapl)
static void
test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t new_fapl = H5I_INVALID_HID; /* File acess property list */
- hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
- hid_t dtid = H5I_INVALID_HID; /* Datatype ID for the dataset */
- hid_t str_tid = H5I_INVALID_HID; /* String datatype ID */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hsize_t dims[1] = {1}; /* Dimension sizes */
- hsize_t dims2[2] = {5, 4}; /* Dimension sizes */
- hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunks[2] = {2, 3}; /* Chunk dimension sizes */
- H5T_t *dtype = NULL; /* Internal datatype pointer */
- H5T_t *str_dtype = NULL; /* Internal datatype pointer for the string datatype */
- H5F_t *f = NULL; /* Internal file pointer */
- H5F_libver_t low, high; /* Low and high bounds */
- herr_t ret; /* Return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t new_fapl = H5I_INVALID_HID; /* File acess property list */
+ hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+ hid_t dtid = H5I_INVALID_HID; /* Datatype ID for the dataset */
+ hid_t str_tid = H5I_INVALID_HID; /* String datatype ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hsize_t dims[1] = {1}; /* Dimension sizes */
+ hsize_t dims2[2] = {5, 4}; /* Dimension sizes */
+ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunks[2] = {2, 3}; /* Chunk dimension sizes */
+ H5T_t * dtype = NULL; /* Internal datatype pointer */
+ H5T_t * str_dtype = NULL; /* Internal datatype pointer for the string datatype */
+ H5F_t * f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* Return value */
/* Retrieve the low/high version bounds from the input fapl */
ret = H5Pget_libver_bounds(fapl, &low, &high);
@@ -6800,14 +6761,14 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
* --the library will only use basic version
*/
- if(dtype->shared->type == H5T_COMPOUND ||
- dtype->shared->type == H5T_ENUM ||
- dtype->shared->type == H5T_ARRAY) {
- if(dtype->shared->type == H5T_ARRAY && low == H5F_LIBVER_EARLIEST)
+ if (dtype->shared->type == H5T_COMPOUND || dtype->shared->type == H5T_ENUM ||
+ dtype->shared->type == H5T_ARRAY) {
+ if (dtype->shared->type == H5T_ARRAY && low == H5F_LIBVER_EARLIEST)
VERIFY(dtype->shared->version, H5O_DTYPE_VERSION_2, "H5O_dtype_ver_bounds");
else
VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[low], "H5O_dtype_ver_bounds");
- } else
+ }
+ else
VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "H5O_dtype_ver_bounds");
/* Close the dataset */
@@ -6842,21 +6803,19 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
/* Open the file and create the chunked dataset with the input tid */
/* Verify the dataset's datatype message version */
/* Also verify the committed atatype message version */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(new_fapl, low, high);
- } H5E_END_TRY;
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
continue;
/* Open the file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); }
+ H5E_END_TRY;
- if(fid >= 0 ) { /* The file open succeeds */
+ if (fid >= 0) { /* The file open succeeds */
/* Get the internal file pointer */
f = (H5F_t *)H5VL_object(fid);
@@ -6869,13 +6828,13 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
CHECK(str_dtype, NULL, "H5VL_object");
/* Verify the committed datatype message version */
- VERIFY(str_dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "H5O_dtype_ver_bounds");
+ VERIFY(str_dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST],
+ "H5O_dtype_ver_bounds");
/* Close the committed datatype */
ret = H5Tclose(str_tid);
CHECK(ret, FAIL, "H5Tclose");
-
/* Create the chunked dataset */
did = H5Dcreate2(fid, DSETNAME, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
CHECK(did, H5I_INVALID_HID, "H5Dcreate2");
@@ -6895,16 +6854,17 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
* H5T_INTEGER, H5T_FLOAT, H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_REFERENCE:
* --the library will only use basic version
*/
- if(dtype->shared->type == H5T_COMPOUND ||
- dtype->shared->type == H5T_ENUM ||
- dtype->shared->type == H5T_ARRAY) {
- if(dtype->shared->type == H5T_ARRAY &&
- f->shared->low_bound == H5F_LIBVER_EARLIEST)
+ if (dtype->shared->type == H5T_COMPOUND || dtype->shared->type == H5T_ENUM ||
+ dtype->shared->type == H5T_ARRAY) {
+ if (dtype->shared->type == H5T_ARRAY && f->shared->low_bound == H5F_LIBVER_EARLIEST)
VERIFY(dtype->shared->version, H5O_DTYPE_VERSION_2, "H5O_dtype_ver_bounds");
else
- VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[f->shared->low_bound], "H5O_dtype_ver_bounds");
- } else
- VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "H5O_dtype_ver_bounds");
+ VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[f->shared->low_bound],
+ "H5O_dtype_ver_bounds");
+ }
+ else
+ VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST],
+ "H5O_dtype_ver_bounds");
/* Close the dataset */
ret = H5Dclose(did);
@@ -6923,8 +6883,8 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
CHECK(ret, FAIL, "H5Fclose");
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close the file access property list */
ret = H5Pclose(new_fapl);
@@ -6975,18 +6935,18 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
static void
test_libver_bounds_attributes(hid_t fapl)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
- hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
- hid_t tid = H5I_INVALID_HID; /* Datatype ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t aid = H5I_INVALID_HID; /* Attribute ID */
- hid_t attr_cpl = H5I_INVALID_HID; /* Attribute creation property list */
- H5A_t *attr = NULL; /* Internal attribute pointer */
- H5F_t *f = NULL; /* Internal file pointer */
- H5F_libver_t low, high; /* Low and high bounds */
- herr_t ret; /* Return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t tid = H5I_INVALID_HID; /* Datatype ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t attr_cpl = H5I_INVALID_HID; /* Attribute creation property list */
+ H5A_t * attr = NULL; /* Internal attribute pointer */
+ H5F_t * f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* Return value */
/* Retrieve the low/high bounds from the input fapl */
ret = H5Pget_libver_bounds(fapl, &low, &high);
@@ -7021,7 +6981,7 @@ test_libver_bounds_attributes(hid_t fapl)
CHECK(attr, NULL, "H5VL_object");
/* Verify the attribute version */
- if(low == H5F_LIBVER_EARLIEST)
+ if (low == H5F_LIBVER_EARLIEST)
/* The earliest version the library can set for an attribute with committed datatype is 2 */
VERIFY(attr->shared->version, H5O_ATTR_VERSION_2, "H5O_attr_ver_bounds");
else
@@ -7061,7 +7021,7 @@ test_libver_bounds_attributes(hid_t fapl)
CHECK(attr, NULL, "H5VL_object");
/* Verify attribute version */
- if(low == H5F_LIBVER_EARLIEST)
+ if (low == H5F_LIBVER_EARLIEST)
/* The earliest version the library can set for an attribute with character encoding is 3 */
VERIFY(attr->shared->version, H5O_ATTR_VERSION_3, "H5O_attr_ver_bounds");
else
@@ -7126,7 +7086,7 @@ test_libver_bounds_attributes(hid_t fapl)
CHECK(attr, NULL, "H5VL_object");
/* Verify the attribute version */
- if(low == H5F_LIBVER_EARLIEST)
+ if (low == H5F_LIBVER_EARLIEST)
/* The earliest version the library can set for an attribute with shared datatype is 2 */
VERIFY(attr->shared->version, H5O_ATTR_VERSION_2, "H5O_attr_ver_bounds");
else
@@ -7163,21 +7123,19 @@ test_libver_bounds_attributes(hid_t fapl)
/* Loop through all the combinations of low/high bounds */
/* Open the file and group and attach an attribute to the group */
/* Verify the attribute version */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(new_fapl, low, high);
- } H5E_END_TRY;
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); }
+ H5E_END_TRY;
- if(ret < 0) /* Invalid low/high combinations */
+ if (ret < 0) /* Invalid low/high combinations */
continue;
/* Open the file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl); }
+ H5E_END_TRY;
- if(fid >=0 ) { /* The file open succeeds */
+ if (fid >= 0) { /* The file open succeeds */
/* Get the internal file pointer */
f = (H5F_t *)H5VL_object(fid);
@@ -7196,7 +7154,8 @@ test_libver_bounds_attributes(hid_t fapl)
CHECK(attr, NULL, "H5VL_object");
/* Verify the attribute message version */
- VERIFY(attr->shared->version, H5O_attr_ver_bounds[f->shared->low_bound], "H5O_attr_ver_bounds");
+ VERIFY(attr->shared->version, H5O_attr_ver_bounds[f->shared->low_bound],
+ "H5O_attr_ver_bounds");
/* Close the attribute */
ret = H5Aclose(aid);
@@ -7215,8 +7174,8 @@ test_libver_bounds_attributes(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close the file access property list */
ret = H5Pclose(new_fapl);
@@ -7237,44 +7196,44 @@ test_libver_bounds_attributes(hid_t fapl)
static void
test_libver_macros(void)
{
- int major = H5_VERS_MAJOR;
- int minor = H5_VERS_MINOR;
- int release = H5_VERS_RELEASE;
+ int major = H5_VERS_MAJOR;
+ int minor = H5_VERS_MINOR;
+ int release = H5_VERS_RELEASE;
/* Output message about test being performed */
MESSAGE(5, ("Testing macros for library version comparison\n"));
- VERIFY(H5_VERSION_GE(major,minor,release), TRUE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major-1,minor,release), TRUE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major-1,minor+1,release), TRUE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major-1,minor,release+1), TRUE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major,minor-1,release), TRUE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major,minor-1,release+1), TRUE, "H5_VERSION_GE");
- if(H5_VERS_RELEASE > 0)
- VERIFY(H5_VERSION_GE(major,minor,release-1), TRUE, "H5_VERSION_GE");
-
- VERIFY(H5_VERSION_GE(major+1,minor,release), FALSE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major+1,minor-1,release), FALSE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major+1,minor-1,release-1), FALSE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major,minor+1,release), FALSE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major,minor+1,release-1), FALSE, "H5_VERSION_GE");
- VERIFY(H5_VERSION_GE(major,minor,release+1), FALSE, "H5_VERSION_GE");
-
- VERIFY(H5_VERSION_LE(major,minor,release), TRUE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major+1,minor,release), TRUE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major+1,minor-1,release), TRUE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major+1,minor-1,release-1), TRUE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major,minor+1,release), TRUE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major,minor+1,release-1), TRUE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major,minor,release+1), TRUE, "H5_VERSION_LE");
-
- VERIFY(H5_VERSION_LE(major-1,minor,release), FALSE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major-1,minor+1,release), FALSE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major-1,minor+1,release+1), FALSE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major,minor-1,release), FALSE, "H5_VERSION_LE");
- VERIFY(H5_VERSION_LE(major,minor-1,release+1), FALSE, "H5_VERSION_LE");
- if(H5_VERS_RELEASE > 0)
- VERIFY(H5_VERSION_LE(major,minor,release-1), FALSE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_GE(major, minor, release), TRUE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major - 1, minor, release), TRUE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major - 1, minor + 1, release), TRUE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major - 1, minor, release + 1), TRUE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major, minor - 1, release), TRUE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major, minor - 1, release + 1), TRUE, "H5_VERSION_GE");
+ if (H5_VERS_RELEASE > 0)
+ VERIFY(H5_VERSION_GE(major, minor, release - 1), TRUE, "H5_VERSION_GE");
+
+ VERIFY(H5_VERSION_GE(major + 1, minor, release), FALSE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major + 1, minor - 1, release), FALSE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major + 1, minor - 1, release - 1), FALSE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major, minor + 1, release), FALSE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major, minor + 1, release - 1), FALSE, "H5_VERSION_GE");
+ VERIFY(H5_VERSION_GE(major, minor, release + 1), FALSE, "H5_VERSION_GE");
+
+ VERIFY(H5_VERSION_LE(major, minor, release), TRUE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major + 1, minor, release), TRUE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major + 1, minor - 1, release), TRUE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major + 1, minor - 1, release - 1), TRUE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major, minor + 1, release), TRUE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major, minor + 1, release - 1), TRUE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major, minor, release + 1), TRUE, "H5_VERSION_LE");
+
+ VERIFY(H5_VERSION_LE(major - 1, minor, release), FALSE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major - 1, minor + 1, release), FALSE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major - 1, minor + 1, release + 1), FALSE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major, minor - 1, release), FALSE, "H5_VERSION_LE");
+ VERIFY(H5_VERSION_LE(major, minor - 1, release + 1), FALSE, "H5_VERSION_LE");
+ if (H5_VERS_RELEASE > 0)
+ VERIFY(H5_VERSION_LE(major, minor, release - 1), FALSE, "H5_VERSION_LE");
} /* test_libver_macros() */
/****************************************************************
@@ -7287,10 +7246,10 @@ test_libver_macros(void)
static void
test_libver_macros2(void)
{
- hid_t file;
- hid_t grp;
- htri_t status;
- herr_t ret; /* Return value */
+ hid_t file;
+ hid_t grp;
+ htri_t status;
+ herr_t ret; /* Return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing macros for library version comparison with a file\n"));
@@ -7317,7 +7276,7 @@ test_libver_macros2(void)
* Delete the group using different function based on the library version.
* And verify the action.
*/
-#if H5_VERSION_GE(1,8,0)
+#if H5_VERSION_GE(1, 8, 0)
ret = H5Ldelete(file, "Group", H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lunlink");
@@ -7327,9 +7286,8 @@ test_libver_macros2(void)
ret = H5Gunlink(file, "Group");
CHECK(ret, FAIL, "H5Gunlink");
- H5E_BEGIN_TRY {
- grp = H5Gopen(file, "Group");
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { grp = H5Gopen(file, "Group"); }
+ H5E_END_TRY;
VERIFY(grp, FAIL, "H5Gopen");
#endif
@@ -7351,20 +7309,20 @@ test_libver_macros2(void)
static void
test_incr_filesize(void)
{
- hid_t fid; /* File opened with read-write permission */
- h5_stat_size_t filesize; /* Size of file when empty */
- hid_t fcpl; /* File creation property list */
- hid_t fapl; /* File access property list */
- hid_t dspace; /* Dataspace ID */
- hid_t dset; /* Dataset ID */
- hid_t dcpl; /* Dataset creation property list */
- unsigned u; /* Local index variable */
- char filename[FILENAME_LEN]; /* Filename to use */
- char name[32]; /* Dataset name */
- haddr_t stored_eoa; /* The stored EOA value */
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- herr_t ret; /* Return value */
+ hid_t fid; /* File opened with read-write permission */
+ h5_stat_size_t filesize; /* Size of file when empty */
+ hid_t fcpl; /* File creation property list */
+ hid_t fapl; /* File access property list */
+ hid_t dspace; /* Dataspace ID */
+ hid_t dset; /* Dataset ID */
+ hid_t dcpl; /* Dataset creation property list */
+ unsigned u; /* Local index variable */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ char name[32]; /* Dataset name */
+ haddr_t stored_eoa; /* The stored EOA value */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ herr_t ret; /* Return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing H5Fincrement_filesize() and H5Fget_eoa())\n"));
@@ -7380,7 +7338,7 @@ test_incr_filesize(void)
CHECK(ret, FAIL, "H5PDdriver_query");
/* Check whether the VFD feature flag supports these two public routines */
- if(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO) {
+ if (driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO) {
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl, FAIL, "H5Pcreate");
@@ -7406,7 +7364,7 @@ test_incr_filesize(void)
CHECK(ret, FAIL, "H5Pset_alloc_time");
/* Create datasets in file */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
HDsprintf(name, "Dataset %u", u);
dset = H5Dcreate2(fid, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
CHECK(dset, FAIL, "H5Dcreate2");
@@ -7453,7 +7411,7 @@ test_incr_filesize(void)
filesize = h5_get_file_size(filename, fapl);
/* Verify the filesize is the previous stored_eoa + 512 */
- VERIFY(filesize, stored_eoa+512, "file size");
+ VERIFY(filesize, stored_eoa + 512, "file size");
/* Close the file access property list */
ret = H5Pclose(fapl);
@@ -7478,10 +7436,10 @@ test_incr_filesize(void)
static void
test_min_dset_ohdr(void)
{
- const char basename[] = "min_dset_ohdr_testfile";
- char filename[FILENAME_LEN] = "";
- hid_t file_id = -1;
- hid_t file2_id = -1;
+ const char basename[] = "min_dset_ohdr_testfile";
+ char filename[FILENAME_LEN] = "";
+ hid_t file_id = -1;
+ hid_t file2_id = -1;
hbool_t minimize;
herr_t ret;
@@ -7564,21 +7522,18 @@ test_min_dset_ohdr(void)
*/
/* trying to set with invalid file ID */
- H5E_BEGIN_TRY {
- ret = H5Fset_dset_no_attrs_hint(-1, TRUE);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Fset_dset_no_attrs_hint(-1, TRUE); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Fset_dset_no_attrs_hint");
/* trying to get with invalid file ID */
- H5E_BEGIN_TRY {
- ret = H5Fget_dset_no_attrs_hint(-1, &minimize);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Fget_dset_no_attrs_hint(-1, &minimize); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint");
/* trying to get with invalid pointer */
- H5E_BEGIN_TRY {
- ret = H5Fget_dset_no_attrs_hint(file_id, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Fget_dset_no_attrs_hint(file_id, NULL); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint");
/************/
@@ -7601,17 +7556,17 @@ test_min_dset_ohdr(void)
static void
test_deprec(void)
{
- hid_t file; /* File IDs for old & new files */
- hid_t fcpl; /* File creation property list */
- hid_t fapl; /* File creation property list */
- hid_t new_fapl;
- hsize_t align;
- unsigned super; /* Superblock version # */
- unsigned freelist; /* Free list version # */
- unsigned stab; /* Symbol table entry version # */
- unsigned shhdr; /* Shared object header version # */
- H5F_info1_t finfo; /* global information about file */
- herr_t ret; /* Generic return value */
+ hid_t file; /* File IDs for old & new files */
+ hid_t fcpl; /* File creation property list */
+ hid_t fapl; /* File creation property list */
+ hid_t new_fapl;
+ hsize_t align;
+ unsigned super; /* Superblock version # */
+ unsigned freelist; /* Free list version # */
+ unsigned stab; /* Symbol table entry version # */
+ unsigned shhdr; /* Shared object header version # */
+ H5F_info1_t finfo; /* global information about file */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing deprecated routines\n"));
@@ -7621,38 +7576,37 @@ test_deprec(void)
*/
/* Create file with default file creation property list */
- file= H5Fcreate(FILE1, H5F_ACC_TRUNC , H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fcreate");
/* Get the file's version information */
ret = H5Fget_info1(file, &finfo);
CHECK(ret, FAIL, "H5Fget_info1");
- VERIFY(finfo.super_ext_size, 0,"H5Fget_info1");
- VERIFY(finfo.sohm.hdr_size, 0,"H5Fget_info1");
- VERIFY(finfo.sohm.msgs_info.index_size, 0,"H5Fget_info1");
- VERIFY(finfo.sohm.msgs_info.heap_size, 0,"H5Fget_info1");
+ VERIFY(finfo.super_ext_size, 0, "H5Fget_info1");
+ VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1");
/* Get the file's dataset creation property list */
- fcpl = H5Fget_create_plist(file);
+ fcpl = H5Fget_create_plist(file);
CHECK(fcpl, FAIL, "H5Fget_create_plist");
/* Get the file's version information */
- ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
+ ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
CHECK(ret, FAIL, "H5Pget_version");
- VERIFY(super,0,"H5Pget_version");
- VERIFY(freelist,0,"H5Pget_version");
- VERIFY(stab,0,"H5Pget_version");
- VERIFY(shhdr,0,"H5Pget_version");
+ VERIFY(super, 0, "H5Pget_version");
+ VERIFY(freelist, 0, "H5Pget_version");
+ VERIFY(stab, 0, "H5Pget_version");
+ VERIFY(shhdr, 0, "H5Pget_version");
/* Close FCPL */
- ret=H5Pclose(fcpl);
+ ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
/* Close file */
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
-
/* Create a file creation property list */
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl, FAIL, "H5Pcreate");
@@ -7663,7 +7617,7 @@ test_deprec(void)
CHECK(ret, FAIL, "H5Pset_file_space_strategy");
fapl = H5Pcreate(H5P_FILE_ACCESS);
- ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1024);
+ ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1024);
CHECK(ret, FAIL, "H5Pset_alignment");
/* Creating a file with the non-default file creation property list should
@@ -7671,42 +7625,42 @@ test_deprec(void)
*/
/* Create file with custom file creation property list */
- file= H5Fcreate(FILE1, H5F_ACC_TRUNC , fcpl, fapl);
+ file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(file, FAIL, "H5Fcreate");
new_fapl = H5Fget_access_plist(file);
H5Pget_alignment(new_fapl, NULL, &align);
/* Close FCPL */
- ret=H5Pclose(fcpl);
+ ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
/* Get the file's version information */
ret = H5Fget_info1(file, &finfo);
CHECK(ret, FAIL, "H5Fget_info1");
- VERIFY(finfo.super_ext_size, 152,"H5Fget_info1");
- VERIFY(finfo.sohm.hdr_size, 0,"H5Fget_info1");
- VERIFY(finfo.sohm.msgs_info.index_size, 0,"H5Fget_info1");
- VERIFY(finfo.sohm.msgs_info.heap_size, 0,"H5Fget_info1");
+ VERIFY(finfo.super_ext_size, 152, "H5Fget_info1");
+ VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1");
/* Get the file's dataset creation property list */
- fcpl = H5Fget_create_plist(file);
+ fcpl = H5Fget_create_plist(file);
CHECK(fcpl, FAIL, "H5Fget_create_plist");
/* Get the file's version information */
- ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
+ ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
CHECK(ret, FAIL, "H5Pget_version");
- VERIFY(super,2,"H5Pget_version");
- VERIFY(freelist,0,"H5Pget_version");
- VERIFY(stab,0,"H5Pget_version");
- VERIFY(shhdr,0,"H5Pget_version");
+ VERIFY(super, 2, "H5Pget_version");
+ VERIFY(freelist, 0, "H5Pget_version");
+ VERIFY(stab, 0, "H5Pget_version");
+ VERIFY(shhdr, 0, "H5Pget_version");
/* Close FCPL */
- ret=H5Pclose(fcpl);
+ ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
/* Close file */
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
@@ -7716,37 +7670,37 @@ test_deprec(void)
/* Get the file's version information */
ret = H5Fget_info1(file, &finfo);
CHECK(ret, FAIL, "H5Fget_info1");
- VERIFY(finfo.super_ext_size, 152,"H5Fget_info1");
- VERIFY(finfo.sohm.hdr_size, 0,"H5Fget_info1");
- VERIFY(finfo.sohm.msgs_info.index_size, 0,"H5Fget_info1");
- VERIFY(finfo.sohm.msgs_info.heap_size, 0,"H5Fget_info1");
+ VERIFY(finfo.super_ext_size, 152, "H5Fget_info1");
+ VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1");
/* Get the file's creation property list */
- fcpl = H5Fget_create_plist(file);
+ fcpl = H5Fget_create_plist(file);
CHECK(fcpl, FAIL, "H5Fget_create_plist");
/* Get the file's version information */
- ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
+ ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
CHECK(ret, FAIL, "H5Pget_version");
- VERIFY(super,2,"H5Pget_version");
- VERIFY(freelist,0,"H5Pget_version");
- VERIFY(stab,0,"H5Pget_version");
- VERIFY(shhdr,0,"H5Pget_version");
+ VERIFY(super, 2, "H5Pget_version");
+ VERIFY(freelist, 0, "H5Pget_version");
+ VERIFY(stab, 0, "H5Pget_version");
+ VERIFY(shhdr, 0, "H5Pget_version");
/* Close FCPL */
- ret=H5Pclose(fcpl);
+ ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
/* Close file */
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
{ /* Test deprecated H5Pget/set_file_space() */
H5F_file_space_type_t old_strategy;
- hsize_t old_threshold;
- hid_t fid;
- hid_t ffcpl;
+ hsize_t old_threshold;
+ hid_t fid;
+ hid_t ffcpl;
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl, FAIL, "H5Pcreate");
@@ -7775,19 +7729,19 @@ test_deprec(void)
VERIFY(old_threshold, 3, "H5Pget_file_space");
/* Create a file */
- fid = H5Fcreate(FILE1, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT);
+ fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fcreate");
- old_strategy = H5F_FILE_SPACE_DEFAULT;
+ old_strategy = H5F_FILE_SPACE_DEFAULT;
old_threshold = 0;
- ffcpl = H5Fget_create_plist(fid);
- ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold);
+ ffcpl = H5Fget_create_plist(fid);
+ ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold);
CHECK(ret, FAIL, "H5Pget_file_space");
VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space");
VERIFY(old_threshold, 3, "H5Pget_file_space");
/* Close file */
- ret=H5Fclose(fid);
+ ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
ret = H5Pclose(ffcpl);
@@ -7800,10 +7754,10 @@ test_deprec(void)
fid = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
- old_strategy = H5F_FILE_SPACE_DEFAULT;
+ old_strategy = H5F_FILE_SPACE_DEFAULT;
old_threshold = 0;
- ffcpl = H5Fget_create_plist(fid);
- ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold);
+ ffcpl = H5Fget_create_plist(fid);
+ ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold);
CHECK(ret, FAIL, "H5Pget_file_space");
VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space");
VERIFY(old_threshold, 3, "H5Pget_file_space");
@@ -7811,7 +7765,7 @@ test_deprec(void)
ret = H5Pclose(ffcpl);
CHECK(ret, FAIL, "H5Pclose");
- ret=H5Fclose(fid);
+ ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
}
@@ -7826,77 +7780,80 @@ test_deprec(void)
void
test_file(void)
{
- const char *env_h5_drvr; /* File Driver value from environment */
- hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */
- herr_t ret;
+ const char *env_h5_drvr; /* File Driver value from environment */
+ hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File I/O\n"));
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
/* Improved version of VFD-dependent checks */
fapl_id = h5_fileaccess();
CHECK(fapl_id, H5I_INVALID_HID, "h5_fileaccess");
- test_file_create(); /* Test file creation(also creation templates)*/
- test_file_open(); /* Test file opening */
- test_file_reopen(); /* Test file reopening */
- test_file_close(); /* Test file close behavior */
- test_get_file_id(); /* Test H5Iget_file_id */
- test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */
- test_file_perm(); /* Test file access permissions */
- test_file_perm2(); /* Test file access permission again */
- test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */
- test_file_delete(fapl_id); /* Test H5Fdelete */
- test_file_open_dot(); /* Test opening objects with "." for a name */
- test_file_open_overlap(); /* Test opening files in an overlapping manner */
- test_file_getname(); /* Test basic H5Fget_name() functionality */
- test_file_double_root_open(); /* Test opening root group from two files works properly */
- test_file_double_group_open(); /* Test opening same group from two files works properly */
- test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */
- test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */
+ test_file_create(); /* Test file creation(also creation templates)*/
+ test_file_open(); /* Test file opening */
+ test_file_reopen(); /* Test file reopening */
+ test_file_close(); /* Test file close behavior */
+ test_get_file_id(); /* Test H5Iget_file_id */
+ test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */
+ test_file_perm(); /* Test file access permissions */
+ test_file_perm2(); /* Test file access permission again */
+ test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */
+ test_file_delete(fapl_id); /* Test H5Fdelete */
+ test_file_open_dot(); /* Test opening objects with "." for a name */
+ test_file_open_overlap(); /* Test opening files in an overlapping manner */
+ test_file_getname(); /* Test basic H5Fget_name() functionality */
+ test_file_double_root_open(); /* Test opening root group from two files works properly */
+ test_file_double_group_open(); /* Test opening same group from two files works properly */
+ test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */
+ test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */
test_file_double_file_dataset_open(TRUE);
test_file_double_file_dataset_open(FALSE);
- test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */
- test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */
- test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */
- test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */
- test_userblock_alignment_paged(); /* Tests files created with a userblock and alignment (via paged aggregation) interact properly */
- test_filespace_info(env_h5_drvr); /* Test file creation public routines: */
- /* H5Pget/set_file_space_strategy() & H5Pget/set_file_space_page_size() */
- /* Skipped testing for multi/split drivers */
- test_file_freespace(env_h5_drvr); /* Test file public routine H5Fget_freespace() */
- /* Skipped testing for multi/split drivers */
- /* Setup for multi/split drivers are there already */
- test_sects_freespace(env_h5_drvr, TRUE); /* Test file public routine H5Fget_free_sections() for new format */
- /* Skipped testing for multi/split drivers */
- /* Setup for multi/split drivers are there already */
- test_sects_freespace(env_h5_drvr, FALSE); /* Test file public routine H5Fget_free_sections() */
- /* Skipped testing for multi/split drivers */
- test_filespace_compatible(); /* Test compatibility for file space management */
- test_filespace_round_compatible(); /* Testing file space compatibility for files from trunk to 1_8 to trunk */
- test_filespace_1_10_0_compatible(); /* Testing file space compatibility for files from release 1.10.0 */
- test_libver_bounds(); /* Test compatibility for file space management */
+ test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */
+ test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */
+ test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */
+ test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly
+ */
+ test_userblock_alignment_paged(); /* Tests files created with a userblock and alignment (via paged
+ aggregation) interact properly */
+ test_filespace_info(env_h5_drvr); /* Test file creation public routines: */
+ /* H5Pget/set_file_space_strategy() & H5Pget/set_file_space_page_size() */
+ /* Skipped testing for multi/split drivers */
+ test_file_freespace(env_h5_drvr); /* Test file public routine H5Fget_freespace() */
+ /* Skipped testing for multi/split drivers */
+ /* Setup for multi/split drivers are there already */
+ test_sects_freespace(env_h5_drvr,
+ TRUE); /* Test file public routine H5Fget_free_sections() for new format */
+ /* Skipped testing for multi/split drivers */
+ /* Setup for multi/split drivers are there already */
+ test_sects_freespace(env_h5_drvr, FALSE); /* Test file public routine H5Fget_free_sections() */
+ /* Skipped testing for multi/split drivers */
+ test_filespace_compatible(); /* Test compatibility for file space management */
+ test_filespace_round_compatible(); /* Testing file space compatibility for files from trunk to 1_8 to
+ trunk */
+ test_filespace_1_10_0_compatible(); /* Testing file space compatibility for files from release 1.10.0 */
+ test_libver_bounds(); /* Test compatibility for file space management */
test_libver_bounds_low_high();
- test_libver_macros(); /* Test the macros for library version comparison */
- test_libver_macros2(); /* Test the macros for library version comparison */
- test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */
- test_min_dset_ohdr(); /* Test datset object header minimization */
+ test_libver_macros(); /* Test the macros for library version comparison */
+ test_libver_macros2(); /* Test the macros for library version comparison */
+ test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */
+ test_min_dset_ohdr(); /* Test datset object header minimization */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */
- test_deprec(); /* Test deprecated routines */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */
+ test_deprec(); /* Test deprecated routines */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
ret = H5Pclose(fapl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* test_file() */
-
/*-------------------------------------------------------------------------
* Function: cleanup_file
*
@@ -7924,4 +7881,3 @@ cleanup_file(void)
HDremove(FILE7);
HDremove(DST_FILE);
}
-
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 7ca7dca..910153c 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -12,65 +12,64 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tgenprop
-*
-* Test the Generic Property functionality
-*
-*************************************************************/
+ *
+ * Test program: tgenprop
+ *
+ * Test the Generic Property functionality
+ *
+ *************************************************************/
-#define H5P_FRIEND /*suppress error about including H5Ppkg */
+#define H5P_FRIEND /*suppress error about including H5Ppkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5P_TESTING
#include "testhdf5.h"
-#include "H5Dprivate.h" /* For Dataset creation property list names */
-#include "H5Ppkg.h" /* Generic Properties */
+#include "H5Dprivate.h" /* For Dataset creation property list names */
+#include "H5Ppkg.h" /* Generic Properties */
-#define FILENAME "tgenprop.h5"
+#define FILENAME "tgenprop.h5"
/* Property definitions */
-#define CLASS1_NAME "Class 1"
-#define CLASS1_PATH "root/Class 1"
+#define CLASS1_NAME "Class 1"
+#define CLASS1_PATH "root/Class 1"
-#define CLASS2_NAME "Class 2"
-#define CLASS2_PATH "root/Class 1/Class 2"
+#define CLASS2_NAME "Class 2"
+#define CLASS2_PATH "root/Class 1/Class 2"
/* Property definitions */
-#define PROP1_NAME "Property 1"
-int prop1_def=10; /* Property 1 default value */
+#define PROP1_NAME "Property 1"
+int prop1_def = 10; /* Property 1 default value */
#define PROP1_SIZE sizeof(prop1_def)
#define PROP1_DEF_VALUE (&prop1_def)
-#define PROP2_NAME "Property 2"
-float prop2_def=3.14F; /* Property 2 default value */
+#define PROP2_NAME "Property 2"
+float prop2_def = 3.14F; /* Property 2 default value */
#define PROP2_SIZE sizeof(prop2_def)
#define PROP2_DEF_VALUE (&prop2_def)
-#define PROP3_NAME "Property 3"
-char prop3_def[10]="Ten chars"; /* Property 3 default value */
+#define PROP3_NAME "Property 3"
+char prop3_def[10] = "Ten chars"; /* Property 3 default value */
#define PROP3_SIZE sizeof(prop3_def)
#define PROP3_DEF_VALUE (&prop3_def)
-#define PROP4_NAME "Property 4"
-double prop4_def=1.41F; /* Property 4 default value */
+#define PROP4_NAME "Property 4"
+double prop4_def = 1.41F; /* Property 4 default value */
#define PROP4_SIZE sizeof(prop4_def)
#define PROP4_DEF_VALUE (&prop4_def)
/* Structs used during iteration */
typedef struct iter_data_t {
- int iter_count;
- char **names;
+ int iter_count;
+ char **names;
} iter_data_t;
typedef struct count_data_t {
- int count;
- hid_t id;
+ int count;
+ hid_t id;
} count_data_t;
-
/****************************************************************
**
** test_genprop_basic_class(): Test basic generic property list code.
@@ -80,24 +79,24 @@ typedef struct count_data_t {
static void
test_genprop_basic_class(void)
{
- hid_t cid1; /* Generic Property class ID */
- hid_t cid2; /* Generic Property class ID */
- hid_t cid3; /* Generic Property class ID */
- char *name; /* Name of class */
- herr_t ret; /* Generic return value */
+ hid_t cid1; /* Generic Property class ID */
+ hid_t cid2; /* Generic Property class ID */
+ hid_t cid3; /* Generic Property class ID */
+ char * name; /* Name of class */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Generic Property List Class Creation Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS1_NAME)!=0)
- TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
+ if (HDstrcmp(name, CLASS1_NAME) != 0)
+ TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n", name, CLASS1_NAME);
H5free_memory(name);
/* Check class parent */
@@ -105,11 +104,11 @@ test_genprop_basic_class(void)
CHECK_I(cid2, "H5Pget_class_parent");
/* Verify class parent correct */
- ret = H5Pequal(cid2,H5P_ROOT);
+ ret = H5Pequal(cid2, H5P_ROOT);
VERIFY(ret, 1, "H5Pequal");
/* Make certain false postives aren't being returned */
- ret = H5Pequal(cid2,H5P_FILE_CREATE);
+ ret = H5Pequal(cid2, H5P_FILE_CREATE);
VERIFY(ret, 0, "H5Pequal");
/* Close parent class */
@@ -121,14 +120,14 @@ test_genprop_basic_class(void)
CHECK_I(ret, "H5Pclose_class");
/* Create another new generic class, derived from file creation class */
- cid1 = H5Pcreate_class(H5P_FILE_CREATE,CLASS2_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_FILE_CREATE, CLASS2_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS2_NAME)!=0)
- TestErrPrintf("Class names don't match!, name=%s, CLASS2_NAME=%s\n",name,CLASS2_NAME);
+ if (HDstrcmp(name, CLASS2_NAME) != 0)
+ TestErrPrintf("Class names don't match!, name=%s, CLASS2_NAME=%s\n", name, CLASS2_NAME);
H5free_memory(name);
/* Check class parent */
@@ -136,7 +135,7 @@ test_genprop_basic_class(void)
CHECK_I(cid2, "H5Pget_class_parent");
/* Verify class parent correct */
- ret = H5Pequal(cid2,H5P_FILE_CREATE);
+ ret = H5Pequal(cid2, H5P_FILE_CREATE);
VERIFY(ret, 1, "H5Pequal");
/* Check class parent's parent */
@@ -144,7 +143,7 @@ test_genprop_basic_class(void)
CHECK_I(cid3, "H5Pget_class_parent");
/* Verify class parent's parent correct */
- ret = H5Pequal(cid3,H5P_GROUP_CREATE);
+ ret = H5Pequal(cid3, H5P_GROUP_CREATE);
VERIFY(ret, 1, "H5Pequal");
/* Close parent class's parent */
@@ -169,10 +168,10 @@ test_genprop_basic_class(void)
static void
test_genprop_basic_class_prop(void)
{
- hid_t cid1; /* Generic Property class ID */
- size_t size; /* Size of property */
- size_t nprops; /* Number of properties in class */
- herr_t ret; /* Generic return value */
+ hid_t cid1; /* Generic Property class ID */
+ size_t size; /* Size of property */
+ size_t nprops; /* Number of properties in class */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Generic Property List Class Properties Functionality\n"));
@@ -191,11 +190,13 @@ test_genprop_basic_class_prop(void)
VERIFY(ret, 0, "H5Pexist");
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Try to insert the first property again (should fail) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
VERIFY(ret, FAIL, "H5Pregister2");
/* Check the existance of the first property */
@@ -213,11 +214,13 @@ test_genprop_basic_class_prop(void)
VERIFY(nprops, 1, "H5Pget_nprops");
/* Insert second property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Try to insert the second property again (should fail) */
- ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
VERIFY(ret, FAIL, "H5Pregister2");
/* Check the existance of the second property */
@@ -235,7 +238,8 @@ test_genprop_basic_class_prop(void)
VERIFY(nprops, 2, "H5Pget_nprops");
/* Insert third property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Check the existance of the third property */
@@ -294,12 +298,11 @@ test_genprop_basic_class_prop(void)
**
****************************************************************/
static int
-test_genprop_iter1(hid_t H5_ATTR_UNUSED id, const char *name,
- void *iter_data)
+test_genprop_iter1(hid_t H5_ATTR_UNUSED id, const char *name, void *iter_data)
{
iter_data_t *idata = (iter_data_t *)iter_data;
- return HDstrcmp(name,idata->names[idata->iter_count++]);
+ return HDstrcmp(name, idata->names[idata->iter_count++]);
}
/****************************************************************
@@ -311,19 +314,16 @@ test_genprop_iter1(hid_t H5_ATTR_UNUSED id, const char *name,
static void
test_genprop_class_iter(void)
{
- hid_t cid1; /* Generic Property class ID */
- size_t nprops; /* Number of properties in class */
- int idx; /* Index to start iteration at */
- struct { /* Struct for iterations */
- int iter_count;
+ hid_t cid1; /* Generic Property class ID */
+ size_t nprops; /* Number of properties in class */
+ int idx; /* Index to start iteration at */
+ struct { /* Struct for iterations */
+ int iter_count;
const char **names;
} iter_struct;
- const char *pnames[4]={ /* Names of properties for iterator */
- PROP1_NAME,
- PROP2_NAME,
- PROP3_NAME,
- PROP4_NAME};
- herr_t ret; /* Generic return value */
+ const char *pnames[4] = {/* Names of properties for iterator */
+ PROP1_NAME, PROP2_NAME, PROP3_NAME, PROP4_NAME};
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Generic Property List Class Property Iteration Functionality\n"));
@@ -333,35 +333,39 @@ test_genprop_class_iter(void)
CHECK_I(cid1, "H5Pcreate_class");
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert second property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert third property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert third property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Check the number of properties in class */
- ret = H5Pget_nprops(cid1,&nprops);
+ ret = H5Pget_nprops(cid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 4, "H5Pget_nprops");
/* Iterate over all properties in class */
- iter_struct.iter_count=0;
- iter_struct.names=pnames;
- ret = H5Piterate(cid1,NULL,test_genprop_iter1,&iter_struct);
+ iter_struct.iter_count = 0;
+ iter_struct.names = pnames;
+ ret = H5Piterate(cid1, NULL, test_genprop_iter1, &iter_struct);
VERIFY(ret, 0, "H5Piterate");
/* Iterate over last three properties in class */
- idx=iter_struct.iter_count=1;
- ret = H5Piterate(cid1,&idx,test_genprop_iter1,&iter_struct);
+ idx = iter_struct.iter_count = 1;
+ ret = H5Piterate(cid1, &idx, test_genprop_iter1, &iter_struct);
VERIFY(ret, 0, "H5Piterate");
VERIFY(idx, (int)nprops, "H5Piterate");
@@ -417,49 +421,54 @@ test_genprop_cls_cls_cb1(hid_t list_id, void *create_data)
static void
test_genprop_class_callback(void)
{
- hid_t cid1; /* Generic Property class ID */
- hid_t cid2; /* Generic Property class ID */
- hid_t lid1; /* Generic Property list ID */
- hid_t lid2; /* Generic Property list ID */
- hid_t lid3; /* Generic Property list ID */
- size_t nprops; /* Number of properties in class */
- struct { /* Struct for callbacks */
- int count;
+ hid_t cid1; /* Generic Property class ID */
+ hid_t cid2; /* Generic Property class ID */
+ hid_t lid1; /* Generic Property list ID */
+ hid_t lid2; /* Generic Property list ID */
+ hid_t lid3; /* Generic Property list ID */
+ size_t nprops; /* Number of properties in class */
+ struct { /* Struct for callbacks */
+ int count;
hid_t id;
} crt_cb_struct, cpy_cb_struct, cls_cb_struct;
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Generic Property List Class Callback Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, test_genprop_cls_crt_cb1, &crt_cb_struct, test_genprop_cls_cpy_cb1, &cpy_cb_struct, test_genprop_cls_cls_cb1, &cls_cb_struct);
+ cid1 =
+ H5Pcreate_class(H5P_ROOT, CLASS1_NAME, test_genprop_cls_crt_cb1, &crt_cb_struct,
+ test_genprop_cls_cpy_cb1, &cpy_cb_struct, test_genprop_cls_cls_cb1, &cls_cb_struct);
CHECK_I(cid1, "H5Pcreate_class");
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert second property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert third property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Check the number of properties in class */
- ret = H5Pget_nprops(cid1,&nprops);
+ ret = H5Pget_nprops(cid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 3, "H5Pget_nprops");
/* Initialize class callback structs */
- crt_cb_struct.count=0;
- crt_cb_struct.id=(-1);
- cpy_cb_struct.count=0;
- cpy_cb_struct.id=(-1);
- cls_cb_struct.count=0;
- cls_cb_struct.id=(-1);
+ crt_cb_struct.count = 0;
+ crt_cb_struct.id = (-1);
+ cpy_cb_struct.count = 0;
+ cpy_cb_struct.id = (-1);
+ cls_cb_struct.count = 0;
+ cls_cb_struct.id = (-1);
/* Create a property list from the class */
lid1 = H5Pcreate(cid1);
@@ -470,7 +479,7 @@ test_genprop_class_callback(void)
VERIFY(crt_cb_struct.id, lid1, "H5Pcreate");
/* Check the number of properties in list */
- ret = H5Pget_nprops(lid1,&nprops);
+ ret = H5Pget_nprops(lid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 3, "H5Pget_nprops");
@@ -483,7 +492,7 @@ test_genprop_class_callback(void)
VERIFY(crt_cb_struct.id, lid2, "H5Pcreate");
/* Check the number of properties in list */
- ret = H5Pget_nprops(lid2,&nprops);
+ ret = H5Pget_nprops(lid2, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 3, "H5Pget_nprops");
@@ -525,11 +534,14 @@ test_genprop_class_callback(void)
VERIFY(cls_cb_struct.id, lid3, "H5Pclose");
/* Create another new generic class, derived from first class */
- cid2 = H5Pcreate_class(cid1, CLASS2_NAME, test_genprop_cls_crt_cb1, &crt_cb_struct, test_genprop_cls_cpy_cb1, &cpy_cb_struct, test_genprop_cls_cls_cb1, &cls_cb_struct);
+ cid2 =
+ H5Pcreate_class(cid1, CLASS2_NAME, test_genprop_cls_crt_cb1, &crt_cb_struct, test_genprop_cls_cpy_cb1,
+ &cpy_cb_struct, test_genprop_cls_cls_cb1, &cls_cb_struct);
CHECK_I(cid2, "H5Pcreate_class");
/* Insert fourth property into class (with no callbacks) */
- ret = H5Pregister2(cid2, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid2, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Check the number of properties in class */
@@ -596,34 +608,36 @@ test_genprop_class_callback(void)
static void
test_genprop_basic_list(void)
{
- hid_t cid1; /* Generic Property class ID */
- hid_t cid2; /* Generic Property class ID */
- hid_t lid1; /* Generic Property list ID */
- size_t nprops; /* Number of properties */
- size_t size; /* Size of property */
- int prop1_value; /* Value for property #1 */
- float prop2_value; /* Value for property #2 */
- herr_t ret; /* Generic return value */
+ hid_t cid1; /* Generic Property class ID */
+ hid_t cid2; /* Generic Property class ID */
+ hid_t lid1; /* Generic Property list ID */
+ size_t nprops; /* Number of properties */
+ size_t size; /* Size of property */
+ int prop1_value; /* Value for property #1 */
+ float prop2_value; /* Value for property #2 */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Generic Property List Creation Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Add several properties (w/default values) */
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert second property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Check the number of properties in class */
- ret = H5Pget_nprops(cid1,&nprops);
+ ret = H5Pget_nprops(cid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 2, "H5Pget_nprops");
@@ -636,15 +650,15 @@ test_genprop_basic_list(void)
CHECK_I(cid2, "H5Pget_class");
/* Check that the list's class is correct */
- ret = H5Pequal(cid1,cid2);
+ ret = H5Pequal(cid1, cid2);
VERIFY(ret, 1, "H5Pequal");
/* Check correct "is a" class/list relationship */
- ret = H5Pisa_class(lid1,cid1);
+ ret = H5Pisa_class(lid1, cid1);
VERIFY(ret, 1, "H5Pisa_class");
/* Check "is a" class/list relationship another way */
- ret = H5Pisa_class(lid1,cid2);
+ ret = H5Pisa_class(lid1, cid2);
VERIFY(ret, 1, "H5Pisa_class");
/* Close class */
@@ -652,7 +666,7 @@ test_genprop_basic_list(void)
CHECK_I(ret, "H5Pclose_class");
/* Check the number of properties in list */
- ret = H5Pget_nprops(lid1,&nprops);
+ ret = H5Pget_nprops(lid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 2, "H5Pget_nprops");
@@ -663,24 +677,23 @@ test_genprop_basic_list(void)
VERIFY(ret, 1, "H5Pexist");
/* Check the sizes of the properties */
- ret = H5Pget_size(lid1, PROP1_NAME,&size);
+ ret = H5Pget_size(lid1, PROP1_NAME, &size);
CHECK_I(ret, "H5Pget_size");
VERIFY(size, PROP1_SIZE, "H5Pget_size");
- ret = H5Pget_size(lid1, PROP2_NAME,&size);
+ ret = H5Pget_size(lid1, PROP2_NAME, &size);
CHECK_I(ret, "H5Pget_size");
VERIFY(size, PROP2_SIZE, "H5Pget_size");
/* Check values of properties (set with default values) */
- ret = H5Pget(lid1, PROP1_NAME,&prop1_value);
+ ret = H5Pget(lid1, PROP1_NAME, &prop1_value);
CHECK_I(ret, "H5Pget");
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
- ret = H5Pget(lid1, PROP2_NAME,&prop2_value);
+ ret = H5Pget(lid1, PROP2_NAME, &prop2_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE))
- HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
- "H5Pget", (double)*PROP2_DEF_VALUE, (double)prop2_value, (int)__LINE__, __FILE__);
-
+ if (!H5_FLT_ABS_EQUAL(prop2_value, *PROP2_DEF_VALUE))
+ HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget",
+ (double)*PROP2_DEF_VALUE, (double)prop2_value, (int)__LINE__, __FILE__);
/* Close list */
ret = H5Pclose(lid1);
@@ -702,30 +715,32 @@ test_genprop_basic_list(void)
static void
test_genprop_basic_list_prop(void)
{
- hid_t cid1; /* Generic Property class ID */
- hid_t lid1; /* Generic Property list ID */
- size_t nprops; /* Number of properties */
- int prop1_value; /* Value for property #1 */
- float prop2_value; /* Value for property #2 */
- char prop3_value[10];/* Property #3 value */
- double prop4_value; /* Property #4 value */
- herr_t ret; /* Generic return value */
+ hid_t cid1; /* Generic Property class ID */
+ hid_t lid1; /* Generic Property list ID */
+ size_t nprops; /* Number of properties */
+ int prop1_value; /* Value for property #1 */
+ float prop2_value; /* Value for property #2 */
+ char prop3_value[10]; /* Property #3 value */
+ double prop4_value; /* Property #4 value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Generic Property List Property Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Add several properties (several w/default values) */
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert second property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Create a property list from the class */
@@ -733,7 +748,7 @@ test_genprop_basic_list_prop(void)
CHECK_I(lid1, "H5Pcreate");
/* Check the number of properties in list */
- ret = H5Pget_nprops(lid1,&nprops);
+ ret = H5Pget_nprops(lid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 2, "H5Pget_nprops");
@@ -748,7 +763,7 @@ test_genprop_basic_list_prop(void)
CHECK_I(ret, "H5Pinsert2");
/* Check the number of properties in list */
- ret = H5Pget_nprops(lid1,&nprops);
+ ret = H5Pget_nprops(lid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 4, "H5Pget_nprops");
@@ -763,35 +778,34 @@ test_genprop_basic_list_prop(void)
VERIFY(ret, 1, "H5Pexist");
/* Check values of permanent properties (set with default values) */
- ret = H5Pget(lid1, PROP1_NAME,&prop1_value);
+ ret = H5Pget(lid1, PROP1_NAME, &prop1_value);
CHECK_I(ret, "H5Pget");
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
- ret = H5Pget(lid1, PROP2_NAME,&prop2_value);
+ ret = H5Pget(lid1, PROP2_NAME, &prop2_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE))
- HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
- "H5Pget", (double)*PROP2_DEF_VALUE, (double)prop2_value, (int)__LINE__, __FILE__);
-
+ if (!H5_FLT_ABS_EQUAL(prop2_value, *PROP2_DEF_VALUE))
+ HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget",
+ (double)*PROP2_DEF_VALUE, (double)prop2_value, (int)__LINE__, __FILE__);
/* Check values of temporary properties (set with regular values) */
- ret = H5Pget(lid1, PROP3_NAME,&prop3_value);
+ ret = H5Pget(lid1, PROP3_NAME, &prop3_value);
CHECK_I(ret, "H5Pget");
- if(HDmemcmp(&prop3_value, PROP3_DEF_VALUE, PROP3_SIZE)!=0)
- TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__);
- ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
+ if (HDmemcmp(&prop3_value, PROP3_DEF_VALUE, PROP3_SIZE) != 0)
+ TestErrPrintf("Property #3 doesn't match!, line=%d\n", __LINE__);
+ ret = H5Pget(lid1, PROP4_NAME, &prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
- HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
- "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
+ if (!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
+ HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget",
+ *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
/* Delete permanent property */
ret = H5Premove(lid1, PROP2_NAME);
CHECK_I(ret, "H5Premove");
/* Check number of properties */
- ret = H5Pget_nprops(lid1,&nprops);
+ ret = H5Pget_nprops(lid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 3, "H5Pget_nprops");
@@ -800,7 +814,7 @@ test_genprop_basic_list_prop(void)
CHECK_I(ret, "H5Premove");
/* Check number of properties */
- ret = H5Pget_nprops(lid1,&nprops);
+ ret = H5Pget_nprops(lid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 2, "H5Pget_nprops");
@@ -811,17 +825,17 @@ test_genprop_basic_list_prop(void)
VERIFY(ret, 1, "H5Pexist");
/* Check values of permanent properties (set with default values) */
- ret = H5Pget(lid1, PROP1_NAME,&prop1_value);
+ ret = H5Pget(lid1, PROP1_NAME, &prop1_value);
CHECK_I(ret, "H5Pget");
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
/* Check values of temporary properties (set with regular values) */
- ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
+ ret = H5Pget(lid1, PROP4_NAME, &prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
- HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
- "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
+ if (!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
+ HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget",
+ *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
/* Close list */
ret = H5Pclose(lid1);
@@ -839,12 +853,11 @@ test_genprop_basic_list_prop(void)
**
****************************************************************/
static int
-test_genprop_iter2(hid_t H5_ATTR_UNUSED id, const char *name,
- void *iter_data)
+test_genprop_iter2(hid_t H5_ATTR_UNUSED id, const char *name, void *iter_data)
{
iter_data_t *idata = (iter_data_t *)iter_data;
- return HDstrcmp(name,idata->names[idata->iter_count++]);
+ return HDstrcmp(name, idata->names[idata->iter_count++]);
}
/****************************************************************
@@ -856,37 +869,35 @@ test_genprop_iter2(hid_t H5_ATTR_UNUSED id, const char *name,
static void
test_genprop_list_iter(void)
{
- hid_t cid1; /* Generic Property class ID */
- hid_t lid1; /* Generic Property list ID */
- size_t nprops; /* Number of properties */
- int idx; /* Index to start iteration at */
- struct { /* Struct for iterations */
- int iter_count;
+ hid_t cid1; /* Generic Property class ID */
+ hid_t lid1; /* Generic Property list ID */
+ size_t nprops; /* Number of properties */
+ int idx; /* Index to start iteration at */
+ struct { /* Struct for iterations */
+ int iter_count;
const char **names;
} iter_struct;
- const char *pnames[4]={ /* Names of properties for iterator */
- PROP3_NAME,
- PROP4_NAME,
- PROP1_NAME,
- PROP2_NAME
- };
- herr_t ret; /* Generic return value */
+ const char *pnames[4] = {/* Names of properties for iterator */
+ PROP3_NAME, PROP4_NAME, PROP1_NAME, PROP2_NAME};
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Generic Property List Iteration Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Add several properties (several w/default values) */
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert second property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Create a property list from the class */
@@ -894,7 +905,7 @@ test_genprop_list_iter(void)
CHECK_I(lid1, "H5Pcreate");
/* Check the number of properties in list */
- ret = H5Pget_nprops(lid1,&nprops);
+ ret = H5Pget_nprops(lid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 2, "H5Pget_nprops");
@@ -909,19 +920,19 @@ test_genprop_list_iter(void)
CHECK_I(ret, "H5Pinsert2");
/* Check the number of properties in list */
- ret = H5Pget_nprops(lid1,&nprops);
+ ret = H5Pget_nprops(lid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 4, "H5Pget_nprops");
/* Iterate over all properties in list */
- iter_struct.iter_count=0;
- iter_struct.names=pnames;
- ret = H5Piterate(lid1,NULL,test_genprop_iter2,&iter_struct);
+ iter_struct.iter_count = 0;
+ iter_struct.names = pnames;
+ ret = H5Piterate(lid1, NULL, test_genprop_iter2, &iter_struct);
VERIFY(ret, 0, "H5Piterate");
/* Iterate over last three properties in list */
- idx=iter_struct.iter_count=1;
- ret = H5Piterate(lid1,&idx,test_genprop_iter2,&iter_struct);
+ idx = iter_struct.iter_count = 1;
+ ret = H5Piterate(lid1, &idx, test_genprop_iter2, &iter_struct);
VERIFY(ret, 0, "H5Piterate");
VERIFY(idx, (int)nprops, "H5Piterate");
@@ -937,30 +948,30 @@ test_genprop_list_iter(void)
typedef struct {
/* Creation information */
- int crt_count;
+ int crt_count;
char *crt_name;
void *crt_value;
/* Set information */
- int set_count;
+ int set_count;
hid_t set_plist_id;
char *set_name;
void *set_value;
/* Get information */
- int get_count;
+ int get_count;
hid_t get_plist_id;
char *get_name;
void *get_value;
/* Delete information */
- int del_count;
+ int del_count;
hid_t del_plist_id;
char *del_name;
void *del_value;
/* Copy information */
- int cop_count;
+ int cop_count;
char *cop_name;
void *cop_value;
@@ -968,15 +979,15 @@ typedef struct {
int cmp_count;
/* Close information */
- int cls_count;
+ int cls_count;
char *cls_name;
void *cls_value;
} prop_cb_info;
/* Global variables for Callback information */
-prop_cb_info prop1_cb_info; /* Callback statistics for property #1 */
-prop_cb_info prop2_cb_info; /* Callback statistics for property #2 */
-prop_cb_info prop3_cb_info; /* Callback statistics for property #3 */
+prop_cb_info prop1_cb_info; /* Callback statistics for property #1 */
+prop_cb_info prop2_cb_info; /* Callback statistics for property #2 */
+prop_cb_info prop3_cb_info; /* Callback statistics for property #3 */
/****************************************************************
**
@@ -1004,11 +1015,11 @@ test_genprop_prop_crt_cb1(const char *name, size_t size, void *def_value)
{
/* Set the information from the creation call */
prop1_cb_info.crt_count++;
- prop1_cb_info.crt_name=HDstrdup(name);
- prop1_cb_info.crt_value=HDmalloc(size);
- HDmemcpy(prop1_cb_info.crt_value,def_value,size);
+ prop1_cb_info.crt_name = HDstrdup(name);
+ prop1_cb_info.crt_value = HDmalloc(size);
+ HDmemcpy(prop1_cb_info.crt_value, def_value, size);
- return(SUCCEED);
+ return (SUCCEED);
}
/****************************************************************
@@ -1021,14 +1032,14 @@ test_genprop_prop_set_cb1(hid_t plist_id, const char *name, size_t size, void *v
{
/* Set the information from the set call */
prop1_cb_info.set_count++;
- prop1_cb_info.set_plist_id=plist_id;
- if(prop1_cb_info.set_name==NULL)
- prop1_cb_info.set_name=HDstrdup(name);
- if(prop1_cb_info.set_value==NULL)
- prop1_cb_info.set_value=HDmalloc(size);
- HDmemcpy(prop1_cb_info.set_value,value,size);
-
- return(SUCCEED);
+ prop1_cb_info.set_plist_id = plist_id;
+ if (prop1_cb_info.set_name == NULL)
+ prop1_cb_info.set_name = HDstrdup(name);
+ if (prop1_cb_info.set_value == NULL)
+ prop1_cb_info.set_value = HDmalloc(size);
+ HDmemcpy(prop1_cb_info.set_value, value, size);
+
+ return (SUCCEED);
}
/****************************************************************
@@ -1041,14 +1052,14 @@ test_genprop_prop_get_cb1(hid_t plist_id, const char *name, size_t size, void *v
{
/* Set the information from the get call */
prop1_cb_info.get_count++;
- prop1_cb_info.get_plist_id=plist_id;
- if(prop1_cb_info.get_name==NULL)
- prop1_cb_info.get_name=HDstrdup(name);
- if(prop1_cb_info.get_value==NULL)
- prop1_cb_info.get_value=HDmalloc(size);
- HDmemcpy(prop1_cb_info.get_value,value,size);
-
- return(SUCCEED);
+ prop1_cb_info.get_plist_id = plist_id;
+ if (prop1_cb_info.get_name == NULL)
+ prop1_cb_info.get_name = HDstrdup(name);
+ if (prop1_cb_info.get_value == NULL)
+ prop1_cb_info.get_value = HDmalloc(size);
+ HDmemcpy(prop1_cb_info.get_value, value, size);
+
+ return (SUCCEED);
}
/****************************************************************
@@ -1061,13 +1072,13 @@ test_genprop_prop_cop_cb1(const char *name, size_t size, void *value)
{
/* Set the information from the get call */
prop1_cb_info.cop_count++;
- if(prop1_cb_info.cop_name==NULL)
- prop1_cb_info.cop_name=HDstrdup(name);
- if(prop1_cb_info.cop_value==NULL)
- prop1_cb_info.cop_value=HDmalloc(size);
- HDmemcpy(prop1_cb_info.cop_value,value,size);
+ if (prop1_cb_info.cop_name == NULL)
+ prop1_cb_info.cop_name = HDstrdup(name);
+ if (prop1_cb_info.cop_value == NULL)
+ prop1_cb_info.cop_value = HDmalloc(size);
+ HDmemcpy(prop1_cb_info.cop_value, value, size);
- return(SUCCEED);
+ return (SUCCEED);
}
/****************************************************************
@@ -1081,7 +1092,7 @@ test_genprop_prop_cmp_cb1(const void *value1, const void *value2, size_t size)
/* Set the information from the comparison call */
prop1_cb_info.cmp_count++;
- return(HDmemcmp(value1, value2, size));
+ return (HDmemcmp(value1, value2, size));
}
/****************************************************************
@@ -1095,7 +1106,7 @@ test_genprop_prop_cmp_cb3(const void *value1, const void *value2, size_t size)
/* Set the information from the comparison call */
prop3_cb_info.cmp_count++;
- return(HDmemcmp(value1, value2, size));
+ return (HDmemcmp(value1, value2, size));
}
/****************************************************************
@@ -1108,13 +1119,13 @@ test_genprop_prop_cls_cb1(const char *name, size_t size, void *value)
{
/* Set the information from the close call */
prop1_cb_info.cls_count++;
- if(prop1_cb_info.cls_name==NULL)
- prop1_cb_info.cls_name=HDstrdup(name);
- if(prop1_cb_info.cls_value==NULL)
- prop1_cb_info.cls_value=HDmalloc(size);
- HDmemcpy(prop1_cb_info.cls_value,value,size);
+ if (prop1_cb_info.cls_name == NULL)
+ prop1_cb_info.cls_name = HDstrdup(name);
+ if (prop1_cb_info.cls_value == NULL)
+ prop1_cb_info.cls_value = HDmalloc(size);
+ HDmemcpy(prop1_cb_info.cls_value, value, size);
- return(SUCCEED);
+ return (SUCCEED);
}
/****************************************************************
@@ -1127,12 +1138,12 @@ test_genprop_prop_del_cb2(hid_t plist_id, const char *name, size_t size, void *v
{
/* Set the information from the delete call */
prop2_cb_info.del_count++;
- prop2_cb_info.del_plist_id=plist_id;
- prop2_cb_info.del_name=HDstrdup(name);
- prop2_cb_info.del_value=HDmalloc(size);
- HDmemcpy(prop2_cb_info.del_value,value,size);
+ prop2_cb_info.del_plist_id = plist_id;
+ prop2_cb_info.del_name = HDstrdup(name);
+ prop2_cb_info.del_value = HDmalloc(size);
+ HDmemcpy(prop2_cb_info.del_value, value, size);
- return(SUCCEED);
+ return (SUCCEED);
}
/****************************************************************
@@ -1144,58 +1155,64 @@ test_genprop_prop_del_cb2(hid_t plist_id, const char *name, size_t size, void *v
static void
test_genprop_list_callback(void)
{
- hid_t cid1; /* Generic Property class ID */
- hid_t lid1; /* Generic Property list ID */
- hid_t lid2; /* 2nd Generic Property list ID */
- size_t nprops; /* Number of properties in class */
- int prop1_value; /* Value for property #1 */
- int prop1_new_value=20; /* Property #1 new value */
- float prop2_value; /* Value for property #2 */
- char prop3_value[10];/* Property #3 value */
- char prop3_new_value[10]="10 chairs"; /* Property #3 new value */
- double prop4_value; /* Property #4 value */
- struct { /* Struct for callbacks */
- int count;
+ hid_t cid1; /* Generic Property class ID */
+ hid_t lid1; /* Generic Property list ID */
+ hid_t lid2; /* 2nd Generic Property list ID */
+ size_t nprops; /* Number of properties in class */
+ int prop1_value; /* Value for property #1 */
+ int prop1_new_value = 20; /* Property #1 new value */
+ float prop2_value; /* Value for property #2 */
+ char prop3_value[10]; /* Property #3 value */
+ char prop3_new_value[10] = "10 chairs"; /* Property #3 new value */
+ double prop4_value; /* Property #4 value */
+ struct { /* Struct for callbacks */
+ int count;
hid_t id;
} cop_cb_struct;
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Generic Property List Property Callback Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL,test_genprop_cls_cpy_cb2,&cop_cb_struct,NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, NULL, NULL, test_genprop_cls_cpy_cb2, &cop_cb_struct, NULL,
+ NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Insert first property into class (with callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE,test_genprop_prop_crt_cb1,test_genprop_prop_set_cb1,test_genprop_prop_get_cb1,NULL,test_genprop_prop_cop_cb1,test_genprop_prop_cmp_cb1,test_genprop_prop_cls_cb1);
+ ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, test_genprop_prop_crt_cb1,
+ test_genprop_prop_set_cb1, test_genprop_prop_get_cb1, NULL, test_genprop_prop_cop_cb1,
+ test_genprop_prop_cmp_cb1, test_genprop_prop_cls_cb1);
CHECK_I(ret, "H5Pregister2");
/* Insert second property into class (with only delete callback) */
- ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL,test_genprop_prop_del_cb2,NULL, NULL, NULL);
+ ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL,
+ test_genprop_prop_del_cb2, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert third property into class (with only compare callback) */
- ret = H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, test_genprop_prop_cmp_cb3, NULL);
+ ret = H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL,
+ test_genprop_prop_cmp_cb3, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert fourth property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Check the number of properties in class */
- ret = H5Pget_nprops(cid1,&nprops);
+ ret = H5Pget_nprops(cid1, &nprops);
CHECK_I(ret, "H5Pget_nprops");
VERIFY(nprops, 4, "H5Pget_nprops");
/* Initialize class callback structs */
- cop_cb_struct.count=0;
- cop_cb_struct.id=(-1);
+ cop_cb_struct.count = 0;
+ cop_cb_struct.id = (-1);
/* Initialize callback information for properties tracked */
- HDmemset(&prop1_cb_info,0,sizeof(prop_cb_info));
- HDmemset(&prop2_cb_info,0,sizeof(prop_cb_info));
- HDmemset(&prop3_cb_info,0,sizeof(prop_cb_info));
+ HDmemset(&prop1_cb_info, 0, sizeof(prop_cb_info));
+ HDmemset(&prop2_cb_info, 0, sizeof(prop_cb_info));
+ HDmemset(&prop3_cb_info, 0, sizeof(prop_cb_info));
/* Create a property list from the class */
lid1 = H5Pcreate(cid1);
@@ -1210,81 +1227,81 @@ test_genprop_list_callback(void)
/* Verify creation callback information for properties tracked */
VERIFY(prop1_cb_info.crt_count, 1, "H5Pcreate");
- if(HDstrcmp(prop1_cb_info.crt_name, PROP1_NAME)!=0)
- TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- if(HDmemcmp(prop1_cb_info.crt_value, PROP1_DEF_VALUE, PROP1_SIZE)!=0)
- TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
+ if (HDstrcmp(prop1_cb_info.crt_name, PROP1_NAME) != 0)
+ TestErrPrintf("Property #1 name doesn't match!, line=%d\n", __LINE__);
+ if (HDmemcmp(prop1_cb_info.crt_value, PROP1_DEF_VALUE, PROP1_SIZE) != 0)
+ TestErrPrintf("Property #1 value doesn't match!, line=%d\n", __LINE__);
/* Check values of permanent properties (set with default values) */
- ret = H5Pget(lid1, PROP1_NAME,&prop1_value);
+ ret = H5Pget(lid1, PROP1_NAME, &prop1_value);
CHECK_I(ret, "H5Pget");
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
/* The compare callback should not have been called */
VERIFY(prop1_cb_info.cmp_count, 0, "H5Pget");
- ret = H5Pget(lid1, PROP2_NAME,&prop2_value);
+ ret = H5Pget(lid1, PROP2_NAME, &prop2_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE))
- HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
- "H5Pget", (double)*PROP2_DEF_VALUE, (double)prop2_value, (int)__LINE__, __FILE__);
+ if (!H5_FLT_ABS_EQUAL(prop2_value, *PROP2_DEF_VALUE))
+ HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget",
+ (double)*PROP2_DEF_VALUE, (double)prop2_value, (int)__LINE__, __FILE__);
/* Check values of temporary properties (set with regular values) */
- ret = H5Pget(lid1, PROP3_NAME,&prop3_value);
+ ret = H5Pget(lid1, PROP3_NAME, &prop3_value);
CHECK_I(ret, "H5Pget");
- if(HDmemcmp(&prop3_value, PROP3_DEF_VALUE, PROP3_SIZE)!=0)
- TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__);
+ if (HDmemcmp(&prop3_value, PROP3_DEF_VALUE, PROP3_SIZE) != 0)
+ TestErrPrintf("Property #3 doesn't match!, line=%d\n", __LINE__);
/* The compare callback should not have been called, as there is no get
* callback for this property */
VERIFY(prop3_cb_info.cmp_count, 0, "H5Pget");
- ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
+ ret = H5Pget(lid1, PROP4_NAME, &prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
- HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
- "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
+ if (!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
+ HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget",
+ *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
/* Verify get callback information for properties tracked */
VERIFY(prop1_cb_info.get_count, 1, "H5Pget");
VERIFY(prop1_cb_info.get_plist_id, lid1, "H5Pget");
- if(HDstrcmp(prop1_cb_info.get_name, PROP1_NAME)!=0)
- TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- if(HDmemcmp(prop1_cb_info.get_value, PROP1_DEF_VALUE, PROP1_SIZE)!=0)
- TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
+ if (HDstrcmp(prop1_cb_info.get_name, PROP1_NAME) != 0)
+ TestErrPrintf("Property #1 name doesn't match!, line=%d\n", __LINE__);
+ if (HDmemcmp(prop1_cb_info.get_value, PROP1_DEF_VALUE, PROP1_SIZE) != 0)
+ TestErrPrintf("Property #1 value doesn't match!, line=%d\n", __LINE__);
/* Set value of property #1 to different value */
- ret = H5Pset(lid1, PROP1_NAME,&prop1_new_value);
+ ret = H5Pset(lid1, PROP1_NAME, &prop1_new_value);
CHECK_I(ret, "H5Pset");
/* Verify set callback information for properties tracked */
VERIFY(prop1_cb_info.set_count, 1, "H5Pset");
VERIFY(prop1_cb_info.set_plist_id, lid1, "H5Pset");
- if(HDstrcmp(prop1_cb_info.set_name, PROP1_NAME)!=0)
- TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- if(HDmemcmp(prop1_cb_info.set_value,&prop1_new_value, PROP1_SIZE)!=0)
- TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
+ if (HDstrcmp(prop1_cb_info.set_name, PROP1_NAME) != 0)
+ TestErrPrintf("Property #1 name doesn't match!, line=%d\n", __LINE__);
+ if (HDmemcmp(prop1_cb_info.set_value, &prop1_new_value, PROP1_SIZE) != 0)
+ TestErrPrintf("Property #1 value doesn't match!, line=%d\n", __LINE__);
/* The compare callback should not have been called */
VERIFY(prop1_cb_info.cmp_count, 0, "H5Pset");
/* Set value of property #3 to different value */
- ret = H5Pset(lid1, PROP3_NAME,prop3_new_value);
+ ret = H5Pset(lid1, PROP3_NAME, prop3_new_value);
CHECK_I(ret, "H5Pset");
/* The compare callback should not have been called */
VERIFY(prop3_cb_info.cmp_count, 0, "H5Pset");
/* Check new value of tracked properties */
- ret = H5Pget(lid1, PROP1_NAME,&prop1_value);
+ ret = H5Pget(lid1, PROP1_NAME, &prop1_value);
CHECK_I(ret, "H5Pget");
VERIFY(prop1_value, prop1_new_value, "H5Pget");
/* Verify get callback information again for properties tracked */
VERIFY(prop1_cb_info.get_count, 2, "H5Pget");
VERIFY(prop1_cb_info.get_plist_id, lid1, "H5Pget");
- if(HDstrcmp(prop1_cb_info.get_name, PROP1_NAME)!=0)
- TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- if(HDmemcmp(prop1_cb_info.get_value,&prop1_new_value, PROP1_SIZE)!=0)
- TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
+ if (HDstrcmp(prop1_cb_info.get_name, PROP1_NAME) != 0)
+ TestErrPrintf("Property #1 name doesn't match!, line=%d\n", __LINE__);
+ if (HDmemcmp(prop1_cb_info.get_value, &prop1_new_value, PROP1_SIZE) != 0)
+ TestErrPrintf("Property #1 value doesn't match!, line=%d\n", __LINE__);
/* Delete property #2 */
ret = H5Premove(lid1, PROP2_NAME);
@@ -1293,10 +1310,10 @@ test_genprop_list_callback(void)
/* Verify delete callback information for properties tracked */
VERIFY(prop2_cb_info.del_count, 1, "H5Premove");
VERIFY(prop2_cb_info.del_plist_id, lid1, "H5Premove");
- if(HDstrcmp(prop2_cb_info.del_name, PROP2_NAME)!=0)
- TestErrPrintf("Property #2 name doesn't match!, line=%d\n",__LINE__);
- if(HDmemcmp(prop2_cb_info.del_value, PROP2_DEF_VALUE, PROP2_SIZE)!=0)
- TestErrPrintf("Property #2 value doesn't match!, line=%d\n",__LINE__);
+ if (HDstrcmp(prop2_cb_info.del_name, PROP2_NAME) != 0)
+ TestErrPrintf("Property #2 name doesn't match!, line=%d\n", __LINE__);
+ if (HDmemcmp(prop2_cb_info.del_value, PROP2_DEF_VALUE, PROP2_SIZE) != 0)
+ TestErrPrintf("Property #2 value doesn't match!, line=%d\n", __LINE__);
/* Copy first list */
lid2 = H5Pcopy(lid1);
@@ -1304,17 +1321,17 @@ test_genprop_list_callback(void)
/* Verify copy callback information for properties tracked */
VERIFY(prop1_cb_info.cop_count, 1, "H5Pcopy");
- if(HDstrcmp(prop1_cb_info.cop_name, PROP1_NAME)!=0)
- TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- if(HDmemcmp(prop1_cb_info.cop_value,&prop1_new_value, PROP1_SIZE)!=0)
- TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
+ if (HDstrcmp(prop1_cb_info.cop_name, PROP1_NAME) != 0)
+ TestErrPrintf("Property #1 name doesn't match!, line=%d\n", __LINE__);
+ if (HDmemcmp(prop1_cb_info.cop_value, &prop1_new_value, PROP1_SIZE) != 0)
+ TestErrPrintf("Property #1 value doesn't match!, line=%d\n", __LINE__);
/* Verify that the class creation callback occurred */
VERIFY(cop_cb_struct.count, 1, "H5Pcopy");
VERIFY(cop_cb_struct.id, lid2, "H5Pcopy");
/* Compare the two lists */
- ret = H5Pequal(lid1,lid2);
+ ret = H5Pequal(lid1, lid2);
VERIFY(ret, 1, "H5Pequal");
/* Verify compare callback information for properties tracked */
@@ -1327,10 +1344,10 @@ test_genprop_list_callback(void)
/* Verify close callback information for properties tracked */
VERIFY(prop1_cb_info.cls_count, 1, "H5Pclose");
- if(HDstrcmp(prop1_cb_info.cls_name, PROP1_NAME)!=0)
- TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
- if(HDmemcmp(prop1_cb_info.cls_value,&prop1_new_value, PROP1_SIZE)!=0)
- TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
+ if (HDstrcmp(prop1_cb_info.cls_name, PROP1_NAME) != 0)
+ TestErrPrintf("Property #1 name doesn't match!, line=%d\n", __LINE__);
+ if (HDmemcmp(prop1_cb_info.cls_value, &prop1_new_value, PROP1_SIZE) != 0)
+ TestErrPrintf("Property #1 value doesn't match!, line=%d\n", __LINE__);
/* Close second list */
ret = H5Pclose(lid2);
@@ -1368,12 +1385,12 @@ test_genprop_list_callback(void)
static void
test_genprop_list_addprop(void)
{
- hid_t fid; /* File ID */
- hid_t did; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t pid; /* Property List ID */
- int prop1_value; /* Value for property #1 */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t pid; /* Property List ID */
+ int prop1_value; /* Value for property #1 */
+ herr_t ret; /* Generic return value */
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1396,7 +1413,7 @@ test_genprop_list_addprop(void)
VERIFY(ret, 1, "H5Pexist");
/* Check values of property (set with default value) */
- ret = H5Pget(pid, PROP1_NAME,&prop1_value);
+ ret = H5Pget(pid, PROP1_NAME, &prop1_value);
CHECK_I(ret, "H5Pget");
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
@@ -1442,13 +1459,13 @@ test_genprop_list_addprop(void)
static void
test_genprop_class_addprop(void)
{
- hid_t fid; /* File ID */
- hid_t did; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t cid; /* Property Class ID */
- hid_t pid; /* Property List ID */
- int prop1_value; /* Value for property #1 */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t cid; /* Property Class ID */
+ hid_t pid; /* Property List ID */
+ int prop1_value; /* Value for property #1 */
+ herr_t ret; /* Generic return value */
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1467,7 +1484,8 @@ test_genprop_class_addprop(void)
VERIFY(ret, 1, "H5Pexist");
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Check existence of an original property */
@@ -1496,7 +1514,8 @@ test_genprop_class_addprop(void)
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
/* Insert second property into class (with no callbacks) */
- ret = H5Pregister2(cid, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Check existence of an original property (in class) */
@@ -1569,8 +1588,8 @@ test_genprop_class_addprop(void)
static void
test_genprop_list_add_remove_prop(void)
{
- hid_t pid; /* Property List ID */
- herr_t ret; /* Generic return value */
+ hid_t pid; /* Property List ID */
+ herr_t ret; /* Generic return value */
/* Create a dataset creation property list */
pid = H5Pcreate(H5P_DATASET_CREATE);
@@ -1607,25 +1626,27 @@ test_genprop_list_add_remove_prop(void)
static void
test_genprop_equal(void)
{
- hid_t cid1; /* Generic Property class ID */
- hid_t lid1; /* Generic Property list ID */
- hid_t lid2; /* Generic Property list ID */
- int prop1_new_value = 20; /* Property #1 new value */
- herr_t ret; /* Generic return value */
+ hid_t cid1; /* Generic Property class ID */
+ hid_t lid1; /* Generic Property list ID */
+ hid_t lid2; /* Generic Property list ID */
+ int prop1_new_value = 20; /* Property #1 new value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Generic Property List Equal Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Insert second property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Create a property list from the class */
@@ -1756,50 +1777,52 @@ test_genprop_equal(void)
static void
test_genprop_path(void)
{
- hid_t cid1; /* Generic Property class ID */
- hid_t cid2; /* Generic Property class ID */
- hid_t cid3; /* Generic Property class ID */
- char *path; /* Class path */
- herr_t ret; /* Generic return value */
+ hid_t cid1; /* Generic Property class ID */
+ hid_t cid2; /* Generic Property class ID */
+ hid_t cid3; /* Generic Property class ID */
+ char * path; /* Class path */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Generic Property List Class Path Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Get full path for first class */
path = H5P__get_class_path_test(cid1);
CHECK_PTR(path, "H5P__get_class_path_test");
- if(HDstrcmp(path,CLASS1_PATH)!=0)
- TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH);
+ if (HDstrcmp(path, CLASS1_PATH) != 0)
+ TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n", path, CLASS1_PATH);
H5free_memory(path);
/* Create another new generic class, derived from first class */
- cid2 = H5Pcreate_class(cid1,CLASS2_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ cid2 = H5Pcreate_class(cid1, CLASS2_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid2, "H5Pcreate_class");
/* Insert second property into class (with no callbacks) */
- ret = H5Pregister2(cid2, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid2, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Get full path for second class */
path = H5P__get_class_path_test(cid2);
CHECK_PTR(path, "H5P__get_class_path_test");
- if(HDstrcmp(path,CLASS2_PATH)!=0)
- TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH);
+ if (HDstrcmp(path, CLASS2_PATH) != 0)
+ TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n", path, CLASS2_PATH);
/* Open a copy of the class with the path name */
cid3 = H5P__open_class_path_test(path);
CHECK_I(cid3, "H5P__open_class_path_test");
/* Check that the classes are equal */
- ret = H5Pequal(cid2,cid3);
+ ret = H5Pequal(cid2, cid3);
VERIFY(ret, 1, "H5Pequal");
/* Release the path string */
@@ -1828,20 +1851,21 @@ test_genprop_path(void)
static void
test_genprop_refcount(void)
{
- hid_t cid1; /* Generic Property class ID */
- hid_t lid1; /* Generic Property class ID */
- char *name; /* Name of class */
- herr_t ret; /* Generic return value */
+ hid_t cid1; /* Generic Property class ID */
+ hid_t lid1; /* Generic Property class ID */
+ char * name; /* Name of class */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Generic Property List Reference Count Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Insert first property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ ret =
+ H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
/* Create a new generic list, derived from the root of the class hierarchy */
@@ -1851,8 +1875,8 @@ test_genprop_refcount(void)
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS1_NAME)!=0)
- TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
+ if (HDstrcmp(name, CLASS1_NAME) != 0)
+ TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n", name, CLASS1_NAME);
H5free_memory(name);
/* Close class */
@@ -1864,14 +1888,14 @@ test_genprop_refcount(void)
CHECK_I(cid1, "H5Pget_class");
/* Check correct "is a" class/list relationship */
- ret = H5Pisa_class(lid1,cid1);
+ ret = H5Pisa_class(lid1, cid1);
VERIFY(ret, 1, "H5Pisa_class");
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS1_NAME)!=0)
- TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
+ if (HDstrcmp(name, CLASS1_NAME) != 0)
+ TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n", name, CLASS1_NAME);
H5free_memory(name);
/* Close list */
@@ -1881,8 +1905,8 @@ test_genprop_refcount(void)
/* Check class name */
name = H5Pget_class_name(cid1);
CHECK_PTR(name, "H5Pget_class_name");
- if(HDstrcmp(name,CLASS1_NAME)!=0)
- TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
+ if (HDstrcmp(name, CLASS1_NAME) != 0)
+ TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n", name, CLASS1_NAME);
H5free_memory(name);
/* Close class */
@@ -1901,10 +1925,10 @@ test_genprop_refcount(void)
static void
test_genprop_deprec_class(void)
{
- hid_t cid1; /* Generic Property class ID */
- size_t size; /* Size of property */
- size_t nprops; /* Number of properties in class */
- herr_t ret; /* Generic return value */
+ hid_t cid1; /* Generic Property class ID */
+ size_t size; /* Size of property */
+ size_t nprops; /* Number of properties in class */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deprecated Generic Property List Functions\n"));
@@ -2029,12 +2053,12 @@ test_genprop_deprec_class(void)
static void
test_genprop_deprec_list(void)
{
- hid_t fid; /* File ID */
- hid_t did; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t pid; /* Property List ID */
- int prop1_value; /* Value for property #1 */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t pid; /* Property List ID */
+ int prop1_value; /* Value for property #1 */
+ herr_t ret; /* Generic return value */
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2057,7 +2081,7 @@ test_genprop_deprec_list(void)
VERIFY(ret, 1, "H5Pexist");
/* Check values of property (set with default value) */
- ret = H5Pget(pid, PROP1_NAME,&prop1_value);
+ ret = H5Pget(pid, PROP1_NAME, &prop1_value);
CHECK_I(ret, "H5Pget");
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
@@ -2104,32 +2128,32 @@ test_genprop(void)
MESSAGE(5, ("Testing Generic Properties\n"));
/* These tests use the same file... */
- test_genprop_basic_class(); /* Test basic code for creating a generic class */
+ test_genprop_basic_class(); /* Test basic code for creating a generic class */
test_genprop_basic_class_prop(); /* Test basic code for adding properties to a generic class */
- test_genprop_class_iter(); /* Test code for iterating over properties in a generic class */
- test_genprop_class_callback(); /* Test code for property class callbacks */
+ test_genprop_class_iter(); /* Test code for iterating over properties in a generic class */
+ test_genprop_class_callback(); /* Test code for property class callbacks */
- test_genprop_basic_list(); /* Test basic code for creating a generic property list */
+ test_genprop_basic_list(); /* Test basic code for creating a generic property list */
test_genprop_basic_list_prop(); /* Test basic code for adding properties to a generic property list */
- test_genprop_list_iter(); /* Test basic code for iterating over properties in a generic property list */
- test_genprop_list_callback(); /* Test code for property list callbacks */
+ test_genprop_list_iter(); /* Test basic code for iterating over properties in a generic property list */
+ test_genprop_list_callback(); /* Test code for property list callbacks */
- test_genprop_list_addprop(); /* Test adding properties to HDF5 property list */
- test_genprop_class_addprop(); /* Test adding properties to HDF5 property class */
+ test_genprop_list_addprop(); /* Test adding properties to HDF5 property list */
+ test_genprop_class_addprop(); /* Test adding properties to HDF5 property class */
- test_genprop_list_add_remove_prop(); /* Test adding and removing the same property several times to HDF5 property list */
+ test_genprop_list_add_remove_prop(); /* Test adding and removing the same property several times to HDF5
+ property list */
- test_genprop_equal(); /* Tests for more H5Pequal verification */
- test_genprop_path(); /* Tests for class path verification */
- test_genprop_refcount(); /* Tests for class reference counting */
+ test_genprop_equal(); /* Tests for more H5Pequal verification */
+ test_genprop_path(); /* Tests for class path verification */
+ test_genprop_refcount(); /* Tests for class reference counting */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_genprop_deprec_class(); /* Tests for deprecated routines */
- test_genprop_deprec_list(); /* Tests for deprecated routines */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-} /* test_genprop() */
+ test_genprop_deprec_class(); /* Tests for deprecated routines */
+ test_genprop_deprec_list(); /* Tests for deprecated routines */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+} /* test_genprop() */
/*-------------------------------------------------------------------------
* Function: cleanup_genprop
@@ -2150,4 +2174,3 @@ cleanup_genprop(void)
{
remove(FILENAME);
}
-
diff --git a/test/th5o.c b/test/th5o.c
index 4bc2096..8885eb4 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -12,12 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: th5o
-*
-* Test public H5O functions for accessing
-*
-*************************************************************/
+ *
+ * Test program: th5o
+ *
+ * Test public H5O functions for accessing
+ *
+ *************************************************************/
#include "testhdf5.h"
#include "H5Fprivate.h"
@@ -33,7 +33,6 @@
#define TEST6_DIM1 100
#define TEST6_DIM2 100
-
/****************************************************************
**
** test_h5o_open(): Test H5Oopen function.
@@ -42,13 +41,13 @@
static void
test_h5o_open(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
hsize_t dims[RANK];
- H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
- H5G_info_t ginfo; /* Group info struct */
- H5T_class_t type_class; /* Class of the datatype */
- herr_t ret; /* Value returned from API calls */
+ H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
+ H5G_info_t ginfo; /* Group info struct */
+ H5T_class_t type_class; /* Class of the datatype */
+ herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -72,7 +71,7 @@ test_h5o_open(void)
/* Create the data space for the dataset. */
dims[0] = DIM0;
dims[1] = DIM1;
- dspace = H5Screate_simple(RANK, dims, NULL);
+ dspace = H5Screate_simple(RANK, dims, NULL);
CHECK(dspace, FAIL, "H5Screate_simple");
/* Create the dataset. */
@@ -122,28 +121,30 @@ test_h5o_open(void)
CHECK(ret, FAIL, "H5Dclose");
/* Trying to open objects with bogus names should fail gracefully */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
grp = H5Oopen(fid, "bogus_group", H5P_DEFAULT);
VERIFY(grp, FAIL, "H5Oopen");
dtype = H5Oopen(fid, "group/bogus_datatype", H5P_DEFAULT);
VERIFY(dtype, FAIL, "H5Oopen");
dset = H5Oopen(fid, "/bogus_dataset", H5P_DEFAULT);
VERIFY(dset, FAIL, "H5Oopen");
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Trying to open an object with a bogus file ID should fail */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dset = H5Oopen(fid, "dataset", H5P_DEFAULT);
VERIFY(dset, FAIL, "H5Oopen");
- } H5E_END_TRY
+ }
+ H5E_END_TRY
} /* test_h5o_open() */
-
-
/****************************************************************
**
** test_h5o_close(): Test H5Oclose function.
@@ -152,10 +153,10 @@ test_h5o_open(void)
static void
test_h5o_close(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
- hsize_t dims[RANK];
- herr_t ret; /* Value returned from API calls */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ hsize_t dims[RANK];
+ herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -180,7 +181,7 @@ test_h5o_close(void)
/* Create the data space for the dataset. */
dims[0] = DIM0;
dims[1] = DIM1;
- dspace = H5Screate_simple(RANK, dims, NULL);
+ dspace = H5Screate_simple(RANK, dims, NULL);
CHECK(dspace, FAIL, "H5Screate_simple");
/* Create the dataset. */
@@ -190,10 +191,12 @@ test_h5o_close(void)
CHECK(ret, FAIL, "H5Oclose");
/* Attempting to close the data space with H5Oclose should fail */
- H5E_BEGIN_TRY {
- ret = H5Oclose(dspace);
- VERIFY(ret, FAIL, "H5Oclose");
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ ret = H5Oclose(dspace);
+ VERIFY(ret, FAIL, "H5Oclose");
+ }
+ H5E_END_TRY
/* Close the dataspace for real */
ret = H5Sclose(dspace);
CHECK(ret, FAIL, "H5Sclose");
@@ -233,7 +236,6 @@ test_h5o_close(void)
CHECK(ret, FAIL, "H5Fclose");
}
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/****************************************************************
**
@@ -243,17 +245,17 @@ test_h5o_close(void)
static void
test_h5o_open_by_addr(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
- H5L_info2_t li; /* Buffer for H5Lget_info2 */
- haddr_t grp_addr; /* Addresses for objects */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ H5L_info2_t li; /* Buffer for H5Lget_info2 */
+ haddr_t grp_addr; /* Addresses for objects */
haddr_t dset_addr;
haddr_t dtype_addr;
hsize_t dims[RANK];
- H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
- H5G_info_t ginfo; /* Group info struct */
- H5T_class_t type_class; /* Class of the datatype */
- herr_t ret; /* Value returned from API calls */
+ H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
+ H5G_info_t ginfo; /* Group info struct */
+ H5T_class_t type_class; /* Class of the datatype */
+ herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -277,7 +279,7 @@ test_h5o_open_by_addr(void)
/* Create the data space for the dataset. */
dims[0] = DIM0;
dims[1] = DIM1;
- dspace = H5Screate_simple(RANK, dims, NULL);
+ dspace = H5Screate_simple(RANK, dims, NULL);
CHECK(dspace, FAIL, "H5Screate_simple");
/* Create the dataset. */
@@ -345,39 +347,34 @@ test_h5o_open_by_addr(void)
/* Try giving some bogus values to H5O_open_by_addr. */
/* Try to open an object with a bad address */
grp_addr += 20;
- H5E_BEGIN_TRY{
- grp = H5Oopen_by_addr(fid, grp_addr);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); }
+ H5E_END_TRY
VERIFY(grp, FAIL, "H5Oopen_by_addr");
/* For instance, an objectno smaller than the end of the file's superblock should
* trigger an error */
grp_addr = 10;
- H5E_BEGIN_TRY{
- grp = H5Oopen_by_addr(fid, grp_addr);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); }
+ H5E_END_TRY
VERIFY(grp, FAIL, "H5Oopen_by_addr");
/* Likewise, an objectno larger than the size of the file should fail */
grp_addr = 0;
grp_addr = 1000000000;
- H5E_BEGIN_TRY{
- grp = H5Oopen_by_addr(fid, grp_addr);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); }
+ H5E_END_TRY
VERIFY(grp, FAIL, "H5Oopen_by_addr");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Also, trying to open an object without a valid location should fail */
- H5E_BEGIN_TRY{
- dtype = H5Oopen_by_addr(fid, dtype_addr);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { dtype = H5Oopen_by_addr(fid, dtype_addr); }
+ H5E_END_TRY
VERIFY(dtype, FAIL, "H5Oopen_by_addr");
} /* test_h5o_open_by_addr() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/****************************************************************
**
** test_h5o_open_by_token(): Test H5Oopen_by_token function.
@@ -386,14 +383,14 @@ test_h5o_open_by_addr(void)
static void
test_h5o_open_by_token(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
- H5L_info2_t li; /* Buffer for H5Lget_info */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ H5L_info2_t li; /* Buffer for H5Lget_info */
hsize_t dims[RANK];
- H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
- H5G_info_t ginfo; /* Group info struct */
- H5T_class_t type_class; /* Class of the datatype */
- herr_t ret; /* Value returned from API calls */
+ H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
+ H5G_info_t ginfo; /* Group info struct */
+ H5T_class_t type_class; /* Class of the datatype */
+ herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -417,7 +414,7 @@ test_h5o_open_by_token(void)
/* Create the data space for the dataset. */
dims[0] = DIM0;
dims[1] = DIM1;
- dspace = H5Screate_simple(RANK, dims, NULL);
+ dspace = H5Screate_simple(RANK, dims, NULL);
CHECK(dspace, FAIL, "H5Screate_simple");
/* Create the dataset. */
@@ -476,18 +473,16 @@ test_h5o_open_by_token(void)
/* Try giving some bogus values to H5O_open_by_token */
/* Try opening an object using H5O_TOKEN_UNDEF (should fail) */
- H5E_BEGIN_TRY{
- dtype = H5Oopen_by_token(fid, H5O_TOKEN_UNDEF);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { dtype = H5Oopen_by_token(fid, H5O_TOKEN_UNDEF); }
+ H5E_END_TRY
VERIFY(dtype, FAIL, "H5Oopen_by_token");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Also, trying to open an object without a valid location (should fail) */
- H5E_BEGIN_TRY{
- dtype = H5Oopen_by_token(fid, li.u.token);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { dtype = H5Oopen_by_token(fid, li.u.token); }
+ H5E_END_TRY
VERIFY(dtype, FAIL, "H5Oopen_by_token");
} /* test_h5o_open_by_token() */
@@ -500,11 +495,11 @@ test_h5o_open_by_token(void)
static void
test_h5o_refcount(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
- H5O_info2_t oinfo; /* Object info struct */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ H5O_info2_t oinfo; /* Object info struct */
hsize_t dims[RANK];
- herr_t ret; /* Value returned from API calls */
+ herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -524,7 +519,7 @@ test_h5o_refcount(void)
/* Create the data space for the dataset. */
dims[0] = DIM0;
dims[1] = DIM1;
- dspace = H5Screate_simple(RANK, dims, NULL);
+ dspace = H5Screate_simple(RANK, dims, NULL);
CHECK(dspace, FAIL, "H5Screate_simple");
/* Create the dataset. */
@@ -666,7 +661,8 @@ test_h5o_refcount(void)
CHECK(ret, FAIL, "H5Dclose");
/* Make sure that bogus IDs return errors properly */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Oincr_refcount(grp);
VERIFY(ret, FAIL, "H5Oincr_refcount");
ret = H5Oincr_refcount(dtype);
@@ -679,14 +675,14 @@ test_h5o_refcount(void)
VERIFY(ret, FAIL, "H5Odecr_refcount");
ret = H5Odecr_refcount(dset);
VERIFY(ret, FAIL, "H5Odecr_refcount");
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
} /* test_h5o_refcount() */
-
/****************************************************************
**
** test_h5o_plist(): Test object creation properties
@@ -695,13 +691,13 @@ test_h5o_refcount(void)
static void
test_h5o_plist(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
- hid_t fapl; /* File access property list */
- hid_t gcpl, dcpl, tcpl; /* Object creation properties */
- unsigned def_max_compact, def_min_dense; /* Default phase change parameters */
- unsigned max_compact, min_dense; /* Actual phase change parameters */
- herr_t ret; /* Value returned from API calls */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ hid_t fapl; /* File access property list */
+ hid_t gcpl, dcpl, tcpl; /* Object creation properties */
+ unsigned def_max_compact, def_min_dense; /* Default phase change parameters */
+ unsigned max_compact, min_dense; /* Actual phase change parameters */
+ herr_t ret; /* Value returned from API calls */
/* Make a FAPL that uses the "use the latest version of the format" flag */
fapl = H5Pcreate(H5P_FILE_ACCESS);
@@ -880,7 +876,6 @@ test_h5o_plist(void)
CHECK(ret, FAIL, "H5Pclose");
} /* test_h5o_plist() */
-
/****************************************************************
**
** test_h5o_link(): Test creating link to object
@@ -889,20 +884,20 @@ test_h5o_plist(void)
static void
test_h5o_link(void)
{
- hid_t file_id=-1;
- hid_t group_id=-1;
- hid_t space_id=-1;
- hid_t dset_id=-1;
- hid_t type_id=-1;
- hid_t fapl_id=-1;
- hid_t lcpl_id=-1;
- hsize_t dims[2] = {TEST6_DIM1, TEST6_DIM2};
- htri_t committed; /* Whether the named datatype is committed */
+ hid_t file_id = -1;
+ hid_t group_id = -1;
+ hid_t space_id = -1;
+ hid_t dset_id = -1;
+ hid_t type_id = -1;
+ hid_t fapl_id = -1;
+ hid_t lcpl_id = -1;
+ hsize_t dims[2] = {TEST6_DIM1, TEST6_DIM2};
+ htri_t committed; /* Whether the named datatype is committed */
H5F_libver_t low, high; /* File format bounds */
- int *wdata;
- int *rdata;
- int i, n;
- herr_t ret; /* Value returned from API calls */
+ int * wdata;
+ int * rdata;
+ int i, n;
+ herr_t ret; /* Value returned from API calls */
/* Allocate memory buffers */
/* (These are treated as 2-D buffers) */
@@ -912,11 +907,11 @@ test_h5o_link(void)
CHECK_PTR(rdata, "HDmalloc");
/* Initialize the raw data */
- for(i = n = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
- wdata[i] = n++;
+ for (i = n = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
+ wdata[i] = n++;
/* Create the dataspace */
- space_id = H5Screate_simple(2 ,dims, NULL);
+ space_id = H5Screate_simple(2, dims, NULL);
CHECK(space_id, FAIL, "H5Screate_simple");
/* Create LCPL with intermediate group creation flag set */
@@ -930,13 +925,12 @@ test_h5o_link(void)
CHECK(fapl_id, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds */
- H5E_BEGIN_TRY {
- ret = H5Pset_libver_bounds(fapl_id, low, high);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(fapl_id, low, high); }
+ H5E_END_TRY;
if (ret < 0) /* Invalid low/high combinations */
continue;
@@ -972,7 +966,7 @@ test_h5o_link(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the data */
- for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
+ for (i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
VERIFY(wdata[i], rdata[i], "H5Dread");
/* Create a group with no name*/
@@ -1010,7 +1004,7 @@ test_h5o_link(void)
/* Read data from dataset */
ret = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Dread");
- for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
+ for (i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
VERIFY(wdata[i], rdata[i], "H5Dread");
/* Close open IDs */
@@ -1021,7 +1015,7 @@ test_h5o_link(void)
ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
} /* for high */
- } /* for low */
+ } /* for low */
/* Close remaining IDs */
ret = H5Sclose(space_id);
@@ -1034,7 +1028,6 @@ test_h5o_link(void)
HDfree(rdata);
} /* end test_h5o_link() */
-
/****************************************************************
**
** test_h5o_comment(): Test H5Oset(get)_comment functions.
@@ -1043,20 +1036,20 @@ test_h5o_link(void)
static void
test_h5o_comment(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
hid_t attr_space, attr_id;
hsize_t dims[RANK];
- hsize_t attr_dims = 1;
- int attr_value = 5;
- const char *file_comment = "file comment";
- const char *grp_comment = "group comment";
- const char *dset_comment = "dataset comment";
- const char *dtype_comment = "datatype comment";
+ hsize_t attr_dims = 1;
+ int attr_value = 5;
+ const char *file_comment = "file comment";
+ const char *grp_comment = "group comment";
+ const char *dset_comment = "dataset comment";
+ const char *dtype_comment = "datatype comment";
char check_comment[64];
ssize_t comment_len = 0;
ssize_t len;
- herr_t ret; /* Value returned from API calls */
+ herr_t ret; /* Value returned from API calls */
int ret_value;
/* Create a new HDF5 file */
@@ -1109,7 +1102,7 @@ test_h5o_comment(void)
/* Create the data space for the dataset. */
dims[0] = DIM0;
dims[1] = DIM1;
- dspace = H5Screate_simple(RANK, dims, NULL);
+ dspace = H5Screate_simple(RANK, dims, NULL);
CHECK(dspace, FAIL, "H5Screate_simple");
/* Create the dataset. */
@@ -1121,9 +1114,8 @@ test_h5o_comment(void)
CHECK(ret, FAIL, "H5Oset_comment");
/* Putting a comment on the dataspace. It's supposed to fail. */
- H5E_BEGIN_TRY {
- ret = H5Oset_comment(dspace, "dataspace comment");
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Oset_comment(dspace, "dataspace comment"); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Oset_comment");
/* Close the file */
@@ -1134,7 +1126,6 @@ test_h5o_comment(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Now make sure that the comments are correct all 4 types of objects */
/* Open file */
fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -1144,7 +1135,7 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(fid, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- len = H5Oget_comment(fid, check_comment, (size_t)comment_len+1);
+ len = H5Oget_comment(fid, check_comment, (size_t)comment_len + 1);
CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(file_comment, check_comment);
@@ -1158,7 +1149,7 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(grp, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- len = H5Oget_comment(grp, check_comment, (size_t)comment_len+1);
+ len = H5Oget_comment(grp, check_comment, (size_t)comment_len + 1);
CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(grp_comment, check_comment);
@@ -1172,7 +1163,7 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(dtype, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- len = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1);
+ len = H5Oget_comment(dtype, check_comment, (size_t)comment_len + 1);
CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(dtype_comment, check_comment);
@@ -1186,13 +1177,12 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(dset, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- len = H5Oget_comment(dset, check_comment, (size_t)comment_len+1);
+ len = H5Oget_comment(dset, check_comment, (size_t)comment_len + 1);
CHECK(ret, len, "H5Oget_comment");
ret_value = HDstrcmp(dset_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment");
-
/* Close the IDs */
ret = H5Gclose(grp);
CHECK(ret, FAIL, "H5Gclose");
@@ -1207,7 +1197,6 @@ test_h5o_comment(void)
} /* test_h5o_comment() */
-
/****************************************************************
**
** test_h5o_comment_by_name(): Test H5Oset(get)_comment_by_name functions.
@@ -1216,20 +1205,20 @@ test_h5o_comment(void)
static void
test_h5o_comment_by_name(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
hid_t attr_space, attr_id;
hsize_t dims[RANK];
- hsize_t attr_dims = 1;
- int attr_value = 5;
- const char *file_comment = "file comment by name";
- const char *grp_comment = "group comment by name";
- const char *dset_comment = "dataset comment by name";
- const char *dtype_comment = "datatype comment by name";
+ hsize_t attr_dims = 1;
+ int attr_value = 5;
+ const char *file_comment = "file comment by name";
+ const char *grp_comment = "group comment by name";
+ const char *dset_comment = "dataset comment by name";
+ const char *dtype_comment = "datatype comment by name";
char check_comment[64];
ssize_t comment_len = 0;
ssize_t len;
- herr_t ret; /* Value returned from API calls */
+ herr_t ret; /* Value returned from API calls */
int ret_value;
/* Create a new HDF5 file */
@@ -1282,7 +1271,7 @@ test_h5o_comment_by_name(void)
/* Create the data space for the dataset. */
dims[0] = DIM0;
dims[1] = DIM1;
- dspace = H5Screate_simple(RANK, dims, NULL);
+ dspace = H5Screate_simple(RANK, dims, NULL);
CHECK(dspace, FAIL, "H5Screate_simple");
/* Create the dataset. */
@@ -1294,9 +1283,8 @@ test_h5o_comment_by_name(void)
CHECK(ret, FAIL, "H5Oset_comment_by_name");
/* Putting a comment on the dataspace. It's supposed to fail. */
- H5E_BEGIN_TRY {
- ret = H5Oset_comment_by_name(dspace, ".", "dataspace comment", H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Oset_comment_by_name(dspace, ".", "dataspace comment", H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Oset_comment");
/* Close the file */
@@ -1316,7 +1304,7 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(fid, ".", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- len = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ len = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len + 1, H5P_DEFAULT);
CHECK(len, FAIL, "H5Oget_comment_by_name");
ret_value = HDstrcmp(file_comment, check_comment);
@@ -1330,7 +1318,7 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(fid, "group", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- len = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ len = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len + 1, H5P_DEFAULT);
CHECK(len, FAIL, "H5Oget_comment_by_name");
ret_value = HDstrcmp(grp_comment, check_comment);
@@ -1340,7 +1328,7 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(grp, "datatype", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- len = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ len = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len + 1, H5P_DEFAULT);
CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(dtype_comment, check_comment);
@@ -1350,7 +1338,7 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(fid, "dataset", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- len = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ len = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len + 1, H5P_DEFAULT);
CHECK(len, FAIL, "H5Oget_comment_by_name");
ret_value = HDstrcmp(dset_comment, check_comment);
@@ -1366,7 +1354,6 @@ test_h5o_comment_by_name(void)
} /* test_h5o_comment_by_name() */
-
/****************************************************************
**
** test_h5o_getinfo_same_file(): Test that querying the object info for
@@ -1376,10 +1363,10 @@ test_h5o_comment_by_name(void)
static void
test_h5o_getinfo_same_file(void)
{
- hid_t fid1, fid2; /* HDF5 File ID */
- hid_t gid1, gid2; /* Group IDs */
- H5O_info2_t oinfo1, oinfo2; /* Object info structs */
- herr_t ret; /* Value returned from API calls */
+ hid_t fid1, fid2; /* HDF5 File ID */
+ hid_t gid1, gid2; /* Group IDs */
+ H5O_info2_t oinfo1, oinfo2; /* Object info structs */
+ herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
fid1 = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1423,7 +1410,6 @@ test_h5o_getinfo_same_file(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open file twice */
fid1 = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1482,17 +1468,17 @@ test_h5o_getinfo_same_file(void)
static void
test_h5o_open_by_addr_deprec(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
- H5L_info1_t li; /* Buffer for H5Lget_info1 */
- haddr_t grp_addr; /* Addresses for objects */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ H5L_info1_t li; /* Buffer for H5Lget_info1 */
+ haddr_t grp_addr; /* Addresses for objects */
haddr_t dset_addr;
haddr_t dtype_addr;
hsize_t dims[RANK];
- H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
- H5G_info_t ginfo; /* Group info struct */
- H5T_class_t type_class; /* Class of the datatype */
- herr_t ret; /* Value returned from API calls */
+ H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
+ H5G_info_t ginfo; /* Group info struct */
+ H5T_class_t type_class; /* Class of the datatype */
+ herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1516,7 +1502,7 @@ test_h5o_open_by_addr_deprec(void)
/* Create the data space for the dataset. */
dims[0] = DIM0;
dims[1] = DIM1;
- dspace = H5Screate_simple(RANK, dims, NULL);
+ dspace = H5Screate_simple(RANK, dims, NULL);
CHECK(dspace, FAIL, "H5Screate_simple");
/* Create the dataset. */
@@ -1531,10 +1517,10 @@ test_h5o_open_by_addr_deprec(void)
ret = H5Lget_info1(fid, "group", &li, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_info");
grp_addr = li.u.address;
- ret = H5Lget_info1(fid, "group/datatype", &li, H5P_DEFAULT);
+ ret = H5Lget_info1(fid, "group/datatype", &li, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_info");
dtype_addr = li.u.address;
- ret = H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT);
+ ret = H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_info");
dset_addr = li.u.address;
@@ -1579,38 +1565,33 @@ test_h5o_open_by_addr_deprec(void)
/* Try giving some bogus values to H5O_open_by_addr. */
/* Try to open an object with a bad address */
grp_addr += 20;
- H5E_BEGIN_TRY{
- grp = H5Oopen_by_addr(fid, grp_addr);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); }
+ H5E_END_TRY
VERIFY(grp, FAIL, "H5Oopen_by_addr");
/* For instance, an objectno smaller than the end of the file's superblock should
* trigger an error */
grp_addr = 10;
- H5E_BEGIN_TRY{
- grp = H5Oopen_by_addr(fid, grp_addr);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); }
+ H5E_END_TRY
VERIFY(grp, FAIL, "H5Oopen_by_addr");
/* Likewise, an objectno larger than the size of the file should fail */
grp_addr = 0;
grp_addr = 1000000000;
- H5E_BEGIN_TRY{
- grp = H5Oopen_by_addr(fid, grp_addr);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { grp = H5Oopen_by_addr(fid, grp_addr); }
+ H5E_END_TRY
VERIFY(grp, FAIL, "H5Oopen_by_addr");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Also, trying to open an object without a valid location should fail */
- H5E_BEGIN_TRY{
- dtype = H5Oopen_by_addr(fid, dtype_addr);
- }H5E_END_TRY
+ H5E_BEGIN_TRY { dtype = H5Oopen_by_addr(fid, dtype_addr); }
+ H5E_END_TRY
VERIFY(dtype, FAIL, "H5Oopen_by_addr");
} /* test_h5o_open_by_addr_deprec() */
-
/****************************************************************
**
** visit_obj_cb():
@@ -1621,29 +1602,31 @@ test_h5o_open_by_addr_deprec(void)
**
****************************************************************/
static int
-visit_obj_cb(hid_t group_id, const char *name, const H5O_info1_t *oinfo1,
- void H5_ATTR_UNUSED *_op_data)
+visit_obj_cb(hid_t group_id, const char *name, const H5O_info1_t *oinfo1, void H5_ATTR_UNUSED *_op_data)
{
- H5O_info1_t oinfo2; /* Object info structs */
+ H5O_info1_t oinfo2; /* Object info structs */
/* Verify the object info for "group1", "group2" and the root group */
- if(!(HDstrcmp(name, "group1"))) {
+ if (!(HDstrcmp(name, "group1"))) {
H5Oget_info_by_name2(group_id, name, &oinfo2, H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
VERIFY(oinfo1->num_attrs, oinfo2.num_attrs, "obj info from H5Ovisit1");
- } else if(!(HDstrcmp(name, "group2"))) {
+ }
+ else if (!(HDstrcmp(name, "group2"))) {
H5Oget_info_by_name2(group_id, name, &oinfo2, H5O_INFO_HDR, H5P_DEFAULT);
VERIFY(oinfo1->hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Ovisit1/H5Oget_info2");
VERIFY(oinfo1->hdr.nchunks, oinfo2.hdr.nchunks, "obj info from H5Ovisit1/H5Oget_info2");
- } else if(!(HDstrcmp(name, "."))) {
+ }
+ else if (!(HDstrcmp(name, "."))) {
H5Oget_info_by_name2(group_id, name, &oinfo2, H5O_INFO_META_SIZE, H5P_DEFAULT);
- VERIFY(oinfo1->meta_size.obj.index_size, oinfo2.meta_size.obj.index_size, "obj info from H5Ovisit1/H5Oget_info2");
- VERIFY(oinfo1->meta_size.obj.heap_size, oinfo2.meta_size.obj.heap_size, "obj info from H5Ovisit1/H5Oget_info2");
+ VERIFY(oinfo1->meta_size.obj.index_size, oinfo2.meta_size.obj.index_size,
+ "obj info from H5Ovisit1/H5Oget_info2");
+ VERIFY(oinfo1->meta_size.obj.heap_size, oinfo2.meta_size.obj.heap_size,
+ "obj info from H5Ovisit1/H5Oget_info2");
}
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
} /* end visit_obj_cb() */
-
/****************************************************************
**
** test_h5o_getinfo_visit():
@@ -1656,14 +1639,14 @@ visit_obj_cb(hid_t group_id, const char *name, const H5O_info1_t *oinfo1,
static void
test_h5o_getinfo_visit(void)
{
- hid_t fid = -1; /* HDF5 File ID */
- hid_t gid1 = -1, gid2 = -1; /* Group IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- H5O_info1_t oinfo1, oinfo2; /* Object info structs */
- char attrname[25]; /* Attribute name */
- int j; /* Local index variable */
- herr_t ret; /* Value returned from API calls */
+ hid_t fid = -1; /* HDF5 File ID */
+ hid_t gid1 = -1, gid2 = -1; /* Group IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ H5O_info1_t oinfo1, oinfo2; /* Object info structs */
+ char attrname[25]; /* Attribute name */
+ int j; /* Local index variable */
+ herr_t ret; /* Value returned from API calls */
/* Create an HDF5 file */
fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1678,7 +1661,7 @@ test_h5o_getinfo_visit(void)
CHECK(sid, FAIL, "H5Screate");
/* Attach 10 attributes to "group1" */
- for(j = 0; j <10; j++) {
+ for (j = 0; j < 10; j++) {
/* Create the attribute name */
HDsprintf(attrname, "attr%u", j);
/* Create the attribute */
@@ -1700,7 +1683,7 @@ test_h5o_getinfo_visit(void)
/* Query the object info for "group1" via H5Oget_info1 and H5Oget_info2 */
ret = H5Oget_info1(gid1, &oinfo1);
CHECK(ret, FAIL, "H5Oget_info1");
- ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS);
+ ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_BASIC | H5O_INFO_NUM_ATTRS);
CHECK(ret, FAIL, "H5Oget_info2");
/* Verify the object info for "group1" is correct */
@@ -1714,7 +1697,7 @@ test_h5o_getinfo_visit(void)
/* Query the object info for "group2" via H5Oget_info1 and H5Oget_info2 */
ret = H5Oget_info_by_name1(fid, "group2", &oinfo1, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_native_info_by_name");
- ret = H5Oget_info_by_name2(fid, "group2", &oinfo2, H5O_INFO_HDR|H5O_INFO_META_SIZE, H5P_DEFAULT);
+ ret = H5Oget_info_by_name2(fid, "group2", &oinfo2, H5O_INFO_HDR | H5O_INFO_META_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_native_info_by_name");
/* Verify the object info for "group2" is correct */
@@ -1740,7 +1723,6 @@ test_h5o_getinfo_visit(void)
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/****************************************************************
**
** test_h5o(): Main H5O (generic object) testing routine.
@@ -1752,25 +1734,24 @@ test_h5o(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Objects\n"));
- test_h5o_open(); /* Test generic open function */
+ test_h5o_open(); /* Test generic open function */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_h5o_open_by_addr(); /* Test opening objects by address */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- test_h5o_open_by_token(); /* Test opening objects by token */
- test_h5o_close(); /* Test generic close function */
- test_h5o_refcount(); /* Test incrementing and decrementing reference count */
- test_h5o_plist(); /* Test object creation properties */
- test_h5o_link(); /* Test object link routine */
- test_h5o_comment(); /* Test routines for comment */
- test_h5o_comment_by_name(); /* Test routines for comment by name */
- test_h5o_getinfo_same_file(); /* Test info for objects in the same file */
+ test_h5o_open_by_addr(); /* Test opening objects by address */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ test_h5o_open_by_token(); /* Test opening objects by token */
+ test_h5o_close(); /* Test generic close function */
+ test_h5o_refcount(); /* Test incrementing and decrementing reference count */
+ test_h5o_plist(); /* Test object creation properties */
+ test_h5o_link(); /* Test object link routine */
+ test_h5o_comment(); /* Test routines for comment */
+ test_h5o_comment_by_name(); /* Test routines for comment by name */
+ test_h5o_getinfo_same_file(); /* Test info for objects in the same file */
#ifndef H5_NO_DEPRECATED_SYMBOLS
test_h5o_open_by_addr_deprec(); /* Test opening objects by address with H5Lget_info1 */
test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* test_h5o() */
-
/*-------------------------------------------------------------------------
* Function: cleanup_h5o
*
@@ -1788,4 +1769,3 @@ cleanup_h5o(void)
{
remove(TEST_FILENAME);
}
-
diff --git a/test/th5s.c b/test/th5s.c
index bb84353..07cb0ab 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -12,12 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: th5s
-*
-* Test the dataspace functionality
-*
-*************************************************************/
+ *
+ * Test program: th5s
+ *
+ * Test the dataspace functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
#include "H5srcdir.h"
@@ -29,69 +29,69 @@
* This file needs to access private information from the H5S package.
* This file also needs to access the dataspace testing code.
*/
-#define H5S_FRIEND /*suppress error about including H5Spkg */
-#define H5S_TESTING /*suppress warning about H5S testing funcs*/
-#include "H5Spkg.h" /* Dataspaces */
+#define H5S_FRIEND /*suppress error about including H5Spkg */
+#define H5S_TESTING /*suppress warning about H5S testing funcs*/
+#include "H5Spkg.h" /* Dataspaces */
/*
* This file needs to access private information from the H5O package.
* This file also needs to access the dataspace testing code.
*/
-#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
-#include "H5Opkg.h" /* Object header */
+#include "H5Opkg.h" /* Object header */
-#define TESTFILE "th5s.h5"
-#define DATAFILE "th5s1.h5"
-#define NULLFILE "th5s2.h5"
-#define BASICFILE "th5s3.h5"
-#define ZEROFILE "th5s4.h5"
+#define TESTFILE "th5s.h5"
+#define DATAFILE "th5s1.h5"
+#define NULLFILE "th5s2.h5"
+#define BASICFILE "th5s3.h5"
+#define ZEROFILE "th5s4.h5"
#define BASICDATASET "basic_dataset"
#define BASICDATASET1 "basic_dataset1"
#define BASICDATASET2 "basic_dataset2"
#define BASICDATASET3 "basic_dataset3"
#define BASICDATASET4 "basic_dataset4"
-#define BASICATTR "basic_attribute"
-#define NULLDATASET "null_dataset"
-#define NULLATTR "null_attribute"
-#define EXTFILE_NAME "ext_file"
+#define BASICATTR "basic_attribute"
+#define NULLDATASET "null_dataset"
+#define NULLATTR "null_attribute"
+#define EXTFILE_NAME "ext_file"
/* 3-D dataset with fixed dimensions */
-#define SPACE1_RANK 3
-#define SPACE1_DIM1 3
-#define SPACE1_DIM2 15
-#define SPACE1_DIM3 13
+#define SPACE1_RANK 3
+#define SPACE1_DIM1 3
+#define SPACE1_DIM2 15
+#define SPACE1_DIM3 13
/* 4-D dataset with one unlimited dimension */
-#define SPACE2_RANK 4
-#define SPACE2_DIM1 0
-#define SPACE2_DIM2 15
-#define SPACE2_DIM3 13
-#define SPACE2_DIM4 23
-#define SPACE2_MAX1 H5S_UNLIMITED
-#define SPACE2_MAX2 15
-#define SPACE2_MAX3 13
-#define SPACE2_MAX4 23
+#define SPACE2_RANK 4
+#define SPACE2_DIM1 0
+#define SPACE2_DIM2 15
+#define SPACE2_DIM3 13
+#define SPACE2_DIM4 23
+#define SPACE2_MAX1 H5S_UNLIMITED
+#define SPACE2_MAX2 15
+#define SPACE2_MAX3 13
+#define SPACE2_MAX4 23
/* Scalar dataset with simple datatype */
-#define SPACE3_RANK 0
-unsigned space3_data=65;
+#define SPACE3_RANK 0
+unsigned space3_data = 65;
/* Scalar dataset with compound datatype */
-#define SPACE4_FIELDNAME1 "c1"
-#define SPACE4_FIELDNAME2 "u"
-#define SPACE4_FIELDNAME3 "f"
-#define SPACE4_FIELDNAME4 "c2"
-size_t space4_field1_off=0;
-size_t space4_field2_off=0;
-size_t space4_field3_off=0;
-size_t space4_field4_off=0;
+#define SPACE4_FIELDNAME1 "c1"
+#define SPACE4_FIELDNAME2 "u"
+#define SPACE4_FIELDNAME3 "f"
+#define SPACE4_FIELDNAME4 "c2"
+size_t space4_field1_off = 0;
+size_t space4_field2_off = 0;
+size_t space4_field3_off = 0;
+size_t space4_field4_off = 0;
struct space4_struct {
- char c1;
+ char c1;
unsigned u;
- float f;
- char c2;
-} space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */
+ float f;
+ char c2;
+} space4_data = {'v', 987123, -3.14F, 'g'}; /* Test data for 4th dataspace */
/*
* Testing configuration defines used by:
@@ -99,13 +99,12 @@ struct space4_struct {
* test_h5s_encode_irregular_hyper()
* test_h5s_encode_points()
*/
-#define CONFIG_8 1
-#define CONFIG_16 2
-#define CONFIG_32 3
-#define POWER8 256 /* 2^8 */
-#define POWER16 65536 /* 2^16 */
-#define POWER32 4294967296 /* 2^32 */
-
+#define CONFIG_8 1
+#define CONFIG_16 2
+#define CONFIG_32 3
+#define POWER8 256 /* 2^8 */
+#define POWER16 65536 /* 2^16 */
+#define POWER32 4294967296 /* 2^32 */
/****************************************************************
**
@@ -115,21 +114,19 @@ struct space4_struct {
static void
test_h5s_basic(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t sid1, sid2; /* Dataspace ID */
- hid_t dset1; /* Dataset ID */
- hid_t aid1; /* Attribute ID */
- int rank; /* Logical rank of dataspace */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3,
- SPACE2_DIM4};
- hsize_t dims3[H5S_MAX_RANK+1];
- hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3,
- SPACE2_MAX4};
- hsize_t tdims[4]; /* Dimension array to test with */
- hsize_t tmax[4];
- hssize_t n; /* Number of dataspace elements */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hid_t dset1; /* Dataset ID */
+ hid_t aid1; /* Attribute ID */
+ int rank; /* Logical rank of dataspace */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, SPACE2_DIM4};
+ hsize_t dims3[H5S_MAX_RANK + 1];
+ hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hsize_t tmax[4];
+ hssize_t n; /* Number of dataspace elements */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspace Manipulation\n"));
@@ -139,8 +136,7 @@ test_h5s_basic(void)
n = H5Sget_simple_extent_npoints(sid1);
CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
- VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
- "H5Sget_simple_extent_npoints");
+ VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3, "H5Sget_simple_extent_npoints");
rank = H5Sget_simple_extent_ndims(sid1);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
@@ -148,16 +144,14 @@ test_h5s_basic(void)
rank = H5Sget_simple_extent_dims(sid1, tdims, NULL);
CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
- VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims");
sid2 = H5Screate_simple(SPACE2_RANK, dims2, max2);
CHECK(sid2, FAIL, "H5Screate_simple");
n = H5Sget_simple_extent_npoints(sid2);
CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
- VERIFY(n, SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4,
- "H5Sget_simple_extent_npoints");
+ VERIFY(n, SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4, "H5Sget_simple_extent_npoints");
rank = H5Sget_simple_extent_ndims(sid2);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
@@ -165,20 +159,16 @@ test_h5s_basic(void)
rank = H5Sget_simple_extent_dims(sid2, tdims, tmax);
CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
- VERIFY(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
- VERIFY(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims");
/* Change max dims to be equal to the dimensions */
ret = H5Sset_extent_simple(sid1, SPACE1_RANK, dims1, NULL);
CHECK(ret, FAIL, "H5Sset_extent_simple");
rank = H5Sget_simple_extent_dims(sid1, tdims, tmax);
CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
- VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
- VERIFY(HDmemcmp(tmax, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tmax, dims1, SPACE1_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims");
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
@@ -190,9 +180,8 @@ test_h5s_basic(void)
* Check to be sure we can't create a simple dataspace that has too many
* dimensions.
*/
- H5E_BEGIN_TRY {
- sid1 = H5Screate_simple(H5S_MAX_RANK+1, dims3, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { sid1 = H5Screate_simple(H5S_MAX_RANK + 1, dims3, NULL); }
+ H5E_END_TRY;
VERIFY(sid1, FAIL, "H5Screate_simple");
/*
@@ -203,30 +192,30 @@ test_h5s_basic(void)
* the instructions in space_overflow.c for regenerating the th5s.h5 file.
*/
{
- const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
-
- fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
- CHECK_I(fid1, "H5Fopen");
- if (fid1 >= 0){
- dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT);
- VERIFY(dset1, FAIL, "H5Dopen2");
- ret = H5Fclose(fid1);
- CHECK_I(ret, "H5Fclose");
- }
- else
- HDprintf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", testfile);
+ const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
+
+ fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK_I(fid1, "H5Fopen");
+ if (fid1 >= 0) {
+ dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT);
+ VERIFY(dset1, FAIL, "H5Dopen2");
+ ret = H5Fclose(fid1);
+ CHECK_I(ret, "H5Fclose");
+ }
+ else
+ HDprintf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", testfile);
}
/* Verify that incorrect dimensions don't work */
dims1[0] = H5S_UNLIMITED;
- sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
VERIFY(sid1, FAIL, "H5Screate_simple");
dims1[0] = H5S_UNLIMITED;
- sid1 = H5Screate(H5S_SIMPLE);
+ sid1 = H5Screate(H5S_SIMPLE);
CHECK(sid1, FAIL, "H5Screate");
- ret = H5Sset_extent_simple(sid1,SPACE1_RANK,dims1,NULL);
+ ret = H5Sset_extent_simple(sid1, SPACE1_RANK, dims1, NULL);
VERIFY(ret, FAIL, "H5Sset_extent_simple");
ret = H5Sclose(sid1);
@@ -239,7 +228,7 @@ test_h5s_basic(void)
fid1 = H5Fcreate(BASICFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fcreate");
- dims1[0]=SPACE1_DIM1;
+ dims1[0] = SPACE1_DIM1;
sid1 = H5Screate(H5S_SIMPLE);
CHECK(sid1, FAIL, "H5Screate");
@@ -247,62 +236,55 @@ test_h5s_basic(void)
CHECK(sid2, FAIL, "H5Screate");
/* This dataset's space has no extent; it should not be created */
- H5E_BEGIN_TRY {
- dset1 = H5Dcreate2(fid1, BASICDATASET, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ dset1 = H5Dcreate2(fid1, BASICDATASET, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ }
+ H5E_END_TRY
VERIFY(dset1, FAIL, "H5Dcreate2");
dset1 = H5Dcreate2(fid1, BASICDATASET2, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset1, FAIL, "H5Dcreate2");
/* Try some writes with the bad dataspace (sid1) */
- H5E_BEGIN_TRY {
- ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, &n);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, &n); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dwrite");
- H5E_BEGIN_TRY {
- ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &n);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &n); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dwrite");
- H5E_BEGIN_TRY {
- ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, sid1, H5P_DEFAULT, &n);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, sid1, H5P_DEFAULT, &n); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dwrite");
/* Try to iterate using the bad dataspace */
- H5E_BEGIN_TRY {
- ret = H5Diterate(&n, H5T_NATIVE_INT, sid1, NULL, NULL);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Diterate(&n, H5T_NATIVE_INT, sid1, NULL, NULL); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Diterate");
/* Try to fill using the bad dataspace */
- H5E_BEGIN_TRY {
- ret = H5Dfill(NULL, H5T_NATIVE_INT, &n, H5T_NATIVE_INT, sid1);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dfill(NULL, H5T_NATIVE_INT, &n, H5T_NATIVE_INT, sid1); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dfill");
/* Now use the bad dataspace as the space for an attribute */
- H5E_BEGIN_TRY {
- aid1 = H5Acreate2(dset1, BASICATTR, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { aid1 = H5Acreate2(dset1, BASICATTR, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY
VERIFY(aid1, FAIL, "H5Acreate2");
/* Make sure that dataspace reads using the bad dataspace fail */
- H5E_BEGIN_TRY {
- ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, &n);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, &n); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dread");
- H5E_BEGIN_TRY {
- ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &n);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &n); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dread");
- H5E_BEGIN_TRY {
- ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, sid1, H5P_DEFAULT, &n);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, sid1, H5P_DEFAULT, &n); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dread");
/* Clean up */
@@ -314,7 +296,7 @@ test_h5s_basic(void)
CHECK(ret, FAIL, "H5Sclose");
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5s_basic() */
+} /* test_h5s_basic() */
/****************************************************************
**
@@ -324,20 +306,20 @@ test_h5s_basic(void)
static void
test_h5s_null(void)
{
- hid_t fid; /* File ID */
- hid_t sid; /* Dataspace IDs */
- hid_t dset_sid, dset_sid2; /* Dataspace IDs */
- hid_t attr_sid; /* Dataspace IDs */
- hid_t did; /* Dataset ID */
- hid_t attr; /*Attribute ID */
- H5S_class_t stype; /* dataspace type */
- hssize_t nelem; /* Number of elements */
- unsigned uval=2; /* Buffer for writing to dataset */
- int val=1; /* Buffer for writing to attribute */
- H5S_sel_type sel_type; /* Type of selection currently */
- hsize_t dims[1]={10}; /* Dimensions for converting null dataspace to simple */
- H5S_class_t space_type; /* Type of dataspace */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t sid; /* Dataspace IDs */
+ hid_t dset_sid, dset_sid2; /* Dataspace IDs */
+ hid_t attr_sid; /* Dataspace IDs */
+ hid_t did; /* Dataset ID */
+ hid_t attr; /*Attribute ID */
+ H5S_class_t stype; /* dataspace type */
+ hssize_t nelem; /* Number of elements */
+ unsigned uval = 2; /* Buffer for writing to dataset */
+ int val = 1; /* Buffer for writing to attribute */
+ H5S_sel_type sel_type; /* Type of selection currently */
+ hsize_t dims[1] = {10}; /* Dimensions for converting null dataspace to simple */
+ H5S_class_t space_type; /* Type of dataspace */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Null Dataspace\n"));
@@ -370,21 +352,25 @@ test_h5s_null(void)
VERIFY(nelem, 0, "H5Sget_select_npoints");
/* Check to be sure we can't set a hyperslab selection on a null dataspace */
- H5E_BEGIN_TRY {
- hsize_t start[1]={0};
- hsize_t count[1]={0};
+ H5E_BEGIN_TRY
+ {
+ hsize_t start[1] = {0};
+ hsize_t count[1] = {0};
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL);
- } H5E_END_TRY;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL);
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
/* Check to be sure we can't set a point selection on a null dataspace */
- H5E_BEGIN_TRY {
- hsize_t coord[1][1]; /* Coordinates for point selection */
+ H5E_BEGIN_TRY
+ {
+ hsize_t coord[1][1]; /* Coordinates for point selection */
- coord[0][0]=0;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord);
- } H5E_END_TRY;
+ coord[0][0] = 0;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord);
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sselect_elements");
/* Create first dataset */
@@ -432,7 +418,7 @@ test_h5s_null(void)
VERIFY(uval, 2, "H5Aread");
/* Close attribute */
- ret=H5Aclose(attr);
+ ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Close the dataset */
@@ -524,7 +510,7 @@ test_h5s_null(void)
VERIFY(val, 1, "H5Aread");
/* Close attribute */
- ret=H5Aclose(attr);
+ ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Close the dataset */
@@ -544,61 +530,61 @@ test_h5s_null(void)
static void
test_h5s_zero_dim(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t sid1, attr_sid; /* Dataspace ID */
- hid_t sid_chunk; /* Dataspace ID for chunked dataset */
- hid_t dset1; /* Dataset ID */
- hid_t plist_id; /* Dataset creation property list */
- hid_t attr; /* Attribute ID */
- int rank; /* Logical rank of dataspace */
- hsize_t dims1[] = {0, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t max_dims[] = {SPACE1_DIM1+1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t extend_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t chunk_dims[] = {SPACE1_DIM1, SPACE1_DIM2/3, SPACE1_DIM3};
- hsize_t tdims[SPACE1_RANK]; /* Dimension array to test with */
- int wdata[SPACE1_DIM2][SPACE1_DIM3];
- int rdata[SPACE1_DIM2][SPACE1_DIM3];
- short wdata_short[SPACE1_DIM2][SPACE1_DIM3];
- short rdata_short[SPACE1_DIM2][SPACE1_DIM3];
- int wdata_real[SPACE1_DIM1][SPACE1_DIM2][SPACE1_DIM3];
- int rdata_real[SPACE1_DIM1][SPACE1_DIM2][SPACE1_DIM3];
- int val = 3;
- hsize_t start[] = {0, 0, 0};
- hsize_t count[] = {3, 15, 13};
- hsize_t coord[1][3]; /* Coordinates for point selection */
- hssize_t nelem; /* Number of elements */
- H5S_sel_type sel_type; /* Type of selection currently */
- H5S_class_t stype; /* dataspace type */
- H5D_alloc_time_t alloc_time; /* Space allocation time */
- herr_t ret; /* Generic return value */
- unsigned int i, j, k;
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t sid1, attr_sid; /* Dataspace ID */
+ hid_t sid_chunk; /* Dataspace ID for chunked dataset */
+ hid_t dset1; /* Dataset ID */
+ hid_t plist_id; /* Dataset creation property list */
+ hid_t attr; /* Attribute ID */
+ int rank; /* Logical rank of dataspace */
+ hsize_t dims1[] = {0, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t max_dims[] = {SPACE1_DIM1 + 1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t extend_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t chunk_dims[] = {SPACE1_DIM1, SPACE1_DIM2 / 3, SPACE1_DIM3};
+ hsize_t tdims[SPACE1_RANK]; /* Dimension array to test with */
+ int wdata[SPACE1_DIM2][SPACE1_DIM3];
+ int rdata[SPACE1_DIM2][SPACE1_DIM3];
+ short wdata_short[SPACE1_DIM2][SPACE1_DIM3];
+ short rdata_short[SPACE1_DIM2][SPACE1_DIM3];
+ int wdata_real[SPACE1_DIM1][SPACE1_DIM2][SPACE1_DIM3];
+ int rdata_real[SPACE1_DIM1][SPACE1_DIM2][SPACE1_DIM3];
+ int val = 3;
+ hsize_t start[] = {0, 0, 0};
+ hsize_t count[] = {3, 15, 13};
+ hsize_t coord[1][3]; /* Coordinates for point selection */
+ hssize_t nelem; /* Number of elements */
+ H5S_sel_type sel_type; /* Type of selection currently */
+ H5S_class_t stype; /* dataspace type */
+ H5D_alloc_time_t alloc_time; /* Space allocation time */
+ herr_t ret; /* Generic return value */
+ unsigned int i, j, k;
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspace with zero dimension size\n"));
/* Initialize the data */
- for(i = 0; i < SPACE1_DIM2; i++)
- for(j = 0; j < SPACE1_DIM3; j++) {
- wdata[i][j] = (int)(i + j);
- rdata[i][j] = 7;
+ for (i = 0; i < SPACE1_DIM2; i++)
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ wdata[i][j] = (int)(i + j);
+ rdata[i][j] = 7;
wdata_short[i][j] = (short)(i + j);
rdata_short[i][j] = 7;
}
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < SPACE1_DIM2; j++)
- for(k = 0; k < SPACE1_DIM3; k++)
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < SPACE1_DIM2; j++)
+ for (k = 0; k < SPACE1_DIM3; k++)
wdata_real[i][j][k] = (int)(i + j + k);
/* Test with different space allocation times */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for (alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Make sure we can create the space with the dimension size 0 (starting from v1.8.7).
* The dimension doesn't need to be unlimited. */
dims1[0] = 0;
dims1[1] = SPACE1_DIM2;
dims1[2] = SPACE1_DIM3;
- sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
ret = H5Sclose(sid1);
@@ -609,7 +595,7 @@ test_h5s_zero_dim(void)
/* SID1 has the 1st dimension size as zero. The maximal dimension will be
* the same as the dimension because of the NULL passed in. */
- ret = H5Sset_extent_simple(sid1,SPACE1_RANK,dims1,NULL);
+ ret = H5Sset_extent_simple(sid1, SPACE1_RANK, dims1, NULL);
CHECK(ret, FAIL, "H5Sset_extent_simple");
/* Check that the dataspace actually has 0 elements */
@@ -679,12 +665,11 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Dread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++) {
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++) {
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]);
}
}
}
@@ -701,12 +686,11 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Dread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++) {
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata_short[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++) {
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata_short[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata_short[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata_short[i][j]);
}
}
}
@@ -716,9 +700,8 @@ test_h5s_zero_dim(void)
ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- H5E_BEGIN_TRY {
- ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, wdata);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, wdata); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dwrite");
/* Change to "none" selection */
@@ -727,13 +710,14 @@ test_h5s_zero_dim(void)
/* Select a point beyond the dimension size, then try to write the data.
* It should fail. */
- coord[0][0]=2; coord[0][1]=5; coord[0][2]=3;
- ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord);
+ coord[0][0] = 2;
+ coord[0][1] = 5;
+ coord[0][2] = 3;
+ ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord);
CHECK(ret, FAIL, "H5Sselect_elements");
- H5E_BEGIN_TRY {
- ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &val);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &val); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dwrite");
/* Restore the selection to all */
@@ -753,7 +737,8 @@ test_h5s_zero_dim(void)
/* ret = H5Pset_alloc_time(plist_id, alloc_time); */
/* CHECK(ret, FAIL, "H5Pset_alloc_time"); */
- dset1 = H5Dcreate2(fid1, BASICDATASET1, H5T_NATIVE_INT, sid_chunk, H5P_DEFAULT, plist_id, H5P_DEFAULT);
+ dset1 =
+ H5Dcreate2(fid1, BASICDATASET1, H5T_NATIVE_INT, sid_chunk, H5P_DEFAULT, plist_id, H5P_DEFAULT);
CHECK(dset1, FAIL, "H5Dcreate2");
/* Write "nothing" to the dataset */
@@ -768,19 +753,18 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Dread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++)
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++)
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]);
}
- }
+ }
/* Now extend the dataset to SPACE1_DIM1*SPACE1_DIM2*SPACE1_DIM3 and make sure
* we can write data to it */
extend_dims[0] = SPACE1_DIM1;
- ret = H5Dset_extent(dset1, extend_dims);
+ ret = H5Dset_extent(dset1, extend_dims);
CHECK(ret, FAIL, "H5Dset_extent");
ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata_real);
@@ -793,13 +777,13 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Dread");
/* Check results */
- for(i=0; i<SPACE1_DIM1; i++) {
- for(j=0; j<SPACE1_DIM2; j++) {
- for(k=0; k<SPACE1_DIM3; k++) {
- if(rdata_real[i][j][k] != wdata_real[i][j][k]) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ for (j = 0; j < SPACE1_DIM2; j++) {
+ for (k = 0; k < SPACE1_DIM3; k++) {
+ if (rdata_real[i][j][k] != wdata_real[i][j][k]) {
H5_FAILED();
- HDprintf("element [%d][%d][%d] is %d but should have been %d\n",
- i, j, k, rdata_real[i][j][k], wdata_real[i][j][k]);
+ HDprintf("element [%d][%d][%d] is %d but should have been %d\n", i, j, k,
+ rdata_real[i][j][k], wdata_real[i][j][k]);
}
}
}
@@ -807,7 +791,7 @@ test_h5s_zero_dim(void)
/* Now shrink the first dimension size of the dataset to 0 and make sure no data is in it */
extend_dims[0] = 0;
- ret = H5Dset_extent(dset1, extend_dims);
+ ret = H5Dset_extent(dset1, extend_dims);
CHECK(ret, FAIL, "H5Dset_extent");
ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL);
@@ -818,21 +802,19 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Dread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++)
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++)
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]);
}
- }
+ }
/* Now extend the first dimension size of the dataset to SPACE1_DIM1*3 past the maximal size.
* It is supposed to fail. */
- extend_dims[0] = SPACE1_DIM1*3;
- H5E_BEGIN_TRY {
- ret = H5Dset_extent(dset1, extend_dims);
- } H5E_END_TRY;
+ extend_dims[0] = SPACE1_DIM1 * 3;
+ H5E_BEGIN_TRY { ret = H5Dset_extent(dset1, extend_dims); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dset_extent");
ret = H5Pclose(plist_id);
@@ -865,14 +847,13 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Dread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++)
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++)
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]);
}
- }
+ }
ret = H5Pclose(plist_id);
CHECK(ret, FAIL, "H5Pclose");
@@ -909,12 +890,11 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Dread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++) {
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++) {
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]);
}
}
}
@@ -941,12 +921,11 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Aread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++) {
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++) {
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]);
}
}
}
@@ -963,12 +942,11 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Aread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++) {
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata_short[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++) {
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata_short[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata_short[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata_short[i][j]);
}
}
}
@@ -983,14 +961,13 @@ test_h5s_zero_dim(void)
* dataset now.
*===============================================================
*/
- dims1[0]=SPACE1_DIM1;
- ret = H5Sset_extent_simple(sid_chunk,SPACE1_RANK,dims1,max_dims);
+ dims1[0] = SPACE1_DIM1;
+ ret = H5Sset_extent_simple(sid_chunk, SPACE1_RANK, dims1, max_dims);
CHECK(ret, FAIL, "H5Sset_extent_simple");
nelem = H5Sget_simple_extent_npoints(sid_chunk);
CHECK(nelem, FAIL, "H5Sget_simple_extent_npoints");
- VERIFY(nelem, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
- "H5Sget_simple_extent_npoints");
+ VERIFY(nelem, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3, "H5Sget_simple_extent_npoints");
rank = H5Sget_simple_extent_ndims(sid_chunk);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
@@ -998,8 +975,7 @@ test_h5s_zero_dim(void)
rank = H5Sget_simple_extent_dims(sid_chunk, tdims, NULL);
CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
- VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims");
/* Set it to chunked dataset */
plist_id = H5Pcreate(H5P_DATASET_CREATE);
@@ -1011,7 +987,8 @@ test_h5s_zero_dim(void)
ret = H5Pset_alloc_time(plist_id, alloc_time);
CHECK(ret, FAIL, "H5Pset_alloc_time");
- dset1 = H5Dcreate2(fid1, BASICDATASET4, H5T_NATIVE_INT, sid_chunk, H5P_DEFAULT, plist_id, H5P_DEFAULT);
+ dset1 =
+ H5Dcreate2(fid1, BASICDATASET4, H5T_NATIVE_INT, sid_chunk, H5P_DEFAULT, plist_id, H5P_DEFAULT);
CHECK(dset1, FAIL, "H5Dcreate2");
ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata_real);
@@ -1024,13 +1001,13 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Dread");
/* Check results */
- for(i=0; i<SPACE1_DIM1; i++) {
- for(j=0; j<SPACE1_DIM2; j++) {
- for(k=0; k<SPACE1_DIM3; k++) {
- if(rdata_real[i][j][k] != wdata_real[i][j][k]) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ for (j = 0; j < SPACE1_DIM2; j++) {
+ for (k = 0; k < SPACE1_DIM3; k++) {
+ if (rdata_real[i][j][k] != wdata_real[i][j][k]) {
H5_FAILED();
- HDprintf("element [%d][%d][%d] is %d but should have been %d\n",
- i, j, k, rdata_real[i][j][k], wdata_real[i][j][k]);
+ HDprintf("element [%d][%d][%d] is %d but should have been %d\n", i, j, k,
+ rdata_real[i][j][k], wdata_real[i][j][k]);
}
}
}
@@ -1044,8 +1021,8 @@ test_h5s_zero_dim(void)
/* Change the dimensions to make them zero size again (0x0x0). Verify that
* no element is in the dataspace. */
- dims1[0]=dims1[1]=dims1[2]=0;
- ret = H5Sset_extent_simple(sid_chunk,SPACE1_RANK,dims1,NULL);
+ dims1[0] = dims1[1] = dims1[2] = 0;
+ ret = H5Sset_extent_simple(sid_chunk, SPACE1_RANK, dims1, NULL);
CHECK(ret, FAIL, "H5Sset_extent_simple");
/* Check that the dataspace actually has 0 elements */
@@ -1112,12 +1089,11 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Dread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++) {
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++) {
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata[i][j]);
}
}
}
@@ -1150,18 +1126,17 @@ test_h5s_zero_dim(void)
CHECK(ret, FAIL, "H5Aread");
/* Check results */
- for(i=0; i<SPACE1_DIM2; i++) {
- for(j=0; j<SPACE1_DIM3; j++) {
- if(rdata_short[i][j] != 7) {
+ for (i = 0; i < SPACE1_DIM2; i++) {
+ for (j = 0; j < SPACE1_DIM3; j++) {
+ if (rdata_short[i][j] != 7) {
H5_FAILED();
- HDprintf("element [%d][%d] is %d but should have been 7\n",
- i, j, rdata_short[i][j]);
+ HDprintf("element [%d][%d] is %d but should have been 7\n", i, j, rdata_short[i][j]);
}
}
}
/* Close attribute */
- ret=H5Aclose(attr);
+ ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Close the dataspace */
@@ -1173,7 +1148,6 @@ test_h5s_zero_dim(void)
} /* end for */
} /* test_h5s_zero_dim() */
-
/****************************************************************
**
** test_h5s_encode(): Test H5S (dataspace) encoding and decoding.
@@ -1184,24 +1158,24 @@ test_h5s_zero_dim(void)
static void
test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
{
- hid_t sid1, sid2, sid3; /* Dataspace ID */
- hid_t decoded_sid1, decoded_sid2, decoded_sid3;
- int rank; /* Logical rank of dataspace */
- hid_t fapl = -1; /* File access property list ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- size_t sbuf_size=0, null_size=0, scalar_size=0;
- unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL;
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- hsize_t start[] = {0, 0, 0};
- hsize_t stride[] = {2, 5, 3};
- hsize_t count[] = {2, 2, 2};
- hsize_t block[] = {1, 3, 1};
- H5S_sel_type sel_type;
- H5S_class_t space_type;
- hssize_t nblocks;
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t sid1, sid2, sid3; /* Dataspace ID */
+ hid_t decoded_sid1, decoded_sid2, decoded_sid3;
+ int rank; /* Logical rank of dataspace */
+ hid_t fapl = -1; /* File access property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ size_t sbuf_size = 0, null_size = 0, scalar_size = 0;
+ unsigned char *sbuf = NULL, *null_sbuf = NULL, *scalar_buf = NULL;
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ hsize_t start[] = {0, 0, 0};
+ hsize_t stride[] = {2, 5, 3};
+ hsize_t count[] = {2, 2, 2};
+ hsize_t block[] = {1, 3, 1};
+ H5S_sel_type sel_type;
+ H5S_class_t space_type;
+ hssize_t nblocks;
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspace Encoding and Decoding\n"));
@@ -1231,15 +1205,14 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
ret = H5Sencode2(sid1, NULL, &sbuf_size, fapl);
CHECK(ret, FAIL, "H5Sencode2");
- if(sbuf_size>0) {
- sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size);
+ if (sbuf_size > 0) {
+ sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size);
CHECK(sbuf, NULL, "HDcalloc");
}
/* Try decoding bogus buffer */
- H5E_BEGIN_TRY {
- ret_id = H5Sdecode(sbuf);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret_id = H5Sdecode(sbuf); }
+ H5E_END_TRY;
VERIFY(ret_id, FAIL, "H5Sdecode");
/* Encode the simple dataspace in a buffer with the fapl setting */
@@ -1247,25 +1220,23 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
CHECK(ret, FAIL, "H5Sencode");
/* Decode from the dataspace buffer and return an object handle */
- decoded_sid1=H5Sdecode(sbuf);
+ decoded_sid1 = H5Sdecode(sbuf);
CHECK(decoded_sid1, FAIL, "H5Sdecode");
/* Verify the decoded dataspace */
n = H5Sget_simple_extent_npoints(decoded_sid1);
CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
- VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
- "H5Sget_simple_extent_npoints");
+ VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3, "H5Sget_simple_extent_npoints");
/* Retrieve and verify the dataspace rank */
rank = H5Sget_simple_extent_ndims(decoded_sid1);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
VERIFY(rank, SPACE1_RANK, "H5Sget_simple_extent_ndims");
- /* Retrieve and verify the dataspace dimensions */
+ /* Retrieve and verify the dataspace dimensions */
rank = H5Sget_simple_extent_dims(decoded_sid1, tdims, NULL);
CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
- VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims");
/* Verify the type of dataspace selection */
sel_type = H5Sget_select_type(decoded_sid1);
@@ -1273,7 +1244,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
/* Verify the number of hyperslab blocks */
nblocks = H5Sget_select_hyper_nblocks(decoded_sid1);
- VERIFY(nblocks, 2*2*2, "H5Sget_select_hyper_nblocks");
+ VERIFY(nblocks, 2 * 2 * 2, "H5Sget_select_hyper_nblocks");
/* Close the dataspaces */
ret = H5Sclose(sid1);
@@ -1293,8 +1264,8 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
ret = H5Sencode2(sid2, NULL, &null_size, fapl);
CHECK(ret, FAIL, "H5Sencode");
- if(null_size>0) {
- null_sbuf = (unsigned char*)HDcalloc((size_t)1, null_size);
+ if (null_size > 0) {
+ null_sbuf = (unsigned char *)HDcalloc((size_t)1, null_size);
CHECK(null_sbuf, NULL, "HDcalloc");
}
@@ -1303,7 +1274,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
CHECK(ret, FAIL, "H5Sencode2");
/* Decode from the dataspace buffer and return an object handle */
- decoded_sid2=H5Sdecode(null_sbuf);
+ decoded_sid2 = H5Sdecode(null_sbuf);
CHECK(decoded_sid2, FAIL, "H5Sdecode");
/* Verify the decoded dataspace type */
@@ -1329,8 +1300,8 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
ret = H5Sencode2(sid3, NULL, &scalar_size, fapl);
CHECK(ret, FAIL, "H5Sencode");
- if(scalar_size>0) {
- scalar_buf = (unsigned char*)HDcalloc((size_t)1, scalar_size);
+ if (scalar_size > 0) {
+ scalar_buf = (unsigned char *)HDcalloc((size_t)1, scalar_size);
CHECK(scalar_buf, NULL, "HDcalloc");
}
@@ -1339,7 +1310,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
CHECK(ret, FAIL, "H5Sencode2");
/* Decode from the dataspace buffer and return an object handle */
- decoded_sid3=H5Sdecode(scalar_buf);
+ decoded_sid3 = H5Sdecode(scalar_buf);
CHECK(decoded_sid3, FAIL, "H5Sdecode");
/* Verify extent type */
@@ -1363,16 +1334,16 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
ret = H5Sclose(decoded_sid3);
CHECK(ret, FAIL, "H5Sclose");
- /* Close the file access property list */
+ /* Close the file access property list */
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
/* Release resources */
- if(sbuf)
+ if (sbuf)
HDfree(sbuf);
- if(null_sbuf)
+ if (null_sbuf)
HDfree(null_sbuf);
- if(scalar_buf)
+ if (scalar_buf)
HDfree(scalar_buf);
} /* test_h5s_encode() */
@@ -1386,23 +1357,23 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high)
static void
test_h5s_encode1(void)
{
- hid_t sid1, sid2, sid3; /* Dataspace ID */
- hid_t decoded_sid1, decoded_sid2, decoded_sid3;
- int rank; /* Logical rank of dataspace */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- size_t sbuf_size=0, null_size=0, scalar_size=0;
- unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL;
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- hsize_t start[] = {0, 0, 0};
- hsize_t stride[] = {2, 5, 3};
- hsize_t count[] = {2, 2, 2};
- hsize_t block[] = {1, 3, 1};
- H5S_sel_type sel_type;
- H5S_class_t space_type;
- hssize_t nblocks;
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t sid1, sid2, sid3; /* Dataspace ID */
+ hid_t decoded_sid1, decoded_sid2, decoded_sid3;
+ int rank; /* Logical rank of dataspace */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ size_t sbuf_size = 0, null_size = 0, scalar_size = 0;
+ unsigned char *sbuf = NULL, *null_sbuf = NULL, *scalar_buf = NULL;
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ hsize_t start[] = {0, 0, 0};
+ hsize_t stride[] = {2, 5, 3};
+ hsize_t count[] = {2, 2, 2};
+ hsize_t block[] = {1, 3, 1};
+ H5S_sel_type sel_type;
+ H5S_class_t space_type;
+ hssize_t nblocks;
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspace Encoding (H5Sencode1) and Decoding\n"));
@@ -1423,15 +1394,14 @@ test_h5s_encode1(void)
ret = H5Sencode1(sid1, NULL, &sbuf_size);
CHECK(ret, FAIL, "H5Sencode2");
- if(sbuf_size>0) {
- sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size);
+ if (sbuf_size > 0) {
+ sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size);
CHECK(sbuf, NULL, "HDcalloc");
}
/* Try decoding bogus buffer */
- H5E_BEGIN_TRY {
- ret_id = H5Sdecode(sbuf);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret_id = H5Sdecode(sbuf); }
+ H5E_END_TRY;
VERIFY(ret_id, FAIL, "H5Sdecode");
/* Encode the simple dataspace in a buffer */
@@ -1439,25 +1409,23 @@ test_h5s_encode1(void)
CHECK(ret, FAIL, "H5Sencode");
/* Decode from the dataspace buffer and return an object handle */
- decoded_sid1=H5Sdecode(sbuf);
+ decoded_sid1 = H5Sdecode(sbuf);
CHECK(decoded_sid1, FAIL, "H5Sdecode");
/* Verify the decoded dataspace */
n = H5Sget_simple_extent_npoints(decoded_sid1);
CHECK(n, FAIL, "H5Sget_simple_extent_npoints");
- VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
- "H5Sget_simple_extent_npoints");
+ VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3, "H5Sget_simple_extent_npoints");
/* Retrieve and verify the dataspace rank */
rank = H5Sget_simple_extent_ndims(decoded_sid1);
CHECK(rank, FAIL, "H5Sget_simple_extent_ndims");
VERIFY(rank, SPACE1_RANK, "H5Sget_simple_extent_ndims");
- /* Retrieve and verify the dataspace dimensions */
+ /* Retrieve and verify the dataspace dimensions */
rank = H5Sget_simple_extent_dims(decoded_sid1, tdims, NULL);
CHECK(rank, FAIL, "H5Sget_simple_extent_dims");
- VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0,
- "H5Sget_simple_extent_dims");
+ VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims");
/* Verify the type of dataspace selection */
sel_type = H5Sget_select_type(decoded_sid1);
@@ -1465,7 +1433,7 @@ test_h5s_encode1(void)
/* Verify the number of hyperslab blocks */
nblocks = H5Sget_select_hyper_nblocks(decoded_sid1);
- VERIFY(nblocks, 2*2*2, "H5Sget_select_hyper_nblocks");
+ VERIFY(nblocks, 2 * 2 * 2, "H5Sget_select_hyper_nblocks");
/* Close the dataspaces */
ret = H5Sclose(sid1);
@@ -1485,8 +1453,8 @@ test_h5s_encode1(void)
ret = H5Sencode1(sid2, NULL, &null_size);
CHECK(ret, FAIL, "H5Sencode");
- if(null_size>0) {
- null_sbuf = (unsigned char*)HDcalloc((size_t)1, null_size);
+ if (null_size > 0) {
+ null_sbuf = (unsigned char *)HDcalloc((size_t)1, null_size);
CHECK(null_sbuf, NULL, "HDcalloc");
}
@@ -1495,7 +1463,7 @@ test_h5s_encode1(void)
CHECK(ret, FAIL, "H5Sencode2");
/* Decode from the dataspace buffer and return an object handle */
- decoded_sid2=H5Sdecode(null_sbuf);
+ decoded_sid2 = H5Sdecode(null_sbuf);
CHECK(decoded_sid2, FAIL, "H5Sdecode");
/* Verify the decoded dataspace type */
@@ -1521,8 +1489,8 @@ test_h5s_encode1(void)
ret = H5Sencode1(sid3, NULL, &scalar_size);
CHECK(ret, FAIL, "H5Sencode");
- if(scalar_size>0) {
- scalar_buf = (unsigned char*)HDcalloc((size_t)1, scalar_size);
+ if (scalar_size > 0) {
+ scalar_buf = (unsigned char *)HDcalloc((size_t)1, scalar_size);
CHECK(scalar_buf, NULL, "HDcalloc");
}
@@ -1531,7 +1499,7 @@ test_h5s_encode1(void)
CHECK(ret, FAIL, "H5Sencode2");
/* Decode from the dataspace buffer and return an object handle */
- decoded_sid3=H5Sdecode(scalar_buf);
+ decoded_sid3 = H5Sdecode(scalar_buf);
CHECK(decoded_sid3, FAIL, "H5Sdecode");
/* Verify extent type */
@@ -1556,17 +1524,16 @@ test_h5s_encode1(void)
CHECK(ret, FAIL, "H5Sclose");
/* Release resources */
- if(sbuf)
+ if (sbuf)
HDfree(sbuf);
- if(null_sbuf)
+ if (null_sbuf)
HDfree(null_sbuf);
- if(scalar_buf)
+ if (scalar_buf)
HDfree(scalar_buf);
} /* test_h5s_encode1() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/****************************************************************
**
** test_h5s_check_encoding():
@@ -1582,27 +1549,27 @@ test_h5s_encode1(void)
**
****************************************************************/
static herr_t
-test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid,
- uint32_t expected_version, uint8_t expected_enc_size, hbool_t expected_to_fail)
+test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, uint32_t expected_version, uint8_t expected_enc_size,
+ hbool_t expected_to_fail)
{
- char *buf = NULL; /* Pointer to the encoded buffer */
- size_t buf_size; /* Size of the encoded buffer */
- hid_t d_sid = -1; /* The decoded dataspace ID */
- htri_t check;
- hsize_t in_low_bounds[1]; /* The low bounds for the selection for in_sid */
- hsize_t in_high_bounds[1]; /* The high bounds for the selection for in_sid */
- hsize_t d_low_bounds[1]; /* The low bounds for the selection for d_sid */
- hsize_t d_high_bounds[1]; /* The high bounds for the selection for d_sid */
- herr_t ret; /* Return value */
+ char * buf = NULL; /* Pointer to the encoded buffer */
+ size_t buf_size; /* Size of the encoded buffer */
+ hid_t d_sid = -1; /* The decoded dataspace ID */
+ htri_t check;
+ hsize_t in_low_bounds[1]; /* The low bounds for the selection for in_sid */
+ hsize_t in_high_bounds[1]; /* The high bounds for the selection for in_sid */
+ hsize_t d_low_bounds[1]; /* The low bounds for the selection for d_sid */
+ hsize_t d_high_bounds[1]; /* The high bounds for the selection for d_sid */
+ herr_t ret; /* Return value */
/* Get buffer size for encoding with the format setting in in_fapl */
- H5E_BEGIN_TRY {
- ret = H5Sencode2(in_sid, NULL, &buf_size, in_fapl);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Sencode2(in_sid, NULL, &buf_size, in_fapl); }
+ H5E_END_TRY
- if(expected_to_fail) {
+ if (expected_to_fail) {
VERIFY(ret, FAIL, "H5Screate_simple");
- } else {
+ }
+ else {
CHECK(ret, FAIL, "H5Sencode2");
@@ -1643,35 +1610,34 @@ test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid,
* --the expected encoded size (version 3 hyperslab selection info)
*/
- if(H5Sget_select_type(in_sid) == H5S_SEL_POINTS) {
+ if (H5Sget_select_type(in_sid) == H5S_SEL_POINTS) {
/* Verify the version */
VERIFY((uint32_t)buf[35], expected_version, "Version for point selection");
/* Verify the encoded size for version 2 */
- if(expected_version == 2)
+ if (expected_version == 2)
VERIFY((uint8_t)buf[39], expected_enc_size, "Encoded size of point selection info");
}
- if(H5Sget_select_type(in_sid) == H5S_SEL_HYPERSLABS) {
+ if (H5Sget_select_type(in_sid) == H5S_SEL_HYPERSLABS) {
/* Verify the version */
VERIFY((uint32_t)buf[35], expected_version, "Version for hyperslab selection info");
/* Verify the encoded size for version 3 */
- if(expected_version == 3)
+ if (expected_version == 3)
VERIFY((uint8_t)buf[40], expected_enc_size, "Encoded size of selection info");
} /* hyperslab selection */
ret = H5Sclose(d_sid);
CHECK(ret, FAIL, "H5Sclose");
- if(buf)
+ if (buf)
HDfree(buf);
-
}
- return(0);
+ return (0);
} /* test_h5s_check_encoding */
@@ -1686,18 +1652,18 @@ test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid,
static void
test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
{
- hid_t fapl = -1; /* File access property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hsize_t numparticles = 8388608; /* Used to calculate dimension size */
- unsigned num_dsets = 513; /* Used to calculate dimension size */
- hsize_t total_particles = numparticles * num_dsets;
- hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
- hsize_t start, stride, count, block; /* Selection info */
- unsigned config; /* Testing configuration */
- unsigned unlim; /* H5S_UNLIMITED setting or not */
- herr_t ret; /* Generic return value */
- uint32_t expected_version = 0; /* Expected version for selection info */
- uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t numparticles = 8388608; /* Used to calculate dimension size */
+ unsigned num_dsets = 513; /* Used to calculate dimension size */
+ hsize_t total_particles = numparticles * num_dsets;
+ hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
+ hsize_t start, stride, count, block; /* Selection info */
+ unsigned config; /* Testing configuration */
+ unsigned unlim; /* H5S_UNLIMITED setting or not */
+ herr_t ret; /* Generic return value */
+ uint32_t expected_version = 0; /* Expected version for selection info */
+ uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspace encoding of regular hyperslabs\n"));
@@ -1715,35 +1681,34 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
CHECK(sid, FAIL, "H5Screate_simple");
/* Testing with each configuration */
- for(config = CONFIG_16; config <= CONFIG_32; config++) {
+ for (config = CONFIG_16; config <= CONFIG_32; config++) {
hbool_t expected_to_fail = FALSE;
/* Testing with unlimited or not */
- for(unlim = 0; unlim <= 1; unlim++) {
+ for (unlim = 0; unlim <= 1; unlim++) {
start = 0;
- count = unlim? H5S_UNLIMITED : 2;
+ count = unlim ? H5S_UNLIMITED : 2;
- if((high <= H5F_LIBVER_V18) &&
- (unlim || config == CONFIG_32))
+ if ((high <= H5F_LIBVER_V18) && (unlim || config == CONFIG_32))
expected_to_fail = TRUE;
- if(low >= H5F_LIBVER_V112)
+ if (low >= H5F_LIBVER_V112)
expected_version = 3;
- else if(config == CONFIG_16 && !unlim)
+ else if (config == CONFIG_16 && !unlim)
expected_version = 1;
else
expected_version = 2;
/* test 1 */
- switch(config) {
+ switch (config) {
case CONFIG_16:
- stride = POWER16 - 1;
- block = 4;
+ stride = POWER16 - 1;
+ block = 4;
expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4);
break;
case CONFIG_32:
- stride = POWER32 - 1;
- block = 4;
+ stride = POWER32 - 1;
+ block = 4;
expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8);
break;
@@ -1761,15 +1726,15 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
CHECK(ret, FAIL, "test_h5s_check_encoding");
/* test 2 */
- switch(config) {
+ switch (config) {
case CONFIG_16:
- stride = POWER16 - 1;
- block = POWER16 - 2;
+ stride = POWER16 - 1;
+ block = POWER16 - 2;
expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4);
break;
case CONFIG_32:
- stride = POWER32 - 1;
- block = POWER32 - 2;
+ stride = POWER32 - 1;
+ block = POWER32 - 2;
expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8);
break;
default:
@@ -1786,15 +1751,15 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
CHECK(ret, FAIL, "test_h5s_check_encoding");
/* test 3 */
- switch(config) {
+ switch (config) {
case CONFIG_16:
- stride = POWER16 - 1;
- block = POWER16 - 1;
+ stride = POWER16 - 1;
+ block = POWER16 - 1;
expected_enc_size = 4;
break;
case CONFIG_32:
- stride = POWER32 - 1;
- block = POWER32 - 1;
+ stride = POWER32 - 1;
+ block = POWER32 - 1;
expected_enc_size = 8;
break;
default:
@@ -1811,15 +1776,15 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
CHECK(ret, FAIL, "test_h5s_check_encoding");
/* test 4 */
- switch(config) {
+ switch (config) {
case CONFIG_16:
- stride = POWER16;
- block = POWER16 - 2;
+ stride = POWER16;
+ block = POWER16 - 2;
expected_enc_size = 4;
break;
case CONFIG_32:
- stride = POWER32;
- block = POWER32 - 2;
+ stride = POWER32;
+ block = POWER32 - 2;
expected_enc_size = 8;
break;
default:
@@ -1836,15 +1801,15 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
CHECK(ret, FAIL, "test_h5s_check_encoding");
/* test 5 */
- switch(config) {
+ switch (config) {
case CONFIG_16:
- stride = POWER16;
- block = 1;
+ stride = POWER16;
+ block = 1;
expected_enc_size = 4;
break;
case CONFIG_32:
- stride = POWER32;
- block = 1;
+ stride = POWER32;
+ block = 1;
expected_enc_size = 8;
break;
default:
@@ -1861,7 +1826,7 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
CHECK(ret, FAIL, "test_h5s_check_encoding");
} /* for unlim */
- } /* for config */
+ } /* for config */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -1882,16 +1847,16 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
static void
test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
{
- hid_t fapl = -1; /* File access property list ID */
- hid_t sid; /* Dataspace ID */
- hsize_t numparticles = 8388608; /* Used to calculate dimension size */
- unsigned num_dsets = 513; /* Used to calculate dimension size */
- hsize_t total_particles = numparticles * num_dsets;
- hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
- hsize_t start, stride, count, block; /* Selection info */
- htri_t is_regular; /* Is this a regular hyperslab */
- unsigned config; /* Testing configuration */
- herr_t ret; /* Generic return value */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t sid; /* Dataspace ID */
+ hsize_t numparticles = 8388608; /* Used to calculate dimension size */
+ unsigned num_dsets = 513; /* Used to calculate dimension size */
+ hsize_t total_particles = numparticles * num_dsets;
+ hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
+ hsize_t start, stride, count, block; /* Selection info */
+ htri_t is_regular; /* Is this a regular hyperslab */
+ unsigned config; /* Testing configuration */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspace encoding of irregular hyperslabs\n"));
@@ -1909,9 +1874,9 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
CHECK(sid, FAIL, "H5Screate_simple");
/* Testing with each configuration */
- for(config = CONFIG_8; config <= CONFIG_32; config++) {
- hbool_t expected_to_fail = FALSE; /* Whether H5Sencode2 is expected to fail */
- uint32_t expected_version = 0; /* Expected version for selection info */
+ for (config = CONFIG_8; config <= CONFIG_32; config++) {
+ hbool_t expected_to_fail = FALSE; /* Whether H5Sencode2 is expected to fail */
+ uint32_t expected_version = 0; /* Expected version for selection info */
uint32_t expected_enc_size = 0; /* Expected encoded size for selection info */
start = 0;
@@ -1920,15 +1885,15 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
/* H5Sencode2 is expected to fail for library v110 and below
when the selection exceeds the 32 bits integer limit */
- if(high <= H5F_LIBVER_V110 && config == CONFIG_32)
+ if (high <= H5F_LIBVER_V110 && config == CONFIG_32)
expected_to_fail = TRUE;
- if(low >= H5F_LIBVER_V112 || config == CONFIG_32)
+ if (low >= H5F_LIBVER_V112 || config == CONFIG_32)
expected_version = 3;
else
expected_version = 1;
- switch(config) {
+ switch (config) {
case CONFIG_8:
stride = POWER8 - 2;
break;
@@ -1954,19 +1919,19 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
count = 5;
block = 2;
- switch(config) {
+ switch (config) {
case CONFIG_8:
- stride = POWER8;
+ stride = POWER8;
expected_enc_size = expected_version == 3 ? 2 : 4;
break;
case CONFIG_16:
- stride = POWER16;
+ stride = POWER16;
expected_enc_size = 4;
break;
case CONFIG_32:
- stride = POWER32;
+ stride = POWER32;
expected_enc_size = 8;
break;
@@ -1985,7 +1950,8 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
/* Verify the version and encoded size expected for the configuration */
HDassert(expected_enc_size <= 255);
- ret = test_h5s_check_encoding(fapl, sid, expected_version, (uint8_t)expected_enc_size, expected_to_fail);
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, (uint8_t)expected_enc_size,
+ expected_to_fail);
CHECK(ret, FAIL, "test_h5s_check_encoding");
} /* for config */
@@ -2006,17 +1972,17 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
static void
test_h5s_encode_points(H5F_libver_t low, H5F_libver_t high)
{
- hid_t fapl = -1; /* File access property list ID */
- hid_t sid; /* Dataspace ID */
- hsize_t numparticles = 8388608; /* Used to calculate dimenion size */
- unsigned num_dsets = 513; /* used to calculate dimension size */
- hsize_t total_particles = numparticles * num_dsets;
- hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
- hsize_t coord[4]; /* The point coordinates */
- herr_t ret; /* Generic return value */
- hbool_t expected_to_fail = FALSE; /* Expected to fail or not */
- uint32_t expected_version = 0; /* Expected version for selection info */
- uint8_t expected_enc_size = 0; /* Expected encoded size of selection info */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t sid; /* Dataspace ID */
+ hsize_t numparticles = 8388608; /* Used to calculate dimenion size */
+ unsigned num_dsets = 513; /* used to calculate dimension size */
+ hsize_t total_particles = numparticles * num_dsets;
+ hsize_t vdsdims[1] = {total_particles}; /* Dimension size */
+ hsize_t coord[4]; /* The point coordinates */
+ herr_t ret; /* Generic return value */
+ hbool_t expected_to_fail = FALSE; /* Expected to fail or not */
+ uint32_t expected_version = 0; /* Expected version for selection info */
+ uint8_t expected_enc_size = 0; /* Expected encoded size of selection info */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspace encoding of points selection\n"));
@@ -2038,14 +2004,14 @@ test_h5s_encode_points(H5F_libver_t low, H5F_libver_t high)
coord[1] = 15;
coord[2] = POWER16;
coord[3] = 19;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
CHECK(ret, FAIL, "H5Sselect_elements");
- expected_to_fail = FALSE;
+ expected_to_fail = FALSE;
expected_enc_size = 4;
- expected_version = 1;
+ expected_version = 1;
- if(low >= H5F_LIBVER_V112)
+ if (low >= H5F_LIBVER_V112)
expected_version = 2;
/* Verify the version and encoded size expected for the configuration */
@@ -2057,7 +2023,7 @@ test_h5s_encode_points(H5F_libver_t low, H5F_libver_t high)
coord[1] = 15;
coord[2] = POWER32 - 1;
coord[3] = 19;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Expected result same as test 1 */
@@ -2065,11 +2031,11 @@ test_h5s_encode_points(H5F_libver_t low, H5F_libver_t high)
CHECK(ret, FAIL, "test_h5s_check_encoding");
/* test 3 */
- if(high <= H5F_LIBVER_V110)
+ if (high <= H5F_LIBVER_V110)
expected_to_fail = TRUE;
- if(high >= H5F_LIBVER_V112) {
- expected_version = 2;
+ if (high >= H5F_LIBVER_V112) {
+ expected_version = 2;
expected_enc_size = 8;
}
@@ -2077,7 +2043,7 @@ test_h5s_encode_points(H5F_libver_t low, H5F_libver_t high)
coord[1] = 15;
coord[2] = POWER32 + 1;
coord[3] = 19;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)4, coord);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify the version and encoded size expected for the configuration */
@@ -2103,13 +2069,13 @@ test_h5s_encode_points(H5F_libver_t low, H5F_libver_t high)
static void
test_h5s_encode_length(void)
{
- hid_t sid; /* Dataspace ID */
- hid_t decoded_sid; /* Dataspace ID from H5Sdecode2 */
- size_t sbuf_size=0; /* Buffer size for H5Sencode2/1 */
- unsigned char *sbuf=NULL; /* Buffer for H5Sencode2/1 */
- hsize_t dims[1] = {500}; /* Dimension size */
- hsize_t start, count, block, stride; /* Hyperslab selection specifications */
- herr_t ret; /* Generic return value */
+ hid_t sid; /* Dataspace ID */
+ hid_t decoded_sid; /* Dataspace ID from H5Sdecode2 */
+ size_t sbuf_size = 0; /* Buffer size for H5Sencode2/1 */
+ unsigned char *sbuf = NULL; /* Buffer for H5Sencode2/1 */
+ hsize_t dims[1] = {500}; /* Dimension size */
+ hsize_t start, count, block, stride; /* Hyperslab selection specifications */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Version 2 Hyperslab Encoding Length is correct\n"));
@@ -2119,10 +2085,10 @@ test_h5s_encode_length(void)
CHECK(sid, FAIL, "H5Screate_simple");
/* Setting H5S_UNLIMITED in count will use version 2 for hyperslab encoding */
- start = 0;
+ start = 0;
stride = 10;
- block = 4;
- count = H5S_UNLIMITED;
+ block = 4;
+ count = H5S_UNLIMITED;
/* Set hyperslab selection */
ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block);
@@ -2133,8 +2099,8 @@ test_h5s_encode_length(void)
CHECK(ret, FAIL, "H5Sencode");
/* Allocate the buffer */
- if(sbuf_size > 0) {
- sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size);
+ if (sbuf_size > 0) {
+ sbuf = (unsigned char *)HDcalloc((size_t)1, sbuf_size);
CHECK(sbuf, NULL, "H5Sencode2");
}
@@ -2158,7 +2124,7 @@ test_h5s_encode_length(void)
CHECK(ret, FAIL, "H5Sclose");
/* Free the buffer */
- if(sbuf)
+ if (sbuf)
HDfree(sbuf);
/* Close the original dataspace */
@@ -2175,14 +2141,14 @@ test_h5s_encode_length(void)
static void
test_h5s_scalar_write(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- int rank; /* Logical rank of dataspace */
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- H5S_class_t ext_type; /* Extent type */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ int rank; /* Logical rank of dataspace */
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ H5S_class_t ext_type; /* Extent type */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Scalar Dataspace Manipulation during Writing\n"));
@@ -2192,9 +2158,8 @@ test_h5s_scalar_write(void)
CHECK(fid1, FAIL, "H5Fcreate");
/* Verify a non-zero rank fails with a NULL dimension. */
- H5E_BEGIN_TRY {
- sid1 = H5Screate_simple(SPACE1_RANK, NULL, NULL);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { sid1 = H5Screate_simple(SPACE1_RANK, NULL, NULL); }
+ H5E_END_TRY
VERIFY(sid1, FAIL, "H5Screate_simple");
/* Create scalar dataspace */
@@ -2238,7 +2203,7 @@ test_h5s_scalar_write(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5s_scalar_write() */
+} /* test_h5s_scalar_write() */
/****************************************************************
**
@@ -2248,15 +2213,15 @@ test_h5s_scalar_write(void)
static void
test_h5s_scalar_read(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- int rank; /* Logical rank of dataspace */
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- unsigned rdata; /* Scalar data read in */
- herr_t ret; /* Generic return value */
- H5S_class_t ext_type; /* Extent type */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ int rank; /* Logical rank of dataspace */
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ unsigned rdata; /* Scalar data read in */
+ herr_t ret; /* Generic return value */
+ H5S_class_t ext_type; /* Extent type */
/* Output message about test being performed */
MESSAGE(5, ("Testing Scalar Dataspace Manipulation during Reading\n"));
@@ -2302,7 +2267,7 @@ test_h5s_scalar_read(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5s_scalar_read() */
+} /* test_h5s_scalar_read() */
/****************************************************************
**
@@ -2313,14 +2278,14 @@ test_h5s_scalar_read(void)
static void
test_h5s_compound_scalar_write(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t tid1; /* Attribute datatype ID */
- hid_t sid1; /* Dataspace ID */
- int rank; /* Logical rank of dataspace */
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t tid1; /* Attribute datatype ID */
+ hid_t sid1; /* Dataspace ID */
+ int rank; /* Logical rank of dataspace */
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Scalar Dataspace Manipulation for Writing Compound Datatypes\n"));
@@ -2330,23 +2295,19 @@ test_h5s_compound_scalar_write(void)
CHECK(fid1, FAIL, "H5Fcreate");
/* Create the compound datatype. */
- tid1 = H5Tcreate (H5T_COMPOUND, sizeof(struct space4_struct));
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(struct space4_struct));
CHECK(tid1, FAIL, "H5Tcreate");
- space4_field1_off=HOFFSET(struct space4_struct, c1);
- ret = H5Tinsert(tid1, SPACE4_FIELDNAME1, space4_field1_off,
- H5T_NATIVE_SCHAR);
+ space4_field1_off = HOFFSET(struct space4_struct, c1);
+ ret = H5Tinsert(tid1, SPACE4_FIELDNAME1, space4_field1_off, H5T_NATIVE_SCHAR);
CHECK(ret, FAIL, "H5Tinsert");
- space4_field2_off=HOFFSET(struct space4_struct, u);
- ret = H5Tinsert(tid1, SPACE4_FIELDNAME2, space4_field2_off,
- H5T_NATIVE_UINT);
+ space4_field2_off = HOFFSET(struct space4_struct, u);
+ ret = H5Tinsert(tid1, SPACE4_FIELDNAME2, space4_field2_off, H5T_NATIVE_UINT);
CHECK(ret, FAIL, "H5Tinsert");
- space4_field3_off=HOFFSET(struct space4_struct, f);
- ret = H5Tinsert(tid1, SPACE4_FIELDNAME3, space4_field3_off,
- H5T_NATIVE_FLOAT);
+ space4_field3_off = HOFFSET(struct space4_struct, f);
+ ret = H5Tinsert(tid1, SPACE4_FIELDNAME3, space4_field3_off, H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
- space4_field4_off=HOFFSET(struct space4_struct, c2);
- ret = H5Tinsert(tid1, SPACE4_FIELDNAME4, space4_field4_off,
- H5T_NATIVE_SCHAR);
+ space4_field4_off = HOFFSET(struct space4_struct, c2);
+ ret = H5Tinsert(tid1, SPACE4_FIELDNAME4, space4_field4_off, H5T_NATIVE_SCHAR);
CHECK(ret, FAIL, "H5Tinsert");
/* Create scalar dataspace */
@@ -2386,7 +2347,7 @@ test_h5s_compound_scalar_write(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5s_compound_scalar_write() */
+} /* test_h5s_compound_scalar_write() */
/****************************************************************
**
@@ -2397,15 +2358,15 @@ test_h5s_compound_scalar_write(void)
static void
test_h5s_compound_scalar_read(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t type; /* Datatype */
- int rank; /* Logical rank of dataspace */
- hsize_t tdims[4]; /* Dimension array to test with */
- hssize_t n; /* Number of dataspace elements */
- struct space4_struct rdata; /* Scalar data read in */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t type; /* Datatype */
+ int rank; /* Logical rank of dataspace */
+ hsize_t tdims[4]; /* Dimension array to test with */
+ hssize_t n; /* Number of dataspace elements */
+ struct space4_struct rdata; /* Scalar data read in */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Scalar Dataspace Manipulation for Reading Compound Datatypes\n"));
@@ -2432,17 +2393,19 @@ test_h5s_compound_scalar_read(void)
rank = H5Sget_simple_extent_dims(sid1, tdims, NULL);
VERIFY(rank, 0, "H5Sget_simple_extent_dims");
- type=H5Dget_type(dataset);
+ type = H5Dget_type(dataset);
CHECK(type, FAIL, "H5Dget_type");
ret = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct))) {
- HDprintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c1);
- HDprintf("scalar data different: space4_data.u=%u, read_data4.u=%u\n",space4_data.u,rdata.u);
- HDprintf("scalar data different: space4_data.f=%f, read_data4.f=%f\n",(double)space4_data.f,(double)rdata.f);
- TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c2);
- } /* end if */
+ if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct))) {
+ HDprintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n", space4_data.c1, rdata.c1);
+ HDprintf("scalar data different: space4_data.u=%u, read_data4.u=%u\n", space4_data.u, rdata.u);
+ HDprintf("scalar data different: space4_data.f=%f, read_data4.f=%f\n", (double)space4_data.f,
+ (double)rdata.f);
+ TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n", space4_data.c1,
+ rdata.c2);
+ } /* end if */
/* Close datatype */
ret = H5Tclose(type);
@@ -2459,12 +2422,11 @@ test_h5s_compound_scalar_read(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* end test_h5s_compound_scalar_read() */
-
+} /* end test_h5s_compound_scalar_read() */
/* Data array sizes for chunk test */
-#define CHUNK_DATA_NX 50000
-#define CHUNK_DATA_NY 3
+#define CHUNK_DATA_NX 50000
+#define CHUNK_DATA_NY 3
/****************************************************************
**
@@ -2476,17 +2438,17 @@ test_h5s_compound_scalar_read(void)
static void
test_h5s_chunk(void)
{
- herr_t status;
- hid_t fileID, dsetID;
- hid_t plist_id;
- hid_t space_id;
- hsize_t dims[2];
- hsize_t csize[2];
- double **chunk_data_dbl = NULL;
- double *chunk_data_dbl_data = NULL;
- float **chunk_data_flt = NULL;
- float *chunk_data_flt_data = NULL;
- int i,j;
+ herr_t status;
+ hid_t fileID, dsetID;
+ hid_t plist_id;
+ hid_t space_id;
+ hsize_t dims[2];
+ hsize_t csize[2];
+ double **chunk_data_dbl = NULL;
+ double * chunk_data_dbl_data = NULL;
+ float ** chunk_data_flt = NULL;
+ float * chunk_data_flt_data = NULL;
+ int i, j;
/* Allocate memory */
chunk_data_dbl_data = (double *)HDcalloc(CHUNK_DATA_NX * CHUNK_DATA_NY, sizeof(double));
@@ -2511,12 +2473,12 @@ test_h5s_chunk(void)
csize[0] = CHUNK_DATA_NX;
csize[1] = CHUNK_DATA_NY;
- status = H5Pset_chunk(plist_id, 2, csize);
+ status = H5Pset_chunk(plist_id, 2, csize);
CHECK(status, FAIL, "H5Pset_chunk");
/* Create the dataspace */
- dims[0] = CHUNK_DATA_NX;
- dims[1] = CHUNK_DATA_NY;
+ dims[0] = CHUNK_DATA_NX;
+ dims[1] = CHUNK_DATA_NY;
space_id = H5Screate_simple(2, dims, NULL);
CHECK(space_id, FAIL, "H5Screate_simple");
@@ -2524,8 +2486,8 @@ test_h5s_chunk(void)
CHECK(dsetID, FAIL, "H5Dcreate2");
/* Initialize float array */
- for(i = 0; i < CHUNK_DATA_NX; i++)
- for(j = 0; j < CHUNK_DATA_NY; j++)
+ for (i = 0; i < CHUNK_DATA_NX; i++)
+ for (j = 0; j < CHUNK_DATA_NY; j++)
chunk_data_flt[i][j] = (float)(i + 1) * 2.5F - (float)j * 100.3F;
status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data);
@@ -2549,9 +2511,9 @@ test_h5s_chunk(void)
dsetID = H5Dopen2(fileID, "coords", H5P_DEFAULT);
CHECK(dsetID, FAIL, "H5Dopen2");
- status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl_data);
+ status = H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl_data);
CHECK(status, FAIL, "H5Dread");
- status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data);
+ status = H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data);
CHECK(status, FAIL, "H5Dread");
status = H5Dclose(dsetID);
@@ -2559,13 +2521,15 @@ test_h5s_chunk(void)
status = H5Fclose(fileID);
CHECK(status, FAIL, "H5Fclose");
- for(i = 0; i < CHUNK_DATA_NX; i++) {
- for(j = 0; j < CHUNK_DATA_NY; j++) {
+ for (i = 0; i < CHUNK_DATA_NX; i++) {
+ for (j = 0; j < CHUNK_DATA_NY; j++) {
/* Check if the two values are within 0.001% range. */
- if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F))
- TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]);
+ if (!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F))
+ TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n",
+ (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j,
+ (double)chunk_data_flt[i][j]);
} /* end for */
- } /* end for */
+ } /* end for */
HDfree(chunk_data_dbl);
HDfree(chunk_data_dbl_data);
@@ -2581,22 +2545,19 @@ test_h5s_chunk(void)
static void
test_h5s_extent_equal(void)
{
- hid_t null_space; /* Null dataspace */
- hid_t scalar_space; /* Scalar dataspace */
- hid_t d1_space1, d1_space2, d1_space3, d1_space4; /* 1-D dataspaces */
- hid_t d2_space1, d2_space2, d2_space3, d2_space4; /* 2-D dataspaces */
- hid_t d3_space1, d3_space2, d3_space3, d3_space4; /* 3-D dataspaces */
- hsize_t d1_dims1[1] = {10}, /* 1-D dimensions */
- d1_dims2[1] = {20},
- d1_dims3[1] = {H5S_UNLIMITED};
- hsize_t d2_dims1[2] = {10, 10}, /* 2-D dimensions */
- d2_dims2[2] = {20, 20},
- d2_dims3[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t d3_dims1[3] = {10, 10, 10}, /* 3-D dimensions */
- d3_dims2[3] = {20, 20, 20},
- d3_dims3[3] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED};
- htri_t ext_equal; /* Whether two dataspace extents are equal */
- herr_t ret; /* Generic error return */
+ hid_t null_space; /* Null dataspace */
+ hid_t scalar_space; /* Scalar dataspace */
+ hid_t d1_space1, d1_space2, d1_space3, d1_space4; /* 1-D dataspaces */
+ hid_t d2_space1, d2_space2, d2_space3, d2_space4; /* 2-D dataspaces */
+ hid_t d3_space1, d3_space2, d3_space3, d3_space4; /* 3-D dataspaces */
+ hsize_t d1_dims1[1] = {10}, /* 1-D dimensions */
+ d1_dims2[1] = {20}, d1_dims3[1] = {H5S_UNLIMITED};
+ hsize_t d2_dims1[2] = {10, 10}, /* 2-D dimensions */
+ d2_dims2[2] = {20, 20}, d2_dims3[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t d3_dims1[3] = {10, 10, 10}, /* 3-D dimensions */
+ d3_dims2[3] = {20, 20, 20}, d3_dims3[3] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED};
+ htri_t ext_equal; /* Whether two dataspace extents are equal */
+ herr_t ret; /* Generic error return */
/* Create dataspaces */
null_space = H5Screate(H5S_NULL);
@@ -3098,22 +3059,19 @@ static void
test_h5s_extent_copy(void)
{
hid_t spaces[14] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; /* Array of all dataspaces */
- hid_t tmp_space = -1;
+ hid_t tmp_space = -1;
hsize_t d1_dims1[1] = {10}, /* 1-D dimensions */
- d1_dims2[1] = {20},
- d1_dims3[1] = {H5S_UNLIMITED};
- hsize_t d2_dims1[2] = {10, 10}, /* 2-D dimensions */
- d2_dims2[2] = {20, 20},
- d2_dims3[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t d3_dims1[3] = {10, 10, 10}, /* 3-D dimensions */
- d3_dims2[3] = {20, 20, 20},
- d3_dims3[3] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t npoints[14]; /* Expected number of points in selection for each element in spaces */
- hssize_t npoints_ret; /* Number of points returned by H5Sget_select_npoints() */
- htri_t ext_equal; /* Whether two dataspace extents are equal */
+ d1_dims2[1] = {20}, d1_dims3[1] = {H5S_UNLIMITED};
+ hsize_t d2_dims1[2] = {10, 10}, /* 2-D dimensions */
+ d2_dims2[2] = {20, 20}, d2_dims3[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t d3_dims1[3] = {10, 10, 10}, /* 3-D dimensions */
+ d3_dims2[3] = {20, 20, 20}, d3_dims3[3] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t npoints[14]; /* Expected number of points in selection for each element in spaces */
+ hssize_t npoints_ret; /* Number of points returned by H5Sget_select_npoints() */
+ htri_t ext_equal; /* Whether two dataspace extents are equal */
const unsigned num_spaces = sizeof(spaces) / sizeof(spaces[0]);
- unsigned i, j;
- herr_t ret; /* Generic error return */
+ unsigned i, j;
+ herr_t ret; /* Generic error return */
/* Create dataspaces */
spaces[0] = H5Screate(H5S_NULL);
@@ -3127,39 +3085,39 @@ test_h5s_extent_copy(void)
spaces[2] = H5Screate_simple(1, d1_dims1, NULL);
CHECK(spaces[2], FAIL, "H5Screate");
npoints[2] = d1_dims1[0];
- spaces[3] = H5Screate_simple(1, d1_dims2, NULL);
+ spaces[3] = H5Screate_simple(1, d1_dims2, NULL);
CHECK(spaces[3], FAIL, "H5Screate");
npoints[3] = d1_dims2[0];
- spaces[4] = H5Screate_simple(1, d1_dims1, d1_dims2);
+ spaces[4] = H5Screate_simple(1, d1_dims1, d1_dims2);
CHECK(spaces[4], FAIL, "H5Screate");
npoints[4] = d1_dims1[0];
- spaces[5] = H5Screate_simple(1, d1_dims1, d1_dims3);
+ spaces[5] = H5Screate_simple(1, d1_dims1, d1_dims3);
CHECK(spaces[5], FAIL, "H5Screate");
npoints[5] = d1_dims1[0];
spaces[6] = H5Screate_simple(2, d2_dims1, NULL);
CHECK(spaces[6], FAIL, "H5Screate");
npoints[6] = d2_dims1[0] * d2_dims1[1];
- spaces[7] = H5Screate_simple(2, d2_dims2, NULL);
+ spaces[7] = H5Screate_simple(2, d2_dims2, NULL);
CHECK(spaces[7], FAIL, "H5Screate");
npoints[7] = d2_dims2[0] * d2_dims2[1];
- spaces[8] = H5Screate_simple(2, d2_dims1, d2_dims2);
+ spaces[8] = H5Screate_simple(2, d2_dims1, d2_dims2);
CHECK(spaces[8], FAIL, "H5Screate");
npoints[8] = d2_dims1[0] * d2_dims1[1];
- spaces[9] = H5Screate_simple(2, d2_dims1, d2_dims3);
+ spaces[9] = H5Screate_simple(2, d2_dims1, d2_dims3);
CHECK(spaces[9], FAIL, "H5Screate");
npoints[9] = d2_dims1[0] * d2_dims1[1];
spaces[10] = H5Screate_simple(3, d3_dims1, NULL);
CHECK(spaces[10], FAIL, "H5Screate");
npoints[10] = d3_dims1[0] * d3_dims1[1] * d3_dims1[2];
- spaces[11] = H5Screate_simple(3, d3_dims2, NULL);
+ spaces[11] = H5Screate_simple(3, d3_dims2, NULL);
CHECK(spaces[11], FAIL, "H5Screate");
npoints[11] = d3_dims2[0] * d3_dims2[1] * d3_dims2[2];
- spaces[12] = H5Screate_simple(3, d3_dims1, d3_dims2);
+ spaces[12] = H5Screate_simple(3, d3_dims1, d3_dims2);
CHECK(spaces[12], FAIL, "H5Screate");
npoints[12] = d3_dims1[0] * d3_dims1[1] * d3_dims1[2];
- spaces[13] = H5Screate_simple(3, d3_dims1, d3_dims3);
+ spaces[13] = H5Screate_simple(3, d3_dims1, d3_dims3);
CHECK(spaces[13], FAIL, "H5Screate");
npoints[13] = d3_dims1[0] * d3_dims1[1] * d3_dims1[2];
@@ -3168,8 +3126,8 @@ test_h5s_extent_copy(void)
/* Copy between all dataspace combinations. Note there are a few
* duplicates. */
- for(i = 0; i < num_spaces; i++)
- for(j = i; j < num_spaces; j++) {
+ for (i = 0; i < num_spaces; i++)
+ for (j = i; j < num_spaces; j++) {
/* Copy from i to j, unless the inner loop just restarted, in which
* case i and j are the same, so the second call to H5Sextent_copy()
* will test copying from i/j to i/j */
@@ -3198,7 +3156,7 @@ test_h5s_extent_copy(void)
} /* end for */
/* Close dataspaces */
- for(i = 0; i < num_spaces; i++) {
+ for (i = 0; i < num_spaces; i++) {
ret = H5Sclose(spaces[i]);
CHECK(ret, FAIL, "H5Sclose");
spaces[i] = -1;
@@ -3217,12 +3175,12 @@ test_h5s_extent_copy(void)
static void
test_h5s_bug1(void)
{
- hid_t space1; /* Dataspace to copy extent to */
- hid_t space2; /* Scalar dataspace */
- hsize_t dims[2] = {10, 10}; /* Dimensions */
- hsize_t start[2] = {0, 0}; /* Hyperslab start */
- htri_t select_valid; /* Whether the dataspace selection is valid */
- herr_t ret; /* Generic error return */
+ hid_t space1; /* Dataspace to copy extent to */
+ hid_t space2; /* Scalar dataspace */
+ hsize_t dims[2] = {10, 10}; /* Dimensions */
+ hsize_t start[2] = {0, 0}; /* Hyperslab start */
+ htri_t select_valid; /* Whether the dataspace selection is valid */
+ herr_t ret; /* Generic error return */
/* Create dataspaces */
space1 = H5Screate(H5S_SIMPLE);
@@ -3250,7 +3208,6 @@ test_h5s_bug1(void)
CHECK(ret, FAIL, "H5Sclose");
} /* test_h5s_bug1() */
-
/*-------------------------------------------------------------------------
* Function: test_versionbounds
*
@@ -3266,21 +3223,21 @@ test_h5s_bug1(void)
*
*-------------------------------------------------------------------------
*/
-#define VERBFNAME "tverbounds_dspace.h5"
-#define BASIC_DSET "Basic Dataset"
-#define LATEST_DSET "Latest Dataset"
+#define VERBFNAME "tverbounds_dspace.h5"
+#define BASIC_DSET "Basic Dataset"
+#define LATEST_DSET "Latest Dataset"
static void
test_versionbounds(void)
{
- hid_t file = -1; /* File ID */
- hid_t space = -1; /* Dataspace ID */
- hid_t dset = -1; /* Dataset ID */
- hid_t fapl = -1; /* File access property list ID */
- hid_t dset_space = -1; /* Retrieved dataset's dataspace ID */
- hsize_t dim[1]; /* Dataset dimensions */
- H5F_libver_t low, high; /* File format bounds */
- H5S_t *spacep = NULL; /* Pointer to internal dataspace */
- herr_t ret = 0; /* Generic return value */
+ hid_t file = -1; /* File ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t dset_space = -1; /* Retrieved dataset's dataspace ID */
+ hsize_t dim[1]; /* Dataset dimensions */
+ H5F_libver_t low, high; /* File format bounds */
+ H5S_t * spacep = NULL; /* Pointer to internal dataspace */
+ herr_t ret = 0; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Version Bounds\n"));
@@ -3291,7 +3248,7 @@ test_versionbounds(void)
/* Create dataspace */
dim[0] = 10;
- space = H5Screate_simple(1, dim, NULL);
+ space = H5Screate_simple(1, dim, NULL);
CHECK(space, FAIL, "H5Screate");
/* Its version should be H5O_SDSPACE_VERSION_1 */
@@ -3300,9 +3257,9 @@ test_versionbounds(void)
VERIFY(spacep->extent.version, H5O_SDSPACE_VERSION_1, "basic dataspace version bound");
/* Set high bound to V18 */
- low = H5F_LIBVER_EARLIEST;
+ low = H5F_LIBVER_EARLIEST;
high = H5F_LIBVER_V18;
- ret = H5Pset_libver_bounds(fapl, low, high);
+ ret = H5Pset_libver_bounds(fapl, low, high);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
/* Create the file */
@@ -3335,9 +3292,9 @@ test_versionbounds(void)
/* Set low and high bounds to latest to trigger the increment of the
dataspace version */
- low = H5F_LIBVER_LATEST;
+ low = H5F_LIBVER_LATEST;
high = H5F_LIBVER_LATEST;
- ret = H5Pset_libver_bounds(fapl, low, high);
+ ret = H5Pset_libver_bounds(fapl, low, high);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
/* Reopen the file with new version bounds, LATEST/LATEST */
@@ -3373,7 +3330,6 @@ test_versionbounds(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_versionbounds() */
-
/****************************************************************
**
** test_h5s(): Main H5S (dataspace) testing routine.
@@ -3382,21 +3338,21 @@ test_versionbounds(void)
void
test_h5s(void)
{
- H5F_libver_t low, high; /* Low and high bounds */
+ H5F_libver_t low, high; /* Low and high bounds */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataspaces\n"));
- test_h5s_basic(); /* Test basic H5S code */
- test_h5s_null(); /* Test Null dataspace H5S code */
- test_h5s_zero_dim(); /* Test dataspace with zero dimension size */
+ test_h5s_basic(); /* Test basic H5S code */
+ test_h5s_null(); /* Test Null dataspace H5S code */
+ test_h5s_zero_dim(); /* Test dataspace with zero dimension size */
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Invalid combinations, just continue */
- if(high == H5F_LIBVER_EARLIEST || high < low)
+ if (high == H5F_LIBVER_EARLIEST || high < low)
continue;
test_h5s_encode(low, high); /* Test encoding and decoding */
@@ -3405,29 +3361,28 @@ test_h5s(void)
test_h5s_encode_points(low, high); /* Test encoding points */
} /* end high bound */
- } /* end low bound */
+ } /* end low bound */
- test_h5s_encode_length(); /* Test version 2 hyperslab encoding length is correct */
+ test_h5s_encode_length(); /* Test version 2 hyperslab encoding length is correct */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_h5s_encode1(); /* Test operations with old API routine (H5Sencode1) */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ test_h5s_encode1(); /* Test operations with old API routine (H5Sencode1) */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
- test_h5s_scalar_write(); /* Test scalar H5S writing code */
- test_h5s_scalar_read(); /* Test scalar H5S reading code */
+ test_h5s_scalar_write(); /* Test scalar H5S writing code */
+ test_h5s_scalar_read(); /* Test scalar H5S reading code */
- test_h5s_compound_scalar_write(); /* Test compound datatype scalar H5S writing code */
- test_h5s_compound_scalar_read(); /* Test compound datatype scalar H5S reading code */
+ test_h5s_compound_scalar_write(); /* Test compound datatype scalar H5S writing code */
+ test_h5s_compound_scalar_read(); /* Test compound datatype scalar H5S reading code */
/* This test was added later to exercise a bug in chunked I/O */
- test_h5s_chunk(); /* Exercise bug fix for chunked I/O */
+ test_h5s_chunk(); /* Exercise bug fix for chunked I/O */
- test_h5s_extent_equal(); /* Test extent comparison code */
- test_h5s_extent_copy(); /* Test extent copy code */
- test_h5s_bug1(); /* Test bug in offset initialization */
- test_versionbounds(); /* Test version bounds with dataspace */
+ test_h5s_extent_equal(); /* Test extent comparison code */
+ test_h5s_extent_copy(); /* Test extent copy code */
+ test_h5s_bug1(); /* Test bug in offset initialization */
+ test_versionbounds(); /* Test version bounds with dataspace */
} /* test_h5s() */
-
/*-------------------------------------------------------------------------
* Function: cleanup_h5s
*
diff --git a/test/theap.c b/test/theap.c
index 7b2fadb..73b8f5b 100644
--- a/test/theap.c
+++ b/test/theap.c
@@ -33,12 +33,12 @@
#include "H5HPprivate.h"
/* The number of elements in testing arrays */
-#define NUM_ELEMS 1000
+#define NUM_ELEMS 1000
/* Objects for testing in heaps */
typedef struct test_obj {
- H5HP_info_t heap_info; /* Information required for heap. _MUST_ be first */
- int val; /* Actual information for object */
+ H5HP_info_t heap_info; /* Information required for heap. _MUST_ be first */
+ int val; /* Actual information for object */
} test_obj;
/* Array of random element values */
@@ -50,28 +50,30 @@ static test_obj *inc_sort_num;
/* Array of random elements values, sorted in decreasing order */
static test_obj *dec_sort_num;
-static int tst_dec_sort(const void *_i1, const void *_i2)
+static int
+tst_dec_sort(const void *_i1, const void *_i2)
{
- const test_obj *i1=(const test_obj *)_i1;
- const test_obj *i2=(const test_obj *)_i2;
-
- if(i1->val<i2->val)
- return(1);
- else if(i1->val>i2->val)
- return(-1);
- return(0);
+ const test_obj *i1 = (const test_obj *)_i1;
+ const test_obj *i2 = (const test_obj *)_i2;
+
+ if (i1->val < i2->val)
+ return (1);
+ else if (i1->val > i2->val)
+ return (-1);
+ return (0);
}
-static int tst_inc_sort(const void *_i1, const void *_i2)
+static int
+tst_inc_sort(const void *_i1, const void *_i2)
{
- const test_obj *i1=(const test_obj *)_i1;
- const test_obj *i2=(const test_obj *)_i2;
-
- if(i1->val<i2->val)
- return(-1);
- else if(i1->val>i2->val)
- return(1);
- return(0);
+ const test_obj *i1 = (const test_obj *)_i1;
+ const test_obj *i2 = (const test_obj *)_i2;
+
+ if (i1->val < i2->val)
+ return (-1);
+ else if (i1->val > i2->val)
+ return (1);
+ return (0);
}
/****************************************************************
@@ -83,8 +85,8 @@ static int tst_inc_sort(const void *_i1, const void *_i2)
static void
test_heap_init(void)
{
- time_t curr_time; /* Current time, for seeding random number generator */
- size_t u; /* Local index variables */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ size_t u; /* Local index variables */
/* Allocate arrays */
rand_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS);
@@ -97,7 +99,7 @@ test_heap_init(void)
/* Create randomized set of numbers */
curr_time = HDtime(NULL);
HDsrandom((unsigned)curr_time);
- for(u = 0; u < NUM_ELEMS; u++)
+ for (u = 0; u < NUM_ELEMS; u++)
/* Generate random numbers from -1000 to 1000 */
rand_num[u].val = (int)(HDrandom() % 2001) - 1001;
@@ -119,26 +121,26 @@ test_heap_init(void)
static void
test_heap_create(void)
{
- H5HP_t *heap; /* Heap created */
- herr_t ret; /* Generic return value */
+ H5HP_t *heap; /* Heap created */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing Creating & Closing Heaps\n"));
/* Try creating a maximum Heap */
- heap=H5HP_create(H5HP_MAX_HEAP);
+ heap = H5HP_create(H5HP_MAX_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Try closing the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
/* Try creating a minimum Heap */
- heap=H5HP_create(H5HP_MIN_HEAP);
+ heap = H5HP_create(H5HP_MIN_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Try closing the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_create() */
@@ -152,67 +154,67 @@ test_heap_create(void)
static void
test_heap_insert_min(void)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
+ H5HP_t * heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int val; /* Value of object on heap */
+ test_obj obj1, obj2, obj3; /* Test objects to insert */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Inserting Into Minimum Heaps\n"));
/* Create a Heap */
- heap=H5HP_create(H5HP_MIN_HEAP);
+ heap = H5HP_create(H5HP_MIN_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Insert an object into the heap */
- obj1.val=100;
- ret=H5HP_insert(heap,10,&obj1);
+ obj1.val = 100;
+ ret = H5HP_insert(heap, 10, &obj1);
CHECK(ret, FAIL, "H5HP_insert");
/* Check that the heap has one element */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 1, "H5HP_count");
/* Check the minimum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 10, "H5HP_top");
/* Insert another object into the heap, with value less than top element */
- obj2.val=50;
- ret=H5HP_insert(heap,5,&obj2);
+ obj2.val = 50;
+ ret = H5HP_insert(heap, 5, &obj2);
CHECK(ret, FAIL, "H5HP_insert");
/* Check that the heap has two elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 2, "H5HP_count");
/* Check the minimum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 5, "H5HP_top");
/* Insert third object into the heap, with value greater than top element */
- obj3.val=200;
- ret=H5HP_insert(heap,20,&obj3);
+ obj3.val = 200;
+ ret = H5HP_insert(heap, 20, &obj3);
CHECK(ret, FAIL, "H5HP_insert");
/* Check that the heap has three elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 3, "H5HP_count");
/* Check the minimum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 5, "H5HP_top");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_insert_min() */
@@ -226,67 +228,67 @@ test_heap_insert_min(void)
static void
test_heap_insert_max(void)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
+ H5HP_t * heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int val; /* Value of object on heap */
+ test_obj obj1, obj2, obj3; /* Test objects to insert */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Inserting Into Maximum Heaps\n"));
/* Create a Heap */
- heap=H5HP_create(H5HP_MAX_HEAP);
+ heap = H5HP_create(H5HP_MAX_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Insert an object into the heap */
- obj1.val=100;
- ret=H5HP_insert(heap,10,&obj1);
+ obj1.val = 100;
+ ret = H5HP_insert(heap, 10, &obj1);
CHECK(ret, FAIL, "H5HP_insert");
/* Check that the heap has one element */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 1, "H5HP_count");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 10, "H5HP_top");
/* Insert another object into the heap, with value less than top element */
- obj2.val=50;
- ret=H5HP_insert(heap,5,&obj2);
+ obj2.val = 50;
+ ret = H5HP_insert(heap, 5, &obj2);
CHECK(ret, FAIL, "H5HP_insert");
/* Check that the heap has two elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 2, "H5HP_count");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 10, "H5HP_top");
/* Insert third object into the heap, with value greater than top element */
- obj3.val=200;
- ret=H5HP_insert(heap,20,&obj3);
+ obj3.val = 200;
+ ret = H5HP_insert(heap, 20, &obj3);
CHECK(ret, FAIL, "H5HP_insert");
/* Check that the heap has three elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 3, "H5HP_count");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 20, "H5HP_top");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_insert_max() */
@@ -317,38 +319,38 @@ test_heap_insert(void)
static void
test_heap_insert_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem, int top_val)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- size_t u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ H5HP_t *heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int val; /* Value of object on heap */
+ size_t u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create a Heap */
- heap=H5HP_create(heap_type);
+ heap = H5HP_create(heap_type);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Insert the array elements into the heap */
- for(u=0; u<nelem; u++) {
- ret=H5HP_insert(heap,arr[u].val,&arr[u]);
+ for (u = 0; u < nelem; u++) {
+ ret = H5HP_insert(heap, arr[u].val, &arr[u]);
CHECK(ret, FAIL, "H5HP_insert");
} /* end for */
/* Check that the heap has correct number of elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
CHECK(num, FAIL, "H5HP_count");
VERIFY((size_t)num, nelem, "H5HP_count");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, top_val, "H5HP_top");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_insert_many_core() */
@@ -393,67 +395,67 @@ test_heap_insert_many(void)
static void
test_heap_remove_min(void)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- void *ptr; /* Pointer for object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
+ H5HP_t * heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int val; /* Value of object on heap */
+ void * ptr; /* Pointer for object on heap */
+ test_obj obj1, obj2, obj3; /* Test objects to insert */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Removing From Minimum Heaps\n"));
/* Create a Heap */
- heap=H5HP_create(H5HP_MIN_HEAP);
+ heap = H5HP_create(H5HP_MIN_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Try removing an object from an empty heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
VERIFY(ret, FAIL, "H5HP_remove");
/* Insert an object into the heap */
- obj1.val=100;
- ret=H5HP_insert(heap,10,&obj1);
+ obj1.val = 100;
+ ret = H5HP_insert(heap, 10, &obj1);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert another object into the heap, with value less than top element */
- obj2.val=50;
- ret=H5HP_insert(heap,5,&obj2);
+ obj2.val = 50;
+ ret = H5HP_insert(heap, 5, &obj2);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert third object into the heap, with value greater than top element */
- obj3.val=200;
- ret=H5HP_insert(heap,20,&obj3);
+ obj3.val = 200;
+ ret = H5HP_insert(heap, 20, &obj3);
CHECK(ret, FAIL, "H5HP_insert");
/* Remove first maximum value from heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 5, "H5HP_remove");
CHECK_PTR_EQ(ptr, &obj2, "H5HP_remove");
/* Remove second maximum value from heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 10, "H5HP_remove");
CHECK_PTR_EQ(ptr, &obj1, "H5HP_remove");
/* Remove third maximum value from heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 20, "H5HP_remove");
CHECK_PTR_EQ(ptr, &obj3, "H5HP_remove");
/* Try removing an object from an empty heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
VERIFY(ret, FAIL, "H5HP_remove");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_remove_min() */
@@ -467,67 +469,67 @@ test_heap_remove_min(void)
static void
test_heap_remove_max(void)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- void *ptr; /* Pointer for object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
+ H5HP_t * heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int val; /* Value of object on heap */
+ void * ptr; /* Pointer for object on heap */
+ test_obj obj1, obj2, obj3; /* Test objects to insert */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Removing From Maximum Heaps\n"));
/* Create a Heap */
- heap=H5HP_create(H5HP_MAX_HEAP);
+ heap = H5HP_create(H5HP_MAX_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Try removing an object from an empty heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
VERIFY(ret, FAIL, "H5HP_remove");
/* Insert an object into the heap */
- obj1.val=100;
- ret=H5HP_insert(heap,10,&obj1);
+ obj1.val = 100;
+ ret = H5HP_insert(heap, 10, &obj1);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert another object into the heap, with value less than top element */
- obj2.val=50;
- ret=H5HP_insert(heap,5,&obj2);
+ obj2.val = 50;
+ ret = H5HP_insert(heap, 5, &obj2);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert third object into the heap, with value greater than top element */
- obj3.val=200;
- ret=H5HP_insert(heap,20,&obj3);
+ obj3.val = 200;
+ ret = H5HP_insert(heap, 20, &obj3);
CHECK(ret, FAIL, "H5HP_insert");
/* Remove first maximum value from heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 20, "H5HP_remove");
CHECK_PTR_EQ(ptr, &obj3, "H5HP_remove");
/* Remove second maximum value from heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 10, "H5HP_remove");
CHECK_PTR_EQ(ptr, &obj1, "H5HP_remove");
/* Remove third maximum value from heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 5, "H5HP_remove");
CHECK_PTR_EQ(ptr, &obj2, "H5HP_remove");
/* Try removing an object from an empty heap */
- ret=H5HP_remove(heap,&val,&ptr);
+ ret = H5HP_remove(heap, &val, &ptr);
VERIFY(ret, FAIL, "H5HP_remove");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_remove_max() */
@@ -555,110 +557,115 @@ test_heap_remove(void)
** "Core" routine called by test_heap_remove_many() routine.
**
****************************************************************/
-static void test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem)
+static void
+test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int last_val; /* Last value from the heap */
- int val; /* Value of object on heap */
+ H5HP_t * heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int last_val; /* Last value from the heap */
+ int val; /* Value of object on heap */
test_obj *ptr; /* Pointer for object on heap */
- size_t u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ size_t u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create a Heap */
- heap=H5HP_create(heap_type);
+ heap = H5HP_create(heap_type);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Insert the array elements into the heap */
- for(u=0; u<nelem; u++) {
- ret=H5HP_insert(heap,arr[u].val,&arr[u]);
+ for (u = 0; u < nelem; u++) {
+ ret = H5HP_insert(heap, arr[u].val, &arr[u]);
CHECK(ret, FAIL, "H5HP_insert");
} /* end for */
/* Check that the heap has correct number of elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
CHECK(num, FAIL, "H5HP_count");
VERIFY((size_t)num, nelem, "H5HP_count");
/* Set an appropriate starting value for the "last" value from heap */
- if(heap_type==H5HP_MAX_HEAP)
- last_val=INT_MAX;
+ if (heap_type == H5HP_MAX_HEAP)
+ last_val = INT_MAX;
else
- last_val=INT_MIN;
+ last_val = INT_MIN;
/* Remove the objects from the heap */
- for(u=0; u<nelem; u++) {
- ret=H5HP_remove(heap,&val,(void **)&ptr);
+ for (u = 0; u < nelem; u++) {
+ ret = H5HP_remove(heap, &val, (void **)&ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, ptr->val, "H5HP_remove");
/* Check that the value is correct, based on the heap type */
- if(heap_type==H5HP_MAX_HEAP) {
- if(val>last_val)
- TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val);
+ if (heap_type == H5HP_MAX_HEAP) {
+ if (val > last_val)
+ TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n", __LINE__, val,
+ last_val);
} /* end if */
else {
- if(val<last_val)
- TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val);
+ if (val < last_val)
+ TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n", __LINE__, val,
+ last_val);
} /* end else */
/* Update last value */
- last_val=val;
+ last_val = val;
} /* end for */
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
-/* Insert & remove again, to check that completely empty heaps can be added again */
+ /* Insert & remove again, to check that completely empty heaps can be added again */
/* Set an appropriate starting value for the "last" value from heap */
- if(heap_type==H5HP_MAX_HEAP)
- last_val=INT_MAX;
+ if (heap_type == H5HP_MAX_HEAP)
+ last_val = INT_MAX;
else
- last_val=INT_MIN;
+ last_val = INT_MIN;
/* Insert the array elements into the heap */
- for(u=0; u<nelem; u++) {
- ret=H5HP_insert(heap,arr[u].val,&arr[u]);
+ for (u = 0; u < nelem; u++) {
+ ret = H5HP_insert(heap, arr[u].val, &arr[u]);
CHECK(ret, FAIL, "H5HP_insert");
} /* end for */
/* Check that the heap has correct number of elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
CHECK(num, FAIL, "H5HP_count");
VERIFY((size_t)num, nelem, "H5HP_count");
/* Remove the objects from the heap */
- for(u=0; u<nelem; u++) {
- ret=H5HP_remove(heap,&val,(void **)&ptr);
+ for (u = 0; u < nelem; u++) {
+ ret = H5HP_remove(heap, &val, (void **)&ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, ptr->val, "H5HP_remove");
/* Check that the value is correct, based on the heap type */
- if(heap_type==H5HP_MAX_HEAP) {
- if(val>last_val)
- TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val);
+ if (heap_type == H5HP_MAX_HEAP) {
+ if (val > last_val)
+ TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n", __LINE__, val,
+ last_val);
} /* end if */
else {
- if(val<last_val)
- TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val);
+ if (val < last_val)
+ TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n", __LINE__, val,
+ last_val);
} /* end else */
/* Update last value */
- last_val=val;
+ last_val = val;
} /* end for */
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_remove_many_core() */
@@ -703,67 +710,67 @@ test_heap_remove_many(void)
static void
test_heap_change_min(void)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
+ H5HP_t * heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int val; /* Value of object on heap */
+ test_obj obj1, obj2, obj3; /* Test objects to insert */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Changing Priority of Objects in Minimum Heaps\n"));
/* Create a Heap */
- heap=H5HP_create(H5HP_MIN_HEAP);
+ heap = H5HP_create(H5HP_MIN_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Insert an object into the heap */
- obj1.val=100;
- ret=H5HP_insert(heap,10,&obj1);
+ obj1.val = 100;
+ ret = H5HP_insert(heap, 10, &obj1);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert another object into the heap, with value less than top element */
- obj2.val=50;
- ret=H5HP_insert(heap,5,&obj2);
+ obj2.val = 50;
+ ret = H5HP_insert(heap, 5, &obj2);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert third object into the heap, with value greater than top element */
- obj3.val=200;
- ret=H5HP_insert(heap,20,&obj3);
+ obj3.val = 200;
+ ret = H5HP_insert(heap, 20, &obj3);
CHECK(ret, FAIL, "H5HP_insert");
/* Change priority of first object on heap in way which shouldn't affect heap order */
- ret=H5HP_change(heap,11,&obj1);
+ ret = H5HP_change(heap, 11, &obj1);
CHECK(ret, FAIL, "H5HP_change");
/* Check the minimum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 5, "H5HP_top");
/* Change priority of first object on heap to be the top object on the heap */
- ret=H5HP_change(heap,3,&obj1);
+ ret = H5HP_change(heap, 3, &obj1);
CHECK(ret, FAIL, "H5HP_change");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 3, "H5HP_top");
/* Change priority of first object on heap to not be the top object on the heap */
- ret=H5HP_change(heap,10,&obj1);
+ ret = H5HP_change(heap, 10, &obj1);
CHECK(ret, FAIL, "H5HP_change");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 5, "H5HP_top");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_change_min() */
@@ -777,67 +784,67 @@ test_heap_change_min(void)
static void
test_heap_change_max(void)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
+ H5HP_t * heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int val; /* Value of object on heap */
+ test_obj obj1, obj2, obj3; /* Test objects to insert */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Changing Priority of Objects in Maximum Heaps\n"));
/* Create a Heap */
- heap=H5HP_create(H5HP_MAX_HEAP);
+ heap = H5HP_create(H5HP_MAX_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Insert an object into the heap */
- obj1.val=100;
- ret=H5HP_insert(heap,10,&obj1);
+ obj1.val = 100;
+ ret = H5HP_insert(heap, 10, &obj1);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert another object into the heap, with value less than top element */
- obj2.val=50;
- ret=H5HP_insert(heap,5,&obj2);
+ obj2.val = 50;
+ ret = H5HP_insert(heap, 5, &obj2);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert third object into the heap, with value greater than top element */
- obj3.val=200;
- ret=H5HP_insert(heap,20,&obj3);
+ obj3.val = 200;
+ ret = H5HP_insert(heap, 20, &obj3);
CHECK(ret, FAIL, "H5HP_insert");
/* Change priority of first object on heap in way which shouldn't affect heap order */
- ret=H5HP_change(heap,11,&obj1);
+ ret = H5HP_change(heap, 11, &obj1);
CHECK(ret, FAIL, "H5HP_change");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 20, "H5HP_top");
/* Change priority of first object on heap to be the top object on the heap */
- ret=H5HP_change(heap,21,&obj1);
+ ret = H5HP_change(heap, 21, &obj1);
CHECK(ret, FAIL, "H5HP_change");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 21, "H5HP_top");
/* Change priority of first object on heap to not be the top object on the heap */
- ret=H5HP_change(heap,10,&obj1);
+ ret = H5HP_change(heap, 10, &obj1);
CHECK(ret, FAIL, "H5HP_change");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 20, "H5HP_top");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_change() */
@@ -869,67 +876,67 @@ test_heap_change(void)
static void
test_heap_incdec_min(void)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
+ H5HP_t * heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int val; /* Value of object on heap */
+ test_obj obj1, obj2, obj3; /* Test objects to insert */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Incrementing & Decrementing Priority of Objects in Minimum Heaps\n"));
/* Create a Heap */
- heap=H5HP_create(H5HP_MIN_HEAP);
+ heap = H5HP_create(H5HP_MIN_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Insert an object into the heap */
- obj1.val=100;
- ret=H5HP_insert(heap,6,&obj1);
+ obj1.val = 100;
+ ret = H5HP_insert(heap, 6, &obj1);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert another object into the heap, with value less than top element */
- obj2.val=50;
- ret=H5HP_insert(heap,5,&obj2);
+ obj2.val = 50;
+ ret = H5HP_insert(heap, 5, &obj2);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert third object into the heap, with value greater than top element */
- obj3.val=200;
- ret=H5HP_insert(heap,20,&obj3);
+ obj3.val = 200;
+ ret = H5HP_insert(heap, 20, &obj3);
CHECK(ret, FAIL, "H5HP_insert");
/* Decrement object one's priority by two to put it on top of the heap */
- ret=H5HP_decr(heap, 2, &obj1);
+ ret = H5HP_decr(heap, 2, &obj1);
CHECK(ret, FAIL, "H5HP_change");
/* Check the minimum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 4, "H5HP_top");
/* Decrement object two's priority by two to put it back on top of the heap */
- ret=H5HP_decr(heap, 2, &obj2);
+ ret = H5HP_decr(heap, 2, &obj2);
CHECK(ret, FAIL, "H5HP_change");
/* Check the minimum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 3, "H5HP_top");
/* Increment object two's priority by two to return object one to the top */
- ret=H5HP_incr(heap,2,&obj2);
+ ret = H5HP_incr(heap, 2, &obj2);
CHECK(ret, FAIL, "H5HP_change");
/* Check the minimum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 4, "H5HP_top");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_incdec_min() */
@@ -944,67 +951,67 @@ test_heap_incdec_min(void)
static void
test_heap_incdec_max(void)
{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
+ H5HP_t * heap; /* Heap created */
+ ssize_t num; /* Number of elements in heap */
+ int val; /* Value of object on heap */
+ test_obj obj1, obj2, obj3; /* Test objects to insert */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Incrementing & Decrementing Priority of Objects in Maximum Heaps\n"));
/* Create a Heap */
- heap=H5HP_create(H5HP_MAX_HEAP);
+ heap = H5HP_create(H5HP_MAX_HEAP);
CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
- num=H5HP_count(heap);
+ num = H5HP_count(heap);
VERIFY(num, 0, "H5HP_count");
/* Insert an object into the heap */
- obj1.val=100;
- ret=H5HP_insert(heap,19,&obj1);
+ obj1.val = 100;
+ ret = H5HP_insert(heap, 19, &obj1);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert another object into the heap, with value less than top element */
- obj2.val=50;
- ret=H5HP_insert(heap,5,&obj2);
+ obj2.val = 50;
+ ret = H5HP_insert(heap, 5, &obj2);
CHECK(ret, FAIL, "H5HP_insert");
/* Insert third object into the heap, with value greater than top element */
- obj3.val=200;
- ret=H5HP_insert(heap,20,&obj3);
+ obj3.val = 200;
+ ret = H5HP_insert(heap, 20, &obj3);
CHECK(ret, FAIL, "H5HP_insert");
/* Increment object one's priority by two to put it on top of the heap */
- ret=H5HP_incr(heap, 2, &obj1);
+ ret = H5HP_incr(heap, 2, &obj1);
CHECK(ret, FAIL, "H5HP_change");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 21, "H5HP_top");
/* Increment object three's priority by two to put it back on top of the heap */
- ret=H5HP_incr(heap, 2, &obj3);
+ ret = H5HP_incr(heap, 2, &obj3);
CHECK(ret, FAIL, "H5HP_change");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 22, "H5HP_top");
/* Decrement object three's priority by two to return object one to the top */
- ret=H5HP_decr(heap,2,&obj3);
+ ret = H5HP_decr(heap, 2, &obj3);
CHECK(ret, FAIL, "H5HP_change");
/* Check the maximum value on the heap */
- ret=H5HP_top(heap, &val);
+ ret = H5HP_top(heap, &val);
CHECK(ret, FAIL, "H5HP_top");
VERIFY(val, 21, "H5HP_top");
/* Close the heap */
- ret=H5HP_close(heap);
+ ret = H5HP_close(heap);
CHECK(ret, FAIL, "H5HP_close");
} /* end test_heap_incdec_max() */
@@ -1037,11 +1044,11 @@ static void
test_heap_term(void)
{
/* Release arrays */
- if(rand_num)
+ if (rand_num)
HDfree(rand_num);
- if(inc_sort_num)
+ if (inc_sort_num)
HDfree(inc_sort_num);
- if(dec_sort_num)
+ if (dec_sort_num)
HDfree(dec_sort_num);
} /* end test_tst_term() */
@@ -1060,16 +1067,15 @@ test_heap(void)
test_heap_init();
/* Actual Heap tests */
- test_heap_create(); /* Test Heap creation */
- test_heap_insert(); /* Test basic Heap insertion */
- test_heap_insert_many(); /* Test Heap insertion of many items */
- test_heap_remove(); /* Test basic Heap removal */
- test_heap_remove_many(); /* Test Heap removal of many items */
- test_heap_change(); /* Test changing priority of objects on Heap */
- test_heap_incdec(); /* Test incrementing & decrementing priority of objects on Heap */
+ test_heap_create(); /* Test Heap creation */
+ test_heap_insert(); /* Test basic Heap insertion */
+ test_heap_insert_many(); /* Test Heap insertion of many items */
+ test_heap_remove(); /* Test basic Heap removal */
+ test_heap_remove_many(); /* Test Heap removal of many items */
+ test_heap_change(); /* Test changing priority of objects on Heap */
+ test_heap_incdec(); /* Test incrementing & decrementing priority of objects on Heap */
/* Release Heap testing data */
test_heap_term();
-} /* end test_heap() */
-
+} /* end test_heap() */
diff --git a/test/thread_id.c b/test/thread_id.c
index 0c804ed..ce60893 100644
--- a/test/thread_id.c
+++ b/test/thread_id.c
@@ -49,23 +49,21 @@ typedef struct _pthread_barrierattr {
} pthread_barrierattr_t;
typedef struct _pthread_barrier {
- uint32_t magic;
- unsigned int count;
- uint64_t nentered;
- pthread_cond_t cv;
+ uint32_t magic;
+ unsigned int count;
+ uint64_t nentered;
+ pthread_cond_t cv;
pthread_mutex_t mtx;
} pthread_barrier_t;
-int pthread_barrier_init(pthread_barrier_t *, const pthread_barrierattr_t *,
- unsigned int);
+int pthread_barrier_init(pthread_barrier_t *, const pthread_barrierattr_t *, unsigned int);
int pthread_barrier_wait(pthread_barrier_t *);
int pthread_barrier_destroy(pthread_barrier_t *);
static const uint32_t barrier_magic = 0xf00dd00f;
int
-pthread_barrier_init(pthread_barrier_t *barrier,
- const pthread_barrierattr_t *attr, unsigned int count)
+pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
{
int rc;
@@ -98,8 +96,7 @@ barrier_lock(pthread_barrier_t *barrier)
int rc;
if ((rc = pthread_mutex_lock(&barrier->mtx)) != 0) {
- my_errx(EXIT_FAILURE, "%s: pthread_mutex_lock: %s", __func__,
- strerror(rc));
+ my_errx(EXIT_FAILURE, "%s: pthread_mutex_lock: %s", __func__, strerror(rc));
}
}
@@ -109,8 +106,7 @@ barrier_unlock(pthread_barrier_t *barrier)
int rc;
if ((rc = pthread_mutex_unlock(&barrier->mtx)) != 0) {
- my_errx(EXIT_FAILURE, "%s: pthread_mutex_unlock: %s", __func__,
- strerror(rc));
+ my_errx(EXIT_FAILURE, "%s: pthread_mutex_unlock: %s", __func__, strerror(rc));
}
}
@@ -125,7 +121,7 @@ pthread_barrier_destroy(pthread_barrier_t *barrier)
else if (barrier->nentered % barrier->count != 0)
rc = EBUSY;
else {
- rc = 0;
+ rc = 0;
barrier->magic = ~barrier->magic;
}
barrier_unlock(barrier);
@@ -142,7 +138,7 @@ pthread_barrier_destroy(pthread_barrier_t *barrier)
int
pthread_barrier_wait(pthread_barrier_t *barrier)
{
- int rc;
+ int rc;
uint64_t threshold;
if (barrier == NULL)
@@ -170,7 +166,7 @@ out:
return rc;
}
-#endif /* H5_HAVE_DARWIN */
+#endif /* H5_HAVE_DARWIN */
static void my_err(int, const char *, ...) H5_ATTR_FORMAT(printf, 2, 3);
@@ -178,7 +174,7 @@ static void
my_err(int code, const char *fmt, ...)
{
va_list ap;
- int errno_copy = errno;
+ int errno_copy = errno;
(void)HDfprintf(stderr, "thread_id: ");
HDva_start(ap, fmt);
@@ -188,22 +184,22 @@ my_err(int code, const char *fmt, ...)
HDexit(code);
}
-#define threads_failure(_call, _result) do { \
- my_errx(EXIT_FAILURE, "%s.%d: " #_call ": %s", __func__, \
- __LINE__, HDstrerror(_result)); \
-} while (false)
+#define threads_failure(_call, _result) \
+ do { \
+ my_errx(EXIT_FAILURE, "%s.%d: " #_call ": %s", __func__, __LINE__, HDstrerror(_result)); \
+ } while (false)
#define NTHREADS 5
-static volatile bool failed = false;
+static volatile bool failed = false;
static pthread_barrier_t barrier;
-static bool used[NTHREADS];
-static pthread_mutex_t used_lock;
+static bool used[NTHREADS];
+static pthread_mutex_t used_lock;
static void
atomic_printf(const char *fmt, ...)
{
- char buf[80];
+ char buf[80];
va_list ap;
ssize_t nprinted, nwritten;
@@ -218,8 +214,7 @@ atomic_printf(const char *fmt, ...)
nwritten = write(STDOUT_FILENO, buf, (size_t)nprinted);
if (nwritten < nprinted) {
- my_errx(EXIT_FAILURE, "%s.%d: write error or short write",
- __func__, __LINE__);
+ my_errx(EXIT_FAILURE, "%s.%d: write error or short write", __func__, __LINE__);
}
}
@@ -261,8 +256,7 @@ thread_main(void H5_ATTR_UNUSED *arg)
ntid = H5TS_thread_id();
if (ntid != tid) {
- atomic_printf("tid changed from %" PRIu64 " to %" PRIu64 " FAIL\n",
- tid, ntid);
+ atomic_printf("tid changed from %" PRIu64 " to %" PRIu64 " FAIL\n", tid, ntid);
failed = true;
}
return NULL;
@@ -275,7 +269,7 @@ pre_barrier_error:
int
main(void)
{
- int i, rc, times;
+ int i, rc, times;
pthread_t threads[NTHREADS];
/* Run H5open() to initialize the library's thread-ID freelist,
@@ -296,7 +290,7 @@ main(void)
for (times = 0; times < 2; times++) {
for (i = 0; i < NTHREADS; i++)
- used[i] = false; // access synchronized by thread create/join
+ used[i] = false; // access synchronized by thread create/join
for (i = 0; i < NTHREADS; i++) {
rc = pthread_create(&threads[i], NULL, thread_main, NULL);
@@ -320,7 +314,7 @@ main(void)
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
}
-#else /*H5_HAVE_THREADSAFE && !H5_HAVE_WIN_THREADS*/
+#else /*H5_HAVE_THREADSAFE && !H5_HAVE_WIN_THREADS*/
int
main(void)
{
diff --git a/test/tid.c b/test/tid.c
index 7a839d2..27135fc 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -16,7 +16,7 @@
#include "testhdf5.h"
/* Include H5Ipkg.h to calculate max number of groups */
-#define H5I_FRIEND /*suppress error about including H5Ipkg */
+#define H5I_FRIEND /*suppress error about including H5Ipkg */
#include "H5Ipkg.h"
static herr_t
@@ -27,59 +27,59 @@ free_wrapper(void *p)
}
/* Test basic functionality of registering and deleting types and IDs */
-static int basic_id_test(void)
+static int
+basic_id_test(void)
{
- H5I_type_t myType = H5I_BADID;
- hid_t arrayID = H5I_INVALID_HID;
- void* testObj = NULL;
- void* testPtr = NULL;
- char nameString[10];
- hid_t testID;
- ssize_t testSize = -1;
- herr_t err;
- int num_ref;
- hsize_t num_members;
-
+ H5I_type_t myType = H5I_BADID;
+ hid_t arrayID = H5I_INVALID_HID;
+ void * testObj = NULL;
+ void * testPtr = NULL;
+ char nameString[10];
+ hid_t testID;
+ ssize_t testSize = -1;
+ herr_t err;
+ int num_ref;
+ hsize_t num_members;
/* Try to register an ID with ficticious types */
H5E_BEGIN_TRY
- arrayID = H5Iregister((H5I_type_t) 420, testObj);
+ arrayID = H5Iregister((H5I_type_t)420, testObj);
H5E_END_TRY
VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister");
- if(arrayID != H5I_INVALID_HID)
+ if (arrayID != H5I_INVALID_HID)
goto out;
H5E_BEGIN_TRY
- arrayID = H5Iregister((H5I_type_t) -1, testObj);
+ arrayID = H5Iregister((H5I_type_t)-1, testObj);
H5E_END_TRY
VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister");
- if(arrayID != H5I_INVALID_HID)
+ if (arrayID != H5I_INVALID_HID)
goto out;
- /* Try to access IDs with ficticious types */
+ /* Try to access IDs with ficticious types */
H5E_BEGIN_TRY
- testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t) 0);
+ testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t)0);
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Iobject_verify");
- if(testPtr != NULL)
+ if (testPtr != NULL)
goto out;
H5E_BEGIN_TRY
- testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t) 700);
+ testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t)700);
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Iobject_verify");
- if(testPtr != NULL)
+ if (testPtr != NULL)
goto out;
/* Register a type */
myType = H5Iregister_type((size_t)64, 0, free_wrapper);
CHECK(myType, H5I_BADID, "H5Iregister_type");
- if(myType == H5I_BADID)
+ if (myType == H5I_BADID)
goto out;
/* Register an ID and retrieve the object it points to.
@@ -90,7 +90,7 @@ static int basic_id_test(void)
arrayID = H5Iregister(myType, testObj);
CHECK(arrayID, H5I_INVALID_HID, "H5Iregister");
- if(arrayID == H5I_INVALID_HID) {
+ if (arrayID == H5I_INVALID_HID) {
HDfree(testObj);
goto out;
}
@@ -98,58 +98,58 @@ static int basic_id_test(void)
testPtr = (int *)H5Iobject_verify(arrayID, myType);
CHECK_PTR_EQ(testPtr, testObj, "H5Iobject_verify");
- if(testPtr != testObj)
+ if (testPtr != testObj)
goto out;
/* Ensure that H5Iget_file_id and H5Iget_name() fail, since this
* is an hid_t for the wrong kind of object
*/
H5E_BEGIN_TRY
- testID = H5Iget_file_id(arrayID);
+ testID = H5Iget_file_id(arrayID);
H5E_END_TRY
VERIFY(testID, H5I_INVALID_HID, "H5Iget_file_id");
- if(testID != H5I_INVALID_HID)
+ if (testID != H5I_INVALID_HID)
goto out;
H5E_BEGIN_TRY
- testSize = H5Iget_name(arrayID, nameString, (size_t)9);
+ testSize = H5Iget_name(arrayID, nameString, (size_t)9);
H5E_END_TRY
VERIFY(testSize, -1, "H5Iget_name");
- if(testSize != -1)
+ if (testSize != -1)
goto out;
/* Make sure H5Iremove_verify catches objects of the wrong type */
H5E_BEGIN_TRY
- testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) 0);
+ testPtr = (int *)H5Iremove_verify(arrayID, (H5I_type_t)0);
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Iremove_verify");
- if(testPtr != NULL)
+ if (testPtr != NULL)
goto out;
H5E_BEGIN_TRY
- testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) ((int) myType-1));
+ testPtr = (int *)H5Iremove_verify(arrayID, (H5I_type_t)((int)myType - 1));
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Iremove_verify");
- if(testPtr != NULL)
+ if (testPtr != NULL)
goto out;
/* Remove an ID and make sure we can't access it */
- testPtr = (int*) H5Iremove_verify(arrayID, myType);
+ testPtr = (int *)H5Iremove_verify(arrayID, myType);
CHECK_PTR(testPtr, "H5Iremove_verify");
- if(testPtr == NULL)
+ if (testPtr == NULL)
goto out;
H5E_BEGIN_TRY
- testPtr = (int*) H5Iobject_verify(arrayID, myType);
+ testPtr = (int *)H5Iobject_verify(arrayID, myType);
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Iobject_verify");
- if(testPtr != NULL)
+ if (testPtr != NULL)
goto out;
/* Delete the type and make sure we can't access objects within it */
@@ -157,23 +157,23 @@ static int basic_id_test(void)
err = H5Idestroy_type(myType);
VERIFY(err, 0, "H5Idestroy_type");
- if( err != 0)
+ if (err != 0)
goto out;
VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists");
- if(H5Itype_exists(myType) != 0)
+ if (H5Itype_exists(myType) != 0)
goto out;
H5E_BEGIN_TRY
- VERIFY(H5Inmembers(myType, NULL), -1, "H5Inmembers");
- if(H5Inmembers(myType, NULL) != -1)
- goto out;
+ VERIFY(H5Inmembers(myType, NULL), -1, "H5Inmembers");
+ if (H5Inmembers(myType, NULL) != -1)
+ goto out;
H5E_END_TRY
/* Register another type and another object in that type */
myType = H5Iregister_type((size_t)64, 0, free_wrapper);
CHECK(myType, H5I_BADID, "H5Iregister_type");
- if(myType == H5I_BADID)
+ if (myType == H5I_BADID)
goto out;
/* The memory that testObj pointed to should already have been
@@ -184,7 +184,7 @@ static int basic_id_test(void)
arrayID = H5Iregister(myType, testObj);
CHECK(arrayID, H5I_INVALID_HID, "H5Iregister");
- if(arrayID == H5I_INVALID_HID) {
+ if (arrayID == H5I_INVALID_HID) {
HDfree(testObj);
goto out;
}
@@ -194,7 +194,7 @@ static int basic_id_test(void)
if (err < 0)
goto out;
VERIFY(num_members, 1, "H5Inmembers");
- if(num_members != 1)
+ if (num_members != 1)
goto out;
/* Increment references to type and ensure that dec_type_ref
@@ -202,33 +202,33 @@ static int basic_id_test(void)
*/
num_ref = H5Iinc_type_ref(myType);
VERIFY(num_ref, 2, "H5Iinc_type_ref");
- if( num_ref != 2)
+ if (num_ref != 2)
goto out;
num_ref = H5Idec_type_ref(myType);
VERIFY(num_ref, 1, "H5Idec_type_ref");
- if(num_ref != 1)
+ if (num_ref != 1)
goto out;
err = H5Inmembers(myType, &num_members);
CHECK(err, -1, "H5Inmembers");
if (err < 0)
goto out;
VERIFY(num_members, 1, "H5Inmembers");
- if(num_members != 1)
+ if (num_members != 1)
goto out;
/* This call to dec_type_ref should destroy the type */
num_ref = H5Idec_type_ref(myType);
VERIFY(num_ref, 0, "H5Idec_type_ref");
- if(num_ref != 0)
+ if (num_ref != 0)
goto out;
VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists");
if (H5Itype_exists(myType) != 0)
goto out;
H5E_BEGIN_TRY
- err = H5Inmembers(myType, &num_members);
- if(err >= 0)
- goto out;
+ err = H5Inmembers(myType, &num_members);
+ if (err >= 0)
+ goto out;
H5E_END_TRY
return 0;
@@ -237,22 +237,26 @@ out:
/* Clean up type if it has been allocated and free memory used
* by testObj
*/
- if(myType >= 0)
+ if (myType >= 0)
H5Idestroy_type(myType);
return -1;
}
+/* A dummy search function for the next test */
+static int
+test_search_func(void H5_ATTR_UNUSED *ptr1, hid_t H5_ATTR_UNUSED id, void H5_ATTR_UNUSED *ptr2)
+{
+ return 0;
+}
- /* A dummy search function for the next test */
-static int test_search_func(void H5_ATTR_UNUSED * ptr1, hid_t H5_ATTR_UNUSED id, void H5_ATTR_UNUSED * ptr2) { return 0; }
-
- /* Ensure that public functions cannot access "predefined" ID types */
-static int id_predefined_test(void )
+/* Ensure that public functions cannot access "predefined" ID types */
+static int
+id_predefined_test(void)
{
void * testObj;
- hid_t testID;
- hid_t typeID = H5I_INVALID_HID;
+ hid_t testID;
+ hid_t typeID = H5I_INVALID_HID;
void * testPtr;
herr_t testErr;
@@ -263,59 +267,59 @@ static int id_predefined_test(void )
*/
H5E_BEGIN_TRY
- testID = H5Iregister(H5I_FILE, testObj);
+ testID = H5Iregister(H5I_FILE, testObj);
H5E_END_TRY
VERIFY(testID, H5I_INVALID_HID, "H5Iregister");
- if(testID != H5I_INVALID_HID)
+ if (testID != H5I_INVALID_HID)
goto out;
H5E_BEGIN_TRY
- testPtr = H5Isearch(H5I_GENPROP_LST, test_search_func, testObj);
+ testPtr = H5Isearch(H5I_GENPROP_LST, test_search_func, testObj);
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Isearch");
- if(testPtr != NULL)
+ if (testPtr != NULL)
goto out;
H5E_BEGIN_TRY
- testErr = H5Inmembers(H5I_ERROR_STACK, NULL);
+ testErr = H5Inmembers(H5I_ERROR_STACK, NULL);
H5E_END_TRY
VERIFY(testErr, -1, "H5Inmembers");
- if(testErr != -1)
+ if (testErr != -1)
goto out;
H5E_BEGIN_TRY
- testErr = H5Iclear_type(H5I_FILE, 0);
+ testErr = H5Iclear_type(H5I_FILE, 0);
H5E_END_TRY
VERIFY((testErr >= 0), 0, "H5Iclear_type");
- if(testErr >= 0)
+ if (testErr >= 0)
goto out;
H5E_BEGIN_TRY
- testErr = H5Idestroy_type(H5I_DATASET);
+ testErr = H5Idestroy_type(H5I_DATASET);
H5E_END_TRY
VERIFY((testErr >= 0), 0, "H5Idestroy_type");
- if(testErr >= 0)
+ if (testErr >= 0)
goto out;
H5E_BEGIN_TRY
- testErr = H5Itype_exists(H5I_GROUP);
+ testErr = H5Itype_exists(H5I_GROUP);
H5E_END_TRY
VERIFY(testErr, -1, "H5Itype_exists");
- if(testErr != -1)
+ if (testErr != -1)
goto out;
H5E_BEGIN_TRY
- testErr = H5Itype_exists(H5I_ATTR);
+ testErr = H5Itype_exists(H5I_ATTR);
H5E_END_TRY
VERIFY(testErr, -1, "H5Itype_exists");
- if(testErr != -1)
+ if (testErr != -1)
goto out;
/*
@@ -324,23 +328,23 @@ static int id_predefined_test(void )
typeID = H5Tcreate(H5T_OPAQUE, (size_t)42);
CHECK(typeID, H5I_INVALID_HID, "H5Tcreate");
- if(typeID == H5I_INVALID_HID)
+ if (typeID == H5I_INVALID_HID)
goto out;
H5E_BEGIN_TRY
- testPtr = H5Iremove_verify(typeID, H5I_DATATYPE);
+ testPtr = H5Iremove_verify(typeID, H5I_DATATYPE);
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Iremove_verify");
- if(testPtr != NULL)
+ if (testPtr != NULL)
goto out;
H5E_BEGIN_TRY
- testPtr = H5Iobject_verify(typeID, H5I_DATATYPE);
+ testPtr = H5Iobject_verify(typeID, H5I_DATATYPE);
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Iobject_verify");
- if(testPtr != NULL)
+ if (testPtr != NULL)
goto out;
H5Tclose(typeID);
@@ -351,23 +355,23 @@ static int id_predefined_test(void )
return 0;
out:
- if(typeID != H5I_INVALID_HID)
+ if (typeID != H5I_INVALID_HID)
H5Tclose(typeID);
- if(testObj != NULL)
+ if (testObj != NULL)
HDfree(testObj);
return -1;
}
-
/* Test the H5Iis_valid function */
-static int test_is_valid(void)
+static int
+test_is_valid(void)
{
- hid_t dtype; /* datatype id */
- int64_t nmembs1; /* number of type memnbers */
+ hid_t dtype; /* datatype id */
+ int64_t nmembs1; /* number of type memnbers */
int64_t nmembs2;
- htri_t tri_ret; /* htri_t return value */
- herr_t ret; /* return value */
+ htri_t tri_ret; /* htri_t return value */
+ herr_t ret; /* return value */
/* Create a datatype id */
dtype = H5Tcopy(H5T_NATIVE_INT);
@@ -437,10 +441,11 @@ out:
}
/* Test the H5Iget_type function */
-static int test_get_type(void)
+static int
+test_get_type(void)
{
- hid_t dtype; /* datatype id */
- H5I_type_t type_ret; /* return value */
+ hid_t dtype; /* datatype id */
+ H5I_type_t type_ret; /* return value */
/* Create a datatype id */
dtype = H5Tcopy(H5T_NATIVE_INT);
@@ -471,13 +476,13 @@ static int test_get_type(void)
return 0;
out:
- if(dtype != H5I_INVALID_HID)
- H5Tclose(dtype);
+ if (dtype != H5I_INVALID_HID)
+ H5Tclose(dtype);
return -1;
}
- /* Test boundary cases with lots of types */
+/* Test boundary cases with lots of types */
/* Type IDs range from H5I_NTYPES to H5I_MAX_NUM_TYPES. The system will assign */
/* IDs in sequential order until H5I_MAX_NUM_TYPES IDs have been given out, at which */
@@ -492,50 +497,48 @@ out:
/* destroy it, this test will mysteriously fail (because it will expect there to */
/* be one more "free" type ID than there is). */
/* H5I_NTYPES is defined in h5public.h, H5I_MAX_NUM_TYPES is defined in h5pkg.h */
-static int test_id_type_list(void)
+static int
+test_id_type_list(void)
{
- H5I_type_t startType; /* The first type ID we were assigned in this test */
+ H5I_type_t startType; /* The first type ID we were assigned in this test */
H5I_type_t currentType;
H5I_type_t testType;
- int i; /* Just a counter variable */
+ int i; /* Just a counter variable */
startType = H5Iregister_type((size_t)8, 0, free_wrapper);
CHECK(startType, H5I_BADID, "H5Iregister_type");
- if(startType == H5I_BADID)
+ if (startType == H5I_BADID)
goto out;
/* Sanity check */
- if((int)startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES)
- {
+ if ((int)startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) {
/* Error condition, throw an error */
CHECK(1, 1, "H5Iregister_type");
goto out;
}
/* Create types up to H5I_MAX_NUM_TYPES */
- for(i = startType + 1; i < H5I_MAX_NUM_TYPES; i++)
- {
+ for (i = startType + 1; i < H5I_MAX_NUM_TYPES; i++) {
currentType = H5Iregister_type((size_t)8, 0, free_wrapper);
CHECK(currentType, H5I_BADID, "H5Iregister_type");
- if(currentType == H5I_BADID)
+ if (currentType == H5I_BADID)
goto out;
}
/* Wrap around to low type ID numbers */
- for(i = H5I_NTYPES; i < startType; i++)
- {
+ for (i = H5I_NTYPES; i < startType; i++) {
currentType = H5Iregister_type((size_t)8, 0, free_wrapper);
CHECK(currentType, H5I_BADID, "H5Iregister_type");
- if(currentType == H5I_BADID)
+ if (currentType == H5I_BADID)
goto out;
}
/* There should be no room at the inn for a new ID type*/
H5E_BEGIN_TRY
- testType = H5Iregister_type((size_t)8, 0, free_wrapper);
+ testType = H5Iregister_type((size_t)8, 0, free_wrapper);
H5E_END_TRY
VERIFY(testType, H5I_BADID, "H5Iregister_type");
- if(testType != H5I_BADID)
+ if (testType != H5I_BADID)
goto out;
/* Now delete a type and try to insert again */
@@ -543,25 +546,25 @@ static int test_id_type_list(void)
testType = H5Iregister_type((size_t)8, 0, free_wrapper);
VERIFY(testType, H5I_NTYPES, "H5Iregister_type");
- if(testType != H5I_NTYPES)
+ if (testType != H5I_NTYPES)
goto out;
/* Cleanup. Destroy all types. */
- for(i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES; i++)
- H5Idestroy_type((H5I_type_t) i);
+ for (i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES; i++)
+ H5Idestroy_type((H5I_type_t)i);
return 0;
out:
/* Cleanup. For simplicity, just destroy all types and ignore errors. */
H5E_BEGIN_TRY
- for(i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES; i++)
- H5Idestroy_type((H5I_type_t) i);
+ for (i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES; i++)
+ H5Idestroy_type((H5I_type_t)i);
H5E_END_TRY
return -1;
}
- /* Test removing ids in callback for H5Iclear_type */
+/* Test removing ids in callback for H5Iclear_type */
/* There was a rare bug where, if an id free callback being called by
* H5I_clear_type() removed another id in that type, a segfault could occur.
@@ -570,48 +573,50 @@ out:
/* Macro definitions */
#define TEST_RCT_MAX_NOBJS 25
#define TEST_RCT_MIN_NOBJS 5
-#define TEST_RCT_NITER 50
+#define TEST_RCT_NITER 50
/* Structure to hold the list of objects */
typedef struct {
- struct test_rct_obj_t *list; /* List of objects */
- long nobjs; /* Number of objects in list */
- long nobjs_rem; /* Number of objects in list that have not been freed */
+ struct test_rct_obj_t *list; /* List of objects */
+ long nobjs; /* Number of objects in list */
+ long nobjs_rem; /* Number of objects in list that have not been freed */
} test_rct_list_t;
/* Structure for an object */
typedef struct test_rct_obj_t {
- hid_t id; /* ID for this object */
- int nfrees; /* Number of times this object has been freed */
- hbool_t freeing; /* Whether we are currently freeing this object directly (through H5Idec_ref()) */
- test_rct_list_t *obj_list; /* List of all objects */
+ hid_t id; /* ID for this object */
+ int nfrees; /* Number of times this object has been freed */
+ hbool_t freeing; /* Whether we are currently freeing this object directly (through H5Idec_ref()) */
+ test_rct_list_t *obj_list; /* List of all objects */
} test_rct_obj_t;
/* Free callback */
-static herr_t test_rct_free(void *_obj) {
+static herr_t
+test_rct_free(void *_obj)
+{
test_rct_obj_t *obj = (test_rct_obj_t *)_obj;
- long rem_idx, i;
- herr_t ret; /* return value */
+ long rem_idx, i;
+ herr_t ret; /* return value */
/* Mark this object as freed */
obj->nfrees++;
obj->obj_list->nobjs_rem--;
/* Check freeing and nobjs_rem */
- if(!obj->freeing && (obj->obj_list->nobjs_rem > 0)) {
+ if (!obj->freeing && (obj->obj_list->nobjs_rem > 0)) {
/* Remove a random object from the list */
rem_idx = HDrandom() % obj->obj_list->nobjs_rem;
/* Scan the list, finding the rem_idx'th object that has not been
* freed */
- for(i = 0; i < obj->obj_list->nobjs; i++)
- if(obj->obj_list->list[i].nfrees == 0) {
- if(rem_idx == 0)
+ for (i = 0; i < obj->obj_list->nobjs; i++)
+ if (obj->obj_list->list[i].nfrees == 0) {
+ if (rem_idx == 0)
break;
else
rem_idx--;
} /* end if */
- if(i == obj->obj_list->nobjs) {
+ if (i == obj->obj_list->nobjs) {
ERROR("invalid obj_list");
goto out;
} /* end if */
@@ -619,16 +624,16 @@ static herr_t test_rct_free(void *_obj) {
/* Remove the object. Mark as "freeing" so its own callback does
* not free another object. */
obj->obj_list->list[i].freeing = TRUE;
- ret = H5Idec_ref(obj->obj_list->list[i].id);
+ ret = H5Idec_ref(obj->obj_list->list[i].id);
CHECK(ret, FAIL, "H5Idec_ref");
- if(ret == FAIL)
+ if (ret == FAIL)
goto out;
obj->obj_list->list[i].freeing = FALSE;
} /* end else */
- } /* end if */
+ } /* end if */
/* Verify nobjs_rem is non-negative */
- if(obj->obj_list->nobjs_rem < 0) {
+ if (obj->obj_list->nobjs_rem < 0) {
ERROR("invalid nobjs_rem");
goto out;
} /* end if */
@@ -640,110 +645,112 @@ out:
} /* end test_rct_free() */
/* Test function */
-static int test_remove_clear_type(void)
+static int
+test_remove_clear_type(void)
{
- H5I_type_t obj_type;
+ H5I_type_t obj_type;
test_rct_list_t obj_list;
- test_rct_obj_t list[TEST_RCT_MAX_NOBJS];
- long i, j;
- long nobjs_found;
- hsize_t nmembers;
- herr_t ret; /* return value */
+ test_rct_obj_t list[TEST_RCT_MAX_NOBJS];
+ long i, j;
+ long nobjs_found;
+ hsize_t nmembers;
+ herr_t ret; /* return value */
/* Register type */
obj_type = H5Iregister_type((size_t)8, 0, test_rct_free);
CHECK(obj_type, H5I_BADID, "H5Iregister_type");
- if(obj_type == H5I_BADID)
+ if (obj_type == H5I_BADID)
goto out;
/* Init obj_list.list */
obj_list.list = list;
- for(i = 0; i < TEST_RCT_NITER; i++) {
+ for (i = 0; i < TEST_RCT_NITER; i++) {
/* Build object list */
- obj_list.nobjs = obj_list.nobjs_rem = TEST_RCT_MIN_NOBJS + (HDrandom() % (long)(TEST_RCT_MAX_NOBJS - TEST_RCT_MIN_NOBJS + 1));
- for(j = 0; j < obj_list.nobjs; j++) {
- list[j].nfrees = 0;
- list[j].freeing = FALSE;
+ obj_list.nobjs = obj_list.nobjs_rem =
+ TEST_RCT_MIN_NOBJS + (HDrandom() % (long)(TEST_RCT_MAX_NOBJS - TEST_RCT_MIN_NOBJS + 1));
+ for (j = 0; j < obj_list.nobjs; j++) {
+ list[j].nfrees = 0;
+ list[j].freeing = FALSE;
list[j].obj_list = &obj_list;
- list[j].id = H5Iregister(obj_type, &list[j]);
+ list[j].id = H5Iregister(obj_type, &list[j]);
CHECK(list[j].id, FAIL, "H5Iregister");
- if(list[j].id == FAIL)
+ if (list[j].id == FAIL)
goto out;
- if(HDrandom() % 2) {
+ if (HDrandom() % 2) {
ret = H5Iinc_ref(list[j].id);
CHECK(ret, FAIL, "H5Iinc_ref");
- if(ret == FAIL)
+ if (ret == FAIL)
goto out;
} /* end if */
- } /* end for */
+ } /* end for */
/* Clear the type */
ret = H5Iclear_type(obj_type, FALSE);
CHECK(ret, FAIL, "H5Iclear_type");
- if(ret == FAIL)
+ if (ret == FAIL)
goto out;
/* Verify list */
nobjs_found = 0;
- for(j = 0; j < obj_list.nobjs; j++) {
- if(list[j].nfrees == 0)
+ for (j = 0; j < obj_list.nobjs; j++) {
+ if (list[j].nfrees == 0)
nobjs_found++;
else {
VERIFY(list[j].nfrees, (long)1, "list[j].nfrees");
- if(list[j].nfrees != (long)1)
+ if (list[j].nfrees != (long)1)
goto out;
} /* end else */
VERIFY(list[j].freeing, FALSE, "list[j].freeing");
- if(list[j].freeing != FALSE)
+ if (list[j].freeing != FALSE)
goto out;
} /* end for */
/* Verify number of objects */
VERIFY(obj_list.nobjs_rem, nobjs_found, "obj_list.nobjs_rem");
- if(obj_list.nobjs_rem != nobjs_found)
+ if (obj_list.nobjs_rem != nobjs_found)
goto out;
ret = H5Inmembers(obj_type, &nmembers);
CHECK(ret, FAIL, "H5Inmembers");
- if(ret == FAIL)
+ if (ret == FAIL)
goto out;
VERIFY(nmembers, (size_t)nobjs_found, "H5Inmembers");
- if(nmembers != (size_t)nobjs_found)
+ if (nmembers != (size_t)nobjs_found)
goto out;
/* Clear the type with force set to TRUE */
ret = H5Iclear_type(obj_type, TRUE);
CHECK(ret, FAIL, "H5Iclear_type");
- if(ret == FAIL)
+ if (ret == FAIL)
goto out;
/* Verify list */
- for(j = 0; j < obj_list.nobjs; j++) {
+ for (j = 0; j < obj_list.nobjs; j++) {
VERIFY(list[j].nfrees, (long)1, "list[j].nfrees");
- if(list[j].nfrees != (long)1)
+ if (list[j].nfrees != (long)1)
goto out;
VERIFY(list[j].freeing, FALSE, "list[j].freeing");
- if(list[j].freeing != FALSE)
+ if (list[j].freeing != FALSE)
goto out;
} /* end for */
/* Verify number of objects is 0 */
VERIFY(obj_list.nobjs_rem, (long)0, "obj_list.nobjs_rem");
- if(obj_list.nobjs_rem != (long)0)
+ if (obj_list.nobjs_rem != (long)0)
goto out;
ret = H5Inmembers(obj_type, &nmembers);
CHECK(ret, FAIL, "H5Inmembers");
- if(ret == FAIL)
+ if (ret == FAIL)
goto out;
VERIFY(nmembers, (size_t)0, "H5Inmembers");
- if(nmembers != (size_t)0)
+ if (nmembers != (size_t)0)
goto out;
} /* end for */
/* Destroy type */
ret = H5Idestroy_type(obj_type);
CHECK(ret, FAIL, "H5Idestroy_type");
- if(ret == FAIL)
+ if (ret == FAIL)
goto out;
return 0;
@@ -751,21 +758,27 @@ static int test_remove_clear_type(void)
out:
/* Cleanup. For simplicity, just destroy the types and ignore errors. */
H5E_BEGIN_TRY
- H5Idestroy_type(obj_type);
+ H5Idestroy_type(obj_type);
H5E_END_TRY
return -1;
} /* end test_remove_clear_type() */
-void test_ids(void)
+void
+test_ids(void)
{
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
- if (basic_id_test() < 0) TestErrPrintf("Basic ID test failed\n");
- if (id_predefined_test() < 0) TestErrPrintf("Predefined ID type test failed\n");
- if (test_is_valid() < 0) TestErrPrintf("H5Iis_valid test failed\n");
- if (test_get_type() < 0) TestErrPrintf("H5Iget_type test failed\n");
- if (test_id_type_list() < 0) TestErrPrintf("ID type list test failed\n");
- if (test_remove_clear_type() < 0) TestErrPrintf("ID remove during H5Iclear_type test failed\n");
-
+ if (basic_id_test() < 0)
+ TestErrPrintf("Basic ID test failed\n");
+ if (id_predefined_test() < 0)
+ TestErrPrintf("Predefined ID type test failed\n");
+ if (test_is_valid() < 0)
+ TestErrPrintf("H5Iis_valid test failed\n");
+ if (test_get_type() < 0)
+ TestErrPrintf("H5Iget_type test failed\n");
+ if (test_id_type_list() < 0)
+ TestErrPrintf("ID type list test failed\n");
+ if (test_remove_clear_type() < 0)
+ TestErrPrintf("ID remove during H5Iclear_type test failed\n");
}
diff --git a/test/timer.c b/test/timer.c
index 1014e75..e907655 100644
--- a/test/timer.c
+++ b/test/timer.c
@@ -22,9 +22,6 @@
#include "h5test.h"
-
-
-
/*-------------------------------------------------------------------------
* Function: test_time_formatting
*
@@ -47,55 +44,55 @@ test_time_formatting(void)
/* < 0, N/A */
s = H5_timer_get_time_string(-1.0F);
- if(NULL == s || HDstrcmp(s, "N/A") != 0)
+ if (NULL == s || HDstrcmp(s, "N/A") != 0)
TEST_ERROR;
HDfree(s);
/* 0 0 */
s = H5_timer_get_time_string(0.0F);
- if(NULL == s || HDstrcmp(s, "0.0 s") != 0)
+ if (NULL == s || HDstrcmp(s, "0.0 s") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 us nanoseconds */
s = H5_timer_get_time_string(123.0E-9F);
- if(NULL == s || HDstrcmp(s, "123 ns") != 0)
+ if (NULL == s || HDstrcmp(s, "123 ns") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 ms microseconds */
s = H5_timer_get_time_string(23.456E-6F);
- if(NULL == s || HDstrcmp(s, "23.5 us") != 0)
+ if (NULL == s || HDstrcmp(s, "23.5 us") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 s milliseconds */
s = H5_timer_get_time_string(4.56789E-3F);
- if(NULL == s || HDstrcmp(s, "4.6 ms") != 0)
+ if (NULL == s || HDstrcmp(s, "4.6 ms") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 min seconds */
s = H5_timer_get_time_string(3.14F);
- if(NULL == s || HDstrcmp(s, "3.14 s") != 0)
+ if (NULL == s || HDstrcmp(s, "3.14 s") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 hr mins, secs */
s = H5_timer_get_time_string(2521.0F);
- if(NULL == s || HDstrcmp(s, "42 m 1 s") != 0)
+ if (NULL == s || HDstrcmp(s, "42 m 1 s") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 d hrs, mins, secs */
s = H5_timer_get_time_string(9756.0F);
- if(NULL == s || HDstrcmp(s, "2 h 42 m 36 s") != 0)
+ if (NULL == s || HDstrcmp(s, "2 h 42 m 36 s") != 0)
TEST_ERROR;
HDfree(s);
/* > 1 d days, hrs, mins, secs */
s = H5_timer_get_time_string(280802.0F);
- if(NULL == s || HDstrcmp(s, "3 d 6 h 0 m 2 s") != 0)
+ if (NULL == s || HDstrcmp(s, "3 d 6 h 0 m 2 s") != 0)
TEST_ERROR;
HDfree(s);
@@ -103,13 +100,11 @@ test_time_formatting(void)
return 0;
error:
- if(s)
+ if (s)
HDfree(s);
return -1;
-
}
-
/*-------------------------------------------------------------------------
* Function: test_timer_system_user
*
@@ -130,47 +125,47 @@ error:
static herr_t
test_timer_system_user(void)
{
- int i;
- char *buf = NULL;
- H5_timer_t timer;
- H5_timevals_t times;
- herr_t err;
+ int i;
+ char * buf = NULL;
+ H5_timer_t timer;
+ H5_timevals_t times;
+ herr_t err;
TESTING("system/user times");
err = H5_timer_init(&timer);
- if(err < 0)
+ if (err < 0)
TEST_ERROR;
err = H5_timer_start(&timer);
- if(err < 0)
+ if (err < 0)
TEST_ERROR;
/* The system and user times may not be present on some systems. They
- * will be -1.0 if they are not.
+ * will be -1.0 if they are not.
*/
- if(timer.initial.system < (double)0.0f || timer.initial.user < (double)0.0f) {
+ if (timer.initial.system < (double)0.0f || timer.initial.user < (double)0.0f) {
SKIPPED();
printf("NOTE: No suitable way to get system/user times on this platform.\n");
return 0;
}
/* Do some fake work */
- for(i=0; i < 1024; i++) {
+ for (i = 0; i < 1024; i++) {
buf = (char *)HDmalloc(1024 * (size_t)i);
HDfree(buf);
}
err = H5_timer_stop(&timer);
- if(err < 0)
+ if (err < 0)
TEST_ERROR;
err = H5_timer_get_times(timer, &times);
- if(err < 0)
+ if (err < 0)
TEST_ERROR;
/* System and user times should be non-negative. */
- if(times.system < (double)0.0f || times.user < (double)0.0f)
+ if (times.system < (double)0.0f || times.user < (double)0.0f)
TEST_ERROR;
PASSED();
@@ -180,7 +175,6 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_timer_elapsed
*
@@ -199,38 +193,38 @@ error:
static herr_t
test_timer_elapsed(void)
{
- int i;
- char *buf = NULL;
- H5_timer_t timer;
- H5_timevals_t times;
- herr_t err;
+ int i;
+ char * buf = NULL;
+ H5_timer_t timer;
+ H5_timevals_t times;
+ herr_t err;
TESTING("elapsed times");
err = H5_timer_init(&timer);
- if(err < 0)
+ if (err < 0)
TEST_ERROR;
err = H5_timer_start(&timer);
- if(err < 0)
+ if (err < 0)
TEST_ERROR;
/* Do some fake work */
- for(i=0; i < 1024; i++) {
+ for (i = 0; i < 1024; i++) {
buf = (char *)HDmalloc(1024 * (size_t)i);
HDfree(buf);
}
err = H5_timer_stop(&timer);
- if(err < 0)
+ if (err < 0)
TEST_ERROR;
err = H5_timer_get_times(timer, &times);
- if(err < 0)
+ if (err < 0)
TEST_ERROR;
/* Elapsed time should be non-negative. */
- if(times.elapsed < (double)0.0f)
+ if (times.elapsed < (double)0.0f)
TEST_ERROR;
PASSED();
@@ -240,20 +234,18 @@ error:
return -1;
}
-
-
static herr_t
test_timer_functionality(void)
{
- int i;
- char *buf = NULL;
- H5_timer_t timer;
+ int i;
+ char * buf = NULL;
+ H5_timer_t timer;
- H5_timevals_t times;
- double prev_etime;
- double prev_total_etime;
+ H5_timevals_t times;
+ double prev_etime;
+ double prev_total_etime;
- herr_t err;
+ herr_t err;
TESTING("timer functionality");
@@ -263,109 +255,106 @@ test_timer_functionality(void)
/* Timer should be running after start */
err = H5_timer_init(&timer);
- if(err < 0 || timer.is_running)
+ if (err < 0 || timer.is_running)
TEST_ERROR;
/* Times should be initialized to zero */
err = H5_timer_get_times(timer, &times);
- if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
+ if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
TEST_ERROR;
err = H5_timer_get_total_times(timer, &times);
- if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
+ if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
TEST_ERROR;
-
/********************
* CHECK START/STOP *
********************/
/* Running state should change after start */
err = H5_timer_start(&timer);
- if(err < 0 || !timer.is_running)
+ if (err < 0 || !timer.is_running)
TEST_ERROR;
/* Do some fake work */
- for(i=0; i < 1024; i++) {
+ for (i = 0; i < 1024; i++) {
buf = (char *)HDmalloc(1024 * (size_t)i);
HDfree(buf);
}
/* Running state should change after stop */
err = H5_timer_stop(&timer);
- if(err < 0 || timer.is_running)
+ if (err < 0 || timer.is_running)
TEST_ERROR;
/* Times should be positive and non-negative */
err = H5_timer_get_times(timer, &times);
- if(err < 0 || times.elapsed < (double)0.0f)
+ if (err < 0 || times.elapsed < (double)0.0f)
TEST_ERROR;
err = H5_timer_get_total_times(timer, &times);
- if(err < 0 || times.elapsed < (double)0.0f)
+ if (err < 0 || times.elapsed < (double)0.0f)
TEST_ERROR;
-
/**********************
* CHECK INTERRUPTING *
**********************/
/* Timer should change stat and refresh to 0s */
err = H5_timer_init(&timer);
- if(err < 0 || timer.is_running)
+ if (err < 0 || timer.is_running)
TEST_ERROR;
err = H5_timer_get_times(timer, &times);
- if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
+ if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
TEST_ERROR;
err = H5_timer_get_total_times(timer, &times);
- if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
+ if (err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
TEST_ERROR;
/* Timer state should flip */
err = H5_timer_start(&timer);
- if(err < 0 || !timer.is_running)
+ if (err < 0 || !timer.is_running)
TEST_ERROR;
/* Do some fake work */
- for(i=0; i < 1024; i++) {
+ for (i = 0; i < 1024; i++) {
buf = (char *)HDmalloc(1024 * (size_t)i);
HDfree(buf);
}
/* Times should be non-negative */
err = H5_timer_get_times(timer, &times);
- if(err < 0 || times.elapsed < (double)0.0f)
+ if (err < 0 || times.elapsed < (double)0.0f)
TEST_ERROR;
prev_etime = times.elapsed;
err = H5_timer_get_total_times(timer, &times);
- if(err < 0 || times.elapsed < (double)0.0f)
+ if (err < 0 || times.elapsed < (double)0.0f)
TEST_ERROR;
prev_total_etime = times.elapsed;
/* Do some fake work */
- for(i=0; i < 1024; i++) {
+ for (i = 0; i < 1024; i++) {
buf = (char *)HDmalloc(1024 * (size_t)i);
HDfree(buf);
}
/* State should flip on stop */
err = H5_timer_stop(&timer);
- if(err < 0 || timer.is_running)
+ if (err < 0 || timer.is_running)
TEST_ERROR;
/* Times should be >= than the cached intermediate times */
err = H5_timer_get_times(timer, &times);
- if(err < 0 || times.elapsed < prev_etime)
+ if (err < 0 || times.elapsed < prev_etime)
TEST_ERROR;
err = H5_timer_get_total_times(timer, &times);
- if(err < 0 || times.elapsed < prev_total_etime)
+ if (err < 0 || times.elapsed < prev_total_etime)
TEST_ERROR;
-
PASSED();
return 0;
@@ -373,7 +362,6 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -391,24 +379,23 @@ error:
int
main(void)
{
- int nerrors = 0;
+ int nerrors = 0;
h5_reset();
printf("Testing platform-independent timer functionality.\n");
- nerrors += test_time_formatting() < 0 ? 1 : 0;
- nerrors += test_timer_system_user() < 0 ? 1 : 0;
- nerrors += test_timer_elapsed() < 0 ? 1 : 0;
- nerrors += test_timer_functionality() < 0 ? 1 : 0;
+ nerrors += test_time_formatting() < 0 ? 1 : 0;
+ nerrors += test_timer_system_user() < 0 ? 1 : 0;
+ nerrors += test_timer_elapsed() < 0 ? 1 : 0;
+ nerrors += test_timer_functionality() < 0 ? 1 : 0;
- if(nerrors) {
- printf("***** %d platform-independent timer TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ if (nerrors) {
+ printf("***** %d platform-independent timer TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
return 1;
- } else {
+ }
+ else {
printf("All platform-independent timer tests passed.\n");
return 0;
}
}
-
diff --git a/test/titerate.c b/test/titerate.c
index 9d60915..bcf19b9 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -12,17 +12,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: titerate
-*
-* Test the Group & Attribute functionality
-*
-*************************************************************/
+ *
+ * Test program: titerate
+ *
+ * Test the Group & Attribute functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
#include "H5srcdir.h"
-#define DATAFILE "titerate.h5"
+#define DATAFILE "titerate.h5"
/* Number of datasets for group iteration test */
#define NDATASETS 50
@@ -34,29 +34,24 @@
#define ITER_NGROUPS 150
/* General maximum length of names used */
-#define NAMELEN 80
+#define NAMELEN 80
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
-typedef enum {
- RET_ZERO,
- RET_TWO,
- RET_CHANGE,
- RET_CHANGE2
-} iter_enum;
+typedef enum { RET_ZERO, RET_TWO, RET_CHANGE, RET_CHANGE2 } iter_enum;
/* Custom group iteration callback data */
typedef struct {
- char name[NAMELEN]; /* The name of the object */
- H5O_type_t type; /* The type of the object */
- iter_enum command; /* The type of return value */
+ char name[NAMELEN]; /* The name of the object */
+ H5O_type_t type; /* The type of the object */
+ iter_enum command; /* The type of return value */
} iter_info;
/* Definition for test_corrupted_attnamelen */
-#define CORRUPTED_ATNAMELEN_FILE "memleak_H5O_dtype_decode_helper_H5Odtype.h5"
-#define DSET_NAME "image"
+#define CORRUPTED_ATNAMELEN_FILE "memleak_H5O_dtype_decode_helper_H5Odtype.h5"
+#define DSET_NAME "image"
typedef struct searched_err_t {
char message[256];
bool found;
@@ -66,23 +61,21 @@ typedef struct searched_err_t {
static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data);
/* Local functions */
-int iter_strcmp(const void *s1, const void *s2);
-int iter_strcmp2(const void *s1, const void *s2);
-static herr_t liter_cb(hid_t group, const char *name, const H5L_info2_t *info,
- void *op_data);
-static herr_t liter_cb2(hid_t group, const char *name, const H5L_info2_t *info,
- void *op_data);
-herr_t aiter_cb(hid_t group, const char *name, const H5A_info_t *ainfo,
- void *op_data);
+int iter_strcmp(const void *s1, const void *s2);
+int iter_strcmp2(const void *s1, const void *s2);
+static herr_t liter_cb(hid_t group, const char *name, const H5L_info2_t *info, void *op_data);
+static herr_t liter_cb2(hid_t group, const char *name, const H5L_info2_t *info, void *op_data);
+herr_t aiter_cb(hid_t group, const char *name, const H5A_info_t *ainfo, void *op_data);
/****************************************************************
**
** iter_strcmp(): String comparison routine for qsort
**
****************************************************************/
-H5_ATTR_PURE int iter_strcmp(const void *s1, const void *s2)
+H5_ATTR_PURE int
+iter_strcmp(const void *s1, const void *s2)
{
- return(HDstrcmp(*(const char * const *)s1,*(const char * const *)s2));
+ return (HDstrcmp(*(const char *const *)s1, *(const char *const *)s2));
}
/****************************************************************
@@ -92,32 +85,32 @@ H5_ATTR_PURE int iter_strcmp(const void *s1, const void *s2)
****************************************************************/
static herr_t
liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info,
- void *op_data)
+ void *op_data)
{
- iter_info *info = (iter_info *)op_data;
- static int count = 0;
+ iter_info *info = (iter_info *)op_data;
+ static int count = 0;
static int count2 = 0;
HDstrcpy(info->name, name);
- switch(info->command) {
+ switch (info->command) {
case RET_ZERO:
- return(0);
+ return (0);
case RET_TWO:
- return(2);
+ return (2);
case RET_CHANGE:
count++;
- return(count > 10 ? 1 : 0);
+ return (count > 10 ? 1 : 0);
case RET_CHANGE2:
count2++;
- return(count2 > 10 ? 1 : 0);
+ return (count2 > 10 ? 1 : 0);
default:
HDprintf("invalid iteration command");
- return(-1);
+ return (-1);
} /* end switch */
} /* end liter_cb() */
@@ -129,19 +122,19 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR
static void
test_iter_group(hid_t fapl, hbool_t new_format)
{
- hid_t file; /* File ID */
- hid_t dataset; /* Dataset ID */
- hid_t datatype; /* Common datatype ID */
- hid_t filespace; /* Common dataspace ID */
- hid_t root_group,grp; /* Root group ID */
- int i; /* counting variable */
- hsize_t idx; /* Index in the group */
- char name[NAMELEN]; /* temporary name buffer */
- char *lnames[NDATASETS + 2];/* Names of the links created */
- char dataset_name[NAMELEN]; /* dataset name */
- iter_info info; /* Custom iteration information */
- H5G_info_t ginfo; /* Buffer for querying object's info */
- herr_t ret; /* Generic return value */
+ hid_t file; /* File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t datatype; /* Common datatype ID */
+ hid_t filespace; /* Common dataspace ID */
+ hid_t root_group, grp; /* Root group ID */
+ int i; /* counting variable */
+ hsize_t idx; /* Index in the group */
+ char name[NAMELEN]; /* temporary name buffer */
+ char * lnames[NDATASETS + 2]; /* Names of the links created */
+ char dataset_name[NAMELEN]; /* dataset name */
+ iter_info info; /* Custom iteration information */
+ H5G_info_t ginfo; /* Buffer for querying object's info */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Group Iteration Functionality\n"));
@@ -152,18 +145,18 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Test iterating over empty group */
info.command = RET_ZERO;
- idx = 0;
- ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
+ idx = 0;
+ ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
VERIFY(ret, SUCCEED, "H5Literate2");
datatype = H5Tcopy(H5T_NATIVE_INT);
CHECK(datatype, FAIL, "H5Tcopy");
- filespace=H5Screate(H5S_SCALAR);
+ filespace = H5Screate(H5S_SCALAR);
CHECK(filespace, FAIL, "H5Screate");
- for(i=0; i< NDATASETS; i++) {
- HDsprintf(name,"Dataset %d",i);
+ for (i = 0; i < NDATASETS; i++) {
+ HDsprintf(name, "Dataset %d", i);
dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -204,7 +197,6 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Sort the dataset names */
HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
-
/* Iterate through the datasets in the root group in various ways */
file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
CHECK(file, FAIL, "H5Fopen");
@@ -219,19 +211,25 @@ test_iter_group(hid_t fapl, hbool_t new_format)
CHECK(ret, FAIL, "H5Gget_info");
VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info");
- for(i = 0; i< (int)ginfo.nlinks; i++) {
- H5O_info2_t oinfo; /* Object info */
+ for (i = 0; i < (int)ginfo.nlinks; i++) {
+ H5O_info2_t oinfo; /* Object info */
- ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
+ ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i,
+ dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_name_by_idx");
- ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
+ H5O_INFO_BASIC, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx");
} /* end for */
- H5E_BEGIN_TRY {
- ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS+3), dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret =
+ (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS + 3),
+ dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Lget_name_by_idx");
ret = H5Gclose(root_group);
@@ -245,55 +243,57 @@ test_iter_group(hid_t fapl, hbool_t new_format)
CHECK(ret, FAIL, "H5Gget_info");
VERIFY(ginfo.nlinks, NDATASETS + 2, "H5Gget_info");
- for(i = 0; i< (int)ginfo.nlinks; i++) {
- H5O_info2_t oinfo; /* Object info */
+ for (i = 0; i < (int)ginfo.nlinks; i++) {
+ H5O_info2_t oinfo; /* Object info */
- ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
+ ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name,
+ (size_t)NAMELEN, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_name_by_idx");
- ret = H5Oget_info_by_idx3(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx3");
} /* end for */
- H5E_BEGIN_TRY {
- ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS + 3), dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS + 3),
+ dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Lget_name_by_idx");
/* Test invalid indices for starting iteration */
info.command = RET_ZERO;
- idx = (hsize_t)-1;
- H5E_BEGIN_TRY {
- ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
- } H5E_END_TRY;
+ idx = (hsize_t)-1;
+ H5E_BEGIN_TRY { ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Literate2");
/* Test skipping exactly as many entries as in the group */
idx = NDATASETS + 2;
- H5E_BEGIN_TRY {
- ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Literate2");
/* Test skipping more entries than are in the group */
idx = NDATASETS + 3;
- H5E_BEGIN_TRY {
- ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Literate2");
/* Test all objects in group, when callback always returns 0 */
info.command = RET_ZERO;
- idx = 0;
- if((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0)
+ idx = 0;
+ if ((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0)
TestErrPrintf("Group iteration function didn't return zero correctly!\n");
/* Test all objects in group, when callback always returns 1 */
/* This also tests the "restarting" ability, because the index changes */
info.command = RET_TWO;
- i = 0;
- idx = 0;
- while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) {
+ i = 0;
+ idx = 0;
+ while ((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 2, "H5Literate2");
@@ -302,24 +302,27 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Verify that the index is the correct value */
VERIFY(idx, (hsize_t)i, "H5Literate2");
- if(idx > (NDATASETS + 2))
+ if (idx > (NDATASETS + 2))
TestErrPrintf("Group iteration function walked too far!\n");
/* Verify that the correct name is retrieved */
- if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
- TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
+ if (HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
+ TestErrPrintf(
+ "Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n",
+ (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
} /* end while */
VERIFY(ret, -1, "H5Literate2");
- if(i != (NDATASETS + 2))
- TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__);
+ if (i != (NDATASETS + 2))
+ TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n",
+ __LINE__);
/* Test all objects in group, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
- i = 0;
- idx = 0;
- while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) {
+ i = 0;
+ idx = 0;
+ while ((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 1, "H5Literate2");
@@ -328,23 +331,26 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Verify that the index is the correct value */
VERIFY(idx, (hsize_t)(i + 10), "H5Literate2");
- if(idx > (NDATASETS + 2))
+ if (idx > (NDATASETS + 2))
TestErrPrintf("Group iteration function walked too far!\n");
/* Verify that the correct name is retrieved */
- if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
- TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
+ if (HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
+ TestErrPrintf(
+ "Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n",
+ (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
} /* end while */
VERIFY(ret, -1, "H5Literate2");
- if(i != 42 || idx != 52)
- TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__);
+ if (i != 42 || idx != 52)
+ TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n",
+ __LINE__);
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Free the dataset names */
- for(i = 0; i< (NDATASETS + 2); i++)
+ for (i = 0; i < (NDATASETS + 2); i++)
HDfree(lnames[i]);
} /* test_iter_group() */
@@ -354,33 +360,32 @@ test_iter_group(hid_t fapl, hbool_t new_format)
**
****************************************************************/
herr_t
-aiter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5A_info_t H5_ATTR_UNUSED *ainfo,
- void *op_data)
+aiter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *op_data)
{
- iter_info *info = (iter_info *)op_data;
- static int count = 0;
+ iter_info *info = (iter_info *)op_data;
+ static int count = 0;
static int count2 = 0;
HDstrcpy(info->name, name);
- switch(info->command) {
+ switch (info->command) {
case RET_ZERO:
- return(0);
+ return (0);
case RET_TWO:
- return(2);
+ return (2);
case RET_CHANGE:
count++;
- return(count > 10 ? 1 : 0);
+ return (count > 10 ? 1 : 0);
case RET_CHANGE2:
count2++;
- return(count2 > 10 ? 1 : 0);
+ return (count2 > 10 ? 1 : 0);
default:
HDprintf("invalid iteration command");
- return(-1);
+ return (-1);
} /* end switch */
} /* end aiter_cb() */
@@ -389,18 +394,19 @@ aiter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5A_info_t H5_ATTR_
** test_iter_attr(): Test attribute iteration functionality
**
****************************************************************/
-static void test_iter_attr(hid_t fapl, hbool_t new_format)
+static void
+test_iter_attr(hid_t fapl, hbool_t new_format)
{
- hid_t file; /* File ID */
- hid_t dataset; /* Common Dataset ID */
- hid_t filespace; /* Common dataspace ID */
- hid_t attribute; /* Attribute ID */
- int i; /* counting variable */
- hsize_t idx; /* Index in the attribute list */
- char name[NAMELEN]; /* temporary name buffer */
- char *anames[NATTR]; /* Names of the attributes created */
- iter_info info; /* Custom iteration information */
- herr_t ret; /* Generic return value */
+ hid_t file; /* File ID */
+ hid_t dataset; /* Common Dataset ID */
+ hid_t filespace; /* Common dataspace ID */
+ hid_t attribute; /* Attribute ID */
+ int i; /* counting variable */
+ hsize_t idx; /* Index in the attribute list */
+ char name[NAMELEN]; /* temporary name buffer */
+ char * anames[NATTR]; /* Names of the attributes created */
+ iter_info info; /* Custom iteration information */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Attribute Iteration Functionality\n"));
@@ -415,7 +421,7 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
dataset = H5Dcreate2(file, "Dataset", H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
- for(i = 0; i < NATTR; i++) {
+ for (i = 0; i < NATTR; i++) {
HDsprintf(name, "Attribute %02d", i);
attribute = H5Acreate2(dataset, name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attribute, FAIL, "H5Acreate2");
@@ -438,7 +444,6 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
-
/* Iterate through the attributes on the dataset in various ways */
file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
CHECK(file, FAIL, "H5Fopen");
@@ -451,30 +456,28 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* Test skipping exactly as many attributes as there are */
idx = NATTR;
- H5E_BEGIN_TRY {
- ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Aiterate2");
/* Test skipping more attributes than there are */
idx = NATTR + 1;
- H5E_BEGIN_TRY {
- ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Aiterate2");
/* Test all attributes on dataset, when callback always returns 0 */
info.command = RET_ZERO;
- idx = 0;
- if((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0)
+ idx = 0;
+ if ((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0)
TestErrPrintf("Attribute iteration function didn't return zero correctly!\n");
/* Test all attributes on dataset, when callback always returns 1 */
/* This also tests the "restarting" ability, because the index changes */
info.command = RET_TWO;
- i = 0;
- idx = 0;
- while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
+ i = 0;
+ idx = 0;
+ while ((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 2, "H5Aiterate2");
@@ -485,23 +488,25 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
VERIFY(idx, (unsigned)i, "H5Aiterate2");
/* Don't check name when new format is used */
- if(!new_format) {
+ if (!new_format) {
/* Verify that the correct name is retrieved */
- if(HDstrcmp(info.name, anames[(size_t)idx - 1]) != 0)
- TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = '%s', anames[%u] = '%s'!\n", __LINE__, info.name, (unsigned)(idx - 1), anames[(size_t)idx - 1]);
+ if (HDstrcmp(info.name, anames[(size_t)idx - 1]) != 0)
+ TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = "
+ "'%s', anames[%u] = '%s'!\n",
+ __LINE__, info.name, (unsigned)(idx - 1), anames[(size_t)idx - 1]);
} /* end if */
- } /* end while */
+ } /* end while */
VERIFY(ret, -1, "H5Aiterate2");
- if(i != 50 || idx != 50)
- TestErrPrintf("%u: Attribute iteration function didn't perform multiple iterations correctly!\n", __LINE__);
-
+ if (i != 50 || idx != 50)
+ TestErrPrintf("%u: Attribute iteration function didn't perform multiple iterations correctly!\n",
+ __LINE__);
/* Test all attributes on dataset, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
- i = 0;
- idx = 0;
- while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
+ i = 0;
+ idx = 0;
+ while ((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 1, "H5Aiterate2");
@@ -512,24 +517,27 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
VERIFY(idx, (unsigned)i + 10, "H5Aiterate2");
/* Don't check name when new format is used */
- if(!new_format) {
+ if (!new_format) {
/* Verify that the correct name is retrieved */
- if(HDstrcmp(info.name, anames[(size_t)idx - 1]) != 0)
- TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = '%s', anames[%u] = '%s'!\n", __LINE__, info.name, (unsigned)(idx - 1), anames[(size_t)idx - 1]);
+ if (HDstrcmp(info.name, anames[(size_t)idx - 1]) != 0)
+ TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = "
+ "'%s', anames[%u] = '%s'!\n",
+ __LINE__, info.name, (unsigned)(idx - 1), anames[(size_t)idx - 1]);
} /* end if */
- } /* end while */
+ } /* end while */
VERIFY(ret, -1, "H5Aiterate2");
- if(i != 40 || idx != 50)
- TestErrPrintf("%u: Attribute iteration function didn't perform multiple iterations correctly!\n", __LINE__);
+ if (i != 40 || idx != 50)
+ TestErrPrintf("%u: Attribute iteration function didn't perform multiple iterations correctly!\n",
+ __LINE__);
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
- ret=H5Dclose(dataset);
+ ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
/* Free the attribute names */
- for(i=0; i< NATTR; i++)
+ for (i = 0; i < NATTR; i++)
HDfree(anames[i]);
} /* test_iter_attr() */
@@ -539,9 +547,10 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
** iter_strcmp2(): String comparison routine for qsort
**
****************************************************************/
-H5_ATTR_PURE int iter_strcmp2(const void *s1, const void *s2)
+H5_ATTR_PURE int
+iter_strcmp2(const void *s1, const void *s2)
{
- return(HDstrcmp((const char *)s1, (const char *)s2));
+ return (HDstrcmp((const char *)s1, (const char *)s2));
} /* end iter_strcmp2() */
/****************************************************************
@@ -550,16 +559,15 @@ H5_ATTR_PURE int iter_strcmp2(const void *s1, const void *s2)
**
****************************************************************/
static herr_t
-liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info,
- void *opdata)
+liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *opdata)
{
const iter_info *test_info = (const iter_info *)opdata;
- H5O_info2_t oinfo;
- herr_t ret; /* Generic return value */
+ H5O_info2_t oinfo;
+ herr_t ret; /* Generic return value */
- if(HDstrcmp(name, test_info->name)) {
+ if (HDstrcmp(name, test_info->name)) {
TestErrPrintf("name = '%s', test_info = '%s'\n", name, test_info->name);
- return(H5_ITER_ERROR);
+ return (H5_ITER_ERROR);
} /* end if */
/*
@@ -568,12 +576,12 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link
ret = H5Oget_info_by_name3(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name3");
- if(test_info->type != oinfo.type) {
+ if (test_info->type != oinfo.type) {
TestErrPrintf("test_info->type = %d, oinfo.type = %d\n", test_info->type, (int)oinfo.type);
- return(H5_ITER_ERROR);
+ return (H5_ITER_ERROR);
} /* end if */
- return(H5_ITER_STOP);
+ return (H5_ITER_STOP);
} /* liter_cb2() */
/****************************************************************
@@ -585,23 +593,23 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link
static void
test_iter_group_large(hid_t fapl)
{
- hid_t file; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t dims[] = {SPACE1_DIM1};
- herr_t ret; /* Generic return value */
- char gname[20]; /* Temporary group name */
- iter_info *names; /* Names of objects in the root group */
- iter_info *curr_name; /* Pointer to the current name in the root group */
- int i;
+ hid_t file; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t dims[] = {SPACE1_DIM1};
+ herr_t ret; /* Generic return value */
+ char gname[20]; /* Temporary group name */
+ iter_info *names; /* Names of objects in the root group */
+ iter_info *curr_name; /* Pointer to the current name in the root group */
+ int i;
/* Compound datatype */
typedef struct s1_t {
unsigned int a;
unsigned int b;
- float c;
+ float c;
} s1_t;
/* Allocate & initialize array */
@@ -620,7 +628,7 @@ test_iter_group_large(hid_t fapl)
CHECK(sid, FAIL, "H5Screate_simple");
/* Create a bunch of groups */
- for(i = 0; i < ITER_NGROUPS; i++) {
+ for (i = 0; i < ITER_NGROUPS; i++) {
HDsprintf(gname, "Group_%d", i);
/* Add the name to the list of objects in the root group */
@@ -683,13 +691,13 @@ test_iter_group_large(hid_t fapl)
/* Iterate through the file to see members of the root group */
curr_name = &names[0];
- ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name);
+ ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name);
CHECK(ret, FAIL, "H5Literate2");
- for(i = 1; i < 100; i++) {
+ for (i = 1; i < 100; i++) {
hsize_t idx = (hsize_t)i;
curr_name = &names[i];
- ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name);
+ ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name);
CHECK(ret, FAIL, "H5Literate2");
} /* end for */
@@ -707,21 +715,22 @@ test_iter_group_large(hid_t fapl)
** functionality
**
****************************************************************/
-static void test_grp_memb_funcs(hid_t fapl)
+static void
+test_grp_memb_funcs(hid_t fapl)
{
- hid_t file; /* File ID */
- hid_t dataset; /* Dataset ID */
- hid_t datatype; /* Common datatype ID */
- hid_t filespace; /* Common dataspace ID */
- hid_t root_group,grp; /* Root group ID */
- int i; /* counting variable */
- char name[NAMELEN]; /* temporary name buffer */
- char *dnames[NDATASETS+2];/* Names of the datasets created */
- char *obj_names[NDATASETS+2];/* Names of the objects in group */
- char dataset_name[NAMELEN]; /* dataset name */
- ssize_t name_len; /* Length of object's name */
- H5G_info_t ginfo; /* Buffer for querying object's info */
- herr_t ret = SUCCEED; /* Generic return value */
+ hid_t file; /* File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t datatype; /* Common datatype ID */
+ hid_t filespace; /* Common dataspace ID */
+ hid_t root_group, grp; /* Root group ID */
+ int i; /* counting variable */
+ char name[NAMELEN]; /* temporary name buffer */
+ char * dnames[NDATASETS + 2]; /* Names of the datasets created */
+ char * obj_names[NDATASETS + 2]; /* Names of the objects in group */
+ char dataset_name[NAMELEN]; /* dataset name */
+ ssize_t name_len; /* Length of object's name */
+ H5G_info_t ginfo; /* Buffer for querying object's info */
+ herr_t ret = SUCCEED; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Group Member Information Functionality\n"));
@@ -736,7 +745,7 @@ static void test_grp_memb_funcs(hid_t fapl)
filespace = H5Screate(H5S_SCALAR);
CHECK(filespace, FAIL, "H5Screate");
- for(i = 0; i < NDATASETS; i++) {
+ for (i = 0; i < NDATASETS; i++) {
HDsprintf(name, "Dataset %d", i);
dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -792,14 +801,16 @@ static void test_grp_memb_funcs(hid_t fapl)
CHECK(ret, FAIL, "H5Gget_info");
VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info");
- for(i = 0; i < (int)ginfo.nlinks; i++) {
- H5O_info2_t oinfo; /* Object info */
+ for (i = 0; i < (int)ginfo.nlinks; i++) {
+ H5O_info2_t oinfo; /* Object info */
/* Test with NULL for name, to query length */
- name_len = H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, NULL, (size_t)NAMELEN, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, NULL,
+ (size_t)NAMELEN, H5P_DEFAULT);
CHECK(name_len, FAIL, "H5Lget_name_by_idx");
- ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)(name_len + 1), H5P_DEFAULT);
+ ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i,
+ dataset_name, (size_t)(name_len + 1), H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_name_by_idx");
/* Double-check that the length is the same */
@@ -809,27 +820,32 @@ static void test_grp_memb_funcs(hid_t fapl)
obj_names[i] = HDstrdup(dataset_name);
CHECK_PTR(obj_names[i], "strdup");
- ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
+ H5O_INFO_BASIC, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx3");
- if(!HDstrcmp(dataset_name, "grp"))
+ if (!HDstrcmp(dataset_name, "grp"))
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
- if(!HDstrcmp(dataset_name, "dtype"))
+ if (!HDstrcmp(dataset_name, "dtype"))
VERIFY(oinfo.type, H5O_TYPE_NAMED_DATATYPE, "H5Lget_name_by_idx");
- if(!HDstrncmp(dataset_name, "Dataset", (size_t)7))
+ if (!HDstrncmp(dataset_name, "Dataset", (size_t)7))
VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Lget_name_by_idx");
} /* end for */
- H5E_BEGIN_TRY {
- ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS+3), dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ ret =
+ (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)(NDATASETS + 3),
+ dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Lget_name_by_idx");
/* Sort the dataset names */
HDqsort(obj_names, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
/* Compare object names */
- for(i = 0; i< (int)ginfo.nlinks; i++) {
+ for (i = 0; i < (int)ginfo.nlinks; i++) {
ret = HDstrcmp(dnames[i], obj_names[i]);
VERIFY(ret, 0, "HDstrcmp");
} /* end for */
@@ -837,12 +853,11 @@ static void test_grp_memb_funcs(hid_t fapl)
ret = H5Gclose(root_group);
CHECK(ret, FAIL, "H5Gclose");
-
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Free the dataset names */
- for(i = 0; i< (NDATASETS + 2); i++) {
+ for (i = 0; i < (NDATASETS + 2); i++) {
HDfree(dnames[i]);
HDfree(obj_names[i]);
} /* end for */
@@ -853,15 +868,16 @@ static void test_grp_memb_funcs(hid_t fapl)
** test_links(): Test soft and hard link iteration
**
****************************************************************/
-static void test_links(hid_t fapl)
+static void
+test_links(hid_t fapl)
{
- hid_t file; /* File ID */
- char obj_name[NAMELEN]; /* Names of the object in group */
- ssize_t name_len; /* Length of object's name */
- hid_t gid, gid1;
- H5G_info_t ginfo; /* Buffer for querying object's info */
- hsize_t i;
- herr_t ret; /* Generic return value */
+ hid_t file; /* File ID */
+ char obj_name[NAMELEN]; /* Names of the object in group */
+ ssize_t name_len; /* Length of object's name */
+ hid_t gid, gid1;
+ H5G_info_t ginfo; /* Buffer for querying object's info */
+ hsize_t i;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality\n"));
@@ -889,12 +905,13 @@ static void test_links(hid_t fapl)
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
/* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */
- for(i = 0; i < ginfo.nlinks; i++) {
- H5O_info2_t oinfo; /* Object info */
- H5L_info2_t linfo; /* Link info */
+ for (i = 0; i < ginfo.nlinks; i++) {
+ H5O_info2_t oinfo; /* Object info */
+ H5L_info2_t linfo; /* Link info */
/* Get link name */
- name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN,
+ H5P_DEFAULT);
CHECK(name_len, FAIL, "H5Lget_name_by_idx");
/* Get link type */
@@ -902,16 +919,17 @@ static void test_links(hid_t fapl)
CHECK(ret, FAIL, "H5Lget_info_by_idx2");
/* Get object type */
- if(linfo.type == H5L_TYPE_HARD) {
- ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ if (linfo.type == H5L_TYPE_HARD) {
+ ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
+ H5O_INFO_BASIC, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx3");
} /* end if */
- if(!HDstrcmp(obj_name, "g1.1"))
+ if (!HDstrcmp(obj_name, "g1.1"))
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
- else if(!HDstrcmp(obj_name, "hardlink"))
+ else if (!HDstrcmp(obj_name, "hardlink"))
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
- else if(!HDstrcmp(obj_name, "softlink"))
+ else if (!HDstrcmp(obj_name, "softlink"))
VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx");
else
CHECK(0, 0, "unknown object name");
@@ -941,17 +959,16 @@ static void test_links(hid_t fapl)
static int
find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_client_data)
{
- int status = H5_ITER_CONT;
+ int status = H5_ITER_CONT;
searched_err_t *searched_err = (searched_err_t *)_client_data;
if (searched_err == NULL)
return H5_ITER_ERROR;
/* If the searched error message is found, stop the iteration */
- if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0)
- {
+ if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0) {
searched_err->found = true;
- status = H5_ITER_STOP;
+ status = H5_ITER_STOP;
}
return status;
@@ -964,17 +981,18 @@ find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_
** detected and invalid read can be avoided.
**
**************************************************************************/
-static void test_corrupted_attnamelen(void)
+static void
+test_corrupted_attnamelen(void)
{
- hid_t fid = -1; /* File ID */
- hid_t did = -1; /* Dataset ID */
- searched_err_t err_caught; /* Data to be passed to callback func */
- int err_status; /* Status returned by H5Aiterate2 */
- herr_t ret; /* Return value */
- const char *testfile = H5_get_srcdir_filename(CORRUPTED_ATNAMELEN_FILE); /* Corrected test file name */
+ hid_t fid = -1; /* File ID */
+ hid_t did = -1; /* Dataset ID */
+ searched_err_t err_caught; /* Data to be passed to callback func */
+ int err_status; /* Status returned by H5Aiterate2 */
+ herr_t ret; /* Return value */
+ const char * testfile = H5_get_srcdir_filename(CORRUPTED_ATNAMELEN_FILE); /* Corrected test file name */
const char *err_message = "attribute name has different length than stored length";
- /* the error message produced when the failure occurs */
+ /* the error message produced when the failure occurs */
/* Output message about test being performed */
MESSAGE(5, ("Testing the Handling of Corrupted Attribute's Name Length\n"));
@@ -992,8 +1010,7 @@ static void test_corrupted_attnamelen(void)
VERIFY(err_status, FAIL, "H5Aiterate2");
/* Make sure the intended error was caught */
- if(err_status == -1)
- {
+ if (err_status == -1) {
/* Initialize client data */
HDstrcpy(err_caught.message, err_message);
err_caught.found = false;
@@ -1021,15 +1038,16 @@ static void test_corrupted_attnamelen(void)
** test_links_deprec(): Test soft and hard link iteration
**
****************************************************************/
-static void test_links_deprec(hid_t fapl)
+static void
+test_links_deprec(hid_t fapl)
{
- hid_t file; /* File ID */
- char obj_name[NAMELEN]; /* Names of the object in group */
- ssize_t name_len; /* Length of object's name */
- hid_t gid, gid1;
- H5G_info_t ginfo; /* Buffer for querying object's info */
- hsize_t i;
- herr_t ret; /* Generic return value */
+ hid_t file; /* File ID */
+ char obj_name[NAMELEN]; /* Names of the object in group */
+ ssize_t name_len; /* Length of object's name */
+ hid_t gid, gid1;
+ H5G_info_t ginfo; /* Buffer for querying object's info */
+ hsize_t i;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality Using Deprecated Routines\n"));
@@ -1057,12 +1075,13 @@ static void test_links_deprec(hid_t fapl)
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
/* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */
- for(i = 0; i < ginfo.nlinks; i++) {
- H5O_info2_t oinfo; /* Object info */
- H5L_info2_t linfo; /* Link info */
+ for (i = 0; i < ginfo.nlinks; i++) {
+ H5O_info2_t oinfo; /* Object info */
+ H5L_info2_t linfo; /* Link info */
/* Get link name */
- name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN,
+ H5P_DEFAULT);
CHECK(name_len, FAIL, "H5Lget_name_by_idx");
/* Get link type */
@@ -1070,16 +1089,17 @@ static void test_links_deprec(hid_t fapl)
CHECK(ret, FAIL, "H5Lget_info_by_idx1");
/* Get object type */
- if(linfo.type == H5L_TYPE_HARD) {
- ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ if (linfo.type == H5L_TYPE_HARD) {
+ ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
+ H5O_INFO_BASIC, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx");
} /* end if */
- if(!HDstrcmp(obj_name, "g1.1"))
+ if (!HDstrcmp(obj_name, "g1.1"))
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
- else if(!HDstrcmp(obj_name, "hardlink"))
+ else if (!HDstrcmp(obj_name, "hardlink"))
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
- else if(!HDstrcmp(obj_name, "softlink"))
+ else if (!HDstrcmp(obj_name, "softlink"))
VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx");
else
CHECK(0, 0, "unknown object name");
@@ -1104,9 +1124,9 @@ static void test_links_deprec(hid_t fapl)
void
test_iterate(void)
{
- hid_t fapl, fapl2; /* File access property lists */
- unsigned new_format; /* Whether to use the new format or not */
- herr_t ret; /* Generic return value */
+ hid_t fapl, fapl2; /* File access property lists */
+ unsigned new_format; /* Whether to use the new format or not */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Iteration Operations\n"));
@@ -1124,14 +1144,14 @@ test_iterate(void)
CHECK(ret, FAIL, "H5Pset_libver_bounds");
/* These next tests use the same file */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
test_iter_group(new_format ? fapl2 : fapl, new_format); /* Test group iteration */
- test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */
- test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */
- test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */
- test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
+ test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */
+ test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */
+ test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */
+ test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_links_deprec(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
+ test_links_deprec(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
#endif
} /* end for */
@@ -1143,8 +1163,7 @@ test_iterate(void)
CHECK(ret, FAIL, "H5Pclose");
ret = H5Pclose(fapl2);
CHECK(ret, FAIL, "H5Pclose");
-} /* test_iterate() */
-
+} /* test_iterate() */
/*-------------------------------------------------------------------------
* Function: cleanup_iterate
@@ -1165,4 +1184,3 @@ cleanup_iterate(void)
{
HDremove(DATAFILE);
}
-
diff --git a/test/tmeta.c b/test/tmeta.c
index ceb7d2b..03ebf01 100644
--- a/test/tmeta.c
+++ b/test/tmeta.c
@@ -12,36 +12,41 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tmeta
-*
-* Test the basic meta-data encode/decode macros calls.
-*
-*************************************************************/
+ *
+ * Test program: tmeta
+ *
+ * Test the basic meta-data encode/decode macros calls.
+ *
+ *************************************************************/
#include "testhdf5.h"
#include "H5Fprivate.h"
-#define TEST_INT16_VALUE -7641
-#define TEST_UINT16_VALUE 45002
-#define TEST_INT32_VALUE -981236
-#define TEST_UINT32_VALUE 3476589
+#define TEST_INT16_VALUE -7641
+#define TEST_UINT16_VALUE 45002
+#define TEST_INT32_VALUE -981236
+#define TEST_UINT32_VALUE 3476589
-uint8_t compar_buffer[] =
-{
+uint8_t compar_buffer[] = {
/* Little-endian encoded version of the 16-bit signed integer */
- (uint8_t) ((TEST_INT16_VALUE) & 0xff), (uint8_t) ((TEST_INT16_VALUE >> 8) & 0xff),
+ (uint8_t)((TEST_INT16_VALUE)&0xff),
+ (uint8_t)((TEST_INT16_VALUE >> 8) & 0xff),
/* Little-endian encoded version of the 16-bit unsigned integer */
- (uint8_t) ((TEST_UINT16_VALUE) & 0xff), (uint8_t) ((TEST_UINT16_VALUE >> 8) & 0xff),
+ (uint8_t)((TEST_UINT16_VALUE)&0xff),
+ (uint8_t)((TEST_UINT16_VALUE >> 8) & 0xff),
/* Little-endian encoded version of the 32-bit signed integer */
- (uint8_t) ((TEST_INT32_VALUE) & 0xff), (uint8_t) ((TEST_INT32_VALUE >> 8) & 0xff),
- (uint8_t) ((TEST_INT32_VALUE >> 16) & 0xff), (uint8_t) ((TEST_INT32_VALUE >> 24) & 0xff),
+ (uint8_t)((TEST_INT32_VALUE)&0xff),
+ (uint8_t)((TEST_INT32_VALUE >> 8) & 0xff),
+ (uint8_t)((TEST_INT32_VALUE >> 16) & 0xff),
+ (uint8_t)((TEST_INT32_VALUE >> 24) & 0xff),
/* Little-endian encoded version of the 32-bit unsigned integer */
- (uint8_t) ((TEST_UINT32_VALUE) & 0xff), (uint8_t) ((TEST_UINT32_VALUE >> 8) & 0xff),
- (uint8_t) ((TEST_UINT32_VALUE >> 16) & 0xff), (uint8_t) ((TEST_UINT32_VALUE >> 24) & 0xff),
+ (uint8_t)((TEST_UINT32_VALUE)&0xff),
+ (uint8_t)((TEST_UINT32_VALUE >> 8) & 0xff),
+ (uint8_t)((TEST_UINT32_VALUE >> 16) & 0xff),
+ (uint8_t)((TEST_UINT32_VALUE >> 24) & 0xff),
};
-uint8_t encode_buffer[sizeof(compar_buffer)];
+uint8_t encode_buffer[sizeof(compar_buffer)];
/****************************************************************
**
@@ -51,62 +56,62 @@ uint8_t encode_buffer[sizeof(compar_buffer)];
void
test_metadata(void)
{
- int16_t ei16 = TEST_INT16_VALUE; /* variables to hold the values to encode */
- uint16_t eu16 = TEST_UINT16_VALUE;
- int32_t ei32 = TEST_INT32_VALUE;
- uint32_t eu32 = TEST_UINT32_VALUE;
- int16_t di16; /* variables to hold the decoded values */
- uint16_t du16;
- int32_t di32;
- uint32_t du32;
- uint8_t *p; /* pointer into the buffer being en/de-coded */
+ int16_t ei16 = TEST_INT16_VALUE; /* variables to hold the values to encode */
+ uint16_t eu16 = TEST_UINT16_VALUE;
+ int32_t ei32 = TEST_INT32_VALUE;
+ uint32_t eu32 = TEST_UINT32_VALUE;
+ int16_t di16; /* variables to hold the decoded values */
+ uint16_t du16;
+ int32_t di32;
+ uint32_t du32;
+ uint8_t *p; /* pointer into the buffer being en/de-coded */
/* Output message about test being performed */
MESSAGE(5, ("Testing Metadata Encoding/decoding\n"));
/* Start by encoding the values above */
p = encode_buffer;
- INT16ENCODE(p, ei16); /* Encode the int16 value */
- UINT16ENCODE(p, eu16); /* Encode the uint16 value */
- INT32ENCODE(p, ei32); /* Encode the int32 value */
- UINT32ENCODE(p, eu32); /* Encode the uint32 value */
+ INT16ENCODE(p, ei16); /* Encode the int16 value */
+ UINT16ENCODE(p, eu16); /* Encode the uint16 value */
+ INT32ENCODE(p, ei32); /* Encode the int32 value */
+ UINT32ENCODE(p, eu32); /* Encode the uint32 value */
/* Check if we got what we asked for */
if (HDmemcmp(encode_buffer, compar_buffer, sizeof(compar_buffer)) != 0) {
- unsigned u; /* local counting variable */
+ unsigned u; /* local counting variable */
for (u = 0; u < sizeof(compar_buffer); u++) {
if (compar_buffer[u] != encode_buffer[u])
- TestErrPrintf("Error encoding meta-data at offset %u, wanted: %u, got: %u\n", (unsigned) u, (unsigned) compar_buffer[u], (unsigned) encode_buffer[u]);
- } /* end for */
- } /* end if */
+ TestErrPrintf("Error encoding meta-data at offset %u, wanted: %u, got: %u\n", (unsigned)u,
+ (unsigned)compar_buffer[u], (unsigned)encode_buffer[u]);
+ } /* end for */
+ } /* end if */
/* Test decoding macros */
p = encode_buffer;
- INT16DECODE(p, di16); /* Decode the int16 value */
- UINT16DECODE(p, du16); /* Decode the uint16 value */
- INT32DECODE(p, di32); /* Decode the int32 value */
- UINT32DECODE(p, du32); /* Decode the uint32 value */
+ INT16DECODE(p, di16); /* Decode the int16 value */
+ UINT16DECODE(p, du16); /* Decode the uint16 value */
+ INT32DECODE(p, di32); /* Decode the int32 value */
+ UINT32DECODE(p, du32); /* Decode the uint32 value */
/* Check the values decoded */
if (di16 != TEST_INT16_VALUE)
TestErrPrintf("Error decoding int16 meta-data wanted: %d, got: %d "
- "at %s:%d\n", (int) TEST_INT16_VALUE, (int) di16,
- __FILE__, __LINE__);
+ "at %s:%d\n",
+ (int)TEST_INT16_VALUE, (int)di16, __FILE__, __LINE__);
if (du16 != TEST_UINT16_VALUE)
TestErrPrintf("Error decoding uint16 meta-data wanted: %u, got: %u "
- "at %s:%d\n", (unsigned) TEST_UINT16_VALUE, (unsigned) du16,
- __FILE__, __LINE__);
+ "at %s:%d\n",
+ (unsigned)TEST_UINT16_VALUE, (unsigned)du16, __FILE__, __LINE__);
if (di32 != TEST_INT32_VALUE)
TestErrPrintf("Error decoding int32 meta-data wanted: %ld, got: %ld "
- "at %s:%d\n", (long) TEST_INT32_VALUE, (long) di32,
- __FILE__, __LINE__);
+ "at %s:%d\n",
+ (long)TEST_INT32_VALUE, (long)di32, __FILE__, __LINE__);
if (du32 != TEST_UINT32_VALUE)
TestErrPrintf("Error decoding uint32 meta-data wanted: %lu, got: %lu "
- "at %s:%d\n", (unsigned long) TEST_UINT32_VALUE, (unsigned long) du32,
- __FILE__, __LINE__);
-} /* test_metadata() */
+ "at %s:%d\n",
+ (unsigned long)TEST_UINT32_VALUE, (unsigned long)du32, __FILE__, __LINE__);
+} /* test_metadata() */
-
/*-------------------------------------------------------------------------
* Function: cleanup_metadata
*
@@ -126,4 +131,3 @@ cleanup_metadata(void)
{
/* no file to clean */
}
-
diff --git a/test/tmisc.c b/test/tmisc.c
index 6eb6872..a6db198 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -12,330 +12,323 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tmisc
-*
-* Test miscellaneous features not tested elsewhere. Generally
-* regression tests for bugs that are reported and don't
-* have an existing test to add them to.
-*
-*************************************************************/
+ *
+ * Test program: tmisc
+ *
+ * Test miscellaneous features not tested elsewhere. Generally
+ * regression tests for bugs that are reported and don't
+ * have an existing test to add them to.
+ *
+ *************************************************************/
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5D_TESTING
#include "testhdf5.h"
#include "H5srcdir.h"
-#include "H5Dpkg.h" /* Datasets */
-#include "H5MMprivate.h" /* Memory */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5MMprivate.h" /* Memory */
/* Definitions for misc. test #1 */
-#define MISC1_FILE "tmisc1.h5"
-#define MISC1_VAL (13417386) /* 0xccbbaa */
-#define MISC1_VAL2 (15654348) /* 0xeeddcc */
+#define MISC1_FILE "tmisc1.h5"
+#define MISC1_VAL (13417386) /* 0xccbbaa */
+#define MISC1_VAL2 (15654348) /* 0xeeddcc */
#define MISC1_DSET_NAME "/scalar_set"
/* Definitions for misc. test #2 */
-#define MISC2_FILE_1 "tmisc2a.h5"
-#define MISC2_FILE_2 "tmisc2b.h5"
+#define MISC2_FILE_1 "tmisc2a.h5"
+#define MISC2_FILE_2 "tmisc2b.h5"
#define MISC2_ATT_NAME_1 "scalar_att_1"
#define MISC2_ATT_NAME_2 "scalar_att_2"
typedef struct {
- char *string;
+ char *string;
} misc2_struct;
/* Definitions for misc. test #3 */
-#define MISC3_FILE "tmisc3.h5"
-#define MISC3_RANK 2
-#define MISC3_DIM1 6
-#define MISC3_DIM2 6
-#define MISC3_CHUNK_DIM1 2
-#define MISC3_CHUNK_DIM2 2
-#define MISC3_FILL_VALUE 2
-#define MISC3_DSET_NAME "/chunked"
+#define MISC3_FILE "tmisc3.h5"
+#define MISC3_RANK 2
+#define MISC3_DIM1 6
+#define MISC3_DIM2 6
+#define MISC3_CHUNK_DIM1 2
+#define MISC3_CHUNK_DIM2 2
+#define MISC3_FILL_VALUE 2
+#define MISC3_DSET_NAME "/chunked"
/* Definitions for misc. test #4 */
-#define MISC4_FILE_1 "tmisc4a.h5"
-#define MISC4_FILE_2 "tmisc4b.h5"
-#define MISC4_GROUP_1 "/Group1"
-#define MISC4_GROUP_2 "/Group2"
+#define MISC4_FILE_1 "tmisc4a.h5"
+#define MISC4_FILE_2 "tmisc4b.h5"
+#define MISC4_GROUP_1 "/Group1"
+#define MISC4_GROUP_2 "/Group2"
/* Definitions for misc. test #5 */
-#define MISC5_FILE "tmisc5.h5"
-#define MISC5_DSETNAME "dset1"
-#define MISC5_DSETRANK 1
-#define MISC5_NELMTOPLVL 1
-#define MISC5_DBGNELM1 2
-#define MISC5_DBGNELM2 1
-#define MISC5_DBGNELM3 1
-#define MISC5_DBGELVAL1 999999999
-#define MISC5_DBGELVAL2 888888888
-#define MISC5_DBGELVAL3 777777777
-
-typedef struct
-{
- int st1_el1;
+#define MISC5_FILE "tmisc5.h5"
+#define MISC5_DSETNAME "dset1"
+#define MISC5_DSETRANK 1
+#define MISC5_NELMTOPLVL 1
+#define MISC5_DBGNELM1 2
+#define MISC5_DBGNELM2 1
+#define MISC5_DBGNELM3 1
+#define MISC5_DBGELVAL1 999999999
+#define MISC5_DBGELVAL2 888888888
+#define MISC5_DBGELVAL3 777777777
+
+typedef struct {
+ int st1_el1;
hvl_t st1_el2;
} misc5_struct1;
-typedef struct
-{
- int st2_el1;
+typedef struct {
+ int st2_el1;
hvl_t st2_el2;
} misc5_struct2;
-typedef struct
-{
+typedef struct {
int st3_el1;
} misc5_struct3;
-typedef struct
-{
- hid_t st3h_base;
- hid_t st3h_id;
+typedef struct {
+ hid_t st3h_base;
+ hid_t st3h_id;
} misc5_struct3_hndl;
-typedef struct
-{
- hid_t st2h_base;
- hid_t st2h_id;
+typedef struct {
+ hid_t st2h_base;
+ hid_t st2h_id;
misc5_struct3_hndl *st2h_st3hndl;
} misc5_struct2_hndl;
-typedef struct
-{
- hid_t st1h_base;
- hid_t st1h_id;
+typedef struct {
+ hid_t st1h_base;
+ hid_t st1h_id;
misc5_struct2_hndl *st1h_st2hndl;
} misc5_struct1_hndl;
/* Definitions for misc. test #6 */
-#define MISC6_FILE "tmisc6.h5"
-#define MISC6_DSETNAME1 "dset1"
-#define MISC6_DSETNAME2 "dset2"
-#define MISC6_NUMATTR 16
+#define MISC6_FILE "tmisc6.h5"
+#define MISC6_DSETNAME1 "dset1"
+#define MISC6_DSETNAME2 "dset2"
+#define MISC6_NUMATTR 16
/* Definitions for misc. test #7 */
-#define MISC7_FILE "tmisc7.h5"
-#define MISC7_DSETNAME1 "Dataset1"
-#define MISC7_DSETNAME2 "Dataset2"
-#define MISC7_TYPENAME1 "Datatype1"
-#define MISC7_TYPENAME2 "Datatype2"
+#define MISC7_FILE "tmisc7.h5"
+#define MISC7_DSETNAME1 "Dataset1"
+#define MISC7_DSETNAME2 "Dataset2"
+#define MISC7_TYPENAME1 "Datatype1"
+#define MISC7_TYPENAME2 "Datatype2"
/* Definitions for misc. test #8 */
-#define MISC8_FILE "tmisc8.h5"
-#define MISC8_DSETNAME1 "Dataset1"
-#define MISC8_DSETNAME4 "Dataset4"
-#define MISC8_DSETNAME5 "Dataset5"
-#define MISC8_DSETNAME8 "Dataset8"
+#define MISC8_FILE "tmisc8.h5"
+#define MISC8_DSETNAME1 "Dataset1"
+#define MISC8_DSETNAME4 "Dataset4"
+#define MISC8_DSETNAME5 "Dataset5"
+#define MISC8_DSETNAME8 "Dataset8"
#ifndef H5_HAVE_PARALLEL
-#define MISC8_DSETNAME2 "Dataset2"
-#define MISC8_DSETNAME3 "Dataset3"
-#define MISC8_DSETNAME6 "Dataset6"
-#define MISC8_DSETNAME7 "Dataset7"
-#define MISC8_DSETNAME9 "Dataset9"
-#define MISC8_DSETNAME10 "Dataset10"
+#define MISC8_DSETNAME2 "Dataset2"
+#define MISC8_DSETNAME3 "Dataset3"
+#define MISC8_DSETNAME6 "Dataset6"
+#define MISC8_DSETNAME7 "Dataset7"
+#define MISC8_DSETNAME9 "Dataset9"
+#define MISC8_DSETNAME10 "Dataset10"
#endif
-#define MISC8_RANK 2
-#define MISC8_DIM0 50
-#define MISC8_DIM1 50
-#define MISC8_CHUNK_DIM0 10
-#define MISC8_CHUNK_DIM1 10
+#define MISC8_RANK 2
+#define MISC8_DIM0 50
+#define MISC8_DIM1 50
+#define MISC8_CHUNK_DIM0 10
+#define MISC8_CHUNK_DIM1 10
/* Definitions for misc. test #9 */
-#define MISC9_FILE "tmisc9.h5"
+#define MISC9_FILE "tmisc9.h5"
/* Definitions for misc. test #10 */
-#define MISC10_FILE_OLD "tmtimeo.h5"
-#define MISC10_FILE_NEW "tmisc10.h5"
-#define MISC10_DSETNAME "Dataset1"
+#define MISC10_FILE_OLD "tmtimeo.h5"
+#define MISC10_FILE_NEW "tmisc10.h5"
+#define MISC10_DSETNAME "Dataset1"
/* Definitions for misc. test #11 */
-#define MISC11_FILE "tmisc11.h5"
-#define MISC11_USERBLOCK 1024
-#define MISC11_SIZEOF_OFF 4
-#define MISC11_SIZEOF_LEN 4
-#define MISC11_SYM_LK 8
-#define MISC11_SYM_IK 32
-#define MISC11_ISTORE_IK 64
-#define MISC11_NINDEXES 1
+#define MISC11_FILE "tmisc11.h5"
+#define MISC11_USERBLOCK 1024
+#define MISC11_SIZEOF_OFF 4
+#define MISC11_SIZEOF_LEN 4
+#define MISC11_SYM_LK 8
+#define MISC11_SYM_IK 32
+#define MISC11_ISTORE_IK 64
+#define MISC11_NINDEXES 1
/* Definitions for misc. test #12 */
-#define MISC12_FILE "tmisc12.h5"
-#define MISC12_DSET_NAME "Dataset"
-#define MISC12_SPACE1_RANK 1
-#define MISC12_SPACE1_DIM1 4
-#define MISC12_CHUNK_SIZE 2
-#define MISC12_APPEND_SIZE 5
+#define MISC12_FILE "tmisc12.h5"
+#define MISC12_DSET_NAME "Dataset"
+#define MISC12_SPACE1_RANK 1
+#define MISC12_SPACE1_DIM1 4
+#define MISC12_CHUNK_SIZE 2
+#define MISC12_APPEND_SIZE 5
/* Definitions for misc. test #13 */
-#define MISC13_FILE_1 "tmisc13a.h5"
-#define MISC13_FILE_2 "tmisc13b.h5"
-#define MISC13_DSET1_NAME "Dataset1"
-#define MISC13_DSET2_NAME "Dataset2"
-#define MISC13_DSET3_NAME "Dataset3"
-#define MISC13_GROUP1_NAME "Group1"
-#define MISC13_GROUP2_NAME "Group2"
-#define MISC13_DTYPE_NAME "Datatype"
-#define MISC13_RANK 1
-#define MISC13_DIM1 600
-#define MISC13_CHUNK_DIM1 10
-#define MISC13_USERBLOCK_SIZE 512
-#define MISC13_COPY_BUF_SIZE 4096
+#define MISC13_FILE_1 "tmisc13a.h5"
+#define MISC13_FILE_2 "tmisc13b.h5"
+#define MISC13_DSET1_NAME "Dataset1"
+#define MISC13_DSET2_NAME "Dataset2"
+#define MISC13_DSET3_NAME "Dataset3"
+#define MISC13_GROUP1_NAME "Group1"
+#define MISC13_GROUP2_NAME "Group2"
+#define MISC13_DTYPE_NAME "Datatype"
+#define MISC13_RANK 1
+#define MISC13_DIM1 600
+#define MISC13_CHUNK_DIM1 10
+#define MISC13_USERBLOCK_SIZE 512
+#define MISC13_COPY_BUF_SIZE 4096
/* Definitions for misc. test #14 */
-#define MISC14_FILE "tmisc14.h5"
-#define MISC14_DSET1_NAME "Dataset1"
-#define MISC14_DSET2_NAME "Dataset2"
-#define MISC14_DSET3_NAME "Dataset3"
-#define MISC14_METADATA_SIZE 4096
+#define MISC14_FILE "tmisc14.h5"
+#define MISC14_DSET1_NAME "Dataset1"
+#define MISC14_DSET2_NAME "Dataset2"
+#define MISC14_DSET3_NAME "Dataset3"
+#define MISC14_METADATA_SIZE 4096
/* Definitions for misc. test #15 */
-#define MISC15_FILE "tmisc15.h5"
+#define MISC15_FILE "tmisc15.h5"
/* Definitions for misc. test #16 */
-#define MISC16_FILE "tmisc16.h5"
-#define MISC16_SPACE_DIM 4
-#define MISC16_SPACE_RANK 1
-#define MISC16_STR_SIZE 8
-#define MISC16_DSET_NAME "Dataset"
+#define MISC16_FILE "tmisc16.h5"
+#define MISC16_SPACE_DIM 4
+#define MISC16_SPACE_RANK 1
+#define MISC16_STR_SIZE 8
+#define MISC16_DSET_NAME "Dataset"
/* Definitions for misc. test #17 */
-#define MISC17_FILE "tmisc17.h5"
-#define MISC17_SPACE_RANK 2
-#define MISC17_SPACE_DIM1 4
-#define MISC17_SPACE_DIM2 8
-#define MISC17_DSET_NAME "Dataset"
+#define MISC17_FILE "tmisc17.h5"
+#define MISC17_SPACE_RANK 2
+#define MISC17_SPACE_DIM1 4
+#define MISC17_SPACE_DIM2 8
+#define MISC17_DSET_NAME "Dataset"
/* Definitions for misc. test #18 */
-#define MISC18_FILE "tmisc18.h5"
-#define MISC18_DSET1_NAME "Dataset1"
-#define MISC18_DSET2_NAME "Dataset2"
+#define MISC18_FILE "tmisc18.h5"
+#define MISC18_DSET1_NAME "Dataset1"
+#define MISC18_DSET2_NAME "Dataset2"
/* Definitions for misc. test #19 */
-#define MISC19_FILE "tmisc19.h5"
-#define MISC19_DSET_NAME "Dataset"
-#define MISC19_ATTR_NAME "Attribute"
-#define MISC19_GROUP_NAME "Group"
+#define MISC19_FILE "tmisc19.h5"
+#define MISC19_DSET_NAME "Dataset"
+#define MISC19_ATTR_NAME "Attribute"
+#define MISC19_GROUP_NAME "Group"
/* Definitions for misc. test #20 */
-#define MISC20_FILE "tmisc20.h5"
-#define MISC20_FILE_OLD "tlayouto.h5"
-#define MISC20_DSET_NAME "Dataset"
-#define MISC20_DSET2_NAME "Dataset2"
-#define MISC20_SPACE_RANK 2
+#define MISC20_FILE "tmisc20.h5"
+#define MISC20_FILE_OLD "tlayouto.h5"
+#define MISC20_DSET_NAME "Dataset"
+#define MISC20_DSET2_NAME "Dataset2"
+#define MISC20_SPACE_RANK 2
/* Make sure the product of the following 2 does not get too close to */
/* 64 bits, risking an overflow. */
-#define MISC20_SPACE_DIM0 (8*1024*1024*(uint64_t)1024)
-#define MISC20_SPACE_DIM1 ((256*1024*(uint64_t)1024)+1)
-#define MISC20_SPACE2_DIM0 8
-#define MISC20_SPACE2_DIM1 4
+#define MISC20_SPACE_DIM0 (8 * 1024 * 1024 * (uint64_t)1024)
+#define MISC20_SPACE_DIM1 ((256 * 1024 * (uint64_t)1024) + 1)
+#define MISC20_SPACE2_DIM0 8
+#define MISC20_SPACE2_DIM1 4
#ifdef H5_HAVE_FILTER_SZIP
/* Definitions for misc. test #21 */
-#define MISC21_FILE "tmisc21.h5"
-#define MISC21_DSET_NAME "Dataset"
-#define MISC21_SPACE_RANK 2
-#define MISC21_SPACE_DIM0 7639
-#define MISC21_SPACE_DIM1 6308
-#define MISC21_CHUNK_DIM0 2048
-#define MISC21_CHUNK_DIM1 2048
+#define MISC21_FILE "tmisc21.h5"
+#define MISC21_DSET_NAME "Dataset"
+#define MISC21_SPACE_RANK 2
+#define MISC21_SPACE_DIM0 7639
+#define MISC21_SPACE_DIM1 6308
+#define MISC21_CHUNK_DIM0 2048
+#define MISC21_CHUNK_DIM1 2048
/* Definitions for misc. test #22 */
-#define MISC22_FILE "tmisc22.h5"
-#define MISC22_DSET_NAME "Dataset"
-#define MISC22_SPACE_RANK 2
-#define MISC22_CHUNK_DIM0 512
-#define MISC22_CHUNK_DIM1 512
-#define MISC22_SPACE_DIM0 639
-#define MISC22_SPACE_DIM1 1308
+#define MISC22_FILE "tmisc22.h5"
+#define MISC22_DSET_NAME "Dataset"
+#define MISC22_SPACE_RANK 2
+#define MISC22_CHUNK_DIM0 512
+#define MISC22_CHUNK_DIM1 512
+#define MISC22_SPACE_DIM0 639
+#define MISC22_SPACE_DIM1 1308
#endif /* H5_HAVE_FILTER_SZIP */
/* Definitions for misc. test #23 */
-#define MISC23_FILE "tmisc23.h5"
-#define MISC23_NAME_BUF_SIZE 40
+#define MISC23_FILE "tmisc23.h5"
+#define MISC23_NAME_BUF_SIZE 40
/* Definitions for misc. test #24 */
-#define MISC24_FILE "tmisc24.h5"
-#define MISC24_GROUP_NAME "group"
-#define MISC24_GROUP_LINK "group_link"
-#define MISC24_DATASET_NAME "dataset"
-#define MISC24_DATASET_LINK "dataset_link"
-#define MISC24_DATATYPE_NAME "datatype"
-#define MISC24_DATATYPE_LINK "datatype_link"
+#define MISC24_FILE "tmisc24.h5"
+#define MISC24_GROUP_NAME "group"
+#define MISC24_GROUP_LINK "group_link"
+#define MISC24_DATASET_NAME "dataset"
+#define MISC24_DATASET_LINK "dataset_link"
+#define MISC24_DATATYPE_NAME "datatype"
+#define MISC24_DATATYPE_LINK "datatype_link"
/* Definitions for misc. test #25 'a', 'b' & 'c' */
-#define MISC25A_FILE "foo.h5"
-#define MISC25A_GROUP0_NAME "grp0"
-#define MISC25A_GROUP1_NAME "/grp0/grp1"
-#define MISC25A_GROUP2_NAME "/grp0/grp2"
-#define MISC25A_GROUP3_NAME "/grp0/grp3"
-#define MISC25A_ATTR1_NAME "_long attribute_"
-#define MISC25A_ATTR1_LEN 11
-#define MISC25A_ATTR2_NAME "_short attr__"
-#define MISC25A_ATTR2_LEN 11
-#define MISC25A_ATTR3_NAME "_short attr__"
-#define MISC25A_ATTR3_LEN 1
-#define MISC25B_FILE "mergemsg.h5"
-#define MISC25B_GROUP "grp1"
-#define MISC25C_FILE "nc4_rename.h5"
-#define MISC25C_DSETNAME "da"
-#define MISC25C_DSETNAME2 "dz"
-#define MISC25C_DSETGRPNAME "ga"
-#define MISC25C_GRPNAME "gb"
-#define MISC25C_GRPNAME2 "gc"
-#define MISC25C_ATTRNAME "aa"
-#define MISC25C_ATTRNAME2 "ab"
+#define MISC25A_FILE "foo.h5"
+#define MISC25A_GROUP0_NAME "grp0"
+#define MISC25A_GROUP1_NAME "/grp0/grp1"
+#define MISC25A_GROUP2_NAME "/grp0/grp2"
+#define MISC25A_GROUP3_NAME "/grp0/grp3"
+#define MISC25A_ATTR1_NAME "_long attribute_"
+#define MISC25A_ATTR1_LEN 11
+#define MISC25A_ATTR2_NAME "_short attr__"
+#define MISC25A_ATTR2_LEN 11
+#define MISC25A_ATTR3_NAME "_short attr__"
+#define MISC25A_ATTR3_LEN 1
+#define MISC25B_FILE "mergemsg.h5"
+#define MISC25B_GROUP "grp1"
+#define MISC25C_FILE "nc4_rename.h5"
+#define MISC25C_DSETNAME "da"
+#define MISC25C_DSETNAME2 "dz"
+#define MISC25C_DSETGRPNAME "ga"
+#define MISC25C_GRPNAME "gb"
+#define MISC25C_GRPNAME2 "gc"
+#define MISC25C_ATTRNAME "aa"
+#define MISC25C_ATTRNAME2 "ab"
/* Definitions for misc. test #26 */
-#define MISC26_FILE "dcpl_file"
+#define MISC26_FILE "dcpl_file"
/* Definitions for misc. test #27 */
/* (Note that this test file is generated by the "gen_bad_ohdr.c" code) */
-#define MISC27_FILE "tbad_msg_count.h5"
-#define MISC27_GROUP "Group"
+#define MISC27_FILE "tbad_msg_count.h5"
+#define MISC27_GROUP "Group"
/* Definitions for misc. test #28 */
-#define MISC28_FILE "tmisc28.h5"
-#define MISC28_SIZE 10
-#define MISC28_NSLOTS 10000
+#define MISC28_FILE "tmisc28.h5"
+#define MISC28_SIZE 10
+#define MISC28_NSLOTS 10000
/* Definitions for misc. test #29 */
-#define MISC29_ORIG_FILE "specmetaread.h5"
-#define MISC29_COPY_FILE "tmisc29.h5"
-#define MISC29_DSETNAME "dset2"
+#define MISC29_ORIG_FILE "specmetaread.h5"
+#define MISC29_COPY_FILE "tmisc29.h5"
+#define MISC29_DSETNAME "dset2"
/* Definitions for misc. test #30 */
-#define MISC30_FILE "tmisc30.h5"
+#define MISC30_FILE "tmisc30.h5"
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Definitions for misc. test #31 */
-#define MISC31_FILE "tmisc31.h5"
-#define MISC31_DSETNAME "dset"
-#define MISC31_ATTRNAME1 "attr1"
-#define MISC31_ATTRNAME2 "attr2"
-#define MISC31_GROUPNAME "group"
-#define MISC31_PROPNAME "misc31_prop"
-#define MISC31_DTYPENAME "dtype"
+#define MISC31_FILE "tmisc31.h5"
+#define MISC31_DSETNAME "dset"
+#define MISC31_ATTRNAME1 "attr1"
+#define MISC31_ATTRNAME2 "attr2"
+#define MISC31_GROUPNAME "group"
+#define MISC31_PROPNAME "misc31_prop"
+#define MISC31_DTYPENAME "dtype"
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Definitions for misc. test #33 */
/* Note that this test file is generated by "gen_bad_offset.c" */
/* and bad offset values are written to that file for testing */
-#define MISC33_FILE "bad_offset.h5"
+#define MISC33_FILE "bad_offset.h5"
/* Definitions for misc. test #35 */
-#define MISC35_SPACE_RANK 3
-#define MISC35_SPACE_DIM1 3
-#define MISC35_SPACE_DIM2 15
-#define MISC35_SPACE_DIM3 13
-#define MISC35_NPOINTS 10
-
+#define MISC35_SPACE_RANK 3
+#define MISC35_SPACE_DIM1 3
+#define MISC35_SPACE_DIM2 15
+#define MISC35_SPACE_DIM3 13
+#define MISC35_NPOINTS 10
/****************************************************************
**
@@ -346,9 +339,9 @@ typedef struct
static void
test_misc1(void)
{
- int i;
- int i_check;
- hid_t file, dataspace, dataset;
+ int i;
+ int i_check;
+ hid_t file, dataspace, dataset;
herr_t ret;
/* Output message about test being performed */
@@ -361,10 +354,11 @@ test_misc1(void)
CHECK(dataspace, FAIL, "H5Screate");
/* Write the dataset the first time. */
- dataset = H5Dcreate2(file, MISC1_DSET_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset =
+ H5Dcreate2(file, MISC1_DSET_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
- i = MISC1_VAL;
+ i = MISC1_VAL;
ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &i);
CHECK(ret, FAIL, "H5Dwrite");
@@ -376,10 +370,11 @@ test_misc1(void)
CHECK(ret, FAIL, "H5Ldelete");
/* Write the dataset for the second time with a different value. */
- dataset = H5Dcreate2(file, MISC1_DSET_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset =
+ H5Dcreate2(file, MISC1_DSET_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
- i = MISC1_VAL2;
+ i = MISC1_VAL2;
ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &i);
CHECK(ret, FAIL, "H5Dwrite");
@@ -404,7 +399,7 @@ test_misc1(void)
ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &i_check);
CHECK(ret, FAIL, "H5Dread");
- VERIFY(i_check,MISC1_VAL2,"H5Dread");
+ VERIFY(i_check, MISC1_VAL2, "H5Dread");
ret = H5Sclose(dataspace);
CHECK(ret, FAIL, "H5Sclose");
@@ -417,12 +412,13 @@ test_misc1(void)
} /* end test_misc1() */
-static hid_t misc2_create_type(void)
+static hid_t
+misc2_create_type(void)
{
- hid_t type, type_tmp;
+ hid_t type, type_tmp;
herr_t ret;
- type_tmp = H5Tcopy (H5T_C_S1);
+ type_tmp = H5Tcopy(H5T_C_S1);
CHECK(type_tmp, FAIL, "H5Tcopy");
ret = H5Tset_size(type_tmp, H5T_VARIABLE);
@@ -440,14 +436,15 @@ static hid_t misc2_create_type(void)
return type;
}
-static void test_misc2_write_attribute(void)
+static void
+test_misc2_write_attribute(void)
{
- hid_t file1, file2, root1, root2, dataspace, att1, att2;
- hid_t type;
- herr_t ret;
+ hid_t file1, file2, root1, root2, dataspace, att1, att2;
+ hid_t type;
+ herr_t ret;
misc2_struct data, data_check;
- char *string_att1 = HDstrdup("string attribute in file one");
- char *string_att2 = HDstrdup("string attribute in file two");
+ char * string_att1 = HDstrdup("string attribute in file one");
+ char * string_att2 = HDstrdup("string attribute in file two");
type = misc2_create_type();
@@ -523,13 +520,13 @@ static void test_misc2_write_attribute(void)
return;
}
-
-static void test_misc2_read_attribute(const char *filename, const char *att_name)
+static void
+test_misc2_read_attribute(const char *filename, const char *att_name)
{
- hid_t file, root, att;
- hid_t type;
- hid_t space;
- herr_t ret;
+ hid_t file, root, att;
+ hid_t type;
+ hid_t space;
+ herr_t ret;
misc2_struct data_check;
type = misc2_create_type();
@@ -596,14 +593,14 @@ test_misc2(void)
static void
test_misc3(void)
{
- hid_t file, dataspace, dataset, dcpl;
- int rank=MISC3_RANK;
- hsize_t dims[MISC3_RANK]={MISC3_DIM1,MISC3_DIM2};
- hsize_t chunk_dims[MISC3_RANK]={MISC3_CHUNK_DIM1,MISC3_CHUNK_DIM2};
- int fill=MISC3_FILL_VALUE;
- int read_buf[MISC3_DIM1][MISC3_DIM2];
- int i,j;
- herr_t ret;
+ hid_t file, dataspace, dataset, dcpl;
+ int rank = MISC3_RANK;
+ hsize_t dims[MISC3_RANK] = {MISC3_DIM1, MISC3_DIM2};
+ hsize_t chunk_dims[MISC3_RANK] = {MISC3_CHUNK_DIM1, MISC3_CHUNK_DIM2};
+ int fill = MISC3_FILL_VALUE;
+ int read_buf[MISC3_DIM1][MISC3_DIM2];
+ int i, j;
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing reading from chunked dataset with non-zero fill-value\n"));
@@ -612,7 +609,7 @@ test_misc3(void)
CHECK(file, FAIL, "H5Fcreate");
/* Create a simple dataspace */
- dataspace = H5Screate_simple(rank,dims,NULL);
+ dataspace = H5Screate_simple(rank, dims, NULL);
CHECK(dataspace, FAIL, "H5Screate_simple");
/* Create a dataset creation property list */
@@ -620,11 +617,11 @@ test_misc3(void)
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set the chunk information */
- ret = H5Pset_chunk(dcpl,rank,chunk_dims);
+ ret = H5Pset_chunk(dcpl, rank, chunk_dims);
CHECK(dcpl, FAIL, "H5Pset_chunk");
/* Set the fill-value information */
- ret = H5Pset_fill_value(dcpl,H5T_NATIVE_INT,&fill);
+ ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill);
CHECK(dcpl, FAIL, "H5Pset_fill_value");
/* Create the dataset */
@@ -635,9 +632,9 @@ test_misc3(void)
ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &read_buf);
CHECK(ret, FAIL, "H5Dread");
- for(i=0; i<MISC3_DIM1; i++)
- for(j=0; j<MISC3_DIM2; j++)
- VERIFY(read_buf[i][j],fill,"H5Dread");
+ for (i = 0; i < MISC3_DIM1; i++)
+ for (j = 0; j < MISC3_DIM2; j++)
+ VERIFY(read_buf[i][j], fill, "H5Dread");
/* Release resources */
ret = H5Pclose(dcpl);
@@ -662,9 +659,9 @@ test_misc3(void)
static void
test_misc4(void)
{
- hid_t file1, file2, group1, group2, group3;
+ hid_t file1, file2, group1, group2, group3;
H5O_info2_t oinfo1, oinfo2, oinfo3;
- herr_t ret;
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing fileno working in H5O_info_t\n"));
@@ -699,9 +696,9 @@ test_misc4(void)
VERIFY(oinfo1.fileno, oinfo2.fileno, "H5Oget_info_by_name");
/* Verify that the fileno values are not the same between file1 & file2 */
- if(oinfo1.fileno == oinfo3.fileno)
+ if (oinfo1.fileno == oinfo3.fileno)
TestErrPrintf("Error on line %d: oinfo1.fileno != oinfo3.fileno\n", __LINE__);
- if(oinfo2.fileno == oinfo3.fileno)
+ if (oinfo2.fileno == oinfo3.fileno)
TestErrPrintf("Error on line %d: oinfo2.fileno != oinfo3.fileno\n", __LINE__);
/* Close the objects */
@@ -732,8 +729,8 @@ test_misc4(void)
static misc5_struct3_hndl *
create_struct3(void)
{
- misc5_struct3_hndl *str3hndl; /* New 'struct3' created */
- herr_t ret; /* For error checking */
+ misc5_struct3_hndl *str3hndl; /* New 'struct3' created */
+ herr_t ret; /* For error checking */
str3hndl = (misc5_struct3_hndl *)HDmalloc(sizeof(misc5_struct3_hndl));
CHECK_PTR(str3hndl, "malloc");
@@ -741,11 +738,11 @@ create_struct3(void)
str3hndl->st3h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct3));
CHECK(str3hndl->st3h_base, FAIL, "H5Tcreate");
- ret = H5Tinsert(str3hndl->st3h_base, "st3_el1", HOFFSET( misc5_struct3, st3_el1), H5T_NATIVE_INT);
- CHECK(ret,FAIL,"H5Tinsert");
+ ret = H5Tinsert(str3hndl->st3h_base, "st3_el1", HOFFSET(misc5_struct3, st3_el1), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
str3hndl->st3h_id = H5Tvlen_create(str3hndl->st3h_base);
- CHECK(str3hndl->st3h_id,FAIL,"H5Tvlen_create");
+ CHECK(str3hndl->st3h_id, FAIL, "H5Tvlen_create");
return str3hndl;
}
@@ -753,13 +750,13 @@ create_struct3(void)
static void
delete_struct3(misc5_struct3_hndl *str3hndl)
{
- herr_t ret; /* For error checking */
+ herr_t ret; /* For error checking */
ret = H5Tclose(str3hndl->st3h_id);
- CHECK(ret,FAIL,"H5Tclose");
+ CHECK(ret, FAIL, "H5Tclose");
ret = H5Tclose(str3hndl->st3h_base);
- CHECK(ret,FAIL,"H5Tclose");
+ CHECK(ret, FAIL, "H5Tclose");
HDfree(str3hndl);
}
@@ -767,7 +764,7 @@ delete_struct3(misc5_struct3_hndl *str3hndl)
static void
set_struct3(misc5_struct3 *buf)
{
- buf->st3_el1=MISC5_DBGELVAL3;
+ buf->st3_el1 = MISC5_DBGELVAL3;
}
/*********************** struct2 ***********************/
@@ -775,8 +772,8 @@ set_struct3(misc5_struct3 *buf)
static misc5_struct2_hndl *
create_struct2(void)
{
- misc5_struct2_hndl *str2hndl; /* New 'struct2' created */
- herr_t ret; /* For error checking */
+ misc5_struct2_hndl *str2hndl; /* New 'struct2' created */
+ herr_t ret; /* For error checking */
str2hndl = (misc5_struct2_hndl *)HDmalloc(sizeof(misc5_struct2_hndl));
CHECK_PTR(str2hndl, "HDmalloc");
@@ -790,11 +787,12 @@ create_struct2(void)
str2hndl->st2h_st3hndl = create_struct3();
CHECK_PTR(str2hndl->st2h_st3hndl, "create_struct3");
- ret = H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id);
- CHECK(ret,FAIL,"H5Tinsert");
+ ret = H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2),
+ str2hndl->st2h_st3hndl->st3h_id);
+ CHECK(ret, FAIL, "H5Tinsert");
str2hndl->st2h_id = H5Tvlen_create(str2hndl->st2h_base);
- CHECK(str2hndl->st2h_id,FAIL,"H5Tvlen_create");
+ CHECK(str2hndl->st2h_id, FAIL, "H5Tvlen_create");
return str2hndl;
}
@@ -802,15 +800,15 @@ create_struct2(void)
static void
delete_struct2(misc5_struct2_hndl *str2hndl)
{
- herr_t ret; /* For error checking */
+ herr_t ret; /* For error checking */
- ret=H5Tclose(str2hndl->st2h_id);
- CHECK(ret,FAIL,"H5Tclose");
+ ret = H5Tclose(str2hndl->st2h_id);
+ CHECK(ret, FAIL, "H5Tclose");
delete_struct3(str2hndl->st2h_st3hndl);
H5Tclose(str2hndl->st2h_base);
- CHECK(ret,FAIL,"H5Tclose");
+ CHECK(ret, FAIL, "H5Tclose");
HDfree(str2hndl);
}
@@ -818,15 +816,15 @@ delete_struct2(misc5_struct2_hndl *str2hndl)
static void
set_struct2(misc5_struct2 *buf)
{
- unsigned i; /* Local index variable */
+ unsigned i; /* Local index variable */
- buf->st2_el1 = MISC5_DBGELVAL2;
+ buf->st2_el1 = MISC5_DBGELVAL2;
buf->st2_el2.len = MISC5_DBGNELM3;
- buf->st2_el2.p = HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3));
+ buf->st2_el2.p = HDmalloc((buf->st2_el2.len) * sizeof(misc5_struct3));
CHECK_PTR(buf->st2_el2.p, "HDmalloc");
- for(i=0; i<(buf->st2_el2.len); i++)
+ for (i = 0; i < (buf->st2_el2.len); i++)
set_struct3(&(((misc5_struct3 *)(buf->st2_el2.p))[i]));
}
@@ -841,8 +839,8 @@ clear_struct2(misc5_struct2 *buf)
static misc5_struct1_hndl *
create_struct1(void)
{
- misc5_struct1_hndl *str1hndl; /* New 'struct1' created */
- herr_t ret; /* For error checking */
+ misc5_struct1_hndl *str1hndl; /* New 'struct1' created */
+ herr_t ret; /* For error checking */
str1hndl = (misc5_struct1_hndl *)HDmalloc(sizeof(misc5_struct1_hndl));
CHECK_PTR(str1hndl, "HDmalloc");
@@ -853,14 +851,15 @@ create_struct1(void)
ret = H5Tinsert(str1hndl->st1h_base, "st1_el1", HOFFSET(misc5_struct1, st1_el1), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- str1hndl->st1h_st2hndl=create_struct2();
+ str1hndl->st1h_st2hndl = create_struct2();
CHECK_PTR(str1hndl->st1h_st2hndl, "create_struct2");
- ret = H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id);
- CHECK(ret,FAIL,"H5Tinsert");
+ ret = H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2),
+ str1hndl->st1h_st2hndl->st2h_id);
+ CHECK(ret, FAIL, "H5Tinsert");
str1hndl->st1h_id = H5Tvlen_create(str1hndl->st1h_base);
- CHECK(str1hndl->st1h_id,FAIL,"H5Tvlen_create");
+ CHECK(str1hndl->st1h_id, FAIL, "H5Tvlen_create");
return str1hndl;
}
@@ -868,15 +867,15 @@ create_struct1(void)
static void
delete_struct1(misc5_struct1_hndl *str1hndl)
{
- herr_t ret; /* For error checking */
+ herr_t ret; /* For error checking */
ret = H5Tclose(str1hndl->st1h_id);
- CHECK(ret,FAIL,"H5Tclose");
+ CHECK(ret, FAIL, "H5Tclose");
delete_struct2(str1hndl->st1h_st2hndl);
ret = H5Tclose(str1hndl->st1h_base);
- CHECK(ret,FAIL,"H5Tclose");
+ CHECK(ret, FAIL, "H5Tclose");
HDfree(str1hndl);
}
@@ -884,15 +883,15 @@ delete_struct1(misc5_struct1_hndl *str1hndl)
static void
set_struct1(misc5_struct1 *buf)
{
- unsigned i; /* Local index variable */
+ unsigned i; /* Local index variable */
- buf->st1_el1=MISC5_DBGELVAL1;
- buf->st1_el2.len=MISC5_DBGNELM2;
+ buf->st1_el1 = MISC5_DBGELVAL1;
+ buf->st1_el2.len = MISC5_DBGNELM2;
- buf->st1_el2.p=HDmalloc((buf->st1_el2.len)*sizeof(misc5_struct2));
+ buf->st1_el2.p = HDmalloc((buf->st1_el2.len) * sizeof(misc5_struct2));
CHECK_PTR(buf->st1_el2.p, "HDmalloc");
- for(i=0; i<(buf->st1_el2.len); i++)
+ for (i = 0; i < (buf->st1_el2.len); i++)
set_struct2(&(((misc5_struct2 *)(buf->st1_el2.p))[i]));
}
@@ -901,21 +900,21 @@ clear_struct1(misc5_struct1 *buf)
{
unsigned i;
- for(i=0;i<buf->st1_el2.len;i++)
- clear_struct2(&((( misc5_struct2 *)(buf->st1_el2.p))[i]));
+ for (i = 0; i < buf->st1_el2.len; i++)
+ clear_struct2(&(((misc5_struct2 *)(buf->st1_el2.p))[i]));
HDfree(buf->st1_el2.p);
}
static void
test_misc5(void)
{
- hid_t loc_id, space_id, dataset_id;
- hid_t mem_type_id;
+ hid_t loc_id, space_id, dataset_id;
+ hid_t mem_type_id;
misc5_struct1_hndl *str1hndl;
- hsize_t dims[MISC5_DSETRANK];
- hvl_t buf;
- unsigned i,j,k;
- herr_t ret;
+ hsize_t dims[MISC5_DSETRANK];
+ hvl_t buf;
+ unsigned i, j, k;
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing several level deep nested compound & VL datatypes \n"));
@@ -929,21 +928,22 @@ test_misc5(void)
CHECK_PTR(str1hndl, "create_struct1");
/* Create the dataspace */
- dims[0] = MISC5_NELMTOPLVL;
+ dims[0] = MISC5_NELMTOPLVL;
space_id = H5Screate_simple(MISC5_DSETRANK, dims, NULL);
CHECK(space_id, FAIL, "H5Screate_simple");
/* Create the dataset */
- dataset_id = H5Dcreate2(loc_id, MISC5_DSETNAME, str1hndl->st1h_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset_id = H5Dcreate2(loc_id, MISC5_DSETNAME, str1hndl->st1h_id, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(dataset_id, FAIL, "H5Dcreate2");
/* Create the variable-length buffer */
buf.len = MISC5_DBGNELM1;
- buf.p = HDmalloc((buf.len) * sizeof(misc5_struct1));
+ buf.p = HDmalloc((buf.len) * sizeof(misc5_struct1));
CHECK_PTR(buf.p, "HDmalloc");
/* Create the top-level VL information */
- for(i = 0; i < MISC5_DBGNELM1; i++)
+ for (i = 0; i < MISC5_DBGNELM1; i++)
set_struct1(&(((misc5_struct1 *)(buf.p))[i]));
/* Write the data out */
@@ -951,7 +951,7 @@ test_misc5(void)
CHECK(ret, FAIL, "H5Dwrite");
/* Release the top-level VL information */
- for(j = 0; j < MISC5_DBGNELM1; j++)
+ for (j = 0; j < MISC5_DBGNELM1; j++)
clear_struct1(&(((misc5_struct1 *)(buf.p))[j]));
/* Free the variable-length buffer */
@@ -962,16 +962,15 @@ test_misc5(void)
CHECK(ret, FAIL, "H5Dclose");
/* Close dataspace */
- ret=H5Sclose(space_id);
- CHECK(ret,FAIL,"H5Sclose");
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
/* Delete memory structures */
delete_struct1(str1hndl);
/* Close file */
- ret=H5Fclose(loc_id);
- CHECK(ret,FAIL,"H5Fclose");
-
+ ret = H5Fclose(loc_id);
+ CHECK(ret, FAIL, "H5Fclose");
/* Read the dataset back in & verify it */
loc_id = H5Fopen(MISC5_FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -994,38 +993,45 @@ test_misc5(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the correct information was read in */
- for(i=0; i<(buf.len); i++) {
+ for (i = 0; i < (buf.len); i++) {
/* HDprintf("[%d]=%d\n",i, ((misc5_struct1 *)(buf.p))[i].st1_el1); */
- VERIFY(((misc5_struct1 *)(buf.p))[i].st1_el1,MISC5_DBGELVAL1,"H5Dread");
- for(j=0; j<(((misc5_struct1 *)(buf.p)) [i].st1_el2.len); j++) {
- /* HDprintf(" [%d]=%d\n",j, ((misc5_struct2 *)(((misc5_struct1 *) (buf.p))[i].st1_el2.p))[j].st2_el1); */
- VERIFY(((misc5_struct2 *)(((misc5_struct1 *) (buf.p))[i].st1_el2.p))[j].st2_el1, MISC5_DBGELVAL2,"H5Dread");
- for(k=0; k<(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.len); k++) {
- /* HDprintf(" [%d]=%d\n",k, ((misc5_struct3 *)(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.p))[k].st3_el1); */
- VERIFY(((misc5_struct3 *)(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.p))[k].st3_el1, MISC5_DBGELVAL3,"H5Dread");
+ VERIFY(((misc5_struct1 *)(buf.p))[i].st1_el1, MISC5_DBGELVAL1, "H5Dread");
+ for (j = 0; j < (((misc5_struct1 *)(buf.p))[i].st1_el2.len); j++) {
+ /* HDprintf(" [%d]=%d\n",j, ((misc5_struct2 *)(((misc5_struct1 *)
+ * (buf.p))[i].st1_el2.p))[j].st2_el1); */
+ VERIFY(((misc5_struct2 *)(((misc5_struct1 *)(buf.p))[i].st1_el2.p))[j].st2_el1, MISC5_DBGELVAL2,
+ "H5Dread");
+ for (k = 0; k < (((misc5_struct2 *)(((misc5_struct1 *)(buf.p))[i].st1_el2.p))[j].st2_el2.len);
+ k++) {
+ /* HDprintf(" [%d]=%d\n",k, ((misc5_struct3 *)(((misc5_struct2 *) (((misc5_struct1
+ * *)(buf.p))[i]. st1_el2.p))[j].st2_el2.p))[k].st3_el1); */
+ VERIFY(((misc5_struct3 *)(((misc5_struct2 *)(((misc5_struct1 *)(buf.p))[i].st1_el2.p))[j]
+ .st2_el2.p))[k]
+ .st3_el1,
+ MISC5_DBGELVAL3, "H5Dread");
} /* end for */
}
}
/* Reclaim the memory for the VL information */
- ret=H5Treclaim(mem_type_id, space_id, H5P_DEFAULT, &buf);
- CHECK(ret,FAIL,"H5Treclaim");
+ ret = H5Treclaim(mem_type_id, space_id, H5P_DEFAULT, &buf);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close dataspace */
- ret=H5Sclose(space_id);
- CHECK(ret,FAIL,"H5Sclose");
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
/* Close dataset */
- ret=H5Tclose(mem_type_id);
- CHECK(ret,FAIL,"H5Tclose");
+ ret = H5Tclose(mem_type_id);
+ CHECK(ret, FAIL, "H5Tclose");
/* Close dataset */
- ret=H5Dclose(dataset_id);
- CHECK(ret,FAIL,"H5Dclose");
+ ret = H5Dclose(dataset_id);
+ CHECK(ret, FAIL, "H5Dclose");
/* Close file */
- ret=H5Fclose(loc_id);
- CHECK(ret,FAIL,"H5Fclose");
+ ret = H5Fclose(loc_id);
+ CHECK(ret, FAIL, "H5Fclose");
} /* end test_misc5() */
@@ -1038,11 +1044,11 @@ test_misc5(void)
static void
test_misc6(void)
{
- hid_t loc_id, space_id, dataset_id;
- hid_t attr_id;
- char attr_name[16];
+ hid_t loc_id, space_id, dataset_id;
+ hid_t attr_id;
+ char attr_name[16];
unsigned u;
- herr_t ret;
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing object header continuation code \n"));
@@ -1056,7 +1062,8 @@ test_misc6(void)
CHECK(space_id, FAIL, "H5Screate");
/* Create the first dataset */
- dataset_id = H5Dcreate2(loc_id, MISC6_DSETNAME1, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset_id =
+ H5Dcreate2(loc_id, MISC6_DSETNAME1, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset_id, FAIL, "H5Dcreate2");
/* Close dataset */
@@ -1064,7 +1071,8 @@ test_misc6(void)
CHECK(ret, FAIL, "H5Dclose");
/* Create the second dataset */
- dataset_id = H5Dcreate2(loc_id, MISC6_DSETNAME2, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset_id =
+ H5Dcreate2(loc_id, MISC6_DSETNAME2, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset_id, FAIL, "H5Dcreate2");
/* Close dataset */
@@ -1076,7 +1084,7 @@ test_misc6(void)
CHECK(ret, FAIL, "H5Fclose");
/* Loop through adding attributes to each dataset */
- for(u = 0; u < MISC6_NUMATTR; u++) {
+ for (u = 0; u < MISC6_NUMATTR; u++) {
/* Create name for attribute */
HDsprintf(attr_name, "Attr#%u", u);
@@ -1084,7 +1092,6 @@ test_misc6(void)
loc_id = H5Fopen(MISC6_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(loc_id, FAIL, "H5Fopen");
-
/* Open first dataset */
dataset_id = H5Dopen2(loc_id, MISC6_DSETNAME1, H5P_DEFAULT);
CHECK(dataset_id, FAIL, "H5Dopen2");
@@ -1101,7 +1108,6 @@ test_misc6(void)
ret = H5Dclose(dataset_id);
CHECK(ret, FAIL, "H5Dclose");
-
/* Open second dataset */
dataset_id = H5Dopen2(loc_id, MISC6_DSETNAME2, H5P_DEFAULT);
CHECK(dataset_id, FAIL, "H5Dopen2");
@@ -1118,15 +1124,14 @@ test_misc6(void)
ret = H5Dclose(dataset_id);
CHECK(ret, FAIL, "H5Dclose");
-
/* Close file */
ret = H5Fclose(loc_id);
- CHECK(ret,FAIL,"H5Fclose");
+ CHECK(ret, FAIL, "H5Fclose");
} /* end for */
/* Close dataspace */
- ret=H5Sclose(space_id);
- CHECK(ret,FAIL,"H5Sclose");
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
} /* end test_misc6() */
@@ -1139,8 +1144,8 @@ test_misc6(void)
static void
test_misc7(void)
{
- hid_t fid, did, tid, sid;
- int enum_value=1;
+ hid_t fid, did, tid, sid;
+ int enum_value = 1;
herr_t ret;
/* Output message about test being performed */
@@ -1239,27 +1244,27 @@ test_misc7(void)
static void
test_misc8(void)
{
- hid_t fid, did, sid;
- hid_t fapl; /* File access property list */
- hid_t dcpl; /* Dataset creation property list */
- int rank=MISC8_RANK;
- hsize_t dims[MISC8_RANK]={MISC8_DIM0,MISC8_DIM1};
- hsize_t chunk_dims[MISC8_RANK]={MISC8_CHUNK_DIM0,MISC8_CHUNK_DIM1};
- hsize_t storage_size; /* Number of bytes of raw data storage used */
- int *wdata; /* Data to write */
- int *tdata; /* Temporary pointer to data write */
+ hid_t fid, did, sid;
+ hid_t fapl; /* File access property list */
+ hid_t dcpl; /* Dataset creation property list */
+ int rank = MISC8_RANK;
+ hsize_t dims[MISC8_RANK] = {MISC8_DIM0, MISC8_DIM1};
+ hsize_t chunk_dims[MISC8_RANK] = {MISC8_CHUNK_DIM0, MISC8_CHUNK_DIM1};
+ hsize_t storage_size; /* Number of bytes of raw data storage used */
+ int * wdata; /* Data to write */
+ int * tdata; /* Temporary pointer to data write */
#ifdef VERIFY_DATA
int *rdata; /* Data to read */
int *tdata2; /* Temporary pointer to data to read */
-#endif /* VERIFY_DATA */
- unsigned u,v; /* Local index variables */
- int mdc_nelmts; /* Metadata number of elements */
- size_t rdcc_nelmts; /* Raw data number of elements */
- size_t rdcc_nbytes; /* Raw data number of bytes */
- double rdcc_w0; /* Raw data write percentage */
- hsize_t start[MISC8_RANK]; /* Hyperslab start */
- hsize_t count[MISC8_RANK]; /* Hyperslab block count */
- herr_t ret;
+#endif /* VERIFY_DATA */
+ unsigned u, v; /* Local index variables */
+ int mdc_nelmts; /* Metadata number of elements */
+ size_t rdcc_nelmts; /* Raw data number of elements */
+ size_t rdcc_nbytes; /* Raw data number of bytes */
+ double rdcc_w0; /* Raw data write percentage */
+ hsize_t start[MISC8_RANK]; /* Hyperslab start */
+ hsize_t count[MISC8_RANK]; /* Hyperslab block count */
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing dataset storage sizes\n"));
@@ -1273,9 +1278,9 @@ test_misc8(void)
#endif /* VERIFY_DATA */
/* Initialize values */
- tdata=wdata;
- for(u=0; u<MISC8_DIM0; u++)
- for(v=0; v<MISC8_DIM1; v++)
+ tdata = wdata;
+ for (u = 0; u < MISC8_DIM0; u++)
+ for (v = 0; v < MISC8_DIM1; v++)
*tdata++ = (int)(((u * MISC8_DIM1) + v) % 13);
/* Create a file acccess property list */
@@ -1283,22 +1288,22 @@ test_misc8(void)
CHECK(fapl, FAIL, "H5Pcreate");
/* Get the default file access properties for caching */
- ret=H5Pget_cache(fapl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0);
+ ret = H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0);
CHECK(ret, FAIL, "H5Pget_cache");
/* Decrease the size of the raw data cache */
- rdcc_nbytes=0;
+ rdcc_nbytes = 0;
/* Set the file access properties for caching */
- ret=H5Pset_cache(fapl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
+ ret = H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0);
CHECK(ret, FAIL, "H5Pset_cache");
/* Create the file */
- fid=H5Fcreate(MISC8_FILE,H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
- CHECK(fid,FAIL,"H5Fcreate");
+ fid = H5Fcreate(MISC8_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
/* Close file access property list */
- ret=H5Pclose(fapl);
+ ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
/* Create a simple dataspace */
@@ -1307,9 +1312,11 @@ test_misc8(void)
/* Select a hyperslab which coincides with chunk boundaries */
/* (For later use) */
- start[0] = 1; start[1] = 1;
- count[0] = (MISC8_CHUNK_DIM0 * 2) - 1; count[1] = (MISC8_CHUNK_DIM1 * 2) - 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL);
+ start[0] = 1;
+ start[1] = 1;
+ count[0] = (MISC8_CHUNK_DIM0 * 2) - 1;
+ count[1] = (MISC8_CHUNK_DIM1 * 2) - 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset creation property list */
@@ -1332,7 +1339,8 @@ test_misc8(void)
/* Check the storage size */
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
- VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size");
+ VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5Dget_storage_size");
/* Close dataset ID */
ret = H5Dclose(did);
@@ -1340,7 +1348,7 @@ test_misc8(void)
#ifndef H5_HAVE_PARALLEL
/* Set the space allocation time to late */
- ret = H5Pset_alloc_time(dcpl,H5D_ALLOC_TIME_LATE);
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE);
CHECK(ret, FAIL, "H5Pset_alloc_time");
/* Create a contiguous dataset, with space allocation late */
@@ -1358,7 +1366,8 @@ test_misc8(void)
/* Check the storage size after data is written */
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
- VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size");
+ VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5Dget_storage_size");
/* Close dataset ID */
ret = H5Dclose(did);
@@ -1383,7 +1392,8 @@ test_misc8(void)
/* Check the storage size after data is written */
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
- VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size");
+ VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5Dget_storage_size");
/* Close dataset ID */
ret = H5Dclose(did);
@@ -1427,13 +1437,13 @@ test_misc8(void)
/* Check the storage size */
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
- VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size");
+ VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5Dget_storage_size");
/* Close dataset ID */
ret = H5Dclose(did);
CHECK(ret, FAIL, "H5Dclose");
-
/* III. chunked dataset tests */
ret = H5Pset_layout(dcpl, H5D_CHUNKED);
@@ -1454,7 +1464,8 @@ test_misc8(void)
/* Check the storage size after data is written */
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
- VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size");
+ VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5Dget_storage_size");
/* Close dataset ID */
ret = H5Dclose(did);
@@ -1484,7 +1495,8 @@ test_misc8(void)
/* Check the storage size after data is written */
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
- VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size");
+ VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5Dget_storage_size");
/* Close dataset ID */
ret = H5Dclose(did);
@@ -1508,7 +1520,8 @@ test_misc8(void)
/* Check the storage size after only four chunks are written */
storage_size = H5Dget_storage_size(did);
- VERIFY(storage_size, (hsize_t)(4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size");
+ VERIFY(storage_size, (hsize_t)(4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5Dget_storage_size");
/* Write entire dataset */
ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -1520,18 +1533,20 @@ test_misc8(void)
CHECK(ret, FAIL, "H5Dread");
/* Check values written */
- tdata=wdata;
- tdata2=rdata;
- for(u=0; u<MISC8_DIM0; u++)
- for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++)
- if(*tdata!=*tdata2)
- TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
+ tdata = wdata;
+ tdata2 = rdata;
+ for (u = 0; u < MISC8_DIM0; u++)
+ for (v = 0; v < MISC8_DIM1; v++, tdata++, tdata2++)
+ if (*tdata != *tdata2)
+ TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n", __LINE__, (unsigned)u,
+ (unsigned)v, (int)*tdata, (int)*tdata2);
#endif /* VERIFY_DATA */
/* Check the storage size after data is written */
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
- VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size");
+ VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5Dget_storage_size");
/* Close dataset ID */
ret = H5Dclose(did);
@@ -1539,12 +1554,12 @@ test_misc8(void)
#endif /* H5_HAVE_PARALLEL */
/* Set the space allocation time to early */
- ret = H5Pset_alloc_time(dcpl,H5D_ALLOC_TIME_EARLY);
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
CHECK(ret, FAIL, "H5Pset_alloc_time");
/* Use compression as well as chunking for these datasets */
#ifdef H5_HAVE_FILTER_DEFLATE
- ret = H5Pset_deflate(dcpl,9);
+ ret = H5Pset_deflate(dcpl, 9);
CHECK(ret, FAIL, "H5Pset_deflate");
#endif /* end H5_HAVE_FILTER_DEFLATE */
@@ -1560,11 +1575,13 @@ test_misc8(void)
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
- if(storage_size >= (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
-#else /* Compression is not configured */
- if(storage_size != (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ if (storage_size >= (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
+#else /* Compression is not configured */
+ if (storage_size != (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Close dataset ID */
@@ -1592,11 +1609,13 @@ test_misc8(void)
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
- if(storage_size >= (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
-#else /* Compression is not configured */
- if(storage_size != (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ if (storage_size >= (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
+#else /* Compression is not configured */
+ if (storage_size != (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Write entire dataset */
@@ -1609,23 +1628,26 @@ test_misc8(void)
CHECK(ret, FAIL, "H5Dread");
/* Check values written */
- tdata=wdata;
- tdata2=rdata;
- for(u=0; u<MISC8_DIM0; u++)
- for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++)
- if(*tdata!=*tdata2)
- TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
+ tdata = wdata;
+ tdata2 = rdata;
+ for (u = 0; u < MISC8_DIM0; u++)
+ for (v = 0; v < MISC8_DIM1; v++, tdata++, tdata2++)
+ if (*tdata != *tdata2)
+ TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n", __LINE__, (unsigned)u,
+ (unsigned)v, (int)*tdata, (int)*tdata2);
#endif /* VERIFY_DATA */
/* Check the storage size after data is written */
- storage_size=H5Dget_storage_size(did);
+ storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
- if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ if (storage_size >= (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
#else
- if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ if (storage_size != (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
#endif /*H5_HAVE_FILTER_DEFLATE*/
/* Close dataset ID */
@@ -1652,11 +1674,13 @@ test_misc8(void)
storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
- if(storage_size >= (4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
-#else /* Compression is not configured */
- if(storage_size != (4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ if (storage_size >= (4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
+#else /* Compression is not configured */
+ if (storage_size != (4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Write entire dataset */
@@ -1669,23 +1693,26 @@ test_misc8(void)
CHECK(ret, FAIL, "H5Dread");
/* Check values written */
- tdata=wdata;
- tdata2=rdata;
- for(u=0; u<MISC8_DIM0; u++)
- for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++)
- if(*tdata!=*tdata2)
- TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
+ tdata = wdata;
+ tdata2 = rdata;
+ for (u = 0; u < MISC8_DIM0; u++)
+ for (v = 0; v < MISC8_DIM1; v++, tdata++, tdata2++)
+ if (*tdata != *tdata2)
+ TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n", __LINE__, (unsigned)u,
+ (unsigned)v, (int)*tdata, (int)*tdata2);
#endif /* VERIFY_DATA */
/* Check the storage size after data is written */
- storage_size=H5Dget_storage_size(did);
+ storage_size = H5Dget_storage_size(did);
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
- if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ if (storage_size >= (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
#else
- if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT)))
- TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ if (storage_size != (MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)))
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n", __LINE__,
+ (unsigned)storage_size);
#endif /*H5_HAVE_FILTER_DEFLATE*/
/* Close dataset ID */
@@ -1694,15 +1721,15 @@ test_misc8(void)
#endif /* H5_HAVE_PARALLEL */
/* Close dataset creation property list */
- ret=H5Pclose(dcpl);
+ ret = H5Pclose(dcpl);
CHECK(ret, FAIL, "H5Pclose");
/* Close dataspace */
- ret=H5Sclose(sid);
+ ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
/* Close file */
- ret=H5Fclose(fid);
+ ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Free the read & write buffers */
@@ -1721,7 +1748,7 @@ test_misc8(void)
static void
test_misc9(void)
{
- hid_t fapl, fid;
+ hid_t fapl, fid;
herr_t ret;
/* Output message about test being performed */
@@ -1734,9 +1761,9 @@ test_misc9(void)
CHECK(ret, FAIL, "H5Pset_fapl_core");
fid = H5Fopen(MISC9_FILE, H5F_ACC_RDWR, fapl);
- VERIFY(fid,FAIL,"H5Fopen");
+ VERIFY(fid, FAIL, "H5Fopen");
- ret=H5Pclose(fapl);
+ ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pset_fapl_core");
} /* end test_misc9() */
@@ -1753,11 +1780,11 @@ test_misc9(void)
static void
test_misc10(void)
{
- hid_t file, file_new; /* File IDs for old & new files */
- hid_t fcpl; /* File creation property list */
- hid_t dataset, dataset_new; /* Dataset IDs for old & new datasets */
- hid_t dcpl; /* Dataset creation property list */
- hid_t space, type; /* Old dataset's dataspace & datatype */
+ hid_t file, file_new; /* File IDs for old & new files */
+ hid_t fcpl; /* File creation property list */
+ hid_t dataset, dataset_new; /* Dataset IDs for old & new datasets */
+ hid_t dcpl; /* Dataset creation property list */
+ hid_t space, type; /* Old dataset's dataspace & datatype */
const char *testfile = H5_get_srcdir_filename(MISC10_FILE_OLD); /* Corrected test file name */
herr_t ret;
@@ -1767,22 +1794,22 @@ test_misc10(void)
/*
* Open the old file and the dataset and get old settings.
*/
- file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fopen");
- fcpl = H5Fget_create_plist(file);
+ fcpl = H5Fget_create_plist(file);
CHECK(fcpl, FAIL, "H5Fget_create_plist");
dataset = H5Dopen2(file, MISC10_DSETNAME, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dopen2");
- dcpl = H5Dget_create_plist(dataset);
+ dcpl = H5Dget_create_plist(dataset);
CHECK(dcpl, FAIL, "H5Dget_create_plist");
- space = H5Dget_space(dataset);
+ space = H5Dget_space(dataset);
CHECK(space, FAIL, "H5Dget_space");
- type = H5Dget_type(dataset);
+ type = H5Dget_type(dataset);
CHECK(type, FAIL, "H5Dget_type");
/* Create new file & dataset */
- file_new = H5Fcreate(MISC10_FILE_NEW, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT);
+ file_new = H5Fcreate(MISC10_FILE_NEW, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
CHECK(file_new, FAIL, "H5Fcreate");
dataset_new = H5Dcreate2(file_new, MISC10_DSETNAME, type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
@@ -1821,20 +1848,20 @@ test_misc10(void)
static void
test_misc11(void)
{
- hid_t file; /* File IDs for old & new files */
- hid_t fcpl; /* File creation property list */
- hsize_t userblock; /* Userblock size retrieved from FCPL */
- size_t off_size; /* Size of offsets in the file */
- size_t len_size; /* Size of lengths in the file */
- unsigned sym_ik; /* Symbol table B-tree initial 'K' value */
- unsigned istore_ik; /* Indexed storage B-tree initial 'K' value */
- unsigned sym_lk; /* Symbol table B-tree leaf 'K' value */
- unsigned nindexes; /* Shared message number of indexes */
- H5F_info2_t finfo; /* global information about file */
+ hid_t file; /* File IDs for old & new files */
+ hid_t fcpl; /* File creation property list */
+ hsize_t userblock; /* Userblock size retrieved from FCPL */
+ size_t off_size; /* Size of offsets in the file */
+ size_t len_size; /* Size of lengths in the file */
+ unsigned sym_ik; /* Symbol table B-tree initial 'K' value */
+ unsigned istore_ik; /* Indexed storage B-tree initial 'K' value */
+ unsigned sym_lk; /* Symbol table B-tree leaf 'K' value */
+ unsigned nindexes; /* Shared message number of indexes */
+ H5F_info2_t finfo; /* global information about file */
H5F_fspace_strategy_t strategy; /* File space strategy */
- hsize_t threshold; /* Free-space section threshold */
- hbool_t persist; /* To persist free-space or not */
- herr_t ret; /* Generic return value */
+ hsize_t threshold; /* Free-space section threshold */
+ hbool_t persist; /* To persist free-space or not */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing file creation properties retrieved correctly\n"));
@@ -1844,51 +1871,48 @@ test_misc11(void)
*/
/* Create file with default file creation property list */
- file= H5Fcreate(MISC11_FILE, H5F_ACC_TRUNC , H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(MISC11_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fcreate");
/* Get the file's version information */
ret = H5Fget_info2(file, &finfo);
CHECK(ret, FAIL, "H5Fget_info2");
- VERIFY(finfo.super.version, 0,"H5Fget_info2");
- VERIFY(finfo.free.version, 0,"H5Fget_info2");
- VERIFY(finfo.sohm.version, 0,"H5Fget_info2");
+ VERIFY(finfo.super.version, 0, "H5Fget_info2");
+ VERIFY(finfo.free.version, 0, "H5Fget_info2");
+ VERIFY(finfo.sohm.version, 0, "H5Fget_info2");
/* Close file */
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
-
/* Create a file creation property list */
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl, FAIL, "H5Pcreate");
/* Set all the properties in the FCPL */
- ret=H5Pset_userblock(fcpl,(hsize_t)MISC11_USERBLOCK);
+ ret = H5Pset_userblock(fcpl, (hsize_t)MISC11_USERBLOCK);
CHECK(ret, FAIL, "H5Pset_userblock");
ret = H5Pset_sizes(fcpl, (size_t)MISC11_SIZEOF_OFF, (size_t)MISC11_SIZEOF_LEN);
CHECK(ret, FAIL, "H5Pset_sizes");
/* This should fail as (32770*2) will exceed ^16 - 2 bytes for storing btree entries */
- H5E_BEGIN_TRY {
- ret=H5Pset_sym_k(fcpl, 32770, 0);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_sym_k(fcpl, 32770, 0); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_sym_k");
- ret=H5Pset_sym_k(fcpl,MISC11_SYM_IK,MISC11_SYM_LK);
+ ret = H5Pset_sym_k(fcpl, MISC11_SYM_IK, MISC11_SYM_LK);
CHECK(ret, FAIL, "H5Pset_sym_k");
/* This should fail as (32770*2) will exceed ^16 - 2 bytes for storing btree entries */
- H5E_BEGIN_TRY {
- ret=H5Pset_istore_k(fcpl, 32770);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_istore_k(fcpl, 32770); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pset_istore_k");
- ret=H5Pset_istore_k(fcpl,MISC11_ISTORE_IK);
+ ret = H5Pset_istore_k(fcpl, MISC11_ISTORE_IK);
CHECK(ret, FAIL, "H5Pset_istore_k");
- ret=H5Pset_shared_mesg_nindexes(fcpl,MISC11_NINDEXES);
+ ret = H5Pset_shared_mesg_nindexes(fcpl, MISC11_NINDEXES);
CHECK(ret, FAIL, "H5Pset_shared_mesg");
ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
@@ -1899,22 +1923,22 @@ test_misc11(void)
*/
/* Create file with custom file creation property list */
- file= H5Fcreate(MISC11_FILE, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT);
+ file = H5Fcreate(MISC11_FILE, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fcreate");
/* Close FCPL */
- ret=H5Pclose(fcpl);
+ ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
/* Get the file's version information */
ret = H5Fget_info2(file, &finfo);
CHECK(ret, FAIL, "H5Fget_info2");
- VERIFY(finfo.super.version, 2,"H5Fget_info2");
- VERIFY(finfo.free.version, 0,"H5Fget_info2");
- VERIFY(finfo.sohm.version, 0,"H5Fget_info2");
+ VERIFY(finfo.super.version, 2, "H5Fget_info2");
+ VERIFY(finfo.free.version, 0, "H5Fget_info2");
+ VERIFY(finfo.sohm.version, 0, "H5Fget_info2");
/* Close file */
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
@@ -1922,36 +1946,36 @@ test_misc11(void)
CHECK(file, FAIL, "H5Fcreate");
/* Get the file's creation property list */
- fcpl = H5Fget_create_plist(file);
+ fcpl = H5Fget_create_plist(file);
CHECK(fcpl, FAIL, "H5Fget_create_plist");
/* Get the file's version information */
ret = H5Fget_info2(file, &finfo);
CHECK(ret, FAIL, "H5Fget_info2");
- VERIFY(finfo.super.version, 2,"H5Fget_info2");
- VERIFY(finfo.free.version, 0,"H5Fget_info2");
- VERIFY(finfo.sohm.version, 0,"H5Fget_info2");
+ VERIFY(finfo.super.version, 2, "H5Fget_info2");
+ VERIFY(finfo.free.version, 0, "H5Fget_info2");
+ VERIFY(finfo.sohm.version, 0, "H5Fget_info2");
/* Retrieve all the property values & check them */
- ret=H5Pget_userblock(fcpl,&userblock);
+ ret = H5Pget_userblock(fcpl, &userblock);
CHECK(ret, FAIL, "H5Pget_userblock");
VERIFY(userblock, MISC11_USERBLOCK, "H5Pget_userblock");
- ret=H5Pget_sizes(fcpl,&off_size,&len_size);
+ ret = H5Pget_sizes(fcpl, &off_size, &len_size);
CHECK(ret, FAIL, "H5Pget_sizes");
VERIFY(off_size, MISC11_SIZEOF_OFF, "H5Pget_sizes");
VERIFY(len_size, MISC11_SIZEOF_LEN, "H5Pget_sizes");
- ret=H5Pget_sym_k(fcpl,&sym_ik,&sym_lk);
+ ret = H5Pget_sym_k(fcpl, &sym_ik, &sym_lk);
CHECK(ret, FAIL, "H5Pget_sym_k");
VERIFY(sym_ik, MISC11_SYM_IK, "H5Pget_sym_k");
VERIFY(sym_lk, MISC11_SYM_LK, "H5Pget_sym_k");
- ret=H5Pget_istore_k(fcpl,&istore_ik);
+ ret = H5Pget_istore_k(fcpl, &istore_ik);
CHECK(ret, FAIL, "H5Pget_istore_k");
VERIFY(istore_ik, MISC11_ISTORE_IK, "H5Pget_istore_k");
- ret=H5Pget_shared_mesg_nindexes(fcpl,&nindexes);
+ ret = H5Pget_shared_mesg_nindexes(fcpl, &nindexes);
CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes");
VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
@@ -1962,11 +1986,11 @@ test_misc11(void)
VERIFY(threshold, 1, "H5Pget_file_space_strategy");
/* Close file */
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Close FCPL */
- ret=H5Pclose(fcpl);
+ ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
} /* end test_misc11() */
@@ -1979,33 +2003,30 @@ test_misc11(void)
static void
test_misc12(void)
{
- const char *wdata [MISC12_SPACE1_DIM1]= {
+ const char *wdata[MISC12_SPACE1_DIM1] = {
"Four score and seven years ago our forefathers brought forth on this continent a new nation,",
"conceived in liberty and dedicated to the proposition that all men are created equal.",
"Now we are engaged in a great civil war,",
- "testing whether that nation or any nation so conceived and so dedicated can long endure."
- };
- const char *wdata1 [MISC12_APPEND_SIZE]= {
- "O Gloria inmarcesible! O Jubilo inmortal! En surcos de dolores, el",
- "bien germina ya! Ceso la horrible noche, La libertad sublime",
- "derrama las auroras de su invencible luz.",
- "La humanidad entera, que entre cadenas gime, comprende",
- "las palabras del que murio en la cruz."
- };
- char *rdata [MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE]; /* Information read in */
- hid_t fid1;
- hid_t dataset;
- hid_t sid1, space, memspace;
- hid_t tid1, cparms;
- hsize_t dims1[] = {MISC12_SPACE1_DIM1};
- hsize_t dimsn[] = {MISC12_APPEND_SIZE};
- hsize_t maxdims1[1] = {H5S_UNLIMITED};
- hsize_t chkdims1[1] = {MISC12_CHUNK_SIZE};
- hsize_t newsize[1] = {MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE};
- hsize_t offset[1] = {MISC12_SPACE1_DIM1};
- hsize_t count[1] = {MISC12_APPEND_SIZE};
- int i; /* counting variable */
- herr_t ret; /* Generic return value */
+ "testing whether that nation or any nation so conceived and so dedicated can long endure."};
+ const char *wdata1[MISC12_APPEND_SIZE] = {
+ "O Gloria inmarcesible! O Jubilo inmortal! En surcos de dolores, el",
+ "bien germina ya! Ceso la horrible noche, La libertad sublime",
+ "derrama las auroras de su invencible luz.", "La humanidad entera, que entre cadenas gime, comprende",
+ "las palabras del que murio en la cruz."};
+ char * rdata[MISC12_SPACE1_DIM1 + MISC12_APPEND_SIZE]; /* Information read in */
+ hid_t fid1;
+ hid_t dataset;
+ hid_t sid1, space, memspace;
+ hid_t tid1, cparms;
+ hsize_t dims1[] = {MISC12_SPACE1_DIM1};
+ hsize_t dimsn[] = {MISC12_APPEND_SIZE};
+ hsize_t maxdims1[1] = {H5S_UNLIMITED};
+ hsize_t chkdims1[1] = {MISC12_CHUNK_SIZE};
+ hsize_t newsize[1] = {MISC12_SPACE1_DIM1 + MISC12_APPEND_SIZE};
+ hsize_t offset[1] = {MISC12_SPACE1_DIM1};
+ hsize_t count[1] = {MISC12_APPEND_SIZE};
+ int i; /* counting variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing VL-type in chunked dataset\n"));
@@ -2064,12 +2085,14 @@ test_misc12(void)
ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Dread");
- for(i = 0; i < MISC12_SPACE1_DIM1; i++)
- if(HDstrcmp(wdata[i], rdata[i]))
- TestErrPrintf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n", __LINE__, i, wdata[i], i, rdata[i]);
- for(; i < (MISC12_SPACE1_DIM1 + MISC12_APPEND_SIZE); i++)
- if(HDstrcmp(wdata1[i - MISC12_SPACE1_DIM1], rdata[i]))
- TestErrPrintf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n", __LINE__, i - MISC12_SPACE1_DIM1, wdata1[i - MISC12_SPACE1_DIM1], i, rdata[i]);
+ for (i = 0; i < MISC12_SPACE1_DIM1; i++)
+ if (HDstrcmp(wdata[i], rdata[i]))
+ TestErrPrintf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n", __LINE__, i, wdata[i], i,
+ rdata[i]);
+ for (; i < (MISC12_SPACE1_DIM1 + MISC12_APPEND_SIZE); i++)
+ if (HDstrcmp(wdata1[i - MISC12_SPACE1_DIM1], rdata[i]))
+ TestErrPrintf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n", __LINE__, i - MISC12_SPACE1_DIM1,
+ wdata1[i - MISC12_SPACE1_DIM1], i, rdata[i]);
ret = H5Sselect_all(space);
CHECK(ret, FAIL, "H5Sselect_all");
@@ -2101,7 +2124,7 @@ misc13_init_data(unsigned *original_data)
{
unsigned u;
- for(u = 0; u < MISC13_DIM1; u++)
+ for (u = 0; u < MISC13_DIM1; u++)
original_data[u] = u;
}
@@ -2110,8 +2133,8 @@ misc13_verify_data_match(const unsigned *original_data, const unsigned *read_dat
{
unsigned u;
- for(u = 0; u < MISC13_DIM1; u++)
- if(original_data[u] != read_data[u])
+ for (u = 0; u < MISC13_DIM1; u++)
+ if (original_data[u] != read_data[u])
return FALSE;
return TRUE;
@@ -2120,14 +2143,14 @@ misc13_verify_data_match(const unsigned *original_data, const unsigned *read_dat
static void
misc13_create_dataset(hid_t loc_id, const char *name, hid_t dcpl, const unsigned *data)
{
- hid_t dsid = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dims[MISC13_RANK]; /* Dataset dimensions */
- herr_t ret; /* Generic return value */
+ hid_t dsid = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dims[MISC13_RANK]; /* Dataset dimensions */
+ herr_t ret; /* Generic return value */
/* Create dataspace for use with dataset */
dims[0] = MISC13_DIM1;
- sid = H5Screate_simple(MISC13_RANK, dims, NULL);
+ sid = H5Screate_simple(MISC13_RANK, dims, NULL);
CHECK(sid, FAIL, "H5Screate_simple");
/* Create contiguous dataset in root group */
@@ -2151,9 +2174,9 @@ misc13_create_dataset(hid_t loc_id, const char *name, hid_t dcpl, const unsigned
static void
misc13_verify_dataset(hid_t loc_id, const char *name, const unsigned *data)
{
- unsigned *read_data = NULL; /* Data to write to dataset */
- hid_t dsid = -1; /* Dataset ID */
- herr_t ret; /* Generic return value */
+ unsigned *read_data = NULL; /* Data to write to dataset */
+ hid_t dsid = -1; /* Dataset ID */
+ herr_t ret; /* Generic return value */
/* Create a data buffer for the dataset read */
read_data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned));
@@ -2183,13 +2206,13 @@ misc13_verify_dataset(hid_t loc_id, const char *name, const unsigned *data)
static void
misc13_create_hdf_file(const char *name, const unsigned *data)
{
- hid_t fid = -1; /* File ID */
- hid_t gid1 = -1; /* Group ID (level 1) */
- hid_t gid2 = -1; /* Group ID (level 2) */
- hid_t tid = -1; /* Datatype ID */
- hid_t dcplid = -1; /* Dataset creation property list ID */
- hsize_t chunk_dims[MISC13_RANK]; /* Chunk dimensions */
- herr_t ret; /* Generic return value */
+ hid_t fid = -1; /* File ID */
+ hid_t gid1 = -1; /* Group ID (level 1) */
+ hid_t gid2 = -1; /* Group ID (level 2) */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t dcplid = -1; /* Dataset creation property list ID */
+ hsize_t chunk_dims[MISC13_RANK]; /* Chunk dimensions */
+ herr_t ret; /* Generic return value */
/* Create file */
fid = H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2205,7 +2228,7 @@ misc13_create_hdf_file(const char *name, const unsigned *data)
/* Use chunked storage for this DCPL */
chunk_dims[0] = MISC13_CHUNK_DIM1;
- ret = H5Pset_chunk(dcplid, MISC13_RANK, chunk_dims);
+ ret = H5Pset_chunk(dcplid, MISC13_RANK, chunk_dims);
CHECK(ret, FAIL, "H5Pset_chunk");
/* Create contiguous dataset in root group */
@@ -2273,13 +2296,13 @@ misc13_create_hdf_file(const char *name, const unsigned *data)
static void
misc13_insert_user_block(const char *old_name, const char *new_name, const char *str, size_t size)
{
- FILE *new_fp = NULL; /* Pointers to new & old files */
- FILE *old_fp = NULL;
- void *user_block = NULL; /* Pointer to user block to write to file */
- void *copy_buf = NULL; /* Pointer to buffer for copying data */
- size_t written; /* Amount of data written to new file */
- size_t read_in; /* Amount of data read in from old file */
- int ret; /* Generic status value */
+ FILE * new_fp = NULL; /* Pointers to new & old files */
+ FILE * old_fp = NULL;
+ void * user_block = NULL; /* Pointer to user block to write to file */
+ void * copy_buf = NULL; /* Pointer to buffer for copying data */
+ size_t written; /* Amount of data written to new file */
+ size_t read_in; /* Amount of data read in from old file */
+ int ret; /* Generic status value */
/* Allocate space for the user block */
user_block = HDcalloc(size, (size_t)1);
@@ -2289,7 +2312,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char
HDmemcpy(user_block, str, HDstrlen(str));
/* Open the new file */
- new_fp = HDfopen(new_name,"wb");
+ new_fp = HDfopen(new_name, "wb");
CHECK_PTR(new_fp, "HDfopen");
/* Write the user block to the new file */
@@ -2297,7 +2320,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char
VERIFY(written, size, "HDfwrite");
/* Open the old file */
- old_fp = HDfopen(old_name,"rb");
+ old_fp = HDfopen(old_name, "rb");
CHECK_PTR(old_fp, "HDfopen");
/* Allocate space for the copy buffer */
@@ -2305,7 +2328,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char
CHECK_PTR(copy_buf, "HDmalloc");
/* Copy data from the old file to the new file */
- while((read_in = HDfread(copy_buf, (size_t)1, (size_t)MISC13_COPY_BUF_SIZE, old_fp)) > 0) {
+ while ((read_in = HDfread(copy_buf, (size_t)1, (size_t)MISC13_COPY_BUF_SIZE, old_fp)) > 0) {
/* Write the data to the new file */
written = HDfwrite(copy_buf, (size_t)1, read_in, new_fp);
VERIFY(written, read_in, "HDfwrite");
@@ -2329,15 +2352,15 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char
static void
misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_size,
- hbool_t check_for_new_dataset)
+ hbool_t check_for_new_dataset)
{
- hid_t fid = -1; /* File ID */
- hid_t gid1 = -1; /* Group IDs */
- hid_t gid2 = -1; /* Group IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t fcplid = -1; /* File creation property list ID */
- hsize_t ub_size_out; /* Userblock size retrieved from FCPL */
- herr_t ret; /* Generic return value */
+ hid_t fid = -1; /* File ID */
+ hid_t gid1 = -1; /* Group IDs */
+ hid_t gid2 = -1; /* Group IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t fcplid = -1; /* File creation property list ID */
+ hsize_t ub_size_out; /* Userblock size retrieved from FCPL */
+ herr_t ret; /* Generic return value */
/* Open the file */
fid = H5Fopen(name, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -2365,7 +2388,7 @@ misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_siz
misc13_verify_dataset(fid, MISC13_DSET2_NAME, data);
/* Verify the "new" contiguous dataset in the root group, if asked */
- if(check_for_new_dataset)
+ if (check_for_new_dataset)
misc13_verify_dataset(fid, MISC13_DSET3_NAME, data);
/* Open the named datatype in the root group */
@@ -2421,8 +2444,8 @@ misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_siz
static void
misc13_add_to_new_file(const char *name, const unsigned *data)
{
- hid_t fid = -1; /* File ID */
- herr_t ret; /* Generic return value */
+ hid_t fid = -1; /* File ID */
+ herr_t ret; /* Generic return value */
/* Open the file */
fid = H5Fopen(name, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -2446,9 +2469,9 @@ misc13_add_to_new_file(const char *name, const unsigned *data)
static void
test_misc13(void)
{
- unsigned *data = NULL; /* Data to write to dataset */
- hsize_t userblock_size; /* Correct size of userblock */
- hbool_t check_for_new_dataset; /* Whether to check for the post-userblock-creation dataset */
+ unsigned *data = NULL; /* Data to write to dataset */
+ hsize_t userblock_size; /* Correct size of userblock */
+ hbool_t check_for_new_dataset; /* Whether to check for the post-userblock-creation dataset */
/* Create a data buffer for the datasets */
data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned));
@@ -2461,7 +2484,7 @@ test_misc13(void)
misc13_create_hdf_file(MISC13_FILE_1, data);
/* Verify file contents are correct */
- userblock_size = 0;
+ userblock_size = 0;
check_for_new_dataset = FALSE;
misc13_verify_file(MISC13_FILE_1, data, userblock_size, check_for_new_dataset);
@@ -2469,7 +2492,7 @@ test_misc13(void)
misc13_insert_user_block(MISC13_FILE_1, MISC13_FILE_2, "Test String", (size_t)MISC13_USERBLOCK_SIZE);
/* Verify file contents are still correct */
- userblock_size = MISC13_USERBLOCK_SIZE;
+ userblock_size = MISC13_USERBLOCK_SIZE;
check_for_new_dataset = FALSE;
misc13_verify_file(MISC13_FILE_2, data, userblock_size, check_for_new_dataset);
@@ -2477,7 +2500,7 @@ test_misc13(void)
misc13_add_to_new_file(MISC13_FILE_2, data);
/* Verify file contents are still correct */
- userblock_size = MISC13_USERBLOCK_SIZE;
+ userblock_size = MISC13_USERBLOCK_SIZE;
check_for_new_dataset = TRUE;
misc13_verify_file(MISC13_FILE_2, data, userblock_size, check_for_new_dataset);
@@ -2495,17 +2518,17 @@ test_misc13(void)
static void
test_misc14(void)
{
- hid_t file_id; /* File ID */
- hid_t fapl; /* File access property list ID */
- hid_t DataSpace; /* Dataspace ID */
- hid_t Dataset1; /* Dataset ID #1 */
- hid_t Dataset2; /* Dataset ID #2 */
- hid_t Dataset3; /* Dataset ID #3 */
- double data1 = 5.0F; /* Data to write for dataset #1 */
- double data2 = 10.0F; /* Data to write for dataset #2 */
- double data3 = 15.0F; /* Data to write for dataset #3 */
- double rdata; /* Data read in */
- herr_t ret; /* Generic return value */
+ hid_t file_id; /* File ID */
+ hid_t fapl; /* File access property list ID */
+ hid_t DataSpace; /* Dataspace ID */
+ hid_t Dataset1; /* Dataset ID #1 */
+ hid_t Dataset2; /* Dataset ID #2 */
+ hid_t Dataset3; /* Dataset ID #3 */
+ double data1 = 5.0F; /* Data to write for dataset #1 */
+ double data2 = 10.0F; /* Data to write for dataset #2 */
+ double data3 = 15.0F; /* Data to write for dataset #3 */
+ double rdata; /* Data read in */
+ herr_t ret; /* Generic return value */
/* Test creating two datasets and deleting the second */
@@ -2526,14 +2549,16 @@ test_misc14(void)
CHECK(file_id, FAIL, "H5Fcreate");
/* Create first dataset & write data */
- Dataset1 = H5Dcreate2(file_id, MISC14_DSET1_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ Dataset1 = H5Dcreate2(file_id, MISC14_DSET1_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(Dataset1, FAIL, "H5Dcreate2");
ret = H5Dwrite(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data1);
CHECK(ret, FAIL, "H5Dwrite");
/* Create second dataset (to be unlinked). */
- Dataset2 = H5Dcreate2(file_id, MISC14_DSET2_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ Dataset2 = H5Dcreate2(file_id, MISC14_DSET2_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(Dataset2, FAIL, "H5Dcreate2");
ret = H5Dwrite(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data2);
@@ -2542,8 +2567,8 @@ test_misc14(void)
/* Check data from first dataset */
ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if(!H5_DBL_ABS_EQUAL(rdata, data1))
- TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__);
+ if (!H5_DBL_ABS_EQUAL(rdata, data1))
+ TestErrPrintf("Error on line %d: data1!=rdata\n", __LINE__);
/* Unlink second dataset */
ret = H5Ldelete(file_id, MISC14_DSET2_NAME, H5P_DEFAULT);
@@ -2556,15 +2581,15 @@ test_misc14(void)
/* Verify the data from dataset #1 */
ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if(!H5_DBL_ABS_EQUAL(rdata,data1))
- TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__);
+ if (!H5_DBL_ABS_EQUAL(rdata, data1))
+ TestErrPrintf("Error on line %d: data1!=rdata\n", __LINE__);
/* Close first dataset */
ret = H5Dclose(Dataset1);
CHECK(ret, FAIL, "H5Dclose");
/* Close the file */
- ret = H5Fclose (file_id);
+ ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
/* Test creating two datasets and deleting the first */
@@ -2574,14 +2599,16 @@ test_misc14(void)
CHECK(file_id, FAIL, "H5Fcreate");
/* Create first dataset & write data */
- Dataset1 = H5Dcreate2(file_id, MISC14_DSET1_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ Dataset1 = H5Dcreate2(file_id, MISC14_DSET1_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(Dataset1, FAIL, "H5Dcreate2");
ret = H5Dwrite(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data1);
CHECK(ret, FAIL, "H5Dwrite");
/* Create second dataset */
- Dataset2 = H5Dcreate2(file_id, MISC14_DSET2_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ Dataset2 = H5Dcreate2(file_id, MISC14_DSET2_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(Dataset2, FAIL, "H5Dcreate2");
ret = H5Dwrite(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data2);
@@ -2590,8 +2617,8 @@ test_misc14(void)
/* Check data from second dataset */
ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if(!H5_DBL_ABS_EQUAL(rdata,data2))
- TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__);
+ if (!H5_DBL_ABS_EQUAL(rdata, data2))
+ TestErrPrintf("Error on line %d: data2!=rdata\n", __LINE__);
/* Unlink first dataset */
ret = H5Ldelete(file_id, MISC14_DSET1_NAME, H5P_DEFAULT);
@@ -2604,15 +2631,15 @@ test_misc14(void)
/* Verify the data from dataset #2 */
ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if(!H5_DBL_ABS_EQUAL(rdata,data2))
- TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__);
+ if (!H5_DBL_ABS_EQUAL(rdata, data2))
+ TestErrPrintf("Error on line %d: data2!=rdata\n", __LINE__);
/* Close second dataset */
ret = H5Dclose(Dataset2);
CHECK(ret, FAIL, "H5Dclose");
/* Close the file */
- ret = H5Fclose (file_id);
+ ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
/* Test creating three datasets and deleting the second */
@@ -2622,21 +2649,24 @@ test_misc14(void)
CHECK(file_id, FAIL, "H5Fcreate");
/* Create first dataset & write data */
- Dataset1 = H5Dcreate2(file_id, MISC14_DSET1_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ Dataset1 = H5Dcreate2(file_id, MISC14_DSET1_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(Dataset1, FAIL, "H5Dcreate2");
ret = H5Dwrite(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data1);
CHECK(ret, FAIL, "H5Dwrite");
/* Create second dataset */
- Dataset2 = H5Dcreate2(file_id, MISC14_DSET2_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ Dataset2 = H5Dcreate2(file_id, MISC14_DSET2_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(Dataset2, FAIL, "H5Dcreate2");
ret = H5Dwrite(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data2);
CHECK(ret, FAIL, "H5Dwrite");
/* Create third dataset */
- Dataset3 = H5Dcreate2(file_id, MISC14_DSET3_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ Dataset3 = H5Dcreate2(file_id, MISC14_DSET3_NAME, H5T_NATIVE_DOUBLE, DataSpace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(Dataset2, FAIL, "H5Dcreate2");
ret = H5Dwrite(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data3);
@@ -2645,14 +2675,14 @@ test_misc14(void)
/* Check data from first dataset */
ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if(!H5_DBL_ABS_EQUAL(rdata,data1))
- TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__);
+ if (!H5_DBL_ABS_EQUAL(rdata, data1))
+ TestErrPrintf("Error on line %d: data1!=rdata\n", __LINE__);
/* Check data from third dataset */
ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if(!H5_DBL_ABS_EQUAL(rdata,data3))
- TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__);
+ if (!H5_DBL_ABS_EQUAL(rdata, data3))
+ TestErrPrintf("Error on line %d: data3!=rdata\n", __LINE__);
/* Unlink second dataset */
ret = H5Ldelete(file_id, MISC14_DSET2_NAME, H5P_DEFAULT);
@@ -2665,14 +2695,14 @@ test_misc14(void)
/* Verify the data from dataset #1 */
ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if(!H5_DBL_ABS_EQUAL(rdata,data1))
- TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__);
+ if (!H5_DBL_ABS_EQUAL(rdata, data1))
+ TestErrPrintf("Error on line %d: data1!=rdata\n", __LINE__);
/* Verify the data from dataset #3 */
ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
- if(!H5_DBL_ABS_EQUAL(rdata,data3))
- TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__);
+ if (!H5_DBL_ABS_EQUAL(rdata, data3))
+ TestErrPrintf("Error on line %d: data3!=rdata\n", __LINE__);
/* Close first dataset */
ret = H5Dclose(Dataset1);
@@ -2683,13 +2713,13 @@ test_misc14(void)
CHECK(ret, FAIL, "H5Dclose");
/* Close the file */
- ret = H5Fclose (file_id);
+ ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
/* Close shared objects (dataspace & fapl) */
- ret = H5Sclose (DataSpace);
+ ret = H5Sclose(DataSpace);
CHECK(ret, FAIL, "H5Sclose");
- ret = H5Pclose (fapl);
+ ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
} /* end test_misc14() */
@@ -2703,9 +2733,9 @@ test_misc14(void)
static void
test_misc15(void)
{
- hid_t file; /* File ID */
- hid_t fapl; /* File access property list */
- herr_t ret; /* Generic return value */
+ hid_t file; /* File ID */
+ hid_t fapl; /* File access property list */
+ herr_t ret; /* Generic return value */
/* Create the file & get it's FAPL */
file = H5Fcreate(MISC15_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2755,15 +2785,15 @@ test_misc15(void)
static void
test_misc16(void)
{
- hid_t file; /* File ID */
- herr_t ret; /* Generic return value */
- char wdata[MISC16_SPACE_DIM][MISC16_STR_SIZE];
- char rdata[MISC16_SPACE_DIM][MISC16_STR_SIZE]; /* Information read in */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t dims[] = {MISC16_SPACE_DIM};
- int i;
+ hid_t file; /* File ID */
+ herr_t ret; /* Generic return value */
+ char wdata[MISC16_SPACE_DIM][MISC16_STR_SIZE];
+ char rdata[MISC16_SPACE_DIM][MISC16_STR_SIZE]; /* Information read in */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t dims[] = {MISC16_SPACE_DIM};
+ int i;
/* Initialize the data */
/* (Note that these are supposed to stress the code, so are a little weird) */
@@ -2803,16 +2833,19 @@ test_misc16(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < MISC16_SPACE_DIM; i++) {
- if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
- TestErrPrintf("Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(unsigned)__LINE__, (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ for (i = 0; i < MISC16_SPACE_DIM; i++) {
+ if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
+ TestErrPrintf(
+ "Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
+ (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i]));
continue;
} /* end if */
- if(HDstrcmp(wdata[i], rdata[i]) != 0 ) {
- TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(unsigned)__LINE__, (int)i,wdata[i],(int)i,rdata[i]);
+ if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
+ (unsigned)__LINE__, (int)i, wdata[i], (int)i, rdata[i]);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -2840,15 +2873,15 @@ test_misc16(void)
static void
test_misc17(void)
{
- hid_t file; /* File ID */
- herr_t ret; /* Generic return value */
- char wdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2];
- char rdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2]; /* Information read in */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t dims[] = {MISC17_SPACE_DIM1, MISC17_SPACE_DIM2};
- int i;
+ hid_t file; /* File ID */
+ herr_t ret; /* Generic return value */
+ char wdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2];
+ char rdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2]; /* Information read in */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t dims[] = {MISC17_SPACE_DIM1, MISC17_SPACE_DIM2};
+ int i;
/* Initialize the data */
/* (Note that these are supposed to stress the code, so are a little weird) */
@@ -2866,10 +2899,10 @@ test_misc17(void)
CHECK(sid, FAIL, "H5Screate_simple");
/* Create a datatype to refer to */
- tid = H5Tcopy (H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
CHECK(tid, FAIL, "H5Tcopy");
- ret = H5Tset_strpad (tid,H5T_STR_NULLPAD);
+ ret = H5Tset_strpad(tid, H5T_STR_NULLPAD);
CHECK(ret, FAIL, "H5Tset_strpad");
/* Create a dataset */
@@ -2885,16 +2918,19 @@ test_misc17(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data in the way of strings. */
- for(i = 0; i < MISC17_SPACE_DIM1; i++) {
- if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
- TestErrPrintf("Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(unsigned)__LINE__, (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ for (i = 0; i < MISC17_SPACE_DIM1; i++) {
+ if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
+ TestErrPrintf(
+ "Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
+ (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i]));
continue;
} /* end if */
- if(HDstrcmp(wdata[i], rdata[i]) != 0 ) {
- TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(unsigned)__LINE__, (int)i,wdata[i],(int)i,rdata[i]);
+ if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
+ (unsigned)__LINE__, (int)i, wdata[i], (int)i, rdata[i]);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -2921,18 +2957,18 @@ test_misc17(void)
static void
test_misc18(void)
{
- hid_t fid; /* File ID */
- hid_t sid; /* 'Space ID */
- hid_t did1, did2; /* Dataset IDs */
- hid_t aid; /* Attribute ID */
+ hid_t fid; /* File ID */
+ hid_t sid; /* 'Space ID */
+ hid_t did1, did2; /* Dataset IDs */
+ hid_t aid; /* Attribute ID */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- H5O_info1_t old_oinfo; /* (deprecated) information about object */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- H5O_info2_t oinfo; /* Data model information about object */
- H5O_native_info_t ninfo; /* Native file format information about object */
- char attr_name[32]; /* Attribute name buffer */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ H5O_info1_t old_oinfo; /* (deprecated) information about object */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ H5O_info2_t oinfo; /* Data model information about object */
+ H5O_native_info_t ninfo; /* Native file format information about object */
+ char attr_name[32]; /* Attribute name buffer */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create the file */
fid = H5Fcreate(MISC18_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2951,7 +2987,8 @@ test_misc18(void)
CHECK(ret, FAIL, "H5Oget_info_by_name");
VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name");
#ifndef H5_NO_DEPRECATED_SYMBOLS
- ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR | H5O_INFO_NUM_ATTRS,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name");
VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name");
@@ -2975,7 +3012,8 @@ test_misc18(void)
CHECK(ret, FAIL, "H5Oget_info_by_name");
VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name");
#ifndef H5_NO_DEPRECATED_SYMBOLS
- ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR | H5O_INFO_NUM_ATTRS,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name");
VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name");
@@ -2991,7 +3029,7 @@ test_misc18(void)
VERIFY(ninfo.hdr.space.free, 152, "H5Oget_native_info_by_name");
/* Loop creating attributes on each dataset, flushing them to the file each time */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
/* Set up attribute name */
HDsprintf(attr_name, "Attr %u", u);
@@ -3010,7 +3048,7 @@ test_misc18(void)
CHECK(ret, FAIL, "H5Aclose");
/* Flush file, to 'fix' size of dataset object headers */
- ret = H5Fflush(fid,H5F_SCOPE_GLOBAL);
+ ret = H5Fflush(fid, H5F_SCOPE_GLOBAL);
CHECK(ret, FAIL, "H5Fflush");
} /* end for */
@@ -3019,7 +3057,8 @@ test_misc18(void)
CHECK(ret, FAIL, "H5Oget_info_by_name");
VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name");
#ifndef H5_NO_DEPRECATED_SYMBOLS
- ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR | H5O_INFO_NUM_ATTRS,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name");
VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name");
@@ -3039,7 +3078,8 @@ test_misc18(void)
CHECK(ret, FAIL, "H5Oget_info_by_name");
VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name");
#ifndef H5_NO_DEPRECATED_SYMBOLS
- ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR | H5O_INFO_NUM_ATTRS,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name");
VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name");
@@ -3078,25 +3118,25 @@ test_misc18(void)
static void
test_misc19(void)
{
- hid_t fid = -1; /* File ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t plid = -1; /* Property List ID */
- hid_t pcid = -1; /* Property Class ID */
- hid_t gid = -1; /* Group ID */
- hid_t ecid = -1; /* Error Class ID */
- hid_t emid = -1; /* Error Message ID */
- hid_t esid = -1; /* Error Stack ID */
- hid_t vfdid = -1; /* Virtual File Driver ID */
- hid_t volid = -1; /* Virtual Object Layer ID */
- H5FD_class_t *vfd_cls = NULL; /* VFD class */
- H5VL_class_t *vol_cls = NULL; /* VOL class */
- int rc; /* Reference count */
- herr_t ret; /* Generic return value */
-
-/* Check H5I operations on files */
+ hid_t fid = -1; /* File ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t plid = -1; /* Property List ID */
+ hid_t pcid = -1; /* Property Class ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t ecid = -1; /* Error Class ID */
+ hid_t emid = -1; /* Error Message ID */
+ hid_t esid = -1; /* Error Stack ID */
+ hid_t vfdid = -1; /* Virtual File Driver ID */
+ hid_t volid = -1; /* Virtual Object Layer ID */
+ H5FD_class_t *vfd_cls = NULL; /* VFD class */
+ H5VL_class_t *vol_cls = NULL; /* VOL class */
+ int rc; /* Reference count */
+ herr_t ret; /* Generic return value */
+
+ /* Check H5I operations on files */
/* Create the file */
fid = H5Fcreate(MISC19_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3123,12 +3163,11 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the file again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Fclose(fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Fclose(fid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Fclose");
-/* Check H5I operations on property lists */
+ /* Check H5I operations on property lists */
/* Create the property list */
plid = H5Pcreate(H5P_DATASET_CREATE);
@@ -3155,15 +3194,14 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the property list again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Pclose(plid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pclose(plid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pclose");
-/* Check H5I operations on property classes */
+ /* Check H5I operations on property classes */
/* Create a property class */
- pcid = H5Pcreate_class(H5P_DATASET_CREATE,"foo",NULL,NULL,NULL,NULL,NULL,NULL);
+ pcid = H5Pcreate_class(H5P_DATASET_CREATE, "foo", NULL, NULL, NULL, NULL, NULL, NULL);
CHECK(pcid, FAIL, "H5Pcreate_class");
/* Check the reference count */
@@ -3187,12 +3225,11 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the property class again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Pclose_class(pcid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pclose_class(pcid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Pclose_class");
-/* Check H5I operations on datatypes */
+ /* Check H5I operations on datatypes */
/* Create a datatype */
tid = H5Tcreate(H5T_OPAQUE, (size_t)16);
@@ -3219,12 +3256,11 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the datatype again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Tclose(tid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Tclose(tid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Tclose");
-/* Check H5I operations on dataspaces */
+ /* Check H5I operations on dataspaces */
/* Create a dataspace */
sid = H5Screate(H5S_SCALAR);
@@ -3251,12 +3287,11 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the dataspace again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Sclose(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Sclose(sid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sclose");
-/* Check H5I operations on datasets */
+ /* Check H5I operations on datasets */
/* Create a file */
fid = H5Fcreate(MISC19_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3291,9 +3326,8 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the dataset again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Dclose(did);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dclose(did); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dclose");
/* Close the dataspace */
@@ -3304,7 +3338,7 @@ test_misc19(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-/* Check H5I operations on attributes */
+ /* Check H5I operations on attributes */
/* Create a file */
fid = H5Fcreate(MISC19_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3343,9 +3377,8 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the attribute again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Aclose(aid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Aclose(aid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Aclose");
/* Close the root group */
@@ -3360,7 +3393,7 @@ test_misc19(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-/* Check H5I operations on groups */
+ /* Check H5I operations on groups */
/* Create a file */
fid = H5Fcreate(MISC19_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3391,19 +3424,18 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the group again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Gclose(gid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Gclose(gid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Gclose");
/* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-/* Check H5I operations on error classes */
+ /* Check H5I operations on error classes */
/* Create an error class */
- ecid = H5Eregister_class("foo","bar","baz");
+ ecid = H5Eregister_class("foo", "bar", "baz");
CHECK(ecid, FAIL, "H5Eregister_class");
/* Check the reference count */
@@ -3427,19 +3459,18 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the error class again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Eunregister_class(ecid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Eunregister_class(ecid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Eunregister_class");
-/* Check H5I operations on error messages */
+ /* Check H5I operations on error messages */
/* Create an error class */
- ecid = H5Eregister_class("foo","bar","baz");
+ ecid = H5Eregister_class("foo", "bar", "baz");
CHECK(ecid, FAIL, "H5Eregister_class");
/* Create an error message */
- emid = H5Ecreate_msg(ecid,H5E_MAJOR,"mumble");
+ emid = H5Ecreate_msg(ecid, H5E_MAJOR, "mumble");
CHECK(emid, FAIL, "H5Ecreate_msg");
/* Check the reference count */
@@ -3463,16 +3494,15 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the error message again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Eclose_msg(emid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Eclose_msg(emid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Eclose_msg");
/* Close the error class */
ret = H5Eunregister_class(ecid);
CHECK(ret, FAIL, "H5Eunregister_class");
-/* Check H5I operations on error stacks */
+ /* Check H5I operations on error stacks */
/* Create an error stack */
esid = H5Eget_current_stack();
@@ -3499,13 +3529,11 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try closing the error stack again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Eclose_stack(esid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Eclose_stack(esid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Eclose_stack");
-
-/* Check H5I operations on virtual file drivers */
+ /* Check H5I operations on virtual file drivers */
/* Get a VFD class to register */
vfd_cls = h5_get_dummy_vfd_class();
@@ -3536,14 +3564,13 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try unregistering the VFD again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5FDunregister(vfdid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5FDunregister(vfdid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5FDunregister");
HDfree(vfd_cls);
-/* Check H5I operations on virtual object connectors */
+ /* Check H5I operations on virtual object connectors */
/* Get a VOL class to register */
vol_cls = h5_get_dummy_vol_class();
@@ -3574,9 +3601,8 @@ test_misc19(void)
VERIFY(rc, 0, "H5Idec_ref");
/* Try unregistering the VOL connector again (should fail) */
- H5E_BEGIN_TRY {
- ret = H5VLunregister_connector(volid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5VLunregister_connector(volid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5VLunregister_connector");
HDfree(vol_cls);
@@ -3592,17 +3618,17 @@ test_misc19(void)
static void
test_misc20(void)
{
- hid_t fid; /* File ID */
- hid_t sid; /* 'Space ID */
- hid_t did; /* Dataset ID */
- hid_t dcpl; /* Dataset creation property list ID */
- int rank=MISC20_SPACE_RANK; /* Rank of dataspace */
- hsize_t big_dims[MISC20_SPACE_RANK]={MISC20_SPACE_DIM0,MISC20_SPACE_DIM1}; /* Large dimensions */
- hsize_t small_dims[MISC20_SPACE_RANK]={MISC20_SPACE2_DIM0,MISC20_SPACE2_DIM1}; /* Small dimensions */
- unsigned version; /* Version of storage layout info */
- hsize_t contig_size; /* Size of contiguous storage size from layout into */
+ hid_t fid; /* File ID */
+ hid_t sid; /* 'Space ID */
+ hid_t did; /* Dataset ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ int rank = MISC20_SPACE_RANK; /* Rank of dataspace */
+ hsize_t big_dims[MISC20_SPACE_RANK] = {MISC20_SPACE_DIM0, MISC20_SPACE_DIM1}; /* Large dimensions */
+ hsize_t small_dims[MISC20_SPACE_RANK] = {MISC20_SPACE2_DIM0, MISC20_SPACE2_DIM1}; /* Small dimensions */
+ unsigned version; /* Version of storage layout info */
+ hsize_t contig_size; /* Size of contiguous storage size from layout into */
const char *testfile = H5_get_srcdir_filename(MISC20_FILE_OLD); /* Corrected test file name */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing large dimension truncation fix\n"));
@@ -3678,14 +3704,15 @@ test_misc20(void)
CHECK(did, FAIL, "H5Dopen2");
/* Get the layout version */
- ret = H5D__layout_version_test(did,&version);
+ ret = H5D__layout_version_test(did, &version);
CHECK(ret, FAIL, "H5D__layout_version_test");
VERIFY(version, 3, "H5D__layout_version_test");
/* Get the layout contiguous storage size */
- ret = H5D__layout_contig_size_test(did,&contig_size);
+ ret = H5D__layout_contig_size_test(did, &contig_size);
CHECK(ret, FAIL, "H5D__layout_contig_size_test");
- VERIFY(contig_size, (MISC20_SPACE_DIM0 * MISC20_SPACE_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5D__layout_contig_size_test");
+ VERIFY(contig_size, (MISC20_SPACE_DIM0 * MISC20_SPACE_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5D__layout_contig_size_test");
/* Close datasset */
ret = H5Dclose(did);
@@ -3696,14 +3723,15 @@ test_misc20(void)
CHECK(did, FAIL, "H5Dopen2");
/* Get the layout version */
- ret = H5D__layout_version_test(did,&version);
+ ret = H5D__layout_version_test(did, &version);
CHECK(ret, FAIL, "H5D__layout_version_test");
VERIFY(version, 3, "H5D__layout_version_test");
/* Get the layout contiguous storage size */
- ret = H5D__layout_contig_size_test(did,&contig_size);
+ ret = H5D__layout_contig_size_test(did, &contig_size);
CHECK(ret, FAIL, "H5D__layout_contig_size_test");
- VERIFY(contig_size, (MISC20_SPACE2_DIM0 * MISC20_SPACE2_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5D__layout_contig_size_test");
+ VERIFY(contig_size, (MISC20_SPACE2_DIM0 * MISC20_SPACE2_DIM1 * H5Tget_size(H5T_NATIVE_INT)),
+ "H5D__layout_contig_size_test");
/* Close datasset */
ret = H5Dclose(did);
@@ -3726,14 +3754,15 @@ test_misc20(void)
CHECK(did, FAIL, "H5Dopen2");
/* Get the layout version */
- ret = H5D__layout_version_test(did,&version);
+ ret = H5D__layout_version_test(did, &version);
CHECK(ret, FAIL, "H5D__layout_version_test");
VERIFY(version, 2, "H5D__layout_version_test");
/* Get the layout contiguous storage size */
- ret = H5D__layout_contig_size_test(did,&contig_size);
+ ret = H5D__layout_contig_size_test(did, &contig_size);
CHECK(ret, FAIL, "H5D__layout_contig_size_test");
- VERIFY(contig_size, (MISC20_SPACE_DIM0 * MISC20_SPACE_DIM1 * H5Tget_size(H5T_STD_I32LE)), "H5D__layout_contig_size_test");
+ VERIFY(contig_size, (MISC20_SPACE_DIM0 * MISC20_SPACE_DIM1 * H5Tget_size(H5T_STD_I32LE)),
+ "H5D__layout_contig_size_test");
/* Close datasset */
ret = H5Dclose(did);
@@ -3763,13 +3792,14 @@ test_misc20(void)
static void
test_misc21(void)
{
- hid_t fid, sid, dcpl, dsid;
- char *buf;
- hsize_t dims[2]={MISC21_SPACE_DIM0,MISC21_SPACE_DIM1},
- chunk_size[2]={MISC21_CHUNK_DIM0,MISC21_CHUNK_DIM1};
- herr_t ret; /* Generic return value */
-
- if (h5_szip_can_encode() != 1) return;
+ hid_t fid, sid, dcpl, dsid;
+ char * buf;
+ hsize_t dims[2] = {MISC21_SPACE_DIM0, MISC21_SPACE_DIM1},
+ chunk_size[2] = {MISC21_CHUNK_DIM0, MISC21_CHUNK_DIM1};
+ herr_t ret; /* Generic return value */
+
+ if (h5_szip_can_encode() != 1)
+ return;
/* Output message about test being performed */
MESSAGE(5, ("Testing late allocation time w/chunks & filters\n"));
@@ -3828,37 +3858,38 @@ test_misc21(void)
static void
test_misc22(void)
{
- hid_t fid, sid, dcpl, dsid, dcpl2;
- char *buf;
- hsize_t dims[2]={MISC22_SPACE_DIM0,MISC22_SPACE_DIM1},
- chunk_size[2]={MISC22_CHUNK_DIM0,MISC22_CHUNK_DIM1};
- herr_t ret; /* Generic return value */
- hid_t dtype;
+ hid_t fid, sid, dcpl, dsid, dcpl2;
+ char * buf;
+ hsize_t dims[2] = {MISC22_SPACE_DIM0, MISC22_SPACE_DIM1},
+ chunk_size[2] = {MISC22_CHUNK_DIM0, MISC22_CHUNK_DIM1};
+ herr_t ret; /* Generic return value */
+ hid_t dtype;
/* should extend test to signed ints */
hid_t idts[4];
-/* do the same for floats
- hid_t fdts[2]={H5T_NATIVE_FLOAT32,
- H5T_NATIVE_FLOAT64}
-*/
- size_t prec[4] = {3,11,19,27};
- size_t offsets[5] = {0,3,11,19,27};
- int i,j,k;
+ /* do the same for floats
+ hid_t fdts[2]={H5T_NATIVE_FLOAT32,
+ H5T_NATIVE_FLOAT64}
+ */
+ size_t prec[4] = {3, 11, 19, 27};
+ size_t offsets[5] = {0, 3, 11, 19, 27};
+ int i, j, k;
unsigned int flags;
- size_t cd_nelmts=32;
+ size_t cd_nelmts = 32;
unsigned int cd_values[32];
- unsigned correct;
+ unsigned correct;
- if (h5_szip_can_encode() != 1) return;
- idts[0]=H5Tcopy(H5T_NATIVE_UINT8);
- idts[1]=H5Tcopy(H5T_NATIVE_UINT16);
- idts[2]=H5Tcopy(H5T_NATIVE_UINT32);
- idts[3]=H5Tcopy(H5T_NATIVE_UINT64);
+ if (h5_szip_can_encode() != 1)
+ return;
+ idts[0] = H5Tcopy(H5T_NATIVE_UINT8);
+ idts[1] = H5Tcopy(H5T_NATIVE_UINT16);
+ idts[2] = H5Tcopy(H5T_NATIVE_UINT32);
+ idts[3] = H5Tcopy(H5T_NATIVE_UINT64);
/* Output message about test being performed */
MESSAGE(5, ("Testing datatypes with SZIP filter\n"));
/* Allocate space for the buffer */
- buf = (char *)HDcalloc(MISC22_SPACE_DIM0*MISC22_SPACE_DIM1, 8);
+ buf = (char *)HDcalloc(MISC22_SPACE_DIM0 * MISC22_SPACE_DIM1, 8);
CHECK(buf, NULL, "HDcalloc");
/* Create the file */
@@ -3871,12 +3902,16 @@ test_misc22(void)
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
- if (prec[j] > (H5Tget_size(idts[i])*8)) continue; /* skip irrelevant combination */
+ if (prec[j] > (H5Tget_size(idts[i]) * 8))
+ continue; /* skip irrelevant combination */
for (k = 0; k < 5; k++) {
- if (offsets[k] > (H5Tget_size(idts[i])*8)) continue; /* skip irrelevant combinations */
- if ((prec[j]+offsets[k]) > (H5Tget_size(idts[i])*8)) continue;
+ if (offsets[k] > (H5Tget_size(idts[i]) * 8))
+ continue; /* skip irrelevant combinations */
+ if ((prec[j] + offsets[k]) > (H5Tget_size(idts[i]) * 8))
+ continue;
- MESSAGE(5, (" Testing datatypes size=%d precision=%u offset=%d\n",H5Tget_size(idts[i]),(unsigned)prec[j],(unsigned)offsets[k]));
+ MESSAGE(5, (" Testing datatypes size=%d precision=%u offset=%d\n", H5Tget_size(idts[i]),
+ (unsigned)prec[j], (unsigned)offsets[k]));
/* Create the DCPL */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
@@ -3886,26 +3921,26 @@ test_misc22(void)
ret = H5Pset_chunk(dcpl, MISC22_SPACE_RANK, chunk_size);
CHECK(ret, FAIL, "H5Pset_chunk");
/* Set custom DCPL properties */
- ret = H5Pset_szip(dcpl, H5_SZIP_NN_OPTION_MASK, 32); /* vary the PPB */
+ ret = H5Pset_szip(dcpl, H5_SZIP_NN_OPTION_MASK, 32); /* vary the PPB */
CHECK(ret, FAIL, "H5Pset_szip");
/* set up the datatype according to the loop */
dtype = H5Tcopy(idts[i]);
CHECK(dtype, FAIL, "H5Tcopy");
- ret = H5Tset_precision(dtype,prec[j]);
+ ret = H5Tset_precision(dtype, prec[j]);
CHECK(ret, FAIL, "H5Tset_precision");
- ret = H5Tset_offset(dtype,offsets[k]);
+ ret = H5Tset_offset(dtype, offsets[k]);
CHECK(ret, FAIL, "H5Tset_precision");
/* compute the correct PPB that should be set by SZIP */
- if(offsets[k] == 0)
+ if (offsets[k] == 0)
correct = prec[j];
else
correct = H5Tget_size(idts[i]) * 8;
- if(correct > 24) {
- if(correct <= 32)
+ if (correct > 24) {
+ if (correct <= 32)
correct = 32;
- else if(correct <= 64)
+ else if (correct <= 64)
correct = 64;
} /* end if */
@@ -3931,8 +3966,8 @@ test_misc22(void)
dcpl2 = H5Dget_create_plist(dsid);
CHECK(dcpl2, FAIL, "H5Dget_create_plist");
- ret = H5Pget_filter_by_id2(dcpl2, H5Z_FILTER_SZIP, &flags,
- &cd_nelmts, cd_values, 0, NULL , NULL);
+ ret = H5Pget_filter_by_id2(dcpl2, H5Z_FILTER_SZIP, &flags, &cd_nelmts, cd_values, 0, NULL,
+ NULL);
CHECK(ret, FAIL, "H5Pget_filter_by_id2");
VERIFY(cd_values[2], correct, "SZIP filter returned value for precision");
@@ -3973,10 +4008,10 @@ test_misc22(void)
static void
test_misc23(void)
{
- hsize_t dims[] = {10};
- hid_t file_id=0, group_id=0, type_id=0, space_id=0,
- tmp_id=0, create_id=H5P_DEFAULT, access_id=H5P_DEFAULT;
- char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */
+ hsize_t dims[] = {10};
+ hid_t file_id = 0, group_id = 0, type_id = 0, space_id = 0, tmp_id = 0, create_id = H5P_DEFAULT,
+ access_id = H5P_DEFAULT;
+ char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */
H5O_info2_t oinfo;
htri_t tri_status;
ssize_t namelen;
@@ -3989,7 +4024,6 @@ test_misc23(void)
file_id = H5Fcreate(MISC23_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file_id, FAIL, "H5Fcreate");
-
/* Build some infrastructure */
group_id = H5Gcreate2(file_id, "/A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group_id, FAIL, "H5Gcreate2");
@@ -3997,34 +4031,28 @@ test_misc23(void)
space_id = H5Screate_simple(1, dims, NULL);
CHECK(space_id, FAIL, "H5Screate_simple");
- type_id = H5Tcopy( H5T_STD_I32BE);
+ type_id = H5Tcopy(H5T_STD_I32BE);
CHECK(type_id, FAIL, "H5Tcopy");
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/**********************************************************************
* test the old APIs
**********************************************************************/
- H5E_BEGIN_TRY {
- tmp_id = H5Gcreate1(file_id, "/A/B00a/grp", (size_t)0);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Gcreate1(file_id, "/A/B00a/grp", (size_t)0); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gcreate1");
-
tmp_id = H5Gcreate1(file_id, "/A/grp", (size_t)0);
CHECK(tmp_id, FAIL, "H5Gcreate1");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
-
- H5E_BEGIN_TRY {
- tmp_id = H5Dcreate1(file_id, "/A/B00c/dset", type_id, space_id, create_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Dcreate1(file_id, "/A/B00c/dset", type_id, space_id, create_id); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Dcreate1");
-
tmp_id = H5Dcreate1(file_id, "/A/dset", type_id, space_id, create_id);
CHECK(tmp_id, FAIL, "H5Dcreate1");
@@ -4044,7 +4072,6 @@ test_misc23(void)
status = H5Pset_create_intermediate_group(create_id, TRUE);
CHECK(status, FAIL, "H5Pset_create_intermediate_group");
-
tmp_id = H5Gcreate2(file_id, "/A/B01/grp", create_id, H5P_DEFAULT, access_id);
CHECK(tmp_id, FAIL, "H5Gcreate2");
@@ -4067,39 +4094,33 @@ test_misc23(void)
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
-
tmp_id = H5Gcreate2(file_id, "/A/B02/C02/grp", create_id, H5P_DEFAULT, access_id);
CHECK(tmp_id, FAIL, "H5Gcreate2");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
-
tmp_id = H5Gcreate2(group_id, "B03/grp/", create_id, H5P_DEFAULT, access_id);
CHECK(tmp_id, FAIL, "H5Gcreate2");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
-
tmp_id = H5Gcreate2(group_id, "/A/B04/grp/", create_id, H5P_DEFAULT, access_id);
CHECK(tmp_id, FAIL, "H5Gcreate2");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
-
tmp_id = H5Gcreate2(file_id, "/A/B05/C05/A", create_id, H5P_DEFAULT, access_id);
CHECK(tmp_id, FAIL, "H5Gcreate2");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
-
status = H5Pclose(create_id);
CHECK(status, FAIL, "H5Pclose");
-
/**********************************************************************
* test H5Dcreate2()
**********************************************************************/
@@ -4112,42 +4133,36 @@ test_misc23(void)
status = H5Pset_create_intermediate_group(create_id, TRUE);
CHECK(status, FAIL, "H5Pset_create_intermediate_group");
-
tmp_id = H5Dcreate2(file_id, "/A/B06/dset", type_id, space_id, create_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(tmp_id, FAIL, "H5Dcreate2");
status = H5Dclose(tmp_id);
CHECK(status, FAIL, "H5Dclose");
-
tmp_id = H5Dcreate2(file_id, "/A/B07/B07/dset", type_id, space_id, create_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(tmp_id, FAIL, "H5Dcreate2");
status = H5Dclose(tmp_id);
CHECK(status, FAIL, "H5Dclose");
-
tmp_id = H5Dcreate2(group_id, "B08/dset", type_id, space_id, create_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(tmp_id, FAIL, "H5Dcreate2");
status = H5Dclose(tmp_id);
CHECK(status, FAIL, "H5Dclose");
-
tmp_id = H5Dcreate2(group_id, "/A/B09/dset", type_id, space_id, create_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(tmp_id, FAIL, "H5Dcreate2");
status = H5Dclose(tmp_id);
CHECK(status, FAIL, "H5Dclose");
-
tmp_id = H5Dcreate2(file_id, "/A/B10/C10/A/dset", type_id, space_id, create_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(tmp_id, FAIL, "H5Dcreate2");
status = H5Dclose(tmp_id);
CHECK(status, FAIL, "H5Dclose");
-
status = H5Tclose(type_id);
CHECK(status, FAIL, "H5Tclose");
@@ -4157,10 +4172,9 @@ test_misc23(void)
status = H5Pclose(create_id);
CHECK(status, FAIL, "H5Pclose");
-
/**********************************************************************
- * test H5Tcommit2()
- **********************************************************************/
+ * test H5Tcommit2()
+ **********************************************************************/
/* Create link creation property list */
create_id = H5Pcreate(H5P_LINK_CREATE);
@@ -4179,7 +4193,6 @@ test_misc23(void)
status = H5Tclose(tmp_id);
CHECK(status, FAIL, "H5Tclose");
-
tmp_id = H5Tcopy(H5T_NATIVE_INT32);
CHECK(tmp_id, FAIL, "H5Tcopy");
@@ -4189,7 +4202,6 @@ test_misc23(void)
status = H5Tclose(tmp_id);
CHECK(status, FAIL, "H5Tclose");
-
tmp_id = H5Tcopy(H5T_NATIVE_INT64);
CHECK(tmp_id, FAIL, "H5Tcopy");
@@ -4199,7 +4211,6 @@ test_misc23(void)
status = H5Tclose(tmp_id);
CHECK(status, FAIL, "H5Tclose");
-
tmp_id = H5Tcopy(H5T_NATIVE_FLOAT);
CHECK(tmp_id, FAIL, "H5Tcopy");
@@ -4209,7 +4220,6 @@ test_misc23(void)
status = H5Tclose(tmp_id);
CHECK(status, FAIL, "H5Tclose");
-
tmp_id = H5Tcopy(H5T_NATIVE_DOUBLE);
CHECK(tmp_id, FAIL, "H5Tcopy");
@@ -4219,13 +4229,12 @@ test_misc23(void)
status = H5Tclose(tmp_id);
CHECK(status, FAIL, "H5Tclose");
-
status = H5Pclose(create_id);
CHECK(status, FAIL, "H5Pclose");
/**********************************************************************
- * test H5Lcopy()
- **********************************************************************/
+ * test H5Lcopy()
+ **********************************************************************/
/* Create link creation property list */
create_id = H5Pcreate(H5P_LINK_CREATE);
@@ -4245,8 +4254,8 @@ test_misc23(void)
VERIFY(tri_status, TRUE, "H5Lexists");
/**********************************************************************
- * test H5Lmove()
- **********************************************************************/
+ * test H5Lmove()
+ **********************************************************************/
status = H5Lmove(file_id, "/A/B16/grp", file_id, "/A/B17/grp", create_id, access_id);
CHECK(status, FAIL, "H5Lmove");
@@ -4258,8 +4267,8 @@ test_misc23(void)
VERIFY(tri_status, FALSE, "H5Lexists");
/**********************************************************************
- * test H5Lcreate_hard()
- **********************************************************************/
+ * test H5Lcreate_hard()
+ **********************************************************************/
status = H5Lcreate_hard(file_id, "/A/B01/grp", file_id, "/A/B18/grp", create_id, access_id);
CHECK(status, FAIL, "H5Lcreate_hard");
@@ -4268,8 +4277,8 @@ test_misc23(void)
VERIFY(tri_status, TRUE, "H5Lexists");
/**********************************************************************
- * test H5Lcreate_soft()
- **********************************************************************/
+ * test H5Lcreate_soft()
+ **********************************************************************/
status = H5Lcreate_soft("/A/B01/grp", file_id, "/A/B19/grp", create_id, access_id);
CHECK(status, FAIL, "H5Lcreate_soft");
@@ -4278,8 +4287,8 @@ test_misc23(void)
VERIFY(tri_status, TRUE, "H5Lexists");
/**********************************************************************
- * test H5Lcreate_external()
- **********************************************************************/
+ * test H5Lcreate_external()
+ **********************************************************************/
status = H5Lcreate_external("fake_filename", "fake_path", file_id, "/A/B20/grp", create_id, access_id);
CHECK(status, FAIL, "H5Lcreate_external");
@@ -4288,18 +4297,19 @@ test_misc23(void)
VERIFY(tri_status, TRUE, "H5Lexists");
/**********************************************************************
- * test H5Lcreate_ud()
- **********************************************************************/
+ * test H5Lcreate_ud()
+ **********************************************************************/
- status = H5Lcreate_ud(file_id, "/A/B21/grp", H5L_TYPE_EXTERNAL, "file\0obj", (size_t) 9, create_id, access_id);
+ status =
+ H5Lcreate_ud(file_id, "/A/B21/grp", H5L_TYPE_EXTERNAL, "file\0obj", (size_t)9, create_id, access_id);
CHECK(status, FAIL, "H5Lcreate_ud");
tri_status = H5Lexists(file_id, "/A/B21/grp", access_id);
VERIFY(tri_status, TRUE, "H5Lexists");
/**********************************************************************
- * close
- **********************************************************************/
+ * close
+ **********************************************************************/
status = H5Pclose(create_id);
CHECK(status, FAIL, "H5Pclose");
@@ -4320,9 +4330,8 @@ test_misc23(void)
static void
test_misc24(void)
{
- hid_t file_id = 0, group_id = 0, type_id = 0, space_id = 0,
- dset_id = 0, tmp_id = 0;
- herr_t ret; /* Generic return value */
+ hid_t file_id = 0, group_id = 0, type_id = 0, space_id = 0, dset_id = 0, tmp_id = 0;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing opening objects with inappropriate APIs\n"));
@@ -4339,7 +4348,8 @@ test_misc24(void)
group_id = H5Gcreate2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group_id, FAIL, "H5Gcreate2");
- dset_id = H5Dcreate2(file_id, MISC24_DATASET_NAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, MISC24_DATASET_NAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
type_id = H5Tcopy(H5T_NATIVE_INT);
@@ -4372,64 +4382,52 @@ test_misc24(void)
CHECK(ret, FAIL, "H5Tclose");
/* Attempt to open each kind of object with wrong API, including using soft links */
- H5E_BEGIN_TRY {
- tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Dopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Dopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Topen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Topen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Topen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Topen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Topen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Topen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Topen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Dopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Dopen2");
/* Try again, with the object already open through valid call */
@@ -4437,24 +4435,20 @@ test_misc24(void)
group_id = H5Gopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT);
CHECK(group_id, FAIL, "H5Gopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Dopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Dopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Topen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Topen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Topen2");
ret = H5Gclose(group_id);
@@ -4464,24 +4458,20 @@ test_misc24(void)
dset_id = H5Dopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Topen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Topen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Topen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Topen2");
ret = H5Dclose(dset_id);
@@ -4491,24 +4481,20 @@ test_misc24(void)
type_id = H5Topen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Topen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Dopen2");
- H5E_BEGIN_TRY {
- tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Dopen2");
ret = H5Tclose(type_id);
@@ -4528,12 +4514,12 @@ test_misc24(void)
static void
test_misc25a(void)
{
- hid_t fid; /* File ID */
- hid_t gid, gid2, gid3; /* Group IDs */
- hid_t aid; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t gid, gid2, gid3; /* Group IDs */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Exercise null object header message bug\n"));
@@ -4570,7 +4556,6 @@ test_misc25a(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -4639,7 +4624,6 @@ test_misc25a(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -4668,7 +4652,6 @@ test_misc25a(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -4711,7 +4694,6 @@ test_misc25a(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -4758,7 +4740,6 @@ test_misc25a(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -4779,7 +4760,6 @@ test_misc25a(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -4823,7 +4803,6 @@ test_misc25a(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_misc25a() */
-
/****************************************************************
**
** test_misc25b(): Exercise null object header message merge bug
@@ -4834,10 +4813,10 @@ test_misc25a(void)
static void
test_misc25b(void)
{
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
const char *testfile = H5_get_srcdir_filename(MISC25B_FILE); /* Corrected test file name */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Exercise null object header message bug\n"));
@@ -4859,7 +4838,6 @@ test_misc25b(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_misc25b() */
-
/****************************************************************
**
** test_misc25c(): Exercise another null object header message merge bug.
@@ -4868,15 +4846,15 @@ test_misc25b(void)
static void
test_misc25c(void)
{
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list ID */
- hid_t gcpl; /* Group creation property list ID */
- hid_t sid; /* Dataspace ID */
- hid_t did; /* Dataset ID */
- hid_t gid; /* Group ID */
- hid_t gid2; /* Group ID */
- hid_t aid; /* Attribute ID */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list ID */
+ hid_t gcpl; /* Group creation property list ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t did; /* Dataset ID */
+ hid_t gid; /* Group ID */
+ hid_t gid2; /* Group ID */
+ hid_t aid; /* Attribute ID */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Exercise another null object header message bug\n"));
@@ -4967,7 +4945,6 @@ test_misc25c(void)
ret = H5Pclose(gcpl);
CHECK(ret, FAIL, "H5Pclose");
-
/* Re-open the file */
fid = H5Fopen(MISC25C_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -4993,7 +4970,6 @@ test_misc25c(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_misc25c() */
-
/****************************************************************
**
** test_misc26(): Regression test: ensure that copying filter
@@ -5003,12 +4979,12 @@ test_misc25c(void)
static void
test_misc26(void)
{
- hid_t fid; /* File ID */
- hid_t sid; /* Dataspace ID */
- hid_t did; /* Dataset ID */
- hid_t dcpl1, dcpl2, dcpl3; /* Property List IDs */
+ hid_t fid; /* File ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t did; /* Dataset ID */
+ hid_t dcpl1, dcpl2, dcpl3; /* Property List IDs */
hsize_t dims[] = {1};
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Copying filter pipelines\n"));
@@ -5039,7 +5015,6 @@ test_misc26(void)
ret = H5Pset_deflate(dcpl3, 2);
CHECK_I(ret, "H5Pset_deflate");
-
/* Create a new file and datasets within that file that use these
* property lists
*/
@@ -5079,7 +5054,6 @@ test_misc26(void)
CHECK_I(ret, "H5Pclose");
}
-
/****************************************************************
**
** test_misc27(): Ensure that objects with incorrect # of object
@@ -5091,10 +5065,10 @@ test_misc26(void)
static void
test_misc27(void)
{
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
const char *testfile = H5_get_srcdir_filename(MISC27_FILE); /* Corrected test file name */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Corrupt object header handling\n"));
@@ -5105,11 +5079,10 @@ test_misc27(void)
#ifdef H5_STRICT_FORMAT_CHECKS
/* Open group with incorrect # of object header messages (should fail) */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, MISC27_GROUP, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { gid = H5Gopen2(fid, MISC27_GROUP, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(gid, FAIL, "H5Gopen2");
-#else /* H5_STRICT_FORMAT_CHECKS */
+#else /* H5_STRICT_FORMAT_CHECKS */
/* Open group with incorrect # of object header messages */
gid = H5Gopen2(fid, MISC27_GROUP, H5P_DEFAULT);
CHECK(gid, FAIL, "H5Gopen2");
@@ -5124,7 +5097,6 @@ test_misc27(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_misc27() */
-
/****************************************************************
**
** test_misc28(): Ensure that the dataset chunk cache will hold
@@ -5135,21 +5107,21 @@ test_misc27(void)
static void
test_misc28(void)
{
- hid_t fid; /* File ID */
- hid_t sidf; /* File Dataspace ID */
- hid_t sidm; /* Memory Dataspace ID */
- hid_t did; /* Dataset ID */
- hid_t dcpl, fapl; /* Property List IDs */
- hsize_t dims[] = {MISC28_SIZE, MISC28_SIZE};
+ hid_t fid; /* File ID */
+ hid_t sidf; /* File Dataspace ID */
+ hid_t sidm; /* Memory Dataspace ID */
+ hid_t did; /* Dataset ID */
+ hid_t dcpl, fapl; /* Property List IDs */
+ hsize_t dims[] = {MISC28_SIZE, MISC28_SIZE};
hsize_t mdims[] = {MISC28_SIZE};
hsize_t cdims[] = {1, 1};
- hsize_t start[] = {0,0};
+ hsize_t start[] = {0, 0};
hsize_t count[] = {MISC28_SIZE, 1};
size_t nbytes_used;
int nused;
char buf[MISC28_SIZE];
int i;
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Dataset chunk cache\n"));
@@ -5169,7 +5141,6 @@ test_misc28(void)
ret = H5Pset_chunk(dcpl, 2, cdims);
CHECK(ret, FAIL, "H5Pset_chunk");
-
/* Create a new file and datasets within that file that use these
* property lists
*/
@@ -5185,11 +5156,11 @@ test_misc28(void)
/* Verify that the chunk cache is empty */
ret = H5D__current_cache_size_test(did, &nbytes_used, &nused);
CHECK(ret, FAIL, "H5D__current_cache_size_test");
- VERIFY(nbytes_used, (size_t) 0, "H5D__current_cache_size_test");
+ VERIFY(nbytes_used, (size_t)0, "H5D__current_cache_size_test");
VERIFY(nused, 0, "H5D__current_cache_size_test");
/* Initialize write buffer */
- for(i=0; i<MISC28_SIZE; i++)
+ for (i = 0; i < MISC28_SIZE; i++)
buf[i] = (char)i;
/* Create memory dataspace and selection in file dataspace */
@@ -5206,16 +5177,16 @@ test_misc28(void)
/* Verify that all 10 chunks written have been cached */
ret = H5D__current_cache_size_test(did, &nbytes_used, &nused);
CHECK(ret, FAIL, "H5D__current_cache_size_test");
- VERIFY(nbytes_used, (size_t) MISC28_SIZE, "H5D__current_cache_size_test");
+ VERIFY(nbytes_used, (size_t)MISC28_SIZE, "H5D__current_cache_size_test");
VERIFY(nused, MISC28_SIZE, "H5D__current_cache_size_test");
/* Initialize write buffer */
- for(i=0; i<MISC28_SIZE; i++)
+ for (i = 0; i < MISC28_SIZE; i++)
buf[i] = (char)(MISC28_SIZE - 1 - i);
/* Select new hyperslab */
start[1] = 1;
- ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL);
+ ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Write hyperslab */
@@ -5225,14 +5196,13 @@ test_misc28(void)
/* Verify that the size of the cache remains at 10 */
ret = H5D__current_cache_size_test(did, &nbytes_used, &nused);
CHECK(ret, FAIL, "H5D__current_cache_size_test");
- VERIFY(nbytes_used, (size_t) MISC28_SIZE, "H5D__current_cache_size_test");
+ VERIFY(nbytes_used, (size_t)MISC28_SIZE, "H5D__current_cache_size_test");
VERIFY(nused, MISC28_SIZE, "H5D__current_cache_size_test");
/* Close dataset */
ret = H5Dclose(did);
CHECK(ret, FAIL, "H5Dclose");
-
/* Re open dataset */
did = H5Dopen2(fid, "dataset", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen2");
@@ -5240,12 +5210,12 @@ test_misc28(void)
/* Verify that the chunk cache is empty */
ret = H5D__current_cache_size_test(did, &nbytes_used, &nused);
CHECK(ret, FAIL, "H5D__current_cache_size_test");
- VERIFY(nbytes_used, (size_t) 0, "H5D__current_cache_size_test");
+ VERIFY(nbytes_used, (size_t)0, "H5D__current_cache_size_test");
VERIFY(nused, 0, "H5D__current_cache_size_test");
/* Select hyperslabe for reading */
start[1] = 0;
- ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL);
+ ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read hypserslab */
@@ -5253,18 +5223,18 @@ test_misc28(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the data read */
- for(i=0; i<MISC28_SIZE; i++)
+ for (i = 0; i < MISC28_SIZE; i++)
VERIFY(buf[i], i, "H5Dread");
/* Verify that all 10 chunks read have been cached */
ret = H5D__current_cache_size_test(did, &nbytes_used, &nused);
CHECK(ret, FAIL, "H5D__current_cache_size_test");
- VERIFY(nbytes_used, (size_t) MISC28_SIZE, "H5D__current_cache_size_test");
+ VERIFY(nbytes_used, (size_t)MISC28_SIZE, "H5D__current_cache_size_test");
VERIFY(nused, MISC28_SIZE, "H5D__current_cache_size_test");
/* Select new hyperslab */
start[1] = 1;
- ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL);
+ ret = H5Sselect_hyperslab(sidf, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read hyperslab */
@@ -5272,20 +5242,19 @@ test_misc28(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the data read */
- for(i=0; i<MISC28_SIZE; i++)
+ for (i = 0; i < MISC28_SIZE; i++)
VERIFY(buf[i], MISC28_SIZE - 1 - i, "H5Dread");
/* Verify that the size of the cache remains at 10 */
ret = H5D__current_cache_size_test(did, &nbytes_used, &nused);
CHECK(ret, FAIL, "H5D__current_cache_size_test");
- VERIFY(nbytes_used, (size_t) MISC28_SIZE, "H5D__current_cache_size_test");
+ VERIFY(nbytes_used, (size_t)MISC28_SIZE, "H5D__current_cache_size_test");
VERIFY(nused, MISC28_SIZE, "H5D__current_cache_size_test");
/* Close dataset */
ret = H5Dclose(did);
CHECK(ret, FAIL, "H5Dclose");
-
/* Close the dataspaces and file */
ret = H5Sclose(sidf);
CHECK_I(ret, "H5Sclose");
@@ -5301,7 +5270,6 @@ test_misc28(void)
CHECK_I(ret, "H5Pclose");
} /* end test_misc28() */
-
/****************************************************************
**
** test_misc29(): Ensure that speculative metadata reads don't
@@ -5311,8 +5279,8 @@ test_misc28(void)
static void
test_misc29(void)
{
- hid_t fid; /* File ID */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Speculative metadata reads\n"));
@@ -5334,10 +5302,9 @@ test_misc29(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_misc29() */
-
static int
test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info,
- void H5_ATTR_UNUSED *op_data)
+ void H5_ATTR_UNUSED *op_data)
{
H5O_info2_t object_info;
@@ -5350,7 +5317,6 @@ test_misc30_get_info(hid_t loc_id)
return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL);
}
-
/****************************************************************
**
** test_misc30(): Exercise local heap code that loads prefix
@@ -5361,17 +5327,17 @@ test_misc30_get_info(hid_t loc_id)
static void
test_misc30(void)
{
- hsize_t file_size[] = {0, 0}; /* Sizes of file created */
- unsigned get_info; /* Whether to perform the get info call */
+ hsize_t file_size[] = {0, 0}; /* Sizes of file created */
+ unsigned get_info; /* Whether to perform the get info call */
/* Output message about test being performed */
MESSAGE(5, ("Local heap dropping free block info\n"));
- for(get_info = FALSE; get_info <= TRUE; get_info++) {
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
- int i; /* Local index counter */
- herr_t ret; /* Generic return value */
+ for (get_info = FALSE; get_info <= TRUE; get_info++) {
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ int i; /* Local index counter */
+ herr_t ret; /* Generic return value */
fid = H5Fcreate(MISC30_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
@@ -5383,13 +5349,13 @@ test_misc30(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- for(i = 0; i < 20; i++) {
+ for (i = 0; i < 20; i++) {
char gname[32];
fid = H5Fopen(MISC30_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
- if(get_info) {
+ if (get_info) {
ret = test_misc30_get_info(fid);
CHECK(ret, FAIL, "test_misc30_get_info");
}
@@ -5415,7 +5381,6 @@ test_misc30(void)
VERIFY(file_size[0], file_size[1], "test_misc30");
} /* end test_misc30() */
-
/****************************************************************
**
** test_misc31(): Test reentering library through deprecated
@@ -5427,14 +5392,14 @@ static void
test_misc31(void)
{
#ifndef H5_NO_DEPRECATED_SYMBOLS
- hid_t file_id; /* File id */
- hid_t space_id; /* Dataspace id */
- hid_t dset_id; /* Dataset id */
- hid_t attr_id; /* Attribute id */
- hid_t group_id; /* Group id */
- hid_t dtype_id; /* Datatype id */
- herr_t ret; /* Generic return value */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ hid_t file_id; /* File id */
+ hid_t space_id; /* Dataspace id */
+ hid_t dset_id; /* Dataset id */
+ hid_t attr_id; /* Attribute id */
+ hid_t group_id; /* Group id */
+ hid_t dtype_id; /* Datatype id */
+ herr_t ret; /* Generic return value */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Output message about test being performed */
MESSAGE(5, ("Deprecated routines initialize after H5close()\n"));
@@ -5509,13 +5474,12 @@ test_misc31(void)
ret = H5Tclose(dtype_id);
CHECK(ret, FAIL, "H5Tclose");
-#else /* H5_NO_DEPRECATED_SYMBOLS */
+#else /* H5_NO_DEPRECATED_SYMBOLS */
/* Output message about test being skipped */
MESSAGE(5, (" ...Skipped"));
#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end test_misc31() */
-
/****************************************************************
*
* test_misc32(): Simple test of filter memory allocation
@@ -5525,8 +5489,8 @@ test_misc31(void)
static void
test_misc32(void)
{
- void *buffer;
- void *resized;
+ void * buffer;
+ void * resized;
size_t size;
/* Output message about test being performed */
@@ -5559,13 +5523,13 @@ test_misc32(void)
CHECK_PTR_NULL(buffer, "H5allocate_memory"); /*BAD*/
buffer = H5allocate_memory(0, TRUE);
CHECK_PTR_NULL(buffer, "H5allocate_memory"); /*BAD*/
-#endif /* NDEBUG */
+#endif /* NDEBUG */
/* RESIZE */
/* Size zero returns NULL. Valgrind will confirm buffer is freed. */
- size = 1024;
- buffer = H5allocate_memory(size, TRUE);
+ size = 1024;
+ buffer = H5allocate_memory(size, TRUE);
resized = H5resize_memory(buffer, 0);
CHECK_PTR_NULL(resized, "H5resize_memory");
@@ -5578,7 +5542,7 @@ test_misc32(void)
#ifdef NDEBUG
resized = H5resize_memory(NULL, 0);
CHECK_PTR_NULL(resized, "H5resize_memory"); /*BAD*/
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end test_misc32() */
@@ -5595,10 +5559,10 @@ test_misc32(void)
static void
test_misc33(void)
{
- hid_t fid = -1; /* File ID */
+ hid_t fid = -1; /* File ID */
const char *testfile = H5_get_srcdir_filename(MISC33_FILE); /* Corrected test file name */
- H5O_info2_t oinfo; /* Structure for object metadata information */
- herr_t ret; /* Generic return value */
+ H5O_info2_t oinfo; /* Structure for object metadata information */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing that bad offset into the heap returns error"));
@@ -5608,21 +5572,18 @@ test_misc33(void)
CHECK(fid, FAIL, "H5Fopen");
/* Case (1) */
- H5E_BEGIN_TRY {
- ret = H5Oget_info_by_name3(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Oget_info_by_name3(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Oget_info_by_name3");
/* Case (2) */
- H5E_BEGIN_TRY {
- ret = H5Oget_info_by_name3(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Oget_info_by_name3(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Oget_info_by_name3");
/* Case (3) */
- H5E_BEGIN_TRY {
- ret = H5Oget_info_by_name3(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Oget_info_by_name3(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Oget_info_by_name3");
/* Close the file */
@@ -5639,9 +5600,9 @@ test_misc33(void)
static void
test_misc34(void)
{
- void *mem = NULL; /* allocated buffer */
- char *dup = NULL; /* 'duplicated' string */
- size_t sz = 0; /* buffer size */
+ void * mem = NULL; /* allocated buffer */
+ char * dup = NULL; /* 'duplicated' string */
+ size_t sz = 0; /* buffer size */
/* Output message about test being performed */
MESSAGE(5, ("Testing O and NULL behavior in H5MM API calls"));
@@ -5668,12 +5629,12 @@ test_misc34(void)
*/
mem = H5MM_xfree(mem);
- sz = 1024;
+ sz = 1024;
mem = H5MM_realloc(mem, sz);
CHECK_PTR(mem, "H5MM_realloc (case 1)");
/* Don't free mem here! */
- sz = 0;
+ sz = 0;
mem = H5MM_realloc(mem, sz);
CHECK_PTR_NULL(mem, "H5MM_realloc (case 2)");
mem = H5MM_xfree(mem);
@@ -5689,7 +5650,6 @@ test_misc34(void)
} /* end test_misc34() */
-
/****************************************************************
**
** test_misc35(): Check operation of free-list routines
@@ -5698,29 +5658,21 @@ test_misc34(void)
static void
test_misc35(void)
{
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hsize_t dims[] = {MISC35_SPACE_DIM1, MISC35_SPACE_DIM2, MISC35_SPACE_DIM3}; /* Dataspace dims */
- hsize_t coord[MISC35_NPOINTS][MISC35_SPACE_RANK] = /* Coordinates for point selection */
- {{0,10, 5},
- {1, 2, 7},
- {2, 4, 9},
- {0, 6,11},
- {1, 8,13},
- {2,12, 0},
- {0,14, 2},
- {1, 0, 4},
- {2, 1, 6},
- {0, 3, 8}};
- size_t reg_size_start; /* Initial amount of regular memory allocated */
- size_t arr_size_start; /* Initial amount of array memory allocated */
- size_t blk_size_start; /* Initial amount of block memory allocated */
- size_t fac_size_start; /* Initial amount of factory memory allocated */
- size_t reg_size_final; /* Final amount of regular memory allocated */
- size_t arr_size_final; /* Final amount of array memory allocated */
- size_t blk_size_final; /* Final amount of block memory allocated */
- size_t fac_size_final; /* Final amount of factory memory allocated */
- H5_alloc_stats_t alloc_stats; /* Memory stats */
- herr_t ret; /* Return value */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hsize_t dims[] = {MISC35_SPACE_DIM1, MISC35_SPACE_DIM2, MISC35_SPACE_DIM3}; /* Dataspace dims */
+ hsize_t coord[MISC35_NPOINTS][MISC35_SPACE_RANK] = /* Coordinates for point selection */
+ {{0, 10, 5}, {1, 2, 7}, {2, 4, 9}, {0, 6, 11}, {1, 8, 13},
+ {2, 12, 0}, {0, 14, 2}, {1, 0, 4}, {2, 1, 6}, {0, 3, 8}};
+ size_t reg_size_start; /* Initial amount of regular memory allocated */
+ size_t arr_size_start; /* Initial amount of array memory allocated */
+ size_t blk_size_start; /* Initial amount of block memory allocated */
+ size_t fac_size_start; /* Initial amount of factory memory allocated */
+ size_t reg_size_final; /* Final amount of regular memory allocated */
+ size_t arr_size_final; /* Final amount of array memory allocated */
+ size_t blk_size_final; /* Final amount of block memory allocated */
+ size_t fac_size_final; /* Final amount of factory memory allocated */
+ H5_alloc_stats_t alloc_stats; /* Memory stats */
+ herr_t ret; /* Return value */
/* Output message about test being performed */
MESSAGE(5, ("Free-list API calls"));
@@ -5738,7 +5690,6 @@ test_misc35(void)
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-
/* Retrieve initial free list values */
ret = H5get_free_list_sizes(&reg_size_start, &arr_size_start, &blk_size_start, &fac_size_start);
CHECK(ret, FAIL, "H5get_free_list_sizes");
@@ -5749,7 +5700,7 @@ test_misc35(void)
CHECK(arr_size_start, 0, "H5get_free_list_sizes");
CHECK(blk_size_start, 0, "H5get_free_list_sizes");
CHECK(fac_size_start, 0, "H5get_free_list_sizes");
-#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
/* All the values should be == 0 */
VERIFY(reg_size_start, 0, "H5get_free_list_sizes");
VERIFY(arr_size_start, 0, "H5get_free_list_sizes");
@@ -5766,13 +5717,13 @@ test_misc35(void)
CHECK(ret, FAIL, "H5get_free_list_sizes");
/* All the free list values should be <= previous values */
- if(reg_size_final > reg_size_start)
+ if (reg_size_final > reg_size_start)
ERROR("reg_size_final > reg_size_start");
- if(arr_size_final > arr_size_start)
+ if (arr_size_final > arr_size_start)
ERROR("arr_size_final > arr_size_start");
- if(blk_size_final > blk_size_start)
+ if (blk_size_final > blk_size_start)
ERROR("blk_size_final > blk_size_start");
- if(fac_size_final > fac_size_start)
+ if (fac_size_final > fac_size_start)
ERROR("fac_size_final > fac_size_start");
/* Retrieve memory allocation statistics */
@@ -5788,7 +5739,7 @@ test_misc35(void)
CHECK(alloc_stats.total_alloc_blocks_count, 0, "H5get_alloc_stats");
CHECK(alloc_stats.curr_alloc_blocks_count, 0, "H5get_alloc_stats");
CHECK(alloc_stats.peak_alloc_blocks_count, 0, "H5get_alloc_stats");
-#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
/* All the values should be == 0 */
VERIFY(alloc_stats.total_alloc_bytes, 0, "H5get_alloc_stats");
VERIFY(alloc_stats.curr_alloc_bytes, 0, "H5get_alloc_stats");
@@ -5801,7 +5752,6 @@ test_misc35(void)
} /* end test_misc35() */
-
/****************************************************************
**
** test_misc(): Main misc. test routine.
@@ -5813,49 +5763,49 @@ test_misc(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Miscellaneous Routines\n"));
- test_misc1(); /* Test unlinking a dataset & immediately re-using name */
- test_misc2(); /* Test storing a VL-derived datatype in two different files */
- test_misc3(); /* Test reading from chunked dataset with non-zero fill value */
- test_misc4(); /* Test retrieving the fileno for various objects with H5Oget_info() */
- test_misc5(); /* Test several level deep nested compound & VL datatypes */
- test_misc6(); /* Test object header continuation code */
- test_misc7(); /* Test for sensible datatypes stored on disk */
- test_misc8(); /* Test storage sizes of various types of dataset storage */
- test_misc9(); /* Test for opening (not creating) core files */
- test_misc10(); /* Test for using dataset creation property lists from old files */
- test_misc11(); /* Test for all properties of a file creation property list being stored */
- test_misc12(); /* Test VL-strings in chunked datasets operating correctly */
- test_misc13(); /* Test that a user block can be insert in front of file contents */
- test_misc14(); /* Test that deleted dataset's data is removed from sieve buffer correctly */
- test_misc15(); /* Test that checking a file's access property list more than once works */
- test_misc16(); /* Test array of fixed-length string */
- test_misc17(); /* Test array of ASCII character */
- test_misc18(); /* Test new object header information in H5O_info_t struct */
- test_misc19(); /* Test incrementing & decrementing ref count on IDs */
- test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */
+ test_misc1(); /* Test unlinking a dataset & immediately re-using name */
+ test_misc2(); /* Test storing a VL-derived datatype in two different files */
+ test_misc3(); /* Test reading from chunked dataset with non-zero fill value */
+ test_misc4(); /* Test retrieving the fileno for various objects with H5Oget_info() */
+ test_misc5(); /* Test several level deep nested compound & VL datatypes */
+ test_misc6(); /* Test object header continuation code */
+ test_misc7(); /* Test for sensible datatypes stored on disk */
+ test_misc8(); /* Test storage sizes of various types of dataset storage */
+ test_misc9(); /* Test for opening (not creating) core files */
+ test_misc10(); /* Test for using dataset creation property lists from old files */
+ test_misc11(); /* Test for all properties of a file creation property list being stored */
+ test_misc12(); /* Test VL-strings in chunked datasets operating correctly */
+ test_misc13(); /* Test that a user block can be insert in front of file contents */
+ test_misc14(); /* Test that deleted dataset's data is removed from sieve buffer correctly */
+ test_misc15(); /* Test that checking a file's access property list more than once works */
+ test_misc16(); /* Test array of fixed-length string */
+ test_misc17(); /* Test array of ASCII character */
+ test_misc18(); /* Test new object header information in H5O_info_t struct */
+ test_misc19(); /* Test incrementing & decrementing ref count on IDs */
+ test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */
#ifdef H5_HAVE_FILTER_SZIP
- test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked datasets w/a filters */
- test_misc22(); /* check szip bits per pixel */
-#endif /* H5_HAVE_FILTER_SZIP */
- test_misc23(); /* Test intermediate group creation */
- test_misc24(); /* Test inappropriate API opens of objects */
- test_misc25a(); /* Exercise null object header message merge bug */
- test_misc25b(); /* Exercise null object header message merge bug on existing file */
- test_misc25c(); /* Exercise another null object header message merge bug */
- test_misc26(); /* Test closing property lists with long filter pipelines */
- test_misc27(); /* Test opening file with object that has bad # of object header messages */
- test_misc28(); /* Test that chunks are cached appropriately */
- test_misc29(); /* Test that speculative metadata reads are handled correctly */
- test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */
- test_misc31(); /* Test Reentering library through deprecated routines after H5close() */
- test_misc32(); /* Test filter memory allocation functions */
- test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */
- test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */
- test_misc35(); /* Test behavior of free-list & allocation statistics API calls */
+ test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked
+ datasets w/a filters */
+ test_misc22(); /* check szip bits per pixel */
+#endif /* H5_HAVE_FILTER_SZIP */
+ test_misc23(); /* Test intermediate group creation */
+ test_misc24(); /* Test inappropriate API opens of objects */
+ test_misc25a(); /* Exercise null object header message merge bug */
+ test_misc25b(); /* Exercise null object header message merge bug on existing file */
+ test_misc25c(); /* Exercise another null object header message merge bug */
+ test_misc26(); /* Test closing property lists with long filter pipelines */
+ test_misc27(); /* Test opening file with object that has bad # of object header messages */
+ test_misc28(); /* Test that chunks are cached appropriately */
+ test_misc29(); /* Test that speculative metadata reads are handled correctly */
+ test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */
+ test_misc31(); /* Test Reentering library through deprecated routines after H5close() */
+ test_misc32(); /* Test filter memory allocation functions */
+ test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */
+ test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */
+ test_misc35(); /* Test behavior of free-list & allocation statistics API calls */
} /* test_misc() */
-
/*-------------------------------------------------------------------------
* Function: cleanup_misc
*
@@ -5909,4 +5859,3 @@ cleanup_misc(void)
HDremove(MISC31_FILE);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end cleanup_misc() */
-
diff --git a/test/trefer.c b/test/trefer.c
index 4bf5c17..530a409 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -12,40 +12,40 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: trefer
-*
-* Test the Reference functionality
-*
-*************************************************************/
+ *
+ * Test program: trefer
+ *
+ * Test the Reference functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
-#define FILE_REF_PARAM "trefer_param.h5"
-#define FILE_REF_OBJ "trefer_obj.h5"
-#define FILE_REF_VL_OBJ "trefer_vl_obj.h5"
-#define FILE_REF_CMPND_OBJ "trefer_cmpnd_obj.h5"
-#define FILE_REF_REG "trefer_reg.h5"
-#define FILE_REF_REG_1D "trefer_reg_1d.h5"
-#define FILE_REF_OBJ_DEL "trefer_obj_del.h5"
-#define FILE_REF_GRP "trefer_grp.h5"
-#define FILE_REF_ATTR "trefer_attr.h5"
-#define FILE_REF_EXT1 "trefer_ext1.h5"
-#define FILE_REF_EXT2 "trefer_ext2.h5"
-#define FILE_REF_COMPAT "trefer_compat.h5"
+#define FILE_REF_PARAM "trefer_param.h5"
+#define FILE_REF_OBJ "trefer_obj.h5"
+#define FILE_REF_VL_OBJ "trefer_vl_obj.h5"
+#define FILE_REF_CMPND_OBJ "trefer_cmpnd_obj.h5"
+#define FILE_REF_REG "trefer_reg.h5"
+#define FILE_REF_REG_1D "trefer_reg_1d.h5"
+#define FILE_REF_OBJ_DEL "trefer_obj_del.h5"
+#define FILE_REF_GRP "trefer_grp.h5"
+#define FILE_REF_ATTR "trefer_attr.h5"
+#define FILE_REF_EXT1 "trefer_ext1.h5"
+#define FILE_REF_EXT2 "trefer_ext2.h5"
+#define FILE_REF_COMPAT "trefer_compat.h5"
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
/* 2-D dataset with fixed dimensions */
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 10
-#define SPACE2_DIM2 10
+#define SPACE2_RANK 2
+#define SPACE2_DIM1 10
+#define SPACE2_DIM2 10
/* Larger 1-D dataset with fixed dimensions */
-#define SPACE3_RANK 1
-#define SPACE3_DIM1 100
+#define SPACE3_RANK 1
+#define SPACE3_DIM1 100
/* Element selection information */
#define POINT1_NPOINTS 10
@@ -54,30 +54,29 @@
typedef struct s1_t {
unsigned int a;
unsigned int b;
- float c;
+ float c;
} s1_t;
/* Compound datatype with reference */
typedef struct s2_t {
- H5R_ref_t ref0; /* reference */
- H5R_ref_t ref1; /* reference */
- H5R_ref_t ref2; /* reference */
- H5R_ref_t ref3; /* reference */
+ H5R_ref_t ref0; /* reference */
+ H5R_ref_t ref1; /* reference */
+ H5R_ref_t ref2; /* reference */
+ H5R_ref_t ref3; /* reference */
unsigned int dim_idx; /* dimension index of the dataset */
} s2_t;
-#define GROUPNAME "/group"
-#define GROUPNAME2 "group2"
-#define GROUPNAME3 "group3"
-#define DSETNAME "/dset"
-#define DSETNAME2 "dset2"
-#define NAME_SIZE 16
+#define GROUPNAME "/group"
+#define GROUPNAME2 "group2"
+#define GROUPNAME3 "group3"
+#define DSETNAME "/dset"
+#define DSETNAME2 "dset2"
+#define NAME_SIZE 16
#define MAX_ITER_CREATE 1000
#define MAX_ITER_WRITE MAX_ITER_CREATE
#define MAX_ITER_READ MAX_ITER_CREATE
-
/****************************************************************
**
** test_reference_params(): Test basic H5R (reference) parameters
@@ -87,26 +86,26 @@ typedef struct s2_t {
static void
test_reference_params(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t group; /* Group ID */
- hid_t attr; /* Attribute ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hid_t aapl_id; /* Attribute access property list */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1};
- H5R_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
- unsigned *obuf;
- H5R_type_t type; /* Reference type */
- unsigned int i; /* Counters */
- const char *write_comment = "Foo!"; /* Comments for group */
- hid_t ret_id; /* Generic hid_t return value */
- ssize_t name_size; /* Size of reference name */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t attr; /* Attribute ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hid_t aapl_id; /* Attribute access property list */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ unsigned * obuf;
+ H5R_type_t type; /* Reference type */
+ unsigned int i; /* Counters */
+ const char * write_comment = "Foo!"; /* Comments for group */
+ hid_t ret_id; /* Generic hid_t return value */
+ ssize_t name_size; /* Size of reference name */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Reference Parameters\n"));
@@ -117,7 +116,7 @@ test_reference_params(void)
tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
obuf[i] = i * 3;
/* Create file */
@@ -181,13 +180,13 @@ test_reference_params(void)
CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -311,7 +310,7 @@ test_reference_params(void)
HDfree(rbuf);
HDfree(tbuf);
HDfree(obuf);
-} /* test_reference_params() */
+} /* test_reference_params() */
/****************************************************************
**
@@ -322,20 +321,20 @@ test_reference_params(void)
static void
test_reference_obj(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hid_t dapl_id; /* Dataset access property list */
- H5R_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- unsigned *ibuf, *obuf;
- unsigned i, j; /* Counters */
- H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ unsigned * ibuf, *obuf;
+ unsigned i, j; /* Counters */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Object Reference Functions\n"));
@@ -390,13 +389,13 @@ test_reference_obj(void)
CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -486,7 +485,7 @@ test_reference_obj(void)
ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
CHECK(ret, FAIL, "H5Dread");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
VERIFY(ibuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
@@ -512,7 +511,7 @@ test_reference_obj(void)
tclass = H5Tget_class(tid1);
VERIFY(tclass, H5T_COMPOUND, "H5Tget_class");
- ret= H5Tget_nmembers(tid1);
+ ret = H5Tget_nmembers(tid1);
VERIFY(ret, 3, "H5Tget_nmembers");
}
@@ -533,7 +532,7 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Fclose");
/* Destroy references */
- for(j = 0; j < SPACE1_DIM1; j++) {
+ for (j = 0; j < SPACE1_DIM1; j++) {
ret = H5Rdestroy(&wbuf[j]);
CHECK(ret, FAIL, "H5Rdestroy");
ret = H5Rdestroy(&rbuf[j]);
@@ -545,7 +544,7 @@ test_reference_obj(void)
HDfree(rbuf);
HDfree(ibuf);
HDfree(obuf);
-} /* test_reference_obj() */
+} /* test_reference_obj() */
/****************************************************************
**
@@ -557,22 +556,22 @@ test_reference_obj(void)
static void
test_reference_vlen_obj(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t vl_dims[] = {1};
- hid_t dapl_id; /* Dataset access property list */
- H5R_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- unsigned *ibuf, *obuf;
- unsigned i, j; /* Counters */
- H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
- hvl_t vl_wbuf = {0, NULL}, vl_rbuf = {0, NULL};
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t vl_dims[] = {1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ unsigned * ibuf, *obuf;
+ unsigned i, j; /* Counters */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
+ hvl_t vl_wbuf = {0, NULL}, vl_rbuf = {0, NULL};
/* Output message about test being performed */
MESSAGE(5, ("Testing Object Reference Functions within VLEN type\n"));
@@ -631,13 +630,13 @@ test_reference_vlen_obj(void)
CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -694,7 +693,7 @@ test_reference_vlen_obj(void)
/* Store references into vlen */
vl_wbuf.len = SPACE1_DIM1;
- vl_wbuf.p = wbuf;
+ vl_wbuf.p = wbuf;
/* Write selection to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &vl_wbuf);
@@ -753,7 +752,7 @@ test_reference_vlen_obj(void)
ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
CHECK(ret, FAIL, "H5Dread");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
VERIFY(ibuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
@@ -779,7 +778,7 @@ test_reference_vlen_obj(void)
tclass = H5Tget_class(tid1);
VERIFY(tclass, H5T_COMPOUND, "H5Tget_class");
- ret= H5Tget_nmembers(tid1);
+ ret = H5Tget_nmembers(tid1);
VERIFY(ret, 3, "H5Tget_nmembers");
}
@@ -800,7 +799,7 @@ test_reference_vlen_obj(void)
CHECK(ret, FAIL, "H5Fclose");
/* Destroy references */
- for(j = 0; j < SPACE1_DIM1; j++) {
+ for (j = 0; j < SPACE1_DIM1; j++) {
ret = H5Rdestroy(&wbuf[j]);
CHECK(ret, FAIL, "H5Rdestroy");
ret = H5Rdestroy(&rbuf[j]);
@@ -812,7 +811,7 @@ test_reference_vlen_obj(void)
HDfree(rbuf);
HDfree(ibuf);
HDfree(obuf);
-} /* test_reference_vlen_obj() */
+} /* test_reference_vlen_obj() */
/****************************************************************
**
@@ -824,22 +823,22 @@ test_reference_vlen_obj(void)
static void
test_reference_cmpnd_obj(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t cmpnd_dims[] = {1};
- hid_t dapl_id; /* Dataset access property list */
- H5R_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- unsigned *ibuf, *obuf;
- unsigned i, j; /* Counters */
- H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
- s2_t cmpnd_wbuf, cmpnd_rbuf;
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t cmpnd_dims[] = {1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ unsigned * ibuf, *obuf;
+ unsigned i, j; /* Counters */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
+ s2_t cmpnd_wbuf, cmpnd_rbuf;
/* Output message about test being performed */
MESSAGE(5, ("Testing Object Reference Functions within compound type\n"));
@@ -898,13 +897,13 @@ test_reference_cmpnd_obj(void)
CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -976,10 +975,10 @@ test_reference_cmpnd_obj(void)
VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
/* Store dimensions */
- cmpnd_wbuf.ref0 = wbuf[0];
- cmpnd_wbuf.ref1 = wbuf[1];
- cmpnd_wbuf.ref2 = wbuf[2];
- cmpnd_wbuf.ref3 = wbuf[3];
+ cmpnd_wbuf.ref0 = wbuf[0];
+ cmpnd_wbuf.ref1 = wbuf[1];
+ cmpnd_wbuf.ref2 = wbuf[2];
+ cmpnd_wbuf.ref3 = wbuf[3];
cmpnd_wbuf.dim_idx = SPACE1_DIM1;
/* Write selection to disk */
@@ -1042,7 +1041,7 @@ test_reference_cmpnd_obj(void)
ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
CHECK(ret, FAIL, "H5Dread");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
VERIFY(ibuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
@@ -1068,7 +1067,7 @@ test_reference_cmpnd_obj(void)
tclass = H5Tget_class(tid1);
VERIFY(tclass, H5T_COMPOUND, "H5Tget_class");
- ret= H5Tget_nmembers(tid1);
+ ret = H5Tget_nmembers(tid1);
VERIFY(ret, 3, "H5Tget_nmembers");
}
@@ -1089,11 +1088,11 @@ test_reference_cmpnd_obj(void)
CHECK(ret, FAIL, "H5Fclose");
/* Destroy references */
- for(j = 0; j < SPACE1_DIM1; j++) {
+ for (j = 0; j < SPACE1_DIM1; j++) {
ret = H5Rdestroy(&wbuf[j]);
CHECK(ret, FAIL, "H5Rdestroy");
}
- for(j = 0; j < SPACE1_DIM1; j++) {
+ for (j = 0; j < SPACE1_DIM1; j++) {
ret = H5Rdestroy(&rbuf[j]);
CHECK(ret, FAIL, "H5Rdestroy");
}
@@ -1103,7 +1102,7 @@ test_reference_cmpnd_obj(void)
HDfree(rbuf);
HDfree(ibuf);
HDfree(obuf);
-} /* test_reference_cmpnd_obj() */
+} /* test_reference_cmpnd_obj() */
/****************************************************************
**
@@ -1118,49 +1117,48 @@ test_reference_cmpnd_obj(void)
static void
test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t fapl; /* File access property list */
- hid_t dset1, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid2; /* Dataspace ID #2 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t *coords; /* Coordinate buffer */
- hsize_t low[SPACE2_RANK]; /* Selection bounds */
- hsize_t high[SPACE2_RANK]; /* Selection bounds */
- H5R_ref_t *wbuf = NULL, /* buffer to write to disk */
- *rbuf = NULL; /* buffer read from disk */
- H5R_ref_t nvrbuf[3]={{{{0}}},{{{101}}},{{{255}}}}; /* buffer with non-valid refs */
- uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */
- *drbuf = NULL; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Type of object */
- int i, j; /* Counters */
- hssize_t hssize_ret; /* hssize_t return value */
- htri_t tri_ret; /* htri_t return value */
- herr_t ret; /* Generic return value */
- hid_t dset_NA; /* Dataset id for undefined reference */
- hid_t space_NA; /* Dataspace id for undefined reference */
- hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
- H5R_ref_t rdata_NA[1]; /* Read buffer */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t * coords; /* Coordinate buffer */
+ hsize_t low[SPACE2_RANK]; /* Selection bounds */
+ hsize_t high[SPACE2_RANK]; /* Selection bounds */
+ H5R_ref_t *wbuf = NULL, /* buffer to write to disk */
+ *rbuf = NULL; /* buffer read from disk */
+ H5R_ref_t nvrbuf[3] = {{{{0}}}, {{{101}}}, {{{255}}}}; /* buffer with non-valid refs */
+ uint8_t * dwbuf = NULL, /* Buffer for writing numeric data to disk */
+ *drbuf = NULL; /* Buffer for reading numeric data from disk */
+ uint8_t * tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Type of object */
+ int i, j; /* Counters */
+ hssize_t hssize_ret; /* hssize_t return value */
+ htri_t tri_ret; /* htri_t return value */
+ herr_t ret; /* Generic return value */
+ hid_t dset_NA; /* Dataset id for undefined reference */
+ hid_t space_NA; /* Dataspace id for undefined reference */
+ hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
+ H5R_ref_t rdata_NA[1]; /* Read buffer */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
- rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
dwbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
- for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
+ for (tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
*tu8++ = (uint8_t)(i * 3);
/* Create file access property list */
@@ -1200,11 +1198,13 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
/* Create a dataset */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(dset1 < 0) {
+ if (dset1 < 0) {
VERIFY(libver_high <= H5F_LIBVER_V110, TRUE, "H5Dcreate2");
ret = H5Sclose(sid1);
@@ -1218,18 +1218,23 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
- } else {
+ }
+ else {
CHECK(dset1, H5I_INVALID_HID, "H5Dcreate2");
/* Create references */
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 6; block[1] = 6;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 6;
+ block[1] = 6;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
ret = (int)H5Sget_select_npoints(sid2);
@@ -1243,16 +1248,26 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Select sequence of ten points for second reference */
- coord1[0][0] = 6; coord1[0][1] = 9;
- coord1[1][0] = 2; coord1[1][1] = 2;
- coord1[2][0] = 8; coord1[2][1] = 4;
- coord1[3][0] = 1; coord1[3][1] = 6;
- coord1[4][0] = 2; coord1[4][1] = 8;
- coord1[5][0] = 3; coord1[5][1] = 2;
- coord1[6][0] = 0; coord1[6][1] = 4;
- coord1[7][0] = 9; coord1[7][1] = 0;
- coord1[8][0] = 7; coord1[8][1] = 1;
- coord1[9][0] = 3; coord1[9][1] = 3;
+ coord1[0][0] = 6;
+ coord1[0][1] = 9;
+ coord1[1][0] = 2;
+ coord1[1][1] = 2;
+ coord1[2][0] = 8;
+ coord1[2][1] = 4;
+ coord1[3][0] = 1;
+ coord1[3][1] = 6;
+ coord1[4][0] = 2;
+ coord1[4][1] = 8;
+ coord1[5][0] = 3;
+ coord1[5][1] = 2;
+ coord1[6][0] = 0;
+ coord1[6][1] = 4;
+ coord1[7][0] = 9;
+ coord1[7][1] = 0;
+ coord1[8][0] = 7;
+ coord1[8][1] = 1;
+ coord1[9][0] = 3;
+ coord1[9][1] = 3;
ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
@@ -1264,15 +1279,15 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Rcreate_region");
/* Select unlimited hyperslab for third reference */
- start[0] = 1;
- start[1] = 8;
+ start[0] = 1;
+ start[1] = 8;
stride[0] = 4;
stride[1] = 1;
- count[0] = H5S_UNLIMITED;
- count[1] = 1;
- block[0] = 2;
- block[1] = 2;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ count[0] = H5S_UNLIMITED;
+ count[1] = 1;
+ block[0] = 2;
+ block[1] = 2;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
hssize_ret = H5Sget_select_npoints(sid2);
@@ -1302,8 +1317,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(space_NA, H5I_INVALID_HID, "H5Screate_simple");
/* Create the dataset and write the region references to it */
- dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF, space_NA, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF, space_NA, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset_NA, H5I_INVALID_HID, "H5Dcreate");
/* Close and release resources for undefined region reference tests */
@@ -1347,9 +1361,8 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/*
* Dereference an undefined reference (should fail)
*/
- H5E_BEGIN_TRY {
- dset2 = H5Ropen_object(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { dset2 = H5Ropen_object(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object");
/* Close and release resources. */
@@ -1358,20 +1371,19 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* This close should fail since H5Ropen_object never created
* the id of the referenced object. */
- H5E_BEGIN_TRY {
- ret = H5Dclose(dset2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dclose(dset2); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dclose");
/*
* End the test of an undefined reference
*/
- /* Open the dataset */
- dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
- CHECK(dset1, H5I_INVALID_HID, "H5Dopen2");
+ /* Open the dataset */
+ dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
+ CHECK(dset1, H5I_INVALID_HID, "H5Dopen2");
- /* Read selection from disk */
+ /* Read selection from disk */
ret = H5Dread(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
@@ -1395,7 +1407,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
+ for (tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
VERIFY(*tu8, (uint8_t)(i * 3), "Data");
/* Get the hyperslab selection */
@@ -1510,10 +1522,9 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Dclose");
/* Attempting to retrieve type of object using non-valid refs */
- for(j = 0; j < 3; j++) {
- H5E_BEGIN_TRY {
- ret = H5Rget_obj_type3(&nvrbuf[j], H5P_DEFAULT, &obj_type);
- } H5E_END_TRY;
+ for (j = 0; j < 3; j++) {
+ H5E_BEGIN_TRY { ret = H5Rget_obj_type3(&nvrbuf[j], H5P_DEFAULT, &obj_type); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Rget_obj_type3");
} /* end for */
@@ -1530,13 +1541,12 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Fclose");
/* Destroy references */
- for(j = 0; j < SPACE1_DIM1; j++) {
+ for (j = 0; j < SPACE1_DIM1; j++) {
ret = H5Rdestroy(&wbuf[j]);
CHECK(ret, FAIL, "H5Rdestroy");
ret = H5Rdestroy(&rbuf[j]);
CHECK(ret, FAIL, "H5Rdestroy");
}
-
}
/* Free memory buffers */
@@ -1545,7 +1555,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
HDfree(dwbuf);
HDfree(drbuf);
-} /* test_reference_region() */
+} /* test_reference_region() */
/****************************************************************
**
@@ -1560,42 +1570,42 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
static void
test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t fapl; /* File access property list */
- hid_t dset1, /* Dataset ID */
- dset3; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid3; /* Dataspace ID #3 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {2}, /* Must be 2 */
- dims3[] = {SPACE3_DIM1};
- hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hsize_t *coords; /* Coordinate buffer */
- hsize_t low[SPACE3_RANK]; /* Selection bounds */
- hsize_t high[SPACE3_RANK]; /* Selection bounds */
- H5R_ref_t *wbuf = NULL, /* buffer to write to disk */
- *rbuf = NULL; /* buffer read from disk */
- uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */
- *drbuf = NULL; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Object type */
- int i; /* Counter */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset3; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid3; /* Dataspace ID #3 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {2}, /* Must be 2 */
+ dims3[] = {SPACE3_DIM1};
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t * coords; /* Coordinate buffer */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
+ H5R_ref_t *wbuf = NULL, /* buffer to write to disk */
+ *rbuf = NULL; /* buffer read from disk */
+ uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */
+ *drbuf = NULL; /* Buffer for reading numeric data from disk */
+ uint8_t * tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Object type */
+ int i; /* Counter */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
- rbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
+ wbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
dwbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
- for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
+ for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
*tu8++ = (uint8_t)(i * 3);
/* Create the file access property list */
@@ -1635,11 +1645,13 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
/* Create a dataset */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(dset1 < 0) {
+ if (dset1 < 0) {
VERIFY(libver_high <= H5F_LIBVER_V110, TRUE, "H5Dcreate2");
@@ -1654,8 +1666,8 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
- } else {
+ }
+ else {
CHECK(ret, FAIL, "H5Dcreate2");
@@ -1666,7 +1678,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
stride[0] = 5;
count[0] = 15;
block[0] = 2;
- ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
+ ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
ret = (int)H5Sget_select_npoints(sid3);
@@ -1752,7 +1764,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Dread(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
+ for (tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
VERIFY(*tu8, (uint8_t)(i * 3), "Data");
/* Get the hyperslab selection */
@@ -1770,16 +1782,16 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
- VERIFY(coords[0], 2, "Hyperslab Coordinates");
- VERIFY(coords[1], 3, "Hyperslab Coordinates");
- VERIFY(coords[2], 7, "Hyperslab Coordinates");
- VERIFY(coords[3], 8, "Hyperslab Coordinates");
- VERIFY(coords[4], 12, "Hyperslab Coordinates");
- VERIFY(coords[5], 13, "Hyperslab Coordinates");
- VERIFY(coords[6], 17, "Hyperslab Coordinates");
- VERIFY(coords[7], 18, "Hyperslab Coordinates");
- VERIFY(coords[8], 22, "Hyperslab Coordinates");
- VERIFY(coords[9], 23, "Hyperslab Coordinates");
+ VERIFY(coords[0], 2, "Hyperslab Coordinates");
+ VERIFY(coords[1], 3, "Hyperslab Coordinates");
+ VERIFY(coords[2], 7, "Hyperslab Coordinates");
+ VERIFY(coords[3], 8, "Hyperslab Coordinates");
+ VERIFY(coords[4], 12, "Hyperslab Coordinates");
+ VERIFY(coords[5], 13, "Hyperslab Coordinates");
+ VERIFY(coords[6], 17, "Hyperslab Coordinates");
+ VERIFY(coords[7], 18, "Hyperslab Coordinates");
+ VERIFY(coords[8], 22, "Hyperslab Coordinates");
+ VERIFY(coords[9], 23, "Hyperslab Coordinates");
VERIFY(coords[10], 27, "Hyperslab Coordinates");
VERIFY(coords[11], 28, "Hyperslab Coordinates");
VERIFY(coords[12], 32, "Hyperslab Coordinates");
@@ -1870,13 +1882,12 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Fclose");
/* Destroy references */
- for(i = 0; i < 2; i++) {
+ for (i = 0; i < 2; i++) {
ret = H5Rdestroy(&wbuf[i]);
CHECK(ret, FAIL, "H5Rdestroy");
ret = H5Rdestroy(&rbuf[i]);
CHECK(ret, FAIL, "H5Rdestroy");
}
-
}
/* Free memory buffers */
@@ -1885,7 +1896,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
HDfree(dwbuf);
HDfree(drbuf);
-} /* test_reference_region_1D() */
+} /* test_reference_region_1D() */
/****************************************************************
**
@@ -1896,13 +1907,13 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
static void
test_reference_obj_deleted(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1; /* Dataspace ID */
- H5R_ref_t oref; /* Object Reference to test */
- H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ H5R_ref_t oref; /* Object Reference to test */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
/* Create file */
fid1 = H5Fcreate(FILE_REF_OBJ_DEL, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1982,7 +1993,7 @@ test_reference_obj_deleted(void)
/* Destroy reference */
ret = H5Rdestroy(&oref);
CHECK(ret, FAIL, "H5Rdestroy");
-} /* test_reference_obj_deleted() */
+} /* test_reference_obj_deleted() */
/****************************************************************
**
@@ -1992,26 +2003,26 @@ test_reference_obj_deleted(void)
****************************************************************/
static herr_t
test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info,
- void *op_data)
+ void *op_data)
{
- int *count = (int *)op_data; /* Pointer to name counter */
+ int * count = (int *)op_data; /* Pointer to name counter */
herr_t ret_value;
/* Simple check for correct names */
- if(*count == 0) {
- if(HDstrcmp(name, DSETNAME2) == 0)
+ if (*count == 0) {
+ if (HDstrcmp(name, DSETNAME2) == 0)
ret_value = 0;
else
ret_value = -1;
} /* end if */
- else if(*count == 1) {
- if(HDstrcmp(name, GROUPNAME2) == 0)
+ else if (*count == 1) {
+ if (HDstrcmp(name, GROUPNAME2) == 0)
ret_value = 0;
else
ret_value = -1;
} /* end if */
- else if(*count == 2) {
- if(HDstrcmp(name, GROUPNAME3) == 0)
+ else if (*count == 2) {
+ if (HDstrcmp(name, GROUPNAME3) == 0)
ret_value = 0;
else
ret_value = -1;
@@ -2021,7 +2032,7 @@ test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2
(*count)++;
- return(ret_value);
+ return (ret_value);
} /* end test_deref_iter_op() */
/****************************************************************
@@ -2033,18 +2044,18 @@ test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2
static void
test_reference_group(void)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t did; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- H5R_ref_t wref; /* Reference to write */
- H5R_ref_t rref; /* Reference to read */
- H5G_info_t ginfo; /* Group info struct */
- char objname[NAME_SIZE]; /* Buffer to store name */
- H5O_info2_t oinfo; /* Object info struct */
- int count = 0; /* Count within iterated group */
- ssize_t size; /* Name length */
- herr_t ret;
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ H5R_ref_t wref; /* Reference to write */
+ H5R_ref_t rref; /* Reference to read */
+ H5G_info_t ginfo; /* Group info struct */
+ char objname[NAME_SIZE]; /* Buffer to store name */
+ H5O_info2_t oinfo; /* Object info struct */
+ int count = 0; /* Count within iterated group */
+ ssize_t size; /* Name length */
+ herr_t ret;
/* Create file with a group and a dataset containing an object reference to the group */
fid = H5Fcreate(FILE_REF_GRP, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2055,16 +2066,16 @@ test_reference_group(void)
CHECK(sid, H5I_INVALID_HID, "H5Screate");
/* Create group to refer to */
- gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid, H5I_INVALID_HID, "H5Gcreate2");
/* Create nested groups */
- gid2 = H5Gcreate2(gid, GROUPNAME2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid2 = H5Gcreate2(gid, GROUPNAME2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid2, H5I_INVALID_HID, "H5Gcreate2");
ret = H5Gclose(gid2);
CHECK(ret, FAIL, "H5Gclose");
- gid2 = H5Gcreate2(gid, GROUPNAME3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid2 = H5Gcreate2(gid, GROUPNAME3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid2, H5I_INVALID_HID, "H5Gcreate2");
ret = H5Gclose(gid2);
CHECK(ret, FAIL, "H5Gclose");
@@ -2127,11 +2138,13 @@ test_reference_group(void)
CHECK(ret, FAIL, "H5Gget_info");
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
- size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT);
+ size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE,
+ H5P_DEFAULT);
CHECK(size, (-1), "H5Lget_name_by_idx");
VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx");
- ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx3");
VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3");
@@ -2154,7 +2167,7 @@ test_reference_group(void)
/* Destroy reference */
ret = H5Rdestroy(&rref);
CHECK(ret, FAIL, "H5Rdestroy");
-} /* test_reference_group() */
+} /* test_reference_group() */
/****************************************************************
**
@@ -2165,20 +2178,20 @@ test_reference_group(void)
static void
test_reference_attr(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
- hid_t attr; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t dims[] = {SPACE1_DIM1};
- hid_t dapl_id; /* Dataset access property list */
- H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */
- ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */
- unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1];
- unsigned i; /* Local index variables */
- H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t attr; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t dims[] = {SPACE1_DIM1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */
+ ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */
+ unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1];
+ unsigned i; /* Local index variables */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Attribute Reference Functions\n"));
@@ -2203,7 +2216,7 @@ test_reference_attr(void)
attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
wbuf[i] = (i * 3) + 1;
/* Write attribute to disk */
@@ -2222,7 +2235,7 @@ test_reference_attr(void)
attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
wbuf[i] = i * 3;
/* Write attribute to disk */
@@ -2250,13 +2263,13 @@ test_reference_attr(void)
CHECK(tid, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -2267,7 +2280,7 @@ test_reference_attr(void)
attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
wbuf[i] = (i * 3) + 2;
/* Write attribute to disk */
@@ -2361,7 +2374,7 @@ test_reference_attr(void)
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
VERIFY(rbuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
@@ -2376,7 +2389,7 @@ test_reference_attr(void)
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
VERIFY(rbuf[i], (i * 3) + 1, "Data");
/* Close attribute */
@@ -2391,7 +2404,7 @@ test_reference_attr(void)
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
VERIFY(rbuf[i], (i * 3) + 2, "Data");
/* Close attribute */
@@ -2417,7 +2430,7 @@ test_reference_attr(void)
ret = H5Rdestroy(&ref_rbuf[i]);
CHECK(ret, FAIL, "H5Rdestroy");
}
-} /* test_reference_attr() */
+} /* test_reference_attr() */
/****************************************************************
**
@@ -2428,20 +2441,20 @@ test_reference_attr(void)
static void
test_reference_external(void)
{
- hid_t fid1, fid2; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
- hid_t attr; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t dims[] = {SPACE1_DIM1};
- hid_t dapl_id; /* Dataset access property list */
- H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */
- ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */
- unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1];
- unsigned i; /* Local index variables */
- H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
+ hid_t fid1, fid2; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t attr; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t dims[] = {SPACE1_DIM1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */
+ ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */
+ unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1];
+ unsigned i; /* Local index variables */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing External References Functions\n"));
@@ -2466,7 +2479,7 @@ test_reference_external(void)
attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
wbuf[i] = (i * 3) + 1;
/* Write attribute to disk */
@@ -2485,7 +2498,7 @@ test_reference_external(void)
attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
wbuf[i] = i * 3;
/* Write attribute to disk */
@@ -2513,13 +2526,13 @@ test_reference_external(void)
CHECK(tid, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -2530,7 +2543,7 @@ test_reference_external(void)
attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
wbuf[i] = (i * 3) + 2;
/* Write attribute to disk */
@@ -2640,7 +2653,7 @@ test_reference_external(void)
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
VERIFY(rbuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
@@ -2655,7 +2668,7 @@ test_reference_external(void)
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
VERIFY(rbuf[i], (i * 3) + 1, "Data");
/* Close attribute */
@@ -2670,7 +2683,7 @@ test_reference_external(void)
ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
CHECK(ret, FAIL, "H5Aread");
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
VERIFY(rbuf[i], (i * 3) + 2, "Data");
/* Close attribute */
@@ -2696,7 +2709,7 @@ test_reference_external(void)
ret = H5Rdestroy(&ref_rbuf[i]);
CHECK(ret, FAIL, "H5Rdestroy");
}
-} /* test_reference_external() */
+} /* test_reference_external() */
/****************************************************************
**
@@ -2707,26 +2720,25 @@ test_reference_external(void)
static void
test_reference_compat_conv(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, dset2; /* Dataset ID */
- hid_t group, group2; /* Group ID */
- hid_t sid1, sid2, sid3; /* Dataspace IDs */
- hid_t tid1, tid2; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2},
- dims3[] = {SPACE1_DIM1}; /* Purposedly set dimension larger to test NULL references */
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK];/* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hobj_ref_t *wbuf_obj = NULL; /* Buffer to write to disk */
- H5R_ref_t *rbuf_obj = NULL; /* Buffer read from disk */
- hdset_reg_ref_t *wbuf_reg = NULL; /* Buffer to write to disk */
- H5R_ref_t *rbuf_reg = NULL; /* Buffer read from disk */
- H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
- unsigned int i; /* Counter */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, dset2; /* Dataset ID */
+ hid_t group, group2; /* Group ID */
+ hid_t sid1, sid2, sid3; /* Dataspace IDs */
+ hid_t tid1, tid2; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2},
+ dims3[] = {SPACE1_DIM1}; /* Purposedly set dimension larger to test NULL references */
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hobj_ref_t * wbuf_obj = NULL; /* Buffer to write to disk */
+ H5R_ref_t * rbuf_obj = NULL; /* Buffer read from disk */
+ hdset_reg_ref_t *wbuf_reg = NULL; /* Buffer to write to disk */
+ H5R_ref_t * rbuf_reg = NULL; /* Buffer read from disk */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
+ unsigned int i; /* Counter */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deprecated Object Reference Functions\n"));
@@ -2778,13 +2790,13 @@ test_reference_compat_conv(void)
CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -2840,7 +2852,7 @@ test_reference_compat_conv(void)
count[1] = 1;
block[0] = 6;
block[1] = 6;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create first dataset region */
@@ -2848,17 +2860,27 @@ test_reference_compat_conv(void)
CHECK(ret, FAIL, "H5Rcreate");
/* Select sequence of ten points for second reference */
- coord1[0][0] = 6; coord1[0][1] = 9;
- coord1[1][0] = 2; coord1[1][1] = 2;
- coord1[2][0] = 8; coord1[2][1] = 4;
- coord1[3][0] = 1; coord1[3][1] = 6;
- coord1[4][0] = 2; coord1[4][1] = 8;
- coord1[5][0] = 3; coord1[5][1] = 2;
- coord1[6][0] = 0; coord1[6][1] = 4;
- coord1[7][0] = 9; coord1[7][1] = 0;
- coord1[8][0] = 7; coord1[8][1] = 1;
- coord1[9][0] = 3; coord1[9][1] = 3;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ coord1[0][0] = 6;
+ coord1[0][1] = 9;
+ coord1[1][0] = 2;
+ coord1[1][1] = 2;
+ coord1[2][0] = 8;
+ coord1[2][1] = 4;
+ coord1[3][0] = 1;
+ coord1[3][1] = 6;
+ coord1[4][0] = 2;
+ coord1[4][1] = 8;
+ coord1[5][0] = 3;
+ coord1[5][1] = 2;
+ coord1[6][0] = 0;
+ coord1[6][1] = 4;
+ coord1[7][0] = 9;
+ coord1[7][1] = 0;
+ coord1[8][0] = 7;
+ coord1[8][1] = 1;
+ coord1[9][0] = 3;
+ coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create second dataset region */
@@ -2914,7 +2936,6 @@ test_reference_compat_conv(void)
CHECK(ret, FAIL, "H5Rget_obj_type3");
VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
-
/* Make sure the referenced objects can be opened */
dset2 = H5Ropen_object(&rbuf_obj[0], H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
@@ -2944,7 +2965,6 @@ test_reference_compat_conv(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-
/* Open the dataset region reference dataset */
dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT);
CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
@@ -2984,11 +3004,11 @@ test_reference_compat_conv(void)
CHECK(ret, FAIL, "H5Fclose");
/* Destroy references */
- for(i = 0; i < dims1[0]; i++) {
+ for (i = 0; i < dims1[0]; i++) {
ret = H5Rdestroy(&rbuf_obj[i]);
CHECK(ret, FAIL, "H5Rdestroy");
}
- for(i = 0; i < dims3[0]; i++) {
+ for (i = 0; i < dims3[0]; i++) {
ret = H5Rdestroy(&rbuf_reg[i]);
CHECK(ret, FAIL, "H5Rdestroy");
}
@@ -2998,7 +3018,7 @@ test_reference_compat_conv(void)
HDfree(rbuf_obj);
HDfree(wbuf_reg);
HDfree(rbuf_reg);
-} /* test_reference_compat() */
+} /* test_reference_compat() */
/****************************************************************
**
@@ -3009,46 +3029,46 @@ test_reference_compat_conv(void)
static void
test_reference_perf(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t dims1[] = {1};
- hid_t dapl_id; /* Dataset access property list */
- H5R_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
- H5R_ref_t *wbuf_reg, /* buffer to write to disk */
- *rbuf_reg; /* buffer read from disk */
- hobj_ref_t *wbuf_deprec,/* deprecated references */
- *rbuf_deprec;/* deprecated references */
- hdset_reg_ref_t *wbuf_reg_deprec, /* deprecated references*/
- *rbuf_reg_deprec; /* deprecated references*/
- unsigned *ibuf, *obuf;
- unsigned i, j; /* Counters */
- H5O_type_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
- double t1, t2, t; /* Timers */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ H5R_ref_t *wbuf_reg, /* buffer to write to disk */
+ *rbuf_reg; /* buffer read from disk */
+ hobj_ref_t *wbuf_deprec, /* deprecated references */
+ *rbuf_deprec; /* deprecated references */
+ hdset_reg_ref_t *wbuf_reg_deprec, /* deprecated references*/
+ *rbuf_reg_deprec; /* deprecated references*/
+ unsigned * ibuf, *obuf;
+ unsigned i, j; /* Counters */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
+ double t1, t2, t; /* Timers */
/* Output message about test being performed */
MESSAGE(5, ("Testing Object Reference Performance\n"));
/* Allocate write & read buffers */
- wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
- obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
- ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
- wbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
- rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
- rbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
- tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
- wbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
- rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+ ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+ wbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
+ rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
+ tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ wbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
wbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
rbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- for(i = 0; i < SPACE1_DIM1; i++)
+ for (i = 0; i < SPACE1_DIM1; i++)
obuf[i] = i * 3;
/* Create file */
@@ -3092,13 +3112,13 @@ test_reference_perf(void)
CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -3118,8 +3138,8 @@ test_reference_perf(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
t = 0;
- for(i = 0; i < MAX_ITER_CREATE; i++) {
- t1 = H5_get_time();
+ for (i = 0; i < MAX_ITER_CREATE; i++) {
+ t1 = H5_get_time();
ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]);
CHECK(ret, FAIL, "H5Rcreate_object");
t2 = H5_get_time();
@@ -3127,7 +3147,7 @@ test_reference_perf(void)
ret = H5Rdestroy(&wbuf[0]);
CHECK(ret, FAIL, "H5Rdestroy");
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Object reference create time: %lfs\n", t / MAX_ITER_CREATE);
/* Create reference to dataset */
@@ -3138,7 +3158,7 @@ test_reference_perf(void)
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
t = 0;
- for(i = 0; i < MAX_ITER_WRITE; i++) {
+ for (i = 0; i < MAX_ITER_WRITE; i++) {
t1 = H5_get_time();
/* Write selection to disk */
ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -3146,7 +3166,7 @@ test_reference_perf(void)
t2 = H5_get_time();
t += t2 - t1;
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Object reference write time: %lfs\n", t / MAX_ITER_WRITE);
/* Close Dataset */
@@ -3158,14 +3178,14 @@ test_reference_perf(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
t = 0;
- for(i = 0; i < MAX_ITER_CREATE; i++) {
- t1 = H5_get_time();
+ for (i = 0; i < MAX_ITER_CREATE; i++) {
+ t1 = H5_get_time();
ret = H5Rcreate(&wbuf_deprec[0], fid1, "/Group1/Dataset1", H5R_OBJECT1, H5I_INVALID_HID);
CHECK(ret, FAIL, "H5Rcreate");
t2 = H5_get_time();
t += t2 - t1;
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Deprecated object reference create time: %lfs\n", t / MAX_ITER_CREATE);
/* Create reference to dataset */
@@ -3173,7 +3193,7 @@ test_reference_perf(void)
CHECK(ret, FAIL, "H5Rcreate");
t = 0;
- for(i = 0; i < MAX_ITER_WRITE; i++) {
+ for (i = 0; i < MAX_ITER_WRITE; i++) {
t1 = H5_get_time();
/* Write selection to disk */
ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_deprec);
@@ -3181,7 +3201,7 @@ test_reference_perf(void)
t2 = H5_get_time();
t += t2 - t1;
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Deprecated object reference write time: %lfs\n", t / MAX_ITER_WRITE);
/* Close Dataset */
@@ -3193,7 +3213,7 @@ test_reference_perf(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
t = 0;
- for(i = 0; i < MAX_ITER_CREATE; i++) {
+ for (i = 0; i < MAX_ITER_CREATE; i++) {
t1 = H5_get_time();
/* Store first dataset region */
ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]);
@@ -3203,7 +3223,7 @@ test_reference_perf(void)
ret = H5Rdestroy(&wbuf_reg[0]);
CHECK(ret, FAIL, "H5Rdestroy");
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Region reference create time: %lfs\n", t / MAX_ITER_CREATE);
/* Store first dataset region */
@@ -3211,7 +3231,7 @@ test_reference_perf(void)
CHECK(ret, FAIL, "H5Rcreate_region");
t = 0;
- for(i = 0; i < MAX_ITER_WRITE; i++) {
+ for (i = 0; i < MAX_ITER_WRITE; i++) {
t1 = H5_get_time();
/* Write selection to disk */
ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_reg);
@@ -3219,7 +3239,7 @@ test_reference_perf(void)
t2 = H5_get_time();
t += t2 - t1;
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Region reference write time: %lfs\n", t / MAX_ITER_WRITE);
/* Close Dataset */
@@ -3231,7 +3251,7 @@ test_reference_perf(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
t = 0;
- for(i = 0; i < MAX_ITER_CREATE; i++) {
+ for (i = 0; i < MAX_ITER_CREATE; i++) {
t1 = H5_get_time();
/* Store first dataset region */
ret = H5Rcreate(&wbuf_reg_deprec[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION1, sid1);
@@ -3239,11 +3259,11 @@ test_reference_perf(void)
t2 = H5_get_time();
t += t2 - t1;
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Deprecated region reference create time: %lfs\n", t / MAX_ITER_CREATE);
t = 0;
- for(i = 0; i < MAX_ITER_WRITE; i++) {
+ for (i = 0; i < MAX_ITER_WRITE; i++) {
t1 = H5_get_time();
/* Write selection to disk */
ret = H5Dwrite(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_reg_deprec);
@@ -3251,7 +3271,7 @@ test_reference_perf(void)
t2 = H5_get_time();
t += t2 - t1;
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Deprecated region reference write time: %lfs\n", t / MAX_ITER_WRITE);
/* Close Dataset */
@@ -3275,7 +3295,7 @@ test_reference_perf(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
t = 0;
- for(i = 0; i < MAX_ITER_READ; i++) {
+ for (i = 0; i < MAX_ITER_READ; i++) {
t1 = H5_get_time();
/* Read selection from disk */
ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
@@ -3285,7 +3305,7 @@ test_reference_perf(void)
ret = H5Rdestroy(&rbuf[0]);
CHECK(ret, FAIL, "H5Rdestroy");
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Object reference read time: %lfs\n", t / MAX_ITER_READ);
/* Read selection from disk */
@@ -3307,7 +3327,7 @@ test_reference_perf(void)
ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
CHECK(ret, FAIL, "H5Dread");
- for(i = 0; i < dims1[0]; i++)
+ for (i = 0; i < dims1[0]; i++)
VERIFY(ibuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
@@ -3323,7 +3343,7 @@ test_reference_perf(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
t = 0;
- for(i = 0; i < MAX_ITER_READ; i++) {
+ for (i = 0; i < MAX_ITER_READ; i++) {
t1 = H5_get_time();
/* Read selection from disk */
ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_deprec);
@@ -3331,7 +3351,7 @@ test_reference_perf(void)
t2 = H5_get_time();
t += t2 - t1;
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Deprecated object reference read time: %lfs\n", t / MAX_ITER_READ);
/* Close Dataset */
@@ -3343,7 +3363,7 @@ test_reference_perf(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
t = 0;
- for(i = 0; i < MAX_ITER_READ; i++) {
+ for (i = 0; i < MAX_ITER_READ; i++) {
t1 = H5_get_time();
/* Read selection from disk */
ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg);
@@ -3353,7 +3373,7 @@ test_reference_perf(void)
ret = H5Rdestroy(&rbuf_reg[0]);
CHECK(ret, FAIL, "H5Rdestroy");
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Region reference read time: %lfs\n", t / MAX_ITER_READ);
/* Read selection from disk */
@@ -3369,7 +3389,7 @@ test_reference_perf(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
t = 0;
- for(i = 0; i < MAX_ITER_READ; i++) {
+ for (i = 0; i < MAX_ITER_READ; i++) {
t1 = H5_get_time();
/* Read selection from disk */
ret = H5Dread(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg_deprec);
@@ -3377,7 +3397,7 @@ test_reference_perf(void)
t2 = H5_get_time();
t += t2 - t1;
}
- if(VERBOSE_MED)
+ if (VERBOSE_MED)
HDprintf("--- Deprecated region reference read time: %lfs\n", t / MAX_ITER_READ);
/* Close Dataset */
@@ -3393,7 +3413,7 @@ test_reference_perf(void)
CHECK(ret, FAIL, "H5Fclose");
/* Destroy references */
- for(j = 0; j < dims1[0]; j++) {
+ for (j = 0; j < dims1[0]; j++) {
ret = H5Rdestroy(&wbuf[j]);
CHECK(ret, FAIL, "H5Rdestroy");
ret = H5Rdestroy(&wbuf_reg[j]);
@@ -3416,7 +3436,7 @@ test_reference_perf(void)
HDfree(tbuf);
HDfree(ibuf);
HDfree(obuf);
-} /* test_reference_perf() */
+} /* test_reference_perf() */
/****************************************************************
**
@@ -3426,7 +3446,7 @@ test_reference_perf(void)
void
test_reference(void)
{
- H5F_libver_t low, high; /* Low and high bounds */
+ H5F_libver_t low, high; /* Low and high bounds */
/* Output message about test being performed */
MESSAGE(5, ("Testing References\n"));
@@ -3437,29 +3457,28 @@ test_reference(void)
test_reference_cmpnd_obj(); /* Test reference within compound type */
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Invalid combinations, just continue */
- if(high == H5F_LIBVER_EARLIEST || high < low)
+ if (high == H5F_LIBVER_EARLIEST || high < low)
continue;
- test_reference_region(low, high); /* Test basic H5R dataset region reference code */
- test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */
+ test_reference_region(low, high); /* Test basic H5R dataset region reference code */
+ test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */
} /* end high bound */
- } /* end low bound */
+ } /* end low bound */
- test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
- test_reference_group(); /* Test operations on dereferenced groups */
- test_reference_attr(); /* Test attribute references */
- test_reference_external(); /* Test external references */
- test_reference_compat_conv(); /* Test operations with old types */
+ test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
+ test_reference_group(); /* Test operations on dereferenced groups */
+ test_reference_attr(); /* Test attribute references */
+ test_reference_external(); /* Test external references */
+ test_reference_compat_conv(); /* Test operations with old types */
test_reference_perf();
-} /* test_reference() */
-
+} /* test_reference() */
/*-------------------------------------------------------------------------
* Function: cleanup_reference
diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c
index db91b8e..6191526 100644
--- a/test/trefer_deprec.c
+++ b/test/trefer_deprec.c
@@ -12,31 +12,31 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: trefer_deprec
-*
-* Test the Reference functionality
-*
-*************************************************************/
+ *
+ * Test program: trefer_deprec
+ *
+ * Test the Reference functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
-#define FILE1 "trefer1.h5"
-#define FILE2 "trefer2.h5"
-#define FILE3 "trefer3.h5"
+#define FILE1 "trefer1.h5"
+#define FILE2 "trefer2.h5"
+#define FILE3 "trefer3.h5"
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
/* 2-D dataset with fixed dimensions */
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 10
-#define SPACE2_DIM2 10
+#define SPACE2_RANK 2
+#define SPACE2_DIM1 10
+#define SPACE2_DIM2 10
/* Larger 1-D dataset with fixed dimensions */
-#define SPACE3_RANK 1
-#define SPACE3_DIM1 100
+#define SPACE3_RANK 1
+#define SPACE3_DIM1 100
/* Element selection information */
#define POINT1_NPOINTS 10
@@ -45,16 +45,15 @@
typedef struct s1_t {
unsigned int a;
unsigned int b;
- float c;
+ float c;
} s1_t;
-#define GROUPNAME "/group"
-#define GROUPNAME2 "group2"
-#define GROUPNAME3 "group3"
-#define DSETNAME "/dset"
-#define DSETNAME2 "dset2"
-#define NAME_SIZE 16
-
+#define GROUPNAME "/group"
+#define GROUPNAME2 "group2"
+#define GROUPNAME3 "group3"
+#define DSETNAME "/dset"
+#define DSETNAME2 "dset2"
+#define NAME_SIZE 16
/****************************************************************
**
@@ -65,23 +64,23 @@ typedef struct s1_t {
static void
test_reference_params(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hid_t dapl_id; /* Dataset access property list */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1};
- hobj_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i; /* counting variables */
+ hobj_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ unsigned * tu32; /* Temporary pointer to uint32 data */
+ int i; /* counting variables */
const char *write_comment = "Foo!"; /* Comments for group */
- hid_t ret_id; /* Generic hid_t return value */
- ssize_t name_size; /* Size of reference name */
- herr_t ret; /* Generic return value */
+ hid_t ret_id; /* Generic hid_t return value */
+ ssize_t name_size; /* Size of reference name */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Reference Parameters\n"));
@@ -115,7 +114,7 @@ test_reference_params(void)
dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
+ for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
*tu32++ = (unsigned)i * 3;
/* Write selection to disk */
@@ -139,13 +138,13 @@ test_reference_params(void)
CHECK(tid1, FAIL, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -234,7 +233,7 @@ test_reference_params(void)
HDfree(wbuf);
HDfree(rbuf);
HDfree(tbuf);
-} /* test_reference_obj() */
+} /* test_reference_obj() */
/****************************************************************
**
@@ -245,25 +244,25 @@ test_reference_params(void)
static void
test_reference_obj(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hid_t dapl_id; /* Dataset access property list */
- hobj_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
- hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i, j; /* counting variables */
- const char *write_comment="Foo!"; /* Comments for group */
- char read_comment[10];
- H5O_type_t obj_type; /* Object type */
- ssize_t size; /* Comment length */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t dapl_id; /* Dataset access property list */
+ hobj_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ hobj_ref_t nvrbuf[3] = {0, 101, 1000000000}; /* buffer with non-valid refs */
+ unsigned * tu32; /* Temporary pointer to uint32 data */
+ int i, j; /* counting variables */
+ const char *write_comment = "Foo!"; /* Comments for group */
+ char read_comment[10];
+ H5O_type_t obj_type; /* Object type */
+ ssize_t size; /* Comment length */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Object Reference Functions\n"));
@@ -297,7 +296,7 @@ test_reference_obj(void)
dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
+ for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
*tu32++ = (unsigned)i * 3;
/* Write selection to disk */
@@ -321,13 +320,13 @@ test_reference_obj(void)
CHECK(tid1, FAIL, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -417,8 +416,8 @@ test_reference_obj(void)
ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- VERIFY(*tu32, (uint32_t)(i*3), "Data");
+ for (tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
+ VERIFY(*tu32, (uint32_t)(i * 3), "Data");
/* Close dereferenced Dataset */
ret = H5Dclose(dset2);
@@ -433,8 +432,8 @@ test_reference_obj(void)
CHECK(size, FAIL, "H5Oget_comment");
/* Check for correct comment value */
- if(HDstrcmp(write_comment, read_comment) != 0)
- TestErrPrintf("Error! Incorrect group comment, wanted: %s, got: %s\n",write_comment,read_comment);
+ if (HDstrcmp(write_comment, read_comment) != 0)
+ TestErrPrintf("Error! Incorrect group comment, wanted: %s, got: %s\n", write_comment, read_comment);
/* Close group */
ret = H5Gclose(group);
@@ -451,15 +450,14 @@ test_reference_obj(void)
tclass = H5Tget_class(tid1);
VERIFY(tclass, H5T_COMPOUND, "H5Tget_class");
- ret= H5Tget_nmembers(tid1);
+ ret = H5Tget_nmembers(tid1);
VERIFY(ret, 3, "H5Tget_nmembers");
}
/* Attempting to retrieve type of object using non-valid refs */
- for(j = 0; j < 3; j++) {
- H5E_BEGIN_TRY {
- ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &nvrbuf[j], &obj_type);
- } H5E_END_TRY;
+ for (j = 0; j < 3; j++) {
+ H5E_BEGIN_TRY { ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &nvrbuf[j], &obj_type); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Rget_obj_type2");
} /* end for */
@@ -483,7 +481,7 @@ test_reference_obj(void)
HDfree(wbuf);
HDfree(rbuf);
HDfree(tbuf);
-} /* test_reference_obj() */
+} /* test_reference_obj() */
/****************************************************************
**
@@ -498,47 +496,46 @@ test_reference_obj(void)
static void
test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t fapl = -1; /* File access property list */
- hid_t dset1, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid2; /* Dataspace ID #2 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t *coords; /* Coordinate buffer */
- hsize_t low[SPACE2_RANK]; /* Selection bounds */
- hsize_t high[SPACE2_RANK]; /* Selection bounds */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Type of object */
- int i, j; /* counting variables */
- hssize_t hssize_ret; /* hssize_t return value */
- htri_t tri_ret; /* htri_t return value */
- herr_t ret; /* Generic return value */
- hdset_reg_ref_t undef_reg[1]; /* test for undefined reference */
- hid_t dset_NA; /* Dataset id for undefined reference */
- hid_t space_NA; /* Dataspace id for undefined reference */
- hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
- hdset_reg_ref_t wdata_NA[1], /* Write buffer */
- rdata_NA[1]; /* Read buffer */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t * coords; /* Coordinate buffer */
+ hsize_t low[SPACE2_RANK]; /* Selection bounds */
+ hsize_t high[SPACE2_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ hdset_reg_ref_t nvrbuf[3] = {{{0}}, {{101}}, {{255}}}; /* buffer with non-valid refs */
+ uint8_t * dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t * tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Type of object */
+ int i, j; /* counting variables */
+ hssize_t hssize_ret; /* hssize_t return value */
+ htri_t tri_ret; /* htri_t return value */
+ herr_t ret; /* Generic return value */
+ hdset_reg_ref_t undef_reg[1]; /* test for undefined reference */
+ hid_t dset_NA; /* Dataset id for undefined reference */
+ hid_t space_NA; /* Dataspace id for undefined reference */
+ hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
+ hdset_reg_ref_t wdata_NA[1], /* Write buffer */
+ rdata_NA[1]; /* Read buffer */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
@@ -566,7 +563,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset2, FAIL, "H5Dcreate2");
- for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
+ for (tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
*tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
@@ -588,11 +585,15 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Create references */
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 6; block[1] = 6;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 6;
+ block[1] = 6;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
ret = (int)H5Sget_select_npoints(sid2);
@@ -606,17 +607,27 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
/* Select sequence of ten points for second reference */
- coord1[0][0] = 6; coord1[0][1] = 9;
- coord1[1][0] = 2; coord1[1][1] = 2;
- coord1[2][0] = 8; coord1[2][1] = 4;
- coord1[3][0] = 1; coord1[3][1] = 6;
- coord1[4][0] = 2; coord1[4][1] = 8;
- coord1[5][0] = 3; coord1[5][1] = 2;
- coord1[6][0] = 0; coord1[6][1] = 4;
- coord1[7][0] = 9; coord1[7][1] = 0;
- coord1[8][0] = 7; coord1[8][1] = 1;
- coord1[9][0] = 3; coord1[9][1] = 3;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ coord1[0][0] = 6;
+ coord1[0][1] = 9;
+ coord1[1][0] = 2;
+ coord1[1][1] = 2;
+ coord1[2][0] = 8;
+ coord1[2][1] = 4;
+ coord1[3][0] = 1;
+ coord1[3][1] = 6;
+ coord1[4][0] = 2;
+ coord1[4][1] = 8;
+ coord1[5][0] = 3;
+ coord1[5][1] = 2;
+ coord1[6][0] = 0;
+ coord1[6][1] = 4;
+ coord1[7][0] = 9;
+ coord1[7][1] = 0;
+ coord1[8][0] = 7;
+ coord1[8][1] = 1;
+ coord1[9][0] = 3;
+ coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
ret = (int)H5Sget_select_npoints(sid2);
@@ -627,22 +638,25 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Rcreate");
/* Select unlimited hyperslab for third reference */
- start[0] = 1; start[1] = 8;
- stride[0] = 4; stride[1] = 1;
- count[0] = H5S_UNLIMITED; count[1] = 1;
- block[0] = 2; block[1] = 2;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 1;
+ start[1] = 8;
+ stride[0] = 4;
+ stride[1] = 1;
+ count[0] = H5S_UNLIMITED;
+ count[1] = 1;
+ block[0] = 2;
+ block[1] = 2;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
hssize_ret = H5Sget_select_npoints(sid2);
VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
/* Store third dataset region */
- H5E_BEGIN_TRY {
- ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2); }
+ H5E_END_TRY;
- if(libver_high < H5F_LIBVER_V110)
+ if (libver_high < H5F_LIBVER_V110)
VERIFY(ret, FAIL, "H5Rcreate");
else
CHECK(ret, FAIL, "H5Rcreate");
@@ -670,8 +684,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(space_NA, FAIL, "H5Screate_simple");
/* Create the dataset and write the region references to it */
- dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF_DSETREG, space_NA, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF_DSETREG, space_NA, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset_NA, FAIL, "H5Dcreate");
/* Close and release resources for undefined region reference tests */
@@ -715,9 +728,8 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/*
* Dereference an undefined reference (should fail)
*/
- H5E_BEGIN_TRY {
- dset2 = H5Rdereference2(dset_NA, H5P_DEFAULT, H5R_DATASET_REGION, &rdata_NA[0]);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { dset2 = H5Rdereference2(dset_NA, H5P_DEFAULT, H5R_DATASET_REGION, &rdata_NA[0]); }
+ H5E_END_TRY;
VERIFY(dset2, FAIL, "H5Rdereference2");
/* Close and release resources. */
@@ -726,9 +738,8 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* This close should fail since H5Rdereference2 never created
* the id of the referenced object. */
- H5E_BEGIN_TRY {
- ret = H5Dclose(dset2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dclose(dset2); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dclose");
/*
@@ -767,7 +778,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
+ for (tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
VERIFY(*tu8, (uint8_t)(i * 3), "Data");
/* Get the hyperslab selection */
@@ -779,8 +790,9 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(ret, 36, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid2);
VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
- ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) *
+ 2); /* allocate space for the hyperslab blocks */
+ ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
VERIFY(coords[1], 2, "Hyperslab Coordinates");
@@ -807,8 +819,9 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid2);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
- ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK *
+ sizeof(hsize_t)); /* allocate space for the element points */
+ ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
VERIFY(coords[1], coord1[0][1], "Element Coordinates");
@@ -842,7 +855,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Sclose(sid2);
CHECK(ret, FAIL, "H5Sclose");
- if(libver_high >= H5F_LIBVER_V110) {
+ if (libver_high >= H5F_LIBVER_V110) {
/* Get the unlimited selection */
sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
CHECK(sid2, FAIL, "H5Rget_region");
@@ -878,10 +891,9 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Dclose");
/* Attempting to retrieve type of object using non-valid refs */
- for(j = 0; j < 3; j++) {
- H5E_BEGIN_TRY {
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &nvrbuf[j], &obj_type);
- } H5E_END_TRY;
+ for (j = 0; j < 3; j++) {
+ H5E_BEGIN_TRY { ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &nvrbuf[j], &obj_type); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Rget_obj_type2");
} /* end for */
@@ -902,7 +914,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
HDfree(rbuf);
HDfree(dwbuf);
HDfree(drbuf);
-} /* test_reference_region() */
+} /* test_reference_region() */
/****************************************************************
**
@@ -917,38 +929,37 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
static void
test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t fapl = -1; /* File access property list */
- hid_t dset1, /* Dataset ID */
- dset3; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid3; /* Dataspace ID #3 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims3[] = {SPACE3_DIM1};
- hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hsize_t *coords; /* Coordinate buffer */
- hsize_t low[SPACE3_RANK]; /* Selection bounds */
- hsize_t high[SPACE3_RANK]; /* Selection bounds */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Object type */
- int i; /* counting variables */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset3; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid3; /* Dataspace ID #3 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1}, dims3[] = {SPACE3_DIM1};
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t * coords; /* Coordinate buffer */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t * tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Object type */
+ int i; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
@@ -976,7 +987,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
dset3 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset3, FAIL, "H5Dcreate2");
- for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
+ for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
*tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
@@ -998,11 +1009,11 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Create references */
/* Select 15 2x1 hyperslabs for first reference */
- start[0] = 2;
+ start[0] = 2;
stride[0] = 5;
- count[0] = 15;
- block[0] = 2;
- ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
+ count[0] = 15;
+ block[0] = 2;
+ ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
ret = (int)H5Sget_select_npoints(sid3);
@@ -1026,7 +1037,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
coord1[7][0] = 89;
coord1[8][0] = 97;
coord1[9][0] = 03;
- ret = H5Sselect_elements(sid3, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ ret = H5Sselect_elements(sid3, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
ret = (int)H5Sget_select_npoints(sid3);
@@ -1088,7 +1099,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Dread(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
+ for (tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
VERIFY(*tu8, (uint8_t)(i * 3), "Data");
/* Get the hyperslab selection */
@@ -1100,19 +1111,20 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(ret, 30, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid3);
VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
- ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) *
+ 2); /* allocate space for the hyperslab blocks */
+ ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
- VERIFY(coords[0], 2, "Hyperslab Coordinates");
- VERIFY(coords[1], 3, "Hyperslab Coordinates");
- VERIFY(coords[2], 7, "Hyperslab Coordinates");
- VERIFY(coords[3], 8, "Hyperslab Coordinates");
- VERIFY(coords[4], 12, "Hyperslab Coordinates");
- VERIFY(coords[5], 13, "Hyperslab Coordinates");
- VERIFY(coords[6], 17, "Hyperslab Coordinates");
- VERIFY(coords[7], 18, "Hyperslab Coordinates");
- VERIFY(coords[8], 22, "Hyperslab Coordinates");
- VERIFY(coords[9], 23, "Hyperslab Coordinates");
+ VERIFY(coords[0], 2, "Hyperslab Coordinates");
+ VERIFY(coords[1], 3, "Hyperslab Coordinates");
+ VERIFY(coords[2], 7, "Hyperslab Coordinates");
+ VERIFY(coords[3], 8, "Hyperslab Coordinates");
+ VERIFY(coords[4], 12, "Hyperslab Coordinates");
+ VERIFY(coords[5], 13, "Hyperslab Coordinates");
+ VERIFY(coords[6], 17, "Hyperslab Coordinates");
+ VERIFY(coords[7], 18, "Hyperslab Coordinates");
+ VERIFY(coords[8], 22, "Hyperslab Coordinates");
+ VERIFY(coords[9], 23, "Hyperslab Coordinates");
VERIFY(coords[10], 27, "Hyperslab Coordinates");
VERIFY(coords[11], 28, "Hyperslab Coordinates");
VERIFY(coords[12], 32, "Hyperslab Coordinates");
@@ -1152,8 +1164,9 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid3);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
- ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK *
+ sizeof(hsize_t)); /* allocate space for the element points */
+ ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
VERIFY(coords[1], coord1[1][0], "Element Coordinates");
@@ -1204,7 +1217,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
HDfree(rbuf);
HDfree(dwbuf);
HDfree(drbuf);
-} /* test_reference_region_1D() */
+} /* test_reference_region_1D() */
/****************************************************************
**
@@ -1215,14 +1228,14 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
static void
test_reference_obj_deleted(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1; /* Dataspace ID */
- hobj_ref_t oref; /* Object Reference to test */
- H5O_type_t obj_type; /* Object type */
- haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hobj_ref_t oref; /* Object Reference to test */
+ H5O_type_t obj_type; /* Object type */
+ haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
+ herr_t ret; /* Generic return value */
/* Create file */
fid1 = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1304,7 +1317,7 @@ test_reference_obj_deleted(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_reference_obj_deleted() */
+} /* test_reference_obj_deleted() */
/****************************************************************
**
@@ -1314,26 +1327,26 @@ test_reference_obj_deleted(void)
****************************************************************/
static herr_t
test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info,
- void *op_data)
+ void *op_data)
{
- int *count = (int *)op_data; /* Pointer to name counter */
+ int * count = (int *)op_data; /* Pointer to name counter */
herr_t ret_value;
/* Simple check for correct names */
- if(*count == 0) {
- if(HDstrcmp(name, DSETNAME2) == 0)
+ if (*count == 0) {
+ if (HDstrcmp(name, DSETNAME2) == 0)
ret_value = 0;
else
ret_value = -1;
} /* end if */
- else if(*count == 1) {
- if(HDstrcmp(name, GROUPNAME2) == 0)
+ else if (*count == 1) {
+ if (HDstrcmp(name, GROUPNAME2) == 0)
ret_value = 0;
else
ret_value = -1;
} /* end if */
- else if(*count == 2) {
- if(HDstrcmp(name, GROUPNAME3) == 0)
+ else if (*count == 2) {
+ if (HDstrcmp(name, GROUPNAME3) == 0)
ret_value = 0;
else
ret_value = -1;
@@ -1343,7 +1356,7 @@ test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2
(*count)++;
- return(ret_value);
+ return (ret_value);
} /* end test_deref_iter_op() */
/****************************************************************
@@ -1355,18 +1368,18 @@ test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2
static void
test_reference_group(void)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t did; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hobj_ref_t wref; /* Reference to write */
- hobj_ref_t rref; /* Reference to read */
- H5G_info_t ginfo; /* Group info struct */
- char objname[NAME_SIZE]; /* Buffer to store name */
- H5O_info2_t oinfo; /* Object info struct */
- int count = 0; /* Count within iterated group */
- ssize_t size; /* Name length */
- herr_t ret;
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hobj_ref_t wref; /* Reference to write */
+ hobj_ref_t rref; /* Reference to read */
+ H5G_info_t ginfo; /* Group info struct */
+ char objname[NAME_SIZE]; /* Buffer to store name */
+ H5O_info2_t oinfo; /* Object info struct */
+ int count = 0; /* Count within iterated group */
+ ssize_t size; /* Name length */
+ herr_t ret;
/* Create file with a group and a dataset containing an object reference to the group */
fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1377,16 +1390,16 @@ test_reference_group(void)
CHECK(sid, FAIL, "H5Screate");
/* Create group to refer to */
- gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid, FAIL, "H5Gcreate2");
/* Create nested groups */
- gid2 = H5Gcreate2(gid, GROUPNAME2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid2 = H5Gcreate2(gid, GROUPNAME2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid2, FAIL, "H5Gcreate2");
ret = H5Gclose(gid2);
CHECK(ret, FAIL, "H5Gclose");
- gid2 = H5Gcreate2(gid, GROUPNAME3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid2 = H5Gcreate2(gid, GROUPNAME3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid2, FAIL, "H5Gcreate2");
ret = H5Gclose(gid2);
CHECK(ret, FAIL, "H5Gclose");
@@ -1420,7 +1433,6 @@ test_reference_group(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -1446,11 +1458,13 @@ test_reference_group(void)
CHECK(ret, FAIL, "H5Gget_info");
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
- size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT);
+ size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE,
+ H5P_DEFAULT);
CHECK(size, FAIL, "H5Lget_name_by_idx");
VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx");
- ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC,
+ H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx3");
VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3");
@@ -1469,7 +1483,7 @@ test_reference_group(void)
CHECK(ret, FAIL, "H5Gclose");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_reference_group() */
+} /* test_reference_group() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/****************************************************************
@@ -1481,25 +1495,24 @@ test_reference_group(void)
static void
test_reference_compat(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, dset2; /* Dataset ID */
- hid_t group, group2; /* Group ID */
- hid_t sid1, /* Dataspace IDs */
- sid2;
- hid_t tid1, tid2; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hobj_ref_t *wbuf_obj, /* Buffer to write to disk */
- *rbuf_obj; /* Buffer read from disk */
- hdset_reg_ref_t *wbuf_reg, /* Buffer to write to disk */
- *rbuf_reg; /* Buffer read from disk */
- H5G_obj_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, dset2; /* Dataset ID */
+ hid_t group, group2; /* Group ID */
+ hid_t sid1, /* Dataspace IDs */
+ sid2;
+ hid_t tid1, tid2; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hobj_ref_t *wbuf_obj, /* Buffer to write to disk */
+ *rbuf_obj; /* Buffer read from disk */
+ hdset_reg_ref_t *wbuf_reg, /* Buffer to write to disk */
+ *rbuf_reg; /* Buffer read from disk */
+ H5G_obj_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deprecated Object Reference Functions\n"));
@@ -1547,13 +1560,13 @@ test_reference_compat(void)
CHECK(tid1, FAIL, "H5Tcreate");
/* Insert fields */
- ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
@@ -1568,7 +1581,6 @@ test_reference_compat(void)
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
-
/* Create a dataset with object reference datatype */
dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -1597,17 +1609,20 @@ test_reference_compat(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-
/* Create a dataset with region reference datatype */
dataset = H5Dcreate2(fid1, "Dataset4", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 6; block[1] = 6;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 6;
+ block[1] = 6;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create first dataset region */
@@ -1615,17 +1630,27 @@ test_reference_compat(void)
CHECK(ret, FAIL, "H5Rcreate");
/* Select sequence of ten points for second reference */
- coord1[0][0] = 6; coord1[0][1] = 9;
- coord1[1][0] = 2; coord1[1][1] = 2;
- coord1[2][0] = 8; coord1[2][1] = 4;
- coord1[3][0] = 1; coord1[3][1] = 6;
- coord1[4][0] = 2; coord1[4][1] = 8;
- coord1[5][0] = 3; coord1[5][1] = 2;
- coord1[6][0] = 0; coord1[6][1] = 4;
- coord1[7][0] = 9; coord1[7][1] = 0;
- coord1[8][0] = 7; coord1[8][1] = 1;
- coord1[9][0] = 3; coord1[9][1] = 3;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ coord1[0][0] = 6;
+ coord1[0][1] = 9;
+ coord1[1][0] = 2;
+ coord1[1][1] = 2;
+ coord1[2][0] = 8;
+ coord1[2][1] = 4;
+ coord1[3][0] = 1;
+ coord1[3][1] = 6;
+ coord1[4][0] = 2;
+ coord1[4][1] = 8;
+ coord1[5][0] = 3;
+ coord1[5][1] = 2;
+ coord1[6][0] = 0;
+ coord1[6][1] = 4;
+ coord1[7][0] = 9;
+ coord1[7][1] = 0;
+ coord1[8][0] = 7;
+ coord1[8][1] = 1;
+ coord1[9][0] = 3;
+ coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create second dataset region */
@@ -1640,7 +1665,6 @@ test_reference_compat(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-
/* Close disk dataspaces */
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
@@ -1651,7 +1675,6 @@ test_reference_compat(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open the file */
fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1681,7 +1704,6 @@ test_reference_compat(void)
CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
VERIFY(obj_type, H5G_TYPE, "H5Rget_obj_type1");
-
/* Make sure the referenced objects can be opened */
dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[0]);
CHECK(dset2, FAIL, "H5Rdereference1");
@@ -1711,7 +1733,6 @@ test_reference_compat(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-
/* Open the dataset region reference dataset */
dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT);
CHECK(ret, FAIL, "H5Dopen2");
@@ -1761,7 +1782,7 @@ test_reference_compat(void)
HDfree(rbuf_obj);
HDfree(wbuf_reg);
HDfree(rbuf_reg);
-} /* test_reference_compat() */
+} /* test_reference_compat() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/****************************************************************
@@ -1772,36 +1793,35 @@ test_reference_compat(void)
void
test_reference_deprec(void)
{
- H5F_libver_t low, high; /* Low and high bounds */
+ H5F_libver_t low, high; /* Low and high bounds */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deprecated References\n"));
- test_reference_params(); /* Test for correct parameter checking */
- test_reference_obj(); /* Test basic H5R object reference code */
+ test_reference_params(); /* Test for correct parameter checking */
+ test_reference_obj(); /* Test basic H5R object reference code */
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Invalid combinations, just continue */
- if(high == H5F_LIBVER_EARLIEST || high < low)
+ if (high == H5F_LIBVER_EARLIEST || high < low)
continue;
- test_reference_region(low, high); /* Test basic H5R dataset region reference code */
- test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */
+ test_reference_region(low, high); /* Test basic H5R dataset region reference code */
+ test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */
} /* end high bound */
- } /* end low bound */
+ } /* end low bound */
test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
- test_reference_group(); /* Test operations on dereferenced groups */
+ test_reference_group(); /* Test operations on dereferenced groups */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_reference_compat(); /* Test operations with old API routines */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
-} /* test_reference() */
+ test_reference_compat(); /* Test operations with old API routines */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+} /* test_reference() */
/*-------------------------------------------------------------------------
* Function: cleanup_reference
@@ -1824,4 +1844,3 @@ cleanup_reference_deprec(void)
HDremove(FILE2);
HDremove(FILE3);
}
-
diff --git a/test/trefer_shutdown.c b/test/trefer_shutdown.c
index b1c43e0..50bdb26 100644
--- a/test/trefer_shutdown.c
+++ b/test/trefer_shutdown.c
@@ -7,7 +7,7 @@ main(int argc, char **argv)
hid_t fid;
hid_t did;
hid_t sid;
- int i;
+ int i;
if ((fid = H5Fcreate("HDFFV-10992.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
HDfprintf(stderr, "H5Fcreate failed\n");
diff --git a/test/trefstr.c b/test/trefstr.c
index c33b5eb..18e357e 100644
--- a/test/trefstr.c
+++ b/test/trefstr.c
@@ -58,23 +58,23 @@ test_refstr_init(void)
static void
test_refstr_create(void)
{
- H5RS_str_t *rs; /* Ref-counted string created */
- unsigned count; /* Reference count on string */
- herr_t ret; /* Generic return value */
+ H5RS_str_t *rs; /* Ref-counted string created */
+ unsigned count; /* Reference count on string */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Creating & Closing Ref-Counted Strings\n"));
/* Try creating a ref-counted string */
- rs=H5RS_create("foo");
+ rs = H5RS_create("foo");
CHECK_PTR(rs, "H5RS_create");
/* Get the reference count on the string */
- count=H5RS_get_count(rs);
+ count = H5RS_get_count(rs);
VERIFY(count, 1, "H5RS_get_count");
/* Try closing a real ref-counted string */
- ret=H5RS_decr(rs);
+ ret = H5RS_decr(rs);
CHECK(ret, FAIL, "H5RS_decr");
} /* end test_refstr_create() */
@@ -88,39 +88,39 @@ test_refstr_create(void)
static void
test_refstr_count(void)
{
- H5RS_str_t *rs; /* Ref-counted string created */
- unsigned count; /* Reference count on string */
- herr_t ret; /* Generic return value */
+ H5RS_str_t *rs; /* Ref-counted string created */
+ unsigned count; /* Reference count on string */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Incrementing & Decrementing Ref-Counted Strings\n"));
/* Try creating a ref-counted string */
- rs=H5RS_create("foo");
+ rs = H5RS_create("foo");
CHECK_PTR(rs, "H5RS_create");
/* Get the reference count on the string */
- count=H5RS_get_count(rs);
+ count = H5RS_get_count(rs);
VERIFY(count, 1, "H5RS_get_count");
/* Increment reference count */
- ret=H5RS_incr(rs);
+ ret = H5RS_incr(rs);
CHECK(ret, FAIL, "H5RS_incr");
/* Get the reference count on the string */
- count=H5RS_get_count(rs);
+ count = H5RS_get_count(rs);
VERIFY(count, 2, "H5RS_get_count");
/* Decrement reference count for string */
- ret=H5RS_decr(rs);
+ ret = H5RS_decr(rs);
CHECK(ret, FAIL, "H5RS_decr");
/* Get the reference count on the string */
- count=H5RS_get_count(rs);
+ count = H5RS_get_count(rs);
VERIFY(count, 1, "H5RS_get_count");
/* Decrement reference count for string */
- ret=H5RS_decr(rs);
+ ret = H5RS_decr(rs);
CHECK(ret, FAIL, "H5RS_decr");
} /* end test_refstr_count() */
@@ -134,42 +134,42 @@ test_refstr_count(void)
static void
test_refstr_dup(void)
{
- H5RS_str_t *rs1; /* Ref-counted string created */
- H5RS_str_t *rs2; /* Ref-counted string created */
- unsigned count; /* Reference count on string */
- herr_t ret; /* Generic return value */
+ H5RS_str_t *rs1; /* Ref-counted string created */
+ H5RS_str_t *rs2; /* Ref-counted string created */
+ unsigned count; /* Reference count on string */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Duplicating Ref-Counted Strings\n"));
/* Try creating a ref-counted string */
- rs1=H5RS_create("foo");
+ rs1 = H5RS_create("foo");
CHECK_PTR(rs1, "H5RS_create");
/* Get the reference count on the string */
- count=H5RS_get_count(rs1);
+ count = H5RS_get_count(rs1);
VERIFY(count, 1, "H5RS_get_count");
/* Duplicate r-string */
- rs2=H5RS_dup(rs1);
+ rs2 = H5RS_dup(rs1);
CHECK_PTR(rs2, "H5RS_dup");
/* Get the reference count on the strings */
- count=H5RS_get_count(rs1);
+ count = H5RS_get_count(rs1);
VERIFY(count, 2, "H5RS_get_count");
- count=H5RS_get_count(rs2);
+ count = H5RS_get_count(rs2);
VERIFY(count, 2, "H5RS_get_count");
/* Decrement reference count for string */
- ret=H5RS_decr(rs2);
+ ret = H5RS_decr(rs2);
CHECK(ret, FAIL, "H5RS_decr");
/* Get the reference count on the string */
- count=H5RS_get_count(rs1);
+ count = H5RS_get_count(rs1);
VERIFY(count, 1, "H5RS_get_count");
/* Decrement reference count for string */
- ret=H5RS_decr(rs1);
+ ret = H5RS_decr(rs1);
CHECK(ret, FAIL, "H5RS_decr");
} /* end test_refstr_dup() */
@@ -183,42 +183,42 @@ test_refstr_dup(void)
static void
test_refstr_cmp(void)
{
- H5RS_str_t *rs1; /* Ref-counted string created */
- H5RS_str_t *rs2; /* Ref-counted string created */
- int cmp; /* Comparison value */
- ssize_t len; /* Length of string */
- herr_t ret; /* Generic return value */
+ H5RS_str_t *rs1; /* Ref-counted string created */
+ H5RS_str_t *rs2; /* Ref-counted string created */
+ int cmp; /* Comparison value */
+ ssize_t len; /* Length of string */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Comparing Ref-Counted Strings\n"));
/* Create first reference counted string */
- rs1=H5RS_create("foo");
+ rs1 = H5RS_create("foo");
CHECK_PTR(rs1, "H5RS_create");
/* Create second reference counted string */
- rs2=H5RS_create("foo2");
+ rs2 = H5RS_create("foo2");
CHECK_PTR(rs2, "H5RS_create");
/* Compare the strings in various ways */
- cmp=H5RS_cmp(rs1,rs1);
+ cmp = H5RS_cmp(rs1, rs1);
VERIFY(cmp, 0, "H5RS_cmp");
- cmp=H5RS_cmp(rs2,rs2);
+ cmp = H5RS_cmp(rs2, rs2);
VERIFY(cmp, 0, "H5RS_cmp");
- cmp=H5RS_cmp(rs1,rs2);
- if(cmp>=0)
- TestErrPrintf("%d: string comparison incorrect!\n",__LINE__);
+ cmp = H5RS_cmp(rs1, rs2);
+ if (cmp >= 0)
+ TestErrPrintf("%d: string comparison incorrect!\n", __LINE__);
/* Check the lengths of the strings also */
- len=H5RS_len(rs1);
+ len = H5RS_len(rs1);
VERIFY(len, 3, "H5RS_len");
- len=H5RS_len(rs2);
+ len = H5RS_len(rs2);
VERIFY(len, 4, "H5RS_len");
/* Decrement reference count for strings */
- ret=H5RS_decr(rs2);
+ ret = H5RS_decr(rs2);
CHECK(ret, FAIL, "H5RS_decr");
- ret=H5RS_decr(rs1);
+ ret = H5RS_decr(rs1);
CHECK(ret, FAIL, "H5RS_decr");
} /* end test_refstr_cmp() */
@@ -232,48 +232,48 @@ test_refstr_cmp(void)
static void
test_refstr_wrap(void)
{
- H5RS_str_t *rs; /* Ref-counted string created */
- const char *s; /* Pointer to raw string in ref-counted string */
- char buf[16]; /* Buffer to wrap */
- int cmp; /* Comparison value */
- herr_t ret; /* Generic return value */
+ H5RS_str_t *rs; /* Ref-counted string created */
+ const char *s; /* Pointer to raw string in ref-counted string */
+ char buf[16]; /* Buffer to wrap */
+ int cmp; /* Comparison value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Wrapping Ref-Counted Strings\n"));
/* Initialize buffer */
- HDstrcpy(buf,"foo");
+ HDstrcpy(buf, "foo");
/* Wrap ref-counted string around existing buffer */
- rs=H5RS_wrap(buf);
+ rs = H5RS_wrap(buf);
CHECK_PTR(rs, "H5RS_wrap");
/* Get pointer to raw string in ref-counted string */
- s=H5RS_get_str(rs);
+ s = H5RS_get_str(rs);
CHECK_PTR(s, "H5RS_get_str");
CHECK_PTR_EQ(s, buf, "wrapping");
- cmp=HDstrcmp(s,buf);
+ cmp = HDstrcmp(s, buf);
VERIFY(cmp, 0, "HDstrcmp");
/* Increment reference count (should duplicate string) */
- ret=H5RS_incr(rs);
+ ret = H5RS_incr(rs);
CHECK(ret, FAIL, "H5RS_incr");
/* Change the buffer initially wrapped */
- buf[0]='F';
+ buf[0] = 'F';
/* Get pointer to raw string in ref-counted string */
- s=H5RS_get_str(rs);
+ s = H5RS_get_str(rs);
CHECK_PTR(s, "H5RS_get_str");
CHECK(s, buf, "wrapping");
- cmp=HDstrcmp(s,buf);
- if(cmp<=0)
- TestErrPrintf("%d: string comparison incorrect!\n",__LINE__);
+ cmp = HDstrcmp(s, buf);
+ if (cmp <= 0)
+ TestErrPrintf("%d: string comparison incorrect!\n", __LINE__);
/* Decrement reference count for string */
- ret=H5RS_decr(rs);
+ ret = H5RS_decr(rs);
CHECK(ret, FAIL, "H5RS_decr");
- ret=H5RS_decr(rs);
+ ret = H5RS_decr(rs);
CHECK(ret, FAIL, "H5RS_decr");
} /* end test_refstr_wrap() */
@@ -288,49 +288,49 @@ test_refstr_wrap(void)
static void
test_refstr_own(void)
{
- H5RS_str_t *rs; /* Ref-counted string created */
- char *s; /* Pointer to string to transfer */
- const char *t; /* Temporary pointers to string */
- int cmp; /* Comparison value */
- herr_t ret; /* Generic return value */
+ H5RS_str_t *rs; /* Ref-counted string created */
+ char * s; /* Pointer to string to transfer */
+ const char *t; /* Temporary pointers to string */
+ int cmp; /* Comparison value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Transferring Ref-Counted Strings\n"));
/* Initialize buffer */
- s = (char *)H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1);
+ s = (char *)H5FL_BLK_MALLOC(str_buf, HDstrlen("foo") + 1);
CHECK_PTR(s, "H5FL_BLK_MALLOC");
HDstrcpy(s, "foo");
/* Transfer ownership of dynamically allocated string to ref-counted string */
- rs=H5RS_own(s);
+ rs = H5RS_own(s);
CHECK_PTR(rs, "H5RS_own");
/* Get pointer to raw string in ref-counted string */
- t=H5RS_get_str(rs);
+ t = H5RS_get_str(rs);
CHECK_PTR(t, "H5RS_get_str");
CHECK_PTR_EQ(t, s, "transferring");
- cmp=HDstrcmp(s,t);
+ cmp = HDstrcmp(s, t);
VERIFY(cmp, 0, "HDstrcmp");
/* Increment reference count (should NOT duplicate string) */
- ret=H5RS_incr(rs);
+ ret = H5RS_incr(rs);
CHECK(ret, FAIL, "H5RS_incr");
/* Change the buffer initially wrapped */
- *s='F';
+ *s = 'F';
/* Get pointer to raw string in ref-counted string */
- t=H5RS_get_str(rs);
+ t = H5RS_get_str(rs);
CHECK_PTR(t, "H5RS_get_str");
CHECK_PTR_EQ(t, s, "transferring");
- cmp=HDstrcmp(t,s);
+ cmp = HDstrcmp(t, s);
VERIFY(cmp, 0, "HDstrcmp");
/* Decrement reference count for string */
- ret=H5RS_decr(rs);
+ ret = H5RS_decr(rs);
CHECK(ret, FAIL, "H5RS_decr");
- ret=H5RS_decr(rs);
+ ret = H5RS_decr(rs);
CHECK(ret, FAIL, "H5RS_decr");
} /* end test_refstr_own() */
@@ -361,14 +361,13 @@ test_refstr(void)
test_refstr_init();
/* Actual ref-counted strings tests */
- test_refstr_create(); /* Test ref-counted string creation */
- test_refstr_count(); /* Test ref-counted string counting */
- test_refstr_dup(); /* Test ref-counted string duplication */
- test_refstr_cmp(); /* Test ref-counted string comparison */
- test_refstr_wrap(); /* Test ref-counted string wrapping */
- test_refstr_own(); /* Test ref-counted string ownership transfer */
+ test_refstr_create(); /* Test ref-counted string creation */
+ test_refstr_count(); /* Test ref-counted string counting */
+ test_refstr_dup(); /* Test ref-counted string duplication */
+ test_refstr_cmp(); /* Test ref-counted string comparison */
+ test_refstr_wrap(); /* Test ref-counted string wrapping */
+ test_refstr_own(); /* Test ref-counted string ownership transfer */
/* Finalize ref-counted strings testing data */
test_refstr_finalize();
-} /* end test_refstr() */
-
+} /* end test_refstr() */
diff --git a/test/tselect.c b/test/tselect.c
index cdf0ba5..f40b2b9 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -12,50 +12,50 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tselect
-*
-* Test the Dataspace selection functionality
-*
-*************************************************************/
+ *
+ * Test program: tselect
+ *
+ * Test the Dataspace selection functionality
+ *
+ *************************************************************/
-#define H5S_FRIEND /*suppress error about including H5Spkg */
+#define H5S_FRIEND /*suppress error about including H5Spkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5S_TESTING
#include "testhdf5.h"
-#include "H5Spkg.h" /* Dataspaces */
+#include "H5Spkg.h" /* Dataspaces */
-#define FILENAME "tselect.h5"
+#define FILENAME "tselect.h5"
/* 3-D dataset with fixed dimensions */
-#define SPACE1_NAME "Space1"
-#define SPACE1_RANK 3
-#define SPACE1_DIM1 3
-#define SPACE1_DIM2 15
-#define SPACE1_DIM3 13
+#define SPACE1_NAME "Space1"
+#define SPACE1_RANK 3
+#define SPACE1_DIM1 3
+#define SPACE1_DIM2 15
+#define SPACE1_DIM3 13
/* 2-D dataset with fixed dimensions */
#define SPACE2_NAME "Space2"
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 30
-#define SPACE2_DIM2 26
-#define SPACE2A_RANK 1
-#define SPACE2A_DIM1 (SPACE2_DIM1*SPACE2_DIM2)
+#define SPACE2_RANK 2
+#define SPACE2_DIM1 30
+#define SPACE2_DIM2 26
+#define SPACE2A_RANK 1
+#define SPACE2A_DIM1 (SPACE2_DIM1 * SPACE2_DIM2)
/* 2-D dataset with fixed dimensions */
-#define SPACE3_NAME "Space3"
-#define SPACE3_RANK 2
-#define SPACE3_DIM1 15
-#define SPACE3_DIM2 26
+#define SPACE3_NAME "Space3"
+#define SPACE3_RANK 2
+#define SPACE3_DIM1 15
+#define SPACE3_DIM2 26
/* 3-D dataset with fixed dimensions */
-#define SPACE4_NAME "Space4"
-#define SPACE4_RANK 3
-#define SPACE4_DIM1 11
-#define SPACE4_DIM2 13
-#define SPACE4_DIM3 17
+#define SPACE4_NAME "Space4"
+#define SPACE4_RANK 3
+#define SPACE4_DIM1 11
+#define SPACE4_DIM2 13
+#define SPACE4_DIM3 17
/* Number of random hyperslabs to test */
#define NHYPERSLABS 10
@@ -64,63 +64,63 @@
#define NRAND_HYPER 100
/* 5-D dataset with fixed dimensions */
-#define SPACE5_NAME "Space5"
-#define SPACE5_RANK 5
-#define SPACE5_DIM1 10
-#define SPACE5_DIM2 10
-#define SPACE5_DIM3 10
-#define SPACE5_DIM4 10
-#define SPACE5_DIM5 10
+#define SPACE5_NAME "Space5"
+#define SPACE5_RANK 5
+#define SPACE5_DIM1 10
+#define SPACE5_DIM2 10
+#define SPACE5_DIM3 10
+#define SPACE5_DIM4 10
+#define SPACE5_DIM5 10
/* 1-D dataset with same size as 5-D dataset */
-#define SPACE6_RANK 1
-#define SPACE6_DIM1 (SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5)
+#define SPACE6_RANK 1
+#define SPACE6_DIM1 (SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5)
/* 2-D dataset with easy dimension sizes */
-#define SPACE7_NAME "Space7"
-#define SPACE7_RANK 2
-#define SPACE7_DIM1 10
-#define SPACE7_DIM2 10
-#define SPACE7_FILL 254
+#define SPACE7_NAME "Space7"
+#define SPACE7_RANK 2
+#define SPACE7_DIM1 10
+#define SPACE7_DIM2 10
+#define SPACE7_FILL 254
#define SPACE7_CHUNK_DIM1 5
#define SPACE7_CHUNK_DIM2 5
-#define SPACE7_NPOINTS 8
+#define SPACE7_NPOINTS 8
/* 4-D dataset with fixed dimensions */
-#define SPACE8_NAME "Space8"
-#define SPACE8_RANK 4
-#define SPACE8_DIM1 11
-#define SPACE8_DIM2 13
-#define SPACE8_DIM3 17
-#define SPACE8_DIM4 19
+#define SPACE8_NAME "Space8"
+#define SPACE8_RANK 4
+#define SPACE8_DIM1 11
+#define SPACE8_DIM2 13
+#define SPACE8_DIM3 17
+#define SPACE8_DIM4 19
/* Another 2-D dataset with easy dimension sizes */
-#define SPACE9_RANK 2
-#define SPACE9_DIM1 12
-#define SPACE9_DIM2 12
+#define SPACE9_RANK 2
+#define SPACE9_DIM1 12
+#define SPACE9_DIM2 12
/* Element selection information */
#define POINT1_NPOINTS 10
/* Chunked dataset information */
#define DATASETNAME "ChunkArray"
-#define NX_SUB 87 /* hyperslab dimensions */
-#define NY_SUB 61
-#define NZ_SUB 181
-#define NX 87 /* output buffer dimensions */
-#define NY 61
-#define NZ 181
-#define RANK_F 3 /* File dataspace rank */
-#define RANK_M 3 /* Memory dataspace rank */
-#define X 87 /* dataset dimensions */
-#define Y 61
-#define Z 181
-#define CHUNK_X 87 /* chunk dimensions */
-#define CHUNK_Y 61
-#define CHUNK_Z 181
+#define NX_SUB 87 /* hyperslab dimensions */
+#define NY_SUB 61
+#define NZ_SUB 181
+#define NX 87 /* output buffer dimensions */
+#define NY 61
+#define NZ 181
+#define RANK_F 3 /* File dataspace rank */
+#define RANK_M 3 /* Memory dataspace rank */
+#define X 87 /* dataset dimensions */
+#define Y 61
+#define Z 181
+#define CHUNK_X 87 /* chunk dimensions */
+#define CHUNK_Y 61
+#define CHUNK_Z 181
/* Basic chunk size */
-#define SPACE10_DIM1 180
+#define SPACE10_DIM1 180
#define SPACE10_CHUNK_SIZE 12
/* Information for bounds checking test */
@@ -130,40 +130,40 @@
#define SPACE11_NPOINTS 4
/* Information for offsets w/chunks test #2 */
-#define SPACE12_RANK 1
-#define SPACE12_DIM0 25
-#define SPACE12_CHUNK_DIM0 5
+#define SPACE12_RANK 1
+#define SPACE12_DIM0 25
+#define SPACE12_CHUNK_DIM0 5
/* Information for Space rebuild test */
-#define SPACERE1_RANK 1
-#define SPACERE1_DIM0 20
-#define SPACERE2_RANK 2
-#define SPACERE2_DIM0 8
-#define SPACERE2_DIM1 12
-#define SPACERE3_RANK 3
-#define SPACERE3_DIM0 8
-#define SPACERE3_DIM1 12
-#define SPACERE3_DIM2 8
-#define SPACERE4_RANK 4
-#define SPACERE4_DIM0 8
-#define SPACERE4_DIM1 12
-#define SPACERE4_DIM2 8
-#define SPACERE4_DIM3 12
-#define SPACERE5_RANK 5
-#define SPACERE5_DIM0 8
-#define SPACERE5_DIM1 12
-#define SPACERE5_DIM2 8
-#define SPACERE5_DIM3 12
-#define SPACERE5_DIM4 8
+#define SPACERE1_RANK 1
+#define SPACERE1_DIM0 20
+#define SPACERE2_RANK 2
+#define SPACERE2_DIM0 8
+#define SPACERE2_DIM1 12
+#define SPACERE3_RANK 3
+#define SPACERE3_DIM0 8
+#define SPACERE3_DIM1 12
+#define SPACERE3_DIM2 8
+#define SPACERE4_RANK 4
+#define SPACERE4_DIM0 8
+#define SPACERE4_DIM1 12
+#define SPACERE4_DIM2 8
+#define SPACERE4_DIM3 12
+#define SPACERE5_RANK 5
+#define SPACERE5_DIM0 8
+#define SPACERE5_DIM1 12
+#define SPACERE5_DIM2 8
+#define SPACERE5_DIM3 12
+#define SPACERE5_DIM4 8
/* Information for Space update diminfo test */
-#define SPACEUD1_DIM0 20
-#define SPACEUD3_DIM0 9
-#define SPACEUD3_DIM1 12
-#define SPACEUD3_DIM2 13
+#define SPACEUD1_DIM0 20
+#define SPACEUD3_DIM0 9
+#define SPACEUD3_DIM1 12
+#define SPACEUD3_DIM2 13
/* #defines for shape same / different rank tests */
-#define SS_DR_MAX_RANK 5
+#define SS_DR_MAX_RANK 5
/* Information for regular hyperslab query test */
#define SPACE13_RANK 3
@@ -173,25 +173,30 @@
#define SPACE13_NPOINTS 4
/* Information for testing selection iterators */
-#define SEL_ITER_MAX_SEQ 256
-
+#define SEL_ITER_MAX_SEQ 256
/* Defines for test_hyper_io_1d() */
-#define DNAME "DSET_1D"
-#define RANK 1
-#define NUMCHUNKS 3
-#define CHUNKSZ 20
-#define NUM_ELEMENTS NUMCHUNKS * CHUNKSZ
+#define DNAME "DSET_1D"
+#define RANK 1
+#define NUMCHUNKS 3
+#define CHUNKSZ 20
+#define NUM_ELEMENTS NUMCHUNKS *CHUNKSZ
/* Location comparison function */
static int compare_size_t(const void *s1, const void *s2);
-static herr_t test_select_hyper_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
-static herr_t test_select_point_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
-static herr_t test_select_all_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
-static herr_t test_select_none_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
-static herr_t test_select_hyper_iter2(void *_elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_operator_data);
-static herr_t test_select_hyper_iter3(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data);
+static herr_t test_select_hyper_iter1(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
+ void *operator_data);
+static herr_t test_select_point_iter1(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
+ void *operator_data);
+static herr_t test_select_all_iter1(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
+ void *operator_data);
+static herr_t test_select_none_iter1(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
+ void *operator_data);
+static herr_t test_select_hyper_iter2(void *_elem, hid_t type_id, unsigned ndim, const hsize_t *point,
+ void *_operator_data);
+static herr_t test_select_hyper_iter3(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
+ void *operator_data);
/****************************************************************
**
@@ -199,18 +204,19 @@ static herr_t test_select_hyper_iter3(void *elem,hid_t type_id, unsigned ndim, c
**
****************************************************************/
static herr_t
-test_select_hyper_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t H5_ATTR_UNUSED *point, void *_operator_data)
+test_select_hyper_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim,
+ const hsize_t H5_ATTR_UNUSED *point, void *_operator_data)
{
- uint8_t *tbuf=(uint8_t *)_elem, /* temporary buffer pointer */
- **tbuf2=(uint8_t **)_operator_data; /* temporary buffer handle */
+ uint8_t *tbuf = (uint8_t *)_elem, /* temporary buffer pointer */
+ **tbuf2 = (uint8_t **)_operator_data; /* temporary buffer handle */
- if(*tbuf!=**tbuf2)
- return(-1);
+ if (*tbuf != **tbuf2)
+ return (-1);
else {
(*tbuf2)++;
- return(0);
+ return (0);
}
-} /* end test_select_hyper_iter1() */
+} /* end test_select_hyper_iter1() */
/****************************************************************
**
@@ -221,22 +227,22 @@ test_select_hyper_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_A
static void
test_select_hyper(hid_t xfer_plist)
{
- hid_t fid1; /* HDF5 File IDs */
+ hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- H5S_class_t ext_type; /* Extent type */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ H5S_class_t ext_type; /* Extent type */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab Selection Functions\n"));
@@ -248,9 +254,9 @@ test_select_hyper(hid_t xfer_plist)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -269,56 +275,80 @@ test_select_hyper(hid_t xfer_plist)
VERIFY(ext_type, H5S_SIMPLE, "H5Sget_simple_extent_type");
/* Test selecting stride==0 to verify failure */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=0; stride[1]=0; stride[2]=0;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=1; block[1]=1; block[2]=1;
- H5E_BEGIN_TRY {
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
- } H5E_END_TRY;
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 0;
+ stride[1] = 0;
+ stride[2] = 0;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ H5E_BEGIN_TRY { ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
/* Test selecting stride<block to verify failure */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=2; block[1]=2; block[2]=2;
- H5E_BEGIN_TRY {
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
- } H5E_END_TRY;
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 2;
+ block[1] = 2;
+ block[2] = 2;
+ H5E_BEGIN_TRY { ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
/* Select 2x15x13 hyperslab for disk dataset */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 15x26 hyperslab for memory dataset */
- start[0]=15; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 15;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,SPACE2_NAME,H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE2_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Exercise checks for NULL buffer and valid selection */
- H5E_BEGIN_TRY {
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, NULL); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dwrite");
- H5E_BEGIN_TRY {
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, xfer_plist, NULL); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -330,38 +360,44 @@ test_select_hyper(hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 15x26 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 0x26 hyperslab to OR into current selection (should be a NOOP) */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=0; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 0;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Exercise checks for NULL buffer and valid selection */
- H5E_BEGIN_TRY {
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, NULL); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dread");
- H5E_BEGIN_TRY {
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, xfer_plist, NULL); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dread");
/* Check that the values match with a dataset iterator */
- tbuf=wbuf+(15*SPACE2_DIM2);
- ret = H5Diterate(rbuf,H5T_NATIVE_UCHAR,sid2,test_select_hyper_iter1,&tbuf);
+ tbuf = wbuf + (15 * SPACE2_DIM2);
+ ret = H5Diterate(rbuf, H5T_NATIVE_UCHAR, sid2, test_select_hyper_iter1, &tbuf);
CHECK(ret, FAIL, "H5Diterate");
/* Close memory dataspace */
@@ -383,12 +419,12 @@ test_select_hyper(hid_t xfer_plist)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper() */
+} /* test_select_hyper() */
struct pnt_iter {
- hsize_t coord[POINT1_NPOINTS*2][SPACE2_RANK]; /* Coordinates for point selection */
- uint8_t *buf; /* Buffer the points are in */
- int offset; /* Which point we are looking at */
+ hsize_t coord[POINT1_NPOINTS * 2][SPACE2_RANK]; /* Coordinates for point selection */
+ uint8_t *buf; /* Buffer the points are in */
+ int offset; /* Which point we are looking at */
};
/****************************************************************
@@ -398,20 +434,22 @@ struct pnt_iter {
**
****************************************************************/
static herr_t
-test_select_point_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t H5_ATTR_UNUSED *point, void *_operator_data)
+test_select_point_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim,
+ const hsize_t H5_ATTR_UNUSED *point, void *_operator_data)
{
- uint8_t *elem=(uint8_t *)_elem; /* Pointer to the element to examine */
- uint8_t *tmp; /* temporary ptr to element in operator data */
- struct pnt_iter *pnt_info=(struct pnt_iter *)_operator_data;
-
- tmp=pnt_info->buf+(pnt_info->coord[pnt_info->offset][0]*SPACE2_DIM2)+pnt_info->coord[pnt_info->offset][1];
- if(*elem!=*tmp)
- return(-1);
+ uint8_t * elem = (uint8_t *)_elem; /* Pointer to the element to examine */
+ uint8_t * tmp; /* temporary ptr to element in operator data */
+ struct pnt_iter *pnt_info = (struct pnt_iter *)_operator_data;
+
+ tmp = pnt_info->buf + (pnt_info->coord[pnt_info->offset][0] * SPACE2_DIM2) +
+ pnt_info->coord[pnt_info->offset][1];
+ if (*elem != *tmp)
+ return (-1);
else {
pnt_info->offset++;
- return(0);
+ return (0);
}
-} /* end test_select_point_iter1() */
+} /* end test_select_point_iter1() */
/****************************************************************
**
@@ -423,24 +461,24 @@ test_select_point_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_A
static void
test_select_point(hid_t xfer_plist)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hsize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hsize_t temp_coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j; /* Counters */
- struct pnt_iter pi; /* Custom Pointer iterator struct */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t temp_coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ struct pnt_iter pi; /* Custom Pointer iterator struct */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Element Selection Functions\n"));
@@ -452,9 +490,9 @@ test_select_point(hid_t xfer_plist)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -469,103 +507,164 @@ test_select_point(hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select sequence of ten points for disk dataset */
- coord1[0][0]=0; coord1[0][1]=10; coord1[0][2]= 5;
- coord1[1][0]=1; coord1[1][1]= 2; coord1[1][2]= 7;
- coord1[2][0]=2; coord1[2][1]= 4; coord1[2][2]= 9;
- coord1[3][0]=0; coord1[3][1]= 6; coord1[3][2]=11;
- coord1[4][0]=1; coord1[4][1]= 8; coord1[4][2]=13;
- coord1[5][0]=2; coord1[5][1]=12; coord1[5][2]= 0;
- coord1[6][0]=0; coord1[6][1]=14; coord1[6][2]= 2;
- coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4;
- coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6;
- coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8;
- ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ coord1[0][0] = 0;
+ coord1[0][1] = 10;
+ coord1[0][2] = 5;
+ coord1[1][0] = 1;
+ coord1[1][1] = 2;
+ coord1[1][2] = 7;
+ coord1[2][0] = 2;
+ coord1[2][1] = 4;
+ coord1[2][2] = 9;
+ coord1[3][0] = 0;
+ coord1[3][1] = 6;
+ coord1[3][2] = 11;
+ coord1[4][0] = 1;
+ coord1[4][1] = 8;
+ coord1[4][2] = 13;
+ coord1[5][0] = 2;
+ coord1[5][1] = 12;
+ coord1[5][2] = 0;
+ coord1[6][0] = 0;
+ coord1[6][1] = 14;
+ coord1[6][2] = 2;
+ coord1[7][0] = 1;
+ coord1[7][1] = 0;
+ coord1[7][2] = 4;
+ coord1[8][0] = 2;
+ coord1[8][1] = 1;
+ coord1[8][2] = 6;
+ coord1[9][0] = 0;
+ coord1[9][1] = 3;
+ coord1[9][2] = 8;
+ ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
- H5Sget_select_elem_pointlist(sid1,(hsize_t)0,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord1);
- for(i=0; i<POINT1_NPOINTS; i++) {
- VERIFY(temp_coord1[i][0],coord1[i][0],"H5Sget_select_elem_pointlist");
- VERIFY(temp_coord1[i][1],coord1[i][1],"H5Sget_select_elem_pointlist");
- VERIFY(temp_coord1[i][2],coord1[i][2],"H5Sget_select_elem_pointlist");
+ H5Sget_select_elem_pointlist(sid1, (hsize_t)0, (hsize_t)POINT1_NPOINTS, (hsize_t *)temp_coord1);
+ for (i = 0; i < POINT1_NPOINTS; i++) {
+ VERIFY(temp_coord1[i][0], coord1[i][0], "H5Sget_select_elem_pointlist");
+ VERIFY(temp_coord1[i][1], coord1[i][1], "H5Sget_select_elem_pointlist");
+ VERIFY(temp_coord1[i][2], coord1[i][2], "H5Sget_select_elem_pointlist");
} /* end for */
ret = (int)H5Sget_select_npoints(sid1);
VERIFY(ret, 10, "H5Sget_select_npoints");
/* Append another sequence of ten points to disk dataset */
- coord1[0][0]=0; coord1[0][1]= 2; coord1[0][2]= 0;
- coord1[1][0]=1; coord1[1][1]=10; coord1[1][2]= 8;
- coord1[2][0]=2; coord1[2][1]= 8; coord1[2][2]=10;
- coord1[3][0]=0; coord1[3][1]= 7; coord1[3][2]=12;
- coord1[4][0]=1; coord1[4][1]= 3; coord1[4][2]=11;
- coord1[5][0]=2; coord1[5][1]= 1; coord1[5][2]= 1;
- coord1[6][0]=0; coord1[6][1]=13; coord1[6][2]= 7;
- coord1[7][0]=1; coord1[7][1]=14; coord1[7][2]= 6;
- coord1[8][0]=2; coord1[8][1]= 2; coord1[8][2]= 5;
- coord1[9][0]=0; coord1[9][1]= 6; coord1[9][2]=13;
+ coord1[0][0] = 0;
+ coord1[0][1] = 2;
+ coord1[0][2] = 0;
+ coord1[1][0] = 1;
+ coord1[1][1] = 10;
+ coord1[1][2] = 8;
+ coord1[2][0] = 2;
+ coord1[2][1] = 8;
+ coord1[2][2] = 10;
+ coord1[3][0] = 0;
+ coord1[3][1] = 7;
+ coord1[3][2] = 12;
+ coord1[4][0] = 1;
+ coord1[4][1] = 3;
+ coord1[4][2] = 11;
+ coord1[5][0] = 2;
+ coord1[5][1] = 1;
+ coord1[5][2] = 1;
+ coord1[6][0] = 0;
+ coord1[6][1] = 13;
+ coord1[6][2] = 7;
+ coord1[7][0] = 1;
+ coord1[7][1] = 14;
+ coord1[7][2] = 6;
+ coord1[8][0] = 2;
+ coord1[8][1] = 2;
+ coord1[8][2] = 5;
+ coord1[9][0] = 0;
+ coord1[9][1] = 6;
+ coord1[9][2] = 13;
ret = H5Sselect_elements(sid1, H5S_SELECT_APPEND, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
- H5Sget_select_elem_pointlist(sid1,(hsize_t)POINT1_NPOINTS,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord1);
- for(i=0; i<POINT1_NPOINTS; i++) {
- VERIFY(temp_coord1[i][0],coord1[i][0],"H5Sget_select_elem_pointlist");
- VERIFY(temp_coord1[i][1],coord1[i][1],"H5Sget_select_elem_pointlist");
- VERIFY(temp_coord1[i][2],coord1[i][2],"H5Sget_select_elem_pointlist");
+ H5Sget_select_elem_pointlist(sid1, (hsize_t)POINT1_NPOINTS, (hsize_t)POINT1_NPOINTS,
+ (hsize_t *)temp_coord1);
+ for (i = 0; i < POINT1_NPOINTS; i++) {
+ VERIFY(temp_coord1[i][0], coord1[i][0], "H5Sget_select_elem_pointlist");
+ VERIFY(temp_coord1[i][1], coord1[i][1], "H5Sget_select_elem_pointlist");
+ VERIFY(temp_coord1[i][2], coord1[i][2], "H5Sget_select_elem_pointlist");
} /* end for */
ret = (int)H5Sget_select_npoints(sid1);
VERIFY(ret, 20, "H5Sget_select_npoints");
/* Select sequence of ten points for memory dataset */
- coord2[0][0]=12; coord2[0][1]= 3;
- coord2[1][0]=15; coord2[1][1]=13;
- coord2[2][0]= 7; coord2[2][1]=25;
- coord2[3][0]= 0; coord2[3][1]= 6;
- coord2[4][0]=13; coord2[4][1]= 0;
- coord2[5][0]=24; coord2[5][1]=11;
- coord2[6][0]=12; coord2[6][1]=21;
- coord2[7][0]=29; coord2[7][1]= 4;
- coord2[8][0]= 8; coord2[8][1]= 8;
- coord2[9][0]=19; coord2[9][1]=17;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
+ coord2[0][0] = 12;
+ coord2[0][1] = 3;
+ coord2[1][0] = 15;
+ coord2[1][1] = 13;
+ coord2[2][0] = 7;
+ coord2[2][1] = 25;
+ coord2[3][0] = 0;
+ coord2[3][1] = 6;
+ coord2[4][0] = 13;
+ coord2[4][1] = 0;
+ coord2[5][0] = 24;
+ coord2[5][1] = 11;
+ coord2[6][0] = 12;
+ coord2[6][1] = 21;
+ coord2[7][0] = 29;
+ coord2[7][1] = 4;
+ coord2[8][0] = 8;
+ coord2[8][1] = 8;
+ coord2[9][0] = 19;
+ coord2[9][1] = 17;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
- H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord2);
- for(i=0; i<POINT1_NPOINTS; i++) {
- VERIFY(temp_coord2[i][0],coord2[i][0],"H5Sget_select_elem_pointlist");
- VERIFY(temp_coord2[i][1],coord2[i][1],"H5Sget_select_elem_pointlist");
+ H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)POINT1_NPOINTS, (hsize_t *)temp_coord2);
+ for (i = 0; i < POINT1_NPOINTS; i++) {
+ VERIFY(temp_coord2[i][0], coord2[i][0], "H5Sget_select_elem_pointlist");
+ VERIFY(temp_coord2[i][1], coord2[i][1], "H5Sget_select_elem_pointlist");
} /* end for */
/* Save points for later iteration */
/* (these are in the second half of the buffer, because we are prepending */
/* the next list of points to the beginning of the point selection list) */
- HDmemcpy(((char *)pi.coord)+sizeof(coord2),coord2,sizeof(coord2));
+ HDmemcpy(((char *)pi.coord) + sizeof(coord2), coord2, sizeof(coord2));
ret = (int)H5Sget_select_npoints(sid2);
VERIFY(ret, 10, "H5Sget_select_npoints");
/* Append another sequence of ten points to memory dataset */
- coord2[0][0]=24; coord2[0][1]= 0;
- coord2[1][0]= 2; coord2[1][1]=25;
- coord2[2][0]=13; coord2[2][1]=17;
- coord2[3][0]= 8; coord2[3][1]= 3;
- coord2[4][0]=29; coord2[4][1]= 4;
- coord2[5][0]=11; coord2[5][1]=14;
- coord2[6][0]= 5; coord2[6][1]=22;
- coord2[7][0]=12; coord2[7][1]= 2;
- coord2[8][0]=21; coord2[8][1]=12;
- coord2[9][0]= 9; coord2[9][1]=18;
+ coord2[0][0] = 24;
+ coord2[0][1] = 0;
+ coord2[1][0] = 2;
+ coord2[1][1] = 25;
+ coord2[2][0] = 13;
+ coord2[2][1] = 17;
+ coord2[3][0] = 8;
+ coord2[3][1] = 3;
+ coord2[4][0] = 29;
+ coord2[4][1] = 4;
+ coord2[5][0] = 11;
+ coord2[5][1] = 14;
+ coord2[6][0] = 5;
+ coord2[6][1] = 22;
+ coord2[7][0] = 12;
+ coord2[7][1] = 2;
+ coord2[8][0] = 21;
+ coord2[8][1] = 12;
+ coord2[9][0] = 9;
+ coord2[9][1] = 18;
ret = H5Sselect_elements(sid2, H5S_SELECT_PREPEND, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
- H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord2);
- for(i=0; i<POINT1_NPOINTS; i++) {
- VERIFY(temp_coord2[i][0],coord2[i][0],"H5Sget_select_elem_pointlist");
- VERIFY(temp_coord2[i][1],coord2[i][1],"H5Sget_select_elem_pointlist");
+ H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)POINT1_NPOINTS, (hsize_t *)temp_coord2);
+ for (i = 0; i < POINT1_NPOINTS; i++) {
+ VERIFY(temp_coord2[i][0], coord2[i][0], "H5Sget_select_elem_pointlist");
+ VERIFY(temp_coord2[i][1], coord2[i][1], "H5Sget_select_elem_pointlist");
} /* end for */
ret = (int)H5Sget_select_npoints(sid2);
@@ -591,60 +690,81 @@ test_select_point(hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select sequence of points for read dataset */
- coord3[0][0]= 0; coord3[0][1]= 2;
- coord3[1][0]= 4; coord3[1][1]= 8;
- coord3[2][0]=13; coord3[2][1]=13;
- coord3[3][0]=14; coord3[3][1]=20;
- coord3[4][0]= 7; coord3[4][1]= 9;
- coord3[5][0]= 2; coord3[5][1]= 0;
- coord3[6][0]= 9; coord3[6][1]=19;
- coord3[7][0]= 1; coord3[7][1]=22;
- coord3[8][0]=12; coord3[8][1]=21;
- coord3[9][0]=11; coord3[9][1]= 6;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord3);
+ coord3[0][0] = 0;
+ coord3[0][1] = 2;
+ coord3[1][0] = 4;
+ coord3[1][1] = 8;
+ coord3[2][0] = 13;
+ coord3[2][1] = 13;
+ coord3[3][0] = 14;
+ coord3[3][1] = 20;
+ coord3[4][0] = 7;
+ coord3[4][1] = 9;
+ coord3[5][0] = 2;
+ coord3[5][1] = 0;
+ coord3[6][0] = 9;
+ coord3[6][1] = 19;
+ coord3[7][0] = 1;
+ coord3[7][1] = 22;
+ coord3[8][0] = 12;
+ coord3[8][1] = 21;
+ coord3[9][0] = 11;
+ coord3[9][1] = 6;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord3);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
- H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord3);
- for(i=0; i<POINT1_NPOINTS; i++) {
- VERIFY(temp_coord3[i][0],coord3[i][0],"H5Sget_select_elem_pointlist");
- VERIFY(temp_coord3[i][1],coord3[i][1],"H5Sget_select_elem_pointlist");
+ H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)POINT1_NPOINTS, (hsize_t *)temp_coord3);
+ for (i = 0; i < POINT1_NPOINTS; i++) {
+ VERIFY(temp_coord3[i][0], coord3[i][0], "H5Sget_select_elem_pointlist");
+ VERIFY(temp_coord3[i][1], coord3[i][1], "H5Sget_select_elem_pointlist");
} /* end for */
ret = (int)H5Sget_select_npoints(sid2);
VERIFY(ret, 10, "H5Sget_select_npoints");
/* Append another sequence of ten points to disk dataset */
- coord3[0][0]=14; coord3[0][1]=25;
- coord3[1][0]= 0; coord3[1][1]= 0;
- coord3[2][0]=11; coord3[2][1]=11;
- coord3[3][0]= 5; coord3[3][1]=14;
- coord3[4][0]= 3; coord3[4][1]= 5;
- coord3[5][0]= 2; coord3[5][1]= 2;
- coord3[6][0]= 7; coord3[6][1]=13;
- coord3[7][0]= 9; coord3[7][1]=16;
- coord3[8][0]=12; coord3[8][1]=22;
- coord3[9][0]=13; coord3[9][1]= 9;
+ coord3[0][0] = 14;
+ coord3[0][1] = 25;
+ coord3[1][0] = 0;
+ coord3[1][1] = 0;
+ coord3[2][0] = 11;
+ coord3[2][1] = 11;
+ coord3[3][0] = 5;
+ coord3[3][1] = 14;
+ coord3[4][0] = 3;
+ coord3[4][1] = 5;
+ coord3[5][0] = 2;
+ coord3[5][1] = 2;
+ coord3[6][0] = 7;
+ coord3[6][1] = 13;
+ coord3[7][0] = 9;
+ coord3[7][1] = 16;
+ coord3[8][0] = 12;
+ coord3[8][1] = 22;
+ coord3[9][0] = 13;
+ coord3[9][1] = 9;
ret = H5Sselect_elements(sid2, H5S_SELECT_APPEND, (size_t)POINT1_NPOINTS, (const hsize_t *)coord3);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
- H5Sget_select_elem_pointlist(sid2,(hsize_t)POINT1_NPOINTS,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord3);
- for(i=0; i<POINT1_NPOINTS; i++) {
- VERIFY(temp_coord3[i][0],coord3[i][0],"H5Sget_select_elem_pointlist");
- VERIFY(temp_coord3[i][1],coord3[i][1],"H5Sget_select_elem_pointlist");
+ H5Sget_select_elem_pointlist(sid2, (hsize_t)POINT1_NPOINTS, (hsize_t)POINT1_NPOINTS,
+ (hsize_t *)temp_coord3);
+ for (i = 0; i < POINT1_NPOINTS; i++) {
+ VERIFY(temp_coord3[i][0], coord3[i][0], "H5Sget_select_elem_pointlist");
+ VERIFY(temp_coord3[i][1], coord3[i][1], "H5Sget_select_elem_pointlist");
} /* end for */
ret = (int)H5Sget_select_npoints(sid2);
VERIFY(ret, 20, "H5Sget_select_npoints");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Check that the values match with a dataset iterator */
- pi.buf=wbuf;
- pi.offset=0;
- ret = H5Diterate(rbuf,H5T_NATIVE_UCHAR,sid2,test_select_point_iter1,&pi);
+ pi.buf = wbuf;
+ pi.offset = 0;
+ ret = H5Diterate(rbuf, H5T_NATIVE_UCHAR, sid2, test_select_point_iter1, &pi);
CHECK(ret, FAIL, "H5Diterate");
/* Close memory dataspace */
@@ -666,7 +786,7 @@ test_select_point(hid_t xfer_plist)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_point() */
+} /* test_select_point() */
/****************************************************************
**
@@ -675,18 +795,19 @@ test_select_point(hid_t xfer_plist)
**
****************************************************************/
static herr_t
-test_select_all_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t H5_ATTR_UNUSED *point, void *_operator_data)
+test_select_all_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim,
+ const hsize_t H5_ATTR_UNUSED *point, void *_operator_data)
{
- uint8_t *tbuf=(uint8_t *)_elem, /* temporary buffer pointer */
- **tbuf2=(uint8_t **)_operator_data; /* temporary buffer handle */
+ uint8_t *tbuf = (uint8_t *)_elem, /* temporary buffer pointer */
+ **tbuf2 = (uint8_t **)_operator_data; /* temporary buffer handle */
- if(*tbuf!=**tbuf2)
- return(-1);
+ if (*tbuf != **tbuf2)
+ return (-1);
else {
(*tbuf2)++;
- return(0);
+ return (0);
}
-} /* end test_select_all_iter1() */
+} /* end test_select_all_iter1() */
/****************************************************************
**
@@ -695,10 +816,11 @@ test_select_all_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATT
**
****************************************************************/
static herr_t
-test_select_none_iter1(void H5_ATTR_UNUSED *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t H5_ATTR_UNUSED *point, void H5_ATTR_UNUSED *_operator_data)
+test_select_none_iter1(void H5_ATTR_UNUSED *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim,
+ const hsize_t H5_ATTR_UNUSED *point, void H5_ATTR_UNUSED *_operator_data)
{
- return(-1);
-} /* end test_select_none_iter1() */
+ return (-1);
+} /* end test_select_none_iter1() */
/****************************************************************
**
@@ -709,16 +831,16 @@ test_select_none_iter1(void H5_ATTR_UNUSED *_elem, hid_t H5_ATTR_UNUSED type_id,
static void
test_select_all(hid_t xfer_plist)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hsize_t dims1[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j,k; /* Counters */
- herr_t ret; /* Generic return value */
- H5S_class_t ext_type; /* Extent type */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j, k; /* Counters */
+ herr_t ret; /* Generic return value */
+ H5S_class_t ext_type; /* Extent type */
/* Output message about test being performed */
MESSAGE(5, ("Testing 'All' Selection Functions\n"));
@@ -730,9 +852,9 @@ test_select_all(hid_t xfer_plist)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
- for(j=0; j<SPACE4_DIM2; j++)
- for(k=0; k<SPACE4_DIM3; k++)
+ for (i = 0, tbuf = wbuf; i < SPACE4_DIM1; i++)
+ for (j = 0; j < SPACE4_DIM2; j++)
+ for (k = 0; k < SPACE4_DIM3; k++)
*tbuf++ = (uint8_t)((((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k);
/* Create file */
@@ -761,7 +883,7 @@ test_select_all(hid_t xfer_plist)
/* Check that the values match with a dataset iterator */
tbuf = wbuf;
- ret = H5Diterate(rbuf, H5T_NATIVE_UCHAR, sid1, test_select_all_iter1, &tbuf);
+ ret = H5Diterate(rbuf, H5T_NATIVE_UCHAR, sid1, test_select_all_iter1, &tbuf);
CHECK(ret, FAIL, "H5Diterate");
/* Close disk dataspace */
@@ -779,7 +901,7 @@ test_select_all(hid_t xfer_plist)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_all() */
+} /* test_select_all() */
/****************************************************************
**
@@ -790,22 +912,22 @@ test_select_all(hid_t xfer_plist)
static void
test_select_all_hyper(hid_t xfer_plist)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- H5S_class_t ext_type; /* Extent type */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ H5S_class_t ext_type; /* Extent type */
/* Output message about test being performed */
MESSAGE(5, ("Testing 'All' Selection Functions\n"));
@@ -817,9 +939,9 @@ test_select_all_hyper(hid_t xfer_plist)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -842,11 +964,15 @@ test_select_all_hyper(hid_t xfer_plist)
CHECK(ret, FAIL, "H5Sselect_all");
/* Select 15x26 hyperslab for memory dataset */
- start[0] = 15; start[1] = 0;
- stride[0] = 1; stride[1] = 1;
- count[0] = 15; count[1] = 26;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 15;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
@@ -866,11 +992,15 @@ test_select_all_hyper(hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 15x26 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select no extent for disk dataset */
@@ -878,7 +1008,7 @@ test_select_all_hyper(hid_t xfer_plist)
CHECK(ret, FAIL, "H5Sselect_none");
/* Read selection from disk (should fail with no selection defined) */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, rbuf);
VERIFY(ret, FAIL, "H5Dread");
/* Select entire 15x26 extent for disk dataset */
@@ -886,18 +1016,18 @@ test_select_all_hyper(hid_t xfer_plist)
CHECK(ret, FAIL, "H5Sselect_all");
/* Read selection from disk (should work now) */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Check that the values match with a dataset iterator */
- tbuf=wbuf+(15*SPACE2_DIM2);
- ret = H5Diterate(rbuf,H5T_NATIVE_UCHAR,sid2,test_select_all_iter1,&tbuf);
+ tbuf = wbuf + (15 * SPACE2_DIM2);
+ ret = H5Diterate(rbuf, H5T_NATIVE_UCHAR, sid2, test_select_all_iter1, &tbuf);
CHECK(ret, FAIL, "H5Diterate");
/* A quick check to make certain that iterating through a "none" selection works */
ret = H5Sselect_none(sid2);
CHECK(ret, FAIL, "H5Sselect_none");
- ret = H5Diterate(rbuf,H5T_NATIVE_UCHAR,sid2,test_select_none_iter1,&tbuf);
+ ret = H5Diterate(rbuf, H5T_NATIVE_UCHAR, sid2, test_select_none_iter1, &tbuf);
CHECK(ret, FAIL, "H5Diterate");
/* Close memory dataspace */
@@ -919,7 +1049,7 @@ test_select_all_hyper(hid_t xfer_plist)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_all_hyper() */
+} /* test_select_all_hyper() */
/****************************************************************
**
@@ -931,23 +1061,23 @@ test_select_all_hyper(hid_t xfer_plist)
static void
test_select_combo(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Combination of Hyperslab & Element Selection Functions\n"));
@@ -959,9 +1089,9 @@ test_select_combo(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -976,25 +1106,49 @@ test_select_combo(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select sequence of ten points for disk dataset */
- coord1[0][0]=0; coord1[0][1]=10; coord1[0][2]= 5;
- coord1[1][0]=1; coord1[1][1]= 2; coord1[1][2]= 7;
- coord1[2][0]=2; coord1[2][1]= 4; coord1[2][2]= 9;
- coord1[3][0]=0; coord1[3][1]= 6; coord1[3][2]=11;
- coord1[4][0]=1; coord1[4][1]= 8; coord1[4][2]=13;
- coord1[5][0]=2; coord1[5][1]=12; coord1[5][2]= 0;
- coord1[6][0]=0; coord1[6][1]=14; coord1[6][2]= 2;
- coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4;
- coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6;
- coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8;
- ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ coord1[0][0] = 0;
+ coord1[0][1] = 10;
+ coord1[0][2] = 5;
+ coord1[1][0] = 1;
+ coord1[1][1] = 2;
+ coord1[1][2] = 7;
+ coord1[2][0] = 2;
+ coord1[2][1] = 4;
+ coord1[2][2] = 9;
+ coord1[3][0] = 0;
+ coord1[3][1] = 6;
+ coord1[3][2] = 11;
+ coord1[4][0] = 1;
+ coord1[4][1] = 8;
+ coord1[4][2] = 13;
+ coord1[5][0] = 2;
+ coord1[5][1] = 12;
+ coord1[5][2] = 0;
+ coord1[6][0] = 0;
+ coord1[6][1] = 14;
+ coord1[6][2] = 2;
+ coord1[7][0] = 1;
+ coord1[7][1] = 0;
+ coord1[7][2] = 4;
+ coord1[8][0] = 2;
+ coord1[8][1] = 1;
+ coord1[8][2] = 6;
+ coord1[9][0] = 0;
+ coord1[9][1] = 3;
+ coord1[9][2] = 8;
+ ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Select 1x10 hyperslab for writing memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
@@ -1014,23 +1168,27 @@ test_select_combo(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 10x1 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i=0; i<POINT1_NPOINTS; i++) {
- tbuf=wbuf+i;
- tbuf2=rbuf+(i*SPACE3_DIM2);
- if(*tbuf!=*tbuf2)
- TestErrPrintf("element values don't match!, i=%d\n",i);
+ for (i = 0; i < POINT1_NPOINTS; i++) {
+ tbuf = wbuf + i;
+ tbuf2 = rbuf + (i * SPACE3_DIM2);
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("element values don't match!, i=%d\n", i);
} /* end for */
/* Close memory dataspace */
@@ -1052,18 +1210,17 @@ test_select_combo(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_combo() */
+} /* test_select_combo() */
static int
compare_size_t(const void *s1, const void *s2)
{
- if(*(const size_t *)s1<*(const size_t *)s2)
- return(-1);
+ if (*(const size_t *)s1 < *(const size_t *)s2)
+ return (-1);
+ else if (*(const size_t *)s1 > *(const size_t *)s2)
+ return (1);
else
- if(*(const size_t *)s1>*(const size_t *)s2)
- return(1);
- else
- return(0);
+ return (0);
}
/****************************************************************
@@ -1075,46 +1232,47 @@ compare_size_t(const void *s1, const void *s2)
static void
test_select_hyper_stride(hid_t xfer_plist)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- uint16_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- size_t loc1[72]={ /* Gruesomely ugly way to make certain hyperslab locations are checked correctly */
- 27, 28, 29, 53, 54, 55, 79, 80, 81, /* Block #1 */
- 32, 33, 34, 58, 59, 60, 84, 85, 86, /* Block #2 */
- 157,158,159,183,184,185,209,210,211, /* Block #3 */
- 162,163,164,188,189,190,214,215,216, /* Block #4 */
- 287,288,289,313,314,315,339,340,341, /* Block #5 */
- 292,293,294,318,319,320,344,345,346, /* Block #6 */
- 417,418,419,443,444,445,469,470,471, /* Block #7 */
- 422,423,424,448,449,450,474,475,476, /* Block #8 */
- };
- size_t loc2[72]={
- 0, 1, 2, 26, 27, 28, /* Block #1 */
- 4, 5, 6, 30, 31, 32, /* Block #2 */
- 8, 9, 10, 34, 35, 36, /* Block #3 */
- 12, 13, 14, 38, 39, 40, /* Block #4 */
- 104,105,106,130,131,132, /* Block #5 */
- 108,109,110,134,135,136, /* Block #6 */
- 112,113,114,138,139,140, /* Block #7 */
- 116,117,118,142,143,144, /* Block #8 */
- 208,209,210,234,235,236, /* Block #9 */
- 212,213,214,238,239,240, /* Block #10 */
- 216,217,218,242,243,244, /* Block #11 */
- 220,221,222,246,247,248, /* Block #12 */
- };
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ uint16_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ size_t loc1[72] = {
+ /* Gruesomely ugly way to make certain hyperslab locations are checked correctly */
+ 27, 28, 29, 53, 54, 55, 79, 80, 81, /* Block #1 */
+ 32, 33, 34, 58, 59, 60, 84, 85, 86, /* Block #2 */
+ 157, 158, 159, 183, 184, 185, 209, 210, 211, /* Block #3 */
+ 162, 163, 164, 188, 189, 190, 214, 215, 216, /* Block #4 */
+ 287, 288, 289, 313, 314, 315, 339, 340, 341, /* Block #5 */
+ 292, 293, 294, 318, 319, 320, 344, 345, 346, /* Block #6 */
+ 417, 418, 419, 443, 444, 445, 469, 470, 471, /* Block #7 */
+ 422, 423, 424, 448, 449, 450, 474, 475, 476, /* Block #8 */
+ };
+ size_t loc2[72] = {
+ 0, 1, 2, 26, 27, 28, /* Block #1 */
+ 4, 5, 6, 30, 31, 32, /* Block #2 */
+ 8, 9, 10, 34, 35, 36, /* Block #3 */
+ 12, 13, 14, 38, 39, 40, /* Block #4 */
+ 104, 105, 106, 130, 131, 132, /* Block #5 */
+ 108, 109, 110, 134, 135, 136, /* Block #6 */
+ 112, 113, 114, 138, 139, 140, /* Block #7 */
+ 116, 117, 118, 142, 143, 144, /* Block #8 */
+ 208, 209, 210, 234, 235, 236, /* Block #9 */
+ 212, 213, 214, 238, 239, 240, /* Block #10 */
+ 216, 217, 218, 242, 243, 244, /* Block #11 */
+ 220, 221, 222, 246, 247, 248, /* Block #12 */
+ };
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n"));
@@ -1126,9 +1284,9 @@ test_select_hyper_stride(hid_t xfer_plist)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint16_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint16_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1143,19 +1301,31 @@ test_select_hyper_stride(hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x3x3 count with a stride of 2x4x3 & 1x2x2 block hyperslab for disk dataset */
- start[0] = 0; start[1] = 0; start[2] = 0;
- stride[0] = 2; stride[1] = 4; stride[2] = 3;
- count[0] = 2; count[1] = 3; count[2] = 3;
- block[0] = 1; block[1] = 2; block[2] = 2;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 2;
+ stride[1] = 4;
+ stride[2] = 3;
+ count[0] = 2;
+ count[1] = 3;
+ count[2] = 3;
+ block[0] = 1;
+ block[1] = 2;
+ block[2] = 2;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 4x2 count with a stride of 5x5 & 3x3 block hyperslab for memory dataset */
- start[0] = 1; start[1] = 1;
- stride[0] = 5; stride[1] = 5;
- count[0] = 4; count[1] = 2;
- block[0] = 3; block[1] = 3;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 1;
+ start[1] = 1;
+ stride[0] = 5;
+ stride[1] = 5;
+ count[0] = 4;
+ count[1] = 2;
+ block[0] = 3;
+ block[1] = 3;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
@@ -1175,30 +1345,36 @@ test_select_hyper_stride(hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 3x4 count with a stride of 4x4 & 2x3 block hyperslab for memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=4; stride[1]=4;
- count[0]=3; count[1]=4;
- block[0]=2; block[1]=3;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 4;
+ stride[1] = 4;
+ count[0] = 3;
+ count[1] = 4;
+ block[0] = 2;
+ block[1] = 3;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_USHORT,sid2,sid1,xfer_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid2, sid1, xfer_plist, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Sort the locations into the proper order */
HDqsort(loc1, (size_t)72, sizeof(size_t), compare_size_t);
HDqsort(loc2, (size_t)72, sizeof(size_t), compare_size_t);
/* Compare data read with data written out */
- for(i=0; i<72; i++) {
- tbuf=wbuf+loc1[i];
- tbuf2=rbuf+loc2[i];
- if(*tbuf!=*tbuf2) {
- HDprintf("%d: hyperslab values don't match!, loc1[%d]=%d, loc2[%d]=%d\n",__LINE__,i,(int)loc1[i],i,(int)loc2[i]);
- HDprintf("wbuf=%p, tbuf=%p, rbuf=%p, tbuf2=%p\n",(void *)wbuf,(void *)tbuf,(void *)rbuf,(void *)tbuf2);
- TestErrPrintf("*tbuf=%u, *tbuf2=%u\n",(unsigned)*tbuf,(unsigned)*tbuf2);
+ for (i = 0; i < 72; i++) {
+ tbuf = wbuf + loc1[i];
+ tbuf2 = rbuf + loc2[i];
+ if (*tbuf != *tbuf2) {
+ HDprintf("%d: hyperslab values don't match!, loc1[%d]=%d, loc2[%d]=%d\n", __LINE__, i,
+ (int)loc1[i], i, (int)loc2[i]);
+ HDprintf("wbuf=%p, tbuf=%p, rbuf=%p, tbuf2=%p\n", (void *)wbuf, (void *)tbuf, (void *)rbuf,
+ (void *)tbuf2);
+ TestErrPrintf("*tbuf=%u, *tbuf2=%u\n", (unsigned)*tbuf, (unsigned)*tbuf2);
} /* end if */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -1219,7 +1395,7 @@ test_select_hyper_stride(hid_t xfer_plist)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_stride() */
+} /* test_select_hyper_stride() */
/****************************************************************
**
@@ -1230,19 +1406,19 @@ test_select_hyper_stride(hid_t xfer_plist)
static void
test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims2[] = {SPACE2_DIM2, SPACE2_DIM1};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- uint16_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims2[] = {SPACE2_DIM2, SPACE2_DIM1};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ uint16_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Contiguous Hyperslabs Functionality\n"));
@@ -1254,9 +1430,9 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint16_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint16_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1271,19 +1447,27 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 12x10 count with a stride of 1x3 & 3x3 block hyperslab for disk dataset */
- start[0] = 0; start[1] = 0;
- stride[0] = 1; stride[1] = 3;
- count[0] = 12; count[1] = 10;
- block[0] = 1; block[1] = 3;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 3;
+ count[0] = 12;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 3;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 4x5 count with a stride of 3x6 & 3x6 block hyperslab for memory dataset */
- start[0] = 0; start[1] = 0;
- stride[0] = 3; stride[1] = 6;
- count[0] = 4; count[1] = 5;
- block[0] = 3; block[1] = 6;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 3;
+ stride[1] = 6;
+ count[0] = 4;
+ count[1] = 5;
+ block[0] = 3;
+ block[1] = 6;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
@@ -1303,19 +1487,27 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 6x5 count with a stride of 2x6 & 2x6 block hyperslab for disk dataset */
- start[0] = 0; start[1] = 0;
- stride[0] = 2; stride[1] = 6;
- count[0] = 6; count[1] = 5;
- block[0] = 2; block[1] = 6;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 6;
+ count[0] = 6;
+ count[1] = 5;
+ block[0] = 2;
+ block[1] = 6;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 3x15 count with a stride of 4x2 & 4x2 block hyperslab for memory dataset */
- start[0] = 0; start[1] = 0;
- stride[0] = 4; stride[1] = 2;
- count[0] = 3; count[1] = 15;
- block[0] = 4; block[1] = 2;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 4;
+ stride[1] = 2;
+ count[0] = 3;
+ count[1] = 15;
+ block[0] = 4;
+ block[1] = 2;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
@@ -1323,8 +1515,8 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12))
- TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__);
+ if (HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12))
+ TestErrPrintf("hyperslab values don't match! Line=%d\n", __LINE__);
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -1345,7 +1537,7 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_contig() */
+} /* test_select_hyper_contig() */
/****************************************************************
**
@@ -1356,17 +1548,17 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
static void
test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1};
- hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */
- hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */
- uint16_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j,k,l; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1};
+ hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */
+ hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */
+ uint16_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j, k, l; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing More Contiguous Hyperslabs Functionality\n"));
@@ -1374,15 +1566,16 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
CHECK_PTR(wbuf, "HDmalloc");
- rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
+ rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t),
+ (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE8_DIM1; i++)
- for(j=0; j<SPACE8_DIM2; j++)
- for(k=0; k<SPACE8_DIM3; k++)
- for(l=0; l<SPACE8_DIM4; l++)
- *tbuf++=(uint16_t)((i*SPACE8_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE8_DIM1; i++)
+ for (j = 0; j < SPACE8_DIM2; j++)
+ for (k = 0; k < SPACE8_DIM3; k++)
+ for (l = 0; l < SPACE8_DIM4; l++)
+ *tbuf++ = (uint16_t)((i * SPACE8_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1397,15 +1590,27 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select contiguous hyperslab for disk dataset */
- start[0]=0; start[1]=0; start[2]=0; start[3]=0;
- count[0]=2; count[1]=SPACE8_DIM3; count[2]=SPACE8_DIM2; count[3]=SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ start[3] = 0;
+ count[0] = 2;
+ count[1] = SPACE8_DIM3;
+ count[2] = SPACE8_DIM2;
+ count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select contiguous hyperslab in memory */
- start[0]=0; start[1]=0; start[2]=0; start[3]=0;
- count[0]=2; count[1]=SPACE8_DIM3; count[2]=SPACE8_DIM2; count[3]=SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ start[3] = 0;
+ count[0] = 2;
+ count[1] = SPACE8_DIM3;
+ count[2] = SPACE8_DIM2;
+ count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
@@ -1425,23 +1630,35 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select contiguous hyperslab in memory */
- start[0]=0; start[1]=0; start[2]=0; start[3]=0;
- count[0]=2; count[1]=SPACE8_DIM3; count[2]=SPACE8_DIM2; count[3]=SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ start[3] = 0;
+ count[0] = 2;
+ count[1] = SPACE8_DIM3;
+ count[2] = SPACE8_DIM2;
+ count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select contiguous hyperslab in memory */
- start[0]=0; start[1]=0; start[2]=0; start[3]=0;
- count[0]=2; count[1]=SPACE8_DIM3; count[2]=SPACE8_DIM2; count[3]=SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ start[3] = 0;
+ count[0] = 2;
+ count[1] = SPACE8_DIM3;
+ count[2] = SPACE8_DIM2;
+ count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_USHORT,sid2,sid1,xfer_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid2, sid1, xfer_plist, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1))
+ if (HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 2 * SPACE8_DIM3 * SPACE8_DIM2 * SPACE8_DIM1))
TestErrPrintf("Error: hyperslab values don't match!\n");
/* Close memory dataspace */
@@ -1463,7 +1680,7 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_contig2() */
+} /* test_select_hyper_contig2() */
/****************************************************************
**
@@ -1477,17 +1694,17 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
static void
test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1};
- hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */
- hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */
- uint16_t *wbuf, /* Buffer to write to disk */
- *rbuf, /* Buffer read from disk */
- *tbuf, *tbuf2; /* Temporary buffer pointers */
- unsigned i,j,k,l; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1};
+ hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */
+ hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */
+ uint16_t *wbuf, /* Buffer to write to disk */
+ *rbuf, /* Buffer read from disk */
+ *tbuf, *tbuf2; /* Temporary buffer pointers */
+ unsigned i, j, k, l; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Yet More Contiguous Hyperslabs Functionality\n"));
@@ -1495,15 +1712,16 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
CHECK_PTR(wbuf, "HDmalloc");
- rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
+ rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t),
+ (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE8_DIM4; i++)
- for(j=0; j<SPACE8_DIM3; j++)
- for(k=0; k<SPACE8_DIM2; k++)
- for(l=0; l<SPACE8_DIM1; l++)
- *tbuf++=(uint16_t)((k*SPACE8_DIM2)+l);
+ for (i = 0, tbuf = wbuf; i < SPACE8_DIM4; i++)
+ for (j = 0; j < SPACE8_DIM3; j++)
+ for (k = 0; k < SPACE8_DIM2; k++)
+ for (l = 0; l < SPACE8_DIM1; l++)
+ *tbuf++ = (uint16_t)((k * SPACE8_DIM2) + l);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1518,15 +1736,27 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select semi-contiguous hyperslab for disk dataset */
- start[0] = 0; start[1] = 0; start[2] = SPACE8_DIM2/2; start[3] = 0;
- count[0] = 2; count[1] = SPACE8_DIM3; count[2] = SPACE8_DIM2 / 2; count[3] = SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = SPACE8_DIM2 / 2;
+ start[3] = 0;
+ count[0] = 2;
+ count[1] = SPACE8_DIM3;
+ count[2] = SPACE8_DIM2 / 2;
+ count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select semi-contiguous hyperslab in memory */
- start[0] = 0; start[1] = 0; start[2] = SPACE8_DIM2 / 2; start[3] = 0;
- count[0] = 2; count[1] = SPACE8_DIM3; count[2] = SPACE8_DIM2 / 2; count[3] = SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = SPACE8_DIM2 / 2;
+ start[3] = 0;
+ count[0] = 2;
+ count[1] = SPACE8_DIM3;
+ count[2] = SPACE8_DIM2 / 2;
+ count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
@@ -1546,41 +1776,55 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select semi-contiguous hyperslab in memory */
- start[0]=0; start[1]=0; start[2]=SPACE8_DIM2/2; start[3]=0;
- count[0]=2; count[1]=SPACE8_DIM3; count[2]=SPACE8_DIM2/2; count[3]=SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = SPACE8_DIM2 / 2;
+ start[3] = 0;
+ count[0] = 2;
+ count[1] = SPACE8_DIM3;
+ count[2] = SPACE8_DIM2 / 2;
+ count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select semi-contiguous hyperslab in memory */
- start[0]=0; start[1]=0; start[2]=SPACE8_DIM2/2; start[3]=0;
- count[0]=2; count[1]=SPACE8_DIM3; count[2]=SPACE8_DIM2/2; count[3]=SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = SPACE8_DIM2 / 2;
+ start[3] = 0;
+ count[0] = 2;
+ count[1] = SPACE8_DIM3;
+ count[2] = SPACE8_DIM2 / 2;
+ count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_USHORT,sid2,sid1,xfer_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid2, sid1, xfer_plist, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i=0, tbuf=wbuf,tbuf2=rbuf; i<SPACE8_DIM4; i++)
- for(j=0; j<SPACE8_DIM3; j++)
- for(k=0; k<SPACE8_DIM2; k++)
- for(l=0; l<SPACE8_DIM1; l++,tbuf++,tbuf2++)
- if( (i>=start[0] && i<(start[0]+count[0])) &&
- (j>=start[1] && j<(start[1]+count[1])) &&
- (k>=start[2] && k<(start[2]+count[2])) &&
- (l>=start[3] && l<(start[3]+count[3])) ) {
- if(*tbuf!=*tbuf2) {
+ for (i = 0, tbuf = wbuf, tbuf2 = rbuf; i < SPACE8_DIM4; i++)
+ for (j = 0; j < SPACE8_DIM3; j++)
+ for (k = 0; k < SPACE8_DIM2; k++)
+ for (l = 0; l < SPACE8_DIM1; l++, tbuf++, tbuf2++)
+ if ((i >= start[0] && i < (start[0] + count[0])) &&
+ (j >= start[1] && j < (start[1] + count[1])) &&
+ (k >= start[2] && k < (start[2] + count[2])) &&
+ (l >= start[3] && l < (start[3] + count[3]))) {
+ if (*tbuf != *tbuf2) {
HDprintf("Error: hyperslab values don't match!\n");
- TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2);
+ TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n", __LINE__,
+ i, j, k, l, (unsigned)*tbuf, (unsigned)*tbuf2);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(*tbuf2!=0) {
+ if (*tbuf2 != 0) {
HDprintf("Error: invalid data in read buffer!\n");
- TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2);
+ TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n", __LINE__,
+ i, j, k, l, (unsigned)*tbuf, (unsigned)*tbuf2);
} /* end if */
- } /* end else */
+ } /* end else */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -1601,8 +1845,7 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_contig3() */
-
+} /* test_select_hyper_contig3() */
/****************************************************************
**
@@ -1611,23 +1854,23 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
**
****************************************************************/
static void
-verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf,
- size_t H5_ATTR_NDEBUG_UNUSED cube_size, unsigned edge_size, unsigned cube_rank)
+verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, size_t H5_ATTR_NDEBUG_UNUSED cube_size,
+ unsigned edge_size, unsigned cube_rank)
{
- const uint16_t *cube_ptr; /* Pointer into the cube buffer */
- uint16_t expected_value; /* Expected value in dataset */
- unsigned i, j, k, l, m; /* Local index variables */
- size_t s; /* Local index variable */
- hbool_t mis_match; /* Flag to indicate mis-match in expected value */
+ const uint16_t *cube_ptr; /* Pointer into the cube buffer */
+ uint16_t expected_value; /* Expected value in dataset */
+ unsigned i, j, k, l, m; /* Local index variables */
+ size_t s; /* Local index variable */
+ hbool_t mis_match; /* Flag to indicate mis-match in expected value */
HDassert(cube_buf);
HDassert(cube_size > 0);
expected_value = 0;
- mis_match = FALSE;
- cube_ptr = cube_buf;
- s = 0;
- i = 0;
+ mis_match = FALSE;
+ cube_ptr = cube_buf;
+ s = 0;
+ i = 0;
do {
j = 0;
do {
@@ -1641,7 +1884,7 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf,
HDassert(s < cube_size);
/* Check for correct value */
- if(*cube_ptr != expected_value)
+ if (*cube_ptr != expected_value)
mis_match = TRUE;
/* Advance to next element */
@@ -1649,19 +1892,18 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf,
expected_value++;
s++;
m++;
- } while((cube_rank > 0) && (m < edge_size));
+ } while ((cube_rank > 0) && (m < edge_size));
l++;
- } while((cube_rank > 1) && (l < edge_size));
+ } while ((cube_rank > 1) && (l < edge_size));
k++;
- } while((cube_rank > 2) && (k < edge_size));
+ } while ((cube_rank > 2) && (k < edge_size));
j++;
- } while((cube_rank > 3) && (j < edge_size));
+ } while ((cube_rank > 3) && (j < edge_size));
i++;
- } while((cube_rank > 4) && (i < edge_size));
- if(mis_match)
+ } while ((cube_rank > 4) && (i < edge_size));
+ if (mis_match)
TestErrPrintf("Initial cube data don't match! Line = %d\n", __LINE__);
-} /* verify_select_hyper_contig_dr__run_test() */
-
+} /* verify_select_hyper_contig_dr__run_test() */
/****************************************************************
**
@@ -1673,44 +1915,45 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf,
**
****************************************************************/
static void
-test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
- const uint16_t *zero_buf, unsigned edge_size, unsigned chunk_edge_size,
- unsigned small_rank, unsigned large_rank, hid_t dset_type, hid_t xfer_plist)
+test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, const uint16_t *zero_buf,
+ unsigned edge_size, unsigned chunk_edge_size, unsigned small_rank,
+ unsigned large_rank, hid_t dset_type, hid_t xfer_plist)
{
- hbool_t mis_match; /* Flag indicating a value read in wasn't what was expected */
- hid_t fapl; /* File access property list */
- hid_t fid1; /* File ID */
- hid_t small_cube_sid; /* Dataspace ID for small cube in memory & file */
- hid_t mem_large_cube_sid; /* Dataspace ID for large cube in memory */
- hid_t file_large_cube_sid; /* Dataspace ID for large cube in file */
- hid_t small_cube_dcpl_id = H5P_DEFAULT; /* DCPL for small cube dataset */
- hid_t large_cube_dcpl_id = H5P_DEFAULT; /* DCPL for large cube dataset */
- hid_t small_cube_dataset; /* Dataset ID */
- hid_t large_cube_dataset; /* Dataset ID */
- size_t start_index; /* Offset within buffer to begin inspecting */
- size_t stop_index; /* Offset within buffer to end inspecting */
- uint16_t expected_value; /* Expected value in dataset */
- uint16_t * small_cube_buf_1; /* Buffer for small cube data */
- uint16_t * large_cube_buf_1; /* Buffer for large cube data */
- uint16_t * ptr_1; /* Temporary pointer into cube data */
- hsize_t dims[SS_DR_MAX_RANK]; /* Dataspace dimensions */
- hsize_t start[SS_DR_MAX_RANK]; /* Shared hyperslab start offset */
- hsize_t stride[SS_DR_MAX_RANK]; /* Shared hyperslab stride */
- hsize_t count[SS_DR_MAX_RANK]; /* Shared hyperslab count */
- hsize_t block[SS_DR_MAX_RANK]; /* Shared hyperslab block size */
- hsize_t * start_ptr; /* Actual hyperslab start offset */
- hsize_t * stride_ptr; /* Actual hyperslab stride */
- hsize_t * count_ptr; /* Actual hyperslab count */
- hsize_t * block_ptr; /* Actual hyperslab block size */
- size_t small_cube_size; /* Number of elements in small cube */
- size_t large_cube_size; /* Number of elements in large cube */
- unsigned u, v, w, x; /* Local index variables */
- size_t s; /* Local index variable */
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hbool_t mis_match; /* Flag indicating a value read in wasn't what was expected */
+ hid_t fapl; /* File access property list */
+ hid_t fid1; /* File ID */
+ hid_t small_cube_sid; /* Dataspace ID for small cube in memory & file */
+ hid_t mem_large_cube_sid; /* Dataspace ID for large cube in memory */
+ hid_t file_large_cube_sid; /* Dataspace ID for large cube in file */
+ hid_t small_cube_dcpl_id = H5P_DEFAULT; /* DCPL for small cube dataset */
+ hid_t large_cube_dcpl_id = H5P_DEFAULT; /* DCPL for large cube dataset */
+ hid_t small_cube_dataset; /* Dataset ID */
+ hid_t large_cube_dataset; /* Dataset ID */
+ size_t start_index; /* Offset within buffer to begin inspecting */
+ size_t stop_index; /* Offset within buffer to end inspecting */
+ uint16_t expected_value; /* Expected value in dataset */
+ uint16_t *small_cube_buf_1; /* Buffer for small cube data */
+ uint16_t *large_cube_buf_1; /* Buffer for large cube data */
+ uint16_t *ptr_1; /* Temporary pointer into cube data */
+ hsize_t dims[SS_DR_MAX_RANK]; /* Dataspace dimensions */
+ hsize_t start[SS_DR_MAX_RANK]; /* Shared hyperslab start offset */
+ hsize_t stride[SS_DR_MAX_RANK]; /* Shared hyperslab stride */
+ hsize_t count[SS_DR_MAX_RANK]; /* Shared hyperslab count */
+ hsize_t block[SS_DR_MAX_RANK]; /* Shared hyperslab block size */
+ hsize_t * start_ptr; /* Actual hyperslab start offset */
+ hsize_t * stride_ptr; /* Actual hyperslab stride */
+ hsize_t * count_ptr; /* Actual hyperslab count */
+ hsize_t * block_ptr; /* Actual hyperslab block size */
+ size_t small_cube_size; /* Number of elements in small cube */
+ size_t large_cube_size; /* Number of elements in large cube */
+ unsigned u, v, w, x; /* Local index variables */
+ size_t s; /* Local index variable */
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
MESSAGE(7, ("\tn-cube slice through m-cube I/O test %d.\n", test_num));
- MESSAGE(7, ("\tranks = %u/%u, edge_size = %u, chunk_edge_size = %u.\n", small_rank, large_rank, edge_size, chunk_edge_size));
+ MESSAGE(7, ("\tranks = %u/%u, edge_size = %u, chunk_edge_size = %u.\n", small_rank, large_rank, edge_size,
+ chunk_edge_size));
HDassert(edge_size >= 6);
HDassert(edge_size >= chunk_edge_size);
@@ -1721,8 +1964,8 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
/* Compute cube sizes */
small_cube_size = large_cube_size = (size_t)1;
- for(u = 0; u < large_rank; u++) {
- if(u < small_rank)
+ for (u = 0; u < large_rank; u++) {
+ if (u < small_rank)
small_cube_size *= (size_t)edge_size;
large_cube_size *= (size_t)edge_size;
@@ -1775,11 +2018,11 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
* large data set creation property lists to specify chunked
* datasets.
*/
- if(chunk_edge_size > 0) {
- hsize_t chunk_dims[SS_DR_MAX_RANK]; /* Chunk dimensions */
+ if (chunk_edge_size > 0) {
+ hsize_t chunk_dims[SS_DR_MAX_RANK]; /* Chunk dimensions */
- chunk_dims[0] = chunk_dims[1] =
- chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = (hsize_t)chunk_edge_size;
+ chunk_dims[0] = chunk_dims[1] = chunk_dims[2] = chunk_dims[3] = chunk_dims[4] =
+ (hsize_t)chunk_edge_size;
small_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
CHECK(small_cube_dcpl_id, FAIL, "H5Pcreate");
@@ -1790,7 +2033,6 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
ret = H5Pset_chunk(small_cube_dcpl_id, (int)small_rank, chunk_dims);
CHECK(ret, FAIL, "H5Pset_chunk");
-
large_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
CHECK(large_cube_dcpl_id, FAIL, "H5Pcreate");
@@ -1802,54 +2044,50 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
} /* end if */
/* create the small cube dataset */
- small_cube_dataset = H5Dcreate2(fid1, "small_cube_dataset", dset_type,
- small_cube_sid, H5P_DEFAULT, small_cube_dcpl_id, H5P_DEFAULT);
+ small_cube_dataset = H5Dcreate2(fid1, "small_cube_dataset", dset_type, small_cube_sid, H5P_DEFAULT,
+ small_cube_dcpl_id, H5P_DEFAULT);
CHECK(small_cube_dataset, FAIL, "H5Dcreate2");
/* Close non-default small dataset DCPL */
- if(small_cube_dcpl_id != H5P_DEFAULT) {
+ if (small_cube_dcpl_id != H5P_DEFAULT) {
ret = H5Pclose(small_cube_dcpl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end if */
/* create the large cube dataset */
- large_cube_dataset = H5Dcreate2(fid1, "large_cube_dataset", dset_type,
- file_large_cube_sid, H5P_DEFAULT, large_cube_dcpl_id, H5P_DEFAULT);
+ large_cube_dataset = H5Dcreate2(fid1, "large_cube_dataset", dset_type, file_large_cube_sid, H5P_DEFAULT,
+ large_cube_dcpl_id, H5P_DEFAULT);
CHECK(large_cube_dataset, FAIL, "H5Dcreate2");
/* Close non-default large dataset DCPL */
- if(large_cube_dcpl_id != H5P_DEFAULT) {
+ if (large_cube_dcpl_id != H5P_DEFAULT) {
ret = H5Pclose(large_cube_dcpl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end if */
-
/* write initial data to the on disk datasets */
- ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid,
- small_cube_sid, xfer_plist, cube_buf);
+ ret =
+ H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, small_cube_sid, xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
- ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid,
- file_large_cube_sid, xfer_plist, cube_buf);
+ ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, file_large_cube_sid, xfer_plist,
+ cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
/* read initial data from disk and verify that it is as expected. */
- ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid,
- small_cube_sid, xfer_plist, small_cube_buf_1);
+ ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, small_cube_sid, xfer_plist,
+ small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
/* Check that the data is valid */
- verify_select_hyper_contig_dr__run_test(small_cube_buf_1, small_cube_size,
- edge_size, small_rank);
+ verify_select_hyper_contig_dr__run_test(small_cube_buf_1, small_cube_size, edge_size, small_rank);
- ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid,
- file_large_cube_sid, xfer_plist, large_cube_buf_1);
+ ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, file_large_cube_sid, xfer_plist,
+ large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
/* Check that the data is valid */
- verify_select_hyper_contig_dr__run_test(large_cube_buf_1, large_cube_size,
- edge_size, large_rank);
-
+ verify_select_hyper_contig_dr__run_test(large_cube_buf_1, large_cube_size, edge_size, large_rank);
/* first, verify that we can read from disk correctly using selections
* of different rank that H5Sselect_shape_same() views as being of the
@@ -1860,15 +2098,14 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
* returns true on the memory and file selections.
*/
-
/* set up start, stride, count, and block -- note that we will
* change start[] so as to read slices of the large cube.
*/
- for(u = 0; u < SS_DR_MAX_RANK; u++) {
- start[u] = 0;
+ for (u = 0; u < SS_DR_MAX_RANK; u++) {
+ start[u] = 0;
stride[u] = 1;
- count[u] = 1;
- if((SS_DR_MAX_RANK - u) > small_rank)
+ count[u] = 1;
+ if ((SS_DR_MAX_RANK - u) > small_rank)
block[u] = 1;
else
block[u] = (hsize_t)edge_size;
@@ -1892,12 +2129,8 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
start[3] = (hsize_t)x;
start[4] = (hsize_t)0;
- ret = H5Sselect_hyperslab(file_large_cube_sid,
- H5S_SELECT_SET,
- start_ptr,
- stride_ptr,
- count_ptr,
- block_ptr);
+ ret = H5Sselect_hyperslab(file_large_cube_sid, H5S_SELECT_SET, start_ptr, stride_ptr,
+ count_ptr, block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* verify that H5Sselect_shape_same() reports the two
@@ -1907,39 +2140,33 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
VERIFY(check, TRUE, "H5Sselect_shape_same");
/* Read selection from disk */
- ret = H5Dread(large_cube_dataset,
- H5T_NATIVE_UINT16,
- small_cube_sid,
- file_large_cube_sid,
- xfer_plist,
- small_cube_buf_1);
+ ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, file_large_cube_sid,
+ xfer_plist, small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
/* verify that expected data is retrieved */
- mis_match = FALSE;
- ptr_1 = small_cube_buf_1;
+ mis_match = FALSE;
+ ptr_1 = small_cube_buf_1;
expected_value = (uint16_t)((u * edge_size * edge_size * edge_size * edge_size) +
- (v * edge_size * edge_size * edge_size) +
- (w * edge_size * edge_size) +
- (x * edge_size));
- for(s = 0; s < small_cube_size; s++ ) {
- if(*ptr_1 != expected_value )
+ (v * edge_size * edge_size * edge_size) +
+ (w * edge_size * edge_size) + (x * edge_size));
+ for (s = 0; s < small_cube_size; s++) {
+ if (*ptr_1 != expected_value)
mis_match = TRUE;
ptr_1++;
expected_value++;
} /* end for */
- if(mis_match)
- TestErrPrintf("small cube read from largecube has bad data! Line=%d\n",__LINE__);
+ if (mis_match)
+ TestErrPrintf("small cube read from largecube has bad data! Line=%d\n", __LINE__);
x++;
- } while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
+ } while ((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
w++;
- } while((large_rank >= 3) && (small_rank <= 2) && (w < edge_size));
+ } while ((large_rank >= 3) && (small_rank <= 2) && (w < edge_size));
v++;
- } while((large_rank >= 4) && (small_rank <= 3) && (v < edge_size));
+ } while ((large_rank >= 4) && (small_rank <= 3) && (v < edge_size));
u++;
- } while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
-
+ } while ((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
/* similarly, read the on disk small cube into slices through the in memory
* large cube, and verify that the correct data (and only the correct data)
@@ -1967,78 +2194,65 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
start[3] = (hsize_t)x;
start[4] = (hsize_t)0;
- ret = H5Sselect_hyperslab(mem_large_cube_sid,
- H5S_SELECT_SET,
- start_ptr,
- stride_ptr,
- count_ptr,
- block_ptr);
+ ret = H5Sselect_hyperslab(mem_large_cube_sid, H5S_SELECT_SET, start_ptr, stride_ptr,
+ count_ptr, block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* verify that H5Sselect_shape_same() reports the two
* selections as having the same shape.
*/
check = H5Sselect_shape_same(small_cube_sid, mem_large_cube_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
-
/* Read selection from disk */
- ret = H5Dread(small_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_large_cube_sid,
- small_cube_sid,
- xfer_plist,
- large_cube_buf_1);
+ ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, small_cube_sid,
+ xfer_plist, large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
-
/* verify that the expected data and only the
* expected data was read.
*/
start_index = (u * edge_size * edge_size * edge_size * edge_size) +
- (v * edge_size * edge_size * edge_size) +
- (w * edge_size * edge_size) +
+ (v * edge_size * edge_size * edge_size) + (w * edge_size * edge_size) +
(x * edge_size);
stop_index = start_index + small_cube_size - 1;
HDassert(start_index < stop_index);
HDassert(stop_index <= large_cube_size);
- mis_match = FALSE;
- ptr_1 = large_cube_buf_1;
+ mis_match = FALSE;
+ ptr_1 = large_cube_buf_1;
expected_value = 0;
- for(s = 0; s < start_index; s++) {
- if(*ptr_1 != 0)
+ for (s = 0; s < start_index; s++) {
+ if (*ptr_1 != 0)
mis_match = TRUE;
ptr_1++;
} /* end for */
- for(; s <= stop_index; s++) {
- if(*ptr_1 != expected_value)
+ for (; s <= stop_index; s++) {
+ if (*ptr_1 != expected_value)
mis_match = TRUE;
expected_value++;
ptr_1++;
} /* end for */
- for(; s < large_cube_size; s++) {
- if(*ptr_1 != 0)
+ for (; s < large_cube_size; s++) {
+ if (*ptr_1 != 0)
mis_match = TRUE;
ptr_1++;
} /* end for */
- if(mis_match)
+ if (mis_match)
TestErrPrintf("large cube read from small cube has bad data! Line=%u\n", __LINE__);
/* Zero out the buffer for the next pass */
HDmemset(large_cube_buf_1 + start_index, 0, small_cube_size * sizeof(uint16_t));
x++;
- } while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
+ } while ((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
w++;
- } while((large_rank >= 3) && (small_rank <= 2) && (w < edge_size));
+ } while ((large_rank >= 3) && (small_rank <= 2) && (w < edge_size));
v++;
- } while((large_rank >= 4) && (small_rank <= 3) && (v < edge_size));
+ } while ((large_rank >= 4) && (small_rank <= 3) && (v < edge_size));
u++;
- } while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
-
+ } while ((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
/* now we go in the opposite direction, verifying that we can write
* from memory to file using selections of different rank that
@@ -2065,12 +2279,8 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
*/
/* zero out the on disk small cube */
- ret = H5Dwrite(small_cube_dataset,
- H5T_NATIVE_UINT16,
- small_cube_sid,
- small_cube_sid,
- xfer_plist,
- zero_buf);
+ ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, small_cube_sid,
+ xfer_plist, zero_buf);
CHECK(ret, FAIL, "H5Dwrite");
/* select the portion of the in memory large cube from which we
@@ -2082,15 +2292,10 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
start[3] = (hsize_t)x;
start[4] = (hsize_t)0;
- ret = H5Sselect_hyperslab(mem_large_cube_sid,
- H5S_SELECT_SET,
- start_ptr,
- stride_ptr,
- count_ptr,
- block_ptr);
+ ret = H5Sselect_hyperslab(mem_large_cube_sid, H5S_SELECT_SET, start_ptr, stride_ptr,
+ count_ptr, block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* verify that H5Sselect_shape_same() reports the in
* memory slice through the cube selection and the
* on disk full small cube selections as having the same shape.
@@ -2098,52 +2303,39 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
check = H5Sselect_shape_same(small_cube_sid, mem_large_cube_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
-
- /* write the slice from the in memory large cube to the on disk small cube */
- ret = H5Dwrite(small_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_large_cube_sid,
- small_cube_sid,
- xfer_plist,
- cube_buf);
+ /* write the slice from the in memory large cube to the on disk small cube */
+ ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, small_cube_sid,
+ xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
-
/* read the on disk small cube into memory */
- ret = H5Dread(small_cube_dataset,
- H5T_NATIVE_UINT16,
- small_cube_sid,
- small_cube_sid,
- xfer_plist,
- small_cube_buf_1);
+ ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, small_cube_sid,
+ xfer_plist, small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
-
/* verify that expected data is retrieved */
- mis_match = FALSE;
- ptr_1 = small_cube_buf_1;
+ mis_match = FALSE;
+ ptr_1 = small_cube_buf_1;
expected_value = (uint16_t)((u * edge_size * edge_size * edge_size * edge_size) +
- (v * edge_size * edge_size * edge_size) +
- (w * edge_size * edge_size) +
- (x * edge_size));
- for(s = 0; s < small_cube_size; s++) {
- if(*ptr_1 != expected_value)
+ (v * edge_size * edge_size * edge_size) +
+ (w * edge_size * edge_size) + (x * edge_size));
+ for (s = 0; s < small_cube_size; s++) {
+ if (*ptr_1 != expected_value)
mis_match = TRUE;
expected_value++;
ptr_1++;
} /* end for */
- if(mis_match )
- TestErrPrintf("small cube data don't match! Line=%d\n",__LINE__);
+ if (mis_match)
+ TestErrPrintf("small cube data don't match! Line=%d\n", __LINE__);
x++;
- } while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
+ } while ((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
w++;
- } while((large_rank >= 3) && (small_rank <= 2) && (w < edge_size));
+ } while ((large_rank >= 3) && (small_rank <= 2) && (w < edge_size));
v++;
- } while((large_rank >= 4) && (small_rank <= 3) && (v < edge_size));
+ } while ((large_rank >= 4) && (small_rank <= 3) && (v < edge_size));
u++;
- } while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
-
+ } while ((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
/* Now write the contents of the in memory small cube to slices of
* the on disk cube. After each write, read the on disk cube
@@ -2173,15 +2365,10 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
*/
/* zero out the on disk cube */
- ret = H5Dwrite(large_cube_dataset,
- H5T_NATIVE_USHORT,
- mem_large_cube_sid,
- file_large_cube_sid,
- xfer_plist,
- zero_buf);
+ ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_USHORT, mem_large_cube_sid,
+ file_large_cube_sid, xfer_plist, zero_buf);
CHECK(ret, FAIL, "H5Dwrite");
-
/* select the portion of the in memory large cube to which we
* are going to write data.
*/
@@ -2191,15 +2378,10 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
start[3] = (hsize_t)x;
start[4] = (hsize_t)0;
- ret = H5Sselect_hyperslab(file_large_cube_sid,
- H5S_SELECT_SET,
- start_ptr,
- stride_ptr,
- count_ptr,
- block_ptr);
+ ret = H5Sselect_hyperslab(file_large_cube_sid, H5S_SELECT_SET, start_ptr, stride_ptr,
+ count_ptr, block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* verify that H5Sselect_shape_same() reports the in
* memory full selection of the small cube and the
* on disk slice through the large cube selection
@@ -2208,72 +2390,60 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
check = H5Sselect_shape_same(small_cube_sid, file_large_cube_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
-
- /* write the cube from memory to the target slice of the disk cube */
- ret = H5Dwrite(large_cube_dataset,
- H5T_NATIVE_UINT16,
- small_cube_sid,
- file_large_cube_sid,
- xfer_plist,
- cube_buf);
+ /* write the cube from memory to the target slice of the disk cube */
+ ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, file_large_cube_sid,
+ xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
-
/* read the on disk cube into memory */
ret = H5Sselect_all(file_large_cube_sid);
CHECK(ret, FAIL, "H5Sselect_all");
- ret = H5Dread(large_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_large_cube_sid,
- file_large_cube_sid,
- xfer_plist,
- large_cube_buf_1);
+ ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid,
+ file_large_cube_sid, xfer_plist, large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
-
/* verify that the expected data and only the
* expected data was read.
*/
start_index = (u * edge_size * edge_size * edge_size * edge_size) +
- (v * edge_size * edge_size * edge_size) +
- (w * edge_size * edge_size) +
+ (v * edge_size * edge_size * edge_size) + (w * edge_size * edge_size) +
(x * edge_size);
stop_index = start_index + small_cube_size - 1;
HDassert(start_index < stop_index);
HDassert(stop_index <= large_cube_size);
- mis_match = FALSE;
- ptr_1 = large_cube_buf_1;
+ mis_match = FALSE;
+ ptr_1 = large_cube_buf_1;
expected_value = 0;
- for(s = 0; s < start_index; s++) {
- if(*ptr_1 != 0)
+ for (s = 0; s < start_index; s++) {
+ if (*ptr_1 != 0)
mis_match = TRUE;
ptr_1++;
} /* end for */
- for(; s <= stop_index; s++) {
- if(*ptr_1 != expected_value)
+ for (; s <= stop_index; s++) {
+ if (*ptr_1 != expected_value)
mis_match = TRUE;
expected_value++;
ptr_1++;
} /* end for */
- for(; s < large_cube_size; s++) {
- if(*ptr_1 != 0)
+ for (; s < large_cube_size; s++) {
+ if (*ptr_1 != 0)
mis_match = TRUE;
ptr_1++;
} /* end for */
- if(mis_match)
+ if (mis_match)
TestErrPrintf("large cube written from small cube has bad data! Line=%d\n", __LINE__);
x++;
- } while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
+ } while ((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
w++;
- } while((large_rank >= 3) && (small_rank <= 2) && (w < edge_size));
+ } while ((large_rank >= 3) && (small_rank <= 2) && (w < edge_size));
v++;
- } while((large_rank >= 4) && (small_rank <= 3) && (v < edge_size));
+ } while ((large_rank >= 4) && (small_rank <= 3) && (v < edge_size));
u++;
- } while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
+ } while ((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
/* Close memory dataspaces */
ret = H5Sclose(small_cube_sid);
@@ -2282,12 +2452,10 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
ret = H5Sclose(mem_large_cube_sid);
CHECK(ret, FAIL, "H5Sclose");
-
/* Close disk dataspace */
ret = H5Sclose(file_large_cube_sid);
CHECK(ret, FAIL, "H5Sclose");
-
/* Close Datasets */
ret = H5Dclose(small_cube_dataset);
CHECK(ret, FAIL, "H5Dclose");
@@ -2303,8 +2471,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
HDfree(small_cube_buf_1);
HDfree(large_cube_buf_1);
-} /* test_select_hyper_contig_dr__run_test() */
-
+} /* test_select_hyper_contig_dr__run_test() */
/****************************************************************
**
@@ -2318,25 +2485,25 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
static void
test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist)
{
- int test_num = 0;
- unsigned chunk_edge_size; /* Size of chunk's dataspace dimensions */
- unsigned edge_size = 6; /* Size of dataset's dataspace dimensions */
- unsigned small_rank; /* Current rank of small dataset */
- unsigned large_rank; /* Current rank of large dataset */
- uint16_t *cube_buf; /* Buffer for writing cube data */
- uint16_t *zero_buf; /* Buffer for writing zeroed cube data */
- uint16_t *cube_ptr; /* Temporary pointer into cube data */
- unsigned max_rank = 5; /* Max. rank to use */
- size_t max_cube_size; /* Max. number of elements in largest cube */
- size_t s; /* Local index variable */
- unsigned u; /* Local index variable */
+ int test_num = 0;
+ unsigned chunk_edge_size; /* Size of chunk's dataspace dimensions */
+ unsigned edge_size = 6; /* Size of dataset's dataspace dimensions */
+ unsigned small_rank; /* Current rank of small dataset */
+ unsigned large_rank; /* Current rank of large dataset */
+ uint16_t *cube_buf; /* Buffer for writing cube data */
+ uint16_t *zero_buf; /* Buffer for writing zeroed cube data */
+ uint16_t *cube_ptr; /* Temporary pointer into cube data */
+ unsigned max_rank = 5; /* Max. rank to use */
+ size_t max_cube_size; /* Max. number of elements in largest cube */
+ size_t s; /* Local index variable */
+ unsigned u; /* Local index variable */
/* Output message about test being performed */
MESSAGE(5, ("Testing Contiguous Hyperslabs With Different Rank I/O Functionality\n"));
/* Compute max. cube size */
max_cube_size = (size_t)1;
- for(u = 0; u < max_rank; u++)
+ for (u = 0; u < max_rank; u++)
max_cube_size *= (size_t)edge_size;
/* Allocate cube buffer for writing values */
@@ -2345,34 +2512,31 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist)
/* Initialize the cube buffer */
cube_ptr = cube_buf;
- for(s = 0; s < max_cube_size; s++)
+ for (s = 0; s < max_cube_size; s++)
*cube_ptr++ = (uint16_t)s;
/* Allocate cube buffer for zeroing values on disk */
zero_buf = (uint16_t *)HDcalloc(sizeof(uint16_t), max_cube_size);
CHECK_PTR(zero_buf, "HDcalloc");
- for(large_rank = 1; large_rank <= max_rank; large_rank++) {
- for(small_rank = 1; small_rank < large_rank; small_rank++) {
+ for (large_rank = 1; large_rank <= max_rank; large_rank++) {
+ for (small_rank = 1; small_rank < large_rank; small_rank++) {
chunk_edge_size = 0;
- test_select_hyper_contig_dr__run_test(test_num, cube_buf, zero_buf,
- edge_size, chunk_edge_size, small_rank, large_rank,
- dset_type, xfer_plist);
+ test_select_hyper_contig_dr__run_test(test_num, cube_buf, zero_buf, edge_size, chunk_edge_size,
+ small_rank, large_rank, dset_type, xfer_plist);
test_num++;
chunk_edge_size = 3;
- test_select_hyper_contig_dr__run_test(test_num, cube_buf, zero_buf,
- edge_size, chunk_edge_size, small_rank, large_rank,
- dset_type, xfer_plist);
+ test_select_hyper_contig_dr__run_test(test_num, cube_buf, zero_buf, edge_size, chunk_edge_size,
+ small_rank, large_rank, dset_type, xfer_plist);
test_num++;
} /* for loop on small rank */
- } /* for loop on large rank */
+ } /* for loop on large rank */
HDfree(cube_buf);
HDfree(zero_buf);
-} /* test_select_hyper_contig_dr() */
-
+} /* test_select_hyper_contig_dr() */
/****************************************************************
**
@@ -2395,22 +2559,22 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist)
**
****************************************************************/
static void
-test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
- unsigned tgt_n_cube_rank, unsigned edge_size, unsigned checker_edge_size,
- unsigned sel_rank, hsize_t sel_start[])
+test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, unsigned tgt_n_cube_rank,
+ unsigned edge_size, unsigned checker_edge_size,
+ unsigned sel_rank, hsize_t sel_start[])
{
- hbool_t first_selection = TRUE;
- unsigned n_cube_offset;
- unsigned sel_offset;
- hsize_t base_count;
- hsize_t offset_count;
- hsize_t start[SS_DR_MAX_RANK]; /* Offset of hyperslab selection */
- hsize_t stride[SS_DR_MAX_RANK]; /* Stride of hyperslab selection */
- hsize_t count[SS_DR_MAX_RANK]; /* Count of hyperslab selection */
- hsize_t block[SS_DR_MAX_RANK]; /* Block size of hyperslab selection */
- unsigned i, j, k, l, m; /* Local index variable */
- unsigned u; /* Local index variables */
- herr_t ret; /* Generic return value */
+ hbool_t first_selection = TRUE;
+ unsigned n_cube_offset;
+ unsigned sel_offset;
+ hsize_t base_count;
+ hsize_t offset_count;
+ hsize_t start[SS_DR_MAX_RANK]; /* Offset of hyperslab selection */
+ hsize_t stride[SS_DR_MAX_RANK]; /* Stride of hyperslab selection */
+ hsize_t count[SS_DR_MAX_RANK]; /* Count of hyperslab selection */
+ hsize_t block[SS_DR_MAX_RANK]; /* Block size of hyperslab selection */
+ unsigned i, j, k, l, m; /* Local index variable */
+ unsigned u; /* Local index variables */
+ herr_t ret; /* Generic return value */
HDassert(edge_size >= 6);
HDassert(0 < checker_edge_size);
@@ -2419,7 +2583,7 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
HDassert(sel_rank <= tgt_n_cube_rank);
HDassert(tgt_n_cube_rank <= SS_DR_MAX_RANK);
- sel_offset = SS_DR_MAX_RANK - sel_rank;
+ sel_offset = SS_DR_MAX_RANK - sel_rank;
n_cube_offset = SS_DR_MAX_RANK - tgt_n_cube_rank;
HDassert(n_cube_offset <= sel_offset);
@@ -2429,11 +2593,11 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
* offset).
*/
base_count = edge_size / (checker_edge_size * 2);
- if((edge_size % (checker_edge_size * 2)) > 0)
+ if ((edge_size % (checker_edge_size * 2)) > 0)
base_count++;
offset_count = (edge_size - checker_edge_size) / (checker_edge_size * 2);
- if(((edge_size - checker_edge_size) % (checker_edge_size * 2)) > 0)
+ if (((edge_size - checker_edge_size) % (checker_edge_size * 2)) > 0)
offset_count++;
/* Now set up the stride and block arrays, and portions of the start
@@ -2441,36 +2605,36 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
* the checker board.
*/
u = 0;
- while(u < n_cube_offset) {
+ while (u < n_cube_offset) {
/* these values should never be used */
- start[u] = 0;
+ start[u] = 0;
stride[u] = 0;
- count[u] = 0;
- block[u] = 0;
+ count[u] = 0;
+ block[u] = 0;
u++;
} /* end while */
- while(u < sel_offset) {
- start[u] = sel_start[u];
+ while (u < sel_offset) {
+ start[u] = sel_start[u];
stride[u] = 2 * edge_size;
- count[u] = 1;
- block[u] = 1;
+ count[u] = 1;
+ block[u] = 1;
u++;
} /* end while */
- while(u < SS_DR_MAX_RANK) {
+ while (u < SS_DR_MAX_RANK) {
stride[u] = 2 * checker_edge_size;
- block[u] = checker_edge_size;
+ block[u] = checker_edge_size;
u++;
} /* end while */
i = 0;
do {
- if(0 >= sel_offset) {
- if(i == 0) {
+ if (0 >= sel_offset) {
+ if (i == 0) {
start[0] = 0;
count[0] = base_count;
} /* end if */
@@ -2478,12 +2642,12 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
start[0] = checker_edge_size;
count[0] = offset_count;
} /* end else */
- } /* end if */
+ } /* end if */
j = 0;
do {
- if(1 >= sel_offset) {
- if(j == 0 ) {
+ if (1 >= sel_offset) {
+ if (j == 0) {
start[1] = 0;
count[1] = base_count;
} /* end if */
@@ -2491,12 +2655,12 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
start[1] = checker_edge_size;
count[1] = offset_count;
} /* end else */
- } /* end if */
+ } /* end if */
k = 0;
do {
- if(2 >= sel_offset) {
- if(k == 0) {
+ if (2 >= sel_offset) {
+ if (k == 0) {
start[2] = 0;
count[2] = base_count;
} /* end if */
@@ -2504,12 +2668,12 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
start[2] = checker_edge_size;
count[2] = offset_count;
} /* end else */
- } /* end if */
+ } /* end if */
l = 0;
do {
- if(3 >= sel_offset) {
- if(l == 0) {
+ if (3 >= sel_offset) {
+ if (l == 0) {
start[3] = 0;
count[3] = base_count;
} /* end if */
@@ -2517,12 +2681,12 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
start[3] = checker_edge_size;
count[3] = offset_count;
} /* end else */
- } /* end if */
+ } /* end if */
m = 0;
do {
- if(4 >= sel_offset) {
- if(m == 0) {
+ if (4 >= sel_offset) {
+ if (m == 0) {
start[4] = 0;
count[4] = base_count;
} /* end if */
@@ -2530,41 +2694,35 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
start[4] = checker_edge_size;
count[4] = offset_count;
} /* end else */
- } /* end if */
+ } /* end if */
- if(((i + j + k + l + m) % 2) == 0) {
- if(first_selection) {
+ if (((i + j + k + l + m) % 2) == 0) {
+ if (first_selection) {
first_selection = FALSE;
- ret = H5Sselect_hyperslab(tgt_n_cube_sid,
- H5S_SELECT_SET,
- &(start[n_cube_offset]),
- &(stride[n_cube_offset]),
- &(count[n_cube_offset]),
- &(block[n_cube_offset]));
+ ret = H5Sselect_hyperslab(tgt_n_cube_sid, H5S_SELECT_SET,
+ &(start[n_cube_offset]), &(stride[n_cube_offset]),
+ &(count[n_cube_offset]), &(block[n_cube_offset]));
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* end if */
else {
- ret = H5Sselect_hyperslab(tgt_n_cube_sid,
- H5S_SELECT_OR,
- &(start[n_cube_offset]),
- &(stride[n_cube_offset]),
- &(count[n_cube_offset]),
- &(block[n_cube_offset]));
+ ret = H5Sselect_hyperslab(tgt_n_cube_sid, H5S_SELECT_OR,
+ &(start[n_cube_offset]), &(stride[n_cube_offset]),
+ &(count[n_cube_offset]), &(block[n_cube_offset]));
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* end else */
- } /* end if */
+ } /* end if */
m++;
- } while((m <= 1) && (4 >= sel_offset));
+ } while ((m <= 1) && (4 >= sel_offset));
l++;
- } while((l <= 1) && (3 >= sel_offset));
+ } while ((l <= 1) && (3 >= sel_offset));
k++;
- } while((k <= 1) && (2 >= sel_offset));
+ } while ((k <= 1) && (2 >= sel_offset));
j++;
- } while((j <= 1) && (1 >= sel_offset));
+ } while ((j <= 1) && (1 >= sel_offset));
i++;
- } while((i <= 1) && (0 >= sel_offset));
+ } while ((i <= 1) && (0 >= sel_offset));
/* Wierdness alert:
*
@@ -2573,7 +2731,7 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
* code to manually clip the selection back to the dataspace
* proper.
*/
- for(u = 0; u < SS_DR_MAX_RANK; u++) {
+ for (u = 0; u < SS_DR_MAX_RANK; u++) {
start[u] = 0;
stride[u] = edge_size;
count[u] = 1;
@@ -2584,7 +2742,6 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* test_select_hyper_checker_board_dr__select_checker_board() */
-
/****************************************************************
**
** test_select_hyper_checker_board_dr__verify_data():
@@ -2628,18 +2785,18 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
**
****************************************************************/
H5_ATTR_PURE static hbool_t
-test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr,
- unsigned rank, unsigned edge_size, unsigned checker_edge_size,
- uint16_t first_expected_val, hbool_t buf_starts_in_checker)
+test_select_hyper_checker_board_dr__verify_data(uint16_t *buf_ptr, unsigned rank, unsigned edge_size,
+ unsigned checker_edge_size, uint16_t first_expected_val,
+ hbool_t buf_starts_in_checker)
{
- hbool_t good_data = TRUE;
- hbool_t in_checker;
- hbool_t start_in_checker[5];
- uint16_t expected_value;
- uint16_t * val_ptr;
- unsigned i, j, k, l, m; /* to track position in n-cube */
- unsigned v, w, x, y, z; /* to track position in checker */
- const unsigned test_max_rank = 5; /* code changes needed if this is increased */
+ hbool_t good_data = TRUE;
+ hbool_t in_checker;
+ hbool_t start_in_checker[5];
+ uint16_t expected_value;
+ uint16_t * val_ptr;
+ unsigned i, j, k, l, m; /* to track position in n-cube */
+ unsigned v, w, x, y, z; /* to track position in checker */
+ const unsigned test_max_rank = 5; /* code changes needed if this is increased */
HDassert(buf_ptr != NULL);
HDassert(0 < rank);
@@ -2649,60 +2806,60 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr,
HDassert(checker_edge_size <= edge_size);
HDassert(test_max_rank <= SS_DR_MAX_RANK);
- val_ptr = buf_ptr;
+ val_ptr = buf_ptr;
expected_value = first_expected_val;
- i = 0;
- v = 0;
+ i = 0;
+ v = 0;
start_in_checker[0] = buf_starts_in_checker;
do {
- if(v >= checker_edge_size) {
+ if (v >= checker_edge_size) {
start_in_checker[0] = !start_in_checker[0];
- v = 0;
+ v = 0;
} /* end if */
- j = 0;
- w = 0;
+ j = 0;
+ w = 0;
start_in_checker[1] = start_in_checker[0];
do {
- if(w >= checker_edge_size) {
+ if (w >= checker_edge_size) {
start_in_checker[1] = !start_in_checker[1];
- w = 0;
+ w = 0;
} /* end if */
- k = 0;
- x = 0;
+ k = 0;
+ x = 0;
start_in_checker[2] = start_in_checker[1];
do {
- if(x >= checker_edge_size) {
+ if (x >= checker_edge_size) {
start_in_checker[2] = !start_in_checker[2];
- x = 0;
+ x = 0;
} /* end if */
- l = 0;
- y = 0;
+ l = 0;
+ y = 0;
start_in_checker[3] = start_in_checker[2];
do {
- if(y >= checker_edge_size) {
- start_in_checker[3] = ! start_in_checker[3];
- y = 0;
+ if (y >= checker_edge_size) {
+ start_in_checker[3] = !start_in_checker[3];
+ y = 0;
} /* end if */
- m = 0;
- z = 0;
+ m = 0;
+ z = 0;
in_checker = start_in_checker[3];
do {
- if(z >= checker_edge_size) {
- in_checker = ! in_checker;
- z = 0;
+ if (z >= checker_edge_size) {
+ in_checker = !in_checker;
+ z = 0;
} /* end if */
- if(in_checker) {
- if(*val_ptr != expected_value)
+ if (in_checker) {
+ if (*val_ptr != expected_value)
good_data = FALSE;
} /* end if */
else {
- if(*val_ptr != 0)
+ if (*val_ptr != 0)
good_data = FALSE;
} /* end else */
@@ -2711,24 +2868,23 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr,
m++;
z++;
- } while((rank >= (test_max_rank - 4)) && (m < edge_size));
+ } while ((rank >= (test_max_rank - 4)) && (m < edge_size));
l++;
y++;
- } while((rank >= (test_max_rank - 3)) && (l < edge_size));
+ } while ((rank >= (test_max_rank - 3)) && (l < edge_size));
k++;
x++;
- } while((rank >= (test_max_rank - 2)) && (k < edge_size));
+ } while ((rank >= (test_max_rank - 2)) && (k < edge_size));
j++;
w++;
- } while((rank >= (test_max_rank - 1)) && (j < edge_size));
+ } while ((rank >= (test_max_rank - 1)) && (j < edge_size));
i++;
v++;
- } while((rank >= test_max_rank) && (i < edge_size));
+ } while ((rank >= test_max_rank) && (i < edge_size));
- return(good_data);
+ return (good_data);
} /* test_select_hyper_checker_board_dr__verify_data() */
-
/****************************************************************
**
** test_select_hyper_checker_board_dr__run_test(): Test H5S
@@ -2739,44 +2895,45 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr,
**
****************************************************************/
static void
-test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_buf,
- const uint16_t *zero_buf, unsigned edge_size, unsigned checker_edge_size,
- unsigned chunk_edge_size, unsigned small_rank, unsigned large_rank,
- hid_t dset_type, hid_t xfer_plist)
+test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_buf, const uint16_t *zero_buf,
+ unsigned edge_size, unsigned checker_edge_size,
+ unsigned chunk_edge_size, unsigned small_rank,
+ unsigned large_rank, hid_t dset_type, hid_t xfer_plist)
{
hbool_t data_ok;
- hid_t fapl; /* File access property list */
- hid_t fid; /* HDF5 File IDs */
- hid_t full_small_cube_sid; /* Dataspace for small cube w/all selection */
- hid_t mem_small_cube_sid;
- hid_t file_small_cube_sid;
- hid_t full_large_cube_sid; /* Dataspace for large cube w/all selection */
- hid_t mem_large_cube_sid;
- hid_t file_large_cube_sid;
- hid_t small_cube_dcpl_id = H5P_DEFAULT; /* DCPL for small cube dataset */
- hid_t large_cube_dcpl_id = H5P_DEFAULT; /* DCPL for large cube dataset */
- hid_t small_cube_dataset; /* Dataset ID */
- hid_t large_cube_dataset; /* Dataset ID */
- unsigned small_rank_offset; /* Rank offset of slice */
- const unsigned test_max_rank = 5; /* must update code if this changes */
- size_t start_index; /* Offset within buffer to begin inspecting */
- size_t stop_index; /* Offset within buffer to end inspecting */
- uint16_t expected_value;
- uint16_t * small_cube_buf_1;
- uint16_t * large_cube_buf_1;
- uint16_t * ptr_1;
- size_t small_cube_size; /* Number of elements in small cube */
- size_t large_cube_size; /* Number of elements in large cube */
+ hid_t fapl; /* File access property list */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t full_small_cube_sid; /* Dataspace for small cube w/all selection */
+ hid_t mem_small_cube_sid;
+ hid_t file_small_cube_sid;
+ hid_t full_large_cube_sid; /* Dataspace for large cube w/all selection */
+ hid_t mem_large_cube_sid;
+ hid_t file_large_cube_sid;
+ hid_t small_cube_dcpl_id = H5P_DEFAULT; /* DCPL for small cube dataset */
+ hid_t large_cube_dcpl_id = H5P_DEFAULT; /* DCPL for large cube dataset */
+ hid_t small_cube_dataset; /* Dataset ID */
+ hid_t large_cube_dataset; /* Dataset ID */
+ unsigned small_rank_offset; /* Rank offset of slice */
+ const unsigned test_max_rank = 5; /* must update code if this changes */
+ size_t start_index; /* Offset within buffer to begin inspecting */
+ size_t stop_index; /* Offset within buffer to end inspecting */
+ uint16_t expected_value;
+ uint16_t * small_cube_buf_1;
+ uint16_t * large_cube_buf_1;
+ uint16_t * ptr_1;
+ size_t small_cube_size; /* Number of elements in small cube */
+ size_t large_cube_size; /* Number of elements in large cube */
hsize_t dims[SS_DR_MAX_RANK];
hsize_t chunk_dims[SS_DR_MAX_RANK];
- hsize_t sel_start[SS_DR_MAX_RANK];
- unsigned u, v, w, x; /* Local index variables */
- size_t s; /* Local index variable */
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hsize_t sel_start[SS_DR_MAX_RANK];
+ unsigned u, v, w, x; /* Local index variables */
+ size_t s; /* Local index variable */
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
MESSAGE(7, ("\tn-cube slice through m-cube I/O test %d.\n", test_num));
- MESSAGE(7, ("\tranks = %d/%d, edge_size = %d, checker_edge_size = %d, chunk_edge_size = %d.\n", small_rank, large_rank, edge_size, checker_edge_size, chunk_edge_size));
+ MESSAGE(7, ("\tranks = %d/%d, edge_size = %d, checker_edge_size = %d, chunk_edge_size = %d.\n",
+ small_rank, large_rank, edge_size, checker_edge_size, chunk_edge_size));
HDassert(edge_size >= 6);
HDassert(checker_edge_size > 0);
@@ -2790,8 +2947,8 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* Compute cube sizes */
small_cube_size = large_cube_size = (size_t)1;
- for(u = 0; u < large_rank; u++) {
- if(u < small_rank)
+ for (u = 0; u < large_rank; u++) {
+ if (u < small_rank)
small_cube_size *= (size_t)edge_size;
large_cube_size *= (size_t)edge_size;
@@ -2807,14 +2964,12 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
*/
HDassert(large_cube_size < (size_t)(64 * 1024));
-
/* Allocate & initialize buffers */
small_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), small_cube_size);
CHECK_PTR(small_cube_buf_1, "HDcalloc");
large_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), large_cube_size);
CHECK_PTR(large_cube_buf_1, "HDcalloc");
-
/* Create a dataset transfer property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);
CHECK(fapl, FAIL, "H5Pcreate");
@@ -2831,11 +2986,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
-
/* setup dims: */
dims[0] = dims[1] = dims[2] = dims[3] = dims[4] = edge_size;
-
/* Create small cube dataspaces */
full_small_cube_sid = H5Screate_simple((int)small_rank, dims, NULL);
CHECK(full_small_cube_sid, FAIL, "H5Screate_simple");
@@ -2846,7 +2999,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
file_small_cube_sid = H5Screate_simple((int)small_rank, dims, NULL);
CHECK(file_small_cube_sid, FAIL, "H5Screate_simple");
-
/* Create large cube dataspace */
full_large_cube_sid = H5Screate_simple((int)large_rank, dims, NULL);
CHECK(full_large_cube_sid, FAIL, "H5Screate_simple");
@@ -2857,14 +3009,12 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
file_large_cube_sid = H5Screate_simple((int)large_rank, dims, NULL);
CHECK(file_large_cube_sid, FAIL, "H5Screate_simple");
-
/* if chunk edge size is greater than zero, set up the small and
* large data set creation property lists to specify chunked
* datasets.
*/
- if(chunk_edge_size > 0) {
- chunk_dims[0] = chunk_dims[1] =
- chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = chunk_edge_size;
+ if (chunk_edge_size > 0) {
+ chunk_dims[0] = chunk_dims[1] = chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = chunk_edge_size;
small_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
CHECK(small_cube_dcpl_id, FAIL, "H5Pcreate");
@@ -2875,7 +3025,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
ret = H5Pset_chunk(small_cube_dcpl_id, (int)small_rank, chunk_dims);
CHECK(ret, FAIL, "H5Pset_chunk");
-
large_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
CHECK(large_cube_dcpl_id, FAIL, "H5Pcreate");
@@ -2886,58 +3035,52 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
CHECK(ret, FAIL, "H5Pset_chunk");
} /* end if */
-
/* create the small cube dataset */
- small_cube_dataset = H5Dcreate2(fid, "small_cube_dataset", dset_type,
- file_small_cube_sid, H5P_DEFAULT, small_cube_dcpl_id, H5P_DEFAULT);
+ small_cube_dataset = H5Dcreate2(fid, "small_cube_dataset", dset_type, file_small_cube_sid, H5P_DEFAULT,
+ small_cube_dcpl_id, H5P_DEFAULT);
CHECK(small_cube_dataset, FAIL, "H5Dcreate2");
/* Close non-default small dataset DCPL */
- if(small_cube_dcpl_id != H5P_DEFAULT) {
+ if (small_cube_dcpl_id != H5P_DEFAULT) {
ret = H5Pclose(small_cube_dcpl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end if */
/* create the large cube dataset */
- large_cube_dataset = H5Dcreate2(fid, "large_cube_dataset", dset_type,
- file_large_cube_sid, H5P_DEFAULT, large_cube_dcpl_id, H5P_DEFAULT);
+ large_cube_dataset = H5Dcreate2(fid, "large_cube_dataset", dset_type, file_large_cube_sid, H5P_DEFAULT,
+ large_cube_dcpl_id, H5P_DEFAULT);
CHECK(large_cube_dataset, FAIL, "H5Dcreate2");
/* Close non-default large dataset DCPL */
- if(large_cube_dcpl_id != H5P_DEFAULT) {
+ if (large_cube_dcpl_id != H5P_DEFAULT) {
ret = H5Pclose(large_cube_dcpl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end if */
-
/* write initial data to the on disk datasets */
- ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid,
- full_small_cube_sid, xfer_plist, cube_buf);
+ ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid, full_small_cube_sid,
+ xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
- ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid,
- full_large_cube_sid, xfer_plist, cube_buf);
+ ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid, full_large_cube_sid,
+ xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
-
/* read initial small cube data from disk and verify that it is as expected. */
- ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid,
- full_small_cube_sid, xfer_plist, small_cube_buf_1);
+ ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid, full_small_cube_sid, xfer_plist,
+ small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
/* Check that the data is valid */
- verify_select_hyper_contig_dr__run_test(small_cube_buf_1, small_cube_size,
- edge_size, small_rank);
+ verify_select_hyper_contig_dr__run_test(small_cube_buf_1, small_cube_size, edge_size, small_rank);
/* read initial large cube data from disk and verify that it is as expected. */
- ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid,
- full_large_cube_sid, xfer_plist, large_cube_buf_1);
+ ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid, full_large_cube_sid, xfer_plist,
+ large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
/* Check that the data is valid */
- verify_select_hyper_contig_dr__run_test(large_cube_buf_1, large_cube_size,
- edge_size, large_rank);
-
+ verify_select_hyper_contig_dr__run_test(large_cube_buf_1, large_cube_size, edge_size, large_rank);
/* first, verify that we can read from disk correctly using selections
* of different rank that H5Sselect_shape_same() views as being of the
@@ -2953,12 +3096,8 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0;
- test_select_hyper_checker_board_dr__select_checker_board(mem_small_cube_sid,
- small_rank,
- edge_size,
- checker_edge_size,
- small_rank,
- sel_start);
+ test_select_hyper_checker_board_dr__select_checker_board(mem_small_cube_sid, small_rank, edge_size,
+ checker_edge_size, small_rank, sel_start);
/* now read slices from the large, on-disk cube into the small cube.
* Note how we adjust sel_start only in the dimensions peculiar to the
@@ -2967,22 +3106,22 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
u = 0;
do {
- if(small_rank_offset > 0)
+ if (small_rank_offset > 0)
sel_start[0] = u;
v = 0;
do {
- if(small_rank_offset > 1)
+ if (small_rank_offset > 1)
sel_start[1] = v;
w = 0;
do {
- if(small_rank_offset > 2)
+ if (small_rank_offset > 2)
sel_start[2] = w;
x = 0;
do {
- if(small_rank_offset > 3)
+ if (small_rank_offset > 3)
sel_start[3] = x;
/* we know that small_rank >= 1 and that large_rank > small_rank
@@ -2996,15 +3135,8 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDassert((sel_start[3] == 0) || (3 < small_rank_offset));
HDassert((sel_start[4] == 0) || (4 < small_rank_offset));
- test_select_hyper_checker_board_dr__select_checker_board
- (
- file_large_cube_sid,
- large_rank,
- edge_size,
- checker_edge_size,
- small_rank,
- sel_start
- );
+ test_select_hyper_checker_board_dr__select_checker_board(
+ file_large_cube_sid, large_rank, edge_size, checker_edge_size, small_rank, sel_start);
/* verify that H5Sselect_shape_same() reports the two
* selections as having the same shape.
@@ -3016,45 +3148,31 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDmemset(small_cube_buf_1, 0, sizeof(*small_cube_buf_1) * small_cube_size);
/* Read selection from disk */
- ret = H5Dread(large_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_small_cube_sid,
- file_large_cube_sid,
- xfer_plist,
- small_cube_buf_1);
+ ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, mem_small_cube_sid,
+ file_large_cube_sid, xfer_plist, small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
- expected_value = (uint16_t)
- ((u * edge_size * edge_size * edge_size * edge_size) +
- (v * edge_size * edge_size * edge_size) +
- (w * edge_size * edge_size) +
- (x * edge_size));
-
- data_ok = test_select_hyper_checker_board_dr__verify_data
- (
- small_cube_buf_1,
- small_rank,
- edge_size,
- checker_edge_size,
- expected_value,
- (hbool_t)TRUE
- );
- if(!data_ok)
- TestErrPrintf("small cube read from largecube has bad data! Line=%d\n",__LINE__);
+ expected_value = (uint16_t)((u * edge_size * edge_size * edge_size * edge_size) +
+ (v * edge_size * edge_size * edge_size) +
+ (w * edge_size * edge_size) + (x * edge_size));
+
+ data_ok = test_select_hyper_checker_board_dr__verify_data(small_cube_buf_1, small_rank,
+ edge_size, checker_edge_size,
+ expected_value, (hbool_t)TRUE);
+ if (!data_ok)
+ TestErrPrintf("small cube read from largecube has bad data! Line=%d\n", __LINE__);
x++;
- } while((large_rank >= (test_max_rank - 3)) &&
- (small_rank <= (test_max_rank - 4)) && (x < edge_size));
+ } while ((large_rank >= (test_max_rank - 3)) && (small_rank <= (test_max_rank - 4)) &&
+ (x < edge_size));
w++;
- } while((large_rank >= (test_max_rank - 2)) &&
- (small_rank <= (test_max_rank - 3)) && (w < edge_size));
+ } while ((large_rank >= (test_max_rank - 2)) && (small_rank <= (test_max_rank - 3)) &&
+ (w < edge_size));
v++;
- } while((large_rank >= (test_max_rank - 1)) &&
- (small_rank <= (test_max_rank - 2)) && (v < edge_size));
+ } while ((large_rank >= (test_max_rank - 1)) && (small_rank <= (test_max_rank - 2)) &&
+ (v < edge_size));
u++;
- } while((large_rank >= test_max_rank) &&
- (small_rank <= (test_max_rank - 1)) && (u < edge_size));
-
+ } while ((large_rank >= test_max_rank) && (small_rank <= (test_max_rank - 1)) && (u < edge_size));
/* similarly, read the on disk small cube into slices through the in memory
* large cube, and verify that the correct data (and only the correct data)
@@ -3063,32 +3181,27 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* select a checker board in the file small cube dataspace */
sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0;
- test_select_hyper_checker_board_dr__select_checker_board(file_small_cube_sid,
- small_rank,
- edge_size,
- checker_edge_size,
- small_rank,
- sel_start);
-
+ test_select_hyper_checker_board_dr__select_checker_board(file_small_cube_sid, small_rank, edge_size,
+ checker_edge_size, small_rank, sel_start);
u = 0;
do {
- if(0 < small_rank_offset)
+ if (0 < small_rank_offset)
sel_start[0] = u;
v = 0;
do {
- if(1 < small_rank_offset)
+ if (1 < small_rank_offset)
sel_start[1] = v;
w = 0;
do {
- if(2 < small_rank_offset)
+ if (2 < small_rank_offset)
sel_start[2] = w;
x = 0;
do {
- if(3 < small_rank_offset)
+ if (3 < small_rank_offset)
sel_start[3] = x;
/* we know that small_rank >= 1 and that large_rank > small_rank
@@ -3102,15 +3215,8 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDassert((sel_start[3] == 0) || (3 < small_rank_offset));
HDassert((sel_start[4] == 0) || (4 < small_rank_offset));
- test_select_hyper_checker_board_dr__select_checker_board
- (
- mem_large_cube_sid,
- large_rank,
- edge_size,
- checker_edge_size,
- small_rank,
- sel_start
- );
+ test_select_hyper_checker_board_dr__select_checker_board(
+ mem_large_cube_sid, large_rank, edge_size, checker_edge_size, small_rank, sel_start);
/* verify that H5Sselect_shape_same() reports the two
* selections as having the same shape.
@@ -3118,52 +3224,38 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
check = H5Sselect_shape_same(file_small_cube_sid, mem_large_cube_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
-
/* zero out the in memory large cube */
HDmemset(large_cube_buf_1, 0, sizeof(*large_cube_buf_1) * large_cube_size);
/* Read selection from disk */
- ret = H5Dread(small_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_large_cube_sid,
- file_small_cube_sid,
- xfer_plist,
- large_cube_buf_1);
+ ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid,
+ file_small_cube_sid, xfer_plist, large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
-
/* verify that the expected data and only the
* expected data was read.
*/
- data_ok = TRUE;
- ptr_1 = large_cube_buf_1;
+ data_ok = TRUE;
+ ptr_1 = large_cube_buf_1;
expected_value = 0;
- start_index = (u * edge_size * edge_size * edge_size * edge_size) +
- (v * edge_size * edge_size * edge_size) +
- (w * edge_size * edge_size) +
+ start_index = (u * edge_size * edge_size * edge_size * edge_size) +
+ (v * edge_size * edge_size * edge_size) + (w * edge_size * edge_size) +
(x * edge_size);
stop_index = start_index + small_cube_size - 1;
- HDassert( start_index < stop_index );
- HDassert( stop_index <= large_cube_size );
+ HDassert(start_index < stop_index);
+ HDassert(stop_index <= large_cube_size);
/* verify that the large cube contains only zeros before the slice */
- for(s = 0; s < start_index; s++) {
- if(*ptr_1 != 0)
+ for (s = 0; s < start_index; s++) {
+ if (*ptr_1 != 0)
data_ok = FALSE;
ptr_1++;
} /* end for */
HDassert(s == start_index);
- data_ok &= test_select_hyper_checker_board_dr__verify_data
- (
- ptr_1,
- small_rank,
- edge_size,
- checker_edge_size,
- (uint16_t)0,
- (hbool_t)TRUE
- );
+ data_ok &= test_select_hyper_checker_board_dr__verify_data(
+ ptr_1, small_rank, edge_size, checker_edge_size, (uint16_t)0, (hbool_t)TRUE);
ptr_1 += small_cube_size;
s += small_cube_size;
@@ -3171,27 +3263,25 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDassert(s == stop_index + 1);
/* verify that the large cube contains only zeros after the slice */
- for(s = stop_index + 1; s < large_cube_size; s++) {
- if(*ptr_1 != 0)
+ for (s = stop_index + 1; s < large_cube_size; s++) {
+ if (*ptr_1 != 0)
data_ok = FALSE;
ptr_1++;
} /* end for */
- if(!data_ok)
- TestErrPrintf("large cube read from small cube has bad data! Line=%d\n",__LINE__);
+ if (!data_ok)
+ TestErrPrintf("large cube read from small cube has bad data! Line=%d\n", __LINE__);
x++;
- } while((large_rank >= (test_max_rank - 3)) &&
- (small_rank <= (test_max_rank - 4)) && (x < edge_size));
+ } while ((large_rank >= (test_max_rank - 3)) && (small_rank <= (test_max_rank - 4)) &&
+ (x < edge_size));
w++;
- } while((large_rank >= (test_max_rank - 2)) &&
- (small_rank <= (test_max_rank - 3)) && (w < edge_size));
+ } while ((large_rank >= (test_max_rank - 2)) && (small_rank <= (test_max_rank - 3)) &&
+ (w < edge_size));
v++;
- } while((large_rank >= (test_max_rank - 1)) &&
- (small_rank <= (test_max_rank - 2)) && (v < edge_size));
+ } while ((large_rank >= (test_max_rank - 1)) && (small_rank <= (test_max_rank - 2)) &&
+ (v < edge_size));
u++;
- } while((large_rank >= test_max_rank) &&
- (small_rank <= (test_max_rank - 1)) && (u < edge_size));
-
+ } while ((large_rank >= test_max_rank) && (small_rank <= (test_max_rank - 1)) && (u < edge_size));
/* now we go in the opposite direction, verifying that we can write
* from memory to file using selections of different rank that
@@ -3206,43 +3296,34 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* select a checker board in the file small cube dataspace */
sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0;
- test_select_hyper_checker_board_dr__select_checker_board(file_small_cube_sid,
- small_rank,
- edge_size,
- checker_edge_size,
- small_rank,
- sel_start);
+ test_select_hyper_checker_board_dr__select_checker_board(file_small_cube_sid, small_rank, edge_size,
+ checker_edge_size, small_rank, sel_start);
u = 0;
do {
- if(small_rank_offset > 0)
+ if (small_rank_offset > 0)
sel_start[0] = u;
v = 0;
do {
- if(small_rank_offset > 1)
+ if (small_rank_offset > 1)
sel_start[1] = v;
w = 0;
do {
- if(small_rank_offset > 2)
+ if (small_rank_offset > 2)
sel_start[2] = w;
x = 0;
do {
- if(small_rank_offset > 3)
+ if (small_rank_offset > 3)
sel_start[3] = x;
/* zero out the on disk small cube */
- ret = H5Dwrite(small_cube_dataset,
- H5T_NATIVE_UINT16,
- full_small_cube_sid,
- full_small_cube_sid,
- xfer_plist,
- zero_buf);
+ ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid,
+ full_small_cube_sid, xfer_plist, zero_buf);
CHECK(ret, FAIL, "H5Dwrite");
-
/* we know that small_rank >= 1 and that large_rank > small_rank
* by the assertions at the head of this function. Thus no
* need for another inner loop.
@@ -3254,15 +3335,8 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDassert((sel_start[3] == 0) || (3 < small_rank_offset));
HDassert((sel_start[4] == 0) || (4 < small_rank_offset));
- test_select_hyper_checker_board_dr__select_checker_board
- (
- mem_large_cube_sid,
- large_rank,
- edge_size,
- checker_edge_size,
- small_rank,
- sel_start
- );
+ test_select_hyper_checker_board_dr__select_checker_board(
+ mem_large_cube_sid, large_rank, edge_size, checker_edge_size, small_rank, sel_start);
/* verify that H5Sselect_shape_same() reports the two
* selections as having the same shape.
@@ -3270,62 +3344,42 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
check = H5Sselect_shape_same(file_small_cube_sid, mem_large_cube_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
-
- /* write the slice from the in memory large cube to the
+ /* write the slice from the in memory large cube to the
* on disk small cube
*/
- ret = H5Dwrite(small_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_large_cube_sid,
- file_small_cube_sid,
- xfer_plist,
- cube_buf);
+ ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid,
+ file_small_cube_sid, xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
-
/* zero the buffer that we will be using for reading */
HDmemset(small_cube_buf_1, 0, sizeof(*small_cube_buf_1) * small_cube_size);
/* read the on disk small cube into memory */
- ret = H5Dread(small_cube_dataset,
- H5T_NATIVE_UINT16,
- full_small_cube_sid,
- full_small_cube_sid,
- xfer_plist,
- small_cube_buf_1);
+ ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid,
+ full_small_cube_sid, xfer_plist, small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
- expected_value = (uint16_t)
- ((u * edge_size * edge_size * edge_size * edge_size) +
- (v * edge_size * edge_size * edge_size) +
- (w * edge_size * edge_size) +
- (x * edge_size));
-
- data_ok = test_select_hyper_checker_board_dr__verify_data
- (
- small_cube_buf_1,
- small_rank,
- edge_size,
- checker_edge_size,
- expected_value,
- (hbool_t)TRUE
- );
- if(!data_ok)
- TestErrPrintf("small cube read from largecube has bad data! Line=%d\n",__LINE__);
+ expected_value = (uint16_t)((u * edge_size * edge_size * edge_size * edge_size) +
+ (v * edge_size * edge_size * edge_size) +
+ (w * edge_size * edge_size) + (x * edge_size));
+
+ data_ok = test_select_hyper_checker_board_dr__verify_data(small_cube_buf_1, small_rank,
+ edge_size, checker_edge_size,
+ expected_value, (hbool_t)TRUE);
+ if (!data_ok)
+ TestErrPrintf("small cube read from largecube has bad data! Line=%d\n", __LINE__);
x++;
- } while((large_rank >= (test_max_rank - 3)) &&
- (small_rank <= (test_max_rank - 4)) && (x < edge_size));
+ } while ((large_rank >= (test_max_rank - 3)) && (small_rank <= (test_max_rank - 4)) &&
+ (x < edge_size));
w++;
- } while((large_rank >= (test_max_rank - 2)) &&
- (small_rank <= (test_max_rank - 3)) && (w < edge_size));
+ } while ((large_rank >= (test_max_rank - 2)) && (small_rank <= (test_max_rank - 3)) &&
+ (w < edge_size));
v++;
- } while((large_rank >= (test_max_rank - 1)) &&
- (small_rank <= (test_max_rank - 2)) && (v < edge_size));
+ } while ((large_rank >= (test_max_rank - 1)) && (small_rank <= (test_max_rank - 2)) &&
+ (v < edge_size));
u++;
- } while((large_rank >= test_max_rank) &&
- (small_rank <= (test_max_rank - 1)) && (u < edge_size));
-
+ } while ((large_rank >= test_max_rank) && (small_rank <= (test_max_rank - 1)) && (u < edge_size));
/* Now write checker board selections of the entries in memory
* small cube to slices of the on disk cube. After each write,
@@ -3337,40 +3391,32 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* select a checker board in the in memory small cube dataspace */
sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0;
- test_select_hyper_checker_board_dr__select_checker_board(mem_small_cube_sid,
- small_rank,
- edge_size,
- checker_edge_size,
- small_rank,
- sel_start);
+ test_select_hyper_checker_board_dr__select_checker_board(mem_small_cube_sid, small_rank, edge_size,
+ checker_edge_size, small_rank, sel_start);
u = 0;
do {
- if(small_rank_offset > 0)
+ if (small_rank_offset > 0)
sel_start[0] = u;
v = 0;
do {
- if(small_rank_offset > 1)
+ if (small_rank_offset > 1)
sel_start[1] = v;
w = 0;
do {
- if(small_rank_offset > 2)
+ if (small_rank_offset > 2)
sel_start[2] = w;
x = 0;
do {
- if(small_rank_offset > 3)
+ if (small_rank_offset > 3)
sel_start[3] = x;
/* zero out the on disk cube */
- ret = H5Dwrite(large_cube_dataset,
- H5T_NATIVE_USHORT,
- full_large_cube_sid,
- full_large_cube_sid,
- xfer_plist,
- zero_buf);
+ ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_USHORT, full_large_cube_sid,
+ full_large_cube_sid, xfer_plist, zero_buf);
CHECK(ret, FAIL, "H5Dwrite");
/* we know that small_rank >= 1 and that large_rank > small_rank
@@ -3384,16 +3430,8 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDassert((sel_start[3] == 0) || (3 < small_rank_offset));
HDassert((sel_start[4] == 0) || (4 < small_rank_offset));
-
- test_select_hyper_checker_board_dr__select_checker_board
- (
- file_large_cube_sid,
- large_rank,
- edge_size,
- checker_edge_size,
- small_rank,
- sel_start
- );
+ test_select_hyper_checker_board_dr__select_checker_board(
+ file_large_cube_sid, large_rank, edge_size, checker_edge_size, small_rank, sel_start);
/* verify that H5Sselect_shape_same() reports the two
* selections as having the same shape.
@@ -3401,67 +3439,48 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
check = H5Sselect_shape_same(file_large_cube_sid, mem_small_cube_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
-
- /* write the checker board selection of the in memory
+ /* write the checker board selection of the in memory
* small cube to a slice through the on disk large
* cube.
*/
- ret = H5Dwrite(large_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_small_cube_sid,
- file_large_cube_sid,
- xfer_plist,
- cube_buf);
+ ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, mem_small_cube_sid,
+ file_large_cube_sid, xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
-
/* zero out the in memory large cube */
HDmemset(large_cube_buf_1, 0, sizeof(*large_cube_buf_1) * large_cube_size);
/* read the on disk large cube into memory */
- ret = H5Dread(large_cube_dataset,
- H5T_NATIVE_UINT16,
- full_large_cube_sid,
- full_large_cube_sid,
- xfer_plist,
- large_cube_buf_1);
+ ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid,
+ full_large_cube_sid, xfer_plist, large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
-
/* verify that the expected data and only the
* expected data was written to the on disk large
* cube.
*/
- data_ok = TRUE;
- ptr_1 = large_cube_buf_1;
+ data_ok = TRUE;
+ ptr_1 = large_cube_buf_1;
expected_value = 0;
- start_index = (u * edge_size * edge_size * edge_size * edge_size) +
- (v * edge_size * edge_size * edge_size) +
- (w * edge_size * edge_size) +
+ start_index = (u * edge_size * edge_size * edge_size * edge_size) +
+ (v * edge_size * edge_size * edge_size) + (w * edge_size * edge_size) +
(x * edge_size);
stop_index = start_index + small_cube_size - 1;
- HDassert( start_index < stop_index );
- HDassert( stop_index <= large_cube_size );
+ HDassert(start_index < stop_index);
+ HDassert(stop_index <= large_cube_size);
/* verify that the large cube contains only zeros before the slice */
- for(s = 0; s < start_index; s++) {
- if(*ptr_1 != 0)
+ for (s = 0; s < start_index; s++) {
+ if (*ptr_1 != 0)
data_ok = FALSE;
ptr_1++;
} /* end for */
HDassert(s == start_index);
/* verify that the slice contains the expected data */
- data_ok &= test_select_hyper_checker_board_dr__verify_data
- (
- ptr_1,
- small_rank,
- edge_size,
- checker_edge_size,
- (uint16_t)0,
- (hbool_t)TRUE
- );
+ data_ok &= test_select_hyper_checker_board_dr__verify_data(
+ ptr_1, small_rank, edge_size, checker_edge_size, (uint16_t)0, (hbool_t)TRUE);
ptr_1 += small_cube_size;
s += small_cube_size;
@@ -3469,27 +3488,25 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDassert(s == stop_index + 1);
/* verify that the large cube contains only zeros after the slice */
- for(s = stop_index + 1; s < large_cube_size; s++) {
- if(*ptr_1 != 0)
+ for (s = stop_index + 1; s < large_cube_size; s++) {
+ if (*ptr_1 != 0)
data_ok = FALSE;
ptr_1++;
} /* end for */
- if(!data_ok)
- TestErrPrintf("large cube written from small cube has bad data! Line=%d\n",__LINE__);
+ if (!data_ok)
+ TestErrPrintf("large cube written from small cube has bad data! Line=%d\n", __LINE__);
x++;
- } while((large_rank >= (test_max_rank - 3)) &&
- (small_rank <= (test_max_rank - 4)) && (x < edge_size));
+ } while ((large_rank >= (test_max_rank - 3)) && (small_rank <= (test_max_rank - 4)) &&
+ (x < edge_size));
w++;
- } while((large_rank >= (test_max_rank - 2)) &&
- (small_rank <= (test_max_rank - 3)) && (w < edge_size));
+ } while ((large_rank >= (test_max_rank - 2)) && (small_rank <= (test_max_rank - 3)) &&
+ (w < edge_size));
v++;
- } while((large_rank >= (test_max_rank - 1)) &&
- (small_rank <= (test_max_rank - 2)) && (v < edge_size));
+ } while ((large_rank >= (test_max_rank - 1)) && (small_rank <= (test_max_rank - 2)) &&
+ (v < edge_size));
u++;
- } while((large_rank >= test_max_rank) &&
- (small_rank <= (test_max_rank - 1)) && (u < edge_size));
-
+ } while ((large_rank >= test_max_rank) && (small_rank <= (test_max_rank - 1)) && (u < edge_size));
/* Close memory dataspaces */
ret = H5Sclose(full_small_cube_sid);
@@ -3504,7 +3521,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
ret = H5Sclose(mem_large_cube_sid);
CHECK(ret, FAIL, "H5Sclose");
-
/* Close disk dataspace */
ret = H5Sclose(file_small_cube_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -3527,8 +3543,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDfree(small_cube_buf_1);
HDfree(large_cube_buf_1);
-} /* test_select_hyper_checker_board_dr__run_test() */
-
+} /* test_select_hyper_checker_board_dr__run_test() */
/****************************************************************
**
@@ -3545,26 +3560,26 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
static void
test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist)
{
- uint16_t *cube_buf; /* Buffer for writing cube data */
- uint16_t *cube_ptr; /* Temporary pointer into cube data */
- uint16_t *zero_buf; /* Buffer for writing zeroed cube data */
- int test_num = 0;
- unsigned checker_edge_size = 2; /* Size of checkerboard dimension */
- unsigned chunk_edge_size; /* Size of chunk's dataspace dimensions */
- unsigned edge_size = 6; /* Size of dataset's dataspace dimensions */
- unsigned small_rank; /* Current rank of small dataset */
- unsigned large_rank; /* Current rank of large dataset */
- unsigned max_rank = 5; /* Max. rank to use */
- size_t max_cube_size; /* Max. number of elements in largest cube */
- size_t s; /* Local index variable */
- unsigned u; /* Local index variable */
+ uint16_t *cube_buf; /* Buffer for writing cube data */
+ uint16_t *cube_ptr; /* Temporary pointer into cube data */
+ uint16_t *zero_buf; /* Buffer for writing zeroed cube data */
+ int test_num = 0;
+ unsigned checker_edge_size = 2; /* Size of checkerboard dimension */
+ unsigned chunk_edge_size; /* Size of chunk's dataspace dimensions */
+ unsigned edge_size = 6; /* Size of dataset's dataspace dimensions */
+ unsigned small_rank; /* Current rank of small dataset */
+ unsigned large_rank; /* Current rank of large dataset */
+ unsigned max_rank = 5; /* Max. rank to use */
+ size_t max_cube_size; /* Max. number of elements in largest cube */
+ size_t s; /* Local index variable */
+ unsigned u; /* Local index variable */
/* Output message about test being performed */
MESSAGE(5, ("Testing Checker Board Hyperslabs With Different Rank I/O Functionality\n"));
/* Compute max. cube size */
max_cube_size = (size_t)1;
- for(u = 0; u < max_rank; u++)
+ for (u = 0; u < max_rank; u++)
max_cube_size *= (size_t)(edge_size + 1);
/* Allocate cube buffer for writing values */
@@ -3573,47 +3588,43 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist)
/* Initialize the cube buffer */
cube_ptr = cube_buf;
- for(s = 0; s < max_cube_size; s++)
+ for (s = 0; s < max_cube_size; s++)
*cube_ptr++ = (uint16_t)s;
/* Allocate cube buffer for zeroing values on disk */
zero_buf = (uint16_t *)HDcalloc(sizeof(uint16_t), max_cube_size);
CHECK_PTR(zero_buf, "HDcalloc");
- for(large_rank = 1; large_rank <= max_rank; large_rank++) {
- for(small_rank = 1; small_rank < large_rank; small_rank++) {
+ for (large_rank = 1; large_rank <= max_rank; large_rank++) {
+ for (small_rank = 1; small_rank < large_rank; small_rank++) {
chunk_edge_size = 0;
- test_select_hyper_checker_board_dr__run_test(test_num, cube_buf,
- zero_buf, edge_size, checker_edge_size, chunk_edge_size, small_rank,
- large_rank, dset_type, xfer_plist);
+ test_select_hyper_checker_board_dr__run_test(test_num, cube_buf, zero_buf, edge_size,
+ checker_edge_size, chunk_edge_size, small_rank,
+ large_rank, dset_type, xfer_plist);
test_num++;
- test_select_hyper_checker_board_dr__run_test(test_num, cube_buf,
- zero_buf,
- edge_size + 1, checker_edge_size, chunk_edge_size, small_rank,
- large_rank, dset_type, xfer_plist);
+ test_select_hyper_checker_board_dr__run_test(test_num, cube_buf, zero_buf, edge_size + 1,
+ checker_edge_size, chunk_edge_size, small_rank,
+ large_rank, dset_type, xfer_plist);
test_num++;
chunk_edge_size = 3;
- test_select_hyper_checker_board_dr__run_test(test_num, cube_buf,
- zero_buf,
- edge_size, checker_edge_size, chunk_edge_size, small_rank,
- large_rank, dset_type, xfer_plist);
+ test_select_hyper_checker_board_dr__run_test(test_num, cube_buf, zero_buf, edge_size,
+ checker_edge_size, chunk_edge_size, small_rank,
+ large_rank, dset_type, xfer_plist);
test_num++;
- test_select_hyper_checker_board_dr__run_test(test_num, cube_buf,
- zero_buf,
- edge_size + 1, checker_edge_size, chunk_edge_size, small_rank,
- large_rank, dset_type, xfer_plist);
+ test_select_hyper_checker_board_dr__run_test(test_num, cube_buf, zero_buf, edge_size + 1,
+ checker_edge_size, chunk_edge_size, small_rank,
+ large_rank, dset_type, xfer_plist);
test_num++;
} /* for loop on small rank */
- } /* for loop on large rank */
+ } /* for loop on large rank */
HDfree(cube_buf);
HDfree(zero_buf);
-} /* test_select_hyper_checker_board_dr() */
-
+} /* test_select_hyper_checker_board_dr() */
/****************************************************************
**
@@ -3624,22 +3635,22 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist)
static void
test_select_hyper_copy(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t data1,data2; /* Dataset IDs */
- hid_t sid1,sid2,sid3; /* Dataspace IDs */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- uint16_t *wbuf, /* buffer to write to disk */
- *rbuf, /* 1st buffer read from disk */
- *rbuf2, /* 2nd buffer read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t data1, data2; /* Dataset IDs */
+ hid_t sid1, sid2, sid3; /* Dataspace IDs */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ uint16_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* 1st buffer read from disk */
+ *rbuf2, /* 2nd buffer read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n"));
@@ -3653,9 +3664,9 @@ test_select_hyper_copy(void)
CHECK_PTR(rbuf2, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint16_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint16_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3670,19 +3681,31 @@ test_select_hyper_copy(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x3x3 count with a stride of 2x4x3 & 1x2x2 block hyperslab for disk dataset */
- start[0] = 0; start[1] = 0; start[2] = 0;
- stride[0] = 2; stride[1] = 4; stride[2] = 3;
- count[0] = 2; count[1] = 3; count[2] = 3;
- block[0] = 1; block[1] = 2; block[2] = 2;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 2;
+ stride[1] = 4;
+ stride[2] = 3;
+ count[0] = 2;
+ count[1] = 3;
+ count[2] = 3;
+ block[0] = 1;
+ block[1] = 2;
+ block[2] = 2;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 4x2 count with a stride of 5x5 & 3x3 block hyperslab for memory dataset */
- start[0] = 1; start[1] = 1;
- stride[0] = 5; stride[1] = 5;
- count[0] = 4; count[1] = 2;
- block[0] = 3; block[1] = 3;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 1;
+ start[1] = 1;
+ stride[0] = 5;
+ stride[1] = 5;
+ count[0] = 4;
+ count[1] = 2;
+ block[0] = 3;
+ block[1] = 3;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Make a copy of the dataspace to write */
@@ -3718,11 +3741,15 @@ test_select_hyper_copy(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 3x4 count with a stride of 4x4 & 2x3 block hyperslab for memory dataset */
- start[0] = 0; start[1] = 0;
- stride[0] = 4; stride[1] = 4;
- count[0] = 3; count[1] = 4;
- block[0] = 2; block[1] = 3;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 4;
+ stride[1] = 4;
+ count[0] = 3;
+ count[1] = 4;
+ block[0] = 2;
+ block[1] = 3;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Make a copy of the dataspace to read */
@@ -3730,16 +3757,16 @@ test_select_hyper_copy(void)
CHECK(sid3, FAIL, "H5Scopy");
/* Read selection from disk */
- ret=H5Dread(data1,H5T_STD_U16LE,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(data1, H5T_STD_U16LE, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Read selection from disk */
- ret=H5Dread(data2,H5T_STD_U16LE,sid3,sid1,H5P_DEFAULT,rbuf2);
+ ret = H5Dread(data2, H5T_STD_U16LE, sid3, sid1, H5P_DEFAULT, rbuf2);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2))
- TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__);
+ if (HDmemcmp(rbuf, rbuf2, sizeof(uint16_t) * SPACE3_DIM1 * SPACE3_DIM2))
+ TestErrPrintf("hyperslab values don't match! Line=%d\n", __LINE__);
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -3769,7 +3796,7 @@ test_select_hyper_copy(void)
HDfree(wbuf);
HDfree(rbuf);
HDfree(rbuf2);
-} /* test_select_hyper_copy() */
+} /* test_select_hyper_copy() */
/****************************************************************
**
@@ -3780,21 +3807,21 @@ test_select_hyper_copy(void)
static void
test_select_point_copy(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t data1,data2; /* Dataset IDs */
- hid_t sid1,sid2,sid3; /* Dataspace IDs */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- uint16_t *wbuf, /* buffer to write to disk */
- *rbuf, /* 1st buffer read from disk */
- *rbuf2, /* 2nd buffer read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t data1, data2; /* Dataset IDs */
+ hid_t sid1, sid2, sid3; /* Dataspace IDs */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ uint16_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* 1st buffer read from disk */
+ *rbuf2, /* 2nd buffer read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n"));
@@ -3808,9 +3835,9 @@ test_select_point_copy(void)
CHECK_PTR(rbuf2, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint16_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint16_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3825,31 +3852,61 @@ test_select_point_copy(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select sequence of ten points for disk dataset */
- coord1[0][0]=0; coord1[0][1]=10; coord1[0][2]= 5;
- coord1[1][0]=1; coord1[1][1]= 2; coord1[1][2]= 7;
- coord1[2][0]=2; coord1[2][1]= 4; coord1[2][2]= 9;
- coord1[3][0]=0; coord1[3][1]= 6; coord1[3][2]=11;
- coord1[4][0]=1; coord1[4][1]= 8; coord1[4][2]=13;
- coord1[5][0]=2; coord1[5][1]=12; coord1[5][2]= 0;
- coord1[6][0]=0; coord1[6][1]=14; coord1[6][2]= 2;
- coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4;
- coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6;
- coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8;
- ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ coord1[0][0] = 0;
+ coord1[0][1] = 10;
+ coord1[0][2] = 5;
+ coord1[1][0] = 1;
+ coord1[1][1] = 2;
+ coord1[1][2] = 7;
+ coord1[2][0] = 2;
+ coord1[2][1] = 4;
+ coord1[2][2] = 9;
+ coord1[3][0] = 0;
+ coord1[3][1] = 6;
+ coord1[3][2] = 11;
+ coord1[4][0] = 1;
+ coord1[4][1] = 8;
+ coord1[4][2] = 13;
+ coord1[5][0] = 2;
+ coord1[5][1] = 12;
+ coord1[5][2] = 0;
+ coord1[6][0] = 0;
+ coord1[6][1] = 14;
+ coord1[6][2] = 2;
+ coord1[7][0] = 1;
+ coord1[7][1] = 0;
+ coord1[7][2] = 4;
+ coord1[8][0] = 2;
+ coord1[8][1] = 1;
+ coord1[8][2] = 6;
+ coord1[9][0] = 0;
+ coord1[9][1] = 3;
+ coord1[9][2] = 8;
+ ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Select sequence of ten points for write dataset */
- coord2[0][0]=12; coord2[0][1]= 3;
- coord2[1][0]=15; coord2[1][1]=13;
- coord2[2][0]= 7; coord2[2][1]=25;
- coord2[3][0]= 0; coord2[3][1]= 6;
- coord2[4][0]=13; coord2[4][1]= 0;
- coord2[5][0]=24; coord2[5][1]=11;
- coord2[6][0]=12; coord2[6][1]=21;
- coord2[7][0]=29; coord2[7][1]= 4;
- coord2[8][0]= 8; coord2[8][1]= 8;
- coord2[9][0]=19; coord2[9][1]=17;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
+ coord2[0][0] = 12;
+ coord2[0][1] = 3;
+ coord2[1][0] = 15;
+ coord2[1][1] = 13;
+ coord2[2][0] = 7;
+ coord2[2][1] = 25;
+ coord2[3][0] = 0;
+ coord2[3][1] = 6;
+ coord2[4][0] = 13;
+ coord2[4][1] = 0;
+ coord2[5][0] = 24;
+ coord2[5][1] = 11;
+ coord2[6][0] = 12;
+ coord2[6][1] = 21;
+ coord2[7][0] = 29;
+ coord2[7][1] = 4;
+ coord2[8][0] = 8;
+ coord2[8][1] = 8;
+ coord2[9][0] = 19;
+ coord2[9][1] = 17;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Make a copy of the dataspace to write */
@@ -3885,17 +3942,27 @@ test_select_point_copy(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select sequence of points for read dataset */
- coord3[0][0]= 0; coord3[0][1]= 2;
- coord3[1][0]= 4; coord3[1][1]= 8;
- coord3[2][0]=13; coord3[2][1]=13;
- coord3[3][0]=14; coord3[3][1]=25;
- coord3[4][0]= 7; coord3[4][1]= 9;
- coord3[5][0]= 2; coord3[5][1]= 0;
- coord3[6][0]= 9; coord3[6][1]=19;
- coord3[7][0]= 1; coord3[7][1]=22;
- coord3[8][0]=12; coord3[8][1]=21;
- coord3[9][0]=11; coord3[9][1]= 6;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord3);
+ coord3[0][0] = 0;
+ coord3[0][1] = 2;
+ coord3[1][0] = 4;
+ coord3[1][1] = 8;
+ coord3[2][0] = 13;
+ coord3[2][1] = 13;
+ coord3[3][0] = 14;
+ coord3[3][1] = 25;
+ coord3[4][0] = 7;
+ coord3[4][1] = 9;
+ coord3[5][0] = 2;
+ coord3[5][1] = 0;
+ coord3[6][0] = 9;
+ coord3[6][1] = 19;
+ coord3[7][0] = 1;
+ coord3[7][1] = 22;
+ coord3[8][0] = 12;
+ coord3[8][1] = 21;
+ coord3[9][0] = 11;
+ coord3[9][1] = 6;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord3);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Make a copy of the dataspace to read */
@@ -3903,15 +3970,15 @@ test_select_point_copy(void)
CHECK(sid3, FAIL, "H5Scopy");
/* Read selection from disk */
- ret=H5Dread(data1,H5T_STD_U16LE,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(data1, H5T_STD_U16LE, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Read selection from disk */
- ret=H5Dread(data2,H5T_STD_U16LE,sid3,sid1,H5P_DEFAULT,rbuf2);
+ ret = H5Dread(data2, H5T_STD_U16LE, sid3, sid1, H5P_DEFAULT, rbuf2);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2))
+ if (HDmemcmp(rbuf, rbuf2, sizeof(uint16_t) * SPACE3_DIM1 * SPACE3_DIM2))
TestErrPrintf("point values don't match!\n");
/* Close memory dataspace */
@@ -3942,7 +4009,7 @@ test_select_point_copy(void)
HDfree(wbuf);
HDfree(rbuf);
HDfree(rbuf2);
-} /* test_select_point_copy() */
+} /* test_select_point_copy() */
/****************************************************************
**
@@ -3954,25 +4021,25 @@ test_select_point_copy(void)
static void
test_select_hyper_offset(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- hssize_t offset[SPACE1_RANK]; /* Offset of selection */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- htri_t valid; /* Generic boolean return value */
- H5S_class_t ext_type; /* Extent type */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ hssize_t offset[SPACE1_RANK]; /* Offset of selection */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ htri_t valid; /* Generic boolean return value */
+ H5S_class_t ext_type; /* Extent type */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab Selection Functions with Offsets\n"));
@@ -3984,9 +4051,9 @@ test_select_hyper_offset(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -4005,45 +4072,64 @@ test_select_hyper_offset(void)
VERIFY(ext_type, H5S_SIMPLE, "H5Sget_simple_extent_type");
/* Select 2x15x13 hyperslab for disk dataset */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Check a valid offset */
- offset[0]=-1; offset[1]=0; offset[2]=0;
- ret = H5Soffset_simple(sid1,offset);
+ offset[0] = -1;
+ offset[1] = 0;
+ offset[2] = 0;
+ ret = H5Soffset_simple(sid1, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid1);
VERIFY(valid, TRUE, "H5Sselect_valid");
/* Check an invalid offset */
- offset[0]=10; offset[1]=0; offset[2]=0;
- ret = H5Soffset_simple(sid1,offset);
+ offset[0] = 10;
+ offset[1] = 0;
+ offset[2] = 0;
+ ret = H5Soffset_simple(sid1, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid1);
VERIFY(valid, FALSE, "H5Sselect_valid");
/* Reset offset */
- offset[0]=0; offset[1]=0; offset[2]=0;
- ret = H5Soffset_simple(sid1,offset);
+ offset[0] = 0;
+ offset[1] = 0;
+ offset[2] = 0;
+ ret = H5Soffset_simple(sid1, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid1);
VERIFY(valid, TRUE, "H5Sselect_valid");
/* Select 15x26 hyperslab for memory dataset */
- start[0]=15; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 15;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Choose a valid offset for the memory dataspace */
- offset[0]=-10; offset[1]=0;
- ret = H5Soffset_simple(sid2,offset);
+ offset[0] = -10;
+ offset[1] = 0;
+ ret = H5Soffset_simple(sid2, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid2);
VERIFY(valid, TRUE, "H5Sselect_valid");
@@ -4065,26 +4151,31 @@ test_select_hyper_offset(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 15x26 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i=0; i<SPACE3_DIM1; i++) {
- tbuf=wbuf+((i+5)*SPACE2_DIM2);
- tbuf2=rbuf+(i*SPACE3_DIM2);
- for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) {
- if(*tbuf!=*tbuf2)
- TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",__LINE__,i,j,(unsigned)*tbuf,(unsigned)*tbuf2);
+ for (i = 0; i < SPACE3_DIM1; i++) {
+ tbuf = wbuf + ((i + 5) * SPACE2_DIM2);
+ tbuf2 = rbuf + (i * SPACE3_DIM2);
+ for (j = 0; j < SPACE3_DIM2; j++, tbuf++, tbuf2++) {
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",
+ __LINE__, i, j, (unsigned)*tbuf, (unsigned)*tbuf2);
} /* end for */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -4105,7 +4196,7 @@ test_select_hyper_offset(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_offset() */
+} /* test_select_hyper_offset() */
/****************************************************************
**
@@ -4116,21 +4207,21 @@ test_select_hyper_offset(void)
static void
test_select_hyper_offset2(void)
{
- hid_t fid1; /* HDF5 File IDs */
+ hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
- hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
- hsize_t start[SPACE7_RANK]; /* Starting location of hyperslab */
- hsize_t count[SPACE7_RANK]; /* Element count of hyperslab */
- hssize_t offset[SPACE7_RANK]; /* Offset of selection */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- htri_t valid; /* Generic boolean return value */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
+ hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
+ hsize_t start[SPACE7_RANK]; /* Starting location of hyperslab */
+ hsize_t count[SPACE7_RANK]; /* Element count of hyperslab */
+ hssize_t offset[SPACE7_RANK]; /* Offset of selection */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ htri_t valid; /* Generic boolean return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing More Hyperslab Selection Functions with Offsets\n"));
@@ -4142,9 +4233,9 @@ test_select_hyper_offset2(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
- for(j=0; j<SPACE7_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE7_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE7_DIM1; i++)
+ for (j = 0; j < SPACE7_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE7_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -4159,27 +4250,33 @@ test_select_hyper_offset2(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 4x10 hyperslab for disk dataset */
- start[0]=1; start[1]=0;
- count[0]=4; count[1]=10;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 1;
+ start[1] = 0;
+ count[0] = 4;
+ count[1] = 10;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Set offset */
- offset[0]=1; offset[1]=0;
- ret = H5Soffset_simple(sid1,offset);
+ offset[0] = 1;
+ offset[1] = 0;
+ ret = H5Soffset_simple(sid1, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid1);
VERIFY(valid, TRUE, "H5Sselect_valid");
/* Select 4x10 hyperslab for memory dataset */
- start[0]=1; start[1]=0;
- count[0]=4; count[1]=10;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 1;
+ start[1] = 0;
+ count[0] = 4;
+ count[1] = 10;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Choose a valid offset for the memory dataspace */
- offset[0]=2; offset[1]=0;
- ret = H5Soffset_simple(sid2, offset);
+ offset[0] = 2;
+ offset[1] = 0;
+ ret = H5Soffset_simple(sid2, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid2);
VERIFY(valid, TRUE, "H5Sselect_valid");
@@ -4197,14 +4294,15 @@ test_select_hyper_offset2(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i=0; i<4; i++) {
- tbuf=wbuf+((i+3)*SPACE7_DIM2);
- tbuf2=rbuf+((i+3)*SPACE7_DIM2);
- for(j=0; j<SPACE7_DIM2; j++, tbuf++, tbuf2++) {
- if(*tbuf!=*tbuf2)
- TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",__LINE__,i,j,(unsigned)*tbuf,(unsigned)*tbuf2);
+ for (i = 0; i < 4; i++) {
+ tbuf = wbuf + ((i + 3) * SPACE7_DIM2);
+ tbuf2 = rbuf + ((i + 3) * SPACE7_DIM2);
+ for (j = 0; j < SPACE7_DIM2; j++, tbuf++, tbuf2++) {
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",
+ __LINE__, i, j, (unsigned)*tbuf, (unsigned)*tbuf2);
} /* end for */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -4225,7 +4323,7 @@ test_select_hyper_offset2(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_offset2() */
+} /* test_select_hyper_offset2() */
/****************************************************************
**
@@ -4237,23 +4335,23 @@ test_select_hyper_offset2(void)
static void
test_select_point_offset(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
- hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hssize_t offset[SPACE1_RANK]; /* Offset of selection */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- htri_t valid; /* Generic boolean return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */
+ hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hssize_t offset[SPACE1_RANK]; /* Offset of selection */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ htri_t valid; /* Generic boolean return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Element Selection Functions\n"));
@@ -4265,9 +4363,9 @@ test_select_point_offset(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -4282,57 +4380,94 @@ test_select_point_offset(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select sequence of ten points for disk dataset */
- coord1[0][0]=0; coord1[0][1]=10; coord1[0][2]= 5;
- coord1[1][0]=1; coord1[1][1]= 2; coord1[1][2]= 7;
- coord1[2][0]=2; coord1[2][1]= 4; coord1[2][2]= 9;
- coord1[3][0]=0; coord1[3][1]= 6; coord1[3][2]=11;
- coord1[4][0]=1; coord1[4][1]= 8; coord1[4][2]=12;
- coord1[5][0]=2; coord1[5][1]=12; coord1[5][2]= 0;
- coord1[6][0]=0; coord1[6][1]=14; coord1[6][2]= 2;
- coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4;
- coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6;
- coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8;
- ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ coord1[0][0] = 0;
+ coord1[0][1] = 10;
+ coord1[0][2] = 5;
+ coord1[1][0] = 1;
+ coord1[1][1] = 2;
+ coord1[1][2] = 7;
+ coord1[2][0] = 2;
+ coord1[2][1] = 4;
+ coord1[2][2] = 9;
+ coord1[3][0] = 0;
+ coord1[3][1] = 6;
+ coord1[3][2] = 11;
+ coord1[4][0] = 1;
+ coord1[4][1] = 8;
+ coord1[4][2] = 12;
+ coord1[5][0] = 2;
+ coord1[5][1] = 12;
+ coord1[5][2] = 0;
+ coord1[6][0] = 0;
+ coord1[6][1] = 14;
+ coord1[6][2] = 2;
+ coord1[7][0] = 1;
+ coord1[7][1] = 0;
+ coord1[7][2] = 4;
+ coord1[8][0] = 2;
+ coord1[8][1] = 1;
+ coord1[8][2] = 6;
+ coord1[9][0] = 0;
+ coord1[9][1] = 3;
+ coord1[9][2] = 8;
+ ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Check a valid offset */
- offset[0]=0; offset[1]=0; offset[2]=1;
- ret = H5Soffset_simple(sid1,offset);
+ offset[0] = 0;
+ offset[1] = 0;
+ offset[2] = 1;
+ ret = H5Soffset_simple(sid1, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid1);
VERIFY(valid, TRUE, "H5Sselect_valid");
/* Check an invalid offset */
- offset[0]=10; offset[1]=0; offset[2]=0;
- ret = H5Soffset_simple(sid1,offset);
+ offset[0] = 10;
+ offset[1] = 0;
+ offset[2] = 0;
+ ret = H5Soffset_simple(sid1, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid1);
VERIFY(valid, FALSE, "H5Sselect_valid");
/* Reset offset */
- offset[0]=0; offset[1]=0; offset[2]=0;
- ret = H5Soffset_simple(sid1,offset);
+ offset[0] = 0;
+ offset[1] = 0;
+ offset[2] = 0;
+ ret = H5Soffset_simple(sid1, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid1);
VERIFY(valid, TRUE, "H5Sselect_valid");
/* Select sequence of ten points for write dataset */
- coord2[0][0]=12; coord2[0][1]= 3;
- coord2[1][0]=15; coord2[1][1]=13;
- coord2[2][0]= 7; coord2[2][1]=24;
- coord2[3][0]= 0; coord2[3][1]= 6;
- coord2[4][0]=13; coord2[4][1]= 0;
- coord2[5][0]=24; coord2[5][1]=11;
- coord2[6][0]=12; coord2[6][1]=21;
- coord2[7][0]=23; coord2[7][1]= 4;
- coord2[8][0]= 8; coord2[8][1]= 8;
- coord2[9][0]=19; coord2[9][1]=17;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
+ coord2[0][0] = 12;
+ coord2[0][1] = 3;
+ coord2[1][0] = 15;
+ coord2[1][1] = 13;
+ coord2[2][0] = 7;
+ coord2[2][1] = 24;
+ coord2[3][0] = 0;
+ coord2[3][1] = 6;
+ coord2[4][0] = 13;
+ coord2[4][1] = 0;
+ coord2[5][0] = 24;
+ coord2[5][1] = 11;
+ coord2[6][0] = 12;
+ coord2[6][1] = 21;
+ coord2[7][0] = 23;
+ coord2[7][1] = 4;
+ coord2[8][0] = 8;
+ coord2[8][1] = 8;
+ coord2[9][0] = 19;
+ coord2[9][1] = 17;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Choose a valid offset for the memory dataspace */
- offset[0]=5; offset[1]=1;
- ret = H5Soffset_simple(sid2, offset);
+ offset[0] = 5;
+ offset[1] = 1;
+ ret = H5Soffset_simple(sid2, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid2);
VERIFY(valid, TRUE, "H5Sselect_valid");
@@ -4354,17 +4489,27 @@ test_select_point_offset(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select sequence of points for read dataset */
- coord3[0][0]= 0; coord3[0][1]= 2;
- coord3[1][0]= 4; coord3[1][1]= 8;
- coord3[2][0]=13; coord3[2][1]=13;
- coord3[3][0]=14; coord3[3][1]=25;
- coord3[4][0]= 7; coord3[4][1]= 9;
- coord3[5][0]= 2; coord3[5][1]= 0;
- coord3[6][0]= 9; coord3[6][1]=19;
- coord3[7][0]= 1; coord3[7][1]=22;
- coord3[8][0]=12; coord3[8][1]=21;
- coord3[9][0]=11; coord3[9][1]= 6;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord3);
+ coord3[0][0] = 0;
+ coord3[0][1] = 2;
+ coord3[1][0] = 4;
+ coord3[1][1] = 8;
+ coord3[2][0] = 13;
+ coord3[2][1] = 13;
+ coord3[3][0] = 14;
+ coord3[3][1] = 25;
+ coord3[4][0] = 7;
+ coord3[4][1] = 9;
+ coord3[5][0] = 2;
+ coord3[5][1] = 0;
+ coord3[6][0] = 9;
+ coord3[6][1] = 19;
+ coord3[7][0] = 1;
+ coord3[7][1] = 22;
+ coord3[8][0] = 12;
+ coord3[8][1] = 21;
+ coord3[9][0] = 11;
+ coord3[9][1] = 6;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord3);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Read selection from disk */
@@ -4372,10 +4517,10 @@ test_select_point_offset(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i = 0; i < POINT1_NPOINTS; i++) {
+ for (i = 0; i < POINT1_NPOINTS; i++) {
tbuf = wbuf + ((coord2[i][0] + (hsize_t)offset[0]) * SPACE2_DIM2) + coord2[i][1] + (hsize_t)offset[1];
tbuf2 = rbuf + (coord3[i][0] * SPACE3_DIM2) + coord3[i][1];
- if(*tbuf != *tbuf2)
+ if (*tbuf != *tbuf2)
TestErrPrintf("element values don't match!, i=%d\n", i);
} /* end for */
@@ -4398,7 +4543,7 @@ test_select_point_offset(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_point_offset() */
+} /* test_select_point_offset() */
/****************************************************************
**
@@ -4409,31 +4554,31 @@ test_select_point_offset(void)
static void
test_select_hyper_union(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t xfer; /* Dataset Transfer Property List ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- size_t begin[SPACE2_DIM1]= /* Offset within irregular block */
- {0,0,0,0,0,0,0,0,0,0, /* First ten rows start at offset 0 */
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}; /* Next eighteen rows start at offset 5 */
- size_t len[SPACE2_DIM1]= /* Len of each row within irregular block */
- {10,10,10,10,10,10,10,10, /* First eight rows are 10 long */
- 20,20, /* Next two rows are 20 long */
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15}; /* Next eighteen rows are 15 long */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- hssize_t npoints; /* Number of elements in selection */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hid_t xfer; /* Dataset Transfer Property List ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ size_t begin[SPACE2_DIM1] = /* Offset within irregular block */
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* First ten rows start at offset 0 */
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}; /* Next eighteen rows start at offset 5 */
+ size_t len[SPACE2_DIM1] = /* Len of each row within irregular block */
+ {10, 10, 10, 10, 10, 10, 10, 10, /* First eight rows are 10 long */
+ 20, 20, /* Next two rows are 20 long */
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}; /* Next eighteen rows are 15 long */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ hssize_t npoints; /* Number of elements in selection */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of hyperslabs\n"));
@@ -4445,15 +4590,15 @@ test_select_hyper_union(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fcreate");
-/* Test simple case of one block overlapping another */
+ /* Test simple case of one block overlapping another */
/* Create dataspace for dataset */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
@@ -4463,30 +4608,46 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x15x13 hyperslab for disk dataset */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid1);
VERIFY(npoints, 2 * 15 * 13, "H5Sget_select_npoints");
/* Select 8x26 hyperslab for memory dataset */
- start[0]=15; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=8; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 15;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 8;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Union overlapping 8x26 hyperslab for memory dataset (to form a 15x26 selection) */
- start[0]=22; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=8; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 22;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 8;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
@@ -4509,26 +4670,31 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 15x26 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i=0; i<SPACE3_DIM1; i++) {
- tbuf=wbuf+((i+15)*SPACE2_DIM2);
- tbuf2=rbuf+(i*SPACE3_DIM2);
- for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) {
- if(*tbuf!=*tbuf2)
- TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ for (i = 0; i < SPACE3_DIM1; i++) {
+ tbuf = wbuf + ((i + 15) * SPACE2_DIM2);
+ tbuf2 = rbuf + (i * SPACE3_DIM2);
+ for (j = 0; j < SPACE3_DIM2; j++, tbuf++, tbuf2++) {
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",
+ __LINE__, i, j, (int)*tbuf, (int)*tbuf2);
} /* end for */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -4542,7 +4708,7 @@ test_select_hyper_union(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-/* Test simple case of several block overlapping another */
+ /* Test simple case of several block overlapping another */
/* Create dataspace for dataset */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
@@ -4552,35 +4718,55 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x15x13 hyperslab for disk dataset */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 8x15 hyperslab for memory dataset */
- start[0]=15; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=8; count[1]=15;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 15;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 8;
+ count[1] = 15;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Union overlapping 8x15 hyperslab for memory dataset (to form a 15x15 selection) */
- start[0]=22; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=8; count[1]=15;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 22;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 8;
+ count[1] = 15;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Union overlapping 15x15 hyperslab for memory dataset (to form a 15x26 selection) */
- start[0]=15; start[1]=11;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=15;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 15;
+ start[1] = 11;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 15;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
@@ -4603,26 +4789,31 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 15x26 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i=0; i<SPACE3_DIM1; i++) {
- tbuf=wbuf+((i+15)*SPACE2_DIM2);
- tbuf2=rbuf+(i*SPACE3_DIM2);
- for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) {
- if(*tbuf!=*tbuf2)
- TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ for (i = 0; i < SPACE3_DIM1; i++) {
+ tbuf = wbuf + ((i + 15) * SPACE2_DIM2);
+ tbuf2 = rbuf + (i * SPACE3_DIM2);
+ for (j = 0; j < SPACE3_DIM2; j++, tbuf++, tbuf2++) {
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",
+ __LINE__, i, j, (int)*tbuf, (int)*tbuf2);
} /* end for */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -4636,7 +4827,7 @@ test_select_hyper_union(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-/* Test disjoint case of two non-overlapping blocks */
+ /* Test disjoint case of two non-overlapping blocks */
/* Create dataspace for dataset */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
@@ -4646,27 +4837,43 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x15x13 hyperslab for disk dataset */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 7x26 hyperslab for memory dataset */
- start[0]=1; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=7; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 7;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Union non-overlapping 8x26 hyperslab for memory dataset (to form a 15x26 disjoint selection) */
- start[0]=22; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=8; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 22;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 8;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
@@ -4689,30 +4896,35 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 15x26 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i=0; i<SPACE3_DIM1; i++) {
+ for (i = 0; i < SPACE3_DIM1; i++) {
/* Jump over gap in middle */
- if(i<7)
- tbuf=wbuf+((i+1)*SPACE2_DIM2);
+ if (i < 7)
+ tbuf = wbuf + ((i + 1) * SPACE2_DIM2);
else
- tbuf=wbuf+((i+15)*SPACE2_DIM2);
- tbuf2=rbuf+(i*SPACE3_DIM2);
- for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) {
- if(*tbuf!=*tbuf2)
- TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ tbuf = wbuf + ((i + 15) * SPACE2_DIM2);
+ tbuf2 = rbuf + (i * SPACE3_DIM2);
+ for (j = 0; j < SPACE3_DIM2; j++, tbuf++, tbuf2++) {
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",
+ __LINE__, i, j, (int)*tbuf, (int)*tbuf2);
} /* end for */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -4726,7 +4938,7 @@ test_select_hyper_union(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-/* Test disjoint case of two non-overlapping blocks with hyperslab caching turned off */
+ /* Test disjoint case of two non-overlapping blocks with hyperslab caching turned off */
/* Create dataspace for dataset */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
@@ -4736,27 +4948,43 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x15x13 hyperslab for disk dataset */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 7x26 hyperslab for memory dataset */
- start[0]=1; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=7; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 7;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Union non-overlapping 8x26 hyperslab for memory dataset (to form a 15x26 disjoint selection) */
- start[0]=22; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=8; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 22;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 8;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
@@ -4766,11 +4994,11 @@ test_select_hyper_union(void)
dataset = H5Dcreate2(fid1, SPACE4_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
- xfer = H5Pcreate (H5P_DATASET_XFER);
+ xfer = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer, FAIL, "H5Pcreate");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -4782,15 +5010,19 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 15x26 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Close transfer property list */
@@ -4798,18 +5030,19 @@ test_select_hyper_union(void)
CHECK(ret, FAIL, "H5Pclose");
/* Compare data read with data written out */
- for(i=0; i<SPACE3_DIM1; i++) {
+ for (i = 0; i < SPACE3_DIM1; i++) {
/* Jump over gap in middle */
- if(i<7)
- tbuf=wbuf+((i+1)*SPACE2_DIM2);
+ if (i < 7)
+ tbuf = wbuf + ((i + 1) * SPACE2_DIM2);
else
- tbuf=wbuf+((i+15)*SPACE2_DIM2);
- tbuf2=rbuf+(i*SPACE3_DIM2);
- for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) {
- if(*tbuf!=*tbuf2)
- TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ tbuf = wbuf + ((i + 15) * SPACE2_DIM2);
+ tbuf2 = rbuf + (i * SPACE3_DIM2);
+ for (j = 0; j < SPACE3_DIM2; j++, tbuf++, tbuf2++) {
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",
+ __LINE__, i, j, (int)*tbuf, (int)*tbuf2);
} /* end for */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -4823,7 +5056,7 @@ test_select_hyper_union(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-/* Test case of two blocks which overlap corners and must be split */
+ /* Test case of two blocks which overlap corners and must be split */
/* Create dataspace for dataset */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
@@ -4833,38 +5066,54 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x15x13 hyperslab for disk dataset */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 10x10 hyperslab for memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Union overlapping 15x20 hyperslab for memory dataset (forming a irregularly shaped region) */
- start[0]=8; start[1]=5;
- stride[0]=1; stride[1]=1;
- count[0]=20; count[1]=15;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 8;
+ start[1] = 5;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 20;
+ count[1] = 15;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
VERIFY(npoints, 15 * 26, "H5Sget_select_npoints");
/* Create a dataset */
- dataset = H5Dcreate2(fid1,SPACE5_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE5_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -4876,25 +5125,30 @@ test_select_hyper_union(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 15x26 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i=0,tbuf2=rbuf; i<SPACE2_DIM1; i++) {
- tbuf=wbuf+(i*SPACE2_DIM2)+begin[i];
- for(j=0; j<(int)len[i]; j++, tbuf++, tbuf2++) {
- if(*tbuf!=*tbuf2)
- TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ for (i = 0, tbuf2 = rbuf; i < SPACE2_DIM1; i++) {
+ tbuf = wbuf + (i * SPACE2_DIM2) + begin[i];
+ for (j = 0; j < (int)len[i]; j++, tbuf++, tbuf2++) {
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",
+ __LINE__, i, j, (int)*tbuf, (int)*tbuf2);
} /* end for */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -4915,7 +5169,7 @@ test_select_hyper_union(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_union() */
+} /* test_select_hyper_union() */
/****************************************************************
**
@@ -4927,70 +5181,57 @@ test_select_hyper_union(void)
static void
test_select_hyper_union_stagger(void)
{
- hid_t file_id; /* File ID */
- hid_t dset_id; /* Dataset ID */
- hid_t dataspace; /* File dataspace ID */
- hid_t memspace; /* Memory dataspace ID */
- hid_t tmp_space; /* Temporary dataspace ID */
- hid_t tmp2_space; /* Another emporary dataspace ID */
- hsize_t dimsm[2]={7,7}; /* Memory array dimensions */
- hsize_t dimsf[2]={6,5}; /* File array dimensions */
- hsize_t count[2]={3,1}; /* 1st Hyperslab size */
- hsize_t count2[2]={3,1}; /* 2nd Hyperslab size */
- hsize_t count3[2]={2,1}; /* 3rd Hyperslab size */
- hsize_t start[2]={0,0}; /* 1st Hyperslab offset */
- hsize_t start2[2]={2,1}; /* 2nd Hyperslab offset */
- hsize_t start3[2]={4,2}; /* 3rd Hyperslab offset */
- hsize_t count_out[2]={4,2}; /* Hyperslab size in memory */
- hsize_t start_out[2]={0,3}; /* Hyperslab offset in memory */
- int data[6][5]; /* Data to write */
- int data_out[7][7]; /* Data read in */
- int input_loc[8][2]={{0,0},
- {1,0},
- {2,0},
- {2,1},
- {3,1},
- {4,1},
- {4,2},
- {5,2}};
- int output_loc[8][2]={{0,3},
- {0,4},
- {1,3},
- {1,4},
- {2,3},
- {2,4},
- {3,3},
- {3,4}};
- int dsetrank=2; /* File Dataset rank */
- int memrank=2; /* Memory Dataset rank */
- int i,j; /* Local counting variables */
- herr_t error;
- hsize_t stride[2]={1,1};
- hsize_t block[2]={1,1};
+ hid_t file_id; /* File ID */
+ hid_t dset_id; /* Dataset ID */
+ hid_t dataspace; /* File dataspace ID */
+ hid_t memspace; /* Memory dataspace ID */
+ hid_t tmp_space; /* Temporary dataspace ID */
+ hid_t tmp2_space; /* Another emporary dataspace ID */
+ hsize_t dimsm[2] = {7, 7}; /* Memory array dimensions */
+ hsize_t dimsf[2] = {6, 5}; /* File array dimensions */
+ hsize_t count[2] = {3, 1}; /* 1st Hyperslab size */
+ hsize_t count2[2] = {3, 1}; /* 2nd Hyperslab size */
+ hsize_t count3[2] = {2, 1}; /* 3rd Hyperslab size */
+ hsize_t start[2] = {0, 0}; /* 1st Hyperslab offset */
+ hsize_t start2[2] = {2, 1}; /* 2nd Hyperslab offset */
+ hsize_t start3[2] = {4, 2}; /* 3rd Hyperslab offset */
+ hsize_t count_out[2] = {4, 2}; /* Hyperslab size in memory */
+ hsize_t start_out[2] = {0, 3}; /* Hyperslab offset in memory */
+ int data[6][5]; /* Data to write */
+ int data_out[7][7]; /* Data read in */
+ int input_loc[8][2] = {{0, 0}, {1, 0}, {2, 0}, {2, 1}, {3, 1}, {4, 1}, {4, 2}, {5, 2}};
+ int output_loc[8][2] = {{0, 3}, {0, 4}, {1, 3}, {1, 4}, {2, 3}, {2, 4}, {3, 3}, {3, 4}};
+ int dsetrank = 2; /* File Dataset rank */
+ int memrank = 2; /* Memory Dataset rank */
+ int i, j; /* Local counting variables */
+ herr_t error;
+ hsize_t stride[2] = {1, 1};
+ hsize_t block[2] = {1, 1};
/* Initialize data to write */
- for(i=0; i<6; i++)
- for(j=0; j<5; j++)
- data[i][j] = j*10 + i;
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 5; j++)
+ data[i][j] = j * 10 + i;
/* Create file */
- file_id=H5Fcreate(FILENAME,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
+ file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file_id, FAIL, "H5Fcreate");
/* Create File Dataspace */
- dataspace=H5Screate_simple(dsetrank,dimsf,NULL);
+ dataspace = H5Screate_simple(dsetrank, dimsf, NULL);
CHECK(dataspace, FAIL, "H5Screate_simple");
/* Create File Dataset */
- dset_id=H5Dcreate2(file_id,"IntArray",H5T_NATIVE_INT,dataspace,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset_id =
+ H5Dcreate2(file_id, "IntArray", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
/* Write File Dataset */
- error=H5Dwrite(dset_id,H5T_NATIVE_INT,dataspace,dataspace,H5P_DEFAULT,data);
+ error = H5Dwrite(dset_id, H5T_NATIVE_INT, dataspace, dataspace, H5P_DEFAULT, data);
CHECK(error, FAIL, "H5Dwrite");
/* Close things */
- error=H5Sclose(dataspace);
+ error = H5Sclose(dataspace);
CHECK(error, FAIL, "H5Sclose");
error = H5Dclose(dset_id);
CHECK(error, FAIL, "H5Dclose");
@@ -5021,48 +5262,48 @@ test_select_hyper_union_stagger(void)
/* Copy the file dataspace and select hyperslab */
tmp2_space = H5Scopy(dataspace);
CHECK(tmp2_space, FAIL, "H5Scopy");
- error=H5Sselect_hyperslab(tmp2_space, H5S_SELECT_SET, start3, stride, count3, block);
+ error = H5Sselect_hyperslab(tmp2_space, H5S_SELECT_SET, start3, stride, count3, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Combine the copied dataspace with the temporary dataspace */
- error=H5Smodify_select(tmp_space,H5S_SELECT_OR,tmp2_space);
+ error = H5Smodify_select(tmp_space, H5S_SELECT_OR, tmp2_space);
CHECK(error, FAIL, "H5Smodify_select");
/* Create Memory Dataspace */
- memspace=H5Screate_simple(memrank,dimsm,NULL);
+ memspace = H5Screate_simple(memrank, dimsm, NULL);
CHECK(memspace, FAIL, "H5Screate_simple");
/* Select hyperslab in memory */
- error=H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start_out, stride, count_out, block);
+ error = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start_out, stride, count_out, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Read File Dataset */
- error=H5Dread(dset_id,H5T_NATIVE_INT,memspace,tmp_space,H5P_DEFAULT,data_out);
+ error = H5Dread(dset_id, H5T_NATIVE_INT, memspace, tmp_space, H5P_DEFAULT, data_out);
CHECK(error, FAIL, "H5Dread");
/* Verify input data */
- for(i=0; i<8; i++) {
- if(data[input_loc[i][0]][input_loc[i][1]]!=data_out[output_loc[i][0]][output_loc[i][1]]) {
- HDprintf("input data #%d is wrong!\n",i);
- HDprintf("input_loc=[%d][%d]\n",input_loc[i][0],input_loc[i][1]);
- HDprintf("output_loc=[%d][%d]\n",output_loc[i][0],output_loc[i][1]);
- HDprintf("data=%d\n",data[input_loc[i][0]][input_loc[i][1]]);
- TestErrPrintf("data_out=%d\n",data_out[output_loc[i][0]][output_loc[i][1]]);
+ for (i = 0; i < 8; i++) {
+ if (data[input_loc[i][0]][input_loc[i][1]] != data_out[output_loc[i][0]][output_loc[i][1]]) {
+ HDprintf("input data #%d is wrong!\n", i);
+ HDprintf("input_loc=[%d][%d]\n", input_loc[i][0], input_loc[i][1]);
+ HDprintf("output_loc=[%d][%d]\n", output_loc[i][0], output_loc[i][1]);
+ HDprintf("data=%d\n", data[input_loc[i][0]][input_loc[i][1]]);
+ TestErrPrintf("data_out=%d\n", data_out[output_loc[i][0]][output_loc[i][1]]);
} /* end if */
- } /* end for */
+ } /* end for */
/* Close things */
- error=H5Sclose(tmp2_space);
+ error = H5Sclose(tmp2_space);
CHECK(error, FAIL, "H5Sclose");
- error=H5Sclose(tmp_space);
+ error = H5Sclose(tmp_space);
CHECK(error, FAIL, "H5Sclose");
- error=H5Sclose(dataspace);
+ error = H5Sclose(dataspace);
CHECK(error, FAIL, "H5Sclose");
- error=H5Sclose(memspace);
+ error = H5Sclose(memspace);
CHECK(error, FAIL, "H5Sclose");
- error=H5Dclose(dset_id);
+ error = H5Dclose(dset_id);
CHECK(error, FAIL, "H5Dclose");
- error=H5Fclose(file_id);
+ error = H5Fclose(file_id);
CHECK(error, FAIL, "H5Fclose");
}
@@ -5076,80 +5317,46 @@ test_select_hyper_union_stagger(void)
static void
test_select_hyper_union_3d(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t tmp_space; /* Temporary Dataspace ID */
- hid_t tmp2_space; /* Another temporary Dataspace ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
- hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hid_t tmp_space; /* Temporary Dataspace ID */
+ hid_t tmp2_space; /* Another temporary Dataspace ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
struct row_list {
size_t z;
size_t y;
size_t x;
size_t l;
- } rows[]= { /* Array of x,y,z coordinates & length for each row written from memory */
- {0,0,0,6}, /* 1st face of 3-D object */
- {0,1,0,6},
- {0,2,0,6},
- {0,3,0,6},
- {0,4,0,6},
- {1,0,0,6}, /* 2nd face of 3-D object */
- {1,1,0,6},
- {1,2,0,6},
- {1,3,0,6},
- {1,4,0,6},
- {2,0,0,6}, /* 3rd face of 3-D object */
- {2,1,0,10},
- {2,2,0,10},
- {2,3,0,10},
- {2,4,0,10},
- {2,5,2,8},
- {2,6,2,8},
- {3,0,0,6}, /* 4th face of 3-D object */
- {3,1,0,10},
- {3,2,0,10},
- {3,3,0,10},
- {3,4,0,10},
- {3,5,2,8},
- {3,6,2,8},
- {4,0,0,6}, /* 5th face of 3-D object */
- {4,1,0,10},
- {4,2,0,10},
- {4,3,0,10},
- {4,4,0,10},
- {4,5,2,8},
- {4,6,2,8},
- {5,1,2,8}, /* 6th face of 3-D object */
- {5,2,2,8},
- {5,3,2,8},
- {5,4,2,8},
- {5,5,2,8},
- {5,6,2,8},
- {6,1,2,8}, /* 7th face of 3-D object */
- {6,2,2,8},
- {6,3,2,8},
- {6,4,2,8},
- {6,5,2,8},
- {6,6,2,8},
- {7,1,2,8}, /* 8th face of 3-D object */
- {7,2,2,8},
- {7,3,2,8},
- {7,4,2,8},
- {7,5,2,8},
- {7,6,2,8}};
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j,k; /* Counters */
- herr_t ret; /* Generic return value */
- hsize_t npoints; /* Number of elements in selection */
+ } rows[] = {
+ /* Array of x,y,z coordinates & length for each row written from memory */
+ {0, 0, 0, 6}, /* 1st face of 3-D object */
+ {0, 1, 0, 6}, {0, 2, 0, 6}, {0, 3, 0, 6}, {0, 4, 0, 6}, {1, 0, 0, 6}, /* 2nd face of 3-D object */
+ {1, 1, 0, 6}, {1, 2, 0, 6}, {1, 3, 0, 6}, {1, 4, 0, 6}, {2, 0, 0, 6}, /* 3rd face of 3-D object */
+ {2, 1, 0, 10}, {2, 2, 0, 10}, {2, 3, 0, 10}, {2, 4, 0, 10}, {2, 5, 2, 8},
+ {2, 6, 2, 8}, {3, 0, 0, 6}, /* 4th face of 3-D object */
+ {3, 1, 0, 10}, {3, 2, 0, 10}, {3, 3, 0, 10}, {3, 4, 0, 10}, {3, 5, 2, 8},
+ {3, 6, 2, 8}, {4, 0, 0, 6}, /* 5th face of 3-D object */
+ {4, 1, 0, 10}, {4, 2, 0, 10}, {4, 3, 0, 10}, {4, 4, 0, 10}, {4, 5, 2, 8},
+ {4, 6, 2, 8}, {5, 1, 2, 8}, /* 6th face of 3-D object */
+ {5, 2, 2, 8}, {5, 3, 2, 8}, {5, 4, 2, 8}, {5, 5, 2, 8}, {5, 6, 2, 8},
+ {6, 1, 2, 8}, /* 7th face of 3-D object */
+ {6, 2, 2, 8}, {6, 3, 2, 8}, {6, 4, 2, 8}, {6, 5, 2, 8}, {6, 6, 2, 8},
+ {7, 1, 2, 8}, /* 8th face of 3-D object */
+ {7, 2, 2, 8}, {7, 3, 2, 8}, {7, 4, 2, 8}, {7, 5, 2, 8}, {7, 6, 2, 8}};
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j, k; /* Counters */
+ herr_t ret; /* Generic return value */
+ hsize_t npoints; /* Number of elements in selection */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of 3-D hyperslabs\n"));
@@ -5161,16 +5368,16 @@ test_select_hyper_union_3d(void)
CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
- for(j=0; j<SPACE4_DIM2; j++)
- for(k=0; k<SPACE4_DIM3; k++)
- *tbuf++=(uint8_t)((((i*SPACE4_DIM2)+j)*SPACE4_DIM3)+k);
+ for (i = 0, tbuf = wbuf; i < SPACE4_DIM1; i++)
+ for (j = 0; j < SPACE4_DIM2; j++)
+ for (k = 0; k < SPACE4_DIM3; k++)
+ *tbuf++ = (uint8_t)((((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fcreate");
-/* Test case of two blocks which overlap corners and must be split */
+ /* Test case of two blocks which overlap corners and must be split */
/* Create dataspace for dataset on disk */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
@@ -5180,42 +5387,66 @@ test_select_hyper_union_3d(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x15x13 hyperslab for disk dataset */
- start[0]=1; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=2; count[1]=15; count[2]=13;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 2;
+ count[1] = 15;
+ count[2] = 13;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 5x5x6 hyperslab for memory dataset */
- start[0]=0; start[1]=0; start[2]=0;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=5; count[1]=5; count[2]=6;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 5;
+ count[1] = 5;
+ count[2] = 6;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Union overlapping 15x20 hyperslab for memory dataset (forming a irregularly shaped region) */
- start[0]=2; start[1]=1; start[2]=2;
- stride[0]=1; stride[1]=1; stride[2]=1;
- count[0]=6; count[1]=6; count[2]=8;
- block[0]=1; block[1]=1; block[2]=1;
- tmp_space = H5Scombine_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 1;
+ start[2] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = 6;
+ count[1] = 6;
+ count[2] = 8;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ tmp_space = H5Scombine_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(tmp_space, FAIL, "H5Sselect_hyperslab");
/* Combine dataspaces and create new dataspace */
- tmp2_space = H5Scombine_select(sid2,H5S_SELECT_OR,tmp_space);
+ tmp2_space = H5Scombine_select(sid2, H5S_SELECT_OR, tmp_space);
CHECK(tmp2_space, FAIL, "H5Scombin_select");
npoints = (hsize_t)H5Sget_select_npoints(tmp2_space);
- VERIFY(npoints, 15*26, "H5Sget_select_npoints");
+ VERIFY(npoints, 15 * 26, "H5Sget_select_npoints");
/* Create a dataset */
dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,tmp2_space,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, tmp2_space, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close temporary dataspaces */
@@ -5233,25 +5464,30 @@ test_select_hyper_union_3d(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 15x26 hyperslab for reading memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 15;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- for(i=0,tbuf2=rbuf; i<(int)(sizeof(rows)/sizeof(struct row_list)); i++) {
- tbuf=wbuf+(rows[i].z*SPACE4_DIM3*SPACE4_DIM2)+(rows[i].y*SPACE4_DIM3)+rows[i].x;
- for(j=0; j<(int)rows[i].l; j++, tbuf++, tbuf2++) {
- if(*tbuf!=*tbuf2)
- TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ for (i = 0, tbuf2 = rbuf; i < (int)(sizeof(rows) / sizeof(struct row_list)); i++) {
+ tbuf = wbuf + (rows[i].z * SPACE4_DIM3 * SPACE4_DIM2) + (rows[i].y * SPACE4_DIM3) + rows[i].x;
+ for (j = 0; j < (int)rows[i].l; j++, tbuf++, tbuf2++) {
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",
+ __LINE__, i, j, (int)*tbuf, (int)*tbuf2);
} /* end for */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -5272,7 +5508,7 @@ test_select_hyper_union_3d(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_union_3d() */
+} /* test_select_hyper_union_3d() */
/****************************************************************
**
@@ -5284,32 +5520,33 @@ test_select_hyper_union_3d(void)
static void
test_select_hyper_valid_combination(void)
{
- hid_t single_pt_sid; /* Dataspace ID with single point selection */
- hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
- hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
+ hid_t single_pt_sid; /* Dataspace ID with single point selection */
+ hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
+ hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
hid_t non_existent_sid = -1; /* A non-existent space id */
- hid_t tmp_sid; /* Temporary dataspace ID */
- hsize_t dims2D[] = {SPACE9_DIM1, SPACE9_DIM2};
- hsize_t dims3D[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
+ hid_t tmp_sid; /* Temporary dataspace ID */
+ hsize_t dims2D[] = {SPACE9_DIM1, SPACE9_DIM2};
+ hsize_t dims3D[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
- hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
- hsize_t start[SPACE4_RANK]; /* Hyperslab start */
- hsize_t stride[SPACE4_RANK]; /* Hyperslab stride */
- hsize_t count[SPACE4_RANK]; /* Hyperslab block count */
- hsize_t block[SPACE4_RANK]; /* Hyperslab block size */
- herr_t ret; /* Generic return value */
+ hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
+ hsize_t start[SPACE4_RANK]; /* Hyperslab start */
+ hsize_t stride[SPACE4_RANK]; /* Hyperslab stride */
+ hsize_t count[SPACE4_RANK]; /* Hyperslab block count */
+ hsize_t block[SPACE4_RANK]; /* Hyperslab block size */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing Selection Combination Validity\n"));
- assert(SPACE9_DIM2>=POINT1_NPOINTS);
+ assert(SPACE9_DIM2 >= POINT1_NPOINTS);
/* Create dataspace for single point selection */
single_pt_sid = H5Screate_simple(SPACE9_RANK, dims2D, NULL);
CHECK(single_pt_sid, FAIL, "H5Screate_simple");
/* Select sequence of ten points for multiple point selection */
- coord1[0][0] = 2; coord1[0][1] = 2;
- ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
+ coord1[0][0] = 2;
+ coord1[0][1] = 2;
+ ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create dataspace for single hyperslab selection */
@@ -5317,11 +5554,15 @@ test_select_hyper_valid_combination(void)
CHECK(single_hyper_sid, FAIL, "H5Screate_simple");
/* Select 10x10 hyperslab for single hyperslab selection */
- start[0]=1; start[1]=1;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=(SPACE9_DIM1-2); block[1]=(SPACE9_DIM2-2);
- ret = H5Sselect_hyperslab(single_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = (SPACE9_DIM1 - 2);
+ block[1] = (SPACE9_DIM2 - 2);
+ ret = H5Sselect_hyperslab(single_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for regular hyperslab selection */
@@ -5329,14 +5570,21 @@ test_select_hyper_valid_combination(void)
CHECK(regular_hyper_sid, FAIL, "H5Screate_simple");
/* Select regular, strided hyperslab selection */
- start[0]=2; start[1]=2; start[2]=2;
- stride[0]=2; stride[1]=2; stride[2]=2;
- count[0]=5; count[1]=2; count[2]=5;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(regular_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 2;
+ start[2] = 2;
+ stride[0] = 2;
+ stride[1] = 2;
+ stride[2] = 2;
+ count[0] = 5;
+ count[1] = 2;
+ count[2] = 5;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ ret = H5Sselect_hyperslab(regular_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Test all the selections created */
/* Test the invalid combinations between point and hyperslab */
@@ -5374,8 +5622,7 @@ test_select_hyper_valid_combination(void)
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(regular_hyper_sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_select_hyper_valid_combination() */
-
+} /* test_select_hyper_valid_combination() */
/****************************************************************
**
@@ -5386,22 +5633,22 @@ test_select_hyper_valid_combination(void)
static void
test_select_hyper_and_2d(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims2[] = {SPACE2A_DIM1};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- hssize_t npoints; /* Number of elements in selection */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims2[] = {SPACE2A_DIM1};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ hssize_t npoints; /* Number of elements in selection */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab Selection Functions with intersection of 2-D hyperslabs\n"));
@@ -5413,9 +5660,9 @@ test_select_hyper_and_2d(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -5430,30 +5677,38 @@ test_select_hyper_and_2d(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 10x10 hyperslab for disk dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Intersect overlapping 10x10 hyperslab */
- start[0]=5; start[1]=5;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_AND,start,stride,count,block);
+ start[0] = 5;
+ start[1] = 5;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_AND, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid1);
VERIFY(npoints, 5 * 5, "H5Sget_select_npoints");
/* Select 25 hyperslab for memory dataset */
- start[0]=0;
- stride[0]=1;
- count[0]=25;
- block[0]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ stride[0] = 1;
+ count[0] = 25;
+ block[0] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
@@ -5464,26 +5719,28 @@ test_select_hyper_and_2d(void)
CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Read entire dataset from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Initialize write buffer */
- for(i=0, tbuf=rbuf, tbuf2=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++, tbuf++) {
- if((i>=5 && i<=9) && (j>=5 && j<=9)) {
- if(*tbuf!=*tbuf2)
- HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ for (i = 0, tbuf = rbuf, tbuf2 = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++, tbuf++) {
+ if ((i >= 5 && i <= 9) && (j >= 5 && j <= 9)) {
+ if (*tbuf != *tbuf2)
+ HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n", __LINE__,
+ i, j, (int)*tbuf, (int)*tbuf2);
tbuf2++;
} /* end if */
else {
- if(*tbuf!=0)
- HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf);
+ if (*tbuf != 0)
+ HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n", __LINE__, i, j,
+ (int)*tbuf);
} /* end else */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -5504,7 +5761,7 @@ test_select_hyper_and_2d(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_and_2d() */
+} /* test_select_hyper_and_2d() */
/****************************************************************
**
@@ -5515,22 +5772,22 @@ test_select_hyper_and_2d(void)
static void
test_select_hyper_xor_2d(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims2[] = {SPACE2A_DIM1};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- hssize_t npoints; /* Number of elements in selection */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims2[] = {SPACE2A_DIM1};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ hssize_t npoints; /* Number of elements in selection */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab Selection Functions with XOR of 2-D hyperslabs\n"));
@@ -5542,9 +5799,9 @@ test_select_hyper_xor_2d(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -5559,30 +5816,38 @@ test_select_hyper_xor_2d(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 10x10 hyperslab for disk dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Intersect overlapping 10x10 hyperslab */
- start[0]=5; start[1]=5;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_XOR,start,stride,count,block);
+ start[0] = 5;
+ start[1] = 5;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_XOR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid1);
VERIFY(npoints, 150, "H5Sget_select_npoints");
/* Select 25 hyperslab for memory dataset */
- start[0]=0;
- stride[0]=1;
- count[0]=150;
- block[0]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ stride[0] = 1;
+ count[0] = 150;
+ block[0] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
@@ -5593,28 +5858,30 @@ test_select_hyper_xor_2d(void)
CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Read entire dataset from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Initialize write buffer */
- for(i=0, tbuf=rbuf, tbuf2=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++, tbuf++) {
- if(((i>=0 && i<=4) && (j>=0 && j<=9)) ||
- ((i>=5 && i<=9) && ((j>=0 && j<=4) || (j>=10 && j<=14))) ||
- ((i>=10 && i<=14) && (j>=5 && j<=14))) {
- if(*tbuf!=*tbuf2)
- HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ for (i = 0, tbuf = rbuf, tbuf2 = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++, tbuf++) {
+ if (((i >= 0 && i <= 4) && (j >= 0 && j <= 9)) ||
+ ((i >= 5 && i <= 9) && ((j >= 0 && j <= 4) || (j >= 10 && j <= 14))) ||
+ ((i >= 10 && i <= 14) && (j >= 5 && j <= 14))) {
+ if (*tbuf != *tbuf2)
+ HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n", __LINE__,
+ i, j, (int)*tbuf, (int)*tbuf2);
tbuf2++;
} /* end if */
else {
- if(*tbuf!=0)
- HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf);
+ if (*tbuf != 0)
+ HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n", __LINE__, i, j,
+ (int)*tbuf);
} /* end else */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -5635,7 +5902,7 @@ test_select_hyper_xor_2d(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_xor_2d() */
+} /* test_select_hyper_xor_2d() */
/****************************************************************
**
@@ -5646,22 +5913,22 @@ test_select_hyper_xor_2d(void)
static void
test_select_hyper_notb_2d(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims2[] = {SPACE2A_DIM1};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- hssize_t npoints; /* Number of elements in selection */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims2[] = {SPACE2A_DIM1};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ hssize_t npoints; /* Number of elements in selection */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTB of 2-D hyperslabs\n"));
@@ -5673,9 +5940,9 @@ test_select_hyper_notb_2d(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -5690,30 +5957,38 @@ test_select_hyper_notb_2d(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 10x10 hyperslab for disk dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Intersect overlapping 10x10 hyperslab */
- start[0]=5; start[1]=5;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_NOTB,start,stride,count,block);
+ start[0] = 5;
+ start[1] = 5;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_NOTB, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid1);
VERIFY(npoints, 75, "H5Sget_select_npoints");
/* Select 75 hyperslab for memory dataset */
- start[0]=0;
- stride[0]=1;
- count[0]=75;
- block[0]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ stride[0] = 1;
+ count[0] = 75;
+ block[0] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
@@ -5724,27 +5999,28 @@ test_select_hyper_notb_2d(void)
CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Read entire dataset from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Initialize write buffer */
- for(i=0, tbuf=rbuf, tbuf2=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++, tbuf++) {
- if(((i>=0 && i<=4) && (j>=0 && j<=9)) ||
- ((i>=5 && i<=9) && (j>=0 && j<=4))) {
- if(*tbuf!=*tbuf2)
- HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ for (i = 0, tbuf = rbuf, tbuf2 = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++, tbuf++) {
+ if (((i >= 0 && i <= 4) && (j >= 0 && j <= 9)) || ((i >= 5 && i <= 9) && (j >= 0 && j <= 4))) {
+ if (*tbuf != *tbuf2)
+ HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n", __LINE__,
+ i, j, (int)*tbuf, (int)*tbuf2);
tbuf2++;
} /* end if */
else {
- if(*tbuf!=0)
- HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf);
+ if (*tbuf != 0)
+ HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n", __LINE__, i, j,
+ (int)*tbuf);
} /* end else */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -5765,7 +6041,7 @@ test_select_hyper_notb_2d(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_notb_2d() */
+} /* test_select_hyper_notb_2d() */
/****************************************************************
**
@@ -5776,22 +6052,22 @@ test_select_hyper_notb_2d(void)
static void
test_select_hyper_nota_2d(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t dims2[] = {SPACE2A_DIM1};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf, /* temporary buffer pointer */
- *tbuf2; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
- hssize_t npoints; /* Number of elements in selection */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims2[] = {SPACE2A_DIM1};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
+ hssize_t npoints; /* Number of elements in selection */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTA of 2-D hyperslabs\n"));
@@ -5803,9 +6079,9 @@ test_select_hyper_nota_2d(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE2_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE2_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -5820,30 +6096,38 @@ test_select_hyper_nota_2d(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 10x10 hyperslab for disk dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Intersect overlapping 10x10 hyperslab */
- start[0]=5; start[1]=5;
- stride[0]=1; stride[1]=1;
- count[0]=10; count[1]=10;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_NOTA,start,stride,count,block);
+ start[0] = 5;
+ start[1] = 5;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 10;
+ count[1] = 10;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_NOTA, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid1);
VERIFY(npoints, 75, "H5Sget_select_npoints");
/* Select 75 hyperslab for memory dataset */
- start[0]=0;
- stride[0]=1;
- count[0]=75;
- block[0]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ stride[0] = 1;
+ count[0] = 75;
+ block[0] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
@@ -5854,27 +6138,29 @@ test_select_hyper_nota_2d(void)
CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Read entire dataset from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Initialize write buffer */
- for(i=0, tbuf=rbuf, tbuf2=wbuf; i<SPACE2_DIM1; i++)
- for(j=0; j<SPACE2_DIM2; j++, tbuf++) {
- if(((i>=10 && i<=14) && (j>=5 && j<=14)) ||
- ((i>=5 && i<=9) && (j>=10 && j<=14))) {
- if(*tbuf!=*tbuf2)
- TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2);
+ for (i = 0, tbuf = rbuf, tbuf2 = wbuf; i < SPACE2_DIM1; i++)
+ for (j = 0; j < SPACE2_DIM2; j++, tbuf++) {
+ if (((i >= 10 && i <= 14) && (j >= 5 && j <= 14)) ||
+ ((i >= 5 && i <= 9) && (j >= 10 && j <= 14))) {
+ if (*tbuf != *tbuf2)
+ TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",
+ __LINE__, i, j, (int)*tbuf, (int)*tbuf2);
tbuf2++;
} /* end if */
else {
- if(*tbuf!=0)
- TestErrPrintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf);
+ if (*tbuf != 0)
+ TestErrPrintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n", __LINE__,
+ i, j, (int)*tbuf);
} /* end else */
- } /* end for */
+ } /* end for */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -5895,7 +6181,7 @@ test_select_hyper_nota_2d(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_nota_2d() */
+} /* test_select_hyper_nota_2d() */
/****************************************************************
**
@@ -5903,29 +6189,30 @@ test_select_hyper_nota_2d(void)
**
****************************************************************/
static herr_t
-test_select_hyper_iter2(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndim, const hsize_t *point, void *_operator_data)
+test_select_hyper_iter2(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndim, const hsize_t *point,
+ void *_operator_data)
{
- int *tbuf=(int *)_elem, /* temporary buffer pointer */
- **tbuf2=(int **)_operator_data; /* temporary buffer handle */
- unsigned u; /* Local counting variable */
+ int *tbuf = (int *)_elem, /* temporary buffer pointer */
+ **tbuf2 = (int **)_operator_data; /* temporary buffer handle */
+ unsigned u; /* Local counting variable */
- if(*tbuf!=**tbuf2) {
+ if (*tbuf != **tbuf2) {
TestErrPrintf("Error in hyperslab iteration!\n");
HDprintf("location: { ");
- for(u=0; u<ndim; u++) {
- HDprintf("%2d",(int)point[u]);
- if(u<(ndim-1))
+ for (u = 0; u < ndim; u++) {
+ HDprintf("%2d", (int)point[u]);
+ if (u < (ndim - 1))
HDprintf(", ");
} /* end for */
HDprintf("}\n");
- HDprintf("*tbuf=%d, **tbuf2=%d\n",*tbuf,**tbuf2);
- return(-1);
+ HDprintf("*tbuf=%d, **tbuf2=%d\n", *tbuf, **tbuf2);
+ return (-1);
} /* end if */
else {
(*tbuf2)++;
- return(0);
+ return (0);
}
-} /* end test_select_hyper_iter2() */
+} /* end test_select_hyper_iter2() */
/****************************************************************
**
@@ -5936,22 +6223,22 @@ test_select_hyper_iter2(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndim
static void
test_select_hyper_union_random_5d(hid_t read_plist)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE5_DIM1, SPACE5_DIM2, SPACE5_DIM3, SPACE5_DIM4, SPACE5_DIM5};
- hsize_t dims2[] = {SPACE6_DIM1};
- hsize_t start[SPACE5_RANK]; /* Starting location of hyperslab */
- hsize_t count[SPACE5_RANK]; /* Element count of hyperslab */
- int *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j,k,l,m; /* Counters */
- herr_t ret; /* Generic return value */
- hssize_t npoints, /* Number of elements in file selection */
- npoints2; /* Number of elements in memory selection */
- unsigned seed; /* Random number seed for each test */
- unsigned test_num; /* Count of tests being executed */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE5_DIM1, SPACE5_DIM2, SPACE5_DIM3, SPACE5_DIM4, SPACE5_DIM5};
+ hsize_t dims2[] = {SPACE6_DIM1};
+ hsize_t start[SPACE5_RANK]; /* Starting location of hyperslab */
+ hsize_t count[SPACE5_RANK]; /* Element count of hyperslab */
+ int * wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j, k, l, m; /* Counters */
+ herr_t ret; /* Generic return value */
+ hssize_t npoints, /* Number of elements in file selection */
+ npoints2; /* Number of elements in memory selection */
+ unsigned seed; /* Random number seed for each test */
+ unsigned test_num; /* Count of tests being executed */
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab Selection Functions with random unions of 5-D hyperslabs\n"));
@@ -5959,16 +6246,19 @@ test_select_hyper_union_random_5d(hid_t read_plist)
/* Allocate write & read buffers */
wbuf = (int *)HDmalloc(sizeof(int) * SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5);
CHECK_PTR(wbuf, "HDmalloc");
- rbuf = (int *)HDcalloc(sizeof(int), (size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5));
+ rbuf = (int *)HDcalloc(sizeof(int),
+ (size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5));
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE5_DIM1; i++)
- for(j=0; j<SPACE5_DIM2; j++)
- for(k=0; k<SPACE5_DIM3; k++)
- for(l=0; l<SPACE5_DIM4; l++)
- for(m=0; m<SPACE5_DIM5; m++)
- *tbuf++=(int)(((((((i*SPACE5_DIM2)+j)*SPACE5_DIM3)+k)*SPACE5_DIM4)+l)*SPACE5_DIM5)+m;
+ for (i = 0, tbuf = wbuf; i < SPACE5_DIM1; i++)
+ for (j = 0; j < SPACE5_DIM2; j++)
+ for (k = 0; k < SPACE5_DIM3; k++)
+ for (l = 0; l < SPACE5_DIM4; l++)
+ for (m = 0; m < SPACE5_DIM5; m++)
+ *tbuf++ = (int)(((((((i * SPACE5_DIM2) + j) * SPACE5_DIM3) + k) * SPACE5_DIM4) + l) *
+ SPACE5_DIM5) +
+ m;
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -5983,7 +6273,7 @@ test_select_hyper_union_random_5d(hid_t read_plist)
CHECK(dataset, FAIL, "H5Dcreate2");
/* Write entire dataset to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Create dataspace for reading buffer */
@@ -5994,27 +6284,28 @@ test_select_hyper_union_random_5d(hid_t read_plist)
seed = (unsigned)HDtime(NULL) + (unsigned)HDclock();
/* Crunch through a bunch of random hyperslab reads from the file dataset */
- for(test_num=0; test_num<NRAND_HYPER; test_num++) {
+ for (test_num = 0; test_num < NRAND_HYPER; test_num++) {
/* Save random # seed for later use */
/* (Used in case of errors, to regenerate the hyperslab sequence) */
seed += (unsigned)HDclock();
HDsrandom(seed);
- for(i=0; i<NHYPERSLABS; i++) {
+ for (i = 0; i < NHYPERSLABS; i++) {
/* Select random hyperslab location & size for selection */
- for(j=0; j<SPACE5_RANK; j++) {
+ for (j = 0; j < SPACE5_RANK; j++) {
start[j] = ((hsize_t)HDrandom() % dims1[j]);
count[j] = (((hsize_t)HDrandom() % (dims1[j] - start[j])) + 1);
} /* end for */
/* Select hyperslab */
- ret = H5Sselect_hyperslab(sid1, (i == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, NULL, count, NULL);
+ ret = H5Sselect_hyperslab(sid1, (i == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, NULL, count,
+ NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- if(ret < 0) {
+ if (ret < 0) {
TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed);
break;
} /* end if */
- } /* end for */
+ } /* end for */
/* Get the number of elements selected */
npoints = H5Sget_select_npoints(sid1);
@@ -6023,24 +6314,24 @@ test_select_hyper_union_random_5d(hid_t read_plist)
/* Select linear 1-D hyperslab for memory dataset */
start[0] = 0;
count[0] = (hsize_t)npoints;
- ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints2 = H5Sget_select_npoints(sid2);
VERIFY(npoints, npoints2, "H5Sget_select_npoints");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_INT,sid2,sid1,read_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_INT, sid2, sid1, read_plist, rbuf);
CHECK(ret, FAIL, "H5Dread");
- if(ret < 0) {
+ if (ret < 0) {
TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed);
break;
} /* end if */
/* Compare data read with data written out */
- tbuf=rbuf;
- ret = H5Diterate(wbuf,H5T_NATIVE_INT,sid1,test_select_hyper_iter2,&tbuf);
- if(ret < 0) {
+ tbuf = rbuf;
+ ret = H5Diterate(wbuf, H5T_NATIVE_INT, sid1, test_select_hyper_iter2, &tbuf);
+ if (ret < 0) {
TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed);
break;
} /* end if */
@@ -6068,7 +6359,7 @@ test_select_hyper_union_random_5d(hid_t read_plist)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_union_random_5d() */
+} /* test_select_hyper_union_random_5d() */
/****************************************************************
**
@@ -6079,30 +6370,30 @@ test_select_hyper_union_random_5d(hid_t read_plist)
static void
test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
{
- hsize_t dimsf[3]; /* dataset dimensions */
- hsize_t chunk_dimsf[3] = {CHUNK_X, CHUNK_Y, CHUNK_Z}; /* chunk sizes */
- short *data; /* data to write */
- short *tmpdata; /* data to write */
+ hsize_t dimsf[3]; /* dataset dimensions */
+ hsize_t chunk_dimsf[3] = {CHUNK_X, CHUNK_Y, CHUNK_Z}; /* chunk sizes */
+ short * data; /* data to write */
+ short * tmpdata; /* data to write */
/*
* Data and output buffer initialization.
*/
- hid_t file, dataset; /* handles */
- hid_t dataspace;
- hid_t memspace;
- hid_t plist;
- hsize_t dimsm[3]; /* memory space dimensions */
- hsize_t dims_out[3]; /* dataset dimensions */
- herr_t status;
-
- short *data_out; /* output buffer */
- short *tmpdata_out; /* output buffer */
-
- hsize_t count[3]; /* size of the hyperslab in the file */
- hsize_t offset[3]; /* hyperslab offset in the file */
- hsize_t count_out[3]; /* size of the hyperslab in memory */
- hsize_t offset_out[3]; /* hyperslab offset in memory */
- int i, j, k, status_n, rank;
+ hid_t file, dataset; /* handles */
+ hid_t dataspace;
+ hid_t memspace;
+ hid_t plist;
+ hsize_t dimsm[3]; /* memory space dimensions */
+ hsize_t dims_out[3]; /* dataset dimensions */
+ herr_t status;
+
+ short *data_out; /* output buffer */
+ short *tmpdata_out; /* output buffer */
+
+ hsize_t count[3]; /* size of the hyperslab in the file */
+ hsize_t offset[3]; /* hyperslab offset in the file */
+ hsize_t count_out[3]; /* size of the hyperslab in memory */
+ hsize_t offset_out[3]; /* hyperslab offset in memory */
+ int i, j, k, status_n, rank;
/* Output message about test being performed */
MESSAGE(5, ("Testing Hyperslab I/O on Large Chunks\n"));
@@ -6120,24 +6411,24 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
for (j = 0; j < X; j++)
for (i = 0; i < Y; i++)
for (k = 0; k < Z; k++)
- *tmpdata++ = (short)((k+1)%256);
+ *tmpdata++ = (short)((k + 1) % 256);
/*
* Create a new file using H5F_ACC_TRUNC access,
* the default file creation properties, and the default file
* access properties.
*/
- file = H5Fcreate (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_plist);
+ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_plist);
CHECK(file, FAIL, "H5Fcreate");
/*
* Describe the size of the array and create the dataspace for fixed
* size dataset.
*/
- dimsf[0] = X;
- dimsf[1] = Y;
- dimsf[2] = Z;
- dataspace = H5Screate_simple (RANK_F, dimsf, NULL);
+ dimsf[0] = X;
+ dimsf[1] = Y;
+ dimsf[2] = Z;
+ dataspace = H5Screate_simple(RANK_F, dimsf, NULL);
CHECK(dataspace, FAIL, "H5Screate_simple");
/*
@@ -6160,8 +6451,7 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
count[0] = NX_SUB;
count[1] = NY_SUB;
count[2] = NZ_SUB;
- status = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, offset, NULL,
- count, NULL);
+ status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, count, NULL);
CHECK(status, FAIL, "H5Sselect_hyperslab");
/*
@@ -6170,7 +6460,7 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
dimsm[0] = NX;
dimsm[1] = NY;
dimsm[2] = NZ;
- memspace = H5Screate_simple (RANK_M, dimsm, NULL);
+ memspace = H5Screate_simple(RANK_M, dimsm, NULL);
CHECK(memspace, FAIL, "H5Screate_simple");
/*
@@ -6182,39 +6472,36 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
count_out[0] = NX_SUB;
count_out[1] = NY_SUB;
count_out[2] = NZ_SUB;
- status = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, offset_out, NULL,
- count_out, NULL);
+ status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, count_out, NULL);
CHECK(status, FAIL, "H5Sselect_hyperslab");
/*
* Write the data to the dataset using hyperslabs
*/
- status = H5Dwrite (dataset, H5T_NATIVE_SHORT, memspace, dataspace,
- xfer_plist, data);
+ status = H5Dwrite(dataset, H5T_NATIVE_SHORT, memspace, dataspace, xfer_plist, data);
CHECK(status, FAIL, "H5Dwrite");
/*
* Close/release resources.
*/
- status=H5Pclose (plist);
+ status = H5Pclose(plist);
CHECK(status, FAIL, "H5Pclose");
- status=H5Sclose (dataspace);
+ status = H5Sclose(dataspace);
CHECK(status, FAIL, "H5Sclose");
- status=H5Sclose (memspace);
+ status = H5Sclose(memspace);
CHECK(status, FAIL, "H5Sclose");
- status=H5Dclose (dataset);
+ status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
- status=H5Fclose (file);
+ status = H5Fclose(file);
CHECK(status, FAIL, "H5Fclose");
+ /*************************************************************
-/*************************************************************
+ This reads the hyperslab from the test.h5 file just
+ created, into a 3-dimensional plane of the 3-dimensional
+ array.
- This reads the hyperslab from the test.h5 file just
- created, into a 3-dimensional plane of the 3-dimensional
- array.
-
- ************************************************************/
+ ************************************************************/
/*
* Open the file and the dataset.
@@ -6224,7 +6511,7 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dopen2");
- dataspace = H5Dget_space(dataset); /* dataspace handle */
+ dataspace = H5Dget_space(dataset); /* dataspace handle */
CHECK(dataspace, FAIL, "H5Dget_space");
rank = H5Sget_simple_extent_ndims(dataspace);
VERIFY(rank, 3, "H5Sget_simple_extent_ndims");
@@ -6243,8 +6530,7 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
count[0] = NX_SUB;
count[1] = NY_SUB;
count[2] = NZ_SUB;
- status = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, offset, NULL,
- count, NULL);
+ status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, count, NULL);
CHECK(status, FAIL, "H5Sselect_hyperslab");
/*
@@ -6253,7 +6539,7 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
dimsm[0] = NX;
dimsm[1] = NY;
dimsm[2] = NZ;
- memspace = H5Screate_simple (RANK_M, dimsm, NULL);
+ memspace = H5Screate_simple(RANK_M, dimsm, NULL);
CHECK(memspace, FAIL, "H5Screate_simple");
/*
@@ -6265,42 +6551,41 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
count_out[0] = NX_SUB;
count_out[1] = NY_SUB;
count_out[2] = NZ_SUB;
- status = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, offset_out, NULL,
- count_out, NULL);
+ status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, count_out, NULL);
CHECK(status, FAIL, "H5Sselect_hyperslab");
/*
* Read data from hyperslab in the file into the hyperslab in
* memory and display.
*/
- status = H5Dread (dataset, H5T_NATIVE_SHORT, memspace, dataspace,
- xfer_plist, data_out);
+ status = H5Dread(dataset, H5T_NATIVE_SHORT, memspace, dataspace, xfer_plist, data_out);
CHECK(status, FAIL, "H5Dread");
/* Compare data written with data read in */
- tmpdata = data;
+ tmpdata = data;
tmpdata_out = data_out;
for (j = 0; j < X; j++)
for (i = 0; i < Y; i++)
- for (k = 0; k < Z; k++,tmpdata++,tmpdata_out++) {
- if(*tmpdata!=*tmpdata_out)
- TestErrPrintf("Line %d: Error! j=%d, i=%d, k=%d, *tmpdata=%x, *tmpdata_out=%x\n",__LINE__,j,i,k,(unsigned)*tmpdata,(unsigned)*tmpdata_out);
+ for (k = 0; k < Z; k++, tmpdata++, tmpdata_out++) {
+ if (*tmpdata != *tmpdata_out)
+ TestErrPrintf("Line %d: Error! j=%d, i=%d, k=%d, *tmpdata=%x, *tmpdata_out=%x\n",
+ __LINE__, j, i, k, (unsigned)*tmpdata, (unsigned)*tmpdata_out);
} /* end for */
/*
* Close and release resources.
*/
- status=H5Dclose (dataset);
+ status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
- status=H5Sclose (dataspace);
+ status = H5Sclose(dataspace);
CHECK(status, FAIL, "H5Sclose");
- status=H5Sclose (memspace);
+ status = H5Sclose(memspace);
CHECK(status, FAIL, "H5Sclose");
- status=H5Fclose (file);
+ status = H5Fclose(file);
CHECK(status, FAIL, "H5Fclose");
- HDfree (data);
- HDfree (data_out);
-} /* test_select_hyper_chunk() */
+ HDfree(data);
+ HDfree(data_out);
+} /* test_select_hyper_chunk() */
/****************************************************************
**
@@ -6312,29 +6597,29 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
static void
test_select_point_chunk(void)
{
- hsize_t dimsf[SPACE7_RANK]; /* dataset dimensions */
- hsize_t chunk_dimsf[SPACE7_RANK] = {SPACE7_CHUNK_DIM1,SPACE7_CHUNK_DIM2}; /* chunk sizes */
- unsigned *data; /* data to write */
- unsigned *tmpdata; /* data to write */
+ hsize_t dimsf[SPACE7_RANK]; /* dataset dimensions */
+ hsize_t chunk_dimsf[SPACE7_RANK] = {SPACE7_CHUNK_DIM1, SPACE7_CHUNK_DIM2}; /* chunk sizes */
+ unsigned *data; /* data to write */
+ unsigned *tmpdata; /* data to write */
/*
* Data and output buffer initialization.
*/
- hid_t file, dataset; /* handles */
- hid_t dataspace;
- hid_t pnt1_space; /* Dataspace to hold 1st point selection */
- hid_t pnt2_space; /* Dataspace to hold 2nd point selection */
- hid_t hyp1_space; /* Dataspace to hold 1st hyperslab selection */
- hid_t hyp2_space; /* Dataspace to hold 2nd hyperslab selection */
- hid_t dcpl;
- herr_t ret; /* Generic return value */
-
- unsigned *data_out; /* output buffer */
-
- hsize_t start[SPACE7_RANK]; /* hyperslab offset */
- hsize_t count[SPACE7_RANK]; /* size of the hyperslab */
- hsize_t points[SPACE7_NPOINTS][SPACE7_RANK]; /* points for selection */
- unsigned i, j; /* Local index variables */
+ hid_t file, dataset; /* handles */
+ hid_t dataspace;
+ hid_t pnt1_space; /* Dataspace to hold 1st point selection */
+ hid_t pnt2_space; /* Dataspace to hold 2nd point selection */
+ hid_t hyp1_space; /* Dataspace to hold 1st hyperslab selection */
+ hid_t hyp2_space; /* Dataspace to hold 2nd hyperslab selection */
+ hid_t dcpl;
+ herr_t ret; /* Generic return value */
+
+ unsigned *data_out; /* output buffer */
+
+ hsize_t start[SPACE7_RANK]; /* hyperslab offset */
+ hsize_t count[SPACE7_RANK]; /* size of the hyperslab */
+ hsize_t points[SPACE7_NPOINTS][SPACE7_RANK]; /* points for selection */
+ unsigned i, j; /* Local index variables */
/* Output message about test being performed */
MESSAGE(5, ("Testing Point Selections on Chunked Datasets\n"));
@@ -6351,20 +6636,20 @@ test_select_point_chunk(void)
tmpdata = data;
for (i = 0; i < SPACE7_DIM1; i++)
for (j = 0; j < SPACE7_DIM1; j++)
- *tmpdata++ = ((i*SPACE7_DIM2)+j)%256;
+ *tmpdata++ = ((i * SPACE7_DIM2) + j) % 256;
/*
* Create a new file using H5F_ACC_TRUNC access,
* the default file creation properties and file
* access properties.
*/
- file = H5Fcreate (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fcreate");
/* Create file dataspace */
- dimsf[0] = SPACE7_DIM1;
- dimsf[1] = SPACE7_DIM2;
- dataspace = H5Screate_simple (SPACE7_RANK, dimsf, NULL);
+ dimsf[0] = SPACE7_DIM1;
+ dimsf[1] = SPACE7_DIM2;
+ dataspace = H5Screate_simple(SPACE7_RANK, dimsf, NULL);
CHECK(dataspace, FAIL, "H5Screate_simple");
/*
@@ -6379,75 +6664,79 @@ test_select_point_chunk(void)
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create 1st point selection */
- pnt1_space = H5Scopy (dataspace);
+ pnt1_space = H5Scopy(dataspace);
CHECK(pnt1_space, FAIL, "H5Scopy");
- points[0][0]=3;
- points[0][1]=3;
- points[1][0]=3;
- points[1][1]=8;
- points[2][0]=8;
- points[2][1]=3;
- points[3][0]=8;
- points[3][1]=8;
- points[4][0]=1; /* In same chunk as point #0, but "earlier" in chunk */
- points[4][1]=1;
- points[5][0]=1; /* In same chunk as point #1, but "earlier" in chunk */
- points[5][1]=6;
- points[6][0]=6; /* In same chunk as point #2, but "earlier" in chunk */
- points[6][1]=1;
- points[7][0]=6; /* In same chunk as point #3, but "earlier" in chunk */
- points[7][1]=6;
+ points[0][0] = 3;
+ points[0][1] = 3;
+ points[1][0] = 3;
+ points[1][1] = 8;
+ points[2][0] = 8;
+ points[2][1] = 3;
+ points[3][0] = 8;
+ points[3][1] = 8;
+ points[4][0] = 1; /* In same chunk as point #0, but "earlier" in chunk */
+ points[4][1] = 1;
+ points[5][0] = 1; /* In same chunk as point #1, but "earlier" in chunk */
+ points[5][1] = 6;
+ points[6][0] = 6; /* In same chunk as point #2, but "earlier" in chunk */
+ points[6][1] = 1;
+ points[7][0] = 6; /* In same chunk as point #3, but "earlier" in chunk */
+ points[7][1] = 6;
ret = H5Sselect_elements(pnt1_space, H5S_SELECT_SET, (size_t)SPACE7_NPOINTS, (const hsize_t *)points);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create 1st hyperslab selection */
- hyp1_space = H5Scopy (dataspace);
+ hyp1_space = H5Scopy(dataspace);
CHECK(hyp1_space, FAIL, "H5Scopy");
- start[0]=2; start[1]=2;
- count[0]=4; count[1]=2;
- ret = H5Sselect_hyperslab(hyp1_space,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 2;
+ start[1] = 2;
+ count[0] = 4;
+ count[1] = 2;
+ ret = H5Sselect_hyperslab(hyp1_space, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Write out data using 1st point selection for file & hyperslab for memory */
- ret=H5Dwrite(dataset,H5T_NATIVE_UINT,hyp1_space,pnt1_space,H5P_DEFAULT,data);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, hyp1_space, pnt1_space, H5P_DEFAULT, data);
CHECK(ret, FAIL, "H5Dwrite");
/* Create 2nd point selection */
- pnt2_space = H5Scopy (dataspace);
+ pnt2_space = H5Scopy(dataspace);
CHECK(pnt2_space, FAIL, "H5Scopy");
- points[0][0]=4;
- points[0][1]=4;
- points[1][0]=4;
- points[1][1]=9;
- points[2][0]=9;
- points[2][1]=4;
- points[3][0]=9;
- points[3][1]=9;
- points[4][0]=2; /* In same chunk as point #0, but "earlier" in chunk */
- points[4][1]=2;
- points[5][0]=2; /* In same chunk as point #1, but "earlier" in chunk */
- points[5][1]=7;
- points[6][0]=7; /* In same chunk as point #2, but "earlier" in chunk */
- points[6][1]=2;
- points[7][0]=7; /* In same chunk as point #3, but "earlier" in chunk */
- points[7][1]=7;
+ points[0][0] = 4;
+ points[0][1] = 4;
+ points[1][0] = 4;
+ points[1][1] = 9;
+ points[2][0] = 9;
+ points[2][1] = 4;
+ points[3][0] = 9;
+ points[3][1] = 9;
+ points[4][0] = 2; /* In same chunk as point #0, but "earlier" in chunk */
+ points[4][1] = 2;
+ points[5][0] = 2; /* In same chunk as point #1, but "earlier" in chunk */
+ points[5][1] = 7;
+ points[6][0] = 7; /* In same chunk as point #2, but "earlier" in chunk */
+ points[6][1] = 2;
+ points[7][0] = 7; /* In same chunk as point #3, but "earlier" in chunk */
+ points[7][1] = 7;
ret = H5Sselect_elements(pnt2_space, H5S_SELECT_SET, (size_t)SPACE7_NPOINTS, (const hsize_t *)points);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create 2nd hyperslab selection */
- hyp2_space = H5Scopy (dataspace);
+ hyp2_space = H5Scopy(dataspace);
CHECK(hyp2_space, FAIL, "H5Scopy");
- start[0]=2; start[1]=4;
- count[0]=4; count[1]=2;
- ret = H5Sselect_hyperslab(hyp2_space,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 2;
+ start[1] = 4;
+ count[0] = 4;
+ count[1] = 2;
+ ret = H5Sselect_hyperslab(hyp2_space, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Write out data using 2nd hyperslab selection for file & point for memory */
- ret=H5Dwrite(dataset,H5T_NATIVE_UINT,pnt2_space,hyp2_space,H5P_DEFAULT,data);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, pnt2_space, hyp2_space, H5P_DEFAULT, data);
CHECK(ret, FAIL, "H5Dwrite");
/* Close everything (except selections) */
@@ -6470,13 +6759,13 @@ test_select_point_chunk(void)
ret = H5Dread(dataset, H5T_NATIVE_UINT, hyp1_space, pnt1_space, H5P_DEFAULT, data_out);
CHECK(ret, FAIL, "H5Dread");
-/* Verify data (later) */
+ /* Verify data (later) */
/* Read data using 2nd hyperslab selection for file and point for memory */
ret = H5Dread(dataset, H5T_NATIVE_UINT, pnt2_space, hyp2_space, H5P_DEFAULT, data_out);
CHECK(ret, FAIL, "H5Dread");
-/* Verify data (later) */
+ /* Verify data (later) */
/* Close everything (inclusing selections) */
ret = H5Sclose(pnt1_space);
@@ -6493,8 +6782,8 @@ test_select_point_chunk(void)
CHECK(ret, FAIL, "H5Fclose");
HDfree(data);
- HDfree (data_out);
-} /* test_select_point_chunk() */
+ HDfree(data_out);
+} /* test_select_point_chunk() */
/****************************************************************
**
@@ -6505,17 +6794,17 @@ test_select_point_chunk(void)
static void
test_select_scalar_chunk(void)
{
- hid_t file_id; /* File ID */
- hid_t dcpl; /* Dataset creation property list */
- hid_t dsid; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t m_sid; /* Memory dataspace */
- hsize_t dims[] = {2}; /* Dataset dimensions */
- hsize_t maxdims[] = {H5S_UNLIMITED}; /* Dataset maximum dimensions */
- hsize_t offset[] = {0}; /* Hyperslab start */
- hsize_t count[] = {1}; /* Hyperslab count */
- unsigned data = 2; /* Data to write */
- herr_t ret;
+ hid_t file_id; /* File ID */
+ hid_t dcpl; /* Dataset creation property list */
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t m_sid; /* Memory dataspace */
+ hsize_t dims[] = {2}; /* Dataset dimensions */
+ hsize_t maxdims[] = {H5S_UNLIMITED}; /* Dataset maximum dimensions */
+ hsize_t offset[] = {0}; /* Hyperslab start */
+ hsize_t count[] = {1}; /* Hyperslab count */
+ unsigned data = 2; /* Data to write */
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing Scalar Dataspaces and Chunked Datasets\n"));
@@ -6527,7 +6816,7 @@ test_select_scalar_chunk(void)
CHECK(dcpl, FAIL, "H5Pcreate");
dims[0] = 1024U;
- ret = H5Pset_chunk(dcpl, 1, dims);
+ ret = H5Pset_chunk(dcpl, 1, dims);
CHECK(ret, FAIL, "H5Pset_chunk");
/* Create 1-D dataspace */
@@ -6546,7 +6835,7 @@ test_select_scalar_chunk(void)
CHECK(m_sid, FAIL, "H5Screate");
/* Write out data using scalar dataspace for memory dataspace */
- ret = H5Dwrite (dsid, H5T_NATIVE_UINT, m_sid, sid, H5P_DEFAULT, &data);
+ ret = H5Dwrite(dsid, H5T_NATIVE_UINT, m_sid, sid, H5P_DEFAULT, &data);
CHECK(ret, FAIL, "H5Dwrite");
/* Close resources */
@@ -6558,9 +6847,9 @@ test_select_scalar_chunk(void)
CHECK(ret, FAIL, "H5Dclose");
ret = H5Pclose(dcpl);
CHECK(ret, FAIL, "H5Pclose");
- ret = H5Fclose (file_id);
+ ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_select_scalar_chunk() */
+} /* test_select_scalar_chunk() */
/****************************************************************
**
@@ -6571,111 +6860,114 @@ test_select_scalar_chunk(void)
static void
test_select_valid(void)
{
- herr_t error;
- htri_t valid;
- hid_t main_space, sub_space;
- hsize_t safe_start[2]={1,1};
- hsize_t safe_count[2]={1,1};
+ herr_t error;
+ htri_t valid;
+ hid_t main_space, sub_space;
+ hsize_t safe_start[2] = {1, 1};
+ hsize_t safe_count[2] = {1, 1};
hsize_t start[2];
- hsize_t dims[2],maxdims[2],size[2],count[2];
+ hsize_t dims[2], maxdims[2], size[2], count[2];
/* Output message about test being performed */
MESSAGE(5, ("Testing Selection Validity\n"));
- MESSAGE(8, ( "Case 1 : sub_space is not a valid dataspace\n"));
+ MESSAGE(8, ("Case 1 : sub_space is not a valid dataspace\n"));
dims[0] = dims[1] = H5S_UNLIMITED;
- sub_space = H5Screate_simple(2,dims,NULL);
+ sub_space = H5Screate_simple(2, dims, NULL);
VERIFY(sub_space, FAIL, "H5Screate_simple");
- valid=H5Sselect_valid(sub_space);
+ valid = H5Sselect_valid(sub_space);
VERIFY(valid, FAIL, "H5Sselect_valid");
/* Set arrays and dataspace for the rest of the cases */
count[0] = count[1] = 1;
dims[0] = dims[1] = maxdims[0] = maxdims[1] = 10;
- main_space = H5Screate_simple(2,dims,maxdims);
+ main_space = H5Screate_simple(2, dims, maxdims);
CHECK(main_space, FAIL, "H5Screate_simple");
- MESSAGE(8, ( "Case 2 : sub_space is a valid but closed dataspace\n"));
+ MESSAGE(8, ("Case 2 : sub_space is a valid but closed dataspace\n"));
sub_space = H5Scopy(main_space);
CHECK(sub_space, FAIL, "H5Scopy");
- error=H5Sclose(sub_space);
+ error = H5Sclose(sub_space);
CHECK(error, FAIL, "H5Sclose");
- valid=H5Sselect_valid(sub_space);
+ valid = H5Sselect_valid(sub_space);
VERIFY(valid, FAIL, "H5Sselect_valid");
- MESSAGE(8, ( "Case 3 : in the dimensions\nTry offset (4,4) and size(6,6), the original space is of size (10,10)\n"));
+ MESSAGE(8, ("Case 3 : in the dimensions\nTry offset (4,4) and size(6,6), the original space is of size "
+ "(10,10)\n"));
start[0] = start[1] = 4;
size[0] = size[1] = 6;
sub_space = H5Scopy(main_space);
CHECK(sub_space, FAIL, "H5Scopy");
- error=H5Sselect_hyperslab(sub_space,H5S_SELECT_SET,start,size,count,size);
+ error = H5Sselect_hyperslab(sub_space, H5S_SELECT_SET, start, size, count, size);
CHECK(error, FAIL, "H5Sselect_hyperslab");
- valid=H5Sselect_valid(sub_space);
+ valid = H5Sselect_valid(sub_space);
VERIFY(valid, TRUE, "H5Sselect_valid");
- error=H5Sselect_hyperslab(sub_space,H5S_SELECT_OR,safe_start,NULL,safe_count,NULL);
+ error = H5Sselect_hyperslab(sub_space, H5S_SELECT_OR, safe_start, NULL, safe_count, NULL);
CHECK(error, FAIL, "H5Sselect_hyperslab");
- valid=H5Sselect_valid(sub_space);
+ valid = H5Sselect_valid(sub_space);
VERIFY(valid, TRUE, "H5Sselect_valid");
- error=H5Sclose(sub_space);
+ error = H5Sclose(sub_space);
CHECK(error, FAIL, "H5Sclose");
- MESSAGE(8, ( "Case 4 : exceed dimensions by 1\nTry offset (5,5) and size(6,6), the original space is of size (10,10)\n"));
+ MESSAGE(8, ("Case 4 : exceed dimensions by 1\nTry offset (5,5) and size(6,6), the original space is of "
+ "size (10,10)\n"));
start[0] = start[1] = 5;
size[0] = size[1] = 6;
sub_space = H5Scopy(main_space);
CHECK(sub_space, FAIL, "H5Scopy");
- error=H5Sselect_hyperslab(sub_space,H5S_SELECT_SET,start,size,count,size);
+ error = H5Sselect_hyperslab(sub_space, H5S_SELECT_SET, start, size, count, size);
CHECK(error, FAIL, "H5Sselect_hyperslab");
- valid=H5Sselect_valid(sub_space);
+ valid = H5Sselect_valid(sub_space);
VERIFY(valid, FALSE, "H5Sselect_valid");
- error=H5Sselect_hyperslab(sub_space,H5S_SELECT_OR,safe_start,NULL,safe_count,NULL);
+ error = H5Sselect_hyperslab(sub_space, H5S_SELECT_OR, safe_start, NULL, safe_count, NULL);
CHECK(error, FAIL, "H5Sselect_hyperslab");
- valid=H5Sselect_valid(sub_space);
+ valid = H5Sselect_valid(sub_space);
VERIFY(valid, FALSE, "H5Sselect_valid");
- error=H5Sclose(sub_space);
+ error = H5Sclose(sub_space);
CHECK(error, FAIL, "H5Sclose");
- MESSAGE(8, ( "Case 5 : exceed dimensions by 2\nTry offset (6,6) and size(6,6), the original space is of size (10,10)\n"));
+ MESSAGE(8, ("Case 5 : exceed dimensions by 2\nTry offset (6,6) and size(6,6), the original space is of "
+ "size (10,10)\n"));
start[0] = start[1] = 6;
size[0] = size[1] = 6;
sub_space = H5Scopy(main_space);
CHECK(sub_space, FAIL, "H5Scopy");
- error=H5Sselect_hyperslab(sub_space,H5S_SELECT_SET,start,size,count,size);
+ error = H5Sselect_hyperslab(sub_space, H5S_SELECT_SET, start, size, count, size);
CHECK(error, FAIL, "H5Sselect_hyperslab");
- valid=H5Sselect_valid(sub_space);
+ valid = H5Sselect_valid(sub_space);
VERIFY(valid, FALSE, "H5Sselect_valid");
- error=H5Sselect_hyperslab(sub_space,H5S_SELECT_OR,safe_start,NULL,safe_count,NULL);
+ error = H5Sselect_hyperslab(sub_space, H5S_SELECT_OR, safe_start, NULL, safe_count, NULL);
CHECK(error, FAIL, "H5Sselect_hyperslab");
- valid=H5Sselect_valid(sub_space);
+ valid = H5Sselect_valid(sub_space);
VERIFY(valid, FALSE, "H5Sselect_valid");
- error=H5Sclose(sub_space);
+ error = H5Sclose(sub_space);
CHECK(error, FAIL, "H5Sclose");
- error=H5Sclose(main_space);
+ error = H5Sclose(main_space);
CHECK(error, FAIL, "H5Sclose");
-} /* test_select_valid() */
+} /* test_select_valid() */
/****************************************************************
**
@@ -6687,19 +6979,19 @@ test_select_valid(void)
static void
test_select_combine(void)
{
- hid_t base_id; /* Base dataspace for test */
- hid_t all_id; /* Dataspace for "all" selection */
- hid_t none_id; /* Dataspace for "none" selection */
- hid_t space1; /* Temporary dataspace #1 */
- hsize_t start[SPACE7_RANK]; /* Hyperslab start */
- hsize_t stride[SPACE7_RANK]; /* Hyperslab stride */
- hsize_t count[SPACE7_RANK]; /* Hyperslab count */
- hsize_t block[SPACE7_RANK]; /* Hyperslab block */
- hsize_t dims[SPACE7_RANK]={SPACE7_DIM1,SPACE7_DIM2}; /* Dimensions of dataspace */
- H5S_sel_type sel_type; /* Selection type */
- hssize_t nblocks; /* Number of hyperslab blocks */
- hsize_t blocks[16][2][SPACE7_RANK]; /* List of blocks */
- herr_t error;
+ hid_t base_id; /* Base dataspace for test */
+ hid_t all_id; /* Dataspace for "all" selection */
+ hid_t none_id; /* Dataspace for "none" selection */
+ hid_t space1; /* Temporary dataspace #1 */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t stride[SPACE7_RANK]; /* Hyperslab stride */
+ hsize_t count[SPACE7_RANK]; /* Hyperslab count */
+ hsize_t block[SPACE7_RANK]; /* Hyperslab block */
+ hsize_t dims[SPACE7_RANK] = {SPACE7_DIM1, SPACE7_DIM2}; /* Dimensions of dataspace */
+ H5S_sel_type sel_type; /* Selection type */
+ hssize_t nblocks; /* Number of hyperslab blocks */
+ hsize_t blocks[16][2][SPACE7_RANK]; /* List of blocks */
+ herr_t error;
/* Output message about test being performed */
MESSAGE(5, ("Testing Selection Combinations\n"));
@@ -6709,100 +7001,99 @@ test_select_combine(void)
CHECK(base_id, FAIL, "H5Screate_simple");
/* Copy base dataspace and set selection to "all" */
- all_id=H5Scopy(base_id);
+ all_id = H5Scopy(base_id);
CHECK(all_id, FAIL, "H5Scopy");
- error=H5Sselect_all(all_id);
+ error = H5Sselect_all(all_id);
CHECK(error, FAIL, "H5Sselect_all");
- sel_type=H5Sget_select_type(all_id);
+ sel_type = H5Sget_select_type(all_id);
VERIFY(sel_type, H5S_SEL_ALL, "H5Sget_select_type");
/* Copy base dataspace and set selection to "none" */
- none_id=H5Scopy(base_id);
+ none_id = H5Scopy(base_id);
CHECK(none_id, FAIL, "H5Scopy");
- error=H5Sselect_none(none_id);
+ error = H5Sselect_none(none_id);
CHECK(error, FAIL, "H5Sselect_none");
- sel_type=H5Sget_select_type(none_id);
+ sel_type = H5Sget_select_type(none_id);
VERIFY(sel_type, H5S_SEL_NONE, "H5Sget_select_type");
-
/* Copy "all" selection & space */
- space1=H5Scopy(all_id);
+ space1 = H5Scopy(all_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'OR' "all" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_OR, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that it's still "all" selection */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_ALL, "H5Sget_select_type");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
/* Copy "all" selection & space */
- space1=H5Scopy(all_id);
+ space1 = H5Scopy(all_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'AND' "all" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_AND,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_AND, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that the new selection is the same at the original block */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
/* Verify that there is only one block */
- nblocks=H5Sget_select_hyper_nblocks(space1);
+ nblocks = H5Sget_select_hyper_nblocks(space1);
VERIFY(nblocks, 1, "H5Sget_select_hyper_nblocks");
/* Retrieve the block defined */
- HDmemset(blocks,-1,sizeof(blocks)); /* Reset block list */
- error=H5Sget_select_hyper_blocklist(space1,(hsize_t)0,(hsize_t)nblocks,(hsize_t *)blocks);
+ HDmemset(blocks, -1, sizeof(blocks)); /* Reset block list */
+ error = H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks, (hsize_t *)blocks);
CHECK(error, FAIL, "H5Sget_select_hyper_blocklist");
/* Verify that the correct block is defined */
VERIFY(blocks[0][0][0], (hsize_t)start[0], "H5Sget_select_hyper_blocklist");
VERIFY(blocks[0][0][1], (hsize_t)start[1], "H5Sget_select_hyper_blocklist");
- VERIFY(blocks[0][1][0], (block[0]-1), "H5Sget_select_hyper_blocklist");
- VERIFY(blocks[0][1][1], (block[1]-1), "H5Sget_select_hyper_blocklist");
+ VERIFY(blocks[0][1][0], (block[0] - 1), "H5Sget_select_hyper_blocklist");
+ VERIFY(blocks[0][1][1], (block[1] - 1), "H5Sget_select_hyper_blocklist");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
/* Copy "all" selection & space */
- space1=H5Scopy(all_id);
+ space1 = H5Scopy(all_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'XOR' "all" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_XOR,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_XOR, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that the new selection is an inversion of the original block */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
/* Verify that there are two blocks */
- nblocks=H5Sget_select_hyper_nblocks(space1);
+ nblocks = H5Sget_select_hyper_nblocks(space1);
VERIFY(nblocks, 2, "H5Sget_select_hyper_nblocks");
/* Retrieve the block defined */
- HDmemset(blocks,-1,sizeof(blocks)); /* Reset block list */
- error=H5Sget_select_hyper_blocklist(space1,(hsize_t)0,(hsize_t)nblocks,(hsize_t *)blocks);
+ HDmemset(blocks, -1, sizeof(blocks)); /* Reset block list */
+ error = H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks, (hsize_t *)blocks);
CHECK(error, FAIL, "H5Sget_select_hyper_blocklist");
/* Verify that the correct block is defined */
@@ -6816,32 +7107,32 @@ test_select_combine(void)
VERIFY(blocks[1][1][1], 9, "H5Sget_select_hyper_blocklist");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
/* Copy "all" selection & space */
- space1=H5Scopy(all_id);
+ space1 = H5Scopy(all_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'NOTB' "all" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_NOTB,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_NOTB, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that the new selection is an inversion of the original block */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
/* Verify that there are two blocks */
- nblocks=H5Sget_select_hyper_nblocks(space1);
+ nblocks = H5Sget_select_hyper_nblocks(space1);
VERIFY(nblocks, 2, "H5Sget_select_hyper_nblocks");
/* Retrieve the block defined */
- HDmemset(blocks,-1,sizeof(blocks)); /* Reset block list */
- error=H5Sget_select_hyper_blocklist(space1,(hsize_t)0,(hsize_t)nblocks,(hsize_t *)blocks);
+ HDmemset(blocks, -1, sizeof(blocks)); /* Reset block list */
+ error = H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks, (hsize_t *)blocks);
CHECK(error, FAIL, "H5Sget_select_hyper_blocklist");
/* Verify that the correct block is defined */
@@ -6855,194 +7146,192 @@ test_select_combine(void)
VERIFY(blocks[1][1][1], 9, "H5Sget_select_hyper_blocklist");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
/* Copy "all" selection & space */
- space1=H5Scopy(all_id);
+ space1 = H5Scopy(all_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'NOTA' "all" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_NOTA,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_NOTA, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that the new selection is the "none" selection */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_NONE, "H5Sget_select_type");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
-
/* Copy "none" selection & space */
- space1=H5Scopy(none_id);
+ space1 = H5Scopy(none_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'OR' "none" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_OR, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that the new selection is the same as the original hyperslab */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
/* Verify that there is only one block */
- nblocks=H5Sget_select_hyper_nblocks(space1);
+ nblocks = H5Sget_select_hyper_nblocks(space1);
VERIFY(nblocks, 1, "H5Sget_select_hyper_nblocks");
/* Retrieve the block defined */
- HDmemset(blocks,-1,sizeof(blocks)); /* Reset block list */
- error=H5Sget_select_hyper_blocklist(space1,(hsize_t)0,(hsize_t)nblocks,(hsize_t *)blocks);
+ HDmemset(blocks, -1, sizeof(blocks)); /* Reset block list */
+ error = H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks, (hsize_t *)blocks);
CHECK(error, FAIL, "H5Sget_select_hyper_blocklist");
/* Verify that the correct block is defined */
VERIFY(blocks[0][0][0], (hsize_t)start[0], "H5Sget_select_hyper_blocklist");
VERIFY(blocks[0][0][1], (hsize_t)start[1], "H5Sget_select_hyper_blocklist");
- VERIFY(blocks[0][1][0], (block[0]-1), "H5Sget_select_hyper_blocklist");
- VERIFY(blocks[0][1][1], (block[1]-1), "H5Sget_select_hyper_blocklist");
+ VERIFY(blocks[0][1][0], (block[0] - 1), "H5Sget_select_hyper_blocklist");
+ VERIFY(blocks[0][1][1], (block[1] - 1), "H5Sget_select_hyper_blocklist");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
/* Copy "none" selection & space */
- space1=H5Scopy(none_id);
+ space1 = H5Scopy(none_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'AND' "none" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_AND,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_AND, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that the new selection is the "none" selection */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_NONE, "H5Sget_select_type");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
/* Copy "none" selection & space */
- space1=H5Scopy(none_id);
+ space1 = H5Scopy(none_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'XOR' "none" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_XOR,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_XOR, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that the new selection is the same as the original hyperslab */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
/* Verify that there is only one block */
- nblocks=H5Sget_select_hyper_nblocks(space1);
+ nblocks = H5Sget_select_hyper_nblocks(space1);
VERIFY(nblocks, 1, "H5Sget_select_hyper_nblocks");
/* Retrieve the block defined */
- HDmemset(blocks,-1,sizeof(blocks)); /* Reset block list */
- error=H5Sget_select_hyper_blocklist(space1,(hsize_t)0,(hsize_t)nblocks,(hsize_t *)blocks);
+ HDmemset(blocks, -1, sizeof(blocks)); /* Reset block list */
+ error = H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks, (hsize_t *)blocks);
CHECK(error, FAIL, "H5Sget_select_hyper_blocklist");
/* Verify that the correct block is defined */
VERIFY(blocks[0][0][0], (hsize_t)start[0], "H5Sget_select_hyper_blocklist");
VERIFY(blocks[0][0][1], (hsize_t)start[1], "H5Sget_select_hyper_blocklist");
- VERIFY(blocks[0][1][0], (block[0]-1), "H5Sget_select_hyper_blocklist");
- VERIFY(blocks[0][1][1], (block[1]-1), "H5Sget_select_hyper_blocklist");
+ VERIFY(blocks[0][1][0], (block[0] - 1), "H5Sget_select_hyper_blocklist");
+ VERIFY(blocks[0][1][1], (block[1] - 1), "H5Sget_select_hyper_blocklist");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
/* Copy "none" selection & space */
- space1=H5Scopy(none_id);
+ space1 = H5Scopy(none_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'NOTB' "none" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_NOTB,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_NOTB, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that the new selection is the "none" selection */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_NONE, "H5Sget_select_type");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
/* Copy "none" selection & space */
- space1=H5Scopy(none_id);
+ space1 = H5Scopy(none_id);
CHECK(space1, FAIL, "H5Scopy");
/* 'NOTA' "none" selection with another hyperslab */
- start[0]=start[1]=0;
- stride[0]=stride[1]=1;
- count[0]=count[1]=1;
- block[0]=block[1]=5;
- error=H5Sselect_hyperslab(space1,H5S_SELECT_NOTA,start,stride,count,block);
+ start[0] = start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 1;
+ block[0] = block[1] = 5;
+ error = H5Sselect_hyperslab(space1, H5S_SELECT_NOTA, start, stride, count, block);
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Verify that the new selection is the same as the original hyperslab */
- sel_type=H5Sget_select_type(space1);
+ sel_type = H5Sget_select_type(space1);
VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type");
/* Verify that there is only one block */
- nblocks=H5Sget_select_hyper_nblocks(space1);
+ nblocks = H5Sget_select_hyper_nblocks(space1);
VERIFY(nblocks, 1, "H5Sget_select_hyper_nblocks");
/* Retrieve the block defined */
- HDmemset(blocks,-1,sizeof(blocks)); /* Reset block list */
- error=H5Sget_select_hyper_blocklist(space1,(hsize_t)0,(hsize_t)nblocks,(hsize_t *)blocks);
+ HDmemset(blocks, -1, sizeof(blocks)); /* Reset block list */
+ error = H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks, (hsize_t *)blocks);
CHECK(error, FAIL, "H5Sget_select_hyper_blocklist");
/* Verify that the correct block is defined */
VERIFY(blocks[0][0][0], (hsize_t)start[0], "H5Sget_select_hyper_blocklist");
VERIFY(blocks[0][0][1], (hsize_t)start[1], "H5Sget_select_hyper_blocklist");
- VERIFY(blocks[0][1][0], (block[0]-1), "H5Sget_select_hyper_blocklist");
- VERIFY(blocks[0][1][1], (block[1]-1), "H5Sget_select_hyper_blocklist");
+ VERIFY(blocks[0][1][0], (block[0] - 1), "H5Sget_select_hyper_blocklist");
+ VERIFY(blocks[0][1][1], (block[1] - 1), "H5Sget_select_hyper_blocklist");
/* Close temporary dataspace */
- error=H5Sclose(space1);
+ error = H5Sclose(space1);
CHECK(error, FAIL, "H5Sclose");
-
/* Close dataspaces */
- error=H5Sclose(base_id);
+ error = H5Sclose(base_id);
CHECK(error, FAIL, "H5Sclose");
- error=H5Sclose(all_id);
+ error = H5Sclose(all_id);
CHECK(error, FAIL, "H5Sclose");
- error=H5Sclose(none_id);
+ error = H5Sclose(none_id);
CHECK(error, FAIL, "H5Sclose");
-} /* test_select_combine() */
+} /* test_select_combine() */
/*
* Typedef for iteration structure used in the fill value tests
*/
typedef struct {
- unsigned short fill_value; /* The fill value to check */
- size_t curr_coord; /* Current coordinate to examine */
- hsize_t *coords; /* Pointer to selection's coordinates */
+ unsigned short fill_value; /* The fill value to check */
+ size_t curr_coord; /* Current coordinate to examine */
+ hsize_t * coords; /* Pointer to selection's coordinates */
} fill_iter_info;
/****************************************************************
@@ -7051,32 +7340,34 @@ typedef struct {
**
****************************************************************/
static herr_t
-test_select_hyper_iter3(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndim, const hsize_t *point, void *_operator_data)
+test_select_hyper_iter3(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndim, const hsize_t *point,
+ void *_operator_data)
{
- unsigned *tbuf = (unsigned *)_elem; /* temporary buffer pointer */
- fill_iter_info *iter_info = (fill_iter_info *)_operator_data; /* Get the pointer to the iterator information */
- hsize_t *coord_ptr; /* Pointer to the coordinate information for a point*/
+ unsigned * tbuf = (unsigned *)_elem; /* temporary buffer pointer */
+ fill_iter_info *iter_info =
+ (fill_iter_info *)_operator_data; /* Get the pointer to the iterator information */
+ hsize_t *coord_ptr; /* Pointer to the coordinate information for a point*/
/* Check value in current buffer location */
- if(*tbuf != iter_info->fill_value)
- return(-1);
+ if (*tbuf != iter_info->fill_value)
+ return (-1);
else {
/* Check number of dimensions */
- if(ndim != SPACE7_RANK)
- return(-1);
+ if (ndim != SPACE7_RANK)
+ return (-1);
else {
/* Check Coordinates */
coord_ptr = iter_info->coords + (2 * iter_info->curr_coord);
iter_info->curr_coord++;
- if(coord_ptr[0] != point[0])
- return(-1);
- else if(coord_ptr[1] != point[1])
- return(-1);
+ if (coord_ptr[0] != point[0])
+ return (-1);
+ else if (coord_ptr[1] != point[1])
+ return (-1);
else
- return(0);
+ return (0);
} /* end else */
- } /* end else */
-} /* end test_select_hyper_iter3() */
+ } /* end else */
+} /* end test_select_hyper_iter3() */
/****************************************************************
**
@@ -7087,15 +7378,15 @@ test_select_hyper_iter3(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndim
static void
test_select_fill_all(void)
{
- hid_t sid1; /* Dataspace ID */
- hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
- unsigned fill_value; /* Fill value */
- fill_iter_info iter_info; /* Iterator information structure */
- hsize_t points[SPACE7_DIM1*SPACE7_DIM2][SPACE7_RANK]; /* Coordinates of selection */
- unsigned *wbuf, /* buffer to write to disk */
- *tbuf; /* temporary buffer pointer */
- unsigned u, v; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t sid1; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
+ unsigned fill_value; /* Fill value */
+ fill_iter_info iter_info; /* Iterator information structure */
+ hsize_t points[SPACE7_DIM1 * SPACE7_DIM2][SPACE7_RANK]; /* Coordinates of selection */
+ unsigned * wbuf, /* buffer to write to disk */
+ *tbuf; /* temporary buffer pointer */
+ unsigned u, v; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Filling 'all' Selections\n"));
@@ -7105,8 +7396,8 @@ test_select_fill_all(void)
CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++)
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++)
*tbuf++ = (u * SPACE7_DIM2) + v;
/* Create dataspace for dataset on disk */
@@ -7123,14 +7414,14 @@ test_select_fill_all(void)
CHECK(ret, FAIL, "H5Dfill");
/* Verify memory buffer the hard way... */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++)
- if(*tbuf != fill_value)
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++)
+ if (*tbuf != fill_value)
TestErrPrintf("Error! v=%d, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, fill_value);
/* Set the coordinates of the selection */
- for(u = 0; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++) {
+ for (u = 0; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++) {
points[(u * SPACE7_DIM2) + v][0] = u;
points[(u * SPACE7_DIM2) + v][1] = v;
} /* end for */
@@ -7138,7 +7429,7 @@ test_select_fill_all(void)
/* Initialize the iterator structure */
iter_info.fill_value = SPACE7_FILL;
iter_info.curr_coord = 0;
- iter_info.coords = (hsize_t *)points;
+ iter_info.coords = (hsize_t *)points;
/* Iterate through selection, verifying correct data */
ret = H5Diterate(wbuf, H5T_NATIVE_UINT, sid1, test_select_hyper_iter3, &iter_info);
@@ -7150,7 +7441,7 @@ test_select_fill_all(void)
/* Free memory buffers */
HDfree(wbuf);
-} /* test_select_fill_all() */
+} /* test_select_fill_all() */
/****************************************************************
**
@@ -7161,17 +7452,17 @@ test_select_fill_all(void)
static void
test_select_fill_point(hssize_t *offset)
{
- hid_t sid1; /* Dataspace ID */
- hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
- hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
- hsize_t points[5][SPACE7_RANK] = {{2,4}, {3,8}, {8,4}, {7,5}, {7,7}};
- size_t num_points = 5; /* Number of points selected */
- int fill_value; /* Fill value */
- fill_iter_info iter_info; /* Iterator information structure */
- unsigned *wbuf, /* buffer to write to disk */
- *tbuf; /* temporary buffer pointer */
- unsigned u, v, w; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t sid1; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
+ hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
+ hsize_t points[5][SPACE7_RANK] = {{2, 4}, {3, 8}, {8, 4}, {7, 5}, {7, 7}};
+ size_t num_points = 5; /* Number of points selected */
+ int fill_value; /* Fill value */
+ fill_iter_info iter_info; /* Iterator information structure */
+ unsigned * wbuf, /* buffer to write to disk */
+ *tbuf; /* temporary buffer pointer */
+ unsigned u, v, w; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Filling 'point' Selections\n"));
@@ -7181,8 +7472,8 @@ test_select_fill_point(hssize_t *offset)
CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++)
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++)
*tbuf++ = (unsigned short)(u * SPACE7_DIM2) + v;
/* Create dataspace for dataset on disk */
@@ -7193,7 +7484,7 @@ test_select_fill_point(hssize_t *offset)
ret = H5Sselect_elements(sid1, H5S_SELECT_SET, num_points, (const hsize_t *)points);
CHECK(ret, FAIL, "H5Sselect_elements");
- if(offset != NULL) {
+ if (offset != NULL) {
HDmemcpy(real_offset, offset, SPACE7_RANK * sizeof(hssize_t));
/* Set offset, if provided */
@@ -7211,26 +7502,29 @@ test_select_fill_point(hssize_t *offset)
CHECK(ret, FAIL, "H5Dfill");
/* Verify memory buffer the hard way... */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
- for(w = 0; w < (unsigned)num_points; w++) {
- if(u == (unsigned)(points[w][0] + (hsize_t)real_offset[0]) && v == (unsigned)(points[w][1] + (hsize_t)real_offset[1])) {
- if(*tbuf != (unsigned)fill_value)
- TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++, tbuf++) {
+ for (w = 0; w < (unsigned)num_points; w++) {
+ if (u == (unsigned)(points[w][0] + (hsize_t)real_offset[0]) &&
+ v == (unsigned)(points[w][1] + (hsize_t)real_offset[1])) {
+ if (*tbuf != (unsigned)fill_value)
+ TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf,
+ (unsigned)fill_value);
break;
} /* end if */
- } /* end for */
- if(w == (unsigned)num_points && *tbuf != ((u * SPACE7_DIM2) + v))
- TestErrPrintf("Error! v=%d, u=%d, *tbuf=%u, should be: %u\n", v, u, *tbuf, ((u * SPACE7_DIM2) + v));
+ } /* end for */
+ if (w == (unsigned)num_points && *tbuf != ((u * SPACE7_DIM2) + v))
+ TestErrPrintf("Error! v=%d, u=%d, *tbuf=%u, should be: %u\n", v, u, *tbuf,
+ ((u * SPACE7_DIM2) + v));
} /* end for */
/* Initialize the iterator structure */
iter_info.fill_value = SPACE7_FILL;
iter_info.curr_coord = 0;
- iter_info.coords = (hsize_t *)points;
+ iter_info.coords = (hsize_t *)points;
/* Add in the offset */
- for(u = 0; u < (unsigned)num_points; u++) {
+ for (u = 0; u < (unsigned)num_points; u++) {
points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]);
points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]);
} /* end for */
@@ -7245,7 +7539,7 @@ test_select_fill_point(hssize_t *offset)
/* Free memory buffers */
HDfree(wbuf);
-} /* test_select_fill_point() */
+} /* test_select_fill_point() */
/****************************************************************
**
@@ -7256,19 +7550,19 @@ test_select_fill_point(hssize_t *offset)
static void
test_select_fill_hyper_simple(hssize_t *offset)
{
- hid_t sid1; /* Dataspace ID */
- hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
- hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
- hsize_t start[SPACE7_RANK]; /* Hyperslab start */
- hsize_t count[SPACE7_RANK]; /* Hyperslab block size */
- size_t num_points; /* Number of points in selection */
- hsize_t points[16][SPACE7_RANK]; /* Coordinates selected */
- int fill_value; /* Fill value */
- fill_iter_info iter_info; /* Iterator information structure */
- unsigned *wbuf, /* buffer to write to disk */
- *tbuf; /* temporary buffer pointer */
- unsigned u, v; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t sid1; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
+ hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t count[SPACE7_RANK]; /* Hyperslab block size */
+ size_t num_points; /* Number of points in selection */
+ hsize_t points[16][SPACE7_RANK]; /* Coordinates selected */
+ int fill_value; /* Fill value */
+ fill_iter_info iter_info; /* Iterator information structure */
+ unsigned * wbuf, /* buffer to write to disk */
+ *tbuf; /* temporary buffer pointer */
+ unsigned u, v; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Filling Simple 'hyperslab' Selections\n"));
@@ -7278,8 +7572,8 @@ test_select_fill_hyper_simple(hssize_t *offset)
CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++)
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++)
*tbuf++ = (unsigned short)(u * SPACE7_DIM2) + v;
/* Create dataspace for dataset on disk */
@@ -7287,12 +7581,14 @@ test_select_fill_hyper_simple(hssize_t *offset)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Select "hyperslab" selection */
- start[0] = 3; start[1] = 3;
- count[0] = 4; count[1] = 4;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
+ start[0] = 3;
+ start[1] = 3;
+ count[0] = 4;
+ count[1] = 4;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- if(offset != NULL) {
+ if (offset != NULL) {
HDmemcpy(real_offset, offset, SPACE7_RANK * sizeof(hssize_t));
/* Set offset, if provided */
@@ -7310,27 +7606,31 @@ test_select_fill_hyper_simple(hssize_t *offset)
CHECK(ret, FAIL, "H5Dfill");
/* Verify memory buffer the hard way... */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
- if((u >= (unsigned)((hssize_t)start[0] + real_offset[0]) && u < (unsigned)((hssize_t)(start[0] + count[0]) + real_offset[0]))
- && (v >= (unsigned)((hssize_t)start[1] + real_offset[1]) && v < (unsigned)((hssize_t)(start[1] + count[1]) + real_offset[1]))) {
- if(*tbuf != (unsigned)fill_value)
- TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
- } /* end if */
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++, tbuf++) {
+ if ((u >= (unsigned)((hssize_t)start[0] + real_offset[0]) &&
+ u < (unsigned)((hssize_t)(start[0] + count[0]) + real_offset[0])) &&
+ (v >= (unsigned)((hssize_t)start[1] + real_offset[1]) &&
+ v < (unsigned)((hssize_t)(start[1] + count[1]) + real_offset[1]))) {
+ if (*tbuf != (unsigned)fill_value)
+ TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf,
+ (unsigned)fill_value);
+ } /* end if */
else {
- if(*tbuf != ((unsigned)(u * SPACE7_DIM2) + v))
- TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, should be: %u\n", v, u, *tbuf, ((u * SPACE7_DIM2) + v));
+ if (*tbuf != ((unsigned)(u * SPACE7_DIM2) + v))
+ TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, should be: %u\n", v, u, *tbuf,
+ ((u * SPACE7_DIM2) + v));
} /* end else */
- } /* end for */
+ } /* end for */
/* Initialize the iterator structure */
iter_info.fill_value = SPACE7_FILL;
iter_info.curr_coord = 0;
- iter_info.coords = (hsize_t *)points;
+ iter_info.coords = (hsize_t *)points;
/* Set the coordinates of the selection (with the offset) */
- for(u = 0, num_points = 0; u < (unsigned)count[0]; u++)
- for(v = 0; v < (unsigned)count[1]; v++, num_points++) {
+ for (u = 0, num_points = 0; u < (unsigned)count[0]; u++)
+ for (v = 0; v < (unsigned)count[1]; v++, num_points++) {
points[num_points][0] = (hsize_t)((hssize_t)(u + start[0]) + real_offset[0]);
points[num_points][1] = (hsize_t)((hssize_t)(v + start[1]) + real_offset[1]);
} /* end for */
@@ -7345,7 +7645,7 @@ test_select_fill_hyper_simple(hssize_t *offset)
/* Free memory buffers */
HDfree(wbuf);
-} /* test_select_fill_hyper_simple() */
+} /* test_select_fill_hyper_simple() */
/****************************************************************
**
@@ -7356,26 +7656,24 @@ test_select_fill_hyper_simple(hssize_t *offset)
static void
test_select_fill_hyper_regular(hssize_t *offset)
{
- hid_t sid1; /* Dataspace ID */
- hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
- hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
- hsize_t start[SPACE7_RANK]; /* Hyperslab start */
- hsize_t stride[SPACE7_RANK]; /* Hyperslab stride size */
- hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
- hsize_t block[SPACE7_RANK]; /* Hyperslab block size */
- hsize_t points[16][SPACE7_RANK] = {
- {2,2}, {2,3}, {2,6}, {2,7},
- {3,2}, {3,3}, {3,6}, {3,7},
- {6,2}, {6,3}, {6,6}, {6,7},
- {7,2}, {7,3}, {7,6}, {7,7},
- };
- size_t num_points=16; /* Number of points selected */
- int fill_value; /* Fill value */
- fill_iter_info iter_info; /* Iterator information structure */
- unsigned *wbuf, /* buffer to write to disk */
- *tbuf; /* temporary buffer pointer */
- unsigned u, v, w; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t sid1; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
+ hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t stride[SPACE7_RANK]; /* Hyperslab stride size */
+ hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
+ hsize_t block[SPACE7_RANK]; /* Hyperslab block size */
+ hsize_t points[16][SPACE7_RANK] = {
+ {2, 2}, {2, 3}, {2, 6}, {2, 7}, {3, 2}, {3, 3}, {3, 6}, {3, 7},
+ {6, 2}, {6, 3}, {6, 6}, {6, 7}, {7, 2}, {7, 3}, {7, 6}, {7, 7},
+ };
+ size_t num_points = 16; /* Number of points selected */
+ int fill_value; /* Fill value */
+ fill_iter_info iter_info; /* Iterator information structure */
+ unsigned * wbuf, /* buffer to write to disk */
+ *tbuf; /* temporary buffer pointer */
+ unsigned u, v, w; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Filling Regular 'hyperslab' Selections\n"));
@@ -7385,23 +7683,27 @@ test_select_fill_hyper_regular(hssize_t *offset)
CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++)
- *tbuf++ =(u * SPACE7_DIM2) + v;
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++)
+ *tbuf++ = (u * SPACE7_DIM2) + v;
/* Create dataspace for dataset on disk */
sid1 = H5Screate_simple(SPACE7_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Screate_simple");
/* Select "hyperslab" selection */
- start[0] = 2; start[1] = 2;
- stride[0] = 4; stride[1] = 4;
- count[0] = 2; count[1] = 2;
- block[0] = 2; block[1] = 2;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- if(offset != NULL) {
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 4;
+ stride[1] = 4;
+ count[0] = 2;
+ count[1] = 2;
+ block[0] = 2;
+ block[1] = 2;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ if (offset != NULL) {
HDmemcpy(real_offset, offset, SPACE7_RANK * sizeof(hssize_t));
/* Set offset, if provided */
@@ -7419,26 +7721,29 @@ test_select_fill_hyper_regular(hssize_t *offset)
CHECK(ret, FAIL, "H5Dfill");
/* Verify memory buffer the hard way... */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
- for(w = 0; w < (unsigned)num_points; w++) {
- if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) {
- if(*tbuf != (unsigned)fill_value)
- TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++, tbuf++) {
+ for (w = 0; w < (unsigned)num_points; w++) {
+ if (u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) &&
+ v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) {
+ if (*tbuf != (unsigned)fill_value)
+ TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf,
+ (unsigned)fill_value);
break;
} /* end if */
- } /* end for */
- if(w == (unsigned)num_points && *tbuf != ((u * SPACE7_DIM2) + v))
- TestErrPrintf("Error! v=%d, u=%d, *tbuf=%u, should be: %u\n", v, u, *tbuf, ((u * SPACE7_DIM2) + v));
+ } /* end for */
+ if (w == (unsigned)num_points && *tbuf != ((u * SPACE7_DIM2) + v))
+ TestErrPrintf("Error! v=%d, u=%d, *tbuf=%u, should be: %u\n", v, u, *tbuf,
+ ((u * SPACE7_DIM2) + v));
} /* end for */
/* Initialize the iterator structure */
iter_info.fill_value = SPACE7_FILL;
iter_info.curr_coord = 0;
- iter_info.coords = (hsize_t *)points;
+ iter_info.coords = (hsize_t *)points;
/* Add in the offset */
- for(u = 0; u < (unsigned)num_points; u++) {
+ for (u = 0; u < (unsigned)num_points; u++) {
points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]);
points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]);
} /* end for */
@@ -7453,7 +7758,7 @@ test_select_fill_hyper_regular(hssize_t *offset)
/* Free memory buffers */
HDfree(wbuf);
-} /* test_select_fill_hyper_regular() */
+} /* test_select_fill_hyper_regular() */
/****************************************************************
**
@@ -7464,37 +7769,31 @@ test_select_fill_hyper_regular(hssize_t *offset)
static void
test_select_fill_hyper_irregular(hssize_t *offset)
{
- hid_t sid1; /* Dataspace ID */
- hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
- hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
- hsize_t start[SPACE7_RANK]; /* Hyperslab start */
- hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
- hsize_t points[32][SPACE7_RANK] = { /* Yes, some of the are duplicated.. */
- {2,2}, {2,3}, {2,4}, {2,5},
- {3,2}, {3,3}, {3,4}, {3,5},
- {4,2}, {4,3}, {4,4}, {4,5},
- {5,2}, {5,3}, {5,4}, {5,5},
- {4,4}, {4,5}, {4,6}, {4,7},
- {5,4}, {5,5}, {5,6}, {5,7},
- {6,4}, {6,5}, {6,6}, {6,7},
- {7,4}, {7,5}, {7,6}, {7,7},
- };
- hsize_t iter_points[28][SPACE7_RANK] = { /* Coordinates, as iterated through */
- {2,2}, {2,3}, {2,4}, {2,5},
- {3,2}, {3,3}, {3,4}, {3,5},
- {4,2}, {4,3}, {4,4}, {4,5}, {4,6}, {4,7},
- {5,2}, {5,3}, {5,4}, {5,5}, {5,6}, {5,7},
- {6,4}, {6,5}, {6,6}, {6,7},
- {7,4}, {7,5}, {7,6}, {7,7},
- };
- size_t num_points = 32; /* Number of points selected */
- size_t num_iter_points = 28; /* Number of resulting points */
- int fill_value; /* Fill value */
- fill_iter_info iter_info; /* Iterator information structure */
- unsigned *wbuf, /* buffer to write to disk */
- *tbuf; /* temporary buffer pointer */
- unsigned u, v, w; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t sid1; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
+ hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
+ hsize_t points[32][SPACE7_RANK] = {
+ /* Yes, some of the are duplicated.. */
+ {2, 2}, {2, 3}, {2, 4}, {2, 5}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {4, 2}, {4, 3}, {4, 4},
+ {4, 5}, {5, 2}, {5, 3}, {5, 4}, {5, 5}, {4, 4}, {4, 5}, {4, 6}, {4, 7}, {5, 4}, {5, 5},
+ {5, 6}, {5, 7}, {6, 4}, {6, 5}, {6, 6}, {6, 7}, {7, 4}, {7, 5}, {7, 6}, {7, 7},
+ };
+ hsize_t iter_points[28][SPACE7_RANK] = {
+ /* Coordinates, as iterated through */
+ {2, 2}, {2, 3}, {2, 4}, {2, 5}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {4, 2}, {4, 3},
+ {4, 4}, {4, 5}, {4, 6}, {4, 7}, {5, 2}, {5, 3}, {5, 4}, {5, 5}, {5, 6}, {5, 7},
+ {6, 4}, {6, 5}, {6, 6}, {6, 7}, {7, 4}, {7, 5}, {7, 6}, {7, 7},
+ };
+ size_t num_points = 32; /* Number of points selected */
+ size_t num_iter_points = 28; /* Number of resulting points */
+ int fill_value; /* Fill value */
+ fill_iter_info iter_info; /* Iterator information structure */
+ unsigned * wbuf, /* buffer to write to disk */
+ *tbuf; /* temporary buffer pointer */
+ unsigned u, v, w; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Filling Irregular 'hyperslab' Selections\n"));
@@ -7504,8 +7803,8 @@ test_select_fill_hyper_irregular(hssize_t *offset)
CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++)
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++)
*tbuf++ = (u * SPACE7_DIM2) + v;
/* Create dataspace for dataset on disk */
@@ -7513,18 +7812,22 @@ test_select_fill_hyper_irregular(hssize_t *offset)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Select first "hyperslab" selection */
- start[0] = 2; start[1] = 2;
- count[0] = 4; count[1] = 4;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
+ start[0] = 2;
+ start[1] = 2;
+ count[0] = 4;
+ count[1] = 4;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Combine with second "hyperslab" selection */
- start[0] = 4; start[1] = 4;
- count[0] = 4; count[1] = 4;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_OR, start, NULL, count, NULL);
+ start[0] = 4;
+ start[1] = 4;
+ count[0] = 4;
+ count[1] = 4;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_OR, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- if(offset != NULL) {
+ if (offset != NULL) {
HDmemcpy(real_offset, offset, SPACE7_RANK * sizeof(hssize_t));
/* Set offset, if provided */
@@ -7542,26 +7845,29 @@ test_select_fill_hyper_irregular(hssize_t *offset)
CHECK(ret, FAIL, "H5Dfill");
/* Verify memory buffer the hard way... */
- for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
- for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
- for(w = 0; w < (unsigned)num_points; w++) {
- if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) {
- if(*tbuf != (unsigned)fill_value)
- TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
+ for (u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
+ for (v = 0; v < SPACE7_DIM2; v++, tbuf++) {
+ for (w = 0; w < (unsigned)num_points; w++) {
+ if (u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) &&
+ v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) {
+ if (*tbuf != (unsigned)fill_value)
+ TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf,
+ (unsigned)fill_value);
break;
} /* end if */
- } /* end for */
- if(w == (unsigned)num_points && *tbuf != ((u * SPACE7_DIM2) + v))
- TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, should be: %u\n", v, u, *tbuf, ((u * SPACE7_DIM2) + v));
+ } /* end for */
+ if (w == (unsigned)num_points && *tbuf != ((u * SPACE7_DIM2) + v))
+ TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, should be: %u\n", v, u, *tbuf,
+ ((u * SPACE7_DIM2) + v));
} /* end for */
/* Initialize the iterator structure */
iter_info.fill_value = SPACE7_FILL;
iter_info.curr_coord = 0;
- iter_info.coords = (hsize_t *)iter_points;
+ iter_info.coords = (hsize_t *)iter_points;
/* Add in the offset */
- for(u = 0; u < (unsigned)num_iter_points; u++) {
+ for (u = 0; u < (unsigned)num_iter_points; u++) {
iter_points[u][0] = (hsize_t)((hssize_t)iter_points[u][0] + real_offset[0]);
iter_points[u][1] = (hsize_t)((hssize_t)iter_points[u][1] + real_offset[1]);
} /* end for */
@@ -7576,7 +7882,7 @@ test_select_fill_hyper_irregular(hssize_t *offset)
/* Free memory buffers */
HDfree(wbuf);
-} /* test_select_fill_hyper_irregular() */
+} /* test_select_fill_hyper_irregular() */
/****************************************************************
**
@@ -7587,16 +7893,16 @@ test_select_fill_hyper_irregular(hssize_t *offset)
static void
test_select_none(void)
{
- hid_t fid1; /* HDF5 File IDs */
+ hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
- hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
- uint8_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer to read from disk */
- *tbuf; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2};
+ hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
+ uint8_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer to read from disk */
+ *tbuf; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing I/O on 0-sized Selections\n"));
@@ -7608,9 +7914,9 @@ test_select_none(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
- for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
- for(j=0; j<SPACE7_DIM2; j++)
- *tbuf++=(uint8_t)((i*SPACE7_DIM2)+j);
+ for (i = 0, tbuf = wbuf; i < SPACE7_DIM1; i++)
+ for (j = 0; j < SPACE7_DIM2; j++)
+ *tbuf++ = (uint8_t)((i * SPACE7_DIM2) + j);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -7625,7 +7931,7 @@ test_select_none(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, "Dataset1", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Make "none" selection in both disk and memory datasets */
@@ -7636,23 +7942,23 @@ test_select_none(void)
CHECK(ret, FAIL, "H5Sselect_none");
/* Attempt to read "nothing" from disk (before space is allocated) */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Write "nothing" to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Write "nothing" to disk (with a datatype conversion :-) */
- ret=H5Dwrite(dataset,H5T_NATIVE_INT,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_INT, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Write "nothing" to disk (with NULL buffer argument) */
- ret=H5Dwrite(dataset,H5T_NATIVE_INT,sid2,sid1,H5P_DEFAULT,NULL);
+ ret = H5Dwrite(dataset, H5T_NATIVE_INT, sid2, sid1, H5P_DEFAULT, NULL);
CHECK(ret, FAIL, "H5Dwrite");
/* Read "nothing" from disk (with NULL buffer argument) */
- ret=H5Dread(dataset,H5T_NATIVE_INT,sid2,sid1,H5P_DEFAULT,NULL);
+ ret = H5Dread(dataset, H5T_NATIVE_INT, sid2, sid1, H5P_DEFAULT, NULL);
CHECK(ret, FAIL, "H5Dread");
/* Close memory dataspace */
@@ -7674,7 +7980,7 @@ test_select_none(void)
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_none() */
+} /* test_select_none() */
/****************************************************************
**
@@ -7685,21 +7991,21 @@ test_select_none(void)
static void
test_scalar_select(void)
{
- hid_t fid1; /* HDF5 File IDs */
+ hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
- hsize_t coord1[SPACE7_RANK]; /* Coordinates for point selection */
- hsize_t start[SPACE7_RANK]; /* Hyperslab start */
- hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
- uint8_t *wbuf_uint8, /* buffer to write to disk */
- rval_uint8, /* value read back in */
- *tbuf_uint8; /* temporary buffer pointer */
- unsigned short *wbuf_ushort,/* another buffer to write to disk */
- rval_ushort, /* value read back in */
- *tbuf_ushort; /* temporary buffer pointer */
- int i,j; /* Counters */
- herr_t ret; /* Generic return value */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
+ hsize_t coord1[SPACE7_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
+ uint8_t *wbuf_uint8, /* buffer to write to disk */
+ rval_uint8, /* value read back in */
+ *tbuf_uint8; /* temporary buffer pointer */
+ unsigned short *wbuf_ushort, /* another buffer to write to disk */
+ rval_ushort, /* value read back in */
+ *tbuf_ushort; /* temporary buffer pointer */
+ int i, j; /* Counters */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing I/O on Selections in Scalar Dataspaces\n"));
@@ -7711,10 +8017,10 @@ test_scalar_select(void)
CHECK_PTR(wbuf_ushort, "HDmalloc");
/* Initialize write buffers */
- for(i=0, tbuf_uint8=wbuf_uint8, tbuf_ushort=wbuf_ushort; i<SPACE7_DIM1; i++)
- for(j=0; j<SPACE7_DIM2; j++) {
- *tbuf_uint8++=(uint8_t)((i*SPACE7_DIM2)+j);
- *tbuf_ushort++=(unsigned short)((j*SPACE7_DIM2)+i);
+ for (i = 0, tbuf_uint8 = wbuf_uint8, tbuf_ushort = wbuf_ushort; i < SPACE7_DIM1; i++)
+ for (j = 0; j < SPACE7_DIM2; j++) {
+ *tbuf_uint8++ = (uint8_t)((i * SPACE7_DIM2) + j);
+ *tbuf_ushort++ = (unsigned short)((j * SPACE7_DIM2) + i);
} /* end for */
/* Create file */
@@ -7730,67 +8036,74 @@ test_scalar_select(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, "Dataset1", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Select one element in memory with a point selection */
- coord1[0]=0; coord1[1]= 2;
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)1, (const hsize_t *)&coord1);
+ coord1[0] = 0;
+ coord1[1] = 2;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)1, (const hsize_t *)&coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Write single point to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf_uint8);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf_uint8);
CHECK(ret, FAIL, "H5Dwrite");
/* Read scalar element from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid1,sid1,H5P_DEFAULT,&rval_uint8);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid1, sid1, H5P_DEFAULT, &rval_uint8);
CHECK(ret, FAIL, "H5Dread");
/* Check value read back in */
- if(rval_uint8!=*(wbuf_uint8+2))
- TestErrPrintf("Error! rval=%u, should be: *(wbuf+2)=%u\n",(unsigned)rval_uint8,(unsigned)*(wbuf_uint8+2));
+ if (rval_uint8 != *(wbuf_uint8 + 2))
+ TestErrPrintf("Error! rval=%u, should be: *(wbuf+2)=%u\n", (unsigned)rval_uint8,
+ (unsigned)*(wbuf_uint8 + 2));
/* Write single point to disk (with a datatype conversion) */
- ret=H5Dwrite(dataset,H5T_NATIVE_USHORT,sid2,sid1,H5P_DEFAULT,wbuf_ushort);
+ ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, wbuf_ushort);
CHECK(ret, FAIL, "H5Dwrite");
/* Read scalar element from disk */
- ret=H5Dread(dataset,H5T_NATIVE_USHORT,sid1,sid1,H5P_DEFAULT,&rval_ushort);
+ ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid1, sid1, H5P_DEFAULT, &rval_ushort);
CHECK(ret, FAIL, "H5Dread");
/* Check value read back in */
- if(rval_ushort!=*(wbuf_ushort+2))
- TestErrPrintf("Error! rval=%u, should be: *(wbuf+2)=%u\n",(unsigned)rval_ushort,(unsigned)*(wbuf_ushort+2));
+ if (rval_ushort != *(wbuf_ushort + 2))
+ TestErrPrintf("Error! rval=%u, should be: *(wbuf+2)=%u\n", (unsigned)rval_ushort,
+ (unsigned)*(wbuf_ushort + 2));
/* Select one element in memory with a hyperslab selection */
- start[0]=4; start[1]=3;
- count[0]=1; count[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 4;
+ start[1] = 3;
+ count[0] = 1;
+ count[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Write single hyperslab element to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf_uint8);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf_uint8);
CHECK(ret, FAIL, "H5Dwrite");
/* Read scalar element from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid1,sid1,H5P_DEFAULT,&rval_uint8);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid1, sid1, H5P_DEFAULT, &rval_uint8);
CHECK(ret, FAIL, "H5Dread");
/* Check value read back in */
- if(rval_uint8!=*(wbuf_uint8+(SPACE7_DIM2*4)+3))
- TestErrPrintf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n",(unsigned)rval_uint8,(unsigned)*(wbuf_uint8+(SPACE7_DIM2*4)+3));
+ if (rval_uint8 != *(wbuf_uint8 + (SPACE7_DIM2 * 4) + 3))
+ TestErrPrintf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n", (unsigned)rval_uint8,
+ (unsigned)*(wbuf_uint8 + (SPACE7_DIM2 * 4) + 3));
/* Write single hyperslab element to disk (with a datatype conversion) */
- ret=H5Dwrite(dataset,H5T_NATIVE_USHORT,sid2,sid1,H5P_DEFAULT,wbuf_ushort);
+ ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, wbuf_ushort);
CHECK(ret, FAIL, "H5Dwrite");
/* Read scalar element from disk */
- ret=H5Dread(dataset,H5T_NATIVE_USHORT,sid1,sid1,H5P_DEFAULT,&rval_ushort);
+ ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid1, sid1, H5P_DEFAULT, &rval_ushort);
CHECK(ret, FAIL, "H5Dread");
/* Check value read back in */
- if(rval_ushort!=*(wbuf_ushort+(SPACE7_DIM2*4)+3))
- TestErrPrintf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n",(unsigned)rval_ushort,(unsigned)*(wbuf_ushort+(SPACE7_DIM2*4)+3));
+ if (rval_ushort != *(wbuf_ushort + (SPACE7_DIM2 * 4) + 3))
+ TestErrPrintf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n", (unsigned)rval_ushort,
+ (unsigned)*(wbuf_ushort + (SPACE7_DIM2 * 4) + 3));
/* Select no elements in memory & file with "none" selections */
ret = H5Sselect_none(sid1);
@@ -7800,11 +8113,11 @@ test_scalar_select(void)
CHECK(ret, FAIL, "H5Sselect_none");
/* Write no data to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf_uint8);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf_uint8);
CHECK(ret, FAIL, "H5Dwrite");
/* Write no data to disk (with a datatype conversion) */
- ret=H5Dwrite(dataset,H5T_NATIVE_USHORT,sid2,sid1,H5P_DEFAULT,wbuf_ushort);
+ ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, wbuf_ushort);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -7826,7 +8139,7 @@ test_scalar_select(void)
/* Free memory buffers */
HDfree(wbuf_uint8);
HDfree(wbuf_ushort);
-} /* test_scalar_select() */
+} /* test_scalar_select() */
/****************************************************************
**
@@ -7838,11 +8151,11 @@ test_scalar_select(void)
static void
test_scalar_select2(void)
{
- hid_t sid; /* Dataspace ID */
- hsize_t coord1[1]; /* Coordinates for point selection */
- hsize_t start[1]; /* Hyperslab start */
- hsize_t count[1]; /* Hyperslab block count */
- herr_t ret; /* Generic return value */
+ hid_t sid; /* Dataspace ID */
+ hsize_t coord1[1]; /* Coordinates for point selection */
+ hsize_t start[1]; /* Hyperslab start */
+ hsize_t count[1]; /* Hyperslab block count */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing Selections in Scalar Dataspaces\n"));
@@ -7852,18 +8165,16 @@ test_scalar_select2(void)
CHECK(sid, FAIL, "H5Screate_simple");
/* Select one element in memory with a point selection */
- coord1[0]=0;
- H5E_BEGIN_TRY {
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)&coord1);
- } H5E_END_TRY;
+ coord1[0] = 0;
+ H5E_BEGIN_TRY { ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)&coord1); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sselect_elements");
/* Select one element in memory with a hyperslab selection */
- start[0]=0;
- count[0]=0;
- H5E_BEGIN_TRY {
- ret = H5Sselect_hyperslab(sid,H5S_SELECT_SET,start,NULL,count,NULL);
- } H5E_END_TRY;
+ start[0] = 0;
+ count[0] = 0;
+ H5E_BEGIN_TRY { ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
/* Select no elements in memory & file with "none" selection */
@@ -7877,7 +8188,7 @@ test_scalar_select2(void)
/* Close disk dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_scalar_select2() */
+} /* test_scalar_select2() */
/****************************************************************
**
@@ -7888,18 +8199,18 @@ test_scalar_select2(void)
static void
test_scalar_select3(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
- hsize_t coord1[SPACE7_RANK]; /* Coordinates for point selection */
- hsize_t start[SPACE7_RANK]; /* Hyperslab start */
- hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
- uint8_t wval_uint8, /* Value written out */
- rval_uint8; /* Value read in */
- unsigned short wval_ushort, /* Another value written out */
- rval_ushort; /* Another value read in */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1, sid2; /* Dataspace ID */
+ hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2};
+ hsize_t coord1[SPACE7_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE7_RANK]; /* Hyperslab start */
+ hsize_t count[SPACE7_RANK]; /* Hyperslab block count */
+ uint8_t wval_uint8, /* Value written out */
+ rval_uint8; /* Value read in */
+ unsigned short wval_ushort, /* Another value written out */
+ rval_ushort; /* Another value read in */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing I/O on Selections in Scalar Dataspaces in Memory\n"));
@@ -7921,71 +8232,78 @@ test_scalar_select3(void)
CHECK(dataset, FAIL, "H5Dcreate2");
/* Select one element in file with a point selection */
- coord1[0] = 0; coord1[1] = 2;
- ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)1, (const hsize_t *)&coord1);
+ coord1[0] = 0;
+ coord1[1] = 2;
+ ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)1, (const hsize_t *)&coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Write single point to disk */
wval_uint8 = 12;
- ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, &wval_uint8);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, &wval_uint8);
CHECK(ret, FAIL, "H5Dwrite");
/* Read scalar element from disk */
rval_uint8 = 0;
- ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, &rval_uint8);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, &rval_uint8);
CHECK(ret, FAIL, "H5Dread");
/* Check value read back in */
- if(rval_uint8 != wval_uint8)
- TestErrPrintf("%u: Error! rval=%u, should be: wval=%u\n", (unsigned)__LINE__, (unsigned)rval_uint8, (unsigned)wval_uint8);
+ if (rval_uint8 != wval_uint8)
+ TestErrPrintf("%u: Error! rval=%u, should be: wval=%u\n", (unsigned)__LINE__, (unsigned)rval_uint8,
+ (unsigned)wval_uint8);
/* Write single point to disk (with a datatype conversion) */
wval_ushort = 23;
- ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, &wval_ushort);
+ ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, &wval_ushort);
CHECK(ret, FAIL, "H5Dwrite");
/* Read scalar element from disk */
rval_ushort = 0;
- ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, &rval_ushort);
+ ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, &rval_ushort);
CHECK(ret, FAIL, "H5Dread");
/* Check value read back in */
- if(rval_ushort != wval_ushort)
- TestErrPrintf("%u: Error! rval=%u, should be: wval=%u\n", (unsigned)__LINE__, (unsigned)rval_ushort, (unsigned)wval_ushort);
+ if (rval_ushort != wval_ushort)
+ TestErrPrintf("%u: Error! rval=%u, should be: wval=%u\n", (unsigned)__LINE__, (unsigned)rval_ushort,
+ (unsigned)wval_ushort);
/* Select one element in file with a hyperslab selection */
- start[0] = 4; start[1] = 3;
- count[0] = 1; count[1] = 1;
- ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
+ start[0] = 4;
+ start[1] = 3;
+ count[0] = 1;
+ count[1] = 1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Write single hyperslab element to disk */
wval_uint8 = 92;
- ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, &wval_uint8);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, &wval_uint8);
CHECK(ret, FAIL, "H5Dwrite");
/* Read scalar element from disk */
rval_uint8 = 0;
- ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, &rval_uint8);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, &rval_uint8);
CHECK(ret, FAIL, "H5Dread");
/* Check value read back in */
- if(rval_uint8 != wval_uint8)
- TestErrPrintf("%u: Error! rval=%u, should be: wval=%u\n", (unsigned)__LINE__, (unsigned)rval_uint8, (unsigned)wval_uint8);
+ if (rval_uint8 != wval_uint8)
+ TestErrPrintf("%u: Error! rval=%u, should be: wval=%u\n", (unsigned)__LINE__, (unsigned)rval_uint8,
+ (unsigned)wval_uint8);
/* Write single hyperslab element to disk (with a datatype conversion) */
wval_ushort = 107;
- ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, &wval_ushort);
+ ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, &wval_ushort);
CHECK(ret, FAIL, "H5Dwrite");
/* Read scalar element from disk */
rval_ushort = 0;
- ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, &rval_ushort);
+ ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid2, sid1, H5P_DEFAULT, &rval_ushort);
CHECK(ret, FAIL, "H5Dread");
/* Check value read back in */
- if(rval_ushort != wval_ushort)
- TestErrPrintf("%u: Error! rval=%u, should be: wval=%u\n", (unsigned)__LINE__, (unsigned)rval_ushort, (unsigned)wval_ushort);
+ if (rval_ushort != wval_ushort)
+ TestErrPrintf("%u: Error! rval=%u, should be: wval=%u\n", (unsigned)__LINE__, (unsigned)rval_ushort,
+ (unsigned)wval_ushort);
/* Select no elements in memory & file with "none" selections */
ret = H5Sselect_none(sid1);
@@ -8017,7 +8335,7 @@ test_scalar_select3(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_scalar_select3() */
+} /* test_scalar_select3() */
/****************************************************************
**
@@ -8028,38 +8346,38 @@ test_scalar_select3(void)
static void
test_shape_same(void)
{
- hid_t all_sid; /* Dataspace ID with "all" selection */
- hid_t none_sid; /* Dataspace ID with "none" selection */
- hid_t single_pt_sid; /* Dataspace ID with single point selection */
- hid_t mult_pt_sid; /* Dataspace ID with multiple point selection */
- hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
- hid_t single_hyper_all_sid; /* Dataspace ID with single block hyperslab
- * selection that is the entire dataspace
- */
- hid_t single_hyper_pt_sid; /* Dataspace ID with single block hyperslab
- * selection that is the same as the single
- * point selection
- */
- hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
- hid_t irreg_hyper_sid; /* Dataspace ID with irregular hyperslab selection */
+ hid_t all_sid; /* Dataspace ID with "all" selection */
+ hid_t none_sid; /* Dataspace ID with "none" selection */
+ hid_t single_pt_sid; /* Dataspace ID with single point selection */
+ hid_t mult_pt_sid; /* Dataspace ID with multiple point selection */
+ hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
+ hid_t single_hyper_all_sid; /* Dataspace ID with single block hyperslab
+ * selection that is the entire dataspace
+ */
+ hid_t single_hyper_pt_sid; /* Dataspace ID with single block hyperslab
+ * selection that is the same as the single
+ * point selection
+ */
+ hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
+ hid_t irreg_hyper_sid; /* Dataspace ID with irregular hyperslab selection */
hid_t none_hyper_sid; /* Dataspace ID with "no hyperslabs" selection */
hid_t scalar_all_sid; /* ID for scalar dataspace with "all" selection */
- hid_t scalar_none_sid; /* ID for scalar dataspace with "none" selection */
- hid_t tmp_sid; /* Temporary dataspace ID */
- hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2};
- hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
- hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */
- hsize_t start[SPACE9_RANK]; /* Hyperslab start */
- hsize_t stride[SPACE9_RANK]; /* Hyperslab stride */
- hsize_t count[SPACE9_RANK]; /* Hyperslab block count */
- hsize_t block[SPACE9_RANK]; /* Hyperslab block size */
- unsigned u,v; /* Local index variables */
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hid_t scalar_none_sid; /* ID for scalar dataspace with "none" selection */
+ hid_t tmp_sid; /* Temporary dataspace ID */
+ hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2};
+ hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
+ hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */
+ hsize_t start[SPACE9_RANK]; /* Hyperslab start */
+ hsize_t stride[SPACE9_RANK]; /* Hyperslab stride */
+ hsize_t count[SPACE9_RANK]; /* Hyperslab block count */
+ hsize_t block[SPACE9_RANK]; /* Hyperslab block size */
+ unsigned u, v; /* Local index variables */
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing Same Shape Comparisons\n"));
- assert(SPACE9_DIM2>=POINT1_NPOINTS);
+ assert(SPACE9_DIM2 >= POINT1_NPOINTS);
/* Create dataspace for "all" selection */
all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
@@ -8082,8 +8400,9 @@ test_shape_same(void)
CHECK(single_pt_sid, FAIL, "H5Screate_simple");
/* Select sequence of ten points for multiple point selection */
- coord1[0][0] = 2; coord1[0][1] = 2;
- ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
+ coord1[0][0] = 2;
+ coord1[0][1] = 2;
+ ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create dataspace for multiple point selection */
@@ -8091,16 +8410,26 @@ test_shape_same(void)
CHECK(mult_pt_sid, FAIL, "H5Screate_simple");
/* Select sequence of ten points for multiple point selection */
- coord2[0][0]=2; coord2[0][1]=2;
- coord2[1][0]=7; coord2[1][1]=2;
- coord2[2][0]=1; coord2[2][1]=4;
- coord2[3][0]=2; coord2[3][1]=6;
- coord2[4][0]=0; coord2[4][1]=8;
- coord2[5][0]=3; coord2[5][1]=2;
- coord2[6][0]=4; coord2[6][1]=4;
- coord2[7][0]=1; coord2[7][1]=0;
- coord2[8][0]=5; coord2[8][1]=1;
- coord2[9][0]=9; coord2[9][1]=3;
+ coord2[0][0] = 2;
+ coord2[0][1] = 2;
+ coord2[1][0] = 7;
+ coord2[1][1] = 2;
+ coord2[2][0] = 1;
+ coord2[2][1] = 4;
+ coord2[3][0] = 2;
+ coord2[3][1] = 6;
+ coord2[4][0] = 0;
+ coord2[4][1] = 8;
+ coord2[5][0] = 3;
+ coord2[5][1] = 2;
+ coord2[6][0] = 4;
+ coord2[6][1] = 4;
+ coord2[7][0] = 1;
+ coord2[7][1] = 0;
+ coord2[8][0] = 5;
+ coord2[8][1] = 1;
+ coord2[9][0] = 9;
+ coord2[9][1] = 3;
ret = H5Sselect_elements(mult_pt_sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
@@ -8109,11 +8438,15 @@ test_shape_same(void)
CHECK(single_hyper_sid, FAIL, "H5Screate_simple");
/* Select 10x10 hyperslab for single hyperslab selection */
- start[0]=1; start[1]=1;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=(SPACE9_DIM1-2); block[1]=(SPACE9_DIM2-2);
- ret = H5Sselect_hyperslab(single_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = (SPACE9_DIM1 - 2);
+ block[1] = (SPACE9_DIM2 - 2);
+ ret = H5Sselect_hyperslab(single_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for single hyperslab selection with entire extent selected */
@@ -8121,11 +8454,15 @@ test_shape_same(void)
CHECK(single_hyper_all_sid, FAIL, "H5Screate_simple");
/* Select entire extent for hyperslab selection */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=SPACE9_DIM1; block[1]=SPACE9_DIM2;
- ret = H5Sselect_hyperslab(single_hyper_all_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = SPACE9_DIM1;
+ block[1] = SPACE9_DIM2;
+ ret = H5Sselect_hyperslab(single_hyper_all_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for single hyperslab selection with single point selected */
@@ -8133,11 +8470,15 @@ test_shape_same(void)
CHECK(single_hyper_pt_sid, FAIL, "H5Screate_simple");
/* Select entire extent for hyperslab selection */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(single_hyper_pt_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(single_hyper_pt_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for regular hyperslab selection */
@@ -8145,11 +8486,15 @@ test_shape_same(void)
CHECK(regular_hyper_sid, FAIL, "H5Screate_simple");
/* Select regular, strided hyperslab selection */
- start[0]=2; start[1]=2;
- stride[0]=2; stride[1]=2;
- count[0]=5; count[1]=2;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(regular_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 5;
+ count[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(regular_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for irregular hyperslab selection */
@@ -8157,18 +8502,26 @@ test_shape_same(void)
CHECK(irreg_hyper_sid, FAIL, "H5Screate_simple");
/* Create irregular hyperslab selection by OR'ing two blocks together */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(irreg_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0]=4; start[1]=4;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=3; block[1]=3;
- ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 4;
+ start[1] = 4;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 3;
+ block[1] = 3;
+ ret = H5Sselect_hyperslab(irreg_hyper_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for "no" hyperslab selection */
@@ -8176,14 +8529,18 @@ test_shape_same(void)
CHECK(none_hyper_sid, FAIL, "H5Screate_simple");
/* Create "no" hyperslab selection by XOR'ing same blocks together */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(none_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_XOR,start,stride,count,block);
+ ret = H5Sselect_hyperslab(none_hyper_sid, H5S_SELECT_XOR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create scalar dataspace for "all" selection */
@@ -8199,868 +8556,890 @@ test_shape_same(void)
CHECK(ret, FAIL, "H5Sselect_none");
/* Compare "all" selection to all the selections created */
- /* Compare against itself */
- check = H5Sselect_shape_same(all_sid ,all_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against itself */
+ check = H5Sselect_shape_same(all_sid, all_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(all_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(all_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5Sselect_shape_same(all_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ check = H5Sselect_shape_same(all_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(all_sid, none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(all_sid, none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against single point selection */
- check = H5Sselect_shape_same(all_sid, single_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(all_sid, single_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(all_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(all_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(all_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(all_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(all_sid, single_hyper_all_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(all_sid, single_hyper_all_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(all_sid, single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(all_sid, single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(all_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(all_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(all_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(all_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(all_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(all_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(all_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(all_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(all_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(all_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
/* Compare "none" selection to all the selections created */
- /* Compare against itself */
- check = H5Sselect_shape_same(none_sid, none_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against itself */
+ check = H5Sselect_shape_same(none_sid, none_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(none_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(none_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5Sselect_shape_same(none_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ check = H5Sselect_shape_same(none_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(none_sid, all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(none_sid, all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against single point selection */
- check = H5Sselect_shape_same(none_sid, single_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(none_sid, single_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(none_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(none_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(none_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(none_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(none_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(none_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(none_sid, single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(none_sid, single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(none_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(none_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(none_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(none_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(none_sid, none_hyper_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(none_sid, none_hyper_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(none_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(none_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(none_sid, scalar_none_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(none_sid, scalar_none_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
/* Compare single point selection to all the selections created */
- /* Compare against itself */
- check = H5Sselect_shape_same(single_pt_sid, single_pt_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against itself */
+ check = H5Sselect_shape_same(single_pt_sid, single_pt_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(single_pt_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(single_pt_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5Sselect_shape_same(single_pt_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ check = H5Sselect_shape_same(single_pt_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(single_pt_sid, all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(single_pt_sid, all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(single_pt_sid, none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(single_pt_sid, none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(single_pt_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(single_pt_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(single_pt_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(single_pt_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(single_pt_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(single_pt_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(single_pt_sid, single_hyper_pt_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(single_pt_sid, single_hyper_pt_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(single_pt_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(single_pt_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(single_pt_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(single_pt_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(single_pt_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(single_pt_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(single_pt_sid, scalar_all_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(single_pt_sid, scalar_all_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(single_pt_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(single_pt_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
/* Compare multiple point selection to all the selections created */
- /* Compare against itself */
- check = H5Sselect_shape_same(mult_pt_sid, mult_pt_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against itself */
+ check = H5Sselect_shape_same(mult_pt_sid, mult_pt_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(mult_pt_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(mult_pt_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5Sselect_shape_same(mult_pt_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ check = H5Sselect_shape_same(mult_pt_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(mult_pt_sid, all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(mult_pt_sid, all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(mult_pt_sid, none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(mult_pt_sid, none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against single point selection */
- check = H5Sselect_shape_same(mult_pt_sid, single_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(mult_pt_sid, single_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(mult_pt_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(mult_pt_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(mult_pt_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(mult_pt_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(mult_pt_sid, single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(mult_pt_sid, single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(mult_pt_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(mult_pt_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(mult_pt_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(mult_pt_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(mult_pt_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(mult_pt_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(mult_pt_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(mult_pt_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(mult_pt_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(mult_pt_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
/* Compare single "normal" hyperslab selection to all the selections created */
- /* Compare against itself */
- check = H5Sselect_shape_same(single_hyper_sid, single_hyper_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against itself */
+ check = H5Sselect_shape_same(single_hyper_sid, single_hyper_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(single_hyper_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(single_hyper_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5Sselect_shape_same(single_hyper_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ check = H5Sselect_shape_same(single_hyper_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(single_hyper_sid, all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(single_hyper_sid, all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(single_hyper_sid, none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(single_hyper_sid, none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against single point selection */
- check = H5Sselect_shape_same(single_hyper_sid, single_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(single_hyper_sid, single_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(single_hyper_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(single_hyper_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_sid, single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_sid, single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
#ifdef NOT_YET
-/* In theory, these two selections are the same shape, but the
- * H5Sselect_shape_same() routine is just not this sophisticated yet and it
- * would take too much effort to make this work. The worst case is that the
- * non-optimized chunk mapping routines will be invoked instead of the more
- * optimized routines, so this only hurts performance, not correctness
- */
- /* Construct point selection which matches "plain" hyperslab selection */
- /* Create dataspace for point selection */
- tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(tmp_sid, FAIL, "H5Screate_simple");
-
- /* Select sequence of points for point selection */
- for(u = 1; u < (SPACE9_DIM1 - 1); u++) {
- for(v = 1; v < (SPACE9_DIM2 - 1); v++) {
- coord2[v - 1][0] = u;
- coord2[v - 1][1] = v;
- } /* end for */
-
- ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, (SPACE9_DIM2 - 2), coord2);
- CHECK(ret, FAIL, "H5Sselect_elements");
- } /* end for */
+ /* In theory, these two selections are the same shape, but the
+ * H5Sselect_shape_same() routine is just not this sophisticated yet and it
+ * would take too much effort to make this work. The worst case is that the
+ * non-optimized chunk mapping routines will be invoked instead of the more
+ * optimized routines, so this only hurts performance, not correctness
+ */
+ /* Construct point selection which matches "plain" hyperslab selection */
+ /* Create dataspace for point selection */
+ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(tmp_sid, FAIL, "H5Screate_simple");
+
+ /* Select sequence of points for point selection */
+ for (u = 1; u < (SPACE9_DIM1 - 1); u++) {
+ for (v = 1; v < (SPACE9_DIM2 - 1); v++) {
+ coord2[v - 1][0] = u;
+ coord2[v - 1][1] = v;
+ } /* end for */
- /* Compare against hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, (SPACE9_DIM2 - 2), coord2);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+ } /* end for */
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Compare against hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
+
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
#endif /* NOT_YET */
- /* Construct hyperslab selection which matches "plain" hyperslab selection */
- /* Create dataspace for hyperslab selection */
- tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(tmp_sid, FAIL, "H5Screate_simple");
-
- /* Un-select entire extent */
- ret = H5Sselect_none(tmp_sid);
- CHECK(ret, FAIL, "H5Sselect_none");
-
- /* Select sequence of rows for hyperslab selection */
- for(u = 1; u < (SPACE9_DIM1 - 1); u++) {
- start[0] = u; start[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 1; block[1] = (SPACE9_DIM2 - 2);
- ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_OR, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
- } /* end for */
+ /* Construct hyperslab selection which matches "plain" hyperslab selection */
+ /* Create dataspace for hyperslab selection */
+ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(tmp_sid, FAIL, "H5Screate_simple");
+
+ /* Un-select entire extent */
+ ret = H5Sselect_none(tmp_sid);
+ CHECK(ret, FAIL, "H5Sselect_none");
+
+ /* Select sequence of rows for hyperslab selection */
+ for (u = 1; u < (SPACE9_DIM1 - 1); u++) {
+ start[0] = u;
+ start[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = (SPACE9_DIM2 - 2);
+ ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_OR, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ } /* end for */
- /* Compare against hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
/* Compare single "all" hyperslab selection to all the selections created */
- /* Compare against itself */
- check = H5Sselect_shape_same(single_hyper_all_sid, single_hyper_all_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against itself */
+ check = H5Sselect_shape_same(single_hyper_all_sid, single_hyper_all_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(single_hyper_all_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(single_hyper_all_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5Sselect_shape_same(single_hyper_all_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ check = H5Sselect_shape_same(single_hyper_all_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, all_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, all_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against single point selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, single_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, single_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
#ifdef NOT_YET
-/* In theory, these two selections are the same shape, but the
- * H5S_select_shape_same() routine is just not this sophisticated yet and it
- * would take too much effort to make this work. The worst case is that the
- * non-optimized chunk mapping routines will be invoked instead of the more
- * optimized routines, so this only hurts performance, not correctness
- */
- /* Construct point selection which matches "all" hyperslab selection */
- /* Create dataspace for point selection */
- tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(tmp_sid, FAIL, "H5Screate_simple");
-
- /* Select sequence of points for point selection */
- for(u = 0; u < SPACE9_DIM1; u++) {
- for(v = 0; v < SPACE9_DIM2; v++) {
- coord2[v][0] = u;
- coord2[v][1] = v;
- } /* end for */
- ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, SPACE9_DIM2, coord2);
- CHECK(ret, FAIL, "H5Sselect_elements");
- } /* end for */
+ /* In theory, these two selections are the same shape, but the
+ * H5S_select_shape_same() routine is just not this sophisticated yet and it
+ * would take too much effort to make this work. The worst case is that the
+ * non-optimized chunk mapping routines will be invoked instead of the more
+ * optimized routines, so this only hurts performance, not correctness
+ */
+ /* Construct point selection which matches "all" hyperslab selection */
+ /* Create dataspace for point selection */
+ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(tmp_sid, FAIL, "H5Screate_simple");
+
+ /* Select sequence of points for point selection */
+ for (u = 0; u < SPACE9_DIM1; u++) {
+ for (v = 0; v < SPACE9_DIM2; v++) {
+ coord2[v][0] = u;
+ coord2[v][1] = v;
+ } /* end for */
+ ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, SPACE9_DIM2, coord2);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+ } /* end for */
- /* Compare against hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
#endif /* NOT_YET */
- /* Construct hyperslab selection which matches "all" hyperslab selection */
- /* Create dataspace for hyperslab selection */
- tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(tmp_sid, FAIL, "H5Screate_simple");
-
- /* Un-select entire extent */
- ret = H5Sselect_none(tmp_sid);
- CHECK(ret, FAIL, "H5Sselect_none");
-
- /* Select sequence of rows for hyperslab selection */
- for(u = 0; u < SPACE9_DIM2; u++) {
- start[0] = u; start[1] = 0;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 1; block[1] = SPACE9_DIM2;
- ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_OR, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
- } /* end for */
+ /* Construct hyperslab selection which matches "all" hyperslab selection */
+ /* Create dataspace for hyperslab selection */
+ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(tmp_sid, FAIL, "H5Screate_simple");
- /* Compare against hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Un-select entire extent */
+ ret = H5Sselect_none(tmp_sid);
+ CHECK(ret, FAIL, "H5Sselect_none");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Select sequence of rows for hyperslab selection */
+ for (u = 0; u < SPACE9_DIM2; u++) {
+ start[0] = u;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = SPACE9_DIM2;
+ ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_OR, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ } /* end for */
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_all_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
+
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_all_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
/* Compare single "point" hyperslab selection to all the selections created */
- /* Compare against itself */
- check = H5Sselect_shape_same(single_hyper_pt_sid, single_hyper_pt_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against itself */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, single_hyper_pt_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(single_hyper_pt_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(single_hyper_pt_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5Sselect_shape_same(single_hyper_pt_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ check = H5Sselect_shape_same(single_hyper_pt_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against single point selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, single_pt_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, single_pt_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, scalar_all_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, scalar_all_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(single_hyper_pt_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(single_hyper_pt_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
/* Compare regular, strided hyperslab selection to all the selections created */
- /* Compare against itself */
- check = H5Sselect_shape_same(regular_hyper_sid, regular_hyper_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against itself */
+ check = H5Sselect_shape_same(regular_hyper_sid, regular_hyper_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(regular_hyper_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(regular_hyper_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- check = H5Sselect_shape_same(regular_hyper_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ check = H5Sselect_shape_same(regular_hyper_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(regular_hyper_sid, all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
-
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(regular_hyper_sid, none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
-
- /* Compare against single point selection */
- check = H5Sselect_shape_same(regular_hyper_sid, single_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
-
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(regular_hyper_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
-
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
-
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
-
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
-
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
-
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
-
- /* Construct point selection which matches regular, strided hyperslab selection */
- /* Create dataspace for point selection */
- tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(tmp_sid, FAIL, "H5Screate_simple");
-
- /* Select sequence of points for point selection */
- for(u = 2; u < 11; u += 2) {
- for(v = 0; v < 2; v++) {
- coord2[v][0] = u;
- coord2[v][1] = (v * 2) + 2;
- } /* end for */
- ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, (size_t)2, (const hsize_t *)coord2);
- CHECK(ret, FAIL, "H5Sselect_elements");
- } /* end for */
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
-
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
-
- /* Construct hyperslab selection which matches regular, strided hyperslab selection */
- /* Create dataspace for hyperslab selection */
- tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(tmp_sid, FAIL, "H5Screate_simple");
-
- /* Un-select entire extent */
- ret = H5Sselect_none(tmp_sid);
- CHECK(ret, FAIL, "H5Sselect_none");
-
- /* Select sequence of rows for hyperslab selection */
- for(u = 2; u < 11; u += 2) {
- start[0] = u; start[1] = 3;
- stride[0] = 1; stride[1] = 2;
- count[0] = 1; count[1] = 2;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_OR, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
- } /* end for */
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, single_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Construct regular hyperslab selection with an offset which matches regular, strided hyperslab selection */
- /* Create dataspace for hyperslab selection */
- tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(tmp_sid, FAIL, "H5Screate_simple");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Select regular, strided hyperslab selection at an offset */
- start[0] = 1; start[1] = 1;
- stride[0] = 2; stride[1] = 2;
- count[0] = 5; count[1] = 2;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_SET, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(regular_hyper_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Construct point selection which matches regular, strided hyperslab selection */
+ /* Create dataspace for point selection */
+ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(tmp_sid, FAIL, "H5Screate_simple");
- /* Compare irregular hyperslab selection to all the selections created */
- /* Compare against itself */
- check = H5Sselect_shape_same(irreg_hyper_sid, irreg_hyper_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Select sequence of points for point selection */
+ for (u = 2; u < 11; u += 2) {
+ for (v = 0; v < 2; v++) {
+ coord2[v][0] = u;
+ coord2[v][1] = (v * 2) + 2;
+ } /* end for */
+ ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, (size_t)2, (const hsize_t *)coord2);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+ } /* end for */
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(irreg_hyper_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- check = H5Sselect_shape_same(irreg_hyper_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Construct hyperslab selection which matches regular, strided hyperslab selection */
+ /* Create dataspace for hyperslab selection */
+ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(tmp_sid, FAIL, "H5Screate_simple");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Un-select entire extent */
+ ret = H5Sselect_none(tmp_sid);
+ CHECK(ret, FAIL, "H5Sselect_none");
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Select sequence of rows for hyperslab selection */
+ for (u = 2; u < 11; u += 2) {
+ start[0] = u;
+ start[1] = 3;
+ stride[0] = 1;
+ stride[1] = 2;
+ count[0] = 1;
+ count[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_OR, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ } /* end for */
- /* Compare against single point selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, single_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Construct regular hyperslab selection with an offset which matches regular, strided hyperslab selection
+ */
+ /* Create dataspace for hyperslab selection */
+ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(tmp_sid, FAIL, "H5Screate_simple");
+
+ /* Select regular, strided hyperslab selection at an offset */
+ start[0] = 1;
+ start[1] = 1;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 5;
+ count[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Compare against hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(regular_hyper_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare irregular hyperslab selection to all the selections created */
+ /* Compare against itself */
+ check = H5Sselect_shape_same(irreg_hyper_sid, irreg_hyper_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Construct hyperslab selection which matches irregular hyperslab selection */
- /* Create dataspace for hyperslab selection */
- tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(tmp_sid, FAIL, "H5Screate_simple");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(irreg_hyper_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_SET, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ check = H5Sselect_shape_same(irreg_hyper_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Select sequence of columns for hyperslab selection */
- for(u = 0; u < 3; u++) {
- start[0] = 4; start[1] = u + 4;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 3; block[1] = 1;
- ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_OR, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
- } /* end for */
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against hyperslab selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, single_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(irreg_hyper_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare scalar "all" dataspace with all selections created */
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against itself */
- check = H5Sselect_shape_same(scalar_all_sid, scalar_all_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(scalar_all_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- check = H5Sselect_shape_same(scalar_all_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Construct hyperslab selection which matches irregular hyperslab selection */
+ /* Create dataspace for hyperslab selection */
+ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
+ CHECK(tmp_sid, FAIL, "H5Screate_simple");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(scalar_all_sid, all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Select sequence of columns for hyperslab selection */
+ for (u = 0; u < 3; u++) {
+ start[0] = 4;
+ start[1] = u + 4;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 3;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_OR, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ } /* end for */
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(scalar_all_sid, none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against hyperslab selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against single point selection */
- check = H5Sselect_shape_same(scalar_all_sid, single_pt_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(scalar_all_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(scalar_all_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(irreg_hyper_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(scalar_all_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare scalar "all" dataspace with all selections created */
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(scalar_all_sid, single_hyper_pt_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against itself */
+ check = H5Sselect_shape_same(scalar_all_sid, scalar_all_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(scalar_all_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(scalar_all_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(scalar_all_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ check = H5Sselect_shape_same(scalar_all_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(scalar_all_sid, none_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against scalar "none" hyperslab selection */
- check = H5Sselect_shape_same(scalar_all_sid, scalar_none_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(scalar_all_sid, all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(scalar_all_sid, none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare scalar "none" dataspace with all selections created */
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(scalar_all_sid, single_pt_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against itself */
- check = H5Sselect_shape_same(scalar_none_sid, scalar_none_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(scalar_all_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against copy of itself */
- tmp_sid = H5Scopy(scalar_none_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(scalar_all_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- check = H5Sselect_shape_same(scalar_none_sid, tmp_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(scalar_all_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(scalar_all_sid, single_hyper_pt_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
+
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(scalar_all_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
+
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(scalar_all_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
+
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(scalar_all_sid, none_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
+
+ /* Compare against scalar "none" hyperslab selection */
+ check = H5Sselect_shape_same(scalar_all_sid, scalar_none_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
+
+ /* Compare scalar "none" dataspace with all selections created */
+
+ /* Compare against itself */
+ check = H5Sselect_shape_same(scalar_none_sid, scalar_none_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
+
+ /* Compare against copy of itself */
+ tmp_sid = H5Scopy(scalar_none_sid);
+ CHECK(tmp_sid, FAIL, "H5Scopy");
+
+ check = H5Sselect_shape_same(scalar_none_sid, tmp_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against "all" selection */
- check = H5Sselect_shape_same(scalar_none_sid, all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Compare against "none" selection */
- check = H5Sselect_shape_same(scalar_none_sid, none_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against "all" selection */
+ check = H5Sselect_shape_same(scalar_none_sid, all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against single point selection */
- check = H5Sselect_shape_same(scalar_none_sid, single_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "none" selection */
+ check = H5Sselect_shape_same(scalar_none_sid, none_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
- /* Compare against multiple point selection */
- check = H5Sselect_shape_same(scalar_none_sid, mult_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against single point selection */
+ check = H5Sselect_shape_same(scalar_none_sid, single_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "plain" single hyperslab selection */
- check = H5Sselect_shape_same(scalar_none_sid, single_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against multiple point selection */
+ check = H5Sselect_shape_same(scalar_none_sid, mult_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "all" single hyperslab selection */
- check = H5Sselect_shape_same(scalar_none_sid, single_hyper_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "plain" single hyperslab selection */
+ check = H5Sselect_shape_same(scalar_none_sid, single_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "single point" single hyperslab selection */
- check = H5Sselect_shape_same(scalar_none_sid, single_hyper_pt_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "all" single hyperslab selection */
+ check = H5Sselect_shape_same(scalar_none_sid, single_hyper_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against regular, strided hyperslab selection */
- check = H5Sselect_shape_same(scalar_none_sid, regular_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "single point" single hyperslab selection */
+ check = H5Sselect_shape_same(scalar_none_sid, single_hyper_pt_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against irregular hyperslab selection */
- check = H5Sselect_shape_same(scalar_none_sid, irreg_hyper_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against regular, strided hyperslab selection */
+ check = H5Sselect_shape_same(scalar_none_sid, regular_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against "no" hyperslab selection */
- check = H5Sselect_shape_same(scalar_none_sid, none_hyper_sid);
- VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against irregular hyperslab selection */
+ check = H5Sselect_shape_same(scalar_none_sid, irreg_hyper_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
- /* Compare against scalar "all" hyperslab selection */
- check = H5Sselect_shape_same(scalar_none_sid, scalar_all_sid);
- VERIFY(check, FALSE, "H5Sselect_shape_same");
+ /* Compare against "no" hyperslab selection */
+ check = H5Sselect_shape_same(scalar_none_sid, none_hyper_sid);
+ VERIFY(check, TRUE, "H5Sselect_shape_same");
+ /* Compare against scalar "all" hyperslab selection */
+ check = H5Sselect_shape_same(scalar_none_sid, scalar_all_sid);
+ VERIFY(check, FALSE, "H5Sselect_shape_same");
/* Close dataspaces */
ret = H5Sclose(all_sid);
@@ -9087,7 +9466,7 @@ test_shape_same(void)
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(scalar_none_sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_shape_same() */
+} /* test_shape_same() */
/****************************************************************
**
@@ -9118,25 +9497,25 @@ test_shape_same(void)
static void
test_shape_same_dr__smoke_check_1(void)
{
- hid_t small_square_sid;
- hid_t small_cube_xy_slice_0_sid;
- hid_t small_cube_xy_slice_1_sid;
- hid_t small_cube_xy_slice_2_sid;
- hid_t small_cube_xz_slice_0_sid;
- hid_t small_cube_xz_slice_1_sid;
- hid_t small_cube_xz_slice_2_sid;
- hid_t small_cube_yz_slice_0_sid;
- hid_t small_cube_yz_slice_1_sid;
- hid_t small_cube_yz_slice_2_sid;
- hid_t small_cube_yz_slice_3_sid;
- hid_t small_cube_yz_slice_4_sid;
- hsize_t small_cube_dims[] = {10, 10, 10};
- hsize_t start[3];
- hsize_t stride[3];
- hsize_t count[3];
- hsize_t block[3];
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hid_t small_square_sid;
+ hid_t small_cube_xy_slice_0_sid;
+ hid_t small_cube_xy_slice_1_sid;
+ hid_t small_cube_xy_slice_2_sid;
+ hid_t small_cube_xz_slice_0_sid;
+ hid_t small_cube_xz_slice_1_sid;
+ hid_t small_cube_xz_slice_2_sid;
+ hid_t small_cube_yz_slice_0_sid;
+ hid_t small_cube_yz_slice_1_sid;
+ hid_t small_cube_yz_slice_2_sid;
+ hid_t small_cube_yz_slice_3_sid;
+ hid_t small_cube_yz_slice_4_sid;
+ hsize_t small_cube_dims[] = {10, 10, 10};
+ hsize_t start[3];
+ hsize_t stride[3];
+ hsize_t count[3];
+ hsize_t block[3];
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
MESSAGE(7, (" Smoke check 1: Slices through a cube.\n"));
@@ -9154,39 +9533,35 @@ test_shape_same_dr__smoke_check_1(void)
small_cube_xy_slice_2_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xy_slice_2_sid, FAIL, "H5Screate_simple");
- start[0] = 0; /* x */
- start[1] = 0; /* y */
- start[2] = 0; /* z */
+ start[0] = 0; /* x */
+ start[1] = 0; /* y */
+ start[2] = 0; /* z */
/* stride is a bit silly here, since we are only selecting a single */
/* contiguous plane, but include it anyway, with values large enough */
/* to ensure that we will only get the single block selected. */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 10; /* x */
- block[1] = 10; /* y */
- block[2] = 1; /* z */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 10; /* x */
+ block[1] = 10; /* y */
+ block[2] = 1; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[2] = 5;
- ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[2] = 9;
- ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Create the 10 X 10 X 10 dataspaces for the hyperslab parallel to the xz axis */
small_cube_xz_slice_0_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xz_slice_0_sid, FAIL, "H5Screate_simple");
@@ -9197,39 +9572,35 @@ test_shape_same_dr__smoke_check_1(void)
small_cube_xz_slice_2_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xz_slice_2_sid, FAIL, "H5Screate_simple");
- start[0] = 0; /* x */
- start[1] = 0; /* y */
- start[2] = 0; /* z */
+ start[0] = 0; /* x */
+ start[1] = 0; /* y */
+ start[2] = 0; /* z */
/* stride is a bit silly here, since we are only selecting a single */
/* contiguous chunk, but include it anyway, with values large enough */
/* to ensure that we will only get the single chunk. */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 10; /* x */
- block[1] = 1; /* y */
- block[2] = 10; /* z */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 10; /* x */
+ block[1] = 1; /* y */
+ block[2] = 10; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[1] = 4;
- ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[1] = 9;
- ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Create the 10 X 10 X 10 dataspaces for the hyperslabs parallel to the yz axis */
small_cube_yz_slice_0_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_yz_slice_0_sid, FAIL, "H5Screate_simple");
@@ -9246,57 +9617,50 @@ test_shape_same_dr__smoke_check_1(void)
small_cube_yz_slice_4_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_yz_slice_4_sid, FAIL, "H5Screate_simple");
- start[0] = 0; /* x */
- start[1] = 0; /* y */
- start[2] = 0; /* z */
+ start[0] = 0; /* x */
+ start[1] = 0; /* y */
+ start[2] = 0; /* z */
/* stride is a bit silly here, since we are only selecting a single */
/* contiguous chunk, but include it anyway, with values large enough */
/* to ensure that we will only get the single chunk. */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 1; /* x */
- block[1] = 10; /* y */
- block[2] = 10; /* z */
+ block[0] = 1; /* x */
+ block[1] = 10; /* y */
+ block[2] = 10; /* z */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 4;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 9;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 4;
block[0] = 2;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_3_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_3_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 3;
block[0] = 1;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_4_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_4_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 6;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_4_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_4_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* setup is done -- run the tests: */
/* Compare against "xy" selection */
@@ -9309,7 +9673,6 @@ test_shape_same_dr__smoke_check_1(void)
check = H5Sselect_shape_same(small_cube_xy_slice_2_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
/* Compare against "xz" selection */
check = H5Sselect_shape_same(small_cube_xz_slice_0_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
@@ -9320,7 +9683,6 @@ test_shape_same_dr__smoke_check_1(void)
check = H5Sselect_shape_same(small_cube_xz_slice_2_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
/* Compare against "yz" selection */
check = H5Sselect_shape_same(small_cube_yz_slice_0_sid, small_square_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
@@ -9337,12 +9699,10 @@ test_shape_same_dr__smoke_check_1(void)
check = H5Sselect_shape_same(small_cube_yz_slice_4_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
/* Close dataspaces */
ret = H5Sclose(small_square_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(small_cube_xy_slice_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -9352,7 +9712,6 @@ test_shape_same_dr__smoke_check_1(void)
ret = H5Sclose(small_cube_xy_slice_2_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(small_cube_xz_slice_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -9362,7 +9721,6 @@ test_shape_same_dr__smoke_check_1(void)
ret = H5Sclose(small_cube_xz_slice_2_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(small_cube_yz_slice_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -9425,24 +9783,24 @@ test_shape_same_dr__smoke_check_1(void)
static void
test_shape_same_dr__smoke_check_2(void)
{
- hid_t small_square_sid;
- hid_t small_cube_xy_slice_0_sid;
- hid_t small_cube_xy_slice_1_sid;
- hid_t small_cube_xy_slice_2_sid;
- hid_t small_cube_xz_slice_0_sid;
- hid_t small_cube_xz_slice_1_sid;
- hid_t small_cube_xz_slice_2_sid;
- hid_t small_cube_yz_slice_0_sid;
- hid_t small_cube_yz_slice_1_sid;
- hid_t small_cube_yz_slice_2_sid;
- hid_t small_cube_yz_slice_3_sid;
- hsize_t small_cube_dims[] = {10, 10, 10};
- hsize_t start[3];
- hsize_t stride[3];
- hsize_t count[3];
- hsize_t block[3];
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hid_t small_square_sid;
+ hid_t small_cube_xy_slice_0_sid;
+ hid_t small_cube_xy_slice_1_sid;
+ hid_t small_cube_xy_slice_2_sid;
+ hid_t small_cube_xz_slice_0_sid;
+ hid_t small_cube_xz_slice_1_sid;
+ hid_t small_cube_xz_slice_2_sid;
+ hid_t small_cube_yz_slice_0_sid;
+ hid_t small_cube_yz_slice_1_sid;
+ hid_t small_cube_yz_slice_2_sid;
+ hid_t small_cube_yz_slice_3_sid;
+ hsize_t small_cube_dims[] = {10, 10, 10};
+ hsize_t start[3];
+ hsize_t stride[3];
+ hsize_t count[3];
+ hsize_t block[3];
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
MESSAGE(7, (" Smoke check 2: Checker board slices through a cube.\n"));
@@ -9450,37 +9808,34 @@ test_shape_same_dr__smoke_check_2(void)
small_square_sid = H5Screate_simple(2, small_cube_dims, NULL);
CHECK(small_square_sid, FAIL, "H5Screate_simple");
- start[0] = 0; /* x */
- start[1] = 0; /* y */
+ start[0] = 0; /* x */
+ start[1] = 0; /* y */
- stride[0] = 4; /* x */
- stride[1] = 4; /* y */
+ stride[0] = 4; /* x */
+ stride[1] = 4; /* y */
- count[0] = 3; /* x */
- count[1] = 3; /* y */
+ count[0] = 3; /* x */
+ count[1] = 3; /* y */
- block[0] = 2; /* x */
- block[1] = 2; /* y */
- ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 2; /* y */
+ ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 2; /* x */
- start[1] = 2; /* y */
+ start[0] = 2; /* x */
+ start[1] = 2; /* y */
- stride[0] = 4; /* x */
- stride[1] = 4; /* y */
+ stride[0] = 4; /* x */
+ stride[1] = 4; /* y */
- count[0] = 2; /* x */
- count[1] = 2; /* y */
+ count[0] = 2; /* x */
+ count[1] = 2; /* y */
- block[0] = 2; /* x */
- block[1] = 2; /* y */
- ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 2; /* y */
+ ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Create the 10 X 10 X 10 dataspaces for the hyperslab parallel to the xy axis */
small_cube_xy_slice_0_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xy_slice_0_sid, FAIL, "H5Screate_simple");
@@ -9491,67 +9846,58 @@ test_shape_same_dr__smoke_check_2(void)
small_cube_xy_slice_2_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xy_slice_2_sid, FAIL, "H5Screate_simple");
+ start[0] = 0; /* x */
+ start[1] = 0; /* y */
+ start[2] = 0; /* z */
- start[0] = 0; /* x */
- start[1] = 0; /* y */
- start[2] = 0; /* z */
-
- stride[0] = 4; /* x */
- stride[1] = 4; /* y */
- stride[2] = 20; /* z -- large enough that there will only be one slice */
+ stride[0] = 4; /* x */
+ stride[1] = 4; /* y */
+ stride[2] = 20; /* z -- large enough that there will only be one slice */
- count[0] = 3; /* x */
- count[1] = 3; /* y */
- count[2] = 1; /* z */
+ count[0] = 3; /* x */
+ count[1] = 3; /* y */
+ count[2] = 1; /* z */
- block[0] = 2; /* x */
- block[1] = 2; /* y */
- block[2] = 1; /* z */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 2; /* y */
+ block[2] = 1; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[2] = 3;
- ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[2] = 9;
- ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ start[0] = 2; /* x */
+ start[1] = 2; /* y */
+ start[2] = 0; /* z */
- start[0] = 2; /* x */
- start[1] = 2; /* y */
- start[2] = 0; /* z */
-
- stride[0] = 4; /* x */
- stride[1] = 4; /* y */
- stride[2] = 20; /* z -- large enough that there will only be one slice */
+ stride[0] = 4; /* x */
+ stride[1] = 4; /* y */
+ stride[2] = 20; /* z -- large enough that there will only be one slice */
- count[0] = 2; /* x */
- count[1] = 2; /* y */
- count[2] = 1; /* z */
+ count[0] = 2; /* x */
+ count[1] = 2; /* y */
+ count[2] = 1; /* z */
- block[0] = 2; /* x */
- block[1] = 2; /* y */
- block[2] = 1; /* z */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 2; /* y */
+ block[2] = 1; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[2] = 3;
- ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[2] = 9;
- ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Create the 10 X 10 X 10 dataspaces for the hyperslab parallel to the xz axis */
small_cube_xz_slice_0_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xz_slice_0_sid, FAIL, "H5Screate_simple");
@@ -9562,66 +9908,58 @@ test_shape_same_dr__smoke_check_2(void)
small_cube_xz_slice_2_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xz_slice_2_sid, FAIL, "H5Screate_simple");
+ start[0] = 0; /* x */
+ start[1] = 0; /* y */
+ start[2] = 0; /* z */
- start[0] = 0; /* x */
- start[1] = 0; /* y */
- start[2] = 0; /* z */
-
- stride[0] = 4; /* x */
- stride[1] = 20; /* y -- large enough that there will only be one slice */
- stride[2] = 4; /* z */
+ stride[0] = 4; /* x */
+ stride[1] = 20; /* y -- large enough that there will only be one slice */
+ stride[2] = 4; /* z */
- count[0] = 3; /* x */
- count[1] = 1; /* y */
- count[2] = 3; /* z */
+ count[0] = 3; /* x */
+ count[1] = 1; /* y */
+ count[2] = 3; /* z */
- block[0] = 2; /* x */
- block[1] = 1; /* y */
- block[2] = 2; /* z */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 1; /* y */
+ block[2] = 2; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[1] = 5;
- ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[1] = 9;
- ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 2; /* x */
- start[1] = 0; /* y */
- start[2] = 2; /* z */
+ start[0] = 2; /* x */
+ start[1] = 0; /* y */
+ start[2] = 2; /* z */
- stride[0] = 4; /* x */
- stride[1] = 20; /* y -- large enough that there will only be one slice */
- stride[2] = 4; /* z */
+ stride[0] = 4; /* x */
+ stride[1] = 20; /* y -- large enough that there will only be one slice */
+ stride[2] = 4; /* z */
- count[0] = 2; /* x */
- count[1] = 1; /* y */
- count[2] = 2; /* z */
+ count[0] = 2; /* x */
+ count[1] = 1; /* y */
+ count[2] = 2; /* z */
- block[0] = 2; /* x */
- block[1] = 1; /* y */
- block[2] = 2; /* z */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 1; /* y */
+ block[2] = 2; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[1] = 5;
- ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[1] = 9;
- ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Create the 10 X 10 X 10 dataspaces for the hyperslabs parallel to the yz axis */
small_cube_yz_slice_0_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_yz_slice_0_sid, FAIL, "H5Screate_simple");
@@ -9635,68 +9973,60 @@ test_shape_same_dr__smoke_check_2(void)
small_cube_yz_slice_3_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_yz_slice_3_sid, FAIL, "H5Screate_simple");
- start[0] = 0; /* x */
- start[1] = 0; /* y */
- start[2] = 0; /* z */
+ start[0] = 0; /* x */
+ start[1] = 0; /* y */
+ start[2] = 0; /* z */
- stride[0] = 20; /* x -- large enough that there will only be one slice */
- stride[1] = 4; /* y */
- stride[2] = 4; /* z */
+ stride[0] = 20; /* x -- large enough that there will only be one slice */
+ stride[1] = 4; /* y */
+ stride[2] = 4; /* z */
- count[0] = 1; /* x */
- count[1] = 3; /* y */
- count[2] = 3; /* z */
+ count[0] = 1; /* x */
+ count[1] = 3; /* y */
+ count[2] = 3; /* z */
- block[0] = 1; /* x */
- block[1] = 2; /* y */
- block[2] = 2; /* z */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 1; /* x */
+ block[1] = 2; /* y */
+ block[2] = 2; /* z */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 8;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 9;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 3;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_3_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_3_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ start[0] = 0; /* x */
+ start[1] = 2; /* y */
+ start[2] = 2; /* z */
- start[0] = 0; /* x */
- start[1] = 2; /* y */
- start[2] = 2; /* z */
-
- stride[0] = 20; /* x -- large enough that there will only be one slice */
- stride[1] = 4; /* y */
- stride[2] = 4; /* z */
+ stride[0] = 20; /* x -- large enough that there will only be one slice */
+ stride[1] = 4; /* y */
+ stride[2] = 4; /* z */
- count[0] = 1; /* x */
- count[1] = 2; /* y */
- count[2] = 2; /* z */
+ count[0] = 1; /* x */
+ count[1] = 2; /* y */
+ count[2] = 2; /* z */
- block[0] = 1; /* x */
- block[1] = 2; /* y */
- block[2] = 2; /* z */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 1; /* x */
+ block[1] = 2; /* y */
+ block[2] = 2; /* z */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 8;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 9;
- ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start[0] = 4;
@@ -9705,11 +10035,9 @@ test_shape_same_dr__smoke_check_2(void)
* the oddness looks like it is not related to my code.
* -- JRM
*/
- ret = H5Sselect_hyperslab(small_cube_yz_slice_3_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_3_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* setup is done -- run the tests: */
/* Compare against "xy" selection */
@@ -9722,7 +10050,6 @@ test_shape_same_dr__smoke_check_2(void)
check = H5Sselect_shape_same(small_cube_xy_slice_2_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
/* Compare against "xz" selection */
check = H5Sselect_shape_same(small_cube_xz_slice_0_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
@@ -9733,7 +10060,6 @@ test_shape_same_dr__smoke_check_2(void)
check = H5Sselect_shape_same(small_cube_xz_slice_2_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
/* Compare against "yz" selection */
check = H5Sselect_shape_same(small_cube_yz_slice_0_sid, small_square_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
@@ -9747,12 +10073,10 @@ test_shape_same_dr__smoke_check_2(void)
check = H5Sselect_shape_same(small_cube_yz_slice_3_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
/* Close dataspaces */
ret = H5Sclose(small_square_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(small_cube_xy_slice_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -9762,7 +10086,6 @@ test_shape_same_dr__smoke_check_2(void)
ret = H5Sclose(small_cube_xy_slice_2_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(small_cube_xz_slice_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -9772,7 +10095,6 @@ test_shape_same_dr__smoke_check_2(void)
ret = H5Sclose(small_cube_xz_slice_2_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(small_cube_yz_slice_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -9787,7 +10109,6 @@ test_shape_same_dr__smoke_check_2(void)
} /* test_shape_same_dr__smoke_check_2() */
-
/****************************************************************
**
** test_shape_same_dr__smoke_check_3():
@@ -9830,23 +10151,23 @@ test_shape_same_dr__smoke_check_2(void)
static void
test_shape_same_dr__smoke_check_3(void)
{
- hid_t small_square_sid;
- hid_t small_cube_xy_slice_0_sid;
- hid_t small_cube_xy_slice_1_sid;
- hid_t small_cube_xy_slice_2_sid;
- hid_t small_cube_xz_slice_0_sid;
- hid_t small_cube_xz_slice_1_sid;
- hid_t small_cube_xz_slice_2_sid;
- hid_t small_cube_yz_slice_0_sid;
- hid_t small_cube_yz_slice_1_sid;
- hid_t small_cube_yz_slice_2_sid;
- hsize_t small_cube_dims[] = {10, 10, 10};
- hsize_t start[3];
- hsize_t stride[3];
- hsize_t count[3];
- hsize_t block[3];
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hid_t small_square_sid;
+ hid_t small_cube_xy_slice_0_sid;
+ hid_t small_cube_xy_slice_1_sid;
+ hid_t small_cube_xy_slice_2_sid;
+ hid_t small_cube_xz_slice_0_sid;
+ hid_t small_cube_xz_slice_1_sid;
+ hid_t small_cube_xz_slice_2_sid;
+ hid_t small_cube_yz_slice_0_sid;
+ hid_t small_cube_yz_slice_1_sid;
+ hid_t small_cube_yz_slice_2_sid;
+ hsize_t small_cube_dims[] = {10, 10, 10};
+ hsize_t start[3];
+ hsize_t stride[3];
+ hsize_t count[3];
+ hsize_t block[3];
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
MESSAGE(7, (" Smoke check 3: Offset subsets of slices through a cube.\n"));
@@ -9854,52 +10175,48 @@ test_shape_same_dr__smoke_check_3(void)
small_square_sid = H5Screate_simple(2, small_cube_dims, NULL);
CHECK(small_square_sid, FAIL, "H5Screate_simple");
- start[0] = 2; /* x */
- start[1] = 3; /* y */
+ start[0] = 2; /* x */
+ start[1] = 3; /* y */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
- block[0] = 2; /* x */
- block[1] = 4; /* y */
- ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 4; /* y */
+ ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 3; /* x */
- start[1] = 6; /* y */
+ start[0] = 3; /* x */
+ start[1] = 6; /* y */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
- block[0] = 4; /* x */
- block[1] = 2; /* y */
- ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 4; /* x */
+ block[1] = 2; /* y */
+ ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 5; /* x */
- start[1] = 3; /* y */
+ start[0] = 5; /* x */
+ start[1] = 3; /* y */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
- block[0] = 2; /* x */
- block[1] = 2; /* y */
- ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 2; /* y */
+ ret = H5Sselect_hyperslab(small_square_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Create the 10 X 10 X 10 dataspaces for the hyperslab parallel to the xy axis */
small_cube_xy_slice_0_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xy_slice_0_sid, FAIL, "H5Screate_simple");
@@ -9910,107 +10227,96 @@ test_shape_same_dr__smoke_check_3(void)
small_cube_xy_slice_2_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xy_slice_2_sid, FAIL, "H5Screate_simple");
+ start[0] = 2; /* x */
+ start[1] = 3; /* y */
+ start[2] = 5; /* z */
- start[0] = 2; /* x */
- start[1] = 3; /* y */
- start[2] = 5; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
-
- block[0] = 2; /* x */
- block[1] = 4; /* y */
- block[2] = 1; /* z */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 4; /* y */
+ block[2] = 1; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the starting point to the origin */
- start[0] -= 1; /* x */
- start[1] -= 2; /* y */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ start[0] -= 1; /* x */
+ start[1] -= 2; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the irregular selection to the upper right hand corner */
- start[0] += 5; /* x */
- start[1] += 5; /* y */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ start[0] += 5; /* x */
+ start[1] += 5; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 3; /* x */
- start[1] = 6; /* y */
- start[2] = 5; /* z */
+ start[0] = 3; /* x */
+ start[1] = 6; /* y */
+ start[2] = 5; /* z */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 4; /* x */
- block[1] = 2; /* y */
- block[2] = 1; /* z */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 4; /* x */
+ block[1] = 2; /* y */
+ block[2] = 1; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the starting point to the origin */
- start[0] -= 1; /* x */
- start[1] -= 2; /* y */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] -= 1; /* x */
+ start[1] -= 2; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the irregular selection to the upper right hand corner */
- start[0] += 5; /* x */
- start[1] += 5; /* y */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] += 5; /* x */
+ start[1] += 5; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 5; /* x */
- start[1] = 3; /* y */
- start[2] = 5; /* z */
+ start[0] = 5; /* x */
+ start[1] = 3; /* y */
+ start[2] = 5; /* z */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 2; /* x */
- block[1] = 2; /* y */
- block[2] = 1; /* z */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 2; /* y */
+ block[2] = 1; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the starting point to the origin */
- start[0] -= 1; /* x */
- start[1] -= 2; /* y */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] -= 1; /* x */
+ start[1] -= 2; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_1_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the irregular selection to the upper right hand corner */
- start[0] += 5; /* x */
- start[1] += 5; /* y */
- ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] += 5; /* x */
+ start[1] += 5; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xy_slice_2_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Create the 10 X 10 X 10 dataspaces for the hyperslab parallel to the xz axis */
small_cube_xz_slice_0_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xz_slice_0_sid, FAIL, "H5Screate_simple");
@@ -10021,108 +10327,98 @@ test_shape_same_dr__smoke_check_3(void)
small_cube_xz_slice_2_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_xz_slice_2_sid, FAIL, "H5Screate_simple");
- start[0] = 2; /* x */
- start[1] = 5; /* y */
- start[2] = 3; /* z */
+ start[0] = 2; /* x */
+ start[1] = 5; /* y */
+ start[2] = 3; /* z */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 2; /* x */
- block[1] = 1; /* y */
- block[2] = 4; /* z */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 1; /* y */
+ block[2] = 4; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the starting point to the origin */
- start[0] -= 1; /* x */
- start[2] -= 2; /* y */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ start[0] -= 1; /* x */
+ start[2] -= 2; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the irregular selection to the upper right hand corner */
- start[0] += 5; /* x */
- start[2] += 5; /* y */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ start[0] += 5; /* x */
+ start[2] += 5; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 3; /* x */
- start[1] = 5; /* y */
- start[2] = 6; /* z */
+ start[0] = 3; /* x */
+ start[1] = 5; /* y */
+ start[2] = 6; /* z */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 4; /* x */
- block[1] = 1; /* y */
- block[2] = 2; /* z */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 4; /* x */
+ block[1] = 1; /* y */
+ block[2] = 2; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the starting point to the origin */
- start[0] -= 1; /* x */
- start[2] -= 2; /* y */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] -= 1; /* x */
+ start[2] -= 2; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the irregular selection to the upper right hand corner */
- start[0] += 5; /* x */
- start[2] += 5; /* y */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] += 5; /* x */
+ start[2] += 5; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 5; /* x */
- start[1] = 5; /* y */
- start[2] = 3; /* z */
+ start[0] = 5; /* x */
+ start[1] = 5; /* y */
+ start[2] = 3; /* z */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 2; /* x */
- block[1] = 1; /* y */
- block[2] = 2; /* z */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 2; /* x */
+ block[1] = 1; /* y */
+ block[2] = 2; /* z */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the starting point to the origin */
- start[0] -= 1; /* x */
- start[2] -= 2; /* y */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] -= 1; /* x */
+ start[2] -= 2; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_1_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the irregular selection to the upper right hand corner */
- start[0] += 5; /* x */
- start[2] += 5; /* y */
- ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] += 5; /* x */
+ start[2] += 5; /* y */
+ ret = H5Sselect_hyperslab(small_cube_xz_slice_2_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
-/* QAK: Start here.
- */
+ /* QAK: Start here.
+ */
/* Create the 10 X 10 X 10 dataspaces for the hyperslabs parallel to the yz axis */
small_cube_yz_slice_0_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_yz_slice_0_sid, FAIL, "H5Screate_simple");
@@ -10133,106 +10429,96 @@ test_shape_same_dr__smoke_check_3(void)
small_cube_yz_slice_2_sid = H5Screate_simple(3, small_cube_dims, NULL);
CHECK(small_cube_yz_slice_2_sid, FAIL, "H5Screate_simple");
- start[0] = 8; /* x */
- start[1] = 2; /* y */
- start[2] = 3; /* z */
+ start[0] = 8; /* x */
+ start[1] = 2; /* y */
+ start[2] = 3; /* z */
- stride[0] = 20; /* x -- large enough that there will only be one slice */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x -- large enough that there will only be one slice */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 1; /* x */
- block[1] = 2; /* y */
- block[2] = 4; /* z */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ block[0] = 1; /* x */
+ block[1] = 2; /* y */
+ block[2] = 4; /* z */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the starting point to the origin */
- start[1] -= 1; /* x */
- start[2] -= 2; /* y */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ start[1] -= 1; /* x */
+ start[2] -= 2; /* y */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the irregular selection to the upper right hand corner */
- start[0] += 5; /* x */
- start[2] += 5; /* y */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ start[0] += 5; /* x */
+ start[2] += 5; /* y */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 8; /* x */
- start[1] = 3; /* y */
- start[2] = 6; /* z */
+ start[0] = 8; /* x */
+ start[1] = 3; /* y */
+ start[2] = 6; /* z */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 1; /* x */
- block[1] = 4; /* y */
- block[2] = 2; /* z */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 1; /* x */
+ block[1] = 4; /* y */
+ block[2] = 2; /* z */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the starting point to the origin */
- start[1] -= 1; /* x */
- start[2] -= 2; /* y */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[1] -= 1; /* x */
+ start[2] -= 2; /* y */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the irregular selection to the upper right hand corner */
- start[0] += 5; /* x */
- start[2] += 5; /* y */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] += 5; /* x */
+ start[2] += 5; /* y */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 8; /* x */
- start[1] = 5; /* y */
- start[2] = 3; /* z */
+ start[0] = 8; /* x */
+ start[1] = 5; /* y */
+ start[2] = 3; /* z */
- stride[0] = 20; /* x */
- stride[1] = 20; /* y */
- stride[2] = 20; /* z */
+ stride[0] = 20; /* x */
+ stride[1] = 20; /* y */
+ stride[2] = 20; /* z */
- count[0] = 1; /* x */
- count[1] = 1; /* y */
- count[2] = 1; /* z */
+ count[0] = 1; /* x */
+ count[1] = 1; /* y */
+ count[2] = 1; /* z */
- block[0] = 1; /* x */
- block[1] = 2; /* y */
- block[2] = 2; /* z */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ block[0] = 1; /* x */
+ block[1] = 2; /* y */
+ block[2] = 2; /* z */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the starting point to the origin */
- start[1] -= 1; /* x */
- start[2] -= 2; /* y */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[1] -= 1; /* x */
+ start[2] -= 2; /* y */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_1_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* move the irregular selection to the upper right hand corner */
- start[0] += 5; /* x */
- start[2] += 5; /* y */
- ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ start[0] += 5; /* x */
+ start[2] += 5; /* y */
+ ret = H5Sselect_hyperslab(small_cube_yz_slice_2_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* setup is done -- run the tests: */
/* Compare against "xy" selection */
@@ -10245,7 +10531,6 @@ test_shape_same_dr__smoke_check_3(void)
check = H5Sselect_shape_same(small_cube_xy_slice_2_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
/* Compare against "xz" selection */
check = H5Sselect_shape_same(small_cube_xz_slice_0_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
@@ -10256,7 +10541,6 @@ test_shape_same_dr__smoke_check_3(void)
check = H5Sselect_shape_same(small_cube_xz_slice_2_sid, small_square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
/* Compare against "yz" selection */
check = H5Sselect_shape_same(small_cube_yz_slice_0_sid, small_square_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
@@ -10267,12 +10551,10 @@ test_shape_same_dr__smoke_check_3(void)
check = H5Sselect_shape_same(small_cube_yz_slice_2_sid, small_square_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
-
/* Close dataspaces */
ret = H5Sclose(small_square_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(small_cube_xy_slice_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -10282,7 +10564,6 @@ test_shape_same_dr__smoke_check_3(void)
ret = H5Sclose(small_cube_xy_slice_2_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(small_cube_xz_slice_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -10292,7 +10573,6 @@ test_shape_same_dr__smoke_check_3(void)
ret = H5Sclose(small_cube_xz_slice_2_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(small_cube_yz_slice_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -10303,7 +10583,6 @@ test_shape_same_dr__smoke_check_3(void)
CHECK(ret, FAIL, "H5Sclose");
} /* test_shape_same_dr__smoke_check_3() */
-
/****************************************************************
**
** test_shape_same_dr__smoke_check_4():
@@ -10337,21 +10616,21 @@ test_shape_same_dr__smoke_check_3(void)
static void
test_shape_same_dr__smoke_check_4(void)
{
- hid_t square_sid;
- hid_t three_d_space_0_sid;
- hid_t three_d_space_1_sid;
- hid_t three_d_space_2_sid;
- hid_t three_d_space_3_sid;
- hid_t four_d_space_0_sid;
- hid_t four_d_space_1_sid;
- hid_t four_d_space_2_sid;
- hid_t four_d_space_3_sid;
- hid_t four_d_space_4_sid;
- hid_t four_d_space_5_sid;
- hid_t four_d_space_6_sid;
- hsize_t dims[] = {10, 10, 10, 10};
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hid_t square_sid;
+ hid_t three_d_space_0_sid;
+ hid_t three_d_space_1_sid;
+ hid_t three_d_space_2_sid;
+ hid_t three_d_space_3_sid;
+ hid_t four_d_space_0_sid;
+ hid_t four_d_space_1_sid;
+ hid_t four_d_space_2_sid;
+ hid_t four_d_space_3_sid;
+ hid_t four_d_space_4_sid;
+ hid_t four_d_space_5_sid;
+ hid_t four_d_space_6_sid;
+ hsize_t dims[] = {10, 10, 10, 10};
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
MESSAGE(7, (" Smoke check 4: Spaces of different dimension but same size.\n"));
@@ -10360,91 +10639,89 @@ test_shape_same_dr__smoke_check_4(void)
CHECK(square_sid, FAIL, "H5Screate_simple");
/* create (1 X 10 X 10) dataspace */
- dims[0] = 1;
- dims[1] = 10;
- dims[2] = 10;
+ dims[0] = 1;
+ dims[1] = 10;
+ dims[2] = 10;
three_d_space_0_sid = H5Screate_simple(3, dims, NULL);
CHECK(three_d_space_0_sid, FAIL, "H5Screate_simple");
/* create (10 X 1 X 10) dataspace */
- dims[0] = 10;
- dims[1] = 1;
- dims[2] = 10;
+ dims[0] = 10;
+ dims[1] = 1;
+ dims[2] = 10;
three_d_space_1_sid = H5Screate_simple(3, dims, NULL);
CHECK(three_d_space_1_sid, FAIL, "H5Screate_simple");
/* create (10 X 10 X 1) dataspace */
- dims[0] = 10;
- dims[1] = 10;
- dims[2] = 1;
+ dims[0] = 10;
+ dims[1] = 10;
+ dims[2] = 1;
three_d_space_2_sid = H5Screate_simple(3, dims, NULL);
CHECK(three_d_space_2_sid, FAIL, "H5Screate_simple");
/* create (10 X 10 X 10) dataspace */
- dims[0] = 10;
- dims[1] = 10;
- dims[2] = 10;
+ dims[0] = 10;
+ dims[1] = 10;
+ dims[2] = 10;
three_d_space_3_sid = H5Screate_simple(3, dims, NULL);
CHECK(three_d_space_3_sid, FAIL, "H5Screate_simple");
-
/* create (1 X 1 X 10 X 10) dataspace */
- dims[0] = 1;
- dims[1] = 1;
- dims[2] = 10;
- dims[3] = 10;
+ dims[0] = 1;
+ dims[1] = 1;
+ dims[2] = 10;
+ dims[3] = 10;
four_d_space_0_sid = H5Screate_simple(4, dims, NULL);
CHECK(four_d_space_0_sid, FAIL, "H5Screate_simple");
/* create (1 X 10 X 1 X 10) dataspace */
- dims[0] = 1;
- dims[1] = 10;
- dims[2] = 1;
- dims[3] = 10;
+ dims[0] = 1;
+ dims[1] = 10;
+ dims[2] = 1;
+ dims[3] = 10;
four_d_space_1_sid = H5Screate_simple(4, dims, NULL);
CHECK(four_d_space_1_sid, FAIL, "H5Screate_simple");
/* create (1 X 10 X 10 X 1) dataspace */
- dims[0] = 1;
- dims[1] = 10;
- dims[2] = 10;
- dims[3] = 1;
+ dims[0] = 1;
+ dims[1] = 10;
+ dims[2] = 10;
+ dims[3] = 1;
four_d_space_2_sid = H5Screate_simple(4, dims, NULL);
CHECK(four_d_space_2_sid, FAIL, "H5Screate_simple");
/* create (10 X 1 X 1 X 10) dataspace */
- dims[0] = 10;
- dims[1] = 1;
- dims[2] = 1;
- dims[3] = 10;
+ dims[0] = 10;
+ dims[1] = 1;
+ dims[2] = 1;
+ dims[3] = 10;
four_d_space_3_sid = H5Screate_simple(4, dims, NULL);
CHECK(four_d_space_3_sid, FAIL, "H5Screate_simple");
/* create (10 X 1 X 10 X 1) dataspace */
- dims[0] = 10;
- dims[1] = 1;
- dims[2] = 10;
- dims[3] = 1;
+ dims[0] = 10;
+ dims[1] = 1;
+ dims[2] = 10;
+ dims[3] = 1;
four_d_space_4_sid = H5Screate_simple(4, dims, NULL);
CHECK(four_d_space_4_sid, FAIL, "H5Screate_simple");
/* create (10 X 10 X 1 X 1) dataspace */
- dims[0] = 10;
- dims[1] = 10;
- dims[2] = 1;
- dims[3] = 1;
+ dims[0] = 10;
+ dims[1] = 10;
+ dims[2] = 1;
+ dims[3] = 1;
four_d_space_5_sid = H5Screate_simple(4, dims, NULL);
CHECK(four_d_space_5_sid, FAIL, "H5Screate_simple");
/* create (10 X 1 X 10 X 10) dataspace */
- dims[0] = 10;
- dims[1] = 1;
- dims[2] = 10;
- dims[3] = 10;
+ dims[0] = 10;
+ dims[1] = 1;
+ dims[2] = 10;
+ dims[3] = 10;
four_d_space_6_sid = H5Screate_simple(4, dims, NULL);
CHECK(four_d_space_6_sid, FAIL, "H5Screate_simple");
-
/* setup is done -- run the tests: */
check = H5Sselect_shape_same(three_d_space_0_sid, square_sid);
@@ -10459,7 +10736,6 @@ test_shape_same_dr__smoke_check_4(void)
check = H5Sselect_shape_same(three_d_space_3_sid, square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
check = H5Sselect_shape_same(four_d_space_0_sid, square_sid);
VERIFY(check, TRUE, "H5Sselect_shape_same");
@@ -10481,12 +10757,10 @@ test_shape_same_dr__smoke_check_4(void)
check = H5Sselect_shape_same(four_d_space_6_sid, square_sid);
VERIFY(check, FALSE, "H5Sselect_shape_same");
-
/* Close dataspaces */
ret = H5Sclose(square_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(three_d_space_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -10499,7 +10773,6 @@ test_shape_same_dr__smoke_check_4(void)
ret = H5Sclose(three_d_space_3_sid);
CHECK(ret, FAIL, "H5Sclose");
-
ret = H5Sclose(four_d_space_0_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -10537,73 +10810,60 @@ test_shape_same_dr__smoke_check_4(void)
**
****************************************************************/
static void
-test_shape_same_dr__full_space_vs_slice(int test_num,
- int small_rank,
- int large_rank,
- int offset,
- hsize_t edge_size,
- hbool_t dim_selected[],
- hbool_t expected_result)
+test_shape_same_dr__full_space_vs_slice(int test_num, int small_rank, int large_rank, int offset,
+ hsize_t edge_size, hbool_t dim_selected[], hbool_t expected_result)
{
- char test_desc_0[128];
- char test_desc_1[256];
- int i;
- hid_t n_cube_0_sid; /* the fully selected hyper cube */
- hid_t n_cube_1_sid; /* the hyper cube in which a slice is selected */
- hsize_t dims[SS_DR_MAX_RANK];
- hsize_t start[SS_DR_MAX_RANK];
- hsize_t * start_ptr;
- hsize_t stride[SS_DR_MAX_RANK];
- hsize_t * stride_ptr;
- hsize_t count[SS_DR_MAX_RANK];
- hsize_t * count_ptr;
- hsize_t block[SS_DR_MAX_RANK];
- hsize_t * block_ptr;
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
-
- HDassert( 0 < small_rank );
- HDassert( small_rank <= large_rank );
- HDassert( large_rank <= SS_DR_MAX_RANK );
- HDassert( 0 <= offset );
- HDassert( offset < large_rank );
- HDassert( edge_size > 0 );
- HDassert( edge_size <= 1000 );
-
- HDsprintf(test_desc_0,
- "\tn-cube slice through m-cube (n <= m) test %d.\n",
- test_num);
+ char test_desc_0[128];
+ char test_desc_1[256];
+ int i;
+ hid_t n_cube_0_sid; /* the fully selected hyper cube */
+ hid_t n_cube_1_sid; /* the hyper cube in which a slice is selected */
+ hsize_t dims[SS_DR_MAX_RANK];
+ hsize_t start[SS_DR_MAX_RANK];
+ hsize_t *start_ptr;
+ hsize_t stride[SS_DR_MAX_RANK];
+ hsize_t *stride_ptr;
+ hsize_t count[SS_DR_MAX_RANK];
+ hsize_t *count_ptr;
+ hsize_t block[SS_DR_MAX_RANK];
+ hsize_t *block_ptr;
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
+
+ HDassert(0 < small_rank);
+ HDassert(small_rank <= large_rank);
+ HDassert(large_rank <= SS_DR_MAX_RANK);
+ HDassert(0 <= offset);
+ HDassert(offset < large_rank);
+ HDassert(edge_size > 0);
+ HDassert(edge_size <= 1000);
+
+ HDsprintf(test_desc_0, "\tn-cube slice through m-cube (n <= m) test %d.\n", test_num);
MESSAGE(7, (test_desc_0));
/* This statement must be updated if SS_DR_MAX_RANK is changed */
- HDsprintf(test_desc_1,
- "\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n",
- small_rank, large_rank, offset,
- (int)dim_selected[0],
- (int)dim_selected[1],
- (int)dim_selected[2],
- (int)dim_selected[3],
- (int)dim_selected[4]);
+ HDsprintf(test_desc_1, "\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n", small_rank,
+ large_rank, offset, (int)dim_selected[0], (int)dim_selected[1], (int)dim_selected[2],
+ (int)dim_selected[3], (int)dim_selected[4]);
MESSAGE(7, (test_desc_1));
/* copy the edge size into the dims array */
- for(i = 0; i < SS_DR_MAX_RANK; i++)
+ for (i = 0; i < SS_DR_MAX_RANK; i++)
dims[i] = edge_size;
/* Create the small n-cube */
n_cube_0_sid = H5Screate_simple(small_rank, dims, NULL);
CHECK(n_cube_0_sid, FAIL, "H5Screate_simple");
-
/* Create the large n-cube */
n_cube_1_sid = H5Screate_simple(large_rank, dims, NULL);
CHECK(n_cube_1_sid, FAIL, "H5Screate_simple");
/* set up start, stride, count, and block for the hyperslab selection */
- for(i = 0; i < SS_DR_MAX_RANK; i++) {
+ for (i = 0; i < SS_DR_MAX_RANK; i++) {
stride[i] = 2 * edge_size; /* a bit silly in this case */
- count[i] = 1;
- if(dim_selected[i]) {
+ count[i] = 1;
+ if (dim_selected[i]) {
start[i] = 0;
block[i] = edge_size;
} /* end if */
@@ -10611,7 +10871,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num,
start[i] = (hsize_t)offset;
block[i] = 1;
} /* end else */
- } /* end for */
+ } /* end for */
/* since large rank may be less than SS_DR_MAX_RANK, we may not
* use the entire start, stride, count, and block arrays. This
@@ -10633,26 +10893,21 @@ test_shape_same_dr__full_space_vs_slice(int test_num,
count_ptr = &(count[i]);
block_ptr = &(block[i]);
-
/* select the hyperslab */
- ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_SET,
- start_ptr, stride_ptr, count_ptr, block_ptr);
+ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_SET, start_ptr, stride_ptr, count_ptr, block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* setup is done -- run the test: */
check = H5Sselect_shape_same(n_cube_0_sid, n_cube_1_sid);
VERIFY(check, expected_result, "H5Sselect_shape_same");
-
/* Close dataspaces */
ret = H5Sclose(n_cube_0_sid);
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(n_cube_1_sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_shape_same_dr__full_space_vs_slice() */
-
+} /* test_shape_same_dr__full_space_vs_slice() */
/****************************************************************
**
@@ -10685,123 +10940,100 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void)
{
hbool_t dim_selected[5];
hbool_t expected_result;
- int i, j;
- int v, w, x, y, z;
- int test_num = 0;
- int small_rank;
- int large_rank;
+ int i, j;
+ int v, w, x, y, z;
+ int test_num = 0;
+ int small_rank;
+ int large_rank;
hsize_t edge_size = 10;
- for(large_rank = 1; large_rank <= 5; large_rank++) {
- for(small_rank = 1; small_rank <= large_rank; small_rank++) {
+ for (large_rank = 1; large_rank <= 5; large_rank++) {
+ for (small_rank = 1; small_rank <= large_rank; small_rank++) {
v = 0;
do {
- if(v == 0)
+ if (v == 0)
dim_selected[0] = FALSE;
else
dim_selected[0] = TRUE;
w = 0;
do {
- if(w == 0)
+ if (w == 0)
dim_selected[1] = FALSE;
else
dim_selected[1] = TRUE;
x = 0;
do {
- if(x == 0)
+ if (x == 0)
dim_selected[2] = FALSE;
else
dim_selected[2] = TRUE;
y = 0;
do {
- if(y == 0)
+ if (y == 0)
dim_selected[3] = FALSE;
else
dim_selected[3] = TRUE;
z = 0;
do {
- if(z == 0)
+ if (z == 0)
dim_selected[4] = FALSE;
else
dim_selected[4] = TRUE;
/* compute the expected result: */
- i = 0;
- j = 4;
+ i = 0;
+ j = 4;
expected_result = TRUE;
- while((i < small_rank) && expected_result) {
- if(!dim_selected[j])
+ while ((i < small_rank) && expected_result) {
+ if (!dim_selected[j])
expected_result = FALSE;
i++;
j--;
} /* end while */
- while((i < large_rank) && expected_result) {
- if(dim_selected[j])
+ while ((i < large_rank) && expected_result) {
+ if (dim_selected[j])
expected_result = FALSE;
i++;
j--;
} /* end while */
-
/* everything is set up -- run the tests */
- test_shape_same_dr__full_space_vs_slice
- (
- test_num++,
- small_rank,
- large_rank,
- 0,
- edge_size,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__full_space_vs_slice
- (
- test_num++,
- small_rank,
- large_rank,
- large_rank / 2,
- edge_size,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__full_space_vs_slice
- (
- test_num++,
- small_rank,
- large_rank,
- large_rank - 1,
- edge_size,
- dim_selected,
- expected_result
- );
+ test_shape_same_dr__full_space_vs_slice(test_num++, small_rank, large_rank, 0,
+ edge_size, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__full_space_vs_slice(test_num++, small_rank, large_rank,
+ large_rank / 2, edge_size,
+ dim_selected, expected_result);
+
+ test_shape_same_dr__full_space_vs_slice(test_num++, small_rank, large_rank,
+ large_rank - 1, edge_size,
+ dim_selected, expected_result);
z++;
- } while((z < 2) && (large_rank >= 1));
+ } while ((z < 2) && (large_rank >= 1));
y++;
- } while((y < 2) && (large_rank >= 2));
+ } while ((y < 2) && (large_rank >= 2));
x++;
- } while((x < 2) && (large_rank >= 3));
+ } while ((x < 2) && (large_rank >= 3));
w++;
- } while((w < 2) && (large_rank >= 4));
+ } while ((w < 2) && (large_rank >= 4));
v++;
- } while((v < 2) && (large_rank >= 5));
+ } while ((v < 2) && (large_rank >= 5));
} /* end for */
- } /* end for */
+ } /* end for */
} /* test_shape_same_dr__run_full_space_vs_slice_tests() */
-
/****************************************************************
**
** test_shape_same_dr__checkerboard(): Tests selection of a
@@ -10819,78 +11051,64 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void)
**
****************************************************************/
static void
-test_shape_same_dr__checkerboard(int test_num,
- int small_rank,
- int large_rank,
- int offset,
- hsize_t edge_size,
- hsize_t checker_size,
- hbool_t dim_selected[],
- hbool_t expected_result)
+test_shape_same_dr__checkerboard(int test_num, int small_rank, int large_rank, int offset, hsize_t edge_size,
+ hsize_t checker_size, hbool_t dim_selected[], hbool_t expected_result)
{
- char test_desc_0[128];
- char test_desc_1[256];
- int i;
- int dims_selected = 0;
- hid_t n_cube_0_sid; /* the checker board selected
- * hyper cube
- */
- hid_t n_cube_1_sid; /* the hyper cube in which a
- * checkerboard slice is selected
- */
- hsize_t dims[SS_DR_MAX_RANK];
- hsize_t base_start[2];
- hsize_t start[SS_DR_MAX_RANK];
- hsize_t * start_ptr;
- hsize_t base_stride[2];
- hsize_t stride[SS_DR_MAX_RANK];
- hsize_t * stride_ptr;
- hsize_t base_count[2];
- hsize_t count[SS_DR_MAX_RANK];
- hsize_t * count_ptr;
- hsize_t base_block[2];
- hsize_t block[SS_DR_MAX_RANK];
- hsize_t * block_ptr;
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
-
- HDassert( 0 < small_rank );
- HDassert( small_rank <= large_rank );
- HDassert( large_rank <= SS_DR_MAX_RANK );
- HDassert( 0 < checker_size );
- HDassert( checker_size <= edge_size );
- HDassert( edge_size <= 1000 );
- HDassert( 0 <= offset );
- HDassert( offset < (int)edge_size );
-
- for(i = SS_DR_MAX_RANK - large_rank; i < SS_DR_MAX_RANK; i++)
- if(dim_selected[i] == TRUE)
+ char test_desc_0[128];
+ char test_desc_1[256];
+ int i;
+ int dims_selected = 0;
+ hid_t n_cube_0_sid; /* the checker board selected
+ * hyper cube
+ */
+ hid_t n_cube_1_sid; /* the hyper cube in which a
+ * checkerboard slice is selected
+ */
+ hsize_t dims[SS_DR_MAX_RANK];
+ hsize_t base_start[2];
+ hsize_t start[SS_DR_MAX_RANK];
+ hsize_t *start_ptr;
+ hsize_t base_stride[2];
+ hsize_t stride[SS_DR_MAX_RANK];
+ hsize_t *stride_ptr;
+ hsize_t base_count[2];
+ hsize_t count[SS_DR_MAX_RANK];
+ hsize_t *count_ptr;
+ hsize_t base_block[2];
+ hsize_t block[SS_DR_MAX_RANK];
+ hsize_t *block_ptr;
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
+
+ HDassert(0 < small_rank);
+ HDassert(small_rank <= large_rank);
+ HDassert(large_rank <= SS_DR_MAX_RANK);
+ HDassert(0 < checker_size);
+ HDassert(checker_size <= edge_size);
+ HDassert(edge_size <= 1000);
+ HDassert(0 <= offset);
+ HDassert(offset < (int)edge_size);
+
+ for (i = SS_DR_MAX_RANK - large_rank; i < SS_DR_MAX_RANK; i++)
+ if (dim_selected[i] == TRUE)
dims_selected++;
- HDassert( dims_selected >= 0 );
- HDassert( dims_selected <= large_rank );
+ HDassert(dims_selected >= 0);
+ HDassert(dims_selected <= large_rank);
- HDsprintf(test_desc_0,
- "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n",
- test_num);
+ HDsprintf(test_desc_0, "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", test_num);
MESSAGE(7, (test_desc_0));
/* This statement must be updated if SS_DR_MAX_RANK is changed */
HDsprintf(test_desc_1,
"\tranks: %d/%d edge/chkr size: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d:%d.\n",
- small_rank, large_rank,
- (int)edge_size, (int)checker_size,
- offset,
- (int)dim_selected[0],
- (int)dim_selected[1],
- (int)dim_selected[2],
- (int)dim_selected[3],
- (int)dim_selected[4],
+ small_rank, large_rank, (int)edge_size, (int)checker_size, offset, (int)dim_selected[0],
+ (int)dim_selected[1], (int)dim_selected[2], (int)dim_selected[3], (int)dim_selected[4],
dims_selected);
MESSAGE(7, (test_desc_1));
/* copy the edge size into the dims array */
- for(i = 0; i < SS_DR_MAX_RANK; i++)
+ for (i = 0; i < SS_DR_MAX_RANK; i++)
dims[i] = edge_size;
/* Create the small n-cube */
@@ -10966,11 +11184,11 @@ test_shape_same_dr__checkerboard(int test_num,
*/
base_count[0] = edge_size / (checker_size * 2);
- if((edge_size % (checker_size * 2)) > 0)
- base_count[0]++;
+ if ((edge_size % (checker_size * 2)) > 0)
+ base_count[0]++;
base_count[1] = (edge_size - checker_size) / (checker_size * 2);
- if(((edge_size - checker_size) % (checker_size * 2)) > 0)
+ if (((edge_size - checker_size) % (checker_size * 2)) > 0)
base_count[1]++;
base_block[0] = checker_size;
@@ -10979,15 +11197,14 @@ test_shape_same_dr__checkerboard(int test_num,
/* now setup start, stride, count, and block arrays for
* the first call to H5Sselect_hyperslab().
*/
- for(i = 0; i < SS_DR_MAX_RANK; i++) {
+ for (i = 0; i < SS_DR_MAX_RANK; i++) {
start[i] = base_start[0];
stride[i] = base_stride[0];
count[i] = base_count[0];
block[i] = base_block[0];
} /* end for */
- ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_SET,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* if small_rank == 1, or if edge_size == checker_size, we
@@ -10998,16 +11215,15 @@ test_shape_same_dr__checkerboard(int test_num,
* make the additional selection.
*/
- if((small_rank > 1) && (checker_size < edge_size)) {
- for(i = 0; i < SS_DR_MAX_RANK; i++) {
+ if ((small_rank > 1) && (checker_size < edge_size)) {
+ for (i = 0; i < SS_DR_MAX_RANK; i++) {
start[i] = base_start[1];
stride[i] = base_stride[1];
count[i] = base_count[1];
block[i] = base_block[1];
} /* end for */
- ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_OR,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* end if */
@@ -11018,31 +11234,28 @@ test_shape_same_dr__checkerboard(int test_num,
* code to manually clip the selection back to the dataspace
* proper.
*/
- for(i = 0; i < SS_DR_MAX_RANK; i++) {
+ for (i = 0; i < SS_DR_MAX_RANK; i++) {
start[i] = 0;
stride[i] = edge_size;
count[i] = 1;
block[i] = edge_size;
} /* end for */
- ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_AND,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_AND, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Create the large n-cube */
n_cube_1_sid = H5Screate_simple(large_rank, dims, NULL);
CHECK(n_cube_1_sid, FAIL, "H5Screate_simple");
-
/* Now select the checkerboard selection in the (possibly larger) n-cube.
*
* Since we have already calculated the base start, stride, count,
* and block, re-use the values in setting up start, stride, count,
* and block.
*/
- for(i = 0; i < SS_DR_MAX_RANK; i++) {
- if(dim_selected[i]) {
+ for (i = 0; i < SS_DR_MAX_RANK; i++) {
+ if (dim_selected[i]) {
start[i] = base_start[0];
stride[i] = base_stride[0];
count[i] = base_count[0];
@@ -11054,7 +11267,7 @@ test_shape_same_dr__checkerboard(int test_num,
count[i] = 1;
block[i] = 1;
} /* end else */
- } /* end for */
+ } /* end for */
/* Since large rank may be less than SS_DR_MAX_RANK, we may not
* use the entire start, stride, count, and block arrays. This
@@ -11069,7 +11282,7 @@ test_shape_same_dr__checkerboard(int test_num,
*/
i = SS_DR_MAX_RANK - large_rank;
- HDassert( i >= 0 );
+ HDassert(i >= 0);
start_ptr = &(start[i]);
stride_ptr = &(stride[i]);
@@ -11077,8 +11290,7 @@ test_shape_same_dr__checkerboard(int test_num,
block_ptr = &(block[i]);
/* select the hyperslab */
- ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_SET,
- start_ptr, stride_ptr, count_ptr, block_ptr);
+ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_SET, start_ptr, stride_ptr, count_ptr, block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* As before, if the number of dimensions selected is less than or
@@ -11090,9 +11302,9 @@ test_shape_same_dr__checkerboard(int test_num,
* Otherwise, set up start, stride, count and block, and
* make the additional selection.
*/
- if((dims_selected > 1) && (checker_size < edge_size)) {
- for(i = 0; i < SS_DR_MAX_RANK; i++) {
- if(dim_selected[i]) {
+ if ((dims_selected > 1) && (checker_size < edge_size)) {
+ for (i = 0; i < SS_DR_MAX_RANK; i++) {
+ if (dim_selected[i]) {
start[i] = base_start[1];
stride[i] = base_stride[1];
count[i] = base_count[1];
@@ -11104,14 +11316,12 @@ test_shape_same_dr__checkerboard(int test_num,
count[i] = 1;
block[i] = 1;
} /* end else */
- } /* end for */
+ } /* end for */
- ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_OR,
- start_ptr, stride_ptr, count_ptr, block_ptr);
+ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_OR, start_ptr, stride_ptr, count_ptr, block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* end if */
-
/* Wierdness alert:
*
* Again, it seems that selections can extend beyond the
@@ -11119,30 +11329,27 @@ test_shape_same_dr__checkerboard(int test_num,
* code to manually clip the selection back to the dataspace
* proper.
*/
- for(i = 0; i < SS_DR_MAX_RANK; i++) {
+ for (i = 0; i < SS_DR_MAX_RANK; i++) {
start[i] = 0;
stride[i] = edge_size;
count[i] = 1;
block[i] = edge_size;
} /* end for */
- ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_AND,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_AND, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* setup is done -- run the test: */
check = H5Sselect_shape_same(n_cube_0_sid, n_cube_1_sid);
VERIFY(check, expected_result, "H5Sselect_shape_same");
-
/* Close dataspaces */
ret = H5Sclose(n_cube_0_sid);
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(n_cube_1_sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_shape_same_dr__checkerboard() */
-
+} /* test_shape_same_dr__checkerboard() */
/****************************************************************
**
@@ -11171,249 +11378,171 @@ test_shape_same_dr__run_checkerboard_tests(void)
{
hbool_t dim_selected[5];
hbool_t expected_result;
- int i, j;
- int v, w, x, y, z;
- int test_num = 0;
- int small_rank;
- int large_rank;
-
- for(large_rank = 1; large_rank <= 5; large_rank++) {
- for(small_rank = 1; small_rank <= large_rank; small_rank++) {
+ int i, j;
+ int v, w, x, y, z;
+ int test_num = 0;
+ int small_rank;
+ int large_rank;
+
+ for (large_rank = 1; large_rank <= 5; large_rank++) {
+ for (small_rank = 1; small_rank <= large_rank; small_rank++) {
v = 0;
do {
- if(v == 0)
+ if (v == 0)
dim_selected[0] = FALSE;
else
dim_selected[0] = TRUE;
w = 0;
do {
- if(w == 0)
+ if (w == 0)
dim_selected[1] = FALSE;
else
dim_selected[1] = TRUE;
x = 0;
do {
- if(x == 0)
+ if (x == 0)
dim_selected[2] = FALSE;
else
dim_selected[2] = TRUE;
y = 0;
do {
- if(y == 0)
+ if (y == 0)
dim_selected[3] = FALSE;
else
dim_selected[3] = TRUE;
z = 0;
do {
- if(z == 0)
+ if (z == 0)
dim_selected[4] = FALSE;
else
dim_selected[4] = TRUE;
-
/* compute the expected result: */
- i = 0;
- j = 4;
+ i = 0;
+ j = 4;
expected_result = TRUE;
- while((i < small_rank) && expected_result) {
- if(!dim_selected[j])
+ while ((i < small_rank) && expected_result) {
+ if (!dim_selected[j])
expected_result = FALSE;
i++;
j--;
} /* end while */
- while((i < large_rank) && expected_result) {
- if(dim_selected[j])
+ while ((i < large_rank) && expected_result) {
+ if (dim_selected[j])
expected_result = FALSE;
i++;
j--;
} /* end while */
-
/* everything is set up -- run the tests */
/* run test with edge size 16, checker
* size 1, and a variety of offsets
*/
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 0,
- /* edge_size */ 16,
- /* checker_size */ 1,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 5,
- /* edge_size */ 16,
- /* checker_size */ 1,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 15,
- /* edge_size */ 16,
- /* checker_size */ 1,
- dim_selected,
- expected_result
- );
-
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 0,
+ /* edge_size */ 16,
+ /* checker_size */ 1, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 5,
+ /* edge_size */ 16,
+ /* checker_size */ 1, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 15,
+ /* edge_size */ 16,
+ /* checker_size */ 1, dim_selected,
+ expected_result);
/* run test with edge size 10, checker
* size 2, and a variety of offsets
*/
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 0,
- /* edge_size */ 10,
- /* checker_size */ 2,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 5,
- /* edge_size */ 10,
- /* checker_size */ 2,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 9,
- /* edge_size */ 10,
- /* checker_size */ 2,
- dim_selected,
- expected_result
- );
-
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 0,
+ /* edge_size */ 10,
+ /* checker_size */ 2, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 5,
+ /* edge_size */ 10,
+ /* checker_size */ 2, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 9,
+ /* edge_size */ 10,
+ /* checker_size */ 2, dim_selected,
+ expected_result);
/* run test with edge size 10, checker
* size 3, and a variety of offsets
*/
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 0,
- /* edge_size */ 10,
- /* checker_size */ 3,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 5,
- /* edge_size */ 10,
- /* checker_size */ 3,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 9,
- /* edge_size */ 10,
- /* checker_size */ 3,
- dim_selected,
- expected_result
- );
-
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 0,
+ /* edge_size */ 10,
+ /* checker_size */ 3, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 5,
+ /* edge_size */ 10,
+ /* checker_size */ 3, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 9,
+ /* edge_size */ 10,
+ /* checker_size */ 3, dim_selected,
+ expected_result);
/* run test with edge size 8, checker
* size 8, and a variety of offsets
*/
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 0,
- /* edge_size */ 8,
- /* checker_size */ 8,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 4,
- /* edge_size */ 8,
- /* checker_size */ 8,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__checkerboard
- (
- test_num++,
- small_rank,
- large_rank,
- /* offset */ 7,
- /* edge_size */ 8,
- /* checker_size */ 8,
- dim_selected,
- expected_result
- );
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 0,
+ /* edge_size */ 8,
+ /* checker_size */ 8, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 4,
+ /* edge_size */ 8,
+ /* checker_size */ 8, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__checkerboard(test_num++, small_rank, large_rank,
+ /* offset */ 7,
+ /* edge_size */ 8,
+ /* checker_size */ 8, dim_selected,
+ expected_result);
z++;
- } while((z < 2) && (large_rank >= 1));
+ } while ((z < 2) && (large_rank >= 1));
y++;
- } while((y < 2) && (large_rank >= 2));
+ } while ((y < 2) && (large_rank >= 2));
x++;
- } while((x < 2) && (large_rank >= 3));
+ } while ((x < 2) && (large_rank >= 3));
w++;
- } while((w < 2) && (large_rank >= 4));
+ } while ((w < 2) && (large_rank >= 4));
v++;
- } while((v < 2) && (large_rank >= 5));
+ } while ((v < 2) && (large_rank >= 5));
} /* end for */
- } /* end for */
+ } /* end for */
} /* test_shape_same_dr__run_checkerboard_tests() */
-
/****************************************************************
**
** test_shape_same_dr__irregular():
@@ -11430,118 +11559,100 @@ test_shape_same_dr__run_checkerboard_tests(void)
**
****************************************************************/
static void
-test_shape_same_dr__irregular(int test_num,
- int small_rank,
- int large_rank,
- int pattern_offset,
- int slice_offset,
- hbool_t dim_selected[],
- hbool_t expected_result)
+test_shape_same_dr__irregular(int test_num, int small_rank, int large_rank, int pattern_offset,
+ int slice_offset, hbool_t dim_selected[], hbool_t expected_result)
{
- char test_desc_0[128];
- char test_desc_1[256];
- int edge_size = 10;
- int i;
- int j;
- int k;
- int dims_selected = 0;
- hid_t n_cube_0_sid; /* the hyper cube containing
- * an irregular selection
- */
- hid_t n_cube_1_sid; /* the hyper cube in which a
- * slice contains an irregular
- * selection.
- */
- hsize_t dims[SS_DR_MAX_RANK];
- hsize_t start_0[SS_DR_MAX_RANK] = { 2, 2, 2, 2, 5};
- hsize_t stride_0[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
- hsize_t count_0[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1};
- hsize_t block_0[SS_DR_MAX_RANK] = { 2, 2, 2, 2, 3};
-
- hsize_t start_1[SS_DR_MAX_RANK] = { 2, 2, 2, 5, 2};
- hsize_t stride_1[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
- hsize_t count_1[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1};
- hsize_t block_1[SS_DR_MAX_RANK] = { 2, 2, 2, 3, 2};
-
- hsize_t start_2[SS_DR_MAX_RANK] = { 2, 2, 5, 2, 2};
- hsize_t stride_2[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
- hsize_t count_2[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1};
- hsize_t block_2[SS_DR_MAX_RANK] = { 2, 2, 3, 2, 2};
-
- hsize_t start_3[SS_DR_MAX_RANK] = { 2, 5, 2, 2, 2};
- hsize_t stride_3[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
- hsize_t count_3[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1};
- hsize_t block_3[SS_DR_MAX_RANK] = { 2, 3, 2, 2, 2};
-
- hsize_t start_4[SS_DR_MAX_RANK] = { 5, 2, 2, 2, 2};
- hsize_t stride_4[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
- hsize_t count_4[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1};
- hsize_t block_4[SS_DR_MAX_RANK] = { 3, 2, 2, 2, 2};
-
- hsize_t clip_start[SS_DR_MAX_RANK] = { 0, 0, 0, 0, 0};
- hsize_t clip_stride[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
- hsize_t clip_count[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1};
- hsize_t clip_block[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
-
-
- hsize_t *(starts[SS_DR_MAX_RANK]) =
- {start_0, start_1, start_2, start_3, start_4};
- hsize_t *(strides[SS_DR_MAX_RANK]) =
- {stride_0, stride_1, stride_2, stride_3, stride_4};
- hsize_t *(counts[SS_DR_MAX_RANK]) =
- {count_0, count_1, count_2, count_3, count_4};
- hsize_t *(blocks[SS_DR_MAX_RANK]) =
- {block_0, block_1, block_2, block_3, block_4};
-
- hsize_t start[SS_DR_MAX_RANK];
- hsize_t * start_ptr;
- hsize_t stride[SS_DR_MAX_RANK];
- hsize_t * stride_ptr;
- hsize_t count[SS_DR_MAX_RANK];
- hsize_t * count_ptr;
- hsize_t block[SS_DR_MAX_RANK];
- hsize_t * block_ptr;
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
-
- HDassert( 0 < small_rank );
- HDassert( small_rank <= large_rank );
- HDassert( large_rank <= SS_DR_MAX_RANK );
- HDassert( 9 <= edge_size );
- HDassert( edge_size <= 1000 );
- HDassert( 0 <= slice_offset );
- HDassert( slice_offset < edge_size );
- HDassert( -2 <= pattern_offset );
- HDassert( pattern_offset <= 2 );
-
- for(i = SS_DR_MAX_RANK - large_rank; i < SS_DR_MAX_RANK; i++)
- if(dim_selected[i] == TRUE)
+ char test_desc_0[128];
+ char test_desc_1[256];
+ int edge_size = 10;
+ int i;
+ int j;
+ int k;
+ int dims_selected = 0;
+ hid_t n_cube_0_sid; /* the hyper cube containing
+ * an irregular selection
+ */
+ hid_t n_cube_1_sid; /* the hyper cube in which a
+ * slice contains an irregular
+ * selection.
+ */
+ hsize_t dims[SS_DR_MAX_RANK];
+ hsize_t start_0[SS_DR_MAX_RANK] = {2, 2, 2, 2, 5};
+ hsize_t stride_0[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
+ hsize_t count_0[SS_DR_MAX_RANK] = {1, 1, 1, 1, 1};
+ hsize_t block_0[SS_DR_MAX_RANK] = {2, 2, 2, 2, 3};
+
+ hsize_t start_1[SS_DR_MAX_RANK] = {2, 2, 2, 5, 2};
+ hsize_t stride_1[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
+ hsize_t count_1[SS_DR_MAX_RANK] = {1, 1, 1, 1, 1};
+ hsize_t block_1[SS_DR_MAX_RANK] = {2, 2, 2, 3, 2};
+
+ hsize_t start_2[SS_DR_MAX_RANK] = {2, 2, 5, 2, 2};
+ hsize_t stride_2[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
+ hsize_t count_2[SS_DR_MAX_RANK] = {1, 1, 1, 1, 1};
+ hsize_t block_2[SS_DR_MAX_RANK] = {2, 2, 3, 2, 2};
+
+ hsize_t start_3[SS_DR_MAX_RANK] = {2, 5, 2, 2, 2};
+ hsize_t stride_3[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
+ hsize_t count_3[SS_DR_MAX_RANK] = {1, 1, 1, 1, 1};
+ hsize_t block_3[SS_DR_MAX_RANK] = {2, 3, 2, 2, 2};
+
+ hsize_t start_4[SS_DR_MAX_RANK] = {5, 2, 2, 2, 2};
+ hsize_t stride_4[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
+ hsize_t count_4[SS_DR_MAX_RANK] = {1, 1, 1, 1, 1};
+ hsize_t block_4[SS_DR_MAX_RANK] = {3, 2, 2, 2, 2};
+
+ hsize_t clip_start[SS_DR_MAX_RANK] = {0, 0, 0, 0, 0};
+ hsize_t clip_stride[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
+ hsize_t clip_count[SS_DR_MAX_RANK] = {1, 1, 1, 1, 1};
+ hsize_t clip_block[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10};
+
+ hsize_t *(starts[SS_DR_MAX_RANK]) = {start_0, start_1, start_2, start_3, start_4};
+ hsize_t *(strides[SS_DR_MAX_RANK]) = {stride_0, stride_1, stride_2, stride_3, stride_4};
+ hsize_t *(counts[SS_DR_MAX_RANK]) = {count_0, count_1, count_2, count_3, count_4};
+ hsize_t *(blocks[SS_DR_MAX_RANK]) = {block_0, block_1, block_2, block_3, block_4};
+
+ hsize_t start[SS_DR_MAX_RANK];
+ hsize_t *start_ptr;
+ hsize_t stride[SS_DR_MAX_RANK];
+ hsize_t *stride_ptr;
+ hsize_t count[SS_DR_MAX_RANK];
+ hsize_t *count_ptr;
+ hsize_t block[SS_DR_MAX_RANK];
+ hsize_t *block_ptr;
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
+
+ HDassert(0 < small_rank);
+ HDassert(small_rank <= large_rank);
+ HDassert(large_rank <= SS_DR_MAX_RANK);
+ HDassert(9 <= edge_size);
+ HDassert(edge_size <= 1000);
+ HDassert(0 <= slice_offset);
+ HDassert(slice_offset < edge_size);
+ HDassert(-2 <= pattern_offset);
+ HDassert(pattern_offset <= 2);
+
+ for (i = SS_DR_MAX_RANK - large_rank; i < SS_DR_MAX_RANK; i++)
+ if (dim_selected[i] == TRUE)
dims_selected++;
- HDassert( dims_selected >= 0 );
- HDassert( dims_selected <= large_rank );
+ HDassert(dims_selected >= 0);
+ HDassert(dims_selected <= large_rank);
- HDsprintf(test_desc_0,
- "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n",
+ HDsprintf(test_desc_0, "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n",
test_num);
MESSAGE(7, (test_desc_0));
/* This statement must be updated if SS_DR_MAX_RANK is changed */
- HDsprintf(test_desc_1,
- "\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n",
- small_rank, large_rank,
- edge_size,
- slice_offset, pattern_offset,
- (int)dim_selected[0],
- (int)dim_selected[1],
- (int)dim_selected[2],
- (int)dim_selected[3],
- (int)dim_selected[4],
+ HDsprintf(test_desc_1, "\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n",
+ small_rank, large_rank, edge_size, slice_offset, pattern_offset, (int)dim_selected[0],
+ (int)dim_selected[1], (int)dim_selected[2], (int)dim_selected[3], (int)dim_selected[4],
dims_selected);
MESSAGE(7, (test_desc_1));
/* copy the edge size into the dims array */
- for(i = 0; i < SS_DR_MAX_RANK; i++)
+ for (i = 0; i < SS_DR_MAX_RANK; i++)
dims[i] = (hsize_t)edge_size;
/* Create the small n-cube */
@@ -11592,20 +11703,17 @@ test_shape_same_dr__irregular(int test_num,
CHECK(ret, FAIL, "H5Sselect_none");
/* now, select the irregular pattern */
- for(i = 0; i < SS_DR_MAX_RANK; i++) {
- ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_OR,
- starts[i], strides[i], counts[i], blocks[i]);
+ for (i = 0; i < SS_DR_MAX_RANK; i++) {
+ ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_OR, starts[i], strides[i], counts[i], blocks[i]);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* end for */
/* finally, clip the selection to ensure that it lies fully
* within the n-cube.
*/
- ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_AND,
- clip_start, clip_stride, clip_count, clip_block);
+ ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_AND, clip_start, clip_stride, clip_count, clip_block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* Create the large n-cube */
n_cube_1_sid = H5Screate_simple(large_rank, dims, NULL);
CHECK(n_cube_1_sid, FAIL, "H5Screate_simple");
@@ -11614,7 +11722,6 @@ test_shape_same_dr__irregular(int test_num,
H5Sselect_none(n_cube_1_sid);
CHECK(ret, FAIL, "H5Sselect_none");
-
/* Since large rank may be less than SS_DR_MAX_RANK, we may not
* use the entire start, stride, count, and block arrays. This
* is a problem, since it is inconvenient to set up the dim_selected
@@ -11628,24 +11735,23 @@ test_shape_same_dr__irregular(int test_num,
*/
i = SS_DR_MAX_RANK - large_rank;
- HDassert( i >= 0 );
+ HDassert(i >= 0);
start_ptr = &(start[i]);
stride_ptr = &(stride[i]);
count_ptr = &(count[i]);
block_ptr = &(block[i]);
-
/* Now select the irregular selection in the (possibly larger) n-cube.
*
* Basic idea is to project the pattern used in the smaller n-cube
* onto the dimensions selected in the larger n-cube, with the displacement
* specified.
*/
- for(i = 0; i < SS_DR_MAX_RANK; i++) {
+ for (i = 0; i < SS_DR_MAX_RANK; i++) {
j = 0;
- for(k = 0; k < SS_DR_MAX_RANK; k++) {
- if(dim_selected[k]) {
+ for (k = 0; k < SS_DR_MAX_RANK; k++) {
+ if (dim_selected[k]) {
start[k] = (starts[i])[j] + (hsize_t)pattern_offset;
stride[k] = (strides[i])[j];
count[k] = (counts[i])[j];
@@ -11658,35 +11764,30 @@ test_shape_same_dr__irregular(int test_num,
count[k] = 1;
block[k] = 1;
} /* end else */
- } /* end for */
+ } /* end for */
/* select the hyperslab */
- ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_OR,
- start_ptr, stride_ptr, count_ptr, block_ptr);
+ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_OR, start_ptr, stride_ptr, count_ptr, block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* end for */
/* it is possible that the selection extends beyond the dataspace.
* clip the selection to ensure that it doesn't.
*/
- ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_AND,
- clip_start, clip_stride, clip_count, clip_block);
+ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_AND, clip_start, clip_stride, clip_count, clip_block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
/* setup is done -- run the test: */
check = H5Sselect_shape_same(n_cube_0_sid, n_cube_1_sid);
VERIFY(check, expected_result, "H5Sselect_shape_same");
-
/* Close dataspaces */
ret = H5Sclose(n_cube_0_sid);
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(n_cube_1_sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_shape_same_dr__irregular() */
-
+} /* test_shape_same_dr__irregular() */
/****************************************************************
**
@@ -11717,191 +11818,132 @@ test_shape_same_dr__run_irregular_tests(void)
{
hbool_t dim_selected[5];
hbool_t expected_result;
- int i, j;
- int v, w, x, y, z;
- int test_num = 0;
- int small_rank;
- int large_rank;
-
- for(large_rank = 1; large_rank <= 5; large_rank++) {
- for(small_rank = 1; small_rank <= large_rank; small_rank++) {
+ int i, j;
+ int v, w, x, y, z;
+ int test_num = 0;
+ int small_rank;
+ int large_rank;
+
+ for (large_rank = 1; large_rank <= 5; large_rank++) {
+ for (small_rank = 1; small_rank <= large_rank; small_rank++) {
v = 0;
do {
- if(v == 0)
+ if (v == 0)
dim_selected[0] = FALSE;
else
dim_selected[0] = TRUE;
w = 0;
do {
- if(w == 0)
+ if (w == 0)
dim_selected[1] = FALSE;
else
dim_selected[1] = TRUE;
x = 0;
do {
- if(x == 0)
+ if (x == 0)
dim_selected[2] = FALSE;
else
dim_selected[2] = TRUE;
y = 0;
do {
- if(y == 0)
+ if (y == 0)
dim_selected[3] = FALSE;
else
dim_selected[3] = TRUE;
z = 0;
do {
- if(z == 0)
+ if (z == 0)
dim_selected[4] = FALSE;
else
dim_selected[4] = TRUE;
-
/* compute the expected result: */
- i = 0;
- j = 4;
+ i = 0;
+ j = 4;
expected_result = TRUE;
- while((i < small_rank) && expected_result) {
- if(!dim_selected[j])
+ while ((i < small_rank) && expected_result) {
+ if (!dim_selected[j])
expected_result = FALSE;
i++;
j--;
} /* end while */
- while((i < large_rank) && expected_result) {
- if(dim_selected[j])
+ while ((i < large_rank) && expected_result) {
+ if (dim_selected[j])
expected_result = FALSE;
i++;
j--;
} /* end while */
-
/* everything is set up -- run the tests */
- test_shape_same_dr__irregular
- (
- test_num++,
- small_rank,
- large_rank,
- /* pattern_offset */ -2,
- /* slice_offset */ 0,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__irregular
- (
- test_num++,
- small_rank,
- large_rank,
- /* pattern_offset */ -2,
- /* slice_offset */ 4,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__irregular
- (
- test_num++,
- small_rank,
- large_rank,
- /* pattern_offset */ -2,
- /* slice_offset */ 9,
- dim_selected,
- expected_result
- );
-
-
- test_shape_same_dr__irregular
- (
- test_num++,
- small_rank,
- large_rank,
- /* pattern_offset */ 0,
- /* slice_offset */ 0,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__irregular
- (
- test_num++,
- small_rank,
- large_rank,
- /* pattern_offset */ 0,
- /* slice_offset */ 6,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__irregular
- (
- test_num++,
- small_rank,
- large_rank,
- /* pattern_offset */ 0,
- /* slice_offset */ 9,
- dim_selected,
- expected_result
- );
-
-
- test_shape_same_dr__irregular
- (
- test_num++,
- small_rank,
- large_rank,
- /* pattern_offset */ 2,
- /* slice_offset */ 0,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__irregular
- (
- test_num++,
- small_rank,
- large_rank,
- /* pattern_offset */ 2,
- /* slice_offset */ 5,
- dim_selected,
- expected_result
- );
-
- test_shape_same_dr__irregular
- (
- test_num++,
- small_rank,
- large_rank,
- /* pattern_offset */ 2,
- /* slice_offset */ 9,
- dim_selected,
- expected_result
- );
+ test_shape_same_dr__irregular(test_num++, small_rank, large_rank,
+ /* pattern_offset */ -2,
+ /* slice_offset */ 0, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__irregular(test_num++, small_rank, large_rank,
+ /* pattern_offset */ -2,
+ /* slice_offset */ 4, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__irregular(test_num++, small_rank, large_rank,
+ /* pattern_offset */ -2,
+ /* slice_offset */ 9, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__irregular(test_num++, small_rank, large_rank,
+ /* pattern_offset */ 0,
+ /* slice_offset */ 0, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__irregular(test_num++, small_rank, large_rank,
+ /* pattern_offset */ 0,
+ /* slice_offset */ 6, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__irregular(test_num++, small_rank, large_rank,
+ /* pattern_offset */ 0,
+ /* slice_offset */ 9, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__irregular(test_num++, small_rank, large_rank,
+ /* pattern_offset */ 2,
+ /* slice_offset */ 0, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__irregular(test_num++, small_rank, large_rank,
+ /* pattern_offset */ 2,
+ /* slice_offset */ 5, dim_selected,
+ expected_result);
+
+ test_shape_same_dr__irregular(test_num++, small_rank, large_rank,
+ /* pattern_offset */ 2,
+ /* slice_offset */ 9, dim_selected,
+ expected_result);
z++;
- } while((z < 2) && (large_rank >= 1));
+ } while ((z < 2) && (large_rank >= 1));
y++;
- } while((y < 2) && (large_rank >= 2));
+ } while ((y < 2) && (large_rank >= 2));
x++;
- } while((x < 2) && (large_rank >= 3));
+ } while ((x < 2) && (large_rank >= 3));
w++;
- } while((w < 2) && (large_rank >= 4));
+ } while ((w < 2) && (large_rank >= 4));
v++;
- } while((v < 2 ) && (large_rank >= 5));
+ } while ((v < 2) && (large_rank >= 5));
} /* end for */
- } /* end for */
+ } /* end for */
} /* test_shape_same_dr__run_irregular_tests() */
-
/****************************************************************
**
** test_shape_same_dr(): Tests selections on dataspace with
@@ -11925,8 +11967,7 @@ test_shape_same_dr(void)
test_shape_same_dr__run_full_space_vs_slice_tests();
test_shape_same_dr__run_checkerboard_tests();
test_shape_same_dr__run_irregular_tests();
-} /* test_shape_same_dr() */
-
+} /* test_shape_same_dr() */
/****************************************************************
**
@@ -11939,67 +11980,61 @@ test_shape_same_dr(void)
static void
test_space_rebuild(void)
{
- /* regular space IDs in span-tree form */
- hid_t sid_reg1,sid_reg2,sid_reg3,sid_reg4,sid_reg5;
+ /* regular space IDs in span-tree form */
+ hid_t sid_reg1, sid_reg2, sid_reg3, sid_reg4, sid_reg5;
- /* Original regular Space IDs */
- hid_t sid_reg_ori1,sid_reg_ori2,sid_reg_ori3,sid_reg_ori4,sid_reg_ori5;
+ /* Original regular Space IDs */
+ hid_t sid_reg_ori1, sid_reg_ori2, sid_reg_ori3, sid_reg_ori4, sid_reg_ori5;
- /* Irregular space IDs */
- hid_t sid_irreg1,sid_irreg2,sid_irreg3,sid_irreg4,sid_irreg5;
+ /* Irregular space IDs */
+ hid_t sid_irreg1, sid_irreg2, sid_irreg3, sid_irreg4, sid_irreg5;
- /* rebuild status state */
- H5S_diminfo_valid_t rebuild_stat1,rebuild_stat2;
- htri_t rebuild_check;
- herr_t ret;
+ /* rebuild status state */
+ H5S_diminfo_valid_t rebuild_stat1, rebuild_stat2;
+ htri_t rebuild_check;
+ herr_t ret;
- /* dimensions of rank 1 to rank 5 */
- hsize_t dims1[] ={SPACERE1_DIM0};
- hsize_t dims2[] ={SPACERE2_DIM0,SPACERE2_DIM1};
- hsize_t dims3[] ={SPACERE3_DIM0,SPACERE3_DIM1,SPACERE3_DIM2};
- hsize_t dims4[] ={SPACERE4_DIM0,SPACERE4_DIM1,SPACERE4_DIM2,SPACERE4_DIM3};
- hsize_t dims5[] ={SPACERE5_DIM0,SPACERE5_DIM1,SPACERE5_DIM2,SPACERE5_DIM3,SPACERE5_DIM4};
+ /* dimensions of rank 1 to rank 5 */
+ hsize_t dims1[] = {SPACERE1_DIM0};
+ hsize_t dims2[] = {SPACERE2_DIM0, SPACERE2_DIM1};
+ hsize_t dims3[] = {SPACERE3_DIM0, SPACERE3_DIM1, SPACERE3_DIM2};
+ hsize_t dims4[] = {SPACERE4_DIM0, SPACERE4_DIM1, SPACERE4_DIM2, SPACERE4_DIM3};
+ hsize_t dims5[] = {SPACERE5_DIM0, SPACERE5_DIM1, SPACERE5_DIM2, SPACERE5_DIM3, SPACERE5_DIM4};
- /* The start of the hyperslab */
- hsize_t start1[SPACERE1_RANK],start2[SPACERE2_RANK],
- start3[SPACERE3_RANK],start4[SPACERE4_RANK],
- start5[SPACERE5_RANK];
+ /* The start of the hyperslab */
+ hsize_t start1[SPACERE1_RANK], start2[SPACERE2_RANK], start3[SPACERE3_RANK], start4[SPACERE4_RANK],
+ start5[SPACERE5_RANK];
- /* The stride of the hyperslab */
- hsize_t stride1[SPACERE1_RANK],stride2[SPACERE2_RANK],
- stride3[SPACERE3_RANK],stride4[SPACERE4_RANK],
- stride5[SPACERE5_RANK];
+ /* The stride of the hyperslab */
+ hsize_t stride1[SPACERE1_RANK], stride2[SPACERE2_RANK], stride3[SPACERE3_RANK], stride4[SPACERE4_RANK],
+ stride5[SPACERE5_RANK];
- /* The number of blocks for the hyperslab */
- hsize_t count1[SPACERE1_RANK],count2[SPACERE2_RANK],
- count3[SPACERE3_RANK],count4[SPACERE4_RANK],
- count5[SPACERE5_RANK];
+ /* The number of blocks for the hyperslab */
+ hsize_t count1[SPACERE1_RANK], count2[SPACERE2_RANK], count3[SPACERE3_RANK], count4[SPACERE4_RANK],
+ count5[SPACERE5_RANK];
- /* The size of each block for the hyperslab */
- hsize_t block1[SPACERE1_RANK],block2[SPACERE2_RANK],
- block3[SPACERE3_RANK],block4[SPACERE4_RANK],
- block5[SPACERE5_RANK];
-
- /* Declarations for special test of rebuild */
- hid_t sid_spec;
+ /* The size of each block for the hyperslab */
+ hsize_t block1[SPACERE1_RANK], block2[SPACERE2_RANK], block3[SPACERE3_RANK], block4[SPACERE4_RANK],
+ block5[SPACERE5_RANK];
+ /* Declarations for special test of rebuild */
+ hid_t sid_spec;
/* Output message about test being performed */
MESSAGE(6, ("Testing functionality to rebuild regular hyperslab selection\n"));
-
MESSAGE(7, ("Testing functionality to rebuild 1-D hyperslab selection\n"));
/* Create 1-D dataspace */
- sid_reg1 = H5Screate_simple(SPACERE1_RANK,dims1,NULL);
- sid_reg_ori1 = H5Screate_simple(SPACERE1_RANK,dims1,NULL);
+ sid_reg1 = H5Screate_simple(SPACERE1_RANK, dims1, NULL);
+ sid_reg_ori1 = H5Screate_simple(SPACERE1_RANK, dims1, NULL);
/* Build up the original one dimensional regular selection */
start1[0] = 1;
count1[0] = 3;
stride1[0] = 5;
block1[0] = 4;
- ret = H5Sselect_hyperslab(sid_reg_ori1,H5S_SELECT_SET,start1,stride1,count1,block1);
+ ret = H5Sselect_hyperslab(sid_reg_ori1, H5S_SELECT_SET, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Build up one dimensional regular selection with H5_SELECT_OR,
@@ -12009,71 +12044,70 @@ test_space_rebuild(void)
count1[0] = 2;
stride1[0] = 5;
block1[0] = 4;
- ret = H5Sselect_hyperslab(sid_reg1,H5S_SELECT_SET,start1,stride1,count1,block1);
+ ret = H5Sselect_hyperslab(sid_reg1, H5S_SELECT_SET, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start1[0] = 11;
count1[0] = 1;
stride1[0] = 5;
block1[0] = 4;
- ret = H5Sselect_hyperslab(sid_reg1,H5S_SELECT_OR,start1,stride1,count1,block1);
+ ret = H5Sselect_hyperslab(sid_reg1, H5S_SELECT_OR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_reg1,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_reg1, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 and rebuild_stat2 should be
* H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(ret != FAIL) {
- /* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5Sselect_shape_same(sid_reg1, sid_reg_ori1);
- CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
+ if (ret != FAIL) {
+ /* In this case, rebuild_check should be TRUE. */
+ rebuild_check = H5Sselect_shape_same(sid_reg1, sid_reg_ori1);
+ CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
}
/* For irregular hyperslab */
- sid_irreg1 = H5Screate_simple(SPACERE1_RANK,dims1,NULL);
+ sid_irreg1 = H5Screate_simple(SPACERE1_RANK, dims1, NULL);
/* Build up one dimensional irregular selection with H5_SELECT_OR */
start1[0] = 1;
count1[0] = 2;
stride1[0] = 5;
block1[0] = 4;
- ret = H5Sselect_hyperslab(sid_irreg1,H5S_SELECT_SET,start1,stride1,count1,block1);
+ ret = H5Sselect_hyperslab(sid_irreg1, H5S_SELECT_SET, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start1[0] = 12; /* Just one position switch */
count1[0] = 1;
stride1[0] = 5;
block1[0] = 4;
- ret = H5Sselect_hyperslab(sid_irreg1,H5S_SELECT_OR,start1,stride1,count1,block1);
+ ret = H5Sselect_hyperslab(sid_irreg1, H5S_SELECT_OR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_irreg1,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_irreg1, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
* rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
/* No need to do shape comparision */
-
MESSAGE(7, ("Testing functionality to rebuild 2-D hyperslab selection\n"));
/* Create 2-D dataspace */
- sid_reg2 = H5Screate_simple(SPACERE2_RANK,dims2,NULL);
- sid_reg_ori2 = H5Screate_simple(SPACERE2_RANK,dims2,NULL);
+ sid_reg2 = H5Screate_simple(SPACERE2_RANK, dims2, NULL);
+ sid_reg_ori2 = H5Screate_simple(SPACERE2_RANK, dims2, NULL);
/* Build up the original two dimensional regular selection */
start2[0] = 2;
@@ -12085,7 +12119,7 @@ test_space_rebuild(void)
stride2[1] = 3;
block2[1] = 2;
- ret = H5Sselect_hyperslab(sid_reg_ori2,H5S_SELECT_SET,start2,stride2,count2,block2);
+ ret = H5Sselect_hyperslab(sid_reg_ori2, H5S_SELECT_SET, start2, stride2, count2, block2);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Build up two dimensional regular selection with H5_SELECT_OR, inside HDF5,
@@ -12096,7 +12130,7 @@ test_space_rebuild(void)
stride2[1] = 3;
block2[1] = 2;
- ret = H5Sselect_hyperslab(sid_reg2,H5S_SELECT_SET,start2,stride2,count2,block2);
+ ret = H5Sselect_hyperslab(sid_reg2, H5S_SELECT_SET, start2, stride2, count2, block2);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start2[1] = 7; /* 7 = start(1) + count(2) * stride(3) */
@@ -12104,29 +12138,29 @@ test_space_rebuild(void)
stride2[1] = 3;
block2[1] = 2;
- ret = H5Sselect_hyperslab(sid_reg2,H5S_SELECT_OR,start2,stride2,count2,block2);
+ ret = H5Sselect_hyperslab(sid_reg2, H5S_SELECT_OR, start2, stride2, count2, block2);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_reg2,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_reg2, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 and rebuild_stat2 should be
* H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
} /* end if */
- if(ret != FAIL) {
- /* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5Sselect_shape_same(sid_reg2, sid_reg_ori2);
- CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
+ if (ret != FAIL) {
+ /* In this case, rebuild_check should be TRUE. */
+ rebuild_check = H5Sselect_shape_same(sid_reg2, sid_reg_ori2);
+ CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
}
/* 2-D irregular case */
- sid_irreg2 = H5Screate_simple(SPACERE2_RANK,dims2,NULL);
+ sid_irreg2 = H5Screate_simple(SPACERE2_RANK, dims2, NULL);
/* Build up two dimensional irregular selection with H5_SELECT_OR */
start2[0] = 2;
@@ -12137,7 +12171,7 @@ test_space_rebuild(void)
count2[1] = 1;
stride2[1] = 3;
block2[1] = 2;
- ret = H5Sselect_hyperslab(sid_irreg2,H5S_SELECT_SET,start2,stride2,count2,block2);
+ ret = H5Sselect_hyperslab(sid_irreg2, H5S_SELECT_SET, start2, stride2, count2, block2);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start2[1] = 4;
@@ -12145,28 +12179,28 @@ test_space_rebuild(void)
stride2[1] = 4;
block2[1] = 3; /* Just add one element for the block */
- ret = H5Sselect_hyperslab(sid_irreg2,H5S_SELECT_OR,start2,stride2,count2,block2);
+ ret = H5Sselect_hyperslab(sid_irreg2, H5S_SELECT_OR, start2, stride2, count2, block2);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_irreg2,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_irreg2, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
* rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
/* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 3-D hyperslab selection\n"));
/* Create 3-D dataspace */
- sid_reg3 = H5Screate_simple(SPACERE3_RANK,dims3,NULL);
- sid_reg_ori3 = H5Screate_simple(SPACERE3_RANK,dims3,NULL);
+ sid_reg3 = H5Screate_simple(SPACERE3_RANK, dims3, NULL);
+ sid_reg_ori3 = H5Screate_simple(SPACERE3_RANK, dims3, NULL);
/* Build up the original three dimensional regular selection */
start3[0] = 2;
@@ -12183,8 +12217,7 @@ test_space_rebuild(void)
stride3[2] = 4;
block3[2] = 2;
-
- ret = H5Sselect_hyperslab(sid_reg_ori3,H5S_SELECT_SET,start3,stride3,count3,block3);
+ ret = H5Sselect_hyperslab(sid_reg_ori3, H5S_SELECT_SET, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Build up three dimensional regular selection with H5_SELECT_OR, inside HDF5,
@@ -12194,7 +12227,7 @@ test_space_rebuild(void)
stride3[2] = 4;
block3[2] = 2;
- ret = H5Sselect_hyperslab(sid_reg3,H5S_SELECT_SET,start3,stride3,count3,block3);
+ ret = H5Sselect_hyperslab(sid_reg3, H5S_SELECT_SET, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start3[2] = 5;
@@ -12202,28 +12235,28 @@ test_space_rebuild(void)
stride3[2] = 4;
block3[2] = 2;
- ret = H5Sselect_hyperslab(sid_reg3,H5S_SELECT_OR,start3,stride3,count3,block3);
+ ret = H5Sselect_hyperslab(sid_reg3, H5S_SELECT_OR, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_reg3,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_reg3, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 and rebuild_stat2 should be
* H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(ret != FAIL) {
- /* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5Sselect_shape_same(sid_reg3, sid_reg_ori3);
- CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
+ if (ret != FAIL) {
+ /* In this case, rebuild_check should be TRUE. */
+ rebuild_check = H5Sselect_shape_same(sid_reg3, sid_reg_ori3);
+ CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
}
- sid_irreg3 = H5Screate_simple(SPACERE3_RANK,dims3,NULL);
+ sid_irreg3 = H5Screate_simple(SPACERE3_RANK, dims3, NULL);
/* Build up three dimensional irregular selection with H5_SELECT_OR */
start3[0] = 2;
@@ -12240,7 +12273,7 @@ test_space_rebuild(void)
stride3[2] = 2;
block3[2] = 1;
- ret = H5Sselect_hyperslab(sid_irreg3,H5S_SELECT_SET,start3,stride3,count3,block3);
+ ret = H5Sselect_hyperslab(sid_irreg3, H5S_SELECT_SET, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start3[2] = 3;
@@ -12248,28 +12281,28 @@ test_space_rebuild(void)
stride3[2] = 3; /* Just add one element for the stride */
block3[2] = 1;
- ret = H5Sselect_hyperslab(sid_irreg3,H5S_SELECT_OR,start3,stride3,count3,block3);
+ ret = H5Sselect_hyperslab(sid_irreg3, H5S_SELECT_OR, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_irreg3,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_irreg3, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
* rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
/* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 4-D hyperslab selection\n"));
/* Create 4-D dataspace */
- sid_reg4 = H5Screate_simple(SPACERE4_RANK,dims4,NULL);
- sid_reg_ori4 = H5Screate_simple(SPACERE4_RANK,dims4,NULL);
+ sid_reg4 = H5Screate_simple(SPACERE4_RANK, dims4, NULL);
+ sid_reg_ori4 = H5Screate_simple(SPACERE4_RANK, dims4, NULL);
/* Build up the original four dimensional regular selection */
start4[0] = 2;
@@ -12292,8 +12325,7 @@ test_space_rebuild(void)
stride4[3] = 4;
block4[3] = 2;
-
- ret = H5Sselect_hyperslab(sid_reg_ori4,H5S_SELECT_SET,start4,stride4,count4,block4);
+ ret = H5Sselect_hyperslab(sid_reg_ori4, H5S_SELECT_SET, start4, stride4, count4, block4);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Build up four dimensional regular selection with H5_SELECT_OR, inside HDF5,
@@ -12303,7 +12335,7 @@ test_space_rebuild(void)
stride4[3] = 4;
block4[3] = 2;
- ret = H5Sselect_hyperslab(sid_reg4,H5S_SELECT_SET,start4,stride4,count4,block4);
+ ret = H5Sselect_hyperslab(sid_reg4, H5S_SELECT_SET, start4, stride4, count4, block4);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start4[3] = 5;
@@ -12311,31 +12343,29 @@ test_space_rebuild(void)
stride4[3] = 4;
block4[3] = 2;
-
- ret = H5Sselect_hyperslab(sid_reg4,H5S_SELECT_OR,start4,stride4,count4,block4);
+ ret = H5Sselect_hyperslab(sid_reg4, H5S_SELECT_OR, start4, stride4, count4, block4);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- ret = H5S__get_rebuild_status_test(sid_reg4,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_reg4, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 and rebuild_stat2 should be
* H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(ret != FAIL) {
- /* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5Sselect_shape_same(sid_reg4, sid_reg_ori4);
- CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
+ if (ret != FAIL) {
+ /* In this case, rebuild_check should be TRUE. */
+ rebuild_check = H5Sselect_shape_same(sid_reg4, sid_reg_ori4);
+ CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
}
/* Testing irregular selection */
- sid_irreg4 = H5Screate_simple(SPACERE4_RANK,dims4,NULL);
+ sid_irreg4 = H5Screate_simple(SPACERE4_RANK, dims4, NULL);
/* Build up four dimensional irregular selection with H5_SELECT_OR */
start4[0] = 2;
@@ -12357,7 +12387,7 @@ test_space_rebuild(void)
stride4[3] = 4;
block4[3] = 2; /* sub-block is one element difference */
- ret = H5Sselect_hyperslab(sid_irreg4,H5S_SELECT_SET,start4,stride4,count4,block4);
+ ret = H5Sselect_hyperslab(sid_irreg4, H5S_SELECT_SET, start4, stride4, count4, block4);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start4[2] = 5;
@@ -12368,30 +12398,30 @@ test_space_rebuild(void)
start4[3] = 1;
count4[3] = 2;
stride4[3] = 4;
- block4[3] = 3; /* sub-block is one element difference */
+ block4[3] = 3; /* sub-block is one element difference */
- ret = H5Sselect_hyperslab(sid_irreg4,H5S_SELECT_OR,start4,stride4,count4,block4);
+ ret = H5Sselect_hyperslab(sid_irreg4, H5S_SELECT_OR, start4, stride4, count4, block4);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_irreg4,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_irreg4, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
* rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
/* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 5-D hyperslab selection\n"));
/* Create 5-D dataspace */
- sid_reg5 = H5Screate_simple(SPACERE5_RANK,dims5,NULL);
- sid_reg_ori5 = H5Screate_simple(SPACERE5_RANK,dims5,NULL);
+ sid_reg5 = H5Screate_simple(SPACERE5_RANK, dims5, NULL);
+ sid_reg_ori5 = H5Screate_simple(SPACERE5_RANK, dims5, NULL);
/* Build up the original five dimensional regular selection */
start5[0] = 2;
@@ -12419,7 +12449,7 @@ test_space_rebuild(void)
stride5[4] = 4;
block5[4] = 2;
- ret = H5Sselect_hyperslab(sid_reg_ori5,H5S_SELECT_SET,start5,stride5,count5,block5);
+ ret = H5Sselect_hyperslab(sid_reg_ori5, H5S_SELECT_SET, start5, stride5, count5, block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Build up five dimensional regular selection with H5_SELECT_OR, inside HDF5,
@@ -12429,7 +12459,7 @@ test_space_rebuild(void)
stride5[4] = 4;
block5[4] = 2;
- ret = H5Sselect_hyperslab(sid_reg5,H5S_SELECT_SET,start5,stride5,count5,block5);
+ ret = H5Sselect_hyperslab(sid_reg5, H5S_SELECT_SET, start5, stride5, count5, block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start5[4] = 5;
@@ -12437,30 +12467,28 @@ test_space_rebuild(void)
stride5[4] = 4;
block5[4] = 2;
-
- ret = H5Sselect_hyperslab(sid_reg5,H5S_SELECT_OR,start5,stride5,count5,block5);
+ ret = H5Sselect_hyperslab(sid_reg5, H5S_SELECT_OR, start5, stride5, count5, block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- ret = H5S__get_rebuild_status_test(sid_reg5,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_reg5, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 and rebuild_stat2 should be
* H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(ret != FAIL) {
- /* In this case, rebuild_check should be TRUE. */
- rebuild_check = H5Sselect_shape_same(sid_reg5, sid_reg_ori5);
- CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
+ if (ret != FAIL) {
+ /* In this case, rebuild_check should be TRUE. */
+ rebuild_check = H5Sselect_shape_same(sid_reg5, sid_reg_ori5);
+ CHECK(rebuild_check, FALSE, "H5Sselect_shape_same");
}
- sid_irreg5 = H5Screate_simple(SPACERE5_RANK,dims5,NULL);
+ sid_irreg5 = H5Screate_simple(SPACERE5_RANK, dims5, NULL);
/* Build up five dimensional irregular selection with H5_SELECT_OR */
start5[0] = 2;
@@ -12488,7 +12516,7 @@ test_space_rebuild(void)
stride5[4] = 4;
block5[4] = 2;
- ret = H5Sselect_hyperslab(sid_irreg5,H5S_SELECT_SET,start5,stride5,count5,block5);
+ ret = H5Sselect_hyperslab(sid_irreg5, H5S_SELECT_SET, start5, stride5, count5, block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start5[3] = 5;
@@ -12501,26 +12529,26 @@ test_space_rebuild(void)
stride5[4] = 4;
block5[4] = 2;
- ret = H5Sselect_hyperslab(sid_irreg5,H5S_SELECT_OR,start5,stride5,count5,block5);
+ ret = H5Sselect_hyperslab(sid_irreg5, H5S_SELECT_OR, start5, stride5, count5, block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_irreg5,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_irreg5, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
* rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
/* No need to do shape comparision */
- /* We use 5-D to test a special case with
- rebuilding routine TRUE, FALSE and TRUE */
- sid_spec = H5Screate_simple(SPACERE5_RANK,dims5,NULL);
+ /* We use 5-D to test a special case with
+ rebuilding routine TRUE, FALSE and TRUE */
+ sid_spec = H5Screate_simple(SPACERE5_RANK, dims5, NULL);
/* Build up the original five dimensional regular selection */
start5[0] = 2;
@@ -12548,20 +12576,20 @@ test_space_rebuild(void)
stride5[4] = 4;
block5[4] = 2;
- ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_SET,start5,stride5,count5,block5);
+ ret = H5Sselect_hyperslab(sid_spec, H5S_SELECT_SET, start5, stride5, count5, block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_spec,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_spec, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 and rebuild_stat2 should both be
* H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
/* No need to do shape comparision */
@@ -12576,20 +12604,20 @@ test_space_rebuild(void)
stride5[4] = 4;
block5[4] = 2;
- ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_OR,start5,stride5,count5,block5);
+ ret = H5Sselect_hyperslab(sid_spec, H5S_SELECT_OR, start5, stride5, count5, block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_spec,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_spec, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
* rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
/* No need to do shape comparision */
@@ -12604,20 +12632,20 @@ test_space_rebuild(void)
stride5[4] = 4;
block5[4] = 2;
- ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_OR,start5,stride5,count5,block5);
+ ret = H5Sselect_hyperslab(sid_spec, H5S_SELECT_OR, start5, stride5, count5, block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S__get_rebuild_status_test(sid_spec,&rebuild_stat1,&rebuild_stat2);
+ ret = H5S__get_rebuild_status_test(sid_spec, &rebuild_stat1, &rebuild_stat2);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
/* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
* rebuild_stat2 should be H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
+ if (rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
}
/* No need to do shape comparision */
@@ -12650,7 +12678,6 @@ test_space_rebuild(void)
CHECK(ret, FAIL, "H5Sclose");
}
-
/****************************************************************
**
** test_space_update_diminfo(): Tests selection diminfo update
@@ -12662,33 +12689,31 @@ test_space_rebuild(void)
static void
test_space_update_diminfo(void)
{
- hid_t space_id; /* Dataspace id */
- H5S_diminfo_valid_t diminfo_valid; /* Diminfo status */
- H5S_diminfo_valid_t rebuild_status; /* Diminfo status after rebuid */
- H5S_sel_type sel_type; /* Selection type */
- herr_t ret; /* Return value */
-
- /* dimensions of rank 1 to rank 5 */
- hsize_t dims1[] ={SPACEUD1_DIM0};
- hsize_t dims3[] ={SPACEUD3_DIM0, SPACEUD3_DIM1, SPACEUD3_DIM2};
+ hid_t space_id; /* Dataspace id */
+ H5S_diminfo_valid_t diminfo_valid; /* Diminfo status */
+ H5S_diminfo_valid_t rebuild_status; /* Diminfo status after rebuid */
+ H5S_sel_type sel_type; /* Selection type */
+ herr_t ret; /* Return value */
- /* The start of the hyperslab */
- hsize_t start1[1], start3[3];
+ /* dimensions of rank 1 to rank 5 */
+ hsize_t dims1[] = {SPACEUD1_DIM0};
+ hsize_t dims3[] = {SPACEUD3_DIM0, SPACEUD3_DIM1, SPACEUD3_DIM2};
- /* The stride of the hyperslab */
- hsize_t stride1[1], stride3[3];
+ /* The start of the hyperslab */
+ hsize_t start1[1], start3[3];
- /* The number of blocks for the hyperslab */
- hsize_t count1[1], count3[3];
+ /* The stride of the hyperslab */
+ hsize_t stride1[1], stride3[3];
- /* The size of each block for the hyperslab */
- hsize_t block1[1], block3[3];
+ /* The number of blocks for the hyperslab */
+ hsize_t count1[1], count3[3];
+ /* The size of each block for the hyperslab */
+ hsize_t block1[1], block3[3];
/* Output message about test being performed */
MESSAGE(6, ("Testing functionality to update hyperslab dimension info\n"));
-
MESSAGE(7, ("Testing functionality to update 1-D hyperslab dimension info\n"));
/*
@@ -12696,51 +12721,51 @@ test_space_update_diminfo(void)
*/
/* Create 1-D dataspace */
- space_id = H5Screate_simple(1, dims1, NULL);
+ space_id = H5Screate_simple(1, dims1, NULL);
/* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add block after first, with OR */
- start1[0] = 6;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 6;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add block before first, this time with XOR */
- start1[0] = 0;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ start1[0] = 0;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add two blocks after current block */
@@ -12748,15 +12773,15 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add two blocks overlapping current block, with OR */
@@ -12764,15 +12789,15 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add two blocks partially overlapping current block, with OR */
@@ -12780,15 +12805,15 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add two blocks partially overlapping current block, with XOR */
@@ -12796,40 +12821,38 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO, after rebuild it should be IMPOSSIBLE */
- ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid,
- &rebuild_status);
+ ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid, &rebuild_status);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
- if(rebuild_status != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_rebuild");
+ if (rebuild_status != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
} /* end if */
/* Fill in missing block */
- start1[0] = 15;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ start1[0] = 15;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO, after rebuild it should be YES */
- ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid,
- &rebuild_status);
+ ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid, &rebuild_status);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
- if(rebuild_status != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_rebuild");
+ if (rebuild_status != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
} /* end if */
/*
@@ -12837,63 +12860,63 @@ test_space_update_diminfo(void)
*/
/* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add block immediately after first, with OR */
- start1[0] = 5;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 5;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add block immediately before first, with XOR */
- start1[0] = 1;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 1;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add differently size block immediately after current, with OR */
- start1[0] = 7;
- count1[0] = 1;
- block1[0] = 7;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 7;
+ count1[0] = 1;
+ block1[0] = 7;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/*
@@ -12901,155 +12924,153 @@ test_space_update_diminfo(void)
*/
/* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add block completely overlapping first, with OR */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add block parially overlapping first, with OR */
- start1[0] = 4;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 4;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add block completely enclosing current, with OR */
- start1[0] = 2;
- count1[0] = 1;
- block1[0] = 5;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 2;
+ count1[0] = 1;
+ block1[0] = 5;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add block completely enclosed by current, with OR */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add equally sized block parially overlapping current, with XOR */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 5;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 5;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Fill in hole in block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 4;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 4;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO, after rebuild it should be YES */
- ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid,
- &rebuild_status);
+ ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid, &rebuild_status);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
- if(rebuild_status != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_rebuild");
+ if (rebuild_status != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
} /* end if */
/* Add differently sized block parially overlapping current, with XOR */
- start1[0] = 4;
- count1[0] = 1;
- block1[0] = 5;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ start1[0] = 4;
+ count1[0] = 1;
+ block1[0] = 5;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Fill in hole in block */
- start1[0] = 4;
- count1[0] = 1;
- block1[0] = 4;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 4;
+ count1[0] = 1;
+ block1[0] = 4;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO, after rebuild it should be YES */
- ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid,
- &rebuild_status);
+ ret = H5S__get_rebuild_status_test(space_id, &diminfo_valid, &rebuild_status);
CHECK(ret, FAIL, "H5S__get_rebuild_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
- if(rebuild_status != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_rebuild");
+ if (rebuild_status != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_rebuild");
} /* end if */
/* Add block completely overlapping current, with XOR */
- start1[0] = 2;
- count1[0] = 1;
- block1[0] = 7;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
+ start1[0] = 2;
+ count1[0] = 1;
+ block1[0] = 7;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
sel_type = H5Sget_select_type(space_id);
@@ -13064,30 +13085,30 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create single block with start out of phase */
- start1[0] = 8;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 8;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks */
@@ -13095,15 +13116,15 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks with start out of phase */
@@ -13111,15 +13132,15 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks */
@@ -13127,15 +13148,15 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks with wrong stride */
@@ -13143,60 +13164,60 @@ test_space_update_diminfo(void)
stride1[0] = 4;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create single block with wrong size */
- start1[0] = 6;
- count1[0] = 1;
- block1[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 6;
+ count1[0] = 1;
+ block1[0] = 1;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
+ start1[0] = 3;
+ count1[0] = 1;
+ block1[0] = 2;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks with wrong size */
@@ -13204,15 +13225,15 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks */
@@ -13220,30 +13241,30 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create single block with wrong size */
- start1[0] = 9;
- count1[0] = 1;
- block1[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
+ start1[0] = 9;
+ count1[0] = 1;
+ block1[0] = 1;
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks */
@@ -13251,15 +13272,15 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks with wrong size */
@@ -13267,25 +13288,24 @@ test_space_update_diminfo(void)
stride1[0] = 3;
count1[0] = 2;
block1[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
ret = H5Sclose(space_id);
CHECK(ret, FAIL, "H5Sclose");
-
MESSAGE(7, ("Testing functionality to update 3-D hyperslab dimension info\n"));
/* Create 3-D dataspace */
- space_id = H5Screate_simple(3, dims3, NULL);
+ space_id = H5Screate_simple(3, dims3, NULL);
/* Create multiple blocks */
start3[0] = 0;
@@ -13300,15 +13320,15 @@ test_space_update_diminfo(void)
block3[0] = 1;
block3[1] = 2;
block3[2] = 3;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add blocks with same values in all dimensions */
@@ -13318,9 +13338,9 @@ test_space_update_diminfo(void)
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add blocks with same values in two dimensions */
@@ -13328,15 +13348,15 @@ test_space_update_diminfo(void)
stride3[0] = 1;
count3[0] = 1;
block3[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks */
@@ -13352,15 +13372,15 @@ test_space_update_diminfo(void)
block3[0] = 1;
block3[1] = 2;
block3[2] = 3;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add blocks with same values in one dimension */
@@ -13372,15 +13392,15 @@ test_space_update_diminfo(void)
count3[1] = 1;
block3[0] = 1;
block3[1] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Create multiple blocks */
@@ -13396,15 +13416,15 @@ test_space_update_diminfo(void)
block3[0] = 1;
block3[1] = 2;
block3[2] = 3;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be YES */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
/* Add blocks with same values in no dimensions */
@@ -13420,22 +13440,21 @@ test_space_update_diminfo(void)
block3[0] = 1;
block3[1] = 2;
block3[2] = 3;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
+ ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* diminfo_valid should be NO */
ret = H5S__get_diminfo_status_test(space_id, &diminfo_valid);
CHECK(ret, FAIL, "H5S__get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
+ if (diminfo_valid != H5S_DIMINFO_VALID_NO) {
+ ret = FAIL;
+ CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
} /* end if */
ret = H5Sclose(space_id);
CHECK(ret, FAIL, "H5Sclose");
} /* end test_space_update_diminfo() */
-
/****************************************************************
**
** test_select_hyper_chunk_offset(): Tests selections on dataspace,
@@ -13446,21 +13465,21 @@ test_space_update_diminfo(void)
static void
test_select_hyper_chunk_offset(void)
{
- hid_t fid; /* File ID */
- hid_t sid; /* Dataspace ID */
- hid_t msid; /* Memory dataspace ID */
- hid_t did; /* Dataset ID */
- const hsize_t mem_dims[1] = { SPACE10_DIM1 }; /* Dataspace dimensions for memory */
- const hsize_t dims[1] = { 0 }; /* Dataspace initial dimensions */
- const hsize_t maxdims[1] = { H5S_UNLIMITED }; /* Dataspace mam dims */
- int *wbuf; /* Buffer for writing data */
- int *rbuf; /* Buffer for reading data */
- hid_t dcpl; /* Dataset creation property list ID */
- hsize_t chunks[1]={SPACE10_CHUNK_SIZE }; /* Chunk size */
- hsize_t start[1] = { 0 }; /* The start of the hyperslab */
- hsize_t count[1] = { SPACE10_CHUNK_SIZE }; /* The size of the hyperslab */
- int i,j; /* Local index */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t msid; /* Memory dataspace ID */
+ hid_t did; /* Dataset ID */
+ const hsize_t mem_dims[1] = {SPACE10_DIM1}; /* Dataspace dimensions for memory */
+ const hsize_t dims[1] = {0}; /* Dataspace initial dimensions */
+ const hsize_t maxdims[1] = {H5S_UNLIMITED}; /* Dataspace mam dims */
+ int * wbuf; /* Buffer for writing data */
+ int * rbuf; /* Buffer for reading data */
+ hid_t dcpl; /* Dataset creation property list ID */
+ hsize_t chunks[1] = {SPACE10_CHUNK_SIZE}; /* Chunk size */
+ hsize_t start[1] = {0}; /* The start of the hyperslab */
+ hsize_t count[1] = {SPACE10_CHUNK_SIZE}; /* The size of the hyperslab */
+ int i, j; /* Local index */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing hyperslab selections using offsets in chunked datasets\n"));
@@ -13472,8 +13491,8 @@ test_select_hyper_chunk_offset(void)
CHECK_PTR(rbuf, "HDcalloc");
/* Initialize the write buffer */
- for(i=0; i<SPACE10_DIM1; i++)
- wbuf[i]=i;
+ for (i = 0; i < SPACE10_DIM1; i++)
+ wbuf[i] = i;
/* Create file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -13516,14 +13535,14 @@ test_select_hyper_chunk_offset(void)
CHECK(ret, FAIL, "H5Pclose");
/* Loop over writing out each chunk */
- for(i = SPACE10_CHUNK_SIZE; i <= SPACE10_DIM1; i += SPACE10_CHUNK_SIZE) {
- hssize_t offset[1]; /* Offset of selection */
- hid_t fsid; /* File dataspace ID */
- hsize_t size[1]; /* The size to extend the dataset to */
+ for (i = SPACE10_CHUNK_SIZE; i <= SPACE10_DIM1; i += SPACE10_CHUNK_SIZE) {
+ hssize_t offset[1]; /* Offset of selection */
+ hid_t fsid; /* File dataspace ID */
+ hsize_t size[1]; /* The size to extend the dataset to */
/* Extend the dataset */
- size[0] = (hsize_t)i; /* The size to extend the dataset to */
- ret = H5Dset_extent(did, size);
+ size[0] = (hsize_t)i; /* The size to extend the dataset to */
+ ret = H5Dset_extent(did, size);
CHECK(ret, FAIL, "H5Dset_extent");
/* Get the (extended) dataspace from the dataset */
@@ -13536,12 +13555,12 @@ test_select_hyper_chunk_offset(void)
/* Set the selection offset for the file dataspace */
offset[0] = i - SPACE10_CHUNK_SIZE;
- ret = H5Soffset_simple(fsid, offset);
+ ret = H5Soffset_simple(fsid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Set the selection offset for the memory dataspace */
offset[0] = SPACE10_DIM1 - i;
- ret = H5Soffset_simple(msid, offset);
+ ret = H5Soffset_simple(msid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Write the data to the chunk */
@@ -13558,59 +13577,60 @@ test_select_hyper_chunk_offset(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify the information read in */
- for(i=0; i<SPACE10_DIM1; i+=SPACE10_CHUNK_SIZE)
- for(j=0; j<SPACE10_CHUNK_SIZE; j++)
- if(wbuf[i+j]!=rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j])
- TestErrPrintf("Line: %d - Error! i=%d, j=%d, rbuf=%d, wbuf=%d\n",__LINE__,i,j,rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j],wbuf[i+j]);
-
-/* Check with 'OR'ed set of hyperslab selections, which makes certain the
- * hyperslab spanlist code gets tested. -QAK
- */
+ for (i = 0; i < SPACE10_DIM1; i += SPACE10_CHUNK_SIZE)
+ for (j = 0; j < SPACE10_CHUNK_SIZE; j++)
+ if (wbuf[i + j] != rbuf[((SPACE10_DIM1 - i) - SPACE10_CHUNK_SIZE) + j])
+ TestErrPrintf("Line: %d - Error! i=%d, j=%d, rbuf=%d, wbuf=%d\n", __LINE__, i, j,
+ rbuf[((SPACE10_DIM1 - i) - SPACE10_CHUNK_SIZE) + j], wbuf[i + j]);
+
+ /* Check with 'OR'ed set of hyperslab selections, which makes certain the
+ * hyperslab spanlist code gets tested. -QAK
+ */
/* Re-initialize the write buffer */
- for(i = 0; i < SPACE10_DIM1; i++)
+ for (i = 0; i < SPACE10_DIM1; i++)
wbuf[i] = i * 2;
/* Change the selected the region in the memory dataspace */
start[0] = 0;
- count[0] = SPACE10_CHUNK_SIZE/3;
- ret = H5Sselect_hyperslab(msid, H5S_SELECT_SET, start, NULL, count, NULL);
+ count[0] = SPACE10_CHUNK_SIZE / 3;
+ ret = H5Sselect_hyperslab(msid, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = (2 * SPACE10_CHUNK_SIZE)/3;
- ret = H5Sselect_hyperslab(msid, H5S_SELECT_OR, start, NULL, count, NULL);
+ start[0] = (2 * SPACE10_CHUNK_SIZE) / 3;
+ ret = H5Sselect_hyperslab(msid, H5S_SELECT_OR, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Loop over writing out each chunk */
- for(i = SPACE10_CHUNK_SIZE; i <= SPACE10_DIM1; i += SPACE10_CHUNK_SIZE) {
- hssize_t offset[1]; /* Offset of selection */
- hid_t fsid; /* File dataspace ID */
- hsize_t size[1]; /* The size to extend the dataset to */
+ for (i = SPACE10_CHUNK_SIZE; i <= SPACE10_DIM1; i += SPACE10_CHUNK_SIZE) {
+ hssize_t offset[1]; /* Offset of selection */
+ hid_t fsid; /* File dataspace ID */
+ hsize_t size[1]; /* The size to extend the dataset to */
/* Extend the dataset */
- size[0] = (hsize_t)i; /* The size to extend the dataset to */
- ret = H5Dset_extent(did, size);
+ size[0] = (hsize_t)i; /* The size to extend the dataset to */
+ ret = H5Dset_extent(did, size);
CHECK(ret, FAIL, "H5Dset_extent");
/* Get the (extended) dataspace from the dataset */
- fsid = H5Dget_space (did);
+ fsid = H5Dget_space(did);
CHECK(fsid, FAIL, "H5Dget_space");
/* Select the correct region in the dataset */
start[0] = 0;
- ret = H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL);
+ ret = H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = (2*SPACE10_CHUNK_SIZE)/3;
- ret = H5Sselect_hyperslab(fsid, H5S_SELECT_OR, start, NULL, count, NULL);
+ start[0] = (2 * SPACE10_CHUNK_SIZE) / 3;
+ ret = H5Sselect_hyperslab(fsid, H5S_SELECT_OR, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Set the selection offset for the file dataspace */
offset[0] = i - SPACE10_CHUNK_SIZE;
- ret = H5Soffset_simple(fsid, offset);
+ ret = H5Soffset_simple(fsid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Set the selection offset for the memory dataspace */
- offset[0] = SPACE10_DIM1-i;
- ret = H5Soffset_simple(msid, offset);
+ offset[0] = SPACE10_DIM1 - i;
+ ret = H5Soffset_simple(msid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Write the data to the chunk */
@@ -13627,29 +13647,30 @@ test_select_hyper_chunk_offset(void)
CHECK(ret, FAIL, "H5Soffset_simple");
/* Verify the information read in */
- for(i=0; i<SPACE10_DIM1; i+=SPACE10_CHUNK_SIZE)
- for(j=0; j<SPACE10_CHUNK_SIZE; j++)
+ for (i = 0; i < SPACE10_DIM1; i += SPACE10_CHUNK_SIZE)
+ for (j = 0; j < SPACE10_CHUNK_SIZE; j++)
/* We're not writing out the "middle" of each chunk, so don't check that */
- if(j<(SPACE10_CHUNK_SIZE/3) || j>=((2*SPACE10_CHUNK_SIZE)/3))
- if(wbuf[i+j]!=rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j])
- TestErrPrintf("Line: %d - Error! i=%d, j=%d, rbuf=%d, wbuf=%d\n",__LINE__,i,j,rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j],wbuf[i+j]);
+ if (j < (SPACE10_CHUNK_SIZE / 3) || j >= ((2 * SPACE10_CHUNK_SIZE) / 3))
+ if (wbuf[i + j] != rbuf[((SPACE10_DIM1 - i) - SPACE10_CHUNK_SIZE) + j])
+ TestErrPrintf("Line: %d - Error! i=%d, j=%d, rbuf=%d, wbuf=%d\n", __LINE__, i, j,
+ rbuf[((SPACE10_DIM1 - i) - SPACE10_CHUNK_SIZE) + j], wbuf[i + j]);
/* Close the memory dataspace */
- ret=H5Sclose (msid);
+ ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
/* Close the dataset */
- ret=H5Dclose (did);
+ ret = H5Dclose(did);
CHECK(ret, FAIL, "H5Dclose");
/* Close the file */
- ret=H5Fclose (fid);
+ ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Free the buffers */
HDfree(wbuf);
HDfree(rbuf);
-} /* test_select_hyper_chunk_offset() */
+} /* test_select_hyper_chunk_offset() */
/****************************************************************
**
@@ -13661,19 +13682,19 @@ test_select_hyper_chunk_offset(void)
static void
test_select_hyper_chunk_offset2(void)
{
- hid_t file, dataset; /* handles */
- hid_t dataspace;
- hid_t memspace;
- hid_t dcpl; /* Dataset creation property list */
- herr_t status;
- unsigned data_out[SPACE12_DIM0]; /* output buffer */
- unsigned data_in[SPACE12_CHUNK_DIM0]; /* input buffer */
- hsize_t dims[SPACE12_RANK]={SPACE12_DIM0}; /* Dimension size */
- hsize_t chunk_dims[SPACE12_RANK]={SPACE12_CHUNK_DIM0}; /* Chunk size */
- hsize_t start[SPACE12_RANK]; /* Start of hyperslab */
- hsize_t count[SPACE12_RANK]; /* Size of hyperslab */
- hssize_t offset[SPACE12_RANK]; /* hyperslab offset in the file */
- unsigned u, v; /* Local index variables */
+ hid_t file, dataset; /* handles */
+ hid_t dataspace;
+ hid_t memspace;
+ hid_t dcpl; /* Dataset creation property list */
+ herr_t status;
+ unsigned data_out[SPACE12_DIM0]; /* output buffer */
+ unsigned data_in[SPACE12_CHUNK_DIM0]; /* input buffer */
+ hsize_t dims[SPACE12_RANK] = {SPACE12_DIM0}; /* Dimension size */
+ hsize_t chunk_dims[SPACE12_RANK] = {SPACE12_CHUNK_DIM0}; /* Chunk size */
+ hsize_t start[SPACE12_RANK]; /* Start of hyperslab */
+ hsize_t count[SPACE12_RANK]; /* Size of hyperslab */
+ hssize_t offset[SPACE12_RANK]; /* hyperslab offset in the file */
+ unsigned u, v; /* Local index variables */
/* Output message about test being performed */
MESSAGE(6, ("Testing more hyperslab selections using offsets in chunked datasets\n"));
@@ -13719,25 +13740,25 @@ test_select_hyper_chunk_offset2(void)
*/
start[0] = 0;
count[0] = SPACE12_CHUNK_DIM0;
- status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, NULL, count, NULL);
+ status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(status, FAIL, "H5Sselect_hyperslab");
/* Loop through retrieving data from file, checking it against data written */
- for(u = 0; u < SPACE12_DIM0; u += SPACE12_CHUNK_DIM0) {
+ for (u = 0; u < SPACE12_DIM0; u += SPACE12_CHUNK_DIM0) {
/* Set the offset of the file selection */
offset[0] = u;
- status = H5Soffset_simple(dataspace, offset);
+ status = H5Soffset_simple(dataspace, offset);
CHECK(status, FAIL, "H5Soffset_simple");
/* Read in buffer of data */
- status = H5Dread(dataset, H5T_NATIVE_UINT, memspace, dataspace,
- H5P_DEFAULT, data_in);
+ status = H5Dread(dataset, H5T_NATIVE_UINT, memspace, dataspace, H5P_DEFAULT, data_in);
CHECK(status, FAIL, "H5Dread");
/* Check data read in */
- for(v = 0; v < SPACE12_CHUNK_DIM0; v++)
- if(data_out[u + v] != data_in[v])
- TestErrPrintf("Error! data_out[%u]=%u, data_in[%u]=%u\n",(unsigned)(u + v), data_out[u + v], v, data_in[v]);
+ for (v = 0; v < SPACE12_CHUNK_DIM0; v++)
+ if (data_out[u + v] != data_in[v])
+ TestErrPrintf("Error! data_out[%u]=%u, data_in[%u]=%u\n", (unsigned)(u + v), data_out[u + v],
+ v, data_in[v]);
} /* end for */
status = H5Dclose(dataset);
@@ -13751,7 +13772,7 @@ test_select_hyper_chunk_offset2(void)
status = H5Fclose(file);
CHECK(status, FAIL, "H5Fclose");
-} /* test_select_hyper_chunk_offset2() */
+} /* test_select_hyper_chunk_offset2() */
/****************************************************************
**
@@ -13762,23 +13783,23 @@ test_select_hyper_chunk_offset2(void)
static void
test_select_bounds(void)
{
- hid_t sid; /* Dataspace ID */
- const hsize_t dims[SPACE11_RANK] = {SPACE11_DIM1, SPACE11_DIM2}; /* Dataspace dimensions */
- hsize_t coord[SPACE11_NPOINTS][SPACE11_RANK]; /* Coordinates for point selection */
- hsize_t start[SPACE11_RANK]; /* The start of the hyperslab */
- hsize_t stride[SPACE11_RANK]; /* The stride between block starts for the hyperslab */
- hsize_t count[SPACE11_RANK]; /* The number of blocks for the hyperslab */
- hsize_t block[SPACE11_RANK]; /* The size of each block for the hyperslab */
- hssize_t offset[SPACE11_RANK]; /* Offset amount for selection */
- hsize_t low_bounds[SPACE11_RANK]; /* The low bounds for the selection */
- hsize_t high_bounds[SPACE11_RANK]; /* The high bounds for the selection */
- herr_t ret; /* Generic return value */
+ hid_t sid; /* Dataspace ID */
+ const hsize_t dims[SPACE11_RANK] = {SPACE11_DIM1, SPACE11_DIM2}; /* Dataspace dimensions */
+ hsize_t coord[SPACE11_NPOINTS][SPACE11_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE11_RANK]; /* The start of the hyperslab */
+ hsize_t stride[SPACE11_RANK]; /* The stride between block starts for the hyperslab */
+ hsize_t count[SPACE11_RANK]; /* The number of blocks for the hyperslab */
+ hsize_t block[SPACE11_RANK]; /* The size of each block for the hyperslab */
+ hssize_t offset[SPACE11_RANK]; /* Offset amount for selection */
+ hsize_t low_bounds[SPACE11_RANK]; /* The low bounds for the selection */
+ hsize_t high_bounds[SPACE11_RANK]; /* The high bounds for the selection */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing selection bounds\n"));
/* Create dataspace */
- sid = H5Screate_simple (SPACE11_RANK, dims, NULL);
+ sid = H5Screate_simple(SPACE11_RANK, dims, NULL);
CHECK(sid, FAIL, "H5Screate_simple");
/* Get bounds for 'all' selection */
@@ -13790,8 +13811,9 @@ test_select_bounds(void)
VERIFY(high_bounds[1], SPACE11_DIM2 - 1, "H5Sget_select_bounds");
/* Set offset for selection */
- offset[0] = 1; offset[1] = 1;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 1;
+ offset[1] = 1;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for 'all' selection with offset (which should be ignored) */
@@ -13803,8 +13825,9 @@ test_select_bounds(void)
VERIFY(high_bounds[1], SPACE11_DIM2 - 1, "H5Sget_select_bounds");
/* Reset offset for selection */
- offset[0] = 0; offset[1] = 0;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 0;
+ offset[1] = 0;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Set 'none' selection */
@@ -13812,17 +13835,20 @@ test_select_bounds(void)
CHECK(ret, FAIL, "H5Sselect_none");
/* Get bounds for 'none' selection */
- H5E_BEGIN_TRY {
- ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_select_bo unds");
/* Set point selection */
- coord[0][0] = 3; coord[0][1] = 3;
- coord[1][0] = 3; coord[1][1] = 96;
- coord[2][0] = 96; coord[2][1] = 3;
- coord[3][0] = 96; coord[3][1] = 96;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)SPACE11_NPOINTS, (const hsize_t *)coord);
+ coord[0][0] = 3;
+ coord[0][1] = 3;
+ coord[1][0] = 3;
+ coord[1][1] = 96;
+ coord[2][0] = 96;
+ coord[2][1] = 3;
+ coord[3][0] = 96;
+ coord[3][1] = 96;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)SPACE11_NPOINTS, (const hsize_t *)coord);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Get bounds for point selection */
@@ -13834,19 +13860,20 @@ test_select_bounds(void)
VERIFY(high_bounds[1], SPACE11_DIM2 - 4, "H5Sget_select_bounds");
/* Set bad offset for selection */
- offset[0] = 5; offset[1] = -5;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 5;
+ offset[1] = -5;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with negative offset */
- H5E_BEGIN_TRY {
- ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_select_bounds");
/* Set valid offset for selection */
- offset[0] = 2; offset[1] = -2;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 2;
+ offset[1] = -2;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for point selection with offset */
@@ -13858,16 +13885,21 @@ test_select_bounds(void)
VERIFY(high_bounds[1], SPACE11_DIM2 - 6, "H5Sget_select_bounds");
/* Reset offset for selection */
- offset[0] = 0; offset[1] = 0;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 0;
+ offset[1] = 0;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Set "regular" hyperslab selection */
- start[0] = 2; start[1] = 2;
- stride[0] = 10; stride[1] = 10;
- count[0] = 4; count[1] = 4;
- block[0] = 5; block[1] = 5;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 10;
+ stride[1] = 10;
+ count[0] = 4;
+ count[1] = 4;
+ block[0] = 5;
+ block[1] = 5;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Get bounds for hyperslab selection */
@@ -13879,19 +13911,20 @@ test_select_bounds(void)
VERIFY(high_bounds[1], 36, "H5Sget_select_bounds");
/* Set bad offset for selection */
- offset[0] = 5; offset[1] = -5;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 5;
+ offset[1] = -5;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with negative offset */
- H5E_BEGIN_TRY {
- ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_select_bounds");
/* Set valid offset for selection */
- offset[0] = 5; offset[1] = -2;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 5;
+ offset[1] = -2;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with offset */
@@ -13903,16 +13936,21 @@ test_select_bounds(void)
VERIFY(high_bounds[1], 34, "H5Sget_select_bounds");
/* Reset offset for selection */
- offset[0] = 0; offset[1] = 0;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 0;
+ offset[1] = 0;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Make "irregular" hyperslab selection */
- start[0] = 20; start[1] = 20;
- stride[0] = 20; stride[1] = 20;
- count[0] = 2; count[1] = 2;
- block[0] = 10; block[1] = 10;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
+ start[0] = 20;
+ start[1] = 20;
+ stride[0] = 20;
+ stride[1] = 20;
+ count[0] = 2;
+ count[1] = 2;
+ block[0] = 10;
+ block[1] = 10;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Get bounds for hyperslab selection */
@@ -13924,19 +13962,20 @@ test_select_bounds(void)
VERIFY(high_bounds[1], 49, "H5Sget_select_bounds");
/* Set bad offset for selection */
- offset[0] = 5; offset[1] = -5;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 5;
+ offset[1] = -5;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with negative offset */
- H5E_BEGIN_TRY {
- ret = H5Sget_select_bounds(sid, low_bounds, high_bounds);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_select_bounds");
/* Set valid offset for selection */
- offset[0] = 5; offset[1] = -2;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 5;
+ offset[1] = -2;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Get bounds for hyperslab selection with offset */
@@ -13948,15 +13987,15 @@ test_select_bounds(void)
VERIFY(high_bounds[1], 47, "H5Sget_select_bounds");
/* Reset offset for selection */
- offset[0] = 0; offset[1] = 0;
- ret = H5Soffset_simple(sid, offset);
+ offset[0] = 0;
+ offset[1] = 0;
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Close the dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_select_bounds() */
-
+} /* test_select_bounds() */
/****************************************************************
**
@@ -13966,22 +14005,22 @@ test_select_bounds(void)
static void
test_hyper_regular(void)
{
- hid_t sid; /* Dataspace ID */
- const hsize_t dims[SPACE13_RANK] = {SPACE13_DIM1, SPACE13_DIM2, SPACE13_DIM3}; /* Dataspace dimensions */
- hsize_t coord[SPACE13_NPOINTS][SPACE13_RANK]; /* Coordinates for point selection */
- hsize_t start[SPACE13_RANK]; /* The start of the hyperslab */
- hsize_t stride[SPACE13_RANK]; /* The stride between block starts for the hyperslab */
- hsize_t count[SPACE13_RANK]; /* The number of blocks for the hyperslab */
- hsize_t block[SPACE13_RANK]; /* The size of each block for the hyperslab */
- hsize_t t_start[SPACE13_RANK]; /* Temporary start of the hyperslab */
- hsize_t t_count[SPACE13_RANK]; /* Temporary number of blocks for the hyperslab */
- hsize_t q_start[SPACE13_RANK]; /* The queried start of the hyperslab */
- hsize_t q_stride[SPACE13_RANK]; /* The queried stride between block starts for the hyperslab */
- hsize_t q_count[SPACE13_RANK]; /* The queried number of blocks for the hyperslab */
- hsize_t q_block[SPACE13_RANK]; /* The queried size of each block for the hyperslab */
- htri_t is_regular; /* Whether a hyperslab selection is regular */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t sid; /* Dataspace ID */
+ const hsize_t dims[SPACE13_RANK] = {SPACE13_DIM1, SPACE13_DIM2, SPACE13_DIM3}; /* Dataspace dimensions */
+ hsize_t coord[SPACE13_NPOINTS][SPACE13_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE13_RANK]; /* The start of the hyperslab */
+ hsize_t stride[SPACE13_RANK]; /* The stride between block starts for the hyperslab */
+ hsize_t count[SPACE13_RANK]; /* The number of blocks for the hyperslab */
+ hsize_t block[SPACE13_RANK]; /* The size of each block for the hyperslab */
+ hsize_t t_start[SPACE13_RANK]; /* Temporary start of the hyperslab */
+ hsize_t t_count[SPACE13_RANK]; /* Temporary number of blocks for the hyperslab */
+ hsize_t q_start[SPACE13_RANK]; /* The queried start of the hyperslab */
+ hsize_t q_stride[SPACE13_RANK]; /* The queried stride between block starts for the hyperslab */
+ hsize_t q_count[SPACE13_RANK]; /* The queried number of blocks for the hyperslab */
+ hsize_t q_block[SPACE13_RANK]; /* The queried size of each block for the hyperslab */
+ htri_t is_regular; /* Whether a hyperslab selection is regular */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing queries on regular hyperslabs\n"));
@@ -13991,15 +14030,13 @@ test_hyper_regular(void)
CHECK(sid, FAIL, "H5Screate_simple");
/* Query if 'all' selection is regular hyperslab (should fail) */
- H5E_BEGIN_TRY {
- is_regular = H5Sis_regular_hyperslab(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); }
+ H5E_END_TRY;
VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
/* Query regular hyperslab selection info (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
/* Set 'none' selection */
@@ -14007,43 +14044,55 @@ test_hyper_regular(void)
CHECK(ret, FAIL, "H5Sselect_none");
/* Query if 'none' selection is regular hyperslab (should fail) */
- H5E_BEGIN_TRY {
- is_regular = H5Sis_regular_hyperslab(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); }
+ H5E_END_TRY;
VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
/* Query regular hyperslab selection info (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
/* Set point selection */
- coord[0][0] = 3; coord[0][1] = 3; coord[0][2] = 3;
- coord[1][0] = 3; coord[1][1] = 48; coord[1][2] = 48;
- coord[2][0] = 48; coord[2][1] = 3; coord[2][2] = 3;
- coord[3][0] = 48; coord[3][1] = 48; coord[3][2] = 48;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)SPACE13_NPOINTS, (const hsize_t *)coord);
+ coord[0][0] = 3;
+ coord[0][1] = 3;
+ coord[0][2] = 3;
+ coord[1][0] = 3;
+ coord[1][1] = 48;
+ coord[1][2] = 48;
+ coord[2][0] = 48;
+ coord[2][1] = 3;
+ coord[2][2] = 3;
+ coord[3][0] = 48;
+ coord[3][1] = 48;
+ coord[3][2] = 48;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)SPACE13_NPOINTS, (const hsize_t *)coord);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Query if 'point' selection is regular hyperslab (should fail) */
- H5E_BEGIN_TRY {
- is_regular = H5Sis_regular_hyperslab(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); }
+ H5E_END_TRY;
VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab");
/* Query regular hyperslab selection info (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
/* Set "regular" hyperslab selection */
- start[0] = 2; start[1] = 2; start[2] = 2;
- stride[0] = 5; stride[1] = 5; stride[2] = 5;
- count[0] = 3; count[1] = 3; count[2] = 3;
- block[0] = 4; block[1] = 4; block[2] = 4;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 2;
+ start[1] = 2;
+ start[2] = 2;
+ stride[0] = 5;
+ stride[1] = 5;
+ stride[2] = 5;
+ count[0] = 3;
+ count[1] = 3;
+ count[2] = 3;
+ block[0] = 4;
+ block[1] = 4;
+ block[2] = 4;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */
@@ -14055,21 +14104,25 @@ test_hyper_regular(void)
CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
/* Verify the hyperslab parameters */
- for(u = 0; u < SPACE13_RANK; u++) {
- if(start[u] != q_start[u])
+ for (u = 0; u < SPACE13_RANK; u++) {
+ if (start[u] != q_start[u])
ERROR("H5Sget_regular_hyperslab, start");
- if(stride[u] != q_stride[u])
+ if (stride[u] != q_stride[u])
ERROR("H5Sget_regular_hyperslab, stride");
- if(count[u] != q_count[u])
+ if (count[u] != q_count[u])
ERROR("H5Sget_regular_hyperslab, count");
- if(block[u] != q_block[u])
+ if (block[u] != q_block[u])
ERROR("H5Sget_regular_hyperslab, block");
} /* end for */
/* 'OR' in another point */
- t_start[0] = 0; t_start[1] = 0; t_start[2] = 0;
- t_count[0] = 1; t_count[1] = 1; t_count[2] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, t_start, NULL, t_count, NULL);
+ t_start[0] = 0;
+ t_start[1] = 0;
+ t_start[2] = 0;
+ t_count[0] = 1;
+ t_count[1] = 1;
+ t_count[2] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, t_start, NULL, t_count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Query if 'hyperslab' selection is regular hyperslab (should be FALSE) */
@@ -14077,15 +14130,18 @@ test_hyper_regular(void)
VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab");
/* Query regular hyperslab selection info (should fail) */
- H5E_BEGIN_TRY {
- ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sget_regular_hyperslab");
/* 'XOR' in the point again, to remove it, which should make it regular again */
- t_start[0] = 0; t_start[1] = 0; t_start[2] = 0;
- t_count[0] = 1; t_count[1] = 1; t_count[2] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_XOR, t_start, NULL, t_count, NULL);
+ t_start[0] = 0;
+ t_start[1] = 0;
+ t_start[2] = 0;
+ t_count[0] = 1;
+ t_count[1] = 1;
+ t_count[2] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_XOR, t_start, NULL, t_count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */
@@ -14097,21 +14153,21 @@ test_hyper_regular(void)
CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
/* Verify the hyperslab parameters */
- for(u = 0; u < SPACE13_RANK; u++) {
- if(start[u] != q_start[u])
+ for (u = 0; u < SPACE13_RANK; u++) {
+ if (start[u] != q_start[u])
ERROR("H5Sget_regular_hyperslab, start");
- if(stride[u] != q_stride[u])
+ if (stride[u] != q_stride[u])
ERROR("H5Sget_regular_hyperslab, stride");
- if(count[u] != q_count[u])
+ if (count[u] != q_count[u])
ERROR("H5Sget_regular_hyperslab, count");
- if(block[u] != q_block[u])
+ if (block[u] != q_block[u])
ERROR("H5Sget_regular_hyperslab, block");
} /* end for */
/* Close the dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_hyper_regular() */
+} /* test_hyper_regular() */
/****************************************************************
**
@@ -14119,16 +14175,16 @@ test_hyper_regular(void)
**
****************************************************************/
static void
-test_hyper_unlim_check(hid_t sid, hsize_t *dims, hssize_t enpoints,
- hssize_t enblocks, hsize_t *eblock1, hsize_t *eblock2)
+test_hyper_unlim_check(hid_t sid, hsize_t *dims, hssize_t enpoints, hssize_t enblocks, hsize_t *eblock1,
+ hsize_t *eblock2)
{
- hid_t lim_sid;
- hsize_t start[3];
+ hid_t lim_sid;
+ hsize_t start[3];
H5S_sel_type sel_type;
- hssize_t npoints;
- hssize_t nblocks;
- hsize_t blocklist[12];
- herr_t ret;
+ hssize_t npoints;
+ hssize_t nblocks;
+ hsize_t blocklist[12];
+ herr_t ret;
HDassert(enblocks <= 2);
@@ -14151,39 +14207,37 @@ test_hyper_unlim_check(hid_t sid, hsize_t *dims, hssize_t enpoints,
CHECK(sel_type, H5S_SEL_ERROR, "H5Sget_select_type");
/* Only examine blocks for hyperslab selection */
- if(sel_type == H5S_SEL_HYPERSLABS) {
+ if (sel_type == H5S_SEL_HYPERSLABS) {
/* Get number of blocks */
nblocks = H5Sget_select_hyper_nblocks(lim_sid);
CHECK(nblocks, FAIL, "H5Sget_select_hyper_nblocks");
VERIFY(nblocks, enblocks, "H5Sget_select_hyper_nblocks");
- if(nblocks > 0) {
+ if (nblocks > 0) {
/* Get blocklist */
ret = H5Sget_select_hyper_blocklist(lim_sid, (hsize_t)0, (hsize_t)nblocks, blocklist);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
/* Verify blocklist */
- if(nblocks == (hssize_t)1) {
- if(HDmemcmp(blocklist, eblock1, 6 * sizeof(eblock1[0])))
+ if (nblocks == (hssize_t)1) {
+ if (HDmemcmp(blocklist, eblock1, 6 * sizeof(eblock1[0])))
ERROR("H5Sget_select_hyper_blocklist");
} /* end if */
else {
HDassert(nblocks == (hssize_t)2);
- if(HDmemcmp(blocklist, eblock1, 6 * sizeof(eblock1[0]))) {
- if(HDmemcmp(blocklist, eblock2, 6 * sizeof(eblock2[0])))
+ if (HDmemcmp(blocklist, eblock1, 6 * sizeof(eblock1[0]))) {
+ if (HDmemcmp(blocklist, eblock2, 6 * sizeof(eblock2[0])))
ERROR("H5Sget_select_hyper_blocklist");
- if(HDmemcmp(&blocklist[6], eblock1, 6 * sizeof(eblock1[0])))
+ if (HDmemcmp(&blocklist[6], eblock1, 6 * sizeof(eblock1[0])))
ERROR("H5Sget_select_hyper_blocklist");
} /* end if */
- else
- if(HDmemcmp(&blocklist[6], eblock2, 6 * sizeof(eblock2[0])))
- ERROR("H5Sget_select_hyper_blocklist");
+ else if (HDmemcmp(&blocklist[6], eblock2, 6 * sizeof(eblock2[0])))
+ ERROR("H5Sget_select_hyper_blocklist");
} /* end else */
- } /* end if */
- } /* end if */
- else
- if(sel_type != H5S_SEL_NONE)
- ERROR("H5Sget_select_type");
+ } /* end if */
+ } /* end if */
+ else if (sel_type != H5S_SEL_NONE)
+ ERROR("H5Sget_select_type");
/* Close the limited dataspace */
ret = H5Sclose(lim_sid);
@@ -14193,20 +14247,20 @@ test_hyper_unlim_check(hid_t sid, hsize_t *dims, hssize_t enpoints,
static void
test_hyper_unlim(void)
{
- hid_t sid;
- hsize_t dims[3] = {4, 4, 7};
- hsize_t mdims[3] = {4, H5S_UNLIMITED, 7};
- hsize_t start[3] = {1, 2, 1};
- hsize_t stride[3] = {1, 1, 3};
- hsize_t count[3] = {1, 1, 2};
- hsize_t block[3] = {2, H5S_UNLIMITED, 2};
- hsize_t start2[3];
- hsize_t count2[3];
- hsize_t eblock1[6] = {1, 2, 1, 2, 3, 2};
- hsize_t eblock2[6] = {1, 2, 4, 2, 3, 5};
- hssize_t offset[3] = {0, -1, 0};
- hssize_t ssize_out;
- herr_t ret;
+ hid_t sid;
+ hsize_t dims[3] = {4, 4, 7};
+ hsize_t mdims[3] = {4, H5S_UNLIMITED, 7};
+ hsize_t start[3] = {1, 2, 1};
+ hsize_t stride[3] = {1, 1, 3};
+ hsize_t count[3] = {1, 1, 2};
+ hsize_t block[3] = {2, H5S_UNLIMITED, 2};
+ hsize_t start2[3];
+ hsize_t count2[3];
+ hsize_t eblock1[6] = {1, 2, 1, 2, 3, 2};
+ hsize_t eblock2[6] = {1, 2, 4, 2, 3, 5};
+ hssize_t offset[3] = {0, -1, 0};
+ hssize_t ssize_out;
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(6, ("Testing unlimited hyperslab selections\n"));
@@ -14223,7 +14277,7 @@ test_hyper_unlim(void)
test_hyper_unlim_check(sid, dims, (hssize_t)16, (hssize_t)2, eblock1, eblock2);
/* Check with unlimited dimension clipped to 3 */
- dims[1] = 3;
+ dims[1] = 3;
eblock1[4] = 2;
eblock2[4] = 2;
test_hyper_unlim_check(sid, dims, (hssize_t)8, (hssize_t)2, eblock1, eblock2);
@@ -14237,7 +14291,7 @@ test_hyper_unlim(void)
test_hyper_unlim_check(sid, dims, (hssize_t)0, (hssize_t)0, eblock1, eblock2);
/* Check with unlimited dimension clipped to 7 */
- dims[1] = 7;
+ dims[1] = 7;
eblock1[4] = 6;
eblock2[4] = 6;
test_hyper_unlim_check(sid, dims, (hssize_t)40, (hssize_t)2, eblock1, eblock2);
@@ -14251,7 +14305,7 @@ test_hyper_unlim(void)
/* Reset offset of selection */
offset[1] = (hssize_t)0;
- ret = H5Soffset_simple(sid, offset);
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/*
@@ -14259,9 +14313,9 @@ test_hyper_unlim(void)
*/
stride[1] = 3;
stride[2] = 1;
- count[1] = H5S_UNLIMITED;
- count[2] = 1;
- block[1] = 2;
+ count[1] = H5S_UNLIMITED;
+ count[2] = 1;
+ block[1] = 2;
/* Select unlimited hyperslab */
ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
@@ -14277,29 +14331,29 @@ test_hyper_unlim(void)
test_hyper_unlim_check(sid, dims, (hssize_t)16, (hssize_t)2, eblock1, eblock2);
/* Check with unlimited dimension clipped to 3 */
- dims[1] = 3;
+ dims[1] = 3;
eblock1[4] = 2;
test_hyper_unlim_check(sid, dims, (hssize_t)4, (hssize_t)1, eblock1, eblock2);
/* Check with unlimited dimension clipped to 4 */
- dims[1] = 4;
+ dims[1] = 4;
eblock1[4] = 3;
test_hyper_unlim_check(sid, dims, (hssize_t)8, (hssize_t)1, eblock1, eblock2);
/* Check with unlimited dimension clipped to 5 */
- dims[1] = 5;
+ dims[1] = 5;
eblock1[4] = 3;
test_hyper_unlim_check(sid, dims, (hssize_t)8, (hssize_t)1, eblock1, eblock2);
/* Check with unlimited dimension clipped to 6 */
- dims[1] = 6;
+ dims[1] = 6;
eblock1[4] = 3;
eblock2[4] = 5;
test_hyper_unlim_check(sid, dims, (hssize_t)12, (hssize_t)2, eblock1, eblock2);
/* Set offset of selection */
offset[1] = (hssize_t)-1;
- ret = H5Soffset_simple(sid, offset);
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Check with adjusted offset (should not affect result) */
@@ -14307,7 +14361,7 @@ test_hyper_unlim(void)
/* Set offset of selection */
offset[1] = (hssize_t)3;
- ret = H5Soffset_simple(sid, offset);
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/* Check with adjusted offset (should not affect result) */
@@ -14315,41 +14369,44 @@ test_hyper_unlim(void)
/* Reset offset of selection */
offset[1] = (hssize_t)0;
- ret = H5Soffset_simple(sid, offset);
+ ret = H5Soffset_simple(sid, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
/*
* Now try invalid operations
*/
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* Try multiple unlimited dimensions */
- start[0] = 1;
- start[1] = 2;
- start[2] = 1;
+ start[0] = 1;
+ start[1] = 2;
+ start[2] = 1;
stride[0] = 1;
stride[1] = 3;
stride[2] = 3;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- count[2] = H5S_UNLIMITED;
- block[0] = 2;
- block[1] = 2;
- block[2] = 2;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ count[2] = H5S_UNLIMITED;
+ block[0] = 2;
+ block[1] = 2;
+ block[2] = 2;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
/* Try unlimited count and block */
count[2] = 2;
block[1] = H5S_UNLIMITED;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* Try operations with two unlimited selections */
block[1] = 2;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
- H5E_BEGIN_TRY {
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+ H5E_BEGIN_TRY
+ {
ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, NULL, count, NULL);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
ret = H5Sselect_hyperslab(sid, H5S_SELECT_AND, start, NULL, count, NULL);
@@ -14360,27 +14417,32 @@ test_hyper_unlim(void)
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
ret = H5Sselect_hyperslab(sid, H5S_SELECT_NOTA, start, NULL, count, NULL);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/* Try invalid combination operations */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, NULL, block, NULL);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
ret = H5Sselect_hyperslab(sid, H5S_SELECT_XOR, start, NULL, block, NULL);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
ret = H5Sselect_hyperslab(sid, H5S_SELECT_NOTB, start, NULL, block, NULL);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
- } H5E_END_TRY
+ }
+ H5E_END_TRY
ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, block, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
ret = H5Sselect_hyperslab(sid, H5S_SELECT_XOR, start, stride, count, block);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
ret = H5Sselect_hyperslab(sid, H5S_SELECT_NOTA, start, stride, count, block);
VERIFY(ret, FAIL, "H5Sselect_hyperslab");
- } H5E_END_TRY
+ }
+ H5E_END_TRY
/*
* Now test valid combination operations
@@ -14392,7 +14454,7 @@ test_hyper_unlim(void)
block[0] = 2;
block[1] = 2;
block[2] = 2;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start2[0] = 2;
start2[1] = 2;
@@ -14400,7 +14462,7 @@ test_hyper_unlim(void)
count2[0] = 5;
count2[1] = 4;
count2[2] = 2;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_AND, start2, NULL, count2, NULL);
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_AND, start2, NULL, count2, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
eblock1[0] = 2;
eblock1[3] = 2;
@@ -14414,9 +14476,9 @@ test_hyper_unlim(void)
eblock2[4] = 5;
eblock2[2] = 1;
eblock2[5] = 1;
- dims[0] = 50;
- dims[1] = 50;
- dims[2] = 50;
+ dims[0] = 50;
+ dims[1] = 50;
+ dims[2] = 50;
test_hyper_unlim_check(sid, dims, (hssize_t)3, (hssize_t)2, eblock1, eblock2);
/* unlim NOTA non-unlim */
@@ -14426,7 +14488,7 @@ test_hyper_unlim(void)
block[0] = 2;
block[1] = 2;
block[2] = 2;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
start2[0] = 1;
start2[1] = 5;
@@ -14434,7 +14496,7 @@ test_hyper_unlim(void)
count2[0] = 2;
count2[1] = 2;
count2[2] = 6;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_NOTA, start2, NULL, count2, NULL);
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_NOTA, start2, NULL, count2, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
eblock1[0] = 1;
eblock1[3] = 2;
@@ -14448,9 +14510,9 @@ test_hyper_unlim(void)
eblock2[4] = 6;
eblock2[2] = 6;
eblock2[5] = 7;
- dims[0] = 50;
- dims[1] = 50;
- dims[2] = 50;
+ dims[0] = 50;
+ dims[1] = 50;
+ dims[2] = 50;
test_hyper_unlim_check(sid, dims, (hssize_t)12, (hssize_t)2, eblock1, eblock2);
/* non-unlim AND unlim */
@@ -14460,7 +14522,7 @@ test_hyper_unlim(void)
count2[0] = 5;
count2[1] = 4;
count2[2] = 2;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start2, NULL, count2, NULL);
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start2, NULL, count2, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
count[0] = 1;
count[1] = H5S_UNLIMITED;
@@ -14468,7 +14530,7 @@ test_hyper_unlim(void)
block[0] = 2;
block[1] = 2;
block[2] = 2;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_AND, start, stride, count, block);
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_AND, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
eblock1[0] = 2;
eblock1[3] = 2;
@@ -14482,9 +14544,9 @@ test_hyper_unlim(void)
eblock2[4] = 5;
eblock2[2] = 1;
eblock2[5] = 1;
- dims[0] = 50;
- dims[1] = 50;
- dims[2] = 50;
+ dims[0] = 50;
+ dims[1] = 50;
+ dims[2] = 50;
test_hyper_unlim_check(sid, dims, (hssize_t)3, (hssize_t)2, eblock1, eblock2);
/* non-unlim NOTB unlim */
@@ -14494,7 +14556,7 @@ test_hyper_unlim(void)
count2[0] = 2;
count2[1] = 2;
count2[2] = 6;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start2, NULL, count2, NULL);
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start2, NULL, count2, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
count[0] = 1;
count[1] = H5S_UNLIMITED;
@@ -14502,7 +14564,7 @@ test_hyper_unlim(void)
block[0] = 2;
block[1] = 2;
block[2] = 2;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_NOTB, start, stride, count, block);
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_NOTB, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
eblock1[0] = 1;
eblock1[3] = 2;
@@ -14516,9 +14578,9 @@ test_hyper_unlim(void)
eblock2[4] = 6;
eblock2[2] = 6;
eblock2[5] = 7;
- dims[0] = 50;
- dims[1] = 50;
- dims[2] = 50;
+ dims[0] = 50;
+ dims[1] = 50;
+ dims[2] = 50;
test_hyper_unlim_check(sid, dims, (hssize_t)12, (hssize_t)2, eblock1, eblock2);
/* Test H5Sget_select_npoints() */
@@ -14556,37 +14618,37 @@ test_hyper_unlim(void)
static void
test_internal_consistency(void)
{
- hid_t all_sid; /* Dataspace ID with "all" selection */
- hid_t none_sid; /* Dataspace ID with "none" selection */
- hid_t single_pt_sid; /* Dataspace ID with single point selection */
- hid_t mult_pt_sid; /* Dataspace ID with multiple point selection */
- hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
- hid_t single_hyper_all_sid; /* Dataspace ID with single block hyperslab
- * selection that is the entire dataspace
- */
- hid_t single_hyper_pt_sid; /* Dataspace ID with single block hyperslab
- * selection that is the same as the single
- * point selection
- */
- hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
- hid_t irreg_hyper_sid; /* Dataspace ID with irregular hyperslab selection */
- hid_t none_hyper_sid; /* Dataspace ID with "no hyperslabs" selection */
- hid_t scalar_all_sid; /* ID for scalar dataspace with "all" selection */
- hid_t scalar_none_sid; /* ID for scalar dataspace with "none" selection */
- hid_t tmp_sid; /* Temporary dataspace ID */
- hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2};
- hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
- hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */
- hsize_t start[SPACE9_RANK]; /* Hyperslab start */
- hsize_t stride[SPACE9_RANK]; /* Hyperslab stride */
- hsize_t count[SPACE9_RANK]; /* Hyperslab block count */
- hsize_t block[SPACE9_RANK]; /* Hyperslab block size */
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hid_t all_sid; /* Dataspace ID with "all" selection */
+ hid_t none_sid; /* Dataspace ID with "none" selection */
+ hid_t single_pt_sid; /* Dataspace ID with single point selection */
+ hid_t mult_pt_sid; /* Dataspace ID with multiple point selection */
+ hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
+ hid_t single_hyper_all_sid; /* Dataspace ID with single block hyperslab
+ * selection that is the entire dataspace
+ */
+ hid_t single_hyper_pt_sid; /* Dataspace ID with single block hyperslab
+ * selection that is the same as the single
+ * point selection
+ */
+ hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
+ hid_t irreg_hyper_sid; /* Dataspace ID with irregular hyperslab selection */
+ hid_t none_hyper_sid; /* Dataspace ID with "no hyperslabs" selection */
+ hid_t scalar_all_sid; /* ID for scalar dataspace with "all" selection */
+ hid_t scalar_none_sid; /* ID for scalar dataspace with "none" selection */
+ hid_t tmp_sid; /* Temporary dataspace ID */
+ hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2};
+ hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
+ hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */
+ hsize_t start[SPACE9_RANK]; /* Hyperslab start */
+ hsize_t stride[SPACE9_RANK]; /* Hyperslab stride */
+ hsize_t count[SPACE9_RANK]; /* Hyperslab block count */
+ hsize_t block[SPACE9_RANK]; /* Hyperslab block size */
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing Consistency of Internal States\n"));
- assert(SPACE9_DIM2>=POINT1_NPOINTS);
+ assert(SPACE9_DIM2 >= POINT1_NPOINTS);
/* Create dataspace for "all" selection */
all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
@@ -14609,8 +14671,9 @@ test_internal_consistency(void)
CHECK(single_pt_sid, FAIL, "H5Screate_simple");
/* Select sequence of ten points for multiple point selection */
- coord1[0][0] = 2; coord1[0][1] = 2;
- ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
+ coord1[0][0] = 2;
+ coord1[0][1] = 2;
+ ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Create dataspace for multiple point selection */
@@ -14618,16 +14681,26 @@ test_internal_consistency(void)
CHECK(mult_pt_sid, FAIL, "H5Screate_simple");
/* Select sequence of ten points for multiple point selection */
- coord2[0][0]=2; coord2[0][1]=2;
- coord2[1][0]=7; coord2[1][1]=2;
- coord2[2][0]=1; coord2[2][1]=4;
- coord2[3][0]=2; coord2[3][1]=6;
- coord2[4][0]=0; coord2[4][1]=8;
- coord2[5][0]=3; coord2[5][1]=2;
- coord2[6][0]=4; coord2[6][1]=4;
- coord2[7][0]=1; coord2[7][1]=0;
- coord2[8][0]=5; coord2[8][1]=1;
- coord2[9][0]=9; coord2[9][1]=3;
+ coord2[0][0] = 2;
+ coord2[0][1] = 2;
+ coord2[1][0] = 7;
+ coord2[1][1] = 2;
+ coord2[2][0] = 1;
+ coord2[2][1] = 4;
+ coord2[3][0] = 2;
+ coord2[3][1] = 6;
+ coord2[4][0] = 0;
+ coord2[4][1] = 8;
+ coord2[5][0] = 3;
+ coord2[5][1] = 2;
+ coord2[6][0] = 4;
+ coord2[6][1] = 4;
+ coord2[7][0] = 1;
+ coord2[7][1] = 0;
+ coord2[8][0] = 5;
+ coord2[8][1] = 1;
+ coord2[9][0] = 9;
+ coord2[9][1] = 3;
ret = H5Sselect_elements(mult_pt_sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
CHECK(ret, FAIL, "H5Sselect_elements");
@@ -14636,11 +14709,15 @@ test_internal_consistency(void)
CHECK(single_hyper_sid, FAIL, "H5Screate_simple");
/* Select 10x10 hyperslab for single hyperslab selection */
- start[0]=1; start[1]=1;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=(SPACE9_DIM1-2); block[1]=(SPACE9_DIM2-2);
- ret = H5Sselect_hyperslab(single_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1;
+ start[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = (SPACE9_DIM1 - 2);
+ block[1] = (SPACE9_DIM2 - 2);
+ ret = H5Sselect_hyperslab(single_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for single hyperslab selection with entire extent selected */
@@ -14648,11 +14725,15 @@ test_internal_consistency(void)
CHECK(single_hyper_all_sid, FAIL, "H5Screate_simple");
/* Select entire extent for hyperslab selection */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=SPACE9_DIM1; block[1]=SPACE9_DIM2;
- ret = H5Sselect_hyperslab(single_hyper_all_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = SPACE9_DIM1;
+ block[1] = SPACE9_DIM2;
+ ret = H5Sselect_hyperslab(single_hyper_all_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for single hyperslab selection with single point selected */
@@ -14660,11 +14741,15 @@ test_internal_consistency(void)
CHECK(single_hyper_pt_sid, FAIL, "H5Screate_simple");
/* Select entire extent for hyperslab selection */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(single_hyper_pt_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(single_hyper_pt_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for regular hyperslab selection */
@@ -14672,11 +14757,15 @@ test_internal_consistency(void)
CHECK(regular_hyper_sid, FAIL, "H5Screate_simple");
/* Select regular, strided hyperslab selection */
- start[0]=2; start[1]=2;
- stride[0]=2; stride[1]=2;
- count[0]=5; count[1]=2;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(regular_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 5;
+ count[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(regular_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for irregular hyperslab selection */
@@ -14684,18 +14773,26 @@ test_internal_consistency(void)
CHECK(irreg_hyper_sid, FAIL, "H5Screate_simple");
/* Create irregular hyperslab selection by OR'ing two blocks together */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(irreg_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0]=4; start[1]=4;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=3; block[1]=3;
- ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_OR,start,stride,count,block);
+ start[0] = 4;
+ start[1] = 4;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 3;
+ block[1] = 3;
+ ret = H5Sselect_hyperslab(irreg_hyper_sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for "no" hyperslab selection */
@@ -14703,14 +14800,18 @@ test_internal_consistency(void)
CHECK(none_hyper_sid, FAIL, "H5Screate_simple");
/* Create "no" hyperslab selection by XOR'ing same blocks together */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(none_hyper_sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_XOR,start,stride,count,block);
+ ret = H5Sselect_hyperslab(none_hyper_sid, H5S_SELECT_XOR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create scalar dataspace for "all" selection */
@@ -14728,7 +14829,7 @@ test_internal_consistency(void)
/* Test all the selections created */
/* Test the copy of itself */
- tmp_sid=H5Scopy(all_sid);
+ tmp_sid = H5Scopy(all_sid);
CHECK(tmp_sid, FAIL, "H5Scopy");
check = H5S__internal_consistency_test(tmp_sid);
@@ -14806,7 +14907,7 @@ test_internal_consistency(void)
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(scalar_none_sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_internal_consistency() */
+} /* test_internal_consistency() */
/****************************************************************
**
@@ -14817,22 +14918,22 @@ test_internal_consistency(void)
static void
test_irreg_io(void)
{
- hid_t fid; /* File ID */
- hid_t did; /* Dataset ID */
- hid_t dcpl_id; /* Dataset creation property list ID */
- hid_t sid; /* File dataspace ID */
- hid_t mem_sid; /* Memory dataspace ID */
- hsize_t dims[] = {6, 12}; /* Dataspace dimensions */
- hsize_t chunk_dims[] = {2, 2}; /* Chunk dimensions */
- hsize_t mem_dims[] = {32}; /* Memory dataspace dimensions */
- hsize_t start[2]; /* Hyperslab start */
- hsize_t stride[2]; /* Hyperslab stride */
- hsize_t count[2]; /* Hyperslab block count */
- hsize_t block[2]; /* Hyperslab block size */
- unsigned char wbuf[72]; /* Write buffer */
- unsigned char rbuf[32]; /* Read buffer */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* File ID */
+ hid_t did; /* Dataset ID */
+ hid_t dcpl_id; /* Dataset creation property list ID */
+ hid_t sid; /* File dataspace ID */
+ hid_t mem_sid; /* Memory dataspace ID */
+ hsize_t dims[] = {6, 12}; /* Dataspace dimensions */
+ hsize_t chunk_dims[] = {2, 2}; /* Chunk dimensions */
+ hsize_t mem_dims[] = {32}; /* Memory dataspace dimensions */
+ hsize_t start[2]; /* Hyperslab start */
+ hsize_t stride[2]; /* Hyperslab stride */
+ hsize_t count[2]; /* Hyperslab block count */
+ hsize_t block[2]; /* Hyperslab block size */
+ unsigned char wbuf[72]; /* Write buffer */
+ unsigned char rbuf[32]; /* Read buffer */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing Irregular Hyperslab I/O\n"));
@@ -14856,7 +14957,7 @@ test_irreg_io(void)
CHECK(did, FAIL, "H5Dcreate2");
/* Initialize the write buffer */
- for(u = 0; u < 72; u++)
+ for (u = 0; u < 72; u++)
wbuf[u] = (unsigned char)u;
/* Write entire dataset to disk */
@@ -14872,18 +14973,26 @@ test_irreg_io(void)
CHECK(mem_sid, FAIL, "H5Screate_simple");
/* Select 'L'-shaped region within dataset */
- start[0] = 0; start[1] = 10;
- stride[0] = 1; stride[1] = 1;
- count[0] = 4; count[1] = 2;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 10;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 4;
+ count[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 4; start[1] = 0;
- stride[0] = 1; stride[1] = 1;
- count[0] = 2; count[1] = 12;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
+ start[0] = 4;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 2;
+ count[1] = 12;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Reset the buffer */
@@ -14893,7 +15002,6 @@ test_irreg_io(void)
ret = H5Dread(did, H5T_NATIVE_UCHAR, mem_sid, sid, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
-
/* Close everything */
ret = H5Sclose(mem_sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -14903,7 +15011,7 @@ test_irreg_io(void)
CHECK(ret, FAIL, "H5Dclose");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_irreg_io() */
+} /* test_irreg_io() */
/****************************************************************
**
@@ -14913,22 +15021,22 @@ test_irreg_io(void)
static void
test_sel_iter(void)
{
- hid_t sid; /* Dataspace ID */
- hid_t iter_id; /* Dataspace selection iterator ID */
- hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */
- hsize_t coord1[POINT1_NPOINTS][2]; /* Coordinates for point selection */
- hsize_t start[2]; /* Hyperslab start */
- hsize_t stride[2]; /* Hyperslab stride */
- hsize_t count[2]; /* Hyperslab block count */
- hsize_t block[2]; /* Hyperslab block size */
- size_t nseq; /* # of sequences retrieved */
- size_t nbytes; /* # of bytes retrieved */
- hsize_t off[SEL_ITER_MAX_SEQ]; /* Offsets for retrieved sequences */
- size_t len[SEL_ITER_MAX_SEQ]; /* Lengths for retrieved sequences */
- H5S_sel_type sel_type; /* Selection type */
- unsigned sel_share; /* Whether to share selection with dataspace */
- unsigned sel_iter_flags; /* Flags for selection iterator creation */
- herr_t ret; /* Generic return value */
+ hid_t sid; /* Dataspace ID */
+ hid_t iter_id; /* Dataspace selection iterator ID */
+ hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */
+ hsize_t coord1[POINT1_NPOINTS][2]; /* Coordinates for point selection */
+ hsize_t start[2]; /* Hyperslab start */
+ hsize_t stride[2]; /* Hyperslab stride */
+ hsize_t count[2]; /* Hyperslab block count */
+ hsize_t block[2]; /* Hyperslab block size */
+ size_t nseq; /* # of sequences retrieved */
+ size_t nbytes; /* # of bytes retrieved */
+ hsize_t off[SEL_ITER_MAX_SEQ]; /* Offsets for retrieved sequences */
+ size_t len[SEL_ITER_MAX_SEQ]; /* Lengths for retrieved sequences */
+ H5S_sel_type sel_type; /* Selection type */
+ unsigned sel_share; /* Whether to share selection with dataspace */
+ unsigned sel_iter_flags; /* Flags for selection iterator creation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing Dataspace Selection Iterators\n"));
@@ -14937,36 +15045,44 @@ test_sel_iter(void)
sid = H5Screate_simple(2, dims1, NULL);
CHECK(sid, FAIL, "H5Screate_simple");
-
/* Try creating selection iterator object with bad parameters */
- H5E_BEGIN_TRY { /* Bad dataspace ID */
+ H5E_BEGIN_TRY
+ { /* Bad dataspace ID */
iter_id = H5Ssel_iter_create(H5I_INVALID_HID, (size_t)1, (unsigned)0);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(iter_id, FAIL, "H5Ssel_iter_create");
- H5E_BEGIN_TRY { /* Bad element size */
+ H5E_BEGIN_TRY
+ { /* Bad element size */
iter_id = H5Ssel_iter_create(sid, (size_t)0, (unsigned)0);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(iter_id, FAIL, "H5Ssel_iter_create");
- H5E_BEGIN_TRY { /* Bad flag(s) */
+ H5E_BEGIN_TRY
+ { /* Bad flag(s) */
iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)0xffff);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(iter_id, FAIL, "H5Ssel_iter_create");
/* Try closing selection iterator, with bad parameters */
- H5E_BEGIN_TRY { /* Invalid ID */
+ H5E_BEGIN_TRY
+ { /* Invalid ID */
ret = H5Ssel_iter_close(H5I_INVALID_HID);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_close");
- H5E_BEGIN_TRY { /* Not a selection iterator ID */
+ H5E_BEGIN_TRY
+ { /* Not a selection iterator ID */
ret = H5Ssel_iter_close(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_close");
-
/* Try with no selection sharing, and with sharing */
- for(sel_share = 0; sel_share < 2; sel_share++) {
+ for (sel_share = 0; sel_share < 2; sel_share++) {
/* Set selection iterator sharing flags */
- if(sel_share)
+ if (sel_share)
sel_iter_flags = H5S_SEL_ITER_SHARE_WITH_DATASPACE;
else
sel_iter_flags = 0;
@@ -14980,88 +15096,111 @@ test_sel_iter(void)
CHECK(ret, FAIL, "H5Ssel_iter_close");
/* Try closing selection iterator twice */
- H5E_BEGIN_TRY { /* Invalid ID */
+ H5E_BEGIN_TRY
+ { /* Invalid ID */
ret = H5Ssel_iter_close(iter_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_close");
-
/* Create selection iterator object */
iter_id = H5Ssel_iter_create(sid, (size_t)1, (unsigned)sel_iter_flags);
CHECK(iter_id, FAIL, "H5Ssel_iter_create");
/* Try resetting selection iterator with bad parameters */
- H5E_BEGIN_TRY {
- ret = H5Ssel_iter_reset(H5I_INVALID_HID, sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Ssel_iter_reset(H5I_INVALID_HID, sid); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_reset");
- H5E_BEGIN_TRY {
- ret = H5Ssel_iter_reset(iter_id, H5I_INVALID_HID);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Ssel_iter_reset(iter_id, H5I_INVALID_HID); }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_reset");
/* Try retrieving sequences, with bad parameters */
- H5E_BEGIN_TRY { /* Invalid ID */
+ H5E_BEGIN_TRY
+ { /* Invalid ID */
ret = H5Ssel_iter_get_seq_list(H5I_INVALID_HID, (size_t)1, (size_t)1, &nseq, &nbytes, off, len);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
- H5E_BEGIN_TRY { /* Invalid nseq pointer */
+ H5E_BEGIN_TRY
+ { /* Invalid nseq pointer */
ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, NULL, &nbytes, off, len);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
- H5E_BEGIN_TRY { /* Invalid nbytes pointer */
+ H5E_BEGIN_TRY
+ { /* Invalid nbytes pointer */
ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, &nseq, NULL, off, len);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
- H5E_BEGIN_TRY { /* Invalid offset array */
+ H5E_BEGIN_TRY
+ { /* Invalid offset array */
ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, &nseq, &nbytes, NULL, len);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
- H5E_BEGIN_TRY { /* Invalid length array */
+ H5E_BEGIN_TRY
+ { /* Invalid length array */
ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)1, (size_t)1, &nseq, &nbytes, off, NULL);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(ret, FAIL, "H5Ssel_iter_get_seq_list");
/* Close selection iterator */
ret = H5Ssel_iter_close(iter_id);
CHECK(ret, FAIL, "H5Ssel_iter_close");
-
/* Test iterators on various basic selection types */
- for(sel_type = H5S_SEL_NONE; sel_type <= H5S_SEL_ALL; sel_type = (H5S_sel_type)(sel_type + 1)) {
- switch(sel_type) {
- case H5S_SEL_NONE: /* "None" selection */
+ for (sel_type = H5S_SEL_NONE; sel_type <= H5S_SEL_ALL; sel_type = (H5S_sel_type)(sel_type + 1)) {
+ switch (sel_type) {
+ case H5S_SEL_NONE: /* "None" selection */
ret = H5Sselect_none(sid);
CHECK(ret, FAIL, "H5Sselect_none");
break;
- case H5S_SEL_POINTS: /* Point selection */
+ case H5S_SEL_POINTS: /* Point selection */
/* Select sequence of ten points */
- coord1[0][0] = 0; coord1[0][1] = 9;
- coord1[1][0] = 1; coord1[1][1] = 2;
- coord1[2][0] = 2; coord1[2][1] = 4;
- coord1[3][0] = 0; coord1[3][1] = 6;
- coord1[4][0] = 1; coord1[4][1] = 8;
- coord1[5][0] = 2; coord1[5][1] = 10;
- coord1[6][0] = 0; coord1[6][1] = 11;
- coord1[7][0] = 1; coord1[7][1] = 4;
- coord1[8][0] = 2; coord1[8][1] = 1;
- coord1[9][0] = 0; coord1[9][1] = 3;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ coord1[0][0] = 0;
+ coord1[0][1] = 9;
+ coord1[1][0] = 1;
+ coord1[1][1] = 2;
+ coord1[2][0] = 2;
+ coord1[2][1] = 4;
+ coord1[3][0] = 0;
+ coord1[3][1] = 6;
+ coord1[4][0] = 1;
+ coord1[4][1] = 8;
+ coord1[5][0] = 2;
+ coord1[5][1] = 10;
+ coord1[6][0] = 0;
+ coord1[6][1] = 11;
+ coord1[7][0] = 1;
+ coord1[7][1] = 4;
+ coord1[8][0] = 2;
+ coord1[8][1] = 1;
+ coord1[9][0] = 0;
+ coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS,
+ (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
break;
- case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
/* Select regular hyperslab */
- start[0] = 3; start[1] = 0;
- stride[0] = 2; stride[1] = 2;
- count[0] = 2; count[1] = 5;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 3;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 2;
+ count[1] = 5;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
break;
- case H5S_SEL_ALL: /* "All" selection */
+ case H5S_SEL_ALL: /* "All" selection */
ret = H5Sselect_all(sid);
CHECK(ret, FAIL, "H5Sselect_all");
break;
@@ -15088,27 +15227,28 @@ test_sel_iter(void)
VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
/* Try retrieving all sequences */
- ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq,
+ &nbytes, off, len);
CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
/* Check results from retrieving sequence list */
- switch(sel_type) {
- case H5S_SEL_NONE: /* "None" selection */
+ switch (sel_type) {
+ case H5S_SEL_NONE: /* "None" selection */
VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
break;
- case H5S_SEL_POINTS: /* Point selection */
+ case H5S_SEL_POINTS: /* Point selection */
VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
break;
- case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
break;
- case H5S_SEL_ALL: /* "All" selection */
+ case H5S_SEL_ALL: /* "All" selection */
VERIFY(nseq, 1, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 72, "H5Ssel_iter_get_seq_list");
break;
@@ -15131,40 +15271,55 @@ test_sel_iter(void)
/* Test iterators on various basic selection types using
* H5Ssel_iter_reset instead of creating multiple iterators */
- for(sel_type = H5S_SEL_NONE; sel_type <= H5S_SEL_ALL; sel_type = (H5S_sel_type)(sel_type + 1)) {
- switch(sel_type) {
- case H5S_SEL_NONE: /* "None" selection */
+ for (sel_type = H5S_SEL_NONE; sel_type <= H5S_SEL_ALL; sel_type = (H5S_sel_type)(sel_type + 1)) {
+ switch (sel_type) {
+ case H5S_SEL_NONE: /* "None" selection */
ret = H5Sselect_none(sid);
CHECK(ret, FAIL, "H5Sselect_none");
break;
- case H5S_SEL_POINTS: /* Point selection */
+ case H5S_SEL_POINTS: /* Point selection */
/* Select sequence of ten points */
- coord1[0][0] = 0; coord1[0][1] = 9;
- coord1[1][0] = 1; coord1[1][1] = 2;
- coord1[2][0] = 2; coord1[2][1] = 4;
- coord1[3][0] = 0; coord1[3][1] = 6;
- coord1[4][0] = 1; coord1[4][1] = 8;
- coord1[5][0] = 2; coord1[5][1] = 10;
- coord1[6][0] = 0; coord1[6][1] = 11;
- coord1[7][0] = 1; coord1[7][1] = 4;
- coord1[8][0] = 2; coord1[8][1] = 1;
- coord1[9][0] = 0; coord1[9][1] = 3;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ coord1[0][0] = 0;
+ coord1[0][1] = 9;
+ coord1[1][0] = 1;
+ coord1[1][1] = 2;
+ coord1[2][0] = 2;
+ coord1[2][1] = 4;
+ coord1[3][0] = 0;
+ coord1[3][1] = 6;
+ coord1[4][0] = 1;
+ coord1[4][1] = 8;
+ coord1[5][0] = 2;
+ coord1[5][1] = 10;
+ coord1[6][0] = 0;
+ coord1[6][1] = 11;
+ coord1[7][0] = 1;
+ coord1[7][1] = 4;
+ coord1[8][0] = 2;
+ coord1[8][1] = 1;
+ coord1[9][0] = 0;
+ coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS,
+ (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
break;
- case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
/* Select regular hyperslab */
- start[0] = 3; start[1] = 0;
- stride[0] = 2; stride[1] = 2;
- count[0] = 2; count[1] = 5;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 3;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 2;
+ count[1] = 5;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
break;
- case H5S_SEL_ALL: /* "All" selection */
+ case H5S_SEL_ALL: /* "All" selection */
ret = H5Sselect_all(sid);
CHECK(ret, FAIL, "H5Sselect_all");
break;
@@ -15191,27 +15346,28 @@ test_sel_iter(void)
CHECK(ret, FAIL, "H5Ssel_iter_reset");
/* Try retrieving all sequences */
- ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq,
+ &nbytes, off, len);
CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
/* Check results from retrieving sequence list */
- switch(sel_type) {
- case H5S_SEL_NONE: /* "None" selection */
+ switch (sel_type) {
+ case H5S_SEL_NONE: /* "None" selection */
VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
break;
- case H5S_SEL_POINTS: /* Point selection */
+ case H5S_SEL_POINTS: /* Point selection */
VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
break;
- case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
break;
- case H5S_SEL_ALL: /* "All" selection */
+ case H5S_SEL_ALL: /* "All" selection */
VERIFY(nseq, 1, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 72, "H5Ssel_iter_get_seq_list");
break;
@@ -15228,27 +15384,28 @@ test_sel_iter(void)
CHECK(ret, FAIL, "H5Ssel_iter_reset");
/* Try retrieving all sequences again */
- ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq,
+ &nbytes, off, len);
CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
/* Check results from retrieving sequence list */
- switch(sel_type) {
- case H5S_SEL_NONE: /* "None" selection */
+ switch (sel_type) {
+ case H5S_SEL_NONE: /* "None" selection */
VERIFY(nseq, 0, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 0, "H5Ssel_iter_get_seq_list");
break;
- case H5S_SEL_POINTS: /* Point selection */
+ case H5S_SEL_POINTS: /* Point selection */
VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
break;
- case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection */
VERIFY(nseq, 10, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
break;
- case H5S_SEL_ALL: /* "All" selection */
+ case H5S_SEL_ALL: /* "All" selection */
VERIFY(nseq, 1, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 72, "H5Ssel_iter_get_seq_list");
break;
@@ -15270,16 +15427,26 @@ test_sel_iter(void)
CHECK(ret, FAIL, "H5Ssel_iter_close");
/* Point selection which will merge into smaller # of sequences */
- coord1[0][0] = 0; coord1[0][1] = 9;
- coord1[1][0] = 0; coord1[1][1] = 10;
- coord1[2][0] = 0; coord1[2][1] = 11;
- coord1[3][0] = 0; coord1[3][1] = 6;
- coord1[4][0] = 1; coord1[4][1] = 8;
- coord1[5][0] = 2; coord1[5][1] = 10;
- coord1[6][0] = 0; coord1[6][1] = 11;
- coord1[7][0] = 1; coord1[7][1] = 4;
- coord1[8][0] = 1; coord1[8][1] = 5;
- coord1[9][0] = 1; coord1[9][1] = 6;
+ coord1[0][0] = 0;
+ coord1[0][1] = 9;
+ coord1[1][0] = 0;
+ coord1[1][1] = 10;
+ coord1[2][0] = 0;
+ coord1[2][1] = 11;
+ coord1[3][0] = 0;
+ coord1[3][1] = 6;
+ coord1[4][0] = 1;
+ coord1[4][1] = 8;
+ coord1[5][0] = 2;
+ coord1[5][1] = 10;
+ coord1[6][0] = 0;
+ coord1[6][1] = 11;
+ coord1[7][0] = 1;
+ coord1[7][1] = 4;
+ coord1[8][0] = 1;
+ coord1[8][1] = 5;
+ coord1[9][0] = 1;
+ coord1[9][1] = 6;
ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
CHECK(ret, FAIL, "H5Sselect_elements");
@@ -15288,7 +15455,8 @@ test_sel_iter(void)
CHECK(iter_id, FAIL, "H5Ssel_iter_create");
/* Try retrieving all sequences */
- ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq,
+ &nbytes, off, len);
CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
@@ -15298,7 +15466,8 @@ test_sel_iter(void)
CHECK(ret, FAIL, "H5Ssel_iter_reset");
/* Try retrieving all sequences again */
- ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq,
+ &nbytes, off, len);
CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 10, "H5Ssel_iter_get_seq_list");
@@ -15307,20 +15476,27 @@ test_sel_iter(void)
ret = H5Ssel_iter_close(iter_id);
CHECK(ret, FAIL, "H5Ssel_iter_close");
-
/* Select irregular hyperslab, which will merge into smaller # of sequences */
- start[0] = 3; start[1] = 0;
- stride[0] = 2; stride[1] = 2;
- count[0] = 2; count[1] = 5;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 3;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 2;
+ count[1] = 5;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- start[0] = 3; start[1] = 3;
- stride[0] = 2; stride[1] = 2;
- count[0] = 2; count[1] = 5;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
+ start[0] = 3;
+ start[1] = 3;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 2;
+ count[1] = 5;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create selection iterator object */
@@ -15328,7 +15504,8 @@ test_sel_iter(void)
CHECK(iter_id, FAIL, "H5Ssel_iter_create");
/* Try retrieving all sequences */
- ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq,
+ &nbytes, off, len);
CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 20, "H5Ssel_iter_get_seq_list");
@@ -15338,7 +15515,8 @@ test_sel_iter(void)
CHECK(ret, FAIL, "H5Ssel_iter_reset");
/* Try retrieving all sequences again */
- ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq, &nbytes, off, len);
+ ret = H5Ssel_iter_get_seq_list(iter_id, (size_t)SEL_ITER_MAX_SEQ, (size_t)(1024 * 1024), &nseq,
+ &nbytes, off, len);
CHECK(ret, FAIL, "H5Ssel_iter_get_seq_list");
VERIFY(nseq, 6, "H5Ssel_iter_get_seq_list");
VERIFY(nbytes, 20, "H5Ssel_iter_get_seq_list");
@@ -15352,7 +15530,7 @@ test_sel_iter(void)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_sel_iter() */
+} /* test_sel_iter() */
/****************************************************************
**
@@ -15363,20 +15541,20 @@ test_sel_iter(void)
static void
test_select_intersect_block(void)
{
- hid_t sid; /* Dataspace ID */
- hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */
- hsize_t block_start[] = {1, 3}; /* Start offset for block */
- hsize_t block_end[] = {2, 5}; /* End offset for block */
- hsize_t block_end2[] = {0, 5}; /* Bad end offset for block */
- hsize_t block_end3[] = {2, 2}; /* Another bad end offset for block */
- hsize_t block_end4[] = {1, 3}; /* End offset that makes a single element block */
- hsize_t coord[10][2]; /* Coordinates for point selection */
- hsize_t start[2]; /* Starting location of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Element count of hyperslab */
- hsize_t block[2]; /* Block size of hyperslab */
- htri_t status; /* Intersection status */
- herr_t ret; /* Generic return value */
+ hid_t sid; /* Dataspace ID */
+ hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */
+ hsize_t block_start[] = {1, 3}; /* Start offset for block */
+ hsize_t block_end[] = {2, 5}; /* End offset for block */
+ hsize_t block_end2[] = {0, 5}; /* Bad end offset for block */
+ hsize_t block_end3[] = {2, 2}; /* Another bad end offset for block */
+ hsize_t block_end4[] = {1, 3}; /* End offset that makes a single element block */
+ hsize_t coord[10][2]; /* Coordinates for point selection */
+ hsize_t start[2]; /* Starting location of hyperslab */
+ hsize_t stride[2]; /* Stride of hyperslab */
+ hsize_t count[2]; /* Element count of hyperslab */
+ hsize_t block[2]; /* Block size of hyperslab */
+ htri_t status; /* Intersection status */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing Dataspace Selection Block Intersection\n"));
@@ -15385,30 +15563,38 @@ test_select_intersect_block(void)
sid = H5Screate_simple(2, dims1, NULL);
CHECK(sid, FAIL, "H5Screate_simple");
-
/* Try intersection calls with bad parameters */
- H5E_BEGIN_TRY { /* Bad dataspace ID */
+ H5E_BEGIN_TRY
+ { /* Bad dataspace ID */
status = H5Sselect_intersect_block(H5I_INVALID_HID, block_start, block_end);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(status, FAIL, "H5Sselect_intersect_block");
- H5E_BEGIN_TRY { /* Bad start pointer */
+ H5E_BEGIN_TRY
+ { /* Bad start pointer */
status = H5Sselect_intersect_block(sid, NULL, block_end);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(status, FAIL, "H5Sselect_intersect_block");
- H5E_BEGIN_TRY { /* Bad end pointer */
+ H5E_BEGIN_TRY
+ { /* Bad end pointer */
status = H5Sselect_intersect_block(sid, block_start, NULL);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(status, FAIL, "H5Sselect_intersect_block");
- H5E_BEGIN_TRY { /* Invalid block */
+ H5E_BEGIN_TRY
+ { /* Invalid block */
status = H5Sselect_intersect_block(sid, block_start, block_end2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(status, FAIL, "H5Sselect_intersect_block");
- H5E_BEGIN_TRY { /* Another invalid block */
+ H5E_BEGIN_TRY
+ { /* Another invalid block */
status = H5Sselect_intersect_block(sid, block_start, block_end3);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
VERIFY(status, FAIL, "H5Sselect_intersect_block");
-
/* Set selection to 'none' */
ret = H5Sselect_none(sid);
CHECK(ret, FAIL, "H5Sselect_none");
@@ -15417,7 +15603,6 @@ test_select_intersect_block(void)
status = H5Sselect_intersect_block(sid, block_start, block_end);
VERIFY(status, FALSE, "H5Sselect_intersect_block");
-
/* Set selection to 'all' */
ret = H5Sselect_all(sid);
CHECK(ret, FAIL, "H5Sselect_all");
@@ -15426,19 +15611,28 @@ test_select_intersect_block(void)
status = H5Sselect_intersect_block(sid, block_start, block_end);
VERIFY(status, TRUE, "H5Sselect_intersect_block");
-
/* Select sequence of ten points */
- coord[0][0] = 0; coord[0][1] = 10;
- coord[1][0] = 1; coord[1][1] = 2;
- coord[2][0] = 2; coord[2][1] = 4;
- coord[3][0] = 0; coord[3][1] = 6;
- coord[4][0] = 1; coord[4][1] = 8;
- coord[5][0] = 2; coord[5][1] = 11;
- coord[6][0] = 0; coord[6][1] = 4;
- coord[7][0] = 1; coord[7][1] = 0;
- coord[8][0] = 2; coord[8][1] = 1;
- coord[9][0] = 0; coord[9][1] = 3;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)10, (const hsize_t *)coord);
+ coord[0][0] = 0;
+ coord[0][1] = 10;
+ coord[1][0] = 1;
+ coord[1][1] = 2;
+ coord[2][0] = 2;
+ coord[2][1] = 4;
+ coord[3][0] = 0;
+ coord[3][1] = 6;
+ coord[4][0] = 1;
+ coord[4][1] = 8;
+ coord[5][0] = 2;
+ coord[5][1] = 11;
+ coord[6][0] = 0;
+ coord[6][1] = 4;
+ coord[7][0] = 1;
+ coord[7][1] = 0;
+ coord[8][0] = 2;
+ coord[8][1] = 1;
+ coord[9][0] = 0;
+ coord[9][1] = 3;
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)10, (const hsize_t *)coord);
CHECK(ret, FAIL, "H5Sselect_elements");
/* Test block intersection with 'point' selection */
@@ -15447,13 +15641,16 @@ test_select_intersect_block(void)
status = H5Sselect_intersect_block(sid, block_start, block_end4);
VERIFY(status, FALSE, "H5Sselect_intersect_block");
-
/* Select single 4x6 hyperslab block at (2,1) */
- start[0] = 2; start[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 4; count[1] = 6;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 2;
+ start[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 4;
+ count[1] = 6;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Test block intersection with single 'hyperslab' selection */
@@ -15463,11 +15660,15 @@ test_select_intersect_block(void)
VERIFY(status, FALSE, "H5Sselect_intersect_block");
/* 'OR' another hyperslab block in, making an irregular hyperslab selection */
- start[0] = 3; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 4; count[1] = 6;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
+ start[0] = 3;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 4;
+ count[1] = 6;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Test block intersection with 'hyperslab' selection */
@@ -15477,11 +15678,15 @@ test_select_intersect_block(void)
VERIFY(status, FALSE, "H5Sselect_intersect_block");
/* Select regular, strided hyperslab selection */
- start[0] = 2; start[1] = 1;
- stride[0] = 2; stride[1] = 2;
- count[0] = 2; count[1] = 4;
- block[0] = 1; block[1] = 1;
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 2;
+ start[1] = 1;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 2;
+ count[1] = 4;
+ block[0] = 1;
+ block[1] = 1;
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Test block intersection with single 'hyperslab' selection */
@@ -15490,13 +15695,11 @@ test_select_intersect_block(void)
status = H5Sselect_intersect_block(sid, block_start, block_end4);
VERIFY(status, FALSE, "H5Sselect_intersect_block");
-
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-} /* test_select_intersect_block() */
+} /* test_select_intersect_block() */
-
/****************************************************************
**
** test_hyper_io_1d():
@@ -15511,20 +15714,20 @@ test_select_intersect_block(void)
static void
test_hyper_io_1d(void)
{
- hid_t fid; /* File ID */
- hid_t did; /* Dataset ID */
- hid_t sid, mid; /* Dataspace IDs */
- hid_t dcpl; /* Dataset creation property list ID */
- hsize_t dims[1], maxdims[1], dimsm[1]; /* Dataset dimension sizes */
- hsize_t chunk_dims[1]; /* Chunk dimension size */
- hsize_t offset[1]; /* Starting offset for hyperslab */
- hsize_t stride[1]; /* Distance between blocks in the hyperslab selection */
- hsize_t count[1]; /* # of blocks in the the hyperslab selection */
- hsize_t block[1]; /* Size of block in the hyperslab selection */
- unsigned int wdata[CHUNKSZ]; /* Data to be written */
- unsigned int rdata[NUM_ELEMENTS/10]; /* Data to be read */
- herr_t ret; /* Generic return value */
- unsigned i; /* Local index variable */
+ hid_t fid; /* File ID */
+ hid_t did; /* Dataset ID */
+ hid_t sid, mid; /* Dataspace IDs */
+ hid_t dcpl; /* Dataset creation property list ID */
+ hsize_t dims[1], maxdims[1], dimsm[1]; /* Dataset dimension sizes */
+ hsize_t chunk_dims[1]; /* Chunk dimension size */
+ hsize_t offset[1]; /* Starting offset for hyperslab */
+ hsize_t stride[1]; /* Distance between blocks in the hyperslab selection */
+ hsize_t count[1]; /* # of blocks in the the hyperslab selection */
+ hsize_t block[1]; /* Size of block in the hyperslab selection */
+ unsigned int wdata[CHUNKSZ]; /* Data to be written */
+ unsigned int rdata[NUM_ELEMENTS / 10]; /* Data to be read */
+ herr_t ret; /* Generic return value */
+ unsigned i; /* Local index variable */
/* Output message about test being performed */
MESSAGE(6, ("Testing Hyperslab I/O for 1-d single block memory space\n"));
@@ -15537,14 +15740,14 @@ test_hyper_io_1d(void)
CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Create file dataspace */
- dims[0] = CHUNKSZ;
+ dims[0] = CHUNKSZ;
maxdims[0] = H5S_UNLIMITED;
- sid = H5Screate_simple(RANK, dims, maxdims);
+ sid = H5Screate_simple(RANK, dims, maxdims);
CHECK(sid, H5I_INVALID_HID, "H5Pcreate");
/* Create memory dataspace */
dimsm[0] = CHUNKSZ;
- mid = H5Screate_simple(RANK, dimsm, NULL);
+ mid = H5Screate_simple(RANK, dimsm, NULL);
CHECK(mid, H5I_INVALID_HID, "H5Pcreate");
/* Set up to create a chunked dataset */
@@ -15552,7 +15755,7 @@ test_hyper_io_1d(void)
CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate");
chunk_dims[0] = CHUNKSZ;
- ret = H5Pset_chunk(dcpl, RANK, chunk_dims);
+ ret = H5Pset_chunk(dcpl, RANK, chunk_dims);
CHECK(ret, FAIL, "H5Pset_chunk");
/* Create a chunked dataset */
@@ -15562,8 +15765,8 @@ test_hyper_io_1d(void)
/* Set up hyperslab selection for file dataspace */
offset[0] = 0;
stride[0] = 1;
- count[0] = 1;
- block[0] = CHUNKSZ;
+ count[0] = 1;
+ block[0] = CHUNKSZ;
/* Write to each chunk in the dataset */
for (i = 0; i < NUMCHUNKS; i++) {
@@ -15576,10 +15779,10 @@ test_hyper_io_1d(void)
CHECK(ret, FAIL, "H5Dwrite");
/* Extend the dataset's dataspace */
- if(i < (NUMCHUNKS - 1)) {
+ if (i < (NUMCHUNKS - 1)) {
offset[0] = offset[0] + CHUNKSZ;
- dims[0] = dims[0] + CHUNKSZ;
- ret = H5Dset_extent(did, dims);
+ dims[0] = dims[0] + CHUNKSZ;
+ ret = H5Dset_extent(did, dims);
CHECK(ret, FAIL, "H5Dset_extent");
/* Get the dataset's current dataspace */
@@ -15611,8 +15814,8 @@ test_hyper_io_1d(void)
/* Set up to read every 10th element in file dataspace */
offset[0] = 1;
stride[0] = 10;
- count[0] = NUM_ELEMENTS/10;
- block[0] = 1;
+ count[0] = NUM_ELEMENTS / 10;
+ block[0] = 1;
/* Get the dataset's dataspace */
sid = H5Dget_space(did);
@@ -15622,7 +15825,7 @@ test_hyper_io_1d(void)
/* Set up contiguous memory dataspace for the selected elements */
dimsm[0] = count[0];
- mid = H5Screate_simple(RANK, dimsm, NULL);
+ mid = H5Screate_simple(RANK, dimsm, NULL);
CHECK(mid, H5I_INVALID_HID, "H5Screate_simple");
/* Read all the selected 10th elements in the dataset into "rdata" */
@@ -15630,9 +15833,9 @@ test_hyper_io_1d(void)
CHECK(ret, FAIL, "H5Dread");
/* Verify data read is correct */
- for(i = 0; i < 6; i += 2) {
+ for (i = 0; i < 6; i += 2) {
VERIFY(rdata[i], 1, "H5Dread\n");
- VERIFY(rdata[i+1], 11, "H5Dread\n");
+ VERIFY(rdata[i + 1], 11, "H5Dread\n");
}
/* Closing */
@@ -15645,9 +15848,8 @@ test_hyper_io_1d(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_hyper_io_1d() */
+} /* test_hyper_io_1d() */
-
/****************************************************************
**
** test_h5s_set_extent_none:
@@ -15658,18 +15860,18 @@ test_hyper_io_1d(void)
static void
test_h5s_set_extent_none(void)
{
- hid_t sid = H5I_INVALID_HID;
- hid_t dst_sid = H5I_INVALID_HID;
- hid_t null_sid = H5I_INVALID_HID;
- int rank = 1;
- hsize_t current_dims = 123;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t dst_sid = H5I_INVALID_HID;
+ hid_t null_sid = H5I_INVALID_HID;
+ int rank = 1;
+ hsize_t current_dims = 123;
H5S_class_t cls;
- int out_rank;
- hsize_t out_dims;
- hsize_t out_maxdims;
- hssize_t out_points;
- htri_t equal;
- herr_t ret;
+ int out_rank;
+ hsize_t out_dims;
+ hsize_t out_maxdims;
+ hssize_t out_points;
+ htri_t equal;
+ herr_t ret;
/* Specific values here don't matter as we're just going to reset */
sid = H5Screate_simple(rank, &current_dims, NULL);
@@ -15718,7 +15920,6 @@ test_h5s_set_extent_none(void)
} /* test_h5s_set_extent_none() */
-
/****************************************************************
**
** test_select(): Main H5S selection testing routine.
@@ -15727,14 +15928,14 @@ test_h5s_set_extent_none(void)
void
test_select(void)
{
- hid_t plist_id; /* Property list for reading random hyperslabs */
- hid_t fapl; /* Property list accessing the file */
- int mdc_nelmts; /* Metadata number of elements */
- size_t rdcc_nelmts; /* Raw data number of elements */
- size_t rdcc_nbytes; /* Raw data number of bytes */
- double rdcc_w0; /* Raw data write percentage */
+ hid_t plist_id; /* Property list for reading random hyperslabs */
+ hid_t fapl; /* Property list accessing the file */
+ int mdc_nelmts; /* Metadata number of elements */
+ size_t rdcc_nelmts; /* Raw data number of elements */
+ size_t rdcc_nbytes; /* Raw data number of bytes */
+ double rdcc_w0; /* Raw data write percentage */
hssize_t offset[SPACE7_RANK] = {1, 1}; /* Offset for testing selection offsets */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Selections\n"));
@@ -15748,31 +15949,39 @@ test_select(void)
CHECK(ret, FAIL, "H5Pset_buffer");
/* These next tests use the same file */
- test_select_hyper(H5P_DEFAULT); /* Test basic H5S hyperslab selection code */
- test_select_hyper(plist_id); /* Test basic H5S hyperslab selection code */
- test_select_point(H5P_DEFAULT); /* Test basic H5S element selection code, also tests appending to existing element selections */
- test_select_point(plist_id); /* Test basic H5S element selection code, also tests appending to existing element selections */
- test_select_all(H5P_DEFAULT); /* Test basic all & none selection code */
- test_select_all(plist_id); /* Test basic all & none selection code */
- test_select_all_hyper(H5P_DEFAULT); /* Test basic all & none selection code */
- test_select_all_hyper(plist_id); /* Test basic all & none selection code */
+ test_select_hyper(H5P_DEFAULT); /* Test basic H5S hyperslab selection code */
+ test_select_hyper(plist_id); /* Test basic H5S hyperslab selection code */
+ test_select_point(H5P_DEFAULT); /* Test basic H5S element selection code, also tests appending to existing
+ element selections */
+ test_select_point(plist_id); /* Test basic H5S element selection code, also tests appending to existing
+ element selections */
+ test_select_all(H5P_DEFAULT); /* Test basic all & none selection code */
+ test_select_all(plist_id); /* Test basic all & none selection code */
+ test_select_all_hyper(H5P_DEFAULT); /* Test basic all & none selection code */
+ test_select_all_hyper(plist_id); /* Test basic all & none selection code */
/* These next tests use the same file */
- test_select_combo(); /* Test combined hyperslab & element selection code */
+ test_select_combo(); /* Test combined hyperslab & element selection code */
test_select_hyper_stride(H5P_DEFAULT); /* Test strided hyperslab selection code */
- test_select_hyper_stride(plist_id); /* Test strided hyperslab selection code */
+ test_select_hyper_stride(plist_id); /* Test strided hyperslab selection code */
test_select_hyper_contig(H5T_STD_U16LE, H5P_DEFAULT); /* Test contiguous hyperslab selection code */
- test_select_hyper_contig(H5T_STD_U16LE, plist_id); /* Test contiguous hyperslab selection code */
+ test_select_hyper_contig(H5T_STD_U16LE, plist_id); /* Test contiguous hyperslab selection code */
test_select_hyper_contig(H5T_STD_U16BE, H5P_DEFAULT); /* Test contiguous hyperslab selection code */
- test_select_hyper_contig(H5T_STD_U16BE, plist_id); /* Test contiguous hyperslab selection code */
- test_select_hyper_contig2(H5T_STD_U16LE, H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */
+ test_select_hyper_contig(H5T_STD_U16BE, plist_id); /* Test contiguous hyperslab selection code */
+ test_select_hyper_contig2(H5T_STD_U16LE,
+ H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */
test_select_hyper_contig2(H5T_STD_U16LE, plist_id); /* Test more contiguous hyperslab selection cases */
- test_select_hyper_contig2(H5T_STD_U16BE, H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */
+ test_select_hyper_contig2(H5T_STD_U16BE,
+ H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */
test_select_hyper_contig2(H5T_STD_U16BE, plist_id); /* Test more contiguous hyperslab selection cases */
- test_select_hyper_contig3(H5T_STD_U16LE, H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */
- test_select_hyper_contig3(H5T_STD_U16LE, plist_id); /* Test yet more contiguous hyperslab selection cases */
- test_select_hyper_contig3(H5T_STD_U16BE, H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */
- test_select_hyper_contig3(H5T_STD_U16BE, plist_id); /* Test yet more contiguous hyperslab selection cases */
+ test_select_hyper_contig3(H5T_STD_U16LE,
+ H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */
+ test_select_hyper_contig3(H5T_STD_U16LE,
+ plist_id); /* Test yet more contiguous hyperslab selection cases */
+ test_select_hyper_contig3(H5T_STD_U16BE,
+ H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */
+ test_select_hyper_contig3(H5T_STD_U16BE,
+ plist_id); /* Test yet more contiguous hyperslab selection cases */
test_select_hyper_contig_dr(H5T_STD_U16LE, H5P_DEFAULT);
test_select_hyper_contig_dr(H5T_STD_U16LE, plist_id);
test_select_hyper_contig_dr(H5T_STD_U16BE, H5P_DEFAULT);
@@ -15781,28 +15990,28 @@ test_select(void)
test_select_hyper_checker_board_dr(H5T_STD_U16LE, plist_id);
test_select_hyper_checker_board_dr(H5T_STD_U16BE, H5P_DEFAULT);
test_select_hyper_checker_board_dr(H5T_STD_U16BE, plist_id);
- test_select_hyper_copy(); /* Test hyperslab selection copying code */
- test_select_point_copy(); /* Test point selection copying code */
- test_select_hyper_offset(); /* Test selection offset code with hyperslabs */
- test_select_hyper_offset2();/* Test more selection offset code with hyperslabs */
- test_select_point_offset(); /* Test selection offset code with elements */
- test_select_hyper_union(); /* Test hyperslab union code */
+ test_select_hyper_copy(); /* Test hyperslab selection copying code */
+ test_select_point_copy(); /* Test point selection copying code */
+ test_select_hyper_offset(); /* Test selection offset code with hyperslabs */
+ test_select_hyper_offset2(); /* Test more selection offset code with hyperslabs */
+ test_select_point_offset(); /* Test selection offset code with elements */
+ test_select_hyper_union(); /* Test hyperslab union code */
/* Fancy hyperslab API tests */
- test_select_hyper_union_stagger(); /* Test hyperslab union code for staggered slabs */
- test_select_hyper_union_3d(); /* Test hyperslab union code for 3-D dataset */
+ test_select_hyper_union_stagger(); /* Test hyperslab union code for staggered slabs */
+ test_select_hyper_union_3d(); /* Test hyperslab union code for 3-D dataset */
test_select_hyper_valid_combination(); /* Test different input combinations */
- test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */
- test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */
+ test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */
+ test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */
test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */
test_select_hyper_nota_2d(); /* Test hyperslab NOTA code for 2-D dataset */
/* test the random hyperslab I/O with the default property list for reading */
- test_select_hyper_union_random_5d(H5P_DEFAULT); /* Test hyperslab union code for random 5-D hyperslabs */
+ test_select_hyper_union_random_5d(H5P_DEFAULT); /* Test hyperslab union code for random 5-D hyperslabs */
/* test random hyperslab I/O with a small buffer for reads */
- test_select_hyper_union_random_5d(plist_id); /* Test hyperslab union code for random 5-D hyperslabs */
+ test_select_hyper_union_random_5d(plist_id); /* Test hyperslab union code for random 5-D hyperslabs */
/* Create a dataset transfer property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);
@@ -15910,8 +16119,7 @@ test_select(void)
*/
test_h5s_set_extent_none();
-} /* test_select() */
-
+} /* test_select() */
/*-------------------------------------------------------------------------
* Function: cleanup_select
@@ -15930,4 +16138,3 @@ cleanup_select(void)
{
HDremove(FILENAME);
}
-
diff --git a/test/tskiplist.c b/test/tskiplist.c
index 2806afe..9ad4ea4 100644
--- a/test/tskiplist.c
+++ b/test/tskiplist.c
@@ -33,21 +33,23 @@
#include "H5SLprivate.h"
/* The number of elements in testing arrays */
-#define NUM_ELEMS 1000
+#define NUM_ELEMS 1000
/* Random numbers */
static int *rand_num;
static int *sort_rand_num;
static int *rev_sort_rand_num;
-static int tst_sort(const void *i1, const void *i2)
+static int
+tst_sort(const void *i1, const void *i2)
{
- return(*(const int *)i1-*(const int *)i2);
+ return (*(const int *)i1 - *(const int *)i2);
}
-static int tst_rev_sort(const void *i1, const void *i2)
+static int
+tst_rev_sort(const void *i1, const void *i2)
{
- return(*(const int *)i2-*(const int *)i1);
+ return (*(const int *)i2 - *(const int *)i1);
}
/****************************************************************
@@ -59,10 +61,10 @@ static int tst_rev_sort(const void *i1, const void *i2)
static void
test_skiplist_init(void)
{
- time_t curr_time; /* Current time, for seeding random number generator */
- int new_val; /* New value to insert */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ int new_val; /* New value to insert */
unsigned found; /* Flag to indicate value was inserted already */
- size_t u,v; /* Local index variables */
+ size_t u, v; /* Local index variables */
/* Allocate arrays */
rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS);
@@ -77,7 +79,7 @@ test_skiplist_init(void)
HDsrandom((unsigned)curr_time);
/* Create randomized set of numbers */
- for(u = 0; u < NUM_ELEMS; u++) {
+ for (u = 0; u < NUM_ELEMS; u++) {
do {
/* Reset flag */
found = 0;
@@ -86,13 +88,13 @@ test_skiplist_init(void)
new_val = (int)(HDrandom() % 10001) - 5001;
/* Check if the value is already in the array */
- for(v = 0; v < u; v++)
- if(rand_num[v] == new_val)
+ for (v = 0; v < u; v++)
+ if (rand_num[v] == new_val)
found = 1;
- } while(found);
+ } while (found);
/* Set unique value in array */
- rand_num[u]=new_val;
+ rand_num[u] = new_val;
} /* end for */
/* Copy random values to sorted array */
@@ -117,8 +119,8 @@ test_skiplist_init(void)
static void
test_skiplist_create(void)
{
- H5SL_t *slist; /* Skip list created */
- herr_t ret; /* Generic return value */
+ H5SL_t *slist; /* Skip list created */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(6, ("Testing Creating & Closing Skip Lists\n"));
@@ -128,7 +130,7 @@ test_skiplist_create(void)
CHECK_PTR(slist, "H5SL_create");
/* Try closing the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_create() */
@@ -142,13 +144,13 @@ test_skiplist_create(void)
static void
test_skiplist_insert(void)
{
- H5SL_t *slist; /* Skip list created */
- int key, /* Key of item to insert */
- item; /* Item to insert */
- int search_key; /* Key of item to search for in skip list */
- int *found_item; /* Item found in skip list */
- size_t num; /* Number of elements in skip list */
- herr_t ret; /* Generic return value */
+ H5SL_t *slist; /* Skip list created */
+ int key, /* Key of item to insert */
+ item; /* Item to insert */
+ int search_key; /* Key of item to search for in skip list */
+ int * found_item; /* Item found in skip list */
+ size_t num; /* Number of elements in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Insertion Into Skip List\n"));
@@ -158,40 +160,41 @@ test_skiplist_insert(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Try searching for item in empty skip list */
- key=37;
- found_item=(int *)H5SL_search(slist,&key);
+ key = 37;
+ found_item = (int *)H5SL_search(slist, &key);
CHECK_PTR_NULL(found_item, "H5SL_search");
/* Insert an object into the skip list */
- key=2; item=10;
- ret=H5SL_insert(slist,&item,&key);
+ key = 2;
+ item = 10;
+ ret = H5SL_insert(slist, &item, &key);
CHECK(ret, FAIL, "H5SL_insert");
/* Check that the skip list has one element */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 1, "H5SL_count");
/* Search for the item just inserted */
- found_item=(int *)H5SL_search(slist,&key);
+ found_item = (int *)H5SL_search(slist, &key);
CHECK_PTR(found_item, "H5SL_search");
VERIFY(*found_item, item, "H5SL_search");
/* Search for an item not in list */
- search_key=37;
- found_item=(int *)H5SL_search(slist,&search_key);
+ search_key = 37;
+ found_item = (int *)H5SL_search(slist, &search_key);
CHECK_PTR_NULL(found_item, "H5SL_search");
/* Attempt to insert duplicate key (should fail) */
- search_key=2;
- ret=H5SL_insert(slist,&search_key,&search_key);
+ search_key = 2;
+ ret = H5SL_insert(slist, &search_key, &search_key);
VERIFY(ret, FAIL, "H5SL_insert");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_insert() */
@@ -206,10 +209,10 @@ static void
test_skiplist_insert_many(void)
{
H5SL_t *slist; /* Skip list created */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
- int *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
+ int * found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Insertion of Many Items Into Skip List\n"));
@@ -219,50 +222,50 @@ test_skiplist_insert_many(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert many objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, NUM_ELEMS, "H5SL_count");
/* Search for all objects in the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- found_item=(int *)H5SL_search(slist,&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ found_item = (int *)H5SL_search(slist, &rand_num[u]);
CHECK_PTR(found_item, "H5SL_search");
- VERIFY(*found_item,rand_num[u],"H5SL_search");
+ VERIFY(*found_item, rand_num[u], "H5SL_search");
} /* end for */
/* Release all the items from the list */
- ret=H5SL_release(slist);
+ ret = H5SL_release(slist);
CHECK(ret, FAIL, "H5SL_release");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert many objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, NUM_ELEMS, "H5SL_count");
/* Release all the items from the list */
- ret=H5SL_release(slist);
+ ret = H5SL_release(slist);
CHECK(ret, FAIL, "H5SL_release");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_insert_many() */
@@ -276,14 +279,14 @@ test_skiplist_insert_many(void)
static void
test_skiplist_remove(void)
{
- H5SL_t *slist; /* Skip list created */
- int key1, /* Key of 1st item to insert */
- key2, /* Key of 2nd item to insert */
- key3; /* Key of 3rd item to insert */
- int search_key; /* Key of item to search for in skip list */
- int *found_item; /* Item found in skip list */
- size_t num; /* Number of elements in skip list */
- herr_t ret; /* Generic return value */
+ H5SL_t *slist; /* Skip list created */
+ int key1, /* Key of 1st item to insert */
+ key2, /* Key of 2nd item to insert */
+ key3; /* Key of 3rd item to insert */
+ int search_key; /* Key of item to search for in skip list */
+ int * found_item; /* Item found in skip list */
+ size_t num; /* Number of elements in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Removal From Skip List\n"));
@@ -293,58 +296,58 @@ test_skiplist_remove(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Try removing an item in empty skip list */
- search_key=37;
- found_item=(int *)H5SL_remove(slist,&search_key);
+ search_key = 37;
+ found_item = (int *)H5SL_remove(slist, &search_key);
CHECK_PTR_NULL(found_item, "H5SL_remove");
/* Insert three objects into the skip list */
- key1=15;
- ret=H5SL_insert(slist,&key1,&key1);
+ key1 = 15;
+ ret = H5SL_insert(slist, &key1, &key1);
CHECK(ret, FAIL, "H5SL_insert");
- key2=10;
- ret=H5SL_insert(slist,&key2,&key2);
+ key2 = 10;
+ ret = H5SL_insert(slist, &key2, &key2);
CHECK(ret, FAIL, "H5SL_insert");
- key3=20;
- ret=H5SL_insert(slist,&key3,&key3);
+ key3 = 20;
+ ret = H5SL_insert(slist, &key3, &key3);
CHECK(ret, FAIL, "H5SL_insert");
/* Check that the skip list has three elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 3, "H5SL_count");
/* Try removing items from skip list */
- search_key=key1;
- found_item=(int *)H5SL_remove(slist,&search_key);
+ search_key = key1;
+ found_item = (int *)H5SL_remove(slist, &search_key);
CHECK_PTR(found_item, "H5SL_remove");
CHECK_PTR_EQ(found_item, &key1, "H5SL_remove");
- search_key=key2;
- found_item=(int *)H5SL_remove(slist,&search_key);
+ search_key = key2;
+ found_item = (int *)H5SL_remove(slist, &search_key);
CHECK_PTR(found_item, "H5SL_remove");
CHECK_PTR_EQ(found_item, &key2, "H5SL_remove");
- search_key=key3;
- found_item=(int *)H5SL_remove(slist,&search_key);
+ search_key = key3;
+ found_item = (int *)H5SL_remove(slist, &search_key);
CHECK_PTR(found_item, "H5SL_remove");
CHECK_PTR_EQ(found_item, &key3, "H5SL_remove");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Try removing items from empty skip list (after its been worked on) */
- search_key=key1;
- found_item=(int *)H5SL_remove(slist,&search_key);
+ search_key = key1;
+ found_item = (int *)H5SL_remove(slist, &search_key);
CHECK_PTR_NULL(found_item, "H5SL_remove");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_remove() */
@@ -359,10 +362,10 @@ static void
test_skiplist_remove_many(void)
{
H5SL_t *slist; /* Skip list created */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
- int *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
+ int * found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Removal of Many Items From Skip List\n"));
@@ -372,78 +375,80 @@ test_skiplist_remove_many(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert many objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, NUM_ELEMS, "H5SL_count");
/* Remove all objects from the skip list (in random order) */
- for(u=0; u<NUM_ELEMS; u++) {
- found_item=(int *)H5SL_remove(slist,&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ found_item = (int *)H5SL_remove(slist, &rand_num[u]);
CHECK_PTR(found_item, "H5SL_remove");
- VERIFY(*found_item,rand_num[u],"H5SL_remove");
+ VERIFY(*found_item, rand_num[u], "H5SL_remove");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
-/* Insert & remove again (in sorted order), to check that completely empty skip lists can be added again */
+ /* Insert & remove again (in sorted order), to check that completely empty skip lists can be added again
+ */
/* Insert many objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, NUM_ELEMS, "H5SL_count");
/* Remove all objects from the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- found_item=(int *)H5SL_remove(slist,&sort_rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ found_item = (int *)H5SL_remove(slist, &sort_rand_num[u]);
CHECK_PTR(found_item, "H5SL_remove");
- VERIFY(*found_item,sort_rand_num[u],"H5SL_remove");
+ VERIFY(*found_item, sort_rand_num[u], "H5SL_remove");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
-/* Insert & remove again (in reverse sorted order), to check that completely empty skip lists can be added again */
+ /* Insert & remove again (in reverse sorted order), to check that completely empty skip lists can be added
+ * again */
/* Insert many objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, NUM_ELEMS, "H5SL_count");
/* Remove all objects from the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- found_item=(int *)H5SL_remove(slist,&rev_sort_rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ found_item = (int *)H5SL_remove(slist, &rev_sort_rand_num[u]);
CHECK_PTR(found_item, "H5SL_remove");
- VERIFY(*found_item,rev_sort_rand_num[u],"H5SL_remove");
+ VERIFY(*found_item, rev_sort_rand_num[u], "H5SL_remove");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_remove_many() */
@@ -457,12 +462,12 @@ test_skiplist_remove_many(void)
static void
test_skiplist_firstnext(void)
{
- H5SL_t *slist; /* Skip list created */
- H5SL_node_t *node; /* Skip list node */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
- int *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ H5SL_t * slist; /* Skip list created */
+ H5SL_node_t *node; /* Skip list node */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
+ int * found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Iterating Over Skip List With First/Next\n"));
@@ -472,44 +477,44 @@ test_skiplist_firstnext(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Check that the list appears empty */
- node=H5SL_first(slist);
+ node = H5SL_first(slist);
CHECK_PTR_NULL(node, "H5SL_first");
/* Insert many objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, NUM_ELEMS, "H5SL_count");
/* Iterate over all the nodes in the skip list */
- node=H5SL_first(slist);
+ node = H5SL_first(slist);
CHECK_PTR(node, "H5SL_first");
- u=0;
- while(node!=NULL) {
- found_item=(int *)H5SL_item(node);
- VERIFY(*found_item,sort_rand_num[u],"H5SL_next");
+ u = 0;
+ while (node != NULL) {
+ found_item = (int *)H5SL_item(node);
+ VERIFY(*found_item, sort_rand_num[u], "H5SL_next");
u++;
- node=H5SL_next(node);
+ node = H5SL_next(node);
} /* end while */
/* Release all the items from the list */
- ret=H5SL_release(slist);
+ ret = H5SL_release(slist);
CHECK(ret, FAIL, "H5SL_release");
/* Check that the list appears empty again */
- node=H5SL_first(slist);
+ node = H5SL_first(slist);
CHECK_PTR_NULL(node, "H5SL_first");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_firstnext() */
@@ -523,39 +528,20 @@ test_skiplist_firstnext(void)
static void
test_skiplist_string(void)
{
- H5SL_t *slist; /* Skip list created */
+ H5SL_t * slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
typedef struct string_node {
- int i;
+ int i;
const char *s;
} string_node;
- string_node data[10]={
- {10,"10"},
- {20,"20"},
- {15,"15"},
- { 5,"05"},
- {50,"50"},
- {30,"30"},
- {31,"31"},
- {32,"32"},
- {80,"80"},
- {90,"90"}};
- string_node hashed_data[10]={
- { 5,"05"},
- {10,"10"},
- {15,"15"},
- {20,"20"},
- {30,"30"},
- {31,"31"},
- {32,"32"},
- {50,"50"},
- {80,"80"},
- {90,"90"}
- };
- string_node *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ string_node data[10] = {{10, "10"}, {20, "20"}, {15, "15"}, {5, "05"}, {50, "50"},
+ {30, "30"}, {31, "31"}, {32, "32"}, {80, "80"}, {90, "90"}};
+ string_node hashed_data[10] = {{5, "05"}, {10, "10"}, {15, "15"}, {20, "20"}, {30, "30"},
+ {31, "31"}, {32, "32"}, {50, "50"}, {80, "80"}, {90, "90"}};
+ string_node *found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List With String Keys\n"));
@@ -565,31 +551,31 @@ test_skiplist_string(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert objects into the skip list */
- for(u=0; u<10; u++) {
- ret=H5SL_insert(slist,&data[u],data[u].s);
+ for (u = 0; u < 10; u++) {
+ ret = H5SL_insert(slist, &data[u], data[u].s);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 10, "H5SL_count");
/* Iterate over all the nodes in the skip list */
- node=H5SL_first(slist);
- u=0;
- while(node!=NULL) {
- found_item=(string_node *)H5SL_item(node);
+ node = H5SL_first(slist);
+ u = 0;
+ while (node != NULL) {
+ found_item = (string_node *)H5SL_item(node);
VERIFY(found_item->i, hashed_data[u].i, "H5SL_next");
u++;
- node=H5SL_next(node);
+ node = H5SL_next(node);
} /* end while */
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_string() */
@@ -597,12 +583,12 @@ test_skiplist_string(void)
static herr_t
test_skiplist_iter(void *item, void H5_ATTR_UNUSED *key, void *op_data)
{
- size_t *up=(size_t *)op_data;
+ size_t *up = (size_t *)op_data;
- VERIFY(*(int *)item,sort_rand_num[*up],"H5SL_iterate");
+ VERIFY(*(int *)item, sort_rand_num[*up], "H5SL_iterate");
(*up)++;
- return(0);
+ return (0);
}
/****************************************************************
@@ -614,10 +600,10 @@ test_skiplist_iter(void *item, void H5_ATTR_UNUSED *key, void *op_data)
static void
test_skiplist_iterate(void)
{
- H5SL_t *slist; /* Skip list created */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ H5SL_t *slist; /* Skip list created */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Iterating Over Skip List\n"));
@@ -627,26 +613,26 @@ test_skiplist_iterate(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert many objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, NUM_ELEMS, "H5SL_count");
/* Iterate over all the nodes in the skip list */
- u=0;
- ret=H5SL_iterate(slist,test_skiplist_iter,&u);
+ u = 0;
+ ret = H5SL_iterate(slist, test_skiplist_iter, &u);
CHECK(ret, FAIL, "H5SL_iterate");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_iterate() */
@@ -660,14 +646,14 @@ test_skiplist_iterate(void)
static void
test_skiplist_hsize(void)
{
- H5SL_t *slist; /* Skip list created */
+ H5SL_t * slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
- hsize_t data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
- hsize_t sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
- hsize_t *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
+ hsize_t data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
+ hsize_t sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
+ hsize_t * found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List With hsize_t Keys\n"));
@@ -677,31 +663,31 @@ test_skiplist_hsize(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert objects into the skip list */
- for(u=0; u<10; u++) {
- ret=H5SL_insert(slist,&data[u],&data[u]);
+ for (u = 0; u < 10; u++) {
+ ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 10, "H5SL_count");
/* Iterate over all the nodes in the skip list */
- node=H5SL_first(slist);
- u=0;
- while(node!=NULL) {
- found_item=(hsize_t *)H5SL_item(node);
- VERIFY(*found_item,sorted_data[u],"H5SL_next");
+ node = H5SL_first(slist);
+ u = 0;
+ while (node != NULL) {
+ found_item = (hsize_t *)H5SL_item(node);
+ VERIFY(*found_item, sorted_data[u], "H5SL_next");
u++;
- node=H5SL_next(node);
+ node = H5SL_next(node);
} /* end while */
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_hsize() */
@@ -715,14 +701,14 @@ test_skiplist_hsize(void)
static void
test_skiplist_unsigned(void)
{
- H5SL_t *slist; /* Skip list created */
+ H5SL_t * slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
- unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
- unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
- unsigned *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
+ unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
+ unsigned sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
+ unsigned * found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List With unsigned Keys\n"));
@@ -732,31 +718,31 @@ test_skiplist_unsigned(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert objects into the skip list */
- for(u=0; u<10; u++) {
- ret=H5SL_insert(slist,&data[u],&data[u]);
+ for (u = 0; u < 10; u++) {
+ ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 10, "H5SL_count");
/* Iterate over all the nodes in the skip list */
- node=H5SL_first(slist);
- u=0;
- while(node!=NULL) {
- found_item=(unsigned *)H5SL_item(node);
- VERIFY(*found_item,sorted_data[u],"H5SL_next");
+ node = H5SL_first(slist);
+ u = 0;
+ while (node != NULL) {
+ found_item = (unsigned *)H5SL_item(node);
+ VERIFY(*found_item, sorted_data[u], "H5SL_next");
u++;
- node=H5SL_next(node);
+ node = H5SL_next(node);
} /* end while */
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_unsigned() */
@@ -770,14 +756,16 @@ test_skiplist_unsigned(void)
static void
test_skiplist_obj(void)
{
- H5SL_t *slist; /* Skip list created */
+ H5SL_t * slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
- H5_obj_t data[10]={ {10, 12}, {20, 12}, {10, 32}, {10, 11}, {50, 1}, {8, 12}, {31, 12}, {20, 11}, {31, 11}, {8, 32} };
- H5_obj_t sorted_data[10]={ {8, 12}, {8, 32}, {10, 11}, {10, 12}, {10, 32}, {20, 11}, {20, 12}, {31, 11}, {31, 12}, {50, 1} };
- H5_obj_t *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
+ H5_obj_t data[10] = {{10, 12}, {20, 12}, {10, 32}, {10, 11}, {50, 1},
+ {8, 12}, {31, 12}, {20, 11}, {31, 11}, {8, 32}};
+ H5_obj_t sorted_data[10] = {{8, 12}, {8, 32}, {10, 11}, {10, 12}, {10, 32},
+ {20, 11}, {20, 12}, {31, 11}, {31, 12}, {50, 1}};
+ H5_obj_t * found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List With H5_obj_t Keys\n"));
@@ -787,32 +775,32 @@ test_skiplist_obj(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert objects into the skip list */
- for(u=0; u<10; u++) {
- ret=H5SL_insert(slist,&data[u],&data[u]);
+ for (u = 0; u < 10; u++) {
+ ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 10, "H5SL_count");
/* Iterate over all the nodes in the skip list */
- node=H5SL_first(slist);
- u=0;
- while(node!=NULL) {
- found_item=(H5_obj_t *)H5SL_item(node);
- VERIFY(found_item->fileno,sorted_data[u].fileno,"H5SL_next");
- VERIFY(found_item->addr,sorted_data[u].addr,"H5SL_next");
+ node = H5SL_first(slist);
+ u = 0;
+ while (node != NULL) {
+ found_item = (H5_obj_t *)H5SL_item(node);
+ VERIFY(found_item->fileno, sorted_data[u].fileno, "H5SL_next");
+ VERIFY(found_item->addr, sorted_data[u].addr, "H5SL_next");
u++;
- node=H5SL_next(node);
+ node = H5SL_next(node);
} /* end while */
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_obj() */
@@ -833,13 +821,14 @@ typedef struct generic_t {
static int
test_skiplist_generic_cmp(const void *_key1, const void *_key2)
{
- const generic_t *key1 = (const generic_t *)_key1;
- const generic_t *key2 = (const generic_t *)_key2;
- long long result = (long long)(key1->a) - (long long)(key1->b) - (long long)(key2->a) + (long long)(key2->b);
+ const generic_t *key1 = (const generic_t *)_key1;
+ const generic_t *key2 = (const generic_t *)_key2;
+ long long result =
+ (long long)(key1->a) - (long long)(key1->b) - (long long)(key2->a) + (long long)(key2->b);
- if(result < 0)
+ if (result < 0)
return -1;
- else if(result > 0)
+ else if (result > 0)
return 1;
else
return 0;
@@ -848,14 +837,16 @@ test_skiplist_generic_cmp(const void *_key1, const void *_key2)
static void
test_skiplist_generic(void)
{
- H5SL_t *slist; /* Skip list created */
+ H5SL_t * slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
- generic_t data[10]={ {10, 1}, {20, 13}, {15, 32}, {5, 2}, {50, 37}, {30, 100}, {31, 38}, {32, 34}, {80, 32}, {90, 0} };
- generic_t sorted_data[10]={ {30, 100}, {15, 32}, {31, 38}, {32, 34}, {5, 2}, {20, 13}, {10, 1}, {50, 37}, {80, 32}, {90, 0} };
- generic_t *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
+ generic_t data[10] = {{10, 1}, {20, 13}, {15, 32}, {5, 2}, {50, 37},
+ {30, 100}, {31, 38}, {32, 34}, {80, 32}, {90, 0}};
+ generic_t sorted_data[10] = {{30, 100}, {15, 32}, {31, 38}, {32, 34}, {5, 2},
+ {20, 13}, {10, 1}, {50, 37}, {80, 32}, {90, 0}};
+ generic_t * found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List With generic Keys\n"));
@@ -865,32 +856,32 @@ test_skiplist_generic(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert objects into the skip list */
- for(u=0; u<10; u++) {
- ret=H5SL_insert(slist,&data[u],&data[u]);
+ for (u = 0; u < 10; u++) {
+ ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 10, "H5SL_count");
/* Iterate over all the nodes in the skip list */
- node=H5SL_first(slist);
- u=0;
- while(node!=NULL) {
- found_item=(generic_t *)H5SL_item(node);
- VERIFY(found_item->a,sorted_data[u].a,"H5SL_next");
- VERIFY(found_item->b,sorted_data[u].b,"H5SL_next");
+ node = H5SL_first(slist);
+ u = 0;
+ while (node != NULL) {
+ found_item = (generic_t *)H5SL_item(node);
+ VERIFY(found_item->a, sorted_data[u].a, "H5SL_next");
+ VERIFY(found_item->b, sorted_data[u].b, "H5SL_next");
u++;
- node=H5SL_next(node);
+ node = H5SL_next(node);
} /* end while */
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_generic() */
@@ -904,12 +895,12 @@ test_skiplist_generic(void)
static void
test_skiplist_lastprev(void)
{
- H5SL_t *slist; /* Skip list created */
- H5SL_node_t *node; /* Skip list node */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
- int *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ H5SL_t * slist; /* Skip list created */
+ H5SL_node_t *node; /* Skip list node */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
+ int * found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Iterating Over Skip List With Last/Prev\n"));
@@ -919,44 +910,44 @@ test_skiplist_lastprev(void)
CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Check that the list appears empty */
- node=H5SL_last(slist);
+ node = H5SL_last(slist);
CHECK_PTR_NULL(node, "H5SL_last");
/* Insert many objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, NUM_ELEMS, "H5SL_count");
/* Iterate over all the nodes in the skip list */
- node=H5SL_last(slist);
+ node = H5SL_last(slist);
CHECK_PTR(node, "H5SL_last");
- u=NUM_ELEMS-1;
- while(node!=NULL) {
- found_item=(int *)H5SL_item(node);
- VERIFY(*found_item,sort_rand_num[u],"H5SL_prev");
+ u = NUM_ELEMS - 1;
+ while (node != NULL) {
+ found_item = (int *)H5SL_item(node);
+ VERIFY(*found_item, sort_rand_num[u], "H5SL_prev");
u--;
- node=H5SL_prev(node);
+ node = H5SL_prev(node);
} /* end while */
/* Release all the items from the list */
- ret=H5SL_release(slist);
+ ret = H5SL_release(slist);
CHECK(ret, FAIL, "H5SL_release");
/* Check that the list appears empty again */
- node=H5SL_last(slist);
+ node = H5SL_last(slist);
CHECK_PTR_NULL(node, "H5SL_last");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_lastprev() */
@@ -970,14 +961,14 @@ test_skiplist_lastprev(void)
static void
test_skiplist_find(void)
{
- H5SL_t *slist; /* Skip list created */
+ H5SL_t * slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- size_t u; /* Local index variable */
- unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
- unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
- unsigned *found_item; /* Item found in skip list */
- unsigned find_item; /* Item to find in skip list */
- herr_t ret; /* Generic return value */
+ size_t u; /* Local index variable */
+ unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
+ unsigned sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
+ unsigned * found_item; /* Item found in skip list */
+ unsigned find_item; /* Item to find in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Find' Operation\n"));
@@ -987,32 +978,32 @@ test_skiplist_find(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u=0; u<10; u++) {
- ret=H5SL_insert(slist,&data[u],&data[u]);
+ for (u = 0; u < 10; u++) {
+ ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Find the element with key==30 in the skip list */
- find_item=30;
- node=H5SL_find(slist,&find_item);
+ find_item = 30;
+ node = H5SL_find(slist, &find_item);
CHECK_PTR(node, "H5SL_find");
/* Iterate over the rest of the nodes in the skip list */
- u=4;
- while(node!=NULL) {
- found_item=(unsigned *)H5SL_item(node);
- VERIFY(*found_item,sorted_data[u],"H5SL_next");
+ u = 4;
+ while (node != NULL) {
+ found_item = (unsigned *)H5SL_item(node);
+ VERIFY(*found_item, sorted_data[u], "H5SL_next");
u++;
- node=H5SL_next(node);
+ node = H5SL_next(node);
} /* end while */
/* Check for trying to locate non-existent item */
- find_item=81;
- node=H5SL_find(slist,&find_item);
+ find_item = 81;
+ node = H5SL_find(slist, &find_item);
CHECK_PTR_NULL(node, "H5SL_find");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_find() */
@@ -1026,14 +1017,14 @@ test_skiplist_find(void)
static void
test_skiplist_add(void)
{
- H5SL_t *slist; /* Skip list created */
+ H5SL_t * slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- size_t u; /* Local index variable */
- unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
- unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
- unsigned *found_item; /* Item found in skip list */
- unsigned new_item; /* Item to add to skip list */
- herr_t ret; /* Generic return value */
+ size_t u; /* Local index variable */
+ unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
+ unsigned sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
+ unsigned * found_item; /* Item found in skip list */
+ unsigned new_item; /* Item to add to skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Add' Operation\n"));
@@ -1043,31 +1034,31 @@ test_skiplist_add(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u=0; u<10; u++) {
- ret=H5SL_insert(slist,&data[u],&data[u]);
+ for (u = 0; u < 10; u++) {
+ ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Add the element with key==12 in the skip list */
- new_item=12;
- node=H5SL_add(slist,&new_item,&new_item);
+ new_item = 12;
+ node = H5SL_add(slist, &new_item, &new_item);
CHECK_PTR(node, "H5SL_add");
/* Advance to next node in list */
- node=H5SL_next(node);
+ node = H5SL_next(node);
CHECK_PTR(node, "H5SL_next");
/* Iterate over the rest of the nodes in the skip list */
- u=2;
- while(node!=NULL) {
- found_item=(unsigned *)H5SL_item(node);
- VERIFY(*found_item,sorted_data[u],"H5SL_item");
+ u = 2;
+ while (node != NULL) {
+ found_item = (unsigned *)H5SL_item(node);
+ VERIFY(*found_item, sorted_data[u], "H5SL_item");
u++;
- node=H5SL_next(node);
+ node = H5SL_next(node);
} /* end while */
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_add() */
@@ -1075,12 +1066,12 @@ test_skiplist_add(void)
static herr_t
test_skiplist_destroy_free(void *item, void H5_ATTR_UNUSED *key, void *op_data)
{
- unsigned *free_count=(unsigned *)op_data;
+ unsigned *free_count = (unsigned *)op_data;
- VERIFY(*(int *)item,sort_rand_num[*free_count],"H5SL_destroy");
+ VERIFY(*(int *)item, sort_rand_num[*free_count], "H5SL_destroy");
(*free_count)++;
- return(0);
+ return (0);
}
/****************************************************************
@@ -1092,10 +1083,10 @@ test_skiplist_destroy_free(void *item, void H5_ATTR_UNUSED *key, void *op_data)
static void
test_skiplist_destroy(void)
{
- H5SL_t *slist; /* Skip list created */
- size_t u; /* Local index variable */
+ H5SL_t * slist; /* Skip list created */
+ size_t u; /* Local index variable */
unsigned free_count; /* Number of items freed */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Destroy' Operation\n"));
@@ -1105,14 +1096,14 @@ test_skiplist_destroy(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Destroy the skip list */
- free_count=0;
- ret=H5SL_destroy(slist,test_skiplist_destroy_free,&free_count);
+ free_count = 0;
+ ret = H5SL_destroy(slist, test_skiplist_destroy_free, &free_count);
CHECK(ret, FAIL, "H5SL_destroy");
VERIFY(free_count, NUM_ELEMS, "H5SL_destroy");
@@ -1127,11 +1118,11 @@ test_skiplist_destroy(void)
static void
test_skiplist_free(void)
{
- H5SL_t *slist; /* Skip list created */
- size_t num; /* Number of elements in skip list */
- size_t u; /* Local index variable */
+ H5SL_t * slist; /* Skip list created */
+ size_t num; /* Number of elements in skip list */
+ size_t u; /* Local index variable */
unsigned free_count; /* Number of items freed */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Free' Operation\n"));
@@ -1141,33 +1132,33 @@ test_skiplist_free(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Destroy the skip list */
- free_count=0;
- ret=H5SL_free(slist,test_skiplist_destroy_free,&free_count);
+ free_count = 0;
+ ret = H5SL_free(slist, test_skiplist_destroy_free, &free_count);
CHECK(ret, FAIL, "H5SL_destroy");
VERIFY(free_count, NUM_ELEMS, "H5SL_free");
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, 0, "H5SL_count");
/* Insert objects into the skip list again */
- for(u=0; u<NUM_ELEMS; u++) {
- ret=H5SL_insert(slist,&rand_num[u],&rand_num[u]);
+ for (u = 0; u < NUM_ELEMS; u++) {
+ ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check that the skip list has correct # of elements */
- num=H5SL_count(slist);
+ num = H5SL_count(slist);
VERIFY(num, NUM_ELEMS, "H5SL_count");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_free() */
@@ -1181,32 +1172,34 @@ test_skiplist_free(void)
/* Macro definitions */
#define TEST_TFS_MAX_NOBJS 100
#define TEST_TFS_MIN_NOBJS 5
-#define TEST_TFS_NITER 50
+#define TEST_TFS_NITER 50
/* Structure to hold the list of objects */
typedef struct {
- H5SL_t *slist; /* Skiplist holding the objects */
- struct test_tfs_obj_t *list; /* Linear list of objects */
- int nobjs; /* Number of objects in list */
- int nobjs_rem; /* Number of objects in list that have not been freed */
+ H5SL_t * slist; /* Skiplist holding the objects */
+ struct test_tfs_obj_t *list; /* Linear list of objects */
+ int nobjs; /* Number of objects in list */
+ int nobjs_rem; /* Number of objects in list that have not been freed */
} test_tfs_list_t;
/* Structure for an object */
typedef struct test_tfs_obj_t {
- int idx; /* Index (key) for this object */
- int nfrees; /* Number of times this object has been freed */
+ int idx; /* Index (key) for this object */
+ int nfrees; /* Number of times this object has been freed */
} test_tfs_obj_t;
/* op_data struct for H5SL_iterate() */
typedef struct test_tfs_it_ud_t {
- test_tfs_list_t *obj_list; /* List of objects */
- int last_idx; /* Index of last object visited in iteration */
- int ncalls; /* Number of times this callback was called */
+ test_tfs_list_t *obj_list; /* List of objects */
+ int last_idx; /* Index of last object visited in iteration */
+ int ncalls; /* Number of times this callback was called */
} test_tfs_it_ud_t;
/* iterate callback */
-static herr_t test_tfs_iter(void *_obj, void *key, void *_udata) {
- test_tfs_obj_t *obj = (test_tfs_obj_t *)_obj;
+static herr_t
+test_tfs_iter(void *_obj, void *key, void *_udata)
+{
+ test_tfs_obj_t * obj = (test_tfs_obj_t *)_obj;
test_tfs_it_ud_t *udata = (test_tfs_it_ud_t *)_udata;
/* Check consistency */
@@ -1219,21 +1212,23 @@ static herr_t test_tfs_iter(void *_obj, void *key, void *_udata) {
/* Verify we were given the correct object */
do {
udata->last_idx++;
- } while(udata->obj_list->list[udata->last_idx].nfrees != 0);
+ } while (udata->obj_list->list[udata->last_idx].nfrees != 0);
VERIFY(udata->last_idx, obj->idx, "H5SL_iterate");
return 0;
} /* end test_tfs_iter() */
/* try_free_safe callback */
-static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) {
- test_tfs_obj_t *obj = (test_tfs_obj_t *)_obj;
+static htri_t
+test_tfs_free(void *_obj, void *key, void *_obj_list)
+{
+ test_tfs_obj_t * obj = (test_tfs_obj_t *)_obj;
test_tfs_list_t *obj_list = (test_tfs_list_t *)_obj_list;
test_tfs_it_ud_t iter_ud;
- int nrems, rem_idx, i, j;
- test_tfs_obj_t *obj_ret;
- herr_t ret; /* return value */
- htri_t ret_value;
+ int nrems, rem_idx, i, j;
+ test_tfs_obj_t * obj_ret;
+ herr_t ret; /* return value */
+ htri_t ret_value;
/* Check consistency */
CHECK_PTR_EQ((void *)&obj->idx, key, "obj->idx");
@@ -1249,22 +1244,22 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) {
nrems = (int)(HDrandom() % (long)3);
/* Remove objects */
- for(i = 0; i < nrems; i++)
+ for (i = 0; i < nrems; i++)
/* Check nobjs_rem */
- if(obj_list->nobjs_rem > 0) {
+ if (obj_list->nobjs_rem > 0) {
/* Remove a random object from the list */
rem_idx = (int)(HDrandom() % (long)obj_list->nobjs_rem);
/* Scan the list, finding the rem_idx'th object that has not been
* freed */
- for(j = 0; j < obj_list->nobjs; j++)
- if(obj_list->list[j].nfrees == 0) {
- if(rem_idx == 0)
+ for (j = 0; j < obj_list->nobjs; j++)
+ if (obj_list->list[j].nfrees == 0) {
+ if (rem_idx == 0)
break;
else
rem_idx--;
} /* end if */
- if(j == obj_list->nobjs)
+ if (j == obj_list->nobjs)
ERROR("invalid obj_list");
else {
/* Remove the object */
@@ -1273,7 +1268,7 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) {
obj_ret->nfrees++;
obj_list->nobjs_rem--;
} /* end else */
- } /* end if */
+ } /* end if */
/* Mark this object as not freed so we know to expect it in the iterate call
*/
@@ -1281,21 +1276,21 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) {
obj_list->nobjs_rem++;
/* Iterate over skip list (maybe) */
- if(HDrandom() % (long)5) {
+ if (HDrandom() % (long)5) {
iter_ud.obj_list = obj_list;
iter_ud.last_idx = -1;
- iter_ud.ncalls = 0;
- ret = H5SL_iterate(obj_list->slist, test_tfs_iter, &iter_ud);
+ iter_ud.ncalls = 0;
+ ret = H5SL_iterate(obj_list->slist, test_tfs_iter, &iter_ud);
CHECK(ret, FAIL, "H5SL_iterate");
VERIFY(iter_ud.ncalls, obj_list->nobjs_rem, "H5SL_iterate");
} /* end if */
/* Verify nobjs_rem is non-negative */
- if(obj_list->nobjs_rem < 0)
+ if (obj_list->nobjs_rem < 0)
ERROR("invalid nobjs_rem");
/* Decide whether this object should be freed */
- if(HDrandom() % (long)2) {
+ if (HDrandom() % (long)2) {
/* Free the object */
ret_value = TRUE;
obj->nfrees++;
@@ -1313,11 +1308,11 @@ static void
test_skiplist_try_free_safe(void)
{
test_tfs_list_t obj_list;
- test_tfs_obj_t list[TEST_TFS_MAX_NOBJS];
- int i, j;
- int nobjs_found;
- hsize_t count;
- herr_t ret; /* Generic return value */
+ test_tfs_obj_t list[TEST_TFS_MAX_NOBJS];
+ int i, j;
+ int nobjs_found;
+ hsize_t count;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Try Free Safe' Operation\n"));
@@ -1328,15 +1323,16 @@ test_skiplist_try_free_safe(void)
/* Init obj_list.list */
obj_list.list = list;
- for(j = 0; j < TEST_TFS_MAX_NOBJS; j++)
+ for (j = 0; j < TEST_TFS_MAX_NOBJS; j++)
list[j].idx = j;
- for(i = 0; i < TEST_TFS_NITER; i++) {
+ for (i = 0; i < TEST_TFS_NITER; i++) {
/* Build object list */
- obj_list.nobjs = obj_list.nobjs_rem = (int)(TEST_TFS_MIN_NOBJS + (HDrandom() % (long)(TEST_TFS_MAX_NOBJS - TEST_TFS_MIN_NOBJS + 1)));
- for(j = 0; j < obj_list.nobjs; j++) {
+ obj_list.nobjs = obj_list.nobjs_rem =
+ (int)(TEST_TFS_MIN_NOBJS + (HDrandom() % (long)(TEST_TFS_MAX_NOBJS - TEST_TFS_MIN_NOBJS + 1)));
+ for (j = 0; j < obj_list.nobjs; j++) {
list[j].nfrees = 0;
- ret = H5SL_insert(obj_list.slist, &list[j], &list[j].idx);
+ ret = H5SL_insert(obj_list.slist, &list[j], &list[j].idx);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
@@ -1347,8 +1343,8 @@ test_skiplist_try_free_safe(void)
/* Verify list */
nobjs_found = 0;
- for(j = 0; j < obj_list.nobjs; j++)
- if(list[j].nfrees == 0)
+ for (j = 0; j < obj_list.nobjs; j++)
+ if (list[j].nfrees == 0)
nobjs_found++;
else
VERIFY(list[j].nfrees, (long)1, "list[j].nfrees");
@@ -1383,13 +1379,13 @@ test_skiplist_try_free_safe(void)
static void
test_skiplist_less(void)
{
- H5SL_t *slist; /* Skip list created */
- size_t u; /* Local index variable */
- unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
+ H5SL_t * slist; /* Skip list created */
+ size_t u; /* Local index variable */
+ unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
/* unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; */
- unsigned *found_item; /* Item found in skip list */
- unsigned find_item; /* Item to add to skip list */
- herr_t ret; /* Generic return value */
+ unsigned *found_item; /* Item found in skip list */
+ unsigned find_item; /* Item to add to skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Less' Operation\n"));
@@ -1399,41 +1395,41 @@ test_skiplist_less(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u=0; u<10; u++) {
- ret=H5SL_insert(slist,&data[u],&data[u]);
+ for (u = 0; u < 10; u++) {
+ ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check for exact match of items in various positions */
- find_item=20;
- found_item=(unsigned *)H5SL_less(slist,&find_item);
- VERIFY(*found_item,find_item,"H5SL_less");
- find_item=90;
- found_item=(unsigned *)H5SL_less(slist,&find_item);
- VERIFY(*found_item,find_item,"H5SL_less");
- find_item=5;
- found_item=(unsigned *)H5SL_less(slist,&find_item);
- VERIFY(*found_item,find_item,"H5SL_less");
+ find_item = 20;
+ found_item = (unsigned *)H5SL_less(slist, &find_item);
+ VERIFY(*found_item, find_item, "H5SL_less");
+ find_item = 90;
+ found_item = (unsigned *)H5SL_less(slist, &find_item);
+ VERIFY(*found_item, find_item, "H5SL_less");
+ find_item = 5;
+ found_item = (unsigned *)H5SL_less(slist, &find_item);
+ VERIFY(*found_item, find_item, "H5SL_less");
/* Find item less than a missing key, in various positions */
- find_item=19;
- found_item=(unsigned *)H5SL_less(slist,&find_item);
- VERIFY(*found_item,15,"H5SL_less");
- find_item=89;
- found_item=(unsigned *)H5SL_less(slist,&find_item);
- VERIFY(*found_item,80,"H5SL_less");
- find_item=100;
- found_item=(unsigned *)H5SL_less(slist,&find_item);
- VERIFY(*found_item,90,"H5SL_less");
- find_item=9;
- found_item=(unsigned *)H5SL_less(slist,&find_item);
- VERIFY(*found_item,5,"H5SL_less");
- find_item=4;
- found_item=(unsigned *)H5SL_less(slist,&find_item);
+ find_item = 19;
+ found_item = (unsigned *)H5SL_less(slist, &find_item);
+ VERIFY(*found_item, 15, "H5SL_less");
+ find_item = 89;
+ found_item = (unsigned *)H5SL_less(slist, &find_item);
+ VERIFY(*found_item, 80, "H5SL_less");
+ find_item = 100;
+ found_item = (unsigned *)H5SL_less(slist, &find_item);
+ VERIFY(*found_item, 90, "H5SL_less");
+ find_item = 9;
+ found_item = (unsigned *)H5SL_less(slist, &find_item);
+ VERIFY(*found_item, 5, "H5SL_less");
+ find_item = 4;
+ found_item = (unsigned *)H5SL_less(slist, &find_item);
CHECK_PTR_NULL(found_item, "H5SL_less");
/* Close the skip list */
- ret=H5SL_close(slist);
+ ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_less() */
@@ -1447,13 +1443,13 @@ test_skiplist_less(void)
static void
test_skiplist_greater(void)
{
- H5SL_t *slist; /* Skip list created */
- size_t u; /* Local index variable */
- unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
+ H5SL_t * slist; /* Skip list created */
+ size_t u; /* Local index variable */
+ unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
/* unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; */
- unsigned *found_item; /* Item found in skip list */
- unsigned find_item; /* Item to add to skip list */
- herr_t ret; /* Generic return value */
+ unsigned *found_item; /* Item found in skip list */
+ unsigned find_item; /* Item to add to skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Greater' Operation\n"));
@@ -1463,36 +1459,36 @@ test_skiplist_greater(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check for exact match of items in various positions */
- find_item = 20;
+ find_item = 20;
found_item = (unsigned *)H5SL_greater(slist, &find_item);
VERIFY(*found_item, find_item, "H5SL_greater");
- find_item = 90;
+ find_item = 90;
found_item = (unsigned *)H5SL_greater(slist, &find_item);
VERIFY(*found_item, find_item, "H5SL_greater");
- find_item = 5;
+ find_item = 5;
found_item = (unsigned *)H5SL_greater(slist, &find_item);
VERIFY(*found_item, find_item, "H5SL_greater");
/* Find item greater than a missing key, in various positions */
- find_item = 19;
- found_item = (unsigned *)H5SL_greater(slist,&find_item);
+ find_item = 19;
+ found_item = (unsigned *)H5SL_greater(slist, &find_item);
VERIFY(*found_item, 20, "H5SL_greater");
- find_item = 89;
+ find_item = 89;
found_item = (unsigned *)H5SL_greater(slist, &find_item);
VERIFY(*found_item, 90, "H5SL_greater");
- find_item = 100;
+ find_item = 100;
found_item = (unsigned *)H5SL_greater(slist, &find_item);
CHECK_PTR_NULL(found_item, "H5SL_greater");
- find_item = 6;
+ find_item = 6;
found_item = (unsigned *)H5SL_greater(slist, &find_item);
VERIFY(*found_item, 10, "H5SL_greater");
- find_item = 4;
+ find_item = 4;
found_item = (unsigned *)H5SL_greater(slist, &find_item);
VERIFY(*found_item, 5, "H5SL_greater");
@@ -1511,14 +1507,14 @@ test_skiplist_greater(void)
static void
test_skiplist_below(void)
{
- H5SL_t *slist; /* Skip list created */
+ H5SL_t * slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- size_t u; /* Local index variable */
- unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
+ size_t u; /* Local index variable */
+ unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
/* unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; */
- unsigned *found_item; /* Item found in skip list */
- unsigned find_item; /* Item to add to skip list */
- herr_t ret; /* Generic return value */
+ unsigned *found_item; /* Item found in skip list */
+ unsigned find_item; /* Item to add to skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Below' Operation\n"));
@@ -1528,51 +1524,51 @@ test_skiplist_below(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check for exact match of items in various positions */
find_item = 20;
- node = H5SL_below(slist, &find_item);
+ node = H5SL_below(slist, &find_item);
CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_below");
find_item = 90;
- node = H5SL_below(slist, &find_item);
+ node = H5SL_below(slist, &find_item);
CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_below");
find_item = 5;
- node = H5SL_below(slist, &find_item);
+ node = H5SL_below(slist, &find_item);
CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_below");
/* Find item less than a missing key, in various positions */
find_item = 19;
- node = H5SL_below(slist, &find_item);
+ node = H5SL_below(slist, &find_item);
CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 15, "H5SL_below");
find_item = 89;
- node = H5SL_below(slist, &find_item);
+ node = H5SL_below(slist, &find_item);
CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 80, "H5SL_below");
find_item = 100;
- node = H5SL_below(slist, &find_item);
+ node = H5SL_below(slist, &find_item);
CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 90, "H5SL_below");
find_item = 9;
- node = H5SL_below(slist, &find_item);
+ node = H5SL_below(slist, &find_item);
CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 5, "H5SL_below");
find_item = 4;
- node = (H5SL_node_t *)H5SL_less(slist, &find_item);
+ node = (H5SL_node_t *)H5SL_less(slist, &find_item);
CHECK_PTR_NULL(node, "H5SL_below");
/* Close the skip list */
@@ -1590,14 +1586,14 @@ test_skiplist_below(void)
static void
test_skiplist_above(void)
{
- H5SL_t *slist; /* Skip list created */
+ H5SL_t * slist; /* Skip list created */
H5SL_node_t *node; /* Skip list node */
- size_t u; /* Local index variable */
- unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
+ size_t u; /* Local index variable */
+ unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
/* unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90}; */
- unsigned *found_item; /* Item found in skip list */
- unsigned find_item; /* Item to add to skip list */
- herr_t ret; /* Generic return value */
+ unsigned *found_item; /* Item found in skip list */
+ unsigned find_item; /* Item to add to skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Above' Operation\n"));
@@ -1607,49 +1603,49 @@ test_skiplist_above(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Check for exact match of items in various positions */
find_item = 20;
- node = H5SL_above(slist, &find_item);
+ node = H5SL_above(slist, &find_item);
CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_above");
find_item = 90;
- node = H5SL_above(slist, &find_item);
+ node = H5SL_above(slist, &find_item);
CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_above");
find_item = 5;
- node = H5SL_above(slist, &find_item);
+ node = H5SL_above(slist, &find_item);
CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_above");
/* Find item greater than a missing key, in various positions */
find_item = 19;
- node = H5SL_above(slist, &find_item);
+ node = H5SL_above(slist, &find_item);
CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 20, "H5SL_above");
find_item = 89;
- node = H5SL_above(slist, &find_item);
+ node = H5SL_above(slist, &find_item);
CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 90, "H5SL_above");
find_item = 100;
- node = H5SL_above(slist, &find_item);
+ node = H5SL_above(slist, &find_item);
CHECK_PTR_NULL(node, "H5SL_above");
find_item = 6;
- node = H5SL_above(slist, &find_item);
+ node = H5SL_above(slist, &find_item);
CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 10, "H5SL_above");
find_item = 4;
- node = H5SL_above(slist, &find_item);
+ node = H5SL_above(slist, &find_item);
CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 5, "H5SL_above");
@@ -1669,12 +1665,12 @@ test_skiplist_above(void)
static void
test_skiplist_remove_first(void)
{
- H5SL_t *slist; /* Skip list created */
- size_t u; /* Local index variable */
- unsigned data[10]={ 10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
- unsigned sorted_data[10]={ 5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
- unsigned *found_item; /* Item found in skip list */
- herr_t ret; /* Generic return value */
+ H5SL_t * slist; /* Skip list created */
+ size_t u; /* Local index variable */
+ unsigned data[10] = {10, 20, 15, 5, 50, 30, 31, 32, 80, 90};
+ unsigned sorted_data[10] = {5, 10, 15, 20, 30, 31, 32, 50, 80, 90};
+ unsigned *found_item; /* Item found in skip list */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Remove First' Operation\n"));
@@ -1684,13 +1680,13 @@ test_skiplist_remove_first(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
ret = H5SL_insert(slist, &data[u], &data[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Remove objects from the skip list */
- for(u = 0; u < 10; u++) {
+ for (u = 0; u < 10; u++) {
found_item = (unsigned *)H5SL_remove_first(slist);
VERIFY(*found_item, sorted_data[u], "H5SL_remove_first");
} /* end for */
@@ -1714,11 +1710,11 @@ test_skiplist_remove_first(void)
static void
test_skiplist_remove_first_many(void)
{
- H5SL_t *slist; /* Skip list created */
- size_t u; /* Local index variable */
- int *found_item; /* Item found in skip list */
+ H5SL_t *slist; /* Skip list created */
+ size_t u; /* Local index variable */
+ int * found_item; /* Item found in skip list */
int prev_item = INT_MIN; /* Previously found item in skip list */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Remove First' Operation\n"));
@@ -1728,13 +1724,13 @@ test_skiplist_remove_first_many(void)
CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
- for(u = 0; u < NUM_ELEMS; u++) {
+ for (u = 0; u < NUM_ELEMS; u++) {
ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Remove objects from the skip list */
- for(u = 0; u < NUM_ELEMS; u++) {
+ for (u = 0; u < NUM_ELEMS; u++) {
found_item = (int *)H5SL_remove_first(slist);
VERIFY(*found_item > prev_item, TRUE, "H5SL_remove_first");
prev_item = *found_item;
@@ -1760,11 +1756,11 @@ static void
test_skiplist_term(void)
{
/* Release arrays */
- if(rand_num)
+ if (rand_num)
HDfree(rand_num);
- if(sort_rand_num)
+ if (sort_rand_num)
HDfree(sort_rand_num);
- if(rev_sort_rand_num)
+ if (rev_sort_rand_num)
HDfree(rev_sort_rand_num);
} /* end test_skiplist_term() */
@@ -1783,33 +1779,32 @@ test_skiplist(void)
test_skiplist_init();
/* Actual skip list tests */
- test_skiplist_create(); /* Test skip list creation */
- test_skiplist_insert(); /* Test basic skip list insertion */
- test_skiplist_insert_many(); /* Test insertion of many items into skip list */
- test_skiplist_remove(); /* Test basic skip list removal */
- test_skiplist_remove_many(); /* Test removal of many items from skip list */
- test_skiplist_firstnext(); /* Test iteration over skip list nodes with first/next */
- test_skiplist_string(); /* Test skip list string keys */
- test_skiplist_iterate(); /* Test iteration over skip list nodes with callback */
- test_skiplist_hsize(); /* Test skip list hsize_t keys */
- test_skiplist_unsigned(); /* Test skip list unsigned keys */
- test_skiplist_obj(); /* Test skip list H5_obj_t keys */
- test_skiplist_generic(); /* Test skip list generic keys */
- test_skiplist_lastprev(); /* Test iteration over skip list nodes with last/prev */
- test_skiplist_find(); /* Test 'find' operation */
- test_skiplist_add(); /* Test 'add' operation */
- test_skiplist_destroy(); /* Test 'destroy' operation */
- test_skiplist_free(); /* Test 'free' operation */
- test_skiplist_try_free_safe(); /* Test 'try_free_safe' operation */
- test_skiplist_less(); /* Test 'less' operation */
- test_skiplist_greater(); /* Test 'greater' operation */
- test_skiplist_below(); /* Test 'below' operation */
- test_skiplist_above(); /* Test 'above' operation */
- test_skiplist_remove_first(); /* Test 'remove first' operation */
- test_skiplist_remove_first_many(); /* Test 'remove first' operation on large skip lists */
+ test_skiplist_create(); /* Test skip list creation */
+ test_skiplist_insert(); /* Test basic skip list insertion */
+ test_skiplist_insert_many(); /* Test insertion of many items into skip list */
+ test_skiplist_remove(); /* Test basic skip list removal */
+ test_skiplist_remove_many(); /* Test removal of many items from skip list */
+ test_skiplist_firstnext(); /* Test iteration over skip list nodes with first/next */
+ test_skiplist_string(); /* Test skip list string keys */
+ test_skiplist_iterate(); /* Test iteration over skip list nodes with callback */
+ test_skiplist_hsize(); /* Test skip list hsize_t keys */
+ test_skiplist_unsigned(); /* Test skip list unsigned keys */
+ test_skiplist_obj(); /* Test skip list H5_obj_t keys */
+ test_skiplist_generic(); /* Test skip list generic keys */
+ test_skiplist_lastprev(); /* Test iteration over skip list nodes with last/prev */
+ test_skiplist_find(); /* Test 'find' operation */
+ test_skiplist_add(); /* Test 'add' operation */
+ test_skiplist_destroy(); /* Test 'destroy' operation */
+ test_skiplist_free(); /* Test 'free' operation */
+ test_skiplist_try_free_safe(); /* Test 'try_free_safe' operation */
+ test_skiplist_less(); /* Test 'less' operation */
+ test_skiplist_greater(); /* Test 'greater' operation */
+ test_skiplist_below(); /* Test 'below' operation */
+ test_skiplist_above(); /* Test 'above' operation */
+ test_skiplist_remove_first(); /* Test 'remove first' operation */
+ test_skiplist_remove_first_many(); /* Test 'remove first' operation on large skip lists */
/* Release skip list testing data */
test_skiplist_term();
-} /* end test_skiplist() */
-
+} /* end test_skiplist() */
diff --git a/test/tsohm.c b/test/tsohm.c
index f39b5e5..71e42e6 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -21,114 +21,90 @@
* This file needs to access private information from the H5F package.
* This file also needs to access the file testing code.
*/
-#define H5F_FRIEND /* suppress error about including H5Fpkg */
+#define H5F_FRIEND /* suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
/* Default SOHM values */
#define DEF_NUM_INDEXES 0
-const unsigned def_type_flags[H5O_SHMESG_MAX_NINDEXES] = {0,0,0,0,0,0};
-const unsigned def_minsizes[H5O_SHMESG_MAX_NINDEXES] = {250,250,250,250,250,250};
+const unsigned def_type_flags[H5O_SHMESG_MAX_NINDEXES] = {0, 0, 0, 0, 0, 0};
+const unsigned def_minsizes[H5O_SHMESG_MAX_NINDEXES] = {250, 250, 250, 250, 250, 250};
#define DEF_L2B 50
#define DEF_B2L 40
/* Non-default SOHM values for testing */
#define TEST_NUM_INDEXES 4
-const unsigned test_type_flags[H5O_SHMESG_MAX_NINDEXES] =
- {H5O_SHMESG_FILL_FLAG,
- H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_ATTR_FLAG,
- H5O_SHMESG_SDSPACE_FLAG,
- H5O_SHMESG_PLINE_FLAG,
- 0, 0};
-const unsigned test_minsizes[H5O_SHMESG_MAX_NINDEXES] = {0, 2, 40, 100, 3, 1000};
+const unsigned test_type_flags[H5O_SHMESG_MAX_NINDEXES] = {H5O_SHMESG_FILL_FLAG,
+ H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_ATTR_FLAG,
+ H5O_SHMESG_SDSPACE_FLAG,
+ H5O_SHMESG_PLINE_FLAG,
+ 0,
+ 0};
+const unsigned test_minsizes[H5O_SHMESG_MAX_NINDEXES] = {0, 2, 40, 100, 3, 1000};
#define TEST_L2B 65
#define TEST_B2L 64
-#define FILENAME "tsohm.h5"
-#define FILENAME_SRC "tsohm_src.h5"
-#define FILENAME_DST "tsohm_dst.h5"
+#define FILENAME "tsohm.h5"
+#define FILENAME_SRC "tsohm_src.h5"
+#define FILENAME_DST "tsohm_dst.h5"
#define NAME_BUF_SIZE 512
/* How much overhead counts as "not much" when converting B-trees, etc. */
#define OVERHEAD_ALLOWED 1.15F
-#define NUM_DATASETS 10
+#define NUM_DATASETS 10
#define NUM_ATTRIBUTES 100
typedef struct dtype1_struct {
- int i1;
- char str[10];
- int i2;
- int i3;
- int i4;
- int i5;
- int i6;
- int i7;
- int i8;
- float f1;
+ int i1;
+ char str[10];
+ int i2;
+ int i3;
+ int i4;
+ int i5;
+ int i6;
+ int i7;
+ int i8;
+ float f1;
} dtype1_struct;
#define DTYPE2_SIZE 1024
-const char *DSETNAME[] = {
- "dataset0", "dataset1",
- "dataset2", "dataset3",
- "dataset4", "dataset5",
- "dataset6", "dataset7",
- "dataset8", "dataset9",
- "dataset10", "dataset11",
- NULL
-};
-const char *EXTRA_DSETNAME[] = {
- "ex_dataset0", "ex_dataset1",
- "ex_dataset2", "ex_dataset3",
- "ex_dataset4", "ex_dataset5",
- "ex_dataset6", "ex_dataset7",
- "ex_dataset8", "ex_dataset9",
- "ex_dataset10", "ex_dataset11",
- "ex_dataset12", "ex_dataset13",
- "ex_dataset14", "ex_dataset15",
- "ex_dataset16", "ex_dataset17",
- "ex_dataset18", "ex_dataset19",
- NULL
-};
+const char *DSETNAME[] = {"dataset0", "dataset1", "dataset2", "dataset3", "dataset4",
+ "dataset5", "dataset6", "dataset7", "dataset8", "dataset9",
+ "dataset10", "dataset11", NULL};
+const char *EXTRA_DSETNAME[] = {"ex_dataset0", "ex_dataset1", "ex_dataset2",
+ "ex_dataset3", "ex_dataset4", "ex_dataset5",
+ "ex_dataset6", "ex_dataset7", "ex_dataset8",
+ "ex_dataset9", "ex_dataset10", "ex_dataset11",
+ "ex_dataset12", "ex_dataset13", "ex_dataset14",
+ "ex_dataset15", "ex_dataset16", "ex_dataset17",
+ "ex_dataset18", "ex_dataset19", NULL};
#define SOHM_HELPER_NUM_EX_DSETS 20
typedef struct complex_t {
- double re;
- double im;
+ double re;
+ double im;
} complex_t;
#define ENUM_NUM_MEMBS 20
-const char *ENUM_NAME[] = {
- "enum_member0", "enum_member1",
- "enum_member2", "enum_member3",
- "enum_member4", "enum_member5",
- "enum_member6", "enum_member7",
- "enum_member8", "enum_member9",
- "enum_member10", "enum_member11",
- "enum_member12", "enum_member13",
- "enum_member14", "enum_member15",
- "enum_member16", "enum_member17",
- "enum_member18", "enum_member19",
- NULL
-};
-const int ENUM_VAL[] = {
- 0, 13,
- -500, 63,
- 64, -64,
- 65, 2048,
- 1, 2,
- -1, 7,
- 130, -5000,
- 630, 640,
- -640, 650,
- 20480, 10,
- -1001, -10
-};
+const char *ENUM_NAME[] = {"enum_member0", "enum_member1", "enum_member2",
+ "enum_member3", "enum_member4", "enum_member5",
+ "enum_member6", "enum_member7", "enum_member8",
+ "enum_member9", "enum_member10", "enum_member11",
+ "enum_member12", "enum_member13", "enum_member14",
+ "enum_member15", "enum_member16", "enum_member17",
+ "enum_member18", "enum_member19", NULL};
+const int ENUM_VAL[] = {0, 13, -500, 63, 64, -64, 65, 2048, 1, 2, -1,
+ 7, 130, -5000, 630, 640, -640, 650, 20480, 10, -1001, -10};
#define SIZE2_RANK1 6
#define SIZE2_RANK2 10
-#define SIZE2_DIMS {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
+#define SIZE2_DIMS \
+ { \
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 \
+ }
-#define LONG_STRING "00 index. A long string used for testing. To create new strings, set the first two characters to be some ASCII number other than 00, such as 01."
+#define LONG_STRING \
+ "00 index. A long string used for testing. To create new strings, set the first two characters to be " \
+ "some ASCII number other than 00, such as 01."
/* Struct returned from size2_helper function */
typedef struct size2_helper_struct {
@@ -143,25 +119,27 @@ typedef struct size2_helper_struct {
} size2_helper_struct;
/* Number of distinct messages for the sohm_delete test */
-#define DELETE_NUM_MESGS 7
+#define DELETE_NUM_MESGS 7
#define HALF_DELETE_NUM_MESGS 3
-#define DELETE_DIMS {1,1,1,1,1,1,1}
+#define DELETE_DIMS \
+ { \
+ 1, 1, 1, 1, 1, 1, 1 \
+ }
#define DELETE_MIN_MESG_SIZE 10
#define DELETE_MAX_MESG_SIZE 60
-
/* Number of dimensions in extend_dset test */
#define EXTEND_NDIMS 2
/* Dimensions for external_dtype test */
-#define NX 10
-#define NY 10
+#define NX 10
+#define NY 10
/* Helper function prototypes */
static hid_t make_dtype_1(void);
static hid_t make_dtype_2(void);
-static hid_t close_reopen_file(hid_t file, const char* filename, hid_t fapl_id);
-static void test_sohm_attrs(void);
+static hid_t close_reopen_file(hid_t file, const char *filename, hid_t fapl_id);
+static void test_sohm_attrs(void);
#ifdef NOT_NOW
static void size2_dump_struct(const char *name, size2_helper_struct *sizes);
#endif /* NOT_NOW */
@@ -170,21 +148,20 @@ static void test_sohm_delete(void);
static void test_sohm_delete_revert(void);
static void test_sohm_extlink(void);
-
-
/****************************************************************
**
** verify_fcpl_values(): Verifies that FCPL is set as expected.
**
****************************************************************/
static void
-verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, const unsigned *flags_expected, const unsigned *minsizes_expected, unsigned l2b, unsigned b2l)
+verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, const unsigned *flags_expected,
+ const unsigned *minsizes_expected, unsigned l2b, unsigned b2l)
{
- unsigned nindexes_actual;
- unsigned list_size;
- unsigned btree_size;
- unsigned x;
- herr_t ret;
+ unsigned nindexes_actual;
+ unsigned list_size;
+ unsigned btree_size;
+ unsigned x;
+ herr_t ret;
/* Number of indexes */
ret = H5Pget_shared_mesg_nindexes(fcpl_id, &nindexes_actual);
@@ -192,7 +169,7 @@ verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, const unsign
VERIFY(nindexes_actual, nindexes_expected, "H5Pget_shared_mesg_nindexes");
/* Index flags and minsizes */
- for(x=0; x<nindexes_actual; ++x) {
+ for (x = 0; x < nindexes_actual; ++x) {
unsigned flags_i;
unsigned min_mesg_size;
ret = H5Pget_shared_mesg_index(fcpl_id, x, &flags_i, &min_mesg_size);
@@ -208,7 +185,6 @@ verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, const unsign
VERIFY(btree_size, b2l, "H5Pset_shared_mesg_phase_change");
} /* verify_fcpl_values */
-
/****************************************************************
**
** test_sohm_fcpl(): Test File Creation Property Lists.
@@ -217,8 +193,8 @@ verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, const unsign
static void
test_sohm_fcpl(void)
{
- hid_t fid = -1;
- hid_t fcpl_id = -1;
+ hid_t fid = -1;
+ hid_t fcpl_id = -1;
hid_t fcpl2_id = -1;
unsigned x;
herr_t ret;
@@ -265,7 +241,6 @@ test_sohm_fcpl(void)
ret = H5Fclose(fid);
CHECK_I(ret, "H5Fclose");
-
/* Start over with a non-default fcpl */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
@@ -273,7 +248,7 @@ test_sohm_fcpl(void)
/* Set up index values */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, TEST_NUM_INDEXES);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(x = 0; x < TEST_NUM_INDEXES; ++x) {
+ for (x = 0; x < TEST_NUM_INDEXES; ++x) {
ret = H5Pset_shared_mesg_index(fcpl_id, x, test_type_flags[x], test_minsizes[x]);
CHECK_I(ret, "H5Pset_shared_mesg_index");
} /* end for */
@@ -345,7 +320,6 @@ test_sohm_fcpl(void)
CHECK_I(ret, "H5Fclose");
} /* test_sohm_fcpl */
-
/****************************************************************
**
** test_sohm_fcpl_errors(): Test bogus FCPL settings for SOHMs
@@ -367,7 +341,7 @@ test_sohm_fcpl_errors(void)
/* Set up index values */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, TEST_NUM_INDEXES);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(x = 0; x < TEST_NUM_INDEXES; ++x) {
+ for (x = 0; x < TEST_NUM_INDEXES; ++x) {
ret = H5Pset_shared_mesg_index(fcpl_id, x, test_type_flags[x], test_minsizes[x]);
CHECK_I(ret, "H5Pset_shared_mesg_index");
}
@@ -377,7 +351,8 @@ test_sohm_fcpl_errors(void)
verify_fcpl_values(fcpl_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* Trying to create too many indexes should fail */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, H5O_SHMESG_MAX_NINDEXES + 1);
VERIFY(ret, -1, "H5Pset_shared_mesg_nindexes");
@@ -420,12 +395,13 @@ test_sohm_fcpl_errors(void)
VERIFY(ret, -1, "H5Pset_shared_mesg_phase_change");
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, H5O_SHMESG_MAX_LIST_SIZE + 10);
VERIFY(ret, -1, "H5Pset_shared_mesg_phase_change");
- ret = H5Pset_shared_mesg_phase_change(fcpl_id, H5O_SHMESG_MAX_LIST_SIZE, H5O_SHMESG_MAX_LIST_SIZE+1);
+ ret =
+ H5Pset_shared_mesg_phase_change(fcpl_id, H5O_SHMESG_MAX_LIST_SIZE, H5O_SHMESG_MAX_LIST_SIZE + 1);
VERIFY(ret, -1, "H5Pset_shared_mesg_phase_change");
- } H5E_END_TRY
+ }
+ H5E_END_TRY
} /* test_sohm_fcpl_errors */
-
/*-------------------------------------------------------------------------
* Function: make_dtype_1
*
@@ -445,39 +421,53 @@ static hid_t
make_dtype_1(void)
{
hid_t dtype1_id = -1;
- hid_t str_id = -1;
+ hid_t str_id = -1;
/* Create compound datatype. */
- if((dtype1_id = H5Tcreate(H5T_COMPOUND, sizeof(struct dtype1_struct))) < 0) TEST_ERROR
+ if ((dtype1_id = H5Tcreate(H5T_COMPOUND, sizeof(struct dtype1_struct))) < 0)
+ TEST_ERROR
- if(H5Tinsert(dtype1_id, "i1", HOFFSET(dtype1_struct, i1), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (H5Tinsert(dtype1_id, "i1", HOFFSET(dtype1_struct, i1), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
str_id = H5Tcopy(H5T_C_S1);
- if(H5Tset_size(str_id, (size_t)10) < 0) TEST_ERROR
-
- if(H5Tinsert(dtype1_id, "string", HOFFSET(dtype1_struct, str), str_id) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id, "i2", HOFFSET(dtype1_struct, i2), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id, "i3", HOFFSET(dtype1_struct, i3), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id, "i4", HOFFSET(dtype1_struct, i4), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id, "i5", HOFFSET(dtype1_struct, i5), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id, "i6", HOFFSET(dtype1_struct, i6), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id, "i7", HOFFSET(dtype1_struct, i7), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id, "i8", HOFFSET(dtype1_struct, i8), H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id, "f1", HOFFSET(dtype1_struct, f1), H5T_NATIVE_FLOAT) < 0) TEST_ERROR
-
- if(H5Tclose(str_id) < 0) TEST_ERROR
+ if (H5Tset_size(str_id, (size_t)10) < 0)
+ TEST_ERROR
+
+ if (H5Tinsert(dtype1_id, "string", HOFFSET(dtype1_struct, str), str_id) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype1_id, "i2", HOFFSET(dtype1_struct, i2), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype1_id, "i3", HOFFSET(dtype1_struct, i3), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype1_id, "i4", HOFFSET(dtype1_struct, i4), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype1_id, "i5", HOFFSET(dtype1_struct, i5), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype1_id, "i6", HOFFSET(dtype1_struct, i6), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype1_id, "i7", HOFFSET(dtype1_struct, i7), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype1_id, "i8", HOFFSET(dtype1_struct, i8), H5T_NATIVE_INT) < 0)
+ TEST_ERROR
+ if (H5Tinsert(dtype1_id, "f1", HOFFSET(dtype1_struct, f1), H5T_NATIVE_FLOAT) < 0)
+ TEST_ERROR
+
+ if (H5Tclose(str_id) < 0)
+ TEST_ERROR
return dtype1_id;
error:
- H5E_BEGIN_TRY {
- H5Tclose(str_id);
- H5Tclose(dtype1_id);
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(str_id);
+ H5Tclose(dtype1_id);
+ }
+ H5E_END_TRY
return -1;
} /* make_dtype1 */
-
/*-------------------------------------------------------------------------
* Function: make_dtype_2
*
@@ -498,50 +488,62 @@ error:
static hid_t
make_dtype_2(void)
{
- hid_t dtype2_id = -1;
- hid_t enum_id= -1;
- hid_t int_id=-1;
- int x;
+ hid_t dtype2_id = -1;
+ hid_t enum_id = -1;
+ hid_t int_id = -1;
+ int x;
hsize_t dims[] = {2, 1, 2, 4};
- size_t size;
+ size_t size;
/* Create an int with a strange precision */
- if((int_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tset_precision(int_id, (size_t)24) < 0) TEST_ERROR
+ if ((int_id = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ TEST_ERROR
+ if (H5Tset_precision(int_id, (size_t)24) < 0)
+ TEST_ERROR
/* Create an enumeration using that int */
- if((enum_id = H5Tenum_create(int_id)) < 0) TEST_ERROR
+ if ((enum_id = H5Tenum_create(int_id)) < 0)
+ TEST_ERROR
- for(x = 0; x < ENUM_NUM_MEMBS; x++)
- if(H5Tenum_insert(enum_id, ENUM_NAME[x], &ENUM_VAL[x]) < 0) TEST_ERROR
+ for (x = 0; x < ENUM_NUM_MEMBS; x++)
+ if (H5Tenum_insert(enum_id, ENUM_NAME[x], &ENUM_VAL[x]) < 0)
+ TEST_ERROR
/* Create arrays of arrays of arrays of enums */
- if((dtype2_id = H5Tarray_create2(enum_id, 3, dims)) < 0) TEST_ERROR
- if((dtype2_id = H5Tarray_create2(dtype2_id, 4, dims)) < 0) TEST_ERROR
- if((dtype2_id = H5Tarray_create2(dtype2_id, 2, dims)) < 0) TEST_ERROR
- if((dtype2_id = H5Tarray_create2(dtype2_id, 1, dims)) < 0) TEST_ERROR
-
- if(H5Tclose(enum_id) < 0) TEST_ERROR
- if(H5Tclose(int_id) < 0) TEST_ERROR
+ if ((dtype2_id = H5Tarray_create2(enum_id, 3, dims)) < 0)
+ TEST_ERROR
+ if ((dtype2_id = H5Tarray_create2(dtype2_id, 4, dims)) < 0)
+ TEST_ERROR
+ if ((dtype2_id = H5Tarray_create2(dtype2_id, 2, dims)) < 0)
+ TEST_ERROR
+ if ((dtype2_id = H5Tarray_create2(dtype2_id, 1, dims)) < 0)
+ TEST_ERROR
+
+ if (H5Tclose(enum_id) < 0)
+ TEST_ERROR
+ if (H5Tclose(int_id) < 0)
+ TEST_ERROR
/* Check the datatype size. If this is different than the #defined
* size then the fills values will have the wrong size.
*/
size = H5Tget_size(dtype2_id);
- if(size != DTYPE2_SIZE) TEST_ERROR
+ if (size != DTYPE2_SIZE)
+ TEST_ERROR
return dtype2_id;
error:
- H5E_BEGIN_TRY {
- H5Tclose(dtype2_id);
- H5Tclose(enum_id);
- H5Tclose(int_id);
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(dtype2_id);
+ H5Tclose(enum_id);
+ H5Tclose(int_id);
+ }
+ H5E_END_TRY
return -1;
} /* make_dtype2 */
-
/*-------------------------------------------------------------------------
* Function: close_reopen_file
*
@@ -559,20 +561,19 @@ error:
*-------------------------------------------------------------------------
*/
static hid_t
-close_reopen_file(hid_t file, const char* filename, hid_t fapl_id)
+close_reopen_file(hid_t file, const char *filename, hid_t fapl_id)
{
if (H5Fclose(file) < 0)
FAIL_STACK_ERROR
file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
if (file < 0)
FAIL_STACK_ERROR
- return(file);
+ return (file);
error:
return -1;
} /* close_reopen_file */
-
/*-------------------------------------------------------------------------
* Function: size1_helper
*
@@ -595,11 +596,11 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_
{
dtype1_struct wdata;
dtype1_struct rdata;
- hid_t dtype1_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t dset_id = H5I_INVALID_HID;
- hsize_t dim1[1];
- int x;
+ hid_t dtype1_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hsize_t dim1[1];
+ int x;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Macro: TSOHM_S1H_VERIFY_DATA
@@ -612,26 +613,28 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_
* 2018 November 1
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
-#define TSOHM_S1H_VERIFY_DATA(dset_id, dtype_id) \
-{ \
- HDmemset(&rdata, 0, sizeof(rdata)); \
- if (0 > H5Dread((dset_id), (dtype_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata)) { \
- H5_FAILED(); AT(); \
- HDprintf("Can't read data\n"); \
- goto error; \
- } \
- if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str)) { \
- H5_FAILED(); AT(); \
- HDprintf("incorrect read data\n"); \
- goto error; \
- } \
-} /* TSOHM_S1H_VERIFY_DATA() definition */
+#define TSOHM_S1H_VERIFY_DATA(dset_id, dtype_id) \
+ { \
+ HDmemset(&rdata, 0, sizeof(rdata)); \
+ if (0 > H5Dread((dset_id), (dtype_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata)) { \
+ H5_FAILED(); \
+ AT(); \
+ HDprintf("Can't read data\n"); \
+ goto error; \
+ } \
+ if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str)) { \
+ H5_FAILED(); \
+ AT(); \
+ HDprintf("incorrect read data\n"); \
+ goto error; \
+ } \
+ } /* TSOHM_S1H_VERIFY_DATA() definition */
/* Closing and re-opening the file takes a long time on systems without
* local disks. Don't close and reopen if express testing is enabled.
*/
- if(GetTestExpress() > 1)
- test_file_closing = FALSE;
+ if (GetTestExpress() > 1)
+ test_file_closing = FALSE;
/* Intialize wdata */
HDmemset(&wdata, 0, sizeof(wdata));
@@ -650,86 +653,111 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_
HDmemset(&rdata, 0, sizeof(rdata));
dtype1_id = make_dtype_1();
- if(dtype1_id < 0) TEST_ERROR
+ if (dtype1_id < 0)
+ TEST_ERROR
- dim1[0] = 1;
+ dim1[0] = 1;
space_id = H5Screate_simple(1, dim1, NULL);
- if(space_id < 0) TEST_ERROR
+ if (space_id < 0)
+ TEST_ERROR
dset_id = H5Dcreate2(file, DSETNAME[0], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset_id < 0) FAIL_STACK_ERROR
+ if (dset_id < 0)
+ FAIL_STACK_ERROR
/* Test writing and reading */
- if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ FAIL_STACK_ERROR
TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id)
- if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR
- if(test_file_closing)
- if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
+ if (test_file_closing)
+ if ((file = close_reopen_file(file, filename, fapl_id)) < 0)
+ TEST_ERROR
/* Create 3 more datasets with the same datatype/dataspace */
for (x = 1; x < 4; x++) {
dset_id = H5Dcreate2(file, DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (0 > dset_id) FAIL_STACK_ERROR
+ if (0 > dset_id)
+ FAIL_STACK_ERROR
if (x == 3)
- if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) TEST_ERROR
- if (H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR
if (test_file_closing)
- if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
+ if ((file = close_reopen_file(file, filename, fapl_id)) < 0)
+ TEST_ERROR
}
- if(H5Tclose(dtype1_id) < 0) TEST_ERROR
+ if (H5Tclose(dtype1_id) < 0)
+ TEST_ERROR
/* Make sure the data has been written successfully */
dset_id = H5Dopen2(file, DSETNAME[0], H5P_DEFAULT);
- if(dset_id < 0) TEST_ERROR
+ if (dset_id < 0)
+ TEST_ERROR
dtype1_id = H5Dget_type(dset_id);
- if(dtype1_id < 0) TEST_ERROR
+ if (dtype1_id < 0)
+ TEST_ERROR
TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id)
- if(H5Dclose(dset_id) < 0) TEST_ERROR
+ if (H5Dclose(dset_id) < 0)
+ TEST_ERROR
/* Create several copies of the dataset
* this increases the amount of space saved by sharing the datatype message
*/
- for(x = 0; x < SOHM_HELPER_NUM_EX_DSETS; x++) {
- dset_id = H5Dcreate2(file, EXTRA_DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset_id < 0) TEST_ERROR
- if(H5Dclose(dset_id) < 0) TEST_ERROR
+ for (x = 0; x < SOHM_HELPER_NUM_EX_DSETS; x++) {
+ dset_id =
+ H5Dcreate2(file, EXTRA_DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset_id < 0)
+ TEST_ERROR
+ if (H5Dclose(dset_id) < 0)
+ TEST_ERROR
- if(test_file_closing)
- if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
+ if (test_file_closing)
+ if ((file = close_reopen_file(file, filename, fapl_id)) < 0)
+ TEST_ERROR
}
- if(H5Tclose(dtype1_id) < 0) TEST_ERROR
- if(H5Sclose(space_id) < 0) TEST_ERROR
+ if (H5Tclose(dtype1_id) < 0)
+ TEST_ERROR
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR
/* Ensure that we can still read data back from dataset 3 */
dset_id = H5Dopen2(file, DSETNAME[3], H5P_DEFAULT);
- if(dset_id < 0) TEST_ERROR
+ if (dset_id < 0)
+ TEST_ERROR
dtype1_id = H5Dget_type(dset_id);
- if(dtype1_id < 0) TEST_ERROR
+ if (dtype1_id < 0)
+ TEST_ERROR
TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id)
- if(H5Dclose(dset_id) < 0) TEST_ERROR
- if(H5Tclose(dtype1_id) < 0) TEST_ERROR
+ if (H5Dclose(dset_id) < 0)
+ TEST_ERROR
+ if (H5Tclose(dtype1_id) < 0)
+ TEST_ERROR
return file;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Sclose(space_id);
H5Tclose(dtype1_id);
H5Dclose(dset_id);
H5Fclose(file);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return H5I_INVALID_HID;
#undef TSOHM_S1H_VERIFY_DATA /* macro is exclusive to this function */
} /* size1_helper */
-
/*----------------------------------------------------------------------------
* Function: getsize_testsize1
*
@@ -742,10 +770,10 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_
*----------------------------------------------------------------------------
*/
static h5_stat_size_t
-getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id,
- hbool_t test_file_closing, H5O_native_info_t *ninfo)
+getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, hbool_t test_file_closing,
+ H5O_native_info_t *ninfo)
{
- hid_t fid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
herr_t ret;
fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
@@ -767,7 +795,6 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id,
return h5_get_file_size(filename, fapl_id);
} /* getsize_testsize1() */
-
/*-------------------------------------------------------------------------
* Function: test_sohm_size1
*
@@ -781,18 +808,18 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id,
static void
test_sohm_size1(void)
{
- hid_t file = -1;
- hid_t fcpl_id = -1;
- hid_t fapl_id = -1;
+ hid_t file = -1;
+ hid_t fcpl_id = -1;
+ hid_t fapl_id = -1;
unsigned use_shared = 0;
- unsigned use_btree = 0;
+ unsigned use_btree = 0;
h5_stat_size_t file_sizes[9];
unsigned size_index = 0;
hsize_t oh_sizes[3];
unsigned oh_size_index = 0;
-#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */
+#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */
hsize_t norm_oh_size;
#endif /* Jira HDFFV-10646 */
hsize_t sohm_oh_size;
@@ -807,13 +834,13 @@ test_sohm_size1(void)
h5_stat_size_t sohm_final_filesize2;
h5_stat_size_t sohm_btree_final_filesize2;
- H5O_native_info_t ninfo;
- unsigned num_indexes = 1;
- unsigned index_flags = H5O_SHMESG_DTYPE_FLAG;
- unsigned min_mesg_size = 50;
- unsigned list_max = 11;
- unsigned btree_min = 10;
- herr_t ret;
+ H5O_native_info_t ninfo;
+ unsigned num_indexes = 1;
+ unsigned index_flags = H5O_SHMESG_DTYPE_FLAG;
+ unsigned min_mesg_size = 50;
+ unsigned list_max = 11;
+ unsigned btree_min = 10;
+ herr_t ret;
MESSAGE(5, ("Testing that shared datatypes save space\n"));
@@ -847,11 +874,13 @@ test_sohm_size1(void)
if (use_btree) {
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
- } else {
+ }
+ else {
ret = H5Pset_shared_mesg_phase_change(fcpl_id, list_max, btree_min);
}
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- } else {
+ }
+ else {
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 0);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
}
@@ -865,16 +894,16 @@ test_sohm_size1(void)
file_sizes[size_index++] = h5_get_file_size(FILENAME, fapl_id);
/* size of populated file, with different populating behaviors */
- test_open_close = TRUE;
+ test_open_close = TRUE;
file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo);
- test_open_close = FALSE;
+ test_open_close = FALSE;
file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo);
oh_sizes[oh_size_index++] = ninfo.hdr.space.total;
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
} /* for btree/listed messages */
- } /* for normal/shared messages */
+ } /* for normal/shared messages */
ret = H5Pclose(fapl_id);
CHECK_I(ret, "H5Pclose");
@@ -890,29 +919,29 @@ test_sohm_size1(void)
/* Put result sizes into human-readable symbolic names.
* Order dependent on loop execution above.
*/
- norm_empty_filesize = file_sizes[0];
- norm_final_filesize = file_sizes[1];
+ norm_empty_filesize = file_sizes[0];
+ norm_final_filesize = file_sizes[1];
norm_final_filesize2 = file_sizes[2];
-#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */
+#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */
norm_oh_size = oh_sizes[0];
#endif /* Jira HDFFV-10646 */
- sohm_empty_filesize = file_sizes[3];
- sohm_final_filesize = file_sizes[4];
+ sohm_empty_filesize = file_sizes[3];
+ sohm_final_filesize = file_sizes[4];
sohm_final_filesize2 = file_sizes[5];
- sohm_oh_size = oh_sizes[1];
+ sohm_oh_size = oh_sizes[1];
- sohm_btree_empty_filesize = file_sizes[6];
- sohm_btree_final_filesize = file_sizes[7];
+ sohm_btree_empty_filesize = file_sizes[6];
+ sohm_btree_final_filesize = file_sizes[7];
sohm_btree_final_filesize2 = file_sizes[8];
- sohm_btree_oh_size = oh_sizes[2];
+ sohm_btree_oh_size = oh_sizes[2];
/* How the SOHM messages are stored shouldn't affect the
* size of the object header.
*/
VERIFY(sohm_btree_oh_size, sohm_oh_size, "H5Oget_info_by_name");
-#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */
+#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */
/* Object headers in SOHM files should be smaller than normal object
* headers.
*/
@@ -926,31 +955,30 @@ test_sohm_size1(void)
* The sizes here shouldn't really be 1; it's just used to ensure that the
* error code triggers.
*/
- if(sohm_empty_filesize <= norm_empty_filesize)
+ if (sohm_empty_filesize <= norm_empty_filesize)
VERIFY(sohm_empty_filesize, 1, "h5_get_file_size");
- if(sohm_btree_empty_filesize <= norm_empty_filesize)
+ if (sohm_btree_empty_filesize <= norm_empty_filesize)
VERIFY(sohm_btree_empty_filesize, 1, "h5_get_file_size");
/* When full, the sohm btree file should be smaller than the normal file.
* The sohm list file should be at least as small, since it doesn't need
* the overhead of a B-tree.
*/
- if(sohm_btree_final_filesize >= norm_final_filesize)
+ if (sohm_btree_final_filesize >= norm_final_filesize)
VERIFY(sohm_btree_final_filesize, 1, "h5_get_file_size");
- if(sohm_final_filesize > sohm_btree_final_filesize)
+ if (sohm_final_filesize > sohm_btree_final_filesize)
VERIFY(sohm_final_filesize, 1, "h5_get_file_size");
/* Comparative sizes shouldn't change even if we open and close the file
*/
- if(sohm_btree_final_filesize2 >= norm_final_filesize2)
+ if (sohm_btree_final_filesize2 >= norm_final_filesize2)
VERIFY(sohm_btree_final_filesize2, 1, "h5_get_file_size");
- if(sohm_final_filesize2 > sohm_btree_final_filesize2)
+ if (sohm_final_filesize2 > sohm_btree_final_filesize2)
VERIFY(sohm_final_filesize2, 1, "h5_get_file_size");
} /* test_sohm_size1 */
-
/*---------------------------------------------------------------------------
* Function: test_sohm_size_consistency_open_create
*
@@ -964,7 +992,7 @@ test_sohm_size1(void)
*
*---------------------------------------------------------------------------
*/
-#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */
+#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */
static void
test_sohm_size_consistency_open_create(void)
{
@@ -1057,7 +1085,6 @@ test_sohm_size_consistency_open_create(void)
} /* test_sohm_size_consistency_open_create */
#endif /* Jira HDFFV-10645 */
-
/*-------------------------------------------------------------------------
* Function: sohm_attr_helper
*
@@ -1076,14 +1103,14 @@ test_sohm_size_consistency_open_create(void)
static void
sohm_attr_helper(hid_t fcpl_id)
{
- hid_t file_id;
- hid_t space_id;
- hsize_t dims = 2;
- int wdata[2] = {7, 42};
- int rdata[2];
- herr_t ret;
- size_t x;
- unsigned op_index=0;
+ hid_t file_id;
+ hid_t space_id;
+ hsize_t dims = 2;
+ int wdata[2] = {7, 42};
+ int rdata[2];
+ herr_t ret;
+ size_t x;
+ unsigned op_index = 0;
#define TSOHM_SAH_OP_COUNT 3
const char *groupnames[TSOHM_SAH_OP_COUNT] = {
"group_for_nothing_special",
@@ -1150,12 +1177,12 @@ sohm_attr_helper(hid_t fcpl_id)
HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_read_id, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x = 0; x < (size_t)dims; ++x)
+ for (x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
ret = H5Aclose(attr_id);
CHECK_I(ret, "H5Aclose");
- if (attr_id2 > -1 ) {
+ if (attr_id2 > -1) {
ret = H5Aclose(attr_id2);
CHECK_I(ret, "H5Aclose");
}
@@ -1168,7 +1195,6 @@ sohm_attr_helper(hid_t fcpl_id)
#undef TSOHM_SAH_OP_COUNT
} /* sohm_attr_helper */
-
/*-------------------------------------------------------------------------
* Function: test_sohm_attrs
*
@@ -1186,9 +1212,9 @@ sohm_attr_helper(hid_t fcpl_id)
static void
test_sohm_attrs(void)
{
- hid_t bad_fid = H5I_INVALID_HID;
- hid_t fcpl_id = H5I_INVALID_HID;
- unsigned i = 0;
+ hid_t bad_fid = H5I_INVALID_HID;
+ hid_t fcpl_id = H5I_INVALID_HID;
+ unsigned i = 0;
#define TSOHM_TSA_NFLAGS_1 7
unsigned flags1[TSOHM_TSA_NFLAGS_1] = {
H5O_SHMESG_ATTR_FLAG,
@@ -1201,44 +1227,55 @@ test_sohm_attrs(void)
};
#define TSOHM_TSA_NFLAGS_2 6
unsigned flags2[TSOHM_TSA_NFLAGS_2][2] = {
- { H5O_SHMESG_ATTR_FLAG,
+ {
+ H5O_SHMESG_ATTR_FLAG,
H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG,
},
- { H5O_SHMESG_SDSPACE_FLAG,
+ {
+ H5O_SHMESG_SDSPACE_FLAG,
H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG,
},
- { H5O_SHMESG_DTYPE_FLAG,
+ {
+ H5O_SHMESG_DTYPE_FLAG,
H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG,
},
- { H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ {
+ H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG,
H5O_SHMESG_ATTR_FLAG,
},
- { H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ {
+ H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG,
H5O_SHMESG_SDSPACE_FLAG,
},
- { H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG,
+ {
+ H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG,
H5O_SHMESG_DTYPE_FLAG,
},
};
#define TSOHM_TSA_NFLAGS_3 5
unsigned flags3[TSOHM_TSA_NFLAGS_3][3] = {
- { H5O_SHMESG_ATTR_FLAG,
+ {
+ H5O_SHMESG_ATTR_FLAG,
H5O_SHMESG_SDSPACE_FLAG,
H5O_SHMESG_DTYPE_FLAG,
},
- { H5O_SHMESG_DTYPE_FLAG,
+ {
+ H5O_SHMESG_DTYPE_FLAG,
H5O_SHMESG_ATTR_FLAG,
H5O_SHMESG_SDSPACE_FLAG,
},
- { H5O_SHMESG_SDSPACE_FLAG,
+ {
+ H5O_SHMESG_SDSPACE_FLAG,
H5O_SHMESG_DTYPE_FLAG,
H5O_SHMESG_ATTR_FLAG,
},
- { 0, /* first index does not hold a shared message type? */
+ {
+ 0, /* first index does not hold a shared message type? */
H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG,
H5O_SHMESG_ATTR_FLAG,
},
- { 0, /* missing SDSPACE flag */
+ {
+ 0, /* missing SDSPACE flag */
H5O_SHMESG_DTYPE_FLAG,
H5O_SHMESG_ATTR_FLAG,
},
@@ -1261,7 +1298,7 @@ test_sohm_attrs(void)
/* One shared message index
*/
- for (i=0; i < TSOHM_TSA_NFLAGS_1; i++) {
+ for (i = 0; i < TSOHM_TSA_NFLAGS_1; i++) {
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
@@ -1277,7 +1314,7 @@ test_sohm_attrs(void)
/* two shared message indices
*/
- for (i=0; i < TSOHM_TSA_NFLAGS_2; i++) {
+ for (i = 0; i < TSOHM_TSA_NFLAGS_2; i++) {
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2);
@@ -1295,7 +1332,8 @@ test_sohm_attrs(void)
/* duplicate flags in separate indices causes problems
*/
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2);
@@ -1310,11 +1348,12 @@ test_sohm_attrs(void)
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* three shared message indices
*/
- for (i=0; i < TSOHM_TSA_NFLAGS_3; i++) {
+ for (i = 0; i < TSOHM_TSA_NFLAGS_3; i++) {
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 3);
@@ -1338,7 +1377,6 @@ test_sohm_attrs(void)
} /* test_sohm_attrs */
-
/*-------------------------------------------------------------------------
* Function: size2_verify_plist1
*
@@ -1354,41 +1392,40 @@ test_sohm_attrs(void)
static void
size2_verify_plist1(hid_t plist)
{
- size_t cd_nelmts;
- unsigned int cd_value;
- char name[NAME_BUF_SIZE];
- H5Z_filter_t filter;
- hid_t dtype1_id;
+ size_t cd_nelmts;
+ unsigned int cd_value;
+ char name[NAME_BUF_SIZE];
+ H5Z_filter_t filter;
+ hid_t dtype1_id;
dtype1_struct fill1;
dtype1_struct fill1_correct;
- herr_t ret;
+ herr_t ret;
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_FLETCHER32, "H5Pget_filter2");
-
/* Check fill value */
- dtype1_id=make_dtype_1();
+ dtype1_id = make_dtype_1();
CHECK_I(dtype1_id, "make_dtype_1");
HDmemset(&fill1_correct, '1', sizeof(fill1_correct));
@@ -1402,7 +1439,6 @@ size2_verify_plist1(hid_t plist)
CHECK_I(ret, "H5Tclose");
} /* size2_verify_plist1 */
-
/*-------------------------------------------------------------------------
* Function: size2_verify_plist2
*
@@ -1418,48 +1454,47 @@ size2_verify_plist1(hid_t plist)
static void
size2_verify_plist2(hid_t plist)
{
- size_t cd_nelmts;
+ size_t cd_nelmts;
unsigned int cd_value;
- char name[NAME_BUF_SIZE];
+ char name[NAME_BUF_SIZE];
H5Z_filter_t filter;
- hid_t dtype2_id;
- char fill2[DTYPE2_SIZE];
- char fill2_correct[DTYPE2_SIZE];
- herr_t ret;
+ hid_t dtype2_id;
+ char fill2[DTYPE2_SIZE];
+ char fill2_correct[DTYPE2_SIZE];
+ herr_t ret;
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 4, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 4, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 5, "H5Pget_filter2");
-
/* Check fill value */
dtype2_id = make_dtype_2();
CHECK_I(dtype2_id, "make_dtype_2");
@@ -1476,7 +1511,7 @@ size2_verify_plist2(hid_t plist)
} /* size2_verify_plist2 */
#ifdef NOT_NOW
-
+
/*-------------------------------------------------------------------------
* Function: size2_dump_struct
*
@@ -1494,19 +1529,25 @@ size2_verify_plist2(hid_t plist)
static void
size2_dump_struct(const char *name, size2_helper_struct *sizes)
{
- HDputs(name);
- HDprintf(" empty size: %llu\n", (unsigned long long)sizes->empty_size);
- HDprintf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size));
- HDprintf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset));
- HDprintf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset));
- HDprintf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1));
- HDprintf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2));
- HDprintf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved));
- HDprintf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1));
+ HDputs(name);
+ HDprintf(" empty size: %llu\n", (unsigned long long)sizes->empty_size);
+ HDprintf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset,
+ (unsigned long long)(sizes->first_dset - sizes->empty_size));
+ HDprintf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset,
+ (unsigned long long)(sizes->second_dset - sizes->first_dset));
+ HDprintf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1,
+ (unsigned long long)(sizes->dsets1 - sizes->second_dset));
+ HDprintf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2,
+ (unsigned long long)(sizes->dsets2 - sizes->dsets1));
+ HDprintf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved,
+ (unsigned long long)(sizes->interleaved - sizes->dsets2));
+ HDprintf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1,
+ (unsigned long long)(sizes->attrs1 - sizes->interleaved));
+ HDprintf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2,
+ (unsigned long long)(sizes->attrs2 - sizes->attrs1));
} /* size2_dump_struct */
#endif /* NOT_NOW */
-
/*-------------------------------------------------------------------------
* Function: size2_helper
*
@@ -1532,35 +1573,35 @@ size2_dump_struct(const char *name, size2_helper_struct *sizes)
static int
size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_sizes)
{
- hid_t file_id = -1;
- hid_t dtype1_id = -1;
- hid_t dtype2_id = -1;
- hid_t dspace1_id = -1;
- hid_t dspace2_id = -1;
- hid_t dcpl1_id = -1;
- hid_t dcpl2_id = -1;
- hid_t dset_id = -1;
- hid_t attr_type_id = -1;
- hid_t attr_space_id = -1;
- hid_t attr_id = -1;
- hid_t group_id = -1;
- char attr_string1[NAME_BUF_SIZE];
- char attr_string2[NAME_BUF_SIZE];
- char attr_name[NAME_BUF_SIZE];
- int x;
+ hid_t file_id = -1;
+ hid_t dtype1_id = -1;
+ hid_t dtype2_id = -1;
+ hid_t dspace1_id = -1;
+ hid_t dspace2_id = -1;
+ hid_t dcpl1_id = -1;
+ hid_t dcpl2_id = -1;
+ hid_t dset_id = -1;
+ hid_t attr_type_id = -1;
+ hid_t attr_space_id = -1;
+ hid_t attr_id = -1;
+ hid_t group_id = -1;
+ char attr_string1[NAME_BUF_SIZE];
+ char attr_string2[NAME_BUF_SIZE];
+ char attr_name[NAME_BUF_SIZE];
+ int x;
herr_t ret;
/* Constants used in this function */
- const int rank1 = SIZE2_RANK1;
- const int rank2 = SIZE2_RANK2;
+ const int rank1 = SIZE2_RANK1;
+ const int rank2 = SIZE2_RANK2;
const hsize_t dims[SIZE2_RANK2] = SIZE2_DIMS;
dtype1_struct fill1;
- char fill2[DTYPE2_SIZE];
+ char fill2[DTYPE2_SIZE];
/* Closing and re-opening the file takes a long time on systems without
* local disks. Don't close and reopen if express testing is enabled.
*/
- if(GetTestExpress() > 1)
+ if (GetTestExpress() > 1)
test_file_closing = 0;
/* Create a file and get its size */
@@ -1640,7 +1681,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
HDmemset(attr_string2, 0, (size_t)NAME_BUF_SIZE);
HDstrcpy(attr_string1, LONG_STRING);
HDstrcpy(attr_string2, LONG_STRING);
- attr_string2[1] = '1'; /* The second string starts "01 index..." */
+ attr_string2[1] = '1'; /* The second string starts "01 index..." */
/* Set up attribute metadata */
attr_type_id = H5Tcopy(H5T_C_S1);
@@ -1653,7 +1694,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
/* Create datasets with a big datatype, dataspace, fill value,
* and filter pipeline.
*/
- for(x = 0; x < NUM_DATASETS; ++x) {
+ for (x = 0; x < NUM_DATASETS; ++x) {
dset_id = H5Dcreate2(file_id, DSETNAME[x], dtype1_id, dspace1_id, H5P_DEFAULT, dcpl1_id, H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
@@ -1668,12 +1709,12 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(ret, "H5Dclose");
/* Gather extra statistics on first two datasets in file */
- if(x < 2) {
+ if (x < 2) {
ret = H5Fclose(file_id);
CHECK_I(ret, "H5Fclose");
/* Get the file's size now */
- if(x == 0)
+ if (x == 0)
ret_sizes->first_dset = h5_get_file_size(FILENAME, H5P_DEFAULT);
else
ret_sizes->second_dset = h5_get_file_size(FILENAME, H5P_DEFAULT);
@@ -1682,18 +1723,17 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(file_id, "H5Fopen");
} /* end if */
/* Close & reopen file if requested */
- else if(test_file_closing) {
+ else if (test_file_closing) {
file_id = close_reopen_file(file_id, FILENAME, H5P_DEFAULT);
CHECK_I(file_id, "H5Fopen");
} /* end if */
- } /* end for */
+ } /* end for */
/* Close file and get its size now */
ret = H5Fclose(file_id);
CHECK_I(ret, "H5Fclose");
ret_sizes->dsets1 = h5_get_file_size(FILENAME, H5P_DEFAULT);
-
/* Create new group filled with datasets that use all different messages */
file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK_I(file_id, "H5Fopen");
@@ -1701,8 +1741,9 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(group_id, "H5Gcreate2");
/* Create NUM_DATASETS datasets in the new group */
- for(x=0; x<NUM_DATASETS; ++x) {
- dset_id = H5Dcreate2(group_id, DSETNAME[x], dtype2_id, dspace2_id, H5P_DEFAULT, dcpl2_id, H5P_DEFAULT);
+ for (x = 0; x < NUM_DATASETS; ++x) {
+ dset_id =
+ H5Dcreate2(group_id, DSETNAME[x], dtype2_id, dspace2_id, H5P_DEFAULT, dcpl2_id, H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
attr_id = H5Acreate2(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT);
@@ -1716,7 +1757,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(ret, "H5Aclose");
/* Close everything & reopen file if requested */
- if(test_file_closing) {
+ if (test_file_closing) {
ret = H5Gclose(group_id);
CHECK_I(ret, "H5Gclose");
file_id = close_reopen_file(file_id, FILENAME, H5P_DEFAULT);
@@ -1733,7 +1774,6 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(ret, "H5Fclose");
ret_sizes->dsets2 = h5_get_file_size(FILENAME, H5P_DEFAULT);
-
/* Create a new group and interleave writes of datasets types 1 and 2. */
file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK_I(file_id, "H5Fopen");
@@ -1741,9 +1781,9 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(group_id, "H5Gcreate2");
/* Create NUM_DATASETS datasets in the new group */
- for(x=0; x<NUM_DATASETS; x+=2)
- {
- dset_id = H5Dcreate2(group_id, DSETNAME[x], dtype1_id, dspace1_id, H5P_DEFAULT, dcpl1_id, H5P_DEFAULT);
+ for (x = 0; x < NUM_DATASETS; x += 2) {
+ dset_id =
+ H5Dcreate2(group_id, DSETNAME[x], dtype1_id, dspace1_id, H5P_DEFAULT, dcpl1_id, H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
attr_id = H5Acreate2(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT);
@@ -1756,7 +1796,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
ret = H5Aclose(attr_id);
CHECK_I(ret, "H5Aclose");
- dset_id = H5Dcreate2(group_id, DSETNAME[x+1], dtype2_id, dspace2_id, H5P_DEFAULT, dcpl2_id, H5P_DEFAULT);
+ dset_id =
+ H5Dcreate2(group_id, DSETNAME[x + 1], dtype2_id, dspace2_id, H5P_DEFAULT, dcpl2_id, H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
attr_id = H5Acreate2(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT);
@@ -1770,7 +1811,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(ret, "H5Aclose");
/* Close everything & reopen file if requested */
- if(test_file_closing) {
+ if (test_file_closing) {
ret = H5Gclose(group_id);
CHECK_I(ret, "H5Gclose");
file_id = close_reopen_file(file_id, FILENAME, H5P_DEFAULT);
@@ -1797,7 +1838,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
HDstrcpy(attr_name, "00 index");
- for(x = 0; x < NUM_ATTRIBUTES; ++x) {
+ for (x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create a unique name and value for each attribute */
attr_string1[0] = attr_name[0] = (char)((x / 10) + '0');
attr_string1[1] = attr_name[1] = (char)((x % 10) + '0');
@@ -1812,7 +1853,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(ret, "H5Aclose");
/* Close everything & reopen file if requested */
- if(test_file_closing) {
+ if (test_file_closing) {
ret = H5Gclose(group_id);
CHECK_I(ret, "H5Gclose");
file_id = close_reopen_file(file_id, FILENAME, H5P_DEFAULT);
@@ -1829,15 +1870,13 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(ret, "H5Fclose");
ret_sizes->attrs1 = h5_get_file_size(FILENAME, H5P_DEFAULT);
-
/* Create all of the attributes again on the other group */
file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK_I(file_id, "H5Fopen");
group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT);
CHECK_I(group_id, "H5Gopen2");
- for(x=0; x<NUM_ATTRIBUTES; ++x)
- {
+ for (x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create the same name and value for each attribute as before */
attr_string1[0] = attr_name[0] = (char)((x / 10) + '0');
attr_string1[1] = attr_name[1] = (char)((x % 10) + '0');
@@ -1852,7 +1891,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(ret, "H5Aclose");
/* Close everything & reopen file if requested */
- if(test_file_closing) {
+ if (test_file_closing) {
ret = H5Gclose(group_id);
CHECK_I(ret, "H5Gclose");
file_id = close_reopen_file(file_id, FILENAME, H5P_DEFAULT);
@@ -1868,7 +1907,6 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(ret, "H5Fclose");
ret_sizes->attrs2 = h5_get_file_size(FILENAME, H5P_DEFAULT);
-
/* Close everything */
ret = H5Sclose(attr_space_id);
CHECK_I(ret, "H5Sclose");
@@ -1890,7 +1928,6 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
return 0;
} /* size2_helper */
-
/*-------------------------------------------------------------------------
* Function: size2_verify
*
@@ -1908,30 +1945,29 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
static void
size2_verify(void)
{
- hid_t file_id = -1;
- hid_t dset_id=-1;
- hid_t plist_id=-1;
- hid_t space_id=-1;
- hid_t group1_id, group2_id;
- hid_t attr1_id, attr2_id;
- hid_t attr_type_id;
- int x, y;
- herr_t ret;
- char attr_string[NAME_BUF_SIZE];
- char attr_correct_string[NAME_BUF_SIZE];
- char attr_name[NAME_BUF_SIZE];
- int ndims;
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t plist_id = -1;
+ hid_t space_id = -1;
+ hid_t group1_id, group2_id;
+ hid_t attr1_id, attr2_id;
+ hid_t attr_type_id;
+ int x, y;
+ herr_t ret;
+ char attr_string[NAME_BUF_SIZE];
+ char attr_correct_string[NAME_BUF_SIZE];
+ char attr_name[NAME_BUF_SIZE];
+ int ndims;
hsize_t dims[SIZE2_RANK2];
hsize_t correct_dims[SIZE2_RANK2] = SIZE2_DIMS;
file_id = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK_I(file_id, "H5Fopen");
-
/* Verify property lists and dataspaces */
/* Get property lists from first batch of datasets */
- for(x = 0; x < NUM_DATASETS; ++x) {
+ for (x = 0; x < NUM_DATASETS; ++x) {
dset_id = H5Dopen2(file_id, DSETNAME[x], H5P_DEFAULT);
CHECK_I(dset_id, "H5Dopen2");
plist_id = H5Dget_create_plist(dset_id);
@@ -1945,7 +1981,7 @@ size2_verify(void)
ndims = H5Sget_simple_extent_dims(space_id, dims, NULL);
CHECK_I(ndims, "H5Sget_simple_extent_dims");
VERIFY(ndims, SIZE2_RANK1, "H5Sget_simple_extent_dims");
- for(y = 0; y < ndims; ++y)
+ for (y = 0; y < ndims; ++y)
VERIFY(dims[y], correct_dims[y], "H5Sget_simple_extent_dims");
ret = H5Sclose(space_id);
@@ -1958,7 +1994,7 @@ size2_verify(void)
/* Get property lists from second batch of datasets */
group1_id = H5Gopen2(file_id, "group", H5P_DEFAULT);
CHECK_I(group1_id, "H5Gopen2");
- for(x = 0; x < NUM_DATASETS; ++x) {
+ for (x = 0; x < NUM_DATASETS; ++x) {
dset_id = H5Dopen2(group1_id, DSETNAME[x], H5P_DEFAULT);
CHECK_I(dset_id, "H5Dopen2");
plist_id = H5Dget_create_plist(dset_id);
@@ -1972,7 +2008,7 @@ size2_verify(void)
ndims = H5Sget_simple_extent_dims(space_id, dims, NULL);
CHECK_I(ndims, "H5Sget_simple_extent_dims");
VERIFY(ndims, SIZE2_RANK2, "H5Sget_simple_extent_dims");
- for(y = 0; y < ndims; ++y)
+ for (y = 0; y < ndims; ++y)
VERIFY(dims[y], correct_dims[y], "H5Sget_simple_extent_dims");
ret = H5Sclose(space_id);
@@ -1987,7 +2023,7 @@ size2_verify(void)
/* Get property lists from interleaved group of datasets */
group1_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT);
CHECK_I(group1_id, "H5Gopen2");
- for(x = 0; x < NUM_DATASETS; x += 2) {
+ for (x = 0; x < NUM_DATASETS; x += 2) {
/* First "type 1" dataset */
dset_id = H5Dopen2(group1_id, DSETNAME[x], H5P_DEFAULT);
CHECK_I(dset_id, "H5Dopen2");
@@ -2002,7 +2038,7 @@ size2_verify(void)
ndims = H5Sget_simple_extent_dims(space_id, dims, NULL);
CHECK_I(ndims, "H5Sget_simple_extent_dims");
VERIFY(ndims, SIZE2_RANK1, "H5Sget_simple_extent_dims");
- for(y = 0; y < ndims; ++y)
+ for (y = 0; y < ndims; ++y)
VERIFY(dims[y], correct_dims[y], "H5Sget_simple_extent_dims");
ret = H5Sclose(space_id);
@@ -2025,7 +2061,7 @@ size2_verify(void)
ndims = H5Sget_simple_extent_dims(space_id, dims, NULL);
CHECK_I(ndims, "H5Sget_simple_extent_dims");
VERIFY(ndims, SIZE2_RANK2, "H5Sget_simple_extent_dims");
- for(y = 0; y < ndims; ++y)
+ for (y = 0; y < ndims; ++y)
VERIFY(dims[y], correct_dims[y], "H5Sget_simple_extent_dims");
ret = H5Sclose(space_id);
@@ -2037,7 +2073,6 @@ size2_verify(void)
ret = H5Gclose(group1_id);
CHECK_I(ret, "H5Gclose");
-
/* Verify attributes */
/* Create attribute data type */
@@ -2057,7 +2092,7 @@ size2_verify(void)
HDstrcpy(attr_correct_string, LONG_STRING);
HDstrcpy(attr_name, "00 index");
- for(x = 0; x < NUM_ATTRIBUTES; ++x) {
+ for (x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create the name and correct value for each attribute */
attr_correct_string[0] = attr_name[0] = (char)((x / 10) + '0');
attr_correct_string[1] = attr_name[1] = (char)((x % 10) + '0');
@@ -2091,7 +2126,6 @@ size2_verify(void)
CHECK_I(ret, "H5Fclose");
} /* size2_verify */
-
/*-------------------------------------------------------------------------
* Function: test_sohm_size2
*
@@ -2117,7 +2151,7 @@ size2_verify(void)
static void
test_sohm_size2(int close_reopen)
{
- hid_t fcpl_id = -1;
+ hid_t fcpl_id = -1;
/* Sizes for file with no shared messages at all */
size2_helper_struct norm_sizes;
/* Sizes for files with all messages in one index */
@@ -2129,9 +2163,9 @@ test_sohm_size2(int close_reopen)
size2_helper_struct share_some_med, share_some_btree;
/* Sizes for files that share different sizes of messages */
size2_helper_struct share_some_toobig_index, share_tiny_index, type_space_index;
- herr_t ret;
+ herr_t ret;
- if(close_reopen == 0)
+ if (close_reopen == 0)
MESSAGE(5, ("Testing that shared object header messages save space\n"))
else
MESSAGE(5, ("Testing that shared messages save space when file is closed and reopened\n"))
@@ -2150,7 +2184,6 @@ test_sohm_size2(int close_reopen)
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
-
/* Create an fcpl with one big index */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
@@ -2168,7 +2201,6 @@ test_sohm_size2(int close_reopen)
size2_helper(fcpl_id, close_reopen, &list_index_med);
size2_verify();
-
/* Try making the list really big */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 1000, 900);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -2177,7 +2209,6 @@ test_sohm_size2(int close_reopen)
size2_helper(fcpl_id, close_reopen, &list_index_big);
size2_verify();
-
/* Use a B-tree instead of a list */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -2186,7 +2217,6 @@ test_sohm_size2(int close_reopen)
size2_helper(fcpl_id, close_reopen, &btree_index);
size2_verify();
-
/* Use such a small list that it'll become a B-tree */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -2198,7 +2228,6 @@ test_sohm_size2(int close_reopen)
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
-
/* Create a new property list that puts messages in different indexes. */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
@@ -2222,7 +2251,6 @@ test_sohm_size2(int close_reopen)
size2_helper(fcpl_id, close_reopen, &mult_index_med);
size2_verify();
-
/* Use all B-trees */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -2231,7 +2259,6 @@ test_sohm_size2(int close_reopen)
size2_helper(fcpl_id, close_reopen, &mult_index_btree);
size2_verify();
-
/* Edit the same property list (this should work) and don't share all messages.
*/
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_PLINE_FLAG, 20);
@@ -2257,7 +2284,6 @@ test_sohm_size2(int close_reopen)
size2_helper(fcpl_id, close_reopen, &share_some_btree);
size2_verify();
-
/* Change the second index to hold only gigantic messages. Result should
* be the same as the previous file.
*/
@@ -2268,7 +2294,6 @@ test_sohm_size2(int close_reopen)
size2_helper(fcpl_id, close_reopen, &share_some_toobig_index);
size2_verify();
-
/* Share even tiny dataspace and datatype messages. This should result in
* attribute datatypes being shared. Make this one use "really big" lists.
* It turns out that attribute dataspaces are just big enough that it saves
@@ -2294,143 +2319,130 @@ test_sohm_size2(int close_reopen)
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
-
-
/* Check that all sizes make sense. There is lots of room for inexact
* results here since so many different factors contribute to file size.
*/
-
/* Check sizes of all files created using a single index first */
/* The empty size of each file with shared messages enabled should be the
* same and should be bigger than a normal file.
*/
- if(norm_sizes.empty_size > list_index_med.empty_size)
+ if (norm_sizes.empty_size > list_index_med.empty_size)
VERIFY(norm_sizes.empty_size, 1, "h5_get_file_size");
- if(list_index_med.empty_size != list_index_big.empty_size)
+ if (list_index_med.empty_size != list_index_big.empty_size)
VERIFY(list_index_med.empty_size, list_index_big.empty_size, "h5_get_file_size");
- if(list_index_med.empty_size != btree_index.empty_size)
+ if (list_index_med.empty_size != btree_index.empty_size)
VERIFY(list_index_med.empty_size, btree_index.empty_size, "h5_get_file_size");
- if(list_index_med.empty_size != list_index_small.empty_size)
+ if (list_index_med.empty_size != list_index_small.empty_size)
VERIFY(list_index_med.empty_size, list_index_small.empty_size, "h5_get_file_size");
/* The files with indexes shouldn't be that much bigger than an
* empty file.
*/
- if(list_index_med.empty_size > (h5_stat_size_t)((float)norm_sizes.empty_size * OVERHEAD_ALLOWED))
+ if (list_index_med.empty_size > (h5_stat_size_t)((float)norm_sizes.empty_size * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
-
/* Once one dataset has been created (with one of every kind of message),
* the normal file should still be smallest. The very small list
* btree_convert should be smaller than the B-tree since it has no
* extra overhead. The small list should also be smaller than the B-tree.
* The very large list should be much larger than anything else.
*/
- if(norm_sizes.first_dset >= list_index_small.first_dset)
+ if (norm_sizes.first_dset >= list_index_small.first_dset)
VERIFY(norm_sizes.first_dset, 1, "h5_get_file_size");
- if(list_index_small.first_dset >= btree_index.first_dset)
+ if (list_index_small.first_dset >= btree_index.first_dset)
VERIFY(list_index_small.first_dset, 1, "h5_get_file_size");
- if(list_index_med.first_dset >= btree_index.first_dset)
+ if (list_index_med.first_dset >= btree_index.first_dset)
VERIFY(btree_index.first_dset, 1, "h5_get_file_size");
- if(btree_index.first_dset >= list_index_big.first_dset)
+ if (btree_index.first_dset >= list_index_big.first_dset)
VERIFY(list_index_med.first_dset, 1, "h5_get_file_size");
-
/* Once a few copies of the same dataset have been created, the
* very small list shouldn't have become a B-tree yet, so it should
* be the smallest file. A larger list should be next, followed
* by a B-tree, followed by a normal file, followed by a
* list that is too large.
*/
- if(list_index_small.dsets1 >= list_index_med.dsets1)
+ if (list_index_small.dsets1 >= list_index_med.dsets1)
VERIFY(btree_index.dsets1, 1, "h5_get_file_size");
- if(list_index_med.dsets1 >= btree_index.dsets1)
+ if (list_index_med.dsets1 >= btree_index.dsets1)
VERIFY(list_index_med.dsets1, 1, "h5_get_file_size");
- if(btree_index.dsets1 >= norm_sizes.dsets1)
+ if (btree_index.dsets1 >= norm_sizes.dsets1)
VERIFY(btree_index.dsets1, 1, "h5_get_file_size");
- if(norm_sizes.dsets1 >= list_index_big.dsets1)
+ if (norm_sizes.dsets1 >= list_index_big.dsets1)
VERIFY(list_index_big.dsets1, 1, "h5_get_file_size");
/* The size gain should have been the same for each of the lists;
* their overhead is fixed. The B-tree should have gained at least
* as much, and the normal file more than that.
*/
- if((list_index_small.dsets1 - list_index_small.first_dset) !=
- (list_index_med.dsets1 - list_index_med.first_dset))
+ if ((list_index_small.dsets1 - list_index_small.first_dset) !=
+ (list_index_med.dsets1 - list_index_med.first_dset))
VERIFY(0, 1, "h5_get_file_size");
- if((list_index_med.dsets1 - list_index_med.first_dset) !=
- (list_index_big.dsets1 - list_index_big.first_dset))
+ if ((list_index_med.dsets1 - list_index_med.first_dset) !=
+ (list_index_big.dsets1 - list_index_big.first_dset))
VERIFY(0, 1, "h5_get_file_size");
- if((list_index_big.dsets1 - list_index_big.first_dset) >
- (btree_index.dsets1 - btree_index.first_dset))
+ if ((list_index_big.dsets1 - list_index_big.first_dset) > (btree_index.dsets1 - btree_index.first_dset))
VERIFY(0, 1, "h5_get_file_size");
- if((btree_index.dsets1 - btree_index.first_dset) >=
- (norm_sizes.dsets1 - norm_sizes.first_dset))
+ if ((btree_index.dsets1 - btree_index.first_dset) >= (norm_sizes.dsets1 - norm_sizes.first_dset))
VERIFY(0, 1, "h5_get_file_size");
-
/* Once another kind of each message has been written, the very small list
* should convert into a B-tree. Now the list should be smallest, then
* the B-trees (although the converted B-tree file may be a little bigger),
* then the normal file. The largest list may or may not be bigger than
* the normal file.
*/
- if(list_index_med.dsets2 >= btree_index.dsets2)
+ if (list_index_med.dsets2 >= btree_index.dsets2)
VERIFY(list_index_med.dsets2, 1, "h5_get_file_size");
- if(btree_index.dsets2 > (h5_stat_size_t)((float)list_index_small.dsets2 * OVERHEAD_ALLOWED))
+ if (btree_index.dsets2 > (h5_stat_size_t)((float)list_index_small.dsets2 * OVERHEAD_ALLOWED))
VERIFY(btree_index.dsets2, list_index_small.dsets2, "h5_get_file_size");
- if(list_index_small.dsets2 >= norm_sizes.dsets2)
+ if (list_index_small.dsets2 >= norm_sizes.dsets2)
VERIFY(btree_index.dsets2, 1, "h5_get_file_size");
/* If the small list (now a B-tree) is bigger than the existing B-tree,
* it shouldn't be much bigger.
* It seems that the small lists tends to be pretty big anyway. Allow
* for it to have twice as much overhead.
*/
- if(list_index_small.dsets2 > (h5_stat_size_t)((float)btree_index.dsets2 * OVERHEAD_ALLOWED * OVERHEAD_ALLOWED))
+ if (list_index_small.dsets2 >
+ (h5_stat_size_t)((float)btree_index.dsets2 * OVERHEAD_ALLOWED * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* The lists should have grown the least since they share messages and
* have no extra overhead. The normal file should have grown more than
* either the lists or the B-tree. The B-tree may not have grown more
* than the lists, depending on whether it needed to split nodes or not.
*/
- if((list_index_med.dsets2 - list_index_med.dsets1) !=
- (list_index_big.dsets2 - list_index_big.dsets1))
+ if ((list_index_med.dsets2 - list_index_med.dsets1) != (list_index_big.dsets2 - list_index_big.dsets1))
VERIFY(0, 1, "h5_get_file_size");
- if((list_index_big.dsets2 - list_index_big.dsets1) >
- (btree_index.dsets2 - btree_index.dsets1))
+ if ((list_index_big.dsets2 - list_index_big.dsets1) > (btree_index.dsets2 - btree_index.dsets1))
VERIFY(0, 1, "h5_get_file_size");
- if((btree_index.dsets2 - btree_index.dsets1) >=
- (norm_sizes.dsets2 - norm_sizes.dsets1))
+ if ((btree_index.dsets2 - btree_index.dsets1) >= (norm_sizes.dsets2 - norm_sizes.dsets1))
VERIFY(0, 1, "h5_get_file_size");
-
/* Interleaving the writes should have no effect on how the messages are
* shared. No new messages should be written to the indexes, so the
* sohm files will only get a little bit bigger.
*/
- if(list_index_med.interleaved >= btree_index.interleaved)
+ if (list_index_med.interleaved >= btree_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
- if(btree_index.interleaved > (h5_stat_size_t)((float)list_index_small.interleaved * OVERHEAD_ALLOWED))
+ if (btree_index.interleaved > (h5_stat_size_t)((float)list_index_small.interleaved * OVERHEAD_ALLOWED))
VERIFY(btree_index.interleaved, list_index_small.interleaved, "h5_get_file_size");
- if(list_index_small.interleaved >= norm_sizes.interleaved)
+ if (list_index_small.interleaved >= norm_sizes.interleaved)
VERIFY(0, 1, "h5_get_file_size");
/* The lists should still have grown the same amount. The converted
* B-tree shouldn't have grown more than the index that was originally
* a B-tree (although it might have grown less if there was extra free
* space within the file).
*/
- if((list_index_med.interleaved - list_index_med.dsets2) !=
- (list_index_big.interleaved - list_index_big.dsets2))
+ if ((list_index_med.interleaved - list_index_med.dsets2) !=
+ (list_index_big.interleaved - list_index_big.dsets2))
VERIFY(0, 1, "h5_get_file_size");
- if((list_index_big.interleaved - list_index_big.dsets2) >
- (btree_index.interleaved - btree_index.dsets2))
+ if ((list_index_big.interleaved - list_index_big.dsets2) > (btree_index.interleaved - btree_index.dsets2))
VERIFY(0, 1, "h5_get_file_size");
- if((list_index_small.interleaved - list_index_small.dsets2) >
- (btree_index.interleaved - btree_index.dsets2))
+ if ((list_index_small.interleaved - list_index_small.dsets2) >
+ (btree_index.interleaved - btree_index.dsets2))
VERIFY(0, 1, "h5_get_file_size");
- if((btree_index.interleaved - btree_index.dsets2) >=
- (norm_sizes.interleaved - norm_sizes.dsets2))
+ if ((btree_index.interleaved - btree_index.dsets2) >= (norm_sizes.interleaved - norm_sizes.dsets2))
VERIFY(0, 1, "h5_get_file_size");
/* After many attributes have been written, both the small and medium lists
@@ -2439,75 +2451,68 @@ test_sohm_size2(int close_reopen)
* Add in OVERHEAD_ALLOWED as a fudge factor here, since the allocation
* of file space can be hard to predict.
*/
- if(btree_index.attrs1 > (h5_stat_size_t)((float)list_index_small.attrs1 * OVERHEAD_ALLOWED))
+ if (btree_index.attrs1 > (h5_stat_size_t)((float)list_index_small.attrs1 * OVERHEAD_ALLOWED))
VERIFY(btree_index.attrs1, list_index_small.attrs1, "h5_get_file_size");
- if(btree_index.attrs1 > (h5_stat_size_t)((float)list_index_med.attrs1 * OVERHEAD_ALLOWED))
+ if (btree_index.attrs1 > (h5_stat_size_t)((float)list_index_med.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
+ if (list_index_med.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_small.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
+ if (list_index_small.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* Neither of the converted lists should be too much bigger than
* the index that was originally a B-tree.
*/
- if(list_index_small.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
+ if (list_index_small.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
+ if (list_index_med.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* The "normal" file should have had less overhead, so should gain less
* size than any of the other indexes since none of these attribute
* messages could be shared. The large list should have gained
* less overhead than the B-tree indexes.
*/
- if((norm_sizes.attrs1 - norm_sizes.interleaved) >=
- (list_index_big.attrs1 - list_index_big.interleaved))
+ if ((norm_sizes.attrs1 - norm_sizes.interleaved) >= (list_index_big.attrs1 - list_index_big.interleaved))
VERIFY(0, 1, "h5_get_file_size");
- if((list_index_big.attrs1 - list_index_big.interleaved) >=
- (list_index_small.attrs1 - list_index_small.interleaved))
+ if ((list_index_big.attrs1 - list_index_big.interleaved) >=
+ (list_index_small.attrs1 - list_index_small.interleaved))
VERIFY(0, 1, "h5_get_file_size");
/* Give it some overhead (for checkin to move messages into continuation message) */
- if((list_index_small.attrs1 - list_index_small.interleaved) >
- (h5_stat_size_t)((float)(btree_index.attrs1 - btree_index.interleaved) * OVERHEAD_ALLOWED))
+ if ((list_index_small.attrs1 - list_index_small.interleaved) >
+ (h5_stat_size_t)((float)(btree_index.attrs1 - btree_index.interleaved) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
-
/* Writing another copy of each attribute shouldn't change the ordering
* of sizes. The big list index is still too big to be smaller than a
* normal file. The B-tree indexes should all be about the same size.
*/
- if(btree_index.attrs2 > (h5_stat_size_t)((float)list_index_small.attrs2 * OVERHEAD_ALLOWED))
+ if (btree_index.attrs2 > (h5_stat_size_t)((float)list_index_small.attrs2 * OVERHEAD_ALLOWED))
VERIFY(btree_index.attrs2, list_index_small.attrs2, "h5_get_file_size");
- if(list_index_small.attrs2 > (h5_stat_size_t)((float)btree_index.attrs2 * OVERHEAD_ALLOWED))
+ if (list_index_small.attrs2 > (h5_stat_size_t)((float)btree_index.attrs2 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(btree_index.attrs2 > (h5_stat_size_t)((float)list_index_med.attrs2 * OVERHEAD_ALLOWED))
+ if (btree_index.attrs2 > (h5_stat_size_t)((float)list_index_med.attrs2 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs2 > (h5_stat_size_t)((float)btree_index.attrs2 * OVERHEAD_ALLOWED))
+ if (list_index_med.attrs2 > (h5_stat_size_t)((float)btree_index.attrs2 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs2 >= norm_sizes.attrs2)
+ if (list_index_med.attrs2 >= norm_sizes.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_big.attrs2 >= norm_sizes.attrs2)
+ if (list_index_big.attrs2 >= norm_sizes.attrs2)
VERIFY(0, 1, "h5_get_file_size");
/* All of the B-tree indexes should have gained about the same amount
* of space; at least as much as the list index and less than a normal
* file.
*/
- if((list_index_small.attrs2 - list_index_small.attrs1) >
- (btree_index.attrs2 - btree_index.attrs1))
+ if ((list_index_small.attrs2 - list_index_small.attrs1) > (btree_index.attrs2 - btree_index.attrs1))
VERIFY(0, 1, "h5_get_file_size");
- if((list_index_med.attrs2 - list_index_med.attrs1) >
- (btree_index.attrs2 - btree_index.attrs1))
+ if ((list_index_med.attrs2 - list_index_med.attrs1) > (btree_index.attrs2 - btree_index.attrs1))
VERIFY(0, 1, "h5_get_file_size");
- if((list_index_big.attrs2 - list_index_big.attrs1) >
- (list_index_med.attrs2 - list_index_med.attrs1))
+ if ((list_index_big.attrs2 - list_index_big.attrs1) > (list_index_med.attrs2 - list_index_med.attrs1))
VERIFY(0, 1, "h5_get_file_size");
- if((btree_index.attrs2 - btree_index.attrs1) >=
- (norm_sizes.attrs2 - norm_sizes.attrs1))
+ if ((btree_index.attrs2 - btree_index.attrs1) >= (norm_sizes.attrs2 - norm_sizes.attrs1))
VERIFY(0, 1, "h5_get_file_size");
/* Done checking the first few files that use a single index. */
-
/* Start comparing other kinds of files with these "standard"
* one-index files
*/
@@ -2516,45 +2521,45 @@ test_sohm_size2(int close_reopen)
/* These files should be larger when first created than one-index
* files.
*/
- if(mult_index_med.empty_size <= list_index_med.empty_size)
+ if (mult_index_med.empty_size <= list_index_med.empty_size)
VERIFY(0, 1, "h5_get_file_size");
- if(mult_index_btree.empty_size != mult_index_med.empty_size)
+ if (mult_index_btree.empty_size != mult_index_med.empty_size)
VERIFY(0, 1, "h5_get_file_size");
/* When the first dataset is written, they should grow quite a bit as
* many different indexes must be created.
*/
- if((mult_index_med.first_dset - mult_index_med.empty_size) <=
- (list_index_med.first_dset - list_index_med.empty_size))
+ if ((mult_index_med.first_dset - mult_index_med.empty_size) <=
+ (list_index_med.first_dset - list_index_med.empty_size))
VERIFY(0, 1, "h5_get_file_size");
- if((mult_index_btree.first_dset - mult_index_btree.empty_size) <=
- (btree_index.first_dset - btree_index.empty_size))
+ if ((mult_index_btree.first_dset - mult_index_btree.empty_size) <=
+ (btree_index.first_dset - btree_index.empty_size))
VERIFY(0, 1, "h5_get_file_size");
/* When the second dataset is written, they should grow less as
* some extra heap space is allocated, but no more indices.
*/
- if((mult_index_med.second_dset - mult_index_med.first_dset) >
- (mult_index_med.first_dset - mult_index_med.empty_size))
+ if ((mult_index_med.second_dset - mult_index_med.first_dset) >
+ (mult_index_med.first_dset - mult_index_med.empty_size))
VERIFY(0, 1, "h5_get_file_size");
- if((list_index_med.second_dset - list_index_med.first_dset) >
- (list_index_med.first_dset - list_index_med.empty_size))
+ if ((list_index_med.second_dset - list_index_med.first_dset) >
+ (list_index_med.first_dset - list_index_med.empty_size))
VERIFY(0, 1, "h5_get_file_size");
- if((mult_index_btree.second_dset - mult_index_btree.first_dset) >
- (mult_index_btree.first_dset - mult_index_btree.empty_size))
+ if ((mult_index_btree.second_dset - mult_index_btree.first_dset) >
+ (mult_index_btree.first_dset - mult_index_btree.empty_size))
VERIFY(0, 1, "h5_get_file_size");
- if((btree_index.second_dset - btree_index.first_dset) >
- (btree_index.first_dset - btree_index.empty_size))
+ if ((btree_index.second_dset - btree_index.first_dset) >
+ (btree_index.first_dset - btree_index.empty_size))
VERIFY(0, 1, "h5_get_file_size");
/* And the size delta for the second dataset is less in files with only
* one index.
*/
- if((mult_index_med.second_dset - mult_index_med.first_dset) <=
- (list_index_med.second_dset - list_index_med.first_dset))
+ if ((mult_index_med.second_dset - mult_index_med.first_dset) <=
+ (list_index_med.second_dset - list_index_med.first_dset))
VERIFY(0, 1, "h5_get_file_size");
- if((mult_index_btree.first_dset - mult_index_btree.empty_size) <=
- (btree_index.first_dset - btree_index.empty_size))
+ if ((mult_index_btree.first_dset - mult_index_btree.empty_size) <=
+ (btree_index.first_dset - btree_index.empty_size))
VERIFY(0, 1, "h5_get_file_size");
/* Once that initial overhead is out of the way and the lists/btrees
@@ -2562,25 +2567,27 @@ test_sohm_size2(int close_reopen)
* the same rate or slightly faster than files with just one index
* and one heap.
*/
- if((mult_index_med.dsets1 - mult_index_med.second_dset) !=
- (list_index_med.dsets1 - list_index_med.second_dset))
- VERIFY((mult_index_med.dsets1 - mult_index_med.second_dset), (list_index_med.dsets1 - list_index_med.second_dset), "h5_get_file_size");
- if((mult_index_btree.dsets1 - mult_index_btree.second_dset) !=
- (btree_index.dsets1 - btree_index.second_dset))
- VERIFY((mult_index_btree.dsets1 - mult_index_btree.second_dset), (btree_index.dsets1 - btree_index.second_dset), "h5_get_file_size");
+ if ((mult_index_med.dsets1 - mult_index_med.second_dset) !=
+ (list_index_med.dsets1 - list_index_med.second_dset))
+ VERIFY((mult_index_med.dsets1 - mult_index_med.second_dset),
+ (list_index_med.dsets1 - list_index_med.second_dset), "h5_get_file_size");
+ if ((mult_index_btree.dsets1 - mult_index_btree.second_dset) !=
+ (btree_index.dsets1 - btree_index.second_dset))
+ VERIFY((mult_index_btree.dsets1 - mult_index_btree.second_dset),
+ (btree_index.dsets1 - btree_index.second_dset), "h5_get_file_size");
- if((mult_index_med.dsets2 - mult_index_med.dsets1) >
- (h5_stat_size_t)((float)(list_index_med.dsets2 - list_index_med.dsets1) * OVERHEAD_ALLOWED))
+ if ((mult_index_med.dsets2 - mult_index_med.dsets1) >
+ (h5_stat_size_t)((float)(list_index_med.dsets2 - list_index_med.dsets1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if((mult_index_btree.dsets2 - mult_index_btree.dsets1) >
- (h5_stat_size_t)((float)(btree_index.dsets2 - btree_index.dsets1) * OVERHEAD_ALLOWED))
+ if ((mult_index_btree.dsets2 - mult_index_btree.dsets1) >
+ (h5_stat_size_t)((float)(btree_index.dsets2 - btree_index.dsets1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if((mult_index_med.interleaved - mult_index_med.dsets2) >
- (h5_stat_size_t)((float)(list_index_med.interleaved - list_index_med.dsets2) * OVERHEAD_ALLOWED))
+ if ((mult_index_med.interleaved - mult_index_med.dsets2) >
+ (h5_stat_size_t)((float)(list_index_med.interleaved - list_index_med.dsets2) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if((mult_index_btree.interleaved - mult_index_btree.dsets2) >
- (h5_stat_size_t)((float)(btree_index.interleaved - btree_index.dsets2) * OVERHEAD_ALLOWED))
+ if ((mult_index_btree.interleaved - mult_index_btree.dsets2) >
+ (h5_stat_size_t)((float)(btree_index.interleaved - btree_index.dsets2) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* When all the attributes are added, only the index holding attributes
@@ -2588,81 +2595,78 @@ test_sohm_size2(int close_reopen)
* this happens because it's hard to predict exactly how much space this
* will take.
*/
- if((mult_index_med.attrs2 - mult_index_med.attrs1) >
- (h5_stat_size_t)((float)(list_index_med.attrs2 - list_index_med.attrs1) * OVERHEAD_ALLOWED))
+ if ((mult_index_med.attrs2 - mult_index_med.attrs1) >
+ (h5_stat_size_t)((float)(list_index_med.attrs2 - list_index_med.attrs1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if((mult_index_btree.attrs2 - mult_index_btree.attrs1) >
- (h5_stat_size_t)((float)(btree_index.attrs2 - btree_index.attrs1) * OVERHEAD_ALLOWED))
+ if ((mult_index_btree.attrs2 - mult_index_btree.attrs1) >
+ (h5_stat_size_t)((float)(btree_index.attrs2 - btree_index.attrs1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* The final file size for both of the multiple index files should be
* smaller than a normal file but bigger than any of the one-index files.
*/
- if(mult_index_med.attrs2 >= norm_sizes.attrs2)
+ if (mult_index_med.attrs2 >= norm_sizes.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if(mult_index_btree.attrs2 >= norm_sizes.attrs2)
+ if (mult_index_btree.attrs2 >= norm_sizes.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if((h5_stat_size_t)((float)mult_index_med.attrs2 * OVERHEAD_ALLOWED) < btree_index.attrs2)
+ if ((h5_stat_size_t)((float)mult_index_med.attrs2 * OVERHEAD_ALLOWED) < btree_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if((h5_stat_size_t)((float)mult_index_btree.attrs2 * OVERHEAD_ALLOWED) < btree_index.attrs2)
+ if ((h5_stat_size_t)((float)mult_index_btree.attrs2 * OVERHEAD_ALLOWED) < btree_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
-
/* Check files that don't share all messages. */
/* These files have three indexes like the files above, so they should be
* the same size when created.
*/
- if(share_some_med.empty_size != mult_index_med.empty_size)
+ if (share_some_med.empty_size != mult_index_med.empty_size)
VERIFY(0, 1, "h5_get_file_size");
- if(share_some_med.empty_size != share_some_btree.empty_size)
+ if (share_some_med.empty_size != share_some_btree.empty_size)
VERIFY(0, 1, "h5_get_file_size");
/* When the first dataset is created, they should be not quite as big
* as equivalent files that share all messages (since shared messages
* have a little bit of overhead).
*/
- if(share_some_med.first_dset >= mult_index_med.first_dset)
+ if (share_some_med.first_dset >= mult_index_med.first_dset)
VERIFY(0, 1, "h5_get_file_size");
- if(share_some_btree.first_dset >= mult_index_btree.first_dset)
+ if (share_some_btree.first_dset >= mult_index_btree.first_dset)
VERIFY(0, 1, "h5_get_file_size");
/* The files that share some should have a growth rate in between
* files that share all messages and normal files
*/
- if((share_some_med.interleaved - share_some_med.first_dset) <=
- (mult_index_med.interleaved - mult_index_med.first_dset))
+ if ((share_some_med.interleaved - share_some_med.first_dset) <=
+ (mult_index_med.interleaved - mult_index_med.first_dset))
VERIFY(0, 1, "h5_get_file_size");
- if((share_some_med.interleaved - share_some_med.first_dset) >=
- (norm_sizes.interleaved - norm_sizes.first_dset))
+ if ((share_some_med.interleaved - share_some_med.first_dset) >=
+ (norm_sizes.interleaved - norm_sizes.first_dset))
VERIFY(0, 1, "h5_get_file_size");
- if((share_some_btree.interleaved - share_some_btree.first_dset) <=
- (mult_index_btree.interleaved - mult_index_btree.first_dset))
+ if ((share_some_btree.interleaved - share_some_btree.first_dset) <=
+ (mult_index_btree.interleaved - mult_index_btree.first_dset))
VERIFY(0, 1, "h5_get_file_size");
- if((share_some_btree.interleaved - share_some_btree.first_dset) >=
- (norm_sizes.interleaved - norm_sizes.first_dset))
+ if ((share_some_btree.interleaved - share_some_btree.first_dset) >=
+ (norm_sizes.interleaved - norm_sizes.first_dset))
VERIFY(0, 1, "h5_get_file_size");
-
/* Check the file that only stored gigantic messages in its second
* index. Since no messages were that big, it should be identical
* to the file with an empty index.
*/
- if(share_some_btree.empty_size != share_some_toobig_index.empty_size)
+ if (share_some_btree.empty_size != share_some_toobig_index.empty_size)
VERIFY(0, 1, "h5_get_file_size");
- if(share_some_btree.first_dset != share_some_toobig_index.first_dset)
+ if (share_some_btree.first_dset != share_some_toobig_index.first_dset)
VERIFY(0, 1, "h5_get_file_size");
- if(share_some_btree.dsets1 != share_some_toobig_index.dsets1)
+ if (share_some_btree.dsets1 != share_some_toobig_index.dsets1)
VERIFY(0, 1, "h5_get_file_size");
- if(share_some_btree.dsets2 != share_some_toobig_index.dsets2)
+ if (share_some_btree.dsets2 != share_some_toobig_index.dsets2)
VERIFY(0, 1, "h5_get_file_size");
- if(share_some_btree.interleaved != share_some_toobig_index.interleaved)
+ if (share_some_btree.interleaved != share_some_toobig_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
- if(share_some_btree.attrs1 != share_some_toobig_index.attrs1)
+ if (share_some_btree.attrs1 != share_some_toobig_index.attrs1)
VERIFY(0, 1, "h5_get_file_size");
- if(share_some_btree.attrs2 != share_some_toobig_index.attrs2)
+ if (share_some_btree.attrs2 != share_some_toobig_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
-
/* Check the file that shares even very tiny messages. Once messages
* are written to it, it should gain a little space from sharing the
* messages and lose a little space to overhead so that it's just slightly
@@ -2670,46 +2674,48 @@ test_sohm_size2(int close_reopen)
* If the overhead increases or the size of messages decreases, these
* numbers may be off.
*/
- if(share_tiny_index.empty_size != type_space_index.empty_size)
+ if (share_tiny_index.empty_size != type_space_index.empty_size)
VERIFY(share_tiny_index.empty_size, type_space_index.empty_size, "h5_get_file_size");
- if(share_tiny_index.first_dset >= (h5_stat_size_t)((float)type_space_index.first_dset * OVERHEAD_ALLOWED))
+ if (share_tiny_index.first_dset >=
+ (h5_stat_size_t)((float)type_space_index.first_dset * OVERHEAD_ALLOWED))
VERIFY(share_tiny_index.first_dset, type_space_index.first_dset, "h5_get_file_size");
- if(share_tiny_index.first_dset < type_space_index.first_dset)
+ if (share_tiny_index.first_dset < type_space_index.first_dset)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.second_dset >= type_space_index.second_dset)
+ if (share_tiny_index.second_dset >= type_space_index.second_dset)
VERIFY(share_tiny_index.second_dset, type_space_index.second_dset, "h5_get_file_size");
- if((h5_stat_size_t)((float)share_tiny_index.second_dset * OVERHEAD_ALLOWED) < type_space_index.second_dset)
+ if ((h5_stat_size_t)((float)share_tiny_index.second_dset * OVERHEAD_ALLOWED) <
+ type_space_index.second_dset)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.dsets1 >= type_space_index.dsets1)
+ if (share_tiny_index.dsets1 >= type_space_index.dsets1)
VERIFY(0, 1, "h5_get_file_size");
- if((h5_stat_size_t)((float)share_tiny_index.dsets1 * OVERHEAD_ALLOWED) < type_space_index.dsets1)
+ if ((h5_stat_size_t)((float)share_tiny_index.dsets1 * OVERHEAD_ALLOWED) < type_space_index.dsets1)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.dsets2 >= type_space_index.dsets2)
+ if (share_tiny_index.dsets2 >= type_space_index.dsets2)
VERIFY(0, 1, "h5_get_file_size");
- if((h5_stat_size_t)((float)share_tiny_index.dsets2 * OVERHEAD_ALLOWED) < type_space_index.dsets2)
+ if ((h5_stat_size_t)((float)share_tiny_index.dsets2 * OVERHEAD_ALLOWED) < type_space_index.dsets2)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.interleaved >= type_space_index.interleaved)
+ if (share_tiny_index.interleaved >= type_space_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
- if((h5_stat_size_t)((float)share_tiny_index.interleaved * OVERHEAD_ALLOWED) < type_space_index.interleaved)
+ if ((h5_stat_size_t)((float)share_tiny_index.interleaved * OVERHEAD_ALLOWED) <
+ type_space_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.attrs1 >= type_space_index.attrs1)
+ if (share_tiny_index.attrs1 >= type_space_index.attrs1)
VERIFY(0, 1, "h5_get_file_size");
- if((h5_stat_size_t)((float)share_tiny_index.attrs1 * OVERHEAD_ALLOWED) < type_space_index.attrs1)
+ if ((h5_stat_size_t)((float)share_tiny_index.attrs1 * OVERHEAD_ALLOWED) < type_space_index.attrs1)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.attrs2 >= type_space_index.attrs2)
+ if (share_tiny_index.attrs2 >= type_space_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if((h5_stat_size_t)((float)share_tiny_index.attrs2 * OVERHEAD_ALLOWED) < type_space_index.attrs2)
+ if ((h5_stat_size_t)((float)share_tiny_index.attrs2 * OVERHEAD_ALLOWED) < type_space_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
} /* test_sohm_size2 */
-
/*-------------------------------------------------------------------------
* Function: delete_helper_write
*
@@ -2731,10 +2737,11 @@ delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, int x)
char wdata;
herr_t ret;
- dset_id = H5Dcreate2(file_id, DSETNAME[x], H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, dcpl_id[x], H5P_DEFAULT);
+ dset_id =
+ H5Dcreate2(file_id, DSETNAME[x], H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, dcpl_id[x], H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
wdata = (char)(x + 'a');
- ret = H5Dwrite(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &wdata);
+ ret = H5Dwrite(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &wdata);
CHECK_I(ret, "H5Dwrite");
attr_id = H5Acreate2(dset_id, "attr_name", H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, H5P_DEFAULT);
@@ -2748,7 +2755,6 @@ delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, int x)
CHECK_I(ret, "H5Dclose");
} /* delete_helper_write */
-
/*-------------------------------------------------------------------------
* Function: delete_helper_read
*
@@ -2765,22 +2771,22 @@ delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, int x)
static void
delete_helper_read(hid_t file_id, hid_t *dspace_id, int x)
{
- hid_t dset_id = -1;
- hid_t attr_id = -1;
- char rdata;
+ hid_t dset_id = -1;
+ hid_t attr_id = -1;
+ char rdata;
herr_t ret;
dset_id = H5Dopen2(file_id, DSETNAME[x], H5P_DEFAULT);
CHECK_I(dset_id, "H5Dopen2");
rdata = '\0';
- ret = H5Dread(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &rdata);
+ ret = H5Dread(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &rdata);
CHECK_I(ret, "H5Dread");
VERIFY(rdata, (x + 'a'), "H5Dread");
attr_id = H5Aopen(dset_id, "attr_name", H5P_DEFAULT);
CHECK_I(attr_id, "H5Aopen");
rdata = '\0';
- ret = H5Aread(attr_id, H5T_NATIVE_CHAR, &rdata);
+ ret = H5Aread(attr_id, H5T_NATIVE_CHAR, &rdata);
CHECK_I(ret, "H5Dread");
VERIFY(rdata, (x + 'a'), "H5Dread");
@@ -2790,7 +2796,6 @@ delete_helper_read(hid_t file_id, hid_t *dspace_id, int x)
CHECK_I(ret, "H5Dclose");
} /* delete_helper_read */
-
/*-------------------------------------------------------------------------
* Function: delete_helper
*
@@ -2815,23 +2820,23 @@ delete_helper_read(hid_t file_id, hid_t *dspace_id, int x)
static void
delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
{
- hid_t file_id=-1;
- int x;
+ hid_t file_id = -1;
+ int x;
h5_stat_size_t norm_filesize;
h5_stat_size_t deleted_filesize;
- herr_t ret;
+ herr_t ret;
/* Get the size of a "normal" file with no deleted messages */
file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
CHECK_I(file_id, "H5Fcreate");
/* Create batch of messages in the file starting at message 2 */
- for(x=HALF_DELETE_NUM_MESGS; x<DELETE_NUM_MESGS; ++x) {
+ for (x = HALF_DELETE_NUM_MESGS; x < DELETE_NUM_MESGS; ++x) {
delete_helper_write(file_id, dspace_id, dcpl_id, x);
}
/* Check that messages can be read */
- for(x=HALF_DELETE_NUM_MESGS; x<DELETE_NUM_MESGS; ++x) {
+ for (x = HALF_DELETE_NUM_MESGS; x < DELETE_NUM_MESGS; ++x) {
delete_helper_read(file_id, dspace_id, x);
}
@@ -2844,14 +2849,14 @@ delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
CHECK_I(file_id, "H5Fcreate");
- for(x=0; x<HALF_DELETE_NUM_MESGS; ++x) {
+ for (x = 0; x < HALF_DELETE_NUM_MESGS; ++x) {
delete_helper_write(file_id, dspace_id, dcpl_id, x);
}
/* Verify each dataset, then delete it (which should delete
* its shared messages as well
*/
- for(x=0; x<HALF_DELETE_NUM_MESGS; ++x) {
+ for (x = 0; x < HALF_DELETE_NUM_MESGS; ++x) {
delete_helper_read(file_id, dspace_id, x);
ret = H5Ldelete(file_id, DSETNAME[x], H5P_DEFAULT);
CHECK_I(ret, "H5Ldelete");
@@ -2860,10 +2865,10 @@ delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
/* The file is now empty. Write and verify the second batch of messages
* again.
*/
- for(x=HALF_DELETE_NUM_MESGS; x<DELETE_NUM_MESGS; ++x) {
+ for (x = HALF_DELETE_NUM_MESGS; x < DELETE_NUM_MESGS; ++x) {
delete_helper_write(file_id, dspace_id, dcpl_id, x);
}
- for(x=HALF_DELETE_NUM_MESGS; x<DELETE_NUM_MESGS; ++x) {
+ for (x = HALF_DELETE_NUM_MESGS; x < DELETE_NUM_MESGS; ++x) {
delete_helper_read(file_id, dspace_id, x);
}
@@ -2873,13 +2878,12 @@ delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
deleted_filesize = h5_get_file_size(FILENAME, H5P_DEFAULT);
/* The two filesizes should be almost the same */
- if(norm_filesize > (h5_stat_size_t)((float)deleted_filesize * OVERHEAD_ALLOWED))
+ if (norm_filesize > (h5_stat_size_t)((float)deleted_filesize * OVERHEAD_ALLOWED))
VERIFY(norm_filesize, deleted_filesize, "h5_get_file_size");
- if(deleted_filesize > (h5_stat_size_t)((float)norm_filesize * OVERHEAD_ALLOWED))
+ if (deleted_filesize > (h5_stat_size_t)((float)norm_filesize * OVERHEAD_ALLOWED))
VERIFY(deleted_filesize, norm_filesize, "h5_get_file_size");
} /* delete_helper */
-
/*-------------------------------------------------------------------------
* Function: test_sohm_delete
*
@@ -2904,19 +2908,19 @@ test_sohm_delete(void)
/* We'll use dataspaces and filter pipelines for this test.
* Create a number of distinct messages of each type.
*/
- hid_t dspace_id[DELETE_NUM_MESGS] = {0};
- hid_t dcpl_id[DELETE_NUM_MESGS] = {0};
+ hid_t dspace_id[DELETE_NUM_MESGS] = {0};
+ hid_t dcpl_id[DELETE_NUM_MESGS] = {0};
unsigned u;
- int x;
- hsize_t dims[] = DELETE_DIMS;
- herr_t ret;
+ int x;
+ hsize_t dims[] = DELETE_DIMS;
+ herr_t ret;
MESSAGE(5, ("Testing deletion of SOHMs\n"));
/* Create a number of different dataspaces.
* For simplicity, each dataspace has only one element.
*/
- for(u = 0; u < DELETE_NUM_MESGS; ++u) {
+ for (u = 0; u < DELETE_NUM_MESGS; ++u) {
dspace_id[u] = H5Screate_simple((int)(u + 1), dims, dims);
CHECK_I(dspace_id[u], "H5Screate_simple");
} /* end for */
@@ -2930,7 +2934,7 @@ test_sohm_delete(void)
ret = H5Pset_shuffle(dcpl_id[0]);
CHECK_I(ret, "H5Pset_shuffle");
- for(u = 1; u < DELETE_NUM_MESGS; u += 2) {
+ for (u = 1; u < DELETE_NUM_MESGS; u += 2) {
dcpl_id[u] = H5Pcopy(dcpl_id[u - 1]);
CHECK_I(dcpl_id[u], "H5Pcopy");
ret = H5Pset_chunk(dcpl_id[u], (int)(u + 1), dims);
@@ -2954,7 +2958,6 @@ test_sohm_delete(void)
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 16);
CHECK_I(ret, "H5Pset_shared_mesg_index");
-
/* Use big list indexes */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 4 * DELETE_NUM_MESGS, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -2968,14 +2971,12 @@ test_sohm_delete(void)
delete_helper(fcpl_id, dspace_id, dcpl_id);
-
/* Use small list indexes that will convert from lists to B-trees and back */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, HALF_DELETE_NUM_MESGS, HALF_DELETE_NUM_MESGS - 1);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
delete_helper(fcpl_id, dspace_id, dcpl_id);
-
/* Use two indexes */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
@@ -2988,27 +2989,24 @@ test_sohm_delete(void)
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 5000, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
-
/* Use B-tree indexes */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
delete_helper(fcpl_id, dspace_id, dcpl_id);
-
/* Set phase change values so that one index converts to a B-tree and one doesn't */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, HALF_DELETE_NUM_MESGS + 1, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
delete_helper(fcpl_id, dspace_id, dcpl_id);
-
/* Test with varying message sizes (ideally, so some messages are too
* small to be written but some are big enough that they are still written
*/
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(u = DELETE_MIN_MESG_SIZE; u <= DELETE_MAX_MESG_SIZE; u += 10) {
+ for (u = DELETE_MIN_MESG_SIZE; u <= DELETE_MAX_MESG_SIZE; u += 10) {
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, u);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
delete_helper(fcpl_id, dspace_id, dcpl_id);
@@ -3018,7 +3016,7 @@ test_sohm_delete(void)
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
- for(x = DELETE_NUM_MESGS - 1; x >= 0; --x) {
+ for (x = DELETE_NUM_MESGS - 1; x >= 0; --x) {
ret = H5Sclose(dspace_id[x]);
CHECK_I(ret, "H5Sclose");
ret = H5Pclose(dcpl_id[x]);
@@ -3026,7 +3024,6 @@ test_sohm_delete(void)
} /* end for */
} /* test_sohm_delete */
-
/*-------------------------------------------------------------------------
* Function: verify_dset_create_and_delete_does_not_grow_file
*
@@ -3047,13 +3044,13 @@ test_sohm_delete(void)
static int
verify_dset_create_and_delete_does_not_grow_file(hid_t fcpl_id)
{
- hid_t file_id;
- hid_t dspace_id;
- hid_t dset_id;
- hsize_t dims[1] = {1};
+ hid_t file_id;
+ hid_t dspace_id;
+ hid_t dset_id;
+ hsize_t dims[1] = {1};
h5_stat_size_t initial_filesize, deleted_filesize;
- int old_nerrs; /* Number of errors when entering this routine */
- herr_t ret;
+ int old_nerrs; /* Number of errors when entering this routine */
+ herr_t ret;
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
@@ -3071,7 +3068,6 @@ verify_dset_create_and_delete_does_not_grow_file(hid_t fcpl_id)
CHECK_I(ret, "H5Fclose");
initial_filesize = h5_get_file_size(FILENAME, H5P_DEFAULT);
-
/* Re-create the file and create a dataset in it */
file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
CHECK_I(file_id, "H5Fcreate");
@@ -3092,7 +3088,6 @@ verify_dset_create_and_delete_does_not_grow_file(hid_t fcpl_id)
VERIFY(deleted_filesize, initial_filesize, "h5_get_file_size");
-
/* Repeat, creating two datasets in the file */
file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
CHECK_I(file_id, "H5Fcreate");
@@ -3104,7 +3099,8 @@ verify_dset_create_and_delete_does_not_grow_file(hid_t fcpl_id)
CHECK_I(ret, "H5Dclose");
/* Create and close the second. These messages should be shared */
- dset_id = H5Dcreate2(file_id, "dset2", H5T_NATIVE_SHORT, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset_id =
+ H5Dcreate2(file_id, "dset2", H5T_NATIVE_SHORT, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
ret = H5Dclose(dset_id);
CHECK_I(ret, "H5Dclose");
@@ -3122,19 +3118,17 @@ verify_dset_create_and_delete_does_not_grow_file(hid_t fcpl_id)
VERIFY(deleted_filesize, initial_filesize, "h5_get_file_size");
-
/* Cleanup */
ret = H5Sclose(dspace_id);
CHECK_I(ret, "H5Sclose");
/* Retrieve current # of errors */
- if(old_nerrs == GetTestNumErrs())
- return(0);
+ if (old_nerrs == GetTestNumErrs())
+ return (0);
else
- return(-1);
+ return (-1);
} /* verify_dset_create_and_delete_does_not_grow_file */
-
/*-------------------------------------------------------------------------
* Function: test_sohm_delete_revert
*
@@ -3151,7 +3145,7 @@ verify_dset_create_and_delete_does_not_grow_file(hid_t fcpl_id)
static void
test_sohm_delete_revert(void)
{
- hid_t fcpl_id;
+ hid_t fcpl_id;
herr_t ret;
MESSAGE(5, ("Testing that file reverts to original size on SOHM deletion\n"));
@@ -3176,7 +3170,6 @@ test_sohm_delete_revert(void)
ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id);
CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file");
-
/* Try sharing all messages */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
@@ -3203,7 +3196,6 @@ test_sohm_delete_revert(void)
ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id);
CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file");
-
/* Try with shared messages enabled, but when messages are too big
* to be shared.
*/
@@ -3216,7 +3208,6 @@ test_sohm_delete_revert(void)
CHECK_I(ret, "H5Pclose");
} /* test_sohm_delete_revert */
-
/*-------------------------------------------------------------------------
* Function: verify_dset_create_and_open_through_extlink_with_sohm
*
@@ -3234,12 +3225,12 @@ test_sohm_delete_revert(void)
static void
verify_dset_create_and_open_through_extlink_with_sohm(hid_t src_fcpl_id, hid_t dst_fcpl_id)
{
- hid_t src_file_id = -1;
- hid_t dst_file_id = -1;
- hid_t space_id = -1;
- hid_t dset_id = -1;
- hsize_t dims[] = {1, 1};
- herr_t ret;
+ hid_t src_file_id = -1;
+ hid_t dst_file_id = -1;
+ hid_t space_id = -1;
+ hid_t dset_id = -1;
+ hsize_t dims[] = {1, 1};
+ herr_t ret;
/* Create files */
src_file_id = H5Fcreate(FILENAME_SRC, H5F_ACC_TRUNC, src_fcpl_id, H5P_DEFAULT);
@@ -3254,7 +3245,8 @@ verify_dset_create_and_open_through_extlink_with_sohm(hid_t src_fcpl_id, hid_t d
/* Create a dataset through the external link */
space_id = H5Screate_simple(2, dims, dims);
CHECK_I(space_id, "H5Screate_simple");
- dset_id = H5Dcreate2(src_file_id, "ext_link/dataset", H5T_NATIVE_FLOAT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset_id = H5Dcreate2(src_file_id, "ext_link/dataset", H5T_NATIVE_FLOAT, space_id, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
/* Close the dataset and both files to make sure everything gets flushed
@@ -3285,7 +3277,6 @@ verify_dset_create_and_open_through_extlink_with_sohm(hid_t src_fcpl_id, hid_t d
CHECK_I(ret, "H5Fclose");
} /* verify_dset_create_and_open_through_extlink_with_sohm */
-
/*-------------------------------------------------------------------------
* Function: test_sohm_extlink
*
@@ -3302,7 +3293,7 @@ verify_dset_create_and_open_through_extlink_with_sohm(hid_t src_fcpl_id, hid_t d
static void
test_sohm_extlink(void)
{
- hid_t fcpl_id = -1;
+ hid_t fcpl_id = -1;
herr_t ret;
MESSAGE(5, ("Testing SOHM creation through external links\n"));
@@ -3322,7 +3313,6 @@ test_sohm_extlink(void)
CHECK_I(ret, "H5Pclose");
} /* test_sohm_extlink */
-
/*-------------------------------------------------------------------------
* Function: verify_dataset_extension
*
@@ -3342,19 +3332,19 @@ test_sohm_extlink(void)
static int
verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
{
- hid_t file_id = H5I_INVALID_HID;
- hid_t orig_space_id = H5I_INVALID_HID;
- hid_t space1_id, space2_id, space3_id;
- hid_t dcpl_id = H5I_INVALID_HID;
- hid_t dset1_id, dset2_id = H5I_INVALID_HID, dset3_id = H5I_INVALID_HID;
- hsize_t dims1[] = {1, 2};
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t orig_space_id = H5I_INVALID_HID;
+ hid_t space1_id, space2_id, space3_id;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t dset1_id, dset2_id = H5I_INVALID_HID, dset3_id = H5I_INVALID_HID;
+ hsize_t dims1[] = {1, 2};
hsize_t max_dims[] = {H5S_UNLIMITED, 2};
- hsize_t dims2[] = {5, 2};
+ hsize_t dims2[] = {5, 2};
hsize_t out_dims[2];
hsize_t out_maxdims[2];
- int x;
- int old_nerrs; /* Number of errors when entering this routine */
- herr_t ret;
+ int x;
+ int old_nerrs; /* Number of errors when entering this routine */
+ herr_t ret;
hsize_t *space_dims[3];
@@ -3368,42 +3358,42 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
* 2018 November 5
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
-#define TSOHM_VDE_VERIFY_SPACES(dims) \
-{ \
- /* Open dataspaces \
- */ \
- space1_id = H5Dget_space(dset1_id); \
- CHECK_I(space1_id, "H5Dget_space"); \
- space2_id = H5Dget_space(dset2_id); \
- CHECK_I(space2_id, "H5Dget_space"); \
- space3_id = H5Dget_space(dset3_id); \
- CHECK_I(space3_id, "H5Dget_space"); \
- /* Verify dataspaces \
- */ \
- ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims); \
- CHECK_I(ret, "H5Sget_simple_extent_dims"); \
- for(x=0; x<EXTEND_NDIMS; ++x) { \
- VERIFY(out_dims[x], (dims)[0][x], "H5Sget_simple_extent_dims"); \
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \
- } \
- ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims); \
- CHECK_I(ret, "H5Sget_simple_extent_dims"); \
- for(x=0; x<EXTEND_NDIMS; ++x) { \
- VERIFY(out_dims[x], (dims)[1][x], "H5Sget_simple_extent_dims"); \
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \
- } \
- ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims); \
- CHECK_I(ret, "H5Sget_simple_extent_dims"); \
- for(x=0; x<EXTEND_NDIMS; ++x) { \
- VERIFY(out_dims[x], (dims)[2][x], "H5Sget_simple_extent_dims"); \
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \
- } \
- /* Close dataspaces \
- */ \
- CHECK_I(H5Sclose(space1_id), "H5Sclose"); \
- CHECK_I(H5Sclose(space2_id), "H5Sclose"); \
- CHECK_I(H5Sclose(space3_id), "H5Sclose"); \
-} /* define TSOHM_VDE_VERIFY_SPACES */
+#define TSOHM_VDE_VERIFY_SPACES(dims) \
+ { \
+ /* Open dataspaces \
+ */ \
+ space1_id = H5Dget_space(dset1_id); \
+ CHECK_I(space1_id, "H5Dget_space"); \
+ space2_id = H5Dget_space(dset2_id); \
+ CHECK_I(space2_id, "H5Dget_space"); \
+ space3_id = H5Dget_space(dset3_id); \
+ CHECK_I(space3_id, "H5Dget_space"); \
+ /* Verify dataspaces \
+ */ \
+ ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims); \
+ CHECK_I(ret, "H5Sget_simple_extent_dims"); \
+ for (x = 0; x < EXTEND_NDIMS; ++x) { \
+ VERIFY(out_dims[x], (dims)[0][x], "H5Sget_simple_extent_dims"); \
+ VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \
+ } \
+ ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims); \
+ CHECK_I(ret, "H5Sget_simple_extent_dims"); \
+ for (x = 0; x < EXTEND_NDIMS; ++x) { \
+ VERIFY(out_dims[x], (dims)[1][x], "H5Sget_simple_extent_dims"); \
+ VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \
+ } \
+ ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims); \
+ CHECK_I(ret, "H5Sget_simple_extent_dims"); \
+ for (x = 0; x < EXTEND_NDIMS; ++x) { \
+ VERIFY(out_dims[x], (dims)[2][x], "H5Sget_simple_extent_dims"); \
+ VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \
+ } \
+ /* Close dataspaces \
+ */ \
+ CHECK_I(H5Sclose(space1_id), "H5Sclose"); \
+ CHECK_I(H5Sclose(space2_id), "H5Sclose"); \
+ CHECK_I(H5Sclose(space3_id), "H5Sclose"); \
+ } /* define TSOHM_VDE_VERIFY_SPACES */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Macro: TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS()
@@ -3419,28 +3409,28 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
* 2018 November 5
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
-#define TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(n) \
-{ \
- CHECK_I(H5Dclose(dset1_id), "H5Dclose"); \
- if ((n) > 1) \
- CHECK_I(H5Dclose(dset2_id), "H5Dclose"); \
- if ((n) > 2) \
- CHECK_I(H5Dclose(dset3_id), "H5Dclose"); \
- CHECK_I(H5Fclose(file_id), "H5Fclose"); \
- \
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); \
- CHECK_I(file_id, "H5Fopen"); \
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); \
- CHECK_I(dset1_id, "H5Dopen2"); \
- if ((n) > 1) { \
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); \
- CHECK_I(dset2_id, "H5Dopen2"); \
- } \
- if ((n) > 2) { \
- dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); \
- CHECK_I(dset3_id, "H5Dopen2"); \
- } \
-} /* define TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS */
+#define TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(n) \
+ { \
+ CHECK_I(H5Dclose(dset1_id), "H5Dclose"); \
+ if ((n) > 1) \
+ CHECK_I(H5Dclose(dset2_id), "H5Dclose"); \
+ if ((n) > 2) \
+ CHECK_I(H5Dclose(dset3_id), "H5Dclose"); \
+ CHECK_I(H5Fclose(file_id), "H5Fclose"); \
+ \
+ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); \
+ CHECK_I(file_id, "H5Fopen"); \
+ dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); \
+ CHECK_I(dset1_id, "H5Dopen2"); \
+ if ((n) > 1) { \
+ dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); \
+ CHECK_I(dset2_id, "H5Dopen2"); \
+ } \
+ if ((n) > 2) { \
+ dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); \
+ CHECK_I(dset3_id, "H5Dopen2"); \
+ } \
+ } /* define TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS */
/* Remember the current # of reported errors */
old_nerrs = GetTestNumErrs();
@@ -3457,19 +3447,22 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
/* Create a dataspace and a dataset*/
orig_space_id = H5Screate_simple(EXTEND_NDIMS, dims1, max_dims);
CHECK_I(orig_space_id, "H5Screate_simple");
- dset1_id = H5Dcreate2(file_id, "dataset", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ dset1_id =
+ H5Dcreate2(file_id, "dataset", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset1_id, "H5Dcreate2");
- if(close_reopen)
+ if (close_reopen)
TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(1);
/* Create another dataset starting with the same dataspace */
- dset2_id = H5Dcreate2(file_id, "dataset2", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ dset2_id =
+ H5Dcreate2(file_id, "dataset2", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset2_id, "H5Dcreate2");
if (close_reopen)
TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(2);
/* Create a third dataset with the same dataspace */
- dset3_id = H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ dset3_id =
+ H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset3_id, "H5Dcreate2");
if (close_reopen)
TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
@@ -3488,7 +3481,7 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
/* Extend the second dataset */
ret = H5Dset_extent(dset2_id, dims2);
CHECK_I(ret, "H5Dset_extent");
- if(close_reopen)
+ if (close_reopen)
TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
space_dims[1] = dims2;
@@ -3497,7 +3490,7 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
/* Extend the third dataset */
ret = H5Dset_extent(dset3_id, dims2);
CHECK_I(ret, "H5Dset_extent");
- if(close_reopen)
+ if (close_reopen)
TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
space_dims[2] = dims2;
@@ -3513,15 +3506,14 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
ret = H5Fclose(file_id);
CHECK_I(ret, "H5Fclose");
-
-
/* Change the order in which datasets are extended to ensure that there
* are no problems if a dataspace goes from being shared to not being
* shared or vice versa.
*/
file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
CHECK_I(file_id, "H5Fcreate");
- dset1_id = H5Dcreate2(file_id, "dataset", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ dset1_id =
+ H5Dcreate2(file_id, "dataset", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset1_id, "H5Dcreate2");
if (close_reopen)
TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(1);
@@ -3535,7 +3527,8 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
/* Create the second dataset. Its dataspace will be unshared and then
* become shared when extended.
*/
- dset2_id = H5Dcreate2(file_id, "dataset2", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ dset2_id =
+ H5Dcreate2(file_id, "dataset2", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset2_id, "H5Dcreate2");
if (close_reopen)
TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(2);
@@ -3549,15 +3542,16 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
/* Create the third dataset. Its dataspace will be unshared and then
* become shared when extended.
*/
- dset3_id = H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ dset3_id =
+ H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset3_id, "H5Dcreate2");
- if(close_reopen)
+ if (close_reopen)
TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
/* Extend the third dataset */
ret = H5Dset_extent(dset3_id, dims2);
CHECK_I(ret, "H5Dset_extent");
- if(close_reopen)
+ if (close_reopen)
TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
TSOHM_VDE_VERIFY_SPACES(space_dims);
@@ -3579,16 +3573,15 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
CHECK_I(ret, "H5Pclose");
/* Complain if this test generated errors */
- if(old_nerrs == GetTestNumErrs())
- return(0);
+ if (old_nerrs == GetTestNumErrs())
+ return (0);
else
- return(-1);
+ return (-1);
/* macros are exclusive to this function */
#undef TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS
#undef TSOHM_VDE_VERIFY_SPACES
} /* verify_dataset_extension */
-
/*-------------------------------------------------------------------------
* Function: test_sohm_extend_dset
*
@@ -3606,7 +3599,7 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
static void
test_sohm_extend_dset(void)
{
- hid_t fcpl_id = -1;
+ hid_t fcpl_id = -1;
herr_t ret;
MESSAGE(5, ("Testing extending shared dataspaces\n"));
@@ -3622,7 +3615,6 @@ test_sohm_extend_dset(void)
ret = verify_dataset_extension(fcpl_id, TRUE);
CHECK_I(ret, "verify_dataset_extension");
-
/* Only dataspaces */
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG, 16);
CHECK_I(ret, "H5Pset_shared_mesg_index");
@@ -3641,7 +3633,6 @@ test_sohm_extend_dset(void)
ret = verify_dataset_extension(fcpl_id, TRUE);
CHECK_I(ret, "verify_dataset_extension");
-
/* All messages in lists */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 100, 50);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -3651,7 +3642,6 @@ test_sohm_extend_dset(void)
ret = verify_dataset_extension(fcpl_id, TRUE);
CHECK_I(ret, "verify_dataset_extension");
-
/* All messages in lists converted to B-trees */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 1, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -3661,7 +3651,6 @@ test_sohm_extend_dset(void)
ret = verify_dataset_extension(fcpl_id, TRUE);
CHECK_I(ret, "verify_dataset_extension");
-
/* All messages in B-trees */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -3675,7 +3664,6 @@ test_sohm_extend_dset(void)
CHECK_I(ret, "H5Pclose");
} /* test_sohm_extend_dset */
-
/*-------------------------------------------------------------------------
* Function: test_sohm_external_dtype
*
@@ -3697,15 +3685,15 @@ test_sohm_external_dtype(void)
int a;
int b;
} s1_t;
- s1_t *s_ptr, *orig;
- hid_t fcpl, file1, file2;
- hid_t dataset1, dataset2;
- hid_t s1_tid, dset1_tid, dset2_tid, space;
- hsize_t dims[2] = {NX, NY};
+ s1_t * s_ptr, *orig;
+ hid_t fcpl, file1, file2;
+ hid_t dataset1, dataset2;
+ hid_t s1_tid, dset1_tid, dset2_tid, space;
+ hsize_t dims[2] = {NX, NY};
H5T_class_t dtype_class;
- size_t dmsg_count;
- unsigned x, i;
- herr_t ret;
+ size_t dmsg_count;
+ unsigned x, i;
+ herr_t ret;
MESSAGE(5, ("Testing shared external datatype\n"));
@@ -3713,7 +3701,7 @@ test_sohm_external_dtype(void)
CHECK_I(fcpl, "H5Pcreate");
ret = H5Pset_shared_mesg_nindexes(fcpl, TEST_NUM_INDEXES);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(x=0; x<TEST_NUM_INDEXES; ++x) {
+ for (x = 0; x < TEST_NUM_INDEXES; ++x) {
ret = H5Pset_shared_mesg_index(fcpl, x, test_type_flags[x], test_minsizes[x]);
CHECK_I(ret, "H5Pset_shared_mesg_index");
}
@@ -3725,9 +3713,9 @@ test_sohm_external_dtype(void)
s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
CHECK_I(s1_tid, "H5Tcreate");
- ret = H5Tinsert(s1_tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(s1_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK_I(ret, "H5Tinsert");
- ret = H5Tinsert (s1_tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(s1_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK_I(ret, "H5Tinsert");
/* Set up dataset in first file */
@@ -3739,8 +3727,7 @@ test_sohm_external_dtype(void)
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test");
- dataset1 = H5Dcreate2(file1, "dataset_1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT);
+ dataset1 = H5Dcreate2(file1, "dataset_1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(dataset1, "H5Dcreate2");
/* Check on datatype storage status. It should be 1 now. */
@@ -3752,11 +3739,11 @@ test_sohm_external_dtype(void)
CHECK_I(dset1_tid, "H5Dget_type");
/* Allocate space and initialize data */
- orig = (s1_t*)HDmalloc(NX * NY * sizeof(s1_t));
+ orig = (s1_t *)HDmalloc(NX * NY * sizeof(s1_t));
if (orig == NULL)
CHECK_I(-1, "HDmalloc");
- for(i=0; i<NX*NY; i++) {
- s_ptr = (s1_t*)orig + i;
+ for (i = 0; i < NX * NY; i++) {
+ s_ptr = (s1_t *)orig + i;
s_ptr->a = (int)(i * 3 + 1);
s_ptr->b = (int)(i * 3 + 2);
}
@@ -3775,8 +3762,7 @@ test_sohm_external_dtype(void)
CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test");
VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test");
- dataset2 = H5Dcreate2(file2, "dataset_2", dset1_tid, space, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT);
+ dataset2 = H5Dcreate2(file2, "dataset_2", dset1_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(dataset2, "H5Dcreate2");
/* Check on datatype storage status. It should be 1 now. */
@@ -3821,7 +3807,6 @@ test_sohm_external_dtype(void)
HDfree(orig);
} /* test_sohm_external_dtype */
-
/****************************************************************
**
** test_sohm(): Main Shared Object Header Message testing routine.
@@ -3832,27 +3817,26 @@ test_sohm(void)
{
MESSAGE(5, ("Testing Shared Object Header Messages\n"));
- test_sohm_fcpl(); /* Test SOHMs and file creation plists */
- test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */
- test_sohm_size1(); /* Tests the sizes of files with one SOHM */
-#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */
+ test_sohm_fcpl(); /* Test SOHMs and file creation plists */
+ test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */
+ test_sohm_size1(); /* Tests the sizes of files with one SOHM */
+#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */
test_sohm_size_consistency_open_create();
-#endif /* Jira HDFFV-10645 */
- test_sohm_attrs(); /* Tests shared messages in attributes */
- test_sohm_size2(0); /* Tests the sizes of files with multiple SOHMs */
- test_sohm_size2(1); /* Tests the sizes of files with multiple
- * SOHMs, closing and reopening file after
- * each write. */
- test_sohm_delete(); /* Test deleting shared messages */
- test_sohm_delete_revert(); /* Test that a file with SOHMs becomes an
- * empty file again when they are deleted. */
- test_sohm_extlink(); /* Test SOHMs when external links are used */
+#endif /* Jira HDFFV-10645 */
+ test_sohm_attrs(); /* Tests shared messages in attributes */
+ test_sohm_size2(0); /* Tests the sizes of files with multiple SOHMs */
+ test_sohm_size2(1); /* Tests the sizes of files with multiple
+ * SOHMs, closing and reopening file after
+ * each write. */
+ test_sohm_delete(); /* Test deleting shared messages */
+ test_sohm_delete_revert(); /* Test that a file with SOHMs becomes an
+ * empty file again when they are deleted. */
+ test_sohm_extlink(); /* Test SOHMs when external links are used */
test_sohm_extend_dset(); /* Test extending shared datasets */
test_sohm_external_dtype(); /* Test using datatype in another file */
} /* test_sohm */
-
/*-------------------------------------------------------------------------
* Function: cleanup_sohm
*
@@ -3874,4 +3858,3 @@ cleanup_sohm(void)
HDremove(FILENAME_SRC);
HDremove(FILENAME_DST);
} /* cleanup_sohm */
-
diff --git a/test/ttime.c b/test/ttime.c
index 5b3436d..63906ff 100644
--- a/test/ttime.c
+++ b/test/ttime.c
@@ -12,18 +12,18 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: ttime
-*
-* Test the Time Datatype functionality
-*
-*************************************************************/
+ *
+ * Test program: ttime
+ *
+ * Test the Time Datatype functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
-#define DATAFILE "ttime.h5"
+#define DATAFILE "ttime.h5"
#ifdef NOT_YET
-#define DATASETNAME "Dataset"
+#define DATASETNAME "Dataset"
#endif /* NOT_YET */
/****************************************************************
@@ -34,8 +34,8 @@
static void
test_time_commit(void)
{
- hid_t file_id, tid; /* identifiers */
- herr_t status;
+ hid_t file_id, tid; /* identifiers */
+ herr_t status;
/* Output message about test being performed */
MESSAGE(5, ("Testing Committing Time Datatypes\n"));
@@ -44,32 +44,32 @@ test_time_commit(void)
file_id = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file_id, FAIL, "H5Fcreate");
- tid = H5Tcopy (H5T_UNIX_D32LE);
+ tid = H5Tcopy(H5T_UNIX_D32LE);
CHECK(tid, FAIL, "H5Tcopy");
status = H5Tcommit2(file_id, "Committed D32LE type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(status, FAIL, "H5Tcommit2");
- status = H5Tclose (tid);
+ status = H5Tclose(tid);
CHECK(status, FAIL, "H5Tclose");
- tid = H5Tcopy (H5T_UNIX_D32BE);
+ tid = H5Tcopy(H5T_UNIX_D32BE);
CHECK(tid, FAIL, "H5Tcopy");
status = H5Tcommit2(file_id, "Committed D32BE type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(status, FAIL, "H5Tcommit2");
- status = H5Tclose (tid);
+ status = H5Tclose(tid);
CHECK(status, FAIL, "H5Tclose");
- tid = H5Tcopy (H5T_UNIX_D64LE);
+ tid = H5Tcopy(H5T_UNIX_D64LE);
CHECK(tid, FAIL, "H5Tcopy");
status = H5Tcommit2(file_id, "Committed D64LE type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(status, FAIL, "H5Tcommit2");
- status = H5Tclose (tid);
+ status = H5Tclose(tid);
CHECK(status, FAIL, "H5Tclose");
- tid = H5Tcopy (H5T_UNIX_D64BE);
+ tid = H5Tcopy(H5T_UNIX_D64BE);
CHECK(tid, FAIL, "H5Tcopy");
status = H5Tcommit2(file_id, "Committed D64BE type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(status, FAIL, "H5Tcommit2");
- status = H5Tclose (tid);
+ status = H5Tclose(tid);
CHECK(status, FAIL, "H5Tclose");
/* Close the file. */
@@ -82,42 +82,41 @@ test_time_commit(void)
tid = H5Topen2(file_id, "Committed D32LE type", H5P_DEFAULT);
CHECK(tid, FAIL, "H5Topen2");
- if(!H5Tequal(tid, H5T_UNIX_D32LE))
+ if (!H5Tequal(tid, H5T_UNIX_D32LE))
TestErrPrintf("H5T_UNIX_D32LE datatype not found\n");
- status = H5Tclose (tid);
+ status = H5Tclose(tid);
CHECK(status, FAIL, "H5Tclose");
tid = H5Topen2(file_id, "Committed D32BE type", H5P_DEFAULT);
CHECK(tid, FAIL, "H5Topen2");
- if(!H5Tequal(tid, H5T_UNIX_D32BE))
+ if (!H5Tequal(tid, H5T_UNIX_D32BE))
TestErrPrintf("H5T_UNIX_D32BE datatype not found\n");
- status = H5Tclose (tid);
+ status = H5Tclose(tid);
CHECK(status, FAIL, "H5Tclose");
tid = H5Topen2(file_id, "Committed D64LE type", H5P_DEFAULT);
CHECK(tid, FAIL, "H5Topen2");
- if(!H5Tequal(tid, H5T_UNIX_D64LE))
+ if (!H5Tequal(tid, H5T_UNIX_D64LE))
TestErrPrintf("H5T_UNIX_D64LE datatype not found");
- status = H5Tclose (tid);
+ status = H5Tclose(tid);
CHECK(status, FAIL, "H5Tclose");
tid = H5Topen2(file_id, "Committed D64BE type", H5P_DEFAULT);
CHECK(tid, FAIL, "H5Topen2");
- if(!H5Tequal(tid, H5T_UNIX_D64BE))
+ if (!H5Tequal(tid, H5T_UNIX_D64BE))
TestErrPrintf("H5T_UNIX_D64BE datatype not found");
- status = H5Tclose (tid);
+ status = H5Tclose(tid);
CHECK(status, FAIL, "H5Tclose");
status = H5Fclose(file_id);
CHECK(status, FAIL, "H5Fclose");
-
}
#ifdef NOT_YET
@@ -129,12 +128,12 @@ test_time_commit(void)
static void
test_time_io(void)
{
- hid_t fid; /* File identifier */
- hid_t dsid; /* Dataset identifier */
- hid_t tid; /* Datatype identifier */
- hid_t sid; /* Dataspace identifier */
- time_t timenow, timethen; /* Times */
- herr_t status;
+ hid_t fid; /* File identifier */
+ hid_t dsid; /* Dataset identifier */
+ hid_t tid; /* Datatype identifier */
+ hid_t sid; /* Dataspace identifier */
+ time_t timenow, timethen; /* Times */
+ herr_t status;
/* Output message about test being performed */
MESSAGE(5, ("Testing Committing Time Datatypes\n"));
@@ -155,7 +154,7 @@ test_time_io(void)
timenow = HDtime(NULL);
/* Write time to dataset */
- status = H5Dwrite (dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timenow);
+ status = H5Dwrite(dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timenow);
CHECK(status, FAIL, "H5Dwrite");
/* Close objects */
@@ -165,7 +164,7 @@ test_time_io(void)
status = H5Sclose(sid);
CHECK(status, FAIL, "H5Sclose");
- status = H5Fclose (fid);
+ status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
/* Open file and dataset, read time back and print it in calendar format */
@@ -175,23 +174,22 @@ test_time_io(void)
dsid = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT);
CHECK(dsid, FAIL, "H5Dopen2");
-tid = H5Dget_type(dsid);
-CHECK(tid, FAIL, "H5Dget_type");
-if( H5Tget_class (tid) == H5T_TIME)
- HDfprintf(stderr,"datatype class is H5T_TIME\n");
-status = H5Tclose (tid);
-CHECK(status, FAIL, "H5Tclose");
+ tid = H5Dget_type(dsid);
+ CHECK(tid, FAIL, "H5Dget_type");
+ if (H5Tget_class(tid) == H5T_TIME)
+ HDfprintf(stderr, "datatype class is H5T_TIME\n");
+ status = H5Tclose(tid);
+ CHECK(status, FAIL, "H5Tclose");
- status = H5Dread (dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timethen);
+ status = H5Dread(dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timethen);
CHECK(status, FAIL, "H5Dread");
-HDfprintf(stderr,"time written was: %s\n", HDctime(&timethen));
+ HDfprintf(stderr, "time written was: %s\n", HDctime(&timethen));
status = H5Dclose(dsid);
CHECK(status, FAIL, "H5Dclose");
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
-
}
#endif /* NOT_YET */
@@ -206,13 +204,12 @@ test_time(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Time Datatypes\n"));
- test_time_commit(); /* Test committing time datatypes to a file */
+ test_time_commit(); /* Test committing time datatypes to a file */
#ifdef NOT_YET
- test_time_io(); /* Test writing time data to a dataset */
-#endif /* NOT_YET */
-
-} /* test_time() */
+ test_time_io(); /* Test writing time data to a dataset */
+#endif /* NOT_YET */
+} /* test_time() */
/*-------------------------------------------------------------------------
* Function: cleanup_time
@@ -233,4 +230,3 @@ cleanup_time(void)
{
HDremove(DATAFILE);
}
-
diff --git a/test/ttsafe.c b/test/ttsafe.c
index 2de460b..d2085b9 100644
--- a/test/ttsafe.c
+++ b/test/ttsafe.c
@@ -32,9 +32,8 @@
/* ANY new test needs to have a prototype in ttsafe.h */
#include "ttsafe.h"
-
#define MAX_NUM_NAME 1000
-#define NAME_OFFSET 6 /* offset for "name<num>" */
+#define NAME_OFFSET 6 /* offset for "name<num>" */
/* pre-condition: num must be a non-negative number */
H5_ATTR_PURE static unsigned
@@ -42,10 +41,10 @@ num_digits(int num)
{
unsigned u;
- if(num == 0)
+ if (num == 0)
return 1;
- for(u = 0; num > 0; u++)
+ for (u = 0; num > 0; u++)
num = num / 10;
return u;
@@ -59,43 +58,45 @@ tts_is_threadsafe(void)
hbool_t should_be;
#ifdef H5_HAVE_THREADSAFE
- is_ts = FALSE;
+ is_ts = FALSE;
should_be = TRUE;
-#else /* H5_HAVE_THREADSAFE */
- is_ts = TRUE;
+#else /* H5_HAVE_THREADSAFE */
+ is_ts = TRUE;
should_be = FALSE;
#endif /* H5_HAVE_THREADSAFE */
- if(H5is_library_threadsafe(&is_ts) != SUCCEED)
- TestErrPrintf("H5_is_library_threadsafe() call failed - test failed\n");
+ if (H5is_library_threadsafe(&is_ts) != SUCCEED)
+ TestErrPrintf("H5_is_library_threadsafe() call failed - test failed\n");
- if(is_ts != should_be)
- TestErrPrintf("Thread-safety value incorrect - test failed\n");
+ if (is_ts != should_be)
+ TestErrPrintf("Thread-safety value incorrect - test failed\n");
return;
}
/* Routine to generate attribute names for numeric values */
-char *gen_name(int value)
+char *
+gen_name(int value)
{
- char *temp;
+ char * temp;
unsigned length;
- int i;
+ int i;
- length = num_digits(MAX_NUM_NAME - 1);
- temp = (char *)HDmalloc(NAME_OFFSET + length + 1);
- temp = HDstrcpy(temp, "attrib");
+ length = num_digits(MAX_NUM_NAME - 1);
+ temp = (char *)HDmalloc(NAME_OFFSET + length + 1);
+ temp = HDstrcpy(temp, "attrib");
temp[NAME_OFFSET + length] = '\0';
for (i = (int)(length - 1); i >= 0; i--) {
temp[NAME_OFFSET + i] = (char)((int)'0' + value % 10);
- value = value / 10;
+ value = value / 10;
}
return temp;
}
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
/* Initialize testing framework */
@@ -123,7 +124,7 @@ int main(int argc, char *argv[])
TestInfo(argv[0]);
/* Parse command line arguments */
- TestParseCmdLine(argc,argv);
+ TestParseCmdLine(argc, argv);
/* Perform requested testing */
PerformTests();
@@ -142,4 +143,3 @@ int main(int argc, char *argv[])
return GetTestNumErrs();
} /* end main() */
-
diff --git a/test/ttsafe.h b/test/ttsafe.h
index f1cbe4d..e48d121 100644
--- a/test/ttsafe.h
+++ b/test/ttsafe.h
@@ -24,26 +24,24 @@
*/
#include "testhdf5.h"
-
/* Prototypes for the support routines */
-extern char* gen_name(int);
+extern char *gen_name(int);
/* Prototypes for the test routines */
-void tts_is_threadsafe(void);
+void tts_is_threadsafe(void);
#ifdef H5_HAVE_THREADSAFE
-void tts_dcreate(void);
-void tts_error(void);
-void tts_cancel(void);
-void tts_acreate(void);
-void tts_attr_vlen(void);
+void tts_dcreate(void);
+void tts_error(void);
+void tts_cancel(void);
+void tts_acreate(void);
+void tts_attr_vlen(void);
/* Prototypes for the cleanup routines */
-void cleanup_dcreate(void);
-void cleanup_error(void);
-void cleanup_cancel(void);
-void cleanup_acreate(void);
-void cleanup_attr_vlen(void);
+void cleanup_dcreate(void);
+void cleanup_error(void);
+void cleanup_cancel(void);
+void cleanup_acreate(void);
+void cleanup_attr_vlen(void);
#endif /* H5_HAVE_THREADSAFE */
#endif /* TTSAFE_H */
-
diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c
index 5c08d09..58e8d9d 100644
--- a/test/ttsafe_acreate.c
+++ b/test/ttsafe_acreate.c
@@ -35,17 +35,17 @@
#ifdef H5_HAVE_THREADSAFE
-#define FILENAME "ttsafe_acreate.h5"
-#define DATASETNAME "IntData"
-#define NUM_THREADS 16
+#define FILENAME "ttsafe_acreate.h5"
+#define DATASETNAME "IntData"
+#define NUM_THREADS 16
void *tts_acreate_thread(void *);
typedef struct acreate_data_struct {
- hid_t dataset;
- hid_t datatype;
- hid_t dataspace;
- int current_index;
+ hid_t dataset;
+ hid_t datatype;
+ hid_t dataspace;
+ int current_index;
} ttsafe_name_data_t;
void
@@ -55,17 +55,17 @@ tts_acreate(void)
H5TS_thread_t threads[NUM_THREADS];
/* HDF5 data declarations */
- hid_t file = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- hid_t dataspace = H5I_INVALID_HID;
- hid_t datatype = H5I_INVALID_HID;
- hid_t attribute = H5I_INVALID_HID;
- hsize_t dimsf[1]; /* dataset dimensions */
+ hid_t file = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t dataspace = H5I_INVALID_HID;
+ hid_t datatype = H5I_INVALID_HID;
+ hid_t attribute = H5I_INVALID_HID;
+ hsize_t dimsf[1]; /* dataset dimensions */
/* data declarations */
- int data; /* data to write */
- int buffer, i;
- herr_t status;
+ int data; /* data to write */
+ int buffer, i;
+ herr_t status;
ttsafe_name_data_t *attrib_data;
@@ -77,7 +77,7 @@ tts_acreate(void)
CHECK(file, H5I_INVALID_HID, "H5Fcreate");
/* create a simple dataspace for the dataset */
- dimsf[0] = 1;
+ dimsf[0] = 1;
dataspace = H5Screate_simple(1, dimsf, NULL);
CHECK(dataspace, H5I_INVALID_HID, "H5Screate_simple");
@@ -92,7 +92,7 @@ tts_acreate(void)
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* initialize data for dataset and write value to dataset */
- data = NUM_THREADS;
+ data = NUM_THREADS;
status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data);
CHECK(status, FAIL, "H5Dwrite");
@@ -100,24 +100,24 @@ tts_acreate(void)
* Simultaneously create a large number of attributes to be associated
* with the dataset
*/
- for(i = 0; i < NUM_THREADS; i++) {
- attrib_data = (ttsafe_name_data_t *)HDmalloc(sizeof(ttsafe_name_data_t));
- attrib_data->dataset = dataset;
- attrib_data->datatype = datatype;
- attrib_data->dataspace = dataspace;
+ for (i = 0; i < NUM_THREADS; i++) {
+ attrib_data = (ttsafe_name_data_t *)HDmalloc(sizeof(ttsafe_name_data_t));
+ attrib_data->dataset = dataset;
+ attrib_data->datatype = datatype;
+ attrib_data->dataspace = dataspace;
attrib_data->current_index = i;
- threads[i] = H5TS_create_thread(tts_acreate_thread, NULL, attrib_data);
+ threads[i] = H5TS_create_thread(tts_acreate_thread, NULL, attrib_data);
}
- for(i = 0; i < NUM_THREADS; i++)
+ for (i = 0; i < NUM_THREADS; i++)
H5TS_wait_for_thread(threads[i]);
/* verify the correctness of the test */
- for(i = 0; i < NUM_THREADS; i++) {
+ for (i = 0; i < NUM_THREADS; i++) {
attribute = H5Aopen(dataset, gen_name(i), H5P_DEFAULT);
CHECK(attribute, H5I_INVALID_HID, "H5Aopen");
- if(attribute < 0)
+ if (attribute < 0)
TestErrPrintf("unable to open appropriate attribute. Test failed!\n");
else {
status = H5Aread(attribute, H5T_NATIVE_INT, &buffer);
@@ -143,10 +143,10 @@ tts_acreate(void)
void *
tts_acreate_thread(void *client_data)
{
- hid_t attribute = H5I_INVALID_HID;
- char *attribute_name;
- int *attribute_data; /* data for attributes */
- herr_t status;
+ hid_t attribute = H5I_INVALID_HID;
+ char * attribute_name;
+ int * attribute_data; /* data for attributes */
+ herr_t status;
ttsafe_name_data_t *attrib_data;
@@ -154,15 +154,14 @@ tts_acreate_thread(void *client_data)
/* Create attribute */
attribute_name = gen_name(attrib_data->current_index);
- attribute = H5Acreate2(attrib_data->dataset, attribute_name,
- attrib_data->datatype, attrib_data->dataspace,
- H5P_DEFAULT, H5P_DEFAULT);
+ attribute = H5Acreate2(attrib_data->dataset, attribute_name, attrib_data->datatype,
+ attrib_data->dataspace, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attribute, H5I_INVALID_HID, "H5Acreate2");
/* Write data to the attribute */
- attribute_data = (int *)HDmalloc(sizeof(int));
+ attribute_data = (int *)HDmalloc(sizeof(int));
*attribute_data = attrib_data->current_index;
- status = H5Awrite(attribute, H5T_NATIVE_INT, attribute_data);
+ status = H5Awrite(attribute, H5T_NATIVE_INT, attribute_data);
CHECK(status, FAIL, "H5Awrite");
status = H5Aclose(attribute);
CHECK(status, FAIL, "H5Aclose");
@@ -176,4 +175,3 @@ cleanup_acreate(void)
}
#endif /*H5_HAVE_THREADSAFE*/
-
diff --git a/test/ttsafe_attr_vlen.c b/test/ttsafe_attr_vlen.c
index 43a5e9a..846eb15 100644
--- a/test/ttsafe_attr_vlen.c
+++ b/test/ttsafe_attr_vlen.c
@@ -16,7 +16,7 @@
* Testing for thread safety in H5A library operations.
* ------------------------------------------------------------------
*
- * Purpose: Verify that the segmentation fault described in HDFFV-11080
+ * Purpose: Verify that the segmentation fault described in HDFFV-11080
* is fixed.
*
* This test simulates what the user did to trigger the error:
@@ -30,13 +30,13 @@
* --Open the test file
* --Open and read the attribute for each opened file
*
- * The cause of the problem in this jira issue is due to the file pointer
- * that is set in the variable length string datatype for the attribute.
- * That file pointer is already closed and therefore needs to be set to
+ * The cause of the problem in this jira issue is due to the file pointer
+ * that is set in the variable length string datatype for the attribute.
+ * That file pointer is already closed and therefore needs to be set to
* the current opened file pointer when the attribute is accessed.
* Similar patch up was done before when reading dataset in H5D__read()
* in src/H5Aint.c.
- * Hopefully this kind of patch can go away when we resolve the
+ * Hopefully this kind of patch can go away when we resolve the
* shared file pointer issue.
*
********************************************************************/
@@ -45,24 +45,24 @@
#ifdef H5_HAVE_THREADSAFE
-#define FILENAME "ttsafe_attr_vlen.h5"
+#define FILENAME "ttsafe_attr_vlen.h5"
#define ATTR_NAME "root_attr"
-#define NUM_THREADS 32
+#define NUM_THREADS 32
void *tts_attr_vlen_thread(void *);
void
tts_attr_vlen(void)
{
- H5TS_thread_t threads[NUM_THREADS] = {0}; /* Thread declaration */
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hid_t atid = H5I_INVALID_HID; /* Datatype ID for attribute */
- hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */
- hid_t aid = H5I_INVALID_HID; /* The attribute ID */
- const char *string_attr = "2.0"; /* The attribute data */
- int ret; /* Return value */
- int i; /* Local index variable */
+ H5TS_thread_t threads[NUM_THREADS] = {0}; /* Thread declaration */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t atid = H5I_INVALID_HID; /* Datatype ID for attribute */
+ hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */
+ hid_t aid = H5I_INVALID_HID; /* The attribute ID */
+ const char * string_attr = "2.0"; /* The attribute data */
+ int ret; /* Return value */
+ int i; /* Local index variable */
/* Create the HDF5 test file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -106,12 +106,12 @@ tts_attr_vlen(void)
CHECK(ret, H5I_INVALID_HID, "H5Tclose");
/* Start multiple threads and execute tts_attr_vlen_thread() for each thread */
- for(i = 0; i < NUM_THREADS; i++) {
+ for (i = 0; i < NUM_THREADS; i++) {
threads[i] = H5TS_create_thread(tts_attr_vlen_thread, NULL, NULL);
}
/* Wait for the threads to end */
- for(i = 0; i < NUM_THREADS; i++)
+ for (i = 0; i < NUM_THREADS; i++)
H5TS_wait_for_thread(threads[i]);
} /* end tts_attr_vlen() */
@@ -120,13 +120,13 @@ tts_attr_vlen(void)
void *
tts_attr_vlen_thread(void H5_ATTR_UNUSED *client_data)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hid_t aid = H5I_INVALID_HID; /* Attribute ID */
- hid_t atid = H5I_INVALID_HID; /* Datatype ID for the attribute */
- char *string_attr_check; /* The attribute data being read */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t atid = H5I_INVALID_HID; /* Datatype ID for the attribute */
+ char * string_attr_check; /* The attribute data being read */
const char *string_attr = "2.0"; /* The expected attribute data */
- herr_t ret; /* Return value */
+ herr_t ret; /* Return value */
/* Open the test file */
fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -147,10 +147,10 @@ tts_attr_vlen_thread(void H5_ATTR_UNUSED *client_data)
/* Read the attribute */
ret = H5Aread(aid, atid, &string_attr_check);
CHECK(ret, FAIL, "H5Aclose");
-
+
/* Verify the attribute data is as expected */
VERIFY_STR(string_attr_check, string_attr, "H5Aread");
-
+
/* Close IDs */
ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
@@ -174,4 +174,3 @@ cleanup_attr_vlen(void)
}
#endif /*H5_HAVE_THREADSAFE*/
-
diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c
index f6bcd0d..1e40c58 100644
--- a/test/ttsafe_cancel.c
+++ b/test/ttsafe_cancel.c
@@ -36,92 +36,91 @@
#ifdef H5_HAVE_THREADSAFE
#ifndef H5_HAVE_WIN_THREADS
-#define FILENAME "ttsafe_cancel.h5"
-#define DATASETNAME "commonname"
+#define FILENAME "ttsafe_cancel.h5"
+#define DATASETNAME "commonname"
-void *tts_cancel_thread(void *);
-void tts_cancel_barrier(void);
-herr_t tts_cancel_callback(void *, hid_t, unsigned , const hsize_t *, void *);
-void cancellation_cleanup(void *);
+void * tts_cancel_thread(void *);
+void tts_cancel_barrier(void);
+herr_t tts_cancel_callback(void *, hid_t, unsigned, const hsize_t *, void *);
+void cancellation_cleanup(void *);
hid_t cancel_file;
typedef struct cleanup_struct {
- hid_t dataset;
- hid_t datatype;
- hid_t dataspace;
+ hid_t dataset;
+ hid_t datatype;
+ hid_t dataspace;
} cancel_cleanup_t;
-pthread_t childthread;
+pthread_t childthread;
pthread_mutex_t mutex;
-pthread_cond_t cond;
+pthread_cond_t cond;
void
tts_cancel(void)
{
- pthread_attr_t attribute;
- hid_t dataset;
- int buffer;
+ pthread_attr_t attribute;
+ hid_t dataset;
+ int buffer;
int H5_ATTR_NDEBUG_UNUSED ret;
/* make thread scheduling global */
- ret=pthread_attr_init(&attribute);
- assert(ret==0);
+ ret = pthread_attr_init(&attribute);
+ assert(ret == 0);
#ifdef H5_HAVE_SYSTEM_SCOPE_THREADS
- ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
- assert(ret==0);
+ ret = pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
+ assert(ret == 0);
#endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */
-
/* Initialize mutex & condition variables */
- ret=pthread_mutex_init(&mutex,NULL);
- assert(ret==0);
- ret=pthread_cond_init(&cond,NULL);
- assert(ret==0);
+ ret = pthread_mutex_init(&mutex, NULL);
+ assert(ret == 0);
+ ret = pthread_cond_init(&cond, NULL);
+ assert(ret == 0);
/*
* Create a hdf5 file using H5F_ACC_TRUNC access, default file
* creation plist and default file access plist
*/
cancel_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- assert(cancel_file>=0);
- ret=pthread_create(&childthread, &attribute, tts_cancel_thread, NULL);
- assert(ret==0);
+ assert(cancel_file >= 0);
+ ret = pthread_create(&childthread, &attribute, tts_cancel_thread, NULL);
+ assert(ret == 0);
tts_cancel_barrier();
- ret=pthread_cancel(childthread);
- assert(ret==0);
+ ret = pthread_cancel(childthread);
+ assert(ret == 0);
dataset = H5Dopen2(cancel_file, DATASETNAME, H5P_DEFAULT);
- assert(dataset>=0);
- ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer);
- assert(ret>=0);
+ assert(dataset >= 0);
+ ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer);
+ assert(ret >= 0);
if (buffer != 11)
TestErrPrintf("operation unsuccessful with value at %d instead of 11\n", buffer);
- ret=H5Dclose(dataset);
- assert(ret>=0);
- ret=H5Fclose(cancel_file);
- assert(ret>=0);
+ ret = H5Dclose(dataset);
+ assert(ret >= 0);
+ ret = H5Fclose(cancel_file);
+ assert(ret >= 0);
/* Destroy the thread attribute */
- ret=pthread_attr_destroy(&attribute);
- assert(ret==0);
+ ret = pthread_attr_destroy(&attribute);
+ assert(ret == 0);
} /* end tts_cancel() */
void *
tts_cancel_thread(void H5_ATTR_UNUSED *arg)
{
- hid_t dataspace = H5I_INVALID_HID;
- hid_t datatype = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- int datavalue;
- int buffer;
- hsize_t dimsf[1]; /* dataset dimensions */
+ hid_t dataspace = H5I_INVALID_HID;
+ hid_t datatype = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ int datavalue;
+ int buffer;
+ hsize_t dimsf[1]; /* dataset dimensions */
cancel_cleanup_t *cleanup_structure;
- herr_t status;
+ herr_t status;
/* define dataspace for dataset */
- dimsf[0] = 1;
+ dimsf[0] = 1;
dataspace = H5Screate_simple(1, dimsf, NULL);
CHECK(dataspace, H5I_INVALID_HID, "H5Screate_simple");
@@ -132,19 +131,19 @@ tts_cancel_thread(void H5_ATTR_UNUSED *arg)
CHECK(status, FAIL, "H5Tset_order");
/* create a new dataset within the file */
- dataset = H5Dcreate2(cancel_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset =
+ H5Dcreate2(cancel_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* If thread is cancelled, make cleanup call */
- cleanup_structure = (cancel_cleanup_t*)HDmalloc(sizeof(cancel_cleanup_t));
- cleanup_structure->dataset = dataset;
- cleanup_structure->datatype = datatype;
+ cleanup_structure = (cancel_cleanup_t *)HDmalloc(sizeof(cancel_cleanup_t));
+ cleanup_structure->dataset = dataset;
+ cleanup_structure->datatype = datatype;
cleanup_structure->dataspace = dataspace;
pthread_cleanup_push(cancellation_cleanup, cleanup_structure);
-
datavalue = 1;
- status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue);
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue);
CHECK(status, FAIL, "H5Dwrite");
status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer);
@@ -155,7 +154,7 @@ tts_cancel_thread(void H5_ATTR_UNUSED *arg)
HDsleep(3);
datavalue = 100;
- status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue);
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue);
CHECK(status, FAIL, "H5Dwrite");
status = H5Dclose(dataset);
@@ -176,10 +175,10 @@ tts_cancel_thread(void H5_ATTR_UNUSED *arg)
herr_t
tts_cancel_callback(void *elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_ATTR_UNUSED ndim,
- const hsize_t H5_ATTR_UNUSED *point, void *operator_data)
+ const hsize_t H5_ATTR_UNUSED *point, void *operator_data)
{
- hid_t dataset = *(hid_t *)operator_data;
- int value = *(int *)elem;
+ hid_t dataset = *(hid_t *)operator_data;
+ int value = *(int *)elem;
herr_t status;
tts_cancel_barrier();
@@ -205,7 +204,7 @@ void
cancellation_cleanup(void *arg)
{
cancel_cleanup_t *cleanup_structure = (cancel_cleanup_t *)arg;
- herr_t status;
+ herr_t status;
status = H5Dclose(cleanup_structure->dataset);
CHECK(status, FAIL, "H5Dclose");
@@ -226,7 +225,7 @@ void
tts_cancel_barrier(void)
{
static int count = 2;
- int status;
+ int status;
status = pthread_mutex_lock(&mutex);
VERIFY(status, 0, "pthread_mutex_lock");
@@ -245,11 +244,11 @@ tts_cancel_barrier(void)
VERIFY(status, 0, "pthread_mutex_unlock");
} /* end tts_cancel_barrier() */
-void cleanup_cancel(void)
+void
+cleanup_cancel(void)
{
HDunlink(FILENAME);
}
#endif /*H5_HAVE_WIN_THREADS*/
#endif /*H5_HAVE_THREADSAFE*/
-
diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c
index 36b5f1f..cedafd0 100644
--- a/test/ttsafe_dcreate.c
+++ b/test/ttsafe_dcreate.c
@@ -31,39 +31,24 @@
#ifdef H5_HAVE_THREADSAFE
-#define FILENAME "ttsafe_dcreate.h5"
-#define NUM_THREAD 16
+#define FILENAME "ttsafe_dcreate.h5"
+#define NUM_THREAD 16
void *tts_dcreate_creator(void *);
typedef struct thread_info {
- int id;
- hid_t file;
- const char *dsetname;
+ int id;
+ hid_t file;
+ const char *dsetname;
} thread_info;
/*
* Set individual dataset names (rather than generated the names
* automatically)
*/
-const char *dsetname[NUM_THREAD]={
- "zero",
- "one",
- "two",
- "three",
- "four",
- "five",
- "six",
- "seven",
- "eight",
- "nine",
- "ten",
- "eleven",
- "twelve",
- "thirteen",
- "fourteen",
- "fifteen"
-};
+const char *dsetname[NUM_THREAD] = {"zero", "one", "two", "three", "four", "five",
+ "six", "seven", "eight", "nine", "ten", "eleven",
+ "twelve", "thirteen", "fourteen", "fifteen"};
thread_info thread_out[NUM_THREAD];
@@ -79,11 +64,11 @@ tts_dcreate(void)
H5TS_thread_t threads[NUM_THREAD];
/* HDF5 data definitions */
- hid_t file = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- int datavalue, i;
+ hid_t file = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ int datavalue, i;
H5TS_attr_t attribute;
- herr_t status;
+ herr_t status;
/* set pthread attribute to perform global scheduling */
H5TS_attr_init(&attribute);
@@ -101,30 +86,31 @@ tts_dcreate(void)
CHECK(file, H5I_INVALID_HID, "H5Fcreate");
/* simultaneously create a large number of datasets within the file */
- for(i = 0; i < NUM_THREAD; i++) {
- thread_out[i].id = i;
- thread_out[i].file = file;
+ for (i = 0; i < NUM_THREAD; i++) {
+ thread_out[i].id = i;
+ thread_out[i].file = file;
thread_out[i].dsetname = dsetname[i];
- threads[i] = H5TS_create_thread(tts_dcreate_creator, NULL, &thread_out[i]);
+ threads[i] = H5TS_create_thread(tts_dcreate_creator, NULL, &thread_out[i]);
}
- for(i = 0;i < NUM_THREAD; i++)
+ for (i = 0; i < NUM_THREAD; i++)
H5TS_wait_for_thread(threads[i]);
/* compare data to see if it is written correctly */
- for(i = 0; i < NUM_THREAD; i++) {
- if((dataset = H5Dopen2(file, dsetname[i], H5P_DEFAULT)) < 0) {
+ for (i = 0; i < NUM_THREAD; i++) {
+ if ((dataset = H5Dopen2(file, dsetname[i], H5P_DEFAULT)) < 0) {
TestErrPrintf("Dataset name not found - test failed\n");
H5Fclose(file);
return;
- } else {
+ }
+ else {
status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue);
CHECK(status, FAIL, "H5Dread");
- if(datavalue != i) {
- TestErrPrintf("Wrong value read %d for dataset name %s - test failed\n",
- datavalue, dsetname[i]);
+ if (datavalue != i) {
+ TestErrPrintf("Wrong value read %d for dataset name %s - test failed\n", datavalue,
+ dsetname[i]);
status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
status = H5Fclose(file);
@@ -132,7 +118,7 @@ tts_dcreate(void)
return;
}
- status= H5Dclose(dataset);
+ status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
}
}
@@ -148,27 +134,26 @@ tts_dcreate(void)
void *
tts_dcreate_creator(void *_thread_data)
{
- hid_t dataspace = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- herr_t status;
- hsize_t dimsf[1]; /* dataset dimensions */
+ hid_t dataspace = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ herr_t status;
+ hsize_t dimsf[1]; /* dataset dimensions */
struct thread_info thread_data;
memcpy(&thread_data, _thread_data, sizeof(struct thread_info));
/* define dataspace for dataset */
- dimsf[0] = 1;
+ dimsf[0] = 1;
dataspace = H5Screate_simple(1, dimsf, NULL);
CHECK(dataspace, H5I_INVALID_HID, "H5Screate_simple");
/* create a new dataset within the file */
- dataset = H5Dcreate2(thread_data.file, thread_data.dsetname,
- H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(thread_data.file, thread_data.dsetname, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* initialize data for dataset and write value to dataset */
- status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, &thread_data.id);
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &thread_data.id);
CHECK(status, FAIL, "H5Dwrite");
/* close dataset and dataspace resources */
@@ -186,4 +171,3 @@ cleanup_dcreate(void)
HDunlink(FILENAME);
}
#endif /*H5_HAVE_THREADSAFE*/
-
diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c
index 9eeaa24..f92c65e 100644
--- a/test/ttsafe_error.c
+++ b/test/ttsafe_error.c
@@ -33,13 +33,13 @@
#ifdef H5_HAVE_THREADSAFE
-#define NUM_THREAD 16
-#define FILENAME "ttsafe_error.h5"
+#define NUM_THREAD 16
+#define FILENAME "ttsafe_error.h5"
/* Having a common dataset name is an error */
-#define DATASETNAME "commonname"
-#define EXPECTED_ERROR_DEPTH 10
-#define WRITE_NUMBER 37
+#define DATASETNAME "commonname"
+#define EXPECTED_ERROR_DEPTH 10
+#define WRITE_NUMBER 37
/* Typedefs */
typedef struct err_num_struct {
@@ -48,28 +48,27 @@ typedef struct err_num_struct {
} err_num_t;
/* Global variables */
-hid_t error_file_g = H5I_INVALID_HID;
-int error_flag_g = 0;
-int error_count_g = 0;
+hid_t error_file_g = H5I_INVALID_HID;
+int error_flag_g = 0;
+int error_count_g = 0;
err_num_t expected_g[EXPECTED_ERROR_DEPTH];
H5TS_mutex_simple_t error_mutex_g;
/* Prototypes */
-static herr_t error_callback(hid_t , void *);
+static herr_t error_callback(hid_t, void *);
static herr_t walk_error_callback(unsigned, const H5E_error2_t *, void *);
-static void *tts_error_thread(void *);
-
+static void * tts_error_thread(void *);
void
tts_error(void)
{
- hid_t def_fapl = H5I_INVALID_HID;
- hid_t vol_id = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- H5TS_thread_t threads[NUM_THREAD];
- H5TS_attr_t attribute;
- int value, i;
- herr_t status;
+ hid_t def_fapl = H5I_INVALID_HID;
+ hid_t vol_id = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ H5TS_thread_t threads[NUM_THREAD];
+ H5TS_attr_t attribute;
+ int value, i;
+ herr_t status;
/* Must initialize these at runtime */
expected_g[0].maj_num = H5E_DATASET;
@@ -119,7 +118,7 @@ tts_error(void)
status = H5Pget_vol_id(def_fapl, &vol_id);
CHECK(status, FAIL, "H5Pget_vol_id");
- if(vol_id == H5VL_NATIVE) {
+ if (vol_id == H5VL_NATIVE) {
/* Create a hdf5 file using H5F_ACC_TRUNC access, default file
* creation plist and default file access plist
*/
@@ -133,12 +132,13 @@ tts_error(void)
H5TS_wait_for_thread(threads[i]);
if (error_flag_g) {
- TestErrPrintf("At least one thread reported a value that was different from the expected value\n");
+ TestErrPrintf(
+ "At least one thread reported a value that was different from the expected value\n");
HDprintf("(Update this test if the error stack changed!)\n");
}
if (error_count_g != NUM_THREAD - 1)
- TestErrPrintf("Error: %d threads failed instead of %d\n", error_count_g, NUM_THREAD-1);
+ TestErrPrintf("Error: %d threads failed instead of %d\n", error_count_g, NUM_THREAD - 1);
dataset = H5Dopen2(error_file_g, DATASETNAME, H5P_DEFAULT);
CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
@@ -166,14 +166,14 @@ tts_error(void)
static void *
tts_error_thread(void H5_ATTR_UNUSED *arg)
{
- hid_t dataspace = H5I_INVALID_HID;
- hid_t datatype = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- hsize_t dimsf[1]; /* dataset dimensions */
+ hid_t dataspace = H5I_INVALID_HID;
+ hid_t datatype = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hsize_t dimsf[1]; /* dataset dimensions */
H5E_auto2_t old_error_cb;
- void *old_error_client_data;
- int value;
- herr_t status;
+ void * old_error_client_data;
+ int value;
+ herr_t status;
/* preserve previous error stack handler */
status = H5Eget_auto2(H5E_DEFAULT, &old_error_cb, &old_error_client_data);
@@ -184,7 +184,7 @@ tts_error_thread(void H5_ATTR_UNUSED *arg)
CHECK(status, FAIL, "H5Eset_auto2");
/* define dataspace for dataset */
- dimsf[0] = 1;
+ dimsf[0] = 1;
dataspace = H5Screate_simple(1, dimsf, NULL);
CHECK(dataspace, H5I_INVALID_HID, "H5Screate_simple");
@@ -195,10 +195,11 @@ tts_error_thread(void H5_ATTR_UNUSED *arg)
CHECK(status, FAIL, "H5Tset_order");
/* create a new dataset within the file */
- dataset = H5Dcreate2(error_file_g, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset =
+ H5Dcreate2(error_file_g, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Most of these will fail, so don't check the error here */
if (dataset >= 0) {
- value = WRITE_NUMBER;
+ value = WRITE_NUMBER;
status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
CHECK(status, FAIL, "H5Dwrite");
status = H5Dclose(dataset);
@@ -229,8 +230,8 @@ error_callback(hid_t H5_ATTR_UNUSED estack_id, void *client_data)
static herr_t
walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void H5_ATTR_UNUSED *client_data)
{
- hid_t maj_num = H5I_INVALID_HID;
- hid_t min_num = H5I_INVALID_HID;
+ hid_t maj_num = H5I_INVALID_HID;
+ hid_t min_num = H5I_INVALID_HID;
if (err_desc) {
maj_num = err_desc->maj_num;
@@ -251,4 +252,3 @@ cleanup_error(void)
}
#endif /*H5_HAVE_THREADSAFE*/
-
diff --git a/test/ttst.c b/test/ttst.c
index c5912c5..4d6cdf0 100644
--- a/test/ttst.c
+++ b/test/ttst.c
@@ -35,13 +35,12 @@
#include "H5STprivate.h"
/* Test words to insert into s TST */
-static const char *words[]={
- "We", "hold", "these", "truths", "to", "be", "self-evident,", "that",
- "all", "men", "are", "created", "equal,", "that", "they", "are", "endowed",
- "by", "their", "Creator", "with", "certain", "unalienable", "Rights,",
- "that", "among", "these", "are", "Life,", "Liberty", "and", "the",
- "pursuit", "of", "Happiness."
-};
+static const char *words[] = {
+ "We", "hold", "these", "truths", "to", "be", "self-evident,",
+ "that", "all", "men", "are", "created", "equal,", "that",
+ "they", "are", "endowed", "by", "their", "Creator", "with",
+ "certain", "unalienable", "Rights,", "that", "among", "these", "are",
+ "Life,", "Liberty", "and", "the", "pursuit", "of", "Happiness."};
/* Number of words in test words set */
size_t num_words;
@@ -54,9 +53,10 @@ char **rand_uniq_words;
/* Sorted order version of words in test word set */
char **sort_uniq_words;
-static int tst_strcmp(const void *_s1, const void *_s2)
+static int
+tst_strcmp(const void *_s1, const void *_s2)
{
- return(HDstrcmp(*(const char * const *)_s1,*(const char * const *)_s2));
+ return (HDstrcmp(*(const char *const *)_s1, *(const char *const *)_s2));
}
/****************************************************************
@@ -68,71 +68,71 @@ static int tst_strcmp(const void *_s1, const void *_s2)
static void
test_tst_init(void)
{
- time_t curr_time; /* Current time, for seeding random number generator */
- char *tmp_word;/* Temporary pointer to word in word set */
- size_t u,v,w; /* Local index variables */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ char * tmp_word; /* Temporary pointer to word in word set */
+ size_t u, v, w; /* Local index variables */
/* Compute the number of words in the test set */
- num_words=sizeof(words)/sizeof(words[0]);
+ num_words = sizeof(words) / sizeof(words[0]);
/* Determine the number of unique words in test set */
/* (Not particularly efficient, be careful if many words are added to set) */
- num_uniq_words=0;
- for(u=0; u<num_words; u++) {
+ num_uniq_words = 0;
+ for (u = 0; u < num_words; u++) {
/* Assume word is unique */
num_uniq_words++;
- for(v=0; v<u; v++)
+ for (v = 0; v < u; v++)
/* If word is already found in words looked at, decrement unique count */
- if(!HDstrcmp(words[u],words[v])) {
+ if (!HDstrcmp(words[u], words[v])) {
num_uniq_words--;
break;
} /* end if */
- } /* end for */
+ } /* end for */
/* Allocate space for the array of unique words */
- uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words);
+ uniq_words = (char **)HDmalloc(sizeof(char *) * num_uniq_words);
/* Allocate space for the array of randomized order unique words also */
- rand_uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words);
+ rand_uniq_words = (char **)HDmalloc(sizeof(char *) * num_uniq_words);
/* Allocate space for the array of sorted order unique words also */
- sort_uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words);
+ sort_uniq_words = (char **)HDmalloc(sizeof(char *) * num_uniq_words);
/* Insert unique words from test set into unique word set */
- w=0;
- for(u=0; u<num_words; u++) {
+ w = 0;
+ for (u = 0; u < num_words; u++) {
/* Assume word is unique */
- tmp_word=(char *)words[u];
- for(v=0; v<u; v++)
+ tmp_word = (char *)words[u];
+ for (v = 0; v < u; v++)
/* If word is already found in words looked at, decrement unique count */
- if(!HDstrcmp(words[u],words[v])) {
- tmp_word=NULL;
+ if (!HDstrcmp(words[u], words[v])) {
+ tmp_word = NULL;
break;
} /* end if */
/* Check if word was actually unique */
- if(tmp_word!=NULL)
- uniq_words[w++]=tmp_word;
+ if (tmp_word != NULL)
+ uniq_words[w++] = tmp_word;
} /* end for */
/* Create randomized set of unique words */
- for(u=0; u<num_uniq_words; u++)
- rand_uniq_words[u]=uniq_words[u];
- curr_time=HDtime(NULL);
+ for (u = 0; u < num_uniq_words; u++)
+ rand_uniq_words[u] = uniq_words[u];
+ curr_time = HDtime(NULL);
HDsrandom((unsigned)curr_time);
- for(u=0; u<num_uniq_words; u++) {
+ for (u = 0; u < num_uniq_words; u++) {
v = u + ((size_t)HDrandom() % (num_uniq_words - u));
- if(u!=v) {
- tmp_word=rand_uniq_words[u];
- rand_uniq_words[u]=rand_uniq_words[v];
- rand_uniq_words[v]=tmp_word;
+ if (u != v) {
+ tmp_word = rand_uniq_words[u];
+ rand_uniq_words[u] = rand_uniq_words[v];
+ rand_uniq_words[v] = tmp_word;
} /* end if */
- } /* end for */
+ } /* end for */
/* Create sorted set of unique words */
- for(u=0; u<num_uniq_words; u++)
- sort_uniq_words[u]=uniq_words[u];
- HDqsort(sort_uniq_words,num_uniq_words,sizeof(char *),tst_strcmp);
+ for (u = 0; u < num_uniq_words; u++)
+ sort_uniq_words[u] = uniq_words[u];
+ HDqsort(sort_uniq_words, num_uniq_words, sizeof(char *), tst_strcmp);
} /* end test_tst_init() */
/****************************************************************
@@ -144,23 +144,23 @@ test_tst_init(void)
static void
test_tst_create(void)
{
- H5ST_tree_t *tree; /* TST created */
- herr_t ret; /* Generic return value */
+ H5ST_tree_t *tree; /* TST created */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Creating & Closing TSTs\n"));
/* Try closing a NULL tree */
- tree=NULL;
- ret=H5ST_close(tree);
+ tree = NULL;
+ ret = H5ST_close(tree);
VERIFY(ret, FAIL, "H5ST_close");
/* Try creating a TST */
- tree=H5ST_create();
+ tree = H5ST_create();
CHECK_PTR(tree, "H5ST_create");
/* Try closing a real tree */
- ret=H5ST_close(tree);
+ ret = H5ST_close(tree);
CHECK(ret, FAIL, "H5ST_close");
} /* end test_tst_create() */
@@ -175,55 +175,57 @@ static void
test_tst_insert(void)
{
H5ST_tree_t *tree; /* TST created */
- H5ST_ptr_t found; /* Pointer to TST node found */
- void *obj; /* Pointer to object located in TST */
- size_t u; /* Local index counter */
- htri_t check; /* Is string in TST? */
- herr_t ret; /* Generic return value */
+ H5ST_ptr_t found; /* Pointer to TST node found */
+ void * obj; /* Pointer to object located in TST */
+ size_t u; /* Local index counter */
+ htri_t check; /* Is string in TST? */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Inserting Values into TSTs\n"));
/* Create the TST */
- tree=H5ST_create();
+ tree = H5ST_create();
CHECK_PTR(tree, "H5ST_create");
/* Insert unique words into TST, in random order */
- for(u=0; u<num_uniq_words; u++) {
- ret=H5ST_insert(tree,rand_uniq_words[u],rand_uniq_words[u]);
+ for (u = 0; u < num_uniq_words; u++) {
+ ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]);
CHECK(ret, FAIL, "H5ST_insert");
} /* end for */
/* Verify that all words were inserted into TST properly */
- for(u=0; u<num_uniq_words; u++) {
+ for (u = 0; u < num_uniq_words; u++) {
/* Check that the word is present */
- check=H5ST_search(tree,uniq_words[u]);
+ check = H5ST_search(tree, uniq_words[u]);
VERIFY(check, TRUE, "H5ST_search");
/* Check that the value "payloads" are correct */
- found=H5ST_find(tree,uniq_words[u]);
+ found = H5ST_find(tree, uniq_words[u]);
CHECK_PTR(found, "H5ST_find");
- if(HDstrcmp((const char *)found->eqkid,uniq_words[u]))
- TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,uniq_words[u]);
+ if (HDstrcmp((const char *)found->eqkid, uniq_words[u]))
+ TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n", __LINE__,
+ (char *)found->eqkid, (unsigned)u, uniq_words[u]);
- obj=H5ST_locate(tree,uniq_words[u]);
+ obj = H5ST_locate(tree, uniq_words[u]);
CHECK_PTR(obj, "H5ST_locate");
- if(HDstrcmp((const char *)obj,uniq_words[u]))
- TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,uniq_words[u]);
+ if (HDstrcmp((const char *)obj, uniq_words[u]))
+ TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n", __LINE__, (char *)obj,
+ (unsigned)u, uniq_words[u]);
} /* end for */
/* Verify that words not in the TST aren't found */
- check=H5ST_search(tree,"foo");
+ check = H5ST_search(tree, "foo");
VERIFY(check, FALSE, "H5ST_search");
- check=H5ST_search(tree,"bar");
+ check = H5ST_search(tree, "bar");
VERIFY(check, FALSE, "H5ST_search");
- check=H5ST_search(tree,"baz");
+ check = H5ST_search(tree, "baz");
VERIFY(check, FALSE, "H5ST_search");
/* Close the TST */
- ret=H5ST_close(tree);
+ ret = H5ST_close(tree);
CHECK(ret, FAIL, "H5ST_close");
} /* end test_tst_insert() */
@@ -237,39 +239,40 @@ static void
test_tst_iterate(void)
{
H5ST_tree_t *tree; /* TST created */
- H5ST_ptr_t found; /* Pointer to TST node found */
- size_t u; /* Local index counter */
- herr_t ret; /* Generic return value */
+ H5ST_ptr_t found; /* Pointer to TST node found */
+ size_t u; /* Local index counter */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Iterating Over TSTs\n"));
/* Create the TST */
- tree=H5ST_create();
+ tree = H5ST_create();
CHECK_PTR(tree, "H5ST_create");
/* Insert unique words into TST, in random order */
- for(u=0; u<num_uniq_words; u++) {
- ret=H5ST_insert(tree,rand_uniq_words[u],rand_uniq_words[u]);
+ for (u = 0; u < num_uniq_words; u++) {
+ ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]);
CHECK(ret, FAIL, "H5ST_insert");
} /* end for */
/* Use findfirst/findnext calls to iterate through TST */
- found=H5ST_findfirst(tree);
+ found = H5ST_findfirst(tree);
CHECK_PTR(found, "H5ST_findfirst");
- u=0;
+ u = 0;
do {
/* Check that the strings in the TST are in the correct order */
- if(HDstrcmp((const char *)found->eqkid,sort_uniq_words[u]))
- TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, sort_uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,sort_uniq_words[u]);
+ if (HDstrcmp((const char *)found->eqkid, sort_uniq_words[u]))
+ TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, sort_uniq_words[%u]=%s\n",
+ __LINE__, (char *)found->eqkid, (unsigned)u, sort_uniq_words[u]);
/* Advance to next string in TST */
- found=H5ST_findnext(found);
+ found = H5ST_findnext(found);
u++;
- } while(found!=NULL);
+ } while (found != NULL);
/* Close the TST */
- ret=H5ST_close(tree);
+ ret = H5ST_close(tree);
CHECK(ret, FAIL, "H5ST_close");
} /* end test_tst_iterate() */
@@ -283,66 +286,68 @@ static void
test_tst_remove(void)
{
H5ST_tree_t *tree; /* TST created */
- H5ST_ptr_t found; /* Pointer to TST node found */
- void *obj; /* Pointer to object removed from TST */
- htri_t check; /* Is string in TST? */
- size_t u; /* Local index counter */
- herr_t ret; /* Generic return value */
+ H5ST_ptr_t found; /* Pointer to TST node found */
+ void * obj; /* Pointer to object removed from TST */
+ htri_t check; /* Is string in TST? */
+ size_t u; /* Local index counter */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Removing String Values from TSTs\n"));
/* Create the TST */
- tree=H5ST_create();
+ tree = H5ST_create();
CHECK_PTR(tree, "H5ST_create");
/* Insert unique words into TST, in random order */
- for(u=0; u<num_uniq_words; u++) {
- ret=H5ST_insert(tree,rand_uniq_words[u],rand_uniq_words[u]);
+ for (u = 0; u < num_uniq_words; u++) {
+ ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]);
CHECK(ret, FAIL, "H5ST_insert");
} /* end for */
/* Remove strings from TST in random order */
- for(u=0; u<num_uniq_words; u++) {
- obj=H5ST_remove(tree,rand_uniq_words[u]);
+ for (u = 0; u < num_uniq_words; u++) {
+ obj = H5ST_remove(tree, rand_uniq_words[u]);
CHECK_PTR(obj, "H5ST_remove");
/* Check that the correct string was removed from TST */
- if(HDstrcmp((const char *)obj,rand_uniq_words[u]))
- TestErrPrintf("%d: TST node values don't match!, obj=%s, rand_uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,rand_uniq_words[u]);
+ if (HDstrcmp((const char *)obj, rand_uniq_words[u]))
+ TestErrPrintf("%d: TST node values don't match!, obj=%s, rand_uniq_words[%u]=%s\n", __LINE__,
+ (char *)obj, (unsigned)u, rand_uniq_words[u]);
/* Check that the string can't be found in the TST any longer */
- check=H5ST_search(tree,rand_uniq_words[u]);
+ check = H5ST_search(tree, rand_uniq_words[u]);
VERIFY(check, FALSE, "H5ST_search");
} /* end for */
/* Re-insert unique words into TST, in random order */
- for(u=0; u<num_uniq_words; u++) {
- ret=H5ST_insert(tree,rand_uniq_words[u],rand_uniq_words[u]);
+ for (u = 0; u < num_uniq_words; u++) {
+ ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]);
CHECK(ret, FAIL, "H5ST_insert");
} /* end for */
/* Remove TST nodes from TST in random order */
- for(u=0; u<num_uniq_words; u++) {
+ for (u = 0; u < num_uniq_words; u++) {
/* Get the pointer to the node to delete */
- found=H5ST_find(tree,rand_uniq_words[u]);
+ found = H5ST_find(tree, rand_uniq_words[u]);
CHECK_PTR(found, "H5ST_find");
/* Check that the correct object will be removed from TST */
- if(HDstrcmp((const char *)found->eqkid,rand_uniq_words[u]))
- TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, rand_uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,rand_uniq_words[u]);
+ if (HDstrcmp((const char *)found->eqkid, rand_uniq_words[u]))
+ TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, rand_uniq_words[%u]=%s\n",
+ __LINE__, (char *)found->eqkid, (unsigned)u, rand_uniq_words[u]);
/* Remove the node */
- ret=H5ST_delete(tree,found);
+ ret = H5ST_delete(tree, found);
CHECK(ret, FAIL, "H5ST_delete");
/* Check that the string can't be found in the TST any longer */
- check=H5ST_search(tree,rand_uniq_words[u]);
+ check = H5ST_search(tree, rand_uniq_words[u]);
VERIFY(check, FALSE, "H5ST_search");
} /* end for */
/* Close the TST */
- ret=H5ST_close(tree);
+ ret = H5ST_close(tree);
CHECK(ret, FAIL, "H5ST_close");
} /* end test_tst_remove() */
@@ -376,12 +381,11 @@ test_tst(void)
test_tst_init();
/* Actual TST tests */
- test_tst_create(); /* Test TST creation */
- test_tst_insert(); /* Test TST insertion */
- test_tst_iterate(); /* Test TST iteration */
- test_tst_remove(); /* Test TST deletion */
+ test_tst_create(); /* Test TST creation */
+ test_tst_insert(); /* Test TST insertion */
+ test_tst_iterate(); /* Test TST iteration */
+ test_tst_remove(); /* Test TST deletion */
/* Finalize TST testing data */
test_tst_finalize();
-} /* end test_tst() */
-
+} /* end test_tst() */
diff --git a/test/tunicode.c b/test/tunicode.c
index 6f7431b..28f819b 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -14,26 +14,26 @@
/* Unicode test */
#include "testhdf5.h"
-#define NUM_CHARS 16
-#define MAX_STRING_LENGTH ((NUM_CHARS * 4) + 1) /* Max length in bytes */
-#define MAX_PATH_LENGTH (MAX_STRING_LENGTH + 20) /* Max length in bytes */
-#define MAX_CODE_POINT 0x200000
-#define FILENAME "unicode.h5"
+#define NUM_CHARS 16
+#define MAX_STRING_LENGTH ((NUM_CHARS * 4) + 1) /* Max length in bytes */
+#define MAX_PATH_LENGTH (MAX_STRING_LENGTH + 20) /* Max length in bytes */
+#define MAX_CODE_POINT 0x200000
+#define FILENAME "unicode.h5"
/* A buffer to hold two copies of the UTF-8 string */
#define LONG_BUF_SIZE (2 * MAX_STRING_LENGTH + 4)
-#define DSET1_NAME "fl_string_dataset"
-#define DSET3_NAME "dataset3"
-#define DSET4_NAME "dataset4"
+#define DSET1_NAME "fl_string_dataset"
+#define DSET3_NAME "dataset3"
+#define DSET4_NAME "dataset4"
#define VL_DSET1_NAME "vl_dset_1"
-#define GROUP1_NAME "group1"
-#define GROUP2_NAME "group2"
-#define GROUP3_NAME "group3"
-#define GROUP4_NAME "group4"
-
-#define RANK 1
-#define COMP_INT_VAL 7
-#define COMP_FLOAT_VAL -42.0F
+#define GROUP1_NAME "group1"
+#define GROUP2_NAME "group2"
+#define GROUP3_NAME "group3"
+#define GROUP4_NAME "group4"
+
+#define RANK 1
+#define COMP_INT_VAL 7
+#define COMP_FLOAT_VAL -42.0F
#define COMP_DOUBLE_VAL 42.0F
/* Test function prototypes */
@@ -48,62 +48,63 @@ void test_opaque(hid_t fid, const char *string);
/* Utility function prototypes */
static hid_t mkstr(size_t len, H5T_str_t strpad);
-unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos);
-void dump_string(const char * string);
+unsigned int write_char(unsigned int c, char *test_string, unsigned int cur_pos);
+void dump_string(const char *string);
/*
* test_fl_string
* Tests that UTF-8 can be used for fixed-length string data.
* Writes the string to a dataset and reads it back again.
*/
-void test_fl_string(hid_t fid, const char *string)
+void
+test_fl_string(hid_t fid, const char *string)
{
- hid_t dtype_id, space_id, dset_id;
- hsize_t dims = 1;
- char read_buf[MAX_STRING_LENGTH];
- H5T_cset_t cset;
- herr_t ret;
-
- /* Create the datatype, ensure that the character set behaves
- * correctly (it should default to ASCII and can be set to UTF8)
- */
- dtype_id = H5Tcopy(H5T_C_S1);
- CHECK(dtype_id, FAIL, "H5Tcopy");
- ret = H5Tset_size(dtype_id, (size_t)MAX_STRING_LENGTH);
- CHECK(ret, FAIL, "H5Tset_size");
- cset = H5Tget_cset(dtype_id);
- VERIFY(cset, H5T_CSET_ASCII, "H5Tget_cset");
- ret = H5Tset_cset(dtype_id, H5T_CSET_UTF8);
- CHECK(ret, FAIL, "H5Tset_cset");
- cset = H5Tget_cset(dtype_id);
- VERIFY(cset, H5T_CSET_UTF8, "H5Tget_cset");
-
- /* Create dataspace for a dataset */
- space_id = H5Screate_simple(RANK, &dims, NULL);
- CHECK(space_id, FAIL, "H5Screate_simple");
-
- /* Create a dataset */
- dset_id = H5Dcreate2(fid, DSET1_NAME, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset_id, FAIL, "H5Dcreate2");
-
- /* Write UTF-8 string to dataset */
- ret = H5Dwrite(dset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, string);
- CHECK(ret, FAIL, "H5Dwrite");
-
- /* Read string back and make sure it is unchanged */
- ret = H5Dread(dset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf);
- CHECK(ret, FAIL, "H5Dread");
-
- VERIFY(HDstrcmp(string, read_buf), 0, "strcmp");
-
- /* Close all */
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
-
- ret = H5Tclose(dtype_id);
- CHECK(ret, FAIL, "H5Tclose");
- ret = H5Sclose(space_id);
- CHECK(ret, FAIL, "H5Sclose");
+ hid_t dtype_id, space_id, dset_id;
+ hsize_t dims = 1;
+ char read_buf[MAX_STRING_LENGTH];
+ H5T_cset_t cset;
+ herr_t ret;
+
+ /* Create the datatype, ensure that the character set behaves
+ * correctly (it should default to ASCII and can be set to UTF8)
+ */
+ dtype_id = H5Tcopy(H5T_C_S1);
+ CHECK(dtype_id, FAIL, "H5Tcopy");
+ ret = H5Tset_size(dtype_id, (size_t)MAX_STRING_LENGTH);
+ CHECK(ret, FAIL, "H5Tset_size");
+ cset = H5Tget_cset(dtype_id);
+ VERIFY(cset, H5T_CSET_ASCII, "H5Tget_cset");
+ ret = H5Tset_cset(dtype_id, H5T_CSET_UTF8);
+ CHECK(ret, FAIL, "H5Tset_cset");
+ cset = H5Tget_cset(dtype_id);
+ VERIFY(cset, H5T_CSET_UTF8, "H5Tget_cset");
+
+ /* Create dataspace for a dataset */
+ space_id = H5Screate_simple(RANK, &dims, NULL);
+ CHECK(space_id, FAIL, "H5Screate_simple");
+
+ /* Create a dataset */
+ dset_id = H5Dcreate2(fid, DSET1_NAME, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dcreate2");
+
+ /* Write UTF-8 string to dataset */
+ ret = H5Dwrite(dset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, string);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Read string back and make sure it is unchanged */
+ ret = H5Dread(dset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ VERIFY(HDstrcmp(string, read_buf), 0, "strcmp");
+
+ /* Close all */
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ ret = H5Tclose(dtype_id);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
}
/*
@@ -113,52 +114,52 @@ void test_fl_string(hid_t fid, const char *string)
* Borrows heavily from dtypes.c, but is more complicated because
* the string is randomly generated.
*/
-void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
+void
+test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
{
/* buf is used to hold the data that H5Tconvert operates on. */
- char buf[LONG_BUF_SIZE];
+ char buf[LONG_BUF_SIZE];
/* cmpbuf holds the output that H5Tconvert should produce,
* to compare against the actual output. */
- char cmpbuf[LONG_BUF_SIZE];
+ char cmpbuf[LONG_BUF_SIZE];
/* new_string is a slightly modified version of the UTF-8
* string to make the tests run more smoothly. */
- char new_string[MAX_STRING_LENGTH + 2];
+ char new_string[MAX_STRING_LENGTH + 2];
- size_t length; /* Length of new_string in bytes */
- size_t small_len; /* Size of the small datatype */
- size_t big_len; /* Size of the larger datatype */
- hid_t src_type, dst_type;
- herr_t ret;
+ size_t length; /* Length of new_string in bytes */
+ size_t small_len; /* Size of the small datatype */
+ size_t big_len; /* Size of the larger datatype */
+ hid_t src_type, dst_type;
+ herr_t ret;
/* The following tests are simpler if the UTF-8 string contains
* the right number of bytes (even or odd, depending on the test).
* We create a 'new_string' whose length is convenient by prepending
* an 'x' to 'string' when necessary. */
length = HDstrlen(string);
- if(length % 2 != 1)
- {
- HDstrcpy(new_string, "x");
- HDstrcat(new_string, string);
- length++;
- } else {
- HDstrcpy(new_string, string);
+ if (length % 2 != 1) {
+ HDstrcpy(new_string, "x");
+ HDstrcat(new_string, string);
+ length++;
+ }
+ else {
+ HDstrcpy(new_string, string);
}
-
/* Convert a null-terminated string to a shorter and longer null
* terminated string. */
/* Create a src_type that holds the UTF-8 string and its final NULL */
- big_len = length + 1; /* +1 byte for final NULL */
- HDassert((2*big_len)<=sizeof(cmpbuf));
+ big_len = length + 1; /* +1 byte for final NULL */
+ HDassert((2 * big_len) <= sizeof(cmpbuf));
src_type = mkstr(big_len, H5T_STR_NULLTERM);
CHECK(src_type, FAIL, "mkstr");
/* Create a dst_type that holds half of the UTF-8 string and a final
* NULL */
small_len = (length + 1) / 2;
- dst_type = mkstr(small_len, H5T_STR_NULLTERM);
+ dst_type = mkstr(small_len, H5T_STR_NULLTERM);
CHECK(dst_type, FAIL, "mkstr");
/* Fill the buffer with two copies of the UTF-8 string, each with a
@@ -176,11 +177,11 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
* string manually. */
HDstrncpy(cmpbuf, new_string, small_len - 1);
cmpbuf[small_len - 1] = '\0';
- HDstrncpy(&cmpbuf[small_len], new_string, small_len -1);
+ HDstrncpy(&cmpbuf[small_len], new_string, small_len - 1);
cmpbuf[2 * small_len - 1] = '\0';
HDstrcpy(&cmpbuf[2 * small_len], new_string);
- VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp");
+ VERIFY(HDmemcmp(buf, cmpbuf, 2 * big_len), 0, "HDmemcmp");
/* Now convert from smaller datatype to bigger datatype. This should
* leave our buffer looking like: "abc\0\0\0\0\0abc\0\0\0\0\0" */
@@ -190,38 +191,37 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
/* First fill the buffer with NULLs */
HDmemset(cmpbuf, '\0', (size_t)LONG_BUF_SIZE);
/* Copy in the characters */
- HDstrncpy(cmpbuf, new_string, small_len -1);
- HDstrncpy(&cmpbuf[big_len], new_string, small_len -1);
+ HDstrncpy(cmpbuf, new_string, small_len - 1);
+ HDstrncpy(&cmpbuf[big_len], new_string, small_len - 1);
- VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp");
+ VERIFY(HDmemcmp(buf, cmpbuf, 2 * big_len), 0, "HDmemcmp");
ret = H5Tclose(src_type);
CHECK(ret, FAIL, "H5Tclose");
ret = H5Tclose(dst_type);
CHECK(ret, FAIL, "H5Tclose");
-
/* Now test null padding. Null-padded strings do *not* need
* terminating NULLs, so the sizes of the datatypes are slightly
* different and we want a string with an even number of characters. */
length = HDstrlen(string);
- if(length % 2 != 0)
- {
- HDstrcpy(new_string, "x");
- HDstrcat(new_string, string);
- length++;
- } else {
- HDstrcpy(new_string, string);
+ if (length % 2 != 0) {
+ HDstrcpy(new_string, "x");
+ HDstrcat(new_string, string);
+ length++;
+ }
+ else {
+ HDstrcpy(new_string, string);
}
/* Create a src_type that holds the UTF-8 string */
big_len = length;
- HDassert((2*big_len)<=sizeof(cmpbuf));
+ HDassert((2 * big_len) <= sizeof(cmpbuf));
src_type = mkstr(big_len, H5T_STR_NULLPAD);
CHECK(src_type, FAIL, "mkstr");
/* Create a dst_type that holds half of the UTF-8 string */
small_len = length / 2;
- dst_type = mkstr(small_len, H5T_STR_NULLPAD);
+ dst_type = mkstr(small_len, H5T_STR_NULLPAD);
CHECK(dst_type, FAIL, "mkstr");
/* Fill the buffer with two copies of the UTF-8 string.
@@ -241,7 +241,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
HDstrncpy(&cmpbuf[small_len], new_string, small_len);
HDstrncpy(&cmpbuf[2 * small_len], new_string, big_len);
- VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp");
+ VERIFY(HDmemcmp(buf, cmpbuf, 2 * big_len), 0, "HDmemcmp");
/* Now convert from smaller datatype to bigger datatype. This should
* leave our buffer looking like: "abcd\0\0\0\0abcd\0\0\0\0" */
@@ -254,14 +254,13 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
HDstrncpy(cmpbuf, new_string, small_len);
HDstrncpy(&cmpbuf[big_len], new_string, small_len);
- VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp");
+ VERIFY(HDmemcmp(buf, cmpbuf, 2 * big_len), 0, "HDmemcmp");
ret = H5Tclose(src_type);
CHECK(ret, FAIL, "H5Tclose");
ret = H5Tclose(dst_type);
CHECK(ret, FAIL, "H5Tclose");
-
/* Test space padding. This is very similar to null-padding; we can
use the same values of length, small_len, and big_len. */
@@ -287,7 +286,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
HDstrncpy(&cmpbuf[small_len], new_string, small_len);
HDstrncpy(&cmpbuf[2 * small_len], new_string, big_len);
- VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp");
+ VERIFY(HDmemcmp(buf, cmpbuf, 2 * big_len), 0, "HDmemcmp");
/* Now convert from smaller datatype to bigger datatype. This should
* leave our buffer looking like: "abcd abcd " */
@@ -300,7 +299,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
HDstrncpy(cmpbuf, new_string, small_len);
HDstrncpy(&cmpbuf[big_len], new_string, small_len);
- VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp");
+ VERIFY(HDmemcmp(buf, cmpbuf, 2 * big_len), 0, "HDmemcmp");
ret = H5Tclose(src_type);
CHECK(ret, FAIL, "H5Tclose");
@@ -308,60 +307,60 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
CHECK(ret, FAIL, "H5Tclose");
}
-
/*
* test_vl_string
* Tests variable-length string datatype with UTF-8 strings.
*/
-void test_vl_string(hid_t fid, const char *string)
+void
+test_vl_string(hid_t fid, const char *string)
{
- hid_t type_id, space_id, dset_id;
- hsize_t dims = 1;
- hsize_t size; /* Number of bytes used */
- char *read_buf[1];
- herr_t ret;
-
- /* Create dataspace for datasets */
- space_id = H5Screate_simple(RANK, &dims, NULL);
- CHECK(space_id, FAIL, "H5Screate_simple");
-
- /* Create a datatype to refer to */
- type_id = H5Tcopy(H5T_C_S1);
- CHECK(type_id, FAIL, "H5Tcopy");
- ret = H5Tset_size(type_id, H5T_VARIABLE);
- CHECK(ret, FAIL, "H5Tset_size");
-
- /* Create a dataset */
- dset_id = H5Dcreate2(fid, VL_DSET1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset_id, FAIL, "H5Dcreate2");
-
- /* Write dataset to disk */
- ret = H5Dwrite(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &string);
- CHECK(ret, FAIL, "H5Dwrite");
-
- /* Make certain the correct amount of memory will be used */
- ret = H5Dvlen_get_buf_size(dset_id, type_id, space_id, &size);
- CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
- VERIFY(size, (hsize_t)HDstrlen(string) + 1, "H5Dvlen_get_buf_size");
-
- /* Read dataset from disk */
- ret = H5Dread(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf);
- CHECK(ret, FAIL, "H5Dread");
-
- /* Compare data read in */
- VERIFY(HDstrcmp(string, read_buf[0]), 0, "strcmp");
-
- /* Reclaim the read VL data */
- ret = H5Treclaim(type_id, space_id, H5P_DEFAULT, read_buf);
- CHECK(ret, FAIL, "H5Treclaim");
-
- /* Close all */
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
- ret = H5Tclose(type_id);
- CHECK(ret, FAIL, "H5Tclose");
- ret = H5Sclose(space_id);
- CHECK(ret, FAIL, "H5Sclose");
+ hid_t type_id, space_id, dset_id;
+ hsize_t dims = 1;
+ hsize_t size; /* Number of bytes used */
+ char * read_buf[1];
+ herr_t ret;
+
+ /* Create dataspace for datasets */
+ space_id = H5Screate_simple(RANK, &dims, NULL);
+ CHECK(space_id, FAIL, "H5Screate_simple");
+
+ /* Create a datatype to refer to */
+ type_id = H5Tcopy(H5T_C_S1);
+ CHECK(type_id, FAIL, "H5Tcopy");
+ ret = H5Tset_size(type_id, H5T_VARIABLE);
+ CHECK(ret, FAIL, "H5Tset_size");
+
+ /* Create a dataset */
+ dset_id = H5Dcreate2(fid, VL_DSET1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dcreate2");
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &string);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Make certain the correct amount of memory will be used */
+ ret = H5Dvlen_get_buf_size(dset_id, type_id, space_id, &size);
+ CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)HDstrlen(string) + 1, "H5Dvlen_get_buf_size");
+
+ /* Read dataset from disk */
+ ret = H5Dread(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Compare data read in */
+ VERIFY(HDstrcmp(string, read_buf[0]), 0, "strcmp");
+
+ /* Reclaim the read VL data */
+ ret = H5Treclaim(type_id, space_id, H5P_DEFAULT, read_buf);
+ CHECK(ret, FAIL, "H5Treclaim");
+
+ /* Close all */
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Tclose(type_id);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
}
/*
@@ -374,347 +373,348 @@ void test_vl_string(hid_t fid, const char *string)
* was added to links it didn't change how they were stored in the file,
* -JML 2/2/2006
*/
-void test_objnames(hid_t fid, const char* string)
+void
+test_objnames(hid_t fid, const char *string)
{
- hid_t grp_id, grp1_id, grp2_id, grp3_id;
- hid_t type_id, dset_id, space_id;
- char read_buf[MAX_STRING_LENGTH];
- char path_buf[MAX_PATH_LENGTH];
- hsize_t dims=1;
- hobj_ref_t obj_ref;
- ssize_t size;
- herr_t ret;
-
- /* Create a group with a UTF-8 name */
- grp_id = H5Gcreate2(fid, string, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(grp_id, FAIL, "H5Gcreate2");
-
- /* Set a comment on the group to test that we can access the group
- * Also test that UTF-8 comments can be read.
- */
- ret = H5Oset_comment_by_name(fid, string, string, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oset_comment_by_name");
- size = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT);
- CHECK(size, FAIL, "H5Oget_comment_by_name");
-
- ret = H5Gclose(grp_id);
- CHECK(ret, FAIL, "H5Gclose");
-
- VERIFY(HDstrcmp(string, read_buf), 0, "strcmp");
-
- /* Create a new dataset with a UTF-8 name */
- grp1_id = H5Gcreate2(fid, GROUP1_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(grp1_id, FAIL, "H5Gcreate2");
-
- space_id = H5Screate_simple(RANK, &dims, NULL);
- CHECK(space_id, FAIL, "H5Screate_simple");
- dset_id = H5Dcreate2(grp1_id, string, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset_id, FAIL, "H5Dcreate2");
-
- /* Make sure that dataset can be opened again */
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
- ret = H5Sclose(space_id);
- CHECK(ret, FAIL, "H5Sclose");
-
- dset_id = H5Dopen2(grp1_id, string, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dopen2");
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
- ret = H5Gclose(grp1_id);
- CHECK(ret, FAIL, "H5Gclose");
-
- /* Do the same for a named datatype */
- grp2_id = H5Gcreate2(fid, GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(grp2_id, FAIL, "H5Gcreate2");
-
- type_id = H5Tcreate(H5T_OPAQUE, (size_t)1);
- CHECK(type_id, FAIL, "H5Tcreate");
- ret = H5Tcommit2(grp2_id, string, type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(type_id, FAIL, "H5Tcommit2");
- ret = H5Tclose(type_id);
- CHECK(type_id, FAIL, "H5Tclose");
-
- type_id = H5Topen2(grp2_id, string, H5P_DEFAULT);
- CHECK(type_id, FAIL, "H5Topen2");
- ret = H5Tclose(type_id);
- CHECK(type_id, FAIL, "H5Tclose");
-
- /* Don't close the group -- use it to test that object references
- * can refer to objects named in UTF-8 */
-
- space_id = H5Screate_simple(RANK, &dims, NULL);
- CHECK(space_id, FAIL, "H5Screate_simple");
- dset_id = H5Dcreate2(grp2_id, DSET3_NAME, H5T_STD_REF_OBJ, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dcreate2");
-
- /* Create reference to named datatype */
- ret = H5Rcreate(&obj_ref, grp2_id, string, H5R_OBJECT, (hid_t)-1);
- CHECK(ret, FAIL, "H5Rcreate");
- /* Write selection and read it back*/
- ret = H5Dwrite(dset_id, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &obj_ref);
- CHECK(ret, FAIL, "H5Dwrite");
- ret = H5Dread(dset_id, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &obj_ref);
- CHECK(ret, FAIL, "H5Dread");
-
- /* Ensure that we can open named datatype using object reference */
- type_id = H5Rdereference2(dset_id, H5P_DEFAULT, H5R_OBJECT, &obj_ref);
- CHECK(type_id, FAIL, "H5Rdereference2");
- ret = H5Tcommitted(type_id);
- VERIFY(ret, 1, "H5Tcommitted");
-
- ret = H5Tclose(type_id);
- CHECK(type_id, FAIL, "H5Tclose");
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
- ret = H5Sclose(space_id);
- CHECK(ret, FAIL, "H5Sclose");
-
- ret = H5Gclose(grp2_id);
- CHECK(ret, FAIL, "H5Gclose");
-
- /* Create "group3". Build a hard link from group3 to group2, which has
- * a datatype with the UTF-8 name. Create a soft link in group3
- * pointing through the hard link to the datatype. Give the soft
- * link a name in UTF-8. Ensure that the soft link works. */
-
- grp3_id = H5Gcreate2(fid, GROUP3_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(grp3_id, FAIL, "H5Gcreate2");
-
- ret = H5Lcreate_hard(fid, GROUP2_NAME, grp3_id, GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Lcreate_hard");
- HDstrcpy(path_buf, GROUP2_NAME);
- HDstrcat(path_buf, "/");
- HDstrcat(path_buf, string);
- ret = H5Lcreate_hard(grp3_id, path_buf, H5L_SAME_LOC, string, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Lcreate_hard");
-
- /* Open named datatype using soft link */
- type_id = H5Topen2(grp3_id, string, H5P_DEFAULT);
- CHECK(type_id, FAIL, "H5Topen2");
-
- ret = H5Tclose(type_id);
- CHECK(type_id, FAIL, "H5Tclose");
- ret = H5Gclose(grp3_id);
- CHECK(ret, FAIL, "H5Gclose");
+ hid_t grp_id, grp1_id, grp2_id, grp3_id;
+ hid_t type_id, dset_id, space_id;
+ char read_buf[MAX_STRING_LENGTH];
+ char path_buf[MAX_PATH_LENGTH];
+ hsize_t dims = 1;
+ hobj_ref_t obj_ref;
+ ssize_t size;
+ herr_t ret;
+
+ /* Create a group with a UTF-8 name */
+ grp_id = H5Gcreate2(fid, string, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(grp_id, FAIL, "H5Gcreate2");
+
+ /* Set a comment on the group to test that we can access the group
+ * Also test that UTF-8 comments can be read.
+ */
+ ret = H5Oset_comment_by_name(fid, string, string, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oset_comment_by_name");
+ size = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT);
+ CHECK(size, FAIL, "H5Oget_comment_by_name");
+
+ ret = H5Gclose(grp_id);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ VERIFY(HDstrcmp(string, read_buf), 0, "strcmp");
+
+ /* Create a new dataset with a UTF-8 name */
+ grp1_id = H5Gcreate2(fid, GROUP1_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(grp1_id, FAIL, "H5Gcreate2");
+
+ space_id = H5Screate_simple(RANK, &dims, NULL);
+ CHECK(space_id, FAIL, "H5Screate_simple");
+ dset_id = H5Dcreate2(grp1_id, string, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dcreate2");
+
+ /* Make sure that dataset can be opened again */
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ dset_id = H5Dopen2(grp1_id, string, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Dopen2");
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Gclose(grp1_id);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Do the same for a named datatype */
+ grp2_id = H5Gcreate2(fid, GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(grp2_id, FAIL, "H5Gcreate2");
+
+ type_id = H5Tcreate(H5T_OPAQUE, (size_t)1);
+ CHECK(type_id, FAIL, "H5Tcreate");
+ ret = H5Tcommit2(grp2_id, string, type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(type_id, FAIL, "H5Tcommit2");
+ ret = H5Tclose(type_id);
+ CHECK(type_id, FAIL, "H5Tclose");
+
+ type_id = H5Topen2(grp2_id, string, H5P_DEFAULT);
+ CHECK(type_id, FAIL, "H5Topen2");
+ ret = H5Tclose(type_id);
+ CHECK(type_id, FAIL, "H5Tclose");
+
+ /* Don't close the group -- use it to test that object references
+ * can refer to objects named in UTF-8 */
+
+ space_id = H5Screate_simple(RANK, &dims, NULL);
+ CHECK(space_id, FAIL, "H5Screate_simple");
+ dset_id =
+ H5Dcreate2(grp2_id, DSET3_NAME, H5T_STD_REF_OBJ, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Dcreate2");
+
+ /* Create reference to named datatype */
+ ret = H5Rcreate(&obj_ref, grp2_id, string, H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+ /* Write selection and read it back*/
+ ret = H5Dwrite(dset_id, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &obj_ref);
+ CHECK(ret, FAIL, "H5Dwrite");
+ ret = H5Dread(dset_id, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &obj_ref);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Ensure that we can open named datatype using object reference */
+ type_id = H5Rdereference2(dset_id, H5P_DEFAULT, H5R_OBJECT, &obj_ref);
+ CHECK(type_id, FAIL, "H5Rdereference2");
+ ret = H5Tcommitted(type_id);
+ VERIFY(ret, 1, "H5Tcommitted");
+
+ ret = H5Tclose(type_id);
+ CHECK(type_id, FAIL, "H5Tclose");
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Gclose(grp2_id);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Create "group3". Build a hard link from group3 to group2, which has
+ * a datatype with the UTF-8 name. Create a soft link in group3
+ * pointing through the hard link to the datatype. Give the soft
+ * link a name in UTF-8. Ensure that the soft link works. */
+
+ grp3_id = H5Gcreate2(fid, GROUP3_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(grp3_id, FAIL, "H5Gcreate2");
+
+ ret = H5Lcreate_hard(fid, GROUP2_NAME, grp3_id, GROUP2_NAME, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lcreate_hard");
+ HDstrcpy(path_buf, GROUP2_NAME);
+ HDstrcat(path_buf, "/");
+ HDstrcat(path_buf, string);
+ ret = H5Lcreate_hard(grp3_id, path_buf, H5L_SAME_LOC, string, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lcreate_hard");
+
+ /* Open named datatype using soft link */
+ type_id = H5Topen2(grp3_id, string, H5P_DEFAULT);
+ CHECK(type_id, FAIL, "H5Topen2");
+
+ ret = H5Tclose(type_id);
+ CHECK(type_id, FAIL, "H5Tclose");
+ ret = H5Gclose(grp3_id);
+ CHECK(ret, FAIL, "H5Gclose");
}
/*
* test_attrname
* Test that attributes can deal with UTF-8 strings
*/
-void test_attrname(hid_t fid, const char * string)
+void
+test_attrname(hid_t fid, const char *string)
{
- hid_t group_id, attr_id;
- hid_t dtype_id, space_id;
- hsize_t dims=1;
- char read_buf[MAX_STRING_LENGTH];
- ssize_t size;
- herr_t ret;
-
- /* Create a new group and give it an attribute whose
- * name and value are UTF-8 strings.
- */
- group_id = H5Gcreate2(fid, GROUP4_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(group_id, FAIL, "H5Gcreate2");
-
- space_id = H5Screate_simple(RANK, &dims, NULL);
- CHECK(space_id, FAIL, "H5Screate_simple");
- dtype_id = H5Tcopy(H5T_C_S1);
- CHECK(dtype_id, FAIL, "H5Tcopy");
- ret = H5Tset_size(dtype_id, (size_t)MAX_STRING_LENGTH);
- CHECK(ret, FAIL, "H5Tset_size");
-
- /* Create the attribute and check that its name is correct */
- attr_id = H5Acreate2(group_id, string, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(attr_id, FAIL, "H5Acreate2");
- size = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf);
- CHECK(size, FAIL, "H5Aget_name");
- ret = strcmp(read_buf, string);
- VERIFY(ret, 0, "strcmp");
- read_buf[0] = '\0';
-
- /* Try writing and reading from the attribute */
- ret = H5Awrite(attr_id, dtype_id, string);
- CHECK(ret, FAIL, "H5Awrite");
- ret = H5Aread(attr_id, dtype_id, read_buf);
- CHECK(ret, FAIL, "H5Aread");
- ret = strcmp(read_buf, string);
- VERIFY(ret, 0, "strcmp");
-
- /* Clean up */
- ret = H5Aclose(attr_id);
- CHECK(ret, FAIL, "H5Aclose");
- ret = H5Tclose(dtype_id);
- CHECK(ret, FAIL, "H5Tclose");
- ret = H5Sclose(space_id);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Gclose(group_id);
- CHECK(ret, FAIL, "H5Gclose");
+ hid_t group_id, attr_id;
+ hid_t dtype_id, space_id;
+ hsize_t dims = 1;
+ char read_buf[MAX_STRING_LENGTH];
+ ssize_t size;
+ herr_t ret;
+
+ /* Create a new group and give it an attribute whose
+ * name and value are UTF-8 strings.
+ */
+ group_id = H5Gcreate2(fid, GROUP4_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group_id, FAIL, "H5Gcreate2");
+
+ space_id = H5Screate_simple(RANK, &dims, NULL);
+ CHECK(space_id, FAIL, "H5Screate_simple");
+ dtype_id = H5Tcopy(H5T_C_S1);
+ CHECK(dtype_id, FAIL, "H5Tcopy");
+ ret = H5Tset_size(dtype_id, (size_t)MAX_STRING_LENGTH);
+ CHECK(ret, FAIL, "H5Tset_size");
+
+ /* Create the attribute and check that its name is correct */
+ attr_id = H5Acreate2(group_id, string, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Acreate2");
+ size = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf);
+ CHECK(size, FAIL, "H5Aget_name");
+ ret = strcmp(read_buf, string);
+ VERIFY(ret, 0, "strcmp");
+ read_buf[0] = '\0';
+
+ /* Try writing and reading from the attribute */
+ ret = H5Awrite(attr_id, dtype_id, string);
+ CHECK(ret, FAIL, "H5Awrite");
+ ret = H5Aread(attr_id, dtype_id, read_buf);
+ CHECK(ret, FAIL, "H5Aread");
+ ret = strcmp(read_buf, string);
+ VERIFY(ret, 0, "strcmp");
+
+ /* Clean up */
+ ret = H5Aclose(attr_id);
+ CHECK(ret, FAIL, "H5Aclose");
+ ret = H5Tclose(dtype_id);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Gclose(group_id);
+ CHECK(ret, FAIL, "H5Gclose");
}
/*
* test_compound
* Test that compound datatypes can have UTF-8 field names.
*/
-void test_compound(hid_t fid, const char * string)
+void
+test_compound(hid_t fid, const char *string)
{
- /* Define two compound structures, s1_t and s2_t.
- * s2_t is a subset of s1_t, with two out of three
- * fields.
- * This is stolen from the h5_compound example.
- */
- typedef struct s1_t {
- int a;
- double c;
- float b;
- } s1_t;
- typedef struct s2_t {
- double c;
- int a;
- } s2_t;
- /* Actual variable declarations */
- s1_t s1;
- s2_t s2;
- hid_t s1_tid, s2_tid;
- hid_t space_id, dset_id;
- hsize_t dim = 1;
- char *readbuf;
- herr_t ret;
-
- /* Initialize compound data */
- HDmemset(&s1, 0, sizeof(s1_t)); /* To make purify happy */
- s1.a = COMP_INT_VAL;
- s1.c = COMP_DOUBLE_VAL;
- s1.b = COMP_FLOAT_VAL;
-
- /* Create compound datatypes using UTF-8 field name */
- s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
- CHECK(s1_tid, FAIL, "H5Tcreate");
- ret = H5Tinsert(s1_tid, string, HOFFSET(s1_t, a), H5T_NATIVE_INT);
- CHECK(ret, FAIL, "H5Tinsert");
-
- /* Check that the field name was stored correctly */
- readbuf = H5Tget_member_name(s1_tid, 0);
- ret = HDstrcmp(readbuf, string);
- VERIFY(ret, 0, "strcmp");
- H5free_memory(readbuf);
-
- /* Add the other fields to the datatype */
- ret = H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE);
- CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(s1_tid, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT);
- CHECK(ret, FAIL, "H5Tinsert");
-
- /* Create second datatype, with only two fields. */
- s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t));
- CHECK(s2_tid, FAIL, "H5Tcreate");
- ret = H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE);
- CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(s2_tid, string, HOFFSET(s2_t, a), H5T_NATIVE_INT);
- CHECK(ret, FAIL, "H5Tinsert");
-
- /* Create the dataspace and dataset. */
- space_id = H5Screate_simple(1, &dim, NULL);
- CHECK(space_id, FAIL, "H5Screate_simple");
- dset_id = H5Dcreate2(fid, DSET4_NAME, s1_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset_id, FAIL, "H5Dcreate2");
-
- /* Write data to the dataset. */
- ret = H5Dwrite(dset_id, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &s1);
- CHECK(ret, FAIL, "H5Dwrite");
-
- /* Ensure that data can be read back by field name into s2 struct */
- ret = H5Dread(dset_id, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &s2);
- CHECK(ret, FAIL, "H5Dread");
-
- VERIFY(s2.a, COMP_INT_VAL, "H5Dread");
- VERIFY(s2.c, COMP_DOUBLE_VAL, "H5Dread");
-
- /* Clean up */
- ret = H5Tclose(s1_tid);
- CHECK(ret, FAIL, "H5Tclose");
- ret = H5Tclose(s2_tid);
- CHECK(ret, FAIL, "H5Tclose");
- ret = H5Sclose(space_id);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Define two compound structures, s1_t and s2_t.
+ * s2_t is a subset of s1_t, with two out of three
+ * fields.
+ * This is stolen from the h5_compound example.
+ */
+ typedef struct s1_t {
+ int a;
+ double c;
+ float b;
+ } s1_t;
+ typedef struct s2_t {
+ double c;
+ int a;
+ } s2_t;
+ /* Actual variable declarations */
+ s1_t s1;
+ s2_t s2;
+ hid_t s1_tid, s2_tid;
+ hid_t space_id, dset_id;
+ hsize_t dim = 1;
+ char * readbuf;
+ herr_t ret;
+
+ /* Initialize compound data */
+ HDmemset(&s1, 0, sizeof(s1_t)); /* To make purify happy */
+ s1.a = COMP_INT_VAL;
+ s1.c = COMP_DOUBLE_VAL;
+ s1.b = COMP_FLOAT_VAL;
+
+ /* Create compound datatypes using UTF-8 field name */
+ s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ CHECK(s1_tid, FAIL, "H5Tcreate");
+ ret = H5Tinsert(s1_tid, string, HOFFSET(s1_t, a), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Check that the field name was stored correctly */
+ readbuf = H5Tget_member_name(s1_tid, 0);
+ ret = HDstrcmp(readbuf, string);
+ VERIFY(ret, 0, "strcmp");
+ H5free_memory(readbuf);
+
+ /* Add the other fields to the datatype */
+ ret = H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE);
+ CHECK(ret, FAIL, "H5Tinsert");
+ ret = H5Tinsert(s1_tid, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Create second datatype, with only two fields. */
+ s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
+ CHECK(s2_tid, FAIL, "H5Tcreate");
+ ret = H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE);
+ CHECK(ret, FAIL, "H5Tinsert");
+ ret = H5Tinsert(s2_tid, string, HOFFSET(s2_t, a), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Create the dataspace and dataset. */
+ space_id = H5Screate_simple(1, &dim, NULL);
+ CHECK(space_id, FAIL, "H5Screate_simple");
+ dset_id = H5Dcreate2(fid, DSET4_NAME, s1_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dcreate2");
+
+ /* Write data to the dataset. */
+ ret = H5Dwrite(dset_id, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &s1);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Ensure that data can be read back by field name into s2 struct */
+ ret = H5Dread(dset_id, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &s2);
+ CHECK(ret, FAIL, "H5Dread");
+
+ VERIFY(s2.a, COMP_INT_VAL, "H5Dread");
+ VERIFY(s2.c, COMP_DOUBLE_VAL, "H5Dread");
+
+ /* Clean up */
+ ret = H5Tclose(s1_tid);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Tclose(s2_tid);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Sclose(space_id);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
}
/*
* test_enum
* Test that enumerated datatypes can have UTF-8 member names.
*/
-void test_enum(hid_t H5_ATTR_UNUSED fid, const char * string)
+void
+test_enum(hid_t H5_ATTR_UNUSED fid, const char *string)
{
- /* Define an enumerated type */
- typedef enum {
- E1_RED,
- E1_GREEN,
- E1_BLUE,
- E1_WHITE
- } c_e1;
- /* Variable declarations */
- c_e1 val;
- herr_t ret;
- hid_t type_id;
- char readbuf[MAX_STRING_LENGTH];
-
- /* Create an enumerated datatype in HDF5 with a UTF-8 member name*/
- type_id = H5Tcreate(H5T_ENUM, sizeof(c_e1));
- CHECK(type_id, FAIL, "H5Tcreate");
- val = E1_RED;
- ret = H5Tenum_insert(type_id, "RED", &val);
- CHECK(ret, FAIL, "H5Tenum_insert");
- val = E1_GREEN;
- ret = H5Tenum_insert(type_id, "GREEN", &val);
- CHECK(ret, FAIL, "H5Tenum_insert");
- val = E1_BLUE;
- ret = H5Tenum_insert(type_id, "BLUE", &val);
- CHECK(ret, FAIL, "H5Tenum_insert");
- val = E1_WHITE;
- ret = H5Tenum_insert(type_id, string, &val);
- CHECK(ret, FAIL, "H5Tenum_insert");
-
- /* Ensure that UTF-8 member name gives the right value and vice versa. */
- ret = H5Tenum_valueof(type_id, string, &val);
- CHECK(ret, FAIL, "H5Tenum_valueof");
- VERIFY(val, E1_WHITE, "H5Tenum_valueof");
- ret = H5Tenum_nameof(type_id, &val, readbuf, (size_t)MAX_STRING_LENGTH);
- CHECK(ret, FAIL, "H5Tenum_nameof");
- ret = strcmp(readbuf, string);
- VERIFY(ret, 0, "strcmp");
-
- /* Close the datatype */
- ret = H5Tclose(type_id);
- CHECK(ret, FAIL, "H5Tclose");
+ /* Define an enumerated type */
+ typedef enum { E1_RED, E1_GREEN, E1_BLUE, E1_WHITE } c_e1;
+ /* Variable declarations */
+ c_e1 val;
+ herr_t ret;
+ hid_t type_id;
+ char readbuf[MAX_STRING_LENGTH];
+
+ /* Create an enumerated datatype in HDF5 with a UTF-8 member name*/
+ type_id = H5Tcreate(H5T_ENUM, sizeof(c_e1));
+ CHECK(type_id, FAIL, "H5Tcreate");
+ val = E1_RED;
+ ret = H5Tenum_insert(type_id, "RED", &val);
+ CHECK(ret, FAIL, "H5Tenum_insert");
+ val = E1_GREEN;
+ ret = H5Tenum_insert(type_id, "GREEN", &val);
+ CHECK(ret, FAIL, "H5Tenum_insert");
+ val = E1_BLUE;
+ ret = H5Tenum_insert(type_id, "BLUE", &val);
+ CHECK(ret, FAIL, "H5Tenum_insert");
+ val = E1_WHITE;
+ ret = H5Tenum_insert(type_id, string, &val);
+ CHECK(ret, FAIL, "H5Tenum_insert");
+
+ /* Ensure that UTF-8 member name gives the right value and vice versa. */
+ ret = H5Tenum_valueof(type_id, string, &val);
+ CHECK(ret, FAIL, "H5Tenum_valueof");
+ VERIFY(val, E1_WHITE, "H5Tenum_valueof");
+ ret = H5Tenum_nameof(type_id, &val, readbuf, (size_t)MAX_STRING_LENGTH);
+ CHECK(ret, FAIL, "H5Tenum_nameof");
+ ret = strcmp(readbuf, string);
+ VERIFY(ret, 0, "strcmp");
+
+ /* Close the datatype */
+ ret = H5Tclose(type_id);
+ CHECK(ret, FAIL, "H5Tclose");
}
/*
* test_opaque
* Test comments on opaque datatypes
*/
-void test_opaque(hid_t H5_ATTR_UNUSED fid, const char * string)
+void
+test_opaque(hid_t H5_ATTR_UNUSED fid, const char *string)
{
- hid_t type_id;
- char * read_buf;
- herr_t ret;
-
- /* Create an opaque type and give it a UTF-8 tag */
- type_id = H5Tcreate(H5T_OPAQUE, (size_t)4);
- CHECK(type_id, FAIL, "H5Tcreate");
- ret = H5Tset_tag(type_id, string);
- CHECK(ret, FAIL, "H5Tset_tag");
-
- /* Read the tag back. */
- read_buf = H5Tget_tag(type_id);
- ret = strcmp(read_buf, string);
- VERIFY(ret, 0, "H5Tget_tag");
- H5free_memory(read_buf);
-
- ret = H5Tclose(type_id);
- CHECK(ret, FAIL, "H5Tclose");
+ hid_t type_id;
+ char * read_buf;
+ herr_t ret;
+
+ /* Create an opaque type and give it a UTF-8 tag */
+ type_id = H5Tcreate(H5T_OPAQUE, (size_t)4);
+ CHECK(type_id, FAIL, "H5Tcreate");
+ ret = H5Tset_tag(type_id, string);
+ CHECK(ret, FAIL, "H5Tset_tag");
+
+ /* Read the tag back. */
+ read_buf = H5Tget_tag(type_id);
+ ret = strcmp(read_buf, string);
+ VERIFY(ret, 0, "H5Tget_tag");
+ H5free_memory(read_buf);
+
+ ret = H5Tclose(type_id);
+ CHECK(ret, FAIL, "H5Tclose");
}
/*********************/
@@ -724,12 +724,16 @@ void test_opaque(hid_t H5_ATTR_UNUSED fid, const char * string)
/* mkstr
* Borrwed from dtypes.c.
* Creates a new string data type. Used in string padding tests */
-static hid_t mkstr(size_t len, H5T_str_t strpad)
+static hid_t
+mkstr(size_t len, H5T_str_t strpad)
{
- hid_t t;
- if((t = H5Tcopy(H5T_C_S1)) < 0) return -1;
- if(H5Tset_size(t, len) < 0) return -1;
- if(H5Tset_strpad(t, strpad) < 0) return -1;
+ hid_t t;
+ if ((t = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if (H5Tset_size(t, len) < 0)
+ return -1;
+ if (H5Tset_strpad(t, strpad) < 0)
+ return -1;
return t;
}
@@ -737,124 +741,124 @@ static hid_t mkstr(size_t len, H5T_str_t strpad)
* Append a unicode code point c to test_string in UTF-8 encoding.
* Return the new end of the string.
*/
-unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos)
+unsigned int
+write_char(unsigned int c, char *test_string, unsigned int cur_pos)
{
- if (c < 0x80) {
- test_string[cur_pos] = (char)c;
- cur_pos++;
- }
- else if (c < 0x800) {
- test_string[cur_pos] = (char)(0xC0 | c >> 6);
- test_string[cur_pos + 1] = (char)(0x80 | (c & 0x3F));
- cur_pos += 2;
- }
- else if (c < 0x10000) {
- test_string[cur_pos] = (char)(0xE0 | c >> 12);
- test_string[cur_pos + 1] = (char)(0x80 | (c >> 6 & 0x3F));
- test_string[cur_pos + 2] = (char)(0x80 | (c & 0x3F));
- cur_pos += 3;
- }
- else if (c < 0x200000) {
- test_string[cur_pos] = (char)(0xF0 | c >> 18);
- test_string[cur_pos + 1] = (char)(0x80 | (c >> 12 & 0x3F));
- test_string[cur_pos + 2] = (char)(0x80 | (c >> 6 & 0x3F));
- test_string[cur_pos + 3] = (char)(0x80 | (c & 0x3F));
- cur_pos += 4;
- }
-
- return cur_pos;
+ if (c < 0x80) {
+ test_string[cur_pos] = (char)c;
+ cur_pos++;
+ }
+ else if (c < 0x800) {
+ test_string[cur_pos] = (char)(0xC0 | c >> 6);
+ test_string[cur_pos + 1] = (char)(0x80 | (c & 0x3F));
+ cur_pos += 2;
+ }
+ else if (c < 0x10000) {
+ test_string[cur_pos] = (char)(0xE0 | c >> 12);
+ test_string[cur_pos + 1] = (char)(0x80 | (c >> 6 & 0x3F));
+ test_string[cur_pos + 2] = (char)(0x80 | (c & 0x3F));
+ cur_pos += 3;
+ }
+ else if (c < 0x200000) {
+ test_string[cur_pos] = (char)(0xF0 | c >> 18);
+ test_string[cur_pos + 1] = (char)(0x80 | (c >> 12 & 0x3F));
+ test_string[cur_pos + 2] = (char)(0x80 | (c >> 6 & 0x3F));
+ test_string[cur_pos + 3] = (char)(0x80 | (c & 0x3F));
+ cur_pos += 4;
+ }
+
+ return cur_pos;
}
/* dump_string
* Print a string both as text (which will look like garbage) and as hex.
* The text display is not guaranteed to be accurate--certain characters
* could confuse printf (e.g., '\n'). */
-void dump_string(const char * string)
+void
+dump_string(const char *string)
{
- size_t length;
- size_t x;
+ size_t length;
+ size_t x;
- HDprintf("The string was:\n %s", string);
- HDprintf("Or in hex:\n");
+ HDprintf("The string was:\n %s", string);
+ HDprintf("Or in hex:\n");
- length = HDstrlen(string);
+ length = HDstrlen(string);
- for(x=0; x<length; x++)
- HDprintf("%x ", string[x] & (0x000000FF));
+ for (x = 0; x < length; x++)
+ HDprintf("%x ", string[x] & (0x000000FF));
- HDprintf("\n");
+ HDprintf("\n");
}
/* Main test.
* Create a string of random Unicode characters, then run each test with
* that string.
*/
-void test_unicode(void)
+void
+test_unicode(void)
{
- char test_string[MAX_STRING_LENGTH];
- unsigned int cur_pos=0; /* Current position in test_string */
- unsigned int unicode_point; /* Unicode code point for a single character */
- hid_t fid; /* ID of file */
- int x; /* Temporary variable */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(5, ("Testing UTF-8 Encoding\n"));
-
- /* Create a random string with length NUM_CHARS */
- HDsrandom((unsigned)HDtime(NULL));
-
- HDmemset(test_string, 0, sizeof(test_string));
- for(x=0; x<NUM_CHARS; x++)
- {
- /* We need to avoid unprintable characters (codes 0-31) and the
- * . and / characters, since they aren't allowed in path names.
+ char test_string[MAX_STRING_LENGTH];
+ unsigned int cur_pos = 0; /* Current position in test_string */
+ unsigned int unicode_point; /* Unicode code point for a single character */
+ hid_t fid; /* ID of file */
+ int x; /* Temporary variable */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing UTF-8 Encoding\n"));
+
+ /* Create a random string with length NUM_CHARS */
+ HDsrandom((unsigned)HDtime(NULL));
+
+ HDmemset(test_string, 0, sizeof(test_string));
+ for (x = 0; x < NUM_CHARS; x++) {
+ /* We need to avoid unprintable characters (codes 0-31) and the
+ * . and / characters, since they aren't allowed in path names.
+ */
+ unicode_point = (unsigned)(HDrandom() % (MAX_CODE_POINT - 32)) + 32;
+ if (unicode_point != 46 && unicode_point != 47)
+ cur_pos = write_char(unicode_point, test_string, cur_pos);
+ }
+
+ /* Avoid unlikely case of the null string */
+ if (cur_pos == 0) {
+ test_string[cur_pos] = 'Q';
+ cur_pos++;
+ }
+ test_string[cur_pos] = '\0';
+
+ /* Create file */
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ test_fl_string(fid, test_string);
+ test_strpad(fid, "abcdefgh");
+ test_strpad(fid, test_string);
+ test_vl_string(fid, test_string);
+ test_objnames(fid, test_string);
+ test_attrname(fid, test_string);
+ test_compound(fid, test_string);
+ test_enum(fid, test_string);
+ test_opaque(fid, test_string);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* This function could be useful in debugging if certain strings
+ * create errors.
*/
- unicode_point = (unsigned)(HDrandom() % (MAX_CODE_POINT-32)) + 32;
- if(unicode_point != 46 && unicode_point != 47)
- cur_pos = write_char(unicode_point, test_string, cur_pos);
- }
-
- /* Avoid unlikely case of the null string */
- if(cur_pos == 0)
- {
- test_string[cur_pos] = 'Q';
- cur_pos++;
- }
- test_string[cur_pos]='\0';
-
- /* Create file */
- fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(fid, FAIL, "H5Fcreate");
-
- test_fl_string(fid, test_string);
- test_strpad(fid, "abcdefgh");
- test_strpad(fid, test_string);
- test_vl_string(fid, test_string);
- test_objnames(fid, test_string);
- test_attrname(fid, test_string);
- test_compound(fid, test_string);
- test_enum(fid, test_string);
- test_opaque(fid, test_string);
-
- /* Close file */
- ret = H5Fclose(fid);
- CHECK(ret, FAIL, "H5Fclose");
-
- /* This function could be useful in debugging if certain strings
- * create errors.
- */
#ifdef DEBUG
- dump_string(test_string);
+ dump_string(test_string);
#endif /* DEBUG */
}
/* cleanup_unicode(void)
* Delete the file this test created.
*/
-void cleanup_unicode(void)
+void
+cleanup_unicode(void)
{
HDremove(FILENAME);
}
-
-
diff --git a/test/tvlstr.c b/test/tvlstr.c
index bf37ad7..c8e65b5 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -12,37 +12,37 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tvlstr
-*
-* Test the Variable-Length String functionality
-*
-*************************************************************/
+ *
+ * Test program: tvlstr
+ *
+ * Test the Variable-Length String functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
-#define DATAFILE "tvlstr.h5"
-#define DATAFILE2 "tvlstr2.h5"
-#define DATAFILE3 "sel2el.h5"
+#define DATAFILE "tvlstr.h5"
+#define DATAFILE2 "tvlstr2.h5"
+#define DATAFILE3 "sel2el.h5"
-#define DATASET "1Darray"
+#define DATASET "1Darray"
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
-#define NUMP 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
+#define NUMP 4
-#define VLSTR_TYPE "vl_string_type"
+#define VLSTR_TYPE "vl_string_type"
/* Definitions for the VL re-writing test */
-#define REWRITE_NDATASETS 32
+#define REWRITE_NDATASETS 32
/* String for testing attributes */
-static const char *string_att = "This is the string for the attribute";
-static char *string_att_write=NULL;
+static const char *string_att = "This is the string for the attribute";
+static char * string_att_write = NULL;
void *test_vlstr_alloc_custom(size_t size, void *info);
-void test_vlstr_free_custom(void *mem, void *info);
+void test_vlstr_free_custom(void *mem, void *info);
/****************************************************************
**
@@ -52,24 +52,25 @@ void test_vlstr_free_custom(void *mem, void *info);
** allocated.
**
****************************************************************/
-void *test_vlstr_alloc_custom(size_t size, void *info)
+void *
+test_vlstr_alloc_custom(size_t size, void *info)
{
- void *ret_value=NULL; /* Pointer to return */
- size_t *mem_used=(size_t *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ void * ret_value = NULL; /* Pointer to return */
+ size_t *mem_used = (size_t *)info; /* Get the pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
* alignment correct - QAK
*/
- extra=MAX(sizeof(void *),sizeof(size_t));
+ extra = MAX(sizeof(void *), sizeof(size_t));
- if((ret_value=HDmalloc(extra+size))!=NULL) {
- *(size_t *)ret_value=size;
- *mem_used+=size;
+ if ((ret_value = HDmalloc(extra + size)) != NULL) {
+ *(size_t *)ret_value = size;
+ *mem_used += size;
} /* end if */
- ret_value=((unsigned char *)ret_value)+extra;
- return(ret_value);
+ ret_value = ((unsigned char *)ret_value) + extra;
+ return (ret_value);
}
/****************************************************************
@@ -80,21 +81,22 @@ void *test_vlstr_alloc_custom(size_t size, void *info)
** allocated.
**
****************************************************************/
-void test_vlstr_free_custom(void *_mem, void *info)
+void
+test_vlstr_free_custom(void *_mem, void *info)
{
unsigned char *mem;
- size_t *mem_used=(size_t *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ size_t * mem_used = (size_t *)info; /* Get the pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
* alignment correct - QAK
*/
- extra=MAX(sizeof(void *),sizeof(size_t));
+ extra = MAX(sizeof(void *), sizeof(size_t));
- if(_mem!=NULL) {
- mem=((unsigned char *)_mem)-extra;
- *mem_used-=*(size_t *)((void *)mem);
+ if (_mem != NULL) {
+ mem = ((unsigned char *)_mem) - extra;
+ *mem_used -= *(size_t *)((void *)mem);
HDfree(mem);
} /* end if */
}
@@ -109,27 +111,26 @@ static void
test_vlstrings_basic(void)
{
/* Information to write */
- const char *wdata[SPACE1_DIM1]= {
+ const char *wdata[SPACE1_DIM1] = {
"Four score and seven years ago our forefathers brought forth on this continent a new nation,",
"conceived in liberty and dedicated to the proposition that all men are created equal.",
"Now we are engaged in a great civil war,",
- "testing whether that nation or any nation so conceived and so dedicated can long endure."
- };
-
- char *rdata[SPACE1_DIM1]; /* Information read in */
- char *wdata2;
- hid_t dataspace, dataset2;
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i; /* counting variable */
- size_t str_used; /* String data in memory */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ "testing whether that nation or any nation so conceived and so dedicated can long endure."};
+
+ char * rdata[SPACE1_DIM1]; /* Information read in */
+ char * wdata2;
+ hid_t dataspace, dataset2;
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i; /* counting variable */
+ size_t str_used; /* String data in memory */
+ size_t mem_used = 0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic VL String Functionality\n"));
@@ -146,7 +147,7 @@ test_vlstrings_basic(void)
tid1 = H5Tcopy(H5T_C_S1);
CHECK(tid1, FAIL, "H5Tcopy");
- ret = H5Tset_size(tid1,H5T_VARIABLE);
+ ret = H5Tset_size(tid1, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
/* Create a dataset */
@@ -162,7 +163,7 @@ test_vlstrings_basic(void)
dataset2 = H5Dcreate2(fid1, "Dataset2", tid1, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
- wdata2 = (char*)HDcalloc((size_t)65534, sizeof(char));
+ wdata2 = (char *)HDcalloc((size_t)65534, sizeof(char));
HDmemset(wdata2, 'A', (size_t)65533);
ret = H5Dwrite(dataset2, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata2);
@@ -176,45 +177,48 @@ test_vlstrings_basic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vlstr_alloc_custom,&mem_used,test_vlstr_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vlstr_alloc_custom, &mem_used, test_vlstr_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* Count the actual number of bytes used by the strings */
- for(i=0,str_used=0; i<SPACE1_DIM1; i++)
- str_used += HDstrlen(wdata[i])+1;
+ for (i = 0, str_used = 0; i < SPACE1_DIM1; i++)
+ str_used += HDstrlen(wdata[i]) + 1;
/* Compare against the strings actually written */
- VERIFY(size,(hsize_t)str_used,"H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)str_used, "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
- VERIFY(mem_used,str_used,"H5Dread");
+ VERIFY(mem_used, str_used, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i]));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i,
+ (int)strlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
continue;
} /* end if */
- if(HDstrcmp(wdata[i], rdata[i]) != 0 ) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i],
+ (int)i, rdata[i]);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
- ret = H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -247,18 +251,18 @@ test_vlstrings_basic(void)
static void
test_vlstrings_special(void)
{
- const char *wdata[SPACE1_DIM1] = {"", "two", "three", "\0"};
+ const char *wdata[SPACE1_DIM1] = {"", "two", "three", "\0"};
const char *wdata2[SPACE1_DIM1] = {NULL, NULL, NULL, NULL};
- char *rdata[SPACE1_DIM1]; /* Information read in */
- char *fill; /* Fill value */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hid_t dcpl; /* Dataset creation property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i; /* counting variable */
- herr_t ret; /* Generic return value */
+ char * rdata[SPACE1_DIM1]; /* Information read in */
+ char * fill; /* Fill value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ unsigned i; /* counting variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Special VL Strings\n"));
@@ -275,7 +279,7 @@ test_vlstrings_special(void)
tid1 = H5Tcopy(H5T_C_S1);
CHECK(tid1, FAIL, "H5Tcopy");
- ret = H5Tset_size(tid1,H5T_VARIABLE);
+ ret = H5Tset_size(tid1, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
/* Create a dataset */
@@ -287,9 +291,9 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i] != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)i, rdata[i]);
/* Write dataset to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -300,20 +304,22 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i]));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i,
+ (int)strlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
continue;
} /* end if */
- if((wdata[i] == NULL && rdata[i] != NULL) || (rdata[i] == NULL && wdata[i] != NULL)) {
+ if ((wdata[i] == NULL && rdata[i] != NULL) || (rdata[i] == NULL && wdata[i] != NULL)) {
TestErrPrintf("VL data values don't match!\n");
continue;
} /* end if */
- if(HDstrcmp(wdata[i], rdata[i]) != 0 ) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i],
+ (int)i, rdata[i]);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, rdata);
@@ -329,7 +335,7 @@ test_vlstrings_special(void)
/* Set the fill value for the second dataset */
fill = NULL;
- ret = H5Pset_fill_value(dcpl, tid1, &fill);
+ ret = H5Pset_fill_value(dcpl, tid1, &fill);
CHECK(ret, FAIL, "H5Pset_fill_value");
dataset = H5Dcreate2(fid1, "Dataset4", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT);
@@ -344,9 +350,9 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i] != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)i, rdata[i]);
/* Try to write nil strings to disk. */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
@@ -357,9 +363,9 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i] != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)i, rdata[i]);
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -384,14 +390,15 @@ test_vlstrings_special(void)
** Tests if VL string is treated as string.
**
****************************************************************/
-static void test_vlstring_type(void)
+static void
+test_vlstring_type(void)
{
- hid_t fid; /* HDF5 File IDs */
- hid_t tid_vlstr;
- H5T_cset_t cset;
- H5T_str_t pad;
- htri_t vl_str; /* Whether string is VL */
- herr_t ret;
+ hid_t fid; /* HDF5 File IDs */
+ hid_t tid_vlstr;
+ H5T_cset_t cset;
+ H5T_str_t pad;
+ htri_t vl_str; /* Whether string is VL */
+ herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing VL String type\n"));
@@ -448,7 +455,6 @@ static void test_vlstring_type(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
fid = H5Fopen(DATAFILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -480,15 +486,15 @@ static void
test_compact_vlstring(void)
{
const char *wdata[SPACE1_DIM1] = {"one", "two", "three", "four"};
- char *rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hid_t plist; /* Dataset creation property list */
- hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i; /* counting variable */
- herr_t ret; /* Generic return value */
+ char * rdata[SPACE1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hid_t plist; /* Dataset creation property list */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ unsigned i; /* counting variable */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing VL Strings in compact dataset\n"));
@@ -502,10 +508,10 @@ test_compact_vlstring(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a datatype to refer to */
- tid1 = H5Tcopy (H5T_C_S1);
+ tid1 = H5Tcopy(H5T_C_S1);
CHECK(tid1, FAIL, "H5Tcopy");
- ret = H5Tset_size (tid1,H5T_VARIABLE);
+ ret = H5Tset_size(tid1, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
plist = H5Pcreate(H5P_DATASET_CREATE);
@@ -527,16 +533,18 @@ test_compact_vlstring(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i]));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i,
+ (int)strlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i]));
continue;
} /* end if */
- if(HDstrcmp(wdata[i], rdata[i]) != 0) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i],
+ (int)i, rdata[i]);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, rdata);
@@ -569,22 +577,23 @@ test_compact_vlstring(void)
** Tests writing VL strings as attributes
**
****************************************************************/
-static void test_write_vl_string_attribute(void)
+static void
+test_write_vl_string_attribute(void)
{
- hid_t file, root, dataspace, att;
- hid_t type;
+ hid_t file, root, dataspace, att;
+ hid_t type;
herr_t ret;
- char *string_att_check = NULL;
+ char * string_att_check = NULL;
/* Open the file */
file = H5Fopen(DATAFILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fopen");
/* Create a datatype to refer to. */
- type = H5Tcopy (H5T_C_S1);
+ type = H5Tcopy(H5T_C_S1);
CHECK(type, FAIL, "H5Tcopy");
- ret = H5Tset_size (type, H5T_VARIABLE);
+ ret = H5Tset_size(type, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
root = H5Gopen2(file, "/", H5P_DEFAULT);
@@ -603,8 +612,9 @@ static void test_write_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att) != 0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
+ if (HDstrcmp(string_att_check, string_att) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n", string_att,
+ string_att_check);
H5free_memory(string_att_check);
string_att_check = NULL;
@@ -616,7 +626,7 @@ static void test_write_vl_string_attribute(void)
att = H5Acreate2(root, "test_scalar_large", type, dataspace, H5P_DEFAULT, H5P_DEFAULT);
CHECK(att, FAIL, "H5Acreate2");
- string_att_write = (char*)HDcalloc((size_t)8192, sizeof(char));
+ string_att_write = (char *)HDcalloc((size_t)8192, sizeof(char));
HDmemset(string_att_write, 'A', (size_t)8191);
ret = H5Awrite(att, type, &string_att_write);
@@ -625,8 +635,9 @@ static void test_write_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write) != 0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+ if (HDstrcmp(string_att_check, string_att_write) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",
+ string_att_write, string_att_check);
H5free_memory(string_att_check);
string_att_check = NULL;
@@ -658,22 +669,23 @@ static void test_write_vl_string_attribute(void)
** Tests reading VL strings from attributes
**
****************************************************************/
-static void test_read_vl_string_attribute(void)
+static void
+test_read_vl_string_attribute(void)
{
- hid_t file, root, att;
- hid_t type;
+ hid_t file, root, att;
+ hid_t type;
herr_t ret;
- char *string_att_check = NULL;
+ char * string_att_check = NULL;
/* Open file */
file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fopen");
/* Create a datatype to refer to. */
- type = H5Tcopy (H5T_C_S1);
+ type = H5Tcopy(H5T_C_S1);
CHECK(type, FAIL, "H5Tcopy");
- ret = H5Tset_size (type, H5T_VARIABLE);
+ ret = H5Tset_size(type, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
root = H5Gopen2(file, "/", H5P_DEFAULT);
@@ -686,8 +698,9 @@ static void test_read_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att) != 0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
+ if (HDstrcmp(string_att_check, string_att) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n", string_att,
+ string_att_check);
H5free_memory(string_att_check);
string_att_check = NULL;
@@ -699,19 +712,20 @@ static void test_read_vl_string_attribute(void)
att = H5Aopen(root, "test_scalar_large", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
- if(string_att_write) {
+ if (string_att_write) {
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write) != 0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+ if (HDstrcmp(string_att_check, string_att_write) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",
+ string_att_write, string_att_check);
H5free_memory(string_att_check);
string_att_check = NULL;
}
/* Free string allocated in test_write_vl_string_attribute */
- if(string_att_write)
+ if (string_att_write)
HDfree(string_att_write);
ret = H5Aclose(att);
@@ -730,27 +744,29 @@ static void test_read_vl_string_attribute(void)
}
/* Helper routine for test_vl_rewrite() */
-static void write_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, char *data)
+static void
+write_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, char *data)
{
- hid_t dset;
- herr_t ret;
+ hid_t dset;
+ herr_t ret;
- dset = H5Dcreate2(file, name, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset, FAIL, "H5Dcreate2");
+ dset = H5Dcreate2(file, name, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
- ret = H5Dwrite(dset, type, space, space, H5P_DEFAULT, &data);
- CHECK(ret, FAIL, "H5Dwrite");
+ ret = H5Dwrite(dset, type, space, space, H5P_DEFAULT, &data);
+ CHECK(ret, FAIL, "H5Dwrite");
- ret = H5Dclose(dset);
- CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
}
/* Helper routine for test_vl_rewrite() */
-static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, char *data)
+static void
+read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, char *data)
{
- hid_t dset;
+ hid_t dset;
herr_t ret;
- char *data_read;
+ char * data_read;
dset = H5Dopen2(file, name, H5P_DEFAULT);
CHECK(dset, FAIL, "H5Dopen2");
@@ -761,7 +777,7 @@ static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, ch
ret = H5Dclose(dset);
CHECK(ret, FAIL, "H5Dclose");
- if(HDstrcmp(data, data_read))
+ if (HDstrcmp(data, data_read))
TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
ret = H5Treclaim(type, space, H5P_DEFAULT, &data_read);
@@ -775,14 +791,15 @@ static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, ch
** have been linked/unlinked.
**
****************************************************************/
-static void test_vl_rewrite(void)
+static void
+test_vl_rewrite(void)
{
- hid_t file1, file2; /* File IDs */
- hid_t type; /* VL string datatype ID */
- hid_t space; /* Scalar dataspace */
- char name[256]; /* Buffer for names & data */
- int i; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file1, file2; /* File IDs */
+ hid_t type; /* VL string datatype ID */
+ hid_t space; /* Scalar dataspace */
+ char name[256]; /* Buffer for names & data */
+ int i; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Create the VL string datatype */
type = H5Tcopy(H5T_C_S1);
@@ -803,33 +820,33 @@ static void test_vl_rewrite(void)
CHECK(file1, FAIL, "H5Fcreate");
/* Create in file 1 */
- for(i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
HDsprintf(name, "/set_%d", i);
write_scalar_dset(file1, type, space, name, name);
}
/* Effectively copy data from file 1 to 2 */
- for(i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
HDsprintf(name, "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
}
/* Read back from file 2 */
- for(i = 0; i < REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
HDsprintf(name, "/set_%d", i);
read_scalar_dset(file2, type, space, name, name);
} /* end for */
/* Remove from file 2. */
- for(i = 0; i < REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
HDsprintf(name, "/set_%d", i);
ret = H5Ldelete(file2, name, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
} /* end for */
/* Effectively copy from file 1 to file 2 */
- for(i = 0; i < REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
HDsprintf(name, "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
@@ -858,16 +875,17 @@ static void test_vl_rewrite(void)
** H5Sselect_element.
**
****************************************************************/
-static void test_write_same_element(void)
+static void
+test_write_same_element(void)
{
- hid_t file1, dataset1;
- hid_t mspace, fspace, dtype;
- hsize_t fdim[] = {SPACE1_DIM1};
+ hid_t file1, dataset1;
+ hid_t mspace, fspace, dtype;
+ hsize_t fdim[] = {SPACE1_DIM1};
const char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."};
- const char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"};
- hsize_t marray[] = {NUMP};
- hsize_t coord[SPACE1_RANK][NUMP];
- herr_t ret;
+ const char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"};
+ hsize_t marray[] = {NUMP};
+ hsize_t coord[SPACE1_RANK][NUMP];
+ herr_t ret;
file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file1, FAIL, "H5Fcreate");
@@ -881,8 +899,7 @@ static void test_write_same_element(void)
fspace = H5Screate_simple(SPACE1_RANK, fdim, NULL);
CHECK(fspace, FAIL, "H5Screate_simple");
- dataset1 = H5Dcreate2(file1, DATASET, dtype, fspace, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dataset1 = H5Dcreate2(file1, DATASET, dtype, fspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset1, FAIL, "H5Dcreate");
ret = H5Dwrite(dataset1, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -971,7 +988,7 @@ test_vlstrings(void)
test_vl_rewrite();
/* Test writing to the same element more than once using H5Sselect_elements */
test_write_same_element();
-} /* test_vlstrings() */
+} /* test_vlstrings() */
/*-------------------------------------------------------------------------
* Function: cleanup_vlstrings
@@ -994,4 +1011,3 @@ cleanup_vlstrings(void)
HDremove(DATAFILE2);
HDremove(DATAFILE3);
}
-
diff --git a/test/tvltypes.c b/test/tvltypes.c
index e8c69b4..50cfbd7 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -12,37 +12,37 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tvltypes
-*
-* Test the Variable-Length Datatype functionality
-*
-*************************************************************/
+ *
+ * Test program: tvltypes
+ *
+ * Test the Variable-Length Datatype functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
#include "H5Dprivate.h"
-#define FILENAME "tvltypes.h5"
+#define FILENAME "tvltypes.h5"
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
/* 1-D dataset with fixed dimensions */
-#define SPACE3_RANK 1
-#define SPACE3_DIM1 128
-#define L1_INCM 16
-#define L2_INCM 8
-#define L3_INCM 3
+#define SPACE3_RANK 1
+#define SPACE3_DIM1 128
+#define L1_INCM 16
+#define L2_INCM 8
+#define L3_INCM 3
/* 1-D dataset with fixed dimensions */
-#define SPACE4_RANK 1
-#define SPACE4_DIM_SMALL 128
-#define SPACE4_DIM_LARGE (H5D_TEMP_BUF_SIZE / 64)
+#define SPACE4_RANK 1
+#define SPACE4_DIM_SMALL 128
+#define SPACE4_DIM_LARGE (H5D_TEMP_BUF_SIZE / 64)
void *test_vltypes_alloc_custom(size_t size, void *info);
-void test_vltypes_free_custom(void *mem, void *info);
+void test_vltypes_free_custom(void *mem, void *info);
/****************************************************************
**
@@ -52,22 +52,23 @@ void test_vltypes_free_custom(void *mem, void *info);
** allocated.
**
****************************************************************/
-void *test_vltypes_alloc_custom(size_t size, void *mem_used)
+void *
+test_vltypes_alloc_custom(size_t size, void *mem_used)
{
- void *ret_value; /* Pointer to return */
+ void * ret_value; /* Pointer to return */
const size_t extra = MAX(sizeof(void *), sizeof(size_t)); /* Extra space needed */
- /* (This weird contortion is required on the
- * DEC Alpha to keep the alignment correct - QAK)
- */
+ /* (This weird contortion is required on the
+ * DEC Alpha to keep the alignment correct - QAK)
+ */
- if((ret_value = HDmalloc(extra + size)) != NULL) {
+ if ((ret_value = HDmalloc(extra + size)) != NULL) {
*(size_t *)ret_value = size;
*(size_t *)mem_used += size;
} /* end if */
ret_value = ((unsigned char *)ret_value) + extra;
- return(ret_value);
+ return (ret_value);
}
/****************************************************************
@@ -78,15 +79,16 @@ void *test_vltypes_alloc_custom(size_t size, void *mem_used)
** allocated.
**
****************************************************************/
-void test_vltypes_free_custom(void *_mem, void *mem_used)
+void
+test_vltypes_free_custom(void *_mem, void *mem_used)
{
- if(_mem) {
- const size_t extra = MAX(sizeof(void *), sizeof(size_t)); /* Extra space needed */
- /* (This weird contortion is required
- * on the DEC Alpha to keep the
- * alignment correct - QAK)
- */
- unsigned char *mem = ((unsigned char *)_mem) - extra; /* Pointer to actual block allocated */
+ if (_mem) {
+ const size_t extra = MAX(sizeof(void *), sizeof(size_t)); /* Extra space needed */
+ /* (This weird contortion is required
+ * on the DEC Alpha to keep the
+ * alignment correct - QAK)
+ */
+ unsigned char *mem = ((unsigned char *)_mem) - extra; /* Pointer to actual block allocated */
*(size_t *)mem_used -= *(size_t *)((void *)mem);
HDfree(mem);
@@ -102,13 +104,13 @@ void test_vltypes_free_custom(void *_mem, void *mem_used)
static void
test_vltypes_dataset_create(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dcpl; /* Dataset Property list */
- hid_t dataset; /* Dataset ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dcpl; /* Dataset Property list */
+ hid_t dataset; /* Dataset ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataset of VL Datatype Functionality\n"));
@@ -134,9 +136,8 @@ test_vltypes_dataset_create(void)
CHECK(ret, FAIL, "H5Pset_fill_time");
/* Create a dataset, supposed to fail */
- H5E_BEGIN_TRY {
- dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(dataset, FAIL, "H5Dcreate2");
/* Close datatype */
@@ -165,19 +166,19 @@ test_vltypes_dataset_create(void)
static void
test_vltypes_funcs(void)
{
- hid_t type; /* Datatype ID */
- size_t size;
- H5T_pad_t inpad;
- H5T_norm_t norm;
- H5T_cset_t cset;
- H5T_str_t strpad;
- herr_t ret; /* Generic return value */
+ hid_t type; /* Datatype ID */
+ size_t size;
+ H5T_pad_t inpad;
+ H5T_norm_t norm;
+ H5T_cset_t cset;
+ H5T_str_t strpad;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing some type functions for VL\n"));
/* Create a datatype to refer to */
- type = H5Tvlen_create (H5T_IEEE_F32BE);
+ type = H5Tvlen_create(H5T_IEEE_F32BE);
CHECK(type, FAIL, "H5Tvlen_create");
size = H5Tget_precision(type);
@@ -201,14 +202,12 @@ test_vltypes_funcs(void)
ret = H5Tset_offset(type, (size_t)16);
CHECK(ret, FAIL, "H5Tset_offset");
- H5E_BEGIN_TRY {
- cset = H5Tget_cset(type);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { cset = H5Tget_cset(type); }
+ H5E_END_TRY;
VERIFY(cset, FAIL, "H5Tget_cset");
- H5E_BEGIN_TRY {
- strpad=H5Tget_strpad(type);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); }
+ H5E_END_TRY;
VERIFY(strpad, FAIL, "H5Tget_strpad");
/* Close datatype */
@@ -225,35 +224,35 @@ test_vltypes_funcs(void)
static void
test_vltypes_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t wdata2[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hvl_t fill; /* Fill value */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t sid2; /* ID of bad dataspace (no extent set) */
- hid_t tid1; /* Datatype ID */
- hid_t dcpl_pid; /* Dataset creation property list ID */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t wdata2[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hvl_t fill; /* Fill value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t sid2; /* ID of bad dataspace (no extent set) */
+ hid_t tid1; /* Datatype ID */
+ hid_t dcpl_pid; /* Dataset creation property list ID */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Atomic VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+1)*sizeof(unsigned int));
- wdata[i].len=i+1;
- for(j=0; j<(i+1); j++)
- ((unsigned int *)wdata[i].p)[j]=i*10+j;
-
- wdata2[i].p=NULL;
- wdata2[i].len=0;
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + 1) * sizeof(unsigned int));
+ wdata[i].len = i + 1;
+ for (j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].p)[j] = i * 10 + j;
+
+ wdata2[i].p = NULL;
+ wdata2[i].len = 0;
} /* end for */
/* Create file */
@@ -265,7 +264,7 @@ test_vltypes_vlen_atomic(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a datatype to refer to */
- tid1 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create a dataset */
@@ -277,9 +276,10 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i].len != 0 || rdata[i].p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].len != 0 || rdata[i].p != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n", (int)i,
+ (unsigned)rdata[i].len, (int)i, rdata[i].p);
/* Write "nil" data to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
@@ -290,9 +290,10 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i].len != 0 || rdata[i].p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].len != 0 || rdata[i].p != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n", (int)i,
+ (unsigned)rdata[i].len, (int)i, rdata[i].p);
/* Write dataset to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -307,8 +308,9 @@ test_vltypes_vlen_atomic(void)
CHECK(dcpl_pid, FAIL, "H5Pcreate");
/* Set the fill value for the second dataset */
- fill.p = NULL; fill.len = 0;
- ret = H5Pset_fill_value(dcpl_pid, tid1, &fill);
+ fill.p = NULL;
+ fill.len = 0;
+ ret = H5Pset_fill_value(dcpl_pid, tid1, &fill);
CHECK(ret, FAIL, "H5Pset_fill_value");
/* Create a second dataset */
@@ -324,9 +326,10 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i].len != 0 || rdata[i].p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].len != 0 || rdata[i].p != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n", (int)i,
+ (unsigned)rdata[i].len, (int)i, rdata[i].p);
/* Write "nil" data to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
@@ -337,9 +340,10 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++)
- if(rdata[i].len != 0 || rdata[i].p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].len != 0 || rdata[i].p != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n", (int)i,
+ (unsigned)rdata[i].len, (int)i, rdata[i].p);
/* Write data to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -361,7 +365,6 @@ test_vltypes_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file for data checking */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -382,7 +385,8 @@ test_vltypes_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -390,7 +394,7 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(size,((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
@@ -398,21 +402,24 @@ test_vltypes_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n", (int)i,
+ (int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
@@ -437,7 +444,6 @@ test_vltypes_vlen_atomic(void)
ret = H5Pclose(xfer_pid);
CHECK(ret, FAIL, "H5Pclose");
-
/* Open second dataset */
dataset = H5Dopen2(fid1, "Dataset2", H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dopen2");
@@ -458,7 +464,8 @@ test_vltypes_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -466,56 +473,57 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+ VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
/* Try to call H5Dvlen_get_buf with bad dataspace */
- H5E_BEGIN_TRY {
- ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n", (int)i,
+ (int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Try to reclaim read data using "bad" dataspace with no extent
* Should fail */
- H5E_BEGIN_TRY {
- ret=H5Treclaim(tid1,sid2,xfer_pid,rdata);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Treclaim(tid1, sid2, xfer_pid, rdata); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Treclaim");
/* Reclaim the read VL data */
- ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close datatype */
@@ -545,27 +553,27 @@ test_vltypes_vlen_atomic(void)
static void
rewrite_vltypes_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- unsigned increment=4;
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 4;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Check Memory Leak for Basic Atomic VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].p = HDmalloc((i + increment) * sizeof(unsigned int));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + increment) * sizeof(unsigned int));
wdata[i].len = i + increment;
- for(j = 0; j < (i + increment); j++)
+ for (j = 0; j < (i + increment); j++)
((unsigned int *)wdata[i].p)[j] = i * 20 + j;
} /* end for */
@@ -605,7 +613,6 @@ rewrite_vltypes_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file for data checking */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -626,7 +633,8 @@ rewrite_vltypes_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -645,28 +653,31 @@ rewrite_vltypes_vlen_atomic(void)
VERIFY(mem_used, 22 * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n", (int)i,
+ (int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
- ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
@@ -691,8 +702,6 @@ rewrite_vltypes_vlen_atomic(void)
} /* end rewrite_vltypes_vlen_atomic() */
-
-
/****************************************************************
**
** test_vltypes_vlen_compound(): Test basic VL datatype code.
@@ -702,35 +711,35 @@ rewrite_vltypes_vlen_atomic(void)
static void
test_vltypes_vlen_compound(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
} s1;
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Compound VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+1)*sizeof(s1));
- wdata[i].len=i+1;
- for(j=0; j<(i+1); j++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + 1) * sizeof(s1));
+ wdata[i].len = i + 1;
+ for (j = 0; j < (i + 1); j++) {
((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
((s1 *)wdata[i].p)[j].f = (float)(i * 20 + j) / 3.0F;
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -766,7 +775,8 @@ test_vltypes_vlen_compound(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -782,35 +792,40 @@ test_vltypes_vlen_compound(void)
/* Make certain the correct amount of memory has been used */
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(s1),"H5Dread");
+ VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(s1), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if(((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",
+ (int)i, (int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i, (int)j,
+ (int)((s1 *)rdata[i].p)[j].i);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f);
+ if (!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f, ((s1 *)rdata[i].p)[j].f)) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",
+ (int)i, (int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i, (int)j,
+ (double)((s1 *)rdata[i].p)[j].f);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
@@ -848,35 +863,35 @@ test_vltypes_vlen_compound(void)
static void
rewrite_vltypes_vlen_compound(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
} s1;
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- unsigned increment=4;
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 4;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Check Memory Leak for Basic Compound VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].p = HDmalloc((i + increment) * sizeof(s1));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + increment) * sizeof(s1));
wdata[i].len = i + increment;
- for(j = 0; j < (i + increment); j++) {
+ for (j = 0; j < (i + increment); j++) {
((s1 *)wdata[i].p)[j].i = (int)(i * 40 + j);
((s1 *)wdata[i].p)[j].f = (float)(i * 60 + j) / 3.0F;
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -892,7 +907,7 @@ rewrite_vltypes_vlen_compound(void)
CHECK(ret, FAIL, "H5Tinsert");
/* Create a datatype to refer to */
- tid1 = H5Tvlen_create (tid2);
+ tid1 = H5Tvlen_create(tid2);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create a dataset */
@@ -911,7 +926,8 @@ rewrite_vltypes_vlen_compound(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -922,40 +938,45 @@ rewrite_vltypes_vlen_compound(void)
VERIFY(size, 22 * sizeof(s1), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* 22 elements allocated = 4 + 5 + 6 + 7 elements for each array position */
- VERIFY(mem_used,22*sizeof(s1),"H5Dread");
+ VERIFY(mem_used, 22 * sizeof(s1), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if( ((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",
+ (int)i, (int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i, (int)j,
+ (int)((s1 *)rdata[i].p)[j].i);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f);
+ if (!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f, ((s1 *)rdata[i].p)[j].f)) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",
+ (int)i, (int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i, (int)j,
+ (double)((s1 *)rdata[i].p)[j].f);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
@@ -993,21 +1014,21 @@ rewrite_vltypes_vlen_compound(void)
static void
test_vltypes_compound_vlen_vlen(void)
{
- typedef struct { /* Struct that the compound type are composed of */
- int i;
+ typedef struct { /* Struct that the compound type are composed of */
+ int i;
float f;
hvl_t v;
} s1;
- s1 *wdata; /* data to write */
- s1 *rdata; /* data to read */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2, tid3; /* Datatype IDs */
- hsize_t dims1[] = {SPACE3_DIM1};
- unsigned i,j,k; /* counting variables */
- hvl_t *t1, *t2; /* Temporary pointer to VL information */
- herr_t ret; /* Generic return value */
+ s1 * wdata; /* data to write */
+ s1 * rdata; /* data to read */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2, tid3; /* Datatype IDs */
+ hsize_t dims1[] = {SPACE3_DIM1};
+ unsigned i, j, k; /* counting variables */
+ hvl_t * t1, *t2; /* Temporary pointer to VL information */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
@@ -1017,18 +1038,18 @@ test_vltypes_compound_vlen_vlen(void)
CHECK_PTR(wdata, "HDmalloc");
rdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1);
CHECK_PTR(rdata, "HDmalloc");
- for(i = 0; i < SPACE3_DIM1; i++) {
- wdata[i].i = (int)(i * 10);
- wdata[i].f = (float)(i * 20) / 3.0F;
- wdata[i].v.p = HDmalloc((i + L1_INCM) * sizeof(hvl_t));
+ for (i = 0; i < SPACE3_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + L1_INCM) * sizeof(hvl_t));
wdata[i].v.len = i + L1_INCM;
- for(t1 = (hvl_t *)((wdata[i].v).p), j = 0; j < (i + L1_INCM); j++, t1++) {
- t1->p = HDmalloc((j + L2_INCM) * sizeof(unsigned int));
+ for (t1 = (hvl_t *)((wdata[i].v).p), j = 0; j < (i + L1_INCM); j++, t1++) {
+ t1->p = HDmalloc((j + L2_INCM) * sizeof(unsigned int));
t1->len = j + L2_INCM;
- for(k = 0; k < j + L2_INCM; k++)
- ((unsigned int*)t1->p)[k] = i * 100 + j * 10 + k;
+ for (k = 0; k < j + L2_INCM; k++)
+ ((unsigned int *)t1->p)[k] = i * 100 + j * 10 + k;
} /* end for */
- } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1039,11 +1060,11 @@ test_vltypes_compound_vlen_vlen(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a VL datatype to refer to */
- tid3 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid3 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid3, FAIL, "H5Tvlen_create");
/* Create a VL datatype to refer to */
- tid1 = H5Tvlen_create (tid3);
+ tid1 = H5Tvlen_create(tid3);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create the base compound type */
@@ -1074,7 +1095,6 @@ test_vltypes_compound_vlen_vlen(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1088,41 +1108,47 @@ test_vltypes_compound_vlen_vlen(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE3_DIM1; i++) {
- if(wdata[i].i != rdata[i].i) {
- TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
+ for (i = 0; i < SPACE3_DIM1; i++) {
+ if (wdata[i].i != rdata[i].i) {
+ TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n", (int)i,
+ (int)wdata[i].i, (int)i, (int)rdata[i].i);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
- TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i].f, rdata[i].f)) {
+ TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n", (int)i,
+ (double)wdata[i].f, (int)i, (double)rdata[i].f);
continue;
} /* end if */
- if(wdata[i].v.len != rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(t1=(hvl_t *)(wdata[i].v.p), t2=(hvl_t *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) {
- if(t1->len != t2->len) {
- TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
+ for (t1 = (hvl_t *)(wdata[i].v.p), t2 = (hvl_t *)(rdata[i].v.p), j = 0; j < rdata[i].v.len;
+ j++, t1++, t2++) {
+ if (t1->len != t2->len) {
+ TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",
+ __LINE__, (int)i, (int)j, (int)t1->len, (int)t2->len);
continue;
} /* end if */
- for(k=0; k<t2->len; k++) {
- if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) {
- TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
+ for (k = 0; k < t2->len; k++) {
+ if (((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k]) {
+ TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n", (int)k,
+ (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,rdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
@@ -1165,48 +1191,44 @@ test_vltypes_compound_vlen_vlen(void)
static void
test_vltypes_compound_vlstr(void)
{
- typedef enum {
- red,
- blue,
- green
- } e1;
+ typedef enum { red, blue, green } e1;
typedef struct {
char *string;
- e1 color;
+ e1 color;
} s2;
- typedef struct { /* Struct that the compound type are composed of */
+ typedef struct { /* Struct that the compound type are composed of */
hvl_t v;
} s1;
- s1 wdata[SPACE1_DIM1]; /* data to write */
- s1 wdata2[SPACE1_DIM1]; /* data to write */
- s1 rdata[SPACE1_DIM1]; /* data to read */
- s1 rdata2[SPACE1_DIM1]; /* data to read */
- char str[64] = "a\0";
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, dset2; /* Dataset ID */
- hid_t sid1, sid2, filespace, filespace2; /* Dataspace ID */
- hid_t tid1, tid2, tid3, tid4, tid5; /* Datatype IDs */
+ s1 wdata[SPACE1_DIM1]; /* data to write */
+ s1 wdata2[SPACE1_DIM1]; /* data to write */
+ s1 rdata[SPACE1_DIM1]; /* data to read */
+ s1 rdata2[SPACE1_DIM1]; /* data to read */
+ char str[64] = "a\0";
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, dset2; /* Dataset ID */
+ hid_t sid1, sid2, filespace, filespace2; /* Dataspace ID */
+ hid_t tid1, tid2, tid3, tid4, tid5; /* Datatype IDs */
hid_t cparms;
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t chunk_dims[] = {SPACE1_DIM1/2};
- hsize_t maxdims[] = {H5S_UNLIMITED};
- hsize_t size[] = {SPACE1_DIM1};
- hsize_t offset[] = {0};
- unsigned i,j; /* counting variables */
- s2 *t1, *t2; /* Temporary pointer to VL information */
- int val;
- herr_t ret; /* Generic return value */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t chunk_dims[] = {SPACE1_DIM1 / 2};
+ hsize_t maxdims[] = {H5S_UNLIMITED};
+ hsize_t size[] = {SPACE1_DIM1};
+ hsize_t offset[] = {0};
+ unsigned i, j; /* counting variables */
+ s2 * t1, *t2; /* Temporary pointer to VL information */
+ int val;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing VL Datatype of Compound Datatype with VL String Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].v.p=(s2*)HDmalloc((i+L3_INCM)*sizeof(s2));
- wdata[i].v.len=i+L3_INCM;
- for(t1=(s2 *)((wdata[i].v).p), j=0; j<(i+L3_INCM); j++, t1++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].v.p = (s2 *)HDmalloc((i + L3_INCM) * sizeof(s2));
+ wdata[i].v.len = i + L3_INCM;
+ for (t1 = (s2 *)((wdata[i].v).p), j = 0; j < (i + L3_INCM); j++, t1++) {
HDstrcat(str, "m");
- t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1);
+ t1->string = (char *)HDmalloc(HDstrlen(str) * sizeof(char) + 1);
HDstrcpy(t1->string, str);
/*t1->color = red;*/
t1->color = blue;
@@ -1222,15 +1244,15 @@ test_vltypes_compound_vlstr(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a VL string type*/
- tid4 = H5Tcopy (H5T_C_S1);
+ tid4 = H5Tcopy(H5T_C_S1);
CHECK(tid4, FAIL, "H5Tcopy");
- ret = H5Tset_size (tid4,H5T_VARIABLE);
+ ret = H5Tset_size(tid4, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
/* Create an enum type */
tid3 = H5Tenum_create(H5T_STD_I32LE);
- val = 0;
- ret = H5Tenum_insert(tid3, "RED", &val);
+ val = 0;
+ ret = H5Tenum_insert(tid3, "RED", &val);
CHECK(ret, FAIL, "H5Tenum_insert");
val = 1;
ret = H5Tenum_insert(tid3, "BLUE", &val);
@@ -1243,13 +1265,12 @@ test_vltypes_compound_vlstr(void)
tid5 = H5Tcreate(H5T_COMPOUND, sizeof(s2));
CHECK(tid5, FAIL, "H5Tcreate");
/* Insert fields */
- ret=H5Tinsert(tid5, "string", HOFFSET(s2, string), tid4);
+ ret = H5Tinsert(tid5, "string", HOFFSET(s2, string), tid4);
CHECK(ret, FAIL, "H5Tinsert");
/* Insert fields */
- ret=H5Tinsert(tid5, "enumerate", HOFFSET(s2, color), tid3);
+ ret = H5Tinsert(tid5, "enumerate", HOFFSET(s2, color), tid3);
CHECK(ret, FAIL, "H5Tinsert");
-
/* Create a VL datatype of first layer compound type */
tid1 = H5Tvlen_create(tid5);
CHECK(tid1, FAIL, "H5Tvlen_create");
@@ -1264,7 +1285,7 @@ test_vltypes_compound_vlstr(void)
/* Modify dataset creation properties, i.e. enable chunking */
cparms = H5Pcreate(H5P_DATASET_CREATE);
- ret = H5Pset_chunk(cparms, SPACE1_RANK, chunk_dims);
+ ret = H5Pset_chunk(cparms, SPACE1_RANK, chunk_dims);
CHECK(ret, FAIL, "H5Pset_chunk");
/* Create a dataset */
@@ -1277,7 +1298,7 @@ test_vltypes_compound_vlstr(void)
/* Select a hyperslab */
filespace = H5Dget_space(dataset);
- ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dims1, NULL);
+ ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dims1, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Write dataset to disk */
@@ -1323,7 +1344,6 @@ test_vltypes_compound_vlstr(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1341,49 +1361,52 @@ test_vltypes_compound_vlstr(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(wdata[i].v.len != rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) {
- if(HDstrcmp(t1->string, t2->string)) {
- TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string);
- continue;
- } /* end if */
- if(t1->color != t2->color) {
- TestErrPrintf("VL data values don't match!, t1->color=%d, t2->color=%d\n",t1->color, t2->color);
- continue;
- } /* end if */
- } /* end for */
- } /* end for */
+ for (t1 = (s2 *)(wdata[i].v.p), t2 = (s2 *)(rdata[i].v.p), j = 0; j < rdata[i].v.len;
+ j++, t1++, t2++) {
+ if (HDstrcmp(t1->string, t2->string)) {
+ TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n", t1->string,
+ t2->string);
+ continue;
+ } /* end if */
+ if (t1->color != t2->color) {
+ TestErrPrintf("VL data values don't match!, t1->color=%d, t2->color=%d\n", t1->color,
+ t2->color);
+ continue;
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,rdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Use this part for new data */
HDstrcpy(str, "bbbbbbbb\0");
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata2[i].v.p=(s2*)HDmalloc((i+1)*sizeof(s2));
- wdata2[i].v.len=i+1;
- for(t1=(s2*)(wdata2[i].v).p, j=0; j<i+1; j++, t1++) {
- HDstrcat(str, "pp");
- t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata2[i].v.p = (s2 *)HDmalloc((i + 1) * sizeof(s2));
+ wdata2[i].v.len = i + 1;
+ for (t1 = (s2 *)(wdata2[i].v).p, j = 0; j < i + 1; j++, t1++) {
+ HDstrcat(str, "pp");
+ t1->string = (char *)HDmalloc(HDstrlen(str) * sizeof(char) + 1);
HDstrcpy(t1->string, str);
- t1->color = green;
+ t1->color = green;
}
} /* end for */
/* Select a hyperslab */
- filespace2 = H5Dget_space (dset2);
- ret = H5Sselect_hyperslab (filespace2, H5S_SELECT_SET, offset, NULL,
- dims1, NULL);
+ filespace2 = H5Dget_space(dset2);
+ ret = H5Sselect_hyperslab(filespace2, H5S_SELECT_SET, offset, NULL, dims1, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for datasets */
@@ -1391,38 +1414,42 @@ test_vltypes_compound_vlstr(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Write dataset to disk */
- ret=H5Dwrite(dset2,tid2,sid2,filespace2,H5P_DEFAULT, &wdata2);
+ ret = H5Dwrite(dset2, tid2, sid2, filespace2, H5P_DEFAULT, &wdata2);
CHECK(ret, FAIL, "H5Dwrite");
/* Read dataset from disk */
- ret=H5Dread(dset2,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata2);
+ ret = H5Dread(dset2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata2[i].v.len!=rdata2[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata2[%d].v.len=%d, rdata2[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata2[i].v.len,(int)i,(int)rdata2[i].v.len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata2[i].v.len != rdata2[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata2[%d].v.len=%d, rdata2[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata2[i].v.len, (int)i, (int)rdata2[i].v.len);
continue;
} /* end if */
- for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; j<rdata2[i].v.len; j++, t1++, t2++) {
- if(HDstrcmp(t1->string, t2->string)) {
- TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string);
- continue;
- } /* end if */
- if(t1->color != t2->color) {
- TestErrPrintf("VL data values don't match!, t1->color=%d, t2->color=%d\n",t1->color, t2->color);
- continue;
- } /* end if */
- } /* end for */
- } /* end for */
+ for (t1 = (s2 *)(wdata2[i].v.p), t2 = (s2 *)(rdata2[i].v.p), j = 0; j < rdata2[i].v.len;
+ j++, t1++, t2++) {
+ if (HDstrcmp(t1->string, t2->string)) {
+ TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n", t1->string,
+ t2->string);
+ continue;
+ } /* end if */
+ if (t1->color != t2->color) {
+ TestErrPrintf("VL data values don't match!, t1->color=%d, t2->color=%d\n", t1->color,
+ t2->color);
+ continue;
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Reclaim the write VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata2);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, wdata2);
CHECK(ret, FAIL, "H5Treclaim");
/* Reclaim the VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,rdata2);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, rdata2);
CHECK(ret, FAIL, "H5Treclaim");
ret = H5Dclose(dset2);
@@ -1458,36 +1485,36 @@ test_vltypes_compound_vlstr(void)
static void
test_vltypes_compound_vlen_atomic(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
hvl_t v;
} s1;
- s1 wdata[SPACE1_DIM1]; /* Information to write */
- s1 rdata[SPACE1_DIM1]; /* Information read in */
- s1 fill; /* Fill value */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hid_t dcpl_pid; /* Dataset creation property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ s1 wdata[SPACE1_DIM1]; /* Information to write */
+ s1 rdata[SPACE1_DIM1]; /* Information read in */
+ s1 fill; /* Fill value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hid_t dcpl_pid; /* Dataset creation property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].i = (int)(i * 10);
- wdata[i].f = (float)(i * 20) / 3.0F;
- wdata[i].v.p = HDmalloc((i + 1)*sizeof(unsigned int));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + 1) * sizeof(unsigned int));
wdata[i].v.len = i + 1;
- for(j = 0; j < (i + 1); j++)
+ for (j = 0; j < (i + 1); j++)
((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
@@ -1500,7 +1527,7 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a VL datatype to refer to */
- tid1 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create the base compound type */
@@ -1527,7 +1554,8 @@ test_vltypes_compound_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -1543,29 +1571,34 @@ test_vltypes_compound_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].i!=rdata[i].i) {
- TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].i != rdata[i].i) {
+ TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n", (int)i,
+ (int)wdata[i].i, (int)i, (int)rdata[i].i);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
- TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i].f, rdata[i].f)) {
+ TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n", (int)i,
+ (double)wdata[i].f, (int)i, (double)rdata[i].f);
continue;
} /* end if */
- if(wdata[i].v.len!=rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(j=0; j<rdata[i].v.len; j++) {
- if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]);
+ for (j = 0; j < rdata[i].v.len; j++) {
+ if (((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",
+ (int)i, (int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].v.p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
ret = H5Treclaim(tid2, sid1, xfer_pid, rdata);
@@ -1599,9 +1632,13 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i].i != 0 || !H5_FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 || rdata[i].v.p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,(double)rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].i != 0 || !H5_FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 ||
+ rdata[i].v.p != NULL)
+ TestErrPrintf(
+ "VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",
+ (int)i, rdata[i].i, (int)i, (double)rdata[i].f, (int)i, (unsigned)rdata[i].v.len, (int)i,
+ rdata[i].v.p);
/* Write dataset to disk */
ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -1612,29 +1649,34 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(wdata[i].i != rdata[i].i) {
- TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].i != rdata[i].i) {
+ TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n", (int)i,
+ (int)wdata[i].i, (int)i, (int)rdata[i].i);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
- TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i].f, rdata[i].f)) {
+ TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n", (int)i,
+ (double)wdata[i].f, (int)i, (double)rdata[i].f);
continue;
} /* end if */
- if(wdata[i].v.len!=rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(j=0; j<rdata[i].v.len; j++) {
- if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]);
+ for (j = 0; j < rdata[i].v.len; j++) {
+ if (((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",
+ (int)i, (int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].v.p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,rdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
@@ -1642,7 +1684,7 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dclose");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close datatype */
@@ -1678,34 +1720,35 @@ test_vltypes_compound_vlen_atomic(void)
static void
rewrite_vltypes_compound_vlen_atomic(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
hvl_t v;
} s1;
- s1 wdata[SPACE1_DIM1]; /* Information to write */
- s1 rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- unsigned increment=4;
- herr_t ret; /* Generic return value */
+ s1 wdata[SPACE1_DIM1]; /* Information to write */
+ s1 rdata[SPACE1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 4;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
- MESSAGE(5, ("Checking memory leak for compound datatype with VL Atomic Datatype Component Functionality\n"));
+ MESSAGE(5,
+ ("Checking memory leak for compound datatype with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].i = (int)(i * 40);
- wdata[i].f = (float)(i * 50) / 3.0F;
- wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 40);
+ wdata[i].f = (float)(i * 50) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int));
wdata[i].v.len = i + increment;
- for(j = 0; j < (i + increment); j++)
+ for (j = 0; j < (i + increment); j++)
((unsigned int *)wdata[i].v.p)[j] = i * 60 + j;
} /* end for */
@@ -1745,7 +1788,8 @@ rewrite_vltypes_compound_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -1753,47 +1797,52 @@ rewrite_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 22 elements allocated = 4+5+6+7 elements for each array position */
- VERIFY(size, 22*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+ VERIFY(size, 22 * sizeof(unsigned int), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* 22 elements allocated = 4+5+6+7 elements for each array position */
- VERIFY(mem_used,22*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, 22 * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].i!=rdata[i].i) {
- TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].i != rdata[i].i) {
+ TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n", (int)i,
+ (int)wdata[i].i, (int)i, (int)rdata[i].i);
continue;
} /* end if */
- if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
- TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i].f, rdata[i].f)) {
+ TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n", (int)i,
+ (double)wdata[i].f, (int)i, (double)rdata[i].f);
continue;
} /* end if */
- if(wdata[i].v.len!=rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(j=0; j<rdata[i].v.len; j++) {
- if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]);
+ for (j = 0; j < rdata[i].v.len; j++) {
+ if (((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",
+ (int)i, (int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].v.p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Treclaim(tid2,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid2, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
@@ -1828,18 +1877,19 @@ rewrite_vltypes_compound_vlen_atomic(void)
** Tests VL datatype with VL datatypes of atomic datatypes.
**
****************************************************************/
-static size_t vlen_size_func(unsigned long n)
+static size_t
+vlen_size_func(unsigned long n)
{
- size_t u=1;
- size_t tmp=1;
- size_t result=1;
+ size_t u = 1;
+ size_t tmp = 1;
+ size_t result = 1;
- while(u<n) {
+ while (u < n) {
u++;
- tmp+=u;
- result+=tmp;
+ tmp += u;
+ result += tmp;
}
- return(result);
+ return (result);
}
/****************************************************************
@@ -1851,42 +1901,42 @@ static size_t vlen_size_func(unsigned long n)
static void
test_vltypes_vlen_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hvl_t *t1, *t2; /* Temporary pointer to VL information */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j,k; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hvl_t * t1, *t2; /* Temporary pointer to VL information */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j, k; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing VL Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+1)*sizeof(hvl_t));
- if(wdata[i].p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + 1) * sizeof(hvl_t));
+ if (wdata[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
- wdata[i].len=i+1;
- for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+1); j++, t1++) {
- t1->p=HDmalloc((j+1)*sizeof(unsigned int));
- if(t1->p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ wdata[i].len = i + 1;
+ for (t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + 1); j++, t1++) {
+ t1->p = HDmalloc((j + 1) * sizeof(unsigned int));
+ if (t1->p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return;
} /* end if */
- t1->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)t1->p)[k]=i*100+j*10+k;
+ t1->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)t1->p)[k] = i * 100 + j * 10 + k;
} /* end for */
- } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1897,11 +1947,11 @@ test_vltypes_vlen_vlen_atomic(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a VL datatype to refer to */
- tid1 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create the base VL type */
- tid2 = H5Tvlen_create (tid1);
+ tid2 = H5Tvlen_create(tid1);
CHECK(tid2, FAIL, "H5Tvlen_create");
/* Create a dataset */
@@ -1956,7 +2006,8 @@ test_vltypes_vlen_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory was used */
@@ -1965,7 +2016,10 @@ test_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
+ VERIFY(size,
+ (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) +
+ vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)),
+ "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
@@ -1974,37 +2028,43 @@ test_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used, (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dread");
+ VERIFY(mem_used,
+ (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) +
+ vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)),
+ "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(t1=(hvl_t *)wdata[i].p, t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) {
- if(t1->len!=t2->len) {
- TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
+ for (t1 = (hvl_t *)wdata[i].p, t2 = (hvl_t *)(rdata[i].p), j = 0; j < rdata[i].len; j++, t1++, t2++) {
+ if (t1->len != t2->len) {
+ TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",
+ __LINE__, (int)i, (int)j, (int)t1->len, (int)t2->len);
continue;
} /* end if */
- for(k=0; k<t2->len; k++) {
- if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) {
- TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
+ for (k = 0; k < t2->len; k++) {
+ if (((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k]) {
+ TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n", (int)k,
+ (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim all the (nested) VL data */
- ret=H5Treclaim(tid2,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid2, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
@@ -2042,42 +2102,42 @@ test_vltypes_vlen_vlen_atomic(void)
static void
rewrite_longer_vltypes_vlen_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hvl_t *t1, *t2; /* Temporary pointer to VL information */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j,k; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- unsigned increment=1;
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hvl_t * t1, *t2; /* Temporary pointer to VL information */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j, k; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 1;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Check memory leak for VL Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
wdata[i].p = HDmalloc((i + increment) * sizeof(hvl_t));
- if(wdata[i].p == NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ if (wdata[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
wdata[i].len = i + increment;
- for(t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + increment); j++, t1++) {
+ for (t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + increment); j++, t1++) {
t1->p = HDmalloc((j + 1) * sizeof(unsigned int));
- if(t1->p == NULL) {
+ if (t1->p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return;
} /* end if */
t1->len = j + 1;
- for(k = 0; k < (j + 1); k++)
+ for (k = 0; k < (j + 1); k++)
((unsigned int *)t1->p)[k] = i * 1000 + j * 100 + k * 10;
} /* end for */
- } /* end for */
+ } /* end for */
/* Open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -2115,7 +2175,6 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file for data checking */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -2136,7 +2195,8 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory was used */
@@ -2157,34 +2217,38 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
/*VERIFY(mem_used,18*sizeof(hvl_t)+52*sizeof(unsigned int),"H5Dread");*/
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(t1=(hvl_t *)(wdata[i].p), t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) {
- if(t1->len!=t2->len) {
- TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
+ for (t1 = (hvl_t *)(wdata[i].p), t2 = (hvl_t *)(rdata[i].p), j = 0; j < rdata[i].len;
+ j++, t1++, t2++) {
+ if (t1->len != t2->len) {
+ TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",
+ __LINE__, (int)i, (int)j, (int)t1->len, (int)t2->len);
continue;
} /* end if */
- for(k=0; k<t2->len; k++) {
- if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) {
- TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
+ for (k = 0; k < t2->len; k++) {
+ if (((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k]) {
+ TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n", (int)k,
+ (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim all the (nested) VL data */
- ret=H5Treclaim(tid2,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid2, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
@@ -2218,42 +2282,42 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
static void
rewrite_shorter_vltypes_vlen_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hvl_t *t1, *t2; /* Temporary pointer to VL information */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j,k; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- unsigned increment=1;
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hvl_t * t1, *t2; /* Temporary pointer to VL information */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j, k; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 1;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Check memory leak for VL Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+increment)*sizeof(hvl_t));
- if(wdata[i].p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + increment) * sizeof(hvl_t));
+ if (wdata[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
- wdata[i].len=i+increment;
- for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+increment); j++, t1++) {
- t1->p=HDmalloc((j+1)*sizeof(unsigned int));
- if(t1->p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ wdata[i].len = i + increment;
+ for (t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + increment); j++, t1++) {
+ t1->p = HDmalloc((j + 1) * sizeof(unsigned int));
+ if (t1->p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return;
} /* end if */
- t1->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)t1->p)[k]=i*100000+j*1000+k*10;
+ t1->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)t1->p)[k] = i * 100000 + j * 1000 + k * 10;
} /* end for */
- } /* end for */
+ } /* end for */
/* Open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -2291,7 +2355,6 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file for data checking */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -2312,7 +2375,8 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory was used */
@@ -2321,46 +2385,56 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, (hsize_t)(((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
+ VERIFY(size,
+ (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) +
+ vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)),
+ "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used, (size_t)(((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int)),"H5Dread");
+ VERIFY(mem_used,
+ (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) +
+ vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)),
+ "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(t1=(hvl_t *)(wdata[i].p), t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) {
- if(t1->len!=t2->len) {
- TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
+ for (t1 = (hvl_t *)(wdata[i].p), t2 = (hvl_t *)(rdata[i].p), j = 0; j < rdata[i].len;
+ j++, t1++, t2++) {
+ if (t1->len != t2->len) {
+ TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",
+ __LINE__, (int)i, (int)j, (int)t1->len, (int)t2->len);
continue;
} /* end if */
- for(k=0; k<t2->len; k++) {
- if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) {
- TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
+ for (k = 0; k < t2->len; k++) {
+ if (((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k]) {
+ TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n", (int)k,
+ (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim all the (nested) VL data */
- ret=H5Treclaim(tid2,sid1,xfer_pid,rdata);
+ ret = H5Treclaim(tid2, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Treclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
@@ -2396,52 +2470,55 @@ static void
test_vltypes_fill_value(void)
{
typedef struct dtype1_struct {
- unsigned int gui;
- unsigned int pgui;
- const char *str_id;
- const char *str_name;
- const char *str_desc;
- const char *str_orig;
- const char *str_stat;
- unsigned int ver;
- double val;
- double ma;
- double mi;
- const char *str_form;
- const char *str_unit;
+ unsigned int gui;
+ unsigned int pgui;
+ const char * str_id;
+ const char * str_name;
+ const char * str_desc;
+ const char * str_orig;
+ const char * str_stat;
+ unsigned int ver;
+ double val;
+ double ma;
+ double mi;
+ const char * str_form;
+ const char * str_unit;
} dtype1_struct;
- herr_t ret;
- hid_t file_id;
- hid_t dtype1_id = -1;
- hid_t str_id = -1;
- hid_t small_dspace_id; /* Dataspace ID for small datasets */
- hid_t large_dspace_id; /* Dataspace ID for large datasets */
- hid_t small_select_dspace_id; /* Dataspace ID for selection in small datasets */
- hid_t large_select_dspace_id; /* Dataspace ID for selection in large datasets */
- hid_t dset_dspace_id; /* Dataspace ID for a particular dataset */
- hid_t dset_select_dspace_id; /* Dataspace ID for selection in a particular dataset */
- hid_t scalar_dspace_id; /* Dataspace ID for scalar dataspace */
- hid_t single_dspace_id; /* Dataspace ID for single element selection */
- hsize_t single_offset[] = {2}; /* Offset of single element selection */
- hsize_t single_block[] = {1}; /* Block size of single element selection */
- hsize_t select_offset[] = {0}; /* Offset of non-contiguous element selection */
- hsize_t select_stride[] = {2}; /* Stride size of non-contiguous element selection */
- hsize_t small_select_count[] = {SPACE4_DIM_SMALL / 2}; /* Count of small non-contiguous element selection */
- hsize_t large_select_count[] = {SPACE4_DIM_LARGE / 2}; /* Count of large non-contiguous element selection */
- hsize_t select_block[] = {1}; /* Block size of non-contiguous element selection */
- hid_t dcpl_id, xfer_pid;
- hid_t dset_id;
- hsize_t small_dims[] = {SPACE4_DIM_SMALL};
- hsize_t large_dims[] = {SPACE4_DIM_LARGE};
- size_t dset_elmts; /* Number of elements in a particular dataset */
- const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"};
+ herr_t ret;
+ hid_t file_id;
+ hid_t dtype1_id = -1;
+ hid_t str_id = -1;
+ hid_t small_dspace_id; /* Dataspace ID for small datasets */
+ hid_t large_dspace_id; /* Dataspace ID for large datasets */
+ hid_t small_select_dspace_id; /* Dataspace ID for selection in small datasets */
+ hid_t large_select_dspace_id; /* Dataspace ID for selection in large datasets */
+ hid_t dset_dspace_id; /* Dataspace ID for a particular dataset */
+ hid_t dset_select_dspace_id; /* Dataspace ID for selection in a particular dataset */
+ hid_t scalar_dspace_id; /* Dataspace ID for scalar dataspace */
+ hid_t single_dspace_id; /* Dataspace ID for single element selection */
+ hsize_t single_offset[] = {2}; /* Offset of single element selection */
+ hsize_t single_block[] = {1}; /* Block size of single element selection */
+ hsize_t select_offset[] = {0}; /* Offset of non-contiguous element selection */
+ hsize_t select_stride[] = {2}; /* Stride size of non-contiguous element selection */
+ hsize_t small_select_count[] = {SPACE4_DIM_SMALL /
+ 2}; /* Count of small non-contiguous element selection */
+ hsize_t large_select_count[] = {SPACE4_DIM_LARGE /
+ 2}; /* Count of large non-contiguous element selection */
+ hsize_t select_block[] = {1}; /* Block size of non-contiguous element selection */
+ hid_t dcpl_id, xfer_pid;
+ hid_t dset_id;
+ hsize_t small_dims[] = {SPACE4_DIM_SMALL};
+ hsize_t large_dims[] = {SPACE4_DIM_LARGE};
+ size_t dset_elmts; /* Number of elements in a particular dataset */
+ const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead",
+ 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"};
const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0F, 200.0F, 2.0F, "solid", "yard"};
- dtype1_struct *rbuf = NULL; /* Buffer for reading data */
- size_t mem_used = 0; /* Memory used during allocation */
- H5D_layout_t layout; /* Dataset storage layout */
- char dset_name1[64], dset_name2[64]; /* Dataset names */
- unsigned i;
+ dtype1_struct * rbuf = NULL; /* Buffer for reading data */
+ size_t mem_used = 0; /* Memory used during allocation */
+ H5D_layout_t layout; /* Dataset storage layout */
+ char dset_name1[64], dset_name2[64]; /* Dataset names */
+ unsigned i;
/* Output message about test being performed */
MESSAGE(5, ("Check fill value for VL data\n"));
@@ -2449,62 +2526,60 @@ test_vltypes_fill_value(void)
/* Create a string datatype */
str_id = H5Tcopy(H5T_C_S1);
CHECK(str_id, FAIL, "H5Tcopy");
- ret = H5Tset_size(str_id,H5T_VARIABLE);
+ ret = H5Tset_size(str_id, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
/* Create a compound data type */
dtype1_id = H5Tcreate(H5T_COMPOUND, sizeof(struct dtype1_struct));
CHECK(dtype1_id, FAIL, "H5Tcreate");
- ret = H5Tinsert(dtype1_id,"guid",HOFFSET(struct dtype1_struct,gui),H5T_NATIVE_UINT);
+ ret = H5Tinsert(dtype1_id, "guid", HOFFSET(struct dtype1_struct, gui), H5T_NATIVE_UINT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"pguid",HOFFSET(struct dtype1_struct,pgui),H5T_NATIVE_UINT);
+ ret = H5Tinsert(dtype1_id, "pguid", HOFFSET(struct dtype1_struct, pgui), H5T_NATIVE_UINT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_id",HOFFSET(dtype1_struct,str_id),str_id);
+ ret = H5Tinsert(dtype1_id, "str_id", HOFFSET(dtype1_struct, str_id), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_name",HOFFSET(dtype1_struct,str_name),str_id);
+ ret = H5Tinsert(dtype1_id, "str_name", HOFFSET(dtype1_struct, str_name), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_desc",HOFFSET(dtype1_struct,str_desc),str_id);
+ ret = H5Tinsert(dtype1_id, "str_desc", HOFFSET(dtype1_struct, str_desc), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_orig",HOFFSET(dtype1_struct,str_orig),str_id);
+ ret = H5Tinsert(dtype1_id, "str_orig", HOFFSET(dtype1_struct, str_orig), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_stat",HOFFSET(dtype1_struct,str_stat),str_id);
+ ret = H5Tinsert(dtype1_id, "str_stat", HOFFSET(dtype1_struct, str_stat), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"ver",HOFFSET(struct dtype1_struct,ver),H5T_NATIVE_UINT);
+ ret = H5Tinsert(dtype1_id, "ver", HOFFSET(struct dtype1_struct, ver), H5T_NATIVE_UINT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"val",HOFFSET(struct dtype1_struct,val),H5T_NATIVE_DOUBLE);
+ ret = H5Tinsert(dtype1_id, "val", HOFFSET(struct dtype1_struct, val), H5T_NATIVE_DOUBLE);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"ma",HOFFSET(struct dtype1_struct,ma),H5T_NATIVE_DOUBLE);
+ ret = H5Tinsert(dtype1_id, "ma", HOFFSET(struct dtype1_struct, ma), H5T_NATIVE_DOUBLE);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"mi",HOFFSET(struct dtype1_struct,mi),H5T_NATIVE_DOUBLE);
+ ret = H5Tinsert(dtype1_id, "mi", HOFFSET(struct dtype1_struct, mi), H5T_NATIVE_DOUBLE);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_form",HOFFSET(dtype1_struct,str_form),str_id);
+ ret = H5Tinsert(dtype1_id, "str_form", HOFFSET(dtype1_struct, str_form), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_unit",HOFFSET(dtype1_struct,str_unit),str_id);
+ ret = H5Tinsert(dtype1_id, "str_unit", HOFFSET(dtype1_struct, str_unit), str_id);
CHECK(ret, FAIL, "H5Tinsert");
/* Close string datatype */
ret = H5Tclose(str_id);
CHECK(ret, FAIL, "H5Tclose");
-
/* Allocate space for the buffer to read data */
rbuf = (dtype1_struct *)HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct));
CHECK_PTR(rbuf, "HDmalloc");
-
/* Create the small & large dataspaces to use */
small_dspace_id = H5Screate_simple(SPACE4_RANK, small_dims, NULL);
CHECK(small_dspace_id, FAIL, "H5Screate_simple");
@@ -2516,15 +2591,15 @@ test_vltypes_fill_value(void)
small_select_dspace_id = H5Scopy(small_dspace_id);
CHECK(small_select_dspace_id, FAIL, "H5Scopy");
- ret = H5Sselect_hyperslab(small_select_dspace_id, H5S_SELECT_SET,
- select_offset, select_stride, small_select_count, select_block);
+ ret = H5Sselect_hyperslab(small_select_dspace_id, H5S_SELECT_SET, select_offset, select_stride,
+ small_select_count, select_block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
large_select_dspace_id = H5Scopy(large_dspace_id);
CHECK(large_select_dspace_id, FAIL, "H5Scopy");
- ret = H5Sselect_hyperslab(large_select_dspace_id, H5S_SELECT_SET,
- select_offset, select_stride, large_select_count, select_block);
+ ret = H5Sselect_hyperslab(large_select_dspace_id, H5S_SELECT_SET, select_offset, select_stride,
+ large_select_count, select_block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a scalar dataspace */
@@ -2543,32 +2618,32 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fcreate");
/* Create datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
- unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
- unsigned test_loop; /* Loop over datasets */
+ for (layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
+ unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
+ unsigned test_loop; /* Loop over datasets */
#ifdef H5_HAVE_FILTER_DEFLATE
- if(layout == H5D_CHUNKED)
+ if (layout == H5D_CHUNKED)
compress_loop = 2;
else
#endif /* H5_HAVE_FILTER_DEFLATE */
compress_loop = 1;
/* Loop over dataset operations */
- for(test_loop = 0; test_loop < compress_loop; test_loop++) {
- hid_t tmp_dcpl_id; /* Temporary copy of the dataset creation property list */
+ for (test_loop = 0; test_loop < compress_loop; test_loop++) {
+ hid_t tmp_dcpl_id; /* Temporary copy of the dataset creation property list */
/* Make a copy of the dataset creation property list */
tmp_dcpl_id = H5Pcopy(dcpl_id);
CHECK(tmp_dcpl_id, FAIL, "H5Pcopy");
/* Layout specific actions */
- switch(layout) {
+ switch (layout) {
case H5D_COMPACT:
HDstrcpy(dset_name1, "dataset1-compact");
HDstrcpy(dset_name2, "dataset2-compact");
dset_dspace_id = small_dspace_id;
- ret = H5Pset_layout(tmp_dcpl_id, H5D_COMPACT);
+ ret = H5Pset_layout(tmp_dcpl_id, H5D_COMPACT);
CHECK(ret, FAIL, "H5Pset_layout");
break;
@@ -2578,29 +2653,27 @@ test_vltypes_fill_value(void)
dset_dspace_id = large_dspace_id;
break;
- case H5D_CHUNKED:
- {
- hsize_t chunk_dims[1] = {SPACE4_DIM_LARGE / 4};
+ case H5D_CHUNKED: {
+ hsize_t chunk_dims[1] = {SPACE4_DIM_LARGE / 4};
- dset_dspace_id = large_dspace_id;
- ret = H5Pset_chunk(tmp_dcpl_id, 1, chunk_dims);
- CHECK(ret, FAIL, "H5Pset_chunk");
+ dset_dspace_id = large_dspace_id;
+ ret = H5Pset_chunk(tmp_dcpl_id, 1, chunk_dims);
+ CHECK(ret, FAIL, "H5Pset_chunk");
#ifdef H5_HAVE_FILTER_DEFLATE
- if(test_loop == 1) {
- HDstrcpy(dset_name1, "dataset1-chunked-compressed");
- HDstrcpy(dset_name2, "dataset2-chunked-compressed");
- ret = H5Pset_deflate(tmp_dcpl_id, 3);
- CHECK(ret, FAIL, "H5Pset_deflate");
- } /* end if */
- else {
+ if (test_loop == 1) {
+ HDstrcpy(dset_name1, "dataset1-chunked-compressed");
+ HDstrcpy(dset_name2, "dataset2-chunked-compressed");
+ ret = H5Pset_deflate(tmp_dcpl_id, 3);
+ CHECK(ret, FAIL, "H5Pset_deflate");
+ } /* end if */
+ else {
#endif /* H5_HAVE_FILTER_DEFLATE */
- HDstrcpy(dset_name1, "dataset1-chunked");
- HDstrcpy(dset_name2, "dataset2-chunked");
+ HDstrcpy(dset_name1, "dataset1-chunked");
+ HDstrcpy(dset_name2, "dataset2-chunked");
#ifdef H5_HAVE_FILTER_DEFLATE
- } /* end else */
-#endif /* H5_HAVE_FILTER_DEFLATE */
- }
- break;
+ } /* end else */
+#endif /* H5_HAVE_FILTER_DEFLATE */
+ } break;
case H5D_VIRTUAL:
assert(0 && "Invalid layout type!");
@@ -2614,13 +2687,13 @@ test_vltypes_fill_value(void)
} /* end switch */
/* Create first data set with default setting - no space is allocated */
- dset_id = H5Dcreate2(file_id, dset_name1, dtype1_id, dset_dspace_id, H5P_DEFAULT, tmp_dcpl_id, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, dset_name1, dtype1_id, dset_dspace_id, H5P_DEFAULT, tmp_dcpl_id,
+ H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
-
/* Create a second data set with space allocated and fill value written */
ret = H5Pset_fill_time(tmp_dcpl_id, H5D_FILL_TIME_IFSET);
CHECK(ret, FAIL, "H5Pset_fill_time");
@@ -2628,7 +2701,8 @@ test_vltypes_fill_value(void)
ret = H5Pset_alloc_time(tmp_dcpl_id, H5D_ALLOC_TIME_EARLY);
CHECK(ret, FAIL, "H5Pset_alloc_time");
- dset_id = H5Dcreate2(file_id, dset_name2, dtype1_id, dset_dspace_id, H5P_DEFAULT, tmp_dcpl_id, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, dset_name2, dtype1_id, dset_dspace_id, H5P_DEFAULT, tmp_dcpl_id,
+ H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
ret = H5Dclose(dset_id);
@@ -2638,7 +2712,7 @@ test_vltypes_fill_value(void)
ret = H5Pclose(tmp_dcpl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end for */
- } /* end for */
+ } /* end for */
ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
@@ -2646,12 +2720,12 @@ test_vltypes_fill_value(void)
ret = H5Pclose(dcpl_id);
CHECK(ret, FAIL, "H5Pclose");
-
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Open the file to check data set value */
@@ -2659,41 +2733,41 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fopen");
/* Read empty datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
- unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
- unsigned test_loop; /* Loop over datasets */
+ for (layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
+ unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
+ unsigned test_loop; /* Loop over datasets */
#ifdef H5_HAVE_FILTER_DEFLATE
- if(layout == H5D_CHUNKED)
+ if (layout == H5D_CHUNKED)
compress_loop = 2;
else
#endif /* H5_HAVE_FILTER_DEFLATE */
compress_loop = 1;
/* Loop over dataset operations */
- for(test_loop = 0; test_loop < compress_loop; test_loop++) {
+ for (test_loop = 0; test_loop < compress_loop; test_loop++) {
/* Layout specific actions */
- switch(layout) {
+ switch (layout) {
case H5D_COMPACT:
HDstrcpy(dset_name1, "dataset1-compact");
HDstrcpy(dset_name2, "dataset2-compact");
- dset_dspace_id = small_dspace_id;
+ dset_dspace_id = small_dspace_id;
dset_select_dspace_id = small_select_dspace_id;
- dset_elmts = SPACE4_DIM_SMALL;
+ dset_elmts = SPACE4_DIM_SMALL;
break;
case H5D_CONTIGUOUS:
HDstrcpy(dset_name1, "dataset1-contig");
HDstrcpy(dset_name2, "dataset2-contig");
- dset_dspace_id = large_dspace_id;
+ dset_dspace_id = large_dspace_id;
dset_select_dspace_id = large_select_dspace_id;
- dset_elmts = SPACE4_DIM_LARGE;
+ dset_elmts = SPACE4_DIM_LARGE;
break;
case H5D_CHUNKED:
#ifdef H5_HAVE_FILTER_DEFLATE
- if(test_loop == 1) {
+ if (test_loop == 1) {
HDstrcpy(dset_name1, "dataset1-chunked-compressed");
HDstrcpy(dset_name2, "dataset2-chunked-compressed");
} /* end if */
@@ -2703,10 +2777,10 @@ test_vltypes_fill_value(void)
HDstrcpy(dset_name2, "dataset2-chunked");
#ifdef H5_HAVE_FILTER_DEFLATE
} /* end else */
-#endif /* H5_HAVE_FILTER_DEFLATE */
- dset_dspace_id = large_dspace_id;
+#endif /* H5_HAVE_FILTER_DEFLATE */
+ dset_dspace_id = large_dspace_id;
dset_select_dspace_id = large_select_dspace_id;
- dset_elmts = SPACE4_DIM_LARGE;
+ dset_elmts = SPACE4_DIM_LARGE;
break;
case H5D_VIRTUAL:
@@ -2729,18 +2803,15 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ for (i = 0; i < dset_elmts; i++) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Release the space */
ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2754,28 +2825,24 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if((i % 2) == select_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ for (i = 0; i < dset_elmts; i++) {
+ if ((i % 2) == select_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc
- || rbuf[i].str_orig || rbuf[i].str_stat
- || rbuf[i].str_form || rbuf[i].str_unit) {
+ if (rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc || rbuf[i].str_orig ||
+ rbuf[i].str_stat || rbuf[i].str_form || rbuf[i].str_unit) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end for */
/* Release the space */
ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2784,7 +2851,6 @@ test_vltypes_fill_value(void)
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
-
/* Open the second data set to check the value of data */
dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dopen2");
@@ -2794,18 +2860,15 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Release the space */
ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2819,28 +2882,24 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if((i % 2) == select_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ for (i = 0; i < dset_elmts; i++) {
+ if ((i % 2) == select_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc
- || rbuf[i].str_orig || rbuf[i].str_stat
- || rbuf[i].str_form || rbuf[i].str_unit) {
+ if (rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc || rbuf[i].str_orig ||
+ rbuf[i].str_stat || rbuf[i].str_form || rbuf[i].str_unit) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end for */
/* Release the space */
ret = H5Treclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
@@ -2849,52 +2908,51 @@ test_vltypes_fill_value(void)
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
} /* end for */
- } /* end for */
+ } /* end for */
ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file to check data set value */
file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(file_id, FAIL, "H5Fopen");
/* Write one element & fill values to datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
- unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
- unsigned test_loop; /* Loop over datasets */
+ for (layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
+ unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
+ unsigned test_loop; /* Loop over datasets */
#ifdef H5_HAVE_FILTER_DEFLATE
- if(layout == H5D_CHUNKED)
+ if (layout == H5D_CHUNKED)
compress_loop = 2;
else
#endif /* H5_HAVE_FILTER_DEFLATE */
compress_loop = 1;
/* Loop over dataset operations */
- for(test_loop = 0; test_loop < compress_loop; test_loop++) {
+ for (test_loop = 0; test_loop < compress_loop; test_loop++) {
/* Layout specific actions */
- switch(layout) {
+ switch (layout) {
case H5D_COMPACT:
HDstrcpy(dset_name1, "dataset1-compact");
HDstrcpy(dset_name2, "dataset2-compact");
- dset_dspace_id = small_dspace_id;
+ dset_dspace_id = small_dspace_id;
dset_select_dspace_id = small_select_dspace_id;
- dset_elmts = SPACE4_DIM_SMALL;
+ dset_elmts = SPACE4_DIM_SMALL;
break;
case H5D_CONTIGUOUS:
HDstrcpy(dset_name1, "dataset1-contig");
HDstrcpy(dset_name2, "dataset2-contig");
- dset_dspace_id = large_dspace_id;
+ dset_dspace_id = large_dspace_id;
dset_select_dspace_id = large_select_dspace_id;
- dset_elmts = SPACE4_DIM_LARGE;
+ dset_elmts = SPACE4_DIM_LARGE;
break;
case H5D_CHUNKED:
#ifdef H5_HAVE_FILTER_DEFLATE
- if(test_loop == 1) {
+ if (test_loop == 1) {
HDstrcpy(dset_name1, "dataset1-chunked-compressed");
HDstrcpy(dset_name2, "dataset2-chunked-compressed");
} /* end if */
@@ -2904,10 +2962,10 @@ test_vltypes_fill_value(void)
HDstrcpy(dset_name2, "dataset2-chunked");
#ifdef H5_HAVE_FILTER_DEFLATE
} /* end else */
-#endif /* H5_HAVE_FILTER_DEFLATE */
- dset_dspace_id = large_dspace_id;
+#endif /* H5_HAVE_FILTER_DEFLATE */
+ dset_dspace_id = large_dspace_id;
dset_select_dspace_id = large_select_dspace_id;
- dset_elmts = SPACE4_DIM_LARGE;
+ dset_elmts = SPACE4_DIM_LARGE;
break;
case H5D_VIRTUAL:
@@ -2926,8 +2984,8 @@ test_vltypes_fill_value(void)
CHECK(single_dspace_id, FAIL, "H5Scopy");
/* Set a single element in the dataspace */
- ret = H5Sselect_hyperslab(single_dspace_id, H5S_SELECT_SET, single_offset,
- NULL, single_block, NULL);
+ ret = H5Sselect_hyperslab(single_dspace_id, H5S_SELECT_SET, single_offset, NULL, single_block,
+ NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Open first data set */
@@ -2942,32 +3000,28 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(i == single_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, wdata.str_id)
- || rbuf[i].str_name
- || HDstrcmp(rbuf[i].str_desc, wdata.str_desc)
- || HDstrcmp(rbuf[i].str_orig, wdata.str_orig)
- || HDstrcmp(rbuf[i].str_stat, wdata.str_stat)
- || HDstrcmp(rbuf[i].str_form, wdata.str_form)
- || HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (i == single_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name ||
+ HDstrcmp(rbuf[i].str_desc, wdata.str_desc) ||
+ HDstrcmp(rbuf[i].str_orig, wdata.str_orig) ||
+ HDstrcmp(rbuf[i].str_stat, wdata.str_stat) ||
+ HDstrcmp(rbuf[i].str_form, wdata.str_form) ||
+ HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig,"\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
/* Release the space */
ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2981,42 +3035,37 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(i == single_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, wdata.str_id)
- || rbuf[i].str_name
- || HDstrcmp(rbuf[i].str_desc, wdata.str_desc)
- || HDstrcmp(rbuf[i].str_orig, wdata.str_orig)
- || HDstrcmp(rbuf[i].str_stat, wdata.str_stat)
- || HDstrcmp(rbuf[i].str_form, wdata.str_form)
- || HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (i == single_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name ||
+ HDstrcmp(rbuf[i].str_desc, wdata.str_desc) ||
+ HDstrcmp(rbuf[i].str_orig, wdata.str_orig) ||
+ HDstrcmp(rbuf[i].str_stat, wdata.str_stat) ||
+ HDstrcmp(rbuf[i].str_form, wdata.str_form) ||
+ HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if((i % 2) == select_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ if ((i % 2) == select_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc
- || rbuf[i].str_orig || rbuf[i].str_stat
- || rbuf[i].str_form || rbuf[i].str_unit) {
+ if (rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc || rbuf[i].str_orig ||
+ rbuf[i].str_stat || rbuf[i].str_form || rbuf[i].str_unit) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end else */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end else */
+ } /* end for */
/* Release the space */
ret = H5Treclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
@@ -3025,7 +3074,6 @@ test_vltypes_fill_value(void)
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
-
/* Open the second data set to check the value of data */
dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dopen2");
@@ -3038,32 +3086,28 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(i == single_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, wdata.str_id)
- || rbuf[i].str_name
- || HDstrcmp(rbuf[i].str_desc, wdata.str_desc)
- || HDstrcmp(rbuf[i].str_orig, wdata.str_orig)
- || HDstrcmp(rbuf[i].str_stat, wdata.str_stat)
- || HDstrcmp(rbuf[i].str_form, wdata.str_form)
- || HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (i == single_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name ||
+ HDstrcmp(rbuf[i].str_desc, wdata.str_desc) ||
+ HDstrcmp(rbuf[i].str_orig, wdata.str_orig) ||
+ HDstrcmp(rbuf[i].str_stat, wdata.str_stat) ||
+ HDstrcmp(rbuf[i].str_form, wdata.str_form) ||
+ HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig,"\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
/* Release the space */
ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -3077,42 +3121,37 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(i == single_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, wdata.str_id)
- || rbuf[i].str_name
- || HDstrcmp(rbuf[i].str_desc, wdata.str_desc)
- || HDstrcmp(rbuf[i].str_orig, wdata.str_orig)
- || HDstrcmp(rbuf[i].str_stat, wdata.str_stat)
- || HDstrcmp(rbuf[i].str_form, wdata.str_form)
- || HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (i == single_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name ||
+ HDstrcmp(rbuf[i].str_desc, wdata.str_desc) ||
+ HDstrcmp(rbuf[i].str_orig, wdata.str_orig) ||
+ HDstrcmp(rbuf[i].str_stat, wdata.str_stat) ||
+ HDstrcmp(rbuf[i].str_form, wdata.str_form) ||
+ HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if((i % 2) == select_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ if ((i % 2) == select_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc
- || rbuf[i].str_orig || rbuf[i].str_stat
- || rbuf[i].str_form || rbuf[i].str_unit) {
+ if (rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc || rbuf[i].str_orig ||
+ rbuf[i].str_stat || rbuf[i].str_form || rbuf[i].str_unit) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end else */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end else */
+ } /* end for */
/* Release the space */
ret = H5Treclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
@@ -3125,12 +3164,11 @@ test_vltypes_fill_value(void)
ret = H5Sclose(single_dspace_id);
CHECK(ret, FAIL, "H5Sclose");
} /* end for */
- } /* end for */
+ } /* end for */
ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
-
/* Clean up rest of IDs */
ret = H5Pclose(xfer_pid);
CHECK(ret, FAIL, "H5Pclose");
@@ -3169,23 +3207,22 @@ test_vltypes(void)
MESSAGE(5, ("Testing Variable-Length Datatypes\n"));
/* These next tests use the same file */
- test_vltypes_dataset_create(); /* Check dataset of VL when fill value
- * won't be rewritten to it.*/
- test_vltypes_funcs(); /* Test functions with VL types */
- test_vltypes_vlen_atomic(); /* Test VL atomic datatypes */
- rewrite_vltypes_vlen_atomic(); /* Check VL memory leak */
- test_vltypes_vlen_compound(); /* Test VL compound datatypes */
- rewrite_vltypes_vlen_compound(); /* Check VL memory leak */
- test_vltypes_compound_vlen_atomic(); /* Test compound datatypes with VL atomic components */
- rewrite_vltypes_compound_vlen_atomic();/* Check VL memory leak */
- test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */
+ test_vltypes_dataset_create(); /* Check dataset of VL when fill value
+ * won't be rewritten to it.*/
+ test_vltypes_funcs(); /* Test functions with VL types */
+ test_vltypes_vlen_atomic(); /* Test VL atomic datatypes */
+ rewrite_vltypes_vlen_atomic(); /* Check VL memory leak */
+ test_vltypes_vlen_compound(); /* Test VL compound datatypes */
+ rewrite_vltypes_vlen_compound(); /* Check VL memory leak */
+ test_vltypes_compound_vlen_atomic(); /* Test compound datatypes with VL atomic components */
+ rewrite_vltypes_compound_vlen_atomic(); /* Check VL memory leak */
+ test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */
rewrite_longer_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of longer sequence*/
- rewrite_shorter_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of shorted sequence*/
- test_vltypes_compound_vlen_vlen();/* Test compound datatypes with VL atomic components */
- test_vltypes_compound_vlstr(); /* Test data rewritten of nested VL data */
- test_vltypes_fill_value(); /* Test fill value for VL data */
-} /* test_vltypes() */
-
+ rewrite_shorter_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of shorted sequence*/
+ test_vltypes_compound_vlen_vlen(); /* Test compound datatypes with VL atomic components */
+ test_vltypes_compound_vlstr(); /* Test data rewritten of nested VL data */
+ test_vltypes_fill_value(); /* Test fill value for VL data */
+} /* test_vltypes() */
/*-------------------------------------------------------------------------
* Function: cleanup_vltypes
diff --git a/test/twriteorder.c b/test/twriteorder.c
index 04f3bc5..83a615c 100644
--- a/test/twriteorder.c
+++ b/test/twriteorder.c
@@ -11,52 +11,52 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: twriteorder
-*
-* Test to verify that the write order is strictly consistent.
-* The SWMR feature requires that the order of write is strictly consistent.
-* "Strict consistency in computer science is the most stringent consistency
-* model. It says that a read operation has to return the result of the
-* latest write operation which occurred on that data item."--
-* (http://en.wikipedia.org/wiki/Linearizability#Definition_of_linearizability).
-* This is also an alternative form of what POSIX write require that after a
-* write operation has returned success, all reads issued afterward should
-* get the same data the write has written.
-*
-* Created: Albert Cheng, 2013/8/28.
-*************************************************************/
+ *
+ * Test program: twriteorder
+ *
+ * Test to verify that the write order is strictly consistent.
+ * The SWMR feature requires that the order of write is strictly consistent.
+ * "Strict consistency in computer science is the most stringent consistency
+ * model. It says that a read operation has to return the result of the
+ * latest write operation which occurred on that data item."--
+ * (http://en.wikipedia.org/wiki/Linearizability#Definition_of_linearizability).
+ * This is also an alternative form of what POSIX write require that after a
+ * write operation has returned success, all reads issued afterward should
+ * get the same data the write has written.
+ *
+ * Created: Albert Cheng, 2013/8/28.
+ *************************************************************/
/***********************************************************
-*
-* Algorithm
-*
-* The test simulates what SWMR does by writing chained blocks and see if
-* they can be read back correctly.
-* There is a writer process and multiple read processes.
-* The file is divided into 2KB partitions. Then writer writes 1 chained
-* block, each of 1KB big, in each partition after the first partition.
-* Each chained block has this structure:
-* Byte 0-3: offset address of its child block. The last child uses 0 as NULL.
-* Byte 4-1023: some artificial data.
-* The child block address of Block 1 is NULL (0).
-* The child block address of Block 2 is the offset address of Block 1.
-* The child block address of Block n is the offset address of Block n-1.
-* After all n blocks are written, the offset address of Block n is written
-* to the offset 0 of the first partition.
-* Therefore, by the time the offset address of Block n is written to this
-* position, all n chain-linked blocks have been written.
-*
-* The other reader processes will try to read the address value at the
-* offset 0. The value is initially NULL(0). When it changes to non-zero,
-* it signifies the writer process has written all the chain-link blocks
-* and they are ready for the reader processes to access.
-*
-* If the system, in which the writer and reader processes run, the readers
-* will always get all chain-linked blocks correctly. If the order of write
-* is not maintained, some reader processes may found unexpect block data.
-*
-*************************************************************/
+ *
+ * Algorithm
+ *
+ * The test simulates what SWMR does by writing chained blocks and see if
+ * they can be read back correctly.
+ * There is a writer process and multiple read processes.
+ * The file is divided into 2KB partitions. Then writer writes 1 chained
+ * block, each of 1KB big, in each partition after the first partition.
+ * Each chained block has this structure:
+ * Byte 0-3: offset address of its child block. The last child uses 0 as NULL.
+ * Byte 4-1023: some artificial data.
+ * The child block address of Block 1 is NULL (0).
+ * The child block address of Block 2 is the offset address of Block 1.
+ * The child block address of Block n is the offset address of Block n-1.
+ * After all n blocks are written, the offset address of Block n is written
+ * to the offset 0 of the first partition.
+ * Therefore, by the time the offset address of Block n is written to this
+ * position, all n chain-linked blocks have been written.
+ *
+ * The other reader processes will try to read the address value at the
+ * offset 0. The value is initially NULL(0). When it changes to non-zero,
+ * it signifies the writer process has written all the chain-link blocks
+ * and they are ready for the reader processes to access.
+ *
+ * If the system, in which the writer and reader processes run, the readers
+ * will always get all chain-linked blocks correctly. If the order of write
+ * is not maintained, some reader processes may found unexpect block data.
+ *
+ *************************************************************/
#include "h5test.h"
@@ -67,34 +67,38 @@
*/
#ifdef H5_HAVE_FORK
-#define DATAFILE "twriteorder.dat"
-/* #define READERS_MAX 10 */ /* max number of readers */
-#define BLOCKSIZE_DFT 1024 /* 1KB */
-#define PARTITION_DFT 2048 /* 2KB */
-#define NLINKEDBLOCKS_DFT 512 /* default 512 */
-#define SIZE_BLKADDR 4 /* expected sizeof blkaddr */
-#define Hgoto_error(val) {ret_value=val; goto done;}
+#define DATAFILE "twriteorder.dat"
+/* #define READERS_MAX 10 */ /* max number of readers */
+#define BLOCKSIZE_DFT 1024 /* 1KB */
+#define PARTITION_DFT 2048 /* 2KB */
+#define NLINKEDBLOCKS_DFT 512 /* default 512 */
+#define SIZE_BLKADDR 4 /* expected sizeof blkaddr */
+#define Hgoto_error(val) \
+ { \
+ ret_value = val; \
+ goto done; \
+ }
/* type declarations */
typedef enum part_t {
- UC_READWRITE = 0, /* both writer and reader */
- UC_WRITER, /* writer only */
- UC_READER /* reader only */
+ UC_READWRITE = 0, /* both writer and reader */
+ UC_WRITER, /* writer only */
+ UC_READER /* reader only */
} part_t;
/* prototypes */
-int create_wo_file(void);
-int write_wo_file(void);
-int read_wo_file(void);
+int create_wo_file(void);
+int write_wo_file(void);
+int read_wo_file(void);
void usage(const char *prog);
-int setup_parameters(int argc, char * const argv[]);
-int parse_option(int argc, char * const argv[]);
+int setup_parameters(int argc, char *const argv[]);
+int parse_option(int argc, char *const argv[]);
/* Global Variable definitions */
-const char *progname_g="twriteorder"; /* program name */
-int write_fd_g;
-int blocksize_g, part_size_g, nlinkedblock_g;
-part_t launch_g;
+const char *progname_g = "twriteorder"; /* program name */
+int write_fd_g;
+int blocksize_g, part_size_g, nlinkedblock_g;
+part_t launch_g;
/* Function definitions */
@@ -116,9 +120,9 @@ usage(const char *prog)
/* Setup test parameters by parsing command line options.
* Setup default values if not set by options. */
int
-parse_option(int argc, char * const argv[])
+parse_option(int argc, char *const argv[])
{
- int ret_value=0;
+ int ret_value = 0;
int c;
/* command line options: See function usage for a description */
const char *cmd_options = "hb:l:n:p:";
@@ -127,7 +131,7 @@ parse_option(int argc, char * const argv[])
opterr = 0;
while (1) {
- c = getopt (argc, argv, cmd_options);
+ c = getopt(argc, argv, cmd_options);
if (-1 == c)
break;
@@ -136,33 +140,33 @@ parse_option(int argc, char * const argv[])
usage(progname_g);
HDexit(EXIT_SUCCESS);
break;
- case 'b': /* number of planes to write/read */
+ case 'b': /* number of planes to write/read */
if ((blocksize_g = atoi(optarg)) <= 0) {
HDfprintf(stderr, "bad blocksize %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);
};
break;
- case 'n': /* number of planes to write/read */
+ case 'n': /* number of planes to write/read */
if ((nlinkedblock_g = atoi(optarg)) < 2) {
HDfprintf(stderr, "bad number of linked blocks %s, must be greater than 1.\n", optarg);
usage(progname_g);
Hgoto_error(-1);
};
break;
- case 'p': /* number of planes to write/read */
+ case 'p': /* number of planes to write/read */
if ((part_size_g = atoi(optarg)) <= 0) {
HDfprintf(stderr, "bad partition size %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);
};
break;
- case 'l': /* launch reader or writer only */
+ case 'l': /* launch reader or writer only */
switch (*optarg) {
- case 'r': /* reader only */
+ case 'r': /* reader only */
launch_g = UC_READER;
break;
- case 'w': /* writer only */
+ case 'w': /* writer only */
launch_g = UC_WRITER;
break;
default:
@@ -182,11 +186,12 @@ parse_option(int argc, char * const argv[])
HDfprintf(stderr, "Unexpected value is %d\n", c);
Hgoto_error(-1);
} /* end outer switch */
- } /* end while */
+ } /* end while */
/* verify partition size must be >= blocksize */
- if (part_size_g < blocksize_g ){
- HDfprintf(stderr, "Blocksize %d should not be bigger than partition size %d\n", blocksize_g, part_size_g);
+ if (part_size_g < blocksize_g) {
+ HDfprintf(stderr, "Blocksize %d should not be bigger than partition size %d\n", blocksize_g,
+ part_size_g);
Hgoto_error(-1);
}
@@ -198,16 +203,17 @@ done:
/* Setup parameters for the test case.
* Return: 0 succeed; -1 fail.
*/
-int setup_parameters(int argc, char * const argv[])
+int
+setup_parameters(int argc, char *const argv[])
{
/* test case defaults */
- blocksize_g = BLOCKSIZE_DFT;
- part_size_g = PARTITION_DFT;
+ blocksize_g = BLOCKSIZE_DFT;
+ part_size_g = PARTITION_DFT;
nlinkedblock_g = NLINKEDBLOCKS_DFT;
- launch_g = UC_READWRITE;
+ launch_g = UC_READWRITE;
/* parse options */
- if (parse_option(argc, argv) < 0){
+ if (parse_option(argc, argv) < 0) {
return -1;
}
@@ -225,19 +231,20 @@ int setup_parameters(int argc, char * const argv[])
*
* Return: 0 succeed; -1 fail.
*/
-int create_wo_file(void)
+int
+create_wo_file(void)
{
- int blkaddr = 0; /* blkaddress of next linked block */
- h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
+ int blkaddr = 0; /* blkaddress of next linked block */
+ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
/* Create the data file */
- if ((write_fd_g = HDopen(DATAFILE, O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) {
+ if ((write_fd_g = HDopen(DATAFILE, O_RDWR | O_TRUNC | O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) {
HDprintf("WRITER: error from open\n");
return -1;
}
blkaddr = 0;
/* write it to partition 0 */
- if ((bytes_wrote = HDwrite(write_fd_g, &blkaddr, (size_t)SIZE_BLKADDR)) != SIZE_BLKADDR){
+ if ((bytes_wrote = HDwrite(write_fd_g, &blkaddr, (size_t)SIZE_BLKADDR)) != SIZE_BLKADDR) {
HDprintf("blkaddr write failed\n");
return -1;
}
@@ -246,14 +253,14 @@ int create_wo_file(void)
return 0;
}
-int write_wo_file(void)
+int
+write_wo_file(void)
{
- int blkaddr;
- int blkaddr_old=0;
- int i;
- char buffer[BLOCKSIZE_DFT];
- h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
-
+ int blkaddr;
+ int blkaddr_old = 0;
+ int i;
+ char buffer[BLOCKSIZE_DFT];
+ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
/* write block 1, 2, ... */
for (i = 1; i < nlinkedblock_g; i++) {
@@ -265,14 +272,14 @@ int write_wo_file(void)
HDmemcpy(&buffer[0], &blkaddr_old, sizeof(blkaddr_old));
/* fill the rest with the lowest byte of i */
- HDmemset(&buffer[4], i & 0xff, (size_t) (BLOCKSIZE_DFT-4));
+ HDmemset(&buffer[4], i & 0xff, (size_t)(BLOCKSIZE_DFT - 4));
/* write the block */
#ifdef DEBUG
HDprintf("writing block at %d\n", blkaddr);
#endif
HDlseek(write_fd_g, (HDoff_t)blkaddr, SEEK_SET);
- if ((bytes_wrote = HDwrite(write_fd_g, buffer, (size_t)blocksize_g)) != blocksize_g){
+ if ((bytes_wrote = HDwrite(write_fd_g, buffer, (size_t)blocksize_g)) != blocksize_g) {
HDprintf("blkaddr write failed in partition %d\n", i);
return -1;
}
@@ -283,7 +290,8 @@ int write_wo_file(void)
/* write the last blkaddr in partition 0 */
HDlseek(write_fd_g, (HDoff_t)0, SEEK_SET);
- if ((bytes_wrote = HDwrite(write_fd_g, &blkaddr_old, (size_t)sizeof(blkaddr_old))) != sizeof(blkaddr_old)){
+ if ((bytes_wrote = HDwrite(write_fd_g, &blkaddr_old, (size_t)sizeof(blkaddr_old))) !=
+ sizeof(blkaddr_old)) {
HDprintf("blkaddr write failed in partition %d\n", 0);
return -1;
}
@@ -295,13 +303,14 @@ int write_wo_file(void)
return 0;
}
-int read_wo_file(void)
+int
+read_wo_file(void)
{
- int read_fd;
- int blkaddr = 0;
- h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
- int linkedblocks_read = 0;
- char buffer[BLOCKSIZE_DFT];
+ int read_fd;
+ int blkaddr = 0;
+ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+ int linkedblocks_read = 0;
+ char buffer[BLOCKSIZE_DFT];
/* Open the data file */
if ((read_fd = HDopen(DATAFILE, O_RDONLY)) < 0) {
@@ -325,7 +334,7 @@ int read_wo_file(void)
#endif
while (blkaddr != 0) {
HDlseek(read_fd, (HDoff_t)blkaddr, SEEK_SET);
- if ((bytes_read = HDread(read_fd, buffer, (size_t)blocksize_g)) != blocksize_g){
+ if ((bytes_read = HDread(read_fd, buffer, (size_t)blocksize_g)) != blocksize_g) {
HDprintf("blkaddr read failed in partition %d\n", 0);
return -1;
}
@@ -344,7 +353,6 @@ int read_wo_file(void)
return 0;
}
-
/* Overall Algorithm:
* Parse options from user;
* Generate/pre-created the test file needed and close it;
@@ -357,15 +365,15 @@ main(int argc, char *argv[])
{
/*pid_t childpid[READERS_MAX];
int child_ret_value[READERS_MAX];*/
- pid_t childpid=0;
- int child_ret_value;
+ pid_t childpid = 0;
+ int child_ret_value;
pid_t mypid, tmppid;
- int child_status;
- int child_wait_option=0;
- int ret_value = 0;
+ int child_status;
+ int child_wait_option = 0;
+ int ret_value = 0;
/* initialization */
- if (setup_parameters(argc, argv) < 0){
+ if (setup_parameters(argc, argv) < 0) {
Hgoto_error(1);
}
@@ -389,9 +397,9 @@ main(int argc, char *argv[])
/* flush output before possible fork */
HDfflush(stdout);
- if (launch_g==UC_READWRITE) {
+ if (launch_g == UC_READWRITE) {
/* fork process */
- if((childpid = HDfork()) < 0) {
+ if ((childpid = HDfork()) < 0) {
HDperror("fork");
Hgoto_error(1);
};
@@ -403,7 +411,7 @@ main(int argc, char *argv[])
/* ============= */
if (launch_g != UC_WRITER) {
/* child process launch the reader */
- if(0 == childpid) {
+ if (0 == childpid) {
HDprintf("%d: launch reader process\n", mypid);
if (read_wo_file() < 0) {
HDfprintf(stderr, "read_wo_file encountered error\n");
@@ -437,7 +445,7 @@ main(int argc, char *argv[])
Hgoto_error(1);
}
if (WIFEXITED(child_status)) {
- if ((child_ret_value=WEXITSTATUS(child_status)) != 0) {
+ if ((child_ret_value = WEXITSTATUS(child_status)) != 0) {
HDprintf("%d: child process exited with non-zero code (%d)\n", mypid, child_ret_value);
Hgoto_error(2);
}
@@ -450,7 +458,7 @@ main(int argc, char *argv[])
done:
/* Print result and exit */
- if (ret_value != 0){
+ if (ret_value != 0) {
HDprintf("Error(s) encountered\n");
}
else {
@@ -470,4 +478,3 @@ main(void)
} /* end main() */
#endif /* H5_HAVE_FORK */
-
diff --git a/test/unlink.c b/test/unlink.c
index f45d7d7..8129cc9 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -18,65 +18,53 @@
* Purpose: Test unlinking operations.
*/
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5G_TESTING
#include "h5test.h"
-#include "H5Gpkg.h" /* Groups */
-
-const char *FILENAME[] = {
- "unlink",
- "new_move_a",
- "new_move_b",
- "lunlink",
- "filespace",
- "slashes",
- "resurrect_set",
- "resurrect_type",
- "resurrect_group",
- "unlink_chunked",
- "full_group",
- NULL
-};
+#include "H5Gpkg.h" /* Groups */
-/* Macros for test_create_unlink() & test_filespace */
-#define GROUPNAME "group"
-#define GROUP2NAME "group2"
-#define UNLINK_NGROUPS 1000
-#define DATASETNAME "dataset"
-#define DATASET2NAME "dataset2"
-#define ATTRNAME "attribute"
-#define TYPENAME "datatype"
-#define TYPE2NAME "datatype2"
-#define FILESPACE_NDIMS 3
-#define FILESPACE_DIM0 20
-#define FILESPACE_DIM1 20
-#define FILESPACE_DIM2 20
-#define FILESPACE_CHUNK0 10
-#define FILESPACE_CHUNK1 10
-#define FILESPACE_CHUNK2 10
-#define FILESPACE_DEFLATE_LEVEL 6
-#define FILESPACE_REWRITE 10
-#define FILESPACE_NATTR 100
-#define FILESPACE_ATTR_NDIMS 2
-#define FILESPACE_ATTR_DIM0 5
-#define FILESPACE_ATTR_DIM1 5
-#define FILESPACE_TOP_GROUPS 10
-#define FILESPACE_NESTED_GROUPS 50
-#define FILESPACE_NDATASETS 50
-#define SLASHES_GROUP_NAME "Group///"
-#define SLASHES_HARDLINK_NAME "Hard///"
-#define SLASHES_SOFTLINK_NAME "Soft///"
-#define SLASHES_SOFTLINK2_NAME "Soft2///"
-#define SLASHES_ROOTLINK_NAME "Root///"
-#define FULL_GROUP_NUM_KEEP 2
-#define FULL_GROUP_NUM_DELETE_COMPACT 2
-#define FULL_GROUP_NUM_DELETE_DENSE 16
-#define FULL_GROUP_EST_NUM_ENTRIES 8
-#define FULL_GROUP_EST_ENTRY_LEN 9
+const char *FILENAME[] = {"unlink", "new_move_a", "new_move_b", "lunlink",
+ "filespace", "slashes", "resurrect_set", "resurrect_type",
+ "resurrect_group", "unlink_chunked", "full_group", NULL};
+/* Macros for test_create_unlink() & test_filespace */
+#define GROUPNAME "group"
+#define GROUP2NAME "group2"
+#define UNLINK_NGROUPS 1000
+#define DATASETNAME "dataset"
+#define DATASET2NAME "dataset2"
+#define ATTRNAME "attribute"
+#define TYPENAME "datatype"
+#define TYPE2NAME "datatype2"
+#define FILESPACE_NDIMS 3
+#define FILESPACE_DIM0 20
+#define FILESPACE_DIM1 20
+#define FILESPACE_DIM2 20
+#define FILESPACE_CHUNK0 10
+#define FILESPACE_CHUNK1 10
+#define FILESPACE_CHUNK2 10
+#define FILESPACE_DEFLATE_LEVEL 6
+#define FILESPACE_REWRITE 10
+#define FILESPACE_NATTR 100
+#define FILESPACE_ATTR_NDIMS 2
+#define FILESPACE_ATTR_DIM0 5
+#define FILESPACE_ATTR_DIM1 5
+#define FILESPACE_TOP_GROUPS 10
+#define FILESPACE_NESTED_GROUPS 50
+#define FILESPACE_NDATASETS 50
+#define SLASHES_GROUP_NAME "Group///"
+#define SLASHES_HARDLINK_NAME "Hard///"
+#define SLASHES_SOFTLINK_NAME "Soft///"
+#define SLASHES_SOFTLINK2_NAME "Soft2///"
+#define SLASHES_ROOTLINK_NAME "Root///"
+#define FULL_GROUP_NUM_KEEP 2
+#define FULL_GROUP_NUM_DELETE_COMPACT 2
+#define FULL_GROUP_NUM_DELETE_DENSE 16
+#define FULL_GROUP_EST_NUM_ENTRIES 8
+#define FULL_GROUP_EST_ENTRY_LEN 9
/*-------------------------------------------------------------------------
* Function: test_one
@@ -98,51 +86,61 @@ const char *FILENAME[] = {
static int
test_one(hid_t file)
{
- hid_t work = -1, grp = -1;
- herr_t status;
+ hid_t work = -1, grp = -1;
+ herr_t status;
/* Create a test group */
- if((work = H5Gcreate2(file, "/test_one", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((work = H5Gcreate2(file, "/test_one", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete by absolute name */
TESTING("unlink by absolute name");
- if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(file, "/test_one/foo", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grp) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(file, "/test_one/foo", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
PASSED();
/* Delete by local name */
TESTING("unlink by local name");
- if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(work, "foo", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grp) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(work, "foo", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
PASSED();
/* Delete directly - should fail */
TESTING("unlink without a name");
- if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- status = H5Ldelete(grp, ".", H5P_DEFAULT);
- } H5E_END_TRY;
- if(status>=0)
- FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.")
- if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
+ if ((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { status = H5Ldelete(grp, ".", H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0)
+ FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.")
+ if (H5Gclose(grp) < 0)
+ FAIL_STACK_ERROR
/* Cleanup */
- if(H5Gclose(work) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(work) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Gclose(work);
- H5Gclose(grp);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(work);
+ H5Gclose(grp);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_one() */
-
/*-------------------------------------------------------------------------
* Function: test_many
*
@@ -162,84 +160,96 @@ test_one(hid_t file)
static int
test_many(hid_t file)
{
- hid_t work=-1, grp=-1;
- int i;
- const int how_many=500;
- char name[32];
+ hid_t work = -1, grp = -1;
+ int i;
+ const int how_many = 500;
+ char name[32];
/* Create a test group */
- if((work = H5Gcreate2(file, "/test_many", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if((grp = H5Gcreate2(work, "/test_many_foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Gclose(grp) < 0) goto error;
+ if ((work = H5Gcreate2(file, "/test_many", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if ((grp = H5Gcreate2(work, "/test_many_foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(grp) < 0)
+ goto error;
/* Create a bunch of names and unlink them in order */
TESTING("forward unlink");
- for(i = 0; i < how_many; i++) {
- HDsprintf(name, "obj_%05d", i);
- if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ for (i = 0; i < how_many; i++) {
+ HDsprintf(name, "obj_%05d", i);
+ if (H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
- for(i = 0; i < how_many; i++) {
- HDsprintf(name, "obj_%05d", i);
- if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ for (i = 0; i < how_many; i++) {
+ HDsprintf(name, "obj_%05d", i);
+ if (H5Ldelete(work, name, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
PASSED();
/* Create a bunch of names and unlink them in reverse order */
TESTING("backward unlink");
- for(i = 0; i < how_many; i++) {
- HDsprintf(name, "obj_%05d", i);
- if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ for (i = 0; i < how_many; i++) {
+ HDsprintf(name, "obj_%05d", i);
+ if (H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
- for(i = (how_many - 1); i >= 0; --i) {
- HDsprintf(name, "obj_%05d", i);
- if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ for (i = (how_many - 1); i >= 0; --i) {
+ HDsprintf(name, "obj_%05d", i);
+ if (H5Ldelete(work, name, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
PASSED();
/* Create a bunch of names and unlink them from both directions */
TESTING("inward unlink");
- for(i = 0; i < how_many; i++) {
- HDsprintf(name, "obj_%05d", i);
- if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ for (i = 0; i < how_many; i++) {
+ HDsprintf(name, "obj_%05d", i);
+ if (H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
- for(i = 0; i < how_many; i++) {
- if(i % 2)
- HDsprintf(name, "obj_%05d", how_many - (1 + i / 2));
- else
- HDsprintf(name, "obj_%05d", i / 2);
- if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ for (i = 0; i < how_many; i++) {
+ if (i % 2)
+ HDsprintf(name, "obj_%05d", how_many - (1 + i / 2));
+ else
+ HDsprintf(name, "obj_%05d", i / 2);
+ if (H5Ldelete(work, name, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
PASSED();
/* Create a bunch of names and unlink them from the midle */
TESTING("outward unlink");
- for(i = 0; i < how_many; i++) {
- HDsprintf(name, "obj_%05d", i);
- if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ for (i = 0; i < how_many; i++) {
+ HDsprintf(name, "obj_%05d", i);
+ if (H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
- for(i = (how_many - 1); i >= 0; --i) {
- if(i % 2)
- HDsprintf(name, "obj_%05d", how_many - (1 + i / 2));
- else
- HDsprintf(name, "obj_%05d", i / 2);
- if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ for (i = (how_many - 1); i >= 0; --i) {
+ if (i % 2)
+ HDsprintf(name, "obj_%05d", how_many - (1 + i / 2));
+ else
+ HDsprintf(name, "obj_%05d", i / 2);
+ if (H5Ldelete(work, name, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
PASSED();
-
/* Cleanup */
- if (H5Gclose(work) < 0) goto error;
+ if (H5Gclose(work) < 0)
+ goto error;
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Gclose(work);
- H5Gclose(grp);
- } H5E_END_TRY;
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(work);
+ H5Gclose(grp);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: test_symlink
*
@@ -257,29 +267,31 @@ test_many(hid_t file)
static int
test_symlink(hid_t file)
{
- hid_t work=-1;
+ hid_t work = -1;
TESTING("symlink removal");
/* Create a test group and symlink */
- if((work = H5Gcreate2(file, "/test_symlink", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("link_value", work, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(work, "link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((work = H5Gcreate2(file, "/test_symlink", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("link_value", work, "link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(work, "link", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Cleanup */
- if(H5Gclose(work) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(work) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(work);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Gclose(work); }
+ H5E_END_TRY;
return 1;
} /* end test_symlink() */
-
/*-------------------------------------------------------------------------
* Function: test_rename
*
@@ -299,41 +311,53 @@ error:
static int
test_rename(hid_t file)
{
- hid_t work=-1, foo=-1, inner=-1;
+ hid_t work = -1, foo = -1, inner = -1;
/* Create a test group and rename something */
TESTING("object renaming");
- if((work = H5Gcreate2(file, "/test_rename", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((foo = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Lmove(work, "foo", H5L_SAME_LOC, "bar", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if((inner = H5Gcreate2(foo, "inner", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(inner) < 0) FAIL_STACK_ERROR
- if(H5Gclose(foo) < 0) FAIL_STACK_ERROR
- if((inner = H5Gopen2(work, "bar/inner", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(inner) < 0) FAIL_STACK_ERROR
+ if ((work = H5Gcreate2(file, "/test_rename", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((foo = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lmove(work, "foo", H5L_SAME_LOC, "bar", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if ((inner = H5Gcreate2(foo, "inner", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(inner) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(foo) < 0)
+ FAIL_STACK_ERROR
+ if ((inner = H5Gopen2(work, "bar/inner", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(inner) < 0)
+ FAIL_STACK_ERROR
PASSED();
/* Try renaming a symlink */
TESTING("symlink renaming");
- if(H5Lcreate_soft("link_value", work, "link_one", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lmove(work, "link_one", H5L_SAME_LOC, "link_two", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("link_value", work, "link_one", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lmove(work, "link_one", H5L_SAME_LOC, "link_two", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Cleanup */
- if (H5Gclose(work) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(work) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(work);
- H5Gclose(foo);
- H5Gclose(inner);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(work);
+ H5Gclose(foo);
+ H5Gclose(inner);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_rename() */
-
/*-------------------------------------------------------------------------
* Function: test_new_move
*
@@ -353,67 +377,90 @@ error:
static int
test_new_move(hid_t fapl)
{
- hid_t file_a, file_b=(-1);
- hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1);
- char filename[1024];
+ hid_t file_a, file_b = (-1);
+ hid_t grp_1 = (-1), grp_2 = (-1), grp_move = (-1), moved_grp = (-1);
+ char filename[1024];
TESTING("new move");
/* Create a second file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create groups in first file */
- if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create hard and soft links. */
- if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Move a group within the file. Both of source and destination use
* H5L_SAME_LOC. Should fail. */
- H5E_BEGIN_TRY {
- if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) != FAIL) TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=
+ FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Move a group across files. Should fail. */
- H5E_BEGIN_TRY {
- if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) != FAIL) TEST_ERROR
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ if (H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ }
+ H5E_END_TRY;
/* Move a group across groups in the same file. */
- if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- if(H5Gclose(grp_1) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grp_2) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grp_move) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file_a) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file_b) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(grp_1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grp_2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(grp_move) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(moved_grp) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file_a) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file_b) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- H5Gclose(grp_1);
- H5Gclose(grp_2);
- H5Gclose(grp_move);
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(grp_1);
+ H5Gclose(grp_2);
+ H5Gclose(grp_move);
H5Gclose(moved_grp);
- H5Fclose(file_a);
- H5Fclose(file_b);
- } H5E_END_TRY;
+ H5Fclose(file_a);
+ H5Fclose(file_b);
+ }
+ H5E_END_TRY;
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: check_new_move
*
@@ -443,31 +490,32 @@ check_new_move(hid_t fapl)
/* Open file */
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get hard link info */
- if(H5Oget_info_by_name3(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
- if(H5Oget_info_by_name3(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Check hard links */
- if(H5O_TYPE_GROUP != oi_hard1.type || H5O_TYPE_GROUP != oi_hard2.type)
+ if (H5O_TYPE_GROUP != oi_hard1.type || H5O_TYPE_GROUP != oi_hard2.type)
FAIL_PUTS_ERROR(" Unexpected object type, should have been a group")
- if(H5Otoken_cmp(file, &oi_hard1.token, &oi_hard2.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(file, &oi_hard1.token, &oi_hard2.token, &token_cmp) < 0)
FAIL_PUTS_ERROR(" H5Otoken_cmp failed")
- if(token_cmp)
+ if (token_cmp)
FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.")
/* Check soft links */
- if(H5Lget_val(file, "group2/soft", linkval, sizeof(linkval), H5P_DEFAULT) < 0)
+ if (H5Lget_val(file, "group2/soft", linkval, sizeof(linkval), H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
- if(HDstrcmp(linkval, "/group1/group_move"))
+ if (HDstrcmp(linkval, "/group1/group_move"))
FAIL_PUTS_ERROR(" Soft link test failed. Wrong link value")
/* Cleanup */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
@@ -476,7 +524,6 @@ error:
return 1;
} /* end check_new_move() */
-
/*-------------------------------------------------------------------------
* Function: test_filespace
*
@@ -495,33 +542,35 @@ error:
static int
test_filespace(hid_t fapl)
{
- hid_t fapl_nocache; /* File access property list with raw data cache turned off */
- hid_t contig_dcpl; /* Dataset creation property list for contiguous dataset */
- hid_t early_chunk_dcpl; /* Dataset creation property list for chunked dataset & early allocation */
- hid_t late_chunk_dcpl; /* Dataset creation property list for chunked dataset & late allocation */
- hid_t comp_dcpl; /* Dataset creation property list for compressed, chunked dataset */
- hid_t compact_dcpl; /* Dataset creation property list for compact dataset */
- hid_t file; /* File ID */
- hid_t group, group2; /* Group IDs */
- hid_t dataset, dataset2; /* Dataset IDs */
- hid_t space; /* Dataspace ID */
- hid_t type; /* Datatype ID */
- hid_t attr_space; /* Dataspace ID for attributes */
- hid_t attr; /* Attribute ID */
- char filename[1024]; /* Name of file to create */
- char objname[128]; /* Name of object to create */
- hsize_t dims[FILESPACE_NDIMS]= {FILESPACE_DIM0, FILESPACE_DIM1, FILESPACE_DIM2}; /* Dataset dimensions */
- hsize_t chunk_dims[FILESPACE_NDIMS]= {FILESPACE_CHUNK0, FILESPACE_CHUNK1, FILESPACE_CHUNK2}; /* Chunk dimensions */
- hsize_t attr_dims[FILESPACE_ATTR_NDIMS]= {FILESPACE_ATTR_DIM0, FILESPACE_ATTR_DIM1}; /* Attribute dimensions */
- int *data = NULL; /* Pointer to dataset buffer */
- int *tmp_data; /* Temporary pointer to dataset buffer */
- h5_stat_size_t empty_size; /* Size of an empty file */
- h5_stat_size_t file_size; /* Size of each file created */
- herr_t status; /* Function status return value */
- unsigned u,v,w; /* Local index variables */
+ hid_t fapl_nocache; /* File access property list with raw data cache turned off */
+ hid_t contig_dcpl; /* Dataset creation property list for contiguous dataset */
+ hid_t early_chunk_dcpl; /* Dataset creation property list for chunked dataset & early allocation */
+ hid_t late_chunk_dcpl; /* Dataset creation property list for chunked dataset & late allocation */
+ hid_t comp_dcpl; /* Dataset creation property list for compressed, chunked dataset */
+ hid_t compact_dcpl; /* Dataset creation property list for compact dataset */
+ hid_t file; /* File ID */
+ hid_t group, group2; /* Group IDs */
+ hid_t dataset, dataset2; /* Dataset IDs */
+ hid_t space; /* Dataspace ID */
+ hid_t type; /* Datatype ID */
+ hid_t attr_space; /* Dataspace ID for attributes */
+ hid_t attr; /* Attribute ID */
+ char filename[1024]; /* Name of file to create */
+ char objname[128]; /* Name of object to create */
+ hsize_t dims[FILESPACE_NDIMS] = {FILESPACE_DIM0, FILESPACE_DIM1, FILESPACE_DIM2}; /* Dataset dimensions */
+ hsize_t chunk_dims[FILESPACE_NDIMS] = {FILESPACE_CHUNK0, FILESPACE_CHUNK1,
+ FILESPACE_CHUNK2}; /* Chunk dimensions */
+ hsize_t attr_dims[FILESPACE_ATTR_NDIMS] = {FILESPACE_ATTR_DIM0,
+ FILESPACE_ATTR_DIM1}; /* Attribute dimensions */
+ int * data = NULL; /* Pointer to dataset buffer */
+ int * tmp_data; /* Temporary pointer to dataset buffer */
+ h5_stat_size_t empty_size; /* Size of an empty file */
+ h5_stat_size_t file_size; /* Size of each file created */
+ herr_t status; /* Function status return value */
+ unsigned u, v, w; /* Local index variables */
/* Metadata cache parameters */
- int mdc_nelmts;
+ int mdc_nelmts;
size_t rdcc_nelmts;
size_t rdcc_nbytes;
double rdcc_w0;
@@ -531,697 +580,871 @@ test_filespace(hid_t fapl)
/* Open file */
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
-/* Create FAPL with raw data cache disabled */
+ /* Create FAPL with raw data cache disabled */
/* Create file access property list with raw data cache disabled */
- if ((fapl_nocache=H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl_nocache = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Get the cache settings */
- if(H5Pget_cache(fapl_nocache,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0) < 0) TEST_ERROR
+ if (H5Pget_cache(fapl_nocache, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
+ TEST_ERROR
/* Disable the raw data cache */
- rdcc_nelmts=0;
- rdcc_nbytes=0;
- if(H5Pset_cache(fapl_nocache,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0) < 0) TEST_ERROR
+ rdcc_nelmts = 0;
+ rdcc_nbytes = 0;
+ if (H5Pset_cache(fapl_nocache, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
+ TEST_ERROR
-/* Create empty file for size comparisons later */
+ /* Create empty file for size comparisons later */
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
/* Get the size of an empty file */
- if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((empty_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
-/* Create common objects for datasets */
+ /* Create common objects for datasets */
/* Create dataset creation property list for contigous storage */
- if ((contig_dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
/* Make certain that space is allocated early */
- if(H5Pset_alloc_time(contig_dcpl, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
+ if (H5Pset_alloc_time(contig_dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* Create dataset creation property list for chunked storage & early allocation */
- if ((early_chunk_dcpl=H5Pcopy(contig_dcpl)) < 0) TEST_ERROR
+ if ((early_chunk_dcpl = H5Pcopy(contig_dcpl)) < 0)
+ TEST_ERROR
/* Set chunk dimensions */
- if(H5Pset_chunk(early_chunk_dcpl, FILESPACE_NDIMS, chunk_dims) < 0) TEST_ERROR
+ if (H5Pset_chunk(early_chunk_dcpl, FILESPACE_NDIMS, chunk_dims) < 0)
+ TEST_ERROR
/* Create dataset creation property list for chunked storage & late allocation */
- if ((late_chunk_dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ((late_chunk_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
/* Set chunk dimensions */
- if(H5Pset_chunk(late_chunk_dcpl, FILESPACE_NDIMS, chunk_dims) < 0) TEST_ERROR
+ if (H5Pset_chunk(late_chunk_dcpl, FILESPACE_NDIMS, chunk_dims) < 0)
+ TEST_ERROR
/* Create dataset creation property list for compressed, chunked storage & early allocation */
- if ((comp_dcpl=H5Pcopy(early_chunk_dcpl)) < 0) TEST_ERROR
+ if ((comp_dcpl = H5Pcopy(early_chunk_dcpl)) < 0)
+ TEST_ERROR
/* Enable compression & set level */
- if(H5Pset_deflate(comp_dcpl, FILESPACE_DEFLATE_LEVEL) < 0) TEST_ERROR
+ if (H5Pset_deflate(comp_dcpl, FILESPACE_DEFLATE_LEVEL) < 0)
+ TEST_ERROR
/* Create dataset creation property list for compact storage */
- if ((compact_dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ((compact_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
/* Set to compact storage */
- if(H5Pset_layout(compact_dcpl, H5D_COMPACT) < 0) TEST_ERROR
+ if (H5Pset_layout(compact_dcpl, H5D_COMPACT) < 0)
+ TEST_ERROR
/* Create dataspace for datasets */
- if((space = H5Screate_simple(FILESPACE_NDIMS, dims, NULL)) < 0) TEST_ERROR
+ if ((space = H5Screate_simple(FILESPACE_NDIMS, dims, NULL)) < 0)
+ TEST_ERROR
/* Create buffer for writing dataset */
- if(NULL == (data = (int *)HDmalloc(sizeof(int) * FILESPACE_DIM0 * FILESPACE_DIM1 * FILESPACE_DIM2))) TEST_ERROR
-
+ if (NULL == (data = (int *)HDmalloc(sizeof(int) * FILESPACE_DIM0 * FILESPACE_DIM1 * FILESPACE_DIM2)))
+ TEST_ERROR
-/* Create single dataset (with contiguous storage & late allocation), remove it & verify file size */
+ /* Create single dataset (with contiguous storage & late allocation), remove it & verify file size */
TESTING(" contiguous dataset with late allocation");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
/* Remove the dataset */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create single dataset (with contiguous storage & early allocation), remove it & verify file size */
+ /* Create single dataset (with contiguous storage & early allocation), remove it & verify file size */
TESTING(" contiguous dataset with early allocation");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, contig_dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, contig_dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
/* Remove the dataset */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create single dataset (with chunked storage & late allocation), remove it & verify file size */
+ /* Create single dataset (with chunked storage & late allocation), remove it & verify file size */
TESTING(" chunked dataset with late allocation");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, late_chunk_dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if ((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, late_chunk_dcpl,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
/* Remove the dataset */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create single dataset (with chunked storage & early allocation), remove it & verify file size */
+ /* Create single dataset (with chunked storage & early allocation), remove it & verify file size */
TESTING(" chunked dataset with early allocation");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, early_chunk_dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if ((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, early_chunk_dcpl,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
/* Remove the dataset */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create single dataset (with compressed storage & early allocation), remove it & verify file size */
+ /* Create single dataset (with compressed storage & early allocation), remove it & verify file size */
TESTING(" compressed, chunked dataset");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, comp_dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, comp_dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
/* Remove the dataset */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create single dataset (with compressed storage & early allocation), re-write it a bunch of
- * times (which should re-allocate blocks many times) and remove it & verify
- * file size.
- */
+ /* Create single dataset (with compressed storage & early allocation), re-write it a bunch of
+ * times (which should re-allocate blocks many times) and remove it & verify
+ * file size.
+ */
TESTING(" re-writing compressed, chunked dataset");
/* Create file (using FAPL with disabled raw data cache) */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_nocache)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_nocache)) < 0)
+ FAIL_STACK_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, comp_dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, comp_dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Alternate re-writing dataset with compressible & random data */
- for(u = 0; u < FILESPACE_REWRITE; u++) {
+ for (u = 0; u < FILESPACE_REWRITE; u++) {
/* Set buffer to some compressible values */
- for(v = 0, tmp_data = data; v < (FILESPACE_DIM0 * FILESPACE_DIM1 * FILESPACE_DIM2); v++)
+ for (v = 0, tmp_data = data; v < (FILESPACE_DIM0 * FILESPACE_DIM1 * FILESPACE_DIM2); v++)
*tmp_data++ = (int)(v * u);
/* Write the buffer to the dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR
/* Set buffer to different random numbers each time */
- for(v = 0, tmp_data = data; v < (FILESPACE_DIM0 * FILESPACE_DIM1 * FILESPACE_DIM2); v++)
+ for (v = 0, tmp_data = data; v < (FILESPACE_DIM0 * FILESPACE_DIM1 * FILESPACE_DIM2); v++)
*tmp_data++ = (int)HDrandom();
/* Write the buffer to the dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close dataset */
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
/* Remove the dataset */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl_nocache)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl_nocache)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create single dataset (with compact storage), remove it & verify file size */
+ /* Create single dataset (with compact storage), remove it & verify file size */
TESTING(" compact dataset");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, compact_dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if ((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, compact_dcpl,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
/* Remove the dataset */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create two datasets (with contiguous storage), alternate adding attributes
- * to each one (which creates many object header continuations),
- * remove both & verify file size.
- */
+ /* Create two datasets (with contiguous storage), alternate adding attributes
+ * to each one (which creates many object header continuations),
+ * remove both & verify file size.
+ */
TESTING(" object header continuations");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create datasets to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, contig_dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((dataset2 = H5Dcreate2(file, DATASET2NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, contig_dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, contig_dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((dataset2 = H5Dcreate2(file, DATASET2NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, contig_dcpl,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a dataspace for the attributes */
- if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) FAIL_STACK_ERROR
+ if ((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Alternate adding attributes to each one */
- for(u = 0; u < FILESPACE_NATTR; u++) {
+ for (u = 0; u < FILESPACE_NATTR; u++) {
/* Set the name of the attribute to create */
- HDsprintf(objname,"%s %u",ATTRNAME,u);
+ HDsprintf(objname, "%s %u", ATTRNAME, u);
/* Create an attribute on the first dataset */
- if((attr = H5Acreate2(dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((attr = H5Acreate2(dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Don't worry about writing the attribute - it will have a fill value */
/* Close the attribute on the first dataset */
- if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
+ if (H5Aclose(attr) < 0)
+ FAIL_STACK_ERROR
/* Create an attribute on the second dataset */
- if((attr = H5Acreate2(dataset2, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((attr = H5Acreate2(dataset2, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Don't worry about writing the attribute - it will have a fill value */
/* Close the attribute on the second dataset */
- if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
+ if (H5Aclose(attr) < 0)
+ FAIL_STACK_ERROR
/* Flush the file (to fix the sizes of object header buffers, etc) */
- if(H5Fflush(file,H5F_SCOPE_GLOBAL) < 0) FAIL_STACK_ERROR
+ if (H5Fflush(file, H5F_SCOPE_GLOBAL) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close the dataspace for the attributes */
- if(H5Sclose(attr_space) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(attr_space) < 0)
+ FAIL_STACK_ERROR
/* Close datasets */
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset2) < 0)
+ FAIL_STACK_ERROR
/* Remove the datasets */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(file, DATASET2NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASET2NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create single named datatype, remove it & verify file size */
+ /* Create single named datatype, remove it & verify file size */
TESTING(" named datatype");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create datatype to commit */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
/* Create a single named datatype to remove */
- if(H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
+ if (H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
/* Remove the named datatype */
- if(H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create single group, remove it & verify file size */
+ /* Create single group, remove it & verify file size */
TESTING(" single group");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a single group to remove */
- if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
/* Remove the group */
- if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create many groups, remove them & verify file size */
+ /* Create many groups, remove them & verify file size */
TESTING(" multiple groups");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a many groups to remove */
- for(u = 0; u < UNLINK_NGROUPS; u++) {
+ for (u = 0; u < UNLINK_NGROUPS; u++) {
HDsprintf(objname, "%s %u", GROUPNAME, u);
- if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Remove the all the groups */
/* (Remove them in reverse order just to make file size calculation easier -QAK) */
- for(u = UNLINK_NGROUPS; u > 0; u--) {
+ for (u = UNLINK_NGROUPS; u > 0; u--) {
HDsprintf(objname, "%s %u", GROUPNAME, (u - 1));
- if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create simple group hiearchy, remove it & verify file size */
+ /* Create simple group hiearchy, remove it & verify file size */
TESTING(" simple group hierarchy");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a small group hierarchy to remove */
- if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((group2 = H5Gcreate2(group, GROUP2NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((group2 = H5Gcreate2(group, GROUP2NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
/* Remove the second group */
- if(H5Ldelete(file, GROUPNAME "/" GROUP2NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, GROUPNAME "/" GROUP2NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Remove the first group */
- if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create complex group hiearchy, remove it & verify file size */
+ /* Create complex group hiearchy, remove it & verify file size */
TESTING(" complex group hierarchy");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a complex group hierarchy to remove */
- for(u = 0; u < FILESPACE_TOP_GROUPS; u++) {
+ for (u = 0; u < FILESPACE_TOP_GROUPS; u++) {
/* Create group */
- HDsprintf(objname,"%s %u",GROUPNAME,u);
- if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ HDsprintf(objname, "%s %u", GROUPNAME, u);
+ if ((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create nested groups inside top groups */
- for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) {
+ for (v = 0; v < FILESPACE_NESTED_GROUPS; v++) {
/* Create group */
HDsprintf(objname, "%s %u", GROUP2NAME, v);
- if((group2 = H5Gcreate2(group, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2 = H5Gcreate2(group, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create datasets inside nested groups */
- for(w = 0; w < FILESPACE_NDATASETS; w++) {
+ for (w = 0; w < FILESPACE_NDATASETS; w++) {
/* Create & close a dataset */
HDsprintf(objname, "%s %u", DATASETNAME, w);
- if((dataset = H5Dcreate2(group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if ((dataset = H5Dcreate2(group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close nested group */
- if(H5Gclose(group2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group2) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close top group */
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Remove complex group hierarchy */
/* (Remove them in reverse order just to make file size calculation easier -QAK) */
- for(u = FILESPACE_TOP_GROUPS; u > 0; u--) {
+ for (u = FILESPACE_TOP_GROUPS; u > 0; u--) {
/* Open group */
HDsprintf(objname, "%s %u", GROUPNAME, (u - 1));
- if((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Open nested groups inside top groups */
- for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) {
+ for (v = 0; v < FILESPACE_NESTED_GROUPS; v++) {
/* Create group */
HDsprintf(objname, "%s %u", GROUP2NAME, v);
- if((group2 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group2 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Remove datasets inside nested groups */
- for(w = 0; w < FILESPACE_NDATASETS; w++) {
+ for (w = 0; w < FILESPACE_NDATASETS; w++) {
/* Remove dataset */
HDsprintf(objname, "%s %u", DATASETNAME, w);
- if(H5Ldelete(group2, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(group2, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close nested group */
- if(H5Gclose(group2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group2) < 0)
+ FAIL_STACK_ERROR
/* Remove nested group */
- HDsprintf(objname, "%s %u",GROUP2NAME, v);
- if(H5Ldelete(group, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ HDsprintf(objname, "%s %u", GROUP2NAME, v);
+ if (H5Ldelete(group, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close top group */
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
/* Remove top group */
HDsprintf(objname, "%s %u", GROUPNAME, (u - 1));
- if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, objname, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create dataset and duplicate dataset, remove original & verify file size */
+ /* Create dataset and duplicate dataset, remove original & verify file size */
TESTING(" duplicate dataset");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
/* Create another dataset with same name */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(dataset >= 0) {
+ }
+ H5E_END_TRY;
+ if (dataset >= 0) {
H5Dclose(dataset);
TEST_ERROR
} /* end if */
/* Remove the dataset */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create group and duplicate group, remove original & verify file size */
+ /* Create group and duplicate group, remove original & verify file size */
TESTING(" duplicate group");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a single group to remove */
- if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
/* Create another group with same name */
- H5E_BEGIN_TRY {
- group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(group >= 0) {
+ H5E_BEGIN_TRY { group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (group >= 0) {
H5Gclose(group);
TEST_ERROR
} /* end if */
/* Remove the group */
- if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create named datatype and duplicate named datatype, remove original & verify file size */
+ /* Create named datatype and duplicate named datatype, remove original & verify file size */
TESTING(" duplicate named datatype");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create datatype to commit */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
/* Create a single named datatype to remove */
- if(H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
+ if (H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
/* Create datatype to commit */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
/* Create another named datatype with same name */
- H5E_BEGIN_TRY {
- status = H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(status >= 0) TEST_ERROR
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { status = H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (status >= 0)
+ TEST_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
/* Remove the named datatype */
- if(H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Create named datatype and duplicate named datatype, remove original & verify file size */
+ /* Create named datatype and duplicate named datatype, remove original & verify file size */
TESTING(" duplicate attribute");
/* Create file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create datasets to remove */
- if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, contig_dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dataset =
+ H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, contig_dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a dataspace for the attributes */
- if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) FAIL_STACK_ERROR
+ if ((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create an attribute on the dataset */
- if((attr = H5Acreate2(dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((attr = H5Acreate2(dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Don't worry about writing the attribute - it will have a fill value */
/* Close the attribute on the dataset */
- if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
+ if (H5Aclose(attr) < 0)
+ FAIL_STACK_ERROR
/* Create another attribute with same name */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
attr = H5Acreate2(dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT);
- } H5E_END_TRY;
- if(attr >= 0) {
+ }
+ H5E_END_TRY;
+ if (attr >= 0) {
H5Aclose(attr);
TEST_ERROR
} /* end if */
/* Close the dataspace for the attributes */
- if(H5Sclose(attr_space) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(attr_space) < 0)
+ FAIL_STACK_ERROR
/* Close dataset */
- if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
/* Remove the dataset */
- if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != empty_size) TEST_ERROR
+ if (file_size != empty_size)
+ TEST_ERROR
PASSED();
-
-/* Cleanup common objects */
+ /* Cleanup common objects */
/* Release dataset buffer */
HDfree(data);
/* Close property lists */
- if(H5Pclose(fapl_nocache) < 0) FAIL_STACK_ERROR
- if(H5Pclose(contig_dcpl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(early_chunk_dcpl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(late_chunk_dcpl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(comp_dcpl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(compact_dcpl) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(fapl_nocache) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(contig_dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(early_chunk_dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(late_chunk_dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(comp_dcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(compact_dcpl) < 0)
+ FAIL_STACK_ERROR
/* Close dataspace */
- if(H5Sclose(space) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
/* Indicate success */
/* Don't print final "PASSED", since we aren't on the correct line anymore */
@@ -1229,13 +1452,12 @@ test_filespace(hid_t fapl)
error:
/* Release dataset buffer */
- if(data)
+ if (data)
HDfree(data);
return 1;
} /* end test_filespace() */
-
/*-------------------------------------------------------------------------
* Function: test_create_unlink
*
@@ -1254,45 +1476,45 @@ error:
static int
test_create_unlink(const char *msg, hid_t fapl)
{
- hid_t file, group;
+ hid_t file, group;
unsigned u;
char groupname[1024];
- char filename[1024];
+ char filename[1024];
TESTING(msg);
/* Create file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_PUTS_ERROR(" Creating file failed")
/* Create a many groups to remove */
- for(u = 0; u < UNLINK_NGROUPS; u++) {
+ for (u = 0; u < UNLINK_NGROUPS; u++) {
HDsprintf(groupname, "%s %u", GROUPNAME, u);
- if((group = H5Gcreate2(file, groupname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ if ((group = H5Gcreate2(file, groupname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf("group %s creation failed\n", groupname);
goto error;
} /* end if */
- if(H5Gclose (group) < 0) {
+ if (H5Gclose(group) < 0) {
H5_FAILED();
HDprintf("closing group %s failed\n", groupname);
goto error;
} /* end if */
- } /* end for */
+ } /* end for */
/* Remove the all the groups */
- for(u = 0; u < UNLINK_NGROUPS; u++) {
+ for (u = 0; u < UNLINK_NGROUPS; u++) {
HDsprintf(groupname, "%s %u", GROUPNAME, u);
- if(H5Ldelete(file, groupname, H5P_DEFAULT) < 0) {
+ if (H5Ldelete(file, groupname, H5P_DEFAULT) < 0) {
H5_FAILED();
HDprintf("Unlinking group %s failed\n", groupname);
goto error;
} /* end if */
- } /* end for */
+ } /* end for */
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
FAIL_PUTS_ERROR("Closing file failed")
PASSED();
@@ -1302,7 +1524,6 @@ error:
return 1;
} /* end test_create_unlink() */
-
/*-------------------------------------------------------------------------
* Function: test_link_slashes
*
@@ -1321,9 +1542,9 @@ error:
static int
test_link_slashes(hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t gid, gid2; /* Group ID */
- char filename[1024];
+ hid_t fid; /* File ID */
+ hid_t gid, gid2; /* Group ID */
+ char filename[1024];
TESTING("creating links with multiple slashes");
@@ -1331,37 +1552,51 @@ test_link_slashes(hid_t fapl)
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
/* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a group in the root group */
- if((gid = H5Gcreate2(fid, SLASHES_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(fid, SLASHES_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create a nested group in the root group */
- if((gid2 = H5Gcreate2(gid, SLASHES_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(gid, SLASHES_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close the nested group */
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
/* Create a hard link to the nested group */
- if(H5Lcreate_hard(gid, SLASHES_GROUP_NAME, H5L_SAME_LOC, SLASHES_HARDLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(gid, SLASHES_GROUP_NAME, H5L_SAME_LOC, SLASHES_HARDLINK_NAME, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create a soft link with a relative path to the nested group */
- if(H5Lcreate_soft(SLASHES_GROUP_NAME, gid, SLASHES_SOFTLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft(SLASHES_GROUP_NAME, gid, SLASHES_SOFTLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create a soft link with the full path to the nested group */
- if(H5Lcreate_soft("////"SLASHES_GROUP_NAME""SLASHES_GROUP_NAME, gid, SLASHES_SOFTLINK2_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("////" SLASHES_GROUP_NAME "" SLASHES_GROUP_NAME, gid, SLASHES_SOFTLINK2_NAME,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create a soft link to the root group */
- if(H5Lcreate_soft("////", gid, SLASHES_ROOTLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("////", gid, SLASHES_ROOTLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close the group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Create a hard link to the existing group */
- if(H5Lcreate_hard(fid, SLASHES_GROUP_NAME, H5L_SAME_LOC, SLASHES_HARDLINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(fid, SLASHES_GROUP_NAME, H5L_SAME_LOC, SLASHES_HARDLINK_NAME, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
@@ -1370,7 +1605,6 @@ error:
return 1;
} /* end test_link_slashes() */
-
/*-------------------------------------------------------------------------
* Function: test_unlink_slashes
*
@@ -1389,9 +1623,9 @@ error:
static int
test_unlink_slashes(hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
- char filename[1024];
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ char filename[1024];
TESTING("deleting links with multiple slashes");
@@ -1399,37 +1633,48 @@ test_unlink_slashes(hid_t fapl)
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
/* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Open the top level group */
- if((gid = H5Gopen2(fid, SLASHES_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gopen2(fid, SLASHES_GROUP_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Delete the root link */
- if(H5Ldelete(gid,SLASHES_ROOTLINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, SLASHES_ROOTLINK_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Delete the soft link with the full path */
- if(H5Ldelete(gid,SLASHES_SOFTLINK2_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, SLASHES_SOFTLINK2_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Delete the soft link with the relative path */
- if(H5Ldelete(gid,SLASHES_SOFTLINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, SLASHES_SOFTLINK_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Delete the hard link */
- if(H5Ldelete(gid,SLASHES_HARDLINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, SLASHES_HARDLINK_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Delete the group itself */
- if(H5Ldelete(gid,SLASHES_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(gid, SLASHES_GROUP_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close the group */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Delete the hard link */
- if(H5Ldelete(fid,SLASHES_HARDLINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, SLASHES_HARDLINK_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Delete the group itself */
- if(H5Ldelete(fid,SLASHES_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, SLASHES_GROUP_NAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR
PASSED();
return 0;
@@ -1444,30 +1689,34 @@ error:
static int
delete_node(hid_t pid, hid_t id)
{
- char name[256]; /* Name of object to close */
+ char name[256]; /* Name of object to close */
/* Get the name of the object to delete */
- if(H5Iget_name(id, name, sizeof(name)) < 0) return (-1);
+ if (H5Iget_name(id, name, sizeof(name)) < 0)
+ return (-1);
/* Close the object */
- if(H5Gclose(id) < 0) return(-1);
+ if (H5Gclose(id) < 0)
+ return (-1);
/* Unlink the object */
- if(H5Ldelete(pid, name, H5P_DEFAULT) < 0) return(-1);
+ if (H5Ldelete(pid, name, H5P_DEFAULT) < 0)
+ return (-1);
/* If this object is the right-most child, try opening the previous object */
- if(HDstrcmp(name,"/Zone81") == 0) {
+ if (HDstrcmp(name, "/Zone81") == 0) {
hid_t gid;
- if((gid = H5Gopen2(pid, "/Zone80", H5P_DEFAULT)) < 0) return(-1);
- if(H5Gclose(gid) < 0) return(-1);
+ if ((gid = H5Gopen2(pid, "/Zone80", H5P_DEFAULT)) < 0)
+ return (-1);
+ if (H5Gclose(gid) < 0)
+ return (-1);
} /* end if */
/* Indicate success */
- return(0);
+ return (0);
}
-
/*-------------------------------------------------------------------------
* Function: test_unlink_rightleaf
*
@@ -1487,40 +1736,47 @@ delete_node(hid_t pid, hid_t id)
static int
test_unlink_rightleaf(hid_t fid)
{
- hid_t rootid = -1, /* Group ID for root group */
- *gids = NULL; /* Array of IDs for groups created */
- int n, /* Local index variable */
- ngroups = 150; /* Number of groups to create */
- char name[256]; /* Name of object to create */
+ hid_t rootid = -1, /* Group ID for root group */
+ *gids = NULL; /* Array of IDs for groups created */
+ int n, /* Local index variable */
+ ngroups = 150; /* Number of groups to create */
+ char name[256]; /* Name of object to create */
TESTING("deleting right-most child in non-leaf B-tree node");
/* Allocate space for the group IDs */
- if(NULL == (gids = (hid_t *)HDcalloc((size_t)ngroups, sizeof(hid_t)))) TEST_ERROR
+ if (NULL == (gids = (hid_t *)HDcalloc((size_t)ngroups, sizeof(hid_t))))
+ TEST_ERROR
- if((rootid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((rootid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create all the groups */
for (n = 0; n < ngroups; n++) {
HDsprintf(name, "Zone%d", n + 1);
- if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
} /* end for */
/* Unlink & re-create each group */
for (n = 0; n < ngroups; n++) {
- if(delete_node (rootid, gids[n]) < 0) TEST_ERROR
+ if (delete_node(rootid, gids[n]) < 0)
+ TEST_ERROR
HDsprintf(name, "Zone%d", n + 1);
- if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if ((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
} /* end for */
/* Close all the groups */
for (n = 0; n < ngroups; n++) {
- if(H5Gclose(gids[n]) < 0) TEST_ERROR
+ if (H5Gclose(gids[n]) < 0)
+ TEST_ERROR
gids[n] = 0;
} /* end for */
/* Close root group ID */
- if(H5Gclose(rootid) < 0) TEST_ERROR
+ if (H5Gclose(rootid) < 0)
+ TEST_ERROR
/* Free memory */
HDfree(gids);
@@ -1529,24 +1785,21 @@ test_unlink_rightleaf(hid_t fid)
return 0;
error:
- if(gids) {
+ if (gids) {
/* Close any open groups */
for (n = 0; n < ngroups; n++)
- if(gids[n]) {
- H5E_BEGIN_TRY {
- H5Gclose(gids[n]);
- } H5E_END_TRY;
+ if (gids[n]) {
+ H5E_BEGIN_TRY { H5Gclose(gids[n]); }
+ H5E_END_TRY;
} /* end if */
HDfree(gids);
} /* end if */
- H5E_BEGIN_TRY {
- H5Gclose(rootid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Gclose(rootid); }
+ H5E_END_TRY;
return 1;
} /* end test_unlink_rightleaf() */
-
/*-------------------------------------------------------------------------
* Function: test_unlink_rightnode
*
@@ -1566,40 +1819,50 @@ error:
static int
test_unlink_rightnode(hid_t fid)
{
- hid_t rootid = -1, /* Group ID for root group */
- *gids = NULL; /* Array of IDs for groups created */
- int n, /* Local index variable */
- ngroups = 150; /* Number of groups to create */
- char name[256]; /* Name of object to create */
+ hid_t rootid = -1, /* Group ID for root group */
+ *gids = NULL; /* Array of IDs for groups created */
+ int n, /* Local index variable */
+ ngroups = 150; /* Number of groups to create */
+ char name[256]; /* Name of object to create */
TESTING("deleting right-most child in non-leaf B-tree node");
/* Allocate space for the group IDs */
- if(NULL == (gids = (hid_t *)HDcalloc((size_t)ngroups, sizeof(hid_t)))) TEST_ERROR
+ if (NULL == (gids = (hid_t *)HDcalloc((size_t)ngroups, sizeof(hid_t))))
+ TEST_ERROR
- if((rootid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((rootid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create all the groups */
for (n = 0; n < ngroups; n++) {
HDsprintf(name, "ZoneB%d", n + 1);
- if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close all the groups */
for (n = 0; n < ngroups; n++) {
- if(H5Gclose(gids[n]) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gids[n]) < 0)
+ FAIL_STACK_ERROR
gids[n] = 0;
} /* end for */
/* Unlink specific objects to trigger deletion of right leaf in non-leaf node */
- if(H5Ldelete(fid, "/ZoneB77", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneB78", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneB79", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneB8", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneB80", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneB77", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneB78", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneB79", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneB8", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneB80", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close root group ID */
- if(H5Gclose(rootid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(rootid) < 0)
+ FAIL_STACK_ERROR
/* Free memory */
HDfree(gids);
@@ -1608,24 +1871,21 @@ test_unlink_rightnode(hid_t fid)
return 0;
error:
- if(gids) {
+ if (gids) {
/* Close any open groups */
for (n = 0; n < ngroups; n++)
- if(gids[n]) {
- H5E_BEGIN_TRY {
- H5Gclose(gids[n]);
- } H5E_END_TRY;
+ if (gids[n]) {
+ H5E_BEGIN_TRY { H5Gclose(gids[n]); }
+ H5E_END_TRY;
} /* end if */
HDfree(gids);
} /* end if */
- H5E_BEGIN_TRY {
- H5Gclose(rootid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Gclose(rootid); }
+ H5E_END_TRY;
return 1;
} /* end test_unlink_rightnode() */
-
/*-------------------------------------------------------------------------
* Function: test_unlink_middlenode
*
@@ -1645,183 +1905,336 @@ error:
static int
test_unlink_middlenode(hid_t fid)
{
- hid_t rootid = -1, /* Group ID for root group */
- *gids = NULL; /* Array of IDs for groups created */
- int n, /* Local index variable */
- ngroups = 250; /* Number of groups to create */
- char name[256]; /* Name of object to create */
+ hid_t rootid = -1, /* Group ID for root group */
+ *gids = NULL; /* Array of IDs for groups created */
+ int n, /* Local index variable */
+ ngroups = 250; /* Number of groups to create */
+ char name[256]; /* Name of object to create */
TESTING("deleting right-most child in non-leaf B-tree node");
/* Allocate space for the group IDs */
- if(NULL == (gids = (hid_t *)HDcalloc((size_t)ngroups, sizeof(hid_t)))) TEST_ERROR
+ if (NULL == (gids = (hid_t *)HDcalloc((size_t)ngroups, sizeof(hid_t))))
+ TEST_ERROR
- if((rootid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((rootid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create all the groups */
for (n = 0; n < ngroups; n++) {
HDsprintf(name, "ZoneC%d", n + 1);
- if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close all the groups */
for (n = 0; n < ngroups; n++) {
- if(H5Gclose(gids[n]) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gids[n]) < 0)
+ FAIL_STACK_ERROR
gids[n] = 0;
} /* end for */
/* Unlink specific objects to trigger deletion of all leafs in "interior" non-leaf node */
- if(H5Ldelete(fid, "/ZoneC11", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC110", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC111", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC112", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC113", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC114", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC115", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC116", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC117", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC118", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC119", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC12", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC120", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC121", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC122", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC123", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC124", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC125", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC126", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC127", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC128", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC129", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC13", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC130", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC131", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC132", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC133", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC134", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC135", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC136", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC137", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC138", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC139", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC14", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC140", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC141", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC142", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC143", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC144", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC145", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC146", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC147", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC148", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC149", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC15", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC150", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC151", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC152", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC153", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC154", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC155", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC156", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC157", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC158", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC159", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC16", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC160", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC161", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC162", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC163", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC164", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC165", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC166", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC167", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC168", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC169", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC17", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC170", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC171", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC172", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC173", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC174", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC175", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC176", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC177", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC178", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC179", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC18", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC180", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC19", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC20", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC21", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC22", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC23", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC24", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC25", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC26", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC27", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC28", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC29", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC3", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC30", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC31", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC32", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC33", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC34", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC35", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC36", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC37", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC38", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC39", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC4", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC40", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC41", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC42", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC43", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC44", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC45", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC46", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC47", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC48", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC49", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC5", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC50", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC51", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC52", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC53", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC54", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC55", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC56", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC57", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC58", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC59", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC6", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC60", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC61", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC62", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC63", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC64", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC65", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC66", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC67", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC68", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC69", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC7", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC70", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC71", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC72", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC73", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC74", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC75", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC76", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC77", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC78", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC79", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC8", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(fid, "/ZoneC80", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC11", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC110", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC111", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC112", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC113", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC114", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC115", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC116", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC117", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC118", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC119", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC12", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC120", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC121", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC122", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC123", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC124", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC125", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC126", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC127", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC128", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC129", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC13", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC130", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC131", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC132", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC133", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC134", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC135", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC136", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC137", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC138", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC139", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC14", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC140", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC141", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC142", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC143", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC144", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC145", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC146", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC147", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC148", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC149", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC15", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC150", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC151", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC152", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC153", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC154", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC155", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC156", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC157", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC158", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC159", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC16", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC160", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC161", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC162", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC163", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC164", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC165", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC166", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC167", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC168", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC169", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC17", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC170", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC171", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC172", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC173", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC174", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC175", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC176", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC177", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC178", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC179", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC18", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC180", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC19", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC2", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC20", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC21", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC22", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC23", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC24", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC25", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC26", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC27", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC28", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC29", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC3", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC30", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC31", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC32", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC33", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC34", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC35", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC36", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC37", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC38", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC39", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC4", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC40", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC41", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC42", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC43", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC44", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC45", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC46", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC47", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC48", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC49", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC5", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC50", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC51", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC52", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC53", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC54", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC55", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC56", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC57", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC58", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC59", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC6", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC60", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC61", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC62", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC63", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC64", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC65", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC66", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC67", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC68", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC69", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC7", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC70", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC71", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC72", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC73", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC74", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC75", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC76", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC77", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC78", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC79", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC8", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (H5Ldelete(fid, "/ZoneC80", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close root group ID */
- if(H5Gclose(rootid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(rootid) < 0)
+ FAIL_STACK_ERROR
/* Free memory */
HDfree(gids);
@@ -1830,24 +2243,21 @@ test_unlink_middlenode(hid_t fid)
return 0;
error:
- if(gids) {
+ if (gids) {
/* Close any open groups */
for (n = 0; n < ngroups; n++)
- if(gids[n]) {
- H5E_BEGIN_TRY {
- H5Gclose(gids[n]);
- } H5E_END_TRY;
+ if (gids[n]) {
+ H5E_BEGIN_TRY { H5Gclose(gids[n]); }
+ H5E_END_TRY;
} /* end if */
HDfree(gids);
} /* end if */
- H5E_BEGIN_TRY {
- H5Gclose(rootid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Gclose(rootid); }
+ H5E_END_TRY;
return 1;
} /* end test_unlink_middlenode() */
-
/*-------------------------------------------------------------------------
* Function: test_resurrect_dataset
*
@@ -1867,8 +2277,8 @@ error:
static int
test_resurrect_dataset(hid_t fapl)
{
- hid_t f = -1, s = -1, d = -1;
- char filename[1024];
+ hid_t f = -1, s = -1, d = -1;
+ char filename[1024];
TESTING("resurrecting dataset after deletion");
@@ -1876,49 +2286,63 @@ test_resurrect_dataset(hid_t fapl)
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
/* Create the file */
- if((f = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((f = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset in the file */
- if((s = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
- if((d = H5Dcreate2(f, DATASETNAME, H5T_NATIVE_INT, s, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Sclose(s) < 0) FAIL_STACK_ERROR
+ if ((s = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
+ if ((d = H5Dcreate2(f, DATASETNAME, H5T_NATIVE_INT, s, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(s) < 0)
+ FAIL_STACK_ERROR
/* Unlink the dataset while it's open (will mark it for deletion when closed) */
- if(H5Ldelete(f, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(f, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check that dataset name is NULL */
- if(H5Iget_name(d, NULL, (size_t)0) != 0) FAIL_STACK_ERROR
+ if (H5Iget_name(d, NULL, (size_t)0) != 0)
+ FAIL_STACK_ERROR
/* Re-link the dataset to the group hierarchy (shouldn't get deleted now) */
- if(H5Lcreate_hard(d, ".", f, DATASET2NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(d, ".", f, DATASET2NAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close things */
- if(H5Dclose(d) < 0) FAIL_STACK_ERROR
- if(H5Fclose(f) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(d) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(f) < 0)
+ FAIL_STACK_ERROR
/* Re-open the file */
- if((f = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((f = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Attempt to open the dataset under the new name */
- if((d = H5Dopen2(f, DATASET2NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((d = H5Dopen2(f, DATASET2NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close things */
- if(H5Dclose(d) < 0) FAIL_STACK_ERROR
- if(H5Fclose(f) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(d) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(f) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Sclose(s);
- H5Dclose(d);
- H5Fclose(f);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(s);
+ H5Dclose(d);
+ H5Fclose(f);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_resurrect_dataset() */
-
/*-------------------------------------------------------------------------
* Function: test_resurrect_datatype
*
@@ -1938,8 +2362,8 @@ error:
static int
test_resurrect_datatype(hid_t fapl)
{
- hid_t file = -1, type = -1;
- char filename[1024];
+ hid_t file = -1, type = -1;
+ char filename[1024];
TESTING("resurrecting datatype after deletion");
@@ -1947,47 +2371,60 @@ test_resurrect_datatype(hid_t fapl)
h5_fixname(FILENAME[7], fapl, filename, sizeof filename);
/* Create the file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a named datatype in the file */
- if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
- if(H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tcommit2(file, TYPENAME, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Unlink the datatype while it's open (will mark it for deletion when closed) */
- if(H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check that datatype name is NULL */
- if(H5Iget_name(type, NULL, (size_t)0) != 0) FAIL_STACK_ERROR
+ if (H5Iget_name(type, NULL, (size_t)0) != 0)
+ FAIL_STACK_ERROR
/* Re-link the datatype to the group hierarchy (shouldn't get deleted now) */
- if(H5Lcreate_hard(type, ".", file, TYPE2NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(type, ".", file, TYPE2NAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close things */
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Attempt to open the datatype under the new name */
- if((type = H5Topen2(file,TYPE2NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((type = H5Topen2(file, TYPE2NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close things */
- if(H5Tclose(type) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Tclose(type) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Tclose(type);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(type);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_resurrect_datatype() */
-
/*-------------------------------------------------------------------------
* Function: test_resurrect_group
*
@@ -2007,8 +2444,8 @@ error:
static int
test_resurrect_group(hid_t fapl)
{
- hid_t file = -1, group = -1;
- char filename[1024];
+ hid_t file = -1, group = -1;
+ char filename[1024];
TESTING("resurrecting group after deletion");
@@ -2016,46 +2453,58 @@ test_resurrect_group(hid_t fapl)
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
/* Create the file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create a group in the file */
- if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Unlink the group while it's open (will mark it for deletion when closed) */
- if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check that group's name is NULL */
- if(H5Iget_name(group, NULL, (size_t)0) != 0) FAIL_STACK_ERROR
+ if (H5Iget_name(group, NULL, (size_t)0) != 0)
+ FAIL_STACK_ERROR
/* Re-link the group into the group hierarchy (shouldn't get deleted now) */
- if(H5Lcreate_hard(group, ".", file, GROUP2NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(group, ".", file, GROUP2NAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close things */
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/* Re-open the file */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Attempt to open the datatype under the new name */
- if((group = H5Gopen2(file, GROUP2NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((group = H5Gopen2(file, GROUP2NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close things */
- if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(group);
- H5Fclose(file);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(group);
+ H5Fclose(file);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_resurrect_group() */
-
/*-------------------------------------------------------------------------
* Function: test_unlink_chunked_dataset
*
@@ -2074,14 +2523,14 @@ error:
static int
test_unlink_chunked_dataset(hid_t fapl)
{
- hid_t file_id = -1;
- hid_t dset_id = -1;
- hid_t space_id = -1;
- hid_t dcpl_id = -1;
- hsize_t dims[FILESPACE_NDIMS] = {FILESPACE_DIM0, FILESPACE_DIM1, FILESPACE_DIM2};
- hsize_t max_dims[FILESPACE_NDIMS] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED};
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t space_id = -1;
+ hid_t dcpl_id = -1;
+ hsize_t dims[FILESPACE_NDIMS] = {FILESPACE_DIM0, FILESPACE_DIM1, FILESPACE_DIM2};
+ hsize_t max_dims[FILESPACE_NDIMS] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk_dims[FILESPACE_NDIMS] = {FILESPACE_CHUNK0, FILESPACE_CHUNK1, FILESPACE_CHUNK2};
- char filename[1024];
+ char filename[1024];
TESTING("unlinking chunked dataset");
@@ -2089,58 +2538,73 @@ test_unlink_chunked_dataset(hid_t fapl)
h5_fixname(FILENAME[9], fapl, filename, sizeof filename);
/* Create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataspace */
- if((space_id = H5Screate_simple(FILESPACE_NDIMS, dims, max_dims)) < 0) FAIL_STACK_ERROR
+ if ((space_id = H5Screate_simple(FILESPACE_NDIMS, dims, max_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset creation filter */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set to chunked storage */
- if(H5Pset_chunk(dcpl_id, FILESPACE_NDIMS, chunk_dims) < 0) FAIL_STACK_ERROR
+ if (H5Pset_chunk(dcpl_id, FILESPACE_NDIMS, chunk_dims) < 0)
+ FAIL_STACK_ERROR
/* Set to early space allocation */
- if(H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0) FAIL_STACK_ERROR
+ if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dset_id = H5Dcreate2(file_id, DATASETNAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((dset_id = H5Dcreate2(file_id, DATASETNAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_id,
+ H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close the dataspace */
- if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(space_id) < 0)
+ FAIL_STACK_ERROR
/* Close the dataset creation property list */
- if(H5Pclose(dcpl_id) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(dcpl_id) < 0)
+ FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
+ if (H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Delete the dataset */
- if(H5Ldelete(file_id, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, DATASETNAME, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(dcpl_id);
- H5Sclose(space_id);
- H5Dclose(dset_id);
- H5Fclose(file_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dcpl_id);
+ H5Sclose(space_id);
+ H5Dclose(dset_id);
+ H5Fclose(file_id);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_unlink_chunked_dataset() */
-
/*-------------------------------------------------------------------------
* Function: test_full_group_compact
*
@@ -2157,15 +2621,15 @@ error:
static int
test_full_group_compact(hid_t fapl)
{
- hid_t file_id = -1;
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5O_info2_t oi; /* Stat buffer for object */
- char objname[128]; /* Buffer for name of objects to create */
- char objname2[128]; /* Buffer for name of objects to create */
- char filename[1024]; /* Buffer for filename */
- h5_stat_size_t keep_size; /* Size of the file with objects to keep */
- h5_stat_size_t file_size; /* Size of each file created */
- unsigned u; /* Local index variable */
+ hid_t file_id = -1;
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5O_info2_t oi; /* Stat buffer for object */
+ char objname[128]; /* Buffer for name of objects to create */
+ char objname2[128]; /* Buffer for name of objects to create */
+ char filename[1024]; /* Buffer for filename */
+ h5_stat_size_t keep_size; /* Size of the file with objects to keep */
+ h5_stat_size_t file_size; /* Size of each file created */
+ unsigned u; /* Local index variable */
TESTING("unlinking non-empty compact group");
@@ -2173,107 +2637,135 @@ test_full_group_compact(hid_t fapl)
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create group to link objects to */
- if((gid = H5Gcreate2(file_id, "/keep", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(file_id, "/keep", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create several objects to link to */
- for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "keep %u\n", u);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close group with objects to keep */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file with only the objects to keep */
- if((keep_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((keep_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create group to delete */
- if((gid = H5Gcreate2(file_id, "/delete", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(file_id, "/delete", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create external link (doesn't matter if it dangles) */
- if(H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create soft link (doesn't matter if it dangles) */
- if(H5Lcreate_soft("/foo", gid, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/foo", gid, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create hard links to objects in group to keep */
- for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
HDsprintf(objname2, "keep %u\n", u);
- if(H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Create several objects to delete */
- for(u = 0; u < FULL_GROUP_NUM_DELETE_COMPACT; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_DELETE_COMPACT; u++) {
HDsprintf(objname, "delete %u\n", u);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Check on group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) != TRUE) TEST_ERROR
- if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) != TRUE)
+ TEST_ERROR
+ if (H5G__has_stab_test(gid) == TRUE)
+ TEST_ERROR
/* Close group with objects to delete */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Check reference count on objects to keep */
- for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
- if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(oi.rc != 2) TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (oi.rc != 2)
+ TEST_ERROR
} /* end for */
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
-
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Delete the full group */
- if(H5Ldelete(file_id, "/delete", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, "/delete", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check reference count on objects to keep */
- for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
- if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(oi.rc != 1) TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (oi.rc != 1)
+ TEST_ERROR
} /* end for */
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != keep_size) TEST_ERROR
+ if (file_size != keep_size)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(file_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(file_id);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_full_group_compact() */
-
/*-------------------------------------------------------------------------
* Function: test_full_group_dense
*
@@ -2290,16 +2782,16 @@ error:
static int
test_full_group_dense(hid_t fapl)
{
- hid_t file_id = -1;
- hid_t gcpl = (-1); /* Group creation property list ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5O_info2_t oi; /* Stat buffer for object */
- char objname[128]; /* Buffer for name of objects to create */
- char objname2[128]; /* Buffer for name of objects to create */
- char filename[1024]; /* Buffer for filename */
- h5_stat_size_t keep_size; /* Size of the file with objects to keep */
- h5_stat_size_t file_size; /* Size of each file created */
- unsigned u; /* Local index variable */
+ hid_t file_id = -1;
+ hid_t gcpl = (-1); /* Group creation property list ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5O_info2_t oi; /* Stat buffer for object */
+ char objname[128]; /* Buffer for name of objects to create */
+ char objname2[128]; /* Buffer for name of objects to create */
+ char filename[1024]; /* Buffer for filename */
+ h5_stat_size_t keep_size; /* Size of the file with objects to keep */
+ h5_stat_size_t file_size; /* Size of each file created */
+ unsigned u; /* Local index variable */
TESTING("unlinking non-empty dense group");
@@ -2307,33 +2799,43 @@ test_full_group_dense(hid_t fapl)
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create group to link objects to */
- if((gid = H5Gcreate2(file_id, "/keep", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(file_id, "/keep", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create several objects to link to */
- for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "keep %u\n", u);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Close group with objects to keep */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file with only the objects to keep */
- if((keep_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((keep_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Set group creation "est. link info" closer to what will actually occur */
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR
- if(H5Pset_est_link_info(gcpl, FULL_GROUP_EST_NUM_ENTRIES, FULL_GROUP_EST_ENTRY_LEN) < 0) FAIL_STACK_ERROR
+ if ((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pset_est_link_info(gcpl, FULL_GROUP_EST_NUM_ENTRIES, FULL_GROUP_EST_ENTRY_LEN) < 0)
+ FAIL_STACK_ERROR
/* Create group to delete */
/* (use non-default GCPL, in order to make certain that the group's object
@@ -2341,86 +2843,107 @@ test_full_group_dense(hid_t fapl)
* another object header message chunk - in order to make the file size
* computation below easier/correct - QAK)
*/
- if((gid = H5Gcreate2(file_id, "/delete", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if ((gid = H5Gcreate2(file_id, "/delete", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) FAIL_STACK_ERROR
+ if (H5Pclose(gcpl) < 0)
+ FAIL_STACK_ERROR
/* Create external link (doesn't matter if it dangles) */
- if(H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create soft link (doesn't matter if it dangles) */
- if(H5Lcreate_soft("/foo", gid, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_soft("/foo", gid, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Create hard links to objects in group to keep */
- for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
HDsprintf(objname2, "keep %u\n", u);
- if(H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Create several objects to delete */
- for(u = 0; u < FULL_GROUP_NUM_DELETE_DENSE; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_DELETE_DENSE; u++) {
HDsprintf(objname, "delete %u\n", u);
- if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
+ if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
} /* end for */
/* Check on group's status */
- if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR
- if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
+ if (H5G__is_empty_test(gid) == TRUE)
+ TEST_ERROR
+ if (H5G__has_links_test(gid, NULL) == TRUE)
+ TEST_ERROR
+ if (H5G__is_new_dense_test(gid) != TRUE)
+ TEST_ERROR
/* Close group with objects to delete */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if (H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
/* Check reference count on objects to keep */
- for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
- if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(oi.rc != 2) TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (oi.rc != 2)
+ TEST_ERROR
} /* end for */
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
-
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if ((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Delete the full group */
- if(H5Ldelete(file_id, "/delete", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if (H5Ldelete(file_id, "/delete", H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Check reference count on objects to keep */
- for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
+ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
- if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(oi.rc != 1) TEST_ERROR
+ if (H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ if (oi.rc != 1)
+ TEST_ERROR
} /* end for */
/* Close the file */
- if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
/* Get the size of the file */
- if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
+ if ((file_size = h5_get_file_size(filename, fapl)) < 0)
+ TEST_ERROR
/* Verify the file is correct size */
- if(file_size != keep_size) TEST_ERROR
+ if (file_size != keep_size)
+ TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid2);
+ H5Gclose(gid);
H5Pclose(gcpl);
- H5Fclose(file_id);
- } H5E_END_TRY;
+ H5Fclose(file_id);
+ }
+ H5E_END_TRY;
return 1;
} /* end test_full_group_dense() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2437,12 +2960,12 @@ int
main(void)
{
hid_t fapl, fapl2, file;
- int nerrors = 0;
- char filename[1024];
- unsigned new_format;
+ int nerrors = 0;
+ char filename[1024];
+ unsigned new_format;
/* Metadata cache parameters */
- int mdc_nelmts;
+ int mdc_nelmts;
size_t rdcc_nelmts;
size_t rdcc_nbytes;
double rdcc_w0;
@@ -2455,17 +2978,19 @@ main(void)
fapl = h5_fileaccess();
/* Copy the file access property list */
- if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((fapl2 = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
/* Test with old & new format groups */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl;
/* Set the FAPL for the type of format */
- if(new_format) {
+ if (new_format) {
HDputs("\nTesting with new group format:");
my_fapl = fapl2;
} /* end if */
@@ -2475,7 +3000,8 @@ main(void)
} /* end else */
h5_fixname(FILENAME[0], my_fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
/* Tests */
nerrors += test_one(file);
@@ -2494,22 +3020,24 @@ main(void)
hid_t fapl_small_mdc;
/* Make copy of regular fapl, to turn down the elements in the metadata cache */
- if((fapl_small_mdc = H5Pcopy(my_fapl)) < 0)
+ if ((fapl_small_mdc = H5Pcopy(my_fapl)) < 0)
goto error;
/* Get FAPL cache settings */
- if(H5Pget_cache(fapl_small_mdc, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
+ if (H5Pget_cache(fapl_small_mdc, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
HDprintf("H5Pget_cache failed\n");
/* Change FAPL cache settings */
- mdc_nelmts=1;
- if(H5Pset_cache(fapl_small_mdc, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
+ mdc_nelmts = 1;
+ if (H5Pset_cache(fapl_small_mdc, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
HDprintf("H5Pset_cache failed\n");
/* Test creating & unlinking lots of objects with a 1-element metadata cache FAPL */
- nerrors += test_create_unlink("create and unlink large number of objects with small cache", fapl_small_mdc);
+ nerrors += test_create_unlink("create and unlink large number of objects with small cache",
+ fapl_small_mdc);
- if(H5Pclose(fapl_small_mdc) < 0) TEST_ERROR
+ if (H5Pclose(fapl_small_mdc) < 0)
+ TEST_ERROR
} /* end block */
nerrors += test_link_slashes(my_fapl);
@@ -2517,7 +3045,7 @@ main(void)
/* Test specific B-tree removal issues */
/* (only for old format groups) */
- if(!new_format) {
+ if (!new_format) {
nerrors += test_unlink_rightleaf(file);
nerrors += test_unlink_rightnode(file);
nerrors += test_unlink_middlenode(file);
@@ -2533,13 +3061,14 @@ main(void)
/* Test unlinked groups which still have objects in them */
/* (only for new format groups) */
- if(new_format) {
+ if (new_format) {
nerrors += test_full_group_compact(my_fapl);
nerrors += test_full_group_dense(my_fapl);
} /* end if */
/* Close */
- if(H5Fclose(file) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0)
+ TEST_ERROR
} /* end for */
/* Close 2nd FAPL */
@@ -2549,7 +3078,7 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
if (nerrors) {
- HDprintf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S");
+ HDprintf("***** %d FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
}
@@ -2562,4 +3091,3 @@ main(void)
error:
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/unregister.c b/test/unregister.c
index a2a507d..775da82 100644
--- a/test/unregister.c
+++ b/test/unregister.c
@@ -17,40 +17,35 @@
*/
#include "h5test.h"
-#include "H5CXprivate.h" /* API Contexts */
+#include "H5CXprivate.h" /* API Contexts */
-const char *FILENAME[] = {
- "unregister_filter_1",
- "unregister_filter_2",
- NULL
-};
+const char *FILENAME[] = {"unregister_filter_1", "unregister_filter_2", NULL};
-#define GROUP_NAME "test_group"
-#define DSET_NAME "test_dataset"
-#define FILENAME_BUF_SIZE 1024
-#define DSET_DIM1 100
-#define DSET_DIM2 200
-#define FILTER_CHUNK_DIM1 2
-#define FILTER_CHUNK_DIM2 25
-#define GROUP_ITERATION 1000
+#define GROUP_NAME "test_group"
+#define DSET_NAME "test_dataset"
+#define FILENAME_BUF_SIZE 1024
+#define DSET_DIM1 100
+#define DSET_DIM2 200
+#define FILTER_CHUNK_DIM1 2
+#define FILTER_CHUNK_DIM2 25
+#define GROUP_ITERATION 1000
-#define H5Z_FILTER_DUMMY 312
+#define H5Z_FILTER_DUMMY 312
-static size_t do_nothing(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t do_nothing(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
/* Dummy filter for test_unregister_filters only */
const H5Z_class2_t H5Z_DUMMY[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DUMMY, /* Filter ID number */
- 1, 1, /* Encoding and decoding enabled */
- "dummy", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- do_nothing, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DUMMY, /* Filter ID number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dummy", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ do_nothing, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: do_nothing
*
@@ -64,8 +59,8 @@ const H5Z_class2_t H5Z_DUMMY[1] = {{
*/
static size_t
do_nothing(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
+ void H5_ATTR_UNUSED **buf)
{
return nbytes;
}
@@ -82,41 +77,41 @@ do_nothing(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
static herr_t
test_unregister_filters(hid_t fapl_id)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t dcpl_id = H5I_INVALID_HID;
- hid_t gcpl_id = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t gid_loop = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- int i, j, n;
- char group_name[32];
- char filename[FILENAME_BUF_SIZE];
- const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
- hsize_t dims[2];
- int **buf = NULL;
- int *buf_data = NULL;
- herr_t ret;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t gcpl_id = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t gid_loop = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ int i, j, n;
+ char group_name[32];
+ char filename[FILENAME_BUF_SIZE];
+ const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
+ hsize_t dims[2];
+ int ** buf = NULL;
+ int * buf_data = NULL;
+ herr_t ret;
TESTING("Unregistering filter");
/* Set up data array */
- if(NULL == (buf_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ if (NULL == (buf_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
TEST_ERROR;
- if(NULL == (buf = (int **)HDcalloc(DSET_DIM1, sizeof(buf_data))))
+ if (NULL == (buf = (int **)HDcalloc(DSET_DIM1, sizeof(buf_data))))
TEST_ERROR;
for (i = 0; i < DSET_DIM1; i++)
buf[i] = buf_data + (i * DSET_DIM2);
/* Create first file */
h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
- if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
goto error;
/* Create second file */
h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
- if((fid2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
goto error;
/* Register DUMMY filter */
@@ -130,44 +125,43 @@ test_unregister_filters(hid_t fapl_id)
*******************/
/* Use DUMMY filter for creating groups */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
goto error;
- if(H5Pset_filter(gcpl_id, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0)
+ if (H5Pset_filter(gcpl_id, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0)
goto error;
/* Create a group using this filter */
- if((gid = H5Gcreate2(fid1, GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid1, GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto error;
/* Create multiple groups under the main group */
- for(i = 0; i < GROUP_ITERATION; i++) {
+ for (i = 0; i < GROUP_ITERATION; i++) {
HDsprintf(group_name, "group_%d", i);
- if((gid_loop = H5Gcreate2(gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid_loop = H5Gcreate2(gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Gclose(gid_loop) < 0)
+ if (H5Gclose(gid_loop) < 0)
goto error;
}
/* Flush the file containing the groups */
- if(H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0)
goto error;
/* Unregister the filter before closing the group. It should fail */
- H5E_BEGIN_TRY {
- ret = H5Zunregister(H5Z_FILTER_DUMMY);
- } H5E_END_TRY;
- if(ret >= 0) {
+ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__);
goto error;
}
/* Close the group */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto error;
/* Clean up objects used for this test */
- if(H5Pclose (gcpl_id) < 0)
+ if (H5Pclose(gcpl_id) < 0)
goto error;
/*********************
@@ -175,70 +169,69 @@ test_unregister_filters(hid_t fapl_id)
*********************/
/* Use DUMMY filter for creating datasets */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0)
goto error;
- if(H5Pset_filter(dcpl_id, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0)
+ if (H5Pset_filter(dcpl_id, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0)
goto error;
/* Initialize the data for writing */
- for(i = n = 0; i < DSET_DIM1; i++)
- for(j = 0; j < DSET_DIM2; j++)
+ for (i = n = 0; i < DSET_DIM1; i++)
+ for (j = 0; j < DSET_DIM2; j++)
buf[i][j] = n++;
/* Create the dataspace */
dims[0] = DSET_DIM1;
dims[1] = DSET_DIM2;
- if((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
goto error;
/* Create a dataset in the first file */
- if((did = H5Dcreate2(fid1, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid1, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
goto error;
/* Unregister the filter before closing the dataset. It should fail */
- H5E_BEGIN_TRY {
- ret = H5Zunregister(H5Z_FILTER_DUMMY);
- } H5E_END_TRY;
- if(ret >= 0) {
+ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); }
+ H5E_END_TRY;
+ if (ret >= 0) {
H5_FAILED();
HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__);
goto error;
}
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
/* Create a dataset in the second file */
- if((did = H5Dcreate2(fid2, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid2, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
goto error;
/* Close the dataset in the second file */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
/* Unregister the filter after closing all objects but before closing files.
* It should flush all files.
*/
- if(H5Zunregister(H5Z_FILTER_DUMMY) < 0)
+ if (H5Zunregister(H5Z_FILTER_DUMMY) < 0)
goto error;
/* Clean up objects used for this test */
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
goto error;
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
goto error;
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
goto error;
HDfree(buf);
@@ -248,7 +241,8 @@ test_unregister_filters(hid_t fapl_id)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid1);
H5Fclose(fid2);
H5Pclose(dcpl_id);
@@ -257,7 +251,8 @@ error:
H5Gclose(gid_loop);
H5Dclose(did);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
HDfree(buf_data);
@@ -265,7 +260,6 @@ error:
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -278,20 +272,21 @@ error:
int
main(void)
{
- hid_t fapl_id = H5I_INVALID_HID;
- int nerrors = 0;
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t fapl_id = H5I_INVALID_HID;
+ int nerrors = 0;
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Testing setup */
h5_reset();
fapl_id = h5_fileaccess();
/* Push API context */
- if(H5CX_push() < 0) FAIL_STACK_ERROR
+ if (H5CX_push() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = TRUE;
/* Test unregistering filter in its own file */
- nerrors += (test_unregister_filters(fapl_id) < 0 ? 1 : 0);
+ nerrors += (test_unregister_filters(fapl_id) < 0 ? 1 : 0);
h5_cleanup(FILENAME, fapl_id);
@@ -300,19 +295,18 @@ main(void)
HDprintf("All filter unregistration tests passed.\n");
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if (api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
-
HDexit(EXIT_SUCCESS);
error:
nerrors = MAX(1, nerrors);
- HDprintf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/test/use.h b/test/use.h
index 52537d6..0ea86e2d 100644
--- a/test/use.h
+++ b/test/use.h
@@ -16,46 +16,52 @@
#include "h5test.h"
/* Macro definitions */
-#define Hgoto_error(val) {ret_value=val; goto done;}
-#define Hgoto_done {goto done;}
-#define Chunksize_DFT 256 /* chunksize default */
-#define ErrorReportMax 10 /* max number of errors reported */
+#define Hgoto_error(val) \
+ { \
+ ret_value = val; \
+ goto done; \
+ }
+#define Hgoto_done \
+ { \
+ goto done; \
+ }
+#define Chunksize_DFT 256 /* chunksize default */
+#define ErrorReportMax 10 /* max number of errors reported */
/* these two definitions must match each other */
-#define UC_DATATYPE H5T_NATIVE_SHORT /* use case HDF5 data type */
-#define UC_CTYPE short /* use case C data type */
-#define UC_RANK 3 /* use case dataset rank */
+#define UC_DATATYPE H5T_NATIVE_SHORT /* use case HDF5 data type */
+#define UC_CTYPE short /* use case C data type */
+#define UC_RANK 3 /* use case dataset rank */
/* Name of message file that is sent by the writer */
-#define WRITER_MESSAGE "USE_WRITER_MESSAGE"
+#define WRITER_MESSAGE "USE_WRITER_MESSAGE"
/* type declarations */
typedef enum part_t {
- UC_READWRITE = 0, /* both writer and reader */
- UC_WRITER, /* writer only */
- UC_READER /* reader only */
+ UC_READWRITE = 0, /* both writer and reader */
+ UC_WRITER, /* writer only */
+ UC_READER /* reader only */
} part_t;
typedef struct options_t {
- hsize_t chunksize; /* chunks are chunksize^2 planes */
- hsize_t chunkplanes; /* number of planes per chunk, default 1 */
- hsize_t chunkdims[UC_RANK]; /* chunk dims is (chunkplan, chunksize, chunksize) */
- hsize_t dims[UC_RANK]; /* dataset initial dims */
- hsize_t max_dims[UC_RANK]; /* dataset max dims */
- hsize_t nplanes; /* number of planes to write, default proportional to chunksize */
- char *filename; /* use case data filename */
- part_t launch; /* launch writer, reader or both */
- hbool_t use_swmr; /* use swmr open (1) or not */
- int iterations; /* iterations, default 1 */
- hid_t fapl_id; /* instance-specific FAPL ID */
- const char *progname; /* Program name (used in usage and dset name) */
+ hsize_t chunksize; /* chunks are chunksize^2 planes */
+ hsize_t chunkplanes; /* number of planes per chunk, default 1 */
+ hsize_t chunkdims[UC_RANK]; /* chunk dims is (chunkplan, chunksize, chunksize) */
+ hsize_t dims[UC_RANK]; /* dataset initial dims */
+ hsize_t max_dims[UC_RANK]; /* dataset max dims */
+ hsize_t nplanes; /* number of planes to write, default proportional to chunksize */
+ char * filename; /* use case data filename */
+ part_t launch; /* launch writer, reader or both */
+ hbool_t use_swmr; /* use swmr open (1) or not */
+ int iterations; /* iterations, default 1 */
+ hid_t fapl_id; /* instance-specific FAPL ID */
+ const char *progname; /* Program name (used in usage and dset name) */
} options_t;
/* prototype declarations */
-int parse_option(int argc, char * const argv[], options_t * opts);
-int setup_parameters(int argc, char * const argv[], options_t * opts);
-void show_parameters(options_t * opts);
+int parse_option(int argc, char *const argv[], options_t *opts);
+int setup_parameters(int argc, char *const argv[], options_t *opts);
+void show_parameters(options_t *opts);
void usage(const char *prog);
-int create_uc_file(options_t * opts);
-int write_uc_file(hbool_t tosend, hid_t file_id, options_t * opts);
-int read_uc_file(hbool_t towait, options_t * opts);
-
+int create_uc_file(options_t *opts);
+int write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts);
+int read_uc_file(hbool_t towait, options_t *opts);
diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c
index 8fcf0d3..349ab24 100644
--- a/test/use_append_chunk.c
+++ b/test/use_append_chunk.c
@@ -77,23 +77,23 @@ static options_t UC_opts; /* Use Case Options */
* Return: 0 succeed; -1 fail.
*/
int
-setup_parameters(int argc, char * const argv[], options_t * opts)
+setup_parameters(int argc, char *const argv[], options_t *opts)
{
/* use case defaults */
HDmemset(opts, 0, sizeof(options_t));
- opts->chunksize = Chunksize_DFT;
- opts->use_swmr = TRUE; /* use swmr open */
- opts->iterations = 1;
+ opts->chunksize = Chunksize_DFT;
+ opts->use_swmr = TRUE; /* use swmr open */
+ opts->iterations = 1;
opts->chunkplanes = 1;
- opts->progname = USE_APPEND_CHUNK_PROGNAME;
+ opts->progname = USE_APPEND_CHUNK_PROGNAME;
if (parse_option(argc, argv, opts) < 0)
- return(-1);
+ return (-1);
opts->chunkdims[0] = opts->chunkplanes;
opts->chunkdims[1] = opts->chunkdims[2] = opts->chunksize;
- opts->dims[0] = 0;
+ opts->dims[0] = 0;
opts->max_dims[0] = H5S_UNLIMITED;
opts->dims[1] = opts->dims[2] = opts->max_dims[1] = opts->max_dims[2] = opts->chunksize;
@@ -101,10 +101,9 @@ setup_parameters(int argc, char * const argv[], options_t * opts)
opts->nplanes = (hsize_t)opts->chunksize;
show_parameters(opts);
- return(0);
+ return (0);
} /* setup_parameters() */
-
/* Overall Algorithm:
* Parse options from user;
* Generate/pre-created test files needed and close it;
@@ -115,15 +114,15 @@ setup_parameters(int argc, char * const argv[], options_t * opts)
int
main(int argc, char *argv[])
{
- pid_t childpid=0;
- pid_t mypid, tmppid;
- int child_status;
- int child_wait_option=0;
- int ret_value = 0;
- int child_ret_value;
+ pid_t childpid = 0;
+ pid_t mypid, tmppid;
+ int child_status;
+ int child_wait_option = 0;
+ int ret_value = 0;
+ int child_ret_value;
hbool_t send_wait = FALSE;
- hid_t fapl = -1; /* File access property list */
- hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ hid_t fid = -1; /* File ID */
if (setup_parameters(argc, argv, &UC_opts) < 0) {
Hgoto_error(1);
@@ -156,7 +155,8 @@ main(int argc, char *argv[])
if (create_uc_file(&UC_opts) < 0) {
HDfprintf(stderr, "***encounter error\n");
Hgoto_error(1);
- } else {
+ }
+ else {
HDprintf("File created.\n");
}
/* Close FAPL to prevent issues with forking later */
@@ -219,7 +219,8 @@ main(int argc, char *argv[])
}
}
- if ((fid = H5Fopen(UC_opts.filename, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) {
+ if ((fid = H5Fopen(UC_opts.filename, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) <
+ 0) {
HDfprintf(stderr, "H5Fopen failed\n");
Hgoto_error(1);
}
@@ -250,11 +251,11 @@ main(int argc, char *argv[])
if (WIFEXITED(child_status)) {
if ((child_ret_value = WEXITSTATUS(child_status)) != 0) {
- HDprintf("%d: child process exited with non-zero code (%d)\n",
- mypid, child_ret_value);
+ HDprintf("%d: child process exited with non-zero code (%d)\n", mypid, child_ret_value);
Hgoto_error(2);
}
- } else {
+ }
+ else {
HDprintf("%d: child process terminated abnormally\n", mypid);
Hgoto_error(2);
}
@@ -263,11 +264,12 @@ main(int argc, char *argv[])
done:
if (ret_value != 0) {
HDprintf("Error(s) encountered\n");
- } else {
+ }
+ else {
HDprintf("All passed\n");
}
- return(ret_value);
+ return (ret_value);
}
#else /* H5_HAVE_FORK */
@@ -280,4 +282,3 @@ main(void)
} /* end main() */
#endif /* H5_HAVE_FORK */
-
diff --git a/test/use_append_chunk_mirror.c b/test/use_append_chunk_mirror.c
index 6ee01c0..4b7845d 100644
--- a/test/use_append_chunk_mirror.c
+++ b/test/use_append_chunk_mirror.c
@@ -106,9 +106,9 @@
#if CONNECT_WITH_JELLY
#define SERVER_IP "10.10.10.248" /* hard-coded IP address */
#else
-#define SERVER_IP "127.0.0.1" /* localhost */
-#endif /* CONNECT_WITH_JELLY */
-#define SERVER_PORT 3000 /* hard-coded port number */
+#define SERVER_IP "127.0.0.1" /* localhost */
+#endif /* CONNECT_WITH_JELLY */
+#define SERVER_PORT 3000 /* hard-coded port number */
#define MIRROR_FILE_NAME "shinano.h5" /* hard-coded duplicate/mirror filename */
static options_t UC_opts; /* Use Case Options */
@@ -117,23 +117,23 @@ static options_t UC_opts; /* Use Case Options */
* Return: 0 succeed; -1 fail.
*/
int
-setup_parameters(int argc, char * const argv[], options_t * opts)
+setup_parameters(int argc, char *const argv[], options_t *opts)
{
/* use case defaults */
HDmemset(opts, 0, sizeof(options_t));
- opts->chunksize = Chunksize_DFT;
- opts->use_swmr = TRUE;
- opts->iterations = 1;
+ opts->chunksize = Chunksize_DFT;
+ opts->use_swmr = TRUE;
+ opts->iterations = 1;
opts->chunkplanes = 1;
- opts->progname = THIS_PROGNAME;
+ opts->progname = THIS_PROGNAME;
if (parse_option(argc, argv, opts) < 0)
- return(-1);
+ return (-1);
opts->chunkdims[0] = opts->chunkplanes;
opts->chunkdims[1] = opts->chunkdims[2] = opts->chunksize;
- opts->dims[0] = 0;
+ opts->dims[0] = 0;
opts->max_dims[0] = H5S_UNLIMITED;
opts->dims[1] = opts->dims[2] = opts->max_dims[1] = opts->max_dims[2] = opts->chunksize;
@@ -141,10 +141,9 @@ setup_parameters(int argc, char * const argv[], options_t * opts)
opts->nplanes = (hsize_t)opts->chunksize;
show_parameters(opts);
- return(0);
+ return (0);
} /* setup_parameters() */
-
/* Overall Algorithm:
* Parse options from user;
* Generate/pre-created test files needed and close it;
@@ -155,17 +154,17 @@ setup_parameters(int argc, char * const argv[], options_t * opts)
int
main(int argc, char *argv[])
{
- pid_t childpid=0;
- pid_t mypid, tmppid;
- int child_status;
- int child_wait_option=0;
- int ret_value = 0;
- int child_ret_value;
- hbool_t send_wait = FALSE;
- hid_t fid = -1; /* File ID */
- H5FD_mirror_fapl_t mirr_fa;
+ pid_t childpid = 0;
+ pid_t mypid, tmppid;
+ int child_status;
+ int child_wait_option = 0;
+ int ret_value = 0;
+ int child_ret_value;
+ hbool_t send_wait = FALSE;
+ hid_t fid = -1; /* File ID */
+ H5FD_mirror_fapl_t mirr_fa;
H5FD_splitter_vfd_config_t split_fa;
- hid_t mirr_fapl_id = H5I_INVALID_HID;
+ hid_t mirr_fapl_id = H5I_INVALID_HID;
if (setup_parameters(argc, argv, &UC_opts) < 0) {
Hgoto_error(1);
@@ -176,7 +175,6 @@ main(int argc, char *argv[])
mirr_fa.handshake_port = SERVER_PORT;
HDstrncpy(mirr_fa.remote_ip, SERVER_IP, H5FD_MIRROR_MAX_IP_LEN);
-
split_fa.wo_fapl_id = H5I_INVALID_HID;
split_fa.rw_fapl_id = H5I_INVALID_HID;
split_fa.magic = H5FD_SPLITTER_MAGIC;
@@ -215,9 +213,9 @@ main(int argc, char *argv[])
}
/* Prepare parent "splitter" driver in UC_opts */
- split_fa.wo_fapl_id = mirr_fapl_id;
- split_fa.rw_fapl_id = H5P_DEFAULT;
- UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ split_fa.wo_fapl_id = mirr_fapl_id;
+ split_fa.rw_fapl_id = H5P_DEFAULT;
+ UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
if (UC_opts.fapl_id == H5I_INVALID_HID) {
HDfprintf(stderr, "can't create creation FAPL\n");
Hgoto_error(1);
@@ -237,7 +235,8 @@ main(int argc, char *argv[])
if (create_uc_file(&UC_opts) < 0) {
HDfprintf(stderr, "***encounter error\n");
Hgoto_error(1);
- } else {
+ }
+ else {
HDprintf("File created.\n");
}
@@ -303,9 +302,9 @@ main(int argc, char *argv[])
}
/* Prepare parent "splitter" driver in UC_opts */
- split_fa.wo_fapl_id = mirr_fapl_id;
- split_fa.rw_fapl_id = H5P_DEFAULT;
- UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ split_fa.wo_fapl_id = mirr_fapl_id;
+ split_fa.rw_fapl_id = H5P_DEFAULT;
+ UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
if (UC_opts.fapl_id == H5I_INVALID_HID) {
HDfprintf(stderr, "can't create creation FAPL\n");
Hgoto_error(1);
@@ -323,7 +322,8 @@ main(int argc, char *argv[])
}
}
- if ((fid = H5Fopen(UC_opts.filename, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), UC_opts.fapl_id)) < 0) {
+ if ((fid = H5Fopen(UC_opts.filename, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0),
+ UC_opts.fapl_id)) < 0) {
HDfprintf(stderr, "H5Fopen failed\n");
Hgoto_error(1);
}
@@ -359,11 +359,11 @@ main(int argc, char *argv[])
if (WIFEXITED(child_status)) {
if ((child_ret_value = WEXITSTATUS(child_status)) != 0) {
- HDprintf("%d: child process exited with non-zero code (%d)\n",
- mypid, child_ret_value);
+ HDprintf("%d: child process exited with non-zero code (%d)\n", mypid, child_ret_value);
Hgoto_error(2);
}
- } else {
+ }
+ else {
HDprintf("%d: child process terminated abnormally\n", mypid);
Hgoto_error(2);
}
@@ -372,11 +372,12 @@ main(int argc, char *argv[])
done:
if (ret_value != 0) {
HDprintf("Error(s) encountered\n");
- } else {
+ }
+ else {
HDprintf("All passed\n");
}
- return(ret_value);
+ return (ret_value);
}
#else /* H5_HAVE_MIRROR_VFD */
@@ -400,4 +401,3 @@ main(void)
} /* end main() */
#endif /* H5_HAVE_FORK */
-
diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c
index 2eb5a1d..0b2c409 100644
--- a/test/use_append_mchunks.c
+++ b/test/use_append_mchunks.c
@@ -69,25 +69,25 @@ static options_t UC_opts; /* Use Case Options */
* Return: 0 succeed; -1 fail.
*/
int
-setup_parameters(int argc, char * const argv[], options_t * opts)
+setup_parameters(int argc, char *const argv[], options_t *opts)
{
/* use case defaults */
HDmemset(opts, 0, sizeof(options_t));
- opts->chunksize = Chunksize_DFT;
- opts->use_swmr = 1; /* use swmr open */
- opts->iterations = 1;
+ opts->chunksize = Chunksize_DFT;
+ opts->use_swmr = 1; /* use swmr open */
+ opts->iterations = 1;
opts->chunkplanes = 1;
- opts->progname = USE_APPEND_MCHUNKS_PROGNAME;
- opts->fapl_id = H5I_INVALID_HID;
+ opts->progname = USE_APPEND_MCHUNKS_PROGNAME;
+ opts->fapl_id = H5I_INVALID_HID;
if (parse_option(argc, argv, opts) < 0) {
- return(-1);
+ return (-1);
}
opts->chunkdims[0] = (hsize_t)opts->chunkplanes;
opts->chunkdims[1] = opts->chunkdims[2] = (hsize_t)opts->chunksize;
- opts->dims[0] = 0;
+ opts->dims[0] = 0;
opts->max_dims[0] = H5S_UNLIMITED;
opts->dims[1] = opts->dims[2] = opts->max_dims[1] = opts->max_dims[2] = 2 * (hsize_t)opts->chunksize;
@@ -95,10 +95,9 @@ setup_parameters(int argc, char * const argv[], options_t * opts)
opts->nplanes = 2 * (hsize_t)opts->chunksize;
show_parameters(opts);
- return(0);
+ return (0);
} /* end setup_parameters() */
-
/* Overall Algorithm:
* Parse options from user;
* Generate/pre-created test files needed and close it;
@@ -109,15 +108,15 @@ setup_parameters(int argc, char * const argv[], options_t * opts)
int
main(int argc, char *argv[])
{
- pid_t childpid=0;
- pid_t mypid, tmppid;
- int child_status;
- int child_wait_option=0;
- int ret_value = 0;
- int child_ret_value;
+ pid_t childpid = 0;
+ pid_t mypid, tmppid;
+ int child_status;
+ int child_wait_option = 0;
+ int ret_value = 0;
+ int child_ret_value;
hbool_t send_wait = 0;
- hid_t fapl = -1; /* File access property list */
- hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ hid_t fid = -1; /* File ID */
if (setup_parameters(argc, argv, &UC_opts) < 0) {
Hgoto_error(1);
@@ -150,7 +149,8 @@ main(int argc, char *argv[])
if (create_uc_file(&UC_opts) < 0) {
HDfprintf(stderr, "***encounter error\n");
Hgoto_error(1);
- } else {
+ }
+ else {
HDprintf("File created.\n");
}
/* Close FAPL to prevent issues with forking later */
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
/* ============ */
/* Fork process */
/* ============ */
- if (UC_opts.launch==UC_READWRITE) {
+ if (UC_opts.launch == UC_READWRITE) {
if ((childpid = fork()) < 0) {
perror("fork");
Hgoto_error(1);
@@ -214,7 +214,8 @@ main(int argc, char *argv[])
}
}
- if ((fid = H5Fopen(UC_opts.filename, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) {
+ if ((fid = H5Fopen(UC_opts.filename, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) <
+ 0) {
HDfprintf(stderr, "H5Fopen failed\n");
Hgoto_error(1);
}
@@ -244,12 +245,12 @@ main(int argc, char *argv[])
}
if (WIFEXITED(child_status)) {
- if ((child_ret_value=WEXITSTATUS(child_status)) != 0) {
- HDprintf("%d: child process exited with non-zero code (%d)\n",
- mypid, child_ret_value);
+ if ((child_ret_value = WEXITSTATUS(child_status)) != 0) {
+ HDprintf("%d: child process exited with non-zero code (%d)\n", mypid, child_ret_value);
Hgoto_error(1);
}
- } else {
+ }
+ else {
HDprintf("%d: child process terminated abnormally\n", mypid);
Hgoto_error(2);
}
@@ -258,11 +259,12 @@ main(int argc, char *argv[])
done:
if (ret_value != 0) {
HDprintf("Error(s) encountered\n");
- } else {
+ }
+ else {
HDprintf("All passed\n");
}
- return(ret_value);
+ return (ret_value);
} /* end main() */
#else /* H5_HAVE_FORK */
@@ -275,4 +277,3 @@ main(void)
} /* end main() */
#endif /* H5_HAVE_FORK */
-
diff --git a/test/use_common.c b/test/use_common.c
index 7e19167..ccebd0b 100644
--- a/test/use_common.c
+++ b/test/use_common.c
@@ -33,7 +33,8 @@ usage(const char *prog)
HDfprintf(stderr, " OPTIONS\n");
HDfprintf(stderr, " -h, --help Print a usage message and exit\n");
HDfprintf(stderr, " -f FN Test file name [default: %s.h5]\n", prog);
- HDfprintf(stderr, " -i N, --iteration=N Number of iterations to repeat the whole thing. [default: 1]\n");
+ HDfprintf(stderr,
+ " -i N, --iteration=N Number of iterations to repeat the whole thing. [default: 1]\n");
HDfprintf(stderr, " -l w|r launch writer or reader only. [default: launch both]\n");
HDfprintf(stderr, " -n N, --nplanes=N Number of planes to write/read. [default: 1000]\n");
HDfprintf(stderr, " -s N, --swmr=N Use SWMR mode (0: no, non-0: yes) default is yes\n");
@@ -48,11 +49,11 @@ usage(const char *prog)
* ----------------------------------------------------------------------------
*/
int
-parse_option(int argc, char * const argv[], options_t * opts)
+parse_option(int argc, char *const argv[], options_t *opts)
{
- int ret_value=0;
+ int ret_value = 0;
int c;
- int use_swmr; /* Need an int to detect errors */
+ int use_swmr; /* Need an int to detect errors */
/* command line options: See function usage for a description */
const char *nagg_options = "f:hi:l:n:s:y:z:";
@@ -65,79 +66,80 @@ parse_option(int argc, char * const argv[], options_t * opts)
if (-1 == c)
break;
switch (c) {
- case 'h':
- usage(opts->progname);
- exit(EXIT_SUCCESS);
- break;
- case 'f': /* usecase data file name */
- opts->filename = HDstrdup(optarg);
- break;
- case 'i': /* iterations */
- if ((opts->iterations = HDatoi(optarg)) <= 0) {
- HDfprintf(stderr, "bad iterations number %s, must be a positive integer\n", optarg);
+ case 'h':
usage(opts->progname);
- Hgoto_error(-1);
- }
- break;
- case 'l': /* launch reader or writer only */
- switch (*optarg) {
- case 'r': /* reader only */
- opts->launch = UC_READER;
+ exit(EXIT_SUCCESS);
break;
- case 'w': /* writer only */
- opts->launch = UC_WRITER;
+ case 'f': /* usecase data file name */
+ opts->filename = HDstrdup(optarg);
break;
- default:
- HDfprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg);
- usage(opts->progname);
- Hgoto_error(-1);
+ case 'i': /* iterations */
+ if ((opts->iterations = HDatoi(optarg)) <= 0) {
+ HDfprintf(stderr, "bad iterations number %s, must be a positive integer\n", optarg);
+ usage(opts->progname);
+ Hgoto_error(-1);
+ }
break;
- } /* end switch (reader/writer-only mode toggle) */
- break;
- case 'n': /* number of planes to write/read */
- if ((opts->nplanes = HDstrtoul(optarg, NULL, 0)) <= 0) {
- HDfprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg);
- usage(opts->progname);
- Hgoto_error(-1);
- }
- break;
- case 's': /* use swmr file open mode */
- use_swmr = HDatoi(optarg);
- if (use_swmr != 0 && use_swmr != 1) {
- HDfprintf(stderr, "swmr value should be 0(no) or 1(yes)\n");
- usage(opts->progname);
- Hgoto_error(-1);
- }
- opts->use_swmr = (hbool_t)use_swmr;
- break;
- case 'y': /* Number of planes per chunk */
- if ((opts->chunkplanes = HDstrtoul(optarg, NULL, 0)) <= 0) {
- HDfprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg);
- usage(opts->progname);
+ case 'l': /* launch reader or writer only */
+ switch (*optarg) {
+ case 'r': /* reader only */
+ opts->launch = UC_READER;
+ break;
+ case 'w': /* writer only */
+ opts->launch = UC_WRITER;
+ break;
+ default:
+ HDfprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg);
+ usage(opts->progname);
+ Hgoto_error(-1);
+ break;
+ } /* end switch (reader/writer-only mode toggle) */
+ break;
+ case 'n': /* number of planes to write/read */
+ if ((opts->nplanes = HDstrtoul(optarg, NULL, 0)) <= 0) {
+ HDfprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg);
+ usage(opts->progname);
+ Hgoto_error(-1);
+ }
+ break;
+ case 's': /* use swmr file open mode */
+ use_swmr = HDatoi(optarg);
+ if (use_swmr != 0 && use_swmr != 1) {
+ HDfprintf(stderr, "swmr value should be 0(no) or 1(yes)\n");
+ usage(opts->progname);
+ Hgoto_error(-1);
+ }
+ opts->use_swmr = (hbool_t)use_swmr;
+ break;
+ case 'y': /* Number of planes per chunk */
+ if ((opts->chunkplanes = HDstrtoul(optarg, NULL, 0)) <= 0) {
+ HDfprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n",
+ optarg);
+ usage(opts->progname);
+ Hgoto_error(-1);
+ }
+ break;
+ case 'z': /* size of chunk=(z,z) */
+ if ((opts->chunksize = HDstrtoull(optarg, NULL, 0)) <= 0) {
+ HDfprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg);
+ usage(opts->progname);
+ Hgoto_error(-1);
+ }
+ break;
+ case '?':
+ HDfprintf(stderr, "getopt returned '%c'.\n", c);
Hgoto_error(-1);
- }
- break;
- case 'z': /* size of chunk=(z,z) */
- if ((opts->chunksize = HDstrtoull(optarg, NULL, 0)) <= 0) {
- HDfprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg);
- usage(opts->progname);
+ default:
+ HDfprintf(stderr, "getopt returned unexpected value.\n");
+ HDfprintf(stderr, "Unexpected value is %d\n", c);
Hgoto_error(-1);
- }
- break;
- case '?':
- HDfprintf(stderr, "getopt returned '%c'.\n", c);
- Hgoto_error(-1);
- default:
- HDfprintf(stderr, "getopt returned unexpected value.\n");
- HDfprintf(stderr, "Unexpected value is %d\n", c);
- Hgoto_error(-1);
} /* end switch (argument symbol) */
- } /* end while (there are still arguments) */
+ } /* end while (there are still arguments) */
/* set test file name if not given */
if (!opts->filename) {
/* default data file name is <progname>.h5 */
- if ((opts->filename=(char*)HDmalloc(HDstrlen(opts->progname)+4))==NULL) {
+ if ((opts->filename = (char *)HDmalloc(HDstrlen(opts->progname) + 4)) == NULL) {
HDfprintf(stderr, "malloc: failed\n");
Hgoto_error(-1);
}
@@ -146,7 +148,7 @@ parse_option(int argc, char * const argv[], options_t * opts)
}
done:
- return(ret_value);
+ return (ret_value);
} /* end parse_option() */
/* ----------------------------------------------------------------------------
@@ -154,18 +156,18 @@ done:
* ----------------------------------------------------------------------------
*/
void
-show_parameters(options_t * opts)
+show_parameters(options_t *opts)
{
HDprintf("===Parameters used:===\n");
HDprintf("chunk dims=(%llu, %llu, %llu)\n", (unsigned long long)opts->chunkdims[0],
- (unsigned long long)opts->chunkdims[1], (unsigned long long)opts->chunkdims[2]);
+ (unsigned long long)opts->chunkdims[1], (unsigned long long)opts->chunkdims[2]);
HDprintf("dataset max dims=(%llu, %llu, %llu)\n", (unsigned long long)opts->max_dims[0],
- (unsigned long long)opts->max_dims[1], (unsigned long long)opts->max_dims[2]);
+ (unsigned long long)opts->max_dims[1], (unsigned long long)opts->max_dims[2]);
HDprintf("number of planes to write=%llu\n", (unsigned long long)opts->nplanes);
HDprintf("using SWMR mode=%s\n", opts->use_swmr ? "yes(1)" : "no(0)");
HDprintf("data filename=%s\n", opts->filename);
HDprintf("launch part=");
- switch (opts->launch) {
+ switch (opts->launch) {
case UC_READWRITE:
HDprintf("Reader/Writer\n");
break;
@@ -178,7 +180,7 @@ show_parameters(options_t * opts)
default:
/* should not happen */
HDprintf("Illegal part(%d)\n", opts->launch);
- }
+ }
HDprintf("number of iterations=%d (not used yet)\n", opts->iterations);
HDprintf("===Parameters shown===\n");
} /* end show_parameters() */
@@ -194,13 +196,13 @@ show_parameters(options_t * opts)
* ----------------------------------------------------------------------------
*/
int
-create_uc_file(options_t * opts)
+create_uc_file(options_t *opts)
{
- hsize_t dims[3]; /* Dataset starting dimensions */
- hid_t fid; /* File ID for new HDF5 file */
- hid_t dcpl; /* Dataset creation property list */
- hid_t sid; /* Dataspace ID */
- hid_t dsid; /* Dataset ID */
+ hsize_t dims[3]; /* Dataset starting dimensions */
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t dcpl; /* Dataset creation property list */
+ hid_t sid; /* Dataspace ID */
+ hid_t dsid; /* Dataset ID */
H5D_chunk_index_t idx_type; /* Chunk index type */
if ((fid = H5Fcreate(opts->filename, H5F_ACC_TRUNC, H5P_DEFAULT, opts->fapl_id)) < 0)
@@ -258,19 +260,19 @@ create_uc_file(options_t * opts)
* ----------------------------------------------------------------------------
*/
int
-write_uc_file(hbool_t tosend, hid_t file_id, options_t * opts)
+write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
{
- hid_t dsid; /* dataset ID */
- hid_t dcpl; /* Dataset creation property list */
- UC_CTYPE *buffer, *bufptr; /* data buffer */
- hsize_t cz=opts->chunksize; /* Chunk size */
- hid_t f_sid; /* dataset file space id */
- hid_t m_sid; /* memory space id */
- int rank; /* rank */
- hsize_t chunk_dims[3]; /* Chunk dimensions */
- hsize_t dims[3]; /* Dataspace dimensions */
- hsize_t memdims[3]; /* Memory space dimensions */
- hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */
+ hid_t dsid; /* dataset ID */
+ hid_t dcpl; /* Dataset creation property list */
+ UC_CTYPE *buffer, *bufptr; /* data buffer */
+ hsize_t cz = opts->chunksize; /* Chunk size */
+ hid_t f_sid; /* dataset file space id */
+ hid_t m_sid; /* memory space id */
+ int rank; /* rank */
+ hsize_t chunk_dims[3]; /* Chunk dimensions */
+ hsize_t dims[3]; /* Dataspace dimensions */
+ hsize_t memdims[3]; /* Memory space dimensions */
+ hsize_t start[3] = {0, 0, 0}, count[3]; /* Hyperslab selection values */
hsize_t i, j, k;
if (TRUE == tosend) {
@@ -299,18 +301,18 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t * opts)
}
/* verify chunk_dims against set paramenters */
- if (chunk_dims[0]!=opts->chunkdims[0] || chunk_dims[1] != cz || chunk_dims[2] != cz) {
+ if (chunk_dims[0] != opts->chunkdims[0] || chunk_dims[1] != cz || chunk_dims[2] != cz) {
HDfprintf(stderr, "chunk size is not as expected. Got dims=(%llu,%llu,%llu)\n",
- (unsigned long long)chunk_dims[0], (unsigned long long)chunk_dims[1],
- (unsigned long long)chunk_dims[2]);
+ (unsigned long long)chunk_dims[0], (unsigned long long)chunk_dims[1],
+ (unsigned long long)chunk_dims[2]);
return -1;
}
/* allocate space for data buffer 1 X dims[1] X dims[2] of UC_CTYPE */
- memdims[0]=1;
+ memdims[0] = 1;
memdims[1] = opts->dims[1];
memdims[2] = opts->dims[2];
- if ((buffer=(UC_CTYPE*)HDmalloc((size_t)memdims[1]*(size_t)memdims[2]*sizeof(UC_CTYPE)))==NULL) {
+ if ((buffer = (UC_CTYPE *)HDmalloc((size_t)memdims[1] * (size_t)memdims[2] * sizeof(UC_CTYPE))) == NULL) {
HDfprintf(stderr, "malloc: failed\n");
return -1;
}
@@ -318,7 +320,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t * opts)
/*
* Get dataset rank and dimension.
*/
- f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
+ f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
rank = H5Sget_simple_extent_ndims(f_sid);
if (rank != UC_RANK) {
HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
@@ -328,32 +330,30 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t * opts)
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
return -1;
}
- HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n",
- rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]),
- (unsigned long long)(dims[2]));
+ HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]),
+ (unsigned long long)(dims[1]), (unsigned long long)(dims[2]));
/* verify that file space dims are as expected and are consistent with memory space dims */
if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]) {
- HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n",
- (unsigned long long)dims[0], (unsigned long long)dims[1],
- (unsigned long long)dims[2]);
+ HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", (unsigned long long)dims[0],
+ (unsigned long long)dims[1], (unsigned long long)dims[2]);
return -1;
}
/* setup mem-space for buffer */
- if ((m_sid=H5Screate_simple(rank, memdims, NULL))<0) {
+ if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) {
HDfprintf(stderr, "H5Screate_simple for memory failed\n");
return -1;
}
/* write planes */
- count[0]=1;
- count[1]=dims[1];
- count[2]=dims[2];
- for (i=0; i < opts->nplanes; i++) {
+ count[0] = 1;
+ count[1] = dims[1];
+ count[2] = dims[2];
+ for (i = 0; i < opts->nplanes; i++) {
/* fill buffer with value i+1 */
bufptr = buffer;
- for (j=0; j < dims[1]; j++) {
- for (k=0; k < dims[2]; k++) {
+ for (j = 0; j < dims[1]; j++) {
+ for (k = 0; k < dims[2]; k++) {
*bufptr++ = (UC_CTYPE)i;
}
}
@@ -367,7 +367,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t * opts)
}
/* extend the dataset by one for new plane */
- dims[0]=i+1;
+ dims[0] = i + 1;
if (H5Dset_extent(dsid, dims) < 0) {
HDfprintf(stderr, "H5Dset_extent failed\n");
return -1;
@@ -379,7 +379,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t * opts)
return -1;
}
- start[0]=i;
+ start[0] = i;
/* Choose the next plane to write */
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
HDfprintf(stderr, "Failed H5Sselect_hyperslab\n");
@@ -438,20 +438,20 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t * opts)
* ----------------------------------------------------------------------------
*/
int
-read_uc_file(hbool_t towait, options_t * opts)
+read_uc_file(hbool_t towait, options_t *opts)
{
- hid_t fid; /* File ID for new HDF5 file */
- hid_t dsid; /* dataset ID */
- UC_CTYPE *buffer, *bufptr; /* read data buffer */
- hid_t f_sid; /* dataset file space id */
- hid_t m_sid; /* memory space id */
- int rank; /* rank */
- hsize_t dims[3]; /* Dataspace dimensions */
- hsize_t memdims[3]; /* Memory space dimensions */
- hsize_t nplane=0, nplanes_seen=0; /* nth plane, last nth plane */
- hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t dsid; /* dataset ID */
+ UC_CTYPE *buffer, *bufptr; /* read data buffer */
+ hid_t f_sid; /* dataset file space id */
+ hid_t m_sid; /* memory space id */
+ int rank; /* rank */
+ hsize_t dims[3]; /* Dataspace dimensions */
+ hsize_t memdims[3]; /* Memory space dimensions */
+ hsize_t nplane = 0, nplanes_seen = 0; /* nth plane, last nth plane */
+ hsize_t start[3] = {0, 0, 0}, count[3]; /* Hyperslab selection values */
hsize_t j, k;
- int nreadererr=0;
+ int nreadererr = 0;
int nerrs;
int loops_waiting_for_plane;
@@ -462,7 +462,8 @@ read_uc_file(hbool_t towait, options_t * opts)
}
HDfprintf(stderr, "Opening to read %s\n", opts->filename);
- if ((fid = H5Fopen(opts->filename, H5F_ACC_RDONLY | (opts->use_swmr ? H5F_ACC_SWMR_READ : 0), opts->fapl_id)) < 0) {
+ if ((fid = H5Fopen(opts->filename, H5F_ACC_RDONLY | (opts->use_swmr ? H5F_ACC_SWMR_READ : 0),
+ opts->fapl_id)) < 0) {
HDfprintf(stderr, "H5Fopen failed\n");
return -1;
}
@@ -476,7 +477,7 @@ read_uc_file(hbool_t towait, options_t * opts)
memdims[0] = 1;
memdims[1] = opts->dims[1];
memdims[2] = opts->dims[2];
- if ((buffer=(UC_CTYPE*)HDmalloc((size_t)memdims[1]*(size_t)memdims[2]*sizeof(UC_CTYPE)))==NULL) {
+ if ((buffer = (UC_CTYPE *)HDmalloc((size_t)memdims[1] * (size_t)memdims[2] * sizeof(UC_CTYPE))) == NULL) {
HDfprintf(stderr, "malloc: failed\n");
return -1;
}
@@ -485,7 +486,7 @@ read_uc_file(hbool_t towait, options_t * opts)
* Get dataset rank and dimension.
* Verify dimension is as expected (unlimited,2*chunksize,2*chunksize).
*/
- f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
+ f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
rank = H5Sget_simple_extent_ndims(f_sid);
if (rank != UC_RANK) {
HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
@@ -495,22 +496,19 @@ read_uc_file(hbool_t towait, options_t * opts)
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
return -1;
}
- HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n",
- rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]),
- (unsigned long long)(dims[2]));
+ HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]),
+ (unsigned long long)(dims[1]), (unsigned long long)(dims[2]));
/* verify that file space dims are as expected and are consistent with memory space dims */
if (dims[1] != memdims[1] || dims[2] != memdims[2]) {
HDfprintf(stderr, "dataset dimension is not as expected. Got dims=(%llu,%llu,%llu)\n",
- (unsigned long long)dims[0], (unsigned long long)dims[1],
- (unsigned long long)dims[2]);
- HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n",
- (unsigned long long)memdims[0], (unsigned long long)memdims[1],
- (unsigned long long)memdims[2]);
+ (unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]);
+ HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", (unsigned long long)memdims[0],
+ (unsigned long long)memdims[1], (unsigned long long)memdims[2]);
return -1;
}
/* Setup mem-space for buffer */
- if ((m_sid=H5Screate_simple(rank, memdims, NULL)) < 0) {
+ if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) {
HDfprintf(stderr, "H5Screate_simple for memory failed\n");
return -1;
}
@@ -520,22 +518,22 @@ read_uc_file(hbool_t towait, options_t * opts)
count[1] = dims[1];
count[2] = dims[2];
/* quit when all nplanes have been read */
- loops_waiting_for_plane=0;
+ loops_waiting_for_plane = 0;
while (nplanes_seen < opts->nplanes) {
/* print progress message according to if new planes are availalbe */
if (nplanes_seen < dims[0]) {
if (loops_waiting_for_plane) {
/* end the previous message */
HDprintf("\n");
- loops_waiting_for_plane=0;
+ loops_waiting_for_plane = 0;
}
HDprintf("reading planes %llu to %llu\n", (unsigned long long)nplanes_seen,
- (unsigned long long)dims[0]);
+ (unsigned long long)dims[0]);
}
else {
if (loops_waiting_for_plane) {
HDprintf(".");
- if (loops_waiting_for_plane>=30) {
+ if (loops_waiting_for_plane >= 30) {
HDfprintf(stderr, "waited too long for new plane, quit.\n");
return -1;
}
@@ -549,7 +547,7 @@ read_uc_file(hbool_t towait, options_t * opts)
HDsleep(1);
}
- for (nplane=nplanes_seen; nplane < dims[0]; nplane++) {
+ for (nplane = nplanes_seen; nplane < dims[0]; nplane++) {
/* read planes between last old nplanes and current extent */
/* Get the dataset's dataspace */
if ((f_sid = H5Dget_space(dsid)) < 0) {
@@ -557,7 +555,7 @@ read_uc_file(hbool_t towait, options_t * opts)
return -1;
}
- start[0]=nplane;
+ start[0] = nplane;
/* Choose the next plane to read */
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
HDfprintf(stderr, "H5Sselect_hyperslab failed\n");
@@ -572,31 +570,30 @@ read_uc_file(hbool_t towait, options_t * opts)
/* compare read data with expected data value which is nplane */
bufptr = buffer;
- nerrs=0;
- for (j=0; j < dims[1]; j++) {
- for (k=0; k < dims[2]; k++) {
+ nerrs = 0;
+ for (j = 0; j < dims[1]; j++) {
+ for (k = 0; k < dims[2]; k++) {
if ((hsize_t)*bufptr++ != nplane) {
if (++nerrs < ErrorReportMax) {
- HDfprintf(stderr,
- "found error %llu plane(%llu,%llu), expected %llu, got %d\n",
- (unsigned long long)nplane, (unsigned long long)j,
- (unsigned long long)k, (unsigned long long)nplane, (int)*(bufptr-1));
+ HDfprintf(stderr, "found error %llu plane(%llu,%llu), expected %llu, got %d\n",
+ (unsigned long long)nplane, (unsigned long long)j,
+ (unsigned long long)k, (unsigned long long)nplane, (int)*(bufptr - 1));
} /* end if should print error */
- } /* end if value mismatch */
- } /* end for plane second dimension */
- } /* end for plane first dimension */
+ } /* end if value mismatch */
+ } /* end for plane second dimension */
+ } /* end for plane first dimension */
if (nerrs) {
nreadererr++;
HDfprintf(stderr, "found %d unexpected values in plane %llu\n", nerrs,
- (unsigned long long)nplane);
+ (unsigned long long)nplane);
}
} /* end for each plane added since last read */
- nplanes_seen=dims[0];
+ nplanes_seen = dims[0];
/* check if dataset has grown since last time (update dims) */
H5Drefresh(dsid);
- f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
+ f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
return -1;
@@ -615,4 +612,3 @@ read_uc_file(hbool_t towait, options_t * opts)
} /* end read_uc_file() */
#endif /* H5_HAVE_FORK */
-
diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c
index 32a8244..1f0e3d4 100644
--- a/test/use_disable_mdc_flushes.c
+++ b/test/use_disable_mdc_flushes.c
@@ -24,35 +24,38 @@
*/
#ifdef H5_HAVE_FORK
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
#define H5D_TESTING
#include "H5Dpkg.h"
/* Global Variable definitions */
-const char *progname_g="use_disable_mdc_flushes"; /* program name */
+const char *progname_g = "use_disable_mdc_flushes"; /* program name */
/* these two definitions must match each other */
-#define UC_DATATYPE H5T_NATIVE_SHORT /* use case HDF5 data type */
-#define UC_CTYPE short /* use case C data type */
-#define UC_RANK 3 /* use case dataset rank */
-#define Chunksize_DFT 256 /* chunksize default */
-#define Hgoto_error(val) {ret_value=val; goto done;}
-
+#define UC_DATATYPE H5T_NATIVE_SHORT /* use case HDF5 data type */
+#define UC_CTYPE short /* use case C data type */
+#define UC_RANK 3 /* use case dataset rank */
+#define Chunksize_DFT 256 /* chunksize default */
+#define Hgoto_error(val) \
+ { \
+ ret_value = val; \
+ goto done; \
+ }
-char *filename_g;
+char * filename_g;
hsize_t nplanes_g;
-int use_swmr_g;
-int chunkplanes_g;
-int chunksize_g;
+int use_swmr_g;
+int chunkplanes_g;
+int chunksize_g;
hsize_t dims_g[UC_RANK];
hsize_t max_dims_g[UC_RANK];
hsize_t chunkdims_g[UC_RANK];
static void usage(const char *prog);
-static int parse_option(int argc, char * const argv[]);
+static int parse_option(int argc, char *const argv[]);
static void show_parameters(void);
-static int create_file(void);
-static int setup_parameters(int argc, char * const argv[]);
+static int create_file(void);
+static int setup_parameters(int argc, char *const argv[]);
/*
* Note: Long options are not yet implemented.
@@ -80,14 +83,13 @@ usage(const char *prog)
HDfprintf(stderr, "\n");
} /* usage() */
-
/*
* Setup Use Case parameters by parsing command line options.
* Setup default values if not set by options. */
static int
-parse_option(int argc, char * const argv[])
+parse_option(int argc, char *const argv[])
{
- int ret_value=0;
+ int ret_value = 0;
int c;
/* command line options: See function usage for a description */
const char *cmd_options = "f:hn:s:y:z:";
@@ -95,70 +97,71 @@ parse_option(int argc, char * const argv[])
/* suppress getopt from printing error */
opterr = 0;
- while (1){
- c = getopt (argc, argv, cmd_options);
- if (-1 == c)
- break;
- switch (c) {
- case 'h':
- usage(progname_g);
- HDexit(EXIT_SUCCESS);
- break;
- case 'f': /* usecase data file name */
- filename_g = optarg;
- break;
- case 'n': /* number of planes to write/read */
- if ((nplanes_g = (hsize_t)HDatoi(optarg)) <= 0){
- HDfprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg);
- usage(progname_g);
- Hgoto_error(-1);
- };
- break;
- case 's': /* use swmr file open mode */
- if ((use_swmr_g = HDatoi(optarg)) < 0){
- HDfprintf(stderr, "swmr value should be 0(no) or 1(yes)\n");
- usage(progname_g);
- Hgoto_error(-1);
- };
- break;
- case 'y': /* Number of planes per chunk */
- if ((chunkplanes_g = HDatoi(optarg)) <= 0){
- HDfprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg);
- usage(progname_g);
- Hgoto_error(-1);
- };
- break;
- case 'z': /* size of chunk=(z,z) */
- if ((chunksize_g = HDatoi(optarg)) <= 0){
- HDfprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg);
- usage(progname_g);
- Hgoto_error(-1);
- };
- break;
- case '?':
- HDfprintf(stderr, "getopt returned '%c'.\n", c);
- Hgoto_error(-1);
- default:
- HDfprintf(stderr, "getopt returned unexpected value.\n");
- HDfprintf(stderr, "Unexpected value is %d\n", c);
- Hgoto_error(-1);
- }
+ while (1) {
+ c = getopt(argc, argv, cmd_options);
+ if (-1 == c)
+ break;
+ switch (c) {
+ case 'h':
+ usage(progname_g);
+ HDexit(EXIT_SUCCESS);
+ break;
+ case 'f': /* usecase data file name */
+ filename_g = optarg;
+ break;
+ case 'n': /* number of planes to write/read */
+ if ((nplanes_g = (hsize_t)HDatoi(optarg)) <= 0) {
+ HDfprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg);
+ usage(progname_g);
+ Hgoto_error(-1);
+ };
+ break;
+ case 's': /* use swmr file open mode */
+ if ((use_swmr_g = HDatoi(optarg)) < 0) {
+ HDfprintf(stderr, "swmr value should be 0(no) or 1(yes)\n");
+ usage(progname_g);
+ Hgoto_error(-1);
+ };
+ break;
+ case 'y': /* Number of planes per chunk */
+ if ((chunkplanes_g = HDatoi(optarg)) <= 0) {
+ HDfprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n",
+ optarg);
+ usage(progname_g);
+ Hgoto_error(-1);
+ };
+ break;
+ case 'z': /* size of chunk=(z,z) */
+ if ((chunksize_g = HDatoi(optarg)) <= 0) {
+ HDfprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg);
+ usage(progname_g);
+ Hgoto_error(-1);
+ };
+ break;
+ case '?':
+ HDfprintf(stderr, "getopt returned '%c'.\n", c);
+ Hgoto_error(-1);
+ default:
+ HDfprintf(stderr, "getopt returned unexpected value.\n");
+ HDfprintf(stderr, "Unexpected value is %d\n", c);
+ Hgoto_error(-1);
+ }
}
/* set test file name if not given */
- if (!filename_g){
- /* default data file name is <progname>.h5 */
- if ((filename_g = (char*)HDmalloc(HDstrlen(progname_g)+4))==NULL) {
- HDfprintf(stderr, "malloc: failed\n");
- Hgoto_error(-1);
- };
- HDstrcpy(filename_g, progname_g);
- HDstrcat(filename_g, ".h5");
+ if (!filename_g) {
+ /* default data file name is <progname>.h5 */
+ if ((filename_g = (char *)HDmalloc(HDstrlen(progname_g) + 4)) == NULL) {
+ HDfprintf(stderr, "malloc: failed\n");
+ Hgoto_error(-1);
+ };
+ HDstrcpy(filename_g, progname_g);
+ HDstrcat(filename_g, ".h5");
}
done:
/* All done. */
- return(ret_value);
+ return (ret_value);
} /* parse_option() */
/* Show parameters used for this use case */
@@ -167,9 +170,9 @@ show_parameters(void)
{
HDprintf("===Parameters used:===\n");
HDprintf("chunk dims=(%llu, %llu, %llu)\n", (unsigned long long)chunkdims_g[0],
- (unsigned long long)chunkdims_g[1], (unsigned long long)chunkdims_g[2]);
+ (unsigned long long)chunkdims_g[1], (unsigned long long)chunkdims_g[2]);
HDprintf("dataset max dims=(%llu, %llu, %llu)\n", (unsigned long long)max_dims_g[0],
- (unsigned long long)max_dims_g[1], (unsigned long long)max_dims_g[2]);
+ (unsigned long long)max_dims_g[1], (unsigned long long)max_dims_g[2]);
HDprintf("number of planes to write=%llu\n", (unsigned long long)nplanes_g);
HDprintf("using SWMR mode=%s\n", use_swmr_g ? "yes(1)" : "no(0)");
HDprintf("data filename=%s\n", filename_g);
@@ -181,23 +184,23 @@ show_parameters(void)
* Return: 0 succeed; -1 fail.
*/
static int
-setup_parameters(int argc, char * const argv[])
+setup_parameters(int argc, char *const argv[])
{
/* use case defaults */
- chunksize_g = Chunksize_DFT;
- use_swmr_g = 1; /* use swmr open */
+ chunksize_g = Chunksize_DFT;
+ use_swmr_g = 1; /* use swmr open */
chunkplanes_g = 1;
/* parse options */
- if (parse_option(argc, argv) < 0){
- return(-1);
+ if (parse_option(argc, argv) < 0) {
+ return (-1);
}
/* set chunk dims */
chunkdims_g[0] = (hsize_t)chunkplanes_g;
- chunkdims_g[1]= chunkdims_g[2] = (hsize_t)chunksize_g;
+ chunkdims_g[1] = chunkdims_g[2] = (hsize_t)chunksize_g;
/* set dataset initial and max dims */
- dims_g[0] = 0;
+ dims_g[0] = 0;
max_dims_g[0] = H5S_UNLIMITED;
dims_g[1] = dims_g[2] = max_dims_g[1] = max_dims_g[2] = (hsize_t)chunksize_g;
@@ -207,7 +210,7 @@ setup_parameters(int argc, char * const argv[])
/* show parameters and return */
show_parameters();
- return(0);
+ return (0);
} /* setup_parameters() */
/*
@@ -222,20 +225,20 @@ setup_parameters(int argc, char * const argv[])
static int
create_file(void)
{
- hsize_t dims[3]; /* Dataset starting dimensions */
- hid_t fid; /* File ID for new HDF5 file */
- hid_t dcpl; /* Dataset creation property list */
- hid_t sid; /* Dataspace ID */
- hid_t dsid; /* Dataset ID */
- hid_t fapl; /* File access property list */
+ hsize_t dims[3]; /* Dataset starting dimensions */
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t dcpl; /* Dataset creation property list */
+ hid_t sid; /* Dataspace ID */
+ hid_t dsid; /* Dataset ID */
+ hid_t fapl; /* File access property list */
H5D_chunk_index_t idx_type; /* Chunk index type */
/* Create the file */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
- if((fid = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
return -1;
/* Set up dimension sizes */
@@ -243,39 +246,39 @@ create_file(void)
dims[1] = dims[2] = max_dims_g[1];
/* Create dataspace for creating datasets */
- if((sid = H5Screate_simple(3, dims, max_dims_g)) < 0)
+ if ((sid = H5Screate_simple(3, dims, max_dims_g)) < 0)
return -1;
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
return -1;
- if(H5Pset_chunk(dcpl, 3, chunkdims_g) < 0)
+ if (H5Pset_chunk(dcpl, 3, chunkdims_g) < 0)
return -1;
/* create dataset of progname */
- if((dsid = H5Dcreate2(fid, progname_g, UC_DATATYPE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- return -1;
+ if ((dsid = H5Dcreate2(fid, progname_g, UC_DATATYPE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ return -1;
/* Check that the chunk index type is not version 1 B-tree.
* Version 1 B-trees are not supported under SWMR.
*/
- if(H5D__layout_idx_type_test(dsid, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(dsid, &idx_type) < 0)
return -1;
- if(idx_type == H5D_CHUNK_IDX_BTREE) {
+ if (idx_type == H5D_CHUNK_IDX_BTREE) {
HDfprintf(stderr, "ERROR: Chunk index is version 1 B-tree: aborting.\n");
return -1;
}
/* Close everything */
- if(H5Dclose(dsid) < 0)
- return -1;
- if(H5Pclose(fapl) < 0)
+ if (H5Dclose(dsid) < 0)
+ return -1;
+ if (H5Pclose(fapl) < 0)
return -1;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
return -1;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
return 0;
@@ -293,211 +296,208 @@ create_file(void)
static int
write_file(void)
{
- hid_t fid; /* File ID for new HDF5 file */
- hid_t dsid; /* dataset ID */
- hid_t fapl; /* File access property list */
- hid_t dcpl; /* Dataset creation property list */
- char *name;
- UC_CTYPE *buffer, *bufptr; /* data buffer */
- hsize_t cz=(hsize_t)chunksize_g; /* Chunk size */
- hid_t f_sid; /* dataset file space id */
- hid_t m_sid; /* memory space id */
- int rank; /* rank */
- hsize_t chunk_dims[3]; /* Chunk dimensions */
- hsize_t dims[3]; /* Dataspace dimensions */
- hsize_t memdims[3]; /* Memory space dimensions */
- hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */
- hbool_t disabled; /* Object's disabled status */
- hsize_t i, j, k;
+ hid_t fid; /* File ID for new HDF5 file */
+ hid_t dsid; /* dataset ID */
+ hid_t fapl; /* File access property list */
+ hid_t dcpl; /* Dataset creation property list */
+ char * name;
+ UC_CTYPE *buffer, *bufptr; /* data buffer */
+ hsize_t cz = (hsize_t)chunksize_g; /* Chunk size */
+ hid_t f_sid; /* dataset file space id */
+ hid_t m_sid; /* memory space id */
+ int rank; /* rank */
+ hsize_t chunk_dims[3]; /* Chunk dimensions */
+ hsize_t dims[3]; /* Dataspace dimensions */
+ hsize_t memdims[3]; /* Memory space dimensions */
+ hsize_t start[3] = {0, 0, 0}, count[3]; /* Hyperslab selection values */
+ hbool_t disabled; /* Object's disabled status */
+ hsize_t i, j, k;
name = filename_g;
/* Open the file */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
- if(use_swmr_g)
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (use_swmr_g)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
- if((fid = H5Fopen(name, H5F_ACC_RDWR | (use_swmr_g ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0){
- HDfprintf(stderr, "H5Fopen failed\n");
+ if ((fid = H5Fopen(name, H5F_ACC_RDWR | (use_swmr_g ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) {
+ HDfprintf(stderr, "H5Fopen failed\n");
return -1;
}
/* Open the dataset of the program name */
- if((dsid = H5Dopen2(fid, progname_g, H5P_DEFAULT)) < 0){
- HDfprintf(stderr, "H5Dopen2 failed\n");
- return -1;
+ if ((dsid = H5Dopen2(fid, progname_g, H5P_DEFAULT)) < 0) {
+ HDfprintf(stderr, "H5Dopen2 failed\n");
+ return -1;
}
/* Disabled mdc flushed for the dataset */
- if(H5Odisable_mdc_flushes(dsid) < 0) {
- HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n");
- return -1;
+ if (H5Odisable_mdc_flushes(dsid) < 0) {
+ HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n");
+ return -1;
}
/* Get mdc disabled status of the dataset */
- if(H5Oare_mdc_flushes_disabled(dsid, &disabled) < 0) {
- HDfprintf(stderr, "H5Oare_mdc_flushes_disabled failed\n");
- return -1;
- } else if(disabled)
- HDprintf("Dataset has disabled mdc flushes.\n");
+ if (H5Oare_mdc_flushes_disabled(dsid, &disabled) < 0) {
+ HDfprintf(stderr, "H5Oare_mdc_flushes_disabled failed\n");
+ return -1;
+ }
+ else if (disabled)
+ HDprintf("Dataset has disabled mdc flushes.\n");
else
- HDprintf("Dataset should have disabled its mdc flushes.\n");
+ HDprintf("Dataset should have disabled its mdc flushes.\n");
/* Find chunksize used */
- if ((dcpl = H5Dget_create_plist(dsid)) < 0){
- HDfprintf(stderr, "H5Dget_create_plist failed\n");
- return -1;
+ if ((dcpl = H5Dget_create_plist(dsid)) < 0) {
+ HDfprintf(stderr, "H5Dget_create_plist failed\n");
+ return -1;
}
- if (H5D_CHUNKED != H5Pget_layout(dcpl)){
- HDfprintf(stderr, "storage layout is not chunked\n");
- return -1;
+ if (H5D_CHUNKED != H5Pget_layout(dcpl)) {
+ HDfprintf(stderr, "storage layout is not chunked\n");
+ return -1;
}
- if ((rank = H5Pget_chunk(dcpl, 3, chunk_dims)) != 3){
- HDfprintf(stderr, "storage rank is not 3\n");
- return -1;
+ if ((rank = H5Pget_chunk(dcpl, 3, chunk_dims)) != 3) {
+ HDfprintf(stderr, "storage rank is not 3\n");
+ return -1;
}
/* verify chunk_dims against set paramenters */
- if (chunk_dims[0]!= chunkdims_g[0] || chunk_dims[1] != cz || chunk_dims[2] != cz){
- HDfprintf(stderr, "chunk size is not as expected. Got dims=(%llu,%llu,%llu)\n",
- (unsigned long long)chunk_dims[0], (unsigned long long)chunk_dims[1],
- (unsigned long long)chunk_dims[2]);
- return -1;
+ if (chunk_dims[0] != chunkdims_g[0] || chunk_dims[1] != cz || chunk_dims[2] != cz) {
+ HDfprintf(stderr, "chunk size is not as expected. Got dims=(%llu,%llu,%llu)\n",
+ (unsigned long long)chunk_dims[0], (unsigned long long)chunk_dims[1],
+ (unsigned long long)chunk_dims[2]);
+ return -1;
}
/* allocate space for data buffer 1 X dims[1] X dims[2] of UC_CTYPE */
- memdims[0]=1;
+ memdims[0] = 1;
memdims[1] = dims_g[1];
memdims[2] = dims_g[2];
- if ((buffer=(UC_CTYPE*)HDmalloc((size_t)memdims[1]*(size_t)memdims[2]*sizeof(UC_CTYPE)))==NULL) {
- HDfprintf(stderr, "malloc: failed\n");
- return -1;
+ if ((buffer = (UC_CTYPE *)HDmalloc((size_t)memdims[1] * (size_t)memdims[2] * sizeof(UC_CTYPE))) == NULL) {
+ HDfprintf(stderr, "malloc: failed\n");
+ return -1;
};
/*
* Get dataset rank and dimension.
*/
- f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
+ f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
rank = H5Sget_simple_extent_ndims(f_sid);
- if (rank != UC_RANK){
- HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
- return -1;
+ if (rank != UC_RANK) {
+ HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
+ return -1;
}
- if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0){
- HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
- return -1;
+ if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
+ HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ return -1;
}
- HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n",
- rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]),
- (unsigned long long)(dims[2]));
+ HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]),
+ (unsigned long long)(dims[1]), (unsigned long long)(dims[2]));
/* verify that file space dims are as expected and are consistent with memory space dims */
- if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]){
- HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n",
- (unsigned long long)dims[0], (unsigned long long)dims[1],
- (unsigned long long)dims[2]);
- return -1;
+ if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]) {
+ HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", (unsigned long long)dims[0],
+ (unsigned long long)dims[1], (unsigned long long)dims[2]);
+ return -1;
}
/* setup mem-space for buffer */
- if ((m_sid=H5Screate_simple(rank, memdims, NULL))<0){
- HDfprintf(stderr, "H5Screate_simple for memory failed\n");
- return -1;
+ if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) {
+ HDfprintf(stderr, "H5Screate_simple for memory failed\n");
+ return -1;
};
/* write planes */
- count[0]=1;
- count[1]=dims[1];
- count[2]=dims[2];
- for (i=0; i<nplanes_g; i++){
- /* fill buffer with value i+1 */
- bufptr = buffer;
- for (j=0; j<dims[1]; j++)
- for (k=0; k<dims[2]; k++) {
- if(i > SHRT_MAX) {
- HDfprintf(stderr, "rank(%d) of dataset overflow\n", rank);
- return -1;
+ count[0] = 1;
+ count[1] = dims[1];
+ count[2] = dims[2];
+ for (i = 0; i < nplanes_g; i++) {
+ /* fill buffer with value i+1 */
+ bufptr = buffer;
+ for (j = 0; j < dims[1]; j++)
+ for (k = 0; k < dims[2]; k++) {
+ if (i > SHRT_MAX) {
+ HDfprintf(stderr, "rank(%d) of dataset overflow\n", rank);
+ return -1;
+ }
+ *bufptr++ = (short)i;
}
- *bufptr++ = (short)i;
- }
- /* extend the dataset by one for new plane */
- dims[0]=i+1;
- if(H5Dset_extent(dsid, dims) < 0){
- HDfprintf(stderr, "H5Dset_extent failed\n");
+ /* extend the dataset by one for new plane */
+ dims[0] = i + 1;
+ if (H5Dset_extent(dsid, dims) < 0) {
+ HDfprintf(stderr, "H5Dset_extent failed\n");
return -1;
- }
+ }
/* Get the dataset's dataspace */
- if((f_sid = H5Dget_space(dsid)) < 0){
- HDfprintf(stderr, "H5Dset_extent failed\n");
+ if ((f_sid = H5Dget_space(dsid)) < 0) {
+ HDfprintf(stderr, "H5Dset_extent failed\n");
return -1;
- }
+ }
- start[0]=i;
+ start[0] = i;
/* Choose the next plane to write */
- if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0){
- HDfprintf(stderr, "Failed H5Sselect_hyperslab\n");
+ if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
+ HDfprintf(stderr, "Failed H5Sselect_hyperslab\n");
return -1;
- }
+ }
/* Write plane to the dataset */
- if(H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0){
- HDfprintf(stderr, "Failed H5Dwrite\n");
+ if (H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) {
+ HDfprintf(stderr, "Failed H5Dwrite\n");
return -1;
- }
+ }
- /* Flush the dataset for every "chunkplanes_g" planes */
- if(!((i + 1) % (hsize_t)chunkplanes_g)) {
- if(H5Dflush(dsid) < 0) {
- HDfprintf(stderr, "Failed to H5Dflush dataset\n");
- return -1;
+ /* Flush the dataset for every "chunkplanes_g" planes */
+ if (!((i + 1) % (hsize_t)chunkplanes_g)) {
+ if (H5Dflush(dsid) < 0) {
+ HDfprintf(stderr, "Failed to H5Dflush dataset\n");
+ return -1;
+ }
}
}
- }
- if(H5Dflush(dsid) < 0) {
- HDfprintf(stderr, "Failed to H5Dflush dataset\n");
- return -1;
+ if (H5Dflush(dsid) < 0) {
+ HDfprintf(stderr, "Failed to H5Dflush dataset\n");
+ return -1;
}
/* Enable mdc flushes for the dataset */
/* Closing the dataset later will enable mdc flushes automatically if this is not done */
- if(disabled)
- if(H5Oenable_mdc_flushes(dsid) < 0) {
- HDfprintf(stderr, "Failed to H5Oenable_mdc_flushes\n");
- return -1;
- }
+ if (disabled)
+ if (H5Oenable_mdc_flushes(dsid) < 0) {
+ HDfprintf(stderr, "Failed to H5Oenable_mdc_flushes\n");
+ return -1;
+ }
/* Done writing. Free/Close all resources including data file */
HDfree(buffer);
- if(H5Dclose(dsid) < 0){
- HDfprintf(stderr, "Failed to close datasete\n");
- return -1;
+ if (H5Dclose(dsid) < 0) {
+ HDfprintf(stderr, "Failed to close datasete\n");
+ return -1;
}
- if(H5Sclose(m_sid) < 0){
- HDfprintf(stderr, "Failed to close memory space\n");
- return -1;
+ if (H5Sclose(m_sid) < 0) {
+ HDfprintf(stderr, "Failed to close memory space\n");
+ return -1;
}
- if(H5Sclose(f_sid) < 0){
- HDfprintf(stderr, "Failed to close file space\n");
- return -1;
+ if (H5Sclose(f_sid) < 0) {
+ HDfprintf(stderr, "Failed to close file space\n");
+ return -1;
}
- if(H5Pclose(fapl) < 0){
- HDfprintf(stderr, "Failed to property list\n");
- return -1;
+ if (H5Pclose(fapl) < 0) {
+ HDfprintf(stderr, "Failed to property list\n");
+ return -1;
}
- if(H5Fclose(fid) < 0){
- HDfprintf(stderr, "Failed to close file id\n");
- return -1;
+ if (H5Fclose(fid) < 0) {
+ HDfprintf(stderr, "Failed to close file id\n");
+ return -1;
}
return 0;
} /* write_file() */
-
-
/* Overall Algorithm:
* Parse options from user;
* Generate/pre-created test files needed and close it;
@@ -509,14 +509,14 @@ main(int argc, char *argv[])
int ret_value = 0;
/* initialization */
- if(setup_parameters(argc, argv) < 0)
- Hgoto_error(1);
+ if (setup_parameters(argc, argv) < 0)
+ Hgoto_error(1);
/* ============*/
/* Create file */
/* ============*/
HDprintf("Creating skeleton data file for testing H5Odisable_mdc_flushes()...\n");
- if(create_file() < 0) {
+ if (create_file() < 0) {
HDfprintf(stderr, "***encounter error\n");
Hgoto_error(1);
} /* end if */
@@ -524,19 +524,19 @@ main(int argc, char *argv[])
HDprintf("File created.\n");
HDprintf("writing to the file\n");
- if(write_file() < 0) {
+ if (write_file() < 0) {
HDfprintf(stderr, "write_file encountered error\n");
Hgoto_error(1);
}
done:
/* Print result and exit */
- if(ret_value != 0)
+ if (ret_value != 0)
HDprintf("Error(s) encountered\n");
else
HDprintf("All passed\n");
- return(ret_value);
+ return (ret_value);
}
#else /* H5_HAVE_FORK */
@@ -549,4 +549,3 @@ main(void)
} /* end main() */
#endif /* H5_HAVE_FORK */
-
diff --git a/test/vds.c b/test/vds.c
index 816acf9..4c5929e 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -29,35 +29,22 @@ typedef enum {
TEST_API_NTESTS
} test_api_config_t;
-const char *FILENAME[] = {
- "vds_virt_0",
- "vds_virt_1",
- "vds_src_0",
- "vds_src_1",
- "vds%%_src",
- "vds_dapl",
- "vds_virt_2",
- "vds_virt_3",
- "vds_src_2",
- "vds_src_3",
- "vds%%_src2",
- "vds_dapl2",
- NULL
-};
+const char *FILENAME[] = {"vds_virt_0", "vds_virt_1", "vds_src_0", "vds_src_1", "vds%%_src",
+ "vds_dapl", "vds_virt_2", "vds_virt_3", "vds_src_2", "vds_src_3",
+ "vds%%_src2", "vds_dapl2", NULL};
/* I/O test config flags */
-#define TEST_IO_CLOSE_SRC 0x01u
-#define TEST_IO_DIFFERENT_FILE 0x02u
-#define TEST_IO_REOPEN_VIRT 0x04u
-#define TEST_IO_NTESTS 0x08u
+#define TEST_IO_CLOSE_SRC 0x01u
+#define TEST_IO_DIFFERENT_FILE 0x02u
+#define TEST_IO_REOPEN_VIRT 0x04u
+#define TEST_IO_NTESTS 0x08u
#define LIST_DOUBLE_SIZE (H5D_VIRTUAL_DEF_LIST_SIZE + 1)
-#define FILENAME_BUF_SIZE 1024
+#define FILENAME_BUF_SIZE 1024
-#define TMPDIR "tmp_vds/"
+#define TMPDIR "tmp_vds/"
-
/*-------------------------------------------------------------------------
* Function: vds_select_equal
*
@@ -71,126 +58,126 @@ const char *FILENAME[] = {
static htri_t
vds_select_equal(hid_t space1, hid_t space2)
{
- H5S_sel_type type1;
- H5S_sel_type type2;
- hsize_t *buf1 = NULL;
- hsize_t *buf2 = NULL;
- size_t i;
- htri_t ret_value = TRUE;
+ H5S_sel_type type1;
+ H5S_sel_type type2;
+ hsize_t * buf1 = NULL;
+ hsize_t * buf2 = NULL;
+ size_t i;
+ htri_t ret_value = TRUE;
/* Get and compare selection types */
- if((type1 = H5Sget_select_type(space1)) < 0)
+ if ((type1 = H5Sget_select_type(space1)) < 0)
TEST_ERROR
- if((type2 = H5Sget_select_type(space2)) < 0)
+ if ((type2 = H5Sget_select_type(space2)) < 0)
TEST_ERROR
- if(type1 != type2)
+ if (type1 != type2)
return FALSE;
/* Check selection type */
- switch(type1) {
+ switch (type1) {
case H5S_SEL_NONE:
case H5S_SEL_ALL:
break;
- case H5S_SEL_POINTS:
- {
- int rank1;
- int rank2;
- hssize_t npoints1;
- hssize_t npoints2;
+ case H5S_SEL_POINTS: {
+ int rank1;
+ int rank2;
+ hssize_t npoints1;
+ hssize_t npoints2;
- /* Get and compare rank */
- if((rank1 = H5Sget_simple_extent_ndims(space1)) < 0)
- TEST_ERROR
- if((rank2 = H5Sget_simple_extent_ndims(space2)) < 0)
- TEST_ERROR
- if(rank1 != rank2)
- return FALSE;
+ /* Get and compare rank */
+ if ((rank1 = H5Sget_simple_extent_ndims(space1)) < 0)
+ TEST_ERROR
+ if ((rank2 = H5Sget_simple_extent_ndims(space2)) < 0)
+ TEST_ERROR
+ if (rank1 != rank2)
+ return FALSE;
- /* Get and compare number of points */
- if((npoints1 = H5Sget_select_elem_npoints(space1)) < 0)
- TEST_ERROR
- if((npoints2 = H5Sget_select_elem_npoints(space2)) < 0)
- TEST_ERROR
- if(npoints1 != npoints2)
- return FALSE;
+ /* Get and compare number of points */
+ if ((npoints1 = H5Sget_select_elem_npoints(space1)) < 0)
+ TEST_ERROR
+ if ((npoints2 = H5Sget_select_elem_npoints(space2)) < 0)
+ TEST_ERROR
+ if (npoints1 != npoints2)
+ return FALSE;
- /* Allocate point lists. Do not return directly after
- * allocating, to make sure buffers are freed. */
- if(NULL == (buf1 = (hsize_t *)HDmalloc((size_t)rank1 * (size_t)npoints1 * sizeof(hsize_t))))
- TEST_ERROR
- if(NULL == (buf2 = (hsize_t *)HDmalloc((size_t)rank1 * (size_t)npoints1 * sizeof(hsize_t))))
- TEST_ERROR
+ /* Allocate point lists. Do not return directly after
+ * allocating, to make sure buffers are freed. */
+ if (NULL == (buf1 = (hsize_t *)HDmalloc((size_t)rank1 * (size_t)npoints1 * sizeof(hsize_t))))
+ TEST_ERROR
+ if (NULL == (buf2 = (hsize_t *)HDmalloc((size_t)rank1 * (size_t)npoints1 * sizeof(hsize_t))))
+ TEST_ERROR
- /* Get and compare point lists */
- if(H5Sget_select_elem_pointlist(space1, (hsize_t)0, (hsize_t)npoints1, buf1) < 0)
- TEST_ERROR
- if(H5Sget_select_elem_pointlist(space2, (hsize_t)0, (hsize_t)npoints1, buf2) < 0)
- TEST_ERROR
- for(i = 0; i < ((size_t)rank1 * (size_t)npoints1); i++)
- if(buf1[i] != buf2[i]) {
- ret_value = FALSE;
- break;
- }
+ /* Get and compare point lists */
+ if (H5Sget_select_elem_pointlist(space1, (hsize_t)0, (hsize_t)npoints1, buf1) < 0)
+ TEST_ERROR
+ if (H5Sget_select_elem_pointlist(space2, (hsize_t)0, (hsize_t)npoints1, buf2) < 0)
+ TEST_ERROR
+ for (i = 0; i < ((size_t)rank1 * (size_t)npoints1); i++)
+ if (buf1[i] != buf2[i]) {
+ ret_value = FALSE;
+ break;
+ }
- /* Free buffers */
- HDfree(buf1);
- buf1 = NULL;
- HDfree(buf2);
- buf2 = NULL;
- } /* end block */
+ /* Free buffers */
+ HDfree(buf1);
+ buf1 = NULL;
+ HDfree(buf2);
+ buf2 = NULL;
+ } /* end block */
- break;
+ break;
- case H5S_SEL_HYPERSLABS:
- {
- int rank1;
- int rank2;
- hssize_t nblocks1;
- hssize_t nblocks2;
+ case H5S_SEL_HYPERSLABS: {
+ int rank1;
+ int rank2;
+ hssize_t nblocks1;
+ hssize_t nblocks2;
- /* Get and compare rank */
- if((rank1 = H5Sget_simple_extent_ndims(space1)) < 0)
- TEST_ERROR
- if((rank2 = H5Sget_simple_extent_ndims(space2)) < 0)
- TEST_ERROR
- if(rank1 != rank2)
- return FALSE;
+ /* Get and compare rank */
+ if ((rank1 = H5Sget_simple_extent_ndims(space1)) < 0)
+ TEST_ERROR
+ if ((rank2 = H5Sget_simple_extent_ndims(space2)) < 0)
+ TEST_ERROR
+ if (rank1 != rank2)
+ return FALSE;
- /* Get and compare number of blocks */
- if((nblocks1 = H5Sget_select_hyper_nblocks(space1)) < 0)
- TEST_ERROR
- if((nblocks2 = H5Sget_select_hyper_nblocks(space2)) < 0)
- TEST_ERROR
- if(nblocks1 != nblocks2)
- return FALSE;
+ /* Get and compare number of blocks */
+ if ((nblocks1 = H5Sget_select_hyper_nblocks(space1)) < 0)
+ TEST_ERROR
+ if ((nblocks2 = H5Sget_select_hyper_nblocks(space2)) < 0)
+ TEST_ERROR
+ if (nblocks1 != nblocks2)
+ return FALSE;
- /* Allocate block lists. Do not return directly afer
- * allocating, to make sure buffers are freed. */
- if(NULL == (buf1 = (hsize_t *)HDmalloc((size_t)2 * (size_t)rank1 * (size_t)nblocks1 * sizeof(*buf1))))
- TEST_ERROR
- if(NULL == (buf2 = (hsize_t *)HDmalloc((size_t)2 * (size_t)rank1 * (size_t)nblocks1 * sizeof(*buf2))))
- TEST_ERROR
+ /* Allocate block lists. Do not return directly afer
+ * allocating, to make sure buffers are freed. */
+ if (NULL ==
+ (buf1 = (hsize_t *)HDmalloc((size_t)2 * (size_t)rank1 * (size_t)nblocks1 * sizeof(*buf1))))
+ TEST_ERROR
+ if (NULL ==
+ (buf2 = (hsize_t *)HDmalloc((size_t)2 * (size_t)rank1 * (size_t)nblocks1 * sizeof(*buf2))))
+ TEST_ERROR
- /* Get and compare block lists */
- if(H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks1, buf1) < 0)
- TEST_ERROR
- if(H5Sget_select_hyper_blocklist(space2, (hsize_t)0, (hsize_t)nblocks1, buf2) < 0)
- TEST_ERROR
- for(i = 0; i < ((size_t)2 * (size_t)rank1 * (size_t)nblocks1); i++)
- if(buf1[i] != buf2[i]) {
- ret_value = FALSE;
- break;
- }
+ /* Get and compare block lists */
+ if (H5Sget_select_hyper_blocklist(space1, (hsize_t)0, (hsize_t)nblocks1, buf1) < 0)
+ TEST_ERROR
+ if (H5Sget_select_hyper_blocklist(space2, (hsize_t)0, (hsize_t)nblocks1, buf2) < 0)
+ TEST_ERROR
+ for (i = 0; i < ((size_t)2 * (size_t)rank1 * (size_t)nblocks1); i++)
+ if (buf1[i] != buf2[i]) {
+ ret_value = FALSE;
+ break;
+ }
- /* Free buffers */
- HDfree(buf1);
- buf1 = NULL;
- HDfree(buf2);
- buf2 = NULL;
- } /* end block */
+ /* Free buffers */
+ HDfree(buf1);
+ buf1 = NULL;
+ HDfree(buf2);
+ buf2 = NULL;
+ } /* end block */
- break;
+ break;
case H5S_SEL_ERROR:
case H5S_SEL_N:
@@ -201,15 +188,14 @@ vds_select_equal(hid_t space1, hid_t space2)
return ret_value;
error:
- if(buf1)
+ if (buf1)
HDfree(buf1);
- if(buf2)
+ if (buf2)
HDfree(buf2);
return -1;
} /* end vds_select_equal() */
-
/*-------------------------------------------------------------------------
* Function: vds_check_mapping
*
@@ -222,13 +208,13 @@ error:
*-------------------------------------------------------------------------
*/
static int
-vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace,
- const char *filename, const char *dsetname)
+vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace, const char *filename,
+ const char *dsetname)
{
- hid_t space_out = -1;
- char name_out[32];
- htri_t tri_ret;
- ssize_t str_len;
+ hid_t space_out = -1;
+ char name_out[32];
+ htri_t tri_ret;
+ ssize_t str_len;
HDassert(dcpl >= 0);
HDassert(vspace >= 0);
@@ -237,68 +223,66 @@ vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace,
HDassert(dsetname);
/* Check vspace */
- if((space_out = H5Pget_virtual_vspace(dcpl, i)) < 0)
+ if ((space_out = H5Pget_virtual_vspace(dcpl, i)) < 0)
TEST_ERROR
- if((tri_ret = H5Sextent_equal(space_out, vspace)) < 0)
+ if ((tri_ret = H5Sextent_equal(space_out, vspace)) < 0)
TEST_ERROR
- if(!tri_ret)
+ if (!tri_ret)
TEST_ERROR
- if((tri_ret = vds_select_equal(space_out, vspace)) < 0)
+ if ((tri_ret = vds_select_equal(space_out, vspace)) < 0)
TEST_ERROR
- if(!tri_ret)
+ if (!tri_ret)
TEST_ERROR
- if(H5Sclose(space_out) < 0)
+ if (H5Sclose(space_out) < 0)
TEST_ERROR
space_out = -1;
/* Check srcspace */
- if((space_out = H5Pget_virtual_srcspace(dcpl, i)) < 0)
+ if ((space_out = H5Pget_virtual_srcspace(dcpl, i)) < 0)
TEST_ERROR
- if((tri_ret = vds_select_equal(space_out, srcspace)) < 0)
+ if ((tri_ret = vds_select_equal(space_out, srcspace)) < 0)
TEST_ERROR
- if(!tri_ret)
+ if (!tri_ret)
TEST_ERROR
- if(H5Sclose(space_out) < 0)
+ if (H5Sclose(space_out) < 0)
TEST_ERROR
space_out = -1;
/* Check filename */
- if((str_len = H5Pget_virtual_filename(dcpl, i, NULL, (size_t)0)) < 0)
+ if ((str_len = H5Pget_virtual_filename(dcpl, i, NULL, (size_t)0)) < 0)
TEST_ERROR
- if((size_t)str_len != HDstrlen(filename))
+ if ((size_t)str_len != HDstrlen(filename))
TEST_ERROR
HDassert((size_t)str_len < sizeof(name_out));
- if((str_len = H5Pget_virtual_filename(dcpl, i, name_out, sizeof(name_out))) < 0)
+ if ((str_len = H5Pget_virtual_filename(dcpl, i, name_out, sizeof(name_out))) < 0)
TEST_ERROR
- if((size_t)str_len != HDstrlen(filename))
+ if ((size_t)str_len != HDstrlen(filename))
TEST_ERROR
- if(HDstrncmp(name_out, filename, (size_t)str_len + 1) != 0)
+ if (HDstrncmp(name_out, filename, (size_t)str_len + 1) != 0)
TEST_ERROR
/* Check dsetname */
- if((str_len = H5Pget_virtual_dsetname(dcpl, i, NULL, (size_t)0)) < 0)
+ if ((str_len = H5Pget_virtual_dsetname(dcpl, i, NULL, (size_t)0)) < 0)
TEST_ERROR
- if((size_t)str_len != HDstrlen(dsetname))
+ if ((size_t)str_len != HDstrlen(dsetname))
TEST_ERROR
HDassert((size_t)str_len < sizeof(name_out));
- if((str_len = H5Pget_virtual_dsetname(dcpl, i, name_out, sizeof(name_out))) < 0)
+ if ((str_len = H5Pget_virtual_dsetname(dcpl, i, name_out, sizeof(name_out))) < 0)
TEST_ERROR
- if((size_t)str_len != HDstrlen(dsetname))
+ if ((size_t)str_len != HDstrlen(dsetname))
TEST_ERROR
- if(HDstrncmp(name_out, dsetname, (size_t)str_len + 1) != 0)
+ if (HDstrncmp(name_out, dsetname, (size_t)str_len + 1) != 0)
TEST_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
- H5Sclose(space_out);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { H5Sclose(space_out); }
+ H5E_END_TRY
return -1;
} /* end vds_check_mapping() */
-
/*-------------------------------------------------------------------------
* Function: test_api_get_ex_dcpl
*
@@ -310,15 +294,15 @@ error:
*/
/* Helper function to get DCPL for examination depending on config */
static int
-test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
- hid_t *ex_dcpl, hid_t vspace, char *filename, hsize_t exp_meta_size)
+test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, hid_t *ex_dcpl, hid_t vspace,
+ char *filename, hsize_t exp_meta_size)
{
- hid_t file = -1; /* File */
- hid_t dset = -1; /* Virtual dataset */
- H5D_space_status_t space_status; /* Dataset space status */
- void *plist_buf = NULL; /* Serialized property list buffer */
- H5O_native_info_t ninfo; /* Object info struct */
- htri_t tri_ret;
+ hid_t file = -1; /* File */
+ hid_t dset = -1; /* Virtual dataset */
+ H5D_space_status_t space_status; /* Dataset space status */
+ void * plist_buf = NULL; /* Serialized property list buffer */
+ H5O_native_info_t ninfo; /* Object info struct */
+ htri_t tri_ret;
HDassert((config >= TEST_API_BASIC) && (config < TEST_API_NTESTS));
HDassert(fapl >= 0);
@@ -329,106 +313,107 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
HDassert(filename);
/* Take different action depending on test configuration */
- if(config >= TEST_API_CREATE_DSET) {
+ if (config >= TEST_API_CREATE_DSET) {
/* Create file and dataset */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if((dset = H5Dcreate2(file, "vdset", H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, "vdset", H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Test H5Dget_space_status */
- if(H5Dget_space_status(dset, &space_status) < 0)
+ if (H5Dget_space_status(dset, &space_status) < 0)
TEST_ERROR
- if(space_status != H5D_SPACE_STATUS_ALLOCATED)
+ if (space_status != H5D_SPACE_STATUS_ALLOCATED)
TEST_ERROR
/* Reopen dataset if requested */
- if(config >= TEST_API_REOPEN_DSET) {
+ if (config >= TEST_API_REOPEN_DSET) {
/* Close dataset */
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR
dset = -1;
/* Reopen file if requested */
- if(config == TEST_API_REOPEN_FILE) {
- if(H5Fclose(file) < 0)
+ if (config == TEST_API_REOPEN_FILE) {
+ if (H5Fclose(file) < 0)
TEST_ERROR
file = -1;
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
/* Open dataset */
- if((dset = H5Dopen2(file, "vdset", H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, "vdset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Get DCPL from dataset */
- if((*ex_dcpl = H5Dget_create_plist(dset)) < 0)
+ if ((*ex_dcpl = H5Dget_create_plist(dset)) < 0)
TEST_ERROR
/* Test H5Dget_offset() (just returns HADDR_UNDEF) */
- if(HADDR_UNDEF != H5Dget_offset(dset))
+ if (HADDR_UNDEF != H5Dget_offset(dset))
TEST_ERROR
/* Test H5Oget_info returns correct metadata size */
- if(H5Oget_native_info(dset, &ninfo, H5O_NATIVE_INFO_META_SIZE) < 0)
+ if (H5Oget_native_info(dset, &ninfo, H5O_NATIVE_INFO_META_SIZE) < 0)
TEST_ERROR
- if(ninfo.meta_size.obj.index_size != (hsize_t)0)
+ if (ninfo.meta_size.obj.index_size != (hsize_t)0)
TEST_ERROR
- if(config == TEST_API_REOPEN_FILE) {
- if(ninfo.meta_size.obj.heap_size != exp_meta_size) {
- HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)ninfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size);
+ if (config == TEST_API_REOPEN_FILE) {
+ if (ninfo.meta_size.obj.heap_size != exp_meta_size) {
+ HDprintf("VDS metadata size: %llu Expected: %llu\n",
+ (long long unsigned)ninfo.meta_size.obj.heap_size,
+ (long long unsigned)exp_meta_size);
TEST_ERROR
}
}
- else
- if((ninfo.meta_size.obj.heap_size != exp_meta_size)
- && (ninfo.meta_size.obj.heap_size != (hsize_t)0))
- TEST_ERROR
- if(ninfo.meta_size.attr.index_size != (hsize_t)0)
+ else if ((ninfo.meta_size.obj.heap_size != exp_meta_size) &&
+ (ninfo.meta_size.obj.heap_size != (hsize_t)0))
+ TEST_ERROR
+ if (ninfo.meta_size.attr.index_size != (hsize_t)0)
TEST_ERROR
- if(ninfo.meta_size.attr.index_size != (hsize_t)0)
+ if (ninfo.meta_size.attr.index_size != (hsize_t)0)
TEST_ERROR
/* Test H5Dget_space_status */
- if(H5Dget_space_status(dset, &space_status) < 0)
+ if (H5Dget_space_status(dset, &space_status) < 0)
TEST_ERROR
- if(space_status != H5D_SPACE_STATUS_ALLOCATED)
+ if (space_status != H5D_SPACE_STATUS_ALLOCATED)
TEST_ERROR
/* Close dataset */
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR
dset = -1;
/* Delete dataset */
- if(H5Ldelete(file, "vdset", H5P_DEFAULT) < 0)
+ if (H5Ldelete(file, "vdset", H5P_DEFAULT) < 0)
TEST_ERROR
/* Close file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
file = -1;
}
- else if(config == TEST_API_COPY_PLIST) {
+ else if (config == TEST_API_COPY_PLIST) {
/* Copy property list */
- if((*ex_dcpl = H5Pcopy(dcpl)) < 0)
+ if ((*ex_dcpl = H5Pcopy(dcpl)) < 0)
TEST_ERROR
}
- else if(config == TEST_API_ENCDEC_PLIST) {
+ else if (config == TEST_API_ENCDEC_PLIST) {
size_t plist_buf_size;
/* Encode property list to plist_buf */
- if(H5Pencode2(dcpl, NULL, &plist_buf_size, fapl) < 0)
+ if (H5Pencode2(dcpl, NULL, &plist_buf_size, fapl) < 0)
TEST_ERROR
- if(NULL == (plist_buf = HDmalloc(plist_buf_size)))
+ if (NULL == (plist_buf = HDmalloc(plist_buf_size)))
TEST_ERROR
- if(H5Pencode2(dcpl, plist_buf, &plist_buf_size, fapl) < 0)
+ if (H5Pencode2(dcpl, plist_buf, &plist_buf_size, fapl) < 0)
TEST_ERROR
/* Decode serialized property list to *ex_dcpl */
- if((*ex_dcpl = H5Pdecode(plist_buf)) < 0)
+ if ((*ex_dcpl = H5Pdecode(plist_buf)) < 0)
TEST_ERROR
/* Free plist_buf */
@@ -438,7 +423,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
else {
/* Simply copy the id to ex_dcpl and increment the ref count so ex_dcpl
* can be closed */
- if(H5Iinc_ref(dcpl) < 0)
+ if (H5Iinc_ref(dcpl) < 0)
TEST_ERROR
*ex_dcpl = dcpl;
}
@@ -447,21 +432,23 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
* plist to itself, and do not do the comparison if we reopened the file,
* because in that case the extent of the source dset will not be corrent.
*/
- if((*ex_dcpl != dcpl) && (config != TEST_API_REOPEN_FILE)) {
- if((tri_ret = H5Pequal(dcpl, *ex_dcpl)) < 0)
+ if ((*ex_dcpl != dcpl) && (config != TEST_API_REOPEN_FILE)) {
+ if ((tri_ret = H5Pequal(dcpl, *ex_dcpl)) < 0)
TEST_ERROR
- if(!tri_ret)
+ if (!tri_ret)
TEST_ERROR
}
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file);
H5Dclose(dset);
- } H5E_END_TRY;
- if(plist_buf)
+ }
+ H5E_END_TRY;
+ if (plist_buf)
HDfree(plist_buf);
return -1;
@@ -472,29 +459,31 @@ static int
test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
{
char filename[FILENAME_BUF_SIZE];
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t ex_dcpl = -1; /* Temporary dcpl for examination */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t ex_dcpl = -1; /* Temporary dcpl for examination */
hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
- hid_t vspace[LIST_DOUBLE_SIZE]; /* Virtual dset dataspaces */
- const char *src_file[4] = {"src_file1", "src_file2.", "src_file3..", "src_file4..."}; /* Source file names (different lengths) */
- const char *src_dset[4] = {"src_dset1....", "src_dset2.....", "src_dset3......", "src_dset4......."}; /* Source dataset names (different lengths) */
+ hid_t vspace[LIST_DOUBLE_SIZE]; /* Virtual dset dataspaces */
+ const char *src_file[4] = {"src_file1", "src_file2.", "src_file3..",
+ "src_file4..."}; /* Source file names (different lengths) */
+ const char *src_dset[4] = {"src_dset1....", "src_dset2.....", "src_dset3......",
+ "src_dset4......."}; /* Source dataset names (different lengths) */
char tmp_filename[32];
char tmp_dsetname[32];
hsize_t dims[2] = {10, 20}; /* Data space current size */
- hsize_t start[2]; /* Hyperslab start */
- hsize_t stride[2]; /* Hyperslab stride */
- hsize_t count[2]; /* Hyperslab count */
- hsize_t block[2]; /* Hyperslab block */
- hsize_t coord[10]; /* Point selection array */
+ hsize_t start[2]; /* Hyperslab start */
+ hsize_t stride[2]; /* Hyperslab stride */
+ hsize_t count[2]; /* Hyperslab count */
+ hsize_t block[2]; /* Hyperslab block */
+ hsize_t coord[10]; /* Point selection array */
size_t size_out;
herr_t ret;
unsigned i;
/* Initialize vspace */
- for(i = 0; i < (unsigned)(sizeof(vspace) / sizeof(vspace[0])); i++)
+ for (i = 0; i < (unsigned)(sizeof(vspace) / sizeof(vspace[0])); i++)
vspace[i] = -1;
- switch(config) {
+ switch (config) {
case TEST_API_BASIC:
TESTING("virtual dataset API functions")
break;
@@ -521,82 +510,80 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Create DCPL */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
-
/*
* Test 1: All - all selection
*/
/* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all (should not be necessary, but just to be sure) */
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
- if(H5Sselect_all(vspace[0]) < 0)
+ if (H5Sselect_all(vspace[0]) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)69) < 0)
+ if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)69) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
- if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
+ if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
- if(size_out != (size_t)1)
+ if (size_out != (size_t)1)
TEST_ERROR
/* Check that the mapping in the DCPL is correct */
- if(vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0)
+ if (vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0)
TEST_ERROR
/* Close */
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Pclose(ex_dcpl) < 0)
+ if (H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;
-
/*
* Test 2: Hyper - hyper selection
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select regular hyperslab in source space */
- start[0] = 2;
- start[1] = 1;
+ start[0] = 2;
+ start[1] = 1;
stride[0] = 3;
stride[1] = 5;
- count[0] = 2;
- count[1] = 3;
- block[0] = 2;
- block[1] = 4;
- if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 2;
+ count[1] = 3;
+ block[0] = 2;
+ block[1] = 4;
+ if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Select composite hyperslab in virtual space */
@@ -604,60 +591,60 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
count[1] = 1;
block[0] = 5;
block[1] = 6;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, block) < 0)
TEST_ERROR
start[0] = 7;
start[1] = 0;
block[0] = 1;
block[1] = 18;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, NULL, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, NULL, count, block) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename,
- (low >= H5F_LIBVER_V112)?(hsize_t)99:(low >= H5F_LIBVER_V110?174:213)) < 0)
+ if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename,
+ (low >= H5F_LIBVER_V112) ? (hsize_t)99 : (low >= H5F_LIBVER_V110 ? 174 : 213)) <
+ 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
- if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
+ if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
- if(size_out != (size_t)1)
+ if (size_out != (size_t)1)
TEST_ERROR
/* Check that the mapping in the DCPL is correct */
- if(vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0)
+ if (vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0)
TEST_ERROR
/* Close */
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Pclose(ex_dcpl) < 0)
+ if (H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;
-
#ifdef VDS_POINT_SELECTIONS /* VDS does not currently support point selections */
/*
* Test 3: Point - point selection
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select points in source space */
@@ -671,7 +658,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
coord[7] = 14;
coord[8] = 8;
coord[9] = 18;
- if(H5Sselect_elements(srcspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
+ if (H5Sselect_elements(srcspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
TEST_ERROR
/* Select points in virtual space */
@@ -685,52 +672,51 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
coord[7] = 11;
coord[8] = 5;
coord[9] = 5;
- if(H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
+ if (H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
+ if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
- if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
+ if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
- if(size_out != (size_t)1)
+ if (size_out != (size_t)1)
TEST_ERROR
/* Check that the mapping in the DCPL is correct */
- if(vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0)
+ if (vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0)
TEST_ERROR
/* Close */
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Pclose(ex_dcpl) < 0)
+ if (H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;
-
/*
* Test 4: Point - hyper selection
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select hyperslab in source space */
@@ -740,7 +726,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
count[1] = 1;
block[0] = 1;
block[1] = 5;
- if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, block) < 0)
+ if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, block) < 0)
TEST_ERROR
/* Select points in virtual space */
@@ -754,73 +740,72 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
coord[7] = 13;
coord[8] = 7;
coord[9] = 16;
- if(H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
+ if (H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
+ if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
- if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
+ if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
- if(size_out != (size_t)1)
+ if (size_out != (size_t)1)
TEST_ERROR
/* Check that the mapping in the DCPL is correct */
- if(vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0)
+ if (vds_check_mapping(ex_dcpl, (size_t)0, vspace[0], srcspace[0], src_file[0], src_dset[0]) < 0)
TEST_ERROR
/* Close */
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Pclose(ex_dcpl) < 0)
+ if (H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;
-
/*
* Test 5: All previous mappings together
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create dataspaces */
- for(i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++) {
/* Create source dataspace */
- if((srcspace[i] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[i] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
}
/* Select all (should not be necessary, but just to be sure) */
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
- if(H5Sselect_all(vspace[0]) < 0)
+ if (H5Sselect_all(vspace[0]) < 0)
TEST_ERROR
/* Select regular hyperslab in source space */
- start[0] = 2;
- start[1] = 1;
+ start[0] = 2;
+ start[1] = 1;
stride[0] = 3;
stride[1] = 5;
- count[0] = 2;
- count[1] = 3;
- block[0] = 2;
- block[1] = 4;
- if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 2;
+ count[1] = 3;
+ block[0] = 2;
+ block[1] = 4;
+ if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Select composite hyperslab in virtual space */
@@ -828,13 +813,13 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
count[1] = 1;
block[0] = 5;
block[1] = 6;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, block) < 0)
TEST_ERROR
start[0] = 7;
start[1] = 0;
block[0] = 1;
block[1] = 18;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, NULL, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, NULL, count, block) < 0)
TEST_ERROR
/* Select points in source space */
@@ -848,7 +833,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
coord[7] = 14;
coord[8] = 8;
coord[9] = 18;
- if(H5Sselect_elements(srcspace[2], H5S_SELECT_SET, (size_t)5, coord) < 0)
+ if (H5Sselect_elements(srcspace[2], H5S_SELECT_SET, (size_t)5, coord) < 0)
TEST_ERROR
/* Select points in virtual space */
@@ -862,7 +847,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
coord[7] = 11;
coord[8] = 5;
coord[9] = 5;
- if(H5Sselect_elements(vspace[2], H5S_SELECT_SET, (size_t)5, coord) < 0)
+ if (H5Sselect_elements(vspace[2], H5S_SELECT_SET, (size_t)5, coord) < 0)
TEST_ERROR
/* Select hyperslab in source space */
@@ -872,7 +857,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
count[1] = 1;
block[0] = 1;
block[1] = 5;
- if(H5Sselect_hyperslab(srcspace[3], H5S_SELECT_SET, start, NULL, count, block) < 0)
+ if (H5Sselect_hyperslab(srcspace[3], H5S_SELECT_SET, start, NULL, count, block) < 0)
TEST_ERROR
/* Select points in virtual space */
@@ -886,57 +871,57 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
coord[7] = 13;
coord[8] = 7;
coord[9] = 16;
- if(H5Sselect_elements(vspace[3], H5S_SELECT_SET, (size_t)5, coord) < 0)
+ if (H5Sselect_elements(vspace[3], H5S_SELECT_SET, (size_t)5, coord) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- for(i = 0; i < 4; i++)
- if(H5Pset_virtual(dcpl, vspace[i], src_file[i], src_dset[i], srcspace[i]) < 0)
+ for (i = 0; i < 4; i++)
+ if (H5Pset_virtual(dcpl, vspace[i], src_file[i], src_dset[i], srcspace[i]) < 0)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
+ if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
- if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
+ if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
- if(size_out != (size_t)4)
+ if (size_out != (size_t)4)
TEST_ERROR
/* Check that the mappings in the DCPL are correct */
- for(i = 0; i < 4; i++)
- if(vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[i], src_file[i], src_dset[i]) < 0)
+ for (i = 0; i < 4; i++)
+ if (vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[i], src_file[i], src_dset[i]) < 0)
TEST_ERROR
/* Close */
- for(i = 0; i < 4; i++) {
- if(H5Sclose(srcspace[i]) < 0)
+ for (i = 0; i < 4; i++) {
+ if (H5Sclose(srcspace[i]) < 0)
TEST_ERROR
srcspace[i] = -1;
- if(H5Sclose(vspace[i]) < 0)
+ if (H5Sclose(vspace[i]) < 0)
TEST_ERROR
vspace[i] = -1;
}
- if(H5Pclose(ex_dcpl) < 0)
+ if (H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;
-#else /* VDS_POINT_SELECTIONS */
+#else /* VDS_POINT_SELECTIONS */
/*
* Test 3: Verify point selections fail
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select points in source space */
@@ -950,7 +935,7 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
coord[7] = 14;
coord[8] = 8;
coord[9] = 18;
- if(H5Sselect_elements(srcspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
+ if (H5Sselect_elements(srcspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
TEST_ERROR
/* Select points in virtual space */
@@ -964,32 +949,30 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
coord[7] = 11;
coord[8] = 5;
coord[9] = 5;
- if(H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
+ if (H5Sselect_elements(vspace[0], H5S_SELECT_SET, (size_t)5, coord) < 0)
TEST_ERROR
/* Attempt to add virtual layout mapping */
- H5E_BEGIN_TRY {
- ret = H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]);
- } H5E_END_TRY
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]); }
+ H5E_END_TRY
+ if (ret >= 0)
TEST_ERROR
#endif /* VDS_POINT_SELECTIONS */
-
/*
* Test 6: Enough Selections to trigger doubling of mapping list
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create source dataspace */
dims[0] = 1;
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all in source space (should not be necessary, but just to be sure) */
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
/* Init virtual space extent */
@@ -1004,40 +987,40 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
block[1] = 20;
/* Build virtual layout */
- for(i = 0; i < LIST_DOUBLE_SIZE; i++) {
+ for (i = 0; i < LIST_DOUBLE_SIZE; i++) {
/* Create virtual dataspace */
- if((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select row in virual dataspace */
start[0] = (hsize_t)i;
- if(H5Sselect_hyperslab(vspace[i], H5S_SELECT_SET, start, NULL, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[i], H5S_SELECT_SET, start, NULL, count, block) < 0)
TEST_ERROR
- /* Create file and dataset names */
- (void)HDsnprintf(tmp_filename, sizeof(tmp_filename), "src_file%u", i);
+ /* Create file and dataset names */
+ (void) HDsnprintf(tmp_filename, sizeof(tmp_filename), "src_file%u", i);
tmp_filename[sizeof(tmp_filename) - 1] = '\0';
(void)HDsnprintf(tmp_dsetname, sizeof(tmp_dsetname), "src_dset%u", i);
tmp_dsetname[sizeof(tmp_dsetname) - 1] = '\0';
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[i], tmp_filename, tmp_dsetname, srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[i], tmp_filename, tmp_dsetname, srcspace[0]) < 0)
TEST_ERROR
}
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename,
- (low >= H5F_LIBVER_V112)?(hsize_t)607:(hsize_t)697) < 0)
+ if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename,
+ (low >= H5F_LIBVER_V112) ? (hsize_t)607 : (hsize_t)697) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
- if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
+ if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
- if(size_out != (size_t)LIST_DOUBLE_SIZE)
+ if (size_out != (size_t)LIST_DOUBLE_SIZE)
TEST_ERROR
/* Verify virtual layout */
- for(i = 0; i < LIST_DOUBLE_SIZE; i++) {
+ for (i = 0; i < LIST_DOUBLE_SIZE; i++) {
/* Generate source file name */
(void)HDsnprintf(tmp_filename, sizeof(tmp_filename), "src_file%u", i);
tmp_filename[sizeof(tmp_filename) - 1] = '\0';
@@ -1047,60 +1030,58 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
tmp_dsetname[sizeof(tmp_dsetname) - 1] = '\0';
/* Check that the mapping in the DCPL is correct */
- if(vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[0], tmp_filename, tmp_dsetname) < 0)
+ if (vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[0], tmp_filename, tmp_dsetname) < 0)
TEST_ERROR
}
/* Close */
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- for(i = 0; i < LIST_DOUBLE_SIZE; i++) {
- if(H5Sclose(vspace[i]) < 0)
+ for (i = 0; i < LIST_DOUBLE_SIZE; i++) {
+ if (H5Sclose(vspace[i]) < 0)
TEST_ERROR
vspace[i] = -1;
}
- if(H5Pclose(ex_dcpl) < 0)
+ if (H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;
-
/*
* Test 7: Empty VDS
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all (should not be necessary, but just to be sure) */
- if(H5Sselect_all(vspace[0]) < 0)
+ if (H5Sselect_all(vspace[0]) < 0)
TEST_ERROR
/* Get examination DCPL */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
+ if (test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)0) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
- if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
+ if (H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
- if(size_out != (size_t)0)
+ if (size_out != (size_t)0)
TEST_ERROR
/* Close */
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Pclose(ex_dcpl) < 0)
+ if (H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;
-
/* Close */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
dcpl = -1;
@@ -1108,16 +1089,18 @@ test_api(test_api_config_t config, hid_t fapl, H5F_libver_t low)
return 0;
error:
- H5E_BEGIN_TRY {
- for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++)
+ H5E_BEGIN_TRY
+ {
+ for (i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++)
H5Sclose(srcspace[i]);
- for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++)
+ for (i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++)
H5Sclose(vspace[i]);
H5Pclose(dcpl);
H5Pclose(ex_dcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return 1;
+ return 1;
} /* end test_api() */
/*-------------------------------------------------------------------------
@@ -1134,39 +1117,39 @@ error:
static int
test_vds_prefix_first(unsigned config, hid_t fapl)
{
- char *srcfilename = NULL;
- char *srcfilename_map = NULL;
- char *vfilename = NULL;
- char *srcfilenamepct = NULL;
- char *srcfilenamepct_map = NULL;
+ char * srcfilename = NULL;
+ char * srcfilename_map = NULL;
+ char * vfilename = NULL;
+ char * srcfilenamepct = NULL;
+ char * srcfilenamepct_map = NULL;
const char *srcfilenamepct_map_orig = "vds%%%%_src";
- hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
- hid_t vfile = -1; /* File with virtual dset */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t dapl = -1; /* Dataset access property list */
- hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
- hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
- hid_t memspace = -1; /* Memory dataspace */
- hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
- hid_t vdset = -1; /* Virtual dataset */
- hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */
- int buf[10][26]; /* Write and expected read buffer */
- int rbuf[10][26]; /* Read buffer */
- int fill = -1; /* Fill value */
+ hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t dapl = -1; /* Dataset access property list */
+ hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
+ hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
+ hid_t memspace = -1; /* Memory dataspace */
+ hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */
+ int buf[10][26]; /* Write and expected read buffer */
+ int rbuf[10][26]; /* Read buffer */
+ int fill = -1; /* Fill value */
int i, j;
- char buffer[1024]; /* buffer to read vds_prefix */
+ char buffer[1024]; /* buffer to read vds_prefix */
TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection")
- if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE);
@@ -1180,180 +1163,182 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
TEST_ERROR
/* Create DCPL */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Set fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
TEST_ERROR
/* Initialize VDS prefix items */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
TEST_ERROR
- if(H5Pset_virtual_prefix(dapl, TMPDIR) < 0)
+ if (H5Pset_virtual_prefix(dapl, TMPDIR) < 0)
TEST_ERROR
- if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0)
+ if (H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0)
TEST_ERROR
- if(HDstrcmp(buffer, TMPDIR) != 0)
+ if (HDstrcmp(buffer, TMPDIR) != 0)
FAIL_PUTS_ERROR("vds prefix not set correctly");
/* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all (should not be necessary, but just to be sure) */
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
- if(H5Sselect_all(vspace[0]) < 0)
+ if (H5Sselect_all(vspace[0]) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset",
+ srcspace[0]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(NULL == HDgetcwd(buffer, 1024))
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (NULL == HDgetcwd(buffer, 1024))
TEST_ERROR
- if(HDchdir(TMPDIR) < 0)
+ if (HDchdir(TMPDIR) < 0)
TEST_ERROR
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if(HDchdir(buffer) < 0)
+ if (HDchdir(buffer) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source dataset */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Write data directly to source dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) {
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j]) {
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) {
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j]) {
TEST_ERROR
}
}
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data through virtual dataset */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Reopen srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(NULL == HDgetcwd(buffer, 1024))
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (NULL == HDgetcwd(buffer, 1024))
TEST_ERROR
- if(HDchdir(TMPDIR) < 0)
+ if (HDchdir(TMPDIR) < 0)
TEST_ERROR
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if(HDchdir(buffer) < 0)
+ if (HDchdir(buffer) < 0)
TEST_ERROR
}
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read data directly from source dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Close */
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
TEST_ERROR
dapl = -1;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
dcpl = -1;
@@ -1366,24 +1351,26 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
+error:
+ H5E_BEGIN_TRY
+ {
+ for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
H5Dclose(srcdset[i]);
H5Dclose(vdset);
- for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
H5Fclose(srcfile[i]);
H5Fclose(vfile);
- for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
H5Sclose(srcspace[i]);
- for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
H5Sclose(vspace[i]);
H5Sclose(memspace);
H5Pclose(dapl);
H5Pclose(dcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0)
+ if (HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0)
TEST_ERROR
HDfree(srcfilename);
@@ -1395,7 +1382,6 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
return 1;
} /* end test_vds_prefix */
-
/*-------------------------------------------------------------------------
* Function: test_basic_io
*
@@ -1409,50 +1395,50 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
static int
test_basic_io(unsigned config, hid_t fapl)
{
- char *srcfilename = NULL;
- char *srcfilename_map = NULL;
- char *vfilename = NULL;
- char *vfilename2 = NULL;
- char *srcfilenamepct = NULL;
- char *srcfilenamepct_map = NULL;
+ char * srcfilename = NULL;
+ char * srcfilename_map = NULL;
+ char * vfilename = NULL;
+ char * vfilename2 = NULL;
+ char * srcfilenamepct = NULL;
+ char * srcfilenamepct_map = NULL;
const char *srcfilenamepct_map_orig = "vds%%%%_src";
- hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
- hid_t vfile = -1; /* File with virtual dset */
- hid_t vfile2 = -1; /* File with copied virtual dset */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
- hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
- hid_t memspace = -1; /* Memory dataspace */
- hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
- hid_t vdset = -1; /* Virtual dataset */
- hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */
- hsize_t start[4]; /* Hyperslab start */
- hsize_t stride[4]; /* Hyperslab stride */
- hsize_t count[4]; /* Hyperslab count */
- hsize_t block[4]; /* Hyperslab block */
- hssize_t offset[2] = {0, 0}; /* Selection offset */
- int buf[10][26]; /* Write and expected read buffer */
- int rbuf[10][26]; /* Read buffer */
- int rbuf99[9][9]; /* 9x9 Read buffer */
- int evbuf[10][26]; /* Expected VDS "buffer" */
- int erbuf[10][26]; /* Expected read buffer */
- int fill = -1; /* Fill value */
- herr_t ret; /* Generic return value */
+ hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t vfile2 = -1; /* File with copied virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
+ hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
+ hid_t memspace = -1; /* Memory dataspace */
+ hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */
+ hsize_t start[4]; /* Hyperslab start */
+ hsize_t stride[4]; /* Hyperslab stride */
+ hsize_t count[4]; /* Hyperslab count */
+ hsize_t block[4]; /* Hyperslab block */
+ hssize_t offset[2] = {0, 0}; /* Selection offset */
+ int buf[10][26]; /* Write and expected read buffer */
+ int rbuf[10][26]; /* Read buffer */
+ int rbuf99[9][9]; /* 9x9 Read buffer */
+ int evbuf[10][26]; /* Expected VDS "buffer" */
+ int erbuf[10][26]; /* Expected read buffer */
+ int fill = -1; /* Fill value */
+ herr_t ret; /* Generic return value */
int i, j, u, v;
TESTING("basic virtual dataset I/O")
- if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((vfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((vfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE);
@@ -1463,897 +1449,905 @@ test_basic_io(unsigned config, hid_t fapl)
h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE);
/* Create DCPL */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Set fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
TEST_ERROR
/*
* Test 1: All - all selection
*/
/* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all (should not be necessary, but just to be sure) */
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
- if(H5Sselect_all(vspace[0]) < 0)
+ if (H5Sselect_all(vspace[0]) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset",
+ srcspace[0]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source dataset */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Write data directly to source dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data through virtual dataset */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Reopen srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read data directly from source dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Close */
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
-
/*
* Test 2: 2 Source datasets, hyperslab virtual mappings, '%' in source
* dataset name, also test H5Ocopy()
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[1] = 13;
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all in source space (should not be necessary, but just to be sure)
*/
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
start[1] = 13;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "%%src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "%%src_dset1", srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2%%", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "src_dset2%%", srcspace[0]) < 0)
TEST_ERROR
/* Reset dims */
dims[1] = 26;
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2%", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2%", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Write data directly to source datasets */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data through virtual dataset */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Reopen srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read data directly from source datasets */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
- if(H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Test H5Ocopy() to same file */
/* Copy virtual dataset */
- if(H5Ocopy(vfile, "v_dset", vfile, "v_dset2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Ocopy(vfile, "v_dset", vfile, "v_dset2", H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Close v_dset */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data directly to source datasets */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
/* Open v_dset2 */
- if((vdset = H5Dopen2(vfile, "v_dset2", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset2", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Read data through copied virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Reopen srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Only copy to a different file if the source datasets are in a different
* file */
- if(config & TEST_IO_DIFFERENT_FILE) {
+ if (config & TEST_IO_DIFFERENT_FILE) {
/* Close v_dset2 */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
/* Create file to copy virtual dataset to */
- if((vfile2 = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile2 = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Copy virtual dataset */
- if(H5Ocopy(vfile, "v_dset", vfile2, "v_dset3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Ocopy(vfile, "v_dset", vfile2, "v_dset3", H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data directly to source datasets */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen copied virtual file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile2) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile2) < 0)
TEST_ERROR
vfile2 = -1;
- if((vfile2 = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile2 = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
/* Open v_dset3 */
- if((vdset = H5Dopen2(vfile2, "v_dset3", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile2, "v_dset3", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Read data through copied virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Reopen srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Close copied virtual file */
- if(H5Fclose(vfile2) < 0)
+ if (H5Fclose(vfile2) < 0)
TEST_ERROR
vfile2 = -1;
}
/* Close */
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
-
/*
* Test 3: 2 Source datasets, hyperslab virtual mappings with offsets
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[1] = 13;
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all in source space (should not be necessary, but just to be sure)
*/
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
start[0] = 0;
start[1] = 3;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Add virtual layout mappings */
offset[1] = -3;
- if(H5Soffset_simple(vspace[0], offset) < 0)
+ if (H5Soffset_simple(vspace[0], offset) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "%%src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "%%src_dset1", srcspace[0]) < 0)
TEST_ERROR
offset[1] = 10;
- if(H5Soffset_simple(vspace[0], offset) < 0)
+ if (H5Soffset_simple(vspace[0], offset) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2%%", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "src_dset2%%", srcspace[0]) < 0)
TEST_ERROR
/* Reset dims */
dims[1] = 26;
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2%", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2%", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Write data directly to source datasets */
offset[1] = -3;
- if(H5Soffset_simple(vspace[0], offset) < 0)
+ if (H5Soffset_simple(vspace[0], offset) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
offset[1] = 10;
- if(H5Soffset_simple(vspace[0], offset) < 0)
+ if (H5Soffset_simple(vspace[0], offset) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data through virtual dataset */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Reopen srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "%src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read data directly from source datasets */
HDmemset(rbuf[0], 0, sizeof(rbuf));
offset[1] = -3;
- if(H5Soffset_simple(vspace[0], offset) < 0)
+ if (H5Soffset_simple(vspace[0], offset) < 0)
TEST_ERROR
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
offset[1] = 10;
- if(H5Soffset_simple(vspace[0], offset) < 0)
+ if (H5Soffset_simple(vspace[0], offset) < 0)
TEST_ERROR
- if(H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Close */
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
-
/*
* Test 4: 2 Source datasets, hyperslab virtual mappings on one mapping at a
* time, '%' in source file name
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[1] = 13;
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all in source space (should not be necessary, but just to be sure)
*/
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
start[1] = 13;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".",
+ "src_dset1", srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", "src_dset2", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".",
+ "src_dset2", srcspace[0]) < 0)
TEST_ERROR
/* Reset dims */
dims[1] = 26;
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Write data directly to source datasets */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read first source dataset through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, vspace[0], vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, vspace[0], vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2)
- ? buf[i][j] : 0))
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2) ? buf[i][j] : 0))
TEST_ERROR
/* Read second source dataset through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, vspace[1], vspace[1], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, vspace[1], vspace[1], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2)
- ? 0 : buf[i][j]))
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2) ? 0 : buf[i][j]))
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write first source dataset through virtual dataset */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, vspace[0], vspace[0], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, vspace[0], vspace[0], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write second source dataset through virtual dataset */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, vspace[1], vspace[1], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, vspace[1], vspace[1], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Reopen srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDONLY, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read data directly from source datasets */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, vspace[0], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
- if(H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[1], H5T_NATIVE_INT, vspace[1], H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2)
- ? (buf[i][j] - (int)(sizeof(buf) / sizeof(buf[0][0])))
- : buf[i][j]))
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != (j < (int)(sizeof(buf[0]) / sizeof(buf[0][0]) / 2)
+ ? (buf[i][j] - (int)(sizeof(buf) / sizeof(buf[0][0])))
+ : buf[i][j]))
TEST_ERROR
/* Close */
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
-
/*
* Test 5: 2 Source datasets, hyperslab virtual mappings and selections
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create source dataspaces */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((srcspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select hyperslabs in source space */
@@ -2361,10 +2355,10 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 10;
count[1] = 13;
- if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[1] = 13;
- if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
@@ -2372,105 +2366,109 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 5;
count[1] = 26;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[0] = 5;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[1]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2",
+ srcspace[1]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Write data directly to source datasets */
/* Write first dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update evbuf */
- for(i = 0; i < 5; i++) {
- for(j = 0; j < 13; j++)
+ for (i = 0; i < 5; i++) {
+ for (j = 0; j < 13; j++)
evbuf[i][j] = buf[2 * i][j];
- for(/* j = 13 */; j < 26; j++)
+ for (/* j = 13 */; j < 26; j++)
evbuf[i][j] = buf[2 * i + 1][j - 13];
}
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write second dataset */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update evbuf */
- for(i = 0; i < 5; i++) {
- for(j = 0; j < 13; j++)
+ for (i = 0; i < 5; i++) {
+ for (j = 0; j < 13; j++)
evbuf[i + 5][j] = buf[2 * i][j + 13];
- for(/* j = 13 */; j < 26; j++)
+ for (/* j = 13 */; j < 26; j++)
evbuf[i + 5][j] = buf[2 * i + 1][j];
}
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
@@ -2479,78 +2477,78 @@ test_basic_io(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Read first slice */
- if(H5Dread(vdset, H5T_NATIVE_INT, vspace[0], srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, vspace[0], srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++) {
- for(j = 0; j < 13; j++)
+ for (i = 0; i < 5; i++) {
+ for (j = 0; j < 13; j++)
erbuf[i][j] = evbuf[2 * i][j];
- for(/* j = 13 */; j < 26; j++)
+ for (/* j = 13 */; j < 26; j++)
erbuf[i][j] = evbuf[2 * i + 1][j - 13];
}
/* Read second slice */
- if(H5Dread(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++) {
- for(j = 0; j < 13; j++)
+ for (i = 0; i < 5; i++) {
+ for (j = 0; j < 13; j++)
erbuf[i + 5][j] = evbuf[2 * i][j + 13];
- for(/* j = 13 */; j < 26; j++)
+ for (/* j = 13 */; j < 26; j++)
erbuf[i + 5][j] = evbuf[2 * i + 1][j];
}
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data through virtual dataset */
/* Write first slice */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, vspace[0], srcspace[0], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, vspace[0], srcspace[0], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update evbuf */
- for(i = 0; i < 5; i++) {
- for(j = 0; j < 13; j++)
+ for (i = 0; i < 5; i++) {
+ for (j = 0; j < 13; j++)
evbuf[2 * i][j] = buf[i][j];
- for(/* j = 13 */; j < 26; j++)
+ for (/* j = 13 */; j < 26; j++)
evbuf[2 * i + 1][j - 13] = buf[i][j];
}
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write second slice */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update evbuf */
- for(i = 0; i < 5; i++) {
- for(j = 0; j < 13; j++)
+ for (i = 0; i < 5; i++) {
+ for (j = 0; j < 13; j++)
evbuf[2 * i][j + 13] = buf[i + 5][j];
- for(/* j = 13 */; j < 26; j++)
+ for (/* j = 13 */; j < 26; j++)
evbuf[2 * i + 1][j] = buf[i + 5][j];
}
/* Reopen srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
TEST_ERROR
}
@@ -2559,89 +2557,88 @@ test_basic_io(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Read first dataset */
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, srcspace[0], srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, srcspace[0], srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++) {
- for(j = 0; j < 13; j++)
+ for (i = 0; i < 5; i++) {
+ for (j = 0; j < 13; j++)
erbuf[2 * i][j] = evbuf[i][j];
- for(/* j = 13 */; j < 26; j++)
+ for (/* j = 13 */; j < 26; j++)
erbuf[2 * i + 1][j - 13] = evbuf[i][j];
}
/* Read second dataset */
- if(H5Dread(srcdset[1], H5T_NATIVE_INT, srcspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[1], H5T_NATIVE_INT, srcspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++) {
- for(j = 0; j < 13; j++)
+ for (i = 0; i < 5; i++) {
+ for (j = 0; j < 13; j++)
erbuf[2 * i][j + 13] = evbuf[i + 5][j];
- for(/* j = 13 */; j < 26; j++)
+ for (/* j = 13 */; j < 26; j++)
erbuf[2 * i + 1][j] = evbuf[i + 5][j];
}
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Close */
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(srcspace[1]) < 0)
+ if (H5Sclose(srcspace[1]) < 0)
TEST_ERROR
srcspace[1] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
-
/*
* Test 6: 2 Source datasets, checkerboard/stripe pattern to trigger
* sequence list refresh internally
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create memory dataspace */
- if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((memspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspaces */
dims[1] = 52;
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create source dataspace and file space for second operation (srcspace[1])
*/
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((srcspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Reset dims */
@@ -2649,130 +2646,134 @@ test_basic_io(unsigned config, hid_t fapl)
/* Select hyperslabs (stripe) in source space and file space for second
* operation (srcspace[1]) */
- start[0] = 0;
- start[1] = 0;
+ start[0] = 0;
+ start[1] = 0;
stride[0] = 1;
stride[1] = 2;
- count[0] = 1;
- count[1] = 26;
- block[0] = 10;
- block[1] = 1;
- if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = 26;
+ block[0] = 10;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 1;
- if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Select hyperslabs (checkerboard) in virtual spaces */
- start[0] = 0;
- start[1] = 0;
+ start[0] = 0;
+ start[1] = 0;
stride[0] = 2;
stride[1] = 2;
- count[0] = 5;
- count[1] = 26;
- block[0] = 1;
- block[1] = 1;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 5;
+ count[1] = 26;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[0] = 1;
start[1] = 1;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, block) < 0)
TEST_ERROR
start[0] = 0;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[0] = 1;
start[1] = 0;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2",
+ srcspace[0]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Write data directly to source datasets */
/* Write first dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i += 2)
- for(j = 0; j < 26; j++)
+ for (i = 0; i < 10; i += 2)
+ for (j = 0; j < 26; j++)
erbuf[i][j] = buf[i][j];
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write second dataset */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 1; i < 10; i += 2)
- for(j = 0; j < 26; j++)
+ for (i = 1; i < 10; i += 2)
+ for (j = 0; j < 26; j++)
erbuf[i][j] = buf[i][j];
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
@@ -2781,69 +2782,69 @@ test_basic_io(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Read first stripe pattern */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Read second stripe pattern */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, srcspace[1], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, srcspace[1], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i += 2)
- for(j = 0; j < 26; j++) {
+ for (i = 0; i < 10; i += 2)
+ for (j = 0; j < 26; j++) {
erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0]));
}
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data through virtual dataset */
/* Write first slice */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i += 2)
- for(j = 0; j < 26; j++)
+ for (i = 0; i < 10; i += 2)
+ for (j = 0; j < 26; j++)
erbuf[i][j] = buf[i][j];
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write second slice */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, srcspace[1], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, srcspace[1], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 1; i < 10; i += 2)
- for(j = 0; j < 26; j++)
+ for (i = 1; i < 10; i += 2)
+ for (j = 0; j < 26; j++)
erbuf[i][j] = buf[i][j];
/* Reopen srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
TEST_ERROR
}
@@ -2852,75 +2853,74 @@ test_basic_io(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Read first dataset */
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i += 2)
- for(j = 0; j < 26; j++) {
+ for (i = 0; i < 10; i += 2)
+ for (j = 0; j < 26; j++) {
erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0]));
}
/* Read second dataset */
- if(H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Close */
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(srcspace[1]) < 0)
+ if (H5Sclose(srcspace[1]) < 0)
TEST_ERROR
srcspace[1] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
- if(H5Sclose(memspace) < 0)
+ if (H5Sclose(memspace) < 0)
TEST_ERROR
memspace = -1;
-
/*
* Test 7: 1 Source dataset, two mappings, 4 dimensional virtual dataset
* and 3 dimensional source dataset
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create memory dataspace */
- if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((memspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspaces */
@@ -2928,18 +2928,18 @@ test_basic_io(unsigned config, hid_t fapl)
dims[1] = 3;
dims[2] = 3;
dims[3] = 3;
- if((vspace[0] = H5Screate_simple(4, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(4, dims, NULL)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(4, dims, NULL)) < 0)
+ if ((vspace[1] = H5Screate_simple(4, dims, NULL)) < 0)
TEST_ERROR
/* Create source dataspaces */
dims[0] = 2;
dims[1] = 4;
dims[2] = 4;
- if((srcspace[0] = H5Screate_simple(3, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(3, dims, NULL)) < 0)
TEST_ERROR
- if((srcspace[1] = H5Screate_simple(3, dims, NULL)) < 0)
+ if ((srcspace[1] = H5Screate_simple(3, dims, NULL)) < 0)
TEST_ERROR
/* Reset dims */
@@ -2947,118 +2947,121 @@ test_basic_io(unsigned config, hid_t fapl)
dims[1] = 26;
/* Select hyperslabs (stripes) in source spaces */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
stride[0] = 1;
stride[1] = 2;
stride[2] = 1;
- count[0] = 1;
- count[1] = 2;
- count[2] = 1;
- block[0] = 2;
- block[1] = 1;
- block[2] = 4;
- if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = 2;
+ count[2] = 1;
+ block[0] = 2;
+ block[1] = 1;
+ block[2] = 4;
+ if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 1;
- if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Select hyperslabs (corners) in first virtual space */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
- start[3] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ start[3] = 0;
stride[0] = 2;
stride[1] = 2;
stride[2] = 2;
stride[3] = 2;
- count[0] = 2;
- count[1] = 2;
- count[2] = 2;
- count[3] = 2;
- block[0] = 1;
- block[1] = 1;
- block[2] = 1;
- block[3] = 1;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 2;
+ count[1] = 2;
+ count[2] = 2;
+ count[3] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ block[3] = 1;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Select hyperslabs ("+" pattern) in second virtual space */
- start[0] = 1;
- start[1] = 1;
- start[2] = 0;
- start[3] = 0;
+ start[0] = 1;
+ start[1] = 1;
+ start[2] = 0;
+ start[3] = 0;
stride[0] = 2;
stride[1] = 2;
stride[2] = 2;
stride[3] = 2;
- count[0] = 1;
- count[1] = 1;
- count[2] = 2;
- count[3] = 2;
- block[0] = 1;
- block[1] = 1;
- block[2] = 1;
- block[3] = 1;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = 2;
+ count[3] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ block[2] = 1;
+ block[3] = 1;
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 0;
start[2] = 1;
count[1] = 2;
count[2] = 1;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
TEST_ERROR
start[0] = 0;
start[1] = 1;
count[0] = 2;
count[1] = 1;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
TEST_ERROR
start[0] = 1;
count[0] = 1;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 0;
start[3] = 1;
count[1] = 2;
count[3] = 1;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_OR, start, stride, count, block) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[1]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[1]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source dataset */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Select hyperslab in memory space */
@@ -3066,37 +3069,37 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 2;
count[1] = 16;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write data directly to source dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
@@ -3109,7 +3112,7 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 9;
count[1] = 3;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Read data through virtual dataset by hyperslab */
@@ -3125,17 +3128,17 @@ test_basic_io(unsigned config, hid_t fapl)
count[1] = 3;
count[2] = 1;
count[3] = 3;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Read first stripe pattern */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Update erbuf */
HDmemset(erbuf, 0, sizeof(erbuf));
- for(i = 0; i < 9; i++)
- for(j = 0; j < 3; j++)
+ for (i = 0; i < 9; i++)
+ for (j = 0; j < 3; j++)
erbuf[i][j] = fill;
erbuf[0][0] = buf[0][0];
erbuf[0][2] = buf[0][1];
@@ -3149,9 +3152,9 @@ test_basic_io(unsigned config, hid_t fapl)
erbuf[4][2] = buf[0][14];
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Reset rbuf */
@@ -3166,7 +3169,7 @@ test_basic_io(unsigned config, hid_t fapl)
count[1] = 3;
count[2] = 1;
count[3] = 3;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslab in memory space */
@@ -3174,16 +3177,16 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 3;
count[0] = 9;
count[1] = 3;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Read second stripe pattern */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 9; i++)
- for(j = 3; j < 6; j++)
+ for (i = 0; i < 9; i++)
+ for (j = 3; j < 6; j++)
erbuf[i][j] = fill;
erbuf[1][3] = buf[0][4];
erbuf[1][5] = buf[0][5];
@@ -3199,15 +3202,14 @@ test_basic_io(unsigned config, hid_t fapl)
erbuf[7][5] = buf[1][15];
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if((j >= 3) && (j < 6)) {
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if ((j >= 3) && (j < 6)) {
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
}
- else
- if(rbuf[i][j] != 0)
- TEST_ERROR
+ else if (rbuf[i][j] != 0)
+ TEST_ERROR
/* Reset rbuf */
HDmemset(rbuf[0], 0, sizeof(rbuf));
@@ -3221,7 +3223,7 @@ test_basic_io(unsigned config, hid_t fapl)
count[1] = 3;
count[2] = 1;
count[3] = 3;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslab in memory space */
@@ -3229,16 +3231,16 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 6;
count[0] = 9;
count[1] = 3;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Read third stripe pattern */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 9; i++)
- for(j = 6; j < 9; j++)
+ for (i = 0; i < 9; i++)
+ for (j = 6; j < 9; j++)
erbuf[i][j] = fill;
erbuf[0][6] = buf[0][2];
erbuf[0][8] = buf[0][3];
@@ -3252,135 +3254,134 @@ test_basic_io(unsigned config, hid_t fapl)
erbuf[4][8] = buf[1][6];
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if((j >= 6) && (j < 9)) {
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if ((j >= 6) && (j < 9)) {
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
}
- else
- if(rbuf[i][j] != 0)
- TEST_ERROR
+ else if (rbuf[i][j] != 0)
+ TEST_ERROR
/* Now read entire VDS */
/* Set memory space extent to 9x9, select all in order to reach part of the
* code in H5S_select_subtract() */
dims[0] = 9;
dims[1] = 9;
- if(H5Sset_extent_simple(memspace, 2, dims, NULL) < 0)
+ if (H5Sset_extent_simple(memspace, 2, dims, NULL) < 0)
TEST_ERROR
- if(H5Sselect_all(memspace) < 0)
+ if (H5Sselect_all(memspace) < 0)
TEST_ERROR
/* Read third stripe pattern */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf99[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf99[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(rbuf99) / sizeof(rbuf99[0])); i++)
- for(j = 0; j < (int)(sizeof(rbuf99[0]) / sizeof(rbuf99[0][0])); j++)
- if(rbuf99[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(rbuf99) / sizeof(rbuf99[0])); i++)
+ for (j = 0; j < (int)(sizeof(rbuf99[0]) / sizeof(rbuf99[0][0])); j++)
+ if (rbuf99[i][j] != erbuf[i][j])
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data through virtual dataset by hyperslab */
/* Select stripe (only select mapped elements) */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
- start[3] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ start[3] = 0;
stride[0] = 2;
stride[1] = 2;
stride[2] = 1;
stride[3] = 2;
- count[0] = 2;
- count[1] = 2;
- count[2] = 1;
- count[3] = 2;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride ,count, NULL) < 0)
- TEST_ERROR
- start[0] = 1;
- start[1] = 1;
- start[2] = 0;
- start[3] = 0;
+ count[0] = 2;
+ count[1] = 2;
+ count[2] = 1;
+ count[3] = 2;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, NULL) < 0)
+ TEST_ERROR
+ start[0] = 1;
+ start[1] = 1;
+ start[2] = 0;
+ start[3] = 0;
stride[0] = 1;
stride[1] = 1;
stride[2] = 1;
stride[3] = 2;
- count[0] = 1;
- count[1] = 1;
- count[2] = 1;
- count[3] = 2;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride ,count, NULL) < 0)
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = 1;
+ count[3] = 2;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, NULL) < 0)
TEST_ERROR
/* Reset extent of memspace, select hyperslab */
dims[0] = 10;
dims[1] = 26;
- if(H5Sset_extent_simple(memspace, 2, dims, NULL) < 0)
+ if (H5Sset_extent_simple(memspace, 2, dims, NULL) < 0)
TEST_ERROR
start[0] = 0;
start[1] = 0;
count[0] = 1;
count[1] = 10;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write data through virtual dataset by hyperslab */
/* Write first stripe pattern */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
HDmemset(erbuf, 0, sizeof(erbuf));
- erbuf[0][0] = buf[0][0];
- erbuf[0][1] = buf[0][1];
- erbuf[0][8] = buf[0][2];
- erbuf[0][9] = buf[0][3];
- erbuf[1][0] = buf[0][6];
- erbuf[1][1] = buf[0][7];
- erbuf[1][8] = buf[0][8];
- erbuf[1][9] = buf[0][9];
+ erbuf[0][0] = buf[0][0];
+ erbuf[0][1] = buf[0][1];
+ erbuf[0][8] = buf[0][2];
+ erbuf[0][9] = buf[0][3];
+ erbuf[1][0] = buf[0][6];
+ erbuf[1][1] = buf[0][7];
+ erbuf[1][8] = buf[0][8];
+ erbuf[1][9] = buf[0][9];
erbuf[0][13] = buf[0][4];
erbuf[0][14] = buf[0][5];
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Select stripe (only select mapped elements) */
- start[0] = 0;
- start[1] = 1;
- start[2] = 1;
- start[3] = 0;
+ start[0] = 0;
+ start[1] = 1;
+ start[2] = 1;
+ start[3] = 0;
stride[0] = 1;
stride[1] = 1;
stride[2] = 1;
stride[3] = 2;
- count[0] = 3;
- count[1] = 1;
- count[2] = 1;
- count[3] = 2;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride ,count, NULL) < 0)
- TEST_ERROR
- start[0] = 1;
- start[1] = 0;
- start[2] = 1;
- start[3] = 0;
+ count[0] = 3;
+ count[1] = 1;
+ count[2] = 1;
+ count[3] = 2;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, NULL) < 0)
+ TEST_ERROR
+ start[0] = 1;
+ start[1] = 0;
+ start[2] = 1;
+ start[3] = 0;
stride[0] = 1;
stride[1] = 2;
stride[2] = 1;
stride[3] = 1;
- count[0] = 1;
- count[1] = 2;
- count[2] = 1;
- count[3] = 3;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride ,count, NULL) < 0)
+ count[0] = 1;
+ count[1] = 2;
+ count[2] = 1;
+ count[3] = 3;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, NULL) < 0)
TEST_ERROR
/* Select hyperslab in memory space */
@@ -3388,60 +3389,60 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 1;
count[1] = 12;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write second slice */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- erbuf[0][4] = buf[0][0];
- erbuf[0][5] = buf[0][1];
- erbuf[0][6] = buf[0][2];
- erbuf[0][7] = buf[0][3];
+ erbuf[0][4] = buf[0][0];
+ erbuf[0][5] = buf[0][1];
+ erbuf[0][6] = buf[0][2];
+ erbuf[0][7] = buf[0][3];
erbuf[0][12] = buf[0][4];
erbuf[0][15] = buf[0][5];
- erbuf[1][4] = buf[0][6];
- erbuf[1][7] = buf[0][7];
+ erbuf[1][4] = buf[0][6];
+ erbuf[1][7] = buf[0][7];
erbuf[1][12] = buf[0][8];
erbuf[1][13] = buf[0][9];
erbuf[1][14] = buf[0][10];
erbuf[1][15] = buf[0][11];
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Select stripe (only select mapped elements) */
- start[0] = 0;
- start[1] = 0;
- start[2] = 2;
- start[3] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 2;
+ start[3] = 0;
stride[0] = 2;
stride[1] = 2;
stride[2] = 1;
stride[3] = 2;
- count[0] = 2;
- count[1] = 2;
- count[2] = 1;
- count[3] = 2;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride ,count, NULL) < 0)
- TEST_ERROR
- start[0] = 1;
- start[1] = 1;
- start[2] = 2;
- start[3] = 0;
+ count[0] = 2;
+ count[1] = 2;
+ count[2] = 1;
+ count[3] = 2;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, NULL) < 0)
+ TEST_ERROR
+ start[0] = 1;
+ start[1] = 1;
+ start[2] = 2;
+ start[3] = 0;
stride[0] = 1;
stride[1] = 1;
stride[2] = 1;
stride[3] = 2;
- count[0] = 1;
- count[1] = 1;
- count[2] = 1;
- count[3] = 2;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride ,count, NULL) < 0)
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = 1;
+ count[3] = 2;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_OR, start, stride, count, NULL) < 0)
TEST_ERROR
/* Select hyperslab in memory space */
@@ -3449,31 +3450,31 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 1;
count[1] = 10;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write third slice */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- erbuf[0][2] = buf[0][0];
- erbuf[0][3] = buf[0][1];
+ erbuf[0][2] = buf[0][0];
+ erbuf[0][3] = buf[0][1];
erbuf[0][10] = buf[0][2];
erbuf[0][11] = buf[0][3];
- erbuf[1][2] = buf[0][6];
- erbuf[1][3] = buf[0][7];
+ erbuf[1][2] = buf[0][6];
+ erbuf[1][3] = buf[0][7];
erbuf[1][10] = buf[0][8];
erbuf[1][11] = buf[0][9];
- erbuf[1][5] = buf[0][4];
- erbuf[1][6] = buf[0][5];
+ erbuf[1][5] = buf[0][4];
+ erbuf[1][6] = buf[0][5];
/* Reopen srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
}
@@ -3483,106 +3484,106 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 2;
count[1] = 16;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL ,count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Reset rbuf */
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Read dataset */
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Now try writing to whole VDS (should fail due to unmapped elements) */
count[0] = 9;
count[1] = 9;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- H5E_BEGIN_TRY {
- ret = H5Dwrite(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]);
- } H5E_END_TRY
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Dwrite(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]); }
+ H5E_END_TRY
+ if (ret >= 0)
TEST_ERROR
/* Close */
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(srcspace[1]) < 0)
+ if (H5Sclose(srcspace[1]) < 0)
TEST_ERROR
srcspace[1] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
- if(H5Sclose(memspace) < 0)
+ if (H5Sclose(memspace) < 0)
TEST_ERROR
memspace = -1;
-
/*
* Test 8: For code coverage: Horizontal block virtual mappings, and file
* selection, grid memory selection
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create memory dataspace */
- if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((memspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspaces */
dims[0] = 8;
dims[1] = 15;
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[0] = 4;
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all in source space (should not be necessary, but just to be sure)
*/
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
start[0] = 4;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2",
+ srcspace[0]) < 0)
TEST_ERROR
/* Reset dims */
@@ -3590,36 +3591,38 @@ test_basic_io(unsigned config, hid_t fapl)
dims[1] = 26;
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Reset erbuf */
HDmemset(erbuf[0], 0, sizeof(rbuf));
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Select hyperslab in memory */
@@ -3627,21 +3630,21 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 4;
count[1] = 15;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write data directly to first source dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
u = 0;
v = 0;
- for(i = 2; i < 4; i++)
- for(j = 0; j < 15; j++) {
+ for (i = 2; i < 4; i++)
+ for (j = 0; j < 15; j++) {
erbuf[u][v] = buf[i][j];
v += 2;
- if(v >= 24) {
+ if (v >= 24) {
u += 2;
v = 0;
}
@@ -3649,61 +3652,61 @@ test_basic_io(unsigned config, hid_t fapl)
/* Select hyperslab in memory */
start[0] = 4;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write data directly to second source dataset */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 4; i < 6; i++)
- for(j = 0; j < 15; j++) {
+ for (i = 4; i < 6; i++)
+ for (j = 0; j < 15; j++) {
erbuf[u][v] = buf[i][j];
v += 2;
- if(v >= 24) {
+ if (v >= 24) {
u += 2;
v = 0;
}
}
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Select hyperslab in memory */
- start[0] = 0;
- start[1] = 0;
+ start[0] = 0;
+ start[1] = 0;
stride[0] = 2;
stride[1] = 2;
- count[0] = 5;
- count[1] = 12;
- block[0] = 1;
- block[1] = 1;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 5;
+ count[1] = 12;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Select hyperslab in file */
@@ -3711,104 +3714,106 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 4;
count[1] = 15;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
- if(H5Sclose(memspace) < 0)
+ if (H5Sclose(memspace) < 0)
TEST_ERROR
memspace = -1;
-
/*
* Test 9: For code coverage: Horizontal block virtual mappings, and file
* selection, grid memory selection, 3 mappings, 3D memory space
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create memory dataspace */
dims[1] = 13;
dims[2] = 2;
- if((memspace = H5Screate_simple(3, dims, NULL)) < 0)
+ if ((memspace = H5Screate_simple(3, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspaces */
dims[0] = 6;
dims[1] = 10;
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
- if((vspace[2] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[2] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[0] = 2;
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all in source space (should not be necessary, but just to be sure)
*/
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
start[0] = 2;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
start[0] = 4;
- if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3",
+ srcspace[0]) < 0)
TEST_ERROR
/* Reset dims */
@@ -3816,38 +3821,41 @@ test_basic_io(unsigned config, hid_t fapl)
dims[1] = 26;
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Reset erbuf */
HDmemset(erbuf[0], 0, sizeof(rbuf));
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Select hyperslab in memory */
@@ -3857,22 +3865,22 @@ test_basic_io(unsigned config, hid_t fapl)
count[0] = 2;
count[1] = 5;
count[2] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write data directly to first source dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
u = 0;
v = 0;
- for(i = 0; i < 2; i++)
- for(j = 0; j < 10; j++) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 10; j++) {
erbuf[u][v] = buf[i][j];
- if(++v == 6)
+ if (++v == 6)
v += 2;
- else if(v == 14) {
+ else if (v == 14) {
u += 2;
v = 0;
}
@@ -3880,20 +3888,20 @@ test_basic_io(unsigned config, hid_t fapl)
/* Select hyperslab in memory */
start[0] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write data directly to second source dataset */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 2; i < 4; i++)
- for(j = 0; j < 10; j++) {
+ for (i = 2; i < 4; i++)
+ for (j = 0; j < 10; j++) {
erbuf[u][v] = buf[i][j];
- if(++v == 6)
+ if (++v == 6)
v += 2;
- else if(v == 14) {
+ else if (v == 14) {
u += 2;
v = 0;
}
@@ -3901,174 +3909,175 @@ test_basic_io(unsigned config, hid_t fapl)
/* Select hyperslab in memory */
start[0] = 4;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write data directly to third source dataset */
- if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 4; i < 6; i++)
- for(j = 0; j < 10; j++) {
+ for (i = 4; i < 6; i++)
+ for (j = 0; j < 10; j++) {
erbuf[u][v] = buf[i][j];
- if(++v == 6)
+ if (++v == 6)
v += 2;
- else if(v == 14) {
+ else if (v == 14) {
u += 2;
v = 0;
}
}
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(srcdset[2]) < 0)
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Select hyperslab in memory */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
stride[0] = 2;
stride[1] = 4;
stride[2] = 1;
- count[0] = 5;
- count[1] = 2;
- count[2] = 1;
- block[0] = 1;
- block[1] = 3;
- block[2] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 5;
+ count[1] = 2;
+ count[2] = 1;
+ block[0] = 1;
+ block[1] = 3;
+ block[2] = 2;
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(srcdset[2]) < 0)
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
- if(H5Sclose(vspace[2]) < 0)
+ if (H5Sclose(vspace[2]) < 0)
TEST_ERROR
vspace[2] = -1;
- if(H5Sclose(memspace) < 0)
+ if (H5Sclose(memspace) < 0)
TEST_ERROR
memspace = -1;
-
/*
* Test 10: For code coverage: Vertical stripe virtual mappings, vertical
* block file selection, block memory selection, 3D VDS
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create memory dataspace */
- if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((memspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspaces */
dims[0] = 10;
dims[1] = 9;
dims[2] = 6;
- if((vspace[0] = H5Screate_simple(3, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(3, dims, NULL)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(3, dims, NULL)) < 0)
+ if ((vspace[1] = H5Screate_simple(3, dims, NULL)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[1] = 12;
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all in source space (should not be necessary, but just to be sure)
*/
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
- count[0] = 1;
- count[1] = 4;
- count[2] = 3;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 1;
+ count[1] = 4;
+ count[2] = 3;
stride[0] = 1;
stride[1] = 2;
stride[2] = 2;
- block[0] = 10;
- block[1] = 1;
- block[2] = 1;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ block[0] = 10;
+ block[1] = 1;
+ block[2] = 1;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[2] = 1;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2",
+ srcspace[0]) < 0)
TEST_ERROR
/* Reset dims */
@@ -4076,41 +4085,43 @@ test_basic_io(unsigned config, hid_t fapl)
dims[1] = 26;
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Initialize erbuf */
HDmemset(erbuf[0], 0, sizeof(rbuf));
- for(i = 0; i < 10; i++)
- for(j = 0; j < 24; j += 6) {
- erbuf[i][j] = -1;
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 24; j += 6) {
+ erbuf[i][j] = -1;
erbuf[i][j + 1] = -1;
}
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Select hyperslab in memory */
@@ -4118,24 +4129,24 @@ test_basic_io(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 10;
count[1] = 12;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write data directly to first source dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
u = 0;
v = 0;
- for(i = 0; i < 10; i++)
- for(j = 0; j < 8; j++) {
- if(v == 0 || v == 12)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 8; j++) {
+ if (v == 0 || v == 12)
erbuf[u][v] = buf[i][j];
v += 2;
- if(!(v % 6))
+ if (!(v % 6))
v += 6;
- if(v >= 28) {
+ if (v >= 28) {
u++;
v = 0;
}
@@ -4143,66 +4154,66 @@ test_basic_io(unsigned config, hid_t fapl)
/* Select hyperslab in memory */
start[1] = 8;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write data directly to second source dataset */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
u = 0;
v = 1;
- for(i = 0; i < 10; i++)
- for(j = 8; j < 16; j++) {
- if(v == 1 || v == 13)
+ for (i = 0; i < 10; i++)
+ for (j = 8; j < 16; j++) {
+ if (v == 1 || v == 13)
erbuf[u][v] = buf[i][j];
v += 2;
- if(!((v - 1) % 6))
+ if (!((v - 1) % 6))
v += 6;
- if(v >= 28) {
+ if (v >= 28) {
u++;
v = 1;
}
}
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Select hyperslab in memory */
- start[0] = 0;
- start[1] = 0;
+ start[0] = 0;
+ start[1] = 0;
stride[0] = 1;
stride[1] = 6;
- count[0] = 1;
- count[1] = 4;
- block[0] = 10;
- block[1] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = 4;
+ block[0] = 10;
+ block[1] = 2;
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Select hyperslab in file */
@@ -4212,54 +4223,53 @@ test_basic_io(unsigned config, hid_t fapl)
count[0] = 10;
count[1] = 4;
count[2] = 2;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
- if(H5Sclose(memspace) < 0)
+ if (H5Sclose(memspace) < 0)
TEST_ERROR
memspace = -1;
-
/* Close */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
dcpl = -1;
@@ -4274,21 +4284,23 @@ test_basic_io(unsigned config, hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
+ H5E_BEGIN_TRY
+ {
+ for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
H5Dclose(srcdset[i]);
H5Dclose(vdset);
- for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
H5Fclose(srcfile[i]);
H5Fclose(vfile);
H5Fclose(vfile2);
- for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
H5Sclose(srcspace[i]);
- for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
H5Sclose(vspace[i]);
H5Sclose(memspace);
H5Pclose(dcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(srcfilename);
HDfree(srcfilename_map);
@@ -4297,10 +4309,9 @@ error:
HDfree(srcfilenamepct);
HDfree(srcfilenamepct_map);
- return 1;
+ return 1;
} /* end test_basic_io() */
-
/*-------------------------------------------------------------------------
* Function: test_unlim
*
@@ -4313,34 +4324,34 @@ error:
static int
test_unlim(unsigned config, hid_t fapl)
{
- char srcfilename[FILENAME_BUF_SIZE];
- char srcfilename_map[FILENAME_BUF_SIZE];
- char vfilename[FILENAME_BUF_SIZE];
- hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
- hid_t vfile = -1; /* File with virtual dset */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t srcdcpl = -1; /* DCPL for source dset */
- hid_t dapl = -1; /* Dataset access property list */
- hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
- hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
- hid_t memspace = -1; /* Memory dataspace */
- hid_t filespace = -1; /* File dataspace */
- hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
- hid_t vdset = -1; /* Virtual dataset */
- hsize_t dims[2] = {10, 10}; /* Data space current size */
- hsize_t mdims[2] = {10, 20}; /* Data space maximum size */
- hsize_t cdims[2] = {4, 4}; /* Chunk dimensions */
- hsize_t start[4]; /* Hyperslab start */
- hsize_t stride[4]; /* Hyperslab stride */
- hsize_t count[4]; /* Hyperslab count */
- hsize_t block[4]; /* Hyperslab block */
- int buf[10][20]; /* Write and expected read buffer */
- int rbuf[10][20]; /* Read buffer */
- int erbuf[10][20]; /* Expected read buffer */
- int ndims; /* Number of dimensions */
- int fill = -1; /* Fill value */
- H5D_vds_view_t virtual_view; /* Virtual view property */
- int i, j;
+ char srcfilename[FILENAME_BUF_SIZE];
+ char srcfilename_map[FILENAME_BUF_SIZE];
+ char vfilename[FILENAME_BUF_SIZE];
+ hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t srcdcpl = -1; /* DCPL for source dset */
+ hid_t dapl = -1; /* Dataset access property list */
+ hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
+ hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
+ hid_t memspace = -1; /* Memory dataspace */
+ hid_t filespace = -1; /* File dataspace */
+ hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[2] = {10, 10}; /* Data space current size */
+ hsize_t mdims[2] = {10, 20}; /* Data space maximum size */
+ hsize_t cdims[2] = {4, 4}; /* Chunk dimensions */
+ hsize_t start[4]; /* Hyperslab start */
+ hsize_t stride[4]; /* Hyperslab stride */
+ hsize_t count[4]; /* Hyperslab count */
+ hsize_t block[4]; /* Hyperslab block */
+ int buf[10][20]; /* Write and expected read buffer */
+ int rbuf[10][20]; /* Read buffer */
+ int erbuf[10][20]; /* Expected read buffer */
+ int ndims; /* Number of dimensions */
+ int fill = -1; /* Fill value */
+ H5D_vds_view_t virtual_view; /* Virtual view property */
+ int i, j;
TESTING("virtual dataset I/O with unlimited selections")
@@ -4349,45 +4360,44 @@ test_unlim(unsigned config, hid_t fapl)
h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map);
/* Create DCPLs */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if((srcdcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((srcdcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Set fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
TEST_ERROR
/* Set chunk dimensions */
- if(H5Pset_chunk(srcdcpl, 2, cdims) < 0)
+ if (H5Pset_chunk(srcdcpl, 2, cdims) < 0)
TEST_ERROR
/* Create DAPL */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
TEST_ERROR
/* Create memory space */
- if((memspace = H5Screate_simple(2, mdims, NULL)) < 0)
+ if ((memspace = H5Screate_simple(2, mdims, NULL)) < 0)
TEST_ERROR
-
/*
* Test 1: 2 Source datasets, single unlimited hyperslab virtual mappings
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspace */
- dims[0] = 5;
+ dims[0] = 5;
mdims[0] = 5;
- if((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
mdims[0] = 10;
@@ -4396,139 +4406,143 @@ test_unlim(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 5;
count[1] = H5S_UNLIMITED;
- if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[0] = 5;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2",
+ srcspace[0]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write data directly to source datasets */
/* Select hyperslab in memory */
start[0] = 0;
count[1] = 10;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write first dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 10; j++)
erbuf[i][j] = buf[i][j];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write second dataset */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 10; j++)
erbuf[i + 5][j] = buf[i][j];
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -4537,75 +4551,74 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Test H5Pget_virtual_view() */
- if(H5Pget_virtual_view(dapl, &virtual_view) < 0)
+ if (H5Pget_virtual_view(dapl, &virtual_view) < 0)
TEST_ERROR
- if(virtual_view != H5D_VDS_LAST_AVAILABLE)
+ if (virtual_view != H5D_VDS_LAST_AVAILABLE)
TEST_ERROR
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Test H5Pget_virtual_view() */
- if(H5Pget_virtual_view(dapl, &virtual_view) < 0)
+ if (H5Pget_virtual_view(dapl, &virtual_view) < 0)
TEST_ERROR
- if(virtual_view != H5D_VDS_FIRST_MISSING)
+ if (virtual_view != H5D_VDS_FIRST_MISSING)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -4613,106 +4626,105 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[0] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[0] */
dims[0] = 5;
dims[1] = 15;
- if(H5Dset_extent(srcdset[0], dims) < 0)
+ if (H5Dset_extent(srcdset[0], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to new area of srcdset */
count[1] = 5;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(srcdset[0])) < 0)
+ if ((filespace = H5Dget_space(srcdset[0])) < 0)
TEST_ERROR
start[1] = 10;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Close srcdset[0] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions. Note that since we are using
* H5D_VDS_FIRST_MISSING and we only extended one source dataset the
* dimensions will not have changed. */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -4721,69 +4733,68 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Update erbuf to reflect new data that is now visible due to the change to
* H5D_VDS_LAST_AVAILABLE */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j + 10] = buf[i][j];
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 15)
+ if (dims[1] != 15)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -4792,113 +4803,112 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[1] */
dims[0] = 5;
dims[1] = 20;
- if(H5Dset_extent(srcdset[1], dims) < 0)
+ if (H5Dset_extent(srcdset[1], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to new area of srcdset */
count[1] = 10;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(srcdset[1])) < 0)
+ if ((filespace = H5Dget_space(srcdset[1])) < 0)
TEST_ERROR
start[1] = 10;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 10; j++)
erbuf[i + 5][j + 10] = buf[i][j];
/* Close srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[1]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 20)
+ if (dims[1] != 20)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -4907,17 +4917,17 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Now just read middle 2 rows */
@@ -4925,35 +4935,34 @@ test_unlim(unsigned config, hid_t fapl)
start[0] = 4;
count[0] = 2;
count[1] = 20;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, memspace, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, memspace, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data - algorithmically check for only 2 middle rows being
* read so we don't have to wipe out erbuf and then restore it afterwards */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
- if((i == 4) || (i == 5)) {
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
+ if ((i == 4) || (i == 5)) {
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
}
- else
- if(rbuf[i][j] != 0)
- TEST_ERROR
+ else if (rbuf[i][j] != 0)
+ TEST_ERROR
/* Now test reopening virtual dataset without calling H5Dget_space, if
* REOPEN_VIRT flag set */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -4963,23 +4972,23 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Now try setting extent manually */
/* Shrink to 18 */
dims[1] = 18;
- if(H5Dset_extent(vdset, dims) < 0)
+ if (H5Dset_extent(vdset, dims) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -4989,28 +4998,27 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Shrink to 15 */
dims[1] = 15;
- if(H5Dset_extent(vdset, dims) < 0)
+ if (H5Dset_extent(vdset, dims) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5020,64 +5028,63 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
}
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 15)
+ if (dims[1] != 15)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5087,37 +5094,36 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Now test reopening virtual dataset without calling H5Dget_space, if
* REOPEN_VIRT flag set */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5126,29 +5132,28 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Now try setting extent manually */
/* Grow to 18 */
dims[1] = 18;
- if(H5Dset_extent(vdset, dims) < 0)
+ if (H5Dset_extent(vdset, dims) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5158,28 +5163,27 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Grow to 20 */
dims[1] = 20;
- if(H5Dset_extent(vdset, dims) < 0)
+ if (H5Dset_extent(vdset, dims) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5189,73 +5193,72 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
}
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- else if(!(config & TEST_IO_DIFFERENT_FILE)) {
- if(H5Fclose(srcfile[0]) < 0)
+ else if (!(config & TEST_IO_DIFFERENT_FILE)) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
-
/*
* Test 2: 2 Source datasets, interleaved slices, single element wide
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
dims[0] = 10;
dims[1] = 10;
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspace */
- dims[1] = 5;
+ dims[1] = 5;
mdims[1] = 10;
- if((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
mdims[1] = 20;
@@ -5264,146 +5267,150 @@ test_unlim(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 10;
count[1] = H5S_UNLIMITED;
- if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
stride[0] = 1;
stride[1] = 2;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 10;
- block[1] = 1;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 1;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 0;
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2",
+ srcspace[0]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write data directly to source datasets */
/* Select hyperslab in memory */
count[0] = 10;
count[1] = 5;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write first dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][2 * j] = buf[i][j];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write second dataset */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][(2 * j) + 1] = buf[i][j];
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5411,63 +5418,62 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5475,111 +5481,110 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[0] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[0] */
dims[1] = 7;
- if(H5Dset_extent(srcdset[0], dims) < 0)
+ if (H5Dset_extent(srcdset[0], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to new area of srcdset */
count[1] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(srcdset[0])) < 0)
+ if ((filespace = H5Dget_space(srcdset[0])) < 0)
TEST_ERROR
start[1] = 5;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[1] = 0;
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Update erbuf to reflect only new data that is now visible under
* H5D_VDS_FIRST_MISSING (first slice) */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][10] = buf[i][0];
/* Close srcdset[0] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions. Note that since we are using
* H5D_VDS_FIRST_MISSING and we only extended one source dataset the
* dimension will only have changed to add one more slice. */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 11)
+ if (dims[1] != 11)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5587,68 +5592,67 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Update erbuf to reflect new data that is now visible due to the change to
* H5D_VDS_LAST_AVAILABLE (second new slice) */
- for(i = 0; i < 10; i++)
- erbuf[i][12] = buf[i][1];
+ for (i = 0; i < 10; i++)
+ erbuf[i][12] = buf[i][1];
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 13)
+ if (dims[1] != 13)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5656,113 +5660,112 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[1] */
dims[1] = 10;
- if(H5Dset_extent(srcdset[1], dims) < 0)
+ if (H5Dset_extent(srcdset[1], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to new area of srcdset */
count[1] = 5;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(srcdset[1])) < 0)
+ if ((filespace = H5Dget_space(srcdset[1])) < 0)
TEST_ERROR
start[1] = 5;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[1] = 0;
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][(2 * j) + 11] = buf[i][j];
/* Close srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[1]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 20)
+ if (dims[1] != 20)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5770,17 +5773,17 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Now just read middle 2 rows */
@@ -5788,68 +5791,67 @@ test_unlim(unsigned config, hid_t fapl)
start[0] = 4;
count[0] = 2;
count[1] = 20;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[0] = 0;
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, memspace, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, memspace, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data - algorithmically check for only 2 middle rows being
* read so we don't have to wipe out erbuf and then restore it afterwards */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
- if((i == 4) || (i == 5)) {
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
+ if ((i == 4) || (i == 5)) {
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
}
- else
- if(rbuf[i][j] != 0)
- TEST_ERROR
+ else if (rbuf[i][j] != 0)
+ TEST_ERROR
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Update erbuf to reflect new data that is no longer visible due to the
* change to H5D_VDS_FIRST_MISSING */
- for(i = 0; i < 10; i++)
- for(j = 15; j < 20; j += 2)
+ for (i = 0; i < 10; i++)
+ for (j = 15; j < 20; j += 2)
erbuf[i][j] = fill;
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 14)
+ if (dims[1] != 14)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -5857,88 +5859,86 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- else if(!(config & TEST_IO_DIFFERENT_FILE)) {
- if(H5Fclose(srcfile[0]) < 0)
+ else if (!(config & TEST_IO_DIFFERENT_FILE)) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
-
/*
* Test 3: 3 Source datasets, interleaved slices, two elements wide
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
dims[0] = 10;
dims[1] = 10;
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- if((vspace[2] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[2] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspaces */
- dims[1] = 4;
+ dims[1] = 4;
mdims[1] = 8;
- if((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- dims[1] = 4;
+ dims[1] = 4;
mdims[1] = 6;
- if((srcspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((srcspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- dims[1] = 2;
+ dims[1] = 2;
mdims[1] = 6;
- if((srcspace[2] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((srcspace[2] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
mdims[1] = 20;
@@ -5947,185 +5947,191 @@ test_unlim(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 10;
count[1] = H5S_UNLIMITED;
- if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Sselect_hyperslab(srcspace[2], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[2], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
stride[0] = 1;
stride[1] = 6;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 10;
- block[1] = 2;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 2;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 2;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 4;
- if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 0;
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[1]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2",
+ srcspace[1]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", srcspace[2]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3",
+ srcspace[2]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write data directly to source datasets */
/* Select hyperslab in memory */
count[0] = 10;
count[1] = 4;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write first dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 2; j++) {
- erbuf[i][6 * j] = buf[i][2 * j];
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 2; j++) {
+ erbuf[i][6 * j] = buf[i][2 * j];
erbuf[i][(6 * j) + 1] = buf[i][(2 * j) + 1];
}
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write second dataset */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 2; j++) {
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 2; j++) {
erbuf[i][(6 * j) + 2] = buf[i][2 * j];
erbuf[i][(6 * j) + 3] = buf[i][(2 * j) + 1];
}
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Select hyperslab in memory */
count[0] = 10;
count[1] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write third dataset */
- if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++) {
+ for (i = 0; i < 10; i++) {
erbuf[i][4] = buf[i][0];
erbuf[i][5] = buf[i][1];
}
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(srcdset[2]) < 0)
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -6133,63 +6139,62 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -6197,105 +6202,104 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[0] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[0] */
dims[1] = 7;
- if(H5Dset_extent(srcdset[0], dims) < 0)
+ if (H5Dset_extent(srcdset[0], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to new area of srcdset */
count[1] = 3;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(srcdset[0])) < 0)
+ if ((filespace = H5Dget_space(srcdset[0])) < 0)
TEST_ERROR
start[1] = 4;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[1] = 0;
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Close srcdset[0] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions. Note that since we are using
* H5D_VDS_FIRST_MISSING the size will not have changed. */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -6303,71 +6307,70 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Update erbuf to reflect new data that is now visible due to the change to
* H5D_VDS_LAST_AVAILABLE */
- for(i = 0; i < 10; i++) {
+ for (i = 0; i < 10; i++) {
erbuf[i][12] = buf[i][0];
erbuf[i][13] = buf[i][1];
erbuf[i][18] = buf[i][2];
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 19)
+ if (dims[1] != 19)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -6375,116 +6378,115 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[2] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset3", H5P_DEFAULT)) < 0)
+ if ((srcdset[2] = H5Dopen2(srcfile[0], "src_dset3", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[2] */
dims[1] = 5;
- if(H5Dset_extent(srcdset[2], dims) < 0)
+ if (H5Dset_extent(srcdset[2], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to new area of srcdset */
count[1] = 3;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(srcdset[2])) < 0)
+ if ((filespace = H5Dget_space(srcdset[2])) < 0)
TEST_ERROR
start[1] = 2;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[1] = 0;
- if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++) {
+ for (i = 0; i < 10; i++) {
erbuf[i][10] = buf[i][0];
erbuf[i][11] = buf[i][1];
erbuf[i][16] = buf[i][2];
}
/* Close srcdset[2] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[2]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions. Note that the dimensions will not have
* changed. */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 19)
+ if (dims[1] != 19)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -6492,63 +6494,62 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 14)
+ if (dims[1] != 14)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -6556,114 +6557,113 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[1] */
dims[1] = 6;
- if(H5Dset_extent(srcdset[1], dims) < 0)
+ if (H5Dset_extent(srcdset[1], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to new area of srcdset */
count[1] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(srcdset[1])) < 0)
+ if ((filespace = H5Dget_space(srcdset[1])) < 0)
TEST_ERROR
start[1] = 4;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[1] = 0;
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++) {
+ for (i = 0; i < 10; i++) {
erbuf[i][14] = buf[i][0];
erbuf[i][15] = buf[i][1];
}
/* Close srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[1]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 17)
+ if (dims[1] != 17)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -6671,59 +6671,58 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 19)
+ if (dims[1] != 19)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Read data through virtual dataset */
@@ -6731,23 +6730,22 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Now just read middle 2 rows */
@@ -6755,98 +6753,96 @@ test_unlim(unsigned config, hid_t fapl)
start[0] = 4;
count[0] = 2;
count[1] = 19;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[0] = 0;
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Verify read data - algorithmically check for only 2 middle rows being
* read */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else if((i == 4) || (i == 5)) {
- if(rbuf[i][j] != erbuf[i][j])
+ else if ((i == 4) || (i == 5)) {
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
}
- else
- if(rbuf[i][j] != 0)
- TEST_ERROR
+ else if (rbuf[i][j] != 0)
+ TEST_ERROR
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(srcdset[2]) < 0)
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- else if(!(config & TEST_IO_DIFFERENT_FILE)) {
- if(H5Fclose(srcfile[0]) < 0)
+ else if (!(config & TEST_IO_DIFFERENT_FILE)) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(srcspace[1]) < 0)
+ if (H5Sclose(srcspace[1]) < 0)
TEST_ERROR
srcspace[1] = -1;
- if(H5Sclose(srcspace[2]) < 0)
+ if (H5Sclose(srcspace[2]) < 0)
TEST_ERROR
srcspace[2] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
-
/*
* Test 4: 2 Source datasets, offset starts
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspaces */
- dims[0] = 5;
- dims[1] = 0;
+ dims[0] = 5;
+ dims[1] = 0;
mdims[0] = 5;
- if((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
dims[1] = 5;
- if((srcspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((srcspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
mdims[0] = 10;
@@ -6855,59 +6851,63 @@ test_unlim(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 5;
count[1] = H5S_UNLIMITED;
- if(H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
start[1] = 10;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
start[0] = 5;
start[1] = 0;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1",
+ srcspace[0]) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[1]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2",
+ srcspace[1]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write data directly to second source dataset */
@@ -6916,70 +6916,70 @@ test_unlim(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 5;
count[1] = 5;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Write second dataset */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 5; j++)
erbuf[i + 5][j] = buf[i][j];
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 5)
+ if (dims[1] != 5)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -6989,63 +6989,62 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 5)
+ if (dims[1] != 5)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -7053,39 +7052,38 @@ test_unlim(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[0] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[0] */
dims[0] = 5;
dims[1] = 5;
- if(H5Dset_extent(srcdset[0], dims) < 0)
+ if (H5Dset_extent(srcdset[0], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[0] */
@@ -7093,65 +7091,65 @@ test_unlim(unsigned config, hid_t fapl)
start[1] = 0;
count[0] = 5;
count[1] = 5;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j + 10] = buf[i][j];
/* Close srcdset[0] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 5)
+ if (dims[1] != 5)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -7161,63 +7159,62 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 15)
+ if (dims[1] != 15)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -7227,73 +7224,71 @@ test_unlim(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- else if(!(config & TEST_IO_DIFFERENT_FILE)) {
- if(H5Fclose(srcfile[0]) < 0)
+ else if (!(config & TEST_IO_DIFFERENT_FILE)) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(srcspace[1]) < 0)
+ if (H5Sclose(srcspace[1]) < 0)
TEST_ERROR
srcspace[1] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
-
/* Close */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
dcpl = -1;
- if(H5Pclose(srcdcpl) < 0)
+ if (H5Pclose(srcdcpl) < 0)
TEST_ERROR
dcpl = -1;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
TEST_ERROR
dapl = -1;
- if(H5Sclose(memspace) < 0)
+ if (H5Sclose(memspace) < 0)
TEST_ERROR
memspace = -1;
@@ -7301,28 +7296,29 @@ test_unlim(unsigned config, hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
+ H5E_BEGIN_TRY
+ {
+ for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
H5Dclose(srcdset[i]);
H5Dclose(vdset);
- for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
H5Fclose(srcfile[i]);
H5Fclose(vfile);
- for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
H5Sclose(srcspace[i]);
- for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
H5Sclose(vspace[i]);
H5Sclose(filespace);
H5Sclose(memspace);
H5Pclose(dcpl);
H5Pclose(srcdcpl);
H5Pclose(dapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return 1;
+ return 1;
} /* end test_unlim() */
-
/*-------------------------------------------------------------------------
* Function: test_printf
*
@@ -7336,57 +7332,57 @@ error:
static int
test_printf(unsigned config, hid_t fapl)
{
- char *srcfilename = NULL;
- char *srcfilename_map = NULL;
- char *srcfilename2 = NULL;
- char *srcfilename2_map = NULL;
- char *vfilename = NULL;
- char *printf_srcfilename_map = NULL;
- char *srcfilenamepct = NULL;
- char *srcfilenamepct_map = NULL;
+ char * srcfilename = NULL;
+ char * srcfilename_map = NULL;
+ char * srcfilename2 = NULL;
+ char * srcfilename2_map = NULL;
+ char * vfilename = NULL;
+ char * printf_srcfilename_map = NULL;
+ char * srcfilenamepct = NULL;
+ char * srcfilenamepct_map = NULL;
const char *printf_srcfilename_map_orig = "vds_src_%b";
- const char *srcfilenamepct_map_orig = "vds%%%%_src";
- hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
- hid_t vfile = -1; /* File with virtual dset */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t dapl = -1; /* Dataset access property list */
- hid_t srcspace = -1; /* Source dataspace */
- hid_t vspace[2] = {-1, -1}; /* Virtual dset dataspaces */
- hid_t memspace = -1; /* Memory dataspace */
- hid_t filespace = -1; /* File dataspace */
- hid_t srcdset[6] = {-1, -1, -1, -1, -1, -1}; /* Source datsets */
- hid_t vdset = -1; /* Virtual dataset */
- hsize_t dims[2] = {10, 0}; /* Data space current size */
- hsize_t mdims[2] = {10, 20}; /* Data space maximum size */
- hsize_t start[2] = {0, 0}; /* Hyperslab start */
- hsize_t stride[2]; /* Hyperslab stride */
- hsize_t count[2]; /* Hyperslab count */
- hsize_t block[2]; /* Hyperslab block */
- int buf[10][20]; /* Write and expected read buffer */
- int rbuf[10][20]; /* Read buffer */
- int erbuf[10][20]; /* Expected read buffer */
- int ndims; /* Number of dimensions */
- int fill = -1; /* Fill value */
- hsize_t gap_size; /* Gap size property */
+ const char *srcfilenamepct_map_orig = "vds%%%%_src";
+ hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t dapl = -1; /* Dataset access property list */
+ hid_t srcspace = -1; /* Source dataspace */
+ hid_t vspace[2] = {-1, -1}; /* Virtual dset dataspaces */
+ hid_t memspace = -1; /* Memory dataspace */
+ hid_t filespace = -1; /* File dataspace */
+ hid_t srcdset[6] = {-1, -1, -1, -1, -1, -1}; /* Source datsets */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[2] = {10, 0}; /* Data space current size */
+ hsize_t mdims[2] = {10, 20}; /* Data space maximum size */
+ hsize_t start[2] = {0, 0}; /* Hyperslab start */
+ hsize_t stride[2]; /* Hyperslab stride */
+ hsize_t count[2]; /* Hyperslab count */
+ hsize_t block[2]; /* Hyperslab block */
+ int buf[10][20]; /* Write and expected read buffer */
+ int rbuf[10][20]; /* Read buffer */
+ int erbuf[10][20]; /* Expected read buffer */
+ int ndims; /* Number of dimensions */
+ int fill = -1; /* Fill value */
+ hsize_t gap_size; /* Gap size property */
int i, j;
TESTING("virtual dataset I/O with printf source")
- if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilename2_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilename2_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((printf_srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((printf_srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
- if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ if ((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
TEST_ERROR;
h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE);
@@ -7399,216 +7395,218 @@ test_printf(unsigned config, hid_t fapl)
h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE);
/* Create DCPL */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Set fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
TEST_ERROR
/* Create DAPL */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
TEST_ERROR
/* Create memory space */
- if((memspace = H5Screate_simple(2, mdims, NULL)) < 0)
+ if ((memspace = H5Screate_simple(2, mdims, NULL)) < 0)
TEST_ERROR
-
/*
* Test 1: 1 Source dataset mapping, 10x5 blocks
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[1] = 5;
- if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select hyperslabs in virtual space */
stride[0] = 1;
stride[1] = 5;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 10;
- block[1] = 5;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 5;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset%b", srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset%b",
+ srcspace) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Close srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 0)
+ if (dims[1] != 0)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Reopen srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 2 source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write to srcdset[0] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j] = buf[i][j];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[1] */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j + 5] = buf[i][j];
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -7616,95 +7614,95 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile if config option specified */
- if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 3rd source dataset */
- if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[2] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j + 10] = buf[i][j];
/* Close srcdset[2] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[2]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 15)
+ if (dims[1] != 15)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Read data through virtual dataset */
@@ -7712,407 +7710,411 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Now try with different selections */
count[0] = 10;
- for(start[1] = (hsize_t)0; start[1] < (hsize_t)5; start[1]++)
- for(count[1] = (hsize_t)1; count[1] < (hsize_t)11; count[1]++) {
+ for (start[1] = (hsize_t)0; start[1] < (hsize_t)5; start[1]++)
+ for (count[1] = (hsize_t)1; count[1] < (hsize_t)11; count[1]++) {
/* Reset rbuf */
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslab in file space */
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if((j < (int)start[1]) || (j >= (int)(start[1] + count[1]))) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if ((j < (int)start[1]) || (j >= (int)(start[1] + count[1]))) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
}
start[1] = 0;
/* Now try writing through VDS */
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Select hyperslab in file space */
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write data through VDS */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Reopen srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset0", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset0", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
+ if ((srcdset[2] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read srcdset[0] */
count[0] = 10;
count[1] = 5;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Read srcdset[1] */
- if(H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
- if(rbuf[i][j] != buf[i][j + 5])
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
+ if (rbuf[i][j] != buf[i][j + 5])
TEST_ERROR
/* Read srcdset[2] */
- if(H5Dread(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
- if(rbuf[i][j] != buf[i][j + 10])
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
+ if (rbuf[i][j] != buf[i][j + 10])
TEST_ERROR
/* Close */
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Dclose(srcdset[2]) < 0)
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace) < 0)
+ if (H5Sclose(srcspace) < 0)
TEST_ERROR
srcspace = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
-
/*
* Test 2: 1 Source dataset mapping, 10x1 blocks, test printf gap setting,
* '%' in source file name
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[1] = 1;
- if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select hyperslabs in virtual space */
stride[0] = 1;
stride[1] = 1;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 10;
- block[1] = 1;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", "src_dset%b", srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".",
+ "src_dset%b", srcspace) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Close srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 0)
+ if (dims[1] != 0)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Reopen srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create source datasets in a pattern with increasing gaps:
* XX-X--X---X----X */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset6", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset6", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[4] = H5Dcreate2(srcfile[0], "src_dset10", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[4] = H5Dcreate2(srcfile[0], "src_dset10", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[5] = H5Dcreate2(srcfile[0], "src_dset15", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[5] = H5Dcreate2(srcfile[0], "src_dset15", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write to srcdset[0] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][0] = buf[i][0];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[1] */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][1] = buf[i][0];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[2] */
- if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][3] = buf[i][0];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[3] */
- if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][6] = buf[i][0];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[4] */
- if(H5Dwrite(srcdset[4], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[4], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][10] = buf[i][0];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[5] */
- if(H5Dwrite(srcdset[5], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[5], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][15] = buf[i][0];
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- for(i = 0; i < 6; i++) {
- if(H5Dclose(srcdset[i]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ for (i = 0; i < 6; i++) {
+ if (H5Dclose(srcdset[i]) < 0)
TEST_ERROR
srcdset[i] = -1;
}
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 2)
+ if (dims[1] != 2)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -8120,75 +8122,74 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Test H5Pget_virtual_printf_gap() */
- if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
+ if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
TEST_ERROR
- if(gap_size != (hsize_t)0)
+ if (gap_size != (hsize_t)0)
TEST_ERROR
/* Close VDS and reopen with printf gap set to 1, reopen file as well if
* config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_printf_gap(dapl, (hsize_t)1) < 0)
+ if (H5Pset_virtual_printf_gap(dapl, (hsize_t)1) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Test H5Pget_virtual_printf_gap() */
- if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
+ if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
TEST_ERROR
- if(gap_size != (hsize_t)1)
+ if (gap_size != (hsize_t)1)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 4)
+ if (dims[1] != 4)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -8196,69 +8197,68 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with printf gap set to 2, reopen file as well if
* config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_printf_gap(dapl, (hsize_t)2) < 0)
+ if (H5Pset_virtual_printf_gap(dapl, (hsize_t)2) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Test H5Pget_virtual_printf_gap() */
- if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
+ if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
TEST_ERROR
- if(gap_size != (hsize_t)2)
+ if (gap_size != (hsize_t)2)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 7)
+ if (dims[1] != 7)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -8266,69 +8266,68 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with printf gap set to 3, reopen file as well if
* config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_printf_gap(dapl, (hsize_t)3) < 0)
+ if (H5Pset_virtual_printf_gap(dapl, (hsize_t)3) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Test H5Pget_virtual_printf_gap() */
- if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
+ if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
TEST_ERROR
- if(gap_size != (hsize_t)3)
+ if (gap_size != (hsize_t)3)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 11)
+ if (dims[1] != 11)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -8336,69 +8335,68 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with printf gap set to 4, reopen file as well if
* config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_printf_gap(dapl, (hsize_t)4) < 0)
+ if (H5Pset_virtual_printf_gap(dapl, (hsize_t)4) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Test H5Pget_virtual_printf_gap() */
- if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
+ if (H5Pget_virtual_printf_gap(dapl, &gap_size) < 0)
TEST_ERROR
- if(gap_size != (hsize_t)4)
+ if (gap_size != (hsize_t)4)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 16)
+ if (dims[1] != 16)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -8406,63 +8404,62 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 2)
+ if (dims[1] != 2)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -8470,223 +8467,222 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reset dapl */
- if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0)
+ if (H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- for(i = 0; i < 6; i++) {
- if(H5Dclose(srcdset[i]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ for (i = 0; i < 6; i++) {
+ if (H5Dclose(srcdset[i]) < 0)
TEST_ERROR
srcdset[i] = -1;
}
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- else if(!(config & TEST_IO_DIFFERENT_FILE)) {
- if(H5Fclose(srcfile[0]) < 0)
+ else if (!(config & TEST_IO_DIFFERENT_FILE)) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace) < 0)
+ if (H5Sclose(srcspace) < 0)
TEST_ERROR
srcspace = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
-
/* Next 2 tests are always run with a different source file, so only run if
* that config option is set (so they're not run twice with the same
* configuration) */
- if(config & TEST_IO_DIFFERENT_FILE) {
+ if (config & TEST_IO_DIFFERENT_FILE) {
/*
* Test 3: 1 Source dataset mapping, 10x5 blocks, printf source file
*/
/* Clean up files so the source files do not exist yet */
- H5Iinc_ref(fapl); /* Prevent FAPL from being closed */
+ H5Iinc_ref(fapl); /* Prevent FAPL from being closed */
h5_clean_files(FILENAME, fapl);
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[1] = 5;
- if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select hyperslabs in virtual space */
stride[0] = 1;
stride[1] = 5;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 10;
- block[1] = 5;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 5;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], printf_srcfilename_map, "src_dset", srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], printf_srcfilename_map, "src_dset", srcspace) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 0)
+ if (dims[1] != 0)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Create 2 source files, one source dataset */
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write to srcdset[0] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j] = buf[i][j];
/* Close srcdset and srcfiles if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(srcfile[1]) < 0)
+ if (H5Fclose(srcfile[1]) < 0)
TEST_ERROR
srcfile[1] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 5)
+ if (dims[1] != 5)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -8694,96 +8690,96 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile[1] if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if ((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 2nd source dataset */
- if((srcdset[1] = H5Dcreate2(srcfile[1], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[1], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[1] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j + 5] = buf[i][j];
/* Close srcdset[1] and srcfile[1] if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[1]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[1]) < 0)
+ if (H5Fclose(srcfile[1]) < 0)
TEST_ERROR
srcfile[1] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -8791,213 +8787,212 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(srcfile[1]) < 0)
+ if (H5Fclose(srcfile[1]) < 0)
TEST_ERROR
srcfile[1] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace) < 0)
+ if (H5Sclose(srcspace) < 0)
TEST_ERROR
srcspace = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
-
/*
* Test 4: 1 Source dataset mapping, 10x5 blocks, printf source file and
* source dset, extra %%s in source dataset name
*/
/* Clean up files so the source files do not exist yet */
- H5Iinc_ref(fapl); /* Prevent FAPL from being closed */
+ H5Iinc_ref(fapl); /* Prevent FAPL from being closed */
h5_clean_files(FILENAME, fapl);
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[1] = 5;
- if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select hyperslabs in virtual space */
stride[0] = 1;
stride[1] = 5;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 10;
- block[1] = 5;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 5;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], printf_srcfilename_map, "%%src%%_dset%%%b", srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], printf_srcfilename_map, "%%src%%_dset%%%b", srcspace) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 0)
+ if (dims[1] != 0)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Create 2 source files, one source dataset */
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if((srcdset[0] = H5Dcreate2(srcfile[0], "%src%_dset%0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "%src%_dset%0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write to srcdset[0] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j] = buf[i][j];
/* Close srcdset and srcfiles if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(srcfile[1]) < 0)
+ if (H5Fclose(srcfile[1]) < 0)
TEST_ERROR
srcfile[1] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 5)
+ if (dims[1] != 5)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -9005,96 +9000,96 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile[1] if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if ((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 2nd source dataset */
- if((srcdset[1] = H5Dcreate2(srcfile[1], "%src%_dset%1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[1], "%src%_dset%1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[1] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j + 5] = buf[i][j];
/* Close srcdset[1] and srcfile[1] if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[1]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[1]) < 0)
+ if (H5Fclose(srcfile[1]) < 0)
TEST_ERROR
srcfile[1] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -9102,266 +9097,268 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(srcfile[1]) < 0)
+ if (H5Fclose(srcfile[1]) < 0)
TEST_ERROR
srcfile[1] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace) < 0)
+ if (H5Sclose(srcspace) < 0)
TEST_ERROR
srcspace = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
}
-
/*
* Test 5: 2 Source mappings, interleaved slices, single element wide,
* hyperslab selection in source, extra %%s in source dataset names
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
dims[0] = 10;
dims[1] = 10;
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspace (2 elements wide) */
dims[1] = 2;
- if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select hyperslab in source space */
count[0] = 10;
count[1] = 1;
- if(H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
stride[0] = 1;
stride[1] = 2;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 10;
- block[1] = 1;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 1;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[1] = 0;
/* Add virtual layout mappings */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "%bsrc_dset_a%b%%", srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "%bsrc_dset_a%b%%", srcspace) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_b%b%%%%", srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "src_dset_b%b%%%%", srcspace) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Close srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 0)
+ if (dims[1] != 0)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Reopen srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 2 source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "0src_dset_a0%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "0src_dset_a0%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset_b0%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset_b0%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write to srcdset[0] */
block[0] = 10;
block[1] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][0] = buf[i][0];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[1] */
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][1] = buf[i][0];
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 2)
+ if (dims[1] != 2)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -9369,98 +9366,98 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile if config option specified */
- if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 3rd source dataset */
- if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset_b1%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset_b1%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[2] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][3] = buf[i][0];
/* Close srcdset[2] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[2]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 4)
+ if (dims[1] != 4)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -9468,64 +9465,63 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions. Make sure that the 4th slice is no longer
* visible due to the change to H5D_VDS_FIRST_MISSING. */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 2)
+ if (dims[1] != 2)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -9533,98 +9529,98 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile if config option specified */
- if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 4th source dataset */
- if((srcdset[3] = H5Dcreate2(srcfile[0], "2src_dset_a2%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[3] = H5Dcreate2(srcfile[0], "2src_dset_a2%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[3] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][4] = buf[i][0];
/* Close srcdset[3] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[3]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[3]) < 0)
TEST_ERROR
srcdset[3] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 2)
+ if (dims[1] != 2)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -9632,64 +9628,63 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions. Make sure that the 4th slice is now visible
* due to the change to H5D_VDS_LAST_AVAILABLE. */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 4)
+ if (dims[1] != 4)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -9697,64 +9692,63 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with printf_gap set to 1, reopen file as well if
* config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_printf_gap(dapl, (hsize_t)1) < 0)
+ if (H5Pset_virtual_printf_gap(dapl, (hsize_t)1) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions. Make sure that the 6th slice is now visible
* due to the change to printf_gap. */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 5)
+ if (dims[1] != 5)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -9762,288 +9756,290 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reset dapl */
- if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0)
+ if (H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- for(i = 0; i < 4; i++) {
- if(H5Dclose(srcdset[i]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ for (i = 0; i < 4; i++) {
+ if (H5Dclose(srcdset[i]) < 0)
TEST_ERROR
srcdset[i] = -1;
}
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- else if(!(config & TEST_IO_DIFFERENT_FILE)) {
- if(H5Fclose(srcfile[0]) < 0)
+ else if (!(config & TEST_IO_DIFFERENT_FILE)) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace) < 0)
+ if (H5Sclose(srcspace) < 0)
TEST_ERROR
srcspace = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
-
/*
* Test 6: 2 Source mappings, side-by-side, 5x5 and 5x10 blocks
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
dims[0] = 10;
dims[1] = 10;
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspace (1 dimensional) */
dims[0] = 50;
- if((srcspace = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((srcspace = H5Screate_simple(1, dims, NULL)) < 0)
TEST_ERROR
/* Select hyperslab in source space */
count[0] = 25;
- if(H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
/* Select hyperslabs in virtual spaces */
stride[0] = 1;
stride[1] = 5;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 5;
- block[1] = 5;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 5;
+ block[1] = 5;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
- start[0] = 5;
+ start[0] = 5;
stride[1] = 10;
- block[1] = 10;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ block[1] = 10;
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
start[0] = 0;
/* Add virtual layout mappings (select ALL in source space for second
* mapping) */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_a%b", srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "src_dset_a%b", srcspace) < 0)
TEST_ERROR
- if(H5Sselect_all(srcspace) < 0)
+ if (H5Sselect_all(srcspace) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_b%b", srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "src_dset_b%b", srcspace) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Close srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 0)
+ if (dims[1] != 0)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Reopen srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 2 source datasets */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset_a0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset_a0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset_b0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset_b0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write to srcdset[0] */
block[0] = 5;
block[1] = 5;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
count[0] = 25;
- if(H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j] = buf[i][j];
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[1] */
block[1] = 10;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Sselect_all(srcspace) < 0)
+ if (H5Sselect_all(srcspace) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 10; j++)
erbuf[i + 5][j] = buf[i][j];
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Dclose(srcdset[1]) < 0)
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10051,64 +10047,63 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions. Make sure that the 4th slice is no longer
* visible due to the change to H5D_VDS_FIRST_MISSING. */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 5)
+ if (dims[1] != 5)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10116,102 +10111,102 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile if config option specified */
- if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 3rd source dataset */
- if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset_a1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset_a1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[2] */
block[1] = 5;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j + 5] = buf[i][j];
/* Close srcdset[2] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[2]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10219,63 +10214,62 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions. There should be no change. */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10283,99 +10277,99 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile if config option specified */
- if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 4th source dataset */
- if((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset_a2", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset_a2", H5T_NATIVE_INT, srcspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[3] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, srcspace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 5; j++)
erbuf[i][j + 10] = buf[i][j];
/* Close srcdset[3] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[3]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[3]) < 0)
TEST_ERROR
srcdset[3] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 15)
+ if (dims[1] != 15)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10383,37 +10377,36 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Now test reopening virtual dataset without calling H5Dget_space, if
* REOPEN_VIRT flag set */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10421,29 +10414,28 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Now try setting extent manually */
/* Shrink to 12 */
dims[1] = 12;
- if(H5Dset_extent(vdset, dims) < 0)
+ if (H5Dset_extent(vdset, dims) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10451,28 +10443,27 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Shrink to 10 */
dims[1] = 12;
- if(H5Dset_extent(vdset, dims) < 0)
+ if (H5Dset_extent(vdset, dims) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10480,64 +10471,63 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
}
/* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
* as well if config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10545,37 +10535,36 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Now test reopening virtual dataset without calling H5Dget_space, if
* REOPEN_VIRT flag set */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10583,29 +10572,28 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Now try setting extent manually */
/* Grow to 12 */
dims[1] = 12;
- if(H5Dset_extent(vdset, dims) < 0)
+ if (H5Dset_extent(vdset, dims) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10613,28 +10601,27 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Grow to 15 */
dims[1] = 15;
- if(H5Dset_extent(vdset, dims) < 0)
+ if (H5Dset_extent(vdset, dims) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10642,238 +10629,238 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
}
/* Reset dapl */
- if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- for(i = 0; i < 4; i++) {
- if(H5Dclose(srcdset[i]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ for (i = 0; i < 4; i++) {
+ if (H5Dclose(srcdset[i]) < 0)
TEST_ERROR
srcdset[i] = -1;
}
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- else if(!(config & TEST_IO_DIFFERENT_FILE)) {
- if(H5Fclose(srcfile[0]) < 0)
+ else if (!(config & TEST_IO_DIFFERENT_FILE)) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace) < 0)
+ if (H5Sclose(srcspace) < 0)
TEST_ERROR
srcspace = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Sclose(vspace[1]) < 0)
+ if (H5Sclose(vspace[1]) < 0)
TEST_ERROR
vspace[1] = -1;
-
/*
* Test 7: 1 Source dataset mapping, 10x1 blocks, test reallocating sub_dset
* array
*/
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create virtual dataspaces */
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
/* Create source dataspace */
dims[1] = 1;
- if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select hyperslabs in virtual space */
stride[0] = 1;
stride[1] = 1;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 10;
- block[1] = 1;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".", "src_dset%b", srcspace) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilenamepct_map : ".",
+ "src_dset%b", srcspace) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Close srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 0)
+ if (dims[1] != 0)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Reopen srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile[0] = H5Fopen(srcfilenamepct, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create 1 source dataset */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write to srcdset[0] */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
erbuf[i][0] = buf[i][0];
/* Close srcdset[0] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 1)
+ if (dims[1] != 1)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10881,63 +10868,62 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Close VDS and reopen with printf gap set to 127, reopen file as well if
* config option specified */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
- if(H5Pset_virtual_printf_gap(dapl, (hsize_t)127) < 0)
+ if (H5Pset_virtual_printf_gap(dapl, (hsize_t)127) < 0)
TEST_ERROR
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Fclose(vfile) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
}
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 1)
+ if (dims[1] != 1)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 20)
+ if (mdims[1] != 20)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -10945,65 +10931,63 @@ test_printf(unsigned config, hid_t fapl)
HDmemset(rbuf[0], 0, sizeof(rbuf));
/* Select hyperslab in memory space */
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reset dapl */
- if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0)
+ if (H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0)
TEST_ERROR
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- else if(!(config & TEST_IO_DIFFERENT_FILE)) {
- if(H5Fclose(srcfile[0]) < 0)
+ else if (!(config & TEST_IO_DIFFERENT_FILE)) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace) < 0)
+ if (H5Sclose(srcspace) < 0)
TEST_ERROR
srcspace = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
-
/* Close */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
dcpl = -1;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
TEST_ERROR
dapl = -1;
- if(H5Sclose(memspace) < 0)
+ if (H5Sclose(memspace) < 0)
TEST_ERROR
memspace = -1;
@@ -11020,21 +11004,23 @@ test_printf(unsigned config, hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
+ H5E_BEGIN_TRY
+ {
+ for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
H5Dclose(srcdset[i]);
H5Dclose(vdset);
- for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
H5Fclose(srcfile[i]);
H5Fclose(vfile);
H5Sclose(srcspace);
- for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
H5Sclose(vspace[i]);
H5Sclose(filespace);
H5Sclose(memspace);
H5Pclose(dcpl);
H5Pclose(dapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(srcfilename);
HDfree(srcfilename_map);
@@ -11045,10 +11031,9 @@ error:
HDfree(srcfilenamepct);
HDfree(srcfilenamepct_map);
- return 1;
+ return 1;
} /* end test_printf() */
-
/*-------------------------------------------------------------------------
* Function: test_all
*
@@ -11062,32 +11047,32 @@ error:
static int
test_all(unsigned config, hid_t fapl)
{
- char vfilename[FILENAME_BUF_SIZE];
- char srcfilename[FILENAME_BUF_SIZE];
- char srcfilename_map[FILENAME_BUF_SIZE];
- hid_t srcfile = -1; /* File with source dsets */
- hid_t vfile = -1; /* File with virtual dset */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t srcdcpl = -1; /* DCPL for source dset */
- hid_t srcspace[3] = {-1, -1, -1}; /* Source dataspaces */
- hid_t vspace[3] = {-1, -1, -1}; /* Virtual dset dataspaces */
- hid_t memspace = -1; /* Memory dataspace */
- hid_t filespace = -1; /* File dataspace */
- hid_t srcdset[5] = {-1, -1, -1, -1, -1}; /* Source datsets */
- hid_t vdset = -1; /* Virtual dataset */
- hsize_t dims[2] = {6, 6}; /* Data space current size */
- hsize_t mdims[2] = {10, 10}; /* Data space maximum size */
- hsize_t cdims[2] = {2, 2}; /* Chunk dimensions */
- hsize_t start[2]; /* Hyperslab start */
- hsize_t stride[2]; /* Hyperslab stride */
- hsize_t count[2]; /* Hyperslab count */
- hsize_t block[2]; /* Hyperslab block */
- int buf[10][10]; /* Write and expected read buffer */
- int rbuf[10][10]; /* Read buffer */
- int erbuf[10][10]; /* Expected read buffer */
- int ndims; /* Number of dimensions */
- int fill = -1; /* Fill value */
- int i, j;
+ char vfilename[FILENAME_BUF_SIZE];
+ char srcfilename[FILENAME_BUF_SIZE];
+ char srcfilename_map[FILENAME_BUF_SIZE];
+ hid_t srcfile = -1; /* File with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t srcdcpl = -1; /* DCPL for source dset */
+ hid_t srcspace[3] = {-1, -1, -1}; /* Source dataspaces */
+ hid_t vspace[3] = {-1, -1, -1}; /* Virtual dset dataspaces */
+ hid_t memspace = -1; /* Memory dataspace */
+ hid_t filespace = -1; /* File dataspace */
+ hid_t srcdset[5] = {-1, -1, -1, -1, -1}; /* Source datsets */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[2] = {6, 6}; /* Data space current size */
+ hsize_t mdims[2] = {10, 10}; /* Data space maximum size */
+ hsize_t cdims[2] = {2, 2}; /* Chunk dimensions */
+ hsize_t start[2]; /* Hyperslab start */
+ hsize_t stride[2]; /* Hyperslab stride */
+ hsize_t count[2]; /* Hyperslab count */
+ hsize_t block[2]; /* Hyperslab block */
+ int buf[10][10]; /* Write and expected read buffer */
+ int rbuf[10][10]; /* Read buffer */
+ int erbuf[10][10]; /* Expected read buffer */
+ int ndims; /* Number of dimensions */
+ int fill = -1; /* Fill value */
+ int i, j;
TESTING("virtual dataset I/O with mixed selection types")
@@ -11096,43 +11081,44 @@ test_all(unsigned config, hid_t fapl)
h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map);
/* Create DCPLs */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if((srcdcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((srcdcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Set fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
TEST_ERROR
/* Set chunk dimensions */
- if(H5Pset_chunk(srcdcpl, 2, cdims) < 0)
+ if (H5Pset_chunk(srcdcpl, 2, cdims) < 0)
TEST_ERROR
/* Create memory space */
- if((memspace = H5Screate_simple(2, mdims, NULL)) < 0)
+ if ((memspace = H5Screate_simple(2, mdims, NULL)) < 0)
TEST_ERROR
/* Clear virtual layout in DCPL */
- if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ if (H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
TEST_ERROR
/* Create fixed mapping */
- if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
start[0] = 3;
start[1] = 3;
count[0] = 3;
count[1] = 3;
- if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
TEST_ERROR
- if((srcspace[0] = H5Screate_simple(2, count, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, count, NULL)) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_fixed", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "src_dset_fixed", srcspace[0]) < 0)
TEST_ERROR
/* Create unlimited mapping */
- if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
start[0] = 3;
start[1] = 0;
@@ -11140,123 +11126,127 @@ test_all(unsigned config, hid_t fapl)
count[1] = 1;
block[0] = H5S_UNLIMITED;
block[1] = 3;
- if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, block) < 0)
+ if (H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, count, block) < 0)
TEST_ERROR
dims[0] = 0;
dims[1] = 3;
- if((srcspace[1] = H5Screate_simple(2, dims, block)) < 0)
+ if ((srcspace[1] = H5Screate_simple(2, dims, block)) < 0)
TEST_ERROR
start[0] = 0;
- if(H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(srcspace[1], H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_unlim", srcspace[1]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "src_dset_unlim", srcspace[1]) < 0)
TEST_ERROR
/* Create printf mapping */
- if((vspace[2] = H5Screate_simple(2, dims, mdims)) < 0)
+ if ((vspace[2] = H5Screate_simple(2, dims, mdims)) < 0)
TEST_ERROR
- start[0] = 0;
- start[1] = 2;
+ start[0] = 0;
+ start[1] = 2;
stride[0] = 1;
stride[1] = 3;
- count[0] = 1;
- count[1] = H5S_UNLIMITED;
- block[0] = 3;
- block[1] = 2;
- if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, stride, count, block) < 0)
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 3;
+ block[1] = 2;
+ if (H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, stride, count, block) < 0)
TEST_ERROR
- if((srcspace[2] = H5Screate_simple(2, block, NULL)) < 0)
+ if ((srcspace[2] = H5Screate_simple(2, block, NULL)) < 0)
TEST_ERROR
- if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset_printf_%b", srcspace[2]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".",
+ "src_dset_printf_%b", srcspace[2]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if ((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
}
else {
srcfile = vfile;
- if(H5Iinc_ref(srcfile) < 0)
+ if (H5Iinc_ref(srcfile) < 0)
TEST_ERROR
}
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 6)
+ if (dims[0] != 6)
TEST_ERROR
- if(dims[1] != 6)
+ if (dims[1] != 6)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 10)
+ if (mdims[1] != 10)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Reopen srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC)
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC)
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create fixed source dataset */
- if((srcdset[0] = H5Dcreate2(srcfile, "src_dset_fixed", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile, "src_dset_fixed", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create unlimited source_dataset */
- if((srcdset[1] = H5Dcreate2(srcfile, "src_dset_unlim", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dcreate2(srcfile, "src_dset_unlim", H5T_NATIVE_INT, srcspace[1], H5P_DEFAULT, srcdcpl,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] = (i * (int)mdims[1]) + j;
/* Initialize erbuf */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
erbuf[i][j] = fill;
/* Write to srcdset[0] */
@@ -11264,67 +11254,67 @@ test_all(unsigned config, hid_t fapl)
start[1] = 0;
block[0] = 3;
block[1] = 3;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 3; i++)
- for(j = 0; j < 3; j++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 3; j++)
erbuf[i + 3][j + 3] = buf[i][j];
/* Close srcdsets and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- for(i = 0; i < 2; i++) {
- if(H5Dclose(srcdset[i]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ for (i = 0; i < 2; i++) {
+ if (H5Dclose(srcdset[i]) < 0)
TEST_ERROR
srcdset[i] = -1;
}
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 6)
+ if (dims[0] != 6)
TEST_ERROR
- if(dims[1] != 6)
+ if (dims[1] != 6)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 10)
+ if (mdims[1] != 10)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -11334,106 +11324,105 @@ test_all(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if((i >= (int)dims[0]) || (j >= (int)dims[1])) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if ((i >= (int)dims[0]) || (j >= (int)dims[1])) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[1] */
dims[0] = 2;
dims[1] = 3;
- if(H5Dset_extent(srcdset[1], dims) < 0)
+ if (H5Dset_extent(srcdset[1], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[1] */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 2; i++)
- for(j = 0; j < 3; j++)
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++)
erbuf[i + 3][j] = buf[i][j];
/* Close srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[1]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 6)
+ if (dims[0] != 6)
TEST_ERROR
- if(dims[1] != 6)
+ if (dims[1] != 6)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 10)
+ if (mdims[1] != 10)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -11443,37 +11432,37 @@ test_all(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if((i >= (int)dims[0]) || (j >= (int)dims[1])) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if ((i >= (int)dims[0]) || (j >= (int)dims[1])) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile if config option specified */
- if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
- if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create first printf source dataset */
- if((srcdset[2] = H5Dcreate2(srcfile, "src_dset_printf_0", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[2] = H5Dcreate2(srcfile, "src_dset_printf_0", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT,
+ srcdcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[2] */
@@ -11481,64 +11470,64 @@ test_all(unsigned config, hid_t fapl)
start[1] = 0;
block[0] = 3;
block[1] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 3; i++)
- for(j = 0; j < 2; j++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 2; j++)
erbuf[i][j + 2] = buf[i][j];
/* Close srcdset[2] srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[2]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[2]) < 0)
TEST_ERROR
srcdset[2] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 6)
+ if (dims[0] != 6)
TEST_ERROR
- if(dims[1] != 6)
+ if (dims[1] != 6)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 10)
+ if (mdims[1] != 10)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -11548,43 +11537,42 @@ test_all(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if((i >= (int)dims[0]) || (j >= (int)dims[1])) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if ((i >= (int)dims[0]) || (j >= (int)dims[1])) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[1] */
dims[0] = 3;
dims[1] = 3;
- if(H5Dset_extent(srcdset[1], dims) < 0)
+ if (H5Dset_extent(srcdset[1], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to new area of srcdset[1] */
@@ -11592,71 +11580,71 @@ test_all(unsigned config, hid_t fapl)
start[1] = 0;
block[0] = 1;
block[1] = 3;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(srcdset[1])) < 0)
+ if ((filespace = H5Dget_space(srcdset[1])) < 0)
TEST_ERROR
start[0] = 2;
start[1] = 0;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
erbuf[5][i] = buf[0][i];
/* Close srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[1]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 6)
+ if (dims[0] != 6)
TEST_ERROR
- if(dims[1] != 6)
+ if (dims[1] != 6)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 10)
+ if (mdims[1] != 10)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -11666,37 +11654,37 @@ test_all(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if((i >= (int)dims[0]) || (j >= (int)dims[1])) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if ((i >= (int)dims[0]) || (j >= (int)dims[1])) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile if config option specified */
- if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
- if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create second printf source dataset, this time without using srcdcpl */
- if((srcdset[3] = H5Dcreate2(srcfile, "src_dset_printf_1", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[3] = H5Dcreate2(srcfile, "src_dset_printf_1", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[3] */
@@ -11704,64 +11692,64 @@ test_all(unsigned config, hid_t fapl)
start[1] = 0;
block[0] = 3;
block[1] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 3; i++)
- for(j = 0; j < 2; j++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 2; j++)
erbuf[i][j + 5] = buf[i][j];
/* Close srcdset[3] srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[3]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[3]) < 0)
TEST_ERROR
srcdset[3] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 6)
+ if (dims[0] != 6)
TEST_ERROR
- if(dims[1] != 7)
+ if (dims[1] != 7)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 10)
+ if (mdims[1] != 10)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -11771,43 +11759,42 @@ test_all(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if((i >= (int)dims[0]) || (j >= (int)dims[1])) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if ((i >= (int)dims[0]) || (j >= (int)dims[1])) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE)
- if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE)
+ if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0)
+ if ((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Extend srcdset[1] */
dims[0] = 7;
dims[1] = 3;
- if(H5Dset_extent(srcdset[1], dims) < 0)
+ if (H5Dset_extent(srcdset[1], dims) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to new area of srcdset[1] */
@@ -11815,72 +11802,72 @@ test_all(unsigned config, hid_t fapl)
start[1] = 0;
block[0] = 4;
block[1] = 3;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if((filespace = H5Dget_space(srcdset[1])) < 0)
+ if ((filespace = H5Dget_space(srcdset[1])) < 0)
TEST_ERROR
start[0] = 3;
start[1] = 0;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 4; i++)
- for(j = 0; j < 3; j++)
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 3; j++)
erbuf[i + 6][j] = buf[i][j];
/* Close srcdset[1] and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[1]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[1]) < 0)
TEST_ERROR
srcdset[1] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 7)
+ if (dims[1] != 7)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 10)
+ if (mdims[1] != 10)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -11890,37 +11877,37 @@ test_all(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++) {
- if(j >= (int)dims[1]) {
- if(rbuf[i][j] != 0)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++) {
+ if (j >= (int)dims[1]) {
+ if (rbuf[i][j] != 0)
TEST_ERROR
}
- else
- if(rbuf[i][j] != erbuf[i][j])
- TEST_ERROR
+ else if (rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
}
/* Reopen srcfile if config option specified */
- if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
- if((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if ((srcfile = H5Fopen(srcfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Create third printf source dataset */
- if((srcdset[4] = H5Dcreate2(srcfile, "src_dset_printf_2", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0)
+ if ((srcdset[4] = H5Dcreate2(srcfile, "src_dset_printf_2", H5T_NATIVE_INT, srcspace[2], H5P_DEFAULT,
+ srcdcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Adjust write buffer */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
buf[i][j] += (int)mdims[0] * (int)mdims[1];
/* Write to srcdset[4] */
@@ -11928,64 +11915,64 @@ test_all(unsigned config, hid_t fapl)
start[1] = 0;
block[0] = 3;
block[1] = 2;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
TEST_ERROR
- if(H5Dwrite(srcdset[4], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[4], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Update erbuf */
- for(i = 0; i < 3; i++)
- for(j = 0; j < 2; j++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 2; j++)
erbuf[i][j + 8] = buf[i][j];
/* Close srcdset[4] srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[4]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[4]) < 0)
TEST_ERROR
srcdset[4] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Get VDS space */
- if((filespace = H5Dget_space(vdset)) < 0)
+ if ((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
/* Get VDS space dimensions */
- if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
- if(ndims != 2)
+ if (ndims != 2)
TEST_ERROR
- if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ if (H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
TEST_ERROR
- if(dims[0] != 10)
+ if (dims[0] != 10)
TEST_ERROR
- if(dims[1] != 10)
+ if (dims[1] != 10)
TEST_ERROR
- if(mdims[0] != 10)
+ if (mdims[0] != 10)
TEST_ERROR
- if(mdims[1] != 10)
+ if (mdims[1] != 10)
TEST_ERROR
/* Close filespace */
- if(H5Sclose(filespace) < 0)
+ if (H5Sclose(filespace) < 0)
TEST_ERROR
/* Read data through virtual dataset */
@@ -11995,58 +11982,58 @@ test_all(unsigned config, hid_t fapl)
/* Select hyperslab in memory space */
start[0] = 0;
start[1] = 0;
- if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ if (H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
TEST_ERROR
/* Read data */
- if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)mdims[0]; i++)
- for(j = 0; j < (int)mdims[1]; j++)
- if(rbuf[i][j] != erbuf[i][j])
+ for (i = 0; i < (int)mdims[0]; i++)
+ for (j = 0; j < (int)mdims[1]; j++)
+ if (rbuf[i][j] != erbuf[i][j])
TEST_ERROR
/* Close */
- if(!(config & TEST_IO_CLOSE_SRC)) {
- for(i = 0; i < 5; i++) {
- if(H5Dclose(srcdset[i]) < 0)
+ if (!(config & TEST_IO_CLOSE_SRC)) {
+ for (i = 0; i < 5; i++) {
+ if (H5Dclose(srcdset[i]) < 0)
TEST_ERROR
srcdset[i] = -1;
}
- if(H5Fclose(srcfile) < 0)
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
- else if(!(config & TEST_IO_DIFFERENT_FILE)) {
- if(H5Fclose(srcfile) < 0)
+ else if (!(config & TEST_IO_DIFFERENT_FILE)) {
+ if (H5Fclose(srcfile) < 0)
TEST_ERROR
srcfile = -1;
}
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) {
- if(H5Sclose(srcspace[i]) < 0)
+ for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) {
+ if (H5Sclose(srcspace[i]) < 0)
TEST_ERROR
srcspace[i] = -1;
}
- for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) {
- if(H5Sclose(vspace[i]) < 0)
+ for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) {
+ if (H5Sclose(vspace[i]) < 0)
TEST_ERROR
vspace[i] = -1;
}
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
dcpl = -1;
- if(H5Pclose(srcdcpl) < 0)
+ if (H5Pclose(srcdcpl) < 0)
TEST_ERROR
srcdcpl = -1;
- if(H5Sclose(memspace) < 0)
+ if (H5Sclose(memspace) < 0)
TEST_ERROR
memspace = -1;
@@ -12054,26 +12041,27 @@ test_all(unsigned config, hid_t fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
+ H5E_BEGIN_TRY
+ {
+ for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
H5Dclose(srcdset[i]);
H5Dclose(vdset);
H5Fclose(srcfile);
H5Fclose(vfile);
- for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
H5Sclose(srcspace[i]);
- for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
H5Sclose(vspace[i]);
H5Sclose(filespace);
H5Sclose(memspace);
H5Pclose(dcpl);
H5Pclose(srcdcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- return 1;
+ return 1;
} /* end test_all() */
-
/*-------------------------------------------------------------------------
* Function: test_dapl_values
*
@@ -12086,51 +12074,51 @@ error:
static int
test_dapl_values(hid_t fapl_id)
{
- hid_t fid = -1; /* file to write to */
- hid_t dcpl_id = -1; /* dataset creation properties */
- hid_t dapl_id1 = -1; /* dataset access properties */
- hid_t dapl_id2 = -1; /* dataset access properties */
- hid_t vds_sid = -1; /* vds data space */
- hid_t src_sid = -1; /* source data space */
- hid_t did1 = -1; /* dataset */
- hid_t did2 = -1; /* dataset */
- hsize_t start; /* hyperslab start */
- hsize_t stride; /* hyperslab count */
- hsize_t count; /* hyperslab count */
- hsize_t block; /* hyperslab count */
- hsize_t dims; /* dataset size */
- hsize_t max_dims; /* dataset max size */
- H5D_vds_view_t view; /* view from dapl */
- hsize_t gap_size; /* gap size from dapl */
- char filename[1024]; /* file names */
+ hid_t fid = -1; /* file to write to */
+ hid_t dcpl_id = -1; /* dataset creation properties */
+ hid_t dapl_id1 = -1; /* dataset access properties */
+ hid_t dapl_id2 = -1; /* dataset access properties */
+ hid_t vds_sid = -1; /* vds data space */
+ hid_t src_sid = -1; /* source data space */
+ hid_t did1 = -1; /* dataset */
+ hid_t did2 = -1; /* dataset */
+ hsize_t start; /* hyperslab start */
+ hsize_t stride; /* hyperslab count */
+ hsize_t count; /* hyperslab count */
+ hsize_t block; /* hyperslab count */
+ hsize_t dims; /* dataset size */
+ hsize_t max_dims; /* dataset max size */
+ H5D_vds_view_t view; /* view from dapl */
+ hsize_t gap_size; /* gap size from dapl */
+ char filename[1024]; /* file names */
TESTING("H5Dget_access_plist() returns dapl w/ correct values");
/* Create the file */
h5_fixname(FILENAME[5], fapl_id, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
FAIL_STACK_ERROR
/* Create the dcpl and set up VDS mapping */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
/* source */
dims = 42;
- if((src_sid = H5Screate_simple(1, &dims, NULL)) < 0)
+ if ((src_sid = H5Screate_simple(1, &dims, NULL)) < 0)
FAIL_STACK_ERROR
/* vds */
- dims = 0;
+ dims = 0;
max_dims = H5S_UNLIMITED;
- if((vds_sid = H5Screate_simple(1, &dims, &max_dims)) < 0)
+ if ((vds_sid = H5Screate_simple(1, &dims, &max_dims)) < 0)
FAIL_STACK_ERROR
- start = 0;
+ start = 0;
stride = 42;
- count = H5S_UNLIMITED;
- block = 42;
- if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, &start, &stride, &count, &block) < 0)
+ count = H5S_UNLIMITED;
+ block = 42;
+ if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, &start, &stride, &count, &block) < 0)
FAIL_STACK_ERROR
/* map */
- if(H5Pset_virtual(dcpl_id, vds_sid, "f-%b.h5", "/dset1", src_sid) < 0)
+ if (H5Pset_virtual(dcpl_id, vds_sid, "f-%b.h5", "/dset1", src_sid) < 0)
FAIL_STACK_ERROR
/* Create the dapls and set values
@@ -12139,70 +12127,79 @@ test_dapl_values(hid_t fapl_id)
* default isn't the best way to test setting and getting the view.
*/
/* dapl 1 */
- if((dapl_id1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl_id1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_virtual_view(dapl_id1, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl_id1, H5D_VDS_FIRST_MISSING) < 0)
FAIL_STACK_ERROR
/* dapl 2 */
- if((dapl_id2 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl_id2 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
/* default but we set it explicitly to be sure */
- if(H5Pset_virtual_view(dapl_id2, H5D_VDS_LAST_AVAILABLE) < 0)
+ if (H5Pset_virtual_view(dapl_id2, H5D_VDS_LAST_AVAILABLE) < 0)
FAIL_STACK_ERROR
- if(H5Pset_virtual_printf_gap(dapl_id2, 123) < 0)
+ if (H5Pset_virtual_printf_gap(dapl_id2, 123) < 0)
FAIL_STACK_ERROR
/* Create the datasets */
- if((did1 = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id1)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id1)) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id2)) < 0)
+ if ((did2 = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id2)) < 0)
FAIL_STACK_ERROR
/* Close the dapls */
- if(H5Pclose(dapl_id1) < 0)
+ if (H5Pclose(dapl_id1) < 0)
FAIL_STACK_ERROR
dapl_id1 = -1;
- if(H5Pclose(dapl_id2) < 0)
+ if (H5Pclose(dapl_id2) < 0)
FAIL_STACK_ERROR
dapl_id2 = -1;
/* Get a data access property lists from the dataset */
- if((dapl_id1 = H5Dget_access_plist(did1)) < 0)
+ if ((dapl_id1 = H5Dget_access_plist(did1)) < 0)
FAIL_STACK_ERROR
- if((dapl_id2 = H5Dget_access_plist(did2)) < 0)
+ if ((dapl_id2 = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Check the values from the dapls */
/* dapl 1 */
- if(H5Pget_virtual_view(dapl_id1, &view) < 0)
+ if (H5Pget_virtual_view(dapl_id1, &view) < 0)
FAIL_STACK_ERROR
- if(H5D_VDS_FIRST_MISSING != view)
+ if (H5D_VDS_FIRST_MISSING != view)
TEST_ERROR
/* dapl 2 */
- if(H5Pget_virtual_view(dapl_id2, &view) < 0)
+ if (H5Pget_virtual_view(dapl_id2, &view) < 0)
FAIL_STACK_ERROR
- if(H5D_VDS_LAST_AVAILABLE != view)
+ if (H5D_VDS_LAST_AVAILABLE != view)
TEST_ERROR
- if(H5Pget_virtual_printf_gap(dapl_id2, &gap_size) < 0)
+ if (H5Pget_virtual_printf_gap(dapl_id2, &gap_size) < 0)
FAIL_STACK_ERROR
- if(gap_size != 123)
+ if (gap_size != 123)
TEST_ERROR
/* Close everything */
- if(H5Sclose(vds_sid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(src_sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did1) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dapl_id1) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dapl_id2) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl_id) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ if (H5Sclose(vds_sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(src_sid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dapl_id1) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dapl_id2) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(dcpl_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Dclose(did1);
H5Dclose(did2);
H5Pclose(dapl_id1);
@@ -12211,11 +12208,11 @@ test_dapl_values(hid_t fapl_id)
H5Sclose(vds_sid);
H5Sclose(src_sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_dapl_values() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -12232,13 +12229,13 @@ test_dapl_values(hid_t fapl_id)
int
main(void)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t fapl;
- hid_t my_fapl = -1; /* File access property list */
- int test_api_config;
- unsigned bit_config;
- H5F_libver_t low, high; /* Low and high bounds */
- int nerrors = 0;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fapl;
+ hid_t my_fapl = -1; /* File access property list */
+ int test_api_config;
+ unsigned bit_config;
+ H5F_libver_t low, high; /* Low and high bounds */
+ int nerrors = 0;
/* Testing setup */
h5_reset();
@@ -12247,37 +12244,42 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Set to use the latest file format */
- if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((my_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
- /* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- char msg[80]; /* Message for file version bounds */
- const char *low_string; /* The low bound string */
- const char *high_string; /* The high bound string */
+ /* Loop through all the combinations of low/high version bounds */
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ char msg[80]; /* Message for file version bounds */
+ const char *low_string; /* The low bound string */
+ const char *high_string; /* The high bound string */
/* Invalid combinations, just continue */
- if(high == H5F_LIBVER_EARLIEST || high < low)
+ if (high == H5F_LIBVER_EARLIEST || high < low)
continue;
/* Test virtual dataset only for V110 and above */
- if(high < H5F_LIBVER_V110)
+ if (high < H5F_LIBVER_V110)
continue;
/* Set the low/high version bounds */
- if(H5Pset_libver_bounds(my_fapl, low, high) < 0)
+ if (H5Pset_libver_bounds(my_fapl, low, high) < 0)
TEST_ERROR
/* Display testing info */
- low_string = h5_get_version_string(low);
+ low_string = h5_get_version_string(low);
high_string = h5_get_version_string(high);
- HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string, high_string);
+ HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string,
+ high_string);
HDputs(msg);
- for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++)
+ for (test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS;
+ test_api_config++)
nerrors += test_api((test_api_config_t)test_api_config, my_fapl, low);
- for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
- HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
+ for (bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
+ HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "",
+ bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file",
+ bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
nerrors += test_basic_io(bit_config, my_fapl);
nerrors += test_vds_prefix_first(bit_config, my_fapl);
nerrors += test_unlim(bit_config, my_fapl);
@@ -12290,13 +12292,13 @@ main(void)
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, my_fapl) < 0 ? 1 : 0);
- } /* end for high */
- } /* end for low */
+ } /* end for high */
+ } /* end for low */
- if(H5Pclose(my_fapl) < 0)
+ if (H5Pclose(my_fapl) < 0)
TEST_ERROR
- if(nerrors)
+ if (nerrors)
goto error;
HDprintf("All virtual dataset tests passed.\n");
h5_cleanup(FILENAME, fapl);
@@ -12305,8 +12307,6 @@ main(void)
error:
nerrors = MAX(1, nerrors);
- HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/test/vds_env.c b/test/vds_env.c
index 0d0891f..6e9518b 100644
--- a/test/vds_env.c
+++ b/test/vds_env.c
@@ -18,23 +18,17 @@
*/
#include "h5test.h"
-const char *FILENAME[] = {
- "vds_env_virt_0",
- "vds_env_virt_3",
- "vds_env_src_2",
- "vds_env%%_src2",
- NULL
-};
+const char *FILENAME[] = {"vds_env_virt_0", "vds_env_virt_3", "vds_env_src_2", "vds_env%%_src2", NULL};
/* I/O test config flags */
-#define TEST_IO_CLOSE_SRC 0x01u
-#define TEST_IO_DIFFERENT_FILE 0x02u
-#define TEST_IO_REOPEN_VIRT 0x04u
-#define TEST_IO_NTESTS 0x08u
+#define TEST_IO_CLOSE_SRC 0x01u
+#define TEST_IO_DIFFERENT_FILE 0x02u
+#define TEST_IO_REOPEN_VIRT 0x04u
+#define TEST_IO_NTESTS 0x08u
-#define FILENAME_BUF_SIZE 1024
+#define FILENAME_BUF_SIZE 1024
-#define TMPDIR "tmp_vds_env/"
+#define TMPDIR "tmp_vds_env/"
/*-------------------------------------------------------------------------
* Function: test_vds_prefix_second
@@ -57,21 +51,21 @@ test_vds_prefix_second(unsigned config, hid_t fapl)
char srcfilenamepct[FILENAME_BUF_SIZE];
char srcfilenamepct_map[FILENAME_BUF_SIZE];
const char *srcfilenamepct_map_orig = "vds%%%%_src";
- hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
- hid_t vfile = -1; /* File with virtual dset */
- hid_t dcpl = -1; /* Dataset creation property list */
- hid_t dapl = -1; /* Dataset access property list */
- hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
- hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
- hid_t memspace = -1; /* Memory dataspace */
- hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
- hid_t vdset = -1; /* Virtual dataset */
- hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */
- int buf[10][26]; /* Write and expected read buffer */
- int rbuf[10][26]; /* Read buffer */
- int fill = -1; /* Fill value */
+ hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t dapl = -1; /* Dataset access property list */
+ hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
+ hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
+ hid_t memspace = -1; /* Memory dataspace */
+ hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */
+ int buf[10][26]; /* Write and expected read buffer */
+ int rbuf[10][26]; /* Read buffer */
+ int fill = -1; /* Fill value */
int i, j;
- char buffer[1024]; /* buffer to read vds_prefix */
+ char buffer[1024]; /* buffer to read vds_prefix */
TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix")
@@ -87,207 +81,210 @@ test_vds_prefix_second(unsigned config, hid_t fapl)
TEST_ERROR
/* Create DCPL */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
/* Set fill value */
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0)
TEST_ERROR
/* Set prefix to a nonexistent directory, will be overwritten by environment variable */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
TEST_ERROR
- if(H5Pset_virtual_prefix(dapl, "someprefix") < 0)
+ if (H5Pset_virtual_prefix(dapl, "someprefix") < 0)
TEST_ERROR
- if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0)
+ if (H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0)
TEST_ERROR
- if(HDstrcmp(buffer, "someprefix") != 0)
+ if (HDstrcmp(buffer, "someprefix") != 0)
FAIL_PUTS_ERROR("vds prefix not set correctly");
/* Create source dataspace */
- if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
- if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Select all (should not be necessary, but just to be sure) */
- if(H5Sselect_all(srcspace[0]) < 0)
+ if (H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
- if(H5Sselect_all(vspace[0]) < 0)
+ if (H5Sselect_all(vspace[0]) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0)
+ if (H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset",
+ srcspace[0]) < 0)
TEST_ERROR
/* Create virtual file */
- if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Create source file if requested */
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(NULL == HDgetcwd(buffer, 1024))
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (NULL == HDgetcwd(buffer, 1024))
TEST_ERROR
- if(HDchdir(TMPDIR) < 0)
+ if (HDchdir(TMPDIR) < 0)
TEST_ERROR
- if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- if(HDchdir(buffer) < 0)
+ if (HDchdir(buffer) < 0)
TEST_ERROR
}
else {
srcfile[0] = vfile;
- if(H5Iinc_ref(srcfile[0]) < 0)
+ if (H5Iinc_ref(srcfile[0]) < 0)
TEST_ERROR
}
/* Create source dataset */
- if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create virtual dataset */
- if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR
/* Populate write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j;
/* Write data directly to source dataset */
- if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Close srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(H5Dclose(srcdset[0]) < 0)
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(H5Fclose(srcfile[0]) < 0)
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
}
}
/* Reopen virtual dataset and file if config option specified */
- if(config & TEST_IO_REOPEN_VIRT) {
- if(H5Dclose(vdset) < 0)
+ if (config & TEST_IO_REOPEN_VIRT) {
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0)
+ if ((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
- if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ if ((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
}
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) {
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j]) {
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) {
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j]) {
TEST_ERROR
}
}
/* Adjust write buffer */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0]));
/* Write data through virtual dataset */
- if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
TEST_ERROR
/* Reopen srcdset and srcfile if config option specified */
- if(config & TEST_IO_CLOSE_SRC) {
- if(config & TEST_IO_DIFFERENT_FILE) {
- if(NULL == HDgetcwd(buffer, 1024))
+ if (config & TEST_IO_CLOSE_SRC) {
+ if (config & TEST_IO_DIFFERENT_FILE) {
+ if (NULL == HDgetcwd(buffer, 1024))
TEST_ERROR
- if(HDchdir(TMPDIR) < 0)
+ if (HDchdir(TMPDIR) < 0)
TEST_ERROR
- if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- if(HDchdir(buffer) < 0)
+ if (HDchdir(buffer) < 0)
TEST_ERROR
}
- if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
+ if ((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
}
/* Read data directly from source dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
- if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ if (H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
TEST_ERROR
/* Verify read data */
- for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
- for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
- if(rbuf[i][j] != buf[i][j])
+ for (i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++)
+ for (j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++)
+ if (rbuf[i][j] != buf[i][j])
TEST_ERROR
/* Close */
- if(H5Dclose(vdset) < 0)
+ if (H5Dclose(vdset) < 0)
TEST_ERROR
vdset = -1;
- if(H5Dclose(srcdset[0]) < 0)
+ if (H5Dclose(srcdset[0]) < 0)
TEST_ERROR
srcdset[0] = -1;
- if(H5Fclose(srcfile[0]) < 0)
+ if (H5Fclose(srcfile[0]) < 0)
TEST_ERROR
srcfile[0] = -1;
- if(H5Fclose(vfile) < 0)
+ if (H5Fclose(vfile) < 0)
TEST_ERROR
vfile = -1;
- if(H5Sclose(srcspace[0]) < 0)
+ if (H5Sclose(srcspace[0]) < 0)
TEST_ERROR
srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
+ if (H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
TEST_ERROR
dapl = -1;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
TEST_ERROR
dcpl = -1;
PASSED();
return 0;
- error:
- H5E_BEGIN_TRY {
- for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
+error:
+ H5E_BEGIN_TRY
+ {
+ for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++)
H5Dclose(srcdset[i]);
H5Dclose(vdset);
- for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++)
H5Fclose(srcfile[i]);
H5Fclose(vfile);
- for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++)
H5Sclose(srcspace[i]);
- for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
+ for (i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++)
H5Sclose(vspace[i]);
H5Sclose(memspace);
H5Pclose(dapl);
H5Pclose(dcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* end test_vds_prefix2 */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -299,58 +296,62 @@ test_vds_prefix_second(unsigned config, hid_t fapl)
int
main(void)
{
- hid_t fapl, my_fapl;
- unsigned bit_config;
- H5F_libver_t low, high; /* Low and high bounds */
- int nerrors = 0;
+ hid_t fapl, my_fapl;
+ unsigned bit_config;
+ H5F_libver_t low, high; /* Low and high bounds */
+ int nerrors = 0;
/* Testing setup */
h5_reset();
fapl = h5_fileaccess();
/* Set to use the latest file format */
- if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if ((my_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
- /* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- char msg[80]; /* Message for file version bounds */
- const char *low_string; /* The low bound string */
- const char *high_string; /* The high bound string */
+ /* Loop through all the combinations of low/high version bounds */
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ char msg[80]; /* Message for file version bounds */
+ const char *low_string; /* The low bound string */
+ const char *high_string; /* The high bound string */
/* Invalid combinations, just continue */
- if(high == H5F_LIBVER_EARLIEST || high < low)
+ if (high == H5F_LIBVER_EARLIEST || high < low)
continue;
/* Test virtual dataset only for V110 and above */
- if(high < H5F_LIBVER_V110)
+ if (high < H5F_LIBVER_V110)
continue;
/* Set the low/high version bounds */
- if(H5Pset_libver_bounds(my_fapl, low, high) < 0)
+ if (H5Pset_libver_bounds(my_fapl, low, high) < 0)
TEST_ERROR
/* Display testing info */
- low_string = h5_get_version_string(low);
+ low_string = h5_get_version_string(low);
high_string = h5_get_version_string(high);
- HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string, high_string);
+ HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string,
+ high_string);
HDputs(msg);
- for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
- HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
+ for (bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
+ HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "",
+ bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file",
+ bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
nerrors += test_vds_prefix_second(bit_config, fapl);
}
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, my_fapl) < 0 ? 1 : 0);
- } /* end for high */
- } /* end for low */
+ } /* end for high */
+ } /* end for low */
- if(H5Pclose(my_fapl) < 0)
+ if (H5Pclose(my_fapl) < 0)
TEST_ERROR
- if(nerrors)
+ if (nerrors)
goto error;
HDprintf("All virtual dataset tests passed.\n");
h5_cleanup(FILENAME, fapl);
@@ -359,7 +360,6 @@ main(void)
error:
nerrors = MAX(1, nerrors);
- HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return EXIT_FAILURE;
} /* end main() */
diff --git a/test/vds_swmr.h b/test/vds_swmr.h
index 0a194ff..676d831 100644
--- a/test/vds_swmr.h
+++ b/test/vds_swmr.h
@@ -61,27 +61,26 @@
"empty" regions will contain the VDS fill value.
*/
-
/* All datasets are 3D */
-#define RANK 3
+#define RANK 3
/* Lengths of string identifiers (file, dataset names, etc.) */
-#define NAME_LEN 32
+#define NAME_LEN 32
/* Compression level */
-#define COMPRESSION_LEVEL 7
+#define COMPRESSION_LEVEL 7
/* Number of source files */
-#define N_SOURCES 6
+#define N_SOURCES 6
/* Dataset dimensions */
-#define SM_HEIGHT 2 /* K */
-#define LG_HEIGHT 4 /* N */
-#define FULL_HEIGHT 18 /* (3 * K) + (3 * N) */
-#define WIDTH 8 /* M */
+#define SM_HEIGHT 2 /* K */
+#define LG_HEIGHT 4 /* N */
+#define FULL_HEIGHT 18 /* (3 * K) + (3 * N) */
+#define WIDTH 8 /* M */
/* Number of planes each writer will write */
-#define N_PLANES_TO_WRITE 25
+#define N_PLANES_TO_WRITE 25
/* Planes */
H5TEST_DLLVAR hsize_t PLANES[N_SOURCES][RANK];
@@ -96,4 +95,3 @@ H5TEST_DLLVAR char VDS_FILE_NAME[NAME_LEN];
H5TEST_DLLVAR char SOURCE_DSET_PATH[NAME_LEN];
H5TEST_DLLVAR char VDS_DSET_NAME[NAME_LEN];
#endif /* VDS_SWMR_H */
-
diff --git a/test/vds_swmr_gen.c b/test/vds_swmr_gen.c
index b14ecc2..50687a9 100644
--- a/test/vds_swmr_gen.c
+++ b/test/vds_swmr_gen.c
@@ -15,22 +15,16 @@
#include "vds_swmr.h"
/* Max number of planes in the dataset */
-#define N_MAX_PLANES H5S_UNLIMITED
+#define N_MAX_PLANES H5S_UNLIMITED
/* Dataset datatypes */
-#define SOURCE_DATATYPE H5T_STD_I32LE
-#define VDS_DATATYPE H5T_STD_I32LE
+#define SOURCE_DATATYPE H5T_STD_I32LE
+#define VDS_DATATYPE H5T_STD_I32LE
/* Starting size of datasets, both source and VDS */
-static hsize_t DIMS[N_SOURCES][RANK] = {
- {0, SM_HEIGHT, WIDTH},
- {0, LG_HEIGHT, WIDTH},
- {0, SM_HEIGHT, WIDTH},
- {0, LG_HEIGHT, WIDTH},
- {0, SM_HEIGHT, WIDTH},
- {0, LG_HEIGHT, WIDTH}
-};
-static hsize_t VDS_DIMS[RANK] = {0, FULL_HEIGHT, WIDTH};
+static hsize_t DIMS[N_SOURCES][RANK] = {{0, SM_HEIGHT, WIDTH}, {0, LG_HEIGHT, WIDTH}, {0, SM_HEIGHT, WIDTH},
+ {0, LG_HEIGHT, WIDTH}, {0, SM_HEIGHT, WIDTH}, {0, LG_HEIGHT, WIDTH}};
+static hsize_t VDS_DIMS[RANK] = {0, FULL_HEIGHT, WIDTH};
/* Maximum size of datasets, both source and VDS.
* NOTE: Theoretical (i.e.: H5S_UNLIMITED), not the actual max
@@ -38,47 +32,34 @@ static hsize_t VDS_DIMS[RANK] = {0, FULL_HEIGHT, WIDTH};
* That number is specified separately.
*/
static hsize_t MAX_DIMS[N_SOURCES][RANK] = {
- {N_MAX_PLANES, SM_HEIGHT, WIDTH},
- {N_MAX_PLANES, LG_HEIGHT, WIDTH},
- {N_MAX_PLANES, SM_HEIGHT, WIDTH},
- {N_MAX_PLANES, LG_HEIGHT, WIDTH},
- {N_MAX_PLANES, SM_HEIGHT, WIDTH},
- {N_MAX_PLANES, LG_HEIGHT, WIDTH}
-};
+ {N_MAX_PLANES, SM_HEIGHT, WIDTH}, {N_MAX_PLANES, LG_HEIGHT, WIDTH}, {N_MAX_PLANES, SM_HEIGHT, WIDTH},
+ {N_MAX_PLANES, LG_HEIGHT, WIDTH}, {N_MAX_PLANES, SM_HEIGHT, WIDTH}, {N_MAX_PLANES, LG_HEIGHT, WIDTH}};
static hsize_t VDS_MAX_DIMS[RANK] = {N_MAX_PLANES, FULL_HEIGHT, WIDTH};
static char SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
-static int32_t FILL_VALUES[N_SOURCES] = {
- -1,
- -2,
- -3,
- -4,
- -5,
- -6
-};
+static int32_t FILL_VALUES[N_SOURCES] = {-1, -2, -3, -4, -5, -6};
static int32_t VDS_FILL_VALUE = -9;
int
main(void)
{
- hid_t faplid = -1; /* file access property list ID (all files) */
+ hid_t faplid = -1; /* file access property list ID (all files) */
- hid_t src_sid = -1; /* source dataset's dataspace ID */
- hid_t src_dcplid = -1; /* source dataset property list ID */
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t src_dcplid = -1; /* source dataset property list ID */
- hid_t vds_sid = -1; /* VDS dataspace ID */
- hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
- hid_t fid = -1; /* HDF5 file ID */
- hid_t did = -1; /* dataset ID */
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
- hsize_t start[RANK]; /* starting point for hyperslab */
- int map_start = -1; /* starting point in the VDS map */
-
- int i; /* iterator */
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ int map_start = -1; /* starting point in the VDS map */
+ int i; /* iterator */
/* Start by creating the virtual dataset (VDS) dataspace and creation
* property list. The individual source datasets are then created
@@ -86,139 +67,129 @@ main(void)
*/
/* Create VDS dcpl */
- if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_fill_value(vds_dcplid, VDS_DATATYPE,
- &VDS_FILL_VALUE) < 0)
+ if (H5Pset_fill_value(vds_dcplid, VDS_DATATYPE, &VDS_FILL_VALUE) < 0)
TEST_ERROR
/* Create VDS dataspace */
- if((vds_sid = H5Screate_simple(RANK, VDS_DIMS,
- VDS_MAX_DIMS)) < 0)
+ if ((vds_sid = H5Screate_simple(RANK, VDS_DIMS, VDS_MAX_DIMS)) < 0)
TEST_ERROR
/************************************
* Create source files and datasets *
************************************/
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
map_start = 0;
/* All SWMR files need to use the latest file format */
- if((faplid = h5_fileaccess()) < 0)
+ if ((faplid = h5_fileaccess()) < 0)
TEST_ERROR
- if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
- for(i = 0; i < N_SOURCES; i++) {
+ for (i = 0; i < N_SOURCES; i++) {
/* source dataset dcpl */
- if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if(H5Pset_chunk(src_dcplid, RANK, PLANES[i]) < 0)
+ if (H5Pset_chunk(src_dcplid, RANK, PLANES[i]) < 0)
TEST_ERROR
- if(H5Pset_fill_value(src_dcplid, SOURCE_DATATYPE,
- &FILL_VALUES[i]) < 0)
+ if (H5Pset_fill_value(src_dcplid, SOURCE_DATATYPE, &FILL_VALUES[i]) < 0)
TEST_ERROR
/* Use a mix of compressed and uncompressed datasets */
- if(0 != i % 2)
- if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ if (0 != i % 2)
+ if (H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
TEST_ERROR
/* Create source file, dataspace, and dataset */
- if((fid = H5Fcreate(FILE_NAMES[i], H5F_ACC_TRUNC,
- H5P_DEFAULT, faplid)) < 0)
+ if ((fid = H5Fcreate(FILE_NAMES[i], H5F_ACC_TRUNC, H5P_DEFAULT, faplid)) < 0)
TEST_ERROR
- if((src_sid = H5Screate_simple(RANK, DIMS[i],
- MAX_DIMS[i])) < 0)
+ if ((src_sid = H5Screate_simple(RANK, DIMS[i], MAX_DIMS[i])) < 0)
TEST_ERROR
- if((did = H5Dcreate2(fid, SOURCE_DSET_NAME,
- SOURCE_DATATYPE, src_sid,
- H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, SOURCE_DSET_NAME, SOURCE_DATATYPE, src_sid, H5P_DEFAULT, src_dcplid,
+ H5P_DEFAULT)) < 0)
TEST_ERROR
/* set up hyperslabs for source and destination datasets */
start[1] = 0;
- if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
- MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, MAX_DIMS[i], NULL) < 0)
TEST_ERROR
start[1] = (hsize_t)map_start;
- if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL,
- MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL, MAX_DIMS[i], NULL) < 0)
TEST_ERROR
- if(PLANES[i][1] > INT_MAX)
+ if (PLANES[i][1] > INT_MAX)
TEST_ERROR
map_start += (int)PLANES[i][1];
/* Add VDS mapping */
- if(H5Pset_virtual(vds_dcplid, vds_sid, FILE_NAMES[i],
- SOURCE_DSET_PATH, src_sid) < 0)
+ if (H5Pset_virtual(vds_dcplid, vds_sid, FILE_NAMES[i], SOURCE_DSET_PATH, src_sid) < 0)
TEST_ERROR
/* close */
- if(H5Sclose(src_sid) < 0)
+ if (H5Sclose(src_sid) < 0)
TEST_ERROR
- if(H5Pclose(src_dcplid) < 0)
+ if (H5Pclose(src_dcplid) < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
} /* end for */
-
/*******************
* Create VDS file *
*******************/
/* file */
- if((fid = H5Fcreate(VDS_FILE_NAME, H5F_ACC_TRUNC,
- H5P_DEFAULT, faplid)) < 0)
+ if ((fid = H5Fcreate(VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, faplid)) < 0)
TEST_ERROR
/* dataset */
- if((did = H5Dcreate2(fid, VDS_DSET_NAME, VDS_DATATYPE, vds_sid,
- H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, VDS_DSET_NAME, VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) <
+ 0)
TEST_ERROR
/* close */
- if(H5Pclose(faplid) < 0)
+ if (H5Pclose(faplid) < 0)
TEST_ERROR
- if(H5Pclose(vds_dcplid) < 0)
+ if (H5Pclose(vds_dcplid) < 0)
TEST_ERROR
- if(H5Sclose(vds_sid) < 0)
+ if (H5Sclose(vds_sid) < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
- if(faplid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (faplid >= 0)
(void)H5Pclose(faplid);
- if(src_sid >= 0)
+ if (src_sid >= 0)
(void)H5Sclose(src_sid);
- if(src_dcplid >= 0)
+ if (src_dcplid >= 0)
(void)H5Pclose(src_dcplid);
- if(vds_sid >= 0)
+ if (vds_sid >= 0)
(void)H5Sclose(vds_sid);
- if(vds_dcplid >= 0)
+ if (vds_dcplid >= 0)
(void)H5Pclose(vds_dcplid);
- if(fid >= 0)
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return EXIT_FAILURE;
} /* end main */
-
diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c
index 1ee65a0..bdb73b8 100644
--- a/test/vds_swmr_reader.c
+++ b/test/vds_swmr_reader.c
@@ -19,78 +19,77 @@ static hsize_t VDS_PLANE[RANK] = {1, FULL_HEIGHT, WIDTH};
int
main(void)
{
- hid_t fid = -1; /* HDF5 file ID */
- hid_t faplid = -1; /* file access property list ID */
- hid_t did = -1; /* dataset ID */
- hid_t msid = -1; /* memory dataspace ID */
- hid_t fsid = -1; /* file dataspace ID */
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t faplid = -1; /* file access property list ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
- hsize_t start[RANK]; /* hyperslab start point */
+ hsize_t start[RANK]; /* hyperslab start point */
- int n_elements = 0; /* size of buffer (elements) */
- size_t size = 0; /* size of buffer (bytes) */
- int *buffer = NULL; /* data buffer */
-
- int n_dims = -1; /* # dimensions in dataset */
- hsize_t dims[RANK]; /* current size of dataset */
- hsize_t max_dims[RANK]; /* max size of dataset */
+ int n_elements = 0; /* size of buffer (elements) */
+ size_t size = 0; /* size of buffer (bytes) */
+ int * buffer = NULL; /* data buffer */
+ int n_dims = -1; /* # dimensions in dataset */
+ hsize_t dims[RANK]; /* current size of dataset */
+ hsize_t max_dims[RANK]; /* max size of dataset */
/* Open the VDS file and dataset */
- if((faplid = h5_fileaccess()) < 0)
+ if ((faplid = h5_fileaccess()) < 0)
TEST_ERROR
- if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, faplid)) < 0)
+ if ((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, faplid)) < 0)
TEST_ERROR
- if((did = H5Dopen2(fid, VDS_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, VDS_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create the read buffer */
- if(VDS_PLANE[1] * VDS_PLANE[2] > INT_MAX)
+ if (VDS_PLANE[1] * VDS_PLANE[2] > INT_MAX)
TEST_ERROR
n_elements = (int)(VDS_PLANE[1] * VDS_PLANE[2]);
- size = (size_t)n_elements * sizeof(int);
- if(NULL == (buffer = (int *)HDmalloc(size)))
+ size = (size_t)n_elements * sizeof(int);
+ if (NULL == (buffer = (int *)HDmalloc(size)))
TEST_ERROR
/* Create memory dataspace */
- if((msid = H5Screate_simple(RANK, VDS_PLANE, NULL)) < 0)
+ if ((msid = H5Screate_simple(RANK, VDS_PLANE, NULL)) < 0)
TEST_ERROR
/* Read data until the dataset is full (via the writer) */
do {
/* Refresh metadata */
- if(H5Drefresh(did) < 0)
+ if (H5Drefresh(did) < 0)
TEST_ERROR
/* Get the dataset dimensions */
- if((fsid = H5Dget_space(did)) < 0)
+ if ((fsid = H5Dget_space(did)) < 0)
TEST_ERROR
- if(H5Sget_simple_extent_dims(fsid, dims, max_dims) < 0)
+ if (H5Sget_simple_extent_dims(fsid, dims, max_dims) < 0)
TEST_ERROR
/* Check the reported size of the VDS */
- if((n_dims = H5Sget_simple_extent_ndims(fsid)) < 0)
+ if ((n_dims = H5Sget_simple_extent_ndims(fsid)) < 0)
TEST_ERROR
- if(n_dims != RANK)
+ if (n_dims != RANK)
TEST_ERROR
- if(H5Sget_simple_extent_dims(fsid, dims, max_dims) < 0)
+ if (H5Sget_simple_extent_dims(fsid, dims, max_dims) < 0)
TEST_ERROR
/* NOTE: Don't care what dims[0] is. */
- if(dims[1] != FULL_HEIGHT)
+ if (dims[1] != FULL_HEIGHT)
TEST_ERROR
- if(dims[2] != WIDTH)
+ if (dims[2] != WIDTH)
TEST_ERROR
- if(max_dims[0] != H5S_UNLIMITED)
+ if (max_dims[0] != H5S_UNLIMITED)
TEST_ERROR
- if(max_dims[1] != FULL_HEIGHT)
+ if (max_dims[1] != FULL_HEIGHT)
TEST_ERROR
- if(max_dims[2] != WIDTH)
+ if (max_dims[2] != WIDTH)
TEST_ERROR
/* Continue if there's nothing to read */
- if(0 == dims[0]) {
- if(H5Sclose(fsid) < 0)
+ if (0 == dims[0]) {
+ if (H5Sclose(fsid) < 0)
TEST_ERROR
continue;
}
@@ -100,23 +99,23 @@ main(void)
start[0] = dims[0] - 1;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, VDS_PLANE, NULL) < 0)
+ if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, VDS_PLANE, NULL) < 0)
TEST_ERROR
- if(H5Dread(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
TEST_ERROR
- if(H5Sclose(fsid) < 0)
+ if (H5Sclose(fsid) < 0)
TEST_ERROR
} while (dims[0] < N_PLANES_TO_WRITE);
/* Close file and dataset */
- if(H5Pclose(faplid) < 0)
+ if (H5Pclose(faplid) < 0)
TEST_ERROR
- if(H5Sclose(msid) < 0)
+ if (H5Sclose(msid) < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
HDfree(buffer);
@@ -126,23 +125,24 @@ main(void)
error:
- H5E_BEGIN_TRY {
- if(fid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(faplid >= 0)
+ if (faplid >= 0)
(void)H5Pclose(faplid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- if(msid >= 0)
+ if (msid >= 0)
(void)H5Sclose(msid);
- if(fsid >= 0)
+ if (fsid >= 0)
(void)H5Sclose(fsid);
- if(buffer != NULL)
+ if (buffer != NULL)
HDfree(buffer);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
HDfprintf(stderr, "ERROR: SWMR reader exited with errors\n");
return EXIT_FAILURE;
} /* end main */
-
diff --git a/test/vds_swmr_writer.c b/test/vds_swmr_writer.c
index d70352d..32ef4c7 100644
--- a/test/vds_swmr_writer.c
+++ b/test/vds_swmr_writer.c
@@ -11,32 +11,30 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#include "h5test.h"
#include "vds_swmr.h"
int
main(int argc, char *argv[])
{
- int file_number = -1; /* Source file number */
-
- hid_t fid = -1; /* HDF5 file ID */
- hid_t faplid = -1; /* file access property list ID */
- hid_t did = -1; /* dataset ID */
- hid_t msid = -1; /* memory dataspace ID */
- hid_t fsid = -1; /* file dataspace ID */
+ int file_number = -1; /* Source file number */
- hsize_t extent[RANK]; /* dataset extents */
- hsize_t start[RANK]; /* hyperslab start point */
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t faplid = -1; /* file access property list ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
- int *buffer = NULL; /* data buffer */
- int value = -1; /* value written to datasets */
+ hsize_t extent[RANK]; /* dataset extents */
+ hsize_t start[RANK]; /* hyperslab start point */
- hsize_t n_elements = 0; /* number of elements in a plane */
+ int *buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
- hsize_t i; /* iterator */
- hsize_t j; /* iterator */
+ hsize_t n_elements = 0; /* number of elements in a plane */
+ hsize_t i; /* iterator */
+ hsize_t j; /* iterator */
/******************************
* Fill a source dataset file *
@@ -45,96 +43,95 @@ main(int argc, char *argv[])
/* The file number is passed on the command line.
* This is an integer index into the FILE_NAMES array.
*/
- if(argc != 2) {
+ if (argc != 2) {
HDfprintf(stderr, "ERROR: Must pass the source file number on the command line.\n");
return EXIT_FAILURE;
}
file_number = HDatoi(argv[1]);
- if(file_number < 0 || file_number >= N_SOURCES)
+ if (file_number < 0 || file_number >= N_SOURCES)
TEST_ERROR
/* Open the source file and dataset */
/* All SWMR files need to use the latest file format */
- if((faplid = h5_fileaccess()) < 0)
+ if ((faplid = h5_fileaccess()) < 0)
TEST_ERROR
- if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
- if((fid = H5Fopen(FILE_NAMES[file_number], H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, faplid)) < 0)
+ if ((fid = H5Fopen(FILE_NAMES[file_number], H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, faplid)) < 0)
TEST_ERROR
- if((did = H5Dopen2(fid, SOURCE_DSET_PATH, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, SOURCE_DSET_PATH, H5P_DEFAULT)) < 0)
TEST_ERROR
-
/* Create a data buffer that represents a plane */
n_elements = PLANES[file_number][1] * PLANES[file_number][2];
- if(NULL == (buffer = (int *)HDmalloc(n_elements * sizeof(int))))
+ if (NULL == (buffer = (int *)HDmalloc(n_elements * sizeof(int))))
TEST_ERROR
/* Create the memory dataspace */
- if((msid = H5Screate_simple(RANK, PLANES[file_number], NULL)) < 0)
+ if ((msid = H5Screate_simple(RANK, PLANES[file_number], NULL)) < 0)
TEST_ERROR
/* Write planes to the dataset */
- for(i = 0; i < N_PLANES_TO_WRITE; i++) {
+ for (i = 0; i < N_PLANES_TO_WRITE; i++) {
- time_t delay; /* Time interval between plane writes */
+ time_t delay; /* Time interval between plane writes */
/* Cork the dataset's metadata in the cache */
- if(H5Odisable_mdc_flushes(did) < 0)
+ if (H5Odisable_mdc_flushes(did) < 0)
TEST_ERROR
/* Set the dataset's extent. This is inefficient but that's ok here. */
extent[0] = i + 1;
extent[1] = PLANES[file_number][1];
extent[2] = PLANES[file_number][2];
- if(H5Dset_extent(did, extent) < 0)
+ if (H5Dset_extent(did, extent) < 0)
TEST_ERROR
/* Get the file dataspace */
- if((fsid = H5Dget_space(did)) < 0)
+ if ((fsid = H5Dget_space(did)) < 0)
TEST_ERROR
/* Each plane is filled with the plane number as a data value. */
value = (((int)i + 1) * 10) + (int)i;
- for(j = 0; j < n_elements; j++)
- buffer[j] = value;
+ for (j = 0; j < n_elements; j++)
+ buffer[j] = value;
/* Set up the hyperslab for writing. */
start[0] = i;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, PLANES[file_number], NULL) < 0)
+ if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, PLANES[file_number], NULL) < 0)
TEST_ERROR
/* Write the plane to the dataset. */
- if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
TEST_ERROR
/* Uncork the dataset's metadata from the cache */
- if(H5Oenable_mdc_flushes(did) < 0)
+ if (H5Oenable_mdc_flushes(did) < 0)
TEST_ERROR
/* Wait one second between writing planes */
delay = HDtime(0) + (time_t)1;
- while(HDtime(0) < delay)
+ while (HDtime(0) < delay)
;
/* Flush */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
TEST_ERROR
} /* end for */
- if(H5Pclose(faplid) < 0)
+ if (H5Pclose(faplid) < 0)
TEST_ERROR
- if(H5Sclose(msid) < 0)
+ if (H5Sclose(msid) < 0)
TEST_ERROR
- if(H5Sclose(fsid) < 0)
+ if (H5Sclose(fsid) < 0)
TEST_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
HDfree(buffer);
@@ -143,23 +140,24 @@ main(int argc, char *argv[])
error:
- H5E_BEGIN_TRY {
- if(fid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(faplid >= 0)
+ if (faplid >= 0)
(void)H5Pclose(faplid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- if(msid >= 0)
+ if (msid >= 0)
(void)H5Sclose(msid);
- if(fsid >= 0)
+ if (fsid >= 0)
(void)H5Sclose(fsid);
- if(buffer != NULL)
+ if (buffer != NULL)
HDfree(buffer);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
HDfprintf(stderr, "ERROR: SWMR writer exited with errors\n");
return EXIT_FAILURE;
} /* end main */
-
diff --git a/test/vfd.c b/test/vfd.c
index 5078996..373a57e 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -20,55 +20,53 @@
#include "h5test.h"
-#define KB 1024U
-#define FAMILY_NUMBER 4
-#define FAMILY_SIZE (1*KB)
-#define FAMILY_SIZE2 (5*KB)
-#define MULTI_SIZE 128
-#define SPLITTER_SIZE 8 /* dimensions of a dataset */
-
-#define CORE_INCREMENT (4*KB)
-#define CORE_PAGE_SIZE (1024*KB)
-#define CORE_DSET_NAME "core dset"
-#define CORE_DSET_DIM1 1024
-#define CORE_DSET_DIM2 32
-
-#define DSET1_NAME "dset1"
-#define DSET1_DIM1 1024
-#define DSET1_DIM2 32
-#define DSET3_NAME "dset3"
+#define KB 1024U
+#define FAMILY_NUMBER 4
+#define FAMILY_SIZE (1 * KB)
+#define FAMILY_SIZE2 (5 * KB)
+#define MULTI_SIZE 128
+#define SPLITTER_SIZE 8 /* dimensions of a dataset */
+
+#define CORE_INCREMENT (4 * KB)
+#define CORE_PAGE_SIZE (1024 * KB)
+#define CORE_DSET_NAME "core dset"
+#define CORE_DSET_DIM1 1024
+#define CORE_DSET_DIM2 32
+
+#define DSET1_NAME "dset1"
+#define DSET1_DIM1 1024
+#define DSET1_DIM2 32
+#define DSET3_NAME "dset3"
/* Macros for Direct VFD */
#ifdef H5_HAVE_DIRECT
-#define MBOUNDARY 512
-#define FBSIZE (4*KB)
-#define CBSIZE (8*KB)
-#define THRESHOLD 1
-#define DSET2_NAME "dset2"
-#define DSET2_DIM 4
+#define MBOUNDARY 512
+#define FBSIZE (4 * KB)
+#define CBSIZE (8 * KB)
+#define THRESHOLD 1
+#define DSET2_NAME "dset2"
+#define DSET2_DIM 4
#endif /* H5_HAVE_DIRECT */
-const char *FILENAME[] = {
- "sec2_file", /*0*/
- "core_file", /*1*/
- "family_file", /*2*/
- "new_family_v16_", /*3*/
- "multi_file", /*4*/
- "direct_file", /*5*/
- "log_file", /*6*/
- "stdio_file", /*7*/
- "windows_file", /*8*/
- "new_multi_file_v16",/*9*/
- "ro_s3_file", /*10*/
- "splitter_rw_file", /*11*/
- "splitter_wo_file", /*12*/
- "splitter.log", /*13*/
- NULL
-};
+const char *FILENAME[] = {"sec2_file", /*0*/
+ "core_file", /*1*/
+ "family_file", /*2*/
+ "new_family_v16_", /*3*/
+ "multi_file", /*4*/
+ "direct_file", /*5*/
+ "log_file", /*6*/
+ "stdio_file", /*7*/
+ "windows_file", /*8*/
+ "new_multi_file_v16", /*9*/
+ "ro_s3_file", /*10*/
+ "splitter_rw_file", /*11*/
+ "splitter_wo_file", /*12*/
+ "splitter.log", /*13*/
+ NULL};
#define LOG_FILENAME "log_vfd_out.log"
-#define COMPAT_BASENAME "family_v16_"
+#define COMPAT_BASENAME "family_v16_"
#define MULTI_COMPAT_BASENAME "multi_file_v16"
#define SPLITTER_DATASET_NAME "dataset"
@@ -78,36 +76,31 @@ const char *FILENAME[] = {
* four-byte data.
*/
static int __k;
-#define HEXPRINT(size, buf) \
-for (__k = 0; __k < (size); __k++) { \
- if (__k % 16 == 0) { \
- HDprintf("\n%04x", __k); \
- } \
- HDprintf((__k%4 == 0) ? " %02X" : " %02X", (unsigned char)(buf)[__k]); \
-} /* end #define HEXPRINT() */
-
+#define HEXPRINT(size, buf) \
+ for (__k = 0; __k < (size); __k++) { \
+ if (__k % 16 == 0) { \
+ HDprintf("\n%04x", __k); \
+ } \
+ HDprintf((__k % 4 == 0) ? " %02X" : " %02X", (unsigned char)(buf)[__k]); \
+ } /* end #define HEXPRINT() */
/* Helper structure to pass around dataset information.
*/
struct splitter_dataset_def {
- void *buf; /* contents of dataset */
- const char *dset_name; /* dataset name, always added to root group */
- hid_t mem_type_id; /* datatype */
- const hsize_t *dims; /* dimensions */
- int n_dims; /* rank */
+ void * buf; /* contents of dataset */
+ const char * dset_name; /* dataset name, always added to root group */
+ hid_t mem_type_id; /* datatype */
+ const hsize_t *dims; /* dimensions */
+ int n_dims; /* rank */
};
-static int splitter_prepare_file_paths(H5FD_splitter_vfd_config_t *vfd_config,
- char *filename_rw_out);
+static int splitter_prepare_file_paths(H5FD_splitter_vfd_config_t *vfd_config, char *filename_rw_out);
static int splitter_create_single_file_at(const char *filename, hid_t fapl_id,
- const struct splitter_dataset_def *data);
-static int splitter_compare_expected_data(hid_t file_id,
- const struct splitter_dataset_def *data);
-static int run_splitter_test(const struct splitter_dataset_def *data,
- hbool_t ignore_wo_errors, hbool_t provide_logfile_path,
- hid_t sub_fapl_ids[2]);
-static int splitter_RO_test(const struct splitter_dataset_def *data,
- hid_t child_fapl_id);
+ const struct splitter_dataset_def *data);
+static int splitter_compare_expected_data(hid_t file_id, const struct splitter_dataset_def *data);
+static int run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_errors,
+ hbool_t provide_logfile_path, hid_t sub_fapl_ids[2]);
+static int splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id);
static int splitter_tentative_open_test(hid_t child_fapl_id);
static int file_exists(const char *filename, hid_t fapl_id);
@@ -127,21 +120,21 @@ static int file_exists(const char *filename, hid_t fapl_id);
static herr_t
test_sec2(void)
{
- hid_t fid = -1; /* file ID */
- hid_t fapl_id = -1; /* file access property list ID */
- hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- char filename[1024]; /* filename */
- void *os_file_handle = NULL; /* OS file handle */
- hsize_t file_size; /* file size */
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024]; /* filename */
+ void * os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
TESTING("SEC2 file driver");
/* Set property list and file name for SEC2 driver. */
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_sec2(fapl_id) < 0)
+ if (H5Pset_fapl_sec2(fapl_id) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
@@ -150,79 +143,82 @@ test_sec2(void)
TEST_ERROR
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
+ TEST_ERROR
/* Check for extra flags not accounted for above */
- if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
- | H5FD_FEAT_ACCUMULATE_METADATA
- | H5FD_FEAT_DATA_SIEVE
- | H5FD_FEAT_AGGREGATE_SMALLDATA
- | H5FD_FEAT_POSIX_COMPAT_HANDLE
- | H5FD_FEAT_SUPPORTS_SWMR_IO
- | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE |
+ H5FD_FEAT_SUPPORTS_SWMR_IO | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
TEST_ERROR
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((fapl_id_out = H5Fget_access_plist(fid)) < 0)
+ if ((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_SEC2 != H5Pget_driver(fapl_id_out))
+ if (H5FD_SEC2 != H5Pget_driver(fapl_id_out))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(fapl_id_out) < 0)
+ if (H5Pclose(fapl_id_out) < 0)
TEST_ERROR;
/* Check that we can get an operating-system-specific handle from
* the library.
*/
- if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
+ if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
TEST_ERROR;
- if(os_file_handle == NULL)
+ if (os_file_handle == NULL)
FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
-
/* There is no garantee the size of metadata in file is constant.
* Just try to check if it's reasonable.
*
* Currently it should be around 2 KB.
*/
- if(H5Fget_filesize(fid, &file_size) < 0)
+ if (H5Fget_filesize(fid, &file_size) < 0)
TEST_ERROR;
- if(file_size < 1 * KB || file_size > 4 * KB)
+ if (file_size < 1 * KB || file_size > 4 * KB)
FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
/* Close and delete the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[0], fapl_id);
/* Close the fapl */
- if(H5Pclose(fapl_id) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_id);
H5Pclose(fapl_id_out);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_sec2() */
-
/*-------------------------------------------------------------------------
* Function: test_core
*
@@ -239,33 +235,33 @@ error:
static herr_t
test_core(void)
{
- hid_t fid = -1; /* file ID */
- hid_t fapl_id = -1; /* file access property list ID */
- hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
- hid_t driver_id = -1; /* ID for this VFD */
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ hid_t driver_id = -1; /* ID for this VFD */
unsigned long driver_flags = 0; /* VFD feature flags */
- hid_t did = -1; /* dataset ID */
- hid_t sid = -1; /* dataspace ID */
- char filename[1024]; /* filename */
- void *os_file_handle = NULL; /* OS file handle */
- hsize_t file_size; /* file size */
- size_t increment; /* core VFD increment */
- hbool_t backing_store; /* use backing store? */
- hbool_t use_write_tracking; /* write tracking flag */
- size_t write_tracking_page_size; /* write tracking page size */
- int *data_w = NULL; /* data written to the dataset */
- int *data_r = NULL; /* data read from the dataset */
- int val; /* data value */
- int *pw = NULL, *pr = NULL; /* pointers for iterating over
+ hid_t did = -1; /* dataset ID */
+ hid_t sid = -1; /* dataspace ID */
+ char filename[1024]; /* filename */
+ void * os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
+ size_t increment; /* core VFD increment */
+ hbool_t backing_store; /* use backing store? */
+ hbool_t use_write_tracking; /* write tracking flag */
+ size_t write_tracking_page_size; /* write tracking page size */
+ int * data_w = NULL; /* data written to the dataset */
+ int * data_r = NULL; /* data read from the dataset */
+ int val; /* data value */
+ int * pw = NULL, *pr = NULL; /* pointers for iterating over
data arrays (write & read) */
- hsize_t dims[2]; /* dataspace dimensions */
- int i, j; /* iterators */
- htri_t status; /* return value from H5Lexists */
+ hsize_t dims[2]; /* dataspace dimensions */
+ int i, j; /* iterators */
+ htri_t status; /* return value from H5Lexists */
TESTING("CORE file driver");
/* Get a file access property list and fix up the file name */
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
@@ -275,12 +271,12 @@ test_core(void)
************************************************************************/
/* Make sure it's not present at the start of the test */
- if(HDaccess(filename, F_OK) != -1)
- if(HDremove(filename) < 0)
+ if (HDaccess(filename, F_OK) != -1)
+ if (HDremove(filename) < 0)
FAIL_PUTS_ERROR("unable to remove backing store file");
/* Create and close file w/ backing store off */
- if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
+ if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
TEST_ERROR;
/* Check that the VFD feature flags are correct.
@@ -291,27 +287,30 @@ test_core(void)
TEST_ERROR
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS)) TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS))
+ TEST_ERROR
/* Check for extra flags not accounted for above */
- if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
- | H5FD_FEAT_ACCUMULATE_METADATA
- | H5FD_FEAT_DATA_SIEVE
- | H5FD_FEAT_AGGREGATE_SMALLDATA
- | H5FD_FEAT_ALLOW_FILE_IMAGE
- | H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS))
+ if (driver_flags !=
+ (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_ALLOW_FILE_IMAGE | H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS))
TEST_ERROR
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
/* Check for the backing store file */
- if(HDaccess(filename, F_OK) != -1)
+ if (HDaccess(filename, F_OK) != -1)
FAIL_PUTS_ERROR("file created when backing store set to FALSE");
/************************************************************************
@@ -320,43 +319,43 @@ test_core(void)
************************************************************************/
/* Turn the backing store on */
- if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
+ if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
TEST_ERROR;
/* Check that write tracking is off by default and that the default
* page size is non-zero.
*/
- if(H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
+ if (H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
TEST_ERROR;
- if(FALSE != use_write_tracking)
+ if (FALSE != use_write_tracking)
FAIL_PUTS_ERROR("write tracking should be off by default");
- if(0 == write_tracking_page_size)
+ if (0 == write_tracking_page_size)
FAIL_PUTS_ERROR("write tracking page size should never be zero");
/* Set core VFD properties */
- if(H5Pset_core_write_tracking(fapl_id, TRUE, CORE_PAGE_SIZE) < 0)
+ if (H5Pset_core_write_tracking(fapl_id, TRUE, CORE_PAGE_SIZE) < 0)
TEST_ERROR;
/* Create the file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((fapl_id_out = H5Fget_access_plist(fid)) < 0)
+ if ((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_CORE != H5Pget_driver(fapl_id_out))
+ if (H5FD_CORE != H5Pget_driver(fapl_id_out))
TEST_ERROR;
/* Get the basic VFD properties from the fapl and ensure that
* they are correct.
*/
- if(H5Pget_fapl_core(fapl_id_out, &increment, &backing_store) < 0)
+ if (H5Pget_fapl_core(fapl_id_out, &increment, &backing_store) < 0)
TEST_ERROR
- if(increment != (size_t)CORE_INCREMENT)
+ if (increment != (size_t)CORE_INCREMENT)
FAIL_PUTS_ERROR("incorrect increment from file fapl");
- if(backing_store != TRUE)
+ if (backing_store != TRUE)
FAIL_PUTS_ERROR("incorrect backing store flag from file fapl");
/* Check that the backing store write tracking info was saved */
@@ -364,23 +363,23 @@ test_core(void)
* the write tracking properties. Until this bug is fixed, just
* test the main fapl_id.
*/
- if(H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
+ if (H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
TEST_ERROR;
- if(TRUE != use_write_tracking)
+ if (TRUE != use_write_tracking)
FAIL_PUTS_ERROR("write tracking flag incorrect in fapl obtained from H5Fget_access_plist");
- if(CORE_PAGE_SIZE != write_tracking_page_size)
+ if (CORE_PAGE_SIZE != write_tracking_page_size)
FAIL_PUTS_ERROR("write tracking page size incorrect in fapl obtained from H5Fget_access_plist");
/* Close the property list */
- if(H5Pclose(fapl_id_out) < 0)
+ if (H5Pclose(fapl_id_out) < 0)
TEST_ERROR;
/* Check that we can get an operating-system-specific handle from
* the library.
*/
- if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
+ if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
TEST_ERROR;
- if(os_file_handle == NULL)
+ if (os_file_handle == NULL)
FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
/* There is no garantee the size of metadata in file is constant.
@@ -388,16 +387,15 @@ test_core(void)
*
* TODO: Needs justification of why is this is a reasonable size.
*/
- if(H5Fget_filesize(fid, &file_size) < 0)
+ if (H5Fget_filesize(fid, &file_size) < 0)
TEST_ERROR;
- if(file_size < 2 * KB || file_size > 6 * KB)
+ if (file_size < 2 * KB || file_size > 6 * KB)
FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
-
/************************************************************************
* Make changes to the file with the backing store flag OFF to ensure
* that they ARE NOT propagated.
@@ -406,55 +404,56 @@ test_core(void)
/* Open the file with backing store off for read and write.
* Changes won't be saved in file.
*/
- if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
+ if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
TEST_ERROR;
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
/* Allocate memory for data set. */
- if(NULL == (data_w = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if (NULL == (data_w = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
FAIL_PUTS_ERROR("unable to allocate memory for input array");
- if(NULL == (data_r = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if (NULL == (data_r = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
FAIL_PUTS_ERROR("unable to allocate memory for output array");
/* Initialize the buffers */
val = 0;
- pw = data_w;
- for(i = 0; i < CORE_DSET_DIM1; i++)
- for(j = 0; j < CORE_DSET_DIM2; j++)
+ pw = data_w;
+ for (i = 0; i < CORE_DSET_DIM1; i++)
+ for (j = 0; j < CORE_DSET_DIM2; j++)
*pw++ = val++;
HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
/* Create the dataspace */
dims[0] = CORE_DSET_DIM1;
dims[1] = CORE_DSET_DIM2;
- if((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
TEST_ERROR;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
TEST_ERROR;
/* Close and reopen the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
pw = data_w;
pr = data_r;
- for(i = 0; i < CORE_DSET_DIM1; i++)
- for(j = 0; j < CORE_DSET_DIM2; j++)
- if(*pr++ != *pw++) {
+ for (i = 0; i < CORE_DSET_DIM1; i++)
+ for (j = 0; j < CORE_DSET_DIM2; j++)
+ if (*pr++ != *pw++) {
H5_FAILED();
HDprintf(" Read different values than written in data set.\n");
HDprintf(" At index %d,%d\n", i, j);
@@ -462,25 +461,24 @@ test_core(void)
} /* end if */
/* Close everything except the dataspace ID (needed below)*/
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
/* Reopen the file and ensure that the dataset does not exist */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
status = H5Lexists(fid, CORE_DSET_NAME, H5P_DEFAULT);
- if(status < 0)
+ if (status < 0)
TEST_ERROR;
- if(status > 0)
+ if (status > 0)
FAIL_PUTS_ERROR("core VFD dataset created in file when backing store disabled");
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
-
/************************************************************************
* Make changes to the file with the backing store flag ON to ensure
* that they ARE propagated.
@@ -489,40 +487,41 @@ test_core(void)
/* Open the file with backing store on for read and write.
* Changes will be saved in file.
*/
- if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
+ if (H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
TEST_ERROR;
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
TEST_ERROR;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
TEST_ERROR;
/* Close everything and reopen */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- if((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from the dataset */
HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
pw = data_w;
pr = data_r;
- for(i = 0; i < CORE_DSET_DIM1; i++)
- for(j = 0; j < CORE_DSET_DIM2; j++)
- if(*pw++ != *pr++) {
+ for (i = 0; i < CORE_DSET_DIM1; i++)
+ for (j = 0; j < CORE_DSET_DIM2; j++)
+ if (*pw++ != *pr++) {
H5_FAILED();
HDprintf(" Read different values than written in data set.\n");
HDprintf(" At index %d,%d\n", i, j);
@@ -535,50 +534,51 @@ test_core(void)
*
* TODO: Needs justification of why is this is a reasonable size.
*/
- if(H5Fget_filesize(fid, &file_size) < 0)
+ if (H5Fget_filesize(fid, &file_size) < 0)
TEST_ERROR;
- if(file_size < 64 * KB || file_size > 256 * KB)
+ if (file_size < 64 * KB || file_size > 256 * KB)
FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
/* Close everything */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
TEST_ERROR;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
TEST_ERROR;
HDfree(data_w);
HDfree(data_r);
/* Close and delete the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[1], fapl_id);
/* Close the fapl */
- if(H5Pclose(fapl_id) < 0)
+ if (H5Pclose(fapl_id) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did);
H5Pclose(fapl_id_out);
H5Pclose(fapl_id);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(data_w)
+ if (data_w)
HDfree(data_w);
- if(data_r)
+ if (data_r)
HDfree(data_r);
return -1;
} /* end test_core() */
-
/*-------------------------------------------------------------------------
* Function: test_direct
*
@@ -596,20 +596,20 @@ static herr_t
test_direct(void)
{
#ifdef H5_HAVE_DIRECT
- hid_t file=-1, fapl=-1, access_fapl = -1;
- hid_t dset1=-1, dset2=-1, space1=-1, space2=-1;
- char filename[1024];
- int *fhandle=NULL;
- hsize_t file_size;
- hsize_t dims1[2], dims2[1];
+ hid_t file = -1, fapl = -1, access_fapl = -1;
+ hid_t dset1 = -1, dset2 = -1, space1 = -1, space2 = -1;
+ char filename[1024];
+ int * fhandle = NULL;
+ hsize_t file_size;
+ hsize_t dims1[2], dims2[1];
size_t mbound;
size_t fbsize;
size_t cbsize;
- void *proto_points = NULL, *proto_check = NULL;
- int *points = NULL, *check = NULL, *p1 = NULL, *p2 = NULL;
- int wdata2[DSET2_DIM] = {11,12,13,14};
- int rdata2[DSET2_DIM];
- int i, j, n;
+ void * proto_points = NULL, *proto_check = NULL;
+ int * points = NULL, *check = NULL, *p1 = NULL, *p2 = NULL;
+ int wdata2[DSET2_DIM] = {11, 12, 13, 14};
+ int rdata2[DSET2_DIM];
+ int i, j, n;
#endif /*H5_HAVE_DIRECT*/
TESTING("DIRECT I/O file driver");
@@ -617,30 +617,29 @@ test_direct(void)
#ifndef H5_HAVE_DIRECT
SKIPPED();
return 0;
-#else /*H5_HAVE_DIRECT*/
+#else /*H5_HAVE_DIRECT*/
/* Set property list and file name for Direct driver. Set memory alignment boundary
* and file block size to 512 which is the minimum for Linux 2.6. */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
+ if (H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
/* Verify the file access properties */
- if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0)
+ if (H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0)
TEST_ERROR;
- if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE)
+ if (mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE)
TEST_ERROR;
- if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0)
+ if (H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- } H5E_END_TRY;
- if(file<0) {
- H5Pclose (fapl);
+ H5E_BEGIN_TRY { file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); }
+ H5E_END_TRY;
+ if (file < 0) {
+ H5Pclose(fapl);
SKIPPED();
HDprintf(" Probably the file system doesn't support Direct I/O\n");
return 0;
@@ -651,7 +650,7 @@ test_direct(void)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_DIRECT != H5Pget_driver(access_fapl))
+ if (H5FD_DIRECT != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
@@ -659,149 +658,152 @@ test_direct(void)
TEST_ERROR;
/* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
TEST_ERROR;
- if(*fhandle<0)
+ if (*fhandle < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* There is no guarantee of the number of metadata allocations, but it's
* 4 currently and the size of the file should be between 3 & 4 file buffer
* sizes..
*/
- if(file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4))
+ if (file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4))
TEST_ERROR;
/* Allocate aligned memory for data set 1. For data set 1, everything is aligned including
* memory address, size of data, and file address. */
- if(0 != HDposix_memalign(&proto_points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if (0 != HDposix_memalign(&proto_points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
points = proto_points;
- if(0 != HDposix_memalign(&proto_check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if (0 != HDposix_memalign(&proto_check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
check = proto_check;
/* Initialize the dset1 */
p1 = points;
- for(i = n = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
+ for (i = n = 0; i < DSET1_DIM1; i++)
+ for (j = 0; j < DSET1_DIM2; j++)
*p1++ = n++;
/* Create the data space1 */
dims1[0] = DSET1_DIM1;
dims1[1] = DSET1_DIM2;
- if((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
+ if ((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
TEST_ERROR;
/* Create the dset1 */
- if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset1 =
+ H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
- if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ if (H5Dclose(dset1) < 0)
TEST_ERROR;
- if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if ((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
+ if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
p1 = points;
p2 = check;
- for(i = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- if(*p1++ != *p2++) {
+ for (i = 0; i < DSET1_DIM1; i++)
+ for (j = 0; j < DSET1_DIM2; j++)
+ if (*p1++ != *p2++) {
H5_FAILED();
HDprintf(" Read different values than written in data set 1.\n");
HDprintf(" At index %d,%d\n", i, j);
TEST_ERROR;
- } /* end if */
+ } /* end if */
/* Create the data space2. For data set 2, memory address and data size are not aligned. */
dims2[0] = DSET2_DIM;
- if((space2 = H5Screate_simple(1, dims2, NULL)) < 0)
+ if ((space2 = H5Screate_simple(1, dims2, NULL)) < 0)
TEST_ERROR;
/* Create the dset2 */
- if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset2 =
+ H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
- if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0)
+ if (H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0)
TEST_ERROR;
- if(H5Dclose(dset2) < 0)
+ if (H5Dclose(dset2) < 0)
TEST_ERROR;
- if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0)
+ if ((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0)
+ if (H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i = 0; i < DSET2_DIM; i++)
- if(wdata2[i] != rdata2[i]) {
+ for (i = 0; i < DSET2_DIM; i++)
+ if (wdata2[i] != rdata2[i]) {
H5_FAILED();
HDprintf(" Read different values than written in data set 2.\n");
HDprintf(" At index %d\n", i);
TEST_ERROR;
} /* end if */
- if(H5Sclose(space1) < 0)
+ if (H5Sclose(space1) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ if (H5Dclose(dset1) < 0)
TEST_ERROR;
- if(H5Sclose(space2) < 0)
+ if (H5Sclose(space2) < 0)
TEST_ERROR;
- if(H5Dclose(dset2) < 0)
+ if (H5Dclose(dset2) < 0)
TEST_ERROR;
HDfree(points);
HDfree(check);
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[5], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Sclose(space1);
H5Dclose(dset1);
H5Sclose(space2);
H5Dclose(dset2);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(proto_points)
+ if (proto_points)
HDfree(proto_points);
- if(proto_check)
+ if (proto_check)
HDfree(proto_check);
return -1;
#endif /*H5_HAVE_DIRECT*/
}
-
/*-------------------------------------------------------------------------
* Function: test_family_opens
*
@@ -826,52 +828,48 @@ H5_GCC_DIAG_OFF("format-nonliteral")
static herr_t
test_family_opens(char *fname, hid_t fa_pl)
{
- hid_t file=-1;
- char first_name[1024];
- char wrong_name[1024];
- int i;
+ hid_t file = -1;
+ char first_name[1024];
+ char wrong_name[1024];
+ int i;
/* Case 1: reopen file with 1st member file name and default property list */
HDsnprintf(first_name, sizeof(first_name), fname, 0);
- H5E_BEGIN_TRY {
- file = H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
- if(file >= 0)
+ H5E_BEGIN_TRY { file = H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (file >= 0)
TEST_ERROR
/* Case 2: reopen file with correct name template but default property list */
- H5E_BEGIN_TRY {
- file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
- if(file >= 0)
+ H5E_BEGIN_TRY { file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (file >= 0)
TEST_ERROR
/* Case 3: reopen file with wrong member size */
- if(H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- file = H5Fopen(fname, H5F_ACC_RDWR, fa_pl);
- } H5E_END_TRY;
- if(file >= 0)
+ H5E_BEGIN_TRY { file = H5Fopen(fname, H5F_ACC_RDWR, fa_pl); }
+ H5E_END_TRY;
+ if (file >= 0)
TEST_ERROR
/* Case 4: reopen file with wrong name template */
HDstrcpy(wrong_name, fname);
- for(i = 0; i < 1024; i++)
- if(wrong_name[i] == '5') {
+ for (i = 0; i < 1024; i++)
+ if (wrong_name[i] == '5') {
wrong_name[i] = '4';
break;
}
- if(H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- file = H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl);
- } H5E_END_TRY;
- if(file >= 0)
+ H5E_BEGIN_TRY { file = H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); }
+ H5E_END_TRY;
+ if (file >= 0)
TEST_ERROR
return 0;
@@ -881,7 +879,6 @@ error:
} /* end test_family_opens() */
H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: test_family
*
@@ -897,33 +894,33 @@ H5_GCC_DIAG_ON("format-nonliteral")
static herr_t
test_family(void)
{
- hid_t file=-1, fapl=-1, fapl2=-1, space=-1, dset=-1;
- hid_t access_fapl = -1;
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- char filename[1024];
- char dname[] = "dataset";
- unsigned int i, j;
- int *fhandle=NULL, *fhandle2=NULL;
- int **buf = NULL;
- int *buf_data = NULL;
- hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
- hsize_t file_size;
+ hid_t file = -1, fapl = -1, fapl2 = -1, space = -1, dset = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ char dname[] = "dataset";
+ unsigned int i, j;
+ int * fhandle = NULL, *fhandle2 = NULL;
+ int ** buf = NULL;
+ int * buf_data = NULL;
+ hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
+ hsize_t file_size;
TESTING("FAMILY file driver");
/* Set up data array */
- if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int))))
+ if (NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int))))
TEST_ERROR;
- if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data))))
+ if (NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data))))
TEST_ERROR;
for (i = 0; i < FAMILY_NUMBER; i++)
buf[i] = buf_data + (i * FAMILY_SIZE);
/* Set property list and file name for FAMILY driver */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
@@ -932,45 +929,47 @@ test_family(void)
TEST_ERROR
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
/* Check for extra flags not accounted for above */
- if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
- | H5FD_FEAT_ACCUMULATE_METADATA
- | H5FD_FEAT_DATA_SIEVE
- | H5FD_FEAT_AGGREGATE_SMALLDATA))
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA))
TEST_ERROR
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Test different wrong ways to reopen family files where there's only
* one member file existing. */
- if(test_family_opens(filename, fapl) < 0)
+ if (test_family_opens(filename, fapl) < 0)
TEST_ERROR;
/* Reopen the file with default member file size */
- if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR;
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* The file size is supposed to be about 800 bytes right now. */
- if(file_size < (KB / 2) || file_size > KB)
+ if (file_size < (KB / 2) || file_size > KB)
TEST_ERROR;
/* Create and write dataset */
- if((space = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@@ -978,83 +977,83 @@ test_family(void)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_FAMILY != H5Pget_driver(access_fapl))
+ if (H5FD_FAMILY != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
- if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- for(i = 0; i < FAMILY_NUMBER; i++)
- for(j = 0; j < FAMILY_SIZE; j++)
+ for (i = 0; i < FAMILY_NUMBER; i++)
+ for (j = 0; j < FAMILY_SIZE; j++)
buf[i][j] = (int)((i * 10000) + j);
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR;
/* check file handle API */
- if((fapl2 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl2 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_family_offset(fapl2, (hsize_t)0) < 0)
+ if (H5Pset_family_offset(fapl2, (hsize_t)0) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
TEST_ERROR;
- if(*fhandle < 0)
+ if (*fhandle < 0)
TEST_ERROR;
- if(H5Pset_family_offset(fapl2, (hsize_t)(FAMILY_SIZE*2)) < 0)
+ if (H5Pset_family_offset(fapl2, (hsize_t)(FAMILY_SIZE * 2)) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
+ if (H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
TEST_ERROR;
- if(*fhandle2 < 0)
+ if (*fhandle2 < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
- /* Some data has been written. The file size should be bigger (18KB+976)
- * bytes if int size is 4 bytes) now. */
+ /* Some data has been written. The file size should be bigger (18KB+976)
+ * bytes if int size is 4 bytes) now. */
#if H5_SIZEOF_INT <= 4
- if(file_size < (18 * KB) || file_size > (20 * KB))
+ if (file_size < (18 * KB) || file_size > (20 * KB))
TEST_ERROR;
#elif H5_SIZEOF_INT >= 8
- if(file_size < (32 * KB) || file_size > (40 * KB))
+ if (file_size < (32 * KB) || file_size > (40 * KB))
TEST_ERROR;
#endif
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Test different wrong ways to reopen family files when there're multiple
* member files existing. */
- if(test_family_opens(filename, fapl) < 0)
+ if (test_family_opens(filename, fapl) < 0)
TEST_ERROR;
/* Reopen the file with correct member file size. */
- if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[2], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
HDfree(buf);
@@ -1064,13 +1063,15 @@ test_family(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dset);
H5Pclose(fapl);
H5Pclose(fapl2);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
HDfree(buf_data);
@@ -1078,7 +1079,6 @@ error:
return FAIL;
} /* end test_family() */
-
/*-------------------------------------------------------------------------
* Function: test_family_compat
*
@@ -1107,20 +1107,20 @@ H5_GCC_DIAG_OFF("format-nonliteral")
static herr_t
test_family_compat(void)
{
- hid_t file = -1, fapl = -1;
- hid_t dset = -1;
- char dname[]="dataset";
- char filename[1024];
- char pathname[1024], pathname_individual[1024];
- char newname[1024], newname_individual[1024];
- int counter = 0;
+ hid_t file = -1, fapl = -1;
+ hid_t dset = -1;
+ char dname[] = "dataset";
+ char filename[1024];
+ char pathname[1024], pathname_individual[1024];
+ char newname[1024], newname_individual[1024];
+ int counter = 0;
TESTING("FAMILY file driver backward compatibility");
/* Set property list and file name for FAMILY driver */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
TEST_ERROR;
h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof(filename));
@@ -1136,7 +1136,7 @@ test_family_compat(void)
HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter);
HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter);
- while(h5_make_local_copy(pathname_individual, newname_individual) >= 0) {
+ while (h5_make_local_copy(pathname_individual, newname_individual) >= 0) {
counter++;
HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter);
HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter);
@@ -1144,35 +1144,35 @@ test_family_compat(void)
/* Make sure we can open the file. Use the read and write mode to flush the
* superblock. */
- if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Open the file again to make sure it isn't corrupted. */
- if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[3], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
@@ -1180,16 +1180,17 @@ test_family_compat(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file);
H5Pclose(fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_family_compat() */
H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: test_family_member_fapl
*
@@ -1205,33 +1206,33 @@ H5_GCC_DIAG_ON("format-nonliteral")
static herr_t
test_family_member_fapl(void)
{
- hid_t file = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t memb_fapl_id = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t dset = H5I_INVALID_HID;
+ hid_t file = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t memb_fapl_id = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
char filename[1024];
- char dname[] = "dataset";
- unsigned i = 0;
- unsigned j = 0;
- int **buf = NULL;
- int *buf_data = NULL;
- hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
+ char dname[] = "dataset";
+ unsigned i = 0;
+ unsigned j = 0;
+ int ** buf = NULL;
+ int * buf_data = NULL;
+ hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
TESTING("Family member FAPL");
/* Set up data array */
- if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int))))
+ if (NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int))))
TEST_ERROR;
- if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data))))
+ if (NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data))))
TEST_ERROR;
for (i = 0; i < FAMILY_NUMBER; i++)
buf[i] = buf_data + (i * FAMILY_SIZE);
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID)
TEST_ERROR;
- if((memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID)
+ if ((memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID)
TEST_ERROR;
if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL)
@@ -1241,15 +1242,16 @@ test_family_member_fapl(void)
h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID)
TEST_ERROR;
- if((space = H5Screate_simple(2, dims, NULL)) == H5I_INVALID_HID)
+ if ((space = H5Screate_simple(2, dims, NULL)) == H5I_INVALID_HID)
TEST_ERROR;
/* Create and write to dataset, then close file.
*/
- if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID)
+ if ((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) ==
+ H5I_INVALID_HID)
TEST_ERROR;
for (i = 0; i < FAMILY_NUMBER; i++) {
@@ -1292,13 +1294,15 @@ test_family_member_fapl(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dset);
H5Pclose(memb_fapl_id);
H5Pclose(fapl_id);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
HDfree(buf_data);
@@ -1306,7 +1310,6 @@ error:
return FAIL;
} /* end test_family_member_fapl() */
-
/*-------------------------------------------------------------------------
* Function: test_multi_opens
*
@@ -1331,22 +1334,20 @@ static herr_t
test_multi_opens(char *fname)
{
hid_t fid = H5I_INVALID_HID;
- char super_name[1024]; /*name string "%%s-s.h5"*/
- char sf_name[1024]; /*name string "multi_file-s.h5"*/
+ char super_name[1024]; /*name string "%%s-s.h5"*/
+ char sf_name[1024]; /*name string "multi_file-s.h5"*/
/* Case: reopen with the name of super file and default property list */
HDsnprintf(super_name, sizeof(super_name), "%%s-%c.h5", 's');
HDsnprintf(sf_name, sizeof(sf_name), super_name, fname);
- H5E_BEGIN_TRY {
- fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
- return(fid >= 0 ? FAIL : SUCCEED);
+ return (fid >= 0 ? FAIL : SUCCEED);
} /* end test_multi_opens() */
H5_GCC_DIAG_ON("format-nonliteral")
-
/*-------------------------------------------------------------------------
* Function: test_multi
*
@@ -1362,52 +1363,52 @@ H5_GCC_DIAG_ON("format-nonliteral")
static herr_t
test_multi(void)
{
- hid_t file=-1, fapl=-1, fapl2=-1, dset=-1, space=-1;
- hid_t root=-1, attr=-1, aspace=-1, atype=-1;
- hid_t access_fapl = -1;
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- char filename[1024];
- int *fhandle2=NULL, *fhandle=NULL;
- hsize_t file_size;
- H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- const char *memb_name[H5FD_MEM_NTYPES];
- char sv[H5FD_MEM_NTYPES][32];
- hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE};
- hsize_t adims[1]={1};
- char dname[]="dataset";
- char meta[] = "this is some metadata on this file";
- int i, j;
- int **buf = NULL;
- int *buf_data = NULL;
+ hid_t file = -1, fapl = -1, fapl2 = -1, dset = -1, space = -1;
+ hid_t root = -1, attr = -1, aspace = -1, atype = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ int * fhandle2 = NULL, *fhandle = NULL;
+ hsize_t file_size;
+ H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ const char * memb_name[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][32];
+ hsize_t dims[2] = {MULTI_SIZE, MULTI_SIZE};
+ hsize_t adims[1] = {1};
+ char dname[] = "dataset";
+ char meta[] = "this is some metadata on this file";
+ int i, j;
+ int ** buf = NULL;
+ int * buf_data = NULL;
TESTING("MULTI file driver");
/* Set up data array */
- if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int))))
+ if (NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int))))
TEST_ERROR;
- if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data))))
+ if (NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data))))
TEST_ERROR;
for (i = 0; i < MULTI_SIZE; i++)
buf[i] = buf_data + (i * MULTI_SIZE);
/* Set file access property list for MULTI driver */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- HDmemset(memb_map, 0, sizeof(memb_map));
+ HDmemset(memb_map, 0, sizeof(memb_map));
HDmemset(memb_fapl, 0, sizeof(memb_fapl));
HDmemset(memb_name, 0, sizeof(memb_name));
HDmemset(memb_addr, 0, sizeof(memb_addr));
HDmemset(sv, 0, sizeof(sv));
- for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt++) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
memb_fapl[mt] = H5P_DEFAULT;
- memb_map[mt] = H5FD_MEM_SUPER;
+ memb_map[mt] = H5FD_MEM_SUPER;
}
- memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
+ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE;
memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP;
@@ -1415,20 +1416,19 @@ test_multi(void)
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
- HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
+ HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
- memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/4;
+ memb_addr[H5FD_MEM_BTREE] = HADDR_MAX / 4;
HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
- memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
+ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2;
HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g');
memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP];
- memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3;
-
+ memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX / 4) * 3;
- if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
@@ -1437,34 +1437,35 @@ test_multi(void)
TEST_ERROR
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_USE_ALLOC_SIZE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_PAGED_AGGR)) TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_USE_ALLOC_SIZE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_PAGED_AGGR))
+ TEST_ERROR
/* Check for extra flags not accounted for above */
- if(driver_flags != (H5FD_FEAT_DATA_SIEVE
- | H5FD_FEAT_AGGREGATE_SMALLDATA
- | H5FD_FEAT_USE_ALLOC_SIZE
- | H5FD_FEAT_PAGED_AGGR))
+ if (driver_flags != (H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_USE_ALLOC_SIZE |
+ H5FD_FEAT_PAGED_AGGR))
TEST_ERROR
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
-
/* Test wrong ways to reopen multi files */
- if(test_multi_opens(filename) < 0)
+ if (test_multi_opens(filename) < 0)
TEST_ERROR;
/* Reopen the file */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Create and write data set */
- if((space = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@@ -1472,7 +1473,7 @@ test_multi(void)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_MULTI != H5Pget_driver(access_fapl))
+ if (H5FD_MULTI != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
@@ -1480,97 +1481,97 @@ test_multi(void)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* Before any data is written, the raw data file is empty. So
* the file size is only the size of b-tree + HADDR_MAX/4.
*/
- if(file_size < HADDR_MAX/4 || file_size > HADDR_MAX/2)
+ if (file_size < HADDR_MAX / 4 || file_size > HADDR_MAX / 2)
TEST_ERROR;
- if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- for(i=0; i<MULTI_SIZE; i++)
- for(j=0; j<MULTI_SIZE; j++)
- buf[i][j] = i*10000+j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
+ for (i = 0; i < MULTI_SIZE; i++)
+ for (j = 0; j < MULTI_SIZE; j++)
+ buf[i][j] = i * 10000 + j;
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR;
- if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl2 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_multi_type(fapl2, H5FD_MEM_SUPER) < 0)
+ if (H5Pset_multi_type(fapl2, H5FD_MEM_SUPER) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
TEST_ERROR;
- if(*fhandle<0)
+ if (*fhandle < 0)
TEST_ERROR;
- if(H5Pset_multi_type(fapl2, H5FD_MEM_DRAW) < 0)
+ if (H5Pset_multi_type(fapl2, H5FD_MEM_DRAW) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
+ if (H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
TEST_ERROR;
- if(*fhandle2<0)
+ if (*fhandle2 < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* After the data is written, the file size is huge because the
* beginning of raw data file is set at HADDR_MAX/2. It's supposed
* to be (HADDR_MAX/2 + 128*128*4)
*/
- if(file_size < HADDR_MAX/2 || file_size > HADDR_MAX)
+ if (file_size < HADDR_MAX / 2 || file_size > HADDR_MAX)
TEST_ERROR;
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
TEST_ERROR;
/* Create and write attribute for the root group. */
- if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0)
+ if ((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Attribute string. */
- if((atype = H5Tcopy(H5T_C_S1)) < 0)
+ if ((atype = H5Tcopy(H5T_C_S1)) < 0)
TEST_ERROR;
- if(H5Tset_size(atype, HDstrlen(meta) + 1) < 0)
+ if (H5Tset_size(atype, HDstrlen(meta) + 1) < 0)
TEST_ERROR;
- if(H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0)
+ if (H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0)
TEST_ERROR;
/* Create and write attribute */
- if((aspace = H5Screate_simple(1, adims, NULL)) < 0)
+ if ((aspace = H5Screate_simple(1, adims, NULL)) < 0)
TEST_ERROR;
- if((attr = H5Acreate2(root, "Metadata", atype, aspace, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr = H5Acreate2(root, "Metadata", atype, aspace, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Awrite(attr, atype, meta) < 0)
+ if (H5Awrite(attr, atype, meta) < 0)
TEST_ERROR;
/* Close IDs */
- if(H5Tclose(atype) < 0)
+ if (H5Tclose(atype) < 0)
TEST_ERROR;
- if(H5Sclose(aspace) < 0)
+ if (H5Sclose(aspace) < 0)
TEST_ERROR;
- if(H5Aclose(attr) < 0)
+ if (H5Aclose(attr) < 0)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[4], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
HDfree(buf);
@@ -1581,14 +1582,16 @@ test_multi(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dset);
H5Pclose(fapl);
H5Pclose(fapl2);
H5Fclose(file);
H5Aclose(attr);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
HDfree(buf_data);
@@ -1596,7 +1599,6 @@ error:
return FAIL;
} /* end test_multi() */
-
/*-------------------------------------------------------------------------
* Function: test_multi_compat
*
@@ -1620,41 +1622,41 @@ error:
static herr_t
test_multi_compat(void)
{
- hid_t file=-1, fapl=-1, dset=-1, space=-1;
+ hid_t file = -1, fapl = -1, dset = -1, space = -1;
char newname[1024];
char filename_s[1024], newname_s[1024];
char filename_r[1024], newname_r[1024];
H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
haddr_t memb_addr[H5FD_MEM_NTYPES];
- const char *memb_name[H5FD_MEM_NTYPES];
+ const char *memb_name[H5FD_MEM_NTYPES];
char sv[H5FD_MEM_NTYPES][32];
- hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE};
+ hsize_t dims[2] = {MULTI_SIZE, MULTI_SIZE};
int i, j;
- int **buf = NULL;
- int *buf_data = NULL;
+ int ** buf = NULL;
+ int * buf_data = NULL;
TESTING("MULTI file driver backward compatibility");
/* Set up data array */
- if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int))))
+ if (NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int))))
TEST_ERROR;
- if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data))))
+ if (NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data))))
TEST_ERROR;
for (i = 0; i < MULTI_SIZE; i++)
buf[i] = buf_data + (i * MULTI_SIZE);
/* Set file access property list for MULTI driver */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- HDmemset(memb_map, 0, sizeof memb_map);
+ HDmemset(memb_map, 0, sizeof memb_map);
HDmemset(memb_fapl, 0, sizeof memb_fapl);
HDmemset(memb_name, 0, sizeof memb_name);
HDmemset(memb_addr, 0, sizeof memb_addr);
HDmemset(sv, 0, sizeof sv);
- for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt++)
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
memb_map[mt] = H5FD_MEM_SUPER;
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
@@ -1666,9 +1668,9 @@ test_multi_compat(void)
memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
- memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
+ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2;
- if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE)<0)
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[9], fapl, newname, sizeof newname);
@@ -1687,82 +1689,83 @@ test_multi_compat(void)
/* Reopen the file for read only. Verify 1.8 library can open file
* created with 1.6 library.
*/
- if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Make sure we can reopen the file for read and write */
- if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Reopen the file for adding another dataset. The new EOA for metadata file
* should be written to the file */
- if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Create and write data set */
- if((space=H5Screate_simple(2, dims, NULL)) < 0)
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
- if((dset=H5Dcreate2(file, DSET3_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dcreate2(file, DSET3_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
TEST_ERROR;
- for(i=0; i<MULTI_SIZE; i++)
- for(j=0; j<MULTI_SIZE; j++)
- buf[i][j] = i*10000+j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
+ for (i = 0; i < MULTI_SIZE; i++)
+ for (j = 0; j < MULTI_SIZE; j++)
+ buf[i][j] = i * 10000 + j;
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if(H5Sclose(space) < 0)
+ if (H5Sclose(space) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
/* Reopen the file for read only again. Verify the library can handle
* the EOA correctly */
- if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((file = H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
- if((dset = H5Dopen2(file, DSET3_NAME, H5P_DEFAULT)) < 0)
+ if ((dset = H5Dopen2(file, DSET3_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dset) < 0)
+ if (H5Dclose(dset) < 0)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[9], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
HDfree(buf);
@@ -1773,12 +1776,14 @@ test_multi_compat(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(space);
H5Dclose(dset);
H5Pclose(fapl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
HDfree(buf_data);
@@ -1786,7 +1791,6 @@ error:
return FAIL;
} /* end test_multi_compat() */
-
/*-------------------------------------------------------------------------
* Function: test_log
*
@@ -1803,23 +1807,23 @@ error:
static herr_t
test_log(void)
{
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t access_fapl = -1;
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- char filename[1024];
- int *fhandle = NULL;
- hsize_t file_size = 0;
- unsigned int flags = H5FD_LOG_ALL;
- size_t buf_size = 4 * KB;
+ hid_t file = -1;
+ hid_t fapl = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ int * fhandle = NULL;
+ hsize_t file_size = 0;
+ unsigned int flags = H5FD_LOG_ALL;
+ size_t buf_size = 4 * KB;
TESTING("LOG file driver");
/* Set property list and file name for log driver. */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
+ if (H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
TEST_ERROR;
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
@@ -1828,76 +1832,80 @@ test_log(void)
TEST_ERROR
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
+ TEST_ERROR
/* Check for extra flags not accounted for above */
- if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
- | H5FD_FEAT_ACCUMULATE_METADATA
- | H5FD_FEAT_DATA_SIEVE
- | H5FD_FEAT_AGGREGATE_SMALLDATA
- | H5FD_FEAT_POSIX_COMPAT_HANDLE
- | H5FD_FEAT_SUPPORTS_SWMR_IO
- | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE |
+ H5FD_FEAT_SUPPORTS_SWMR_IO | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
TEST_ERROR
/* Create the test file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((access_fapl = H5Fget_access_plist(file)) < 0)
+ if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_LOG != H5Pget_driver(access_fapl))
+ if (H5FD_LOG != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(access_fapl) < 0)
+ if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
/* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
TEST_ERROR;
- if(*fhandle < 0)
+ if (*fhandle < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* There is no guarantee the size of metadata in file is constant.
* Just try to check if it's reasonable. It's 2KB right now.
*/
- if(file_size < 1 * KB || file_size > 4 * KB)
+ if (file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[6], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: test_stdio
*
@@ -1914,21 +1922,21 @@ error:
static herr_t
test_stdio(void)
{
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t access_fapl = -1;
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- char filename[1024];
- FILE *fhandle = NULL;
- hsize_t file_size = 0;
+ hid_t file = -1;
+ hid_t fapl = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ FILE * fhandle = NULL;
+ hsize_t file_size = 0;
TESTING("STDIO file driver");
/* Set property list and file name for STDIO driver. */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_stdio(fapl) < 0)
+ if (H5Pset_fapl_stdio(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[7], fapl, filename, sizeof filename);
@@ -1937,72 +1945,74 @@ test_stdio(void)
TEST_ERROR
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
+ TEST_ERROR
/* Check for extra flags not accounted for above */
- if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
- | H5FD_FEAT_ACCUMULATE_METADATA
- | H5FD_FEAT_DATA_SIEVE
- | H5FD_FEAT_AGGREGATE_SMALLDATA
- | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
TEST_ERROR
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((access_fapl = H5Fget_access_plist(file)) < 0)
+ if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_STDIO != H5Pget_driver(access_fapl))
+ if (H5FD_STDIO != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(access_fapl) < 0)
+ if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
/* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
TEST_ERROR;
- if(NULL == fhandle)
+ if (NULL == fhandle)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* There is no guarantee the size of metadata in file is constant.
* Just try to check if it's reasonable. It's 2KB right now.
*/
- if(file_size < 1 * KB || file_size > 4 * KB)
+ if (file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
/* Close and delete the file */
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[7], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
-
/*-------------------------------------------------------------------------
* Function: test_windows
*
@@ -2021,14 +2031,14 @@ test_windows(void)
{
#ifdef H5_HAVE_WINDOWS
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t access_fapl = -1;
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- char filename[1024];
- int *fhandle = NULL;
- hsize_t file_size = 0;
+ hid_t file = -1;
+ hid_t fapl = -1;
+ hid_t access_fapl = -1;
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024];
+ int * fhandle = NULL;
+ hsize_t file_size = 0;
#endif /*H5_HAVE_WINDOWS*/
@@ -2042,9 +2052,9 @@ test_windows(void)
#else /* H5_HAVE_WINDOWS */
/* Set property list and file name for WINDOWS driver. */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_windows(fapl) < 0)
+ if (H5Pset_fapl_windows(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
@@ -2053,77 +2063,81 @@ test_windows(void)
TEST_ERROR
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) TEST_ERROR
- if(!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO))
+ TEST_ERROR
+ if (!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
+ TEST_ERROR
/* Check for extra flags not accounted for above */
- if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
- | H5FD_FEAT_ACCUMULATE_METADATA
- | H5FD_FEAT_DATA_SIEVE
- | H5FD_FEAT_AGGREGATE_SMALLDATA
- | H5FD_FEAT_POSIX_COMPAT_HANDLE
- | H5FD_FEAT_SUPPORTS_SWMR_IO
- | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
+ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE |
+ H5FD_FEAT_SUPPORTS_SWMR_IO | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
TEST_ERROR
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((access_fapl = H5Fget_access_plist(file)) < 0)
+ if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_WINDOWS!= H5Pget_driver(access_fapl))
+ if (H5FD_WINDOWS != H5Pget_driver(access_fapl))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(access_fapl) < 0)
+ if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
/* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
+ if (H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
TEST_ERROR;
- if(*fhandle < 0)
+ if (*fhandle < 0)
TEST_ERROR;
/* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ if (H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* There is no guarantee the size of metadata in file is constant.
* Just try to check if it's reasonable. It's 2KB right now.
*/
- if(file_size < 1 * KB || file_size > 4 * KB)
+ if (file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
- /* Close and delete the file */
- if(H5Fclose(file) < 0)
+ /* Close and delete the file */
+ if (H5Fclose(file) < 0)
TEST_ERROR;
h5_delete_test_file(FILENAME[8], fapl);
/* Close the fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
#endif /* H5_HAVE_WINDOWS */
} /* end test_windows() */
-
/*-------------------------------------------------------------------------
* Function: test_ros3
*
@@ -2148,17 +2162,16 @@ static herr_t
test_ros3(void)
{
#ifdef H5_HAVE_ROS3_VFD
- hid_t fid = -1; /* file ID */
- hid_t fapl_id = -1; /* file access property list ID */
- hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- char filename[1024]; /* filename */
- void *os_file_handle = NULL; /* OS file handle */
- hsize_t file_size; /* file size */
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ char filename[1024]; /* filename */
+ void * os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
H5FD_ros3_fapl_t test_ros3_fa;
- H5FD_ros3_fapl_t ros3_fa_0 =
- {
+ H5FD_ros3_fapl_t ros3_fa_0 = {
/* version = */ H5FD_CURR_ROS3_FAPL_T_VERSION,
/* authenticate = */ FALSE,
/* aws_region = */ "",
@@ -2172,25 +2185,25 @@ test_ros3(void)
#ifndef H5_HAVE_ROS3_VFD
SKIPPED();
return 0;
-#else /* H5_HAVE_ROS3_VFD */
+#else /* H5_HAVE_ROS3_VFD */
/* Set property list and file name for ROS3 driver. */
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- if(H5Pset_fapl_ros3(fapl_id, &ros3_fa_0) < 0)
+ if (H5Pset_fapl_ros3(fapl_id, &ros3_fa_0) < 0)
TEST_ERROR;
/* verify that the ROS3 FAPL entry is set as expected */
- if(H5Pget_fapl_ros3(fapl_id, &test_ros3_fa) < 0)
+ if (H5Pget_fapl_ros3(fapl_id, &test_ros3_fa) < 0)
TEST_ERROR;
/* need a macro to compare instances of H5FD_ros3_fapl_t */
- if((test_ros3_fa.version != ros3_fa_0.version) ||
- (test_ros3_fa.authenticate != ros3_fa_0.authenticate) ||
- (strcmp(test_ros3_fa.aws_region, ros3_fa_0.aws_region) != 0) ||
- (strcmp(test_ros3_fa.secret_id, ros3_fa_0.secret_id) != 0) ||
- (strcmp(test_ros3_fa.secret_key, ros3_fa_0.secret_key) != 0))
+ if ((test_ros3_fa.version != ros3_fa_0.version) ||
+ (test_ros3_fa.authenticate != ros3_fa_0.authenticate) ||
+ (strcmp(test_ros3_fa.aws_region, ros3_fa_0.aws_region) != 0) ||
+ (strcmp(test_ros3_fa.secret_id, ros3_fa_0.secret_id) != 0) ||
+ (strcmp(test_ros3_fa.secret_key, ros3_fa_0.secret_key) != 0))
TEST_ERROR;
h5_fixname(FILENAME[10], fapl_id, filename, sizeof(filename));
@@ -2202,27 +2215,28 @@ test_ros3(void)
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
TEST_ERROR;
- if(!(driver_flags & H5FD_FEAT_DATA_SIEVE))
+ if (!(driver_flags & H5FD_FEAT_DATA_SIEVE))
TEST_ERROR
/* Check for extra flags not accounted for above */
- if(driver_flags != (H5FD_FEAT_DATA_SIEVE))
+ if (driver_flags != (H5FD_FEAT_DATA_SIEVE))
TEST_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_id);
H5Pclose(fapl_id_out);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
#endif /* H5_HAVE_ROS3_VFD */
} /* end test_ros3() */
-
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Macro: SPLITTER_TEST_FAULT()
*
@@ -2232,16 +2246,16 @@ error:
* * label `done` for exit on fault
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
-#define SPLITTER_TEST_FAULT(mesg) { \
- H5_FAILED(); \
- AT(); \
- HDfprintf(stderr, mesg); \
- H5Eprint2(H5E_DEFAULT, stderr); \
- fflush(stderr); \
- ret_value = -1; \
- goto done; \
-}
-
+#define SPLITTER_TEST_FAULT(mesg) \
+ { \
+ H5_FAILED(); \
+ AT(); \
+ HDfprintf(stderr, mesg); \
+ H5Eprint2(H5E_DEFAULT, stderr); \
+ fflush(stderr); \
+ ret_value = -1; \
+ goto done; \
+ }
/*-------------------------------------------------------------------------
* Function: compare_splitter_config_info
@@ -2257,14 +2271,14 @@ error:
static int
compare_splitter_config_info(hid_t fapl_id, H5FD_splitter_vfd_config_t *info)
{
- int ret_value = 0;
+ int ret_value = 0;
H5FD_splitter_vfd_config_t *fetched_info = NULL;
if (NULL == (fetched_info = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
SPLITTER_TEST_FAULT("memory allocation for fetched_info struct failed");
- fetched_info->magic = H5FD_SPLITTER_MAGIC;
- fetched_info->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ fetched_info->magic = H5FD_SPLITTER_MAGIC;
+ fetched_info->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
fetched_info->rw_fapl_id = H5I_INVALID_HID;
fetched_info->wo_fapl_id = H5I_INVALID_HID;
@@ -2291,9 +2305,8 @@ compare_splitter_config_info(hid_t fapl_id, H5FD_splitter_vfd_config_t *info)
SPLITTER_TEST_FAULT("Write-Only driver mismatch\n");
}
}
- if ( (HDstrlen(info->wo_path) != HDstrlen(fetched_info->wo_path)) ||
- HDstrncmp(info->wo_path, fetched_info->wo_path, H5FD_SPLITTER_PATH_MAX))
- {
+ if ((HDstrlen(info->wo_path) != HDstrlen(fetched_info->wo_path)) ||
+ HDstrncmp(info->wo_path, fetched_info->wo_path, H5FD_SPLITTER_PATH_MAX)) {
HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info->wo_path);
HEXPRINT(H5FD_SPLITTER_PATH_MAX, info->wo_path);
HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info->wo_path);
@@ -2306,7 +2319,6 @@ done:
return ret_value;
} /* end compare_splitter_config_info() */
-
/*-------------------------------------------------------------------------
* Function: run_splitter_test
*
@@ -2325,10 +2337,8 @@ done:
*-------------------------------------------------------------------------
*/
static int
-run_splitter_test(const struct splitter_dataset_def *data,
- hbool_t ignore_wo_errors,
- hbool_t provide_logfile_path,
- hid_t sub_fapl_ids[2])
+run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_errors,
+ hbool_t provide_logfile_path, hid_t sub_fapl_ids[2])
{
hid_t file_id = H5I_INVALID_HID;
hid_t fapl_id = H5I_INVALID_HID;
@@ -2337,8 +2347,8 @@ run_splitter_test(const struct splitter_dataset_def *data,
hid_t fapl_id_out = H5I_INVALID_HID;
hid_t fapl_id_cpy = H5I_INVALID_HID;
H5FD_splitter_vfd_config_t *vfd_config = NULL;
- char *filename_rw = NULL;
- FILE *logfile = NULL;
+ char * filename_rw = NULL;
+ FILE * logfile = NULL;
int ret_value = 0;
if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
@@ -2346,11 +2356,11 @@ run_splitter_test(const struct splitter_dataset_def *data,
if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char))))
SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed");
- vfd_config->magic = H5FD_SPLITTER_MAGIC;
- vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
vfd_config->ignore_wo_errs = ignore_wo_errors;
- vfd_config->rw_fapl_id = sub_fapl_ids[0];
- vfd_config->wo_fapl_id = sub_fapl_ids[1];
+ vfd_config->rw_fapl_id = sub_fapl_ids[0];
+ vfd_config->wo_fapl_id = sub_fapl_ids[1];
if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) {
SPLITTER_TEST_FAULT("can't prepare file paths\n");
@@ -2406,7 +2416,6 @@ run_splitter_test(const struct splitter_dataset_def *data,
fapl_id_out = H5Fget_access_plist(file_id);
if (H5I_INVALID_HID == fapl_id_out) {
SPLITTER_TEST_FAULT("can't get file's FAPL\n");
-
}
if (H5Pget_driver(fapl_id_out) != H5FD_SPLITTER) {
SPLITTER_TEST_FAULT("wrong file FAPL driver\n");
@@ -2426,7 +2435,8 @@ run_splitter_test(const struct splitter_dataset_def *data,
if (space_id < 0) {
SPLITTER_TEST_FAULT("can't create dataspace\n");
}
- dset_id = H5Dcreate2(file_id, data->dset_name, data->mem_type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, data->dset_name, data->mem_type_id, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
if (dset_id < 0) {
SPLITTER_TEST_FAULT("can't create dataset\n");
}
@@ -2455,22 +2465,23 @@ run_splitter_test(const struct splitter_dataset_def *data,
/* Verify existence of logfile if appropriate */
logfile = fopen(vfd_config->log_file_path, "r");
- if ( (TRUE == provide_logfile_path && NULL == logfile) ||
- (FALSE == provide_logfile_path && NULL != logfile) )
- {
+ if ((TRUE == provide_logfile_path && NULL == logfile) ||
+ (FALSE == provide_logfile_path && NULL != logfile)) {
SPLITTER_TEST_FAULT("no logfile when one was expected\n");
}
done:
if (ret_value < 0) {
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset_id);
H5Sclose(space_id);
H5Pclose(fapl_id_out);
H5Pclose(fapl_id_cpy);
H5Pclose(fapl_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
if (logfile != NULL)
@@ -2482,7 +2493,6 @@ done:
return ret_value;
} /* end run_splitter_test() */
-
/*-------------------------------------------------------------------------
* Function: driver_is_splitter_compatible
*
@@ -2501,29 +2511,28 @@ done:
static int
driver_is_splitter_compatible(hid_t fapl_id)
{
- H5FD_splitter_vfd_config_t *vfd_config = NULL;
- hid_t split_fapl_id = H5I_INVALID_HID;
- herr_t ret = SUCCEED;
- int ret_value = 0;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
+ hid_t split_fapl_id = H5I_INVALID_HID;
+ herr_t ret = SUCCEED;
+ int ret_value = 0;
if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) {
FAIL_PUTS_ERROR("memory allocation for vfd_config struct failed");
}
- if(H5I_INVALID_HID == (split_fapl_id = H5Pcreate(H5P_FILE_ACCESS))) {
+ if (H5I_INVALID_HID == (split_fapl_id = H5Pcreate(H5P_FILE_ACCESS))) {
FAIL_PUTS_ERROR("Can't create contained FAPL");
}
- vfd_config->magic = H5FD_SPLITTER_MAGIC;
- vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
vfd_config->ignore_wo_errs = FALSE;
- vfd_config->rw_fapl_id = H5P_DEFAULT;
- vfd_config->wo_fapl_id = fapl_id;
+ vfd_config->rw_fapl_id = H5P_DEFAULT;
+ vfd_config->wo_fapl_id = fapl_id;
HDstrncpy(vfd_config->wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX);
vfd_config->log_file_path[0] = '\0';
- H5E_BEGIN_TRY {
- ret = H5Pset_fapl_splitter(split_fapl_id, vfd_config);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Pset_fapl_splitter(split_fapl_id, vfd_config); }
+ H5E_END_TRY;
if (SUCCEED == ret) {
ret_value = -1;
}
@@ -2538,16 +2547,14 @@ driver_is_splitter_compatible(hid_t fapl_id)
return ret_value;
error:
- H5E_BEGIN_TRY {
- H5Pclose(split_fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(split_fapl_id); }
+ H5E_END_TRY;
HDfree(vfd_config);
return -1;
} /* end driver_is_splitter_compatible() */
-
/*-------------------------------------------------------------------------
* Function: splitter_RO_test
*
@@ -2562,26 +2569,24 @@ error:
*-------------------------------------------------------------------------
*/
static int
-splitter_RO_test(
- const struct splitter_dataset_def *data,
- hid_t child_fapl_id)
+splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id)
{
- char *filename_rw = NULL;
- H5FD_splitter_vfd_config_t *vfd_config = NULL;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t file_id = H5I_INVALID_HID;
- int ret_value = 0;
+ char * filename_rw = NULL;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t file_id = H5I_INVALID_HID;
+ int ret_value = 0;
if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed");
if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char))))
SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed");
- vfd_config->magic = H5FD_SPLITTER_MAGIC;
- vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
vfd_config->ignore_wo_errs = FALSE;
- vfd_config->rw_fapl_id = child_fapl_id;
- vfd_config->wo_fapl_id = child_fapl_id;
+ vfd_config->rw_fapl_id = child_fapl_id;
+ vfd_config->wo_fapl_id = child_fapl_id;
if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) {
SPLITTER_TEST_FAULT("can't prepare splitter file paths\n");
@@ -2603,9 +2608,8 @@ splitter_RO_test(
* Should fail.
*/
- H5E_BEGIN_TRY {
- file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); }
+ H5E_END_TRY;
if (file_id >= 0) {
SPLITTER_TEST_FAULT("R/O open on nonexistent files unexpectedly successful\n");
}
@@ -2617,9 +2621,8 @@ splitter_RO_test(
if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) {
SPLITTER_TEST_FAULT("can't write W/O file\n");
}
- H5E_BEGIN_TRY {
- file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); }
+ H5E_END_TRY;
if (file_id >= 0) {
SPLITTER_TEST_FAULT("R/O open with extant W/O file unexpectedly successful\n");
}
@@ -2632,9 +2635,8 @@ splitter_RO_test(
if (splitter_create_single_file_at(filename_rw, vfd_config->rw_fapl_id, data) < 0) {
SPLITTER_TEST_FAULT("can't create R/W file\n");
}
- H5E_BEGIN_TRY {
- file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); }
+ H5E_END_TRY;
if (file_id >= 0) {
SPLITTER_TEST_FAULT("R/O open with extant R/W file unexpectedly successful\n");
}
@@ -2667,10 +2669,12 @@ splitter_RO_test(
done:
if (ret_value < 0) {
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
HDfree(vfd_config);
@@ -2679,7 +2683,6 @@ done:
return ret_value;
} /* end splitter_RO_test() */
-
/*-------------------------------------------------------------------------
* Function: splitter_prepare_file_paths
*
@@ -2723,7 +2726,8 @@ splitter_prepare_file_paths(H5FD_splitter_vfd_config_t *vfd_config, char *filena
*/
h5_fixname(FILENAME[11], vfd_config->rw_fapl_id, filename_rw_out, H5FD_SPLITTER_PATH_MAX);
h5_fixname(FILENAME[12], vfd_config->wo_fapl_id, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX);
- h5_fixname_no_suffix(FILENAME[13], vfd_config->wo_fapl_id, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX);
+ h5_fixname_no_suffix(FILENAME[13], vfd_config->wo_fapl_id, vfd_config->log_file_path,
+ H5FD_SPLITTER_PATH_MAX);
/* Delete any existing files on disk.
*/
@@ -2735,7 +2739,6 @@ done:
return ret_value;
} /* end splitter_prepare_file_paths() */
-
/*-------------------------------------------------------------------------
* Function: splitter_crate_single_file_at
*
@@ -2756,15 +2759,12 @@ done:
*-------------------------------------------------------------------------
*/
static int
-splitter_create_single_file_at(
- const char *filename,
- hid_t fapl_id,
- const struct splitter_dataset_def *data)
+splitter_create_single_file_at(const char *filename, hid_t fapl_id, const struct splitter_dataset_def *data)
{
- hid_t file_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t dset_id = H5I_INVALID_HID;
- int ret_value = 0;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ int ret_value = 0;
if (filename == NULL || *filename == '\0') {
SPLITTER_TEST_FAULT("filename is invalid\n");
@@ -2783,14 +2783,8 @@ splitter_create_single_file_at(
SPLITTER_TEST_FAULT("can't create dataspace\n");
}
- dset_id = H5Dcreate2(
- file_id,
- data->dset_name,
- data->mem_type_id,
- space_id,
- H5P_DEFAULT,
- H5P_DEFAULT,
- H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, data->dset_name, data->mem_type_id, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
if (dset_id < 0) {
SPLITTER_TEST_FAULT("can't create dataset\n");
}
@@ -2813,16 +2807,17 @@ splitter_create_single_file_at(
done:
if (ret_value < 0) {
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset_id);
H5Sclose(space_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* end if error */
return ret_value;
} /* end splitter_create_single_file_at() */
-
/*-------------------------------------------------------------------------
* Function: splitter_compare_expected_data
*
@@ -2838,15 +2833,14 @@ done:
*-------------------------------------------------------------------------
*/
static int
-splitter_compare_expected_data(hid_t file_id,
- const struct splitter_dataset_def *data)
+splitter_compare_expected_data(hid_t file_id, const struct splitter_dataset_def *data)
{
- hid_t dset_id = H5I_INVALID_HID;
- int buf[SPLITTER_SIZE][SPLITTER_SIZE];
- int expected[SPLITTER_SIZE][SPLITTER_SIZE];
- size_t i = 0;
- size_t j = 0;
- int ret_value = 0;
+ hid_t dset_id = H5I_INVALID_HID;
+ int buf[SPLITTER_SIZE][SPLITTER_SIZE];
+ int expected[SPLITTER_SIZE][SPLITTER_SIZE];
+ size_t i = 0;
+ size_t j = 0;
+ int ret_value = 0;
if (sizeof((void *)buf) != sizeof(data->buf)) {
SPLITTER_TEST_FAULT("invariant size of expected data does not match that received!\n");
@@ -2862,8 +2856,8 @@ splitter_compare_expected_data(hid_t file_id,
SPLITTER_TEST_FAULT("can't read dataset\n");
}
- for (i=0; i < SPLITTER_SIZE; i++) {
- for (j=0; j < SPLITTER_SIZE; j++) {
+ for (i = 0; i < SPLITTER_SIZE; i++) {
+ for (j = 0; j < SPLITTER_SIZE; j++) {
if (buf[i][j] != expected[i][j]) {
SPLITTER_TEST_FAULT("mismatch in expected data\n");
}
@@ -2876,14 +2870,12 @@ splitter_compare_expected_data(hid_t file_id,
done:
if (ret_value < 0) {
- H5E_BEGIN_TRY {
- H5Dclose(dset_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Dclose(dset_id); }
+ H5E_END_TRY;
}
return ret_value;
} /* end splitter_compare_expected_data() */
-
/*-------------------------------------------------------------------------
* Function: splitter_tentative_open_test()
*
@@ -2910,17 +2902,17 @@ done:
static int
splitter_tentative_open_test(hid_t child_fapl_id)
{
- const char *filename_tmp = "splitter_tmp.h5";
- char *filename_rw = NULL;
- H5FD_splitter_vfd_config_t *vfd_config = NULL;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t file_id = H5I_INVALID_HID;
- int buf[SPLITTER_SIZE][SPLITTER_SIZE]; /* for comparison */
- hsize_t dims[2] = { SPLITTER_SIZE, SPLITTER_SIZE }; /* for comparison */
- int i = 0; /* for comparison */
- int j = 0; /* for comparison */
- struct splitter_dataset_def data; /* for comparison */
- int ret_value = 0;
+ const char * filename_tmp = "splitter_tmp.h5";
+ char * filename_rw = NULL;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t file_id = H5I_INVALID_HID;
+ int buf[SPLITTER_SIZE][SPLITTER_SIZE]; /* for comparison */
+ hsize_t dims[2] = {SPLITTER_SIZE, SPLITTER_SIZE}; /* for comparison */
+ int i = 0; /* for comparison */
+ int j = 0; /* for comparison */
+ struct splitter_dataset_def data; /* for comparison */
+ int ret_value = 0;
if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed");
@@ -2928,24 +2920,24 @@ splitter_tentative_open_test(hid_t child_fapl_id)
SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed");
/* pre-fill data buffer to write */
- for (i=0; i < SPLITTER_SIZE; i++) {
- for (j=0; j < SPLITTER_SIZE; j++) {
- buf[i][j] = i*100+j;
+ for (i = 0; i < SPLITTER_SIZE; i++) {
+ for (j = 0; j < SPLITTER_SIZE; j++) {
+ buf[i][j] = i * 100 + j;
}
}
/* Dataset info */
- data.buf = (void *)buf;
+ data.buf = (void *)buf;
data.mem_type_id = H5T_NATIVE_INT;
- data.dims = dims;
- data.n_dims = 2;
- data.dset_name = SPLITTER_DATASET_NAME;
+ data.dims = dims;
+ data.n_dims = 2;
+ data.dset_name = SPLITTER_DATASET_NAME;
- vfd_config->magic = H5FD_SPLITTER_MAGIC;
- vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
vfd_config->ignore_wo_errs = FALSE;
- vfd_config->rw_fapl_id = child_fapl_id;
- vfd_config->wo_fapl_id = child_fapl_id;
+ vfd_config->rw_fapl_id = child_fapl_id;
+ vfd_config->wo_fapl_id = child_fapl_id;
if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) {
SPLITTER_TEST_FAULT("can't prepare splitter file paths\n");
@@ -2976,9 +2968,8 @@ splitter_tentative_open_test(hid_t child_fapl_id)
* Should fail.
*/
- H5E_BEGIN_TRY {
- file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); }
+ H5E_END_TRY;
if (file_id != H5I_INVALID_HID) {
SPLITTER_TEST_FAULT("open with both nonexistent files unexpectedly succeeded\n");
}
@@ -2998,9 +2989,8 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("Can't create W/O file copy.\n");
}
- H5E_BEGIN_TRY {
- file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); }
+ H5E_END_TRY;
if (file_id != H5I_INVALID_HID) {
SPLITTER_TEST_FAULT("open with nonexistent R/W file unexpectedly succeeded\n");
}
@@ -3024,9 +3014,8 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) {
SPLITTER_TEST_FAULT("Can't create R/W file copy.\n");
}
- H5E_BEGIN_TRY {
- file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); }
+ H5E_END_TRY;
if (file_id != H5I_INVALID_HID) {
SPLITTER_TEST_FAULT("open with nonexistent W/O unexpectedly succeeded\n");
}
@@ -3159,10 +3148,12 @@ splitter_tentative_open_test(hid_t child_fapl_id)
done:
if (ret_value < 0) {
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_id);
H5Fclose(file_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
HDfree(vfd_config);
@@ -3171,7 +3162,6 @@ done:
return ret_value;
} /* end splitter_tentative_open_test() */
-
/*-------------------------------------------------------------------------
* Function: file_exists()
*
@@ -3187,12 +3177,11 @@ done:
static int
file_exists(const char *filename, hid_t fapl_id)
{
- hid_t file_id = H5I_INVALID_HID;
- int ret_value = 0;
+ hid_t file_id = H5I_INVALID_HID;
+ int ret_value = 0;
- H5E_BEGIN_TRY {
- file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id); }
+ H5E_END_TRY;
if (file_id != H5I_INVALID_HID) {
ret_value = 1;
if (H5Fclose(file_id) < 0) {
@@ -3203,13 +3192,11 @@ file_exists(const char *filename, hid_t fapl_id)
return ret_value;
error:
- H5E_BEGIN_TRY {
- H5Fclose(file_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(file_id); }
+ H5E_END_TRY;
return ret_value;
} /* end file_exists() */
-
/*-------------------------------------------------------------------------
* Function: test_splitter
*
@@ -3228,28 +3215,28 @@ error:
static herr_t
test_splitter(void)
{
- int buf[SPLITTER_SIZE][SPLITTER_SIZE];
- hsize_t dims[2] = { SPLITTER_SIZE, SPLITTER_SIZE };
- hid_t child_fapl_id = H5I_INVALID_HID;
- int i = 0;
- int j = 0;
+ int buf[SPLITTER_SIZE][SPLITTER_SIZE];
+ hsize_t dims[2] = {SPLITTER_SIZE, SPLITTER_SIZE};
+ hid_t child_fapl_id = H5I_INVALID_HID;
+ int i = 0;
+ int j = 0;
struct splitter_dataset_def data;
TESTING("SPLITTER file driver");
/* pre-fill data buffer to write */
- for (i=0; i < SPLITTER_SIZE; i++) {
- for (j=0; j < SPLITTER_SIZE; j++) {
- buf[i][j] = i*100+j;
+ for (i = 0; i < SPLITTER_SIZE; i++) {
+ for (j = 0; j < SPLITTER_SIZE; j++) {
+ buf[i][j] = i * 100 + j;
}
}
/* Dataset info */
- data.buf = (void *)buf;
+ data.buf = (void *)buf;
data.mem_type_id = H5T_NATIVE_INT;
- data.dims = dims;
- data.n_dims = 2;
- data.dset_name = SPLITTER_DATASET_NAME;
+ data.dims = dims;
+ data.n_dims = 2;
+ data.dset_name = SPLITTER_DATASET_NAME;
/* Stand-in for manual FAPL creation
* Enables verification with arbitrary VFDs via `make check-vfd`
@@ -3281,13 +3268,13 @@ test_splitter(void)
/* Test file creation, utilizing different child FAPLs (default vs.
* specified), logfile, and Write Channel error ignoring behavior.
*/
- for (i=0; i < 4; i++) {
- hbool_t ignore_wo_errors = (i & 1) ? TRUE : FALSE;
+ for (i = 0; i < 4; i++) {
+ hbool_t ignore_wo_errors = (i & 1) ? TRUE : FALSE;
hbool_t provide_logfile_path = (i & 2) ? TRUE : FALSE;
- hid_t child_fapl_ids[2] = { H5P_DEFAULT, H5P_DEFAULT };
+ hid_t child_fapl_ids[2] = {H5P_DEFAULT, H5P_DEFAULT};
/* Test child driver definition/default combination */
- for (j=0; j < 4; j++) {
+ for (j = 0; j < 4; j++) {
child_fapl_ids[0] = (j & 1) ? child_fapl_id : H5P_DEFAULT;
child_fapl_ids[1] = (j & 2) ? child_fapl_id : H5P_DEFAULT;
@@ -3300,8 +3287,8 @@ test_splitter(void)
} /* end for behavior-flag loops */
-/* TODO: SWMR open? */
-/* Concurrent opens with both drivers using the Splitter */
+ /* TODO: SWMR open? */
+ /* Concurrent opens with both drivers using the Splitter */
if (H5Pclose(child_fapl_id) == FAIL) {
TEST_ERROR;
@@ -3319,7 +3306,6 @@ error:
#undef SPLITTER_TEST_FAULT
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -3338,23 +3324,22 @@ main(void)
HDprintf("Testing basic Virtual File Driver functionality.\n");
- nerrors += test_sec2() < 0 ? 1 : 0;
- nerrors += test_core() < 0 ? 1 : 0;
- nerrors += test_direct() < 0 ? 1 : 0;
- nerrors += test_family() < 0 ? 1 : 0;
- nerrors += test_family_compat() < 0 ? 1 : 0;
- nerrors += test_family_member_fapl() < 0 ? 1 : 0;
- nerrors += test_multi() < 0 ? 1 : 0;
- nerrors += test_multi_compat() < 0 ? 1 : 0;
- nerrors += test_log() < 0 ? 1 : 0;
- nerrors += test_stdio() < 0 ? 1 : 0;
- nerrors += test_windows() < 0 ? 1 : 0;
- nerrors += test_ros3() < 0 ? 1 : 0;
- nerrors += test_splitter() < 0 ? 1 : 0;
-
- if(nerrors) {
- HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ nerrors += test_sec2() < 0 ? 1 : 0;
+ nerrors += test_core() < 0 ? 1 : 0;
+ nerrors += test_direct() < 0 ? 1 : 0;
+ nerrors += test_family() < 0 ? 1 : 0;
+ nerrors += test_family_compat() < 0 ? 1 : 0;
+ nerrors += test_family_member_fapl() < 0 ? 1 : 0;
+ nerrors += test_multi() < 0 ? 1 : 0;
+ nerrors += test_multi_compat() < 0 ? 1 : 0;
+ nerrors += test_log() < 0 ? 1 : 0;
+ nerrors += test_stdio() < 0 ? 1 : 0;
+ nerrors += test_windows() < 0 ? 1 : 0;
+ nerrors += test_ros3() < 0 ? 1 : 0;
+ nerrors += test_splitter() < 0 ? 1 : 0;
+
+ if (nerrors) {
+ HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
return EXIT_FAILURE;
}
@@ -3362,4 +3347,3 @@ main(void)
return EXIT_SUCCESS;
} /* end main() */
-
diff --git a/test/vol.c b/test/vol.c
index 0f8af4f..7d6cded 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -21,136 +21,145 @@
#include "h5test.h"
/* Filename */
-const char *FILENAME[] = {
- "native_vol_test",
- NULL
-};
+const char *FILENAME[] = {"native_vol_test", NULL};
-#define NATIVE_VOL_TEST_GROUP_NAME "test_group"
-#define NATIVE_VOL_TEST_DATASET_NAME "test_dataset"
-#define NATIVE_VOL_TEST_ATTRIBUTE_NAME "test_dataset"
-#define NATIVE_VOL_TEST_HARD_LINK_NAME "test_hard_link"
-#define NATIVE_VOL_TEST_SOFT_LINK_NAME "test_soft_link"
-#define NATIVE_VOL_TEST_MOVE_LINK_NAME "test_move_link"
-#define NATIVE_VOL_TEST_COPY_LINK_NAME "test_copy_link"
-#define NATIVE_VOL_TEST_DATATYPE_NAME "test_datatype"
+#define NATIVE_VOL_TEST_GROUP_NAME "test_group"
+#define NATIVE_VOL_TEST_DATASET_NAME "test_dataset"
+#define NATIVE_VOL_TEST_ATTRIBUTE_NAME "test_dataset"
+#define NATIVE_VOL_TEST_HARD_LINK_NAME "test_hard_link"
+#define NATIVE_VOL_TEST_SOFT_LINK_NAME "test_soft_link"
+#define NATIVE_VOL_TEST_MOVE_LINK_NAME "test_move_link"
+#define NATIVE_VOL_TEST_COPY_LINK_NAME "test_copy_link"
+#define NATIVE_VOL_TEST_DATATYPE_NAME "test_datatype"
-#define N_ELEMENTS 10
+#define N_ELEMENTS 10
-#define FAKE_VOL_NAME "fake"
+#define FAKE_VOL_NAME "fake"
#define FAKE_VOL_VALUE ((H5VL_class_value_t)501)
/* A VOL class struct that describes a VOL class with no
* functionality.
*/
static const H5VL_class_t fake_vol_g = {
- 0, /* version */
- FAKE_VOL_VALUE, /* value */
- FAKE_VOL_NAME, /* name */
- 0, /* capability flags */
- NULL, /* initialize */
- NULL, /* terminate */
- { /* info_cls */
- (size_t)0, /* size */
- NULL, /* copy */
- NULL, /* compare */
- NULL, /* free */
- NULL, /* to_str */
- NULL, /* from_str */
+ 0, /* version */
+ FAKE_VOL_VALUE, /* value */
+ FAKE_VOL_NAME, /* name */
+ 0, /* capability flags */
+ NULL, /* initialize */
+ NULL, /* terminate */
+ {
+ /* info_cls */
+ (size_t)0, /* size */
+ NULL, /* copy */
+ NULL, /* compare */
+ NULL, /* free */
+ NULL, /* to_str */
+ NULL, /* from_str */
},
- { /* wrap_cls */
- NULL, /* get_object */
- NULL, /* get_wrap_ctx */
- NULL, /* wrap_object */
- NULL, /* unwrap_object */
- NULL, /* free_wrap_ctx */
+ {
+ /* wrap_cls */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* unwrap_object */
+ NULL, /* free_wrap_ctx */
},
- { /* attribute_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* read */
- NULL, /* write */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* attribute_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* dataset_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* read */
- NULL, /* write */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* dataset_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* datatype_cls */
- NULL, /* commit */
- NULL, /* open */
- NULL, /* get_size */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* datatype_cls */
+ NULL, /* commit */
+ NULL, /* open */
+ NULL, /* get_size */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* file_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* file_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* group_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ {
+ /* group_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
- { /* link_cls */
- NULL, /* create */
- NULL, /* copy */
- NULL, /* move */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ {
+ /* link_cls */
+ NULL, /* create */
+ NULL, /* copy */
+ NULL, /* move */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
- { /* object_cls */
- NULL, /* open */
- NULL, /* copy */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ {
+ /* object_cls */
+ NULL, /* open */
+ NULL, /* copy */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
- { /* introspect_cls */
- NULL, /* get_conn_cls */
- NULL, /* opt_query */
+ {
+ /* introspect_cls */
+ NULL, /* get_conn_cls */
+ NULL, /* opt_query */
},
- { /* request_cls */
- NULL, /* wait */
- NULL, /* notify */
- NULL, /* cancel */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* free */
+ {
+ /* request_cls */
+ NULL, /* wait */
+ NULL, /* notify */
+ NULL, /* cancel */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* free */
},
- { /* blob_cls */
- NULL, /* put */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ {
+ /* blob_cls */
+ NULL, /* put */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
- { /* token_cls */
- NULL, /* cmp */
- NULL, /* to_str */
- NULL /* from_str */
+ {
+ /* token_cls */
+ NULL, /* cmp */
+ NULL, /* to_str */
+ NULL /* from_str */
},
- NULL /* optional */
+ NULL /* optional */
};
-
/*-------------------------------------------------------------------------
* Function: test_vol_registration()
*
@@ -164,13 +173,13 @@ static const H5VL_class_t fake_vol_g = {
static herr_t
test_vol_registration(void)
{
- hid_t native_id = H5I_INVALID_HID;
- hid_t lapl_id = H5I_INVALID_HID;
- hid_t vipl_id = H5I_INVALID_HID;
- herr_t ret = SUCCEED;
+ hid_t native_id = H5I_INVALID_HID;
+ hid_t lapl_id = H5I_INVALID_HID;
+ hid_t vipl_id = H5I_INVALID_HID;
+ herr_t ret = SUCCEED;
htri_t is_registered = FAIL;
- hid_t vol_id = H5I_INVALID_HID;
- hid_t vol_id2 = H5I_INVALID_HID;
+ hid_t vol_id = H5I_INVALID_HID;
+ hid_t vol_id2 = H5I_INVALID_HID;
TESTING("VOL registration");
@@ -187,9 +196,8 @@ test_vol_registration(void)
/* Test registering a connector with an incorrect property list (SHOULD FAIL) */
if ((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0)
TEST_ERROR;
- H5E_BEGIN_TRY {
- vol_id = H5VLregister_connector(&fake_vol_g, lapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { vol_id = H5VLregister_connector(&fake_vol_g, lapl_id); }
+ H5E_END_TRY;
if (H5I_INVALID_HID != vol_id)
FAIL_PUTS_ERROR("should not be able to register a connector with an incorrect property list");
if (H5Pclose(lapl_id) < 0)
@@ -252,9 +260,8 @@ test_vol_registration(void)
/* Try to unregister the native VOL connector (should fail) */
if (H5I_INVALID_HID == (native_id = H5VLget_connector_id_by_name(H5VL_NATIVE_NAME)))
TEST_ERROR;
- H5E_BEGIN_TRY {
- ret = H5VLunregister_connector(native_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5VLunregister_connector(native_id); }
+ H5E_END_TRY;
if (FAIL != ret)
FAIL_PUTS_ERROR("should not be able to unregister the native VOL connector");
@@ -262,16 +269,17 @@ test_vol_registration(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5VLunregister_connector(vol_id);
H5Pclose(lapl_id);
H5Pclose(vipl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_vol_registration() */
-
/*-------------------------------------------------------------------------
* Function: test_native_vol_init()
*
@@ -307,7 +315,6 @@ error:
} /* end test_native_vol_init() */
-
/*-------------------------------------------------------------------------
* Function: test_basic_file_operation()
*
@@ -320,20 +327,20 @@ error:
static herr_t
test_basic_file_operation(const char *env_h5_drvr)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fid_reopen = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t fapl_id2 = H5I_INVALID_HID;
- hid_t fcpl_id = H5I_INVALID_HID;
-
- char filename[1024];
- ssize_t obj_count;
- hid_t obj_id_list[1];
- hsize_t file_size;
- unsigned intent;
- void *os_file_handle = NULL;
- H5F_info2_t finfo;
- char name[32];
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fid_reopen = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t fapl_id2 = H5I_INVALID_HID;
+ hid_t fcpl_id = H5I_INVALID_HID;
+
+ char filename[1024];
+ ssize_t obj_count;
+ hid_t obj_id_list[1];
+ hsize_t file_size;
+ unsigned intent;
+ void * os_file_handle = NULL;
+ H5F_info2_t finfo;
+ char name[32];
TESTING("Basic VOL file operations");
@@ -350,9 +357,9 @@ test_basic_file_operation(const char *env_h5_drvr)
* I'm not fighting it, just getting the testing to verify that the VOL
* connector property is returned correctly. -QAK, 2018/11/17
*/
- if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0)
+ if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0)
TEST_ERROR;
- if(H5Pset_metadata_read_attempts(fapl_id, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl_id, 9) < 0)
TEST_ERROR
/* H5Fcreate */
@@ -374,7 +381,8 @@ test_basic_file_operation(const char *env_h5_drvr)
TEST_ERROR;
/* Can't compare VFD properties for split / multi / family VFDs */
- if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) {
+ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") &&
+ HDstrcmp(env_h5_drvr, "family"))) {
/* H5Fget_access_plist */
if ((fapl_id2 = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
@@ -395,7 +403,8 @@ test_basic_file_operation(const char *env_h5_drvr)
TEST_ERROR;
/* Can't retrieve VFD handle for split / multi / family VFDs */
- if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) {
+ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") &&
+ HDstrcmp(env_h5_drvr, "family"))) {
/* H5Fget_vfd_handle */
if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
TEST_ERROR;
@@ -434,13 +443,14 @@ test_basic_file_operation(const char *env_h5_drvr)
TEST_ERROR;
/* Can't compare VFD properties for split / multi / family VFDs */
- if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) {
+ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") &&
+ HDstrcmp(env_h5_drvr, "family"))) {
/* H5Fget_access_plist */
- if((fapl_id2 = H5Fget_access_plist(fid)) < 0)
+ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
- if(H5Pequal(fapl_id, fapl_id2) != TRUE)
+ if (H5Pequal(fapl_id, fapl_id2) != TRUE)
TEST_ERROR;
- if(H5Pclose(fapl_id2) < 0)
+ if (H5Pclose(fapl_id2) < 0)
TEST_ERROR;
} /* end if */
@@ -448,13 +458,14 @@ test_basic_file_operation(const char *env_h5_drvr)
TEST_ERROR;
/* Can't compare VFD properties for split / multi / family VFDs */
- if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) {
+ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") &&
+ HDstrcmp(env_h5_drvr, "family"))) {
/* H5Fget_access_plist */
- if((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0)
+ if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0)
TEST_ERROR;
- if(H5Pequal(fapl_id, fapl_id2) != TRUE)
+ if (H5Pequal(fapl_id, fapl_id2) != TRUE)
TEST_ERROR;
- if(H5Pclose(fapl_id2) < 0)
+ if (H5Pclose(fapl_id2) < 0)
TEST_ERROR;
} /* end if */
@@ -473,19 +484,20 @@ test_basic_file_operation(const char *env_h5_drvr)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Fclose(fid_reopen);
H5Pclose(fapl_id);
H5Pclose(fapl_id2);
H5Pclose(fcpl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_basic_file_operation() */
-
/*-------------------------------------------------------------------------
* Function: test_basic_group_operation()
*
@@ -498,12 +510,12 @@ error:
static herr_t
test_basic_group_operation(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t gid_a = H5I_INVALID_HID;
- hid_t gcpl_id = H5I_INVALID_HID;
- char filename[1024];
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t gid_a = H5I_INVALID_HID;
+ hid_t gcpl_id = H5I_INVALID_HID;
+ char filename[1024];
H5G_info_t info;
TESTING("Basic VOL group operations");
@@ -576,18 +588,19 @@ test_basic_group_operation(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Gclose(gid);
H5Pclose(fapl_id);
H5Pclose(gcpl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_basic_group_operation() */
-
/*-------------------------------------------------------------------------
* Function: test_basic_dataset_operation()
*
@@ -600,22 +613,22 @@ error:
static herr_t
test_basic_dataset_operation(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t dcpl_id = H5I_INVALID_HID;
- hid_t dapl_id = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t did_a = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t dapl_id = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t did_a = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
char filename[1024];
- hsize_t curr_dims = 0;
- hsize_t max_dims = H5S_UNLIMITED;
+ hsize_t curr_dims = 0;
+ hsize_t max_dims = H5S_UNLIMITED;
- hsize_t storage_size;
- haddr_t offset;
+ hsize_t storage_size;
+ haddr_t offset;
H5D_space_status_t status;
int in_buf[N_ELEMENTS];
@@ -632,7 +645,7 @@ test_basic_dataset_operation(void)
if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
for (i = 0; i < N_ELEMENTS; i++) {
- in_buf[i] = i;
+ in_buf[i] = i;
out_buf[i] = 0;
}
@@ -645,7 +658,8 @@ test_basic_dataset_operation(void)
TEST_ERROR;
if (H5Pset_chunk(dcpl_id, 1, &curr_dims) < 0)
TEST_ERROR;
- if ((did = H5Dcreate2(fid, NATIVE_VOL_TEST_DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, NATIVE_VOL_TEST_DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
/* H5Dcreate_anon */
@@ -753,7 +767,8 @@ test_basic_dataset_operation(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Dclose(did);
H5Dclose(did_a);
@@ -762,13 +777,13 @@ error:
H5Pclose(fapl_id);
H5Pclose(dapl_id);
H5Pclose(dcpl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_basic_dataset_operation() */
-
/*-------------------------------------------------------------------------
* Function: test_basic_attribute_operation()
*
@@ -781,19 +796,19 @@ error:
static herr_t
test_basic_attribute_operation(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t aid = H5I_INVALID_HID;
- hid_t aid_name = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t aid_name = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
- char filename[1024];
+ char filename[1024];
- hsize_t dims = 1;
+ hsize_t dims = 1;
- int data_in = 42;
- int data_out = 0;
+ int data_in = 42;
+ int data_out = 0;
TESTING("Basic VOL attribute operations");
@@ -810,7 +825,8 @@ test_basic_attribute_operation(void)
TEST_ERROR;
/* H5Acreate */
- if ((aid = H5Acreate2(fid, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(fid, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
/* H5Awrite */
@@ -838,7 +854,8 @@ test_basic_attribute_operation(void)
TEST_ERROR;
/* H5Acreate_by_name */
- if ((aid_name = H5Acreate_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid_name = H5Acreate_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, NATIVE_VOL_TEST_ATTRIBUTE_NAME,
+ H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* H5Aclose */
if (H5Aclose(aid_name) < 0)
@@ -865,20 +882,21 @@ test_basic_attribute_operation(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fapl_id);
H5Gclose(gid);
H5Sclose(sid);
H5Aclose(aid);
H5Aclose(aid_name);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_basic_attribute_operation() */
-
/*-------------------------------------------------------------------------
* Function: test_basic_object_operation()
*
@@ -891,12 +909,12 @@ error:
static herr_t
test_basic_object_operation(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t oid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t oid = H5I_INVALID_HID;
- char filename[1024];
+ char filename[1024];
H5O_info2_t object_info;
TESTING("Basic VOL object operations");
@@ -939,22 +957,22 @@ test_basic_object_operation(void)
if (H5Pclose(fapl_id) < 0)
TEST_ERROR;
-
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fapl_id);
H5Gclose(gid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_basic_object_operation() */
-
/*-------------------------------------------------------------------------
* Function: test_basic_link_operation()
*
@@ -967,10 +985,10 @@ error:
static herr_t
test_basic_link_operation(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- char filename[1024];
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ char filename[1024];
TESTING("Basic VOL link operations");
@@ -998,11 +1016,13 @@ test_basic_link_operation(void)
TEST_ERROR;
/* H5Lcopy */
- if (H5Lcopy(gid, NATIVE_VOL_TEST_HARD_LINK_NAME, fid, NATIVE_VOL_TEST_COPY_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcopy(gid, NATIVE_VOL_TEST_HARD_LINK_NAME, fid, NATIVE_VOL_TEST_COPY_LINK_NAME, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
TEST_ERROR;
/* H5Lmove */
- if (H5Lmove(fid, NATIVE_VOL_TEST_COPY_LINK_NAME, gid, NATIVE_VOL_TEST_MOVE_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lmove(fid, NATIVE_VOL_TEST_COPY_LINK_NAME, gid, NATIVE_VOL_TEST_MOVE_LINK_NAME, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
TEST_ERROR;
if (H5Fclose(fid) < 0)
@@ -1016,22 +1036,22 @@ test_basic_link_operation(void)
if (H5Pclose(fapl_id) < 0)
TEST_ERROR;
-
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Fclose(gid);
H5Pclose(fapl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_basic_link_operation() */
-
/*-------------------------------------------------------------------------
* Function: test_basic_datatype_operation()
*
@@ -1044,12 +1064,12 @@ error:
static herr_t
test_basic_datatype_operation(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- hid_t tid_anon = H5I_INVALID_HID;
- hid_t tcpl_id = H5I_INVALID_HID;
- char filename[1024];
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t tid_anon = H5I_INVALID_HID;
+ hid_t tcpl_id = H5I_INVALID_HID;
+ char filename[1024];
TESTING("Basic VOL datatype operations");
@@ -1111,19 +1131,20 @@ test_basic_datatype_operation(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(tcpl_id);
H5Fclose(fid);
H5Pclose(fapl_id);
H5Tclose(tid);
H5Tclose(tid_anon);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_basic_datatype_operation() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1136,31 +1157,30 @@ error:
int
main(void)
{
- const char *env_h5_drvr; /* File driver value from environment */
- int nerrors = 0;
+ const char *env_h5_drvr; /* File driver value from environment */
+ int nerrors = 0;
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
- if(env_h5_drvr == NULL)
+ if (env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
h5_reset();
HDputs("Testing basic Virtual Object Layer (VOL) functionality.");
- nerrors += test_vol_registration() < 0 ? 1 : 0;
- nerrors += test_native_vol_init() < 0 ? 1 : 0;
+ nerrors += test_vol_registration() < 0 ? 1 : 0;
+ nerrors += test_native_vol_init() < 0 ? 1 : 0;
nerrors += test_basic_file_operation(env_h5_drvr) < 0 ? 1 : 0;
- nerrors += test_basic_group_operation() < 0 ? 1 : 0;
- nerrors += test_basic_dataset_operation() < 0 ? 1 : 0;
+ nerrors += test_basic_group_operation() < 0 ? 1 : 0;
+ nerrors += test_basic_dataset_operation() < 0 ? 1 : 0;
nerrors += test_basic_attribute_operation() < 0 ? 1 : 0;
- nerrors += test_basic_object_operation() < 0 ? 1 : 0;
- nerrors += test_basic_link_operation() < 0 ? 1 : 0;
- nerrors += test_basic_datatype_operation() < 0 ? 1 : 0;
+ nerrors += test_basic_object_operation() < 0 ? 1 : 0;
+ nerrors += test_basic_link_operation() < 0 ? 1 : 0;
+ nerrors += test_basic_datatype_operation() < 0 ? 1 : 0;
if (nerrors) {
- HDprintf("***** %d Virtual Object Layer TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ HDprintf("***** %d Virtual Object Layer TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
HDexit(EXIT_FAILURE);
}
@@ -1169,4 +1189,3 @@ main(void)
HDexit(EXIT_SUCCESS);
} /* end main() */
-
diff --git a/test/vol_plugin.c b/test/vol_plugin.c
index 565c847..15aec12 100644
--- a/test/vol_plugin.c
+++ b/test/vol_plugin.c
@@ -23,7 +23,6 @@
#include "null_vol_connector.h"
-
/*-------------------------------------------------------------------------
* Function: test_registration_by_value()
*
@@ -37,49 +36,47 @@
static herr_t
test_registration_by_value(void)
{
- htri_t is_registered = FAIL;
- hid_t vol_id = H5I_INVALID_HID;
+ htri_t is_registered = FAIL;
+ hid_t vol_id = H5I_INVALID_HID;
TESTING("VOL registration by value");
/* The null VOL connector should not be registered at the start of the test */
- if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
/* Register the connector by value */
- if((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0)
+ if ((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* The connector should be registered now */
- if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
- if(FALSE == is_registered)
+ if (FALSE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector was not registered");
/* Unregister the connector */
- if(H5VLunregister_connector(vol_id) < 0)
+ if (H5VLunregister_connector(vol_id) < 0)
TEST_ERROR;
/* The connector should not be registered now */
- if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5VLunregister_connector(vol_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5VLunregister_connector(vol_id); }
+ H5E_END_TRY;
return FAIL;
} /* end test_registration_by_value() */
-
/*-------------------------------------------------------------------------
* Function: test_registration_by_name()
*
@@ -93,49 +90,47 @@ error:
static herr_t
test_registration_by_name(void)
{
- htri_t is_registered = FAIL;
- hid_t vol_id = H5I_INVALID_HID;
+ htri_t is_registered = FAIL;
+ hid_t vol_id = H5I_INVALID_HID;
TESTING("VOL registration by name");
/* The null VOL connector should not be registered at the start of the test */
- if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
/* Register the connector by name */
- if((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0)
+ if ((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* The connector should be registered now */
- if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
- if(FALSE == is_registered)
+ if (FALSE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector was not registered");
/* Unregister the connector */
- if(H5VLunregister_connector(vol_id) < 0)
+ if (H5VLunregister_connector(vol_id) < 0)
TEST_ERROR;
/* The connector should not be registered now */
- if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5VLunregister_connector(vol_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5VLunregister_connector(vol_id); }
+ H5E_END_TRY;
return FAIL;
} /* end test_registration_by_name() */
-
/*-------------------------------------------------------------------------
* Function: test_multiple_registration()
*
@@ -149,97 +144,98 @@ error:
static herr_t
test_multiple_registration(void)
{
- htri_t is_registered = FAIL;
- hid_t vol_ids[N_REGISTRATIONS];
- int i;
+ htri_t is_registered = FAIL;
+ hid_t vol_ids[N_REGISTRATIONS];
+ int i;
TESTING("registering a VOL connector multiple times");
/* The null VOL connector should not be registered at the start of the test */
- if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
/* Register the connector multiple times */
- for(i = 0; i < N_REGISTRATIONS; i++) {
- if((vol_ids[i] = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0)
+ for (i = 0; i < N_REGISTRATIONS; i++) {
+ if ((vol_ids[i] = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
}
/* The connector should be registered now */
- if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
- if(FALSE == is_registered)
+ if (FALSE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector was not registered");
/* Unregister the connector */
- for(i = 0; i < N_REGISTRATIONS; i++) {
- if(H5VLunregister_connector(vol_ids[i]) < 0)
+ for (i = 0; i < N_REGISTRATIONS; i++) {
+ if (H5VLunregister_connector(vol_ids[i]) < 0)
TEST_ERROR;
/* Also test close on some of the IDs. This call currently works
* identically to unregister.
*/
i++;
- if(H5VLclose(vol_ids[i]) < 0)
+ if (H5VLclose(vol_ids[i]) < 0)
TEST_ERROR;
}
/* The connector should not be registered now */
- if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
/* Repeat testing with the _by_value routines */
- if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
/* Register the connector multiple times */
- for(i = 0; i < N_REGISTRATIONS; i++) {
- if((vol_ids[i] = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0)
+ for (i = 0; i < N_REGISTRATIONS; i++) {
+ if ((vol_ids[i] = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0)
TEST_ERROR;
}
/* The connector should be registered now */
- if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
- if(FALSE == is_registered)
+ if (FALSE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector was not registered");
/* Unregister the connector */
- for(i = 0; i < N_REGISTRATIONS; i++) {
- if(H5VLunregister_connector(vol_ids[i]) < 0)
+ for (i = 0; i < N_REGISTRATIONS; i++) {
+ if (H5VLunregister_connector(vol_ids[i]) < 0)
TEST_ERROR;
/* Also test close on some of the IDs. This call currently works
* identically to unregister.
*/
i++;
- if(H5VLclose(vol_ids[i]) < 0)
+ if (H5VLclose(vol_ids[i]) < 0)
TEST_ERROR;
}
/* The connector should not be registered now */
- if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- for(i = 0; i < N_REGISTRATIONS; i++)
+ H5E_BEGIN_TRY
+ {
+ for (i = 0; i < N_REGISTRATIONS; i++)
H5VLunregister_connector(vol_ids[i]);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_multiple_registration() */
-
/*-------------------------------------------------------------------------
* Function: test_getters()
*
@@ -252,69 +248,70 @@ error:
static herr_t
test_getters(void)
{
- htri_t is_registered = FAIL;
- hid_t vol_id = H5I_INVALID_HID;
- hid_t vol_id_out = H5I_INVALID_HID;
+ htri_t is_registered = FAIL;
+ hid_t vol_id = H5I_INVALID_HID;
+ hid_t vol_id_out = H5I_INVALID_HID;
TESTING("VOL getters");
/* The null VOL connector should not be registered at the start of the test */
- if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
/* Register the connector by name */
- if((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0)
+ if ((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Get the connector's ID by name */
- if((vol_id_out = H5VLget_connector_id_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if ((vol_id_out = H5VLget_connector_id_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
- if(vol_id != vol_id_out)
+ if (vol_id != vol_id_out)
FAIL_PUTS_ERROR("VOL connector IDs don't match");
- if(H5VLclose(vol_id_out) < 0)
+ if (H5VLclose(vol_id_out) < 0)
TEST_ERROR;
/* Unregister the connector */
- if(H5VLunregister_connector(vol_id) < 0)
+ if (H5VLunregister_connector(vol_id) < 0)
TEST_ERROR;
/* Repeat testing with the _by_value routines */
- if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
- if(TRUE == is_registered)
+ if (TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
/* Register the connector by value */
- if((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0)
+ if ((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Get the connector's ID by value */
- if((vol_id_out = H5VLget_connector_id_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ if ((vol_id_out = H5VLget_connector_id_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
- if(vol_id != vol_id_out)
+ if (vol_id != vol_id_out)
FAIL_PUTS_ERROR("VOL connector IDs don't match");
- if(H5VLclose(vol_id_out) < 0)
+ if (H5VLclose(vol_id_out) < 0)
TEST_ERROR;
/* Unregister the connector */
- if(H5VLunregister_connector(vol_id) < 0)
+ if (H5VLunregister_connector(vol_id) < 0)
TEST_ERROR;
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5VLclose(vol_id_out);
H5VLunregister_connector(vol_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_getters() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -333,14 +330,13 @@ main(void)
HDputs("Testing VOL connector plugin functionality.");
- nerrors += test_registration_by_name() < 0 ? 1 : 0;
- nerrors += test_registration_by_value() < 0 ? 1 : 0;
- nerrors += test_multiple_registration() < 0 ? 1 : 0;
- nerrors += test_getters() < 0 ? 1 : 0;
+ nerrors += test_registration_by_name() < 0 ? 1 : 0;
+ nerrors += test_registration_by_value() < 0 ? 1 : 0;
+ nerrors += test_multiple_registration() < 0 ? 1 : 0;
+ nerrors += test_getters() < 0 ? 1 : 0;
- if(nerrors) {
- HDprintf("***** %d VOL connector plugin TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ if (nerrors) {
+ HDprintf("***** %d VOL connector plugin TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
HDexit(EXIT_FAILURE);
}
@@ -349,4 +345,3 @@ main(void)
HDexit(EXIT_SUCCESS);
} /* end main() */
-